@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.
Files changed (420) hide show
  1. package/README.md +1 -1
  2. package/package.json +13 -13
  3. package/src/lib/components/cart.js +25 -12
  4. package/src/lib/components/cart.js.map +1 -1
  5. package/src/lib/components/commerce-console-page.js +70 -13
  6. package/src/lib/components/commerce-console-page.js.map +1 -1
  7. package/src/lib/components/console/order-detail-dialog.component.js +2 -1
  8. package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
  9. package/src/lib/components/console/payment-methods-card.component.js +1 -1
  10. package/src/lib/components/console/payment-methods-card.component.js.map +1 -1
  11. package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +5 -0
  12. package/src/lib/components/console/pos/pos-cart-panel.component.js +18 -12
  13. package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -1
  14. package/src/lib/components/console/pos/pos-hardware-api.d.ts +76 -5
  15. package/src/lib/components/console/pos/pos-hardware-api.js +53 -11
  16. package/src/lib/components/console/pos/pos-hardware-api.js.map +1 -1
  17. package/src/lib/components/console/pos/pos-hardware-buyer.component.d.ts +18 -0
  18. package/src/lib/components/console/pos/pos-hardware-buyer.component.js +629 -0
  19. package/src/lib/components/console/pos/pos-hardware-buyer.component.js.map +1 -0
  20. package/src/lib/components/console/pos/pos-hardware-sale-api.d.ts +162 -0
  21. package/src/lib/components/console/pos/pos-hardware-sale-api.js +122 -0
  22. package/src/lib/components/console/pos/pos-hardware-sale-api.js.map +1 -0
  23. package/src/lib/components/console/pos/pos-hardware-sale-terms.component.d.ts +39 -0
  24. package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js +251 -0
  25. package/src/lib/components/console/pos/pos-hardware-sale-terms.component.js.map +1 -0
  26. package/src/lib/components/console/pos/use-pos-display.js +50 -0
  27. package/src/lib/components/console/pos/use-pos-display.js.map +1 -1
  28. package/src/lib/components/console/pos-cellular-control.component.d.ts +41 -0
  29. package/src/lib/components/console/pos-cellular-control.component.js +211 -0
  30. package/src/lib/components/console/pos-cellular-control.component.js.map +1 -0
  31. package/src/lib/components/console/pos-devices-card.component.d.ts +9 -1
  32. package/src/lib/components/console/pos-devices-card.component.js +47 -15
  33. package/src/lib/components/console/pos-devices-card.component.js.map +1 -1
  34. package/src/lib/components/console/pos-display/pos-display-api.d.ts +6 -0
  35. package/src/lib/components/console/pos-display/pos-display-api.js +8 -1
  36. package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -1
  37. package/src/lib/components/console/pos-display-page.component.d.ts +13 -0
  38. package/src/lib/components/console/pos-display-page.component.js +44 -2
  39. package/src/lib/components/console/pos-display-page.component.js.map +1 -1
  40. package/src/lib/components/console/pos-hardware-card.component.d.ts +12 -4
  41. package/src/lib/components/console/pos-hardware-card.component.js +157 -36
  42. package/src/lib/components/console/pos-hardware-card.component.js.map +1 -1
  43. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js +360 -80
  44. package/src/lib/components/console/pos-hardware-orders-staff-page.component.js.map +1 -1
  45. package/src/lib/components/console/pos-hardware-terms-page.component.d.ts +34 -0
  46. package/src/lib/components/console/pos-hardware-terms-page.component.js +257 -0
  47. package/src/lib/components/console/pos-hardware-terms-page.component.js.map +1 -0
  48. package/src/lib/components/console/pos-hardware-terms-sign-page.component.d.ts +27 -0
  49. package/src/lib/components/console/pos-hardware-terms-sign-page.component.js +104 -0
  50. package/src/lib/components/console/pos-hardware-terms-sign-page.component.js.map +1 -0
  51. package/src/lib/components/console/pos-hardware-waiting-card.component.d.ts +24 -0
  52. package/src/lib/components/console/pos-hardware-waiting-card.component.js +205 -0
  53. package/src/lib/components/console/pos-hardware-waiting-card.component.js.map +1 -0
  54. package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js +297 -201
  55. package/src/lib/components/console/pos-ops/pos-check-in-dialog.component.js.map +1 -1
  56. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.d.ts +3 -0
  57. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js +260 -92
  58. package/src/lib/components/console/pos-ops/pos-check-ins-card.component.js.map +1 -1
  59. package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +9 -0
  60. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +15 -6
  61. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -1
  62. package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.d.ts +25 -0
  63. package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js +136 -0
  64. package/src/lib/components/console/pos-ops/pos-rain-check-dialog.component.js.map +1 -0
  65. package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +6 -0
  66. package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +48 -31
  67. package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -1
  68. package/src/lib/components/console/pos-page.component.d.ts +1 -1
  69. package/src/lib/components/console/pos-page.component.js +63 -12
  70. package/src/lib/components/console/pos-page.component.js.map +1 -1
  71. package/src/lib/components/console/pos-reader-splash-setting.component.js +1 -1
  72. package/src/lib/components/console/pos-reader-splash-setting.component.js.map +1 -1
  73. package/src/lib/components/console/product-check-in-fields.component.d.ts +4 -2
  74. package/src/lib/components/console/product-check-in-fields.component.js +60 -14
  75. package/src/lib/components/console/product-check-in-fields.component.js.map +1 -1
  76. package/src/lib/components/console/product-editor-dialog.component.js +44 -1
  77. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  78. package/src/lib/components/console/product-hardware-sku-field.component.d.ts +19 -0
  79. package/src/lib/components/console/product-hardware-sku-field.component.js +92 -0
  80. package/src/lib/components/console/product-hardware-sku-field.component.js.map +1 -0
  81. package/src/lib/components/console/product-kiosk-offer-field.component.d.ts +22 -0
  82. package/src/lib/components/console/product-kiosk-offer-field.component.js +94 -0
  83. package/src/lib/components/console/product-kiosk-offer-field.component.js.map +1 -0
  84. package/src/lib/components/console/product-register-fields.component.d.ts +4 -0
  85. package/src/lib/components/console/product-register-fields.component.js +31 -2
  86. package/src/lib/components/console/product-register-fields.component.js.map +1 -1
  87. package/src/lib/components/console/products-hub-card.component.js +11 -2
  88. package/src/lib/components/console/products-hub-card.component.js.map +1 -1
  89. package/src/lib/components/console/register-hardware-card.component.d.ts +11 -0
  90. package/src/lib/components/console/register-hardware-card.component.js +56 -27
  91. package/src/lib/components/console/register-hardware-card.component.js.map +1 -1
  92. package/src/lib/components/console/reservation-guests-dialog.component.d.ts +28 -0
  93. package/src/lib/components/console/reservation-guests-dialog.component.js +189 -0
  94. package/src/lib/components/console/reservation-guests-dialog.component.js.map +1 -0
  95. package/src/lib/components/console/reservations-card.component.d.ts +9 -0
  96. package/src/lib/components/console/reservations-card.component.js +158 -23
  97. package/src/lib/components/console/reservations-card.component.js.map +1 -1
  98. package/src/lib/components/console/shippingeasy-card.component.js +1 -1
  99. package/src/lib/components/console/shippingeasy-card.component.js.map +1 -1
  100. package/src/lib/components/console/shipstation-card.component.d.ts +1 -1
  101. package/src/lib/components/console/shipstation-card.component.js +3 -3
  102. package/src/lib/components/console/shipstation-card.component.js.map +1 -1
  103. package/src/lib/components/product-detail.d.ts +4 -0
  104. package/src/lib/components/product-detail.js +40 -5
  105. package/src/lib/components/product-detail.js.map +1 -1
  106. package/src/lib/components/product-reviews.js +28 -11
  107. package/src/lib/components/product-reviews.js.map +1 -1
  108. package/src/lib/components/reservation-widget.js +28 -5
  109. package/src/lib/components/reservation-widget.js.map +1 -1
  110. package/src/lib/components/use-day-picker.d.ts +25 -0
  111. package/src/lib/components/use-day-picker.js +57 -0
  112. package/src/lib/components/use-day-picker.js.map +1 -0
  113. package/src/lib/constants/operator-alerts.d.ts +55 -0
  114. package/src/lib/constants/operator-alerts.js +156 -1
  115. package/src/lib/constants/operator-alerts.js.map +1 -1
  116. package/src/lib/declarations.console-server.js +54 -1
  117. package/src/lib/declarations.console-server.js.map +1 -1
  118. package/src/lib/declarations.d.ts +4 -2
  119. package/src/lib/declarations.js +11 -4
  120. package/src/lib/declarations.js.map +1 -1
  121. package/src/lib/declarations.server.js +9 -0
  122. package/src/lib/declarations.server.js.map +1 -1
  123. package/src/lib/model/commerce-cart.d.ts +9 -1
  124. package/src/lib/model/commerce-cart.js +4 -3
  125. package/src/lib/model/commerce-cart.js.map +1 -1
  126. package/src/lib/model/commerce-check-in-product.d.ts +26 -0
  127. package/src/lib/model/commerce-check-in-product.js +64 -2
  128. package/src/lib/model/commerce-check-in-product.js.map +1 -1
  129. package/src/lib/model/commerce-check-in-record.d.ts +127 -0
  130. package/src/lib/model/commerce-check-in-record.js +36 -0
  131. package/src/lib/model/commerce-check-in-record.js.map +1 -0
  132. package/src/lib/model/commerce-check-in.d.ts +91 -87
  133. package/src/lib/model/commerce-check-in.js +186 -62
  134. package/src/lib/model/commerce-check-in.js.map +1 -1
  135. package/src/lib/model/commerce-kiosk-offer.d.ts +31 -0
  136. package/src/lib/model/commerce-kiosk-offer.js +35 -0
  137. package/src/lib/model/commerce-kiosk-offer.js.map +1 -0
  138. package/src/lib/model/commerce-orders.d.ts +76 -0
  139. package/src/lib/model/commerce-orders.js +6 -0
  140. package/src/lib/model/commerce-orders.js.map +1 -1
  141. package/src/lib/model/commerce-pos-day-report.d.ts +54 -1
  142. package/src/lib/model/commerce-pos-day-report.js +39 -2
  143. package/src/lib/model/commerce-pos-day-report.js.map +1 -1
  144. package/src/lib/model/commerce-pos-offline.d.ts +1 -1
  145. package/src/lib/model/commerce-pos-offline.js +6 -1
  146. package/src/lib/model/commerce-pos-offline.js.map +1 -1
  147. package/src/lib/model/commerce-pos-ops.js +3 -2
  148. package/src/lib/model/commerce-pos-ops.js.map +1 -1
  149. package/src/lib/model/commerce-pos.d.ts +36 -3
  150. package/src/lib/model/commerce-pos.js +14 -6
  151. package/src/lib/model/commerce-pos.js.map +1 -1
  152. package/src/lib/model/commerce-receipt.js +3 -2
  153. package/src/lib/model/commerce-receipt.js.map +1 -1
  154. package/src/lib/model/commerce-reservations.d.ts +69 -4
  155. package/src/lib/model/commerce-reservations.js +57 -5
  156. package/src/lib/model/commerce-reservations.js.map +1 -1
  157. package/src/lib/model/commerce.d.ts +66 -0
  158. package/src/lib/model/commerce.js +15 -0
  159. package/src/lib/model/commerce.js.map +1 -1
  160. package/src/lib/model/order-list-fields.d.ts +11 -0
  161. package/src/lib/model/order-list-fields.js +17 -1
  162. package/src/lib/model/order-list-fields.js.map +1 -1
  163. package/src/lib/model/own-store-tax-summary.d.ts +152 -0
  164. package/src/lib/model/own-store-tax-summary.js +288 -0
  165. package/src/lib/model/own-store-tax-summary.js.map +1 -0
  166. package/src/lib/model/plugin-permissions.d.ts +67 -0
  167. package/src/lib/model/plugin-permissions.js +224 -7
  168. package/src/lib/model/plugin-permissions.js.map +1 -1
  169. package/src/lib/model/pos-cellular.d.ts +223 -0
  170. package/src/lib/model/pos-cellular.js +293 -0
  171. package/src/lib/model/pos-cellular.js.map +1 -0
  172. package/src/lib/model/pos-hardware-in-person.d.ts +98 -0
  173. package/src/lib/model/pos-hardware-in-person.js +224 -0
  174. package/src/lib/model/pos-hardware-in-person.js.map +1 -0
  175. package/src/lib/model/pos-hardware-tax-summary.d.ts +166 -0
  176. package/src/lib/model/pos-hardware-tax-summary.js +225 -0
  177. package/src/lib/model/pos-hardware-tax-summary.js.map +1 -0
  178. package/src/lib/model/pos-hardware-terms.d.ts +74 -0
  179. package/src/lib/model/pos-hardware-terms.js +115 -0
  180. package/src/lib/model/pos-hardware-terms.js.map +1 -0
  181. package/src/lib/model/pos-hardware.d.ts +349 -7
  182. package/src/lib/model/pos-hardware.js +291 -20
  183. package/src/lib/model/pos-hardware.js.map +1 -1
  184. package/src/lib/model/product-write.d.ts +10 -0
  185. package/src/lib/model/product-write.js +4 -2
  186. package/src/lib/model/product-write.js.map +1 -1
  187. package/src/lib/plugin.js +16 -0
  188. package/src/lib/plugin.js.map +1 -1
  189. package/src/lib/server/billing-webhook.js +25 -1
  190. package/src/lib/server/billing-webhook.js.map +1 -1
  191. package/src/lib/server/cancel-order.js +7 -5
  192. package/src/lib/server/cancel-order.js.map +1 -1
  193. package/src/lib/server/cart-checkout.js +20 -8
  194. package/src/lib/server/cart-checkout.js.map +1 -1
  195. package/src/lib/server/cart.js +29 -0
  196. package/src/lib/server/cart.js.map +1 -1
  197. package/src/lib/server/checkout.js +42 -13
  198. package/src/lib/server/checkout.js.map +1 -1
  199. package/src/lib/server/collection-membership.d.ts +4 -0
  200. package/src/lib/server/collection-membership.js +5 -10
  201. package/src/lib/server/collection-membership.js.map +1 -1
  202. package/src/lib/server/commerce-site-keys.d.ts +29 -0
  203. package/src/lib/server/commerce-site-keys.js +40 -0
  204. package/src/lib/server/commerce-site-keys.js.map +1 -0
  205. package/src/lib/server/draft-order.js +8 -5
  206. package/src/lib/server/draft-order.js.map +1 -1
  207. package/src/lib/server/fulfill-order.js +7 -5
  208. package/src/lib/server/fulfill-order.js.map +1 -1
  209. package/src/lib/server/gift-cards.js +8 -5
  210. package/src/lib/server/gift-cards.js.map +1 -1
  211. package/src/lib/server/local-fulfillment-status.js +9 -6
  212. package/src/lib/server/local-fulfillment-status.js.map +1 -1
  213. package/src/lib/server/member-post.js +6 -5
  214. package/src/lib/server/member-post.js.map +1 -1
  215. package/src/lib/server/membership-admin-password.d.ts +4 -2
  216. package/src/lib/server/membership-admin-password.js +10 -8
  217. package/src/lib/server/membership-admin-password.js.map +1 -1
  218. package/src/lib/server/membership-admin-remove.d.ts +7 -5
  219. package/src/lib/server/membership-admin-remove.js +9 -9
  220. package/src/lib/server/membership-admin-remove.js.map +1 -1
  221. package/src/lib/server/order-notifications.js +5 -2
  222. package/src/lib/server/order-notifications.js.map +1 -1
  223. package/src/lib/server/order-print.js +7 -5
  224. package/src/lib/server/order-print.js.map +1 -1
  225. package/src/lib/server/order-receipt-send.js +8 -5
  226. package/src/lib/server/order-receipt-send.js.map +1 -1
  227. package/src/lib/server/orders-shipping-prepare.js +9 -6
  228. package/src/lib/server/orders-shipping-prepare.js.map +1 -1
  229. package/src/lib/server/own-store-tax-return-source.d.ts +47 -0
  230. package/src/lib/server/own-store-tax-return-source.js +312 -0
  231. package/src/lib/server/own-store-tax-return-source.js.map +1 -0
  232. package/src/lib/server/payment-methods.js +13 -9
  233. package/src/lib/server/payment-methods.js.map +1 -1
  234. package/src/lib/server/pos-auth.d.ts +37 -6
  235. package/src/lib/server/pos-auth.js +40 -15
  236. package/src/lib/server/pos-auth.js.map +1 -1
  237. package/src/lib/server/pos-cellular-billing.d.ts +81 -0
  238. package/src/lib/server/pos-cellular-billing.js +711 -0
  239. package/src/lib/server/pos-cellular-billing.js.map +1 -0
  240. package/src/lib/server/pos-cellular-notify.d.ts +47 -0
  241. package/src/lib/server/pos-cellular-notify.js +150 -0
  242. package/src/lib/server/pos-cellular-notify.js.map +1 -0
  243. package/src/lib/server/pos-cellular.d.ts +88 -0
  244. package/src/lib/server/pos-cellular.js +339 -0
  245. package/src/lib/server/pos-cellular.js.map +1 -0
  246. package/src/lib/server/pos-check-in.d.ts +5 -1
  247. package/src/lib/server/pos-check-in.js +296 -28
  248. package/src/lib/server/pos-check-in.js.map +1 -1
  249. package/src/lib/server/pos-day-report.js +29 -3
  250. package/src/lib/server/pos-day-report.js.map +1 -1
  251. package/src/lib/server/pos-display.d.ts +16 -0
  252. package/src/lib/server/pos-display.js +129 -2
  253. package/src/lib/server/pos-display.js.map +1 -1
  254. package/src/lib/server/pos-hardware-admin.d.ts +10 -1
  255. package/src/lib/server/pos-hardware-admin.js +250 -84
  256. package/src/lib/server/pos-hardware-admin.js.map +1 -1
  257. package/src/lib/server/pos-hardware-attach.d.ts +105 -0
  258. package/src/lib/server/pos-hardware-attach.js +443 -0
  259. package/src/lib/server/pos-hardware-attach.js.map +1 -0
  260. package/src/lib/server/pos-hardware-buyer-lookup.d.ts +58 -0
  261. package/src/lib/server/pos-hardware-buyer-lookup.js +180 -0
  262. package/src/lib/server/pos-hardware-buyer-lookup.js.map +1 -0
  263. package/src/lib/server/pos-hardware-buyer-record.d.ts +29 -0
  264. package/src/lib/server/pos-hardware-buyer-record.js +86 -0
  265. package/src/lib/server/pos-hardware-buyer-record.js.map +1 -0
  266. package/src/lib/server/pos-hardware-cancel.d.ts +58 -0
  267. package/src/lib/server/pos-hardware-cancel.js +147 -0
  268. package/src/lib/server/pos-hardware-cancel.js.map +1 -0
  269. package/src/lib/server/pos-hardware-closure-notices.d.ts +27 -0
  270. package/src/lib/server/pos-hardware-closure-notices.js +85 -0
  271. package/src/lib/server/pos-hardware-closure-notices.js.map +1 -0
  272. package/src/lib/server/pos-hardware-closure.d.ts +60 -0
  273. package/src/lib/server/pos-hardware-closure.js +153 -0
  274. package/src/lib/server/pos-hardware-closure.js.map +1 -0
  275. package/src/lib/server/pos-hardware-in-person.d.ts +61 -0
  276. package/src/lib/server/pos-hardware-in-person.js +236 -0
  277. package/src/lib/server/pos-hardware-in-person.js.map +1 -0
  278. package/src/lib/server/pos-hardware-notify.d.ts +40 -2
  279. package/src/lib/server/pos-hardware-notify.js +195 -14
  280. package/src/lib/server/pos-hardware-notify.js.map +1 -1
  281. package/src/lib/server/pos-hardware-readers.d.ts +115 -0
  282. package/src/lib/server/pos-hardware-readers.js +430 -0
  283. package/src/lib/server/pos-hardware-readers.js.map +1 -0
  284. package/src/lib/server/pos-hardware-returns.d.ts +116 -0
  285. package/src/lib/server/pos-hardware-returns.js +502 -0
  286. package/src/lib/server/pos-hardware-returns.js.map +1 -0
  287. package/src/lib/server/pos-hardware-sale-fields.d.ts +28 -0
  288. package/src/lib/server/pos-hardware-sale-fields.js +44 -0
  289. package/src/lib/server/pos-hardware-sale-fields.js.map +1 -0
  290. package/src/lib/server/pos-hardware-sale.d.ts +54 -0
  291. package/src/lib/server/pos-hardware-sale.js +369 -0
  292. package/src/lib/server/pos-hardware-sale.js.map +1 -0
  293. package/src/lib/server/pos-hardware-tax-return-source.d.ts +99 -0
  294. package/src/lib/server/pos-hardware-tax-return-source.js +462 -0
  295. package/src/lib/server/pos-hardware-tax-return-source.js.map +1 -0
  296. package/src/lib/server/pos-hardware-terms.d.ts +64 -0
  297. package/src/lib/server/pos-hardware-terms.js +154 -0
  298. package/src/lib/server/pos-hardware-terms.js.map +1 -0
  299. package/src/lib/server/pos-hardware-user-eraser.d.ts +3 -0
  300. package/src/lib/server/pos-hardware-user-eraser.js +31 -7
  301. package/src/lib/server/pos-hardware-user-eraser.js.map +1 -1
  302. package/src/lib/server/pos-hardware-webhook.d.ts +5 -0
  303. package/src/lib/server/pos-hardware-webhook.js +51 -6
  304. package/src/lib/server/pos-hardware-webhook.js.map +1 -1
  305. package/src/lib/server/pos-hardware.d.ts +74 -1
  306. package/src/lib/server/pos-hardware.js +175 -10
  307. package/src/lib/server/pos-hardware.js.map +1 -1
  308. package/src/lib/server/pos-kiosk.d.ts +2 -0
  309. package/src/lib/server/pos-kiosk.js +17 -12
  310. package/src/lib/server/pos-kiosk.js.map +1 -1
  311. package/src/lib/server/pos-offline-card-order.d.ts +64 -0
  312. package/src/lib/server/pos-offline-card-order.js +102 -0
  313. package/src/lib/server/pos-offline-card-order.js.map +1 -0
  314. package/src/lib/server/pos-offline-card-reconcile.d.ts +67 -1
  315. package/src/lib/server/pos-offline-card-reconcile.js +215 -18
  316. package/src/lib/server/pos-offline-card-reconcile.js.map +1 -1
  317. package/src/lib/server/pos-offline-sync.d.ts +39 -0
  318. package/src/lib/server/pos-offline-sync.js +190 -55
  319. package/src/lib/server/pos-offline-sync.js.map +1 -1
  320. package/src/lib/server/pos-ops-gate.d.ts +15 -4
  321. package/src/lib/server/pos-ops-gate.js +42 -9
  322. package/src/lib/server/pos-ops-gate.js.map +1 -1
  323. package/src/lib/server/pos-ops-routes.js +24 -0
  324. package/src/lib/server/pos-ops-routes.js.map +1 -1
  325. package/src/lib/server/pos-order-refund-ids.d.ts +28 -0
  326. package/src/lib/server/pos-order-refund-ids.js +31 -0
  327. package/src/lib/server/pos-order-refund-ids.js.map +1 -0
  328. package/src/lib/server/pos-order.js +52 -49
  329. package/src/lib/server/pos-order.js.map +1 -1
  330. package/src/lib/server/pos-payment.js +1 -1
  331. package/src/lib/server/pos-payment.js.map +1 -1
  332. package/src/lib/server/pos-reader-splash-admin.js +30 -32
  333. package/src/lib/server/pos-reader-splash-admin.js.map +1 -1
  334. package/src/lib/server/pos-reader-splash-images-route.d.ts +17 -0
  335. package/src/lib/server/pos-reader-splash-images-route.js +113 -0
  336. package/src/lib/server/pos-reader-splash-images-route.js.map +1 -0
  337. package/src/lib/server/pos-reader-splash-images.d.ts +51 -0
  338. package/src/lib/server/pos-reader-splash-images.js +123 -0
  339. package/src/lib/server/pos-reader-splash-images.js.map +1 -0
  340. package/src/lib/server/pos-reader-splash.d.ts +68 -1
  341. package/src/lib/server/pos-reader-splash.js +182 -11
  342. package/src/lib/server/pos-reader-splash.js.map +1 -1
  343. package/src/lib/server/pos-readers.d.ts +29 -0
  344. package/src/lib/server/pos-readers.js +134 -35
  345. package/src/lib/server/pos-readers.js.map +1 -1
  346. package/src/lib/server/pos-return.d.ts +10 -0
  347. package/src/lib/server/pos-return.js +26 -1
  348. package/src/lib/server/pos-return.js.map +1 -1
  349. package/src/lib/server/pos-sale.js +6 -1
  350. package/src/lib/server/pos-sale.js.map +1 -1
  351. package/src/lib/server/pos-shift.js +11 -0
  352. package/src/lib/server/pos-shift.js.map +1 -1
  353. package/src/lib/server/pos-staff-pin.js +25 -20
  354. package/src/lib/server/pos-staff-pin.js.map +1 -1
  355. package/src/lib/server/pos-terminal.d.ts +14 -4
  356. package/src/lib/server/pos-terminal.js +34 -38
  357. package/src/lib/server/pos-terminal.js.map +1 -1
  358. package/src/lib/server/printers.d.ts +7 -3
  359. package/src/lib/server/printers.js +18 -12
  360. package/src/lib/server/printers.js.map +1 -1
  361. package/src/lib/server/product-drafts.d.ts +11 -1
  362. package/src/lib/server/product-drafts.js +12 -8
  363. package/src/lib/server/product-drafts.js.map +1 -1
  364. package/src/lib/server/product.d.ts +15 -1
  365. package/src/lib/server/product.js +16 -3
  366. package/src/lib/server/product.js.map +1 -1
  367. package/src/lib/server/products-write.d.ts +26 -2
  368. package/src/lib/server/products-write.js +19 -7
  369. package/src/lib/server/products-write.js.map +1 -1
  370. package/src/lib/server/refund.js +34 -11
  371. package/src/lib/server/refund.js.map +1 -1
  372. package/src/lib/server/reservation-availability-query.d.ts +8 -0
  373. package/src/lib/server/reservation-availability-query.js +11 -1
  374. package/src/lib/server/reservation-availability-query.js.map +1 -1
  375. package/src/lib/server/reservation-availability.d.ts +1 -1
  376. package/src/lib/server/reservation-availability.js +7 -2
  377. package/src/lib/server/reservation-availability.js.map +1 -1
  378. package/src/lib/server/reservation-guests.d.ts +32 -0
  379. package/src/lib/server/reservation-guests.js +285 -0
  380. package/src/lib/server/reservation-guests.js.map +1 -0
  381. package/src/lib/server/reservation-walk-in.d.ts +11 -1
  382. package/src/lib/server/reservation-walk-in.js +56 -12
  383. package/src/lib/server/reservation-walk-in.js.map +1 -1
  384. package/src/lib/server/reserve.js +18 -5
  385. package/src/lib/server/reserve.js.map +1 -1
  386. package/src/lib/server/returns.js +9 -6
  387. package/src/lib/server/returns.js.map +1 -1
  388. package/src/lib/server/reviews.d.ts +22 -2
  389. package/src/lib/server/reviews.js +88 -20
  390. package/src/lib/server/reviews.js.map +1 -1
  391. package/src/lib/server/shipping-connectors.js +10 -11
  392. package/src/lib/server/shipping-connectors.js.map +1 -1
  393. package/src/lib/server/site-page-resolver.js +20 -3
  394. package/src/lib/server/site-page-resolver.js.map +1 -1
  395. package/src/lib/server/store-day.d.ts +33 -0
  396. package/src/lib/server/store-day.js +46 -0
  397. package/src/lib/server/store-day.js.map +1 -0
  398. package/src/lib/server/store-setup-ai-writer.d.ts +2 -1
  399. package/src/lib/server/store-setup-ai-writer.js +5 -6
  400. package/src/lib/server/store-setup-ai-writer.js.map +1 -1
  401. package/src/lib/server/storefront-tax.d.ts +13 -0
  402. package/src/lib/server/storefront-tax.js +8 -1
  403. package/src/lib/server/storefront-tax.js.map +1 -1
  404. package/src/lib/server/tax-return-source.d.ts +32 -3
  405. package/src/lib/server/tax-return-source.js +99 -20
  406. package/src/lib/server/tax-return-source.js.map +1 -1
  407. package/src/lib/server.js +100 -2
  408. package/src/lib/server.js.map +1 -1
  409. package/src/lib/testing/fake-firestore.js +58 -16
  410. package/src/lib/testing/fake-firestore.js.map +1 -1
  411. package/src/lib/testing/pos-ops-memory-firestore.js +18 -4
  412. package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -1
  413. package/src/lib/testing/site-register-permissions.d.ts +29 -0
  414. package/src/lib/testing/site-register-permissions.js +38 -0
  415. package/src/lib/testing/site-register-permissions.js.map +1 -0
  416. package/src/lib/transfer/tracking.server.js +8 -5
  417. package/src/lib/transfer/tracking.server.js.map +1 -1
  418. package/src/lib/utils/add-to-cart.d.ts +2 -0
  419. package/src/lib/utils/add-to-cart.js +6 -3
  420. package/src/lib/utils/add-to-cart.js.map +1 -1
@@ -0,0 +1,293 @@
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
+ */ import { STRIPE_PROCESSOR_FEE_FIXED_USD, STRIPE_PROCESSOR_FEE_PCT } from "@aglyn/aglyn/app-utils/plan-entitlements";
18
+ /*==========================================
19
+ * 4G FOR STRIPE READER S710s (AGL-4038).
20
+ *
21
+ * Stripe sells cellular service for the Stripe Reader S710 as a monthly
22
+ * subscription per reader, billed to the Stripe account the reader is
23
+ * registered to — which, for every reader a store sets up here, is the
24
+ * PLATFORM's. A reader has it when the Terminal Location it is registered
25
+ * to has a Configuration with `cellular[enabled]`; Stripe bills a reader for
26
+ * every calendar month it had it at any time.
27
+ *
28
+ * So 4G is turned on for a STORE: the platform keeps one Location and one
29
+ * Configuration per store (`pos-terminal.ts`), and the native apps' connection
30
+ * tokens are scoped to that one Location, so a second, cellular Location for
31
+ * some of a store's readers would be one those apps could never reach, and
32
+ * moving a reader there takes a fresh pairing code. Every S710 at a store
33
+ * with 4G on has it, and each one is charged.
34
+ *
35
+ * The store's workspace pays what the platform pays, passed through: per
36
+ * S710 per calendar month, Stripe's cellular price, plus what collecting it
37
+ * costs the platform (the card processing on the charge), with no markup.
38
+ * Both are configuration, never literals here:
39
+ *
40
+ * POS_CELLULAR_MONTHLY_COST_CENTS Stripe's price per reader per
41
+ * month, in cents. Unset: 4G is not
42
+ * offered anywhere (hidden, not
43
+ * disabled).
44
+ * POS_CELLULAR_BILLING_COST_BPS the processing percentage on the
45
+ * charge, in basis points (default:
46
+ * the platform's card rate)
47
+ * POS_CELLULAR_BILLING_COST_FIXED_CENTS the processing fixed fee per
48
+ * charge (default: the platform's)
49
+ * STRIPE_PRODUCT_POS_CELLULAR the product the invoice line is
50
+ * billed against (its tax code);
51
+ * `setup-stripe.mjs` makes it
52
+ * POS_CELLULAR_GRACE_DAYS how long a month's charge may stay
53
+ * unpaid before 4G is turned off for
54
+ * the workspace's stores (default 14)
55
+ *
56
+ * Billed in ARREARS, once per workspace per calendar month, on a one-off
57
+ * invoice through core's usage-invoice charge — the same path a domain or
58
+ * an AI overage takes — for the readers that had 4G at any time that month,
59
+ * which is what Stripe bills the platform for. Turning 4G off stops the
60
+ * charge from the next calendar month.
61
+ *
62
+ * A charge that does not collect stays open on the workspace's Billing page
63
+ * and staff are alerted; the people who manage its billing are warned the
64
+ * same day, once, of the day 4G turns off unless it is paid. Still unpaid
65
+ * after the grace period, 4G is turned off at Stripe for every store of the
66
+ * workspace, and they are told again; paying does not turn it back on, and
67
+ * it cannot be turned on again until the charge is paid. A workspace deleted
68
+ * mid-month is charged for that final month as it is erased.
69
+ *=========================================*/ export const POS_CELLULAR_ENV = {
70
+ monthlyCostCents: 'POS_CELLULAR_MONTHLY_COST_CENTS',
71
+ billingCostBps: 'POS_CELLULAR_BILLING_COST_BPS',
72
+ billingCostFixedCents: 'POS_CELLULAR_BILLING_COST_FIXED_CENTS',
73
+ productId: 'STRIPE_PRODUCT_POS_CELLULAR',
74
+ graceDays: 'POS_CELLULAR_GRACE_DAYS'
75
+ };
76
+ /** How long a month's charge may stay unpaid before 4G is turned off, unless configured. */ export const POS_CELLULAR_DEFAULT_GRACE_DAYS = 14;
77
+ /** A day, in milliseconds. */ export const POS_CELLULAR_DAY_MS = 24 * 60 * 60 * 1000;
78
+ /** The platform's card processing rate, in basis points: the default billing cost. */ export const POS_CELLULAR_DEFAULT_BILLING_COST_BPS = Math.round(STRIPE_PROCESSOR_FEE_PCT * 10000);
79
+ /** The platform's card processing fixed fee, in cents: the default billing cost. */ export const POS_CELLULAR_DEFAULT_BILLING_COST_FIXED_CENTS = Math.round(STRIPE_PROCESSOR_FEE_FIXED_USD * 100);
80
+ /** The Stripe device types that take cellular service: the S710, and its simulator. */ export const POS_CELLULAR_DEVICE_TYPES = [
81
+ 'stripe_s710',
82
+ 'simulated_stripe_s710'
83
+ ];
84
+ /** The top-level, server-only record of each reader's 4G months. */ export const POS_CELLULAR_READERS_COLLECTION = 'posCellularReaders';
85
+ /** The top-level, server-only record of each workspace's monthly 4G charge. */ export const POS_CELLULAR_CHARGES_COLLECTION = 'posCellularCharges';
86
+ /** The metadata `kind` the charge's invoice carries. */ export const POS_CELLULAR_CHARGE_KIND = 'pos-cellular';
87
+ /** How many 4G periods a reader's record keeps: two years of on and off. */ export const POS_CELLULAR_MAX_PERIODS = 24;
88
+ function wholeNumber(text, fallback, max) {
89
+ const trimmed = String(text != null ? text : '').trim();
90
+ if (!trimmed) return fallback;
91
+ if (!/^\d+$/.test(trimmed)) return null;
92
+ const value = Number(trimmed);
93
+ return Number.isSafeInteger(value) && value <= max ? value : null;
94
+ }
95
+ /**
96
+ * The deployment's 4G pricing, or null when 4G is not offered: no monthly
97
+ * cost, no product, or a value that is not a whole number in range. A bad
98
+ * value hides the feature rather than billing a guess.
99
+ */ export function parsePosCellularConfig(env = process.env) {
100
+ var _env_POS_CELLULAR_ENV_monthlyCostCents, _env_POS_CELLULAR_ENV_productId;
101
+ const costText = String((_env_POS_CELLULAR_ENV_monthlyCostCents = env[POS_CELLULAR_ENV.monthlyCostCents]) != null ? _env_POS_CELLULAR_ENV_monthlyCostCents : '').trim();
102
+ if (!/^\d+$/.test(costText)) return null;
103
+ const monthlyCostCents = Number(costText);
104
+ if (!Number.isSafeInteger(monthlyCostCents) || monthlyCostCents <= 0 || monthlyCostCents > 100000) return null;
105
+ const productId = String((_env_POS_CELLULAR_ENV_productId = env[POS_CELLULAR_ENV.productId]) != null ? _env_POS_CELLULAR_ENV_productId : '').trim();
106
+ if (!/^prod_[A-Za-z0-9]+$/.test(productId)) return null;
107
+ const billingCostBps = wholeNumber(env[POS_CELLULAR_ENV.billingCostBps], POS_CELLULAR_DEFAULT_BILLING_COST_BPS, 5000);
108
+ const billingCostFixedCents = wholeNumber(env[POS_CELLULAR_ENV.billingCostFixedCents], POS_CELLULAR_DEFAULT_BILLING_COST_FIXED_CENTS, 1000);
109
+ const graceDays = wholeNumber(env[POS_CELLULAR_ENV.graceDays], POS_CELLULAR_DEFAULT_GRACE_DAYS, 90);
110
+ if (billingCostBps === null || billingCostFixedCents === null || graceDays === null || graceDays < 1) return null;
111
+ return {
112
+ monthlyCostCents,
113
+ billingCostBps,
114
+ billingCostFixedCents,
115
+ productId,
116
+ graceDays
117
+ };
118
+ }
119
+ /**
120
+ * One workspace's 4G charge for a month, in whole cents: Stripe's price for
121
+ * each reader, grossed up so that what the charge's own processing takes
122
+ * leaves the platform exactly that:
123
+ *
124
+ * ceil((readers × cost + fixed) / (1 − rate))
125
+ *
126
+ * Rounded up, the one direction that never bills below cost.
127
+ * Zero readers is no charge.
128
+ */ export function posCellularChargeCents(readers, config) {
129
+ if (!Number.isSafeInteger(readers) || readers <= 0) return 0;
130
+ const passThrough = readers * config.monthlyCostCents + config.billingCostFixedCents;
131
+ return Math.ceil(passThrough * 10000 / (10000 - config.billingCostBps));
132
+ }
133
+ /**
134
+ * What one reader costs a month, as the console shows it: a store's charge
135
+ * for a single reader. More readers on one charge share its fixed fee, so
136
+ * this is never less than any reader's share of a larger charge.
137
+ */ export function posCellularReaderMonthlyCents(config) {
138
+ return posCellularChargeCents(1, config);
139
+ }
140
+ /** Whether a reader of this Stripe device type can have 4G. */ export function isPosCellularDeviceType(deviceType) {
141
+ return typeof deviceType === 'string' && POS_CELLULAR_DEVICE_TYPES.includes(deviceType);
142
+ }
143
+ /** `2026-10` for a time in October 2026, in UTC. */ export function posCellularMonthKey(ms) {
144
+ const date = new Date(ms);
145
+ return `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, '0')}`;
146
+ }
147
+ /** The calendar month before the one `ms` falls in. */ export function posCellularPreviousMonthKey(ms) {
148
+ const date = new Date(ms);
149
+ return posCellularMonthKey(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() - 1, 1));
150
+ }
151
+ /** A month's first instant, and the next month's, in UTC; null for a key that is not one. */ export function posCellularMonthBounds(month) {
152
+ const match = /^(\d{4})-(\d{2})$/.exec(month);
153
+ if (!match) return null;
154
+ const year = Number(match[1]);
155
+ const index = Number(match[2]) - 1;
156
+ if (index < 0 || index > 11) return null;
157
+ return {
158
+ startMs: Date.UTC(year, index, 1),
159
+ endMs: Date.UTC(year, index + 1, 1)
160
+ };
161
+ }
162
+ /** `October 2026`, for the invoice line. */ export function posCellularMonthLabel(month) {
163
+ const bounds = posCellularMonthBounds(month);
164
+ if (!bounds) return month;
165
+ return new Date(bounds.startMs).toLocaleString('en-US', {
166
+ month: 'long',
167
+ year: 'numeric',
168
+ timeZone: 'UTC'
169
+ });
170
+ }
171
+ /** The record's document id. */ export function posCellularReaderId(hostId, readerId) {
172
+ return `${hostId}_${readerId}`;
173
+ }
174
+ /** The record with a period open from `now`, unless one already is. */ export function openPosCellularPeriod(base, existing, now) {
175
+ var _ref, _ref1;
176
+ const periods = (_ref = existing == null ? void 0 : existing.periods) != null ? _ref : [];
177
+ const open = periods.some((period)=>period.toMs === null);
178
+ return _extends({}, base, {
179
+ enabled: true,
180
+ periods: open ? periods : [
181
+ ...periods,
182
+ {
183
+ fromMs: now,
184
+ toMs: null
185
+ }
186
+ ].slice(-POS_CELLULAR_MAX_PERIODS),
187
+ disabledAtMs: (_ref1 = existing == null ? void 0 : existing.disabledAtMs) != null ? _ref1 : null,
188
+ updatedAtMs: now
189
+ });
190
+ }
191
+ /** The record with its open period closed at `now`; unchanged when none is open. */ export function closePosCellularPeriod(existing, now) {
192
+ if (!existing.periods.some((period)=>period.toMs === null) && !existing.enabled) return existing;
193
+ return _extends({}, existing, {
194
+ enabled: false,
195
+ periods: existing.periods.map((period)=>period.toMs === null ? _extends({}, period, {
196
+ toMs: now
197
+ }) : period),
198
+ disabledAtMs: now,
199
+ updatedAtMs: now
200
+ });
201
+ }
202
+ /** Whether a reader had 4G at any time in the month. */ export function posCellularBilledInMonth(record, bounds) {
203
+ var _record_periods;
204
+ return ((_record_periods = record.periods) != null ? _record_periods : []).some((period)=>period.fromMs < bounds.endMs && (period.toMs === null || period.toMs > bounds.startMs));
205
+ }
206
+ /** Each workspace's readers that had 4G in the month, by workspace. */ export function posCellularReadersByWorkspace(records, month) {
207
+ const bounds = posCellularMonthBounds(month);
208
+ const byOrg = new Map();
209
+ if (!bounds) return byOrg;
210
+ for (const record of records){
211
+ var _byOrg_get;
212
+ if (!record.orgId || !posCellularBilledInMonth(record, bounds)) continue;
213
+ const entry = (_byOrg_get = byOrg.get(record.orgId)) != null ? _byOrg_get : {
214
+ readers: 0,
215
+ hostIds: []
216
+ };
217
+ entry.readers += 1;
218
+ if (!entry.hostIds.includes(record.hostId)) entry.hostIds.push(record.hostId);
219
+ byOrg.set(record.orgId, entry);
220
+ }
221
+ return byOrg;
222
+ }
223
+ /** States a later run never charges again. */ export const POS_CELLULAR_SETTLED_STATES = [
224
+ 'paid',
225
+ 'open',
226
+ 'suspended',
227
+ 'voided',
228
+ 'no-workspace',
229
+ 'no-customer',
230
+ 'below-minimum'
231
+ ];
232
+ /**
233
+ * When a charge left open runs out of grace: the grace period after it was
234
+ * left open (or, for a charge from before that was recorded, after it last
235
+ * changed).
236
+ */ export function posCellularGraceEndsAtMs(charge, graceDays) {
237
+ var _charge_openedAtMs;
238
+ return Number((_charge_openedAtMs = charge.openedAtMs) != null ? _charge_openedAtMs : charge.updatedAtMs) + graceDays * POS_CELLULAR_DAY_MS;
239
+ }
240
+ /** Whether an open charge is past its grace period. */ export function posCellularOverdue(charge, graceDays, now) {
241
+ return charge.state === 'open' && now >= posCellularGraceEndsAtMs(charge, graceDays);
242
+ }
243
+ /**
244
+ * Whether the people who manage a workspace's billing are still owed the
245
+ * warning that 4G turns off unless the charge is paid: an open charge not yet
246
+ * warned of. Never a charge made as the workspace was erased, whose 4G is
247
+ * already off and whose members are gone.
248
+ */ export function posCellularWarningDue(charge) {
249
+ return charge.state === 'open' && !charge.warnedAtMs && !charge.final;
250
+ }
251
+ /**
252
+ * A day as the workspace reads it, `November 16, 2026`, in its time zone
253
+ * (UTC for a zone the runtime cannot format in).
254
+ */ export function posCellularDayLabel(ms, timeZone = 'UTC') {
255
+ const options = {
256
+ month: 'long',
257
+ day: 'numeric',
258
+ year: 'numeric'
259
+ };
260
+ try {
261
+ return new Date(ms).toLocaleDateString('en-US', _extends({}, options, {
262
+ timeZone
263
+ }));
264
+ } catch (unused) {
265
+ return new Date(ms).toLocaleDateString('en-US', _extends({}, options, {
266
+ timeZone: 'UTC'
267
+ }));
268
+ }
269
+ }
270
+ /**
271
+ * The 4G row of a store's POS devices card: shown only where 4G is offered
272
+ * and the store has an S710, or already has 4G on (so it can be turned off).
273
+ */ export function posCellularView(config, terminal, readers, options = {}) {
274
+ var _suspension_atMs, _options_turnOnBlocked;
275
+ if (!config) return null;
276
+ const enabled = (terminal == null ? void 0 : terminal.cellularEnabled) === true;
277
+ const capable = readers.filter((reader)=>isPosCellularDeviceType(reader.deviceType)).length;
278
+ if (!enabled && capable === 0) return null;
279
+ const suspension = terminal == null ? void 0 : terminal.cellularSuspended;
280
+ const suspended = !enabled && suspension && typeof suspension.month === 'string' ? {
281
+ month: posCellularMonthLabel(suspension.month),
282
+ atMs: Number((_suspension_atMs = suspension.atMs) != null ? _suspension_atMs : 0)
283
+ } : null;
284
+ return {
285
+ readerMonthlyCents: posCellularReaderMonthlyCents(config),
286
+ enabled,
287
+ readers: capable,
288
+ suspended,
289
+ turnOnBlocked: (_options_turnOnBlocked = options.turnOnBlocked) != null ? _options_turnOnBlocked : null
290
+ };
291
+ }
292
+
293
+ //# sourceMappingURL=pos-cellular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/pos-cellular.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n STRIPE_PROCESSOR_FEE_FIXED_USD,\n STRIPE_PROCESSOR_FEE_PCT,\n} from '@aglyn/aglyn/app-utils/plan-entitlements'\n\n/*==========================================\n * 4G FOR STRIPE READER S710s (AGL-4038).\n *\n * Stripe sells cellular service for the Stripe Reader S710 as a monthly\n * subscription per reader, billed to the Stripe account the reader is\n * registered to — which, for every reader a store sets up here, is the\n * PLATFORM's. A reader has it when the Terminal Location it is registered\n * to has a Configuration with `cellular[enabled]`; Stripe bills a reader for\n * every calendar month it had it at any time.\n *\n * So 4G is turned on for a STORE: the platform keeps one Location and one\n * Configuration per store (`pos-terminal.ts`), and the native apps' connection\n * tokens are scoped to that one Location, so a second, cellular Location for\n * some of a store's readers would be one those apps could never reach, and\n * moving a reader there takes a fresh pairing code. Every S710 at a store\n * with 4G on has it, and each one is charged.\n *\n * The store's workspace pays what the platform pays, passed through: per\n * S710 per calendar month, Stripe's cellular price, plus what collecting it\n * costs the platform (the card processing on the charge), with no markup.\n * Both are configuration, never literals here:\n *\n * POS_CELLULAR_MONTHLY_COST_CENTS Stripe's price per reader per\n * month, in cents. Unset: 4G is not\n * offered anywhere (hidden, not\n * disabled).\n * POS_CELLULAR_BILLING_COST_BPS the processing percentage on the\n * charge, in basis points (default:\n * the platform's card rate)\n * POS_CELLULAR_BILLING_COST_FIXED_CENTS the processing fixed fee per\n * charge (default: the platform's)\n * STRIPE_PRODUCT_POS_CELLULAR the product the invoice line is\n * billed against (its tax code);\n * `setup-stripe.mjs` makes it\n * POS_CELLULAR_GRACE_DAYS how long a month's charge may stay\n * unpaid before 4G is turned off for\n * the workspace's stores (default 14)\n *\n * Billed in ARREARS, once per workspace per calendar month, on a one-off\n * invoice through core's usage-invoice charge — the same path a domain or\n * an AI overage takes — for the readers that had 4G at any time that month,\n * which is what Stripe bills the platform for. Turning 4G off stops the\n * charge from the next calendar month.\n *\n * A charge that does not collect stays open on the workspace's Billing page\n * and staff are alerted; the people who manage its billing are warned the\n * same day, once, of the day 4G turns off unless it is paid. Still unpaid\n * after the grace period, 4G is turned off at Stripe for every store of the\n * workspace, and they are told again; paying does not turn it back on, and\n * it cannot be turned on again until the charge is paid. A workspace deleted\n * mid-month is charged for that final month as it is erased.\n *=========================================*/\n\nexport const POS_CELLULAR_ENV = {\n monthlyCostCents: 'POS_CELLULAR_MONTHLY_COST_CENTS',\n billingCostBps: 'POS_CELLULAR_BILLING_COST_BPS',\n billingCostFixedCents: 'POS_CELLULAR_BILLING_COST_FIXED_CENTS',\n productId: 'STRIPE_PRODUCT_POS_CELLULAR',\n graceDays: 'POS_CELLULAR_GRACE_DAYS',\n} as const\n\n/** How long a month's charge may stay unpaid before 4G is turned off, unless configured. */\nexport const POS_CELLULAR_DEFAULT_GRACE_DAYS = 14\n\n/** A day, in milliseconds. */\nexport const POS_CELLULAR_DAY_MS = 24 * 60 * 60 * 1000\n\n/** The platform's card processing rate, in basis points: the default billing cost. */\nexport const POS_CELLULAR_DEFAULT_BILLING_COST_BPS = Math.round(STRIPE_PROCESSOR_FEE_PCT * 10_000)\n\n/** The platform's card processing fixed fee, in cents: the default billing cost. */\nexport const POS_CELLULAR_DEFAULT_BILLING_COST_FIXED_CENTS = Math.round(STRIPE_PROCESSOR_FEE_FIXED_USD * 100)\n\n/** The Stripe device types that take cellular service: the S710, and its simulator. */\nexport const POS_CELLULAR_DEVICE_TYPES: readonly string[] = ['stripe_s710', 'simulated_stripe_s710']\n\n/** The top-level, server-only record of each reader's 4G months. */\nexport const POS_CELLULAR_READERS_COLLECTION = 'posCellularReaders'\n\n/** The top-level, server-only record of each workspace's monthly 4G charge. */\nexport const POS_CELLULAR_CHARGES_COLLECTION = 'posCellularCharges'\n\n/** The metadata `kind` the charge's invoice carries. */\nexport const POS_CELLULAR_CHARGE_KIND = 'pos-cellular'\n\n/** How many 4G periods a reader's record keeps: two years of on and off. */\nexport const POS_CELLULAR_MAX_PERIODS = 24\n\nexport interface PosCellularConfig {\n monthlyCostCents: number\n billingCostBps: number\n billingCostFixedCents: number\n productId: string\n /** Days a charge may stay unpaid before 4G is turned off for the workspace. */\n graceDays: number\n}\n\nfunction wholeNumber(text: string | undefined, fallback: number, max: number): number | null {\n const trimmed = String(text ?? '').trim()\n if (!trimmed) return fallback\n if (!/^\\d+$/.test(trimmed)) return null\n const value = Number(trimmed)\n return Number.isSafeInteger(value) && value <= max ? value : null\n}\n\n/**\n * The deployment's 4G pricing, or null when 4G is not offered: no monthly\n * cost, no product, or a value that is not a whole number in range. A bad\n * value hides the feature rather than billing a guess.\n */\nexport function parsePosCellularConfig(\n env: Record<string, string | undefined> = process.env,\n): PosCellularConfig | null {\n const costText = String(env[POS_CELLULAR_ENV.monthlyCostCents] ?? '').trim()\n if (!/^\\d+$/.test(costText)) return null\n const monthlyCostCents = Number(costText)\n if (!Number.isSafeInteger(monthlyCostCents) || monthlyCostCents <= 0 || monthlyCostCents > 100_000) return null\n const productId = String(env[POS_CELLULAR_ENV.productId] ?? '').trim()\n if (!/^prod_[A-Za-z0-9]+$/.test(productId)) return null\n const billingCostBps = wholeNumber(env[POS_CELLULAR_ENV.billingCostBps], POS_CELLULAR_DEFAULT_BILLING_COST_BPS, 5_000)\n const billingCostFixedCents = wholeNumber(\n env[POS_CELLULAR_ENV.billingCostFixedCents],\n POS_CELLULAR_DEFAULT_BILLING_COST_FIXED_CENTS,\n 1_000,\n )\n const graceDays = wholeNumber(env[POS_CELLULAR_ENV.graceDays], POS_CELLULAR_DEFAULT_GRACE_DAYS, 90)\n if (billingCostBps === null || billingCostFixedCents === null || graceDays === null || graceDays < 1) return null\n return { monthlyCostCents, billingCostBps, billingCostFixedCents, productId, graceDays }\n}\n\n/**\n * One workspace's 4G charge for a month, in whole cents: Stripe's price for\n * each reader, grossed up so that what the charge's own processing takes\n * leaves the platform exactly that:\n *\n * ceil((readers × cost + fixed) / (1 − rate))\n *\n * Rounded up, the one direction that never bills below cost.\n * Zero readers is no charge.\n */\nexport function posCellularChargeCents(readers: number, config: PosCellularConfig): number {\n if (!Number.isSafeInteger(readers) || readers <= 0) return 0\n const passThrough = readers * config.monthlyCostCents + config.billingCostFixedCents\n return Math.ceil((passThrough * 10_000) / (10_000 - config.billingCostBps))\n}\n\n/**\n * What one reader costs a month, as the console shows it: a store's charge\n * for a single reader. More readers on one charge share its fixed fee, so\n * this is never less than any reader's share of a larger charge.\n */\nexport function posCellularReaderMonthlyCents(config: PosCellularConfig): number {\n return posCellularChargeCents(1, config)\n}\n\n/** Whether a reader of this Stripe device type can have 4G. */\nexport function isPosCellularDeviceType(deviceType: unknown): boolean {\n return typeof deviceType === 'string' && POS_CELLULAR_DEVICE_TYPES.includes(deviceType)\n}\n\n/** `2026-10` for a time in October 2026, in UTC. */\nexport function posCellularMonthKey(ms: number): string {\n const date = new Date(ms)\n return `${date.getUTCFullYear()}-${String(date.getUTCMonth() + 1).padStart(2, '0')}`\n}\n\n/** The calendar month before the one `ms` falls in. */\nexport function posCellularPreviousMonthKey(ms: number): string {\n const date = new Date(ms)\n return posCellularMonthKey(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() - 1, 1))\n}\n\n/** A month's first instant, and the next month's, in UTC; null for a key that is not one. */\nexport function posCellularMonthBounds(month: string): { startMs: number; endMs: number } | null {\n const match = /^(\\d{4})-(\\d{2})$/.exec(month)\n if (!match) return null\n const year = Number(match[1])\n const index = Number(match[2]) - 1\n if (index < 0 || index > 11) return null\n return { startMs: Date.UTC(year, index, 1), endMs: Date.UTC(year, index + 1, 1) }\n}\n\n/** `October 2026`, for the invoice line. */\nexport function posCellularMonthLabel(month: string): string {\n const bounds = posCellularMonthBounds(month)\n if (!bounds) return month\n return new Date(bounds.startMs).toLocaleString('en-US', { month: 'long', year: 'numeric', timeZone: 'UTC' })\n}\n\n/** One stretch of time a reader had 4G: from when it was turned on, to when it was turned off (open while it is on). */\nexport interface PosCellularPeriod {\n fromMs: number\n toMs: number | null\n}\n\n/**\n * `posCellularReaders/{hostId}_{readerId}`: one S710's 4G months, written\n * only by the server. No person is named on it: a workspace, a store, a\n * Stripe reader and its serial, and when it had 4G.\n */\nexport interface PosCellularReaderRecord {\n orgId: string\n hostId: string\n readerId: string\n serialNumber: string | null\n /** The store's Terminal Configuration that carries `cellular[enabled]`. */\n stripeConfigurationId: string | null\n enabled: boolean\n periods: PosCellularPeriod[]\n /** The last time a period was closed, which the month's charge queries by. */\n disabledAtMs: number | null\n updatedAtMs: number\n}\n\n/** The record's document id. */\nexport function posCellularReaderId(hostId: string, readerId: string): string {\n return `${hostId}_${readerId}`\n}\n\n/** The record with a period open from `now`, unless one already is. */\nexport function openPosCellularPeriod(\n base: Omit<PosCellularReaderRecord, 'enabled' | 'periods' | 'disabledAtMs' | 'updatedAtMs'>,\n existing: PosCellularReaderRecord | null,\n now: number,\n): PosCellularReaderRecord {\n const periods = existing?.periods ?? []\n const open = periods.some((period) => period.toMs === null)\n return {\n ...base,\n enabled: true,\n periods: open ? periods : [...periods, { fromMs: now, toMs: null }].slice(-POS_CELLULAR_MAX_PERIODS),\n disabledAtMs: existing?.disabledAtMs ?? null,\n updatedAtMs: now,\n }\n}\n\n/** The record with its open period closed at `now`; unchanged when none is open. */\nexport function closePosCellularPeriod(existing: PosCellularReaderRecord, now: number): PosCellularReaderRecord {\n if (!existing.periods.some((period) => period.toMs === null) && !existing.enabled) return existing\n return {\n ...existing,\n enabled: false,\n periods: existing.periods.map((period) => (period.toMs === null ? { ...period, toMs: now } : period)),\n disabledAtMs: now,\n updatedAtMs: now,\n }\n}\n\n/** Whether a reader had 4G at any time in the month. */\nexport function posCellularBilledInMonth(\n record: Pick<PosCellularReaderRecord, 'periods'>,\n bounds: { startMs: number; endMs: number },\n): boolean {\n return (record.periods ?? []).some(\n (period) => period.fromMs < bounds.endMs && (period.toMs === null || period.toMs > bounds.startMs),\n )\n}\n\n/** Each workspace's readers that had 4G in the month, by workspace. */\nexport function posCellularReadersByWorkspace(\n records: ReadonlyArray<PosCellularReaderRecord>,\n month: string,\n): Map<string, { readers: number; hostIds: string[] }> {\n const bounds = posCellularMonthBounds(month)\n const byOrg = new Map<string, { readers: number; hostIds: string[] }>()\n if (!bounds) return byOrg\n for (const record of records) {\n if (!record.orgId || !posCellularBilledInMonth(record, bounds)) continue\n const entry = byOrg.get(record.orgId) ?? { readers: 0, hostIds: [] }\n entry.readers += 1\n if (!entry.hostIds.includes(record.hostId)) entry.hostIds.push(record.hostId)\n byOrg.set(record.orgId, entry)\n }\n return byOrg\n}\n\n/**\n * The outcome of a workspace's month: charged and paid; charged and left\n * open on their Billing page because the card failed; still unpaid after the\n * grace period, so 4G was turned off for the workspace (`suspended`); its\n * invoice voided by staff (`voided`); not charged because there is no one to\n * bill (no workspace, no customer) or nothing to bill (under Stripe's\n * minimum); or `charging`, claimed by a run in progress.\n */\nexport type PosCellularChargeState =\n | 'charging'\n | 'paid'\n | 'open'\n | 'suspended'\n | 'voided'\n | 'failed'\n | 'no-workspace'\n | 'no-customer'\n | 'below-minimum'\n\n/** States a later run never charges again. */\nexport const POS_CELLULAR_SETTLED_STATES: readonly PosCellularChargeState[] = [\n 'paid',\n 'open',\n 'suspended',\n 'voided',\n 'no-workspace',\n 'no-customer',\n 'below-minimum',\n]\n\n/** `posCellularCharges/{orgId}_{month}`: one workspace's 4G charge for one month. */\nexport interface PosCellularCharge {\n orgId: string\n month: string\n readers: number\n amountCents: number\n state: PosCellularChargeState\n invoiceId: string | null\n paidCents: number\n attempts: number\n createdAtMs: number\n updatedAtMs: number\n /** When the charge was left open, which the grace period counts from. */\n openedAtMs?: number | null\n /** When 4G was turned off for the workspace because it stayed unpaid. */\n suspendedAtMs?: number | null\n /** The stores 4G was turned off for, whose notice clears once it is paid. */\n suspendedHostIds?: string[]\n /**\n * When the people who manage the workspace's billing were warned, as the\n * charge was left open, of the day 4G turns off unless it is paid.\n */\n warnedAtMs?: number | null\n /** When the people who manage the workspace's billing were told 4G was turned off. */\n noticeSentAtMs?: number | null\n /** Charged as the workspace was erased, for the month it was deleted in (or the one before). */\n final?: boolean\n}\n\n/**\n * When a charge left open runs out of grace: the grace period after it was\n * left open (or, for a charge from before that was recorded, after it last\n * changed).\n */\nexport function posCellularGraceEndsAtMs(\n charge: Pick<PosCellularCharge, 'openedAtMs' | 'updatedAtMs'>,\n graceDays: number,\n): number {\n return Number(charge.openedAtMs ?? charge.updatedAtMs) + graceDays * POS_CELLULAR_DAY_MS\n}\n\n/** Whether an open charge is past its grace period. */\nexport function posCellularOverdue(\n charge: Pick<PosCellularCharge, 'state' | 'openedAtMs' | 'updatedAtMs'>,\n graceDays: number,\n now: number,\n): boolean {\n return charge.state === 'open' && now >= posCellularGraceEndsAtMs(charge, graceDays)\n}\n\n/**\n * Whether the people who manage a workspace's billing are still owed the\n * warning that 4G turns off unless the charge is paid: an open charge not yet\n * warned of. Never a charge made as the workspace was erased, whose 4G is\n * already off and whose members are gone.\n */\nexport function posCellularWarningDue(\n charge: Pick<PosCellularCharge, 'state' | 'warnedAtMs' | 'final'>,\n): boolean {\n return charge.state === 'open' && !charge.warnedAtMs && !charge.final\n}\n\n/**\n * A day as the workspace reads it, `November 16, 2026`, in its time zone\n * (UTC for a zone the runtime cannot format in).\n */\nexport function posCellularDayLabel(ms: number, timeZone = 'UTC'): string {\n const options = { month: 'long', day: 'numeric', year: 'numeric' } as const\n try {\n return new Date(ms).toLocaleDateString('en-US', { ...options, timeZone })\n } catch {\n return new Date(ms).toLocaleDateString('en-US', { ...options, timeZone: 'UTC' })\n }\n}\n\n/**\n * On a store's terminal settings (`cellularSuspended`) while 4G is off because\n * a month's charge was not paid: which month, its invoice, and when.\n */\nexport interface PosCellularSuspension {\n month: string\n invoiceId: string | null\n atMs: number\n}\n\n/** What the POS devices card is told about 4G for a store; null hides it. */\nexport interface PosCellularView {\n /** What one reader costs a month, in cents, before any sales tax. */\n readerMonthlyCents: number\n enabled: boolean\n /** The store's readers that take 4G. */\n readers: number\n /** Turned off because a month's charge was not paid: that month, as `October 2026`, and when. */\n suspended?: { month: string; atMs: number } | null\n /**\n * Why the viewer may not turn 4G ON (it is charged to the workspace, so it\n * also takes \"Manage billing\"), or null. Turning it off needs only the\n * card's own key.\n */\n turnOnBlocked?: string | null\n}\n\n/**\n * The 4G row of a store's POS devices card: shown only where 4G is offered\n * and the store has an S710, or already has 4G on (so it can be turned off).\n */\nexport function posCellularView(\n config: PosCellularConfig | null,\n terminal: { cellularEnabled?: unknown; cellularSuspended?: unknown } | null | undefined,\n readers: ReadonlyArray<{ deviceType?: unknown }>,\n options: { turnOnBlocked?: string | null } = {},\n): PosCellularView | null {\n if (!config) return null\n const enabled = terminal?.cellularEnabled === true\n const capable = readers.filter((reader) => isPosCellularDeviceType(reader.deviceType)).length\n if (!enabled && capable === 0) return null\n const suspension = terminal?.cellularSuspended as Partial<PosCellularSuspension> | null | undefined\n const suspended =\n !enabled && suspension && typeof suspension.month === 'string'\n ? { month: posCellularMonthLabel(suspension.month), atMs: Number(suspension.atMs ?? 0) }\n : null\n return {\n readerMonthlyCents: posCellularReaderMonthlyCents(config),\n enabled,\n readers: capable,\n suspended,\n turnOnBlocked: options.turnOnBlocked ?? null,\n }\n}\n"],"names":["STRIPE_PROCESSOR_FEE_FIXED_USD","STRIPE_PROCESSOR_FEE_PCT","POS_CELLULAR_ENV","monthlyCostCents","billingCostBps","billingCostFixedCents","productId","graceDays","POS_CELLULAR_DEFAULT_GRACE_DAYS","POS_CELLULAR_DAY_MS","POS_CELLULAR_DEFAULT_BILLING_COST_BPS","Math","round","POS_CELLULAR_DEFAULT_BILLING_COST_FIXED_CENTS","POS_CELLULAR_DEVICE_TYPES","POS_CELLULAR_READERS_COLLECTION","POS_CELLULAR_CHARGES_COLLECTION","POS_CELLULAR_CHARGE_KIND","POS_CELLULAR_MAX_PERIODS","wholeNumber","text","fallback","max","trimmed","String","trim","test","value","Number","isSafeInteger","parsePosCellularConfig","env","process","costText","posCellularChargeCents","readers","config","passThrough","ceil","posCellularReaderMonthlyCents","isPosCellularDeviceType","deviceType","includes","posCellularMonthKey","ms","date","Date","getUTCFullYear","getUTCMonth","padStart","posCellularPreviousMonthKey","UTC","posCellularMonthBounds","month","match","exec","year","index","startMs","endMs","posCellularMonthLabel","bounds","toLocaleString","timeZone","posCellularReaderId","hostId","readerId","openPosCellularPeriod","base","existing","now","periods","open","some","period","toMs","enabled","fromMs","slice","disabledAtMs","updatedAtMs","closePosCellularPeriod","map","posCellularBilledInMonth","record","posCellularReadersByWorkspace","records","byOrg","Map","orgId","entry","get","hostIds","push","set","POS_CELLULAR_SETTLED_STATES","posCellularGraceEndsAtMs","charge","openedAtMs","posCellularOverdue","state","posCellularWarningDue","warnedAtMs","final","posCellularDayLabel","options","day","toLocaleDateString","posCellularView","terminal","suspension","cellularEnabled","capable","filter","reader","length","cellularSuspended","suspended","atMs","readerMonthlyCents","turnOnBlocked"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,8BAA8B,EAC9BC,wBAAwB,QACnB,2CAA0C;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAmD2C,GAE3C,OAAO,MAAMC,mBAAmB;IAC9BC,kBAAkB;IAClBC,gBAAgB;IAChBC,uBAAuB;IACvBC,WAAW;IACXC,WAAW;AACb,EAAU;AAEV,0FAA0F,GAC1F,OAAO,MAAMC,kCAAkC,GAAE;AAEjD,4BAA4B,GAC5B,OAAO,MAAMC,sBAAsB,KAAK,KAAK,KAAK,KAAI;AAEtD,oFAAoF,GACpF,OAAO,MAAMC,wCAAwCC,KAAKC,KAAK,CAACX,2BAA2B,OAAO;AAElG,kFAAkF,GAClF,OAAO,MAAMY,gDAAgDF,KAAKC,KAAK,CAACZ,iCAAiC,KAAI;AAE7G,qFAAqF,GACrF,OAAO,MAAMc,4BAA+C;IAAC;IAAe;CAAwB,CAAA;AAEpG,kEAAkE,GAClE,OAAO,MAAMC,kCAAkC,qBAAoB;AAEnE,6EAA6E,GAC7E,OAAO,MAAMC,kCAAkC,qBAAoB;AAEnE,sDAAsD,GACtD,OAAO,MAAMC,2BAA2B,eAAc;AAEtD,0EAA0E,GAC1E,OAAO,MAAMC,2BAA2B,GAAE;AAW1C,SAASC,YAAYC,IAAwB,EAAEC,QAAgB,EAAEC,GAAW;IAC1E,MAAMC,UAAUC,OAAOJ,eAAAA,OAAQ,IAAIK,IAAI;IACvC,IAAI,CAACF,SAAS,OAAOF;IACrB,IAAI,CAAC,QAAQK,IAAI,CAACH,UAAU,OAAO;IACnC,MAAMI,QAAQC,OAAOL;IACrB,OAA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AWlD,MAAM;IAAU;IACjE,IAAI;QACF,OAAO,IAAIV,KAAKF,IAAI+D,kBAAkB,CAAC,SAAS,aAAKF;YAAS1C;;IAChE,EAAE,eAAM;QACN,OAAO,IAAIjB,KAAKF,IAAI+D,kBAAkB,CAAC,SAAS,aAAKF;YAAS1C,UAAU;;IAC1E;AACF;AA6BA;;;CAGC,GACD,OAAO,SAAS6C,gBACdxE,MAAgC,EAChCyE,QAAuF,EACvF1E,OAAgD,EAChDsE,UAA6C,CAAC,CAAC;QASsBK,kBAOpDL;IAdjB,IAAI,CAACrE,QAAQ,OAAO;IACpB,MAAMwC,UAAUiC,CAAAA,4BAAAA,SAAUE,eAAe,MAAK;IAC9C,MAAMC,UAAU7E,QAAQ8E,MAAM,CAAC,CAACC,SAAW1E,wBAAwB0E,OAAOzE,UAAU,GAAG0E,MAAM;IAC7F,IAAI,CAACvC,WAAWoC,YAAY,GAAG,OAAO;IACtC,MAAMF,aAAaD,4BAAAA,SAAUO,iBAAiB;IAC9C,MAAMC,YACJ,CAACzC,WAAWkC,cAAc,OAAOA,WAAWzD,KAAK,KAAK,WAClD;QAAEA,OAAOO,sBAAsBkD,WAAWzD,KAAK;QAAGiE,MAAM1F,QAAOkF,mBAAAA,WAAWQ,IAAI,YAAfR,mBAAmB;IAAG,IACrF;IACN,OAAO;QACLS,oBAAoBhF,8BAA8BH;QAClDwC;QACAzC,SAAS6E;QACTK;QACAG,aAAa,GAAEf,yBAAAA,QAAQe,aAAa,YAArBf,yBAAyB;IAC1C;AACF"}
@@ -0,0 +1,98 @@
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 { OrderHardwareBuyer } from './commerce-orders';
18
+ import { type PosHardwareAttachment, type PosHardwareLine, type PosHardwareOrder, type PosHardwareSkuId, type PosHardwareTaxRegion, type PosHardwareUnit } from './pos-hardware';
19
+ /** One register line, with the hardware item its product is, when it is one. */
20
+ export interface PosHardwareRegisterLine {
21
+ sku: PosHardwareSkuId | null;
22
+ quantity: number;
23
+ unitAmountCents: number;
24
+ }
25
+ export interface PosHardwareRegisterShare {
26
+ lines: PosHardwareLine[];
27
+ /** The hardware lines at the prices rung. */
28
+ itemsCents: number;
29
+ discountCents: number;
30
+ /** What tax was charged on: the items less the discount. */
31
+ taxableCents: number;
32
+ taxCents: number;
33
+ totalCents: number;
34
+ }
35
+ /**
36
+ * The hardware's share of a register sale, or `null` when the sale sold no
37
+ * hardware. `discountCents` and `taxCents` are the SALE's.
38
+ */
39
+ export declare function posHardwareRegisterShare(input: {
40
+ lines: readonly PosHardwareRegisterLine[];
41
+ discountCents: number;
42
+ taxCents: number;
43
+ }): PosHardwareRegisterShare | null;
44
+ /**
45
+ * One unit per reader sold, in line order; accessories carry no serial and
46
+ * have no unit. `serials` are the serial numbers taken at the sale, in the
47
+ * same order, already normalized; a reader with none waits for one.
48
+ */
49
+ export declare function posHardwareUnits(lines: readonly PosHardwareLine[], serials?: readonly string[]): PosHardwareUnit[];
50
+ /**
51
+ * Whose the order is: the workspace the register attached, or pending. A
52
+ * buyer with an account and a workspace is attached; one with only an
53
+ * account or only an address is pending until they have a workspace.
54
+ */
55
+ export declare function posHardwareAttachmentOf(buyer: OrderHardwareBuyer | null | undefined): PosHardwareAttachment;
56
+ /** The register sale, as the builder reads it. */
57
+ export interface InPersonRegisterSale {
58
+ sellerHostId: string;
59
+ sellerOrgId: string;
60
+ registerOrderId: string;
61
+ number: number | null;
62
+ registerId: string | null;
63
+ kiosk: boolean;
64
+ offline: boolean;
65
+ share: PosHardwareRegisterShare;
66
+ /** When the sale was paid: the order's own stamp. */
67
+ paidAtMs: number;
68
+ /** The tenders that paid it, as its payments name them. */
69
+ tenders: string[];
70
+ paymentLinkSessionId: string | null;
71
+ /** The address the receipt went to, kept for staff when nobody is attached. */
72
+ receiptEmail: string | null;
73
+ buyer: OrderHardwareBuyer | null | undefined;
74
+ /** Serial numbers taken at the sale, normalized, in reader order. */
75
+ serials?: readonly string[];
76
+ /** Where the store taxes from: its own address's region. */
77
+ taxRegion: PosHardwareTaxRegion | null;
78
+ /** The store's rate, in percent, when it charged one. */
79
+ ratePct: number | null;
80
+ stripeAccountId: string | null;
81
+ livemode: boolean;
82
+ currency?: string;
83
+ /**
84
+ * How the buyer agreed to the terms of sale before paying (AGL-4038), from
85
+ * the register sale; absent, the receipt-and-sign notice at the sale.
86
+ */
87
+ termsAcceptance?: unknown;
88
+ }
89
+ /**
90
+ * The hardware order a register sale becomes. In-person hardware is handed
91
+ * over at the sale, so the order starts at Delivered, and moves to Set up
92
+ * once its readers are registered.
93
+ *
94
+ * The tax line states the base the store's rate was applied to — the
95
+ * hardware's share of what the register taxed — so the platform's return
96
+ * reads a stated base, never an inferred one.
97
+ */
98
+ export declare function inPersonPosHardwareOrder(sale: InPersonRegisterSale): PosHardwareOrder;