@vtex/faststore 0.0.10 → 0.0.11
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 +42 -0
- package/README.md +0 -1
- package/dist/actions.json +6 -1
- package/dist/catalog.json +789 -1701
- package/dist/cli/index.d.ts +66 -28
- package/dist/cli/index.js +7371 -512
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-runtime.js +41 -60
- package/dist/cli/server-runtime.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/components.d.ts +63 -57
- package/dist/components.js +60 -54
- package/dist/content-types.json +5785 -754
- package/dist/core/dist/define-component.d.ts +1 -1
- package/dist/core/dist/define-content-type.d.ts +50 -2
- package/dist/core/dist/define-content-type.js +107 -3
- package/dist/core/dist/define-content-type.js.map +1 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/access-code-field.md +1 -1
- package/dist/docs/access-code-sign-in.md +126 -77
- package/dist/docs/account-address-book.md +210 -95
- package/dist/docs/account-menu.md +14 -15
- package/dist/docs/account-saved-cards.md +44 -39
- package/dist/docs/alert-dialog.md +3 -1
- package/dist/docs/avatar.md +4 -2
- package/dist/docs/billing-address.md +99 -30
- package/dist/docs/binding-switcher.md +5 -2
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +39 -26
- package/dist/docs/card-summary.md +18 -8
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +39 -26
- package/dist/docs/cart-item.md +29 -14
- package/dist/docs/cart-totalizer.md +7 -5
- package/dist/docs/cart.md +135 -41
- package/dist/docs/challenge-return.md +135 -0
- package/dist/docs/client-preferences-fieldset.md +10 -5
- package/dist/docs/client-preferences.md +31 -8
- package/dist/docs/client-profile-fieldset.md +20 -6
- package/dist/docs/client-profile.md +12 -3
- package/dist/docs/copy-text.md +9 -7
- package/dist/docs/document-field.md +1 -1
- package/dist/docs/email-field.md +2 -1
- package/dist/docs/email-identification.md +12 -2
- package/dist/docs/footer-copyright.md +4 -2
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +6 -5
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/installments.md +46 -32
- package/dist/docs/my-account-profile.md +16 -11
- package/dist/docs/navigation-link.md +5 -3
- package/dist/docs/order-cancel.md +3 -1
- package/dist/docs/order-delivery-address.md +7 -5
- package/dist/docs/order-delivery-group.md +1 -3
- package/dist/docs/order-details-back.md +1 -1
- package/dist/docs/order-details-header.md +1 -4
- package/dist/docs/order-invoice-download.md +60 -0
- package/dist/docs/order-list-row.md +1 -1
- package/dist/docs/order-list-search.md +13 -20
- package/dist/docs/order-list-views.md +11 -17
- package/dist/docs/order-list.md +12 -5
- package/dist/docs/order-payment.md +9 -7
- package/dist/docs/order-placed-date.md +1 -1
- package/dist/docs/order-placed-payment-summary.md +28 -15
- package/dist/docs/order-placed.md +49 -14
- package/dist/docs/order-progress.md +1 -1
- package/dist/docs/order-status-badge.md +20 -9
- package/dist/docs/order-summary.md +2 -2
- package/dist/docs/order-tracking-link.md +58 -0
- package/dist/docs/payment-method-badges.md +30 -4
- package/dist/docs/payment-methods.md +1 -1
- package/dist/docs/payment.md +36 -17
- package/dist/docs/phone-field.md +4 -4
- package/dist/docs/place-order.md +84 -36
- package/dist/docs/postal-code-field.md +3 -1
- package/dist/docs/pricing.md +21 -23
- package/dist/docs/product-gallery.md +19 -20
- package/dist/docs/product-information.md +13 -9
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +0 -1
- package/dist/docs/promotion.md +4 -2
- package/dist/docs/region.md +23 -15
- package/dist/docs/save-card.md +7 -6
- package/dist/docs/saved-cards.md +65 -36
- package/dist/docs/shipping-address.md +57 -21
- package/dist/docs/shipping-simulator.md +53 -15
- package/dist/docs/sign-in-disclosure.md +176 -0
- package/dist/docs/sign-in-form.md +78 -47
- package/dist/docs/sign-in-redirect.md +4 -2
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +15 -4
- package/dist/docs/variant-selector.md +15 -11
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +2 -2
- package/dist/internal/client.d.ts +1 -3
- package/dist/internal/client.js +1 -1
- package/dist/internal/server.d.ts +7 -4
- package/dist/internal/server.js +7 -4
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
- package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
- package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
- package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
- package/dist/matter/account-address-book/account-address-book.js +74 -33
- package/dist/matter/account-address-book/account-address-book.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
- package/dist/matter/account-address-book/account-address-country.js +83 -49
- package/dist/matter/account-address-book/account-address-country.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
- package/dist/matter/account-address-book/account-address-form.js +518 -155
- package/dist/matter/account-address-book/account-address-form.js.map +1 -1
- package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-record.js +32 -17
- package/dist/matter/account-address-book/account-address-record.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +34 -17
- package/dist/matter/account-menu/account-menu.js +46 -54
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
- package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
- package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
- package/dist/matter/billing-address/billing-address.d.ts +156 -74
- package/dist/matter/billing-address/billing-address.js +227 -156
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
- package/dist/matter/breadcrumb/breadcrumb.js +24 -9
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/buy-button/buy-button.d.ts +8 -11
- package/dist/matter/buy-button/buy-button.js +10 -19
- package/dist/matter/buy-button/buy-button.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +12 -4
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +123 -32
- package/dist/matter/card-entry/card-entry.js +348 -221
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cart/cart-namespace.d.ts +7 -1
- package/dist/matter/cart/cart-namespace.js +7 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +402 -61
- package/dist/matter/cart/cart.js +624 -153
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
- package/dist/matter/cart-destination/cart-destination.js +160 -70
- package/dist/matter/cart-destination/cart-destination.js.map +1 -1
- package/dist/matter/cart-item/cart-item.d.ts +144 -17
- package/dist/matter/cart-item/cart-item.js +166 -49
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
- package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
- package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
- package/dist/matter/challenge-return/challenge-return.js +241 -0
- package/dist/matter/challenge-return/challenge-return.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
- package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
- package/dist/matter/client-preferences/client-preferences.js +84 -15
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +44 -9
- package/dist/matter/client-profile/client-profile.js +64 -24
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
- package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
- package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
- package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
- package/dist/matter/delivery-options/delivery-options.js +75 -12
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
- package/dist/matter/email-identification/email-identification.d.ts +25 -3
- package/dist/matter/email-identification/email-identification.js +49 -12
- package/dist/matter/email-identification/email-identification.js.map +1 -1
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
- package/dist/matter/identity-edit/identity-edit.js +47 -19
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
- package/dist/matter/identity-summary/identity-summary.js +95 -45
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +98 -16
- package/dist/matter/installments/installments-select.js +156 -48
- package/dist/matter/installments/installments-select.js.map +1 -1
- package/dist/matter/installments/installments.d.ts +96 -16
- package/dist/matter/installments/installments.js +115 -40
- package/dist/matter/installments/installments.js.map +1 -1
- package/dist/matter/installments/use-installments-selection.d.ts +1 -0
- package/dist/matter/installments/use-installments-selection.js +8 -3
- package/dist/matter/installments/use-installments-selection.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
- package/dist/matter/my-account-profile/my-account-profile.js +370 -174
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
- package/dist/matter/order-cancel/order-cancel.js +118 -51
- package/dist/matter/order-cancel/order-cancel.js.map +1 -1
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
- package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
- package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
- package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
- package/dist/matter/order-details-header/order-details-header.js +66 -58
- package/dist/matter/order-details-header/order-details-header.js.map +1 -1
- package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +164 -19
- package/dist/matter/order-list/order-list.js +229 -87
- package/dist/matter/order-list/order-list.js.map +1 -1
- package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
- package/dist/matter/order-list-row/order-list-row.js +3 -2
- package/dist/matter/order-list-row/order-list-row.js.map +1 -1
- package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
- package/dist/matter/order-list-search/order-list-search.js +30 -69
- package/dist/matter/order-list-search/order-list-search.js.map +1 -1
- package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
- package/dist/matter/order-list-views/order-list-views.js +22 -68
- package/dist/matter/order-list-views/order-list-views.js.map +1 -1
- package/dist/matter/order-payment/order-payment.d.ts +33 -10
- package/dist/matter/order-payment/order-payment.js +44 -39
- package/dist/matter/order-payment/order-payment.js.map +1 -1
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
- package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
- package/dist/matter/order-placed/order-placed.d.ts +198 -31
- package/dist/matter/order-placed/order-placed.js +230 -139
- package/dist/matter/order-placed/order-placed.js.map +1 -1
- package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
- package/dist/matter/order-placed-date/order-placed-date.js +7 -8
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +19 -8
- package/dist/matter/order-progress/order-progress.js +37 -45
- package/dist/matter/order-progress/order-progress.js.map +1 -1
- package/dist/matter/order-summary/order-summary.d.ts +19 -9
- package/dist/matter/order-summary/order-summary.js +38 -44
- package/dist/matter/order-summary/order-summary.js.map +1 -1
- package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +17 -10
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.d.ts +4 -2
- package/dist/matter/payment/payment-controller.js +30 -9
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +1 -1
- package/dist/matter/payment/payment.d.ts +69 -19
- package/dist/matter/payment/payment.js +101 -35
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
- package/dist/matter/payment/use-payment-method-selection.js +94 -32
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
- package/dist/matter/payment/use-payment-submit-gate.js +47 -8
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +171 -57
- package/dist/matter/place-order/place-order.js +376 -185
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.d.ts +152 -13
- package/dist/matter/pricing/pricing.js +153 -52
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-information/product-information.d.ts +27 -4
- package/dist/matter/product-information/product-information.js +32 -15
- package/dist/matter/product-information/product-information.js.map +1 -1
- package/dist/matter/product-list/product-list.d.ts +24 -6
- package/dist/matter/product-list/product-list.js +32 -26
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
- package/dist/matter/product-shelf/product-shelf.js +2 -15
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.d.ts +33 -16
- package/dist/matter/region/region.js +59 -52
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +43 -8
- package/dist/matter/save-card/save-card.js +61 -23
- package/dist/matter/save-card/save-card.js.map +1 -1
- package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
- package/dist/matter/saved-cards/saved-cards.js +349 -77
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/shipping-address/address-payload.js +25 -0
- package/dist/matter/shipping-address/address-payload.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +71 -71
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
- package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
- package/dist/matter/shipping-address/shipping-address.js +443 -188
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
- package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in/sign-in.d.ts +108 -0
- package/dist/matter/sign-in/sign-in.js +285 -0
- package/dist/matter/sign-in/sign-in.js.map +1 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
- package/dist/matter/sign-in-form/sign-in-form.js +134 -144
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
- package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
- package/dist/particles/binding-switcher/binding-switcher.js +37 -26
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
- package/dist/particles/card-summary/card-summary.d.ts +38 -8
- package/dist/particles/card-summary/card-summary.js +55 -22
- package/dist/particles/card-summary/card-summary.js.map +1 -1
- package/dist/particles/carousel/carousel.d.ts +99 -11
- package/dist/particles/carousel/carousel.js +103 -35
- package/dist/particles/carousel/carousel.js.map +1 -1
- package/dist/particles/copy-text/copy-text.js +5 -15
- package/dist/particles/copy-text/copy-text.js.map +1 -1
- package/dist/particles/dialog/dialog.d.ts +14 -6
- package/dist/particles/dialog/dialog.js +6 -3
- package/dist/particles/dialog/dialog.js.map +1 -1
- package/dist/particles/drawer/drawer.js +1 -1
- package/dist/particles/drawer/drawer.js.map +1 -1
- package/dist/particles/email-field/email-field.d.ts +2 -1
- package/dist/particles/email-field/email-field.js +2 -1
- package/dist/particles/email-field/email-field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.js +1 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/form/form.d.ts +85 -13
- package/dist/particles/form/form.js +91 -42
- package/dist/particles/form/form.js.map +1 -1
- package/dist/particles/gallery/gallery.d.ts +129 -12
- package/dist/particles/gallery/gallery.js +121 -34
- package/dist/particles/gallery/gallery.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
- package/dist/particles/order-details-back/order-details-back.js +8 -10
- package/dist/particles/order-details-back/order-details-back.js.map +1 -1
- package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
- package/dist/particles/order-status-badge/order-status-badge.js +4 -20
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
- package/dist/particles/password-field/password-field.d.ts +1 -1
- package/dist/particles/password-field/password-field.js +2 -4
- package/dist/particles/password-field/password-field.js.map +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +4 -4
- package/dist/particles/phone-field/phone-field.js +8 -11
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/spinner/spinner.d.ts +24 -4
- package/dist/particles/spinner/spinner.js +25 -9
- package/dist/particles/spinner/spinner.js.map +1 -1
- package/dist/particles/switch/switch.d.ts +4 -1
- package/dist/particles/switch/switch.js +3 -1
- package/dist/particles/switch/switch.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +29 -3
- package/dist/particles/toast/toast.js +34 -10
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +164 -56
- package/dist/sdk/address/address-fields.js +4 -4
- package/dist/sdk/address/address-fields.js.map +1 -1
- package/dist/sdk/address/constants.js +1 -6
- package/dist/sdk/address/constants.js.map +1 -1
- package/dist/sdk/address/messages.js +44 -44
- package/dist/sdk/address/messages.js.map +1 -1
- package/dist/sdk/address/postal-code.js +15 -2
- package/dist/sdk/address/postal-code.js.map +1 -1
- package/dist/sdk/address/types.d.ts +5 -3
- package/dist/sdk/address/validate-address.js +3 -3
- package/dist/sdk/address/validate-address.js.map +1 -1
- package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/data/index.js +2 -2
- package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
- package/dist/sdk/generated/gql.js +1 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +20 -5
- package/dist/sdk/generated/graphql.js +6 -0
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/format-error-code.js +23 -0
- package/dist/sdk/i18n/format-error-code.js.map +1 -0
- package/dist/sdk/i18n/message-formatter.d.ts +22 -0
- package/dist/sdk/i18n/message-formatter.js +140 -0
- package/dist/sdk/i18n/message-formatter.js.map +1 -0
- package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
- package/dist/sdk/i18n/use-message-formatter.js +18 -0
- package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/redirect.d.ts +2 -0
- package/dist/sdk/navigation/redirect.js +19 -1
- package/dist/sdk/navigation/redirect.js.map +1 -1
- package/dist/sdk/navigation/types.d.ts +13 -0
- package/dist/sdk/payment/bin-format.js +20 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/seo/entity-landing.d.ts +24 -0
- package/dist/sdk/seo/entity-landing.js +30 -0
- package/dist/sdk/seo/entity-landing.js.map +1 -0
- package/dist/sdk/seo/page-alternates.d.ts +3 -2
- package/dist/sdk/seo/page-alternates.js +4 -2
- package/dist/sdk/seo/page-alternates.js.map +1 -1
- package/dist/sdk/seo/search-landing.d.ts +42 -0
- package/dist/sdk/seo/search-landing.js +85 -0
- package/dist/sdk/seo/search-landing.js.map +1 -0
- package/dist/sdk/session/mock-session.d.ts +9 -0
- package/dist/sdk/session/mock-session.js +31 -0
- package/dist/sdk/session/mock-session.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +3 -0
- package/dist/sdk/session/read-server-session.js +5 -0
- package/dist/sdk/session/read-server-session.js.map +1 -1
- package/dist/sdk/session/return-path-segment.d.ts +10 -0
- package/dist/sdk/session/return-path-segment.js +15 -0
- package/dist/sdk/session/return-path-segment.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
- package/dist/utils/safe-href.d.ts +2 -0
- package/package.json +4 -3
- package/skills/storefront-asset/SKILL.md +2 -2
- package/skills/storefront-asset/references/api-side.md +27 -14
- package/skills/storefront-asset/references/findings.md +5 -2
- package/src/styles/tailwind.css +8 -0
- package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
- package/dist/message-locales.json +0 -7
- package/dist/sdk/i18n/client.d.ts +0 -4
- package/dist/sdk/i18n/client.js +0 -4
- package/dist/sdk/i18n/locales.d.ts +0 -8
- package/dist/sdk/i18n/locales.js +0 -57
- package/dist/sdk/i18n/locales.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.js +0 -183
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -178
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
- package/dist/sdk/i18n/messages/es-ES.js +0 -183
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -178
- package/dist/sdk/i18n/messages/pt-BR.js +0 -183
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -178
- package/dist/sdk/i18n/provider.d.ts +0 -1
- package/dist/sdk/i18n/provider.js +0 -30
- package/dist/sdk/i18n/provider.js.map +0 -1
- package/dist/sdk/i18n/server.d.ts +0 -28
- package/dist/sdk/i18n/server.js +0 -59
- package/dist/sdk/i18n/server.js.map +0 -1
- package/dist/utils/resolve-authored-copy.js +0 -18
- package/dist/utils/resolve-authored-copy.js.map +0 -1
- package/dist/utils/substitute-template.js +0 -33
- package/dist/utils/substitute-template.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentValue } from "../../core/dist/define-content-type.js";
|
|
1
|
+
import { ContentValue, MessageLocaleProp } 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
4
|
import { PageRef } from "../../sdk/navigation/types.js";
|
|
@@ -44,6 +44,23 @@ export declare const AccountMenuContent: {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
+
export declare const AccountMenuListContent: {
|
|
48
|
+
readonly id: "account-menu-list";
|
|
49
|
+
readonly title: "Account Menu List";
|
|
50
|
+
readonly description: "The accessible name of the account's navigation landmark.";
|
|
51
|
+
readonly schema: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly additionalProperties: false;
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly label: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly title: "Accessible label";
|
|
58
|
+
readonly format: "icu-message";
|
|
59
|
+
readonly messageSource: "Account";
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
47
64
|
export declare const AccountMenuIndexRedirectContent: {
|
|
48
65
|
readonly id: "account-menu-index-redirect";
|
|
49
66
|
readonly title: "Account Menu Index Redirect";
|
|
@@ -61,6 +78,8 @@ export declare const AccountMenuIndexRedirectContent: {
|
|
|
61
78
|
readonly type: "string";
|
|
62
79
|
readonly minLength: 1;
|
|
63
80
|
readonly title: "No section message";
|
|
81
|
+
readonly format: "icu-message";
|
|
82
|
+
readonly messageSource: "No account section is configured.";
|
|
64
83
|
};
|
|
65
84
|
};
|
|
66
85
|
};
|
|
@@ -77,11 +96,15 @@ export declare const AccountMenuSignOutContent: {
|
|
|
77
96
|
readonly type: "string";
|
|
78
97
|
readonly minLength: 1;
|
|
79
98
|
readonly title: "Sign-out label";
|
|
99
|
+
readonly format: "icu-message";
|
|
100
|
+
readonly messageSource: "Sign out";
|
|
80
101
|
};
|
|
81
102
|
readonly errorMessage: {
|
|
82
103
|
readonly type: "string";
|
|
83
104
|
readonly minLength: 1;
|
|
84
105
|
readonly title: "Sign-out failed message";
|
|
106
|
+
readonly format: "icu-message";
|
|
107
|
+
readonly messageSource: "We couldn't sign you out. Please try again.";
|
|
85
108
|
};
|
|
86
109
|
};
|
|
87
110
|
};
|
|
@@ -117,26 +140,20 @@ export type AccountMenuRootProps = ComponentPropsWithRef<'div'> & {
|
|
|
117
140
|
$content?: AccountMenuContentValue;
|
|
118
141
|
};
|
|
119
142
|
/** The landmark renders one item per section, so it takes no children. */
|
|
120
|
-
export type AccountMenuListProps = Omit<ComponentPropsWithRef<'nav'>, 'children'> & {
|
|
121
|
-
/**
|
|
122
|
-
|
|
143
|
+
export type AccountMenuListProps = Omit<ComponentPropsWithRef<'nav'>, 'children'> & MessageLocaleProp & {
|
|
144
|
+
/** The accessible name of the navigation landmark. */
|
|
145
|
+
$content?: ContentValue<typeof AccountMenuListContent>;
|
|
123
146
|
};
|
|
124
147
|
/** It renders the gate's loading look or a message, so it forwards no element props beyond a class. */
|
|
125
|
-
export type AccountMenuIndexRedirectProps = {
|
|
148
|
+
export type AccountMenuIndexRedirectProps = MessageLocaleProp & {
|
|
126
149
|
/** Text announced while the first section opens. */
|
|
127
150
|
loadingLabel?: string;
|
|
128
|
-
/**
|
|
129
|
-
emptyMessage?: string;
|
|
130
|
-
/** Merchant-authored copy, sliced from the page content entry; wins over the props field by field. */
|
|
151
|
+
/** Merchant-authored copy: the loading label, which wins over the prop, and the no-section message. */
|
|
131
152
|
$content?: ContentValue<typeof AccountMenuIndexRedirectContent>;
|
|
132
153
|
className?: string;
|
|
133
154
|
};
|
|
134
|
-
export type AccountMenuSignOutProps = {
|
|
135
|
-
/** The control's
|
|
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. */
|
|
155
|
+
export type AccountMenuSignOutProps = MessageLocaleProp & {
|
|
156
|
+
/** The control's label and the message shown when the sign-out did not happen. */
|
|
140
157
|
$content?: ContentValue<typeof AccountMenuSignOutContent>;
|
|
141
158
|
/** Injected by the compiler from the definition's `actions`. */
|
|
142
159
|
$actions?: ComponentActions;
|
|
@@ -149,9 +166,9 @@ export declare const AccountMenuSignOutDefinition: ComponentDefinition<AccountMe
|
|
|
149
166
|
/** The resolved section list and the current section. */
|
|
150
167
|
export declare function useAccountMenu(): AccountMenuContextValue;
|
|
151
168
|
export declare function AccountMenuRoot({ items, $content, className, children, ...props }: AccountMenuRootProps): import("react/jsx-runtime").JSX.Element;
|
|
152
|
-
export declare function AccountMenuList({
|
|
153
|
-
export declare function AccountMenuIndexRedirect({ loadingLabel,
|
|
154
|
-
export declare function AccountMenuSignOut({
|
|
169
|
+
export declare function AccountMenuList({ $content, $locale, className, ...props }: AccountMenuListProps): import("react/jsx-runtime").JSX.Element | null;
|
|
170
|
+
export declare function AccountMenuIndexRedirect({ loadingLabel, $content, $locale, className }: Readonly<AccountMenuIndexRedirectProps>): import("react/jsx-runtime").JSX.Element;
|
|
171
|
+
export declare function AccountMenuSignOut({ $content, $locale, $actions: $actionsProp, className }: Readonly<AccountMenuSignOutProps>): import("react/jsx-runtime").JSX.Element;
|
|
155
172
|
export declare const AccountMenu: {
|
|
156
173
|
Root: typeof AccountMenuRoot;
|
|
157
174
|
List: typeof AccountMenuList;
|
|
@@ -5,6 +5,7 @@ import "../../core/dist/index.js";
|
|
|
5
5
|
import { resolveSafeHref, resolveSiteRelativeHref } from "../../utils/safe-href.js";
|
|
6
6
|
import { resolveStorefrontHref } from "../../sdk/navigation/resolve-storefront-href.js";
|
|
7
7
|
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
8
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
8
9
|
import { useRouteMap } from "../../sdk/navigation/route-map-provider.js";
|
|
9
10
|
import { useStorefrontNavigation } from "../../sdk/navigation/use-storefront-navigation.js";
|
|
10
11
|
import { useStorefrontRoute } from "../../sdk/navigation/use-storefront-route.js";
|
|
@@ -54,6 +55,21 @@ const AccountMenuContent = defineContentType({
|
|
|
54
55
|
} }
|
|
55
56
|
}
|
|
56
57
|
});
|
|
58
|
+
const AccountMenuListContent = defineContentType({
|
|
59
|
+
id: "account-menu-list",
|
|
60
|
+
title: "Account Menu List",
|
|
61
|
+
description: "The accessible name of the account's navigation landmark.",
|
|
62
|
+
schema: {
|
|
63
|
+
type: "object",
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
properties: { label: {
|
|
66
|
+
type: "string",
|
|
67
|
+
title: "Accessible label",
|
|
68
|
+
format: "icu-message",
|
|
69
|
+
messageSource: "Account"
|
|
70
|
+
} }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
57
73
|
const AccountMenuIndexRedirectContent = defineContentType({
|
|
58
74
|
id: "account-menu-index-redirect",
|
|
59
75
|
title: "Account Menu Index Redirect",
|
|
@@ -70,7 +86,9 @@ const AccountMenuIndexRedirectContent = defineContentType({
|
|
|
70
86
|
emptyMessage: {
|
|
71
87
|
type: "string",
|
|
72
88
|
minLength: 1,
|
|
73
|
-
title: "No section message"
|
|
89
|
+
title: "No section message",
|
|
90
|
+
format: "icu-message",
|
|
91
|
+
messageSource: "No account section is configured."
|
|
74
92
|
}
|
|
75
93
|
}
|
|
76
94
|
}
|
|
@@ -86,12 +104,16 @@ const AccountMenuSignOutContent = defineContentType({
|
|
|
86
104
|
label: {
|
|
87
105
|
type: "string",
|
|
88
106
|
minLength: 1,
|
|
89
|
-
title: "Sign-out label"
|
|
107
|
+
title: "Sign-out label",
|
|
108
|
+
format: "icu-message",
|
|
109
|
+
messageSource: "Sign out"
|
|
90
110
|
},
|
|
91
111
|
errorMessage: {
|
|
92
112
|
type: "string",
|
|
93
113
|
minLength: 1,
|
|
94
|
-
title: "Sign-out failed message"
|
|
114
|
+
title: "Sign-out failed message",
|
|
115
|
+
format: "icu-message",
|
|
116
|
+
messageSource: "We couldn't sign you out. Please try again."
|
|
95
117
|
}
|
|
96
118
|
}
|
|
97
119
|
}
|
|
@@ -116,17 +138,14 @@ const AccountMenuListDefinition = defineComponent({
|
|
|
116
138
|
name: "AccountMenuList",
|
|
117
139
|
importPath: "@vtex/faststore/components",
|
|
118
140
|
component: AccountMenuList,
|
|
141
|
+
content: AccountMenuListContent,
|
|
119
142
|
requiresContext: "account-menu",
|
|
120
143
|
editor: {
|
|
121
144
|
label: "Account Menu List",
|
|
122
145
|
category: "navigation"
|
|
123
146
|
},
|
|
124
|
-
schema: {
|
|
125
|
-
|
|
126
|
-
default: "Account",
|
|
127
|
-
label: "Aria Label"
|
|
128
|
-
} },
|
|
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."
|
|
147
|
+
schema: {},
|
|
148
|
+
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 $content field 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."
|
|
130
149
|
});
|
|
131
150
|
const AccountMenuIndexRedirectDefinition = defineComponent({
|
|
132
151
|
name: "AccountMenuIndexRedirect",
|
|
@@ -138,18 +157,11 @@ const AccountMenuIndexRedirectDefinition = defineComponent({
|
|
|
138
157
|
label: "Account Menu Index Redirect",
|
|
139
158
|
category: "navigation"
|
|
140
159
|
},
|
|
141
|
-
schema: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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."
|
|
160
|
+
schema: { loadingLabel: {
|
|
161
|
+
type: "string",
|
|
162
|
+
label: "Loading Announcement"
|
|
163
|
+
} },
|
|
164
|
+
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 ($content field emptyMessage) 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
165
|
});
|
|
154
166
|
const AccountMenuSignOutDefinition = defineComponent({
|
|
155
167
|
name: "AccountMenuSignOut",
|
|
@@ -161,19 +173,8 @@ const AccountMenuSignOutDefinition = defineComponent({
|
|
|
161
173
|
label: "Account Menu Sign Out",
|
|
162
174
|
category: "navigation"
|
|
163
175
|
},
|
|
164
|
-
schema: {
|
|
165
|
-
|
|
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."
|
|
176
|
+
schema: {},
|
|
177
|
+
guideline: "The account sidebar's way out, labelled by the $content field label: 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 ($content field errorMessage) 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
178
|
});
|
|
178
179
|
/**
|
|
179
180
|
* The library's default set, the five sections the PRD names. Labels are English as an interim, until
|
|
@@ -338,8 +339,9 @@ function AccountMenuRoot({ items, $content, className, children, ...props }) {
|
|
|
338
339
|
})
|
|
339
340
|
});
|
|
340
341
|
}
|
|
341
|
-
function AccountMenuList({
|
|
342
|
+
function AccountMenuList({ $content, $locale, className, ...props }) {
|
|
342
343
|
const { items, current } = useAccountMenu();
|
|
344
|
+
const { format } = useMessageFormatter(AccountMenuListContent, $content);
|
|
343
345
|
const currentRef = useRef(null);
|
|
344
346
|
const currentIndex = current?.index ?? null;
|
|
345
347
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -356,7 +358,7 @@ function AccountMenuList({ label = "Account", className, ...props }) {
|
|
|
356
358
|
if (items.length === 0) return null;
|
|
357
359
|
return /* @__PURE__ */ jsx("nav", {
|
|
358
360
|
...props,
|
|
359
|
-
"aria-label": label,
|
|
361
|
+
"aria-label": format("label"),
|
|
360
362
|
className,
|
|
361
363
|
"data-fs-account-menu-list": "",
|
|
362
364
|
children: /* @__PURE__ */ jsx("ul", {
|
|
@@ -382,7 +384,7 @@ function AccountMenuList({ label = "Account", className, ...props }) {
|
|
|
382
384
|
})
|
|
383
385
|
});
|
|
384
386
|
}
|
|
385
|
-
function AccountMenuIndexRedirect({ loadingLabel,
|
|
387
|
+
function AccountMenuIndexRedirect({ loadingLabel, $content, $locale, className }) {
|
|
386
388
|
const { items, current } = useAccountMenu();
|
|
387
389
|
const { bindingId } = useStorefrontContext();
|
|
388
390
|
const { routeMap } = useRouteMap();
|
|
@@ -394,13 +396,13 @@ function AccountMenuIndexRedirect({ loadingLabel, emptyMessage = "No account sec
|
|
|
394
396
|
replacedRef.current = true;
|
|
395
397
|
replace(destination);
|
|
396
398
|
}, [destination, replace]);
|
|
399
|
+
const { format } = useMessageFormatter(AccountMenuIndexRedirectContent, $content);
|
|
397
400
|
const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;
|
|
398
|
-
const entryEmptyMessage = $content?.emptyMessage?.trim() ? $content.emptyMessage : emptyMessage;
|
|
399
401
|
if (destination === null) return /* @__PURE__ */ jsx("p", {
|
|
400
402
|
className,
|
|
401
403
|
"data-fs-account-menu-index-redirect": "",
|
|
402
404
|
"data-fs-account-menu-index-redirect-empty": "",
|
|
403
|
-
children:
|
|
405
|
+
children: format("emptyMessage")
|
|
404
406
|
});
|
|
405
407
|
return /* @__PURE__ */ jsx(AccountAccessGateLoading, {
|
|
406
408
|
className,
|
|
@@ -408,15 +410,6 @@ function AccountMenuIndexRedirect({ loadingLabel, emptyMessage = "No account sec
|
|
|
408
410
|
children: entryLoadingLabel
|
|
409
411
|
});
|
|
410
412
|
}
|
|
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
413
|
/** An absent handler or a rejection is a sign-out that did not happen, never one that did. */
|
|
421
414
|
async function logOut(logout) {
|
|
422
415
|
if (!logout) return false;
|
|
@@ -427,8 +420,9 @@ async function logOut(logout) {
|
|
|
427
420
|
return false;
|
|
428
421
|
}
|
|
429
422
|
}
|
|
430
|
-
function AccountMenuSignOut({
|
|
423
|
+
function AccountMenuSignOut({ $content, $locale, $actions: $actionsProp, className }) {
|
|
431
424
|
const $actions = useActionsOverride($actionsProp);
|
|
425
|
+
const { format } = useMessageFormatter(AccountMenuSignOutContent, $content);
|
|
432
426
|
const { hrefFor } = useStorefrontNavigation();
|
|
433
427
|
const { basePath } = useStorefrontContext();
|
|
434
428
|
const signingOut = useSignOutIntent();
|
|
@@ -447,8 +441,6 @@ function AccountMenuSignOut({ label, errorMessage, $content, $actions: $actionsP
|
|
|
447
441
|
reportSignOutFailure();
|
|
448
442
|
withdrawSignOutIntent();
|
|
449
443
|
}
|
|
450
|
-
const entryLabel = firstAuthored($content?.label, label) ?? DEFAULT_SIGN_OUT_LABEL;
|
|
451
|
-
const entryErrorMessage = firstAuthored($content?.errorMessage, errorMessage) ?? DEFAULT_SIGN_OUT_ERROR;
|
|
452
444
|
return /* @__PURE__ */ jsxs("div", {
|
|
453
445
|
className,
|
|
454
446
|
"data-fs-account-menu-sign-out": "",
|
|
@@ -459,11 +451,11 @@ function AccountMenuSignOut({ label, errorMessage, $content, $actions: $actionsP
|
|
|
459
451
|
disabled: signingOut,
|
|
460
452
|
"aria-busy": signingOut || void 0,
|
|
461
453
|
"data-fs-account-menu-sign-out-button": "",
|
|
462
|
-
children:
|
|
454
|
+
children: format("label")
|
|
463
455
|
}), failed ? /* @__PURE__ */ jsx("p", {
|
|
464
456
|
role: "alert",
|
|
465
457
|
"data-fs-account-menu-sign-out-error": "",
|
|
466
|
-
children:
|
|
458
|
+
children: format("errorMessage")
|
|
467
459
|
}) : null]
|
|
468
460
|
});
|
|
469
461
|
}
|
|
@@ -474,6 +466,6 @@ const AccountMenu = {
|
|
|
474
466
|
SignOut: AccountMenuSignOut
|
|
475
467
|
};
|
|
476
468
|
//#endregion
|
|
477
|
-
export { AccountMenu, AccountMenuContent, AccountMenuIndexRedirect, AccountMenuIndexRedirectContent, AccountMenuIndexRedirectDefinition, AccountMenuList, AccountMenuListDefinition, AccountMenuRoot, AccountMenuRootDefinition, AccountMenuSignOut, AccountMenuSignOutContent, AccountMenuSignOutDefinition, useAccountMenu };
|
|
469
|
+
export { AccountMenu, AccountMenuContent, AccountMenuIndexRedirect, AccountMenuIndexRedirectContent, AccountMenuIndexRedirectDefinition, AccountMenuList, AccountMenuListContent, AccountMenuListDefinition, AccountMenuRoot, AccountMenuRootDefinition, AccountMenuSignOut, AccountMenuSignOutContent, AccountMenuSignOutDefinition, useAccountMenu };
|
|
478
470
|
|
|
479
471
|
//# sourceMappingURL=account-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-menu.js","names":[],"sources":["../../../src/matter/account-menu/account-menu.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport {\n type ComponentPropsWithRef,\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { NavigationLink } from '../../particles/navigation-link/navigation-link.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { resolveStorefrontHref } from '../../sdk/navigation/resolve-storefront-href.js';\nimport { useRouteMap } from '../../sdk/navigation/route-map-provider.js';\nimport type { PageRef, RouteMap } from '../../sdk/navigation/types.js';\nimport { useStorefrontNavigation } from '../../sdk/navigation/use-storefront-navigation.js';\nimport { useStorefrontRoute } from '../../sdk/navigation/use-storefront-route.js';\nimport type { SessionActions } from '../../sdk/session/use-session-actions.js';\nimport { resolveSafeHref, resolveSiteRelativeHref } from '../../utils/safe-href.js';\nimport { AccountAccessGateLoading } from '../account-access-gate/account-access-gate.js';\nimport {\n declareSignOutIntent,\n useSignOutIntent,\n withdrawSignOutIntent,\n} from '../account-access-gate/sign-out-intent.js';\nimport { clearSignOutFailure, reportSignOutFailure, useSignOutFailure } from './sign-out-failure.js';\n\n// The scroll has to land before paint, or the list shows its top for a frame and then jumps.\n// `useEffect` on the server silences React 19's \"useLayoutEffect does nothing on the server\", as\n// `matter/variant-selector` does for its own pre-paint measurement.\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const AccountMenuContent = defineContentType({\n id: 'account-menu',\n title: 'Account Menu',\n description: \"The ordered list of the account's sections, editable without a deployment.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n // `items` is not required, for the reason NavigationLinkList records: a missing element key\n // already omits the component, so requiring it would only cost the prop fallback its shape\n // validity.\n properties: {\n items: {\n type: 'array',\n title: 'Sections',\n minItems: 1,\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['label', 'href'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Label' },\n href: {\n type: 'string',\n minLength: 1,\n title: 'URL',\n format: 'uri-reference',\n // Author-time guidance only, and lookahead-free so the Admin's RE2-family engine takes it.\n pattern: '^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$',\n },\n external: { type: 'boolean', title: 'Leaves the account' },\n },\n },\n },\n },\n },\n});\n\n// Nothing is required, following the gate's model: a slice missing a required property is shape-invalid,\n// which drops the whole element rather than the one field.\nexport const AccountMenuIndexRedirectContent = defineContentType({\n id: 'account-menu-index-redirect',\n title: 'Account Menu Index Redirect',\n description: \"What the account's root shows while it opens the first section, and when there is none to open.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n loadingLabel: { type: 'string', minLength: 1, title: 'Loading announcement' },\n emptyMessage: { type: 'string', minLength: 1, title: 'No section message' },\n },\n },\n});\n\nexport const AccountMenuSignOutContent = defineContentType({\n id: 'account-menu-sign-out',\n title: 'Account Menu Sign Out',\n description: 'The sign-out control in the account sidebar, and what it says when signing out fails.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', minLength: 1, title: 'Sign-out label' },\n errorMessage: { type: 'string', minLength: 1, title: 'Sign-out failed message' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype AccountMenuContentValue = ContentValue<typeof AccountMenuContent>;\n\n/** One authored section. Derived from the model so the prop and content channels cannot drift; the prop\n * channel also takes a page reference. */\nexport type AccountMenuSection = Omit<NonNullable<AccountMenuContentValue['items']>[number], 'href'> & {\n href: PageRef | string;\n};\n\n/** A section resolved for render. A null `href` is a destination the allowlist refused. */\nexport type AccountMenuResolvedSection = {\n label: string;\n href: PageRef | string | null;\n external: boolean;\n};\n\nexport type AccountMenuCurrent = {\n /** Index into the resolved list. */\n index: number;\n /** `exact` when the path is the section; `ancestor` when the shopper is inside it. */\n match: 'exact' | 'ancestor';\n};\n\nexport type AccountMenuContextValue = {\n /** Resolved, in the merchant's order, with blank-label sections dropped. */\n items: readonly AccountMenuResolvedSection[];\n /** The current section, or null when the path matches none. */\n current: AccountMenuCurrent | null;\n};\n\nexport type AccountMenuRootProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback for the section list, used when no CMS entry supplies one. */\n items?: readonly AccountMenuSection[];\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: AccountMenuContentValue;\n};\n\n/** The landmark renders one item per section, so it takes no children. */\nexport type AccountMenuListProps = Omit<ComponentPropsWithRef<'nav'>, 'children'> & {\n /** Accessible name of the navigation landmark. */\n label?: string;\n};\n\n/** It renders the gate's loading look or a message, so it forwards no element props beyond a class. */\nexport type AccountMenuIndexRedirectProps = {\n /** Text announced while the first section opens. */\n loadingLabel?: string;\n /** What the root says when the list holds no section to open. */\n emptyMessage?: string;\n /** Merchant-authored copy, sliced from the page content entry; wins over the props field by field. */\n $content?: ContentValue<typeof AccountMenuIndexRedirectContent>;\n className?: string;\n};\n\nexport type AccountMenuSignOutProps = {\n /** The control's text. */\n label?: string;\n /** What the shopper is told when the sign-out did not happen. */\n errorMessage?: string;\n /** Merchant-authored copy, sliced from the layout content entry; wins over the props field by field. */\n $content?: ContentValue<typeof AccountMenuSignOutContent>;\n /** Injected by the compiler from the definition's `actions`. */\n $actions?: ComponentActions;\n className?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountMenuRootDefinition = defineComponent<AccountMenuRootProps>({\n name: 'AccountMenuRoot',\n importPath: '@vtex/faststore/components',\n component: AccountMenuRoot,\n content: AccountMenuContent,\n providesContext: 'account-menu',\n editor: { label: 'Account Menu Root', category: 'navigation' },\n schema: {\n items: { type: 'array', label: 'Sections' },\n },\n guideline:\n \"The account menu's provider, and deliberately not its landmark: it resolves the section list, derives which section the shopper is reading, publishes both, and renders its children. Compose it in the my-account layout around both AccountMenuList and the Slot holding the section's own page — its context has to reach the consumers inside the slot, and a nav stretched that far would announce every section's content as navigation. The list comes from a published entry, else the authored items prop, else the library's five defaults; a channel supplying an empty list resolves to empty rather than falling through, because a merchant who cleared the list cleared it. Style it through data-fs-account-menu.\",\n});\n\nexport const AccountMenuListDefinition = defineComponent<AccountMenuListProps>({\n name: 'AccountMenuList',\n importPath: '@vtex/faststore/components',\n component: AccountMenuList,\n requiresContext: 'account-menu',\n editor: { label: 'Account Menu List', category: 'navigation' },\n schema: {\n label: { type: 'string', default: 'Account', label: 'Aria Label' },\n },\n guideline:\n \"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.\",\n});\n\nexport const AccountMenuIndexRedirectDefinition = defineComponent<AccountMenuIndexRedirectProps>({\n name: 'AccountMenuIndexRedirect',\n importPath: '@vtex/faststore/components',\n component: AccountMenuIndexRedirect,\n content: AccountMenuIndexRedirectContent,\n requiresContext: 'account-menu',\n editor: { label: 'Account Menu Index Redirect', category: 'navigation' },\n schema: {\n // Mirrored from the content model on purpose, as every content-bearing component in the library\n // does: the entry wins when published, and this is what a store without a CMS authors.\n loadingLabel: { type: 'string', label: 'Loading Announcement' },\n emptyMessage: { type: 'string', default: 'No account section is configured.', label: 'No Section Message' },\n },\n guideline:\n \"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.\",\n});\n\nexport const AccountMenuSignOutDefinition = defineComponent<AccountMenuSignOutProps>({\n name: 'AccountMenuSignOut',\n importPath: '@vtex/faststore/components',\n component: AccountMenuSignOut,\n content: AccountMenuSignOutContent,\n actions: { session: ['logout'] },\n editor: { label: 'Account Menu Sign Out', category: 'navigation' },\n schema: {\n label: { type: 'string', default: 'Sign out', label: 'Label' },\n errorMessage: {\n type: 'string',\n default: \"We couldn't sign you out. Please try again.\",\n label: 'Sign-out Failed Message',\n },\n },\n guideline:\n \"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.\",\n});\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\n/**\n * The library's default set, the five sections the PRD names. Labels are English as an interim, until\n * the Localization cluster's catalog resolves them per locale. Their destinations only resolve in a\n * store that declares the five standard pages.\n */\nconst DEFAULT_SECTIONS: readonly AccountMenuSection[] = [\n { label: 'Profile', href: { standard: 'profile' } },\n { label: 'Orders', href: { standard: 'orders' } },\n { label: 'Address', href: { standard: 'address' } },\n { label: 'Payments', href: { standard: 'payments' } },\n { label: 'Security', href: { standard: 'security' } },\n];\n\nconst HOME_PAGE: PageRef = { standard: 'home' };\n\nfunction resolveSections(sections: readonly AccountMenuSection[]): AccountMenuResolvedSection[] {\n const resolved: AccountMenuResolvedSection[] = [];\n\n sections.forEach((section, index) => {\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank label\n // reaches the component. Drop the section: an anchor with no accessible name is a WCAG failure.\n if (section.label.trim().length === 0) {\n return;\n }\n const external = section.external ?? false;\n // A page reference names a page of this store, so the allowlist has nothing to judge.\n if (typeof section.href !== 'string') {\n resolved.push({ label: section.label, href: section.href, external });\n return;\n }\n const destination = resolveSafeHref(section.href);\n if (!destination.safe) {\n console.warn('[AccountMenu] section destination rejected', { index, reason: destination.reason });\n }\n resolved.push({ label: section.label, href: destination.safe ? destination.href : null, external });\n });\n\n return resolved;\n}\n\n/** What a match runs against: no query, no hash, and no trailing slash except at the root. */\nfunction normalizePath(value: string): string {\n const separator = value.search(/[?#]/);\n const path = separator === -1 ? value : value.slice(0, separator);\n const trimmed = path.replace(/\\/+$/, '');\n return trimmed.length === 0 ? '/' : trimmed;\n}\n\n/**\n * The section's path inside the current binding, compared against the route's logical path: a\n * reference resolved without the base path, or an authored site-relative string as written. The menu\n * renders in a layout, outside the page's route marker, so the path is all it can compare. `null` for\n * an external section, a refused or absolute destination, and a reference that does not resolve: none\n * of them is a path of the account.\n */\nfunction logicalPathOf(section: AccountMenuResolvedSection, bindingId: string, routeMap: RouteMap): string | null {\n if (section.external || section.href === null) {\n return null;\n }\n if (typeof section.href === 'string') {\n return resolveSiteRelativeHref(section.href).safe ? section.href : null;\n }\n return resolveStorefrontHref({ bindingId, basePath: '/' }, routeMap, section.href).href;\n}\n\n/**\n * The current section, matched on segment boundaries. Legacy matched by prefix and marked every\n * section whose path was a prefix of the current one; the longest match wins here, which keeps\n * exactly one section current and makes an exact match beat every ancestor without a second rule.\n */\nfunction findCurrent(\n sections: readonly AccountMenuResolvedSection[],\n logicalPath: string,\n bindingId: string,\n routeMap: RouteMap,\n): AccountMenuCurrent | null {\n const path = normalizePath(logicalPath);\n let current: AccountMenuCurrent | null = null;\n let matchedLength = -1;\n\n for (const [index, section] of sections.entries()) {\n const sectionPath = logicalPathOf(section, bindingId, routeMap);\n if (sectionPath === null) {\n continue;\n }\n const href = normalizePath(sectionPath);\n if (href.length <= matchedLength) {\n continue;\n }\n // A root href is an ancestor of every account path, so a merchant listing the storefront's home\n // beside the sections would otherwise see it current on every page. It matches exactly or not at all.\n const exact = path === href;\n const ancestor = href !== '/' && path.startsWith(`${href}/`);\n if (!exact && !ancestor) {\n continue;\n }\n current = { index, match: exact ? 'exact' : 'ancestor' };\n matchedLength = href.length;\n }\n\n return current;\n}\n\n/**\n * Where the account's root opens: the first section that stays in the account. An external entry would\n * eject the shopper from the account they just opened, and so would an absolute one the merchant did not\n * flag — the same site-relative reading `findCurrent` applies. The page itself is skipped too, in every\n * spelling that matches it, since replacing it with itself would leave the loading look up for good.\n */\nfunction findIndexDestination(\n sections: readonly AccountMenuResolvedSection[],\n current: AccountMenuCurrent | null,\n bindingId: string,\n routeMap: RouteMap,\n): PageRef | string | null {\n const here = current?.match === 'exact' ? sections[current.index] : undefined;\n const herePath = here ? logicalPathOf(here, bindingId, routeMap) : null;\n const hereNormalized = herePath === null ? null : normalizePath(herePath);\n\n for (const section of sections) {\n const sectionPath = logicalPathOf(section, bindingId, routeMap);\n if (section.href === null || sectionPath === null || normalizePath(sectionPath) === hereNormalized) {\n continue;\n }\n return section.href;\n }\n\n return null;\n}\n\n/**\n * `page` for the section itself, `true` for a page inside it. The distinction is kept rather than\n * collapsed because the sibling breadcrumb names the deep page as the current one, and two surfaces\n * announcing \"current page\" for two different things is worse than the menu claiming only its set.\n */\nfunction ariaCurrentFor(match: AccountMenuCurrent['match']): 'page' | 'true' {\n return match === 'exact' ? 'page' : 'true';\n}\n\nfunction overflows(element: Element | null | undefined): boolean {\n if (!element) {\n return false;\n }\n return element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AccountMenuContext = createContext<AccountMenuContextValue | null>(null);\n\n/** The resolved section list and the current section. */\nexport function useAccountMenu(): AccountMenuContextValue {\n const value = useContext(AccountMenuContext);\n if (!value) {\n throw new Error('AccountMenu parts must be used inside AccountMenuRoot.');\n }\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function AccountMenuRoot({ items, $content, className, children, ...props }: AccountMenuRootProps) {\n const { path } = useStorefrontRoute();\n const { bindingId } = useStorefrontContext();\n const { routeMap } = useRouteMap();\n // Presence decides, not truthiness: a channel supplying an empty list resolves to empty rather than\n // falling through, so the defaults never override a list the merchant published deliberately.\n // `minItems` guides the Admin form only, so that empty list still reaches this component.\n const sections = $content?.items ?? items ?? DEFAULT_SECTIONS;\n\n const value = useMemo<AccountMenuContextValue>(() => {\n const resolved = resolveSections(sections);\n return { items: resolved, current: findCurrent(resolved, path, bindingId, routeMap) };\n }, [sections, path, bindingId, routeMap]);\n\n return (\n <AccountMenuContext value={value}>\n <div {...props} className={className} data-fs-account-menu=\"\">\n {children}\n </div>\n </AccountMenuContext>\n );\n}\n\nexport function AccountMenuList({ label = 'Account', className, ...props }: AccountMenuListProps) {\n const { items, current } = useAccountMenu();\n const currentRef = useRef<HTMLLIElement>(null);\n const currentIndex = current?.index ?? null;\n\n useIsomorphicLayoutEffect(() => {\n if (currentIndex === null) {\n return;\n }\n const item = currentRef.current;\n if (!item || typeof item.scrollIntoView !== 'function') {\n return;\n }\n // Only when the row actually scrolls. An unconditional call scrolls whatever ancestor can move,\n // which on a menu that fits is the page. The containers are the item's `ul` and its `nav`.\n const list = item.parentElement;\n if (!overflows(list) && !overflows(list?.parentElement)) {\n return;\n }\n // `nearest` on both axes is a no-op once the item is visible, so a route change inside the\n // current section does not jolt the row.\n item.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }, [currentIndex]);\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <nav {...props} aria-label={label} className={className} data-fs-account-menu-list=\"\">\n <ul data-fs-account-menu-items=\"\">\n {items.map((item, index) => {\n const isCurrent = index === currentIndex;\n return (\n <li\n key={index}\n ref={isCurrent ? currentRef : null}\n data-fs-account-menu-item=\"\"\n data-fs-account-menu-item-current={isCurrent ? '' : undefined}\n >\n {item.href === null ? (\n <span data-fs-text=\"\" data-fs-account-menu-text=\"\">\n {item.label}\n </span>\n ) : (\n <NavigationLink\n href={item.href}\n aria-current={current && isCurrent ? ariaCurrentFor(current.match) : undefined}\n data-fs-account-menu-link=\"\"\n >\n {item.label}\n </NavigationLink>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n}\n\nexport function AccountMenuIndexRedirect({\n loadingLabel,\n emptyMessage = 'No account section is configured.',\n $content,\n className,\n}: Readonly<AccountMenuIndexRedirectProps>) {\n const { items, current } = useAccountMenu();\n const { bindingId } = useStorefrontContext();\n const { routeMap } = useRouteMap();\n const { replace } = useStorefrontNavigation();\n // StrictMode runs an effect twice, and a router whose identity changes per render re-runs it on every\n // pass; one replace is the whole of this part's job.\n const replacedRef = useRef(false);\n\n const destination = findIndexDestination(items, current, bindingId, routeMap);\n\n useEffect(() => {\n if (destination === null || replacedRef.current) {\n return;\n }\n replacedRef.current = true;\n // Replace rather than push, so back from the section leaves the account instead of bouncing through\n // its root.\n // react-doctor-disable-next-line nextjs-no-client-side-redirect -- the order is the merchant's, published at runtime, so no static redirect can express it\n replace(destination);\n }, [destination, replace]);\n\n // Blank entry fields fall through, so clearing one in the Admin reads as unauthored.\n const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;\n const entryEmptyMessage = $content?.emptyMessage?.trim() ? $content.emptyMessage : emptyMessage;\n\n if (destination === null) {\n return (\n <p className={className} data-fs-account-menu-index-redirect=\"\" data-fs-account-menu-index-redirect-empty=\"\">\n {entryEmptyMessage}\n </p>\n );\n }\n\n // The gate's own part rather than one of this part's: in the account layout the gate's wait for the\n // session comes first, and carrying the same look on until the section lands is what keeps a second\n // one from flashing between the two.\n return (\n <AccountAccessGateLoading className={className} data-fs-account-menu-index-redirect=\"\">\n {entryLoadingLabel}\n </AccountAccessGateLoading>\n );\n}\n\nconst DEFAULT_SIGN_OUT_LABEL = 'Sign out';\nconst DEFAULT_SIGN_OUT_ERROR = \"We couldn't sign you out. Please try again.\";\n\n/**\n * The first non-blank of the given values. The models' `minLength` is enforced by neither the runtime\n * slice nor the preflight, and a blank here is a nameless button or a silent failure.\n */\nfunction firstAuthored(...values: (string | undefined)[]): string | undefined {\n return values.find((value) => value?.trim());\n}\n\n/** An absent handler or a rejection is a sign-out that did not happen, never one that did. */\nasync function logOut(logout: SessionActions['logout'] | undefined): Promise<boolean> {\n if (!logout) {\n return false;\n }\n try {\n const errors = await logout();\n return errors.length === 0;\n } catch (error) {\n console.error('[AccountMenuSignOut] logout rejected', error);\n return false;\n }\n}\n\nexport function AccountMenuSignOut({\n label,\n errorMessage,\n $content,\n $actions: $actionsProp,\n className,\n}: Readonly<AccountMenuSignOutProps>) {\n const $actions = useActionsOverride($actionsProp);\n const { hrefFor } = useStorefrontNavigation();\n const { basePath } = useStorefrontContext();\n // Any standing intent, whichever control declared it, is a sign-out under way.\n const signingOut = useSignOutIntent();\n const failed = useSignOutFailure();\n // Two activations in the same task see the same render, so the disabled button alone cannot stop\n // the second one.\n const attemptingRef = useRef(false);\n\n async function handleClick() {\n if (attemptingRef.current) {\n return;\n }\n attemptingRef.current = true;\n clearSignOutFailure();\n // Before the await: the logout payload flips the session in place, and a gate that got its turn\n // between the response and the navigation would send the shopper to sign in for the account they\n // just left. From here on this control is unmounted under the gate; the handler still settles.\n declareSignOutIntent();\n\n if (await logOut($actions?.session?.logout)) {\n // A document load rather than the router, whose cache would keep the account behind the back\n // control. What the browser's back-forward cache restores is the gate's to revalidate.\n globalThis.location.assign(hrefFor(HOME_PAGE) ?? basePath);\n return;\n }\n\n attemptingRef.current = false;\n reportSignOutFailure();\n withdrawSignOutIntent();\n }\n\n const entryLabel = firstAuthored($content?.label, label) ?? DEFAULT_SIGN_OUT_LABEL;\n const entryErrorMessage = firstAuthored($content?.errorMessage, errorMessage) ?? DEFAULT_SIGN_OUT_ERROR;\n\n return (\n <div\n className={className}\n data-fs-account-menu-sign-out=\"\"\n data-fs-account-menu-sign-out-pending={signingOut ? '' : undefined}\n >\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={signingOut}\n aria-busy={signingOut || undefined}\n data-fs-account-menu-sign-out-button=\"\"\n >\n {entryLabel}\n </button>\n {failed ? (\n <p role=\"alert\" data-fs-account-menu-sign-out-error=\"\">\n {entryErrorMessage}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const AccountMenu = {\n Root: AccountMenuRoot,\n List: AccountMenuList,\n IndexRedirect: AccountMenuIndexRedirect,\n SignOut: AccountMenuSignOut,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,4BAA4B,OAAO,WAAW,cAAc,YAAY;AAM9E,MAAa,qBAAqB,kBAAkB;CAClD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EAItB,YAAY,EACV,OAAO;GACL,MAAM;GACN,OAAO;GACP,UAAU;GACV,OAAO;IACL,MAAM;IACN,sBAAsB;IACtB,UAAU,CAAC,SAAS,MAAM;IAC1B,YAAY;KACV,OAAO;MAAE,MAAM;MAAU,WAAW;MAAG,OAAO;KAAQ;KACtD,MAAM;MACJ,MAAM;MACN,WAAW;MACX,OAAO;MACP,QAAQ;MAER,SAAS;KACX;KACA,UAAU;MAAE,MAAM;MAAW,OAAO;KAAqB;IAC3D;GACF;EACF,EACF;CACF;AACF,CAAC;AAID,MAAa,kCAAkC,kBAAkB;CAC/D,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,cAAc;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAuB;GAC5E,cAAc;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAqB;EAC5E;CACF;AACF,CAAC;AAED,MAAa,4BA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CACN,MAAM;CACN,eAAe;CACf,SAAS;AACX"}
|
|
1
|
+
{"version":3,"file":"account-menu.js","names":[],"sources":["../../../src/matter/account-menu/account-menu.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport {\n type ComponentPropsWithRef,\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport { NavigationLink } from '../../particles/navigation-link/navigation-link.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { resolveStorefrontHref } from '../../sdk/navigation/resolve-storefront-href.js';\nimport { useRouteMap } from '../../sdk/navigation/route-map-provider.js';\nimport type { PageRef, RouteMap } from '../../sdk/navigation/types.js';\nimport { useStorefrontNavigation } from '../../sdk/navigation/use-storefront-navigation.js';\nimport { useStorefrontRoute } from '../../sdk/navigation/use-storefront-route.js';\nimport type { SessionActions } from '../../sdk/session/use-session-actions.js';\nimport { resolveSafeHref, resolveSiteRelativeHref } from '../../utils/safe-href.js';\nimport { AccountAccessGateLoading } from '../account-access-gate/account-access-gate.js';\nimport {\n declareSignOutIntent,\n useSignOutIntent,\n withdrawSignOutIntent,\n} from '../account-access-gate/sign-out-intent.js';\nimport { clearSignOutFailure, reportSignOutFailure, useSignOutFailure } from './sign-out-failure.js';\n\n// The scroll has to land before paint, or the list shows its top for a frame and then jumps.\n// `useEffect` on the server silences React 19's \"useLayoutEffect does nothing on the server\", as\n// `matter/variant-selector` does for its own pre-paint measurement.\nconst useIsomorphicLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const AccountMenuContent = defineContentType({\n id: 'account-menu',\n title: 'Account Menu',\n description: \"The ordered list of the account's sections, editable without a deployment.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n // `items` is not required, for the reason NavigationLinkList records: a missing element key\n // already omits the component, so requiring it would only cost the prop fallback its shape\n // validity.\n properties: {\n items: {\n type: 'array',\n title: 'Sections',\n minItems: 1,\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['label', 'href'],\n properties: {\n label: { type: 'string', minLength: 1, title: 'Label' },\n href: {\n type: 'string',\n minLength: 1,\n title: 'URL',\n format: 'uri-reference',\n // Author-time guidance only, and lookahead-free so the Admin's RE2-family engine takes it.\n pattern: '^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$',\n },\n external: { type: 'boolean', title: 'Leaves the account' },\n },\n },\n },\n },\n },\n});\n\nexport const AccountMenuListContent = defineContentType({\n id: 'account-menu-list',\n title: 'Account Menu List',\n description: \"The accessible name of the account's navigation landmark.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Accessible label', format: 'icu-message', messageSource: 'Account' },\n },\n },\n});\n\n// Nothing is required, following the gate's model: a slice missing a required property is shape-invalid,\n// which drops the whole element rather than the one field.\nexport const AccountMenuIndexRedirectContent = defineContentType({\n id: 'account-menu-index-redirect',\n title: 'Account Menu Index Redirect',\n description: \"What the account's root shows while it opens the first section, and when there is none to open.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n loadingLabel: { type: 'string', minLength: 1, title: 'Loading announcement' },\n emptyMessage: {\n type: 'string',\n minLength: 1,\n title: 'No section message',\n format: 'icu-message',\n messageSource: 'No account section is configured.',\n },\n },\n },\n});\n\nexport const AccountMenuSignOutContent = defineContentType({\n id: 'account-menu-sign-out',\n title: 'Account Menu Sign Out',\n description: 'The sign-out control in the account sidebar, and what it says when signing out fails.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: {\n type: 'string',\n minLength: 1,\n title: 'Sign-out label',\n format: 'icu-message',\n messageSource: 'Sign out',\n },\n errorMessage: {\n type: 'string',\n minLength: 1,\n title: 'Sign-out failed message',\n format: 'icu-message',\n messageSource: \"We couldn't sign you out. Please try again.\",\n },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype AccountMenuContentValue = ContentValue<typeof AccountMenuContent>;\n\n/** One authored section. Derived from the model so the prop and content channels cannot drift; the prop\n * channel also takes a page reference. */\nexport type AccountMenuSection = Omit<NonNullable<AccountMenuContentValue['items']>[number], 'href'> & {\n href: PageRef | string;\n};\n\n/** A section resolved for render. A null `href` is a destination the allowlist refused. */\nexport type AccountMenuResolvedSection = {\n label: string;\n href: PageRef | string | null;\n external: boolean;\n};\n\nexport type AccountMenuCurrent = {\n /** Index into the resolved list. */\n index: number;\n /** `exact` when the path is the section; `ancestor` when the shopper is inside it. */\n match: 'exact' | 'ancestor';\n};\n\nexport type AccountMenuContextValue = {\n /** Resolved, in the merchant's order, with blank-label sections dropped. */\n items: readonly AccountMenuResolvedSection[];\n /** The current section, or null when the path matches none. */\n current: AccountMenuCurrent | null;\n};\n\nexport type AccountMenuRootProps = ComponentPropsWithRef<'div'> & {\n /** Authored fallback for the section list, used when no CMS entry supplies one. */\n items?: readonly AccountMenuSection[];\n /** Injected by the compiler, sliced from the page's or layout's composite content entry. */\n $content?: AccountMenuContentValue;\n};\n\n/** The landmark renders one item per section, so it takes no children. */\nexport type AccountMenuListProps = Omit<ComponentPropsWithRef<'nav'>, 'children'> &\n MessageLocaleProp & {\n /** The accessible name of the navigation landmark. */\n $content?: ContentValue<typeof AccountMenuListContent>;\n };\n\n/** It renders the gate's loading look or a message, so it forwards no element props beyond a class. */\nexport type AccountMenuIndexRedirectProps = MessageLocaleProp & {\n /** Text announced while the first section opens. */\n loadingLabel?: string;\n /** Merchant-authored copy: the loading label, which wins over the prop, and the no-section message. */\n $content?: ContentValue<typeof AccountMenuIndexRedirectContent>;\n className?: string;\n};\n\nexport type AccountMenuSignOutProps = MessageLocaleProp & {\n /** The control's label and the message shown when the sign-out did not happen. */\n $content?: ContentValue<typeof AccountMenuSignOutContent>;\n /** Injected by the compiler from the definition's `actions`. */\n $actions?: ComponentActions;\n className?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountMenuRootDefinition = defineComponent<AccountMenuRootProps>({\n name: 'AccountMenuRoot',\n importPath: '@vtex/faststore/components',\n component: AccountMenuRoot,\n content: AccountMenuContent,\n providesContext: 'account-menu',\n editor: { label: 'Account Menu Root', category: 'navigation' },\n schema: {\n items: { type: 'array', label: 'Sections' },\n },\n guideline:\n \"The account menu's provider, and deliberately not its landmark: it resolves the section list, derives which section the shopper is reading, publishes both, and renders its children. Compose it in the my-account layout around both AccountMenuList and the Slot holding the section's own page — its context has to reach the consumers inside the slot, and a nav stretched that far would announce every section's content as navigation. The list comes from a published entry, else the authored items prop, else the library's five defaults; a channel supplying an empty list resolves to empty rather than falling through, because a merchant who cleared the list cleared it. Style it through data-fs-account-menu.\",\n});\n\nexport const AccountMenuListDefinition = defineComponent<AccountMenuListProps>({\n name: 'AccountMenuList',\n importPath: '@vtex/faststore/components',\n component: AccountMenuList,\n content: AccountMenuListContent,\n requiresContext: 'account-menu',\n editor: { label: 'Account Menu List', category: 'navigation' },\n schema: {},\n guideline:\n \"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 $content field 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.\",\n});\n\nexport const AccountMenuIndexRedirectDefinition = defineComponent<AccountMenuIndexRedirectProps>({\n name: 'AccountMenuIndexRedirect',\n importPath: '@vtex/faststore/components',\n component: AccountMenuIndexRedirect,\n content: AccountMenuIndexRedirectContent,\n requiresContext: 'account-menu',\n editor: { label: 'Account Menu Index Redirect', category: 'navigation' },\n schema: {\n // Mirrored from the content model on purpose, as every content-bearing component in the library\n // does: the entry wins when published, and this is what a store without a CMS authors.\n loadingLabel: { type: 'string', label: 'Loading Announcement' },\n },\n guideline:\n \"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 ($content field emptyMessage) 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.\",\n});\n\nexport const AccountMenuSignOutDefinition = defineComponent<AccountMenuSignOutProps>({\n name: 'AccountMenuSignOut',\n importPath: '@vtex/faststore/components',\n component: AccountMenuSignOut,\n content: AccountMenuSignOutContent,\n actions: { session: ['logout'] },\n editor: { label: 'Account Menu Sign Out', category: 'navigation' },\n schema: {},\n guideline:\n \"The account sidebar's way out, labelled by the $content field label: 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 ($content field errorMessage) 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.\",\n});\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\n/**\n * The library's default set, the five sections the PRD names. Labels are English as an interim, until\n * the Localization cluster's catalog resolves them per locale. Their destinations only resolve in a\n * store that declares the five standard pages.\n */\nconst DEFAULT_SECTIONS: readonly AccountMenuSection[] = [\n { label: 'Profile', href: { standard: 'profile' } },\n { label: 'Orders', href: { standard: 'orders' } },\n { label: 'Address', href: { standard: 'address' } },\n { label: 'Payments', href: { standard: 'payments' } },\n { label: 'Security', href: { standard: 'security' } },\n];\n\nconst HOME_PAGE: PageRef = { standard: 'home' };\n\nfunction resolveSections(sections: readonly AccountMenuSection[]): AccountMenuResolvedSection[] {\n const resolved: AccountMenuResolvedSection[] = [];\n\n sections.forEach((section, index) => {\n // `minLength` is enforced by neither the runtime slice nor the preflight, so a blank label\n // reaches the component. Drop the section: an anchor with no accessible name is a WCAG failure.\n if (section.label.trim().length === 0) {\n return;\n }\n const external = section.external ?? false;\n // A page reference names a page of this store, so the allowlist has nothing to judge.\n if (typeof section.href !== 'string') {\n resolved.push({ label: section.label, href: section.href, external });\n return;\n }\n const destination = resolveSafeHref(section.href);\n if (!destination.safe) {\n console.warn('[AccountMenu] section destination rejected', { index, reason: destination.reason });\n }\n resolved.push({ label: section.label, href: destination.safe ? destination.href : null, external });\n });\n\n return resolved;\n}\n\n/** What a match runs against: no query, no hash, and no trailing slash except at the root. */\nfunction normalizePath(value: string): string {\n const separator = value.search(/[?#]/);\n const path = separator === -1 ? value : value.slice(0, separator);\n const trimmed = path.replace(/\\/+$/, '');\n return trimmed.length === 0 ? '/' : trimmed;\n}\n\n/**\n * The section's path inside the current binding, compared against the route's logical path: a\n * reference resolved without the base path, or an authored site-relative string as written. The menu\n * renders in a layout, outside the page's route marker, so the path is all it can compare. `null` for\n * an external section, a refused or absolute destination, and a reference that does not resolve: none\n * of them is a path of the account.\n */\nfunction logicalPathOf(section: AccountMenuResolvedSection, bindingId: string, routeMap: RouteMap): string | null {\n if (section.external || section.href === null) {\n return null;\n }\n if (typeof section.href === 'string') {\n return resolveSiteRelativeHref(section.href).safe ? section.href : null;\n }\n return resolveStorefrontHref({ bindingId, basePath: '/' }, routeMap, section.href).href;\n}\n\n/**\n * The current section, matched on segment boundaries. Legacy matched by prefix and marked every\n * section whose path was a prefix of the current one; the longest match wins here, which keeps\n * exactly one section current and makes an exact match beat every ancestor without a second rule.\n */\nfunction findCurrent(\n sections: readonly AccountMenuResolvedSection[],\n logicalPath: string,\n bindingId: string,\n routeMap: RouteMap,\n): AccountMenuCurrent | null {\n const path = normalizePath(logicalPath);\n let current: AccountMenuCurrent | null = null;\n let matchedLength = -1;\n\n for (const [index, section] of sections.entries()) {\n const sectionPath = logicalPathOf(section, bindingId, routeMap);\n if (sectionPath === null) {\n continue;\n }\n const href = normalizePath(sectionPath);\n if (href.length <= matchedLength) {\n continue;\n }\n // A root href is an ancestor of every account path, so a merchant listing the storefront's home\n // beside the sections would otherwise see it current on every page. It matches exactly or not at all.\n const exact = path === href;\n const ancestor = href !== '/' && path.startsWith(`${href}/`);\n if (!exact && !ancestor) {\n continue;\n }\n current = { index, match: exact ? 'exact' : 'ancestor' };\n matchedLength = href.length;\n }\n\n return current;\n}\n\n/**\n * Where the account's root opens: the first section that stays in the account. An external entry would\n * eject the shopper from the account they just opened, and so would an absolute one the merchant did not\n * flag — the same site-relative reading `findCurrent` applies. The page itself is skipped too, in every\n * spelling that matches it, since replacing it with itself would leave the loading look up for good.\n */\nfunction findIndexDestination(\n sections: readonly AccountMenuResolvedSection[],\n current: AccountMenuCurrent | null,\n bindingId: string,\n routeMap: RouteMap,\n): PageRef | string | null {\n const here = current?.match === 'exact' ? sections[current.index] : undefined;\n const herePath = here ? logicalPathOf(here, bindingId, routeMap) : null;\n const hereNormalized = herePath === null ? null : normalizePath(herePath);\n\n for (const section of sections) {\n const sectionPath = logicalPathOf(section, bindingId, routeMap);\n if (section.href === null || sectionPath === null || normalizePath(sectionPath) === hereNormalized) {\n continue;\n }\n return section.href;\n }\n\n return null;\n}\n\n/**\n * `page` for the section itself, `true` for a page inside it. The distinction is kept rather than\n * collapsed because the sibling breadcrumb names the deep page as the current one, and two surfaces\n * announcing \"current page\" for two different things is worse than the menu claiming only its set.\n */\nfunction ariaCurrentFor(match: AccountMenuCurrent['match']): 'page' | 'true' {\n return match === 'exact' ? 'page' : 'true';\n}\n\nfunction overflows(element: Element | null | undefined): boolean {\n if (!element) {\n return false;\n }\n return element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst AccountMenuContext = createContext<AccountMenuContextValue | null>(null);\n\n/** The resolved section list and the current section. */\nexport function useAccountMenu(): AccountMenuContextValue {\n const value = useContext(AccountMenuContext);\n if (!value) {\n throw new Error('AccountMenu parts must be used inside AccountMenuRoot.');\n }\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function AccountMenuRoot({ items, $content, className, children, ...props }: AccountMenuRootProps) {\n const { path } = useStorefrontRoute();\n const { bindingId } = useStorefrontContext();\n const { routeMap } = useRouteMap();\n // Presence decides, not truthiness: a channel supplying an empty list resolves to empty rather than\n // falling through, so the defaults never override a list the merchant published deliberately.\n // `minItems` guides the Admin form only, so that empty list still reaches this component.\n const sections = $content?.items ?? items ?? DEFAULT_SECTIONS;\n\n const value = useMemo<AccountMenuContextValue>(() => {\n const resolved = resolveSections(sections);\n return { items: resolved, current: findCurrent(resolved, path, bindingId, routeMap) };\n }, [sections, path, bindingId, routeMap]);\n\n return (\n <AccountMenuContext value={value}>\n <div {...props} className={className} data-fs-account-menu=\"\">\n {children}\n </div>\n </AccountMenuContext>\n );\n}\n\nexport function AccountMenuList({ $content, $locale, className, ...props }: AccountMenuListProps) {\n const { items, current } = useAccountMenu();\n const { format } = useMessageFormatter(AccountMenuListContent, $content);\n const currentRef = useRef<HTMLLIElement>(null);\n const currentIndex = current?.index ?? null;\n\n useIsomorphicLayoutEffect(() => {\n if (currentIndex === null) {\n return;\n }\n const item = currentRef.current;\n if (!item || typeof item.scrollIntoView !== 'function') {\n return;\n }\n // Only when the row actually scrolls. An unconditional call scrolls whatever ancestor can move,\n // which on a menu that fits is the page. The containers are the item's `ul` and its `nav`.\n const list = item.parentElement;\n if (!overflows(list) && !overflows(list?.parentElement)) {\n return;\n }\n // `nearest` on both axes is a no-op once the item is visible, so a route change inside the\n // current section does not jolt the row.\n item.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n }, [currentIndex]);\n\n if (items.length === 0) {\n return null;\n }\n\n return (\n <nav {...props} aria-label={format('label')} className={className} data-fs-account-menu-list=\"\">\n <ul data-fs-account-menu-items=\"\">\n {items.map((item, index) => {\n const isCurrent = index === currentIndex;\n return (\n <li\n key={index}\n ref={isCurrent ? currentRef : null}\n data-fs-account-menu-item=\"\"\n data-fs-account-menu-item-current={isCurrent ? '' : undefined}\n >\n {item.href === null ? (\n <span data-fs-text=\"\" data-fs-account-menu-text=\"\">\n {item.label}\n </span>\n ) : (\n <NavigationLink\n href={item.href}\n aria-current={current && isCurrent ? ariaCurrentFor(current.match) : undefined}\n data-fs-account-menu-link=\"\"\n >\n {item.label}\n </NavigationLink>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n}\n\nexport function AccountMenuIndexRedirect({\n loadingLabel,\n $content,\n $locale,\n className,\n}: Readonly<AccountMenuIndexRedirectProps>) {\n const { items, current } = useAccountMenu();\n const { bindingId } = useStorefrontContext();\n const { routeMap } = useRouteMap();\n const { replace } = useStorefrontNavigation();\n // StrictMode runs an effect twice, and a router whose identity changes per render re-runs it on every\n // pass; one replace is the whole of this part's job.\n const replacedRef = useRef(false);\n\n const destination = findIndexDestination(items, current, bindingId, routeMap);\n\n useEffect(() => {\n if (destination === null || replacedRef.current) {\n return;\n }\n replacedRef.current = true;\n // Replace rather than push, so back from the section leaves the account instead of bouncing through\n // its root.\n // react-doctor-disable-next-line nextjs-no-client-side-redirect -- the order is the merchant's, published at runtime, so no static redirect can express it\n replace(destination);\n }, [destination, replace]);\n\n const { format } = useMessageFormatter(AccountMenuIndexRedirectContent, $content);\n // A blank entry field falls through, so clearing one in the Admin reads as unauthored.\n const entryLoadingLabel = $content?.loadingLabel?.trim() ? $content.loadingLabel : loadingLabel;\n\n if (destination === null) {\n return (\n <p className={className} data-fs-account-menu-index-redirect=\"\" data-fs-account-menu-index-redirect-empty=\"\">\n {format('emptyMessage')}\n </p>\n );\n }\n\n // The gate's own part rather than one of this part's: in the account layout the gate's wait for the\n // session comes first, and carrying the same look on until the section lands is what keeps a second\n // one from flashing between the two.\n return (\n <AccountAccessGateLoading className={className} data-fs-account-menu-index-redirect=\"\">\n {entryLoadingLabel}\n </AccountAccessGateLoading>\n );\n}\n\n/** An absent handler or a rejection is a sign-out that did not happen, never one that did. */\nasync function logOut(logout: SessionActions['logout'] | undefined): Promise<boolean> {\n if (!logout) {\n return false;\n }\n try {\n const errors = await logout();\n return errors.length === 0;\n } catch (error) {\n console.error('[AccountMenuSignOut] logout rejected', error);\n return false;\n }\n}\n\nexport function AccountMenuSignOut({\n $content,\n $locale,\n $actions: $actionsProp,\n className,\n}: Readonly<AccountMenuSignOutProps>) {\n const $actions = useActionsOverride($actionsProp);\n const { format } = useMessageFormatter(AccountMenuSignOutContent, $content);\n const { hrefFor } = useStorefrontNavigation();\n const { basePath } = useStorefrontContext();\n // Any standing intent, whichever control declared it, is a sign-out under way.\n const signingOut = useSignOutIntent();\n const failed = useSignOutFailure();\n // Two activations in the same task see the same render, so the disabled button alone cannot stop\n // the second one.\n const attemptingRef = useRef(false);\n\n async function handleClick() {\n if (attemptingRef.current) {\n return;\n }\n attemptingRef.current = true;\n clearSignOutFailure();\n // Before the await: the logout payload flips the session in place, and a gate that got its turn\n // between the response and the navigation would send the shopper to sign in for the account they\n // just left. From here on this control is unmounted under the gate; the handler still settles.\n declareSignOutIntent();\n\n if (await logOut($actions?.session?.logout)) {\n // A document load rather than the router, whose cache would keep the account behind the back\n // control. What the browser's back-forward cache restores is the gate's to revalidate.\n globalThis.location.assign(hrefFor(HOME_PAGE) ?? basePath);\n return;\n }\n\n attemptingRef.current = false;\n reportSignOutFailure();\n withdrawSignOutIntent();\n }\n\n return (\n <div\n className={className}\n data-fs-account-menu-sign-out=\"\"\n data-fs-account-menu-sign-out-pending={signingOut ? '' : undefined}\n >\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={signingOut}\n aria-busy={signingOut || undefined}\n data-fs-account-menu-sign-out-button=\"\"\n >\n {format('label')}\n </button>\n {failed ? (\n <p role=\"alert\" data-fs-account-menu-sign-out-error=\"\">\n {format('errorMessage')}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const AccountMenu = {\n Root: AccountMenuRoot,\n List: AccountMenuList,\n IndexRedirect: AccountMenuIndexRedirect,\n SignOut: AccountMenuSignOut,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCA,MAAM,4BAA4B,OAAO,WAAW,cAAc,YAAY;AAM9E,MAAa,qBAAqB,kBAAkB;CAClD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EAItB,YAAY,EACV,OAAO;GACL,MAAM;GACN,OAAO;GACP,UAAU;GACV,OAAO;IACL,MAAM;IACN,sBAAsB;IACtB,UAAU,CAAC,SAAS,MAAM;IAC1B,YAAY;KACV,OAAO;MAAE,MAAM;MAAU,WAAW;MAAG,OAAO;KAAQ;KACtD,MAAM;MACJ,MAAM;MACN,WAAW;MACX,OAAO;MACP,QAAQ;MAER,SAAS;KACX;KACA,UAAU;MAAE,MAAM;MAAW,OAAO;KAAqB;IAC3D;GACF;EACF,EACF;CACF;AACF,CAAC;AAED,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAoB,QAAQ;GAAe,eAAe;EAAU,EACtG;CACF;AACF,CAAC;AAID,MAAa,kCAAkC,kBAAkB;CAC/D,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,cAAc;IAAE,MAAM;IAAU,WAAW;IAAG,OAAO;GAAuB;GAC5E,cAAc;IACZ,MAAM;IACN,WAAW;IACX,OAAO;IACP,QAAQ;IACR,eAAe;GACjB;EACF;CACF;AACF,CAAC;AAED,MAAa,4BAA4B,kBAAkB;CACzD,IAAI;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wC,KAAK;EAC3D,OAAO;CACT;AACF;AAEA,SAAgB,mBAAmB,EACjC,UACA,SACA,UAAU,cACV,aACoC;CACpC,MAAM,WAAW,mBAAmB,YAAY;CAChD,MAAM,EAAE,WAAW,oBAAoB,2BAA2B,QAAQ;CAC1E,MAAM,EAAE,YAAY,wBAAwB;CAC5C,MAAM,EAAE,aAAa,qBAAqB;CAE1C,MAAM,aAAa,iBAAiB;CACpC,MAAM,SAAS,kBAAkB;CAGjC,MAAM,gBAAgB,OAAO,KAAK;CAElC,eAAe,cAAc;EAC3B,IAAI,cAAc,SAChB;EAEF,cAAc,UAAU;EACxB,oBAAoB;EAIpB,qBAAqB;EAErB,IAAI,MAAM,OAAO,UAAU,SAAS,MAAM,GAAG;GAG3C,WAAW,SAAS,OAAO,QAAQ,SAAS,KAAK,QAAQ;GACzD;EACF;EAEA,cAAc,UAAU;EACxB,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,OACE,qBAAC,OAAD;EACa;EACX,iCAA8B;EAC9B,yCAAuC,aAAa,KAAK,KAAA;EAH3D,UAAA,CAKE,oBAAC,UAAD;GACE,MAAK;GACL,SAAS;GACT,UAAU;GACV,aAAW,cAAc,KAAA;GACzB,wCAAqC;GAEpC,UAAA,OAAO,OAAO;EACT,CAAA,GACP,SACC,oBAAC,KAAD;GAAG,MAAK;GAAQ,uCAAoC;GACjD,UAAA,OAAO,cAAc;EACrB,CAAA,IACD,IACD;;AAET;AAMA,MAAa,cAAc;CACzB,MAAM;CACN,MAAM;CACN,eAAe;CACf,SAAS;AACX"}
|
|
@@ -3,9 +3,9 @@ import { defineComponent } from "../../core/dist/define-component.js";
|
|
|
3
3
|
import "../../core/dist/index.js";
|
|
4
4
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
5
5
|
import { useSession } from "../session/session.js";
|
|
6
|
-
import { Avatar } from "../../particles/avatar/avatar.js";
|
|
7
6
|
import { useEntityDataResolved } from "../../sdk/data/entity-resolution-context.js";
|
|
8
7
|
import { useReactiveDataSettled } from "../../sdk/data/use-reactive-data-settled.js";
|
|
8
|
+
import { Avatar } from "../../particles/avatar/avatar.js";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
const AccountMenuIdentityDefinition = defineComponent({
|
|
11
11
|
name: "AccountMenuIdentity",
|