@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-address-book.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-book.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n type ComponentPropsWithRef,\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n AddressSummary,\n AddressSummaryCountry,\n AddressSummaryField,\n AddressSummaryRecipient,\n AddressSummaryRoot,\n} from '../../particles/address-summary/address-summary.js';\nimport { Button } from '../../particles/button/button.js';\nimport { countryDisplayName } from '../../sdk/address/country-display.js';\nimport { formatAddress } from '../../sdk/address/format-address.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ListItemRefContext } from '../../sdk/data/list-item-ref-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { useSession } from '../session/session.js';\n\n/**\n * The shopper's saved addresses, listed (specs/sfs-3440-address-book-list.md, RFC REQ-01). One family\n * split by data-fetch role, in the pattern `SavedCards` and `CartRoot` use:\n *\n * - `AccountAddressBookRoot` reads the book once through the page's reactive query, owns the four\n * states, and gates on a signed-in session.\n * - `AccountAddressBookList` fans the addresses out by entity ref, one `li` per address.\n * - `AccountAddressBookItem` subscribes to its own `CustomerAddress` entity (`reactive-list-item`) and\n * bridges it onto the generic `AddressSummary` particle.\n * - `Loading`, `Empty` and `Error` are composed parts, so a store chooses where each sits.\n *\n * Every rule the components apply lives in `sdk/address/`: line order is `formatAddress`'s and the\n * country name is `countryDisplayName`'s. The components only compose them.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL fragments — raw template literals, as `saved-cards.tsx` does: the codegen `documents` glob\n// does not scan `src/matter/account-address-book*`. Both drill `customerAddressBook` and merge at\n// compile time (ADR-0011/ADR-0012); `data-component-contract.test.ts` validates each against the real\n// schema. The book is an object with an `id` rather than a bare list under `Query`, which is the\n// shape the compiler can deliver per item.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment AccountAddressBookRootData on Query {\n customerAddressBook {\n __typename\n id\n addresses {\n __typename\n id\n }\n }\n }\n`;\n\nconst itemFragment = /* GraphQL */ `\n fragment AccountAddressBookItemData on Query {\n customerAddressBook {\n addresses {\n __typename\n id\n country\n recipientName\n street\n number\n complement\n neighborhood\n city\n state\n postalCode\n reference\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** The minimal per-address identifiers the root needs to iterate. */\nexport type AccountAddressBookRootSlice = Readonly<{\n __typename?: 'CustomerAddressBook';\n id: string;\n addresses: readonly Readonly<{ __typename?: 'CustomerAddress'; id: string }>[];\n}>;\n\n/** The full per-address slice `AccountAddressBookItem` resolves on its own. */\nexport type AccountAddressBookItemSlice = Readonly<{\n __typename?: 'CustomerAddress';\n id: string;\n country?: string | null;\n recipientName?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n reference?: string | null;\n}>;\n\n/**\n * Where the book is. `null` is the frame before anything resolved, loaded, or failed: it shows\n * nothing, so no state is ever claimed that the data has not earned.\n */\nexport type AccountAddressBookState = 'loading' | 'error' | 'empty' | 'ready';\n\n/** The form the book has open. `address` is the item's raw slice, so the form can seed itself from it. */\nexport type AccountAddressBookOpenForm =\n | Readonly<{ mode: 'add' }>\n | Readonly<{ mode: 'edit'; address: AccountAddressBookItemSlice }>;\n\n/** The address a delete confirmation is open for. `null` when none is. */\nexport type AccountAddressBookPendingDelete = AccountAddressBookItemSlice | null;\n\nexport type AccountAddressBookContextValue = Readonly<{\n book: AccountAddressBookRootSlice | null;\n state: AccountAddressBookState | null;\n openForm: AccountAddressBookOpenForm | null;\n /** Opens a form, replacing any open one. `opener` is where focus returns when the form closes. */\n open: (form: AccountAddressBookOpenForm, opener: HTMLElement | null) => void;\n close: () => void;\n /** True while the open form has a save in flight. The dialog stays open until it settles. */\n formPending: boolean;\n /** Reported by the open form as its save starts and settles. */\n setFormPending: (pending: boolean) => void;\n /** The address waiting for the shopper's answer to a delete confirmation, or `null`. */\n pendingDelete: AccountAddressBookPendingDelete;\n /** Asks for a confirmation. `opener` is where focus returns when it is declined. */\n requestDelete: (address: AccountAddressBookItemSlice, opener: HTMLElement | null) => void;\n endDelete: () => void;\n /** True from an in-place retry until the book resolves. The error part stays mounted meanwhile. */\n retrying: boolean;\n /** Loads the book again: in place through the page root's `refetch`, else by reloading the page. */\n retry: () => void;\n}>;\n\nexport type AccountAddressBookRootProps = ComponentPropsWithRef<'div'> & {\n /** Unwrapped `customerAddressBook` from the reactive runtime (arity-1 fragment); `null` until resolved. */\n $data?: AccountAddressBookRootSlice | null;\n};\n\nexport type AccountAddressBookListProps = ComponentPropsWithRef<'ul'>;\n\nexport type AccountAddressBookItemProps = ComponentPropsWithRef<'div'> & {\n /** Per-address slice from the reactive-list-item runtime; passed directly in tests. */\n $data?: AccountAddressBookItemSlice | null;\n};\n\nexport type AccountAddressBookItemLinesProps = Readonly<{ className?: string }>;\n\nexport type AccountAddressBookLoadingProps = ComponentPropsWithRef<'output'> & {\n /** Announced while the book loads. A blank value falls back to the catalog copy. */\n message?: string;\n};\n\nexport type AccountAddressBookEmptyProps = ComponentPropsWithRef<'p'> & {\n /** Shown once the book resolved to zero addresses. A blank value falls back to the catalog copy. */\n message?: string;\n};\n\nexport type AccountAddressBookErrorProps = ComponentPropsWithRef<'div'> & {\n /** Shown when the read failed. A blank value falls back to the catalog copy. */\n message?: string;\n /** The retry control's label. A blank value falls back to the catalog copy. */\n retryLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Contexts\n// ---------------------------------------------------------------------------\n\nconst AccountAddressBookContext = createContext<AccountAddressBookContextValue | null>(null);\n\n/** The resolved book and its state, for any part composed under `AccountAddressBookRoot`. */\nexport function useAccountAddressBook(): AccountAddressBookContextValue {\n const value = useContext(AccountAddressBookContext);\n if (!value) {\n throw new Error('Address book parts must be used inside an AccountAddressBookRoot.');\n }\n return value;\n}\n\n/** The book's context, or `null` outside a root: the form also stands alone, in add mode. */\nexport function useOptionalAccountAddressBook(): AccountAddressBookContextValue | null {\n return useContext(AccountAddressBookContext);\n}\n\nconst AccountAddressBookItemContext = createContext<AccountAddressBookItemSlice | null>(null);\n\n/**\n * The raw address an entry renders, with its alpha-3 `country`. Delete, edit and the deliverability\n * marker read this rather than the summary, whose country is already a display name.\n */\nexport function useAccountAddressBookItem(): AccountAddressBookItemSlice {\n const value = useContext(AccountAddressBookItemContext);\n if (!value) {\n throw new Error('Address book entry parts must be used inside an AccountAddressBookItem.');\n }\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/**\n * Each state gates on the resolved book, never on `loading` alone: `loading` is false on the first\n * client frame before the seed effect runs, and the book is null both while loading and after a\n * failure. So empty needs a book that resolved to zero addresses, and error needs no book and a\n * settled read that reported one.\n */\nfunction resolveState({\n book,\n loading,\n error,\n}: {\n book: AccountAddressBookRootSlice | null;\n loading: boolean;\n error: unknown;\n}): AccountAddressBookState | null {\n if (book != null) return book.addresses.length === 0 ? 'empty' : 'ready';\n if (loading) return 'loading';\n return error ? 'error' : null;\n}\n\nconst BOOK_SELECTOR = '[data-fs-account-address-book]';\n\n/**\n * Where focus goes once an overlay the book opened has closed: back to the control that opened it,\n * and, when a save or a removal took that control out of the document, to the book itself rather\n * than the page's top. `active` is true while the overlay is open; `remember` runs as it opens.\n */\nfunction useFocusReturn(active: boolean): (opener: HTMLElement | null) => void {\n const target = useRef<{ opener: HTMLElement | null; root: HTMLElement | null } | null>(null);\n\n const remember = useCallback((opener: HTMLElement | null) => {\n target.current = { opener, root: opener?.closest<HTMLElement>(BOOK_SELECTOR) ?? null };\n }, []);\n\n useEffect(() => {\n if (active) return;\n const current = target.current;\n target.current = null;\n if (!current) return;\n const { opener, root } = current;\n (opener?.isConnected ? opener : root)?.focus();\n }, [active]);\n\n return remember;\n}\n\n/**\n * The retry loads the book again in place through the page root's `refetch`. A root with none falls\n * back to reloading the page: the read changes nothing, so that is safe, and the page re-runs its\n * query.\n */\nfunction reloadPage() {\n globalThis.location.reload();\n}\n\n/**\n * A retry keeps the error part, and so its button, mounted while the book loads: focus stays on the\n * button, and the same button is offered again if the read fails again. `retrying` lasts as long as\n * the retry's own `refetch`, so a later load from another trigger is never read as this retry.\n * Once the book resolves, the list or the empty message replaces the button, so focus moves to the\n * book, but only when focus was inside the book at the retry and has fallen to the page's top since.\n * A failed read drops that mark.\n */\nfunction useRetry(refetch: (() => Promise<void>) | undefined, state: AccountAddressBookState | null) {\n const [retrying, setRetrying] = useState(false);\n const focusRoot = useRef<HTMLElement | null>(null);\n\n const retry = useCallback(() => {\n if (!refetch) {\n reloadPage();\n return;\n }\n const { activeElement } = document;\n focusRoot.current = activeElement instanceof HTMLElement ? activeElement.closest<HTMLElement>(BOOK_SELECTOR) : null;\n setRetrying(true);\n refetch()\n .catch(() => {\n // A provider's own `refetch` may reject. The book's error state already shows the failure.\n })\n .finally(() => setRetrying(false));\n }, [refetch]);\n\n useEffect(() => {\n if (state === 'error') {\n focusRoot.current = null;\n return;\n }\n if (state !== 'ready' && state !== 'empty') return;\n const root = focusRoot.current;\n focusRoot.current = null;\n const { activeElement } = document;\n if (root && (!activeElement || activeElement === document.body)) root.focus();\n }, [state]);\n\n return { retrying, retry };\n}\n\nexport function AccountAddressBookRoot({\n $data: $dataProp,\n className,\n children,\n ...props\n}: AccountAddressBookRootProps) {\n const $data = useDataOverride<AccountAddressBookRootSlice | null | undefined>($dataProp);\n const book = $data ?? null;\n const { loading, error, refetch } = useContext(ReactiveRootContext);\n const { state: sessionState } = useSession();\n const state = resolveState({ book, loading, error });\n const [openForm, setOpenForm] = useState<AccountAddressBookOpenForm | null>(null);\n const [formPending, setFormPending] = useState(false);\n const [pendingDelete, setPendingDelete] = useState<AccountAddressBookPendingDelete>(null);\n const rememberFormOpener = useFocusReturn(openForm !== null);\n const rememberDeleteOpener = useFocusReturn(pendingDelete !== null);\n const { retrying, retry } = useRetry(refetch, state);\n\n const open = useCallback(\n (form: AccountAddressBookOpenForm, opener: HTMLElement | null) => {\n rememberFormOpener(opener);\n setOpenForm(form);\n },\n [rememberFormOpener],\n );\n const close = useCallback(() => setOpenForm(null), []);\n\n const requestDelete = useCallback(\n (address: AccountAddressBookItemSlice, opener: HTMLElement | null) => {\n rememberDeleteOpener(opener);\n setPendingDelete(address);\n },\n [rememberDeleteOpener],\n );\n const endDelete = useCallback(() => setPendingDelete(null), []);\n\n const value = useMemo(\n () => ({\n book,\n state,\n openForm,\n open,\n close,\n formPending,\n setFormPending,\n pendingDelete,\n requestDelete,\n endDelete,\n retrying,\n retry,\n }),\n [book, state, openForm, open, close, formPending, pendingDelete, requestDelete, endDelete, retrying, retry],\n );\n\n if (sessionState !== 'loggedIn') return null;\n\n return (\n <AccountAddressBookContext value={value}>\n <div\n tabIndex={-1}\n {...props}\n className={className}\n data-fs-account-address-book=\"\"\n {...(state ? { 'data-fs-account-address-book-state': state } : {})}\n >\n {children}\n </div>\n </AccountAddressBookContext>\n );\n}\n\nexport function AccountAddressBookList({ className, children, ...props }: AccountAddressBookListProps) {\n const { book } = useAccountAddressBook();\n const addresses = book?.addresses ?? [];\n\n if (addresses.length === 0) return null;\n\n return (\n <ul {...props} className={className} data-fs-account-address-book-list=\"\">\n {addresses.map(({ id }) => (\n <li key={id} data-fs-account-address-book-list-item=\"\">\n <ListItemRefContext\n // No fallback slice: the root's fragment selects only `{ id }`, so there is no complete\n // row to fall back to. An incomplete cache slice renders nothing until it resolves.\n value={{ __typename: 'CustomerAddress', id, fallbackData: undefined }}\n >\n {children}\n </ListItemRefContext>\n </li>\n ))}\n </ul>\n );\n}\n\nexport function AccountAddressBookItem({\n $data: $dataProp,\n className,\n children,\n ...props\n}: AccountAddressBookItemProps) {\n // Delivery-agnostic: the slice arrives through the DataOverrideContext seam the reactive-list-item\n // wrapper publishes (or via $data in tests); this component calls no data hook of its own.\n const slice = useDataOverride<AccountAddressBookItemSlice | null | undefined>($dataProp) ?? null;\n const { displayName } = useStorefrontFormatters();\n\n if (!slice) return null;\n\n // The summary shows a name, the raw slice keeps the code, and an address carries no name of its own.\n const summary = {\n recipientName: slice.recipientName,\n street: slice.street,\n number: slice.number,\n complement: slice.complement,\n neighborhood: slice.neighborhood,\n city: slice.city,\n state: slice.state,\n postalCode: slice.postalCode,\n reference: slice.reference,\n country: countryDisplayName(slice.country, displayName),\n };\n\n return (\n <AccountAddressBookItemContext value={slice}>\n <AddressSummaryRoot address={summary}>\n <div {...props} className={className} data-fs-account-address-book-item=\"\">\n {children ?? (\n <AddressSummary>\n <AddressSummaryRecipient />\n <AccountAddressBookItemLines />\n <AddressSummaryCountry />\n </AddressSummary>\n )}\n </div>\n </AddressSummaryRoot>\n </AccountAddressBookItemContext>\n );\n}\n\n/** One `p` per line the address's country prints, each field in that country's order. */\nexport function AccountAddressBookItemLines({ className }: AccountAddressBookItemLinesProps) {\n const address = useAccountAddressBookItem();\n\n return (\n <>\n {formatAddress(address, address.country ?? '').map((line) => (\n <p key={line.map(({ field }) => field).join()} className={className} data-fs-account-address-book-line=\"\">\n {line.map(({ field, separator }) => (\n <Fragment key={field}>\n {separator}\n <AddressSummaryField field={field} />\n </Fragment>\n ))}\n </p>\n ))}\n </>\n );\n}\n\n/**\n * The polite live region stays mounted whether or not the book is loading, so the message is\n * announced when it lands (the region has to exist before its text does).\n */\nexport function AccountAddressBookLoading({ message, className, children, ...props }: AccountAddressBookLoadingProps) {\n const { state } = useAccountAddressBook();\n const intl = useIntl();\n\n return (\n <output {...props} aria-live=\"polite\" className={className} data-fs-account-address-book-loading=\"\">\n {state === 'loading' ? (\n <>\n {children ?? <AccountAddressBookSkeleton />}\n <span data-fs-account-address-book-loading-message=\"\" data-fs-sr-only=\"\" className=\"sr-only\">\n {resolveAuthoredCopy(message, intl.formatMessage({ id: 'fs/address-book.loading' }))}\n </span>\n </>\n ) : null}\n </output>\n );\n}\n\nexport function AccountAddressBookEmpty({ message, className, ...props }: AccountAddressBookEmptyProps) {\n const { state } = useAccountAddressBook();\n const intl = useIntl();\n\n if (state !== 'empty') return null;\n\n return (\n <p {...props} className={className} data-fs-account-address-book-empty=\"\">\n {resolveAuthoredCopy(message, intl.formatMessage({ id: 'fs/address-book.empty' }))}\n </p>\n );\n}\n\nexport function AccountAddressBookError({ message, retryLabel, className, ...props }: AccountAddressBookErrorProps) {\n const { state, retrying, retry } = useAccountAddressBook();\n const intl = useIntl();\n const busy = retrying && state === 'loading';\n\n if (state !== 'error' && !busy) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-account-address-book-error=\"\">\n <p data-fs-account-address-book-error-message=\"\">\n {resolveAuthoredCopy(message, intl.formatMessage({ id: 'fs/address-book.error' }))}\n </p>\n {/* `aria-disabled`, not `disabled`: a disabled button loses focus, and the shopper's is on it. */}\n <Button\n type=\"button\"\n onClick={busy ? undefined : retry}\n aria-disabled={busy || undefined}\n aria-busy={busy || undefined}\n data-fs-account-address-book-retry=\"\"\n >\n {resolveAuthoredCopy(retryLabel, intl.formatMessage({ id: 'fs/address-book.retry' }))}\n </Button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton — no context: `AccountAddressBookLoading` renders it before the root has anything to\n// provide, and the definitions reference it for the lint rule that asks every fetching component\n// for one. The compiler does not render it on the reactive path.\n// ---------------------------------------------------------------------------\n\nexport function AccountAddressBookSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} aria-hidden=\"true\" data-fs-account-address-book-skeleton=\"\">\n <span data-fs-account-address-book-skeleton-line=\"\" />\n <span data-fs-account-address-book-skeleton-line=\"\" />\n <span data-fs-account-address-book-skeleton-line=\"\" />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountAddressBookRootDefinition = defineComponent<AccountAddressBookRootProps>({\n name: 'AccountAddressBookRoot',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookRoot,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'session',\n providesContext: 'account-address-book',\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Account Address Book', category: 'identity' },\n schema: {},\n guideline:\n \"Root of the signed-in shopper's saved addresses: reads the address book once and owns its four states (loading, error, empty, ready), exposed as data-fs-account-address-book-state. Renders nothing unless the session is logged in, so it needs a SessionRoot ancestor. Compose AccountAddressBookLoading, AccountAddressBookError, AccountAddressBookEmpty and an AccountAddressBookList holding one AccountAddressBookItem, in any order. Reading the book starts no cart. See account-address-book.md.\",\n});\n\nexport const AccountAddressBookListDefinition = defineComponent<AccountAddressBookListProps>({\n name: 'AccountAddressBookList',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookList,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book List', category: 'content' },\n schema: {},\n guideline:\n 'The saved addresses as a list, one entry per address in the order the book returns them. Place one AccountAddressBookItem inside as the per-address template; it is repeated once per address. Renders nothing until the book has at least one address. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookItemDefinition = defineComponent<AccountAddressBookItemProps>({\n name: 'AccountAddressBookItem',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookItem,\n fragment: itemFragment,\n fetchStrategy: 'reactive-list-item',\n requiresContext: 'account-address-book',\n providesContext: ['account-address-book-item', 'address-summary'],\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Account Address Book Item', category: 'content' },\n schema: {},\n guideline:\n \"One saved address, written the way its country writes it, with the recipient first and the country's name last. With no children it renders that default entry; give it children to compose the entry yourself, using the AddressSummary parts and AccountAddressBookItemLines. Provides the address-summary contract and the raw address for triggers placed inside it. Must be inside AccountAddressBookList.\",\n});\n\nexport const AccountAddressBookItemLinesDefinition = defineComponent<AccountAddressBookItemLinesProps>({\n name: 'AccountAddressBookItemLines',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookItemLines,\n requiresContext: 'account-address-book-item',\n editor: { label: 'Account Address Book Item Lines', category: 'content' },\n schema: {},\n guideline:\n \"The address's lines in its country's order, one paragraph per line with each field in sequence and its separator (a United States address reads number before street). A field the address lacks is dropped along with its separator. Must be inside AccountAddressBookItem.\",\n});\n\nexport const AccountAddressBookLoadingDefinition = defineComponent<AccountAddressBookLoadingProps>({\n name: 'AccountAddressBookLoading',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookLoading,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Loading', category: 'content' },\n schema: {\n message: { type: 'string', label: 'Loading message' },\n },\n guideline:\n 'Shown only while the book is loading and has not resolved: a placeholder plus a loading message. The wrapper is a polite live region that stays mounted, and the message is visually hidden so it is heard and not seen. Pass children to replace the default placeholder. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookEmptyDefinition = defineComponent<AccountAddressBookEmptyProps>({\n name: 'AccountAddressBookEmpty',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookEmpty,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Empty', category: 'content' },\n schema: {\n message: { type: 'string', label: 'Empty message' },\n },\n guideline:\n 'Shown only once the book has resolved to zero addresses, never while it loads or after it fails, so it never invites the shopper to add an address they already have. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookErrorDefinition = defineComponent<AccountAddressBookErrorProps>({\n name: 'AccountAddressBookError',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookError,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Error', category: 'content' },\n schema: {\n message: { type: 'string', label: 'Error message' },\n retryLabel: { type: 'string', label: 'Retry label' },\n },\n guideline:\n 'Shown when the book failed to load, as an alert with a retry control that loads the book again in place. Stays, with its retry disabled, while that retry loads. Never shown for a first load or an empty book. Must be inside AccountAddressBookRoot.',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAM,WAAyB;;;;;;;;;;;;AAa/B,MAAM,eAA6B;;;;;;;;;;;;;;;;;;;;AAuHnC,MAAM,4BAA4B,cAAqD,IAAI;;AAG3F,SAAgB,wBAAwD;CACtE,MAAM,QAAQ,WAAW,yBAAyB;CAClD,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO;AACT;;AAGA,SAAgB,gCAAuE;CACrF,OAAO,WAAW,yBAAyB;AAC7C;AAEA,MAAM,gCAAgC,cAAkD,IAAI;;;;;AAM5F,SAAgB,4BAAyD;CACvE,MAAM,QAAQ,WAAW,6BAA6B;CACtD,IAA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CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA6B,UAAU;CAAU;CAClE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,mCAAmC,gBAA6C;CAC3F,MAAM;CACN,YAAY;CACZ,WAAW;CACX,UAAU;CACV,eAAe;CACf,iBAAiB;CACjB,iBAAiB,CAAC,6BAA6B,iBAAiB;CAChE,UAAU;CACV,QAAQ;EAAE,OAAO;EAA6B,UAAU;CAAU;CAClE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,wCAAwC,gBAAkD;CACrG,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAmC,UAAU;CAAU;CACxE,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,sCAAsC,gBAAgD;CACjG,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAgC,UAAU;CAAU;CACrE,QAAQ,EACN,SAAS;EAAE,MAAM;EAAU,OAAO;CAAkB,EACtD;CACA,WACE;AACJ,CAAC;AAED,MAAa,oCAAoC,gBAA8C;CAC7F,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAU;CACnE,QAAQ,EACN,SAAS;EAAE,MAAM;EAAU,OAAO;CAAgB,EACpD;CACA,WACE;AACJ,CAAC;AAED,MAAa,oCAAoC,gBAA8C;CAC7F,MAAM;CACN,YAAY;CACZ,WAAW;CACX,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAA8B,UAAU;CAAU;CACnE,QAAQ;EACN,SAAS;GAAE,MAAM;GAAU,OAAO;EAAgB;EAClD,YAAY;GAAE,MAAM;GAAU,OAAO;EAAc;CACrD;CACA,WACE;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"account-address-book.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-book.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport {\n type ComponentPropsWithRef,\n createContext,\n Fragment,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n AddressSummary,\n AddressSummaryCountry,\n AddressSummaryField,\n AddressSummaryRecipient,\n AddressSummaryRoot,\n} from '../../particles/address-summary/address-summary.js';\nimport { Button } from '../../particles/button/button.js';\nimport { countryDisplayName } from '../../sdk/address/country-display.js';\nimport { formatAddress } from '../../sdk/address/format-address.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ListItemRefContext } from '../../sdk/data/list-item-ref-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { useSession } from '../session/session.js';\n\n/**\n * The shopper's saved addresses, listed (specs/sfs-3440-address-book-list.md, RFC REQ-01). One family\n * split by data-fetch role, in the pattern `SavedCards` and `CartRoot` use:\n *\n * - `AccountAddressBookRoot` reads the book once through the page's reactive query, owns the four\n * states, and gates on a signed-in session.\n * - `AccountAddressBookList` fans the addresses out by entity ref, one `li` per address.\n * - `AccountAddressBookItem` subscribes to its own `CustomerAddress` entity (`reactive-list-item`) and\n * bridges it onto the generic `AddressSummary` particle.\n * - `Loading`, `Empty` and `Error` are composed parts, so a store chooses where each sits.\n *\n * Every rule the components apply lives in `sdk/address/`: line order is `formatAddress`'s and the\n * country name is `countryDisplayName`'s. The components only compose them.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL fragments — raw template literals, as `saved-cards.tsx` does: the codegen `documents` glob\n// does not scan `src/matter/account-address-book*`. Both drill `customerAddressBook` and merge at\n// compile time (ADR-0011/ADR-0012); `data-component-contract.test.ts` validates each against the real\n// schema. The book is an object with an `id` rather than a bare list under `Query`, which is the\n// shape the compiler can deliver per item.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment AccountAddressBookRootData on Query {\n customerAddressBook {\n __typename\n id\n addresses {\n __typename\n id\n }\n }\n }\n`;\n\nconst itemFragment = /* GraphQL */ `\n fragment AccountAddressBookItemData on Query {\n customerAddressBook {\n addresses {\n __typename\n id\n country\n recipientName\n street\n number\n complement\n neighborhood\n city\n state\n postalCode\n reference\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** The minimal per-address identifiers the root needs to iterate. */\nexport type AccountAddressBookRootSlice = Readonly<{\n __typename?: 'CustomerAddressBook';\n id: string;\n addresses: readonly Readonly<{ __typename?: 'CustomerAddress'; id: string }>[];\n}>;\n\n/** The full per-address slice `AccountAddressBookItem` resolves on its own. */\nexport type AccountAddressBookItemSlice = Readonly<{\n __typename?: 'CustomerAddress';\n id: string;\n country?: string | null;\n recipientName?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n reference?: string | null;\n}>;\n\n/**\n * Where the book is. `null` is the frame before anything resolved, loaded, or failed: it shows\n * nothing, so no state is ever claimed that the data has not earned.\n */\nexport type AccountAddressBookState = 'loading' | 'error' | 'empty' | 'ready';\n\n/** The form the book has open. `address` is the item's raw slice, so the form can seed itself from it. */\nexport type AccountAddressBookOpenForm =\n | Readonly<{ mode: 'add' }>\n | Readonly<{ mode: 'edit'; address: AccountAddressBookItemSlice }>;\n\n/** The address a delete confirmation is open for. `null` when none is. */\nexport type AccountAddressBookPendingDelete = AccountAddressBookItemSlice | null;\n\nexport type AccountAddressBookContextValue = Readonly<{\n book: AccountAddressBookRootSlice | null;\n state: AccountAddressBookState | null;\n openForm: AccountAddressBookOpenForm | null;\n /** Opens a form, replacing any open one. `opener` is where focus returns when the form closes. */\n open: (form: AccountAddressBookOpenForm, opener: HTMLElement | null) => void;\n close: () => void;\n /** True while the open form has a save in flight. The dialog stays open until it settles. */\n formPending: boolean;\n /** Reported by the open form as its save starts and settles. */\n setFormPending: (pending: boolean) => void;\n /** The address waiting for the shopper's answer to a delete confirmation, or `null`. */\n pendingDelete: AccountAddressBookPendingDelete;\n /** Asks for a confirmation. `opener` is where focus returns when it is declined. */\n requestDelete: (address: AccountAddressBookItemSlice, opener: HTMLElement | null) => void;\n endDelete: () => void;\n /** True from an in-place retry until the book resolves. The error part stays mounted meanwhile. */\n retrying: boolean;\n /** Loads the book again: in place through the page root's `refetch`, else by reloading the page. */\n retry: () => void;\n}>;\n\nexport type AccountAddressBookRootProps = ComponentPropsWithRef<'div'> & {\n /** Unwrapped `customerAddressBook` from the reactive runtime (arity-1 fragment); `null` until resolved. */\n $data?: AccountAddressBookRootSlice | null;\n};\n\nexport type AccountAddressBookListProps = ComponentPropsWithRef<'ul'>;\n\nexport type AccountAddressBookItemProps = ComponentPropsWithRef<'div'> & {\n /** Per-address slice from the reactive-list-item runtime; passed directly in tests. */\n $data?: AccountAddressBookItemSlice | null;\n};\n\nexport type AccountAddressBookItemLinesProps = Readonly<{ className?: string }>;\n\nexport type AccountAddressBookLoadingProps = ComponentPropsWithRef<'output'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof AccountAddressBookLoadingContent>;\n };\n\nexport type AccountAddressBookEmptyProps = ComponentPropsWithRef<'p'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof AccountAddressBookEmptyContent>;\n };\n\nexport type AccountAddressBookErrorProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof AccountAddressBookErrorContent>;\n };\n\n// ---------------------------------------------------------------------------\n// Contexts\n// ---------------------------------------------------------------------------\n\nconst AccountAddressBookContext = createContext<AccountAddressBookContextValue | null>(null);\n\n/** The resolved book and its state, for any part composed under `AccountAddressBookRoot`. */\nexport function useAccountAddressBook(): AccountAddressBookContextValue {\n const value = useContext(AccountAddressBookContext);\n if (!value) {\n throw new Error('Address book parts must be used inside an AccountAddressBookRoot.');\n }\n return value;\n}\n\n/** The book's context, or `null` outside a root: the form also stands alone, in add mode. */\nexport function useOptionalAccountAddressBook(): AccountAddressBookContextValue | null {\n return useContext(AccountAddressBookContext);\n}\n\nconst AccountAddressBookItemContext = createContext<AccountAddressBookItemSlice | null>(null);\n\n/**\n * The raw address an entry renders, with its alpha-3 `country`. Delete, edit and the deliverability\n * marker read this rather than the summary, whose country is already a display name.\n */\nexport function useAccountAddressBookItem(): AccountAddressBookItemSlice {\n const value = useContext(AccountAddressBookItemContext);\n if (!value) {\n throw new Error('Address book entry parts must be used inside an AccountAddressBookItem.');\n }\n return value;\n}\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/**\n * Each state gates on the resolved book, never on `loading` alone: `loading` is false on the first\n * client frame before the seed effect runs, and the book is null both while loading and after a\n * failure. So empty needs a book that resolved to zero addresses, and error needs no book and a\n * settled read that reported one.\n */\nfunction resolveState({\n book,\n loading,\n error,\n}: {\n book: AccountAddressBookRootSlice | null;\n loading: boolean;\n error: unknown;\n}): AccountAddressBookState | null {\n if (book != null) return book.addresses.length === 0 ? 'empty' : 'ready';\n if (loading) return 'loading';\n return error ? 'error' : null;\n}\n\nconst BOOK_SELECTOR = '[data-fs-account-address-book]';\n\n/**\n * Where focus goes once an overlay the book opened has closed: back to the control that opened it,\n * and, when a save or a removal took that control out of the document, to the book itself rather\n * than the page's top. `active` is true while the overlay is open; `remember` runs as it opens.\n */\nfunction useFocusReturn(active: boolean): (opener: HTMLElement | null) => void {\n const target = useRef<{ opener: HTMLElement | null; root: HTMLElement | null } | null>(null);\n\n const remember = useCallback((opener: HTMLElement | null) => {\n target.current = { opener, root: opener?.closest<HTMLElement>(BOOK_SELECTOR) ?? null };\n }, []);\n\n useEffect(() => {\n if (active) return;\n const current = target.current;\n target.current = null;\n if (!current) return;\n const { opener, root } = current;\n (opener?.isConnected ? opener : root)?.focus();\n }, [active]);\n\n return remember;\n}\n\n/**\n * The retry loads the book again in place through the page root's `refetch`. A root with none falls\n * back to reloading the page: the read changes nothing, so that is safe, and the page re-runs its\n * query.\n */\nfunction reloadPage() {\n globalThis.location.reload();\n}\n\n/**\n * A retry keeps the error part, and so its button, mounted while the book loads: focus stays on the\n * button, and the same button is offered again if the read fails again. `retrying` lasts as long as\n * the retry's own `refetch`, so a later load from another trigger is never read as this retry.\n * Once the book resolves, the list or the empty message replaces the button, so focus moves to the\n * book, but only when focus was inside the book at the retry and has fallen to the page's top since.\n * A failed read drops that mark.\n */\nfunction useRetry(refetch: (() => Promise<void>) | undefined, state: AccountAddressBookState | null) {\n const [retrying, setRetrying] = useState(false);\n const focusRoot = useRef<HTMLElement | null>(null);\n\n const retry = useCallback(() => {\n if (!refetch) {\n reloadPage();\n return;\n }\n const { activeElement } = document;\n focusRoot.current = activeElement instanceof HTMLElement ? activeElement.closest<HTMLElement>(BOOK_SELECTOR) : null;\n setRetrying(true);\n refetch()\n .catch(() => {\n // A provider's own `refetch` may reject. The book's error state already shows the failure.\n })\n .finally(() => setRetrying(false));\n }, [refetch]);\n\n useEffect(() => {\n if (state === 'error') {\n focusRoot.current = null;\n return;\n }\n if (state !== 'ready' && state !== 'empty') return;\n const root = focusRoot.current;\n focusRoot.current = null;\n const { activeElement } = document;\n if (root && (!activeElement || activeElement === document.body)) root.focus();\n }, [state]);\n\n return { retrying, retry };\n}\n\nexport function AccountAddressBookRoot({\n $data: $dataProp,\n className,\n children,\n ...props\n}: AccountAddressBookRootProps) {\n const $data = useDataOverride<AccountAddressBookRootSlice | null | undefined>($dataProp);\n const book = $data ?? null;\n const { loading, error, refetch } = useContext(ReactiveRootContext);\n const { state: sessionState } = useSession();\n const state = resolveState({ book, loading, error });\n const [openForm, setOpenForm] = useState<AccountAddressBookOpenForm | null>(null);\n const [formPending, setFormPending] = useState(false);\n const [pendingDelete, setPendingDelete] = useState<AccountAddressBookPendingDelete>(null);\n const rememberFormOpener = useFocusReturn(openForm !== null);\n const rememberDeleteOpener = useFocusReturn(pendingDelete !== null);\n const { retrying, retry } = useRetry(refetch, state);\n\n const open = useCallback(\n (form: AccountAddressBookOpenForm, opener: HTMLElement | null) => {\n rememberFormOpener(opener);\n setOpenForm(form);\n },\n [rememberFormOpener],\n );\n const close = useCallback(() => setOpenForm(null), []);\n\n const requestDelete = useCallback(\n (address: AccountAddressBookItemSlice, opener: HTMLElement | null) => {\n rememberDeleteOpener(opener);\n setPendingDelete(address);\n },\n [rememberDeleteOpener],\n );\n const endDelete = useCallback(() => setPendingDelete(null), []);\n\n const value = useMemo(\n () => ({\n book,\n state,\n openForm,\n open,\n close,\n formPending,\n setFormPending,\n pendingDelete,\n requestDelete,\n endDelete,\n retrying,\n retry,\n }),\n [book, state, openForm, open, close, formPending, pendingDelete, requestDelete, endDelete, retrying, retry],\n );\n\n if (sessionState !== 'loggedIn') return null;\n\n return (\n <AccountAddressBookContext value={value}>\n <div\n tabIndex={-1}\n {...props}\n className={className}\n data-fs-account-address-book=\"\"\n {...(state ? { 'data-fs-account-address-book-state': state } : {})}\n >\n {children}\n </div>\n </AccountAddressBookContext>\n );\n}\n\nexport function AccountAddressBookList({ className, children, ...props }: AccountAddressBookListProps) {\n const { book } = useAccountAddressBook();\n const addresses = book?.addresses ?? [];\n\n if (addresses.length === 0) return null;\n\n return (\n <ul {...props} className={className} data-fs-account-address-book-list=\"\">\n {addresses.map(({ id }) => (\n <li key={id} data-fs-account-address-book-list-item=\"\">\n <ListItemRefContext\n // No fallback slice: the root's fragment selects only `{ id }`, so there is no complete\n // row to fall back to. An incomplete cache slice renders nothing until it resolves.\n value={{ __typename: 'CustomerAddress', id, fallbackData: undefined }}\n >\n {children}\n </ListItemRefContext>\n </li>\n ))}\n </ul>\n );\n}\n\nexport function AccountAddressBookItem({\n $data: $dataProp,\n className,\n children,\n ...props\n}: AccountAddressBookItemProps) {\n // Delivery-agnostic: the slice arrives through the DataOverrideContext seam the reactive-list-item\n // wrapper publishes (or via $data in tests); this component calls no data hook of its own.\n const slice = useDataOverride<AccountAddressBookItemSlice | null | undefined>($dataProp) ?? null;\n const { displayName } = useStorefrontFormatters();\n\n if (!slice) return null;\n\n // The summary shows a name, the raw slice keeps the code, and an address carries no name of its own.\n const summary = {\n recipientName: slice.recipientName,\n street: slice.street,\n number: slice.number,\n complement: slice.complement,\n neighborhood: slice.neighborhood,\n city: slice.city,\n state: slice.state,\n postalCode: slice.postalCode,\n reference: slice.reference,\n country: countryDisplayName(slice.country, displayName),\n };\n\n return (\n <AccountAddressBookItemContext value={slice}>\n <AddressSummaryRoot address={summary}>\n <div {...props} className={className} data-fs-account-address-book-item=\"\">\n {children ?? (\n <AddressSummary>\n <AddressSummaryRecipient />\n <AccountAddressBookItemLines />\n <AddressSummaryCountry />\n </AddressSummary>\n )}\n </div>\n </AddressSummaryRoot>\n </AccountAddressBookItemContext>\n );\n}\n\n/** One `p` per line the address's country prints, each field in that country's order. */\nexport function AccountAddressBookItemLines({ className }: AccountAddressBookItemLinesProps) {\n const address = useAccountAddressBookItem();\n\n return (\n <>\n {formatAddress(address, address.country ?? '').map((line) => (\n <p key={line.map(({ field }) => field).join()} className={className} data-fs-account-address-book-line=\"\">\n {line.map(({ field, separator }) => (\n <Fragment key={field}>\n {separator}\n <AddressSummaryField field={field} />\n </Fragment>\n ))}\n </p>\n ))}\n </>\n );\n}\n\n/**\n * The polite live region stays mounted whether or not the book is loading, so the message is\n * announced when it lands (the region has to exist before its text does).\n */\nexport function AccountAddressBookLoading({\n $content,\n $locale,\n className,\n children,\n ...props\n}: AccountAddressBookLoadingProps) {\n const { state } = useAccountAddressBook();\n const { format } = useMessageFormatter(AccountAddressBookLoadingContent, $content);\n\n return (\n <output {...props} aria-live=\"polite\" className={className} data-fs-account-address-book-loading=\"\">\n {state === 'loading' ? (\n <>\n {children ?? <AccountAddressBookSkeleton />}\n <span data-fs-account-address-book-loading-message=\"\" data-fs-sr-only=\"\" className=\"sr-only\">\n {format('message')}\n </span>\n </>\n ) : null}\n </output>\n );\n}\n\nexport function AccountAddressBookEmpty({ $content, $locale, className, ...props }: AccountAddressBookEmptyProps) {\n const { state } = useAccountAddressBook();\n const { format } = useMessageFormatter(AccountAddressBookEmptyContent, $content);\n\n if (state !== 'empty') return null;\n\n return (\n <p {...props} className={className} data-fs-account-address-book-empty=\"\">\n {format('message')}\n </p>\n );\n}\n\nexport function AccountAddressBookError({ $content, $locale, className, ...props }: AccountAddressBookErrorProps) {\n const { state, retrying, retry } = useAccountAddressBook();\n const { format } = useMessageFormatter(AccountAddressBookErrorContent, $content);\n const busy = retrying && state === 'loading';\n\n if (state !== 'error' && !busy) return null;\n\n return (\n <div {...props} role=\"alert\" className={className} data-fs-account-address-book-error=\"\">\n <p data-fs-account-address-book-error-message=\"\">{format('message')}</p>\n {/* `aria-disabled`, not `disabled`: a disabled button loses focus, and the shopper's is on it. */}\n <Button\n type=\"button\"\n onClick={busy ? undefined : retry}\n aria-disabled={busy || undefined}\n aria-busy={busy || undefined}\n data-fs-account-address-book-retry=\"\"\n >\n {format('retryLabel')}\n </Button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton — no context: `AccountAddressBookLoading` renders it before the root has anything to\n// provide, and the definitions reference it for the lint rule that asks every fetching component\n// for one. The compiler does not render it on the reactive path.\n// ---------------------------------------------------------------------------\n\nexport function AccountAddressBookSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} aria-hidden=\"true\" data-fs-account-address-book-skeleton=\"\">\n <span data-fs-account-address-book-skeleton-line=\"\" />\n <span data-fs-account-address-book-skeleton-line=\"\" />\n <span data-fs-account-address-book-skeleton-line=\"\" />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const AccountAddressBookRootDefinition = defineComponent<AccountAddressBookRootProps>({\n name: 'AccountAddressBookRoot',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookRoot,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'session',\n providesContext: 'account-address-book',\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Account Address Book', category: 'identity' },\n schema: {},\n guideline:\n \"Root of the signed-in shopper's saved addresses: reads the address book once and owns its four states (loading, error, empty, ready), exposed as data-fs-account-address-book-state. Renders nothing unless the session is logged in, so it needs a SessionRoot ancestor. Compose AccountAddressBookLoading, AccountAddressBookError, AccountAddressBookEmpty and an AccountAddressBookList holding one AccountAddressBookItem, in any order. Reading the book starts no cart. See account-address-book.md.\",\n});\n\nexport const AccountAddressBookListDefinition = defineComponent<AccountAddressBookListProps>({\n name: 'AccountAddressBookList',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookList,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book List', category: 'content' },\n schema: {},\n guideline:\n 'The saved addresses as a list, one entry per address in the order the book returns them. Place one AccountAddressBookItem inside as the per-address template; it is repeated once per address. Renders nothing until the book has at least one address. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookItemDefinition = defineComponent<AccountAddressBookItemProps>({\n name: 'AccountAddressBookItem',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookItem,\n fragment: itemFragment,\n fetchStrategy: 'reactive-list-item',\n requiresContext: 'account-address-book',\n providesContext: ['account-address-book-item', 'address-summary'],\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Account Address Book Item', category: 'content' },\n schema: {},\n guideline:\n \"One saved address, written the way its country writes it, with the recipient first and the country's name last. With no children it renders that default entry; give it children to compose the entry yourself, using the AddressSummary parts and AccountAddressBookItemLines. Provides the address-summary contract and the raw address for triggers placed inside it. Must be inside AccountAddressBookList.\",\n});\n\nexport const AccountAddressBookItemLinesDefinition = defineComponent<AccountAddressBookItemLinesProps>({\n name: 'AccountAddressBookItemLines',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookItemLines,\n requiresContext: 'account-address-book-item',\n editor: { label: 'Account Address Book Item Lines', category: 'content' },\n schema: {},\n guideline:\n \"The address's lines in its country's order, one paragraph per line with each field in sequence and its separator (a United States address reads number before street). A field the address lacks is dropped along with its separator. Must be inside AccountAddressBookItem.\",\n});\n\nexport const AccountAddressBookLoadingContent = defineContentType({\n id: 'account-address-book-loading',\n title: 'Account Address Book Loading',\n description: 'Message announced while the address book loads.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n message: {\n type: 'string',\n title: 'Loading message',\n format: 'icu-message',\n messageSource: 'Loading your addresses…',\n },\n },\n },\n});\n\nexport const AccountAddressBookLoadingDefinition = defineComponent<AccountAddressBookLoadingProps>({\n name: 'AccountAddressBookLoading',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookLoading,\n content: AccountAddressBookLoadingContent,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Loading', category: 'content' },\n schema: {},\n guideline:\n 'Shown only while the book is loading and has not resolved: a placeholder plus a loading message. The wrapper is a polite live region that stays mounted, and the message is visually hidden so it is heard and not seen. Pass children to replace the default placeholder. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookEmptyContent = defineContentType({\n id: 'account-address-book-empty',\n title: 'Account Address Book Empty',\n description: 'Message shown when the shopper has no saved addresses.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n message: {\n type: 'string',\n title: 'Empty message',\n format: 'icu-message',\n messageSource: 'You have no saved addresses yet.',\n },\n },\n },\n});\n\nexport const AccountAddressBookEmptyDefinition = defineComponent<AccountAddressBookEmptyProps>({\n name: 'AccountAddressBookEmpty',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookEmpty,\n content: AccountAddressBookEmptyContent,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Empty', category: 'content' },\n schema: {},\n guideline:\n 'Shown only once the book has resolved to zero addresses, never while it loads or after it fails, so it never invites the shopper to add an address they already have. Must be inside AccountAddressBookRoot.',\n});\n\nexport const AccountAddressBookErrorContent = defineContentType({\n id: 'account-address-book-error',\n title: 'Account Address Book Error',\n description: 'Message and retry label shown when the address book cannot be read.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n message: {\n type: 'string',\n title: 'Error message',\n format: 'icu-message',\n messageSource: \"We couldn't load your addresses.\",\n },\n retryLabel: { type: 'string', title: 'Retry label', format: 'icu-message', messageSource: 'Try again' },\n },\n },\n});\n\nexport const AccountAddressBookErrorDefinition = defineComponent<AccountAddressBookErrorProps>({\n name: 'AccountAddressBookError',\n importPath: '@vtex/faststore/components',\n component: AccountAddressBookError,\n content: AccountAddressBookErrorContent,\n requiresContext: 'account-address-book',\n editor: { label: 'Account Address Book Error', category: 'content' },\n schema: {},\n guideline:\n 'Shown when the book failed to load, as an alert with a retry control that loads the book again in place. Stays, with its retry disabled, while that retry loads. Never shown for a first load or an empty book. Must be inside AccountAddressBookRoot.',\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,WAAyB;;;;;;;;;;;;AAa/B,MAAM,eAA6B;;;;;;;;;;;;;;;;;;;;AAqHnC,MAAM,4BAA4B,cAAqD,IAAI;;AAG3F,SAAgB,wBAAwD;CACtE,MAAM,QAAQ,WAAW,yBAAyB;CAClD,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO;AACT;;AAGA,SAAgB,gCAAuE;CACrF,OAAO,WAAW,yBAAyB;AAC7C;AAEA,MAAM,gCAAgC,cAAkD,IAAI;;;;;AAM5F,SAAgB,4BAAyD;CACvE,MAAM,QAAQ,WAAW,6BAA6B;CACtD,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,yEAAyE;CAE3F,OAAO;AACT;;;;;;;AAYA,SAAS,aAAa,EACpB,MACA,SACA,SAKiC;CACjC,IAAI,QAAQ,MAAM,OAAO,KAAK,UAAU,WAAW,IAAI,UAAU;CACjE,IAAI,SAAS,OAAO;CACpB,OAAO,QAAQ,UAAU;AAC3B;AAEA,MAAM,gBAAgB;;;;;;AAOtB,SAAS,eAAe,QAAuD;CAC7E,MAAM,SAAS,OAAwE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;CACT,WACE;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isCountryField } from "../../sdk/address/constants.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveLabelKey } from "../../sdk/address/messages.js";
|
|
3
3
|
import { addressFields } from "../../sdk/address/address-fields.js";
|
|
4
4
|
import { switchCountry } from "../../sdk/address/switch-country.js";
|
|
5
5
|
//#region src/matter/account-address-book/account-address-country-switch.ts
|
|
@@ -32,7 +32,7 @@ function applyCountrySwitch({ draft, aside, from, to }) {
|
|
|
32
32
|
const next = {};
|
|
33
33
|
for (const [name, value] of Object.entries(values)) if (name !== "name") next[name] = value;
|
|
34
34
|
const left = (name, value) => values[name] !== value;
|
|
35
|
-
const labels = new Map(addressFields(from, draft).map(({ name,
|
|
35
|
+
const labels = new Map(addressFields(from, draft).map(({ name, label }) => [name, label]));
|
|
36
36
|
return {
|
|
37
37
|
draft: next,
|
|
38
38
|
aside: {
|
|
@@ -47,7 +47,7 @@ function applyCountrySwitch({ draft, aside, from, to }) {
|
|
|
47
47
|
if (!isCountryField(field) || !left(field, draft[field])) return [];
|
|
48
48
|
return [{
|
|
49
49
|
field,
|
|
50
|
-
|
|
50
|
+
label: labels.get(field) ?? resolveLabelKey("", field, from.country)
|
|
51
51
|
}];
|
|
52
52
|
})
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-address-country-switch.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-country-switch.ts"],"sourcesContent":["import { addressFields } from '../../sdk/address/address-fields.js';\nimport { isCountryField } from '../../sdk/address/constants.js';\nimport {
|
|
1
|
+
{"version":3,"file":"account-address-country-switch.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-country-switch.ts"],"sourcesContent":["import { addressFields } from '../../sdk/address/address-fields.js';\nimport { isCountryField } from '../../sdk/address/constants.js';\nimport { resolveLabelKey } from '../../sdk/address/messages.js';\nimport { switchCountry } from '../../sdk/address/switch-country.js';\nimport type { AddressFieldName, AddressValues, CountryRules } from '../../sdk/address/types.js';\nimport type {\n AccountAddressCountryChange,\n AccountAddressFormDraft,\n EditableField,\n} from './account-address-form-context.js';\n\n/** The values each country's switch set aside, by ISO 3166-1 alpha-3. Never sent. */\nexport type AddressCountryMemory = Readonly<Record<string, AddressValues>>;\n\ntype CountrySwitchInput = Readonly<{\n draft: AccountAddressFormDraft;\n aside: AddressCountryMemory;\n from: CountryRules;\n to: CountryRules;\n}>;\n\ntype CountrySwitchResult = Readonly<{\n draft: AccountAddressFormDraft;\n aside: AddressCountryMemory;\n change: AccountAddressCountryChange;\n}>;\n\nfunction isBlank(value: string | null | undefined): boolean {\n return value === null || value === undefined || value.trim() === '';\n}\n\n/**\n * The country a new address starts in: the preferred one when the store ships there or the list is\n * unknown, else the first country of the list, in the platform's order. `defaultCountry` comes\n * trimmed and upper-cased.\n */\nexport function initialAddressCountry(countries: readonly string[] | null, defaultCountry: string): string {\n if (!countries || countries.includes(defaultCountry)) return defaultCountry;\n return countries[0] ?? defaultCountry;\n}\n\n/**\n * Applies a country switch to the draft. What the new country cannot take is kept for the old one,\n * and what was kept for the new one comes back in every field the switch leaves empty, when it\n * passes the new country's rules with the rest of the draft: a city returns with its state. The\n * change lists the draft's values that stayed behind, with the old country's labels.\n */\nexport function applyCountrySwitch({ draft, aside, from, to }: CountrySwitchInput): CountrySwitchResult {\n const stored = aside[to.country] ?? {};\n const carried = switchCountry(draft, from, to);\n const offered = (Object.keys(stored) as AddressFieldName[]).filter(\n (name) => !isBlank(stored[name]) && isBlank(carried.values[name]),\n );\n const { values } = switchCountry(\n { ...draft, ...Object.fromEntries(offered.map((name) => [name, stored[name]])) },\n from,\n to,\n );\n\n const next: Partial<Record<EditableField, string>> = {};\n for (const [name, value] of Object.entries(values) as [AddressFieldName, string][]) {\n if (name !== 'name') next[name] = value;\n }\n\n const left = (name: AddressFieldName, value: string | null | undefined) => values[name] !== value;\n const labels = new Map(addressFields(from, draft).map(({ name, label }) => [name, label]));\n\n return {\n draft: next,\n aside: {\n ...aside,\n [from.country]: Object.fromEntries(\n Object.entries(carried.setAside).filter(([name, value]) => left(name as AddressFieldName, value)),\n ),\n [to.country]: Object.fromEntries(\n Object.entries(stored).filter(([name, value]) => left(name as AddressFieldName, value)),\n ),\n },\n change: {\n from: from.country,\n to: to.country,\n notCarried: carried.notCarried.flatMap((field) => {\n if (!isCountryField(field) || !left(field, draft[field])) return [];\n return [{ field, label: labels.get(field) ?? resolveLabelKey('', field, from.country) }];\n }),\n },\n };\n}\n"],"mappings":";;;;;AA2BA,SAAS,QAAQ,OAA2C;CAC1D,OAAO,UAAU,QAAQ,UAAU,KAAA,KAAa,MAAM,KAAK,MAAM;AACnE;;;;;;AAOA,SAAgB,sBAAsB,WAAqC,gBAAgC;CACzG,IAAI,CAAC,aAAa,UAAU,SAAS,cAAc,GAAG,OAAO;CAC7D,OAAO,UAAU,MAAM;AACzB;;;;;;;AAQA,SAAgB,mBAAmB,EAAE,OAAO,OAAO,MAAM,MAA+C;CACtG,MAAM,SAAS,MAAM,GAAG,YAAY,CAAC;CACrC,MAAM,UAAU,cAAc,OAAO,MAAM,EAAE;CAC7C,MAAM,UAAW,OAAO,KAAK,MAAM,CAAC,CAAwB,QACzD,SAAS,CAAC,QAAQ,OAAO,KAAK,KAAK,QAAQ,QAAQ,OAAO,KAAK,CAClE;CACA,MAAM,EAAE,WAAW,cACjB;EAAE,GAAG;EAAO,GAAG,OAAO,YAAY,QAAQ,KAAK,SAAS,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;CAAE,GAC/E,MACA,EACF;CAEA,MAAM,OAA+C,CAAC;CACtD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,MAAM,GAC/C,IAAI,SAAS,QAAQ,KAAK,QAAQ;CAGpC,MAAM,QAAQ,MAAwB,UAAqC,OAAO,UAAU;CAC5F,MAAM,SAAS,IAAI,IAAI,cAAc,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE,MAAM,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC;CAEzF,OAAO;EACL,OAAO;EACP,OAAO;GACL,GAAG;IACF,KAAK,UAAU,OAAO,YACrB,OAAO,QAAQ,QAAQ,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,WAAW,KAAK,MAA0B,KAAK,CAAC,CAClG;IACC,GAAG,UAAU,OAAO,YACnB,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,WAAW,KAAK,MAA0B,KAAK,CAAC,CACxF;EACF;EACA,QAAQ;GACN,MAAM,KAAK;GACX,IAAI,GAAG;GACP,YAAY,QAAQ,WAAW,SAAS,UAAU;IAChD,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC,KAAK,OAAO,MAAM,MAAM,GAAG,OAAO,CAAC;IAClE,OAAO,CAAC;KAAE;KAAO,OAAO,OAAO,IAAI,KAAK,KAAK,gBAAgB,IAAI,OAAO,KAAK,OAAO;IAAE,CAAC;GACzF,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
1
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
3
|
import "../../core/dist/index.js";
|
|
3
4
|
//#region src/matter/account-address-book/account-address-country.d.ts
|
|
@@ -6,31 +7,76 @@ export type AddressCountryControlSlice = Readonly<{
|
|
|
6
7
|
countries: readonly string[];
|
|
7
8
|
source: 'PLATFORM' | 'SALES_CHANNEL_FALLBACK';
|
|
8
9
|
}>;
|
|
9
|
-
export type AddressCountryControlProps = Readonly<{
|
|
10
|
+
export type AddressCountryControlProps = MessageLocaleProp & Readonly<{
|
|
10
11
|
/** Unwrapped `shippingCountries` from the reactive runtime: `null` when the read failed, absent outside the page query. */
|
|
11
12
|
$data?: AddressCountryControlSlice | null;
|
|
12
|
-
|
|
13
|
-
label?: string;
|
|
13
|
+
$content?: ContentValue<typeof AddressCountryControlContent>;
|
|
14
14
|
className?: string;
|
|
15
15
|
}>;
|
|
16
|
-
export type AccountAddressCountryNoticeProps = Readonly<{
|
|
17
|
-
|
|
18
|
-
message?: string;
|
|
16
|
+
export type AccountAddressCountryNoticeProps = MessageLocaleProp & Readonly<{
|
|
17
|
+
$content?: ContentValue<typeof AccountAddressCountryNoticeContent>;
|
|
19
18
|
className?: string;
|
|
20
19
|
}>;
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
export declare const AddressCountryControlContent: {
|
|
21
|
+
readonly id: "address-country-control";
|
|
22
|
+
readonly title: "Address Country Control";
|
|
23
|
+
readonly description: "Label of the address's country field.";
|
|
24
|
+
readonly schema: {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
readonly additionalProperties: false;
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly label: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly title: "Field label";
|
|
31
|
+
readonly format: "icu-message";
|
|
32
|
+
readonly messageSource: "Country";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const AddressCountryControlDefinition: ComponentDefinition<AddressCountryControlProps>;
|
|
38
|
+
export declare const AccountAddressCountryNoticeContent: {
|
|
39
|
+
readonly id: "account-address-country-notice";
|
|
40
|
+
readonly title: "Account Address Country Notice";
|
|
41
|
+
readonly description: "Says which fields a country change left behind.";
|
|
42
|
+
readonly schema: {
|
|
43
|
+
readonly type: "object";
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
readonly properties: {
|
|
46
|
+
readonly message: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly title: "Notice message";
|
|
49
|
+
readonly format: "icu-message";
|
|
50
|
+
readonly messageSource: "{count, plural, one {This field won't carry over to an address in {country}: {fields}. It comes back if you switch back to {previous}.} other {These fields won't carry over to an address in {country}: {fields}. They come back if you switch back to {previous}.}}";
|
|
51
|
+
readonly messageArguments: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly properties: {
|
|
54
|
+
readonly count: {
|
|
55
|
+
readonly type: "integer";
|
|
56
|
+
};
|
|
57
|
+
readonly country: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
};
|
|
60
|
+
readonly fields: {
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
};
|
|
63
|
+
readonly previous: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
readonly messageExample: {
|
|
69
|
+
readonly count: 2;
|
|
70
|
+
readonly country: "Argentina";
|
|
71
|
+
readonly fields: "Neighborhood and Number";
|
|
72
|
+
readonly previous: "Brazil";
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export declare const AccountAddressCountryNoticeDefinition: ComponentDefinition<AccountAddressCountryNoticeProps>;
|
|
79
|
+
export declare function AddressCountryControl({ $data: $dataProp, $content, className }: AddressCountryControlProps): import("react/jsx-runtime").JSX.Element | null;
|
|
80
|
+
export declare function AccountAddressCountryNotice({ $content, className }: AccountAddressCountryNoticeProps): import("react/jsx-runtime").JSX.Element;
|
|
35
81
|
//#endregion
|
|
36
82
|
//# sourceMappingURL=account-address-country.d.ts.map
|
|
@@ -1,29 +1,52 @@
|
|
|
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";
|
|
4
5
|
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
5
6
|
import { useStorefrontFormatters } from "../../sdk/format/client.js";
|
|
6
|
-
import {
|
|
7
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
7
8
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
8
|
-
import { resolveAuthoredCopy } from "../../utils/resolve-authored-copy.js";
|
|
9
9
|
import { countryDisplayName } from "../../sdk/address/country-display.js";
|
|
10
10
|
import { AccountAddressBookSkeleton } from "./account-address-book.js";
|
|
11
11
|
import { Select } from "../../particles/select/select.js";
|
|
12
12
|
import { useAccountAddressForm } from "./account-address-form-context.js";
|
|
13
13
|
import { useEffect, useMemo } from "react";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
//#region src/matter/account-address-book/account-address-country.tsx
|
|
16
|
+
/**
|
|
17
|
+
* The country of a new address, chosen from where the store ships, and the notice that says what a switch
|
|
18
|
+
* left behind. The control reads `shippingCountries` through its own fragment and reports the list to the
|
|
19
|
+
* form, which owns the country, the switch and the values set aside. Neither part touches the draft.
|
|
20
|
+
*/
|
|
21
|
+
const fragment = `
|
|
20
22
|
fragment AddressCountryControlData on Query {
|
|
21
23
|
shippingCountries {
|
|
22
24
|
countries
|
|
23
25
|
source
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
|
-
|
|
28
|
+
`;
|
|
29
|
+
const AddressCountryControlContent = defineContentType({
|
|
30
|
+
id: "address-country-control",
|
|
31
|
+
title: "Address Country Control",
|
|
32
|
+
description: "Label of the address's country field.",
|
|
33
|
+
schema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
properties: { label: {
|
|
37
|
+
type: "string",
|
|
38
|
+
title: "Field label",
|
|
39
|
+
format: "icu-message",
|
|
40
|
+
messageSource: "Country"
|
|
41
|
+
} }
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const AddressCountryControlDefinition = defineComponent({
|
|
45
|
+
name: "AddressCountryControl",
|
|
46
|
+
importPath: "@vtex/faststore/components",
|
|
47
|
+
component: AddressCountryControl,
|
|
48
|
+
content: AddressCountryControlContent,
|
|
49
|
+
fragment,
|
|
27
50
|
fetchStrategy: "reactive",
|
|
28
51
|
requiresContext: "account-address-form",
|
|
29
52
|
skeleton: AccountAddressBookSkeleton,
|
|
@@ -31,33 +54,58 @@ const AddressCountryControlDefinition = defineComponent({
|
|
|
31
54
|
label: "Address Country Control",
|
|
32
55
|
category: "input"
|
|
33
56
|
},
|
|
34
|
-
schema: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
57
|
+
schema: {},
|
|
58
|
+
guideline: "The country of the address. A new address picks it from the countries the store ships to, in a list sorted by name, when there are two or more; with one it shows nothing, and the address takes that country. A saved address keeps its country, shown as text, and so does a new one when the list could not be read. Changing it keeps the fields the new country takes, and brings back what was typed for that country before. Compose it under AccountAddressFormRoot to offer the choice. Place AccountAddressCountryNotice next to it. Must be inside AccountAddressFormRoot."
|
|
59
|
+
});
|
|
60
|
+
const AccountAddressCountryNoticeContent = defineContentType({
|
|
61
|
+
id: "account-address-country-notice",
|
|
62
|
+
title: "Account Address Country Notice",
|
|
63
|
+
description: "Says which fields a country change left behind.",
|
|
64
|
+
schema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
properties: { message: {
|
|
68
|
+
type: "string",
|
|
69
|
+
title: "Notice message",
|
|
70
|
+
format: "icu-message",
|
|
71
|
+
messageSource: "{count, plural, one {This field won't carry over to an address in {country}: {fields}. It comes back if you switch back to {previous}.} other {These fields won't carry over to an address in {country}: {fields}. They come back if you switch back to {previous}.}}",
|
|
72
|
+
messageArguments: {
|
|
73
|
+
type: "object",
|
|
74
|
+
properties: {
|
|
75
|
+
count: { type: "integer" },
|
|
76
|
+
country: { type: "string" },
|
|
77
|
+
fields: { type: "string" },
|
|
78
|
+
previous: { type: "string" }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
messageExample: {
|
|
82
|
+
count: 2,
|
|
83
|
+
country: "Argentina",
|
|
84
|
+
fields: "Neighborhood and Number",
|
|
85
|
+
previous: "Brazil"
|
|
86
|
+
}
|
|
87
|
+
} }
|
|
88
|
+
}
|
|
39
89
|
});
|
|
40
90
|
const AccountAddressCountryNoticeDefinition = defineComponent({
|
|
41
91
|
name: "AccountAddressCountryNotice",
|
|
42
92
|
importPath: "@vtex/faststore/components",
|
|
43
93
|
component: AccountAddressCountryNotice,
|
|
94
|
+
content: AccountAddressCountryNoticeContent,
|
|
44
95
|
requiresContext: "account-address-form",
|
|
45
96
|
editor: {
|
|
46
97
|
label: "Account Address Country Notice",
|
|
47
98
|
category: "content"
|
|
48
99
|
},
|
|
49
|
-
schema: {
|
|
50
|
-
|
|
51
|
-
label: "Notice message"
|
|
52
|
-
} },
|
|
53
|
-
guideline: "Says which fields a country change left behind, and that they come back on switching back. Announced politely, and empty until a change leaves something behind. The message takes count, country, previous and fields as ICU arguments. Place it right after AddressCountryControl. Must be inside AccountAddressFormRoot."
|
|
100
|
+
schema: {},
|
|
101
|
+
guideline: "Says which fields a country change left behind, and that they come back on switching back. Announced politely, and empty until a change leaves something behind. Its message takes count, country, previous and fields; fields lists labels from the content of AccountAddressFormFields. Place it right after AddressCountryControl. Must be inside AccountAddressFormRoot."
|
|
54
102
|
});
|
|
55
|
-
function AddressCountryControl({ $data: $dataProp,
|
|
103
|
+
function AddressCountryControl({ $data: $dataProp, $content, className }) {
|
|
56
104
|
const slice = useDataOverride($dataProp);
|
|
57
105
|
const { mode, country, pending, countryChoice: { offer, selected, change } } = useAccountAddressForm();
|
|
58
106
|
const { displayName } = useStorefrontFormatters();
|
|
59
107
|
const { locale } = useStorefrontContext();
|
|
60
|
-
const
|
|
108
|
+
const { format } = useMessageFormatter(AddressCountryControlContent, $content);
|
|
61
109
|
const countries = slice?.countries ?? null;
|
|
62
110
|
const reported = countries?.join(",") ?? null;
|
|
63
111
|
useEffect(() => offer(reported === null ? null : reported.split(",").filter(Boolean)), [offer, reported]);
|
|
@@ -86,7 +134,7 @@ function AddressCountryControl({ $data: $dataProp, label, className }) {
|
|
|
86
134
|
disabled: pending,
|
|
87
135
|
onValueChange: (value) => value && change(value),
|
|
88
136
|
children: [
|
|
89
|
-
/* @__PURE__ */ jsx(Select.Label, { children:
|
|
137
|
+
/* @__PURE__ */ jsx(Select.Label, { children: format("label") }),
|
|
90
138
|
/* @__PURE__ */ jsxs(Select.Trigger, {
|
|
91
139
|
"data-fs-account-address-form-control": "",
|
|
92
140
|
disabled: pending,
|
|
@@ -111,41 +159,27 @@ function AddressCountryControl({ $data: $dataProp, label, className }) {
|
|
|
111
159
|
})
|
|
112
160
|
});
|
|
113
161
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
116
|
-
const {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
return String(intl.formatters.getMessageFormat(authored, intl.locale).format(values));
|
|
128
|
-
} catch {
|
|
129
|
-
return fallback;
|
|
162
|
+
function AccountAddressCountryNotice({ $content, className }) {
|
|
163
|
+
const { countryChoice: { lastChange }, fieldLabel } = useAccountAddressForm();
|
|
164
|
+
const { format } = useMessageFormatter(AccountAddressCountryNoticeContent, $content);
|
|
165
|
+
const { displayName, formatList } = useStorefrontFormatters();
|
|
166
|
+
function describe(change) {
|
|
167
|
+
if (!change || change.notCarried.length === 0) return "";
|
|
168
|
+
return format("message", {
|
|
169
|
+
count: change.notCarried.length,
|
|
170
|
+
country: countryDisplayName(change.to, displayName) ?? change.to,
|
|
171
|
+
previous: countryDisplayName(change.from, displayName) ?? change.from,
|
|
172
|
+
fields: fieldLabel ? formatList(change.notCarried.map(({ label }) => fieldLabel(label))) : ""
|
|
173
|
+
});
|
|
130
174
|
}
|
|
131
|
-
}
|
|
132
|
-
function AccountAddressCountryNotice({ message, className }) {
|
|
133
|
-
const { countryChoice: { lastChange } } = useAccountAddressForm();
|
|
134
|
-
const intl = useIntl();
|
|
135
|
-
const formatters = useStorefrontFormatters();
|
|
136
175
|
return /* @__PURE__ */ jsx("output", {
|
|
137
176
|
"aria-live": "polite",
|
|
138
177
|
className,
|
|
139
178
|
"data-fs-account-address-country-notice": "",
|
|
140
|
-
children:
|
|
141
|
-
change: lastChange,
|
|
142
|
-
message,
|
|
143
|
-
intl,
|
|
144
|
-
formatters
|
|
145
|
-
})
|
|
179
|
+
children: describe(lastChange)
|
|
146
180
|
});
|
|
147
181
|
}
|
|
148
182
|
//#endregion
|
|
149
|
-
export { AccountAddressCountryNotice, AccountAddressCountryNoticeDefinition, AddressCountryControl, AddressCountryControlDefinition };
|
|
183
|
+
export { AccountAddressCountryNotice, AccountAddressCountryNoticeContent, AccountAddressCountryNoticeDefinition, AddressCountryControl, AddressCountryControlContent, AddressCountryControlDefinition };
|
|
150
184
|
|
|
151
185
|
//# sourceMappingURL=account-address-country.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-address-country.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-country.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport { useEffect, useMemo } from 'react';\nimport { Select } from '../../particles/select/select.js';\nimport { countryDisplayName } from '../../sdk/address/country-display.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport { useIntl } from '../../sdk/i18n/client.js';\nimport { resolveAuthoredCopy } from '../../utils/resolve-authored-copy.js';\nimport { AccountAddressBookSkeleton } from './account-address-book.js';\nimport { type AccountAddressCountryChange, useAccountAddressForm } from './account-address-form-context.js';\n\n/**\n * The country of a new address, chosen from where the store ships, and the notice that says what a switch\n * left behind. The control reads `shippingCountries` through its own fragment and reports the list to the\n * form, which owns the country, the switch and the values set aside. Neither part touches the draft.\n */\n\nconst fragment = /* GraphQL */ `\n fragment AddressCountryControlData on Query {\n shippingCountries {\n countries\n source\n }\n }\n`;\n\n/** The shipping countries the control reads. `countries` is ISO 3166-1 alpha-3, in the platform's order. */\nexport type AddressCountryControlSlice = Readonly<{\n countries: readonly string[];\n source: 'PLATFORM' | 'SALES_CHANNEL_FALLBACK';\n}>;\n\nexport type AddressCountryControlProps = Readonly<{\n /** Unwrapped `shippingCountries` from the reactive runtime: `null` when the read failed, absent outside the page query. */\n $data?: AddressCountryControlSlice | null;\n /** The select's label. A blank value falls back to the catalog copy. */\n label?: string;\n className?: string;\n}>;\n\nexport type AccountAddressCountryNoticeProps = Readonly<{\n /** Replaces the whole sentence, with the same ICU arguments. A blank value falls back to the catalog copy. */\n message?: string;\n className?: string;\n}>;\n\nexport const AddressCountryControlDefinition = defineComponent<AddressCountryControlProps>({\n name: 'AddressCountryControl',\n importPath: '@vtex/faststore/components',\n component: AddressCountryControl,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'account-address-form',\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Address Country Control', category: 'input' },\n schema: {\n label: { type: 'string', label: 'Field label' },\n },\n guideline:\n \"The country of the address. A new address picks it from the countries the store ships to, in a list sorted by name, when there are two or more; with one it shows nothing, and the address takes that country. A saved address keeps its country, shown as text, and so does a new one when the list could not be read. Changing it keeps the fields the new country takes, and brings back what was typed for that country before. Compose it explicitly under AccountAddressFormRoot to offer the choice: in the root's default composition it gets no list and shows the root's defaultCountry as text. Place AccountAddressCountryNotice next to it. Must be inside AccountAddressFormRoot.\",\n});\n\nexport const AccountAddressCountryNoticeDefinition = defineComponent<AccountAddressCountryNoticeProps>({\n name: 'AccountAddressCountryNotice',\n importPath: '@vtex/faststore/components',\n component: AccountAddressCountryNotice,\n requiresContext: 'account-address-form',\n editor: { label: 'Account Address Country Notice', category: 'content' },\n schema: {\n message: { type: 'string', label: 'Notice message' },\n },\n guideline:\n 'Says which fields a country change left behind, and that they come back on switching back. Announced politely, and empty until a change leaves something behind. The message takes count, country, previous and fields as ICU arguments. Place it right after AddressCountryControl. Must be inside AccountAddressFormRoot.',\n});\n\ntype CountryOption = Readonly<{ value: string; label: string }>;\n\nexport function AddressCountryControl({ $data: $dataProp, label, className }: AddressCountryControlProps) {\n const slice = useDataOverride<AddressCountryControlSlice | null | undefined>($dataProp);\n const {\n mode,\n country,\n pending,\n countryChoice: { offer, selected, change },\n } = useAccountAddressForm();\n const { displayName } = useStorefrontFormatters();\n const { locale } = useStorefrontContext();\n const intl = useIntl();\n\n // A slice from another ancestor's provider has no `countries`: the list is unknown then.\n const countries = slice?.countries ?? null;\n const reported = countries?.join(',') ?? null;\n\n useEffect(() => offer(reported === null ? null : reported.split(',').filter(Boolean)), [offer, reported]);\n\n const options = useMemo<readonly CountryOption[]>(() => {\n const collator = new Intl.Collator(locale);\n return (countries ?? [])\n .map((code) => ({ value: code, label: countryDisplayName(code, displayName) ?? code }))\n .sort((a, b) => collator.compare(a.label, b.label));\n }, [countries, locale, displayName]);\n\n const switching = selected !== country;\n const wrapper = {\n className,\n 'data-fs-address-country-control': '',\n ...(switching ? { 'data-fs-address-country-control-pending': '' } : {}),\n };\n\n if (mode === 'add' && countries?.length === 1) return null;\n\n if (mode === 'add' && countries && countries.length > 1) {\n return (\n <div {...wrapper} data-fs-address-country-control-mode=\"select\">\n <Select.Root value={selected} disabled={pending} onValueChange={(value) => value && change(value)}>\n <Select.Label>\n {resolveAuthoredCopy(label, intl.formatMessage({ id: 'fs/address-form.country' }))}\n </Select.Label>\n <Select.Trigger data-fs-account-address-form-control=\"\" disabled={pending}>\n <Select.Value>\n {(value) =>\n options.find((option) => option.value === value)?.label ??\n countryDisplayName(value, displayName) ??\n value\n }\n </Select.Value>\n <Select.Icon />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n <Select.List>\n {options.map((option) => (\n <Select.Item key={option.value} value={option.value} label={option.label}>\n <Select.ItemText>{option.label}</Select.ItemText>\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n </div>\n );\n }\n\n const name = countryDisplayName(country, displayName);\n if (!name) return null;\n\n return (\n <div {...wrapper} data-fs-address-country-control-mode=\"text\">\n <p data-fs-address-country-control-text=\"\">{name}</p>\n </div>\n );\n}\n\ntype DescribeChangeInput = Readonly<{\n change: AccountAddressCountryChange | null;\n message: string | undefined;\n intl: ReturnType<typeof useIntl>;\n formatters: ReturnType<typeof useStorefrontFormatters>;\n}>;\n\nfunction describeChange({ change, message, intl, formatters }: DescribeChangeInput): string {\n if (!change || change.notCarried.length === 0) return '';\n const { displayName, formatList } = formatters;\n const values = {\n count: change.notCarried.length,\n country: countryDisplayName(change.to, displayName) ?? change.to,\n previous: countryDisplayName(change.from, displayName) ?? change.from,\n fields: formatList(change.notCarried.map(({ labelId }) => intl.formatMessage({ id: labelId }))),\n };\n const fallback = intl.formatMessage({ id: 'fs/address-form.country-notice' }, values);\n const authored = resolveAuthoredCopy(message, '');\n if (!authored) return fallback;\n try {\n return String(intl.formatters.getMessageFormat(authored, intl.locale).format(values));\n } catch {\n // An authored message is free text: a malformed ICU pattern falls back to the catalog copy.\n return fallback;\n }\n}\n\nexport function AccountAddressCountryNotice({ message, className }: AccountAddressCountryNoticeProps) {\n const {\n countryChoice: { lastChange },\n } = useAccountAddressForm();\n const intl = useIntl();\n const formatters = useStorefrontFormatters();\n\n return (\n <output aria-live=\"polite\" className={className} data-fs-account-address-country-notice=\"\">\n {describeChange({ change: lastChange, message, intl, formatters })}\n </output>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiDA,MAAa,kCAAkC,gBAA4C;CACzF,MAAM;CACN,YAAY;CACZ,WAAW;CACX;;;;;;;;CACA,eAAe;CACf,iBAAiB;CACjB,UAAU;CACV,QAAQ;EAAE,OAAO;EAA2B,UAAU;CAAQ;CAC9D,QAAQ,EACN,OAAO;EAAE,MAAM;EAAU,OAAO;CAAc,EAChD;CACA,WACE;AACJ,C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AW,KAAK,OAAO;EACjE,QAAQ,WAAW,OAAO,WAAW,KAAK,EAAE,cAAc,KAAK,cAAc,EAAE,IAAI,QAAQ,CAAC,CAAC,CAAC;CAChG;CACA,MAAM,WAAW,KAAK,cAAc,EAAE,IAAI,iCAAiC,GAAG,MAAM;CACpF,MAAM,WAAW,oBAAoB,SAAS,EAAE;CAChD,IAAI,CAAC,UAAU,OAAO;CACtB,IAAI;EACF,OAAO,OAAO,KAAK,WAAW,iBAAiB,UAAU,KAAK,MAAM,CAAC,CAAC,OAAO,MAAM,CAAC;CACtF,QAAQ;EAEN,OAAO;CACT;AACF;AAEA,SAAgB,4BAA4B,EAAE,SAAS,aAA+C;CACpG,MAAM,EACJ,eAAe,EAAE,iBACf,sBAAsB;CAC1B,MAAM,OAAO,QAAQ;CACrB,MAAM,aAAa,wBAAwB;CAE3C,OACE,oBAAC,UAAD;EAAQ,aAAU;EAAoB;EAAW,0CAAuC;EACrF,UAAA,eAAe;GAAE,QAAQ;GAAY;GAAS;GAAM;EAAW,CAAC;CAC3D,CAAA;AAEZ"}
|
|
1
|
+
{"version":3,"file":"account-address-country.js","names":[],"sources":["../../../src/matter/account-address-book/account-address-country.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { useEffect, useMemo } from 'react';\nimport { Select } from '../../particles/select/select.js';\nimport { countryDisplayName } from '../../sdk/address/country-display.js';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { AccountAddressBookSkeleton } from './account-address-book.js';\nimport { type AccountAddressCountryChange, useAccountAddressForm } from './account-address-form-context.js';\n\n/**\n * The country of a new address, chosen from where the store ships, and the notice that says what a switch\n * left behind. The control reads `shippingCountries` through its own fragment and reports the list to the\n * form, which owns the country, the switch and the values set aside. Neither part touches the draft.\n */\n\nconst fragment = /* GraphQL */ `\n fragment AddressCountryControlData on Query {\n shippingCountries {\n countries\n source\n }\n }\n`;\n\n/** The shipping countries the control reads. `countries` is ISO 3166-1 alpha-3, in the platform's order. */\nexport type AddressCountryControlSlice = Readonly<{\n countries: readonly string[];\n source: 'PLATFORM' | 'SALES_CHANNEL_FALLBACK';\n}>;\n\nexport type AddressCountryControlProps = MessageLocaleProp &\n Readonly<{\n /** Unwrapped `shippingCountries` from the reactive runtime: `null` when the read failed, absent outside the page query. */\n $data?: AddressCountryControlSlice | null;\n $content?: ContentValue<typeof AddressCountryControlContent>;\n className?: string;\n }>;\n\nexport type AccountAddressCountryNoticeProps = MessageLocaleProp &\n Readonly<{\n $content?: ContentValue<typeof AccountAddressCountryNoticeContent>;\n className?: string;\n }>;\n\nexport const AddressCountryControlContent = defineContentType({\n id: 'address-country-control',\n title: 'Address Country Control',\n description: \"Label of the address's country field.\",\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Field label', format: 'icu-message', messageSource: 'Country' },\n },\n },\n});\n\nexport const AddressCountryControlDefinition = defineComponent<AddressCountryControlProps>({\n name: 'AddressCountryControl',\n importPath: '@vtex/faststore/components',\n component: AddressCountryControl,\n content: AddressCountryControlContent,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'account-address-form',\n skeleton: AccountAddressBookSkeleton,\n editor: { label: 'Address Country Control', category: 'input' },\n schema: {},\n guideline:\n 'The country of the address. A new address picks it from the countries the store ships to, in a list sorted by name, when there are two or more; with one it shows nothing, and the address takes that country. A saved address keeps its country, shown as text, and so does a new one when the list could not be read. Changing it keeps the fields the new country takes, and brings back what was typed for that country before. Compose it under AccountAddressFormRoot to offer the choice. Place AccountAddressCountryNotice next to it. Must be inside AccountAddressFormRoot.',\n});\n\nexport const AccountAddressCountryNoticeContent = defineContentType({\n id: 'account-address-country-notice',\n title: 'Account Address Country Notice',\n description: 'Says which fields a country change left behind.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n message: {\n type: 'string',\n title: 'Notice message',\n format: 'icu-message',\n messageSource:\n \"{count, plural, one {This field won't carry over to an address in {country}: {fields}. It comes back if you switch back to {previous}.} other {These fields won't carry over to an address in {country}: {fields}. They come back if you switch back to {previous}.}}\",\n messageArguments: {\n type: 'object',\n properties: {\n count: { type: 'integer' },\n country: { type: 'string' },\n fields: { type: 'string' },\n previous: { type: 'string' },\n },\n },\n messageExample: { count: 2, country: 'Argentina', fields: 'Neighborhood and Number', previous: 'Brazil' },\n },\n },\n },\n});\n\nexport const AccountAddressCountryNoticeDefinition = defineComponent<AccountAddressCountryNoticeProps>({\n name: 'AccountAddressCountryNotice',\n importPath: '@vtex/faststore/components',\n component: AccountAddressCountryNotice,\n content: AccountAddressCountryNoticeContent,\n requiresContext: 'account-address-form',\n editor: { label: 'Account Address Country Notice', category: 'content' },\n schema: {},\n guideline:\n 'Says which fields a country change left behind, and that they come back on switching back. Announced politely, and empty until a change leaves something behind. Its message takes count, country, previous and fields; fields lists labels from the content of AccountAddressFormFields. Place it right after AddressCountryControl. Must be inside AccountAddressFormRoot.',\n});\n\ntype CountryOption = Readonly<{ value: string; label: string }>;\n\nexport function AddressCountryControl({ $data: $dataProp, $content, className }: AddressCountryControlProps) {\n const slice = useDataOverride<AddressCountryControlSlice | null | undefined>($dataProp);\n const {\n mode,\n country,\n pending,\n countryChoice: { offer, selected, change },\n } = useAccountAddressForm();\n const { displayName } = useStorefrontFormatters();\n const { locale } = useStorefrontContext();\n const { format } = useMessageFormatter(AddressCountryControlContent, $content);\n\n // A slice from another ancestor's provider has no `countries`: the list is unknown then.\n const countries = slice?.countries ?? null;\n const reported = countries?.join(',') ?? null;\n\n useEffect(() => offer(reported === null ? null : reported.split(',').filter(Boolean)), [offer, reported]);\n\n const options = useMemo<readonly CountryOption[]>(() => {\n const collator = new Intl.Collator(locale);\n return (countries ?? [])\n .map((code) => ({ value: code, label: countryDisplayName(code, displayName) ?? code }))\n .sort((a, b) => collator.compare(a.label, b.label));\n }, [countries, locale, displayName]);\n\n const switching = selected !== country;\n const wrapper = {\n className,\n 'data-fs-address-country-control': '',\n ...(switching ? { 'data-fs-address-country-control-pending': '' } : {}),\n };\n\n if (mode === 'add' && countries?.length === 1) return null;\n\n if (mode === 'add' && countries && countries.length > 1) {\n return (\n <div {...wrapper} data-fs-address-country-control-mode=\"select\">\n <Select.Root value={selected} disabled={pending} onValueChange={(value) => value && change(value)}>\n <Select.Label>{format('label')}</Select.Label>\n <Select.Trigger data-fs-account-address-form-control=\"\" disabled={pending}>\n <Select.Value>\n {(value) =>\n options.find((option) => option.value === value)?.label ??\n countryDisplayName(value, displayName) ??\n value\n }\n </Select.Value>\n <Select.Icon />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n <Select.List>\n {options.map((option) => (\n <Select.Item key={option.value} value={option.value} label={option.label}>\n <Select.ItemText>{option.label}</Select.ItemText>\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n </div>\n );\n }\n\n const name = countryDisplayName(country, displayName);\n if (!name) return null;\n\n return (\n <div {...wrapper} data-fs-address-country-control-mode=\"text\">\n <p data-fs-address-country-control-text=\"\">{name}</p>\n </div>\n );\n}\n\nexport function AccountAddressCountryNotice({ $content, className }: AccountAddressCountryNoticeProps) {\n const {\n countryChoice: { lastChange },\n fieldLabel,\n } = useAccountAddressForm();\n const { format } = useMessageFormatter(AccountAddressCountryNoticeContent, $content);\n const { displayName, formatList } = useStorefrontFormatters();\n\n function describe(change: AccountAddressCountryChange | null): string {\n if (!change || change.notCarried.length === 0) return '';\n return format('message', {\n count: change.notCarried.length,\n country: countryDisplayName(change.to, displayName) ?? change.to,\n previous: countryDisplayName(change.from, displayName) ?? change.from,\n fields: fieldLabel ? formatList(change.notCarried.map(({ label }) => fieldLabel(label))) : '',\n });\n }\n\n return (\n <output aria-live=\"polite\" className={className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