@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/components/gated-video.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 { mdiPlayCircleOutline } from '@aglyn/shared-data-mdi'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Typography from '@mui/material/Typography'\nimport { forwardRef, useCallback, useEffect, useRef, useState } 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 = 'gated-video'\n\n/**\n * How many fresh links the player asks for in a row, with no playback in\n * between, before it stops and asks the viewer to reload (AGL-2814).\n *\n * Two covers the two links that can expire under a playing video: the stream\n * link itself, for a browser that re-requests the element's own `src`, and the\n * signed media session behind it. A third failure with nothing played means\n * the problem is not an expiry, and asking again would only loop.\n */\nconst MAX_SILENT_RECOVERIES = 2\n\n/**\n * Seconds of playback on a fresh link that prove it works. Past this the\n * budget above resets, so an expiry hours later recovers as quietly as the\n * first one did.\n */\nconst RECOVERED_AFTER_SECONDS = 5\n\n/**\n * The `MediaError` codes a fresh link can cure: `MEDIA_ERR_NETWORK` (2), which\n * a refused byte-range request raises mid-play, and\n * `MEDIA_ERR_SRC_NOT_SUPPORTED` (4), which a refused first request raises.\n * An abort (1) is the page or the viewer stopping the load, and a decode error (3) is\n * a broken file that no new link can fix.\n */\nconst RECOVERABLE_MEDIA_ERRORS = new Set([2, 4])\n\nexport interface GatedVideoProps {\n /** Product whose gatedVideos list this plays from. */\n productId?: string\n /** Index into the product's gatedVideos (default 0). */\n videoIndex?: number\n lockedText?: string\n}\n\n/**\n * Gated video block (AGL-315): entitled members get a short-TTL signed\n * stream URL from the server (the gate is the mint step); playback\n * resumes from the last position. SiteC's training-program player.\n *\n * Every link behind the player expires (AGL-2814), so a long sitting outlives\n * the one it started with. When a request under an expired link fails, the\n * player asks the stream endpoint for a new one, which re-checks the member's\n * entitlement, and resumes at the second it stopped. A member who has lost\n * the entitlement gets the locked state instead.\n */\nconst GatedVideo = forwardRef<HTMLDivElement, GatedVideoProps>(\n (props, ref) => {\n const { productId, videoIndex, lockedText, ...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 siteFetch = Aglyn.useSiteFetch()\n const [src, setSrc] = useState<string | null>(null)\n const [state, setState] = useState<\n 'loading' | 'locked' | 'ready' | 'stalled'\n >('loading')\n const videoRef = useRef<HTMLVideoElement | null>(null)\n /**\n * Where a recovery stands. A ref, not state: the media events that read\n * and write it fire many times a second, and none of it is rendered.\n */\n const recovery = useRef({\n attempts: 0,\n resumeAt: 0,\n resume: false,\n playing: false,\n playedFrom: 0,\n })\n const resumeKey = `aglyn_video_${hostId}_${productId}_${videoIndex ?? 0}`\n\n /** One POST to the stream endpoint: a link, or why there is none. */\n const requestLink = useCallback(async (): Promise<string | 'locked' | 'failed'> => {\n try {\n const response = await siteFetch('/api/commerce/stream', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n hostId,\n productId,\n video: videoIndex ?? 0,\n }),\n })\n if (response.status === 401 || response.status === 403) return 'locked'\n if (!response.ok) return 'failed'\n const payload = await response.json()\n return typeof payload?.url === 'string' && payload.url\n ? payload.url\n : 'failed'\n } catch {\n return 'failed'\n }\n }, [hostId, productId, videoIndex, siteFetch])\n\n useEffect(() => {\n if (!hostId || !productId) return\n let active = true\n recovery.current = {\n attempts: 0,\n resumeAt: 0,\n resume: false,\n playing: false,\n playedFrom: 0,\n }\n void requestLink().then((link) => {\n if (!active) return\n // Before anything has played, every refusal reads as the lock: the\n // viewer's next step is to sign in or to buy.\n if (link === 'locked' || link === 'failed') return setState('locked')\n setSrc(link)\n setState('ready')\n })\n return () => {\n active = false\n }\n }, [hostId, productId, requestLink])\n\n const handleError = () => {\n const element = videoRef.current\n if (!element || !RECOVERABLE_MEDIA_ERRORS.has(Number(element.error?.code))) {\n return\n }\n const progress = recovery.current\n if (progress.attempts >= MAX_SILENT_RECOVERIES) {\n setState('stalled')\n return\n }\n progress.attempts += 1\n progress.resumeAt = element.currentTime || progress.resumeAt\n progress.resume = progress.playing || !element.paused\n void requestLink().then((link) => {\n if (link === 'locked') return setState('locked')\n if (link === 'failed') return setState('stalled')\n setSrc(link)\n })\n }\n\n const handleLoadedMetadata = () => {\n const element = videoRef.current\n if (!element) return\n const progress = recovery.current\n const saved = Number(window.localStorage.getItem(resumeKey) ?? 0)\n const target =\n progress.resumeAt > 0 ? progress.resumeAt : saved > 5 ? saved : 0\n if (target > 0) element.currentTime = target\n progress.playedFrom = target\n if (progress.resume) {\n progress.resume = false\n try {\n void Promise.resolve(element.play()).catch(() => undefined)\n } catch {\n // A refused autoplay leaves the video paused at the right second,\n // which is the useful half of a resume.\n }\n }\n }\n\n const handleTimeUpdate = () => {\n const element = videoRef.current\n if (!element) return\n window.localStorage.setItem(\n resumeKey,\n String(Math.floor(element.currentTime)),\n )\n const progress = recovery.current\n if (\n progress.attempts &&\n element.currentTime - progress.playedFrom >= RECOVERED_AFTER_SECONDS\n ) {\n progress.attempts = 0\n progress.resumeAt = 0\n }\n }\n\n if (!hostId) {\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n aspectRatio: '16 / 9',\n bgcolor: 'action.hover',\n borderRadius: 1,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n color: 'text.secondary',\n fontSize: 13,\n fontFamily: 'system-ui, sans-serif',\n },\n ...nodeSx,\n ]}\n >\n {'▶ Members-only video'}\n </Box>\n )\n }\n if (state === 'loading') return <Box ref={ref} {...rest} />\n if (state === 'stalled') {\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n aspectRatio: '16 / 9',\n bgcolor: 'action.hover',\n borderRadius: 1,\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n alignItems: 'center',\n justifyContent: 'center',\n px: 2,\n textAlign: 'center',\n },\n ...nodeSx,\n ]}\n >\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Playback stopped. Reload the page to keep watching.'}\n </Typography>\n <Button\n size=\"small\"\n variant=\"contained\"\n onClick={() => window.location.reload()}\n >\n {'Reload'}\n </Button>\n </Box>\n )\n }\n if (state === 'locked' || !src) {\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n aspectRatio: '16 / 9',\n bgcolor: 'action.hover',\n borderRadius: 1,\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n ...nodeSx,\n ]}\n >\n <Typography variant=\"body2\" color=\"text.secondary\">\n {lockedText || '🔒 Sign in with an active subscription to watch'}\n </Typography>\n <Button size=\"small\" variant=\"contained\" href=\"/account\">\n {'Sign in'}\n </Button>\n </Box>\n )\n }\n return (\n <Box ref={ref} {...rest}>\n <video\n ref={videoRef}\n src={src}\n controls\n controlsList=\"nodownload\"\n style={{ width: '100%', borderRadius: 8 }}\n onLoadedMetadata={handleLoadedMetadata}\n onTimeUpdate={handleTimeUpdate}\n onPlay={() => {\n recovery.current.playing = true\n }}\n onPause={() => {\n recovery.current.playing = false\n }}\n onError={handleError}\n />\n </Box>\n )\n },\n)\nGatedVideo.displayName = 'AglynGatedVideo'\n\nexport const schema: Aglyn.ComponentSchema<GatedVideoProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Members video',\n description:\n 'A video only entitled members can play, resuming where they left off.',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiPlayCircleOutline.path, sx: { color: '#2e7d32' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'productId',\n label: 'Product id',\n description:\n 'Members entitled to this product can watch its gated videos.',\n component: Aglyn.FieldComponentType.PRODUCT_SELECT,\n },\n {\n name: 'videoIndex',\n label: 'Video number',\n description: 'Which of the product’s videos to play (1st = 0).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'lockedText',\n label: 'Locked text',\n description:\n 'The message over the poster frame when the viewer cannot play ' +\n 'this video. The poster image still shows, so this only has to ' +\n 'explain the lock.',\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: 'Members video',\n pluginId: BUNDLE_ID,\n description: 'Subscription-gated video with resume',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiPlayCircleOutline.path, sx: { color: '#2e7d32' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: {},\n },\n },\n]\n\nexport default GatedVideo\n"],"names":["Aglyn","mdiPlayCircleOutline","Box","Button","Typography","forwardRef","useCallback","useEffect","useRef","useState","BUNDLE_ID","generatePresetId","ID","MAX_SILENT_RECOVERIES","RECOVERED_AFTER_SECONDS","RECOVERABLE_MEDIA_ERRORS","Set","GatedVideo","props","ref","productId","videoIndex","lockedText","rest","nodeSx","Array","isArray","hostId","useSite","siteFetch","useSiteFetch","src","setSrc","state","setState","videoRef","recovery","attempts","resumeAt","resume","playing","playedFrom","resumeKey","requestLink","response","method","headers","body","JSON","stringify","video","status","ok","payload","json","url","active","current","then","link","handleError","element","has","Number","error","code","progress","currentTime","paused","handleLoadedMetadata","window","saved","localStorage","getItem","target","Promise","resolve","play","catch","undefined","handleTimeUpdate","setItem","String","Math","floor","sx","aspectRatio","bgcolor","borderRadius","display","alignItems","justifyContent","color","fontSize","fontFamily","flexDirection","gap","px","textAlign","variant","size","onClick","location","reload","href","controls","controlsList","style","width","onLoadedMetadata","onTimeUpdate","onPlay","onPause","onError","displayName","schema","$id","pluginId","description","category","ComponentCategory","COMMERCE","icon","path","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","label","component","FieldComponentType","PRODUCT_SELECT","TEXT_FIELD","type","presets","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC5E,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,cAAa;AAElD;;;;;;;;CAQC,GACD,MAAMC,wBAA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H,MAAMwH,iBAAiB,CAACC,QAAQ;IAC1CC,MAAM;QAAEC,MAAM1H,qBAAqB0H,IAAI;QAAEtC,IAAI;YAAEO,OAAO;QAAU;IAAE;IAClEgC,OAAO;QAAEC,aAAa7H,MAAM8H,YAAY,CAACC,OAAO;IAAC;IACjDC,YAAY;QACV;YACEC,MAAM;YACNC,OAAO;YACPZ,aACE;YACFa,WAAWnI,MAAMoI,kBAAkB,CAACC,cAAc;QACpD;QACA;YACEJ,MAAM;YACNC,OAAO;YACPZ,aAAa;YACba,WAAWnI,MAAMoI,kBAAkB,CAACE,UAAU;YAC9CC,MAAM;QACR;QACA;YACEN,MAAM;YACNC,OAAO;YACPZ,aACE,mEACA,mEACA;YACFa,WAAWnI,MAAMoI,kBAAkB,CAACE,UAAU;QAChD;KACD;AACH,EAAC;AAED,OAAO,MAAME,UAAgC;IAC3C;QACEpB,KAAKzG,iBAAiBC;QACtB2H,MAAMvI,MAAMyI,QAAQ,CAACC,MAAM;QAC3BxB,aAAa;QACbG,UAAU3G;QACV4G,aAAa;QACbC,UAAUvH,MAAMwH,iBAAiB,CAACC,QAAQ;QAC1CC,MAAM;YAAEC,MAAM1H,qBAAqB0H,IAAI;YAAEtC,IAAI;gBAAEO,OAAO;YAAU;QAAE;QAClE+C,MAAM;YACJvB,KAAK;YACLwB,aAAahI;YACbyG,UAAU3G;YACVQ,OAAO,CAAC;QACV;IACF;CACD,CAAA;AAED,eAAeD,WAAU"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import * as Aglyn from '@aglyn/aglyn';
18
+ export declare const ID: Aglyn.ComponentId;
19
+ export interface MemberFeedProps {
20
+ heading?: string;
21
+ emptyText?: string;
22
+ maxItems?: number;
23
+ }
24
+ /**
25
+ * Member updates feed (AGL-316): entitlement-filtered posts from the
26
+ * server-enforced feed API. Non-members get the sign-in nudge — the
27
+ * bodies never reach them.
28
+ */
29
+ declare const MemberFeed: import("react").ForwardRefExoticComponent<MemberFeedProps & import("react").RefAttributes<HTMLDivElement>>;
30
+ export declare const schema: Aglyn.ComponentSchema<MemberFeedProps>;
31
+ export declare const presets: Aglyn.PresetSchema[];
32
+ export default MemberFeed;
@@ -0,0 +1,198 @@
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 } 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 { mdiBellRingOutline } from "@aglyn/shared-data-mdi";
21
+ import Box from "@mui/material/Box";
22
+ import Divider from "@mui/material/Divider";
23
+ import Typography from "@mui/material/Typography";
24
+ import { forwardRef, useEffect, useState } from "react";
25
+ import { BUNDLE_ID } from "../constants/bundle-common.js";
26
+ import { generatePresetId } from "../utils/generate-preset-id.js";
27
+ // Component ids are persisted in screen documents; never rename.
28
+ export const ID = 'member-feed';
29
+ /**
30
+ * Member updates feed (AGL-316): entitlement-filtered posts from the
31
+ * server-enforced feed API. Non-members get the sign-in nudge — the
32
+ * bodies never reach them.
33
+ */ const MemberFeed = /*#__PURE__*/ forwardRef((props, ref)=>{
34
+ const { heading, emptyText, maxItems } = props, rest = _object_without_properties_loose(props, [
35
+ "heading",
36
+ "emptyText",
37
+ "maxItems"
38
+ ]);
39
+ // Node styles ride the renderer-merged sx; recompose (stack.ts pattern).
40
+ const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [
41
+ props['sx']
42
+ ];
43
+ const { hostId } = Aglyn.useSite();
44
+ const [posts, setPosts] = useState(null);
45
+ useEffect(()=>{
46
+ if (!hostId) return;
47
+ let active = true;
48
+ void fetch(`/api/commerce/member-feed?hostId=${encodeURIComponent(hostId)}`).then(async (response)=>{
49
+ var _ref;
50
+ if (!active) return;
51
+ if (response.status === 401) return setPosts('anonymous');
52
+ const payload = await response.json();
53
+ setPosts((_ref = payload == null ? void 0 : payload.posts) != null ? _ref : []);
54
+ }).catch(()=>{
55
+ if (active) setPosts([]);
56
+ });
57
+ return ()=>{
58
+ active = false;
59
+ };
60
+ }, [
61
+ hostId
62
+ ]);
63
+ if (!hostId) {
64
+ return /*#__PURE__*/ _jsx(Box, _extends({
65
+ ref: ref
66
+ }, rest, {
67
+ sx: [
68
+ {
69
+ p: 3,
70
+ border: '1px dashed',
71
+ borderColor: 'divider',
72
+ borderRadius: 1,
73
+ color: 'text.secondary',
74
+ fontSize: 13,
75
+ fontFamily: 'system-ui, sans-serif'
76
+ },
77
+ ...nodeSx
78
+ ],
79
+ children: 'Member feed — updates for subscribers render here'
80
+ }));
81
+ }
82
+ if (posts === null) return /*#__PURE__*/ _jsx(Box, _extends({
83
+ ref: ref
84
+ }, rest));
85
+ return /*#__PURE__*/ _jsxs(Box, _extends({
86
+ ref: ref
87
+ }, rest, {
88
+ children: [
89
+ heading ? /*#__PURE__*/ _jsx(Typography, {
90
+ variant: "h5",
91
+ gutterBottom: true,
92
+ children: heading
93
+ }) : null,
94
+ posts === 'anonymous' ? /*#__PURE__*/ _jsx(Typography, {
95
+ variant: "body2",
96
+ color: "text.secondary",
97
+ children: 'Sign in with your membership to see updates.'
98
+ }) : posts.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
99
+ variant: "body2",
100
+ color: "text.secondary",
101
+ children: emptyText || 'No updates yet — check back soon.'
102
+ }) : posts.slice(0, maxItems && maxItems > 0 ? maxItems : 20).map((post, index)=>/*#__PURE__*/ _jsxs(Box, {
103
+ sx: {
104
+ py: 1.5
105
+ },
106
+ children: [
107
+ index > 0 ? /*#__PURE__*/ _jsx(Divider, {
108
+ sx: {
109
+ mb: 1.5
110
+ }
111
+ }) : null,
112
+ /*#__PURE__*/ _jsx(Typography, {
113
+ variant: "subtitle1",
114
+ children: post.title
115
+ }),
116
+ /*#__PURE__*/ _jsx(Typography, {
117
+ variant: "caption",
118
+ color: "text.secondary",
119
+ children: new Date(post.createdAtMs).toLocaleDateString()
120
+ }),
121
+ post.body ? /*#__PURE__*/ _jsx(Typography, {
122
+ variant: "body2",
123
+ sx: {
124
+ mt: 0.5,
125
+ whiteSpace: 'pre-wrap'
126
+ },
127
+ children: post.body
128
+ }) : null
129
+ ]
130
+ }, post.id))
131
+ ]
132
+ }));
133
+ });
134
+ MemberFeed.displayName = 'AglynMemberFeed';
135
+ export const schema = {
136
+ $id: ID,
137
+ pluginId: BUNDLE_ID,
138
+ displayName: 'Member feed',
139
+ description: 'Updates only entitled members can see. Non-members never receive them.',
140
+ category: Aglyn.ComponentCategory.COMMERCE,
141
+ icon: {
142
+ path: mdiBellRingOutline.path,
143
+ sx: {
144
+ color: '#2e7d32'
145
+ }
146
+ },
147
+ flags: {
148
+ selfClosing: Aglyn.FEATURE_FLAG.ENABLED
149
+ },
150
+ attributes: [
151
+ {
152
+ name: 'heading',
153
+ label: 'Heading',
154
+ description: 'Shown above the feed.',
155
+ component: Aglyn.FieldComponentType.TEXT_FIELD
156
+ },
157
+ {
158
+ name: 'emptyText',
159
+ label: 'Empty text',
160
+ description: 'Copy when there are no posts.',
161
+ component: Aglyn.FieldComponentType.TEXT_FIELD
162
+ },
163
+ {
164
+ name: 'maxItems',
165
+ label: 'Max posts',
166
+ description: 'Cap the number shown (default 20).',
167
+ component: Aglyn.FieldComponentType.TEXT_FIELD,
168
+ type: 'number'
169
+ }
170
+ ]
171
+ };
172
+ export const presets = [
173
+ {
174
+ $id: generatePresetId(ID),
175
+ type: Aglyn.NodeType.PRESET,
176
+ displayName: 'Member feed',
177
+ pluginId: BUNDLE_ID,
178
+ description: 'Updates visible only to entitled members',
179
+ category: Aglyn.ComponentCategory.COMMERCE,
180
+ icon: {
181
+ path: mdiBellRingOutline.path,
182
+ sx: {
183
+ color: '#2e7d32'
184
+ }
185
+ },
186
+ data: {
187
+ $id: null,
188
+ componentId: ID,
189
+ pluginId: BUNDLE_ID,
190
+ props: {
191
+ heading: 'Member updates'
192
+ }
193
+ }
194
+ }
195
+ ];
196
+ export default MemberFeed;
197
+
198
+ //# sourceMappingURL=member-feed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/member-feed.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 { mdiBellRingOutline } from '@aglyn/shared-data-mdi'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Typography from '@mui/material/Typography'\nimport { forwardRef, useEffect, useState } 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 = 'member-feed'\n\nexport interface MemberFeedProps {\n heading?: string\n emptyText?: string\n maxItems?: number\n}\n\ninterface FeedPost {\n id: string\n title: string\n body: string\n createdAtMs: number\n}\n\n/**\n * Member updates feed (AGL-316): entitlement-filtered posts from the\n * server-enforced feed API. Non-members get the sign-in nudge — the\n * bodies never reach them.\n */\nconst MemberFeed = forwardRef<HTMLDivElement, MemberFeedProps>(\n (props, ref) => {\n const { heading, emptyText, maxItems, ...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 [posts, setPosts] = useState<FeedPost[] | null | 'anonymous'>(null)\n\n useEffect(() => {\n if (!hostId) return\n let active = true\n void fetch(\n `/api/commerce/member-feed?hostId=${encodeURIComponent(hostId)}`,\n )\n .then(async (response) => {\n if (!active) return\n if (response.status === 401) return setPosts('anonymous')\n const payload = await response.json()\n setPosts(payload?.posts ?? [])\n })\n .catch(() => {\n if (active) setPosts([])\n })\n return () => {\n active = false\n }\n }, [hostId])\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 {'Member feed — updates for subscribers render here'}\n </Box>\n )\n }\n if (posts === null) return <Box ref={ref} {...rest} />\n\n return (\n <Box ref={ref} {...rest}>\n {heading ? (\n <Typography variant=\"h5\" gutterBottom>\n {heading}\n </Typography>\n ) : null}\n {posts === 'anonymous' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Sign in with your membership to see updates.'}\n </Typography>\n ) : posts.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {emptyText || 'No updates yet — check back soon.'}\n </Typography>\n ) : (\n posts\n .slice(0, maxItems && maxItems > 0 ? maxItems : 20)\n .map((post, index) => (\n <Box key={post.id} sx={{ py: 1.5 }}>\n {index > 0 ? <Divider sx={{ mb: 1.5 }} /> : null}\n <Typography variant=\"subtitle1\">{post.title}</Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {new Date(post.createdAtMs).toLocaleDateString()}\n </Typography>\n {post.body ? (\n <Typography\n variant=\"body2\"\n sx={{ mt: 0.5, whiteSpace: 'pre-wrap' }}\n >\n {post.body}\n </Typography>\n ) : null}\n </Box>\n ))\n )}\n </Box>\n )\n },\n)\nMemberFeed.displayName = 'AglynMemberFeed'\n\nexport const schema: Aglyn.ComponentSchema<MemberFeedProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Member feed',\n description:\n 'Updates only entitled members can see. Non-members never receive them.',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiBellRingOutline.path, sx: { color: '#2e7d32' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'heading',\n label: 'Heading',\n description: 'Shown above the feed.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'emptyText',\n label: 'Empty text',\n description: 'Copy when there are no posts.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'maxItems',\n label: 'Max posts',\n description: 'Cap the number shown (default 20).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Member feed',\n pluginId: BUNDLE_ID,\n description: 'Updates visible only to entitled members',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiBellRingOutline.path, sx: { color: '#2e7d32' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { heading: 'Member updates' },\n },\n },\n]\n\nexport default MemberFeed\n"],"names":["Aglyn","mdiBellRingOutline","Box","Divider","Typography","forwardRef","useEffect","useState","BUNDLE_ID","generatePresetId","ID","MemberFeed","props","ref","heading","emptyText","maxItems","rest","nodeSx","Array","isArray","hostId","useSite","posts","setPosts","active","fetch","encodeURIComponent","then","response","status","payload","json","catch","sx","p","border","borderColor","borderRadius","color","fontSize","fontFamily","variant","gutterBottom","length","slice","map","post","index","py","mb","title","Date","createdAtMs","toLocaleDateString","body","mt","whiteSpace","id","displayName","schema","$id","pluginId","description","category","ComponentCategory","COMMERCE","icon","path","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","label","component","FieldComponentType","TEXT_FIELD","type","presets","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,kBAAkB,QAAQ,yBAAwB;AAC3D,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,aAAa,wBAAuB;AAC3C,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AACvD,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,cAAa;AAelD;;;;CAIC,GACD,MAAMC,2BAAaN,WACjB,CAACO,OAAOC;IACN,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAW,GAAGJ,OAATK,wCAASL;;;;;IAClD,yEAAyE;IACzE,MAAMM,SAASC,MAAMC,OAAO,CAACR,KAAK,CAAC,KAAK,IAAIA,KAAK,CAAC,KAAK,GAAG;QAACA,KAAK,CAAC,KAAK;KAAC;IACvE,MAAM,EAAES,MAAM,EAAE,GAAGrB,MAAMsB,OAAO;IAChC,MAAM,CAACC,OAAOC,SAAS,GAAGjB,SAA0C;IAEpED,UAAU;QACR,IAAI,C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B;QACrC;IACF;CACD,CAAA;AAED,eAAeH,WAAU"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import * as Aglyn from '@aglyn/aglyn';
18
+ export declare const ID: Aglyn.ComponentId;
19
+ export interface MemberRecoveryProps {
20
+ heading?: string;
21
+ signinPath?: string;
22
+ }
23
+ /**
24
+ * Password recovery block (AGL-552), styled to match the customer-account
25
+ * forms. Two modes on one block: without a `token` query param it shows
26
+ * the request-email form (/api/membership/recover — always "sent", no
27
+ * account-existence leak); with one it shows the new-password form
28
+ * (/api/membership/reset) and links to sign-in on success. Drop it on the
29
+ * screen designated as the site's recovery page (AGL-553) — the built-in
30
+ * /recover route renders the same flows when no screen is designated.
31
+ */
32
+ declare const MemberRecovery: import("react").ForwardRefExoticComponent<MemberRecoveryProps & import("react").RefAttributes<HTMLDivElement>>;
33
+ export declare const schema: Aglyn.ComponentSchema<MemberRecoveryProps>;
34
+ export declare const presets: Aglyn.PresetSchema[];
35
+ export default MemberRecovery;
@@ -0,0 +1,313 @@
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 } 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 { mdiLockReset } from "@aglyn/shared-data-mdi";
21
+ import Alert from "@mui/material/Alert";
22
+ import Box from "@mui/material/Box";
23
+ import Button from "@mui/material/Button";
24
+ import Link from "@mui/material/Link";
25
+ import TextField from "@mui/material/TextField";
26
+ import Typography from "@mui/material/Typography";
27
+ import { forwardRef, useCallback, useEffect, useState } from "react";
28
+ import { BUNDLE_ID } from "../constants/bundle-common.js";
29
+ import { generatePresetId } from "../utils/generate-preset-id.js";
30
+ // Component ids are persisted in screen documents; never rename.
31
+ export const ID = 'member-recovery';
32
+ /**
33
+ * Password recovery block (AGL-552), styled to match the customer-account
34
+ * forms. Two modes on one block: without a `token` query param it shows
35
+ * the request-email form (/api/membership/recover — always "sent", no
36
+ * account-existence leak); with one it shows the new-password form
37
+ * (/api/membership/reset) and links to sign-in on success. Drop it on the
38
+ * screen designated as the site's recovery page (AGL-553) — the built-in
39
+ * /recover route renders the same flows when no screen is designated.
40
+ */ const MemberRecovery = /*#__PURE__*/ forwardRef((props, ref)=>{
41
+ const { heading, signinPath } = props, rest = _object_without_properties_loose(props, [
42
+ "heading",
43
+ "signinPath"
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 siteFetch = Aglyn.useSiteFetch();
51
+ // Read post-hydration only: the block server-renders inside published
52
+ // screens, where the query string is unavailable.
53
+ const [token, setToken] = useState('');
54
+ const [email, setEmail] = useState('');
55
+ const [password, setPassword] = useState('');
56
+ const [busy, setBusy] = useState(false);
57
+ const [error, setError] = useState('');
58
+ const [done, setDone] = useState(null);
59
+ useEffect(()=>{
60
+ var _get;
61
+ setToken((_get = new URLSearchParams(window.location.search).get('token')) != null ? _get : '');
62
+ }, []);
63
+ const signinHref = signinPath || '/signin';
64
+ const handleRequest = useCallback(async ()=>{
65
+ if (!hostId || busy) return;
66
+ setBusy(true);
67
+ setError('');
68
+ try {
69
+ const response = await siteFetch('/api/membership/recover', {
70
+ method: 'POST',
71
+ headers: {
72
+ 'Content-Type': 'application/json'
73
+ },
74
+ body: JSON.stringify({
75
+ hostId,
76
+ email
77
+ })
78
+ });
79
+ if (!response.ok) {
80
+ var _ref;
81
+ const payload = await response.json().catch(()=>({}));
82
+ setError(String((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Something went wrong'));
83
+ return;
84
+ }
85
+ setDone('requested');
86
+ } finally{
87
+ setBusy(false);
88
+ }
89
+ }, [
90
+ hostId,
91
+ busy,
92
+ email,
93
+ siteFetch
94
+ ]);
95
+ const handleReset = useCallback(async ()=>{
96
+ if (!hostId || busy) return;
97
+ setBusy(true);
98
+ setError('');
99
+ try {
100
+ const response = await siteFetch('/api/membership/reset', {
101
+ method: 'POST',
102
+ headers: {
103
+ 'Content-Type': 'application/json'
104
+ },
105
+ body: JSON.stringify({
106
+ hostId,
107
+ token,
108
+ password
109
+ })
110
+ });
111
+ if (!response.ok) {
112
+ var _ref;
113
+ const payload = await response.json().catch(()=>({}));
114
+ setError(String((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Something went wrong'));
115
+ return;
116
+ }
117
+ setDone('reset');
118
+ } finally{
119
+ setBusy(false);
120
+ }
121
+ }, [
122
+ hostId,
123
+ busy,
124
+ token,
125
+ password,
126
+ siteFetch
127
+ ]);
128
+ if (!hostId) {
129
+ return /*#__PURE__*/ _jsx(Box, _extends({
130
+ ref: ref
131
+ }, rest, {
132
+ sx: [
133
+ {
134
+ p: 3,
135
+ border: '1px dashed',
136
+ borderColor: 'divider',
137
+ borderRadius: 1,
138
+ color: 'text.secondary',
139
+ fontSize: 13,
140
+ fontFamily: 'system-ui, sans-serif'
141
+ },
142
+ ...nodeSx
143
+ ],
144
+ children: 'Password recovery — request and reset forms render here'
145
+ }));
146
+ }
147
+ return /*#__PURE__*/ _jsxs(Box, _extends({
148
+ ref: ref
149
+ }, rest, {
150
+ sx: [
151
+ {
152
+ maxWidth: 420
153
+ },
154
+ ...nodeSx
155
+ ],
156
+ children: [
157
+ /*#__PURE__*/ _jsx(Typography, {
158
+ variant: "h5",
159
+ gutterBottom: true,
160
+ children: heading || 'Reset your password'
161
+ }),
162
+ done === 'reset' ? /*#__PURE__*/ _jsxs(Box, {
163
+ sx: {
164
+ display: 'flex',
165
+ flexDirection: 'column',
166
+ gap: 1.5
167
+ },
168
+ children: [
169
+ /*#__PURE__*/ _jsx(Alert, {
170
+ severity: "success",
171
+ children: 'Your password has been updated.'
172
+ }),
173
+ /*#__PURE__*/ _jsx(Button, {
174
+ variant: "contained",
175
+ color: "primary",
176
+ href: signinHref,
177
+ sx: {
178
+ alignSelf: 'flex-start'
179
+ },
180
+ children: 'Sign in'
181
+ })
182
+ ]
183
+ }) : done === 'requested' ? /*#__PURE__*/ _jsx(Alert, {
184
+ severity: "success",
185
+ children: 'If that email belongs to an account here, a reset link is on ' + 'its way. The link works once and expires in an hour.'
186
+ }) : token ? /*#__PURE__*/ _jsxs(Box, {
187
+ sx: {
188
+ display: 'flex',
189
+ flexDirection: 'column',
190
+ gap: 1.5,
191
+ mt: 1
192
+ },
193
+ children: [
194
+ /*#__PURE__*/ _jsx(TextField, {
195
+ label: "New password",
196
+ type: "password",
197
+ value: password,
198
+ onChange: (event)=>setPassword(event.target.value),
199
+ size: "small",
200
+ helperText: "At least 8 characters"
201
+ }),
202
+ error ? /*#__PURE__*/ _jsx(Alert, {
203
+ severity: "error",
204
+ children: error
205
+ }) : null,
206
+ /*#__PURE__*/ _jsx(Button, {
207
+ variant: "contained",
208
+ color: "primary",
209
+ disabled: busy || password.length < 8,
210
+ onClick: handleReset,
211
+ children: busy ? 'Working…' : 'Set new password'
212
+ })
213
+ ]
214
+ }) : /*#__PURE__*/ _jsxs(Box, {
215
+ sx: {
216
+ display: 'flex',
217
+ flexDirection: 'column',
218
+ gap: 1.5,
219
+ mt: 1
220
+ },
221
+ children: [
222
+ /*#__PURE__*/ _jsx(Typography, {
223
+ variant: "body2",
224
+ color: "text.secondary",
225
+ children: 'Enter your account email and we will send you a reset link.'
226
+ }),
227
+ /*#__PURE__*/ _jsx(TextField, {
228
+ label: "Email",
229
+ type: "email",
230
+ value: email,
231
+ onChange: (event)=>setEmail(event.target.value),
232
+ size: "small"
233
+ }),
234
+ error ? /*#__PURE__*/ _jsx(Alert, {
235
+ severity: "error",
236
+ children: error
237
+ }) : null,
238
+ /*#__PURE__*/ _jsx(Button, {
239
+ variant: "contained",
240
+ color: "primary",
241
+ disabled: busy || !email,
242
+ onClick: handleRequest,
243
+ children: busy ? 'Working…' : 'Email me a reset link'
244
+ }),
245
+ /*#__PURE__*/ _jsx(Typography, {
246
+ variant: "body2",
247
+ children: /*#__PURE__*/ _jsx(Link, {
248
+ href: signinHref,
249
+ underline: "hover",
250
+ children: 'Back to sign in'
251
+ })
252
+ })
253
+ ]
254
+ })
255
+ ]
256
+ }));
257
+ });
258
+ MemberRecovery.displayName = 'AglynMemberRecovery';
259
+ export const schema = {
260
+ $id: ID,
261
+ pluginId: BUNDLE_ID,
262
+ displayName: 'Password recovery',
263
+ description: 'Forgot-password request, and the reset form the emailed link opens.',
264
+ category: Aglyn.ComponentCategory.MEMBERS,
265
+ icon: {
266
+ path: mdiLockReset.path,
267
+ sx: {
268
+ color: '#2e7d32'
269
+ }
270
+ },
271
+ flags: {
272
+ selfClosing: Aglyn.FEATURE_FLAG.ENABLED
273
+ },
274
+ attributes: [
275
+ {
276
+ name: 'heading',
277
+ label: 'Heading',
278
+ description: 'Shown above the recovery forms.',
279
+ component: Aglyn.FieldComponentType.TEXT_FIELD
280
+ },
281
+ {
282
+ name: 'signinPath',
283
+ label: 'Sign-in path',
284
+ description: 'Where "Back to sign in" points (default /signin).',
285
+ component: Aglyn.FieldComponentType.TEXT_FIELD
286
+ }
287
+ ]
288
+ };
289
+ export const presets = [
290
+ {
291
+ $id: generatePresetId(ID),
292
+ type: Aglyn.NodeType.PRESET,
293
+ displayName: 'Password recovery',
294
+ pluginId: BUNDLE_ID,
295
+ description: 'Forgot-password request and reset forms',
296
+ category: Aglyn.ComponentCategory.MEMBERS,
297
+ icon: {
298
+ path: mdiLockReset.path,
299
+ sx: {
300
+ color: '#2e7d32'
301
+ }
302
+ },
303
+ data: {
304
+ $id: null,
305
+ componentId: ID,
306
+ pluginId: BUNDLE_ID,
307
+ props: {}
308
+ }
309
+ }
310
+ ];
311
+ export default MemberRecovery;
312
+
313
+ //# sourceMappingURL=member-recovery.js.map