@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
17 lines (16 loc) • 1.06 kB
JavaScript
import { useAppSelector } from '../app/hooks';
import { selectCustomer, selectKiosk, selectKioskConfig } from '../slices';
var AccountLoyalty = function (_a) {
var _b;
var loyaltyProgram = _a.loyaltyProgram, navigate = _a.navigate, children = _a.children, renderRewards = _a.renderRewards, navigateTo = _a.navigateTo;
var store = useAppSelector(selectKiosk).store;
var config = useAppSelector(selectKioskConfig).accountLoyalty;
var account = useAppSelector(selectCustomer).account;
var hasLoyalty = (_b = store === null || store === void 0 ? void 0 : store.has_loyalty) !== null && _b !== void 0 ? _b : false;
var startOrder = function () { return navigate(navigateTo !== null && navigateTo !== void 0 ? navigateTo : '/menu'); };
var handlers = { startOrder: startOrder };
if (!config || !account || !loyaltyProgram || !hasLoyalty)
return null;
return children({ config: config, handlers: handlers, account: account, loyaltyProgram: loyaltyProgram, renderRewards: renderRewards });
};
export default AccountLoyalty;