@aglyn/plugins-commerce 1.0.0-beta.229 → 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 (590) 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 +58 -2
  176. package/src/lib/components/console/product-zones.js +10 -2
  177. package/src/lib/components/console/product-zones.js.map +1 -1
  178. package/src/lib/components/console/products-hub-card.component.js +51 -11
  179. package/src/lib/components/console/products-hub-card.component.js.map +1 -1
  180. package/src/lib/components/console/register-hardware-card.component.d.ts +33 -0
  181. package/src/lib/components/console/register-hardware-card.component.js +826 -0
  182. package/src/lib/components/console/register-hardware-card.component.js.map +1 -0
  183. package/src/lib/components/console/registers-card.component.js +24 -5
  184. package/src/lib/components/console/registers-card.component.js.map +1 -1
  185. package/src/lib/components/console/return-actions.d.ts +38 -0
  186. package/src/lib/components/console/return-actions.js +76 -0
  187. package/src/lib/components/console/return-actions.js.map +1 -0
  188. package/src/lib/components/console/return-detail-dialog.component.d.ts +34 -0
  189. package/src/lib/components/console/return-detail-dialog.component.js +718 -0
  190. package/src/lib/components/console/return-detail-dialog.component.js.map +1 -0
  191. package/src/lib/components/console/return-settings-card.component.d.ts +34 -0
  192. package/src/lib/components/console/return-settings-card.component.js +195 -0
  193. package/src/lib/components/console/return-settings-card.component.js.map +1 -0
  194. package/src/lib/components/console/return-zones.d.ts +87 -0
  195. package/src/lib/components/console/return-zones.js +31 -0
  196. package/src/lib/components/console/return-zones.js.map +1 -0
  197. package/src/lib/components/console/returns-card.component.d.ts +45 -0
  198. package/src/lib/components/console/returns-card.component.js +159 -0
  199. package/src/lib/components/console/returns-card.component.js.map +1 -0
  200. package/src/lib/components/console/shipping-settings-card.component.js +161 -5
  201. package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
  202. package/src/lib/components/console/shippingeasy-card.component.d.ts +59 -0
  203. package/src/lib/components/console/shippingeasy-card.component.js +378 -0
  204. package/src/lib/components/console/shippingeasy-card.component.js.map +1 -0
  205. package/src/lib/components/console/shipstation-card.component.d.ts +35 -0
  206. package/src/lib/components/console/shipstation-card.component.js +345 -0
  207. package/src/lib/components/console/shipstation-card.component.js.map +1 -0
  208. package/src/lib/components/console/start-return-dialog.component.d.ts +40 -0
  209. package/src/lib/components/console/start-return-dialog.component.js +243 -0
  210. package/src/lib/components/console/start-return-dialog.component.js.map +1 -0
  211. package/src/lib/components/console/stock-movements-card.component.js +2 -1
  212. package/src/lib/components/console/stock-movements-card.component.js.map +1 -1
  213. package/src/lib/components/console/store-settings-card.component.js +2 -66
  214. package/src/lib/components/console/store-settings-card.component.js.map +1 -1
  215. package/src/lib/components/console/store-zones.d.ts +42 -0
  216. package/src/lib/components/console/store-zones.js +39 -0
  217. package/src/lib/components/console/store-zones.js.map +1 -0
  218. package/src/lib/components/order-status.d.ts +36 -0
  219. package/src/lib/components/order-status.js +502 -0
  220. package/src/lib/components/order-status.js.map +1 -0
  221. package/src/lib/components/product-detail.js +44 -2
  222. package/src/lib/components/product-detail.js.map +1 -1
  223. package/src/lib/components/return-request.d.ts +32 -0
  224. package/src/lib/components/return-request.js +576 -0
  225. package/src/lib/components/return-request.js.map +1 -0
  226. package/src/lib/components/storefront-payment-appearance.d.ts +32 -0
  227. package/src/lib/components/storefront-payment-appearance.js +114 -0
  228. package/src/lib/components/storefront-payment-appearance.js.map +1 -0
  229. package/src/lib/components/storefront-payment-element.d.ts +57 -1
  230. package/src/lib/components/storefront-payment-element.js +332 -33
  231. package/src/lib/components/storefront-payment-element.js.map +1 -1
  232. package/src/lib/constants/order-status.d.ts +22 -0
  233. package/src/lib/constants/order-status.js +22 -0
  234. package/src/lib/constants/order-status.js.map +1 -0
  235. package/src/lib/constants/return-request.d.ts +27 -0
  236. package/src/lib/constants/return-request.js +32 -0
  237. package/src/lib/constants/return-request.js.map +1 -0
  238. package/src/lib/constants/stock-movement-query.js +2 -1
  239. package/src/lib/constants/stock-movement-query.js.map +1 -1
  240. package/src/lib/declarations.console-server.js +9 -0
  241. package/src/lib/declarations.console-server.js.map +1 -1
  242. package/src/lib/declarations.server.d.ts +2 -1
  243. package/src/lib/declarations.server.js +47 -1
  244. package/src/lib/declarations.server.js.map +1 -1
  245. package/src/lib/model/buyer-notifications.d.ts +59 -0
  246. package/src/lib/model/buyer-notifications.js +97 -0
  247. package/src/lib/model/buyer-notifications.js.map +1 -0
  248. package/src/lib/model/commerce-orders.d.ts +127 -1
  249. package/src/lib/model/commerce-orders.js +24 -15
  250. package/src/lib/model/commerce-orders.js.map +1 -1
  251. package/src/lib/model/commerce-payment-methods.d.ts +146 -0
  252. package/src/lib/model/commerce-payment-methods.js +247 -0
  253. package/src/lib/model/commerce-payment-methods.js.map +1 -0
  254. package/src/lib/model/commerce-pos-ops.d.ts +437 -0
  255. package/src/lib/model/commerce-pos-ops.js +721 -0
  256. package/src/lib/model/commerce-pos-ops.js.map +1 -0
  257. package/src/lib/model/commerce-pos.d.ts +263 -0
  258. package/src/lib/model/commerce-pos.js +375 -0
  259. package/src/lib/model/commerce-pos.js.map +1 -0
  260. package/src/lib/model/commerce-printers.d.ts +211 -0
  261. package/src/lib/model/commerce-printers.js +181 -0
  262. package/src/lib/model/commerce-printers.js.map +1 -0
  263. package/src/lib/model/commerce-receipt.d.ts +97 -0
  264. package/src/lib/model/commerce-receipt.js +180 -0
  265. package/src/lib/model/commerce-receipt.js.map +1 -0
  266. package/src/lib/model/commerce-returns.d.ts +207 -0
  267. package/src/lib/model/commerce-returns.js +300 -0
  268. package/src/lib/model/commerce-returns.js.map +1 -0
  269. package/src/lib/model/commerce-shipping.d.ts +44 -1
  270. package/src/lib/model/commerce-shipping.js +53 -9
  271. package/src/lib/model/commerce-shipping.js.map +1 -1
  272. package/src/lib/model/commerce-tax-engine.d.ts +90 -0
  273. package/src/lib/model/commerce-tax-engine.js +129 -0
  274. package/src/lib/model/commerce-tax-engine.js.map +1 -0
  275. package/src/lib/model/commerce.d.ts +88 -2
  276. package/src/lib/model/commerce.js +89 -1
  277. package/src/lib/model/commerce.js.map +1 -1
  278. package/src/lib/model/index.d.ts +15 -0
  279. package/src/lib/model/index.js +15 -0
  280. package/src/lib/model/index.js.map +1 -1
  281. package/src/lib/model/order-events.d.ts +154 -0
  282. package/src/lib/model/order-events.js +153 -0
  283. package/src/lib/model/order-events.js.map +1 -0
  284. package/src/lib/model/order-fulfillment.d.ts +117 -0
  285. package/src/lib/model/order-fulfillment.js +217 -0
  286. package/src/lib/model/order-fulfillment.js.map +1 -0
  287. package/src/lib/model/order-history.d.ts +58 -0
  288. package/src/lib/model/order-history.js +22 -0
  289. package/src/lib/model/order-history.js.map +1 -0
  290. package/src/lib/model/order-list-fields.d.ts +9 -1
  291. package/src/lib/model/order-list-fields.js +7 -1
  292. package/src/lib/model/order-list-fields.js.map +1 -1
  293. package/src/lib/model/order-shipping-export.d.ts +91 -0
  294. package/src/lib/model/order-shipping-export.js +192 -0
  295. package/src/lib/model/order-shipping-export.js.map +1 -0
  296. package/src/lib/model/order-status-view.d.ts +103 -0
  297. package/src/lib/model/order-status-view.js +156 -0
  298. package/src/lib/model/order-status-view.js.map +1 -0
  299. package/src/lib/model/order-webhooks.d.ts +142 -0
  300. package/src/lib/model/order-webhooks.js +91 -0
  301. package/src/lib/model/order-webhooks.js.map +1 -0
  302. package/src/lib/model/product-channel.d.ts +56 -0
  303. package/src/lib/model/product-channel.js +86 -0
  304. package/src/lib/model/product-channel.js.map +1 -0
  305. package/src/lib/model/product-modifiers.d.ts +80 -0
  306. package/src/lib/model/product-modifiers.js +140 -0
  307. package/src/lib/model/product-modifiers.js.map +1 -0
  308. package/src/lib/model/shippingeasy.d.ts +94 -0
  309. package/src/lib/model/shippingeasy.js +267 -0
  310. package/src/lib/model/shippingeasy.js.map +1 -0
  311. package/src/lib/model/shipstation.d.ts +125 -0
  312. package/src/lib/model/shipstation.js +399 -0
  313. package/src/lib/model/shipstation.js.map +1 -0
  314. package/src/lib/model/smart-collection-reads.d.ts +32 -0
  315. package/src/lib/model/smart-collection-reads.js +63 -0
  316. package/src/lib/model/smart-collection-reads.js.map +1 -0
  317. package/src/lib/model/tracking-url.d.ts +74 -0
  318. package/src/lib/model/tracking-url.js +159 -0
  319. package/src/lib/model/tracking-url.js.map +1 -0
  320. package/src/lib/plugin-config.d.ts +13 -0
  321. package/src/lib/plugin-config.js +77 -5
  322. package/src/lib/plugin-config.js.map +1 -1
  323. package/src/lib/plugin.js +23 -0
  324. package/src/lib/plugin.js.map +1 -1
  325. package/src/lib/pos-ops-config.d.ts +39 -0
  326. package/src/lib/pos-ops-config.js +88 -0
  327. package/src/lib/pos-ops-config.js.map +1 -0
  328. package/src/lib/printing/print-document.d.ts +106 -0
  329. package/src/lib/printing/print-document.js +464 -0
  330. package/src/lib/printing/print-document.js.map +1 -0
  331. package/src/lib/printing/product-labels.d.ts +58 -0
  332. package/src/lib/printing/product-labels.js +116 -0
  333. package/src/lib/printing/product-labels.js.map +1 -0
  334. package/src/lib/printing/render-epson.d.ts +57 -0
  335. package/src/lib/printing/render-epson.js +135 -0
  336. package/src/lib/printing/render-epson.js.map +1 -0
  337. package/src/lib/printing/render-star.d.ts +45 -0
  338. package/src/lib/printing/render-star.js +100 -0
  339. package/src/lib/printing/render-star.js.map +1 -0
  340. package/src/lib/printing/render-text.d.ts +25 -0
  341. package/src/lib/printing/render-text.js +53 -0
  342. package/src/lib/printing/render-text.js.map +1 -0
  343. package/src/lib/server/api-v1/openapi.js +27 -4
  344. package/src/lib/server/api-v1/openapi.js.map +1 -1
  345. package/src/lib/server/api-v1/order-view.d.ts +67 -0
  346. package/src/lib/server/api-v1/order-view.js +120 -0
  347. package/src/lib/server/api-v1/order-view.js.map +1 -0
  348. package/src/lib/server/api-v1/orders-and-products.js +58 -65
  349. package/src/lib/server/api-v1/orders-and-products.js.map +1 -1
  350. package/src/lib/server/billing-webhook.js +135 -28
  351. package/src/lib/server/billing-webhook.js.map +1 -1
  352. package/src/lib/server/cancel-order.js +29 -0
  353. package/src/lib/server/cancel-order.js.map +1 -1
  354. package/src/lib/server/carrier-rates-availability.d.ts +26 -0
  355. package/src/lib/server/carrier-rates-availability.js +76 -0
  356. package/src/lib/server/carrier-rates-availability.js.map +1 -0
  357. package/src/lib/server/carrier-shipping.d.ts +84 -0
  358. package/src/lib/server/carrier-shipping.js +135 -0
  359. package/src/lib/server/carrier-shipping.js.map +1 -0
  360. package/src/lib/server/cart-checkout.d.ts +2 -0
  361. package/src/lib/server/cart-checkout.js +226 -22
  362. package/src/lib/server/cart-checkout.js.map +1 -1
  363. package/src/lib/server/checkout-extras.d.ts +64 -0
  364. package/src/lib/server/checkout-extras.js +157 -0
  365. package/src/lib/server/checkout-extras.js.map +1 -0
  366. package/src/lib/server/{feed.d.ts → checkout-status.d.ts} +2 -7
  367. package/src/lib/server/checkout-status.js +111 -0
  368. package/src/lib/server/checkout-status.js.map +1 -0
  369. package/src/lib/server/checkout.js +86 -9
  370. package/src/lib/server/checkout.js.map +1 -1
  371. package/src/lib/server/draft-order.js +34 -5
  372. package/src/lib/server/draft-order.js.map +1 -1
  373. package/src/lib/server/fulfill-order.d.ts +127 -10
  374. package/src/lib/server/fulfill-order.js +451 -49
  375. package/src/lib/server/fulfill-order.js.map +1 -1
  376. package/src/lib/server/legacy-feed.d.ts +28 -0
  377. package/src/lib/server/legacy-feed.js +52 -0
  378. package/src/lib/server/legacy-feed.js.map +1 -0
  379. package/src/lib/server/native-checkout.d.ts +34 -15
  380. package/src/lib/server/native-checkout.js +32 -17
  381. package/src/lib/server/native-checkout.js.map +1 -1
  382. package/src/lib/server/order-event-host-emit.d.ts +23 -0
  383. package/src/lib/server/order-event-host-emit.js +30 -0
  384. package/src/lib/server/order-event-host-emit.js.map +1 -0
  385. package/src/lib/server/order-event-triggers.d.ts +37 -0
  386. package/src/lib/server/order-event-triggers.js +119 -0
  387. package/src/lib/server/order-event-triggers.js.map +1 -0
  388. package/src/lib/server/order-events.d.ts +62 -0
  389. package/src/lib/server/order-events.js +109 -0
  390. package/src/lib/server/order-events.js.map +1 -0
  391. package/src/lib/server/order-history.d.ts +23 -0
  392. package/src/lib/server/order-history.js +65 -0
  393. package/src/lib/server/order-history.js.map +1 -0
  394. package/src/lib/server/order-notifications.d.ts +185 -0
  395. package/src/lib/server/order-notifications.js +567 -0
  396. package/src/lib/server/order-notifications.js.map +1 -0
  397. package/src/lib/server/order-receipt-send.d.ts +39 -0
  398. package/src/lib/server/order-receipt-send.js +151 -0
  399. package/src/lib/server/order-receipt-send.js.map +1 -0
  400. package/src/lib/server/order-status-token.d.ts +31 -0
  401. package/src/lib/server/order-status-token.js +75 -0
  402. package/src/lib/server/order-status-token.js.map +1 -0
  403. package/src/lib/server/order-status.d.ts +58 -0
  404. package/src/lib/server/order-status.js +141 -0
  405. package/src/lib/server/order-status.js.map +1 -0
  406. package/src/lib/server/order-webhooks.d.ts +108 -0
  407. package/src/lib/server/order-webhooks.js +622 -0
  408. package/src/lib/server/order-webhooks.js.map +1 -0
  409. package/src/lib/server/orders-shipping-prepare.d.ts +26 -0
  410. package/src/lib/server/orders-shipping-prepare.js +121 -0
  411. package/src/lib/server/orders-shipping-prepare.js.map +1 -0
  412. package/src/lib/server/payment-method-domains.d.ts +209 -0
  413. package/src/lib/server/payment-method-domains.js +444 -0
  414. package/src/lib/server/payment-method-domains.js.map +1 -0
  415. package/src/lib/server/payment-methods.d.ts +77 -0
  416. package/src/lib/server/payment-methods.js +284 -0
  417. package/src/lib/server/payment-methods.js.map +1 -0
  418. package/src/lib/server/pos-auth.d.ts +50 -0
  419. package/src/lib/server/pos-auth.js +121 -0
  420. package/src/lib/server/pos-auth.js.map +1 -0
  421. package/src/lib/server/pos-customer.d.ts +49 -0
  422. package/src/lib/server/pos-customer.js +257 -0
  423. package/src/lib/server/pos-customer.js.map +1 -0
  424. package/src/lib/server/pos-display.d.ts +57 -0
  425. package/src/lib/server/pos-display.js +419 -0
  426. package/src/lib/server/pos-display.js.map +1 -0
  427. package/src/lib/server/pos-fee-month.d.ts +34 -0
  428. package/src/lib/server/pos-fee-month.js +36 -0
  429. package/src/lib/server/pos-fee-month.js.map +1 -0
  430. package/src/lib/server/pos-ops-gate.d.ts +161 -0
  431. package/src/lib/server/pos-ops-gate.js +295 -0
  432. package/src/lib/server/pos-ops-gate.js.map +1 -0
  433. package/src/lib/server/pos-ops-routes.d.ts +22 -0
  434. package/src/lib/server/pos-ops-routes.js +36 -0
  435. package/src/lib/server/pos-ops-routes.js.map +1 -0
  436. package/src/lib/server/pos-order.d.ts +1 -18
  437. package/src/lib/server/pos-order.js +222 -42
  438. package/src/lib/server/pos-order.js.map +1 -1
  439. package/src/lib/server/pos-payment.d.ts +39 -0
  440. package/src/lib/server/pos-payment.js +922 -0
  441. package/src/lib/server/pos-payment.js.map +1 -0
  442. package/src/lib/server/pos-print.d.ts +82 -0
  443. package/src/lib/server/pos-print.js +193 -0
  444. package/src/lib/server/pos-print.js.map +1 -0
  445. package/src/lib/server/pos-readers.d.ts +27 -0
  446. package/src/lib/server/pos-readers.js +276 -0
  447. package/src/lib/server/pos-readers.js.map +1 -0
  448. package/src/lib/server/pos-refund-authority.d.ts +60 -0
  449. package/src/lib/server/pos-refund-authority.js +72 -0
  450. package/src/lib/server/pos-refund-authority.js.map +1 -0
  451. package/src/lib/server/pos-return.d.ts +58 -0
  452. package/src/lib/server/pos-return.js +891 -0
  453. package/src/lib/server/pos-return.js.map +1 -0
  454. package/src/lib/server/pos-sale-stamp.d.ts +66 -0
  455. package/src/lib/server/pos-sale-stamp.js +84 -0
  456. package/src/lib/server/pos-sale-stamp.js.map +1 -0
  457. package/src/lib/server/pos-sale.d.ts +170 -0
  458. package/src/lib/server/pos-sale.js +461 -0
  459. package/src/lib/server/pos-sale.js.map +1 -0
  460. package/src/lib/server/pos-shift.d.ts +45 -0
  461. package/src/lib/server/pos-shift.js +484 -0
  462. package/src/lib/server/pos-shift.js.map +1 -0
  463. package/src/lib/server/pos-staff-pin.d.ts +26 -0
  464. package/src/lib/server/pos-staff-pin.js +339 -0
  465. package/src/lib/server/pos-staff-pin.js.map +1 -0
  466. package/src/lib/server/pos-stripe.d.ts +91 -0
  467. package/src/lib/server/pos-stripe.js +129 -0
  468. package/src/lib/server/pos-stripe.js.map +1 -0
  469. package/src/lib/server/pos-terminal-connection-token.d.ts +48 -0
  470. package/src/lib/server/pos-terminal-connection-token.js +166 -0
  471. package/src/lib/server/pos-terminal-connection-token.js.map +1 -0
  472. package/src/lib/server/pos-terminal.d.ts +218 -0
  473. package/src/lib/server/pos-terminal.js +1014 -0
  474. package/src/lib/server/pos-terminal.js.map +1 -0
  475. package/src/lib/server/print-queue.d.ts +124 -0
  476. package/src/lib/server/print-queue.js +301 -0
  477. package/src/lib/server/print-queue.js.map +1 -0
  478. package/src/lib/server/printer-poll.d.ts +75 -0
  479. package/src/lib/server/printer-poll.js +325 -0
  480. package/src/lib/server/printer-poll.js.map +1 -0
  481. package/src/lib/server/printer-secret.d.ts +39 -0
  482. package/src/lib/server/printer-secret.js +56 -0
  483. package/src/lib/server/printer-secret.js.map +1 -0
  484. package/src/lib/server/printers.d.ts +114 -0
  485. package/src/lib/server/printers.js +546 -0
  486. package/src/lib/server/printers.js.map +1 -0
  487. package/src/lib/server/product-ai-capability.d.ts +42 -0
  488. package/src/lib/server/product-ai-capability.js +159 -0
  489. package/src/lib/server/product-ai-capability.js.map +1 -0
  490. package/src/lib/server/product-catalog.d.ts +42 -0
  491. package/src/lib/server/product-catalog.js +305 -0
  492. package/src/lib/server/product-catalog.js.map +1 -0
  493. package/src/lib/server/product-drafts.d.ts +119 -0
  494. package/src/lib/server/product-drafts.js +384 -0
  495. package/src/lib/server/product-drafts.js.map +1 -0
  496. package/src/lib/server/refund.js +110 -45
  497. package/src/lib/server/refund.js.map +1 -1
  498. package/src/lib/server/reserve.js +2 -0
  499. package/src/lib/server/reserve.js.map +1 -1
  500. package/src/lib/server/return-status-action.d.ts +37 -0
  501. package/src/lib/server/return-status-action.js +57 -0
  502. package/src/lib/server/return-status-action.js.map +1 -0
  503. package/src/lib/server/returns.d.ts +119 -0
  504. package/src/lib/server/returns.js +938 -0
  505. package/src/lib/server/returns.js.map +1 -0
  506. package/src/lib/server/shipment-records.d.ts +36 -0
  507. package/src/lib/server/shipment-records.js +289 -0
  508. package/src/lib/server/shipment-records.js.map +1 -0
  509. package/src/lib/server/shipping-connector-gates.d.ts +40 -0
  510. package/src/lib/server/shipping-connector-gates.js +97 -0
  511. package/src/lib/server/shipping-connector-gates.js.map +1 -0
  512. package/src/lib/server/shipping-connectors.d.ts +29 -0
  513. package/src/lib/server/shipping-connectors.js +236 -0
  514. package/src/lib/server/shipping-connectors.js.map +1 -0
  515. package/src/lib/server/shippingeasy.d.ts +238 -0
  516. package/src/lib/server/shippingeasy.js +787 -0
  517. package/src/lib/server/shippingeasy.js.map +1 -0
  518. package/src/lib/server/shipstation.d.ts +129 -0
  519. package/src/lib/server/shipstation.js +483 -0
  520. package/src/lib/server/shipstation.js.map +1 -0
  521. package/src/lib/server/site-page-resolver.d.ts +5 -0
  522. package/src/lib/server/site-page-resolver.js +156 -1
  523. package/src/lib/server/site-page-resolver.js.map +1 -1
  524. package/src/lib/server/stock-levels.d.ts +21 -0
  525. package/src/lib/server/stock-levels.js +263 -0
  526. package/src/lib/server/stock-levels.js.map +1 -0
  527. package/src/lib/server/stripe-refund.d.ts +47 -0
  528. package/src/lib/server/stripe-refund.js +87 -0
  529. package/src/lib/server/stripe-refund.js.map +1 -0
  530. package/src/lib/server/supplier-update.js +46 -5
  531. package/src/lib/server/supplier-update.js.map +1 -1
  532. package/src/lib/server/tax-engine-quote.d.ts +47 -0
  533. package/src/lib/server/tax-engine-quote.js +105 -0
  534. package/src/lib/server/tax-engine-quote.js.map +1 -0
  535. package/src/lib/server.js +146 -2
  536. package/src/lib/server.js.map +1 -1
  537. package/src/lib/site.js +12 -0
  538. package/src/lib/site.js.map +1 -1
  539. package/src/lib/subprocessors.d.ts +26 -0
  540. package/src/lib/subprocessors.js +50 -0
  541. package/src/lib/subprocessors.js.map +1 -0
  542. package/src/lib/tenant-emails.js +461 -3
  543. package/src/lib/tenant-emails.js.map +1 -1
  544. package/src/lib/testing/fake-firestore.d.ts +45 -0
  545. package/src/lib/testing/fake-firestore.js +189 -0
  546. package/src/lib/testing/fake-firestore.js.map +1 -0
  547. package/src/lib/testing/memory-firestore.d.ts +123 -0
  548. package/src/lib/testing/memory-firestore.js +274 -0
  549. package/src/lib/testing/memory-firestore.js.map +1 -0
  550. package/src/lib/testing/pos-ops-harness.d.ts +50 -0
  551. package/src/lib/testing/pos-ops-harness.js +184 -0
  552. package/src/lib/testing/pos-ops-harness.js.map +1 -0
  553. package/src/lib/testing/pos-ops-memory-firestore.d.ts +55 -0
  554. package/src/lib/testing/pos-ops-memory-firestore.js +376 -0
  555. package/src/lib/testing/pos-ops-memory-firestore.js.map +1 -0
  556. package/src/lib/transfer/records-transfer.d.ts +11 -1
  557. package/src/lib/transfer/records-transfer.js +127 -5
  558. package/src/lib/transfer/records-transfer.js.map +1 -1
  559. package/src/lib/transfer/records.server.d.ts +9 -2
  560. package/src/lib/transfer/records.server.js +58 -7
  561. package/src/lib/transfer/records.server.js.map +1 -1
  562. package/src/lib/transfer/register-transfer-resources.js +40 -1
  563. package/src/lib/transfer/register-transfer-resources.js.map +1 -1
  564. package/src/lib/transfer/register-transfer-ui.js +4 -1
  565. package/src/lib/transfer/register-transfer-ui.js.map +1 -1
  566. package/src/lib/transfer/shipping-presets.d.ts +23 -0
  567. package/src/lib/transfer/shipping-presets.js +156 -0
  568. package/src/lib/transfer/shipping-presets.js.map +1 -0
  569. package/src/lib/transfer/tracking-transfer.d.ts +101 -0
  570. package/src/lib/transfer/tracking-transfer.js +546 -0
  571. package/src/lib/transfer/tracking-transfer.js.map +1 -0
  572. package/src/lib/transfer/tracking.server.d.ts +37 -0
  573. package/src/lib/transfer/tracking.server.js +393 -0
  574. package/src/lib/transfer/tracking.server.js.map +1 -0
  575. package/src/lib/transfer/transfer-keys.d.ts +2 -1
  576. package/src/lib/transfer/transfer-keys.js +6 -2
  577. package/src/lib/transfer/transfer-keys.js.map +1 -1
  578. package/src/lib/utils/code128.d.ts +37 -0
  579. package/src/lib/utils/code128.js +199 -0
  580. package/src/lib/utils/code128.js.map +1 -0
  581. package/src/lib/utils/order-invoice.d.ts +55 -0
  582. package/src/lib/utils/order-invoice.js +127 -0
  583. package/src/lib/utils/order-invoice.js.map +1 -0
  584. package/src/lib/utils/use-checkout-return-notice.d.ts +34 -0
  585. package/src/lib/utils/use-checkout-return-notice.js +78 -0
  586. package/src/lib/utils/use-checkout-return-notice.js.map +1 -0
  587. package/src/lib/utils/use-storefront-purchase-event.js +4 -0
  588. package/src/lib/utils/use-storefront-purchase-event.js.map +1 -1
  589. package/src/lib/server/feed.js +0 -69
  590. package/src/lib/server/feed.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/printers.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 * as Aglyn from '@aglyn/aglyn/server'\nimport type { PluginApiHandler, PluginApiRequest } from '@aglyn/aglyn/server'\nimport { createResourceUid } from '@aglyn/aglyn/app-utils/create-resource-uid'\nimport { resolveSiteTimeZone } from '@aglyn/aglyn/app-utils/collection-entry-date'\nimport { firebaseAdmin, getOrgForHost } from '@aglyn/tenant-data-admin'\nimport { resolveOrgPermissions } from '@aglyn/tenant-runtime/org-permissions'\nimport {\n normalizePrinterDeviceId,\n PRINTER_BRANDS,\n type PosPrinter,\n type PrinterBrand,\n type PrintReport,\n} from '../model/commerce-printers'\nimport { receiptDataFromOrder, type ReceiptData } from '../model/commerce-receipt'\nimport type { HostOrder } from '../model/commerce-orders'\nimport { enqueuePrintJob, printJobsRef, printersRef } from './print-queue'\nimport { printerPollUrl } from './printer-secret'\nimport { isRefusedIdToken } from '@aglyn/tenant-data-admin/server/id-token-refusal'\n\n/**\n * `POST /api/commerce/printers` (AGL-3619): a register's cloud receipt\n * printers, from the Hardware card, and the jobs a manager sends them by hand\n * (a test page, a reprint, \"open drawer\").\n *\n * Every write to `printers` and `printJobs` is here or in the poll routes:\n * the Firestore rules deny both to every client, so a printer's identity, its\n * secret's version and its queue cannot be edited around this gate.\n */\n\n/** A counter seldom has more than two; the cap keeps a typo loop from minting dozens. */\nexport const MAX_PRINTERS_PER_REGISTER = 4\n\ninterface PrinterManager {\n uid: string\n hostId: string\n}\n\n/**\n * The register's gate (`pos-order.ts`): `admin` or `editor` on THIS site,\n * `managePos` on the member's permissions, and `pos` on the owning plan.\n */\nexport async function authorizePrinterManager(\n req: PluginApiRequest,\n hostId: string,\n): Promise<{ ok: true; manager: PrinterManager } | { ok: false; status: number; error: string }> {\n const authorization = String(req.headers.authorization ?? '')\n const idToken = authorization.startsWith('Bearer ') ? authorization.slice(7) : ''\n if (!idToken) return { ok: false, status: 401, error: 'Unauthenticated' }\n if (!/^[A-Za-z0-9_-]{1,128}$/.test(hostId)) return { ok: false, status: 400, error: 'Missing hostId' }\n let uid: string\n try {\n uid = (await firebaseAdmin.app().auth().verifyIdToken(idToken)).uid\n } catch (error) {\n if (!isRefusedIdToken(error)) throw error\n return { ok: false, status: 401, error: 'Unauthenticated' }\n }\n const host = await firebaseAdmin.app().firestore().collection('hosts').doc(hostId).get()\n if (!host.exists) return { ok: false, status: 404, error: 'Unknown site' }\n const role = (host.get('memberRoles') ?? {})[uid]\n if (role !== 'admin' && role !== 'editor') return { ok: false, status: 403, error: 'Not permitted' }\n const membership = await resolveOrgPermissions(uid, { hostId })\n if (!membership.permissions.managePos) return { ok: false, status: 403, error: 'Not permitted' }\n const owner = await getOrgForHost(hostId)\n if (!Aglyn.checkEntitlement(owner?.org as any, 'pos')) {\n return { ok: false, status: 403, error: 'POS requires the Pro plan or above' }\n }\n return { ok: true, manager: { uid, hostId } }\n}\n\nfunction requestBody(req: PluginApiRequest): Record<string, any> {\n if (typeof req.body === 'string') {\n try {\n const parsed = JSON.parse(req.body)\n return parsed && typeof parsed === 'object' ? parsed : {}\n } catch {\n return {}\n }\n }\n return req.body && typeof req.body === 'object' ? req.body : {}\n}\n\nconst text = (value: unknown, max: number): string => String(value ?? '').trim().slice(0, max)\n\n/** The editable settings in a create or update body, validated. */\nexport function printerSettingsFromBody(\n body: Record<string, any>,\n brand: PrinterBrand,\n): { ok: true; patch: Partial<PosPrinter> } | { ok: false; error: string } {\n const patch: Partial<PosPrinter> = {}\n if ('name' in body) {\n const name = text(body['name'], 60)\n if (!name) return { ok: false, error: 'Name the printer' }\n patch.name = name\n }\n if ('model' in body) patch.model = text(body['model'], 40)\n if ('deviceId' in body) {\n const deviceId = normalizePrinterDeviceId(brand, body['deviceId'])\n if (!deviceId) {\n return {\n ok: false,\n error:\n brand === 'star'\n ? 'Enter the printer’s MAC address, e.g. 00:11:62:12:34:56'\n : 'Enter the Server Direct Print ID: 1-30 letters, digits, dots, dashes or underscores',\n }\n }\n patch.deviceId = deviceId\n }\n if ('paperWidthMm' in body) patch.paperWidthMm = Number(body['paperWidthMm']) === 58 ? 58 : 80\n if ('autoPrintReceipts' in body) patch.autoPrintReceipts = body['autoPrintReceipts'] === true\n if ('kickDrawer' in body) patch.kickDrawer = body['kickDrawer'] === true\n if ('kitchenTickets' in body) patch.kitchenTickets = body['kitchenTickets'] === true\n if ('logoKey' in body) {\n const logoKey = text(body['logoKey'], 10)\n const valid =\n !logoKey ||\n (brand === 'star'\n ? /^\\d{1,3}$/.test(logoKey) && Number(logoKey) >= 1 && Number(logoKey) <= 255\n : /^\\d{2,3}\\s*,\\s*\\d{2,3}$/.test(logoKey))\n if (!valid) {\n return {\n ok: false,\n error:\n brand === 'star'\n ? 'The logo number is 1-255, as stored with Star Quick Setup Utility'\n : 'The logo key is two numbers, e.g. 48,48, as stored with Epson TM Utility',\n }\n }\n patch.logoKey = logoKey.replace(/\\s+/g, '')\n }\n return { ok: true, patch }\n}\n\n/** What the card shows a manager to paste into the printer's web configuration. */\nexport function printerCredentials(hostId: string, printerId: string, printer: PosPrinter) {\n return {\n printerId,\n brand: printer.brand,\n pollUrl: printerPollUrl(printer.brand, hostId, printerId, printer.secretVersion),\n deviceId: printer.deviceId,\n }\n}\n\n/** What a receipt needs from the site, the location and the register. */\nexport async function receiptContextFor(\n hostId: string,\n order: Pick<HostOrder, 'locationId'> & { registerId?: string },\n firestore: any = firebaseAdmin.app().firestore(),\n) {\n const hostRef = firestore.collection('hosts').doc(hostId)\n const [host, owner, location, register] = await Promise.all([\n hostRef.get(),\n getOrgForHost(hostId).catch(() => null),\n order.locationId ? hostRef.collection('locations').doc(order.locationId).get() : null,\n order.registerId ? hostRef.collection('registers').doc(order.registerId).get() : null,\n ])\n const storeLines = [location?.get?.('address')].filter(Boolean).map(String)\n return {\n storeName: String(host.get('displayName') ?? host.get('subdomain') ?? 'Receipt'),\n ...(storeLines.length ? { storeLines } : {}),\n ...(register?.exists ? { registerName: String(register.get('name') ?? '') } : {}),\n timeZone: resolveSiteTimeZone(owner?.org as any, host.data?.() ?? {}),\n }\n}\n\n/** The receipt an order prints, with the site's name, address and time zone. */\nexport async function orderReceipt(\n hostId: string,\n orderId: string,\n order: HostOrder & Record<string, any>,\n options: { banner?: string; firestore?: any } = {},\n): Promise<ReceiptData> {\n const context = await receiptContextFor(hostId, order, options.firestore)\n return receiptDataFromOrder(orderId, order, {\n ...context,\n ...(options.banner ? { banner: options.banner } : {}),\n })\n}\n\n/**\n * Queues work for a register's printers (AGL-3619): a receipt for every\n * printer set to auto-print, and a drawer kick on the FIRST printer set to\n * kick the drawer (a till has one drawer; two kicks would be one too many).\n * When the receipt printer is also the drawer printer, the kick rides the\n * receipt job so the drawer opens as the receipt starts.\n *\n * `kitchenTicket` prints on every printer set to print kitchen tickets, and\n * only when asked for: a Z-report or a paid-out slip is not an order to make.\n *\n * `receiptChoice` is what the customer said at the register: `none` (or a\n * receipt sent by email or text) prints no customer receipt; `print` prints\n * one even when no printer auto-prints, on the register's first printer.\n * Absent, the printers' own \"every sale\" setting decides.\n *\n * `idempotencyKey` names the cause (a sale's order id, a shift event's id): a\n * cause delivered twice queues its jobs once.\n */\nexport async function queueRegisterPrint(input: {\n hostId: string\n registerId: string\n receipt?: ReceiptData\n /** A shift report (AGL-3609): printed once, on the register's receipt printer. */\n report?: PrintReport\n kitchenTicket?: ReceiptData\n receiptChoice?: 'print' | 'none'\n openDrawer?: boolean\n orderId?: string\n reason: string\n idempotencyKey?: string\n createdBy?: string\n firestore?: any\n nowMs?: number\n}): Promise<{ jobIds: string[] }> {\n const firestore = input.firestore ?? firebaseAdmin.app().firestore()\n if (!input.registerId) return { jobIds: [] }\n const snapshot = await printersRef(firestore, input.hostId)\n .where('registerId', '==', input.registerId)\n .limit(MAX_PRINTERS_PER_REGISTER)\n .get()\n const printers = snapshot.docs\n .map((doc: any) => ({ id: doc.id, printer: doc.data() as PosPrinter }))\n .sort((a: any, b: any) => a.printer.createdAtMs - b.printer.createdAtMs || a.id.localeCompare(b.id))\n const drawerPrinter = input.openDrawer\n ? printers.find((entry: any) => entry.printer.kickDrawer)\n : undefined\n const jobIds: string[] = []\n const key = (suffix: string) =>\n input.idempotencyKey\n ? `${input.reason}-${input.idempotencyKey}-${suffix}`.replace(/[^A-Za-z0-9_-]/g, '').slice(0, 120)\n : undefined\n let drawerHandled = false\n const receiptPrinters =\n input.receiptChoice === 'none'\n ? []\n : printers.filter((entry: any) => entry.printer.autoPrintReceipts)\n if (input.receiptChoice === 'print' && !receiptPrinters.length && printers.length) {\n receiptPrinters.push(printers[0])\n }\n if (input.receipt) {\n for (const entry of receiptPrinters) {\n const openDrawer = drawerPrinter?.id === entry.id\n drawerHandled ||= openDrawer\n const { jobId } = await enqueuePrintJob(\n firestore,\n input.hostId,\n entry.id,\n {\n kind: 'receipt',\n receipt: input.receipt,\n openDrawer,\n orderId: input.orderId,\n registerId: input.registerId,\n reason: input.reason,\n createdBy: input.createdBy,\n jobId: key(entry.id),\n },\n input.nowMs,\n )\n jobIds.push(jobId)\n }\n }\n if (input.report) {\n // One copy, on the printer that prints receipts — or the till's only one.\n const target = printers.find((entry: any) => entry.printer.autoPrintReceipts) ?? printers[0]\n if (target) {\n const { jobId } = await enqueuePrintJob(\n firestore,\n input.hostId,\n target.id,\n {\n kind: 'report',\n report: input.report,\n registerId: input.registerId,\n reason: input.reason,\n createdBy: input.createdBy,\n jobId: key(`${target.id}-report`),\n },\n input.nowMs,\n )\n jobIds.push(jobId)\n }\n }\n if (input.kitchenTicket) {\n for (const entry of printers) {\n if (!entry.printer.kitchenTickets) continue\n const { jobId } = await enqueuePrintJob(\n firestore,\n input.hostId,\n entry.id,\n {\n kind: 'kitchen',\n receipt: input.kitchenTicket,\n orderId: input.orderId,\n registerId: input.registerId,\n reason: input.reason,\n createdBy: input.createdBy,\n jobId: key(`${entry.id}-kitchen`),\n },\n input.nowMs,\n )\n jobIds.push(jobId)\n }\n }\n if (drawerPrinter && !drawerHandled) {\n const { jobId } = await enqueuePrintJob(\n firestore,\n input.hostId,\n drawerPrinter.id,\n {\n kind: 'drawer',\n orderId: input.orderId,\n registerId: input.registerId,\n reason: input.reason,\n createdBy: input.createdBy,\n jobId: key(`${drawerPrinter.id}-drawer`),\n },\n input.nowMs,\n )\n jobIds.push(jobId)\n }\n return { jobIds }\n}\n\nexport const printersHandler: PluginApiHandler = async (req, res) => {\n if (req.method !== 'POST') return res.status(405).json({ error: 'Method not allowed' })\n const body = requestBody(req)\n const hostId = text(body['hostId'], 128)\n const gate = await authorizePrinterManager(req, hostId)\n if ('error' in gate) return res.status(gate.status).json({ error: gate.error })\n const { uid } = gate.manager\n const firestore = firebaseAdmin.app().firestore()\n const printers = printersRef(firestore, hostId)\n const action = text(body['action'], 20)\n const printerId = text(body['printerId'], 128)\n const loadPrinter = async () => {\n if (!/^[A-Za-z0-9_-]{1,128}$/.test(printerId)) return null\n const snapshot = await printers.doc(printerId).get()\n return snapshot.exists ? { ref: snapshot.ref, printer: snapshot.data() as PosPrinter } : null\n }\n try {\n switch (action) {\n case 'create': {\n const brand = text(body['brand'], 10) as PrinterBrand\n if (!PRINTER_BRANDS.includes(brand)) return res.status(400).json({ error: 'Choose Star or Epson' })\n const registerId = text(body['registerId'], 128)\n const register = /^[A-Za-z0-9_-]{1,128}$/.test(registerId)\n ? await firestore.collection('hosts').doc(hostId).collection('registers').doc(registerId).get()\n : null\n if (!register?.exists) return res.status(404).json({ error: 'Unknown register' })\n const settings = printerSettingsFromBody(\n { name: '', deviceId: '', ...body },\n brand,\n )\n if ('error' in settings) return res.status(400).json({ error: settings.error })\n const siblings = await printers.where('registerId', '==', registerId).limit(MAX_PRINTERS_PER_REGISTER).get()\n if (siblings.size >= MAX_PRINTERS_PER_REGISTER) {\n return res.status(409).json({\n error: `A register can have up to ${MAX_PRINTERS_PER_REGISTER} printers.`,\n })\n }\n const duplicate = await printers.where('deviceId', '==', settings.patch.deviceId).limit(1).get()\n if (!duplicate.empty) {\n return res.status(409).json({ error: 'That printer is already added to this site.' })\n }\n const ref = printers.doc(createResourceUid())\n const printer: PosPrinter = {\n name: settings.patch.name!,\n brand,\n model: settings.patch.model ?? '',\n deviceId: settings.patch.deviceId!,\n registerId,\n paperWidthMm: settings.patch.paperWidthMm ?? 80,\n autoPrintReceipts: settings.patch.autoPrintReceipts ?? true,\n kickDrawer: settings.patch.kickDrawer ?? false,\n kitchenTickets: settings.patch.kitchenTickets ?? false,\n ...(settings.patch.logoKey ? { logoKey: settings.patch.logoKey } : {}),\n secretVersion: 1,\n createdAtMs: Date.now(),\n createdBy: uid,\n }\n await ref.set(printer)\n return res.status(200).json(printerCredentials(hostId, ref.id, printer))\n }\n case 'update': {\n const loaded = await loadPrinter()\n if (!loaded) return res.status(404).json({ error: 'Unknown printer' })\n const settings = printerSettingsFromBody(body, loaded.printer.brand)\n if ('error' in settings) return res.status(400).json({ error: settings.error })\n if (settings.patch.deviceId && settings.patch.deviceId !== loaded.printer.deviceId) {\n const duplicate = await printers.where('deviceId', '==', settings.patch.deviceId).limit(1).get()\n if (!duplicate.empty) {\n return res.status(409).json({ error: 'That printer is already added to this site.' })\n }\n }\n await loaded.ref.set({ ...settings.patch, updatedAtMs: Date.now() }, { merge: true })\n return res.status(200).json({ ok: true })\n }\n case 'remove': {\n const loaded = await loadPrinter()\n if (!loaded) return res.status(200).json({ ok: true })\n const active = await printJobsRef(firestore, hostId)\n .where('printerId', '==', printerId)\n .where('status', 'in', ['queued', 'printing'])\n .orderBy('createdAtMs', 'asc')\n .limit(50)\n .get()\n const batch = firestore.batch()\n for (const doc of active.docs) {\n batch.update(doc.ref, { status: 'canceled', finishedAtMs: Date.now() })\n }\n batch.delete(loaded.ref)\n await batch.commit()\n return res.status(200).json({ ok: true })\n }\n case 'credentials': {\n const loaded = await loadPrinter()\n if (!loaded) return res.status(404).json({ error: 'Unknown printer' })\n return res.status(200).json(printerCredentials(hostId, printerId, loaded.printer))\n }\n case 'regenerate': {\n const loaded = await loadPrinter()\n if (!loaded) return res.status(404).json({ error: 'Unknown printer' })\n const secretVersion = Math.max(1, Number(loaded.printer.secretVersion) || 1) + 1\n await loaded.ref.set({ secretVersion, updatedAtMs: Date.now() }, { merge: true })\n return res\n .status(200)\n .json(printerCredentials(hostId, printerId, { ...loaded.printer, secretVersion }))\n }\n case 'test':\n case 'drawer': {\n const loaded = await loadPrinter()\n if (!loaded) return res.status(404).json({ error: 'Unknown printer' })\n const context = action === 'test' ? await receiptContextFor(hostId, {}, firestore) : null\n const { jobId } = await enqueuePrintJob(firestore, hostId, printerId, {\n kind: action,\n registerId: loaded.printer.registerId,\n reason: action === 'test' ? 'test' : 'open_drawer',\n createdBy: uid,\n ...(context ? { storeName: context.storeName, timeZone: context.timeZone } : {}),\n ...(action === 'test' && body['openDrawer'] === true ? { openDrawer: true } : {}),\n })\n return res.status(200).json({ jobId })\n }\n case 'reprint': {\n const orderId = text(body['orderId'], 128)\n if (!/^[A-Za-z0-9_-]{1,128}$/.test(orderId)) return res.status(400).json({ error: 'Missing orderId' })\n const orderSnapshot = await firestore.collection('hosts').doc(hostId).collection('orders').doc(orderId).get()\n if (!orderSnapshot.exists) return res.status(404).json({ error: 'Unknown order' })\n const order = orderSnapshot.data() as HostOrder & Record<string, any>\n let target = printerId ? await loadPrinter() : null\n if (!target && order['registerId']) {\n const candidates = await printers\n .where('registerId', '==', String(order['registerId']))\n .limit(MAX_PRINTERS_PER_REGISTER)\n .get()\n const doc = candidates.docs.find((d: any) => d.get('autoPrintReceipts')) ?? candidates.docs[0]\n if (doc) target = { ref: doc.ref, printer: doc.data() as PosPrinter }\n }\n if (!target) return res.status(404).json({ error: 'No printer for this register' })\n const receipt = await orderReceipt(hostId, orderId, order, { banner: 'REPRINT', firestore })\n const { jobId } = await enqueuePrintJob(firestore, hostId, target.ref.id, {\n kind: 'receipt',\n receipt,\n orderId,\n registerId: target.printer.registerId,\n reason: 'reprint',\n createdBy: uid,\n })\n return res.status(200).json({ jobId })\n }\n case 'cancel': {\n const jobId = text(body['jobId'], 128)\n if (!/^[A-Za-z0-9_-]{1,128}$/.test(jobId)) return res.status(400).json({ error: 'Missing jobId' })\n const ref = printJobsRef(firestore, hostId).doc(jobId)\n const outcome = await firestore.runTransaction(async (transaction: any) => {\n const snapshot = await transaction.get(ref)\n if (!snapshot.exists) return 'missing'\n if (snapshot.get('status') !== 'queued') return 'started'\n transaction.update(ref, { status: 'canceled', finishedAtMs: Date.now() })\n return 'canceled'\n })\n if (outcome === 'missing') return res.status(404).json({ error: 'Unknown job' })\n if (outcome === 'started') {\n return res.status(409).json({ error: 'The printer already has it.' })\n }\n return res.status(200).json({ ok: true })\n }\n default:\n return res.status(400).json({ error: 'Unknown action' })\n }\n } catch (error) {\n console.error('[printers]', action, error)\n return res.status(500).json({ error: 'The printer could not be updated' })\n }\n}\n"],"names":["Aglyn","createResourceUid","resolveSiteTimeZone","firebaseAdmin","getOrgForHost","resolveOrgPermissions","normalizePrinterDeviceId","PRINTER_BRANDS","receiptDataFromOrder","enqueuePrintJob","printJobsRef","printersRef","printerPollUrl","isRefusedIdToken","MAX_PRINTERS_PER_REGISTER","authorizePrinterManager","req","hostId","host","authorization","String","headers","idToken","startsWith","slice","ok","status","error","test","uid","app","auth","verifyIdToken","firestore","collection","doc","get","exists","role","membership","permissions","managePos","owner","checkEntitlement","org","manager","requestBody","body","parsed","JSON","parse","text","value","max","trim","printerSettingsFromBody","brand","patch","name","model","deviceId","paperWidthMm","Number","autoPrintReceipts","kickDrawer","kitchenTickets","logoKey","valid","replace","printerCredentials","printerId","printer","pollUrl","secretVersion","receiptContextFor","order","register","location","hostRef","Promise","all","catch","locationId","registerId","storeLines","filter","Boolean","map","storeName","length","registerName","timeZone","data","orderReceipt","orderId","options","context","banner","queueRegisterPrint","input","jobIds","snapshot","where","limit","printers","docs","id","sort","a","b","createdAtMs","localeCompare","drawerPrinter","openDrawer","find","entry","undefined","key","suffix","idempotencyKey","reason","drawerHandled","receiptPrinters","receiptChoice","push","receipt","jobId","kind","createdBy","nowMs","report","target","kitchenTicket","printersHandler","res","method","json","gate","action","loadPrinter","ref","settings","includes","siblings","size","duplicate","empty","Date","now","set","loaded","updatedAtMs","merge","active","orderBy","batch","update","finishedAtMs","delete","commit","Math","orderSnapshot","candidates","d","outcome","runTransaction","transaction","console"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,sBAAqB;AAE5C,SAASC,iBAAiB,QAAQ,6CAA4C;AAC9E,SAASC,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,aAAa,EAAEC,aAAa,QAAQ,2BAA0B;AACvE,SAASC,qBAAqB,QAAQ,wCAAuC;AAC7E,SACEC,wBAAwB,EACxBC,cAAc,QAIT,gCAA4B;AACnC,SAASC,oBAAoB,QAA0B,+BAA2B;AAElF,SAASC,eAAe,EAAEC,YAAY,EAAEC,WAAW,QAAQ,mBAAe;AAC1E,SAASC,cAAc,QAAQ,sBAAkB;AACjD,SAASC,gBAAgB,QAAQ,mDAAkD;AAEnF;;;;;;;;CAQC,GAED,uFAAuF,GACvF,OAAO,MAAMC,4BAA4B,EAAC;AAO1C;;;CAGC,GACD,OAAO,eAAeC,wBACpBC,GAAqB,EACrBC,MAAc;QAEeD,4BAafE;IAbd,MAAMC,gBAAgBC,QAAOJ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AE7G,OAAO;oBAAgB;oBAChG,MAAMiH,MAAMlI,aAAauB,WAAWhB,QAAQkB,GAAG,CAAC2F;oBAChD,MAAMsC,UAAU,MAAMnI,UAAUoI,cAAc,CAAC,OAAOC;wBACpD,MAAMjE,WAAW,MAAMiE,YAAYlI,GAAG,CAACwG;wBACvC,IAAI,CAACvC,SAAShE,MAAM,EAAE,OAAO;wBAC7B,IAAIgE,SAASjE,GAAG,CAAC,cAAc,UAAU,OAAO;wBAChDkI,YAAYV,MAAM,CAAChB,KAAK;4BAAElH,QAAQ;4BAAYmI,cAAcV,KAAKC,GAAG;wBAAG;wBACvE,OAAO;oBACT;oBACA,IAAIgB,YAAY,WAAW,OAAO9B,IAAI5G,MAAM,CAAC,KAAK8G,IAAI,CAAC;wBAAE7G,OAAO;oBAAc;oBAC9E,IAAIyI,YAAY,WAAW;wBACzB,OAAO9B,IAAI5G,MAAM,CAAC,KAAK8G,IAAI,CAAC;4BAAE7G,OAAO;wBAA8B;oBACrE;oBACA,OAAO2G,IAAI5G,MAAM,CAAC,KAAK8G,IAAI,CAAC;wBAAE/G,IAAI;oBAAK;gBACzC;YACA;gBACE,OAAO6G,IAAI5G,MAAM,CAAC,KAAK8G,IAAI,CAAC;oBAAE7G,OAAO;gBAAiB;QAC1D;IACF,EAAE,OAAOA,OAAO;QACd4I,QAAQ5I,KAAK,CAAC,cAAc+G,QAAQ/G;QACpC,OAAO2G,IAAI5G,MAAM,CAAC,KAAK8G,IAAI,CAAC;YAAE7G,OAAO;QAAmC;IAC1E;AACF,EAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type PluginAiCapability, type PluginAiCapabilityArgs } from '@aglyn/aglyn/plugin-manager/plugin-ai-capabilities';
18
+ /**
19
+ * WHAT AN AI BUILD CAN MAKE IN COMMERCE (AGL-3616): a product, as a draft.
20
+ *
21
+ * The capability the AI plugin's build planner offers for "sell my candles".
22
+ * Its item is written by this plugin's `product` draft writer, so every rule
23
+ * is the writer's: the plan's `commerce` feature and product allowance, the
24
+ * member's role, `validateProduct`. The product is born a draft with no
25
+ * photo and — unless the request stated a price — no price, so nothing is on
26
+ * the storefront until the merchant prices it and sets it to Active.
27
+ *
28
+ * The arguments are flat, as the contract requires: at most one option
29
+ * (Size, Scent, …), which `draftContent` turns into the product's options.
30
+ * No page block depends on it: a draft is on no storefront block until it is
31
+ * activated, so a page placing one would show nothing.
32
+ */
33
+ /** The operation's name in a build plan. */
34
+ export declare const PRODUCT_AI_OP = "product";
35
+ /** The writer's content for an item. */
36
+ export declare function productDraftContentFromArgs(args: PluginAiCapabilityArgs): Readonly<Record<string, unknown>>;
37
+ export declare const productAiCapability: PluginAiCapability;
38
+ /**
39
+ * Registers the capability; the console surface calls it beside the writer,
40
+ * since only the console runs AI jobs (AGL-3026). Idempotent.
41
+ */
42
+ export declare function registerProductAiCapability(): void;
@@ -0,0 +1,159 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { registerPluginAiCapability } from "@aglyn/aglyn/plugin-manager/plugin-ai-capabilities";
18
+ import { BUNDLE_ID } from "../constants/bundle-common.js";
19
+ import { COMMERCE_MAX_OPTION_VALUES, COMMERCE_MAX_PRICE_USD } from "../model/commerce.js";
20
+ import { PRODUCT_DRAFT_NAME_MAX, PRODUCT_DRAFT_RESOURCE, PRODUCT_DRAFT_SEO_DESCRIPTION_MAX, PRODUCT_DRAFT_SEO_TITLE_MAX, PRODUCT_DRAFT_TAG_MAX } from "./product-drafts.js";
21
+ /**
22
+ * WHAT AN AI BUILD CAN MAKE IN COMMERCE (AGL-3616): a product, as a draft.
23
+ *
24
+ * The capability the AI plugin's build planner offers for "sell my candles".
25
+ * Its item is written by this plugin's `product` draft writer, so every rule
26
+ * is the writer's: the plan's `commerce` feature and product allowance, the
27
+ * member's role, `validateProduct`. The product is born a draft with no
28
+ * photo and — unless the request stated a price — no price, so nothing is on
29
+ * the storefront until the merchant prices it and sets it to Active.
30
+ *
31
+ * The arguments are flat, as the contract requires: at most one option
32
+ * (Size, Scent, …), which `draftContent` turns into the product's options.
33
+ * No page block depends on it: a draft is on no storefront block until it is
34
+ * activated, so a page placing one would show nothing.
35
+ */ /** The operation's name in a build plan. */ export const PRODUCT_AI_OP = 'product';
36
+ /** The description a planner writes; the writer keeps longer ones a person writes. */ const PRODUCT_AI_DESCRIPTION_MAX = 1200;
37
+ /** The tags a planner proposes, as the AI products job proposes them. */ const PRODUCT_AI_TAGS_MAX = 8;
38
+ /** The longest option name or value a planner writes. */ const PRODUCT_AI_OPTION_TEXT_MAX = 30;
39
+ /** The writer's content for an item. */ export function productDraftContentFromArgs(args) {
40
+ const optionName = typeof args['optionName'] === 'string' ? args['optionName'].trim() : '';
41
+ const optionValues = Array.isArray(args['optionValues']) ? args['optionValues'] : [];
42
+ const copied = [
43
+ 'name',
44
+ 'type',
45
+ 'description',
46
+ 'tags',
47
+ 'seoTitle',
48
+ 'seoDescription',
49
+ 'priceUsd'
50
+ ];
51
+ return _extends({}, Object.fromEntries(copied.filter((key)=>args[key] !== undefined).map((key)=>[
52
+ key,
53
+ args[key]
54
+ ])), optionName || optionValues.length ? {
55
+ options: [
56
+ {
57
+ name: optionName,
58
+ values: [
59
+ ...optionValues
60
+ ]
61
+ }
62
+ ]
63
+ } : {});
64
+ }
65
+ export const productAiCapability = {
66
+ op: PRODUCT_AI_OP,
67
+ noun: 'product',
68
+ where: 'Products → Catalog, as a draft',
69
+ intents: [
70
+ 'products to sell, with a description, tags and options — created as drafts for you to price, photograph and activate'
71
+ ],
72
+ argsSchema: {
73
+ type: 'object',
74
+ properties: {
75
+ name: {
76
+ type: 'string',
77
+ description: 'The product name a shopper reads.',
78
+ maxLength: PRODUCT_DRAFT_NAME_MAX
79
+ },
80
+ type: {
81
+ type: 'string',
82
+ description: '"physical" ships, "digital" is a download, "service" is work done for the buyer.',
83
+ enum: [
84
+ 'physical',
85
+ 'digital',
86
+ 'service'
87
+ ]
88
+ },
89
+ description: {
90
+ type: 'string',
91
+ description: 'What the product is and why someone wants it, in a short paragraph.',
92
+ maxLength: PRODUCT_AI_DESCRIPTION_MAX
93
+ },
94
+ tags: {
95
+ type: 'array',
96
+ description: 'A few lowercase words shoppers filter by.',
97
+ items: {
98
+ type: 'string',
99
+ maxLength: PRODUCT_DRAFT_TAG_MAX
100
+ },
101
+ maxItems: PRODUCT_AI_TAGS_MAX
102
+ },
103
+ optionName: {
104
+ type: 'string',
105
+ description: 'The one way the product varies, if it does, e.g. "Size". Leave out for a single product.',
106
+ maxLength: PRODUCT_AI_OPTION_TEXT_MAX
107
+ },
108
+ optionValues: {
109
+ type: 'array',
110
+ description: 'The choices for optionName, e.g. ["8 oz", "16 oz"].',
111
+ items: {
112
+ type: 'string',
113
+ maxLength: PRODUCT_AI_OPTION_TEXT_MAX
114
+ },
115
+ maxItems: COMMERCE_MAX_OPTION_VALUES
116
+ },
117
+ seoTitle: {
118
+ type: 'string',
119
+ description: 'The search listing title.',
120
+ maxLength: PRODUCT_DRAFT_SEO_TITLE_MAX
121
+ },
122
+ seoDescription: {
123
+ type: 'string',
124
+ description: 'The search listing description.',
125
+ maxLength: PRODUCT_DRAFT_SEO_DESCRIPTION_MAX
126
+ },
127
+ priceUsd: {
128
+ type: 'number',
129
+ description: 'The price in dollars, ONLY when the request states it; otherwise leave it out for the merchant to set.',
130
+ minimum: 0,
131
+ maximum: COMMERCE_MAX_PRICE_USD
132
+ }
133
+ },
134
+ required: [
135
+ 'name'
136
+ ],
137
+ additionalProperties: false
138
+ },
139
+ maxPerPlan: 12,
140
+ // Free includes no commerce and no products (`productsPerHost: 0`).
141
+ freeAllowed: false,
142
+ feature: 'commerce',
143
+ quota: 'productsPerHost',
144
+ draftResource: PRODUCT_DRAFT_RESOURCE,
145
+ // Written without a model: the planner already filled the arguments.
146
+ estimateCredits: ()=>0,
147
+ degrade: 'omit',
148
+ draftContent: (item)=>productDraftContentFromArgs(item.args)
149
+ };
150
+ /**
151
+ * Registers the capability; the console surface calls it beside the writer,
152
+ * since only the console runs AI jobs (AGL-3026). Idempotent.
153
+ */ export function registerProductAiCapability() {
154
+ registerPluginAiCapability(productAiCapability, {
155
+ pluginId: BUNDLE_ID
156
+ });
157
+ }
158
+
159
+ //# sourceMappingURL=product-ai-capability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/product-ai-capability.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n registerPluginAiCapability,\n type PluginAiCapability,\n type PluginAiCapabilityArgs,\n} from '@aglyn/aglyn/plugin-manager/plugin-ai-capabilities'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { COMMERCE_MAX_OPTION_VALUES, COMMERCE_MAX_PRICE_USD } from '../model/commerce'\nimport {\n PRODUCT_DRAFT_NAME_MAX,\n PRODUCT_DRAFT_RESOURCE,\n PRODUCT_DRAFT_SEO_DESCRIPTION_MAX,\n PRODUCT_DRAFT_SEO_TITLE_MAX,\n PRODUCT_DRAFT_TAG_MAX,\n} from './product-drafts'\n\n/**\n * WHAT AN AI BUILD CAN MAKE IN COMMERCE (AGL-3616): a product, as a draft.\n *\n * The capability the AI plugin's build planner offers for \"sell my candles\".\n * Its item is written by this plugin's `product` draft writer, so every rule\n * is the writer's: the plan's `commerce` feature and product allowance, the\n * member's role, `validateProduct`. The product is born a draft with no\n * photo and — unless the request stated a price — no price, so nothing is on\n * the storefront until the merchant prices it and sets it to Active.\n *\n * The arguments are flat, as the contract requires: at most one option\n * (Size, Scent, …), which `draftContent` turns into the product's options.\n * No page block depends on it: a draft is on no storefront block until it is\n * activated, so a page placing one would show nothing.\n */\n\n/** The operation's name in a build plan. */\nexport const PRODUCT_AI_OP = 'product'\n\n/** The description a planner writes; the writer keeps longer ones a person writes. */\nconst PRODUCT_AI_DESCRIPTION_MAX = 1_200\n/** The tags a planner proposes, as the AI products job proposes them. */\nconst PRODUCT_AI_TAGS_MAX = 8\n/** The longest option name or value a planner writes. */\nconst PRODUCT_AI_OPTION_TEXT_MAX = 30\n\n/** The writer's content for an item. */\nexport function productDraftContentFromArgs(args: PluginAiCapabilityArgs): Readonly<Record<string, unknown>> {\n const optionName = typeof args['optionName'] === 'string' ? args['optionName'].trim() : ''\n const optionValues = Array.isArray(args['optionValues']) ? (args['optionValues'] as readonly string[]) : []\n const copied = ['name', 'type', 'description', 'tags', 'seoTitle', 'seoDescription', 'priceUsd']\n return {\n ...Object.fromEntries(copied.filter((key) => args[key] !== undefined).map((key) => [key, args[key]])),\n // One half without the other is an option the writer refuses by name.\n ...(optionName || optionValues.length ? { options: [{ name: optionName, values: [...optionValues] }] } : {}),\n }\n}\n\nexport const productAiCapability: PluginAiCapability = {\n op: PRODUCT_AI_OP,\n noun: 'product',\n where: 'Products → Catalog, as a draft',\n intents: [\n 'products to sell, with a description, tags and options — created as drafts for you to price, photograph and activate',\n ],\n argsSchema: {\n type: 'object',\n properties: {\n name: { type: 'string', description: 'The product name a shopper reads.', maxLength: PRODUCT_DRAFT_NAME_MAX },\n type: {\n type: 'string',\n description: '\"physical\" ships, \"digital\" is a download, \"service\" is work done for the buyer.',\n enum: ['physical', 'digital', 'service'],\n },\n description: {\n type: 'string',\n description: 'What the product is and why someone wants it, in a short paragraph.',\n maxLength: PRODUCT_AI_DESCRIPTION_MAX,\n },\n tags: {\n type: 'array',\n description: 'A few lowercase words shoppers filter by.',\n items: { type: 'string', maxLength: PRODUCT_DRAFT_TAG_MAX },\n maxItems: PRODUCT_AI_TAGS_MAX,\n },\n optionName: {\n type: 'string',\n description: 'The one way the product varies, if it does, e.g. \"Size\". Leave out for a single product.',\n maxLength: PRODUCT_AI_OPTION_TEXT_MAX,\n },\n optionValues: {\n type: 'array',\n description: 'The choices for optionName, e.g. [\"8 oz\", \"16 oz\"].',\n items: { type: 'string', maxLength: PRODUCT_AI_OPTION_TEXT_MAX },\n maxItems: COMMERCE_MAX_OPTION_VALUES,\n },\n seoTitle: { type: 'string', description: 'The search listing title.', maxLength: PRODUCT_DRAFT_SEO_TITLE_MAX },\n seoDescription: {\n type: 'string',\n description: 'The search listing description.',\n maxLength: PRODUCT_DRAFT_SEO_DESCRIPTION_MAX,\n },\n priceUsd: {\n type: 'number',\n description: 'The price in dollars, ONLY when the request states it; otherwise leave it out for the merchant to set.',\n minimum: 0,\n maximum: COMMERCE_MAX_PRICE_USD,\n },\n },\n required: ['name'],\n additionalProperties: false,\n },\n maxPerPlan: 12,\n // Free includes no commerce and no products (`productsPerHost: 0`).\n freeAllowed: false,\n feature: 'commerce',\n quota: 'productsPerHost',\n draftResource: PRODUCT_DRAFT_RESOURCE,\n // Written without a model: the planner already filled the arguments.\n estimateCredits: () => 0,\n degrade: 'omit',\n draftContent: (item) => productDraftContentFromArgs(item.args),\n}\n\n/**\n * Registers the capability; the console surface calls it beside the writer,\n * since only the console runs AI jobs (AGL-3026). Idempotent.\n */\nexport function registerProductAiCapability(): void {\n registerPluginAiCapability(productAiCapability, { pluginId: BUNDLE_ID })\n}\n"],"names":["registerPluginAiCapability","BUNDLE_ID","COMMERCE_MAX_OPTION_VALUES","COMMERCE_MAX_PRICE_USD","PRODUCT_DRAFT_NAME_MAX","PRODUCT_DRAFT_RESOURCE","PRODUCT_DRAFT_SEO_DESCRIPTION_MAX","PRODUCT_DRAFT_SEO_TITLE_MAX","PRODUCT_DRAFT_TAG_MAX","PRODUCT_AI_OP","PRODUCT_AI_DESCRIPTION_MAX","PRODUCT_AI_TAGS_MAX","PRODUCT_AI_OPTION_TEXT_MAX","productDraftContentFromArgs","args","optionName","trim","optionValues","Array","isArray","copied","Object","fromEntries","filter","key","undefined","map","length","options","name","values","productAiCapability","op","noun","where","intents","argsSchema","type","properties","description","maxLength","enum","tags","items","maxItems","seoTitle","seoDescription","priceUsd","minimum","maximum","required","additionalProperties","maxPerPlan","freeAllowed","feature","quota","draftResource","estimateCredits","degrade","draftContent","item","registerProductAiCapability","pluginId"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,0BAA0B,QAGrB,qDAAoD;AAC3D,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,0BAA0B,EAAEC,sBAAsB,QAAQ,uBAAmB;AACtF,SACEC,sBAAsB,EACtBC,sBAAsB,EACtBC,iCAAiC,EACjCC,2BAA2B,EAC3BC,qBAAqB,QAChB,sBAAkB;AAEzB;;;;;;;;;;;;;;CAcC,GAED,0CAA0C,GAC1C,OAAO,MAAMC,gBAAgB,UAAS;AAEtC,oFAAoF,GACpF,MAAMC,6B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BACZoB,MAAM;gBACNE,aAAa;gBACbI,OAAO;oBAAEN,MAAM;oBAAUG,WAAW5B;gBAA2B;gBAC/DgC,UAAU1C;YACZ;YACA2C,UAAU;gBAAER,MAAM;gBAAUE,aAAa;gBAA6BC,WAAWjC;YAA4B;YAC7GuC,gBAAgB;gBACdT,MAAM;gBACNE,aAAa;gBACbC,WAAWlC;YACb;YACAyC,UAAU;gBACRV,MAAM;gBACNE,aAAa;gBACbS,SAAS;gBACTC,SAAS9C;YACX;QACF;QACA+C,UAAU;YAAC;SAAO;QAClBC,sBAAsB;IACxB;IACAC,YAAY;IACZ,oEAAoE;IACpEC,aAAa;IACbC,SAAS;IACTC,OAAO;IACPC,eAAenD;IACf,qEAAqE;IACrEoD,iBAAiB,IAAM;IACvBC,SAAS;IACTC,cAAc,CAACC,OAAS/C,4BAA4B+C,KAAK9C,IAAI;AAC/D,EAAC;AAED;;;CAGC,GACD,OAAO,SAAS+C;IACd7D,2BAA2B+B,qBAAqB;QAAE+B,UAAU7D;IAAU;AACxE"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { CatalogOffer, CatalogShippingPrice, PluginProductCatalog } from '@aglyn/aglyn/plugin-manager/plugin-product-catalog';
18
+ import * as CommerceModel from '../model';
19
+ type DocumentData = FirebaseFirestore.DocumentData;
20
+ /** Plain text from a description that may hold markup. */
21
+ export declare function plainDescription(value: unknown): string;
22
+ /** The origin the store's pages answer on: its live custom domain, else its subdomain. */
23
+ export declare function storeOrigin(host: DocumentData | undefined): string | null;
24
+ /** A stable offer id within the longest any channel accepts. */
25
+ export declare function offerId(productId: string, variantId: string, hasVariants: boolean): string;
26
+ /** The countries the store's zones price by a live carrier quote, upper case. */
27
+ export declare function carrierPricedCountries(settings: CommerceModel.ShippingSettings | undefined, countries: readonly string[]): string[];
28
+ /** What one unit of an offer costs to ship to each country, the cheapest rate each. */
29
+ export declare function offerShipping(settings: CommerceModel.ShippingSettings | undefined, countries: readonly string[], unit: {
30
+ priceMinor: number;
31
+ weightGrams?: number;
32
+ }): CatalogShippingPrice[];
33
+ interface PageContext {
34
+ origin: string | null;
35
+ categories: ReadonlyMap<string, CommerceModel.ProductCategory>;
36
+ shipping: CommerceModel.ShippingSettings | undefined;
37
+ countries: readonly string[];
38
+ }
39
+ /** The offers of one stored product; empty for a product that is not listed. */
40
+ export declare function productOffers(productId: string, raw: DocumentData, context: PageContext): CatalogOffer[];
41
+ export declare const productCatalog: PluginProductCatalog;
42
+ export {};