@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/index.js.map +1 -1
- package/src/lib/barcode/barcode-decode.d.ts +71 -0
- package/src/lib/barcode/barcode-decode.js +498 -0
- package/src/lib/barcode/barcode-decode.js.map +1 -0
- package/src/lib/barcode/barcode-encode.d.ts +44 -0
- package/src/lib/barcode/barcode-encode.js +138 -0
- package/src/lib/barcode/barcode-encode.js.map +1 -0
- package/src/lib/barcode/barcode-scanner.component.d.ts +23 -0
- package/src/lib/barcode/barcode-scanner.component.js +260 -0
- package/src/lib/barcode/barcode-scanner.component.js.map +1 -0
- package/src/lib/barcode/scan-button.component.d.ts +10 -0
- package/src/lib/barcode/scan-button.component.js +62 -0
- package/src/lib/barcode/scan-button.component.js.map +1 -0
- package/src/lib/barcode/scanner-wedge.d.ts +35 -0
- package/src/lib/barcode/scanner-wedge.js +108 -0
- package/src/lib/barcode/scanner-wedge.js.map +1 -0
- package/src/lib/components/account.js +10 -1
- package/src/lib/components/account.js.map +1 -1
- package/src/lib/components/cart-extras.d.ts +45 -0
- package/src/lib/components/cart-extras.js +127 -0
- package/src/lib/components/cart-extras.js.map +1 -0
- package/src/lib/components/cart.js +82 -15
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/checkout-return-notice.d.ts +26 -0
- package/src/lib/components/checkout-return-notice.js +48 -0
- package/src/lib/components/checkout-return-notice.js.map +1 -0
- package/src/lib/components/commerce-console-page.js +124 -0
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/commerce-console-sections.d.ts +1 -1
- package/src/lib/components/commerce-console-sections.js +4 -0
- package/src/lib/components/commerce-console-sections.js.map +1 -1
- package/src/lib/components/console/bulk-fulfill.d.ts +44 -0
- package/src/lib/components/console/bulk-fulfill.js +84 -0
- package/src/lib/components/console/bulk-fulfill.js.map +1 -0
- package/src/lib/components/console/customer-notifications-card.component.d.ts +19 -0
- package/src/lib/components/console/customer-notifications-card.component.js +149 -0
- package/src/lib/components/console/customer-notifications-card.component.js.map +1 -0
- package/src/lib/components/console/host-orders-card.component.js +84 -5
- package/src/lib/components/console/host-orders-card.component.js.map +1 -1
- package/src/lib/components/console/locations-card.component.js +164 -57
- package/src/lib/components/console/locations-card.component.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +209 -61
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-fulfillment-panel.component.d.ts +48 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js +542 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -0
- package/src/lib/components/console/order-invoice.component.d.ts +33 -0
- package/src/lib/components/console/order-invoice.component.js +81 -0
- package/src/lib/components/console/order-invoice.component.js.map +1 -0
- package/src/lib/components/console/order-receipt-resend.component.d.ts +21 -0
- package/src/lib/components/console/order-receipt-resend.component.js +203 -0
- package/src/lib/components/console/order-receipt-resend.component.js.map +1 -0
- package/src/lib/components/console/order-returns.component.d.ts +36 -0
- package/src/lib/components/console/order-returns.component.js +142 -0
- package/src/lib/components/console/order-returns.component.js.map +1 -0
- package/src/lib/components/console/order-shipping-actions.component.d.ts +54 -0
- package/src/lib/components/console/order-shipping-actions.component.js +149 -0
- package/src/lib/components/console/order-shipping-actions.component.js.map +1 -0
- package/src/lib/components/console/order-webhooks-card.component.d.ts +50 -0
- package/src/lib/components/console/order-webhooks-card.component.js +623 -0
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -0
- package/src/lib/components/console/order-zones.d.ts +155 -0
- package/src/lib/components/console/order-zones.js +40 -0
- package/src/lib/components/console/order-zones.js.map +1 -0
- package/src/lib/components/console/payment-methods-card.component.d.ts +67 -0
- package/src/lib/components/console/payment-methods-card.component.js +395 -0
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-api.d.ts +124 -0
- package/src/lib/components/console/pos/pos-api.js +101 -0
- package/src/lib/components/console/pos/pos-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +36 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +160 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js +352 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-product-grid.component.d.ts +47 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js +272 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.d.ts +27 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js +282 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +53 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js +445 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.d.ts +31 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js +640 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.d.ts +43 -0
- package/src/lib/components/console/pos/use-pos-display.js +161 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +14 -0
- package/src/lib/components/console/pos-devices-card.component.js +546 -0
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -0
- package/src/lib/components/console/pos-display/brand-screen.d.ts +33 -0
- package/src/lib/components/console/pos-display/brand-screen.js +85 -0
- package/src/lib/components/console/pos-display/brand-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/cart-screen.d.ts +29 -0
- package/src/lib/components/console/pos-display/cart-screen.js +166 -0
- package/src/lib/components/console/pos-display/cart-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pairing-screen.d.ts +24 -0
- package/src/lib/components/console/pos-display/pairing-screen.js +127 -0
- package/src/lib/components/console/pos-display/pairing-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +90 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +140 -0
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -0
- package/src/lib/components/console/pos-display/receipt-screen.d.ts +35 -0
- package/src/lib/components/console/pos-display/receipt-screen.js +200 -0
- package/src/lib/components/console/pos-display/receipt-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/tip-screen.d.ts +36 -0
- package/src/lib/components/console/pos-display/tip-screen.js +211 -0
- package/src/lib/components/console/pos-display/tip-screen.js.map +1 -0
- package/src/lib/components/console/pos-display-page.component.d.ts +16 -0
- package/src/lib/components/console/pos-display-page.component.js +407 -0
- package/src/lib/components/console/pos-display-page.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +289 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js +61 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +38 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +129 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js +60 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.d.ts +48 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js +220 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.d.ts +63 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js +186 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt.d.ts +39 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js +182 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js +465 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.d.ts +29 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js +253 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +494 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js +102 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.d.ts +30 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js +277 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/register-ops.d.ts +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.d.ts +46 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js +128 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.d.ts +36 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js +64 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js.map +1 -0
- package/src/lib/components/console/pos-page.component.d.ts +13 -5
- package/src/lib/components/console/pos-page.component.js +729 -657
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +51 -7
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-labels-dialog.component.d.ts +13 -0
- package/src/lib/components/console/product-labels-dialog.component.js +197 -0
- package/src/lib/components/console/product-labels-dialog.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +19 -0
- package/src/lib/components/console/product-register-fields.component.js +241 -0
- package/src/lib/components/console/product-register-fields.component.js.map +1 -0
- package/src/lib/components/console/product-zones.d.ts +44 -0
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +12 -0
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
- package/src/lib/components/console/register-hardware-card.component.js +826 -0
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
- package/src/lib/components/console/registers-card.component.js +24 -5
- package/src/lib/components/console/registers-card.component.js.map +1 -1
- package/src/lib/components/console/return-actions.d.ts +38 -0
- package/src/lib/components/console/return-actions.js +76 -0
- package/src/lib/components/console/return-actions.js.map +1 -0
- package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
- package/src/lib/components/console/return-detail-dialog.component.js +718 -0
- package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
- package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
- package/src/lib/components/console/return-settings-card.component.js +195 -0
- package/src/lib/components/console/return-settings-card.component.js.map +1 -0
- package/src/lib/components/console/return-zones.d.ts +87 -0
- package/src/lib/components/console/return-zones.js +31 -0
- package/src/lib/components/console/return-zones.js.map +1 -0
- package/src/lib/components/console/returns-card.component.d.ts +45 -0
- package/src/lib/components/console/returns-card.component.js +159 -0
- package/src/lib/components/console/returns-card.component.js.map +1 -0
- package/src/lib/components/console/shipping-settings-card.component.js +161 -5
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
- package/src/lib/components/console/shippingeasy-card.component.js +378 -0
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
- package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
- package/src/lib/components/console/shipstation-card.component.js +345 -0
- package/src/lib/components/console/shipstation-card.component.js.map +1 -0
- package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/start-return-dialog.component.js +243 -0
- package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/stock-movements-card.component.js +2 -1
- package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +2 -66
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-zones.d.ts +42 -0
- package/src/lib/components/console/store-zones.js +39 -0
- package/src/lib/components/console/store-zones.js.map +1 -0
- package/src/lib/components/order-status.d.ts +36 -0
- package/src/lib/components/order-status.js +502 -0
- package/src/lib/components/order-status.js.map +1 -0
- package/src/lib/components/product-detail.js +41 -2
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/return-request.d.ts +32 -0
- package/src/lib/components/return-request.js +576 -0
- package/src/lib/components/return-request.js.map +1 -0
- package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
- package/src/lib/components/storefront-payment-appearance.js +114 -0
- package/src/lib/components/storefront-payment-appearance.js.map +1 -0
- package/src/lib/components/storefront-payment-element.d.ts +57 -1
- package/src/lib/components/storefront-payment-element.js +332 -33
- package/src/lib/components/storefront-payment-element.js.map +1 -1
- package/src/lib/constants/order-status.d.ts +22 -0
- package/src/lib/constants/order-status.js +22 -0
- package/src/lib/constants/order-status.js.map +1 -0
- package/src/lib/constants/return-request.d.ts +27 -0
- package/src/lib/constants/return-request.js +32 -0
- package/src/lib/constants/return-request.js.map +1 -0
- package/src/lib/constants/stock-movement-query.js +2 -1
- package/src/lib/constants/stock-movement-query.js.map +1 -1
- package/src/lib/declarations.console-server.js +9 -0
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.server.d.ts +2 -1
- package/src/lib/declarations.server.js +47 -1
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/buyer-notifications.d.ts +59 -0
- package/src/lib/model/buyer-notifications.js +97 -0
- package/src/lib/model/buyer-notifications.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +127 -1
- package/src/lib/model/commerce-orders.js +24 -15
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-payment-methods.d.ts +146 -0
- package/src/lib/model/commerce-payment-methods.js +247 -0
- package/src/lib/model/commerce-payment-methods.js.map +1 -0
- package/src/lib/model/commerce-pos-ops.d.ts +437 -0
- package/src/lib/model/commerce-pos-ops.js +721 -0
- package/src/lib/model/commerce-pos-ops.js.map +1 -0
- package/src/lib/model/commerce-pos.d.ts +263 -0
- package/src/lib/model/commerce-pos.js +375 -0
- package/src/lib/model/commerce-pos.js.map +1 -0
- package/src/lib/model/commerce-printers.d.ts +211 -0
- package/src/lib/model/commerce-printers.js +181 -0
- package/src/lib/model/commerce-printers.js.map +1 -0
- package/src/lib/model/commerce-receipt.d.ts +97 -0
- package/src/lib/model/commerce-receipt.js +180 -0
- package/src/lib/model/commerce-receipt.js.map +1 -0
- package/src/lib/model/commerce-returns.d.ts +207 -0
- package/src/lib/model/commerce-returns.js +300 -0
- package/src/lib/model/commerce-returns.js.map +1 -0
- package/src/lib/model/commerce-shipping.d.ts +44 -1
- package/src/lib/model/commerce-shipping.js +53 -9
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/commerce-tax-engine.d.ts +90 -0
- package/src/lib/model/commerce-tax-engine.js +129 -0
- package/src/lib/model/commerce-tax-engine.js.map +1 -0
- package/src/lib/model/commerce.d.ts +88 -2
- package/src/lib/model/commerce.js +89 -1
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/index.d.ts +15 -0
- package/src/lib/model/index.js +15 -0
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/model/order-events.d.ts +154 -0
- package/src/lib/model/order-events.js +153 -0
- package/src/lib/model/order-events.js.map +1 -0
- package/src/lib/model/order-fulfillment.d.ts +117 -0
- package/src/lib/model/order-fulfillment.js +217 -0
- package/src/lib/model/order-fulfillment.js.map +1 -0
- package/src/lib/model/order-history.d.ts +58 -0
- package/src/lib/model/order-history.js +22 -0
- package/src/lib/model/order-history.js.map +1 -0
- package/src/lib/model/order-list-fields.d.ts +9 -1
- package/src/lib/model/order-list-fields.js +7 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/order-shipping-export.d.ts +91 -0
- package/src/lib/model/order-shipping-export.js +192 -0
- package/src/lib/model/order-shipping-export.js.map +1 -0
- package/src/lib/model/order-status-view.d.ts +103 -0
- package/src/lib/model/order-status-view.js +156 -0
- package/src/lib/model/order-status-view.js.map +1 -0
- package/src/lib/model/order-webhooks.d.ts +142 -0
- package/src/lib/model/order-webhooks.js +91 -0
- package/src/lib/model/order-webhooks.js.map +1 -0
- package/src/lib/model/product-channel.d.ts +56 -0
- package/src/lib/model/product-channel.js +86 -0
- package/src/lib/model/product-channel.js.map +1 -0
- package/src/lib/model/product-modifiers.d.ts +80 -0
- package/src/lib/model/product-modifiers.js +140 -0
- package/src/lib/model/product-modifiers.js.map +1 -0
- package/src/lib/model/shippingeasy.d.ts +94 -0
- package/src/lib/model/shippingeasy.js +267 -0
- package/src/lib/model/shippingeasy.js.map +1 -0
- package/src/lib/model/shipstation.d.ts +125 -0
- package/src/lib/model/shipstation.js +399 -0
- package/src/lib/model/shipstation.js.map +1 -0
- package/src/lib/model/smart-collection-reads.d.ts +32 -0
- package/src/lib/model/smart-collection-reads.js +63 -0
- package/src/lib/model/smart-collection-reads.js.map +1 -0
- package/src/lib/model/tracking-url.d.ts +74 -0
- package/src/lib/model/tracking-url.js +159 -0
- package/src/lib/model/tracking-url.js.map +1 -0
- package/src/lib/plugin-config.d.ts +13 -0
- package/src/lib/plugin-config.js +77 -5
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +23 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/pos-ops-config.d.ts +39 -0
- package/src/lib/pos-ops-config.js +88 -0
- package/src/lib/pos-ops-config.js.map +1 -0
- package/src/lib/printing/print-document.d.ts +106 -0
- package/src/lib/printing/print-document.js +464 -0
- package/src/lib/printing/print-document.js.map +1 -0
- package/src/lib/printing/product-labels.d.ts +58 -0
- package/src/lib/printing/product-labels.js +116 -0
- package/src/lib/printing/product-labels.js.map +1 -0
- package/src/lib/printing/render-epson.d.ts +57 -0
- package/src/lib/printing/render-epson.js +135 -0
- package/src/lib/printing/render-epson.js.map +1 -0
- package/src/lib/printing/render-star.d.ts +45 -0
- package/src/lib/printing/render-star.js +100 -0
- package/src/lib/printing/render-star.js.map +1 -0
- package/src/lib/printing/render-text.d.ts +25 -0
- package/src/lib/printing/render-text.js +53 -0
- package/src/lib/printing/render-text.js.map +1 -0
- package/src/lib/server/api-v1/openapi.js +27 -4
- package/src/lib/server/api-v1/openapi.js.map +1 -1
- package/src/lib/server/api-v1/order-view.d.ts +67 -0
- package/src/lib/server/api-v1/order-view.js +120 -0
- package/src/lib/server/api-v1/order-view.js.map +1 -0
- package/src/lib/server/api-v1/orders-and-products.js +58 -65
- package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
- package/src/lib/server/billing-webhook.js +135 -28
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +29 -0
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/carrier-rates-availability.d.ts +26 -0
- package/src/lib/server/carrier-rates-availability.js +76 -0
- package/src/lib/server/carrier-rates-availability.js.map +1 -0
- package/src/lib/server/carrier-shipping.d.ts +84 -0
- package/src/lib/server/carrier-shipping.js +135 -0
- package/src/lib/server/carrier-shipping.js.map +1 -0
- package/src/lib/server/cart-checkout.d.ts +2 -0
- package/src/lib/server/cart-checkout.js +226 -22
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/checkout-extras.d.ts +64 -0
- package/src/lib/server/checkout-extras.js +157 -0
- package/src/lib/server/checkout-extras.js.map +1 -0
- package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
- package/src/lib/server/checkout-status.js +111 -0
- package/src/lib/server/checkout-status.js.map +1 -0
- package/src/lib/server/checkout.js +86 -9
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/draft-order.js +34 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.d.ts +127 -10
- package/src/lib/server/fulfill-order.js +451 -49
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/legacy-feed.d.ts +28 -0
- package/src/lib/server/legacy-feed.js +52 -0
- package/src/lib/server/legacy-feed.js.map +1 -0
- package/src/lib/server/native-checkout.d.ts +34 -15
- package/src/lib/server/native-checkout.js +32 -17
- package/src/lib/server/native-checkout.js.map +1 -1
- package/src/lib/server/order-event-host-emit.d.ts +23 -0
- package/src/lib/server/order-event-host-emit.js +30 -0
- package/src/lib/server/order-event-host-emit.js.map +1 -0
- package/src/lib/server/order-event-triggers.d.ts +37 -0
- package/src/lib/server/order-event-triggers.js +119 -0
- package/src/lib/server/order-event-triggers.js.map +1 -0
- package/src/lib/server/order-events.d.ts +62 -0
- package/src/lib/server/order-events.js +109 -0
- package/src/lib/server/order-events.js.map +1 -0
- package/src/lib/server/order-history.d.ts +23 -0
- package/src/lib/server/order-history.js +65 -0
- package/src/lib/server/order-history.js.map +1 -0
- package/src/lib/server/order-notifications.d.ts +185 -0
- package/src/lib/server/order-notifications.js +567 -0
- package/src/lib/server/order-notifications.js.map +1 -0
- package/src/lib/server/order-receipt-send.d.ts +39 -0
- package/src/lib/server/order-receipt-send.js +151 -0
- package/src/lib/server/order-receipt-send.js.map +1 -0
- package/src/lib/server/order-status-token.d.ts +31 -0
- package/src/lib/server/order-status-token.js +75 -0
- package/src/lib/server/order-status-token.js.map +1 -0
- package/src/lib/server/order-status.d.ts +58 -0
- package/src/lib/server/order-status.js +141 -0
- package/src/lib/server/order-status.js.map +1 -0
- package/src/lib/server/order-webhooks.d.ts +108 -0
- package/src/lib/server/order-webhooks.js +622 -0
- package/src/lib/server/order-webhooks.js.map +1 -0
- package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
- package/src/lib/server/orders-shipping-prepare.js +121 -0
- package/src/lib/server/orders-shipping-prepare.js.map +1 -0
- package/src/lib/server/payment-method-domains.d.ts +209 -0
- package/src/lib/server/payment-method-domains.js +444 -0
- package/src/lib/server/payment-method-domains.js.map +1 -0
- package/src/lib/server/payment-methods.d.ts +77 -0
- package/src/lib/server/payment-methods.js +284 -0
- package/src/lib/server/payment-methods.js.map +1 -0
- package/src/lib/server/pos-auth.d.ts +50 -0
- package/src/lib/server/pos-auth.js +121 -0
- package/src/lib/server/pos-auth.js.map +1 -0
- package/src/lib/server/pos-customer.d.ts +49 -0
- package/src/lib/server/pos-customer.js +257 -0
- package/src/lib/server/pos-customer.js.map +1 -0
- package/src/lib/server/pos-display.d.ts +57 -0
- package/src/lib/server/pos-display.js +419 -0
- package/src/lib/server/pos-display.js.map +1 -0
- package/src/lib/server/pos-fee-month.d.ts +34 -0
- package/src/lib/server/pos-fee-month.js +36 -0
- package/src/lib/server/pos-fee-month.js.map +1 -0
- package/src/lib/server/pos-ops-gate.d.ts +161 -0
- package/src/lib/server/pos-ops-gate.js +295 -0
- package/src/lib/server/pos-ops-gate.js.map +1 -0
- package/src/lib/server/pos-ops-routes.d.ts +22 -0
- package/src/lib/server/pos-ops-routes.js +36 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -0
- package/src/lib/server/pos-order.d.ts +1 -18
- package/src/lib/server/pos-order.js +222 -42
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.d.ts +39 -0
- package/src/lib/server/pos-payment.js +922 -0
- package/src/lib/server/pos-payment.js.map +1 -0
- package/src/lib/server/pos-print.d.ts +82 -0
- package/src/lib/server/pos-print.js +193 -0
- package/src/lib/server/pos-print.js.map +1 -0
- package/src/lib/server/pos-readers.d.ts +27 -0
- package/src/lib/server/pos-readers.js +276 -0
- package/src/lib/server/pos-readers.js.map +1 -0
- package/src/lib/server/pos-refund-authority.d.ts +60 -0
- package/src/lib/server/pos-refund-authority.js +72 -0
- package/src/lib/server/pos-refund-authority.js.map +1 -0
- package/src/lib/server/pos-return.d.ts +58 -0
- package/src/lib/server/pos-return.js +891 -0
- package/src/lib/server/pos-return.js.map +1 -0
- package/src/lib/server/pos-sale-stamp.d.ts +66 -0
- package/src/lib/server/pos-sale-stamp.js +84 -0
- package/src/lib/server/pos-sale-stamp.js.map +1 -0
- package/src/lib/server/pos-sale.d.ts +170 -0
- package/src/lib/server/pos-sale.js +461 -0
- package/src/lib/server/pos-sale.js.map +1 -0
- package/src/lib/server/pos-shift.d.ts +45 -0
- package/src/lib/server/pos-shift.js +484 -0
- package/src/lib/server/pos-shift.js.map +1 -0
- package/src/lib/server/pos-staff-pin.d.ts +26 -0
- package/src/lib/server/pos-staff-pin.js +339 -0
- package/src/lib/server/pos-staff-pin.js.map +1 -0
- package/src/lib/server/pos-stripe.d.ts +91 -0
- package/src/lib/server/pos-stripe.js +129 -0
- package/src/lib/server/pos-stripe.js.map +1 -0
- package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
- package/src/lib/server/pos-terminal-connection-token.js +166 -0
- package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
- package/src/lib/server/pos-terminal.d.ts +218 -0
- package/src/lib/server/pos-terminal.js +1014 -0
- package/src/lib/server/pos-terminal.js.map +1 -0
- package/src/lib/server/print-queue.d.ts +124 -0
- package/src/lib/server/print-queue.js +301 -0
- package/src/lib/server/print-queue.js.map +1 -0
- package/src/lib/server/printer-poll.d.ts +75 -0
- package/src/lib/server/printer-poll.js +325 -0
- package/src/lib/server/printer-poll.js.map +1 -0
- package/src/lib/server/printer-secret.d.ts +39 -0
- package/src/lib/server/printer-secret.js +56 -0
- package/src/lib/server/printer-secret.js.map +1 -0
- package/src/lib/server/printers.d.ts +114 -0
- package/src/lib/server/printers.js +546 -0
- package/src/lib/server/printers.js.map +1 -0
- package/src/lib/server/product-catalog.d.ts +42 -0
- package/src/lib/server/product-catalog.js +305 -0
- package/src/lib/server/product-catalog.js.map +1 -0
- package/src/lib/server/refund.js +110 -45
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reserve.js +2 -0
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/return-status-action.d.ts +37 -0
- package/src/lib/server/return-status-action.js +57 -0
- package/src/lib/server/return-status-action.js.map +1 -0
- package/src/lib/server/returns.d.ts +119 -0
- package/src/lib/server/returns.js +938 -0
- package/src/lib/server/returns.js.map +1 -0
- package/src/lib/server/shipment-records.d.ts +36 -0
- package/src/lib/server/shipment-records.js +289 -0
- package/src/lib/server/shipment-records.js.map +1 -0
- package/src/lib/server/shipping-connector-gates.d.ts +40 -0
- package/src/lib/server/shipping-connector-gates.js +97 -0
- package/src/lib/server/shipping-connector-gates.js.map +1 -0
- package/src/lib/server/shipping-connectors.d.ts +29 -0
- package/src/lib/server/shipping-connectors.js +236 -0
- package/src/lib/server/shipping-connectors.js.map +1 -0
- package/src/lib/server/shippingeasy.d.ts +238 -0
- package/src/lib/server/shippingeasy.js +787 -0
- package/src/lib/server/shippingeasy.js.map +1 -0
- package/src/lib/server/shipstation.d.ts +129 -0
- package/src/lib/server/shipstation.js +483 -0
- package/src/lib/server/shipstation.js.map +1 -0
- package/src/lib/server/site-page-resolver.d.ts +5 -0
- package/src/lib/server/site-page-resolver.js +156 -1
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/stock-levels.d.ts +21 -0
- package/src/lib/server/stock-levels.js +263 -0
- package/src/lib/server/stock-levels.js.map +1 -0
- package/src/lib/server/stripe-refund.d.ts +47 -0
- package/src/lib/server/stripe-refund.js +87 -0
- package/src/lib/server/stripe-refund.js.map +1 -0
- package/src/lib/server/supplier-update.js +46 -5
- package/src/lib/server/supplier-update.js.map +1 -1
- package/src/lib/server/tax-engine-quote.d.ts +47 -0
- package/src/lib/server/tax-engine-quote.js +105 -0
- package/src/lib/server/tax-engine-quote.js.map +1 -0
- package/src/lib/server.js +138 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/site.js +12 -0
- package/src/lib/site.js.map +1 -1
- package/src/lib/subprocessors.d.ts +26 -0
- package/src/lib/subprocessors.js +50 -0
- package/src/lib/subprocessors.js.map +1 -0
- package/src/lib/tenant-emails.js +461 -3
- package/src/lib/tenant-emails.js.map +1 -1
- package/src/lib/testing/fake-firestore.d.ts +45 -0
- package/src/lib/testing/fake-firestore.js +189 -0
- package/src/lib/testing/fake-firestore.js.map +1 -0
- package/src/lib/testing/memory-firestore.d.ts +123 -0
- package/src/lib/testing/memory-firestore.js +274 -0
- package/src/lib/testing/memory-firestore.js.map +1 -0
- package/src/lib/testing/pos-ops-harness.d.ts +50 -0
- package/src/lib/testing/pos-ops-harness.js +184 -0
- package/src/lib/testing/pos-ops-harness.js.map +1 -0
- package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
- package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
- package/src/lib/transfer/records-transfer.d.ts +11 -1
- package/src/lib/transfer/records-transfer.js +127 -5
- package/src/lib/transfer/records-transfer.js.map +1 -1
- package/src/lib/transfer/records.server.d.ts +9 -2
- package/src/lib/transfer/records.server.js +58 -7
- package/src/lib/transfer/records.server.js.map +1 -1
- package/src/lib/transfer/register-transfer-resources.js +40 -1
- package/src/lib/transfer/register-transfer-resources.js.map +1 -1
- package/src/lib/transfer/register-transfer-ui.js +4 -1
- package/src/lib/transfer/register-transfer-ui.js.map +1 -1
- package/src/lib/transfer/shipping-presets.d.ts +23 -0
- package/src/lib/transfer/shipping-presets.js +156 -0
- package/src/lib/transfer/shipping-presets.js.map +1 -0
- package/src/lib/transfer/tracking-transfer.d.ts +101 -0
- package/src/lib/transfer/tracking-transfer.js +546 -0
- package/src/lib/transfer/tracking-transfer.js.map +1 -0
- package/src/lib/transfer/tracking.server.d.ts +37 -0
- package/src/lib/transfer/tracking.server.js +393 -0
- package/src/lib/transfer/tracking.server.js.map +1 -0
- package/src/lib/transfer/transfer-keys.d.ts +2 -1
- package/src/lib/transfer/transfer-keys.js +6 -2
- package/src/lib/transfer/transfer-keys.js.map +1 -1
- package/src/lib/utils/code128.d.ts +37 -0
- package/src/lib/utils/code128.js +199 -0
- package/src/lib/utils/code128.js.map +1 -0
- package/src/lib/utils/order-invoice.d.ts +55 -0
- package/src/lib/utils/order-invoice.js +127 -0
- package/src/lib/utils/order-invoice.js.map +1 -0
- package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
- package/src/lib/utils/use-checkout-return-notice.js +78 -0
- package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
- package/src/lib/server/feed.js +0 -69
- package/src/lib/server/feed.js.map +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
/**
|
|
18
|
+
* The customer display's half of `/api/commerce/pos-display` (AGL-3608).
|
|
19
|
+
*
|
|
20
|
+
* Every call carries the DISPLAY token, never a staff session: the screen
|
|
21
|
+
* faces the public, and the token opens one register's display state and
|
|
22
|
+
* nothing else. The route answers 401 when the token is unknown or revoked,
|
|
23
|
+
* which the page reads as "pair again".
|
|
24
|
+
*/ export const POS_DISPLAY_ENDPOINT = '/api/commerce/pos-display';
|
|
25
|
+
/** Where the paired token lives on the device. */ export const POS_DISPLAY_TOKEN_KEY = 'aglyn.posDisplayToken';
|
|
26
|
+
export const POS_DISPLAY_TOKEN_HEADER = 'X-Pos-Display-Token';
|
|
27
|
+
export function readStoredToken() {
|
|
28
|
+
try {
|
|
29
|
+
return window.localStorage.getItem(POS_DISPLAY_TOKEN_KEY) || null;
|
|
30
|
+
} catch (unused) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function storeToken(token) {
|
|
35
|
+
try {
|
|
36
|
+
if (token) window.localStorage.setItem(POS_DISPLAY_TOKEN_KEY, token);
|
|
37
|
+
else window.localStorage.removeItem(POS_DISPLAY_TOKEN_KEY);
|
|
38
|
+
} catch (unused) {
|
|
39
|
+
// Storage blocked (a private window, a locked-down kiosk browser): the
|
|
40
|
+
// display still works until it reloads, then asks for a code again.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function call(init, token) {
|
|
44
|
+
const headers = {};
|
|
45
|
+
if (token) headers[POS_DISPLAY_TOKEN_HEADER] = token;
|
|
46
|
+
if (init.method === 'POST') headers['Content-Type'] = 'application/json';
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetch(init.method === 'GET' ? `${POS_DISPLAY_ENDPOINT}?${init.query}` : POS_DISPLAY_ENDPOINT, _extends({
|
|
49
|
+
method: init.method,
|
|
50
|
+
headers,
|
|
51
|
+
cache: 'no-store'
|
|
52
|
+
}, init.method === 'POST' ? {
|
|
53
|
+
body: JSON.stringify(init.body)
|
|
54
|
+
} : {}));
|
|
55
|
+
const payload = await response.json().catch(()=>null);
|
|
56
|
+
if (!response.ok) {
|
|
57
|
+
var _ref;
|
|
58
|
+
return {
|
|
59
|
+
ok: false,
|
|
60
|
+
status: response.status,
|
|
61
|
+
error: String((_ref = payload == null ? void 0 : payload['error']) != null ? _ref : 'Something went wrong. Try again.')
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
status: response.status,
|
|
67
|
+
value: payload != null ? payload : {}
|
|
68
|
+
};
|
|
69
|
+
} catch (unused) {
|
|
70
|
+
// Offline or the request never landed: status 0, which the poll treats
|
|
71
|
+
// as "try again next tick" rather than as a reason to unpair.
|
|
72
|
+
return {
|
|
73
|
+
ok: false,
|
|
74
|
+
status: 0,
|
|
75
|
+
error: 'No connection. Trying again…'
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export function pairDisplay(code) {
|
|
80
|
+
return call({
|
|
81
|
+
method: 'POST',
|
|
82
|
+
body: {
|
|
83
|
+
action: 'pair',
|
|
84
|
+
code,
|
|
85
|
+
label: 'Customer display'
|
|
86
|
+
}
|
|
87
|
+
}, null);
|
|
88
|
+
}
|
|
89
|
+
export function pollDisplay(token, withBranding) {
|
|
90
|
+
return call({
|
|
91
|
+
method: 'GET',
|
|
92
|
+
query: `action=poll${withBranding ? '&branding=true' : ''}`
|
|
93
|
+
}, token);
|
|
94
|
+
}
|
|
95
|
+
export function respondToDisplay(token, response) {
|
|
96
|
+
return call({
|
|
97
|
+
method: 'POST',
|
|
98
|
+
body: {
|
|
99
|
+
action: 'respond',
|
|
100
|
+
response
|
|
101
|
+
}
|
|
102
|
+
}, token);
|
|
103
|
+
}
|
|
104
|
+
export function forgetDisplay(token) {
|
|
105
|
+
return call({
|
|
106
|
+
method: 'POST',
|
|
107
|
+
body: {
|
|
108
|
+
action: 'forget'
|
|
109
|
+
}
|
|
110
|
+
}, token);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Minor units as the register shows them, in the store's currency (the
|
|
114
|
+
* display state's `currency`; US dollars when a state predates it). A
|
|
115
|
+
* zero-decimal currency (JPY) has no minor unit to divide out.
|
|
116
|
+
*/ export function displayMoney(cents, currency) {
|
|
117
|
+
const code = String(currency || 'usd').toUpperCase();
|
|
118
|
+
const amount = Number(cents) || 0;
|
|
119
|
+
try {
|
|
120
|
+
var _format_resolvedOptions_maximumFractionDigits;
|
|
121
|
+
const format = new Intl.NumberFormat('en-US', {
|
|
122
|
+
style: 'currency',
|
|
123
|
+
currency: code
|
|
124
|
+
});
|
|
125
|
+
const digits = (_format_resolvedOptions_maximumFractionDigits = format.resolvedOptions().maximumFractionDigits) != null ? _format_resolvedOptions_maximumFractionDigits : 2;
|
|
126
|
+
return format.format(amount / 10 ** digits);
|
|
127
|
+
} catch (unused) {
|
|
128
|
+
return `${(amount / 100).toFixed(2)} ${code}`;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Dollars typed on the display as whole cents, or null when the entry is not
|
|
133
|
+
* an amount (`12`, `12.5` and `$12.50` are; `12.505` and `abc` are not).
|
|
134
|
+
*/ export function dollarsToCents(input) {
|
|
135
|
+
const cleaned = String(input != null ? input : '').trim().replace(/^\$/, '');
|
|
136
|
+
if (!/^\d+(\.\d{0,2})?$/.test(cleaned)) return null;
|
|
137
|
+
return Math.round(Number(cleaned) * 100);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=pos-display-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-display/pos-display-api.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as CommerceModel from '../../../model'\n\n/**\n * The customer display's half of `/api/commerce/pos-display` (AGL-3608).\n *\n * Every call carries the DISPLAY token, never a staff session: the screen\n * faces the public, and the token opens one register's display state and\n * nothing else. The route answers 401 when the token is unknown or revoked,\n * which the page reads as \"pair again\".\n */\nexport const POS_DISPLAY_ENDPOINT = '/api/commerce/pos-display'\n\n/** Where the paired token lives on the device. */\nexport const POS_DISPLAY_TOKEN_KEY = 'aglyn.posDisplayToken'\n\nexport const POS_DISPLAY_TOKEN_HEADER = 'X-Pos-Display-Token'\n\n/** The store's look for the idle and thank-you screens. */\nexport interface PosDisplayBranding {\n name: string\n logoUrl: string | null\n logoDarkUrl: string | null\n message: string\n}\n\n/** The state as the route hands it to the display. */\nexport type PosDisplayPublicState = Omit<CommerceModel.PosDisplayState, 'response'> & {\n answered: boolean\n}\n\n/** What the customer sends back for the current prompt. */\nexport interface PosDisplayAnswer {\n promptId: string\n tipChoice?: 'percent' | 'custom' | 'none'\n tipPercent?: number\n tipCents?: number\n receiptChannel?: CommerceModel.PosReceiptChannel\n email?: string\n phone?: string\n marketingOptIn?: boolean\n}\n\n/**\n * A call's outcome, with the status the page branches on: `value` when `ok`,\n * `error` when not. One flat shape rather than a union, because the\n * workspace compiles without `strict` and an `ok` check would not narrow one.\n */\nexport interface PosDisplayResult<T> {\n ok: boolean\n /** The HTTP status, or 0 when the request never landed. */\n status: number\n value?: T\n error?: string\n}\n\nexport function readStoredToken(): string | null {\n try {\n return window.localStorage.getItem(POS_DISPLAY_TOKEN_KEY) || null\n } catch {\n return null\n }\n}\n\nexport function storeToken(token: string | null): void {\n try {\n if (token) window.localStorage.setItem(POS_DISPLAY_TOKEN_KEY, token)\n else window.localStorage.removeItem(POS_DISPLAY_TOKEN_KEY)\n } catch {\n // Storage blocked (a private window, a locked-down kiosk browser): the\n // display still works until it reloads, then asks for a code again.\n }\n}\n\nasync function call<T>(\n init: { method: 'GET'; query: string } | { method: 'POST'; body: Record<string, unknown> },\n token: string | null,\n): Promise<PosDisplayResult<T>> {\n const headers: Record<string, string> = {}\n if (token) headers[POS_DISPLAY_TOKEN_HEADER] = token\n if (init.method === 'POST') headers['Content-Type'] = 'application/json'\n try {\n const response = await fetch(\n init.method === 'GET' ? `${POS_DISPLAY_ENDPOINT}?${init.query}` : POS_DISPLAY_ENDPOINT,\n {\n method: init.method,\n headers,\n cache: 'no-store',\n ...(init.method === 'POST' ? { body: JSON.stringify(init.body) } : {}),\n },\n )\n const payload = (await response.json().catch(() => null)) as Record<string, unknown> | null\n if (!response.ok) {\n return {\n ok: false,\n status: response.status,\n error: String(payload?.['error'] ?? 'Something went wrong. Try again.'),\n }\n }\n return { ok: true, status: response.status, value: (payload ?? {}) as T }\n } catch {\n // Offline or the request never landed: status 0, which the poll treats\n // as \"try again next tick\" rather than as a reason to unpair.\n return { ok: false, status: 0, error: 'No connection. Trying again…' }\n }\n}\n\nexport function pairDisplay(code: string) {\n return call<{ token: string; branding: PosDisplayBranding }>(\n { method: 'POST', body: { action: 'pair', code, label: 'Customer display' } },\n null,\n )\n}\n\nexport function pollDisplay(token: string, withBranding: boolean) {\n return call<{ state: PosDisplayPublicState; branding?: PosDisplayBranding }>(\n { method: 'GET', query: `action=poll${withBranding ? '&branding=true' : ''}` },\n token,\n )\n}\n\nexport function respondToDisplay(token: string, response: PosDisplayAnswer) {\n return call<{ ok: true }>({ method: 'POST', body: { action: 'respond', response } }, token)\n}\n\nexport function forgetDisplay(token: string) {\n return call<{ ok: true }>({ method: 'POST', body: { action: 'forget' } }, token)\n}\n\n/**\n * Minor units as the register shows them, in the store's currency (the\n * display state's `currency`; US dollars when a state predates it). A\n * zero-decimal currency (JPY) has no minor unit to divide out.\n */\nexport function displayMoney(cents: number, currency?: string | null): string {\n const code = String(currency || 'usd').toUpperCase()\n const amount = Number(cents) || 0\n try {\n const format = new Intl.NumberFormat('en-US', { style: 'currency', currency: code })\n const digits = format.resolvedOptions().maximumFractionDigits ?? 2\n return format.format(amount / 10 ** digits)\n } catch {\n return `${(amount / 100).toFixed(2)} ${code}`\n }\n}\n\n/**\n * Dollars typed on the display as whole cents, or null when the entry is not\n * an amount (`12`, `12.5` and `$12.50` are; `12.505` and `abc` are not).\n */\nexport function dollarsToCents(input: string): number | null {\n const cleaned = String(input ?? '').trim().replace(/^\\$/, '')\n if (!/^\\d+(\\.\\d{0,2})?$/.test(cleaned)) return null\n return Math.round(Number(cleaned) * 100)\n}\n"],"names":["POS_DISPLAY_ENDPOINT","POS_DISPLAY_TOKEN_KEY","POS_DISPLAY_TOKEN_HEADER","readStoredToken","window","localStorage","getItem","storeToken","token","setItem","removeItem","call","init","headers","method","response","fetch","query","cache","body","JSON","stringify","payload","json","catch","ok","status","error","String","value","pairDisplay","code","action","label","pollDisplay","withBranding","respondToDisplay","forgetDisplay","displayMoney","cents","currency","toUpperCase","amount","Number","format","Intl","NumberFormat","style","digits","resolvedOptions","maximumFractionDigits","toFixed","dollarsToCents","input","cleaned","trim","replace","test","Math","round"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAID;;;;;;;CAOC,GACD,OAAO,MAAMA,uBAAuB,4BAA2B;AAE/D,gDAAgD,GAChD,OAAO,MAAMC,wBAAwB,wBAAuB;AAE5D,OAAO,MAAMC,2BAA2B,sBAAqB;AAwC7D,OAAO,SAASC;IACd,IAAI;QACF,OAAOC,OAAOC,YAAY,CAACC,OAAO,CAACL,0BAA0B;IAC/D,EAAE,eAAM;QACN,OAAO;IACT;AACF;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|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as CommerceModel from '../../../model';
|
|
18
|
+
import type { PosDisplayAnswer } from './pos-display-api';
|
|
19
|
+
type ReceiptPrompt = NonNullable<CommerceModel.PosDisplayState['receipt']>;
|
|
20
|
+
/**
|
|
21
|
+
* The receipt prompt (AGL-3608). The channels are the register's offer; email
|
|
22
|
+
* and text ask for an address on this screen, and the marketing box is shown
|
|
23
|
+
* only when the store turned it on, unticked, the way checkout words it.
|
|
24
|
+
*
|
|
25
|
+
* What the customer types lives in this component only until it is sent:
|
|
26
|
+
* the inputs empty on submit, and the page unmounts this screen whenever the
|
|
27
|
+
* prompt moves on, so the next customer finds nothing of the last one's.
|
|
28
|
+
*/
|
|
29
|
+
export declare function PosDisplayReceiptScreen({ receipt, promptId, busy, onAnswer, }: {
|
|
30
|
+
receipt: ReceiptPrompt;
|
|
31
|
+
promptId: string;
|
|
32
|
+
busy: boolean;
|
|
33
|
+
onAnswer: (answer: PosDisplayAnswer) => void;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import Button from "@mui/material/Button";
|
|
19
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
20
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
21
|
+
import Stack from "@mui/material/Stack";
|
|
22
|
+
import TextField from "@mui/material/TextField";
|
|
23
|
+
import Typography from "@mui/material/Typography";
|
|
24
|
+
import { useState } from "react";
|
|
25
|
+
import * as CommerceModel from "../../../model/index.js";
|
|
26
|
+
import { posDisplayTouchSx } from "./tip-screen.js";
|
|
27
|
+
const CHANNEL_LABELS = {
|
|
28
|
+
email: 'Email',
|
|
29
|
+
sms: 'Text',
|
|
30
|
+
print: 'Print',
|
|
31
|
+
none: 'No receipt'
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The receipt prompt (AGL-3608). The channels are the register's offer; email
|
|
35
|
+
* and text ask for an address on this screen, and the marketing box is shown
|
|
36
|
+
* only when the store turned it on, unticked, the way checkout words it.
|
|
37
|
+
*
|
|
38
|
+
* What the customer types lives in this component only until it is sent:
|
|
39
|
+
* the inputs empty on submit, and the page unmounts this screen whenever the
|
|
40
|
+
* prompt moves on, so the next customer finds nothing of the last one's.
|
|
41
|
+
*/ export function PosDisplayReceiptScreen({ receipt, promptId, busy, onAnswer }) {
|
|
42
|
+
const [entry, setEntry] = useState(null);
|
|
43
|
+
const [value, setValue] = useState('');
|
|
44
|
+
const [optIn, setOptIn] = useState(false);
|
|
45
|
+
const [problem, setProblem] = useState(null);
|
|
46
|
+
const reset = ()=>{
|
|
47
|
+
setEntry(null);
|
|
48
|
+
setValue('');
|
|
49
|
+
setOptIn(false);
|
|
50
|
+
setProblem(null);
|
|
51
|
+
};
|
|
52
|
+
const submit = (event)=>{
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (entry === 'email') {
|
|
55
|
+
const email = CommerceModel.posDisplayEmail(value);
|
|
56
|
+
if (!email) {
|
|
57
|
+
setProblem('Enter an email address, like name@example.com.');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const marketingOptIn = receipt.offerMarketing && optIn;
|
|
61
|
+
reset();
|
|
62
|
+
onAnswer(_extends({
|
|
63
|
+
promptId,
|
|
64
|
+
receiptChannel: 'email',
|
|
65
|
+
email
|
|
66
|
+
}, marketingOptIn ? {
|
|
67
|
+
marketingOptIn: true
|
|
68
|
+
} : {}));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (entry === 'sms') {
|
|
72
|
+
const phone = CommerceModel.posDisplayPhone(value);
|
|
73
|
+
if (!phone) {
|
|
74
|
+
setProblem('Enter a phone number with its area code.');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
reset();
|
|
78
|
+
onAnswer({
|
|
79
|
+
promptId,
|
|
80
|
+
receiptChannel: 'sms',
|
|
81
|
+
phone
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
if (entry) {
|
|
86
|
+
const email = entry === 'email';
|
|
87
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
88
|
+
component: "form",
|
|
89
|
+
onSubmit: submit,
|
|
90
|
+
spacing: 3,
|
|
91
|
+
sx: {
|
|
92
|
+
width: '100%'
|
|
93
|
+
},
|
|
94
|
+
children: [
|
|
95
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
96
|
+
variant: "h3",
|
|
97
|
+
component: "h1",
|
|
98
|
+
sx: {
|
|
99
|
+
textAlign: 'center'
|
|
100
|
+
},
|
|
101
|
+
children: email ? 'Email receipt' : 'Text receipt'
|
|
102
|
+
}),
|
|
103
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
104
|
+
value: value,
|
|
105
|
+
onChange: (event)=>{
|
|
106
|
+
setValue(event.target.value);
|
|
107
|
+
setProblem(null);
|
|
108
|
+
},
|
|
109
|
+
autoFocus: true,
|
|
110
|
+
autoComplete: "off",
|
|
111
|
+
type: email ? 'email' : 'tel',
|
|
112
|
+
label: email ? 'Email' : 'Mobile number',
|
|
113
|
+
error: Boolean(problem),
|
|
114
|
+
helperText: problem != null ? problem : email ? 'For your receipt' : 'For your receipt by text',
|
|
115
|
+
slotProps: {
|
|
116
|
+
htmlInput: {
|
|
117
|
+
inputMode: email ? 'email' : 'tel'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
sx: (theme)=>({
|
|
121
|
+
'& input': theme.typography.h5
|
|
122
|
+
})
|
|
123
|
+
}),
|
|
124
|
+
email && receipt.offerMarketing ? /*#__PURE__*/ _jsx(FormControlLabel, {
|
|
125
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
126
|
+
checked: optIn,
|
|
127
|
+
onChange: (event)=>setOptIn(event.target.checked)
|
|
128
|
+
}),
|
|
129
|
+
label: /*#__PURE__*/ _jsx(Typography, {
|
|
130
|
+
variant: "h6",
|
|
131
|
+
children: "Email me news and offers"
|
|
132
|
+
})
|
|
133
|
+
}) : null,
|
|
134
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
135
|
+
direction: "row",
|
|
136
|
+
spacing: 2,
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
139
|
+
variant: "outlined",
|
|
140
|
+
size: "large",
|
|
141
|
+
fullWidth: true,
|
|
142
|
+
disabled: busy,
|
|
143
|
+
onClick: reset,
|
|
144
|
+
sx: posDisplayTouchSx,
|
|
145
|
+
children: "Back"
|
|
146
|
+
}),
|
|
147
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
148
|
+
type: "submit",
|
|
149
|
+
variant: "contained",
|
|
150
|
+
size: "large",
|
|
151
|
+
fullWidth: true,
|
|
152
|
+
disabled: busy || !value.trim(),
|
|
153
|
+
sx: posDisplayTouchSx,
|
|
154
|
+
children: "Send"
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
162
|
+
spacing: 3,
|
|
163
|
+
sx: {
|
|
164
|
+
width: '100%'
|
|
165
|
+
},
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
168
|
+
variant: "h3",
|
|
169
|
+
component: "h1",
|
|
170
|
+
sx: {
|
|
171
|
+
textAlign: 'center'
|
|
172
|
+
},
|
|
173
|
+
children: "How would you like your receipt?"
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
176
|
+
spacing: 2,
|
|
177
|
+
children: receipt.channels.map((channel)=>/*#__PURE__*/ _jsx(Button, {
|
|
178
|
+
variant: channel === 'none' ? 'outlined' : 'contained',
|
|
179
|
+
size: "large",
|
|
180
|
+
fullWidth: true,
|
|
181
|
+
disabled: busy,
|
|
182
|
+
onClick: ()=>{
|
|
183
|
+
if (channel === 'email' || channel === 'sms') {
|
|
184
|
+
setEntry(channel);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
onAnswer({
|
|
188
|
+
promptId,
|
|
189
|
+
receiptChannel: channel
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
sx: posDisplayTouchSx,
|
|
193
|
+
children: CHANNEL_LABELS[channel]
|
|
194
|
+
}, channel))
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=receipt-screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-display/receipt-screen.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Button from '@mui/material/Button'\nimport Checkbox from '@mui/material/Checkbox'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Stack from '@mui/material/Stack'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport { type FormEvent, useState } from 'react'\nimport * as CommerceModel from '../../../model'\nimport type { PosDisplayAnswer } from './pos-display-api'\nimport { posDisplayTouchSx } from './tip-screen'\n\ntype ReceiptPrompt = NonNullable<CommerceModel.PosDisplayState['receipt']>\n\nconst CHANNEL_LABELS: Record<CommerceModel.PosReceiptChannel, string> = {\n email: 'Email',\n sms: 'Text',\n print: 'Print',\n none: 'No receipt',\n}\n\n/**\n * The receipt prompt (AGL-3608). The channels are the register's offer; email\n * and text ask for an address on this screen, and the marketing box is shown\n * only when the store turned it on, unticked, the way checkout words it.\n *\n * What the customer types lives in this component only until it is sent:\n * the inputs empty on submit, and the page unmounts this screen whenever the\n * prompt moves on, so the next customer finds nothing of the last one's.\n */\nexport function PosDisplayReceiptScreen({\n receipt,\n promptId,\n busy,\n onAnswer,\n}: {\n receipt: ReceiptPrompt\n promptId: string\n busy: boolean\n onAnswer: (answer: PosDisplayAnswer) => void\n}) {\n const [entry, setEntry] = useState<'email' | 'sms' | null>(null)\n const [value, setValue] = useState('')\n const [optIn, setOptIn] = useState(false)\n const [problem, setProblem] = useState<string | null>(null)\n\n const reset = () => {\n setEntry(null)\n setValue('')\n setOptIn(false)\n setProblem(null)\n }\n\n const submit = (event: FormEvent) => {\n event.preventDefault()\n if (entry === 'email') {\n const email = CommerceModel.posDisplayEmail(value)\n if (!email) {\n setProblem('Enter an email address, like name@example.com.')\n return\n }\n const marketingOptIn = receipt.offerMarketing && optIn\n reset()\n onAnswer({\n promptId,\n receiptChannel: 'email',\n email,\n ...(marketingOptIn ? { marketingOptIn: true } : {}),\n })\n return\n }\n if (entry === 'sms') {\n const phone = CommerceModel.posDisplayPhone(value)\n if (!phone) {\n setProblem('Enter a phone number with its area code.')\n return\n }\n reset()\n onAnswer({ promptId, receiptChannel: 'sms', phone })\n }\n }\n\n if (entry) {\n const email = entry === 'email'\n return (\n <Stack component=\"form\" onSubmit={submit} spacing={3} sx={{ width: '100%' }}>\n <Typography variant=\"h3\" component=\"h1\" sx={{ textAlign: 'center' }}>\n {email ? 'Email receipt' : 'Text receipt'}\n </Typography>\n <TextField\n value={value}\n onChange={(event) => {\n setValue(event.target.value)\n setProblem(null)\n }}\n autoFocus\n autoComplete=\"off\"\n type={email ? 'email' : 'tel'}\n label={email ? 'Email' : 'Mobile number'}\n error={Boolean(problem)}\n helperText={problem ?? (email ? 'For your receipt' : 'For your receipt by text')}\n slotProps={{ htmlInput: { inputMode: email ? 'email' : 'tel' } }}\n sx={(theme) => ({ '& input': theme.typography.h5 })}\n />\n {email && receipt.offerMarketing ? (\n <FormControlLabel\n control={\n <Checkbox checked={optIn} onChange={(event) => setOptIn(event.target.checked)} />\n }\n label={<Typography variant=\"h6\">Email me news and offers</Typography>}\n />\n ) : null}\n <Stack direction=\"row\" spacing={2}>\n <Button\n variant=\"outlined\"\n size=\"large\"\n fullWidth\n disabled={busy}\n onClick={reset}\n sx={posDisplayTouchSx}\n >\n Back\n </Button>\n <Button\n type=\"submit\"\n variant=\"contained\"\n size=\"large\"\n fullWidth\n disabled={busy || !value.trim()}\n sx={posDisplayTouchSx}\n >\n Send\n </Button>\n </Stack>\n </Stack>\n )\n }\n\n return (\n <Stack spacing={3} sx={{ width: '100%' }}>\n <Typography variant=\"h3\" component=\"h1\" sx={{ textAlign: 'center' }}>\n How would you like your receipt?\n </Typography>\n <Stack spacing={2}>\n {receipt.channels.map((channel) => (\n <Button\n key={channel}\n variant={channel === 'none' ? 'outlined' : 'contained'}\n size=\"large\"\n fullWidth\n disabled={busy}\n onClick={() => {\n if (channel === 'email' || channel === 'sms') {\n setEntry(channel)\n return\n }\n onAnswer({ promptId, receiptChannel: channel })\n }}\n sx={posDisplayTouchSx}\n >\n {CHANNEL_LABELS[channel]}\n </Button>\n ))}\n </Stack>\n </Stack>\n )\n}\n"],"names":["Button","Checkbox","FormControlLabel","Stack","TextField","Typography","useState","CommerceModel","posDisplayTouchSx","CHANNEL_LABELS","email","sms","print","none","PosDisplayReceiptScreen","receipt","promptId","busy","onAnswer","entry","setEntry","value","setValue","optIn","setOptIn","problem","setProblem","reset","submit","event","preventDefault","posDisplayEmail","marketingOptIn","offerMarketing","receiptChannel","phone","posDisplayPhone","component","onSubmit","spacing","sx","width","variant","textAlign","onChange","target","autoFocus","autoComplete","type","label","error","Boolean","helperText","slotProps","htmlInput","inputMode","theme","typography","h5","control","checked","direction","size","fullWidth","disabled","onClick","trim","channels","map","channel"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,YAAY,uBAAsB;AACzC,OAAOC,cAAc,yBAAwB;AAC7C,OAAOC,sBAAsB,iCAAgC;AAC7D,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,gBAAgB,2BAA0B;AACjD,SAAyBC,QAAQ,QAAQ,QAAO;AAChD,YAAYC,mBAAmB,0BAAgB;AAE/C,SAASC,iBAAiB,QAAQ,kBAAc;AAIhD,MAAMC,iBAAkE;IACtEC,OAAO;IACPC,KAAK;IACLC,OAAO;IACPC,MAAM;A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AAY,OAAO;gCAC5CjD,SAASiD;gCACT;4BACF;4BACAnD,SAAS;gCAAEF;gCAAUkB,gBAAgBmC;4BAAQ;wBAC/C;wBACA7B,IAAIhC;kCAEHC,cAAc,CAAC4D,QAAQ;uBAdnBA;;;;AAoBjB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { CSSObject, Theme } from '@mui/material/styles';
|
|
18
|
+
import * as CommerceModel from '../../../model';
|
|
19
|
+
import { type PosDisplayAnswer } from './pos-display-api';
|
|
20
|
+
type TipPrompt = NonNullable<CommerceModel.PosDisplayState['tip']>;
|
|
21
|
+
/** A tall, full-width touch target. */
|
|
22
|
+
export declare const posDisplayTouchSx: (theme: Theme) => CSSObject;
|
|
23
|
+
/**
|
|
24
|
+
* The tip prompt (AGL-3608): the merchant's presets, each with the amount it
|
|
25
|
+
* comes to, a custom amount and no tip. The server recomputes a percentage
|
|
26
|
+
* from the prompt it sent, so what is shown here is never what is charged.
|
|
27
|
+
*/
|
|
28
|
+
export declare function PosDisplayTipScreen({ tip, promptId, busy, currency, onAnswer, }: {
|
|
29
|
+
tip: TipPrompt;
|
|
30
|
+
promptId: string;
|
|
31
|
+
busy: boolean;
|
|
32
|
+
/** The store's currency, from the display state. */
|
|
33
|
+
currency?: string;
|
|
34
|
+
onAnswer: (answer: PosDisplayAnswer) => void;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import Button from "@mui/material/Button";
|
|
19
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
20
|
+
import Stack from "@mui/material/Stack";
|
|
21
|
+
import TextField from "@mui/material/TextField";
|
|
22
|
+
import Typography from "@mui/material/Typography";
|
|
23
|
+
import { useState } from "react";
|
|
24
|
+
import * as CommerceModel from "../../../model/index.js";
|
|
25
|
+
import { displayMoney, dollarsToCents } from "./pos-display-api.js";
|
|
26
|
+
/** A tall, full-width touch target. */ export const posDisplayTouchSx = (theme)=>_extends({
|
|
27
|
+
minHeight: theme.spacing(10)
|
|
28
|
+
}, theme.typography.h5);
|
|
29
|
+
/**
|
|
30
|
+
* The tip prompt (AGL-3608): the merchant's presets, each with the amount it
|
|
31
|
+
* comes to, a custom amount and no tip. The server recomputes a percentage
|
|
32
|
+
* from the prompt it sent, so what is shown here is never what is charged.
|
|
33
|
+
*/ export function PosDisplayTipScreen({ tip, promptId, busy, currency, onAnswer }) {
|
|
34
|
+
const [custom, setCustom] = useState(null);
|
|
35
|
+
const [problem, setProblem] = useState(null);
|
|
36
|
+
const submitCustom = (event)=>{
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
const cents = dollarsToCents(custom != null ? custom : '');
|
|
39
|
+
const error = cents === null ? 'Enter an amount, like 5 or 5.50.' : CommerceModel.posTipProblem(cents, tip.baseCents);
|
|
40
|
+
if (cents === null || error) {
|
|
41
|
+
setProblem(error);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setCustom(null);
|
|
45
|
+
setProblem(null);
|
|
46
|
+
onAnswer({
|
|
47
|
+
promptId,
|
|
48
|
+
tipChoice: 'custom',
|
|
49
|
+
tipCents: cents
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
if (custom !== null) {
|
|
53
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
54
|
+
component: "form",
|
|
55
|
+
onSubmit: submitCustom,
|
|
56
|
+
spacing: 3,
|
|
57
|
+
sx: {
|
|
58
|
+
width: '100%'
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
62
|
+
variant: "h3",
|
|
63
|
+
component: "h1",
|
|
64
|
+
sx: {
|
|
65
|
+
textAlign: 'center'
|
|
66
|
+
},
|
|
67
|
+
children: "Custom tip"
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
70
|
+
value: custom,
|
|
71
|
+
onChange: (event)=>{
|
|
72
|
+
setCustom(event.target.value);
|
|
73
|
+
setProblem(null);
|
|
74
|
+
},
|
|
75
|
+
autoFocus: true,
|
|
76
|
+
error: Boolean(problem),
|
|
77
|
+
helperText: problem != null ? problem : `Up to ${displayMoney(tip.baseCents, currency)}`,
|
|
78
|
+
slotProps: {
|
|
79
|
+
input: {
|
|
80
|
+
startAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
|
|
81
|
+
position: "start",
|
|
82
|
+
children: "$"
|
|
83
|
+
})
|
|
84
|
+
},
|
|
85
|
+
htmlInput: {
|
|
86
|
+
inputMode: 'decimal',
|
|
87
|
+
'aria-label': 'Tip amount'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
sx: (theme)=>({
|
|
91
|
+
'& input': theme.typography.h4
|
|
92
|
+
})
|
|
93
|
+
}),
|
|
94
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
95
|
+
direction: "row",
|
|
96
|
+
spacing: 2,
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
99
|
+
variant: "outlined",
|
|
100
|
+
size: "large",
|
|
101
|
+
fullWidth: true,
|
|
102
|
+
disabled: busy,
|
|
103
|
+
onClick: ()=>{
|
|
104
|
+
setCustom(null);
|
|
105
|
+
setProblem(null);
|
|
106
|
+
},
|
|
107
|
+
sx: posDisplayTouchSx,
|
|
108
|
+
children: "Back"
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
111
|
+
type: "submit",
|
|
112
|
+
variant: "contained",
|
|
113
|
+
size: "large",
|
|
114
|
+
fullWidth: true,
|
|
115
|
+
disabled: busy || !custom,
|
|
116
|
+
sx: posDisplayTouchSx,
|
|
117
|
+
children: "Add tip"
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
125
|
+
spacing: 3,
|
|
126
|
+
sx: {
|
|
127
|
+
width: '100%'
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
131
|
+
variant: "h3",
|
|
132
|
+
component: "h1",
|
|
133
|
+
sx: {
|
|
134
|
+
textAlign: 'center'
|
|
135
|
+
},
|
|
136
|
+
children: "Add a tip?"
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
139
|
+
variant: "h6",
|
|
140
|
+
color: "text.secondary",
|
|
141
|
+
sx: {
|
|
142
|
+
textAlign: 'center'
|
|
143
|
+
},
|
|
144
|
+
children: `On ${displayMoney(tip.baseCents, currency)}`
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
147
|
+
direction: {
|
|
148
|
+
xs: 'column',
|
|
149
|
+
sm: 'row'
|
|
150
|
+
},
|
|
151
|
+
spacing: 2,
|
|
152
|
+
children: tip.percentages.map((percent)=>/*#__PURE__*/ _jsxs(Button, {
|
|
153
|
+
variant: "contained",
|
|
154
|
+
size: "large",
|
|
155
|
+
fullWidth: true,
|
|
156
|
+
disabled: busy,
|
|
157
|
+
onClick: ()=>onAnswer({
|
|
158
|
+
promptId,
|
|
159
|
+
tipChoice: 'percent',
|
|
160
|
+
tipPercent: percent
|
|
161
|
+
}),
|
|
162
|
+
sx: (theme)=>_extends({}, posDisplayTouchSx(theme), {
|
|
163
|
+
flexDirection: 'column'
|
|
164
|
+
}),
|
|
165
|
+
children: [
|
|
166
|
+
/*#__PURE__*/ _jsx("span", {
|
|
167
|
+
children: `${percent}%`
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
170
|
+
variant: "body1",
|
|
171
|
+
component: "span",
|
|
172
|
+
children: displayMoney(CommerceModel.posTipFromPercent(tip.baseCents, percent), currency)
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
}, percent))
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
178
|
+
direction: {
|
|
179
|
+
xs: 'column',
|
|
180
|
+
sm: 'row'
|
|
181
|
+
},
|
|
182
|
+
spacing: 2,
|
|
183
|
+
children: [
|
|
184
|
+
tip.allowCustom ? /*#__PURE__*/ _jsx(Button, {
|
|
185
|
+
variant: "outlined",
|
|
186
|
+
size: "large",
|
|
187
|
+
fullWidth: true,
|
|
188
|
+
disabled: busy,
|
|
189
|
+
onClick: ()=>setCustom(''),
|
|
190
|
+
sx: posDisplayTouchSx,
|
|
191
|
+
children: "Custom amount"
|
|
192
|
+
}) : null,
|
|
193
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
194
|
+
variant: "outlined",
|
|
195
|
+
size: "large",
|
|
196
|
+
fullWidth: true,
|
|
197
|
+
disabled: busy,
|
|
198
|
+
onClick: ()=>onAnswer({
|
|
199
|
+
promptId,
|
|
200
|
+
tipChoice: 'none'
|
|
201
|
+
}),
|
|
202
|
+
sx: posDisplayTouchSx,
|
|
203
|
+
children: "No tip"
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=tip-screen.js.map
|