@aglyn/plugins-commerce 1.0.0-beta.285 → 1.0.0-beta.288
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/README.md +1 -1
- package/package.json +13 -13
- package/src/lib/components/cart.js +25 -12
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/commerce-console-page.js +70 -13
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/console/order-detail-dialog.component.js +2 -1
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/order-webhooks-card.component.js +1 -1
- package/src/lib/components/console/order-webhooks-card.component.js.map +1 -1
- package/src/lib/components/console/payment-methods-card.component.js +1 -1
- package/src/lib/components/console/payment-methods-card.component.js.map +1 -1
- package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +5 -0
- package/src/lib/components/console/pos/pos-cart-panel.component.js +18 -12
- package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -1
- package/src/lib/components/console/pos/pos-hardware-api.d.ts +76 -5
- package/src/lib/components/console/pos/pos-hardware-api.js +53 -11
- package/src/lib/components/console/pos/pos-hardware-api.js.map +1 -1
- package/src/lib/components/console/pos/pos-hardware-buyer.component.d.ts +18 -0
- package/src/lib/components/console/pos/pos-hardware-buyer.component.js +629 -0
- package/src/lib/components/console/pos/pos-hardware-buyer.component.js.map +1 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.d.ts +162 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.js +122 -0
- package/src/lib/components/console/pos/pos-hardware-sale-api.js.map +1 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.d.ts +39 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js +251 -0
- package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js.map +1 -0
- package/src/lib/components/console/pos/use-pos-display.js +50 -0
- package/src/lib/components/console/pos/use-pos-display.js.map +1 -1
- package/src/lib/components/console/pos-cellular-control.component.d.ts +41 -0
- package/src/lib/components/console/pos-cellular-control.component.js +211 -0
- package/src/lib/components/console/pos-cellular-control.component.js.map +1 -0
- package/src/lib/components/console/pos-devices-card.component.d.ts +9 -1
- package/src/lib/components/console/pos-devices-card.component.js +47 -15
- package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
- package/src/lib/components/console/pos-display/pos-display-api.d.ts +6 -0
- package/src/lib/components/console/pos-display/pos-display-api.js +8 -1
- package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -1
- package/src/lib/components/console/pos-display-page.component.d.ts +13 -0
- package/src/lib/components/console/pos-display-page.component.js +44 -2
- package/src/lib/components/console/pos-display-page.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-card.component.d.ts +12 -4
- package/src/lib/components/console/pos-hardware-card.component.js +157 -36
- package/src/lib/components/console/pos-hardware-card.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-orders-staff-page.component.js +360 -80
- package/src/lib/components/console/pos-hardware-orders-staff-page.component.js.map +1 -1
- package/src/lib/components/console/pos-hardware-terms-page.component.d.ts +34 -0
- package/src/lib/components/console/pos-hardware-terms-page.component.js +257 -0
- package/src/lib/components/console/pos-hardware-terms-page.component.js.map +1 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.d.ts +27 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.js +104 -0
- package/src/lib/components/console/pos-hardware-terms-sign-page.component.js.map +1 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.d.ts +24 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.js +205 -0
- package/src/lib/components/console/pos-hardware-waiting-card.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js +297 -201
- package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.d.ts +3 -0
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +260 -92
- package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +9 -0
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +15 -6
- package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -1
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.d.ts +25 -0
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js +136 -0
- package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js.map +1 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +6 -0
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +48 -31
- package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -1
- package/src/lib/components/console/pos-page.component.d.ts +1 -1
- package/src/lib/components/console/pos-page.component.js +63 -12
- package/src/lib/components/console/pos-page.component.js.map +1 -1
- package/src/lib/components/console/pos-reader-splash-setting.component.js +1 -1
- package/src/lib/components/console/pos-reader-splash-setting.component.js.map +1 -1
- package/src/lib/components/console/product-check-in-fields.component.d.ts +4 -2
- package/src/lib/components/console/product-check-in-fields.component.js +60 -14
- package/src/lib/components/console/product-check-in-fields.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +44 -1
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-hardware-sku-field.component.d.ts +19 -0
- package/src/lib/components/console/product-hardware-sku-field.component.js +92 -0
- package/src/lib/components/console/product-hardware-sku-field.component.js.map +1 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.d.ts +22 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.js +94 -0
- package/src/lib/components/console/product-kiosk-offer-field.component.js.map +1 -0
- package/src/lib/components/console/product-register-fields.component.d.ts +4 -0
- package/src/lib/components/console/product-register-fields.component.js +31 -2
- package/src/lib/components/console/product-register-fields.component.js.map +1 -1
- package/src/lib/components/console/products-hub-card.component.js +11 -2
- package/src/lib/components/console/products-hub-card.component.js.map +1 -1
- package/src/lib/components/console/register-hardware-card.component.d.ts +11 -0
- package/src/lib/components/console/register-hardware-card.component.js +56 -27
- package/src/lib/components/console/register-hardware-card.component.js.map +1 -1
- package/src/lib/components/console/reservation-guests-dialog.component.d.ts +28 -0
- package/src/lib/components/console/reservation-guests-dialog.component.js +189 -0
- package/src/lib/components/console/reservation-guests-dialog.component.js.map +1 -0
- package/src/lib/components/console/reservations-card.component.d.ts +9 -0
- package/src/lib/components/console/reservations-card.component.js +158 -23
- package/src/lib/components/console/reservations-card.component.js.map +1 -1
- package/src/lib/components/console/shippingeasy-card.component.js +1 -1
- package/src/lib/components/console/shippingeasy-card.component.js.map +1 -1
- package/src/lib/components/console/shipstation-card.component.d.ts +1 -1
- package/src/lib/components/console/shipstation-card.component.js +3 -3
- package/src/lib/components/console/shipstation-card.component.js.map +1 -1
- package/src/lib/components/product-detail.d.ts +4 -0
- package/src/lib/components/product-detail.js +40 -5
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/product-reviews.js +28 -11
- package/src/lib/components/product-reviews.js.map +1 -1
- package/src/lib/components/reservation-widget.js +28 -5
- package/src/lib/components/reservation-widget.js.map +1 -1
- package/src/lib/components/use-day-picker.d.ts +25 -0
- package/src/lib/components/use-day-picker.js +57 -0
- package/src/lib/components/use-day-picker.js.map +1 -0
- package/src/lib/constants/operator-alerts.d.ts +55 -0
- package/src/lib/constants/operator-alerts.js +156 -1
- package/src/lib/constants/operator-alerts.js.map +1 -1
- package/src/lib/declarations.console-server.js +54 -1
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.d.ts +4 -2
- package/src/lib/declarations.js +15 -4
- package/src/lib/declarations.js.map +1 -1
- package/src/lib/declarations.server.js +9 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/commerce-cart.d.ts +9 -1
- package/src/lib/model/commerce-cart.js +4 -3
- package/src/lib/model/commerce-cart.js.map +1 -1
- package/src/lib/model/commerce-check-in-product.d.ts +26 -0
- package/src/lib/model/commerce-check-in-product.js +64 -2
- package/src/lib/model/commerce-check-in-product.js.map +1 -1
- package/src/lib/model/commerce-check-in-record.d.ts +127 -0
- package/src/lib/model/commerce-check-in-record.js +36 -0
- package/src/lib/model/commerce-check-in-record.js.map +1 -0
- package/src/lib/model/commerce-check-in.d.ts +91 -87
- package/src/lib/model/commerce-check-in.js +186 -62
- package/src/lib/model/commerce-check-in.js.map +1 -1
- package/src/lib/model/commerce-kiosk-offer.d.ts +31 -0
- package/src/lib/model/commerce-kiosk-offer.js +35 -0
- package/src/lib/model/commerce-kiosk-offer.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +76 -0
- package/src/lib/model/commerce-orders.js +6 -0
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-pos-day-report.d.ts +54 -1
- package/src/lib/model/commerce-pos-day-report.js +39 -2
- package/src/lib/model/commerce-pos-day-report.js.map +1 -1
- package/src/lib/model/commerce-pos-offline.d.ts +1 -1
- package/src/lib/model/commerce-pos-offline.js +6 -1
- package/src/lib/model/commerce-pos-offline.js.map +1 -1
- package/src/lib/model/commerce-pos-ops.js +3 -2
- package/src/lib/model/commerce-pos-ops.js.map +1 -1
- package/src/lib/model/commerce-pos.d.ts +36 -3
- package/src/lib/model/commerce-pos.js +14 -6
- package/src/lib/model/commerce-pos.js.map +1 -1
- package/src/lib/model/commerce-receipt.js +3 -2
- package/src/lib/model/commerce-receipt.js.map +1 -1
- package/src/lib/model/commerce-reservations.d.ts +69 -4
- package/src/lib/model/commerce-reservations.js +57 -5
- package/src/lib/model/commerce-reservations.js.map +1 -1
- package/src/lib/model/commerce.d.ts +66 -0
- package/src/lib/model/commerce.js +15 -0
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/order-list-fields.d.ts +11 -0
- package/src/lib/model/order-list-fields.js +17 -1
- package/src/lib/model/order-list-fields.js.map +1 -1
- package/src/lib/model/own-store-tax-summary.d.ts +152 -0
- package/src/lib/model/own-store-tax-summary.js +288 -0
- package/src/lib/model/own-store-tax-summary.js.map +1 -0
- package/src/lib/model/plugin-permissions.d.ts +74 -0
- package/src/lib/model/plugin-permissions.js +224 -7
- package/src/lib/model/plugin-permissions.js.map +1 -1
- package/src/lib/model/pos-cellular.d.ts +223 -0
- package/src/lib/model/pos-cellular.js +293 -0
- package/src/lib/model/pos-cellular.js.map +1 -0
- package/src/lib/model/pos-hardware-in-person.d.ts +98 -0
- package/src/lib/model/pos-hardware-in-person.js +224 -0
- package/src/lib/model/pos-hardware-in-person.js.map +1 -0
- package/src/lib/model/pos-hardware-tax-summary.d.ts +166 -0
- package/src/lib/model/pos-hardware-tax-summary.js +225 -0
- package/src/lib/model/pos-hardware-tax-summary.js.map +1 -0
- package/src/lib/model/pos-hardware-terms.d.ts +74 -0
- package/src/lib/model/pos-hardware-terms.js +115 -0
- package/src/lib/model/pos-hardware-terms.js.map +1 -0
- package/src/lib/model/pos-hardware.d.ts +349 -7
- package/src/lib/model/pos-hardware.js +291 -20
- package/src/lib/model/pos-hardware.js.map +1 -1
- package/src/lib/model/product-write.d.ts +10 -0
- package/src/lib/model/product-write.js +4 -2
- package/src/lib/model/product-write.js.map +1 -1
- package/src/lib/model/workspace-site-permissions.d.ts +26 -0
- package/src/lib/model/workspace-site-permissions.js +81 -0
- package/src/lib/model/workspace-site-permissions.js.map +1 -0
- package/src/lib/plugin.js +16 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/billing-webhook.js +25 -1
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +7 -5
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/cart-checkout.js +20 -8
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/cart.js +29 -0
- package/src/lib/server/cart.js.map +1 -1
- package/src/lib/server/checkout.js +42 -13
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/collection-membership.d.ts +4 -0
- package/src/lib/server/collection-membership.js +5 -10
- package/src/lib/server/collection-membership.js.map +1 -1
- package/src/lib/server/commerce-site-keys.d.ts +48 -0
- package/src/lib/server/commerce-site-keys.js +61 -0
- package/src/lib/server/commerce-site-keys.js.map +1 -0
- package/src/lib/server/draft-order.js +8 -5
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/fulfill-order.js +7 -5
- package/src/lib/server/fulfill-order.js.map +1 -1
- package/src/lib/server/gift-cards.js +8 -5
- package/src/lib/server/gift-cards.js.map +1 -1
- package/src/lib/server/local-fulfillment-status.js +9 -6
- package/src/lib/server/local-fulfillment-status.js.map +1 -1
- package/src/lib/server/member-post.js +6 -5
- package/src/lib/server/member-post.js.map +1 -1
- package/src/lib/server/membership-admin-password.d.ts +4 -2
- package/src/lib/server/membership-admin-password.js +10 -8
- package/src/lib/server/membership-admin-password.js.map +1 -1
- package/src/lib/server/membership-admin-remove.d.ts +7 -5
- package/src/lib/server/membership-admin-remove.js +9 -9
- package/src/lib/server/membership-admin-remove.js.map +1 -1
- package/src/lib/server/order-notifications.js +5 -2
- package/src/lib/server/order-notifications.js.map +1 -1
- package/src/lib/server/order-print.js +7 -5
- package/src/lib/server/order-print.js.map +1 -1
- package/src/lib/server/order-receipt-send.js +8 -5
- package/src/lib/server/order-receipt-send.js.map +1 -1
- package/src/lib/server/order-webhooks.js +8 -8
- package/src/lib/server/order-webhooks.js.map +1 -1
- package/src/lib/server/orders-shipping-prepare.js +9 -6
- package/src/lib/server/orders-shipping-prepare.js.map +1 -1
- package/src/lib/server/own-store-tax-return-source.d.ts +47 -0
- package/src/lib/server/own-store-tax-return-source.js +312 -0
- package/src/lib/server/own-store-tax-return-source.js.map +1 -0
- package/src/lib/server/payment-methods.js +13 -9
- package/src/lib/server/payment-methods.js.map +1 -1
- package/src/lib/server/pos-auth.d.ts +37 -6
- package/src/lib/server/pos-auth.js +40 -15
- package/src/lib/server/pos-auth.js.map +1 -1
- package/src/lib/server/pos-cellular-billing.d.ts +81 -0
- package/src/lib/server/pos-cellular-billing.js +711 -0
- package/src/lib/server/pos-cellular-billing.js.map +1 -0
- package/src/lib/server/pos-cellular-notify.d.ts +47 -0
- package/src/lib/server/pos-cellular-notify.js +150 -0
- package/src/lib/server/pos-cellular-notify.js.map +1 -0
- package/src/lib/server/pos-cellular.d.ts +88 -0
- package/src/lib/server/pos-cellular.js +339 -0
- package/src/lib/server/pos-cellular.js.map +1 -0
- package/src/lib/server/pos-check-in.d.ts +5 -1
- package/src/lib/server/pos-check-in.js +296 -28
- package/src/lib/server/pos-check-in.js.map +1 -1
- package/src/lib/server/pos-day-report.js +29 -3
- package/src/lib/server/pos-day-report.js.map +1 -1
- package/src/lib/server/pos-display.d.ts +16 -0
- package/src/lib/server/pos-display.js +129 -2
- package/src/lib/server/pos-display.js.map +1 -1
- package/src/lib/server/pos-hardware-admin.d.ts +10 -1
- package/src/lib/server/pos-hardware-admin.js +250 -84
- package/src/lib/server/pos-hardware-admin.js.map +1 -1
- package/src/lib/server/pos-hardware-attach.d.ts +105 -0
- package/src/lib/server/pos-hardware-attach.js +443 -0
- package/src/lib/server/pos-hardware-attach.js.map +1 -0
- package/src/lib/server/pos-hardware-buyer-lookup.d.ts +58 -0
- package/src/lib/server/pos-hardware-buyer-lookup.js +180 -0
- package/src/lib/server/pos-hardware-buyer-lookup.js.map +1 -0
- package/src/lib/server/pos-hardware-buyer-record.d.ts +29 -0
- package/src/lib/server/pos-hardware-buyer-record.js +86 -0
- package/src/lib/server/pos-hardware-buyer-record.js.map +1 -0
- package/src/lib/server/pos-hardware-cancel.d.ts +58 -0
- package/src/lib/server/pos-hardware-cancel.js +147 -0
- package/src/lib/server/pos-hardware-cancel.js.map +1 -0
- package/src/lib/server/pos-hardware-closure-notices.d.ts +27 -0
- package/src/lib/server/pos-hardware-closure-notices.js +85 -0
- package/src/lib/server/pos-hardware-closure-notices.js.map +1 -0
- package/src/lib/server/pos-hardware-closure.d.ts +60 -0
- package/src/lib/server/pos-hardware-closure.js +153 -0
- package/src/lib/server/pos-hardware-closure.js.map +1 -0
- package/src/lib/server/pos-hardware-in-person.d.ts +61 -0
- package/src/lib/server/pos-hardware-in-person.js +236 -0
- package/src/lib/server/pos-hardware-in-person.js.map +1 -0
- package/src/lib/server/pos-hardware-notify.d.ts +40 -2
- package/src/lib/server/pos-hardware-notify.js +195 -14
- package/src/lib/server/pos-hardware-notify.js.map +1 -1
- package/src/lib/server/pos-hardware-readers.d.ts +115 -0
- package/src/lib/server/pos-hardware-readers.js +430 -0
- package/src/lib/server/pos-hardware-readers.js.map +1 -0
- package/src/lib/server/pos-hardware-returns.d.ts +116 -0
- package/src/lib/server/pos-hardware-returns.js +502 -0
- package/src/lib/server/pos-hardware-returns.js.map +1 -0
- package/src/lib/server/pos-hardware-sale-fields.d.ts +28 -0
- package/src/lib/server/pos-hardware-sale-fields.js +44 -0
- package/src/lib/server/pos-hardware-sale-fields.js.map +1 -0
- package/src/lib/server/pos-hardware-sale.d.ts +54 -0
- package/src/lib/server/pos-hardware-sale.js +369 -0
- package/src/lib/server/pos-hardware-sale.js.map +1 -0
- package/src/lib/server/pos-hardware-tax-return-source.d.ts +99 -0
- package/src/lib/server/pos-hardware-tax-return-source.js +462 -0
- package/src/lib/server/pos-hardware-tax-return-source.js.map +1 -0
- package/src/lib/server/pos-hardware-terms.d.ts +64 -0
- package/src/lib/server/pos-hardware-terms.js +154 -0
- package/src/lib/server/pos-hardware-terms.js.map +1 -0
- package/src/lib/server/pos-hardware-user-eraser.d.ts +3 -0
- package/src/lib/server/pos-hardware-user-eraser.js +31 -7
- package/src/lib/server/pos-hardware-user-eraser.js.map +1 -1
- package/src/lib/server/pos-hardware-webhook.d.ts +5 -0
- package/src/lib/server/pos-hardware-webhook.js +51 -6
- package/src/lib/server/pos-hardware-webhook.js.map +1 -1
- package/src/lib/server/pos-hardware.d.ts +74 -1
- package/src/lib/server/pos-hardware.js +175 -10
- package/src/lib/server/pos-hardware.js.map +1 -1
- package/src/lib/server/pos-kiosk.d.ts +2 -0
- package/src/lib/server/pos-kiosk.js +17 -12
- package/src/lib/server/pos-kiosk.js.map +1 -1
- package/src/lib/server/pos-offline-card-order.d.ts +64 -0
- package/src/lib/server/pos-offline-card-order.js +102 -0
- package/src/lib/server/pos-offline-card-order.js.map +1 -0
- package/src/lib/server/pos-offline-card-reconcile.d.ts +67 -1
- package/src/lib/server/pos-offline-card-reconcile.js +215 -18
- package/src/lib/server/pos-offline-card-reconcile.js.map +1 -1
- package/src/lib/server/pos-offline-sync.d.ts +39 -0
- package/src/lib/server/pos-offline-sync.js +190 -55
- package/src/lib/server/pos-offline-sync.js.map +1 -1
- package/src/lib/server/pos-ops-gate.d.ts +28 -9
- package/src/lib/server/pos-ops-gate.js +50 -19
- package/src/lib/server/pos-ops-gate.js.map +1 -1
- package/src/lib/server/pos-ops-routes.js +24 -0
- package/src/lib/server/pos-ops-routes.js.map +1 -1
- package/src/lib/server/pos-order-refund-ids.d.ts +28 -0
- package/src/lib/server/pos-order-refund-ids.js +31 -0
- package/src/lib/server/pos-order-refund-ids.js.map +1 -0
- package/src/lib/server/pos-order.js +52 -49
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-payment.js +1 -1
- package/src/lib/server/pos-payment.js.map +1 -1
- package/src/lib/server/pos-reader-splash-admin.js +30 -32
- package/src/lib/server/pos-reader-splash-admin.js.map +1 -1
- package/src/lib/server/pos-reader-splash-images-route.d.ts +17 -0
- package/src/lib/server/pos-reader-splash-images-route.js +113 -0
- package/src/lib/server/pos-reader-splash-images-route.js.map +1 -0
- package/src/lib/server/pos-reader-splash-images.d.ts +51 -0
- package/src/lib/server/pos-reader-splash-images.js +123 -0
- package/src/lib/server/pos-reader-splash-images.js.map +1 -0
- package/src/lib/server/pos-reader-splash.d.ts +68 -1
- package/src/lib/server/pos-reader-splash.js +182 -11
- package/src/lib/server/pos-reader-splash.js.map +1 -1
- package/src/lib/server/pos-readers.d.ts +29 -0
- package/src/lib/server/pos-readers.js +134 -35
- package/src/lib/server/pos-readers.js.map +1 -1
- package/src/lib/server/pos-refund-authority.d.ts +3 -1
- package/src/lib/server/pos-refund-authority.js +3 -2
- package/src/lib/server/pos-refund-authority.js.map +1 -1
- package/src/lib/server/pos-return.d.ts +10 -0
- package/src/lib/server/pos-return.js +29 -7
- package/src/lib/server/pos-return.js.map +1 -1
- package/src/lib/server/pos-sale.js +6 -1
- package/src/lib/server/pos-sale.js.map +1 -1
- package/src/lib/server/pos-shift.js +11 -0
- package/src/lib/server/pos-shift.js.map +1 -1
- package/src/lib/server/pos-staff-pin.js +29 -24
- package/src/lib/server/pos-staff-pin.js.map +1 -1
- package/src/lib/server/pos-terminal.d.ts +14 -4
- package/src/lib/server/pos-terminal.js +34 -38
- package/src/lib/server/pos-terminal.js.map +1 -1
- package/src/lib/server/printers.d.ts +7 -3
- package/src/lib/server/printers.js +18 -12
- package/src/lib/server/printers.js.map +1 -1
- package/src/lib/server/product-drafts.d.ts +11 -1
- package/src/lib/server/product-drafts.js +12 -8
- package/src/lib/server/product-drafts.js.map +1 -1
- package/src/lib/server/product.d.ts +15 -1
- package/src/lib/server/product.js +16 -3
- package/src/lib/server/product.js.map +1 -1
- package/src/lib/server/products-write.d.ts +26 -2
- package/src/lib/server/products-write.js +19 -7
- package/src/lib/server/products-write.js.map +1 -1
- package/src/lib/server/refund.js +55 -42
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/reservation-availability-query.d.ts +8 -0
- package/src/lib/server/reservation-availability-query.js +11 -1
- package/src/lib/server/reservation-availability-query.js.map +1 -1
- package/src/lib/server/reservation-availability.d.ts +1 -1
- package/src/lib/server/reservation-availability.js +7 -2
- package/src/lib/server/reservation-availability.js.map +1 -1
- package/src/lib/server/reservation-guests.d.ts +32 -0
- package/src/lib/server/reservation-guests.js +285 -0
- package/src/lib/server/reservation-guests.js.map +1 -0
- package/src/lib/server/reservation-walk-in.d.ts +11 -1
- package/src/lib/server/reservation-walk-in.js +56 -12
- package/src/lib/server/reservation-walk-in.js.map +1 -1
- package/src/lib/server/reserve.js +18 -5
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/returns.js +9 -6
- package/src/lib/server/returns.js.map +1 -1
- package/src/lib/server/reviews.d.ts +22 -2
- package/src/lib/server/reviews.js +88 -20
- package/src/lib/server/reviews.js.map +1 -1
- package/src/lib/server/shipping-connectors.js +10 -11
- package/src/lib/server/shipping-connectors.js.map +1 -1
- package/src/lib/server/site-page-resolver.js +20 -3
- package/src/lib/server/site-page-resolver.js.map +1 -1
- package/src/lib/server/store-day.d.ts +33 -0
- package/src/lib/server/store-day.js +46 -0
- package/src/lib/server/store-day.js.map +1 -0
- package/src/lib/server/store-setup-ai-writer.d.ts +2 -1
- package/src/lib/server/store-setup-ai-writer.js +5 -6
- package/src/lib/server/store-setup-ai-writer.js.map +1 -1
- package/src/lib/server/storefront-tax.d.ts +13 -0
- package/src/lib/server/storefront-tax.js +8 -1
- package/src/lib/server/storefront-tax.js.map +1 -1
- package/src/lib/server/tax-return-source.d.ts +32 -3
- package/src/lib/server/tax-return-source.js +99 -20
- package/src/lib/server/tax-return-source.js.map +1 -1
- package/src/lib/server.js +100 -2
- package/src/lib/server.js.map +1 -1
- package/src/lib/testing/fake-firestore.js +58 -16
- package/src/lib/testing/fake-firestore.js.map +1 -1
- package/src/lib/testing/pos-ops-memory-firestore.js +18 -4
- package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -1
- package/src/lib/testing/site-register-permissions.d.ts +29 -0
- package/src/lib/testing/site-register-permissions.js +38 -0
- package/src/lib/testing/site-register-permissions.js.map +1 -0
- package/src/lib/transfer/tracking.server.js +8 -5
- package/src/lib/transfer/tracking.server.js.map +1 -1
- package/src/lib/utils/add-to-cart.d.ts +2 -0
- package/src/lib/utils/add-to-cart.js +6 -3
- package/src/lib/utils/add-to-cart.js.map +1 -1
|
@@ -14,14 +14,18 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/ import { normalizeProductCheckIn } from "./commerce-check-in-product.js";
|
|
17
|
+
*/ import { addCheckInDays, checkInDayLabel, checkInUseDayProblem, isCheckInDayKey, normalizeProductCheckIn } from "./commerce-check-in-product.js";
|
|
18
18
|
import { emailSearchTokens } from "@aglyn/aglyn/app-utils/email-search";
|
|
19
19
|
import { nameSearchKey, nameSearchToken, nameSearchTokens } from "@aglyn/aglyn/app-utils/name-search";
|
|
20
20
|
import { formatOrderNumber } from "./commerce-orders.js";
|
|
21
|
+
import { reservationGuests } from "./commerce-reservations.js";
|
|
21
22
|
import { posCsvCell } from "./commerce-pos-ops.js";
|
|
22
23
|
import { orderLabelTokens } from "./order-list-fields.js";
|
|
24
|
+
// The record and its route live in a pure module the native contracts read.
|
|
25
|
+
export { CHECK_IN_BATCH_MAX, CHECK_IN_WRISTBAND_COLORS, CHECK_IN_WRISTBAND_MAX, POS_CHECK_IN_ROUTE } from "./commerce-check-in-record.js";
|
|
26
|
+
import { CHECK_IN_WRISTBAND_MAX } from "./commerce-check-in-record.js";
|
|
23
27
|
// The product setting lives in a pure module the native contracts read (AGL-4043).
|
|
24
|
-
export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem } from "./commerce-check-in-product.js";
|
|
28
|
+
export { addCheckInDays, checkInDayLabel, CHECK_IN_MAX_HEADCOUNT, CHECK_IN_USE_DAY_MAX_AHEAD_DAYS, checkInUseDayProblem, isCheckInDayKey, normalizeProductCheckIn, productCheckInProblem } from "./commerce-check-in-product.js";
|
|
25
29
|
/*==========================================
|
|
26
30
|
* CHECK-IN AT THE WINDOW (AGL-4043).
|
|
27
31
|
*
|
|
@@ -31,10 +35,16 @@ export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem
|
|
|
31
35
|
*
|
|
32
36
|
* WHAT IS DUE ON A DAY
|
|
33
37
|
* - An order's lines whose product (or variant) "Needs check-in", on the
|
|
34
|
-
* day the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
38
|
+
* day the buyer chose for the line (`useDayKey`, when the product asks
|
|
39
|
+
* for one), else on the day the order was placed, in the site's time
|
|
40
|
+
* zone. A paid order only: `paid`, `partially_fulfilled`, `fulfilled` or
|
|
37
41
|
* `delivered`. A line refunded by name is not due.
|
|
42
|
+
* - A RAIN CHECK moves one person's pass off its day (bad weather, a
|
|
43
|
+
* closed track): to a later day staff pick, or OPEN, claimable on any
|
|
44
|
+
* later day until it is used. The document keeps its id; its `dayKey`
|
|
45
|
+
* moves with a dated rain check and stays put while one is open
|
|
46
|
+
* (`rainCheckOpen`, which any later day's search also asks). Undo puts it
|
|
47
|
+
* back on the day it was on.
|
|
38
48
|
* - Each unit is a person: quantity × the product's "people per item"
|
|
39
49
|
* (`headcount`, default 1), so three passes are three check-ins.
|
|
40
50
|
* - A reservation that is `confirmed` or `checked_in` and whose stay
|
|
@@ -48,25 +58,14 @@ export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem
|
|
|
48
58
|
* POST /api/commerce/pos-check-in { hostId, action, … }
|
|
49
59
|
* GET /api/commerce/pos-check-in?hostId=…&day=YYYY-MM-DD[&format=csv]
|
|
50
60
|
*
|
|
61
|
+
* Actions: `search`, `customer`, `check_in`, `undo`, `wristband`,
|
|
62
|
+
* `rain_check` and `undo_rain_check`.
|
|
63
|
+
*
|
|
51
64
|
* The native register mirrors these types.
|
|
52
|
-
*=========================================*/ export const
|
|
53
|
-
/** The most check-ins one order line makes, whatever its quantity. */ export const CHECK_IN_MAX_UNITS_PER_LINE = 200;
|
|
65
|
+
*=========================================*/ /** The most check-ins one order line makes, whatever its quantity. */ export const CHECK_IN_MAX_UNITS_PER_LINE = 200;
|
|
54
66
|
/** The most check-ins, orders or stays one day reads. */ export const CHECK_IN_DAY_CEILING = 3000;
|
|
55
67
|
/** The most check-in rows one search reads. */ export const CHECK_IN_SEARCH_ROWS = 100;
|
|
56
68
|
/** The most customers one search answers. */ export const CHECK_IN_SEARCH_CUSTOMERS = 20;
|
|
57
|
-
/** The most check-ins one tap records. */ export const CHECK_IN_BATCH_MAX = 50;
|
|
58
|
-
/** A wristband's number or color, at most this many characters. */ export const CHECK_IN_WRISTBAND_MAX = 24;
|
|
59
|
-
/** Colors offered as quick picks for a wristband. Any word is accepted. */ export const CHECK_IN_WRISTBAND_COLORS = [
|
|
60
|
-
'Red',
|
|
61
|
-
'Orange',
|
|
62
|
-
'Yellow',
|
|
63
|
-
'Green',
|
|
64
|
-
'Blue',
|
|
65
|
-
'Purple',
|
|
66
|
-
'Pink',
|
|
67
|
-
'White',
|
|
68
|
-
'Black'
|
|
69
|
-
];
|
|
70
69
|
/** The order statuses whose check-in lines are due. */ export const CHECK_IN_ORDER_STATUSES = [
|
|
71
70
|
'paid',
|
|
72
71
|
'partially_fulfilled',
|
|
@@ -88,9 +87,14 @@ export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem
|
|
|
88
87
|
const variant = ((_product_variants = product.variants) != null ? _product_variants : []).find((one)=>one.id === (variantId || 'default'));
|
|
89
88
|
const setting = (_normalizeProductCheckIn = normalizeProductCheckIn(variant == null ? void 0 : variant.checkIn)) != null ? _normalizeProductCheckIn : normalizeProductCheckIn(product.checkIn);
|
|
90
89
|
return (setting == null ? void 0 : setting.enabled) ? {
|
|
91
|
-
headcount: (_setting_headcount = setting.headcount) != null ? _setting_headcount : 1
|
|
90
|
+
headcount: (_setting_headcount = setting.headcount) != null ? _setting_headcount : 1,
|
|
91
|
+
askUseDate: setting.askUseDate === true
|
|
92
92
|
} : null;
|
|
93
93
|
}
|
|
94
|
+
/** Whether a product's variant asks the buyer which day they will use it. */ export function productAsksUseDate(product, variantId) {
|
|
95
|
+
var _productCheckInFor;
|
|
96
|
+
return ((_productCheckInFor = productCheckInFor(product, variantId)) == null ? void 0 : _productCheckInFor.askUseDate) === true;
|
|
97
|
+
}
|
|
94
98
|
/** Whether any variant of a product needs check-in. */ export function productNeedsCheckIn(product) {
|
|
95
99
|
var _product_variants;
|
|
96
100
|
if (!product) return false;
|
|
@@ -156,7 +160,13 @@ export { CHECK_IN_MAX_HEADCOUNT, normalizeProductCheckIn, productCheckInProblem
|
|
|
156
160
|
export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
157
161
|
return `r_${reservationId}_${dayKey}_${unitIndex}`;
|
|
158
162
|
}
|
|
159
|
-
/**
|
|
163
|
+
/**
|
|
164
|
+
* The fields a due check-in copies from its source, which a later read may
|
|
165
|
+
* refresh: the customer's, and how many check-ins its line or stay makes that
|
|
166
|
+
* day (a stay checked in per guest changes it when its guests or the store's
|
|
167
|
+
* control change).
|
|
168
|
+
*/ export const CHECK_IN_CUSTOMER_FIELDS = [
|
|
169
|
+
'unitCount',
|
|
160
170
|
'customerKey',
|
|
161
171
|
'customerName',
|
|
162
172
|
'customerEmail',
|
|
@@ -170,13 +180,17 @@ export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
|
170
180
|
return Boolean(order && CHECK_IN_ORDER_STATUSES.includes(String((_order_status = order.status) != null ? _order_status : '')));
|
|
171
181
|
}
|
|
172
182
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* the
|
|
183
|
+
* Every check-in an order makes, keyed by document id, each on its own day:
|
|
184
|
+
* the day the buyer chose for its line (`useDayKey`), else `purchaseDayKey`,
|
|
185
|
+
* the day the order was placed on the site's calendar. A caller working one
|
|
186
|
+
* day keeps the entries whose `dayKey` is that day; the rest are still owed,
|
|
187
|
+
* on theirs. `products` holds the products its lines name, as stored now:
|
|
188
|
+
* the setting is read at the window, so turning it on covers passes already
|
|
189
|
+
* sold today.
|
|
176
190
|
*/ export function dueCheckInsForOrder(input) {
|
|
177
191
|
var _order_number;
|
|
178
192
|
var _order_customerRecord;
|
|
179
|
-
const { orderId, order,
|
|
193
|
+
const { orderId, order, purchaseDayKey } = input;
|
|
180
194
|
const due = new Map();
|
|
181
195
|
if (!orderIsDueForCheckIn(order)) return due;
|
|
182
196
|
const refunded = new Set(Array.isArray(order.refundedLineItemIds) ? order.refundedLineItemIds : []);
|
|
@@ -205,6 +219,7 @@ export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
|
205
219
|
if (!setting) return;
|
|
206
220
|
const quantity = Math.max(0, Math.round(Number(line.quantity) || 0));
|
|
207
221
|
const unitCount = Math.min(quantity * setting.headcount, CHECK_IN_MAX_UNITS_PER_LINE);
|
|
222
|
+
const dayKey = isCheckInDayKey(line.useDayKey) ? line.useDayKey : purchaseDayKey;
|
|
208
223
|
for(let unitIndex = 0; unitIndex < unitCount; unitIndex += 1){
|
|
209
224
|
var _order_channel, _line_productId, _line_variantId;
|
|
210
225
|
due.set(orderCheckInId(orderId, lineIndex, unitIndex), {
|
|
@@ -242,8 +257,67 @@ export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
|
242
257
|
const check = new Date(ms);
|
|
243
258
|
return check.getUTCDate() === Number(match[3]) && check.getUTCMonth() === Number(match[2]) - 1 ? ms : null;
|
|
244
259
|
}
|
|
245
|
-
/**
|
|
246
|
-
|
|
260
|
+
/** Where the store's stay check-in control lives (AGL-4043): `hosts/{hostId}/settings/checkIn.stays`. */ export const STAY_CHECK_IN_SETTINGS_DOC = 'checkIn';
|
|
261
|
+
/**
|
|
262
|
+
* Which check-ins one stay keeps on one day when it needs `unitCount` of
|
|
263
|
+
* them (AGL-4043): when staff change a stay's guests, or the store switches
|
|
264
|
+
* between one check-in per stay and one per guest.
|
|
265
|
+
*
|
|
266
|
+
* A guest already checked in is never dropped, whatever their place: staff
|
|
267
|
+
* check a family in in any order, so the third guest may be in while the
|
|
268
|
+
* first is still on the way. The waiting ones fill what is left, lowest place
|
|
269
|
+
* first, and the rest are dropped; new places are the lowest free ones.
|
|
270
|
+
* `checkedIn` above `unitCount` is a count that cannot be honored without
|
|
271
|
+
* taking back a check-in: the guests route refuses it, and a reconcile keeps
|
|
272
|
+
* every checked-in guest and drops every waiting one.
|
|
273
|
+
*/ export function stayCheckInPlan(input) {
|
|
274
|
+
const wanted = Math.max(0, Math.floor(Number(input.unitCount) || 0));
|
|
275
|
+
const placeOf = (slot)=>Math.max(0, Math.floor(Number(slot.unitIndex) || 0));
|
|
276
|
+
const checkedIn = input.existing.filter((slot)=>slot.status === 'checked_in');
|
|
277
|
+
const waiting = input.existing.filter((slot)=>slot.status !== 'checked_in').sort((a, b)=>placeOf(a) - placeOf(b) || a.id.localeCompare(b.id));
|
|
278
|
+
const room = Math.max(0, wanted - checkedIn.length);
|
|
279
|
+
const kept = waiting.slice(0, room);
|
|
280
|
+
const used = new Set(input.existing.map(placeOf));
|
|
281
|
+
const create = [];
|
|
282
|
+
for(let place = 0; create.length < room - kept.length; place += 1){
|
|
283
|
+
if (!used.has(place)) create.push(place);
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
unitIndexes: [
|
|
287
|
+
...checkedIn.map(placeOf),
|
|
288
|
+
...kept.map(placeOf),
|
|
289
|
+
...create
|
|
290
|
+
].sort((a, b)=>a - b),
|
|
291
|
+
create,
|
|
292
|
+
drop: waiting.slice(room).map((slot)=>slot.id),
|
|
293
|
+
checkedIn: checkedIn.length
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/** Stored check-ins of stays grouped by stay, as {@link stayCheckInPlan} reads them. */ export function storedStayCheckIns(docs) {
|
|
297
|
+
const byStay = new Map();
|
|
298
|
+
for (const doc of docs){
|
|
299
|
+
var _byStay_get, _doc_get;
|
|
300
|
+
const reservationId = doc.get('reservationId');
|
|
301
|
+
if (doc.get('source') !== 'reservation' || typeof reservationId !== 'string' || !reservationId) continue;
|
|
302
|
+
const slots = (_byStay_get = byStay.get(reservationId)) != null ? _byStay_get : [];
|
|
303
|
+
slots.push({
|
|
304
|
+
id: doc.id,
|
|
305
|
+
status: doc.get('status') === 'checked_in' ? 'checked_in' : 'expected',
|
|
306
|
+
unitIndex: Number((_doc_get = doc.get('unitIndex')) != null ? _doc_get : 0)
|
|
307
|
+
});
|
|
308
|
+
byStay.set(reservationId, slots);
|
|
309
|
+
}
|
|
310
|
+
return byStay;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The check-ins a stay makes on a day it covers; empty on any other day. One
|
|
314
|
+
* per stay, or with `perGuest` one per guest (`guests`, at least one), each
|
|
315
|
+
* with its own wristband: the resource's setting under the store's control
|
|
316
|
+
* (`stayChecksInPerGuest`). Given the stay's check-ins already stored that
|
|
317
|
+
* day (`existing`), its places follow {@link stayCheckInPlan}, so a guest
|
|
318
|
+
* checked in is kept and a waiting one beyond the count is not due.
|
|
319
|
+
*/ export function dueCheckInsForReservation(input) {
|
|
320
|
+
var _reservation_status, _input_existing;
|
|
247
321
|
const { reservationId, reservation, dayKey } = input;
|
|
248
322
|
const due = new Map();
|
|
249
323
|
const dayMs = checkInDayMs(dayKey);
|
|
@@ -252,35 +326,43 @@ export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
|
252
326
|
}
|
|
253
327
|
const name = text(reservation.guestName) || null;
|
|
254
328
|
const email = text(reservation.guestEmail) || null;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
reservationId,
|
|
261
|
-
lineIndex: null,
|
|
262
|
-
unitIndex: 0,
|
|
263
|
-
unitCount: 1,
|
|
264
|
-
productId: null,
|
|
265
|
-
variantId: null,
|
|
266
|
-
itemName: text(input.resourceName) || 'Stay',
|
|
267
|
-
variantLabel: null,
|
|
268
|
-
dayKey,
|
|
269
|
-
customerKey: checkInCustomerKey({
|
|
270
|
-
email,
|
|
271
|
-
name,
|
|
272
|
-
fallback: `reservation:${reservationId}`
|
|
273
|
-
}),
|
|
274
|
-
customerName: name,
|
|
275
|
-
customerEmail: email,
|
|
276
|
-
customerEmailLower: email ? email.toLowerCase() : null,
|
|
277
|
-
customerPhone: null,
|
|
278
|
-
contactId: null,
|
|
279
|
-
searchTokens: checkInSearchTokens({
|
|
280
|
-
name,
|
|
281
|
-
email
|
|
282
|
-
})
|
|
329
|
+
const unitCount = input.perGuest ? reservationGuests(reservation) : 1;
|
|
330
|
+
const customerKey = checkInCustomerKey({
|
|
331
|
+
email,
|
|
332
|
+
name,
|
|
333
|
+
fallback: `reservation:${reservationId}`
|
|
283
334
|
});
|
|
335
|
+
const searchTokens = checkInSearchTokens({
|
|
336
|
+
name,
|
|
337
|
+
email
|
|
338
|
+
});
|
|
339
|
+
for (const unitIndex of stayCheckInPlan({
|
|
340
|
+
unitCount,
|
|
341
|
+
existing: (_input_existing = input.existing) != null ? _input_existing : []
|
|
342
|
+
}).unitIndexes){
|
|
343
|
+
due.set(reservationCheckInId(reservationId, dayKey, unitIndex), {
|
|
344
|
+
source: 'reservation',
|
|
345
|
+
orderId: null,
|
|
346
|
+
orderLabel: null,
|
|
347
|
+
channel: 'reservation',
|
|
348
|
+
reservationId,
|
|
349
|
+
lineIndex: null,
|
|
350
|
+
unitIndex,
|
|
351
|
+
unitCount,
|
|
352
|
+
productId: null,
|
|
353
|
+
variantId: null,
|
|
354
|
+
itemName: text(input.resourceName) || 'Stay',
|
|
355
|
+
variantLabel: null,
|
|
356
|
+
dayKey,
|
|
357
|
+
customerKey,
|
|
358
|
+
customerName: name,
|
|
359
|
+
customerEmail: email,
|
|
360
|
+
customerEmailLower: email ? email.toLowerCase() : null,
|
|
361
|
+
customerPhone: null,
|
|
362
|
+
contactId: null,
|
|
363
|
+
searchTokens
|
|
364
|
+
});
|
|
365
|
+
}
|
|
284
366
|
return due;
|
|
285
367
|
}
|
|
286
368
|
/** A due check-in as first written. */ export function newCheckInDocument(due, nowMs) {
|
|
@@ -399,12 +481,50 @@ export function reservationCheckInId(reservationId, dayKey, unitIndex = 0) {
|
|
|
399
481
|
return String((_ref = (_a_customerName = a.customerName) != null ? _a_customerName : a.customerEmail) != null ? _ref : '').localeCompare(String((_ref1 = (_b_customerName = b.customerName) != null ? _b_customerName : b.customerEmail) != null ? _ref1 : '')) || a.itemName.localeCompare(b.itemName) || a.unitIndex - b.unitIndex || a.id.localeCompare(b.id);
|
|
400
482
|
});
|
|
401
483
|
}
|
|
484
|
+
/** Whether a check-in waits on an open rain check (not yet used). */ export function checkInRainCheckIsOpen(row) {
|
|
485
|
+
return row.rainCheckOpen === true && row.status === 'expected';
|
|
486
|
+
}
|
|
402
487
|
export function checkInDayTotals(rows) {
|
|
488
|
+
const rainChecks = rows.filter((row)=>checkInRainCheckIsOpen(row)).length;
|
|
403
489
|
return {
|
|
404
|
-
expected: rows.length,
|
|
405
|
-
checkedIn: rows.filter((row)=>row.status === 'checked_in').length
|
|
490
|
+
expected: rows.length - rainChecks,
|
|
491
|
+
checkedIn: rows.filter((row)=>row.status === 'checked_in').length,
|
|
492
|
+
rainChecks
|
|
406
493
|
};
|
|
407
494
|
}
|
|
495
|
+
/*==========================================
|
|
496
|
+
* RAIN CHECKS
|
|
497
|
+
*=========================================*/ /**
|
|
498
|
+
* Why a pass cannot be rain-checked as asked, or null. Only a pass bought as
|
|
499
|
+
* an order line (a stay's dates change on the Reservations card), only while
|
|
500
|
+
* nobody has used it, and a dated one only to a day after the one it is on
|
|
501
|
+
* that has not passed (`todayKey` on the store's calendar).
|
|
502
|
+
*/ export function rainCheckProblem(row, ask, todayKey) {
|
|
503
|
+
if (row.source !== 'order') {
|
|
504
|
+
return 'Only passes can be rain-checked. Change a stay’s dates on the Reservations card.';
|
|
505
|
+
}
|
|
506
|
+
if (row.status !== 'expected') return 'They are already checked in. Undo the check-in first.';
|
|
507
|
+
if (ask.kind === 'open') return null;
|
|
508
|
+
const day = ask.dayKey;
|
|
509
|
+
if (!isCheckInDayKey(day)) return 'Choose the new day as a date.';
|
|
510
|
+
if (day <= row.dayKey) return 'Choose a day after the one the pass is on.';
|
|
511
|
+
return checkInUseDayProblem(day, todayKey);
|
|
512
|
+
}
|
|
513
|
+
/** What the window says about a pass's rain check: "Rain check from Sat, Oct 25". */ export function rainCheckLabel(row) {
|
|
514
|
+
const rainCheck = row.rainCheck;
|
|
515
|
+
if (!rainCheck) return '';
|
|
516
|
+
const from = checkInDayLabel(rainCheck.fromDayKey);
|
|
517
|
+
if (rainCheck.kind === 'date') return `Rain check: moved from ${from} to ${checkInDayLabel(rainCheck.toDayKey)}`;
|
|
518
|
+
if (rainCheck.claimedDayKey) return `Rain check from ${from}, used ${checkInDayLabel(rainCheck.claimedDayKey)}`;
|
|
519
|
+
return `Rain check from ${from}: good on any later day`;
|
|
520
|
+
}
|
|
521
|
+
/** The check-in's status in words: "Checked in", "Expected" or "Rain check". */ export function checkInStatusLabel(row) {
|
|
522
|
+
if (row.status === 'checked_in') return 'Checked in';
|
|
523
|
+
return checkInRainCheckIsOpen(row) ? 'Rain check' : 'Expected';
|
|
524
|
+
}
|
|
525
|
+
/** The day after `dayKey`: the first day an open rain check is good on. */ export function checkInNextDay(dayKey) {
|
|
526
|
+
return addCheckInDays(dayKey, 1);
|
|
527
|
+
}
|
|
408
528
|
/** A time on the site's clock: "9:14 AM". */ export function checkInTimeLabel(ms, timeZone) {
|
|
409
529
|
if (!ms) return '';
|
|
410
530
|
try {
|
|
@@ -426,7 +546,9 @@ export function checkInDayTotals(rows) {
|
|
|
426
546
|
}
|
|
427
547
|
/** One person's line, as the list and the spreadsheet name it: "Day pass · Adult (2 of 3)". */ export function checkInItemLabel(row) {
|
|
428
548
|
const item = row.variantLabel ? `${row.itemName} · ${row.variantLabel}` : row.itemName;
|
|
429
|
-
|
|
549
|
+
// A guest checked in before their stay's count came down keeps their place,
|
|
550
|
+
// which can lie past the new count: no "4 of 2".
|
|
551
|
+
return row.unitCount > 1 && row.unitIndex < row.unitCount ? `${item} (${row.unitIndex + 1} of ${row.unitCount})` : item;
|
|
430
552
|
}
|
|
431
553
|
/** The day's check-ins as a spreadsheet, one row per person. */ export function checkInDayCsv(rows, timeZone) {
|
|
432
554
|
const header = [
|
|
@@ -440,7 +562,8 @@ export function checkInDayTotals(rows) {
|
|
|
440
562
|
'Checked in at',
|
|
441
563
|
'Checked in by',
|
|
442
564
|
'Wristband number',
|
|
443
|
-
'Wristband color'
|
|
565
|
+
'Wristband color',
|
|
566
|
+
'Rain check'
|
|
444
567
|
];
|
|
445
568
|
const lines = sortCheckInRows(rows).map((row)=>{
|
|
446
569
|
var _row_customerName, _row_customerEmail, _row_customerPhone, _row_orderLabel, _row_checkedInByName, _ref, _ref1;
|
|
@@ -452,11 +575,12 @@ export function checkInDayTotals(rows) {
|
|
|
452
575
|
(_row_customerPhone = row.customerPhone) != null ? _row_customerPhone : '',
|
|
453
576
|
checkInItemLabel(row),
|
|
454
577
|
(_row_orderLabel = row.orderLabel) != null ? _row_orderLabel : row.source === 'reservation' ? 'Stay' : '',
|
|
455
|
-
row
|
|
578
|
+
checkInStatusLabel(row),
|
|
456
579
|
checkInTimeLabel(row.checkedInAtMs, timeZone),
|
|
457
580
|
(_row_checkedInByName = row.checkedInByName) != null ? _row_checkedInByName : '',
|
|
458
581
|
(_ref = (_row_wristband = row.wristband) == null ? void 0 : _row_wristband.number) != null ? _ref : '',
|
|
459
|
-
(_ref1 = (_row_wristband1 = row.wristband) == null ? void 0 : _row_wristband1.color) != null ? _ref1 : ''
|
|
582
|
+
(_ref1 = (_row_wristband1 = row.wristband) == null ? void 0 : _row_wristband1.color) != null ? _ref1 : '',
|
|
583
|
+
rainCheckLabel(row)
|
|
460
584
|
].map(posCsvCell).join(',');
|
|
461
585
|
});
|
|
462
586
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-check-in.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 */\nimport {\n CHECK_IN_MAX_HEADCOUNT,\n normalizeProductCheckIn,\n productCheckInProblem,\n type ProductCheckIn,\n} from './commerce-check-in-product'\nimport { emailSearchTokens } from '@aglyn/aglyn/app-utils/email-search'\nimport {\n nameSearchKey,\n nameSearchToken,\n nameSearchTokens,\n} from '@aglyn/aglyn/app-utils/name-search'\nimport type { ProductVariant } from './commerce'\nimport {\n formatOrderNumber,\n type HostOrder,\n type OrderChannel,\n} from './commerce-orders'\nimport type { HostReservation } from './commerce-reservations'\nimport { posCsvCell } from './commerce-pos-ops'\nimport { orderLabelTokens } from './order-list-fields'\n\n// The product setting lives in a pure module the native contracts read (AGL-4043).\nexport {\n CHECK_IN_MAX_HEADCOUNT,\n normalizeProductCheckIn,\n productCheckInProblem,\n type ProductCheckIn,\n} from './commerce-check-in-product'\n\n/*==========================================\n * CHECK-IN AT THE WINDOW (AGL-4043).\n *\n * A rider who bought a day pass online walks up to the window, is looked up\n * by name, checked in and handed a wristband. So is somebody who bought a\n * pass at the register, and a guest whose stay covers today.\n *\n * WHAT IS DUE ON A DAY\n * - An order's lines whose product (or variant) \"Needs check-in\", on the\n * day the order was placed, in the site's time zone. Products have no\n * service date of their own, so the purchase day is the day the pass is\n * for. A paid order only: `paid`, `partially_fulfilled`, `fulfilled` or\n * `delivered`. A line refunded by name is not due.\n * - Each unit is a person: quantity × the product's \"people per item\"\n * (`headcount`, default 1), so three passes are three check-ins.\n * - A reservation that is `confirmed` or `checked_in` and whose stay\n * covers the day: one check-in per day of the stay.\n *\n * Every due unit is a document, `hosts/{hostId}/checkIns/{id}`, written by\n * the server only. Its id is the unit's identity (order, line, unit; or\n * stay, day), so writing what is due twice writes it once, and a check-in\n * is a transaction on that one document.\n *\n * POST /api/commerce/pos-check-in { hostId, action, … }\n * GET /api/commerce/pos-check-in?hostId=…&day=YYYY-MM-DD[&format=csv]\n *\n * The native register mirrors these types.\n *=========================================*/\n\nexport const POS_CHECK_IN_ROUTE = '/api/commerce/pos-check-in'\n\n/** The most check-ins one order line makes, whatever its quantity. */\nexport const CHECK_IN_MAX_UNITS_PER_LINE = 200\n\n/** The most check-ins, orders or stays one day reads. */\nexport const CHECK_IN_DAY_CEILING = 3000\n\n/** The most check-in rows one search reads. */\nexport const CHECK_IN_SEARCH_ROWS = 100\n\n/** The most customers one search answers. */\nexport const CHECK_IN_SEARCH_CUSTOMERS = 20\n\n/** The most check-ins one tap records. */\nexport const CHECK_IN_BATCH_MAX = 50\n\n/** A wristband's number or color, at most this many characters. */\nexport const CHECK_IN_WRISTBAND_MAX = 24\n\n/** Colors offered as quick picks for a wristband. Any word is accepted. */\nexport const CHECK_IN_WRISTBAND_COLORS = [\n 'Red',\n 'Orange',\n 'Yellow',\n 'Green',\n 'Blue',\n 'Purple',\n 'Pink',\n 'White',\n 'Black',\n] as const\n\n/** The order statuses whose check-in lines are due. */\nexport const CHECK_IN_ORDER_STATUSES = ['paid', 'partially_fulfilled', 'fulfilled', 'delivered'] as const\n\n/** The stay statuses whose days are due. */\nexport const CHECK_IN_RESERVATION_STATUSES = ['confirmed', 'checked_in'] as const\n\nexport type CheckInStatus = 'expected' | 'checked_in'\n\nexport interface CheckInWristband {\n number: string | null\n color: string | null\n}\n\n/** `hosts/{hostId}/checkIns/{id}`: one person due on one day. Server-written only. */\nexport interface HostCheckIn {\n source: 'order' | 'reservation'\n orderId: string | null\n /** The order's number as the console shows it (`#1042`), or null for a stay. */\n orderLabel: string | null\n /** Where the order was sold, or `reservation`. */\n channel: OrderChannel | 'reservation'\n reservationId: string | null\n lineIndex: number | null\n /** This person's place among the line's or stay's check-ins, from 0. */\n unitIndex: number\n /** How many check-ins the line or stay makes that day. */\n unitCount: number\n productId: string | null\n variantId: string | null\n itemName: string\n variantLabel: string | null\n /** The day, `YYYY-MM-DD` in the site's time zone. */\n dayKey: string\n /** Who the check-in is for, as one key: the address, else the contact, else the name, else the order. */\n customerKey: string\n customerName: string | null\n customerEmail: string | null\n customerEmailLower: string | null\n customerPhone: string | null\n /** The contact the register attached to the sale, when it was one. */\n contactId: string | null\n /** The name's, the address's, the phone's and the order number's search prefixes. */\n searchTokens: string[]\n status: CheckInStatus\n checkedInAtMs: number | null\n checkedInBy: string | null\n checkedInByName: string | null\n wristband: CheckInWristband | null\n /** The attempt that checked this person in, so a retried tap is not \"already checked in\". */\n checkInAttempt: string | null\n /** The last undo, kept so a reversed check-in still says who reversed it. */\n undoneAtMs: number | null\n undoneBy: string | null\n createdAtMs: number\n updatedAtMs: number\n}\n\n/** One check-in as the routes answer it. */\nexport type CheckInRow = HostCheckIn & { id: string }\n\n/** A customer with something due on a day, as the search lists them. */\nexport interface CheckInCustomer {\n customerKey: string\n name: string | null\n email: string | null\n phone: string | null\n contactId: string | null\n /** Every check-in the customer has on the day. */\n unitsDue: number\n unitsCheckedIn: number\n /** What the check-ins are for, item names once each. */\n items: string[]\n}\n\n/*==========================================\n * THE PRODUCT SETTING\n *=========================================*/\n\n/**\n * Whether one variant of a product needs check-in, and for how many people\n * per item: the variant's own setting, else the product's; `null` when not.\n */\nexport function productCheckInFor(\n product: { checkIn?: unknown; variants?: ReadonlyArray<Pick<ProductVariant, 'id'> & { checkIn?: unknown }> } | null | undefined,\n variantId: string | null | undefined,\n): { headcount: number } | null {\n if (!product) return null\n const variant = (product.variants ?? []).find((one) => one.id === (variantId || 'default'))\n const setting = normalizeProductCheckIn(variant?.checkIn) ?? normalizeProductCheckIn(product.checkIn)\n return setting?.enabled ? { headcount: setting.headcount ?? 1 } : null\n}\n\n/** Whether any variant of a product needs check-in. */\nexport function productNeedsCheckIn(\n product: Parameters<typeof productCheckInFor>[0],\n): boolean {\n if (!product) return false\n const variants = product.variants?.length ? product.variants : [{ id: 'default' }]\n return variants.some((variant) => productCheckInFor(product, variant.id) !== null)\n}\n\n/*==========================================\n * WHAT IS DUE\n *=========================================*/\n\nconst text = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\n/** The digits of a phone number, without a leading US/Canada 1 when it has eleven. */\nexport function checkInPhoneDigits(phone: string | null | undefined): string {\n const digits = String(phone ?? '').replace(/\\D+/g, '')\n return digits.length === 11 && digits.startsWith('1') ? digits.slice(1) : digits\n}\n\n/** The search prefixes of a phone number: its digits from three on, and its last four. */\nfunction phoneTokens(phone: string | null | undefined): string[] {\n const digits = checkInPhoneDigits(phone).slice(0, 15)\n const tokens: string[] = []\n for (let at = 3; at <= digits.length; at += 1) tokens.push(digits.slice(0, at))\n // The last four, which is what a rider reads out at the window.\n if (digits.length >= 7) tokens.push(digits.slice(-4))\n return tokens\n}\n\n/** The tokens a check-in is found by. */\nexport function checkInSearchTokens(input: {\n name?: string | null\n email?: string | null\n phone?: string | null\n orderNumber?: number | null\n orderId?: string | null\n}): string[] {\n return [\n ...new Set([\n ...nameSearchTokens(input.name ?? ''),\n ...emailSearchTokens(input.email ?? ''),\n ...phoneTokens(input.phone),\n ...(input.orderId ? orderLabelTokens({ number: input.orderNumber ?? undefined }, input.orderId) : []),\n ]),\n ].slice(0, 200)\n}\n\n/**\n * What a typed search asks the index for: the phone's digits when it is a\n * number, else the first word's prefix (a name, an address, `#1042`).\n */\nexport function checkInSearchToken(typed: string): string {\n const value = String(typed ?? '').trim()\n if (!value) return ''\n if (/^[\\d\\s()+.-]+$/.test(value) && !value.startsWith('#')) {\n const digits = checkInPhoneDigits(value)\n return digits.length >= 3 ? digits.slice(0, 15) : ''\n }\n return nameSearchToken(value)\n}\n\n/** One key per customer: the address, else the contact, else the name, else the source. */\nexport function checkInCustomerKey(input: {\n email?: string | null\n contactId?: string | null\n name?: string | null\n fallback: string\n}): string {\n const email = text(input.email).toLowerCase()\n if (email) return `email:${email}`\n if (input.contactId) return `contact:${input.contactId}`\n const name = nameSearchKey(input.name ?? '')\n if (name) return `name:${name}`\n return input.fallback\n}\n\n/** A check-in's document id, from its unit's identity. */\nexport function orderCheckInId(orderId: string, lineIndex: number, unitIndex: number): string {\n return `o_${orderId}_${lineIndex}_${unitIndex}`\n}\n\nexport function reservationCheckInId(reservationId: string, dayKey: string, unitIndex = 0): string {\n return `r_${reservationId}_${dayKey}_${unitIndex}`\n}\n\n/** A due check-in before the server stamps its times and status. */\nexport type DueCheckIn = Omit<\n HostCheckIn,\n | 'status'\n | 'checkedInAtMs'\n | 'checkedInBy'\n | 'checkedInByName'\n | 'wristband'\n | 'checkInAttempt'\n | 'undoneAtMs'\n | 'undoneBy'\n | 'createdAtMs'\n | 'updatedAtMs'\n>\n\n/** The customer fields a due check-in copies from its source, which a later read may refresh. */\nexport const CHECK_IN_CUSTOMER_FIELDS = [\n 'customerKey',\n 'customerName',\n 'customerEmail',\n 'customerEmailLower',\n 'customerPhone',\n 'contactId',\n 'searchTokens',\n] as const\n\n/** Whether an order's lines are due at all. */\nexport function orderIsDueForCheckIn(order: Pick<HostOrder, 'status'> | null | undefined): boolean {\n return Boolean(order && (CHECK_IN_ORDER_STATUSES as readonly string[]).includes(String(order.status ?? '')))\n}\n\n/**\n * The check-ins an order makes on its day, keyed by document id. `products`\n * holds the products its lines name, as stored now: the setting is read at\n * the window, so turning it on covers passes already sold today.\n */\nexport function dueCheckInsForOrder(input: {\n orderId: string\n order: Partial<HostOrder>\n products: ReadonlyMap<string, Parameters<typeof productCheckInFor>[0]>\n dayKey: string\n}): Map<string, DueCheckIn> {\n const { orderId, order, dayKey } = input\n const due = new Map<string, DueCheckIn>()\n if (!orderIsDueForCheckIn(order as HostOrder)) return due\n const refunded = new Set(Array.isArray(order.refundedLineItemIds) ? order.refundedLineItemIds : [])\n const contactId =\n order.customerRecord?.kind === 'contact' && order.customerRecord.id ? order.customerRecord.id : null\n const name = text(order.customerName) || null\n const email = text(order.customerEmail) || null\n const phone = text(order.customerPhone) || null\n const customerKey = checkInCustomerKey({ email, contactId, name, fallback: `order:${orderId}` })\n const searchTokens = checkInSearchTokens({ name, email, phone, orderNumber: order.number ?? null, orderId })\n const lines = Array.isArray(order.lineItems) ? order.lineItems : []\n lines.forEach((line, lineIndex) => {\n if (!line || refunded.has(lineIndex)) return\n const setting = productCheckInFor(input.products.get(line.productId) ?? null, line.variantId)\n if (!setting) return\n const quantity = Math.max(0, Math.round(Number(line.quantity) || 0))\n const unitCount = Math.min(quantity * setting.headcount, CHECK_IN_MAX_UNITS_PER_LINE)\n for (let unitIndex = 0; unitIndex < unitCount; unitIndex += 1) {\n due.set(orderCheckInId(orderId, lineIndex, unitIndex), {\n source: 'order',\n orderId,\n orderLabel: formatOrderNumber({ number: order.number }, orderId),\n channel: (order.channel ?? 'online') as OrderChannel,\n reservationId: null,\n lineIndex,\n unitIndex,\n unitCount,\n productId: line.productId ?? null,\n variantId: line.variantId ?? null,\n itemName: text(line.name) || 'Item',\n variantLabel: text(line.variantLabel) || null,\n dayKey,\n customerKey,\n customerName: name,\n customerEmail: email,\n customerEmailLower: email ? email.toLowerCase() : null,\n customerPhone: phone,\n contactId,\n searchTokens,\n })\n }\n })\n return due\n}\n\n/** UTC midnight of a `YYYY-MM-DD` day, as a stay's days are stored. */\nexport function checkInDayMs(dayKey: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(dayKey)\n if (!match) return null\n const ms = Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]))\n const check = new Date(ms)\n return check.getUTCDate() === Number(match[3]) && check.getUTCMonth() === Number(match[2]) - 1 ? ms : null\n}\n\n/** The check-in a stay makes on a day it covers; empty on any other day. */\nexport function dueCheckInsForReservation(input: {\n reservationId: string\n reservation: Partial<HostReservation>\n resourceName: string | null\n dayKey: string\n}): Map<string, DueCheckIn> {\n const { reservationId, reservation, dayKey } = input\n const due = new Map<string, DueCheckIn>()\n const dayMs = checkInDayMs(dayKey)\n if (\n dayMs === null ||\n !(CHECK_IN_RESERVATION_STATUSES as readonly string[]).includes(String(reservation.status ?? '')) ||\n !(Number(reservation.checkInDayMs) <= dayMs && dayMs < Number(reservation.checkOutDayMs))\n ) {\n return due\n }\n const name = text(reservation.guestName) || null\n const email = text(reservation.guestEmail) || null\n due.set(reservationCheckInId(reservationId, dayKey), {\n source: 'reservation',\n orderId: null,\n orderLabel: null,\n channel: 'reservation',\n reservationId,\n lineIndex: null,\n unitIndex: 0,\n unitCount: 1,\n productId: null,\n variantId: null,\n itemName: text(input.resourceName) || 'Stay',\n variantLabel: null,\n dayKey,\n customerKey: checkInCustomerKey({ email, name, fallback: `reservation:${reservationId}` }),\n customerName: name,\n customerEmail: email,\n customerEmailLower: email ? email.toLowerCase() : null,\n customerPhone: null,\n contactId: null,\n searchTokens: checkInSearchTokens({ name, email }),\n })\n return due\n}\n\n/** A due check-in as first written. */\nexport function newCheckInDocument(due: DueCheckIn, nowMs: number): HostCheckIn {\n return {\n ...due,\n status: 'expected',\n checkedInAtMs: null,\n checkedInBy: null,\n checkedInByName: null,\n wristband: null,\n checkInAttempt: null,\n undoneAtMs: null,\n undoneBy: null,\n createdAtMs: nowMs,\n updatedAtMs: nowMs,\n }\n}\n\n/** The customer fields of a stored check-in that its source now says otherwise. */\nexport function changedCheckInCustomerFields(\n stored: Partial<HostCheckIn>,\n due: DueCheckIn,\n): Partial<DueCheckIn> | null {\n const patch: Record<string, unknown> = {}\n for (const field of CHECK_IN_CUSTOMER_FIELDS) {\n if (JSON.stringify(stored[field] ?? null) !== JSON.stringify(due[field] ?? null)) patch[field] = due[field]\n }\n return Object.keys(patch).length ? (patch as Partial<DueCheckIn>) : null\n}\n\n/*==========================================\n * WRISTBANDS, CUSTOMERS AND THE DAY\n *=========================================*/\n\n/**\n * A wristband as typed, made safe: a number (letters, digits, a dash) and a\n * color word, each optional. `null` with neither; an error for junk.\n */\nexport function normalizeWristband(\n value: unknown,\n): { ok: true; wristband: CheckInWristband | null } | { ok: false; error: string } {\n if (value === undefined || value === null || value === '') return { ok: true, wristband: null }\n if (typeof value !== 'object') return { ok: false, error: 'That is not a wristband.' }\n const raw = value as Record<string, unknown>\n const number = String(raw['number'] ?? '').trim()\n const color = String(raw['color'] ?? '').trim()\n if (number.length > CHECK_IN_WRISTBAND_MAX || color.length > CHECK_IN_WRISTBAND_MAX) {\n return { ok: false, error: `A wristband number or color is ${CHECK_IN_WRISTBAND_MAX} characters at most.` }\n }\n if (number && !/^[A-Za-z0-9#-]+$/.test(number)) {\n return { ok: false, error: 'A wristband number is letters, digits and dashes.' }\n }\n if (color && !/^[\\p{L} -]+$/u.test(color)) {\n return { ok: false, error: 'A wristband color is a word, such as Blue.' }\n }\n if (!number && !color) return { ok: true, wristband: null }\n return { ok: true, wristband: { number: number || null, color: color || null } }\n}\n\n/** A wristband as one line: \"Blue #214\". */\nexport function describeWristband(wristband: CheckInWristband | null | undefined): string {\n if (!wristband) return ''\n return [wristband.color, wristband.number ? `#${wristband.number.replace(/^#/, '')}` : null]\n .filter(Boolean)\n .join(' ')\n}\n\n/** The customers a set of check-ins is for, most due first, then by name. */\nexport function checkInCustomers(rows: ReadonlyArray<CheckInRow>): CheckInCustomer[] {\n const byKey = new Map<string, CheckInCustomer>()\n for (const row of rows) {\n const found = byKey.get(row.customerKey)\n const customer: CheckInCustomer = found ?? {\n customerKey: row.customerKey,\n name: row.customerName,\n email: row.customerEmail,\n phone: row.customerPhone,\n contactId: row.contactId,\n unitsDue: 0,\n unitsCheckedIn: 0,\n items: [],\n }\n customer.unitsDue += 1\n if (row.status === 'checked_in') customer.unitsCheckedIn += 1\n customer.name ||= row.customerName\n customer.email ||= row.customerEmail\n customer.phone ||= row.customerPhone\n customer.contactId ||= row.contactId\n if (!customer.items.includes(row.itemName)) customer.items.push(row.itemName)\n byKey.set(row.customerKey, customer)\n }\n return [...byKey.values()].sort(\n (a, b) =>\n b.unitsDue - b.unitsCheckedIn - (a.unitsDue - a.unitsCheckedIn) ||\n String(a.name ?? a.email ?? '').localeCompare(String(b.name ?? b.email ?? '')),\n )\n}\n\n/** A day's check-ins in the order the window reads them: by name, then item, then unit. */\nexport function sortCheckInRows<T extends Pick<CheckInRow, 'customerName' | 'customerEmail' | 'itemName' | 'unitIndex' | 'id'>>(\n rows: ReadonlyArray<T>,\n): T[] {\n return [...rows].sort(\n (a, b) =>\n String(a.customerName ?? a.customerEmail ?? '').localeCompare(String(b.customerName ?? b.customerEmail ?? '')) ||\n a.itemName.localeCompare(b.itemName) ||\n a.unitIndex - b.unitIndex ||\n a.id.localeCompare(b.id),\n )\n}\n\nexport interface CheckInDayTotals {\n expected: number\n checkedIn: number\n}\n\nexport function checkInDayTotals(rows: ReadonlyArray<Pick<CheckInRow, 'status'>>): CheckInDayTotals {\n return {\n expected: rows.length,\n checkedIn: rows.filter((row) => row.status === 'checked_in').length,\n }\n}\n\n/** A time on the site's clock: \"9:14 AM\". */\nexport function checkInTimeLabel(ms: number | null | undefined, timeZone: string): string {\n if (!ms) return ''\n try {\n return new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit', timeZone }).format(new Date(ms))\n } catch {\n return new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit' }).format(new Date(ms))\n }\n}\n\n/** \"Already checked in at 9:14 AM by Sam\". */\nexport function alreadyCheckedInLabel(row: Pick<CheckInRow, 'checkedInAtMs' | 'checkedInByName'>, timeZone: string): string {\n const at = checkInTimeLabel(row.checkedInAtMs, timeZone)\n return `Already checked in${at ? ` at ${at}` : ''}${row.checkedInByName ? ` by ${row.checkedInByName}` : ''}`\n}\n\n/** One person's line, as the list and the spreadsheet name it: \"Day pass · Adult (2 of 3)\". */\nexport function checkInItemLabel(row: Pick<CheckInRow, 'itemName' | 'variantLabel' | 'unitIndex' | 'unitCount'>): string {\n const item = row.variantLabel ? `${row.itemName} · ${row.variantLabel}` : row.itemName\n return row.unitCount > 1 ? `${item} (${row.unitIndex + 1} of ${row.unitCount})` : item\n}\n\n/** The day's check-ins as a spreadsheet, one row per person. */\nexport function checkInDayCsv(rows: ReadonlyArray<CheckInRow>, timeZone: string): string {\n const header = [\n 'Day',\n 'Name',\n 'Email',\n 'Phone',\n 'Item',\n 'Order',\n 'Status',\n 'Checked in at',\n 'Checked in by',\n 'Wristband number',\n 'Wristband color',\n ]\n const lines = sortCheckInRows(rows).map((row) =>\n [\n row.dayKey,\n row.customerName ?? '',\n row.customerEmail ?? '',\n row.customerPhone ?? '',\n checkInItemLabel(row),\n row.orderLabel ?? (row.source === 'reservation' ? 'Stay' : ''),\n row.status === 'checked_in' ? 'Checked in' : 'Expected',\n checkInTimeLabel(row.checkedInAtMs, timeZone),\n row.checkedInByName ?? '',\n row.wristband?.number ?? '',\n row.wristband?.color ?? '',\n ]\n .map(posCsvCell)\n .join(','),\n )\n return [header.map(posCsvCell).join(','), ...lines].join('\\n') + '\\n'\n}\n"],"names":["normalizeProductCheckIn","emailSearchTokens","nameSearchKey","nameSearchToken","nameSearchTokens","formatOrderNumber","posCsvCell","orderLabelTokens","CHECK_IN_MAX_HEADCOUNT","productCheckInProblem","POS_CHECK_IN_ROUTE","CHECK_IN_MAX_UNITS_PER_LINE","CHECK_IN_DAY_CEILING","CHECK_IN_SEARCH_ROWS","CHECK_IN_SEARCH_CUSTOMERS","CHECK_IN_BATCH_MAX","CHECK_IN_WRISTBAND_MAX","CHECK_IN_WRISTBAND_COLORS","CHECK_IN_ORDER_STATUSES","CHECK_IN_RESERVATION_STATUSES","productCheckInFor","product","variantId","setting","variant","variants","find","one","id","checkIn","enabled","headcount","productNeedsCheckIn","length","some","text","value","trim","checkInPhoneDigits","phone","digits","String","replace","startsWith","slice","phoneTokens","tokens","at","push","checkInSearchTokens","input","Set","name","email","orderId","number","orderNumber","undefined","checkInSearchToken","typed","test","checkInCustomerKey","toLowerCase","contactId","fallback","orderCheckInId","lineIndex","unitIndex","reservationCheckInId","reservationId","dayKey","CHECK_IN_CUSTOMER_FIELDS","orderIsDueForCheckIn","order","Boolean","includes","status","dueCheckInsForOrder","due","Map","refunded","Array","isArray","refundedLineItemIds","customerRecord","kind","customerName","customerEmail","customerPhone","customerKey","searchTokens","lines","lineItems","forEach","line","has","products","get","productId","quantity","Math","max","round","Number","unitCount","min","set","source","orderLabel","channel","itemName","variantLabel","customerEmailLower","checkInDayMs","match","exec","ms","Date","UTC","check","getUTCDate","getUTCMonth","dueCheckInsForReservation","reservation","dayMs","checkOutDayMs","guestName","guestEmail","resourceName","newCheckInDocument","nowMs","checkedInAtMs","checkedInBy","checkedInByName","wristband","checkInAttempt","undoneAtMs","undoneBy","createdAtMs","updatedAtMs","changedCheckInCustomerFields","stored","patch","field","JSON","stringify","Object","keys","normalizeWristband","raw","ok","error","color","describeWristband","filter","join","checkInCustomers","rows","byKey","row","customer","found","unitsDue","unitsCheckedIn","items","values","sort","a","b","localeCompare","sortCheckInRows","checkInDayTotals","expected","checkedIn","checkInTimeLabel","timeZone","Intl","DateTimeFormat","hour","minute","format","alreadyCheckedInLabel","checkInItemLabel","item","checkInDayCsv","header","map"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GACD,SAEEA,uBAAuB,QAGlB,iCAA6B;AACpC,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SACEC,aAAa,EACbC,eAAe,EACfC,gBAAgB,QACX,qCAAoC;AAE3C,SACEC,iBAAiB,QAGZ,uBAAmB;AAE1B,SAASC,UAAU,QAAQ,wBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,yBAAqB;AAEtD,mFAAmF;AACnF,SACEC,sBAAsB,EACtBR,uBAAuB,EACvBS,qBAAqB,QAEhB,iCAA6B;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;2CA2B2C,GAE3C,OAAO,MAAMC,qBAAqB,6BAA4B;AAE9D,oEAAoE,GACpE,OAAO,MAAMC,8BAA8B,IAAG;AAE9C,uDAAuD,GACvD,OAAO,MAAMC,uBAAuB,KAAI;AAExC,6CAA6C,GAC7C,OAAO,MAAMC,uBAAuB,IAAG;AAEvC,2CAA2C,GAC3C,OAAO,MAAMC,4BAA4B,GAAE;AAE3C,wCAAwC,GACxC,OAAO,MAAMC,qBAAqB,GAAE;AAEpC,iEAAiE,GACjE,OAAO,MAAMC,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AA;eAXF;YACEA,IAAIzF,MAAM;aACVyF,oBAAAA,IAAIzE,YAAY,YAAhByE,oBAAoB;aACpBA,qBAAAA,IAAIxE,aAAa,YAAjBwE,qBAAqB;aACrBA,qBAAAA,IAAIvE,aAAa,YAAjBuE,qBAAqB;YACrBuB,iBAAiBvB;aACjBA,kBAAAA,IAAInD,UAAU,YAAdmD,kBAAmBA,IAAIpD,MAAM,KAAK,gBAAgB,SAAS;YAC3DoD,IAAInF,MAAM,KAAK,eAAe,eAAe;YAC7CkG,iBAAiBf,IAAI5B,aAAa,EAAE4C;aACpChB,uBAAAA,IAAI1B,eAAe,YAAnB0B,uBAAuB;qBACvBA,iBAAAA,IAAIzB,SAAS,qBAAbyB,eAAexG,MAAM,mBAAI;sBACzBwG,kBAAAA,IAAIzB,SAAS,qBAAbyB,gBAAeP,KAAK,oBAAI;SACzB,CACEkC,GAAG,CAACpL,YACJqJ,IAAI,CAAC;;IAEV,OAAO;QAAC8B,OAAOC,GAAG,CAACpL,YAAYqJ,IAAI,CAAC;WAAShE;KAAM,CAACgE,IAAI,CAAC,QAAQ;AACnE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-check-in.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 */\nimport {\n addCheckInDays,\n checkInDayLabel,\n checkInUseDayProblem,\n isCheckInDayKey,\n normalizeProductCheckIn,\n} from './commerce-check-in-product'\nimport { emailSearchTokens } from '@aglyn/aglyn/app-utils/email-search'\nimport {\n nameSearchKey,\n nameSearchToken,\n nameSearchTokens,\n} from '@aglyn/aglyn/app-utils/name-search'\nimport type { ProductVariant } from './commerce'\nimport {\n formatOrderNumber,\n type HostOrder,\n type OrderChannel,\n} from './commerce-orders'\nimport { reservationGuests, type HostReservation } from './commerce-reservations'\nimport { posCsvCell } from './commerce-pos-ops'\nimport { orderLabelTokens } from './order-list-fields'\n\n// The record and its route live in a pure module the native contracts read.\nexport {\n CHECK_IN_BATCH_MAX,\n CHECK_IN_WRISTBAND_COLORS,\n CHECK_IN_WRISTBAND_MAX,\n POS_CHECK_IN_ROUTE,\n type CheckInCustomer,\n type CheckInDayTotals,\n type CheckInRainCheck,\n type CheckInRow,\n type CheckInStatus,\n type CheckInWristband,\n type HostCheckIn,\n} from './commerce-check-in-record'\nimport {\n CHECK_IN_WRISTBAND_MAX,\n type CheckInCustomer,\n type CheckInDayTotals,\n type CheckInRow,\n type CheckInStatus,\n type CheckInWristband,\n type HostCheckIn,\n} from './commerce-check-in-record'\n\n// The product setting lives in a pure module the native contracts read (AGL-4043).\nexport {\n addCheckInDays,\n checkInDayLabel,\n CHECK_IN_MAX_HEADCOUNT,\n CHECK_IN_USE_DAY_MAX_AHEAD_DAYS,\n checkInUseDayProblem,\n isCheckInDayKey,\n normalizeProductCheckIn,\n productCheckInProblem,\n type ProductCheckIn,\n} from './commerce-check-in-product'\n\n/*==========================================\n * CHECK-IN AT THE WINDOW (AGL-4043).\n *\n * A rider who bought a day pass online walks up to the window, is looked up\n * by name, checked in and handed a wristband. So is somebody who bought a\n * pass at the register, and a guest whose stay covers today.\n *\n * WHAT IS DUE ON A DAY\n * - An order's lines whose product (or variant) \"Needs check-in\", on the\n * day the buyer chose for the line (`useDayKey`, when the product asks\n * for one), else on the day the order was placed, in the site's time\n * zone. A paid order only: `paid`, `partially_fulfilled`, `fulfilled` or\n * `delivered`. A line refunded by name is not due.\n * - A RAIN CHECK moves one person's pass off its day (bad weather, a\n * closed track): to a later day staff pick, or OPEN, claimable on any\n * later day until it is used. The document keeps its id; its `dayKey`\n * moves with a dated rain check and stays put while one is open\n * (`rainCheckOpen`, which any later day's search also asks). Undo puts it\n * back on the day it was on.\n * - Each unit is a person: quantity × the product's \"people per item\"\n * (`headcount`, default 1), so three passes are three check-ins.\n * - A reservation that is `confirmed` or `checked_in` and whose stay\n * covers the day: one check-in per day of the stay.\n *\n * Every due unit is a document, `hosts/{hostId}/checkIns/{id}`, written by\n * the server only. Its id is the unit's identity (order, line, unit; or\n * stay, day), so writing what is due twice writes it once, and a check-in\n * is a transaction on that one document.\n *\n * POST /api/commerce/pos-check-in { hostId, action, … }\n * GET /api/commerce/pos-check-in?hostId=…&day=YYYY-MM-DD[&format=csv]\n *\n * Actions: `search`, `customer`, `check_in`, `undo`, `wristband`,\n * `rain_check` and `undo_rain_check`.\n *\n * The native register mirrors these types.\n *=========================================*/\n\n/** The most check-ins one order line makes, whatever its quantity. */\nexport const CHECK_IN_MAX_UNITS_PER_LINE = 200\n\n/** The most check-ins, orders or stays one day reads. */\nexport const CHECK_IN_DAY_CEILING = 3000\n\n/** The most check-in rows one search reads. */\nexport const CHECK_IN_SEARCH_ROWS = 100\n\n/** The most customers one search answers. */\nexport const CHECK_IN_SEARCH_CUSTOMERS = 20\n\n/** The order statuses whose check-in lines are due. */\nexport const CHECK_IN_ORDER_STATUSES = ['paid', 'partially_fulfilled', 'fulfilled', 'delivered'] as const\n\n/** The stay statuses whose days are due. */\nexport const CHECK_IN_RESERVATION_STATUSES = ['confirmed', 'checked_in'] as const\n\n/*==========================================\n * THE PRODUCT SETTING\n *=========================================*/\n\n/**\n * Whether one variant of a product needs check-in, and for how many people\n * per item: the variant's own setting, else the product's; `null` when not.\n */\nexport function productCheckInFor(\n product: { checkIn?: unknown; variants?: ReadonlyArray<Pick<ProductVariant, 'id'> & { checkIn?: unknown }> } | null | undefined,\n variantId: string | null | undefined,\n): { headcount: number; askUseDate: boolean } | null {\n if (!product) return null\n const variant = (product.variants ?? []).find((one) => one.id === (variantId || 'default'))\n const setting = normalizeProductCheckIn(variant?.checkIn) ?? normalizeProductCheckIn(product.checkIn)\n return setting?.enabled ? { headcount: setting.headcount ?? 1, askUseDate: setting.askUseDate === true } : null\n}\n\n/** Whether a product's variant asks the buyer which day they will use it. */\nexport function productAsksUseDate(\n product: Parameters<typeof productCheckInFor>[0],\n variantId: string | null | undefined,\n): boolean {\n return productCheckInFor(product, variantId)?.askUseDate === true\n}\n\n/** Whether any variant of a product needs check-in. */\nexport function productNeedsCheckIn(\n product: Parameters<typeof productCheckInFor>[0],\n): boolean {\n if (!product) return false\n const variants = product.variants?.length ? product.variants : [{ id: 'default' }]\n return variants.some((variant) => productCheckInFor(product, variant.id) !== null)\n}\n\n/*==========================================\n * WHAT IS DUE\n *=========================================*/\n\nconst text = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\n/** The digits of a phone number, without a leading US/Canada 1 when it has eleven. */\nexport function checkInPhoneDigits(phone: string | null | undefined): string {\n const digits = String(phone ?? '').replace(/\\D+/g, '')\n return digits.length === 11 && digits.startsWith('1') ? digits.slice(1) : digits\n}\n\n/** The search prefixes of a phone number: its digits from three on, and its last four. */\nfunction phoneTokens(phone: string | null | undefined): string[] {\n const digits = checkInPhoneDigits(phone).slice(0, 15)\n const tokens: string[] = []\n for (let at = 3; at <= digits.length; at += 1) tokens.push(digits.slice(0, at))\n // The last four, which is what a rider reads out at the window.\n if (digits.length >= 7) tokens.push(digits.slice(-4))\n return tokens\n}\n\n/** The tokens a check-in is found by. */\nexport function checkInSearchTokens(input: {\n name?: string | null\n email?: string | null\n phone?: string | null\n orderNumber?: number | null\n orderId?: string | null\n}): string[] {\n return [\n ...new Set([\n ...nameSearchTokens(input.name ?? ''),\n ...emailSearchTokens(input.email ?? ''),\n ...phoneTokens(input.phone),\n ...(input.orderId ? orderLabelTokens({ number: input.orderNumber ?? undefined }, input.orderId) : []),\n ]),\n ].slice(0, 200)\n}\n\n/**\n * What a typed search asks the index for: the phone's digits when it is a\n * number, else the first word's prefix (a name, an address, `#1042`).\n */\nexport function checkInSearchToken(typed: string): string {\n const value = String(typed ?? '').trim()\n if (!value) return ''\n if (/^[\\d\\s()+.-]+$/.test(value) && !value.startsWith('#')) {\n const digits = checkInPhoneDigits(value)\n return digits.length >= 3 ? digits.slice(0, 15) : ''\n }\n return nameSearchToken(value)\n}\n\n/** One key per customer: the address, else the contact, else the name, else the source. */\nexport function checkInCustomerKey(input: {\n email?: string | null\n contactId?: string | null\n name?: string | null\n fallback: string\n}): string {\n const email = text(input.email).toLowerCase()\n if (email) return `email:${email}`\n if (input.contactId) return `contact:${input.contactId}`\n const name = nameSearchKey(input.name ?? '')\n if (name) return `name:${name}`\n return input.fallback\n}\n\n/** A check-in's document id, from its unit's identity. */\nexport function orderCheckInId(orderId: string, lineIndex: number, unitIndex: number): string {\n return `o_${orderId}_${lineIndex}_${unitIndex}`\n}\n\nexport function reservationCheckInId(reservationId: string, dayKey: string, unitIndex = 0): string {\n return `r_${reservationId}_${dayKey}_${unitIndex}`\n}\n\n/** A due check-in before the server stamps its times and status. */\nexport type DueCheckIn = Omit<\n HostCheckIn,\n | 'status'\n | 'checkedInAtMs'\n | 'checkedInBy'\n | 'checkedInByName'\n | 'wristband'\n | 'checkInAttempt'\n | 'undoneAtMs'\n | 'undoneBy'\n | 'createdAtMs'\n | 'updatedAtMs'\n>\n\n/**\n * The fields a due check-in copies from its source, which a later read may\n * refresh: the customer's, and how many check-ins its line or stay makes that\n * day (a stay checked in per guest changes it when its guests or the store's\n * control change).\n */\nexport const CHECK_IN_CUSTOMER_FIELDS = [\n 'unitCount',\n 'customerKey',\n 'customerName',\n 'customerEmail',\n 'customerEmailLower',\n 'customerPhone',\n 'contactId',\n 'searchTokens',\n] as const\n\n/** Whether an order's lines are due at all. */\nexport function orderIsDueForCheckIn(order: Pick<HostOrder, 'status'> | null | undefined): boolean {\n return Boolean(order && (CHECK_IN_ORDER_STATUSES as readonly string[]).includes(String(order.status ?? '')))\n}\n\n/**\n * Every check-in an order makes, keyed by document id, each on its own day:\n * the day the buyer chose for its line (`useDayKey`), else `purchaseDayKey`,\n * the day the order was placed on the site's calendar. A caller working one\n * day keeps the entries whose `dayKey` is that day; the rest are still owed,\n * on theirs. `products` holds the products its lines name, as stored now:\n * the setting is read at the window, so turning it on covers passes already\n * sold today.\n */\nexport function dueCheckInsForOrder(input: {\n orderId: string\n order: Partial<HostOrder>\n products: ReadonlyMap<string, Parameters<typeof productCheckInFor>[0]>\n purchaseDayKey: string\n}): Map<string, DueCheckIn> {\n const { orderId, order, purchaseDayKey } = input\n const due = new Map<string, DueCheckIn>()\n if (!orderIsDueForCheckIn(order as HostOrder)) return due\n const refunded = new Set(Array.isArray(order.refundedLineItemIds) ? order.refundedLineItemIds : [])\n const contactId =\n order.customerRecord?.kind === 'contact' && order.customerRecord.id ? order.customerRecord.id : null\n const name = text(order.customerName) || null\n const email = text(order.customerEmail) || null\n const phone = text(order.customerPhone) || null\n const customerKey = checkInCustomerKey({ email, contactId, name, fallback: `order:${orderId}` })\n const searchTokens = checkInSearchTokens({ name, email, phone, orderNumber: order.number ?? null, orderId })\n const lines = Array.isArray(order.lineItems) ? order.lineItems : []\n lines.forEach((line, lineIndex) => {\n if (!line || refunded.has(lineIndex)) return\n const setting = productCheckInFor(input.products.get(line.productId) ?? null, line.variantId)\n if (!setting) return\n const quantity = Math.max(0, Math.round(Number(line.quantity) || 0))\n const unitCount = Math.min(quantity * setting.headcount, CHECK_IN_MAX_UNITS_PER_LINE)\n const dayKey = isCheckInDayKey(line.useDayKey) ? line.useDayKey : purchaseDayKey\n for (let unitIndex = 0; unitIndex < unitCount; unitIndex += 1) {\n due.set(orderCheckInId(orderId, lineIndex, unitIndex), {\n source: 'order',\n orderId,\n orderLabel: formatOrderNumber({ number: order.number }, orderId),\n channel: (order.channel ?? 'online') as OrderChannel,\n reservationId: null,\n lineIndex,\n unitIndex,\n unitCount,\n productId: line.productId ?? null,\n variantId: line.variantId ?? null,\n itemName: text(line.name) || 'Item',\n variantLabel: text(line.variantLabel) || null,\n dayKey,\n customerKey,\n customerName: name,\n customerEmail: email,\n customerEmailLower: email ? email.toLowerCase() : null,\n customerPhone: phone,\n contactId,\n searchTokens,\n })\n }\n })\n return due\n}\n\n/** UTC midnight of a `YYYY-MM-DD` day, as a stay's days are stored. */\nexport function checkInDayMs(dayKey: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(dayKey)\n if (!match) return null\n const ms = Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]))\n const check = new Date(ms)\n return check.getUTCDate() === Number(match[3]) && check.getUTCMonth() === Number(match[2]) - 1 ? ms : null\n}\n\n/** Where the store's stay check-in control lives (AGL-4043): `hosts/{hostId}/settings/checkIn.stays`. */\nexport const STAY_CHECK_IN_SETTINGS_DOC = 'checkIn'\n\n/** One stay's stored check-in on one day, as far as how many it needs goes. */\nexport interface StayCheckInSlot {\n id: string\n status: CheckInStatus\n unitIndex: number\n}\n\n/**\n * Which check-ins one stay keeps on one day when it needs `unitCount` of\n * them (AGL-4043): when staff change a stay's guests, or the store switches\n * between one check-in per stay and one per guest.\n *\n * A guest already checked in is never dropped, whatever their place: staff\n * check a family in in any order, so the third guest may be in while the\n * first is still on the way. The waiting ones fill what is left, lowest place\n * first, and the rest are dropped; new places are the lowest free ones.\n * `checkedIn` above `unitCount` is a count that cannot be honored without\n * taking back a check-in: the guests route refuses it, and a reconcile keeps\n * every checked-in guest and drops every waiting one.\n */\nexport function stayCheckInPlan(input: {\n unitCount: number\n existing: ReadonlyArray<StayCheckInSlot>\n}): {\n /** Every place the stay is due under that day: the checked-in, the waiting kept, the new. */\n unitIndexes: number[]\n /** New places to write. */\n create: number[]\n /** Waiting check-ins it no longer needs. */\n drop: string[]\n /** How many of its guests are checked in that day. */\n checkedIn: number\n} {\n const wanted = Math.max(0, Math.floor(Number(input.unitCount) || 0))\n const placeOf = (slot: StayCheckInSlot) => Math.max(0, Math.floor(Number(slot.unitIndex) || 0))\n const checkedIn = input.existing.filter((slot) => slot.status === 'checked_in')\n const waiting = input.existing\n .filter((slot) => slot.status !== 'checked_in')\n .sort((a, b) => placeOf(a) - placeOf(b) || a.id.localeCompare(b.id))\n const room = Math.max(0, wanted - checkedIn.length)\n const kept = waiting.slice(0, room)\n const used = new Set(input.existing.map(placeOf))\n const create: number[] = []\n for (let place = 0; create.length < room - kept.length; place += 1) {\n if (!used.has(place)) create.push(place)\n }\n return {\n unitIndexes: [...checkedIn.map(placeOf), ...kept.map(placeOf), ...create].sort((a, b) => a - b),\n create,\n drop: waiting.slice(room).map((slot) => slot.id),\n checkedIn: checkedIn.length,\n }\n}\n\n/** Stored check-ins of stays grouped by stay, as {@link stayCheckInPlan} reads them. */\nexport function storedStayCheckIns(\n docs: ReadonlyArray<{ id: string; get(field: string): unknown }>,\n): Map<string, StayCheckInSlot[]> {\n const byStay = new Map<string, StayCheckInSlot[]>()\n for (const doc of docs) {\n const reservationId = doc.get('reservationId')\n if (doc.get('source') !== 'reservation' || typeof reservationId !== 'string' || !reservationId) continue\n const slots = byStay.get(reservationId) ?? []\n slots.push({\n id: doc.id,\n status: doc.get('status') === 'checked_in' ? 'checked_in' : 'expected',\n unitIndex: Number(doc.get('unitIndex') ?? 0),\n })\n byStay.set(reservationId, slots)\n }\n return byStay\n}\n\n/**\n * The check-ins a stay makes on a day it covers; empty on any other day. One\n * per stay, or with `perGuest` one per guest (`guests`, at least one), each\n * with its own wristband: the resource's setting under the store's control\n * (`stayChecksInPerGuest`). Given the stay's check-ins already stored that\n * day (`existing`), its places follow {@link stayCheckInPlan}, so a guest\n * checked in is kept and a waiting one beyond the count is not due.\n */\nexport function dueCheckInsForReservation(input: {\n reservationId: string\n reservation: Partial<HostReservation>\n resourceName: string | null\n dayKey: string\n perGuest?: boolean\n existing?: ReadonlyArray<StayCheckInSlot>\n}): Map<string, DueCheckIn> {\n const { reservationId, reservation, dayKey } = input\n const due = new Map<string, DueCheckIn>()\n const dayMs = checkInDayMs(dayKey)\n if (\n dayMs === null ||\n !(CHECK_IN_RESERVATION_STATUSES as readonly string[]).includes(String(reservation.status ?? '')) ||\n !(Number(reservation.checkInDayMs) <= dayMs && dayMs < Number(reservation.checkOutDayMs))\n ) {\n return due\n }\n const name = text(reservation.guestName) || null\n const email = text(reservation.guestEmail) || null\n const unitCount = input.perGuest ? reservationGuests(reservation) : 1\n const customerKey = checkInCustomerKey({ email, name, fallback: `reservation:${reservationId}` })\n const searchTokens = checkInSearchTokens({ name, email })\n for (const unitIndex of stayCheckInPlan({ unitCount, existing: input.existing ?? [] }).unitIndexes) {\n due.set(reservationCheckInId(reservationId, dayKey, unitIndex), {\n source: 'reservation',\n orderId: null,\n orderLabel: null,\n channel: 'reservation',\n reservationId,\n lineIndex: null,\n unitIndex,\n unitCount,\n productId: null,\n variantId: null,\n itemName: text(input.resourceName) || 'Stay',\n variantLabel: null,\n dayKey,\n customerKey,\n customerName: name,\n customerEmail: email,\n customerEmailLower: email ? email.toLowerCase() : null,\n customerPhone: null,\n contactId: null,\n searchTokens,\n })\n }\n return due\n}\n\n/** A due check-in as first written. */\nexport function newCheckInDocument(due: DueCheckIn, nowMs: number): HostCheckIn {\n return {\n ...due,\n status: 'expected',\n checkedInAtMs: null,\n checkedInBy: null,\n checkedInByName: null,\n wristband: null,\n checkInAttempt: null,\n undoneAtMs: null,\n undoneBy: null,\n createdAtMs: nowMs,\n updatedAtMs: nowMs,\n }\n}\n\n/** The customer fields of a stored check-in that its source now says otherwise. */\nexport function changedCheckInCustomerFields(\n stored: Partial<HostCheckIn>,\n due: DueCheckIn,\n): Partial<DueCheckIn> | null {\n const patch: Record<string, unknown> = {}\n for (const field of CHECK_IN_CUSTOMER_FIELDS) {\n if (JSON.stringify(stored[field] ?? null) !== JSON.stringify(due[field] ?? null)) patch[field] = due[field]\n }\n return Object.keys(patch).length ? (patch as Partial<DueCheckIn>) : null\n}\n\n/*==========================================\n * WRISTBANDS, CUSTOMERS AND THE DAY\n *=========================================*/\n\n/**\n * A wristband as typed, made safe: a number (letters, digits, a dash) and a\n * color word, each optional. `null` with neither; an error for junk.\n */\nexport function normalizeWristband(\n value: unknown,\n): { ok: true; wristband: CheckInWristband | null } | { ok: false; error: string } {\n if (value === undefined || value === null || value === '') return { ok: true, wristband: null }\n if (typeof value !== 'object') return { ok: false, error: 'That is not a wristband.' }\n const raw = value as Record<string, unknown>\n const number = String(raw['number'] ?? '').trim()\n const color = String(raw['color'] ?? '').trim()\n if (number.length > CHECK_IN_WRISTBAND_MAX || color.length > CHECK_IN_WRISTBAND_MAX) {\n return { ok: false, error: `A wristband number or color is ${CHECK_IN_WRISTBAND_MAX} characters at most.` }\n }\n if (number && !/^[A-Za-z0-9#-]+$/.test(number)) {\n return { ok: false, error: 'A wristband number is letters, digits and dashes.' }\n }\n if (color && !/^[\\p{L} -]+$/u.test(color)) {\n return { ok: false, error: 'A wristband color is a word, such as Blue.' }\n }\n if (!number && !color) return { ok: true, wristband: null }\n return { ok: true, wristband: { number: number || null, color: color || null } }\n}\n\n/** A wristband as one line: \"Blue #214\". */\nexport function describeWristband(wristband: CheckInWristband | null | undefined): string {\n if (!wristband) return ''\n return [wristband.color, wristband.number ? `#${wristband.number.replace(/^#/, '')}` : null]\n .filter(Boolean)\n .join(' ')\n}\n\n/** The customers a set of check-ins is for, most due first, then by name. */\nexport function checkInCustomers(rows: ReadonlyArray<CheckInRow>): CheckInCustomer[] {\n const byKey = new Map<string, CheckInCustomer>()\n for (const row of rows) {\n const found = byKey.get(row.customerKey)\n const customer: CheckInCustomer = found ?? {\n customerKey: row.customerKey,\n name: row.customerName,\n email: row.customerEmail,\n phone: row.customerPhone,\n contactId: row.contactId,\n unitsDue: 0,\n unitsCheckedIn: 0,\n items: [],\n }\n customer.unitsDue += 1\n if (row.status === 'checked_in') customer.unitsCheckedIn += 1\n customer.name ||= row.customerName\n customer.email ||= row.customerEmail\n customer.phone ||= row.customerPhone\n customer.contactId ||= row.contactId\n if (!customer.items.includes(row.itemName)) customer.items.push(row.itemName)\n byKey.set(row.customerKey, customer)\n }\n return [...byKey.values()].sort(\n (a, b) =>\n b.unitsDue - b.unitsCheckedIn - (a.unitsDue - a.unitsCheckedIn) ||\n String(a.name ?? a.email ?? '').localeCompare(String(b.name ?? b.email ?? '')),\n )\n}\n\n/** A day's check-ins in the order the window reads them: by name, then item, then unit. */\nexport function sortCheckInRows<T extends Pick<CheckInRow, 'customerName' | 'customerEmail' | 'itemName' | 'unitIndex' | 'id'>>(\n rows: ReadonlyArray<T>,\n): T[] {\n return [...rows].sort(\n (a, b) =>\n String(a.customerName ?? a.customerEmail ?? '').localeCompare(String(b.customerName ?? b.customerEmail ?? '')) ||\n a.itemName.localeCompare(b.itemName) ||\n a.unitIndex - b.unitIndex ||\n a.id.localeCompare(b.id),\n )\n}\n\n/** Whether a check-in waits on an open rain check (not yet used). */\nexport function checkInRainCheckIsOpen(row: Pick<HostCheckIn, 'status' | 'rainCheckOpen'>): boolean {\n return row.rainCheckOpen === true && row.status === 'expected'\n}\n\nexport function checkInDayTotals(\n rows: ReadonlyArray<Pick<CheckInRow, 'status' | 'rainCheckOpen'>>,\n): CheckInDayTotals {\n const rainChecks = rows.filter((row) => checkInRainCheckIsOpen(row)).length\n return {\n expected: rows.length - rainChecks,\n checkedIn: rows.filter((row) => row.status === 'checked_in').length,\n rainChecks,\n }\n}\n\n/*==========================================\n * RAIN CHECKS\n *=========================================*/\n\n/**\n * Why a pass cannot be rain-checked as asked, or null. Only a pass bought as\n * an order line (a stay's dates change on the Reservations card), only while\n * nobody has used it, and a dated one only to a day after the one it is on\n * that has not passed (`todayKey` on the store's calendar).\n */\nexport function rainCheckProblem(\n row: Pick<HostCheckIn, 'source' | 'status' | 'dayKey'>,\n ask: { kind: 'open' | 'date'; dayKey?: string | null },\n todayKey: string,\n): string | null {\n if (row.source !== 'order') {\n return 'Only passes can be rain-checked. Change a stay’s dates on the Reservations card.'\n }\n if (row.status !== 'expected') return 'They are already checked in. Undo the check-in first.'\n if (ask.kind === 'open') return null\n const day = ask.dayKey\n if (!isCheckInDayKey(day)) return 'Choose the new day as a date.'\n if (day <= row.dayKey) return 'Choose a day after the one the pass is on.'\n return checkInUseDayProblem(day, todayKey)\n}\n\n/** What the window says about a pass's rain check: \"Rain check from Sat, Oct 25\". */\nexport function rainCheckLabel(row: Pick<HostCheckIn, 'rainCheck' | 'rainCheckOpen' | 'status'>): string {\n const rainCheck = row.rainCheck\n if (!rainCheck) return ''\n const from = checkInDayLabel(rainCheck.fromDayKey)\n if (rainCheck.kind === 'date') return `Rain check: moved from ${from} to ${checkInDayLabel(rainCheck.toDayKey)}`\n if (rainCheck.claimedDayKey) return `Rain check from ${from}, used ${checkInDayLabel(rainCheck.claimedDayKey)}`\n return `Rain check from ${from}: good on any later day`\n}\n\n/** The check-in's status in words: \"Checked in\", \"Expected\" or \"Rain check\". */\nexport function checkInStatusLabel(row: Pick<HostCheckIn, 'status' | 'rainCheckOpen'>): string {\n if (row.status === 'checked_in') return 'Checked in'\n return checkInRainCheckIsOpen(row) ? 'Rain check' : 'Expected'\n}\n\n/** The day after `dayKey`: the first day an open rain check is good on. */\nexport function checkInNextDay(dayKey: string): string {\n return addCheckInDays(dayKey, 1)\n}\n\n/** A time on the site's clock: \"9:14 AM\". */\nexport function checkInTimeLabel(ms: number | null | undefined, timeZone: string): string {\n if (!ms) return ''\n try {\n return new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit', timeZone }).format(new Date(ms))\n } catch {\n return new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: '2-digit' }).format(new Date(ms))\n }\n}\n\n/** \"Already checked in at 9:14 AM by Sam\". */\nexport function alreadyCheckedInLabel(row: Pick<CheckInRow, 'checkedInAtMs' | 'checkedInByName'>, timeZone: string): string {\n const at = checkInTimeLabel(row.checkedInAtMs, timeZone)\n return `Already checked in${at ? ` at ${at}` : ''}${row.checkedInByName ? ` by ${row.checkedInByName}` : ''}`\n}\n\n/** One person's line, as the list and the spreadsheet name it: \"Day pass · Adult (2 of 3)\". */\nexport function checkInItemLabel(row: Pick<CheckInRow, 'itemName' | 'variantLabel' | 'unitIndex' | 'unitCount'>): string {\n const item = row.variantLabel ? `${row.itemName} · ${row.variantLabel}` : row.itemName\n // A guest checked in before their stay's count came down keeps their place,\n // which can lie past the new count: no \"4 of 2\".\n return row.unitCount > 1 && row.unitIndex < row.unitCount\n ? `${item} (${row.unitIndex + 1} of ${row.unitCount})`\n : item\n}\n\n/** The day's check-ins as a spreadsheet, one row per person. */\nexport function checkInDayCsv(rows: ReadonlyArray<CheckInRow>, timeZone: string): string {\n const header = [\n 'Day',\n 'Name',\n 'Email',\n 'Phone',\n 'Item',\n 'Order',\n 'Status',\n 'Checked in at',\n 'Checked in by',\n 'Wristband number',\n 'Wristband color',\n 'Rain check',\n ]\n const lines = sortCheckInRows(rows).map((row) =>\n [\n row.dayKey,\n row.customerName ?? '',\n row.customerEmail ?? '',\n row.customerPhone ?? '',\n checkInItemLabel(row),\n row.orderLabel ?? (row.source === 'reservation' ? 'Stay' : ''),\n checkInStatusLabel(row),\n checkInTimeLabel(row.checkedInAtMs, timeZone),\n row.checkedInByName ?? '',\n row.wristband?.number ?? '',\n row.wristband?.color ?? '',\n rainCheckLabel(row),\n ]\n .map(posCsvCell)\n .join(','),\n )\n return [header.map(posCsvCell).join(','), ...lines].join('\\n') + '\\n'\n}\n"],"names":["addCheckInDays","checkInDayLabel","checkInUseDayProblem","isCheckInDayKey","normalizeProductCheckIn","emailSearchTokens","nameSearchKey","nameSearchToken","nameSearchTokens","formatOrderNumber","reservationGuests","posCsvCell","orderLabelTokens","CHECK_IN_BATCH_MAX","CHECK_IN_WRISTBAND_COLORS","CHECK_IN_WRISTBAND_MAX","POS_CHECK_IN_ROUTE","CHECK_IN_MAX_HEADCOUNT","CHECK_IN_USE_DAY_MAX_AHEAD_DAYS","productCheckInProblem","CHECK_IN_MAX_UNITS_PER_LINE","CHECK_IN_DAY_CEILING","CHECK_IN_SEARCH_ROWS","CHECK_IN_SEARCH_CUSTOMERS","CHECK_IN_ORDER_STATUSES","CHECK_IN_RESERVATION_STATUSES","productCheckInFor","product","variantId","setting","variant","variants","find","one","id","checkIn","enabled","headcount","askUseDate","productAsksUseDate","productNeedsCheckIn","length","some","text","value","trim","checkInPhoneDigits","phone","digits","String","replace","startsWith","slice","phoneTokens","tokens","at","push","checkInSearchTokens","input","Set","name","email","orderId","number","orderNumber","undefined","checkInSearchToken","typed","test","checkInCustomerKey","toLowerCase","contactId","fallback","orderCheckInId","lineIndex","unitIndex","reservationCheckInId","reservationId","dayKey","CHECK_IN_CUSTOMER_FIELDS","orderIsDueForCheckIn","order","Boolean","includes","status","dueCheckInsForOrder","purchaseDayKey","due","Map","refunded","Array","isArray","refundedLineItemIds","customerRecord","kind","customerName","customerEmail","customerPhone","customerKey","searchTokens","lines","lineItems","forEach","line","has","products","get","productId","quantity","Math","max","round","Number","unitCount","min","useDayKey","set","source","orderLabel","channel","itemName","variantLabel","customerEmailLower","checkInDayMs","match","exec","ms","Date","UTC","check","getUTCDate","getUTCMonth","STAY_CHECK_IN_SETTINGS_DOC","stayCheckInPlan","wanted","floor","placeOf","slot","checkedIn","existing","filter","waiting","sort","a","b","localeCompare","room","kept","used","map","create","place","unitIndexes","drop","storedStayCheckIns","docs","byStay","doc","slots","dueCheckInsForReservation","reservation","dayMs","checkOutDayMs","guestName","guestEmail","perGuest","resourceName","newCheckInDocument","nowMs","checkedInAtMs","checkedInBy","checkedInByName","wristband","checkInAttempt","undoneAtMs","undoneBy","createdAtMs","updatedAtMs","changedCheckInCustomerFields","stored","patch","field","JSON","stringify","Object","keys","normalizeWristband","raw","ok","error","color","describeWristband","join","checkInCustomers","rows","byKey","row","customer","found","unitsDue","unitsCheckedIn","items","values","sortCheckInRows","checkInRainCheckIsOpen","rainCheckOpen","checkInDayTotals","rainChecks","expected","rainCheckProblem","ask","todayKey","day","rainCheckLabel","rainCheck","from","fromDayKey","toDayKey","claimedDayKey","checkInStatusLabel","checkInNextDay","checkInTimeLabel","timeZone","Intl","DateTimeFormat","hour","minute","format","alreadyCheckedInLabel","checkInItemLabel","item","checkInDayCsv","header"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GACD,SACEA,cAAc,EACdC,eAAe,EACfC,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,QAClB,iCAA6B;AACpC,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SACEC,aAAa,EACbC,eAAe,EACfC,gBAAgB,QACX,qCAAoC;AAE3C,SACEC,iBAAiB,QAGZ,uBAAmB;AAC1B,SAASC,iBAAiB,QAA8B,6BAAyB;AACjF,SAASC,UAAU,QAAQ,wBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,yBAAqB;AAEtD,4EAA4E;AAC5E,SACEC,kBAAkB,EAClBC,yBAAyB,EACzBC,sBAAsB,EACtBC,kBAAkB,QAQb,gCAA4B;AACnC,SACED,sBAAsB,QAOjB,gCAA4B;AAEnC,mFAAmF;AACnF,SACEf,cAAc,EACdC,eAAe,EACfgB,sBAAsB,EACtBC,+BAA+B,EAC/BhB,oBAAoB,EACpBC,eAAe,EACfC,uBAAuB,EACvBe,qBAAqB,QAEhB,iCAA6B;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAoC2C,GAE3C,oEAAoE,GACpE,OAAO,MAAMC,8BAA8B,IAAG;AAE9C,uDAAuD,GACvD,OAAO,MAAMC,uBAAuB,KAAI;AAExC,6CAA6C,GAC7C,OAAO,MAAMC,uBAAuB,IAAG;AAEvC,2CAA2C,GAC3C,OAAO,MAAMC,4BAA4B,GAAE;AAE3C,qDAAqD,GACrD,OAAO,MAAMC,0BAA0B;IAAC;IAAQ;IAAuB;IAAa;CAAY,CAAS;AAEzG,0CAA0C,GAC1C,OAAO,MAAMC,gCAAgC;IAAC;IAAa;CAAa,CAAS;AAEjF;;2CAE2C,GAE3C;;;CAGC,GACD,OAAO,SAASC,kBACdC,OAA+H,EAC/HC,SAAoC;QAGnBD,mBACDvB,0BACuByB;IAHvC,IA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,KAAK,gBAAgB,SAAS;YAC3DsG,mBAAmBvB;YACnByB,iBAAiBzB,IAAI3B,aAAa,EAAEqD;aACpC1B,uBAAAA,IAAIzB,eAAe,YAAnByB,uBAAuB;qBACvBA,iBAAAA,IAAIxB,SAAS,qBAAbwB,eAAerI,MAAM,mBAAI;sBACzBqI,kBAAAA,IAAIxB,SAAS,qBAAbwB,gBAAeN,KAAK,oBAAI;YACxBuB,eAAejB;SAChB,CACE/C,GAAG,CAAC1I,YACJqL,IAAI,CAAC;;IAEV,OAAO;QAACwC,OAAOnF,GAAG,CAAC1I,YAAYqL,IAAI,CAAC;WAAS5F;KAAM,CAAC4F,IAAI,CAAC,QAAQ;AACnE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
* Whether the self-service kiosk offers a product, or one of its variants
|
|
19
|
+
* (AGL-4038). Only an explicit `false` turns either off, so a product stored
|
|
20
|
+
* before the choice existed is offered exactly as it was. A variant is
|
|
21
|
+
* offered only when its product is: the product's choice is the outer one.
|
|
22
|
+
* Nothing here is about a kind of product — what any merchant sells is
|
|
23
|
+
* theirs to put on the kiosk or keep off it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function productOfferedOnKiosk(product: {
|
|
26
|
+
offerOnKiosk?: unknown;
|
|
27
|
+
variants?: ReadonlyArray<{
|
|
28
|
+
id: string;
|
|
29
|
+
offerOnKiosk?: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
} | null | undefined, variantId?: string | null): boolean;
|