@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.232
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/catalog-organization-card.component.js +1 -0
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
- 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 +88 -6
- 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 +756 -654
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/pos-zones.d.ts +23 -0
- package/src/lib/components/console/pos-zones.js +31 -0
- package/src/lib/components/console/pos-zones.js.map +1 -0
- package/src/lib/components/console/product-editor-dialog.component.js +61 -71
- 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 +23 -20
- 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/console/storefront-tax-summary-card.component.js +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js.map +1 -1
- 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 +68 -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 +171 -2
- package/src/lib/model/commerce-orders.js +26 -16
- 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 +91 -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 +16 -0
- package/src/lib/model/index.js +16 -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/product-write.d.ts +186 -0
- package/src/lib/model/product-write.js +116 -0
- package/src/lib/model/product-write.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 +26 -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/channel-order-updates.d.ts +50 -0
- package/src/lib/server/channel-order-updates.js +290 -0
- package/src/lib/server/channel-order-updates.js.map +1 -0
- package/src/lib/server/channel-orders.d.ts +85 -0
- package/src/lib/server/channel-orders.js +543 -0
- package/src/lib/server/channel-orders.js.map +1 -0
- 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 +309 -0
- package/src/lib/server/product-catalog.js.map +1 -0
- package/src/lib/server/product-drafts.d.ts +5 -1
- package/src/lib/server/product-drafts.js +3 -3
- package/src/lib/server/product-drafts.js.map +1 -1
- package/src/lib/server/product-writer.d.ts +19 -0
- package/src/lib/server/product-writer.js +261 -0
- package/src/lib/server/product-writer.js.map +1 -0
- package/src/lib/server/products-write.d.ts +61 -0
- package/src/lib/server/products-write.js +375 -0
- package/src/lib/server/products-write.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 +143 -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 +136 -0
- package/src/lib/testing/memory-firestore.js +282 -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/products.server.d.ts +5 -0
- package/src/lib/transfer/products.server.js +2 -2
- package/src/lib/transfer/products.server.js.map +1 -1
- 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,289 @@
|
|
|
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
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { Alert, Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, List, ListItemButton, ListItemText, Stack, TextField, Typography } from "@mui/material";
|
|
20
|
+
import { useUser } from "@aglyn/tenant-feature-instance";
|
|
21
|
+
import { useEffect, useRef, useState } from "react";
|
|
22
|
+
import { posMoney } from "../../../model/commerce-pos-ops.js";
|
|
23
|
+
import { callPosOps } from "./pos-ops-api.js";
|
|
24
|
+
/** How long typing pauses before the register asks. */ const SEARCH_DEBOUNCE_MS = 250;
|
|
25
|
+
/**
|
|
26
|
+
* The customer at the register (AGL-3609): search the workspace's people by
|
|
27
|
+
* name, email or phone, see what they have bought here before, attach them
|
|
28
|
+
* to the sale — or add a new one in a few taps. Where the workspace keeps no
|
|
29
|
+
* people, it falls back to an email typed for the receipt.
|
|
30
|
+
*/ export function PosCustomerLookup(props) {
|
|
31
|
+
const { hostId, value, onChange } = props;
|
|
32
|
+
const { data: user } = useUser();
|
|
33
|
+
const [text, setText] = useState('');
|
|
34
|
+
const [results, setResults] = useState([]);
|
|
35
|
+
const [available, setAvailable] = useState(true);
|
|
36
|
+
const [stats, setStats] = useState(null);
|
|
37
|
+
const [adding, setAdding] = useState(false);
|
|
38
|
+
const [draft, setDraft] = useState({
|
|
39
|
+
name: '',
|
|
40
|
+
email: '',
|
|
41
|
+
phone: ''
|
|
42
|
+
});
|
|
43
|
+
const [error, setError] = useState('');
|
|
44
|
+
const [busy, setBusy] = useState(false);
|
|
45
|
+
const latest = useRef(0);
|
|
46
|
+
useEffect(()=>{
|
|
47
|
+
const typed = text.trim();
|
|
48
|
+
if (typed.length < 2 || !user) {
|
|
49
|
+
setResults([]);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const ticket = ++latest.current;
|
|
53
|
+
const timer = window.setTimeout(()=>{
|
|
54
|
+
void callPosOps(user, 'pos-customer', {
|
|
55
|
+
hostId,
|
|
56
|
+
action: 'search',
|
|
57
|
+
text: typed
|
|
58
|
+
}).then((answer)=>{
|
|
59
|
+
var _answer_body_customers;
|
|
60
|
+
if (ticket !== latest.current) return;
|
|
61
|
+
setAvailable(answer.body.available !== false);
|
|
62
|
+
setResults(answer.ok ? (_answer_body_customers = answer.body.customers) != null ? _answer_body_customers : [] : []);
|
|
63
|
+
});
|
|
64
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
65
|
+
return ()=>window.clearTimeout(timer);
|
|
66
|
+
}, [
|
|
67
|
+
text,
|
|
68
|
+
user,
|
|
69
|
+
hostId
|
|
70
|
+
]);
|
|
71
|
+
useEffect(()=>{
|
|
72
|
+
setStats(null);
|
|
73
|
+
if (!(value == null ? void 0 : value.email) || !user) return;
|
|
74
|
+
let active = true;
|
|
75
|
+
void callPosOps(user, 'pos-customer', {
|
|
76
|
+
hostId,
|
|
77
|
+
action: 'stats',
|
|
78
|
+
email: value.email
|
|
79
|
+
}).then((answer)=>{
|
|
80
|
+
if (active && answer.ok) {
|
|
81
|
+
var _answer_body_orderCount, _answer_body_lifetimeSpendCents;
|
|
82
|
+
setStats({
|
|
83
|
+
orderCount: Number((_answer_body_orderCount = answer.body.orderCount) != null ? _answer_body_orderCount : 0),
|
|
84
|
+
lifetimeSpendCents: Number((_answer_body_lifetimeSpendCents = answer.body.lifetimeSpendCents) != null ? _answer_body_lifetimeSpendCents : 0)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return ()=>{
|
|
89
|
+
active = false;
|
|
90
|
+
};
|
|
91
|
+
}, [
|
|
92
|
+
value == null ? void 0 : value.email,
|
|
93
|
+
user,
|
|
94
|
+
hostId
|
|
95
|
+
]);
|
|
96
|
+
const pick = (customer)=>{
|
|
97
|
+
onChange(customer);
|
|
98
|
+
setText('');
|
|
99
|
+
setResults([]);
|
|
100
|
+
};
|
|
101
|
+
const typedEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text.trim()) ? text.trim().toLowerCase() : '';
|
|
102
|
+
const create = async ()=>{
|
|
103
|
+
var _answer_body_error;
|
|
104
|
+
setBusy(true);
|
|
105
|
+
setError('');
|
|
106
|
+
const answer = await callPosOps(user, 'pos-customer', _extends({
|
|
107
|
+
hostId,
|
|
108
|
+
action: 'create'
|
|
109
|
+
}, draft));
|
|
110
|
+
setBusy(false);
|
|
111
|
+
if (!answer.ok || !answer.body.customer) return setError((_answer_body_error = answer.body.error) != null ? _answer_body_error : 'Could not add the customer.');
|
|
112
|
+
pick(answer.body.customer);
|
|
113
|
+
setAdding(false);
|
|
114
|
+
};
|
|
115
|
+
if (value) {
|
|
116
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
117
|
+
direction: "row",
|
|
118
|
+
spacing: 1,
|
|
119
|
+
useFlexGap: true,
|
|
120
|
+
sx: {
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
flexWrap: 'wrap'
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ _jsx(Chip, {
|
|
126
|
+
label: value.name || value.email || 'Customer',
|
|
127
|
+
onDelete: ()=>onChange(null),
|
|
128
|
+
color: "primary",
|
|
129
|
+
variant: "outlined"
|
|
130
|
+
}),
|
|
131
|
+
value.name && value.email ? /*#__PURE__*/ _jsx(Typography, {
|
|
132
|
+
variant: "caption",
|
|
133
|
+
color: "text.secondary",
|
|
134
|
+
children: value.email
|
|
135
|
+
}) : null,
|
|
136
|
+
stats ? /*#__PURE__*/ _jsx(Typography, {
|
|
137
|
+
variant: "caption",
|
|
138
|
+
color: "text.secondary",
|
|
139
|
+
children: stats.orderCount ? `${stats.orderCount} past ${stats.orderCount === 1 ? 'order' : 'orders'} · ${posMoney(stats.lifetimeSpendCents)} spent` : 'First order here'
|
|
140
|
+
}) : null
|
|
141
|
+
]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
145
|
+
spacing: 0.5,
|
|
146
|
+
children: [
|
|
147
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
148
|
+
direction: "row",
|
|
149
|
+
spacing: 1,
|
|
150
|
+
children: [
|
|
151
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
152
|
+
size: "small",
|
|
153
|
+
label: "Customer",
|
|
154
|
+
placeholder: available ? 'Name, email or phone' : 'Email for the receipt',
|
|
155
|
+
value: text,
|
|
156
|
+
onChange: (event)=>setText(event.target.value),
|
|
157
|
+
onKeyDown: (event)=>{
|
|
158
|
+
if (event.key === 'Enter' && !available && typedEmail) {
|
|
159
|
+
pick({
|
|
160
|
+
kind: 'none',
|
|
161
|
+
id: '',
|
|
162
|
+
name: '',
|
|
163
|
+
email: typedEmail,
|
|
164
|
+
phone: null
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
sx: {
|
|
169
|
+
flex: 1
|
|
170
|
+
}
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
173
|
+
size: "small",
|
|
174
|
+
onClick: ()=>{
|
|
175
|
+
setDraft({
|
|
176
|
+
name: '',
|
|
177
|
+
email: typedEmail,
|
|
178
|
+
phone: ''
|
|
179
|
+
});
|
|
180
|
+
setError('');
|
|
181
|
+
setAdding(true);
|
|
182
|
+
},
|
|
183
|
+
children: 'New customer'
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
results.length ? /*#__PURE__*/ _jsx(List, {
|
|
188
|
+
dense: true,
|
|
189
|
+
disablePadding: true,
|
|
190
|
+
children: results.map((customer)=>/*#__PURE__*/ _jsx(ListItemButton, {
|
|
191
|
+
onClick: ()=>pick(customer),
|
|
192
|
+
children: /*#__PURE__*/ _jsx(ListItemText, {
|
|
193
|
+
primary: customer.name || customer.email || 'Unnamed',
|
|
194
|
+
secondary: [
|
|
195
|
+
customer.email,
|
|
196
|
+
customer.phone
|
|
197
|
+
].filter(Boolean).join(' · ')
|
|
198
|
+
})
|
|
199
|
+
}, `${customer.kind}:${customer.id}`))
|
|
200
|
+
}) : null,
|
|
201
|
+
!available && typedEmail ? /*#__PURE__*/ _jsx(Button, {
|
|
202
|
+
size: "small",
|
|
203
|
+
onClick: ()=>pick({
|
|
204
|
+
kind: 'none',
|
|
205
|
+
id: '',
|
|
206
|
+
name: '',
|
|
207
|
+
email: typedEmail,
|
|
208
|
+
phone: null
|
|
209
|
+
}),
|
|
210
|
+
sx: {
|
|
211
|
+
alignSelf: 'flex-start'
|
|
212
|
+
},
|
|
213
|
+
children: `Use ${typedEmail}`
|
|
214
|
+
}) : null,
|
|
215
|
+
/*#__PURE__*/ _jsxs(Dialog, {
|
|
216
|
+
open: adding,
|
|
217
|
+
onClose: ()=>setAdding(false),
|
|
218
|
+
maxWidth: "xs",
|
|
219
|
+
fullWidth: true,
|
|
220
|
+
children: [
|
|
221
|
+
/*#__PURE__*/ _jsx(DialogTitle, {
|
|
222
|
+
children: 'New customer'
|
|
223
|
+
}),
|
|
224
|
+
/*#__PURE__*/ _jsx(DialogContent, {
|
|
225
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
226
|
+
spacing: 2,
|
|
227
|
+
sx: {
|
|
228
|
+
pt: 1
|
|
229
|
+
},
|
|
230
|
+
children: [
|
|
231
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
232
|
+
autoFocus: true,
|
|
233
|
+
label: "Name",
|
|
234
|
+
value: draft.name,
|
|
235
|
+
onChange: (event)=>setDraft(_extends({}, draft, {
|
|
236
|
+
name: event.target.value
|
|
237
|
+
}))
|
|
238
|
+
}),
|
|
239
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
240
|
+
label: "Email",
|
|
241
|
+
type: "email",
|
|
242
|
+
value: draft.email,
|
|
243
|
+
onChange: (event)=>setDraft(_extends({}, draft, {
|
|
244
|
+
email: event.target.value
|
|
245
|
+
}))
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
248
|
+
label: "Phone (optional)",
|
|
249
|
+
type: "tel",
|
|
250
|
+
value: draft.phone,
|
|
251
|
+
onChange: (event)=>setDraft(_extends({}, draft, {
|
|
252
|
+
phone: event.target.value
|
|
253
|
+
}))
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
256
|
+
variant: "caption",
|
|
257
|
+
color: "text.secondary",
|
|
258
|
+
children: 'Adding a customer does not sign them up for marketing email.'
|
|
259
|
+
}),
|
|
260
|
+
error ? /*#__PURE__*/ _jsx(Alert, {
|
|
261
|
+
severity: "warning",
|
|
262
|
+
children: error
|
|
263
|
+
}) : null
|
|
264
|
+
]
|
|
265
|
+
})
|
|
266
|
+
}),
|
|
267
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
268
|
+
children: [
|
|
269
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
270
|
+
onClick: ()=>setAdding(false),
|
|
271
|
+
children: 'Cancel'
|
|
272
|
+
}),
|
|
273
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
274
|
+
variant: "contained",
|
|
275
|
+
disabled: busy,
|
|
276
|
+
onClick: create,
|
|
277
|
+
children: 'Add customer'
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
PosCustomerLookup.displayName = 'PosCustomerLookup';
|
|
287
|
+
export default PosCustomerLookup;
|
|
288
|
+
|
|
289
|
+
//# sourceMappingURL=pos-customer-lookup.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-ops/pos-customer-lookup.component.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\n'use client'\n\nimport {\n Alert,\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n List,\n ListItemButton,\n ListItemText,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport { useEffect, useRef, useState } from 'react'\nimport { posMoney } from '../../../model/commerce-pos-ops'\nimport { callPosOps } from './pos-ops-api'\n\n/** The customer a sale is rung for. `id` is empty when no record system keeps people. */\nexport interface PosSelectedCustomer {\n kind: string\n id: string\n name: string\n email: string | null\n phone: string | null\n}\n\nexport interface PosCustomerLookupProps {\n hostId: string\n value: PosSelectedCustomer | null\n onChange: (customer: PosSelectedCustomer | null) => void\n}\n\n/** How long typing pauses before the register asks. */\nconst SEARCH_DEBOUNCE_MS = 250\n\n/**\n * The customer at the register (AGL-3609): search the workspace's people by\n * name, email or phone, see what they have bought here before, attach them\n * to the sale — or add a new one in a few taps. Where the workspace keeps no\n * people, it falls back to an email typed for the receipt.\n */\nexport function PosCustomerLookup(props: PosCustomerLookupProps) {\n const { hostId, value, onChange } = props\n const { data: user } = useUser()\n const [text, setText] = useState('')\n const [results, setResults] = useState<PosSelectedCustomer[]>([])\n const [available, setAvailable] = useState(true)\n const [stats, setStats] = useState<{ orderCount: number; lifetimeSpendCents: number } | null>(null)\n const [adding, setAdding] = useState(false)\n const [draft, setDraft] = useState({ name: '', email: '', phone: '' })\n const [error, setError] = useState('')\n const [busy, setBusy] = useState(false)\n const latest = useRef(0)\n\n useEffect(() => {\n const typed = text.trim()\n if (typed.length < 2 || !user) {\n setResults([])\n return\n }\n const ticket = ++latest.current\n const timer = window.setTimeout(() => {\n void callPosOps<{ available?: boolean; customers?: PosSelectedCustomer[] }>(user, 'pos-customer', {\n hostId,\n action: 'search',\n text: typed,\n }).then((answer) => {\n if (ticket !== latest.current) return\n setAvailable(answer.body.available !== false)\n setResults(answer.ok ? (answer.body.customers ?? []) : [])\n })\n }, SEARCH_DEBOUNCE_MS)\n return () => window.clearTimeout(timer)\n }, [text, user, hostId])\n\n useEffect(() => {\n setStats(null)\n if (!value?.email || !user) return\n let active = true\n void callPosOps<{ orderCount?: number; lifetimeSpendCents?: number }>(user, 'pos-customer', {\n hostId,\n action: 'stats',\n email: value.email,\n }).then((answer) => {\n if (active && answer.ok) {\n setStats({\n orderCount: Number(answer.body.orderCount ?? 0),\n lifetimeSpendCents: Number(answer.body.lifetimeSpendCents ?? 0),\n })\n }\n })\n return () => {\n active = false\n }\n }, [value?.email, user, hostId])\n\n const pick = (customer: PosSelectedCustomer) => {\n onChange(customer)\n setText('')\n setResults([])\n }\n\n const typedEmail = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(text.trim()) ? text.trim().toLowerCase() : ''\n\n const create = async () => {\n setBusy(true)\n setError('')\n const answer = await callPosOps<{ customer?: PosSelectedCustomer }>(user, 'pos-customer', {\n hostId,\n action: 'create',\n ...draft,\n })\n setBusy(false)\n if (!answer.ok || !answer.body.customer) return setError(answer.body.error ?? 'Could not add the customer.')\n pick(answer.body.customer)\n setAdding(false)\n }\n\n if (value) {\n return (\n <Stack direction=\"row\" spacing={1} useFlexGap sx={{ alignItems: 'center', flexWrap: 'wrap' }}>\n <Chip\n label={value.name || value.email || 'Customer'}\n onDelete={() => onChange(null)}\n color=\"primary\"\n variant=\"outlined\"\n />\n {value.name && value.email ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {value.email}\n </Typography>\n ) : null}\n {stats ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {stats.orderCount\n ? `${stats.orderCount} past ${stats.orderCount === 1 ? 'order' : 'orders'} · ${posMoney(\n stats.lifetimeSpendCents,\n )} spent`\n : 'First order here'}\n </Typography>\n ) : null}\n </Stack>\n )\n }\n\n return (\n <Stack spacing={0.5}>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n size=\"small\"\n label=\"Customer\"\n placeholder={available ? 'Name, email or phone' : 'Email for the receipt'}\n value={text}\n onChange={(event) => setText(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && !available && typedEmail) {\n pick({ kind: 'none', id: '', name: '', email: typedEmail, phone: null })\n }\n }}\n sx={{ flex: 1 }}\n />\n <Button\n size=\"small\"\n onClick={() => {\n setDraft({ name: '', email: typedEmail, phone: '' })\n setError('')\n setAdding(true)\n }}\n >\n {'New customer'}\n </Button>\n </Stack>\n {results.length ? (\n <List dense disablePadding>\n {results.map((customer) => (\n <ListItemButton key={`${customer.kind}:${customer.id}`} onClick={() => pick(customer)}>\n <ListItemText\n primary={customer.name || customer.email || 'Unnamed'}\n secondary={[customer.email, customer.phone].filter(Boolean).join(' · ')}\n />\n </ListItemButton>\n ))}\n </List>\n ) : null}\n {!available && typedEmail ? (\n <Button size=\"small\" onClick={() => pick({ kind: 'none', id: '', name: '', email: typedEmail, phone: null })} sx={{ alignSelf: 'flex-start' }}>\n {`Use ${typedEmail}`}\n </Button>\n ) : null}\n <Dialog open={adding} onClose={() => setAdding(false)} maxWidth=\"xs\" fullWidth>\n <DialogTitle>{'New customer'}</DialogTitle>\n <DialogContent>\n <Stack spacing={2} sx={{ pt: 1 }}>\n <TextField\n autoFocus\n label=\"Name\"\n value={draft.name}\n onChange={(event) => setDraft({ ...draft, name: event.target.value })}\n />\n <TextField\n label=\"Email\"\n type=\"email\"\n value={draft.email}\n onChange={(event) => setDraft({ ...draft, email: event.target.value })}\n />\n <TextField\n label=\"Phone (optional)\"\n type=\"tel\"\n value={draft.phone}\n onChange={(event) => setDraft({ ...draft, phone: event.target.value })}\n />\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'Adding a customer does not sign them up for marketing email.'}\n </Typography>\n {error ? <Alert severity=\"warning\">{error}</Alert> : null}\n </Stack>\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setAdding(false)}>{'Cancel'}</Button>\n <Button variant=\"contained\" disabled={busy} onClick={create}>\n {'Add customer'}\n </Button>\n </DialogActions>\n </Dialog>\n </Stack>\n )\n}\n\nPosCustomerLookup.displayName = 'PosCustomerLookup'\n\nexport default PosCustomerLookup\n"],"names":["Alert","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","List","ListItemButton","ListItemText","Stack","TextField","Typography","useUser","useEffect","useRef","useState","posMoney","callPosOps","SEARCH_DEBOUNCE_MS","PosCustomerLookup","props","hostId","value","onChange","data","user","text","setText","results","setResults","available","setAvailable","stats","setStats","adding","setAdding","draft","setDraft","name","email","phone","error","setError","busy","setBusy","latest","typed","trim","length","ticket","current","timer","window","setTimeout","action","then","answer","body","ok","customers","clearTimeout","active","orderCount","Number","lifetimeSpendCents","pick","customer","typedEmail","test","toLowerCase","create","direction","spacing","useFlexGap","sx","alignItems","flexWrap","label","onDelete","color","variant","size","placeholder","event","target","onKeyDown","key","kind","id","flex","onClick","dense","disablePadding","map","primary","secondary","filter","Boolean","join","alignSelf","open","onClose","maxWidth","fullWidth","pt","autoFocus","type","severity","disabled","displayName"],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
export interface PosLastReceiptProps {
|
|
18
|
+
hostId: string;
|
|
19
|
+
orderId: string;
|
|
20
|
+
registerName?: string;
|
|
21
|
+
/** The cashier's name as the receipt prints it. */
|
|
22
|
+
cashierName?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The register's last sale (AGL-3609): its receipt and gift receipt for the
|
|
26
|
+
* browser's print dialog, read from the stored order — so the printout
|
|
27
|
+
* carries the tenders, tip and change the server recorded, not the basket the
|
|
28
|
+
* register remembers — and the register's cloud printer when it has one.
|
|
29
|
+
*/
|
|
30
|
+
export declare function PosLastReceipt(props: PosLastReceiptProps): import("react").JSX.Element;
|
|
31
|
+
export declare namespace PosLastReceipt {
|
|
32
|
+
var displayName: string;
|
|
33
|
+
}
|
|
34
|
+
export default PosLastReceipt;
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { Stack, Typography } from "@mui/material";
|
|
20
|
+
import { doc } from "firebase/firestore";
|
|
21
|
+
import { useFirestore, useFirestoreDoc } from "@aglyn/tenant-feature-instance";
|
|
22
|
+
import { PosReceiptActions } from "./pos-receipt-actions.component.js";
|
|
23
|
+
/**
|
|
24
|
+
* The register's last sale (AGL-3609): its receipt and gift receipt for the
|
|
25
|
+
* browser's print dialog, read from the stored order — so the printout
|
|
26
|
+
* carries the tenders, tip and change the server recorded, not the basket the
|
|
27
|
+
* register remembers — and the register's cloud printer when it has one.
|
|
28
|
+
*/ export function PosLastReceipt(props) {
|
|
29
|
+
const firestore = useFirestore();
|
|
30
|
+
const { data: order } = useFirestoreDoc(()=>doc(firestore, 'hosts', props.hostId, 'orders', props.orderId), [
|
|
31
|
+
firestore,
|
|
32
|
+
props.hostId,
|
|
33
|
+
props.orderId
|
|
34
|
+
]);
|
|
35
|
+
if (!order) return null;
|
|
36
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
37
|
+
spacing: 0.5,
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
40
|
+
variant: "caption",
|
|
41
|
+
color: "text.secondary",
|
|
42
|
+
children: order.number ? `Last sale #${order.number}` : 'Last sale'
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ _jsx(PosReceiptActions, _extends({
|
|
45
|
+
hostId: props.hostId,
|
|
46
|
+
orderId: props.orderId,
|
|
47
|
+
order: _extends({}, order, props.cashierName ? {
|
|
48
|
+
cashierName: props.cashierName
|
|
49
|
+
} : {})
|
|
50
|
+
}, props.registerName ? {
|
|
51
|
+
registerName: props.registerName
|
|
52
|
+
} : {}, {
|
|
53
|
+
cloudPrint: "sale"
|
|
54
|
+
}))
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
PosLastReceipt.displayName = 'PosLastReceipt';
|
|
59
|
+
export default PosLastReceipt;
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=pos-last-receipt.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-ops/pos-last-receipt.component.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\n'use client'\n\nimport { Stack, Typography } from '@mui/material'\nimport { doc } from 'firebase/firestore'\nimport { useFirestore, useFirestoreDoc } from '@aglyn/tenant-feature-instance'\nimport type { PosReceiptOrder } from '../../../model/commerce-pos-ops'\nimport { PosReceiptActions } from './pos-receipt-actions.component'\n\nexport interface PosLastReceiptProps {\n hostId: string\n orderId: string\n registerName?: string\n /** The cashier's name as the receipt prints it. */\n cashierName?: string\n}\n\n/**\n * The register's last sale (AGL-3609): its receipt and gift receipt for the\n * browser's print dialog, read from the stored order — so the printout\n * carries the tenders, tip and change the server recorded, not the basket the\n * register remembers — and the register's cloud printer when it has one.\n */\nexport function PosLastReceipt(props: PosLastReceiptProps) {\n const firestore = useFirestore()\n const { data: order } = useFirestoreDoc<PosReceiptOrder & { registerId?: string; number?: number }>(\n () => doc(firestore, 'hosts', props.hostId, 'orders', props.orderId),\n [firestore, props.hostId, props.orderId],\n )\n if (!order) return null\n return (\n <Stack spacing={0.5}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {order.number ? `Last sale #${order.number}` : 'Last sale'}\n </Typography>\n <PosReceiptActions\n hostId={props.hostId}\n orderId={props.orderId}\n order={{ ...order, ...(props.cashierName ? { cashierName: props.cashierName } : {}) }}\n {...(props.registerName ? { registerName: props.registerName } : {})}\n cloudPrint=\"sale\"\n />\n </Stack>\n )\n}\n\nPosLastReceipt.displayName = 'PosLastReceipt'\n\nexport default PosLastReceipt\n"],"names":["Stack","Typography","doc","useFirestore","useFirestoreDoc","PosReceiptActions","PosLastReceipt","props","firestore","data","order","hostId","orderId","spacing","variant","color","number","cashierName","registerName","cloudPrint","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,SAASA,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACjD,SAASC,GAAG,QAAQ,qBAAoB;AACxC,SAASC,YAAY,EAAEC,eAAe,QAAQ,iCAAgC;AAE9E,SAASC,iBAAiB,QAAQ,qCAAiC;AAUnE;;;;;CAKC,GACD,OAAO,SAASC,eAAeC,KAA0B;IACvD,MAAMC,YAAYL;IAClB,MAAM,EAAEM,MAAMC,KAAK,EAAE,GAAGN,gBACtB,IAAMF,IAAIM,WAAW,SAASD,MAAMI,MAAM,EAAE,UAAUJ,MAAMK,OAAO,GACnE;QAACJ;QAAWD,MAAMI,MAAM;QAAEJ,MAAMK,OAAO;KAAC;IAE1C,IAAI,CAACF,OAAO,OAAO;IACnB,qBACE,MAACV;QAAMa,SAAS;;0BACd,KAACZ;gBAAWa,SAAQ;gBAAUC,OAAM;0BACjCL,MAAMM,MAAM,GAAG,CAAC,WAAW,EAAEN,MAAMM,MAAM,EAAE,GAAG;;0BAEjD,KAACX;gBACCM,QAAQJ,MAAMI,MAAM;gBACpBC,SAASL,MAAMK,OAAO;gBACtBF,OAAO,aAAKA,OAAWH,MAAMU,WAAW,GAAG;oBAAEA,aAAaV,MAAMU,WAAW;gBAAC,IAAI,CAAC;eAC5EV,MAAMW,YAAY,GAAG;gBAAEA,cAAcX,MAAMW,YAAY;YAAC,IAAI,CAAC;gBAClEC,YAAW;;;;AAInB;AAEAb,eAAec,WAAW,GAAG;AAE7B,eAAed,eAAc"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { PosCashierState } from './use-pos-cashier';
|
|
18
|
+
export interface PosOperationsBarProps {
|
|
19
|
+
hostId: string;
|
|
20
|
+
registerId: string;
|
|
21
|
+
registerName?: string;
|
|
22
|
+
cashier: PosCashierState;
|
|
23
|
+
/** Ring the exchange after a return: a new sale for the same customer. */
|
|
24
|
+
onExchange?: (customer: {
|
|
25
|
+
email: string | null;
|
|
26
|
+
name: string | null;
|
|
27
|
+
}) => void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The register's operations strip (AGL-3609): who is ringing (and a PIN
|
|
31
|
+
* switch to someone else), the shift and drawer, returns, and the lock. Sits
|
|
32
|
+
* above the basket; every control is a tablet-sized button.
|
|
33
|
+
*/
|
|
34
|
+
export declare function PosOperationsBar(props: PosOperationsBarProps): import("react").JSX.Element;
|
|
35
|
+
export declare namespace PosOperationsBar {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
export default PosOperationsBar;
|
|
@@ -0,0 +1,129 @@
|
|
|
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
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { Box, Button, Chip, Stack, Typography } from "@mui/material";
|
|
20
|
+
import { useState } from "react";
|
|
21
|
+
import { PosPinPad } from "./pos-pin-pad.component.js";
|
|
22
|
+
import { PosReturnDialog } from "./pos-return-dialog.component.js";
|
|
23
|
+
import { PosShiftPanel } from "./pos-shift-panel.component.js";
|
|
24
|
+
/**
|
|
25
|
+
* The register's operations strip (AGL-3609): who is ringing (and a PIN
|
|
26
|
+
* switch to someone else), the shift and drawer, returns, and the lock. Sits
|
|
27
|
+
* above the basket; every control is a tablet-sized button.
|
|
28
|
+
*/ export function PosOperationsBar(props) {
|
|
29
|
+
const { hostId, registerId, cashier } = props;
|
|
30
|
+
const [switching, setSwitching] = useState(false);
|
|
31
|
+
const [returning, setReturning] = useState(false);
|
|
32
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
33
|
+
spacing: 1,
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
36
|
+
direction: "row",
|
|
37
|
+
spacing: 1,
|
|
38
|
+
useFlexGap: true,
|
|
39
|
+
sx: {
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
flexWrap: 'wrap'
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
/*#__PURE__*/ _jsx(Chip, _extends({
|
|
45
|
+
size: "small",
|
|
46
|
+
variant: "outlined",
|
|
47
|
+
label: cashier.cashier ? `Cashier: ${cashier.cashier.name}` : 'Cashier: you'
|
|
48
|
+
}, cashier.cashier ? {
|
|
49
|
+
onDelete: cashier.signOutCashier
|
|
50
|
+
} : {})),
|
|
51
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
52
|
+
size: "small",
|
|
53
|
+
onClick: ()=>setSwitching(true),
|
|
54
|
+
disabled: !registerId,
|
|
55
|
+
children: 'Switch cashier'
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
58
|
+
size: "small",
|
|
59
|
+
onClick: cashier.lock,
|
|
60
|
+
disabled: !registerId,
|
|
61
|
+
children: 'Lock'
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
64
|
+
sx: {
|
|
65
|
+
flex: 1
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
69
|
+
size: "small",
|
|
70
|
+
variant: "outlined",
|
|
71
|
+
onClick: ()=>setReturning(true),
|
|
72
|
+
disabled: !registerId,
|
|
73
|
+
children: 'Return'
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
}),
|
|
77
|
+
registerId ? /*#__PURE__*/ _jsx(PosShiftPanel, _extends({
|
|
78
|
+
hostId: hostId,
|
|
79
|
+
registerId: registerId
|
|
80
|
+
}, props.registerName ? {
|
|
81
|
+
registerName: props.registerName
|
|
82
|
+
} : {}, cashier.assertion ? {
|
|
83
|
+
cashierAssertion: cashier.assertion
|
|
84
|
+
} : {})) : null,
|
|
85
|
+
/*#__PURE__*/ _jsx(PosPinPad, {
|
|
86
|
+
open: switching,
|
|
87
|
+
hostId: hostId,
|
|
88
|
+
registerId: registerId,
|
|
89
|
+
purpose: "cashier",
|
|
90
|
+
onClose: ()=>setSwitching(false),
|
|
91
|
+
onVerified: (assertion)=>{
|
|
92
|
+
cashier.switchTo(assertion);
|
|
93
|
+
setSwitching(false);
|
|
94
|
+
}
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsx(PosPinPad, {
|
|
97
|
+
open: cashier.locked,
|
|
98
|
+
hostId: hostId,
|
|
99
|
+
registerId: registerId,
|
|
100
|
+
purpose: "cashier",
|
|
101
|
+
title: "Register locked",
|
|
102
|
+
prompt: "Enter your PIN to use the register.",
|
|
103
|
+
dismissible: false,
|
|
104
|
+
onClose: cashier.unlock,
|
|
105
|
+
onVerified: cashier.switchTo
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ _jsx(PosReturnDialog, _extends({
|
|
108
|
+
open: returning,
|
|
109
|
+
hostId: hostId,
|
|
110
|
+
registerId: registerId
|
|
111
|
+
}, cashier.assertion ? {
|
|
112
|
+
cashierAssertion: cashier.assertion
|
|
113
|
+
} : {}, {
|
|
114
|
+
onClose: ()=>setReturning(false)
|
|
115
|
+
}, props.onExchange ? {
|
|
116
|
+
onExchange: props.onExchange
|
|
117
|
+
} : {})),
|
|
118
|
+
cashier.locked ? /*#__PURE__*/ _jsx(Typography, {
|
|
119
|
+
variant: "caption",
|
|
120
|
+
color: "text.secondary",
|
|
121
|
+
children: 'Locked'
|
|
122
|
+
}) : null
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
PosOperationsBar.displayName = 'PosOperationsBar';
|
|
127
|
+
export default PosOperationsBar;
|
|
128
|
+
|
|
129
|
+
//# sourceMappingURL=pos-operations-bar.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos-ops/pos-operations-bar.component.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\n'use client'\n\nimport { Box, Button, Chip, Stack, Typography } from '@mui/material'\nimport { useState } from 'react'\nimport { PosPinPad } from './pos-pin-pad.component'\nimport { PosReturnDialog } from './pos-return-dialog.component'\nimport { PosShiftPanel } from './pos-shift-panel.component'\nimport type { PosCashierState } from './use-pos-cashier'\n\nexport interface PosOperationsBarProps {\n hostId: string\n registerId: string\n registerName?: string\n cashier: PosCashierState\n /** Ring the exchange after a return: a new sale for the same customer. */\n onExchange?: (customer: { email: string | null; name: string | null }) => void\n}\n\n/**\n * The register's operations strip (AGL-3609): who is ringing (and a PIN\n * switch to someone else), the shift and drawer, returns, and the lock. Sits\n * above the basket; every control is a tablet-sized button.\n */\nexport function PosOperationsBar(props: PosOperationsBarProps) {\n const { hostId, registerId, cashier } = props\n const [switching, setSwitching] = useState(false)\n const [returning, setReturning] = useState(false)\n return (\n <Stack spacing={1}>\n <Stack direction=\"row\" spacing={1} useFlexGap sx={{ alignItems: 'center', flexWrap: 'wrap' }}>\n <Chip\n size=\"small\"\n variant=\"outlined\"\n label={cashier.cashier ? `Cashier: ${cashier.cashier.name}` : 'Cashier: you'}\n {...(cashier.cashier ? { onDelete: cashier.signOutCashier } : {})}\n />\n <Button size=\"small\" onClick={() => setSwitching(true)} disabled={!registerId}>\n {'Switch cashier'}\n </Button>\n <Button size=\"small\" onClick={cashier.lock} disabled={!registerId}>\n {'Lock'}\n </Button>\n <Box sx={{ flex: 1 }} />\n <Button size=\"small\" variant=\"outlined\" onClick={() => setReturning(true)} disabled={!registerId}>\n {'Return'}\n </Button>\n </Stack>\n {registerId ? (\n <PosShiftPanel\n hostId={hostId}\n registerId={registerId}\n {...(props.registerName ? { registerName: props.registerName } : {})}\n {...(cashier.assertion ? { cashierAssertion: cashier.assertion } : {})}\n />\n ) : null}\n <PosPinPad\n open={switching}\n hostId={hostId}\n registerId={registerId}\n purpose=\"cashier\"\n onClose={() => setSwitching(false)}\n onVerified={(assertion) => {\n cashier.switchTo(assertion)\n setSwitching(false)\n }}\n />\n <PosPinPad\n open={cashier.locked}\n hostId={hostId}\n registerId={registerId}\n purpose=\"cashier\"\n title=\"Register locked\"\n prompt=\"Enter your PIN to use the register.\"\n dismissible={false}\n onClose={cashier.unlock}\n onVerified={cashier.switchTo}\n />\n <PosReturnDialog\n open={returning}\n hostId={hostId}\n registerId={registerId}\n {...(cashier.assertion ? { cashierAssertion: cashier.assertion } : {})}\n onClose={() => setReturning(false)}\n {...(props.onExchange ? { onExchange: props.onExchange } : {})}\n />\n {cashier.locked ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'Locked'}\n </Typography>\n ) : null}\n </Stack>\n )\n}\n\nPosOperationsBar.displayName = 'PosOperationsBar'\n\nexport default PosOperationsBar\n"],"names":["Box","Button","Chip","Stack","Typography","useState","PosPinPad","PosReturnDialog","PosShiftPanel","PosOperationsBar","props","hostId","registerId","cashier","switching","setSwitching","returning","setReturning","spacing","direction","useFlexGap","sx","alignItems","flexWrap","size","variant","label","name","onDelete","signOutCashier","onClick","disabled","lock","flex","registerName","assertion","cashierAssertion","open","purpose","onClose","onVerified","switchTo","locked","title","prompt","dismissible","unlock","onExchange","color","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,SAASA,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACpE,SAASC,QAAQ,QAAQ,QAAO;AAChC,SAASC,SAAS,QAAQ,6BAAyB;AACnD,SAASC,eAAe,QAAQ,mCAA+B;AAC/D,SAASC,aAAa,QAAQ,iCAA6B;AAY3D;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE,GAAGH;IACxC,MAAM,CAACI,WAAWC,aAAa,GAAGV,SAAS;IAC3C,MAAM,CAACW,WAAWC,aAAa,GAAGZ,SAAS;IAC3C,qBACE,MAACF;QAAMe,SAAS;;0BACd,MAACf;gBAAMgB,WAAU;gBAAMD,SAAS;gBAAGE,UAAU;gBAACC,IAAI;oBAAEC,YAAY;oBAAUC,UAAU;gBAAO;;kCACzF,KAACrB;wBACCsB,MAAK;wBACLC,SAAQ;wBACRC,OAAOb,QAAQA,OAAO,GAAG,CAAC,SAAS,EAAEA,QAAQA,OAAO,CAACc,IAAI,EAAE,GAAG;uBACzDd,QAAQA,OAAO,GAAG;wBAAEe,UAAUf,QAAQgB,cAAc;oBAAC,IAAI,CAAC;kCAEjE,KAAC5B;wBAAOuB,MAAK;wBAAQM,SAAS,IAAMf,aAAa;wBAAOgB,UAAU,CAACnB;kCAChE;;kCAEH,KAACX;wBAAOuB,MAAK;wBAAQM,SAASjB,QAAQmB,IAAI;wBAAED,UAAU,CAACnB;kCACpD;;kCAEH,KAACZ;wBAAIqB,IAAI;4BAAEY,MAAM;wBAAE;;kCACnB,KAAChC;wBAAOuB,MAAK;wBAAQC,SAAQ;wBAAWK,SAAS,IAAMb,aAAa;wBAAOc,UAAU,CAACnB;kCACnF;;;;YAGJA,2BACC,KAACJ;gBACCG,QAAQA;gBACRC,YAAYA;eACPF,MAAMwB,YAAY,GAAG;gBAAEA,cAAcxB,MAAMwB,YAAY;YAAC,IAAI,CAAC,GAC7DrB,QAAQsB,SAAS,GAAG;gBAAEC,kBAAkBvB,QAAQsB,SAAS;YAAC,IAAI,CAAC,MAEpE;0BACJ,KAAC7B;gBACC+B,MAAMvB;gBACNH,QAAQA;gBACRC,YAAYA;gBACZ0B,SAAQ;gBACRC,SAAS,IAAMxB,aAAa;gBAC5ByB,YAAY,CAACL;oBACXtB,QAAQ4B,QAAQ,CAACN;oBACjBpB,aAAa;gBACf;;0BAEF,KAACT;gBACC+B,MAAMxB,QAAQ6B,MAAM;gBACpB/B,QAAQA;gBACRC,YAAYA;gBACZ0B,SAAQ;gBACRK,OAAM;gBACNC,QAAO;gBACPC,aAAa;gBACbN,SAAS1B,QAAQiC,MAAM;gBACvBN,YAAY3B,QAAQ4B,QAAQ;;0BAE9B,KAAClC;gBACC8B,MAAMrB;gBACNL,QAAQA;gBACRC,YAAYA;eACPC,QAAQsB,SAAS,GAAG;gBAAEC,kBAAkBvB,QAAQsB,SAAS;YAAC,IAAI,CAAC;gBACpEI,SAAS,IAAMtB,aAAa;eACvBP,MAAMqC,UAAU,GAAG;gBAAEA,YAAYrC,MAAMqC,UAAU;YAAC,IAAI,CAAC;YAE7DlC,QAAQ6B,MAAM,iBACb,KAACtC;gBAAWqB,SAAQ;gBAAUuB,OAAM;0BACjC;iBAED;;;AAGV;AAEAvC,iBAAiBwC,WAAW,GAAG;AAE/B,eAAexC,iBAAgB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
/** The register's operations routes (AGL-3609). */
|
|
18
|
+
export type PosOpsRoute = 'pos-shift' | 'pos-staff-pin' | 'pos-customer' | 'pos-return';
|
|
19
|
+
export interface PosOpsAnswer<T = Record<string, any>> {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
status: number;
|
|
22
|
+
body: T & {
|
|
23
|
+
error?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* One call to a register route, answered as data — a refusal is a status and
|
|
28
|
+
* a sentence for the cashier, never a throw the register has to catch. A
|
|
29
|
+
* network failure answers status 0.
|
|
30
|
+
*/
|
|
31
|
+
export declare function callPosOps<T = Record<string, any>>(user: unknown, route: PosOpsRoute, body: Record<string, unknown>, options?: {
|
|
32
|
+
idempotencyKey?: string;
|
|
33
|
+
}): Promise<PosOpsAnswer<T>>;
|
|
34
|
+
/** A fresh attempt id for one tap that moves money or cash. */
|
|
35
|
+
export declare function newPosAttemptKey(): string;
|
|
36
|
+
/** Dollars typed at the register → whole cents, or `null` for not-an-amount. */
|
|
37
|
+
export declare function parsePosDollars(value: string): number | null;
|