@vtex/faststore 0.0.6 → 0.0.8
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/CHANGELOG.md +99 -0
- package/dist/actions.json +152 -1
- package/dist/catalog.json +2541 -1278
- package/dist/cli/UnreachableCaseError-Crd168Vu.js +10 -0
- package/dist/cli/UnreachableCaseError-Crd168Vu.js.map +1 -0
- package/dist/cli/cacheControl-CEojH_TM.js +158 -0
- package/dist/cli/cacheControl-CEojH_TM.js.map +1 -0
- package/dist/cli/cachePolicy-m2vASMRW.js +26 -0
- package/dist/cli/cachePolicy-m2vASMRW.js.map +1 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js +10 -0
- package/dist/cli/computeCoreSchemaHash-DPJZj-qJ.js.map +1 -0
- package/dist/cli/default-BCQHcwbL.js +253 -0
- package/dist/cli/default-BCQHcwbL.js.map +1 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js +21 -0
- package/dist/cli/disableSuggestions-yO9UqiWn.js.map +1 -0
- package/dist/cli/dist-C1JhdHfo.js +2001 -0
- package/dist/cli/dist-C1JhdHfo.js.map +1 -0
- package/dist/cli/graphql-DG9thCDG.js +14589 -0
- package/dist/cli/graphql-DG9thCDG.js.map +1 -0
- package/dist/cli/index.d.ts +799 -0
- package/dist/cli/index.js +36459 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.min-BsIHDfFK.js +613 -0
- package/dist/cli/index.min-BsIHDfFK.js.map +1 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js +52 -0
- package/dist/cli/inlineTrace-uLgOJ3TH.js.map +1 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js +11 -0
- package/dist/cli/internalPlugin-DnuwN4_4.js.map +1 -0
- package/dist/cli/packageVersion-DQAnIEil.js +6 -0
- package/dist/cli/packageVersion-DQAnIEil.js.map +1 -0
- package/dist/cli/rolldown-runtime-BMI-E3GI.js +44 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js +17 -0
- package/dist/cli/schemaIsSubgraph-DoGh3OYj.js.map +1 -0
- package/dist/cli/schemaReporting-K-me-3-v.js +199 -0
- package/dist/cli/schemaReporting-K-me-3-v.js.map +1 -0
- package/dist/cli/server-runtime.js +49879 -0
- package/dist/cli/server-runtime.js.map +1 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js +9118 -0
- package/dist/cli/traceTreeBuilder-BIcV2U7b.js.map +1 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js +10201 -0
- package/dist/cli/usageReporting-Bpl8vSZX.js.map +1 -0
- package/dist/cli/v4-CBhFvC49.js +42 -0
- package/dist/cli/v4-CBhFvC49.js.map +1 -0
- package/dist/client.d.ts +5 -1
- package/dist/client.js +5 -1
- package/dist/components.d.ts +38 -9
- package/dist/components.js +42 -13
- package/dist/content-types.json +616 -0
- package/dist/core/dist/define-component.d.ts +43 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/account-access-gate.md +4 -4
- package/dist/docs/account-address-book.md +519 -0
- package/dist/docs/account-entry-point.md +1 -1
- package/dist/docs/account-menu-identity.md +160 -0
- package/dist/docs/account-menu.md +107 -24
- package/dist/docs/alert-dialog.md +2 -2
- package/dist/docs/avatar.md +103 -0
- package/dist/docs/billing-address.md +17 -9
- package/dist/docs/card-entry.md +37 -6
- package/dist/docs/cardholder-document.md +16 -14
- package/dist/docs/cart-item.md +1 -1
- package/dist/docs/cart.md +8 -8
- package/dist/docs/client-profile-fieldset.md +7 -5
- package/dist/docs/copy-text.md +84 -0
- package/dist/docs/document-field.md +8 -8
- package/dist/docs/footer-link-group.md +2 -2
- package/dist/docs/header-root.md +1 -1
- package/dist/docs/incentives.md +2 -2
- package/dist/docs/logo.md +5 -5
- package/dist/docs/my-account-profile.md +5 -5
- package/dist/docs/navigation-link-list.md +2 -2
- package/dist/docs/navigation-link.md +3 -3
- package/dist/docs/order-cancel.md +52 -0
- package/dist/docs/order-delivery-address.md +63 -0
- package/dist/docs/order-delivery-group.md +83 -0
- package/dist/docs/order-details-back.md +41 -0
- package/dist/docs/order-details-header.md +48 -0
- package/dist/docs/order-list-row.md +46 -0
- package/dist/docs/order-list-search.md +101 -0
- package/dist/docs/order-list-views.md +97 -0
- package/dist/docs/order-list.md +94 -0
- package/dist/docs/order-payment.md +94 -0
- package/dist/docs/order-placed-date.md +49 -0
- package/dist/docs/order-placed-payment-summary.md +13 -15
- package/dist/docs/order-placed.md +225 -0
- package/dist/docs/order-progress.md +88 -0
- package/dist/docs/order-status-badge.md +91 -0
- package/dist/docs/order-summary.md +53 -0
- package/dist/docs/payment-method-badges.md +14 -3
- package/dist/docs/place-order.md +13 -9
- package/dist/docs/product-shelf.md +20 -13
- package/dist/docs/saved-cards.md +2 -2
- package/dist/docs/select.md +19 -6
- package/dist/docs/session.md +1 -1
- package/dist/docs/shipping-address.md +1 -1
- package/dist/docs/sign-in-redirect.md +6 -6
- package/dist/docs/toast.md +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +2 -1
- package/dist/internal/client.d.ts +6 -1
- package/dist/internal/client.js +8 -3
- package/dist/internal/content.d.ts +2 -2
- package/dist/internal/server.d.ts +8 -1
- package/dist/internal/server.js +8 -1
- package/dist/matter/account-access-gate/account-access-gate.d.ts +2 -1
- package/dist/matter/account-access-gate/account-access-gate.js +19 -16
- package/dist/matter/account-access-gate/account-access-gate.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +60 -0
- package/dist/matter/account-address-book/account-address-book-delete.js +184 -0
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +19 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js +50 -0
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +42 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js +146 -0
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +25 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +72 -0
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -0
- package/dist/matter/account-address-book/account-address-book.d.ts +120 -0
- package/dist/matter/account-address-book/account-address-book.js +469 -0
- package/dist/matter/account-address-book/account-address-book.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country-switch.js +59 -0
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -0
- package/dist/matter/account-address-book/account-address-country.d.ts +36 -0
- package/dist/matter/account-address-book/account-address-country.js +151 -0
- package/dist/matter/account-address-book/account-address-country.js.map +1 -0
- package/dist/matter/account-address-book/account-address-first-line.js +11 -0
- package/dist/matter/account-address-book/account-address-first-line.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form-context.d.ts +55 -0
- package/dist/matter/account-address-book/account-address-form-context.js +14 -0
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -0
- package/dist/matter/account-address-book/account-address-form.d.ts +85 -0
- package/dist/matter/account-address-book/account-address-form.js +946 -0
- package/dist/matter/account-address-book/account-address-form.js.map +1 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js +189 -0
- package/dist/matter/account-address-book/account-address-postal-autofill.js.map +1 -0
- package/dist/matter/account-address-book/account-address-record.d.ts +26 -0
- package/dist/matter/account-address-book/account-address-record.js +138 -0
- package/dist/matter/account-address-book/account-address-record.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.js +11 -11
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +77 -3
- package/dist/matter/account-menu/account-menu.js +252 -19
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu/sign-out-failure.js +50 -0
- package/dist/matter/account-menu/sign-out-failure.js.map +1 -0
- package/dist/matter/account-menu-identity/account-menu-identity.d.ts +21 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js +88 -0
- package/dist/matter/account-menu-identity/account-menu-identity.js.map +1 -0
- package/dist/matter/billing-address/billing-address.d.ts +30 -17
- package/dist/matter/billing-address/billing-address.js +128 -33
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.js +2 -2
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +4 -3
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +5 -3
- package/dist/matter/card-entry/card-entry.js +78 -27
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cardholder-document/cardholder-document.d.ts +10 -9
- package/dist/matter/cardholder-document/cardholder-document.js +36 -16
- package/dist/matter/cardholder-document/cardholder-document.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +7 -2
- package/dist/matter/cart/cart.js +29 -26
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-item/cart-item.js +2 -2
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences-fieldset.js +2 -2
- package/dist/matter/client-profile-form/client-profile-fieldset.js +9 -6
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.js +3 -3
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.js +4 -3
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +6 -3
- package/dist/matter/my-account-profile/my-account-profile.js +6 -5
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +110 -0
- package/dist/matter/order-cancel/order-cancel.js +344 -0
- package/dist/matter/order-cancel/order-cancel.js.map +1 -0
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +73 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js +172 -0
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -0
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +128 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js +408 -0
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -0
- package/dist/matter/order-details-header/order-details-header.d.ts +104 -0
- package/dist/matter/order-details-header/order-details-header.js +190 -0
- package/dist/matter/order-details-header/order-details-header.js.map +1 -0
- package/dist/matter/order-list/customer-orders-filter.d.ts +12 -0
- package/dist/matter/order-list/customer-orders-filter.js +30 -0
- package/dist/matter/order-list/customer-orders-filter.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +121 -0
- package/dist/matter/order-list/order-list.js +395 -0
- package/dist/matter/order-list/order-list.js.map +1 -0
- package/dist/matter/order-list-row/order-list-row.d.ts +44 -0
- package/dist/matter/order-list-row/order-list-row.js +127 -0
- package/dist/matter/order-list-row/order-list-row.js.map +1 -0
- package/dist/matter/order-list-search/order-list-search.d.ts +72 -0
- package/dist/matter/order-list-search/order-list-search.js +296 -0
- package/dist/matter/order-list-search/order-list-search.js.map +1 -0
- package/dist/matter/order-list-views/order-list-views.d.ts +65 -0
- package/dist/matter/order-list-views/order-list-views.js +154 -0
- package/dist/matter/order-list-views/order-list-views.js.map +1 -0
- package/dist/matter/order-payment/order-payment.d.ts +83 -0
- package/dist/matter/order-payment/order-payment.js +258 -0
- package/dist/matter/order-payment/order-payment.js.map +1 -0
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +145 -0
- package/dist/matter/order-placed/order-placed-deliveries.js +380 -0
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -0
- package/dist/matter/order-placed/order-placed.d.ts +122 -0
- package/dist/matter/order-placed/order-placed.js +452 -0
- package/dist/matter/order-placed/order-placed.js.map +1 -0
- package/dist/matter/order-placed-date/order-placed-date.d.ts +45 -0
- package/dist/matter/order-placed-date/order-placed-date.js +92 -0
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +5 -8
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +29 -81
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +85 -0
- package/dist/matter/order-progress/order-progress.js +203 -0
- package/dist/matter/order-progress/order-progress.js.map +1 -0
- package/dist/matter/order-summary/order-summary.d.ts +81 -0
- package/dist/matter/order-summary/order-summary.js +192 -0
- package/dist/matter/order-summary/order-summary.js.map +1 -0
- package/dist/matter/payment/cardholder-document-rule.d.ts +35 -0
- package/dist/matter/payment/cardholder-document-rule.js +35 -0
- package/dist/matter/payment/cardholder-document-rule.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +38 -23
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.js +12 -0
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +4 -2
- package/dist/matter/payment/payment-method-badges.js.map +1 -1
- package/dist/matter/payment/payment.js +12 -0
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +39 -0
- package/dist/matter/payment/use-payment-method-selection.js +30 -2
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +16 -2
- package/dist/matter/payment/use-payment-submit-gate.js +42 -14
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +12 -7
- package/dist/matter/place-order/place-order.js +126 -103
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.js +5 -5
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +61 -31
- package/dist/matter/product-shelf/product-shelf.js +157 -57
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.js +1 -1
- package/dist/matter/saved-cards/saved-cards.js +27 -15
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/session/session.js +2 -2
- package/dist/matter/session/session.js.map +1 -1
- package/dist/matter/shipping-address/country-descriptors.d.ts +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +23 -1
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/shipping-address.js +63 -15
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in-redirect/sign-in-redirect.js +48 -10
- package/dist/matter/sign-in-redirect/sign-in-redirect.js.map +1 -1
- package/dist/matter/variant-selector/variant-selector.js +2 -2
- package/dist/matter/variant-selector/variant-selector.js.map +1 -1
- package/dist/particles/address-summary/address-summary.js +2 -2
- package/dist/particles/address-summary/address-summary.js.map +1 -1
- package/dist/particles/alert-dialog/alert-dialog.d.ts +5 -1
- package/dist/particles/alert-dialog/alert-dialog.js +5 -2
- package/dist/particles/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/particles/avatar/avatar.d.ts +17 -0
- package/dist/particles/avatar/avatar.js +65 -0
- package/dist/particles/avatar/avatar.js.map +1 -0
- package/dist/particles/copy-text/copy-text.d.ts +28 -0
- package/dist/particles/copy-text/copy-text.js +140 -0
- package/dist/particles/copy-text/copy-text.js.map +1 -0
- package/dist/particles/document-field/document-field.d.ts +34 -5
- package/dist/particles/document-field/document-field.js +115 -19
- package/dist/particles/document-field/document-field.js.map +1 -1
- package/dist/particles/field/field.js +1 -1
- package/dist/particles/field/field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.d.ts +6 -2
- package/dist/particles/footer-link-group/footer-link-group.js +18 -7
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/incentives/incentives.d.ts +6 -2
- package/dist/particles/incentives/incentives.js +7 -2
- package/dist/particles/incentives/incentives.js.map +1 -1
- package/dist/particles/logo/logo.d.ts +3 -2
- package/dist/particles/logo/logo.js +20 -8
- package/dist/particles/logo/logo.js.map +1 -1
- package/dist/particles/navigation-link/navigation-link.d.ts +2 -3
- package/dist/particles/navigation-link/navigation-link.js +4 -4
- package/dist/particles/navigation-link/navigation-link.js.map +1 -1
- package/dist/particles/navigation-link-list/navigation-link-list.d.ts +6 -2
- package/dist/particles/navigation-link-list/navigation-link-list.js +18 -7
- package/dist/particles/navigation-link-list/navigation-link-list.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +28 -0
- package/dist/particles/order-details-back/order-details-back.js +52 -0
- package/dist/particles/order-details-back/order-details-back.js.map +1 -0
- package/dist/particles/order-status-badge/order-status-badge.d.ts +19 -0
- package/dist/particles/order-status-badge/order-status-badge.js +50 -0
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -0
- package/dist/particles/phone-field/phone-field.js +2 -2
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/select/select.js +6 -6
- package/dist/particles/select/select.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +1 -1
- package/dist/particles/toast/toast.js +32 -6
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +1079 -54
- package/dist/sdk/actions/address-action-provider.d.ts +16 -0
- package/dist/sdk/actions/address-action-provider.js +20 -0
- package/dist/sdk/actions/address-action-provider.js.map +1 -0
- package/dist/sdk/actions/analytics-action-provider.js +1 -1
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/order-action-provider.d.ts +12 -0
- package/dist/sdk/actions/order-action-provider.js +16 -0
- package/dist/sdk/actions/order-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/address/address-fields.js +38 -0
- package/dist/sdk/address/address-fields.js.map +1 -0
- package/dist/sdk/address/checkout-readiness.js +17 -0
- package/dist/sdk/address/checkout-readiness.js.map +1 -0
- package/dist/sdk/address/constants.js +60 -0
- package/dist/sdk/address/constants.js.map +1 -0
- package/dist/sdk/address/country-display.js +19 -0
- package/dist/sdk/address/country-display.js.map +1 -0
- package/dist/sdk/address/country-rules.js +30 -0
- package/dist/sdk/address/country-rules.js.map +1 -0
- package/dist/sdk/address/format-address.js +18 -0
- package/dist/sdk/address/format-address.js.map +1 -0
- package/dist/sdk/address/iso-countries.js +262 -0
- package/dist/sdk/address/iso-countries.js.map +1 -0
- package/dist/sdk/address/layouts.js +56 -0
- package/dist/sdk/address/layouts.js.map +1 -0
- package/dist/sdk/address/messages.js +97 -0
- package/dist/sdk/address/messages.js.map +1 -0
- package/dist/sdk/address/operations.d.ts +54 -0
- package/dist/sdk/address/operations.js +83 -0
- package/dist/sdk/address/operations.js.map +1 -0
- package/dist/sdk/address/postal-code-lookup-operations.js +23 -0
- package/dist/sdk/address/postal-code-lookup-operations.js.map +1 -0
- package/dist/sdk/address/postal-code.js +11 -0
- package/dist/sdk/address/postal-code.js.map +1 -0
- package/dist/sdk/address/schema.js +14 -0
- package/dist/sdk/address/schema.js.map +1 -0
- package/dist/sdk/address/server-fields.js +25 -0
- package/dist/sdk/address/server-fields.js.map +1 -0
- package/dist/sdk/address/switch-country.js +57 -0
- package/dist/sdk/address/switch-country.js.map +1 -0
- package/dist/sdk/address/types.d.ts +26 -0
- package/dist/sdk/address/use-address-actions.d.ts +29 -0
- package/dist/sdk/address/use-address-actions.js +247 -0
- package/dist/sdk/address/use-address-actions.js.map +1 -0
- package/dist/sdk/address/use-address-by-postal-code.js +57 -0
- package/dist/sdk/address/use-address-by-postal-code.js.map +1 -0
- package/dist/sdk/address/validate-address.js +62 -0
- package/dist/sdk/address/validate-address.js.map +1 -0
- package/dist/sdk/analytics/use-analytics-actions.js +2 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cache/storefront-cache.js +29 -4
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js +9 -8
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js +2 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
- package/dist/sdk/client/fetch-page-data.d.ts +11 -0
- package/dist/sdk/client/fetch-page-data.js +12 -1
- package/dist/sdk/client/fetch-page-data.js.map +1 -1
- package/dist/sdk/content/create-content-runtime.d.ts +22 -1
- package/dist/sdk/content/create-content-runtime.js +90 -9
- package/dist/sdk/content/create-content-runtime.js.map +1 -1
- package/dist/sdk/data/empty-content-value.js +16 -0
- package/dist/sdk/data/empty-content-value.js.map +1 -0
- package/dist/sdk/data/failed-fields.js +23 -0
- package/dist/sdk/data/failed-fields.js.map +1 -0
- package/dist/sdk/data/hot-data-provider.js +2 -1
- package/dist/sdk/data/hot-data-provider.js.map +1 -1
- package/dist/sdk/data/index.js +1 -1
- package/dist/sdk/data/page-reactive-data-root.d.ts +45 -7
- package/dist/sdk/data/page-reactive-data-root.js +88 -12
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/variables-from-content.d.ts +43 -0
- package/dist/sdk/data/variables-from-content.js +57 -0
- package/dist/sdk/data/variables-from-content.js.map +1 -0
- package/dist/sdk/generated/fragment-types.js +2 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -1
- package/dist/sdk/generated/gql.js +4 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +8 -0
- package/dist/sdk/generated/graphql.js +296 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/messages/en-US.js +138 -1
- package/dist/sdk/i18n/messages/en-US.json +138 -1
- package/dist/sdk/i18n/messages/en-US.json.d.ts +137 -0
- package/dist/sdk/i18n/messages/es-ES.js +138 -1
- package/dist/sdk/i18n/messages/es-ES.json +138 -1
- package/dist/sdk/i18n/messages/pt-BR.js +138 -1
- package/dist/sdk/i18n/messages/pt-BR.json +138 -1
- package/dist/sdk/identity/use-identity-actions.js +5 -4
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/current-page.js +30 -0
- package/dist/sdk/navigation/current-page.js.map +1 -0
- package/dist/sdk/navigation/not-found-log.d.ts +28 -0
- package/dist/sdk/navigation/not-found-log.js +133 -0
- package/dist/sdk/navigation/not-found-log.js.map +1 -0
- package/dist/sdk/navigation/path.js +25 -0
- package/dist/sdk/navigation/path.js.map +1 -0
- package/dist/sdk/navigation/redirect.d.ts +11 -0
- package/dist/sdk/navigation/redirect.js +22 -0
- package/dist/sdk/navigation/redirect.js.map +1 -0
- package/dist/sdk/navigation/report.js +70 -0
- package/dist/sdk/navigation/report.js.map +1 -0
- package/dist/sdk/navigation/resolve-storefront-href.d.ts +12 -0
- package/dist/sdk/navigation/resolve-storefront-href.js +214 -0
- package/dist/sdk/navigation/resolve-storefront-href.js.map +1 -0
- package/dist/sdk/navigation/route-identity-provider.d.ts +11 -0
- package/dist/sdk/navigation/route-identity-provider.js +20 -0
- package/dist/sdk/navigation/route-identity-provider.js.map +1 -0
- package/dist/sdk/navigation/route-map-provider.d.ts +19 -0
- package/dist/sdk/navigation/route-map-provider.js +29 -0
- package/dist/sdk/navigation/route-map-provider.js.map +1 -0
- package/dist/sdk/navigation/storefront-link.d.ts +16 -0
- package/dist/sdk/navigation/storefront-link.js +66 -0
- package/dist/sdk/navigation/storefront-link.js.map +1 -0
- package/dist/sdk/navigation/types.d.ts +45 -0
- package/dist/sdk/navigation/use-storefront-navigation.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-navigation.js +73 -0
- package/dist/sdk/navigation/use-storefront-navigation.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-route.d.ts +26 -0
- package/dist/sdk/navigation/use-storefront-route.js +87 -0
- package/dist/sdk/navigation/use-storefront-route.js.map +1 -0
- package/dist/sdk/navigation/use-storefront-search-params.d.ts +11 -0
- package/dist/sdk/navigation/use-storefront-search-params.js +16 -0
- package/dist/sdk/navigation/use-storefront-search-params.js.map +1 -0
- package/dist/sdk/orders/completion-badge.d.ts +8 -0
- package/dist/sdk/orders/completion-badge.js +47 -0
- package/dist/sdk/orders/completion-badge.js.map +1 -0
- package/dist/sdk/orders/order-operations.d.ts +19 -0
- package/dist/sdk/orders/order-operations.js +21 -0
- package/dist/sdk/orders/order-operations.js.map +1 -0
- package/dist/sdk/orders/use-order-actions.d.ts +23 -0
- package/dist/sdk/orders/use-order-actions.js +62 -0
- package/dist/sdk/orders/use-order-actions.js.map +1 -0
- package/dist/sdk/payment/gateway-origin.js +26 -13
- package/dist/sdk/payment/gateway-origin.js.map +1 -1
- package/dist/sdk/payment/gateway.d.ts +14 -2
- package/dist/sdk/payment/gateway.js +32 -14
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.js +11 -0
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/submission-registry.d.ts +2 -1
- package/dist/sdk/payment/submission-registry.js +12 -8
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +5 -3
- package/dist/sdk/payment/use-payment-actions.js +6 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +6 -3
- package/dist/sdk/payment/use-place-order.js +334 -144
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/region/use-region-actions.js +2 -1
- package/dist/sdk/region/use-region-actions.js.map +1 -1
- package/dist/sdk/seo/page-alternates.d.ts +55 -0
- package/dist/sdk/seo/page-alternates.js +132 -0
- package/dist/sdk/seo/page-alternates.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +21 -0
- package/dist/sdk/session/read-server-session.js +61 -0
- package/dist/sdk/session/read-server-session.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js +5 -4
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/session/use-session-revalidation.js +2 -1
- package/dist/sdk/session/use-session-revalidation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js +3 -2
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/utils/own-value.js +19 -0
- package/dist/utils/own-value.js.map +1 -0
- package/dist/utils/safe-href.d.ts +11 -0
- package/dist/utils/safe-href.js +31 -22
- package/dist/utils/safe-href.js.map +1 -1
- package/package.json +17 -2
- package/skills/storefront-asset/SKILL.md +111 -0
- package/skills/storefront-asset/references/api-side.md +153 -0
- package/skills/storefront-asset/references/findings.md +40 -0
- package/skills/storefront-asset/references/ui-side.md +94 -0
- package/src/styles/tailwind.css +27 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-entry-point.js","names":[],"sources":["../../../src/matter/account-entry-point/account-entry-point.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport { usePathname } from 'next/navigation';\nimport { type ComponentPropsWithRef, useEffect, useState } from 'react';\nimport { Icon } from '../../particles/icon/icon.js';\nimport { NavigationLink } from '../../particles/navigation-link/navigation-link.js';\nimport { resolveSignInHref } from '../../utils/safe-href.js';\nimport { useSession } from '../session/session.js';\n\n/** The account's root. A fixed convention, never an authored value: an authored destination could\n * misroute the entry into the account. */\nconst ACCOUNT_ROUTE = '/account';\n\n// Nothing is required: an entry may author any subset, and a slice missing a required property is\n// shape-invalid, which drops the whole element rather than the one field.\nexport const AccountEntryPointContent = defineContentType({\n id: 'account-entry-point',\n title: 'Account Entry Point',\n description: 'Labels and icon for the header sign-in / account control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n signedOutLabel: { type: 'string', minLength: 1, title: 'Signed-out label' },\n signedInLabel: { type: 'string', minLength: 1, title: 'Signed-in label' },\n icon: { type: 'string', minLength: 1, title: 'Icon' },\n loadingLabel: { type: 'string', minLength: 1, title: 'Loading announcement' },\n },\n },\n});\n\n/** Props for {@link AccountEntryPoint}. Extends native `<a>` attributes (the rendered root). */\nexport type AccountEntryPointProps = Omit<ComponentPropsWithRef<'a'>, 'href' | 'children'> & {\n /** Label for anonymous and identified shoppers. Optional: the render gate, not the type,\n * requires a resolved value. */\n signedOutLabel?: string;\n /** Label for logged-in shoppers. Same gate. */\n signedInLabel?: string;\n /** Icon reference for the glyph. Never gated: a control with no glyph is a valid configuration. */\n icon?: string;\n /** Text the live region announces while the session resolves. */\n loadingLabel?: string;\n /** Merchant-authored fields, sliced from the page/layout content entry; win over the props field\n * by field when present. Absent in a non-CMS store — the props are the fallback. */\n $content?: ContentValue<typeof AccountEntryPointContent>;\n};\n\n/** Props for {@link AccountEntryPointLoading}. Extends native `<span>` attributes. */\nexport type AccountEntryPointLoadingProps = Omit<ComponentPropsWithRef<'span'>, 'children'>;\n\nexport const AccountEntryPointDefinition = defineComponent<AccountEntryPointProps>({\n name: 'AccountEntryPoint',\n importPath: '@vtex/faststore/components',\n component: AccountEntryPoint,\n content: AccountEntryPointContent,\n editor: { label: 'Account Entry Point', category: 'identity' },\n requiresContext: 'session',\n schema: {\n signedOutLabel: { type: 'string', label: 'Signed-out Label' },\n signedInLabel: { type: 'string', label: 'Signed-in Label' },\n icon: { type: 'icon', label: 'Icon' },\n loadingLabel: { type: 'string', label: 'Loading Announcement' },\n },\n guideline:\n 'Session-aware header control rendering one link: the signed-out label toward /login for anonymous and identified shoppers, the signed-in label toward the account route for logged-in ones, and a politely announced placeholder while the session resolves. Both destinations are fixed conventions, not props, so no authored value can misroute the auth flow. Must be inside a SessionRoot, normally the one hosted by the shared layout; a page-hosted provider also works, since the server-side session fetch forwards the shopper cookie. Author the label for a state or that state renders nothing; the labels are optional in the type only because a CMS entry may supply them, and an entry overrides all four fields at runtime. Style it through data-fs-account-entry-point and switch on data-fs-account-entry-point-state.',\n});\n\nexport function AccountEntryPoint({\n signedOutLabel,\n signedInLabel,\n icon,\n loadingLabel,\n $content,\n className,\n ref,\n ...props\n}: AccountEntryPointProps) {\n const { state, loading } = useSession();\n const pathname = usePathname();\n\n // Blank entry fields fall through, so clearing one in the Admin reads as unauthored.\n const entrySignedOutLabel = $content?.signedOutLabel?.trim() ? $content.signedOutLabel : signedOutLabel;\n const entrySignedInLabel = $content?.signedInLabel?.trim() ? $content.signedInLabel : signedInLabel;\n const entryIcon = $content?.icon?.trim() ? $content.icon : icon;\n const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;\n\n // Assistive technology only reports a change inside a region that was already in the tree, so a\n // region mounted together with its text announces nothing. The region therefore holds the same\n // position in both branches — React keeps it mounted across the swap — and starts empty, with the\n // label written on the pass after mount and cleared again once the session resolves.\n //\n // It trails the branch content rather than leading it so the authored swatch, which lands on\n // whichever element leads, can still reach the region through a following-sibling selector.\n const [announcement, setAnnouncement] = useState('');\n const resolvingLabel = loading ? entryLoadingLabel : undefined;\n useEffect(() => {\n setAnnouncement(resolvingLabel ?? '');\n }, [resolvingLabel]);\n\n // Gate on `loading` before `state`: an unresolved session reports `anonymous`, so reading the\n // tri-state first would flash \"Sign In\" at a shopper who is already signed in.\n if (loading) {\n return (\n <>\n <AccountEntryPointLoading {...props} className={className} />\n <AccountEntryPointAnnouncement>{announcement}</AccountEntryPointAnnouncement>\n </>\n );\n }\n\n // `identified` stays on the signed-out link: an identified but unauthenticated shopper cannot\n // reach their account yet.\n const signedIn = state === 'loggedIn';\n const label = signedIn ? entrySignedInLabel : entrySignedOutLabel;\n\n // A focusable link a screen reader announces as its bare URL is worse than no control at all.\n if (!label?.trim()) {\n return null;\n }\n\n return (\n <>\n <NavigationLink\n {...props}\n ref={ref}\n href={signedIn ? ACCOUNT_ROUTE : resolveSignInHref(pathname)}\n // The signed-out destination is a deferred auth proxy that may set a cookie or redirect, and\n // a header control is always in the viewport — the default prefetch would fire that GET on\n // every page view. The account route is an ordinary page, so it keeps the default.\n prefetch={signedIn ? undefined : false}\n className={className}\n data-fs-account-entry-point=\"\"\n data-fs-account-entry-point-state={signedIn ? 'signed-in' : 'signed-out'}\n >\n {entryIcon ? <Icon name={entryIcon} /> : null}\n <span data-fs-account-entry-point-label=\"\">{label}</span>\n </NavigationLink>\n <AccountEntryPointAnnouncement>{announcement}</AccountEntryPointAnnouncement>\n </>\n );\n}\n\n/**\n * The live region that carries the control across the wait. Separate from the visual placeholder\n * because it has to outlive it: the placeholder is only in the tree while the session resolves,\n * while the region has to be there before the text lands for the text to be announced at all.\n */\nfunction AccountEntryPointAnnouncement({ children }: { children: string }) {\n return (\n <output aria-live=\"polite\" data-fs-account-entry-point-announcement=\"\">\n {children}\n </output>\n );\n}\n\n/**\n * The visual stand-in occupying the control's slot while the session resolves. Purely visual: the\n * wait is spoken by the sibling live region, so this is hidden from assistive technology rather\n * than announced twice. Named for the state it represents, as `ShippingSimulatorLoading` is, not\n * for the bar it draws.\n */\nexport function AccountEntryPointLoading({ className, ...props }: AccountEntryPointLoadingProps) {\n return <span {...props} aria-hidden=\"true\" className={className} data-fs-account-entry-point-loading=\"\" />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,gBAAgB;AAItB,MAAa,2BAA2B,kBAAkB;CACxD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,gBAAgB;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAmB;GAC1E,eAAe;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAkB;GACxE,MAAM;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAO;GACpD,cAAc;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAuB;EAC9E;CACF;AACF,CAAC;AAqBD,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAuB,UAAU;CAAW;CAC7D,iBAAiB;CACjB,QAAQ;EACN,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAAmB;EAC5D,eAAe;GAAE,MAAM;GAAU,OAAO;EAAkB;EAC1D,MAAM;GAAE,MAAM;GAAQ,OAAO;EAAO;EACpC,cAAc;GAAE,MAAM;GAAU,OAAO;EAAuB;CAChE;CACA,WACE;AACJ,CAAC;AAED,SAAgB,kBAAkB,EAChC,gBACA,eACA,MACA,cACA,UACA,WACA,KACA,GAAG,SACsB;CACzB,MAAM,EAAE,OAAO,YAAY,WAAW;CACtC,MAAM,WAAW,YAAY;CAG7B,MAAM,sBAAsB,UAAU,gBAAgB,KAAK,IAAI,SAAS,iBAAiB;CACzF,MAAM,qBAAqB,UAAU,eAAe,KAAK,IAAI,SAAS,gBAAgB;CACtF,MAAM,YAAY,UAAU,MAAM,KAAK,IAAI,SAAS,OAAO;CAC3D,MAAM,oBAAoB,UAAU,cAAc,KAAK,IAAI,SAAS,eAAe;CASnF,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,iBAAiB,UAAU,oBAAoB,KAAA;CACrD,gBAAgB;EACd,gBAAgB,kBAAkB,EAAE;CACtC,GAAG,CAAC,cAAc,CAAC;CAInB,IAAI,SACF,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,0BAAD;EAA0B,GAAI;EAAkB;CAAY,CAAA,GAC5D,oBAAC,+BAAD,EAAA,UAAgC,aAA4C,CAAA,CAC5E,EAAA,CAAA;CAMN,MAAM,WAAW,UAAU;CAC3B,MAAM,QAAQ,WAAW,qBAAqB;CAG9C,IAAI,CAAC,OAAO,KAAK,GACf,OAAO;CAGT,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,qBAAC,gBAAD;EACE,GAAI;EACC;EACL,MAAM,WAAW,gBAAgB,kBAAkB,QAAQ;EAI3D,UAAU,WAAW,KAAA,IAAY;EACtB;EACX,+BAA4B;EAC5B,qCAAmC,WAAW,cAAc;EAV9D,UAAA,CAYG,YAAY,oBAAC,MAAD,EAAM,MAAM,UAAY,CAAA,IAAI,MACzC,oBAAC,QAAD;GAAM,qCAAkC;GAAI,UAAA;EAAY,CAAA,CAC1C;CAChB,CAAA,GAAA,oBAAC,+BAAD,EAAA,UAAgC,aAA4C,CAAA,CAC5E,EAAA,CAAA;AAEN;;;;;;AAOA,SAAS,8BAA8B,EAAE,YAAkC;CACzE,OACE,oBAAC,UAAD;EAAQ,aAAU;EAAS,4CAAyC;EACjE;CACK,CAAA;AAEZ;;;;;;;AAQA,SAAgB,yBAAyB,EAAE,WAAW,GAAG,SAAwC;CAC/F,OAAO,oBAAC,QAAD;EAAM,GAAI;EAAO,eAAY;EAAkB;EAAW,uCAAoC;CAAI,CAAA;AAC3G"}
|
|
1
|
+
{"version":3,"file":"account-entry-point.js","names":[],"sources":["../../../src/matter/account-entry-point/account-entry-point.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useEffect, useState } from 'react';\nimport { Icon } from '../../particles/icon/icon.js';\nimport { NavigationLink } from '../../particles/navigation-link/navigation-link.js';\nimport type { PageRef } from '../../sdk/navigation/types.js';\nimport { useStorefrontRoute } from '../../sdk/navigation/use-storefront-route.js';\nimport { signInTarget } from '../../utils/safe-href.js';\nimport { useSession } from '../session/session.js';\n\n/** The account's root page. Never an authored value: an authored destination could misroute the entry\n * into the account. */\nconst ACCOUNT_ROUTE: PageRef = { standard: 'account' };\n\n// Nothing is required: an entry may author any subset, and a slice missing a required property is\n// shape-invalid, which drops the whole element rather than the one field.\nexport const AccountEntryPointContent = defineContentType({\n id: 'account-entry-point',\n title: 'Account Entry Point',\n description: 'Labels and icon for the header sign-in / account control.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n signedOutLabel: { type: 'string', minLength: 1, title: 'Signed-out label' },\n signedInLabel: { type: 'string', minLength: 1, title: 'Signed-in label' },\n icon: { type: 'string', minLength: 1, title: 'Icon' },\n loadingLabel: { type: 'string', minLength: 1, title: 'Loading announcement' },\n },\n },\n});\n\n/** Props for {@link AccountEntryPoint}. Extends native `<a>` attributes (the rendered root). */\nexport type AccountEntryPointProps = Omit<ComponentPropsWithRef<'a'>, 'href' | 'children'> & {\n /** Label for anonymous and identified shoppers. Optional: the render gate, not the type,\n * requires a resolved value. */\n signedOutLabel?: string;\n /** Label for logged-in shoppers. Same gate. */\n signedInLabel?: string;\n /** Icon reference for the glyph. Never gated: a control with no glyph is a valid configuration. */\n icon?: string;\n /** Text the live region announces while the session resolves. */\n loadingLabel?: string;\n /** Merchant-authored fields, sliced from the page/layout content entry; win over the props field\n * by field when present. Absent in a non-CMS store — the props are the fallback. */\n $content?: ContentValue<typeof AccountEntryPointContent>;\n};\n\n/** Props for {@link AccountEntryPointLoading}. Extends native `<span>` attributes. */\nexport type AccountEntryPointLoadingProps = Omit<ComponentPropsWithRef<'span'>, 'children'>;\n\nexport const AccountEntryPointDefinition = defineComponent<AccountEntryPointProps>({\n name: 'AccountEntryPoint',\n importPath: '@vtex/faststore/components',\n component: AccountEntryPoint,\n content: AccountEntryPointContent,\n editor: { label: 'Account Entry Point', category: 'identity' },\n requiresContext: 'session',\n schema: {\n signedOutLabel: { type: 'string', label: 'Signed-out Label' },\n signedInLabel: { type: 'string', label: 'Signed-in Label' },\n icon: { type: 'icon', label: 'Icon' },\n loadingLabel: { type: 'string', label: 'Loading Announcement' },\n },\n guideline:\n 'Session-aware header control rendering one link: the signed-out label toward the sign-in page for anonymous and identified shoppers, the signed-in label toward the account page for logged-in ones, and a politely announced placeholder while the session resolves. Both destinations are fixed conventions, not props, so no authored value can misroute the auth flow. Must be inside a SessionRoot, normally the one hosted by the shared layout; a page-hosted provider also works, since the server-side session fetch forwards the shopper cookie. Author the label for a state or that state renders nothing; the labels are optional in the type only because a CMS entry may supply them, and an entry overrides all four fields at runtime. Style it through data-fs-account-entry-point and switch on data-fs-account-entry-point-state.',\n});\n\nexport function AccountEntryPoint({\n signedOutLabel,\n signedInLabel,\n icon,\n loadingLabel,\n $content,\n className,\n ref,\n ...props\n}: AccountEntryPointProps) {\n const { state, loading } = useSession();\n const { path } = useStorefrontRoute();\n\n // Blank entry fields fall through, so clearing one in the Admin reads as unauthored.\n const entrySignedOutLabel = $content?.signedOutLabel?.trim() ? $content.signedOutLabel : signedOutLabel;\n const entrySignedInLabel = $content?.signedInLabel?.trim() ? $content.signedInLabel : signedInLabel;\n const entryIcon = $content?.icon?.trim() ? $content.icon : icon;\n const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;\n\n // Assistive technology only reports a change inside a region that was already in the tree, so a\n // region mounted together with its text announces nothing. The region therefore holds the same\n // position in both branches — React keeps it mounted across the swap — and starts empty, with the\n // label written on the pass after mount and cleared again once the session resolves.\n //\n // It trails the branch content rather than leading it so the authored swatch, which lands on\n // whichever element leads, can still reach the region through a following-sibling selector.\n const [announcement, setAnnouncement] = useState('');\n const resolvingLabel = loading ? entryLoadingLabel : undefined;\n useEffect(() => {\n setAnnouncement(resolvingLabel ?? '');\n }, [resolvingLabel]);\n\n // Gate on `loading` before `state`: an unresolved session reports `anonymous`, so reading the\n // tri-state first would flash \"Sign In\" at a shopper who is already signed in.\n if (loading) {\n return (\n <>\n <AccountEntryPointLoading {...props} className={className} />\n <AccountEntryPointAnnouncement>{announcement}</AccountEntryPointAnnouncement>\n </>\n );\n }\n\n // `identified` stays on the signed-out link: an identified but unauthenticated shopper cannot\n // reach their account yet.\n const signedIn = state === 'loggedIn';\n const label = signedIn ? entrySignedInLabel : entrySignedOutLabel;\n\n // A focusable link a screen reader announces as its bare URL is worse than no control at all.\n if (!label?.trim()) {\n return null;\n }\n\n return (\n <>\n <NavigationLink\n {...props}\n ref={ref}\n href={signedIn ? ACCOUNT_ROUTE : signInTarget(path)}\n // The signed-out destination is a deferred auth proxy that may set a cookie or redirect, and\n // a header control is always in the viewport — the default prefetch would fire that GET on\n // every page view. The account page is an ordinary page, so it keeps the default.\n prefetch={signedIn ? undefined : false}\n className={className}\n data-fs-account-entry-point=\"\"\n data-fs-account-entry-point-state={signedIn ? 'signed-in' : 'signed-out'}\n >\n {entryIcon ? <Icon name={entryIcon} /> : null}\n <span data-fs-account-entry-point-label=\"\">{label}</span>\n </NavigationLink>\n <AccountEntryPointAnnouncement>{announcement}</AccountEntryPointAnnouncement>\n </>\n );\n}\n\n/**\n * The live region that carries the control across the wait. Separate from the visual placeholder\n * because it has to outlive it: the placeholder is only in the tree while the session resolves,\n * while the region has to be there before the text lands for the text to be announced at all.\n */\nfunction AccountEntryPointAnnouncement({ children }: { children: string }) {\n return (\n <output aria-live=\"polite\" data-fs-account-entry-point-announcement=\"\">\n {children}\n </output>\n );\n}\n\n/**\n * The visual stand-in occupying the control's slot while the session resolves. Purely visual: the\n * wait is spoken by the sibling live region, so this is hidden from assistive technology rather\n * than announced twice. Named for the state it represents, as `ShippingSimulatorLoading` is, not\n * for the bar it draws.\n */\nexport function AccountEntryPointLoading({ className, ...props }: AccountEntryPointLoadingProps) {\n return <span {...props} aria-hidden=\"true\" className={className} data-fs-account-entry-point-loading=\"\" />;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,gBAAyB,EAAE,UAAU,UAAU;AAIrD,MAAa,2BAA2B,kBAAkB;CACxD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,gBAAgB;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAmB;GAC1E,eAAe;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAkB;GACxE,MAAM;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAO;GACpD,cAAc;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAuB;EAC9E;CACF;AACF,CAAC;AAqBD,MAAa,8BAA8B,gBAAwC;CACjF,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT,QAAQ;EAAE,OAAO;EAAuB,UAAU;CAAW;CAC7D,iBAAiB;CACjB,QAAQ;EACN,gBAAgB;GAAE,MAAM;GAAU,OAAO;EAAmB;EAC5D,eAAe;GAAE,MAAM;GAAU,OAAO;EAAkB;EAC1D,MAAM;GAAE,MAAM;GAAQ,OAAO;EAAO;EACpC,cAAc;GAAE,MAAM;GAAU,OAAO;EAAuB;CAChE;CACA,WACE;AACJ,CAAC;AAED,SAAgB,kBAAkB,EAChC,gBACA,eACA,MACA,cACA,UACA,WACA,KACA,GAAG,SACsB;CACzB,MAAM,EAAE,OAAO,YAAY,WAAW;CACtC,MAAM,EAAE,SAAS,mBAAmB;CAGpC,MAAM,sBAAsB,UAAU,gBAAgB,KAAK,IAAI,SAAS,iBAAiB;CACzF,MAAM,qBAAqB,UAAU,eAAe,KAAK,IAAI,SAAS,gBAAgB;CACtF,MAAM,YAAY,UAAU,MAAM,KAAK,IAAI,SAAS,OAAO;CAC3D,MAAM,oBAAoB,UAAU,cAAc,KAAK,IAAI,SAAS,eAAe;CASnF,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,iBAAiB,UAAU,oBAAoB,KAAA;CACrD,gBAAgB;EACd,gBAAgB,kBAAkB,EAAE;CACtC,GAAG,CAAC,cAAc,CAAC;CAInB,IAAI,SACF,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,0BAAD;EAA0B,GAAI;EAAkB;CAAY,CAAA,GAC5D,oBAAC,+BAAD,EAAA,UAAgC,aAA4C,CAAA,CAC5E,EAAA,CAAA;CAMN,MAAM,WAAW,UAAU;CAC3B,MAAM,QAAQ,WAAW,qBAAqB;CAG9C,IAAI,CAAC,OAAO,KAAK,GACf,OAAO;CAGT,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,qBAAC,gBAAD;EACE,GAAI;EACC;EACL,MAAM,WAAW,gBAAgB,aAAa,IAAI;EAIlD,UAAU,WAAW,KAAA,IAAY;EACtB;EACX,+BAA4B;EAC5B,qCAAmC,WAAW,cAAc;EAV9D,UAAA,CAYG,YAAY,oBAAC,MAAD,EAAM,MAAM,UAAY,CAAA,IAAI,MACzC,oBAAC,QAAD;GAAM,qCAAkC;GAAI,UAAA;EAAY,CAAA,CAC1C;CAChB,CAAA,GAAA,oBAAC,+BAAD,EAAA,UAAgC,aAA4C,CAAA,CAC5E,EAAA,CAAA;AAEN;;;;;;AAOA,SAAS,8BAA8B,EAAE,YAAkC;CACzE,OACE,oBAAC,UAAD;EAAQ,aAAU;EAAS,4CAAyC;EACjE;CACK,CAAA;AAEZ;;;;;;;AAQA,SAAgB,yBAAyB,EAAE,WAAW,GAAG,SAAwC;CAC/F,OAAO,oBAAC,QAAD;EAAM,GAAI;EAAO,eAAY;EAAkB;EAAW,uCAAoC;CAAI,CAAA;AAC3G"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ContentValue } from "../../core/dist/define-content-type.js";
|
|
2
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
3
3
|
import "../../core/dist/index.js";
|
|
4
|
+
import { PageRef } from "../../sdk/navigation/types.js";
|
|
5
|
+
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
4
6
|
import { ComponentPropsWithRef } from "react";
|
|
5
7
|
//#region src/matter/account-menu/account-menu.d.ts
|
|
6
8
|
export declare const AccountMenuContent: {
|
|
@@ -42,13 +44,58 @@ export declare const AccountMenuContent: {
|
|
|
42
44
|
};
|
|
43
45
|
};
|
|
44
46
|
};
|
|
47
|
+
export declare const AccountMenuIndexRedirectContent: {
|
|
48
|
+
readonly id: "account-menu-index-redirect";
|
|
49
|
+
readonly title: "Account Menu Index Redirect";
|
|
50
|
+
readonly description: "What the account's root shows while it opens the first section, and when there is none to open.";
|
|
51
|
+
readonly schema: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly additionalProperties: false;
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly loadingLabel: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly minLength: 1;
|
|
58
|
+
readonly title: "Loading announcement";
|
|
59
|
+
};
|
|
60
|
+
readonly emptyMessage: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly minLength: 1;
|
|
63
|
+
readonly title: "No section message";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const AccountMenuSignOutContent: {
|
|
69
|
+
readonly id: "account-menu-sign-out";
|
|
70
|
+
readonly title: "Account Menu Sign Out";
|
|
71
|
+
readonly description: "The sign-out control in the account sidebar, and what it says when signing out fails.";
|
|
72
|
+
readonly schema: {
|
|
73
|
+
readonly type: "object";
|
|
74
|
+
readonly additionalProperties: false;
|
|
75
|
+
readonly properties: {
|
|
76
|
+
readonly label: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly minLength: 1;
|
|
79
|
+
readonly title: "Sign-out label";
|
|
80
|
+
};
|
|
81
|
+
readonly errorMessage: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly minLength: 1;
|
|
84
|
+
readonly title: "Sign-out failed message";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
45
89
|
type AccountMenuContentValue = ContentValue<typeof AccountMenuContent>;
|
|
46
|
-
/** One authored section. Derived from the model so the prop and content channels cannot drift
|
|
47
|
-
|
|
90
|
+
/** One authored section. Derived from the model so the prop and content channels cannot drift; the prop
|
|
91
|
+
* channel also takes a page reference. */
|
|
92
|
+
export type AccountMenuSection = Omit<NonNullable<AccountMenuContentValue['items']>[number], 'href'> & {
|
|
93
|
+
href: PageRef | string;
|
|
94
|
+
};
|
|
48
95
|
/** A section resolved for render. A null `href` is a destination the allowlist refused. */
|
|
49
96
|
export type AccountMenuResolvedSection = {
|
|
50
97
|
label: string;
|
|
51
|
-
href: string | null;
|
|
98
|
+
href: PageRef | string | null;
|
|
52
99
|
external: boolean;
|
|
53
100
|
};
|
|
54
101
|
export type AccountMenuCurrent = {
|
|
@@ -74,15 +121,42 @@ export type AccountMenuListProps = Omit<ComponentPropsWithRef<'nav'>, 'children'
|
|
|
74
121
|
/** Accessible name of the navigation landmark. */
|
|
75
122
|
label?: string;
|
|
76
123
|
};
|
|
124
|
+
/** It renders the gate's loading look or a message, so it forwards no element props beyond a class. */
|
|
125
|
+
export type AccountMenuIndexRedirectProps = {
|
|
126
|
+
/** Text announced while the first section opens. */
|
|
127
|
+
loadingLabel?: string;
|
|
128
|
+
/** What the root says when the list holds no section to open. */
|
|
129
|
+
emptyMessage?: string;
|
|
130
|
+
/** Merchant-authored copy, sliced from the page content entry; wins over the props field by field. */
|
|
131
|
+
$content?: ContentValue<typeof AccountMenuIndexRedirectContent>;
|
|
132
|
+
className?: string;
|
|
133
|
+
};
|
|
134
|
+
export type AccountMenuSignOutProps = {
|
|
135
|
+
/** The control's text. */
|
|
136
|
+
label?: string;
|
|
137
|
+
/** What the shopper is told when the sign-out did not happen. */
|
|
138
|
+
errorMessage?: string;
|
|
139
|
+
/** Merchant-authored copy, sliced from the layout content entry; wins over the props field by field. */
|
|
140
|
+
$content?: ContentValue<typeof AccountMenuSignOutContent>;
|
|
141
|
+
/** Injected by the compiler from the definition's `actions`. */
|
|
142
|
+
$actions?: ComponentActions;
|
|
143
|
+
className?: string;
|
|
144
|
+
};
|
|
77
145
|
export declare const AccountMenuRootDefinition: ComponentDefinition<AccountMenuRootProps>;
|
|
78
146
|
export declare const AccountMenuListDefinition: ComponentDefinition<AccountMenuListProps>;
|
|
147
|
+
export declare const AccountMenuIndexRedirectDefinition: ComponentDefinition<AccountMenuIndexRedirectProps>;
|
|
148
|
+
export declare const AccountMenuSignOutDefinition: ComponentDefinition<AccountMenuSignOutProps>;
|
|
79
149
|
/** The resolved section list and the current section. */
|
|
80
150
|
export declare function useAccountMenu(): AccountMenuContextValue;
|
|
81
151
|
export declare function AccountMenuRoot({ items, $content, className, children, ...props }: AccountMenuRootProps): import("react/jsx-runtime").JSX.Element;
|
|
82
152
|
export declare function AccountMenuList({ label, className, ...props }: AccountMenuListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
153
|
+
export declare function AccountMenuIndexRedirect({ loadingLabel, emptyMessage, $content, className }: Readonly<AccountMenuIndexRedirectProps>): import("react/jsx-runtime").JSX.Element;
|
|
154
|
+
export declare function AccountMenuSignOut({ label, errorMessage, $content, $actions: $actionsProp, className }: Readonly<AccountMenuSignOutProps>): import("react/jsx-runtime").JSX.Element;
|
|
83
155
|
export declare const AccountMenu: {
|
|
84
156
|
Root: typeof AccountMenuRoot;
|
|
85
157
|
List: typeof AccountMenuList;
|
|
158
|
+
IndexRedirect: typeof AccountMenuIndexRedirect;
|
|
159
|
+
SignOut: typeof AccountMenuSignOut;
|
|
86
160
|
};
|
|
87
161
|
//#endregion
|
|
88
162
|
//# sourceMappingURL=account-menu.d.ts.map
|
|
@@ -3,10 +3,18 @@ import { defineComponent } from "../../core/dist/define-component.js";
|
|
|
3
3
|
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
4
4
|
import "../../core/dist/index.js";
|
|
5
5
|
import { resolveSafeHref, resolveSiteRelativeHref } from "../../utils/safe-href.js";
|
|
6
|
+
import { resolveStorefrontHref } from "../../sdk/navigation/resolve-storefront-href.js";
|
|
7
|
+
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
8
|
+
import { useRouteMap } from "../../sdk/navigation/route-map-provider.js";
|
|
9
|
+
import { useStorefrontNavigation } from "../../sdk/navigation/use-storefront-navigation.js";
|
|
10
|
+
import { useStorefrontRoute } from "../../sdk/navigation/use-storefront-route.js";
|
|
11
|
+
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
6
12
|
import { NavigationLink } from "../../particles/navigation-link/navigation-link.js";
|
|
13
|
+
import { declareSignOutIntent, useSignOutIntent, withdrawSignOutIntent } from "../account-access-gate/sign-out-intent.js";
|
|
14
|
+
import { AccountAccessGateLoading } from "../account-access-gate/account-access-gate.js";
|
|
15
|
+
import { clearSignOutFailure, reportSignOutFailure, useSignOutFailure } from "./sign-out-failure.js";
|
|
7
16
|
import { createContext, useContext, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import { usePathname } from "next/navigation";
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
18
|
//#region src/matter/account-menu/account-menu.tsx
|
|
11
19
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
12
20
|
const AccountMenuContent = defineContentType({
|
|
@@ -46,6 +54,48 @@ const AccountMenuContent = defineContentType({
|
|
|
46
54
|
} }
|
|
47
55
|
}
|
|
48
56
|
});
|
|
57
|
+
const AccountMenuIndexRedirectContent = defineContentType({
|
|
58
|
+
id: "account-menu-index-redirect",
|
|
59
|
+
title: "Account Menu Index Redirect",
|
|
60
|
+
description: "What the account's root shows while it opens the first section, and when there is none to open.",
|
|
61
|
+
schema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
properties: {
|
|
65
|
+
loadingLabel: {
|
|
66
|
+
type: "string",
|
|
67
|
+
minLength: 1,
|
|
68
|
+
title: "Loading announcement"
|
|
69
|
+
},
|
|
70
|
+
emptyMessage: {
|
|
71
|
+
type: "string",
|
|
72
|
+
minLength: 1,
|
|
73
|
+
title: "No section message"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const AccountMenuSignOutContent = defineContentType({
|
|
79
|
+
id: "account-menu-sign-out",
|
|
80
|
+
title: "Account Menu Sign Out",
|
|
81
|
+
description: "The sign-out control in the account sidebar, and what it says when signing out fails.",
|
|
82
|
+
schema: {
|
|
83
|
+
type: "object",
|
|
84
|
+
additionalProperties: false,
|
|
85
|
+
properties: {
|
|
86
|
+
label: {
|
|
87
|
+
type: "string",
|
|
88
|
+
minLength: 1,
|
|
89
|
+
title: "Sign-out label"
|
|
90
|
+
},
|
|
91
|
+
errorMessage: {
|
|
92
|
+
type: "string",
|
|
93
|
+
minLength: 1,
|
|
94
|
+
title: "Sign-out failed message"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
49
99
|
const AccountMenuRootDefinition = defineComponent({
|
|
50
100
|
name: "AccountMenuRoot",
|
|
51
101
|
importPath: "@vtex/faststore/components",
|
|
@@ -78,37 +128,94 @@ const AccountMenuListDefinition = defineComponent({
|
|
|
78
128
|
} },
|
|
79
129
|
guideline: "The account menu's navigation landmark and its items, and nothing else — it surrounds the items alone so the section's own content stays outside the navigation region. Author the label: a landmark with no accessible name is one a screen-reader user cannot tell from any other. The current section carries aria-current, page for the section itself and true for a page inside it, with data-fs-account-menu-item-current beside it as a style target and never as the only signal. When the list scrolls, the current item is brought into view on mount and on every route change. Must be a descendant of AccountMenuRoot."
|
|
80
130
|
});
|
|
131
|
+
const AccountMenuIndexRedirectDefinition = defineComponent({
|
|
132
|
+
name: "AccountMenuIndexRedirect",
|
|
133
|
+
importPath: "@vtex/faststore/components",
|
|
134
|
+
component: AccountMenuIndexRedirect,
|
|
135
|
+
content: AccountMenuIndexRedirectContent,
|
|
136
|
+
requiresContext: "account-menu",
|
|
137
|
+
editor: {
|
|
138
|
+
label: "Account Menu Index Redirect",
|
|
139
|
+
category: "navigation"
|
|
140
|
+
},
|
|
141
|
+
schema: {
|
|
142
|
+
loadingLabel: {
|
|
143
|
+
type: "string",
|
|
144
|
+
label: "Loading Announcement"
|
|
145
|
+
},
|
|
146
|
+
emptyMessage: {
|
|
147
|
+
type: "string",
|
|
148
|
+
default: "No account section is configured.",
|
|
149
|
+
label: "No Section Message"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
guideline: "The whole of the account's root page: it replaces the current history entry with the first section of the merchant's list that stays in the account, skipping one marked external, one whose destination was refused or is not site-relative, and the root itself. It shows the access gate's loading look until the section opens. A list with no such section leaves the root terminal — no navigation, and the no-section message in its place — rather than falling back to the library's defaults. Place it alone on the account page, inside AccountMenuRoot and under AccountAccessGate, which the my-account layout provides; never on a section's own page, which it would navigate away from."
|
|
153
|
+
});
|
|
154
|
+
const AccountMenuSignOutDefinition = defineComponent({
|
|
155
|
+
name: "AccountMenuSignOut",
|
|
156
|
+
importPath: "@vtex/faststore/components",
|
|
157
|
+
component: AccountMenuSignOut,
|
|
158
|
+
content: AccountMenuSignOutContent,
|
|
159
|
+
actions: { session: ["logout"] },
|
|
160
|
+
editor: {
|
|
161
|
+
label: "Account Menu Sign Out",
|
|
162
|
+
category: "navigation"
|
|
163
|
+
},
|
|
164
|
+
schema: {
|
|
165
|
+
label: {
|
|
166
|
+
type: "string",
|
|
167
|
+
default: "Sign out",
|
|
168
|
+
label: "Label"
|
|
169
|
+
},
|
|
170
|
+
errorMessage: {
|
|
171
|
+
type: "string",
|
|
172
|
+
default: "We couldn't sign you out. Please try again.",
|
|
173
|
+
label: "Sign-out Failed Message"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
guideline: "The account sidebar's way out: it dispatches $actions.session.logout, tells AccountAccessGate the departure is deliberate so the gate stands down instead of sending the shopper to sign in, and then loads the storefront home as a new document, which is what keeps the account out of the client router's cache. A logout that reports an error keeps the shopper on the account page with the failure message rather than landing a still-signed-in shopper on the home page. Compose it inside AccountMenuRoot beside AccountMenuList, under the gate the my-account layout provides — the back-forward cache is the gate's to revalidate, not this control's."
|
|
177
|
+
});
|
|
81
178
|
/**
|
|
82
179
|
* The library's default set, the five sections the PRD names. Labels are English as an interim, until
|
|
83
180
|
* the Localization cluster's catalog resolves them per locale. Their destinations only resolve in a
|
|
84
|
-
* store that
|
|
181
|
+
* store that declares the five standard pages.
|
|
85
182
|
*/
|
|
86
183
|
const DEFAULT_SECTIONS = [
|
|
87
184
|
{
|
|
88
185
|
label: "Profile",
|
|
89
|
-
href: "
|
|
186
|
+
href: { standard: "profile" }
|
|
90
187
|
},
|
|
91
188
|
{
|
|
92
189
|
label: "Orders",
|
|
93
|
-
href: "
|
|
190
|
+
href: { standard: "orders" }
|
|
94
191
|
},
|
|
95
192
|
{
|
|
96
193
|
label: "Address",
|
|
97
|
-
href: "
|
|
194
|
+
href: { standard: "address" }
|
|
98
195
|
},
|
|
99
196
|
{
|
|
100
197
|
label: "Payments",
|
|
101
|
-
href: "
|
|
198
|
+
href: { standard: "payments" }
|
|
102
199
|
},
|
|
103
200
|
{
|
|
104
201
|
label: "Security",
|
|
105
|
-
href: "
|
|
202
|
+
href: { standard: "security" }
|
|
106
203
|
}
|
|
107
204
|
];
|
|
205
|
+
const HOME_PAGE = { standard: "home" };
|
|
108
206
|
function resolveSections(sections) {
|
|
109
207
|
const resolved = [];
|
|
110
208
|
sections.forEach((section, index) => {
|
|
111
209
|
if (section.label.trim().length === 0) return;
|
|
210
|
+
const external = section.external ?? false;
|
|
211
|
+
if (typeof section.href !== "string") {
|
|
212
|
+
resolved.push({
|
|
213
|
+
label: section.label,
|
|
214
|
+
href: section.href,
|
|
215
|
+
external
|
|
216
|
+
});
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
112
219
|
const destination = resolveSafeHref(section.href);
|
|
113
220
|
if (!destination.safe) console.warn("[AccountMenu] section destination rejected", {
|
|
114
221
|
index,
|
|
@@ -117,7 +224,7 @@ function resolveSections(sections) {
|
|
|
117
224
|
resolved.push({
|
|
118
225
|
label: section.label,
|
|
119
226
|
href: destination.safe ? destination.href : null,
|
|
120
|
-
external
|
|
227
|
+
external
|
|
121
228
|
});
|
|
122
229
|
});
|
|
123
230
|
return resolved;
|
|
@@ -129,18 +236,33 @@ function normalizePath(value) {
|
|
|
129
236
|
return trimmed.length === 0 ? "/" : trimmed;
|
|
130
237
|
}
|
|
131
238
|
/**
|
|
239
|
+
* The section's path inside the current binding, compared against the route's logical path: a
|
|
240
|
+
* reference resolved without the base path, or an authored site-relative string as written. The menu
|
|
241
|
+
* renders in a layout, outside the page's route marker, so the path is all it can compare. `null` for
|
|
242
|
+
* an external section, a refused or absolute destination, and a reference that does not resolve: none
|
|
243
|
+
* of them is a path of the account.
|
|
244
|
+
*/
|
|
245
|
+
function logicalPathOf(section, bindingId, routeMap) {
|
|
246
|
+
if (section.external || section.href === null) return null;
|
|
247
|
+
if (typeof section.href === "string") return resolveSiteRelativeHref(section.href).safe ? section.href : null;
|
|
248
|
+
return resolveStorefrontHref({
|
|
249
|
+
bindingId,
|
|
250
|
+
basePath: "/"
|
|
251
|
+
}, routeMap, section.href).href;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
132
254
|
* The current section, matched on segment boundaries. Legacy matched by prefix and marked every
|
|
133
255
|
* section whose path was a prefix of the current one; the longest match wins here, which keeps
|
|
134
256
|
* exactly one section current and makes an exact match beat every ancestor without a second rule.
|
|
135
257
|
*/
|
|
136
|
-
function findCurrent(sections,
|
|
137
|
-
|
|
138
|
-
const path = normalizePath(pathname);
|
|
258
|
+
function findCurrent(sections, logicalPath, bindingId, routeMap) {
|
|
259
|
+
const path = normalizePath(logicalPath);
|
|
139
260
|
let current = null;
|
|
140
261
|
let matchedLength = -1;
|
|
141
262
|
for (const [index, section] of sections.entries()) {
|
|
142
|
-
|
|
143
|
-
|
|
263
|
+
const sectionPath = logicalPathOf(section, bindingId, routeMap);
|
|
264
|
+
if (sectionPath === null) continue;
|
|
265
|
+
const href = normalizePath(sectionPath);
|
|
144
266
|
if (href.length <= matchedLength) continue;
|
|
145
267
|
const exact = path === href;
|
|
146
268
|
const ancestor = href !== "/" && path.startsWith(`${href}/`);
|
|
@@ -154,6 +276,23 @@ function findCurrent(sections, pathname) {
|
|
|
154
276
|
return current;
|
|
155
277
|
}
|
|
156
278
|
/**
|
|
279
|
+
* Where the account's root opens: the first section that stays in the account. An external entry would
|
|
280
|
+
* eject the shopper from the account they just opened, and so would an absolute one the merchant did not
|
|
281
|
+
* flag — the same site-relative reading `findCurrent` applies. The page itself is skipped too, in every
|
|
282
|
+
* spelling that matches it, since replacing it with itself would leave the loading look up for good.
|
|
283
|
+
*/
|
|
284
|
+
function findIndexDestination(sections, current, bindingId, routeMap) {
|
|
285
|
+
const here = current?.match === "exact" ? sections[current.index] : void 0;
|
|
286
|
+
const herePath = here ? logicalPathOf(here, bindingId, routeMap) : null;
|
|
287
|
+
const hereNormalized = herePath === null ? null : normalizePath(herePath);
|
|
288
|
+
for (const section of sections) {
|
|
289
|
+
const sectionPath = logicalPathOf(section, bindingId, routeMap);
|
|
290
|
+
if (section.href === null || sectionPath === null || normalizePath(sectionPath) === hereNormalized) continue;
|
|
291
|
+
return section.href;
|
|
292
|
+
}
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
157
296
|
* `page` for the section itself, `true` for a page inside it. The distinction is kept rather than
|
|
158
297
|
* collapsed because the sibling breadcrumb names the deep page as the current one, and two surfaces
|
|
159
298
|
* announcing "current page" for two different things is worse than the menu claiming only its set.
|
|
@@ -173,15 +312,22 @@ function useAccountMenu() {
|
|
|
173
312
|
return value;
|
|
174
313
|
}
|
|
175
314
|
function AccountMenuRoot({ items, $content, className, children, ...props }) {
|
|
176
|
-
const
|
|
315
|
+
const { path } = useStorefrontRoute();
|
|
316
|
+
const { bindingId } = useStorefrontContext();
|
|
317
|
+
const { routeMap } = useRouteMap();
|
|
177
318
|
const sections = $content?.items ?? items ?? DEFAULT_SECTIONS;
|
|
178
319
|
const value = useMemo(() => {
|
|
179
320
|
const resolved = resolveSections(sections);
|
|
180
321
|
return {
|
|
181
322
|
items: resolved,
|
|
182
|
-
current: findCurrent(resolved,
|
|
323
|
+
current: findCurrent(resolved, path, bindingId, routeMap)
|
|
183
324
|
};
|
|
184
|
-
}, [
|
|
325
|
+
}, [
|
|
326
|
+
sections,
|
|
327
|
+
path,
|
|
328
|
+
bindingId,
|
|
329
|
+
routeMap
|
|
330
|
+
]);
|
|
185
331
|
return /* @__PURE__ */ jsx(AccountMenuContext, {
|
|
186
332
|
value,
|
|
187
333
|
children: /* @__PURE__ */ jsx("div", {
|
|
@@ -236,11 +382,98 @@ function AccountMenuList({ label = "Account", className, ...props }) {
|
|
|
236
382
|
})
|
|
237
383
|
});
|
|
238
384
|
}
|
|
385
|
+
function AccountMenuIndexRedirect({ loadingLabel, emptyMessage = "No account section is configured.", $content, className }) {
|
|
386
|
+
const { items, current } = useAccountMenu();
|
|
387
|
+
const { bindingId } = useStorefrontContext();
|
|
388
|
+
const { routeMap } = useRouteMap();
|
|
389
|
+
const { replace } = useStorefrontNavigation();
|
|
390
|
+
const replacedRef = useRef(false);
|
|
391
|
+
const destination = findIndexDestination(items, current, bindingId, routeMap);
|
|
392
|
+
useEffect(() => {
|
|
393
|
+
if (destination === null || replacedRef.current) return;
|
|
394
|
+
replacedRef.current = true;
|
|
395
|
+
replace(destination);
|
|
396
|
+
}, [destination, replace]);
|
|
397
|
+
const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;
|
|
398
|
+
const entryEmptyMessage = $content?.emptyMessage?.trim() ? $content.emptyMessage : emptyMessage;
|
|
399
|
+
if (destination === null) return /* @__PURE__ */ jsx("p", {
|
|
400
|
+
className,
|
|
401
|
+
"data-fs-account-menu-index-redirect": "",
|
|
402
|
+
"data-fs-account-menu-index-redirect-empty": "",
|
|
403
|
+
children: entryEmptyMessage
|
|
404
|
+
});
|
|
405
|
+
return /* @__PURE__ */ jsx(AccountAccessGateLoading, {
|
|
406
|
+
className,
|
|
407
|
+
"data-fs-account-menu-index-redirect": "",
|
|
408
|
+
children: entryLoadingLabel
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
const DEFAULT_SIGN_OUT_LABEL = "Sign out";
|
|
412
|
+
const DEFAULT_SIGN_OUT_ERROR = "We couldn't sign you out. Please try again.";
|
|
413
|
+
/**
|
|
414
|
+
* The first non-blank of the given values. The models' `minLength` is enforced by neither the runtime
|
|
415
|
+
* slice nor the preflight, and a blank here is a nameless button or a silent failure.
|
|
416
|
+
*/
|
|
417
|
+
function firstAuthored(...values) {
|
|
418
|
+
return values.find((value) => value?.trim());
|
|
419
|
+
}
|
|
420
|
+
/** An absent handler or a rejection is a sign-out that did not happen, never one that did. */
|
|
421
|
+
async function logOut(logout) {
|
|
422
|
+
if (!logout) return false;
|
|
423
|
+
try {
|
|
424
|
+
return (await logout()).length === 0;
|
|
425
|
+
} catch (error) {
|
|
426
|
+
console.error("[AccountMenuSignOut] logout rejected", error);
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function AccountMenuSignOut({ label, errorMessage, $content, $actions: $actionsProp, className }) {
|
|
431
|
+
const $actions = useActionsOverride($actionsProp);
|
|
432
|
+
const { hrefFor } = useStorefrontNavigation();
|
|
433
|
+
const { basePath } = useStorefrontContext();
|
|
434
|
+
const signingOut = useSignOutIntent();
|
|
435
|
+
const failed = useSignOutFailure();
|
|
436
|
+
const attemptingRef = useRef(false);
|
|
437
|
+
async function handleClick() {
|
|
438
|
+
if (attemptingRef.current) return;
|
|
439
|
+
attemptingRef.current = true;
|
|
440
|
+
clearSignOutFailure();
|
|
441
|
+
declareSignOutIntent();
|
|
442
|
+
if (await logOut($actions?.session?.logout)) {
|
|
443
|
+
globalThis.location.assign(hrefFor(HOME_PAGE) ?? basePath);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
attemptingRef.current = false;
|
|
447
|
+
reportSignOutFailure();
|
|
448
|
+
withdrawSignOutIntent();
|
|
449
|
+
}
|
|
450
|
+
const entryLabel = firstAuthored($content?.label, label) ?? DEFAULT_SIGN_OUT_LABEL;
|
|
451
|
+
const entryErrorMessage = firstAuthored($content?.errorMessage, errorMessage) ?? DEFAULT_SIGN_OUT_ERROR;
|
|
452
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
453
|
+
className,
|
|
454
|
+
"data-fs-account-menu-sign-out": "",
|
|
455
|
+
"data-fs-account-menu-sign-out-pending": signingOut ? "" : void 0,
|
|
456
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
457
|
+
type: "button",
|
|
458
|
+
onClick: handleClick,
|
|
459
|
+
disabled: signingOut,
|
|
460
|
+
"aria-busy": signingOut || void 0,
|
|
461
|
+
"data-fs-account-menu-sign-out-button": "",
|
|
462
|
+
children: entryLabel
|
|
463
|
+
}), failed ? /* @__PURE__ */ jsx("p", {
|
|
464
|
+
role: "alert",
|
|
465
|
+
"data-fs-account-menu-sign-out-error": "",
|
|
466
|
+
children: entryErrorMessage
|
|
467
|
+
}) : null]
|
|
468
|
+
});
|
|
469
|
+
}
|
|
239
470
|
const AccountMenu = {
|
|
240
471
|
Root: AccountMenuRoot,
|
|
241
|
-
List: AccountMenuList
|
|
472
|
+
List: AccountMenuList,
|
|
473
|
+
IndexRedirect: AccountMenuIndexRedirect,
|
|
474
|
+
SignOut: AccountMenuSignOut
|
|
242
475
|
};
|
|
243
476
|
//#endregion
|
|
244
|
-
export { AccountMenu, AccountMenuContent, AccountMenuList, AccountMenuListDefinition, AccountMenuRoot, AccountMenuRootDefinition, useAccountMenu };
|
|
477
|
+
export { AccountMenu, AccountMenuContent, AccountMenuIndexRedirect, AccountMenuIndexRedirectContent, AccountMenuIndexRedirectDefinition, AccountMenuList, AccountMenuListDefinition, AccountMenuRoot, AccountMenuRootDefinition, AccountMenuSignOut, AccountMenuSignOutContent, AccountMenuSignOutDefinition, useAccountMenu };
|
|
245
478
|
|
|
246
479
|
//# sourceMappingURL=account-menu.js.map
|