@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,851 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2026 Aglyn LLC
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
21
|
+
import { buildBeginCheckoutParams, buildViewCartParams, trackEvent, trackEventBeforeNavigation } from "@aglyn/aglyn/app-utils/analytics-events";
|
|
22
|
+
import { isPaymentsNotConfigured, storefrontPaymentsNotConfiguredText } from "@aglyn/aglyn/app-utils/payments-configured";
|
|
23
|
+
import * as CommerceModel from "../model/index.js";
|
|
24
|
+
import { mdiCartOutline } from "@aglyn/shared-data-mdi";
|
|
25
|
+
import Alert from "@mui/material/Alert";
|
|
26
|
+
import Badge from "@mui/material/Badge";
|
|
27
|
+
import Box from "@mui/material/Box";
|
|
28
|
+
import Button from "@mui/material/Button";
|
|
29
|
+
import Checkbox from "@mui/material/Checkbox";
|
|
30
|
+
import Drawer from "@mui/material/Drawer";
|
|
31
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
32
|
+
import IconButton from "@mui/material/IconButton";
|
|
33
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
34
|
+
import SvgIcon from "@mui/material/SvgIcon";
|
|
35
|
+
import TextField from "@mui/material/TextField";
|
|
36
|
+
import Typography from "@mui/material/Typography";
|
|
37
|
+
import { Suspense, forwardRef, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
38
|
+
import { StorefrontPaymentElementFallback } from "./storefront-payment-element-fallback.js";
|
|
39
|
+
/**
|
|
40
|
+
* The Payment Element (AGL-1944), lazily. Stripe.js and its React wrapper are
|
|
41
|
+
* a large dependency and the flag is OFF, so a static import would ship the
|
|
42
|
+
* whole SDK in the bundle of every page carrying a cart — which is most pages
|
|
43
|
+
* on a storefront — to serve a path no shopper currently reaches.
|
|
44
|
+
*/ const StorefrontPaymentElement = /*#__PURE__*/ lazy(()=>import("./storefront-payment-element.js").then((module)=>({
|
|
45
|
+
default: module.StorefrontPaymentElement
|
|
46
|
+
})));
|
|
47
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
48
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
49
|
+
import { useStorefrontPurchaseEvent } from "../utils/use-storefront-purchase-event.js";
|
|
50
|
+
// Component ids are persisted in screen documents; never rename.
|
|
51
|
+
export const ID = 'cart';
|
|
52
|
+
/** Blocks dispatch this after mutating the cart so badges refresh. */ export const CART_UPDATED_EVENT = 'aglyn:cart-updated';
|
|
53
|
+
const usd = (cents)=>`$${(cents / 100).toFixed(2)}`;
|
|
54
|
+
/**
|
|
55
|
+
* The cart's lines as GA4 `items`.
|
|
56
|
+
*
|
|
57
|
+
* One mapping for every event this file sends — `view_cart` and both
|
|
58
|
+
* `begin_checkout` branches — because the `item_id` is what joins them into a
|
|
59
|
+
* single per-product funnel with the `view_item` and `add_to_cart` the product
|
|
60
|
+
* blocks send. Three hand-written copies of the same map are three chances for
|
|
61
|
+
* one step to start reporting a variant id, or a name, or a different price
|
|
62
|
+
* basis, and a funnel whose steps disagree about the product silently reports
|
|
63
|
+
* a drop that never happened.
|
|
64
|
+
*/ function cartAnalyticsItems(cart) {
|
|
65
|
+
var _ref;
|
|
66
|
+
return ((_ref = cart == null ? void 0 : cart.lines) != null ? _ref : []).map((line)=>({
|
|
67
|
+
item_id: line.productId,
|
|
68
|
+
item_name: line.name,
|
|
69
|
+
price: line.unitAmountCents / 100,
|
|
70
|
+
quantity: line.quantity
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function CartLines(props) {
|
|
74
|
+
const { hostId, cart, showCoupon, checkoutLabel, emptyText, onMutate } = props;
|
|
75
|
+
const siteFetch = Aglyn.useSiteFetch();
|
|
76
|
+
const [coupon, setCoupon] = useState('');
|
|
77
|
+
const [email, setEmail] = useState('');
|
|
78
|
+
const [optIn, setOptIn] = useState(false);
|
|
79
|
+
const [giftCard, setGiftCard] = useState('');
|
|
80
|
+
// Where the parcel is going (AGL-1721). Asked ONLY when the server says it
|
|
81
|
+
// cannot price shipping without it — a merchant with one zone, one
|
|
82
|
+
// rest-of-world zone, or no shipping at all never sees this field, which is
|
|
83
|
+
// the common configuration. `null` is "not asked", so the field appearing is
|
|
84
|
+
// itself the server's answer rather than a guess made here.
|
|
85
|
+
const [shipTo, setShipTo] = useState('');
|
|
86
|
+
const [shipCountries, setShipCountries] = useState(null);
|
|
87
|
+
// `paused` is its own state, not an `error` with gentler words (AGL-1511):
|
|
88
|
+
// the two need different severities, and a shopper told in red that
|
|
89
|
+
// checkout failed does not read the sentence explaining it did not. `ask` is
|
|
90
|
+
// the same argument again: being asked for a destination is not a failure.
|
|
91
|
+
// `unconfigured` is the third instance (AGL-2019): a store with no Stripe key
|
|
92
|
+
// answers 501, and before this that fell through to the error tail below and
|
|
93
|
+
// rendered RED. It is also the only one of the five that is TERMINAL — the
|
|
94
|
+
// others can succeed on a retry, this one cannot until the operator acts, so
|
|
95
|
+
// it latches the buy control off instead of inviting another click.
|
|
96
|
+
const [status, setStatus] = useState('idle');
|
|
97
|
+
const [message, setMessage] = useState('');
|
|
98
|
+
/**
|
|
99
|
+
* The in-page checkout session (AGL-1944). Null unless the server chose
|
|
100
|
+
* native mode, which needs both the release flag and a publishable key.
|
|
101
|
+
*/ const [nativeCheckout, setNativeCheckout] = useState(null);
|
|
102
|
+
/**
|
|
103
|
+
* In-progress quantity edits, keyed by line, as the raw field text
|
|
104
|
+
* (AGL-1772). The field used to POST /api/commerce/cart on every
|
|
105
|
+
* keystroke — typing "100" was three Firestore writes, and clearing the
|
|
106
|
+
* field to retype passed through `""` → 0, which is the REMOVE path, so a
|
|
107
|
+
* select-all-and-retype could delete the line mid-edit (and the response
|
|
108
|
+
* replacing `cart` state then fought the input).
|
|
109
|
+
*
|
|
110
|
+
* The repo convention for quantity inputs is local state committed on an
|
|
111
|
+
* explicit settle — the PDP's Qty field (product-detail.tsx) holds
|
|
112
|
+
* `useState` and sends nothing until the buy click, and besigner
|
|
113
|
+
* attributes commit on blur. So: keystrokes only edit the draft; blur or
|
|
114
|
+
* Enter commits ONE write; an empty or unparsable draft is a pending
|
|
115
|
+
* state that reverts to the server's quantity, never a 0-as-remove. A
|
|
116
|
+
* genuine remove still works both ways — the ✕ button, and typing an
|
|
117
|
+
* actual 0 then leaving the field.
|
|
118
|
+
*/ const [quantityDrafts, setQuantityDrafts] = useState({});
|
|
119
|
+
const lineKey = (line)=>{
|
|
120
|
+
var _line_variantId;
|
|
121
|
+
return `${line.productId}:${(_line_variantId = line.variantId) != null ? _line_variantId : ''}`;
|
|
122
|
+
};
|
|
123
|
+
const commitQuantity = (line)=>{
|
|
124
|
+
const key = lineKey(line);
|
|
125
|
+
const draft = quantityDrafts[key];
|
|
126
|
+
if (draft === undefined) return;
|
|
127
|
+
// Drops the draft, but only if it is still THIS one — a keystroke that
|
|
128
|
+
// lands while the write is in flight starts a new edit, and clearing it
|
|
129
|
+
// here would erase what the shopper is typing.
|
|
130
|
+
const settle = ()=>setQuantityDrafts((drafts)=>{
|
|
131
|
+
if (drafts[key] !== draft) return drafts;
|
|
132
|
+
const { [key]: _settled } = drafts, rest = _object_without_properties_loose(drafts, [
|
|
133
|
+
_to_property_key(key)
|
|
134
|
+
]);
|
|
135
|
+
return rest;
|
|
136
|
+
});
|
|
137
|
+
// `Number('')` is 0 — exactly the misreading that turned a cleared
|
|
138
|
+
// field into a remove. Empty means "no answer": show the server's
|
|
139
|
+
// quantity again and write nothing. NaN (letters) reverts the same way.
|
|
140
|
+
if (draft.trim() === '') return settle();
|
|
141
|
+
const parsed = Math.round(Number(draft));
|
|
142
|
+
if (!Number.isFinite(parsed)) return settle();
|
|
143
|
+
const quantity = Math.max(0, parsed);
|
|
144
|
+
// A settled value equal to the server's is not an edit.
|
|
145
|
+
if (quantity === line.quantity) return settle();
|
|
146
|
+
// The draft keeps rendering until the response lands, so the field does
|
|
147
|
+
// not flash the superseded quantity during the round-trip; the server's
|
|
148
|
+
// answer (via the replaced `cart`) takes over when it arrives.
|
|
149
|
+
void onMutate({
|
|
150
|
+
action: 'set',
|
|
151
|
+
productId: line.productId,
|
|
152
|
+
variantId: line.variantId,
|
|
153
|
+
quantity
|
|
154
|
+
}).finally(settle);
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Idempotency key for ONE checkout attempt (AGL-1697).
|
|
158
|
+
*
|
|
159
|
+
* Minted lazily on the first checkout click, retired whenever the attempt
|
|
160
|
+
* changes shape — different lines, codes, email or destination are a
|
|
161
|
+
* different checkout. Keyed off a CONTENT signature of the lines rather
|
|
162
|
+
* than the `cart` object, whose identity changes on every refetch: retiring
|
|
163
|
+
* on identity would hand a genuine retry a fresh key, which is exactly the
|
|
164
|
+
* double-session this exists to prevent.
|
|
165
|
+
*/ const attemptKey = useRef('');
|
|
166
|
+
const cartSignature = useMemo(()=>{
|
|
167
|
+
var _ref;
|
|
168
|
+
return JSON.stringify(((_ref = cart == null ? void 0 : cart.lines) != null ? _ref : []).map((line)=>{
|
|
169
|
+
var _line_variantId;
|
|
170
|
+
return [
|
|
171
|
+
line.productId,
|
|
172
|
+
(_line_variantId = line.variantId) != null ? _line_variantId : '',
|
|
173
|
+
line.quantity
|
|
174
|
+
];
|
|
175
|
+
}));
|
|
176
|
+
}, [
|
|
177
|
+
cart
|
|
178
|
+
]);
|
|
179
|
+
useEffect(()=>{
|
|
180
|
+
attemptKey.current = '';
|
|
181
|
+
}, [
|
|
182
|
+
cartSignature,
|
|
183
|
+
email,
|
|
184
|
+
coupon,
|
|
185
|
+
giftCard,
|
|
186
|
+
shipTo
|
|
187
|
+
]);
|
|
188
|
+
const handleCheckout = useCallback(async ()=>{
|
|
189
|
+
if (status === 'sending') return;
|
|
190
|
+
setStatus('sending');
|
|
191
|
+
setMessage('');
|
|
192
|
+
if (!attemptKey.current) {
|
|
193
|
+
var _ref;
|
|
194
|
+
var _globalThis_crypto_randomUUID, _globalThis_crypto;
|
|
195
|
+
attemptKey.current = (_ref = (_globalThis_crypto = globalThis.crypto) == null ? void 0 : (_globalThis_crypto_randomUUID = _globalThis_crypto.randomUUID) == null ? void 0 : _globalThis_crypto_randomUUID.call(_globalThis_crypto)) != null ? _ref : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
var _ref1;
|
|
199
|
+
const response = await siteFetch('/api/commerce/cart-checkout', {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
headers: {
|
|
202
|
+
'Content-Type': 'application/json',
|
|
203
|
+
// Stable across a retry of THIS attempt (AGL-1697), so a
|
|
204
|
+
// double-click cannot spawn a second session from one cart.
|
|
205
|
+
'Idempotency-Key': attemptKey.current
|
|
206
|
+
},
|
|
207
|
+
body: JSON.stringify(_extends({
|
|
208
|
+
hostId
|
|
209
|
+
}, email.trim() ? {
|
|
210
|
+
email: email.trim()
|
|
211
|
+
} : {}, optIn ? {
|
|
212
|
+
marketingOptIn: true
|
|
213
|
+
} : {}, coupon.trim() ? {
|
|
214
|
+
couponCode: coupon.trim()
|
|
215
|
+
} : {}, giftCard.trim() ? {
|
|
216
|
+
giftCardCode: giftCard.trim()
|
|
217
|
+
} : {}, shipTo ? {
|
|
218
|
+
shippingCountry: shipTo
|
|
219
|
+
} : {}))
|
|
220
|
+
});
|
|
221
|
+
const payload = await response.json().catch(()=>({}));
|
|
222
|
+
// In-page payment (AGL-1944). Checked BEFORE the redirect branch: a
|
|
223
|
+
// native session carries a client secret and no url, and if a server ever
|
|
224
|
+
// sent both, navigating away would silently discard the form.
|
|
225
|
+
//
|
|
226
|
+
// `begin_checkout` is reported on BOTH paths, and from the same place, so
|
|
227
|
+
// the GA4 funnel does not develop a hole the day the flag flips — a
|
|
228
|
+
// storefront whose `begin_checkout` count halved would look like a
|
|
229
|
+
// conversion collapse rather than a checkout that stopped redirecting.
|
|
230
|
+
if (response.ok && (payload == null ? void 0 : payload.clientSecret) && (payload == null ? void 0 : payload.publishableKey)) {
|
|
231
|
+
var _ref2;
|
|
232
|
+
trackEvent('begin_checkout', buildBeginCheckoutParams({
|
|
233
|
+
value: ((_ref2 = cart == null ? void 0 : cart.subtotalCents) != null ? _ref2 : 0) / 100,
|
|
234
|
+
items: cartAnalyticsItems(cart)
|
|
235
|
+
}));
|
|
236
|
+
setNativeCheckout({
|
|
237
|
+
clientSecret: String(payload.clientSecret),
|
|
238
|
+
publishableKey: String(payload.publishableKey)
|
|
239
|
+
});
|
|
240
|
+
setStatus('idle');
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (response.ok && (payload == null ? void 0 : payload.url)) {
|
|
244
|
+
var _ref3;
|
|
245
|
+
// GA4 checkout funnel (AGL-1561, converted by AGL-1591). This used to
|
|
246
|
+
// call `window.gtag` raw with `value`/`currency` only, so the same
|
|
247
|
+
// event name arrived from this surface and from the console's plan
|
|
248
|
+
// checkout in two different shapes — and this half carried no `items`,
|
|
249
|
+
// which is the field GA4's ecommerce funnel is actually built on.
|
|
250
|
+
//
|
|
251
|
+
// The item ids are the PRODUCT ids `view_item` and `add_to_cart`
|
|
252
|
+
// already send, so the three now join into one per-product funnel.
|
|
253
|
+
// `value` is stated rather than derived because the cart subtotal is
|
|
254
|
+
// authoritative after a coupon or gift card, which the line prices
|
|
255
|
+
// below are not. No `billing_interval`: a storefront cart is not a
|
|
256
|
+
// subscription.
|
|
257
|
+
//
|
|
258
|
+
// AWAITED before the redirect (AGL-1580). This surface registers no
|
|
259
|
+
// transport, so delivery is a synchronous `window.gtag` call and the
|
|
260
|
+
// await resolves immediately — a storefront checkout is not slowed by
|
|
261
|
+
// one microtask. It is written this way anyway because the property
|
|
262
|
+
// that makes it safe is invisible from here: the day this bundle grows
|
|
263
|
+
// an async transport, or a host registers one for it, the bare call
|
|
264
|
+
// would start losing the event on exactly the branch that navigates,
|
|
265
|
+
// and nothing at this call site would look different.
|
|
266
|
+
await trackEventBeforeNavigation('begin_checkout', buildBeginCheckoutParams({
|
|
267
|
+
value: ((_ref3 = cart == null ? void 0 : cart.subtotalCents) != null ? _ref3 : 0) / 100,
|
|
268
|
+
items: cartAnalyticsItems(cart)
|
|
269
|
+
}));
|
|
270
|
+
window.location.assign(payload.url);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
// A read-only lockdown answers 423 with the visitor pause copy
|
|
274
|
+
// (AGL-1511). Rendering `payload.error` here would print the wire
|
|
275
|
+
// token "locked" at a shopper, and the `severity="error"` styling
|
|
276
|
+
// would tell them their payment failed — the one thing this copy
|
|
277
|
+
// exists to never say. So the refusal is parsed and shown as a calm
|
|
278
|
+
// notice instead.
|
|
279
|
+
const paused = Aglyn.parseLockdownRefusal(response.status, payload);
|
|
280
|
+
if (paused) {
|
|
281
|
+
setMessage(Aglyn.lockdownRefusalText(paused));
|
|
282
|
+
setStatus('paused');
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// A store that never had payments configured (AGL-2019). The server's
|
|
286
|
+
// own words are NOT rendered here even though they are safe today:
|
|
287
|
+
// this is a visitor-facing surface, the 501 bodies differ between the
|
|
288
|
+
// cart and buy-now doors, and one of them could grow a variable name
|
|
289
|
+
// without anyone thinking about who reads it.
|
|
290
|
+
if (isPaymentsNotConfigured(response.status)) {
|
|
291
|
+
setMessage(storefrontPaymentsNotConfiguredText());
|
|
292
|
+
setStatus('unconfigured');
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
// The merchant's rates differ by destination, so the server will not
|
|
296
|
+
// price this cart until it knows one (AGL-1721). Reveal the field and
|
|
297
|
+
// let the shopper answer; a store that never sends this never shows it.
|
|
298
|
+
if (payload == null ? void 0 : payload.needsShippingCountry) {
|
|
299
|
+
var _ref4;
|
|
300
|
+
var _payload_shippingCountries;
|
|
301
|
+
setShipCountries(((_payload_shippingCountries = payload.shippingCountries) == null ? void 0 : _payload_shippingCountries.length) ? payload.shippingCountries : [
|
|
302
|
+
...CommerceModel.CHECKOUT_SHIPPING_COUNTRIES
|
|
303
|
+
]);
|
|
304
|
+
setMessage(String((_ref4 = payload == null ? void 0 : payload.error) != null ? _ref4 : ''));
|
|
305
|
+
// An unserved destination is a real refusal and reads as one; being
|
|
306
|
+
// asked the first time is not.
|
|
307
|
+
setStatus(shipTo ? 'error' : 'ask');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
setMessage(String((_ref1 = payload == null ? void 0 : payload.error) != null ? _ref1 : ''));
|
|
311
|
+
setStatus('error');
|
|
312
|
+
} catch (unused) {
|
|
313
|
+
setStatus('error');
|
|
314
|
+
}
|
|
315
|
+
// `cart` is a dependency because the payload above reads it: without it
|
|
316
|
+
// the handler closes over whichever cart was current when it was created,
|
|
317
|
+
// and a checkout started after a quantity change would report the OLD
|
|
318
|
+
// subtotal and the OLD lines. The pre-AGL-1591 raw call had the same bug
|
|
319
|
+
// in the `value` alone, where a wrong number is indistinguishable from a
|
|
320
|
+
// right one.
|
|
321
|
+
}, [
|
|
322
|
+
hostId,
|
|
323
|
+
cart,
|
|
324
|
+
coupon,
|
|
325
|
+
email,
|
|
326
|
+
optIn,
|
|
327
|
+
giftCard,
|
|
328
|
+
shipTo,
|
|
329
|
+
status,
|
|
330
|
+
siteFetch
|
|
331
|
+
]);
|
|
332
|
+
if (!cart || cart.lines.length === 0) {
|
|
333
|
+
return /*#__PURE__*/ _jsx(Typography, {
|
|
334
|
+
variant: "body2",
|
|
335
|
+
color: "text.secondary",
|
|
336
|
+
sx: {
|
|
337
|
+
p: 2
|
|
338
|
+
},
|
|
339
|
+
children: emptyText || 'Your cart is empty.'
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
343
|
+
sx: {
|
|
344
|
+
display: 'flex',
|
|
345
|
+
flexDirection: 'column',
|
|
346
|
+
gap: 1.5,
|
|
347
|
+
p: 2
|
|
348
|
+
},
|
|
349
|
+
children: [
|
|
350
|
+
cart.lines.map((line)=>{
|
|
351
|
+
var _quantityDrafts_lineKey, _line_variantId;
|
|
352
|
+
// AGL-1726: resolve BEFORE the guard, never inside the `src`. A
|
|
353
|
+
// stored value can be truthy and still resolve to nothing (a
|
|
354
|
+
// malformed `media:` reference), and testing the raw string would
|
|
355
|
+
// turn "no image" into an `<img>` with no `src` — a broken-image
|
|
356
|
+
// icon where the placeholder belongs.
|
|
357
|
+
const imageUrl = Aglyn.siteRelativeMediaSrc(line.imageUrl, {
|
|
358
|
+
hostId
|
|
359
|
+
});
|
|
360
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
361
|
+
sx: {
|
|
362
|
+
display: 'flex',
|
|
363
|
+
gap: 1.5,
|
|
364
|
+
alignItems: 'center'
|
|
365
|
+
},
|
|
366
|
+
children: [
|
|
367
|
+
imageUrl ? /*#__PURE__*/ _jsx(Box, _extends({
|
|
368
|
+
component: "img",
|
|
369
|
+
src: imageUrl,
|
|
370
|
+
alt: "",
|
|
371
|
+
sx: {
|
|
372
|
+
width: 48,
|
|
373
|
+
height: 48,
|
|
374
|
+
objectFit: 'cover',
|
|
375
|
+
borderRadius: 1
|
|
376
|
+
}
|
|
377
|
+
}, Aglyn.DEFERRED_IMAGE_ATTRIBUTES)) : /*#__PURE__*/ _jsx(Box, {
|
|
378
|
+
sx: {
|
|
379
|
+
width: 48,
|
|
380
|
+
height: 48,
|
|
381
|
+
bgcolor: 'action.hover',
|
|
382
|
+
borderRadius: 1
|
|
383
|
+
}
|
|
384
|
+
}),
|
|
385
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
386
|
+
sx: {
|
|
387
|
+
flex: 1,
|
|
388
|
+
minWidth: 0
|
|
389
|
+
},
|
|
390
|
+
children: [
|
|
391
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
392
|
+
variant: "body2",
|
|
393
|
+
noWrap: true,
|
|
394
|
+
children: [
|
|
395
|
+
line.name,
|
|
396
|
+
line.variantLabel ? ` — ${line.variantLabel}` : ''
|
|
397
|
+
]
|
|
398
|
+
}),
|
|
399
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
400
|
+
variant: "caption",
|
|
401
|
+
color: "text.secondary",
|
|
402
|
+
children: line.unavailable ? 'No longer available' : usd(line.unitAmountCents)
|
|
403
|
+
})
|
|
404
|
+
]
|
|
405
|
+
}),
|
|
406
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
407
|
+
value: (_quantityDrafts_lineKey = quantityDrafts[lineKey(line)]) != null ? _quantityDrafts_lineKey : line.quantity,
|
|
408
|
+
onChange: (event)=>setQuantityDrafts((drafts)=>_extends({}, drafts, {
|
|
409
|
+
[lineKey(line)]: event.target.value
|
|
410
|
+
})),
|
|
411
|
+
onBlur: ()=>commitQuantity(line),
|
|
412
|
+
onKeyDown: (event)=>{
|
|
413
|
+
if (event.key === 'Enter') commitQuantity(line);
|
|
414
|
+
},
|
|
415
|
+
size: "small",
|
|
416
|
+
sx: {
|
|
417
|
+
width: 60
|
|
418
|
+
},
|
|
419
|
+
slotProps: {
|
|
420
|
+
htmlInput: {
|
|
421
|
+
inputMode: 'numeric'
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}),
|
|
425
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
426
|
+
size: "small",
|
|
427
|
+
color: "error",
|
|
428
|
+
onClick: ()=>void onMutate({
|
|
429
|
+
action: 'remove',
|
|
430
|
+
productId: line.productId,
|
|
431
|
+
variantId: line.variantId
|
|
432
|
+
}),
|
|
433
|
+
children: '✕'
|
|
434
|
+
})
|
|
435
|
+
]
|
|
436
|
+
}, `${line.productId}:${(_line_variantId = line.variantId) != null ? _line_variantId : ''}`);
|
|
437
|
+
}),
|
|
438
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
439
|
+
sx: {
|
|
440
|
+
display: 'flex',
|
|
441
|
+
justifyContent: 'space-between'
|
|
442
|
+
},
|
|
443
|
+
children: [
|
|
444
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
445
|
+
variant: "subtitle2",
|
|
446
|
+
children: 'Subtotal'
|
|
447
|
+
}),
|
|
448
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
449
|
+
variant: "subtitle2",
|
|
450
|
+
children: usd(cart.subtotalCents)
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
}),
|
|
454
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
455
|
+
variant: "caption",
|
|
456
|
+
color: "text.secondary",
|
|
457
|
+
children: 'Shipping and taxes are calculated at checkout.'
|
|
458
|
+
}),
|
|
459
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
460
|
+
label: "Email",
|
|
461
|
+
type: "email",
|
|
462
|
+
value: email,
|
|
463
|
+
onChange: (event)=>setEmail(event.target.value),
|
|
464
|
+
size: "small",
|
|
465
|
+
helperText: "For your receipt and order updates"
|
|
466
|
+
}),
|
|
467
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
468
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
469
|
+
size: "small",
|
|
470
|
+
checked: optIn,
|
|
471
|
+
onChange: (event)=>setOptIn(event.target.checked)
|
|
472
|
+
}),
|
|
473
|
+
label: /*#__PURE__*/ _jsx(Typography, {
|
|
474
|
+
variant: "caption",
|
|
475
|
+
children: 'Email me news and offers'
|
|
476
|
+
})
|
|
477
|
+
}),
|
|
478
|
+
showCoupon ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
479
|
+
children: [
|
|
480
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
481
|
+
label: "Coupon code",
|
|
482
|
+
value: coupon,
|
|
483
|
+
onChange: (event)=>setCoupon(event.target.value),
|
|
484
|
+
size: "small"
|
|
485
|
+
}),
|
|
486
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
487
|
+
label: "Gift card",
|
|
488
|
+
value: giftCard,
|
|
489
|
+
onChange: (event)=>setGiftCard(event.target.value),
|
|
490
|
+
size: "small",
|
|
491
|
+
placeholder: "GC-…"
|
|
492
|
+
})
|
|
493
|
+
]
|
|
494
|
+
}) : null,
|
|
495
|
+
shipCountries ? /*#__PURE__*/ _jsx(TextField, {
|
|
496
|
+
select: true,
|
|
497
|
+
label: "Ship to",
|
|
498
|
+
value: shipTo,
|
|
499
|
+
onChange: (event)=>setShipTo(event.target.value),
|
|
500
|
+
size: "small",
|
|
501
|
+
helperText: "Shipping rates depend on where this is going",
|
|
502
|
+
children: shipCountries.map((code)=>{
|
|
503
|
+
var _CommerceModel_CHECKOUT_SHIPPING_COUNTRY_NAMES_code;
|
|
504
|
+
return /*#__PURE__*/ _jsx(MenuItem, {
|
|
505
|
+
value: code,
|
|
506
|
+
children: (_CommerceModel_CHECKOUT_SHIPPING_COUNTRY_NAMES_code = CommerceModel.CHECKOUT_SHIPPING_COUNTRY_NAMES[code]) != null ? _CommerceModel_CHECKOUT_SHIPPING_COUNTRY_NAMES_code : code
|
|
507
|
+
}, code);
|
|
508
|
+
})
|
|
509
|
+
}) : null,
|
|
510
|
+
status === 'paused' || status === 'ask' || status === 'unconfigured' ? /*#__PURE__*/ _jsx(Alert, {
|
|
511
|
+
severity: "info",
|
|
512
|
+
children: message
|
|
513
|
+
}) : null,
|
|
514
|
+
status === 'error' ? /*#__PURE__*/ _jsx(Alert, {
|
|
515
|
+
severity: "error",
|
|
516
|
+
children: message || 'Checkout is unavailable right now.'
|
|
517
|
+
}) : null,
|
|
518
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
519
|
+
variant: "contained",
|
|
520
|
+
color: "primary",
|
|
521
|
+
disabled: status === 'sending' || cart.lines.every((line)=>line.unavailable) || // No payments on this deployment: every further click gets the same
|
|
522
|
+
// 501, so the control latches off rather than inviting a retry that
|
|
523
|
+
// cannot succeed (AGL-2019).
|
|
524
|
+
status === 'unconfigured' || // Asked but unanswered: the server would only refuse again.
|
|
525
|
+
shipCountries !== null && !shipTo,
|
|
526
|
+
onClick: handleCheckout,
|
|
527
|
+
children: status === 'sending' ? // place (AGL-1944).
|
|
528
|
+
nativeCheckout ? 'Opening…' : 'Redirecting…' : checkoutLabel || 'Checkout'
|
|
529
|
+
}),
|
|
530
|
+
nativeCheckout ? /*#__PURE__*/ _jsx(Suspense, {
|
|
531
|
+
fallback: /*#__PURE__*/ _jsx(StorefrontPaymentElementFallback, {}),
|
|
532
|
+
children: /*#__PURE__*/ _jsx(StorefrontPaymentElement, {
|
|
533
|
+
clientSecret: nativeCheckout.clientSecret,
|
|
534
|
+
publishableKey: nativeCheckout.publishableKey,
|
|
535
|
+
payLabel: checkoutLabel || 'Pay now',
|
|
536
|
+
// The session is left open on cancel, deliberately: it is what the
|
|
537
|
+
// AGL-323 abandoned-cart recovery emails are built on, and expiring
|
|
538
|
+
// it would be a write against the merchant's Stripe account made
|
|
539
|
+
// from a browser.
|
|
540
|
+
onCancel: ()=>setNativeCheckout(null)
|
|
541
|
+
})
|
|
542
|
+
}) : null
|
|
543
|
+
]
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Cart block (AGL-293): 'button' renders a badge icon + slide-out
|
|
548
|
+
* drawer for app bars; 'inline' renders the full cart for a cart page.
|
|
549
|
+
* Lines live server-side (cookie cart); every mutation re-resolves
|
|
550
|
+
* prices. Other blocks broadcast CART_UPDATED_EVENT to refresh badges.
|
|
551
|
+
*/ const Cart = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
552
|
+
var _ref;
|
|
553
|
+
const { variant, checkoutLabel, showCoupon, emptyText } = props, rest = _object_without_properties_loose(props, [
|
|
554
|
+
"variant",
|
|
555
|
+
"checkoutLabel",
|
|
556
|
+
"showCoupon",
|
|
557
|
+
"emptyText"
|
|
558
|
+
]);
|
|
559
|
+
// Node styles ride the renderer-merged sx; recompose (stack.ts pattern).
|
|
560
|
+
const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [
|
|
561
|
+
props['sx']
|
|
562
|
+
];
|
|
563
|
+
const { hostId } = Aglyn.useSite();
|
|
564
|
+
const siteFetch = Aglyn.useSiteFetch();
|
|
565
|
+
const [cart, setCart] = useState(null);
|
|
566
|
+
const [open, setOpen] = useState(false);
|
|
567
|
+
// Closes the merchant's ecommerce funnel (AGL-1641). Stripe returns a cart
|
|
568
|
+
// checkout to the page it started on — this one — so the `purchase` that
|
|
569
|
+
// `begin_checkout` above has never had a counterpart to is reported here.
|
|
570
|
+
// No-ops on every ordinary render: the hook returns immediately unless the
|
|
571
|
+
// URL carries `?order=success&session_id=…`.
|
|
572
|
+
useStorefrontPurchaseEvent(hostId, siteFetch);
|
|
573
|
+
const refresh = useCallback(async ()=>{
|
|
574
|
+
if (!hostId) return;
|
|
575
|
+
try {
|
|
576
|
+
const response = await fetch(`/api/commerce/cart?hostId=${encodeURIComponent(hostId)}`);
|
|
577
|
+
if (response.ok) setCart(await response.json());
|
|
578
|
+
} catch (unused) {
|
|
579
|
+
// Badge silently stays stale offline.
|
|
580
|
+
}
|
|
581
|
+
}, [
|
|
582
|
+
hostId
|
|
583
|
+
]);
|
|
584
|
+
useEffect(()=>{
|
|
585
|
+
void refresh();
|
|
586
|
+
const handler = ()=>void refresh();
|
|
587
|
+
window.addEventListener(CART_UPDATED_EVENT, handler);
|
|
588
|
+
return ()=>window.removeEventListener(CART_UPDATED_EVENT, handler);
|
|
589
|
+
}, [
|
|
590
|
+
refresh
|
|
591
|
+
]);
|
|
592
|
+
/**
|
|
593
|
+
* Has THIS opening of the cart already been reported? A drawer that is
|
|
594
|
+
* closed and reopened is a second view; a re-render, a badge refresh or a
|
|
595
|
+
* quantity edit inside an already-open drawer is not.
|
|
596
|
+
*/ const viewReported = useRef(false);
|
|
597
|
+
/**
|
|
598
|
+
* `view_cart` — the funnel step between `add_to_cart` and `begin_checkout`.
|
|
599
|
+
*
|
|
600
|
+
* Fired on the cart being SEEN, which is why it hangs off `open` rather off
|
|
601
|
+
* mount: the button variant renders a badge on every page of a storefront,
|
|
602
|
+
* and reporting a view there would have made "opened the cart" a synonym for
|
|
603
|
+
* "loaded a page" and the checkout rate a fraction of pageviews.
|
|
604
|
+
*
|
|
605
|
+
* Deferred until the lines have actually arrived. The cart is fetched, so a
|
|
606
|
+
* drawer opened while that request is in flight has nothing to describe yet
|
|
607
|
+
* — reporting then would send an empty `items` and a zero `value` for a cart
|
|
608
|
+
* that in fact had both. An empty cart never reports at all: there is no
|
|
609
|
+
* view of nothing, and counting it would put every idle badge click into the
|
|
610
|
+
* denominator of the checkout rate.
|
|
611
|
+
*/ useEffect(()=>{
|
|
612
|
+
const onScreen = variant === 'inline' || open;
|
|
613
|
+
if (!onScreen) {
|
|
614
|
+
viewReported.current = false;
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (viewReported.current || !cart || cart.lines.length === 0) return;
|
|
618
|
+
viewReported.current = true;
|
|
619
|
+
trackEvent('view_cart', buildViewCartParams({
|
|
620
|
+
// The server's subtotal, so this and the `begin_checkout` the same
|
|
621
|
+
// cart sends describe one cart at one size.
|
|
622
|
+
value: cart.subtotalCents / 100,
|
|
623
|
+
items: cartAnalyticsItems(cart)
|
|
624
|
+
}));
|
|
625
|
+
}, [
|
|
626
|
+
variant,
|
|
627
|
+
open,
|
|
628
|
+
cart
|
|
629
|
+
]);
|
|
630
|
+
const mutate = useCallback(async (body)=>{
|
|
631
|
+
if (!hostId) return;
|
|
632
|
+
const response = await siteFetch('/api/commerce/cart', {
|
|
633
|
+
method: 'POST',
|
|
634
|
+
headers: {
|
|
635
|
+
'Content-Type': 'application/json'
|
|
636
|
+
},
|
|
637
|
+
body: JSON.stringify(_extends({
|
|
638
|
+
hostId
|
|
639
|
+
}, body))
|
|
640
|
+
});
|
|
641
|
+
if (response.ok) {
|
|
642
|
+
setCart(await response.json());
|
|
643
|
+
window.dispatchEvent(new Event(CART_UPDATED_EVENT));
|
|
644
|
+
}
|
|
645
|
+
}, [
|
|
646
|
+
hostId,
|
|
647
|
+
siteFetch
|
|
648
|
+
]);
|
|
649
|
+
if (!hostId) {
|
|
650
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
651
|
+
ref: ref
|
|
652
|
+
}, rest, {
|
|
653
|
+
sx: [
|
|
654
|
+
{
|
|
655
|
+
p: variant === 'inline' ? 3 : 1,
|
|
656
|
+
border: '1px dashed',
|
|
657
|
+
borderColor: 'divider',
|
|
658
|
+
borderRadius: 1,
|
|
659
|
+
color: 'text.secondary',
|
|
660
|
+
fontSize: 13,
|
|
661
|
+
fontFamily: 'system-ui, sans-serif',
|
|
662
|
+
display: 'inline-block'
|
|
663
|
+
},
|
|
664
|
+
...nodeSx
|
|
665
|
+
],
|
|
666
|
+
children: variant === 'inline' ? 'Cart — lines render here' : '🛒 Cart'
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
669
|
+
if (variant === 'inline') {
|
|
670
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
671
|
+
ref: ref
|
|
672
|
+
}, rest, {
|
|
673
|
+
children: /*#__PURE__*/ _jsx(CartLines, {
|
|
674
|
+
hostId: hostId,
|
|
675
|
+
cart: cart,
|
|
676
|
+
showCoupon: showCoupon,
|
|
677
|
+
checkoutLabel: checkoutLabel,
|
|
678
|
+
emptyText: emptyText,
|
|
679
|
+
onMutate: mutate
|
|
680
|
+
})
|
|
681
|
+
}));
|
|
682
|
+
}
|
|
683
|
+
return /*#__PURE__*/ _jsxs(Box, _extends({
|
|
684
|
+
ref: ref
|
|
685
|
+
}, rest, {
|
|
686
|
+
sx: [
|
|
687
|
+
{
|
|
688
|
+
display: 'inline-flex'
|
|
689
|
+
},
|
|
690
|
+
...nodeSx
|
|
691
|
+
],
|
|
692
|
+
children: [
|
|
693
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
694
|
+
"aria-label": "Cart",
|
|
695
|
+
onClick: ()=>setOpen(true),
|
|
696
|
+
children: /*#__PURE__*/ _jsx(Badge, {
|
|
697
|
+
badgeContent: (_ref = cart == null ? void 0 : cart.count) != null ? _ref : 0,
|
|
698
|
+
color: "primary",
|
|
699
|
+
children: /*#__PURE__*/ _jsx(SvgIcon, {
|
|
700
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
701
|
+
d: mdiCartOutline.path
|
|
702
|
+
})
|
|
703
|
+
})
|
|
704
|
+
})
|
|
705
|
+
}),
|
|
706
|
+
/*#__PURE__*/ _jsx(Drawer, {
|
|
707
|
+
anchor: "right",
|
|
708
|
+
open: open,
|
|
709
|
+
onClose: ()=>setOpen(false),
|
|
710
|
+
children: /*#__PURE__*/ _jsxs(Box, {
|
|
711
|
+
sx: {
|
|
712
|
+
width: {
|
|
713
|
+
xs: '85vw',
|
|
714
|
+
sm: 380
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
children: [
|
|
718
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
719
|
+
variant: "h6",
|
|
720
|
+
sx: {
|
|
721
|
+
p: 2,
|
|
722
|
+
pb: 0
|
|
723
|
+
},
|
|
724
|
+
children: 'Your cart'
|
|
725
|
+
}),
|
|
726
|
+
/*#__PURE__*/ _jsx(CartLines, {
|
|
727
|
+
hostId: hostId,
|
|
728
|
+
cart: cart,
|
|
729
|
+
showCoupon: showCoupon,
|
|
730
|
+
checkoutLabel: checkoutLabel,
|
|
731
|
+
emptyText: emptyText,
|
|
732
|
+
onMutate: mutate
|
|
733
|
+
})
|
|
734
|
+
]
|
|
735
|
+
})
|
|
736
|
+
})
|
|
737
|
+
]
|
|
738
|
+
}));
|
|
739
|
+
});
|
|
740
|
+
Cart.displayName = 'AglynCart';
|
|
741
|
+
export const schema = {
|
|
742
|
+
$id: ID,
|
|
743
|
+
pluginId: BUNDLE_ID,
|
|
744
|
+
displayName: 'Cart',
|
|
745
|
+
description: 'The shopping cart — a badge icon with a slide-out drawer, or the full cart page.',
|
|
746
|
+
category: Aglyn.ComponentCategory.COMMERCE,
|
|
747
|
+
icon: {
|
|
748
|
+
path: mdiCartOutline.path,
|
|
749
|
+
sx: {
|
|
750
|
+
color: '#2e7d32'
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
flags: {
|
|
754
|
+
selfClosing: Aglyn.FEATURE_FLAG.ENABLED
|
|
755
|
+
},
|
|
756
|
+
attributes: [
|
|
757
|
+
{
|
|
758
|
+
name: 'variant',
|
|
759
|
+
label: 'Style',
|
|
760
|
+
description: 'Icon-with-drawer for app bars, or the full inline cart.',
|
|
761
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
762
|
+
options: [
|
|
763
|
+
{
|
|
764
|
+
value: 'button',
|
|
765
|
+
label: 'Icon + drawer'
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
value: 'inline',
|
|
769
|
+
label: 'Inline (cart page)'
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: 'checkoutLabel',
|
|
775
|
+
label: 'Checkout label',
|
|
776
|
+
description: 'Defaults to "Checkout".',
|
|
777
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
// The PROP KEY stays `showCoupon` — it is persisted in every saved page
|
|
781
|
+
// that uses this component, and renaming it would blank the control on
|
|
782
|
+
// all of them. Only what the merchant reads changes.
|
|
783
|
+
name: 'showCoupon',
|
|
784
|
+
// ONE CONTROL, TWO FEATURES, AND IT ONLY NAMED ONE. This checkbox gates
|
|
785
|
+
// the gift-card field as well as the coupon field, so a merchant who
|
|
786
|
+
// wanted gift cards had no reason to look here — gift cards are only
|
|
787
|
+
// redeemable in the cart, and this is the switch that shows the box.
|
|
788
|
+
// A control named for one feature that also gates another is how a
|
|
789
|
+
// shipped feature stays invisible.
|
|
790
|
+
label: 'Show coupon and gift card fields',
|
|
791
|
+
description: 'One checkbox for both. Coupon codes and gift cards are managed on ' + 'the Products page.',
|
|
792
|
+
component: Aglyn.FieldComponentType.CHECKBOX
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
name: 'emptyText',
|
|
796
|
+
label: 'Empty text',
|
|
797
|
+
description: 'Copy when the cart is empty.',
|
|
798
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
799
|
+
}
|
|
800
|
+
]
|
|
801
|
+
};
|
|
802
|
+
export const presets = [
|
|
803
|
+
{
|
|
804
|
+
$id: generatePresetId(ID, 'button'),
|
|
805
|
+
type: Aglyn.NodeType.PRESET,
|
|
806
|
+
displayName: 'Cart button',
|
|
807
|
+
pluginId: BUNDLE_ID,
|
|
808
|
+
description: 'Badge icon with a slide-out cart drawer',
|
|
809
|
+
category: Aglyn.ComponentCategory.COMMERCE,
|
|
810
|
+
icon: {
|
|
811
|
+
path: mdiCartOutline.path,
|
|
812
|
+
sx: {
|
|
813
|
+
color: '#2e7d32'
|
|
814
|
+
}
|
|
815
|
+
},
|
|
816
|
+
data: {
|
|
817
|
+
$id: null,
|
|
818
|
+
componentId: ID,
|
|
819
|
+
pluginId: BUNDLE_ID,
|
|
820
|
+
props: {
|
|
821
|
+
variant: 'button'
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
$id: generatePresetId(ID, 'inline'),
|
|
827
|
+
type: Aglyn.NodeType.PRESET,
|
|
828
|
+
displayName: 'Cart page',
|
|
829
|
+
pluginId: BUNDLE_ID,
|
|
830
|
+
description: 'Full cart with quantities, coupon, gift card, and checkout',
|
|
831
|
+
category: Aglyn.ComponentCategory.COMMERCE,
|
|
832
|
+
icon: {
|
|
833
|
+
path: mdiCartOutline.path,
|
|
834
|
+
sx: {
|
|
835
|
+
color: '#2e7d32'
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
data: {
|
|
839
|
+
$id: null,
|
|
840
|
+
componentId: ID,
|
|
841
|
+
pluginId: BUNDLE_ID,
|
|
842
|
+
props: {
|
|
843
|
+
variant: 'inline',
|
|
844
|
+
showCoupon: true
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
];
|
|
849
|
+
export default Cart;
|
|
850
|
+
|
|
851
|
+
//# sourceMappingURL=cart.js.map
|