@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.
- package/LICENSE +201 -0
- package/README.md +10 -0
- package/package.json +57 -0
- package/src/index.d.ts +38 -0
- package/src/index.js +38 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/account.d.ts +31 -0
- package/src/lib/components/account.js +645 -0
- package/src/lib/components/account.js.map +1 -0
- package/src/lib/components/cart.d.ts +38 -0
- package/src/lib/components/cart.js +851 -0
- package/src/lib/components/cart.js.map +1 -0
- package/src/lib/components/commerce-console-page.d.ts +32 -0
- package/src/lib/components/commerce-console-page.js +296 -0
- package/src/lib/components/commerce-console-page.js.map +1 -0
- package/src/lib/components/commerce-console-sections.d.ts +34 -0
- package/src/lib/components/commerce-console-sections.js +62 -0
- package/src/lib/components/commerce-console-sections.js.map +1 -0
- package/src/lib/components/console/catalog-organization-card.component.d.ts +14 -0
- package/src/lib/components/console/catalog-organization-card.component.js +1087 -0
- package/src/lib/components/console/catalog-organization-card.component.js.map +1 -0
- package/src/lib/components/console/commerce-analytics-card.component.d.ts +27 -0
- package/src/lib/components/console/commerce-analytics-card.component.js +310 -0
- package/src/lib/components/console/commerce-analytics-card.component.js.map +1 -0
- package/src/lib/components/console/commerce-glance-card.component.d.ts +20 -0
- package/src/lib/components/console/commerce-glance-card.component.js +340 -0
- package/src/lib/components/console/commerce-glance-card.component.js.map +1 -0
- package/src/lib/components/console/commerce-stat-tile.component.d.ts +37 -0
- package/src/lib/components/console/commerce-stat-tile.component.js +72 -0
- package/src/lib/components/console/commerce-stat-tile.component.js.map +1 -0
- package/src/lib/components/console/discounts-card.component.d.ts +14 -0
- package/src/lib/components/console/discounts-card.component.js +443 -0
- package/src/lib/components/console/discounts-card.component.js.map +1 -0
- package/src/lib/components/console/entitlement-gate.component.d.ts +76 -0
- package/src/lib/components/console/entitlement-gate.component.js +115 -0
- package/src/lib/components/console/entitlement-gate.component.js.map +1 -0
- package/src/lib/components/console/gift-cards-card.component.d.ts +29 -0
- package/src/lib/components/console/gift-cards-card.component.js +379 -0
- package/src/lib/components/console/gift-cards-card.component.js.map +1 -0
- package/src/lib/components/console/host-coupons-card.component.d.ts +14 -0
- package/src/lib/components/console/host-coupons-card.component.js +252 -0
- package/src/lib/components/console/host-coupons-card.component.js.map +1 -0
- package/src/lib/components/console/host-orders-card.component.d.ts +13 -0
- package/src/lib/components/console/host-orders-card.component.js +861 -0
- package/src/lib/components/console/host-orders-card.component.js.map +1 -0
- package/src/lib/components/console/locations-card.component.d.ts +14 -0
- package/src/lib/components/console/locations-card.component.js +256 -0
- package/src/lib/components/console/locations-card.component.js.map +1 -0
- package/src/lib/components/console/member-posts-card.component.d.ts +8 -0
- package/src/lib/components/console/member-posts-card.component.js +283 -0
- package/src/lib/components/console/member-posts-card.component.js.map +1 -0
- package/src/lib/components/console/newest-site-users-card.component.d.ts +36 -0
- package/src/lib/components/console/newest-site-users-card.component.js +126 -0
- package/src/lib/components/console/newest-site-users-card.component.js.map +1 -0
- package/src/lib/components/console/order-detail-dialog.component.d.ts +28 -0
- package/src/lib/components/console/order-detail-dialog.component.js +976 -0
- package/src/lib/components/console/order-detail-dialog.component.js.map +1 -0
- package/src/lib/components/console/paid-media.d.ts +127 -0
- package/src/lib/components/console/paid-media.js +397 -0
- package/src/lib/components/console/paid-media.js.map +1 -0
- package/src/lib/components/console/payments-settings-card.component.d.ts +13 -0
- package/src/lib/components/console/payments-settings-card.component.js +295 -0
- package/src/lib/components/console/payments-settings-card.component.js.map +1 -0
- package/src/lib/components/console/pos-page.component.d.ts +13 -0
- package/src/lib/components/console/pos-page.component.js +916 -0
- package/src/lib/components/console/pos-page.component.js.map +1 -0
- package/src/lib/components/console/product-editor-dialog.component.d.ts +32 -0
- package/src/lib/components/console/product-editor-dialog.component.js +1374 -0
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -0
- package/src/lib/components/console/products-hub-card.component.d.ts +16 -0
- package/src/lib/components/console/products-hub-card.component.js +1280 -0
- package/src/lib/components/console/products-hub-card.component.js.map +1 -0
- package/src/lib/components/console/products-hub-zone.component.d.ts +50 -0
- package/src/lib/components/console/products-hub-zone.component.js +200 -0
- package/src/lib/components/console/products-hub-zone.component.js.map +1 -0
- package/src/lib/components/console/recovery-queue-card.component.d.ts +39 -0
- package/src/lib/components/console/recovery-queue-card.component.js +262 -0
- package/src/lib/components/console/recovery-queue-card.component.js.map +1 -0
- package/src/lib/components/console/registers-card.component.d.ts +21 -0
- package/src/lib/components/console/registers-card.component.js +296 -0
- package/src/lib/components/console/registers-card.component.js.map +1 -0
- package/src/lib/components/console/reservations-card.component.d.ts +14 -0
- package/src/lib/components/console/reservations-card.component.js +650 -0
- package/src/lib/components/console/reservations-card.component.js.map +1 -0
- package/src/lib/components/console/reviews-moderation-card.component.d.ts +8 -0
- package/src/lib/components/console/reviews-moderation-card.component.js +235 -0
- package/src/lib/components/console/reviews-moderation-card.component.js.map +1 -0
- package/src/lib/components/console/shipping-settings-card.component.d.ts +38 -0
- package/src/lib/components/console/shipping-settings-card.component.js +560 -0
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -0
- package/src/lib/components/console/stock-movements-card.component.d.ts +31 -0
- package/src/lib/components/console/stock-movements-card.component.js +333 -0
- package/src/lib/components/console/stock-movements-card.component.js.map +1 -0
- package/src/lib/components/console/store-settings-card.component.d.ts +14 -0
- package/src/lib/components/console/store-settings-card.component.js +300 -0
- package/src/lib/components/console/store-settings-card.component.js.map +1 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.d.ts +73 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js +408 -0
- package/src/lib/components/console/storefront-tax-summary-card.component.js.map +1 -0
- package/src/lib/components/console/suppliers-card.component.d.ts +8 -0
- package/src/lib/components/console/suppliers-card.component.js +328 -0
- package/src/lib/components/console/suppliers-card.component.js.map +1 -0
- package/src/lib/components/console/tax-settings-card.component.d.ts +14 -0
- package/src/lib/components/console/tax-settings-card.component.js +473 -0
- package/src/lib/components/console/tax-settings-card.component.js.map +1 -0
- package/src/lib/components/gate.d.ts +39 -0
- package/src/lib/components/gate.js +202 -0
- package/src/lib/components/gate.js.map +1 -0
- package/src/lib/components/gated-video.d.ts +40 -0
- package/src/lib/components/gated-video.js +366 -0
- package/src/lib/components/gated-video.js.map +1 -0
- package/src/lib/components/member-feed.d.ts +32 -0
- package/src/lib/components/member-feed.js +198 -0
- package/src/lib/components/member-feed.js.map +1 -0
- package/src/lib/components/member-recovery.d.ts +35 -0
- package/src/lib/components/member-recovery.js +313 -0
- package/src/lib/components/member-recovery.js.map +1 -0
- package/src/lib/components/member-signin.d.ts +35 -0
- package/src/lib/components/member-signin.js +257 -0
- package/src/lib/components/member-signin.js.map +1 -0
- package/src/lib/components/member-signup.d.ts +34 -0
- package/src/lib/components/member-signup.js +287 -0
- package/src/lib/components/member-signup.js.map +1 -0
- package/src/lib/components/newsletter-signup.d.ts +39 -0
- package/src/lib/components/newsletter-signup.js +229 -0
- package/src/lib/components/newsletter-signup.js.map +1 -0
- package/src/lib/components/product-detail.d.ts +38 -0
- package/src/lib/components/product-detail.js +1022 -0
- package/src/lib/components/product-detail.js.map +1 -0
- package/src/lib/components/product-grid.d.ts +67 -0
- package/src/lib/components/product-grid.js +909 -0
- package/src/lib/components/product-grid.js.map +1 -0
- package/src/lib/components/product-reviews.d.ts +32 -0
- package/src/lib/components/product-reviews.js +349 -0
- package/src/lib/components/product-reviews.js.map +1 -0
- package/src/lib/components/related-products.d.ts +33 -0
- package/src/lib/components/related-products.js +232 -0
- package/src/lib/components/related-products.js.map +1 -0
- package/src/lib/components/reservation-widget.d.ts +33 -0
- package/src/lib/components/reservation-widget.js +418 -0
- package/src/lib/components/reservation-widget.js.map +1 -0
- package/src/lib/components/storefront-payment-element-fallback.d.ts +18 -0
- package/src/lib/components/storefront-payment-element-fallback.js +51 -0
- package/src/lib/components/storefront-payment-element-fallback.js.map +1 -0
- package/src/lib/components/storefront-payment-element.d.ts +78 -0
- package/src/lib/components/storefront-payment-element.js +156 -0
- package/src/lib/components/storefront-payment-element.js.map +1 -0
- package/src/lib/components/wishlist.d.ts +46 -0
- package/src/lib/components/wishlist.js +304 -0
- package/src/lib/components/wishlist.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +18 -0
- package/src/lib/constants/bundle-common.js +18 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/product-filters.d.ts +35 -0
- package/src/lib/constants/product-filters.js +109 -0
- package/src/lib/constants/product-filters.js.map +1 -0
- package/src/lib/model/commerce-cart.d.ts +52 -0
- package/src/lib/model/commerce-cart.js +102 -0
- package/src/lib/model/commerce-cart.js.map +1 -0
- package/src/lib/model/commerce-connect-transfer.d.ts +243 -0
- package/src/lib/model/commerce-connect-transfer.js +231 -0
- package/src/lib/model/commerce-connect-transfer.js.map +1 -0
- package/src/lib/model/commerce-discounts.d.ts +164 -0
- package/src/lib/model/commerce-discounts.js +231 -0
- package/src/lib/model/commerce-discounts.js.map +1 -0
- package/src/lib/model/commerce-dispute.d.ts +124 -0
- package/src/lib/model/commerce-dispute.js +225 -0
- package/src/lib/model/commerce-dispute.js.map +1 -0
- package/src/lib/model/commerce-gift-cards.d.ts +107 -0
- package/src/lib/model/commerce-gift-cards.js +121 -0
- package/src/lib/model/commerce-gift-cards.js.map +1 -0
- package/src/lib/model/commerce-io.d.ts +36 -0
- package/src/lib/model/commerce-io.js +245 -0
- package/src/lib/model/commerce-io.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +1040 -0
- package/src/lib/model/commerce-orders.js +1022 -0
- package/src/lib/model/commerce-orders.js.map +1 -0
- package/src/lib/model/commerce-promotions.d.ts +188 -0
- package/src/lib/model/commerce-promotions.js +199 -0
- package/src/lib/model/commerce-promotions.js.map +1 -0
- package/src/lib/model/commerce-reservations.d.ts +175 -0
- package/src/lib/model/commerce-reservations.js +157 -0
- package/src/lib/model/commerce-reservations.js.map +1 -0
- package/src/lib/model/commerce-shipping.d.ts +316 -0
- package/src/lib/model/commerce-shipping.js +484 -0
- package/src/lib/model/commerce-shipping.js.map +1 -0
- package/src/lib/model/commerce-stock-holds.d.ts +199 -0
- package/src/lib/model/commerce-stock-holds.js +190 -0
- package/src/lib/model/commerce-stock-holds.js.map +1 -0
- package/src/lib/model/commerce-subscription-status.d.ts +67 -0
- package/src/lib/model/commerce-subscription-status.js +76 -0
- package/src/lib/model/commerce-subscription-status.js.map +1 -0
- package/src/lib/model/commerce-tax-decision.d.ts +222 -0
- package/src/lib/model/commerce-tax-decision.js +165 -0
- package/src/lib/model/commerce-tax-decision.js.map +1 -0
- package/src/lib/model/commerce-tax.d.ts +176 -0
- package/src/lib/model/commerce-tax.js +92 -0
- package/src/lib/model/commerce-tax.js.map +1 -0
- package/src/lib/model/commerce.d.ts +551 -0
- package/src/lib/model/commerce.js +739 -0
- package/src/lib/model/commerce.js.map +1 -0
- package/src/lib/model/index.d.ts +40 -0
- package/src/lib/model/index.js +40 -0
- package/src/lib/model/index.js.map +1 -0
- package/src/lib/model/order-figures.d.ts +48 -0
- package/src/lib/model/order-figures.js +74 -0
- package/src/lib/model/order-figures.js.map +1 -0
- package/src/lib/model/plugin-permissions.d.ts +23 -0
- package/src/lib/model/plugin-permissions.js +34 -0
- package/src/lib/model/plugin-permissions.js.map +1 -0
- package/src/lib/model/purchase-analytics.d.ts +186 -0
- package/src/lib/model/purchase-analytics.js +216 -0
- package/src/lib/model/purchase-analytics.js.map +1 -0
- package/src/lib/plugin-config.d.ts +62 -0
- package/src/lib/plugin-config.js +78 -0
- package/src/lib/plugin-config.js.map +1 -0
- package/src/lib/plugin.d.ts +28 -0
- package/src/lib/plugin.js +147 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/server/billing-webhook.d.ts +26 -0
- package/src/lib/server/billing-webhook.js +4011 -0
- package/src/lib/server/billing-webhook.js.map +1 -0
- package/src/lib/server/cancel-order.d.ts +87 -0
- package/src/lib/server/cancel-order.js +368 -0
- package/src/lib/server/cancel-order.js.map +1 -0
- package/src/lib/server/cart-checkout.d.ts +25 -0
- package/src/lib/server/cart-checkout.js +976 -0
- package/src/lib/server/cart-checkout.js.map +1 -0
- package/src/lib/server/cart-cookie.d.ts +32 -0
- package/src/lib/server/cart-cookie.js +77 -0
- package/src/lib/server/cart-cookie.js.map +1 -0
- package/src/lib/server/cart.d.ts +34 -0
- package/src/lib/server/cart.js +181 -0
- package/src/lib/server/cart.js.map +1 -0
- package/src/lib/server/catalog.d.ts +127 -0
- package/src/lib/server/catalog.js +277 -0
- package/src/lib/server/catalog.js.map +1 -0
- package/src/lib/server/checkout.d.ts +36 -0
- package/src/lib/server/checkout.js +915 -0
- package/src/lib/server/checkout.js.map +1 -0
- package/src/lib/server/connect.d.ts +26 -0
- package/src/lib/server/connect.js +238 -0
- package/src/lib/server/connect.js.map +1 -0
- package/src/lib/server/contact-refund.d.ts +117 -0
- package/src/lib/server/contact-refund.js +196 -0
- package/src/lib/server/contact-refund.js.map +1 -0
- package/src/lib/server/download.d.ts +39 -0
- package/src/lib/server/download.js +206 -0
- package/src/lib/server/download.js.map +1 -0
- package/src/lib/server/draft-order.d.ts +26 -0
- package/src/lib/server/draft-order.js +706 -0
- package/src/lib/server/draft-order.js.map +1 -0
- package/src/lib/server/feed.d.ts +24 -0
- package/src/lib/server/feed.js +59 -0
- package/src/lib/server/feed.js.map +1 -0
- package/src/lib/server/fulfill-order.d.ts +97 -0
- package/src/lib/server/fulfill-order.js +235 -0
- package/src/lib/server/fulfill-order.js.map +1 -0
- package/src/lib/server/gate.d.ts +36 -0
- package/src/lib/server/gate.js +112 -0
- package/src/lib/server/gate.js.map +1 -0
- package/src/lib/server/gift-cards.d.ts +42 -0
- package/src/lib/server/gift-cards.js +219 -0
- package/src/lib/server/gift-cards.js.map +1 -0
- package/src/lib/server/low-stock.d.ts +49 -0
- package/src/lib/server/low-stock.js +60 -0
- package/src/lib/server/low-stock.js.map +1 -0
- package/src/lib/server/manual-tax-rate.d.ts +82 -0
- package/src/lib/server/manual-tax-rate.js +113 -0
- package/src/lib/server/manual-tax-rate.js.map +1 -0
- package/src/lib/server/member-feed.d.ts +24 -0
- package/src/lib/server/member-feed.js +72 -0
- package/src/lib/server/member-feed.js.map +1 -0
- package/src/lib/server/member-name-search.d.ts +37 -0
- package/src/lib/server/member-name-search.js +42 -0
- package/src/lib/server/member-name-search.js.map +1 -0
- package/src/lib/server/member-post.d.ts +23 -0
- package/src/lib/server/member-post.js +166 -0
- package/src/lib/server/member-post.js.map +1 -0
- package/src/lib/server/membership-account.d.ts +37 -0
- package/src/lib/server/membership-account.js +148 -0
- package/src/lib/server/membership-account.js.map +1 -0
- package/src/lib/server/membership-admin-password.d.ts +33 -0
- package/src/lib/server/membership-admin-password.js +202 -0
- package/src/lib/server/membership-admin-password.js.map +1 -0
- package/src/lib/server/membership-content.d.ts +23 -0
- package/src/lib/server/membership-content.js +105 -0
- package/src/lib/server/membership-content.js.map +1 -0
- package/src/lib/server/membership-login.d.ts +19 -0
- package/src/lib/server/membership-login.js +137 -0
- package/src/lib/server/membership-login.js.map +1 -0
- package/src/lib/server/membership-logout.d.ts +19 -0
- package/src/lib/server/membership-logout.js +35 -0
- package/src/lib/server/membership-logout.js.map +1 -0
- package/src/lib/server/membership-recover.d.ts +60 -0
- package/src/lib/server/membership-recover.js +244 -0
- package/src/lib/server/membership-recover.js.map +1 -0
- package/src/lib/server/membership-register.d.ts +22 -0
- package/src/lib/server/membership-register.js +241 -0
- package/src/lib/server/membership-register.js.map +1 -0
- package/src/lib/server/membership-reset.d.ts +26 -0
- package/src/lib/server/membership-reset.js +88 -0
- package/src/lib/server/membership-reset.js.map +1 -0
- package/src/lib/server/membership-wishlist.d.ts +23 -0
- package/src/lib/server/membership-wishlist.js +89 -0
- package/src/lib/server/membership-wishlist.js.map +1 -0
- package/src/lib/server/membership.d.ts +96 -0
- package/src/lib/server/membership.js +222 -0
- package/src/lib/server/membership.js.map +1 -0
- package/src/lib/server/native-checkout.d.ts +170 -0
- package/src/lib/server/native-checkout.js +193 -0
- package/src/lib/server/native-checkout.js.map +1 -0
- package/src/lib/server/newsletter.d.ts +23 -0
- package/src/lib/server/newsletter.js +323 -0
- package/src/lib/server/newsletter.js.map +1 -0
- package/src/lib/server/notify-restock.d.ts +22 -0
- package/src/lib/server/notify-restock.js +84 -0
- package/src/lib/server/notify-restock.js.map +1 -0
- package/src/lib/server/order-analytics.d.ts +134 -0
- package/src/lib/server/order-analytics.js +263 -0
- package/src/lib/server/order-analytics.js.map +1 -0
- package/src/lib/server/order-figures.d.ts +33 -0
- package/src/lib/server/order-figures.js +220 -0
- package/src/lib/server/order-figures.js.map +1 -0
- package/src/lib/server/paid-media-delivery.d.ts +173 -0
- package/src/lib/server/paid-media-delivery.js +212 -0
- package/src/lib/server/paid-media-delivery.js.map +1 -0
- package/src/lib/server/pos-order.d.ts +54 -0
- package/src/lib/server/pos-order.js +1137 -0
- package/src/lib/server/pos-order.js.map +1 -0
- package/src/lib/server/process-abandoned.d.ts +54 -0
- package/src/lib/server/process-abandoned.js +222 -0
- package/src/lib/server/process-abandoned.js.map +1 -0
- package/src/lib/server/process-restock.d.ts +42 -0
- package/src/lib/server/process-restock.js +219 -0
- package/src/lib/server/process-restock.js.map +1 -0
- package/src/lib/server/product-card.d.ts +29 -0
- package/src/lib/server/product-card.js +54 -0
- package/src/lib/server/product-card.js.map +1 -0
- package/src/lib/server/product.d.ts +70 -0
- package/src/lib/server/product.js +105 -0
- package/src/lib/server/product.js.map +1 -0
- package/src/lib/server/promotion-hold.d.ts +144 -0
- package/src/lib/server/promotion-hold.js +174 -0
- package/src/lib/server/promotion-hold.js.map +1 -0
- package/src/lib/server/reconcile-stock.d.ts +106 -0
- package/src/lib/server/reconcile-stock.js +349 -0
- package/src/lib/server/reconcile-stock.js.map +1 -0
- package/src/lib/server/refund.d.ts +45 -0
- package/src/lib/server/refund.js +607 -0
- package/src/lib/server/refund.js.map +1 -0
- package/src/lib/server/related.d.ts +24 -0
- package/src/lib/server/related.js +104 -0
- package/src/lib/server/related.js.map +1 -0
- package/src/lib/server/reservation-availability.d.ts +23 -0
- package/src/lib/server/reservation-availability.js +111 -0
- package/src/lib/server/reservation-availability.js.map +1 -0
- package/src/lib/server/reserve-stock.d.ts +156 -0
- package/src/lib/server/reserve-stock.js +146 -0
- package/src/lib/server/reserve-stock.js.map +1 -0
- package/src/lib/server/reserve.d.ts +25 -0
- package/src/lib/server/reserve.js +426 -0
- package/src/lib/server/reserve.js.map +1 -0
- package/src/lib/server/restock-flag.d.ts +202 -0
- package/src/lib/server/restock-flag.js +449 -0
- package/src/lib/server/restock-flag.js.map +1 -0
- package/src/lib/server/reviews.d.ts +51 -0
- package/src/lib/server/reviews.js +132 -0
- package/src/lib/server/reviews.js.map +1 -0
- package/src/lib/server/site-page-enricher.d.ts +42 -0
- package/src/lib/server/site-page-enricher.js +149 -0
- package/src/lib/server/site-page-enricher.js.map +1 -0
- package/src/lib/server/site-page-resolver.d.ts +26 -0
- package/src/lib/server/site-page-resolver.js +223 -0
- package/src/lib/server/site-page-resolver.js.map +1 -0
- package/src/lib/server/stock-hold.d.ts +127 -0
- package/src/lib/server/stock-hold.js +258 -0
- package/src/lib/server/stock-hold.js.map +1 -0
- package/src/lib/server/storefront-tax-record.d.ts +22 -0
- package/src/lib/server/storefront-tax-record.js +218 -0
- package/src/lib/server/storefront-tax-record.js.map +1 -0
- package/src/lib/server/storefront-tax.d.ts +197 -0
- package/src/lib/server/storefront-tax.js +245 -0
- package/src/lib/server/storefront-tax.js.map +1 -0
- package/src/lib/server/stream.d.ts +25 -0
- package/src/lib/server/stream.js +191 -0
- package/src/lib/server/stream.js.map +1 -0
- package/src/lib/server/subscription-portal.d.ts +24 -0
- package/src/lib/server/subscription-portal.js +91 -0
- package/src/lib/server/subscription-portal.js.map +1 -0
- package/src/lib/server/supplier-outbox.d.ts +190 -0
- package/src/lib/server/supplier-outbox.js +342 -0
- package/src/lib/server/supplier-outbox.js.map +1 -0
- package/src/lib/server/supplier-update.d.ts +23 -0
- package/src/lib/server/supplier-update.js +289 -0
- package/src/lib/server/supplier-update.js.map +1 -0
- package/src/lib/server/tax-profile.d.ts +29 -0
- package/src/lib/server/tax-profile.js +40 -0
- package/src/lib/server/tax-profile.js.map +1 -0
- package/src/lib/server.d.ts +32 -0
- package/src/lib/server.js +311 -0
- package/src/lib/server.js.map +1 -0
- package/src/lib/site.d.ts +27 -0
- package/src/lib/site.js +134 -0
- package/src/lib/site.js.map +1 -0
- package/src/lib/utils/escape-html.d.ts +41 -0
- package/src/lib/utils/escape-html.js +41 -0
- package/src/lib/utils/escape-html.js.map +1 -0
- package/src/lib/utils/generate-preset-id.d.ts +19 -0
- package/src/lib/utils/generate-preset-id.js +25 -0
- package/src/lib/utils/generate-preset-id.js.map +1 -0
- package/src/lib/utils/member-continue.d.ts +45 -0
- package/src/lib/utils/member-continue.js +49 -0
- package/src/lib/utils/member-continue.js.map +1 -0
- package/src/lib/utils/use-storefront-purchase-event.d.ts +60 -0
- package/src/lib/utils/use-storefront-purchase-event.js +142 -0
- package/src/lib/utils/use-storefront-purchase-event.js.map +1 -0
|
@@ -0,0 +1,287 @@
|
|
|
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 { trackEventBeforeNavigation } from "@aglyn/aglyn/app-utils/analytics-events";
|
|
21
|
+
import { campaignTouchField } from "@aglyn/aglyn/app-utils/campaign-touch";
|
|
22
|
+
import { mdiAccountPlusOutline } from "@aglyn/shared-data-mdi";
|
|
23
|
+
import Alert from "@mui/material/Alert";
|
|
24
|
+
import Box from "@mui/material/Box";
|
|
25
|
+
import Button from "@mui/material/Button";
|
|
26
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
27
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
28
|
+
import Link from "@mui/material/Link";
|
|
29
|
+
import TextField from "@mui/material/TextField";
|
|
30
|
+
import Typography from "@mui/material/Typography";
|
|
31
|
+
import { forwardRef, useCallback, useState } from "react";
|
|
32
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
33
|
+
import { continuePathFromLocation, memberNavigation } from "../utils/member-continue.js";
|
|
34
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
35
|
+
// Component ids are persisted in screen documents; never rename.
|
|
36
|
+
export const ID = 'member-signup';
|
|
37
|
+
/**
|
|
38
|
+
* Standalone sign-up block (AGL-553), extracted from the customer-account
|
|
39
|
+
* create-account tab. Registers through the AGL-109 membership API (with
|
|
40
|
+
* the same belt-and-braces follow-up login the account block does), then
|
|
41
|
+
* sends the new member to the validated `continue` query param (relative
|
|
42
|
+
* paths only) or the configured fallback.
|
|
43
|
+
*/ const MemberSignup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
44
|
+
const { heading, signinPath, continueFallback } = props, rest = _object_without_properties_loose(props, [
|
|
45
|
+
"heading",
|
|
46
|
+
"signinPath",
|
|
47
|
+
"continueFallback"
|
|
48
|
+
]);
|
|
49
|
+
// Node styles ride the renderer-merged sx; recompose (stack.ts pattern).
|
|
50
|
+
const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [
|
|
51
|
+
props['sx']
|
|
52
|
+
];
|
|
53
|
+
const { hostId } = Aglyn.useSite();
|
|
54
|
+
const siteFetch = Aglyn.useSiteFetch();
|
|
55
|
+
const [displayName, setDisplayName] = useState('');
|
|
56
|
+
const [email, setEmail] = useState('');
|
|
57
|
+
const [password, setPassword] = useState('');
|
|
58
|
+
const [marketingConsent, setMarketingConsent] = useState(false);
|
|
59
|
+
const [error, setError] = useState('');
|
|
60
|
+
const [busy, setBusy] = useState(false);
|
|
61
|
+
const handleSignup = useCallback(async ()=>{
|
|
62
|
+
if (!hostId || busy) return;
|
|
63
|
+
setBusy(true);
|
|
64
|
+
setError('');
|
|
65
|
+
try {
|
|
66
|
+
const response = await siteFetch('/api/membership/register', {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json'
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify(_extends({
|
|
72
|
+
hostId,
|
|
73
|
+
email,
|
|
74
|
+
password
|
|
75
|
+
}, displayName ? {
|
|
76
|
+
displayName
|
|
77
|
+
} : {}, marketingConsent ? {
|
|
78
|
+
marketingConsent: true
|
|
79
|
+
} : {}, campaignTouchField()))
|
|
80
|
+
});
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
var _ref;
|
|
83
|
+
const payload = await response.json().catch(()=>({}));
|
|
84
|
+
setError(String((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Sign-up failed'));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Register does not set the cookie on every deployment; sign in
|
|
88
|
+
// right after to be safe (same as the customer-account block).
|
|
89
|
+
await siteFetch('/api/membership/login', {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: {
|
|
92
|
+
'Content-Type': 'application/json'
|
|
93
|
+
},
|
|
94
|
+
body: JSON.stringify({
|
|
95
|
+
hostId,
|
|
96
|
+
email,
|
|
97
|
+
password
|
|
98
|
+
})
|
|
99
|
+
}).catch(()=>undefined);
|
|
100
|
+
/*
|
|
101
|
+
* The host's own GA4 property, not Aglyn's (AGL-1591). A storefront
|
|
102
|
+
* that switched its members to accounts had no way to see it happen:
|
|
103
|
+
* `sign_up` is a GA4 recommended event and every other funnel step on
|
|
104
|
+
* this site already reports one, so the account door was the single
|
|
105
|
+
* hole in a funnel the operator can otherwise follow end to end.
|
|
106
|
+
*
|
|
107
|
+
* AWAITED, because the line below tears the document down. Delivery on
|
|
108
|
+
* this surface is a synchronous `window.gtag` call today, so the await
|
|
109
|
+
* costs a microtask — it is written this way because the property that
|
|
110
|
+
* makes a bare call safe is invisible from here, and the day a host
|
|
111
|
+
* registers an async transport the event would start disappearing on
|
|
112
|
+
* exactly the branch that navigates.
|
|
113
|
+
*/ await trackEventBeforeNavigation('sign_up', {
|
|
114
|
+
method: 'password'
|
|
115
|
+
});
|
|
116
|
+
memberNavigation.assign(continuePathFromLocation(continueFallback || '/'));
|
|
117
|
+
} finally{
|
|
118
|
+
setBusy(false);
|
|
119
|
+
}
|
|
120
|
+
}, [
|
|
121
|
+
hostId,
|
|
122
|
+
busy,
|
|
123
|
+
displayName,
|
|
124
|
+
email,
|
|
125
|
+
password,
|
|
126
|
+
marketingConsent,
|
|
127
|
+
continueFallback,
|
|
128
|
+
siteFetch
|
|
129
|
+
]);
|
|
130
|
+
if (!hostId) {
|
|
131
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
132
|
+
ref: ref
|
|
133
|
+
}, rest, {
|
|
134
|
+
sx: [
|
|
135
|
+
{
|
|
136
|
+
p: 3,
|
|
137
|
+
border: '1px dashed',
|
|
138
|
+
borderColor: 'divider',
|
|
139
|
+
borderRadius: 1,
|
|
140
|
+
color: 'text.secondary',
|
|
141
|
+
fontSize: 13,
|
|
142
|
+
fontFamily: 'system-ui, sans-serif'
|
|
143
|
+
},
|
|
144
|
+
...nodeSx
|
|
145
|
+
],
|
|
146
|
+
children: 'Member sign-up — the create-account form renders here'
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
return /*#__PURE__*/ _jsxs(Box, _extends({
|
|
150
|
+
ref: ref
|
|
151
|
+
}, rest, {
|
|
152
|
+
sx: [
|
|
153
|
+
{
|
|
154
|
+
maxWidth: 420
|
|
155
|
+
},
|
|
156
|
+
...nodeSx
|
|
157
|
+
],
|
|
158
|
+
children: [
|
|
159
|
+
heading ? /*#__PURE__*/ _jsx(Typography, {
|
|
160
|
+
variant: "h5",
|
|
161
|
+
gutterBottom: true,
|
|
162
|
+
children: heading
|
|
163
|
+
}) : null,
|
|
164
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
165
|
+
sx: {
|
|
166
|
+
display: 'flex',
|
|
167
|
+
flexDirection: 'column',
|
|
168
|
+
gap: 1.5
|
|
169
|
+
},
|
|
170
|
+
children: [
|
|
171
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
172
|
+
label: "Name",
|
|
173
|
+
value: displayName,
|
|
174
|
+
onChange: (event)=>setDisplayName(event.target.value),
|
|
175
|
+
size: "small"
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
178
|
+
label: "Email",
|
|
179
|
+
type: "email",
|
|
180
|
+
value: email,
|
|
181
|
+
onChange: (event)=>setEmail(event.target.value),
|
|
182
|
+
size: "small"
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
185
|
+
label: "Password",
|
|
186
|
+
type: "password",
|
|
187
|
+
value: password,
|
|
188
|
+
onChange: (event)=>setPassword(event.target.value),
|
|
189
|
+
size: "small",
|
|
190
|
+
helperText: "At least 8 characters"
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
193
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
194
|
+
size: "small",
|
|
195
|
+
checked: marketingConsent,
|
|
196
|
+
onChange: (event)=>setMarketingConsent(event.target.checked)
|
|
197
|
+
}),
|
|
198
|
+
label: "Email me about offers and updates"
|
|
199
|
+
}),
|
|
200
|
+
error ? /*#__PURE__*/ _jsx(Alert, {
|
|
201
|
+
severity: "error",
|
|
202
|
+
children: error
|
|
203
|
+
}) : null,
|
|
204
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
205
|
+
variant: "contained",
|
|
206
|
+
color: "primary",
|
|
207
|
+
disabled: busy || !email || password.length < 8,
|
|
208
|
+
onClick: handleSignup,
|
|
209
|
+
children: busy ? 'Working…' : 'Create account'
|
|
210
|
+
}),
|
|
211
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
212
|
+
variant: "body2",
|
|
213
|
+
children: /*#__PURE__*/ _jsx(Link, {
|
|
214
|
+
href: signinPath || '/signin',
|
|
215
|
+
underline: "hover",
|
|
216
|
+
children: 'Already a member? Sign in'
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
}));
|
|
223
|
+
});
|
|
224
|
+
MemberSignup.displayName = 'AglynMemberSignup';
|
|
225
|
+
export const schema = {
|
|
226
|
+
$id: ID,
|
|
227
|
+
pluginId: BUNDLE_ID,
|
|
228
|
+
displayName: 'Member sign-up',
|
|
229
|
+
description: 'A create-account form for site membership.',
|
|
230
|
+
category: Aglyn.ComponentCategory.MEMBERS,
|
|
231
|
+
icon: {
|
|
232
|
+
path: mdiAccountPlusOutline.path,
|
|
233
|
+
sx: {
|
|
234
|
+
color: '#2e7d32'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
flags: {
|
|
238
|
+
selfClosing: Aglyn.FEATURE_FLAG.ENABLED
|
|
239
|
+
},
|
|
240
|
+
attributes: [
|
|
241
|
+
{
|
|
242
|
+
name: 'heading',
|
|
243
|
+
label: 'Heading',
|
|
244
|
+
description: 'The title above the sign-up fields. Say what joining gets them; ' + 'blank renders no heading at all.',
|
|
245
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: 'signinPath',
|
|
249
|
+
label: 'Sign-in path',
|
|
250
|
+
description: 'Where "Already a member?" points (default /signin).',
|
|
251
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: 'continueFallback',
|
|
255
|
+
label: 'After sign-up',
|
|
256
|
+
description: 'Where a new member goes once the account EXISTS, when nothing sent ' + 'them here. A `?continue=` on the URL always wins. Point it at a ' + 'welcome or onboarding page rather than the home page if you have ' + 'one.',
|
|
257
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
};
|
|
261
|
+
export const presets = [
|
|
262
|
+
{
|
|
263
|
+
$id: generatePresetId(ID),
|
|
264
|
+
type: Aglyn.NodeType.PRESET,
|
|
265
|
+
displayName: 'Member sign-up',
|
|
266
|
+
pluginId: BUNDLE_ID,
|
|
267
|
+
description: 'Create-account form for site membership',
|
|
268
|
+
category: Aglyn.ComponentCategory.MEMBERS,
|
|
269
|
+
icon: {
|
|
270
|
+
path: mdiAccountPlusOutline.path,
|
|
271
|
+
sx: {
|
|
272
|
+
color: '#2e7d32'
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
data: {
|
|
276
|
+
$id: null,
|
|
277
|
+
componentId: ID,
|
|
278
|
+
pluginId: BUNDLE_ID,
|
|
279
|
+
props: {
|
|
280
|
+
heading: 'Create your account'
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
];
|
|
285
|
+
export default MemberSignup;
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=member-signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/member-signup.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 { trackEventBeforeNavigation } from '@aglyn/aglyn/app-utils/analytics-events'\nimport { campaignTouchField } from '@aglyn/aglyn/app-utils/campaign-touch'\nimport { mdiAccountPlusOutline } from '@aglyn/shared-data-mdi'\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Checkbox from '@mui/material/Checkbox'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Link from '@mui/material/Link'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport { forwardRef, useCallback, useState } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport {\n continuePathFromLocation,\n memberNavigation,\n} from '../utils/member-continue'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n// Component ids are persisted in screen documents; never rename.\nexport const ID: Aglyn.ComponentId = 'member-signup'\n\nexport interface MemberSignupProps {\n heading?: string\n signinPath?: string\n continueFallback?: string\n}\n\n/**\n * Standalone sign-up block (AGL-553), extracted from the customer-account\n * create-account tab. Registers through the AGL-109 membership API (with\n * the same belt-and-braces follow-up login the account block does), then\n * sends the new member to the validated `continue` query param (relative\n * paths only) or the configured fallback.\n */\nconst MemberSignup = forwardRef<HTMLDivElement, MemberSignupProps>(\n (props, ref) => {\n const { heading, signinPath, continueFallback, ...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 [displayName, setDisplayName] = useState('')\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [marketingConsent, setMarketingConsent] = useState(false)\n const [error, setError] = useState('')\n const [busy, setBusy] = useState(false)\n\n const handleSignup = useCallback(async () => {\n if (!hostId || busy) return\n setBusy(true)\n setError('')\n try {\n const response = await siteFetch('/api/membership/register', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n hostId,\n email,\n password,\n ...(displayName ? { displayName } : {}),\n ...(marketingConsent ? { marketingConsent: true } : {}),\n // The campaign this visitor came from, when they came from one.\n // A sign-up is the identify moment that also writes a lead, so\n // the touch has to arrive with the request that creates it.\n ...campaignTouchField(),\n }),\n })\n if (!response.ok) {\n const payload = await response.json().catch(() => ({}))\n setError(String(payload?.error ?? 'Sign-up failed'))\n return\n }\n // Register does not set the cookie on every deployment; sign in\n // right after to be safe (same as the customer-account block).\n await siteFetch('/api/membership/login', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, email, password }),\n }).catch(() => undefined)\n /*\n * The host's own GA4 property, not Aglyn's (AGL-1591). A storefront\n * that switched its members to accounts had no way to see it happen:\n * `sign_up` is a GA4 recommended event and every other funnel step on\n * this site already reports one, so the account door was the single\n * hole in a funnel the operator can otherwise follow end to end.\n *\n * AWAITED, because the line below tears the document down. Delivery on\n * this surface is a synchronous `window.gtag` call today, so the await\n * costs a microtask — it is written this way because the property that\n * makes a bare call safe is invisible from here, and the day a host\n * registers an async transport the event would start disappearing on\n * exactly the branch that navigates.\n */\n await trackEventBeforeNavigation('sign_up', { method: 'password' })\n memberNavigation.assign(\n continuePathFromLocation(continueFallback || '/'),\n )\n } finally {\n setBusy(false)\n }\n }, [\n hostId,\n busy,\n displayName,\n email,\n password,\n marketingConsent,\n continueFallback,\n siteFetch,\n ])\n\n if (!hostId) {\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n p: 3,\n border: '1px dashed',\n borderColor: 'divider',\n borderRadius: 1,\n color: 'text.secondary',\n fontSize: 13,\n fontFamily: 'system-ui, sans-serif',\n },\n ...nodeSx,\n ]}\n >\n {'Member sign-up — the create-account form renders here'}\n </Box>\n )\n }\n\n return (\n <Box ref={ref} {...rest} sx={[{ maxWidth: 420 }, ...nodeSx]}>\n {heading ? (\n <Typography variant=\"h5\" gutterBottom>\n {heading}\n </Typography>\n ) : null}\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>\n <TextField\n label=\"Name\"\n value={displayName}\n onChange={(event) => setDisplayName(event.target.value)}\n size=\"small\"\n />\n <TextField\n label=\"Email\"\n type=\"email\"\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n size=\"small\"\n />\n <TextField\n label=\"Password\"\n type=\"password\"\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n size=\"small\"\n helperText=\"At least 8 characters\"\n />\n <FormControlLabel\n control={\n <Checkbox\n size=\"small\"\n checked={marketingConsent}\n onChange={(event) =>\n setMarketingConsent(event.target.checked)\n }\n />\n }\n label=\"Email me about offers and updates\"\n />\n {error ? <Alert severity=\"error\">{error}</Alert> : null}\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={busy || !email || password.length < 8}\n onClick={handleSignup}\n >\n {busy ? 'Working…' : 'Create account'}\n </Button>\n <Typography variant=\"body2\">\n <Link href={signinPath || '/signin'} underline=\"hover\">\n {'Already a member? Sign in'}\n </Link>\n </Typography>\n </Box>\n </Box>\n )\n },\n)\nMemberSignup.displayName = 'AglynMemberSignup'\n\nexport const schema: Aglyn.ComponentSchema<MemberSignupProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Member sign-up',\n description: 'A create-account form for site membership.',\n category: Aglyn.ComponentCategory.MEMBERS,\n icon: { path: mdiAccountPlusOutline.path, sx: { color: '#2e7d32' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'heading',\n label: 'Heading',\n description:\n 'The title above the sign-up fields. Say what joining gets them; ' +\n 'blank renders no heading at all.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'signinPath',\n label: 'Sign-in path',\n description: 'Where \"Already a member?\" points (default /signin).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'continueFallback',\n label: 'After sign-up',\n description:\n 'Where a new member goes once the account EXISTS, when nothing sent ' +\n 'them here. A `?continue=` on the URL always wins. Point it at a ' +\n 'welcome or onboarding page rather than the home page if you have ' +\n 'one.',\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: 'Member sign-up',\n pluginId: BUNDLE_ID,\n description: 'Create-account form for site membership',\n category: Aglyn.ComponentCategory.MEMBERS,\n icon: { path: mdiAccountPlusOutline.path, sx: { color: '#2e7d32' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { heading: 'Create your account' },\n },\n },\n]\n\nexport default MemberSignup\n"],"names":["Aglyn","trackEventBeforeNavigation","campaignTouchField","mdiAccountPlusOutline","Alert","Box","Button","Checkbox","FormControlLabel","Link","TextField","Typography","forwardRef","useCallback","useState","BUNDLE_ID","continuePathFromLocation","memberNavigation","generatePresetId","ID","MemberSignup","props","ref","heading","signinPath","continueFallback","rest","nodeSx","Array","isArray","hostId","useSite","siteFetch","useSiteFetch","displayName","setDisplayName","email","setEmail","password","setPassword","marketingConsent","setMarketingConsent","error","setError","busy","setBusy","handleSignup","response","method","headers","body","JSON","stringify","ok","payload","json","catch","String","undefined","assign","sx","p","border","borderColor","borderRadius","color","fontSize","fontFamily","maxWidth","variant","gutterBottom","display","flexDirection","gap","label","value","onChange","event","target","size","type","helperText","control","checked","severity","disabled","length","onClick","href","underline","schema","$id","pluginId","description","category","ComponentCategory","MEMBERS","icon","path","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","component","FieldComponentType","TEXT_FI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AAKxE;IACLyE,UAAU7E;IACVmB,aAAa;IACb2D,aAAa;IACbC,UAAU9F,MAAM+F,iBAAiB,CAACC,OAAO;IACzCC,MAAM;QAAEC,MAAM/F,sBAAsB+F,IAAI;QAAEtC,IAAI;YAAEK,OAAO;QAAU;IAAE;IACnEkC,OAAO;QAAEC,aAAapG,MAAMqG,YAAY,CAACC,OAAO;IAAC;IACjDC,YAAY;QACV;YACEC,MAAM;YACN9B,OAAO;YACPmB,aACE,qEACA;YACFY,WAAWzG,MAAM0G,kBAAkB,CAACC,UAAU;QAChD;QACA;YACEH,MAAM;YACN9B,OAAO;YACPmB,aAAa;YACbY,WAAWzG,MAAM0G,kBAAkB,CAACC,UAAU;QAChD;QACA;YACEH,MAAM;YACN9B,OAAO;YACPmB,aACE,wEACA,qEACA,sEACA;YACFY,WAAWzG,MAAM0G,kBAAkB,CAACC,UAAU;QAChD;KACD;AACH,EAAC;AAED,OAAO,MAAMC,UAAgC;IAC3C;QACEjB,KAAKzE,iBAAiBC;QACtB6D,MAAMhF,MAAM6G,QAAQ,CAACC,MAAM;QAC3B5E,aAAa;QACb0D,UAAU7E;QACV8E,aAAa;QACbC,UAAU9F,MAAM+F,iBAAiB,CAACC,OAAO;QACzCC,MAAM;YAAEC,MAAM/F,sBAAsB+F,IAAI;YAAEtC,IAAI;gBAAEK,OAAO;YAAU;QAAE;QACnE8C,MAAM;YACJpB,KAAK;YACLqB,aAAa7F;YACbyE,UAAU7E;YACVM,OAAO;gBAAEE,SAAS;YAAsB;QAC1C;IACF;CACD,CAAA;AAED,eAAeH,aAAY"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 NewsletterSignupProps {
|
|
20
|
+
heading?: string;
|
|
21
|
+
buttonLabel?: string;
|
|
22
|
+
successText?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Enrolls the subscriber into this list's members (AGL-2499), in
|
|
25
|
+
* addition to the always-on contacts upsert. This is the id shown on the
|
|
26
|
+
* Audiences page's list settings — copy it from there. Left blank, the
|
|
27
|
+
* block behaves exactly as before: contacts only.
|
|
28
|
+
*/
|
|
29
|
+
listId?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Newsletter signup block (AGL-301): consented email capture straight
|
|
33
|
+
* into the contacts CRM (source `newsletter`), ready for email-campaign
|
|
34
|
+
* audiences.
|
|
35
|
+
*/
|
|
36
|
+
declare const NewsletterSignup: import("react").ForwardRefExoticComponent<NewsletterSignupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export declare const schema: Aglyn.ComponentSchema<NewsletterSignupProps>;
|
|
38
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
39
|
+
export default NewsletterSignup;
|
|
@@ -0,0 +1,229 @@
|
|
|
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 { trackEvent } from "@aglyn/aglyn/app-utils/analytics-events";
|
|
20
|
+
import { campaignTouchField } from "@aglyn/aglyn/app-utils/campaign-touch";
|
|
21
|
+
import * as Aglyn from "@aglyn/aglyn";
|
|
22
|
+
import { mdiEmailOutline } from "@aglyn/shared-data-mdi";
|
|
23
|
+
import Box from "@mui/material/Box";
|
|
24
|
+
import Button from "@mui/material/Button";
|
|
25
|
+
import TextField from "@mui/material/TextField";
|
|
26
|
+
import Typography from "@mui/material/Typography";
|
|
27
|
+
import { forwardRef, 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 = 'newsletter-signup';
|
|
32
|
+
/**
|
|
33
|
+
* Newsletter signup block (AGL-301): consented email capture straight
|
|
34
|
+
* into the contacts CRM (source `newsletter`), ready for email-campaign
|
|
35
|
+
* audiences.
|
|
36
|
+
*/ const NewsletterSignup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
37
|
+
const { heading, buttonLabel, successText, listId } = props, rest = _object_without_properties_loose(props, [
|
|
38
|
+
"heading",
|
|
39
|
+
"buttonLabel",
|
|
40
|
+
"successText",
|
|
41
|
+
"listId"
|
|
42
|
+
]);
|
|
43
|
+
// Node styles ride the renderer-merged sx; recompose (stack.ts pattern).
|
|
44
|
+
const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [
|
|
45
|
+
props['sx']
|
|
46
|
+
];
|
|
47
|
+
const { hostId } = Aglyn.useSite();
|
|
48
|
+
const siteFetch = Aglyn.useSiteFetch();
|
|
49
|
+
const [email, setEmail] = useState('');
|
|
50
|
+
const [state, setState] = useState('idle');
|
|
51
|
+
const handleSubscribe = async ()=>{
|
|
52
|
+
if (!hostId || state === 'busy') return;
|
|
53
|
+
setState('busy');
|
|
54
|
+
try {
|
|
55
|
+
const response = await siteFetch('/api/commerce/newsletter', {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/json'
|
|
59
|
+
},
|
|
60
|
+
body: JSON.stringify(_extends({
|
|
61
|
+
hostId,
|
|
62
|
+
email
|
|
63
|
+
}, listId ? {
|
|
64
|
+
listId
|
|
65
|
+
} : {}, campaignTouchField()))
|
|
66
|
+
});
|
|
67
|
+
// GA4 lead conversion (AGL-1561) — AGL-301's subscribe element is a
|
|
68
|
+
// form completion in every sense that matters, and it shares nothing
|
|
69
|
+
// with the generic `Form` element, so it needs its own call. Only on
|
|
70
|
+
// `response.ok`: a failed subscribe is not a lead. The email is
|
|
71
|
+
// deliberately absent from the payload.
|
|
72
|
+
if (response.ok) {
|
|
73
|
+
trackEvent('generate_lead', {
|
|
74
|
+
form_name: 'Newsletter',
|
|
75
|
+
form_location: window.location.pathname
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
setState(response.ok ? 'done' : 'error');
|
|
79
|
+
} catch (unused) {
|
|
80
|
+
setState('error');
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
if (state === 'done') {
|
|
84
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
85
|
+
ref: ref
|
|
86
|
+
}, rest, {
|
|
87
|
+
sx: [
|
|
88
|
+
{
|
|
89
|
+
py: 1
|
|
90
|
+
},
|
|
91
|
+
...nodeSx
|
|
92
|
+
],
|
|
93
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
94
|
+
variant: "body2",
|
|
95
|
+
children: successText || 'You’re on the list — thanks!'
|
|
96
|
+
})
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
return /*#__PURE__*/ _jsxs(Box, _extends({
|
|
100
|
+
ref: ref
|
|
101
|
+
}, rest, {
|
|
102
|
+
children: [
|
|
103
|
+
heading ? // `component="p"` because this introduces the field below it and is
|
|
104
|
+
// not a section heading (AGL-2486). MUI's `defaultVariantMapping`
|
|
105
|
+
// sends `subtitle1` to `<h6>`, so without this the signup block puts
|
|
106
|
+
// a level-6 heading into the outline of every page it appears on. On
|
|
107
|
+
// a blog listing the nearest preceding heading is an `h3`, which
|
|
108
|
+
// makes it a skipped level and a `heading-order` failure.
|
|
109
|
+
//
|
|
110
|
+
// It is also not the field's label — see the `aria-label` below,
|
|
111
|
+
// which is the input's only accessible name.
|
|
112
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
113
|
+
component: "p",
|
|
114
|
+
variant: "subtitle1",
|
|
115
|
+
gutterBottom: true,
|
|
116
|
+
children: heading
|
|
117
|
+
}) : null,
|
|
118
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
119
|
+
sx: {
|
|
120
|
+
display: 'flex',
|
|
121
|
+
gap: 1
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
125
|
+
type: "email",
|
|
126
|
+
placeholder: "you@example.com",
|
|
127
|
+
// The field's only accessible name (AGL-2392). `heading` is
|
|
128
|
+
// optional and is a plain `subtitle1` above the row, never a
|
|
129
|
+
// `<label>`, so without this the input ships nameless — which is
|
|
130
|
+
// what aglyn.com/blog does today. A placeholder is not a name:
|
|
131
|
+
// assistive tech is not required to announce it, and it vanishes
|
|
132
|
+
// the moment the visitor types.
|
|
133
|
+
slotProps: {
|
|
134
|
+
htmlInput: {
|
|
135
|
+
'aria-label': 'Email address'
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
value: email,
|
|
139
|
+
onChange: (event)=>setEmail(event.target.value),
|
|
140
|
+
size: "small",
|
|
141
|
+
sx: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
maxWidth: 320
|
|
144
|
+
},
|
|
145
|
+
error: state === 'error',
|
|
146
|
+
helperText: state === 'error' ? 'Enter a valid email' : undefined
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
149
|
+
variant: "contained",
|
|
150
|
+
color: "primary",
|
|
151
|
+
disabled: !hostId || state === 'busy' || !email.trim(),
|
|
152
|
+
onClick: handleSubscribe,
|
|
153
|
+
children: state === 'busy' ? '…' : buttonLabel || 'Subscribe'
|
|
154
|
+
})
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
}));
|
|
159
|
+
});
|
|
160
|
+
NewsletterSignup.displayName = 'AglynNewsletterSignup';
|
|
161
|
+
export const schema = {
|
|
162
|
+
$id: ID,
|
|
163
|
+
pluginId: BUNDLE_ID,
|
|
164
|
+
displayName: 'Newsletter signup',
|
|
165
|
+
description: 'A consented email capture that writes straight into contacts.',
|
|
166
|
+
category: Aglyn.ComponentCategory.COMMERCE,
|
|
167
|
+
icon: {
|
|
168
|
+
path: mdiEmailOutline.path,
|
|
169
|
+
sx: {
|
|
170
|
+
color: '#2e7d32'
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
flags: {
|
|
174
|
+
selfClosing: Aglyn.FEATURE_FLAG.ENABLED
|
|
175
|
+
},
|
|
176
|
+
attributes: [
|
|
177
|
+
{
|
|
178
|
+
name: 'heading',
|
|
179
|
+
label: 'Heading',
|
|
180
|
+
description: 'Shown above the field.',
|
|
181
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'buttonLabel',
|
|
185
|
+
label: 'Button label',
|
|
186
|
+
description: 'Defaults to "Subscribe".',
|
|
187
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'successText',
|
|
191
|
+
label: 'Success text',
|
|
192
|
+
description: 'Shown after subscribing.',
|
|
193
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'listId',
|
|
197
|
+
label: 'List',
|
|
198
|
+
description: 'Optional — enrolls subscribers into this list too (id from Audiences → Lists). Blank keeps the old contacts-only behavior.',
|
|
199
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
};
|
|
203
|
+
export const presets = [
|
|
204
|
+
{
|
|
205
|
+
$id: generatePresetId(ID),
|
|
206
|
+
type: Aglyn.NodeType.PRESET,
|
|
207
|
+
displayName: 'Newsletter signup',
|
|
208
|
+
pluginId: BUNDLE_ID,
|
|
209
|
+
description: 'Consented email capture into contacts',
|
|
210
|
+
category: Aglyn.ComponentCategory.COMMERCE,
|
|
211
|
+
icon: {
|
|
212
|
+
path: mdiEmailOutline.path,
|
|
213
|
+
sx: {
|
|
214
|
+
color: '#2e7d32'
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
data: {
|
|
218
|
+
$id: null,
|
|
219
|
+
componentId: ID,
|
|
220
|
+
pluginId: BUNDLE_ID,
|
|
221
|
+
props: {
|
|
222
|
+
heading: 'Get updates and offers'
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
];
|
|
227
|
+
export default NewsletterSignup;
|
|
228
|
+
|
|
229
|
+
//# sourceMappingURL=newsletter-signup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/components/newsletter-signup.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 { trackEvent } from '@aglyn/aglyn/app-utils/analytics-events'\nimport { campaignTouchField } from '@aglyn/aglyn/app-utils/campaign-touch'\nimport * as Aglyn from '@aglyn/aglyn'\nimport { mdiEmailOutline } from '@aglyn/shared-data-mdi'\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport { forwardRef, 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 = 'newsletter-signup'\n\nexport interface NewsletterSignupProps {\n heading?: string\n buttonLabel?: string\n successText?: string\n /**\n * Enrolls the subscriber into this list's members (AGL-2499), in\n * addition to the always-on contacts upsert. This is the id shown on the\n * Audiences page's list settings — copy it from there. Left blank, the\n * block behaves exactly as before: contacts only.\n */\n listId?: string\n}\n\n/**\n * Newsletter signup block (AGL-301): consented email capture straight\n * into the contacts CRM (source `newsletter`), ready for email-campaign\n * audiences.\n */\nconst NewsletterSignup = forwardRef<HTMLDivElement, NewsletterSignupProps>(\n (props, ref) => {\n const { heading, buttonLabel, successText, listId, ...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 [email, setEmail] = useState('')\n const [state, setState] = useState<'idle' | 'busy' | 'done' | 'error'>(\n 'idle',\n )\n\n const handleSubscribe = async () => {\n if (!hostId || state === 'busy') return\n setState('busy')\n try {\n const response = await siteFetch('/api/commerce/newsletter', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n hostId,\n email,\n ...(listId ? { listId } : {}),\n // The campaign this visitor came from, when they came from one.\n ...campaignTouchField(),\n }),\n })\n // GA4 lead conversion (AGL-1561) — AGL-301's subscribe element is a\n // form completion in every sense that matters, and it shares nothing\n // with the generic `Form` element, so it needs its own call. Only on\n // `response.ok`: a failed subscribe is not a lead. The email is\n // deliberately absent from the payload.\n if (response.ok) {\n trackEvent('generate_lead', {\n form_name: 'Newsletter',\n form_location: window.location.pathname,\n })\n }\n setState(response.ok ? 'done' : 'error')\n } catch {\n setState('error')\n }\n }\n\n if (state === 'done') {\n return (\n <Box ref={ref} {...rest} sx={[{ py: 1 }, ...nodeSx]}>\n <Typography variant=\"body2\">\n {successText || 'You’re on the list — thanks!'}\n </Typography>\n </Box>\n )\n }\n\n return (\n <Box ref={ref} {...rest}>\n {heading ? (\n // `component=\"p\"` because this introduces the field below it and is\n // not a section heading (AGL-2486). MUI's `defaultVariantMapping`\n // sends `subtitle1` to `<h6>`, so without this the signup block puts\n // a level-6 heading into the outline of every page it appears on. On\n // a blog listing the nearest preceding heading is an `h3`, which\n // makes it a skipped level and a `heading-order` failure.\n //\n // It is also not the field's label — see the `aria-label` below,\n // which is the input's only accessible name.\n <Typography component=\"p\" variant=\"subtitle1\" gutterBottom>\n {heading}\n </Typography>\n ) : null}\n <Box sx={{ display: 'flex', gap: 1 }}>\n <TextField\n type=\"email\"\n placeholder=\"you@example.com\"\n // The field's only accessible name (AGL-2392). `heading` is\n // optional and is a plain `subtitle1` above the row, never a\n // `<label>`, so without this the input ships nameless — which is\n // what aglyn.com/blog does today. A placeholder is not a name:\n // assistive tech is not required to announce it, and it vanishes\n // the moment the visitor types.\n slotProps={{ htmlInput: { 'aria-label': 'Email address' } }}\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n size=\"small\"\n sx={{ flex: 1, maxWidth: 320 }}\n error={state === 'error'}\n helperText={state === 'error' ? 'Enter a valid email' : undefined}\n />\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={!hostId || state === 'busy' || !email.trim()}\n onClick={handleSubscribe}\n >\n {state === 'busy' ? '…' : buttonLabel || 'Subscribe'}\n </Button>\n </Box>\n </Box>\n )\n },\n)\nNewsletterSignup.displayName = 'AglynNewsletterSignup'\n\nexport const schema: Aglyn.ComponentSchema<NewsletterSignupProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Newsletter signup',\n description: 'A consented email capture that writes straight into contacts.',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiEmailOutline.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 field.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'buttonLabel',\n label: 'Button label',\n description: 'Defaults to \"Subscribe\".',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'successText',\n label: 'Success text',\n description: 'Shown after subscribing.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'listId',\n label: 'List',\n description:\n 'Optional — enrolls subscribers into this list too (id from Audiences → Lists). Blank keeps the old contacts-only behavior.',\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: 'Newsletter signup',\n pluginId: BUNDLE_ID,\n description: 'Consented email capture into contacts',\n category: Aglyn.ComponentCategory.COMMERCE,\n icon: { path: mdiEmailOutline.path, sx: { color: '#2e7d32' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { heading: 'Get updates and offers' },\n },\n },\n]\n\nexport default NewsletterSignup\n"],"names":["trackEvent","campaignTouchField","Aglyn","mdiEmailOutline","Box","Button","TextField","Typography","forwardRef","useState","BUNDLE_ID","generatePresetId","ID","NewsletterSignup","props","ref","heading","buttonLabel","successText","listId","rest","nodeSx","Array","isArray","hostId","useSite","siteFetch","useSiteFetch","email","setEmail","state","setState","handleSubscribe","response","method","headers","body","JSON","stringify","ok","form_name","form_location","window","location","pathname","sx","py","variant","component","gutterBottom","display","gap","type","placeholder","slotProps","htmlInput","value","onChange","event","target","size","flex","maxWidth","error","helperText","undefined","color","disabled","trim","onClick","displayName","schema","$id","pluginId","description","category","ComponentCategory","COMMERCE","icon","path","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","label","FieldComponentType","TEXT_FIELD","presets","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,QAAQ,0CAAyC;AACpE,SAASC,kBAAkB,QAAQ,wCAAuC;AAC1E,YAAYC,WAAW,eAAc;AACrC,SAASC,eAAe,QAAQ,yBAAwB;AACxD,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAC5C,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,oBAAmB;AAexD;;;;CAIC,GACD,MAAMC,iCAAmBL,WACvB,CAACM,OAAOC;IACN,MAAM,EAAEC,OAAO,EAAEC,WAAW,EAAEC,WAAW,EAAEC,MAAM,EAAW,GAAGL,OAATM,wCAASN;;;;;;IAC/D,yEAAyE;IACzE,MAAMO,SAASC,MAAMC,OAAO,CAACT,KAAK,CAAC,KAAK,IAAIA,KAAK,CAAC,KAAK,GAAG;QAACA,KAAK,CAAC,KAAK;KAAC;IACvE,MAAM,EAAEU,MAAM,EAAE,GAAGtB,MAAMuB,OAAO;I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D;AACH,EAAC;AAED,OAAO,MAAMC,UAAgC;IAC3C;QACEjB,KAAK7D,iBAAiBC;QACtBwC,MAAMlD,MAAMwF,QAAQ,CAACC,MAAM;QAC3BrB,aAAa;QACbG,UAAU/D;QACVgE,aAAa;QACbC,UAAUzE,MAAM0E,iBAAiB,CAACC,QAAQ;QAC1CC,MAAM;YAAEC,MAAM5E,gBAAgB4E,IAAI;YAAElC,IAAI;gBAAEqB,OAAO;YAAU;QAAE;QAC7D0B,MAAM;YACJpB,KAAK;YACLqB,aAAajF;YACb6D,UAAU/D;YACVI,OAAO;gBAAEE,SAAS;YAAyB;QAC7C;IACF;CACD,CAAA;AAED,eAAeH,iBAAgB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 ProductDetailProps {
|
|
20
|
+
/** Product slug; blank resolves from /products/{slug} in the URL. */
|
|
21
|
+
slug?: string;
|
|
22
|
+
buyLabel?: string;
|
|
23
|
+
/** Hide the description block (design it separately with tokens). */
|
|
24
|
+
hideDescription?: boolean;
|
|
25
|
+
/** Offer a discount/coupon code field before the buy button. */
|
|
26
|
+
showCoupon?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Product detail block (AGL-292): gallery, option pickers that resolve
|
|
30
|
+
* the variant (price/media/stock follow), quantity, and a buy button
|
|
31
|
+
* that charges through the server-priced checkout with the selected
|
|
32
|
+
* variant. Resolves its product from the /products/{slug} URL unless a
|
|
33
|
+
* slug prop pins it; sample data on the inert canvas.
|
|
34
|
+
*/
|
|
35
|
+
declare const ProductDetail: import("react").ForwardRefExoticComponent<ProductDetailProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export declare const schema: Aglyn.ComponentSchema<ProductDetailProps>;
|
|
37
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
38
|
+
export default ProductDetail;
|