@vtex/faststore 0.0.10 → 0.0.12
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 +55 -0
- package/README.md +0 -1
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- 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/domain-logic/dist/checkout/rules.js +33 -0
- package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
- 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 +21 -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 -4
- 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,8 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
3
4
|
import "../../core/dist/index.js";
|
|
5
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
4
6
|
import { Field } from "../../particles/field/field.js";
|
|
5
7
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
8
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
6
9
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
7
10
|
import { useSession } from "../session/session.js";
|
|
8
11
|
import { loggableErrorName } from "../../utils/loggable-error-name.js";
|
|
@@ -42,6 +45,264 @@ const fragment = `
|
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
`;
|
|
48
|
+
const MyAccountProfileRootContent = defineContentType({
|
|
49
|
+
id: "my-account-profile-root",
|
|
50
|
+
title: "My Account Profile Root",
|
|
51
|
+
description: "The toasts the profile Save raises.",
|
|
52
|
+
schema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
additionalProperties: false,
|
|
55
|
+
properties: {
|
|
56
|
+
saveFailedMessage: {
|
|
57
|
+
type: "string",
|
|
58
|
+
title: "Save failure message",
|
|
59
|
+
description: "Shown for a network failure, and when the save cannot be dispatched at all.",
|
|
60
|
+
format: "icu-message",
|
|
61
|
+
messageSource: "Unable to save your profile. Please try again."
|
|
62
|
+
},
|
|
63
|
+
invalidValueMessage: {
|
|
64
|
+
type: "string",
|
|
65
|
+
title: "Refused value message",
|
|
66
|
+
description: "Shown when the account refuses one or more of the submitted values.",
|
|
67
|
+
format: "icu-message",
|
|
68
|
+
messageSource: "Some of your details were not accepted. Check them and try again."
|
|
69
|
+
},
|
|
70
|
+
sessionExpiredMessage: {
|
|
71
|
+
type: "string",
|
|
72
|
+
title: "Session expired message",
|
|
73
|
+
description: "Shown when the session ended before the save, so the shopper must sign in again.",
|
|
74
|
+
format: "icu-message",
|
|
75
|
+
messageSource: "Your session has expired. Please sign in again."
|
|
76
|
+
},
|
|
77
|
+
savedMessage: {
|
|
78
|
+
type: "string",
|
|
79
|
+
title: "Save success message",
|
|
80
|
+
format: "icu-message",
|
|
81
|
+
messageSource: "Your profile has been saved."
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* `CustomerProfileErrorCode` of API Core's schema plus the two codes the sdk mints: the transport failure
|
|
88
|
+
* and the expired session, which the write answers with a top-level `UNAUTHORIZED`.
|
|
89
|
+
*/
|
|
90
|
+
const MY_ACCOUNT_PROFILE_ERROR_FIELDS = {
|
|
91
|
+
INVALID_VALUE: "invalidValueMessage",
|
|
92
|
+
UNAUTHORIZED: "sessionExpiredMessage",
|
|
93
|
+
NETWORK_ERROR: "saveFailedMessage"
|
|
94
|
+
};
|
|
95
|
+
const MyAccountProfileEditButtonContent = defineContentType({
|
|
96
|
+
id: "my-account-profile-edit",
|
|
97
|
+
title: "My Account Profile Edit Button",
|
|
98
|
+
description: "The edit button's label.",
|
|
99
|
+
schema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
properties: { label: {
|
|
103
|
+
type: "string",
|
|
104
|
+
title: "Button label",
|
|
105
|
+
format: "icu-message",
|
|
106
|
+
messageSource: "Edit"
|
|
107
|
+
} }
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
const MyAccountProfileSaveButtonContent = defineContentType({
|
|
111
|
+
id: "my-account-profile-save",
|
|
112
|
+
title: "My Account Profile Save Button",
|
|
113
|
+
description: "The save button's label.",
|
|
114
|
+
schema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
additionalProperties: false,
|
|
117
|
+
properties: { label: {
|
|
118
|
+
type: "string",
|
|
119
|
+
title: "Button label",
|
|
120
|
+
format: "icu-message",
|
|
121
|
+
messageSource: "Save"
|
|
122
|
+
} }
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const MyAccountProfileCancelButtonContent = defineContentType({
|
|
126
|
+
id: "my-account-profile-cancel",
|
|
127
|
+
title: "My Account Profile Cancel Button",
|
|
128
|
+
description: "The cancel button's label.",
|
|
129
|
+
schema: {
|
|
130
|
+
type: "object",
|
|
131
|
+
additionalProperties: false,
|
|
132
|
+
properties: { label: {
|
|
133
|
+
type: "string",
|
|
134
|
+
title: "Button label",
|
|
135
|
+
format: "icu-message",
|
|
136
|
+
messageSource: "Cancel"
|
|
137
|
+
} }
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const MyAccountProfileFirstNameControlContent = defineContentType({
|
|
141
|
+
id: "my-account-profile-first-name",
|
|
142
|
+
title: "My Account Profile First Name Control",
|
|
143
|
+
description: "The first-name field's label and required message.",
|
|
144
|
+
schema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
additionalProperties: false,
|
|
147
|
+
properties: {
|
|
148
|
+
label: {
|
|
149
|
+
type: "string",
|
|
150
|
+
title: "Label",
|
|
151
|
+
format: "icu-message",
|
|
152
|
+
messageSource: "First name"
|
|
153
|
+
},
|
|
154
|
+
requiredMessage: {
|
|
155
|
+
type: "string",
|
|
156
|
+
title: "Required message",
|
|
157
|
+
format: "icu-message",
|
|
158
|
+
messageSource: "First name is required."
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
const MyAccountProfileLastNameControlContent = defineContentType({
|
|
164
|
+
id: "my-account-profile-last-name",
|
|
165
|
+
title: "My Account Profile Last Name Control",
|
|
166
|
+
description: "The last-name field's label and required message.",
|
|
167
|
+
schema: {
|
|
168
|
+
type: "object",
|
|
169
|
+
additionalProperties: false,
|
|
170
|
+
properties: {
|
|
171
|
+
label: {
|
|
172
|
+
type: "string",
|
|
173
|
+
title: "Label",
|
|
174
|
+
format: "icu-message",
|
|
175
|
+
messageSource: "Last name"
|
|
176
|
+
},
|
|
177
|
+
requiredMessage: {
|
|
178
|
+
type: "string",
|
|
179
|
+
title: "Required message",
|
|
180
|
+
format: "icu-message",
|
|
181
|
+
messageSource: "Last name is required."
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
const MyAccountProfilePhoneControlContent = defineContentType({
|
|
187
|
+
id: "my-account-profile-phone",
|
|
188
|
+
title: "My Account Profile Phone Control",
|
|
189
|
+
description: "The phone field's label and invalid message.",
|
|
190
|
+
schema: {
|
|
191
|
+
type: "object",
|
|
192
|
+
additionalProperties: false,
|
|
193
|
+
properties: {
|
|
194
|
+
label: {
|
|
195
|
+
type: "string",
|
|
196
|
+
title: "Label",
|
|
197
|
+
format: "icu-message",
|
|
198
|
+
messageSource: "Phone"
|
|
199
|
+
},
|
|
200
|
+
invalidMessage: {
|
|
201
|
+
type: "string",
|
|
202
|
+
title: "Invalid message",
|
|
203
|
+
format: "icu-message",
|
|
204
|
+
messageSource: "Invalid phone number"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
const MyAccountProfileTaxIdControlContent = defineContentType({
|
|
210
|
+
id: "my-account-profile-tax-id",
|
|
211
|
+
title: "My Account Profile Tax ID Control",
|
|
212
|
+
description: "The tax-ID field's label, invalid message and the reason a saved document is locked.",
|
|
213
|
+
schema: {
|
|
214
|
+
type: "object",
|
|
215
|
+
additionalProperties: false,
|
|
216
|
+
properties: {
|
|
217
|
+
label: {
|
|
218
|
+
type: "string",
|
|
219
|
+
title: "Label",
|
|
220
|
+
format: "icu-message",
|
|
221
|
+
messageSource: "National tax ID"
|
|
222
|
+
},
|
|
223
|
+
invalidMessage: {
|
|
224
|
+
type: "string",
|
|
225
|
+
title: "Invalid message",
|
|
226
|
+
format: "icu-message",
|
|
227
|
+
messageSource: "Invalid document number."
|
|
228
|
+
},
|
|
229
|
+
lockedReason: {
|
|
230
|
+
type: "string",
|
|
231
|
+
title: "Locked reason",
|
|
232
|
+
format: "icu-message",
|
|
233
|
+
messageSource: "Your document ID can't be edited."
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
const MyAccountProfileBirthDateControlContent = defineContentType({
|
|
239
|
+
id: "my-account-profile-birth-date",
|
|
240
|
+
title: "My Account Profile Birth Date Control",
|
|
241
|
+
description: "The birth-date field's label.",
|
|
242
|
+
schema: {
|
|
243
|
+
type: "object",
|
|
244
|
+
additionalProperties: false,
|
|
245
|
+
properties: { label: {
|
|
246
|
+
type: "string",
|
|
247
|
+
title: "Label",
|
|
248
|
+
format: "icu-message",
|
|
249
|
+
messageSource: "Birth date"
|
|
250
|
+
} }
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
const MyAccountProfileGenderControlContent = defineContentType({
|
|
254
|
+
id: "my-account-profile-gender",
|
|
255
|
+
title: "My Account Profile Gender Control",
|
|
256
|
+
description: "The gender field's label, placeholder, clear button label and the default options' labels.",
|
|
257
|
+
schema: {
|
|
258
|
+
type: "object",
|
|
259
|
+
additionalProperties: false,
|
|
260
|
+
properties: {
|
|
261
|
+
label: {
|
|
262
|
+
type: "string",
|
|
263
|
+
title: "Label",
|
|
264
|
+
format: "icu-message",
|
|
265
|
+
messageSource: "Gender"
|
|
266
|
+
},
|
|
267
|
+
placeholder: {
|
|
268
|
+
type: "string",
|
|
269
|
+
title: "Placeholder",
|
|
270
|
+
format: "icu-message",
|
|
271
|
+
messageSource: "Select"
|
|
272
|
+
},
|
|
273
|
+
clearLabel: {
|
|
274
|
+
type: "string",
|
|
275
|
+
title: "Clear button label",
|
|
276
|
+
format: "icu-message",
|
|
277
|
+
messageSource: "Clear"
|
|
278
|
+
},
|
|
279
|
+
femaleLabel: {
|
|
280
|
+
type: "string",
|
|
281
|
+
title: "Female option label",
|
|
282
|
+
format: "icu-message",
|
|
283
|
+
messageSource: "Female"
|
|
284
|
+
},
|
|
285
|
+
maleLabel: {
|
|
286
|
+
type: "string",
|
|
287
|
+
title: "Male option label",
|
|
288
|
+
format: "icu-message",
|
|
289
|
+
messageSource: "Male"
|
|
290
|
+
},
|
|
291
|
+
otherLabel: {
|
|
292
|
+
type: "string",
|
|
293
|
+
title: "Other option label",
|
|
294
|
+
format: "icu-message",
|
|
295
|
+
messageSource: "Other"
|
|
296
|
+
},
|
|
297
|
+
preferNotToSayLabel: {
|
|
298
|
+
type: "string",
|
|
299
|
+
title: "Prefer-not-to-say option label",
|
|
300
|
+
format: "icu-message",
|
|
301
|
+
messageSource: "Prefer not to say"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
});
|
|
45
306
|
const FIELD_KEYS = [
|
|
46
307
|
"firstName",
|
|
47
308
|
"lastName",
|
|
@@ -51,8 +312,6 @@ const FIELD_KEYS = [
|
|
|
51
312
|
"birthDate",
|
|
52
313
|
"gender"
|
|
53
314
|
];
|
|
54
|
-
const DEFAULT_SAVE_FAILED_MESSAGE = "Unable to save your profile. Please try again.";
|
|
55
|
-
const DEFAULT_SAVED_MESSAGE = "Your profile has been saved.";
|
|
56
315
|
function buildSavedValues($data) {
|
|
57
316
|
return {
|
|
58
317
|
firstName: $data?.firstName ?? "",
|
|
@@ -77,22 +336,23 @@ function toNativeDate(stored) {
|
|
|
77
336
|
function toStoredDate(native) {
|
|
78
337
|
return native;
|
|
79
338
|
}
|
|
339
|
+
/** The default option set, each value labelled by a message field; used only when no `options` are authored. */
|
|
80
340
|
const DEFAULT_GENDER_OPTIONS = [
|
|
81
341
|
{
|
|
82
342
|
value: "female",
|
|
83
|
-
|
|
343
|
+
field: "femaleLabel"
|
|
84
344
|
},
|
|
85
345
|
{
|
|
86
346
|
value: "male",
|
|
87
|
-
|
|
347
|
+
field: "maleLabel"
|
|
88
348
|
},
|
|
89
349
|
{
|
|
90
350
|
value: "other",
|
|
91
|
-
|
|
351
|
+
field: "otherLabel"
|
|
92
352
|
},
|
|
93
353
|
{
|
|
94
354
|
value: "prefer_not_to_say",
|
|
95
|
-
|
|
355
|
+
field: "preferNotToSayLabel"
|
|
96
356
|
}
|
|
97
357
|
];
|
|
98
358
|
const MY_ACCOUNT_PROFILE_UNSET = Symbol("MyAccountProfileContextUnset");
|
|
@@ -107,6 +367,7 @@ const MyAccountProfileRootDefinition = defineComponent({
|
|
|
107
367
|
name: "MyAccountProfileRoot",
|
|
108
368
|
importPath: "@vtex/faststore/components",
|
|
109
369
|
component: MyAccountProfileRoot,
|
|
370
|
+
content: MyAccountProfileRootContent,
|
|
110
371
|
fragment,
|
|
111
372
|
fetchStrategy: "reactive",
|
|
112
373
|
requiresContext: "session",
|
|
@@ -117,25 +378,14 @@ const MyAccountProfileRootDefinition = defineComponent({
|
|
|
117
378
|
label: "My Account Profile Root",
|
|
118
379
|
category: "identity"
|
|
119
380
|
},
|
|
120
|
-
schema: {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
saveFailedMessage: {
|
|
126
|
-
type: "string",
|
|
127
|
-
default: "Unable to save your profile. Please try again.",
|
|
128
|
-
label: "Save failure message"
|
|
129
|
-
},
|
|
130
|
-
savedMessage: {
|
|
131
|
-
type: "string",
|
|
132
|
-
default: "Your profile has been saved.",
|
|
133
|
-
label: "Save success message"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
guideline: "Data root + form mechanics for the persistent My Account profile: owns the saved profile, the draft, the view/edit toggle, and the single batched Save (dispatches only dirty, registered fields; an empty string erases, an omitted field is untouched). Self-gates on the authenticated (loggedIn) session; requires a SessionRoot ancestor and a mounted ToastProvider ancestor — Save success/failure surface as a toast, not an inline part. Field Controls register their key plus an optional validator and normalizer through useMyAccountProfile() — the field set is a merchant composition decision, never enumerated here. Compose EditButton (view state), SaveButton/CancelButton (edit state), and Email as children in any order. See my-account-profile.md."
|
|
381
|
+
schema: { documentType: {
|
|
382
|
+
type: "string",
|
|
383
|
+
label: "Default document type (e.g. CPF)"
|
|
384
|
+
} },
|
|
385
|
+
guideline: "Data root + form mechanics for the persistent My Account profile: owns the saved profile, the draft, the view/edit toggle, and the single batched Save (dispatches only dirty, registered fields; an empty string erases, an omitted field is untouched). Self-gates on the authenticated (loggedIn) session; requires a SessionRoot ancestor and a mounted ToastProvider ancestor — Save success/failure surface as a toast (the $content fields savedMessage, saveFailedMessage, invalidValueMessage and sessionExpiredMessage, by refusal code), not an inline part. Field Controls register their key plus an optional validator and normalizer through useMyAccountProfile() — the field set is a merchant composition decision, never enumerated here. Compose EditButton (view state), SaveButton/CancelButton (edit state), and Email as children in any order. See my-account-profile.md."
|
|
137
386
|
});
|
|
138
|
-
function MyAccountProfileRoot({ $data: $dataProp, $actions: $actionsProp, documentType: documentTypeProp,
|
|
387
|
+
function MyAccountProfileRoot({ $data: $dataProp, $actions: $actionsProp, documentType: documentTypeProp, $content, $locale, className, children }) {
|
|
388
|
+
const { format } = useMessageFormatter(MyAccountProfileRootContent, $content);
|
|
139
389
|
const { state } = useSession();
|
|
140
390
|
const toast = useToast();
|
|
141
391
|
const $data = useDataOverride($dataProp);
|
|
@@ -221,7 +471,7 @@ function MyAccountProfileRoot({ $data: $dataProp, $actions: $actionsProp, docume
|
|
|
221
471
|
setFieldErrors({});
|
|
222
472
|
setMode("view");
|
|
223
473
|
toast.add({
|
|
224
|
-
title: savedMessage,
|
|
474
|
+
title: format("savedMessage"),
|
|
225
475
|
type: "success"
|
|
226
476
|
});
|
|
227
477
|
return;
|
|
@@ -240,7 +490,7 @@ function MyAccountProfileRoot({ $data: $dataProp, $actions: $actionsProp, docume
|
|
|
240
490
|
const identity = $actions?.identity;
|
|
241
491
|
if (!identity?.customerProfileUpdate) {
|
|
242
492
|
toast.add({
|
|
243
|
-
title: saveFailedMessage,
|
|
493
|
+
title: format("saveFailedMessage"),
|
|
244
494
|
type: "error"
|
|
245
495
|
});
|
|
246
496
|
return;
|
|
@@ -253,23 +503,24 @@ function MyAccountProfileRoot({ $data: $dataProp, $actions: $actionsProp, docume
|
|
|
253
503
|
}
|
|
254
504
|
setPending(true);
|
|
255
505
|
try {
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
506
|
+
const [firstError] = await identity.customerProfileUpdate(payload);
|
|
507
|
+
if (firstError) {
|
|
508
|
+
const title = formatErrorCode(MyAccountProfileRootContent, MY_ACCOUNT_PROFILE_ERROR_FIELDS, firstError, format, "saveFailedMessage");
|
|
258
509
|
toast.add({
|
|
259
|
-
title
|
|
510
|
+
title,
|
|
260
511
|
type: "error"
|
|
261
512
|
});
|
|
262
513
|
return;
|
|
263
514
|
}
|
|
264
515
|
setMode("view");
|
|
265
516
|
toast.add({
|
|
266
|
-
title: savedMessage,
|
|
517
|
+
title: format("savedMessage"),
|
|
267
518
|
type: "success"
|
|
268
519
|
});
|
|
269
520
|
} catch (error) {
|
|
270
521
|
console.error("[MyAccountProfileRoot] customerProfileUpdate failed", loggableErrorName(error));
|
|
271
522
|
toast.add({
|
|
272
|
-
title: saveFailedMessage,
|
|
523
|
+
title: format("saveFailedMessage"),
|
|
273
524
|
type: "error"
|
|
274
525
|
});
|
|
275
526
|
} finally {
|
|
@@ -320,74 +571,68 @@ const MyAccountProfileEditButtonDefinition = defineComponent({
|
|
|
320
571
|
name: "MyAccountProfileEditButton",
|
|
321
572
|
importPath: "@vtex/faststore/components",
|
|
322
573
|
component: MyAccountProfileEditButton,
|
|
574
|
+
content: MyAccountProfileEditButtonContent,
|
|
323
575
|
requiresContext: "my-account-profile",
|
|
324
576
|
editor: {
|
|
325
577
|
label: "My Account Profile Edit Button",
|
|
326
578
|
category: "identity"
|
|
327
579
|
},
|
|
328
|
-
schema: {
|
|
329
|
-
|
|
330
|
-
default: "Edit",
|
|
331
|
-
label: "Button label"
|
|
332
|
-
} },
|
|
333
|
-
guideline: "Switches MyAccountProfileRoot from the view state to the edit state. Renders only in the view state. Must be a descendant of MyAccountProfileRoot."
|
|
580
|
+
schema: {},
|
|
581
|
+
guideline: "Its label is the $content field label unless children are composed. Switches MyAccountProfileRoot from the view state to the edit state. Renders only in the view state. Must be a descendant of MyAccountProfileRoot."
|
|
334
582
|
});
|
|
335
|
-
function MyAccountProfileEditButton({
|
|
583
|
+
function MyAccountProfileEditButton({ $content, $locale, className, children }) {
|
|
336
584
|
const { mode, edit } = useMyAccountProfile();
|
|
585
|
+
const { format } = useMessageFormatter(MyAccountProfileEditButtonContent, $content);
|
|
337
586
|
if (mode !== "view") return null;
|
|
338
587
|
return /* @__PURE__ */ jsx("button", {
|
|
339
588
|
type: "button",
|
|
340
589
|
onClick: edit,
|
|
341
590
|
className,
|
|
342
591
|
"data-fs-my-account-profile-edit": "",
|
|
343
|
-
children: children ?? label
|
|
592
|
+
children: children ?? format("label")
|
|
344
593
|
});
|
|
345
594
|
}
|
|
346
595
|
const MyAccountProfileSaveButtonDefinition = defineComponent({
|
|
347
596
|
name: "MyAccountProfileSaveButton",
|
|
348
597
|
importPath: "@vtex/faststore/components",
|
|
349
598
|
component: MyAccountProfileSaveButton,
|
|
599
|
+
content: MyAccountProfileSaveButtonContent,
|
|
350
600
|
requiresContext: "my-account-profile",
|
|
351
601
|
editor: {
|
|
352
602
|
label: "My Account Profile Save Button",
|
|
353
603
|
category: "identity"
|
|
354
604
|
},
|
|
355
|
-
schema: {
|
|
356
|
-
|
|
357
|
-
default: "Save",
|
|
358
|
-
label: "Button label"
|
|
359
|
-
} },
|
|
360
|
-
guideline: "Submits MyAccountProfileRoot's batched Save. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot."
|
|
605
|
+
schema: {},
|
|
606
|
+
guideline: "Its label is the $content field label unless children are composed. Submits MyAccountProfileRoot's batched Save. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot."
|
|
361
607
|
});
|
|
362
|
-
function MyAccountProfileSaveButton({
|
|
608
|
+
function MyAccountProfileSaveButton({ $content, $locale, className, children }) {
|
|
363
609
|
const { mode, pending } = useMyAccountProfile();
|
|
610
|
+
const { format } = useMessageFormatter(MyAccountProfileSaveButtonContent, $content);
|
|
364
611
|
if (mode !== "edit") return null;
|
|
365
612
|
return /* @__PURE__ */ jsx("button", {
|
|
366
613
|
type: "submit",
|
|
367
614
|
disabled: pending,
|
|
368
615
|
className,
|
|
369
616
|
"data-fs-my-account-profile-save": "",
|
|
370
|
-
children: children ?? label
|
|
617
|
+
children: children ?? format("label")
|
|
371
618
|
});
|
|
372
619
|
}
|
|
373
620
|
const MyAccountProfileCancelButtonDefinition = defineComponent({
|
|
374
621
|
name: "MyAccountProfileCancelButton",
|
|
375
622
|
importPath: "@vtex/faststore/components",
|
|
376
623
|
component: MyAccountProfileCancelButton,
|
|
624
|
+
content: MyAccountProfileCancelButtonContent,
|
|
377
625
|
requiresContext: "my-account-profile",
|
|
378
626
|
editor: {
|
|
379
627
|
label: "My Account Profile Cancel Button",
|
|
380
628
|
category: "identity"
|
|
381
629
|
},
|
|
382
|
-
schema: {
|
|
383
|
-
|
|
384
|
-
default: "Cancel",
|
|
385
|
-
label: "Button label"
|
|
386
|
-
} },
|
|
387
|
-
guideline: "Reverts every field to its last saved value and returns MyAccountProfileRoot to the view state, without persisting. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot."
|
|
630
|
+
schema: {},
|
|
631
|
+
guideline: "Its label is the $content field label unless children are composed. Reverts every field to its last saved value and returns MyAccountProfileRoot to the view state, without persisting. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot."
|
|
388
632
|
});
|
|
389
|
-
function MyAccountProfileCancelButton({
|
|
633
|
+
function MyAccountProfileCancelButton({ $content, $locale, className, children }) {
|
|
390
634
|
const { mode, pending, cancel } = useMyAccountProfile();
|
|
635
|
+
const { format } = useMessageFormatter(MyAccountProfileCancelButtonContent, $content);
|
|
391
636
|
if (mode !== "edit") return null;
|
|
392
637
|
return /* @__PURE__ */ jsx("button", {
|
|
393
638
|
type: "button",
|
|
@@ -395,7 +640,7 @@ function MyAccountProfileCancelButton({ label = "Cancel", className, children })
|
|
|
395
640
|
onClick: cancel,
|
|
396
641
|
className,
|
|
397
642
|
"data-fs-my-account-profile-cancel": "",
|
|
398
|
-
children: children ?? label
|
|
643
|
+
children: children ?? format("label")
|
|
399
644
|
});
|
|
400
645
|
}
|
|
401
646
|
const MyAccountProfileEmailDefinition = defineComponent({
|
|
@@ -448,33 +693,24 @@ const MyAccountProfileFirstNameControlDefinition = defineComponent({
|
|
|
448
693
|
name: "MyAccountProfileFirstNameControl",
|
|
449
694
|
importPath: "@vtex/faststore/components",
|
|
450
695
|
component: MyAccountProfileFirstNameControl,
|
|
696
|
+
content: MyAccountProfileFirstNameControlContent,
|
|
451
697
|
requiresContext: "my-account-profile",
|
|
452
698
|
editor: {
|
|
453
699
|
label: "My Account Profile First Name Control",
|
|
454
700
|
category: "identity"
|
|
455
701
|
},
|
|
456
|
-
schema: {
|
|
457
|
-
|
|
458
|
-
type: "string",
|
|
459
|
-
default: "First name",
|
|
460
|
-
label: "Label"
|
|
461
|
-
},
|
|
462
|
-
requiredMessage: {
|
|
463
|
-
type: "string",
|
|
464
|
-
default: "First name is required.",
|
|
465
|
-
label: "Required message"
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
guideline: "Draft-bound, required first-name field. Blocks Save with an inline message and focus when left empty. Must be a descendant of MyAccountProfileRoot."
|
|
702
|
+
schema: {},
|
|
703
|
+
guideline: "Draft-bound, required first-name field, labelled by the $content field label. Blocks Save with the inline $content field requiredMessage and focus when left empty. Must be a descendant of MyAccountProfileRoot."
|
|
469
704
|
});
|
|
470
|
-
function MyAccountProfileFirstNameControl({
|
|
705
|
+
function MyAccountProfileFirstNameControl({ $content, $locale, className }) {
|
|
471
706
|
const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();
|
|
707
|
+
const { format } = useMessageFormatter(MyAccountProfileFirstNameControlContent, $content);
|
|
472
708
|
useEffect(() => {
|
|
473
709
|
return registerField({
|
|
474
710
|
key: "firstName",
|
|
475
|
-
validate: (value) => value.trim() ? null : requiredMessage
|
|
711
|
+
validate: (value) => value.trim() ? null : format("requiredMessage")
|
|
476
712
|
});
|
|
477
|
-
}, [
|
|
713
|
+
}, [format, registerField]);
|
|
478
714
|
const error = fieldErrors.firstName;
|
|
479
715
|
if (mode === "view") return /* @__PURE__ */ jsx("p", {
|
|
480
716
|
className,
|
|
@@ -489,7 +725,7 @@ function MyAccountProfileFirstNameControl({ label = "First name", requiredMessag
|
|
|
489
725
|
"data-fs-my-account-profile-first-name": "",
|
|
490
726
|
"data-fs-my-account-profile-field": "firstName",
|
|
491
727
|
children: [
|
|
492
|
-
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
728
|
+
/* @__PURE__ */ jsx(Field.Label, { children: format("label") }),
|
|
493
729
|
/* @__PURE__ */ jsx(Field.Control, {
|
|
494
730
|
value: draft.firstName,
|
|
495
731
|
onChange: (event) => setField("firstName", event.target.value),
|
|
@@ -506,33 +742,24 @@ const MyAccountProfileLastNameControlDefinition = defineComponent({
|
|
|
506
742
|
name: "MyAccountProfileLastNameControl",
|
|
507
743
|
importPath: "@vtex/faststore/components",
|
|
508
744
|
component: MyAccountProfileLastNameControl,
|
|
745
|
+
content: MyAccountProfileLastNameControlContent,
|
|
509
746
|
requiresContext: "my-account-profile",
|
|
510
747
|
editor: {
|
|
511
748
|
label: "My Account Profile Last Name Control",
|
|
512
749
|
category: "identity"
|
|
513
750
|
},
|
|
514
|
-
schema: {
|
|
515
|
-
|
|
516
|
-
type: "string",
|
|
517
|
-
default: "Last name",
|
|
518
|
-
label: "Label"
|
|
519
|
-
},
|
|
520
|
-
requiredMessage: {
|
|
521
|
-
type: "string",
|
|
522
|
-
default: "Last name is required.",
|
|
523
|
-
label: "Required message"
|
|
524
|
-
}
|
|
525
|
-
},
|
|
526
|
-
guideline: "Draft-bound, required last-name field. Blocks Save with an inline message and focus when left empty. Must be a descendant of MyAccountProfileRoot."
|
|
751
|
+
schema: {},
|
|
752
|
+
guideline: "Draft-bound, required last-name field, labelled by the $content field label. Blocks Save with the inline $content field requiredMessage and focus when left empty. Must be a descendant of MyAccountProfileRoot."
|
|
527
753
|
});
|
|
528
|
-
function MyAccountProfileLastNameControl({
|
|
754
|
+
function MyAccountProfileLastNameControl({ $content, $locale, className }) {
|
|
529
755
|
const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();
|
|
756
|
+
const { format } = useMessageFormatter(MyAccountProfileLastNameControlContent, $content);
|
|
530
757
|
useEffect(() => {
|
|
531
758
|
return registerField({
|
|
532
759
|
key: "lastName",
|
|
533
|
-
validate: (value) => value.trim() ? null : requiredMessage
|
|
760
|
+
validate: (value) => value.trim() ? null : format("requiredMessage")
|
|
534
761
|
});
|
|
535
|
-
}, [
|
|
762
|
+
}, [format, registerField]);
|
|
536
763
|
const error = fieldErrors.lastName;
|
|
537
764
|
if (mode === "view") return /* @__PURE__ */ jsx("p", {
|
|
538
765
|
className,
|
|
@@ -547,7 +774,7 @@ function MyAccountProfileLastNameControl({ label = "Last name", requiredMessage
|
|
|
547
774
|
"data-fs-my-account-profile-last-name": "",
|
|
548
775
|
"data-fs-my-account-profile-field": "lastName",
|
|
549
776
|
children: [
|
|
550
|
-
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
777
|
+
/* @__PURE__ */ jsx(Field.Label, { children: format("label") }),
|
|
551
778
|
/* @__PURE__ */ jsx(Field.Control, {
|
|
552
779
|
value: draft.lastName,
|
|
553
780
|
onChange: (event) => setField("lastName", event.target.value),
|
|
@@ -564,17 +791,13 @@ const MyAccountProfilePhoneControlDefinition = defineComponent({
|
|
|
564
791
|
name: "MyAccountProfilePhoneControl",
|
|
565
792
|
importPath: "@vtex/faststore/components",
|
|
566
793
|
component: MyAccountProfilePhoneControl,
|
|
794
|
+
content: MyAccountProfilePhoneControlContent,
|
|
567
795
|
requiresContext: "my-account-profile",
|
|
568
796
|
editor: {
|
|
569
797
|
label: "My Account Profile Phone Control",
|
|
570
798
|
category: "identity"
|
|
571
799
|
},
|
|
572
800
|
schema: {
|
|
573
|
-
label: {
|
|
574
|
-
type: "string",
|
|
575
|
-
default: "Phone",
|
|
576
|
-
label: "Label"
|
|
577
|
-
},
|
|
578
801
|
field: {
|
|
579
802
|
type: ["homePhone", "mobilePhone"],
|
|
580
803
|
default: "mobilePhone",
|
|
@@ -584,27 +807,23 @@ const MyAccountProfilePhoneControlDefinition = defineComponent({
|
|
|
584
807
|
type: ["US", "BR"],
|
|
585
808
|
default: "US",
|
|
586
809
|
label: "Country"
|
|
587
|
-
},
|
|
588
|
-
invalidMessage: {
|
|
589
|
-
type: "string",
|
|
590
|
-
default: "Invalid phone number",
|
|
591
|
-
label: "Invalid message"
|
|
592
810
|
}
|
|
593
811
|
},
|
|
594
|
-
guideline: "Draft-bound, optional phone field bound to either homePhone or mobilePhone via the field prop (Decision 1) — compose it twice to expose both numbers. Normalizes to E.164 on the Root's Save. Absent from the composition means absent from the payload. Must be a descendant of MyAccountProfileRoot."
|
|
812
|
+
guideline: "Draft-bound, optional phone field bound to either homePhone or mobilePhone via the field prop (Decision 1) — compose it twice to expose both numbers. Its copy is the $content fields label and invalidMessage. Normalizes to E.164 on the Root's Save. Absent from the composition means absent from the payload. Must be a descendant of MyAccountProfileRoot."
|
|
595
813
|
});
|
|
596
|
-
function MyAccountProfilePhoneControl({
|
|
814
|
+
function MyAccountProfilePhoneControl({ field = "mobilePhone", country = "US", $content, $locale, className }) {
|
|
597
815
|
const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();
|
|
816
|
+
const { format } = useMessageFormatter(MyAccountProfilePhoneControlContent, $content);
|
|
598
817
|
useEffect(() => {
|
|
599
818
|
return registerField({
|
|
600
819
|
key: field,
|
|
601
|
-
validate: (value) => value.trim() && !validatePhoneNumber(value, country) ? invalidMessage : null,
|
|
820
|
+
validate: (value) => value.trim() && !validatePhoneNumber(value, country) ? format("invalidMessage") : null,
|
|
602
821
|
normalize: (value) => value.trim() ? toE164(value, country) : value
|
|
603
822
|
});
|
|
604
823
|
}, [
|
|
605
824
|
field,
|
|
606
825
|
country,
|
|
607
|
-
|
|
826
|
+
format,
|
|
608
827
|
registerField
|
|
609
828
|
]);
|
|
610
829
|
const error = fieldErrors[field];
|
|
@@ -618,14 +837,14 @@ function MyAccountProfilePhoneControl({ label = "Phone", field = "mobilePhone",
|
|
|
618
837
|
"data-fs-my-account-profile-field": field,
|
|
619
838
|
children: /* @__PURE__ */ jsx(PhoneField, {
|
|
620
839
|
className,
|
|
621
|
-
label,
|
|
840
|
+
label: format("label"),
|
|
622
841
|
country,
|
|
623
842
|
requirement: "optional",
|
|
624
843
|
value: draft[field],
|
|
625
844
|
onValueChange: (value) => setField(field, value),
|
|
626
845
|
invalid: !!error,
|
|
627
846
|
error: error ?? void 0,
|
|
628
|
-
errorInvalid: invalidMessage,
|
|
847
|
+
errorInvalid: format("invalidMessage"),
|
|
629
848
|
isDisabled: pending,
|
|
630
849
|
"data-fs-my-account-profile-phone": field
|
|
631
850
|
})
|
|
@@ -635,45 +854,31 @@ const MyAccountProfileTaxIdControlDefinition = defineComponent({
|
|
|
635
854
|
name: "MyAccountProfileTaxIdControl",
|
|
636
855
|
importPath: "@vtex/faststore/components",
|
|
637
856
|
component: MyAccountProfileTaxIdControl,
|
|
857
|
+
content: MyAccountProfileTaxIdControlContent,
|
|
638
858
|
requiresContext: "my-account-profile",
|
|
639
859
|
editor: {
|
|
640
860
|
label: "My Account Profile Tax ID Control",
|
|
641
861
|
category: "identity"
|
|
642
862
|
},
|
|
643
|
-
schema: {
|
|
644
|
-
|
|
645
|
-
type: "string",
|
|
646
|
-
default: "National tax ID",
|
|
647
|
-
label: "Label"
|
|
648
|
-
},
|
|
649
|
-
invalidMessage: {
|
|
650
|
-
type: "string",
|
|
651
|
-
default: "Invalid document number.",
|
|
652
|
-
label: "Invalid message"
|
|
653
|
-
},
|
|
654
|
-
lockedReason: {
|
|
655
|
-
type: "string",
|
|
656
|
-
default: "Your document ID can't be edited.",
|
|
657
|
-
label: "Locked reason"
|
|
658
|
-
}
|
|
659
|
-
},
|
|
660
|
-
guideline: "Draft-bound, optional national tax-ID field for the Root's active document type: CPF, SSN, SIN or RFC, each with its own mask and validation. Self-gates on that type and renders nothing when it is unset or unknown. A saved value renders as a disabled, locked input in the edit state rather than disappearing (Decision 4); an unsaved value renders as an editable field. Must be a descendant of MyAccountProfileRoot."
|
|
863
|
+
schema: {},
|
|
864
|
+
guideline: "Draft-bound, optional national tax-ID field for the Root's active document type: CPF, SSN, SIN or RFC, each with its own mask and validation. Self-gates on that type and renders nothing when it is unset or unknown. Its copy is the $content fields label, invalidMessage and lockedReason. A saved value renders as a disabled, locked input in the edit state rather than disappearing (Decision 4); an unsaved value renders as an editable field. Must be a descendant of MyAccountProfileRoot."
|
|
661
865
|
});
|
|
662
|
-
function MyAccountProfileTaxIdControl({
|
|
866
|
+
function MyAccountProfileTaxIdControl({ $content, $locale, className }) {
|
|
663
867
|
const { mode, draft, savedValues, fieldErrors, pending, activeDocumentType, registerField, setField } = useMyAccountProfile();
|
|
868
|
+
const { format } = useMessageFormatter(MyAccountProfileTaxIdControlContent, $content);
|
|
664
869
|
const documentType = activeDocumentType && isSupportedDocumentType(activeDocumentType) ? activeDocumentType : void 0;
|
|
665
870
|
const hasSavedDocument = savedValues.document.trim() !== "";
|
|
666
871
|
useEffect(() => {
|
|
667
872
|
if (!documentType || hasSavedDocument) return;
|
|
668
873
|
return registerField({
|
|
669
874
|
key: "document",
|
|
670
|
-
validate: (value) => value.trim() && !isValidDocument(value, documentType) ? invalidMessage : null,
|
|
875
|
+
validate: (value) => value.trim() && !isValidDocument(value, documentType) ? format("invalidMessage") : null,
|
|
671
876
|
normalize: (value) => DOCUMENTS[documentType].sanitize(value)
|
|
672
877
|
});
|
|
673
878
|
}, [
|
|
674
879
|
documentType,
|
|
675
880
|
hasSavedDocument,
|
|
676
|
-
|
|
881
|
+
format,
|
|
677
882
|
registerField
|
|
678
883
|
]);
|
|
679
884
|
if (!documentType) return null;
|
|
@@ -684,25 +889,28 @@ function MyAccountProfileTaxIdControl({ label = "National tax ID", invalidMessag
|
|
|
684
889
|
"data-fs-my-account-profile-field": "document",
|
|
685
890
|
children: savedValues.document ? maskDocumentValue(savedValues.document, documentType) : ""
|
|
686
891
|
});
|
|
687
|
-
if (hasSavedDocument)
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
892
|
+
if (hasSavedDocument) {
|
|
893
|
+
const lockedReason = format("lockedReason");
|
|
894
|
+
return /* @__PURE__ */ jsxs(Field.Root, {
|
|
895
|
+
className,
|
|
896
|
+
"data-fs-my-account-profile-tax-id": "",
|
|
897
|
+
"data-fs-my-account-profile-field": "document",
|
|
898
|
+
children: [
|
|
899
|
+
/* @__PURE__ */ jsx(Field.Label, { children: format("label") }),
|
|
900
|
+
/* @__PURE__ */ jsx(Field.Control, {
|
|
901
|
+
readOnly: true,
|
|
902
|
+
"aria-disabled": "true",
|
|
903
|
+
title: lockedReason,
|
|
904
|
+
value: maskDocumentValue(savedValues.document, documentType),
|
|
905
|
+
"data-fs-my-account-profile-tax-id-readonly": ""
|
|
906
|
+
}),
|
|
907
|
+
/* @__PURE__ */ jsx(Field.Description, { children: lockedReason })
|
|
908
|
+
]
|
|
909
|
+
});
|
|
910
|
+
}
|
|
703
911
|
return /* @__PURE__ */ jsx(DocumentField, {
|
|
704
912
|
className,
|
|
705
|
-
label,
|
|
913
|
+
label: format("label"),
|
|
706
914
|
documentType,
|
|
707
915
|
value: draft.document,
|
|
708
916
|
onValueChange: (value) => setField("document", value),
|
|
@@ -717,20 +925,18 @@ const MyAccountProfileBirthDateControlDefinition = defineComponent({
|
|
|
717
925
|
name: "MyAccountProfileBirthDateControl",
|
|
718
926
|
importPath: "@vtex/faststore/components",
|
|
719
927
|
component: MyAccountProfileBirthDateControl,
|
|
928
|
+
content: MyAccountProfileBirthDateControlContent,
|
|
720
929
|
requiresContext: "my-account-profile",
|
|
721
930
|
editor: {
|
|
722
931
|
label: "My Account Profile Birth Date Control",
|
|
723
932
|
category: "identity"
|
|
724
933
|
},
|
|
725
|
-
schema: {
|
|
726
|
-
|
|
727
|
-
default: "Birth date",
|
|
728
|
-
label: "Label"
|
|
729
|
-
} },
|
|
730
|
-
guideline: "Draft-bound, optional birth-date field over a native date input. Maps the native yyyy-mm-dd value to the stored profile format on read and write. Must be a descendant of MyAccountProfileRoot."
|
|
934
|
+
schema: {},
|
|
935
|
+
guideline: "Draft-bound, optional birth-date field over a native date input, labelled by the $content field label. Maps the native yyyy-mm-dd value to the stored profile format on read and write. Must be a descendant of MyAccountProfileRoot."
|
|
731
936
|
});
|
|
732
|
-
function MyAccountProfileBirthDateControl({
|
|
937
|
+
function MyAccountProfileBirthDateControl({ $content, $locale, className }) {
|
|
733
938
|
const { mode, draft, savedValues, pending, registerField, setField } = useMyAccountProfile();
|
|
939
|
+
const { format } = useMessageFormatter(MyAccountProfileBirthDateControlContent, $content);
|
|
734
940
|
useEffect(() => {
|
|
735
941
|
return registerField({
|
|
736
942
|
key: "birthDate",
|
|
@@ -750,7 +956,7 @@ function MyAccountProfileBirthDateControl({ label = "Birth date", className }) {
|
|
|
750
956
|
className,
|
|
751
957
|
"data-fs-my-account-profile-birth-date": "",
|
|
752
958
|
"data-fs-my-account-profile-field": "birthDate",
|
|
753
|
-
children: [/* @__PURE__ */ jsx(Field.Label, { children: label }), /* @__PURE__ */ jsx(Input, {
|
|
959
|
+
children: [/* @__PURE__ */ jsx(Field.Label, { children: format("label") }), /* @__PURE__ */ jsx(Input, {
|
|
754
960
|
type: "date",
|
|
755
961
|
value: toNativeDate(draft.birthDate),
|
|
756
962
|
onChange: handleChange,
|
|
@@ -762,32 +968,22 @@ const MyAccountProfileGenderControlDefinition = defineComponent({
|
|
|
762
968
|
name: "MyAccountProfileGenderControl",
|
|
763
969
|
importPath: "@vtex/faststore/components",
|
|
764
970
|
component: MyAccountProfileGenderControl,
|
|
971
|
+
content: MyAccountProfileGenderControlContent,
|
|
765
972
|
requiresContext: "my-account-profile",
|
|
766
973
|
editor: {
|
|
767
974
|
label: "My Account Profile Gender Control",
|
|
768
975
|
category: "identity"
|
|
769
976
|
},
|
|
770
|
-
schema: {
|
|
771
|
-
|
|
772
|
-
type: "string",
|
|
773
|
-
default: "Gender",
|
|
774
|
-
label: "Label"
|
|
775
|
-
},
|
|
776
|
-
placeholder: {
|
|
777
|
-
type: "string",
|
|
778
|
-
default: "Select",
|
|
779
|
-
label: "Placeholder"
|
|
780
|
-
},
|
|
781
|
-
clearLabel: {
|
|
782
|
-
type: "string",
|
|
783
|
-
default: "Clear",
|
|
784
|
-
label: "Clear button label"
|
|
785
|
-
}
|
|
786
|
-
},
|
|
787
|
-
guideline: "Draft-bound, optional gender field over a store-configurable set of options (the options prop). Free-string storage — no server-side enum. A Clear button erases a selected value back to empty, since the Select itself offers no such option. Must be a descendant of MyAccountProfileRoot."
|
|
977
|
+
schema: {},
|
|
978
|
+
guideline: "Draft-bound, optional gender field over a store-configurable set of options (the options prop); its label, placeholder and clear label are the $content fields label, placeholder and clearLabel. Without authored options it offers female, male, other and prefer not to say, labelled by the $content fields femaleLabel, maleLabel, otherLabel and preferNotToSayLabel. Free-string storage — no server-side enum. A Clear button erases a selected value back to empty, since the Select itself offers no such option. Must be a descendant of MyAccountProfileRoot."
|
|
788
979
|
});
|
|
789
|
-
function MyAccountProfileGenderControl({
|
|
980
|
+
function MyAccountProfileGenderControl({ options: authoredOptions, $content, $locale, className }) {
|
|
790
981
|
const { mode, draft, savedValues, pending, registerField, setField } = useMyAccountProfile();
|
|
982
|
+
const { format } = useMessageFormatter(MyAccountProfileGenderControlContent, $content);
|
|
983
|
+
const options = useMemo(() => authoredOptions ?? DEFAULT_GENDER_OPTIONS.map(({ value, field }) => ({
|
|
984
|
+
value,
|
|
985
|
+
label: format(field)
|
|
986
|
+
})), [authoredOptions, format]);
|
|
791
987
|
useEffect(() => {
|
|
792
988
|
return registerField({ key: "gender" });
|
|
793
989
|
}, [registerField]);
|
|
@@ -809,8 +1005,8 @@ function MyAccountProfileGenderControl({ label = "Gender", placeholder = "Select
|
|
|
809
1005
|
onValueChange: (value) => setField("gender", value ?? ""),
|
|
810
1006
|
disabled: pending,
|
|
811
1007
|
children: [
|
|
812
|
-
/* @__PURE__ */ jsx(Select.Label, { children: label }),
|
|
813
|
-
/* @__PURE__ */ jsxs(Select.Trigger, { children: [/* @__PURE__ */ jsx(Select.Value, { placeholder }), /* @__PURE__ */ jsx(Select.Icon, {})] }),
|
|
1008
|
+
/* @__PURE__ */ jsx(Select.Label, { children: format("label") }),
|
|
1009
|
+
/* @__PURE__ */ jsxs(Select.Trigger, { children: [/* @__PURE__ */ jsx(Select.Value, { placeholder: format("placeholder") }), /* @__PURE__ */ jsx(Select.Icon, {})] }),
|
|
814
1010
|
/* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, { children: /* @__PURE__ */ jsx(Select.Popup, { children: /* @__PURE__ */ jsx(Select.List, { children: options.map((option) => /* @__PURE__ */ jsx(Select.Item, {
|
|
815
1011
|
value: option.value,
|
|
816
1012
|
children: /* @__PURE__ */ jsx(Select.ItemText, { children: option.label })
|
|
@@ -821,7 +1017,7 @@ function MyAccountProfileGenderControl({ label = "Gender", placeholder = "Select
|
|
|
821
1017
|
onClick: () => setField("gender", ""),
|
|
822
1018
|
disabled: pending,
|
|
823
1019
|
"data-fs-my-account-profile-gender-clear": "",
|
|
824
|
-
children: clearLabel
|
|
1020
|
+
children: format("clearLabel")
|
|
825
1021
|
}) : null]
|
|
826
1022
|
});
|
|
827
1023
|
}
|
|
@@ -852,6 +1048,6 @@ const MyAccountProfile = {
|
|
|
852
1048
|
GenderControlDefinition: MyAccountProfileGenderControlDefinition
|
|
853
1049
|
};
|
|
854
1050
|
//#endregion
|
|
855
|
-
export { MyAccountProfile, MyAccountProfileBirthDateControl, MyAccountProfileBirthDateControlDefinition, MyAccountProfileCancelButton, MyAccountProfileCancelButtonDefinition, MyAccountProfileEditButton, MyAccountProfileEditButtonDefinition, MyAccountProfileEmail, MyAccountProfileEmailDefinition, MyAccountProfileFirstNameControl, MyAccountProfileFirstNameControlDefinition, MyAccountProfileGenderControl, MyAccountProfileGenderControlDefinition, MyAccountProfileLastNameControl, MyAccountProfileLastNameControlDefinition, MyAccountProfilePhoneControl, MyAccountProfilePhoneControlDefinition, MyAccountProfileRoot, MyAccountProfileRootDefinition, MyAccountProfileSaveButton, MyAccountProfileSaveButtonDefinition, MyAccountProfileSkeleton, MyAccountProfileSkeletonDefinition, MyAccountProfileTaxIdControl, MyAccountProfileTaxIdControlDefinition, useMyAccountProfile };
|
|
1051
|
+
export { MY_ACCOUNT_PROFILE_ERROR_FIELDS, MyAccountProfile, MyAccountProfileBirthDateControl, MyAccountProfileBirthDateControlContent, MyAccountProfileBirthDateControlDefinition, MyAccountProfileCancelButton, MyAccountProfileCancelButtonContent, MyAccountProfileCancelButtonDefinition, MyAccountProfileEditButton, MyAccountProfileEditButtonContent, MyAccountProfileEditButtonDefinition, MyAccountProfileEmail, MyAccountProfileEmailDefinition, MyAccountProfileFirstNameControl, MyAccountProfileFirstNameControlContent, MyAccountProfileFirstNameControlDefinition, MyAccountProfileGenderControl, MyAccountProfileGenderControlContent, MyAccountProfileGenderControlDefinition, MyAccountProfileLastNameControl, MyAccountProfileLastNameControlContent, MyAccountProfileLastNameControlDefinition, MyAccountProfilePhoneControl, MyAccountProfilePhoneControlContent, MyAccountProfilePhoneControlDefinition, MyAccountProfileRoot, MyAccountProfileRootContent, MyAccountProfileRootDefinition, MyAccountProfileSaveButton, MyAccountProfileSaveButtonContent, MyAccountProfileSaveButtonDefinition, MyAccountProfileSkeleton, MyAccountProfileSkeletonDefinition, MyAccountProfileTaxIdControl, MyAccountProfileTaxIdControlContent, MyAccountProfileTaxIdControlDefinition, useMyAccountProfile };
|
|
856
1052
|
|
|
857
1053
|
//# sourceMappingURL=my-account-profile.js.map
|