@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,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { orderIsTestMode } from "./commerce-orders.js";
|
|
18
|
+
import { shippingLines, shippingOrderNumber, gramsToOunces } from "./order-shipping-export.js";
|
|
19
|
+
import { shipStationCanImport, weightsOfProducts } from "./shipstation.js";
|
|
20
|
+
/*
|
|
21
|
+
* SHIPPINGEASY'S ORDER API, AS PURE DATA (AGL-3633).
|
|
22
|
+
*
|
|
23
|
+
* ShippingEasy is the opposite direction of ShipStation's Custom Store: it
|
|
24
|
+
* does not pull. The store PUSHES each order into the merchant's own
|
|
25
|
+
* ShippingEasy account with the merchant's API key and secret, and
|
|
26
|
+
* ShippingEasy POSTs a shipment notification to the store's callback URL when
|
|
27
|
+
* a label is bought (ShippingEasy API reference v1.1 and the official Ruby
|
|
28
|
+
* client, read 2026-10-07):
|
|
29
|
+
*
|
|
30
|
+
* - `POST /api/stores/{store_api_key}/orders` with `{ order: { … } }` creates
|
|
31
|
+
* an order; `POST /api/stores/{store_api_key}/orders/{external_order_identifier}/cancellations`
|
|
32
|
+
* cancels one; `GET /api/stores/{store_api_key}/orders/{external_order_identifier}` finds one.
|
|
33
|
+
* - Every request carries `api_key`, `api_timestamp` (Unix seconds) and
|
|
34
|
+
* `api_signature` in its query string: the hex HMAC-SHA256, under the API
|
|
35
|
+
* secret, of `METHOD&path&query&body` — the query being every other
|
|
36
|
+
* parameter sorted by name and form-encoded, the body left off when empty.
|
|
37
|
+
* - The shipment callback is signed the same way, over the callback's own
|
|
38
|
+
* path, query and raw body.
|
|
39
|
+
*
|
|
40
|
+
* This module builds the order, the canonical query and the callback reading.
|
|
41
|
+
* The HMAC, the HTTP and the route live in `server/shippingeasy.ts`.
|
|
42
|
+
*/ /** Where ShippingEasy's API answers. A deployment may point elsewhere with `SHIPPINGEASY_API_BASE_URL`. */ export const SHIPPINGEASY_DEFAULT_BASE_URL = 'https://app.shippingeasy.com';
|
|
43
|
+
/** How far a signed callback's `api_timestamp` may be from now: the Ruby client's own hour. */ export const SHIPPINGEASY_TIMESTAMP_TOLERANCE_MS = 60 * 60 * 1000;
|
|
44
|
+
/** The status an order arrives in ShippingEasy with. */ export const SHIPPINGEASY_AWAITING_SHIPMENT = 'awaiting_shipment';
|
|
45
|
+
/**
|
|
46
|
+
* A value form-encoded as Ruby's `URI.encode_www_form_component` writes it,
|
|
47
|
+
* which is what ShippingEasy's signature was computed over: letters, digits
|
|
48
|
+
* and `*-._` as they are, a space as `+`, every other byte as `%XX` upper-case.
|
|
49
|
+
*/ export function shippingEasyFormComponent(value) {
|
|
50
|
+
return encodeURIComponent(value).replace(/[!'()~]/g, (char)=>`%${char.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%20/g, '+');
|
|
51
|
+
}
|
|
52
|
+
/** The parameters sorted by name and joined `a=1&b=2`, as the signature reads them. `api_signature` is never part of it. */ export function shippingEasyCanonicalQuery(params) {
|
|
53
|
+
return Object.keys(params).filter((name)=>name !== 'api_signature').sort().map((name)=>`${shippingEasyFormComponent(name)}=${shippingEasyFormComponent(params[name])}`).join('&');
|
|
54
|
+
}
|
|
55
|
+
/** The plaintext a request's signature is the HMAC of: `METHOD&path&query&body`, the body left off when empty. */ export function shippingEasySignaturePlaintext(input) {
|
|
56
|
+
const parts = [
|
|
57
|
+
input.method.toUpperCase(),
|
|
58
|
+
input.path,
|
|
59
|
+
shippingEasyCanonicalQuery(input.params)
|
|
60
|
+
];
|
|
61
|
+
if (input.body) parts.push(input.body);
|
|
62
|
+
return parts.join('&');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether an order goes to ShippingEasy, comes back out of it, or neither.
|
|
66
|
+
*
|
|
67
|
+
* - A paid or partly shipped order with something to ship and a full
|
|
68
|
+
* ship-to address is CREATED. A test-mode order never is: ShippingEasy is
|
|
69
|
+
* the merchant's real label account, and a label bought for a test order
|
|
70
|
+
* is real postage.
|
|
71
|
+
* - A canceled or fully refunded order is CANCELED there, which the caller
|
|
72
|
+
* does only when it once sent the order.
|
|
73
|
+
* - Anything else (pending, shipped, delivered) asks nothing.
|
|
74
|
+
*/ export function shippingEasyIntent(order, docId) {
|
|
75
|
+
var _order_status, _order_lineItems, _order_fulfillments;
|
|
76
|
+
if (order.requiresShipping === false) return null;
|
|
77
|
+
const status = (_order_status = order.status) != null ? _order_status : 'pending';
|
|
78
|
+
if (status === 'cancelled' || status === 'refunded') return 'cancel';
|
|
79
|
+
if (status !== 'paid' && status !== 'partially_fulfilled') return null;
|
|
80
|
+
if (orderIsTestMode(_extends({}, order, {
|
|
81
|
+
$id: docId
|
|
82
|
+
}))) return null;
|
|
83
|
+
if (!shipStationCanImport(order)) return null;
|
|
84
|
+
return shippingLines({
|
|
85
|
+
lineItems: (_order_lineItems = order.lineItems) != null ? _order_lineItems : [],
|
|
86
|
+
fulfillments: (_order_fulfillments = order.fulfillments) != null ? _order_fulfillments : []
|
|
87
|
+
}).length ? 'create' : null;
|
|
88
|
+
}
|
|
89
|
+
/*==========================================
|
|
90
|
+
* THE ORDER
|
|
91
|
+
*=========================================*/ /** Cents as ShippingEasy's decimal dollars, `"12.50"`. */ function money(cents) {
|
|
92
|
+
const value = Math.round(Number(cents != null ? cents : 0));
|
|
93
|
+
return (Number.isFinite(value) ? value / 100 : 0).toFixed(2);
|
|
94
|
+
}
|
|
95
|
+
/** Text trimmed and bounded, or `undefined` when there is none. */ function bounded(value, max) {
|
|
96
|
+
const text = value === null || value === undefined ? '' : String(value).trim();
|
|
97
|
+
return text ? text.slice(0, max) : undefined;
|
|
98
|
+
}
|
|
99
|
+
/** A full name as ShippingEasy's first and last name: the last word is the last name. */ export function splitPersonName(name) {
|
|
100
|
+
const words = String(name != null ? name : '').trim().split(/\s+/).filter(Boolean);
|
|
101
|
+
if (!words.length) return {};
|
|
102
|
+
if (words.length === 1) return {
|
|
103
|
+
first_name: words[0].slice(0, 100)
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
first_name: words.slice(0, -1).join(' ').slice(0, 100),
|
|
107
|
+
last_name: words[words.length - 1].slice(0, 100)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The order identifier ShippingEasy keeps: the order number the merchant sees, else the document id. */ export function shippingEasyExternalId(order, docId) {
|
|
111
|
+
return shippingOrderNumber(order, docId);
|
|
112
|
+
}
|
|
113
|
+
function facts(products, productId, variantId) {
|
|
114
|
+
var _products_productId, _variants_;
|
|
115
|
+
const variants = (_products_productId = products[productId]) != null ? _products_productId : {};
|
|
116
|
+
return _extends({}, (_variants_ = variants['']) != null ? _variants_ : {}, variantId && variants[variantId] || {});
|
|
117
|
+
}
|
|
118
|
+
/** Drops the keys whose value is `undefined`, so the JSON names only what is known. */ function compact(value) {
|
|
119
|
+
return Object.fromEntries(Object.entries(value).filter(([, entry])=>entry !== undefined));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The `{ order }` body that creates an order in ShippingEasy. The items are
|
|
123
|
+
* what is LEFT to ship, so a partly shipped order sent after its first parcel
|
|
124
|
+
* asks for the rest; each carries its line's index as `ext_line_item_id`,
|
|
125
|
+
* which the shipment callback hands back to name the line.
|
|
126
|
+
*/ export function shippingEasyOrderPayload(source, products = {}) {
|
|
127
|
+
var _order_createdAtMs, _order_shippingAddress, _order_billingAddress, _order_lineItems, _order_fulfillments, _ship_country, _ref, _bill_country;
|
|
128
|
+
const { docId, order } = source;
|
|
129
|
+
const created = Number((_order_createdAtMs = order.createdAtMs) != null ? _order_createdAtMs : 0) || Date.now();
|
|
130
|
+
const ship = (_order_shippingAddress = order.shippingAddress) != null ? _order_shippingAddress : {};
|
|
131
|
+
const bill = (_order_billingAddress = order.billingAddress) != null ? _order_billingAddress : {};
|
|
132
|
+
const totals = order.totals;
|
|
133
|
+
const email = bounded(order.customerEmail, 100);
|
|
134
|
+
const weights = weightsOfProducts(products);
|
|
135
|
+
const lineItems = shippingLines({
|
|
136
|
+
lineItems: (_order_lineItems = order.lineItems) != null ? _order_lineItems : [],
|
|
137
|
+
fulfillments: (_order_fulfillments = order.fulfillments) != null ? _order_fulfillments : []
|
|
138
|
+
}, weights).map(({ lineItemId, line, quantity, unitGrams })=>{
|
|
139
|
+
var _known_options, _bounded, _line_unitAmountCents;
|
|
140
|
+
const known = facts(products, line.productId, line.variantId);
|
|
141
|
+
const options = Object.entries((_known_options = known.options) != null ? _known_options : {}).filter(([name, value])=>String(name).trim() && String(value).trim()).slice(0, 10);
|
|
142
|
+
return compact({
|
|
143
|
+
item_name: (_bounded = bounded(`${line.name}${line.variantLabel ? ` (${line.variantLabel})` : ''}`, 200)) != null ? _bounded : 'Item',
|
|
144
|
+
sku: bounded(line.sku || (line.variantId ? `${line.productId}-${line.variantId}` : line.productId), 100),
|
|
145
|
+
ext_line_item_id: String(lineItemId),
|
|
146
|
+
ext_product_id: bounded(line.productId, 100),
|
|
147
|
+
unit_price: money(line.unitAmountCents),
|
|
148
|
+
total_excluding_tax: money(Math.round(Number((_line_unitAmountCents = line.unitAmountCents) != null ? _line_unitAmountCents : 0)) * quantity),
|
|
149
|
+
weight_in_ounces: unitGrams !== null ? gramsToOunces(unitGrams).toFixed(2) : undefined,
|
|
150
|
+
quantity: String(quantity),
|
|
151
|
+
product_options: options.length ? Object.fromEntries(options) : undefined
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
const recipient = compact(_extends({}, splitPersonName(ship.name || order.customerName), {
|
|
155
|
+
email,
|
|
156
|
+
phone_number: bounded(ship.phone || order.customerPhone, 50),
|
|
157
|
+
address: bounded(ship.line1, 200),
|
|
158
|
+
address2: bounded(ship.line2, 200),
|
|
159
|
+
city: bounded(ship.city, 100),
|
|
160
|
+
state: bounded(ship.state, 100),
|
|
161
|
+
postal_code: bounded(ship.postalCode, 50),
|
|
162
|
+
country: bounded(String((_ship_country = ship.country) != null ? _ship_country : '').toUpperCase(), 2),
|
|
163
|
+
base_cost: money(totals == null ? void 0 : totals.shippingCents),
|
|
164
|
+
cost_excluding_tax: money(totals == null ? void 0 : totals.shippingCents),
|
|
165
|
+
items_total: String(lineItems.reduce((sum, item)=>sum + Number(item['quantity']), 0)),
|
|
166
|
+
items_shipped: '0',
|
|
167
|
+
line_items: lineItems
|
|
168
|
+
}));
|
|
169
|
+
const billName = splitPersonName(bill.name || order.customerName);
|
|
170
|
+
return {
|
|
171
|
+
order: compact({
|
|
172
|
+
external_order_identifier: shippingEasyExternalId(order, docId),
|
|
173
|
+
ordered_at: new Date(created).toISOString(),
|
|
174
|
+
order_status: SHIPPINGEASY_AWAITING_SHIPMENT,
|
|
175
|
+
total_including_tax: money((_ref = totals == null ? void 0 : totals.totalCents) != null ? _ref : order.amountCents),
|
|
176
|
+
total_tax: money(totals == null ? void 0 : totals.taxCents),
|
|
177
|
+
subtotal_including_tax: money(totals == null ? void 0 : totals.itemsCents),
|
|
178
|
+
discount_amount: money(totals == null ? void 0 : totals.discountCents),
|
|
179
|
+
base_shipping_cost: money(totals == null ? void 0 : totals.shippingCents),
|
|
180
|
+
shipping_cost_excluding_tax: money(totals == null ? void 0 : totals.shippingCents),
|
|
181
|
+
notes: bounded(order.note, 1000),
|
|
182
|
+
billing_first_name: billName.first_name,
|
|
183
|
+
billing_last_name: billName.last_name,
|
|
184
|
+
billing_address: bounded(bill.line1, 200),
|
|
185
|
+
billing_address2: bounded(bill.line2, 200),
|
|
186
|
+
billing_city: bounded(bill.city, 100),
|
|
187
|
+
billing_state: bounded(bill.state, 100),
|
|
188
|
+
billing_postal_code: bounded(bill.postalCode, 50),
|
|
189
|
+
billing_country: bounded(String((_bill_country = bill.country) != null ? _bill_country : '').toUpperCase(), 2),
|
|
190
|
+
billing_phone_number: bounded(bill.phone || order.customerPhone, 50),
|
|
191
|
+
billing_email: email,
|
|
192
|
+
recipients: [
|
|
193
|
+
recipient
|
|
194
|
+
]
|
|
195
|
+
})
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/*==========================================
|
|
199
|
+
* THE SHIPMENT CALLBACK
|
|
200
|
+
*=========================================*/ /**
|
|
201
|
+
* The label states that mean a parcel is on its way. `label_pending` is not
|
|
202
|
+
* bought yet and `cancelled` was voided, so neither ships anything.
|
|
203
|
+
*/ export const SHIPPINGEASY_SHIPPED_STATES = new Set([
|
|
204
|
+
'label_ready',
|
|
205
|
+
'label_printed',
|
|
206
|
+
'drop_shipped'
|
|
207
|
+
]);
|
|
208
|
+
const asObject = (value)=>value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
209
|
+
const asArray = (value)=>Array.isArray(value) ? value : [];
|
|
210
|
+
const asText = (value)=>value === null || value === undefined ? '' : String(value).trim();
|
|
211
|
+
/**
|
|
212
|
+
* A shipment callback's JSON read into notices, or the reason it cannot be.
|
|
213
|
+
* Each order of the shipment is one notice under the shipment's tracking
|
|
214
|
+
* number; its items are the recipients' line items, named back by the
|
|
215
|
+
* `ext_line_item_id` the order was sent with, else by SKU.
|
|
216
|
+
*/ export function readShippingEasyCallback(body) {
|
|
217
|
+
let parsed;
|
|
218
|
+
try {
|
|
219
|
+
parsed = JSON.parse(body);
|
|
220
|
+
} catch (unused) {
|
|
221
|
+
return {
|
|
222
|
+
problem: 'The callback is not JSON.'
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
const shipment = asObject(asObject(parsed)['shipment']);
|
|
226
|
+
if (!Object.keys(shipment).length) return {
|
|
227
|
+
problem: 'The callback names no shipment.'
|
|
228
|
+
};
|
|
229
|
+
const carrier = asText(shipment['carrier_key']);
|
|
230
|
+
const service = asText(shipment['carrier_service_key']);
|
|
231
|
+
const trackingNumber = asText(shipment['tracking_number']).slice(0, 100);
|
|
232
|
+
const notices = [];
|
|
233
|
+
for (const entry of asArray(shipment['orders'])){
|
|
234
|
+
const order = asObject(entry);
|
|
235
|
+
const external = asText(order['external_order_identifier']).slice(0, 200);
|
|
236
|
+
if (!external) continue;
|
|
237
|
+
const items = [];
|
|
238
|
+
for (const recipient of asArray(order['recipients'])){
|
|
239
|
+
for (const raw of asArray(asObject(recipient)['line_items'])){
|
|
240
|
+
const line = asObject(raw);
|
|
241
|
+
const quantity = Math.floor(Number(line['quantity']));
|
|
242
|
+
if (!Number.isFinite(quantity) || quantity <= 0) continue;
|
|
243
|
+
items.push({
|
|
244
|
+
lineItemId: asText(line['ext_line_item_id']) || null,
|
|
245
|
+
sku: asText(line['sku']) || null,
|
|
246
|
+
name: asText(line['item_name']) || null,
|
|
247
|
+
quantity
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
notices.push({
|
|
252
|
+
orderNumber: external,
|
|
253
|
+
orderId: null,
|
|
254
|
+
carrier,
|
|
255
|
+
service,
|
|
256
|
+
trackingNumber,
|
|
257
|
+
items
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
shipmentId: asText(shipment['id']) || null,
|
|
262
|
+
workflowState: asText(shipment['workflow_state']).toLowerCase(),
|
|
263
|
+
notices
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
//# sourceMappingURL=shippingeasy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/shippingeasy.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { HostOrder, OrderStatus } from './commerce-orders'\nimport { orderIsTestMode } from './commerce-orders'\nimport { shippingLines, shippingOrderNumber, gramsToOunces } from './order-shipping-export'\nimport {\n shipStationCanImport,\n weightsOfProducts,\n type ShipNotice,\n type ShipNoticeItem,\n type ShipStationOrderSource,\n type ShipStationProductFacts,\n type ShipStationProducts,\n} from './shipstation'\n\n/*\n * SHIPPINGEASY'S ORDER API, AS PURE DATA (AGL-3633).\n *\n * ShippingEasy is the opposite direction of ShipStation's Custom Store: it\n * does not pull. The store PUSHES each order into the merchant's own\n * ShippingEasy account with the merchant's API key and secret, and\n * ShippingEasy POSTs a shipment notification to the store's callback URL when\n * a label is bought (ShippingEasy API reference v1.1 and the official Ruby\n * client, read 2026-10-07):\n *\n * - `POST /api/stores/{store_api_key}/orders` with `{ order: { … } }` creates\n * an order; `POST /api/stores/{store_api_key}/orders/{external_order_identifier}/cancellations`\n * cancels one; `GET /api/stores/{store_api_key}/orders/{external_order_identifier}` finds one.\n * - Every request carries `api_key`, `api_timestamp` (Unix seconds) and\n * `api_signature` in its query string: the hex HMAC-SHA256, under the API\n * secret, of `METHOD&path&query&body` — the query being every other\n * parameter sorted by name and form-encoded, the body left off when empty.\n * - The shipment callback is signed the same way, over the callback's own\n * path, query and raw body.\n *\n * This module builds the order, the canonical query and the callback reading.\n * The HMAC, the HTTP and the route live in `server/shippingeasy.ts`.\n */\n\n/** Where ShippingEasy's API answers. A deployment may point elsewhere with `SHIPPINGEASY_API_BASE_URL`. */\nexport const SHIPPINGEASY_DEFAULT_BASE_URL = 'https://app.shippingeasy.com'\n\n/** How far a signed callback's `api_timestamp` may be from now: the Ruby client's own hour. */\nexport const SHIPPINGEASY_TIMESTAMP_TOLERANCE_MS = 60 * 60 * 1000\n\n/** The status an order arrives in ShippingEasy with. */\nexport const SHIPPINGEASY_AWAITING_SHIPMENT = 'awaiting_shipment'\n\n/**\n * A value form-encoded as Ruby's `URI.encode_www_form_component` writes it,\n * which is what ShippingEasy's signature was computed over: letters, digits\n * and `*-._` as they are, a space as `+`, every other byte as `%XX` upper-case.\n */\nexport function shippingEasyFormComponent(value: string): string {\n return encodeURIComponent(value)\n .replace(/[!'()~]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`)\n .replace(/%20/g, '+')\n}\n\n/** The parameters sorted by name and joined `a=1&b=2`, as the signature reads them. `api_signature` is never part of it. */\nexport function shippingEasyCanonicalQuery(params: Readonly<Record<string, string>>): string {\n return Object.keys(params)\n .filter((name) => name !== 'api_signature')\n .sort()\n .map((name) => `${shippingEasyFormComponent(name)}=${shippingEasyFormComponent(params[name])}`)\n .join('&')\n}\n\n/** The plaintext a request's signature is the HMAC of: `METHOD&path&query&body`, the body left off when empty. */\nexport function shippingEasySignaturePlaintext(input: {\n method: string\n path: string\n params: Readonly<Record<string, string>>\n body?: string | null\n}): string {\n const parts = [input.method.toUpperCase(), input.path, shippingEasyCanonicalQuery(input.params)]\n if (input.body) parts.push(input.body)\n return parts.join('&')\n}\n\n/*==========================================\n * WHAT TO DO WITH AN ORDER\n *=========================================*/\n\n/** What a changed order asks of ShippingEasy. */\nexport type ShippingEasyIntent = 'create' | 'cancel' | null\n\n/**\n * Whether an order goes to ShippingEasy, comes back out of it, or neither.\n *\n * - A paid or partly shipped order with something to ship and a full\n * ship-to address is CREATED. A test-mode order never is: ShippingEasy is\n * the merchant's real label account, and a label bought for a test order\n * is real postage.\n * - A canceled or fully refunded order is CANCELED there, which the caller\n * does only when it once sent the order.\n * - Anything else (pending, shipped, delivered) asks nothing.\n */\nexport function shippingEasyIntent(\n order: Partial<HostOrder> & { livemode?: unknown; requiresShipping?: unknown },\n docId: string,\n): ShippingEasyIntent {\n if (order.requiresShipping === false) return null\n const status = (order.status ?? 'pending') as OrderStatus\n if (status === 'cancelled' || status === 'refunded') return 'cancel'\n if (status !== 'paid' && status !== 'partially_fulfilled') return null\n if (orderIsTestMode({ ...order, $id: docId })) return null\n if (!shipStationCanImport(order)) return null\n return shippingLines({ lineItems: order.lineItems ?? [], fulfillments: order.fulfillments ?? [] }).length ? 'create' : null\n}\n\n/*==========================================\n * THE ORDER\n *=========================================*/\n\n/** Cents as ShippingEasy's decimal dollars, `\"12.50\"`. */\nfunction money(cents: unknown): string {\n const value = Math.round(Number(cents ?? 0))\n return (Number.isFinite(value) ? value / 100 : 0).toFixed(2)\n}\n\n/** Text trimmed and bounded, or `undefined` when there is none. */\nfunction bounded(value: unknown, max: number): string | undefined {\n const text = value === null || value === undefined ? '' : String(value).trim()\n return text ? text.slice(0, max) : undefined\n}\n\n/** A full name as ShippingEasy's first and last name: the last word is the last name. */\nexport function splitPersonName(name: unknown): { first_name?: string; last_name?: string } {\n const words = String(name ?? '').trim().split(/\\s+/).filter(Boolean)\n if (!words.length) return {}\n if (words.length === 1) return { first_name: words[0].slice(0, 100) }\n return { first_name: words.slice(0, -1).join(' ').slice(0, 100), last_name: words[words.length - 1].slice(0, 100) }\n}\n\n/** The order identifier ShippingEasy keeps: the order number the merchant sees, else the document id. */\nexport function shippingEasyExternalId(order: Pick<HostOrder, 'number'>, docId: string): string {\n return shippingOrderNumber(order, docId)\n}\n\nfunction facts(products: ShipStationProducts, productId: string, variantId?: string): ShipStationProductFacts {\n const variants = products[productId] ?? {}\n return { ...(variants[''] ?? {}), ...((variantId && variants[variantId]) || {}) }\n}\n\n/** Drops the keys whose value is `undefined`, so the JSON names only what is known. */\nfunction compact<T extends Record<string, unknown>>(value: T): T {\n return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined)) as T\n}\n\n/**\n * The `{ order }` body that creates an order in ShippingEasy. The items are\n * what is LEFT to ship, so a partly shipped order sent after its first parcel\n * asks for the rest; each carries its line's index as `ext_line_item_id`,\n * which the shipment callback hands back to name the line.\n */\nexport function shippingEasyOrderPayload(\n source: ShipStationOrderSource,\n products: ShipStationProducts = {},\n): { order: Record<string, unknown> } {\n const { docId, order } = source\n const created = Number(order.createdAtMs ?? 0) || Date.now()\n const ship = order.shippingAddress ?? {}\n const bill = order.billingAddress ?? {}\n const totals = order.totals\n const email = bounded(order.customerEmail, 100)\n const weights = weightsOfProducts(products)\n const lineItems = shippingLines({ lineItems: order.lineItems ?? [], fulfillments: order.fulfillments ?? [] }, weights).map(\n ({ lineItemId, line, quantity, unitGrams }) => {\n const known = facts(products, line.productId, line.variantId)\n const options = Object.entries(known.options ?? {})\n .filter(([name, value]) => String(name).trim() && String(value).trim())\n .slice(0, 10)\n return compact({\n item_name: bounded(`${line.name}${line.variantLabel ? ` (${line.variantLabel})` : ''}`, 200) ?? 'Item',\n sku: bounded(line.sku || (line.variantId ? `${line.productId}-${line.variantId}` : line.productId), 100),\n ext_line_item_id: String(lineItemId),\n ext_product_id: bounded(line.productId, 100),\n unit_price: money(line.unitAmountCents),\n total_excluding_tax: money(Math.round(Number(line.unitAmountCents ?? 0)) * quantity),\n weight_in_ounces: unitGrams !== null ? gramsToOunces(unitGrams).toFixed(2) : undefined,\n quantity: String(quantity),\n product_options: options.length ? Object.fromEntries(options) : undefined,\n })\n },\n )\n const recipient = compact({\n ...splitPersonName(ship.name || order.customerName),\n email,\n phone_number: bounded(ship.phone || order.customerPhone, 50),\n address: bounded(ship.line1, 200),\n address2: bounded(ship.line2, 200),\n city: bounded(ship.city, 100),\n state: bounded(ship.state, 100),\n postal_code: bounded(ship.postalCode, 50),\n country: bounded(String(ship.country ?? '').toUpperCase(), 2),\n base_cost: money(totals?.shippingCents),\n cost_excluding_tax: money(totals?.shippingCents),\n items_total: String(lineItems.reduce((sum, item) => sum + Number(item['quantity']), 0)),\n items_shipped: '0',\n line_items: lineItems,\n })\n const billName = splitPersonName(bill.name || order.customerName)\n return {\n order: compact({\n external_order_identifier: shippingEasyExternalId(order, docId),\n ordered_at: new Date(created).toISOString(),\n order_status: SHIPPINGEASY_AWAITING_SHIPMENT,\n total_including_tax: money(totals?.totalCents ?? order.amountCents),\n total_tax: money(totals?.taxCents),\n subtotal_including_tax: money(totals?.itemsCents),\n discount_amount: money(totals?.discountCents),\n base_shipping_cost: money(totals?.shippingCents),\n shipping_cost_excluding_tax: money(totals?.shippingCents),\n notes: bounded(order.note, 1000),\n billing_first_name: billName.first_name,\n billing_last_name: billName.last_name,\n billing_address: bounded(bill.line1, 200),\n billing_address2: bounded(bill.line2, 200),\n billing_city: bounded(bill.city, 100),\n billing_state: bounded(bill.state, 100),\n billing_postal_code: bounded(bill.postalCode, 50),\n billing_country: bounded(String(bill.country ?? '').toUpperCase(), 2),\n billing_phone_number: bounded(bill.phone || order.customerPhone, 50),\n billing_email: email,\n recipients: [recipient],\n }),\n }\n}\n\n/*==========================================\n * THE SHIPMENT CALLBACK\n *=========================================*/\n\n/**\n * The label states that mean a parcel is on its way. `label_pending` is not\n * bought yet and `cancelled` was voided, so neither ships anything.\n */\nexport const SHIPPINGEASY_SHIPPED_STATES: ReadonlySet<string> = new Set(['label_ready', 'label_printed', 'drop_shipped'])\n\n/** What one callback says. */\nexport interface ShippingEasyCallback {\n /** ShippingEasy's own shipment id, for the log. */\n shipmentId: string | null\n workflowState: string\n /** One notice per order the shipment carries, in the shape every connector records. */\n notices: ShipNotice[]\n}\n\ntype Json = Record<string, unknown>\nconst asObject = (value: unknown): Json => (value && typeof value === 'object' && !Array.isArray(value) ? (value as Json) : {})\nconst asArray = (value: unknown): unknown[] => (Array.isArray(value) ? value : [])\nconst asText = (value: unknown): string => (value === null || value === undefined ? '' : String(value).trim())\n\n/**\n * A shipment callback's JSON read into notices, or the reason it cannot be.\n * Each order of the shipment is one notice under the shipment's tracking\n * number; its items are the recipients' line items, named back by the\n * `ext_line_item_id` the order was sent with, else by SKU.\n */\nexport function readShippingEasyCallback(body: string): ShippingEasyCallback | { problem: string } {\n let parsed: unknown\n try {\n parsed = JSON.parse(body)\n } catch {\n return { problem: 'The callback is not JSON.' }\n }\n const shipment = asObject(asObject(parsed)['shipment'])\n if (!Object.keys(shipment).length) return { problem: 'The callback names no shipment.' }\n const carrier = asText(shipment['carrier_key'])\n const service = asText(shipment['carrier_service_key'])\n const trackingNumber = asText(shipment['tracking_number']).slice(0, 100)\n const notices: ShipNotice[] = []\n for (const entry of asArray(shipment['orders'])) {\n const order = asObject(entry)\n const external = asText(order['external_order_identifier']).slice(0, 200)\n if (!external) continue\n const items: ShipNoticeItem[] = []\n for (const recipient of asArray(order['recipients'])) {\n for (const raw of asArray(asObject(recipient)['line_items'])) {\n const line = asObject(raw)\n const quantity = Math.floor(Number(line['quantity']))\n if (!Number.isFinite(quantity) || quantity <= 0) continue\n items.push({\n lineItemId: asText(line['ext_line_item_id']) || null,\n sku: asText(line['sku']) || null,\n name: asText(line['item_name']) || null,\n quantity,\n })\n }\n }\n notices.push({ orderNumber: external, orderId: null, carrier, service, trackingNumber, items })\n }\n return {\n shipmentId: asText(shipment['id']) || null,\n workflowState: asText(shipment['workflow_state']).toLowerCase(),\n notices,\n }\n}\n"],"names":["orderIsTestMode","shippingLines","shippingOrderNumber","gramsToOunces","shipStationCanImport","weightsOfProducts","SHIPPINGEASY_DEFAULT_BASE_URL","SHIPPINGEASY_TIMESTAMP_TOLERANCE_MS","SHIPPINGEASY_AWAITING_SHIPMENT","shippingEasyFormComponent","value","encodeURIComponent","replace","char","charCodeAt","toString","toUpperCase","shippingEasyCanonicalQuery","params","Object","keys","filter","name","sort","map","join","shippingEasySignaturePlaintext","input","parts","method","path","body","push","shippingEasyIntent","order","docId","requiresShipping","status","$id","lineItems","fulfillments","length","money","cents","Math","round","Number","isFinite","toFixed","bounded","max","text","undefined","String","trim","slice","splitPersonName","words","split","Boolean","first_name","last_name","shippingEasyExternalId","facts","products","productId","variantId","variants","compact","fromEntries","entries","entry","shippingEasyOrderPayload","source","ship","bill","created","createdAtMs","Date","now","shippingAddress","billingAddress","totals","email","customerEmail","weights","lineItemId","line","quantity","unitGrams","known","options","item_name","variantLabel","sku","ext_line_item_id","ext_product_id","unit_price","unitAmountCents","total_excluding_tax","weight_in_ounces","product_options","recipient","customerName","phone_number","phone","customerPhone","address","line1","address2","line2","city","state","postal_code","postalCode","country","base_cost","shippingCents","cost_excluding_tax","items_total","reduce","sum","item","items_shipped","line_items","billName","external_order_identifier","ordered_at","toISOString","order_status","total_including_tax","totalCents","amountCents","total_tax","taxCents","subtotal_including_tax","itemsCents","discount_amount","discountCents","base_shipping_cost","shipping_cost_excluding_tax","notes","note","billing_first_name","billing_last_name","billing_address","billing_address2","billing_city","billing_state","billing_postal_code","billing_country","billing_phone_number","billing_email","recipients","SHIPPINGEASY_SHIPPED_STATES","Set","asObject","Array","isArray","asArray","asText","readShippingEasyCallback","parsed","JSON","parse","problem","shipment","carrier","service","trackingNumber","notices","external","items","raw","floor","orderNumber","orderId","shipmentId","workflowState","toLowerCase"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,eAAe,QAAQ,uBAAmB;AACnD,SAASC,aAAa,EAAEC,mBAAmB,EAAEC,aAAa,QAAQ,6BAAyB;AAC3F,SACEC,oBAAoB,EACpBC,iBAAiB,QAMZ,mBAAe;AAEtB;;;;;;;;;;;;;;;;;;;;;;CAsBC,GAED,yGAAyG,GACzG,OAAO,MAAMC,gCAAgC,+BAA8B;AAE3E,6FAA6F,GAC7F,OAAO,MAAMC,sCAAsC,KAAK,KAAK,KAAI;AAEjE,sDAAsD,GACtD,OAAO,MAAMC,iCAAiC,oBAAmB;AAEjE;;;;CAIC,GACD,OAAO,SAASC,0BAA0BC,KAAa;IACrD,OAAOC,mBAAmBD,OACvBE,OAAO,CAAC,YAAY,CAACC,OAAS,CAAC,CAAC,EAAEA,KAAKC,UAAU,CAAC,GAAGC,QAAQ,CAAC,IAAIC,WAAW,IAAI,EACjFJ,OAAO,CAAC,QAAQ;AACrB;AAEA,0HAA0H,GAC1H,OAAO,SAASK,2BAA2BC,MAAwC;IACjF,OAAOC,OAAOC,IAAI,CAACF,QAChBG,MAAM,CAAC,CAACC,OAASA,SAAS,iBAC1BC,IAAI,GACJC,GAAG,CAAC,CAACF,OAAS,GAAGb,0BAA0Ba,MAAM,CAAC,EAAEb,0BAA0BS,MAAM,CAACI,KAAK,GAAG,EAC7FG,IAAI,CAAC;AACV;AAEA,gHAAgH,GA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BACjDoF,MAAM5I,IAAI,CAAC;oBACTsD,YAAY0E,OAAOzE,IAAI,CAAC,mBAAmB,KAAK;oBAChDO,KAAKkE,OAAOzE,IAAI,CAAC,MAAM,KAAK;oBAC5BjE,MAAM0I,OAAOzE,IAAI,CAAC,YAAY,KAAK;oBACnCC;gBACF;YACF;QACF;QACAkF,QAAQ1I,IAAI,CAAC;YAAE+I,aAAaJ;YAAUK,SAAS;YAAMT;YAASC;YAASC;YAAgBG;QAAM;IAC/F;IACA,OAAO;QACLK,YAAYjB,OAAOM,QAAQ,CAAC,KAAK,KAAK;QACtCY,eAAelB,OAAOM,QAAQ,CAAC,iBAAiB,EAAEa,WAAW;QAC7DT;IACF;AACF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
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, OrderStatus } from './commerce-orders';
|
|
18
|
+
import { type ProductWeights } from './order-shipping-export';
|
|
19
|
+
export declare const SHIPSTATION_STATUS_NAMES: {
|
|
20
|
+
readonly unpaid: "unpaid";
|
|
21
|
+
readonly paid: "paid";
|
|
22
|
+
readonly shipped: "shipped";
|
|
23
|
+
readonly canceled: "canceled";
|
|
24
|
+
readonly onHold: "on_hold";
|
|
25
|
+
};
|
|
26
|
+
/** An Aglyn order status as the feed names it to ShipStation. */
|
|
27
|
+
export declare function shipStationOrderStatus(status: OrderStatus): string;
|
|
28
|
+
/** Orders per page of the feed. ShipStation follows `pages` until it has them all. */
|
|
29
|
+
export declare const SHIPSTATION_PAGE_SIZE = 100;
|
|
30
|
+
/** The widest window one request may ask for: a year, which no import needs. */
|
|
31
|
+
export declare const SHIPSTATION_MAX_WINDOW_MS: number;
|
|
32
|
+
/** Epoch milliseconds as ShipStation's `MM/dd/yyyy HH:mm`, in UTC. */
|
|
33
|
+
export declare function formatShipStationDate(ms: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* ShipStation's `MM/dd/yyyy HH:mm` (UTC; seconds and AM/PM tolerated) as
|
|
36
|
+
* epoch milliseconds, or `null` when the text is not a date. An ISO date is
|
|
37
|
+
* read too, for a merchant testing the URL by hand.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseShipStationDate(value: unknown): number | null;
|
|
40
|
+
/** What the feed knows about one variant of a product, read once per page. */
|
|
41
|
+
export interface ShipStationProductFacts {
|
|
42
|
+
grams?: number;
|
|
43
|
+
imageUrl?: string;
|
|
44
|
+
/** The variant's option choices: `{ Size: 'L', Color: 'Blue' }`. */
|
|
45
|
+
options?: Readonly<Record<string, string>>;
|
|
46
|
+
}
|
|
47
|
+
/** Product id → variant id (`''` for the product itself) → its facts. */
|
|
48
|
+
export type ShipStationProducts = Readonly<Record<string, Readonly<Record<string, ShipStationProductFacts>>>>;
|
|
49
|
+
/** The weights the shared shipping reading takes, from the products' facts. */
|
|
50
|
+
export declare function weightsOfProducts(products: ShipStationProducts): ProductWeights;
|
|
51
|
+
/**
|
|
52
|
+
* Free text as a CDATA section, as the guide asks. A `]]>` inside the text
|
|
53
|
+
* would end the section early, so it is split across two sections — the
|
|
54
|
+
* standard escape, which reads back as the same characters.
|
|
55
|
+
*/
|
|
56
|
+
export declare function xmlCdata(value: unknown, max: number): string;
|
|
57
|
+
/** A plain value (a number, a date, a code) with the five XML entities escaped. */
|
|
58
|
+
export declare function xmlText(value: unknown, max?: number): string;
|
|
59
|
+
/** One order as the feed needs it: the stored order and its document id. */
|
|
60
|
+
export interface ShipStationOrderSource {
|
|
61
|
+
docId: string;
|
|
62
|
+
order: Partial<HostOrder> & {
|
|
63
|
+
createdAtMs?: number;
|
|
64
|
+
updatedAtMs?: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Whether ShipStation can take this order at all: it insists on a ship-to
|
|
69
|
+
* name, street, city, postal code and two-letter country. An order without
|
|
70
|
+
* them could never become a label, and one invalid `<Order>` fails the whole
|
|
71
|
+
* import, so it is left out of the feed rather than sent with a guess.
|
|
72
|
+
*/
|
|
73
|
+
export declare function shipStationCanImport(order: Partial<HostOrder>): boolean;
|
|
74
|
+
/** One `<Order>` element of the feed. */
|
|
75
|
+
export declare function shipStationOrderXml(source: ShipStationOrderSource, products?: ShipStationProducts): string;
|
|
76
|
+
/** The whole `<Orders>` document for one page. */
|
|
77
|
+
export declare function shipStationOrdersXml(orders: readonly string[], pages: number): string;
|
|
78
|
+
/** One shipped line of a notice. */
|
|
79
|
+
export interface ShipNoticeItem {
|
|
80
|
+
lineItemId: string | null;
|
|
81
|
+
sku: string | null;
|
|
82
|
+
name: string | null;
|
|
83
|
+
quantity: number;
|
|
84
|
+
}
|
|
85
|
+
/** What a ShipNotice says, from its query string and its body together. */
|
|
86
|
+
export interface ShipNotice {
|
|
87
|
+
orderNumber: string | null;
|
|
88
|
+
orderId: string | null;
|
|
89
|
+
carrier: string;
|
|
90
|
+
service: string;
|
|
91
|
+
trackingNumber: string;
|
|
92
|
+
items: ShipNoticeItem[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A `<ShipNotice>` body read into a notice, or the reason it cannot be.
|
|
96
|
+
*
|
|
97
|
+
* Read by name, not by a general parser: the notice is a fixed, flat set of
|
|
98
|
+
* elements, and a document type declaration is refused outright, so no
|
|
99
|
+
* entity is ever defined or expanded beyond XML's five. The query string's
|
|
100
|
+
* `order_number`, `carrier`, `service` and `tracking_number` win when
|
|
101
|
+
* present — the guide names them first — and the body fills the rest.
|
|
102
|
+
*/
|
|
103
|
+
export declare function readShipNotice(xml: string, query: Readonly<Record<string, string | undefined>>): ShipNotice | {
|
|
104
|
+
problem: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* ShipStation's carrier code as a name a buyer reads and `trackingUrlFor`
|
|
108
|
+
* knows — `usps` → `USPS`, `fedex` → `FedEx`. An unknown code is passed on
|
|
109
|
+
* as sent, upper-cased at the first letter.
|
|
110
|
+
*/
|
|
111
|
+
export declare function shipStationCarrierName(code: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* Which order lines and how many units a notice ships, against the order.
|
|
114
|
+
* An item is found by the `LineItemID` the feed sent (the line's index),
|
|
115
|
+
* then by SKU among the lines still to ship. `null` lines means the notice
|
|
116
|
+
* named no items: everything still to ship went in this parcel. An item that
|
|
117
|
+
* names no line of this order is reported, not guessed at.
|
|
118
|
+
*/
|
|
119
|
+
export declare function shipNoticeLines(order: Pick<HostOrder, 'lineItems' | 'fulfillments'>, items: readonly ShipNoticeItem[]): {
|
|
120
|
+
lines: Array<{
|
|
121
|
+
lineItemId: number;
|
|
122
|
+
quantity: number;
|
|
123
|
+
}> | null;
|
|
124
|
+
unknown: string[];
|
|
125
|
+
};
|