@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,197 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { Button, Dialog, DialogActions, DialogContent, DialogTitle, MenuItem, Stack, TextField, Typography } from "@mui/material";
20
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
21
+ import { useEffect, useMemo, useState } from "react";
22
+ import { LABEL_SIZES, MAX_LABEL_COPIES, productLabelsHtml, productLabelsZpl } from "../../printing/product-labels.js";
23
+ /**
24
+ * Print product labels (AGL-3619): a label per variant with its name,
25
+ * options, price and a barcode the register scans back, on a thermal label
26
+ * printer through the browser, or as ZPL for a Zebra.
27
+ */ const COPIES_INPUT = {
28
+ htmlInput: {
29
+ inputMode: 'numeric',
30
+ min: 0,
31
+ max: MAX_LABEL_COPIES
32
+ }
33
+ };
34
+ /** The labels a product prints: one row per variant that has a barcode or SKU. */ export function productLabelRows(product) {
35
+ return product.variants.map((variant)=>{
36
+ var _variant_options;
37
+ const options = Object.values((_variant_options = variant.options) != null ? _variant_options : {}).filter(Boolean);
38
+ return _extends({
39
+ variantId: variant.id,
40
+ name: product.name
41
+ }, options.length ? {
42
+ detail: options.join(' / ')
43
+ } : {}, Number.isFinite(Number(variant.priceUsd)) ? {
44
+ priceCents: Math.round(Number(variant.priceUsd) * 100)
45
+ } : {}, {
46
+ currency: 'usd',
47
+ code: String(variant.barcode || variant.sku || '').trim(),
48
+ copies: 1
49
+ });
50
+ });
51
+ }
52
+ export function ProductLabelsDialog(props) {
53
+ var _ref;
54
+ const { product, onClose } = props;
55
+ const { enqueueSnackbar } = useSnackbar();
56
+ const initial = useMemo(()=>product ? productLabelRows(product) : [], [
57
+ product
58
+ ]);
59
+ const [rows, setRows] = useState(initial);
60
+ const [sizeId, setSizeId] = useState(LABEL_SIZES[0].id);
61
+ useEffect(()=>setRows(initial), [
62
+ initial
63
+ ]);
64
+ const printable = rows.filter((row)=>row.code && row.copies > 0);
65
+ const total = printable.reduce((sum, row)=>sum + row.copies, 0);
66
+ const setCopies = (variantId, value)=>setRows((current)=>current.map((row)=>row.variantId === variantId ? _extends({}, row, {
67
+ copies: Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0)))
68
+ }) : row));
69
+ const print = ()=>{
70
+ const win = window.open('', '_blank', 'width=480,height=640');
71
+ if (!win) {
72
+ return void enqueueSnackbar('Allow pop-ups for this site to print labels', {
73
+ variant: 'warning',
74
+ persist: false
75
+ });
76
+ }
77
+ // Every merchant-authored value on the page is escaped by the renderer.
78
+ win.document.write(productLabelsHtml(printable, sizeId));
79
+ win.document.close();
80
+ win.focus();
81
+ win.print();
82
+ };
83
+ const downloadZpl = ()=>{
84
+ var _ref;
85
+ const blob = new Blob([
86
+ productLabelsZpl(printable, sizeId)
87
+ ], {
88
+ type: 'text/plain'
89
+ });
90
+ const url = URL.createObjectURL(blob);
91
+ const link = document.createElement('a');
92
+ link.href = url;
93
+ link.download = `labels-${((_ref = product == null ? void 0 : product.name) != null ? _ref : 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`;
94
+ link.click();
95
+ setTimeout(()=>URL.revokeObjectURL(url), 1000);
96
+ };
97
+ return /*#__PURE__*/ _jsxs(Dialog, {
98
+ open: Boolean(product),
99
+ onClose: onClose,
100
+ fullWidth: true,
101
+ maxWidth: "sm",
102
+ children: [
103
+ /*#__PURE__*/ _jsx(DialogTitle, {
104
+ children: `Labels — ${(_ref = product == null ? void 0 : product.name) != null ? _ref : ''}`
105
+ }),
106
+ /*#__PURE__*/ _jsx(DialogContent, {
107
+ children: /*#__PURE__*/ _jsxs(Stack, {
108
+ spacing: 2,
109
+ sx: {
110
+ pt: 1
111
+ },
112
+ children: [
113
+ /*#__PURE__*/ _jsx(TextField, {
114
+ select: true,
115
+ label: "Label size",
116
+ value: sizeId,
117
+ onChange: (event)=>setSizeId(event.target.value),
118
+ children: LABEL_SIZES.map((size)=>/*#__PURE__*/ _jsx(MenuItem, {
119
+ value: size.id,
120
+ children: size.label
121
+ }, size.id))
122
+ }),
123
+ rows.map((row)=>{
124
+ var _row_detail;
125
+ return /*#__PURE__*/ _jsxs(Stack, {
126
+ direction: "row",
127
+ spacing: 2,
128
+ sx: {
129
+ alignItems: 'center'
130
+ },
131
+ children: [
132
+ /*#__PURE__*/ _jsxs(Stack, {
133
+ sx: {
134
+ flex: 1,
135
+ minWidth: 0
136
+ },
137
+ children: [
138
+ /*#__PURE__*/ _jsx(Typography, {
139
+ variant: "body2",
140
+ noWrap: true,
141
+ children: (_row_detail = row.detail) != null ? _row_detail : row.name
142
+ }),
143
+ /*#__PURE__*/ _jsx(Typography, {
144
+ variant: "caption",
145
+ color: row.code ? 'text.secondary' : 'warning.main',
146
+ noWrap: true,
147
+ children: row.code || 'Add a barcode or SKU to print a label'
148
+ })
149
+ ]
150
+ }),
151
+ /*#__PURE__*/ _jsx(TextField, {
152
+ label: "Copies",
153
+ type: "number",
154
+ size: "small",
155
+ value: row.code ? row.copies : 0,
156
+ disabled: !row.code,
157
+ onChange: (event)=>setCopies(row.variantId, event.target.value),
158
+ slotProps: COPIES_INPUT,
159
+ sx: {
160
+ width: 96
161
+ }
162
+ })
163
+ ]
164
+ }, row.variantId);
165
+ }),
166
+ /*#__PURE__*/ _jsx(Typography, {
167
+ variant: "body2",
168
+ color: "text.secondary",
169
+ children: 'Print to a label printer at 100% scale, or download ZPL to send straight to a Zebra.'
170
+ })
171
+ ]
172
+ })
173
+ }),
174
+ /*#__PURE__*/ _jsxs(DialogActions, {
175
+ children: [
176
+ /*#__PURE__*/ _jsx(Button, {
177
+ onClick: onClose,
178
+ children: 'Cancel'
179
+ }),
180
+ /*#__PURE__*/ _jsx(Button, {
181
+ disabled: !total,
182
+ onClick: downloadZpl,
183
+ children: 'Download ZPL'
184
+ }),
185
+ /*#__PURE__*/ _jsx(Button, {
186
+ disabled: !total,
187
+ onClick: print,
188
+ children: total === 1 ? 'Print 1 label' : `Print ${total} labels`
189
+ })
190
+ ]
191
+ })
192
+ ]
193
+ });
194
+ }
195
+ export default ProductLabelsDialog;
196
+
197
+ //# sourceMappingURL=product-labels-dialog.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-labels-dialog.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport * as CommerceModel from '../../model'\nimport {\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n LABEL_SIZES,\n MAX_LABEL_COPIES,\n productLabelsHtml,\n productLabelsZpl,\n type ProductLabel,\n} from '../../printing/product-labels'\n\n/**\n * Print product labels (AGL-3619): a label per variant with its name,\n * options, price and a barcode the register scans back, on a thermal label\n * printer through the browser, or as ZPL for a Zebra.\n */\n\nconst COPIES_INPUT = { htmlInput: { inputMode: 'numeric', min: 0, max: MAX_LABEL_COPIES } } as const\n\n/** The labels a product prints: one row per variant that has a barcode or SKU. */\nexport function productLabelRows(product: CommerceModel.HostProduct): Array<ProductLabel & { variantId: string }> {\n return product.variants.map((variant) => {\n const options = Object.values(variant.options ?? {}).filter(Boolean)\n return {\n variantId: variant.id,\n name: product.name,\n ...(options.length ? { detail: options.join(' / ') } : {}),\n ...(Number.isFinite(Number(variant.priceUsd))\n ? { priceCents: Math.round(Number(variant.priceUsd) * 100) }\n : {}),\n currency: 'usd',\n code: String(variant.barcode || variant.sku || '').trim(),\n copies: 1,\n }\n })\n}\n\nexport function ProductLabelsDialog(props: {\n product: (CommerceModel.HostProduct & { $id: string }) | null\n onClose: () => void\n}) {\n const { product, onClose } = props\n const { enqueueSnackbar } = useSnackbar()\n const initial = useMemo(() => (product ? productLabelRows(product) : []), [product])\n const [rows, setRows] = useState(initial)\n const [sizeId, setSizeId] = useState(LABEL_SIZES[0].id)\n useEffect(() => setRows(initial), [initial])\n const printable = rows.filter((row) => row.code && row.copies > 0)\n const total = printable.reduce((sum, row) => sum + row.copies, 0)\n\n const setCopies = (variantId: string, value: string) =>\n setRows((current) =>\n current.map((row) =>\n row.variantId === variantId\n ? { ...row, copies: Math.max(0, Math.min(MAX_LABEL_COPIES, Math.floor(Number(value) || 0))) }\n : row,\n ),\n )\n\n const print = () => {\n const win = window.open('', '_blank', 'width=480,height=640')\n if (!win) {\n return void enqueueSnackbar('Allow pop-ups for this site to print labels', {\n variant: 'warning',\n persist: false,\n })\n }\n // Every merchant-authored value on the page is escaped by the renderer.\n win.document.write(productLabelsHtml(printable, sizeId))\n win.document.close()\n win.focus()\n win.print()\n }\n\n const downloadZpl = () => {\n const blob = new Blob([productLabelsZpl(printable, sizeId)], { type: 'text/plain' })\n const url = URL.createObjectURL(blob)\n const link = document.createElement('a')\n link.href = url\n link.download = `labels-${(product?.name ?? 'product').replace(/[^A-Za-z0-9]+/g, '-').toLowerCase()}.zpl`\n link.click()\n setTimeout(() => URL.revokeObjectURL(url), 1000)\n }\n\n return (\n <Dialog open={Boolean(product)} onClose={onClose} fullWidth maxWidth=\"sm\">\n <DialogTitle>{`Labels — ${product?.name ?? ''}`}</DialogTitle>\n <DialogContent>\n <Stack spacing={2} sx={{ pt: 1 }}>\n <TextField select label=\"Label size\" value={sizeId} onChange={(event) => setSizeId(event.target.value)}>\n {LABEL_SIZES.map((size) => (\n <MenuItem key={size.id} value={size.id}>\n {size.label}\n </MenuItem>\n ))}\n </TextField>\n {rows.map((row) => (\n <Stack key={row.variantId} direction=\"row\" spacing={2} sx={{ alignItems: 'center' }}>\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {row.detail ?? row.name}\n </Typography>\n <Typography variant=\"caption\" color={row.code ? 'text.secondary' : 'warning.main'} noWrap>\n {row.code || 'Add a barcode or SKU to print a label'}\n </Typography>\n </Stack>\n <TextField\n label=\"Copies\"\n type=\"number\"\n size=\"small\"\n value={row.code ? row.copies : 0}\n disabled={!row.code}\n onChange={(event) => setCopies(row.variantId, event.target.value)}\n slotProps={COPIES_INPUT}\n sx={{ width: 96 }}\n />\n </Stack>\n ))}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Print to a label printer at 100% scale, or download ZPL to send straight to a Zebra.'}\n </Typography>\n </Stack>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose}>{'Cancel'}</Button>\n <Button disabled={!total} onClick={downloadZpl}>\n {'Download ZPL'}\n </Button>\n <Button disabled={!total} onClick={print}>\n {total === 1 ? 'Print 1 label' : `Print ${total} labels`}\n </Button>\n </DialogActions>\n </Dialog>\n )\n}\n\nexport default ProductLabelsDialog\n"],"names":["Button","Dialog","DialogActions","DialogContent","DialogTitle","MenuItem","Stack","TextField","Typography","useSnackbar","useEffect","useMemo","useState","LABEL_SIZES","MAX_LABEL_COPIES","productLabelsHtml","productLabelsZpl","COPIES_INPUT","htmlInput","inputMode","min","max","productLabelRows","product","variants","map","variant","options","Object","values","filter","Boolean","variantId","id","name","length","detail","join","Number","isFinite","priceUsd","priceCents","Math","round","currency","code","String","barcode","sku","trim","copies","ProductLabelsDialog","props","onClose","enqueueSnackbar","initial","rows","setRows","sizeId","setSizeId","printable","row","total","reduce","sum","setCopies","value","current","floor","print","win","window","open","persist","document","write","close","focus","downloadZpl","blob","Blob","type","url","URL","createObjectURL","link","createElement","href","download","replace","toLowerCase","click","setTimeout","revokeObjectURL","fullWidth","maxWidth","spacing","sx","pt","select","label","onChange","event","target","size","direction","alignItems","flex","minWidth","noWrap","color","disabled","slotProps","width","onClick"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,SACEA,MAAM,EACNC,MAAM,EACNC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SAASC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACpD,SACEC,WAAW,EACXC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QAEX,mCAA+B;AAEtC;;;;CAIC,GAED,MAAMC,eAAe;IAAEC,WAAW;QAAEC,WAAW;QAAWC,KAAK;QAAGC,KAAKP;IAAiB;AAAE;AAE1F,gFAAgF,GAChF,OAAO,SAASQ,iBAAiBC,OAAkC;IACjE,OAAOA,QAAQC,QAAQ,CAACC,GAAG,CAAC,CAACC;YACGA;QAA9B,MAAMC,UAAUC,OAAOC,MAAM,EAACH,mBAAAA,QAAQC,OAAO,YAAfD,mBAAmB,CAAC,GAAGI,MAAM,CAACC;QAC5D,OAAO;YACLC,WAAWN,QAAQO,EAAE;YACrBC,MAAMX,QAAQW,IAAI;WACdP,QAAQQ,MAAM,GAAG;YAAEC,QAAQT,QAAQU,IAAI,CAAC;QAAO,IAAI,CAAC,GACpDC,OAAOC,QAAQ,CAACD,OAAOZ,QAAQc,QAAQ,KACvC;YAAEC,YAAYC,KAAKC,KAAK,CAACL,OAAOZ,QAAQc,QAAQ,IAAI;QAAK,IACzD,CAAC;YACLI,UAAU;YACVC,MAAMC,OAAOpB,QAAQqB,OAAO,IAAIrB,QAAQsB,GA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AAC1B;gDAAWkB,SAAQ;gDAAUoF,OAAOjD,IAAIhB,IAAI,GAAG,mBAAmB;gDAAgBgE,MAAM;0DACtFhD,IAAIhB,IAAI,IAAI;;;;kDAGjB,KAACtC;wCACC6F,OAAM;wCACNnB,MAAK;wCACLuB,MAAK;wCACLtC,OAAOL,IAAIhB,IAAI,GAAGgB,IAAIX,MAAM,GAAG;wCAC/B6D,UAAU,CAAClD,IAAIhB,IAAI;wCACnBwD,UAAU,CAACC,QAAUrC,UAAUJ,IAAI7B,SAAS,EAAEsE,MAAMC,MAAM,CAACrC,KAAK;wCAChE8C,WAAW/F;wCACXgF,IAAI;4CAAEgB,OAAO;wCAAG;;;+BAjBRpD,IAAI7B,SAAS;;sCAqB3B,KAACxB;4BAAWkB,SAAQ;4BAAQoF,OAAM;sCAC/B;;;;;0BAIP,MAAC5G;;kCACC,KAACF;wBAAOkH,SAAS7D;kCAAU;;kCAC3B,KAACrD;wBAAO+G,UAAU,CAACjD;wBAAOoD,SAASpC;kCAChC;;kCAEH,KAAC9E;wBAAO+G,UAAU,CAACjD;wBAAOoD,SAAS7C;kCAChCP,UAAU,IAAI,kBAAkB,CAAC,MAAM,EAAEA,MAAM,OAAO,CAAC;;;;;;AAKlE;AAEA,eAAeX,oBAAmB"}
@@ -0,0 +1,19 @@
1
+ import * as CommerceModel from '../../model';
2
+ type Patch = Partial<CommerceModel.HostProduct>;
3
+ export interface ProductRegisterFieldsProps {
4
+ posQuickKey: boolean;
5
+ modifierGroups: readonly CommerceModel.ProductModifierGroup[];
6
+ update: (patch: Patch) => void;
7
+ }
8
+ /**
9
+ * The product's register settings (AGL-3607): whether it is a quick key on
10
+ * the register's first screen, and its modifier groups — choices such as
11
+ * "Milk" or "Add-ons" the cashier picks as the item is rung up, each choice
12
+ * free or with a price added to the item. A group with a minimum of 1 or
13
+ * more must be answered before the item can be added.
14
+ *
15
+ * Memoized on its own props like every section of this editor (AGL-3423):
16
+ * a keystroke elsewhere in the dialog does not redraw it.
17
+ */
18
+ export declare const ProductRegisterFields: import("react").MemoExoticComponent<(props: ProductRegisterFieldsProps) => import("react").JSX.Element>;
19
+ export {};
@@ -0,0 +1,241 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { Box, Button, FormControlLabel, IconButton, Stack, Switch, TextField, Typography } from "@mui/material";
20
+ import { memo, useCallback } from "react";
21
+ import * as CommerceModel from "../../model/index.js";
22
+ function newId(prefix) {
23
+ return `${prefix}${Math.random().toString(36).slice(2, 10)}`;
24
+ }
25
+ /** Dollars as typed, to whole cents; blank is free. */ function centsFromDollars(value) {
26
+ const number = Math.round(Number(String(value).replace(/[^0-9.]/g, '')) * 100);
27
+ return Number.isFinite(number) && number > 0 ? number : 0;
28
+ }
29
+ /**
30
+ * The product's register settings (AGL-3607): whether it is a quick key on
31
+ * the register's first screen, and its modifier groups — choices such as
32
+ * "Milk" or "Add-ons" the cashier picks as the item is rung up, each choice
33
+ * free or with a price added to the item. A group with a minimum of 1 or
34
+ * more must be answered before the item can be added.
35
+ *
36
+ * Memoized on its own props like every section of this editor (AGL-3423):
37
+ * a keystroke elsewhere in the dialog does not redraw it.
38
+ */ export const ProductRegisterFields = /*#__PURE__*/ memo(function ProductRegisterFields(props) {
39
+ const { modifierGroups, update } = props;
40
+ const setGroups = useCallback((groups)=>update({
41
+ modifierGroups: groups
42
+ }), [
43
+ update
44
+ ]);
45
+ const editGroup = (index, patch)=>setGroups(modifierGroups.map((group, at)=>at === index ? _extends({}, group, patch) : group));
46
+ const editOption = (groupIndex, optionIndex, patch)=>{
47
+ const group = modifierGroups[groupIndex];
48
+ editGroup(groupIndex, {
49
+ options: group.options.map((option, at)=>at === optionIndex ? _extends({}, option, patch) : option)
50
+ });
51
+ };
52
+ const problem = CommerceModel.modifierGroupsProblem(modifierGroups);
53
+ return /*#__PURE__*/ _jsxs(Stack, {
54
+ spacing: 2,
55
+ children: [
56
+ /*#__PURE__*/ _jsx(Typography, {
57
+ variant: "subtitle1",
58
+ component: "h3",
59
+ children: 'At the register'
60
+ }),
61
+ /*#__PURE__*/ _jsx(FormControlLabel, {
62
+ control: /*#__PURE__*/ _jsx(Switch, {
63
+ checked: props.posQuickKey,
64
+ onChange: (event)=>update({
65
+ posQuickKey: event.target.checked
66
+ })
67
+ }),
68
+ label: "Quick key at the register"
69
+ }),
70
+ /*#__PURE__*/ _jsx(Typography, {
71
+ variant: "body2",
72
+ color: "text.secondary",
73
+ children: 'Modifiers are choices added as the item is rung up, such as a milk or an extra shot. ' + 'Each can be free or add to the price.'
74
+ }),
75
+ modifierGroups.map((group, groupIndex)=>/*#__PURE__*/ _jsx(Box, {
76
+ role: "group",
77
+ "aria-label": group.name || 'Modifier group',
78
+ sx: {
79
+ border: 1,
80
+ borderColor: 'divider',
81
+ borderRadius: 1,
82
+ p: 2
83
+ },
84
+ children: /*#__PURE__*/ _jsxs(Stack, {
85
+ spacing: 1.5,
86
+ children: [
87
+ /*#__PURE__*/ _jsxs(Stack, {
88
+ direction: "row",
89
+ spacing: 1,
90
+ sx: {
91
+ alignItems: 'flex-start'
92
+ },
93
+ children: [
94
+ /*#__PURE__*/ _jsx(TextField, {
95
+ label: "Group name",
96
+ size: "small",
97
+ value: group.name,
98
+ onChange: (event)=>editGroup(groupIndex, {
99
+ name: event.target.value
100
+ }),
101
+ sx: {
102
+ flex: 1
103
+ }
104
+ }),
105
+ /*#__PURE__*/ _jsx(TextField, {
106
+ label: "At least",
107
+ size: "small",
108
+ value: group.min,
109
+ onChange: (event)=>editGroup(groupIndex, {
110
+ min: Math.max(0, Math.round(Number(event.target.value) || 0))
111
+ }),
112
+ helperText: group.min > 0 ? 'Required' : 'Optional',
113
+ sx: {
114
+ width: 96
115
+ },
116
+ slotProps: {
117
+ htmlInput: {
118
+ inputMode: 'numeric'
119
+ }
120
+ }
121
+ }),
122
+ /*#__PURE__*/ _jsx(TextField, {
123
+ label: "At most",
124
+ size: "small",
125
+ value: group.max,
126
+ onChange: (event)=>editGroup(groupIndex, {
127
+ max: Math.max(1, Math.round(Number(event.target.value) || 1))
128
+ }),
129
+ sx: {
130
+ width: 96
131
+ },
132
+ slotProps: {
133
+ htmlInput: {
134
+ inputMode: 'numeric'
135
+ }
136
+ }
137
+ }),
138
+ /*#__PURE__*/ _jsx(Button, {
139
+ color: "error",
140
+ onClick: ()=>setGroups(modifierGroups.filter((_group, at)=>at !== groupIndex)),
141
+ children: 'Remove group'
142
+ })
143
+ ]
144
+ }),
145
+ group.options.map((option, optionIndex)=>/*#__PURE__*/ _jsxs(Stack, {
146
+ direction: "row",
147
+ spacing: 1,
148
+ sx: {
149
+ alignItems: 'center'
150
+ },
151
+ children: [
152
+ /*#__PURE__*/ _jsx(TextField, {
153
+ label: "Choice",
154
+ size: "small",
155
+ value: option.name,
156
+ onChange: (event)=>editOption(groupIndex, optionIndex, {
157
+ name: event.target.value
158
+ }),
159
+ sx: {
160
+ flex: 1
161
+ }
162
+ }),
163
+ /*#__PURE__*/ _jsx(TextField, {
164
+ label: "Adds ($)",
165
+ size: "small",
166
+ defaultValue: option.priceCents ? (option.priceCents / 100).toFixed(2) : '',
167
+ placeholder: "0.00",
168
+ onBlur: (event)=>editOption(groupIndex, optionIndex, {
169
+ priceCents: centsFromDollars(event.target.value)
170
+ }),
171
+ sx: {
172
+ width: 120
173
+ },
174
+ slotProps: {
175
+ htmlInput: {
176
+ inputMode: 'decimal'
177
+ }
178
+ }
179
+ }),
180
+ /*#__PURE__*/ _jsx(IconButton, {
181
+ "aria-label": `Remove ${option.name || 'choice'}`,
182
+ onClick: ()=>editGroup(groupIndex, {
183
+ options: group.options.filter((_option, at)=>at !== optionIndex),
184
+ max: Math.max(1, Math.min(group.max, group.options.length - 1))
185
+ }),
186
+ children: '✕'
187
+ })
188
+ ]
189
+ }, option.id)),
190
+ /*#__PURE__*/ _jsx(Box, {
191
+ children: /*#__PURE__*/ _jsx(Button, {
192
+ onClick: ()=>editGroup(groupIndex, {
193
+ options: [
194
+ ...group.options,
195
+ {
196
+ id: newId('o'),
197
+ name: '',
198
+ priceCents: 0
199
+ }
200
+ ]
201
+ }),
202
+ disabled: group.options.length >= CommerceModel.POS_MAX_MODIFIER_OPTIONS,
203
+ children: 'Add choice'
204
+ })
205
+ })
206
+ ]
207
+ })
208
+ }, group.id)),
209
+ /*#__PURE__*/ _jsx(Box, {
210
+ children: /*#__PURE__*/ _jsx(Button, {
211
+ variant: "outlined",
212
+ onClick: ()=>setGroups([
213
+ ...modifierGroups,
214
+ {
215
+ id: newId('g'),
216
+ name: '',
217
+ min: 0,
218
+ max: 1,
219
+ options: [
220
+ {
221
+ id: newId('o'),
222
+ name: '',
223
+ priceCents: 0
224
+ }
225
+ ]
226
+ }
227
+ ]),
228
+ disabled: modifierGroups.length >= CommerceModel.POS_MAX_MODIFIER_GROUPS,
229
+ children: 'Add modifier group'
230
+ })
231
+ }),
232
+ problem && modifierGroups.length ? /*#__PURE__*/ _jsx(Typography, {
233
+ variant: "body2",
234
+ color: "warning.main",
235
+ children: problem
236
+ }) : null
237
+ ]
238
+ });
239
+ });
240
+
241
+ //# sourceMappingURL=product-register-fields.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-register-fields.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport {\n Box,\n Button,\n FormControlLabel,\n IconButton,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { memo, useCallback } from 'react'\nimport * as CommerceModel from '../../model'\n\ntype Patch = Partial<CommerceModel.HostProduct>\n\nexport interface ProductRegisterFieldsProps {\n posQuickKey: boolean\n modifierGroups: readonly CommerceModel.ProductModifierGroup[]\n update: (patch: Patch) => void\n}\n\nfunction newId(prefix: string): string {\n return `${prefix}${Math.random().toString(36).slice(2, 10)}`\n}\n\n/** Dollars as typed, to whole cents; blank is free. */\nfunction centsFromDollars(value: string): number {\n const number = Math.round(Number(String(value).replace(/[^0-9.]/g, '')) * 100)\n return Number.isFinite(number) && number > 0 ? number : 0\n}\n\n/**\n * The product's register settings (AGL-3607): whether it is a quick key on\n * the register's first screen, and its modifier groups — choices such as\n * \"Milk\" or \"Add-ons\" the cashier picks as the item is rung up, each choice\n * free or with a price added to the item. A group with a minimum of 1 or\n * more must be answered before the item can be added.\n *\n * Memoized on its own props like every section of this editor (AGL-3423):\n * a keystroke elsewhere in the dialog does not redraw it.\n */\nexport const ProductRegisterFields = memo(function ProductRegisterFields(\n props: ProductRegisterFieldsProps,\n) {\n const { modifierGroups, update } = props\n const setGroups = useCallback(\n (groups: CommerceModel.ProductModifierGroup[]) => update({ modifierGroups: groups }),\n [update],\n )\n const editGroup = (index: number, patch: Partial<CommerceModel.ProductModifierGroup>) =>\n setGroups(modifierGroups.map((group, at) => (at === index ? { ...group, ...patch } : group)))\n const editOption = (\n groupIndex: number,\n optionIndex: number,\n patch: Partial<CommerceModel.ProductModifierOption>,\n ) => {\n const group = modifierGroups[groupIndex]\n editGroup(groupIndex, {\n options: group.options.map((option, at) => (at === optionIndex ? { ...option, ...patch } : option)),\n })\n }\n const problem = CommerceModel.modifierGroupsProblem(modifierGroups)\n\n return (\n <Stack spacing={2}>\n <Typography variant=\"subtitle1\" component=\"h3\">\n {'At the register'}\n </Typography>\n <FormControlLabel\n control={\n <Switch\n checked={props.posQuickKey}\n onChange={(event) => update({ posQuickKey: event.target.checked })}\n />\n }\n label=\"Quick key at the register\"\n />\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Modifiers are choices added as the item is rung up, such as a milk or an extra shot. ' +\n 'Each can be free or add to the price.'}\n </Typography>\n {modifierGroups.map((group, groupIndex) => (\n <Box\n key={group.id}\n role=\"group\"\n aria-label={group.name || 'Modifier group'}\n sx={{ border: 1, borderColor: 'divider', borderRadius: 1, p: 2 }}\n >\n <Stack spacing={1.5}>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n label=\"Group name\"\n size=\"small\"\n value={group.name}\n onChange={(event) => editGroup(groupIndex, { name: event.target.value })}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"At least\"\n size=\"small\"\n value={group.min}\n onChange={(event) =>\n editGroup(groupIndex, { min: Math.max(0, Math.round(Number(event.target.value) || 0)) })\n }\n helperText={group.min > 0 ? 'Required' : 'Optional'}\n sx={{ width: 96 }}\n slotProps={{ htmlInput: { inputMode: 'numeric' } }}\n />\n <TextField\n label=\"At most\"\n size=\"small\"\n value={group.max}\n onChange={(event) =>\n editGroup(groupIndex, { max: Math.max(1, Math.round(Number(event.target.value) || 1)) })\n }\n sx={{ width: 96 }}\n slotProps={{ htmlInput: { inputMode: 'numeric' } }}\n />\n <Button\n color=\"error\"\n onClick={() => setGroups(modifierGroups.filter((_group, at) => at !== groupIndex))}\n >\n {'Remove group'}\n </Button>\n </Stack>\n {group.options.map((option, optionIndex) => (\n <Stack key={option.id} direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <TextField\n label=\"Choice\"\n size=\"small\"\n value={option.name}\n onChange={(event) => editOption(groupIndex, optionIndex, { name: event.target.value })}\n sx={{ flex: 1 }}\n />\n <TextField\n label=\"Adds ($)\"\n size=\"small\"\n defaultValue={option.priceCents ? (option.priceCents / 100).toFixed(2) : ''}\n placeholder=\"0.00\"\n onBlur={(event) =>\n editOption(groupIndex, optionIndex, { priceCents: centsFromDollars(event.target.value) })\n }\n sx={{ width: 120 }}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <IconButton\n aria-label={`Remove ${option.name || 'choice'}`}\n onClick={() =>\n editGroup(groupIndex, {\n options: group.options.filter((_option, at) => at !== optionIndex),\n max: Math.max(1, Math.min(group.max, group.options.length - 1)),\n })\n }\n >\n {'✕'}\n </IconButton>\n </Stack>\n ))}\n <Box>\n <Button\n onClick={() =>\n editGroup(groupIndex, {\n options: [...group.options, { id: newId('o'), name: '', priceCents: 0 }],\n })\n }\n disabled={group.options.length >= CommerceModel.POS_MAX_MODIFIER_OPTIONS}\n >\n {'Add choice'}\n </Button>\n </Box>\n </Stack>\n </Box>\n ))}\n <Box>\n <Button\n variant=\"outlined\"\n onClick={() =>\n setGroups([\n ...modifierGroups,\n {\n id: newId('g'),\n name: '',\n min: 0,\n max: 1,\n options: [{ id: newId('o'), name: '', priceCents: 0 }],\n },\n ])\n }\n disabled={modifierGroups.length >= CommerceModel.POS_MAX_MODIFIER_GROUPS}\n >\n {'Add modifier group'}\n </Button>\n </Box>\n {problem && modifierGroups.length ? (\n <Typography variant=\"body2\" color=\"warning.main\">\n {problem}\n </Typography>\n ) : null}\n </Stack>\n )\n})\n"],"names":["Box","Button","FormControlLabel","IconButton","Stack","Switch","TextField","Typography","memo","useCallback","CommerceModel","newId","prefix","Math","random","toString","slice","centsFromDollars","value","number","round","Number","String","replace","isFinite","ProductRegisterFields","props","modifierGroups","update","setGroups","groups","editGroup","index","patch","map","group","at","editOption","groupIndex","optionIndex","options","option","problem","modifierGroupsProblem","spacing","variant","component","control","checked","posQuickKey","onChange","event","target","label","color","role","aria-label","name","sx","border","borderColor","borderRadius","p","direction","alignItems","size","flex","min","max","helperText","width","slotProps","htmlInput","inputMode","onClick","filter","_group","defaultValue","priceCents","toFixed","placeholder","onBlur","_option","length","id","disabled","POS_MAX_MODIFIER_OPTIONS","POS_MAX_MODIFIER_GROUPS"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SACEA,GAAG,EACHC,MAAM,EACNC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,IAAI,EAAEC,WAAW,QAAQ,QAAO;AACzC,YAAYC,mBAAmB,uBAAa;AAU5C,SAASC,MAAMC,MAAc;IAC3B,OAAO,GAAGA,SAASC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,KAAK,CAAC,GAAG,KAAK;AAC9D;AAEA,qDAAqD,GACrD,SAASC,iBAAiBC,KAAa;IACrC,MAAMC,SAASN,KAAKO,KAAK,CAACC,OAAOC,OAAOJ,OAAOK,OAAO,CAAC,YAAY,OAAO;IAC1E,OAAOF,OAAOG,QAAQ,CAACL,WAAWA,SAAS,IAAIA,SAAS;AAC1D;AAEA;;;;;;;;;CASC,GACD,OAAO,MAAMM,sCAAwBjB,KAAK,SAASiB,sBACjDC,KAAiC;IAEjC,MAAM,EAAEC,cAAc,EAAEC,MAAM,EAAE,GAAGF;IACnC,MAAMG,YAAYpB,YAChB,CAACqB,SAAiDF,OAAO;YAAED,gBAAgBG;QAAO,IAClF;QAACF;KAAO;IAEV,MAAMG,YAAY,CAACC,OAAeC,QAChCJ,UAAUF,eAAeO,GAAG,CAAC,CAACC,OAAOC,KAAQA,OAAOJ,QAAQ,aAAKG,OAAUF,SAAUE;IACvF,MAAME,aAAa,CACjBC,YACAC,aACAN;QAEA,MAAME,QAAQR,cAAc,CAACW,WAAW;QACxCP,UAAUO,YA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];
47
47
  seoTitle: string;
48
48
  seoDescription: string;
49
+ /**
50
+ * What one unit ships as (AGL-3612): packed size and customs facts, as the
51
+ * editor holds them. A side nobody set is `null`.
52
+ */
53
+ shipping: {
54
+ lengthCm: number | null;
55
+ widthCm: number | null;
56
+ heightCm: number | null;
57
+ hsCode: string;
58
+ originCountry: string;
59
+ };
60
+ /**
61
+ * What shopping channels ask of it (AGL-3637), as the editor holds it. A
62
+ * field nobody entered is `''`.
63
+ */
64
+ channel: {
65
+ brand: string;
66
+ gtin: string;
67
+ mpn: string;
68
+ condition: '' | 'new' | 'refurbished' | 'used';
69
+ googleProductCategory: string;
70
+ };
49
71
  }
50
72
  /**
51
73
  * Copy a widget proposes for one product. A field left out is left alone;
@@ -59,6 +81,28 @@ export interface ConsoleProductCopyValues {
59
81
  optionNames?: string[];
60
82
  seoTitle?: string;
61
83
  seoDescription?: string;
84
+ /**
85
+ * Packed size and customs facts (AGL-3612), merged over the product's; a
86
+ * side set to `null` is cleared.
87
+ */
88
+ shipping?: Partial<{
89
+ lengthCm: number | null;
90
+ widthCm: number | null;
91
+ heightCm: number | null;
92
+ hsCode: string;
93
+ originCountry: string;
94
+ }>;
95
+ /**
96
+ * Shopping-channel facts (AGL-3637), merged over the product's; a field
97
+ * set to `''` is cleared.
98
+ */
99
+ channel?: Partial<{
100
+ brand: string;
101
+ gtin: string;
102
+ mpn: string;
103
+ condition: '' | 'new' | 'refurbished' | 'used';
104
+ googleProductCategory: string;
105
+ }>;
62
106
  }
63
107
  /**
64
108
  * What the `productEditor` zone hands each widget: the product as the editor
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-zones.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 definePluginZone,\n registerPluginZone,\n} from '@aglyn/aglyn/plugin-manager/plugin-zones'\nimport { BUNDLE_ID } from '../../constants/bundle-common'\n\n/**\n * The zones this plugin hosts on its product surfaces (AGL-2916): the product\n * editor, the products hub and the import wizard's After import step.\n *\n * Each is drawn through the shell's renderer (`useConsoleWidgetSlot`), so a\n * widget there passes the same enablement, entitlement and permission gates as\n * one on a console page. The props are this plugin's words for its catalog,\n * declared on the zone's token; a widget from another plugin restates the\n * shape it reads rather than importing this package. A widget proposes and\n * never writes: every write is this plugin's, with the guards it carries.\n */\n\n/** A product type, as the commerce catalog names it. */\nexport type ConsoleProductType = 'physical' | 'digital' | 'service'\n\n/** A product option axis: its name and the values a shopper picks from. */\nexport interface ConsoleProductOption {\n name: string\n values: string[]\n}\n\n/** A product as the commerce editor holds it: saved, or staged and unsaved. */\nexport interface ConsoleProductDraft {\n /** `null` for a product nobody has saved yet. */\n id: string | null\n name: string\n type: ConsoleProductType\n description: string\n tags: string[]\n categoryIds: string[]\n options: ConsoleProductOption[]\n /** The product's media, in order; the first is the photo the storefront leads with. */\n mediaUrls: string[]\n seoTitle: string\n seoDescription: string\n}\n\n/**\n * Copy a widget proposes for one product. A field left out is left alone;\n * `optionNames` renames the product's options in order, keeping every\n * variant, and is ignored unless it names each option once.\n */\nexport interface ConsoleProductCopyValues {\n description?: string\n tags?: string[]\n categoryIds?: string[]\n optionNames?: string[]\n seoTitle?: string\n seoDescription?: string\n}\n\n/**\n * What the `productEditor` zone hands each widget: the product as the editor\n * holds it, and `proposeValues`, which stages copy in the editor as unsaved\n * edits. The zone sits under the product's description, tags and categories,\n * as the editor's search listing hosts `seoFields`. Save product is the\n * write, with the guards it carries.\n */\nexport interface ConsoleProductEditorZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n product: ConsoleProductDraft\n /** The site's categories, as the editor's picker lists them. */\n categories: ReadonlyArray<{ id: string; name: string }>\n /**\n * Stages `values` in the editor as unsaved edits under `key`. Save product\n * is what stores them; a widget never writes the product itself.\n */\n proposeValues: (values: ConsoleProductCopyValues, key: string) => void\n}\n\n/** A catalog row as the products hub holds it. */\nexport interface ConsoleProductSummary {\n id: string\n name: string\n status: 'draft' | 'active' | 'archived'\n /** Whether a variant of the product has no price yet. */\n priceMissing: boolean\n /** Whether the product has a photo. */\n hasPhoto: boolean\n}\n\n/** A new product a widget asks the hub to create, always as a draft with no price. */\nexport interface ConsoleProposedProduct {\n name: string\n type: ConsoleProductType\n description: string\n tags: string[]\n options: ConsoleProductOption[]\n seoTitle: string\n seoDescription: string\n}\n\n/** A discount a widget asks the hub to create, always switched off. */\nexport interface ConsoleProposedDiscount {\n name: string\n /** The code a shopper types, or `null` for a discount that applies on its own. */\n code: string | null\n kind: 'percent' | 'fixed' | 'free_shipping'\n valuePct: number | null\n valueCents: number | null\n minSubtotalCents: number | null\n}\n\n/**\n * What the `productsHub` zone hands each widget: the catalog rows the hub\n * holds, the products its latest import created, and the hub's own writes a\n * widget may ask it to make — copy onto saved products, new draft products,\n * categories and switched-off discounts. The zone sits above the catalog\n * table. Each write is the hub's, with its seed, allowance and slug checks; a\n * widget writes nothing itself. Every write resolves once it is stored and\n * throws with a message a person can act on when the hub refuses it: an\n * allowance the plan has no room for, a product that is gone.\n *\n * The creates are safe to ask twice: a product or a category named like one\n * the site has, and a discount with the code (or, with no code, the name) of\n * one the site has, are passed over, so a proposal applied again, by anyone,\n * creates nothing it already created.\n */\nexport interface ConsoleProductsHubZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n /** The catalog rows the hub holds, in its order. */\n products: readonly ConsoleProductSummary[]\n /**\n * The products the hub's latest import created in this visit, and the\n * options the `productImport` zone set for them; `null` before any import.\n * `key` is new for each import.\n */\n lastImport: {\n key: string\n productIds: readonly string[]\n options: Readonly<Record<string, boolean>>\n } | null\n /** Writes copy onto a saved product, read fresh from the store. */\n applyProductCopy: (productId: string, values: ConsoleProductCopyValues) => Promise<void>\n /** Creates each product as a draft with no price, and resolves with the ids it created. */\n createProductDrafts: (products: readonly ConsoleProposedProduct[]) => Promise<string[]>\n /** Creates categories by name, and resolves with how many it created. */\n createCategories: (names: readonly string[]) => Promise<number>\n /** Creates each discount switched off, and resolves with how many it created. */\n createDiscountDrafts: (discounts: readonly ConsoleProposedDiscount[]) => Promise<number>\n}\n\n/**\n * What the `productImport` zone hands each widget, in the import wizard's\n * After import step: how many products the import creates, and options a widget sets\n * for what happens to them once they land. The hub hands the options, with\n * the ids of the products the import created, to `productsHub` as its\n * `lastImport`.\n */\nexport interface ConsoleProductImportZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n /** How many products the import creates. */\n count: number\n /** The options set for this import, by key. */\n options: Readonly<Record<string, boolean>>\n /** Sets one option; the hub carries it to `productsHub` with what the import created. */\n setOption: (key: string, on: boolean) => void\n}\n\nexport const PRODUCT_EDITOR_ZONE =\n definePluginZone<ConsoleProductEditorZoneProps>('productEditor')\n\nexport const PRODUCTS_HUB_ZONE =\n definePluginZone<ConsoleProductsHubZoneProps>('productsHub')\n\nexport const PRODUCT_IMPORT_ZONE =\n definePluginZone<ConsoleProductImportZoneProps>('productImport')\n\n/**\n * What the `productsCreate` zone hands each widget (AGL-3596): the site and\n * its org. The zone sits beside Add product on the Products page and in the\n * empty catalog: another way to start a product. A widget here writes nothing\n * through the page — anything it proposes is applied through `productsHub`.\n */\nexport interface ConsoleProductsCreateZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n}\n\nexport const PRODUCTS_CREATE_ZONE =\n definePluginZone<ConsoleProductsCreateZoneProps>('productsCreate')\n\n/**\n * Declares the four zones, from the console registrar. The ids are the ones\n * widgets have always registered under, so a widget written for them keeps\n * working. Each is `bare`: the section is one item of a layout this plugin\n * draws — among the editor's fields, above the catalog table, in the import\n * wizard's After import step, in the row beside Add product — and a wrapper would add a gap the page\n * already spaces.\n */\nexport function registerCommerceZones(): void {\n const owner = { pluginId: BUNDLE_ID }\n registerPluginZone(\n {\n zone: PRODUCT_EDITOR_ZONE,\n label: 'Product editor',\n surface: 'console',\n layout: 'bare',\n description:\n 'Under a product’s description, tags and categories in the product editor. A widget here proposes copy for the fields through `proposeValues`, staged as unsaved edits; Save product is the write.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCTS_HUB_ZONE,\n label: 'Products hub',\n surface: 'console',\n layout: 'bare',\n description:\n 'Above the catalog table on the Products page. A widget here proposes copy, draft products, categories and switched-off discounts, and asks the hub to write them; every write is the hub’s, with its allowance and slug checks.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCTS_CREATE_ZONE,\n label: 'Start a product',\n surface: 'console',\n layout: 'bare',\n description:\n 'Beside Add product on the Products page, and in the empty catalog: another way to start a product. A widget here is handed the site and its org and writes nothing through the page.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCT_IMPORT_ZONE,\n label: 'Product import',\n surface: 'console',\n layout: 'bare',\n description:\n 'In the product import wizard’s After import step. A widget here sets options for what happens to the imported products once they land; the hub hands them to `productsHub` with the ids the import created.',\n },\n owner,\n )\n}\n"],"names":["definePluginZone","registerPluginZone","BUNDLE_ID","PRODUCT_EDITOR_ZONE","PRODUCTS_HUB_ZONE","PRODUCT_IMPORT_ZONE","PRODUCTS_CREATE_ZONE","registerCommerceZones","owner","pluginId","zone","label","surface","layout","description"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,gBAAgB,EAChBC,kBAAkB,QACb,2CAA0C;AACjD,SAASC,SAAS,QAAQ,mCAA+B;AAuKzD,OAAO,MAAMC,sBACXH,iBAAgD,iBAAgB;AAElE,OAAO,MAAMI,oBACXJ,iBAA8C,eAAc;AAE9D,OAAO,MAAMK,sBACXL,iBAAgD,iBAAgB;AAclE,OAAO,MAAMM,uBACXN,iBAAiD,kBAAiB;AAEpE;;;;;;;CAOC,GACD,OAAO,SAASO;IACd,MAAMC,QAAQ;QAAEC,UAAUP;IAAU;IACpCD,mBACE;QACES,MAAMP;QACNQ,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAMN;QACNO,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAMJ;QACNK,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAML;QACNM,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;AAEJ"}
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-zones.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 definePluginZone,\n registerPluginZone,\n} from '@aglyn/aglyn/plugin-manager/plugin-zones'\nimport { BUNDLE_ID } from '../../constants/bundle-common'\n\n/**\n * The zones this plugin hosts on its product surfaces (AGL-2916): the product\n * editor, the products hub and the import wizard's After import step.\n *\n * Each is drawn through the shell's renderer (`useConsoleWidgetSlot`), so a\n * widget there passes the same enablement, entitlement and permission gates as\n * one on a console page. The props are this plugin's words for its catalog,\n * declared on the zone's token; a widget from another plugin restates the\n * shape it reads rather than importing this package. A widget proposes and\n * never writes: every write is this plugin's, with the guards it carries.\n */\n\n/** A product type, as the commerce catalog names it. */\nexport type ConsoleProductType = 'physical' | 'digital' | 'service'\n\n/** A product option axis: its name and the values a shopper picks from. */\nexport interface ConsoleProductOption {\n name: string\n values: string[]\n}\n\n/** A product as the commerce editor holds it: saved, or staged and unsaved. */\nexport interface ConsoleProductDraft {\n /** `null` for a product nobody has saved yet. */\n id: string | null\n name: string\n type: ConsoleProductType\n description: string\n tags: string[]\n categoryIds: string[]\n options: ConsoleProductOption[]\n /** The product's media, in order; the first is the photo the storefront leads with. */\n mediaUrls: string[]\n seoTitle: string\n seoDescription: string\n /**\n * What one unit ships as (AGL-3612): packed size and customs facts, as the\n * editor holds them. A side nobody set is `null`.\n */\n shipping: {\n lengthCm: number | null\n widthCm: number | null\n heightCm: number | null\n hsCode: string\n originCountry: string\n }\n /**\n * What shopping channels ask of it (AGL-3637), as the editor holds it. A\n * field nobody entered is `''`.\n */\n channel: {\n brand: string\n gtin: string\n mpn: string\n condition: '' | 'new' | 'refurbished' | 'used'\n googleProductCategory: string\n }\n}\n\n/**\n * Copy a widget proposes for one product. A field left out is left alone;\n * `optionNames` renames the product's options in order, keeping every\n * variant, and is ignored unless it names each option once.\n */\nexport interface ConsoleProductCopyValues {\n description?: string\n tags?: string[]\n categoryIds?: string[]\n optionNames?: string[]\n seoTitle?: string\n seoDescription?: string\n /**\n * Packed size and customs facts (AGL-3612), merged over the product's; a\n * side set to `null` is cleared.\n */\n shipping?: Partial<{\n lengthCm: number | null\n widthCm: number | null\n heightCm: number | null\n hsCode: string\n originCountry: string\n }>\n /**\n * Shopping-channel facts (AGL-3637), merged over the product's; a field\n * set to `''` is cleared.\n */\n channel?: Partial<{\n brand: string\n gtin: string\n mpn: string\n condition: '' | 'new' | 'refurbished' | 'used'\n googleProductCategory: string\n }>\n}\n\n/**\n * What the `productEditor` zone hands each widget: the product as the editor\n * holds it, and `proposeValues`, which stages copy in the editor as unsaved\n * edits. The zone sits under the product's description, tags and categories,\n * as the editor's search listing hosts `seoFields`. Save product is the\n * write, with the guards it carries.\n */\nexport interface ConsoleProductEditorZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n product: ConsoleProductDraft\n /** The site's categories, as the editor's picker lists them. */\n categories: ReadonlyArray<{ id: string; name: string }>\n /**\n * Stages `values` in the editor as unsaved edits under `key`. Save product\n * is what stores them; a widget never writes the product itself.\n */\n proposeValues: (values: ConsoleProductCopyValues, key: string) => void\n}\n\n/** A catalog row as the products hub holds it. */\nexport interface ConsoleProductSummary {\n id: string\n name: string\n status: 'draft' | 'active' | 'archived'\n /** Whether a variant of the product has no price yet. */\n priceMissing: boolean\n /** Whether the product has a photo. */\n hasPhoto: boolean\n}\n\n/** A new product a widget asks the hub to create, always as a draft with no price. */\nexport interface ConsoleProposedProduct {\n name: string\n type: ConsoleProductType\n description: string\n tags: string[]\n options: ConsoleProductOption[]\n seoTitle: string\n seoDescription: string\n}\n\n/** A discount a widget asks the hub to create, always switched off. */\nexport interface ConsoleProposedDiscount {\n name: string\n /** The code a shopper types, or `null` for a discount that applies on its own. */\n code: string | null\n kind: 'percent' | 'fixed' | 'free_shipping'\n valuePct: number | null\n valueCents: number | null\n minSubtotalCents: number | null\n}\n\n/**\n * What the `productsHub` zone hands each widget: the catalog rows the hub\n * holds, the products its latest import created, and the hub's own writes a\n * widget may ask it to make — copy onto saved products, new draft products,\n * categories and switched-off discounts. The zone sits above the catalog\n * table. Each write is the hub's, with its seed, allowance and slug checks; a\n * widget writes nothing itself. Every write resolves once it is stored and\n * throws with a message a person can act on when the hub refuses it: an\n * allowance the plan has no room for, a product that is gone.\n *\n * The creates are safe to ask twice: a product or a category named like one\n * the site has, and a discount with the code (or, with no code, the name) of\n * one the site has, are passed over, so a proposal applied again, by anyone,\n * creates nothing it already created.\n */\nexport interface ConsoleProductsHubZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n /** The catalog rows the hub holds, in its order. */\n products: readonly ConsoleProductSummary[]\n /**\n * The products the hub's latest import created in this visit, and the\n * options the `productImport` zone set for them; `null` before any import.\n * `key` is new for each import.\n */\n lastImport: {\n key: string\n productIds: readonly string[]\n options: Readonly<Record<string, boolean>>\n } | null\n /** Writes copy onto a saved product, read fresh from the store. */\n applyProductCopy: (productId: string, values: ConsoleProductCopyValues) => Promise<void>\n /** Creates each product as a draft with no price, and resolves with the ids it created. */\n createProductDrafts: (products: readonly ConsoleProposedProduct[]) => Promise<string[]>\n /** Creates categories by name, and resolves with how many it created. */\n createCategories: (names: readonly string[]) => Promise<number>\n /** Creates each discount switched off, and resolves with how many it created. */\n createDiscountDrafts: (discounts: readonly ConsoleProposedDiscount[]) => Promise<number>\n}\n\n/**\n * What the `productImport` zone hands each widget, in the import wizard's\n * After import step: how many products the import creates, and options a widget sets\n * for what happens to them once they land. The hub hands the options, with\n * the ids of the products the import created, to `productsHub` as its\n * `lastImport`.\n */\nexport interface ConsoleProductImportZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n /** How many products the import creates. */\n count: number\n /** The options set for this import, by key. */\n options: Readonly<Record<string, boolean>>\n /** Sets one option; the hub carries it to `productsHub` with what the import created. */\n setOption: (key: string, on: boolean) => void\n}\n\nexport const PRODUCT_EDITOR_ZONE =\n definePluginZone<ConsoleProductEditorZoneProps>('productEditor')\n\nexport const PRODUCTS_HUB_ZONE =\n definePluginZone<ConsoleProductsHubZoneProps>('productsHub')\n\nexport const PRODUCT_IMPORT_ZONE =\n definePluginZone<ConsoleProductImportZoneProps>('productImport')\n\n/**\n * What the `productsCreate` zone hands each widget (AGL-3596): the site and\n * its org. The zone sits beside Add product on the Products page and in the\n * empty catalog: another way to start a product. A widget here writes nothing\n * through the page — anything it proposes is applied through `productsHub`.\n */\nexport interface ConsoleProductsCreateZoneProps {\n hostId: string\n /** The org the page names; `undefined` where the host does not know it. */\n orgId: string | undefined\n}\n\nexport const PRODUCTS_CREATE_ZONE =\n definePluginZone<ConsoleProductsCreateZoneProps>('productsCreate')\n\n/**\n * Declares the four zones, from the console registrar. The ids are the ones\n * widgets have always registered under, so a widget written for them keeps\n * working. Each is `bare`: the section is one item of a layout this plugin\n * draws — among the editor's fields, above the catalog table, in the import\n * wizard's After import step, in the row beside Add product — and a wrapper would add a gap the page\n * already spaces.\n */\nexport function registerCommerceZones(): void {\n const owner = { pluginId: BUNDLE_ID }\n registerPluginZone(\n {\n zone: PRODUCT_EDITOR_ZONE,\n label: 'Product editor',\n surface: 'console',\n layout: 'bare',\n description:\n 'Under a product’s description, tags and categories in the product editor. A widget here proposes copy for the fields through `proposeValues`, staged as unsaved edits; Save product is the write.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCTS_HUB_ZONE,\n label: 'Products hub',\n surface: 'console',\n layout: 'bare',\n description:\n 'Above the catalog table on the Products page. A widget here proposes copy, draft products, categories and switched-off discounts, and asks the hub to write them; every write is the hub’s, with its allowance and slug checks.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCTS_CREATE_ZONE,\n label: 'Start a product',\n surface: 'console',\n layout: 'bare',\n description:\n 'Beside Add product on the Products page, and in the empty catalog: another way to start a product. A widget here is handed the site and its org and writes nothing through the page.',\n },\n owner,\n )\n registerPluginZone(\n {\n zone: PRODUCT_IMPORT_ZONE,\n label: 'Product import',\n surface: 'console',\n layout: 'bare',\n description:\n 'In the product import wizard’s After import step. A widget here sets options for what happens to the imported products once they land; the hub hands them to `productsHub` with the ids the import created.',\n },\n owner,\n )\n}\n"],"names":["definePluginZone","registerPluginZone","BUNDLE_ID","PRODUCT_EDITOR_ZONE","PRODUCTS_HUB_ZONE","PRODUCT_IMPORT_ZONE","PRODUCTS_CREATE_ZONE","registerCommerceZones","owner","pluginId","zone","label","surface","layout","description"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,gBAAgB,EAChBC,kBAAkB,QACb,2CAA0C;AACjD,SAASC,SAAS,QAAQ,mCAA+B;AAmNzD,OAAO,MAAMC,sBACXH,iBAAgD,iBAAgB;AAElE,OAAO,MAAMI,oBACXJ,iBAA8C,eAAc;AAE9D,OAAO,MAAMK,sBACXL,iBAAgD,iBAAgB;AAclE,OAAO,MAAMM,uBACXN,iBAAiD,kBAAiB;AAEpE;;;;;;;CAOC,GACD,OAAO,SAASO;IACd,MAAMC,QAAQ;QAAEC,UAAUP;IAAU;IACpCD,mBACE;QACES,MAAMP;QACNQ,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAMN;QACNO,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAMJ;QACNK,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;IAEFP,mBACE;QACES,MAAML;QACNM,OAAO;QACPC,SAAS;QACTC,QAAQ;QACRC,aACE;IACJ,GACAN;AAEJ"}