@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 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-promotions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Promotion redemption-slot arithmetic (AGL-2453).\n *\n * A redemption cap was CHECKED at checkout-session creation and COUNTED at the\n * webhook, and nothing re-asked the question in between. The increments were\n * atomic and no tick was ever lost — the cap was simply never re-read. The\n * window between the two is the whole Stripe Checkout Session lifetime, up to\n * 24 hours, so this was never bounded by simultaneity: every shopper who loaded\n * checkout while a `maxRedemptions: 100` promotion sat at 99 passed the gate,\n * got the discount, and the counter finished at 99+N. Two browser tabs\n * reproduce it.\n *\n * This is the AGL-2449 gift-card shape, reused rather than re-invented: the\n * slot is HELD in a transaction at checkout and SETTLED in a transaction at the\n * webhook, against a `holds` map on the promotion document itself. One\n * document, no fan-out, no index. The differences from a gift card are only in\n * the units — a slot is one whole redemption rather than a number of cents, so\n * a hold carries no amount.\n *\n * ## Both redemption paths, or neither\n *\n * Two DIFFERENT objects carry `maxRedemptions` and both increment through the\n * same webhook helper: the typed coupon at `coupons/{code}` (AGL-96 semantics)\n * and the AGL-305 discount at `discounts/{id}`, which is evaluated over every\n * enabled promotion and applies with nothing typed at all. Holding only the\n * typed one would leave the identical silent over-redemption on the path a\n * shopper does not even opt into — a \"first 50 customers\" promotion enforced\n * only against whoever is not currently mid-checkout. So the arithmetic lives\n * here, in one place, shaped to fit both documents: `HeldPromotion` is the\n * three fields they have in common and nothing else.\n *\n * ## A held slot COUNTS while the session is live\n *\n * This was the owner's call, and it is recorded here because it is the thing a\n * reader will want to argue with. A held-but-unpaid slot reads as REDEEMED for\n * as long as its session can still be paid, and is released when that session\n * expires or is cancelled.\n *\n * The alternative — showing held slots separately and letting a new shopper\n * claim one — reopens the defect for exactly the duration of a live checkout.\n * The two costs are not symmetric: a promotion that oversells is money the\n * merchant did not agree to spend and cannot claw back, while a shopper who\n * sees \"code unavailable\" during someone else's live checkout tries again and\n * succeeds. Over-holding fails safe; under-holding fails expensive.\n *\n * ## Uncapped promotions hold NOTHING\n *\n * `maxRedemptions == null` means there is no slot to reserve, so no hold is\n * placed, no document is written at checkout, and the webhook keeps the plain\n * `increment(1)`. That is not an optimization for its own sake: it keeps the\n * common promotion — the one with no limit — on exactly the write path it had\n * before this issue, so the blast radius of the fix is the capped case only.\n *\n * ## Expiry is a backstop, not the mechanism\n *\n * Every hold carries `expiresAtMs` and every read prunes, so a crashed process\n * cannot strand a merchant's slot forever. But the release is EXPLICIT: each\n * refusal below the checkout claim drops the hold it placed, and\n * `checkout.session.expired` drops the hold of a session that will never be\n * paid. Relying on the TTL alone would mean a merchant watching a cap of 100\n * sit at 100 for a day after an abandoned cart, with nothing in the product\n * able to explain why.\n */\n\n/**\n * One in-flight claim on a promotion slot.\n *\n * No `count`: a checkout redeems a promotion exactly once however many lines\n * it discounts, which is what the webhook's `increment(1)` has always meant.\n * A shape that could express two would invite a caller to write it.\n */\nexport interface PromotionHold {\n expiresAtMs: number\n}\n\n/**\n * The redemption-cap fields shared by `coupons/{code}` and `discounts/{id}`.\n *\n * Deliberately NOT a union of the two document types. The hold arithmetic must\n * behave identically on both or the fix covers one path and not the other, and\n * the cheapest way to guarantee that is to give it no way to tell them apart.\n */\nexport interface HeldPromotion {\n maxRedemptions?: number\n redemptions?: number\n /** Hold key → hold. Absent on every promotion written before AGL-2453. */\n holds?: Record<string, PromotionHold>\n}\n\n/**\n * Stripe Checkout Sessions expire 24h after creation, so a hold outlives any\n * session that can still be paid. A shorter TTL is not the safer choice it\n * looks like: a hold that lapsed while its session was still payable would\n * reopen the very window this closes.\n */\nexport const PROMOTION_HOLD_TTL_MS = 24 * 60 * 60 * 1000\n\n/** What a shopper is told when every slot is spoken for. */\nexport const PROMOTION_EXHAUSTED_MESSAGE =\n 'This discount has been fully redeemed'\n\n/**\n * What a shopper is told when an AUTOMATIC promotion ran out mid-checkout.\n *\n * A separate sentence because the shopper never typed anything: \"this discount\n * has been fully redeemed\" reads as an accusation against a code they did not\n * enter. Naming the refresh is the recovery — the resolver counts holds too, so\n * the reloaded cart simply prices without the promotion and checks out.\n */\nexport const PROMOTION_UNAVAILABLE_MESSAGE =\n 'A promotion on your cart has just been fully redeemed. ' +\n 'Refresh your cart to see the current price.'\n\n/**\n * The promotion's holds with the lapsed ones dropped.\n *\n * Total, not a filter over a trusted shape: a hold whose `expiresAtMs` is\n * absent or non-numeric is treated as EXPIRED rather than eternal, so a\n * malformed row releases the slot instead of stranding it. A merchant losing a\n * configured slot forever to a corrupt map entry is the one direction that has\n * no recovery inside the product.\n */\nexport function prunePromotionHolds(\n holds: Record<string, PromotionHold> | undefined,\n nowMs: number,\n): Record<string, PromotionHold> {\n const live: Record<string, PromotionHold> = {}\n for (const [key, hold] of Object.entries(holds ?? {})) {\n const expiresAtMs = Number(hold?.expiresAtMs)\n if (!Number.isFinite(expiresAtMs) || expiresAtMs <= nowMs) continue\n live[key] = { expiresAtMs }\n }\n return live\n}\n\n/** Settled redemptions, coerced — a corrupt counter must not read as `-1`. */\nfunction settledCount(promotion: HeldPromotion | undefined): number {\n const count = Math.round(Number(promotion?.redemptions ?? 0))\n return Number.isFinite(count) && count > 0 ? count : 0\n}\n\n/**\n * Slots spoken for right now: settled redemptions plus every live hold.\n *\n * `exceptHoldKey` is how a retry of one attempt does not stand in its own way.\n * The shopper presses the same button twice, the second press re-derives the\n * same hold key, and without this exclusion it would be refused its own slot.\n */\nexport function promotionClaimedCount(\n promotion: HeldPromotion | undefined,\n nowMs: number,\n exceptHoldKey?: string,\n): number {\n const live = prunePromotionHolds(promotion?.holds, nowMs)\n if (exceptHoldKey) delete live[exceptHoldKey]\n return settledCount(promotion) + Object.keys(live).length\n}\n\n/**\n * Slots left, or `null` when the promotion is uncapped.\n *\n * `null` rather than `Infinity` so a caller cannot accidentally do arithmetic\n * on \"no limit\" and get a number. Never negative: a cap lowered below the\n * redemptions already taken reads as zero left, not as a debt.\n */\nexport function promotionRemainingSlots(\n promotion: HeldPromotion | undefined,\n nowMs: number,\n exceptHoldKey?: string,\n): number | null {\n const max = Number(promotion?.maxRedemptions)\n if (promotion?.maxRedemptions == null || !Number.isFinite(max)) return null\n return Math.max(\n 0,\n Math.round(max) - promotionClaimedCount(promotion, nowMs, exceptHoldKey),\n )\n}\n\n/**\n * Is there no slot left for a NEW claim?\n *\n * The one question both the pre-read (which filters a promotion out of the\n * resolver) and the in-transaction re-read (which refuses the checkout) ask, so\n * the two cannot drift apart — the drift is what AGL-2450 had to extract a\n * shared filter to prevent.\n */\nexport function promotionExhausted(\n promotion: HeldPromotion | undefined,\n nowMs: number,\n exceptHoldKey?: string,\n): boolean {\n const remaining = promotionRemainingSlots(promotion, nowMs, exceptHoldKey)\n return remaining != null && remaining <= 0\n}\n\n/**\n * How many live checkouts are currently holding a slot.\n *\n * The merchant-facing half of the decision (AGL-2453). The console's promotion\n * and coupon cards read `redemptions / maxRedemptions`, and once a hold counts\n * as spent that figure alone would show a cap of 100 sitting at 100 with no\n * explanation for a merchant looking at 97 orders. This is what the cards name\n * separately, so \"held\" is a state the merchant can SEE rather than a\n * discrepancy they have to reason about.\n */\nexport function promotionHeldCount(\n promotion: HeldPromotion | undefined,\n nowMs: number,\n): number {\n return Object.keys(prunePromotionHolds(promotion?.holds, nowMs)).length\n}\n\n/**\n * The usage line both console cards print, so the two cannot word it\n * differently. Empty string when the promotion is uncapped and nothing is held\n * — there is no cap to report against.\n */\nexport function promotionUsageLabel(\n promotion: HeldPromotion | undefined,\n nowMs: number,\n): string {\n const held = promotionHeldCount(promotion, nowMs)\n const settled = settledCount(promotion)\n const cap =\n promotion?.maxRedemptions != null ? `/${promotion.maxRedemptions}` : ''\n if (!cap && !held) return `${settled} used`\n const heldPart = held > 0 ? ` · ${held} held in checkout` : ''\n return `${settled}${cap} used${heldPart}`\n}\n\n/**\n * Does settling `holdKey` owe the promotion a redemption?\n *\n * NOT pruned, deliberately, and this is the asymmetry that matters: a hold that\n * lapsed while its session sat unpaid is still owed once that session IS paid.\n * Expiry governs what a NEW checkout may claim, never whether a completed\n * payment is counted — dropping it here would give the shopper a discount the\n * merchant's cap never recorded, which is the original defect arriving through\n * the release path.\n *\n * A hold that is not there settles NOTHING. That is the webhook-redelivery case\n * — the first delivery consumed it — and it is what makes the settlement\n * idempotent under the at-least-once delivery `reconcile-stock.ts:52-58`\n * records this file's callers as living with.\n */\nexport function promotionSettles(\n promotion: HeldPromotion | undefined,\n holdKey: string,\n): boolean {\n return Boolean(holdKey) && (promotion?.holds ?? {})[holdKey] != null\n}\n"],"names":["PROMOTION_HOLD_TTL_MS","PROMOTION_EXHAUSTED_MESSAGE","PROMOTION_UNAVAILABLE_MESSAGE","prunePromotionHolds","holds","nowMs","live","key","hold","Object","entries","expiresAtMs","Number","isFinite","settledCount","promotion","count","Math","round","redemptions","promotionClaimedCount","exceptHoldKey","keys","length","promotionRemainingSlots","max","maxRedemptions","promotionExhausted","remaining","promotionHeldCount","promotionUsageLabel","held","settled","cap","heldPart","promotionSettles","holdKey","Boolean"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DC,GAED;;;;;;CAMC,GAmBD;;;;;CAKC,GACD,OAAO,MAAMA,wBAAwB,KAAK,KAAK,KAAK,KAAI;AAExD,0DAA0D,GAC1D,OAAO,MAAMC,8BACX,wCAAuC;AAEzC;;;;;;;CAOC,GACD,OAAO,MAAMC,gCACX,4DACA,8CAA6C;AAE/C;;;;;;;;CAQC,GACD,OAAO,SAASC,oBACdC,KAAgD,EAChDC,KAAa;IAEb,MAAMC,OAAsC,CAAC;IAC7C,KAAK,MAAM,CAACC,KAAKC,KAAK,IAAIC,OAAOC,OAAO,CAACN,gBAAAA,QAAS,CAAC,GAAI;QACrD,MAAMO,cAAcC,OAAOJ,wBAAAA,KAAMG,WAAW;QAC5C,IAAI,CAACC,OAAOC,QAAQ,CAACF,gBAAgBA,eAAeN,OAAO;QAC3DC,IAAI,CAACC,IAAI,GAAG;YAAEI;QAAY;IAC5B;IACA,OAAOL;AACT;AAEA,4EAA4E,GAC5E,SAASQ,aAAaC,SAAoC;;IACxD,MAAMC,QAAQC,KAAKC,KAAK,CAACN,eAAOG,6BAAAA,UAAWI,WAAW,mBAAI;IAC1D,OAAOP,OAAOC,QAAQ,CAACG,UAAUA,QAAQ,IAAIA,QAAQ;AACvD;AAEA;;;;;;CAMC,GACD,OAAO,SAASI,sBACdL,SAAoC,EACpCV,KAAa,EACbgB,aAAsB;IAEtB,MAAMf,OAAOH,oBAAoBY,6BAAAA,UAAWX,KAAK,EAAEC;IACnD,IAAIgB,eAAe,OAAOf,IAAI,CAACe,cAAc;IAC7C,OAAOP,aAAaC,aAAaN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AAY,SAACrB,6BAAAA,UAAWX,KAAK,mBAAI,CAAC,EAAE,CAACgC,QAAQ,IAAI;AAClE"}
@@ -0,0 +1,175 @@
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
+ * Reservations v1 (AGL-304): bookable units (cabins) with date-range
19
+ * stays, seasonal pricing, deposits, and cancellation windows —
20
+ * extending the appointment-slot bookings (AGL-159) rather than
21
+ * replacing them. Dates are day-precision epoch-ms at UTC midnight
22
+ * (`dayMs`); nights = checkout day − checkin day. Pure — the
23
+ * reservation APIs and console own I/O.
24
+ */
25
+ import type { StorefrontTaxMode } from './commerce-tax-decision';
26
+ export declare const DAY_MS: number;
27
+ /** Seasonal pricing window by month-day (year-agnostic, inclusive). */
28
+ export interface ResourceSeason {
29
+ /** 'MM-DD' inclusive start, e.g. '06-01'. */
30
+ from: string;
31
+ /** 'MM-DD' inclusive end; may wrap the year (e.g. '12-15'..'01-05'). */
32
+ to: string;
33
+ /** Multiplier on the nightly rate, e.g. 1.5 for peak. */
34
+ multiplier: number;
35
+ label?: string;
36
+ }
37
+ /** `hosts/{hostId}/resources/{id}` doc. */
38
+ export interface HostResource {
39
+ name: string;
40
+ description?: string;
41
+ /** Sleeps N; display only. */
42
+ capacity?: number;
43
+ photoUrls?: string[];
44
+ amenities?: string[];
45
+ nightlyRateUsd: number;
46
+ /** Friday/Saturday nights multiply by this (default 1). */
47
+ weekendMultiplier?: number;
48
+ seasons?: ResourceSeason[];
49
+ minNights?: number;
50
+ /** Deposit due at reservation: percent of total (1-100). */
51
+ depositPct?: number;
52
+ /** Free cancellation until this many hours before check-in. */
53
+ cancellationHours?: number;
54
+ /** Manually blocked day ranges (maintenance etc.), dayMs pairs. */
55
+ blocks?: Array<{
56
+ fromDayMs: number;
57
+ toDayMs: number;
58
+ }>;
59
+ }
60
+ export type ReservationStatus = 'pending' | 'confirmed' | 'checked_in' | 'checked_out' | 'cancelled' | 'no_show';
61
+ /** `hosts/{hostId}/reservations/{id}` doc. */
62
+ export interface HostReservation {
63
+ resourceId: string;
64
+ status: ReservationStatus;
65
+ /** UTC-midnight day of arrival. */
66
+ checkInDayMs: number;
67
+ /** UTC-midnight day of departure (exclusive). */
68
+ checkOutDayMs: number;
69
+ guestName?: string | null;
70
+ guestEmail?: string | null;
71
+ nights?: number;
72
+ totalCents?: number;
73
+ depositCents?: number;
74
+ /** Payments applied so far (deposit, folio settlements). */
75
+ paidCents?: number;
76
+ /** POS folio lines charged to the stay (AGL-317). */
77
+ folio?: Array<{
78
+ orderId: string;
79
+ amountCents: number;
80
+ note?: string;
81
+ atMs: number;
82
+ }>;
83
+ checkoutSessionId?: string;
84
+ createdAtMs?: number;
85
+ /**
86
+ * WHICH tax regime the paid deposit carried (AGL-1969), stamped at
87
+ * confirmation from the same `storefrontTaxModeOf` derivation every order
88
+ * door uses (AGL-2451).
89
+ *
90
+ * `manual` on a stay whose merchant had set a lodging rate
91
+ * (`TaxSettings.lodging`), `none` where they had not — which is the default
92
+ * and every store that has not opted in. Never `stripe-automatic` from this
93
+ * path: Stripe Tax cannot compute occupancy tax without a lodging tax code
94
+ * `reserve.ts` does not send, so the rate is always the merchant's own and
95
+ * is never computed against Aglyn's registrations (AGL-1904).
96
+ *
97
+ * ABSENT is a fourth state and is not `none` — it means the reservation was
98
+ * confirmed before this field existed. See `StorefrontTaxMode`.
99
+ */
100
+ taxMode?: StorefrontTaxMode;
101
+ /**
102
+ * The lodging tax charged on top of `paidCents` (AGL-1969), from the
103
+ * merchant's own rate. Absent, never zero, where none was charged.
104
+ *
105
+ * SEPARATE FROM `paidCents` on purpose: that field is the money applied to
106
+ * the STAY and the console divides it by `totalCents` to show what is still
107
+ * owed. Tax is not part of the stay's price and is not the merchant's
108
+ * revenue.
109
+ *
110
+ * LIMITATION, stated rather than decided: this is the rate applied to what
111
+ * was CHARGED, which on a deposit-taking resource is the deposit rather than
112
+ * the stay. Whether a jurisdiction wants occupancy tax on the full stay at
113
+ * booking, on the deposit, or on redemption is not a question this codebase
114
+ * answers — see `reserve.ts` and the merchant copy on the Taxes card.
115
+ */
116
+ taxCents?: number;
117
+ }
118
+ /** UTC midnight for an instant. */
119
+ export declare function toDayMs(atMs: number): number;
120
+ /** Per-night rate in cents for one specific night. */
121
+ export declare function nightlyRateCents(resource: Pick<HostResource, 'nightlyRateUsd' | 'weekendMultiplier' | 'seasons'>, dayMs: number): number;
122
+ export interface ReservationQuote {
123
+ nights: number;
124
+ subtotalCents: number;
125
+ depositCents: number;
126
+ totalCents: number;
127
+ /** Per-night breakdown for the quote UI. */
128
+ nightlyCents: number[];
129
+ problem?: string;
130
+ }
131
+ /** Prices a stay; `problem` set (and zeros) when the range is invalid. */
132
+ export declare function computeReservationQuote(resource: HostResource, checkInDayMs: number, checkOutDayMs: number): ReservationQuote;
133
+ /**
134
+ * How long an unpaid `pending` reservation stands between the next guest and
135
+ * the dates it named.
136
+ *
137
+ * A `pending` row is written before the Stripe session opens, and nothing ever
138
+ * clears one: `process-abandoned.ts` sweeps `checkouts`, not `reservations`.
139
+ * So the hold has to lapse by the clock rather than by a job, or one guest who
140
+ * closed the tab at the payment screen takes those dates off the market
141
+ * permanently.
142
+ */
143
+ export declare const PENDING_RESERVATION_HOLD_MS: number;
144
+ /**
145
+ * Does this reservation still stand between a guest and its dates?
146
+ *
147
+ * THE one answer, because four surfaces ask it — the booking door, the booking
148
+ * transaction's re-read, the storefront availability endpoint behind the
149
+ * date-picker, and the console's walk-in check — and they were not asking it
150
+ * the same way. Only the booking door aged out a stale `pending`, so the
151
+ * storefront painted dates unavailable that the booking door would have sold,
152
+ * and the front desk was told a room was taken while it stood empty.
153
+ *
154
+ * A `pending` row carrying no `createdAtMs` releases rather than holds: an
155
+ * unbounded hold on a row that cannot prove its own age is the failure this
156
+ * lapse exists to prevent, and the booking door re-checks inside its
157
+ * transaction before any money moves.
158
+ */
159
+ export declare function reservationHoldsDates(reservation: Pick<HostReservation, 'status'> & {
160
+ createdAtMs?: number;
161
+ }, nowMs?: number): boolean;
162
+ /**
163
+ * Availability: a candidate range conflicts when it overlaps a live
164
+ * reservation ([checkIn, checkOut) semantics — back-to-back stays touch
165
+ * without conflict) or a manual block.
166
+ *
167
+ * `nowMs` is a parameter so the pending lapse is testable without freezing the
168
+ * clock. A caller passing reservations without `createdAtMs` gets the same
169
+ * answer as before for every status but `pending`.
170
+ */
171
+ export declare function isRangeAvailable(resource: Pick<HostResource, 'blocks'>, reservations: Array<Pick<HostReservation, 'checkInDayMs' | 'checkOutDayMs' | 'status'> & {
172
+ createdAtMs?: number;
173
+ }>, checkInDayMs: number, checkOutDayMs: number, nowMs?: number): boolean;
174
+ /** Free-cancellation check against the policy window. */
175
+ export declare function canCancelReservation(resource: Pick<HostResource, 'cancellationHours'>, reservation: Pick<HostReservation, 'checkInDayMs' | 'status'>, nowMs?: number): boolean;
@@ -0,0 +1,157 @@
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
+ * Reservations v1 (AGL-304): bookable units (cabins) with date-range
18
+ * stays, seasonal pricing, deposits, and cancellation windows —
19
+ * extending the appointment-slot bookings (AGL-159) rather than
20
+ * replacing them. Dates are day-precision epoch-ms at UTC midnight
21
+ * (`dayMs`); nights = checkout day − checkin day. Pure — the
22
+ * reservation APIs and console own I/O.
23
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
24
+ export const DAY_MS = 24 * 60 * 60 * 1000;
25
+ /** UTC midnight for an instant. */ export function toDayMs(atMs) {
26
+ return Math.floor(atMs / DAY_MS) * DAY_MS;
27
+ }
28
+ function monthDay(dayMs) {
29
+ const date = new Date(dayMs);
30
+ const month = String(date.getUTCMonth() + 1).padStart(2, '0');
31
+ const day = String(date.getUTCDate()).padStart(2, '0');
32
+ return `${month}-${day}`;
33
+ }
34
+ function inSeason(dayKey, season) {
35
+ if (season.from <= season.to) {
36
+ return dayKey >= season.from && dayKey <= season.to;
37
+ }
38
+ // Wrapping season (e.g. 12-15 .. 01-05).
39
+ return dayKey >= season.from || dayKey <= season.to;
40
+ }
41
+ /** Per-night rate in cents for one specific night. */ export function nightlyRateCents(resource, dayMs) {
42
+ var _resource_seasons;
43
+ let rate = resource.nightlyRateUsd * 100;
44
+ const weekday = new Date(dayMs).getUTCDay();
45
+ if ((weekday === 5 || weekday === 6) && resource.weekendMultiplier) {
46
+ rate *= resource.weekendMultiplier;
47
+ }
48
+ const dayKey = monthDay(dayMs);
49
+ for (const season of (_resource_seasons = resource.seasons) != null ? _resource_seasons : []){
50
+ if (inSeason(dayKey, season)) {
51
+ rate *= season.multiplier;
52
+ break;
53
+ }
54
+ }
55
+ return Math.round(rate);
56
+ }
57
+ /** Prices a stay; `problem` set (and zeros) when the range is invalid. */ export function computeReservationQuote(resource, checkInDayMs, checkOutDayMs) {
58
+ var _resource_depositPct;
59
+ const empty = {
60
+ nights: 0,
61
+ subtotalCents: 0,
62
+ depositCents: 0,
63
+ totalCents: 0,
64
+ nightlyCents: []
65
+ };
66
+ const nights = Math.round((checkOutDayMs - checkInDayMs) / DAY_MS);
67
+ if (!(nights > 0)) return _extends({}, empty, {
68
+ problem: 'Choose at least one night'
69
+ });
70
+ if (resource.minNights && nights < resource.minNights) {
71
+ return _extends({}, empty, {
72
+ problem: `Minimum stay is ${resource.minNights} nights`
73
+ });
74
+ }
75
+ const nightlyCents = [];
76
+ for(let day = checkInDayMs; day < checkOutDayMs; day += DAY_MS){
77
+ nightlyCents.push(nightlyRateCents(resource, day));
78
+ }
79
+ const subtotalCents = nightlyCents.reduce((sum, cents)=>sum + cents, 0);
80
+ const depositPct = Math.min(100, Math.max(0, (_resource_depositPct = resource.depositPct) != null ? _resource_depositPct : 100));
81
+ const depositCents = Math.round(subtotalCents * depositPct / 100);
82
+ return {
83
+ nights,
84
+ subtotalCents,
85
+ depositCents,
86
+ totalCents: subtotalCents,
87
+ nightlyCents
88
+ };
89
+ }
90
+ /**
91
+ * How long an unpaid `pending` reservation stands between the next guest and
92
+ * the dates it named.
93
+ *
94
+ * A `pending` row is written before the Stripe session opens, and nothing ever
95
+ * clears one: `process-abandoned.ts` sweeps `checkouts`, not `reservations`.
96
+ * So the hold has to lapse by the clock rather than by a job, or one guest who
97
+ * closed the tab at the payment screen takes those dates off the market
98
+ * permanently.
99
+ */ export const PENDING_RESERVATION_HOLD_MS = 30 * 60 * 1000;
100
+ /**
101
+ * Does this reservation still stand between a guest and its dates?
102
+ *
103
+ * THE one answer, because four surfaces ask it — the booking door, the booking
104
+ * transaction's re-read, the storefront availability endpoint behind the
105
+ * date-picker, and the console's walk-in check — and they were not asking it
106
+ * the same way. Only the booking door aged out a stale `pending`, so the
107
+ * storefront painted dates unavailable that the booking door would have sold,
108
+ * and the front desk was told a room was taken while it stood empty.
109
+ *
110
+ * A `pending` row carrying no `createdAtMs` releases rather than holds: an
111
+ * unbounded hold on a row that cannot prove its own age is the failure this
112
+ * lapse exists to prevent, and the booking door re-checks inside its
113
+ * transaction before any money moves.
114
+ */ export function reservationHoldsDates(reservation, nowMs = Date.now()) {
115
+ var _reservation_createdAtMs;
116
+ if (reservation.status === 'cancelled' || reservation.status === 'no_show') {
117
+ return false;
118
+ }
119
+ if (reservation.status !== 'pending') return true;
120
+ const createdAtMs = Number((_reservation_createdAtMs = reservation.createdAtMs) != null ? _reservation_createdAtMs : 0);
121
+ return createdAtMs > 0 && nowMs - createdAtMs < PENDING_RESERVATION_HOLD_MS;
122
+ }
123
+ /**
124
+ * Availability: a candidate range conflicts when it overlaps a live
125
+ * reservation ([checkIn, checkOut) semantics — back-to-back stays touch
126
+ * without conflict) or a manual block.
127
+ *
128
+ * `nowMs` is a parameter so the pending lapse is testable without freezing the
129
+ * clock. A caller passing reservations without `createdAtMs` gets the same
130
+ * answer as before for every status but `pending`.
131
+ */ export function isRangeAvailable(resource, reservations, checkInDayMs, checkOutDayMs, nowMs = Date.now()) {
132
+ var _resource_blocks;
133
+ if (!(checkOutDayMs > checkInDayMs)) return false;
134
+ for (const reservation of reservations){
135
+ if (!reservationHoldsDates(reservation, nowMs)) continue;
136
+ if (checkInDayMs < reservation.checkOutDayMs && checkOutDayMs > reservation.checkInDayMs) {
137
+ return false;
138
+ }
139
+ }
140
+ for (const block of (_resource_blocks = resource.blocks) != null ? _resource_blocks : []){
141
+ if (checkInDayMs < block.toDayMs && checkOutDayMs > block.fromDayMs) {
142
+ return false;
143
+ }
144
+ }
145
+ return true;
146
+ }
147
+ /** Free-cancellation check against the policy window. */ export function canCancelReservation(resource, reservation, nowMs = Date.now()) {
148
+ var _resource_cancellationHours;
149
+ if (![
150
+ 'pending',
151
+ 'confirmed'
152
+ ].includes(reservation.status)) return false;
153
+ const windowMs = ((_resource_cancellationHours = resource.cancellationHours) != null ? _resource_cancellationHours : 0) * 60 * 60 * 1000;
154
+ return nowMs <= reservation.checkInDayMs - windowMs;
155
+ }
156
+
157
+ //# sourceMappingURL=commerce-reservations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/model/commerce-reservations.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Reservations v1 (AGL-304): bookable units (cabins) with date-range\n * stays, seasonal pricing, deposits, and cancellation windows —\n * extending the appointment-slot bookings (AGL-159) rather than\n * replacing them. Dates are day-precision epoch-ms at UTC midnight\n * (`dayMs`); nights = checkout day − checkin day. Pure — the\n * reservation APIs and console own I/O.\n */\n\nimport type { StorefrontTaxMode } from './commerce-tax-decision'\n\nexport const DAY_MS = 24 * 60 * 60 * 1000\n\n/** Seasonal pricing window by month-day (year-agnostic, inclusive). */\nexport interface ResourceSeason {\n /** 'MM-DD' inclusive start, e.g. '06-01'. */\n from: string\n /** 'MM-DD' inclusive end; may wrap the year (e.g. '12-15'..'01-05'). */\n to: string\n /** Multiplier on the nightly rate, e.g. 1.5 for peak. */\n multiplier: number\n label?: string\n}\n\n/** `hosts/{hostId}/resources/{id}` doc. */\nexport interface HostResource {\n name: string\n description?: string\n /** Sleeps N; display only. */\n capacity?: number\n photoUrls?: string[]\n amenities?: string[]\n nightlyRateUsd: number\n /** Friday/Saturday nights multiply by this (default 1). */\n weekendMultiplier?: number\n seasons?: ResourceSeason[]\n minNights?: number\n /** Deposit due at reservation: percent of total (1-100). */\n depositPct?: number\n /** Free cancellation until this many hours before check-in. */\n cancellationHours?: number\n /** Manually blocked day ranges (maintenance etc.), dayMs pairs. */\n blocks?: Array<{ fromDayMs: number; toDayMs: number }>\n}\n\nexport type ReservationStatus =\n | 'pending'\n | 'confirmed'\n | 'checked_in'\n | 'checked_out'\n | 'cancelled'\n | 'no_show'\n\n/** `hosts/{hostId}/reservations/{id}` doc. */\nexport interface HostReservation {\n resourceId: string\n status: ReservationStatus\n /** UTC-midnight day of arrival. */\n checkInDayMs: number\n /** UTC-midnight day of departure (exclusive). */\n checkOutDayMs: number\n guestName?: string | null\n guestEmail?: string | null\n nights?: number\n totalCents?: number\n depositCents?: number\n /** Payments applied so far (deposit, folio settlements). */\n paidCents?: number\n /** POS folio lines charged to the stay (AGL-317). */\n folio?: Array<{\n orderId: string\n amountCents: number\n note?: string\n atMs: number\n }>\n checkoutSessionId?: string\n createdAtMs?: number\n /**\n * WHICH tax regime the paid deposit carried (AGL-1969), stamped at\n * confirmation from the same `storefrontTaxModeOf` derivation every order\n * door uses (AGL-2451).\n *\n * `manual` on a stay whose merchant had set a lodging rate\n * (`TaxSettings.lodging`), `none` where they had not — which is the default\n * and every store that has not opted in. Never `stripe-automatic` from this\n * path: Stripe Tax cannot compute occupancy tax without a lodging tax code\n * `reserve.ts` does not send, so the rate is always the merchant's own and\n * is never computed against Aglyn's registrations (AGL-1904).\n *\n * ABSENT is a fourth state and is not `none` — it means the reservation was\n * confirmed before this field existed. See `StorefrontTaxMode`.\n */\n taxMode?: StorefrontTaxMode\n /**\n * The lodging tax charged on top of `paidCents` (AGL-1969), from the\n * merchant's own rate. Absent, never zero, where none was charged.\n *\n * SEPARATE FROM `paidCents` on purpose: that field is the money applied to\n * the STAY and the console divides it by `totalCents` to show what is still\n * owed. Tax is not part of the stay's price and is not the merchant's\n * revenue.\n *\n * LIMITATION, stated rather than decided: this is the rate applied to what\n * was CHARGED, which on a deposit-taking resource is the deposit rather than\n * the stay. Whether a jurisdiction wants occupancy tax on the full stay at\n * booking, on the deposit, or on redemption is not a question this codebase\n * answers — see `reserve.ts` and the merchant copy on the Taxes card.\n */\n taxCents?: number\n}\n\n/** UTC midnight for an instant. */\nexport function toDayMs(atMs: number): number {\n return Math.floor(atMs / DAY_MS) * DAY_MS\n}\n\nfunction monthDay(dayMs: number): string {\n const date = new Date(dayMs)\n const month = String(date.getUTCMonth() + 1).padStart(2, '0')\n const day = String(date.getUTCDate()).padStart(2, '0')\n return `${month}-${day}`\n}\n\nfunction inSeason(dayKey: string, season: ResourceSeason): boolean {\n if (season.from <= season.to) {\n return dayKey >= season.from && dayKey <= season.to\n }\n // Wrapping season (e.g. 12-15 .. 01-05).\n return dayKey >= season.from || dayKey <= season.to\n}\n\n/** Per-night rate in cents for one specific night. */\nexport function nightlyRateCents(\n resource: Pick<\n HostResource,\n 'nightlyRateUsd' | 'weekendMultiplier' | 'seasons'\n >,\n dayMs: number,\n): number {\n let rate = resource.nightlyRateUsd * 100\n const weekday = new Date(dayMs).getUTCDay()\n if ((weekday === 5 || weekday === 6) && resource.weekendMultiplier) {\n rate *= resource.weekendMultiplier\n }\n const dayKey = monthDay(dayMs)\n for (const season of resource.seasons ?? []) {\n if (inSeason(dayKey, season)) {\n rate *= season.multiplier\n break\n }\n }\n return Math.round(rate)\n}\n\nexport interface ReservationQuote {\n nights: number\n subtotalCents: number\n depositCents: number\n totalCents: number\n /** Per-night breakdown for the quote UI. */\n nightlyCents: number[]\n problem?: string\n}\n\n/** Prices a stay; `problem` set (and zeros) when the range is invalid. */\nexport function computeReservationQuote(\n resource: HostResource,\n checkInDayMs: number,\n checkOutDayMs: number,\n): ReservationQuote {\n const empty: ReservationQuote = {\n nights: 0,\n subtotalCents: 0,\n depositCents: 0,\n totalCents: 0,\n nightlyCents: [],\n }\n const nights = Math.round((checkOutDayMs - checkInDayMs) / DAY_MS)\n if (!(nights > 0)) return { ...empty, problem: 'Choose at least one night' }\n if (resource.minNights && nights < resource.minNights) {\n return { ...empty, problem: `Minimum stay is ${resource.minNights} nights` }\n }\n const nightlyCents: number[] = []\n for (let day = checkInDayMs; day < checkOutDayMs; day += DAY_MS) {\n nightlyCents.push(nightlyRateCents(resource, day))\n }\n const subtotalCents = nightlyCents.reduce((sum, cents) => sum + cents, 0)\n const depositPct = Math.min(100, Math.max(0, resource.depositPct ?? 100))\n const depositCents = Math.round((subtotalCents * depositPct) / 100)\n return {\n nights,\n subtotalCents,\n depositCents,\n totalCents: subtotalCents,\n nightlyCents,\n }\n}\n\n/**\n * How long an unpaid `pending` reservation stands between the next guest and\n * the dates it named.\n *\n * A `pending` row is written before the Stripe session opens, and nothing ever\n * clears one: `process-abandoned.ts` sweeps `checkouts`, not `reservations`.\n * So the hold has to lapse by the clock rather than by a job, or one guest who\n * closed the tab at the payment screen takes those dates off the market\n * permanently.\n */\nexport const PENDING_RESERVATION_HOLD_MS = 30 * 60 * 1000\n\n/**\n * Does this reservation still stand between a guest and its dates?\n *\n * THE one answer, because four surfaces ask it — the booking door, the booking\n * transaction's re-read, the storefront availability endpoint behind the\n * date-picker, and the console's walk-in check — and they were not asking it\n * the same way. Only the booking door aged out a stale `pending`, so the\n * storefront painted dates unavailable that the booking door would have sold,\n * and the front desk was told a room was taken while it stood empty.\n *\n * A `pending` row carrying no `createdAtMs` releases rather than holds: an\n * unbounded hold on a row that cannot prove its own age is the failure this\n * lapse exists to prevent, and the booking door re-checks inside its\n * transaction before any money moves.\n */\nexport function reservationHoldsDates(\n reservation: Pick<HostReservation, 'status'> & { createdAtMs?: number },\n nowMs: number = Date.now(),\n): boolean {\n if (reservation.status === 'cancelled' || reservation.status === 'no_show') {\n return false\n }\n if (reservation.status !== 'pending') return true\n const createdAtMs = Number(reservation.createdAtMs ?? 0)\n return createdAtMs > 0 && nowMs - createdAtMs < PENDING_RESERVATION_HOLD_MS\n}\n\n/**\n * Availability: a candidate range conflicts when it overlaps a live\n * reservation ([checkIn, checkOut) semantics — back-to-back stays touch\n * without conflict) or a manual block.\n *\n * `nowMs` is a parameter so the pending lapse is testable without freezing the\n * clock. A caller passing reservations without `createdAtMs` gets the same\n * answer as before for every status but `pending`.\n */\nexport function isRangeAvailable(\n resource: Pick<HostResource, 'blocks'>,\n reservations: Array<\n Pick<HostReservation, 'checkInDayMs' | 'checkOutDayMs' | 'status'> & {\n createdAtMs?: number\n }\n >,\n checkInDayMs: number,\n checkOutDayMs: number,\n nowMs: number = Date.now(),\n): boolean {\n if (!(checkOutDayMs > checkInDayMs)) return false\n for (const reservation of reservations) {\n if (!reservationHoldsDates(reservation, nowMs)) continue\n if (\n checkInDayMs < reservation.checkOutDayMs &&\n checkOutDayMs > reservation.checkInDayMs\n ) {\n return false\n }\n }\n for (const block of resource.blocks ?? []) {\n if (checkInDayMs < block.toDayMs && checkOutDayMs > block.fromDayMs) {\n return false\n }\n }\n return true\n}\n\n/** Free-cancellation check against the policy window. */\nexport function canCancelReservation(\n resource: Pick<HostResource, 'cancellationHours'>,\n reservation: Pick<HostReservation, 'checkInDayMs' | 'status'>,\n nowMs = Date.now(),\n): boolean {\n if (!['pending', 'confirmed'].includes(reservation.status)) return false\n const windowMs = (resource.cancellationHours ?? 0) * 60 * 60 * 1000\n return nowMs <= reservation.checkInDayMs - windowMs\n}\n"],"names":["DAY_MS","toDayMs","atMs","Math","floor","monthDay","dayMs","date","Date","month","String","getUTCMonth","padStart","day","getUTCDate","inSeason","dayKey","season","from","to","nightlyRateCents","resource","rate","nightlyRateUsd","weekday","getUTCDay","weekendMultiplier","seasons","multiplier","round","computeReservationQuote","checkInDayMs","checkOutDayMs","empty","nights","subtotalCents","depositCents","totalCents","nightlyCents","problem","minNights","push","reduce","sum","cents","depositPct","min","max","PENDING_RESERVATION_HOLD_MS","reservationHoldsDates","reservation","nowMs","now","status","createdAtMs","Number","isRangeAvailable","reservations","block","blocks","fromDayMs","canCancelReservation","includes","windowMs","cancellationHours"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC;AAID,OAAO,MAAMA,SAAS,KAAK,KAAK,KAAK,KAAI;AAoGzC,iCAAiC,GACjC,OAAO,SAASC,QAAQC,IAAY;IAClC,OAAOC,KAAKC,KAAK,CAACF,OAAOF,UAAUA;AACrC;AAEA,SAASK,SAASC,KAAa;IAC7B,MAAMC,OAAO,IAAIC,KAAKF;IACtB,MAAMG,QAAQC,OAAOH,KAAKI,WAAW,KAAK,GAAGC,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