@vtex/faststore 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +0 -1
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/actions.json +6 -1
- package/dist/catalog.json +789 -1701
- package/dist/cli/index.d.ts +66 -28
- package/dist/cli/index.js +7371 -512
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-runtime.js +41 -60
- package/dist/cli/server-runtime.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/components.d.ts +63 -57
- package/dist/components.js +60 -54
- package/dist/content-types.json +5785 -754
- package/dist/core/dist/define-component.d.ts +1 -1
- package/dist/core/dist/define-content-type.d.ts +50 -2
- package/dist/core/dist/define-content-type.js +107 -3
- package/dist/core/dist/define-content-type.js.map +1 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/access-code-field.md +1 -1
- package/dist/docs/access-code-sign-in.md +126 -77
- package/dist/docs/account-address-book.md +210 -95
- package/dist/docs/account-menu.md +14 -15
- package/dist/docs/account-saved-cards.md +44 -39
- package/dist/docs/alert-dialog.md +3 -1
- package/dist/docs/avatar.md +4 -2
- package/dist/docs/billing-address.md +99 -30
- package/dist/docs/binding-switcher.md +5 -2
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +39 -26
- package/dist/docs/card-summary.md +18 -8
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +39 -26
- package/dist/docs/cart-item.md +29 -14
- package/dist/docs/cart-totalizer.md +7 -5
- package/dist/docs/cart.md +135 -41
- package/dist/docs/challenge-return.md +135 -0
- package/dist/docs/client-preferences-fieldset.md +10 -5
- package/dist/docs/client-preferences.md +31 -8
- package/dist/docs/client-profile-fieldset.md +20 -6
- package/dist/docs/client-profile.md +12 -3
- package/dist/docs/copy-text.md +9 -7
- package/dist/docs/document-field.md +1 -1
- package/dist/docs/email-field.md +2 -1
- package/dist/docs/email-identification.md +12 -2
- package/dist/docs/footer-copyright.md +4 -2
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +6 -5
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/installments.md +46 -32
- package/dist/docs/my-account-profile.md +16 -11
- package/dist/docs/navigation-link.md +5 -3
- package/dist/docs/order-cancel.md +3 -1
- package/dist/docs/order-delivery-address.md +7 -5
- package/dist/docs/order-delivery-group.md +1 -3
- package/dist/docs/order-details-back.md +1 -1
- package/dist/docs/order-details-header.md +1 -4
- package/dist/docs/order-invoice-download.md +60 -0
- package/dist/docs/order-list-row.md +1 -1
- package/dist/docs/order-list-search.md +13 -20
- package/dist/docs/order-list-views.md +11 -17
- package/dist/docs/order-list.md +12 -5
- package/dist/docs/order-payment.md +9 -7
- package/dist/docs/order-placed-date.md +1 -1
- package/dist/docs/order-placed-payment-summary.md +28 -15
- package/dist/docs/order-placed.md +49 -14
- package/dist/docs/order-progress.md +1 -1
- package/dist/docs/order-status-badge.md +20 -9
- package/dist/docs/order-summary.md +2 -2
- package/dist/docs/order-tracking-link.md +58 -0
- package/dist/docs/payment-method-badges.md +30 -4
- package/dist/docs/payment-methods.md +1 -1
- package/dist/docs/payment.md +36 -17
- package/dist/docs/phone-field.md +4 -4
- package/dist/docs/place-order.md +84 -36
- package/dist/docs/postal-code-field.md +3 -1
- package/dist/docs/pricing.md +21 -23
- package/dist/docs/product-gallery.md +19 -20
- package/dist/docs/product-information.md +13 -9
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +0 -1
- package/dist/docs/promotion.md +4 -2
- package/dist/docs/region.md +23 -15
- package/dist/docs/save-card.md +7 -6
- package/dist/docs/saved-cards.md +65 -36
- package/dist/docs/shipping-address.md +57 -21
- package/dist/docs/shipping-simulator.md +53 -15
- package/dist/docs/sign-in-disclosure.md +176 -0
- package/dist/docs/sign-in-form.md +78 -47
- package/dist/docs/sign-in-redirect.md +4 -2
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +15 -4
- package/dist/docs/variant-selector.md +15 -11
- package/dist/domain-logic/dist/checkout/rules.js +33 -0
- package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +2 -2
- package/dist/internal/client.d.ts +1 -3
- package/dist/internal/client.js +1 -1
- package/dist/internal/server.d.ts +7 -4
- package/dist/internal/server.js +7 -4
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
- package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
- package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
- package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
- package/dist/matter/account-address-book/account-address-book.js +74 -33
- package/dist/matter/account-address-book/account-address-book.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
- package/dist/matter/account-address-book/account-address-country.js +83 -49
- package/dist/matter/account-address-book/account-address-country.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
- package/dist/matter/account-address-book/account-address-form.js +518 -155
- package/dist/matter/account-address-book/account-address-form.js.map +1 -1
- package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-record.js +32 -17
- package/dist/matter/account-address-book/account-address-record.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +34 -17
- package/dist/matter/account-menu/account-menu.js +46 -54
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
- package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
- package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
- package/dist/matter/billing-address/billing-address.d.ts +156 -74
- package/dist/matter/billing-address/billing-address.js +227 -156
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
- package/dist/matter/breadcrumb/breadcrumb.js +24 -9
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/buy-button/buy-button.d.ts +8 -11
- package/dist/matter/buy-button/buy-button.js +10 -19
- package/dist/matter/buy-button/buy-button.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +12 -4
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +123 -32
- package/dist/matter/card-entry/card-entry.js +348 -221
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cart/cart-namespace.d.ts +7 -1
- package/dist/matter/cart/cart-namespace.js +7 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +402 -61
- package/dist/matter/cart/cart.js +624 -153
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
- package/dist/matter/cart-destination/cart-destination.js +160 -70
- package/dist/matter/cart-destination/cart-destination.js.map +1 -1
- package/dist/matter/cart-item/cart-item.d.ts +144 -17
- package/dist/matter/cart-item/cart-item.js +166 -49
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
- package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
- package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
- package/dist/matter/challenge-return/challenge-return.js +241 -0
- package/dist/matter/challenge-return/challenge-return.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
- package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
- package/dist/matter/client-preferences/client-preferences.js +84 -15
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +44 -9
- package/dist/matter/client-profile/client-profile.js +64 -24
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
- package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
- package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
- package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
- package/dist/matter/delivery-options/delivery-options.js +75 -12
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
- package/dist/matter/email-identification/email-identification.d.ts +25 -3
- package/dist/matter/email-identification/email-identification.js +49 -12
- package/dist/matter/email-identification/email-identification.js.map +1 -1
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
- package/dist/matter/identity-edit/identity-edit.js +47 -19
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
- package/dist/matter/identity-summary/identity-summary.js +95 -45
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +98 -16
- package/dist/matter/installments/installments-select.js +156 -48
- package/dist/matter/installments/installments-select.js.map +1 -1
- package/dist/matter/installments/installments.d.ts +96 -16
- package/dist/matter/installments/installments.js +115 -40
- package/dist/matter/installments/installments.js.map +1 -1
- package/dist/matter/installments/use-installments-selection.d.ts +1 -0
- package/dist/matter/installments/use-installments-selection.js +8 -3
- package/dist/matter/installments/use-installments-selection.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
- package/dist/matter/my-account-profile/my-account-profile.js +370 -174
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
- package/dist/matter/order-cancel/order-cancel.js +118 -51
- package/dist/matter/order-cancel/order-cancel.js.map +1 -1
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
- package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
- package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
- package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
- package/dist/matter/order-details-header/order-details-header.js +66 -58
- package/dist/matter/order-details-header/order-details-header.js.map +1 -1
- package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +164 -19
- package/dist/matter/order-list/order-list.js +229 -87
- package/dist/matter/order-list/order-list.js.map +1 -1
- package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
- package/dist/matter/order-list-row/order-list-row.js +3 -2
- package/dist/matter/order-list-row/order-list-row.js.map +1 -1
- package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
- package/dist/matter/order-list-search/order-list-search.js +30 -69
- package/dist/matter/order-list-search/order-list-search.js.map +1 -1
- package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
- package/dist/matter/order-list-views/order-list-views.js +22 -68
- package/dist/matter/order-list-views/order-list-views.js.map +1 -1
- package/dist/matter/order-payment/order-payment.d.ts +33 -10
- package/dist/matter/order-payment/order-payment.js +44 -39
- package/dist/matter/order-payment/order-payment.js.map +1 -1
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
- package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
- package/dist/matter/order-placed/order-placed.d.ts +198 -31
- package/dist/matter/order-placed/order-placed.js +230 -139
- package/dist/matter/order-placed/order-placed.js.map +1 -1
- package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
- package/dist/matter/order-placed-date/order-placed-date.js +7 -8
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +19 -8
- package/dist/matter/order-progress/order-progress.js +37 -45
- package/dist/matter/order-progress/order-progress.js.map +1 -1
- package/dist/matter/order-summary/order-summary.d.ts +19 -9
- package/dist/matter/order-summary/order-summary.js +38 -44
- package/dist/matter/order-summary/order-summary.js.map +1 -1
- package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +17 -10
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.d.ts +4 -2
- package/dist/matter/payment/payment-controller.js +30 -9
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +1 -1
- package/dist/matter/payment/payment.d.ts +69 -19
- package/dist/matter/payment/payment.js +101 -35
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
- package/dist/matter/payment/use-payment-method-selection.js +94 -32
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
- package/dist/matter/payment/use-payment-submit-gate.js +47 -8
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +171 -57
- package/dist/matter/place-order/place-order.js +376 -185
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.d.ts +152 -13
- package/dist/matter/pricing/pricing.js +153 -52
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-information/product-information.d.ts +27 -4
- package/dist/matter/product-information/product-information.js +32 -15
- package/dist/matter/product-information/product-information.js.map +1 -1
- package/dist/matter/product-list/product-list.d.ts +24 -6
- package/dist/matter/product-list/product-list.js +32 -26
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
- package/dist/matter/product-shelf/product-shelf.js +2 -15
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.d.ts +33 -16
- package/dist/matter/region/region.js +59 -52
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +43 -8
- package/dist/matter/save-card/save-card.js +61 -23
- package/dist/matter/save-card/save-card.js.map +1 -1
- package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
- package/dist/matter/saved-cards/saved-cards.js +349 -77
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/shipping-address/address-payload.js +25 -0
- package/dist/matter/shipping-address/address-payload.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +71 -71
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
- package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
- package/dist/matter/shipping-address/shipping-address.js +443 -188
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
- package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in/sign-in.d.ts +108 -0
- package/dist/matter/sign-in/sign-in.js +285 -0
- package/dist/matter/sign-in/sign-in.js.map +1 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
- package/dist/matter/sign-in-form/sign-in-form.js +134 -144
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
- package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
- package/dist/particles/binding-switcher/binding-switcher.js +37 -26
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
- package/dist/particles/card-summary/card-summary.d.ts +38 -8
- package/dist/particles/card-summary/card-summary.js +55 -22
- package/dist/particles/card-summary/card-summary.js.map +1 -1
- package/dist/particles/carousel/carousel.d.ts +99 -11
- package/dist/particles/carousel/carousel.js +103 -35
- package/dist/particles/carousel/carousel.js.map +1 -1
- package/dist/particles/copy-text/copy-text.js +5 -15
- package/dist/particles/copy-text/copy-text.js.map +1 -1
- package/dist/particles/dialog/dialog.d.ts +14 -6
- package/dist/particles/dialog/dialog.js +6 -3
- package/dist/particles/dialog/dialog.js.map +1 -1
- package/dist/particles/drawer/drawer.js +1 -1
- package/dist/particles/drawer/drawer.js.map +1 -1
- package/dist/particles/email-field/email-field.d.ts +2 -1
- package/dist/particles/email-field/email-field.js +2 -1
- package/dist/particles/email-field/email-field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.js +1 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/form/form.d.ts +85 -13
- package/dist/particles/form/form.js +91 -42
- package/dist/particles/form/form.js.map +1 -1
- package/dist/particles/gallery/gallery.d.ts +129 -12
- package/dist/particles/gallery/gallery.js +121 -34
- package/dist/particles/gallery/gallery.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
- package/dist/particles/order-details-back/order-details-back.js +8 -10
- package/dist/particles/order-details-back/order-details-back.js.map +1 -1
- package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
- package/dist/particles/order-status-badge/order-status-badge.js +4 -20
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
- package/dist/particles/password-field/password-field.d.ts +1 -1
- package/dist/particles/password-field/password-field.js +2 -4
- package/dist/particles/password-field/password-field.js.map +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +4 -4
- package/dist/particles/phone-field/phone-field.js +8 -11
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/spinner/spinner.d.ts +24 -4
- package/dist/particles/spinner/spinner.js +25 -9
- package/dist/particles/spinner/spinner.js.map +1 -1
- package/dist/particles/switch/switch.d.ts +4 -1
- package/dist/particles/switch/switch.js +3 -1
- package/dist/particles/switch/switch.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +29 -3
- package/dist/particles/toast/toast.js +34 -10
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +164 -56
- package/dist/sdk/address/address-fields.js +4 -4
- package/dist/sdk/address/address-fields.js.map +1 -1
- package/dist/sdk/address/constants.js +1 -6
- package/dist/sdk/address/constants.js.map +1 -1
- package/dist/sdk/address/messages.js +44 -44
- package/dist/sdk/address/messages.js.map +1 -1
- package/dist/sdk/address/postal-code.js +15 -2
- package/dist/sdk/address/postal-code.js.map +1 -1
- package/dist/sdk/address/types.d.ts +5 -3
- package/dist/sdk/address/validate-address.js +3 -3
- package/dist/sdk/address/validate-address.js.map +1 -1
- package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/data/index.js +2 -2
- package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
- package/dist/sdk/generated/gql.js +1 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +20 -5
- package/dist/sdk/generated/graphql.js +6 -0
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/format-error-code.js +23 -0
- package/dist/sdk/i18n/format-error-code.js.map +1 -0
- package/dist/sdk/i18n/message-formatter.d.ts +22 -0
- package/dist/sdk/i18n/message-formatter.js +140 -0
- package/dist/sdk/i18n/message-formatter.js.map +1 -0
- package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
- package/dist/sdk/i18n/use-message-formatter.js +18 -0
- package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/redirect.d.ts +2 -0
- package/dist/sdk/navigation/redirect.js +19 -1
- package/dist/sdk/navigation/redirect.js.map +1 -1
- package/dist/sdk/navigation/types.d.ts +13 -0
- package/dist/sdk/payment/bin-format.js +21 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -4
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/seo/entity-landing.d.ts +24 -0
- package/dist/sdk/seo/entity-landing.js +30 -0
- package/dist/sdk/seo/entity-landing.js.map +1 -0
- package/dist/sdk/seo/page-alternates.d.ts +3 -2
- package/dist/sdk/seo/page-alternates.js +4 -2
- package/dist/sdk/seo/page-alternates.js.map +1 -1
- package/dist/sdk/seo/search-landing.d.ts +42 -0
- package/dist/sdk/seo/search-landing.js +85 -0
- package/dist/sdk/seo/search-landing.js.map +1 -0
- package/dist/sdk/session/mock-session.d.ts +9 -0
- package/dist/sdk/session/mock-session.js +31 -0
- package/dist/sdk/session/mock-session.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +3 -0
- package/dist/sdk/session/read-server-session.js +5 -0
- package/dist/sdk/session/read-server-session.js.map +1 -1
- package/dist/sdk/session/return-path-segment.d.ts +10 -0
- package/dist/sdk/session/return-path-segment.js +15 -0
- package/dist/sdk/session/return-path-segment.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
- package/dist/utils/safe-href.d.ts +2 -0
- package/package.json +4 -3
- package/skills/storefront-asset/SKILL.md +2 -2
- package/skills/storefront-asset/references/api-side.md +27 -14
- package/skills/storefront-asset/references/findings.md +5 -2
- package/src/styles/tailwind.css +8 -0
- package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
- package/dist/message-locales.json +0 -7
- package/dist/sdk/i18n/client.d.ts +0 -4
- package/dist/sdk/i18n/client.js +0 -4
- package/dist/sdk/i18n/locales.d.ts +0 -8
- package/dist/sdk/i18n/locales.js +0 -57
- package/dist/sdk/i18n/locales.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.js +0 -183
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -178
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
- package/dist/sdk/i18n/messages/es-ES.js +0 -183
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -178
- package/dist/sdk/i18n/messages/pt-BR.js +0 -183
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -178
- package/dist/sdk/i18n/provider.d.ts +0 -1
- package/dist/sdk/i18n/provider.js +0 -30
- package/dist/sdk/i18n/provider.js.map +0 -1
- package/dist/sdk/i18n/server.d.ts +0 -28
- package/dist/sdk/i18n/server.js +0 -59
- package/dist/sdk/i18n/server.js.map +0 -1
- package/dist/utils/resolve-authored-copy.js +0 -18
- package/dist/utils/resolve-authored-copy.js.map +0 -1
- package/dist/utils/substitute-template.js +0 -33
- package/dist/utils/substitute-template.js.map +0 -1
|
@@ -1,16 +1,22 @@
|
|
|
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 { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
7
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
5
8
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
6
|
-
import {
|
|
7
|
-
import { ListItemRefContext } from "../../sdk/data/list-item-ref-context.js";
|
|
9
|
+
import { loggableErrorName } from "../../utils/loggable-error-name.js";
|
|
10
|
+
import { ListItemRefContext, useListItemRef } from "../../sdk/data/list-item-ref-context.js";
|
|
11
|
+
import { Icon } from "../../particles/icon/icon.js";
|
|
8
12
|
import { Fieldset } from "../../particles/fieldset/fieldset.js";
|
|
9
13
|
import { RadioGroup, RadioIndicator, RadioRoot } from "../../particles/radio/radio.js";
|
|
10
14
|
import { useRegisterPaymentSubmission } from "../../sdk/payment/submission-registry.js";
|
|
11
15
|
import { PAYMENT_NETWORK_ERROR_CODE } from "../../sdk/payment/operations.js";
|
|
12
16
|
import { usePayment } from "../payment/payment.js";
|
|
13
|
-
import { SECURITY_CODE_MASK_STYLE,
|
|
17
|
+
import { SECURITY_CODE_MASK_STYLE, isSecurityCodeMasked } from "../../sdk/payment/security-code-mask.js";
|
|
18
|
+
import { NETWORK_ICON_BY_KEY } from "../card-entry/card-entry.js";
|
|
19
|
+
import { useApolloClient } from "@apollo/client/react";
|
|
14
20
|
import { createContext, useCallback, useContext, useId, useRef, useState } from "react";
|
|
15
21
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
22
|
//#region src/matter/saved-cards/saved-cards.tsx
|
|
@@ -34,6 +40,10 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
34
40
|
* `$actions.payment.sendPayments` itself. T13's `usePlaceOrder` resolves and invokes it; this module
|
|
35
41
|
* never returns the CVV, only `userErrors`.
|
|
36
42
|
*
|
|
43
|
+
* A card whose `cvvRequired` is a literal `false` has no code to enter (T39): `SavedCardOption` registers the
|
|
44
|
+
* `'saved-card'` continuation itself, one that sends nothing and tells `usePlaceOrder` the order is placed by
|
|
45
|
+
* Start Transaction alone. Any other flag value, including an absent one, keeps the field and the coded path.
|
|
46
|
+
*
|
|
37
47
|
* Selecting a row dispatches `usePayment().selectMethod({ methodId, accountId, bin })` — the
|
|
38
48
|
* `bin` is this row's own projected BIN, never `usePayment().draft.bin`. The epic's and the RFC's
|
|
39
49
|
* own text says the saved-card continuation closes over "the account id and BIN", which conflates
|
|
@@ -55,6 +65,7 @@ const fragment = `
|
|
|
55
65
|
accountId
|
|
56
66
|
methodId
|
|
57
67
|
bin
|
|
68
|
+
expired
|
|
58
69
|
}
|
|
59
70
|
}
|
|
60
71
|
}
|
|
@@ -77,10 +88,105 @@ const optionFragment = `
|
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
`;
|
|
91
|
+
const SavedCardsContent = defineContentType({
|
|
92
|
+
id: "saved-cards",
|
|
93
|
+
title: "Saved Cards",
|
|
94
|
+
description: "Copy for the saved-card group legend and a refused card selection.",
|
|
95
|
+
schema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
additionalProperties: false,
|
|
98
|
+
properties: {
|
|
99
|
+
legend: {
|
|
100
|
+
type: "string",
|
|
101
|
+
title: "Legend",
|
|
102
|
+
description: "The radio group's visible accessible name.",
|
|
103
|
+
format: "icu-message",
|
|
104
|
+
messageSource: "Saved cards"
|
|
105
|
+
},
|
|
106
|
+
savedCardUnavailableMessage: {
|
|
107
|
+
type: "string",
|
|
108
|
+
title: "Saved card unavailable message",
|
|
109
|
+
description: "Shown when the picked saved card can no longer be used.",
|
|
110
|
+
format: "icu-message",
|
|
111
|
+
messageSource: "This saved card is no longer available. Choose another card."
|
|
112
|
+
},
|
|
113
|
+
genericErrorMessage: {
|
|
114
|
+
type: "string",
|
|
115
|
+
title: "Selection failure message",
|
|
116
|
+
description: "Shown when a card selection fails: a network failure or a fault the shopper cannot fix.",
|
|
117
|
+
format: "icu-message",
|
|
118
|
+
messageSource: "Unable to select this card. Please try again."
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* The message for each code a method selection can return. A saved card the server no longer matches is
|
|
125
|
+
* one the shopper can replace; the rest, and a code this map does not know, share one message.
|
|
126
|
+
*/
|
|
127
|
+
const SAVED_CARDS_ERROR_FIELDS = {
|
|
128
|
+
MISSING_CART_CONTEXT: "genericErrorMessage",
|
|
129
|
+
CART_NOT_FOUND: "genericErrorMessage",
|
|
130
|
+
INVALID_METHOD_ID: "genericErrorMessage",
|
|
131
|
+
INVALID_SAVED_CARD_ACCOUNT_ID: "savedCardUnavailableMessage",
|
|
132
|
+
MISMATCHED_BIN_FOR_SAVED_CARD: "savedCardUnavailableMessage",
|
|
133
|
+
INVALID_BIN_FORMAT: "genericErrorMessage",
|
|
134
|
+
CONFLICTING_BIN_AND_ACCOUNT_ID: "genericErrorMessage",
|
|
135
|
+
NETWORK_ERROR: "genericErrorMessage"
|
|
136
|
+
};
|
|
137
|
+
const SavedCardCvvFieldContent = defineContentType({
|
|
138
|
+
id: "saved-card-cvv-field",
|
|
139
|
+
title: "Saved Card CVV Field",
|
|
140
|
+
description: "Copy for the security code input of a saved card.",
|
|
141
|
+
schema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
properties: {
|
|
145
|
+
securityCodeLabel: {
|
|
146
|
+
type: "string",
|
|
147
|
+
title: "Security code label",
|
|
148
|
+
description: "The input's accessible name; no visible label renders.",
|
|
149
|
+
format: "icu-message",
|
|
150
|
+
messageSource: "Security code"
|
|
151
|
+
},
|
|
152
|
+
securityCodeDescription: {
|
|
153
|
+
type: "string",
|
|
154
|
+
title: "Security code description",
|
|
155
|
+
description: "Helper text linked to the input; blank renders nothing.",
|
|
156
|
+
format: "icu-message",
|
|
157
|
+
messageSource: "The 3-4 digit number on your card"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
const SavedCardRemoveContent = defineContentType({
|
|
163
|
+
id: "saved-card-remove",
|
|
164
|
+
title: "Saved Card Remove",
|
|
165
|
+
description: "Copy for the remove control of an expired saved card.",
|
|
166
|
+
schema: {
|
|
167
|
+
type: "object",
|
|
168
|
+
additionalProperties: false,
|
|
169
|
+
properties: {
|
|
170
|
+
label: {
|
|
171
|
+
type: "string",
|
|
172
|
+
title: "Label",
|
|
173
|
+
format: "icu-message",
|
|
174
|
+
messageSource: "Remove card"
|
|
175
|
+
},
|
|
176
|
+
failureMessage: {
|
|
177
|
+
type: "string",
|
|
178
|
+
title: "Failure message",
|
|
179
|
+
description: "Rendered when the removal did not complete, never the server's text.",
|
|
180
|
+
format: "icu-message",
|
|
181
|
+
messageSource: "The card was not removed. Please try again."
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
80
186
|
const SavedCardDataContext = createContext(null);
|
|
81
|
-
function useSavedCardData() {
|
|
187
|
+
function useSavedCardData(consumer) {
|
|
82
188
|
const data = useContext(SavedCardDataContext);
|
|
83
|
-
if (!data) throw new Error(
|
|
189
|
+
if (!data) throw new Error(`${consumer} must be used inside a <SavedCardOption> subtree.`);
|
|
84
190
|
return data;
|
|
85
191
|
}
|
|
86
192
|
const SavedCardsDefinition = defineComponent({
|
|
@@ -91,16 +197,13 @@ const SavedCardsDefinition = defineComponent({
|
|
|
91
197
|
fetchStrategy: "reactive",
|
|
92
198
|
requiresContext: "payment",
|
|
93
199
|
providesContext: "saved-card",
|
|
200
|
+
content: SavedCardsContent,
|
|
94
201
|
editor: {
|
|
95
202
|
label: "Saved Cards",
|
|
96
203
|
category: "commerce"
|
|
97
204
|
},
|
|
98
|
-
schema: {
|
|
99
|
-
|
|
100
|
-
default: "Saved cards",
|
|
101
|
-
label: "Legend"
|
|
102
|
-
} },
|
|
103
|
-
guideline: "Radio list of the shopper's saved cards (network, last four, label); expired cards render present but disabled, never selectable. Place a SavedCardOption inside as the per-card template, itself wrapping a SavedCardCvvField so the shopper can complete payment with a stored card — omitting the CVV field means a shopper can select a card but never pay with it. Picking a row dispatches the payment method selection by methodId and accountId only, never a card number or BIN, plus the inline selection error (role=\"alert\") if the server rejects it. \"Use a new card\" is CardEntry composed as a sibling, not a control inside this list. Renders one container div and no chrome of its own; always carries a loading/empty/ready state hook. Must be inside a PaymentSectionRoot or PaymentSectionController. See saved-cards.md."
|
|
205
|
+
schema: {},
|
|
206
|
+
guideline: "Radio list of the shopper's saved cards (network, last four, label); expired cards render present but disabled, never selectable, and a persisted selection that points at an expired card counts as no selection (no row checked, no security-code field, nothing to submit). Place a SavedCardOption inside as the per-card template, itself wrapping a SavedCardCvvField so the shopper can complete payment with a stored card that needs a security code; a card that needs none is payable through SavedCardOption alone. Picking a row dispatches the payment method selection by methodId and accountId only, never a card number or BIN, plus the inline selection error (role=\"alert\") if the server rejects it. \"Use a new card\" is CardEntry composed as a sibling, not a control inside this list. Renders one container div and no chrome of its own; always carries a loading/empty/ready state hook. Must be inside a PaymentSectionRoot or PaymentSectionController. See saved-cards.md."
|
|
104
207
|
});
|
|
105
208
|
const SavedCardOptionDefinition = defineComponent({
|
|
106
209
|
name: "SavedCardOption",
|
|
@@ -115,7 +218,7 @@ const SavedCardOptionDefinition = defineComponent({
|
|
|
115
218
|
category: "commerce"
|
|
116
219
|
},
|
|
117
220
|
schema: {},
|
|
118
|
-
guideline: "One saved card as a radio row: network, masked last four, and its label when set; disabled when expired. Place a SavedCardCvvField inside so the CVV appears once
|
|
221
|
+
guideline: "One saved card as a radio row: the network mark (its name as text when the network has no mark), the masked last four, and its label when set, separated by a dot; disabled when expired. An expired card is never the selection and mounts no field. A card that needs no security code shows no field and places the order with one action: this component alone makes it payable. Place a SavedCardCvvField inside so the CVV appears once a card that needs one is selected. Must be inside SavedCards."
|
|
119
222
|
});
|
|
120
223
|
const SavedCardCvvFieldDefinition = defineComponent({
|
|
121
224
|
name: "SavedCardCvvField",
|
|
@@ -124,23 +227,27 @@ const SavedCardCvvFieldDefinition = defineComponent({
|
|
|
124
227
|
requiresContext: "saved-card-data",
|
|
125
228
|
actions: { payment: ["sendPayments"] },
|
|
126
229
|
hardened: true,
|
|
230
|
+
content: SavedCardCvvFieldContent,
|
|
127
231
|
editor: {
|
|
128
232
|
label: "Saved Card CVV Field",
|
|
129
233
|
category: "commerce"
|
|
130
234
|
},
|
|
131
|
-
schema: {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
235
|
+
schema: {},
|
|
236
|
+
guideline: "The CVV re-entry field for its saved card row; renders nothing until that row is selected, is not expired and requires a CVV (only a card flagged as needing none skips it; an unknown flag requires it). Registers the direct-to-gateway submission for the saved-card path on selection — the CVV never transits our backend, only the gateway leg's userErrors return. Only needed for cards that need a code: a card that needs none is payable without it. Must be inside SavedCardOption."
|
|
237
|
+
});
|
|
238
|
+
const SavedCardRemoveDefinition = defineComponent({
|
|
239
|
+
name: "SavedCardRemove",
|
|
240
|
+
importPath: "@vtex/faststore/components",
|
|
241
|
+
component: SavedCardRemove,
|
|
242
|
+
requiresContext: "saved-card-data",
|
|
243
|
+
actions: { savedCard: ["remove"] },
|
|
244
|
+
content: SavedCardRemoveContent,
|
|
245
|
+
editor: {
|
|
246
|
+
label: "Saved Card Remove",
|
|
247
|
+
category: "commerce"
|
|
142
248
|
},
|
|
143
|
-
|
|
249
|
+
schema: {},
|
|
250
|
+
guideline: "A button that removes this saved card from the shopper's account, rendered only for an expired card: a card that can still be used shows no control. Place it inside SavedCardOption, beside SavedCardCvvField. If the removal does not complete the card stays listed and an alert (role=\"alert\") says so, in the failureMessage $content field and never the server's text. It never changes the selected payment method or card. Must be inside SavedCardOption."
|
|
144
251
|
});
|
|
145
252
|
/** Mirrors `PaymentMethodList`'s own state hook, so an empty or loading region stays swatch-targetable. */
|
|
146
253
|
function savedCardsState({ loading, count }) {
|
|
@@ -153,21 +260,46 @@ function savedCardsState({ loading, count }) {
|
|
|
153
260
|
* `selectNewCard()` never clears — only `draft.path` flips to `'new-card'` (`use-payment-method-
|
|
154
261
|
* selection.ts`) — so reading `selectedAccountId` alone leaves the previously picked row wedged
|
|
155
262
|
* checked, with its CVV field still mounted and registered, after the shopper picks "use a new card"
|
|
156
|
-
* instead.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
263
|
+
* instead. The same goes for a persisted selection whose card has since expired: the row is disabled, so
|
|
264
|
+
* it can never be the choice, and counts as no selection at all (T39). Every read site in this module goes
|
|
265
|
+
* through this one function — the radio group's own `value`, a row's `-selected` state, the CVV field's
|
|
266
|
+
* visibility gate and the no-code submission's — so they can never drift out of sync with each other.
|
|
267
|
+
* Reads only `draft.path`, never `draft.bin`: that stays a fully separate concern (Decision 2) that no
|
|
268
|
+
* call site in this module touches.
|
|
160
269
|
*/
|
|
161
|
-
function resolveEffectiveSelectedAccountId(selectedAccountId, draftPath) {
|
|
162
|
-
return draftPath === "new-card" ? null : selectedAccountId;
|
|
270
|
+
function resolveEffectiveSelectedAccountId({ selectedAccountId, draftPath, selectedCardExpired }) {
|
|
271
|
+
return draftPath === "new-card" || selectedCardExpired ? null : selectedAccountId;
|
|
163
272
|
}
|
|
164
|
-
|
|
273
|
+
/**
|
|
274
|
+
* Fail closed: only a literal `false` on a found list entry means "not expired". An entry that lacks
|
|
275
|
+
* the flag (a cache entry written before the fragment selected it) counts as expired, so it can never
|
|
276
|
+
* hold the radio group's value. No entry at all is not an expired card.
|
|
277
|
+
*/
|
|
278
|
+
function isListEntryExpired(entry) {
|
|
279
|
+
return entry !== void 0 && entry.expired !== false;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* `SavedCard.network` is the upstream `paymentSystemName`, free text. Own-property lookup on the icon
|
|
283
|
+
* table, because a plain-object read lets a name that normalises to `constructor` resolve to the
|
|
284
|
+
* inherited `Object` function, which `Icon` then throws on. Same normalisation as card entry's
|
|
285
|
+
* `networkIconName`.
|
|
286
|
+
*/
|
|
287
|
+
function savedCardNetworkIcon(network) {
|
|
288
|
+
const key = network.toLowerCase().replaceAll(/[^a-z]/g, "");
|
|
289
|
+
return Object.hasOwn(NETWORK_ICON_BY_KEY, key) ? NETWORK_ICON_BY_KEY[key] ?? null : null;
|
|
290
|
+
}
|
|
291
|
+
function SavedCards({ $data: $dataProp, $content, $locale, className, children, ...props }) {
|
|
165
292
|
const $data = useDataOverride($dataProp);
|
|
293
|
+
const { format } = useMessageFormatter(SavedCardsContent, $content);
|
|
166
294
|
const { selectedAccountId, selectMethod, selectionError, draft, placing: placingNow, attempt, cardPaymentCollapsed } = usePayment();
|
|
167
295
|
const placing = placingNow || attempt?.phase === "sent" || attempt?.phase === "unresolved";
|
|
168
296
|
const loading = $data == null;
|
|
169
297
|
const savedCards = $data?.savedCards ?? [];
|
|
170
|
-
const effectiveSelectedAccountId = resolveEffectiveSelectedAccountId(
|
|
298
|
+
const effectiveSelectedAccountId = resolveEffectiveSelectedAccountId({
|
|
299
|
+
selectedAccountId,
|
|
300
|
+
draftPath: draft.path,
|
|
301
|
+
selectedCardExpired: isListEntryExpired(savedCards.find((entry) => entry.accountId === selectedAccountId))
|
|
302
|
+
});
|
|
171
303
|
const handleValueChange = useCallback((accountId) => {
|
|
172
304
|
const card = savedCards.find((entry) => entry.accountId === accountId);
|
|
173
305
|
if (!card) return;
|
|
@@ -192,10 +324,10 @@ function SavedCards({ $data: $dataProp, legend, className, children, ...props })
|
|
|
192
324
|
children: [selectionError ? /* @__PURE__ */ jsx("div", {
|
|
193
325
|
role: "alert",
|
|
194
326
|
"data-fs-saved-cards-error": "",
|
|
195
|
-
children: selectionError
|
|
327
|
+
children: formatErrorCode(SavedCardsContent, SAVED_CARDS_ERROR_FIELDS, selectionError, format, "genericErrorMessage")
|
|
196
328
|
}) : null, savedCards.length > 0 ? /* @__PURE__ */ jsxs(Fieldset.Root, {
|
|
197
329
|
"data-fs-saved-cards-fieldset": "",
|
|
198
|
-
children: [/* @__PURE__ */ jsx(Fieldset.Legend, { children:
|
|
330
|
+
children: [/* @__PURE__ */ jsx(Fieldset.Legend, { children: format("legend") }), /* @__PURE__ */ jsx(RadioGroup, {
|
|
199
331
|
value: effectiveSelectedAccountId ?? "",
|
|
200
332
|
onValueChange: handleValueChange,
|
|
201
333
|
children: savedCards.map((card) => /* @__PURE__ */ jsx(ListItemRefContext, {
|
|
@@ -214,7 +346,12 @@ function SavedCardOption({ $data: $dataProp, className, children, ...props }) {
|
|
|
214
346
|
const slice = useDataOverride($dataProp) ?? null;
|
|
215
347
|
const { selectedAccountId, draft } = usePayment();
|
|
216
348
|
if (!slice) return null;
|
|
217
|
-
const isSelected = slice.accountId === resolveEffectiveSelectedAccountId(
|
|
349
|
+
const isSelected = slice.accountId === resolveEffectiveSelectedAccountId({
|
|
350
|
+
selectedAccountId,
|
|
351
|
+
draftPath: draft.path,
|
|
352
|
+
selectedCardExpired: slice.expired
|
|
353
|
+
});
|
|
354
|
+
const networkIcon = savedCardNetworkIcon(slice.network);
|
|
218
355
|
return /* @__PURE__ */ jsx(SavedCardDataContext, {
|
|
219
356
|
value: slice,
|
|
220
357
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -223,25 +360,53 @@ function SavedCardOption({ $data: $dataProp, className, children, ...props }) {
|
|
|
223
360
|
"data-fs-saved-card-option": "",
|
|
224
361
|
...isSelected ? { "data-fs-saved-card-option-selected": "" } : {},
|
|
225
362
|
...slice.expired ? { "data-fs-saved-card-option-expired": "" } : {},
|
|
226
|
-
children: [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsxs(RadioRoot, {
|
|
365
|
+
value: slice.accountId,
|
|
366
|
+
disabled: slice.expired,
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ jsx(RadioIndicator, { "data-fs-saved-card-option-indicator": "" }),
|
|
369
|
+
/* @__PURE__ */ jsx("span", {
|
|
370
|
+
"data-fs-saved-card-option-network": "",
|
|
371
|
+
children: networkIcon ? /* @__PURE__ */ jsx(Icon, {
|
|
372
|
+
name: networkIcon,
|
|
373
|
+
"aria-hidden": false,
|
|
374
|
+
role: "img",
|
|
375
|
+
"aria-label": slice.network,
|
|
376
|
+
"data-fs-saved-card-option-network-icon": ""
|
|
377
|
+
}) : slice.network
|
|
378
|
+
}),
|
|
379
|
+
slice.network ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
380
|
+
" ",
|
|
381
|
+
/* @__PURE__ */ jsx("span", {
|
|
382
|
+
"aria-hidden": "true",
|
|
383
|
+
"data-fs-saved-card-option-separator": "",
|
|
384
|
+
children: "·"
|
|
385
|
+
}),
|
|
386
|
+
" "
|
|
387
|
+
] }) : null,
|
|
388
|
+
/* @__PURE__ */ jsx("span", {
|
|
389
|
+
"data-fs-saved-card-option-last-four": "",
|
|
390
|
+
children: `•••• ${slice.lastFourDigits}`
|
|
391
|
+
}),
|
|
392
|
+
slice.label ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
393
|
+
" ",
|
|
394
|
+
/* @__PURE__ */ jsx("span", {
|
|
395
|
+
"aria-hidden": "true",
|
|
396
|
+
"data-fs-saved-card-option-separator": "",
|
|
397
|
+
children: "·"
|
|
398
|
+
}),
|
|
399
|
+
" ",
|
|
400
|
+
/* @__PURE__ */ jsx("span", {
|
|
401
|
+
"data-fs-saved-card-option-label": "",
|
|
402
|
+
children: slice.label
|
|
403
|
+
})
|
|
404
|
+
] }) : null
|
|
405
|
+
]
|
|
406
|
+
}),
|
|
407
|
+
isSelected && slice.cvvRequired === false ? /* @__PURE__ */ jsx(SavedCardNoCodeSubmission, {}) : null,
|
|
408
|
+
children
|
|
409
|
+
]
|
|
245
410
|
})
|
|
246
411
|
});
|
|
247
412
|
}
|
|
@@ -273,22 +438,10 @@ function sanitizeCvv(value) {
|
|
|
273
438
|
* Three or four digits (T27, FR-11). `sanitizeCvv` already strips non-digits and caps at
|
|
274
439
|
* `CVV_MAX_LENGTH`, so the only rule left is the floor — and three-or-four is `card-entry`'s own
|
|
275
440
|
* fallback for a method that declares no `cvvRegex` (its `isValidCvv`, `/^\d{3,4}$/`). Requiredness is
|
|
276
|
-
* not checked here: `SavedCardCvvInput` renders only when the row is selected and
|
|
277
|
-
*
|
|
441
|
+
* not checked here: `SavedCardCvvInput` renders only when the row is selected, not expired and its
|
|
442
|
+
* `cvvRequired` is not a literal `false`, so its presence *is* the requiredness signal.
|
|
278
443
|
*/
|
|
279
444
|
const SAVED_CARD_CVV_PATTERN = /^\d{3,4}$/;
|
|
280
|
-
/**
|
|
281
|
-
* The length at which this field's security code counts as fully typed, and the mask engages (T173,
|
|
282
|
-
* specs/mask-the-cvv-only-once-it.md, FR-3). Three — the floor of `SAVED_CARD_CVV_PATTERN` above,
|
|
283
|
-
* for the same reason that pattern accepts either length: a saved card carries no per-network CVV
|
|
284
|
-
* length. Its slice exposes a display `network` string, not a `cvvMask`, so nothing here tells a
|
|
285
|
-
* 3-digit network apart from Amex's 4 the way `CardEntry` can, and inferring one from the display
|
|
286
|
-
* name would hardcode a network table this package deliberately does not own.
|
|
287
|
-
*
|
|
288
|
-
* Masking at the floor is the side to err on: a complete code is never left legible on either kind
|
|
289
|
-
* of card, and a 4-digit code is simply already masked when its last digit arrives.
|
|
290
|
-
*/
|
|
291
|
-
const SAVED_CARD_CVV_COMPLETE_LENGTH = 3;
|
|
292
445
|
/** Merges a caller-forwarded `aria-describedby` (from `...props`) with the description `<p>`'s own
|
|
293
446
|
* id, rather than clobbering it — the accessibility wiring `Field.Root` would otherwise provide for
|
|
294
447
|
* free (saved-cards.md Decision 3). */
|
|
@@ -298,12 +451,13 @@ function mergeDescribedBy(existing, id) {
|
|
|
298
451
|
/**
|
|
299
452
|
* The stateful, registering half of the CVV field — split out from `SavedCardCvvField` so this row's
|
|
300
453
|
* conditional visibility never skips a hook call (spec Decision 5). This component mounts wholesale
|
|
301
|
-
* when its row is selected and requires a CVV, and unmounts wholesale otherwise, so its own hooks
|
|
454
|
+
* when its row is selected, is not expired and requires a CVV, and unmounts wholesale otherwise, so its own hooks
|
|
302
455
|
* always run the same number of times across its own lifetime; only its *presence* is conditional,
|
|
303
456
|
* decided by its caller.
|
|
304
457
|
*/
|
|
305
|
-
function SavedCardCvvInput({ accountId, bin, securityCodeLabel, securityCodeDescription, $actions, ref: forwardedRef, ...props }) {
|
|
458
|
+
function SavedCardCvvInput({ accountId, bin, securityCodeLabel, securityCodeDescription, $actions, ref: forwardedRef, onFocus, onBlur, ...props }) {
|
|
306
459
|
const [cvv, setCvv] = useState("");
|
|
460
|
+
const [focused, setFocused] = useState(false);
|
|
307
461
|
const inputRef = useRef(null);
|
|
308
462
|
const sendPayments = $actions?.payment?.sendPayments;
|
|
309
463
|
const descriptionId = useId();
|
|
@@ -356,7 +510,7 @@ function SavedCardCvvInput({ accountId, bin, securityCodeLabel, securityCodeDesc
|
|
|
356
510
|
]);
|
|
357
511
|
useRegisterPaymentSubmission("saved-card", submit, checkCvv);
|
|
358
512
|
const ariaDescribedBy = securityCodeDescription ? mergeDescribedBy(props["aria-describedby"], descriptionId) : props["aria-describedby"];
|
|
359
|
-
const inputStyle =
|
|
513
|
+
const inputStyle = isSecurityCodeMasked(cvv, focused && !props.disabled) ? {
|
|
360
514
|
...props.style,
|
|
361
515
|
...SECURITY_CODE_MASK_STYLE
|
|
362
516
|
} : props.style;
|
|
@@ -370,6 +524,14 @@ function SavedCardCvvInput({ accountId, bin, securityCodeLabel, securityCodeDesc
|
|
|
370
524
|
"aria-describedby": ariaDescribedBy,
|
|
371
525
|
value: cvv,
|
|
372
526
|
onChange: (event) => setCvv(sanitizeCvv(event.target.value)),
|
|
527
|
+
onFocus: (event) => {
|
|
528
|
+
setFocused(true);
|
|
529
|
+
onFocus?.(event);
|
|
530
|
+
},
|
|
531
|
+
onBlur: (event) => {
|
|
532
|
+
setFocused(false);
|
|
533
|
+
onBlur?.(event);
|
|
534
|
+
},
|
|
373
535
|
"data-fs-saved-card-cvv-field": "",
|
|
374
536
|
style: inputStyle
|
|
375
537
|
}), securityCodeDescription ? /* @__PURE__ */ jsx("p", {
|
|
@@ -378,22 +540,132 @@ function SavedCardCvvInput({ accountId, bin, securityCodeLabel, securityCodeDesc
|
|
|
378
540
|
children: securityCodeDescription
|
|
379
541
|
}) : null] });
|
|
380
542
|
}
|
|
381
|
-
|
|
543
|
+
/**
|
|
544
|
+
* The submission of a selected, non-expired card whose flag is a literal `false` (T39): no input mounts, so
|
|
545
|
+
* there is no code and nothing to send. It registers a continuation that issues no request and tells
|
|
546
|
+
* `usePlaceOrder` the order is placed by Start Transaction alone (`completesWithoutGateway`), so
|
|
547
|
+
* `sendPayments` and the gateway callback are never called. Mounted by `SavedCardOption`, never by
|
|
548
|
+
* `SavedCardCvvField`: a composition that leaves the field out still has to make this card payable. No
|
|
549
|
+
* pre-flight is registered (nothing to validate), and it logs nothing.
|
|
550
|
+
*/
|
|
551
|
+
function SavedCardNoCodeSubmission() {
|
|
552
|
+
const submit = useCallback(async () => ({
|
|
553
|
+
reachedGateway: false,
|
|
554
|
+
userErrors: [],
|
|
555
|
+
completesWithoutGateway: true
|
|
556
|
+
}), []);
|
|
557
|
+
useRegisterPaymentSubmission("saved-card", submit);
|
|
558
|
+
return null;
|
|
559
|
+
}
|
|
560
|
+
function SavedCardCvvField({ $actions: $actionsProp, $content, $locale, className, ...props }) {
|
|
382
561
|
const $actions = useActionsOverride($actionsProp);
|
|
383
|
-
const {
|
|
562
|
+
const { format } = useMessageFormatter(SavedCardCvvFieldContent, $content);
|
|
563
|
+
const { accountId, bin, cvvRequired, expired } = useSavedCardData("SavedCardCvvField");
|
|
384
564
|
const { selectedAccountId, draft } = usePayment();
|
|
385
|
-
if (accountId !== resolveEffectiveSelectedAccountId(
|
|
565
|
+
if (accountId !== resolveEffectiveSelectedAccountId({
|
|
566
|
+
selectedAccountId,
|
|
567
|
+
draftPath: draft.path,
|
|
568
|
+
selectedCardExpired: expired
|
|
569
|
+
}) || cvvRequired === false) return null;
|
|
386
570
|
return /* @__PURE__ */ jsx(SavedCardCvvInput, {
|
|
387
571
|
...props,
|
|
388
572
|
className,
|
|
389
573
|
accountId,
|
|
390
574
|
bin,
|
|
391
|
-
securityCodeLabel,
|
|
392
|
-
securityCodeDescription,
|
|
575
|
+
securityCodeLabel: format("securityCodeLabel"),
|
|
576
|
+
securityCodeDescription: format("securityCodeDescription"),
|
|
393
577
|
$actions
|
|
394
578
|
});
|
|
395
579
|
}
|
|
580
|
+
/**
|
|
581
|
+
* The `CustomerSavedCard` opaque id the removal API takes. The checkout row's own id is a `SavedCard` id
|
|
582
|
+
* (a different entity set), but both wrap the same platform `accountId`, so the account-side id is derived
|
|
583
|
+
* from it: standard-alphabet, padded base64 of `CustomerSavedCard:<accountId>` (the server's
|
|
584
|
+
* `encodeOpaqueId`). `btoa` over `TextEncoder` bytes, because `Buffer` does not exist in the browser. A
|
|
585
|
+
* drift from the server's encoding is refused there as `CARD_NOT_FOUND`, which lands on the failure path.
|
|
586
|
+
*/
|
|
587
|
+
function toAccountSavedCardId(accountId) {
|
|
588
|
+
const bytes = new TextEncoder().encode(`CustomerSavedCard:${accountId}`);
|
|
589
|
+
let binary = "";
|
|
590
|
+
for (const byte of bytes) binary += String.fromCodePoint(byte);
|
|
591
|
+
return btoa(binary);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Removes an expired saved card (T216). Renders only for a row whose `expired` is the literal `true`. A
|
|
595
|
+
* success evicts the row's `SavedCard` entity, which is what the checkout list reads; the SDK action only
|
|
596
|
+
* updates the account's own `CustomerSavedCards` entity. Anything else, including a missing action, leaves
|
|
597
|
+
* the row and says so with its failureMessage, never the server's message. A caller's `onClick` runs first, and
|
|
598
|
+
* calling `event.preventDefault()` there cancels the removal.
|
|
599
|
+
*/
|
|
600
|
+
function SavedCardRemove({ $actions: $actionsProp, $content, $locale, className, onClick, ...props }) {
|
|
601
|
+
const $actions = useActionsOverride($actionsProp);
|
|
602
|
+
const { format } = useMessageFormatter(SavedCardRemoveContent, $content);
|
|
603
|
+
const { accountId, network, lastFourDigits, expired } = useSavedCardData("SavedCardRemove");
|
|
604
|
+
const listItemRef = useListItemRef();
|
|
605
|
+
const { cache } = useApolloClient();
|
|
606
|
+
const [pending, setPending] = useState(false);
|
|
607
|
+
const [failed, setFailed] = useState(false);
|
|
608
|
+
const inFlight = useRef(false);
|
|
609
|
+
if (expired !== true) return null;
|
|
610
|
+
async function handleClick(event) {
|
|
611
|
+
if (inFlight.current) return;
|
|
612
|
+
onClick?.(event);
|
|
613
|
+
if (event.defaultPrevented) return;
|
|
614
|
+
inFlight.current = true;
|
|
615
|
+
setPending(true);
|
|
616
|
+
setFailed(false);
|
|
617
|
+
let removed = false;
|
|
618
|
+
try {
|
|
619
|
+
const remove = $actions?.savedCard?.remove;
|
|
620
|
+
if (typeof remove === "function") {
|
|
621
|
+
const userErrors = await remove({ id: toAccountSavedCardId(accountId) });
|
|
622
|
+
removed = Array.isArray(userErrors) && userErrors.length === 0;
|
|
623
|
+
}
|
|
624
|
+
} catch (error) {
|
|
625
|
+
console.error("[SavedCardRemove] remove failed", loggableErrorName(error));
|
|
626
|
+
} finally {
|
|
627
|
+
inFlight.current = false;
|
|
628
|
+
setPending(false);
|
|
629
|
+
}
|
|
630
|
+
if (!removed) {
|
|
631
|
+
setFailed(true);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
const entityId = listItemRef ? cache.identify({
|
|
635
|
+
__typename: listItemRef.__typename,
|
|
636
|
+
id: listItemRef.id
|
|
637
|
+
}) : void 0;
|
|
638
|
+
if (entityId) {
|
|
639
|
+
cache.evict({ id: entityId });
|
|
640
|
+
cache.gc();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
const resolvedLabel = format("label");
|
|
644
|
+
const accessibleName = [
|
|
645
|
+
resolvedLabel,
|
|
646
|
+
network,
|
|
647
|
+
lastFourDigits ? `•••• ${lastFourDigits}` : ""
|
|
648
|
+
].filter(Boolean).join(" ");
|
|
649
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
650
|
+
...props,
|
|
651
|
+
type: "button",
|
|
652
|
+
className,
|
|
653
|
+
"aria-label": accessibleName,
|
|
654
|
+
onClick: handleClick,
|
|
655
|
+
"data-fs-saved-card-remove": "",
|
|
656
|
+
...pending ? {
|
|
657
|
+
"aria-busy": true,
|
|
658
|
+
"aria-disabled": true,
|
|
659
|
+
"data-fs-saved-card-remove-pending": ""
|
|
660
|
+
} : {},
|
|
661
|
+
children: resolvedLabel
|
|
662
|
+
}), failed ? /* @__PURE__ */ jsx("p", {
|
|
663
|
+
role: "alert",
|
|
664
|
+
"data-fs-saved-card-remove-error": "",
|
|
665
|
+
children: format("failureMessage")
|
|
666
|
+
}) : null] });
|
|
667
|
+
}
|
|
396
668
|
//#endregion
|
|
397
|
-
export { SAVED_CARD_INVALID_SECURITY_CODE, SavedCardCvvField, SavedCardCvvFieldDefinition, SavedCardOption, SavedCardOptionDefinition, SavedCards, SavedCardsDefinition };
|
|
669
|
+
export { SAVED_CARDS_ERROR_FIELDS, SAVED_CARD_INVALID_SECURITY_CODE, SavedCardCvvField, SavedCardCvvFieldContent, SavedCardCvvFieldDefinition, SavedCardOption, SavedCardOptionDefinition, SavedCardRemove, SavedCardRemoveContent, SavedCardRemoveDefinition, SavedCards, SavedCardsContent, SavedCardsDefinition };
|
|
398
670
|
|
|
399
671
|
//# sourceMappingURL=saved-cards.js.map
|