@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,473 @@
|
|
|
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
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import * as CommerceModel from "../../model/index.js";
|
|
20
|
+
import { PLATFORM_BRAND_NAME } from "@aglyn/aglyn/app-utils/platform-brand";
|
|
21
|
+
import { CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
23
|
+
import { Alert, Button, Divider, FormControlLabel, MenuItem, Stack, Switch, TextField, Typography } from "@mui/material";
|
|
24
|
+
import { doc, setDoc } from "firebase/firestore";
|
|
25
|
+
import { useCallback, useState } from "react";
|
|
26
|
+
import { useFirestore } from "@aglyn/tenant-feature-instance";
|
|
27
|
+
import { useFirestoreDoc, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
|
|
28
|
+
import { pluginDocsHelp } from "@aglyn/aglyn";
|
|
29
|
+
/**
|
|
30
|
+
* Tax settings (AGL-285): manual per-region rates (most-specific wins)
|
|
31
|
+
* or Stripe Tax automatic calculation, stored on
|
|
32
|
+
* `hosts/{hostId}/settings/store` under `tax`. The legacy quick-buy
|
|
33
|
+
* checkout taxes by the store origin; Checkout v2 taxes by destination.
|
|
34
|
+
*/ export function TaxSettingsCard(props) {
|
|
35
|
+
var _ref, _current_mode, _ref1, _ref2, _current_rates, _flatPctProblem, _ref3, _flatPctProblem1, _ref4;
|
|
36
|
+
var _store_tax, _current_origin, _current_origin1, _current_lodging, _current_service;
|
|
37
|
+
const { hostId } = props;
|
|
38
|
+
const firestore = useFirestore();
|
|
39
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
40
|
+
const { data: store, status: storeStatus, /**
|
|
41
|
+
* The settings doc this form is seeded from is unconfirmed by the server
|
|
42
|
+
* (AGL-1358). `current` is `draft ?? store?.tax ?? {mode: 'manual'}` and
|
|
43
|
+
* the save writes `{tax: current}`, so `merge: true` protects the doc's
|
|
44
|
+
* other maps and nothing inside this one. `mode` is the field that costs
|
|
45
|
+
* money: a cached seed flipping `stripe` back to `manual` stops automatic
|
|
46
|
+
* tax calculation — `resolveTaxRate` returns null in stripe mode — and
|
|
47
|
+
* the store under-collects with nothing anywhere reporting it.
|
|
48
|
+
*/ fromCache: storeFromCache } = useFirestoreDoc(()=>doc(firestore, 'hosts', hostId, 'settings', 'store'), [
|
|
49
|
+
firestore,
|
|
50
|
+
hostId
|
|
51
|
+
]);
|
|
52
|
+
const [draft, setDraft] = useState(null);
|
|
53
|
+
const current = (_ref = draft != null ? draft : store == null ? void 0 : store.tax) != null ? _ref : {
|
|
54
|
+
mode: 'manual'
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Whether anyone has ever answered the tax question for this store
|
|
58
|
+
* (AGL-1999). Read from the SAVED document, never from `current` — the
|
|
59
|
+
* `{ mode: 'manual' }` seed above is local state that has never reached
|
|
60
|
+
* Firestore, and it is exactly what made this invisible: the card looked
|
|
61
|
+
* configured while the server saw `mode: undefined`, took no branch, and
|
|
62
|
+
* sold untaxed. Every storefront path now refuses that state, so the card
|
|
63
|
+
* has to show it rather than paper over it.
|
|
64
|
+
*/ const decided = storeStatus !== 'loading' && typeof (store == null ? void 0 : (_store_tax = store.tax) == null ? void 0 : _store_tax.mode) === 'string';
|
|
65
|
+
const update = (patch)=>setDraft(_extends({}, current, patch));
|
|
66
|
+
const updateRate = (index, patch)=>{
|
|
67
|
+
var _current_rates;
|
|
68
|
+
const rates = [
|
|
69
|
+
...(_current_rates = current.rates) != null ? _current_rates : []
|
|
70
|
+
];
|
|
71
|
+
if (patch === null) rates.splice(index, 1);
|
|
72
|
+
else rates[index] = _extends({
|
|
73
|
+
country: '',
|
|
74
|
+
pct: 0
|
|
75
|
+
}, rates[index], patch);
|
|
76
|
+
update({
|
|
77
|
+
rates
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* One of the flat, per-regime rates (AGL-1969 lodging, AGL-2028 services).
|
|
82
|
+
*
|
|
83
|
+
* A blank field clears the rate rather than storing `NaN`: clearing is how a
|
|
84
|
+
* merchant turns the regime back off, and `Number('')` is 0 while
|
|
85
|
+
* `Number(' ')` is also 0 — neither of which should ever reach the document
|
|
86
|
+
* as a "rate".
|
|
87
|
+
*/ const updateFlat = (key, patch)=>update({
|
|
88
|
+
[key]: _extends({}, current[key], patch)
|
|
89
|
+
});
|
|
90
|
+
const flatPctText = (key)=>{
|
|
91
|
+
var _current_key;
|
|
92
|
+
const pct = (_current_key = current[key]) == null ? void 0 : _current_key.pct;
|
|
93
|
+
return pct === undefined || pct === null ? '' : String(pct);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Shown under a typed rate this will NOT apply. Silence here would be the
|
|
97
|
+
* failure: `resolveFlatTaxCents` treats an out-of-range percentage as off,
|
|
98
|
+
* so a decimal-point typo would otherwise save cleanly and collect nothing.
|
|
99
|
+
*/ const flatPctProblem = (key)=>{
|
|
100
|
+
var _current_key;
|
|
101
|
+
const raw = (_current_key = current[key]) == null ? void 0 : _current_key.pct;
|
|
102
|
+
if (raw === undefined || raw === null || String(raw) === '') return null;
|
|
103
|
+
if (Number(raw) === 0) return null;
|
|
104
|
+
return CommerceModel.isUsableFlatTaxPct(raw) ? null : `Enter a percentage between 0 and ${CommerceModel.FLAT_TAX_MAX_PCT}. ` + 'This rate is not being applied.';
|
|
105
|
+
};
|
|
106
|
+
const handleSave = useCallback(async ()=>{
|
|
107
|
+
/**
|
|
108
|
+
* Refuse a save whose seed the server never confirmed (AGL-1358).
|
|
109
|
+
*
|
|
110
|
+
* No create path to exempt: this is a FIXED document path, so the
|
|
111
|
+
* `{mode: 'manual'}` default produced when the cache has never seen the
|
|
112
|
+
* map is not the harmless blank a fresh uid would be — writing it turns
|
|
113
|
+
* automatic tax calculation off on a store that had it on.
|
|
114
|
+
*
|
|
115
|
+
* The guard WRAPS the write — an early return is a shape you can keep
|
|
116
|
+
* while losing the protection.
|
|
117
|
+
*/ const verdict = await writeGuardedBySeed({
|
|
118
|
+
subject: 'tax settings',
|
|
119
|
+
unreadable: storeStatus === 'error',
|
|
120
|
+
fromCache: storeFromCache
|
|
121
|
+
}, async ()=>{
|
|
122
|
+
await setDoc(doc(firestore, 'hosts', hostId, 'settings', 'store'), {
|
|
123
|
+
tax: current
|
|
124
|
+
}, {
|
|
125
|
+
merge: true
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
// Before `setDraft(null)`, so a refusal keeps every typed rate on screen.
|
|
129
|
+
if (!verdict.ok) {
|
|
130
|
+
return void enqueueSnackbar(verdict.message, {
|
|
131
|
+
variant: 'warning',
|
|
132
|
+
persist: false
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
setDraft(null);
|
|
136
|
+
enqueueSnackbar('Tax settings saved', {
|
|
137
|
+
variant: 'success',
|
|
138
|
+
persist: false
|
|
139
|
+
});
|
|
140
|
+
}, [
|
|
141
|
+
current,
|
|
142
|
+
firestore,
|
|
143
|
+
hostId,
|
|
144
|
+
enqueueSnackbar,
|
|
145
|
+
storeStatus,
|
|
146
|
+
storeFromCache
|
|
147
|
+
]);
|
|
148
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
149
|
+
header: 'Taxes',
|
|
150
|
+
help: pluginDocsHelp('commerce', {
|
|
151
|
+
anchor: '#shipping--taxes'
|
|
152
|
+
}),
|
|
153
|
+
contentGutterX: true,
|
|
154
|
+
contentGutterY: true,
|
|
155
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
156
|
+
spacing: 1.5,
|
|
157
|
+
children: [
|
|
158
|
+
decided ? null : // The store is not selling. Saying so here is the whole point: the
|
|
159
|
+
// silent version of this state charged shoppers an untaxed total.
|
|
160
|
+
/*#__PURE__*/ _jsx(Alert, {
|
|
161
|
+
severity: "warning",
|
|
162
|
+
children: 'Choose how this store handles sales tax and save. Until you ' + 'do, checkout is turned off — we won’t take an order we can’t ' + 'tax correctly.'
|
|
163
|
+
}),
|
|
164
|
+
/*#__PURE__*/ _jsxs(TextField, {
|
|
165
|
+
label: "Calculation",
|
|
166
|
+
value: (_current_mode = current.mode) != null ? _current_mode : 'manual',
|
|
167
|
+
onChange: (event)=>update({
|
|
168
|
+
mode: event.target.value
|
|
169
|
+
}),
|
|
170
|
+
size: "small",
|
|
171
|
+
select: true,
|
|
172
|
+
sx: {
|
|
173
|
+
maxWidth: 280
|
|
174
|
+
},
|
|
175
|
+
children: [
|
|
176
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
177
|
+
value: "manual",
|
|
178
|
+
children: 'Manual rates (below)'
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
181
|
+
value: "stripe",
|
|
182
|
+
children: 'Stripe Tax (automatic)'
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
185
|
+
value: "none",
|
|
186
|
+
children: 'Don’t collect sales tax'
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
current.mode === 'none' ? /*#__PURE__*/ _jsx(Typography, {
|
|
191
|
+
variant: "body2",
|
|
192
|
+
color: "text.secondary",
|
|
193
|
+
children: 'This store adds no sales tax to any order. Orders still go ' + 'through — the decision is recorded, not the tax.'
|
|
194
|
+
}) : current.mode === 'stripe' ? /*#__PURE__*/ _jsx(Typography, {
|
|
195
|
+
variant: "body2",
|
|
196
|
+
color: "text.secondary",
|
|
197
|
+
children: 'Stripe Tax calculates per buyer location at checkout. ' + 'Activate Stripe Tax in your Stripe dashboard first.'
|
|
198
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
199
|
+
children: [
|
|
200
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
201
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
202
|
+
size: "small",
|
|
203
|
+
checked: Boolean(current.pricesIncludeTax),
|
|
204
|
+
onChange: (event)=>update({
|
|
205
|
+
pricesIncludeTax: event.target.checked
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
label: "Prices include tax (VAT-style)"
|
|
209
|
+
}),
|
|
210
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
211
|
+
direction: "row",
|
|
212
|
+
spacing: 1,
|
|
213
|
+
children: [
|
|
214
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
215
|
+
label: "Origin country",
|
|
216
|
+
value: (_ref1 = (_current_origin = current.origin) == null ? void 0 : _current_origin.country) != null ? _ref1 : '',
|
|
217
|
+
onChange: (event)=>update({
|
|
218
|
+
origin: _extends({}, current.origin, {
|
|
219
|
+
country: event.target.value.toUpperCase().slice(0, 2)
|
|
220
|
+
})
|
|
221
|
+
}),
|
|
222
|
+
size: "small",
|
|
223
|
+
sx: {
|
|
224
|
+
width: 140
|
|
225
|
+
},
|
|
226
|
+
placeholder: "US"
|
|
227
|
+
}),
|
|
228
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
229
|
+
label: "Origin state",
|
|
230
|
+
value: (_ref2 = (_current_origin1 = current.origin) == null ? void 0 : _current_origin1.state) != null ? _ref2 : '',
|
|
231
|
+
onChange: (event)=>update({
|
|
232
|
+
origin: _extends({}, current.origin, {
|
|
233
|
+
state: event.target.value.toUpperCase().slice(0, 3)
|
|
234
|
+
})
|
|
235
|
+
}),
|
|
236
|
+
size: "small",
|
|
237
|
+
sx: {
|
|
238
|
+
width: 140
|
|
239
|
+
},
|
|
240
|
+
placeholder: "TX"
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
}),
|
|
244
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
245
|
+
variant: "body2",
|
|
246
|
+
color: "text.secondary",
|
|
247
|
+
children: 'Where this store ships or sells FROM — the jurisdiction the ' + 'manual rates below are applied from. Not the address your ' + 'workspace is billed at by Aglyn, and not where your payouts ' + 'are sent.'
|
|
248
|
+
}),
|
|
249
|
+
((_current_rates = current.rates) != null ? _current_rates : []).map((rate, index)=>{
|
|
250
|
+
var _rate_state, _rate_label;
|
|
251
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
252
|
+
direction: "row",
|
|
253
|
+
spacing: 1,
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
256
|
+
label: "Country",
|
|
257
|
+
value: rate.country,
|
|
258
|
+
onChange: (event)=>updateRate(index, {
|
|
259
|
+
country: event.target.value.toUpperCase().slice(0, 2)
|
|
260
|
+
}),
|
|
261
|
+
size: "small",
|
|
262
|
+
sx: {
|
|
263
|
+
width: 90
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
267
|
+
label: "State",
|
|
268
|
+
value: (_rate_state = rate.state) != null ? _rate_state : '',
|
|
269
|
+
onChange: (event)=>updateRate(index, {
|
|
270
|
+
state: event.target.value.toUpperCase().slice(0, 3) || undefined
|
|
271
|
+
}),
|
|
272
|
+
size: "small",
|
|
273
|
+
sx: {
|
|
274
|
+
width: 80
|
|
275
|
+
}
|
|
276
|
+
}),
|
|
277
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
278
|
+
label: "%",
|
|
279
|
+
value: rate.pct,
|
|
280
|
+
onChange: (event)=>updateRate(index, {
|
|
281
|
+
pct: Number(event.target.value) || 0
|
|
282
|
+
}),
|
|
283
|
+
size: "small",
|
|
284
|
+
sx: {
|
|
285
|
+
width: 80
|
|
286
|
+
},
|
|
287
|
+
slotProps: {
|
|
288
|
+
htmlInput: {
|
|
289
|
+
inputMode: 'decimal'
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
294
|
+
label: "Label",
|
|
295
|
+
value: (_rate_label = rate.label) != null ? _rate_label : '',
|
|
296
|
+
onChange: (event)=>updateRate(index, {
|
|
297
|
+
label: event.target.value
|
|
298
|
+
}),
|
|
299
|
+
size: "small",
|
|
300
|
+
sx: {
|
|
301
|
+
flex: 1
|
|
302
|
+
},
|
|
303
|
+
placeholder: "Sales tax"
|
|
304
|
+
}),
|
|
305
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
306
|
+
size: "small",
|
|
307
|
+
color: "error",
|
|
308
|
+
onClick: ()=>updateRate(index, null),
|
|
309
|
+
children: '✕'
|
|
310
|
+
})
|
|
311
|
+
]
|
|
312
|
+
}, index);
|
|
313
|
+
}),
|
|
314
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
315
|
+
size: "small",
|
|
316
|
+
sx: {
|
|
317
|
+
alignSelf: 'flex-start'
|
|
318
|
+
},
|
|
319
|
+
onClick: ()=>{
|
|
320
|
+
var _ref;
|
|
321
|
+
var _current_rates;
|
|
322
|
+
return updateRate((_ref = (_current_rates = current.rates) == null ? void 0 : _current_rates.length) != null ? _ref : 0, {});
|
|
323
|
+
},
|
|
324
|
+
children: 'Add rate'
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}),
|
|
328
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
329
|
+
sx: {
|
|
330
|
+
my: 0.5
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
334
|
+
spacing: 1,
|
|
335
|
+
children: [
|
|
336
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
337
|
+
variant: "subtitle2",
|
|
338
|
+
children: 'Lodging tax'
|
|
339
|
+
}),
|
|
340
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
341
|
+
variant: "body2",
|
|
342
|
+
color: "text.secondary",
|
|
343
|
+
children: 'Charged on reservations, on top of the price, using the rate ' + 'you enter here. It is separate from the sales tax above ' + 'because occupancy tax is its own regime with its own rates ' + 'and its own return. Leave it blank to charge none — that is ' + 'the default.'
|
|
344
|
+
}),
|
|
345
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
346
|
+
direction: "row",
|
|
347
|
+
spacing: 1,
|
|
348
|
+
children: [
|
|
349
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
350
|
+
label: "Rate %",
|
|
351
|
+
value: flatPctText('lodging'),
|
|
352
|
+
onChange: (event)=>updateFlat('lodging', {
|
|
353
|
+
pct: event.target.value === '' ? undefined : Number(event.target.value)
|
|
354
|
+
}),
|
|
355
|
+
size: "small",
|
|
356
|
+
sx: {
|
|
357
|
+
width: 110
|
|
358
|
+
},
|
|
359
|
+
placeholder: "0",
|
|
360
|
+
error: Boolean(flatPctProblem('lodging')),
|
|
361
|
+
helperText: (_flatPctProblem = flatPctProblem('lodging')) != null ? _flatPctProblem : ' ',
|
|
362
|
+
slotProps: {
|
|
363
|
+
htmlInput: {
|
|
364
|
+
inputMode: 'decimal'
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}),
|
|
368
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
369
|
+
label: "Label",
|
|
370
|
+
value: (_ref3 = (_current_lodging = current.lodging) == null ? void 0 : _current_lodging.label) != null ? _ref3 : '',
|
|
371
|
+
onChange: (event)=>updateFlat('lodging', {
|
|
372
|
+
label: event.target.value
|
|
373
|
+
}),
|
|
374
|
+
size: "small",
|
|
375
|
+
sx: {
|
|
376
|
+
flex: 1
|
|
377
|
+
},
|
|
378
|
+
placeholder: "Occupancy tax",
|
|
379
|
+
helperText: "Shown to the guest on the receipt"
|
|
380
|
+
})
|
|
381
|
+
]
|
|
382
|
+
}),
|
|
383
|
+
/*#__PURE__*/ _jsx(Alert, {
|
|
384
|
+
severity: "info",
|
|
385
|
+
children: `${PLATFORM_BRAND_NAME} applies the rate you enter and records ` + 'what was charged. It does not determine whether this tax ' + 'applies to you, at what rate, or where it should be paid — ' + 'that is yours to decide.'
|
|
386
|
+
}),
|
|
387
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
388
|
+
variant: "body2",
|
|
389
|
+
color: "text.secondary",
|
|
390
|
+
children: 'On a reservation that takes a deposit, the rate is applied to ' + 'the deposit — the amount actually charged here — not to the ' + 'whole stay. If tax is due on the full stay, collect the ' + 'difference the same way you collect the rest of the balance.'
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
}),
|
|
394
|
+
/*#__PURE__*/ _jsx(Divider, {
|
|
395
|
+
sx: {
|
|
396
|
+
my: 0.5
|
|
397
|
+
}
|
|
398
|
+
}),
|
|
399
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
400
|
+
spacing: 1,
|
|
401
|
+
children: [
|
|
402
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
403
|
+
variant: "subtitle2",
|
|
404
|
+
children: 'Service tax'
|
|
405
|
+
}),
|
|
406
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
407
|
+
variant: "body2",
|
|
408
|
+
color: "text.secondary",
|
|
409
|
+
children: 'Charged on paid bookings, on top of the price, using the rate ' + 'you enter here. It is separate from the sales tax above ' + 'because whether a service is taxable is often a different ' + 'question from whether goods are. Leave it blank to charge ' + 'none — that is the default.'
|
|
410
|
+
}),
|
|
411
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
412
|
+
direction: "row",
|
|
413
|
+
spacing: 1,
|
|
414
|
+
children: [
|
|
415
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
416
|
+
label: "Rate %",
|
|
417
|
+
value: flatPctText('service'),
|
|
418
|
+
onChange: (event)=>updateFlat('service', {
|
|
419
|
+
pct: event.target.value === '' ? undefined : Number(event.target.value)
|
|
420
|
+
}),
|
|
421
|
+
size: "small",
|
|
422
|
+
sx: {
|
|
423
|
+
width: 110
|
|
424
|
+
},
|
|
425
|
+
placeholder: "0",
|
|
426
|
+
error: Boolean(flatPctProblem('service')),
|
|
427
|
+
helperText: (_flatPctProblem1 = flatPctProblem('service')) != null ? _flatPctProblem1 : ' ',
|
|
428
|
+
slotProps: {
|
|
429
|
+
htmlInput: {
|
|
430
|
+
inputMode: 'decimal'
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}),
|
|
434
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
435
|
+
label: "Label",
|
|
436
|
+
value: (_ref4 = (_current_service = current.service) == null ? void 0 : _current_service.label) != null ? _ref4 : '',
|
|
437
|
+
onChange: (event)=>updateFlat('service', {
|
|
438
|
+
label: event.target.value
|
|
439
|
+
}),
|
|
440
|
+
size: "small",
|
|
441
|
+
sx: {
|
|
442
|
+
flex: 1
|
|
443
|
+
},
|
|
444
|
+
placeholder: "Service tax",
|
|
445
|
+
helperText: "Shown to the client on the receipt"
|
|
446
|
+
})
|
|
447
|
+
]
|
|
448
|
+
}),
|
|
449
|
+
/*#__PURE__*/ _jsx(Alert, {
|
|
450
|
+
severity: "info",
|
|
451
|
+
children: `${PLATFORM_BRAND_NAME} applies the rate you enter and records ` + 'what was charged. It does not determine whether this tax ' + 'applies to you, at what rate, or where it should be paid — ' + 'that is yours to decide.'
|
|
452
|
+
})
|
|
453
|
+
]
|
|
454
|
+
}),
|
|
455
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
456
|
+
variant: "contained",
|
|
457
|
+
color: "primary",
|
|
458
|
+
size: "small",
|
|
459
|
+
disabled: !draft,
|
|
460
|
+
onClick: handleSave,
|
|
461
|
+
sx: {
|
|
462
|
+
alignSelf: 'flex-start'
|
|
463
|
+
},
|
|
464
|
+
children: 'Save tax settings'
|
|
465
|
+
})
|
|
466
|
+
]
|
|
467
|
+
})
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
TaxSettingsCard.displayName = 'TaxSettingsCard';
|
|
471
|
+
export default TaxSettingsCard;
|
|
472
|
+
|
|
473
|
+
//# sourceMappingURL=tax-settings-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/tax-settings-card.component.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'use client'\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport * as CommerceModel from '../../model'\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n Alert,\n Button,\n Divider,\n FormControlLabel,\n MenuItem,\n Stack,\n Switch,\n TextField,\n Typography,\n} from '@mui/material'\nimport { doc, setDoc } from 'firebase/firestore'\nimport { useCallback, useState } from 'react'\nimport { useFirestore } from '@aglyn/tenant-feature-instance'\nimport {\n useFirestoreDoc,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\n\nexport interface TaxSettingsCardProps {\n hostId: string\n}\n\n/**\n * Tax settings (AGL-285): manual per-region rates (most-specific wins)\n * or Stripe Tax automatic calculation, stored on\n * `hosts/{hostId}/settings/store` under `tax`. The legacy quick-buy\n * checkout taxes by the store origin; Checkout v2 taxes by destination.\n */\nexport function TaxSettingsCard(props: TaxSettingsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const {\n data: store,\n status: storeStatus,\n /**\n * The settings doc this form is seeded from is unconfirmed by the server\n * (AGL-1358). `current` is `draft ?? store?.tax ?? {mode: 'manual'}` and\n * the save writes `{tax: current}`, so `merge: true` protects the doc's\n * other maps and nothing inside this one. `mode` is the field that costs\n * money: a cached seed flipping `stripe` back to `manual` stops automatic\n * tax calculation — `resolveTaxRate` returns null in stripe mode — and\n * the store under-collects with nothing anywhere reporting it.\n */\n fromCache: storeFromCache,\n } = useFirestoreDoc<any>(\n () => doc(firestore, 'hosts', hostId, 'settings', 'store'),\n [firestore, hostId],\n )\n const [draft, setDraft] = useState<CommerceModel.TaxSettings | null>(null)\n const current: CommerceModel.TaxSettings = draft ?? store?.tax ?? { mode: 'manual' }\n /**\n * Whether anyone has ever answered the tax question for this store\n * (AGL-1999). Read from the SAVED document, never from `current` — the\n * `{ mode: 'manual' }` seed above is local state that has never reached\n * Firestore, and it is exactly what made this invisible: the card looked\n * configured while the server saw `mode: undefined`, took no branch, and\n * sold untaxed. Every storefront path now refuses that state, so the card\n * has to show it rather than paper over it.\n */\n const decided =\n storeStatus !== 'loading' && typeof store?.tax?.mode === 'string'\n const update = (patch: Partial<CommerceModel.TaxSettings>) =>\n setDraft({ ...current, ...patch })\n const updateRate = (\n index: number,\n patch: Partial<CommerceModel.TaxRate> | null,\n ) => {\n const rates = [...(current.rates ?? [])]\n if (patch === null) rates.splice(index, 1)\n else rates[index] = { country: '', pct: 0, ...rates[index], ...patch }\n update({ rates })\n }\n /**\n * One of the flat, per-regime rates (AGL-1969 lodging, AGL-2028 services).\n *\n * A blank field clears the rate rather than storing `NaN`: clearing is how a\n * merchant turns the regime back off, and `Number('')` is 0 while\n * `Number(' ')` is also 0 — neither of which should ever reach the document\n * as a \"rate\".\n */\n const updateFlat = (\n key: 'lodging' | 'service',\n patch: Partial<CommerceModel.FlatTaxRate>,\n ) => update({ [key]: { ...current[key], ...patch } })\n const flatPctText = (key: 'lodging' | 'service') => {\n const pct = current[key]?.pct\n return pct === undefined || pct === null ? '' : String(pct)\n }\n /**\n * Shown under a typed rate this will NOT apply. Silence here would be the\n * failure: `resolveFlatTaxCents` treats an out-of-range percentage as off,\n * so a decimal-point typo would otherwise save cleanly and collect nothing.\n */\n const flatPctProblem = (key: 'lodging' | 'service'): string | null => {\n const raw = current[key]?.pct\n if (raw === undefined || raw === null || String(raw) === '') return null\n if (Number(raw) === 0) return null\n return CommerceModel.isUsableFlatTaxPct(raw)\n ? null\n : `Enter a percentage between 0 and ${CommerceModel.FLAT_TAX_MAX_PCT}. ` +\n 'This rate is not being applied.'\n }\n\n const handleSave = useCallback(async () => {\n /**\n * Refuse a save whose seed the server never confirmed (AGL-1358).\n *\n * No create path to exempt: this is a FIXED document path, so the\n * `{mode: 'manual'}` default produced when the cache has never seen the\n * map is not the harmless blank a fresh uid would be — writing it turns\n * automatic tax calculation off on a store that had it on.\n *\n * The guard WRAPS the write — an early return is a shape you can keep\n * while losing the protection.\n */\n const verdict = await writeGuardedBySeed(\n {\n subject: 'tax settings',\n unreadable: storeStatus === 'error',\n fromCache: storeFromCache,\n },\n async () => {\n await setDoc(\n doc(firestore, 'hosts', hostId, 'settings', 'store'),\n { tax: current },\n { merge: true },\n )\n },\n )\n // Before `setDraft(null)`, so a refusal keeps every typed rate on screen.\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n setDraft(null)\n enqueueSnackbar('Tax settings saved', { variant: 'success', persist: false })\n }, [current, firestore, hostId, enqueueSnackbar, storeStatus, storeFromCache])\n\n return (\n <CardDisplay\n header={'Taxes'}\n help={pluginDocsHelp('commerce', { anchor: '#shipping--taxes' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1.5}>\n {decided ? null : (\n // The store is not selling. Saying so here is the whole point: the\n // silent version of this state charged shoppers an untaxed total.\n <Alert severity=\"warning\">\n {'Choose how this store handles sales tax and save. Until you ' +\n 'do, checkout is turned off — we won’t take an order we can’t ' +\n 'tax correctly.'}\n </Alert>\n )}\n <TextField\n label=\"Calculation\"\n value={current.mode ?? 'manual'}\n onChange={(event) =>\n update({\n mode: event.target.value as 'manual' | 'stripe' | 'none',\n })\n }\n size=\"small\"\n select\n sx={{ maxWidth: 280 }}\n >\n <MenuItem value=\"manual\">{'Manual rates (below)'}</MenuItem>\n <MenuItem value=\"stripe\">{'Stripe Tax (automatic)'}</MenuItem>\n {/* An explicit decision, not an omission (AGL-1999) — the option a\n merchant under a nexus threshold, or selling non-taxable goods,\n needs in order to sell at all. */}\n <MenuItem value=\"none\">{'Don’t collect sales tax'}</MenuItem>\n </TextField>\n {current.mode === 'none' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This store adds no sales tax to any order. Orders still go ' +\n 'through — the decision is recorded, not the tax.'}\n </Typography>\n ) : current.mode === 'stripe' ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Stripe Tax calculates per buyer location at checkout. ' +\n 'Activate Stripe Tax in your Stripe dashboard first.'}\n </Typography>\n ) : (\n <>\n <FormControlLabel\n control={\n <Switch\n size=\"small\"\n checked={Boolean(current.pricesIncludeTax)}\n onChange={(event) =>\n update({ pricesIncludeTax: event.target.checked })\n }\n />\n }\n label=\"Prices include tax (VAT-style)\"\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Origin country\"\n value={current.origin?.country ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n country: event.target.value.toUpperCase().slice(0, 2),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"US\"\n />\n <TextField\n label=\"Origin state\"\n value={current.origin?.state ?? ''}\n onChange={(event) =>\n update({\n origin: {\n ...current.origin,\n state: event.target.value.toUpperCase().slice(0, 3),\n },\n })\n }\n size=\"small\"\n sx={{ width: 140 }}\n placeholder=\"TX\"\n />\n </Stack>\n {/* Which of the product's three addresses this is. A merchant\n who reads an unlabeled origin as \"our address\" may set it\n from the wrong one: the address the workspace pays Aglyn\n from is a different jurisdiction question, and the payout\n identity is a third. Naming the two it is NOT costs a line\n and prevents a mis-taxed order. */}\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Where this store ships or sells FROM — the jurisdiction the ' +\n 'manual rates below are applied from. Not the address your ' +\n 'workspace is billed at by Aglyn, and not where your payouts ' +\n 'are sent.'}\n </Typography>\n {(current.rates ?? []).map((rate, index) => (\n <Stack key={index} direction=\"row\" spacing={1}>\n <TextField\n label=\"Country\"\n value={rate.country}\n onChange={(event) =>\n updateRate(index, {\n country: event.target.value.toUpperCase().slice(0, 2),\n })\n }\n size=\"small\"\n sx={{ width: 90 }}\n />\n <TextField\n label=\"State\"\n value={rate.state ?? ''}\n onChange={(event) =>\n updateRate(index, {\n state:\n event.target.value.toUpperCase().slice(0, 3) ||\n undefined,\n })\n }\n size=\"small\"\n sx={{ width: 80 }}\n />\n <TextField\n label=\"%\"\n value={rate.pct}\n onChange={(event) =>\n updateRate(index, { pct: Number(event.target.value) || 0 })\n }\n size=\"small\"\n sx={{ width: 80 }}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={rate.label ?? ''}\n onChange={(event) =>\n updateRate(index, { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Sales tax\"\n />\n <Button\n size=\"small\"\n color=\"error\"\n onClick={() => updateRate(index, null)}\n >\n {'✕'}\n </Button>\n </Stack>\n ))}\n <Button\n size=\"small\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() => updateRate(current.rates?.length ?? 0, {})}\n >\n {'Add rate'}\n </Button>\n </>\n )}\n {/*\n LODGING TAX (AGL-1969) — deliberately OUTSIDE the calculation branch\n above, and deliberately not a `rates[]` row.\n\n The setting above is a goods SALES rate resolved against an address.\n Occupancy tax is a different regime with its own rates, registration\n and return, and it applies to reservations, which sell nights rather\n than goods. Nesting it under \"Manual rates\" would have said the two\n are the same machinery; putting it here says a store on Stripe Tax —\n which cannot compute occupancy tax from these sessions at all — can\n still set one.\n\n It is off until the merchant fills it in, so nothing an existing\n store charges moves.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Lodging tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on reservations, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because occupancy tax is its own regime with its own rates ' +\n 'and its own return. Leave it blank to charge none — that is ' +\n 'the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('lodging')}\n onChange={(event) =>\n updateFlat('lodging', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('lodging'))}\n helperText={flatPctProblem('lodging') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.lodging?.label ?? ''}\n onChange={(event) =>\n updateFlat('lodging', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Occupancy tax\"\n helperText=\"Shown to the guest on the receipt\"\n />\n </Stack>\n {/*\n MECHANISM ONLY, AND NO REMITTANCE DETERMINATION.\n\n Whether a jurisdiction imposes occupancy tax, who must register for\n it and who must remit it are legal conclusions that attach by\n operation of law (AGL-1904/AGL-1956) and are the merchant's under\n the Terms. This copy says what the software DOES and what it does\n not do, and stops there — including the deposit basis, which is a\n real limitation rather than an answer this product has taken.\n */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'On a reservation that takes a deposit, the rate is applied to ' +\n 'the deposit — the amount actually charged here — not to the ' +\n 'whole stay. If tax is due on the full stay, collect the ' +\n 'difference the same way you collect the rest of the balance.'}\n </Typography>\n </Stack>\n {/*\n SERVICE TAX (AGL-2028) — the bookings sibling of the block above,\n and here for the same reason it is not in the bookings plugin's own\n settings: this is the one card a merchant comes to with a tax\n question, and a second tax surface elsewhere is how one of them ends\n up unanswered.\n\n Its EXISTENCE is also the opt-in AGL-2000 wanted. That issue\n declined to apply the goods rate to an appointment partly because\n nothing said the merchant meant these settings to cover bookings; a\n field labelled for services, blank until they fill it in, is them\n saying so.\n */}\n <Divider sx={{ my: 0.5 }} />\n <Stack spacing={1}>\n <Typography variant=\"subtitle2\">{'Service tax'}</Typography>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Charged on paid bookings, on top of the price, using the rate ' +\n 'you enter here. It is separate from the sales tax above ' +\n 'because whether a service is taxable is often a different ' +\n 'question from whether goods are. Leave it blank to charge ' +\n 'none — that is the default.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <TextField\n label=\"Rate %\"\n value={flatPctText('service')}\n onChange={(event) =>\n updateFlat('service', {\n pct:\n event.target.value === ''\n ? undefined\n : Number(event.target.value),\n })\n }\n size=\"small\"\n sx={{ width: 110 }}\n placeholder=\"0\"\n error={Boolean(flatPctProblem('service'))}\n helperText={flatPctProblem('service') ?? ' '}\n slotProps={{ htmlInput: { inputMode: 'decimal' } }}\n />\n <TextField\n label=\"Label\"\n value={current.service?.label ?? ''}\n onChange={(event) =>\n updateFlat('service', { label: event.target.value })\n }\n size=\"small\"\n sx={{ flex: 1 }}\n placeholder=\"Service tax\"\n helperText=\"Shown to the client on the receipt\"\n />\n </Stack>\n {/* MECHANISM ONLY, AND NO REMITTANCE DETERMINATION — see the\n lodging block above. */}\n <Alert severity=\"info\">\n {`${PLATFORM_BRAND_NAME} applies the rate you enter and records ` +\n 'what was charged. It does not determine whether this tax ' +\n 'applies to you, at what rate, or where it should be paid — ' +\n 'that is yours to decide.'}\n </Alert>\n </Stack>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n disabled={!draft}\n onClick={handleSave}\n sx={{ alignSelf: 'flex-start' }}\n >\n {'Save tax settings'}\n </Button>\n </Stack>\n </CardDisplay>\n )\n}\nTaxSettingsCard.displayName = 'TaxSettingsCard'\n\nexport default TaxSettingsCard\n"],"names":["CommerceModel","PLATFORM_BRAND_NAME","CardDisplay","useSnackbar","Alert","Button","Divider","FormControlLabel","MenuItem","Stack","Switch","TextField","Typography","doc","setDoc","useCallback","useState","useFirestore","useFirestoreDoc","writeGuardedBySeed","pluginDocsHelp","TaxSettingsCard","props","draft","current","flatPctProblem","store","hostId","firestore","enqueueSnackbar","data","status","storeStatus","fromCache","storeFromCache","setDraft","tax","mode","decided","update","patch","updateRate","index","rates","splice","country","pct","updateFlat","key","flatPctText","undefined","String","raw","Number","isUsableFlatTaxPct","FLAT_TAX_MAX_PCT","handleSave","verdict","subject","unreadable","merge","ok","message","variant","persist","header","help","anchor","contentGutterX","contentGutterY","spacing","severity","label","value","onChange","event","target","size","select","sx","maxWidth","color","control","checked","Boolean","pricesIncludeTax","direction","origin","toUpperCase","slice","width","placeholder","state","map","rate","slotProps","htmlInput","inputMode","flex","onClick","alignSelf","length","my","error","helperText","lodging","service","disabled","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAGA,YAAYA,mBAAmB,uBAAa;AAC5C,SAASC,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,WAAW,QAAQ,uBAAsB;AAClD,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SACEC,KAAK,EACLC,MAAM,EACNC,OAAO,EACPC,gBAAgB,EAChBC,QAAQ,EACRC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SAASC,GAAG,EAAEC,MAAM,QAAQ,qBAAoB;AAChD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AAC7C,SAASC,YAAY,QAAQ,iCAAgC;AAC7D,SACEC,eAAe,EACfC,kBAAkB,QACb,iCAAgC;AACvC,SAASC,cAAc,QAAQ,eAAc;AAM7C;;;;;CAKC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;QAsBdC,MA8G5BC,6BAqFHA,gBAyGYC,wBA6EAA;QA9WcC,YA+IjBF,iBAeAA,kBAwIFA,kBA6EAA;IAnZnB,MAAM,EAAEG,MAAM,EAAE,GAAGL;IACnB,MAAMM,YAAYX;IAClB,MAAM,EAAEY,eAAe,EAAE,GAAG1B;IAC5B,MAAM,EACJ2B,MAAMJ,KAAK,EACXK,QAAQC,WAAW,EACnB;;;;;;;;KAQC,GACDC,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F;oBACX4E,SAAS3C;oBACTuB,IAAI;wBAAEqB,WAAW;oBAAa;8BAE7B;;;;;AAKX;AACA/E,gBAAgBuF,WAAW,GAAG;AAE9B,eAAevF,gBAAe"}
|
|
@@ -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
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
export declare const ID: Aglyn.ComponentId;
|
|
20
|
+
export interface GateProps {
|
|
21
|
+
/** Product id granting access; blank = any live subscription. */
|
|
22
|
+
productId?: string;
|
|
23
|
+
teaserText?: string;
|
|
24
|
+
ctaLabel?: string;
|
|
25
|
+
/** Where the CTA sends non-members (product or sign-in page). */
|
|
26
|
+
ctaHref?: string;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Content gate (AGL-309): renders children only for entitled members
|
|
31
|
+
* (purchase or live subscription, checked by the server-enforced gate
|
|
32
|
+
* API). Non-members see the teaser + CTA. Layout gating only — media
|
|
33
|
+
* that must stay secret should use the gated video block (AGL-315) or
|
|
34
|
+
* download links (AGL-302), which enforce on the server end-to-end.
|
|
35
|
+
*/
|
|
36
|
+
declare const Gate: import("react").ForwardRefExoticComponent<GateProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export declare const schema: Aglyn.ComponentSchema<GateProps>;
|
|
38
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
39
|
+
export default Gate;
|