@aglyn/plugins-commerce 1.0.0-beta.284 → 1.0.0-beta.287
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/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 +11 -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 +67 -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/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 +29 -0
- package/src/lib/server/commerce-site-keys.js +40 -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/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 +15 -4
- package/src/lib/server/pos-ops-gate.js +42 -9
- 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-return.d.ts +10 -0
- package/src/lib/server/pos-return.js +26 -1
- 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 +25 -20
- 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 +34 -11
- 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
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ /**
|
|
18
|
+
* The POS hardware shop's sales on the operator's sales tax return (AGL-4038).
|
|
19
|
+
*
|
|
20
|
+
* The operator is the seller of record for every card reader order, so these
|
|
21
|
+
* are its OWN sales, unlike the storefront's facilitated ones beside them.
|
|
22
|
+
* They FOLD INTO the filing figures (Items 1–2 for Texas) as the operator's
|
|
23
|
+
* own sales outside its invoices, through the contract's `operatorSales`:
|
|
24
|
+
*
|
|
25
|
+
* - **sold online from the shop** — on the platform's own account — under
|
|
26
|
+
* "Card reader shop (online)";
|
|
27
|
+
* - **sold in person** at the operator's own store's register: already in
|
|
28
|
+
* that store's register sale, which the own-stores section folds in
|
|
29
|
+
* (`own-store-tax-return-source.ts`), so NOT again here. Only a sale whose
|
|
30
|
+
* store is not one of the operator's own (the store was moved, or no
|
|
31
|
+
* workspace is named as the operator's own) is folded in from its record
|
|
32
|
+
* here, and a review finding says so.
|
|
33
|
+
*
|
|
34
|
+
* This card states, worded for the filing jurisdiction:
|
|
35
|
+
*
|
|
36
|
+
* - **every card reader sale by ship-to state** (in person: where the store
|
|
37
|
+
* is), with the refunds of the period beside them — the figure an
|
|
38
|
+
* economic-nexus threshold elsewhere is measured against;
|
|
39
|
+
* - **every order in the period** in the working papers, each with where it
|
|
40
|
+
* is folded in.
|
|
41
|
+
*
|
|
42
|
+
* Truncation and rows no period can reach are reported, and the platform
|
|
43
|
+
* raises each as a blocking finding of its own.
|
|
44
|
+
*/ import { firebaseAdmin } from "@aglyn/tenant-data-admin";
|
|
45
|
+
import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
46
|
+
import { centsToDollars } from "@aglyn/aglyn/app-utils/tax-jurisdiction-figures";
|
|
47
|
+
import { POS_HARDWARE_SALES_COLLECTION } from "../model/pos-hardware.js";
|
|
48
|
+
import { posHardwareRefundStamp, posHardwareRowInPeriod, posHardwareTaxableBase, posHardwareTaxSummary } from "../model/pos-hardware-tax-summary.js";
|
|
49
|
+
/** The section's id, unique on the return. */ export const POS_HARDWARE_TAX_SECTION_ID = 'posHardware';
|
|
50
|
+
/** The part the shop's online sales fold into the filing figures under. */ export const POS_HARDWARE_SHOP_PART_ID = 'posHardwareShop';
|
|
51
|
+
/** The part an in-person sale at a store that is not the operator's own folds in under. */ export const POS_HARDWARE_IN_PERSON_PART_ID = 'posHardwareInPerson';
|
|
52
|
+
/** Where one retained sale record folds into the filing figures. See the module note. */ export function posHardwareFoldedAs(row, options = {}) {
|
|
53
|
+
var _options_ownHostIds;
|
|
54
|
+
if (row.source !== 'in_person') return 'shop';
|
|
55
|
+
const host = typeof row.posHostId === 'string' ? row.posHostId : '';
|
|
56
|
+
return host && ((_options_ownHostIds = options.ownHostIds) == null ? void 0 : _options_ownHostIds.has(host)) ? 'store register sale' : 'in-person record';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The operator's own hardware sales the filing figures fold in from this
|
|
60
|
+
* section: the shop's online sales, and any in-person sale whose store is not
|
|
61
|
+
* the operator's own. Every figure is the summary's own math over that part's
|
|
62
|
+
* records, so the card and the figures cannot disagree.
|
|
63
|
+
*/ export function posHardwareOperatorSales(rows, period, options = {}) {
|
|
64
|
+
const parts = [
|
|
65
|
+
{
|
|
66
|
+
id: POS_HARDWARE_SHOP_PART_ID,
|
|
67
|
+
label: 'Card reader shop (online)',
|
|
68
|
+
foldedAs: 'shop'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: POS_HARDWARE_IN_PERSON_PART_ID,
|
|
72
|
+
label: 'Card readers sold in person (store not read)',
|
|
73
|
+
foldedAs: 'in-person record'
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
return parts.flatMap(({ id, label, foldedAs })=>{
|
|
77
|
+
const summary = posHardwareTaxSummary(rows.filter((row)=>posHardwareFoldedAs(row, options) === foldedAs), period);
|
|
78
|
+
const byJurisdiction = Object.fromEntries(Object.entries(summary.byJurisdiction).map(([jurisdiction, figures])=>[
|
|
79
|
+
jurisdiction,
|
|
80
|
+
{
|
|
81
|
+
transactionCount: figures.transactionCount,
|
|
82
|
+
totalSalesCents: figures.totalSalesCents,
|
|
83
|
+
taxableSalesCents: figures.taxableSalesCents,
|
|
84
|
+
taxCollectedCents: figures.taxCollectedCents,
|
|
85
|
+
refundCount: figures.refundedOrders,
|
|
86
|
+
refundedSalesCents: figures.refundedSalesCents,
|
|
87
|
+
refundedTaxCents: figures.refundedTaxCents
|
|
88
|
+
}
|
|
89
|
+
]));
|
|
90
|
+
// The shop's part is always stated, so its zero is a figure; an empty
|
|
91
|
+
// in-person part is simply not there.
|
|
92
|
+
return foldedAs === 'shop' || Object.keys(byJurisdiction).length ? [
|
|
93
|
+
{
|
|
94
|
+
id,
|
|
95
|
+
label,
|
|
96
|
+
byJurisdiction
|
|
97
|
+
}
|
|
98
|
+
] : [];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const isoOrNull = (value)=>value === null ? null : new Date(value).toISOString();
|
|
102
|
+
const numberOrNull = (value)=>typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
103
|
+
const textOrNull = (value)=>typeof value === 'string' && value ? value : null;
|
|
104
|
+
const emptyFigures = ()=>({
|
|
105
|
+
transactionCount: 0,
|
|
106
|
+
totalSalesCents: 0,
|
|
107
|
+
taxableSalesCents: 0,
|
|
108
|
+
taxCollectedCents: 0,
|
|
109
|
+
taxabilityReasons: {},
|
|
110
|
+
rates: [],
|
|
111
|
+
untaxedOrders: 0,
|
|
112
|
+
refundedOrders: 0,
|
|
113
|
+
refundedSalesCents: 0,
|
|
114
|
+
refundedTaxCents: 0
|
|
115
|
+
});
|
|
116
|
+
/** The filing jurisdiction's hardware figures, or zeros when none sold there. */ export function posHardwareFilingFigures(summary, filing) {
|
|
117
|
+
var _summary_byJurisdiction_filing_code;
|
|
118
|
+
return (_summary_byJurisdiction_filing_code = summary.byJurisdiction[filing.code]) != null ? _summary_byJurisdiction_filing_code : emptyFigures();
|
|
119
|
+
}
|
|
120
|
+
/** The section's findings. The platform raises the non-zero ones. */ export function posHardwareTaxFindings(summary, filing, operatorSales = []) {
|
|
121
|
+
var _ref;
|
|
122
|
+
const brand = PLATFORM_BRAND_NAME;
|
|
123
|
+
const figures = posHardwareFilingFigures(summary, filing);
|
|
124
|
+
const unread = operatorSales.find((part)=>part.id === POS_HARDWARE_IN_PERSON_PART_ID);
|
|
125
|
+
return [
|
|
126
|
+
{
|
|
127
|
+
// REVIEW: the sales ARE in the figures, from their hardware records;
|
|
128
|
+
// the rest of that store's sales are not, because it is not one of the
|
|
129
|
+
// operator's own stores.
|
|
130
|
+
id: 'posHardwareInPersonStoreNotRead',
|
|
131
|
+
severity: 'review',
|
|
132
|
+
count: Object.values((_ref = unread == null ? void 0 : unread.byJurisdiction) != null ? _ref : {}).reduce((sum, part)=>sum + part.transactionCount, 0),
|
|
133
|
+
label: `Card readers sold in person at a store that is not one of ${brand}’s own`,
|
|
134
|
+
detail: `Folded into ${filing.figuresName} from their hardware records. The store that sold them is not a ` + `site of the workspace named as ${brand}’s own (POS_HARDWARE_SELLER_ORG_ID), so its other sales are ` + 'not in the figures. Name the workspace, or check the store was moved on purpose.'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'posHardwareUntaxed',
|
|
138
|
+
severity: 'review',
|
|
139
|
+
count: figures.untaxedOrders,
|
|
140
|
+
label: `Card reader hardware sold into ${filing.label} without tax`,
|
|
141
|
+
detail: 'Sold while Stripe Tax was off for the hardware shop, so no tax was ' + `collected. If the sale was taxable in ${filing.label}, the tax is ` + `still owed, out of ${brand}’s receipt.`
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'posHardwareMissingTaxableBase',
|
|
145
|
+
severity: 'review',
|
|
146
|
+
count: summary.attention.ordersMissingTaxableBase,
|
|
147
|
+
label: 'Card reader hardware orders with tax but no stated base',
|
|
148
|
+
detail: 'Tax was collected but Stripe’s taxable_amount was not recorded on the ' + 'order, so the hardware taxable-sales line understates the base. Read ' + 'the Checkout Session in Stripe with the tax breakdown expanded.'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'posHardwareMissingShipTo',
|
|
152
|
+
severity: 'review',
|
|
153
|
+
count: summary.attention.ordersMissingShipTo,
|
|
154
|
+
label: 'Card reader hardware orders with no ship-to region',
|
|
155
|
+
detail: 'Listed as Not stated, and in no state’s figures. If the order shipped ' + `to ${filing.label}, the hardware lines understate its sales.`
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: 'posHardwareCanceledWithoutRefund',
|
|
159
|
+
severity: 'review',
|
|
160
|
+
count: summary.attention.canceledWithoutRefund,
|
|
161
|
+
label: 'Canceled card reader hardware orders with no refund recorded',
|
|
162
|
+
detail: 'Counted as sales: the order is marked canceled or refunded, but no ' + 'refund was recorded on it. Check the payment in Stripe.'
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
/** Every ship-to state, the filing jurisdiction first, then by sales. */ export function posHardwareJurisdictionRows(summary, filing) {
|
|
167
|
+
return Object.entries(summary.byJurisdiction).map(([jurisdiction, figures])=>({
|
|
168
|
+
jurisdiction,
|
|
169
|
+
isFilingJurisdiction: jurisdiction === filing.code,
|
|
170
|
+
orders: figures.transactionCount,
|
|
171
|
+
totalSalesCents: figures.totalSalesCents,
|
|
172
|
+
taxableSalesCents: figures.taxableSalesCents,
|
|
173
|
+
taxCollectedCents: figures.taxCollectedCents,
|
|
174
|
+
refundedOrders: figures.refundedOrders,
|
|
175
|
+
refundedSalesCents: figures.refundedSalesCents,
|
|
176
|
+
refundedTaxCents: figures.refundedTaxCents
|
|
177
|
+
})).sort((a, b)=>Number(b.isFilingJurisdiction) - Number(a.isFilingJurisdiction) || b.totalSalesCents - a.totalSalesCents || a.jurisdiction.localeCompare(b.jurisdiction));
|
|
178
|
+
}
|
|
179
|
+
const dollars = (centsValue)=>`$${centsToDollars(centsValue)}`;
|
|
180
|
+
function posHardwareTables(summary, filing) {
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
description: 'Sales by where each order shipped, which is where its sales tax is ' + 'sourced, and the refunds made in this period beside them. A state ' + 'other than the one filed here is the figure an economic-nexus ' + 'threshold there is measured against.',
|
|
184
|
+
columns: [
|
|
185
|
+
{
|
|
186
|
+
label: 'Ship-to state'
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: 'Orders',
|
|
190
|
+
numeric: true
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: 'Total sales',
|
|
194
|
+
numeric: true,
|
|
195
|
+
money: true
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
label: 'Taxable sales',
|
|
199
|
+
numeric: true,
|
|
200
|
+
money: true
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: 'Tax collected',
|
|
204
|
+
numeric: true,
|
|
205
|
+
money: true
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: 'Refunded in period',
|
|
209
|
+
numeric: true,
|
|
210
|
+
money: true
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
label: 'Tax refunded',
|
|
214
|
+
numeric: true,
|
|
215
|
+
money: true
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
rows: posHardwareJurisdictionRows(summary, filing).map((row)=>({
|
|
219
|
+
key: row.jurisdiction,
|
|
220
|
+
cells: [
|
|
221
|
+
_extends({
|
|
222
|
+
text: row.jurisdiction === 'unknown' ? 'Not stated' : row.jurisdiction
|
|
223
|
+
}, row.isFilingJurisdiction ? {
|
|
224
|
+
tag: {
|
|
225
|
+
label: 'Registered',
|
|
226
|
+
tone: 'attention'
|
|
227
|
+
}
|
|
228
|
+
} : {}, row.refundedOrders ? {
|
|
229
|
+
caption: `${row.refundedOrders} refund${row.refundedOrders === 1 ? '' : 's'} in this period`
|
|
230
|
+
} : {}),
|
|
231
|
+
{
|
|
232
|
+
text: String(row.orders)
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
text: dollars(row.totalSalesCents),
|
|
236
|
+
strong: row.isFilingJurisdiction
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
text: dollars(row.taxableSalesCents)
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
text: dollars(row.taxCollectedCents)
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
text: dollars(row.refundedSalesCents)
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
text: dollars(row.refundedTaxCents)
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
})),
|
|
252
|
+
empty: 'No card reader hardware was sold or refunded in this period.',
|
|
253
|
+
footnote: 'Every card reader sale, online and in person. The online ones are folded into the filing figures ' + 'as “Card reader shop (online)”; one sold in person is in its store’s register sale there. ' + 'Test-mode orders are in no figure. A refund is counted in the period it was made, whenever the ' + 'order was paid.'
|
|
254
|
+
}
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
function posHardwareFigures(summary) {
|
|
258
|
+
const figures = [
|
|
259
|
+
{
|
|
260
|
+
label: 'Orders paid in this period',
|
|
261
|
+
value: String(summary.orders),
|
|
262
|
+
note: 'Every ship-to state. Live orders only.'
|
|
263
|
+
}
|
|
264
|
+
];
|
|
265
|
+
if (summary.excluded.testModeOrders) {
|
|
266
|
+
figures.push({
|
|
267
|
+
label: 'Test-mode orders left out',
|
|
268
|
+
value: String(summary.excluded.testModeOrders),
|
|
269
|
+
note: 'Made with Stripe’s test keys, so not sales: in no figure above.'
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
return figures;
|
|
273
|
+
}
|
|
274
|
+
/** One record as the working papers carry it, for an order the period counts. */ function projectRow(row, period, options) {
|
|
275
|
+
var _row_totalCents, _row_taxCents, _row_refundedCents;
|
|
276
|
+
var _row_shipTo, _row_shipTo1;
|
|
277
|
+
const placed = posHardwareRowInPeriod(row, period);
|
|
278
|
+
const total = Number((_row_totalCents = row.totalCents) != null ? _row_totalCents : 0) || 0;
|
|
279
|
+
const tax = Number((_row_taxCents = row.taxCents) != null ? _row_taxCents : 0) || 0;
|
|
280
|
+
return {
|
|
281
|
+
orderId: row.orderId,
|
|
282
|
+
paidAt: isoOrNull(numberOrNull(row.paidAtMs)),
|
|
283
|
+
status: textOrNull(row.status),
|
|
284
|
+
state: textOrNull((_row_shipTo = row.shipTo) == null ? void 0 : _row_shipTo.state),
|
|
285
|
+
country: textOrNull((_row_shipTo1 = row.shipTo) == null ? void 0 : _row_shipTo1.country),
|
|
286
|
+
totalSalesCents: total - tax,
|
|
287
|
+
taxableSalesCents: posHardwareTaxableBase(Array.isArray(row.taxLines) ? row.taxLines : []),
|
|
288
|
+
taxCents: tax,
|
|
289
|
+
refundedCents: Number((_row_refundedCents = row.refundedCents) != null ? _row_refundedCents : 0) || 0,
|
|
290
|
+
refundedAt: isoOrNull(posHardwareRefundStamp(row)),
|
|
291
|
+
inPeriodAs: placed.sale && placed.refund ? 'sale and refund' : placed.sale ? 'sale' : 'refund',
|
|
292
|
+
foldedAs: posHardwareFoldedAs(row, options)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function posHardwareExports(summary, filing, rows) {
|
|
296
|
+
const brand = PLATFORM_BRAND_NAME;
|
|
297
|
+
const states = posHardwareJurisdictionRows(summary, filing);
|
|
298
|
+
return [
|
|
299
|
+
{
|
|
300
|
+
placement: 'jurisdictions',
|
|
301
|
+
rows: [
|
|
302
|
+
[
|
|
303
|
+
`Card reader hardware — ${brand}’s OWN sales by ship-to state (folded into the filing figures above, by source)`
|
|
304
|
+
],
|
|
305
|
+
[
|
|
306
|
+
'Ship-to state',
|
|
307
|
+
'Orders',
|
|
308
|
+
'Total sales (USD)',
|
|
309
|
+
'Taxable sales (USD)',
|
|
310
|
+
'Tax collected (USD)',
|
|
311
|
+
'Refunded in period (USD)',
|
|
312
|
+
'Tax refunded (USD)'
|
|
313
|
+
],
|
|
314
|
+
...states.length ? states.map((row)=>[
|
|
315
|
+
row.jurisdiction,
|
|
316
|
+
String(row.orders),
|
|
317
|
+
centsToDollars(row.totalSalesCents),
|
|
318
|
+
centsToDollars(row.taxableSalesCents),
|
|
319
|
+
centsToDollars(row.taxCollectedCents),
|
|
320
|
+
centsToDollars(row.refundedSalesCents),
|
|
321
|
+
centsToDollars(row.refundedTaxCents)
|
|
322
|
+
]) : [
|
|
323
|
+
[
|
|
324
|
+
'—',
|
|
325
|
+
'0',
|
|
326
|
+
'0.00',
|
|
327
|
+
'0.00',
|
|
328
|
+
'0.00',
|
|
329
|
+
'0.00',
|
|
330
|
+
'0.00'
|
|
331
|
+
]
|
|
332
|
+
]
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
placement: 'sections',
|
|
337
|
+
rows: [
|
|
338
|
+
[
|
|
339
|
+
'Card reader hardware orders in this period (posHardwareSales) — folded into the filing figures as each says'
|
|
340
|
+
],
|
|
341
|
+
[
|
|
342
|
+
'Order',
|
|
343
|
+
'Paid (UTC)',
|
|
344
|
+
'Status',
|
|
345
|
+
'Ship-to state',
|
|
346
|
+
'Country',
|
|
347
|
+
'Total sales (USD)',
|
|
348
|
+
'Taxable sales (USD)',
|
|
349
|
+
'Tax collected (USD)',
|
|
350
|
+
'Refunded (USD)',
|
|
351
|
+
'Refunded at (UTC)',
|
|
352
|
+
'In this period as',
|
|
353
|
+
'Folded in as'
|
|
354
|
+
],
|
|
355
|
+
...rows.map((row)=>{
|
|
356
|
+
var _row_paidAt, _row_status, _row_state, _row_country, _row_refundedAt;
|
|
357
|
+
return [
|
|
358
|
+
row.orderId,
|
|
359
|
+
(_row_paidAt = row.paidAt) != null ? _row_paidAt : '',
|
|
360
|
+
(_row_status = row.status) != null ? _row_status : '',
|
|
361
|
+
(_row_state = row.state) != null ? _row_state : '',
|
|
362
|
+
(_row_country = row.country) != null ? _row_country : '',
|
|
363
|
+
centsToDollars(row.totalSalesCents),
|
|
364
|
+
row.taxableSalesCents === null ? 'not stated' : centsToDollars(row.taxableSalesCents),
|
|
365
|
+
centsToDollars(row.taxCents),
|
|
366
|
+
centsToDollars(row.refundedCents),
|
|
367
|
+
(_row_refundedAt = row.refundedAt) != null ? _row_refundedAt : '',
|
|
368
|
+
row.inPeriodAs,
|
|
369
|
+
row.foldedAs === 'shop' ? 'Card reader shop (online)' : row.foldedAs === 'store register sale' ? 'its store’s register sale' : 'Card readers sold in person (store not read)'
|
|
370
|
+
];
|
|
371
|
+
})
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The hardware section for one period, from records already read. Pure, so
|
|
378
|
+
* the section a preparer reads can be proved from fixtures.
|
|
379
|
+
*/ export function posHardwareTaxReturnAnswer(read, request, options = {}) {
|
|
380
|
+
const brand = PLATFORM_BRAND_NAME;
|
|
381
|
+
const { filing } = request;
|
|
382
|
+
const period = {
|
|
383
|
+
start: request.start,
|
|
384
|
+
end: request.end
|
|
385
|
+
};
|
|
386
|
+
const summary = posHardwareTaxSummary(read.rows, period);
|
|
387
|
+
const operatorSales = posHardwareOperatorSales(read.rows, period, options);
|
|
388
|
+
const seen = new Set();
|
|
389
|
+
const rows = read.rows.filter((row)=>{
|
|
390
|
+
if (!(row == null ? void 0 : row.orderId) || seen.has(row.orderId) || row.livemode !== true) return false;
|
|
391
|
+
seen.add(row.orderId);
|
|
392
|
+
const placed = posHardwareRowInPeriod(row, period);
|
|
393
|
+
return placed.sale || placed.refund;
|
|
394
|
+
}).map((row)=>projectRow(row, period, options));
|
|
395
|
+
return {
|
|
396
|
+
id: POS_HARDWARE_TAX_SECTION_ID,
|
|
397
|
+
name: 'Card reader hardware',
|
|
398
|
+
title: `Card reader hardware — ${brand}’s own sales`,
|
|
399
|
+
help: `Card readers and accessories ${brand} sold to workspaces, online from the POS hardware shop and ` + `in person at its own store. ${brand} is the seller, so these are its own sales, folded into the ` + 'filing figures above.',
|
|
400
|
+
intro: `${brand} is the seller of record for every card reader order, so these are ` + `${brand}’s OWN sales, not facilitated ones, and they are folded into ${filing.figuresName}: ` + 'the online ones as “Card reader shop (online)”, one sold in person in its store’s register sale. ' + 'Refunds are counted in the period they were made and never netted.',
|
|
401
|
+
truncated: read.truncated,
|
|
402
|
+
undatedRows: read.undatedRows,
|
|
403
|
+
findings: posHardwareTaxFindings(summary, filing, operatorSales),
|
|
404
|
+
filingLines: [],
|
|
405
|
+
operatorSales,
|
|
406
|
+
tables: posHardwareTables(summary, filing),
|
|
407
|
+
figures: posHardwareFigures(summary),
|
|
408
|
+
exports: posHardwareExports(summary, filing, rows),
|
|
409
|
+
summary,
|
|
410
|
+
rows
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Reads the period's hardware records and answers for them.
|
|
415
|
+
*
|
|
416
|
+
* Three range queries, because a record counts in a period two ways — paid
|
|
417
|
+
* in it, or refunded in it (by the stamp of the status that refunded it) —
|
|
418
|
+
* and a fourth, the honesty check: a range query cannot match a record whose
|
|
419
|
+
* `paidAtMs` is null, so those are counted over all of them and the platform
|
|
420
|
+
* blocks the return on any. Each is a single-field range, served by
|
|
421
|
+
* Firestore's automatic index. A query that reaches the row cap marks the
|
|
422
|
+
* section truncated, and the platform blocks on that too.
|
|
423
|
+
*/ export async function readPosHardwareTaxReturn(request, options = {}) {
|
|
424
|
+
var _undated_data_count;
|
|
425
|
+
const collection = firebaseAdmin.app().firestore().collection(POS_HARDWARE_SALES_COLLECTION);
|
|
426
|
+
const startMs = request.start.getTime();
|
|
427
|
+
const endMs = request.end.getTime();
|
|
428
|
+
const inRange = (field)=>collection.where(field, '>=', startMs).where(field, '<', endMs).limit(request.rowCap + 1).get();
|
|
429
|
+
const [paid, refunded, canceled, undated] = await Promise.all([
|
|
430
|
+
inRange('paidAtMs'),
|
|
431
|
+
inRange('refundedAtMs'),
|
|
432
|
+
inRange('canceledAtMs'),
|
|
433
|
+
collection.where('paidAtMs', '==', null).count().get()
|
|
434
|
+
]);
|
|
435
|
+
const byId = new Map();
|
|
436
|
+
for (const snapshot of [
|
|
437
|
+
paid,
|
|
438
|
+
refunded,
|
|
439
|
+
canceled
|
|
440
|
+
]){
|
|
441
|
+
for (const doc of snapshot.docs.slice(0, request.rowCap)){
|
|
442
|
+
if (!byId.has(doc.id)) {
|
|
443
|
+
byId.set(doc.id, _extends({}, doc.data(), {
|
|
444
|
+
orderId: doc.id
|
|
445
|
+
}));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return posHardwareTaxReturnAnswer({
|
|
450
|
+
rows: [
|
|
451
|
+
...byId.values()
|
|
452
|
+
],
|
|
453
|
+
truncated: [
|
|
454
|
+
paid,
|
|
455
|
+
refunded,
|
|
456
|
+
canceled
|
|
457
|
+
].some((snapshot)=>snapshot.size > request.rowCap),
|
|
458
|
+
undatedRows: Number((_undated_data_count = undated.data().count) != null ? _undated_data_count : 0)
|
|
459
|
+
}, request, options);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
//# sourceMappingURL=pos-hardware-tax-return-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/pos-hardware-tax-return-source.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The POS hardware shop's sales on the operator's sales tax return (AGL-4038).\n *\n * The operator is the seller of record for every card reader order, so these\n * are its OWN sales, unlike the storefront's facilitated ones beside them.\n * They FOLD INTO the filing figures (Items 1–2 for Texas) as the operator's\n * own sales outside its invoices, through the contract's `operatorSales`:\n *\n * - **sold online from the shop** — on the platform's own account — under\n * \"Card reader shop (online)\";\n * - **sold in person** at the operator's own store's register: already in\n * that store's register sale, which the own-stores section folds in\n * (`own-store-tax-return-source.ts`), so NOT again here. Only a sale whose\n * store is not one of the operator's own (the store was moved, or no\n * workspace is named as the operator's own) is folded in from its record\n * here, and a review finding says so.\n *\n * This card states, worded for the filing jurisdiction:\n *\n * - **every card reader sale by ship-to state** (in person: where the store\n * is), with the refunds of the period beside them — the figure an\n * economic-nexus threshold elsewhere is measured against;\n * - **every order in the period** in the working papers, each with where it\n * is folded in.\n *\n * Truncation and rows no period can reach are reported, and the platform\n * raises each as a blocking finding of its own.\n */\n\nimport { firebaseAdmin } from '@aglyn/tenant-data-admin'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { centsToDollars } from '@aglyn/aglyn/app-utils/tax-jurisdiction-figures'\nimport type {\n TaxReturnExportBlock,\n TaxReturnFiling,\n TaxReturnFinding,\n TaxReturnOperatorSalesPart,\n TaxReturnSectionFigure,\n TaxReturnSectionTable,\n TaxReturnSourceAnswer,\n TaxReturnSourceRequest,\n} from '@aglyn/aglyn/plugin-manager/plugin-tax-return-sources'\nimport { POS_HARDWARE_SALES_COLLECTION } from '../model/pos-hardware'\nimport {\n posHardwareRefundStamp,\n posHardwareRowInPeriod,\n posHardwareTaxableBase,\n posHardwareTaxSummary,\n type PosHardwareTaxJurisdiction,\n type PosHardwareTaxRowInput,\n type PosHardwareTaxSummary,\n} from '../model/pos-hardware-tax-summary'\n\n/** The section's id, unique on the return. */\nexport const POS_HARDWARE_TAX_SECTION_ID = 'posHardware'\n\n/** The part the shop's online sales fold into the filing figures under. */\nexport const POS_HARDWARE_SHOP_PART_ID = 'posHardwareShop'\n/** The part an in-person sale at a store that is not the operator's own folds in under. */\nexport const POS_HARDWARE_IN_PERSON_PART_ID = 'posHardwareInPerson'\n\n/** Where an order is folded into the filing figures. */\nexport type PosHardwareFoldedAs = 'shop' | 'store register sale' | 'in-person record'\n\n/** Who decides where a record folds in: the operator's own stores, by site id. */\nexport interface PosHardwareFoldOptions {\n /** The sites of the operator's own stores, whose register sales the own-stores section folds in. */\n ownHostIds?: ReadonlySet<string>\n}\n\n/** Where one retained sale record folds into the filing figures. See the module note. */\nexport function posHardwareFoldedAs(\n row: Pick<PosHardwareTaxRowInput, 'source' | 'posHostId'>,\n options: PosHardwareFoldOptions = {},\n): PosHardwareFoldedAs {\n if (row.source !== 'in_person') return 'shop'\n const host = typeof row.posHostId === 'string' ? row.posHostId : ''\n return host && options.ownHostIds?.has(host) ? 'store register sale' : 'in-person record'\n}\n\n/**\n * The operator's own hardware sales the filing figures fold in from this\n * section: the shop's online sales, and any in-person sale whose store is not\n * the operator's own. Every figure is the summary's own math over that part's\n * records, so the card and the figures cannot disagree.\n */\nexport function posHardwareOperatorSales(\n rows: readonly PosHardwareTaxRowInput[],\n period: { start: Date; end: Date },\n options: PosHardwareFoldOptions = {},\n): TaxReturnOperatorSalesPart[] {\n const parts: Array<{ id: string; label: string; foldedAs: PosHardwareFoldedAs }> = [\n { id: POS_HARDWARE_SHOP_PART_ID, label: 'Card reader shop (online)', foldedAs: 'shop' },\n {\n id: POS_HARDWARE_IN_PERSON_PART_ID,\n label: 'Card readers sold in person (store not read)',\n foldedAs: 'in-person record',\n },\n ]\n return parts.flatMap(({ id, label, foldedAs }) => {\n const summary = posHardwareTaxSummary(\n rows.filter((row) => posHardwareFoldedAs(row, options) === foldedAs),\n period,\n )\n const byJurisdiction = Object.fromEntries(\n Object.entries(summary.byJurisdiction).map(([jurisdiction, figures]) => [\n jurisdiction,\n {\n transactionCount: figures.transactionCount,\n totalSalesCents: figures.totalSalesCents,\n taxableSalesCents: figures.taxableSalesCents,\n taxCollectedCents: figures.taxCollectedCents,\n refundCount: figures.refundedOrders,\n refundedSalesCents: figures.refundedSalesCents,\n refundedTaxCents: figures.refundedTaxCents,\n },\n ]),\n )\n // The shop's part is always stated, so its zero is a figure; an empty\n // in-person part is simply not there.\n return foldedAs === 'shop' || Object.keys(byJurisdiction).length ? [{ id, label, byJurisdiction }] : []\n })\n}\n\n/** One order as the working papers carry it: amounts and the region, no buyer. */\nexport interface PosHardwareTaxRow {\n orderId: string\n paidAt: string | null\n status: string | null\n state: string | null\n country: string | null\n totalSalesCents: number\n taxableSalesCents: number | null\n taxCents: number\n refundedCents: number\n refundedAt: string | null\n /** How the order counts in this period. */\n inPeriodAs: 'sale' | 'refund' | 'sale and refund'\n /** Where it is folded into the filing figures. */\n foldedAs: PosHardwareFoldedAs\n}\n\nconst isoOrNull = (value: number | null): string | null =>\n value === null ? null : new Date(value).toISOString()\n\nconst numberOrNull = (value: unknown): number | null =>\n typeof value === 'number' && Number.isFinite(value) ? value : null\n\nconst textOrNull = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null\n\nconst emptyFigures = (): PosHardwareTaxJurisdiction => ({\n transactionCount: 0,\n totalSalesCents: 0,\n taxableSalesCents: 0,\n taxCollectedCents: 0,\n taxabilityReasons: {},\n rates: [],\n untaxedOrders: 0,\n refundedOrders: 0,\n refundedSalesCents: 0,\n refundedTaxCents: 0,\n})\n\n/** The filing jurisdiction's hardware figures, or zeros when none sold there. */\nexport function posHardwareFilingFigures(\n summary: PosHardwareTaxSummary,\n filing: TaxReturnFiling,\n): PosHardwareTaxJurisdiction {\n return summary.byJurisdiction[filing.code] ?? emptyFigures()\n}\n\n/** The section's findings. The platform raises the non-zero ones. */\nexport function posHardwareTaxFindings(\n summary: PosHardwareTaxSummary,\n filing: TaxReturnFiling,\n operatorSales: readonly TaxReturnOperatorSalesPart[] = [],\n): TaxReturnFinding[] {\n const brand = PLATFORM_BRAND_NAME\n const figures = posHardwareFilingFigures(summary, filing)\n const unread = operatorSales.find((part) => part.id === POS_HARDWARE_IN_PERSON_PART_ID)\n return [\n {\n // REVIEW: the sales ARE in the figures, from their hardware records;\n // the rest of that store's sales are not, because it is not one of the\n // operator's own stores.\n id: 'posHardwareInPersonStoreNotRead',\n severity: 'review',\n count: Object.values(unread?.byJurisdiction ?? {}).reduce((sum, part) => sum + part.transactionCount, 0),\n label: `Card readers sold in person at a store that is not one of ${brand}’s own`,\n detail:\n `Folded into ${filing.figuresName} from their hardware records. The store that sold them is not a ` +\n `site of the workspace named as ${brand}’s own (POS_HARDWARE_SELLER_ORG_ID), so its other sales are ` +\n 'not in the figures. Name the workspace, or check the store was moved on purpose.',\n },\n {\n id: 'posHardwareUntaxed',\n severity: 'review',\n count: figures.untaxedOrders,\n label: `Card reader hardware sold into ${filing.label} without tax`,\n detail:\n 'Sold while Stripe Tax was off for the hardware shop, so no tax was ' +\n `collected. If the sale was taxable in ${filing.label}, the tax is ` +\n `still owed, out of ${brand}’s receipt.`,\n },\n {\n id: 'posHardwareMissingTaxableBase',\n severity: 'review',\n count: summary.attention.ordersMissingTaxableBase,\n label: 'Card reader hardware orders with tax but no stated base',\n detail:\n 'Tax was collected but Stripe’s taxable_amount was not recorded on the ' +\n 'order, so the hardware taxable-sales line understates the base. Read ' +\n 'the Checkout Session in Stripe with the tax breakdown expanded.',\n },\n {\n id: 'posHardwareMissingShipTo',\n severity: 'review',\n count: summary.attention.ordersMissingShipTo,\n label: 'Card reader hardware orders with no ship-to region',\n detail:\n 'Listed as Not stated, and in no state’s figures. If the order shipped ' +\n `to ${filing.label}, the hardware lines understate its sales.`,\n },\n {\n id: 'posHardwareCanceledWithoutRefund',\n severity: 'review',\n count: summary.attention.canceledWithoutRefund,\n label: 'Canceled card reader hardware orders with no refund recorded',\n detail:\n 'Counted as sales: the order is marked canceled or refunded, but no ' +\n 'refund was recorded on it. Check the payment in Stripe.',\n },\n ]\n}\n\n/** One ship-to state's row, ready to print. */\nexport interface PosHardwareJurisdictionRow {\n jurisdiction: string\n isFilingJurisdiction: boolean\n orders: number\n totalSalesCents: number\n taxableSalesCents: number\n taxCollectedCents: number\n refundedOrders: number\n refundedSalesCents: number\n refundedTaxCents: number\n}\n\n/** Every ship-to state, the filing jurisdiction first, then by sales. */\nexport function posHardwareJurisdictionRows(\n summary: PosHardwareTaxSummary,\n filing: TaxReturnFiling,\n): PosHardwareJurisdictionRow[] {\n return Object.entries(summary.byJurisdiction)\n .map(([jurisdiction, figures]) => ({\n jurisdiction,\n isFilingJurisdiction: jurisdiction === filing.code,\n orders: figures.transactionCount,\n totalSalesCents: figures.totalSalesCents,\n taxableSalesCents: figures.taxableSalesCents,\n taxCollectedCents: figures.taxCollectedCents,\n refundedOrders: figures.refundedOrders,\n refundedSalesCents: figures.refundedSalesCents,\n refundedTaxCents: figures.refundedTaxCents,\n }))\n .sort(\n (a, b) =>\n Number(b.isFilingJurisdiction) - Number(a.isFilingJurisdiction) ||\n b.totalSalesCents - a.totalSalesCents ||\n a.jurisdiction.localeCompare(b.jurisdiction),\n )\n}\n\nconst dollars = (centsValue: number) => `$${centsToDollars(centsValue)}`\n\nfunction posHardwareTables(summary: PosHardwareTaxSummary, filing: TaxReturnFiling): TaxReturnSectionTable[] {\n return [\n {\n description:\n 'Sales by where each order shipped, which is where its sales tax is ' +\n 'sourced, and the refunds made in this period beside them. A state ' +\n 'other than the one filed here is the figure an economic-nexus ' +\n 'threshold there is measured against.',\n columns: [\n { label: 'Ship-to state' },\n { label: 'Orders', numeric: true },\n { label: 'Total sales', numeric: true, money: true },\n { label: 'Taxable sales', numeric: true, money: true },\n { label: 'Tax collected', numeric: true, money: true },\n { label: 'Refunded in period', numeric: true, money: true },\n { label: 'Tax refunded', numeric: true, money: true },\n ],\n rows: posHardwareJurisdictionRows(summary, filing).map((row) => ({\n key: row.jurisdiction,\n cells: [\n {\n text: row.jurisdiction === 'unknown' ? 'Not stated' : row.jurisdiction,\n ...(row.isFilingJurisdiction ? { tag: { label: 'Registered', tone: 'attention' as const } } : {}),\n ...(row.refundedOrders\n ? { caption: `${row.refundedOrders} refund${row.refundedOrders === 1 ? '' : 's'} in this period` }\n : {}),\n },\n { text: String(row.orders) },\n { text: dollars(row.totalSalesCents), strong: row.isFilingJurisdiction },\n { text: dollars(row.taxableSalesCents) },\n { text: dollars(row.taxCollectedCents) },\n { text: dollars(row.refundedSalesCents) },\n { text: dollars(row.refundedTaxCents) },\n ],\n })),\n empty: 'No card reader hardware was sold or refunded in this period.',\n footnote:\n 'Every card reader sale, online and in person. The online ones are folded into the filing figures ' +\n 'as “Card reader shop (online)”; one sold in person is in its store’s register sale there. ' +\n 'Test-mode orders are in no figure. A refund is counted in the period it was made, whenever the ' +\n 'order was paid.',\n },\n ]\n}\n\nfunction posHardwareFigures(summary: PosHardwareTaxSummary): TaxReturnSectionFigure[] {\n const figures: TaxReturnSectionFigure[] = [\n {\n label: 'Orders paid in this period',\n value: String(summary.orders),\n note: 'Every ship-to state. Live orders only.',\n },\n ]\n if (summary.excluded.testModeOrders) {\n figures.push({\n label: 'Test-mode orders left out',\n value: String(summary.excluded.testModeOrders),\n note: 'Made with Stripe’s test keys, so not sales: in no figure above.',\n })\n }\n return figures\n}\n\n/** One record as the working papers carry it, for an order the period counts. */\nfunction projectRow(\n row: PosHardwareTaxRowInput,\n period: { start: Date; end: Date },\n options: PosHardwareFoldOptions,\n): PosHardwareTaxRow {\n const placed = posHardwareRowInPeriod(row, period)\n const total = Number(row.totalCents ?? 0) || 0\n const tax = Number(row.taxCents ?? 0) || 0\n return {\n orderId: row.orderId,\n paidAt: isoOrNull(numberOrNull(row.paidAtMs)),\n status: textOrNull(row.status),\n state: textOrNull(row.shipTo?.state),\n country: textOrNull(row.shipTo?.country),\n totalSalesCents: total - tax,\n taxableSalesCents: posHardwareTaxableBase(Array.isArray(row.taxLines) ? row.taxLines : []),\n taxCents: tax,\n refundedCents: Number(row.refundedCents ?? 0) || 0,\n refundedAt: isoOrNull(posHardwareRefundStamp(row)),\n inPeriodAs: placed.sale && placed.refund ? 'sale and refund' : placed.sale ? 'sale' : 'refund',\n foldedAs: posHardwareFoldedAs(row, options),\n }\n}\n\nfunction posHardwareExports(\n summary: PosHardwareTaxSummary,\n filing: TaxReturnFiling,\n rows: readonly PosHardwareTaxRow[],\n): TaxReturnExportBlock[] {\n const brand = PLATFORM_BRAND_NAME\n const states = posHardwareJurisdictionRows(summary, filing)\n return [\n {\n placement: 'jurisdictions',\n rows: [\n [`Card reader hardware — ${brand}’s OWN sales by ship-to state (folded into the filing figures above, by source)`],\n [\n 'Ship-to state',\n 'Orders',\n 'Total sales (USD)',\n 'Taxable sales (USD)',\n 'Tax collected (USD)',\n 'Refunded in period (USD)',\n 'Tax refunded (USD)',\n ],\n ...(states.length\n ? states.map((row) => [\n row.jurisdiction,\n String(row.orders),\n centsToDollars(row.totalSalesCents),\n centsToDollars(row.taxableSalesCents),\n centsToDollars(row.taxCollectedCents),\n centsToDollars(row.refundedSalesCents),\n centsToDollars(row.refundedTaxCents),\n ])\n : [['—', '0', '0.00', '0.00', '0.00', '0.00', '0.00']]),\n ],\n },\n {\n placement: 'sections',\n rows: [\n ['Card reader hardware orders in this period (posHardwareSales) — folded into the filing figures as each says'],\n [\n 'Order',\n 'Paid (UTC)',\n 'Status',\n 'Ship-to state',\n 'Country',\n 'Total sales (USD)',\n 'Taxable sales (USD)',\n 'Tax collected (USD)',\n 'Refunded (USD)',\n 'Refunded at (UTC)',\n 'In this period as',\n 'Folded in as',\n ],\n ...rows.map((row) => [\n row.orderId,\n row.paidAt ?? '',\n row.status ?? '',\n row.state ?? '',\n row.country ?? '',\n centsToDollars(row.totalSalesCents),\n row.taxableSalesCents === null ? 'not stated' : centsToDollars(row.taxableSalesCents),\n centsToDollars(row.taxCents),\n centsToDollars(row.refundedCents),\n row.refundedAt ?? '',\n row.inPeriodAs,\n row.foldedAs === 'shop'\n ? 'Card reader shop (online)'\n : row.foldedAs === 'store register sale'\n ? 'its store’s register sale'\n : 'Card readers sold in person (store not read)',\n ]),\n ],\n },\n ]\n}\n\n/**\n * The hardware section for one period, from records already read. Pure, so\n * the section a preparer reads can be proved from fixtures.\n */\nexport function posHardwareTaxReturnAnswer(\n read: { rows: readonly PosHardwareTaxRowInput[]; truncated: boolean; undatedRows: number },\n request: TaxReturnSourceRequest,\n options: PosHardwareFoldOptions = {},\n): TaxReturnSourceAnswer {\n const brand = PLATFORM_BRAND_NAME\n const { filing } = request\n const period = { start: request.start, end: request.end }\n const summary = posHardwareTaxSummary(read.rows, period)\n const operatorSales = posHardwareOperatorSales(read.rows, period, options)\n const seen = new Set<string>()\n const rows = read.rows\n .filter((row) => {\n if (!row?.orderId || seen.has(row.orderId) || row.livemode !== true) return false\n seen.add(row.orderId)\n const placed = posHardwareRowInPeriod(row, period)\n return placed.sale || placed.refund\n })\n .map((row) => projectRow(row, period, options))\n return {\n id: POS_HARDWARE_TAX_SECTION_ID,\n name: 'Card reader hardware',\n title: `Card reader hardware — ${brand}’s own sales`,\n help:\n `Card readers and accessories ${brand} sold to workspaces, online from the POS hardware shop and ` +\n `in person at its own store. ${brand} is the seller, so these are its own sales, folded into the ` +\n 'filing figures above.',\n intro:\n `${brand} is the seller of record for every card reader order, so these are ` +\n `${brand}’s OWN sales, not facilitated ones, and they are folded into ${filing.figuresName}: ` +\n 'the online ones as “Card reader shop (online)”, one sold in person in its store’s register sale. ' +\n 'Refunds are counted in the period they were made and never netted.',\n truncated: read.truncated,\n undatedRows: read.undatedRows,\n findings: posHardwareTaxFindings(summary, filing, operatorSales),\n filingLines: [],\n operatorSales,\n tables: posHardwareTables(summary, filing),\n figures: posHardwareFigures(summary),\n exports: posHardwareExports(summary, filing, rows),\n summary,\n rows,\n }\n}\n\n/**\n * Reads the period's hardware records and answers for them.\n *\n * Three range queries, because a record counts in a period two ways — paid\n * in it, or refunded in it (by the stamp of the status that refunded it) —\n * and a fourth, the honesty check: a range query cannot match a record whose\n * `paidAtMs` is null, so those are counted over all of them and the platform\n * blocks the return on any. Each is a single-field range, served by\n * Firestore's automatic index. A query that reaches the row cap marks the\n * section truncated, and the platform blocks on that too.\n */\nexport async function readPosHardwareTaxReturn(\n request: TaxReturnSourceRequest,\n options: PosHardwareFoldOptions = {},\n): Promise<TaxReturnSourceAnswer> {\n const collection = firebaseAdmin.app().firestore().collection(POS_HARDWARE_SALES_COLLECTION)\n const startMs = request.start.getTime()\n const endMs = request.end.getTime()\n const inRange = (field: string) =>\n collection.where(field, '>=', startMs).where(field, '<', endMs).limit(request.rowCap + 1).get()\n const [paid, refunded, canceled, undated] = await Promise.all([\n inRange('paidAtMs'),\n inRange('refundedAtMs'),\n inRange('canceledAtMs'),\n collection.where('paidAtMs', '==', null).count().get(),\n ])\n const byId = new Map<string, PosHardwareTaxRowInput>()\n for (const snapshot of [paid, refunded, canceled]) {\n for (const doc of snapshot.docs.slice(0, request.rowCap)) {\n if (!byId.has(doc.id)) {\n byId.set(doc.id, { ...(doc.data() as Omit<PosHardwareTaxRowInput, 'orderId'>), orderId: doc.id })\n }\n }\n }\n return posHardwareTaxReturnAnswer(\n {\n rows: [...byId.values()],\n truncated: [paid, refunded, canceled].some((snapshot) => snapshot.size > request.rowCap),\n undatedRows: Number(undated.data().count ?? 0),\n },\n request,\n options,\n )\n}\n"],"names":["firebaseAdmin","PLATFORM_BRAND_NAME","centsToDollars","POS_HARDWARE_SALES_COLLECTION","posHardwareRefundStamp","posHardwareRowInPeriod","posHardwareTaxableBase","posHardwareTaxSummary","POS_HARDWARE_TAX_SECTION_ID","POS_HARDWARE_SHOP_PART_ID","POS_HARDWARE_IN_PERSON_PART_ID","posHardwareFoldedAs","row","options","source","host","posHostId","ownHostIds","has","posHardwareOperatorSales","rows","period","parts","id","label","foldedAs","flatMap","summary","filter","byJurisdiction","Object","fromEntries","entries","map","jurisdiction","figures","transactionCount","totalSalesCents","taxableSalesCents","taxCollectedCents","refundCount","refundedOrders","refundedSalesCents","refundedTaxCents","keys","length","isoOrNull","value","Date","toISOString","numberOrNull","Number","isFinite","textOrNull","emptyFigures","taxabilityReasons","rates","untaxedOrders","posHardwareFilingFigures","filing","code","posHardwareTaxFindings","operatorSales","brand","unread","find","part","severity","count","values","reduce","sum","detail","figuresName","attention","ordersMissingTaxableBase","ordersMissingShipTo","canceledWithoutRefund","posHardwareJurisdictionRows","isFilingJurisdiction","orders","sort","a","b","localeCompare","dollars","centsValue","posHardwareTables","description","columns","numeric","money","key","cells","text","tag","tone","caption","String","strong","empty","footnote","posHardwareFigures","note","excluded","testModeOrders","push","projectRow","placed","total","totalCents","tax","taxCents","orderId","paidAt","paidAtMs","status","state","shipTo","country","Array","isArray","taxLines","refundedCents","refundedAt","inPeriodAs","sale","refund","posHardwareExports","states","placement","posHardwareTaxReturnAnswer","read","request","start","end","seen","Set","livemode","add","name","title","help","intro","truncated","undatedRows","findings","filingLines","tables","exports","readPosHardwareTaxReturn","undated","collection","app","firestore","startMs","getTime","endMs","inRange","field","where","limit","rowCap","get","paid","refunded","canceled","Promise","all","byId","Map","snapshot","doc","docs","slice","set","data","some","size"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SAASA,aAAa,QAAQ,2BAA0B;AACxD,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,cAAc,QAAQ,kDAAiD;AAWhF,SAASC,6BAA6B,QAAQ,2BAAuB;AACrE,SACEC,sBAAsB,EACtBC,sBAAsB,EACtBC,sBAAsB,EACtBC,qBAAqB,QAIhB,uCAAmC;AAE1C,4CAA4C,GAC5C,OAAO,MAAMC,8BAA8B,cAAa;AAExD,yEAAyE,GACzE,OAAO,MAAMC,4BAA4B,kBAAiB;AAC1D,yFAAyF,GACzF,OAAO,MAAMC,iCAAiC,sBAAqB;AAWnE,uFAAuF,GACvF,OAAO,SAASC,oBACdC,GAAyD,EACzDC,UAAkC,CAAC,CAAC;QAIrBA;IAFf,IAAID,IAAIE,MAAM,KAAK,aAAa,OAAO;IACvC,MAAMC,OAAO,OAAOH,IAAII,SAAS,KAAK,WAAWJ,IAAII,SAAS,GAAG;IACjE,OAAOD,UAAQF,sBAAAA,QAAQI,UAAU,qBAAlBJ,oBAAoBK,GAAG,CAACH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B,MAAM,EAAG;YACxD,IAAI,CAACO,KAAKvJ,GAAG,CAAC0J,IAAIrJ,EAAE,GAAG;gBACrBkJ,KAAKM,GAAG,CAACH,IAAIrJ,EAAE,EAAE,aAAMqJ,IAAII,IAAI;oBAAgD/D,SAAS2D,IAAIrJ,EAAE;;YAChG;QACF;IACF;IACA,OAAO4G,2BACL;QACE/G,MAAM;eAAIqJ,KAAKpG,MAAM;SAAG;QACxB2E,WAAW;YAACoB;YAAMC;YAAUC;SAAS,CAACW,IAAI,CAAC,CAACN,WAAaA,SAASO,IAAI,GAAG7C,QAAQ6B,MAAM;QACvFjB,aAAa9F,QAAOoG,sBAAAA,QAAQyB,IAAI,GAAG5G,KAAK,YAApBmF,sBAAwB;IAC9C,GACAlB,SACAxH;AAEJ"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { PosHardwareInPersonConfig } from '../model/pos-hardware';
|
|
18
|
+
import { type PosHardwareTermsAcceptance } from '../model/pos-hardware-terms';
|
|
19
|
+
export declare class PosHardwareTermsRefusal extends Error {
|
|
20
|
+
readonly status: number;
|
|
21
|
+
constructor(message: string, status: number);
|
|
22
|
+
}
|
|
23
|
+
/** What the buyer reads: the version, the sections, the link and the summary. */
|
|
24
|
+
export declare function posHardwareTermsView(): {
|
|
25
|
+
version: string;
|
|
26
|
+
sections: string;
|
|
27
|
+
url: string;
|
|
28
|
+
summary: string[];
|
|
29
|
+
};
|
|
30
|
+
/** The device a request came from, as an acceptance records it. */
|
|
31
|
+
export declare function posHardwareTermsDevice(headers: Record<string, unknown>): {
|
|
32
|
+
ip: string | null;
|
|
33
|
+
userAgent: string | null;
|
|
34
|
+
};
|
|
35
|
+
/** The sale's items and total, for the screen the buyer accepts on. */
|
|
36
|
+
export declare function posHardwareTermsSale(config: PosHardwareInPersonConfig, registerOrderId: string): Promise<{
|
|
37
|
+
items: string[];
|
|
38
|
+
acceptance: PosHardwareTermsAcceptance | null;
|
|
39
|
+
}>;
|
|
40
|
+
/** Whether the buyer has accepted, for the register waiting on the display. */
|
|
41
|
+
export declare function posHardwareTermsStatus(config: PosHardwareInPersonConfig, registerOrderId: string): Promise<{
|
|
42
|
+
acceptance: PosHardwareTermsAcceptance | null;
|
|
43
|
+
}>;
|
|
44
|
+
/** Notes who put the terms on the display, so the display's acceptance names them. */
|
|
45
|
+
export declare function requestPosHardwareTermsOnDisplay(input: {
|
|
46
|
+
config: PosHardwareInPersonConfig;
|
|
47
|
+
registerOrderId: string;
|
|
48
|
+
uid: string;
|
|
49
|
+
now?: number;
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Records the buyer's acceptance on the register sale and on its hardware
|
|
53
|
+
* order when there is one, in one transaction. The first electronic
|
|
54
|
+
* acceptance stands; answers the acceptance that holds.
|
|
55
|
+
*/
|
|
56
|
+
export declare function recordPosHardwareTermsAcceptance(input: {
|
|
57
|
+
config: PosHardwareInPersonConfig;
|
|
58
|
+
registerOrderId: string;
|
|
59
|
+
method: 'tablet' | 'display';
|
|
60
|
+
staffUid: string | null;
|
|
61
|
+
ip: string | null;
|
|
62
|
+
userAgent: string | null;
|
|
63
|
+
now?: number;
|
|
64
|
+
}): Promise<PosHardwareTermsAcceptance>;
|