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

28 lines (27 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var react_1 = tslib_1.__importStar(require("react")); var hooks_1 = require("../app/hooks"); var slices_1 = require("../slices"); var Keypad_1 = tslib_1.__importDefault(require("./Keypad")); var MadeForNotes = function (_a) { var subtitle = _a.subtitle, hasNotes = _a.hasNotes, notes = _a.notes, setNotes = _a.setNotes, close = _a.close, children = _a.children, KeypadView = _a.KeypadView, title = _a.title; var _b = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig), config = _b.keypadModal, modalContentConfig = _b.modalContent; var handlers = { submit: close }; var keypadHandlers = (0, react_1.useMemo)(function () { return ({ change: setNotes }); }, [setNotes]); var renderKeypad = (0, react_1.useCallback)(function () { return (react_1.default.createElement(Keypad_1.default, { type: "default", handlers: keypadHandlers, value: notes !== null && notes !== void 0 ? notes : '', children: KeypadView })); }, [keypadHandlers, notes, KeypadView]); if (!config || !modalContentConfig || !hasNotes) return null; return children({ config: config, modalContentConfig: modalContentConfig, handlers: handlers, subtitle: subtitle, title: title, renderKeypad: renderKeypad }); }; exports.default = MadeForNotes;