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

25 lines (24 loc) 1.26 kB
import React, { useCallback, useMemo } from 'react'; import { useAppSelector } from '../app/hooks'; import { selectKioskConfig } from '../slices'; import { default as KeypadContainer } from './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 = useAppSelector(selectKioskConfig), config = _b.keypadModal, modalContentConfig = _b.modalContent; var handlers = { submit: close }; var keypadHandlers = useMemo(function () { return ({ change: setNotes }); }, [setNotes]); var renderKeypad = useCallback(function () { return (React.createElement(KeypadContainer, { 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 }); }; export default MadeForNotes;