@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,251 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { customerDisplayHost, subscribeCustomerDisplayHost } from "@aglyn/aglyn/plugin-manager/plugin-customer-display";
19
+ import { Alert, Box, Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, Link, Stack, Typography } from "@mui/material";
20
+ import { useCallback, useEffect, useState, useSyncExternalStore } from "react";
21
+ import { BUNDLE_ID } from "../../../constants/bundle-common.js";
22
+ import { PosHardwareRequestError } from "./pos-hardware-api.js";
23
+ import { posHardwareAcceptTerms, posHardwareTerms, posHardwareTermsOnDisplay, posHardwareTermsStatus } from "./pos-hardware-sale-api.js";
24
+ /** The display page the terms open at, beneath `/kiosk/commerce` (`server/pos-display.ts`). */ export const POS_HARDWARE_TERMS_SCREEN_PATH = '/hardware-terms';
25
+ /** The printable booth sign, a public page of this plugin. */ export const POS_HARDWARE_TERMS_SIGN_HREF = `/kiosk/${BUNDLE_ID}/hardware-terms-sign`;
26
+ /** How often the register asks whether the buyer accepted on the display. */ export const POS_HARDWARE_TERMS_POLL_MS = 2500;
27
+ const METHOD_LABEL = {
28
+ tablet: 'on this tablet',
29
+ display: 'on the customer display',
30
+ notice: 'by the receipt and booth sign'
31
+ };
32
+ function useDisplayHost() {
33
+ return useSyncExternalStore(subscribeCustomerDisplayHost, customerDisplayHost, ()=>null);
34
+ }
35
+ /**
36
+ * The buyer accepts the terms of sale before paying (AGL-4038, Terms 4.28):
37
+ * on the customer display, which the register shows them on through core's
38
+ * display seam, or on this tablet, handed to them. Where neither can be
39
+ * used, every receipt of the sale and the booth sign state the terms, and
40
+ * paying is agreeing; the sign prints from here.
41
+ */ export function PosHardwareSaleTerms(props) {
42
+ var _ref, _ref1, _ref2;
43
+ const { user, hostId, saleOrderId, notify } = props;
44
+ const host = useDisplayHost();
45
+ const [acceptance, setAcceptance] = useState(null);
46
+ const [waiting, setWaiting] = useState(false);
47
+ const [tablet, setTablet] = useState(null);
48
+ const [agreed, setAgreed] = useState(false);
49
+ const [busy, setBusy] = useState(false);
50
+ const refresh = useCallback(async ()=>{
51
+ var _ref;
52
+ const answer = await posHardwareTermsStatus(user, hostId, saleOrderId).catch(()=>null);
53
+ if (answer) setAcceptance(answer.acceptance);
54
+ return (_ref = answer == null ? void 0 : answer.acceptance) != null ? _ref : null;
55
+ }, [
56
+ user,
57
+ hostId,
58
+ saleOrderId
59
+ ]);
60
+ useEffect(()=>{
61
+ setAcceptance(null);
62
+ setWaiting(false);
63
+ void refresh();
64
+ }, [
65
+ refresh
66
+ ]);
67
+ // Waiting on the display: asked until the buyer accepts there.
68
+ useEffect(()=>{
69
+ if (!waiting) return undefined;
70
+ const timer = window.setInterval(()=>{
71
+ void refresh().then((held)=>{
72
+ if (held && held.method !== 'notice') {
73
+ setWaiting(false);
74
+ notify('The buyer accepted the terms of sale on the display.', 'success');
75
+ }
76
+ });
77
+ }, POS_HARDWARE_TERMS_POLL_MS);
78
+ return ()=>window.clearInterval(timer);
79
+ }, [
80
+ waiting,
81
+ refresh,
82
+ notify
83
+ ]);
84
+ const fail = (caught, fallback)=>notify(caught instanceof PosHardwareRequestError ? caught.message : fallback, 'warning');
85
+ const showOnDisplay = async ()=>{
86
+ if (!host) return;
87
+ setBusy(true);
88
+ try {
89
+ await posHardwareTermsOnDisplay(user, hostId, saleOrderId);
90
+ const shown = await host.show({
91
+ pluginId: BUNDLE_ID,
92
+ path: POS_HARDWARE_TERMS_SCREEN_PATH,
93
+ params: {
94
+ order: saleOrderId
95
+ }
96
+ });
97
+ if (!shown) throw new Error('not shown');
98
+ setWaiting(true);
99
+ } catch (caught) {
100
+ fail(caught, 'The terms could not be shown on the display. Hand them this tablet instead.');
101
+ } finally{
102
+ setBusy(false);
103
+ }
104
+ };
105
+ const takeOff = async ()=>{
106
+ var _host_close;
107
+ setWaiting(false);
108
+ await (host == null ? void 0 : (_host_close = host.close) == null ? void 0 : _host_close.call(host, BUNDLE_ID));
109
+ };
110
+ const openTablet = async ()=>{
111
+ setBusy(true);
112
+ try {
113
+ setAgreed(false);
114
+ setTablet(await posHardwareTerms(user, hostId));
115
+ } catch (caught) {
116
+ fail(caught, 'The terms could not be shown.');
117
+ } finally{
118
+ setBusy(false);
119
+ }
120
+ };
121
+ const acceptOnTablet = async ()=>{
122
+ setBusy(true);
123
+ try {
124
+ const answer = await posHardwareAcceptTerms(user, hostId, saleOrderId);
125
+ setAcceptance(answer.acceptance);
126
+ setTablet(null);
127
+ notify('The buyer accepted the terms of sale.', 'success');
128
+ } catch (caught) {
129
+ fail(caught, 'The acceptance did not go through. Try again.');
130
+ } finally{
131
+ setBusy(false);
132
+ }
133
+ };
134
+ const accepted = acceptance && acceptance.method !== 'notice' ? acceptance : null;
135
+ return /*#__PURE__*/ _jsxs(_Fragment, {
136
+ children: [
137
+ /*#__PURE__*/ _jsx(Alert, {
138
+ severity: accepted ? 'success' : 'info',
139
+ action: accepted ? undefined : /*#__PURE__*/ _jsxs(Stack, {
140
+ direction: "row",
141
+ spacing: 1,
142
+ children: [
143
+ host ? waiting ? /*#__PURE__*/ _jsx(Button, {
144
+ size: "small",
145
+ onClick: ()=>void takeOff(),
146
+ children: 'Take off display'
147
+ }) : /*#__PURE__*/ _jsx(Button, {
148
+ size: "small",
149
+ disabled: busy,
150
+ onClick: ()=>void showOnDisplay(),
151
+ children: 'Show on display'
152
+ }) : null,
153
+ /*#__PURE__*/ _jsx(Button, {
154
+ size: "small",
155
+ disabled: busy,
156
+ onClick: ()=>void openTablet(),
157
+ children: 'Accept on this tablet'
158
+ })
159
+ ]
160
+ }),
161
+ children: accepted ? `Terms of sale accepted ${METHOD_LABEL[accepted.method]} at ${new Date(accepted.atMs).toLocaleTimeString()}.` : waiting ? 'Waiting for the buyer to accept the terms of sale on the display…' : 'Before the buyer pays, have them accept the terms of sale. If no screen can be used, the receipt and the booth sign state the terms, and paying is agreeing.'
162
+ }),
163
+ /*#__PURE__*/ _jsx(Typography, {
164
+ variant: "caption",
165
+ color: "text.secondary",
166
+ children: /*#__PURE__*/ _jsx(Link, {
167
+ href: POS_HARDWARE_TERMS_SIGN_HREF,
168
+ target: "_blank",
169
+ rel: "noopener",
170
+ children: 'Print the booth sign'
171
+ })
172
+ }),
173
+ /*#__PURE__*/ _jsxs(Dialog, {
174
+ open: Boolean(tablet),
175
+ onClose: ()=>setTablet(null),
176
+ maxWidth: "sm",
177
+ fullWidth: true,
178
+ children: [
179
+ /*#__PURE__*/ _jsx(DialogTitle, {
180
+ children: 'Terms of sale for your card reader hardware'
181
+ }),
182
+ /*#__PURE__*/ _jsxs(DialogContent, {
183
+ sx: {
184
+ display: 'flex',
185
+ flexDirection: 'column',
186
+ gap: 1.5
187
+ },
188
+ children: [
189
+ /*#__PURE__*/ _jsx(Typography, {
190
+ variant: "body2",
191
+ children: `Hand this tablet to the buyer. This purchase is made under our Terms, Sections ${(_ref = tablet == null ? void 0 : tablet.sections) != null ? _ref : ''}. In short:`
192
+ }),
193
+ /*#__PURE__*/ _jsx(Box, {
194
+ component: "ul",
195
+ sx: {
196
+ m: 0,
197
+ pl: 3,
198
+ display: 'flex',
199
+ flexDirection: 'column',
200
+ gap: 1
201
+ },
202
+ children: ((_ref1 = tablet == null ? void 0 : tablet.summary) != null ? _ref1 : []).map((line)=>/*#__PURE__*/ _jsx(Typography, {
203
+ component: "li",
204
+ variant: "body2",
205
+ children: line
206
+ }, line))
207
+ }),
208
+ /*#__PURE__*/ _jsxs(Typography, {
209
+ variant: "body2",
210
+ color: "text.secondary",
211
+ children: [
212
+ 'The full Terms: ',
213
+ /*#__PURE__*/ _jsx(Link, {
214
+ href: tablet == null ? void 0 : tablet.url,
215
+ target: "_blank",
216
+ rel: "noopener",
217
+ children: tablet == null ? void 0 : tablet.url.replace(/^https?:\/\//, '')
218
+ })
219
+ ]
220
+ }),
221
+ /*#__PURE__*/ _jsx(FormControlLabel, {
222
+ control: /*#__PURE__*/ _jsx(Checkbox, {
223
+ checked: agreed,
224
+ onChange: (event)=>setAgreed(event.target.checked)
225
+ }),
226
+ label: `I have read the terms of sale (Sections ${(_ref2 = tablet == null ? void 0 : tablet.sections) != null ? _ref2 : ''}) and accept them for this purchase.`
227
+ })
228
+ ]
229
+ }),
230
+ /*#__PURE__*/ _jsxs(DialogActions, {
231
+ children: [
232
+ /*#__PURE__*/ _jsx(Button, {
233
+ onClick: ()=>setTablet(null),
234
+ children: 'Not now'
235
+ }),
236
+ /*#__PURE__*/ _jsx(Button, {
237
+ variant: "contained",
238
+ disabled: !agreed || busy,
239
+ onClick: ()=>void acceptOnTablet(),
240
+ children: 'Accept'
241
+ })
242
+ ]
243
+ })
244
+ ]
245
+ })
246
+ ]
247
+ });
248
+ }
249
+ export default PosHardwareSaleTerms;
250
+
251
+ //# sourceMappingURL=pos-hardware-sale-terms.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos/pos-hardware-sale-terms.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use client'\n\nimport {\n customerDisplayHost,\n subscribeCustomerDisplayHost,\n} from '@aglyn/aglyn/plugin-manager/plugin-customer-display'\nimport {\n Alert,\n Box,\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n Link,\n Stack,\n Typography,\n} from '@mui/material'\nimport { useCallback, useEffect, useState, useSyncExternalStore } from 'react'\nimport { BUNDLE_ID } from '../../../constants/bundle-common'\nimport { PosHardwareRequestError } from './pos-hardware-api'\nimport {\n posHardwareAcceptTerms,\n posHardwareTerms,\n posHardwareTermsOnDisplay,\n posHardwareTermsStatus,\n type PosHardwareTermsAcceptanceView,\n type PosHardwareTermsView,\n} from './pos-hardware-sale-api'\n\ntype User = Parameters<typeof posHardwareTerms>[0]\ntype Notify = (message: string, variant: 'success' | 'info' | 'warning' | 'error') => void\n\n/** The display page the terms open at, beneath `/kiosk/commerce` (`server/pos-display.ts`). */\nexport const POS_HARDWARE_TERMS_SCREEN_PATH = '/hardware-terms'\n\n/** The printable booth sign, a public page of this plugin. */\nexport const POS_HARDWARE_TERMS_SIGN_HREF = `/kiosk/${BUNDLE_ID}/hardware-terms-sign`\n\n/** How often the register asks whether the buyer accepted on the display. */\nexport const POS_HARDWARE_TERMS_POLL_MS = 2_500\n\nconst METHOD_LABEL: Record<PosHardwareTermsAcceptanceView['method'], string> = {\n tablet: 'on this tablet',\n display: 'on the customer display',\n notice: 'by the receipt and booth sign',\n}\n\nfunction useDisplayHost() {\n return useSyncExternalStore(subscribeCustomerDisplayHost, customerDisplayHost, () => null)\n}\n\n/**\n * The buyer accepts the terms of sale before paying (AGL-4038, Terms 4.28):\n * on the customer display, which the register shows them on through core's\n * display seam, or on this tablet, handed to them. Where neither can be\n * used, every receipt of the sale and the booth sign state the terms, and\n * paying is agreeing; the sign prints from here.\n */\nexport function PosHardwareSaleTerms(props: { user: User; hostId: string; saleOrderId: string; notify: Notify }) {\n const { user, hostId, saleOrderId, notify } = props\n const host = useDisplayHost()\n const [acceptance, setAcceptance] = useState<PosHardwareTermsAcceptanceView | null>(null)\n const [waiting, setWaiting] = useState(false)\n const [tablet, setTablet] = useState<PosHardwareTermsView | null>(null)\n const [agreed, setAgreed] = useState(false)\n const [busy, setBusy] = useState(false)\n\n const refresh = useCallback(async () => {\n const answer = await posHardwareTermsStatus(user, hostId, saleOrderId).catch(() => null)\n if (answer) setAcceptance(answer.acceptance)\n return answer?.acceptance ?? null\n }, [user, hostId, saleOrderId])\n\n useEffect(() => {\n setAcceptance(null)\n setWaiting(false)\n void refresh()\n }, [refresh])\n\n // Waiting on the display: asked until the buyer accepts there.\n useEffect(() => {\n if (!waiting) return undefined\n const timer = window.setInterval(() => {\n void refresh().then((held) => {\n if (held && held.method !== 'notice') {\n setWaiting(false)\n notify('The buyer accepted the terms of sale on the display.', 'success')\n }\n })\n }, POS_HARDWARE_TERMS_POLL_MS)\n return () => window.clearInterval(timer)\n }, [waiting, refresh, notify])\n\n const fail = (caught: unknown, fallback: string) =>\n notify(caught instanceof PosHardwareRequestError ? caught.message : fallback, 'warning')\n\n const showOnDisplay = async () => {\n if (!host) return\n setBusy(true)\n try {\n await posHardwareTermsOnDisplay(user, hostId, saleOrderId)\n const shown = await host.show({ pluginId: BUNDLE_ID, path: POS_HARDWARE_TERMS_SCREEN_PATH, params: { order: saleOrderId } })\n if (!shown) throw new Error('not shown')\n setWaiting(true)\n } catch (caught) {\n fail(caught, 'The terms could not be shown on the display. Hand them this tablet instead.')\n } finally {\n setBusy(false)\n }\n }\n\n const takeOff = async () => {\n setWaiting(false)\n await host?.close?.(BUNDLE_ID)\n }\n\n const openTablet = async () => {\n setBusy(true)\n try {\n setAgreed(false)\n setTablet(await posHardwareTerms(user, hostId))\n } catch (caught) {\n fail(caught, 'The terms could not be shown.')\n } finally {\n setBusy(false)\n }\n }\n\n const acceptOnTablet = async () => {\n setBusy(true)\n try {\n const answer = await posHardwareAcceptTerms(user, hostId, saleOrderId)\n setAcceptance(answer.acceptance)\n setTablet(null)\n notify('The buyer accepted the terms of sale.', 'success')\n } catch (caught) {\n fail(caught, 'The acceptance did not go through. Try again.')\n } finally {\n setBusy(false)\n }\n }\n\n const accepted = acceptance && acceptance.method !== 'notice' ? acceptance : null\n return (\n <>\n <Alert\n severity={accepted ? 'success' : 'info'}\n action={\n accepted ? undefined : (\n <Stack direction=\"row\" spacing={1}>\n {host ? (\n waiting ? (\n <Button size=\"small\" onClick={() => void takeOff()}>\n {'Take off display'}\n </Button>\n ) : (\n <Button size=\"small\" disabled={busy} onClick={() => void showOnDisplay()}>\n {'Show on display'}\n </Button>\n )\n ) : null}\n <Button size=\"small\" disabled={busy} onClick={() => void openTablet()}>\n {'Accept on this tablet'}\n </Button>\n </Stack>\n )\n }\n >\n {accepted\n ? `Terms of sale accepted ${METHOD_LABEL[accepted.method]} at ${new Date(accepted.atMs).toLocaleTimeString()}.`\n : waiting\n ? 'Waiting for the buyer to accept the terms of sale on the display…'\n : 'Before the buyer pays, have them accept the terms of sale. If no screen can be used, the receipt and the booth sign state the terms, and paying is agreeing.'}\n </Alert>\n <Typography variant=\"caption\" color=\"text.secondary\">\n <Link href={POS_HARDWARE_TERMS_SIGN_HREF} target=\"_blank\" rel=\"noopener\">\n {'Print the booth sign'}\n </Link>\n </Typography>\n <Dialog open={Boolean(tablet)} onClose={() => setTablet(null)} maxWidth=\"sm\" fullWidth>\n <DialogTitle>{'Terms of sale for your card reader hardware'}</DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>\n <Typography variant=\"body2\">\n {`Hand this tablet to the buyer. This purchase is made under our Terms, Sections ${tablet?.sections ?? ''}. In short:`}\n </Typography>\n <Box component=\"ul\" sx={{ m: 0, pl: 3, display: 'flex', flexDirection: 'column', gap: 1 }}>\n {(tablet?.summary ?? []).map((line) => (\n <Typography key={line} component=\"li\" variant=\"body2\">\n {line}\n </Typography>\n ))}\n </Box>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'The full Terms: '}\n <Link href={tablet?.url} target=\"_blank\" rel=\"noopener\">\n {tablet?.url.replace(/^https?:\\/\\//, '')}\n </Link>\n </Typography>\n <FormControlLabel\n control={<Checkbox checked={agreed} onChange={(event) => setAgreed(event.target.checked)} />}\n label={`I have read the terms of sale (Sections ${tablet?.sections ?? ''}) and accept them for this purchase.`}\n />\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setTablet(null)}>{'Not now'}</Button>\n <Button variant=\"contained\" disabled={!agreed || busy} onClick={() => void acceptOnTablet()}>\n {'Accept'}\n </Button>\n </DialogActions>\n </Dialog>\n </>\n )\n}\n\nexport default PosHardwareSaleTerms\n"],"names":["customerDisplayHost","subscribeCustomerDisplayHost","Alert","Box","Button","Checkbox","Dialog","DialogActions","DialogContent","DialogTitle","FormControlLabel","Link","Stack","Typography","useCallback","useEffect","useState","useSyncExternalStore","BUNDLE_ID","PosHardwareRequestError","posHardwareAcceptTerms","posHardwareTerms","posHardwareTermsOnDisplay","posHardwareTermsStatus","POS_HARDWARE_TERMS_SCREEN_PATH","POS_HARDWARE_TERMS_SIGN_HREF","POS_HARDWARE_TERMS_POLL_MS","METHOD_LABEL","tablet","display","notice","useDisplayHost","PosHardwareSaleTerms","props","user","hostId","saleOrderId","notify","host","acceptance","setAcceptance","waiting","setWaiting","setTablet","agreed","setAgreed","busy","setBusy","refresh","answer","catch","undefined","timer","window","setInterval","then","held","method","clearInterval","fail","caught","fallback","message","showOnDisplay","shown","show","pluginId","path","params","order","Error","takeOff","close","openTablet","acceptOnTablet","accepted","severity","action","direction","spacing","size","onClick","disabled","Date","atMs","toLocaleTimeString","variant","color","href","target","rel","open","Boolean","onClose","maxWidth","fullWidth","sx","flexDirection","gap","sections","component","m","pl","summary","map","line","url","replace","control","checked","onChange","event","label"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;AAEA,SACEA,mBAAmB,EACnBC,4BAA4B,QACvB,sDAAqD;AAC5D,SACEC,KAAK,EACLC,GAAG,EACHC,MAAM,EACNC,QAAQ,EACRC,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,gBAAgB,EAChBC,IAAI,EACJC,KAAK,EACLC,UAAU,QACL,gBAAe;AACtB,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,oBAAoB,QAAQ,QAAO;AAC9E,SAASC,SAAS,QAAQ,sCAAkC;AAC5D,SAASC,uBAAuB,QAAQ,wBAAoB;AAC5D,SACEC,sBAAsB,EACtBC,gBAAgB,EAChBC,yBAAyB,EACzBC,sBAAsB,QAGjB,6BAAyB;AAKhC,6FAA6F,GAC7F,OAAO,MAAMC,iCAAiC,kBAAiB;AAE/D,4DAA4D,GAC5D,OAAO,MAAMC,+BAA+B,CAAC,OAAO,EAAEP,UAAU,oBAAoB,CAAC,CAAA;AAErF,2EAA2E,GAC3E,OAAO,MAAMQ,6BAA6B,KAAK;AAE/C,MAAMC,eAAyE;IAC7EC,QAAQ;IACRC,SAAS;IACTC,QAAQ;AACV;AAEA,SAASC;IACP,OAAOd,qB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AAQkE,UAAU,CAACC,QAAUlE,UAAUkE,MAAMtB,MAAM,CAACoB,OAAO;;gCACvFG,OAAO,CAAC,wCAAwC,WAAEpF,0BAAAA,OAAQuE,QAAQ,oBAAI,GAAG,oCAAoC,CAAC;;;;kCAGlH,MAAC5F;;0CACC,KAACH;gCAAO6E,SAAS,IAAMtC,UAAU;0CAAQ;;0CACzC,KAACvC;gCAAOkF,SAAQ;gCAAYJ,UAAU,CAACtC,UAAUE;gCAAMmC,SAAS,IAAM,KAAKP;0CACxE;;;;;;;;AAMb;AAEA,eAAe1C,qBAAoB"}
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */ 'use client';
17
17
  import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { registerCustomerDisplayHost } from "@aglyn/aglyn/plugin-manager/plugin-customer-display";
18
19
  import { useCallback, useEffect, useRef, useState } from "react";
19
20
  import { newAttemptKey, posDisplayCall } from "./pos-api.js";
20
21
  /**
@@ -72,6 +73,55 @@ import { newAttemptKey, posDisplayCall } from "./pos-api.js";
72
73
  hostId,
73
74
  registerId
74
75
  ]);
76
+ // While this register has a display, any plugin's widget on the page may
77
+ // put one of its own public pages on it (AGL-4042), through core's seam,
78
+ // which names no plugin here and no register there.
79
+ useEffect(()=>{
80
+ if (!connected || !uid || !registerId) return undefined;
81
+ return registerCustomerDisplayHost({
82
+ show: async (screen)=>{
83
+ const signedIn = userRef.current;
84
+ if (!signedIn) return false;
85
+ try {
86
+ await posDisplayCall(signedIn, {
87
+ action: 'push',
88
+ hostId,
89
+ registerId,
90
+ state: {
91
+ mode: 'screen',
92
+ screen,
93
+ promptId: newAttemptKey().slice(0, 32)
94
+ }
95
+ });
96
+ return true;
97
+ } catch (unused) {
98
+ return false;
99
+ }
100
+ },
101
+ // Staff closed the plugin's screen (AGL-4042): the display shows the
102
+ // register's own screen again, unless the register already moved on.
103
+ close: async (pluginId)=>{
104
+ const signedIn = userRef.current;
105
+ if (!signedIn) return false;
106
+ try {
107
+ await posDisplayCall(signedIn, {
108
+ action: 'close-screen',
109
+ hostId,
110
+ registerId,
111
+ pluginId
112
+ });
113
+ return true;
114
+ } catch (unused) {
115
+ return false;
116
+ }
117
+ }
118
+ });
119
+ }, [
120
+ connected,
121
+ uid,
122
+ hostId,
123
+ registerId
124
+ ]);
75
125
  const show = useCallback(async (state)=>{
76
126
  if (!user || !registerId || !connected) return;
77
127
  await posDisplayCall(user, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../../libs/plugins/commerce/src/lib/components/console/pos/use-pos-display.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'use client'\n\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport type * as CommerceModel from '../../../model'\nimport { newAttemptKey, posDisplayCall } from './pos-api'\n\ntype User = Parameters<typeof posDisplayCall>[0]\n\n/**\n * The tip the customer screen shows beside the sale (AGL-3608): the tips\n * already on its payments, plus one chosen for the payment about to be taken\n * (on the display or by the cashier), which the ledger does not hold until\n * that payment is recorded. Without the second part the screen read the\n * sale's total right after the customer added a tip, short by that tip.\n */\nexport function posDisplayTipCents(\n sale: { status: string; tipCents: number } | null | undefined,\n pendingTipCents: number,\n): number {\n if (!sale) return 0\n const pending = sale.status === 'paid' ? 0 : Math.max(0, Math.round(pendingTipCents) || 0)\n return Math.max(0, sale.tipCents) + pending\n}\n\n/** How long the register waits for the customer to answer a prompt. */\nexport const POS_DISPLAY_ANSWER_TIMEOUT_MS = 3 * 60 * 1000\n\nexport interface PosDisplayControl {\n /** A display for this register polled within the last two minutes. */\n connected: boolean\n /** The prompt the register is waiting on, if any. */\n asking: CommerceModel.PosDisplayMode | null\n /** Shows something on the display with no answer expected. */\n show: (state: Omit<CommerceModel.PosDisplayState, 'updatedAtMs' | 'promptId'>) => Promise<void>\n /**\n * Asks the customer (a tip or a receipt) and resolves with their answer,\n * or null when the cashier cancels or the customer does not answer.\n */\n ask: (\n state: Omit<CommerceModel.PosDisplayState, 'updatedAtMs' | 'promptId'>,\n ) => Promise<CommerceModel.PosDisplayResponse | null>\n cancelAsk: () => void\n}\n\n/**\n * The register's half of the customer display (AGL-3608). It writes the\n * display's state through `commerce/pos-display` and reads answers back the\n * same way; nothing here talks to Firestore, because the display state is\n * server-only (it can hold a customer's typed email address).\n */\nexport function usePosDisplay(\n user: User | null | undefined,\n hostId: string,\n registerId: string,\n): PosDisplayControl {\n const [connected, setConnected] = useState(false)\n const [asking, setAsking] = useState<CommerceModel.PosDisplayMode | null>(null)\n const cancelRef = useRef<(() => void) | null>(null)\n // The poll reads the latest session through a ref and is keyed on the uid,\n // so a refreshed user object does not restart it.\n const userRef = useRef(user)\n userRef.current = user\n const uid = (user as { uid?: string } | null | undefined)?.uid ?? ''\n\n useEffect(() => {\n if (!uid || !registerId) return undefined\n let active = true\n const check = async () => {\n const signedIn = userRef.current\n if (!signedIn) return\n try {\n const result = await posDisplayCall<{ connected: boolean }>(\n signedIn,\n { action: 'state', hostId, registerId },\n 'GET',\n )\n if (active) setConnected(Boolean(result.connected))\n } catch {\n if (active) setConnected(false)\n }\n }\n void check()\n const timer = setInterval(check, 15_000)\n return () => {\n active = false\n clearInterval(timer)\n }\n }, [uid, hostId, registerId])\n\n const show = useCallback<PosDisplayControl['show']>(\n async (state) => {\n if (!user || !registerId || !connected) return\n await posDisplayCall(user, { action: 'push', hostId, registerId, state }).catch(() => undefined)\n },\n [user, hostId, registerId, connected],\n )\n\n const cancelAsk = useCallback(() => {\n cancelRef.current?.()\n }, [])\n\n const ask = useCallback<PosDisplayControl['ask']>(\n async (state) => {\n if (!user || !registerId) return null\n cancelRef.current?.()\n const promptId = newAttemptKey().slice(0, 32)\n await posDisplayCall(user, {\n action: 'push',\n hostId,\n registerId,\n state: { ...state, promptId },\n })\n setAsking(state.mode)\n return await new Promise<CommerceModel.PosDisplayResponse | null>((resolve) => {\n let done = false\n const finish = (answer: CommerceModel.PosDisplayResponse | null) => {\n if (done) return\n done = true\n clearInterval(timer)\n clearTimeout(timeout)\n cancelRef.current = null\n setAsking(null)\n resolve(answer)\n }\n const timer = setInterval(async () => {\n try {\n const result = await posDisplayCall<{\n state: CommerceModel.PosDisplayState | null\n }>(user, { action: 'state', hostId, registerId }, 'GET')\n const response = result.state?.response\n if (response && response.promptId === promptId) finish(response)\n } catch {\n // A missed poll is retried on the next tick.\n }\n }, 1000)\n const timeout = setTimeout(() => finish(null), POS_DISPLAY_ANSWER_TIMEOUT_MS)\n cancelRef.current = () => finish(null)\n })\n },\n [user, hostId, registerId],\n )\n\n // Pairing a new display is `usePosPairing` (AGL-3712), shared with the devices card.\n return { connected, asking, show, ask, cancelAsk }\n}\n"],"names":["useCallback","useEffect","useRef","useState","newAttemptKey","posDisplayCall","posDisplayTipCents","sale","pendingTipCents","pending","status","Math","max","round","tipCents","POS_DISPLAY_ANSWER_TIMEOUT_MS","usePosDisplay","user","hostId","registerId","connected","setConnected","asking","setAsking","cancelRef","userRef","current","uid","undefined","active","check","signedIn","result","action","Boolean","timer","setInterval","clearInterval","show","state","catch","cancelAsk","ask","promptId","slice","mode","Promise","resolve","done","finish","answer","clearTimeout","timeout","response","setTimeout"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAEhE,SAASC,aAAa,EAAEC,cAAc,QAAQ,eAAW;AAIzD;;;;;;CAMC,GACD,OAAO,SAASC,mBACdC,IAA6D,EAC7DC,eAAuB;IAEvB,IAAI,CAACD,MAAM,OAAO;IAClB,MAAME,U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src/lib/components/console/pos/use-pos-display.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'use client'\n\nimport { registerCustomerDisplayHost } from '@aglyn/aglyn/plugin-manager/plugin-customer-display'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport type * as CommerceModel from '../../../model'\nimport { newAttemptKey, posDisplayCall } from './pos-api'\n\ntype User = Parameters<typeof posDisplayCall>[0]\n\n/**\n * The tip the customer screen shows beside the sale (AGL-3608): the tips\n * already on its payments, plus one chosen for the payment about to be taken\n * (on the display or by the cashier), which the ledger does not hold until\n * that payment is recorded. Without the second part the screen read the\n * sale's total right after the customer added a tip, short by that tip.\n */\nexport function posDisplayTipCents(\n sale: { status: string; tipCents: number } | null | undefined,\n pendingTipCents: number,\n): number {\n if (!sale) return 0\n const pending = sale.status === 'paid' ? 0 : Math.max(0, Math.round(pendingTipCents) || 0)\n return Math.max(0, sale.tipCents) + pending\n}\n\n/** How long the register waits for the customer to answer a prompt. */\nexport const POS_DISPLAY_ANSWER_TIMEOUT_MS = 3 * 60 * 1000\n\nexport interface PosDisplayControl {\n /** A display for this register polled within the last two minutes. */\n connected: boolean\n /** The prompt the register is waiting on, if any. */\n asking: CommerceModel.PosDisplayMode | null\n /** Shows something on the display with no answer expected. */\n show: (state: Omit<CommerceModel.PosDisplayState, 'updatedAtMs' | 'promptId'>) => Promise<void>\n /**\n * Asks the customer (a tip or a receipt) and resolves with their answer,\n * or null when the cashier cancels or the customer does not answer.\n */\n ask: (\n state: Omit<CommerceModel.PosDisplayState, 'updatedAtMs' | 'promptId'>,\n ) => Promise<CommerceModel.PosDisplayResponse | null>\n cancelAsk: () => void\n}\n\n/**\n * The register's half of the customer display (AGL-3608). It writes the\n * display's state through `commerce/pos-display` and reads answers back the\n * same way; nothing here talks to Firestore, because the display state is\n * server-only (it can hold a customer's typed email address).\n */\nexport function usePosDisplay(\n user: User | null | undefined,\n hostId: string,\n registerId: string,\n): PosDisplayControl {\n const [connected, setConnected] = useState(false)\n const [asking, setAsking] = useState<CommerceModel.PosDisplayMode | null>(null)\n const cancelRef = useRef<(() => void) | null>(null)\n // The poll reads the latest session through a ref and is keyed on the uid,\n // so a refreshed user object does not restart it.\n const userRef = useRef(user)\n userRef.current = user\n const uid = (user as { uid?: string } | null | undefined)?.uid ?? ''\n\n useEffect(() => {\n if (!uid || !registerId) return undefined\n let active = true\n const check = async () => {\n const signedIn = userRef.current\n if (!signedIn) return\n try {\n const result = await posDisplayCall<{ connected: boolean }>(\n signedIn,\n { action: 'state', hostId, registerId },\n 'GET',\n )\n if (active) setConnected(Boolean(result.connected))\n } catch {\n if (active) setConnected(false)\n }\n }\n void check()\n const timer = setInterval(check, 15_000)\n return () => {\n active = false\n clearInterval(timer)\n }\n }, [uid, hostId, registerId])\n\n // While this register has a display, any plugin's widget on the page may\n // put one of its own public pages on it (AGL-4042), through core's seam,\n // which names no plugin here and no register there.\n useEffect(() => {\n if (!connected || !uid || !registerId) return undefined\n return registerCustomerDisplayHost({\n show: async (screen) => {\n const signedIn = userRef.current\n if (!signedIn) return false\n try {\n await posDisplayCall(signedIn, {\n action: 'push',\n hostId,\n registerId,\n state: { mode: 'screen', screen, promptId: newAttemptKey().slice(0, 32) },\n })\n return true\n } catch {\n return false\n }\n },\n // Staff closed the plugin's screen (AGL-4042): the display shows the\n // register's own screen again, unless the register already moved on.\n close: async (pluginId) => {\n const signedIn = userRef.current\n if (!signedIn) return false\n try {\n await posDisplayCall(signedIn, { action: 'close-screen', hostId, registerId, pluginId })\n return true\n } catch {\n return false\n }\n },\n })\n }, [connected, uid, hostId, registerId])\n\n const show = useCallback<PosDisplayControl['show']>(\n async (state) => {\n if (!user || !registerId || !connected) return\n await posDisplayCall(user, { action: 'push', hostId, registerId, state }).catch(() => undefined)\n },\n [user, hostId, registerId, connected],\n )\n\n const cancelAsk = useCallback(() => {\n cancelRef.current?.()\n }, [])\n\n const ask = useCallback<PosDisplayControl['ask']>(\n async (state) => {\n if (!user || !registerId) return null\n cancelRef.current?.()\n const promptId = newAttemptKey().slice(0, 32)\n await posDisplayCall(user, {\n action: 'push',\n hostId,\n registerId,\n state: { ...state, promptId },\n })\n setAsking(state.mode)\n return await new Promise<CommerceModel.PosDisplayResponse | null>((resolve) => {\n let done = false\n const finish = (answer: CommerceModel.PosDisplayResponse | null) => {\n if (done) return\n done = true\n clearInterval(timer)\n clearTimeout(timeout)\n cancelRef.current = null\n setAsking(null)\n resolve(answer)\n }\n const timer = setInterval(async () => {\n try {\n const result = await posDisplayCall<{\n state: CommerceModel.PosDisplayState | null\n }>(user, { action: 'state', hostId, registerId }, 'GET')\n const response = result.state?.response\n if (response && response.promptId === promptId) finish(response)\n } catch {\n // A missed poll is retried on the next tick.\n }\n }, 1000)\n const timeout = setTimeout(() => finish(null), POS_DISPLAY_ANSWER_TIMEOUT_MS)\n cancelRef.current = () => finish(null)\n })\n },\n [user, hostId, registerId],\n )\n\n // Pairing a new display is `usePosPairing` (AGL-3712), shared with the devices card.\n return { connected, asking, show, ask, cancelAsk }\n}\n"],"names":["registerCustomerDisplayHost","useCallback","useEffect","useRef","useState","newAttemptKey","posDisplayCall","posDisplayTipCents","sale","pendingTipCents","pending","status","Math","max","round","tipCents","POS_DISPLAY_ANSWER_TIMEOUT_MS","usePosDisplay","user","hostId","registerId","connected","setConnected","asking","setAsking","cancelRef","userRef","current","uid","undefined","active","check","signedIn","result","action","Boolean","timer","setInterval","clearInterval","show","screen","state","mode","promptId","slice","close","pluginId","catch","cancelAsk","ask","Promise","resolve","done","finish","answer","clearTimeout","timeout","response","setTimeout"],"mapp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,MAAMhD,YACV,OAAOwC;QACL,IAAI,CAACvB,QAAQ,CAACE,YAAY,OAAO;QACjCK,UAAUE,OAAO,oBAAjBF,UAAUE,OAAO,MAAjBF;QACA,MAAMkB,WAAWtC,gBAAgBuC,KAAK,CAAC,GAAG;QAC1C,MAAMtC,eAAeY,MAAM;YACzBgB,QAAQ;YACRf;YACAC;YACAqB,OAAO,aAAKA;gBAAOE;;QACrB;QACAnB,UAAUiB,MAAMC,IAAI;QACpB,OAAO,MAAM,IAAIQ,QAAiD,CAACC;YACjE,IAAIC,OAAO;YACX,MAAMC,SAAS,CAACC;gBACd,IAAIF,MAAM;gBACVA,OAAO;gBACPd,cAAcF;gBACdmB,aAAaC;gBACb/B,UAAUE,OAAO,GAAG;gBACpBH,UAAU;gBACV2B,QAAQG;YACV;YACA,MAAMlB,QAAQC,YAAY;gBACxB,IAAI;wBAIeJ;oBAHjB,MAAMA,SAAS,MAAM3B,eAElBY,MAAM;wBAAEgB,QAAQ;wBAASf;wBAAQC;oBAAW,GAAG;oBAClD,MAAMqC,YAAWxB,gBAAAA,OAAOQ,KAAK,qBAAZR,cAAcwB,QAAQ;oBACvC,IAAIA,YAAYA,SAASd,QAAQ,KAAKA,UAAUU,OAAOI;gBACzD,EAAE,eAAM;gBACN,6CAA6C;gBAC/C;YACF,GAAG;YACH,MAAMD,UAAUE,WAAW,IAAML,OAAO,OAAOrC;YAC/CS,UAAUE,OAAO,GAAG,IAAM0B,OAAO;QACnC;IACF,GACA;QAACnC;QAAMC;QAAQC;KAAW;IAG5B,qFAAqF;IACrF,OAAO;QAAEC;QAAWE;QAAQgB;QAAMU;QAAKD;IAAU;AACnD"}
@@ -0,0 +1,41 @@
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 { PosCellularView } from '../../model/pos-cellular';
18
+ export interface PosCellularControlProps {
19
+ hostId: string;
20
+ cellular: PosCellularView;
21
+ /** Why the viewer may not change it ("Registers and devices"), or null. */
22
+ blocked: string | null;
23
+ /** Reload the card once it changed. */
24
+ onChanged: () => void | Promise<void>;
25
+ }
26
+ /**
27
+ * 4G for a store's Stripe Reader S710s (AGL-4038), on the POS devices card.
28
+ * Stripe turns cellular service on for a store's reader Location, so this is
29
+ * one switch for the store: it says plainly that every S710 at the store
30
+ * gets 4G and that each one is charged, and turning it on takes an explicit
31
+ * agreement to the monthly price. Turning it ON is charged to the workspace,
32
+ * so it also takes "Manage billing": without it the control says so rather
33
+ * than hiding. A store whose 4G was turned off for an unpaid month says
34
+ * which, and how to turn it back on. Loaded only where 4G is offered and the
35
+ * store has an S710.
36
+ */
37
+ export declare function PosCellularControl({ hostId, cellular, blocked, onChanged }: PosCellularControlProps): import("react").JSX.Element;
38
+ export declare namespace PosCellularControl {
39
+ var displayName: string;
40
+ }
41
+ export default PosCellularControl;
@@ -0,0 +1,211 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * @license
5
+ * Copyright 2026 Aglyn LLC
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */ import { BlockedControl } from "@aglyn/shared-ui-jsx/components/blocked-control.component";
19
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
20
+ import { useUser } from "@aglyn/tenant-feature-instance";
21
+ import { Alert, Box, Button, Checkbox, Chip, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, Stack, Typography } from "@mui/material";
22
+ import { useState } from "react";
23
+ import { posReadersCall, PosRequestError, usd } from "./pos/pos-api.js";
24
+ const readersText = (count)=>`${count} Stripe Reader S710${count === 1 ? '' : 's'}`;
25
+ /**
26
+ * 4G for a store's Stripe Reader S710s (AGL-4038), on the POS devices card.
27
+ * Stripe turns cellular service on for a store's reader Location, so this is
28
+ * one switch for the store: it says plainly that every S710 at the store
29
+ * gets 4G and that each one is charged, and turning it on takes an explicit
30
+ * agreement to the monthly price. Turning it ON is charged to the workspace,
31
+ * so it also takes "Manage billing": without it the control says so rather
32
+ * than hiding. A store whose 4G was turned off for an unpaid month says
33
+ * which, and how to turn it back on. Loaded only where 4G is offered and the
34
+ * store has an S710.
35
+ */ export function PosCellularControl({ hostId, cellular, blocked, onChanged }) {
36
+ var _cellular_turnOnBlocked;
37
+ const { data: user } = useUser();
38
+ const { enqueueSnackbar } = useSnackbar();
39
+ const [dialog, setDialog] = useState(null);
40
+ const [agreed, setAgreed] = useState(false);
41
+ const [busy, setBusy] = useState(false);
42
+ const price = usd(cellular.readerMonthlyCents);
43
+ // Off needs only the card's key; on is charged to the workspace, so billing too.
44
+ const reason = blocked != null ? blocked : cellular.enabled ? null : (_cellular_turnOnBlocked = cellular.turnOnBlocked) != null ? _cellular_turnOnBlocked : null;
45
+ const change = async (enabled)=>{
46
+ if (!user) return;
47
+ setBusy(true);
48
+ try {
49
+ await posReadersCall(user, _extends({
50
+ action: 'cellular',
51
+ hostId,
52
+ enabled
53
+ }, enabled ? {
54
+ consent: agreed
55
+ } : {}));
56
+ setDialog(null);
57
+ setAgreed(false);
58
+ enqueueSnackbar(enabled ? '4G is on for this store’s S710 readers' : '4G is off for this store', {
59
+ variant: 'success',
60
+ persist: false
61
+ });
62
+ await onChanged();
63
+ } catch (error) {
64
+ enqueueSnackbar(error instanceof PosRequestError ? error.message : '4G could not be changed. Try again.', {
65
+ variant: 'warning',
66
+ persist: false
67
+ });
68
+ } finally{
69
+ setBusy(false);
70
+ }
71
+ };
72
+ return /*#__PURE__*/ _jsxs(Stack, {
73
+ direction: "row",
74
+ spacing: 1,
75
+ sx: {
76
+ alignItems: 'center',
77
+ flexWrap: 'wrap',
78
+ rowGap: 1
79
+ },
80
+ children: [
81
+ /*#__PURE__*/ _jsxs(Box, {
82
+ sx: {
83
+ flex: 1,
84
+ minWidth: 220
85
+ },
86
+ children: [
87
+ /*#__PURE__*/ _jsx(Typography, {
88
+ variant: "body2",
89
+ sx: {
90
+ fontWeight: 'fontWeightMedium'
91
+ },
92
+ children: '4G (cellular)'
93
+ }),
94
+ /*#__PURE__*/ _jsx(Typography, {
95
+ variant: "caption",
96
+ color: "text.secondary",
97
+ component: "p",
98
+ children: cellular.enabled ? `On for every Stripe Reader S710 at this store (${readersText(cellular.readers)} now). Each is charged ${price} a month.` : `A Stripe Reader S710 can use Stripe's 4G service when Wi-Fi drops. It turns on for every S710 at this store, at ${price} a month each.`
99
+ })
100
+ ]
101
+ }),
102
+ /*#__PURE__*/ _jsx(Chip, {
103
+ size: "small",
104
+ label: cellular.enabled ? 'On' : 'Off',
105
+ color: cellular.enabled ? 'success' : 'default'
106
+ }),
107
+ /*#__PURE__*/ _jsx(BlockedControl, {
108
+ blocked: Boolean(reason),
109
+ reason: reason != null ? reason : '',
110
+ children: /*#__PURE__*/ _jsx(Button, {
111
+ size: "small",
112
+ onClick: ()=>setDialog(cellular.enabled ? 'off' : 'on'),
113
+ children: cellular.enabled ? 'Turn off 4G' : 'Turn on 4G'
114
+ })
115
+ }),
116
+ cellular.suspended ? /*#__PURE__*/ _jsx(Alert, {
117
+ severity: "warning",
118
+ sx: {
119
+ flexBasis: '100%'
120
+ },
121
+ children: `4G was turned off because the 4G charge for ${cellular.suspended.month} wasn't paid. Pay it on the Billing page, then turn 4G on again here.`
122
+ }) : null,
123
+ /*#__PURE__*/ _jsxs(Dialog, {
124
+ open: dialog === 'on',
125
+ onClose: ()=>busy ? undefined : setDialog(null),
126
+ maxWidth: "sm",
127
+ fullWidth: true,
128
+ children: [
129
+ /*#__PURE__*/ _jsx(DialogTitle, {
130
+ children: 'Turn on 4G for this store?'
131
+ }),
132
+ /*#__PURE__*/ _jsxs(DialogContent, {
133
+ sx: {
134
+ display: 'flex',
135
+ flexDirection: 'column',
136
+ gap: 1.5
137
+ },
138
+ children: [
139
+ /*#__PURE__*/ _jsx(Typography, {
140
+ variant: "body2",
141
+ children: `Every Stripe Reader S710 at this store gets Stripe's 4G service and uses it whenever Wi-Fi and Ethernet are not available. That is ${readersText(cellular.readers)} now, and any S710 you add here later.`
142
+ }),
143
+ /*#__PURE__*/ _jsx(Typography, {
144
+ variant: "body2",
145
+ children: `Each S710 is charged ${price} a month, plus any sales tax, for every calendar month it has 4G. The charge goes to this workspace's card at the start of the next month. Turning 4G off stops the charge from the next month. If a month's charge isn't paid, 4G is turned off after a grace period, until it's paid and turned on again.`
146
+ }),
147
+ /*#__PURE__*/ _jsx(FormControlLabel, {
148
+ control: /*#__PURE__*/ _jsx(Checkbox, {
149
+ checked: agreed,
150
+ onChange: (event)=>setAgreed(event.target.checked)
151
+ }),
152
+ label: `I agree to ${price} a month for each Stripe Reader S710 at this store while 4G is on.`
153
+ })
154
+ ]
155
+ }),
156
+ /*#__PURE__*/ _jsxs(DialogActions, {
157
+ children: [
158
+ /*#__PURE__*/ _jsx(Button, {
159
+ onClick: ()=>setDialog(null),
160
+ disabled: busy,
161
+ children: 'Cancel'
162
+ }),
163
+ /*#__PURE__*/ _jsx(Button, {
164
+ variant: "contained",
165
+ disabled: busy || !agreed,
166
+ onClick: ()=>void change(true),
167
+ children: 'Turn on 4G'
168
+ })
169
+ ]
170
+ })
171
+ ]
172
+ }),
173
+ /*#__PURE__*/ _jsxs(Dialog, {
174
+ open: dialog === 'off',
175
+ onClose: ()=>busy ? undefined : setDialog(null),
176
+ maxWidth: "xs",
177
+ fullWidth: true,
178
+ children: [
179
+ /*#__PURE__*/ _jsx(DialogTitle, {
180
+ children: 'Turn off 4G?'
181
+ }),
182
+ /*#__PURE__*/ _jsx(DialogContent, {
183
+ children: /*#__PURE__*/ _jsx(Typography, {
184
+ variant: "body2",
185
+ children: 'The S710 readers at this store stop using 4G the next time they connect, and use Wi-Fi or Ethernet only. This month is still charged for each reader that had 4G in it.'
186
+ })
187
+ }),
188
+ /*#__PURE__*/ _jsxs(DialogActions, {
189
+ children: [
190
+ /*#__PURE__*/ _jsx(Button, {
191
+ onClick: ()=>setDialog(null),
192
+ disabled: busy,
193
+ children: 'Cancel'
194
+ }),
195
+ /*#__PURE__*/ _jsx(Button, {
196
+ variant: "contained",
197
+ disabled: busy,
198
+ onClick: ()=>void change(false),
199
+ children: 'Turn off 4G'
200
+ })
201
+ ]
202
+ })
203
+ ]
204
+ })
205
+ ]
206
+ });
207
+ }
208
+ PosCellularControl.displayName = 'PosCellularControl';
209
+ export default PosCellularControl;
210
+
211
+ //# sourceMappingURL=pos-cellular-control.component.js.map