@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -1
- package/src/index.js.map +1 -1
- package/src/lib/barcode/barcode-decode.d.ts +71 -0
- package/src/lib/barcode/barcode-decode.js +498 -0
- package/src/lib/barcode/barcode-decode.js.map +1 -0
- package/src/lib/barcode/barcode-encode.d.ts +44 -0
- package/src/lib/barcode/barcode-encode.js +138 -0
- package/src/lib/barcode/barcode-encode.js.map +1 -0
- package/src/lib/barcode/barcode-scanner.component.d.ts +23 -0
- package/src/lib/barcode/barcode-scanner.component.js +260 -0
- package/src/lib/barcode/barcode-scanner.component.js.map +1 -0
- package/src/lib/barcode/scan-button.component.d.ts +10 -0
- package/src/lib/barcode/scan-button.component.js +62 -0
- package/src/lib/barcode/scan-button.component.js.map +1 -0
- package/src/lib/barcode/scanner-wedge.d.ts +35 -0
- package/src/lib/barcode/scanner-wedge.js +108 -0
- package/src/lib/barcode/scanner-wedge.js.map +1 -0
- package/src/lib/components/account.js +10 -1
- package/src/lib/components/account.js.map +1 -1
- package/src/lib/components/cart-extras.d.ts +45 -0
- package/src/lib/components/cart-extras.js +127 -0
- package/src/lib/components/cart-extras.js.map +1 -0
- package/src/lib/components/cart.js +82 -15
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/checkout-return-notice.d.ts +26 -0
- package/src/lib/components/checkout-return-notice.js +48 -0
- package/src/lib/components/checkout-return-notice.js.map +1 -0
- package/src/lib/components/commerce-console-page.js +124 -0
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/commerce-console-sections.d.ts +1 -1
- package/src/lib/components/commerce-console-sections.js +4 -0
- package/src/lib/components/commerce-console-sections.js.map +1 -1
- package/src/lib/components/console/bulk-fulfill.d.ts +44 -0
- package/src/lib/components/console/bulk-fulfill.js +84 -0
- package/src/lib/components/console/bulk-fulfill.js.map +1 -0
- package/src/lib/components/console/catalog-organization-card.component.js +1 -0
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -1
- package/src/lib/components/console/customer-notifications-card.component.d.ts +19 -0
- package/src/lib/components/console/customer-notifications-card.component.js +149 -0
- package/src/lib/components/console/customer-notifications-card.component.js.map +1 -0
- package/src/lib/components/console/host-orders-card.component.js +88 -6
- package/src/lib/components/console/host-orders-card.component.js.map +1 -1
- package/src/lib/components/console/locations-card.component.js +164 -57
- package/src/lib/components/console/locations-card.component.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +209 -61
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-fulfillment-panel.component.d.ts +48 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js +542 -0
- package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -0
- package/src/lib/components/console/order-invoice.component.d.ts +33 -0
- package/src/lib/components/console/order-invoice.component.js +81 -0
- package/src/lib/components/console/order-invoice.component.js.map +1 -0
- package/src/lib/components/console/order-receipt-resend.component.d.ts +21 -0
- package/src/lib/components/console/order-receipt-resend.component.js +203 -0
- package/src/lib/components/console/order-receipt-resend.component.js.map +1 -0
- package/src/lib/components/console/order-returns.component.d.ts +36 -0
- package/src/lib/components/console/order-returns.component.js +142 -0
- package/src/lib/components/console/order-returns.component.js.map +1 -0
- package/src/lib/components/console/order-shipping-actions.component.d.ts +54 -0
- package/src/lib/components/console/order-shipping-actions.component.js +149 -0
- package/src/lib/components/console/order-shipping-actions.component.js.map +1 -0
- package/src/lib/components/console/order-webhooks-card.component.d.ts +50 -0
- package/src/lib/components/console/order-webhooks-card.component.js +623 -0
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -0
- package/src/lib/components/console/order-zones.d.ts +155 -0
- package/src/lib/components/console/order-zones.js +40 -0
- package/src/lib/components/console/order-zones.js.map +1 -0
- package/src/lib/components/console/payment-methods-card.component.d.ts +67 -0
- package/src/lib/components/console/payment-methods-card.component.js +395 -0
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-api.d.ts +124 -0
- package/src/lib/components/console/pos/pos-api.js +101 -0
- package/src/lib/components/console/pos/pos-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +36 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +160 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js +352 -0
- package/src/lib/components/console/pos/pos-item-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-product-grid.component.d.ts +47 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js +272 -0
- package/src/lib/components/console/pos/pos-product-grid.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.d.ts +27 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js +282 -0
- package/src/lib/components/console/pos/pos-receipt-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +53 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js +445 -0
- package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.d.ts +31 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js +640 -0
- package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.d.ts +43 -0
- package/src/lib/components/console/pos/use-pos-display.js +161 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +14 -0
- package/src/lib/components/console/pos-devices-card.component.js +546 -0
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -0
- package/src/lib/components/console/pos-display/brand-screen.d.ts +33 -0
- package/src/lib/components/console/pos-display/brand-screen.js +85 -0
- package/src/lib/components/console/pos-display/brand-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/cart-screen.d.ts +29 -0
- package/src/lib/components/console/pos-display/cart-screen.js +166 -0
- package/src/lib/components/console/pos-display/cart-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pairing-screen.d.ts +24 -0
- package/src/lib/components/console/pos-display/pairing-screen.js +127 -0
- package/src/lib/components/console/pos-display/pairing-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +90 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +140 -0
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -0
- package/src/lib/components/console/pos-display/receipt-screen.d.ts +35 -0
- package/src/lib/components/console/pos-display/receipt-screen.js +200 -0
- package/src/lib/components/console/pos-display/receipt-screen.js.map +1 -0
- package/src/lib/components/console/pos-display/tip-screen.d.ts +36 -0
- package/src/lib/components/console/pos-display/tip-screen.js +211 -0
- package/src/lib/components/console/pos-display/tip-screen.js.map +1 -0
- package/src/lib/components/console/pos-display-page.component.d.ts +16 -0
- package/src/lib/components/console/pos-display-page.component.js +407 -0
- package/src/lib/components/console/pos-display-page.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +289 -0
- package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js +61 -0
- package/src/lib/components/console/pos-ops/pos-last-receipt.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +38 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +129 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js +60 -0
- package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.d.ts +48 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js +220 -0
- package/src/lib/components/console/pos-ops/pos-pin-pad.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.d.ts +63 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js +186 -0
- package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-receipt.d.ts +39 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js +182 -0
- package/src/lib/components/console/pos-ops/pos-receipt.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js +465 -0
- package/src/lib/components/console/pos-ops/pos-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.d.ts +29 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js +253 -0
- package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +34 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +494 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.d.ts +37 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js +102 -0
- package/src/lib/components/console/pos-ops/pos-shift-report.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.d.ts +30 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js +277 -0
- package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/register-ops.d.ts +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js +28 -0
- package/src/lib/components/console/pos-ops/register-ops.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.d.ts +46 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js +128 -0
- package/src/lib/components/console/pos-ops/use-pos-cashier.js.map +1 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.d.ts +36 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js +64 -0
- package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js.map +1 -0
- package/src/lib/components/console/pos-page.component.d.ts +13 -5
- package/src/lib/components/console/pos-page.component.js +756 -654
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/pos-zones.d.ts +23 -0
- package/src/lib/components/console/pos-zones.js +31 -0
- package/src/lib/components/console/pos-zones.js.map +1 -0
- package/src/lib/components/console/product-editor-dialog.component.js +61 -71
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-labels-dialog.component.d.ts +13 -0
- package/src/lib/components/console/product-labels-dialog.component.js +197 -0
- package/src/lib/components/console/product-labels-dialog.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +19 -0
- package/src/lib/components/console/product-register-fields.component.js +241 -0
- package/src/lib/components/console/product-register-fields.component.js.map +1 -0
- package/src/lib/components/console/product-zones.d.ts +44 -0
- package/src/lib/components/console/product-zones.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +23 -20
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
- package/src/lib/components/console/register-hardware-card.component.js +826 -0
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
- package/src/lib/components/console/registers-card.component.js +24 -5
- package/src/lib/components/console/registers-card.component.js.map +1 -1
- package/src/lib/components/console/return-actions.d.ts +38 -0
- package/src/lib/components/console/return-actions.js +76 -0
- package/src/lib/components/console/return-actions.js.map +1 -0
- package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
- package/src/lib/components/console/return-detail-dialog.component.js +718 -0
- package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
- package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
- package/src/lib/components/console/return-settings-card.component.js +195 -0
- package/src/lib/components/console/return-settings-card.component.js.map +1 -0
- package/src/lib/components/console/return-zones.d.ts +87 -0
- package/src/lib/components/console/return-zones.js +31 -0
- package/src/lib/components/console/return-zones.js.map +1 -0
- package/src/lib/components/console/returns-card.component.d.ts +45 -0
- package/src/lib/components/console/returns-card.component.js +159 -0
- package/src/lib/components/console/returns-card.component.js.map +1 -0
- package/src/lib/components/console/shipping-settings-card.component.js +161 -5
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
- package/src/lib/components/console/shippingeasy-card.component.js +378 -0
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
- package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
- package/src/lib/components/console/shipstation-card.component.js +345 -0
- package/src/lib/components/console/shipstation-card.component.js.map +1 -0
- package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
- package/src/lib/components/console/start-return-dialog.component.js +243 -0
- package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
- package/src/lib/components/console/stock-movements-card.component.js +2 -1
- package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +2 -66
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-zones.d.ts +42 -0
- package/src/lib/components/console/store-zones.js +39 -0
- package/src/lib/components/console/store-zones.js.map +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js.map +1 -1
- package/src/lib/components/order-status.d.ts +36 -0
- package/src/lib/components/order-status.js +502 -0
- package/src/lib/components/order-status.js.map +1 -0
- package/src/lib/components/product-detail.js +41 -2
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/return-request.d.ts +32 -0
- package/src/lib/components/return-request.js +576 -0
- package/src/lib/components/return-request.js.map +1 -0
- package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
- package/src/lib/components/storefront-payment-appearance.js +114 -0
- package/src/lib/components/storefront-payment-appearance.js.map +1 -0
- package/src/lib/components/storefront-payment-element.d.ts +57 -1
- package/src/lib/components/storefront-payment-element.js +332 -33
- package/src/lib/components/storefront-payment-element.js.map +1 -1
- package/src/lib/constants/order-status.d.ts +22 -0
- package/src/lib/constants/order-status.js +22 -0
- package/src/lib/constants/order-status.js.map +1 -0
- package/src/lib/constants/return-request.d.ts +27 -0
- package/src/lib/constants/return-request.js +32 -0
- package/src/lib/constants/return-request.js.map +1 -0
- package/src/lib/constants/stock-movement-query.js +2 -1
- package/src/lib/constants/stock-movement-query.js.map +1 -1
- package/src/lib/declarations.console-server.js +9 -0
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.server.d.ts +2 -1
- package/src/lib/declarations.server.js +68 -1
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/buyer-notifications.d.ts +59 -0
- package/src/lib/model/buyer-notifications.js +97 -0
- package/src/lib/model/buyer-notifications.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +171 -2
- package/src/lib/model/commerce-orders.js +26 -16
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-payment-methods.d.ts +146 -0
- package/src/lib/model/commerce-payment-methods.js +247 -0
- package/src/lib/model/commerce-payment-methods.js.map +1 -0
- package/src/lib/model/commerce-pos-ops.d.ts +437 -0
- package/src/lib/model/commerce-pos-ops.js +721 -0
- package/src/lib/model/commerce-pos-ops.js.map +1 -0
- package/src/lib/model/commerce-pos.d.ts +263 -0
- package/src/lib/model/commerce-pos.js +375 -0
- package/src/lib/model/commerce-pos.js.map +1 -0
- package/src/lib/model/commerce-printers.d.ts +211 -0
- package/src/lib/model/commerce-printers.js +181 -0
- package/src/lib/model/commerce-printers.js.map +1 -0
- package/src/lib/model/commerce-receipt.d.ts +97 -0
- package/src/lib/model/commerce-receipt.js +180 -0
- package/src/lib/model/commerce-receipt.js.map +1 -0
- package/src/lib/model/commerce-returns.d.ts +207 -0
- package/src/lib/model/commerce-returns.js +300 -0
- package/src/lib/model/commerce-returns.js.map +1 -0
- package/src/lib/model/commerce-shipping.d.ts +44 -1
- package/src/lib/model/commerce-shipping.js +53 -9
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/commerce-tax-engine.d.ts +90 -0
- package/src/lib/model/commerce-tax-engine.js +129 -0
- package/src/lib/model/commerce-tax-engine.js.map +1 -0
- package/src/lib/model/commerce.d.ts +91 -2
- package/src/lib/model/commerce.js +89 -1
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/index.d.ts +16 -0
- package/src/lib/model/index.js +16 -0
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/model/order-events.d.ts +154 -0
- package/src/lib/model/order-events.js +153 -0
- package/src/lib/model/order-events.js.map +1 -0
- package/src/lib/model/order-fulfillment.d.ts +117 -0
- package/src/lib/model/order-fulfillment.js +217 -0
- package/src/lib/model/order-fulfillment.js.map +1 -0
- package/src/lib/model/order-history.d.ts +58 -0
- package/src/lib/model/order-history.js +22 -0
- package/src/lib/model/order-history.js.map +1 -0
- package/src/lib/model/order-list-fields.d.ts +9 -1
- package/src/lib/model/order-list-fields.js +7 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/order-shipping-export.d.ts +91 -0
- package/src/lib/model/order-shipping-export.js +192 -0
- package/src/lib/model/order-shipping-export.js.map +1 -0
- package/src/lib/model/order-status-view.d.ts +103 -0
- package/src/lib/model/order-status-view.js +156 -0
- package/src/lib/model/order-status-view.js.map +1 -0
- package/src/lib/model/order-webhooks.d.ts +142 -0
- package/src/lib/model/order-webhooks.js +91 -0
- package/src/lib/model/order-webhooks.js.map +1 -0
- package/src/lib/model/product-channel.d.ts +56 -0
- package/src/lib/model/product-channel.js +86 -0
- package/src/lib/model/product-channel.js.map +1 -0
- package/src/lib/model/product-modifiers.d.ts +80 -0
- package/src/lib/model/product-modifiers.js +140 -0
- package/src/lib/model/product-modifiers.js.map +1 -0
- package/src/lib/model/product-write.d.ts +186 -0
- package/src/lib/model/product-write.js +116 -0
- package/src/lib/model/product-write.js.map +1 -0
- package/src/lib/model/shippingeasy.d.ts +94 -0
- package/src/lib/model/shippingeasy.js +267 -0
- package/src/lib/model/shippingeasy.js.map +1 -0
- package/src/lib/model/shipstation.d.ts +125 -0
- package/src/lib/model/shipstation.js +399 -0
- package/src/lib/model/shipstation.js.map +1 -0
- package/src/lib/model/smart-collection-reads.d.ts +32 -0
- package/src/lib/model/smart-collection-reads.js +63 -0
- package/src/lib/model/smart-collection-reads.js.map +1 -0
- package/src/lib/model/tracking-url.d.ts +74 -0
- package/src/lib/model/tracking-url.js +159 -0
- package/src/lib/model/tracking-url.js.map +1 -0
- package/src/lib/plugin-config.d.ts +13 -0
- package/src/lib/plugin-config.js +77 -5
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +26 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/pos-ops-config.d.ts +39 -0
- package/src/lib/pos-ops-config.js +88 -0
- package/src/lib/pos-ops-config.js.map +1 -0
- package/src/lib/printing/print-document.d.ts +106 -0
- package/src/lib/printing/print-document.js +464 -0
- package/src/lib/printing/print-document.js.map +1 -0
- package/src/lib/printing/product-labels.d.ts +58 -0
- package/src/lib/printing/product-labels.js +116 -0
- package/src/lib/printing/product-labels.js.map +1 -0
- package/src/lib/printing/render-epson.d.ts +57 -0
- package/src/lib/printing/render-epson.js +135 -0
- package/src/lib/printing/render-epson.js.map +1 -0
- package/src/lib/printing/render-star.d.ts +45 -0
- package/src/lib/printing/render-star.js +100 -0
- package/src/lib/printing/render-star.js.map +1 -0
- package/src/lib/printing/render-text.d.ts +25 -0
- package/src/lib/printing/render-text.js +53 -0
- package/src/lib/printing/render-text.js.map +1 -0
- package/src/lib/server/api-v1/openapi.js +27 -4
- package/src/lib/server/api-v1/openapi.js.map +1 -1
- package/src/lib/server/api-v1/order-view.d.ts +67 -0
- package/src/lib/server/api-v1/order-view.js +120 -0
- package/src/lib/server/api-v1/order-view.js.map +1 -0
- package/src/lib/server/api-v1/orders-and-products.js +58 -65
- package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
- package/src/lib/server/billing-webhook.js +135 -28
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +29 -0
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/carrier-rates-availability.d.ts +26 -0
- package/src/lib/server/carrier-rates-availability.js +76 -0
- package/src/lib/server/carrier-rates-availability.js.map +1 -0
- package/src/lib/server/carrier-shipping.d.ts +84 -0
- package/src/lib/server/carrier-shipping.js +135 -0
- package/src/lib/server/carrier-shipping.js.map +1 -0
- package/src/lib/server/cart-checkout.d.ts +2 -0
- package/src/lib/server/cart-checkout.js +226 -22
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/channel-order-updates.d.ts +50 -0
- package/src/lib/server/channel-order-updates.js +290 -0
- package/src/lib/server/channel-order-updates.js.map +1 -0
- package/src/lib/server/channel-orders.d.ts +85 -0
- package/src/lib/server/channel-orders.js +543 -0
- package/src/lib/server/channel-orders.js.map +1 -0
- package/src/lib/server/checkout-extras.d.ts +64 -0
- package/src/lib/server/checkout-extras.js +157 -0
- package/src/lib/server/checkout-extras.js.map +1 -0
- package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
- package/src/lib/server/checkout-status.js +111 -0
- package/src/lib/server/checkout-status.js.map +1 -0
- package/src/lib/server/checkout.js +86 -9
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/draft-order.js +34 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.d.ts +127 -10
- package/src/lib/server/fulfill-order.js +451 -49
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/legacy-feed.d.ts +28 -0
- package/src/lib/server/legacy-feed.js +52 -0
- package/src/lib/server/legacy-feed.js.map +1 -0
- package/src/lib/server/native-checkout.d.ts +34 -15
- package/src/lib/server/native-checkout.js +32 -17
- package/src/lib/server/native-checkout.js.map +1 -1
- package/src/lib/server/order-event-host-emit.d.ts +23 -0
- package/src/lib/server/order-event-host-emit.js +30 -0
- package/src/lib/server/order-event-host-emit.js.map +1 -0
- package/src/lib/server/order-event-triggers.d.ts +37 -0
- package/src/lib/server/order-event-triggers.js +119 -0
- package/src/lib/server/order-event-triggers.js.map +1 -0
- package/src/lib/server/order-events.d.ts +62 -0
- package/src/lib/server/order-events.js +109 -0
- package/src/lib/server/order-events.js.map +1 -0
- package/src/lib/server/order-history.d.ts +23 -0
- package/src/lib/server/order-history.js +65 -0
- package/src/lib/server/order-history.js.map +1 -0
- package/src/lib/server/order-notifications.d.ts +185 -0
- package/src/lib/server/order-notifications.js +567 -0
- package/src/lib/server/order-notifications.js.map +1 -0
- package/src/lib/server/order-receipt-send.d.ts +39 -0
- package/src/lib/server/order-receipt-send.js +151 -0
- package/src/lib/server/order-receipt-send.js.map +1 -0
- package/src/lib/server/order-status-token.d.ts +31 -0
- package/src/lib/server/order-status-token.js +75 -0
- package/src/lib/server/order-status-token.js.map +1 -0
- package/src/lib/server/order-status.d.ts +58 -0
- package/src/lib/server/order-status.js +141 -0
- package/src/lib/server/order-status.js.map +1 -0
- package/src/lib/server/order-webhooks.d.ts +108 -0
- package/src/lib/server/order-webhooks.js +622 -0
- package/src/lib/server/order-webhooks.js.map +1 -0
- package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
- package/src/lib/server/orders-shipping-prepare.js +121 -0
- package/src/lib/server/orders-shipping-prepare.js.map +1 -0
- package/src/lib/server/payment-method-domains.d.ts +209 -0
- package/src/lib/server/payment-method-domains.js +444 -0
- package/src/lib/server/payment-method-domains.js.map +1 -0
- package/src/lib/server/payment-methods.d.ts +77 -0
- package/src/lib/server/payment-methods.js +284 -0
- package/src/lib/server/payment-methods.js.map +1 -0
- package/src/lib/server/pos-auth.d.ts +50 -0
- package/src/lib/server/pos-auth.js +121 -0
- package/src/lib/server/pos-auth.js.map +1 -0
- package/src/lib/server/pos-customer.d.ts +49 -0
- package/src/lib/server/pos-customer.js +257 -0
- package/src/lib/server/pos-customer.js.map +1 -0
- package/src/lib/server/pos-display.d.ts +57 -0
- package/src/lib/server/pos-display.js +419 -0
- package/src/lib/server/pos-display.js.map +1 -0
- package/src/lib/server/pos-fee-month.d.ts +34 -0
- package/src/lib/server/pos-fee-month.js +36 -0
- package/src/lib/server/pos-fee-month.js.map +1 -0
- package/src/lib/server/pos-ops-gate.d.ts +161 -0
- package/src/lib/server/pos-ops-gate.js +295 -0
- package/src/lib/server/pos-ops-gate.js.map +1 -0
- package/src/lib/server/pos-ops-routes.d.ts +22 -0
- package/src/lib/server/pos-ops-routes.js +36 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -0
- package/src/lib/server/pos-order.d.ts +1 -18
- package/src/lib/server/pos-order.js +222 -42
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.d.ts +39 -0
- package/src/lib/server/pos-payment.js +922 -0
- package/src/lib/server/pos-payment.js.map +1 -0
- package/src/lib/server/pos-print.d.ts +82 -0
- package/src/lib/server/pos-print.js +193 -0
- package/src/lib/server/pos-print.js.map +1 -0
- package/src/lib/server/pos-readers.d.ts +27 -0
- package/src/lib/server/pos-readers.js +276 -0
- package/src/lib/server/pos-readers.js.map +1 -0
- package/src/lib/server/pos-refund-authority.d.ts +60 -0
- package/src/lib/server/pos-refund-authority.js +72 -0
- package/src/lib/server/pos-refund-authority.js.map +1 -0
- package/src/lib/server/pos-return.d.ts +58 -0
- package/src/lib/server/pos-return.js +891 -0
- package/src/lib/server/pos-return.js.map +1 -0
- package/src/lib/server/pos-sale-stamp.d.ts +66 -0
- package/src/lib/server/pos-sale-stamp.js +84 -0
- package/src/lib/server/pos-sale-stamp.js.map +1 -0
- package/src/lib/server/pos-sale.d.ts +170 -0
- package/src/lib/server/pos-sale.js +461 -0
- package/src/lib/server/pos-sale.js.map +1 -0
- package/src/lib/server/pos-shift.d.ts +45 -0
- package/src/lib/server/pos-shift.js +484 -0
- package/src/lib/server/pos-shift.js.map +1 -0
- package/src/lib/server/pos-staff-pin.d.ts +26 -0
- package/src/lib/server/pos-staff-pin.js +339 -0
- package/src/lib/server/pos-staff-pin.js.map +1 -0
- package/src/lib/server/pos-stripe.d.ts +91 -0
- package/src/lib/server/pos-stripe.js +129 -0
- package/src/lib/server/pos-stripe.js.map +1 -0
- package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
- package/src/lib/server/pos-terminal-connection-token.js +166 -0
- package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
- package/src/lib/server/pos-terminal.d.ts +218 -0
- package/src/lib/server/pos-terminal.js +1014 -0
- package/src/lib/server/pos-terminal.js.map +1 -0
- package/src/lib/server/print-queue.d.ts +124 -0
- package/src/lib/server/print-queue.js +301 -0
- package/src/lib/server/print-queue.js.map +1 -0
- package/src/lib/server/printer-poll.d.ts +75 -0
- package/src/lib/server/printer-poll.js +325 -0
- package/src/lib/server/printer-poll.js.map +1 -0
- package/src/lib/server/printer-secret.d.ts +39 -0
- package/src/lib/server/printer-secret.js +56 -0
- package/src/lib/server/printer-secret.js.map +1 -0
- package/src/lib/server/printers.d.ts +114 -0
- package/src/lib/server/printers.js +546 -0
- package/src/lib/server/printers.js.map +1 -0
- package/src/lib/server/product-catalog.d.ts +42 -0
- package/src/lib/server/product-catalog.js +309 -0
- package/src/lib/server/product-catalog.js.map +1 -0
- package/src/lib/server/product-drafts.d.ts +5 -1
- package/src/lib/server/product-drafts.js +3 -3
- package/src/lib/server/product-drafts.js.map +1 -1
- package/src/lib/server/product-writer.d.ts +19 -0
- package/src/lib/server/product-writer.js +261 -0
- package/src/lib/server/product-writer.js.map +1 -0
- package/src/lib/server/products-write.d.ts +61 -0
- package/src/lib/server/products-write.js +375 -0
- package/src/lib/server/products-write.js.map +1 -0
- package/src/lib/server/refund.js +110 -45
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reserve.js +2 -0
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/return-status-action.d.ts +37 -0
- package/src/lib/server/return-status-action.js +57 -0
- package/src/lib/server/return-status-action.js.map +1 -0
- package/src/lib/server/returns.d.ts +119 -0
- package/src/lib/server/returns.js +938 -0
- package/src/lib/server/returns.js.map +1 -0
- package/src/lib/server/shipment-records.d.ts +36 -0
- package/src/lib/server/shipment-records.js +289 -0
- package/src/lib/server/shipment-records.js.map +1 -0
- package/src/lib/server/shipping-connector-gates.d.ts +40 -0
- package/src/lib/server/shipping-connector-gates.js +97 -0
- package/src/lib/server/shipping-connector-gates.js.map +1 -0
- package/src/lib/server/shipping-connectors.d.ts +29 -0
- package/src/lib/server/shipping-connectors.js +236 -0
- package/src/lib/server/shipping-connectors.js.map +1 -0
- package/src/lib/server/shippingeasy.d.ts +238 -0
- package/src/lib/server/shippingeasy.js +787 -0
- package/src/lib/server/shippingeasy.js.map +1 -0
- package/src/lib/server/shipstation.d.ts +129 -0
- package/src/lib/server/shipstation.js +483 -0
- package/src/lib/server/shipstation.js.map +1 -0
- package/src/lib/server/site-page-resolver.d.ts +5 -0
- package/src/lib/server/site-page-resolver.js +156 -1
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/stock-levels.d.ts +21 -0
- package/src/lib/server/stock-levels.js +263 -0
- package/src/lib/server/stock-levels.js.map +1 -0
- package/src/lib/server/stripe-refund.d.ts +47 -0
- package/src/lib/server/stripe-refund.js +87 -0
- package/src/lib/server/stripe-refund.js.map +1 -0
- package/src/lib/server/supplier-update.js +46 -5
- package/src/lib/server/supplier-update.js.map +1 -1
- package/src/lib/server/tax-engine-quote.d.ts +47 -0
- package/src/lib/server/tax-engine-quote.js +105 -0
- package/src/lib/server/tax-engine-quote.js.map +1 -0
- package/src/lib/server.js +143 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/site.js +12 -0
- package/src/lib/site.js.map +1 -1
- package/src/lib/subprocessors.d.ts +26 -0
- package/src/lib/subprocessors.js +50 -0
- package/src/lib/subprocessors.js.map +1 -0
- package/src/lib/tenant-emails.js +461 -3
- package/src/lib/tenant-emails.js.map +1 -1
- package/src/lib/testing/fake-firestore.d.ts +45 -0
- package/src/lib/testing/fake-firestore.js +189 -0
- package/src/lib/testing/fake-firestore.js.map +1 -0
- package/src/lib/testing/memory-firestore.d.ts +136 -0
- package/src/lib/testing/memory-firestore.js +282 -0
- package/src/lib/testing/memory-firestore.js.map +1 -0
- package/src/lib/testing/pos-ops-harness.d.ts +50 -0
- package/src/lib/testing/pos-ops-harness.js +184 -0
- package/src/lib/testing/pos-ops-harness.js.map +1 -0
- package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
- package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
- package/src/lib/transfer/products.server.d.ts +5 -0
- package/src/lib/transfer/products.server.js +2 -2
- package/src/lib/transfer/products.server.js.map +1 -1
- package/src/lib/transfer/records-transfer.d.ts +11 -1
- package/src/lib/transfer/records-transfer.js +127 -5
- package/src/lib/transfer/records-transfer.js.map +1 -1
- package/src/lib/transfer/records.server.d.ts +9 -2
- package/src/lib/transfer/records.server.js +58 -7
- package/src/lib/transfer/records.server.js.map +1 -1
- package/src/lib/transfer/register-transfer-resources.js +40 -1
- package/src/lib/transfer/register-transfer-resources.js.map +1 -1
- package/src/lib/transfer/register-transfer-ui.js +4 -1
- package/src/lib/transfer/register-transfer-ui.js.map +1 -1
- package/src/lib/transfer/shipping-presets.d.ts +23 -0
- package/src/lib/transfer/shipping-presets.js +156 -0
- package/src/lib/transfer/shipping-presets.js.map +1 -0
- package/src/lib/transfer/tracking-transfer.d.ts +101 -0
- package/src/lib/transfer/tracking-transfer.js +546 -0
- package/src/lib/transfer/tracking-transfer.js.map +1 -0
- package/src/lib/transfer/tracking.server.d.ts +37 -0
- package/src/lib/transfer/tracking.server.js +393 -0
- package/src/lib/transfer/tracking.server.js.map +1 -0
- package/src/lib/transfer/transfer-keys.d.ts +2 -1
- package/src/lib/transfer/transfer-keys.js +6 -2
- package/src/lib/transfer/transfer-keys.js.map +1 -1
- package/src/lib/utils/code128.d.ts +37 -0
- package/src/lib/utils/code128.js +199 -0
- package/src/lib/utils/code128.js.map +1 -0
- package/src/lib/utils/order-invoice.d.ts +55 -0
- package/src/lib/utils/order-invoice.js +127 -0
- package/src/lib/utils/order-invoice.js.map +1 -0
- package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
- package/src/lib/utils/use-checkout-return-notice.js +78 -0
- package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
- package/src/lib/server/feed.js +0 -69
- package/src/lib/server/feed.js.map +0 -1
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import { pluginDocsHelp } from "@aglyn/aglyn";
|
|
20
|
+
import { CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
22
|
+
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
23
|
+
import { useUser } from "@aglyn/tenant-feature-instance";
|
|
24
|
+
import { Alert, Button, Chip, Divider, Stack, Switch, Typography } from "@mui/material";
|
|
25
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
26
|
+
import { STOREFRONT_PAYMENT_METHODS } from "../../model/commerce-payment-methods.js";
|
|
27
|
+
/**
|
|
28
|
+
* What a method's Stripe state means to the merchant, or null for nothing to
|
|
29
|
+
* say. Only an ON method gets a verdict: an off one is the merchant's choice.
|
|
30
|
+
*/ export function capabilityVerdict(row, accountConnected) {
|
|
31
|
+
if (!row.on) return null;
|
|
32
|
+
if (!accountConnected) return {
|
|
33
|
+
label: 'Connect Stripe first',
|
|
34
|
+
color: 'default'
|
|
35
|
+
};
|
|
36
|
+
switch(row.capability){
|
|
37
|
+
case 'active':
|
|
38
|
+
return {
|
|
39
|
+
label: 'Ready',
|
|
40
|
+
color: 'success'
|
|
41
|
+
};
|
|
42
|
+
case 'pending':
|
|
43
|
+
return {
|
|
44
|
+
label: 'Stripe is reviewing',
|
|
45
|
+
color: 'warning'
|
|
46
|
+
};
|
|
47
|
+
case 'inactive':
|
|
48
|
+
return {
|
|
49
|
+
label: 'Stripe needs more details',
|
|
50
|
+
color: 'warning'
|
|
51
|
+
};
|
|
52
|
+
case 'unrequested':
|
|
53
|
+
return {
|
|
54
|
+
label: 'Save to request',
|
|
55
|
+
color: 'default'
|
|
56
|
+
};
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** The domain chip: what Apple Pay can do on this name right now. */ export function domainVerdict(domain) {
|
|
62
|
+
if (domain.enabled && domain.status.applePay === 'active') {
|
|
63
|
+
return {
|
|
64
|
+
label: 'Apple Pay ready',
|
|
65
|
+
color: 'success'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (domain.enabled) return {
|
|
69
|
+
label: 'Registered',
|
|
70
|
+
color: 'default'
|
|
71
|
+
};
|
|
72
|
+
if (domain.lastError) return {
|
|
73
|
+
label: 'Retrying',
|
|
74
|
+
color: 'warning'
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
label: 'Registers on first checkout',
|
|
78
|
+
color: 'default'
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The methods a merchant can see: everything the platform offers, and every
|
|
83
|
+
* method we could not ask Stripe about except crypto, which is shown only once
|
|
84
|
+
* the platform positively offers it (AGL-3629: hidden where unavailable).
|
|
85
|
+
*/ export function visibleMethods(rows) {
|
|
86
|
+
return rows.map((row)=>({
|
|
87
|
+
row,
|
|
88
|
+
spec: STOREFRONT_PAYMENT_METHODS.find((method)=>method.id === row.id)
|
|
89
|
+
})).filter((entry)=>{
|
|
90
|
+
var _entry_spec;
|
|
91
|
+
return Boolean(entry.spec) && entry.row.platform !== 'unavailable' && !(entry.row.platform === null && ((_entry_spec = entry.spec) == null ? void 0 : _entry_spec.kind) === 'crypto');
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Payment methods (AGL-3629): which wallets, buy-now-pay-later and crypto
|
|
96
|
+
* options the storefront offers, what each needs, and whether Stripe is ready
|
|
97
|
+
* for it. Cards are always on and are not listed.
|
|
98
|
+
*
|
|
99
|
+
* Read and saved through `/api/commerce/payment-methods` rather than a
|
|
100
|
+
* Firestore listen, because two of the three facts per row — what the
|
|
101
|
+
* platform offers and the payout account's capability — live at Stripe, and a
|
|
102
|
+
* save is a Stripe request as well as a settings write.
|
|
103
|
+
*/ export function PaymentMethodsCard(props) {
|
|
104
|
+
const { hostId } = props;
|
|
105
|
+
const { data: user } = useUser();
|
|
106
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
107
|
+
const [view, setView] = useState(null);
|
|
108
|
+
const [state, setState] = useState('loading');
|
|
109
|
+
const [draft, setDraft] = useState({});
|
|
110
|
+
const [saving, setSaving] = useState(false);
|
|
111
|
+
const [nonce, setNonce] = useState(0);
|
|
112
|
+
// The load keys on the uid, not the user object: a refreshed token hands
|
|
113
|
+
// back a new object, and reloading on it would throw away unsaved toggles.
|
|
114
|
+
const userRef = useRef(user);
|
|
115
|
+
userRef.current = user;
|
|
116
|
+
const uid = user == null ? void 0 : user.uid;
|
|
117
|
+
useEffect(()=>{
|
|
118
|
+
const user = userRef.current;
|
|
119
|
+
if (!uid || !user || !hostId) return;
|
|
120
|
+
let cancelled = false;
|
|
121
|
+
setState('loading');
|
|
122
|
+
void (async ()=>{
|
|
123
|
+
try {
|
|
124
|
+
const response = await authorizedFetch(user, `/api/commerce/payment-methods?hostId=${encodeURIComponent(hostId)}`);
|
|
125
|
+
if (cancelled) return;
|
|
126
|
+
if (response.status === 501) return void setState('unconfigured');
|
|
127
|
+
if (!response.ok) return void setState('error');
|
|
128
|
+
const payload = await response.json();
|
|
129
|
+
if (cancelled) return;
|
|
130
|
+
setView(payload);
|
|
131
|
+
setDraft({});
|
|
132
|
+
setState('loaded');
|
|
133
|
+
} catch (unused) {
|
|
134
|
+
if (!cancelled) setState('error');
|
|
135
|
+
}
|
|
136
|
+
})();
|
|
137
|
+
return ()=>{
|
|
138
|
+
cancelled = true;
|
|
139
|
+
};
|
|
140
|
+
}, [
|
|
141
|
+
uid,
|
|
142
|
+
hostId,
|
|
143
|
+
nonce
|
|
144
|
+
]);
|
|
145
|
+
const dirty = Object.keys(draft).length > 0;
|
|
146
|
+
const handleSave = useCallback(async ()=>{
|
|
147
|
+
if (!dirty) return;
|
|
148
|
+
setSaving(true);
|
|
149
|
+
try {
|
|
150
|
+
const response = await authorizedFetch(user, '/api/commerce/payment-methods', {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
headers: {
|
|
153
|
+
'Content-Type': 'application/json'
|
|
154
|
+
},
|
|
155
|
+
body: JSON.stringify({
|
|
156
|
+
hostId,
|
|
157
|
+
methods: draft
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
const payload = await response.json().catch(()=>({}));
|
|
161
|
+
if (!response.ok) {
|
|
162
|
+
var _ref;
|
|
163
|
+
return void enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Payment methods were not saved', {
|
|
164
|
+
variant: 'error',
|
|
165
|
+
allowDuplicate: true
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
setView(payload);
|
|
169
|
+
setDraft({});
|
|
170
|
+
enqueueSnackbar('Payment methods saved', {
|
|
171
|
+
variant: 'success',
|
|
172
|
+
persist: false
|
|
173
|
+
});
|
|
174
|
+
} catch (unused) {
|
|
175
|
+
enqueueSnackbar('Payment methods were not saved', {
|
|
176
|
+
variant: 'error',
|
|
177
|
+
allowDuplicate: true
|
|
178
|
+
});
|
|
179
|
+
} finally{
|
|
180
|
+
setSaving(false);
|
|
181
|
+
}
|
|
182
|
+
}, [
|
|
183
|
+
dirty,
|
|
184
|
+
draft,
|
|
185
|
+
enqueueSnackbar,
|
|
186
|
+
hostId,
|
|
187
|
+
user
|
|
188
|
+
]);
|
|
189
|
+
const handleFinish = useCallback(async ()=>{
|
|
190
|
+
setSaving(true);
|
|
191
|
+
try {
|
|
192
|
+
var _ref;
|
|
193
|
+
const response = await authorizedFetch(user, '/api/commerce/payment-methods', {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
headers: {
|
|
196
|
+
'Content-Type': 'application/json'
|
|
197
|
+
},
|
|
198
|
+
body: JSON.stringify({
|
|
199
|
+
hostId,
|
|
200
|
+
action: 'finish'
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
const payload = await response.json().catch(()=>({}));
|
|
204
|
+
if (response.ok && typeof (payload == null ? void 0 : payload.url) === 'string') {
|
|
205
|
+
return void window.location.assign(payload.url);
|
|
206
|
+
}
|
|
207
|
+
enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Stripe could not be opened', {
|
|
208
|
+
variant: 'error',
|
|
209
|
+
allowDuplicate: true
|
|
210
|
+
});
|
|
211
|
+
} catch (unused) {
|
|
212
|
+
enqueueSnackbar('Stripe could not be opened', {
|
|
213
|
+
variant: 'error',
|
|
214
|
+
allowDuplicate: true
|
|
215
|
+
});
|
|
216
|
+
} finally{
|
|
217
|
+
setSaving(false);
|
|
218
|
+
}
|
|
219
|
+
}, [
|
|
220
|
+
enqueueSnackbar,
|
|
221
|
+
hostId,
|
|
222
|
+
user
|
|
223
|
+
]);
|
|
224
|
+
const rows = view ? visibleMethods(view.methods) : [];
|
|
225
|
+
const canEdit = (view == null ? void 0 : view.canEdit) !== false;
|
|
226
|
+
const canFinish = (view == null ? void 0 : view.canFinish) !== false;
|
|
227
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
228
|
+
header: 'Payment methods',
|
|
229
|
+
help: pluginDocsHelp('commerce', {
|
|
230
|
+
anchor: '#payment-methods'
|
|
231
|
+
}),
|
|
232
|
+
HeaderProps: {
|
|
233
|
+
action: state === 'loaded' && canEdit ? /*#__PURE__*/ _jsx(Button, {
|
|
234
|
+
size: "small",
|
|
235
|
+
variant: "contained",
|
|
236
|
+
disabled: !dirty || saving,
|
|
237
|
+
onClick: handleSave,
|
|
238
|
+
children: saving ? 'Saving…' : 'Save'
|
|
239
|
+
}) : null
|
|
240
|
+
},
|
|
241
|
+
contentGutterX: true,
|
|
242
|
+
contentGutterY: true,
|
|
243
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
244
|
+
spacing: 1.5,
|
|
245
|
+
"data-testid": "payment-methods-card",
|
|
246
|
+
children: [
|
|
247
|
+
state === 'loading' ? /*#__PURE__*/ _jsx(Typography, {
|
|
248
|
+
variant: "body2",
|
|
249
|
+
color: "text.secondary",
|
|
250
|
+
children: 'Checking your payment methods…'
|
|
251
|
+
}) : null,
|
|
252
|
+
state === 'unconfigured' ? /*#__PURE__*/ _jsx(Alert, {
|
|
253
|
+
severity: "info",
|
|
254
|
+
children: 'Payments are not configured on this deployment.'
|
|
255
|
+
}) : null,
|
|
256
|
+
state === 'error' ? /*#__PURE__*/ _jsx(Alert, {
|
|
257
|
+
severity: "error",
|
|
258
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
259
|
+
color: "inherit",
|
|
260
|
+
size: "small",
|
|
261
|
+
onClick: ()=>setNonce((n)=>n + 1),
|
|
262
|
+
children: 'Retry'
|
|
263
|
+
}),
|
|
264
|
+
children: 'We couldn’t load your payment methods. Nothing has changed — ' + 'shoppers still see what they saw before.'
|
|
265
|
+
}) : null,
|
|
266
|
+
state === 'loaded' && view ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
267
|
+
children: [
|
|
268
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
269
|
+
variant: "body2",
|
|
270
|
+
color: "text.secondary",
|
|
271
|
+
children: 'Cards are always on. Turn off anything you don’t want to offer. ' + 'Stripe shows each method only on orders and to shoppers it suits, ' + 'using the limits below.'
|
|
272
|
+
}),
|
|
273
|
+
canEdit ? null : /*#__PURE__*/ _jsx(Alert, {
|
|
274
|
+
severity: "info",
|
|
275
|
+
children: 'Only a site admin can change which payment methods your store offers.'
|
|
276
|
+
}),
|
|
277
|
+
view.warnings.map((warning)=>/*#__PURE__*/ _jsx(Alert, {
|
|
278
|
+
severity: "warning",
|
|
279
|
+
children: warning
|
|
280
|
+
}, warning)),
|
|
281
|
+
rows.map(({ row, spec })=>{
|
|
282
|
+
var _draft_row_id;
|
|
283
|
+
const on = (_draft_row_id = draft[row.id]) != null ? _draft_row_id : row.on;
|
|
284
|
+
const verdict = capabilityVerdict(_extends({}, row, {
|
|
285
|
+
on
|
|
286
|
+
}), view.accountConnected);
|
|
287
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
288
|
+
spacing: 0.5,
|
|
289
|
+
"data-testid": `payment-method-${row.id}`,
|
|
290
|
+
children: [
|
|
291
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
292
|
+
direction: "row",
|
|
293
|
+
spacing: 1,
|
|
294
|
+
sx: {
|
|
295
|
+
alignItems: 'center'
|
|
296
|
+
},
|
|
297
|
+
children: [
|
|
298
|
+
/*#__PURE__*/ _jsx(Switch, {
|
|
299
|
+
checked: on,
|
|
300
|
+
disabled: !canEdit || saving,
|
|
301
|
+
onChange: (event)=>{
|
|
302
|
+
const next = event.target.checked;
|
|
303
|
+
setDraft((current)=>{
|
|
304
|
+
const copy = _extends({}, current);
|
|
305
|
+
if (next === row.on) delete copy[row.id];
|
|
306
|
+
else copy[row.id] = next;
|
|
307
|
+
return copy;
|
|
308
|
+
});
|
|
309
|
+
},
|
|
310
|
+
slotProps: {
|
|
311
|
+
input: {
|
|
312
|
+
'aria-label': spec.label
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}),
|
|
316
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
317
|
+
variant: "subtitle2",
|
|
318
|
+
sx: {
|
|
319
|
+
flex: 1
|
|
320
|
+
},
|
|
321
|
+
children: spec.label
|
|
322
|
+
}),
|
|
323
|
+
spec.capability && verdict ? /*#__PURE__*/ _jsx(Chip, {
|
|
324
|
+
size: "small",
|
|
325
|
+
variant: "outlined",
|
|
326
|
+
label: verdict.label,
|
|
327
|
+
color: verdict.color
|
|
328
|
+
}) : null,
|
|
329
|
+
on && row.capability === 'inactive' && canFinish ? /*#__PURE__*/ _jsx(Button, {
|
|
330
|
+
size: "small",
|
|
331
|
+
disabled: saving,
|
|
332
|
+
onClick: handleFinish,
|
|
333
|
+
children: 'Finish in Stripe'
|
|
334
|
+
}) : null
|
|
335
|
+
]
|
|
336
|
+
}),
|
|
337
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
338
|
+
variant: "body2",
|
|
339
|
+
color: "text.secondary",
|
|
340
|
+
children: spec.requirements
|
|
341
|
+
}),
|
|
342
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
343
|
+
variant: "caption",
|
|
344
|
+
color: "text.secondary",
|
|
345
|
+
children: spec.limits
|
|
346
|
+
})
|
|
347
|
+
]
|
|
348
|
+
}, row.id);
|
|
349
|
+
}),
|
|
350
|
+
/*#__PURE__*/ _jsx(Divider, {}),
|
|
351
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
352
|
+
variant: "subtitle2",
|
|
353
|
+
children: 'Wallet domains'
|
|
354
|
+
}),
|
|
355
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
356
|
+
variant: "body2",
|
|
357
|
+
color: "text.secondary",
|
|
358
|
+
children: 'Apple Pay shows only on a domain registered with Stripe. Your ' + 'site’s domains are registered for you when you connect them and ' + 'on the first in-page checkout.'
|
|
359
|
+
}),
|
|
360
|
+
view.domains.map((domain)=>{
|
|
361
|
+
const verdict = domainVerdict(domain);
|
|
362
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
363
|
+
direction: "row",
|
|
364
|
+
spacing: 1,
|
|
365
|
+
sx: {
|
|
366
|
+
alignItems: 'center'
|
|
367
|
+
},
|
|
368
|
+
"data-testid": `payment-domain-${domain.domain}`,
|
|
369
|
+
children: [
|
|
370
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
371
|
+
variant: "body2",
|
|
372
|
+
sx: {
|
|
373
|
+
flex: 1
|
|
374
|
+
},
|
|
375
|
+
children: domain.domain
|
|
376
|
+
}),
|
|
377
|
+
/*#__PURE__*/ _jsx(Chip, {
|
|
378
|
+
size: "small",
|
|
379
|
+
variant: "outlined",
|
|
380
|
+
label: verdict.label,
|
|
381
|
+
color: verdict.color
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
}, domain.domain);
|
|
385
|
+
})
|
|
386
|
+
]
|
|
387
|
+
}) : null
|
|
388
|
+
]
|
|
389
|
+
})
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
PaymentMethodsCard.displayName = 'PaymentMethodsCard';
|
|
393
|
+
export default PaymentMethodsCard;
|
|
394
|
+
|
|
395
|
+
//# sourceMappingURL=payment-methods-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/payment-methods-card.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport {\n Alert,\n Button,\n Chip,\n Divider,\n Stack,\n Switch,\n Typography,\n} from '@mui/material'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport {\n STOREFRONT_PAYMENT_METHODS,\n type StorefrontPaymentMethodId,\n type StorefrontPaymentMethodSettings,\n type StorefrontPaymentMethodSpec,\n} from '../../model/commerce-payment-methods'\n\nexport interface PaymentMethodsCardProps {\n hostId: string\n}\n\n/** One method as the route reports it (`server/payment-methods.ts`). */\nexport interface PaymentMethodRowView {\n id: StorefrontPaymentMethodId\n on: boolean\n platform: 'on' | 'unavailable' | null\n capability: 'active' | 'pending' | 'inactive' | 'unrequested' | null\n}\n\nexport interface PaymentMethodDomainView {\n domain: string\n enabled: boolean\n stripeId: string | null\n status: { applePay: string | null; googlePay: string | null }\n lastError: string | null\n}\n\nexport interface PaymentMethodsView {\n methods: PaymentMethodRowView[]\n domains: PaymentMethodDomainView[]\n accountConnected: boolean\n /** Absent from an older answer: read as allowed, and the route still judges. */\n canEdit?: boolean\n canFinish?: boolean\n warnings: string[]\n}\n\n/**\n * What a method's Stripe state means to the merchant, or null for nothing to\n * say. Only an ON method gets a verdict: an off one is the merchant's choice.\n */\nexport function capabilityVerdict(\n row: PaymentMethodRowView,\n accountConnected: boolean,\n): { label: string; color: 'success' | 'warning' | 'default' } | null {\n if (!row.on) return null\n if (!accountConnected) return { label: 'Connect Stripe first', color: 'default' }\n switch (row.capability) {\n case 'active':\n return { label: 'Ready', color: 'success' }\n case 'pending':\n return { label: 'Stripe is reviewing', color: 'warning' }\n case 'inactive':\n return { label: 'Stripe needs more details', color: 'warning' }\n case 'unrequested':\n return { label: 'Save to request', color: 'default' }\n default:\n return null\n }\n}\n\n/** The domain chip: what Apple Pay can do on this name right now. */\nexport function domainVerdict(domain: PaymentMethodDomainView): {\n label: string\n color: 'success' | 'warning' | 'default'\n} {\n if (domain.enabled && domain.status.applePay === 'active') {\n return { label: 'Apple Pay ready', color: 'success' }\n }\n if (domain.enabled) return { label: 'Registered', color: 'default' }\n if (domain.lastError) return { label: 'Retrying', color: 'warning' }\n return { label: 'Registers on first checkout', color: 'default' }\n}\n\n/**\n * The methods a merchant can see: everything the platform offers, and every\n * method we could not ask Stripe about except crypto, which is shown only once\n * the platform positively offers it (AGL-3629: hidden where unavailable).\n */\nexport function visibleMethods(\n rows: readonly PaymentMethodRowView[],\n): Array<{ row: PaymentMethodRowView; spec: StorefrontPaymentMethodSpec }> {\n return rows\n .map((row) => ({\n row,\n spec: STOREFRONT_PAYMENT_METHODS.find((method) => method.id === row.id),\n }))\n .filter(\n (entry): entry is { row: PaymentMethodRowView; spec: StorefrontPaymentMethodSpec } =>\n Boolean(entry.spec) &&\n entry.row.platform !== 'unavailable' &&\n !(entry.row.platform === null && entry.spec?.kind === 'crypto'),\n )\n}\n\n/**\n * Payment methods (AGL-3629): which wallets, buy-now-pay-later and crypto\n * options the storefront offers, what each needs, and whether Stripe is ready\n * for it. Cards are always on and are not listed.\n *\n * Read and saved through `/api/commerce/payment-methods` rather than a\n * Firestore listen, because two of the three facts per row — what the\n * platform offers and the payout account's capability — live at Stripe, and a\n * save is a Stripe request as well as a settings write.\n */\nexport function PaymentMethodsCard(props: PaymentMethodsCardProps) {\n const { hostId } = props\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const [view, setView] = useState<PaymentMethodsView | null>(null)\n const [state, setState] = useState<'loading' | 'loaded' | 'error' | 'unconfigured'>(\n 'loading',\n )\n const [draft, setDraft] = useState<StorefrontPaymentMethodSettings>({})\n const [saving, setSaving] = useState(false)\n const [nonce, setNonce] = useState(0)\n // The load keys on the uid, not the user object: a refreshed token hands\n // back a new object, and reloading on it would throw away unsaved toggles.\n const userRef = useRef(user)\n userRef.current = user\n const uid = user?.uid\n\n useEffect(() => {\n const user = userRef.current\n if (!uid || !user || !hostId) return\n let cancelled = false\n setState('loading')\n void (async () => {\n try {\n const response = await authorizedFetch(\n user,\n `/api/commerce/payment-methods?hostId=${encodeURIComponent(hostId)}`,\n )\n if (cancelled) return\n if (response.status === 501) return void setState('unconfigured')\n if (!response.ok) return void setState('error')\n const payload = (await response.json()) as PaymentMethodsView\n if (cancelled) return\n setView(payload)\n setDraft({})\n setState('loaded')\n } catch {\n if (!cancelled) setState('error')\n }\n })()\n return () => {\n cancelled = true\n }\n }, [uid, hostId, nonce])\n\n const dirty = Object.keys(draft).length > 0\n\n const handleSave = useCallback(async () => {\n if (!dirty) return\n setSaving(true)\n try {\n const response = await authorizedFetch(user, '/api/commerce/payment-methods', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, methods: draft }),\n })\n const payload = await response.json().catch(() => ({}))\n if (!response.ok) {\n return void enqueueSnackbar(payload?.error ?? 'Payment methods were not saved', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n setView(payload as PaymentMethodsView)\n setDraft({})\n enqueueSnackbar('Payment methods saved', { variant: 'success', persist: false })\n } catch {\n enqueueSnackbar('Payment methods were not saved', {\n variant: 'error',\n allowDuplicate: true,\n })\n } finally {\n setSaving(false)\n }\n }, [dirty, draft, enqueueSnackbar, hostId, user])\n\n const handleFinish = useCallback(async () => {\n setSaving(true)\n try {\n const response = await authorizedFetch(user, '/api/commerce/payment-methods', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, action: 'finish' }),\n })\n const payload = await response.json().catch(() => ({}))\n if (response.ok && typeof payload?.url === 'string') {\n return void window.location.assign(payload.url)\n }\n enqueueSnackbar(payload?.error ?? 'Stripe could not be opened', {\n variant: 'error',\n allowDuplicate: true,\n })\n } catch {\n enqueueSnackbar('Stripe could not be opened', { variant: 'error', allowDuplicate: true })\n } finally {\n setSaving(false)\n }\n }, [enqueueSnackbar, hostId, user])\n\n const rows = view ? visibleMethods(view.methods) : []\n const canEdit = view?.canEdit !== false\n const canFinish = view?.canFinish !== false\n\n return (\n <CardDisplay\n header={'Payment methods'}\n help={pluginDocsHelp('commerce', { anchor: '#payment-methods' })}\n HeaderProps={{\n action:\n state === 'loaded' && canEdit ? (\n <Button\n size=\"small\"\n variant=\"contained\"\n disabled={!dirty || saving}\n onClick={handleSave}\n >\n {saving ? 'Saving…' : 'Save'}\n </Button>\n ) : null,\n }}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5} data-testid=\"payment-methods-card\">\n {state === 'loading' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Checking your payment methods…'}\n </Typography>\n ) : null}\n {state === 'unconfigured' ? (\n <Alert severity=\"info\">{'Payments are not configured on this deployment.'}</Alert>\n ) : null}\n {state === 'error' ? (\n <Alert\n severity=\"error\"\n action={\n <Button color=\"inherit\" size=\"small\" onClick={() => setNonce((n) => n + 1)}>\n {'Retry'}\n </Button>\n }\n >\n {'We couldn’t load your payment methods. Nothing has changed — ' +\n 'shoppers still see what they saw before.'}\n </Alert>\n ) : null}\n {state === 'loaded' && view ? (\n <>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Cards are always on. Turn off anything you don’t want to offer. ' +\n 'Stripe shows each method only on orders and to shoppers it suits, ' +\n 'using the limits below.'}\n </Typography>\n {canEdit ? null : (\n <Alert severity=\"info\">\n {'Only a site admin can change which payment methods your store offers.'}\n </Alert>\n )}\n {view.warnings.map((warning) => (\n <Alert key={warning} severity=\"warning\">\n {warning}\n </Alert>\n ))}\n {rows.map(({ row, spec }) => {\n const on = draft[row.id] ?? row.on\n const verdict = capabilityVerdict({ ...row, on }, view.accountConnected)\n return (\n <Stack key={row.id} spacing={0.5} data-testid={`payment-method-${row.id}`}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Switch\n checked={on}\n disabled={!canEdit || saving}\n onChange={(event) => {\n const next = event.target.checked\n setDraft((current) => {\n const copy = { ...current }\n if (next === row.on) delete copy[row.id]\n else copy[row.id] = next\n return copy\n })\n }}\n slotProps={{ input: { 'aria-label': spec.label } }}\n />\n <Typography variant=\"subtitle2\" sx={{ flex: 1 }}>\n {spec.label}\n </Typography>\n {spec.capability && verdict ? (\n <Chip size=\"small\" variant=\"outlined\" label={verdict.label} color={verdict.color} />\n ) : null}\n {on && row.capability === 'inactive' && canFinish ? (\n <Button size=\"small\" disabled={saving} onClick={handleFinish}>\n {'Finish in Stripe'}\n </Button>\n ) : null}\n </Stack>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {spec.requirements}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {spec.limits}\n </Typography>\n </Stack>\n )\n })}\n <Divider />\n <Typography variant=\"subtitle2\">{'Wallet domains'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Apple Pay shows only on a domain registered with Stripe. Your ' +\n 'site’s domains are registered for you when you connect them and ' +\n 'on the first in-page checkout.'}\n </Typography>\n {view.domains.map((domain) => {\n const verdict = domainVerdict(domain)\n return (\n <Stack\n key={domain.domain}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n data-testid={`payment-domain-${domain.domain}`}\n >\n <Typography variant=\"body2\" sx={{ flex: 1 }}>\n {domain.domain}\n </Typography>\n <Chip size=\"small\" variant=\"outlined\" label={verdict.label} color={verdict.color} />\n </Stack>\n )\n })}\n </>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nPaymentMethodsCard.displayName = 'PaymentMethodsCard'\n\nexport default PaymentMethodsCard\n"],"names":["pluginDocsHelp","CardDisplay","useSnackbar","authorizedFetch","useUser","Alert","Button","Chip","Divider","Stack","Switch","Typography","useCallback","useEffect","useRef","useState","STOREFRONT_PAYMENT_METHODS","capabilityVerdict","row","accountConnected","on","label","color","capability","domainVerdict","domain","enabled","status","applePay","lastError","visibleMethods","rows","map","spec","find","method","id","filter","entry","Boolean","platform","kind","PaymentMethodsCard","props","hostId","data","user","enqueueSnackbar","view","setView","state","setState","draft","setDraft","saving","setSaving","nonce","setNonce","userRef","current","uid","cancelled","response","encodeURIComponent","ok","payload","json","dirty","Object","keys","length","handleSave","headers","body","JSON","stringify","methods","catch","error","variant","allowDuplicate","persist","handleFinish","action","url","window","location","assign","canEdit","canFinish","header","help","anchor","HeaderProps","size","disabled","onClick","contentGutterX","contentGutterY","spacing","data-testid","severity","n","warnings","warning","verdict","direction","sx","alignItems","checked","onChange","event","next","target","copy","slotProps","input","flex","requirements","limits","domains","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,cAAc,QAAQ,eAAc;AAC7C,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,eAAe,QAAQ,2CAA0C;AAC1E,SAASC,OAAO,QAAQ,iCAAgC;AACxD,SACEC,KAAK,EACLC,MAAM,EACNC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,MAAM,EACNC,UAAU,QACL,gBAAe;AACtB,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAChE,SACEC,0BAA0B,QAIrB,0CAAsC;AAgC7C;;;CAGC,GACD,OAAO,SAASC,kBACdC,GAAyB,EACzBC,gB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d;0DAC7C;iDAED;;;kDAEN,KAACvE;wCAAWoE,SAAQ;wCAAQzD,OAAM;kDAC/BW,KAAKqF,YAAY;;kDAEpB,KAAC3G;wCAAWoE,SAAQ;wCAAUzD,OAAM;kDACjCW,KAAKsF,MAAM;;;+BAhCJrG,IAAIkB,EAAE;wBAoCtB;sCACA,KAAC5B;sCACD,KAACG;4BAAWoE,SAAQ;sCAAa;;sCACjC,KAACpE;4BAAWoE,SAAQ;4BAAQzD,OAAM;sCAC/B,mEACC,qEACA;;wBAEH0B,KAAKwE,OAAO,CAACxF,GAAG,CAAC,CAACP;4BACjB,MAAMgF,UAAUjF,cAAcC;4BAC9B,qBACE,MAAChB;gCAECiG,WAAU;gCACVP,SAAS;gCACTQ,IAAI;oCAAEC,YAAY;gCAAS;gCAC3BR,eAAa,CAAC,eAAe,EAAE3E,OAAOA,MAAM,EAAE;;kDAE9C,KAACd;wCAAWoE,SAAQ;wCAAQ4B,IAAI;4CAAEU,MAAM;wCAAE;kDACvC5F,OAAOA,MAAM;;kDAEhB,KAAClB;wCAAKuF,MAAK;wCAAQf,SAAQ;wCAAW1D,OAAOoF,QAAQpF,KAAK;wCAAEC,OAAOmF,QAAQnF,KAAK;;;+BAT3EG,OAAOA,MAAM;wBAYxB;;qBAEA;;;;AAIZ;AACAiB,mBAAmB+E,WAAW,GAAG;AAEjC,eAAe/E,mBAAkB"}
|
|
@@ -0,0 +1,124 @@
|
|
|
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 { authorizedFetch } from '@aglyn/shared-util-http/authorized-token';
|
|
18
|
+
import type * as CommerceModel from '../../../model';
|
|
19
|
+
import type { PosRegisterSettings } from '../../../plugin-config';
|
|
20
|
+
/**
|
|
21
|
+
* The register's client half (AGL-3607): one place that knows the routes, so
|
|
22
|
+
* the components ask "take cash" rather than building requests. Every call
|
|
23
|
+
* that starts a payment carries the attempt key it is given; the server
|
|
24
|
+
* derives the payment from it, so a retried press finds the same payment.
|
|
25
|
+
*/
|
|
26
|
+
/** The open sale as the server reports it after every change. */
|
|
27
|
+
export interface PosSaleSummary {
|
|
28
|
+
orderId: string;
|
|
29
|
+
status: string;
|
|
30
|
+
totalCents: number;
|
|
31
|
+
paidCents: number;
|
|
32
|
+
dueCents: number;
|
|
33
|
+
tenderableCents: number;
|
|
34
|
+
tipCents: number;
|
|
35
|
+
payments: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
method: CommerceModel.OrderPaymentMethod;
|
|
38
|
+
amountCents: number;
|
|
39
|
+
tipCents?: number;
|
|
40
|
+
status: CommerceModel.OrderPaymentStatus;
|
|
41
|
+
cardBrand?: string;
|
|
42
|
+
last4?: string;
|
|
43
|
+
changeCents?: number;
|
|
44
|
+
checkoutUrl?: string;
|
|
45
|
+
readerId?: string;
|
|
46
|
+
failureMessage?: string;
|
|
47
|
+
livemode?: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
export interface PosTenderResult {
|
|
51
|
+
sale: PosSaleSummary;
|
|
52
|
+
paymentId?: string;
|
|
53
|
+
completed: boolean;
|
|
54
|
+
clientSecret?: string;
|
|
55
|
+
paymentIntentId?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface PosRegisterContext {
|
|
58
|
+
settings: PosRegisterSettings;
|
|
59
|
+
terminal: {
|
|
60
|
+
available: boolean;
|
|
61
|
+
testMode: boolean;
|
|
62
|
+
};
|
|
63
|
+
readers: Array<{
|
|
64
|
+
id: string;
|
|
65
|
+
label: string;
|
|
66
|
+
registerId: string | null;
|
|
67
|
+
status: string;
|
|
68
|
+
livemode: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
publishableKey: string;
|
|
71
|
+
smsReceipts: boolean;
|
|
72
|
+
}
|
|
73
|
+
type User = Parameters<typeof authorizedFetch>[0];
|
|
74
|
+
export declare class PosRequestError extends Error {
|
|
75
|
+
readonly status: number;
|
|
76
|
+
constructor(message: string, status: number);
|
|
77
|
+
}
|
|
78
|
+
/** A fresh attempt key, for one press of one tender. */
|
|
79
|
+
export declare function newAttemptKey(): string;
|
|
80
|
+
export declare function posRegisterContext(user: User, hostId: string): Promise<PosRegisterContext>;
|
|
81
|
+
/** Prices the basket on the server and opens a sale with an empty ledger. */
|
|
82
|
+
export declare function openPosSale(user: User, attemptKey: string, body: {
|
|
83
|
+
hostId: string;
|
|
84
|
+
registerId: string;
|
|
85
|
+
lines: unknown[];
|
|
86
|
+
discountPct: number;
|
|
87
|
+
customerEmail?: string;
|
|
88
|
+
/** The person the register's customer lookup attached (AGL-3609). */
|
|
89
|
+
customer?: unknown;
|
|
90
|
+
/** A PIN-switched cashier's signed assertion (AGL-3609). */
|
|
91
|
+
cashierAssertion?: string;
|
|
92
|
+
locationId?: string;
|
|
93
|
+
}): Promise<{
|
|
94
|
+
orderId: string;
|
|
95
|
+
totals: CommerceModel.OrderTotals;
|
|
96
|
+
dueCents: number;
|
|
97
|
+
stockWarnings?: unknown[];
|
|
98
|
+
}>;
|
|
99
|
+
export type PosTenderAction = 'cash' | 'gift-card' | 'folio' | 'card-present' | 'card-present-sdk' | 'card-keyed' | 'card-link' | 'status' | 'cancel' | 'retry' | 'simulate' | 'void' | 'receipt';
|
|
100
|
+
export declare function posTender(user: User, hostId: string, orderId: string, action: PosTenderAction, body?: Record<string, unknown>, attemptKey?: string): Promise<PosTenderResult>;
|
|
101
|
+
export declare function posGiftCardBalance(user: User, hostId: string, code: string): Promise<{
|
|
102
|
+
availableCents: number;
|
|
103
|
+
frozen: boolean;
|
|
104
|
+
voided: boolean;
|
|
105
|
+
last4: string;
|
|
106
|
+
}>;
|
|
107
|
+
export declare function posDisplayCall<T = any>(user: User, body: Record<string, unknown>, method?: 'GET' | 'POST'): Promise<T>;
|
|
108
|
+
export declare function posReadersCall<T = any>(user: User, body: Record<string, unknown>): Promise<T>;
|
|
109
|
+
/** Cents as the register shows them. */
|
|
110
|
+
export declare const usd: (cents: number) => string;
|
|
111
|
+
/** A dollar string the cashier typed, as whole cents (NaN-safe, never negative). */
|
|
112
|
+
export declare function centsFromInput(value: string): number;
|
|
113
|
+
export interface AglynPosBridge {
|
|
114
|
+
collectCardPayment(input: {
|
|
115
|
+
paymentIntentId: string;
|
|
116
|
+
clientSecret: string;
|
|
117
|
+
amountCents: number;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
status: 'collected' | 'canceled' | 'failed';
|
|
120
|
+
message?: string;
|
|
121
|
+
}>;
|
|
122
|
+
}
|
|
123
|
+
export declare function posNativeBridge(): AglynPosBridge | null;
|
|
124
|
+
export {};
|