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

19 lines (18 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var hooks_1 = require("../app/hooks"); var slices_1 = require("../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 = (0, hooks_1.useAppSelector)(slices_1.selectKiosk).store; var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).accountLoyalty; var account = (0, hooks_1.useAppSelector)(slices_1.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 }); }; exports.default = AccountLoyalty;