@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/index.js.map +1 -1
- package/src/lib/barcode/barcode-decode.d.ts +71 -0
- package/src/lib/barcode/barcode-decode.js +498 -0
- package/src/lib/barcode/barcode-decode.js.map +1 -0
- package/src/lib/barcode/barcode-encode.d.ts +44 -0
- package/src/lib/barcode/barcode-encode.js +138 -0
- package/src/lib/barcode/barcode-encode.js.map +1 -0
- package/src/lib/barcode/barcode-scanner.component.d.ts +23 -0
- package/src/lib/barcode/barcode-scanner.component.js +260 -0
- package/src/lib/barcode/barcode-scanner.component.js.map +1 -0
- package/src/lib/barcode/scan-button.component.d.ts +10 -0
- package/src/lib/barcode/scan-button.component.js +62 -0
- package/src/lib/barcode/scan-button.component.js.map +1 -0
- package/src/lib/barcode/scanner-wedge.d.ts +35 -0
- package/src/lib/barcode/scanner-wedge.js +108 -0
- package/src/lib/barcode/scanner-wedge.js.map +1 -0
- package/src/lib/components/account.js +10 -1
- package/src/lib/components/account.js.map +1 -1
- package/src/lib/components/cart-extras.d.ts +45 -0
- package/src/lib/components/cart-extras.js +127 -0
- package/src/lib/components/cart-extras.js.map +1 -0
- package/src/lib/components/cart.js +82 -15
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/checkout-return-notice.d.ts +26 -0
- package/src/lib/components/checkout-return-notice.js +48 -0
- package/src/lib/components/checkout-return-notice.js.map +1 -0
- package/src/lib/components/commerce-console-page.js +124 -0
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/commerce-console-sections.d.ts +1 -1
- package/src/lib/components/commerce-console-sections.js +4 -0
- package/src/lib/components/commerce-console-sections.js.map +1 -1
- package/src/lib/components/console/bulk-fulfill.d.ts +44 -0
- package/src/lib/components/console/bulk-fulfill.js +84 -0
- package/src/lib/components/console/bulk-fulfill.js.map +1 -0
- package/src/lib/components/console/catalog-organization-card.component.js +1 -0
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
- package/src/lib/components/console/customer-notifications-card.component.d.ts +19 -0
- package/src/lib/components/console/customer-notifications-card.component.js +149 -0
- package/src/lib/components/console/customer-notifications-card.component.js.map +1 -0
- package/src/lib/components/console/host-orders-card.component.js +88 -6
- package/src/lib/components/console/host-orders-card.component.js.map +1 -1
- package/src/lib/components/console/locations-card.component.js +164 -57
- package/src/lib/components/console/locations-card.component.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +209 -61
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-fulfillment-panel.component.d.ts +48 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js +542 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -0
- package/src/lib/components/console/order-invoice.component.d.ts +33 -0
- package/src/lib/components/console/order-invoice.component.js +81 -0
- package/src/lib/components/console/order-invoice.component.js.map +1 -0
- package/src/lib/components/console/order-receipt-resend.component.d.ts +21 -0
- package/src/lib/components/console/order-receipt-resend.component.js +203 -0
- package/src/lib/components/console/order-receipt-resend.component.js.map +1 -0
- package/src/lib/components/console/order-returns.component.d.ts +36 -0
- package/src/lib/components/console/order-returns.component.js +142 -0
- package/src/lib/components/console/order-returns.component.js.map +1 -0
- package/src/lib/components/console/order-shipping-actions.component.d.ts +54 -0
- package/src/lib/components/console/order-shipping-actions.component.js +149 -0
- package/src/lib/components/console/order-shipping-actions.component.js.map +1 -0
- package/src/lib/components/console/order-webhooks-card.component.d.ts +50 -0
- package/src/lib/components/console/order-webhooks-card.component.js +623 -0
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -0
- package/src/lib/components/console/order-zones.d.ts +155 -0
- package/src/lib/components/console/order-zones.js +40 -0
- package/src/lib/components/console/order-zones.js.map +1 -0
- package/src/lib/components/console/payment-methods-card.component.d.ts +67 -0
- package/src/lib/components/console/payment-methods-card.component.js +395 -0
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-api.d.ts +124 -0
- package/src/lib/components/console/pos/pos-api.js +101 -0
- package/src/lib/components/console/pos/pos-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +36 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +160 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js +352 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-product-grid.component.d.ts +47 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js +272 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.d.ts +27 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js +282 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +53 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js +445 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.d.ts +31 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js +640 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.d.ts +43 -0
- package/src/lib/components/console/pos/use-pos-display.js +161 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +14 -0
- package/src/lib/components/console/pos-devices-card.component.js +546 -0
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -0
- package/src/lib/components/console/pos-display/brand-screen.d.ts +33 -0
- package/src/lib/components/console/pos-display/brand-screen.js +85 -0
- package/src/lib/components/console/pos-display/brand-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/cart-screen.d.ts +29 -0
- package/src/lib/components/console/pos-display/cart-screen.js +166 -0
- package/src/lib/components/console/pos-display/cart-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pairing-screen.d.ts +24 -0
- package/src/lib/components/console/pos-display/pairing-screen.js +127 -0
- package/src/lib/components/console/pos-display/pairing-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +90 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +140 -0
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -0
- package/src/lib/components/console/pos-display/receipt-screen.d.ts +35 -0
- package/src/lib/components/console/pos-display/receipt-screen.js +200 -0
- package/src/lib/components/console/pos-display/receipt-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/tip-screen.d.ts +36 -0
- package/src/lib/components/console/pos-display/tip-screen.js +211 -0
- package/src/lib/components/console/pos-display/tip-screen.js.map +1 -0
- package/src/lib/components/console/pos-display-page.component.d.ts +16 -0
- package/src/lib/components/console/pos-display-page.component.js +407 -0
- package/src/lib/components/console/pos-display-page.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +289 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js +61 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +38 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +129 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js +60 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.d.ts +48 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js +220 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.d.ts +63 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js +186 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt.d.ts +39 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js +182 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js +465 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.d.ts +29 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js +253 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +494 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js +102 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.d.ts +30 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js +277 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/register-ops.d.ts +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.d.ts +46 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js +128 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.d.ts +36 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js +64 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js.map +1 -0
- package/src/lib/components/console/pos-page.component.d.ts +13 -5
- package/src/lib/components/console/pos-page.component.js +756 -654
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/pos-zones.d.ts +23 -0
- package/src/lib/components/console/pos-zones.js +31 -0
- package/src/lib/components/console/pos-zones.js.map +1 -0
- package/src/lib/components/console/product-editor-dialog.component.js +61 -71
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-labels-dialog.component.d.ts +13 -0
- package/src/lib/components/console/product-labels-dialog.component.js +197 -0
- package/src/lib/components/console/product-labels-dialog.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +19 -0
- package/src/lib/components/console/product-register-fields.component.js +241 -0
- package/src/lib/components/console/product-register-fields.component.js.map +1 -0
- package/src/lib/components/console/product-zones.d.ts +44 -0
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +23 -20
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
- package/src/lib/components/console/register-hardware-card.component.js +826 -0
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
- package/src/lib/components/console/registers-card.component.js +24 -5
- package/src/lib/components/console/registers-card.component.js.map +1 -1
- package/src/lib/components/console/return-actions.d.ts +38 -0
- package/src/lib/components/console/return-actions.js +76 -0
- package/src/lib/components/console/return-actions.js.map +1 -0
- package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
- package/src/lib/components/console/return-detail-dialog.component.js +718 -0
- package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
- package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
- package/src/lib/components/console/return-settings-card.component.js +195 -0
- package/src/lib/components/console/return-settings-card.component.js.map +1 -0
- package/src/lib/components/console/return-zones.d.ts +87 -0
- package/src/lib/components/console/return-zones.js +31 -0
- package/src/lib/components/console/return-zones.js.map +1 -0
- package/src/lib/components/console/returns-card.component.d.ts +45 -0
- package/src/lib/components/console/returns-card.component.js +159 -0
- package/src/lib/components/console/returns-card.component.js.map +1 -0
- package/src/lib/components/console/shipping-settings-card.component.js +161 -5
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
- package/src/lib/components/console/shippingeasy-card.component.js +378 -0
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
- package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
- package/src/lib/components/console/shipstation-card.component.js +345 -0
- package/src/lib/components/console/shipstation-card.component.js.map +1 -0
- package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/start-return-dialog.component.js +243 -0
- package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/stock-movements-card.component.js +2 -1
- package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +2 -66
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-zones.d.ts +42 -0
- package/src/lib/components/console/store-zones.js +39 -0
- package/src/lib/components/console/store-zones.js.map +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js.map +1 -1
- package/src/lib/components/order-status.d.ts +36 -0
- package/src/lib/components/order-status.js +502 -0
- package/src/lib/components/order-status.js.map +1 -0
- package/src/lib/components/product-detail.js +41 -2
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/return-request.d.ts +32 -0
- package/src/lib/components/return-request.js +576 -0
- package/src/lib/components/return-request.js.map +1 -0
- package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
- package/src/lib/components/storefront-payment-appearance.js +114 -0
- package/src/lib/components/storefront-payment-appearance.js.map +1 -0
- package/src/lib/components/storefront-payment-element.d.ts +57 -1
- package/src/lib/components/storefront-payment-element.js +332 -33
- package/src/lib/components/storefront-payment-element.js.map +1 -1
- package/src/lib/constants/order-status.d.ts +22 -0
- package/src/lib/constants/order-status.js +22 -0
- package/src/lib/constants/order-status.js.map +1 -0
- package/src/lib/constants/return-request.d.ts +27 -0
- package/src/lib/constants/return-request.js +32 -0
- package/src/lib/constants/return-request.js.map +1 -0
- package/src/lib/constants/stock-movement-query.js +2 -1
- package/src/lib/constants/stock-movement-query.js.map +1 -1
- package/src/lib/declarations.console-server.js +9 -0
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.server.d.ts +2 -1
- package/src/lib/declarations.server.js +68 -1
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/buyer-notifications.d.ts +59 -0
- package/src/lib/model/buyer-notifications.js +97 -0
- package/src/lib/model/buyer-notifications.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +171 -2
- package/src/lib/model/commerce-orders.js +26 -16
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-payment-methods.d.ts +146 -0
- package/src/lib/model/commerce-payment-methods.js +247 -0
- package/src/lib/model/commerce-payment-methods.js.map +1 -0
- package/src/lib/model/commerce-pos-ops.d.ts +437 -0
- package/src/lib/model/commerce-pos-ops.js +721 -0
- package/src/lib/model/commerce-pos-ops.js.map +1 -0
- package/src/lib/model/commerce-pos.d.ts +263 -0
- package/src/lib/model/commerce-pos.js +375 -0
- package/src/lib/model/commerce-pos.js.map +1 -0
- package/src/lib/model/commerce-printers.d.ts +211 -0
- package/src/lib/model/commerce-printers.js +181 -0
- package/src/lib/model/commerce-printers.js.map +1 -0
- package/src/lib/model/commerce-receipt.d.ts +97 -0
- package/src/lib/model/commerce-receipt.js +180 -0
- package/src/lib/model/commerce-receipt.js.map +1 -0
- package/src/lib/model/commerce-returns.d.ts +207 -0
- package/src/lib/model/commerce-returns.js +300 -0
- package/src/lib/model/commerce-returns.js.map +1 -0
- package/src/lib/model/commerce-shipping.d.ts +44 -1
- package/src/lib/model/commerce-shipping.js +53 -9
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/commerce-tax-engine.d.ts +90 -0
- package/src/lib/model/commerce-tax-engine.js +129 -0
- package/src/lib/model/commerce-tax-engine.js.map +1 -0
- package/src/lib/model/commerce.d.ts +91 -2
- package/src/lib/model/commerce.js +89 -1
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/index.d.ts +16 -0
- package/src/lib/model/index.js +16 -0
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/model/order-events.d.ts +154 -0
- package/src/lib/model/order-events.js +153 -0
- package/src/lib/model/order-events.js.map +1 -0
- package/src/lib/model/order-fulfillment.d.ts +117 -0
- package/src/lib/model/order-fulfillment.js +217 -0
- package/src/lib/model/order-fulfillment.js.map +1 -0
- package/src/lib/model/order-history.d.ts +58 -0
- package/src/lib/model/order-history.js +22 -0
- package/src/lib/model/order-history.js.map +1 -0
- package/src/lib/model/order-list-fields.d.ts +9 -1
- package/src/lib/model/order-list-fields.js +7 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/order-shipping-export.d.ts +91 -0
- package/src/lib/model/order-shipping-export.js +192 -0
- package/src/lib/model/order-shipping-export.js.map +1 -0
- package/src/lib/model/order-status-view.d.ts +103 -0
- package/src/lib/model/order-status-view.js +156 -0
- package/src/lib/model/order-status-view.js.map +1 -0
- package/src/lib/model/order-webhooks.d.ts +142 -0
- package/src/lib/model/order-webhooks.js +91 -0
- package/src/lib/model/order-webhooks.js.map +1 -0
- package/src/lib/model/product-channel.d.ts +56 -0
- package/src/lib/model/product-channel.js +86 -0
- package/src/lib/model/product-channel.js.map +1 -0
- package/src/lib/model/product-modifiers.d.ts +80 -0
- package/src/lib/model/product-modifiers.js +140 -0
- package/src/lib/model/product-modifiers.js.map +1 -0
- package/src/lib/model/product-write.d.ts +186 -0
- package/src/lib/model/product-write.js +116 -0
- package/src/lib/model/product-write.js.map +1 -0
- package/src/lib/model/shippingeasy.d.ts +94 -0
- package/src/lib/model/shippingeasy.js +267 -0
- package/src/lib/model/shippingeasy.js.map +1 -0
- package/src/lib/model/shipstation.d.ts +125 -0
- package/src/lib/model/shipstation.js +399 -0
- package/src/lib/model/shipstation.js.map +1 -0
- package/src/lib/model/smart-collection-reads.d.ts +32 -0
- package/src/lib/model/smart-collection-reads.js +63 -0
- package/src/lib/model/smart-collection-reads.js.map +1 -0
- package/src/lib/model/tracking-url.d.ts +74 -0
- package/src/lib/model/tracking-url.js +159 -0
- package/src/lib/model/tracking-url.js.map +1 -0
- package/src/lib/plugin-config.d.ts +13 -0
- package/src/lib/plugin-config.js +77 -5
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +26 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/pos-ops-config.d.ts +39 -0
- package/src/lib/pos-ops-config.js +88 -0
- package/src/lib/pos-ops-config.js.map +1 -0
- package/src/lib/printing/print-document.d.ts +106 -0
- package/src/lib/printing/print-document.js +464 -0
- package/src/lib/printing/print-document.js.map +1 -0
- package/src/lib/printing/product-labels.d.ts +58 -0
- package/src/lib/printing/product-labels.js +116 -0
- package/src/lib/printing/product-labels.js.map +1 -0
- package/src/lib/printing/render-epson.d.ts +57 -0
- package/src/lib/printing/render-epson.js +135 -0
- package/src/lib/printing/render-epson.js.map +1 -0
- package/src/lib/printing/render-star.d.ts +45 -0
- package/src/lib/printing/render-star.js +100 -0
- package/src/lib/printing/render-star.js.map +1 -0
- package/src/lib/printing/render-text.d.ts +25 -0
- package/src/lib/printing/render-text.js +53 -0
- package/src/lib/printing/render-text.js.map +1 -0
- package/src/lib/server/api-v1/openapi.js +27 -4
- package/src/lib/server/api-v1/openapi.js.map +1 -1
- package/src/lib/server/api-v1/order-view.d.ts +67 -0
- package/src/lib/server/api-v1/order-view.js +120 -0
- package/src/lib/server/api-v1/order-view.js.map +1 -0
- package/src/lib/server/api-v1/orders-and-products.js +58 -65
- package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
- package/src/lib/server/billing-webhook.js +135 -28
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +29 -0
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/carrier-rates-availability.d.ts +26 -0
- package/src/lib/server/carrier-rates-availability.js +76 -0
- package/src/lib/server/carrier-rates-availability.js.map +1 -0
- package/src/lib/server/carrier-shipping.d.ts +84 -0
- package/src/lib/server/carrier-shipping.js +135 -0
- package/src/lib/server/carrier-shipping.js.map +1 -0
- package/src/lib/server/cart-checkout.d.ts +2 -0
- package/src/lib/server/cart-checkout.js +226 -22
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/channel-order-updates.d.ts +50 -0
- package/src/lib/server/channel-order-updates.js +290 -0
- package/src/lib/server/channel-order-updates.js.map +1 -0
- package/src/lib/server/channel-orders.d.ts +85 -0
- package/src/lib/server/channel-orders.js +543 -0
- package/src/lib/server/channel-orders.js.map +1 -0
- package/src/lib/server/checkout-extras.d.ts +64 -0
- package/src/lib/server/checkout-extras.js +157 -0
- package/src/lib/server/checkout-extras.js.map +1 -0
- package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
- package/src/lib/server/checkout-status.js +111 -0
- package/src/lib/server/checkout-status.js.map +1 -0
- package/src/lib/server/checkout.js +86 -9
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/draft-order.js +34 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.d.ts +127 -10
- package/src/lib/server/fulfill-order.js +451 -49
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/legacy-feed.d.ts +28 -0
- package/src/lib/server/legacy-feed.js +52 -0
- package/src/lib/server/legacy-feed.js.map +1 -0
- package/src/lib/server/native-checkout.d.ts +34 -15
- package/src/lib/server/native-checkout.js +32 -17
- package/src/lib/server/native-checkout.js.map +1 -1
- package/src/lib/server/order-event-host-emit.d.ts +23 -0
- package/src/lib/server/order-event-host-emit.js +30 -0
- package/src/lib/server/order-event-host-emit.js.map +1 -0
- package/src/lib/server/order-event-triggers.d.ts +37 -0
- package/src/lib/server/order-event-triggers.js +119 -0
- package/src/lib/server/order-event-triggers.js.map +1 -0
- package/src/lib/server/order-events.d.ts +62 -0
- package/src/lib/server/order-events.js +109 -0
- package/src/lib/server/order-events.js.map +1 -0
- package/src/lib/server/order-history.d.ts +23 -0
- package/src/lib/server/order-history.js +65 -0
- package/src/lib/server/order-history.js.map +1 -0
- package/src/lib/server/order-notifications.d.ts +185 -0
- package/src/lib/server/order-notifications.js +567 -0
- package/src/lib/server/order-notifications.js.map +1 -0
- package/src/lib/server/order-receipt-send.d.ts +39 -0
- package/src/lib/server/order-receipt-send.js +151 -0
- package/src/lib/server/order-receipt-send.js.map +1 -0
- package/src/lib/server/order-status-token.d.ts +31 -0
- package/src/lib/server/order-status-token.js +75 -0
- package/src/lib/server/order-status-token.js.map +1 -0
- package/src/lib/server/order-status.d.ts +58 -0
- package/src/lib/server/order-status.js +141 -0
- package/src/lib/server/order-status.js.map +1 -0
- package/src/lib/server/order-webhooks.d.ts +108 -0
- package/src/lib/server/order-webhooks.js +622 -0
- package/src/lib/server/order-webhooks.js.map +1 -0
- package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
- package/src/lib/server/orders-shipping-prepare.js +121 -0
- package/src/lib/server/orders-shipping-prepare.js.map +1 -0
- package/src/lib/server/payment-method-domains.d.ts +209 -0
- package/src/lib/server/payment-method-domains.js +444 -0
- package/src/lib/server/payment-method-domains.js.map +1 -0
- package/src/lib/server/payment-methods.d.ts +77 -0
- package/src/lib/server/payment-methods.js +284 -0
- package/src/lib/server/payment-methods.js.map +1 -0
- package/src/lib/server/pos-auth.d.ts +50 -0
- package/src/lib/server/pos-auth.js +121 -0
- package/src/lib/server/pos-auth.js.map +1 -0
- package/src/lib/server/pos-customer.d.ts +49 -0
- package/src/lib/server/pos-customer.js +257 -0
- package/src/lib/server/pos-customer.js.map +1 -0
- package/src/lib/server/pos-display.d.ts +57 -0
- package/src/lib/server/pos-display.js +419 -0
- package/src/lib/server/pos-display.js.map +1 -0
- package/src/lib/server/pos-fee-month.d.ts +34 -0
- package/src/lib/server/pos-fee-month.js +36 -0
- package/src/lib/server/pos-fee-month.js.map +1 -0
- package/src/lib/server/pos-ops-gate.d.ts +161 -0
- package/src/lib/server/pos-ops-gate.js +295 -0
- package/src/lib/server/pos-ops-gate.js.map +1 -0
- package/src/lib/server/pos-ops-routes.d.ts +22 -0
- package/src/lib/server/pos-ops-routes.js +36 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -0
- package/src/lib/server/pos-order.d.ts +1 -18
- package/src/lib/server/pos-order.js +222 -42
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.d.ts +39 -0
- package/src/lib/server/pos-payment.js +922 -0
- package/src/lib/server/pos-payment.js.map +1 -0
- package/src/lib/server/pos-print.d.ts +82 -0
- package/src/lib/server/pos-print.js +193 -0
- package/src/lib/server/pos-print.js.map +1 -0
- package/src/lib/server/pos-readers.d.ts +27 -0
- package/src/lib/server/pos-readers.js +276 -0
- package/src/lib/server/pos-readers.js.map +1 -0
- package/src/lib/server/pos-refund-authority.d.ts +60 -0
- package/src/lib/server/pos-refund-authority.js +72 -0
- package/src/lib/server/pos-refund-authority.js.map +1 -0
- package/src/lib/server/pos-return.d.ts +58 -0
- package/src/lib/server/pos-return.js +891 -0
- package/src/lib/server/pos-return.js.map +1 -0
- package/src/lib/server/pos-sale-stamp.d.ts +66 -0
- package/src/lib/server/pos-sale-stamp.js +84 -0
- package/src/lib/server/pos-sale-stamp.js.map +1 -0
- package/src/lib/server/pos-sale.d.ts +170 -0
- package/src/lib/server/pos-sale.js +461 -0
- package/src/lib/server/pos-sale.js.map +1 -0
- package/src/lib/server/pos-shift.d.ts +45 -0
- package/src/lib/server/pos-shift.js +484 -0
- package/src/lib/server/pos-shift.js.map +1 -0
- package/src/lib/server/pos-staff-pin.d.ts +26 -0
- package/src/lib/server/pos-staff-pin.js +339 -0
- package/src/lib/server/pos-staff-pin.js.map +1 -0
- package/src/lib/server/pos-stripe.d.ts +91 -0
- package/src/lib/server/pos-stripe.js +129 -0
- package/src/lib/server/pos-stripe.js.map +1 -0
- package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
- package/src/lib/server/pos-terminal-connection-token.js +166 -0
- package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
- package/src/lib/server/pos-terminal.d.ts +218 -0
- package/src/lib/server/pos-terminal.js +1014 -0
- package/src/lib/server/pos-terminal.js.map +1 -0
- package/src/lib/server/print-queue.d.ts +124 -0
- package/src/lib/server/print-queue.js +301 -0
- package/src/lib/server/print-queue.js.map +1 -0
- package/src/lib/server/printer-poll.d.ts +75 -0
- package/src/lib/server/printer-poll.js +325 -0
- package/src/lib/server/printer-poll.js.map +1 -0
- package/src/lib/server/printer-secret.d.ts +39 -0
- package/src/lib/server/printer-secret.js +56 -0
- package/src/lib/server/printer-secret.js.map +1 -0
- package/src/lib/server/printers.d.ts +114 -0
- package/src/lib/server/printers.js +546 -0
- package/src/lib/server/printers.js.map +1 -0
- package/src/lib/server/product-catalog.d.ts +42 -0
- package/src/lib/server/product-catalog.js +309 -0
- package/src/lib/server/product-catalog.js.map +1 -0
- package/src/lib/server/product-drafts.d.ts +5 -1
- package/src/lib/server/product-drafts.js +3 -3
- package/src/lib/server/product-drafts.js.map +1 -1
- package/src/lib/server/product-writer.d.ts +19 -0
- package/src/lib/server/product-writer.js +261 -0
- package/src/lib/server/product-writer.js.map +1 -0
- package/src/lib/server/products-write.d.ts +61 -0
- package/src/lib/server/products-write.js +375 -0
- package/src/lib/server/products-write.js.map +1 -0
- package/src/lib/server/refund.js +110 -45
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reserve.js +2 -0
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/return-status-action.d.ts +37 -0
- package/src/lib/server/return-status-action.js +57 -0
- package/src/lib/server/return-status-action.js.map +1 -0
- package/src/lib/server/returns.d.ts +119 -0
- package/src/lib/server/returns.js +938 -0
- package/src/lib/server/returns.js.map +1 -0
- package/src/lib/server/shipment-records.d.ts +36 -0
- package/src/lib/server/shipment-records.js +289 -0
- package/src/lib/server/shipment-records.js.map +1 -0
- package/src/lib/server/shipping-connector-gates.d.ts +40 -0
- package/src/lib/server/shipping-connector-gates.js +97 -0
- package/src/lib/server/shipping-connector-gates.js.map +1 -0
- package/src/lib/server/shipping-connectors.d.ts +29 -0
- package/src/lib/server/shipping-connectors.js +236 -0
- package/src/lib/server/shipping-connectors.js.map +1 -0
- package/src/lib/server/shippingeasy.d.ts +238 -0
- package/src/lib/server/shippingeasy.js +787 -0
- package/src/lib/server/shippingeasy.js.map +1 -0
- package/src/lib/server/shipstation.d.ts +129 -0
- package/src/lib/server/shipstation.js +483 -0
- package/src/lib/server/shipstation.js.map +1 -0
- package/src/lib/server/site-page-resolver.d.ts +5 -0
- package/src/lib/server/site-page-resolver.js +156 -1
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/stock-levels.d.ts +21 -0
- package/src/lib/server/stock-levels.js +263 -0
- package/src/lib/server/stock-levels.js.map +1 -0
- package/src/lib/server/stripe-refund.d.ts +47 -0
- package/src/lib/server/stripe-refund.js +87 -0
- package/src/lib/server/stripe-refund.js.map +1 -0
- package/src/lib/server/supplier-update.js +46 -5
- package/src/lib/server/supplier-update.js.map +1 -1
- package/src/lib/server/tax-engine-quote.d.ts +47 -0
- package/src/lib/server/tax-engine-quote.js +105 -0
- package/src/lib/server/tax-engine-quote.js.map +1 -0
- package/src/lib/server.js +143 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/site.js +12 -0
- package/src/lib/site.js.map +1 -1
- package/src/lib/subprocessors.d.ts +26 -0
- package/src/lib/subprocessors.js +50 -0
- package/src/lib/subprocessors.js.map +1 -0
- package/src/lib/tenant-emails.js +461 -3
- package/src/lib/tenant-emails.js.map +1 -1
- package/src/lib/testing/fake-firestore.d.ts +45 -0
- package/src/lib/testing/fake-firestore.js +189 -0
- package/src/lib/testing/fake-firestore.js.map +1 -0
- package/src/lib/testing/memory-firestore.d.ts +136 -0
- package/src/lib/testing/memory-firestore.js +282 -0
- package/src/lib/testing/memory-firestore.js.map +1 -0
- package/src/lib/testing/pos-ops-harness.d.ts +50 -0
- package/src/lib/testing/pos-ops-harness.js +184 -0
- package/src/lib/testing/pos-ops-harness.js.map +1 -0
- package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
- package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
- package/src/lib/transfer/products.server.d.ts +5 -0
- package/src/lib/transfer/products.server.js +2 -2
- package/src/lib/transfer/products.server.js.map +1 -1
- package/src/lib/transfer/records-transfer.d.ts +11 -1
- package/src/lib/transfer/records-transfer.js +127 -5
- package/src/lib/transfer/records-transfer.js.map +1 -1
- package/src/lib/transfer/records.server.d.ts +9 -2
- package/src/lib/transfer/records.server.js +58 -7
- package/src/lib/transfer/records.server.js.map +1 -1
- package/src/lib/transfer/register-transfer-resources.js +40 -1
- package/src/lib/transfer/register-transfer-resources.js.map +1 -1
- package/src/lib/transfer/register-transfer-ui.js +4 -1
- package/src/lib/transfer/register-transfer-ui.js.map +1 -1
- package/src/lib/transfer/shipping-presets.d.ts +23 -0
- package/src/lib/transfer/shipping-presets.js +156 -0
- package/src/lib/transfer/shipping-presets.js.map +1 -0
- package/src/lib/transfer/tracking-transfer.d.ts +101 -0
- package/src/lib/transfer/tracking-transfer.js +546 -0
- package/src/lib/transfer/tracking-transfer.js.map +1 -0
- package/src/lib/transfer/tracking.server.d.ts +37 -0
- package/src/lib/transfer/tracking.server.js +393 -0
- package/src/lib/transfer/tracking.server.js.map +1 -0
- package/src/lib/transfer/transfer-keys.d.ts +2 -1
- package/src/lib/transfer/transfer-keys.js +6 -2
- package/src/lib/transfer/transfer-keys.js.map +1 -1
- package/src/lib/utils/code128.d.ts +37 -0
- package/src/lib/utils/code128.js +199 -0
- package/src/lib/utils/code128.js.map +1 -0
- package/src/lib/utils/order-invoice.d.ts +55 -0
- package/src/lib/utils/order-invoice.js +127 -0
- package/src/lib/utils/order-invoice.js.map +1 -0
- package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
- package/src/lib/utils/use-checkout-return-notice.js +78 -0
- package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
- package/src/lib/server/feed.js +0 -69
- package/src/lib/server/feed.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/transfer/transfer-keys.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 * THE COMMERCE TRANSFER RESOURCES (AGL-3531), by the key each is declared\n * under in `plugins.config.json` (`transferResources`). Every one is a site's\n * records (`scope: host`); the console's lists open the import wizard and the\n * export dialog on these keys through the core launcher.\n *\n * | key | import | why |\n * | -- | -- | -- |\n * | products | yes | matched by handle, then SKU, then ID; a match is updated |\n * | categories | yes | matched by slug, then name, then ID |\n * | discounts | yes | matched by code, then name, then ID; new ones start switched off |\n * | coupons | yes | matched by code; new ones start switched off |\n * | orders | no | an order is the record of a sale, written by checkout alone |\n * | gift cards | yes, by issuing | each row issues a card through the issue path, confirmed by its total; owners and admins only |\n */\n\nexport const COMMERCE_PRODUCTS_TRANSFER = 'commerce.products'\nexport const COMMERCE_ORDERS_TRANSFER = 'commerce.orders'\nexport const COMMERCE_DISCOUNTS_TRANSFER = 'commerce.discounts'\nexport const COMMERCE_COUPONS_TRANSFER = 'commerce.coupons'\nexport const COMMERCE_GIFT_CARDS_TRANSFER = 'commerce.gift-cards'\nexport const COMMERCE_CATEGORIES_TRANSFER = 'commerce.categories'\n\n/** Every commerce resource key, in the order the hub lists them. */\nexport const COMMERCE_TRANSFER_RESOURCES = [\n COMMERCE_PRODUCTS_TRANSFER,\n COMMERCE_CATEGORIES_TRANSFER,\n COMMERCE_ORDERS_TRANSFER,\n COMMERCE_DISCOUNTS_TRANSFER,\n COMMERCE_COUPONS_TRANSFER,\n COMMERCE_GIFT_CARDS_TRANSFER,\n] as const\n\n/** The resources a file may write; the others are exported only. */\nexport const COMMERCE_IMPORTABLE_TRANSFERS: ReadonlySet<string> = new Set([\n COMMERCE_PRODUCTS_TRANSFER,\n COMMERCE_CATEGORIES_TRANSFER,\n COMMERCE_DISCOUNTS_TRANSFER,\n COMMERCE_COUPONS_TRANSFER,\n COMMERCE_GIFT_CARDS_TRANSFER,\n])\n\n/**\n * The gift card import's Confirm step (AGL-3551), and the key its answer\n * rides under in the wizard's `extras`: the total value typed back.\n */\nexport const GIFT_CARD_CONFIRM_STEP_ID = 'gift-card-total'\n"],"names":["COMMERCE_PRODUCTS_TRANSFER","COMMERCE_ORDERS_TRANSFER","COMMERCE_DISCOUNTS_TRANSFER","COMMERCE_COUPONS_TRANSFER","COMMERCE_GIFT_CARDS_TRANSFER","COMMERCE_CATEGORIES_TRANSFER","COMMERCE_TRANSFER_RESOURCES","COMMERCE_IMPORTABLE_TRANSFERS","Set","GIFT_CARD_CONFIRM_STEP_ID"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/transfer/transfer-keys.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 * THE COMMERCE TRANSFER RESOURCES (AGL-3531), by the key each is declared\n * under in `plugins.config.json` (`transferResources`). Every one is a site's\n * records (`scope: host`); the console's lists open the import wizard and the\n * export dialog on these keys through the core launcher.\n *\n * | key | import | why |\n * | -- | -- | -- |\n * | products | yes | matched by handle, then SKU, then ID; a match is updated |\n * | categories | yes | matched by slug, then name, then ID |\n * | discounts | yes | matched by code, then name, then ID; new ones start switched off |\n * | coupons | yes | matched by code; new ones start switched off |\n * | orders | no | an order is the record of a sale, written by checkout alone |\n * | gift cards | yes, by issuing | each row issues a card through the issue path, confirmed by its total; owners and admins only |\n * | tracking numbers | yes, by shipping | each row is a parcel: it ships what its order still owes, or replaces a shipped order's tracking when the person chooses (AGL-3613) |\n */\n\nexport const COMMERCE_PRODUCTS_TRANSFER = 'commerce.products'\nexport const COMMERCE_ORDERS_TRANSFER = 'commerce.orders'\nexport const COMMERCE_DISCOUNTS_TRANSFER = 'commerce.discounts'\nexport const COMMERCE_COUPONS_TRANSFER = 'commerce.coupons'\nexport const COMMERCE_GIFT_CARDS_TRANSFER = 'commerce.gift-cards'\nexport const COMMERCE_CATEGORIES_TRANSFER = 'commerce.categories'\nexport const COMMERCE_TRACKING_TRANSFER = 'commerce.tracking'\n\n/** Every commerce resource key, in the order the hub lists them. */\nexport const COMMERCE_TRANSFER_RESOURCES = [\n COMMERCE_PRODUCTS_TRANSFER,\n COMMERCE_CATEGORIES_TRANSFER,\n COMMERCE_ORDERS_TRANSFER,\n COMMERCE_DISCOUNTS_TRANSFER,\n COMMERCE_COUPONS_TRANSFER,\n COMMERCE_GIFT_CARDS_TRANSFER,\n COMMERCE_TRACKING_TRANSFER,\n] as const\n\n/** The resources a file may write; the others are exported only. */\nexport const COMMERCE_IMPORTABLE_TRANSFERS: ReadonlySet<string> = new Set([\n COMMERCE_PRODUCTS_TRANSFER,\n COMMERCE_CATEGORIES_TRANSFER,\n COMMERCE_DISCOUNTS_TRANSFER,\n COMMERCE_COUPONS_TRANSFER,\n COMMERCE_GIFT_CARDS_TRANSFER,\n COMMERCE_TRACKING_TRANSFER,\n])\n\n/**\n * The gift card import's Confirm step (AGL-3551), and the key its answer\n * rides under in the wizard's `extras`: the total value typed back.\n */\nexport const GIFT_CARD_CONFIRM_STEP_ID = 'gift-card-total'\n"],"names":["COMMERCE_PRODUCTS_TRANSFER","COMMERCE_ORDERS_TRANSFER","COMMERCE_DISCOUNTS_TRANSFER","COMMERCE_COUPONS_TRANSFER","COMMERCE_GIFT_CARDS_TRANSFER","COMMERCE_CATEGORIES_TRANSFER","COMMERCE_TRACKING_TRANSFER","COMMERCE_TRANSFER_RESOURCES","COMMERCE_IMPORTABLE_TRANSFERS","Set","GIFT_CARD_CONFIRM_STEP_ID"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;CAeC,GAED,OAAO,MAAMA,6BAA6B,oBAAmB;AAC7D,OAAO,MAAMC,2BAA2B,kBAAiB;AACzD,OAAO,MAAMC,8BAA8B,qBAAoB;AAC/D,OAAO,MAAMC,4BAA4B,mBAAkB;AAC3D,OAAO,MAAMC,+BAA+B,sBAAqB;AACjE,OAAO,MAAMC,+BAA+B,sBAAqB;AACjE,OAAO,MAAMC,6BAA6B,oBAAmB;AAE7D,kEAAkE,GAClE,OAAO,MAAMC,8BAA8B;IACzCP;IACAK;IACAJ;IACAC;IACAC;IACAC;IACAE;CACD,CAAS;AAEV,kEAAkE,GAClE,OAAO,MAAME,gCAAqD,IAAIC,IAAI;IACxET;IACAK;IACAH;IACAC;IACAC;IACAE;CACD,EAAC;AAEF;;;CAGC,GACD,OAAO,MAAMI,4BAA4B,kBAAiB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/** Bar/space widths of symbols 0–106, ISO/IEC 15417. */
|
|
18
|
+
export declare const CODE128_PATTERNS: readonly string[];
|
|
19
|
+
/**
|
|
20
|
+
* The symbol values for `text`: code set C for an even run of digits, B for
|
|
21
|
+
* anything else printable (ASCII 32–126). Throws on a character code 128
|
|
22
|
+
* cannot carry in set B rather than printing a barcode that scans as
|
|
23
|
+
* something else.
|
|
24
|
+
*/
|
|
25
|
+
export declare function code128Values(text: string): number[];
|
|
26
|
+
/** The barcode as module widths, bar first, quiet zones not included. */
|
|
27
|
+
export declare function code128Widths(text: string): number[];
|
|
28
|
+
/**
|
|
29
|
+
* An SVG of the barcode: black bars on white with a ten-module quiet zone
|
|
30
|
+
* each side, sized in modules so the printer's own resolution decides the
|
|
31
|
+
* physical width. `crispEdges` keeps a thermal head from smearing a bar.
|
|
32
|
+
*/
|
|
33
|
+
export declare function code128Svg(text: string, options?: {
|
|
34
|
+
height?: number;
|
|
35
|
+
moduleWidth?: number;
|
|
36
|
+
title?: string;
|
|
37
|
+
}): string;
|
|
@@ -0,0 +1,199 @@
|
|
|
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
|
+
* CODE 128, AS AN SVG (AGL-3609).
|
|
18
|
+
*
|
|
19
|
+
* The receipt prints the order number as a barcode so the register's return
|
|
20
|
+
* lookup can scan it back: a keyboard-wedge scanner types the digits and
|
|
21
|
+
* presses Enter, exactly as it does for a product. Code 128 because every
|
|
22
|
+
* scanner reads it and a short number stays short — an even run of digits
|
|
23
|
+
* packs two to a symbol in code set C.
|
|
24
|
+
*
|
|
25
|
+
* Each symbol is six alternating bar and space widths (bar first) adding up
|
|
26
|
+
* to eleven modules; the stop symbol has a seventh bar. The check symbol is
|
|
27
|
+
* the start value plus each data value times its position, modulo 103.
|
|
28
|
+
*=========================================*/ /** Bar/space widths of symbols 0–106, ISO/IEC 15417. */ export const CODE128_PATTERNS = [
|
|
29
|
+
'212222',
|
|
30
|
+
'222122',
|
|
31
|
+
'222221',
|
|
32
|
+
'121223',
|
|
33
|
+
'121322',
|
|
34
|
+
'131222',
|
|
35
|
+
'122213',
|
|
36
|
+
'122312',
|
|
37
|
+
'132212',
|
|
38
|
+
'221213',
|
|
39
|
+
'221312',
|
|
40
|
+
'231212',
|
|
41
|
+
'112232',
|
|
42
|
+
'122132',
|
|
43
|
+
'122231',
|
|
44
|
+
'113222',
|
|
45
|
+
'123122',
|
|
46
|
+
'123221',
|
|
47
|
+
'223211',
|
|
48
|
+
'221132',
|
|
49
|
+
'221231',
|
|
50
|
+
'213212',
|
|
51
|
+
'223112',
|
|
52
|
+
'312131',
|
|
53
|
+
'311222',
|
|
54
|
+
'321122',
|
|
55
|
+
'321221',
|
|
56
|
+
'312212',
|
|
57
|
+
'322112',
|
|
58
|
+
'322211',
|
|
59
|
+
'212123',
|
|
60
|
+
'212321',
|
|
61
|
+
'232121',
|
|
62
|
+
'111323',
|
|
63
|
+
'131123',
|
|
64
|
+
'131321',
|
|
65
|
+
'112313',
|
|
66
|
+
'132113',
|
|
67
|
+
'132311',
|
|
68
|
+
'211313',
|
|
69
|
+
'231113',
|
|
70
|
+
'231311',
|
|
71
|
+
'112133',
|
|
72
|
+
'112331',
|
|
73
|
+
'132131',
|
|
74
|
+
'113123',
|
|
75
|
+
'113321',
|
|
76
|
+
'133121',
|
|
77
|
+
'313121',
|
|
78
|
+
'211331',
|
|
79
|
+
'231131',
|
|
80
|
+
'213113',
|
|
81
|
+
'213311',
|
|
82
|
+
'213131',
|
|
83
|
+
'311123',
|
|
84
|
+
'311321',
|
|
85
|
+
'331121',
|
|
86
|
+
'312113',
|
|
87
|
+
'312311',
|
|
88
|
+
'332111',
|
|
89
|
+
'314111',
|
|
90
|
+
'221411',
|
|
91
|
+
'431111',
|
|
92
|
+
'111224',
|
|
93
|
+
'111422',
|
|
94
|
+
'121124',
|
|
95
|
+
'121421',
|
|
96
|
+
'141122',
|
|
97
|
+
'141221',
|
|
98
|
+
'112214',
|
|
99
|
+
'112412',
|
|
100
|
+
'122114',
|
|
101
|
+
'122411',
|
|
102
|
+
'142112',
|
|
103
|
+
'142211',
|
|
104
|
+
'241211',
|
|
105
|
+
'221114',
|
|
106
|
+
'413111',
|
|
107
|
+
'241112',
|
|
108
|
+
'134111',
|
|
109
|
+
'111242',
|
|
110
|
+
'121142',
|
|
111
|
+
'121241',
|
|
112
|
+
'114212',
|
|
113
|
+
'124112',
|
|
114
|
+
'124211',
|
|
115
|
+
'411212',
|
|
116
|
+
'421112',
|
|
117
|
+
'421211',
|
|
118
|
+
'212141',
|
|
119
|
+
'214121',
|
|
120
|
+
'412121',
|
|
121
|
+
'111143',
|
|
122
|
+
'111341',
|
|
123
|
+
'131141',
|
|
124
|
+
'114113',
|
|
125
|
+
'114311',
|
|
126
|
+
'411113',
|
|
127
|
+
'411311',
|
|
128
|
+
'113141',
|
|
129
|
+
'114131',
|
|
130
|
+
'311141',
|
|
131
|
+
'411131',
|
|
132
|
+
'211412',
|
|
133
|
+
'211214',
|
|
134
|
+
'211232',
|
|
135
|
+
'2331112'
|
|
136
|
+
];
|
|
137
|
+
const START_B = 104;
|
|
138
|
+
const START_C = 105;
|
|
139
|
+
const STOP = 106;
|
|
140
|
+
/**
|
|
141
|
+
* The symbol values for `text`: code set C for an even run of digits, B for
|
|
142
|
+
* anything else printable (ASCII 32–126). Throws on a character code 128
|
|
143
|
+
* cannot carry in set B rather than printing a barcode that scans as
|
|
144
|
+
* something else.
|
|
145
|
+
*/ export function code128Values(text) {
|
|
146
|
+
const value = String(text != null ? text : '');
|
|
147
|
+
if (!value) throw new Error('Nothing to encode');
|
|
148
|
+
const useC = /^\d+$/.test(value) && value.length % 2 === 0;
|
|
149
|
+
const data = [];
|
|
150
|
+
if (useC) {
|
|
151
|
+
for(let at = 0; at < value.length; at += 2)data.push(Number(value.slice(at, at + 2)));
|
|
152
|
+
} else {
|
|
153
|
+
for (const character of value){
|
|
154
|
+
const code = character.charCodeAt(0);
|
|
155
|
+
if (code < 32 || code > 126) throw new Error(`Cannot encode "${character}" in a barcode`);
|
|
156
|
+
data.push(code - 32);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const start = useC ? START_C : START_B;
|
|
160
|
+
const checksum = data.reduce((sum, symbol, index)=>sum + symbol * (index + 1), start) % 103;
|
|
161
|
+
return [
|
|
162
|
+
start,
|
|
163
|
+
...data,
|
|
164
|
+
checksum,
|
|
165
|
+
STOP
|
|
166
|
+
];
|
|
167
|
+
}
|
|
168
|
+
/** The barcode as module widths, bar first, quiet zones not included. */ export function code128Widths(text) {
|
|
169
|
+
return code128Values(text).flatMap((symbol)=>{
|
|
170
|
+
var _CODE128_PATTERNS_symbol;
|
|
171
|
+
return [
|
|
172
|
+
...(_CODE128_PATTERNS_symbol = CODE128_PATTERNS[symbol]) != null ? _CODE128_PATTERNS_symbol : ''
|
|
173
|
+
].map(Number);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* An SVG of the barcode: black bars on white with a ten-module quiet zone
|
|
178
|
+
* each side, sized in modules so the printer's own resolution decides the
|
|
179
|
+
* physical width. `crispEdges` keeps a thermal head from smearing a bar.
|
|
180
|
+
*/ export function code128Svg(text, options = {}) {
|
|
181
|
+
var _options_moduleWidth, _options_height, _options_title;
|
|
182
|
+
const moduleWidth = (_options_moduleWidth = options.moduleWidth) != null ? _options_moduleWidth : 2;
|
|
183
|
+
const height = (_options_height = options.height) != null ? _options_height : 60;
|
|
184
|
+
const quiet = 10;
|
|
185
|
+
const widths = code128Widths(text);
|
|
186
|
+
const totalModules = widths.reduce((sum, width)=>sum + width, 0) + quiet * 2;
|
|
187
|
+
let x = quiet;
|
|
188
|
+
const bars = [];
|
|
189
|
+
widths.forEach((width, index)=>{
|
|
190
|
+
if (index % 2 === 0) {
|
|
191
|
+
bars.push(`<rect x="${x * moduleWidth}" y="0" width="${width * moduleWidth}" height="${height}"/>`);
|
|
192
|
+
}
|
|
193
|
+
x += width;
|
|
194
|
+
});
|
|
195
|
+
const title = String((_options_title = options.title) != null ? _options_title : text).replace(/[<>&"]/g, '');
|
|
196
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${title}" ` + `viewBox="0 0 ${totalModules * moduleWidth} ${height}" ` + `width="${totalModules * moduleWidth}" height="${height}" shape-rendering="crispEdges">` + `<rect width="100%" height="100%" fill="#fff"/><g fill="#000">${bars.join('')}</g></svg>`;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
//# sourceMappingURL=code128.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/utils/code128.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 * CODE 128, AS AN SVG (AGL-3609).\n *\n * The receipt prints the order number as a barcode so the register's return\n * lookup can scan it back: a keyboard-wedge scanner types the digits and\n * presses Enter, exactly as it does for a product. Code 128 because every\n * scanner reads it and a short number stays short — an even run of digits\n * packs two to a symbol in code set C.\n *\n * Each symbol is six alternating bar and space widths (bar first) adding up\n * to eleven modules; the stop symbol has a seventh bar. The check symbol is\n * the start value plus each data value times its position, modulo 103.\n *=========================================*/\n\n/** Bar/space widths of symbols 0–106, ISO/IEC 15417. */\nexport const CODE128_PATTERNS: readonly string[] = [\n '212222', '222122', '222221', '121223', '121322', '131222', '122213', '122312',\n '132212', '221213', '221312', '231212', '112232', '122132', '122231', '113222',\n '123122', '123221', '223211', '221132', '221231', '213212', '223112', '312131',\n '311222', '321122', '321221', '312212', '322112', '322211', '212123', '212321',\n '232121', '111323', '131123', '131321', '112313', '132113', '132311', '211313',\n '231113', '231311', '112133', '112331', '132131', '113123', '113321', '133121',\n '313121', '211331', '231131', '213113', '213311', '213131', '311123', '311321',\n '331121', '312113', '312311', '332111', '314111', '221411', '431111', '111224',\n '111422', '121124', '121421', '141122', '141221', '112214', '112412', '122114',\n '122411', '142112', '142211', '241211', '221114', '413111', '241112', '134111',\n '111242', '121142', '121241', '114212', '124112', '124211', '411212', '421112',\n '421211', '212141', '214121', '412121', '111143', '111341', '131141', '114113',\n '114311', '411113', '411311', '113141', '114131', '311141', '411131', '211412',\n '211214', '211232', '2331112',\n]\n\nconst START_B = 104\nconst START_C = 105\nconst STOP = 106\n\n/**\n * The symbol values for `text`: code set C for an even run of digits, B for\n * anything else printable (ASCII 32–126). Throws on a character code 128\n * cannot carry in set B rather than printing a barcode that scans as\n * something else.\n */\nexport function code128Values(text: string): number[] {\n const value = String(text ?? '')\n if (!value) throw new Error('Nothing to encode')\n const useC = /^\\d+$/.test(value) && value.length % 2 === 0\n const data: number[] = []\n if (useC) {\n for (let at = 0; at < value.length; at += 2) data.push(Number(value.slice(at, at + 2)))\n } else {\n for (const character of value) {\n const code = character.charCodeAt(0)\n if (code < 32 || code > 126) throw new Error(`Cannot encode \"${character}\" in a barcode`)\n data.push(code - 32)\n }\n }\n const start = useC ? START_C : START_B\n const checksum = data.reduce((sum, symbol, index) => sum + symbol * (index + 1), start) % 103\n return [start, ...data, checksum, STOP]\n}\n\n/** The barcode as module widths, bar first, quiet zones not included. */\nexport function code128Widths(text: string): number[] {\n return code128Values(text).flatMap((symbol) =>\n [...(CODE128_PATTERNS[symbol] ?? '')].map(Number),\n )\n}\n\n/**\n * An SVG of the barcode: black bars on white with a ten-module quiet zone\n * each side, sized in modules so the printer's own resolution decides the\n * physical width. `crispEdges` keeps a thermal head from smearing a bar.\n */\nexport function code128Svg(\n text: string,\n options: { height?: number; moduleWidth?: number; title?: string } = {},\n): string {\n const moduleWidth = options.moduleWidth ?? 2\n const height = options.height ?? 60\n const quiet = 10\n const widths = code128Widths(text)\n const totalModules = widths.reduce((sum, width) => sum + width, 0) + quiet * 2\n let x = quiet\n const bars: string[] = []\n widths.forEach((width, index) => {\n if (index % 2 === 0) {\n bars.push(\n `<rect x=\"${x * moduleWidth}\" y=\"0\" width=\"${width * moduleWidth}\" height=\"${height}\"/>`,\n )\n }\n x += width\n })\n const title = String(options.title ?? text).replace(/[<>&\"]/g, '')\n return (\n `<svg xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"${title}\" ` +\n `viewBox=\"0 0 ${totalModules * moduleWidth} ${height}\" ` +\n `width=\"${totalModules * moduleWidth}\" height=\"${height}\" shape-rendering=\"crispEdges\">` +\n `<rect width=\"100%\" height=\"100%\" fill=\"#fff\"/><g fill=\"#000\">${bars.join('')}</g></svg>`\n )\n}\n"],"names":["CODE128_PATTERNS","START_B","START_C","STOP","code128Values","text","value","String","Error","useC","test","length","data","at","push","Number","slice","character","code","charCodeAt","start","checksum","reduce","sum","symbol","index","code128Widths","flatMap","map","code128Svg","options","moduleWidth","height","quiet","widths","totalModules","width","x","bars","forEach","title","replace","join"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;2CAY2C,GAE3C,sDAAsD,GACtD,OAAO,MAAMA,mBAAsC;IACjD;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IAAU;IACtE;IAAU;IAAU;IAAU;IAAU;IAAU;I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DA,sBACLA,iBAcMA;IAfrB,MAAMC,eAAcD,uBAAAA,QAAQC,WAAW,YAAnBD,uBAAuB;IAC3C,MAAME,UAASF,kBAAAA,QAAQE,MAAM,YAAdF,kBAAkB;IACjC,MAAMG,QAAQ;IACd,MAAMC,SAASR,cAAcrB;IAC7B,MAAM8B,eAAeD,OAAOZ,MAAM,CAAC,CAACC,KAAKa,QAAUb,MAAMa,OAAO,KAAKH,QAAQ;IAC7E,IAAII,IAAIJ;IACR,MAAMK,OAAiB,EAAE;IACzBJ,OAAOK,OAAO,CAAC,CAACH,OAAOX;QACrB,IAAIA,QAAQ,MAAM,GAAG;YACnBa,KAAKxB,IAAI,CACP,CAAC,SAAS,EAAEuB,IAAIN,YAAY,eAAe,EAAEK,QAAQL,YAAY,UAAU,EAAEC,OAAO,GAAG,CAAC;QAE5F;QACAK,KAAKD;IACP;IACA,MAAMI,QAAQjC,QAAOuB,iBAAAA,QAAQU,KAAK,YAAbV,iBAAiBzB,MAAMoC,OAAO,CAAC,WAAW;IAC/D,OACE,CAAC,+DAA+D,EAAED,MAAM,EAAE,CAAC,GAC3E,CAAC,aAAa,EAAEL,eAAeJ,YAAY,CAAC,EAAEC,OAAO,EAAE,CAAC,GACxD,CAAC,OAAO,EAAEG,eAAeJ,YAAY,UAAU,EAAEC,OAAO,+BAA+B,CAAC,GACxF,CAAC,6DAA6D,EAAEM,KAAKI,IAAI,CAAC,IAAI,UAAU,CAAC;AAE7F"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 '../model/commerce-orders';
|
|
18
|
+
/**
|
|
19
|
+
* The printable invoice (AGL-3611), beside the packing slip: the order as a
|
|
20
|
+
* bill — who sold it, to whom, each line with its unit price, the totals,
|
|
21
|
+
* what was refunded and what was paid in the end.
|
|
22
|
+
*
|
|
23
|
+
* A string of markup, because it is written into a print popup the way the
|
|
24
|
+
* packing slip is, and the browser's print dialog saves it as a PDF. Every
|
|
25
|
+
* value is escaped: the addresses are typed by the shopper, and the popup
|
|
26
|
+
* inherits the console's origin (AGL-2283). No `<style>` and no `style`
|
|
27
|
+
* attributes, because the popup inherits the console's content security
|
|
28
|
+
* policy; the layout is the table attributes HTML still honors.
|
|
29
|
+
*/
|
|
30
|
+
export interface OrderInvoiceStore {
|
|
31
|
+
/** The business's name, as its emails sign. */
|
|
32
|
+
name: string;
|
|
33
|
+
/** The store's currency, for an order that does not carry its own. */
|
|
34
|
+
currency: string;
|
|
35
|
+
/** The receipt footer the store set, printed at the foot. */
|
|
36
|
+
footer?: string | null;
|
|
37
|
+
/** The store's terms address, printed at the foot. */
|
|
38
|
+
termsUrl?: string | null;
|
|
39
|
+
}
|
|
40
|
+
type InvoiceOrder = Pick<HostOrder, 'number' | 'status' | 'lineItems' | 'totals' | 'refundedCents' | 'customerName' | 'customerEmail' | 'shippingAddress' | 'billingAddress'> & {
|
|
41
|
+
createdAtMs?: number;
|
|
42
|
+
currency?: string;
|
|
43
|
+
amountCents?: number;
|
|
44
|
+
};
|
|
45
|
+
/** Money in the order's currency, integer cents in. */
|
|
46
|
+
export declare function invoiceMoney(cents: number, currency: string): string;
|
|
47
|
+
/** What the payment line says. */
|
|
48
|
+
export declare function invoicePaymentStatus(order: Pick<InvoiceOrder, 'status' | 'refundedCents' | 'totals' | 'amountCents'>): string;
|
|
49
|
+
/** The invoice's markup: a full document body, every value escaped. */
|
|
50
|
+
export declare function buildOrderInvoiceHtml(input: {
|
|
51
|
+
order: InvoiceOrder;
|
|
52
|
+
orderId: string;
|
|
53
|
+
store: OrderInvoiceStore;
|
|
54
|
+
}): string;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { formatOrderNumber, orderCreatedAtMs } from "../model/commerce-orders.js";
|
|
17
|
+
import { escapeHtml } from "./escape-html.js";
|
|
18
|
+
/** Money in the order's currency, integer cents in. */ export function invoiceMoney(cents, currency) {
|
|
19
|
+
const amount = (Number(cents) || 0) / 100;
|
|
20
|
+
try {
|
|
21
|
+
return new Intl.NumberFormat('en-US', {
|
|
22
|
+
style: 'currency',
|
|
23
|
+
currency: currency || 'USD'
|
|
24
|
+
}).format(amount);
|
|
25
|
+
} catch (unused) {
|
|
26
|
+
return `${amount.toFixed(2)} ${String(currency || '').toUpperCase()}`.trim();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function addressLines(address) {
|
|
30
|
+
if (!address) return [];
|
|
31
|
+
return [
|
|
32
|
+
address.name,
|
|
33
|
+
address.line1,
|
|
34
|
+
address.line2,
|
|
35
|
+
[
|
|
36
|
+
address.city,
|
|
37
|
+
address.state,
|
|
38
|
+
address.postalCode
|
|
39
|
+
].filter(Boolean).join(' '),
|
|
40
|
+
address.country,
|
|
41
|
+
address.phone
|
|
42
|
+
].map((part)=>String(part != null ? part : '').trim()).filter(Boolean);
|
|
43
|
+
}
|
|
44
|
+
/** What the payment line says. */ export function invoicePaymentStatus(order) {
|
|
45
|
+
var _ref, _ref1, _order_refundedCents, _order_status;
|
|
46
|
+
var _order_totals;
|
|
47
|
+
const total = Number((_ref = (_ref1 = (_order_totals = order.totals) == null ? void 0 : _order_totals.totalCents) != null ? _ref1 : order.amountCents) != null ? _ref : 0);
|
|
48
|
+
const refunded = Math.max(0, Number((_order_refundedCents = order.refundedCents) != null ? _order_refundedCents : 0));
|
|
49
|
+
const status = String((_order_status = order.status) != null ? _order_status : '');
|
|
50
|
+
if (status === 'pending' || status === 'draft') return 'Awaiting payment';
|
|
51
|
+
if (status === 'cancelled') return 'Canceled';
|
|
52
|
+
if (refunded > 0 && refunded >= total) return 'Refunded';
|
|
53
|
+
if (refunded > 0) return 'Paid, partially refunded';
|
|
54
|
+
return 'Paid';
|
|
55
|
+
}
|
|
56
|
+
/** The invoice's markup: a full document body, every value escaped. */ export function buildOrderInvoiceHtml(input) {
|
|
57
|
+
var _ref, _order_lineItems, _ref1, _ref2, _order_refundedCents, _order_customerName, _order_customerEmail, _order_lineItems1, _ref3, _ref4, _ref5, _ref6;
|
|
58
|
+
const { order, orderId, store } = input;
|
|
59
|
+
const currency = String(order.currency || store.currency || 'USD').toUpperCase();
|
|
60
|
+
const money = (cents)=>escapeHtml(invoiceMoney(cents, currency));
|
|
61
|
+
const number = formatOrderNumber(order, orderId);
|
|
62
|
+
const createdAt = orderCreatedAtMs(order);
|
|
63
|
+
const totals = order.totals;
|
|
64
|
+
const itemsCents = (_ref = totals == null ? void 0 : totals.itemsCents) != null ? _ref : ((_order_lineItems = order.lineItems) != null ? _order_lineItems : []).reduce((sum, line)=>sum + Number(line.unitAmountCents || 0) * Number(line.quantity || 0), 0);
|
|
65
|
+
const totalCents = Number((_ref1 = (_ref2 = totals == null ? void 0 : totals.totalCents) != null ? _ref2 : order.amountCents) != null ? _ref1 : itemsCents);
|
|
66
|
+
const refundedCents = Math.max(0, Number((_order_refundedCents = order.refundedCents) != null ? _order_refundedCents : 0));
|
|
67
|
+
const billTo = [
|
|
68
|
+
...order.billingAddress ? addressLines(order.billingAddress) : [
|
|
69
|
+
(_order_customerName = order.customerName) != null ? _order_customerName : ''
|
|
70
|
+
].filter(Boolean),
|
|
71
|
+
(_order_customerEmail = order.customerEmail) != null ? _order_customerEmail : ''
|
|
72
|
+
].filter(Boolean);
|
|
73
|
+
const shipTo = addressLines(order.shippingAddress);
|
|
74
|
+
const rows = ((_order_lineItems1 = order.lineItems) != null ? _order_lineItems1 : []).map((line)=>{
|
|
75
|
+
const quantity = Number(line.quantity) || 0;
|
|
76
|
+
const unit = Number(line.unitAmountCents) || 0;
|
|
77
|
+
const detail = [
|
|
78
|
+
line.variantLabel ? escapeHtml(line.variantLabel) : '',
|
|
79
|
+
line.sku ? `SKU ${escapeHtml(line.sku)}` : ''
|
|
80
|
+
].filter(Boolean).join(' · ');
|
|
81
|
+
return `<tr><td>${escapeHtml(line.name)}${detail ? `<br/><small>${detail}</small>` : ''}</td>` + `<td align="right">${escapeHtml(quantity)}</td>` + `<td align="right">${money(unit)}</td>` + `<td align="right">${money(unit * quantity)}</td></tr>`;
|
|
82
|
+
}).join('');
|
|
83
|
+
const summary = [
|
|
84
|
+
[
|
|
85
|
+
'Subtotal',
|
|
86
|
+
money(itemsCents)
|
|
87
|
+
]
|
|
88
|
+
];
|
|
89
|
+
if (Number((_ref3 = totals == null ? void 0 : totals.discountCents) != null ? _ref3 : 0) > 0) summary.push([
|
|
90
|
+
'Discount',
|
|
91
|
+
`−${money(Number(totals == null ? void 0 : totals.discountCents))}`
|
|
92
|
+
]);
|
|
93
|
+
if (Number((_ref4 = totals == null ? void 0 : totals.shippingCents) != null ? _ref4 : 0) > 0) summary.push([
|
|
94
|
+
'Shipping',
|
|
95
|
+
money(Number(totals == null ? void 0 : totals.shippingCents))
|
|
96
|
+
]);
|
|
97
|
+
if (Number((_ref5 = totals == null ? void 0 : totals.taxCents) != null ? _ref5 : 0) > 0) summary.push([
|
|
98
|
+
'Tax',
|
|
99
|
+
money(Number(totals == null ? void 0 : totals.taxCents))
|
|
100
|
+
]);
|
|
101
|
+
summary.push([
|
|
102
|
+
'<b>Total</b>',
|
|
103
|
+
`<b>${money(totalCents)}</b>`
|
|
104
|
+
]);
|
|
105
|
+
if (Number((_ref6 = totals == null ? void 0 : totals.tipCents) != null ? _ref6 : 0) > 0) summary.push([
|
|
106
|
+
'Tip',
|
|
107
|
+
money(Number(totals == null ? void 0 : totals.tipCents))
|
|
108
|
+
]);
|
|
109
|
+
if (refundedCents > 0) {
|
|
110
|
+
summary.push([
|
|
111
|
+
'Refunded',
|
|
112
|
+
`−${money(refundedCents)}`
|
|
113
|
+
]);
|
|
114
|
+
summary.push([
|
|
115
|
+
'<b>Net paid</b>',
|
|
116
|
+
`<b>${money(Math.max(0, totalCents - refundedCents))}</b>`
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
const block = (title, lines)=>lines.length ? `<td valign="top"><b>${title}</b><br/>${lines.map((line)=>escapeHtml(line)).join('<br/>')}</td>` : '';
|
|
120
|
+
return `<title>${escapeHtml(`Invoice ${number}`)}</title>` + `<h2>${escapeHtml(store.name || 'Invoice')}</h2>` + `<h3>${escapeHtml(`Invoice ${number}`)}</h3>` + `<p>${createdAt ? `Date: ${escapeHtml(new Date(createdAt).toLocaleDateString('en-US', {
|
|
121
|
+
year: 'numeric',
|
|
122
|
+
month: 'long',
|
|
123
|
+
day: 'numeric'
|
|
124
|
+
}))}<br/>` : ''}` + `Payment: ${escapeHtml(invoicePaymentStatus(order))}<br/>Currency: ${escapeHtml(currency)}</p>` + `<table width="100%" cellpadding="6"><tr>${block('Bill to', billTo)}${block('Ship to', shipTo)}</tr></table>` + `<table width="100%" cellpadding="6" border="1" cellspacing="0">` + `<tr><th align="left">Item</th><th align="right">Qty</th><th align="right">Unit price</th><th align="right">Amount</th></tr>` + rows + `</table>` + `<table width="100%" cellpadding="4">${summary.map(([label, value])=>`<tr><td align="right" width="80%">${label}</td><td align="right">${value}</td></tr>`).join('')}</table>` + (store.footer ? `<p>${escapeHtml(store.footer)}</p>` : '') + (store.termsUrl ? `<p><small>Terms: ${escapeHtml(store.termsUrl)}</small></p>` : '');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=order-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/utils/order-invoice.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n formatOrderNumber,\n orderCreatedAtMs,\n type HostOrder,\n type OrderAddress,\n} from '../model/commerce-orders'\nimport { escapeHtml } from './escape-html'\n\n/**\n * The printable invoice (AGL-3611), beside the packing slip: the order as a\n * bill — who sold it, to whom, each line with its unit price, the totals,\n * what was refunded and what was paid in the end.\n *\n * A string of markup, because it is written into a print popup the way the\n * packing slip is, and the browser's print dialog saves it as a PDF. Every\n * value is escaped: the addresses are typed by the shopper, and the popup\n * inherits the console's origin (AGL-2283). No `<style>` and no `style`\n * attributes, because the popup inherits the console's content security\n * policy; the layout is the table attributes HTML still honors.\n */\n\nexport interface OrderInvoiceStore {\n /** The business's name, as its emails sign. */\n name: string\n /** The store's currency, for an order that does not carry its own. */\n currency: string\n /** The receipt footer the store set, printed at the foot. */\n footer?: string | null\n /** The store's terms address, printed at the foot. */\n termsUrl?: string | null\n}\n\ntype InvoiceOrder = Pick<\n HostOrder,\n | 'number'\n | 'status'\n | 'lineItems'\n | 'totals'\n | 'refundedCents'\n | 'customerName'\n | 'customerEmail'\n | 'shippingAddress'\n | 'billingAddress'\n> & { createdAtMs?: number; currency?: string; amountCents?: number }\n\n/** Money in the order's currency, integer cents in. */\nexport function invoiceMoney(cents: number, currency: string): string {\n const amount = (Number(cents) || 0) / 100\n try {\n return new Intl.NumberFormat('en-US', { style: 'currency', currency: currency || 'USD' }).format(amount)\n } catch {\n return `${amount.toFixed(2)} ${String(currency || '').toUpperCase()}`.trim()\n }\n}\n\nfunction addressLines(address: OrderAddress | undefined | null): string[] {\n if (!address) return []\n return [\n address.name,\n address.line1,\n address.line2,\n [address.city, address.state, address.postalCode].filter(Boolean).join(' '),\n address.country,\n address.phone,\n ]\n .map((part) => String(part ?? '').trim())\n .filter(Boolean)\n}\n\n/** What the payment line says. */\nexport function invoicePaymentStatus(order: Pick<InvoiceOrder, 'status' | 'refundedCents' | 'totals' | 'amountCents'>): string {\n const total = Number(order.totals?.totalCents ?? order.amountCents ?? 0)\n const refunded = Math.max(0, Number(order.refundedCents ?? 0))\n const status = String(order.status ?? '')\n if (status === 'pending' || status === 'draft') return 'Awaiting payment'\n if (status === 'cancelled') return 'Canceled'\n if (refunded > 0 && refunded >= total) return 'Refunded'\n if (refunded > 0) return 'Paid, partially refunded'\n return 'Paid'\n}\n\n/** The invoice's markup: a full document body, every value escaped. */\nexport function buildOrderInvoiceHtml(input: {\n order: InvoiceOrder\n orderId: string\n store: OrderInvoiceStore\n}): string {\n const { order, orderId, store } = input\n const currency = String(order.currency || store.currency || 'USD').toUpperCase()\n const money = (cents: number) => escapeHtml(invoiceMoney(cents, currency))\n const number = formatOrderNumber(order, orderId)\n const createdAt = orderCreatedAtMs(order as never)\n const totals = order.totals\n const itemsCents =\n totals?.itemsCents ??\n (order.lineItems ?? []).reduce((sum, line) => sum + Number(line.unitAmountCents || 0) * Number(line.quantity || 0), 0)\n const totalCents = Number(totals?.totalCents ?? order.amountCents ?? itemsCents)\n const refundedCents = Math.max(0, Number(order.refundedCents ?? 0))\n\n const billTo = [\n ...(order.billingAddress ? addressLines(order.billingAddress) : [order.customerName ?? ''].filter(Boolean)),\n order.customerEmail ?? '',\n ].filter(Boolean)\n const shipTo = addressLines(order.shippingAddress)\n\n const rows = (order.lineItems ?? [])\n .map((line) => {\n const quantity = Number(line.quantity) || 0\n const unit = Number(line.unitAmountCents) || 0\n const detail = [line.variantLabel ? escapeHtml(line.variantLabel) : '', line.sku ? `SKU ${escapeHtml(line.sku)}` : '']\n .filter(Boolean)\n .join(' · ')\n return (\n `<tr><td>${escapeHtml(line.name)}${detail ? `<br/><small>${detail}</small>` : ''}</td>` +\n `<td align=\"right\">${escapeHtml(quantity)}</td>` +\n `<td align=\"right\">${money(unit)}</td>` +\n `<td align=\"right\">${money(unit * quantity)}</td></tr>`\n )\n })\n .join('')\n\n const summary: Array<[string, string]> = [['Subtotal', money(itemsCents)]]\n if (Number(totals?.discountCents ?? 0) > 0) summary.push(['Discount', `−${money(Number(totals?.discountCents))}`])\n if (Number(totals?.shippingCents ?? 0) > 0) summary.push(['Shipping', money(Number(totals?.shippingCents))])\n if (Number(totals?.taxCents ?? 0) > 0) summary.push(['Tax', money(Number(totals?.taxCents))])\n summary.push(['<b>Total</b>', `<b>${money(totalCents)}</b>`])\n if (Number(totals?.tipCents ?? 0) > 0) summary.push(['Tip', money(Number(totals?.tipCents))])\n if (refundedCents > 0) {\n summary.push(['Refunded', `−${money(refundedCents)}`])\n summary.push(['<b>Net paid</b>', `<b>${money(Math.max(0, totalCents - refundedCents))}</b>`])\n }\n\n const block = (title: string, lines: string[]) =>\n lines.length ? `<td valign=\"top\"><b>${title}</b><br/>${lines.map((line) => escapeHtml(line)).join('<br/>')}</td>` : ''\n\n return (\n `<title>${escapeHtml(`Invoice ${number}`)}</title>` +\n `<h2>${escapeHtml(store.name || 'Invoice')}</h2>` +\n `<h3>${escapeHtml(`Invoice ${number}`)}</h3>` +\n `<p>${createdAt ? `Date: ${escapeHtml(new Date(createdAt).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }))}<br/>` : ''}` +\n `Payment: ${escapeHtml(invoicePaymentStatus(order))}<br/>Currency: ${escapeHtml(currency)}</p>` +\n `<table width=\"100%\" cellpadding=\"6\"><tr>${block('Bill to', billTo)}${block('Ship to', shipTo)}</tr></table>` +\n `<table width=\"100%\" cellpadding=\"6\" border=\"1\" cellspacing=\"0\">` +\n `<tr><th align=\"left\">Item</th><th align=\"right\">Qty</th><th align=\"right\">Unit price</th><th align=\"right\">Amount</th></tr>` +\n rows +\n `</table>` +\n `<table width=\"100%\" cellpadding=\"4\">${summary\n .map(([label, value]) => `<tr><td align=\"right\" width=\"80%\">${label}</td><td align=\"right\">${value}</td></tr>`)\n .join('')}</table>` +\n (store.footer ? `<p>${escapeHtml(store.footer)}</p>` : '') +\n (store.termsUrl ? `<p><small>Terms: ${escapeHtml(store.termsUrl)}</small></p>` : '')\n )\n}\n"],"names":["formatOrderNumber","orderCreatedAtMs","escapeHtml","invoiceMoney","cents","currency","amount","Number","Intl","NumberFormat","style","format","toFixed","String","toUpperCase","trim","addressLines","address","name","line1","line2","city","state","postalCode","filter","Boolean","join","country","phone","map","part","invoicePaymentStatus","order","total","totals","totalCents","amountCents","refunded","Math","max","refundedCents","status","buildOrderInvoiceHtml","input","orderId","store","money","number","createdAt","itemsCents","lineItems","reduce","sum","line","unitAmountCents","quantity","billTo","billingAddress","customerName","customerEmail","shipTo","shippingAddress","rows","unit","detail","variantLabel","sku","summary","discountCents","push","shippingCents","taxCents","tipCents","block","title","lines","length","Date","toLocaleDateString","year","month","day","label","value","footer","termsUrl"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iBAAiB,EACjBC,g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AM,WAAWjB,UAAUiB,MAAM,WAAWb,QAAQ,aAAa,CAAC,GAC7G,CAAC,+DAA+D,CAAC,GACjE,CAAC,2HAA2H,CAAC,GAC7HE,OACA,CAAC,QAAQ,CAAC,GACV,CAAC,oCAAoC,EAAEK,QACpCtC,GAAG,CAAC,CAAC,CAACqD,OAAOC,MAAM,GAAK,CAAC,kCAAkC,EAAED,MAAM,uBAAuB,EAAEC,MAAM,UAAU,CAAC,EAC7GzD,IAAI,CAAC,IAAI,QAAQ,CAAC,GACpBmB,CAAAA,MAAMuC,MAAM,GAAG,CAAC,GAAG,EAAElF,WAAW2C,MAAMuC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAC,IACvDvC,CAAAA,MAAMwC,QAAQ,GAAG,CAAC,iBAAiB,EAAEnF,WAAW2C,MAAMwC,QAAQ,EAAE,YAAY,CAAC,GAAG,EAAC;AAEtF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The shopper-facing half of `server/checkout-status.ts` (AGL-3606): on the
|
|
19
|
+
* page Stripe returned them to, say plainly when the payment did NOT go
|
|
20
|
+
* through — a redirect-based method whose bank step failed comes back to the
|
|
21
|
+
* same `?order=success&session_id=…` a paid order does.
|
|
22
|
+
*
|
|
23
|
+
* Silent for a paid session, and on every ordinary page view (no
|
|
24
|
+
* `session_id`). Both the cart and the product page mount this, so the first
|
|
25
|
+
* mount claims the session and any sibling stays quiet — one notice, not two.
|
|
26
|
+
*/
|
|
27
|
+
export interface CheckoutReturnNotice {
|
|
28
|
+
severity: 'warning' | 'info';
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
/** Test seam: the claim set outlives a test otherwise. */
|
|
32
|
+
export declare function __resetCheckoutReturnNotice(): void;
|
|
33
|
+
export declare function checkoutReturnNoticeFor(status: string, paymentStatus: string): CheckoutReturnNotice | null;
|
|
34
|
+
export declare function useCheckoutReturnNotice(hostId: string, siteFetch?: typeof fetch): [CheckoutReturnNotice | null, () => void];
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { useEffect, useState } from "react";
|
|
18
|
+
const claimed = new Set();
|
|
19
|
+
/** Test seam: the claim set outlives a test otherwise. */ export function __resetCheckoutReturnNotice() {
|
|
20
|
+
claimed.clear();
|
|
21
|
+
}
|
|
22
|
+
export function checkoutReturnNoticeFor(status, paymentStatus) {
|
|
23
|
+
if (status === 'open') {
|
|
24
|
+
return {
|
|
25
|
+
severity: 'warning',
|
|
26
|
+
message: 'Your payment was not completed and nothing was charged. Your items are still here, so you can check out again.'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (status === 'expired') {
|
|
30
|
+
return {
|
|
31
|
+
severity: 'warning',
|
|
32
|
+
message: 'That checkout expired before it was paid, and nothing was charged. You can check out again.'
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (status === 'complete' && paymentStatus === 'unpaid') {
|
|
36
|
+
return {
|
|
37
|
+
severity: 'info',
|
|
38
|
+
message: 'Your order was placed. Your payment is still processing.'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
export function useCheckoutReturnNotice(hostId, siteFetch = fetch) {
|
|
44
|
+
const [notice, setNotice] = useState(null);
|
|
45
|
+
useEffect(()=>{
|
|
46
|
+
var _params_get;
|
|
47
|
+
if (typeof window === 'undefined' || !hostId) return;
|
|
48
|
+
const params = new URLSearchParams(window.location.search);
|
|
49
|
+
if (params.get('order') !== 'success') return;
|
|
50
|
+
const sessionId = (_params_get = params.get('session_id')) != null ? _params_get : '';
|
|
51
|
+
if (!sessionId || claimed.has(sessionId)) return;
|
|
52
|
+
// Claimed for the document, not the effect run: under StrictMode the
|
|
53
|
+
// effect runs twice and the second run must not start a second lookup —
|
|
54
|
+
// nor may the first one's answer be thrown away, which is why there is no
|
|
55
|
+
// `active` guard (a state update after unmount is a no-op).
|
|
56
|
+
claimed.add(sessionId);
|
|
57
|
+
void (async ()=>{
|
|
58
|
+
try {
|
|
59
|
+
var _ref, _ref1;
|
|
60
|
+
const response = await siteFetch(`/api/commerce/checkout-status?hostId=${encodeURIComponent(hostId)}&sessionId=${encodeURIComponent(sessionId)}`);
|
|
61
|
+
if (!response.ok) return;
|
|
62
|
+
const body = await response.json();
|
|
63
|
+
setNotice(checkoutReturnNoticeFor(String((_ref = body == null ? void 0 : body.status) != null ? _ref : ''), String((_ref1 = body == null ? void 0 : body.paymentStatus) != null ? _ref1 : '')));
|
|
64
|
+
} catch (unused) {
|
|
65
|
+
// Saying nothing is the pre-existing behavior, and the safe one.
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
}, [
|
|
69
|
+
hostId,
|
|
70
|
+
siteFetch
|
|
71
|
+
]);
|
|
72
|
+
return [
|
|
73
|
+
notice,
|
|
74
|
+
()=>setNotice(null)
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=use-checkout-return-notice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/utils/use-checkout-return-notice.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'use client'\n\nimport { useEffect, useState } from 'react'\n\n/**\n * The shopper-facing half of `server/checkout-status.ts` (AGL-3606): on the\n * page Stripe returned them to, say plainly when the payment did NOT go\n * through — a redirect-based method whose bank step failed comes back to the\n * same `?order=success&session_id=…` a paid order does.\n *\n * Silent for a paid session, and on every ordinary page view (no\n * `session_id`). Both the cart and the product page mount this, so the first\n * mount claims the session and any sibling stays quiet — one notice, not two.\n */\n\nexport interface CheckoutReturnNotice {\n severity: 'warning' | 'info'\n message: string\n}\n\nconst claimed = new Set<string>()\n\n/** Test seam: the claim set outlives a test otherwise. */\nexport function __resetCheckoutReturnNotice(): void {\n claimed.clear()\n}\n\nexport function checkoutReturnNoticeFor(\n status: string,\n paymentStatus: string,\n): CheckoutReturnNotice | null {\n if (status === 'open') {\n return {\n severity: 'warning',\n message:\n 'Your payment was not completed and nothing was charged. Your items are still here, so you can check out again.',\n }\n }\n if (status === 'expired') {\n return {\n severity: 'warning',\n message:\n 'That checkout expired before it was paid, and nothing was charged. You can check out again.',\n }\n }\n if (status === 'complete' && paymentStatus === 'unpaid') {\n return {\n severity: 'info',\n message: 'Your order was placed. Your payment is still processing.',\n }\n }\n return null\n}\n\nexport function useCheckoutReturnNotice(\n hostId: string,\n siteFetch: typeof fetch = fetch,\n): [CheckoutReturnNotice | null, () => void] {\n const [notice, setNotice] = useState<CheckoutReturnNotice | null>(null)\n useEffect(() => {\n if (typeof window === 'undefined' || !hostId) return\n const params = new URLSearchParams(window.location.search)\n if (params.get('order') !== 'success') return\n const sessionId = params.get('session_id') ?? ''\n if (!sessionId || claimed.has(sessionId)) return\n // Claimed for the document, not the effect run: under StrictMode the\n // effect runs twice and the second run must not start a second lookup —\n // nor may the first one's answer be thrown away, which is why there is no\n // `active` guard (a state update after unmount is a no-op).\n claimed.add(sessionId)\n void (async () => {\n try {\n const response = await siteFetch(\n `/api/commerce/checkout-status?hostId=${encodeURIComponent(\n hostId,\n )}&sessionId=${encodeURIComponent(sessionId)}`,\n )\n if (!response.ok) return\n const body = (await response.json()) as {\n status?: string\n paymentStatus?: string\n }\n setNotice(\n checkoutReturnNoticeFor(\n String(body?.status ?? ''),\n String(body?.paymentStatus ?? ''),\n ),\n )\n } catch {\n // Saying nothing is the pre-existing behavior, and the safe one.\n }\n })()\n }, [hostId, siteFetch])\n return [notice, () => setNotice(null)]\n}\n"],"names":["useEffect","useState","claimed","Set","__resetCheckoutReturnNotice","clear","checkoutReturnNoticeFor","status","paymentStatus","severity","message","useCheckoutReturnNotice","hostId","siteFetch","fetch","notice","setNotice","params","window","URLSearchParams","location","search","get","sessionId","has","add","response","encodeURIComponent","ok","body","json","String"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAkB3C,MAAMC,UAAU,IAAIC;AAEpB,wDAAw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