@aglyn/plugins-commerce 1.0.0-beta.230 → 1.0.0-beta.231

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 (581) hide show
  1. package/package.json +13 -13
  2. package/src/index.d.ts +0 -1
  3. package/src/index.js +0 -1
  4. package/src/index.js.map +1 -1
  5. package/src/lib/barcode/barcode-decode.d.ts +71 -0
  6. package/src/lib/barcode/barcode-decode.js +498 -0
  7. package/src/lib/barcode/barcode-decode.js.map +1 -0
  8. package/src/lib/barcode/barcode-encode.d.ts +44 -0
  9. package/src/lib/barcode/barcode-encode.js +138 -0
  10. package/src/lib/barcode/barcode-encode.js.map +1 -0
  11. package/src/lib/barcode/barcode-scanner.component.d.ts +23 -0
  12. package/src/lib/barcode/barcode-scanner.component.js +260 -0
  13. package/src/lib/barcode/barcode-scanner.component.js.map +1 -0
  14. package/src/lib/barcode/scan-button.component.d.ts +10 -0
  15. package/src/lib/barcode/scan-button.component.js +62 -0
  16. package/src/lib/barcode/scan-button.component.js.map +1 -0
  17. package/src/lib/barcode/scanner-wedge.d.ts +35 -0
  18. package/src/lib/barcode/scanner-wedge.js +108 -0
  19. package/src/lib/barcode/scanner-wedge.js.map +1 -0
  20. package/src/lib/components/account.js +10 -1
  21. package/src/lib/components/account.js.map +1 -1
  22. package/src/lib/components/cart-extras.d.ts +45 -0
  23. package/src/lib/components/cart-extras.js +127 -0
  24. package/src/lib/components/cart-extras.js.map +1 -0
  25. package/src/lib/components/cart.js +82 -15
  26. package/src/lib/components/cart.js.map +1 -1
  27. package/src/lib/components/checkout-return-notice.d.ts +26 -0
  28. package/src/lib/components/checkout-return-notice.js +48 -0
  29. package/src/lib/components/checkout-return-notice.js.map +1 -0
  30. package/src/lib/components/commerce-console-page.js +124 -0
  31. package/src/lib/components/commerce-console-page.js.map +1 -1
  32. package/src/lib/components/commerce-console-sections.d.ts +1 -1
  33. package/src/lib/components/commerce-console-sections.js +4 -0
  34. package/src/lib/components/commerce-console-sections.js.map +1 -1
  35. package/src/lib/components/console/bulk-fulfill.d.ts +44 -0
  36. package/src/lib/components/console/bulk-fulfill.js +84 -0
  37. package/src/lib/components/console/bulk-fulfill.js.map +1 -0
  38. package/src/lib/components/console/customer-notifications-card.component.d.ts +19 -0
  39. package/src/lib/components/console/customer-notifications-card.component.js +149 -0
  40. package/src/lib/components/console/customer-notifications-card.component.js.map +1 -0
  41. package/src/lib/components/console/host-orders-card.component.js +84 -5
  42. package/src/lib/components/console/host-orders-card.component.js.map +1 -1
  43. package/src/lib/components/console/locations-card.component.js +164 -57
  44. package/src/lib/components/console/locations-card.component.js.map +1 -1
  45. package/src/lib/components/console/order-detail-dialog.component.js +209 -61
  46. package/src/lib/components/console/order-detail-dialog.component.js.map +1 -1
  47. package/src/lib/components/console/order-fulfillment-panel.component.d.ts +48 -0
  48. package/src/lib/components/console/order-fulfillment-panel.component.js +542 -0
  49. package/src/lib/components/console/order-fulfillment-panel.component.js.map +1 -0
  50. package/src/lib/components/console/order-invoice.component.d.ts +33 -0
  51. package/src/lib/components/console/order-invoice.component.js +81 -0
  52. package/src/lib/components/console/order-invoice.component.js.map +1 -0
  53. package/src/lib/components/console/order-receipt-resend.component.d.ts +21 -0
  54. package/src/lib/components/console/order-receipt-resend.component.js +203 -0
  55. package/src/lib/components/console/order-receipt-resend.component.js.map +1 -0
  56. package/src/lib/components/console/order-returns.component.d.ts +36 -0
  57. package/src/lib/components/console/order-returns.component.js +142 -0
  58. package/src/lib/components/console/order-returns.component.js.map +1 -0
  59. package/src/lib/components/console/order-shipping-actions.component.d.ts +54 -0
  60. package/src/lib/components/console/order-shipping-actions.component.js +149 -0
  61. package/src/lib/components/console/order-shipping-actions.component.js.map +1 -0
  62. package/src/lib/components/console/order-webhooks-card.component.d.ts +50 -0
  63. package/src/lib/components/console/order-webhooks-card.component.js +623 -0
  64. package/src/lib/components/console/order-webhooks-card.component.js.map +1 -0
  65. package/src/lib/components/console/order-zones.d.ts +155 -0
  66. package/src/lib/components/console/order-zones.js +40 -0
  67. package/src/lib/components/console/order-zones.js.map +1 -0
  68. package/src/lib/components/console/payment-methods-card.component.d.ts +67 -0
  69. package/src/lib/components/console/payment-methods-card.component.js +395 -0
  70. package/src/lib/components/console/payment-methods-card.component.js.map +1 -0
  71. package/src/lib/components/console/pos/pos-api.d.ts +124 -0
  72. package/src/lib/components/console/pos/pos-api.js +101 -0
  73. package/src/lib/components/console/pos/pos-api.js.map +1 -0
  74. package/src/lib/components/console/pos/pos-cart-panel.component.d.ts +36 -0
  75. package/src/lib/components/console/pos/pos-cart-panel.component.js +160 -0
  76. package/src/lib/components/console/pos/pos-cart-panel.component.js.map +1 -0
  77. package/src/lib/components/console/pos/pos-item-dialog.component.d.ts +39 -0
  78. package/src/lib/components/console/pos/pos-item-dialog.component.js +352 -0
  79. package/src/lib/components/console/pos/pos-item-dialog.component.js.map +1 -0
  80. package/src/lib/components/console/pos/pos-product-grid.component.d.ts +47 -0
  81. package/src/lib/components/console/pos/pos-product-grid.component.js +272 -0
  82. package/src/lib/components/console/pos/pos-product-grid.component.js.map +1 -0
  83. package/src/lib/components/console/pos/pos-receipt-panel.component.d.ts +27 -0
  84. package/src/lib/components/console/pos/pos-receipt-panel.component.js +282 -0
  85. package/src/lib/components/console/pos/pos-receipt-panel.component.js.map +1 -0
  86. package/src/lib/components/console/pos/pos-tender-dialogs.component.d.ts +53 -0
  87. package/src/lib/components/console/pos/pos-tender-dialogs.component.js +445 -0
  88. package/src/lib/components/console/pos/pos-tender-dialogs.component.js.map +1 -0
  89. package/src/lib/components/console/pos/pos-tender-panel.component.d.ts +31 -0
  90. package/src/lib/components/console/pos/pos-tender-panel.component.js +640 -0
  91. package/src/lib/components/console/pos/pos-tender-panel.component.js.map +1 -0
  92. package/src/lib/components/console/pos/use-pos-display.d.ts +43 -0
  93. package/src/lib/components/console/pos/use-pos-display.js +161 -0
  94. package/src/lib/components/console/pos/use-pos-display.js.map +1 -0
  95. package/src/lib/components/console/pos-devices-card.component.d.ts +14 -0
  96. package/src/lib/components/console/pos-devices-card.component.js +546 -0
  97. package/src/lib/components/console/pos-devices-card.component.js.map +1 -0
  98. package/src/lib/components/console/pos-display/brand-screen.d.ts +33 -0
  99. package/src/lib/components/console/pos-display/brand-screen.js +85 -0
  100. package/src/lib/components/console/pos-display/brand-screen.js.map +1 -0
  101. package/src/lib/components/console/pos-display/cart-screen.d.ts +29 -0
  102. package/src/lib/components/console/pos-display/cart-screen.js +166 -0
  103. package/src/lib/components/console/pos-display/cart-screen.js.map +1 -0
  104. package/src/lib/components/console/pos-display/pairing-screen.d.ts +24 -0
  105. package/src/lib/components/console/pos-display/pairing-screen.js +127 -0
  106. package/src/lib/components/console/pos-display/pairing-screen.js.map +1 -0
  107. package/src/lib/components/console/pos-display/pos-display-api.d.ts +90 -0
  108. package/src/lib/components/console/pos-display/pos-display-api.js +140 -0
  109. package/src/lib/components/console/pos-display/pos-display-api.js.map +1 -0
  110. package/src/lib/components/console/pos-display/receipt-screen.d.ts +35 -0
  111. package/src/lib/components/console/pos-display/receipt-screen.js +200 -0
  112. package/src/lib/components/console/pos-display/receipt-screen.js.map +1 -0
  113. package/src/lib/components/console/pos-display/tip-screen.d.ts +36 -0
  114. package/src/lib/components/console/pos-display/tip-screen.js +211 -0
  115. package/src/lib/components/console/pos-display/tip-screen.js.map +1 -0
  116. package/src/lib/components/console/pos-display-page.component.d.ts +16 -0
  117. package/src/lib/components/console/pos-display-page.component.js +407 -0
  118. package/src/lib/components/console/pos-display-page.component.js.map +1 -0
  119. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.d.ts +40 -0
  120. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js +289 -0
  121. package/src/lib/components/console/pos-ops/pos-customer-lookup.component.js.map +1 -0
  122. package/src/lib/components/console/pos-ops/pos-last-receipt.component.d.ts +34 -0
  123. package/src/lib/components/console/pos-ops/pos-last-receipt.component.js +61 -0
  124. package/src/lib/components/console/pos-ops/pos-last-receipt.component.js.map +1 -0
  125. package/src/lib/components/console/pos-ops/pos-operations-bar.component.d.ts +38 -0
  126. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js +129 -0
  127. package/src/lib/components/console/pos-ops/pos-operations-bar.component.js.map +1 -0
  128. package/src/lib/components/console/pos-ops/pos-ops-api.d.ts +37 -0
  129. package/src/lib/components/console/pos-ops/pos-ops-api.js +60 -0
  130. package/src/lib/components/console/pos-ops/pos-ops-api.js.map +1 -0
  131. package/src/lib/components/console/pos-ops/pos-pin-pad.component.d.ts +48 -0
  132. package/src/lib/components/console/pos-ops/pos-pin-pad.component.js +220 -0
  133. package/src/lib/components/console/pos-ops/pos-pin-pad.component.js.map +1 -0
  134. package/src/lib/components/console/pos-ops/pos-receipt-actions.component.d.ts +63 -0
  135. package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js +186 -0
  136. package/src/lib/components/console/pos-ops/pos-receipt-actions.component.js.map +1 -0
  137. package/src/lib/components/console/pos-ops/pos-receipt.d.ts +39 -0
  138. package/src/lib/components/console/pos-ops/pos-receipt.js +182 -0
  139. package/src/lib/components/console/pos-ops/pos-receipt.js.map +1 -0
  140. package/src/lib/components/console/pos-ops/pos-return-dialog.component.d.ts +40 -0
  141. package/src/lib/components/console/pos-ops/pos-return-dialog.component.js +465 -0
  142. package/src/lib/components/console/pos-ops/pos-return-dialog.component.js.map +1 -0
  143. package/src/lib/components/console/pos-ops/pos-shift-history-card.component.d.ts +29 -0
  144. package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js +253 -0
  145. package/src/lib/components/console/pos-ops/pos-shift-history-card.component.js.map +1 -0
  146. package/src/lib/components/console/pos-ops/pos-shift-panel.component.d.ts +34 -0
  147. package/src/lib/components/console/pos-ops/pos-shift-panel.component.js +494 -0
  148. package/src/lib/components/console/pos-ops/pos-shift-panel.component.js.map +1 -0
  149. package/src/lib/components/console/pos-ops/pos-shift-report.component.d.ts +37 -0
  150. package/src/lib/components/console/pos-ops/pos-shift-report.component.js +102 -0
  151. package/src/lib/components/console/pos-ops/pos-shift-report.component.js.map +1 -0
  152. package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.d.ts +30 -0
  153. package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js +277 -0
  154. package/src/lib/components/console/pos-ops/pos-staff-pins-card.component.js.map +1 -0
  155. package/src/lib/components/console/pos-ops/register-ops.d.ts +28 -0
  156. package/src/lib/components/console/pos-ops/register-ops.js +28 -0
  157. package/src/lib/components/console/pos-ops/register-ops.js.map +1 -0
  158. package/src/lib/components/console/pos-ops/use-pos-cashier.d.ts +46 -0
  159. package/src/lib/components/console/pos-ops/use-pos-cashier.js +128 -0
  160. package/src/lib/components/console/pos-ops/use-pos-cashier.js.map +1 -0
  161. package/src/lib/components/console/pos-ops/use-pos-sale-receipt.d.ts +36 -0
  162. package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js +64 -0
  163. package/src/lib/components/console/pos-ops/use-pos-sale-receipt.js.map +1 -0
  164. package/src/lib/components/console/pos-page.component.d.ts +13 -5
  165. package/src/lib/components/console/pos-page.component.js +729 -657
  166. package/src/lib/components/console/pos-page.component.js.map +1 -1
  167. package/src/lib/components/console/product-editor-dialog.component.js +51 -7
  168. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
  169. package/src/lib/components/console/product-labels-dialog.component.d.ts +13 -0
  170. package/src/lib/components/console/product-labels-dialog.component.js +197 -0
  171. package/src/lib/components/console/product-labels-dialog.component.js.map +1 -0
  172. package/src/lib/components/console/product-register-fields.component.d.ts +19 -0
  173. package/src/lib/components/console/product-register-fields.component.js +241 -0
  174. package/src/lib/components/console/product-register-fields.component.js.map +1 -0
  175. package/src/lib/components/console/product-zones.d.ts +44 -0
  176. package/src/lib/components/console/product-zones.js.map +1 -1
  177. package/src/lib/components/console/products-hub-card.component.js +12 -0
  178. package/src/lib/components/console/products-hub-card.component.js.map +1 -1
  179. package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
  180. package/src/lib/components/console/register-hardware-card.component.js +826 -0
  181. package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
  182. package/src/lib/components/console/registers-card.component.js +24 -5
  183. package/src/lib/components/console/registers-card.component.js.map +1 -1
  184. package/src/lib/components/console/return-actions.d.ts +38 -0
  185. package/src/lib/components/console/return-actions.js +76 -0
  186. package/src/lib/components/console/return-actions.js.map +1 -0
  187. package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
  188. package/src/lib/components/console/return-detail-dialog.component.js +718 -0
  189. package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
  190. package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
  191. package/src/lib/components/console/return-settings-card.component.js +195 -0
  192. package/src/lib/components/console/return-settings-card.component.js.map +1 -0
  193. package/src/lib/components/console/return-zones.d.ts +87 -0
  194. package/src/lib/components/console/return-zones.js +31 -0
  195. package/src/lib/components/console/return-zones.js.map +1 -0
  196. package/src/lib/components/console/returns-card.component.d.ts +45 -0
  197. package/src/lib/components/console/returns-card.component.js +159 -0
  198. package/src/lib/components/console/returns-card.component.js.map +1 -0
  199. package/src/lib/components/console/shipping-settings-card.component.js +161 -5
  200. package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
  201. package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
  202. package/src/lib/components/console/shippingeasy-card.component.js +378 -0
  203. package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
  204. package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
  205. package/src/lib/components/console/shipstation-card.component.js +345 -0
  206. package/src/lib/components/console/shipstation-card.component.js.map +1 -0
  207. package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
  208. package/src/lib/components/console/start-return-dialog.component.js +243 -0
  209. package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
  210. package/src/lib/components/console/stock-movements-card.component.js +2 -1
  211. package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
  212. package/src/lib/components/console/store-settings-card.component.js +2 -66
  213. package/src/lib/components/console/store-settings-card.component.js.map +1 -1
  214. package/src/lib/components/console/store-zones.d.ts +42 -0
  215. package/src/lib/components/console/store-zones.js +39 -0
  216. package/src/lib/components/console/store-zones.js.map +1 -0
  217. package/src/lib/components/order-status.d.ts +36 -0
  218. package/src/lib/components/order-status.js +502 -0
  219. package/src/lib/components/order-status.js.map +1 -0
  220. package/src/lib/components/product-detail.js +41 -2
  221. package/src/lib/components/product-detail.js.map +1 -1
  222. package/src/lib/components/return-request.d.ts +32 -0
  223. package/src/lib/components/return-request.js +576 -0
  224. package/src/lib/components/return-request.js.map +1 -0
  225. package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
  226. package/src/lib/components/storefront-payment-appearance.js +114 -0
  227. package/src/lib/components/storefront-payment-appearance.js.map +1 -0
  228. package/src/lib/components/storefront-payment-element.d.ts +57 -1
  229. package/src/lib/components/storefront-payment-element.js +332 -33
  230. package/src/lib/components/storefront-payment-element.js.map +1 -1
  231. package/src/lib/constants/order-status.d.ts +22 -0
  232. package/src/lib/constants/order-status.js +22 -0
  233. package/src/lib/constants/order-status.js.map +1 -0
  234. package/src/lib/constants/return-request.d.ts +27 -0
  235. package/src/lib/constants/return-request.js +32 -0
  236. package/src/lib/constants/return-request.js.map +1 -0
  237. package/src/lib/constants/stock-movement-query.js +2 -1
  238. package/src/lib/constants/stock-movement-query.js.map +1 -1
  239. package/src/lib/declarations.console-server.js +9 -0
  240. package/src/lib/declarations.console-server.js.map +1 -1
  241. package/src/lib/declarations.server.d.ts +2 -1
  242. package/src/lib/declarations.server.js +47 -1
  243. package/src/lib/declarations.server.js.map +1 -1
  244. package/src/lib/model/buyer-notifications.d.ts +59 -0
  245. package/src/lib/model/buyer-notifications.js +97 -0
  246. package/src/lib/model/buyer-notifications.js.map +1 -0
  247. package/src/lib/model/commerce-orders.d.ts +127 -1
  248. package/src/lib/model/commerce-orders.js +24 -15
  249. package/src/lib/model/commerce-orders.js.map +1 -1
  250. package/src/lib/model/commerce-payment-methods.d.ts +146 -0
  251. package/src/lib/model/commerce-payment-methods.js +247 -0
  252. package/src/lib/model/commerce-payment-methods.js.map +1 -0
  253. package/src/lib/model/commerce-pos-ops.d.ts +437 -0
  254. package/src/lib/model/commerce-pos-ops.js +721 -0
  255. package/src/lib/model/commerce-pos-ops.js.map +1 -0
  256. package/src/lib/model/commerce-pos.d.ts +263 -0
  257. package/src/lib/model/commerce-pos.js +375 -0
  258. package/src/lib/model/commerce-pos.js.map +1 -0
  259. package/src/lib/model/commerce-printers.d.ts +211 -0
  260. package/src/lib/model/commerce-printers.js +181 -0
  261. package/src/lib/model/commerce-printers.js.map +1 -0
  262. package/src/lib/model/commerce-receipt.d.ts +97 -0
  263. package/src/lib/model/commerce-receipt.js +180 -0
  264. package/src/lib/model/commerce-receipt.js.map +1 -0
  265. package/src/lib/model/commerce-returns.d.ts +207 -0
  266. package/src/lib/model/commerce-returns.js +300 -0
  267. package/src/lib/model/commerce-returns.js.map +1 -0
  268. package/src/lib/model/commerce-shipping.d.ts +44 -1
  269. package/src/lib/model/commerce-shipping.js +53 -9
  270. package/src/lib/model/commerce-shipping.js.map +1 -1
  271. package/src/lib/model/commerce-tax-engine.d.ts +90 -0
  272. package/src/lib/model/commerce-tax-engine.js +129 -0
  273. package/src/lib/model/commerce-tax-engine.js.map +1 -0
  274. package/src/lib/model/commerce.d.ts +88 -2
  275. package/src/lib/model/commerce.js +89 -1
  276. package/src/lib/model/commerce.js.map +1 -1
  277. package/src/lib/model/index.d.ts +15 -0
  278. package/src/lib/model/index.js +15 -0
  279. package/src/lib/model/index.js.map +1 -1
  280. package/src/lib/model/order-events.d.ts +154 -0
  281. package/src/lib/model/order-events.js +153 -0
  282. package/src/lib/model/order-events.js.map +1 -0
  283. package/src/lib/model/order-fulfillment.d.ts +117 -0
  284. package/src/lib/model/order-fulfillment.js +217 -0
  285. package/src/lib/model/order-fulfillment.js.map +1 -0
  286. package/src/lib/model/order-history.d.ts +58 -0
  287. package/src/lib/model/order-history.js +22 -0
  288. package/src/lib/model/order-history.js.map +1 -0
  289. package/src/lib/model/order-list-fields.d.ts +9 -1
  290. package/src/lib/model/order-list-fields.js +7 -1
  291. package/src/lib/model/order-list-fields.js.map +1 -1
  292. package/src/lib/model/order-shipping-export.d.ts +91 -0
  293. package/src/lib/model/order-shipping-export.js +192 -0
  294. package/src/lib/model/order-shipping-export.js.map +1 -0
  295. package/src/lib/model/order-status-view.d.ts +103 -0
  296. package/src/lib/model/order-status-view.js +156 -0
  297. package/src/lib/model/order-status-view.js.map +1 -0
  298. package/src/lib/model/order-webhooks.d.ts +142 -0
  299. package/src/lib/model/order-webhooks.js +91 -0
  300. package/src/lib/model/order-webhooks.js.map +1 -0
  301. package/src/lib/model/product-channel.d.ts +56 -0
  302. package/src/lib/model/product-channel.js +86 -0
  303. package/src/lib/model/product-channel.js.map +1 -0
  304. package/src/lib/model/product-modifiers.d.ts +80 -0
  305. package/src/lib/model/product-modifiers.js +140 -0
  306. package/src/lib/model/product-modifiers.js.map +1 -0
  307. package/src/lib/model/shippingeasy.d.ts +94 -0
  308. package/src/lib/model/shippingeasy.js +267 -0
  309. package/src/lib/model/shippingeasy.js.map +1 -0
  310. package/src/lib/model/shipstation.d.ts +125 -0
  311. package/src/lib/model/shipstation.js +399 -0
  312. package/src/lib/model/shipstation.js.map +1 -0
  313. package/src/lib/model/smart-collection-reads.d.ts +32 -0
  314. package/src/lib/model/smart-collection-reads.js +63 -0
  315. package/src/lib/model/smart-collection-reads.js.map +1 -0
  316. package/src/lib/model/tracking-url.d.ts +74 -0
  317. package/src/lib/model/tracking-url.js +159 -0
  318. package/src/lib/model/tracking-url.js.map +1 -0
  319. package/src/lib/plugin-config.d.ts +13 -0
  320. package/src/lib/plugin-config.js +77 -5
  321. package/src/lib/plugin-config.js.map +1 -1
  322. package/src/lib/plugin.js +23 -0
  323. package/src/lib/plugin.js.map +1 -1
  324. package/src/lib/pos-ops-config.d.ts +39 -0
  325. package/src/lib/pos-ops-config.js +88 -0
  326. package/src/lib/pos-ops-config.js.map +1 -0
  327. package/src/lib/printing/print-document.d.ts +106 -0
  328. package/src/lib/printing/print-document.js +464 -0
  329. package/src/lib/printing/print-document.js.map +1 -0
  330. package/src/lib/printing/product-labels.d.ts +58 -0
  331. package/src/lib/printing/product-labels.js +116 -0
  332. package/src/lib/printing/product-labels.js.map +1 -0
  333. package/src/lib/printing/render-epson.d.ts +57 -0
  334. package/src/lib/printing/render-epson.js +135 -0
  335. package/src/lib/printing/render-epson.js.map +1 -0
  336. package/src/lib/printing/render-star.d.ts +45 -0
  337. package/src/lib/printing/render-star.js +100 -0
  338. package/src/lib/printing/render-star.js.map +1 -0
  339. package/src/lib/printing/render-text.d.ts +25 -0
  340. package/src/lib/printing/render-text.js +53 -0
  341. package/src/lib/printing/render-text.js.map +1 -0
  342. package/src/lib/server/api-v1/openapi.js +27 -4
  343. package/src/lib/server/api-v1/openapi.js.map +1 -1
  344. package/src/lib/server/api-v1/order-view.d.ts +67 -0
  345. package/src/lib/server/api-v1/order-view.js +120 -0
  346. package/src/lib/server/api-v1/order-view.js.map +1 -0
  347. package/src/lib/server/api-v1/orders-and-products.js +58 -65
  348. package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
  349. package/src/lib/server/billing-webhook.js +135 -28
  350. package/src/lib/server/billing-webhook.js.map +1 -1
  351. package/src/lib/server/cancel-order.js +29 -0
  352. package/src/lib/server/cancel-order.js.map +1 -1
  353. package/src/lib/server/carrier-rates-availability.d.ts +26 -0
  354. package/src/lib/server/carrier-rates-availability.js +76 -0
  355. package/src/lib/server/carrier-rates-availability.js.map +1 -0
  356. package/src/lib/server/carrier-shipping.d.ts +84 -0
  357. package/src/lib/server/carrier-shipping.js +135 -0
  358. package/src/lib/server/carrier-shipping.js.map +1 -0
  359. package/src/lib/server/cart-checkout.d.ts +2 -0
  360. package/src/lib/server/cart-checkout.js +226 -22
  361. package/src/lib/server/cart-checkout.js.map +1 -1
  362. package/src/lib/server/checkout-extras.d.ts +64 -0
  363. package/src/lib/server/checkout-extras.js +157 -0
  364. package/src/lib/server/checkout-extras.js.map +1 -0
  365. package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
  366. package/src/lib/server/checkout-status.js +111 -0
  367. package/src/lib/server/checkout-status.js.map +1 -0
  368. package/src/lib/server/checkout.js +86 -9
  369. package/src/lib/server/checkout.js.map +1 -1
  370. package/src/lib/server/draft-order.js +34 -5
  371. package/src/lib/server/draft-order.js.map +1 -1
  372. package/src/lib/server/fulfill-order.d.ts +127 -10
  373. package/src/lib/server/fulfill-order.js +451 -49
  374. package/src/lib/server/fulfill-order.js.map +1 -1
  375. package/src/lib/server/legacy-feed.d.ts +28 -0
  376. package/src/lib/server/legacy-feed.js +52 -0
  377. package/src/lib/server/legacy-feed.js.map +1 -0
  378. package/src/lib/server/native-checkout.d.ts +34 -15
  379. package/src/lib/server/native-checkout.js +32 -17
  380. package/src/lib/server/native-checkout.js.map +1 -1
  381. package/src/lib/server/order-event-host-emit.d.ts +23 -0
  382. package/src/lib/server/order-event-host-emit.js +30 -0
  383. package/src/lib/server/order-event-host-emit.js.map +1 -0
  384. package/src/lib/server/order-event-triggers.d.ts +37 -0
  385. package/src/lib/server/order-event-triggers.js +119 -0
  386. package/src/lib/server/order-event-triggers.js.map +1 -0
  387. package/src/lib/server/order-events.d.ts +62 -0
  388. package/src/lib/server/order-events.js +109 -0
  389. package/src/lib/server/order-events.js.map +1 -0
  390. package/src/lib/server/order-history.d.ts +23 -0
  391. package/src/lib/server/order-history.js +65 -0
  392. package/src/lib/server/order-history.js.map +1 -0
  393. package/src/lib/server/order-notifications.d.ts +185 -0
  394. package/src/lib/server/order-notifications.js +567 -0
  395. package/src/lib/server/order-notifications.js.map +1 -0
  396. package/src/lib/server/order-receipt-send.d.ts +39 -0
  397. package/src/lib/server/order-receipt-send.js +151 -0
  398. package/src/lib/server/order-receipt-send.js.map +1 -0
  399. package/src/lib/server/order-status-token.d.ts +31 -0
  400. package/src/lib/server/order-status-token.js +75 -0
  401. package/src/lib/server/order-status-token.js.map +1 -0
  402. package/src/lib/server/order-status.d.ts +58 -0
  403. package/src/lib/server/order-status.js +141 -0
  404. package/src/lib/server/order-status.js.map +1 -0
  405. package/src/lib/server/order-webhooks.d.ts +108 -0
  406. package/src/lib/server/order-webhooks.js +622 -0
  407. package/src/lib/server/order-webhooks.js.map +1 -0
  408. package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
  409. package/src/lib/server/orders-shipping-prepare.js +121 -0
  410. package/src/lib/server/orders-shipping-prepare.js.map +1 -0
  411. package/src/lib/server/payment-method-domains.d.ts +209 -0
  412. package/src/lib/server/payment-method-domains.js +444 -0
  413. package/src/lib/server/payment-method-domains.js.map +1 -0
  414. package/src/lib/server/payment-methods.d.ts +77 -0
  415. package/src/lib/server/payment-methods.js +284 -0
  416. package/src/lib/server/payment-methods.js.map +1 -0
  417. package/src/lib/server/pos-auth.d.ts +50 -0
  418. package/src/lib/server/pos-auth.js +121 -0
  419. package/src/lib/server/pos-auth.js.map +1 -0
  420. package/src/lib/server/pos-customer.d.ts +49 -0
  421. package/src/lib/server/pos-customer.js +257 -0
  422. package/src/lib/server/pos-customer.js.map +1 -0
  423. package/src/lib/server/pos-display.d.ts +57 -0
  424. package/src/lib/server/pos-display.js +419 -0
  425. package/src/lib/server/pos-display.js.map +1 -0
  426. package/src/lib/server/pos-fee-month.d.ts +34 -0
  427. package/src/lib/server/pos-fee-month.js +36 -0
  428. package/src/lib/server/pos-fee-month.js.map +1 -0
  429. package/src/lib/server/pos-ops-gate.d.ts +161 -0
  430. package/src/lib/server/pos-ops-gate.js +295 -0
  431. package/src/lib/server/pos-ops-gate.js.map +1 -0
  432. package/src/lib/server/pos-ops-routes.d.ts +22 -0
  433. package/src/lib/server/pos-ops-routes.js +36 -0
  434. package/src/lib/server/pos-ops-routes.js.map +1 -0
  435. package/src/lib/server/pos-order.d.ts +1 -18
  436. package/src/lib/server/pos-order.js +222 -42
  437. package/src/lib/server/pos-order.js.map +1 -1
  438. package/src/lib/server/pos-payment.d.ts +39 -0
  439. package/src/lib/server/pos-payment.js +922 -0
  440. package/src/lib/server/pos-payment.js.map +1 -0
  441. package/src/lib/server/pos-print.d.ts +82 -0
  442. package/src/lib/server/pos-print.js +193 -0
  443. package/src/lib/server/pos-print.js.map +1 -0
  444. package/src/lib/server/pos-readers.d.ts +27 -0
  445. package/src/lib/server/pos-readers.js +276 -0
  446. package/src/lib/server/pos-readers.js.map +1 -0
  447. package/src/lib/server/pos-refund-authority.d.ts +60 -0
  448. package/src/lib/server/pos-refund-authority.js +72 -0
  449. package/src/lib/server/pos-refund-authority.js.map +1 -0
  450. package/src/lib/server/pos-return.d.ts +58 -0
  451. package/src/lib/server/pos-return.js +891 -0
  452. package/src/lib/server/pos-return.js.map +1 -0
  453. package/src/lib/server/pos-sale-stamp.d.ts +66 -0
  454. package/src/lib/server/pos-sale-stamp.js +84 -0
  455. package/src/lib/server/pos-sale-stamp.js.map +1 -0
  456. package/src/lib/server/pos-sale.d.ts +170 -0
  457. package/src/lib/server/pos-sale.js +461 -0
  458. package/src/lib/server/pos-sale.js.map +1 -0
  459. package/src/lib/server/pos-shift.d.ts +45 -0
  460. package/src/lib/server/pos-shift.js +484 -0
  461. package/src/lib/server/pos-shift.js.map +1 -0
  462. package/src/lib/server/pos-staff-pin.d.ts +26 -0
  463. package/src/lib/server/pos-staff-pin.js +339 -0
  464. package/src/lib/server/pos-staff-pin.js.map +1 -0
  465. package/src/lib/server/pos-stripe.d.ts +91 -0
  466. package/src/lib/server/pos-stripe.js +129 -0
  467. package/src/lib/server/pos-stripe.js.map +1 -0
  468. package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
  469. package/src/lib/server/pos-terminal-connection-token.js +166 -0
  470. package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
  471. package/src/lib/server/pos-terminal.d.ts +218 -0
  472. package/src/lib/server/pos-terminal.js +1014 -0
  473. package/src/lib/server/pos-terminal.js.map +1 -0
  474. package/src/lib/server/print-queue.d.ts +124 -0
  475. package/src/lib/server/print-queue.js +301 -0
  476. package/src/lib/server/print-queue.js.map +1 -0
  477. package/src/lib/server/printer-poll.d.ts +75 -0
  478. package/src/lib/server/printer-poll.js +325 -0
  479. package/src/lib/server/printer-poll.js.map +1 -0
  480. package/src/lib/server/printer-secret.d.ts +39 -0
  481. package/src/lib/server/printer-secret.js +56 -0
  482. package/src/lib/server/printer-secret.js.map +1 -0
  483. package/src/lib/server/printers.d.ts +114 -0
  484. package/src/lib/server/printers.js +546 -0
  485. package/src/lib/server/printers.js.map +1 -0
  486. package/src/lib/server/product-catalog.d.ts +42 -0
  487. package/src/lib/server/product-catalog.js +305 -0
  488. package/src/lib/server/product-catalog.js.map +1 -0
  489. package/src/lib/server/refund.js +110 -45
  490. package/src/lib/server/refund.js.map +1 -1
  491. package/src/lib/server/reserve.js +2 -0
  492. package/src/lib/server/reserve.js.map +1 -1
  493. package/src/lib/server/return-status-action.d.ts +37 -0
  494. package/src/lib/server/return-status-action.js +57 -0
  495. package/src/lib/server/return-status-action.js.map +1 -0
  496. package/src/lib/server/returns.d.ts +119 -0
  497. package/src/lib/server/returns.js +938 -0
  498. package/src/lib/server/returns.js.map +1 -0
  499. package/src/lib/server/shipment-records.d.ts +36 -0
  500. package/src/lib/server/shipment-records.js +289 -0
  501. package/src/lib/server/shipment-records.js.map +1 -0
  502. package/src/lib/server/shipping-connector-gates.d.ts +40 -0
  503. package/src/lib/server/shipping-connector-gates.js +97 -0
  504. package/src/lib/server/shipping-connector-gates.js.map +1 -0
  505. package/src/lib/server/shipping-connectors.d.ts +29 -0
  506. package/src/lib/server/shipping-connectors.js +236 -0
  507. package/src/lib/server/shipping-connectors.js.map +1 -0
  508. package/src/lib/server/shippingeasy.d.ts +238 -0
  509. package/src/lib/server/shippingeasy.js +787 -0
  510. package/src/lib/server/shippingeasy.js.map +1 -0
  511. package/src/lib/server/shipstation.d.ts +129 -0
  512. package/src/lib/server/shipstation.js +483 -0
  513. package/src/lib/server/shipstation.js.map +1 -0
  514. package/src/lib/server/site-page-resolver.d.ts +5 -0
  515. package/src/lib/server/site-page-resolver.js +156 -1
  516. package/src/lib/server/site-page-resolver.js.map +1 -1
  517. package/src/lib/server/stock-levels.d.ts +21 -0
  518. package/src/lib/server/stock-levels.js +263 -0
  519. package/src/lib/server/stock-levels.js.map +1 -0
  520. package/src/lib/server/stripe-refund.d.ts +47 -0
  521. package/src/lib/server/stripe-refund.js +87 -0
  522. package/src/lib/server/stripe-refund.js.map +1 -0
  523. package/src/lib/server/supplier-update.js +46 -5
  524. package/src/lib/server/supplier-update.js.map +1 -1
  525. package/src/lib/server/tax-engine-quote.d.ts +47 -0
  526. package/src/lib/server/tax-engine-quote.js +105 -0
  527. package/src/lib/server/tax-engine-quote.js.map +1 -0
  528. package/src/lib/server.js +138 -2
  529. package/src/lib/server.js.map +1 -1
  530. package/src/lib/site.js +12 -0
  531. package/src/lib/site.js.map +1 -1
  532. package/src/lib/subprocessors.d.ts +26 -0
  533. package/src/lib/subprocessors.js +50 -0
  534. package/src/lib/subprocessors.js.map +1 -0
  535. package/src/lib/tenant-emails.js +461 -3
  536. package/src/lib/tenant-emails.js.map +1 -1
  537. package/src/lib/testing/fake-firestore.d.ts +45 -0
  538. package/src/lib/testing/fake-firestore.js +189 -0
  539. package/src/lib/testing/fake-firestore.js.map +1 -0
  540. package/src/lib/testing/memory-firestore.d.ts +123 -0
  541. package/src/lib/testing/memory-firestore.js +274 -0
  542. package/src/lib/testing/memory-firestore.js.map +1 -0
  543. package/src/lib/testing/pos-ops-harness.d.ts +50 -0
  544. package/src/lib/testing/pos-ops-harness.js +184 -0
  545. package/src/lib/testing/pos-ops-harness.js.map +1 -0
  546. package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
  547. package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
  548. package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
  549. package/src/lib/transfer/records-transfer.d.ts +11 -1
  550. package/src/lib/transfer/records-transfer.js +127 -5
  551. package/src/lib/transfer/records-transfer.js.map +1 -1
  552. package/src/lib/transfer/records.server.d.ts +9 -2
  553. package/src/lib/transfer/records.server.js +58 -7
  554. package/src/lib/transfer/records.server.js.map +1 -1
  555. package/src/lib/transfer/register-transfer-resources.js +40 -1
  556. package/src/lib/transfer/register-transfer-resources.js.map +1 -1
  557. package/src/lib/transfer/register-transfer-ui.js +4 -1
  558. package/src/lib/transfer/register-transfer-ui.js.map +1 -1
  559. package/src/lib/transfer/shipping-presets.d.ts +23 -0
  560. package/src/lib/transfer/shipping-presets.js +156 -0
  561. package/src/lib/transfer/shipping-presets.js.map +1 -0
  562. package/src/lib/transfer/tracking-transfer.d.ts +101 -0
  563. package/src/lib/transfer/tracking-transfer.js +546 -0
  564. package/src/lib/transfer/tracking-transfer.js.map +1 -0
  565. package/src/lib/transfer/tracking.server.d.ts +37 -0
  566. package/src/lib/transfer/tracking.server.js +393 -0
  567. package/src/lib/transfer/tracking.server.js.map +1 -0
  568. package/src/lib/transfer/transfer-keys.d.ts +2 -1
  569. package/src/lib/transfer/transfer-keys.js +6 -2
  570. package/src/lib/transfer/transfer-keys.js.map +1 -1
  571. package/src/lib/utils/code128.d.ts +37 -0
  572. package/src/lib/utils/code128.js +199 -0
  573. package/src/lib/utils/code128.js.map +1 -0
  574. package/src/lib/utils/order-invoice.d.ts +55 -0
  575. package/src/lib/utils/order-invoice.js +127 -0
  576. package/src/lib/utils/order-invoice.js.map +1 -0
  577. package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
  578. package/src/lib/utils/use-checkout-return-notice.js +78 -0
  579. package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
  580. package/src/lib/server/feed.js +0 -69
  581. package/src/lib/server/feed.js.map +0 -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
+ /**
18
+ * The buyer's "Request a return" page (AGL-3611).
19
+ *
20
+ * The component id is persisted in screen documents; never rename it. The
21
+ * path is where the site serves the page when it has no page of its own
22
+ * there, and where the account block and the order-status page link to.
23
+ */
24
+ export declare const RETURN_REQUEST_COMPONENT_ID = "return-request";
25
+ export declare const RETURN_REQUEST_PATH = "order-return";
26
+ /** The page's address for one order, with the status-link token when there is one. */
27
+ export declare function returnRequestHref(orderId: string, token?: string | null): string;
@@ -0,0 +1,32 @@
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
+ * The buyer's "Request a return" page (AGL-3611).
18
+ *
19
+ * The component id is persisted in screen documents; never rename it. The
20
+ * path is where the site serves the page when it has no page of its own
21
+ * there, and where the account block and the order-status page link to.
22
+ */ export const RETURN_REQUEST_COMPONENT_ID = 'return-request';
23
+ export const RETURN_REQUEST_PATH = 'order-return';
24
+ /** The page's address for one order, with the status-link token when there is one. */ export function returnRequestHref(orderId, token) {
25
+ const query = new URLSearchParams({
26
+ o: orderId
27
+ });
28
+ if (token) query.set('t', token);
29
+ return `/${RETURN_REQUEST_PATH}?${query.toString()}`;
30
+ }
31
+
32
+ //# sourceMappingURL=return-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/constants/return-request.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The buyer's \"Request a return\" page (AGL-3611).\n *\n * The component id is persisted in screen documents; never rename it. The\n * path is where the site serves the page when it has no page of its own\n * there, and where the account block and the order-status page link to.\n */\nexport const RETURN_REQUEST_COMPONENT_ID = 'return-request'\n\nexport const RETURN_REQUEST_PATH = 'order-return'\n\n/** The page's address for one order, with the status-link token when there is one. */\nexport function returnRequestHref(orderId: string, token?: string | null): string {\n const query = new URLSearchParams({ o: orderId })\n if (token) query.set('t', token)\n return `/${RETURN_REQUEST_PATH}?${query.toString()}`\n}\n"],"names":["RETURN_REQUEST_COMPONENT_ID","RETURN_REQUEST_PATH","returnRequestHref","orderId","token","query","URLSearchParams","o","set","toString"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;CAMC,GACD,OAAO,MAAMA,8BAA8B,iBAAgB;AAE3D,OAAO,MAAMC,sBAAsB,eAAc;AAEjD,oFAAoF,GACpF,OAAO,SAASC,kBAAkBC,OAAe,EAAEC,KAAqB;IACtE,MAAMC,QAAQ,IAAIC,gBAAgB;QAAEC,GAAGJ;IAAQ;IAC/C,IAAIC,OAAOC,MAAMG,GAAG,CAAC,KAAKJ;IAC1B,OAAO,CAAC,CAAC,EAAEH,oBAAoB,CAAC,EAAEI,MAAMI,QAAQ,IAAI;AACtD"}
@@ -104,7 +104,8 @@ export const STOCK_MOVEMENT_FILTER_HEADERS = {
104
104
  restock: 'Restock',
105
105
  correction: 'Correction',
106
106
  damage: 'Damaged',
107
- cancellation: 'Order canceled'
107
+ cancellation: 'Order canceled',
108
+ sync: 'Count synced'
108
109
  };
109
110
 
110
111
  //# sourceMappingURL=stock-movement-query.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/constants/stock-movement-query.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 { ListFilterField } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport type { ListQueryDeclaration } from '@aglyn/shared-ui-jsx/const/list-query-plan'\nimport type { InventoryAdjustmentReason } from '../model/commerce'\n\n/*\n * What the stock movements ledger filters by, and how its query serves it\n * (AGL-3321).\n *\n * Every field is one every writer of `hosts/{hostId}/inventoryAdjustments`\n * already stores — the \"Adjust stock\" dialog, the sale path\n * (`decrementVariantStock`) and the cancellation restock — so nothing new is\n * written and nothing needs a backfill. Each is an EQUALITY beneath the\n * ledger's one order, `atMs` newest first, which is one `(field, atMs DESC)`\n * composite per field under index merging; the date filter is a range on\n * `atMs` itself, the order the ledger is already in, so it costs nothing.\n *\n * Order and location are typed or picked ids, matched whole. A sparse field\n * answers `equals` exactly — a row with no order is simply not that order —\n * and offers no \"is set\", which would be an inequality on a second field.\n *\n * No quick search. The ledger's rows name a product by id; the name a reader\n * would type lives on the product, so a search could only ever match the\n * names of the rows already loaded. Product is a picked filter instead, and\n * the ids the old search read (order, location) are filters of their own.\n */\nexport const STOCK_MOVEMENT_FILTER_FIELDS: readonly ListFilterField[] = [\n { column: 'productId', kind: 'exact', path: 'productId', operators: ['equals', 'isAnyOf'] },\n { column: 'reason', kind: 'exact', path: 'reason', operators: ['equals', 'isAnyOf'] },\n { column: 'atMs', kind: 'date', path: 'atMs', storedAs: 'millis', presence: 'always' },\n { column: 'orderId', kind: 'exact', path: 'orderId', operators: ['equals'] },\n { column: 'locationId', kind: 'exact', path: 'locationId', operators: ['equals'] },\n]\n\n/** The ledger's one order: newest first, the order every writer stamps. */\nexport const STOCK_MOVEMENT_QUERY: ListQueryDeclaration = {\n fields: STOCK_MOVEMENT_FILTER_FIELDS,\n sorts: [{ path: 'atMs', direction: 'desc', column: 'atMs' }],\n}\n\nexport const STOCK_MOVEMENT_FILTER_HEADERS: Readonly<Record<string, string>> = {\n productId: 'Product',\n reason: 'Reason',\n atMs: 'When',\n orderId: 'Order',\n locationId: 'Location',\n}\n\n/** The fields picked from choices rather than typed. */\nexport const STOCK_MOVEMENT_SELECT_FIELDS: readonly string[] = ['productId', 'reason', 'locationId']\n\n/** The stored key is a closed set; these are what a merchant reads. */\nexport const STOCK_MOVEMENT_REASON_LABEL: Readonly<Record<InventoryAdjustmentReason, string>> = {\n sale: 'Sale',\n refund: 'Refund return',\n restock: 'Restock',\n correction: 'Correction',\n damage: 'Damaged',\n cancellation: 'Order canceled',\n}\n"],"names":["STOCK_MOVEMENT_FILTER_FIELDS","column","kind","path","operators","storedAs","presence","STOCK_MOVEMENT_QUERY","fields","sorts","direction","STOCK_MOVEMENT_FILTER_HEADERS","productId","reason","atMs","orderId","locationId","STOCK_MOVEMENT_SELECT_FIELDS","STOCK_MOVEMENT_REASON_LABEL","sale","refund","restock","correction","damage","cancellation"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAMD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMA,+BAA2D;IACtE;QAAEC,QAAQ;QAAaC,MAAM;QAASC,MAAM;QAAaC,WAAW;YAAC;YAAU;SAAU;IAAC;IAC1F;QAAEH,QAAQ;QAAUC,MAAM;QAASC,MAAM;QAAUC,WAAW;YAAC;YAAU;SAAU;IAAC;IACpF;QAAEH,QAAQ;QAAQC,MAAM;QAAQC,MAAM;QAAQE,UAAU;QAAUC,UAAU;IAAS;IACrF;QAAEL,QAAQ;QAAWC,MAAM;QAASC,MAAM;QAAWC,WAAW;YAAC;SAAS;IAAC;IAC3E;QAAEH,QAAQ;QAAcC,MAAM;QAASC,MAAM;QAAcC,WAAW;YAAC;SAAS;IAAC;CAClF,CAAA;AAED,yEAAyE,GACzE,OAAO,MAAMG,uBAA6C;IACxDC,QAAQR;IACRS,OAAO;QAAC;YAAEN,MAAM;YAAQO,WAAW;YAAQT,QAAQ;QAAO;KAAE;AAC9D,EAAC;AAED,OAAO,MAAMU,gCAAkE;IAC7EC,WAAW;IACXC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,YAAY;AACd,EAAC;AAED,sDAAsD,GACtD,OAAO,MAAMC,+BAAkD;IAAC;IAAa;IAAU;CAAa,CAAA;AAEpG,qEAAqE,GACrE,OAAO,MAAMC,8BAAmF;IAC9FC,MAAM;IACNC,QAAQ;IACRC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,cAAc;AAChB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/constants/stock-movement-query.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 { ListFilterField } from '@aglyn/shared-ui-jsx/const/list-filter'\nimport type { ListQueryDeclaration } from '@aglyn/shared-ui-jsx/const/list-query-plan'\nimport type { InventoryAdjustmentReason } from '../model/commerce'\n\n/*\n * What the stock movements ledger filters by, and how its query serves it\n * (AGL-3321).\n *\n * Every field is one every writer of `hosts/{hostId}/inventoryAdjustments`\n * already stores — the \"Adjust stock\" dialog, the sale path\n * (`decrementVariantStock`) and the cancellation restock — so nothing new is\n * written and nothing needs a backfill. Each is an EQUALITY beneath the\n * ledger's one order, `atMs` newest first, which is one `(field, atMs DESC)`\n * composite per field under index merging; the date filter is a range on\n * `atMs` itself, the order the ledger is already in, so it costs nothing.\n *\n * Order and location are typed or picked ids, matched whole. A sparse field\n * answers `equals` exactly — a row with no order is simply not that order —\n * and offers no \"is set\", which would be an inequality on a second field.\n *\n * No quick search. The ledger's rows name a product by id; the name a reader\n * would type lives on the product, so a search could only ever match the\n * names of the rows already loaded. Product is a picked filter instead, and\n * the ids the old search read (order, location) are filters of their own.\n */\nexport const STOCK_MOVEMENT_FILTER_FIELDS: readonly ListFilterField[] = [\n { column: 'productId', kind: 'exact', path: 'productId', operators: ['equals', 'isAnyOf'] },\n { column: 'reason', kind: 'exact', path: 'reason', operators: ['equals', 'isAnyOf'] },\n { column: 'atMs', kind: 'date', path: 'atMs', storedAs: 'millis', presence: 'always' },\n { column: 'orderId', kind: 'exact', path: 'orderId', operators: ['equals'] },\n { column: 'locationId', kind: 'exact', path: 'locationId', operators: ['equals'] },\n]\n\n/** The ledger's one order: newest first, the order every writer stamps. */\nexport const STOCK_MOVEMENT_QUERY: ListQueryDeclaration = {\n fields: STOCK_MOVEMENT_FILTER_FIELDS,\n sorts: [{ path: 'atMs', direction: 'desc', column: 'atMs' }],\n}\n\nexport const STOCK_MOVEMENT_FILTER_HEADERS: Readonly<Record<string, string>> = {\n productId: 'Product',\n reason: 'Reason',\n atMs: 'When',\n orderId: 'Order',\n locationId: 'Location',\n}\n\n/** The fields picked from choices rather than typed. */\nexport const STOCK_MOVEMENT_SELECT_FIELDS: readonly string[] = ['productId', 'reason', 'locationId']\n\n/** The stored key is a closed set; these are what a merchant reads. */\nexport const STOCK_MOVEMENT_REASON_LABEL: Readonly<Record<InventoryAdjustmentReason, string>> = {\n sale: 'Sale',\n refund: 'Refund return',\n restock: 'Restock',\n correction: 'Correction',\n damage: 'Damaged',\n cancellation: 'Order canceled',\n sync: 'Count synced',\n}\n"],"names":["STOCK_MOVEMENT_FILTER_FIELDS","column","kind","path","operators","storedAs","presence","STOCK_MOVEMENT_QUERY","fields","sorts","direction","STOCK_MOVEMENT_FILTER_HEADERS","productId","reason","atMs","orderId","locationId","STOCK_MOVEMENT_SELECT_FIELDS","STOCK_MOVEMENT_REASON_LABEL","sale","refund","restock","correction","damage","cancellation","sync"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAMD;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,MAAMA,+BAA2D;IACtE;QAAEC,QAAQ;QAAaC,MAAM;QAASC,MAAM;QAAaC,WAAW;YAAC;YAAU;SAAU;IAAC;IAC1F;QAAEH,QAAQ;QAAUC,MAAM;QAASC,MAAM;QAAUC,WAAW;YAAC;YAAU;SAAU;IAAC;IACpF;QAAEH,QAAQ;QAAQC,MAAM;QAAQC,MAAM;QAAQE,UAAU;QAAUC,UAAU;IAAS;IACrF;QAAEL,QAAQ;QAAWC,MAAM;QAASC,MAAM;QAAWC,WAAW;YAAC;SAAS;IAAC;IAC3E;QAAEH,QAAQ;QAAcC,MAAM;QAASC,MAAM;QAAcC,WAAW;YAAC;SAAS;IAAC;CAClF,CAAA;AAED,yEAAyE,GACzE,OAAO,MAAMG,uBAA6C;IACxDC,QAAQR;IACRS,OAAO;QAAC;YAAEN,MAAM;YAAQO,WAAW;YAAQT,QAAQ;QAAO;KAAE;AAC9D,EAAC;AAED,OAAO,MAAMU,gCAAkE;IAC7EC,WAAW;IACXC,QAAQ;IACRC,MAAM;IACNC,SAAS;IACTC,YAAY;AACd,EAAC;AAED,sDAAsD,GACtD,OAAO,MAAMC,+BAAkD;IAAC;IAAa;IAAU;CAAa,CAAA;AAEpG,qEAAqE,GACrE,OAAO,MAAMC,8BAAmF;IAC9FC,MAAM;IACNC,QAAQ;IACRC,SAAS;IACTC,YAAY;IACZC,QAAQ;IACRC,cAAc;IACdC,MAAM;AACR,EAAC"}
@@ -17,7 +17,9 @@
17
17
  // registry, not the whole server surface.
18
18
  import { registerApiV1SiteResource } from "@aglyn/tenant-data-admin/server/api-v1-resources";
19
19
  import { registerPluginPersonEraser } from "@aglyn/aglyn/plugin-manager/plugin-person-erasure";
20
+ import { registerPluginService } from "@aglyn/aglyn/plugin-manager/plugin-services";
20
21
  import { BUNDLE_ID } from "./constants/bundle-common.js";
22
+ import { ORDER_HISTORY_CONTRACT } from "./model/order-history.js";
21
23
  import { registerCommerceTransferResources } from "./transfer/register-transfer-resources.js";
22
24
  /**
23
25
  * The commerce plugin's CONSOLE-ONLY server declarations, named under
@@ -46,6 +48,13 @@ import { registerCommerceTransferResources } from "./transfer/register-transfer-
46
48
  registerPluginPersonEraser(async (request)=>(await import("./server/person-eraser.js")).commercePersonEraser(request), {
47
49
  pluginId: BUNDLE_ID
48
50
  });
51
+ // A site's earlier orders, for a plugin that reads history behind the
52
+ // order events (AGL-3614); the reader is loaded with the first page asked.
53
+ registerPluginService(ORDER_HISTORY_CONTRACT, {
54
+ listOrders: async (request)=>(await import("./server/order-history.js")).listOrderHistory(request)
55
+ }, {
56
+ pluginId: BUNDLE_ID
57
+ });
49
58
  registerApiV1SiteResource('products', {
50
59
  handle: async (...args)=>(await import("./server/api-v1/orders-and-products.js")).handleProducts(...args),
51
60
  describe: async ()=>(await import("./server/api-v1/openapi.js")).PRODUCTS_API_V1_DESCRIPTION
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.console-server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The registry's own module, not the data layer's barrel: boot needs the\n// registry, not the whole server surface.\nimport { registerApiV1SiteResource } from '@aglyn/tenant-data-admin/server/api-v1-resources'\nimport { registerPluginPersonEraser } from '@aglyn/aglyn/plugin-manager/plugin-person-erasure'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { registerCommerceTransferResources } from './transfer/register-transfer-resources'\n\n/**\n * The commerce plugin's CONSOLE-ONLY server declarations, named under\n * `consoleServerDeclarations` in `plugins.config.json` and run at the\n * console's boot. The tenant runtime registers none of it.\n *\n * It serves a site's products and orders on the customer REST API,\n * `/v1/sites/{siteId}/products/…` and `/v1/sites/{siteId}/orders/…`: the\n * console's router owns the pipeline in front — the key, the plan's API\n * access, the quota, the rate limit, the error envelope — and the site's\n * ownership, and hands every request under each resource here.\n *\n * No plan feature is named on the registrations, though both need\n * `commerce`: the handlers ask the key's scope FIRST and the plan second\n * (AGL-900, AGL-1928), so a key without the scope is told about the scope\n * whatever plan its organization is on, and the router would ask in the\n * opposite order.\n *\n * Light at boot: the handlers are imported with their first request and the\n * descriptions when the document is first built. Registering again replaces\n * this plugin's own entries.\n */\nexport function registerCommerceConsoleServerDeclarations(): void {\n // Commerce's share of a person erasure (AGL-2623, AGL-3080): every order the\n // person placed keeps its amounts, with the buyer taken off it. Required,\n // and loaded with the first erasure.\n registerPluginPersonEraser(\n async (request) => (await import('./server/person-eraser')).commercePersonEraser(request),\n { pluginId: BUNDLE_ID },\n )\n registerApiV1SiteResource(\n 'products',\n {\n handle: async (...args) =>\n (await import('./server/api-v1/orders-and-products')).handleProducts(...args),\n describe: async () =>\n (await import('./server/api-v1/openapi')).PRODUCTS_API_V1_DESCRIPTION,\n },\n { pluginId: BUNDLE_ID },\n )\n registerApiV1SiteResource(\n 'orders',\n {\n handle: async (...args) =>\n (await import('./server/api-v1/orders-and-products')).handleOrders(...args),\n describe: async () =>\n (await import('./server/api-v1/openapi')).ORDERS_API_V1_DESCRIPTION,\n },\n { pluginId: BUNDLE_ID },\n )\n // Products, categories, orders, discounts, coupons and gift cards on the\n // import wizard and the export dialog (AGL-3531): the transfer routes are\n // the console's alone, so they register here.\n registerCommerceTransferResources()\n}\n"],"names":["registerApiV1SiteResource","registerPluginPersonEraser","BUNDLE_ID","registerCommerceTransferResources","registerCommerceConsoleServerDeclarations","request","commercePersonEraser","pluginId","handle","args","handleProducts","describe","PRODUCTS_API_V1_DESCRIPTION","handleOrders","ORDERS_API_V1_DESCRIPTION"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,yEAAyE;AACzE,0CAA0C;AAC1C,SAASA,yBAAyB,QAAQ,mDAAkD;AAC5F,SAASC,0BAA0B,QAAQ,oDAAmD;AAC9F,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,iCAAiC,QAAQ,4CAAwC;AAE1F;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASC;IACd,6EAA6E;IAC7E,0EAA0E;IAC1E,qCAAqC;IACrCH,2BACE,OAAOI,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,4BAAwB,EAAGC,oBAAoB,CAACD,UACjF;QAAEE,UAAUL;IAAU;IAExBF,0BACE,YACA;QACEQ,QAAQ,OAAO,GAAGC,OAChB,AAAC,CAAA,MAAM,MAAM,CAAC,yCAAqC,EAAGC,cAAc,IAAID;QAC1EE,UAAU,UACR,AAAC,CAAA,MAAM,MAAM,CAAC,6BAAyB,EAAGC,2BAA2B;IACzE,GACA;QAAEL,UAAUL;IAAU;IAExBF,0BACE,UACA;QACEQ,QAAQ,OAAO,GAAGC,OAChB,AAAC,CAAA,MAAM,MAAM,CAAC,yCAAqC,EAAGI,YAAY,IAAIJ;QACxEE,UAAU,UACR,AAAC,CAAA,MAAM,MAAM,CAAC,6BAAyB,EAAGG,yBAAyB;IACvE,GACA;QAAEP,UAAUL;IAAU;IAExB,yEAAyE;IACzE,0EAA0E;IAC1E,8CAA8C;IAC9CC;AACF"}
1
+ {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.console-server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The registry's own module, not the data layer's barrel: boot needs the\n// registry, not the whole server surface.\nimport { registerApiV1SiteResource } from '@aglyn/tenant-data-admin/server/api-v1-resources'\nimport { registerPluginPersonEraser } from '@aglyn/aglyn/plugin-manager/plugin-person-erasure'\nimport { registerPluginService } from '@aglyn/aglyn/plugin-manager/plugin-services'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { ORDER_HISTORY_CONTRACT } from './model/order-history'\nimport { registerCommerceTransferResources } from './transfer/register-transfer-resources'\n\n/**\n * The commerce plugin's CONSOLE-ONLY server declarations, named under\n * `consoleServerDeclarations` in `plugins.config.json` and run at the\n * console's boot. The tenant runtime registers none of it.\n *\n * It serves a site's products and orders on the customer REST API,\n * `/v1/sites/{siteId}/products/…` and `/v1/sites/{siteId}/orders/…`: the\n * console's router owns the pipeline in front — the key, the plan's API\n * access, the quota, the rate limit, the error envelope — and the site's\n * ownership, and hands every request under each resource here.\n *\n * No plan feature is named on the registrations, though both need\n * `commerce`: the handlers ask the key's scope FIRST and the plan second\n * (AGL-900, AGL-1928), so a key without the scope is told about the scope\n * whatever plan its organization is on, and the router would ask in the\n * opposite order.\n *\n * Light at boot: the handlers are imported with their first request and the\n * descriptions when the document is first built. Registering again replaces\n * this plugin's own entries.\n */\nexport function registerCommerceConsoleServerDeclarations(): void {\n // Commerce's share of a person erasure (AGL-2623, AGL-3080): every order the\n // person placed keeps its amounts, with the buyer taken off it. Required,\n // and loaded with the first erasure.\n registerPluginPersonEraser(\n async (request) => (await import('./server/person-eraser')).commercePersonEraser(request),\n { pluginId: BUNDLE_ID },\n )\n // A site's earlier orders, for a plugin that reads history behind the\n // order events (AGL-3614); the reader is loaded with the first page asked.\n registerPluginService(\n ORDER_HISTORY_CONTRACT,\n { listOrders: async (request) => (await import('./server/order-history')).listOrderHistory(request) },\n { pluginId: BUNDLE_ID },\n )\n registerApiV1SiteResource(\n 'products',\n {\n handle: async (...args) =>\n (await import('./server/api-v1/orders-and-products')).handleProducts(...args),\n describe: async () =>\n (await import('./server/api-v1/openapi')).PRODUCTS_API_V1_DESCRIPTION,\n },\n { pluginId: BUNDLE_ID },\n )\n registerApiV1SiteResource(\n 'orders',\n {\n handle: async (...args) =>\n (await import('./server/api-v1/orders-and-products')).handleOrders(...args),\n describe: async () =>\n (await import('./server/api-v1/openapi')).ORDERS_API_V1_DESCRIPTION,\n },\n { pluginId: BUNDLE_ID },\n )\n // Products, categories, orders, discounts, coupons and gift cards on the\n // import wizard and the export dialog (AGL-3531): the transfer routes are\n // the console's alone, so they register here.\n registerCommerceTransferResources()\n}\n"],"names":["registerApiV1SiteResource","registerPluginPersonEraser","registerPluginService","BUNDLE_ID","ORDER_HISTORY_CONTRACT","registerCommerceTransferResources","registerCommerceConsoleServerDeclarations","request","commercePersonEraser","pluginId","listOrders","listOrderHistory","handle","args","handleProducts","describe","PRODUCTS_API_V1_DESCRIPTION","handleOrders","ORDERS_API_V1_DESCRIPTION"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,yEAAyE;AACzE,0CAA0C;AAC1C,SAASA,yBAAyB,QAAQ,mDAAkD;AAC5F,SAASC,0BAA0B,QAAQ,oDAAmD;AAC9F,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,sBAAsB,QAAQ,2BAAuB;AAC9D,SAASC,iCAAiC,QAAQ,4CAAwC;AAE1F;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASC;IACd,6EAA6E;IAC7E,0EAA0E;IAC1E,qCAAqC;IACrCL,2BACE,OAAOM,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,4BAAwB,EAAGC,oBAAoB,CAACD,UACjF;QAAEE,UAAUN;IAAU;IAExB,sEAAsE;IACtE,2EAA2E;IAC3ED,sBACEE,wBACA;QAAEM,YAAY,OAAOH,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,4BAAwB,EAAGI,gBAAgB,CAACJ;IAAS,GACpG;QAAEE,UAAUN;IAAU;IAExBH,0BACE,YACA;QACEY,QAAQ,OAAO,GAAGC,OAChB,AAAC,CAAA,MAAM,MAAM,CAAC,yCAAqC,EAAGC,cAAc,IAAID;QAC1EE,UAAU,UACR,AAAC,CAAA,MAAM,MAAM,CAAC,6BAAyB,EAAGC,2BAA2B;IACzE,GACA;QAAEP,UAAUN;IAAU;IAExBH,0BACE,UACA;QACEY,QAAQ,OAAO,GAAGC,OAChB,AAAC,CAAA,MAAM,MAAM,CAAC,yCAAqC,EAAGI,YAAY,IAAIJ;QACxEE,UAAU,UACR,AAAC,CAAA,MAAM,MAAM,CAAC,6BAAyB,EAAGG,yBAAyB;IACvE,GACA;QAAET,UAAUN;IAAU;IAExB,yEAAyE;IACzE,0EAA0E;IAC1E,8CAA8C;IAC9CE;AACF"}
@@ -16,7 +16,8 @@
16
16
  */
17
17
  /**
18
18
  * The commerce plugin's server declarations: the light registrations core
19
- * reads at boot, before any surface loads.
19
+ * reads at boot, before any surface loads — among them its orders as a label
20
+ * buyer reads and writes them, through core's `core.shipment-records`.
20
21
  *
21
22
  * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and
22
23
  * staff can switch them before the first one is ever raised; and the indexes
@@ -16,12 +16,18 @@
16
16
  */ // The seam from its own module, not the plugin-manager barrel: boot needs the
17
17
  // registry and nothing else, and the barrel reaches the client contexts.
18
18
  import { registerOperatorAlerts } from "@aglyn/aglyn/plugin-manager/operator-alerts";
19
+ import { registerPluginEventHandler } from "@aglyn/aglyn/plugin-manager/plugin-events";
19
20
  import { registerPluginRecordIndex } from "@aglyn/aglyn/plugin-manager/plugin-record-index";
21
+ import { registerPluginShipmentRecords } from "@aglyn/aglyn/plugin-manager/plugin-shipment-records";
22
+ import { registerPluginProductCatalog } from "@aglyn/aglyn/plugin-manager/plugin-product-catalog";
23
+ import { registerPluginStockLevels } from "@aglyn/aglyn/plugin-manager/plugin-stock-levels";
20
24
  import { BUNDLE_ID } from "./constants/bundle-common.js";
21
25
  import { COMMERCE_OPERATOR_ALERTS } from "./constants/operator-alerts.js";
26
+ import { registerCommerceEventTriggers } from "./server/order-event-triggers.js";
22
27
  /**
23
28
  * The commerce plugin's server declarations: the light registrations core
24
- * reads at boot, before any surface loads.
29
+ * reads at boot, before any surface loads — among them its orders as a label
30
+ * buyer reads and writes them, through core's `core.shipment-records`.
25
31
  *
26
32
  * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and
27
33
  * staff can switch them before the first one is ever raised; and the indexes
@@ -31,6 +37,8 @@ import { COMMERCE_OPERATOR_ALERTS } from "./constants/operator-alerts.js";
31
37
  registerOperatorAlerts(COMMERCE_OPERATOR_ALERTS, {
32
38
  pluginId: BUNDLE_ID
33
39
  });
40
+ // Its order and return events (AGL-3611), and each as a workflow trigger.
41
+ registerCommerceEventTriggers();
34
42
  // Products and categories, as another plugin reads them (AGL-3080). The
35
43
  // readers and the Admin SDK arrive with the first read, not with the boot.
36
44
  registerPluginRecordIndex('product', lazyIndex('productRecordIndex'), {
@@ -39,7 +47,45 @@ import { COMMERCE_OPERATOR_ALERTS } from "./constants/operator-alerts.js";
39
47
  registerPluginRecordIndex('productCategory', lazyIndex('productCategoryRecordIndex'), {
40
48
  pluginId: BUNDLE_ID
41
49
  });
50
+ // Orders, as a label buyer reads and writes them (AGL-3612): read the
51
+ // lines and the address, write a shipment, record tracking. The module and
52
+ // the Admin SDK load with the first call.
53
+ registerPluginShipmentRecords(lazyShipmentRecords, {
54
+ pluginId: BUNDLE_ID
55
+ });
56
+ // A site's domains as Stripe payment method domains (AGL-3629), so Apple
57
+ // Pay and the other wallets show on the merchant's own domain. The Stripe
58
+ // calls arrive with the first event, not with the boot.
59
+ registerPluginEventHandler('host.domain.attached', async (payload)=>(await import("./server/payment-method-domains.js")).onHostDomainAttached(payload), {
60
+ pluginId: BUNDLE_ID
61
+ });
62
+ registerPluginEventHandler('host.domain.released', async (payload)=>(await import("./server/payment-method-domains.js")).onHostDomainReleased(payload), {
63
+ pluginId: BUNDLE_ID
64
+ });
65
+ // The store's catalog, as a shopping-channel feed reads it (AGL-3637).
66
+ registerPluginProductCatalog(lazyCatalog, {
67
+ pluginId: BUNDLE_ID
68
+ });
69
+ // Counts another warehouse keeps, applied as a stock-take (AGL-3634): a
70
+ // fulfillment network says how many it can ship and the products say so.
71
+ registerPluginStockLevels(lazyStockLevels, {
72
+ pluginId: BUNDLE_ID
73
+ });
42
74
  }
75
+ /** Stock counts, with the Admin SDK and the model arriving on the first call. */ const lazyStockLevels = {
76
+ setAvailable: async (request)=>(await import("./server/stock-levels.js")).commerceStockLevels.setAvailable(request)
77
+ };
78
+ const loadShipmentRecords = async ()=>(await import("./server/shipment-records.js")).commerceShipmentRecords;
79
+ const lazyShipmentRecords = {
80
+ read: async (hostId, recordId)=>(await loadShipmentRecords()).read(hostId, recordId),
81
+ recordShipment: async (write)=>(await loadShipmentRecords()).recordShipment(write),
82
+ recordTracking: async (update)=>(await loadShipmentRecords()).recordTracking(update),
83
+ shipFromAddresses: async (hostId)=>(await loadShipmentRecords()).shipFromAddresses(hostId)
84
+ };
85
+ /** The catalog, with the Admin SDK and the model arriving on the first read. */ const lazyCatalog = {
86
+ store: async (hostId)=>(await import("./server/product-catalog.js")).productCatalog.store(hostId),
87
+ page: async (request)=>(await import("./server/product-catalog.js")).productCatalog.page(request)
88
+ };
43
89
  function lazyIndex(name) {
44
90
  const load = async ()=>(await import("./server/product-record-index.js"))[name];
45
91
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The seam from its own module, not the plugin-manager barrel: boot needs the\n// registry and nothing else, and the barrel reaches the client contexts.\nimport { registerOperatorAlerts } from '@aglyn/aglyn/plugin-manager/operator-alerts'\nimport {\n registerPluginRecordIndex,\n type PluginRecordIndex,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-index'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_OPERATOR_ALERTS } from './constants/operator-alerts'\n\n/**\n * The commerce plugin's server declarations: the light registrations core\n * reads at boot, before any surface loads.\n *\n * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and\n * staff can switch them before the first one is ever raised; and the indexes\n * of its products and categories, so another plugin reads them without\n * reaching for this plugin's collections.\n */\nexport function registerCommerceServerDeclarations(): void {\n registerOperatorAlerts(COMMERCE_OPERATOR_ALERTS, { pluginId: BUNDLE_ID })\n // Products and categories, as another plugin reads them (AGL-3080). The\n // readers and the Admin SDK arrive with the first read, not with the boot.\n registerPluginRecordIndex('product', lazyIndex('productRecordIndex'), { pluginId: BUNDLE_ID })\n registerPluginRecordIndex('productCategory', lazyIndex('productCategoryRecordIndex'), {\n pluginId: BUNDLE_ID,\n })\n}\n\ntype IndexName = 'productRecordIndex' | 'productCategoryRecordIndex'\n\nfunction lazyIndex(name: IndexName): PluginRecordIndex {\n const load = async () => (await import('./server/product-record-index'))[name]\n return {\n list: async (request) => (await load()).list(request),\n get: async (request) => (await load()).get(request),\n }\n}\n"],"names":["registerOperatorAlerts","registerPluginRecordIndex","BUNDLE_ID","COMMERCE_OPERATOR_ALERTS","registerCommerceServerDeclarations","pluginId","lazyIndex","name","load","list","request","get"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E;AAC9E,yEAAyE;AACzE,SAASA,sBAAsB,QAAQ,8CAA6C;AACpF,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,wBAAwB,QAAQ,iCAA6B;AAEtE;;;;;;;;CAQC,GACD,OAAO,SAASC;IACdJ,uBAAuBG,0BAA0B;QAAEE,UAAUH;IAAU;IACvE,wEAAwE;IACxE,2EAA2E;IAC3ED,0BAA0B,WAAWK,UAAU,uBAAuB;QAAED,UAAUH;IAAU;IAC5FD,0BAA0B,mBAAmBK,UAAU,+BAA+B;QACpFD,UAAUH;IACZ;AACF;AAIA,SAASI,UAAUC,IAAe;IAChC,MAAMC,OAAO,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,mCAA+B,CAAE,CAACD,KAAK;IAC9E,OAAO;QACLE,MAAM,OAAOC,UAAY,AAAC,CAAA,MAAMF,MAAK,EAAGC,IAAI,CAACC;QAC7CC,KAAK,OAAOD,UAAY,AAAC,CAAA,MAAMF,MAAK,EAAGG,GAAG,CAACD;IAC7C;AACF"}
1
+ {"version":3,"sources":["../../../../../../libs/plugins/commerce/src/lib/declarations.server.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// The seam from its own module, not the plugin-manager barrel: boot needs the\n// registry and nothing else, and the barrel reaches the client contexts.\nimport { registerOperatorAlerts } from '@aglyn/aglyn/plugin-manager/operator-alerts'\nimport { registerPluginEventHandler } from '@aglyn/aglyn/plugin-manager/plugin-events'\nimport {\n registerPluginRecordIndex,\n type PluginRecordIndex,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-index'\nimport {\n registerPluginShipmentRecords,\n type PluginShipmentRecords,\n} from '@aglyn/aglyn/plugin-manager/plugin-shipment-records'\nimport {\n registerPluginProductCatalog,\n type PluginProductCatalog,\n} from '@aglyn/aglyn/plugin-manager/plugin-product-catalog'\nimport {\n registerPluginStockLevels,\n type PluginStockLevels,\n} from '@aglyn/aglyn/plugin-manager/plugin-stock-levels'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { COMMERCE_OPERATOR_ALERTS } from './constants/operator-alerts'\nimport { registerCommerceEventTriggers } from './server/order-event-triggers'\n\n/**\n * The commerce plugin's server declarations: the light registrations core\n * reads at boot, before any surface loads — among them its orders as a label\n * buyer reads and writes them, through core's `core.shipment-records`.\n *\n * Its operator alerts (AGL-3377), so Staff → Operator alerts lists them and\n * staff can switch them before the first one is ever raised; and the indexes\n * of its products and categories, so another plugin reads them without\n * reaching for this plugin's collections.\n */\nexport function registerCommerceServerDeclarations(): void {\n registerOperatorAlerts(COMMERCE_OPERATOR_ALERTS, { pluginId: BUNDLE_ID })\n // Its order and return events (AGL-3611), and each as a workflow trigger.\n registerCommerceEventTriggers()\n // Products and categories, as another plugin reads them (AGL-3080). The\n // readers and the Admin SDK arrive with the first read, not with the boot.\n registerPluginRecordIndex('product', lazyIndex('productRecordIndex'), { pluginId: BUNDLE_ID })\n registerPluginRecordIndex('productCategory', lazyIndex('productCategoryRecordIndex'), {\n pluginId: BUNDLE_ID,\n })\n // Orders, as a label buyer reads and writes them (AGL-3612): read the\n // lines and the address, write a shipment, record tracking. The module and\n // the Admin SDK load with the first call.\n registerPluginShipmentRecords(lazyShipmentRecords, { pluginId: BUNDLE_ID })\n // A site's domains as Stripe payment method domains (AGL-3629), so Apple\n // Pay and the other wallets show on the merchant's own domain. The Stripe\n // calls arrive with the first event, not with the boot.\n registerPluginEventHandler(\n 'host.domain.attached',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainAttached(payload),\n { pluginId: BUNDLE_ID },\n )\n registerPluginEventHandler(\n 'host.domain.released',\n async (payload) =>\n (await import('./server/payment-method-domains')).onHostDomainReleased(payload),\n { pluginId: BUNDLE_ID },\n )\n // The store's catalog, as a shopping-channel feed reads it (AGL-3637).\n registerPluginProductCatalog(lazyCatalog, { pluginId: BUNDLE_ID })\n // Counts another warehouse keeps, applied as a stock-take (AGL-3634): a\n // fulfillment network says how many it can ship and the products say so.\n registerPluginStockLevels(lazyStockLevels, { pluginId: BUNDLE_ID })\n}\n\n/** Stock counts, with the Admin SDK and the model arriving on the first call. */\nconst lazyStockLevels: PluginStockLevels = {\n setAvailable: async (request) => (await import('./server/stock-levels')).commerceStockLevels.setAvailable(request),\n}\n\nconst loadShipmentRecords = async () =>\n (await import('./server/shipment-records')).commerceShipmentRecords\n\nconst lazyShipmentRecords: PluginShipmentRecords = {\n read: async (hostId, recordId) => (await loadShipmentRecords()).read(hostId, recordId),\n recordShipment: async (write) => (await loadShipmentRecords()).recordShipment(write),\n recordTracking: async (update) => (await loadShipmentRecords()).recordTracking(update),\n shipFromAddresses: async (hostId) => (await loadShipmentRecords()).shipFromAddresses(hostId),\n}\n\n/** The catalog, with the Admin SDK and the model arriving on the first read. */\nconst lazyCatalog: PluginProductCatalog = {\n store: async (hostId) => (await import('./server/product-catalog')).productCatalog.store(hostId),\n page: async (request) => (await import('./server/product-catalog')).productCatalog.page(request),\n}\n\ntype IndexName = 'productRecordIndex' | 'productCategoryRecordIndex'\n\nfunction lazyIndex(name: IndexName): PluginRecordIndex {\n const load = async () => (await import('./server/product-record-index'))[name]\n return {\n list: async (request) => (await load()).list(request),\n get: async (request) => (await load()).get(request),\n }\n}\n"],"names":["registerOperatorAlerts","registerPluginEventHandler","registerPluginRecordIndex","registerPluginShipmentRecords","registerPluginProductCatalog","registerPluginStockLevels","BUNDLE_ID","COMMERCE_OPERATOR_ALERTS","registerCommerceEventTriggers","registerCommerceServerDeclarations","pluginId","lazyIndex","lazyShipmentRecords","payload","onHostDomainAttached","onHostDomainReleased","lazyCatalog","lazyStockLevels","setAvailable","request","commerceStockLevels","loadShipmentRecords","commerceShipmentRecords","read","hostId","recordId","recordShipment","write","recordTracking","update","shipFromAddresses","store","productCatalog","page","name","load","list","get"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E;AAC9E,yEAAyE;AACzE,SAASA,sBAAsB,QAAQ,8CAA6C;AACpF,SAASC,0BAA0B,QAAQ,4CAA2C;AACtF,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SACEC,6BAA6B,QAExB,sDAAqD;AAC5D,SACEC,4BAA4B,QAEvB,qDAAoD;AAC3D,SACEC,yBAAyB,QAEpB,kDAAiD;AACxD,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,wBAAwB,QAAQ,iCAA6B;AACtE,SAASC,6BAA6B,QAAQ,mCAA+B;AAE7E;;;;;;;;;CASC,GACD,OAAO,SAASC;IACdT,uBAAuBO,0BAA0B;QAAEG,UAAUJ;IAAU;IACvE,0EAA0E;IAC1EE;IACA,wEAAwE;IACxE,2EAA2E;IAC3EN,0BAA0B,WAAWS,UAAU,uBAAuB;QAAED,UAAUJ;IAAU;IAC5FJ,0BAA0B,mBAAmBS,UAAU,+BAA+B;QACpFD,UAAUJ;IACZ;IACA,sEAAsE;IACtE,2EAA2E;IAC3E,0CAA0C;IAC1CH,8BAA8BS,qBAAqB;QAAEF,UAAUJ;IAAU;IACzE,yEAAyE;IACzE,0EAA0E;IAC1E,wDAAwD;IACxDL,2BACE,wBACA,OAAOY,UACL,AAAC,CAAA,MAAM,MAAM,CAAC,qCAAiC,EAAGC,oBAAoB,CAACD,UACzE;QAAEH,UAAUJ;IAAU;IAExBL,2BACE,wBACA,OAAOY,UACL,AAAC,CAAA,MAAM,MAAM,CAAC,qCAAiC,EAAGE,oBAAoB,CAACF,UACzE;QAAEH,UAAUJ;IAAU;IAExB,uEAAuE;IACvEF,6BAA6BY,aAAa;QAAEN,UAAUJ;IAAU;IAChE,wEAAwE;IACxE,yEAAyE;IACzED,0BAA0BY,iBAAiB;QAAEP,UAAUJ;IAAU;AACnE;AAEA,+EAA+E,GAC/E,MAAMW,kBAAqC;IACzCC,cAAc,OAAOC,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,2BAAuB,EAAGC,mBAAmB,CAACF,YAAY,CAACC;AAC5G;AAEA,MAAME,sBAAsB,UAC1B,AAAC,CAAA,MAAM,MAAM,CAAC,+BAA2B,EAAGC,uBAAuB;AAErE,MAAMV,sBAA6C;IACjDW,MAAM,OAAOC,QAAQC,WAAa,AAAC,CAAA,MAAMJ,qBAAoB,EAAGE,IAAI,CAACC,QAAQC;IAC7EC,gBAAgB,OAAOC,QAAU,AAAC,CAAA,MAAMN,qBAAoB,EAAGK,cAAc,CAACC;IAC9EC,gBAAgB,OAAOC,SAAW,AAAC,CAAA,MAAMR,qBAAoB,EAAGO,cAAc,CAACC;IAC/EC,mBAAmB,OAAON,SAAW,AAAC,CAAA,MAAMH,qBAAoB,EAAGS,iBAAiB,CAACN;AACvF;AAEA,8EAA8E,GAC9E,MAAMR,cAAoC;IACxCe,OAAO,OAAOP,SAAW,AAAC,CAAA,MAAM,MAAM,CAAC,8BAA0B,EAAGQ,cAAc,CAACD,KAAK,CAACP;IACzFS,MAAM,OAAOd,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,8BAA0B,EAAGa,cAAc,CAACC,IAAI,CAACd;AAC1F;AAIA,SAASR,UAAUuB,IAAe;IAChC,MAAMC,OAAO,UAAY,AAAC,CAAA,MAAM,MAAM,CAAC,mCAA+B,CAAE,CAACD,KAAK;IAC9E,OAAO;QACLE,MAAM,OAAOjB,UAAY,AAAC,CAAA,MAAMgB,MAAK,EAAGC,IAAI,CAACjB;QAC7CkB,KAAK,OAAOlB,UAAY,AAAC,CAAA,MAAMgB,MAAK,EAAGE,GAAG,CAAClB;IAC7C;AACF"}
@@ -0,0 +1,59 @@
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
+ /**
18
+ * What a store tells its buyer, and when (AGL-3610).
19
+ *
20
+ * Five moments in an order's life each send the buyer one message: the
21
+ * receipt, each shipment, delivery, each refund and a cancellation. A store
22
+ * turns any of them off on `hosts/{hostId}/settings/store.buyerNotifications`
23
+ * — and ONLY off: every moment is ON unless an explicit `false` is stored,
24
+ * because transaction messages are on by default for every store, existing
25
+ * and new (the 2026-10-06 decision AGL-3600 implemented for the owner's own
26
+ * notices). An absent map, an absent key and a malformed value all read as
27
+ * on, so a schema slip can never silence a store's receipts.
28
+ *
29
+ * `texts` is the channel switch rather than a moment: when the platform can
30
+ * send texts and the order carries the buyer's phone number, each moment that
31
+ * is on also goes by text unless the store turned texts off.
32
+ */
33
+ export declare const BUYER_NOTIFICATION_EVENTS: readonly ["receipt", "shipped", "delivered", "refunded", "cancelled"];
34
+ export type BuyerNotificationEvent = (typeof BUYER_NOTIFICATION_EVENTS)[number];
35
+ export type BuyerNotificationChannel = 'email' | 'sms';
36
+ export type BuyerNotificationSettings = Partial<Record<BuyerNotificationEvent | 'texts', boolean>>;
37
+ /** The designable email each moment sends: keys in `tenant-emails.ts`. */
38
+ export declare const BUYER_NOTIFICATION_EMAIL_KEYS: Readonly<Record<BuyerNotificationEvent, string>>;
39
+ /** How the store settings card names each moment. */
40
+ export declare const BUYER_NOTIFICATION_LABELS: Readonly<Record<BuyerNotificationEvent, {
41
+ label: string;
42
+ description: string;
43
+ }>>;
44
+ /** Whether a moment (or the `texts` channel) is on. Only `false` is off. */
45
+ export declare function buyerNotificationEnabled(settings: unknown, key: BuyerNotificationEvent | 'texts'): boolean;
46
+ /**
47
+ * The idempotency key for one message: which moment, which occurrence of it
48
+ * (a shipment id, a refund id; `order` for the once-per-order moments) and
49
+ * which channel. Stored as a field name under `buyerNotifications` on the
50
+ * order, so it is restricted to characters a Firestore field path takes
51
+ * without quoting.
52
+ */
53
+ export declare function buyerNotificationMarker(event: BuyerNotificationEvent, occurrence: string, channel: BuyerNotificationChannel): string;
54
+ /**
55
+ * Formats integer cents in the store's currency. Falls back to a plain dollar
56
+ * figure for a currency code `Intl` does not know, rather than throwing on a
57
+ * stored typo.
58
+ */
59
+ export declare function formatOrderMoney(cents: number, currency?: string): string;
@@ -0,0 +1,97 @@
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
+ * What a store tells its buyer, and when (AGL-3610).
18
+ *
19
+ * Five moments in an order's life each send the buyer one message: the
20
+ * receipt, each shipment, delivery, each refund and a cancellation. A store
21
+ * turns any of them off on `hosts/{hostId}/settings/store.buyerNotifications`
22
+ * — and ONLY off: every moment is ON unless an explicit `false` is stored,
23
+ * because transaction messages are on by default for every store, existing
24
+ * and new (the 2026-10-06 decision AGL-3600 implemented for the owner's own
25
+ * notices). An absent map, an absent key and a malformed value all read as
26
+ * on, so a schema slip can never silence a store's receipts.
27
+ *
28
+ * `texts` is the channel switch rather than a moment: when the platform can
29
+ * send texts and the order carries the buyer's phone number, each moment that
30
+ * is on also goes by text unless the store turned texts off.
31
+ */ export const BUYER_NOTIFICATION_EVENTS = [
32
+ 'receipt',
33
+ 'shipped',
34
+ 'delivered',
35
+ 'refunded',
36
+ 'cancelled'
37
+ ];
38
+ /** The designable email each moment sends: keys in `tenant-emails.ts`. */ export const BUYER_NOTIFICATION_EMAIL_KEYS = {
39
+ receipt: 'order-receipt',
40
+ shipped: 'order-shipped',
41
+ delivered: 'order-delivered',
42
+ refunded: 'order-refunded',
43
+ cancelled: 'order-cancelled'
44
+ };
45
+ /** How the store settings card names each moment. */ export const BUYER_NOTIFICATION_LABELS = {
46
+ receipt: {
47
+ label: 'Order receipt',
48
+ description: 'When an order is paid: online, from a payment link, or at the register when the customer gives an email.'
49
+ },
50
+ shipped: {
51
+ label: 'Order shipped',
52
+ description: 'Each time you ship part or all of an order, with the carrier and tracking link.'
53
+ },
54
+ delivered: {
55
+ label: 'Order delivered',
56
+ description: 'When you mark an order delivered.'
57
+ },
58
+ refunded: {
59
+ label: 'Refund issued',
60
+ description: 'Each refund, with the amount and any items you named.'
61
+ },
62
+ cancelled: {
63
+ label: 'Order canceled',
64
+ description: 'When you cancel an order.'
65
+ }
66
+ };
67
+ /** Whether a moment (or the `texts` channel) is on. Only `false` is off. */ export function buyerNotificationEnabled(settings, key) {
68
+ if (!settings || typeof settings !== 'object') return true;
69
+ return settings[key] !== false;
70
+ }
71
+ /**
72
+ * The idempotency key for one message: which moment, which occurrence of it
73
+ * (a shipment id, a refund id; `order` for the once-per-order moments) and
74
+ * which channel. Stored as a field name under `buyerNotifications` on the
75
+ * order, so it is restricted to characters a Firestore field path takes
76
+ * without quoting.
77
+ */ export function buyerNotificationMarker(event, occurrence, channel) {
78
+ const safe = (value)=>String(value || 'order').replace(/[^A-Za-z0-9_-]/g, '_').slice(0, 120);
79
+ return `${event}__${safe(occurrence)}__${channel}`;
80
+ }
81
+ /**
82
+ * Formats integer cents in the store's currency. Falls back to a plain dollar
83
+ * figure for a currency code `Intl` does not know, rather than throwing on a
84
+ * stored typo.
85
+ */ export function formatOrderMoney(cents, currency = 'USD') {
86
+ const amount = (Number(cents) || 0) / 100;
87
+ try {
88
+ return new Intl.NumberFormat('en-US', {
89
+ style: 'currency',
90
+ currency: String(currency || 'USD').toUpperCase()
91
+ }).format(amount);
92
+ } catch (unused) {
93
+ return `$${amount.toFixed(2)}`;
94
+ }
95
+ }
96
+
97
+ //# sourceMappingURL=buyer-notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/buyer-notifications.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * What a store tells its buyer, and when (AGL-3610).\n *\n * Five moments in an order's life each send the buyer one message: the\n * receipt, each shipment, delivery, each refund and a cancellation. A store\n * turns any of them off on `hosts/{hostId}/settings/store.buyerNotifications`\n * — and ONLY off: every moment is ON unless an explicit `false` is stored,\n * because transaction messages are on by default for every store, existing\n * and new (the 2026-10-06 decision AGL-3600 implemented for the owner's own\n * notices). An absent map, an absent key and a malformed value all read as\n * on, so a schema slip can never silence a store's receipts.\n *\n * `texts` is the channel switch rather than a moment: when the platform can\n * send texts and the order carries the buyer's phone number, each moment that\n * is on also goes by text unless the store turned texts off.\n */\nexport const BUYER_NOTIFICATION_EVENTS = [\n 'receipt',\n 'shipped',\n 'delivered',\n 'refunded',\n 'cancelled',\n] as const\n\nexport type BuyerNotificationEvent = (typeof BUYER_NOTIFICATION_EVENTS)[number]\n\nexport type BuyerNotificationChannel = 'email' | 'sms'\n\nexport type BuyerNotificationSettings = Partial<\n Record<BuyerNotificationEvent | 'texts', boolean>\n>\n\n/** The designable email each moment sends: keys in `tenant-emails.ts`. */\nexport const BUYER_NOTIFICATION_EMAIL_KEYS: Readonly<\n Record<BuyerNotificationEvent, string>\n> = {\n receipt: 'order-receipt',\n shipped: 'order-shipped',\n delivered: 'order-delivered',\n refunded: 'order-refunded',\n cancelled: 'order-cancelled',\n}\n\n/** How the store settings card names each moment. */\nexport const BUYER_NOTIFICATION_LABELS: Readonly<\n Record<BuyerNotificationEvent, { label: string; description: string }>\n> = {\n receipt: {\n label: 'Order receipt',\n description:\n 'When an order is paid: online, from a payment link, or at the register when the customer gives an email.',\n },\n shipped: {\n label: 'Order shipped',\n description:\n 'Each time you ship part or all of an order, with the carrier and tracking link.',\n },\n delivered: {\n label: 'Order delivered',\n description: 'When you mark an order delivered.',\n },\n refunded: {\n label: 'Refund issued',\n description: 'Each refund, with the amount and any items you named.',\n },\n cancelled: {\n label: 'Order canceled',\n description: 'When you cancel an order.',\n },\n}\n\n/** Whether a moment (or the `texts` channel) is on. Only `false` is off. */\nexport function buyerNotificationEnabled(\n settings: unknown,\n key: BuyerNotificationEvent | 'texts',\n): boolean {\n if (!settings || typeof settings !== 'object') return true\n return (settings as Record<string, unknown>)[key] !== false\n}\n\n/**\n * The idempotency key for one message: which moment, which occurrence of it\n * (a shipment id, a refund id; `order` for the once-per-order moments) and\n * which channel. Stored as a field name under `buyerNotifications` on the\n * order, so it is restricted to characters a Firestore field path takes\n * without quoting.\n */\nexport function buyerNotificationMarker(\n event: BuyerNotificationEvent,\n occurrence: string,\n channel: BuyerNotificationChannel,\n): string {\n const safe = (value: string) =>\n String(value || 'order')\n .replace(/[^A-Za-z0-9_-]/g, '_')\n .slice(0, 120)\n return `${event}__${safe(occurrence)}__${channel}`\n}\n\n/**\n * Formats integer cents in the store's currency. Falls back to a plain dollar\n * figure for a currency code `Intl` does not know, rather than throwing on a\n * stored typo.\n */\nexport function formatOrderMoney(cents: number, currency = 'USD'): string {\n const amount = (Number(cents) || 0) / 100\n try {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: String(currency || 'USD').toUpperCase(),\n }).format(amount)\n } catch {\n return `$${amount.toFixed(2)}`\n }\n}\n"],"names":["BUYER_NOTIFICATION_EVENTS","BUYER_NOTIFICATION_EMAIL_KEYS","receipt","shipped","delivered","refunded","cancelled","BUYER_NOTIFICATION_LABELS","label","description","buyerNotificationEnabled","settings","key","buyerNotificationMarker","event","occurrence","channel","safe","value","String","replace","slice","formatOrderMoney","cents","currency","amount","Number","Intl","NumberFormat","style","toUpperCase","format","toFixed"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMA,4BAA4B;IACvC;IACA;IACA;IACA;IACA;CACD,CAAS;AAUV,wEAAwE,GACxE,OAAO,MAAMC,gCAET;IACFC,SAAS;IACTC,SAAS;IACTC,WAAW;IACXC,UAAU;IACVC,WAAW;AACb,EAAC;AAED,mDAAmD,GACnD,OAAO,MAAMC,4BAET;IACFL,SAAS;QACPM,OAAO;QACPC,aACE;IACJ;IACAN,SAAS;QACPK,OAAO;QACPC,aACE;IACJ;IACAL,WAAW;QACTI,OAAO;QACPC,aAAa;IACf;IACAJ,UAAU;QACRG,OAAO;QACPC,aAAa;IACf;IACAH,WAAW;QACTE,OAAO;QACPC,aAAa;IACf;AACF,EAAC;AAED,0EAA0E,GAC1E,OAAO,SAASC,yBACdC,QAAiB,EACjBC,GAAqC;IAErC,IAAI,CAACD,YAAY,OAAOA,aAAa,UAAU,OAAO;IACtD,OAAO,AAACA,QAAoC,CAACC,IAAI,KAAK;AACxD;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,wBACdC,KAA6B,EAC7BC,UAAkB,EAClBC,OAAiC;IAEjC,MAAMC,OAAO,CAACC,QACZC,OAAOD,SAAS,SACbE,OAAO,CAAC,mBAAmB,KAC3BC,KAAK,CAAC,GAAG;IACd,OAAO,GAAGP,MAAM,EAAE,EAAEG,KAAKF,YAAY,EAAE,EAAEC,SAAS;AACpD;AAEA;;;;CAIC,GACD,OAAO,SAASM,iBAAiBC,KAAa,EAAEC,WAAW,KAAK;IAC9D,MAAMC,SAAS,AAACC,CAAAA,OAAOH,UAAU,CAAA,IAAK;IACtC,IAAI;QACF,OAAO,IAAII,KAAKC,YAAY,CAAC,SAAS;YACpCC,OAAO;YACPL,UAAUL,OAAOK,YAAY,OAAOM,WAAW;QACjD,GAAGC,MAAM,CAACN;IACZ,EAAE,eAAM;QACN,OAAO,CAAC,CAAC,EAAEA,OAAOO,OAAO,CAAC,IAAI;IAChC;AACF"}