@aglyn/plugins-commerce 1.0.0-beta.285 → 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
@@ -1,3 +1,4 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2026 Aglyn LLC
@@ -53,7 +54,14 @@ export const POS_HARDWARE_MAX_UNITS = 20;
53
54
  * Absent, {@link POS_HARDWARE_DEFAULT_MARKUP_BPS} applies.
54
55
  */ markupBps: 'POS_HARDWARE_MARKUP_BPS',
55
56
  /** JSON `{ "standard" | "express" | "priority": <cents> }`. */ shipping: 'POS_HARDWARE_SHIPPING',
56
- /** `true` turns Stripe automatic tax on for hardware checkouts. */ automaticTax: 'POS_HARDWARE_AUTOMATIC_TAX'
57
+ /** `true` turns Stripe automatic tax on for hardware checkouts. */ automaticTax: 'POS_HARDWARE_AUTOMATIC_TAX',
58
+ /**
59
+ * `true` lets the platform's own store sell hardware IN PERSON at its
60
+ * register (AGL-4038): a reader handed over at an event, attached to the
61
+ * buyer's workspace. Absent or anything else keeps it off.
62
+ */ inPersonEnabled: 'POS_HARDWARE_IN_PERSON_ENABLED',
63
+ /** The site id of the platform's own store whose register sells hardware in person. */ sellerHostId: 'POS_HARDWARE_SELLER_HOST_ID',
64
+ /** The workspace that owns that store. */ sellerOrgId: 'POS_HARDWARE_SELLER_ORG_ID'
57
65
  };
58
66
  /**
59
67
  * The markup when the deployment sets none: 3000 basis points on Stripe's
@@ -70,7 +78,10 @@ export const POS_HARDWARE_MAX_UNITS = 20;
70
78
  kind: 'reader',
71
79
  stripeProductName: 'Stripe Reader S710',
72
80
  displayName: 'Stripe Reader S710',
73
- use: 'Handheld with its own 4G connection, for events and parking lots'
81
+ // 4G needs Stripe's cellular service, billed monthly per reader, which a
82
+ // store turns on for its S710s where it is offered (AGL-4038): the reader
83
+ // alone does not bring a connection.
84
+ use: 'Handheld for events and parking lots; 4G needs Stripe’s cellular service, billed monthly'
74
85
  },
75
86
  {
76
87
  id: 'stripe-reader-s700',
@@ -79,6 +90,13 @@ export const POS_HARDWARE_MAX_UNITS = 20;
79
90
  displayName: 'Stripe Reader S700',
80
91
  use: 'Handheld or countertop reader on Wi-Fi'
81
92
  },
93
+ {
94
+ id: 'stripe-reader-t600',
95
+ kind: 'reader',
96
+ stripeProductName: 'Stripe Reader T600',
97
+ displayName: 'Stripe Reader T600',
98
+ use: 'Countertop reader on Wi-Fi, or on Ethernet with the hub'
99
+ },
82
100
  {
83
101
  id: 'bbpos-wisepos-e',
84
102
  kind: 'reader',
@@ -96,16 +114,44 @@ export const POS_HARDWARE_MAX_UNITS = 20;
96
114
  {
97
115
  id: 'stripe-reader-s700-dock',
98
116
  kind: 'accessory',
99
- stripeProductName: 'Stripe Reader S700 Dock',
117
+ stripeProductName: 'Stripe Reader S700/S710 Dock',
100
118
  displayName: 'Charging dock for the S700 and S710',
101
119
  use: 'Keeps the reader charged at the counter and adds an Ethernet port'
102
120
  },
103
121
  {
104
- id: 'bbpos-wisepos-e-dock',
122
+ id: 'stripe-reader-hub',
105
123
  kind: 'accessory',
106
- stripeProductName: 'BBPOS WisePOS E Dock',
107
- displayName: 'Charging dock for the WisePOS E',
108
- use: 'Keeps the reader charged at the counter and adds an Ethernet port'
124
+ stripeProductName: 'Stripe Reader Hub',
125
+ displayName: 'Hub for the S700, S710 and T600',
126
+ use: 'Connects the reader to Ethernet and power'
127
+ },
128
+ {
129
+ id: 'stripe-reader-s700-case',
130
+ kind: 'accessory',
131
+ stripeProductName: 'Stripe Reader S700/S710 Case',
132
+ displayName: 'Case for the S700 and S710',
133
+ use: 'Protects a handheld reader on the move'
134
+ },
135
+ {
136
+ id: 'stripe-reader-s700-cable',
137
+ kind: 'accessory',
138
+ stripeProductName: 'Stripe Reader S700/S710 Cable',
139
+ displayName: 'Cable for the S700 and S710',
140
+ use: 'A spare cable for the reader'
141
+ },
142
+ {
143
+ id: 'stripe-reader-charger',
144
+ kind: 'accessory',
145
+ stripeProductName: 'Stripe Reader Charger',
146
+ displayName: 'Charger for Stripe readers',
147
+ use: 'A spare wall charger'
148
+ },
149
+ {
150
+ id: 'stripe-reader-m2-dock',
151
+ kind: 'accessory',
152
+ stripeProductName: 'Stripe Reader M2 Dock',
153
+ displayName: 'Charging dock for the M2',
154
+ use: 'Keeps the M2 charged at the counter'
109
155
  },
110
156
  {
111
157
  id: 'stripe-reader-m2-mount',
@@ -113,6 +159,20 @@ export const POS_HARDWARE_MAX_UNITS = 20;
113
159
  stripeProductName: 'Stripe Reader M2 Mount',
114
160
  displayName: 'Mount for the M2',
115
161
  use: 'Holds the M2 in place at the counter'
162
+ },
163
+ {
164
+ id: 'bbpos-wisepos-e-dock',
165
+ kind: 'accessory',
166
+ stripeProductName: 'BBPOS WisePOS E Dock',
167
+ displayName: 'Charging dock for the WisePOS E',
168
+ use: 'Keeps the reader charged at the counter and adds an Ethernet port'
169
+ },
170
+ {
171
+ id: 'bbpos-wisepos-e-power-cable',
172
+ kind: 'accessory',
173
+ stripeProductName: 'BBPOS WisePOS E 5ft Power Cable',
174
+ displayName: '5 ft power cable for the WisePOS E',
175
+ use: 'A spare power cable for the reader'
116
176
  }
117
177
  ];
118
178
  export function posHardwareSku(id) {
@@ -128,6 +188,11 @@ const SHIPPING_METHODS = Object.keys(POS_HARDWARE_SHIPPING_LABELS);
128
188
  export function isPosHardwareShippingMethod(value) {
129
189
  return typeof value === 'string' && SHIPPING_METHODS.includes(value);
130
190
  }
191
+ export const POS_HARDWARE_IN_PERSON_SHIPPING_LABEL = 'Handed over in person';
192
+ /** The label of any order's method, the in-person one included. */ export function posHardwareShippingLabel(method) {
193
+ if (method === 'in_person') return POS_HARDWARE_IN_PERSON_SHIPPING_LABEL;
194
+ return POS_HARDWARE_SHIPPING_LABELS[isPosHardwareShippingMethod(method) ? method : 'standard'];
195
+ }
131
196
  /** The highest single figure the parser accepts, in cents: $10,000. */ const MAX_FIGURE_CENTS = 1000000;
132
197
  /** The highest markup the parser accepts: 1000%. */ const MAX_MARKUP_BPS = 100000;
133
198
  const isCents = (value, min)=>typeof value === 'number' && Number.isSafeInteger(value) && value >= min && value <= MAX_FIGURE_CENTS;
@@ -187,6 +252,33 @@ function parseJsonObject(raw) {
187
252
  automaticTax: String((_env_POS_HARDWARE_ENV_automaticTax = env[POS_HARDWARE_ENV.automaticTax]) != null ? _env_POS_HARDWARE_ENV_automaticTax : '').trim().toLowerCase() === 'true'
188
253
  };
189
254
  }
255
+ const CONFIG_ID = /^[A-Za-z0-9_-]{1,128}$/;
256
+ /**
257
+ * The in-person sale's configuration from the environment, or `null` while
258
+ * it is off: not turned on, or the store or its workspace not named, or
259
+ * named with something that cannot be an id. It needs nothing of the online
260
+ * shop's: the store's own products carry the prices.
261
+ */ export function parsePosHardwareInPersonConfig(env) {
262
+ var _env_POS_HARDWARE_ENV_inPersonEnabled, _env_POS_HARDWARE_ENV_sellerHostId, _env_POS_HARDWARE_ENV_sellerOrgId;
263
+ if (String((_env_POS_HARDWARE_ENV_inPersonEnabled = env[POS_HARDWARE_ENV.inPersonEnabled]) != null ? _env_POS_HARDWARE_ENV_inPersonEnabled : '').trim().toLowerCase() !== 'true') return null;
264
+ const sellerHostId = String((_env_POS_HARDWARE_ENV_sellerHostId = env[POS_HARDWARE_ENV.sellerHostId]) != null ? _env_POS_HARDWARE_ENV_sellerHostId : '').trim();
265
+ const sellerOrgId = String((_env_POS_HARDWARE_ENV_sellerOrgId = env[POS_HARDWARE_ENV.sellerOrgId]) != null ? _env_POS_HARDWARE_ENV_sellerOrgId : '').trim();
266
+ if (!CONFIG_ID.test(sellerHostId) || !CONFIG_ID.test(sellerOrgId)) return null;
267
+ return {
268
+ sellerHostId,
269
+ sellerOrgId
270
+ };
271
+ }
272
+ export function isPosHardwareSkuId(value) {
273
+ return typeof value === 'string' && posHardwareSku(value) !== null;
274
+ }
275
+ /**
276
+ * A reader's serial number as staff scanned or typed it, in the one form
277
+ * every comparison uses: upper case, letters, digits and dashes only, at
278
+ * most 64 characters. Empty when nothing usable was given.
279
+ */ export function normalizePosHardwareSerial(value) {
280
+ return String(value != null ? value : '').toUpperCase().replace(/[^A-Z0-9-]/g, '').slice(0, 64);
281
+ }
190
282
  /**
191
283
  * What the merchant pays for one item: Stripe's price plus the markup,
192
284
  * rounded half up to the cent, in integer math throughout.
@@ -283,8 +375,9 @@ function parseJsonObject(raw) {
283
375
  * THE CHECKOUT SESSION'S METADATA.
284
376
  *
285
377
  * The webhook builds the order from the session Stripe hands back, so the
286
- * lines ride in its metadata in a compact form (`sku*qty*unit;…`, well inside
287
- * Stripe's 500-character value limit for the at most seven distinct items),
378
+ * lines ride in its metadata in a compact form (`sku*qty*unit;…`, inside
379
+ * Stripe's 500-character value limit even with every item in the catalog in
380
+ * one basket at the highest price the config accepts, which a spec holds),
288
381
  * and the webhook re-reads every one against the catalog rather than trusting
289
382
  * a name from the wire.
290
383
  *=========================================*/ export const POS_HARDWARE_METADATA_TYPE = 'pos-hardware-order';
@@ -364,6 +457,10 @@ export function nextPosHardwareStatus(status) {
364
457
  */ export function posHardwareRefundable(status) {
365
458
  return status === 'paid' || status === 'ordered';
366
459
  }
460
+ export function posHardwareOrderSource(order) {
461
+ return (order == null ? void 0 : order.source) === 'in_person' ? 'in_person' : 'online';
462
+ }
463
+ export const POS_HARDWARE_RETURN_REASON_MAX = 500;
367
464
  /** The timestamp field each status stamps when it is reached. */ export const POS_HARDWARE_STATUS_STAMP = {
368
465
  paid: 'paidAtMs',
369
466
  ordered: 'orderedAtMs',
@@ -382,7 +479,17 @@ export function nextPosHardwareStatus(status) {
382
479
  * record and owes the sales tax on it. So beside every order the server keeps
383
480
  * `posHardwareSales/{orderId}`, a TOP-LEVEL record of what tax and accounting
384
481
  * need — the lines, the amounts, the tax, Stripe's ids, the status dates and
385
- * the region it shipped to — and nothing about the person who bought it.
482
+ * the region it shipped to — and, of the person who bought it, only their
483
+ * NAME and ADDRESS ({@link PosHardwareSaleBuyer}).
484
+ *
485
+ * The name and address are the reseller's records Stripe's Terminal Reseller
486
+ * Terms §10 ask for: the identity and address of each buyer, open to Stripe's
487
+ * inspection. §10 states no period, so they are kept for the record's own
488
+ * seven years. They SURVIVE the buyer's account erasure, which still takes
489
+ * the email, phone, tracking and the name and street off the ORDER: every
490
+ * write sets the record through {@link posHardwareSaleSetOptions}, which
491
+ * leaves the stored name and address alone when the order no longer has
492
+ * them because its buyer was erased.
386
493
  *
387
494
  * It is the `platformRevenue` / `storefrontTaxCollected` shape on purpose
388
495
  * (AGL-1811, AGL-1904): keyed to the workspace by FIELD, outside
@@ -395,7 +502,47 @@ export function nextPosHardwareStatus(status) {
395
502
  * Written in the same transaction as every write to the order, from the
396
503
  * order as it stands after that write, so the two never disagree and a
397
504
  * missing record heals on the next write.
505
+ *
506
+ * KEPT SEVEN YEARS FROM THE SALE, THEN DELETED. Every write stamps
507
+ * `expiresAt` ({@link posHardwareSaleExpiry}) and the Firestore TTL policy on
508
+ * `posHardwareSales.expiresAt` deletes the record once it passes.
398
509
  *=========================================*/ /** The top-level collection of retained hardware sale records. */ export const POS_HARDWARE_SALES_COLLECTION = 'posHardwareSales';
510
+ /**
511
+ * How long the platform keeps a hardware sale record (AGL-4038): seven years
512
+ * from the sale, then the record is deleted. Longer than the four years Texas
513
+ * requires for sales tax records, a margin for an audit of an older period.
514
+ */ export const POS_HARDWARE_SALE_RETENTION_YEARS = 7;
515
+ /**
516
+ * When a sale record expires: the same calendar instant, seven years after
517
+ * the sale was paid (the order's creation where no payment time is stated).
518
+ * A sale on 29 February expires on 1 March, a day late rather than early.
519
+ * Null when there is no sale time, so the record is kept, never reaped at
520
+ * the epoch.
521
+ */ export function posHardwareSaleExpiry(order) {
522
+ const saleAtMs = [
523
+ order.paidAtMs,
524
+ order.createdAtMs
525
+ ].find((value)=>typeof value === 'number' && Number.isFinite(value) && value > 0);
526
+ if (saleAtMs === undefined) return null;
527
+ const expires = new Date(saleAtMs);
528
+ expires.setUTCFullYear(expires.getUTCFullYear() + POS_HARDWARE_SALE_RETENTION_YEARS);
529
+ return expires;
530
+ }
531
+ /** A tax line as the record keeps it: every field picked, every figure an integer. */ function saleTaxLine(line) {
532
+ var _integerOrNull;
533
+ const integerOrNull = (value)=>typeof value === 'number' && Number.isFinite(value) ? Math.round(value) : null;
534
+ const numberOrNull = (value)=>typeof value === 'number' && Number.isFinite(value) ? value : null;
535
+ const textOf = (value)=>typeof value === 'string' && value ? value : null;
536
+ return {
537
+ amountCents: (_integerOrNull = integerOrNull(line == null ? void 0 : line.amountCents)) != null ? _integerOrNull : 0,
538
+ taxabilityReason: textOf(line == null ? void 0 : line.taxabilityReason),
539
+ taxRateId: textOf(line == null ? void 0 : line.taxRateId),
540
+ taxableAmountCents: integerOrNull(line == null ? void 0 : line.taxableAmountCents),
541
+ jurisdiction: textOf(line == null ? void 0 : line.jurisdiction),
542
+ rateState: textOf(line == null ? void 0 : line.rateState),
543
+ percentage: numberOrNull(line == null ? void 0 : line.percentage)
544
+ };
545
+ }
399
546
  const stampOrNull = (value)=>typeof value === 'number' && Number.isFinite(value) ? value : null;
400
547
  const textOrNull = (value)=>typeof value === 'string' && value.trim() ? value.trim() : null;
401
548
  /** The tax region of an order: its address cut down, or what an erasure left. */ export function posHardwareTaxRegion(order) {
@@ -415,14 +562,76 @@ const textOrNull = (value)=>typeof value === 'string' && value.trim() ? value.tr
415
562
  postalCode: textOrNull(kept.postalCode)
416
563
  } : null;
417
564
  }
565
+ /** An address with every key present, or null when it names no place. */ function saleAddress(address) {
566
+ var _ref, _ref1, _ref2;
567
+ var _textOrNull, _textOrNull1, _textOrNull2;
568
+ const line1 = textOrNull(address == null ? void 0 : address.line1);
569
+ const city = textOrNull(address == null ? void 0 : address.city);
570
+ const country = textOrNull(address == null ? void 0 : address.country);
571
+ if (!line1 || !city || !country) return null;
572
+ return {
573
+ line1: line1.slice(0, 200),
574
+ line2: (_ref = (_textOrNull = textOrNull(address == null ? void 0 : address.line2)) == null ? void 0 : _textOrNull.slice(0, 200)) != null ? _ref : null,
575
+ city: city.slice(0, 100),
576
+ state: (_ref1 = (_textOrNull1 = textOrNull(address == null ? void 0 : address.state)) == null ? void 0 : _textOrNull1.slice(0, 100)) != null ? _ref1 : null,
577
+ postalCode: (_ref2 = (_textOrNull2 = textOrNull(address == null ? void 0 : address.postalCode)) == null ? void 0 : _textOrNull2.slice(0, 20)) != null ? _ref2 : null,
578
+ country: country.toUpperCase().slice(0, 2)
579
+ };
580
+ }
581
+ /**
582
+ * A buyer's business address as an in-person order keeps it (AGL-4038):
583
+ * trimmed and cut to length, or null when it lacks a street, city, postal
584
+ * code or two-letter country.
585
+ */ export function posHardwareBuyerAddress(value) {
586
+ var _textOrNull, _textOrNull1, _textOrNull2, _textOrNull3, _textOrNull4, _textOrNull5;
587
+ const address = value && typeof value === 'object' ? value : {};
588
+ const line1 = (_textOrNull = textOrNull(address.line1)) == null ? void 0 : _textOrNull.slice(0, 200);
589
+ const city = (_textOrNull1 = textOrNull(address.city)) == null ? void 0 : _textOrNull1.slice(0, 100);
590
+ const postalCode = (_textOrNull2 = textOrNull(address.postalCode)) == null ? void 0 : _textOrNull2.slice(0, 20);
591
+ const country = (_textOrNull3 = textOrNull(address.country)) == null ? void 0 : _textOrNull3.toUpperCase();
592
+ if (!line1 || !city || !postalCode || !country || !/^[A-Z]{2}$/.test(country)) return null;
593
+ const line2 = (_textOrNull4 = textOrNull(address.line2)) == null ? void 0 : _textOrNull4.slice(0, 200);
594
+ const state = (_textOrNull5 = textOrNull(address.state)) == null ? void 0 : _textOrNull5.slice(0, 100);
595
+ return _extends({
596
+ line1
597
+ }, line2 ? {
598
+ line2
599
+ } : {}, {
600
+ city
601
+ }, state ? {
602
+ state
603
+ } : {}, {
604
+ postalCode,
605
+ country
606
+ });
607
+ }
608
+ /**
609
+ * The buyer's name and address as the order holds them now (AGL-4038): the
610
+ * shipping name and address of an online order, the attachment's of an
611
+ * in-person one. `undefined` when the order has none BECAUSE its buyer's
612
+ * account was erased, which tells the write to keep what the record has;
613
+ * null when it simply names no one yet.
614
+ */ export function posHardwareSaleBuyer(order) {
615
+ var _ref;
616
+ var _textOrNull, _order_attachment, _order_shipping, _order_attachment1, _order_shipping1;
617
+ const inPerson = posHardwareOrderSource(order) === 'in_person';
618
+ const name = (_ref = (_textOrNull = textOrNull(inPerson ? (_order_attachment = order.attachment) == null ? void 0 : _order_attachment.name : (_order_shipping = order.shipping) == null ? void 0 : _order_shipping.name)) == null ? void 0 : _textOrNull.slice(0, 200)) != null ? _ref : null;
619
+ const address = saleAddress(inPerson ? (_order_attachment1 = order.attachment) == null ? void 0 : _order_attachment1.address : (_order_shipping1 = order.shipping) == null ? void 0 : _order_shipping1.address);
620
+ if (name || address) return {
621
+ name,
622
+ address
623
+ };
624
+ return typeof order.buyerErasedAtMs === 'number' ? undefined : null;
625
+ }
418
626
  /**
419
627
  * The retained sale record of an order, as it stands. Every field is picked
420
628
  * by name, so a field added to the order later reaches the record only when
421
629
  * someone decides it should.
422
630
  */ export function posHardwareSaleRecord(orderId, order) {
423
- var _order_lines, _order_subtotalCents, _ref, _ref1, _order_taxCents, _order_totalCents, _order_currency, _order_createdAtMs, _ref2, _order_updatedAtMs;
424
- var _order_shipping, _order_shipping1;
425
- return {
631
+ var _order_lines, _order_subtotalCents, _ref, _ref1, _order_taxCents, _stampOrNull, _order_totalCents, _order_currency, _order_createdAtMs, _ref2, _order_updatedAtMs;
632
+ var _order_shipping, _order_shipping1, _order_posSale, _order_posSale1, _order_posSale2;
633
+ const buyer = posHardwareSaleBuyer(order);
634
+ return _extends({
426
635
  orderId,
427
636
  orgId: order.orgId,
428
637
  lines: ((_order_lines = order.lines) != null ? _order_lines : []).map((line)=>({
@@ -436,9 +645,12 @@ const textOrNull = (value)=>typeof value === 'string' && value.trim() ? value.tr
436
645
  shippingMethod: (_ref = (_order_shipping = order.shipping) == null ? void 0 : _order_shipping.method) != null ? _ref : 'standard',
437
646
  shippingCents: (_ref1 = (_order_shipping1 = order.shipping) == null ? void 0 : _order_shipping1.cents) != null ? _ref1 : 0,
438
647
  taxCents: (_order_taxCents = order.taxCents) != null ? _order_taxCents : 0,
648
+ discountCents: (_stampOrNull = stampOrNull(order.discountCents)) != null ? _stampOrNull : 0,
439
649
  totalCents: (_order_totalCents = order.totalCents) != null ? _order_totalCents : 0,
440
650
  currency: (_order_currency = order.currency) != null ? _order_currency : POS_HARDWARE_CURRENCY,
441
651
  shipTo: posHardwareTaxRegion(order),
652
+ automaticTax: typeof order.automaticTax === 'boolean' ? order.automaticTax : null,
653
+ taxLines: (Array.isArray(order.taxLines) ? order.taxLines : []).map(saleTaxLine),
442
654
  stripeCheckoutSessionId: textOrNull(order.stripeCheckoutSessionId),
443
655
  stripePaymentIntentId: textOrNull(order.stripePaymentIntentId),
444
656
  stripeHardwareOrderId: textOrNull(order.stripeHardwareOrderId),
@@ -454,7 +666,45 @@ const textOrNull = (value)=>typeof value === 'string' && value.trim() ? value.tr
454
666
  deliveredAtMs: stampOrNull(order.deliveredAtMs),
455
667
  registeredAtMs: stampOrNull(order.registeredAtMs),
456
668
  canceledAtMs: stampOrNull(order.canceledAtMs),
457
- refundedAtMs: stampOrNull(order.refundedAtMs)
669
+ refundedAtMs: stampOrNull(order.refundedAtMs),
670
+ source: posHardwareOrderSource(order),
671
+ posHostId: textOrNull((_order_posSale = order.posSale) == null ? void 0 : _order_posSale.hostId),
672
+ posOrderId: textOrNull((_order_posSale1 = order.posSale) == null ? void 0 : _order_posSale1.orderId),
673
+ paidTo: salePaidTo(order),
674
+ storefrontTaxRowId: textOrNull((_order_posSale2 = order.posSale) == null ? void 0 : _order_posSale2.paymentLinkSessionId)
675
+ }, buyer === undefined ? {} : {
676
+ buyer
677
+ }, {
678
+ // The TTL policy's field: the record outlives the workspace, not the law.
679
+ expiresAt: posHardwareSaleExpiry(order)
680
+ });
681
+ }
682
+ /**
683
+ * How every write of a sale record is made (AGL-4038): `set` with exactly
684
+ * the record's own fields as `mergeFields`, so each one is replaced whole —
685
+ * a map included, never merged key by key — and a field the record leaves
686
+ * out is left as stored. The record leaves out only `buyer`, and only once
687
+ * the buyer's account was erased ({@link posHardwareSaleBuyer}), so the
688
+ * buyer's name and address outlive the erasure and every write after it.
689
+ */ export function posHardwareSaleSetOptions(order) {
690
+ return {
691
+ mergeFields: Object.keys(posHardwareSaleRecord('', order))
692
+ };
693
+ }
694
+ /** Where a sale's money went, picked by name: never a buyer detail. */ function salePaidTo(order) {
695
+ var _paidTo_hostId, _paidTo_orgId;
696
+ const paidTo = order.paidTo;
697
+ if (posHardwareOrderSource(order) !== 'in_person' || (paidTo == null ? void 0 : paidTo.account) !== 'seller_store') {
698
+ return {
699
+ account: 'platform'
700
+ };
701
+ }
702
+ return {
703
+ account: 'seller_store',
704
+ hostId: String((_paidTo_hostId = paidTo.hostId) != null ? _paidTo_hostId : ''),
705
+ orgId: String((_paidTo_orgId = paidTo.orgId) != null ? _paidTo_orgId : ''),
706
+ tenders: (Array.isArray(paidTo.tenders) ? paidTo.tenders : []).map(String).slice(0, 10),
707
+ stripeAccountId: textOrNull(paidTo.stripeAccountId)
458
708
  };
459
709
  }
460
710
  /**
@@ -465,27 +715,48 @@ const textOrNull = (value)=>typeof value === 'string' && value.trim() ? value.tr
465
715
  * The country, state and postal code stay, because sales tax is sourced by
466
716
  * them. Deterministic but for the stamp, and an order already erased no
467
717
  * longer answers to the person's uid, so a second run finds nothing.
718
+ *
719
+ * The buyer's NAME and ADDRESS stay on the platform's sale record, not on
720
+ * the order: `buyerErasedAtMs` is what tells the record's next write to keep
721
+ * them ({@link posHardwareSaleBuyer}, {@link posHardwareSaleSetOptions}).
468
722
  */ export function posHardwareBuyerErasedPatch(order, now) {
469
- var _ref, _ref1, _ref2, _ref3;
723
+ var _ref, _ref1, _ref2, _attachment_orgId, _attachment_hostId, _attachment_attachedBy, _attachment_attachedAtMs;
470
724
  // The whole map, read in the same transaction: a dotted-path update would
471
725
  // leave a field added to `shipping` later standing with the person in it.
472
726
  const shipping = order.shipping;
473
- return {
727
+ const attachment = order.attachment;
728
+ return _extends({
474
729
  createdBy: null,
475
730
  contactEmail: null,
476
731
  shipping: {
477
732
  method: (_ref = shipping == null ? void 0 : shipping.method) != null ? _ref : 'standard',
478
- label: (_ref1 = shipping == null ? void 0 : shipping.label) != null ? _ref1 : POS_HARDWARE_SHIPPING_LABELS[(_ref2 = shipping == null ? void 0 : shipping.method) != null ? _ref2 : 'standard'],
479
- cents: (_ref3 = shipping == null ? void 0 : shipping.cents) != null ? _ref3 : 0,
733
+ label: (_ref1 = shipping == null ? void 0 : shipping.label) != null ? _ref1 : posHardwareShippingLabel(shipping == null ? void 0 : shipping.method),
734
+ cents: (_ref2 = shipping == null ? void 0 : shipping.cents) != null ? _ref2 : 0,
480
735
  name: null,
481
736
  phone: null,
482
737
  address: null,
483
738
  taxRegion: posHardwareTaxRegion(order)
484
739
  },
485
- tracking: null,
740
+ tracking: null
741
+ }, attachment ? {
742
+ attachment: {
743
+ state: attachment.state === 'attached' ? 'attached' : 'pending',
744
+ email: null,
745
+ uid: null,
746
+ orgId: (_attachment_orgId = attachment.orgId) != null ? _attachment_orgId : null,
747
+ hostId: (_attachment_hostId = attachment.hostId) != null ? _attachment_hostId : null,
748
+ attachedBy: (_attachment_attachedBy = attachment.attachedBy) != null ? _attachment_attachedBy : null,
749
+ attachedAtMs: (_attachment_attachedAtMs = attachment.attachedAtMs) != null ? _attachment_attachedAtMs : null
750
+ }
751
+ } : {}, order.returnRequest ? {
752
+ returnRequest: _extends({}, order.returnRequest, {
753
+ reason: null,
754
+ requestedBy: null
755
+ })
756
+ } : {}, {
486
757
  buyerErasedAtMs: now,
487
758
  updatedAtMs: now
488
- };
759
+ });
489
760
  }
490
761
  /** An order id: `hw_` and twenty hex characters. */ export const POS_HARDWARE_ORDER_ID = /^hw_[a-f0-9]{20}$/;
491
762
  /** Dollars and cents for the card and the emails. */ export function formatPosHardwareCents(cents) {