@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,418 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2026 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import * as Aglyn from "@aglyn/aglyn";
20
+ import { buildBeginCheckoutParams, trackEventBeforeNavigation } from "@aglyn/aglyn/app-utils/analytics-events";
21
+ import * as CommerceModel from "../model/index.js";
22
+ import { mdiCalendarCheckOutline } from "@aglyn/shared-data-mdi";
23
+ import Alert from "@mui/material/Alert";
24
+ import Box from "@mui/material/Box";
25
+ import Button from "@mui/material/Button";
26
+ import Divider from "@mui/material/Divider";
27
+ import TextField from "@mui/material/TextField";
28
+ import Typography from "@mui/material/Typography";
29
+ import { forwardRef, useContext, useEffect, useMemo, useRef, useState } from "react";
30
+ import { BUNDLE_ID } from "../constants/bundle-common.js";
31
+ import { generatePresetId } from "../utils/generate-preset-id.js";
32
+ // Component ids are persisted in screen documents; never rename.
33
+ export const ID = 'reservation-widget';
34
+ const usd = (cents)=>`$${(cents / 100).toFixed(2)}`;
35
+ /**
36
+ * Reservation widget (AGL-310): date-range picker with a live quote
37
+ * (nights × seasonal rates + deposit due today) and a reserve flow that
38
+ * charges the deposit through the merchant's account. The server
39
+ * re-quotes and re-checks availability — the widget is display-only.
40
+ */ const ReservationWidget = /*#__PURE__*/ forwardRef((props, ref)=>{
41
+ const { resourceId, reserveLabel } = props, rest = _object_without_properties_loose(props, [
42
+ "resourceId",
43
+ "reserveLabel"
44
+ ]);
45
+ // Node styles ride the renderer-merged sx; recompose (stack.ts pattern).
46
+ const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [
47
+ props['sx']
48
+ ];
49
+ const { hostId } = Aglyn.useSite();
50
+ const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext);
51
+ const siteFetch = Aglyn.useSiteFetch();
52
+ const [availability, setAvailability] = useState(null);
53
+ const [checkIn, setCheckIn] = useState('');
54
+ const [checkOut, setCheckOut] = useState('');
55
+ const [guestName, setGuestName] = useState('');
56
+ const [guestEmail, setGuestEmail] = useState('');
57
+ const [status, setStatus] = useState('idle');
58
+ const [message, setMessage] = useState('');
59
+ useEffect(()=>{
60
+ if (!hostId || !resourceId) return;
61
+ let active = true;
62
+ void fetch(`/api/commerce/reservation-availability?hostId=${encodeURIComponent(hostId)}` + `&resourceId=${encodeURIComponent(resourceId)}`).then((response)=>response.ok ? response.json() : null).then((payload)=>{
63
+ if (active && payload) setAvailability(payload);
64
+ }).catch(()=>undefined);
65
+ return ()=>{
66
+ active = false;
67
+ };
68
+ }, [
69
+ hostId,
70
+ resourceId
71
+ ]);
72
+ const checkInDayMs = checkIn ? Date.parse(`${checkIn}T00:00:00Z`) : 0;
73
+ const checkOutDayMs = checkOut ? Date.parse(`${checkOut}T00:00:00Z`) : 0;
74
+ const quote = useMemo(()=>{
75
+ if (!availability || !checkInDayMs || !checkOutDayMs) return null;
76
+ return CommerceModel.computeReservationQuote(availability.resource, checkInDayMs, checkOutDayMs);
77
+ }, [
78
+ availability,
79
+ checkInDayMs,
80
+ checkOutDayMs
81
+ ]);
82
+ const conflict = useMemo(()=>{
83
+ if (!availability || !checkInDayMs || !checkOutDayMs) return false;
84
+ return !CommerceModel.isRangeAvailable(availability.resource, availability.unavailable.map((range)=>({
85
+ checkInDayMs: range.fromDayMs,
86
+ checkOutDayMs: range.toDayMs,
87
+ status: 'confirmed'
88
+ })), checkInDayMs, checkOutDayMs);
89
+ }, [
90
+ availability,
91
+ checkInDayMs,
92
+ checkOutDayMs
93
+ ]);
94
+ /**
95
+ * Idempotency key for ONE reservation attempt (AGL-1697).
96
+ *
97
+ * Minted lazily on the first Reserve click, retired whenever the stay
98
+ * changes shape — different dates, resource or guest are a different
99
+ * attempt. A retry of THIS attempt presents the same key, so the server
100
+ * replays the original session URL instead of telling the guest their own
101
+ * pending hold "just sold out".
102
+ */ const attemptKey = useRef('');
103
+ useEffect(()=>{
104
+ attemptKey.current = '';
105
+ }, [
106
+ checkInDayMs,
107
+ checkOutDayMs,
108
+ resourceId,
109
+ guestName,
110
+ guestEmail
111
+ ]);
112
+ const handleReserve = async ()=>{
113
+ if (!hostId || !resourceId || status === 'sending') return;
114
+ setStatus('sending');
115
+ setMessage('');
116
+ if (!attemptKey.current) {
117
+ var _ref;
118
+ var _globalThis_crypto_randomUUID, _globalThis_crypto;
119
+ attemptKey.current = (_ref = (_globalThis_crypto = globalThis.crypto) == null ? void 0 : (_globalThis_crypto_randomUUID = _globalThis_crypto.randomUUID) == null ? void 0 : _globalThis_crypto_randomUUID.call(_globalThis_crypto)) != null ? _ref : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
120
+ }
121
+ try {
122
+ var _ref1;
123
+ const response = await siteFetch('/api/commerce/reserve', {
124
+ method: 'POST',
125
+ headers: {
126
+ 'Content-Type': 'application/json',
127
+ 'Idempotency-Key': attemptKey.current
128
+ },
129
+ body: JSON.stringify({
130
+ hostId,
131
+ resourceId,
132
+ checkInDayMs,
133
+ checkOutDayMs,
134
+ guestName,
135
+ guestEmail
136
+ })
137
+ });
138
+ const payload = await response.json().catch(()=>({}));
139
+ if (response.ok && (payload == null ? void 0 : payload.url)) {
140
+ // The stay's `begin_checkout`. This widget charges a real deposit
141
+ // through the merchant's Stripe account and reported nothing at all,
142
+ // so a lodging site saw traffic and then silence — GA4's ecommerce
143
+ // reports read that as a 100% abandonment rate on every resource
144
+ // they list, which is the same hole `purchase` closed for products.
145
+ //
146
+ // After the server accepted the hold and minted a session, never on
147
+ // the click: the dates can lose a race and answer 409, and counting
148
+ // those would report checkouts that Stripe never saw.
149
+ //
150
+ // `value` is what is being charged TODAY — `reserve.ts` bills
151
+ // `depositCents || totalCents` — not the value of the stay. Reporting
152
+ // the whole stay against a deposit payment would make the merchant's
153
+ // checkout value disagree with the `purchase` that follows it, and
154
+ // the gap would look like abandoned upsell rather than a deposit.
155
+ //
156
+ // Ex-tax, matching `buildStorefrontPurchaseParams`: the lodging tax
157
+ // rides the session as a second line and is money held for a taxing
158
+ // authority, not the merchant's revenue.
159
+ const chargedCents = quote ? quote.depositCents || quote.totalCents : 0;
160
+ if (availability && chargedCents > 0) {
161
+ await trackEventBeforeNavigation('begin_checkout', buildBeginCheckoutParams({
162
+ value: chargedCents / 100,
163
+ items: [
164
+ {
165
+ item_id: resourceId,
166
+ item_name: availability.resource.name,
167
+ price: chargedCents / 100,
168
+ quantity: 1
169
+ }
170
+ ]
171
+ }));
172
+ }
173
+ window.location.assign(payload.url);
174
+ return;
175
+ }
176
+ setMessage(String((_ref1 = payload == null ? void 0 : payload.error) != null ? _ref1 : ''));
177
+ setStatus('error');
178
+ } catch (unused) {
179
+ setStatus('error');
180
+ }
181
+ };
182
+ if (!hostId) {
183
+ return /*#__PURE__*/ _jsx(Box, _extends({
184
+ ref: ref
185
+ }, rest, {
186
+ sx: [
187
+ {
188
+ p: 3,
189
+ border: '1px dashed',
190
+ borderColor: 'divider',
191
+ borderRadius: 1,
192
+ color: 'text.secondary',
193
+ fontSize: 13,
194
+ fontFamily: 'system-ui, sans-serif'
195
+ },
196
+ ...nodeSx
197
+ ],
198
+ children: 'Reservation widget — dates, quote, and reserve render here'
199
+ }));
200
+ }
201
+ if (!resourceId) {
202
+ // The instruction is for the author, so only editing surfaces draw it;
203
+ // a published page renders the bare element.
204
+ if (!suppressNavigation) return /*#__PURE__*/ _jsx(Box, _extends({
205
+ ref: ref
206
+ }, rest));
207
+ return /*#__PURE__*/ _jsx(Box, _extends({
208
+ ref: ref
209
+ }, rest, {
210
+ sx: [
211
+ {
212
+ p: 2
213
+ },
214
+ ...nodeSx
215
+ ],
216
+ children: /*#__PURE__*/ _jsx(Typography, {
217
+ variant: "body2",
218
+ color: "text.secondary",
219
+ children: 'Set a resource id on this block (console → Resources).'
220
+ })
221
+ }));
222
+ }
223
+ return /*#__PURE__*/ _jsxs(Box, _extends({
224
+ ref: ref
225
+ }, rest, {
226
+ sx: [
227
+ {
228
+ display: 'flex',
229
+ flexDirection: 'column',
230
+ gap: 1.5,
231
+ maxWidth: 420,
232
+ p: 2,
233
+ border: 1,
234
+ borderColor: 'divider',
235
+ borderRadius: 1
236
+ },
237
+ ...nodeSx
238
+ ],
239
+ children: [
240
+ availability ? /*#__PURE__*/ _jsxs(_Fragment, {
241
+ children: [
242
+ /*#__PURE__*/ _jsx(Typography, {
243
+ variant: "h6",
244
+ children: availability.resource.name
245
+ }),
246
+ /*#__PURE__*/ _jsx(Typography, {
247
+ variant: "body2",
248
+ color: "text.secondary",
249
+ children: `From $${availability.resource.nightlyRateUsd}/night` + (availability.resource.minNights ? ` · ${availability.resource.minNights}-night minimum` : '')
250
+ })
251
+ ]
252
+ }) : null,
253
+ /*#__PURE__*/ _jsxs(Box, {
254
+ sx: {
255
+ display: 'flex',
256
+ gap: 1
257
+ },
258
+ children: [
259
+ /*#__PURE__*/ _jsx(TextField, {
260
+ label: "Check-in",
261
+ type: "date",
262
+ value: checkIn,
263
+ onChange: (event)=>setCheckIn(event.target.value),
264
+ size: "small",
265
+ fullWidth: true,
266
+ slotProps: {
267
+ inputLabel: {
268
+ shrink: true
269
+ }
270
+ }
271
+ }),
272
+ /*#__PURE__*/ _jsx(TextField, {
273
+ label: "Check-out",
274
+ type: "date",
275
+ value: checkOut,
276
+ onChange: (event)=>setCheckOut(event.target.value),
277
+ size: "small",
278
+ fullWidth: true,
279
+ slotProps: {
280
+ inputLabel: {
281
+ shrink: true
282
+ }
283
+ }
284
+ })
285
+ ]
286
+ }),
287
+ conflict ? /*#__PURE__*/ _jsx(Alert, {
288
+ severity: "warning",
289
+ children: 'Those dates are unavailable.'
290
+ }) : (quote == null ? void 0 : quote.problem) ? /*#__PURE__*/ _jsx(Alert, {
291
+ severity: "info",
292
+ children: quote.problem
293
+ }) : quote ? /*#__PURE__*/ _jsxs(_Fragment, {
294
+ children: [
295
+ /*#__PURE__*/ _jsx(Divider, {}),
296
+ /*#__PURE__*/ _jsxs(Box, {
297
+ sx: {
298
+ display: 'flex',
299
+ justifyContent: 'space-between'
300
+ },
301
+ children: [
302
+ /*#__PURE__*/ _jsx(Typography, {
303
+ variant: "body2",
304
+ children: `${quote.nights} night${quote.nights === 1 ? '' : 's'}`
305
+ }),
306
+ /*#__PURE__*/ _jsx(Typography, {
307
+ variant: "body2",
308
+ children: usd(quote.subtotalCents)
309
+ })
310
+ ]
311
+ }),
312
+ quote.depositCents < quote.totalCents ? /*#__PURE__*/ _jsxs(Box, {
313
+ sx: {
314
+ display: 'flex',
315
+ justifyContent: 'space-between'
316
+ },
317
+ children: [
318
+ /*#__PURE__*/ _jsx(Typography, {
319
+ variant: "body2",
320
+ sx: {
321
+ fontWeight: 600
322
+ },
323
+ children: 'Due today (deposit)'
324
+ }),
325
+ /*#__PURE__*/ _jsx(Typography, {
326
+ variant: "body2",
327
+ sx: {
328
+ fontWeight: 600
329
+ },
330
+ children: usd(quote.depositCents)
331
+ })
332
+ ]
333
+ }) : null
334
+ ]
335
+ }) : null,
336
+ /*#__PURE__*/ _jsx(TextField, {
337
+ label: "Your name",
338
+ value: guestName,
339
+ onChange: (event)=>setGuestName(event.target.value),
340
+ size: "small"
341
+ }),
342
+ /*#__PURE__*/ _jsx(TextField, {
343
+ label: "Email",
344
+ type: "email",
345
+ value: guestEmail,
346
+ onChange: (event)=>setGuestEmail(event.target.value),
347
+ size: "small"
348
+ }),
349
+ status === 'error' ? /*#__PURE__*/ _jsx(Alert, {
350
+ severity: "error",
351
+ children: message || 'Reservation is unavailable right now.'
352
+ }) : null,
353
+ /*#__PURE__*/ _jsx(Button, {
354
+ variant: "contained",
355
+ color: "primary",
356
+ disabled: status === 'sending' || conflict || !quote || Boolean(quote.problem) || !guestEmail.trim(),
357
+ onClick: handleReserve,
358
+ children: status === 'sending' ? 'Redirecting…' : reserveLabel || 'Reserve now'
359
+ })
360
+ ]
361
+ }));
362
+ });
363
+ ReservationWidget.displayName = 'AglynReservationWidget';
364
+ export const schema = {
365
+ $id: ID,
366
+ pluginId: BUNDLE_ID,
367
+ displayName: 'Reservation widget',
368
+ description: 'A date-range booking with a live quote and a deposit taken up front.',
369
+ category: Aglyn.ComponentCategory.COMMERCE,
370
+ icon: {
371
+ path: mdiCalendarCheckOutline.path,
372
+ sx: {
373
+ color: '#2e7d32'
374
+ }
375
+ },
376
+ flags: {
377
+ selfClosing: Aglyn.FEATURE_FLAG.ENABLED
378
+ },
379
+ attributes: [
380
+ {
381
+ name: 'resourceId',
382
+ label: 'Resource id',
383
+ description: 'From the Resources card on the Products page.',
384
+ component: Aglyn.FieldComponentType.TEXT_FIELD
385
+ },
386
+ {
387
+ name: 'reserveLabel',
388
+ label: 'Button label',
389
+ description: 'Defaults to "Reserve now".',
390
+ component: Aglyn.FieldComponentType.TEXT_FIELD
391
+ }
392
+ ]
393
+ };
394
+ export const presets = [
395
+ {
396
+ $id: generatePresetId(ID),
397
+ type: Aglyn.NodeType.PRESET,
398
+ displayName: 'Reservation widget',
399
+ pluginId: BUNDLE_ID,
400
+ description: 'Date-range stay booking with live quote + deposit',
401
+ category: Aglyn.ComponentCategory.COMMERCE,
402
+ icon: {
403
+ path: mdiCalendarCheckOutline.path,
404
+ sx: {
405
+ color: '#2e7d32'
406
+ }
407
+ },
408
+ data: {
409
+ $id: null,
410
+ componentId: ID,
411
+ pluginId: BUNDLE_ID,
412
+ props: {}
413
+ }
414
+ }
415
+ ];
416
+ export default ReservationWidget;
417
+
418
+ //# sourceMappingURL=reservation-widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/reservation-widget.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\nimport * as Aglyn from '@aglyn/aglyn'\nimport {\n buildBeginCheckoutParams,\n trackEventBeforeNavigation,\n} from '@aglyn/aglyn/app-utils/analytics-events'\nimport * as CommerceModel from '../model'\nimport { mdiCalendarCheckOutline } from '@aglyn/shared-data-mdi'\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Divider from '@mui/material/Divider'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport {\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n// Component ids are persisted in screen documents; never rename.\nexport const ID: Aglyn.ComponentId = 'reservation-widget'\n\nexport interface ReservationWidgetProps {\n /** Resource id from the console Resources card. */\n resourceId?: string\n reserveLabel?: string\n}\n\ninterface Availability {\n resource: CommerceModel.HostResource\n unavailable: Array<{ fromDayMs: number; toDayMs: number }>\n}\n\nconst usd = (cents: number) => `$${(cents / 100).toFixed(2)}`\n\n/**\n * Reservation widget (AGL-310): date-range picker with a live quote\n * (nights × seasonal rates + deposit due today) and a reserve flow that\n * charges the deposit through the merchant's account. The server\n * re-quotes and re-checks availability — the widget is display-only.\n */\nconst ReservationWidget = forwardRef<HTMLDivElement, ReservationWidgetProps>(\n (props, ref) => {\n const { resourceId, reserveLabel, ...rest } = props\n // Node styles ride the renderer-merged sx; recompose (stack.ts pattern).\n const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [props['sx']]\n const { hostId } = Aglyn.useSite()\n const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext)\n const siteFetch = Aglyn.useSiteFetch()\n const [availability, setAvailability] = useState<Availability | null>(null)\n const [checkIn, setCheckIn] = useState('')\n const [checkOut, setCheckOut] = useState('')\n const [guestName, setGuestName] = useState('')\n const [guestEmail, setGuestEmail] = useState('')\n const [status, setStatus] = useState<'idle' | 'sending' | 'error'>('idle')\n const [message, setMessage] = useState('')\n\n useEffect(() => {\n if (!hostId || !resourceId) return\n let active = true\n void fetch(\n `/api/commerce/reservation-availability?hostId=${encodeURIComponent(hostId)}` +\n `&resourceId=${encodeURIComponent(resourceId)}`,\n )\n .then((response) => (response.ok ? response.json() : null))\n .then((payload) => {\n if (active && payload) setAvailability(payload)\n })\n .catch(() => undefined)\n return () => {\n active = false\n }\n }, [hostId, resourceId])\n\n const checkInDayMs = checkIn ? Date.parse(`${checkIn}T00:00:00Z`) : 0\n const checkOutDayMs = checkOut ? Date.parse(`${checkOut}T00:00:00Z`) : 0\n\n const quote = useMemo(() => {\n if (!availability || !checkInDayMs || !checkOutDayMs) return null\n return CommerceModel.computeReservationQuote(\n availability.resource,\n checkInDayMs,\n checkOutDayMs,\n )\n }, [availability, checkInDayMs, checkOutDayMs])\n\n const conflict = useMemo(() => {\n if (!availability || !checkInDayMs || !checkOutDayMs) return false\n return !CommerceModel.isRangeAvailable(\n availability.resource,\n availability.unavailable.map((range) => ({\n checkInDayMs: range.fromDayMs,\n checkOutDayMs: range.toDayMs,\n status: 'confirmed' as const,\n })),\n checkInDayMs,\n checkOutDayMs,\n )\n }, [availability, checkInDayMs, checkOutDayMs])\n\n /**\n * Idempotency key for ONE reservation attempt (AGL-1697).\n *\n * Minted lazily on the first Reserve click, retired whenever the stay\n * changes shape — different dates, resource or guest are a different\n * attempt. A retry of THIS attempt presents the same key, so the server\n * replays the original session URL instead of telling the guest their own\n * pending hold \"just sold out\".\n */\n const attemptKey = useRef('')\n useEffect(() => {\n attemptKey.current = ''\n }, [checkInDayMs, checkOutDayMs, resourceId, guestName, guestEmail])\n\n const handleReserve = async () => {\n if (!hostId || !resourceId || status === 'sending') return\n setStatus('sending')\n setMessage('')\n if (!attemptKey.current) {\n attemptKey.current =\n globalThis.crypto?.randomUUID?.() ??\n `${Date.now()}-${Math.random().toString(36).slice(2)}`\n }\n try {\n const response = await siteFetch('/api/commerce/reserve', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Idempotency-Key': attemptKey.current,\n },\n body: JSON.stringify({\n hostId,\n resourceId,\n checkInDayMs,\n checkOutDayMs,\n guestName,\n guestEmail,\n }),\n })\n const payload = await response.json().catch(() => ({}))\n if (response.ok && payload?.url) {\n // The stay's `begin_checkout`. This widget charges a real deposit\n // through the merchant's Stripe account and reported nothing at all,\n // so a lodging site saw traffic and then silence — GA4's ecommerce\n // reports read that as a 100% abandonment rate on every resource\n // they list, which is the same hole `purchase` closed for products.\n //\n // After the server accepted the hold and minted a session, never on\n // the click: the dates can lose a race and answer 409, and counting\n // those would report checkouts that Stripe never saw.\n //\n // `value` is what is being charged TODAY — `reserve.ts` bills\n // `depositCents || totalCents` — not the value of the stay. Reporting\n // the whole stay against a deposit payment would make the merchant's\n // checkout value disagree with the `purchase` that follows it, and\n // the gap would look like abandoned upsell rather than a deposit.\n //\n // Ex-tax, matching `buildStorefrontPurchaseParams`: the lodging tax\n // rides the session as a second line and is money held for a taxing\n // authority, not the merchant's revenue.\n const chargedCents = quote\n ? quote.depositCents || quote.totalCents\n : 0\n if (availability && chargedCents > 0) {\n await trackEventBeforeNavigation(\n 'begin_checkout',\n buildBeginCheckoutParams({\n value: chargedCents / 100,\n items: [\n {\n item_id: resourceId,\n item_name: availability.resource.name,\n price: chargedCents / 100,\n quantity: 1,\n },\n ],\n }),\n )\n }\n window.location.assign(payload.url)\n return\n }\n setMessage(String(payload?.error ?? ''))\n setStatus('error')\n } catch {\n setStatus('error')\n }\n }\n\n if (!hostId) {\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n p: 3,\n border: '1px dashed',\n borderColor: 'divider',\n borderRadius: 1,\n color: 'text.secondary',\n fontSize: 13,\n fontFamily: 'system-ui, sans-serif',\n },\n ...nodeSx,\n ]}\n >\n {'Reservation widget — dates, quote, and reserve render here'}\n </Box>\n )\n }\n if (!resourceId) {\n // The instruction is for the author, so only editing surfaces draw it;\n // a published page renders the bare element.\n if (!suppressNavigation) return <Box ref={ref} {...rest} />\n return (\n <Box ref={ref} {...rest} sx={[{ p: 2 }, ...nodeSx]}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Set a resource id on this block (console → Resources).'}\n </Typography>\n </Box>\n )\n }\n\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n display: 'flex',\n flexDirection: 'column',\n gap: 1.5,\n maxWidth: 420,\n p: 2,\n border: 1,\n borderColor: 'divider',\n borderRadius: 1,\n },\n ...nodeSx,\n ]}\n >\n {availability ? (\n <>\n <Typography variant=\"h6\">{availability.resource.name}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`From $${availability.resource.nightlyRateUsd}/night` +\n (availability.resource.minNights\n ? ` · ${availability.resource.minNights}-night minimum`\n : '')}\n </Typography>\n </>\n ) : null}\n <Box sx={{ display: 'flex', gap: 1 }}>\n <TextField\n label=\"Check-in\"\n type=\"date\"\n value={checkIn}\n onChange={(event) => setCheckIn(event.target.value)}\n size=\"small\"\n fullWidth\n slotProps={{ inputLabel: { shrink: true } }}\n />\n <TextField\n label=\"Check-out\"\n type=\"date\"\n value={checkOut}\n onChange={(event) => setCheckOut(event.target.value)}\n size=\"small\"\n fullWidth\n slotProps={{ inputLabel: { shrink: true } }}\n />\n </Box>\n {conflict ? (\n <Alert severity=\"warning\">{'Those dates are unavailable.'}</Alert>\n ) : quote?.problem ? (\n <Alert severity=\"info\">{quote.problem}</Alert>\n ) : quote ? (\n <>\n <Divider />\n <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>\n <Typography variant=\"body2\">\n {`${quote.nights} night${quote.nights === 1 ? '' : 's'}`}\n </Typography>\n <Typography variant=\"body2\">\n {usd(quote.subtotalCents)}\n </Typography>\n </Box>\n {quote.depositCents < quote.totalCents ? (\n <Box sx={{ display: 'flex', justifyContent: 'space-between' }}>\n <Typography variant=\"body2\" sx={{ fontWeight: 600 }}>\n {'Due today (deposit)'}\n </Typography>\n <Typography variant=\"body2\" sx={{ fontWeight: 600 }}>\n {usd(quote.depositCents)}\n </Typography>\n </Box>\n ) : null}\n </>\n ) : null}\n <TextField\n label=\"Your name\"\n value={guestName}\n onChange={(event) => setGuestName(event.target.value)}\n size=\"small\"\n />\n <TextField\n label=\"Email\"\n type=\"email\"\n value={guestEmail}\n onChange={(event) => setGuestEmail(event.target.value)}\n size=\"small\"\n />\n {status === 'error' ? (\n <Alert severity=\"error\">\n {message || 'Reservation is unavailable right now.'}\n </Alert>\n ) : null}\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={\n status === 'sending' ||\n conflict ||\n !quote ||\n Boolean(quote.problem) ||\n !guestEmail.trim()\n }\n onClick={handleReserve}\n >\n {status === 'sending'\n ? 'Redirecting…'\n : reserveLabel || 'Reserve now'}\n </Button>\n </Box>\n )\n },\n)\nReservationWidget.displayName = 'AglynReservationWidget'\n\nexport const schema: Aglyn.ComponentSchema<ReservationWidgetProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Reservation widget',\n description:\n 'A date-range booking with a live quote and a deposit taken up front.',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiCalendarCheckOutline.path, sx: { color: '#2e7d32' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'resourceId',\n label: 'Resource id',\n description: 'From the Resources card on the Products page.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'reserveLabel',\n label: 'Button label',\n description: 'Defaults to \"Reserve now\".',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Reservation widget',\n pluginId: BUNDLE_ID,\n description: 'Date-range stay booking with live quote + deposit',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiCalendarCheckOutline.path, sx: { color: '#2e7d32' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: {},\n },\n },\n]\n\nexport default ReservationWidget\n"],"names":["Aglyn","buildBeginCheckoutParams","trackEventBeforeNavigation","CommerceModel","mdiCalendarCheckOutline","Alert","Box","Button","Divider","TextField","Typography","forwardRef","useContext","useEffect","useMemo","useRef","useState","BUNDLE_ID","generatePresetId","ID","usd","cents","toFixed","ReservationWidget","props","ref","resourceId","reserveLabel","rest","nodeSx","Array","isArray","hostId","useSite","suppressNavigation","ScreenLinkContext","siteFetch","useSiteFetch","availability","setAvailability","checkIn","setCheckIn","checkOut","setCheckOut","guestName","setGuestName","guestEmail","setGuestEmail","status","setStatus","message","setMessage","active","fetch","encodeURIComponent","then","response","ok","json","payload","catch","undefined","checkInDayMs","Date","parse","checkOutDayMs","quote","computeReservationQuote","resource","conflict","isRangeAvailable","unavailable","map","range","fromDayMs","toDayMs","attemptKey","current","handleReserve","globalThis","crypto","randomUUID","now","Math","random","toString","slice","method","headers","body","JSON","stringify","url","chargedCents","depositCents","totalCents","value","items","item_id","item_name","name","price","quantity","window","location","assign","String","error","sx","p","border","borderColor","borderRadius","color","fontSize","fontFamily","variant","display","flexDirection","gap","maxWidth","nightlyRateUsd","minNights","label","type","onChange","event","target","size","fullWidth","slotProps","inputLabel","shrink","severity","problem","justifyContent","nights","subtotalCents","fontWeight","disabled","Boolean","trim","onClick","displayName","schema","$id","pluginId","description","category","ComponentCategory","COMMERCE","icon","path","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","component","FieldComponentType","TEXT_FIELD","presets","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,wBAAwB,EACxBC,0BAA0B,QACrB,0CAAyC;AAChD,YAAYC,mBAAmB,oBAAU;AACzC,SAASC,uBAAuB,QAAQ,yBAAwB;AAChE,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,gBAAgB,2BAA0B;AACjD,SACEC,UAAU,EACVC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAO;AACd,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,qBAAoB;AAazD,MAAMC,MAAM,CAACC,QAAkB,CAAC,CAAC,EAAE,AAACA,CAAAA,QAAQ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026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /** Loading fallback for the lazy boundary the callers mount this behind. */
18
+ export declare function StorefrontPaymentElementFallback(): import("react").JSX.Element;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ /**
18
+ * The spinner shown WHILE the Payment Element chunk loads (AGL-2486).
19
+ *
20
+ * It lives in its own module for one reason: a `lazy()` fallback that is
21
+ * imported from the lazily-loaded module cancels the laziness. `cart.tsx` and
22
+ * `product-detail.tsx` both used to do
23
+ *
24
+ * ```ts
25
+ * import { StorefrontPaymentElementFallback } from './storefront-payment-element'
26
+ * const StorefrontPaymentElement = lazy(() => import('./storefront-payment-element'))
27
+ * ```
28
+ *
29
+ * — and a static import and a dynamic import of the same module resolve to the
30
+ * same module, so the static one pulled the whole payment element (and, with
31
+ * it, `@stripe/stripe-js`) straight into the eager bundle. The lazy boundary
32
+ * was decorative. Keeping the fallback here is what makes it real.
33
+ *
34
+ * So: nothing in this file may import `@stripe/*`, and `stripe-stays-lazy.spec.ts`
35
+ * asserts that it does not.
36
+ */ import Box from "@mui/material/Box";
37
+ import CircularProgress from "@mui/material/CircularProgress";
38
+ /** Loading fallback for the lazy boundary the callers mount this behind. */ export function StorefrontPaymentElementFallback() {
39
+ return /*#__PURE__*/ _jsx(Box, {
40
+ sx: {
41
+ display: 'flex',
42
+ justifyContent: 'center',
43
+ py: 4
44
+ },
45
+ children: /*#__PURE__*/ _jsx(CircularProgress, {
46
+ size: 24
47
+ })
48
+ });
49
+ }
50
+
51
+ //# sourceMappingURL=storefront-payment-element-fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/storefront-payment-element-fallback.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The spinner shown WHILE the Payment Element chunk loads (AGL-2486).\n *\n * It lives in its own module for one reason: a `lazy()` fallback that is\n * imported from the lazily-loaded module cancels the laziness. `cart.tsx` and\n * `product-detail.tsx` both used to do\n *\n * ```ts\n * import { StorefrontPaymentElementFallback } from './storefront-payment-element'\n * const StorefrontPaymentElement = lazy(() => import('./storefront-payment-element'))\n * ```\n *\n * — and a static import and a dynamic import of the same module resolve to the\n * same module, so the static one pulled the whole payment element (and, with\n * it, `@stripe/stripe-js`) straight into the eager bundle. The lazy boundary\n * was decorative. Keeping the fallback here is what makes it real.\n *\n * So: nothing in this file may import `@stripe/*`, and `stripe-stays-lazy.spec.ts`\n * asserts that it does not.\n */\n\nimport Box from '@mui/material/Box'\nimport CircularProgress from '@mui/material/CircularProgress'\n\n/** Loading fallback for the lazy boundary the callers mount this behind. */\nexport function StorefrontPaymentElementFallback() {\n return (\n <Box sx={{ display: 'flex', justifyContent: 'center', py: 4 }}>\n <CircularProgress size={24} />\n </Box>\n )\n}\n"],"names":["Box","CircularProgress","StorefrontPaymentElementFallback","sx","display","justifyContent","py","size"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;CAmBC,GAED,OAAOA,SAAS,oBAAmB;AACnC,OAAOC,sBAAsB,iCAAgC;AAE7D,0EAA0E,GAC1E,OAAO,SAASC;IACd,qBACE,KAACF;QAAIG,IAAI;YAAEC,SAAS;YAAQC,gBAAgB;YAAUC,IAAI;QAAE;kBAC1D,cAAA,KAACL;YAAiBM,MAAM;;;AAG9B"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * The storefront Payment Element (AGL-1944) — the shopper pays on the
19
+ * merchant's own domain instead of being sent to `checkout.stripe.com`.
20
+ *
21
+ * ## THIS COMPONENT DOES NOT FULFIL ANYTHING
22
+ *
23
+ * It has no success callback, and that absence is the design rather than an
24
+ * omission. `libs/plugins/commerce/src/lib/server/billing-webhook.ts` creates
25
+ * the order on `checkout.session.completed` and is the only thing that ever
26
+ * does. An in-page flow makes trusting the browser far more tempting than a
27
+ * redirect does — the form is right there, `confirm()` resolves in hand, and
28
+ * posting "done, please fulfil" is one line away — and the browser is the one
29
+ * participant in a payment that can lie about having paid.
30
+ *
31
+ * It is also the participant that can VANISH. A shopper who confirms and
32
+ * closes the tab never runs a callback, so a flow that fulfils here loses the
33
+ * order outright while keeping the money; a shopper who refreshes the return
34
+ * page runs it twice. Neither is reachable from a design with no callback in
35
+ * it. What happens after a successful confirm is a redirect to `return_url`,
36
+ * carrying the `session_id` the server put there — so the page can SHOW the
37
+ * shopper a result by looking the order up, without being TOLD the outcome by
38
+ * this code.
39
+ *
40
+ * ## Declines and 3DS
41
+ *
42
+ * Both were handled for us by the redirect and now have to be handled here.
43
+ *
44
+ * A decline resolves as `{ type: 'error' }` and is rendered inline WITHOUT
45
+ * unmounting the form: the shopper's basket, address and chosen method are all
46
+ * still on screen and they can try another card. That is the whole difference
47
+ * between a recoverable decline and a dead end, and it is why the error state
48
+ * below sits beside the element rather than replacing it.
49
+ *
50
+ * A 3DS challenge is Stripe's own: `confirm()` presents the challenge and, for
51
+ * redirect-based methods, sends the browser to `return_url` and back. Nothing
52
+ * here has to model it — but the button must stay disabled across the whole
53
+ * await, because a second `confirm()` during a challenge is exactly the
54
+ * double-submit the server's idempotency claim exists to survive and there is
55
+ * no reason to make it lean on that.
56
+ */
57
+ export interface StorefrontPaymentElementProps {
58
+ /** Stripe's instruction to the browser. Not a claim that money moved. */
59
+ clientSecret: string;
60
+ publishableKey: string;
61
+ /** Shown on the pay button, so the merchant's own total reads through. */
62
+ payLabel?: string;
63
+ /** Abandon the in-page form and return to the store. */
64
+ onCancel?: () => void;
65
+ }
66
+ /** Test seam: `loadStripe` caches per key across a file's tests otherwise. */
67
+ export declare function __resetStripePromises(): void;
68
+ export declare function StorefrontPaymentElement({ clientSecret, publishableKey, payLabel, onCancel, }: StorefrontPaymentElementProps): import("react").JSX.Element;
69
+ /**
70
+ * Re-exported so the old import path still resolves, but the definition now
71
+ * lives in its own module (AGL-2486): a fallback imported FROM the lazily
72
+ * loaded module drags that module into the eager bundle and cancels the
73
+ * `lazy()`. Callers must import it from `./storefront-payment-element-fallback`
74
+ * — importing it from here is exactly the bug, and re-exporting it does not
75
+ * make that safe.
76
+ */
77
+ export { StorefrontPaymentElementFallback } from './storefront-payment-element-fallback';
78
+ export default StorefrontPaymentElement;