@aglyn/plugins-commerce 1.0.0-beta.229 → 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 +58 -2
- package/src/lib/components/console/product-zones.js +10 -2
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +51 -11
- 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 +44 -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-ai-capability.d.ts +42 -0
- package/src/lib/server/product-ai-capability.js +159 -0
- package/src/lib/server/product-ai-capability.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/product-drafts.d.ts +119 -0
- package/src/lib/server/product-drafts.js +384 -0
- package/src/lib/server/product-drafts.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 +146 -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/utils/use-storefront-purchase-event.js +4 -0
- package/src/lib/utils/use-storefront-purchase-event.js.map +1 -1
- package/src/lib/server/feed.js +0 -69
- package/src/lib/server/feed.js.map +0 -1
|
@@ -0,0 +1,197 @@
|
|
|
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 { Button, Dialog, DialogActions, DialogContent, DialogTitle, MenuItem, Stack, TextField, Typography } from "@mui/material";
|
|
20
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
21
|
+
import { useEffect, useMemo, useState } from "react";
|
|
22
|
+
import { LABEL_SIZES, MAX_LABEL_COPIES, productLabelsHtml, productLabelsZpl } from "../../printing/product-labels.js";
|
|
23
|
+
/**
|
|
24
|
+
* Print product labels (AGL-3619): a label per variant with its name,
|
|
25
|
+
* options, price and a barcode the register scans back, on a thermal label
|
|
26
|
+
* printer through the browser, or as ZPL for a Zebra.
|
|
27
|
+
*/ const COPIES_INPUT = {
|
|
28
|
+
htmlInput: {
|
|
29
|
+
inputMode: 'numeric',
|
|
30
|
+
min: 0,
|
|
31
|
+
max: MAX_LABEL_COPIES
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** The labels a product prints: one row per variant that has a barcode or SKU. */ export function productLabelRows(product) {
|
|
35
|
+
return product.variants.map((variant)=>{
|
|
36
|
+
var _variant_options;
|
|
37
|
+
const options = Object.values((_variant_options = variant.options) != null ? _variant_options : {}).filter(Boolean);
|
|
38
|
+
return _extends({
|
|
39
|
+
variantId: variant.id,
|
|
40
|
+
name: product.name
|
|
41
|
+
}, options.length ? {
|
|
42
|
+
detail: options.join(' / ')
|
|
43
|
+
} : {}, Number.isFinite(Number(variant.priceUsd)) ? {
|
|
44
|
+
priceCents: Math.round(Number(variant.priceUsd) * 100)
|
|
45
|
+
} : {}, {
|
|
46
|
+
currency: 'usd',
|
|
47
|
+
code: String(variant.barcode || variant.sku || '').trim(),
|
|
48
|
+
copies: 1
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function ProductLabelsDialog(props) {
|
|
53
|
+
var _ref;
|
|
54
|
+
const { product, onClose } = props;
|
|
55
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
56
|
+
const initial = useMemo(()=>product ? productLabelRows(product) : [], [
|
|
57
|
+
product
|
|
58
|
+
]);
|
|
59
|
+
const [rows, setRows] = useState(initial);
|
|
60
|
+
const [sizeId, setSizeId] = useState(LABEL_SIZES[0].id);
|
|
61
|
+
useEffect(()=>setRows(initial), [
|
|
62
|
+
initial
|
|
63
|
+
]);
|
|
64
|
+
const printable = rows.filter((row)=>row.code && row.copies > 0);
|
|
65
|
+
const total = printable.reduce((sum, row)=>sum + row.copies, 0);
|
|
66
|
+
const setCopies = (variantId, value)=>setRows((current)=>current.map((row)=>row.variantId === variantId ? _extends({}, row, {
|
|
67
|
+
copies: Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0)))
|
|
68
|
+
}) : row));
|
|
69
|
+
const print = ()=>{
|
|
70
|
+
const win = window.open('', '_blank', 'width=480,height=640');
|
|
71
|
+
if (!win) {
|
|
72
|
+
return void enqueueSnackbar('Allow pop-ups for this site to print labels', {
|
|
73
|
+
variant: 'warning',
|
|
74
|
+
persist: false
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// Every merchant-authored value on the page is escaped by the renderer.
|
|
78
|
+
win.document.write(productLabelsHtml(printable, sizeId));
|
|
79
|
+
win.document.close();
|
|
80
|
+
win.focus();
|
|
81
|
+
win.print();
|
|
82
|
+
};
|
|
83
|
+
const downloadZpl = ()=>{
|
|
84
|
+
var _ref;
|
|
85
|
+
const blob = new Blob([
|
|
86
|
+
productLabelsZpl(printable, sizeId)
|
|
87
|
+
], {
|
|
88
|
+
type: 'text/plain'
|
|
89
|
+
});
|
|
90
|
+
const url = URL.createObjectURL(blob);
|
|
91
|
+
const link = document.createElement('a');
|
|
92
|
+
link.href = url;
|
|
93
|
+
link.download = `labels-${((_ref = product == null ? void 0 : product.name) != null ? _ref : 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`;
|
|
94
|
+
link.click();
|
|
95
|
+
setTimeout(()=>URL.revokeObjectURL(url), 1000);
|
|
96
|
+
};
|
|
97
|
+
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
98
|
+
open: Boolean(product),
|
|
99
|
+
onClose: onClose,
|
|
100
|
+
fullWidth: true,
|
|
101
|
+
maxWidth: "sm",
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ _jsx(DialogTitle, {
|
|
104
|
+
children: `Labels — ${(_ref = product == null ? void 0 : product.name) != null ? _ref : ''}`
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ _jsx(DialogContent, {
|
|
107
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
108
|
+
spacing: 2,
|
|
109
|
+
sx: {
|
|
110
|
+
pt: 1
|
|
111
|
+
},
|
|
112
|
+
children: [
|
|
113
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
114
|
+
select: true,
|
|
115
|
+
label: "Label size",
|
|
116
|
+
value: sizeId,
|
|
117
|
+
onChange: (event)=>setSizeId(event.target.value),
|
|
118
|
+
children: LABEL_SIZES.map((size)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
119
|
+
value: size.id,
|
|
120
|
+
children: size.label
|
|
121
|
+
}, size.id))
|
|
122
|
+
}),
|
|
123
|
+
rows.map((row)=>{
|
|
124
|
+
var _row_detail;
|
|
125
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
126
|
+
direction: "row",
|
|
127
|
+
spacing: 2,
|
|
128
|
+
sx: {
|
|
129
|
+
alignItems: 'center'
|
|
130
|
+
},
|
|
131
|
+
children: [
|
|
132
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
133
|
+
sx: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
minWidth: 0
|
|
136
|
+
},
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
139
|
+
variant: "body2",
|
|
140
|
+
noWrap: true,
|
|
141
|
+
children: (_row_detail = row.detail) != null ? _row_detail : row.name
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
144
|
+
variant: "caption",
|
|
145
|
+
color: row.code ? 'text.secondary' : 'warning.main',
|
|
146
|
+
noWrap: true,
|
|
147
|
+
children: row.code || 'Add a barcode or SKU to print a label'
|
|
148
|
+
})
|
|
149
|
+
]
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
152
|
+
label: "Copies",
|
|
153
|
+
type: "number",
|
|
154
|
+
size: "small",
|
|
155
|
+
value: row.code ? row.copies : 0,
|
|
156
|
+
disabled: !row.code,
|
|
157
|
+
onChange: (event)=>setCopies(row.variantId, event.target.value),
|
|
158
|
+
slotProps: COPIES_INPUT,
|
|
159
|
+
sx: {
|
|
160
|
+
width: 96
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}, row.variantId);
|
|
165
|
+
}),
|
|
166
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
167
|
+
variant: "body2",
|
|
168
|
+
color: "text.secondary",
|
|
169
|
+
children: 'Print to a label printer at 100% scale, or download ZPL to send straight to a Zebra.'
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
})
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
175
|
+
children: [
|
|
176
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
177
|
+
onClick: onClose,
|
|
178
|
+
children: 'Cancel'
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
181
|
+
disabled: !total,
|
|
182
|
+
onClick: downloadZpl,
|
|
183
|
+
children: 'Download ZPL'
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
186
|
+
disabled: !total,
|
|
187
|
+
onClick: print,
|
|
188
|
+
children: total === 1 ? 'Print 1 label' : `Print ${total} labels`
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
export default ProductLabelsDialog;
|
|
196
|
+
|
|
197
|
+
//# sourceMappingURL=product-labels-dialog.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-labels-dialog.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'use client'\n\nimport * as CommerceModel from '../../model'\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n LABEL_SIZES,\n MAX_LABEL_COPIES,\n productLabelsHtml,\n productLabelsZpl,\n type ProductLabel,\n} from '../../printing/product-labels'\n\n/**\n * Print product labels (AGL-3619): a label per variant with its name,\n * options, price and a barcode the register scans back, on a thermal label\n * printer through the browser, or as ZPL for a Zebra.\n */\n\nconst COPIES_INPUT = { htmlInput: { inputMode: 'numeric', min: 0, max: MAX_LABEL_COPIES } } as const\n\n/** The labels a product prints: one row per variant that has a barcode or SKU. */\nexport function productLabelRows(product: CommerceModel.HostProduct): Array<ProductLabel & { variantId: string }> {\n return product.variants.map((variant) => {\n const options = Object.values(variant.options ?? {}).filter(Boolean)\n return {\n variantId: variant.id,\n name: product.name,\n ...(options.length ? { detail: options.join(' / ') } : {}),\n ...(Number.isFinite(Number(variant.priceUsd))\n ? { priceCents: Math.round(Number(variant.priceUsd) * 100) }\n : {}),\n currency: 'usd',\n code: String(variant.barcode || variant.sku || '').trim(),\n copies: 1,\n }\n })\n}\n\nexport function ProductLabelsDialog(props: {\n product: (CommerceModel.HostProduct & { $id: string }) | null\n onClose: () => void\n}) {\n const { product, onClose } = props\n const { enqueueSnackbar } = useSnackbar()\n const initial = useMemo(() => (product ? productLabelRows(product) : []), [product])\n const [rows, setRows] = useState(initial)\n const [sizeId, setSizeId] = useState(LABEL_SIZES[0].id)\n useEffect(() => setRows(initial), [initial])\n const printable = rows.filter((row) => row.code && row.copies > 0)\n const total = printable.reduce((sum, row) => sum + row.copies, 0)\n\n const setCopies = (variantId: string, value: string) =>\n setRows((current) =>\n current.map((row) =>\n row.variantId === variantId\n ? { ...row, copies: Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0))) }\n : row,\n ),\n )\n\n const print = () => {\n const win = window.open('', '_blank', 'width=480,height=640')\n if (!win) {\n return void enqueueSnackbar('Allow pop-ups for this site to print labels', {\n variant: 'warning',\n persist: false,\n })\n }\n // Every merchant-authored value on the page is escaped by the renderer.\n win.document.write(productLabelsHtml(printable, sizeId))\n win.document.close()\n win.focus()\n win.print()\n }\n\n const downloadZpl = () => {\n const blob = new Blob([productLabelsZpl(printable, sizeId)], { type: 'text/plain' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = `labels-${(product?.name ?? 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`\n link.click()\n setTimeout(() => URL.revokeObjectURL(url), 1000)\n }\n\n return (\n <Dialog open={Boolean(product)} onClose={onClose} fullWidth maxWidth=\"sm\">\n <DialogTitle>{`Labels — ${product?.name ?? ''}`}</DialogTitle>\n <DialogContent>\n <Stack spacing={2} sx={{ pt: 1 }}>\n <TextField select label=\"Label size\" value={sizeId} onChange={(event) => setSizeId(event.target.value)}>\n {LABEL_SIZES.map((size) => (\n <MenuItem key={size.id} value={size.id}>\n {size.label}\n </MenuItem>\n ))}\n </TextField>\n {rows.map((row) => (\n <Stack key={row.variantId} direction=\"row\" spacing={2} sx={{ alignItems: 'center' }}>\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.detail ?? row.name}\n </Typography>\n <Typography variant=\"caption\" color={row.code ? 'text.secondary' : 'warning.main'} noWrap>\n {row.code || 'Add a barcode or SKU to print a label'}\n </Typography>\n </Stack>\n <TextField\n label=\"Copies\"\n type=\"number\"\n size=\"small\"\n value={row.code ? row.copies : 0}\n disabled={!row.code}\n onChange={(event) => setCopies(row.variantId, event.target.value)}\n slotProps={COPIES_INPUT}\n sx={{ width: 96 }}\n />\n </Stack>\n ))}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Print to a label printer at 100% scale, or download ZPL to send straight to a Zebra.'}\n </Typography>\n </Stack>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose}>{'Cancel'}</Button>\n <Button disabled={!total} onClick={downloadZpl}>\n {'Download ZPL'}\n </Button>\n <Button disabled={!total} onClick={print}>\n {total === 1 ? 'Print 1 label' : `Print ${total} labels`}\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n\nexport default ProductLabelsDialog\n"],"names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","MenuItem","Stack","TextField","Typography","useSnackbar","useEffect","useMemo","useState","LABEL_SIZES","MAX_LABEL_COPIES","productLabelsHtml","productLabelsZpl","COPIES_INPUT","htmlInput","inputMode","min","max","productLabelRows","product","variants","map","variant","options","Object","values","filter","Boolean","variantId","id","name","length","detail","join","Number","isFinite","priceUsd","priceCents","Math","round","currency","code","String","barcode","sku","trim","copies","ProductLabelsDialog","props","onClose","enqueueSnackbar","initial","rows","setRows","sizeId","setSizeId","printable","row","total","reduce","sum","setCopies","value","current","floor","print","win","window","open","persist","document","write","close","focus","downloadZpl","blob","Blob","type","url","URL","createObjectURL","link","createElement","href","download","replace","toLowerCase","click","setTimeout","revokeObjectURL","fullWidth","maxWidth","spacing","sx","pt","select","label","onChange","event","target","size","direction","alignItems","flex","minWidth","noWrap","color","disabled","slotProps","width","onClick"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,SACEA,MAAM,EACNC,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SACEC,WAAW,EACXC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QAEX,mCAA+B;AAEtC;;;;CAIC,GAED,MAAMC,eAAe;IAAEC,WAAW;QAAEC,WAAW;QAAWC,KAAK;QAAGC,KAAKP;IAAiB;AAAE;AAE1F,gFAAgF,GAChF,OAAO,SAASQ,iBAAiBC,OAAkC;IACjE,OAAOA,QAAQC,QAAQ,CAACC,GAAG,CAAC,CAACC;YACGA;QAA9B,MAAMC,UAAUC,OAAOC,MAAM,EAACH,mBAAAA,QAAQC,OAAO,YAAfD,mBAAmB,CAAC,GAAGI,MAAM,CAACC;QAC5D,OAAO;YACLC,WAAWN,QAAQO,EAAE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zBuB,KAAK/B,GAAG,CAAC,CAACoC;gCAIFA;iDAHP,MAACvD;gCAA0BmG,WAAU;gCAAMT,SAAS;gCAAGC,IAAI;oCAAES,YAAY;gCAAS;;kDAChF,MAACpG;wCAAM2F,IAAI;4CAAEU,MAAM;4CAAGC,UAAU;wCAAE;;0DAChC,KAACpG;gDAAWkB,SAAQ;gDAAQmF,MAAM;2DAC/BhD,cAAAA,IAAIzB,MAAM,YAAVyB,cAAcA,IAAI3B,IAAI;;0DAEzB,KAAC1B;gDAAWkB,SAAQ;gDAAUoF,OAAOjD,IAAIhB,IAAI,GAAG,mBAAmB;gDAAgBgE,MAAM;0DACtFhD,IAAIhB,IAAI,IAAI;;;;kDAGjB,KAACtC;wCACC6F,OAAM;wCACNnB,MAAK;wCACLuB,MAAK;wCACLtC,OAAOL,IAAIhB,IAAI,GAAGgB,IAAIX,MAAM,GAAG;wCAC/B6D,UAAU,CAAClD,IAAIhB,IAAI;wCACnBwD,UAAU,CAACC,QAAUrC,UAAUJ,IAAI7B,SAAS,EAAEsE,MAAMC,MAAM,CAACrC,KAAK;wCAChE8C,WAAW/F;wCACXgF,IAAI;4CAAEgB,OAAO;wCAAG;;;+BAjBRpD,IAAI7B,SAAS;;sCAqB3B,KAACxB;4BAAWkB,SAAQ;4BAAQoF,OAAM;sCAC/B;;;;;0BAIP,MAAC5G;;kCACC,KAACF;wBAAOkH,SAAS7D;kCAAU;;kCAC3B,KAACrD;wBAAO+G,UAAU,CAACjD;wBAAOoD,SAASpC;kCAChC;;kCAEH,KAAC9E;wBAAO+G,UAAU,CAACjD;wBAAOoD,SAAS7C;kCAChCP,UAAU,IAAI,kBAAkB,CAAC,MAAM,EAAEA,MAAM,OAAO,CAAC;;;;;;AAKlE;AAEA,eAAeX,oBAAmB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as CommerceModel from '../../model';
|
|
2
|
+
type Patch = Partial<CommerceModel.HostProduct>;
|
|
3
|
+
export interface ProductRegisterFieldsProps {
|
|
4
|
+
posQuickKey: boolean;
|
|
5
|
+
modifierGroups: readonly CommerceModel.ProductModifierGroup[];
|
|
6
|
+
update: (patch: Patch) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The product's register settings (AGL-3607): whether it is a quick key on
|
|
10
|
+
* the register's first screen, and its modifier groups — choices such as
|
|
11
|
+
* "Milk" or "Add-ons" the cashier picks as the item is rung up, each choice
|
|
12
|
+
* free or with a price added to the item. A group with a minimum of 1 or
|
|
13
|
+
* more must be answered before the item can be added.
|
|
14
|
+
*
|
|
15
|
+
* Memoized on its own props like every section of this editor (AGL-3423):
|
|
16
|
+
* a keystroke elsewhere in the dialog does not redraw it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ProductRegisterFields: import("react").MemoExoticComponent<(props: ProductRegisterFieldsProps) => import("react").JSX.Element>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,241 @@
|
|
|
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, FormControlLabel, IconButton, Stack, Switch, TextField, Typography } from "@mui/material";
|
|
20
|
+
import { memo, useCallback } from "react";
|
|
21
|
+
import * as CommerceModel from "../../model/index.js";
|
|
22
|
+
function newId(prefix) {
|
|
23
|
+
return `${prefix}${Math.random().toString(36).slice(2, 10)}`;
|
|
24
|
+
}
|
|
25
|
+
/** Dollars as typed, to whole cents; blank is free. */ function centsFromDollars(value) {
|
|
26
|
+
const number = Math.round(Number(String(value).replace(/[^0-9.]/g, '')) * 100);
|
|
27
|
+
return Number.isFinite(number) && number > 0 ? number : 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The product's register settings (AGL-3607): whether it is a quick key on
|
|
31
|
+
* the register's first screen, and its modifier groups — choices such as
|
|
32
|
+
* "Milk" or "Add-ons" the cashier picks as the item is rung up, each choice
|
|
33
|
+
* free or with a price added to the item. A group with a minimum of 1 or
|
|
34
|
+
* more must be answered before the item can be added.
|
|
35
|
+
*
|
|
36
|
+
* Memoized on its own props like every section of this editor (AGL-3423):
|
|
37
|
+
* a keystroke elsewhere in the dialog does not redraw it.
|
|
38
|
+
*/ export const ProductRegisterFields = /*#__PURE__*/ memo(function ProductRegisterFields(props) {
|
|
39
|
+
const { modifierGroups, update } = props;
|
|
40
|
+
const setGroups = useCallback((groups)=>update({
|
|
41
|
+
modifierGroups: groups
|
|
42
|
+
}), [
|
|
43
|
+
update
|
|
44
|
+
]);
|
|
45
|
+
const editGroup = (index, patch)=>setGroups(modifierGroups.map((group, at)=>at === index ? _extends({}, group, patch) : group));
|
|
46
|
+
const editOption = (groupIndex, optionIndex, patch)=>{
|
|
47
|
+
const group = modifierGroups[groupIndex];
|
|
48
|
+
editGroup(groupIndex, {
|
|
49
|
+
options: group.options.map((option, at)=>at === optionIndex ? _extends({}, option, patch) : option)
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const problem = CommerceModel.modifierGroupsProblem(modifierGroups);
|
|
53
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
54
|
+
spacing: 2,
|
|
55
|
+
children: [
|
|
56
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
57
|
+
variant: "subtitle1",
|
|
58
|
+
component: "h3",
|
|
59
|
+
children: 'At the register'
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
62
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
63
|
+
checked: props.posQuickKey,
|
|
64
|
+
onChange: (event)=>update({
|
|
65
|
+
posQuickKey: event.target.checked
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
68
|
+
label: "Quick key at the register"
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
71
|
+
variant: "body2",
|
|
72
|
+
color: "text.secondary",
|
|
73
|
+
children: 'Modifiers are choices added as the item is rung up, such as a milk or an extra shot. ' + 'Each can be free or add to the price.'
|
|
74
|
+
}),
|
|
75
|
+
modifierGroups.map((group, groupIndex)=>/*#__PURE__*/ _jsx(Box, {
|
|
76
|
+
role: "group",
|
|
77
|
+
"aria-label": group.name || 'Modifier group',
|
|
78
|
+
sx: {
|
|
79
|
+
border: 1,
|
|
80
|
+
borderColor: 'divider',
|
|
81
|
+
borderRadius: 1,
|
|
82
|
+
p: 2
|
|
83
|
+
},
|
|
84
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
85
|
+
spacing: 1.5,
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
88
|
+
direction: "row",
|
|
89
|
+
spacing: 1,
|
|
90
|
+
sx: {
|
|
91
|
+
alignItems: 'flex-start'
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
95
|
+
label: "Group name",
|
|
96
|
+
size: "small",
|
|
97
|
+
value: group.name,
|
|
98
|
+
onChange: (event)=>editGroup(groupIndex, {
|
|
99
|
+
name: event.target.value
|
|
100
|
+
}),
|
|
101
|
+
sx: {
|
|
102
|
+
flex: 1
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
106
|
+
label: "At least",
|
|
107
|
+
size: "small",
|
|
108
|
+
value: group.min,
|
|
109
|
+
onChange: (event)=>editGroup(groupIndex, {
|
|
110
|
+
min: Math.max(0, Math.round(Number(event.target.value) || 0))
|
|
111
|
+
}),
|
|
112
|
+
helperText: group.min > 0 ? 'Required' : 'Optional',
|
|
113
|
+
sx: {
|
|
114
|
+
width: 96
|
|
115
|
+
},
|
|
116
|
+
slotProps: {
|
|
117
|
+
htmlInput: {
|
|
118
|
+
inputMode: 'numeric'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
123
|
+
label: "At most",
|
|
124
|
+
size: "small",
|
|
125
|
+
value: group.max,
|
|
126
|
+
onChange: (event)=>editGroup(groupIndex, {
|
|
127
|
+
max: Math.max(1, Math.round(Number(event.target.value) || 1))
|
|
128
|
+
}),
|
|
129
|
+
sx: {
|
|
130
|
+
width: 96
|
|
131
|
+
},
|
|
132
|
+
slotProps: {
|
|
133
|
+
htmlInput: {
|
|
134
|
+
inputMode: 'numeric'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
139
|
+
color: "error",
|
|
140
|
+
onClick: ()=>setGroups(modifierGroups.filter((_group, at)=>at !== groupIndex)),
|
|
141
|
+
children: 'Remove group'
|
|
142
|
+
})
|
|
143
|
+
]
|
|
144
|
+
}),
|
|
145
|
+
group.options.map((option, optionIndex)=>/*#__PURE__*/ _jsxs(Stack, {
|
|
146
|
+
direction: "row",
|
|
147
|
+
spacing: 1,
|
|
148
|
+
sx: {
|
|
149
|
+
alignItems: 'center'
|
|
150
|
+
},
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
153
|
+
label: "Choice",
|
|
154
|
+
size: "small",
|
|
155
|
+
value: option.name,
|
|
156
|
+
onChange: (event)=>editOption(groupIndex, optionIndex, {
|
|
157
|
+
name: event.target.value
|
|
158
|
+
}),
|
|
159
|
+
sx: {
|
|
160
|
+
flex: 1
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
164
|
+
label: "Adds ($)",
|
|
165
|
+
size: "small",
|
|
166
|
+
defaultValue: option.priceCents ? (option.priceCents / 100).toFixed(2) : '',
|
|
167
|
+
placeholder: "0.00",
|
|
168
|
+
onBlur: (event)=>editOption(groupIndex, optionIndex, {
|
|
169
|
+
priceCents: centsFromDollars(event.target.value)
|
|
170
|
+
}),
|
|
171
|
+
sx: {
|
|
172
|
+
width: 120
|
|
173
|
+
},
|
|
174
|
+
slotProps: {
|
|
175
|
+
htmlInput: {
|
|
176
|
+
inputMode: 'decimal'
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
181
|
+
"aria-label": `Remove ${option.name || 'choice'}`,
|
|
182
|
+
onClick: ()=>editGroup(groupIndex, {
|
|
183
|
+
options: group.options.filter((_option, at)=>at !== optionIndex),
|
|
184
|
+
max: Math.max(1, Math.min(group.max, group.options.length - 1))
|
|
185
|
+
}),
|
|
186
|
+
children: '✕'
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}, option.id)),
|
|
190
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
191
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
192
|
+
onClick: ()=>editGroup(groupIndex, {
|
|
193
|
+
options: [
|
|
194
|
+
...group.options,
|
|
195
|
+
{
|
|
196
|
+
id: newId('o'),
|
|
197
|
+
name: '',
|
|
198
|
+
priceCents: 0
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}),
|
|
202
|
+
disabled: group.options.length >= CommerceModel.POS_MAX_MODIFIER_OPTIONS,
|
|
203
|
+
children: 'Add choice'
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
]
|
|
207
|
+
})
|
|
208
|
+
}, group.id)),
|
|
209
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
210
|
+
children: /*#__PURE__*/ _jsx(Button, {
|
|
211
|
+
variant: "outlined",
|
|
212
|
+
onClick: ()=>setGroups([
|
|
213
|
+
...modifierGroups,
|
|
214
|
+
{
|
|
215
|
+
id: newId('g'),
|
|
216
|
+
name: '',
|
|
217
|
+
min: 0,
|
|
218
|
+
max: 1,
|
|
219
|
+
options: [
|
|
220
|
+
{
|
|
221
|
+
id: newId('o'),
|
|
222
|
+
name: '',
|
|
223
|
+
priceCents: 0
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
]),
|
|
228
|
+
disabled: modifierGroups.length >= CommerceModel.POS_MAX_MODIFIER_GROUPS,
|
|
229
|
+
children: 'Add modifier group'
|
|
230
|
+
})
|
|
231
|
+
}),
|
|
232
|
+
problem && modifierGroups.length ? /*#__PURE__*/ _jsx(Typography, {
|
|
233
|
+
variant: "body2",
|
|
234
|
+
color: "warning.main",
|
|
235
|
+
children: problem
|
|
236
|
+
}) : null
|
|
237
|
+
]
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=product-register-fields.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-register-fields.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'use client'\n\nimport {\n Box,\n Button,\n FormControlLabel,\n IconButton,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { memo, useCallback } from 'react'\nimport * as CommerceModel from '../../model'\n\ntype Patch = Partial<CommerceModel.HostProduct>\n\nexport interface ProductRegisterFieldsProps {\n posQuickKey: boolean\n modifierGroups: readonly CommerceModel.ProductModifierGroup[]\n update: (patch: Patch) => void\n}\n\nfunction newId(prefix: string): string {\n return `${prefix}${Math.random().toString(36).slice(2, 10)}`\n}\n\n/** Dollars as typed, to whole cents; blank is free. */\nfunction centsFromDollars(value: string): number {\n const number = Math.round(Number(String(value).replace(/[^0-9.]/g, '')) * 100)\n return Number.isFinite(number) && number > 0 ? number : 0\n}\n\n/**\n * The product's register settings (AGL-3607): whether it is a quick key on\n * the register's first screen, and its modifier groups — choices such as\n * \"Milk\" or \"Add-ons\" the cashier picks as the item is rung up, each choice\n * free or with a price added to the item. A group with a minimum of 1 or\n * more must be answered before the item can be added.\n *\n * Memoized on its own props like every section of this editor (AGL-3423):\n * a keystroke elsewhere in the dialog does not redraw it.\n */\nexport const ProductRegisterFields = memo(function ProductRegisterFields(\n props: ProductRegisterFieldsProps,\n) {\n const { modifierGroups, update } = props\n const setGroups = useCallback(\n (groups: CommerceModel.ProductModifierGroup[]) => update({ modifierGroups: groups }),\n [update],\n )\n const editGroup = (index: number, patch: Partial<CommerceModel.ProductModifierGroup>) =>\n setGroups(modifierGroups.map((group, at) => (at === index ? { ...group, ...patch } : group)))\n const editOption = (\n groupIndex: number,\n optionIndex: number,\n patch: Partial<CommerceModel.ProductModifierOption>,\n ) => {\n const group = modifierGroups[groupIndex]\n editGroup(groupIndex, {\n options: group.options.map((option, at) => (at === optionIndex ? { ...option, ...patch } : option)),\n })\n }\n const problem = CommerceModel.modifierGroupsProblem(modifierGroups)\n\n return (\n <Stack spacing={2}>\n <Typography variant=\"subtitle1\" component=\"h3\">\n {'At the register'}\n </Typography>\n <FormControlLabel\n control={\n <Switch\n checked={props.posQuickKey}\n onChange={(event) => update({ posQuickKey: event.target.checked })}\n />\n }\n label=\"Quick key at the register\"\n />\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Modifiers are choices added as the item is rung up, such as a milk or an extra shot. ' +\n 'Each can be free or add to the price.'}\n </Typography>\n {modifierGroups.map((group, groupIndex) => (\n <Box\n key={group.id}\n role=\"group\"\n aria-label={group.name || 'Modifier group'}\n sx={{ border: 1, borderColor: 'divider', borderRadius: 1, p: 2 }}\n >\n <Stack spacing={1.5}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n label=\"Group name\"\n size=\"small\"\n value={group.name}\n onChange={(event) => editGroup(groupIndex, { name: event.target.value })}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"At least\"\n size=\"small\"\n value={group.min}\n onChange={(event) =>\n editGroup(groupIndex, { min: Math.max(0, Math.round(Number(event.target.value) || 0)) })\n }\n helperText={group.min > 0 ? 'Required' : 'Optional'}\n sx={{ width: 96 }}\n slotProps={{ htmlInput: { inputMode: 'numeric' } }}\n />\n <TextField\n label=\"At most\"\n size=\"small\"\n value={group.max}\n onChange={(event) =>\n editGroup(groupIndex, { max: Math.max(1, Math.round(Number(event.target.value) || 1)) })\n }\n sx={{ width: 96 }}\n slotProps={{ htmlInput: { inputMode: 'numeric' } }}\n />\n <Button\n color=\"error\"\n onClick={() => setGroups(modifierGroups.filter((_group, at) => at !== groupIndex))}\n >\n {'Remove group'}\n </Button>\n </Stack>\n {group.options.map((option, optionIndex) => (\n <Stack key={option.id} direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n label=\"Choice\"\n size=\"small\"\n value={option.name}\n onChange={(event) => editOption(groupIndex, optionIndex, { name: event.target.value })}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Adds ($)\"\n size=\"small\"\n defaultValue={option.priceCents ? (option.priceCents / 100).toFixed(2) : ''}\n placeholder=\"0.00\"\n onBlur={(event) =>\n editOption(groupIndex, optionIndex, { priceCents: centsFromDollars(event.target.value) })\n }\n sx={{ width: 120 }}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <IconButton\n aria-label={`Remove ${option.name || 'choice'}`}\n onClick={() =>\n editGroup(groupIndex, {\n options: group.options.filter((_option, at) => at !== optionIndex),\n max: Math.max(1, Math.min(group.max, group.options.length - 1)),\n })\n }\n >\n {'✕'}\n </IconButton>\n </Stack>\n ))}\n <Box>\n <Button\n onClick={() =>\n editGroup(groupIndex, {\n options: [...group.options, { id: newId('o'), name: '', priceCents: 0 }],\n })\n }\n disabled={group.options.length >= CommerceModel.POS_MAX_MODIFIER_OPTIONS}\n >\n {'Add choice'}\n </Button>\n </Box>\n </Stack>\n </Box>\n ))}\n <Box>\n <Button\n variant=\"outlined\"\n onClick={() =>\n setGroups([\n ...modifierGroups,\n {\n id: newId('g'),\n name: '',\n min: 0,\n max: 1,\n options: [{ id: newId('o'), name: '', priceCents: 0 }],\n },\n ])\n }\n disabled={modifierGroups.length >= CommerceModel.POS_MAX_MODIFIER_GROUPS}\n >\n {'Add modifier group'}\n </Button>\n </Box>\n {problem && modifierGroups.length ? (\n <Typography variant=\"body2\" color=\"warning.main\">\n {problem}\n </Typography>\n ) : null}\n </Stack>\n )\n})\n"],"names":["Box","Button","FormControlLabel","IconButton","Stack","Switch","TextField","Typography","memo","useCallback","CommerceModel","newId","prefix","Math","random","toString","slice","centsFromDollars","value","number","round","Number","String","replace","isFinite","ProductRegisterFields","props","modifierGroups","update","setGroups","groups","editGroup","index","patch","map","group","at","editOption","groupIndex","optionIndex","options","option","problem","modifierGroupsProblem","spacing","variant","component","control","checked","posQuickKey","onChange","event","target","label","color","role","aria-label","name","sx","border","borderColor","borderRadius","p","direction","alignItems","size","flex","min","max","helperText","width","slotProps","htmlInput","inputMode","onClick","filter","_group","defaultValue","priceCents","toFixed","placeholder","onBlur","_option","length","id","disabled","POS_MAX_MODIFIER_OPTIONS","POS_MAX_MODIFIER_GROUPS"],"mappings":"AAAA;;;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9C,KAAOA,OAAOG;oDACtD6B,KAAKvD,KAAKuD,GAAG,CAAC,GAAGvD,KAAKsD,GAAG,CAAChC,MAAMiC,GAAG,EAAEjC,MAAMK,OAAO,CAAC2C,MAAM,GAAG;gDAC9D;sDAGD;;;mCA5BO1C,OAAO2C,EAAE;0CAgCvB,KAACpF;0CACC,cAAA,KAACC;oCACCyE,SAAS,IACP3C,UAAUO,YAAY;4CACpBE,SAAS;mDAAIL,MAAMK,OAAO;gDAAE;oDAAE4C,IAAIzE,MAAM;oDAAM8C,MAAM;oDAAIqB,YAAY;gDAAE;6CAAE;wCAC1E;oCAEFO,UAAUlD,MAAMK,OAAO,CAAC2C,MAAM,IAAIzE,cAAc4E,wBAAwB;8CAEvE;;;;;mBApFFnD,MAAMiD,EAAE;0BA0FjB,KAACpF;0BACC,cAAA,KAACC;oBACC4C,SAAQ;oBACR6B,SAAS,IACP7C,UAAU;+BACLF;4BACH;gCACEyD,IAAIzE,MAAM;gCACV8C,MAAM;gCACNU,KAAK;gCACLC,KAAK;gCACL5B,SAAS;oCAAC;wCAAE4C,IAAIzE,MAAM;wCAAM8C,MAAM;wCAAIqB,YAAY;oCAAE;iCAAE;4BACxD;yBACD;oBAEHO,UAAU1D,eAAewD,MAAM,IAAIzE,cAAc6E,uBAAuB;8BAEvE;;;YAGJ7C,WAAWf,eAAewD,MAAM,iBAC/B,KAAC5E;gBAAWsC,SAAQ;gBAAQS,OAAM;0BAC/BZ;iBAED;;;AAGV,GAAE"}
|
|
@@ -46,6 +46,28 @@ export interface ConsoleProductDraft {
|
|
|
46
46
|
mediaUrls: string[];
|
|
47
47
|
seoTitle: string;
|
|
48
48
|
seoDescription: string;
|
|
49
|
+
/**
|
|
50
|
+
* What one unit ships as (AGL-3612): packed size and customs facts, as the
|
|
51
|
+
* editor holds them. A side nobody set is `null`.
|
|
52
|
+
*/
|
|
53
|
+
shipping: {
|
|
54
|
+
lengthCm: number | null;
|
|
55
|
+
widthCm: number | null;
|
|
56
|
+
heightCm: number | null;
|
|
57
|
+
hsCode: string;
|
|
58
|
+
originCountry: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* What shopping channels ask of it (AGL-3637), as the editor holds it. A
|
|
62
|
+
* field nobody entered is `''`.
|
|
63
|
+
*/
|
|
64
|
+
channel: {
|
|
65
|
+
brand: string;
|
|
66
|
+
gtin: string;
|
|
67
|
+
mpn: string;
|
|
68
|
+
condition: '' | 'new' | 'refurbished' | 'used';
|
|
69
|
+
googleProductCategory: string;
|
|
70
|
+
};
|
|
49
71
|
}
|
|
50
72
|
/**
|
|
51
73
|
* Copy a widget proposes for one product. A field left out is left alone;
|
|
@@ -59,6 +81,28 @@ export interface ConsoleProductCopyValues {
|
|
|
59
81
|
optionNames?: string[];
|
|
60
82
|
seoTitle?: string;
|
|
61
83
|
seoDescription?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Packed size and customs facts (AGL-3612), merged over the product's; a
|
|
86
|
+
* side set to `null` is cleared.
|
|
87
|
+
*/
|
|
88
|
+
shipping?: Partial<{
|
|
89
|
+
lengthCm: number | null;
|
|
90
|
+
widthCm: number | null;
|
|
91
|
+
heightCm: number | null;
|
|
92
|
+
hsCode: string;
|
|
93
|
+
originCountry: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Shopping-channel facts (AGL-3637), merged over the product's; a field
|
|
97
|
+
* set to `''` is cleared.
|
|
98
|
+
*/
|
|
99
|
+
channel?: Partial<{
|
|
100
|
+
brand: string;
|
|
101
|
+
gtin: string;
|
|
102
|
+
mpn: string;
|
|
103
|
+
condition: '' | 'new' | 'refurbished' | 'used';
|
|
104
|
+
googleProductCategory: string;
|
|
105
|
+
}>;
|
|
62
106
|
}
|
|
63
107
|
/**
|
|
64
108
|
* What the `productEditor` zone hands each widget: the product as the editor
|
|
@@ -175,11 +219,23 @@ export declare const PRODUCT_EDITOR_ZONE: import("@aglyn/aglyn/plugin-manager/pl
|
|
|
175
219
|
export declare const PRODUCTS_HUB_ZONE: import("@aglyn/aglyn/plugin-manager/plugin-zones").PluginZone<ConsoleProductsHubZoneProps>;
|
|
176
220
|
export declare const PRODUCT_IMPORT_ZONE: import("@aglyn/aglyn/plugin-manager/plugin-zones").PluginZone<ConsoleProductImportZoneProps>;
|
|
177
221
|
/**
|
|
178
|
-
*
|
|
222
|
+
* What the `productsCreate` zone hands each widget (AGL-3596): the site and
|
|
223
|
+
* its org. The zone sits beside Add product on the Products page and in the
|
|
224
|
+
* empty catalog: another way to start a product. A widget here writes nothing
|
|
225
|
+
* through the page — anything it proposes is applied through `productsHub`.
|
|
226
|
+
*/
|
|
227
|
+
export interface ConsoleProductsCreateZoneProps {
|
|
228
|
+
hostId: string;
|
|
229
|
+
/** The org the page names; `undefined` where the host does not know it. */
|
|
230
|
+
orgId: string | undefined;
|
|
231
|
+
}
|
|
232
|
+
export declare const PRODUCTS_CREATE_ZONE: import("@aglyn/aglyn/plugin-manager/plugin-zones").PluginZone<ConsoleProductsCreateZoneProps>;
|
|
233
|
+
/**
|
|
234
|
+
* Declares the four zones, from the console registrar. The ids are the ones
|
|
179
235
|
* widgets have always registered under, so a widget written for them keeps
|
|
180
236
|
* working. Each is `bare`: the section is one item of a layout this plugin
|
|
181
237
|
* draws — among the editor's fields, above the catalog table, in the import
|
|
182
|
-
* wizard's After import step — and a wrapper would add a gap the page
|
|
238
|
+
* wizard's After import step, in the row beside Add product — and a wrapper would add a gap the page
|
|
183
239
|
* already spaces.
|
|
184
240
|
*/
|
|
185
241
|
export declare function registerCommerceZones(): void;
|
|
@@ -18,12 +18,13 @@ import { BUNDLE_ID } from "../../constants/bundle-common.js";
|
|
|
18
18
|
export const PRODUCT_EDITOR_ZONE = definePluginZone('productEditor');
|
|
19
19
|
export const PRODUCTS_HUB_ZONE = definePluginZone('productsHub');
|
|
20
20
|
export const PRODUCT_IMPORT_ZONE = definePluginZone('productImport');
|
|
21
|
+
export const PRODUCTS_CREATE_ZONE = definePluginZone('productsCreate');
|
|
21
22
|
/**
|
|
22
|
-
* Declares the
|
|
23
|
+
* Declares the four zones, from the console registrar. The ids are the ones
|
|
23
24
|
* widgets have always registered under, so a widget written for them keeps
|
|
24
25
|
* working. Each is `bare`: the section is one item of a layout this plugin
|
|
25
26
|
* draws — among the editor's fields, above the catalog table, in the import
|
|
26
|
-
* wizard's After import step — and a wrapper would add a gap the page
|
|
27
|
+
* wizard's After import step, in the row beside Add product — and a wrapper would add a gap the page
|
|
27
28
|
* already spaces.
|
|
28
29
|
*/ export function registerCommerceZones() {
|
|
29
30
|
const owner = {
|
|
@@ -43,6 +44,13 @@ export const PRODUCT_IMPORT_ZONE = definePluginZone('productImport');
|
|
|
43
44
|
layout: 'bare',
|
|
44
45
|
description: 'Above the catalog table on the Products page. A widget here proposes copy, draft products, categories and switched-off discounts, and asks the hub to write them; every write is the hub’s, with its allowance and slug checks.'
|
|
45
46
|
}, owner);
|
|
47
|
+
registerPluginZone({
|
|
48
|
+
zone: PRODUCTS_CREATE_ZONE,
|
|
49
|
+
label: 'Start a product',
|
|
50
|
+
surface: 'console',
|
|
51
|
+
layout: 'bare',
|
|
52
|
+
description: 'Beside Add product on the Products page, and in the empty catalog: another way to start a product. A widget here is handed the site and its org and writes nothing through the page.'
|
|
53
|
+
}, owner);
|
|
46
54
|
registerPluginZone({
|
|
47
55
|
zone: PRODUCT_IMPORT_ZONE,
|
|
48
56
|
label: 'Product import',
|