@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"challenge-return.js","names":[],"sources":["../../../src/matter/challenge-return/challenge-return.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport { type ComponentPropsWithRef, useEffect, useRef, useState } from 'react';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { StorefrontLink } from '../../sdk/navigation/storefront-link.js';\nimport type { PageRef } from '../../sdk/navigation/types.js';\nimport { useStorefrontNavigation } from '../../sdk/navigation/use-storefront-navigation.js';\nimport { readChallengeReturn } from '../../sdk/payment/challenge-return.js';\nimport { PAYMENT_NETWORK_ERROR_CODE, type PaymentUserError } from '../../sdk/payment/operations.js';\nimport { emitPurchaseForOrder, useSettledOrderRead } from '../../sdk/payment/resumed-purchase.js';\nimport { resolveSiteRelativeHref } from '../../utils/safe-href.js';\n\n/**\n * The page a shopper lands on when the bank sends them back from a 3D Secure challenge (T208). It finishes\n * the order with no click: one `gatewayCallback` for the order group in its own URL, one read of the settled\n * order, one `purchase`, and a replace to the confirmation page. A whole-page handover component, like\n * `SignInRedirect`: it does its work in an effect and renders only the state it is in.\n *\n * **A return never pays.** This page reaches `payment.gatewayCallback` and nothing else of the payment\n * actions, and renders no field of any kind: the card was handed to the gateway before the shopper left.\n *\n * The query is read from the document in the effect, never through `useSearchParams()`, which would need a\n * `Suspense` boundary the generator does not emit on a prerendered route; a prerender has no query at all,\n * so the first paint is the resuming state and the effect decides.\n */\n\nconst CHECKOUT_PAGE: PageRef = { standard: 'checkout' };\nconst ORDER_PLACED_PAGE: PageRef = { standard: 'order-placed' };\n\n// Field names avoid the card-field pattern the catalog sweep reads.\nexport const ChallengeReturnContent = defineContentType({\n id: 'challenge-return',\n title: 'Challenge Return',\n description: 'Copy for the page the bank sends the shopper back to after a 3D Secure challenge.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n resumingMessage: {\n type: 'string',\n title: 'Message while finishing the order',\n format: 'icu-message',\n messageSource: 'Finishing your order...',\n },\n lateReturnMessage: {\n type: 'string',\n title: 'Message when the verification lapsed',\n description: 'Shown in an alert when the callback answered a refusal: the order was not placed.',\n format: 'icu-message',\n messageSource: '3D Secure expired. Go back to the checkout to place your order again.',\n },\n unconfirmedMessage: {\n type: 'string',\n title: 'Message when the order could not be confirmed',\n description: 'Shown as a status when the callback gave no answer: the payment may still be processing.',\n format: 'icu-message',\n messageSource:\n 'We could not confirm your order yet. Your payment may still be processing, so please do not pay again.',\n },\n checkoutLabel: {\n type: 'string',\n title: 'Back to the checkout label',\n description: 'Label of the link back to the checkout, shown with the late-return message.',\n format: 'icu-message',\n messageSource: 'Back to the checkout',\n },\n },\n },\n});\n\nexport type ChallengeReturnProps = ComponentPropsWithRef<'div'> &\n MessageLocaleProp & {\n /** Where the late-return link goes. e.g. `{ standard: 'checkout' }` */\n checkoutHref?: PageRef | string;\n /**\n * Where the shopper lands once the order is finished. A page reference gets the order's Node id as its\n * `orderId` param. e.g. `{ standard: 'order-placed' }`\n */\n successHref?: PageRef | string;\n /** Merchant-authored copy for each state the page can end on. */\n $content?: ContentValue<typeof ChallengeReturnContent>;\n /** Compiler-injected action surface; carries `payment.gatewayCallback` and `analytics.track`. */\n $actions?: ComponentActions;\n };\n\nexport const ChallengeReturnDefinition = defineComponent<ChallengeReturnProps>({\n name: 'ChallengeReturn',\n importPath: '@vtex/faststore/components',\n component: ChallengeReturn,\n actions: { payment: ['gatewayCallback'], analytics: ['track'] },\n content: ChallengeReturnContent,\n editor: { label: 'Challenge Return', category: 'commerce' },\n schema: {\n // Literals, not shared constants: the native catalog builder extracts `schema` statically and silently\n // drops an identifier-valued default.\n checkoutHref: { type: 'link', default: { standard: 'checkout' }, label: 'Checkout page' },\n successHref: {\n type: 'link',\n default: { standard: 'order-placed' },\n fills: ['orderId'],\n label: 'Confirmation Page',\n },\n },\n guideline:\n \"The whole of the page the bank sends the shopper back to after a 3D Secure challenge: on mount it finishes the order with no click (one gateway callback for the order group in the URL, one read of the order, one purchase event) and replaces the page with the order confirmation. Place it alone on its own page, named by PlaceOrder's challengeReturnHref, never beside anything the shopper is meant to read. It renders no payment field and never pays: a shopper who returns after the verification lapsed reads an alert with a link back to the checkout, and one whose order could not be confirmed reads a status that says not to pay again, with no such link. See challenge-return.md.\",\n});\n\n/** What a result with no readable `userErrors` collapses to: this package's own code, which says nothing about the order. */\nconst PAYMENT_NETWORK_ERROR_CODE_ENTRY: PaymentUserError = {\n code: PAYMENT_NETWORK_ERROR_CODE,\n message: 'Unable to complete the request. Please try again.',\n};\n\ntype ReturnState = 'resuming' | 'done' | 'late' | 'unconfirmed';\n\n/** True when the entry carries a code the server sent: an answer about this payment, not this package's own collapse. */\nfunction carriesServerCode(userErrors: readonly PaymentUserError[]): boolean {\n return userErrors.some(\n (userError) => typeof userError?.code === 'string' && userError.code !== PAYMENT_NETWORK_ERROR_CODE,\n );\n}\n\n/** The confirmation target: the authored page filled with the Node id, or a site-relative path of the store. */\nfunction confirmationTarget(successHref: PageRef | string, orderNodeId: string): PageRef | string {\n if (typeof successHref !== 'string') {\n return { ...successHref, params: { ...successHref.params, orderId: orderNodeId } };\n }\n const destination = resolveSiteRelativeHref(successHref);\n if (destination.safe && !destination.href.includes('{')) return destination.href;\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[ChallengeReturn] successHref is not a path of this store; going to the confirmation page instead.');\n }\n return { ...ORDER_PLACED_PAGE, params: { orderId: orderNodeId } };\n}\n\ntype GatewayCallback = NonNullable<NonNullable<ComponentActions['payment']>['gatewayCallback']>;\n\ntype FinishArgs = {\n gatewayCallback: GatewayCallback | undefined;\n track: NonNullable<ComponentActions['analytics']>['track'];\n readOrder: ReturnType<typeof useSettledOrderRead>;\n replace: ReturnType<typeof useStorefrontNavigation>['replace'];\n hrefFor: ReturnType<typeof useStorefrontNavigation>['hrefFor'];\n successHref: PageRef | string;\n settle: (next: ReturnState) => void;\n};\n\n/** The order node id the callback settled, or the state the page ends on when it did not. */\nasync function callGateway(\n callback: GatewayCallback,\n orderGroup: string,\n): Promise<{ orderNodeId: string } | { failedState: ReturnState }> {\n let result: Awaited<ReturnType<GatewayCallback>>;\n try {\n result = await callback(orderGroup, { acceptChallenges: true });\n } catch {\n return { failedState: 'unconfirmed' };\n }\n\n const userErrors = Array.isArray(result?.userErrors) ? result.userErrors : [PAYMENT_NETWORK_ERROR_CODE_ENTRY];\n if (userErrors.length > 0) return { failedState: carriesServerCode(userErrors) ? 'late' : 'unconfirmed' };\n\n // The order may well be placed, but nothing can address its confirmation, so nothing is reported and\n // nowhere is navigated to.\n const orderNodeId = result.orderNodeId ?? null;\n return orderNodeId === null ? { failedState: 'unconfirmed' } : { orderNodeId };\n}\n\n/** Reports the purchase and goes to the confirmation page; the state the page ends on. */\nasync function reportAndConfirm(\n { track, readOrder, replace, hrefFor, successHref }: Omit<FinishArgs, 'gatewayCallback' | 'settle'>,\n orderNodeId: string,\n): Promise<ReturnState> {\n await emitPurchaseForOrder({ track, readOrder, orderNodeId });\n const confirmation = confirmationTarget(successHref, orderNodeId);\n // The order is placed and reported, so a confirmation page the store cannot reach, or a router that\n // throws, must not leave a blank page or a status that never ends. It reads as the unconfirmed state:\n // the payment may be done, so no message tells the shopper to pay again and none links back to the checkout.\n if (hrefFor(confirmation) === null) return 'unconfirmed';\n try {\n replace(confirmation);\n } catch {\n console.error('[ChallengeReturn] could not go to the confirmation page');\n return 'unconfirmed';\n }\n return 'done';\n}\n\nasync function finishChallengeReturn({ gatewayCallback, settle, ...rest }: FinishArgs): Promise<void> {\n const returned = readChallengeReturn(globalThis.location.search);\n if (returned === null) {\n settle('late');\n return;\n }\n\n if (!gatewayCallback) {\n console.error('[ChallengeReturn] the payment action namespace is not injected');\n settle('unconfirmed');\n return;\n }\n\n const outcome = await callGateway(gatewayCallback, returned.orderGroup);\n if ('failedState' in outcome) {\n settle(outcome.failedState);\n return;\n }\n settle(await reportAndConfirm(rest, outcome.orderNodeId));\n}\n\nexport function ChallengeReturn({\n $content,\n $locale,\n checkoutHref = CHECKOUT_PAGE,\n successHref = ORDER_PLACED_PAGE,\n $actions: $actionsProp,\n className,\n ref,\n ...props\n}: ChallengeReturnProps) {\n const $actions = useActionsOverride($actionsProp);\n const { format } = useMessageFormatter(ChallengeReturnContent, $content);\n const gatewayCallback = $actions?.payment?.gatewayCallback;\n const track = $actions?.analytics?.track;\n const readOrder = useSettledOrderRead();\n const { replace, hrefFor } = useStorefrontNavigation();\n const [state, setState] = useState<ReturnState>('resuming');\n // StrictMode runs an effect twice, and a second callback on an order already being finished is a repeat\n // of a call whose behaviour on repetition is unmeasured. The ref survives the simulated remount, and also\n // keeps a re-render that hands the effect new dependencies from starting the sequence again.\n const startedRef = useRef(false);\n // Whether the page is still mounted. The sequence outlives a render, so a result that lands after the\n // shopper left must not write state. It is a ref, not a flag local to the effect: StrictMode's simulated\n // cleanup would cancel the one sequence there is, and the second run is barred from starting another.\n const mountedRef = useRef(false);\n\n useEffect(() => {\n mountedRef.current = true;\n if (!startedRef.current) {\n startedRef.current = true;\n const settle = (next: ReturnState) => {\n if (mountedRef.current) setState(next);\n };\n void finishChallengeReturn({ gatewayCallback, track, readOrder, replace, hrefFor, successHref, settle });\n }\n return () => {\n mountedRef.current = false;\n };\n }, [gatewayCallback, track, readOrder, replace, hrefFor, successHref]);\n\n return (\n <div {...props} ref={ref} className={className} data-fs-challenge-return=\"\">\n {state === 'resuming' ? <output data-fs-challenge-return-resuming=\"\">{format('resumingMessage')}</output> : null}\n {state === 'late' ? (\n <div role=\"alert\" data-fs-challenge-return-late=\"\">\n <span data-fs-challenge-return-message=\"\">{format('lateReturnMessage')}</span>\n <StorefrontLink href={checkoutHref} data-fs-challenge-return-checkout-link=\"\">\n {format('checkoutLabel')}\n </StorefrontLink>\n </div>\n ) : null}\n {state === 'unconfirmed' ? (\n <output data-fs-challenge-return-unconfirmed=\"\">{format('unconfirmedMessage')}</output>\n ) : null}\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1,22 +1,90 @@
|
|
|
1
|
+
import { ContentTypeDefinition, 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
|
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
4
5
|
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
5
6
|
//#region src/matter/client-preferences/client-preferences-fieldset.d.ts
|
|
7
|
+
export declare const ClientPreferencesFieldsetContent: {
|
|
8
|
+
readonly id: "client-preferences-fieldset";
|
|
9
|
+
readonly title: "Client Preferences Fieldset";
|
|
10
|
+
readonly description: "The preferences fieldset's loading and loaded announcements and its accessible group name.";
|
|
11
|
+
readonly schema: {
|
|
12
|
+
readonly type: "object";
|
|
13
|
+
readonly additionalProperties: false;
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly loadingLabel: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly title: "Loading announcement";
|
|
18
|
+
readonly format: "icu-message";
|
|
19
|
+
readonly messageSource: "Loading your preferences";
|
|
20
|
+
};
|
|
21
|
+
readonly loadedLabel: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly title: "Loaded announcement";
|
|
24
|
+
readonly format: "icu-message";
|
|
25
|
+
readonly messageSource: "Your preferences are ready";
|
|
26
|
+
};
|
|
27
|
+
readonly groupLabel: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly title: "Accessible group name";
|
|
30
|
+
readonly format: "icu-message";
|
|
31
|
+
readonly messageSource: "Your preferences";
|
|
32
|
+
readonly messageOptional: true;
|
|
33
|
+
};
|
|
34
|
+
readonly genericErrorMessage: {
|
|
35
|
+
readonly type: "string";
|
|
36
|
+
readonly title: "Generic error message";
|
|
37
|
+
readonly description: "Shown by FormError when the preferences could not be saved.";
|
|
38
|
+
readonly format: "icu-message";
|
|
39
|
+
readonly messageSource: "Unable to save your preferences. Please try again.";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const ClientPreferencesNewsletterControlContent: {
|
|
45
|
+
readonly id: "client-preferences-newsletter";
|
|
46
|
+
readonly title: "Client Preferences Newsletter Control";
|
|
47
|
+
readonly description: "The newsletter opt-in's label.";
|
|
48
|
+
readonly schema: {
|
|
49
|
+
readonly type: "object";
|
|
50
|
+
readonly additionalProperties: false;
|
|
51
|
+
readonly properties: {
|
|
52
|
+
readonly label: {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
readonly title: "Label";
|
|
55
|
+
readonly format: "icu-message";
|
|
56
|
+
readonly messageSource: "Email me with news and offers";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export declare const ClientPreferencesSavePersonalDataControlContent: {
|
|
62
|
+
readonly id: "client-preferences-save-data";
|
|
63
|
+
readonly title: "Client Preferences Save Personal Data Control";
|
|
64
|
+
readonly description: "The save-personal-data opt-in's label.";
|
|
65
|
+
readonly schema: {
|
|
66
|
+
readonly type: "object";
|
|
67
|
+
readonly additionalProperties: false;
|
|
68
|
+
readonly properties: {
|
|
69
|
+
readonly label: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly title: "Label";
|
|
72
|
+
readonly format: "icu-message";
|
|
73
|
+
readonly messageSource: "Save my information for next time";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
6
78
|
/** The `$data` slice forwarded by the reactive runtime — the ClientPreferences sibling entity, unwrapped. */
|
|
7
79
|
export type ClientPreferencesFieldsetData = {
|
|
8
80
|
optinNewsLetter?: boolean | null;
|
|
9
81
|
savePersonalData?: boolean | null;
|
|
10
82
|
} | null;
|
|
11
|
-
export type ClientPreferencesFieldsetProps = {
|
|
83
|
+
export type ClientPreferencesFieldsetProps = MessageLocaleProp & {
|
|
12
84
|
/** Placeholder rows the loading skeleton draws. Set it to the number of controls composed here. */
|
|
13
85
|
skeletonCount?: number;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** Announced politely once the controls mount. Blank means no announcement. */
|
|
17
|
-
loadedLabel?: string;
|
|
18
|
-
/** Accessible name of the `<fieldset>` group. Blank means no name is exposed. */
|
|
19
|
-
groupLabel?: string;
|
|
86
|
+
/** The loading and loaded announcements and the accessible group name. */
|
|
87
|
+
$content?: ContentValue<typeof ClientPreferencesFieldsetContent>;
|
|
20
88
|
className?: string;
|
|
21
89
|
children?: ReactNode;
|
|
22
90
|
/** `ClientPreferencesFieldsetData` slice forwarded by the reactive runtime. */
|
|
@@ -24,16 +92,17 @@ export type ClientPreferencesFieldsetProps = {
|
|
|
24
92
|
/** Compiler-injected; carries `identity.clientPreferencesUpdate`. */
|
|
25
93
|
$actions?: ComponentActions;
|
|
26
94
|
};
|
|
27
|
-
type PreferenceControlProps = {
|
|
28
|
-
label
|
|
95
|
+
type PreferenceControlProps<T extends ContentTypeDefinition> = MessageLocaleProp & {
|
|
96
|
+
/** The control's label. */
|
|
97
|
+
$content?: ContentValue<T>;
|
|
29
98
|
className?: string;
|
|
30
99
|
children?: ReactNode;
|
|
31
100
|
};
|
|
32
|
-
export type ClientPreferencesNewsletterControlProps = PreferenceControlProps
|
|
33
|
-
export type ClientPreferencesSavePersonalDataControlProps = PreferenceControlProps
|
|
101
|
+
export type ClientPreferencesNewsletterControlProps = PreferenceControlProps<typeof ClientPreferencesNewsletterControlContent>;
|
|
102
|
+
export type ClientPreferencesSavePersonalDataControlProps = PreferenceControlProps<typeof ClientPreferencesSavePersonalDataControlContent>;
|
|
34
103
|
export declare const ClientPreferencesFieldsetDefinition: ComponentDefinition<ClientPreferencesFieldsetProps>;
|
|
35
|
-
export declare const ClientPreferencesNewsletterControlDefinition: ComponentDefinition<
|
|
36
|
-
export declare const ClientPreferencesSavePersonalDataControlDefinition: ComponentDefinition<
|
|
104
|
+
export declare const ClientPreferencesNewsletterControlDefinition: ComponentDefinition<ClientPreferencesNewsletterControlProps>;
|
|
105
|
+
export declare const ClientPreferencesSavePersonalDataControlDefinition: ComponentDefinition<ClientPreferencesSavePersonalDataControlProps>;
|
|
37
106
|
/**
|
|
38
107
|
* Registers a batched write of the `ClientPreferences` entity with the enclosing `FormRoot`
|
|
39
108
|
* (`registerFieldset`, namespace `clientPreferences`) on mount, unconditionally — so this fieldset keeps
|
|
@@ -56,10 +125,10 @@ export declare const ClientPreferencesSavePersonalDataControlDefinition: Compone
|
|
|
56
125
|
* the slice arrives as a plain prop.
|
|
57
126
|
*
|
|
58
127
|
* Both ends of that wait are spoken: the fieldset carries `aria-busy` while it lasts and holds a polite
|
|
59
|
-
* live region that announces `loadingLabel` and then `loadedLabel
|
|
128
|
+
* live region that announces the `loadingLabel` and then the `loadedLabel` message. Style the region `sr-only` — it is
|
|
60
129
|
* text meant for a screen reader, not for the page.
|
|
61
130
|
*/
|
|
62
|
-
export declare function ClientPreferencesFieldset({ skeletonCount,
|
|
131
|
+
export declare function ClientPreferencesFieldset({ skeletonCount, $content, $locale, className, children, $data: $dataProp, $actions: $actionsProp }: ClientPreferencesFieldsetProps): import("react/jsx-runtime").JSX.Element;
|
|
63
132
|
export declare namespace ClientPreferencesFieldset {
|
|
64
133
|
var Skeleton: typeof ClientPreferencesFieldsetSkeleton;
|
|
65
134
|
}
|
|
@@ -71,7 +140,7 @@ export declare namespace ClientPreferencesFieldset {
|
|
|
71
140
|
export declare function ClientPreferencesFieldsetSkeleton({ count, className, ...props }: ComponentPropsWithRef<'div'> & {
|
|
72
141
|
count?: number;
|
|
73
142
|
}): import("react/jsx-runtime").JSX.Element;
|
|
74
|
-
export declare function ClientPreferencesNewsletterControl({
|
|
75
|
-
export declare function ClientPreferencesSavePersonalDataControl({
|
|
143
|
+
export declare function ClientPreferencesNewsletterControl({ $content, $locale, className, children }: ClientPreferencesNewsletterControlProps): import("react/jsx-runtime").JSX.Element;
|
|
144
|
+
export declare function ClientPreferencesSavePersonalDataControl({ $content, $locale, className, children }: ClientPreferencesSavePersonalDataControlProps): import("react/jsx-runtime").JSX.Element;
|
|
76
145
|
//#endregion
|
|
77
146
|
//# sourceMappingURL=client-preferences-fieldset.d.ts.map
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
3
4
|
import "../../core/dist/index.js";
|
|
5
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
4
6
|
import { Checkbox } from "../../particles/checkbox/checkbox.js";
|
|
5
7
|
import { Field, FieldBinding, FieldsetFieldContext, useFieldsetField, useFieldsetFieldNames, useNoAncestorFieldset } from "../../particles/field/field.js";
|
|
6
8
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
9
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
7
10
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
8
11
|
import { useSession } from "../session/session.js";
|
|
9
|
-
import { useFormRegistry } from "../../particles/form/form.js";
|
|
10
|
-
import { Icon } from "../../particles/icon/icon.js";
|
|
11
12
|
import { useEntityDataResolved } from "../../sdk/data/entity-resolution-context.js";
|
|
12
13
|
import { useReactiveDataSettled } from "../../sdk/data/use-reactive-data-settled.js";
|
|
14
|
+
import { useFormRegistry } from "../../particles/form/form.js";
|
|
15
|
+
import { Icon } from "../../particles/icon/icon.js";
|
|
13
16
|
import { Fieldset } from "../../particles/fieldset/fieldset.js";
|
|
14
17
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
15
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -39,6 +42,90 @@ const fragment = `
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
`;
|
|
45
|
+
const ClientPreferencesFieldsetContent = defineContentType({
|
|
46
|
+
id: "client-preferences-fieldset",
|
|
47
|
+
title: "Client Preferences Fieldset",
|
|
48
|
+
description: "The preferences fieldset's loading and loaded announcements and its accessible group name.",
|
|
49
|
+
schema: {
|
|
50
|
+
type: "object",
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
properties: {
|
|
53
|
+
loadingLabel: {
|
|
54
|
+
type: "string",
|
|
55
|
+
title: "Loading announcement",
|
|
56
|
+
format: "icu-message",
|
|
57
|
+
messageSource: "Loading your preferences"
|
|
58
|
+
},
|
|
59
|
+
loadedLabel: {
|
|
60
|
+
type: "string",
|
|
61
|
+
title: "Loaded announcement",
|
|
62
|
+
format: "icu-message",
|
|
63
|
+
messageSource: "Your preferences are ready"
|
|
64
|
+
},
|
|
65
|
+
groupLabel: {
|
|
66
|
+
type: "string",
|
|
67
|
+
title: "Accessible group name",
|
|
68
|
+
format: "icu-message",
|
|
69
|
+
messageSource: "Your preferences",
|
|
70
|
+
messageOptional: true
|
|
71
|
+
},
|
|
72
|
+
genericErrorMessage: {
|
|
73
|
+
type: "string",
|
|
74
|
+
title: "Generic error message",
|
|
75
|
+
description: "Shown by FormError when the preferences could not be saved.",
|
|
76
|
+
format: "icu-message",
|
|
77
|
+
messageSource: "Unable to save your preferences. Please try again."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* The message for each refusal of the preferences write: every `ClientPreferencesUpdateErrorCode` plus
|
|
84
|
+
* the client-minted transport failure. None is a fault the shopper can fix, so all share one message.
|
|
85
|
+
* `dispatch` hands `FormError` this copy, and genericErrorMessage for an unknown code.
|
|
86
|
+
*/
|
|
87
|
+
const CLIENT_PREFERENCES_FIELDSET_ERROR_FIELDS = {
|
|
88
|
+
MISSING_CART_CONTEXT: "genericErrorMessage",
|
|
89
|
+
CART_NOT_FOUND: "genericErrorMessage",
|
|
90
|
+
NO_PREFERENCE_PROVIDED: "genericErrorMessage",
|
|
91
|
+
NETWORK_ERROR: "genericErrorMessage"
|
|
92
|
+
};
|
|
93
|
+
function wordClientPreferencesError(error, { format }) {
|
|
94
|
+
return {
|
|
95
|
+
code: error.code,
|
|
96
|
+
message: formatErrorCode(ClientPreferencesFieldsetContent, CLIENT_PREFERENCES_FIELDSET_ERROR_FIELDS, error, format, "genericErrorMessage")
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const ClientPreferencesNewsletterControlContent = defineContentType({
|
|
100
|
+
id: "client-preferences-newsletter",
|
|
101
|
+
title: "Client Preferences Newsletter Control",
|
|
102
|
+
description: "The newsletter opt-in's label.",
|
|
103
|
+
schema: {
|
|
104
|
+
type: "object",
|
|
105
|
+
additionalProperties: false,
|
|
106
|
+
properties: { label: {
|
|
107
|
+
type: "string",
|
|
108
|
+
title: "Label",
|
|
109
|
+
format: "icu-message",
|
|
110
|
+
messageSource: "Email me with news and offers"
|
|
111
|
+
} }
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
const ClientPreferencesSavePersonalDataControlContent = defineContentType({
|
|
115
|
+
id: "client-preferences-save-data",
|
|
116
|
+
title: "Client Preferences Save Personal Data Control",
|
|
117
|
+
description: "The save-personal-data opt-in's label.",
|
|
118
|
+
schema: {
|
|
119
|
+
type: "object",
|
|
120
|
+
additionalProperties: false,
|
|
121
|
+
properties: { label: {
|
|
122
|
+
type: "string",
|
|
123
|
+
title: "Label",
|
|
124
|
+
format: "icu-message",
|
|
125
|
+
messageSource: "Save my information for next time"
|
|
126
|
+
} }
|
|
127
|
+
}
|
|
128
|
+
});
|
|
42
129
|
/** No control publishes a rule today (Decision 6) — kept as a stable empty object so the context
|
|
43
130
|
* value's identity does not churn on every render. */
|
|
44
131
|
const NO_RULES = {};
|
|
@@ -60,6 +147,7 @@ const ClientPreferencesFieldsetDefinition = defineComponent({
|
|
|
60
147
|
name: "ClientPreferencesFieldset",
|
|
61
148
|
importPath: "@vtex/faststore/components",
|
|
62
149
|
component: ClientPreferencesFieldset,
|
|
150
|
+
content: ClientPreferencesFieldsetContent,
|
|
63
151
|
fragment,
|
|
64
152
|
fetchStrategy: "reactive",
|
|
65
153
|
skeleton: ClientPreferencesFieldsetSkeleton,
|
|
@@ -70,61 +158,40 @@ const ClientPreferencesFieldsetDefinition = defineComponent({
|
|
|
70
158
|
label: "Client Preferences Fieldset",
|
|
71
159
|
category: "identity"
|
|
72
160
|
},
|
|
73
|
-
schema: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
loadingLabel: {
|
|
80
|
-
type: "string",
|
|
81
|
-
default: "Loading your preferences",
|
|
82
|
-
label: "Loading announcement"
|
|
83
|
-
},
|
|
84
|
-
loadedLabel: {
|
|
85
|
-
type: "string",
|
|
86
|
-
default: "Your preferences are ready",
|
|
87
|
-
label: "Loaded announcement"
|
|
88
|
-
},
|
|
89
|
-
groupLabel: {
|
|
90
|
-
type: "string",
|
|
91
|
-
default: "Your preferences",
|
|
92
|
-
label: "Accessible group name"
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
guideline: "Registers a batched write of the ClientPreferences entity with the enclosing FormRoot; renders one Fieldset.Root and no <form>. Distinct from ClientPreferencesRoot (matter/client-preferences), which writes on toggle and requires client-preferences-toggle — the two cannot compile into each other's container. Must be inside a FormRoot with a SessionRoot ancestor. Compose ClientPreferencesNewsletterControl and/or ClientPreferencesSavePersonalDataControl as children. The controls mount only once the preferences have resolved, with skeletonCount placeholder rows in their place until then — set it to the number of controls composed, or the form jumps by the difference. Style the announcement sr-only. Dispatches only the flags the shopper changed. groupLabel names the group as its accessible name; blank emits no aria-label, and a composed FieldsetLegend wins over it."
|
|
161
|
+
schema: { skeletonCount: {
|
|
162
|
+
type: "number",
|
|
163
|
+
default: 2,
|
|
164
|
+
label: "Skeleton rows"
|
|
165
|
+
} },
|
|
166
|
+
guideline: "Registers a batched write of the ClientPreferences entity with the enclosing FormRoot; renders one Fieldset.Root and no <form>. Distinct from ClientPreferencesRoot (matter/client-preferences), which writes on toggle and requires client-preferences-toggle — the two cannot compile into each other's container. Must be inside a FormRoot with a SessionRoot ancestor. Compose ClientPreferencesNewsletterControl and/or ClientPreferencesSavePersonalDataControl as children. The controls mount only once the preferences have resolved, with skeletonCount placeholder rows in their place until then — set it to the number of controls composed, or the form jumps by the difference. Style the announcement sr-only; it reads the $content fields loadingLabel and loadedLabel. Dispatches only the flags the shopper changed. The $content field groupLabel names the group as its accessible name; an unauthored one emits no aria-label, and a composed FieldsetLegend wins over it."
|
|
96
167
|
});
|
|
97
168
|
const ClientPreferencesNewsletterControlDefinition = defineComponent({
|
|
98
169
|
name: "ClientPreferencesNewsletterControl",
|
|
99
170
|
importPath: "@vtex/faststore/components",
|
|
100
171
|
component: ClientPreferencesNewsletterControl,
|
|
172
|
+
content: ClientPreferencesNewsletterControlContent,
|
|
101
173
|
requiresContext: "client-preferences",
|
|
102
174
|
providesContext: "field",
|
|
103
175
|
editor: {
|
|
104
176
|
label: "Client Preferences Newsletter Control",
|
|
105
177
|
category: "identity"
|
|
106
178
|
},
|
|
107
|
-
schema: {
|
|
108
|
-
|
|
109
|
-
label: "Label"
|
|
110
|
-
} },
|
|
111
|
-
guideline: "The bound newsletter opt-in control; must be a descendant of ClientPreferencesFieldset. Renders Field.Root > Field.Label > Field.Checkbox by default, or the composed children in the author's own order. Defaults to unchecked."
|
|
179
|
+
schema: {},
|
|
180
|
+
guideline: "The bound newsletter opt-in control, labelled by the $content field label; must be a descendant of ClientPreferencesFieldset. Renders Field.Root > Field.Label > Field.Checkbox by default, or the composed children in the author's own order. Defaults to unchecked."
|
|
112
181
|
});
|
|
113
182
|
const ClientPreferencesSavePersonalDataControlDefinition = defineComponent({
|
|
114
183
|
name: "ClientPreferencesSavePersonalDataControl",
|
|
115
184
|
importPath: "@vtex/faststore/components",
|
|
116
185
|
component: ClientPreferencesSavePersonalDataControl,
|
|
186
|
+
content: ClientPreferencesSavePersonalDataControlContent,
|
|
117
187
|
requiresContext: "client-preferences",
|
|
118
188
|
providesContext: "field",
|
|
119
189
|
editor: {
|
|
120
190
|
label: "Client Preferences Save Personal Data Control",
|
|
121
191
|
category: "identity"
|
|
122
192
|
},
|
|
123
|
-
schema: {
|
|
124
|
-
|
|
125
|
-
label: "Label"
|
|
126
|
-
} },
|
|
127
|
-
guideline: "The bound save-personal-data opt-in control; must be a descendant of ClientPreferencesFieldset. Renders Field.Root > Field.Label > Field.Checkbox by default, or the composed children in the author's own order. Defaults to unchecked."
|
|
193
|
+
schema: {},
|
|
194
|
+
guideline: "The bound save-personal-data opt-in control, labelled by the $content field label; must be a descendant of ClientPreferencesFieldset. Renders Field.Root > Field.Label > Field.Checkbox by default, or the composed children in the author's own order. Defaults to unchecked."
|
|
128
195
|
});
|
|
129
196
|
/**
|
|
130
197
|
* Registers a batched write of the `ClientPreferences` entity with the enclosing `FormRoot`
|
|
@@ -148,13 +215,16 @@ const ClientPreferencesSavePersonalDataControlDefinition = defineComponent({
|
|
|
148
215
|
* the slice arrives as a plain prop.
|
|
149
216
|
*
|
|
150
217
|
* Both ends of that wait are spoken: the fieldset carries `aria-busy` while it lasts and holds a polite
|
|
151
|
-
* live region that announces `loadingLabel` and then `loadedLabel
|
|
218
|
+
* live region that announces the `loadingLabel` and then the `loadedLabel` message. Style the region `sr-only` — it is
|
|
152
219
|
* text meant for a screen reader, not for the page.
|
|
153
220
|
*/
|
|
154
|
-
function ClientPreferencesFieldset({ skeletonCount = CLIENT_PREFERENCES_SKELETON_ROWS,
|
|
221
|
+
function ClientPreferencesFieldset({ skeletonCount = CLIENT_PREFERENCES_SKELETON_ROWS, $content, $locale, className, children, $data: $dataProp, $actions: $actionsProp }) {
|
|
155
222
|
useNoAncestorFieldset("ClientPreferencesFieldset");
|
|
156
223
|
const $data = useDataOverride($dataProp);
|
|
157
224
|
const $actions = useActionsOverride($actionsProp);
|
|
225
|
+
const messages = useMessageFormatter(ClientPreferencesFieldsetContent, $content);
|
|
226
|
+
const { format } = messages;
|
|
227
|
+
const groupLabel = format("groupLabel");
|
|
158
228
|
const settled = useReactiveDataSettled();
|
|
159
229
|
const sliceResolved = useEntityDataResolved();
|
|
160
230
|
const resolved = settled && sliceResolved && $data !== void 0;
|
|
@@ -165,25 +235,28 @@ function ClientPreferencesFieldset({ skeletonCount = CLIENT_PREFERENCES_SKELETON
|
|
|
165
235
|
const latest = useRef({
|
|
166
236
|
$actions,
|
|
167
237
|
readOnly,
|
|
168
|
-
getFieldState
|
|
238
|
+
getFieldState,
|
|
239
|
+
messages
|
|
169
240
|
});
|
|
170
241
|
useEffect(() => {
|
|
171
242
|
latest.current = {
|
|
172
243
|
$actions,
|
|
173
244
|
readOnly,
|
|
174
|
-
getFieldState
|
|
245
|
+
getFieldState,
|
|
246
|
+
messages
|
|
175
247
|
};
|
|
176
248
|
}, [
|
|
177
249
|
$actions,
|
|
178
250
|
readOnly,
|
|
179
|
-
getFieldState
|
|
251
|
+
getFieldState,
|
|
252
|
+
messages
|
|
180
253
|
]);
|
|
181
254
|
const { registry: fieldsetRegistry, getFieldNames } = useFieldsetFieldNames("clientPreferences");
|
|
182
255
|
const dispatch = useCallback(async (payload) => {
|
|
183
256
|
if (latest.current.readOnly) throw new Error("ClientPreferencesFieldset cannot dispatch while the session is read-only.");
|
|
184
257
|
const update = latest.current.$actions?.identity?.clientPreferencesUpdate;
|
|
185
258
|
if (!update) throw new Error("ClientPreferencesFieldset requires $actions.identity.clientPreferencesUpdate.");
|
|
186
|
-
return update(payload);
|
|
259
|
+
return (await update(payload)).map((error) => wordClientPreferencesError(error, latest.current.messages));
|
|
187
260
|
}, []);
|
|
188
261
|
const toPayload = useCallback((values) => {
|
|
189
262
|
const { getFieldState } = latest.current;
|
|
@@ -216,7 +289,7 @@ function ClientPreferencesFieldset({ skeletonCount = CLIENT_PREFERENCES_SKELETON
|
|
|
216
289
|
rules: NO_RULES
|
|
217
290
|
}), [saved, readOnly]);
|
|
218
291
|
const [announcement, setAnnouncement] = useState("");
|
|
219
|
-
const announced = resolved ? loadedLabel : loadingLabel;
|
|
292
|
+
const announced = format(resolved ? "loadedLabel" : "loadingLabel");
|
|
220
293
|
useEffect(() => {
|
|
221
294
|
setAnnouncement(announced);
|
|
222
295
|
}, [announced]);
|
|
@@ -224,7 +297,7 @@ function ClientPreferencesFieldset({ skeletonCount = CLIENT_PREFERENCES_SKELETON
|
|
|
224
297
|
className,
|
|
225
298
|
disabled: readOnly,
|
|
226
299
|
"aria-busy": resolved ? void 0 : true,
|
|
227
|
-
...groupLabel
|
|
300
|
+
...groupLabel.trim() ? { "aria-label": groupLabel } : {},
|
|
228
301
|
"data-fs-client-preferences-fieldset": "",
|
|
229
302
|
...resolved ? {} : { "data-fs-client-preferences-fieldset-pending": "" },
|
|
230
303
|
...readOnly ? { "data-fs-client-preferences-fieldset-readonly": "" } : {},
|
|
@@ -256,44 +329,43 @@ function ClientPreferencesFieldsetSkeleton({ count = CLIENT_PREFERENCES_SKELETON
|
|
|
256
329
|
});
|
|
257
330
|
}
|
|
258
331
|
ClientPreferencesFieldset.Skeleton = ClientPreferencesFieldsetSkeleton;
|
|
259
|
-
function PreferenceControl({ fieldKey, attr,
|
|
332
|
+
function PreferenceControl({ fieldKey, attr, label, className, children }) {
|
|
260
333
|
const { namespace, saved, readOnly, rules } = useClientPreferencesFieldsetContext();
|
|
261
334
|
const name = useFieldsetField(namespace, fieldKey);
|
|
262
|
-
const resolvedLabel = label ?? defaultLabel;
|
|
263
335
|
return /* @__PURE__ */ jsx(FieldBinding, {
|
|
264
336
|
name,
|
|
265
|
-
label
|
|
337
|
+
label,
|
|
266
338
|
defaultValue: saved[fieldKey],
|
|
267
339
|
rule: rules[fieldKey],
|
|
268
340
|
disabled: readOnly,
|
|
269
341
|
children: /* @__PURE__ */ jsx(Field.Root, {
|
|
270
342
|
className,
|
|
271
343
|
"data-fs-client-preferences-fieldset-field": attr,
|
|
272
|
-
children: children ?? /* @__PURE__ */ jsxs(Field.Label, { children: [/* @__PURE__ */ jsx(Field.Checkbox, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(Icon, { name: "checked" }) }) }),
|
|
344
|
+
children: children ?? /* @__PURE__ */ jsxs(Field.Label, { children: [/* @__PURE__ */ jsx(Field.Checkbox, { children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(Icon, { name: "checked" }) }) }), label] })
|
|
273
345
|
})
|
|
274
346
|
});
|
|
275
347
|
}
|
|
276
|
-
function ClientPreferencesNewsletterControl({
|
|
348
|
+
function ClientPreferencesNewsletterControl({ $content, $locale, className, children }) {
|
|
349
|
+
const { format } = useMessageFormatter(ClientPreferencesNewsletterControlContent, $content);
|
|
277
350
|
return /* @__PURE__ */ jsx(PreferenceControl, {
|
|
278
351
|
fieldKey: "optinNewsLetter",
|
|
279
352
|
attr: "newsletter",
|
|
280
|
-
|
|
281
|
-
label,
|
|
353
|
+
label: format("label"),
|
|
282
354
|
className,
|
|
283
355
|
children
|
|
284
356
|
});
|
|
285
357
|
}
|
|
286
|
-
function ClientPreferencesSavePersonalDataControl({
|
|
358
|
+
function ClientPreferencesSavePersonalDataControl({ $content, $locale, className, children }) {
|
|
359
|
+
const { format } = useMessageFormatter(ClientPreferencesSavePersonalDataControlContent, $content);
|
|
287
360
|
return /* @__PURE__ */ jsx(PreferenceControl, {
|
|
288
361
|
fieldKey: "savePersonalData",
|
|
289
362
|
attr: "save-personal-data",
|
|
290
|
-
|
|
291
|
-
label,
|
|
363
|
+
label: format("label"),
|
|
292
364
|
className,
|
|
293
365
|
children
|
|
294
366
|
});
|
|
295
367
|
}
|
|
296
368
|
//#endregion
|
|
297
|
-
export { ClientPreferencesFieldset, ClientPreferencesFieldsetDefinition, ClientPreferencesFieldsetSkeleton, ClientPreferencesNewsletterControl, ClientPreferencesNewsletterControlDefinition, ClientPreferencesSavePersonalDataControl, ClientPreferencesSavePersonalDataControlDefinition };
|
|
369
|
+
export { CLIENT_PREFERENCES_FIELDSET_ERROR_FIELDS, ClientPreferencesFieldset, ClientPreferencesFieldsetContent, ClientPreferencesFieldsetDefinition, ClientPreferencesFieldsetSkeleton, ClientPreferencesNewsletterControl, ClientPreferencesNewsletterControlContent, ClientPreferencesNewsletterControlDefinition, ClientPreferencesSavePersonalDataControl, ClientPreferencesSavePersonalDataControlContent, ClientPreferencesSavePersonalDataControlDefinition };
|
|
298
370
|
|
|
299
371
|
//# sourceMappingURL=client-preferences-fieldset.js.map
|