UNPKG

@open-tender/store

Version:

A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API

14 lines (13 loc) 869 B
import React, { useCallback } from 'react'; import { useAppSelector } from '../app/hooks'; import { selectKioskConfig } from '../slices'; import { default as RewardContainer } from './Reward'; var Rewards = function (_a) { var title = _a.title, subtitle = _a.subtitle, rewards = _a.rewards, children = _a.children, RewardView = _a.RewardView, AppliedView = _a.AppliedView; var config = useAppSelector(selectKioskConfig).rewards; var renderReward = useCallback(function (reward, index, isLast) { return (React.createElement(RewardContainer, { reward: reward, index: index, isLast: isLast, children: RewardView, AppliedView: AppliedView })); }, [RewardView, AppliedView]); if (!config) return null; return children({ config: config, title: title, subtitle: subtitle, rewards: rewards, renderReward: renderReward }); }; export default Rewards;