@aglyn/plugins-commerce 1.0.0-beta.143

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 (417) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +10 -0
  3. package/package.json +57 -0
  4. package/src/index.d.ts +38 -0
  5. package/src/index.js +38 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/account.d.ts +31 -0
  8. package/src/lib/components/account.js +645 -0
  9. package/src/lib/components/account.js.map +1 -0
  10. package/src/lib/components/cart.d.ts +38 -0
  11. package/src/lib/components/cart.js +851 -0
  12. package/src/lib/components/cart.js.map +1 -0
  13. package/src/lib/components/commerce-console-page.d.ts +32 -0
  14. package/src/lib/components/commerce-console-page.js +296 -0
  15. package/src/lib/components/commerce-console-page.js.map +1 -0
  16. package/src/lib/components/commerce-console-sections.d.ts +34 -0
  17. package/src/lib/components/commerce-console-sections.js +62 -0
  18. package/src/lib/components/commerce-console-sections.js.map +1 -0
  19. package/src/lib/components/console/catalog-organization-card.component.d.ts +14 -0
  20. package/src/lib/components/console/catalog-organization-card.component.js +1087 -0
  21. package/src/lib/components/console/catalog-organization-card.component.js.map +1 -0
  22. package/src/lib/components/console/commerce-analytics-card.component.d.ts +27 -0
  23. package/src/lib/components/console/commerce-analytics-card.component.js +310 -0
  24. package/src/lib/components/console/commerce-analytics-card.component.js.map +1 -0
  25. package/src/lib/components/console/commerce-glance-card.component.d.ts +20 -0
  26. package/src/lib/components/console/commerce-glance-card.component.js +340 -0
  27. package/src/lib/components/console/commerce-glance-card.component.js.map +1 -0
  28. package/src/lib/components/console/commerce-stat-tile.component.d.ts +37 -0
  29. package/src/lib/components/console/commerce-stat-tile.component.js +72 -0
  30. package/src/lib/components/console/commerce-stat-tile.component.js.map +1 -0
  31. package/src/lib/components/console/discounts-card.component.d.ts +14 -0
  32. package/src/lib/components/console/discounts-card.component.js +443 -0
  33. package/src/lib/components/console/discounts-card.component.js.map +1 -0
  34. package/src/lib/components/console/entitlement-gate.component.d.ts +76 -0
  35. package/src/lib/components/console/entitlement-gate.component.js +115 -0
  36. package/src/lib/components/console/entitlement-gate.component.js.map +1 -0
  37. package/src/lib/components/console/gift-cards-card.component.d.ts +29 -0
  38. package/src/lib/components/console/gift-cards-card.component.js +379 -0
  39. package/src/lib/components/console/gift-cards-card.component.js.map +1 -0
  40. package/src/lib/components/console/host-coupons-card.component.d.ts +14 -0
  41. package/src/lib/components/console/host-coupons-card.component.js +252 -0
  42. package/src/lib/components/console/host-coupons-card.component.js.map +1 -0
  43. package/src/lib/components/console/host-orders-card.component.d.ts +13 -0
  44. package/src/lib/components/console/host-orders-card.component.js +861 -0
  45. package/src/lib/components/console/host-orders-card.component.js.map +1 -0
  46. package/src/lib/components/console/locations-card.component.d.ts +14 -0
  47. package/src/lib/components/console/locations-card.component.js +256 -0
  48. package/src/lib/components/console/locations-card.component.js.map +1 -0
  49. package/src/lib/components/console/member-posts-card.component.d.ts +8 -0
  50. package/src/lib/components/console/member-posts-card.component.js +283 -0
  51. package/src/lib/components/console/member-posts-card.component.js.map +1 -0
  52. package/src/lib/components/console/newest-site-users-card.component.d.ts +36 -0
  53. package/src/lib/components/console/newest-site-users-card.component.js +126 -0
  54. package/src/lib/components/console/newest-site-users-card.component.js.map +1 -0
  55. package/src/lib/components/console/order-detail-dialog.component.d.ts +28 -0
  56. package/src/lib/components/console/order-detail-dialog.component.js +976 -0
  57. package/src/lib/components/console/order-detail-dialog.component.js.map +1 -0
  58. package/src/lib/components/console/paid-media.d.ts +127 -0
  59. package/src/lib/components/console/paid-media.js +397 -0
  60. package/src/lib/components/console/paid-media.js.map +1 -0
  61. package/src/lib/components/console/payments-settings-card.component.d.ts +13 -0
  62. package/src/lib/components/console/payments-settings-card.component.js +295 -0
  63. package/src/lib/components/console/payments-settings-card.component.js.map +1 -0
  64. package/src/lib/components/console/pos-page.component.d.ts +13 -0
  65. package/src/lib/components/console/pos-page.component.js +916 -0
  66. package/src/lib/components/console/pos-page.component.js.map +1 -0
  67. package/src/lib/components/console/product-editor-dialog.component.d.ts +32 -0
  68. package/src/lib/components/console/product-editor-dialog.component.js +1374 -0
  69. package/src/lib/components/console/product-editor-dialog.component.js.map +1 -0
  70. package/src/lib/components/console/products-hub-card.component.d.ts +16 -0
  71. package/src/lib/components/console/products-hub-card.component.js +1280 -0
  72. package/src/lib/components/console/products-hub-card.component.js.map +1 -0
  73. package/src/lib/components/console/products-hub-zone.component.d.ts +50 -0
  74. package/src/lib/components/console/products-hub-zone.component.js +200 -0
  75. package/src/lib/components/console/products-hub-zone.component.js.map +1 -0
  76. package/src/lib/components/console/recovery-queue-card.component.d.ts +39 -0
  77. package/src/lib/components/console/recovery-queue-card.component.js +262 -0
  78. package/src/lib/components/console/recovery-queue-card.component.js.map +1 -0
  79. package/src/lib/components/console/registers-card.component.d.ts +21 -0
  80. package/src/lib/components/console/registers-card.component.js +296 -0
  81. package/src/lib/components/console/registers-card.component.js.map +1 -0
  82. package/src/lib/components/console/reservations-card.component.d.ts +14 -0
  83. package/src/lib/components/console/reservations-card.component.js +650 -0
  84. package/src/lib/components/console/reservations-card.component.js.map +1 -0
  85. package/src/lib/components/console/reviews-moderation-card.component.d.ts +8 -0
  86. package/src/lib/components/console/reviews-moderation-card.component.js +235 -0
  87. package/src/lib/components/console/reviews-moderation-card.component.js.map +1 -0
  88. package/src/lib/components/console/shipping-settings-card.component.d.ts +38 -0
  89. package/src/lib/components/console/shipping-settings-card.component.js +560 -0
  90. package/src/lib/components/console/shipping-settings-card.component.js.map +1 -0
  91. package/src/lib/components/console/stock-movements-card.component.d.ts +31 -0
  92. package/src/lib/components/console/stock-movements-card.component.js +333 -0
  93. package/src/lib/components/console/stock-movements-card.component.js.map +1 -0
  94. package/src/lib/components/console/store-settings-card.component.d.ts +14 -0
  95. package/src/lib/components/console/store-settings-card.component.js +300 -0
  96. package/src/lib/components/console/store-settings-card.component.js.map +1 -0
  97. package/src/lib/components/console/storefront-tax-summary-card.component.d.ts +73 -0
  98. package/src/lib/components/console/storefront-tax-summary-card.component.js +408 -0
  99. package/src/lib/components/console/storefront-tax-summary-card.component.js.map +1 -0
  100. package/src/lib/components/console/suppliers-card.component.d.ts +8 -0
  101. package/src/lib/components/console/suppliers-card.component.js +328 -0
  102. package/src/lib/components/console/suppliers-card.component.js.map +1 -0
  103. package/src/lib/components/console/tax-settings-card.component.d.ts +14 -0
  104. package/src/lib/components/console/tax-settings-card.component.js +473 -0
  105. package/src/lib/components/console/tax-settings-card.component.js.map +1 -0
  106. package/src/lib/components/gate.d.ts +39 -0
  107. package/src/lib/components/gate.js +202 -0
  108. package/src/lib/components/gate.js.map +1 -0
  109. package/src/lib/components/gated-video.d.ts +40 -0
  110. package/src/lib/components/gated-video.js +366 -0
  111. package/src/lib/components/gated-video.js.map +1 -0
  112. package/src/lib/components/member-feed.d.ts +32 -0
  113. package/src/lib/components/member-feed.js +198 -0
  114. package/src/lib/components/member-feed.js.map +1 -0
  115. package/src/lib/components/member-recovery.d.ts +35 -0
  116. package/src/lib/components/member-recovery.js +313 -0
  117. package/src/lib/components/member-recovery.js.map +1 -0
  118. package/src/lib/components/member-signin.d.ts +35 -0
  119. package/src/lib/components/member-signin.js +257 -0
  120. package/src/lib/components/member-signin.js.map +1 -0
  121. package/src/lib/components/member-signup.d.ts +34 -0
  122. package/src/lib/components/member-signup.js +287 -0
  123. package/src/lib/components/member-signup.js.map +1 -0
  124. package/src/lib/components/newsletter-signup.d.ts +39 -0
  125. package/src/lib/components/newsletter-signup.js +229 -0
  126. package/src/lib/components/newsletter-signup.js.map +1 -0
  127. package/src/lib/components/product-detail.d.ts +38 -0
  128. package/src/lib/components/product-detail.js +1022 -0
  129. package/src/lib/components/product-detail.js.map +1 -0
  130. package/src/lib/components/product-grid.d.ts +67 -0
  131. package/src/lib/components/product-grid.js +909 -0
  132. package/src/lib/components/product-grid.js.map +1 -0
  133. package/src/lib/components/product-reviews.d.ts +32 -0
  134. package/src/lib/components/product-reviews.js +349 -0
  135. package/src/lib/components/product-reviews.js.map +1 -0
  136. package/src/lib/components/related-products.d.ts +33 -0
  137. package/src/lib/components/related-products.js +232 -0
  138. package/src/lib/components/related-products.js.map +1 -0
  139. package/src/lib/components/reservation-widget.d.ts +33 -0
  140. package/src/lib/components/reservation-widget.js +418 -0
  141. package/src/lib/components/reservation-widget.js.map +1 -0
  142. package/src/lib/components/storefront-payment-element-fallback.d.ts +18 -0
  143. package/src/lib/components/storefront-payment-element-fallback.js +51 -0
  144. package/src/lib/components/storefront-payment-element-fallback.js.map +1 -0
  145. package/src/lib/components/storefront-payment-element.d.ts +78 -0
  146. package/src/lib/components/storefront-payment-element.js +156 -0
  147. package/src/lib/components/storefront-payment-element.js.map +1 -0
  148. package/src/lib/components/wishlist.d.ts +46 -0
  149. package/src/lib/components/wishlist.js +304 -0
  150. package/src/lib/components/wishlist.js.map +1 -0
  151. package/src/lib/constants/bundle-common.d.ts +18 -0
  152. package/src/lib/constants/bundle-common.js +18 -0
  153. package/src/lib/constants/bundle-common.js.map +1 -0
  154. package/src/lib/constants/product-filters.d.ts +35 -0
  155. package/src/lib/constants/product-filters.js +109 -0
  156. package/src/lib/constants/product-filters.js.map +1 -0
  157. package/src/lib/model/commerce-cart.d.ts +52 -0
  158. package/src/lib/model/commerce-cart.js +102 -0
  159. package/src/lib/model/commerce-cart.js.map +1 -0
  160. package/src/lib/model/commerce-connect-transfer.d.ts +243 -0
  161. package/src/lib/model/commerce-connect-transfer.js +231 -0
  162. package/src/lib/model/commerce-connect-transfer.js.map +1 -0
  163. package/src/lib/model/commerce-discounts.d.ts +164 -0
  164. package/src/lib/model/commerce-discounts.js +231 -0
  165. package/src/lib/model/commerce-discounts.js.map +1 -0
  166. package/src/lib/model/commerce-dispute.d.ts +124 -0
  167. package/src/lib/model/commerce-dispute.js +225 -0
  168. package/src/lib/model/commerce-dispute.js.map +1 -0
  169. package/src/lib/model/commerce-gift-cards.d.ts +107 -0
  170. package/src/lib/model/commerce-gift-cards.js +121 -0
  171. package/src/lib/model/commerce-gift-cards.js.map +1 -0
  172. package/src/lib/model/commerce-io.d.ts +36 -0
  173. package/src/lib/model/commerce-io.js +245 -0
  174. package/src/lib/model/commerce-io.js.map +1 -0
  175. package/src/lib/model/commerce-orders.d.ts +1040 -0
  176. package/src/lib/model/commerce-orders.js +1022 -0
  177. package/src/lib/model/commerce-orders.js.map +1 -0
  178. package/src/lib/model/commerce-promotions.d.ts +188 -0
  179. package/src/lib/model/commerce-promotions.js +199 -0
  180. package/src/lib/model/commerce-promotions.js.map +1 -0
  181. package/src/lib/model/commerce-reservations.d.ts +175 -0
  182. package/src/lib/model/commerce-reservations.js +157 -0
  183. package/src/lib/model/commerce-reservations.js.map +1 -0
  184. package/src/lib/model/commerce-shipping.d.ts +316 -0
  185. package/src/lib/model/commerce-shipping.js +484 -0
  186. package/src/lib/model/commerce-shipping.js.map +1 -0
  187. package/src/lib/model/commerce-stock-holds.d.ts +199 -0
  188. package/src/lib/model/commerce-stock-holds.js +190 -0
  189. package/src/lib/model/commerce-stock-holds.js.map +1 -0
  190. package/src/lib/model/commerce-subscription-status.d.ts +67 -0
  191. package/src/lib/model/commerce-subscription-status.js +76 -0
  192. package/src/lib/model/commerce-subscription-status.js.map +1 -0
  193. package/src/lib/model/commerce-tax-decision.d.ts +222 -0
  194. package/src/lib/model/commerce-tax-decision.js +165 -0
  195. package/src/lib/model/commerce-tax-decision.js.map +1 -0
  196. package/src/lib/model/commerce-tax.d.ts +176 -0
  197. package/src/lib/model/commerce-tax.js +92 -0
  198. package/src/lib/model/commerce-tax.js.map +1 -0
  199. package/src/lib/model/commerce.d.ts +551 -0
  200. package/src/lib/model/commerce.js +739 -0
  201. package/src/lib/model/commerce.js.map +1 -0
  202. package/src/lib/model/index.d.ts +40 -0
  203. package/src/lib/model/index.js +40 -0
  204. package/src/lib/model/index.js.map +1 -0
  205. package/src/lib/model/order-figures.d.ts +48 -0
  206. package/src/lib/model/order-figures.js +74 -0
  207. package/src/lib/model/order-figures.js.map +1 -0
  208. package/src/lib/model/plugin-permissions.d.ts +23 -0
  209. package/src/lib/model/plugin-permissions.js +34 -0
  210. package/src/lib/model/plugin-permissions.js.map +1 -0
  211. package/src/lib/model/purchase-analytics.d.ts +186 -0
  212. package/src/lib/model/purchase-analytics.js +216 -0
  213. package/src/lib/model/purchase-analytics.js.map +1 -0
  214. package/src/lib/plugin-config.d.ts +62 -0
  215. package/src/lib/plugin-config.js +78 -0
  216. package/src/lib/plugin-config.js.map +1 -0
  217. package/src/lib/plugin.d.ts +28 -0
  218. package/src/lib/plugin.js +147 -0
  219. package/src/lib/plugin.js.map +1 -0
  220. package/src/lib/server/billing-webhook.d.ts +26 -0
  221. package/src/lib/server/billing-webhook.js +4011 -0
  222. package/src/lib/server/billing-webhook.js.map +1 -0
  223. package/src/lib/server/cancel-order.d.ts +87 -0
  224. package/src/lib/server/cancel-order.js +368 -0
  225. package/src/lib/server/cancel-order.js.map +1 -0
  226. package/src/lib/server/cart-checkout.d.ts +25 -0
  227. package/src/lib/server/cart-checkout.js +976 -0
  228. package/src/lib/server/cart-checkout.js.map +1 -0
  229. package/src/lib/server/cart-cookie.d.ts +32 -0
  230. package/src/lib/server/cart-cookie.js +77 -0
  231. package/src/lib/server/cart-cookie.js.map +1 -0
  232. package/src/lib/server/cart.d.ts +34 -0
  233. package/src/lib/server/cart.js +181 -0
  234. package/src/lib/server/cart.js.map +1 -0
  235. package/src/lib/server/catalog.d.ts +127 -0
  236. package/src/lib/server/catalog.js +277 -0
  237. package/src/lib/server/catalog.js.map +1 -0
  238. package/src/lib/server/checkout.d.ts +36 -0
  239. package/src/lib/server/checkout.js +915 -0
  240. package/src/lib/server/checkout.js.map +1 -0
  241. package/src/lib/server/connect.d.ts +26 -0
  242. package/src/lib/server/connect.js +238 -0
  243. package/src/lib/server/connect.js.map +1 -0
  244. package/src/lib/server/contact-refund.d.ts +117 -0
  245. package/src/lib/server/contact-refund.js +196 -0
  246. package/src/lib/server/contact-refund.js.map +1 -0
  247. package/src/lib/server/download.d.ts +39 -0
  248. package/src/lib/server/download.js +206 -0
  249. package/src/lib/server/download.js.map +1 -0
  250. package/src/lib/server/draft-order.d.ts +26 -0
  251. package/src/lib/server/draft-order.js +706 -0
  252. package/src/lib/server/draft-order.js.map +1 -0
  253. package/src/lib/server/feed.d.ts +24 -0
  254. package/src/lib/server/feed.js +59 -0
  255. package/src/lib/server/feed.js.map +1 -0
  256. package/src/lib/server/fulfill-order.d.ts +97 -0
  257. package/src/lib/server/fulfill-order.js +235 -0
  258. package/src/lib/server/fulfill-order.js.map +1 -0
  259. package/src/lib/server/gate.d.ts +36 -0
  260. package/src/lib/server/gate.js +112 -0
  261. package/src/lib/server/gate.js.map +1 -0
  262. package/src/lib/server/gift-cards.d.ts +42 -0
  263. package/src/lib/server/gift-cards.js +219 -0
  264. package/src/lib/server/gift-cards.js.map +1 -0
  265. package/src/lib/server/low-stock.d.ts +49 -0
  266. package/src/lib/server/low-stock.js +60 -0
  267. package/src/lib/server/low-stock.js.map +1 -0
  268. package/src/lib/server/manual-tax-rate.d.ts +82 -0
  269. package/src/lib/server/manual-tax-rate.js +113 -0
  270. package/src/lib/server/manual-tax-rate.js.map +1 -0
  271. package/src/lib/server/member-feed.d.ts +24 -0
  272. package/src/lib/server/member-feed.js +72 -0
  273. package/src/lib/server/member-feed.js.map +1 -0
  274. package/src/lib/server/member-name-search.d.ts +37 -0
  275. package/src/lib/server/member-name-search.js +42 -0
  276. package/src/lib/server/member-name-search.js.map +1 -0
  277. package/src/lib/server/member-post.d.ts +23 -0
  278. package/src/lib/server/member-post.js +166 -0
  279. package/src/lib/server/member-post.js.map +1 -0
  280. package/src/lib/server/membership-account.d.ts +37 -0
  281. package/src/lib/server/membership-account.js +148 -0
  282. package/src/lib/server/membership-account.js.map +1 -0
  283. package/src/lib/server/membership-admin-password.d.ts +33 -0
  284. package/src/lib/server/membership-admin-password.js +202 -0
  285. package/src/lib/server/membership-admin-password.js.map +1 -0
  286. package/src/lib/server/membership-content.d.ts +23 -0
  287. package/src/lib/server/membership-content.js +105 -0
  288. package/src/lib/server/membership-content.js.map +1 -0
  289. package/src/lib/server/membership-login.d.ts +19 -0
  290. package/src/lib/server/membership-login.js +137 -0
  291. package/src/lib/server/membership-login.js.map +1 -0
  292. package/src/lib/server/membership-logout.d.ts +19 -0
  293. package/src/lib/server/membership-logout.js +35 -0
  294. package/src/lib/server/membership-logout.js.map +1 -0
  295. package/src/lib/server/membership-recover.d.ts +60 -0
  296. package/src/lib/server/membership-recover.js +244 -0
  297. package/src/lib/server/membership-recover.js.map +1 -0
  298. package/src/lib/server/membership-register.d.ts +22 -0
  299. package/src/lib/server/membership-register.js +241 -0
  300. package/src/lib/server/membership-register.js.map +1 -0
  301. package/src/lib/server/membership-reset.d.ts +26 -0
  302. package/src/lib/server/membership-reset.js +88 -0
  303. package/src/lib/server/membership-reset.js.map +1 -0
  304. package/src/lib/server/membership-wishlist.d.ts +23 -0
  305. package/src/lib/server/membership-wishlist.js +89 -0
  306. package/src/lib/server/membership-wishlist.js.map +1 -0
  307. package/src/lib/server/membership.d.ts +96 -0
  308. package/src/lib/server/membership.js +222 -0
  309. package/src/lib/server/membership.js.map +1 -0
  310. package/src/lib/server/native-checkout.d.ts +170 -0
  311. package/src/lib/server/native-checkout.js +193 -0
  312. package/src/lib/server/native-checkout.js.map +1 -0
  313. package/src/lib/server/newsletter.d.ts +23 -0
  314. package/src/lib/server/newsletter.js +323 -0
  315. package/src/lib/server/newsletter.js.map +1 -0
  316. package/src/lib/server/notify-restock.d.ts +22 -0
  317. package/src/lib/server/notify-restock.js +84 -0
  318. package/src/lib/server/notify-restock.js.map +1 -0
  319. package/src/lib/server/order-analytics.d.ts +134 -0
  320. package/src/lib/server/order-analytics.js +263 -0
  321. package/src/lib/server/order-analytics.js.map +1 -0
  322. package/src/lib/server/order-figures.d.ts +33 -0
  323. package/src/lib/server/order-figures.js +220 -0
  324. package/src/lib/server/order-figures.js.map +1 -0
  325. package/src/lib/server/paid-media-delivery.d.ts +173 -0
  326. package/src/lib/server/paid-media-delivery.js +212 -0
  327. package/src/lib/server/paid-media-delivery.js.map +1 -0
  328. package/src/lib/server/pos-order.d.ts +54 -0
  329. package/src/lib/server/pos-order.js +1137 -0
  330. package/src/lib/server/pos-order.js.map +1 -0
  331. package/src/lib/server/process-abandoned.d.ts +54 -0
  332. package/src/lib/server/process-abandoned.js +222 -0
  333. package/src/lib/server/process-abandoned.js.map +1 -0
  334. package/src/lib/server/process-restock.d.ts +42 -0
  335. package/src/lib/server/process-restock.js +219 -0
  336. package/src/lib/server/process-restock.js.map +1 -0
  337. package/src/lib/server/product-card.d.ts +29 -0
  338. package/src/lib/server/product-card.js +54 -0
  339. package/src/lib/server/product-card.js.map +1 -0
  340. package/src/lib/server/product.d.ts +70 -0
  341. package/src/lib/server/product.js +105 -0
  342. package/src/lib/server/product.js.map +1 -0
  343. package/src/lib/server/promotion-hold.d.ts +144 -0
  344. package/src/lib/server/promotion-hold.js +174 -0
  345. package/src/lib/server/promotion-hold.js.map +1 -0
  346. package/src/lib/server/reconcile-stock.d.ts +106 -0
  347. package/src/lib/server/reconcile-stock.js +349 -0
  348. package/src/lib/server/reconcile-stock.js.map +1 -0
  349. package/src/lib/server/refund.d.ts +45 -0
  350. package/src/lib/server/refund.js +607 -0
  351. package/src/lib/server/refund.js.map +1 -0
  352. package/src/lib/server/related.d.ts +24 -0
  353. package/src/lib/server/related.js +104 -0
  354. package/src/lib/server/related.js.map +1 -0
  355. package/src/lib/server/reservation-availability.d.ts +23 -0
  356. package/src/lib/server/reservation-availability.js +111 -0
  357. package/src/lib/server/reservation-availability.js.map +1 -0
  358. package/src/lib/server/reserve-stock.d.ts +156 -0
  359. package/src/lib/server/reserve-stock.js +146 -0
  360. package/src/lib/server/reserve-stock.js.map +1 -0
  361. package/src/lib/server/reserve.d.ts +25 -0
  362. package/src/lib/server/reserve.js +426 -0
  363. package/src/lib/server/reserve.js.map +1 -0
  364. package/src/lib/server/restock-flag.d.ts +202 -0
  365. package/src/lib/server/restock-flag.js +449 -0
  366. package/src/lib/server/restock-flag.js.map +1 -0
  367. package/src/lib/server/reviews.d.ts +51 -0
  368. package/src/lib/server/reviews.js +132 -0
  369. package/src/lib/server/reviews.js.map +1 -0
  370. package/src/lib/server/site-page-enricher.d.ts +42 -0
  371. package/src/lib/server/site-page-enricher.js +149 -0
  372. package/src/lib/server/site-page-enricher.js.map +1 -0
  373. package/src/lib/server/site-page-resolver.d.ts +26 -0
  374. package/src/lib/server/site-page-resolver.js +223 -0
  375. package/src/lib/server/site-page-resolver.js.map +1 -0
  376. package/src/lib/server/stock-hold.d.ts +127 -0
  377. package/src/lib/server/stock-hold.js +258 -0
  378. package/src/lib/server/stock-hold.js.map +1 -0
  379. package/src/lib/server/storefront-tax-record.d.ts +22 -0
  380. package/src/lib/server/storefront-tax-record.js +218 -0
  381. package/src/lib/server/storefront-tax-record.js.map +1 -0
  382. package/src/lib/server/storefront-tax.d.ts +197 -0
  383. package/src/lib/server/storefront-tax.js +245 -0
  384. package/src/lib/server/storefront-tax.js.map +1 -0
  385. package/src/lib/server/stream.d.ts +25 -0
  386. package/src/lib/server/stream.js +191 -0
  387. package/src/lib/server/stream.js.map +1 -0
  388. package/src/lib/server/subscription-portal.d.ts +24 -0
  389. package/src/lib/server/subscription-portal.js +91 -0
  390. package/src/lib/server/subscription-portal.js.map +1 -0
  391. package/src/lib/server/supplier-outbox.d.ts +190 -0
  392. package/src/lib/server/supplier-outbox.js +342 -0
  393. package/src/lib/server/supplier-outbox.js.map +1 -0
  394. package/src/lib/server/supplier-update.d.ts +23 -0
  395. package/src/lib/server/supplier-update.js +289 -0
  396. package/src/lib/server/supplier-update.js.map +1 -0
  397. package/src/lib/server/tax-profile.d.ts +29 -0
  398. package/src/lib/server/tax-profile.js +40 -0
  399. package/src/lib/server/tax-profile.js.map +1 -0
  400. package/src/lib/server.d.ts +32 -0
  401. package/src/lib/server.js +311 -0
  402. package/src/lib/server.js.map +1 -0
  403. package/src/lib/site.d.ts +27 -0
  404. package/src/lib/site.js +134 -0
  405. package/src/lib/site.js.map +1 -0
  406. package/src/lib/utils/escape-html.d.ts +41 -0
  407. package/src/lib/utils/escape-html.js +41 -0
  408. package/src/lib/utils/escape-html.js.map +1 -0
  409. package/src/lib/utils/generate-preset-id.d.ts +19 -0
  410. package/src/lib/utils/generate-preset-id.js +25 -0
  411. package/src/lib/utils/generate-preset-id.js.map +1 -0
  412. package/src/lib/utils/member-continue.d.ts +45 -0
  413. package/src/lib/utils/member-continue.js +49 -0
  414. package/src/lib/utils/member-continue.js.map +1 -0
  415. package/src/lib/utils/use-storefront-purchase-event.d.ts +60 -0
  416. package/src/lib/utils/use-storefront-purchase-event.js +142 -0
  417. package/src/lib/utils/use-storefront-purchase-event.js.map +1 -0
@@ -0,0 +1,31 @@
1
+ export interface StockMovementsCardProps {
2
+ hostId: string;
3
+ }
4
+ /**
5
+ * Stock movements (AGL-2341) — the adjustment history that had no history
6
+ * view.
7
+ *
8
+ * `hosts/{hostId}/inventoryAdjustments` has five writers: the products hub's
9
+ * "Adjust stock" dialog, the sale path in `billing-webhook.ts`, the POS in
10
+ * `pos-order.ts`, and the restock in `cancel-order.ts`. The hub's own comment
11
+ * calls the collection "adjustment history".
12
+ *
13
+ * Its only reader was arithmetic: `cancel-order.ts` projects `appliedDelta`
14
+ * off the `reason: 'sale'` rows to cap what a cancellation may put back. No
15
+ * surface displayed a single one of them. A merchant whose count disagreed
16
+ * with the shelf had no way to see what moved it, when, or why — and the one
17
+ * number that reconciles the discrepancy was written on every adjustment and
18
+ * unreachable.
19
+ *
20
+ * `delta` is what the merchant's history says moved; `appliedDelta` is what
21
+ * the count could actually give up when the floor in `adjustVariantInventory`
22
+ * absorbed part of it, which happens on a backorder product selling past
23
+ * zero. They differ rarely and they differ importantly — three sold out of a
24
+ * count of zero is exactly the state a merchant is trying to explain — so
25
+ * both are shown when they disagree and only `delta` when they do not.
26
+ */
27
+ export declare function StockMovementsCard(props: StockMovementsCardProps): import("react").JSX.Element;
28
+ export declare namespace StockMovementsCard {
29
+ var displayName: string;
30
+ }
31
+ export default StockMovementsCard;
@@ -0,0 +1,333 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { CardDisplay } from "@aglyn/shared-ui-jsx";
19
+ import { ListPagination } from "@aglyn/shared-ui-jsx/components/list-pagination.component";
20
+ import { TABLE_PAGE_SIZE_DEFAULT } from "@aglyn/shared-ui-jsx/const/table-pagination";
21
+ import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
22
+ import { Alert, MenuItem, Stack, TableBody, TableCell, TableHead, TableRow, TextField, Typography } from "@mui/material";
23
+ import { collection, limit, orderBy, query } from "firebase/firestore";
24
+ import { useEffect, useMemo, useState } from "react";
25
+ import { useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-instance";
26
+ import { pluginDocsHelp } from "@aglyn/aglyn";
27
+ /**
28
+ * How many rows the listener holds.
29
+ *
30
+ * Ordered by `atMs` descending, which is a SINGLE-FIELD index Firestore
31
+ * maintains automatically — no composite, so nothing here can drift from
32
+ * `cloud/firebase-firestore.indexes.json`. Filtering by product happens over
33
+ * this window rather than in the query for exactly that reason: an equality
34
+ * filter plus this ordering is a composite index, and an index that has to be
35
+ * deployed by hand is an index the feature ships without.
36
+ */ const WINDOW = 100;
37
+ const movementsHelp = pluginDocsHelp('commerce', {
38
+ anchor: '#stock-movements',
39
+ title: 'Stock movements',
40
+ excerpt: 'Every change to a tracked count — sales, returns, cancellations and ' + 'hand adjustments — newest first, with the reason each one was made.'
41
+ });
42
+ /** The stored key is a closed set; these are what a merchant reads. */ const REASON_LABEL = {
43
+ sale: 'Sale',
44
+ refund: 'Refund return',
45
+ restock: 'Restock',
46
+ correction: 'Correction',
47
+ damage: 'Damaged',
48
+ cancellation: 'Order canceled'
49
+ };
50
+ /**
51
+ * Stock movements (AGL-2341) — the adjustment history that had no history
52
+ * view.
53
+ *
54
+ * `hosts/{hostId}/inventoryAdjustments` has five writers: the products hub's
55
+ * "Adjust stock" dialog, the sale path in `billing-webhook.ts`, the POS in
56
+ * `pos-order.ts`, and the restock in `cancel-order.ts`. The hub's own comment
57
+ * calls the collection "adjustment history".
58
+ *
59
+ * Its only reader was arithmetic: `cancel-order.ts` projects `appliedDelta`
60
+ * off the `reason: 'sale'` rows to cap what a cancellation may put back. No
61
+ * surface displayed a single one of them. A merchant whose count disagreed
62
+ * with the shelf had no way to see what moved it, when, or why — and the one
63
+ * number that reconciles the discrepancy was written on every adjustment and
64
+ * unreachable.
65
+ *
66
+ * `delta` is what the merchant's history says moved; `appliedDelta` is what
67
+ * the count could actually give up when the floor in `adjustVariantInventory`
68
+ * absorbed part of it, which happens on a backorder product selling past
69
+ * zero. They differ rarely and they differ importantly — three sold out of a
70
+ * count of zero is exactly the state a merchant is trying to explain — so
71
+ * both are shown when they disagree and only `delta` when they do not.
72
+ */ export function StockMovementsCard(props) {
73
+ var _ref;
74
+ const { hostId } = props;
75
+ const firestore = useFirestore();
76
+ const [productFilter, setProductFilter] = useState('all');
77
+ const [reasonFilter, setReasonFilter] = useState('all');
78
+ const { data: movementDocs } = useFirestoreCollection(()=>query(collection(firestore, 'hosts', hostId, 'inventoryAdjustments'), orderBy('atMs', 'desc'), /*
79
+ * `WINDOW + 1` is a PROBE (AGL-2501). One document beyond the ceiling
80
+ * turns "there are older movements than these" into a fact for the
81
+ * price of a single read. The comparison it replaces —
82
+ * `length >= WINDOW` — is wrong at exactly the count that equals the
83
+ * ceiling, which is the one ledger size where a merchant is told
84
+ * rows are missing and none are. The probe row is sliced off below
85
+ * and never rendered.
86
+ */ limit(WINDOW + 1)), [
87
+ firestore,
88
+ hostId
89
+ ], {
90
+ idField: '$id'
91
+ });
92
+ // Names, so a row reads as "Desk lamp" rather than a 20-character id. The
93
+ // products hub above runs this exact query, so the SDK shares one listener.
94
+ const { data: productDocs } = useFirestoreCollection(()=>query(collection(firestore, 'hosts', hostId, 'products'), limit(500)), [
95
+ firestore,
96
+ hostId
97
+ ], {
98
+ idField: '$id'
99
+ });
100
+ const productNames = useMemo(()=>{
101
+ const names = new Map();
102
+ for (const product of productDocs != null ? productDocs : []){
103
+ var _product_name;
104
+ names.set(product.$id, (_product_name = product.name) != null ? _product_name : product.$id);
105
+ }
106
+ return names;
107
+ }, [
108
+ productDocs
109
+ ]);
110
+ /** Read beyond the ceiling — so the ledger holds more than was read. */ const truncated = ((_ref = movementDocs == null ? void 0 : movementDocs.length) != null ? _ref : 0) > WINDOW;
111
+ /** The window itself, probe row removed. */ const windowRows = useMemo(()=>(movementDocs != null ? movementDocs : []).slice(0, WINDOW), [
112
+ movementDocs
113
+ ]);
114
+ const movements = useMemo(()=>[
115
+ ...windowRows
116
+ ]// The query already orders, but a cached snapshot can arrive before
117
+ // the server's and the sort is what makes "newest first" a promise
118
+ // rather than a hope.
119
+ .sort((a, b)=>{
120
+ var _b_atMs, _a_atMs;
121
+ return Number((_b_atMs = b.atMs) != null ? _b_atMs : 0) - Number((_a_atMs = a.atMs) != null ? _a_atMs : 0);
122
+ }).filter((row)=>productFilter === 'all' || row.productId === productFilter).filter((row)=>reasonFilter === 'all' || row.reason === reasonFilter), [
123
+ windowRows,
124
+ productFilter,
125
+ reasonFilter
126
+ ]);
127
+ /*
128
+ * The page is a SLICE of the window, and the window stays where it is.
129
+ *
130
+ * Paging the QUERY would be the cheaper read and the wrong control here,
131
+ * because both filters above run in the browser: on a ten-row server page
132
+ * "Damaged" would search ten movements instead of a hundred and answer "no
133
+ * stock movements" about a ledger full of them. Moving those filters to the
134
+ * server is what would earn a query-level page, and it cannot be done
135
+ * without composite indexes this feature would then ship without — see
136
+ * `WINDOW`. So the read is unchanged and the wall of a hundred rows becomes
137
+ * a footer over them.
138
+ */ const [page, setPage] = useState(0);
139
+ const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT);
140
+ // A filter narrows the list under the reader's feet, and page four of the
141
+ // unfiltered ledger is not a position in the filtered one — MUI renders an
142
+ // out-of-range page as an empty table with no explanation, which reads as
143
+ // the filter having matched nothing.
144
+ useEffect(()=>setPage(0), [
145
+ productFilter,
146
+ reasonFilter
147
+ ]);
148
+ const shown = useMemo(()=>movements.slice(page * pageSize, page * pageSize + pageSize), [
149
+ movements,
150
+ page,
151
+ pageSize
152
+ ]);
153
+ /** Products that actually appear in the window — filtering to an empty
154
+ * option is a dead end, and the whole catalog is not the answer here. */ const filterableProducts = useMemo(()=>{
155
+ const ids = new Set();
156
+ for (const row of windowRows){
157
+ if (row.productId) ids.add(row.productId);
158
+ }
159
+ return [
160
+ ...ids
161
+ ].sort((a, b)=>{
162
+ var _productNames_get, _productNames_get1;
163
+ return ((_productNames_get = productNames.get(a)) != null ? _productNames_get : a).localeCompare((_productNames_get1 = productNames.get(b)) != null ? _productNames_get1 : b);
164
+ });
165
+ }, [
166
+ windowRows,
167
+ productNames
168
+ ]);
169
+ return /*#__PURE__*/ _jsx(CardDisplay, {
170
+ header: "Stock movements",
171
+ help: movementsHelp,
172
+ contentGutterX: true,
173
+ contentGutterY: true,
174
+ children: /*#__PURE__*/ _jsxs(Stack, {
175
+ spacing: 2,
176
+ children: [
177
+ /*#__PURE__*/ _jsxs(Stack, {
178
+ direction: "row",
179
+ spacing: 2,
180
+ children: [
181
+ /*#__PURE__*/ _jsxs(TextField, {
182
+ label: "Product",
183
+ size: "small",
184
+ select: true,
185
+ value: productFilter,
186
+ onChange: (event)=>setProductFilter(event.target.value),
187
+ sx: {
188
+ minWidth: 200
189
+ },
190
+ children: [
191
+ /*#__PURE__*/ _jsx(MenuItem, {
192
+ value: "all",
193
+ children: 'All products'
194
+ }),
195
+ filterableProducts.map((productId)=>{
196
+ var _productNames_get;
197
+ return /*#__PURE__*/ _jsx(MenuItem, {
198
+ value: productId,
199
+ children: (_productNames_get = productNames.get(productId)) != null ? _productNames_get : productId
200
+ }, productId);
201
+ })
202
+ ]
203
+ }),
204
+ /*#__PURE__*/ _jsxs(TextField, {
205
+ label: "Reason",
206
+ size: "small",
207
+ select: true,
208
+ value: reasonFilter,
209
+ onChange: (event)=>setReasonFilter(event.target.value),
210
+ sx: {
211
+ minWidth: 180
212
+ },
213
+ children: [
214
+ /*#__PURE__*/ _jsx(MenuItem, {
215
+ value: "all",
216
+ children: 'Every reason'
217
+ }),
218
+ Object.entries(REASON_LABEL).map(([value, label])=>/*#__PURE__*/ _jsx(MenuItem, {
219
+ value: value,
220
+ children: label
221
+ }, value))
222
+ ]
223
+ })
224
+ ]
225
+ }),
226
+ movements.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
227
+ variant: "body2",
228
+ color: "text.secondary",
229
+ children: 'No stock movements recorded yet. Sales, returns, cancellations ' + 'and hand adjustments all land here.'
230
+ }) : /*#__PURE__*/ _jsxs(ScrollTable, {
231
+ size: "small",
232
+ children: [
233
+ /*#__PURE__*/ _jsx(TableHead, {
234
+ children: /*#__PURE__*/ _jsxs(TableRow, {
235
+ children: [
236
+ /*#__PURE__*/ _jsx(TableCell, {
237
+ children: 'When'
238
+ }),
239
+ /*#__PURE__*/ _jsx(TableCell, {
240
+ children: 'Product'
241
+ }),
242
+ /*#__PURE__*/ _jsx(TableCell, {
243
+ align: "right",
244
+ children: 'Change'
245
+ }),
246
+ /*#__PURE__*/ _jsx(TableCell, {
247
+ children: 'Reason'
248
+ }),
249
+ /*#__PURE__*/ _jsx(TableCell, {
250
+ children: 'Source'
251
+ })
252
+ ]
253
+ })
254
+ }),
255
+ /*#__PURE__*/ _jsx(TableBody, {
256
+ children: shown.map((row)=>{
257
+ var _row_delta, _row_appliedDelta, _productNames_get, _REASON_LABEL_row_reason;
258
+ const delta = Number((_row_delta = row.delta) != null ? _row_delta : 0);
259
+ const applied = Number((_row_appliedDelta = row.appliedDelta) != null ? _row_appliedDelta : delta);
260
+ return /*#__PURE__*/ _jsxs(TableRow, {
261
+ children: [
262
+ /*#__PURE__*/ _jsx(TableCell, {
263
+ children: row.atMs ? new Date(Number(row.atMs)).toLocaleString() : '—'
264
+ }),
265
+ /*#__PURE__*/ _jsxs(TableCell, {
266
+ children: [
267
+ (_productNames_get = productNames.get(row.productId)) != null ? _productNames_get : row.productId,
268
+ row.variantId ? /*#__PURE__*/ _jsx(Typography, {
269
+ variant: "caption",
270
+ color: "text.secondary",
271
+ children: ` · ${row.variantId}`
272
+ }) : null
273
+ ]
274
+ }),
275
+ /*#__PURE__*/ _jsxs(TableCell, {
276
+ align: "right",
277
+ children: [
278
+ /*#__PURE__*/ _jsx(Typography, {
279
+ variant: "body2",
280
+ color: delta < 0 ? 'error.main' : 'success.main',
281
+ component: "span",
282
+ children: delta > 0 ? `+${delta}` : String(delta)
283
+ }),
284
+ applied !== delta ? /*#__PURE__*/ _jsx(Typography, {
285
+ variant: "caption",
286
+ color: "text.secondary",
287
+ children: ` (${applied > 0 ? `+${applied}` : applied} applied)`
288
+ }) : null
289
+ ]
290
+ }),
291
+ /*#__PURE__*/ _jsx(TableCell, {
292
+ children: (_REASON_LABEL_row_reason = REASON_LABEL[row.reason]) != null ? _REASON_LABEL_row_reason : row.reason
293
+ }),
294
+ /*#__PURE__*/ _jsx(TableCell, {
295
+ children: /*#__PURE__*/ _jsx(Typography, {
296
+ variant: "caption",
297
+ color: "text.secondary",
298
+ children: [
299
+ row.orderId ? `order ${row.orderId}` : null,
300
+ row.locationId ? `at ${row.locationId}` : null
301
+ ].filter(Boolean).join(' · ') || '—'
302
+ })
303
+ })
304
+ ]
305
+ }, row.$id);
306
+ })
307
+ })
308
+ ]
309
+ }),
310
+ movements.length === 0 ? null : /*#__PURE__*/ _jsx(ListPagination, {
311
+ page: page,
312
+ pageSize: pageSize,
313
+ rowCount: shown.length,
314
+ // The movements matching the filters, which this card genuinely
315
+ // holds. What it does not know is how many are older than the
316
+ // window, and the notice below says so rather than letting the
317
+ // count line imply a ledger total it cannot see.
318
+ count: movements.length,
319
+ onPageChange: setPage,
320
+ onPageSizeChange: setPageSize
321
+ }),
322
+ truncated ? /*#__PURE__*/ _jsx(Alert, {
323
+ severity: "info",
324
+ children: `Paging the ${WINDOW} most recent movements. Older rows are ` + 'kept and reachable through a data export.'
325
+ }) : null
326
+ ]
327
+ })
328
+ });
329
+ }
330
+ StockMovementsCard.displayName = 'StockMovementsCard';
331
+ export default StockMovementsCard;
332
+
333
+ //# sourceMappingURL=stock-movements-card.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/stock-movements-card.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 { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { TABLE_PAGE_SIZE_DEFAULT } from '@aglyn/shared-ui-jsx/const/table-pagination'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport {\n Alert,\n MenuItem,\n Stack,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n TextField,\n Typography,\n} from '@mui/material'\nimport { collection, limit, orderBy, query } from 'firebase/firestore'\nimport { useEffect, useMemo, useState } from 'react'\nimport {\n useFirestore,\n useFirestoreCollection,\n} from '@aglyn/tenant-feature-instance'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport * as CommerceModel from '../../model'\n\nexport interface StockMovementsCardProps {\n hostId: string\n}\n\n/**\n * How many rows the listener holds.\n *\n * Ordered by `atMs` descending, which is a SINGLE-FIELD index Firestore\n * maintains automatically — no composite, so nothing here can drift from\n * `cloud/firebase-firestore.indexes.json`. Filtering by product happens over\n * this window rather than in the query for exactly that reason: an equality\n * filter plus this ordering is a composite index, and an index that has to be\n * deployed by hand is an index the feature ships without.\n */\nconst WINDOW = 100\n\nconst movementsHelp = pluginDocsHelp('commerce', {\n anchor: '#stock-movements',\n title: 'Stock movements',\n excerpt:\n 'Every change to a tracked count — sales, returns, cancellations and ' +\n 'hand adjustments — newest first, with the reason each one was made.',\n})\n\n/** The stored key is a closed set; these are what a merchant reads. */\nconst REASON_LABEL: Record<CommerceModel.InventoryAdjustmentReason, string> = {\n sale: 'Sale',\n refund: 'Refund return',\n restock: 'Restock',\n correction: 'Correction',\n damage: 'Damaged',\n cancellation: 'Order canceled',\n}\n\ntype MovementRow = CommerceModel.InventoryAdjustment & { $id: string }\n\n/**\n * Stock movements (AGL-2341) — the adjustment history that had no history\n * view.\n *\n * `hosts/{hostId}/inventoryAdjustments` has five writers: the products hub's\n * \"Adjust stock\" dialog, the sale path in `billing-webhook.ts`, the POS in\n * `pos-order.ts`, and the restock in `cancel-order.ts`. The hub's own comment\n * calls the collection \"adjustment history\".\n *\n * Its only reader was arithmetic: `cancel-order.ts` projects `appliedDelta`\n * off the `reason: 'sale'` rows to cap what a cancellation may put back. No\n * surface displayed a single one of them. A merchant whose count disagreed\n * with the shelf had no way to see what moved it, when, or why — and the one\n * number that reconciles the discrepancy was written on every adjustment and\n * unreachable.\n *\n * `delta` is what the merchant's history says moved; `appliedDelta` is what\n * the count could actually give up when the floor in `adjustVariantInventory`\n * absorbed part of it, which happens on a backorder product selling past\n * zero. They differ rarely and they differ importantly — three sold out of a\n * count of zero is exactly the state a merchant is trying to explain — so\n * both are shown when they disagree and only `delta` when they do not.\n */\nexport function StockMovementsCard(props: StockMovementsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const [productFilter, setProductFilter] = useState('all')\n const [reasonFilter, setReasonFilter] = useState('all')\n\n const { data: movementDocs } = useFirestoreCollection<any>(\n () =>\n query(\n collection(firestore, 'hosts', hostId, 'inventoryAdjustments'),\n orderBy('atMs', 'desc'),\n /*\n * `WINDOW + 1` is a PROBE (AGL-2501). One document beyond the ceiling\n * turns \"there are older movements than these\" into a fact for the\n * price of a single read. The comparison it replaces —\n * `length >= WINDOW` — is wrong at exactly the count that equals the\n * ceiling, which is the one ledger size where a merchant is told\n * rows are missing and none are. The probe row is sliced off below\n * and never rendered.\n */\n limit(WINDOW + 1),\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n // Names, so a row reads as \"Desk lamp\" rather than a 20-character id. The\n // products hub above runs this exact query, so the SDK shares one listener.\n const { data: productDocs } = useFirestoreCollection<any>(\n () =>\n query(collection(firestore, 'hosts', hostId, 'products'), limit(500)),\n [firestore, hostId],\n { idField: '$id' },\n )\n\n const productNames = useMemo(() => {\n const names = new Map<string, string>()\n for (const product of productDocs ?? []) {\n names.set(product.$id, product.name ?? product.$id)\n }\n return names\n }, [productDocs])\n\n /** Read beyond the ceiling — so the ledger holds more than was read. */\n const truncated = (movementDocs?.length ?? 0) > WINDOW\n /** The window itself, probe row removed. */\n const windowRows = useMemo(\n () => ((movementDocs ?? []) as MovementRow[]).slice(0, WINDOW),\n [movementDocs],\n )\n\n const movements: MovementRow[] = useMemo(\n () =>\n [...windowRows]\n // The query already orders, but a cached snapshot can arrive before\n // the server's and the sort is what makes \"newest first\" a promise\n // rather than a hope.\n .sort((a, b) => Number(b.atMs ?? 0) - Number(a.atMs ?? 0))\n .filter(\n (row) => productFilter === 'all' || row.productId === productFilter,\n )\n .filter((row) => reasonFilter === 'all' || row.reason === reasonFilter),\n [windowRows, productFilter, reasonFilter],\n )\n\n /*\n * The page is a SLICE of the window, and the window stays where it is.\n *\n * Paging the QUERY would be the cheaper read and the wrong control here,\n * because both filters above run in the browser: on a ten-row server page\n * \"Damaged\" would search ten movements instead of a hundred and answer \"no\n * stock movements\" about a ledger full of them. Moving those filters to the\n * server is what would earn a query-level page, and it cannot be done\n * without composite indexes this feature would then ship without — see\n * `WINDOW`. So the read is unchanged and the wall of a hundred rows becomes\n * a footer over them.\n */\n const [page, setPage] = useState(0)\n const [pageSize, setPageSize] = useState(TABLE_PAGE_SIZE_DEFAULT)\n // A filter narrows the list under the reader's feet, and page four of the\n // unfiltered ledger is not a position in the filtered one — MUI renders an\n // out-of-range page as an empty table with no explanation, which reads as\n // the filter having matched nothing.\n useEffect(() => setPage(0), [productFilter, reasonFilter])\n const shown = useMemo(\n () => movements.slice(page * pageSize, page * pageSize + pageSize),\n [movements, page, pageSize],\n )\n\n /** Products that actually appear in the window — filtering to an empty\n * option is a dead end, and the whole catalog is not the answer here. */\n const filterableProducts = useMemo(() => {\n const ids = new Set<string>()\n for (const row of windowRows) {\n if (row.productId) ids.add(row.productId)\n }\n return [...ids].sort((a, b) =>\n (productNames.get(a) ?? a).localeCompare(productNames.get(b) ?? b),\n )\n }, [windowRows, productNames])\n\n return (\n <CardDisplay header=\"Stock movements\" help={movementsHelp} contentGutterX contentGutterY>\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={2}>\n <TextField\n label=\"Product\"\n size=\"small\"\n select\n value={productFilter}\n onChange={(event) => setProductFilter(event.target.value)}\n sx={{ minWidth: 200 }}\n >\n <MenuItem value=\"all\">{'All products'}</MenuItem>\n {filterableProducts.map((productId) => (\n <MenuItem key={productId} value={productId}>\n {productNames.get(productId) ?? productId}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n label=\"Reason\"\n size=\"small\"\n select\n value={reasonFilter}\n onChange={(event) => setReasonFilter(event.target.value)}\n sx={{ minWidth: 180 }}\n >\n <MenuItem value=\"all\">{'Every reason'}</MenuItem>\n {Object.entries(REASON_LABEL).map(([value, label]) => (\n <MenuItem key={value} value={value}>\n {label}\n </MenuItem>\n ))}\n </TextField>\n </Stack>\n {movements.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No stock movements recorded yet. Sales, returns, cancellations ' +\n 'and hand adjustments all land here.'}\n </Typography>\n ) : (\n <ScrollTable size=\"small\">\n <TableHead>\n <TableRow>\n <TableCell>{'When'}</TableCell>\n <TableCell>{'Product'}</TableCell>\n <TableCell align=\"right\">{'Change'}</TableCell>\n <TableCell>{'Reason'}</TableCell>\n <TableCell>{'Source'}</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {shown.map((row) => {\n const delta = Number(row.delta ?? 0)\n const applied = Number(row.appliedDelta ?? delta)\n return (\n <TableRow key={row.$id}>\n <TableCell>\n {row.atMs\n ? new Date(Number(row.atMs)).toLocaleString()\n : '—'}\n </TableCell>\n <TableCell>\n {productNames.get(row.productId) ?? row.productId}\n {row.variantId ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {` · ${row.variantId}`}\n </Typography>\n ) : null}\n </TableCell>\n <TableCell align=\"right\">\n {/*\n * The sign is carried explicitly. \"3\" and \"-3\" are the\n * same width and opposite facts, and a merchant\n * scanning a column for the movement that broke their\n * count reads the sign before the number.\n */}\n <Typography\n variant=\"body2\"\n color={delta < 0 ? 'error.main' : 'success.main'}\n component=\"span\"\n >\n {delta > 0 ? `+${delta}` : String(delta)}\n </Typography>\n {applied !== delta ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {` (${applied > 0 ? `+${applied}` : applied} applied)`}\n </Typography>\n ) : null}\n </TableCell>\n <TableCell>\n {REASON_LABEL[row.reason] ?? row.reason}\n </TableCell>\n <TableCell>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {[\n row.orderId ? `order ${row.orderId}` : null,\n row.locationId ? `at ${row.locationId}` : null,\n ]\n .filter(Boolean)\n .join(' · ') || '—'}\n </Typography>\n </TableCell>\n </TableRow>\n )\n })}\n </TableBody>\n </ScrollTable>\n )}\n {movements.length === 0 ? null : (\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={shown.length}\n // The movements matching the filters, which this card genuinely\n // holds. What it does not know is how many are older than the\n // window, and the notice below says so rather than letting the\n // count line imply a ledger total it cannot see.\n count={movements.length}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n )}\n {truncated ? (\n <Alert severity=\"info\">\n {`Paging the ${WINDOW} most recent movements. Older rows are ` +\n 'kept and reachable through a data export.'}\n </Alert>\n ) : null}\n </Stack>\n </CardDisplay>\n )\n}\nStockMovementsCard.displayName = 'StockMovementsCard'\n\nexport default StockMovementsCard\n"],"names":["CardDisplay","ListPagination","TABLE_PAGE_SIZE_DEFAULT","ScrollTable","Alert","MenuItem","Stack","TableBody","TableCell","TableHead","TableRow","TextField","Typography","collection","limit","orderBy","query","useEffect","useMemo","useState","useFirestore","useFirestoreCollection","pluginDocsHelp","WINDOW","movementsHelp","anchor","title","excerpt","REASON_LABEL","sale","refund","restock","correction","damage","cancellation","StockMovementsCard","props","hostId","firestore","productFilter","setProductFilter","reasonFilter","setReasonFilter","data","movementDocs","idField","productDocs","productNames","names","Map","product","set","$id","name","truncated","length","windowRows","slice","movements","sort","a","b","Number","atMs","filter","row","productId","reason","page","setPage","pageSize","setPageSize","shown","filterableProducts","ids","Set","add","get","localeCompare","header","help","contentGutterX","contentGutterY","spacing","direction","label","size","select","value","onChange","event","target","sx","minWidth","map","Object","entries","variant","color","align","delta","applied","appliedDelta","Date","toLocaleString","variantId","component","String","orderId","locationId","Boolean","join","rowCount","count","onPageChange","onPageSizeChange","severity","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,WAAW,QAAQ,uBAAsB;AAClD,SAASC,cAAc,QAAQ,4DAA2D;AAC1F,SAASC,uBAAuB,QAAQ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AE,EAAEG,UAAU,IAAI,CAAC,CAAC,EAAEA,SAAS,GAAGA,QAAQ,SAAS,CAAC;qDAEtD;;;sDAEN,KAAC7F;uDACEoB,2BAAAA,YAAY,CAACqC,IAAIE,MAAM,CAAC,YAAxBvC,2BAA4BqC,IAAIE,MAAM;;sDAEzC,KAAC3D;sDACC,cAAA,KAACI;gDAAWqF,SAAQ;gDAAUC,OAAM;0DACjC;oDACCjC,IAAI2C,OAAO,GAAG,CAAC,MAAM,EAAE3C,IAAI2C,OAAO,EAAE,GAAG;oDACvC3C,IAAI4C,UAAU,GAAG,CAAC,GAAG,EAAE5C,IAAI4C,UAAU,EAAE,GAAG;iDAC3C,CACE7C,MAAM,CAAC8C,SACPC,IAAI,CAAC,UAAU;;;;mCA5CT9C,IAAIb,GAAG;4BAiD1B;;;;gBAILM,UAAUH,MAAM,KAAK,IAAI,qBACxB,KAACtD;oBACCmE,MAAMA;oBACNE,UAAUA;oBACV0C,UAAUxC,MAAMjB,MAAM;oBACtB,gEAAgE;oBAChE,8DAA8D;oBAC9D,+DAA+D;oBAC/D,iDAAiD;oBACjD0D,OAAOvD,UAAUH,MAAM;oBACvB2D,cAAc7C;oBACd8C,kBAAkB5C;;gBAGrBjB,0BACC,KAAClD;oBAAMgH,UAAS;8BACb,CAAC,WAAW,EAAE7F,OAAO,uCAAuC,CAAC,GAC5D;qBAEF;;;;AAIZ;AACAY,mBAAmBkF,WAAW,GAAG;AAEjC,eAAelF,mBAAkB"}
@@ -0,0 +1,14 @@
1
+ export interface StoreSettingsCardProps {
2
+ hostId: string;
3
+ }
4
+ /**
5
+ * Store settings (AGL-295) on `hosts/{hostId}/settings/store`: the PDP
6
+ * template screen (drives /products/{slug}), currency display, checkout
7
+ * preferences, and receipt branding. Tax and shipping have their own
8
+ * cards; store password/maintenance live in Site Protection.
9
+ */
10
+ export declare function StoreSettingsCard(props: StoreSettingsCardProps): import("react").JSX.Element;
11
+ export declare namespace StoreSettingsCard {
12
+ var displayName: string;
13
+ }
14
+ export default StoreSettingsCard;