@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,74 @@
|
|
|
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
|
+
* Carrier tracking links (AGL-3610) — THE one place a carrier name and a
|
|
19
|
+
* tracking number become a URL a buyer can open.
|
|
20
|
+
*
|
|
21
|
+
* SHARED ON PURPOSE. The buyer's shipped email and the guest order-status page
|
|
22
|
+
* (AGL-3610), the console's fulfillment rows and partial fulfillment
|
|
23
|
+
* (AGL-3611), and the shipping plugin's label purchase all need the same link
|
|
24
|
+
* for the same parcel. Import `trackingUrlFor` from
|
|
25
|
+
* `@aglyn/plugins-commerce/model` rather than writing a second table: two
|
|
26
|
+
* tables drift, and a buyer whose email and status page disagree about where
|
|
27
|
+
* their parcel is has been handed two answers to one question.
|
|
28
|
+
*
|
|
29
|
+
* The carrier is FREE TEXT on an order (`OrderFulfillment.carrier`, typed by a
|
|
30
|
+
* merchant or a supplier: "UPS", "ups ground", "Fed Ex", "USPS Priority"), so
|
|
31
|
+
* `carrierIdFor` matches loosely and returns `null` for anything it does not
|
|
32
|
+
* know. An unknown carrier gets NO link rather than a guess — a link to the
|
|
33
|
+
* wrong carrier's tracker is worse than none, because the buyer believes it.
|
|
34
|
+
*
|
|
35
|
+
* A fulfillment that already carries a `trackingUrl` (the shipping plugin's
|
|
36
|
+
* label purchase knows the exact one) wins over a built one:
|
|
37
|
+
* `fulfillmentTrackingUrl` is the reader every surface should call.
|
|
38
|
+
*/
|
|
39
|
+
export type TrackingCarrierId = 'usps' | 'ups' | 'fedex' | 'dhl' | 'canada-post' | 'royal-mail' | 'australia-post';
|
|
40
|
+
export interface TrackingCarrier {
|
|
41
|
+
id: TrackingCarrierId;
|
|
42
|
+
/** How the carrier names itself, for display. */
|
|
43
|
+
label: string;
|
|
44
|
+
/** Lower-cased, punctuation-stripped spellings a merchant types. */
|
|
45
|
+
aliases: readonly string[];
|
|
46
|
+
/** The public tracker, with the number URL-encoded in place. */
|
|
47
|
+
url: (trackingNumber: string) => string;
|
|
48
|
+
}
|
|
49
|
+
export declare const TRACKING_CARRIERS: readonly TrackingCarrier[];
|
|
50
|
+
/**
|
|
51
|
+
* The carrier a free-text name refers to, or `null`. Matches an alias exactly
|
|
52
|
+
* after squashing, then as a prefix ("UPS Ground", "USPS Priority Mail",
|
|
53
|
+
* "FedEx 2Day") — never as a substring, so "Pups Express" is not UPS.
|
|
54
|
+
*/
|
|
55
|
+
export declare function carrierIdFor(carrier: string | null | undefined): TrackingCarrierId | null;
|
|
56
|
+
/** Display label for a carrier id, or the merchant's own text. */
|
|
57
|
+
export declare function carrierLabelFor(carrier: string | null | undefined): string;
|
|
58
|
+
/**
|
|
59
|
+
* The public tracking URL for a parcel, or `null` when the carrier is unknown
|
|
60
|
+
* or there is no number. Whitespace inside the number is removed (merchants
|
|
61
|
+
* paste "1Z 999 AA1 01 2345 6784"); everything else is URL-encoded.
|
|
62
|
+
*/
|
|
63
|
+
export declare function trackingUrlFor(carrier: string | null | undefined, trackingNumber: string | null | undefined): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* The link for one fulfillment: its own stored `trackingUrl` when it is an
|
|
66
|
+
* `https:` URL, otherwise one built from carrier + number. Anything else in
|
|
67
|
+
* the stored field (a `javascript:` URL typed into a supplier callback) is
|
|
68
|
+
* ignored rather than rendered into an email or a page.
|
|
69
|
+
*/
|
|
70
|
+
export declare function fulfillmentTrackingUrl(fulfillment: {
|
|
71
|
+
carrier?: string | null;
|
|
72
|
+
trackingNumber?: string | null;
|
|
73
|
+
trackingUrl?: string | null;
|
|
74
|
+
}): string | null;
|
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
* Carrier tracking links (AGL-3610) — THE one place a carrier name and a
|
|
18
|
+
* tracking number become a URL a buyer can open.
|
|
19
|
+
*
|
|
20
|
+
* SHARED ON PURPOSE. The buyer's shipped email and the guest order-status page
|
|
21
|
+
* (AGL-3610), the console's fulfillment rows and partial fulfillment
|
|
22
|
+
* (AGL-3611), and the shipping plugin's label purchase all need the same link
|
|
23
|
+
* for the same parcel. Import `trackingUrlFor` from
|
|
24
|
+
* `@aglyn/plugins-commerce/model` rather than writing a second table: two
|
|
25
|
+
* tables drift, and a buyer whose email and status page disagree about where
|
|
26
|
+
* their parcel is has been handed two answers to one question.
|
|
27
|
+
*
|
|
28
|
+
* The carrier is FREE TEXT on an order (`OrderFulfillment.carrier`, typed by a
|
|
29
|
+
* merchant or a supplier: "UPS", "ups ground", "Fed Ex", "USPS Priority"), so
|
|
30
|
+
* `carrierIdFor` matches loosely and returns `null` for anything it does not
|
|
31
|
+
* know. An unknown carrier gets NO link rather than a guess — a link to the
|
|
32
|
+
* wrong carrier's tracker is worse than none, because the buyer believes it.
|
|
33
|
+
*
|
|
34
|
+
* A fulfillment that already carries a `trackingUrl` (the shipping plugin's
|
|
35
|
+
* label purchase knows the exact one) wins over a built one:
|
|
36
|
+
* `fulfillmentTrackingUrl` is the reader every surface should call.
|
|
37
|
+
*/ export const TRACKING_CARRIERS = [
|
|
38
|
+
{
|
|
39
|
+
id: 'usps',
|
|
40
|
+
label: 'USPS',
|
|
41
|
+
aliases: [
|
|
42
|
+
'usps',
|
|
43
|
+
'unitedstatespostalservice',
|
|
44
|
+
'uspostalservice',
|
|
45
|
+
'postalservice'
|
|
46
|
+
],
|
|
47
|
+
url: (number)=>`https://tools.usps.com/go/TrackConfirmAction?tLabels=${number}`
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'ups',
|
|
51
|
+
label: 'UPS',
|
|
52
|
+
aliases: [
|
|
53
|
+
'ups',
|
|
54
|
+
'unitedparcelservice'
|
|
55
|
+
],
|
|
56
|
+
url: (number)=>`https://www.ups.com/track?tracknum=${number}`
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'fedex',
|
|
60
|
+
label: 'FedEx',
|
|
61
|
+
aliases: [
|
|
62
|
+
'fedex',
|
|
63
|
+
'federalexpress'
|
|
64
|
+
],
|
|
65
|
+
url: (number)=>`https://www.fedex.com/fedextrack/?trknbr=${number}`
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'dhl',
|
|
69
|
+
label: 'DHL',
|
|
70
|
+
aliases: [
|
|
71
|
+
'dhl',
|
|
72
|
+
'dhlexpress',
|
|
73
|
+
'dhlecommerce'
|
|
74
|
+
],
|
|
75
|
+
url: (number)=>`https://www.dhl.com/global-en/home/tracking.html?tracking-id=${number}`
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'canada-post',
|
|
79
|
+
label: 'Canada Post',
|
|
80
|
+
aliases: [
|
|
81
|
+
'canadapost',
|
|
82
|
+
'postescanada',
|
|
83
|
+
'canpost'
|
|
84
|
+
],
|
|
85
|
+
url: (number)=>`https://www.canadapost-postescanada.ca/track-reperage/en#/search?searchFor=${number}`
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'royal-mail',
|
|
89
|
+
label: 'Royal Mail',
|
|
90
|
+
aliases: [
|
|
91
|
+
'royalmail',
|
|
92
|
+
'parcelforce'
|
|
93
|
+
],
|
|
94
|
+
url: (number)=>`https://www.royalmail.com/track-your-item#/tracking-results/${number}`
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'australia-post',
|
|
98
|
+
label: 'Australia Post',
|
|
99
|
+
aliases: [
|
|
100
|
+
'australiapost',
|
|
101
|
+
'auspost',
|
|
102
|
+
'startrack'
|
|
103
|
+
],
|
|
104
|
+
url: (number)=>`https://auspost.com.au/mypost/track/details/${number}`
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
function squash(value) {
|
|
108
|
+
return value.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The carrier a free-text name refers to, or `null`. Matches an alias exactly
|
|
112
|
+
* after squashing, then as a prefix ("UPS Ground", "USPS Priority Mail",
|
|
113
|
+
* "FedEx 2Day") — never as a substring, so "Pups Express" is not UPS.
|
|
114
|
+
*/ export function carrierIdFor(carrier) {
|
|
115
|
+
const squashed = squash(String(carrier != null ? carrier : ''));
|
|
116
|
+
if (!squashed) return null;
|
|
117
|
+
for (const entry of TRACKING_CARRIERS){
|
|
118
|
+
if (entry.aliases.includes(squashed)) return entry.id;
|
|
119
|
+
}
|
|
120
|
+
// Longest alias first, so "uspostalservice" is tried before "ups".
|
|
121
|
+
const byLength = TRACKING_CARRIERS.flatMap((entry)=>entry.aliases.map((alias)=>({
|
|
122
|
+
alias,
|
|
123
|
+
id: entry.id
|
|
124
|
+
}))).sort((a, b)=>b.alias.length - a.alias.length);
|
|
125
|
+
for (const { alias, id } of byLength){
|
|
126
|
+
if (squashed.startsWith(alias)) return id;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/** Display label for a carrier id, or the merchant's own text. */ export function carrierLabelFor(carrier) {
|
|
131
|
+
var _ref;
|
|
132
|
+
var _TRACKING_CARRIERS_find;
|
|
133
|
+
const id = carrierIdFor(carrier);
|
|
134
|
+
return (_ref = (_TRACKING_CARRIERS_find = TRACKING_CARRIERS.find((entry)=>entry.id === id)) == null ? void 0 : _TRACKING_CARRIERS_find.label) != null ? _ref : String(carrier != null ? carrier : '').trim();
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The public tracking URL for a parcel, or `null` when the carrier is unknown
|
|
138
|
+
* or there is no number. Whitespace inside the number is removed (merchants
|
|
139
|
+
* paste "1Z 999 AA1 01 2345 6784"); everything else is URL-encoded.
|
|
140
|
+
*/ export function trackingUrlFor(carrier, trackingNumber) {
|
|
141
|
+
const number = String(trackingNumber != null ? trackingNumber : '').replace(/\s+/g, '');
|
|
142
|
+
if (!number) return null;
|
|
143
|
+
const id = carrierIdFor(carrier);
|
|
144
|
+
const entry = TRACKING_CARRIERS.find((candidate)=>candidate.id === id);
|
|
145
|
+
return entry ? entry.url(encodeURIComponent(number)) : null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The link for one fulfillment: its own stored `trackingUrl` when it is an
|
|
149
|
+
* `https:` URL, otherwise one built from carrier + number. Anything else in
|
|
150
|
+
* the stored field (a `javascript:` URL typed into a supplier callback) is
|
|
151
|
+
* ignored rather than rendered into an email or a page.
|
|
152
|
+
*/ export function fulfillmentTrackingUrl(fulfillment) {
|
|
153
|
+
var _fulfillment_trackingUrl;
|
|
154
|
+
const stored = String((_fulfillment_trackingUrl = fulfillment.trackingUrl) != null ? _fulfillment_trackingUrl : '').trim();
|
|
155
|
+
if (/^https:\/\/[^\s]+$/i.test(stored)) return stored;
|
|
156
|
+
return trackingUrlFor(fulfillment.carrier, fulfillment.trackingNumber);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
//# sourceMappingURL=tracking-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/tracking-url.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 * Carrier tracking links (AGL-3610) — THE one place a carrier name and a\n * tracking number become a URL a buyer can open.\n *\n * SHARED ON PURPOSE. The buyer's shipped email and the guest order-status page\n * (AGL-3610), the console's fulfillment rows and partial fulfillment\n * (AGL-3611), and the shipping plugin's label purchase all need the same link\n * for the same parcel. Import `trackingUrlFor` from\n * `@aglyn/plugins-commerce/model` rather than writing a second table: two\n * tables drift, and a buyer whose email and status page disagree about where\n * their parcel is has been handed two answers to one question.\n *\n * The carrier is FREE TEXT on an order (`OrderFulfillment.carrier`, typed by a\n * merchant or a supplier: \"UPS\", \"ups ground\", \"Fed Ex\", \"USPS Priority\"), so\n * `carrierIdFor` matches loosely and returns `null` for anything it does not\n * know. An unknown carrier gets NO link rather than a guess — a link to the\n * wrong carrier's tracker is worse than none, because the buyer believes it.\n *\n * A fulfillment that already carries a `trackingUrl` (the shipping plugin's\n * label purchase knows the exact one) wins over a built one:\n * `fulfillmentTrackingUrl` is the reader every surface should call.\n */\n\nexport type TrackingCarrierId =\n | 'usps'\n | 'ups'\n | 'fedex'\n | 'dhl'\n | 'canada-post'\n | 'royal-mail'\n | 'australia-post'\n\nexport interface TrackingCarrier {\n id: TrackingCarrierId\n /** How the carrier names itself, for display. */\n label: string\n /** Lower-cased, punctuation-stripped spellings a merchant types. */\n aliases: readonly string[]\n /** The public tracker, with the number URL-encoded in place. */\n url: (trackingNumber: string) => string\n}\n\nexport const TRACKING_CARRIERS: readonly TrackingCarrier[] = [\n {\n id: 'usps',\n label: 'USPS',\n aliases: ['usps', 'unitedstatespostalservice', 'uspostalservice', 'postalservice'],\n url: (number) =>\n `https://tools.usps.com/go/TrackConfirmAction?tLabels=${number}`,\n },\n {\n id: 'ups',\n label: 'UPS',\n aliases: ['ups', 'unitedparcelservice'],\n url: (number) => `https://www.ups.com/track?tracknum=${number}`,\n },\n {\n id: 'fedex',\n label: 'FedEx',\n aliases: ['fedex', 'federalexpress'],\n url: (number) => `https://www.fedex.com/fedextrack/?trknbr=${number}`,\n },\n {\n id: 'dhl',\n label: 'DHL',\n aliases: ['dhl', 'dhlexpress', 'dhlecommerce'],\n url: (number) =>\n `https://www.dhl.com/global-en/home/tracking.html?tracking-id=${number}`,\n },\n {\n id: 'canada-post',\n label: 'Canada Post',\n aliases: ['canadapost', 'postescanada', 'canpost'],\n url: (number) =>\n `https://www.canadapost-postescanada.ca/track-reperage/en#/search?searchFor=${number}`,\n },\n {\n id: 'royal-mail',\n label: 'Royal Mail',\n aliases: ['royalmail', 'parcelforce'],\n url: (number) =>\n `https://www.royalmail.com/track-your-item#/tracking-results/${number}`,\n },\n {\n id: 'australia-post',\n label: 'Australia Post',\n aliases: ['australiapost', 'auspost', 'startrack'],\n url: (number) => `https://auspost.com.au/mypost/track/details/${number}`,\n },\n]\n\nfunction squash(value: string): string {\n return value.toLowerCase().replace(/[^a-z0-9]/g, '')\n}\n\n/**\n * The carrier a free-text name refers to, or `null`. Matches an alias exactly\n * after squashing, then as a prefix (\"UPS Ground\", \"USPS Priority Mail\",\n * \"FedEx 2Day\") — never as a substring, so \"Pups Express\" is not UPS.\n */\nexport function carrierIdFor(\n carrier: string | null | undefined,\n): TrackingCarrierId | null {\n const squashed = squash(String(carrier ?? ''))\n if (!squashed) return null\n for (const entry of TRACKING_CARRIERS) {\n if (entry.aliases.includes(squashed)) return entry.id\n }\n // Longest alias first, so \"uspostalservice\" is tried before \"ups\".\n const byLength = TRACKING_CARRIERS.flatMap((entry) =>\n entry.aliases.map((alias) => ({ alias, id: entry.id })),\n ).sort((a, b) => b.alias.length - a.alias.length)\n for (const { alias, id } of byLength) {\n if (squashed.startsWith(alias)) return id\n }\n return null\n}\n\n/** Display label for a carrier id, or the merchant's own text. */\nexport function carrierLabelFor(carrier: string | null | undefined): string {\n const id = carrierIdFor(carrier)\n return (\n TRACKING_CARRIERS.find((entry) => entry.id === id)?.label ??\n String(carrier ?? '').trim()\n )\n}\n\n/**\n * The public tracking URL for a parcel, or `null` when the carrier is unknown\n * or there is no number. Whitespace inside the number is removed (merchants\n * paste \"1Z 999 AA1 01 2345 6784\"); everything else is URL-encoded.\n */\nexport function trackingUrlFor(\n carrier: string | null | undefined,\n trackingNumber: string | null | undefined,\n): string | null {\n const number = String(trackingNumber ?? '').replace(/\\s+/g, '')\n if (!number) return null\n const id = carrierIdFor(carrier)\n const entry = TRACKING_CARRIERS.find((candidate) => candidate.id === id)\n return entry ? entry.url(encodeURIComponent(number)) : null\n}\n\n/**\n * The link for one fulfillment: its own stored `trackingUrl` when it is an\n * `https:` URL, otherwise one built from carrier + number. Anything else in\n * the stored field (a `javascript:` URL typed into a supplier callback) is\n * ignored rather than rendered into an email or a page.\n */\nexport function fulfillmentTrackingUrl(fulfillment: {\n carrier?: string | null\n trackingNumber?: string | null\n trackingUrl?: string | null\n}): string | null {\n const stored = String(fulfillment.trackingUrl ?? '').trim()\n if (/^https:\\/\\/[^\\s]+$/i.test(stored)) return stored\n return trackingUrlFor(fulfillment.carrier, fulfillment.trackingNumber)\n}\n"],"names":["TRACKING_CARRIERS","id","label","aliases","url","number","squash","value","toLowerCase","replace","carrierIdFor","carrier","squashed","String","entry","includes","byLength","flatMap","map","alias","sort","a","b","length","startsWith","carrierLabelFor","find","trim","trackingUrlFor","trackingNumber","candidate","encodeURIComponent","fulfillmentTrackingUrl","fulfillment","stored","trackingUrl","test"],"mappings":"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"}
|
|
@@ -50,6 +50,19 @@ export declare const POS_MAX_DISCOUNT_PCT_DEFAULT = 100;
|
|
|
50
50
|
* settings doc directly.
|
|
51
51
|
*/
|
|
52
52
|
export declare const COMMERCE_CONFIG_SCHEMA: PluginConfigSchema;
|
|
53
|
+
/** The register's tip, receipt and display settings, resolved for one site. */
|
|
54
|
+
export interface PosRegisterSettings {
|
|
55
|
+
tippingEnabled: boolean;
|
|
56
|
+
tipPercentages: number[];
|
|
57
|
+
receiptDefault: 'ask' | 'print' | 'none';
|
|
58
|
+
displayMessage: string;
|
|
59
|
+
displayMarketingOptIn: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The register settings out of a merged commerce config, with every value
|
|
63
|
+
* typed and bounded so the register, the display and the server agree.
|
|
64
|
+
*/
|
|
65
|
+
export declare function posRegisterSettings(config: Record<string, unknown> | null | undefined): PosRegisterSettings;
|
|
53
66
|
/**
|
|
54
67
|
* The ceiling for one org, read defensively (AGL-2161).
|
|
55
68
|
*
|
package/src/lib/plugin-config.js
CHANGED
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
|
-
*/
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { posTipPercentages } from "./model/commerce-pos.js";
|
|
18
|
+
import { POS_OPS_CONFIG_DEFAULTS, POS_OPS_CONFIG_FIELDS } from "./pos-ops-config.js";
|
|
19
|
+
/**
|
|
17
20
|
* The ceiling a register may discount to, when the merchant has not set one
|
|
18
21
|
* (AGL-2161).
|
|
19
22
|
*
|
|
@@ -55,12 +58,81 @@
|
|
|
55
58
|
min: 0,
|
|
56
59
|
max: 100,
|
|
57
60
|
description: 'The largest discount the point of sale will accept on a sale. ' + 'A register that asks for more is refused, and the sale is not rung ' + 'up. Set to 0 to stop staff discounting at the register entirely.'
|
|
58
|
-
}
|
|
61
|
+
},
|
|
62
|
+
// THE REGISTER'S TIPS, RECEIPTS AND CUSTOMER DISPLAY (AGL-3607, AGL-3608).
|
|
63
|
+
// Off by default: a store that never asked for tips does not start
|
|
64
|
+
// asking its customers for one on the day this ships.
|
|
65
|
+
{
|
|
66
|
+
key: 'posTippingEnabled',
|
|
67
|
+
label: 'Ask for tips at the register',
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
description: 'Offers the customer a tip on the card reader and on the customer ' + 'display. Tips are yours: they are not counted as sales and carry no ' + 'platform fee.'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: 'posTipPercentages',
|
|
73
|
+
label: 'Tip choices (%)',
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: 'Up to four percentages, separated by commas, shown to the customer ' + 'as tip buttons. The customer can also enter an amount or choose no tip.'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
key: 'posReceiptDefault',
|
|
79
|
+
label: 'Receipts at the register',
|
|
80
|
+
type: 'select',
|
|
81
|
+
options: [
|
|
82
|
+
{
|
|
83
|
+
value: 'ask',
|
|
84
|
+
label: 'Ask the customer'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
value: 'print',
|
|
88
|
+
label: 'Always print'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: 'none',
|
|
92
|
+
label: 'No receipt unless asked'
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
description: 'With a customer display paired, "Ask the customer" lets them choose ' + 'email, print or no receipt on their own screen.'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: 'posDisplayMessage',
|
|
99
|
+
label: 'Customer display welcome',
|
|
100
|
+
type: 'string',
|
|
101
|
+
description: 'The line the customer display shows under your store name between ' + 'sales. Leave blank for "Welcome".'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: 'posDisplayMarketingOptIn',
|
|
105
|
+
label: 'Offer email sign-up on the customer display',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
description: 'Shows an unticked "Email me news and offers" box when a customer ' + 'asks for an email receipt. Only a ticked box adds them to your ' + 'marketing audience.'
|
|
108
|
+
},
|
|
109
|
+
// RUNNING THE REGISTER (AGL-3609): shifts, refund limits, the idle lock
|
|
110
|
+
// and what a printed receipt carries.
|
|
111
|
+
...POS_OPS_CONFIG_FIELDS
|
|
59
112
|
],
|
|
60
|
-
defaults: {
|
|
61
|
-
posMaxDiscountPct: POS_MAX_DISCOUNT_PCT_DEFAULT
|
|
62
|
-
|
|
113
|
+
defaults: _extends({
|
|
114
|
+
posMaxDiscountPct: POS_MAX_DISCOUNT_PCT_DEFAULT,
|
|
115
|
+
posTippingEnabled: false,
|
|
116
|
+
posTipPercentages: '15, 18, 20, 25',
|
|
117
|
+
posReceiptDefault: 'ask',
|
|
118
|
+
posDisplayMessage: '',
|
|
119
|
+
posDisplayMarketingOptIn: true
|
|
120
|
+
}, POS_OPS_CONFIG_DEFAULTS)
|
|
63
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* The register settings out of a merged commerce config, with every value
|
|
124
|
+
* typed and bounded so the register, the display and the server agree.
|
|
125
|
+
*/ export function posRegisterSettings(config) {
|
|
126
|
+
var _ref, _ref1;
|
|
127
|
+
const receipt = String((_ref = config == null ? void 0 : config['posReceiptDefault']) != null ? _ref : 'ask');
|
|
128
|
+
return {
|
|
129
|
+
tippingEnabled: (config == null ? void 0 : config['posTippingEnabled']) === true,
|
|
130
|
+
tipPercentages: posTipPercentages(config == null ? void 0 : config['posTipPercentages']),
|
|
131
|
+
receiptDefault: receipt === 'print' || receipt === 'none' ? receipt : 'ask',
|
|
132
|
+
displayMessage: String((_ref1 = config == null ? void 0 : config['posDisplayMessage']) != null ? _ref1 : '').trim().slice(0, 120),
|
|
133
|
+
displayMarketingOptIn: (config == null ? void 0 : config['posDisplayMarketingOptIn']) !== false
|
|
134
|
+
};
|
|
135
|
+
}
|
|
64
136
|
/**
|
|
65
137
|
* The ceiling for one org, read defensively (AGL-2161).
|
|
66
138
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/plugin-config.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 { PluginConfigSchema } from '@aglyn/aglyn'\n\n/**\n * The ceiling a register may discount to, when the merchant has not set one\n * (AGL-2161).\n *\n * 100, i.e. today's behaviour exactly. That is deliberate and is the one\n * number in this fix that is NOT a safety judgement:\n *\n * - A full comp is a legitimate register operation — a damaged item, a\n * goodwill gesture, a staff meal — and every merchant on the platform has\n * had it since POS shipped.\n * - Any lower default would change what merchants charge their own customers\n * on the day it deployed, without them asking. Picking that number is a\n * merchant policy decision, not a bug fix, and inventing one here would be\n * the same class of mistake as inventing a billing rate.\n *\n * What AGL-2161 actually fixes is that there was no ceiling to set and no\n * refusal when one was exceeded: the request body's `discountPct` was clamped\n * into range and rung up, so a register sending `150` silently comped the\n * whole sale. The ceiling is now real, enforced server-side, refused rather\n * than clamped, and one config value away from being lower.\n */\nexport const POS_MAX_DISCOUNT_PCT_DEFAULT = 100\n\n/**\n * Commerce plugin config schema (AGL-428 framework, AGL-2161 adopter).\n *\n * PURE DATA (type-only aglyn import), the same shape as bookings': the client\n * barrel registers it via '@aglyn/aglyn' and the /server entry via\n * '@aglyn/aglyn/server', so neither bundle drags in the other's barrel.\n *\n * `min`/`max` are not decoration — `mergePluginConfig` coerces a stored value\n * into the declared range and falls back to the default on junk, so the\n * ceiling itself cannot be forged out of bounds by a manager editing the\n * settings doc directly.\n */\nexport const COMMERCE_CONFIG_SCHEMA: PluginConfigSchema = {\n pluginId: 'commerce',\n fields: [\n {\n key: 'posMaxDiscountPct',\n label: 'Maximum register discount (%)',\n type: 'number',\n min: 0,\n max: 100,\n description:\n 'The largest discount the point of sale will accept on a sale. ' +\n 'A register that asks for more is refused, and the sale is not rung ' +\n 'up. Set to 0 to stop staff discounting at the register entirely.',\n },\n ],\n defaults: {
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/plugin-config.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 { PluginConfigSchema } from '@aglyn/aglyn'\nimport { posTipPercentages } from './model/commerce-pos'\nimport { POS_OPS_CONFIG_DEFAULTS, POS_OPS_CONFIG_FIELDS } from './pos-ops-config'\n\n/**\n * The ceiling a register may discount to, when the merchant has not set one\n * (AGL-2161).\n *\n * 100, i.e. today's behaviour exactly. That is deliberate and is the one\n * number in this fix that is NOT a safety judgement:\n *\n * - A full comp is a legitimate register operation — a damaged item, a\n * goodwill gesture, a staff meal — and every merchant on the platform has\n * had it since POS shipped.\n * - Any lower default would change what merchants charge their own customers\n * on the day it deployed, without them asking. Picking that number is a\n * merchant policy decision, not a bug fix, and inventing one here would be\n * the same class of mistake as inventing a billing rate.\n *\n * What AGL-2161 actually fixes is that there was no ceiling to set and no\n * refusal when one was exceeded: the request body's `discountPct` was clamped\n * into range and rung up, so a register sending `150` silently comped the\n * whole sale. The ceiling is now real, enforced server-side, refused rather\n * than clamped, and one config value away from being lower.\n */\nexport const POS_MAX_DISCOUNT_PCT_DEFAULT = 100\n\n/**\n * Commerce plugin config schema (AGL-428 framework, AGL-2161 adopter).\n *\n * PURE DATA (type-only aglyn import), the same shape as bookings': the client\n * barrel registers it via '@aglyn/aglyn' and the /server entry via\n * '@aglyn/aglyn/server', so neither bundle drags in the other's barrel.\n *\n * `min`/`max` are not decoration — `mergePluginConfig` coerces a stored value\n * into the declared range and falls back to the default on junk, so the\n * ceiling itself cannot be forged out of bounds by a manager editing the\n * settings doc directly.\n */\nexport const COMMERCE_CONFIG_SCHEMA: PluginConfigSchema = {\n pluginId: 'commerce',\n fields: [\n {\n key: 'posMaxDiscountPct',\n label: 'Maximum register discount (%)',\n type: 'number',\n min: 0,\n max: 100,\n description:\n 'The largest discount the point of sale will accept on a sale. ' +\n 'A register that asks for more is refused, and the sale is not rung ' +\n 'up. Set to 0 to stop staff discounting at the register entirely.',\n },\n // THE REGISTER'S TIPS, RECEIPTS AND CUSTOMER DISPLAY (AGL-3607, AGL-3608).\n // Off by default: a store that never asked for tips does not start\n // asking its customers for one on the day this ships.\n {\n key: 'posTippingEnabled',\n label: 'Ask for tips at the register',\n type: 'boolean',\n description:\n 'Offers the customer a tip on the card reader and on the customer ' +\n 'display. Tips are yours: they are not counted as sales and carry no ' +\n 'platform fee.',\n },\n {\n key: 'posTipPercentages',\n label: 'Tip choices (%)',\n type: 'string',\n description:\n 'Up to four percentages, separated by commas, shown to the customer ' +\n 'as tip buttons. The customer can also enter an amount or choose no tip.',\n },\n {\n key: 'posReceiptDefault',\n label: 'Receipts at the register',\n type: 'select',\n options: [\n { value: 'ask', label: 'Ask the customer' },\n { value: 'print', label: 'Always print' },\n { value: 'none', label: 'No receipt unless asked' },\n ],\n description:\n 'With a customer display paired, \"Ask the customer\" lets them choose ' +\n 'email, print or no receipt on their own screen.',\n },\n {\n key: 'posDisplayMessage',\n label: 'Customer display welcome',\n type: 'string',\n description:\n 'The line the customer display shows under your store name between ' +\n 'sales. Leave blank for \"Welcome\".',\n },\n {\n key: 'posDisplayMarketingOptIn',\n label: 'Offer email sign-up on the customer display',\n type: 'boolean',\n description:\n 'Shows an unticked \"Email me news and offers\" box when a customer ' +\n 'asks for an email receipt. Only a ticked box adds them to your ' +\n 'marketing audience.',\n },\n // RUNNING THE REGISTER (AGL-3609): shifts, refund limits, the idle lock\n // and what a printed receipt carries.\n ...POS_OPS_CONFIG_FIELDS,\n ],\n defaults: {\n posMaxDiscountPct: POS_MAX_DISCOUNT_PCT_DEFAULT,\n posTippingEnabled: false,\n posTipPercentages: '15, 18, 20, 25',\n posReceiptDefault: 'ask',\n posDisplayMessage: '',\n posDisplayMarketingOptIn: true,\n ...POS_OPS_CONFIG_DEFAULTS,\n },\n}\n\n/** The register's tip, receipt and display settings, resolved for one site. */\nexport interface PosRegisterSettings {\n tippingEnabled: boolean\n tipPercentages: number[]\n receiptDefault: 'ask' | 'print' | 'none'\n displayMessage: string\n displayMarketingOptIn: boolean\n}\n\n/**\n * The register settings out of a merged commerce config, with every value\n * typed and bounded so the register, the display and the server agree.\n */\nexport function posRegisterSettings(\n config: Record<string, unknown> | null | undefined,\n): PosRegisterSettings {\n const receipt = String(config?.['posReceiptDefault'] ?? 'ask')\n return {\n tippingEnabled: config?.['posTippingEnabled'] === true,\n tipPercentages: posTipPercentages(config?.['posTipPercentages']),\n receiptDefault:\n receipt === 'print' || receipt === 'none' ? receipt : 'ask',\n displayMessage: String(config?.['posDisplayMessage'] ?? '').trim().slice(0, 120),\n displayMarketingOptIn: config?.['posDisplayMarketingOptIn'] !== false,\n }\n}\n\n/**\n * The ceiling for one org, read defensively (AGL-2161).\n *\n * Spelled here rather than at the call site so the POS route and any later\n * reader cannot disagree about what a missing or malformed value means. The\n * framework has already clamped and defaulted by the time this runs; the\n * second `Number.isFinite` guard is for the schema-less case, where\n * `getPluginConfig` returns the raw doc untouched.\n */\nexport function posMaxDiscountPct(\n config: Record<string, unknown> | null | undefined,\n): number {\n const raw = Number(config?.['posMaxDiscountPct'])\n if (!Number.isFinite(raw)) return POS_MAX_DISCOUNT_PCT_DEFAULT\n return Math.min(100, Math.max(0, raw))\n}\n"],"names":["posTipPercentages","POS_OPS_CONFIG_DEFAULTS","POS_OPS_CONFIG_FIELDS","POS_MAX_DISCOUNT_PCT_DEFAULT","COMMERCE_CONFIG_SCHEMA","pluginId","fields","key","label","type","min","max","description","options","value","defaults","posMaxDiscountPct","posTippingEnabled","posReceiptDefault","posDisplayMessage","posDisplayMarketingOptIn","posRegisterSettings","config","receipt","String","tippingEnabled","tipPercentages","receiptDefault","displayMessage","trim","slice","displayMarketingOptIn","raw","Number","isFinite","Math"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,sBAAkB;AAEjF;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMC,+BAA+B,IAAG;AAE/C;;;;;;;;;;;CAWC,GACD,OAAO,MAAMC,yBAA6C;IACxDC,UAAU;IACVC,QAAQ;QACN;YACEC,KAAK;YACLC,OAAO;YACPC,MAAM;YACNC,KAAK;YACLC,KAAK;YACLC,aACE,mEACA,wEACA;QACJ;QACA,2EAA2E;QAC3E,mEAAmE;QACnE,sDAAsD;QACtD;YACEL,KAAK;YACLC,OAAO;YACPC,MAAM;YACNG,aACE,sEACA,yEACA;QACJ;QACA;YACEL,KAAK;YACLC,OAAO;YACPC,MAAM;YACNG,aACE,wEACA;QACJ;QACA;YACEL,KAAK;YACLC,OAAO;YACPC,MAAM;YACNI,SAAS;gBACP;oBAAEC,OAAO;oBAAON,OAAO;gBAAmB;gBAC1C;oBAAEM,OAAO;oBAASN,OAAO;gBAAe;gBACxC;oBAAEM,OAAO;oBAAQN,OAAO;gBAA0B;aACnD;YACDI,aACE,yEACA;QACJ;QACA;YACEL,KAAK;YACLC,OAAO;YACPC,MAAM;YACNG,aACE,uEACA;QACJ;QACA;YACEL,KAAK;YACLC,OAAO;YACPC,MAAM;YACNG,aACE,sEACA,oEACA;QACJ;QACA,wEAAwE;QACxE,sCAAsC;WACnCV;KACJ;IACDa,UAAU;QACRC,mBAAmBb;QACnBc,mBAAmB;QACnBjB,mBAAmB;QACnBkB,mBAAmB;QACnBC,mBAAmB;QACnBC,0BAA0B;OACvBnB;AAEP,EAAC;AAWD;;;CAGC,GACD,OAAO,SAASoB,oBACdC,MAAkD;;IAElD,MAAMC,UAAUC,eAAOF,0BAAAA,MAAQ,CAAC,oBAAoB,mBAAI;IACxD,OAAO;QACLG,gBAAgBH,CAAAA,0BAAAA,MAAQ,CAAC,oBAAoB,MAAK;QAClDI,gBAAgB1B,kBAAkBsB,0BAAAA,MAAQ,CAAC,oBAAoB;QAC/DK,gBACEJ,YAAY,WAAWA,YAAY,SAASA,UAAU;QACxDK,gBAAgBJ,gBAAOF,0BAAAA,MAAQ,CAAC,oBAAoB,oBAAI,IAAIO,IAAI,GAAGC,KAAK,CAAC,GAAG;QAC5EC,uBAAuBT,CAAAA,0BAAAA,MAAQ,CAAC,2BAA2B,MAAK;IAClE;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASN,kBACdM,MAAkD;IAElD,MAAMU,MAAMC,OAAOX,0BAAAA,MAAQ,CAAC,oBAAoB;IAChD,IAAI,CAACW,OAAOC,QAAQ,CAACF,MAAM,OAAO7B;IAClC,OAAOgC,KAAKzB,GAAG,CAAC,KAAKyB,KAAKxB,GAAG,CAAC,GAAGqB;AACnC"}
|
package/src/lib/plugin.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { mdiStorefrontOutline } from "@aglyn/shared-data-mdi";
|
|
18
18
|
import { lazy } from "react";
|
|
19
19
|
const PosConsolePage = lazy(()=>import("./components/console/pos-page.component.js"));
|
|
20
|
+
/** The customer display (AGL-3608): loads only on the public page that shows it. */ const PosDisplayPage = lazy(()=>import("./components/console/pos-display-page.component.js"));
|
|
20
21
|
const CommerceGlanceCard = lazy(()=>import("./components/console/commerce-glance-card.component.js"));
|
|
21
22
|
const NewestSiteUsersCard = lazy(()=>import("./components/console/newest-site-users-card.component.js"));
|
|
22
23
|
const SiteMemberPurchases = lazy(()=>import("./components/console/site-member-purchases.component.js"));
|
|
@@ -26,6 +27,9 @@ import { COMMERCE_PERMISSIONS } from "./model/plugin-permissions.js";
|
|
|
26
27
|
import { registerCommerceRecordLists } from "./model/commerce-record-lists.js";
|
|
27
28
|
import { registerCommerceRecordRoutes } from "./model/commerce-record-routes.js";
|
|
28
29
|
import { registerCommerceZones } from "./components/console/product-zones.js";
|
|
30
|
+
import { registerCommerceOrderZones } from "./components/console/order-zones.js";
|
|
31
|
+
import { registerCommerceReturnZones } from "./components/console/return-zones.js";
|
|
32
|
+
import { registerCommerceStoreZones } from "./components/console/store-zones.js";
|
|
29
33
|
import { registerCommerceTransferUi } from "./transfer/register-transfer-ui.js";
|
|
30
34
|
import { COMMERCE_SEARCH_SOURCES } from "./model/commerce-search-sources.js";
|
|
31
35
|
import { COMMERCE_CONFIG_SCHEMA } from "./plugin-config.js";
|
|
@@ -46,6 +50,14 @@ import { COMMERCE_CONFIG_SCHEMA } from "./plugin-config.js";
|
|
|
46
50
|
// The zones its product editor, products hub and CSV import dialog host,
|
|
47
51
|
// with the props each hands a widget (AGL-2916, AGL-3080).
|
|
48
52
|
registerCommerceZones();
|
|
53
|
+
// …and the order dialog's two (AGL-3611), where a shipping plugin's widget
|
|
54
|
+
// buys a label and records the shipment through the dialog's own route.
|
|
55
|
+
registerCommerceOrderZones();
|
|
56
|
+
// …and the return dialog's (AGL-3611), where a shipping plugin's widget
|
|
57
|
+
// buys the buyer a return label and attaches it through this plugin's route.
|
|
58
|
+
registerCommerceReturnZones();
|
|
59
|
+
// The orders list's bulk actions and the store's Settings (AGL-3612).
|
|
60
|
+
registerCommerceStoreZones();
|
|
49
61
|
// Its import and export resources' names and the products wizard's own
|
|
50
62
|
// step (AGL-3531); the server halves register from the console's server
|
|
51
63
|
// declarations.
|
|
@@ -60,6 +72,17 @@ import { COMMERCE_CONFIG_SCHEMA } from "./plugin-config.js";
|
|
|
60
72
|
pluginId: BUNDLE_ID,
|
|
61
73
|
displayName: 'Commerce',
|
|
62
74
|
searchSources: COMMERCE_SEARCH_SOURCES,
|
|
75
|
+
// The screen a register turns toward its customer (AGL-3608), at
|
|
76
|
+
// `/kiosk/commerce/pos-display`. No staff session: the device proves
|
|
77
|
+
// itself with the display token it got by pairing, and
|
|
78
|
+
// `server/pos-display.ts` refuses every read without one.
|
|
79
|
+
publicPages: [
|
|
80
|
+
{
|
|
81
|
+
path: '/pos-display',
|
|
82
|
+
title: 'Customer display',
|
|
83
|
+
Component: PosDisplayPage
|
|
84
|
+
}
|
|
85
|
+
],
|
|
63
86
|
// Dashboard/analytics glance card (AGL-419): rendered through the
|
|
64
87
|
// shell's 'commerceGlance' widget slot.
|
|
65
88
|
widgets: [
|
package/src/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/plugin.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 * as Aglyn from '@aglyn/aglyn'\nimport { mdiStorefrontOutline } from '@aglyn/shared-data-mdi'\nimport { lazy } from 'react'\nconst PosConsolePage = lazy(() => import('./components/console/pos-page.component'))\nconst CommerceGlanceCard = lazy(\n () => import('./components/console/commerce-glance-card.component'),\n)\nconst NewestSiteUsersCard = lazy(\n () => import('./components/console/newest-site-users-card.component'),\n)\nconst SiteMemberPurchases = lazy(\n () => import('./components/console/site-member-purchases.component'),\n)\nimport { COMMERCE_CONSOLE_SECTIONS } from './components/commerce-console-sections'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_PERMISSIONS } from './model/plugin-permissions'\nimport { registerCommerceRecordLists } from './model/commerce-record-lists'\nimport { registerCommerceRecordRoutes } from './model/commerce-record-routes'\nimport { registerCommerceZones } from './components/console/product-zones'\nimport { registerCommerceTransferUi } from './transfer/register-transfer-ui'\nimport { COMMERCE_SEARCH_SOURCES } from './model/commerce-search-sources'\nimport { COMMERCE_CONFIG_SCHEMA } from './plugin-config'\n\n/** Code-split: the Products console page only loads when opened. */\nconst CommerceConsolePage = lazy(() => import('./components/commerce-console-page'))\n\n/**\n * Console half (AGL-395): registers the Products nav item in the\n * ConsoleExtension registry so the commerce console surface is owned by the\n * plugin, like events and email. The page body still lives in the console\n * app (`/[hostId]/products`): its product editor depends on the app's media\n * browser, which transitively pulls in the org/session context, so a full\n * body relocation needs a plugin-consumable media-picker context first —\n * tracked as follow-up. The nav item omits a `Component`, so the shell's\n * nav renders the link and the existing named route serves the page.\n */\nexport function registerCommerceConsole(): void {\n // Where a product is read, for surfaces outside this plugin (AGL-3080).\n registerCommerceRecordRoutes()\n registerCommerceRecordLists()\n // The zones its product editor, products hub and CSV import dialog host,\n // with the props each hands a widget (AGL-2916, AGL-3080).\n registerCommerceZones()\n // Its import and export resources' names and the products wizard's own\n // step (AGL-3531); the server halves register from the console's server\n // declarations.\n registerCommerceTransferUi()\n // Plugin-declared permissions (AGL-435): tier defaults ride every\n // resolved role set; custom roles override key-by-key.\n Aglyn.registerPluginPermissions(COMMERCE_PERMISSIONS)\n // Register discount ceiling (AGL-2161) — the generic settings card renders\n // it from this schema, so there is no bespoke UI to keep in sync.\n Aglyn.registerPluginConfigSchema(COMMERCE_CONFIG_SCHEMA)\n Aglyn.registerConsoleExtension({\n pluginId: BUNDLE_ID,\n displayName: 'Commerce',\n searchSources: COMMERCE_SEARCH_SOURCES,\n // Dashboard/analytics glance card (AGL-419): rendered through the\n // shell's 'commerceGlance' widget slot.\n widgets: [\n {\n slot: 'commerceGlance',\n widgetId: 'commerce-glance',\n title: 'Commerce',\n Component: CommerceGlanceCard,\n },\n // What a site user bought — lifetime total, orders and subscriptions —\n // in their drawer on the site's Users page: the orders and\n // subscriptions are this plugin's.\n {\n slot: Aglyn.CONSOLE_WIDGET_SLOTS.siteMember,\n widgetId: 'commerce-site-member-purchases',\n title: 'Purchases',\n Component: SiteMemberPurchases,\n },\n ],\n navItems: [\n {\n label: 'Products',\n href: '/products',\n icon: { path: mdiStorefrontOutline.path },\n // Sections as ROUTES (AGL-2501): `/products/orders` and friends are\n // real URLs the shell resolves and gates, so the page mounts the one\n // being read instead of subscribing all six.\n sections: COMMERCE_CONSOLE_SECTIONS,\n header: {\n title: 'Products',\n icon: { path: mdiStorefrontOutline.path },\n // The overview, not `catalog`: this surface is the whole commerce\n // console — Catalog, Orders, Promotions and Reservations.\n docsTopic: 'commerce',\n },\n Component: CommerceConsolePage,\n },\n {\n // POS register (AGL-312/419): relocated from the app's /pos route —\n // the generic [pluginSlug] shell now serves it at the same URL.\n label: 'POS',\n href: '/pos',\n /*\n * WHO may open the register, declared on THIS nav item rather than on\n * the extension.\n *\n * A key here narrows one surface; a key on the extension would gate\n * every surface it registers, and Products is the sibling — a catalog\n * anyone who works on the site may open. The register is the one that\n * takes money and lists checked-in guests by name, so the two\n * genuinely have different answers and only this one is narrowed.\n *\n * `managePos` rather than a dotted catalog key because it is the key\n * the sale itself is refused by: `server/pos-order.ts` resolves the\n * member's permission map and returns 403 unless `managePos` holds.\n * The shell answers this declaration out of that same resolved map, so\n * the console offers a register exactly to the people the route will\n * accept a sale from — the gate and its server twin cannot disagree,\n * because they are reading one value.\n *\n * `pos-order.ts` stays the enforcement point regardless. This decides\n * whether the surface is built at all, which is the part a check\n * inside the page cannot do: by the time the page can refuse itself it\n * has mounted and its product, register, location and reservation\n * listeners are already open.\n */\n permission: 'managePos',\n icon: { path: mdiStorefrontOutline.path },\n header: { title: 'Point of Sale', docsTopic: 'pos' },\n Component: PosConsolePage,\n },\n ],\n })\n /*\n * The USER ACCOUNTS half, registered under its own id.\n *\n * `accounts` is a switch rather than a bundle: the member blocks and every\n * `membership/*` handler ship inside this package, which is why the id\n * carries no loader manifest entry of its own. A second extension is how a\n * card about visitor accounts is gated on the switch that decides whether\n * the site serves them — `listConsoleWidgets` filters by the workspace's\n * effective plugin ids, and `accounts` is default-OFF per site.\n *\n * A separate call rather than more widgets on the commerce extension: the\n * registry is keyed by `pluginId` and that key IS the gate, so folding this\n * card in above would have kept the dashboard defect it fixes — `Newest\n * site users` on a site whose /signin returns 404.\n */\n Aglyn.registerConsoleExtension({\n pluginId: Aglyn.ACCOUNTS_PLUGIN_ID,\n displayName: 'User Accounts',\n widgets: [\n {\n slot: Aglyn.CONSOLE_WIDGET_SLOTS.hostDashboard,\n widgetId: 'accounts-newest-site-users',\n title: 'Newest site users',\n Component: NewestSiteUsersCard,\n },\n ],\n })\n}\n\nexport * from './site'\n"],"names":["Aglyn","mdiStorefrontOutline","lazy","PosConsolePage","CommerceGlanceCard","NewestSiteUsersCard","SiteMemberPurchases","COMMERCE_CONSOLE_SECTIONS","BUNDLE_ID","COMMERCE_PERMISSIONS","registerCommerceRecordLists","registerCommerceRecordRoutes","registerCommerceZones","registerCommerceTransferUi","COMMERCE_SEARCH_SOURCES","COMMERCE_CONFIG_SCHEMA","CommerceConsolePage","registerCommerceConsole","registerPluginPermissions","registerPluginConfigSchema","registerConsoleExtension","pluginId","displayName","searchSources","widgets","slot","widgetId","title","Component","CONSOLE_WIDGET_SLOTS","siteMember","navItems","label","href","icon","path","sections","header","docsTopic","permission","ACCOUNTS_PLUGIN_ID","hostDashboard"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,IAAI,QAAQ,QAAO;AAC5B,MAAMC,iBAAiBD,KAAK,IAAM,MAAM,CAAC;AACzC,MAAME,qBAAqBF,KACzB,IAAM,MAAM,CAAC;AAEf,MAAMG,sBAAsBH,KAC1B,IAAM,MAAM,CAAC;AAEf,MAAMI,sBAAsBJ,KAC1B,IAAM,MAAM,CAAC;AAEf,SAASK,yBAAyB,QAAQ,4CAAwC;AAClF,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,oBAAoB,QAAQ,gCAA4B;AACjE,SAASC,2BAA2B,QAAQ,mCAA+B;AAC3E,SAASC,4BAA4B,QAAQ,oCAAgC;AAC7E,SAASC,qBAAqB,QAAQ,wCAAoC;AAC1E,SAASC,0BAA0B,QAAQ,qCAAiC;AAC5E,SAASC,uBAAuB,QAAQ,qCAAiC;AACzE,SAASC,sBAAsB,QAAQ,qBAAiB;AAExD,kEAAkE,GAClE,MAAMC,sBAAsBd,KAAK,IAAM,MAAM,CAAC;AAE9C;;;;;;;;;CASC,GACD,OAAO,SAASe;IACd,wEAAwE;IACxEN;IACAD;IACA,yEAAyE;IACzE,2DAA2D;IAC3DE;IACA,uEAAuE;IACvE,wEAAwE;IACxE,gBAAgB;IAChBC;IACA,kEAAkE;IAClE,uDAAuD;IACvDb,MAAMkB,yBAAyB,CAACT;IAChC,2EAA2E;IAC3E,kEAAkE;IAClET,MAAMmB,0BAA0B,CAACJ;IACjCf,MAAMoB,wBAAwB,CAAC;QAC7BC,UAAUb;QACVc,aAAa;QACbC,eAAeT;QACf,kEAAkE;QAClE,wCAAwC;QACxCU,SAAS;YACP;gBACEC,MAAM;gBACNC,UAAU;gBACVC,OAAO;gBACPC,WAAWxB;YACb;YACA,uEAAuE;YACvE,2DAA2D;YAC3D,mCAAmC;YACnC;gBACEqB,MAAMzB,MAAM6B,oBAAoB,CAACC,UAAU;gBAC3CJ,UAAU;gBACVC,OAAO;gBACPC,WAAWtB;YACb;SACD;QACDyB,UAAU;YACR;gBACEC,OAAO;gBACPC,MAAM;gBACNC,MAAM;oBAAEC,MAAMlC,qBAAqBkC,IAAI;gBAAC;gBACxC,oEAAoE;gBACpE,qEAAqE;gBACrE,6CAA6C;gBAC7CC,UAAU7B;gBACV8B,QAAQ;oBACNV,OAAO;oBACPO,MAAM;wBAAEC,MAAMlC,qBAAqBkC,IAAI;oBAAC;oBACxC,kEAAkE;oBAClE,0DAA0D;oBAC1DG,WAAW;gBACb;gBACAV,WAAWZ;YACb;YACA;gBACE,oEAAoE;gBACpE,gEAAgE;gBAChEgB,OAAO;gBACPC,MAAM;gBACN;;;;;;;;;;;;;;;;;;;;;;;SAuBC,GACDM,YAAY;gBACZL,MAAM;oBAAEC,MAAMlC,qBAAqBkC,IAAI;gBAAC;gBACxCE,QAAQ;oBAAEV,OAAO;oBAAiBW,WAAW;gBAAM;gBACnDV,WAAWzB;YACb;SACD;IACH;IACA;;;;;;;;;;;;;;GAcC,GACDH,MAAMoB,wBAAwB,CAAC;QAC7BC,UAAUrB,MAAMwC,kBAAkB;QAClClB,aAAa;QACbE,SAAS;YACP;gBACEC,MAAMzB,MAAM6B,oBAAoB,CAACY,aAAa;gBAC9Cf,UAAU;gBACVC,OAAO;gBACPC,WAAWvB;YACb;SACD;IACH;AACF;AAEA,cAAc,YAAQ"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/plugin.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 * as Aglyn from '@aglyn/aglyn'\nimport { mdiStorefrontOutline } from '@aglyn/shared-data-mdi'\nimport { lazy } from 'react'\nconst PosConsolePage = lazy(() => import('./components/console/pos-page.component'))\n/** The customer display (AGL-3608): loads only on the public page that shows it. */\nconst PosDisplayPage = lazy(() => import('./components/console/pos-display-page.component'))\nconst CommerceGlanceCard = lazy(\n () => import('./components/console/commerce-glance-card.component'),\n)\nconst NewestSiteUsersCard = lazy(\n () => import('./components/console/newest-site-users-card.component'),\n)\nconst SiteMemberPurchases = lazy(\n () => import('./components/console/site-member-purchases.component'),\n)\nimport { COMMERCE_CONSOLE_SECTIONS } from './components/commerce-console-sections'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_PERMISSIONS } from './model/plugin-permissions'\nimport { registerCommerceRecordLists } from './model/commerce-record-lists'\nimport { registerCommerceRecordRoutes } from './model/commerce-record-routes'\nimport { registerCommerceZones } from './components/console/product-zones'\nimport { registerCommerceOrderZones } from './components/console/order-zones'\nimport { registerCommerceReturnZones } from './components/console/return-zones'\nimport { registerCommerceStoreZones } from './components/console/store-zones'\nimport { registerCommerceTransferUi } from './transfer/register-transfer-ui'\nimport { COMMERCE_SEARCH_SOURCES } from './model/commerce-search-sources'\nimport { COMMERCE_CONFIG_SCHEMA } from './plugin-config'\n\n/** Code-split: the Products console page only loads when opened. */\nconst CommerceConsolePage = lazy(() => import('./components/commerce-console-page'))\n\n/**\n * Console half (AGL-395): registers the Products nav item in the\n * ConsoleExtension registry so the commerce console surface is owned by the\n * plugin, like events and email. The page body still lives in the console\n * app (`/[hostId]/products`): its product editor depends on the app's media\n * browser, which transitively pulls in the org/session context, so a full\n * body relocation needs a plugin-consumable media-picker context first —\n * tracked as follow-up. The nav item omits a `Component`, so the shell's\n * nav renders the link and the existing named route serves the page.\n */\nexport function registerCommerceConsole(): void {\n // Where a product is read, for surfaces outside this plugin (AGL-3080).\n registerCommerceRecordRoutes()\n registerCommerceRecordLists()\n // The zones its product editor, products hub and CSV import dialog host,\n // with the props each hands a widget (AGL-2916, AGL-3080).\n registerCommerceZones()\n // …and the order dialog's two (AGL-3611), where a shipping plugin's widget\n // buys a label and records the shipment through the dialog's own route.\n registerCommerceOrderZones()\n // …and the return dialog's (AGL-3611), where a shipping plugin's widget\n // buys the buyer a return label and attaches it through this plugin's route.\n registerCommerceReturnZones()\n // The orders list's bulk actions and the store's Settings (AGL-3612).\n registerCommerceStoreZones()\n // Its import and export resources' names and the products wizard's own\n // step (AGL-3531); the server halves register from the console's server\n // declarations.\n registerCommerceTransferUi()\n // Plugin-declared permissions (AGL-435): tier defaults ride every\n // resolved role set; custom roles override key-by-key.\n Aglyn.registerPluginPermissions(COMMERCE_PERMISSIONS)\n // Register discount ceiling (AGL-2161) — the generic settings card renders\n // it from this schema, so there is no bespoke UI to keep in sync.\n Aglyn.registerPluginConfigSchema(COMMERCE_CONFIG_SCHEMA)\n Aglyn.registerConsoleExtension({\n pluginId: BUNDLE_ID,\n displayName: 'Commerce',\n searchSources: COMMERCE_SEARCH_SOURCES,\n // The screen a register turns toward its customer (AGL-3608), at\n // `/kiosk/commerce/pos-display`. No staff session: the device proves\n // itself with the display token it got by pairing, and\n // `server/pos-display.ts` refuses every read without one.\n publicPages: [\n { path: '/pos-display', title: 'Customer display', Component: PosDisplayPage },\n ],\n // Dashboard/analytics glance card (AGL-419): rendered through the\n // shell's 'commerceGlance' widget slot.\n widgets: [\n {\n slot: 'commerceGlance',\n widgetId: 'commerce-glance',\n title: 'Commerce',\n Component: CommerceGlanceCard,\n },\n // What a site user bought — lifetime total, orders and subscriptions —\n // in their drawer on the site's Users page: the orders and\n // subscriptions are this plugin's.\n {\n slot: Aglyn.CONSOLE_WIDGET_SLOTS.siteMember,\n widgetId: 'commerce-site-member-purchases',\n title: 'Purchases',\n Component: SiteMemberPurchases,\n },\n ],\n navItems: [\n {\n label: 'Products',\n href: '/products',\n icon: { path: mdiStorefrontOutline.path },\n // Sections as ROUTES (AGL-2501): `/products/orders` and friends are\n // real URLs the shell resolves and gates, so the page mounts the one\n // being read instead of subscribing all six.\n sections: COMMERCE_CONSOLE_SECTIONS,\n header: {\n title: 'Products',\n icon: { path: mdiStorefrontOutline.path },\n // The overview, not `catalog`: this surface is the whole commerce\n // console — Catalog, Orders, Promotions and Reservations.\n docsTopic: 'commerce',\n },\n Component: CommerceConsolePage,\n },\n {\n // POS register (AGL-312/419): relocated from the app's /pos route —\n // the generic [pluginSlug] shell now serves it at the same URL.\n label: 'POS',\n href: '/pos',\n /*\n * WHO may open the register, declared on THIS nav item rather than on\n * the extension.\n *\n * A key here narrows one surface; a key on the extension would gate\n * every surface it registers, and Products is the sibling — a catalog\n * anyone who works on the site may open. The register is the one that\n * takes money and lists checked-in guests by name, so the two\n * genuinely have different answers and only this one is narrowed.\n *\n * `managePos` rather than a dotted catalog key because it is the key\n * the sale itself is refused by: `server/pos-order.ts` resolves the\n * member's permission map and returns 403 unless `managePos` holds.\n * The shell answers this declaration out of that same resolved map, so\n * the console offers a register exactly to the people the route will\n * accept a sale from — the gate and its server twin cannot disagree,\n * because they are reading one value.\n *\n * `pos-order.ts` stays the enforcement point regardless. This decides\n * whether the surface is built at all, which is the part a check\n * inside the page cannot do: by the time the page can refuse itself it\n * has mounted and its product, register, location and reservation\n * listeners are already open.\n */\n permission: 'managePos',\n icon: { path: mdiStorefrontOutline.path },\n header: { title: 'Point of Sale', docsTopic: 'pos' },\n Component: PosConsolePage,\n },\n ],\n })\n /*\n * The USER ACCOUNTS half, registered under its own id.\n *\n * `accounts` is a switch rather than a bundle: the member blocks and every\n * `membership/*` handler ship inside this package, which is why the id\n * carries no loader manifest entry of its own. A second extension is how a\n * card about visitor accounts is gated on the switch that decides whether\n * the site serves them — `listConsoleWidgets` filters by the workspace's\n * effective plugin ids, and `accounts` is default-OFF per site.\n *\n * A separate call rather than more widgets on the commerce extension: the\n * registry is keyed by `pluginId` and that key IS the gate, so folding this\n * card in above would have kept the dashboard defect it fixes — `Newest\n * site users` on a site whose /signin returns 404.\n */\n Aglyn.registerConsoleExtension({\n pluginId: Aglyn.ACCOUNTS_PLUGIN_ID,\n displayName: 'User Accounts',\n widgets: [\n {\n slot: Aglyn.CONSOLE_WIDGET_SLOTS.hostDashboard,\n widgetId: 'accounts-newest-site-users',\n title: 'Newest site users',\n Component: NewestSiteUsersCard,\n },\n ],\n })\n}\n\nexport * from './site'\n"],"names":["Aglyn","mdiStorefrontOutline","lazy","PosConsolePage","PosDisplayPage","CommerceGlanceCard","NewestSiteUsersCard","SiteMemberPurchases","COMMERCE_CONSOLE_SECTIONS","BUNDLE_ID","COMMERCE_PERMISSIONS","registerCommerceRecordLists","registerCommerceRecordRoutes","registerCommerceZones","registerCommerceOrderZones","registerCommerceReturnZones","registerCommerceStoreZones","registerCommerceTransferUi","COMMERCE_SEARCH_SOURCES","COMMERCE_CONFIG_SCHEMA","CommerceConsolePage","registerCommerceConsole","registerPluginPermissions","registerPluginConfigSchema","registerConsoleExtension","pluginId","displayName","searchSources","publicPages","path","title","Component","widgets","slot","widgetId","CONSOLE_WIDGET_SLOTS","siteMember","navItems","label","href","icon","sections","header","docsTopic","permission","ACCOUNTS_PLUGIN_ID","hostDashboard"],"mappings":"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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { PluginConfigField } from '@aglyn/aglyn';
|
|
18
|
+
/**
|
|
19
|
+
* The most a register refund may be without a manager's PIN, by default:
|
|
20
|
+
* nothing. Before this, only an admin of the whole workspace could refund at
|
|
21
|
+
* all, so a default above zero would hand every cashier refunds on the day it
|
|
22
|
+
* shipped. A merchant who trusts the till raises it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const POS_REFUND_LIMIT_DEFAULT = 0;
|
|
25
|
+
export declare const POS_OPS_CONFIG_FIELDS: PluginConfigField[];
|
|
26
|
+
export declare const POS_OPS_CONFIG_DEFAULTS: Record<string, unknown>;
|
|
27
|
+
/** The register settings, typed and bounded, for one site's merged config. */
|
|
28
|
+
export interface PosOpsSettings {
|
|
29
|
+
requireOpenShift: boolean;
|
|
30
|
+
refundLimitCents: number;
|
|
31
|
+
autoLockMinutes: number;
|
|
32
|
+
receiptAddress: string;
|
|
33
|
+
returnPolicy: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Read defensively: the framework has already clamped a schema'd value, and
|
|
37
|
+
* this second bound is for a config read without the schema.
|
|
38
|
+
*/
|
|
39
|
+
export declare function posOpsSettings(config: Record<string, unknown> | null | undefined): PosOpsSettings;
|