@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
@@ -0,0 +1,27 @@
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 { ClosureNotice, ClosureNoticeSource, ClosureSubject } from '@aglyn/aglyn/plugin-manager/plugin-closure-notices';
18
+ import { type PosHardwareOrder } from '../model/pos-hardware';
19
+ /** The notice's id. */
20
+ export declare const POS_HARDWARE_CLOSURE_NOTICE_ID = "pos-hardware-unshipped-orders";
21
+ /** The warning for these unshipped orders, or none when there are none. Pure. */
22
+ export declare function posHardwareClosureNotice(subject: ClosureSubject['kind'], orders: ReadonlyArray<{
23
+ orderId: string;
24
+ order: Pick<PosHardwareOrder, 'status' | 'lines' | 'totalCents'>;
25
+ }>): ClosureNotice[];
26
+ /** The hardware shop's closure notices, as the declarations register them. */
27
+ export declare const posHardwareClosureNoticeSource: ClosureNoticeSource;
@@ -0,0 +1,85 @@
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
+ */ import { firebaseAdmin } from "@aglyn/tenant-data-admin";
17
+ import { formatPosHardwareCents, POS_HARDWARE_ORDERS_COLLECTION, posHardwareRefundable } from "../model/pos-hardware.js";
18
+ /*==========================================
19
+ * BEFORE A CLOSURE: WHICH HARDWARE ORDERS IT WILL CANCEL AND REFUND (AGL-4038).
20
+ *
21
+ * Deleting a workspace, or closing the account that placed an order, cancels
22
+ * every card reader order that has not shipped — paid, or already placed
23
+ * with Stripe — and refunds it in full (`pos-hardware-closure.ts`). The
24
+ * delete-workspace and close-account screens ask core's closure notices
25
+ * before the confirm, and this answers for the hardware shop: one warning
26
+ * listing each such order, its number, its items and what is refunded.
27
+ *
28
+ * The same orders the closure reads: a workspace's own (`paid` or `ordered`),
29
+ * or every one the person placed in any workspace (by `createdBy`, the
30
+ * collection-group override the account eraser uses). Nothing is held back:
31
+ * the closure goes ahead, and this only says what it will do.
32
+ *=========================================*/ /** The notice's id. */ export const POS_HARDWARE_CLOSURE_NOTICE_ID = 'pos-hardware-unshipped-orders';
33
+ /** The number a person reads: `HW-` and six characters of the id. */ function orderNumber(orderId) {
34
+ return `HW-${orderId.replace(/^hw_/, '').slice(0, 6).toUpperCase()}`;
35
+ }
36
+ /** The warning for these unshipped orders, or none when there are none. Pure. */ export function posHardwareClosureNotice(subject, orders) {
37
+ const unshipped = orders.filter(({ order })=>posHardwareRefundable(order == null ? void 0 : order.status));
38
+ if (!unshipped.length) return [];
39
+ const count = unshipped.length;
40
+ const one = count === 1;
41
+ return [
42
+ {
43
+ id: POS_HARDWARE_CLOSURE_NOTICE_ID,
44
+ severity: 'warning',
45
+ title: one ? 'A card reader order will be canceled and refunded' : `${count} card reader orders will be canceled and refunded`,
46
+ body: subject === 'workspace' ? `${one ? 'This order has' : 'These orders have'} not shipped yet. When the workspace is deleted, ` + `${one ? 'it is' : 'each is'} canceled and refunded in full, shipping and tax included, to the card ` + `it was paid with, and the person who placed ${one ? 'it gets an email' : 'each gets an email'}. ` + `Nothing will ship. Keep the workspace if you still want ${one ? 'it' : 'them'}.` : `${one ? 'This order you placed has' : 'These orders you placed have'} not shipped yet. When your ` + `account is closed, ${one ? 'it is' : 'each is'} canceled and refunded in full, shipping and tax ` + `included, to the card it was paid with, and you get an email about ${one ? 'it' : 'each'}. Nothing ` + `will ship. Keep your account if you still want ${one ? 'it' : 'them'}.`,
47
+ items: unshipped.map(({ orderId, order })=>{
48
+ var _order_lines, _order_totalCents;
49
+ return {
50
+ id: orderId,
51
+ primary: `Order ${orderNumber(orderId)}`,
52
+ secondary: ((_order_lines = order.lines) != null ? _order_lines : []).map((line)=>`${line.name} × ${line.quantity}`).join(', ') || undefined,
53
+ amount: formatPosHardwareCents(Number((_order_totalCents = order.totalCents) != null ? _order_totalCents : 0))
54
+ };
55
+ })
56
+ }
57
+ ];
58
+ }
59
+ /** Reads the unshipped orders a closure of `subject` would cancel. */ async function unshippedOrders(subject) {
60
+ const firestore = firebaseAdmin.app().firestore();
61
+ if (subject.kind === 'workspace') {
62
+ const orders = firestore.collection('orgs').doc(subject.orgId).collection(POS_HARDWARE_ORDERS_COLLECTION);
63
+ // One equality query per status, as the closure reads them.
64
+ const found = await Promise.all([
65
+ 'paid',
66
+ 'ordered'
67
+ ].map((status)=>orders.where('status', '==', status).get()));
68
+ return found.flatMap((snapshot)=>snapshot.docs.map((doc)=>({
69
+ orderId: doc.id,
70
+ order: doc.data()
71
+ })));
72
+ }
73
+ const placed = await firestore.collectionGroup(POS_HARDWARE_ORDERS_COLLECTION).where('createdBy', '==', subject.uid).get();
74
+ return placed.docs.map((doc)=>({
75
+ orderId: doc.id,
76
+ order: doc.data()
77
+ }));
78
+ }
79
+ /** The hardware shop's closure notices, as the declarations register them. */ export const posHardwareClosureNoticeSource = {
80
+ async notices (subject) {
81
+ return posHardwareClosureNotice(subject.kind, await unshippedOrders(subject));
82
+ }
83
+ };
84
+
85
+ //# sourceMappingURL=pos-hardware-closure-notices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/pos-hardware-closure-notices.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 type {\n ClosureNotice,\n ClosureNoticeSource,\n ClosureSubject,\n} from '@aglyn/aglyn/plugin-manager/plugin-closure-notices'\nimport { firebaseAdmin } from '@aglyn/tenant-data-admin'\nimport {\n formatPosHardwareCents,\n POS_HARDWARE_ORDERS_COLLECTION,\n posHardwareRefundable,\n type PosHardwareOrder,\n} from '../model/pos-hardware'\n\n/*==========================================\n * BEFORE A CLOSURE: WHICH HARDWARE ORDERS IT WILL CANCEL AND REFUND (AGL-4038).\n *\n * Deleting a workspace, or closing the account that placed an order, cancels\n * every card reader order that has not shipped — paid, or already placed\n * with Stripe — and refunds it in full (`pos-hardware-closure.ts`). The\n * delete-workspace and close-account screens ask core's closure notices\n * before the confirm, and this answers for the hardware shop: one warning\n * listing each such order, its number, its items and what is refunded.\n *\n * The same orders the closure reads: a workspace's own (`paid` or `ordered`),\n * or every one the person placed in any workspace (by `createdBy`, the\n * collection-group override the account eraser uses). Nothing is held back:\n * the closure goes ahead, and this only says what it will do.\n *=========================================*/\n\n/** The notice's id. */\nexport const POS_HARDWARE_CLOSURE_NOTICE_ID = 'pos-hardware-unshipped-orders'\n\n/** The number a person reads: `HW-` and six characters of the id. */\nfunction orderNumber(orderId: string): string {\n return `HW-${orderId.replace(/^hw_/, '').slice(0, 6).toUpperCase()}`\n}\n\n/** The warning for these unshipped orders, or none when there are none. Pure. */\nexport function posHardwareClosureNotice(\n subject: ClosureSubject['kind'],\n orders: ReadonlyArray<{ orderId: string; order: Pick<PosHardwareOrder, 'status' | 'lines' | 'totalCents'> }>,\n): ClosureNotice[] {\n const unshipped = orders.filter(({ order }) => posHardwareRefundable(order?.status))\n if (!unshipped.length) return []\n const count = unshipped.length\n const one = count === 1\n return [\n {\n id: POS_HARDWARE_CLOSURE_NOTICE_ID,\n severity: 'warning',\n title: one\n ? 'A card reader order will be canceled and refunded'\n : `${count} card reader orders will be canceled and refunded`,\n body:\n subject === 'workspace'\n ? `${one ? 'This order has' : 'These orders have'} not shipped yet. When the workspace is deleted, ` +\n `${one ? 'it is' : 'each is'} canceled and refunded in full, shipping and tax included, to the card ` +\n `it was paid with, and the person who placed ${one ? 'it gets an email' : 'each gets an email'}. ` +\n `Nothing will ship. Keep the workspace if you still want ${one ? 'it' : 'them'}.`\n : `${one ? 'This order you placed has' : 'These orders you placed have'} not shipped yet. When your ` +\n `account is closed, ${one ? 'it is' : 'each is'} canceled and refunded in full, shipping and tax ` +\n `included, to the card it was paid with, and you get an email about ${one ? 'it' : 'each'}. Nothing ` +\n `will ship. Keep your account if you still want ${one ? 'it' : 'them'}.`,\n items: unshipped.map(({ orderId, order }) => ({\n id: orderId,\n primary: `Order ${orderNumber(orderId)}`,\n secondary: (order.lines ?? []).map((line) => `${line.name} × ${line.quantity}`).join(', ') || undefined,\n amount: formatPosHardwareCents(Number(order.totalCents ?? 0)),\n })),\n },\n ]\n}\n\n/** Reads the unshipped orders a closure of `subject` would cancel. */\nasync function unshippedOrders(\n subject: ClosureSubject,\n): Promise<Array<{ orderId: string; order: PosHardwareOrder }>> {\n const firestore = firebaseAdmin.app().firestore()\n if (subject.kind === 'workspace') {\n const orders = firestore.collection('orgs').doc(subject.orgId).collection(POS_HARDWARE_ORDERS_COLLECTION)\n // One equality query per status, as the closure reads them.\n const found = await Promise.all(['paid', 'ordered'].map((status) => orders.where('status', '==', status).get()))\n return found.flatMap((snapshot) =>\n snapshot.docs.map((doc: { id: string; data: () => unknown }) => ({ orderId: doc.id, order: doc.data() as PosHardwareOrder })),\n )\n }\n const placed = await firestore.collectionGroup(POS_HARDWARE_ORDERS_COLLECTION).where('createdBy', '==', subject.uid).get()\n return placed.docs.map((doc: { id: string; data: () => unknown }) => ({ orderId: doc.id, order: doc.data() as PosHardwareOrder }))\n}\n\n/** The hardware shop's closure notices, as the declarations register them. */\nexport const posHardwareClosureNoticeSource: ClosureNoticeSource = {\n async notices(subject) {\n return posHardwareClosureNotice(subject.kind, await unshippedOrders(subject))\n },\n}\n"],"names":["firebaseAdmin","formatPosHardwareCents","POS_HARDWARE_ORDERS_COLLECTION","posHardwareRefundable","POS_HARDWARE_CLOSURE_NOTICE_ID","orderNumber","orderId","replace","slice","toUpperCase","posHardwareClosureNotice","subject","orders","unshipped","filter","order","status","length","count","one","id","severity","title","body","items","map","primary","secondary","lines","line","name","quantity","join","undefined","amount","Number","totalCents","unshippedOrders","firestore","app","kind","collection","doc","orgId","found","Promise","all","where","get","flatMap","snapshot","docs","data","placed","collectionGroup","uid","posHardwareClosureNoticeSource","notices"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAOD,SAASA,aAAa,QAAQ,2BAA0B;AACxD,SACEC,sBAA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C,SAAQ9C,OAAO;QACnB,OAAOD,yBAAyBC,QAAQ6B,IAAI,EAAE,MAAMH,gBAAgB1B;IACtE;AACF,EAAC"}
@@ -0,0 +1,60 @@
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 { PluginOrgEraser } from '@aglyn/aglyn/plugin-manager/plugin-org-erasure';
18
+ import { type PosHardwareCancelReason, type PosHardwareOrder } from '../model/pos-hardware';
19
+ type Firestore = FirebaseFirestore.Firestore;
20
+ export type PosHardwareClosureOutcome = 'canceled' | 'already' | 'skipped' | 'failed';
21
+ /**
22
+ * Cancels and refunds one unshipped order because of a closure, and tells
23
+ * the buyer and staff. Never throws. `known` is the order as the closure read
24
+ * it, for the alert should the cancel itself throw.
25
+ */
26
+ export declare function closeUnshippedPosHardwareOrder(orgId: string, orderId: string, reason: Exclude<PosHardwareCancelReason, 'staff'>, known?: PosHardwareOrder): Promise<PosHardwareClosureOutcome>;
27
+ /** What a closure did to one buyer's or workspace's hardware orders. */
28
+ export interface PosHardwareClosureCounts {
29
+ hardwareOrdersCanceled: number;
30
+ /** Of those, the ones staff had already placed with Stripe. */
31
+ hardwareOrdersPlacedWithStripe: number;
32
+ /** Unshipped orders whose refund Stripe refused; staff were alerted. */
33
+ hardwareRefundsFailed: number;
34
+ }
35
+ /**
36
+ * Cancels every order given that is still unshipped. `orders` is read before
37
+ * the call; each order is re-read under the lock by the cancel itself, so one
38
+ * that shipped in between is left alone.
39
+ */
40
+ export declare function closeUnshippedPosHardwareOrders(orders: ReadonlyArray<{
41
+ orderId: string;
42
+ order: PosHardwareOrder;
43
+ }>, reason: Exclude<PosHardwareCancelReason, 'staff'>): Promise<PosHardwareClosureCounts>;
44
+ export interface PosHardwareOrgEraserDeps {
45
+ firestore(): Firestore;
46
+ }
47
+ /**
48
+ * COMMERCE'S SHARE OF A WORKSPACE ERASURE: the workspace's unshipped hardware
49
+ * orders, canceled and refunded before the erasure deletes them with the
50
+ * workspace. It runs first among the erasure's steps (plugin erasers run
51
+ * while the workspace still stands), so the buyer's email can still name the
52
+ * site and the workspace.
53
+ *
54
+ * A plan (`dryRun`) counts what it would cancel and touches neither Stripe
55
+ * nor Firestore.
56
+ */
57
+ export declare function createPosHardwareOrgEraser(deps: PosHardwareOrgEraserDeps): PluginOrgEraser;
58
+ /** The eraser over the platform's own Firestore, as the declarations register it. */
59
+ export declare const posHardwareOrgEraser: PluginOrgEraser;
60
+ export {};
@@ -0,0 +1,153 @@
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
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
17
+ import { firebaseAdmin } from "@aglyn/tenant-data-admin";
18
+ import { addAdminAudit } from "@aglyn/tenant-data-admin/server/admin-audit-write";
19
+ import { POS_HARDWARE_ORDERS_COLLECTION } from "../model/pos-hardware.js";
20
+ import { cancelAndRefundPosHardwareOrder } from "./pos-hardware-cancel.js";
21
+ import { raisePosHardwareCanceledAfterOrderingAlert, raisePosHardwareRefundFailedAlert, sendPosHardwareEmailOnce } from "./pos-hardware-notify.js";
22
+ /** The unshipped statuses a closure cancels. */ const UNSHIPPED = [
23
+ 'paid',
24
+ 'ordered'
25
+ ];
26
+ /** The audit row's actor: the closure, never a person. */ const CLOSURE_ACTOR = {
27
+ 'workspace-closed': 'system:workspace-closed',
28
+ 'account-closed': 'system:account-closed'
29
+ };
30
+ /**
31
+ * Cancels and refunds one unshipped order because of a closure, and tells
32
+ * the buyer and staff. Never throws. `known` is the order as the closure read
33
+ * it, for the alert should the cancel itself throw.
34
+ */ export async function closeUnshippedPosHardwareOrder(orgId, orderId, reason, known) {
35
+ try {
36
+ var _result_order_refundId, _result_order_refundedCents;
37
+ const result = await cancelAndRefundPosHardwareOrder({
38
+ orgId,
39
+ orderId,
40
+ finalStatus: 'canceled',
41
+ reason
42
+ });
43
+ switch(result.outcome){
44
+ case 'missing':
45
+ case 'not-refundable':
46
+ return 'skipped';
47
+ case 'already':
48
+ // Canceled between the closure's read and the lock: whoever canceled
49
+ // it told the buyer and staff.
50
+ return 'already';
51
+ case 'no-payment':
52
+ await raisePosHardwareRefundFailedAlert(orderId, result.order, reason, 'the order has no payment to refund');
53
+ return 'failed';
54
+ case 'refused':
55
+ await raisePosHardwareRefundFailedAlert(orderId, result.order, reason, result.message);
56
+ return 'failed';
57
+ }
58
+ const firestore = firebaseAdmin.app().firestore();
59
+ await addAdminAudit(firestore, {
60
+ action: 'pos-hardware-order-cancel',
61
+ actorUid: CLOSURE_ACTOR[reason],
62
+ actorEmail: null,
63
+ scope: 'posHardwareOrder',
64
+ target: `orgs/${orgId}/${POS_HARDWARE_ORDERS_COLLECTION}/${orderId}`,
65
+ orgId,
66
+ before: {
67
+ status: result.before.status
68
+ },
69
+ after: {
70
+ status: result.order.status,
71
+ refundId: (_result_order_refundId = result.order.refundId) != null ? _result_order_refundId : null,
72
+ refundedCents: (_result_order_refundedCents = result.order.refundedCents) != null ? _result_order_refundedCents : null,
73
+ reason
74
+ },
75
+ at: firebaseAdmin.firestore.FieldValue.serverTimestamp()
76
+ }).catch((error)=>console.error('[pos-hardware] closure audit failed', orderId, error));
77
+ // Once between this and the staff page: a staff cancel that already
78
+ // told the buyer is not told again (AGL-4038).
79
+ await sendPosHardwareEmailOnce('canceled', orderId, result.order);
80
+ if (result.before.status === 'ordered') {
81
+ await raisePosHardwareCanceledAfterOrderingAlert(orderId, result.order, reason);
82
+ }
83
+ return 'canceled';
84
+ } catch (error) {
85
+ console.error('[pos-hardware] closure cancel failed', orderId, error);
86
+ await raisePosHardwareRefundFailedAlert(orderId, known != null ? known : {
87
+ orgId,
88
+ hostId: '',
89
+ status: 'paid',
90
+ totalCents: 0,
91
+ stripePaymentIntentId: null
92
+ }, reason, error instanceof Error ? error.message : String(error));
93
+ return 'failed';
94
+ }
95
+ }
96
+ /**
97
+ * Cancels every order given that is still unshipped. `orders` is read before
98
+ * the call; each order is re-read under the lock by the cancel itself, so one
99
+ * that shipped in between is left alone.
100
+ */ export async function closeUnshippedPosHardwareOrders(orders, reason) {
101
+ const counts = {
102
+ hardwareOrdersCanceled: 0,
103
+ hardwareOrdersPlacedWithStripe: 0,
104
+ hardwareRefundsFailed: 0
105
+ };
106
+ for (const { orderId, order } of orders){
107
+ if (!UNSHIPPED.includes(order == null ? void 0 : order.status)) continue;
108
+ const outcome = await closeUnshippedPosHardwareOrder(order.orgId, orderId, reason, order);
109
+ if (outcome === 'canceled') {
110
+ counts.hardwareOrdersCanceled += 1;
111
+ if (order.status === 'ordered') counts.hardwareOrdersPlacedWithStripe += 1;
112
+ }
113
+ if (outcome === 'failed') counts.hardwareRefundsFailed += 1;
114
+ }
115
+ return counts;
116
+ }
117
+ /**
118
+ * COMMERCE'S SHARE OF A WORKSPACE ERASURE: the workspace's unshipped hardware
119
+ * orders, canceled and refunded before the erasure deletes them with the
120
+ * workspace. It runs first among the erasure's steps (plugin erasers run
121
+ * while the workspace still stands), so the buyer's email can still name the
122
+ * site and the workspace.
123
+ *
124
+ * A plan (`dryRun`) counts what it would cancel and touches neither Stripe
125
+ * nor Firestore.
126
+ */ export function createPosHardwareOrgEraser(deps) {
127
+ return async ({ orgId, dryRun })=>{
128
+ const orders = deps.firestore().collection('orgs').doc(orgId).collection(POS_HARDWARE_ORDERS_COLLECTION);
129
+ // One equality query per status, each served by the automatic
130
+ // single-field index: a workspace's hardware orders are few.
131
+ const found = await Promise.all(UNSHIPPED.map((status)=>orders.where('status', '==', status).get()));
132
+ const unshipped = found.flatMap((snapshot)=>snapshot.docs.map((doc)=>({
133
+ orderId: doc.id,
134
+ // The path names the workspace; the field is what the order says.
135
+ order: _extends({}, doc.data(), {
136
+ orgId
137
+ })
138
+ })));
139
+ if (dryRun) {
140
+ return {
141
+ hardwareOrdersCanceled: unshipped.length,
142
+ hardwareOrdersPlacedWithStripe: unshipped.filter(({ order })=>order.status === 'ordered').length,
143
+ hardwareRefundsFailed: 0
144
+ };
145
+ }
146
+ return _extends({}, await closeUnshippedPosHardwareOrders(unshipped, 'workspace-closed'));
147
+ };
148
+ }
149
+ /** The eraser over the platform's own Firestore, as the declarations register it. */ export const posHardwareOrgEraser = (request)=>createPosHardwareOrgEraser({
150
+ firestore: ()=>firebaseAdmin.app().firestore()
151
+ })(request);
152
+
153
+ //# sourceMappingURL=pos-hardware-closure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/pos-hardware-closure.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 type {\n PluginOrgEraser,\n PluginOrgErasureReport,\n} from '@aglyn/aglyn/plugin-manager/plugin-org-erasure'\nimport { firebaseAdmin } from '@aglyn/tenant-data-admin'\nimport { addAdminAudit } from '@aglyn/tenant-data-admin/server/admin-audit-write'\nimport {\n POS_HARDWARE_ORDERS_COLLECTION,\n type PosHardwareCancelReason,\n type PosHardwareOrder,\n} from '../model/pos-hardware'\nimport { cancelAndRefundPosHardwareOrder } from './pos-hardware-cancel'\nimport {\n raisePosHardwareCanceledAfterOrderingAlert,\n raisePosHardwareRefundFailedAlert,\n sendPosHardwareEmailOnce,\n} from './pos-hardware-notify'\n\n/*==========================================\n * A CLOSURE CANCELS EVERY UNSHIPPED HARDWARE ORDER (AGL-4038).\n *\n * When the workspace that bought hardware is deleted, or the account that\n * placed an order is closed, every order of theirs that has not shipped —\n * `paid` or `ordered` — is canceled and refunded in full on the platform's\n * Stripe account, through the staff page's own path and its idempotency\n * (`pos-hardware-cancel.ts`). Then:\n *\n * - the buyer gets the \"canceled and refunded\" email, once: the same claim\n * the staff page sends it under (`sendPosHardwareEmailOnce`);\n * - staff get an alert when the order was already placed with Stripe\n * (`ordered`), because Stripe will still ship it unless someone cancels\n * it there, and another when Stripe refuses the refund;\n * - an `adminAudit` row records the cancel, with the closure as its actor.\n *\n * THE CLOSURE NEVER WAITS ON THIS. A refusal, or a throw, is counted and\n * alerted and the next order is tried; nothing here fails the erasure, so\n * the workspace or the account closes right away whatever Stripe says.\n * Shipped, delivered and registered orders are untouched, and the retained\n * sale record (`posHardwareSales`) records the refund and outlives both.\n *\n * Idempotent: a canceled order is no longer `paid` or `ordered`, so a second\n * closure run finds nothing to refund, sends no second email, raises no\n * second alert and makes no second Stripe call. A run that died after Stripe\n * refunded and before the order said so reads that refund back instead of\n * making another (`pos-hardware-cancel.ts`).\n *=========================================*/\n\ntype Firestore = FirebaseFirestore.Firestore\n\nexport type PosHardwareClosureOutcome = 'canceled' | 'already' | 'skipped' | 'failed'\n\n/** The unshipped statuses a closure cancels. */\nconst UNSHIPPED = ['paid', 'ordered'] as const\n\n/** The audit row's actor: the closure, never a person. */\nconst CLOSURE_ACTOR: Record<Exclude<PosHardwareCancelReason, 'staff'>, string> = {\n 'workspace-closed': 'system:workspace-closed',\n 'account-closed': 'system:account-closed',\n}\n\n/**\n * Cancels and refunds one unshipped order because of a closure, and tells\n * the buyer and staff. Never throws. `known` is the order as the closure read\n * it, for the alert should the cancel itself throw.\n */\nexport async function closeUnshippedPosHardwareOrder(\n orgId: string,\n orderId: string,\n reason: Exclude<PosHardwareCancelReason, 'staff'>,\n known?: PosHardwareOrder,\n): Promise<PosHardwareClosureOutcome> {\n try {\n const result = await cancelAndRefundPosHardwareOrder({ orgId, orderId, finalStatus: 'canceled', reason })\n switch (result.outcome) {\n case 'missing':\n case 'not-refundable':\n return 'skipped'\n case 'already':\n // Canceled between the closure's read and the lock: whoever canceled\n // it told the buyer and staff.\n return 'already'\n case 'no-payment':\n await raisePosHardwareRefundFailedAlert(orderId, result.order, reason, 'the order has no payment to refund')\n return 'failed'\n case 'refused':\n await raisePosHardwareRefundFailedAlert(orderId, result.order, reason, result.message)\n return 'failed'\n }\n const firestore = firebaseAdmin.app().firestore()\n await addAdminAudit(firestore, {\n action: 'pos-hardware-order-cancel',\n actorUid: CLOSURE_ACTOR[reason],\n actorEmail: null,\n scope: 'posHardwareOrder',\n target: `orgs/${orgId}/${POS_HARDWARE_ORDERS_COLLECTION}/${orderId}`,\n orgId,\n before: { status: result.before.status },\n after: {\n status: result.order.status,\n refundId: result.order.refundId ?? null,\n refundedCents: result.order.refundedCents ?? null,\n reason,\n },\n at: firebaseAdmin.firestore.FieldValue.serverTimestamp(),\n }).catch((error: unknown) => console.error('[pos-hardware] closure audit failed', orderId, error))\n // Once between this and the staff page: a staff cancel that already\n // told the buyer is not told again (AGL-4038).\n await sendPosHardwareEmailOnce('canceled', orderId, result.order)\n if (result.before.status === 'ordered') {\n await raisePosHardwareCanceledAfterOrderingAlert(orderId, result.order, reason)\n }\n return 'canceled'\n } catch (error) {\n console.error('[pos-hardware] closure cancel failed', orderId, error)\n await raisePosHardwareRefundFailedAlert(\n orderId,\n known ?? ({ orgId, hostId: '', status: 'paid', totalCents: 0, stripePaymentIntentId: null } as unknown as PosHardwareOrder),\n reason,\n error instanceof Error ? error.message : String(error),\n )\n return 'failed'\n }\n}\n\n/** What a closure did to one buyer's or workspace's hardware orders. */\nexport interface PosHardwareClosureCounts {\n hardwareOrdersCanceled: number\n /** Of those, the ones staff had already placed with Stripe. */\n hardwareOrdersPlacedWithStripe: number\n /** Unshipped orders whose refund Stripe refused; staff were alerted. */\n hardwareRefundsFailed: number\n}\n\n/**\n * Cancels every order given that is still unshipped. `orders` is read before\n * the call; each order is re-read under the lock by the cancel itself, so one\n * that shipped in between is left alone.\n */\nexport async function closeUnshippedPosHardwareOrders(\n orders: ReadonlyArray<{ orderId: string; order: PosHardwareOrder }>,\n reason: Exclude<PosHardwareCancelReason, 'staff'>,\n): Promise<PosHardwareClosureCounts> {\n const counts: PosHardwareClosureCounts = {\n hardwareOrdersCanceled: 0,\n hardwareOrdersPlacedWithStripe: 0,\n hardwareRefundsFailed: 0,\n }\n for (const { orderId, order } of orders) {\n if (!(UNSHIPPED as readonly string[]).includes(order?.status)) continue\n const outcome = await closeUnshippedPosHardwareOrder(order.orgId, orderId, reason, order)\n if (outcome === 'canceled') {\n counts.hardwareOrdersCanceled += 1\n if (order.status === 'ordered') counts.hardwareOrdersPlacedWithStripe += 1\n }\n if (outcome === 'failed') counts.hardwareRefundsFailed += 1\n }\n return counts\n}\n\nexport interface PosHardwareOrgEraserDeps {\n firestore(): Firestore\n}\n\n/**\n * COMMERCE'S SHARE OF A WORKSPACE ERASURE: the workspace's unshipped hardware\n * orders, canceled and refunded before the erasure deletes them with the\n * workspace. It runs first among the erasure's steps (plugin erasers run\n * while the workspace still stands), so the buyer's email can still name the\n * site and the workspace.\n *\n * A plan (`dryRun`) counts what it would cancel and touches neither Stripe\n * nor Firestore.\n */\nexport function createPosHardwareOrgEraser(deps: PosHardwareOrgEraserDeps): PluginOrgEraser {\n return async ({ orgId, dryRun }): Promise<PluginOrgErasureReport> => {\n const orders = deps.firestore().collection('orgs').doc(orgId).collection(POS_HARDWARE_ORDERS_COLLECTION)\n // One equality query per status, each served by the automatic\n // single-field index: a workspace's hardware orders are few.\n const found = await Promise.all(UNSHIPPED.map((status) => orders.where('status', '==', status).get()))\n const unshipped = found.flatMap((snapshot) =>\n snapshot.docs.map((doc) => ({\n orderId: doc.id,\n // The path names the workspace; the field is what the order says.\n order: { ...(doc.data() as PosHardwareOrder), orgId },\n })),\n )\n if (dryRun) {\n return {\n hardwareOrdersCanceled: unshipped.length,\n hardwareOrdersPlacedWithStripe: unshipped.filter(({ order }) => order.status === 'ordered').length,\n hardwareRefundsFailed: 0,\n }\n }\n return { ...(await closeUnshippedPosHardwareOrders(unshipped, 'workspace-closed')) }\n }\n}\n\n/** The eraser over the platform's own Firestore, as the declarations register it. */\nexport const posHardwareOrgEraser: PluginOrgEraser = (request) =>\n createPosHardwareOrgEraser({ firestore: () => firebaseAdmin.app().firestore() })(request)\n"],"names":["firebaseAdmin","addAdminAudit","POS_HARDWARE_ORDERS_COLLECTION","cancelAndRefundPosHardwareOrder","raisePosHardwareCanceledAfterOrderingAlert","raisePosHardwareRefundFailedAlert","sendPosHardwareEmailOnce","UNSHIPPED","CLOSURE_ACTOR","closeUnshippedPosHardwareOrder","orgId","orderId","reason","known","result","finalStatus","outcome","order","message","firestore","app","action","actorUid","actorEmail","scope","target","before","status","after","refundId","refundedCents","at","FieldValue","serverTimestamp","catch","error","console","hostId","totalCents","stripePaymentIntentId","Error","String","closeUnshippedPosHardwareOrders","orders","counts","hardwareOrdersCanceled","hardwareOrdersPlacedWithStripe","hardwareRefundsFailed","includes","createPosHardwareOrgEraser","deps","dryRun","collection","doc","found","Promise","all","map","where","get","unshipped","flatMap","snapshot","docs","id","data","length","filter","posHardwareOrgEraser","request"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAMD,SAASA,aAAa,QAAQ,2BAA0B;AACxD,SAASC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;CASC,GACD,OAAO,SAASK,2BAA2BC,IAA8B;IACvE,OAAO,OAAO,EAAExC,KAAK,EAAEyC,MAAM,EAAE;QAC7B,MAAMR,SAASO,KAAK/B,SAAS,GAAGiC,UAAU,CAAC,QAAQC,GAAG,CAAC3C,OAAO0C,UAAU,CAAClD;QACzE,8DAA8D;QAC9D,6DAA6D;QAC7D,MAAMoD,QAAQ,MAAMC,QAAQC,GAAG,CAACjD,UAAUkD,GAAG,CAAC,CAAC9B,SAAWgB,OAAOe,KAAK,CAAC,UAAU,MAAM/B,QAAQgC,GAAG;QAClG,MAAMC,YAAYN,MAAMO,OAAO,CAAC,CAACC,WAC/BA,SAASC,IAAI,CAACN,GAAG,CAAC,CAACJ,MAAS,CAAA;oBAC1B1C,SAAS0C,IAAIW,EAAE;oBACf,kEAAkE;oBAClE/C,OAAO,aAAMoC,IAAIY,IAAI;wBAAyBvD;;gBAChD,CAAA;QAEF,IAAIyC,QAAQ;YACV,OAAO;gBACLN,wBAAwBe,UAAUM,MAAM;gBACxCpB,gCAAgCc,UAAUO,MAAM,CAAC,CAAC,EAAElD,KAAK,EAAE,GAAKA,MAAMU,MAAM,KAAK,WAAWuC,MAAM;gBAClGnB,uBAAuB;YACzB;QACF;QACA,OAAO,aAAM,MAAML,gCAAgCkB,WAAW;IAChE;AACF;AAEA,mFAAmF,GACnF,OAAO,MAAMQ,uBAAwC,CAACC,UACpDpB,2BAA2B;QAAE9B,WAAW,IAAMnB,cAAcoB,GAAG,GAAGD,SAAS;IAAG,GAAGkD,SAAQ"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type PosHardwareInPersonConfig, type PosHardwareOrder } from '../model/pos-hardware';
18
+ export type InPersonRecordOutcome = {
19
+ outcome: 'off' | 'not-seller' | 'missing' | 'not-paid' | 'no-hardware';
20
+ } | {
21
+ outcome: 'recorded' | 'already';
22
+ orderId: string;
23
+ orgId: string;
24
+ pending: boolean;
25
+ };
26
+ /** How many marked sales one sweep records at most. */
27
+ export declare const IN_PERSON_SWEEP_LIMIT = 25;
28
+ /**
29
+ * Records the hardware order of one register sale on the seller store, once.
30
+ * Never throws for a sale that is not one: it says why it did nothing.
31
+ */
32
+ export declare function recordInPersonPosHardwareSale(hostId: string, registerOrderId: string, options?: {
33
+ offline?: boolean;
34
+ config?: PosHardwareInPersonConfig | null;
35
+ now?: number;
36
+ }): Promise<InPersonRecordOutcome>;
37
+ /**
38
+ * Records every paid sale on the seller store that is still marked, at most
39
+ * {@link IN_PERSON_SWEEP_LIMIT} a time, and drops the mark from a sale that
40
+ * can no longer be paid. Never throws: a sale it cannot record stays marked
41
+ * for the next sweep.
42
+ */
43
+ export declare function sweepInPersonPosHardwareSales(config?: PosHardwareInPersonConfig | null): Promise<{
44
+ recorded: number;
45
+ failed: number;
46
+ }>;
47
+ /** The "To attach" list: the selling workspace's pending in-person orders, newest first. */
48
+ export declare function pendingInPersonPosHardwareOrders(config: PosHardwareInPersonConfig, limit?: number): Promise<Array<{
49
+ id: string;
50
+ order: PosHardwareOrder;
51
+ }>>;
52
+ /**
53
+ * What the completion listener runs for a sale on the seller store. Never
54
+ * throws into a sale: a failure is logged and the sale stays marked for the
55
+ * sweep.
56
+ */
57
+ export declare function recordCompletedSaleHardware(event: {
58
+ hostId: string;
59
+ orderId: string;
60
+ offline?: boolean;
61
+ }): Promise<void>;