@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,14 +1,20 @@
|
|
|
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 { useStorefrontFormatters } from "../../sdk/format/client.js";
|
|
6
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
4
7
|
import { Checkbox } from "../../particles/checkbox/checkbox.js";
|
|
5
8
|
import { Field } from "../../particles/field/field.js";
|
|
6
9
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
7
|
-
import {
|
|
10
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
11
|
+
import { countryDisplayName } from "../../sdk/address/country-display.js";
|
|
8
12
|
import { Select } from "../../particles/select/select.js";
|
|
9
13
|
import { Icon } from "../../particles/icon/icon.js";
|
|
10
14
|
import { usePayment } from "../payment/payment.js";
|
|
11
|
-
import {
|
|
15
|
+
import { normalizeAddressField, pickActiveTextFields } from "../shipping-address/address-payload.js";
|
|
16
|
+
import { LIBRARY_COUNTRIES, useLibraryCountryDescriptors } from "../shipping-address/library-country-descriptors.js";
|
|
17
|
+
import { getAvailableCountries, getCountryDescriptor, satisfiesFieldRule } from "../shipping-address/country-descriptors.js";
|
|
12
18
|
import { useEffect, useId, useMemo, useState } from "react";
|
|
13
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
20
|
//#region src/matter/billing-address/billing-address.tsx
|
|
@@ -18,29 +24,42 @@ const OMITTED_FORM_FIELD_NAMES = /* @__PURE__ */ new Set(["recipientName"]);
|
|
|
18
24
|
/** Descriptor field names the custom-address form renders but never marks required, even while
|
|
19
25
|
* "different" is selected (PR #544 N1 item 1 — the engineer's own rule, verbatim: "if the person says
|
|
20
26
|
* the address is different, the new address fields must be required"). `complement` is the one
|
|
21
|
-
* exception: `complementLabel`
|
|
27
|
+
* exception: the `complementLabel` message labels it optional ("Complement (optional)"),
|
|
22
28
|
* and neither a real-world address nor the server's own write contract treats it as load-bearing.
|
|
23
29
|
* Shared between the `required` attribute below and `isBillingAddressFormValid`, so the two never
|
|
24
|
-
* drift apart.
|
|
30
|
+
* drift apart. A `complementLabel` message that drops the "(optional)" suffix loses that visual cue
|
|
25
31
|
* without changing this set — the two are independent (R7, billing-address.md). */
|
|
26
32
|
const OPTIONAL_FORM_FIELD_NAMES = /* @__PURE__ */ new Set(["complement"]);
|
|
27
33
|
/**
|
|
28
|
-
*
|
|
29
|
-
* the
|
|
30
|
-
*
|
|
31
|
-
* string there, not in another English override map here. T31
|
|
32
|
-
* (specs/make-the-payment-components-authored-copy.md, Decision 5) turned the eight *field* labels into
|
|
33
|
-
* schema props but left this one a plain map: a prop per ISO code does not scale the way eight named
|
|
34
|
-
* field-label props do. Keyed by the descriptor's own ISO code.
|
|
34
|
+
* The message field that labels each descriptor field, by canonical field name. `recipientName` is listed
|
|
35
|
+
* though the form never renders it (`OMITTED_FORM_FIELD_NAMES`). A field a library-backed descriptor adds
|
|
36
|
+
* with no entry here shows its canonical name.
|
|
35
37
|
*/
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
const LABEL_FIELDS = {
|
|
39
|
+
recipientName: "recipientNameLabel",
|
|
40
|
+
street: "streetLabel",
|
|
41
|
+
number: "numberLabel",
|
|
42
|
+
complement: "complementLabel",
|
|
43
|
+
neighborhood: "neighborhoodLabel",
|
|
44
|
+
city: "cityLabel",
|
|
45
|
+
state: "stateLabel",
|
|
46
|
+
postalCode: "postalCodeLabel"
|
|
39
47
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
function labelFieldOf(name) {
|
|
49
|
+
return Object.hasOwn(LABEL_FIELDS, name) ? LABEL_FIELDS[name] : void 0;
|
|
50
|
+
}
|
|
51
|
+
function countryNameOf(iso, displayName) {
|
|
52
|
+
return countryDisplayName(iso, displayName) ?? iso;
|
|
53
|
+
}
|
|
54
|
+
/** `defaultCountry` when it has a descriptor or is library-backed, else the first available country. */
|
|
55
|
+
function initialCountryOf(defaultCountry) {
|
|
56
|
+
if (getCountryDescriptor(defaultCountry) || LIBRARY_COUNTRIES.includes(defaultCountry)) return defaultCountry;
|
|
57
|
+
return getAvailableCountries()[0] ?? defaultCountry;
|
|
58
|
+
}
|
|
59
|
+
/** The field's label message, or its descriptor name when no message field covers it. */
|
|
60
|
+
function fieldLabelOf(name, formatLabel) {
|
|
61
|
+
const labelField = labelFieldOf(name);
|
|
62
|
+
return labelField ? formatLabel(labelField) : name;
|
|
44
63
|
}
|
|
45
64
|
/**
|
|
46
65
|
* Whether the toggle reads as "same as delivery" — `true` whenever the published flag is `null`
|
|
@@ -56,26 +75,23 @@ function resolveSameAsDelivery(billingAddressDifferent) {
|
|
|
56
75
|
* `isBillingAddressFormValid`) and the per-field error (the `issue` computed per field in the render), so the
|
|
57
76
|
* two can never disagree (T38 Decision 8). Blank (after
|
|
58
77
|
* trim) wins over format: `complement` (`OPTIONAL_FORM_FIELD_NAMES`) may be blank, every other field may
|
|
59
|
-
* not. A non-blank value is tested raw against the descriptor's `rule.pattern`
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* delivery form would run the pattern on it (see
|
|
63
|
-
* here: the descriptor's `rule
|
|
78
|
+
* not. A non-blank value is tested raw against the descriptor's `rule.pattern` and its function-valued
|
|
79
|
+
* `rule.validate` (`satisfiesFieldRule`) — the same predicates the delivery form's react-hook-form rule
|
|
80
|
+
* applies, so a surrounding space is a format error in both for a pattern. A whitespace-only value is the
|
|
81
|
+
* one divergence: it is blank here (`required`), where the delivery form would run the pattern on it (see
|
|
82
|
+
* `satisfiesFieldPattern`). No postal format is defined here: the descriptor's `rule` is the only definition.
|
|
64
83
|
*/
|
|
65
84
|
function getFieldIssue(field, value) {
|
|
66
85
|
if (value.trim().length === 0) return OPTIONAL_FORM_FIELD_NAMES.has(field.name) ? null : "required";
|
|
67
|
-
return
|
|
86
|
+
return satisfiesFieldRule(field, value) ? null : "format";
|
|
68
87
|
}
|
|
69
88
|
/**
|
|
70
|
-
* The message under a field whose verdict is `format`.
|
|
71
|
-
* `postalCodeInvalidMessage
|
|
72
|
-
*
|
|
73
|
-
* same rule, so a pattern a descriptor gains later never surfaces the postal-code copy. A field with no
|
|
74
|
-
* pattern never reaches a `format` verdict, so the empty string is not a message anyone sees.
|
|
89
|
+
* The message under a field whose verdict is `format`. Only the postal code has a format today, and it reads
|
|
90
|
+
* the formatted `postalCodeInvalidMessage`, so a format a descriptor gives another field later never surfaces
|
|
91
|
+
* the postal-code copy: that field needs a message field of its own, and shows none until it has one.
|
|
75
92
|
*/
|
|
76
93
|
function getFieldFormatMessage(field, postalCodeMessage) {
|
|
77
|
-
|
|
78
|
-
return field.rule?.pattern?.message ?? "";
|
|
94
|
+
return field.name === "postalCode" ? postalCodeMessage : "";
|
|
79
95
|
}
|
|
80
96
|
/** The descriptor's fields the custom-address form renders: everything but `OMITTED_FORM_FIELD_NAMES`. */
|
|
81
97
|
function getRenderableFields(descriptor) {
|
|
@@ -153,138 +169,200 @@ function focusNextBillingControl(panel, renderableFields, onFieldFocused) {
|
|
|
153
169
|
if (landed && fieldName) onFieldFocused(fieldName);
|
|
154
170
|
return landed;
|
|
155
171
|
}
|
|
172
|
+
const BillingAddressContent = defineContentType({
|
|
173
|
+
id: "billing-address",
|
|
174
|
+
title: "Billing Address",
|
|
175
|
+
description: "Copy of the billing address toggle, its notices, the custom-address form and its messages.",
|
|
176
|
+
schema: {
|
|
177
|
+
type: "object",
|
|
178
|
+
additionalProperties: false,
|
|
179
|
+
properties: {
|
|
180
|
+
sameAsDeliveryLabel: {
|
|
181
|
+
type: "string",
|
|
182
|
+
title: "Same-as-delivery toggle label",
|
|
183
|
+
format: "icu-message",
|
|
184
|
+
messageSource: "Billing address same as delivery address"
|
|
185
|
+
},
|
|
186
|
+
countryLabel: {
|
|
187
|
+
type: "string",
|
|
188
|
+
title: "Country field label",
|
|
189
|
+
format: "icu-message",
|
|
190
|
+
messageSource: "Country"
|
|
191
|
+
},
|
|
192
|
+
submitLabel: {
|
|
193
|
+
type: "string",
|
|
194
|
+
title: "Submit button label",
|
|
195
|
+
format: "icu-message",
|
|
196
|
+
messageSource: "Save billing address"
|
|
197
|
+
},
|
|
198
|
+
submitPendingLabel: {
|
|
199
|
+
type: "string",
|
|
200
|
+
title: "Submit button pending label",
|
|
201
|
+
format: "icu-message",
|
|
202
|
+
messageSource: "Saving..."
|
|
203
|
+
},
|
|
204
|
+
requiredNoticeLabel: {
|
|
205
|
+
type: "string",
|
|
206
|
+
title: "Required-billing-address notice",
|
|
207
|
+
description: "Shown when the selected method's validator marks a billing address required.",
|
|
208
|
+
format: "icu-message",
|
|
209
|
+
messageSource: "This payment method requires a billing address."
|
|
210
|
+
},
|
|
211
|
+
unsavedAddressNoticeLabel: {
|
|
212
|
+
type: "string",
|
|
213
|
+
title: "Unsaved-address notice",
|
|
214
|
+
description: "Shown while the form is open and no address has been saved yet.",
|
|
215
|
+
format: "icu-message",
|
|
216
|
+
messageSource: "No billing address has been saved yet — the delivery address will be used unless you save one below."
|
|
217
|
+
},
|
|
218
|
+
billingMatchNoticeLabel: {
|
|
219
|
+
type: "string",
|
|
220
|
+
title: "Billing-match disclaimer",
|
|
221
|
+
description: "Always on unless billingMatchNoticeVisible is false; blank shows no disclaimer.",
|
|
222
|
+
format: "icu-message",
|
|
223
|
+
messageSource: "Your billing address must match the one on your card or bank statement, or your bank may decline the order."
|
|
224
|
+
},
|
|
225
|
+
recipientNameLabel: {
|
|
226
|
+
type: "string",
|
|
227
|
+
title: "Recipient name field label",
|
|
228
|
+
description: "Not rendered today: the billing write has no recipient name.",
|
|
229
|
+
format: "icu-message",
|
|
230
|
+
messageSource: "Recipient's name"
|
|
231
|
+
},
|
|
232
|
+
streetLabel: {
|
|
233
|
+
type: "string",
|
|
234
|
+
title: "Street field label",
|
|
235
|
+
format: "icu-message",
|
|
236
|
+
messageSource: "Street"
|
|
237
|
+
},
|
|
238
|
+
numberLabel: {
|
|
239
|
+
type: "string",
|
|
240
|
+
title: "Number field label",
|
|
241
|
+
format: "icu-message",
|
|
242
|
+
messageSource: "Number"
|
|
243
|
+
},
|
|
244
|
+
complementLabel: {
|
|
245
|
+
type: "string",
|
|
246
|
+
title: "Complement field label",
|
|
247
|
+
description: "Its \"(optional)\" is the only sign the field is optional.",
|
|
248
|
+
format: "icu-message",
|
|
249
|
+
messageSource: "Complement (optional)"
|
|
250
|
+
},
|
|
251
|
+
neighborhoodLabel: {
|
|
252
|
+
type: "string",
|
|
253
|
+
title: "Neighborhood field label",
|
|
254
|
+
format: "icu-message",
|
|
255
|
+
messageSource: "Neighborhood"
|
|
256
|
+
},
|
|
257
|
+
cityLabel: {
|
|
258
|
+
type: "string",
|
|
259
|
+
title: "City field label",
|
|
260
|
+
format: "icu-message",
|
|
261
|
+
messageSource: "City"
|
|
262
|
+
},
|
|
263
|
+
stateLabel: {
|
|
264
|
+
type: "string",
|
|
265
|
+
title: "State field label",
|
|
266
|
+
format: "icu-message",
|
|
267
|
+
messageSource: "State"
|
|
268
|
+
},
|
|
269
|
+
postalCodeLabel: {
|
|
270
|
+
type: "string",
|
|
271
|
+
title: "Postal code field label",
|
|
272
|
+
format: "icu-message",
|
|
273
|
+
messageSource: "Postal code"
|
|
274
|
+
},
|
|
275
|
+
fieldRequiredMessage: {
|
|
276
|
+
type: "string",
|
|
277
|
+
title: "Field required message",
|
|
278
|
+
description: "Shown under a required field left blank.",
|
|
279
|
+
format: "icu-message",
|
|
280
|
+
messageSource: "This field is required."
|
|
281
|
+
},
|
|
282
|
+
postalCodeInvalidMessage: {
|
|
283
|
+
type: "string",
|
|
284
|
+
title: "Postal code format message",
|
|
285
|
+
description: "Shown under a postal code not in the selected country's format. Never contains the typed value.",
|
|
286
|
+
format: "icu-message",
|
|
287
|
+
messageSource: "Enter a valid postal code."
|
|
288
|
+
},
|
|
289
|
+
missingFieldsMessage: {
|
|
290
|
+
type: "string",
|
|
291
|
+
title: "Missing address fields message",
|
|
292
|
+
description: "Shown when the server refuses an address without a postal code or a country.",
|
|
293
|
+
format: "icu-message",
|
|
294
|
+
messageSource: "Fill in the postal code and the country of your billing address."
|
|
295
|
+
},
|
|
296
|
+
invalidCountryMessage: {
|
|
297
|
+
type: "string",
|
|
298
|
+
title: "Invalid country message",
|
|
299
|
+
description: "Shown when the server refuses the selected country.",
|
|
300
|
+
format: "icu-message",
|
|
301
|
+
messageSource: "Choose a valid country for your billing address."
|
|
302
|
+
},
|
|
303
|
+
genericErrorMessage: {
|
|
304
|
+
type: "string",
|
|
305
|
+
title: "Save failure message",
|
|
306
|
+
description: "Shown when the save fails: a network failure or a fault the shopper cannot fix.",
|
|
307
|
+
format: "icu-message",
|
|
308
|
+
messageSource: "Unable to save your billing address. Please try again."
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
/**
|
|
314
|
+
* The message for each code an address write can return. A missing field and a refused country are ones
|
|
315
|
+
* the shopper can fix; the rest, and a code this map does not know, share one message.
|
|
316
|
+
*/
|
|
317
|
+
const BILLING_ADDRESS_ERROR_FIELDS = {
|
|
318
|
+
MISSING_CART_CONTEXT: "genericErrorMessage",
|
|
319
|
+
CART_NOT_FOUND: "genericErrorMessage",
|
|
320
|
+
MISSING_BILLING_ADDRESS_FIELDS: "missingFieldsMessage",
|
|
321
|
+
INVALID_COUNTRY_CODE: "invalidCountryMessage",
|
|
322
|
+
NETWORK_ERROR: "genericErrorMessage"
|
|
323
|
+
};
|
|
156
324
|
const BillingAddressDefinition = defineComponent({
|
|
157
325
|
name: "BillingAddress",
|
|
158
326
|
importPath: "@vtex/faststore/components",
|
|
159
327
|
component: BillingAddress,
|
|
160
328
|
requiresContext: "payment",
|
|
161
329
|
actions: { payment: ["setBillingAddress"] },
|
|
330
|
+
content: BillingAddressContent,
|
|
162
331
|
editor: {
|
|
163
332
|
label: "Billing Address",
|
|
164
333
|
category: "commerce"
|
|
165
334
|
},
|
|
166
335
|
schema: {
|
|
167
|
-
sameAsDeliveryLabel: {
|
|
168
|
-
type: "string",
|
|
169
|
-
default: "Billing address same as delivery address",
|
|
170
|
-
label: "Same-as-delivery toggle label"
|
|
171
|
-
},
|
|
172
336
|
defaultCountry: {
|
|
173
337
|
type: "string",
|
|
174
338
|
default: "BRA",
|
|
175
339
|
label: "Default country (ISO-3)"
|
|
176
340
|
},
|
|
177
|
-
countryLabel: {
|
|
178
|
-
type: "string",
|
|
179
|
-
default: "Country",
|
|
180
|
-
label: "Country field label"
|
|
181
|
-
},
|
|
182
|
-
submitLabel: {
|
|
183
|
-
type: "string",
|
|
184
|
-
default: "Save billing address",
|
|
185
|
-
label: "Submit button label"
|
|
186
|
-
},
|
|
187
|
-
submitPendingLabel: {
|
|
188
|
-
type: "string",
|
|
189
|
-
default: "Saving...",
|
|
190
|
-
label: "Submit button pending label"
|
|
191
|
-
},
|
|
192
|
-
requiredNoticeLabel: {
|
|
193
|
-
type: "string",
|
|
194
|
-
default: "This payment method requires a billing address.",
|
|
195
|
-
label: "Required-billing-address notice label"
|
|
196
|
-
},
|
|
197
|
-
unsavedAddressNoticeLabel: {
|
|
198
|
-
type: "string",
|
|
199
|
-
default: "No billing address has been saved yet — the delivery address will be used unless you save one below.",
|
|
200
|
-
label: "Unsaved-address notice label"
|
|
201
|
-
},
|
|
202
|
-
billingMatchNoticeLabel: {
|
|
203
|
-
type: "string",
|
|
204
|
-
default: "Your billing address must match the one on your card or bank statement, or your bank may decline the order.",
|
|
205
|
-
label: "Billing-match disclaimer"
|
|
206
|
-
},
|
|
207
341
|
billingMatchNoticeVisible: {
|
|
208
342
|
type: "boolean",
|
|
209
343
|
default: true,
|
|
210
344
|
label: "Show the billing-match disclaimer"
|
|
211
345
|
},
|
|
212
|
-
recipientNameLabel: {
|
|
213
|
-
type: "string",
|
|
214
|
-
default: "Recipient's name",
|
|
215
|
-
label: "Recipient name field label"
|
|
216
|
-
},
|
|
217
|
-
streetLabel: {
|
|
218
|
-
type: "string",
|
|
219
|
-
default: "Street",
|
|
220
|
-
label: "Street field label"
|
|
221
|
-
},
|
|
222
|
-
numberLabel: {
|
|
223
|
-
type: "string",
|
|
224
|
-
default: "Number",
|
|
225
|
-
label: "Number field label"
|
|
226
|
-
},
|
|
227
|
-
complementLabel: {
|
|
228
|
-
type: "string",
|
|
229
|
-
default: "Complement (optional)",
|
|
230
|
-
label: "Complement field label"
|
|
231
|
-
},
|
|
232
|
-
neighborhoodLabel: {
|
|
233
|
-
type: "string",
|
|
234
|
-
default: "Neighborhood",
|
|
235
|
-
label: "Neighborhood field label"
|
|
236
|
-
},
|
|
237
|
-
cityLabel: {
|
|
238
|
-
type: "string",
|
|
239
|
-
default: "City",
|
|
240
|
-
label: "City field label"
|
|
241
|
-
},
|
|
242
|
-
stateLabel: {
|
|
243
|
-
type: "string",
|
|
244
|
-
default: "State",
|
|
245
|
-
label: "State field label"
|
|
246
|
-
},
|
|
247
|
-
postalCodeLabel: {
|
|
248
|
-
type: "string",
|
|
249
|
-
default: "Postal code",
|
|
250
|
-
label: "Postal code field label"
|
|
251
|
-
},
|
|
252
|
-
fieldRequiredMessage: {
|
|
253
|
-
type: "string",
|
|
254
|
-
default: "This field is required.",
|
|
255
|
-
label: "Field required message"
|
|
256
|
-
},
|
|
257
|
-
postalCodeInvalidMessage: {
|
|
258
|
-
type: "string",
|
|
259
|
-
default: "Enter a valid postal code.",
|
|
260
|
-
label: "Postal code format message"
|
|
261
|
-
},
|
|
262
346
|
disabled: {
|
|
263
347
|
type: "boolean",
|
|
264
348
|
default: false,
|
|
265
349
|
label: "Disabled"
|
|
266
350
|
}
|
|
267
351
|
},
|
|
268
|
-
guideline: "Same-as-delivery toggle (default on) for the billing address; when off, mounts a country-specific address form (reusing shipping-address's country descriptors) and persists it via $actions.payment.setBillingAddress on an explicit submit control. Re-checking the toggle dispatches sameAsDelivery: true only once an address was actually persisted (otherwise it's a local no-op — there's nothing on the server to revert). Publishes only a boolean (never the address) onto the shared payment draft for usePlaceOrder to read. While the form is open and nothing has been saved yet, renders an inline status notice — the required attribute on the form's own fields is not a submit gate; Place Order can still complete billed to the delivery address if the shopper never saves. Must be inside a PaymentSectionRoot or PaymentSectionController; place as a sibling of CardEntry/SavedCards/Installments/SaveCard/PlaceOrder, never nested inside any of them. See billing-address.md."
|
|
352
|
+
guideline: "Same-as-delivery toggle (default on) for the billing address; when off, mounts a country-specific address form (reusing shipping-address's country descriptors) and persists it via $actions.payment.setBillingAddress on an explicit submit control. Re-checking the toggle dispatches sameAsDelivery: true only once an address was actually persisted (otherwise it's a local no-op — there's nothing on the server to revert). Publishes only a boolean (never the address) onto the shared payment draft for usePlaceOrder to read. Every label, notice and message is a $content field; country names follow the store locale. While the form is open and nothing has been saved yet, renders an inline status notice — the required attribute on the form's own fields is not a submit gate; Place Order can still complete billed to the delivery address if the shopper never saves. Must be inside a PaymentSectionRoot or PaymentSectionController; place as a sibling of CardEntry/SavedCards/Installments/SaveCard/PlaceOrder, never nested inside any of them. See billing-address.md."
|
|
269
353
|
});
|
|
270
|
-
function BillingAddress({
|
|
354
|
+
function BillingAddress({ defaultCountry = "BRA", billingMatchNoticeVisible = true, disabled = false, className, $actions: $actionsProp, $content, $locale, ...props }) {
|
|
271
355
|
const $actions = useActionsOverride($actionsProp);
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
complement: complementLabel,
|
|
277
|
-
neighborhood: neighborhoodLabel,
|
|
278
|
-
city: cityLabel,
|
|
279
|
-
state: stateLabel,
|
|
280
|
-
postalCode: postalCodeLabel
|
|
281
|
-
};
|
|
356
|
+
const { format } = useMessageFormatter(BillingAddressContent, $content);
|
|
357
|
+
const { displayName } = useStorefrontFormatters();
|
|
358
|
+
const countryName = (iso) => countryNameOf(iso, displayName);
|
|
359
|
+
const fieldLabel = (name) => fieldLabelOf(name, (labelField) => format(labelField));
|
|
282
360
|
const { draft, selectedMethod, setDraftBillingAddressDifferent, setDraftBillingAddressUnsaved, placing, cardPaymentCollapsed, registerRefusalFocus } = usePayment();
|
|
283
361
|
const instanceKey = useId();
|
|
284
362
|
const panelId = useId();
|
|
285
363
|
const [formDraft, setFormDraft] = useState(() => ({
|
|
286
364
|
postalCode: "",
|
|
287
|
-
country:
|
|
365
|
+
country: initialCountryOf(defaultCountry),
|
|
288
366
|
street: "",
|
|
289
367
|
number: "",
|
|
290
368
|
complement: "",
|
|
@@ -310,8 +388,8 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
310
388
|
setDraftBillingAddressUnsaved
|
|
311
389
|
]);
|
|
312
390
|
const canTakeFocus = !cardPaymentCollapsed && formOpen;
|
|
313
|
-
|
|
314
|
-
const draftDescriptor =
|
|
391
|
+
useLibraryCountryDescriptors();
|
|
392
|
+
const draftDescriptor = getCountryDescriptor(formDraft.country);
|
|
315
393
|
const renderableFields = useMemo(() => draftDescriptor ? getRenderableFields(draftDescriptor) : [], [draftDescriptor]);
|
|
316
394
|
useEffect(() => {
|
|
317
395
|
if (!canTakeFocus) return;
|
|
@@ -325,8 +403,6 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
325
403
|
]);
|
|
326
404
|
const billingAddressRequired = selectedMethod?.validator.billingAddressRequired ?? false;
|
|
327
405
|
const fieldsDisabled = disabled || pending;
|
|
328
|
-
const requiredMessage = resolveAuthoredCopy(fieldRequiredMessage, "This field is required.");
|
|
329
|
-
const invalidMessage = resolveAuthoredCopy(postalCodeInvalidMessage, "Enter a valid postal code.");
|
|
330
406
|
async function handleSameAsDeliveryChange(nextSameAsDelivery) {
|
|
331
407
|
setError(null);
|
|
332
408
|
if (!nextSameAsDelivery) {
|
|
@@ -342,7 +418,7 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
342
418
|
setPending(true);
|
|
343
419
|
try {
|
|
344
420
|
const [firstError] = await setBillingAddress({ sameAsDelivery: true });
|
|
345
|
-
if (firstError) setError(firstError
|
|
421
|
+
if (firstError) setError(firstError);
|
|
346
422
|
else {
|
|
347
423
|
setDraftBillingAddressDifferent(false);
|
|
348
424
|
setFormOpen(false);
|
|
@@ -372,27 +448,22 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
372
448
|
const setBillingAddress = $actions?.payment?.setBillingAddress;
|
|
373
449
|
setError(null);
|
|
374
450
|
if (!setBillingAddress) return;
|
|
375
|
-
const isFieldActive = (name) => renderableFields.some((field) => field.name === name);
|
|
376
451
|
setPending(true);
|
|
377
452
|
try {
|
|
378
453
|
const [firstError] = await setBillingAddress({
|
|
379
454
|
sameAsDelivery: false,
|
|
380
|
-
postalCode: formDraft.postalCode,
|
|
455
|
+
postalCode: normalizeAddressField(renderableFields, "postalCode", formDraft.postalCode),
|
|
381
456
|
country: formDraft.country,
|
|
382
|
-
...
|
|
383
|
-
...isFieldActive("number") ? { number: formDraft.number } : {},
|
|
384
|
-
...isFieldActive("complement") ? { complement: formDraft.complement } : {},
|
|
385
|
-
...isFieldActive("neighborhood") ? { neighborhood: formDraft.neighborhood } : {},
|
|
386
|
-
...isFieldActive("city") ? { city: formDraft.city } : {},
|
|
387
|
-
...isFieldActive("state") ? { state: formDraft.state } : {}
|
|
457
|
+
...pickActiveTextFields(renderableFields, formDraft)
|
|
388
458
|
});
|
|
389
|
-
if (firstError) setError(firstError
|
|
459
|
+
if (firstError) setError(firstError);
|
|
390
460
|
else setDraftBillingAddressDifferent(true);
|
|
391
461
|
} finally {
|
|
392
462
|
setPending(false);
|
|
393
463
|
}
|
|
394
464
|
}
|
|
395
465
|
if (cardPaymentCollapsed) return null;
|
|
466
|
+
const billingMatchNotice = billingMatchNoticeVisible ? format("billingMatchNoticeLabel") : "";
|
|
396
467
|
return /* @__PURE__ */ jsxs("div", {
|
|
397
468
|
...props,
|
|
398
469
|
className,
|
|
@@ -403,9 +474,9 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
403
474
|
...pending ? { "data-fs-billing-address-pending": "" } : {},
|
|
404
475
|
...sameAsDelivery ? { "data-fs-billing-address-same-as-delivery": "" } : {},
|
|
405
476
|
children: [
|
|
406
|
-
|
|
477
|
+
billingMatchNotice.trim() ? /* @__PURE__ */ jsx("p", {
|
|
407
478
|
"data-fs-billing-address-match-notice": "",
|
|
408
|
-
children:
|
|
479
|
+
children: billingMatchNotice
|
|
409
480
|
}) : null,
|
|
410
481
|
/* @__PURE__ */ jsxs("div", {
|
|
411
482
|
"data-fs-billing-address-toggle-field": "",
|
|
@@ -418,10 +489,10 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
418
489
|
disabled: fieldsDisabled,
|
|
419
490
|
"aria-controls": panelId,
|
|
420
491
|
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(Icon, { name: "checked" }) })
|
|
421
|
-
}), sameAsDeliveryLabel] })
|
|
492
|
+
}), format("sameAsDeliveryLabel")] })
|
|
422
493
|
}), billingAddressRequired ? /* @__PURE__ */ jsx("p", {
|
|
423
494
|
"data-fs-billing-address-required-note": "",
|
|
424
|
-
children: requiredNoticeLabel
|
|
495
|
+
children: format("requiredNoticeLabel")
|
|
425
496
|
}) : null]
|
|
426
497
|
}),
|
|
427
498
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -434,19 +505,19 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
434
505
|
unsavedAddressNoticeVisible ? /* @__PURE__ */ jsx("p", {
|
|
435
506
|
role: "status",
|
|
436
507
|
"data-fs-billing-address-unsaved-notice": "",
|
|
437
|
-
children: unsavedAddressNoticeLabel
|
|
508
|
+
children: format("unsavedAddressNoticeLabel")
|
|
438
509
|
}) : null,
|
|
439
510
|
/* @__PURE__ */ jsxs(Field.Root, {
|
|
440
511
|
disabled: fieldsDisabled,
|
|
441
512
|
"data-fs-field-root": "",
|
|
442
513
|
"data-fs-billing-address-field": "country",
|
|
443
|
-
children: [/* @__PURE__ */ jsx(Field.Label, { children: countryLabel }), /* @__PURE__ */ jsxs(Select.Root, {
|
|
514
|
+
children: [/* @__PURE__ */ jsx(Field.Label, { children: format("countryLabel") }), /* @__PURE__ */ jsxs(Select.Root, {
|
|
444
515
|
value: formDraft.country,
|
|
445
516
|
onValueChange: handleCountryChange,
|
|
446
517
|
disabled: fieldsDisabled,
|
|
447
518
|
required: true,
|
|
448
|
-
children: [/* @__PURE__ */ jsxs(Select.Trigger, { children: [/* @__PURE__ */ jsx(Select.Value, { children: (value) => value ?
|
|
449
|
-
const label =
|
|
519
|
+
children: [/* @__PURE__ */ jsxs(Select.Trigger, { children: [/* @__PURE__ */ jsx(Select.Value, { children: (value) => value ? countryName(value) : value }), /* @__PURE__ */ jsx(Select.Icon, { children: "▾" })] }), /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, { children: /* @__PURE__ */ jsx(Select.Popup, { children: /* @__PURE__ */ jsx(Select.List, { children: getAvailableCountries().map((iso) => {
|
|
520
|
+
const label = countryName(iso);
|
|
450
521
|
return /* @__PURE__ */ jsx(Select.Item, {
|
|
451
522
|
value: iso,
|
|
452
523
|
label,
|
|
@@ -464,7 +535,7 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
464
535
|
"data-fs-field-root": "",
|
|
465
536
|
"data-fs-billing-address-field": field.name,
|
|
466
537
|
children: [
|
|
467
|
-
/* @__PURE__ */ jsx(Field.Label, { children:
|
|
538
|
+
/* @__PURE__ */ jsx(Field.Label, { children: fieldLabel(field.name) }),
|
|
468
539
|
/* @__PURE__ */ jsx(Field.Control, {
|
|
469
540
|
value: formDraft[field.name] ?? "",
|
|
470
541
|
onChange: (event) => handleFieldChange(field.name, event.currentTarget.value),
|
|
@@ -474,7 +545,7 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
474
545
|
}),
|
|
475
546
|
invalid ? /* @__PURE__ */ jsx(Field.Error, {
|
|
476
547
|
match: true,
|
|
477
|
-
children: issue === "format" ? getFieldFormatMessage(field,
|
|
548
|
+
children: issue === "format" ? getFieldFormatMessage(field, format("postalCodeInvalidMessage")) : format("fieldRequiredMessage")
|
|
478
549
|
}) : null
|
|
479
550
|
]
|
|
480
551
|
}, field.name);
|
|
@@ -484,7 +555,7 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
484
555
|
onClick: handleSubmit,
|
|
485
556
|
disabled: fieldsDisabled || !canSaveBillingDraft(draftDescriptor, renderableFields, formDraft),
|
|
486
557
|
"data-fs-billing-address-submit": "",
|
|
487
|
-
children: pending ? submitPendingLabel : submitLabel
|
|
558
|
+
children: format(pending ? "submitPendingLabel" : "submitLabel")
|
|
488
559
|
})
|
|
489
560
|
]
|
|
490
561
|
})
|
|
@@ -492,12 +563,12 @@ function BillingAddress({ sameAsDeliveryLabel = "Billing address same as deliver
|
|
|
492
563
|
error ? /* @__PURE__ */ jsx("div", {
|
|
493
564
|
role: "alert",
|
|
494
565
|
"data-fs-billing-address-error": "",
|
|
495
|
-
children: error
|
|
566
|
+
children: formatErrorCode(BillingAddressContent, BILLING_ADDRESS_ERROR_FIELDS, error, format, "genericErrorMessage")
|
|
496
567
|
}) : null
|
|
497
568
|
]
|
|
498
569
|
});
|
|
499
570
|
}
|
|
500
571
|
//#endregion
|
|
501
|
-
export { BillingAddress, BillingAddressDefinition, getFieldFormatMessage, isBillingAddressFormValid, resolveSameAsDelivery };
|
|
572
|
+
export { BILLING_ADDRESS_ERROR_FIELDS, BillingAddress, BillingAddressContent, BillingAddressDefinition, getFieldFormatMessage, isBillingAddressFormValid, resolveSameAsDelivery };
|
|
502
573
|
|
|
503
574
|
//# sourceMappingURL=billing-address.js.map
|