@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,283 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
19
|
+
import { CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
20
|
+
import { ListPagination } from "@aglyn/shared-ui-jsx/components/list-pagination.component";
|
|
21
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
22
|
+
import { Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, MenuItem, Stack, TextField, Typography } from "@mui/material";
|
|
23
|
+
import { collection, deleteDoc, doc, limit, orderBy, query } from "firebase/firestore";
|
|
24
|
+
import { useCallback, useState } from "react";
|
|
25
|
+
import { useFirestore, useUser } from "@aglyn/tenant-feature-instance";
|
|
26
|
+
import { useFirestoreCollection, usePagedCollection } from "@aglyn/tenant-feature-instance";
|
|
27
|
+
import { EntitlementGatedCard } from "./entitlement-gate.component.js";
|
|
28
|
+
import { pluginDocsHelp } from "@aglyn/aglyn";
|
|
29
|
+
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
30
|
+
/**
|
|
31
|
+
* Member updates (AGL-316): posts for entitled subscribers, published
|
|
32
|
+
* through a manager-gated API that can also email the audience. The
|
|
33
|
+
* member-feed block renders them on the site.
|
|
34
|
+
*
|
|
35
|
+
* Gated on `contentGating` since AGL-2080, and this is the one of the five
|
|
36
|
+
* that failed OPEN. `server/gate.ts:48` (`hostHasContentGating`) is what
|
|
37
|
+
* decides whether `membership-content.ts`, `member-feed.ts` and `stream.ts`
|
|
38
|
+
* withhold anything; without the entitlement it withholds nothing. So an
|
|
39
|
+
* unentitled operator could mark a post members-only, see it accepted, and
|
|
40
|
+
* have the renderer serve it to the public — believing content was protected
|
|
41
|
+
* while it was not. A refusal the operator can see is the fix.
|
|
42
|
+
*/ const memberPostsHelp = pluginDocsHelp('membersOnly', {
|
|
43
|
+
anchor: '#manage-your-members'
|
|
44
|
+
});
|
|
45
|
+
export function MemberPostsCard(props) {
|
|
46
|
+
var _ref, _ref1, _ref2, _ref3;
|
|
47
|
+
const { hostId } = props;
|
|
48
|
+
const firestore = useFirestore();
|
|
49
|
+
const { data: user } = useUser();
|
|
50
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
51
|
+
/*
|
|
52
|
+
* Ordered by the SERVER, and a growing window rather than a fixed read.
|
|
53
|
+
*
|
|
54
|
+
* This was `limit(50)` with no `orderBy`, rendering `.slice(0, 8)`. A
|
|
55
|
+
* Firestore query with a limit and no ordering returns DOCUMENT-ID order,
|
|
56
|
+
* and posts are created with `.add()`, so those fifty were a pseudo-random
|
|
57
|
+
* sample of the feed — the client sort below then ordered the sample and
|
|
58
|
+
* showed eight of it, which looks newest-first and is not. Past fifty
|
|
59
|
+
* posts, one written this morning could simply never appear.
|
|
60
|
+
*/ const { rows: posts, hasMore, page, setPage, pageSize, setPageSize } = usePagedCollection((pageLimit)=>query(collection(firestore, 'hosts', hostId, 'memberPosts'), orderBy('createdAtMs', 'desc'), limit(pageLimit)), [
|
|
61
|
+
firestore,
|
|
62
|
+
hostId
|
|
63
|
+
], {
|
|
64
|
+
idField: '$id'
|
|
65
|
+
});
|
|
66
|
+
const { data: productDocs } = useFirestoreCollection(()=>query(collection(firestore, 'hosts', hostId, 'products'), limit(200)), [
|
|
67
|
+
firestore,
|
|
68
|
+
hostId
|
|
69
|
+
], {
|
|
70
|
+
idField: '$id'
|
|
71
|
+
});
|
|
72
|
+
const [draft, setDraft] = useState(null);
|
|
73
|
+
const handlePublish = useCallback(async ()=>{
|
|
74
|
+
if (!(draft == null ? void 0 : draft.title.trim())) return;
|
|
75
|
+
setDraft((prev)=>prev ? _extends({}, prev, {
|
|
76
|
+
busy: true
|
|
77
|
+
}) : prev);
|
|
78
|
+
try {
|
|
79
|
+
const response = await authorizedFetch(user, '/api/commerce/member-post', {
|
|
80
|
+
method: 'POST',
|
|
81
|
+
headers: {
|
|
82
|
+
'Content-Type': 'application/json'
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify(_extends({
|
|
85
|
+
hostId
|
|
86
|
+
}, draft))
|
|
87
|
+
});
|
|
88
|
+
const payload = await response.json();
|
|
89
|
+
if (!response.ok) {
|
|
90
|
+
var _ref;
|
|
91
|
+
return void enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Publish failed', {
|
|
92
|
+
variant: 'error',
|
|
93
|
+
allowDuplicate: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
enqueueSnackbar(payload.emailed ? `Published — emailed ${payload.emailed} subscribers` : 'Published', {
|
|
97
|
+
variant: 'success',
|
|
98
|
+
persist: false
|
|
99
|
+
});
|
|
100
|
+
setDraft(null);
|
|
101
|
+
} finally{
|
|
102
|
+
setDraft((prev)=>prev ? _extends({}, prev, {
|
|
103
|
+
busy: false
|
|
104
|
+
}) : prev);
|
|
105
|
+
}
|
|
106
|
+
}, [
|
|
107
|
+
draft,
|
|
108
|
+
user,
|
|
109
|
+
hostId,
|
|
110
|
+
enqueueSnackbar
|
|
111
|
+
]);
|
|
112
|
+
return /*#__PURE__*/ _jsx(EntitlementGatedCard, {
|
|
113
|
+
help: memberPostsHelp,
|
|
114
|
+
hostId: hostId,
|
|
115
|
+
feature: "contentGating",
|
|
116
|
+
header: 'Member updates',
|
|
117
|
+
upsell: 'Memberships and gated content keep posts, pages and video behind ' + 'a subscription, and publish updates to the members entitled to ' + 'them.',
|
|
118
|
+
children: /*#__PURE__*/ _jsxs(CardDisplay, {
|
|
119
|
+
header: 'Member updates',
|
|
120
|
+
help: memberPostsHelp,
|
|
121
|
+
contentGutterX: true,
|
|
122
|
+
contentGutterY: true,
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
125
|
+
spacing: 1,
|
|
126
|
+
children: [
|
|
127
|
+
posts.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
|
|
128
|
+
variant: "body2",
|
|
129
|
+
color: "text.secondary",
|
|
130
|
+
children: 'Post updates only your subscribers can see (and optionally ' + 'email them). Add a Member feed block to a members screen.'
|
|
131
|
+
}) : posts.map((post)=>{
|
|
132
|
+
var _post_createdAtMs;
|
|
133
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
134
|
+
direction: "row",
|
|
135
|
+
spacing: 1,
|
|
136
|
+
sx: {
|
|
137
|
+
alignItems: 'center'
|
|
138
|
+
},
|
|
139
|
+
children: [
|
|
140
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
141
|
+
sx: {
|
|
142
|
+
flex: 1,
|
|
143
|
+
minWidth: 0
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
147
|
+
variant: "body2",
|
|
148
|
+
noWrap: true,
|
|
149
|
+
children: post.title
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
152
|
+
variant: "caption",
|
|
153
|
+
color: "text.secondary",
|
|
154
|
+
children: new Date((_post_createdAtMs = post.createdAtMs) != null ? _post_createdAtMs : 0).toLocaleDateString()
|
|
155
|
+
})
|
|
156
|
+
]
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
159
|
+
size: "small",
|
|
160
|
+
color: "error",
|
|
161
|
+
onClick: ()=>deleteDoc(doc(firestore, 'hosts', hostId, 'memberPosts', post.$id)),
|
|
162
|
+
children: 'Delete'
|
|
163
|
+
})
|
|
164
|
+
]
|
|
165
|
+
}, post.$id);
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ _jsx(ListPagination, {
|
|
168
|
+
page: page,
|
|
169
|
+
pageSize: pageSize,
|
|
170
|
+
rowCount: posts.length,
|
|
171
|
+
hasMore: hasMore,
|
|
172
|
+
onPageChange: setPage,
|
|
173
|
+
onPageSizeChange: setPageSize
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
176
|
+
size: "small",
|
|
177
|
+
sx: {
|
|
178
|
+
alignSelf: 'flex-start'
|
|
179
|
+
},
|
|
180
|
+
onClick: ()=>setDraft({
|
|
181
|
+
title: '',
|
|
182
|
+
body: '',
|
|
183
|
+
productId: '',
|
|
184
|
+
emailSubscribers: true
|
|
185
|
+
}),
|
|
186
|
+
children: 'New update'
|
|
187
|
+
})
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
/*#__PURE__*/ _jsxs(Dialog, {
|
|
191
|
+
open: Boolean(draft),
|
|
192
|
+
onClose: ()=>setDraft(null),
|
|
193
|
+
maxWidth: "sm",
|
|
194
|
+
fullWidth: true,
|
|
195
|
+
children: [
|
|
196
|
+
/*#__PURE__*/ _jsx(DialogTitle, {
|
|
197
|
+
children: 'New member update'
|
|
198
|
+
}),
|
|
199
|
+
/*#__PURE__*/ _jsxs(DialogContent, {
|
|
200
|
+
sx: {
|
|
201
|
+
display: 'flex',
|
|
202
|
+
flexDirection: 'column',
|
|
203
|
+
gap: 2
|
|
204
|
+
},
|
|
205
|
+
children: [
|
|
206
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
207
|
+
label: "Title",
|
|
208
|
+
value: (_ref = draft == null ? void 0 : draft.title) != null ? _ref : '',
|
|
209
|
+
onChange: (event)=>setDraft((prev)=>prev ? _extends({}, prev, {
|
|
210
|
+
title: event.target.value
|
|
211
|
+
}) : prev),
|
|
212
|
+
size: "small",
|
|
213
|
+
autoFocus: true,
|
|
214
|
+
sx: {
|
|
215
|
+
mt: 1
|
|
216
|
+
}
|
|
217
|
+
}),
|
|
218
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
219
|
+
label: "Body",
|
|
220
|
+
value: (_ref1 = draft == null ? void 0 : draft.body) != null ? _ref1 : '',
|
|
221
|
+
onChange: (event)=>setDraft((prev)=>prev ? _extends({}, prev, {
|
|
222
|
+
body: event.target.value
|
|
223
|
+
}) : prev),
|
|
224
|
+
size: "small",
|
|
225
|
+
multiline: true,
|
|
226
|
+
minRows: 4
|
|
227
|
+
}),
|
|
228
|
+
/*#__PURE__*/ _jsxs(TextField, {
|
|
229
|
+
label: "Audience",
|
|
230
|
+
value: (_ref2 = draft == null ? void 0 : draft.productId) != null ? _ref2 : '',
|
|
231
|
+
onChange: (event)=>setDraft((prev)=>prev ? _extends({}, prev, {
|
|
232
|
+
productId: event.target.value
|
|
233
|
+
}) : prev),
|
|
234
|
+
size: "small",
|
|
235
|
+
select: true,
|
|
236
|
+
children: [
|
|
237
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
238
|
+
value: "",
|
|
239
|
+
children: 'All live subscribers'
|
|
240
|
+
}),
|
|
241
|
+
(productDocs != null ? productDocs : []).filter((product)=>product.subscription).map((product)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
242
|
+
value: product.$id,
|
|
243
|
+
children: `Subscribers of ${product.name}`
|
|
244
|
+
}, product.$id))
|
|
245
|
+
]
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
248
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
249
|
+
size: "small",
|
|
250
|
+
checked: (_ref3 = draft == null ? void 0 : draft.emailSubscribers) != null ? _ref3 : true,
|
|
251
|
+
onChange: (event)=>setDraft((prev)=>prev ? _extends({}, prev, {
|
|
252
|
+
emailSubscribers: event.target.checked
|
|
253
|
+
}) : prev)
|
|
254
|
+
}),
|
|
255
|
+
label: "Email subscribers"
|
|
256
|
+
})
|
|
257
|
+
]
|
|
258
|
+
}),
|
|
259
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
260
|
+
children: [
|
|
261
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
262
|
+
onClick: ()=>setDraft(null),
|
|
263
|
+
children: 'Cancel'
|
|
264
|
+
}),
|
|
265
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
266
|
+
variant: "contained",
|
|
267
|
+
color: "primary",
|
|
268
|
+
disabled: !(draft == null ? void 0 : draft.title.trim()) || (draft == null ? void 0 : draft.busy),
|
|
269
|
+
onClick: handlePublish,
|
|
270
|
+
children: 'Publish'
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
MemberPostsCard.displayName = 'MemberPostsCard';
|
|
281
|
+
export default MemberPostsCard;
|
|
282
|
+
|
|
283
|
+
//# sourceMappingURL=member-posts-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/member-posts-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 { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { ListPagination } from '@aglyn/shared-ui-jsx/components/list-pagination.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n FormControlLabel,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteDoc,\n doc,\n limit,\n orderBy,\n query,\n} from 'firebase/firestore'\nimport { useCallback, useState } from 'react'\nimport { useFirestore, useUser } from '@aglyn/tenant-feature-instance'\nimport {\n useFirestoreCollection,\n usePagedCollection,\n} from '@aglyn/tenant-feature-instance'\nimport { EntitlementGatedCard } from './entitlement-gate.component'\nimport { pluginDocsHelp } from '@aglyn/aglyn'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\n\nexport interface MemberPostsCardProps {\n hostId: string\n}\n\n/**\n * Member updates (AGL-316): posts for entitled subscribers, published\n * through a manager-gated API that can also email the audience. The\n * member-feed block renders them on the site.\n *\n * Gated on `contentGating` since AGL-2080, and this is the one of the five\n * that failed OPEN. `server/gate.ts:48` (`hostHasContentGating`) is what\n * decides whether `membership-content.ts`, `member-feed.ts` and `stream.ts`\n * withhold anything; without the entitlement it withholds nothing. So an\n * unentitled operator could mark a post members-only, see it accepted, and\n * have the renderer serve it to the public — believing content was protected\n * while it was not. A refusal the operator can see is the fix.\n */\n\nconst memberPostsHelp = pluginDocsHelp('membersOnly', {\n anchor: '#manage-your-members',\n})\n\nexport function MemberPostsCard(props: MemberPostsCardProps) {\n const { hostId } = props\n const firestore = useFirestore()\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n /*\n * Ordered by the SERVER, and a growing window rather than a fixed read.\n *\n * This was `limit(50)` with no `orderBy`, rendering `.slice(0, 8)`. A\n * Firestore query with a limit and no ordering returns DOCUMENT-ID order,\n * and posts are created with `.add()`, so those fifty were a pseudo-random\n * sample of the feed — the client sort below then ordered the sample and\n * showed eight of it, which looks newest-first and is not. Past fifty\n * posts, one written this morning could simply never appear.\n */\n const {\n rows: posts,\n hasMore,\n page,\n setPage,\n pageSize,\n setPageSize,\n } = usePagedCollection<any>(\n (pageLimit) =>\n query(\n collection(firestore, 'hosts', hostId, 'memberPosts'),\n orderBy('createdAtMs', 'desc'),\n limit(pageLimit),\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n const { data: productDocs } = useFirestoreCollection<any>(\n () => query(collection(firestore, 'hosts', hostId, 'products'), limit(200)),\n [firestore, hostId],\n { idField: '$id' },\n )\n const [draft, setDraft] = useState<{\n title: string\n body: string\n productId: string\n emailSubscribers: boolean\n busy?: boolean\n } | null>(null)\n\n const handlePublish = useCallback(async () => {\n if (!draft?.title.trim()) return\n setDraft((prev) => (prev ? { ...prev, busy: true } : prev))\n try {\n const response = await authorizedFetch(\n user,\n '/api/commerce/member-post',\n {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, ...draft }),\n },\n )\n const payload = await response.json()\n if (!response.ok) {\n return void enqueueSnackbar(payload?.error ?? 'Publish failed', {\n variant: 'error',\n allowDuplicate: true,\n })\n }\n enqueueSnackbar(\n payload.emailed\n ? `Published — emailed ${payload.emailed} subscribers`\n : 'Published',\n { variant: 'success', persist: false },\n )\n setDraft(null)\n } finally {\n setDraft((prev) => (prev ? { ...prev, busy: false } : prev))\n }\n }, [draft, user, hostId, enqueueSnackbar])\n\n return (\n <EntitlementGatedCard\n help={memberPostsHelp}\n hostId={hostId}\n feature=\"contentGating\"\n header={'Member updates'}\n upsell={\n 'Memberships and gated content keep posts, pages and video behind ' +\n 'a subscription, and publish updates to the members entitled to ' +\n 'them.'\n }\n >\n <CardDisplay\n header={'Member updates'}\n help={memberPostsHelp}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={1}>\n {posts.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Post updates only your subscribers can see (and optionally ' +\n 'email them). Add a Member feed block to a members screen.'}\n </Typography>\n ) : (\n posts.map((post: any) => (\n <Stack\n key={post.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center' }}\n >\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Typography variant=\"body2\" noWrap>\n {post.title}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {new Date(post.createdAtMs ?? 0).toLocaleDateString()}\n </Typography>\n </Stack>\n <Button\n size=\"small\"\n color=\"error\"\n onClick={() =>\n deleteDoc(\n doc(firestore, 'hosts', hostId, 'memberPosts', post.$id),\n )\n }\n >\n {'Delete'}\n </Button>\n </Stack>\n ))\n )}\n <ListPagination\n page={page}\n pageSize={pageSize}\n rowCount={posts.length}\n hasMore={hasMore}\n onPageChange={setPage}\n onPageSizeChange={setPageSize}\n />\n <Button\n size=\"small\"\n sx={{ alignSelf: 'flex-start' }}\n onClick={() =>\n setDraft({\n title: '',\n body: '',\n productId: '',\n emailSubscribers: true,\n })\n }\n >\n {'New update'}\n </Button>\n </Stack>\n <Dialog\n open={Boolean(draft)}\n onClose={() => setDraft(null)}\n maxWidth=\"sm\"\n fullWidth\n >\n <DialogTitle>{'New member update'}</DialogTitle>\n <DialogContent sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>\n <TextField\n label=\"Title\"\n value={draft?.title ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, title: event.target.value } : prev,\n )\n }\n size=\"small\"\n autoFocus\n sx={{ mt: 1 }}\n />\n <TextField\n label=\"Body\"\n value={draft?.body ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, body: event.target.value } : prev,\n )\n }\n size=\"small\"\n multiline\n minRows={4}\n />\n <TextField\n label=\"Audience\"\n value={draft?.productId ?? ''}\n onChange={(event) =>\n setDraft((prev) =>\n prev ? { ...prev, productId: event.target.value } : prev,\n )\n }\n size=\"small\"\n select\n >\n <MenuItem value=\"\">{'All live subscribers'}</MenuItem>\n {(productDocs ?? [])\n .filter((product: any) => product.subscription)\n .map((product: any) => (\n <MenuItem key={product.$id} value={product.$id}>\n {`Subscribers of ${product.name}`}\n </MenuItem>\n ))}\n </TextField>\n <FormControlLabel\n control={\n <Checkbox\n size=\"small\"\n checked={draft?.emailSubscribers ?? true}\n onChange={(event) =>\n setDraft((prev) =>\n prev\n ? { ...prev, emailSubscribers: event.target.checked }\n : prev,\n )\n }\n />\n }\n label=\"Email subscribers\"\n />\n </DialogContent>\n <DialogActions>\n <Button onClick={() => setDraft(null)}>{'Cancel'}</Button>\n <Button\n variant=\"contained\"\n color=\"primary\"\n disabled={!draft?.title.trim() || draft?.busy}\n onClick={handlePublish}\n >\n {'Publish'}\n </Button>\n </DialogActions>\n </Dialog>\n </CardDisplay>\n </EntitlementGatedCard>\n )\n}\nMemberPostsCard.displayName = 'MemberPostsCard'\n\nexport default MemberPostsCard\n"],"names":["CardDisplay","ListPagination","useSnackbar","Button","Checkbox","Dialog","DialogActions","DialogContent","DialogTitle","FormControlLabel","MenuItem","Stack","TextField","Typography","collection","deleteDoc","doc","limit","orderBy","query","useCallback","useState","useFirestore","useUser","useFirestoreCollection","usePagedCollection","EntitlementGatedCard","pluginDocsHelp","authorizedFetch","memberPostsHelp","anchor","MemberPostsCard","props","hostId","firestore","data","user","enqueueSnackbar","rows","posts","hasMore","page","setPage","pageSize","setPageSize","pageLimit","idField","productDocs","draft","setDraft","handlePublish","title","trim","prev","busy","response","method","headers","body","JSON","stringify","payload","json","ok","error","variant","allowDuplicate","emailed","persist","help","feature","header","upsell","contentGutterX","contentGutterY","spacing","length","color","map","post","direction","sx","alignItems","flex","minWidth","noWrap","Date","createdAtMs","toLocaleDateString","size","onClick","$id","rowCount","onPageChange","onPageSizeChange","alignSelf","productId","emailSubscribers","open","Boolean","onClose","maxWidth","fullWidth","display","flexDirection","gap","label","value","onChange","event","target","autoFocus","mt","multiline","minRows","select","filter","product","subscription","name","control","checked","disabled","displayName"],"mappings":"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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard glance at the newest site users (AGL-350).
|
|
3
|
+
*
|
|
4
|
+
* ## Why this card lives in the commerce package and registers as `accounts`
|
|
5
|
+
*
|
|
6
|
+
* It is a card about visitor ACCOUNTS, and the accounts capability is a
|
|
7
|
+
* switch a site turns on rather than a bundle that loads: the member blocks
|
|
8
|
+
* and every `membership/*` handler ship inside commerce, which is why
|
|
9
|
+
* `ACCOUNTS_PLUGIN_ID` has no manifest entry of its own. Registering the
|
|
10
|
+
* widget under that id is what puts the card behind the same switch as the
|
|
11
|
+
* `/signin` page it describes — the console dashboard used to import it
|
|
12
|
+
* directly, so a site that has never turned member accounts on still had
|
|
13
|
+
* `Newest site users` on its dashboard, permanently empty, advertising a
|
|
14
|
+
* feature it does not serve.
|
|
15
|
+
*
|
|
16
|
+
* ## Five, and no footer
|
|
17
|
+
*
|
|
18
|
+
* A deliberate preview, not a window that got cut short: the Users section
|
|
19
|
+
* owns the full, searchable, paged list and the header links to it. The
|
|
20
|
+
* pagination sweep records the same reading in `table-footer-consistency`.
|
|
21
|
+
*
|
|
22
|
+
* `orderBy('createdAt', 'desc')` is safe to name, checked against the writers
|
|
23
|
+
* rather than assumed — an `orderBy` DROPS documents missing the field, so a
|
|
24
|
+
* newest-first list can quietly become a some-of-them list. Every path that
|
|
25
|
+
* creates a member stamps it (`membership-register.ts` writes a
|
|
26
|
+
* `serverTimestamp()` on the only sign-up route, the seed and e2e fixtures
|
|
27
|
+
* stamp their own), and `siteMembers` is absent from `IMPORTABLE_FIELDS`, so
|
|
28
|
+
* no site-bundle restore can mint one without it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function NewestSiteUsersCard(props: {
|
|
31
|
+
hostId: string;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
33
|
+
export declare namespace NewestSiteUsersCard {
|
|
34
|
+
var displayName: string;
|
|
35
|
+
}
|
|
36
|
+
export default NewestSiteUsersCard;
|
|
@@ -0,0 +1,126 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
19
|
+
import { buildRoute, pluginDocsHelp, Route } from "@aglyn/aglyn";
|
|
20
|
+
import { AppLink, CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import { Button, Stack, Typography } from "@mui/material";
|
|
22
|
+
import { collection, limit, orderBy, query } from "firebase/firestore";
|
|
23
|
+
import { useParams } from "next/navigation";
|
|
24
|
+
import { useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-instance";
|
|
25
|
+
/**
|
|
26
|
+
* Dashboard glance at the newest site users (AGL-350).
|
|
27
|
+
*
|
|
28
|
+
* ## Why this card lives in the commerce package and registers as `accounts`
|
|
29
|
+
*
|
|
30
|
+
* It is a card about visitor ACCOUNTS, and the accounts capability is a
|
|
31
|
+
* switch a site turns on rather than a bundle that loads: the member blocks
|
|
32
|
+
* and every `membership/*` handler ship inside commerce, which is why
|
|
33
|
+
* `ACCOUNTS_PLUGIN_ID` has no manifest entry of its own. Registering the
|
|
34
|
+
* widget under that id is what puts the card behind the same switch as the
|
|
35
|
+
* `/signin` page it describes — the console dashboard used to import it
|
|
36
|
+
* directly, so a site that has never turned member accounts on still had
|
|
37
|
+
* `Newest site users` on its dashboard, permanently empty, advertising a
|
|
38
|
+
* feature it does not serve.
|
|
39
|
+
*
|
|
40
|
+
* ## Five, and no footer
|
|
41
|
+
*
|
|
42
|
+
* A deliberate preview, not a window that got cut short: the Users section
|
|
43
|
+
* owns the full, searchable, paged list and the header links to it. The
|
|
44
|
+
* pagination sweep records the same reading in `table-footer-consistency`.
|
|
45
|
+
*
|
|
46
|
+
* `orderBy('createdAt', 'desc')` is safe to name, checked against the writers
|
|
47
|
+
* rather than assumed — an `orderBy` DROPS documents missing the field, so a
|
|
48
|
+
* newest-first list can quietly become a some-of-them list. Every path that
|
|
49
|
+
* creates a member stamps it (`membership-register.ts` writes a
|
|
50
|
+
* `serverTimestamp()` on the only sign-up route, the seed and e2e fixtures
|
|
51
|
+
* stamp their own), and `siteMembers` is absent from `IMPORTABLE_FIELDS`, so
|
|
52
|
+
* no site-bundle restore can mint one without it.
|
|
53
|
+
*/ export function NewestSiteUsersCard(props) {
|
|
54
|
+
const { hostId } = props;
|
|
55
|
+
const firestore = useFirestore();
|
|
56
|
+
const { orgSlug, host } = useParams();
|
|
57
|
+
const { data: memberDocs } = useFirestoreCollection(()=>query(collection(firestore, 'hosts', hostId, 'siteMembers'), orderBy('createdAt', 'desc'), limit(5)), [
|
|
58
|
+
firestore,
|
|
59
|
+
hostId
|
|
60
|
+
], {
|
|
61
|
+
idField: '$id'
|
|
62
|
+
});
|
|
63
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
64
|
+
header: 'Newest site users',
|
|
65
|
+
help: pluginDocsHelp('membersOnly', {
|
|
66
|
+
anchor: '#manage-your-members',
|
|
67
|
+
excerpt: 'The five newest visitor accounts on this site — the Users page ' + 'has the full, searchable list.'
|
|
68
|
+
}),
|
|
69
|
+
contentGutterX: true,
|
|
70
|
+
contentGutterY: true,
|
|
71
|
+
HeaderProps: {
|
|
72
|
+
action: /*#__PURE__*/ _jsx(Button, _extends({
|
|
73
|
+
component: AppLink
|
|
74
|
+
}, {
|
|
75
|
+
componentVariant: 'naked',
|
|
76
|
+
nativeButton: false
|
|
77
|
+
}, {
|
|
78
|
+
href: buildRoute(Route.HOST_USERS, {
|
|
79
|
+
orgSlug,
|
|
80
|
+
host
|
|
81
|
+
}),
|
|
82
|
+
size: "small",
|
|
83
|
+
color: "primary",
|
|
84
|
+
children: 'View all'
|
|
85
|
+
}))
|
|
86
|
+
},
|
|
87
|
+
children: (memberDocs == null ? void 0 : memberDocs.length) ? /*#__PURE__*/ _jsx(Stack, {
|
|
88
|
+
spacing: 0.75,
|
|
89
|
+
children: memberDocs.map((member)=>{
|
|
90
|
+
var _member_createdAt_toDate, _member_createdAt;
|
|
91
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
92
|
+
direction: "row",
|
|
93
|
+
spacing: 1,
|
|
94
|
+
sx: {
|
|
95
|
+
justifyContent: 'space-between',
|
|
96
|
+
alignItems: 'center'
|
|
97
|
+
},
|
|
98
|
+
children: [
|
|
99
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
100
|
+
variant: "body2",
|
|
101
|
+
noWrap: true,
|
|
102
|
+
sx: {
|
|
103
|
+
minWidth: 0
|
|
104
|
+
},
|
|
105
|
+
children: member.displayName || member.name || member.email || member.$id
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
108
|
+
variant: "caption",
|
|
109
|
+
color: "text.secondary",
|
|
110
|
+
noWrap: true,
|
|
111
|
+
children: ((_member_createdAt = member.createdAt) == null ? void 0 : (_member_createdAt_toDate = _member_createdAt.toDate) == null ? void 0 : _member_createdAt_toDate.call(_member_createdAt)) ? member.createdAt.toDate().toLocaleDateString() : ''
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
}, member.$id);
|
|
115
|
+
})
|
|
116
|
+
}) : /*#__PURE__*/ _jsx(Typography, {
|
|
117
|
+
variant: "body2",
|
|
118
|
+
color: "text.secondary",
|
|
119
|
+
children: 'No site accounts yet — they appear when visitors sign up on ' + 'your site.'
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
NewestSiteUsersCard.displayName = 'NewestSiteUsersCard';
|
|
124
|
+
export default NewestSiteUsersCard;
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=newest-site-users-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/newest-site-users-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 { buildRoute, pluginDocsHelp, Route } from '@aglyn/aglyn'\nimport { AppLink, CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { Button, Stack, Typography } from '@mui/material'\nimport { collection, limit, orderBy, query } from 'firebase/firestore'\nimport { useParams } from 'next/navigation'\nimport { useFirestore, useFirestoreCollection } from '@aglyn/tenant-feature-instance'\n\n/**\n * Dashboard glance at the newest site users (AGL-350).\n *\n * ## Why this card lives in the commerce package and registers as `accounts`\n *\n * It is a card about visitor ACCOUNTS, and the accounts capability is a\n * switch a site turns on rather than a bundle that loads: the member blocks\n * and every `membership/*` handler ship inside commerce, which is why\n * `ACCOUNTS_PLUGIN_ID` has no manifest entry of its own. Registering the\n * widget under that id is what puts the card behind the same switch as the\n * `/signin` page it describes — the console dashboard used to import it\n * directly, so a site that has never turned member accounts on still had\n * `Newest site users` on its dashboard, permanently empty, advertising a\n * feature it does not serve.\n *\n * ## Five, and no footer\n *\n * A deliberate preview, not a window that got cut short: the Users section\n * owns the full, searchable, paged list and the header links to it. The\n * pagination sweep records the same reading in `table-footer-consistency`.\n *\n * `orderBy('createdAt', 'desc')` is safe to name, checked against the writers\n * rather than assumed — an `orderBy` DROPS documents missing the field, so a\n * newest-first list can quietly become a some-of-them list. Every path that\n * creates a member stamps it (`membership-register.ts` writes a\n * `serverTimestamp()` on the only sign-up route, the seed and e2e fixtures\n * stamp their own), and `siteMembers` is absent from `IMPORTABLE_FIELDS`, so\n * no site-bundle restore can mint one without it.\n */\nexport function NewestSiteUsersCard(props: { hostId: string }) {\n const { hostId } = props\n const firestore = useFirestore()\n const { orgSlug, host } = useParams<{ orgSlug: string; host: string }>()\n const { data: memberDocs } = useFirestoreCollection<any>(\n () =>\n query(\n collection(firestore, 'hosts', hostId, 'siteMembers'),\n orderBy('createdAt', 'desc'),\n limit(5),\n ),\n [firestore, hostId],\n { idField: '$id' },\n )\n\n return (\n <CardDisplay\n header={'Newest site users'}\n help={pluginDocsHelp('membersOnly', {\n anchor: '#manage-your-members',\n excerpt:\n 'The five newest visitor accounts on this site — the Users page ' +\n 'has the full, searchable list.',\n })}\n contentGutterX\n contentGutterY\n HeaderProps={{\n action: (\n <Button\n component={AppLink as any}\n {...({ componentVariant: 'naked', nativeButton: false } as any)}\n href={buildRoute(Route.HOST_USERS, { orgSlug, host })}\n size=\"small\"\n color=\"primary\"\n >\n {'View all'}\n </Button>\n ),\n }}\n >\n {memberDocs?.length ? (\n <Stack spacing={0.75}>\n {memberDocs.map((member: any) => (\n <Stack\n key={member.$id}\n direction=\"row\"\n spacing={1}\n sx={{ justifyContent: 'space-between', alignItems: 'center' }}\n >\n <Typography variant=\"body2\" noWrap sx={{ minWidth: 0 }}>\n {/*\n `displayName` first: that is the field sign-up writes, and a\n member document has never carried `name` — the tenant's\n campaign sender says so where it merges recipients. Reading\n `name` first meant every account rendered as an email\n address while the site knew the person's name.\n */}\n {member.displayName || member.name || member.email || member.$id}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\" noWrap>\n {member.createdAt?.toDate?.()\n ? member.createdAt.toDate().toLocaleDateString()\n : ''}\n </Typography>\n </Stack>\n ))}\n </Stack>\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No site accounts yet — they appear when visitors sign up on ' +\n 'your site.'}\n </Typography>\n )}\n </CardDisplay>\n )\n}\nNewestSiteUsersCard.displayName = 'NewestSiteUsersCard'\n\nexport default NewestSiteUsersCard\n"],"names":["buildRoute","pluginDocsHelp","Route","AppLink","CardDisplay","Button","Stack","Typography","collection","limit","orderBy","query","useParams","useFirestore","useFirestoreCollection","NewestSiteUsersCard","props","hostId","firestore","orgSlug","host","data","memberDocs","idField","header","help","anchor","excerpt","contentGutterX","contentGutterY","HeaderProps","action","component","componentVariant","nativeButton","href","HOST_USERS","size","color","length","spacing","map","member","direction","sx","justifyContent","alignItems","variant","noWrap","minWidth","displayName","name","email","$id","createdAt","toDate","toLocaleDateString"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,UAAU,EAAEC,cAAc,EAAEC,KAAK,QAAQ,eAAc;AAChE,SAASC,OAAO,EAAEC,WAAW,QAAQ,uBAAsB;AAC3D,SAASC,MAAM,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACzD,SAASC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,QAAQ,qBAAoB;AACtE,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SAASC,YAAY,EAAEC,sBAAsB,QAAQ,iCAAgC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GACD,OAAO,SAASC,oBAAoBC,KAAyB;IAC3D,MAAM,EAAEC,MAAM,EAAE,GAAGD;IACnB,MAAME,YAAYL;IAClB,MAAM,EAAEM,OAAO,EAAEC,IAAI,EAAE,GAAGR;IAC1B,MAAM,EAAES,MAAMC,UAAU,EAAE,GAAGR,uBAC3B,IACEH,MACEH,WAAWU,WAAW,SAASD,QAAQ,gBACvCP,QAAQ,aAAa,SACrBD,MAAM,KAEV;QAACS;QAAWD;KAAO,EACnB;QAAEM,SAAS;IAAM;IAGnB,qBACE,KAACnB;QACCoB,QAAQ;QACRC,MAAMxB,eAAe,eAAe;YAClCyB,QAAQ;YACRC,SACE,oEACA;QACJ;QACAC,cAAc;QACdC,cAAc;QACdC,aAAa;YACXC,sBACE,KAAC1B;gBACC2B,WAAW7B;eACN;gBAAE8B,kBAAkB;gBAASC,cAAc;YAAM;gBACtDC,MAAMnC,WAAWE,MAAMkC,UAAU,EAAE;oBAAEjB;oBAASC;gBAAK;gBACnDiB,MAAK;gBACLC,OAAM;0BAEL;;QAGP;kBAEChB,CAAAA,8BAAAA,WAAYiB,MAAM,kBACjB,KAACjC;YAAMkC,SAAS;sBACblB,WAAWmB,GAAG,CAAC,CAACC;oBAkBVA,0BAAAA;qCAjBL,MAACpC;oBAECqC,WAAU;oBACVH,SAAS;oBACTI,IAAI;wBAAEC,gBAAgB;wBAAiBC,YAAY;oBAAS;;sCAE5D,KAACvC;4BAAWwC,SAAQ;4BAAQC,MAAM;4BAACJ,IAAI;gCAAEK,UAAU;4BAAE;sCAQlDP,OAAOQ,WAAW,IAAIR,OAAOS,IAAI,IAAIT,OAAOU,KAAK,IAAIV,OAAOW,GAAG;;sCAElE,KAAC9C;4BAAWwC,SAAQ;4BAAUT,OAAM;4BAAiBU,MAAM;sCACxDN,EAAAA,oBAAAA,OAAOY,SAAS,sBAAhBZ,2BAAAA,kBAAkBa,MAAM,qBAAxBb,8BAAAA,sBACGA,OAAOY,SAAS,CAACC,MAAM,GAAGC,kBAAkB,KAC5C;;;mBAlBDd,OAAOW,GAAG;;2BAwBrB,KAAC9C;YAAWwC,SAAQ;YAAQT,OAAM;sBAC/B,iEACC;;;AAKZ;AACAvB,oBAAoBmC,WAAW,GAAG;AAElC,eAAenC,oBAAmB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as CommerceModel from '../../model';
|
|
2
|
+
export interface OrderDetailDialogProps {
|
|
3
|
+
hostId: string;
|
|
4
|
+
order: (CommerceModel.HostOrder & {
|
|
5
|
+
$id: string;
|
|
6
|
+
}) | null;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The dispute chip's colour (AGL-1796).
|
|
11
|
+
*
|
|
12
|
+
* `open` is WARNING rather than error because it is the case that still has a
|
|
13
|
+
* deadline on it — the merchant can still act, and a red chip on a case they
|
|
14
|
+
* might win says the money is gone when it is not. `lost` is the one that took
|
|
15
|
+
* the money, and shares `refunded`'s red for that reason.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DISPUTE_COLOR: Record<CommerceModel.OrderDisputeTone, 'default' | 'success' | 'warning' | 'error'>;
|
|
18
|
+
/**
|
|
19
|
+
* Order detail (AGL-287): timeline, line items, totals, and the actions
|
|
20
|
+
* the status machine allows — fulfill with tracking, refund, cancel, mark
|
|
21
|
+
* delivered (each a server route that re-asks the transition under the
|
|
22
|
+
* write), notes, printable packing slip.
|
|
23
|
+
*/
|
|
24
|
+
export declare function OrderDetailDialog(props: OrderDetailDialogProps): import("react").JSX.Element;
|
|
25
|
+
export declare namespace OrderDetailDialog {
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
28
|
+
export default OrderDetailDialog;
|