@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/index.js.map +1 -1
- package/src/lib/barcode/barcode-decode.d.ts +71 -0
- package/src/lib/barcode/barcode-decode.js +498 -0
- package/src/lib/barcode/barcode-decode.js.map +1 -0
- package/src/lib/barcode/barcode-encode.d.ts +44 -0
- package/src/lib/barcode/barcode-encode.js +138 -0
- package/src/lib/barcode/barcode-encode.js.map +1 -0
- package/src/lib/barcode/barcode-scanner.component.d.ts +23 -0
- package/src/lib/barcode/barcode-scanner.component.js +260 -0
- package/src/lib/barcode/barcode-scanner.component.js.map +1 -0
- package/src/lib/barcode/scan-button.component.d.ts +10 -0
- package/src/lib/barcode/scan-button.component.js +62 -0
- package/src/lib/barcode/scan-button.component.js.map +1 -0
- package/src/lib/barcode/scanner-wedge.d.ts +35 -0
- package/src/lib/barcode/scanner-wedge.js +108 -0
- package/src/lib/barcode/scanner-wedge.js.map +1 -0
- package/src/lib/components/account.js +10 -1
- package/src/lib/components/account.js.map +1 -1
- package/src/lib/components/cart-extras.d.ts +45 -0
- package/src/lib/components/cart-extras.js +127 -0
- package/src/lib/components/cart-extras.js.map +1 -0
- package/src/lib/components/cart.js +82 -15
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/checkout-return-notice.d.ts +26 -0
- package/src/lib/components/checkout-return-notice.js +48 -0
- package/src/lib/components/checkout-return-notice.js.map +1 -0
- package/src/lib/components/commerce-console-page.js +124 -0
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/commerce-console-sections.d.ts +1 -1
- package/src/lib/components/commerce-console-sections.js +4 -0
- package/src/lib/components/commerce-console-sections.js.map +1 -1
- package/src/lib/components/console/bulk-fulfill.d.ts +44 -0
- package/src/lib/components/console/bulk-fulfill.js +84 -0
- package/src/lib/components/console/bulk-fulfill.js.map +1 -0
- package/src/lib/components/console/customer-notifications-card.component.d.ts +19 -0
- package/src/lib/components/console/customer-notifications-card.component.js +149 -0
- package/src/lib/components/console/customer-notifications-card.component.js.map +1 -0
- package/src/lib/components/console/host-orders-card.component.js +84 -5
- package/src/lib/components/console/host-orders-card.component.js.map +1 -1
- package/src/lib/components/console/locations-card.component.js +164 -57
- package/src/lib/components/console/locations-card.component.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +209 -61
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-fulfillment-panel.component.d.ts +48 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js +542 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -0
- package/src/lib/components/console/order-invoice.component.d.ts +33 -0
- package/src/lib/components/console/order-invoice.component.js +81 -0
- package/src/lib/components/console/order-invoice.component.js.map +1 -0
- package/src/lib/components/console/order-receipt-resend.component.d.ts +21 -0
- package/src/lib/components/console/order-receipt-resend.component.js +203 -0
- package/src/lib/components/console/order-receipt-resend.component.js.map +1 -0
- package/src/lib/components/console/order-returns.component.d.ts +36 -0
- package/src/lib/components/console/order-returns.component.js +142 -0
- package/src/lib/components/console/order-returns.component.js.map +1 -0
- package/src/lib/components/console/order-shipping-actions.component.d.ts +54 -0
- package/src/lib/components/console/order-shipping-actions.component.js +149 -0
- package/src/lib/components/console/order-shipping-actions.component.js.map +1 -0
- package/src/lib/components/console/order-webhooks-card.component.d.ts +50 -0
- package/src/lib/components/console/order-webhooks-card.component.js +623 -0
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -0
- package/src/lib/components/console/order-zones.d.ts +155 -0
- package/src/lib/components/console/order-zones.js +40 -0
- package/src/lib/components/console/order-zones.js.map +1 -0
- package/src/lib/components/console/payment-methods-card.component.d.ts +67 -0
- package/src/lib/components/console/payment-methods-card.component.js +395 -0
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-api.d.ts +124 -0
- package/src/lib/components/console/pos/pos-api.js +101 -0
- package/src/lib/components/console/pos/pos-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +36 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +160 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js +352 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-product-grid.component.d.ts +47 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js +272 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.d.ts +27 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js +282 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +53 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js +445 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.d.ts +31 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js +640 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.d.ts +43 -0
- package/src/lib/components/console/pos/use-pos-display.js +161 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +14 -0
- package/src/lib/components/console/pos-devices-card.component.js +546 -0
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -0
- package/src/lib/components/console/pos-display/brand-screen.d.ts +33 -0
- package/src/lib/components/console/pos-display/brand-screen.js +85 -0
- package/src/lib/components/console/pos-display/brand-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/cart-screen.d.ts +29 -0
- package/src/lib/components/console/pos-display/cart-screen.js +166 -0
- package/src/lib/components/console/pos-display/cart-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pairing-screen.d.ts +24 -0
- package/src/lib/components/console/pos-display/pairing-screen.js +127 -0
- package/src/lib/components/console/pos-display/pairing-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +90 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +140 -0
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -0
- package/src/lib/components/console/pos-display/receipt-screen.d.ts +35 -0
- package/src/lib/components/console/pos-display/receipt-screen.js +200 -0
- package/src/lib/components/console/pos-display/receipt-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/tip-screen.d.ts +36 -0
- package/src/lib/components/console/pos-display/tip-screen.js +211 -0
- package/src/lib/components/console/pos-display/tip-screen.js.map +1 -0
- package/src/lib/components/console/pos-display-page.component.d.ts +16 -0
- package/src/lib/components/console/pos-display-page.component.js +407 -0
- package/src/lib/components/console/pos-display-page.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +289 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js +61 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +38 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +129 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js +60 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.d.ts +48 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js +220 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.d.ts +63 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js +186 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt.d.ts +39 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js +182 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js +465 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.d.ts +29 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js +253 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +494 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js +102 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.d.ts +30 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js +277 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/register-ops.d.ts +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.d.ts +46 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js +128 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.d.ts +36 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js +64 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js.map +1 -0
- package/src/lib/components/console/pos-page.component.d.ts +13 -5
- package/src/lib/components/console/pos-page.component.js +729 -657
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +51 -7
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-labels-dialog.component.d.ts +13 -0
- package/src/lib/components/console/product-labels-dialog.component.js +197 -0
- package/src/lib/components/console/product-labels-dialog.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +19 -0
- package/src/lib/components/console/product-register-fields.component.js +241 -0
- package/src/lib/components/console/product-register-fields.component.js.map +1 -0
- package/src/lib/components/console/product-zones.d.ts +44 -0
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +12 -0
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
- package/src/lib/components/console/register-hardware-card.component.js +826 -0
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
- package/src/lib/components/console/registers-card.component.js +24 -5
- package/src/lib/components/console/registers-card.component.js.map +1 -1
- package/src/lib/components/console/return-actions.d.ts +38 -0
- package/src/lib/components/console/return-actions.js +76 -0
- package/src/lib/components/console/return-actions.js.map +1 -0
- package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
- package/src/lib/components/console/return-detail-dialog.component.js +718 -0
- package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
- package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
- package/src/lib/components/console/return-settings-card.component.js +195 -0
- package/src/lib/components/console/return-settings-card.component.js.map +1 -0
- package/src/lib/components/console/return-zones.d.ts +87 -0
- package/src/lib/components/console/return-zones.js +31 -0
- package/src/lib/components/console/return-zones.js.map +1 -0
- package/src/lib/components/console/returns-card.component.d.ts +45 -0
- package/src/lib/components/console/returns-card.component.js +159 -0
- package/src/lib/components/console/returns-card.component.js.map +1 -0
- package/src/lib/components/console/shipping-settings-card.component.js +161 -5
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
- package/src/lib/components/console/shippingeasy-card.component.js +378 -0
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
- package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
- package/src/lib/components/console/shipstation-card.component.js +345 -0
- package/src/lib/components/console/shipstation-card.component.js.map +1 -0
- package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/start-return-dialog.component.js +243 -0
- package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/stock-movements-card.component.js +2 -1
- package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +2 -66
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-zones.d.ts +42 -0
- package/src/lib/components/console/store-zones.js +39 -0
- package/src/lib/components/console/store-zones.js.map +1 -0
- package/src/lib/components/order-status.d.ts +36 -0
- package/src/lib/components/order-status.js +502 -0
- package/src/lib/components/order-status.js.map +1 -0
- package/src/lib/components/product-detail.js +41 -2
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/return-request.d.ts +32 -0
- package/src/lib/components/return-request.js +576 -0
- package/src/lib/components/return-request.js.map +1 -0
- package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
- package/src/lib/components/storefront-payment-appearance.js +114 -0
- package/src/lib/components/storefront-payment-appearance.js.map +1 -0
- package/src/lib/components/storefront-payment-element.d.ts +57 -1
- package/src/lib/components/storefront-payment-element.js +332 -33
- package/src/lib/components/storefront-payment-element.js.map +1 -1
- package/src/lib/constants/order-status.d.ts +22 -0
- package/src/lib/constants/order-status.js +22 -0
- package/src/lib/constants/order-status.js.map +1 -0
- package/src/lib/constants/return-request.d.ts +27 -0
- package/src/lib/constants/return-request.js +32 -0
- package/src/lib/constants/return-request.js.map +1 -0
- package/src/lib/constants/stock-movement-query.js +2 -1
- package/src/lib/constants/stock-movement-query.js.map +1 -1
- package/src/lib/declarations.console-server.js +9 -0
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.server.d.ts +2 -1
- package/src/lib/declarations.server.js +47 -1
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/buyer-notifications.d.ts +59 -0
- package/src/lib/model/buyer-notifications.js +97 -0
- package/src/lib/model/buyer-notifications.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +127 -1
- package/src/lib/model/commerce-orders.js +24 -15
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-payment-methods.d.ts +146 -0
- package/src/lib/model/commerce-payment-methods.js +247 -0
- package/src/lib/model/commerce-payment-methods.js.map +1 -0
- package/src/lib/model/commerce-pos-ops.d.ts +437 -0
- package/src/lib/model/commerce-pos-ops.js +721 -0
- package/src/lib/model/commerce-pos-ops.js.map +1 -0
- package/src/lib/model/commerce-pos.d.ts +263 -0
- package/src/lib/model/commerce-pos.js +375 -0
- package/src/lib/model/commerce-pos.js.map +1 -0
- package/src/lib/model/commerce-printers.d.ts +211 -0
- package/src/lib/model/commerce-printers.js +181 -0
- package/src/lib/model/commerce-printers.js.map +1 -0
- package/src/lib/model/commerce-receipt.d.ts +97 -0
- package/src/lib/model/commerce-receipt.js +180 -0
- package/src/lib/model/commerce-receipt.js.map +1 -0
- package/src/lib/model/commerce-returns.d.ts +207 -0
- package/src/lib/model/commerce-returns.js +300 -0
- package/src/lib/model/commerce-returns.js.map +1 -0
- package/src/lib/model/commerce-shipping.d.ts +44 -1
- package/src/lib/model/commerce-shipping.js +53 -9
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/commerce-tax-engine.d.ts +90 -0
- package/src/lib/model/commerce-tax-engine.js +129 -0
- package/src/lib/model/commerce-tax-engine.js.map +1 -0
- package/src/lib/model/commerce.d.ts +88 -2
- package/src/lib/model/commerce.js +89 -1
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/index.d.ts +15 -0
- package/src/lib/model/index.js +15 -0
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/model/order-events.d.ts +154 -0
- package/src/lib/model/order-events.js +153 -0
- package/src/lib/model/order-events.js.map +1 -0
- package/src/lib/model/order-fulfillment.d.ts +117 -0
- package/src/lib/model/order-fulfillment.js +217 -0
- package/src/lib/model/order-fulfillment.js.map +1 -0
- package/src/lib/model/order-history.d.ts +58 -0
- package/src/lib/model/order-history.js +22 -0
- package/src/lib/model/order-history.js.map +1 -0
- package/src/lib/model/order-list-fields.d.ts +9 -1
- package/src/lib/model/order-list-fields.js +7 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/order-shipping-export.d.ts +91 -0
- package/src/lib/model/order-shipping-export.js +192 -0
- package/src/lib/model/order-shipping-export.js.map +1 -0
- package/src/lib/model/order-status-view.d.ts +103 -0
- package/src/lib/model/order-status-view.js +156 -0
- package/src/lib/model/order-status-view.js.map +1 -0
- package/src/lib/model/order-webhooks.d.ts +142 -0
- package/src/lib/model/order-webhooks.js +91 -0
- package/src/lib/model/order-webhooks.js.map +1 -0
- package/src/lib/model/product-channel.d.ts +56 -0
- package/src/lib/model/product-channel.js +86 -0
- package/src/lib/model/product-channel.js.map +1 -0
- package/src/lib/model/product-modifiers.d.ts +80 -0
- package/src/lib/model/product-modifiers.js +140 -0
- package/src/lib/model/product-modifiers.js.map +1 -0
- package/src/lib/model/shippingeasy.d.ts +94 -0
- package/src/lib/model/shippingeasy.js +267 -0
- package/src/lib/model/shippingeasy.js.map +1 -0
- package/src/lib/model/shipstation.d.ts +125 -0
- package/src/lib/model/shipstation.js +399 -0
- package/src/lib/model/shipstation.js.map +1 -0
- package/src/lib/model/smart-collection-reads.d.ts +32 -0
- package/src/lib/model/smart-collection-reads.js +63 -0
- package/src/lib/model/smart-collection-reads.js.map +1 -0
- package/src/lib/model/tracking-url.d.ts +74 -0
- package/src/lib/model/tracking-url.js +159 -0
- package/src/lib/model/tracking-url.js.map +1 -0
- package/src/lib/plugin-config.d.ts +13 -0
- package/src/lib/plugin-config.js +77 -5
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +23 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/pos-ops-config.d.ts +39 -0
- package/src/lib/pos-ops-config.js +88 -0
- package/src/lib/pos-ops-config.js.map +1 -0
- package/src/lib/printing/print-document.d.ts +106 -0
- package/src/lib/printing/print-document.js +464 -0
- package/src/lib/printing/print-document.js.map +1 -0
- package/src/lib/printing/product-labels.d.ts +58 -0
- package/src/lib/printing/product-labels.js +116 -0
- package/src/lib/printing/product-labels.js.map +1 -0
- package/src/lib/printing/render-epson.d.ts +57 -0
- package/src/lib/printing/render-epson.js +135 -0
- package/src/lib/printing/render-epson.js.map +1 -0
- package/src/lib/printing/render-star.d.ts +45 -0
- package/src/lib/printing/render-star.js +100 -0
- package/src/lib/printing/render-star.js.map +1 -0
- package/src/lib/printing/render-text.d.ts +25 -0
- package/src/lib/printing/render-text.js +53 -0
- package/src/lib/printing/render-text.js.map +1 -0
- package/src/lib/server/api-v1/openapi.js +27 -4
- package/src/lib/server/api-v1/openapi.js.map +1 -1
- package/src/lib/server/api-v1/order-view.d.ts +67 -0
- package/src/lib/server/api-v1/order-view.js +120 -0
- package/src/lib/server/api-v1/order-view.js.map +1 -0
- package/src/lib/server/api-v1/orders-and-products.js +58 -65
- package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
- package/src/lib/server/billing-webhook.js +135 -28
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +29 -0
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/carrier-rates-availability.d.ts +26 -0
- package/src/lib/server/carrier-rates-availability.js +76 -0
- package/src/lib/server/carrier-rates-availability.js.map +1 -0
- package/src/lib/server/carrier-shipping.d.ts +84 -0
- package/src/lib/server/carrier-shipping.js +135 -0
- package/src/lib/server/carrier-shipping.js.map +1 -0
- package/src/lib/server/cart-checkout.d.ts +2 -0
- package/src/lib/server/cart-checkout.js +226 -22
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/checkout-extras.d.ts +64 -0
- package/src/lib/server/checkout-extras.js +157 -0
- package/src/lib/server/checkout-extras.js.map +1 -0
- package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
- package/src/lib/server/checkout-status.js +111 -0
- package/src/lib/server/checkout-status.js.map +1 -0
- package/src/lib/server/checkout.js +86 -9
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/draft-order.js +34 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.d.ts +127 -10
- package/src/lib/server/fulfill-order.js +451 -49
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/legacy-feed.d.ts +28 -0
- package/src/lib/server/legacy-feed.js +52 -0
- package/src/lib/server/legacy-feed.js.map +1 -0
- package/src/lib/server/native-checkout.d.ts +34 -15
- package/src/lib/server/native-checkout.js +32 -17
- package/src/lib/server/native-checkout.js.map +1 -1
- package/src/lib/server/order-event-host-emit.d.ts +23 -0
- package/src/lib/server/order-event-host-emit.js +30 -0
- package/src/lib/server/order-event-host-emit.js.map +1 -0
- package/src/lib/server/order-event-triggers.d.ts +37 -0
- package/src/lib/server/order-event-triggers.js +119 -0
- package/src/lib/server/order-event-triggers.js.map +1 -0
- package/src/lib/server/order-events.d.ts +62 -0
- package/src/lib/server/order-events.js +109 -0
- package/src/lib/server/order-events.js.map +1 -0
- package/src/lib/server/order-history.d.ts +23 -0
- package/src/lib/server/order-history.js +65 -0
- package/src/lib/server/order-history.js.map +1 -0
- package/src/lib/server/order-notifications.d.ts +185 -0
- package/src/lib/server/order-notifications.js +567 -0
- package/src/lib/server/order-notifications.js.map +1 -0
- package/src/lib/server/order-receipt-send.d.ts +39 -0
- package/src/lib/server/order-receipt-send.js +151 -0
- package/src/lib/server/order-receipt-send.js.map +1 -0
- package/src/lib/server/order-status-token.d.ts +31 -0
- package/src/lib/server/order-status-token.js +75 -0
- package/src/lib/server/order-status-token.js.map +1 -0
- package/src/lib/server/order-status.d.ts +58 -0
- package/src/lib/server/order-status.js +141 -0
- package/src/lib/server/order-status.js.map +1 -0
- package/src/lib/server/order-webhooks.d.ts +108 -0
- package/src/lib/server/order-webhooks.js +622 -0
- package/src/lib/server/order-webhooks.js.map +1 -0
- package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
- package/src/lib/server/orders-shipping-prepare.js +121 -0
- package/src/lib/server/orders-shipping-prepare.js.map +1 -0
- package/src/lib/server/payment-method-domains.d.ts +209 -0
- package/src/lib/server/payment-method-domains.js +444 -0
- package/src/lib/server/payment-method-domains.js.map +1 -0
- package/src/lib/server/payment-methods.d.ts +77 -0
- package/src/lib/server/payment-methods.js +284 -0
- package/src/lib/server/payment-methods.js.map +1 -0
- package/src/lib/server/pos-auth.d.ts +50 -0
- package/src/lib/server/pos-auth.js +121 -0
- package/src/lib/server/pos-auth.js.map +1 -0
- package/src/lib/server/pos-customer.d.ts +49 -0
- package/src/lib/server/pos-customer.js +257 -0
- package/src/lib/server/pos-customer.js.map +1 -0
- package/src/lib/server/pos-display.d.ts +57 -0
- package/src/lib/server/pos-display.js +419 -0
- package/src/lib/server/pos-display.js.map +1 -0
- package/src/lib/server/pos-fee-month.d.ts +34 -0
- package/src/lib/server/pos-fee-month.js +36 -0
- package/src/lib/server/pos-fee-month.js.map +1 -0
- package/src/lib/server/pos-ops-gate.d.ts +161 -0
- package/src/lib/server/pos-ops-gate.js +295 -0
- package/src/lib/server/pos-ops-gate.js.map +1 -0
- package/src/lib/server/pos-ops-routes.d.ts +22 -0
- package/src/lib/server/pos-ops-routes.js +36 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -0
- package/src/lib/server/pos-order.d.ts +1 -18
- package/src/lib/server/pos-order.js +222 -42
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.d.ts +39 -0
- package/src/lib/server/pos-payment.js +922 -0
- package/src/lib/server/pos-payment.js.map +1 -0
- package/src/lib/server/pos-print.d.ts +82 -0
- package/src/lib/server/pos-print.js +193 -0
- package/src/lib/server/pos-print.js.map +1 -0
- package/src/lib/server/pos-readers.d.ts +27 -0
- package/src/lib/server/pos-readers.js +276 -0
- package/src/lib/server/pos-readers.js.map +1 -0
- package/src/lib/server/pos-refund-authority.d.ts +60 -0
- package/src/lib/server/pos-refund-authority.js +72 -0
- package/src/lib/server/pos-refund-authority.js.map +1 -0
- package/src/lib/server/pos-return.d.ts +58 -0
- package/src/lib/server/pos-return.js +891 -0
- package/src/lib/server/pos-return.js.map +1 -0
- package/src/lib/server/pos-sale-stamp.d.ts +66 -0
- package/src/lib/server/pos-sale-stamp.js +84 -0
- package/src/lib/server/pos-sale-stamp.js.map +1 -0
- package/src/lib/server/pos-sale.d.ts +170 -0
- package/src/lib/server/pos-sale.js +461 -0
- package/src/lib/server/pos-sale.js.map +1 -0
- package/src/lib/server/pos-shift.d.ts +45 -0
- package/src/lib/server/pos-shift.js +484 -0
- package/src/lib/server/pos-shift.js.map +1 -0
- package/src/lib/server/pos-staff-pin.d.ts +26 -0
- package/src/lib/server/pos-staff-pin.js +339 -0
- package/src/lib/server/pos-staff-pin.js.map +1 -0
- package/src/lib/server/pos-stripe.d.ts +91 -0
- package/src/lib/server/pos-stripe.js +129 -0
- package/src/lib/server/pos-stripe.js.map +1 -0
- package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
- package/src/lib/server/pos-terminal-connection-token.js +166 -0
- package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
- package/src/lib/server/pos-terminal.d.ts +218 -0
- package/src/lib/server/pos-terminal.js +1014 -0
- package/src/lib/server/pos-terminal.js.map +1 -0
- package/src/lib/server/print-queue.d.ts +124 -0
- package/src/lib/server/print-queue.js +301 -0
- package/src/lib/server/print-queue.js.map +1 -0
- package/src/lib/server/printer-poll.d.ts +75 -0
- package/src/lib/server/printer-poll.js +325 -0
- package/src/lib/server/printer-poll.js.map +1 -0
- package/src/lib/server/printer-secret.d.ts +39 -0
- package/src/lib/server/printer-secret.js +56 -0
- package/src/lib/server/printer-secret.js.map +1 -0
- package/src/lib/server/printers.d.ts +114 -0
- package/src/lib/server/printers.js +546 -0
- package/src/lib/server/printers.js.map +1 -0
- package/src/lib/server/product-catalog.d.ts +42 -0
- package/src/lib/server/product-catalog.js +305 -0
- package/src/lib/server/product-catalog.js.map +1 -0
- package/src/lib/server/refund.js +110 -45
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reserve.js +2 -0
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/return-status-action.d.ts +37 -0
- package/src/lib/server/return-status-action.js +57 -0
- package/src/lib/server/return-status-action.js.map +1 -0
- package/src/lib/server/returns.d.ts +119 -0
- package/src/lib/server/returns.js +938 -0
- package/src/lib/server/returns.js.map +1 -0
- package/src/lib/server/shipment-records.d.ts +36 -0
- package/src/lib/server/shipment-records.js +289 -0
- package/src/lib/server/shipment-records.js.map +1 -0
- package/src/lib/server/shipping-connector-gates.d.ts +40 -0
- package/src/lib/server/shipping-connector-gates.js +97 -0
- package/src/lib/server/shipping-connector-gates.js.map +1 -0
- package/src/lib/server/shipping-connectors.d.ts +29 -0
- package/src/lib/server/shipping-connectors.js +236 -0
- package/src/lib/server/shipping-connectors.js.map +1 -0
- package/src/lib/server/shippingeasy.d.ts +238 -0
- package/src/lib/server/shippingeasy.js +787 -0
- package/src/lib/server/shippingeasy.js.map +1 -0
- package/src/lib/server/shipstation.d.ts +129 -0
- package/src/lib/server/shipstation.js +483 -0
- package/src/lib/server/shipstation.js.map +1 -0
- package/src/lib/server/site-page-resolver.d.ts +5 -0
- package/src/lib/server/site-page-resolver.js +156 -1
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/stock-levels.d.ts +21 -0
- package/src/lib/server/stock-levels.js +263 -0
- package/src/lib/server/stock-levels.js.map +1 -0
- package/src/lib/server/stripe-refund.d.ts +47 -0
- package/src/lib/server/stripe-refund.js +87 -0
- package/src/lib/server/stripe-refund.js.map +1 -0
- package/src/lib/server/supplier-update.js +46 -5
- package/src/lib/server/supplier-update.js.map +1 -1
- package/src/lib/server/tax-engine-quote.d.ts +47 -0
- package/src/lib/server/tax-engine-quote.js +105 -0
- package/src/lib/server/tax-engine-quote.js.map +1 -0
- package/src/lib/server.js +138 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/site.js +12 -0
- package/src/lib/site.js.map +1 -1
- package/src/lib/subprocessors.d.ts +26 -0
- package/src/lib/subprocessors.js +50 -0
- package/src/lib/subprocessors.js.map +1 -0
- package/src/lib/tenant-emails.js +461 -3
- package/src/lib/tenant-emails.js.map +1 -1
- package/src/lib/testing/fake-firestore.d.ts +45 -0
- package/src/lib/testing/fake-firestore.js +189 -0
- package/src/lib/testing/fake-firestore.js.map +1 -0
- package/src/lib/testing/memory-firestore.d.ts +123 -0
- package/src/lib/testing/memory-firestore.js +274 -0
- package/src/lib/testing/memory-firestore.js.map +1 -0
- package/src/lib/testing/pos-ops-harness.d.ts +50 -0
- package/src/lib/testing/pos-ops-harness.js +184 -0
- package/src/lib/testing/pos-ops-harness.js.map +1 -0
- package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
- package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
- package/src/lib/transfer/records-transfer.d.ts +11 -1
- package/src/lib/transfer/records-transfer.js +127 -5
- package/src/lib/transfer/records-transfer.js.map +1 -1
- package/src/lib/transfer/records.server.d.ts +9 -2
- package/src/lib/transfer/records.server.js +58 -7
- package/src/lib/transfer/records.server.js.map +1 -1
- package/src/lib/transfer/register-transfer-resources.js +40 -1
- package/src/lib/transfer/register-transfer-resources.js.map +1 -1
- package/src/lib/transfer/register-transfer-ui.js +4 -1
- package/src/lib/transfer/register-transfer-ui.js.map +1 -1
- package/src/lib/transfer/shipping-presets.d.ts +23 -0
- package/src/lib/transfer/shipping-presets.js +156 -0
- package/src/lib/transfer/shipping-presets.js.map +1 -0
- package/src/lib/transfer/tracking-transfer.d.ts +101 -0
- package/src/lib/transfer/tracking-transfer.js +546 -0
- package/src/lib/transfer/tracking-transfer.js.map +1 -0
- package/src/lib/transfer/tracking.server.d.ts +37 -0
- package/src/lib/transfer/tracking.server.js +393 -0
- package/src/lib/transfer/tracking.server.js.map +1 -0
- package/src/lib/transfer/transfer-keys.d.ts +2 -1
- package/src/lib/transfer/transfer-keys.js +6 -2
- package/src/lib/transfer/transfer-keys.js.map +1 -1
- package/src/lib/utils/code128.d.ts +37 -0
- package/src/lib/utils/code128.js +199 -0
- package/src/lib/utils/code128.js.map +1 -0
- package/src/lib/utils/order-invoice.d.ts +55 -0
- package/src/lib/utils/order-invoice.js +127 -0
- package/src/lib/utils/order-invoice.js.map +1 -0
- package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
- package/src/lib/utils/use-checkout-return-notice.js +78 -0
- package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
- package/src/lib/server/feed.js +0 -69
- package/src/lib/server/feed.js.map +0 -1
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
* What shopping channels ask of a product beyond what the store shows
|
|
18
|
+
* (AGL-3637): the brand, the manufacturer's identifiers, the condition and
|
|
19
|
+
* Google's category. Entered in the product editor's channel fields and read
|
|
20
|
+
* by the product catalog the store publishes to other plugins
|
|
21
|
+
* (`server/product-catalog.ts`). Every field is optional: a channel feed
|
|
22
|
+
* falls back to the store's defaults and says what is missing.
|
|
23
|
+
*/ export const PRODUCT_CHANNEL_CONDITIONS = [
|
|
24
|
+
'new',
|
|
25
|
+
'refurbished',
|
|
26
|
+
'used'
|
|
27
|
+
];
|
|
28
|
+
/** Digits only, at most 14: what a barcode field holds once spaces and dashes are gone. */ export function normalizeGtin(value) {
|
|
29
|
+
return String(value != null ? value : '').replace(/[\s-]/g, '').replace(/[^0-9]/g, '').slice(0, 14);
|
|
30
|
+
}
|
|
31
|
+
const text = (value, max)=>String(value != null ? value : '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
32
|
+
/**
|
|
33
|
+
* A stored product's channel facts made safe; `undefined` when nothing is
|
|
34
|
+
* set. Never throws: the field is written by the editor, the importer and the
|
|
35
|
+
* REST API, and read on every feed fetch.
|
|
36
|
+
*/ export function normalizeProductChannelFacts(value) {
|
|
37
|
+
var _raw_condition;
|
|
38
|
+
if (!value || typeof value !== 'object') return undefined;
|
|
39
|
+
const raw = value;
|
|
40
|
+
const facts = {};
|
|
41
|
+
const brand = text(raw['brand'], 70);
|
|
42
|
+
if (brand) facts.brand = brand;
|
|
43
|
+
const gtin = normalizeGtin(raw['gtin']);
|
|
44
|
+
if (gtin.length >= 8) facts.gtin = gtin;
|
|
45
|
+
const mpn = text(raw['mpn'], 70);
|
|
46
|
+
if (mpn) facts.mpn = mpn;
|
|
47
|
+
const condition = String((_raw_condition = raw['condition']) != null ? _raw_condition : '').trim().toLowerCase();
|
|
48
|
+
if (PRODUCT_CHANNEL_CONDITIONS.includes(condition)) {
|
|
49
|
+
facts.condition = condition;
|
|
50
|
+
}
|
|
51
|
+
const category = text(raw['googleProductCategory'], 750);
|
|
52
|
+
if (category) facts.googleProductCategory = category;
|
|
53
|
+
return Object.keys(facts).length ? facts : undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Channel facts as the product editor stages them, keystroke by keystroke:
|
|
57
|
+
* what {@link normalizeProductChannelFacts} keeps, except that a field being
|
|
58
|
+
* typed is kept as typed — a barcode shorter than eight digits, a brand with
|
|
59
|
+
* the space before its next word. The editor runs this on every keystroke, so
|
|
60
|
+
* the strict form would erase the field under the cursor; readers normalize
|
|
61
|
+
* what is stored, so a half-typed value never reaches a channel.
|
|
62
|
+
*/ export function draftProductChannelFacts(value) {
|
|
63
|
+
var _raw_condition;
|
|
64
|
+
if (!value || typeof value !== 'object') return undefined;
|
|
65
|
+
const raw = value;
|
|
66
|
+
const facts = {};
|
|
67
|
+
const typed = (field, max)=>{
|
|
68
|
+
var _raw_field;
|
|
69
|
+
return String((_raw_field = raw[field]) != null ? _raw_field : '').replace(/^\s+/, '').slice(0, max);
|
|
70
|
+
};
|
|
71
|
+
const brand = typed('brand', 70);
|
|
72
|
+
if (brand) facts.brand = brand;
|
|
73
|
+
const gtin = normalizeGtin(raw['gtin']);
|
|
74
|
+
if (gtin) facts.gtin = gtin;
|
|
75
|
+
const mpn = typed('mpn', 70);
|
|
76
|
+
if (mpn) facts.mpn = mpn;
|
|
77
|
+
const condition = String((_raw_condition = raw['condition']) != null ? _raw_condition : '').trim().toLowerCase();
|
|
78
|
+
if (PRODUCT_CHANNEL_CONDITIONS.includes(condition)) {
|
|
79
|
+
facts.condition = condition;
|
|
80
|
+
}
|
|
81
|
+
const category = typed('googleProductCategory', 750);
|
|
82
|
+
if (category) facts.googleProductCategory = category;
|
|
83
|
+
return Object.keys(facts).length ? facts : undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=product-channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/product-channel.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * What shopping channels ask of a product beyond what the store shows\n * (AGL-3637): the brand, the manufacturer's identifiers, the condition and\n * Google's category. Entered in the product editor's channel fields and read\n * by the product catalog the store publishes to other plugins\n * (`server/product-catalog.ts`). Every field is optional: a channel feed\n * falls back to the store's defaults and says what is missing.\n */\nexport interface ProductChannelFacts {\n /** The brand a shopper knows it by; at most 70 characters. */\n brand?: string\n /**\n * The product's GTIN (UPC, EAN, ISBN, JAN or ITF-14), digits only. For a\n * product with several configurations each variant's barcode is its own.\n */\n gtin?: string\n /** The manufacturer's part number; at most 70 characters. */\n mpn?: string\n condition?: 'new' | 'refurbished' | 'used'\n /** A Google product taxonomy id (`2271`) or full path. */\n googleProductCategory?: string\n}\n\nexport const PRODUCT_CHANNEL_CONDITIONS = ['new', 'refurbished', 'used'] as const\n\n/** Digits only, at most 14: what a barcode field holds once spaces and dashes are gone. */\nexport function normalizeGtin(value: unknown): string {\n return String(value ?? '')\n .replace(/[\\s-]/g, '')\n .replace(/[^0-9]/g, '')\n .slice(0, 14)\n}\n\nconst text = (value: unknown, max: number): string =>\n String(value ?? '')\n .replace(/\\s+/g, ' ')\n .trim()\n .slice(0, max)\n\n/**\n * A stored product's channel facts made safe; `undefined` when nothing is\n * set. Never throws: the field is written by the editor, the importer and the\n * REST API, and read on every feed fetch.\n */\nexport function normalizeProductChannelFacts(value: unknown): ProductChannelFacts | undefined {\n if (!value || typeof value !== 'object') return undefined\n const raw = value as Record<string, unknown>\n const facts: ProductChannelFacts = {}\n const brand = text(raw['brand'], 70)\n if (brand) facts.brand = brand\n const gtin = normalizeGtin(raw['gtin'])\n if (gtin.length >= 8) facts.gtin = gtin\n const mpn = text(raw['mpn'], 70)\n if (mpn) facts.mpn = mpn\n const condition = String(raw['condition'] ?? '').trim().toLowerCase()\n if ((PRODUCT_CHANNEL_CONDITIONS as readonly string[]).includes(condition)) {\n facts.condition = condition as ProductChannelFacts['condition']\n }\n const category = text(raw['googleProductCategory'], 750)\n if (category) facts.googleProductCategory = category\n return Object.keys(facts).length ? facts : undefined\n}\n\n/**\n * Channel facts as the product editor stages them, keystroke by keystroke:\n * what {@link normalizeProductChannelFacts} keeps, except that a field being\n * typed is kept as typed — a barcode shorter than eight digits, a brand with\n * the space before its next word. The editor runs this on every keystroke, so\n * the strict form would erase the field under the cursor; readers normalize\n * what is stored, so a half-typed value never reaches a channel.\n */\nexport function draftProductChannelFacts(value: unknown): ProductChannelFacts | undefined {\n if (!value || typeof value !== 'object') return undefined\n const raw = value as Record<string, unknown>\n const facts: ProductChannelFacts = {}\n const typed = (field: string, max: number) => String(raw[field] ?? '').replace(/^\\s+/, '').slice(0, max)\n const brand = typed('brand', 70)\n if (brand) facts.brand = brand\n const gtin = normalizeGtin(raw['gtin'])\n if (gtin) facts.gtin = gtin\n const mpn = typed('mpn', 70)\n if (mpn) facts.mpn = mpn\n const condition = String(raw['condition'] ?? '').trim().toLowerCase()\n if ((PRODUCT_CHANNEL_CONDITIONS as readonly string[]).includes(condition)) {\n facts.condition = condition as ProductChannelFacts['condition']\n }\n const category = typed('googleProductCategory', 750)\n if (category) facts.googleProductCategory = category\n return Object.keys(facts).length ? facts : undefined\n}\n"],"names":["PRODUCT_CHANNEL_CONDITIONS","normalizeGtin","value","String","replace","slice","text","max","trim","normalizeProductChannelFacts","raw","undefined","facts","brand","gtin","length","mpn","condition","toLowerCase","includes","category","googleProductCategory","Object","keys","draftProductChannelFacts","typed","field"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAgBD,OAAO,MAAMA,6BAA6B;IAAC;IAAO;IAAe;CAAO,CAAS;AAEjF,yFAAyF,GACzF,OAAO,SAASC,cAAcC,KAAc;IAC1C,OAAOC,OAAOD,gBAAAA,QAAS,IACpBE,OAAO,CAAC,UAAU,IAClBA,OAAO,CAAC,WAAW,IACnBC,KAAK,CAAC,GAAG;AACd;AAEA,MAAMC,OAAO,CAACJ,OAAgBK,MAC5BJ,OAAOD,gBAAAA,QAAS,IACbE,OAAO,CAAC,QAAQ,KAChBI,IAAI,GACJH,KAAK,CAAC,GAAGE;AAEd;;;;CAIC,GACD,OAAO,SAASE,6BAA6BP,KAAc;QAUhCQ;IATzB,IAAI,CAACR,SAAS,OAAOA,UAAU,UAAU,OAAOS;IAChD,MAAMD,MAAMR;IACZ,MAAMU,QAA6B,CAAC;IACpC,MAAMC,QAAQP,KAAKI,GAAG,CAAC,QAAQ,EAAE;IACjC,IAAIG,OAAOD,MAAMC,KAAK,GAAGA;IACzB,MAAMC,OAAOb,cAAcS,GAAG,CAAC,OAAO;IACtC,IAAII,KAAKC,MAAM,IAAI,GAAGH,MAAME,IAAI,GAAGA;IACnC,MAAME,MAAMV,KAAKI,GAAG,CAAC,MAAM,EAAE;IAC7B,IAAIM,KAAKJ,MAAMI,GAAG,GAAGA;IACrB,MAAMC,YAAYd,QAAOO,iBAAAA,GAAG,CAAC,YAAY,YAAhBA,iBAAoB,IAAIF,IAAI,GAAGU,WAAW;IACnE,IAAI,AAAClB,2BAAiDmB,QAAQ,CAACF,YAAY;QACzEL,MAAMK,SAAS,GAAGA;IACpB;IACA,MAAMG,WAAWd,KAAKI,GAAG,CAAC,wBAAwB,EAAE;IACpD,IAAIU,UAAUR,MAAMS,qBAAqB,GAAGD;IAC5C,OAAOE,OAAOC,IAAI,CAACX,OAAOG,MAAM,GAAGH,QAAQD;AAC7C;AAEA;;;;;;;CAOC,GACD,OAAO,SAASa,yBAAyBtB,KAAc;QAW5BQ;IAVzB,IAAI,CAACR,SAAS,OAAOA,UAAU,UAAU,OAAOS;IAChD,MAAMD,MAAMR;IACZ,MAAMU,QAA6B,CAAC;IACpC,MAAMa,QAAQ,CAACC,OAAenB;YAAuBG;eAAPP,QAAOO,aAAAA,GAAG,CAACgB,MAAM,YAAVhB,aAAc,IAAIN,OAAO,CAAC,QAAQ,IAAIC,KAAK,CAAC,GAAGE;;IACpG,MAAMM,QAAQY,MAAM,SAAS;IAC7B,IAAIZ,OAAOD,MAAMC,KAAK,GAAGA;IACzB,MAAMC,OAAOb,cAAcS,GAAG,CAAC,OAAO;IACtC,IAAII,MAAMF,MAAME,IAAI,GAAGA;IACvB,MAAME,MAAMS,MAAM,OAAO;IACzB,IAAIT,KAAKJ,MAAMI,GAAG,GAAGA;IACrB,MAAMC,YAAYd,QAAOO,iBAAAA,GAAG,CAAC,YAAY,YAAhBA,iBAAoB,IAAIF,IAAI,GAAGU,WAAW;IACnE,IAAI,AAAClB,2BAAiDmB,QAAQ,CAACF,YAAY;QACzEL,MAAMK,SAAS,GAAGA;IACpB;IACA,MAAMG,WAAWK,MAAM,yBAAyB;IAChD,IAAIL,UAAUR,MAAMS,qBAAqB,GAAGD;IAC5C,OAAOE,OAAOC,IAAI,CAACX,OAAOG,MAAM,GAAGH,QAAQD;AAC7C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
/** One choice in a modifier group. `priceCents` is added to the item, 0 for free. */
|
|
18
|
+
export interface ProductModifierOption {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
priceCents: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A set of choices offered together ("Milk", "Add-ons"). `min` of 1 or more
|
|
25
|
+
* makes it required; `max` caps how many can be picked (1 = pick one).
|
|
26
|
+
*/
|
|
27
|
+
export interface ProductModifierGroup {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
min: number;
|
|
31
|
+
max: number;
|
|
32
|
+
options: ProductModifierOption[];
|
|
33
|
+
}
|
|
34
|
+
/** A modifier as the order line keeps it: names and price as sold. */
|
|
35
|
+
export interface OrderLineModifier {
|
|
36
|
+
groupId: string;
|
|
37
|
+
optionId: string;
|
|
38
|
+
group: string;
|
|
39
|
+
name: string;
|
|
40
|
+
priceCents: number;
|
|
41
|
+
}
|
|
42
|
+
/** What the register sends for a line: the option ids it picked, nothing priced. */
|
|
43
|
+
export interface ModifierSelection {
|
|
44
|
+
groupId: string;
|
|
45
|
+
optionId: string;
|
|
46
|
+
}
|
|
47
|
+
export declare const POS_MAX_MODIFIER_GROUPS = 10;
|
|
48
|
+
export declare const POS_MAX_MODIFIER_OPTIONS = 20;
|
|
49
|
+
/** $1,000 on one modifier: anything larger is a product, not an add-on. */
|
|
50
|
+
export declare const POS_MAX_MODIFIER_PRICE_CENTS = 100000;
|
|
51
|
+
/** Why a product's modifier groups cannot be saved, or null when they can. */
|
|
52
|
+
export declare function modifierGroupsProblem(groups: unknown): string | null;
|
|
53
|
+
/** The product's groups, or none when they are missing or malformed. */
|
|
54
|
+
export declare function productModifierGroups(product: {
|
|
55
|
+
modifierGroups?: unknown;
|
|
56
|
+
}): ProductModifierGroup[];
|
|
57
|
+
/** Whether a group must be answered before the item can be added. */
|
|
58
|
+
export declare function modifierGroupRequired(group: ProductModifierGroup): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Prices a line's chosen modifiers from the PRODUCT, in group order, and
|
|
61
|
+
* checks every group's minimum and maximum. Unknown ids, a repeated choice
|
|
62
|
+
* and a group answered past its maximum are refused with what to fix.
|
|
63
|
+
*/
|
|
64
|
+
export interface ResolvedLineModifiers {
|
|
65
|
+
ok: boolean;
|
|
66
|
+
/** The chosen modifiers, in group order; empty when not `ok`. */
|
|
67
|
+
modifiers: OrderLineModifier[];
|
|
68
|
+
/** What they add to one unit, in cents. */
|
|
69
|
+
extraCents: number;
|
|
70
|
+
/** What to fix, when not `ok`. */
|
|
71
|
+
error?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare function resolveLineModifiers(product: {
|
|
74
|
+
name?: string;
|
|
75
|
+
modifierGroups?: unknown;
|
|
76
|
+
}, raw: unknown): ResolvedLineModifiers;
|
|
77
|
+
/** The label a line prints: the variant, then each modifier (`Large / Oat milk, Extra shot`). */
|
|
78
|
+
export declare function lineLabelWithModifiers(variantLabel: string | undefined, modifiers: readonly Pick<OrderLineModifier, 'name'>[]): string;
|
|
79
|
+
/** Two lines merge only when they are the same item with the same choices. */
|
|
80
|
+
export declare function modifierSelectionKey(selection: readonly ModifierSelection[] | undefined): string;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /*==========================================
|
|
17
|
+
* REGISTER MODIFIERS AND QUICK KEYS (AGL-3607).
|
|
18
|
+
*
|
|
19
|
+
* A modifier is a choice added to an item as it is rung up — "Oat milk",
|
|
20
|
+
* "Extra shot +$0.75", "No onions" — that is not a stocked variant. Groups
|
|
21
|
+
* live on the product (`modifierGroups`); the register sends the chosen
|
|
22
|
+
* option ids with each line and the SERVER prices them from the product
|
|
23
|
+
* document, so a register never names what a modifier costs.
|
|
24
|
+
*
|
|
25
|
+
* A chosen modifier is folded into the line's `variantLabel` as well as kept
|
|
26
|
+
* structured in `modifiers`: every receipt, email, order view and export
|
|
27
|
+
* already prints the label, so the choice reaches all of them without each
|
|
28
|
+
* learning a new field.
|
|
29
|
+
*=========================================*/ /** One choice in a modifier group. `priceCents` is added to the item, 0 for free. */ export const POS_MAX_MODIFIER_GROUPS = 10;
|
|
30
|
+
export const POS_MAX_MODIFIER_OPTIONS = 20;
|
|
31
|
+
/** $1,000 on one modifier: anything larger is a product, not an add-on. */ export const POS_MAX_MODIFIER_PRICE_CENTS = 100000;
|
|
32
|
+
/** Why a product's modifier groups cannot be saved, or null when they can. */ export function modifierGroupsProblem(groups) {
|
|
33
|
+
if (groups == null) return null;
|
|
34
|
+
if (!Array.isArray(groups)) return 'Modifiers must be a list';
|
|
35
|
+
if (groups.length > POS_MAX_MODIFIER_GROUPS) {
|
|
36
|
+
return `At most ${POS_MAX_MODIFIER_GROUPS} modifier groups per product`;
|
|
37
|
+
}
|
|
38
|
+
const groupIds = new Set();
|
|
39
|
+
for (const group of groups){
|
|
40
|
+
var _group_name;
|
|
41
|
+
if (!(group == null ? void 0 : group.id) || groupIds.has(group.id)) return 'Modifier groups need unique ids';
|
|
42
|
+
groupIds.add(group.id);
|
|
43
|
+
if (!String((_group_name = group.name) != null ? _group_name : '').trim()) return 'Name every modifier group';
|
|
44
|
+
const options = Array.isArray(group.options) ? group.options : [];
|
|
45
|
+
if (options.length === 0) return `Add a choice to “${group.name}”`;
|
|
46
|
+
if (options.length > POS_MAX_MODIFIER_OPTIONS) {
|
|
47
|
+
return `“${group.name}” has more than ${POS_MAX_MODIFIER_OPTIONS} choices`;
|
|
48
|
+
}
|
|
49
|
+
const optionIds = new Set();
|
|
50
|
+
for (const option of options){
|
|
51
|
+
var _option_name;
|
|
52
|
+
if (!(option == null ? void 0 : option.id) || optionIds.has(option.id)) return 'Modifier choices need unique ids';
|
|
53
|
+
optionIds.add(option.id);
|
|
54
|
+
if (!String((_option_name = option.name) != null ? _option_name : '').trim()) return `Name every choice in “${group.name}”`;
|
|
55
|
+
const price = option.priceCents;
|
|
56
|
+
if (!Number.isInteger(price) || price < 0 || price > POS_MAX_MODIFIER_PRICE_CENTS) {
|
|
57
|
+
return `“${option.name}” needs a price of $0 to $1,000`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const { min, max } = group;
|
|
61
|
+
if (!Number.isInteger(min) || min < 0) return `“${group.name}” needs a minimum of 0 or more`;
|
|
62
|
+
if (!Number.isInteger(max) || max < 1 || max > options.length) {
|
|
63
|
+
return `“${group.name}” allows 1 to ${options.length} choices`;
|
|
64
|
+
}
|
|
65
|
+
if (min > max) return `“${group.name}” requires more choices than it allows`;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/** The product's groups, or none when they are missing or malformed. */ export function productModifierGroups(product) {
|
|
70
|
+
const groups = product == null ? void 0 : product.modifierGroups;
|
|
71
|
+
if (!Array.isArray(groups) || modifierGroupsProblem(groups)) return [];
|
|
72
|
+
return groups;
|
|
73
|
+
}
|
|
74
|
+
/** Whether a group must be answered before the item can be added. */ export function modifierGroupRequired(group) {
|
|
75
|
+
return group.min > 0;
|
|
76
|
+
}
|
|
77
|
+
export function resolveLineModifiers(product, raw) {
|
|
78
|
+
const refuse = (error)=>({
|
|
79
|
+
ok: false,
|
|
80
|
+
modifiers: [],
|
|
81
|
+
extraCents: 0,
|
|
82
|
+
error
|
|
83
|
+
});
|
|
84
|
+
const groups = productModifierGroups(product);
|
|
85
|
+
const picks = (Array.isArray(raw) ? raw : []).slice(0, POS_MAX_MODIFIER_GROUPS * POS_MAX_MODIFIER_OPTIONS).map((entry)=>{
|
|
86
|
+
var _ref, _ref1;
|
|
87
|
+
return {
|
|
88
|
+
groupId: String((_ref = entry == null ? void 0 : entry.groupId) != null ? _ref : ''),
|
|
89
|
+
optionId: String((_ref1 = entry == null ? void 0 : entry.optionId) != null ? _ref1 : '')
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
const seen = new Set();
|
|
93
|
+
for (const pick of picks){
|
|
94
|
+
const key = `${pick.groupId}:${pick.optionId}`;
|
|
95
|
+
if (seen.has(key)) return refuse(`A choice on ${product.name} was picked twice.`);
|
|
96
|
+
seen.add(key);
|
|
97
|
+
const group = groups.find((entry)=>entry.id === pick.groupId);
|
|
98
|
+
if (!group || !group.options.some((option)=>option.id === pick.optionId)) {
|
|
99
|
+
return refuse(`A choice on ${product.name} is no longer offered. Remove it and add it again.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const modifiers = [];
|
|
103
|
+
for (const group of groups){
|
|
104
|
+
const chosen = group.options.filter((option)=>picks.some((pick)=>pick.groupId === group.id && pick.optionId === option.id));
|
|
105
|
+
if (chosen.length < group.min) {
|
|
106
|
+
return refuse(`Choose ${group.name.toLowerCase()} for ${product.name}.`);
|
|
107
|
+
}
|
|
108
|
+
if (chosen.length > group.max) {
|
|
109
|
+
return refuse(`Choose at most ${group.max} for ${group.name.toLowerCase()} on ${product.name}.`);
|
|
110
|
+
}
|
|
111
|
+
for (const option of chosen){
|
|
112
|
+
modifiers.push({
|
|
113
|
+
groupId: group.id,
|
|
114
|
+
optionId: option.id,
|
|
115
|
+
group: group.name,
|
|
116
|
+
name: option.name,
|
|
117
|
+
priceCents: option.priceCents
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
modifiers,
|
|
124
|
+
extraCents: modifiers.reduce((sum, modifier)=>sum + modifier.priceCents, 0)
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** The label a line prints: the variant, then each modifier (`Large / Oat milk, Extra shot`). */ export function lineLabelWithModifiers(variantLabel, modifiers) {
|
|
128
|
+
const added = modifiers.map((modifier)=>modifier.name).join(', ');
|
|
129
|
+
return [
|
|
130
|
+
variantLabel,
|
|
131
|
+
added
|
|
132
|
+
].filter(Boolean).join(' / ');
|
|
133
|
+
}
|
|
134
|
+
/** Two lines merge only when they are the same item with the same choices. */ export function modifierSelectionKey(selection) {
|
|
135
|
+
return [
|
|
136
|
+
...selection != null ? selection : []
|
|
137
|
+
].map((pick)=>`${pick.groupId}:${pick.optionId}`).sort().join('|');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=product-modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/product-modifiers.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * REGISTER MODIFIERS AND QUICK KEYS (AGL-3607).\n *\n * A modifier is a choice added to an item as it is rung up — \"Oat milk\",\n * \"Extra shot +$0.75\", \"No onions\" — that is not a stocked variant. Groups\n * live on the product (`modifierGroups`); the register sends the chosen\n * option ids with each line and the SERVER prices them from the product\n * document, so a register never names what a modifier costs.\n *\n * A chosen modifier is folded into the line's `variantLabel` as well as kept\n * structured in `modifiers`: every receipt, email, order view and export\n * already prints the label, so the choice reaches all of them without each\n * learning a new field.\n *=========================================*/\n\n/** One choice in a modifier group. `priceCents` is added to the item, 0 for free. */\nexport interface ProductModifierOption {\n id: string\n name: string\n priceCents: number\n}\n\n/**\n * A set of choices offered together (\"Milk\", \"Add-ons\"). `min` of 1 or more\n * makes it required; `max` caps how many can be picked (1 = pick one).\n */\nexport interface ProductModifierGroup {\n id: string\n name: string\n min: number\n max: number\n options: ProductModifierOption[]\n}\n\n/** A modifier as the order line keeps it: names and price as sold. */\nexport interface OrderLineModifier {\n groupId: string\n optionId: string\n group: string\n name: string\n priceCents: number\n}\n\n/** What the register sends for a line: the option ids it picked, nothing priced. */\nexport interface ModifierSelection {\n groupId: string\n optionId: string\n}\n\nexport const POS_MAX_MODIFIER_GROUPS = 10\nexport const POS_MAX_MODIFIER_OPTIONS = 20\n/** $1,000 on one modifier: anything larger is a product, not an add-on. */\nexport const POS_MAX_MODIFIER_PRICE_CENTS = 100_000\n\n/** Why a product's modifier groups cannot be saved, or null when they can. */\nexport function modifierGroupsProblem(groups: unknown): string | null {\n if (groups == null) return null\n if (!Array.isArray(groups)) return 'Modifiers must be a list'\n if (groups.length > POS_MAX_MODIFIER_GROUPS) {\n return `At most ${POS_MAX_MODIFIER_GROUPS} modifier groups per product`\n }\n const groupIds = new Set<string>()\n for (const group of groups as ProductModifierGroup[]) {\n if (!group?.id || groupIds.has(group.id)) return 'Modifier groups need unique ids'\n groupIds.add(group.id)\n if (!String(group.name ?? '').trim()) return 'Name every modifier group'\n const options = Array.isArray(group.options) ? group.options : []\n if (options.length === 0) return `Add a choice to “${group.name}”`\n if (options.length > POS_MAX_MODIFIER_OPTIONS) {\n return `“${group.name}” has more than ${POS_MAX_MODIFIER_OPTIONS} choices`\n }\n const optionIds = new Set<string>()\n for (const option of options) {\n if (!option?.id || optionIds.has(option.id)) return 'Modifier choices need unique ids'\n optionIds.add(option.id)\n if (!String(option.name ?? '').trim()) return `Name every choice in “${group.name}”`\n const price = option.priceCents\n if (!Number.isInteger(price) || price < 0 || price > POS_MAX_MODIFIER_PRICE_CENTS) {\n return `“${option.name}” needs a price of $0 to $1,000`\n }\n }\n const { min, max } = group\n if (!Number.isInteger(min) || min < 0) return `“${group.name}” needs a minimum of 0 or more`\n if (!Number.isInteger(max) || max < 1 || max > options.length) {\n return `“${group.name}” allows 1 to ${options.length} choices`\n }\n if (min > max) return `“${group.name}” requires more choices than it allows`\n }\n return null\n}\n\n/** The product's groups, or none when they are missing or malformed. */\nexport function productModifierGroups(product: {\n modifierGroups?: unknown\n}): ProductModifierGroup[] {\n const groups = product?.modifierGroups\n if (!Array.isArray(groups) || modifierGroupsProblem(groups)) return []\n return groups as ProductModifierGroup[]\n}\n\n/** Whether a group must be answered before the item can be added. */\nexport function modifierGroupRequired(group: ProductModifierGroup): boolean {\n return group.min > 0\n}\n\n/**\n * Prices a line's chosen modifiers from the PRODUCT, in group order, and\n * checks every group's minimum and maximum. Unknown ids, a repeated choice\n * and a group answered past its maximum are refused with what to fix.\n */\nexport interface ResolvedLineModifiers {\n ok: boolean\n /** The chosen modifiers, in group order; empty when not `ok`. */\n modifiers: OrderLineModifier[]\n /** What they add to one unit, in cents. */\n extraCents: number\n /** What to fix, when not `ok`. */\n error?: string\n}\n\nexport function resolveLineModifiers(\n product: { name?: string; modifierGroups?: unknown },\n raw: unknown,\n): ResolvedLineModifiers {\n const refuse = (error: string): ResolvedLineModifiers => ({\n ok: false,\n modifiers: [],\n extraCents: 0,\n error,\n })\n const groups = productModifierGroups(product)\n const picks: ModifierSelection[] = (Array.isArray(raw) ? raw : [])\n .slice(0, POS_MAX_MODIFIER_GROUPS * POS_MAX_MODIFIER_OPTIONS)\n .map((entry: any) => ({\n groupId: String(entry?.groupId ?? ''),\n optionId: String(entry?.optionId ?? ''),\n }))\n const seen = new Set<string>()\n for (const pick of picks) {\n const key = `${pick.groupId}:${pick.optionId}`\n if (seen.has(key)) return refuse(`A choice on ${product.name} was picked twice.`)\n seen.add(key)\n const group = groups.find((entry) => entry.id === pick.groupId)\n if (!group || !group.options.some((option) => option.id === pick.optionId)) {\n return refuse(`A choice on ${product.name} is no longer offered. Remove it and add it again.`)\n }\n }\n const modifiers: OrderLineModifier[] = []\n for (const group of groups) {\n const chosen = group.options.filter((option) =>\n picks.some((pick) => pick.groupId === group.id && pick.optionId === option.id),\n )\n if (chosen.length < group.min) {\n return refuse(`Choose ${group.name.toLowerCase()} for ${product.name}.`)\n }\n if (chosen.length > group.max) {\n return refuse(`Choose at most ${group.max} for ${group.name.toLowerCase()} on ${product.name}.`)\n }\n for (const option of chosen) {\n modifiers.push({\n groupId: group.id,\n optionId: option.id,\n group: group.name,\n name: option.name,\n priceCents: option.priceCents,\n })\n }\n }\n return {\n ok: true,\n modifiers,\n extraCents: modifiers.reduce((sum, modifier) => sum + modifier.priceCents, 0),\n }\n}\n\n/** The label a line prints: the variant, then each modifier (`Large / Oat milk, Extra shot`). */\nexport function lineLabelWithModifiers(\n variantLabel: string | undefined,\n modifiers: readonly Pick<OrderLineModifier, 'name'>[],\n): string {\n const added = modifiers.map((modifier) => modifier.name).join(', ')\n return [variantLabel, added].filter(Boolean).join(' / ')\n}\n\n/** Two lines merge only when they are the same item with the same choices. */\nexport function modifierSelectionKey(selection: readonly ModifierSelection[] | undefined): string {\n return [...(selection ?? [])]\n .map((pick) => `${pick.groupId}:${pick.optionId}`)\n .sort()\n .join('|')\n}\n"],"names":["POS_MAX_MODIFIER_GROUPS","POS_MAX_MODIFIER_OPTIONS","POS_MAX_MODIFIER_PRICE_CENTS","modifierGroupsProblem","groups","Array","isArray","length","groupIds","Set","group","id","has","add","String","name","trim","options","optionIds","option","price","priceCents","Number","isInteger","min","max","productModifierGroups","product","modifierGroups","modifierGroupRequired","resolveLineModifiers","raw","refuse","error","ok","modifiers","extraCents","picks","slice","map","entry","groupId","optionId","seen","pick","key","find","some","chosen","filter","toLowerCase","push","reduce","sum","modifier","lineLabelWithModifiers","variantLabel","added","join","Boolean","modifierSelectionKey","selection","sort"],"mappings":"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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 { HostOrder } from './commerce-orders';
|
|
18
|
+
import { type ShipNotice, type ShipStationOrderSource, type ShipStationProducts } from './shipstation';
|
|
19
|
+
/** Where ShippingEasy's API answers. A deployment may point elsewhere with `SHIPPINGEASY_API_BASE_URL`. */
|
|
20
|
+
export declare const SHIPPINGEASY_DEFAULT_BASE_URL = "https://app.shippingeasy.com";
|
|
21
|
+
/** How far a signed callback's `api_timestamp` may be from now: the Ruby client's own hour. */
|
|
22
|
+
export declare const SHIPPINGEASY_TIMESTAMP_TOLERANCE_MS: number;
|
|
23
|
+
/** The status an order arrives in ShippingEasy with. */
|
|
24
|
+
export declare const SHIPPINGEASY_AWAITING_SHIPMENT = "awaiting_shipment";
|
|
25
|
+
/**
|
|
26
|
+
* A value form-encoded as Ruby's `URI.encode_www_form_component` writes it,
|
|
27
|
+
* which is what ShippingEasy's signature was computed over: letters, digits
|
|
28
|
+
* and `*-._` as they are, a space as `+`, every other byte as `%XX` upper-case.
|
|
29
|
+
*/
|
|
30
|
+
export declare function shippingEasyFormComponent(value: string): string;
|
|
31
|
+
/** The parameters sorted by name and joined `a=1&b=2`, as the signature reads them. `api_signature` is never part of it. */
|
|
32
|
+
export declare function shippingEasyCanonicalQuery(params: Readonly<Record<string, string>>): string;
|
|
33
|
+
/** The plaintext a request's signature is the HMAC of: `METHOD&path&query&body`, the body left off when empty. */
|
|
34
|
+
export declare function shippingEasySignaturePlaintext(input: {
|
|
35
|
+
method: string;
|
|
36
|
+
path: string;
|
|
37
|
+
params: Readonly<Record<string, string>>;
|
|
38
|
+
body?: string | null;
|
|
39
|
+
}): string;
|
|
40
|
+
/** What a changed order asks of ShippingEasy. */
|
|
41
|
+
export type ShippingEasyIntent = 'create' | 'cancel' | null;
|
|
42
|
+
/**
|
|
43
|
+
* Whether an order goes to ShippingEasy, comes back out of it, or neither.
|
|
44
|
+
*
|
|
45
|
+
* - A paid or partly shipped order with something to ship and a full
|
|
46
|
+
* ship-to address is CREATED. A test-mode order never is: ShippingEasy is
|
|
47
|
+
* the merchant's real label account, and a label bought for a test order
|
|
48
|
+
* is real postage.
|
|
49
|
+
* - A canceled or fully refunded order is CANCELED there, which the caller
|
|
50
|
+
* does only when it once sent the order.
|
|
51
|
+
* - Anything else (pending, shipped, delivered) asks nothing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function shippingEasyIntent(order: Partial<HostOrder> & {
|
|
54
|
+
livemode?: unknown;
|
|
55
|
+
requiresShipping?: unknown;
|
|
56
|
+
}, docId: string): ShippingEasyIntent;
|
|
57
|
+
/** A full name as ShippingEasy's first and last name: the last word is the last name. */
|
|
58
|
+
export declare function splitPersonName(name: unknown): {
|
|
59
|
+
first_name?: string;
|
|
60
|
+
last_name?: string;
|
|
61
|
+
};
|
|
62
|
+
/** The order identifier ShippingEasy keeps: the order number the merchant sees, else the document id. */
|
|
63
|
+
export declare function shippingEasyExternalId(order: Pick<HostOrder, 'number'>, docId: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* The `{ order }` body that creates an order in ShippingEasy. The items are
|
|
66
|
+
* what is LEFT to ship, so a partly shipped order sent after its first parcel
|
|
67
|
+
* asks for the rest; each carries its line's index as `ext_line_item_id`,
|
|
68
|
+
* which the shipment callback hands back to name the line.
|
|
69
|
+
*/
|
|
70
|
+
export declare function shippingEasyOrderPayload(source: ShipStationOrderSource, products?: ShipStationProducts): {
|
|
71
|
+
order: Record<string, unknown>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* The label states that mean a parcel is on its way. `label_pending` is not
|
|
75
|
+
* bought yet and `cancelled` was voided, so neither ships anything.
|
|
76
|
+
*/
|
|
77
|
+
export declare const SHIPPINGEASY_SHIPPED_STATES: ReadonlySet<string>;
|
|
78
|
+
/** What one callback says. */
|
|
79
|
+
export interface ShippingEasyCallback {
|
|
80
|
+
/** ShippingEasy's own shipment id, for the log. */
|
|
81
|
+
shipmentId: string | null;
|
|
82
|
+
workflowState: string;
|
|
83
|
+
/** One notice per order the shipment carries, in the shape every connector records. */
|
|
84
|
+
notices: ShipNotice[];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A shipment callback's JSON read into notices, or the reason it cannot be.
|
|
88
|
+
* Each order of the shipment is one notice under the shipment's tracking
|
|
89
|
+
* number; its items are the recipients' line items, named back by the
|
|
90
|
+
* `ext_line_item_id` the order was sent with, else by SKU.
|
|
91
|
+
*/
|
|
92
|
+
export declare function readShippingEasyCallback(body: string): ShippingEasyCallback | {
|
|
93
|
+
problem: string;
|
|
94
|
+
};
|