@vtex/faststore 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +0 -1
- package/dist/actions.json +6 -1
- package/dist/catalog.json +789 -1701
- package/dist/cli/index.d.ts +66 -28
- package/dist/cli/index.js +7371 -512
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-runtime.js +41 -60
- package/dist/cli/server-runtime.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/components.d.ts +63 -57
- package/dist/components.js +60 -54
- package/dist/content-types.json +5785 -754
- package/dist/core/dist/define-component.d.ts +1 -1
- package/dist/core/dist/define-content-type.d.ts +50 -2
- package/dist/core/dist/define-content-type.js +107 -3
- package/dist/core/dist/define-content-type.js.map +1 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/access-code-field.md +1 -1
- package/dist/docs/access-code-sign-in.md +126 -77
- package/dist/docs/account-address-book.md +210 -95
- package/dist/docs/account-menu.md +14 -15
- package/dist/docs/account-saved-cards.md +44 -39
- package/dist/docs/alert-dialog.md +3 -1
- package/dist/docs/avatar.md +4 -2
- package/dist/docs/billing-address.md +99 -30
- package/dist/docs/binding-switcher.md +5 -2
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +39 -26
- package/dist/docs/card-summary.md +18 -8
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +39 -26
- package/dist/docs/cart-item.md +29 -14
- package/dist/docs/cart-totalizer.md +7 -5
- package/dist/docs/cart.md +135 -41
- package/dist/docs/challenge-return.md +135 -0
- package/dist/docs/client-preferences-fieldset.md +10 -5
- package/dist/docs/client-preferences.md +31 -8
- package/dist/docs/client-profile-fieldset.md +20 -6
- package/dist/docs/client-profile.md +12 -3
- package/dist/docs/copy-text.md +9 -7
- package/dist/docs/document-field.md +1 -1
- package/dist/docs/email-field.md +2 -1
- package/dist/docs/email-identification.md +12 -2
- package/dist/docs/footer-copyright.md +4 -2
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +6 -5
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/installments.md +46 -32
- package/dist/docs/my-account-profile.md +16 -11
- package/dist/docs/navigation-link.md +5 -3
- package/dist/docs/order-cancel.md +3 -1
- package/dist/docs/order-delivery-address.md +7 -5
- package/dist/docs/order-delivery-group.md +1 -3
- package/dist/docs/order-details-back.md +1 -1
- package/dist/docs/order-details-header.md +1 -4
- package/dist/docs/order-invoice-download.md +60 -0
- package/dist/docs/order-list-row.md +1 -1
- package/dist/docs/order-list-search.md +13 -20
- package/dist/docs/order-list-views.md +11 -17
- package/dist/docs/order-list.md +12 -5
- package/dist/docs/order-payment.md +9 -7
- package/dist/docs/order-placed-date.md +1 -1
- package/dist/docs/order-placed-payment-summary.md +28 -15
- package/dist/docs/order-placed.md +49 -14
- package/dist/docs/order-progress.md +1 -1
- package/dist/docs/order-status-badge.md +20 -9
- package/dist/docs/order-summary.md +2 -2
- package/dist/docs/order-tracking-link.md +58 -0
- package/dist/docs/payment-method-badges.md +30 -4
- package/dist/docs/payment-methods.md +1 -1
- package/dist/docs/payment.md +36 -17
- package/dist/docs/phone-field.md +4 -4
- package/dist/docs/place-order.md +84 -36
- package/dist/docs/postal-code-field.md +3 -1
- package/dist/docs/pricing.md +21 -23
- package/dist/docs/product-gallery.md +19 -20
- package/dist/docs/product-information.md +13 -9
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +0 -1
- package/dist/docs/promotion.md +4 -2
- package/dist/docs/region.md +23 -15
- package/dist/docs/save-card.md +7 -6
- package/dist/docs/saved-cards.md +65 -36
- package/dist/docs/shipping-address.md +57 -21
- package/dist/docs/shipping-simulator.md +53 -15
- package/dist/docs/sign-in-disclosure.md +176 -0
- package/dist/docs/sign-in-form.md +78 -47
- package/dist/docs/sign-in-redirect.md +4 -2
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +15 -4
- package/dist/docs/variant-selector.md +15 -11
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +2 -2
- package/dist/internal/client.d.ts +1 -3
- package/dist/internal/client.js +1 -1
- package/dist/internal/server.d.ts +7 -4
- package/dist/internal/server.js +7 -4
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
- package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
- package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
- package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
- package/dist/matter/account-address-book/account-address-book.js +74 -33
- package/dist/matter/account-address-book/account-address-book.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
- package/dist/matter/account-address-book/account-address-country.js +83 -49
- package/dist/matter/account-address-book/account-address-country.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
- package/dist/matter/account-address-book/account-address-form.js +518 -155
- package/dist/matter/account-address-book/account-address-form.js.map +1 -1
- package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-record.js +32 -17
- package/dist/matter/account-address-book/account-address-record.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +34 -17
- package/dist/matter/account-menu/account-menu.js +46 -54
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
- package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
- package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
- package/dist/matter/billing-address/billing-address.d.ts +156 -74
- package/dist/matter/billing-address/billing-address.js +227 -156
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
- package/dist/matter/breadcrumb/breadcrumb.js +24 -9
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/buy-button/buy-button.d.ts +8 -11
- package/dist/matter/buy-button/buy-button.js +10 -19
- package/dist/matter/buy-button/buy-button.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +12 -4
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +123 -32
- package/dist/matter/card-entry/card-entry.js +348 -221
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cart/cart-namespace.d.ts +7 -1
- package/dist/matter/cart/cart-namespace.js +7 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +402 -61
- package/dist/matter/cart/cart.js +624 -153
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
- package/dist/matter/cart-destination/cart-destination.js +160 -70
- package/dist/matter/cart-destination/cart-destination.js.map +1 -1
- package/dist/matter/cart-item/cart-item.d.ts +144 -17
- package/dist/matter/cart-item/cart-item.js +166 -49
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
- package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
- package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
- package/dist/matter/challenge-return/challenge-return.js +241 -0
- package/dist/matter/challenge-return/challenge-return.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
- package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
- package/dist/matter/client-preferences/client-preferences.js +84 -15
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +44 -9
- package/dist/matter/client-profile/client-profile.js +64 -24
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
- package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
- package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
- package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
- package/dist/matter/delivery-options/delivery-options.js +75 -12
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
- package/dist/matter/email-identification/email-identification.d.ts +25 -3
- package/dist/matter/email-identification/email-identification.js +49 -12
- package/dist/matter/email-identification/email-identification.js.map +1 -1
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
- package/dist/matter/identity-edit/identity-edit.js +47 -19
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
- package/dist/matter/identity-summary/identity-summary.js +95 -45
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +98 -16
- package/dist/matter/installments/installments-select.js +156 -48
- package/dist/matter/installments/installments-select.js.map +1 -1
- package/dist/matter/installments/installments.d.ts +96 -16
- package/dist/matter/installments/installments.js +115 -40
- package/dist/matter/installments/installments.js.map +1 -1
- package/dist/matter/installments/use-installments-selection.d.ts +1 -0
- package/dist/matter/installments/use-installments-selection.js +8 -3
- package/dist/matter/installments/use-installments-selection.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
- package/dist/matter/my-account-profile/my-account-profile.js +370 -174
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
- package/dist/matter/order-cancel/order-cancel.js +118 -51
- package/dist/matter/order-cancel/order-cancel.js.map +1 -1
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
- package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
- package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
- package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
- package/dist/matter/order-details-header/order-details-header.js +66 -58
- package/dist/matter/order-details-header/order-details-header.js.map +1 -1
- package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +164 -19
- package/dist/matter/order-list/order-list.js +229 -87
- package/dist/matter/order-list/order-list.js.map +1 -1
- package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
- package/dist/matter/order-list-row/order-list-row.js +3 -2
- package/dist/matter/order-list-row/order-list-row.js.map +1 -1
- package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
- package/dist/matter/order-list-search/order-list-search.js +30 -69
- package/dist/matter/order-list-search/order-list-search.js.map +1 -1
- package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
- package/dist/matter/order-list-views/order-list-views.js +22 -68
- package/dist/matter/order-list-views/order-list-views.js.map +1 -1
- package/dist/matter/order-payment/order-payment.d.ts +33 -10
- package/dist/matter/order-payment/order-payment.js +44 -39
- package/dist/matter/order-payment/order-payment.js.map +1 -1
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
- package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
- package/dist/matter/order-placed/order-placed.d.ts +198 -31
- package/dist/matter/order-placed/order-placed.js +230 -139
- package/dist/matter/order-placed/order-placed.js.map +1 -1
- package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
- package/dist/matter/order-placed-date/order-placed-date.js +7 -8
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +19 -8
- package/dist/matter/order-progress/order-progress.js +37 -45
- package/dist/matter/order-progress/order-progress.js.map +1 -1
- package/dist/matter/order-summary/order-summary.d.ts +19 -9
- package/dist/matter/order-summary/order-summary.js +38 -44
- package/dist/matter/order-summary/order-summary.js.map +1 -1
- package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +17 -10
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.d.ts +4 -2
- package/dist/matter/payment/payment-controller.js +30 -9
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +1 -1
- package/dist/matter/payment/payment.d.ts +69 -19
- package/dist/matter/payment/payment.js +101 -35
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
- package/dist/matter/payment/use-payment-method-selection.js +94 -32
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
- package/dist/matter/payment/use-payment-submit-gate.js +47 -8
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +171 -57
- package/dist/matter/place-order/place-order.js +376 -185
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.d.ts +152 -13
- package/dist/matter/pricing/pricing.js +153 -52
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-information/product-information.d.ts +27 -4
- package/dist/matter/product-information/product-information.js +32 -15
- package/dist/matter/product-information/product-information.js.map +1 -1
- package/dist/matter/product-list/product-list.d.ts +24 -6
- package/dist/matter/product-list/product-list.js +32 -26
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
- package/dist/matter/product-shelf/product-shelf.js +2 -15
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.d.ts +33 -16
- package/dist/matter/region/region.js +59 -52
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +43 -8
- package/dist/matter/save-card/save-card.js +61 -23
- package/dist/matter/save-card/save-card.js.map +1 -1
- package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
- package/dist/matter/saved-cards/saved-cards.js +349 -77
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/shipping-address/address-payload.js +25 -0
- package/dist/matter/shipping-address/address-payload.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +71 -71
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
- package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
- package/dist/matter/shipping-address/shipping-address.js +443 -188
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
- package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in/sign-in.d.ts +108 -0
- package/dist/matter/sign-in/sign-in.js +285 -0
- package/dist/matter/sign-in/sign-in.js.map +1 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
- package/dist/matter/sign-in-form/sign-in-form.js +134 -144
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
- package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
- package/dist/particles/binding-switcher/binding-switcher.js +37 -26
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
- package/dist/particles/card-summary/card-summary.d.ts +38 -8
- package/dist/particles/card-summary/card-summary.js +55 -22
- package/dist/particles/card-summary/card-summary.js.map +1 -1
- package/dist/particles/carousel/carousel.d.ts +99 -11
- package/dist/particles/carousel/carousel.js +103 -35
- package/dist/particles/carousel/carousel.js.map +1 -1
- package/dist/particles/copy-text/copy-text.js +5 -15
- package/dist/particles/copy-text/copy-text.js.map +1 -1
- package/dist/particles/dialog/dialog.d.ts +14 -6
- package/dist/particles/dialog/dialog.js +6 -3
- package/dist/particles/dialog/dialog.js.map +1 -1
- package/dist/particles/drawer/drawer.js +1 -1
- package/dist/particles/drawer/drawer.js.map +1 -1
- package/dist/particles/email-field/email-field.d.ts +2 -1
- package/dist/particles/email-field/email-field.js +2 -1
- package/dist/particles/email-field/email-field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.js +1 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/form/form.d.ts +85 -13
- package/dist/particles/form/form.js +91 -42
- package/dist/particles/form/form.js.map +1 -1
- package/dist/particles/gallery/gallery.d.ts +129 -12
- package/dist/particles/gallery/gallery.js +121 -34
- package/dist/particles/gallery/gallery.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
- package/dist/particles/order-details-back/order-details-back.js +8 -10
- package/dist/particles/order-details-back/order-details-back.js.map +1 -1
- package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
- package/dist/particles/order-status-badge/order-status-badge.js +4 -20
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
- package/dist/particles/password-field/password-field.d.ts +1 -1
- package/dist/particles/password-field/password-field.js +2 -4
- package/dist/particles/password-field/password-field.js.map +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +4 -4
- package/dist/particles/phone-field/phone-field.js +8 -11
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/spinner/spinner.d.ts +24 -4
- package/dist/particles/spinner/spinner.js +25 -9
- package/dist/particles/spinner/spinner.js.map +1 -1
- package/dist/particles/switch/switch.d.ts +4 -1
- package/dist/particles/switch/switch.js +3 -1
- package/dist/particles/switch/switch.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +29 -3
- package/dist/particles/toast/toast.js +34 -10
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +164 -56
- package/dist/sdk/address/address-fields.js +4 -4
- package/dist/sdk/address/address-fields.js.map +1 -1
- package/dist/sdk/address/constants.js +1 -6
- package/dist/sdk/address/constants.js.map +1 -1
- package/dist/sdk/address/messages.js +44 -44
- package/dist/sdk/address/messages.js.map +1 -1
- package/dist/sdk/address/postal-code.js +15 -2
- package/dist/sdk/address/postal-code.js.map +1 -1
- package/dist/sdk/address/types.d.ts +5 -3
- package/dist/sdk/address/validate-address.js +3 -3
- package/dist/sdk/address/validate-address.js.map +1 -1
- package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/data/index.js +2 -2
- package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
- package/dist/sdk/generated/gql.js +1 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +20 -5
- package/dist/sdk/generated/graphql.js +6 -0
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/format-error-code.js +23 -0
- package/dist/sdk/i18n/format-error-code.js.map +1 -0
- package/dist/sdk/i18n/message-formatter.d.ts +22 -0
- package/dist/sdk/i18n/message-formatter.js +140 -0
- package/dist/sdk/i18n/message-formatter.js.map +1 -0
- package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
- package/dist/sdk/i18n/use-message-formatter.js +18 -0
- package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/redirect.d.ts +2 -0
- package/dist/sdk/navigation/redirect.js +19 -1
- package/dist/sdk/navigation/redirect.js.map +1 -1
- package/dist/sdk/navigation/types.d.ts +13 -0
- package/dist/sdk/payment/bin-format.js +20 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -3
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/seo/entity-landing.d.ts +24 -0
- package/dist/sdk/seo/entity-landing.js +30 -0
- package/dist/sdk/seo/entity-landing.js.map +1 -0
- package/dist/sdk/seo/page-alternates.d.ts +3 -2
- package/dist/sdk/seo/page-alternates.js +4 -2
- package/dist/sdk/seo/page-alternates.js.map +1 -1
- package/dist/sdk/seo/search-landing.d.ts +42 -0
- package/dist/sdk/seo/search-landing.js +85 -0
- package/dist/sdk/seo/search-landing.js.map +1 -0
- package/dist/sdk/session/mock-session.d.ts +9 -0
- package/dist/sdk/session/mock-session.js +31 -0
- package/dist/sdk/session/mock-session.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +3 -0
- package/dist/sdk/session/read-server-session.js +5 -0
- package/dist/sdk/session/read-server-session.js.map +1 -1
- package/dist/sdk/session/return-path-segment.d.ts +10 -0
- package/dist/sdk/session/return-path-segment.js +15 -0
- package/dist/sdk/session/return-path-segment.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
- package/dist/utils/safe-href.d.ts +2 -0
- package/package.json +4 -3
- package/skills/storefront-asset/SKILL.md +2 -2
- package/skills/storefront-asset/references/api-side.md +27 -14
- package/skills/storefront-asset/references/findings.md +5 -2
- package/src/styles/tailwind.css +8 -0
- package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
- package/dist/message-locales.json +0 -7
- package/dist/sdk/i18n/client.d.ts +0 -4
- package/dist/sdk/i18n/client.js +0 -4
- package/dist/sdk/i18n/locales.d.ts +0 -8
- package/dist/sdk/i18n/locales.js +0 -57
- package/dist/sdk/i18n/locales.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.js +0 -183
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -178
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
- package/dist/sdk/i18n/messages/es-ES.js +0 -183
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -178
- package/dist/sdk/i18n/messages/pt-BR.js +0 -183
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -178
- package/dist/sdk/i18n/provider.d.ts +0 -1
- package/dist/sdk/i18n/provider.js +0 -30
- package/dist/sdk/i18n/provider.js.map +0 -1
- package/dist/sdk/i18n/server.d.ts +0 -28
- package/dist/sdk/i18n/server.js +0 -59
- package/dist/sdk/i18n/server.js.map +0 -1
- package/dist/utils/resolve-authored-copy.js +0 -18
- package/dist/utils/resolve-authored-copy.js.map +0 -1
- package/dist/utils/substitute-template.js +0 -33
- package/dist/utils/substitute-template.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-button.js","names":[],"sources":["../../../src/matter/buy-button/buy-button.tsx"],"sourcesContent":["'use client';\n\nimport { useReactiveVar } from '@apollo/client/react';\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { createContext, Suspense, useContext, useState } from 'react';\nimport { Button } from '../../particles/button/button.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { HotDataProvider } from '../../sdk/data/hot-data-provider.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport type { VariantBuyButtonDataFragment } from '../../sdk/generated/graphql.js';\nimport { resolveDefaultSeller } from '../../sdk/seller.js';\nimport { publishedVariantIdFor, selectedVariantVar } from '../../sdk/state/variant-selector.js';\nimport { useProductQuantity } from '../product-quantity/product-quantity.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment BuyButtonData on Query {\n productBySlug(slug: $slug) {\n id\n title\n slug\n images(first: 1) {\n edges {\n node {\n url\n altText\n }\n }\n }\n variants(first: 1) {\n edges {\n node {\n id\n sku\n availableForSale\n sellers {\n id\n isDefault\n offer {\n price { amount currencyCode }\n listPrice { amount currencyCode }\n }\n }\n }\n }\n }\n }\n }\n`;\n\n// Variant slice carrying the selected variant's availability plus its default seller, authored via\n// graphql() so HotDataProvider gets a TypedDocumentNode. Declared so codegen scans the source and\n// emits VariantBuyButtonDataFragment; the fragment is spread into variantQuery at the GraphQL layer,\n// so the variable is unused at runtime. `offer` is selected only as the same purchasability gate the\n// product transform applies — the buy button never displays price.\nconst _variantFragment = graphql(`\n fragment VariantBuyButtonData on Variant {\n __typename\n id\n availableForSale\n sellers {\n id\n isDefault\n offer {\n price { amount currencyCode }\n }\n }\n }\n`);\n\nconst variantQuery = graphql(`\n query VariantBuyButtonQuery($id: ID!) {\n node(id: $id) {\n __typename\n ... on Variant {\n ...VariantBuyButtonData\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Raw data types (shape of the fragment result)\n// ---------------------------------------------------------------------------\n\ntype MoneyValue = {\n amount: number;\n currencyCode: string;\n};\n\ntype RawBuyButtonData = {\n id: string;\n title: string;\n slug: string;\n images: {\n edges: Array<{\n node: {\n url: string;\n altText: string | null;\n };\n }>;\n };\n variants: {\n edges: Array<{\n node: {\n id: string;\n sku: string;\n availableForSale: boolean;\n sellers: Array<{\n id: string;\n isDefault: boolean;\n offer: {\n price: MoneyValue;\n listPrice: MoneyValue;\n } | null;\n }>;\n };\n }>;\n };\n};\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const BuyButtonLabels = defineContentType({\n id: 'buy-button-labels',\n title: 'Buy Button Labels',\n description: 'Editorial labels for the add-to-cart button.',\n schema: {\n type: 'object',\n additionalProperties: false,\n required: ['availableLabel', 'unavailableLabel'],\n properties: {\n availableLabel: { type: 'string', minLength: 1, title: 'Available label', default: 'Comprar' },\n unavailableLabel: { type: 'string', minLength: 1, title: 'Unavailable label', default: 'Indisponivel' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype BuyButtonContextData = {\n available: boolean;\n /** Identifiers passed to useCart().addItem when the button is clicked. */\n variantId: string;\n seller: string;\n};\n\ntype BuyButtonContextValue = BuyButtonContextData | null;\n\nconst BUYBUTTON_CONTEXT_UNSET = Symbol('BuyButtonContextUnset');\n\nexport type BuyButtonRootProps = ComponentPropsWithRef<'div'> & {\n $data?: RawBuyButtonData | null;\n /** Page-supplied viewed SKU; adds this variant before the shopper interacts. A published swatch\n * selection wins over it once set. */\n selectedVariantId?: string;\n};\n\nexport type BuyButtonButtonProps = ComponentPropsWithRef<'button'> & {\n availableLabel?: string;\n unavailableLabel?: string;\n /** Merchant-authored labels, sliced from the page/layout content entry; win over the label props\n * when present. Absent in a non-CMS store — the label props (and their defaults) are the fallback. */\n $content?: ContentValue<typeof BuyButtonLabels>;\n /** Injected by the compiler from `actions: { cart: ['addItem'] }`; the cart write surface. */\n $actions?: ComponentActions;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst BuyButtonContext = createContext<BuyButtonContextValue | typeof BUYBUTTON_CONTEXT_UNSET>(BUYBUTTON_CONTEXT_UNSET);\n\nfunction useBuyButton(): BuyButtonContextValue {\n const ctx = useContext(BuyButtonContext);\n if (ctx === BUYBUTTON_CONTEXT_UNSET) {\n throw new Error('BuyButton components must be used inside BuyButtonRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Transform\n// ---------------------------------------------------------------------------\n\n// Builds the add-to-cart context from a variant: the SKU (its Node id), its default seller, and its\n// availability. A variant whose resolved seller has no purchasable offer yields null (the button does\n// not render). Shared by the product-level and selected-variant transforms so the default-seller +\n// offer gate lives in one place.\nfunction buyButtonContextFromVariant(variant: {\n id: string;\n availableForSale: boolean;\n sellers: readonly { id: string; isDefault: boolean; offer: unknown }[];\n}): BuyButtonContextData | null {\n const seller = resolveDefaultSeller(variant.sellers);\n if (!seller?.offer) return null;\n\n return {\n available: variant.availableForSale,\n variantId: variant.id,\n seller: seller.id,\n };\n}\n\nfunction transformBuyButtonData(data: RawBuyButtonData): BuyButtonContextData | null {\n const edge = data.variants.edges[0];\n if (!edge) return null;\n\n return buyButtonContextFromVariant(edge.node);\n}\n\nexport function transformVariantBuyButtonData(variant: VariantBuyButtonDataFragment): BuyButtonContextData | null {\n return buyButtonContextFromVariant(variant);\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const BuyButtonRootDefinition = defineComponent<BuyButtonRootProps>({\n name: 'BuyButtonRoot',\n importPath: '@vtex/faststore/components',\n component: BuyButtonRoot,\n fragment,\n skeleton: BuyButtonSkeleton,\n editor: { label: 'Buy Button', category: 'commerce' },\n schema: {\n selectedVariantId: { type: 'string', label: 'Selected Variant ID' },\n },\n guideline:\n 'Data provider for the buy button; place it on PDPs with BuyButtonButton as a child. Adds the variant the shopper picks (it reads the published VariantSelector selection), sending that SKU and its seller to the cart; the selectedVariantId prop is an optional pre-selection fallback, and it falls back to the product first variant on a variant fetch error. Cart writes flow through $actions.cart, so no CartRoot ancestor is required. See buy-button.md.',\n});\n\nexport const BuyButtonButtonDefinition = defineComponent({\n name: 'BuyButtonButton',\n importPath: '@vtex/faststore/components',\n component: BuyButtonButton,\n content: BuyButtonLabels,\n editor: { label: 'Buy Button Action', category: 'commerce' },\n schema: {\n availableLabel: { type: 'string', default: 'Comprar', label: 'Available label' },\n unavailableLabel: { type: 'string', default: 'Indisponivel', label: 'Unavailable label' },\n },\n actions: { cart: ['addItem'] },\n guideline:\n 'The add-to-cart button; must be a descendant of BuyButtonRoot. Cart writes flow through $actions.cart, so no CartRoot ancestor is required.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function BuyButtonRoot({ $data, selectedVariantId, children, ...props }: BuyButtonRootProps) {\n const productSlice = $data ?? null;\n\n // Read the shopper's published variant selection so the button adds the variant the shopper picked\n // — the selected SKU, its seller, and its availability — without a page navigation, scoped to this\n // product. The explicit selectedVariantId prop is the pre-selection fallback; the live published\n // selection wins once set.\n const publishedSelection = useReactiveVar(selectedVariantVar);\n const publishedVariantId = publishedVariantIdFor(publishedSelection, productSlice?.id ?? null);\n const activeVariantId = publishedVariantId ?? selectedVariantId;\n\n if (activeVariantId) {\n return (\n <Suspense fallback={null}>\n <HotDataProvider\n query={variantQuery}\n variables={{ id: activeVariantId }}\n field=\"node\"\n fallbackData={productSlice}\n >\n <BuyButtonProvider fallbackProductSlice={productSlice} {...props}>\n {children}\n </BuyButtonProvider>\n </HotDataProvider>\n </Suspense>\n );\n }\n\n const contextValue = productSlice ? transformBuyButtonData(productSlice) : null;\n\n return (\n <BuyButtonView contextValue={contextValue} {...props}>\n {children}\n </BuyButtonView>\n );\n}\n\ntype BuyButtonProviderProps = Omit<BuyButtonRootProps, '$data' | 'selectedVariantId'> & {\n fallbackProductSlice: RawBuyButtonData | null;\n};\n\n// Reads the override written by the nested HotDataProvider: a Variant node when the variant fetch\n// succeeds, or the product slice (fallbackData) on error/null. Dispatch on __typename so the whole\n// add-to-cart context — availability, the SKU (variantId), and the seller — resolves from the\n// selected variant; always source the product path from the explicit fallback prop so a mis-passed\n// Product node id can never crash the variant transform.\nfunction BuyButtonProvider({ fallbackProductSlice, ...viewProps }: BuyButtonProviderProps) {\n const override = useDataOverride<unknown>(null);\n const overrideTypename = (override as { __typename?: string } | null)?.__typename;\n\n let contextValue: BuyButtonContextValue = null;\n if (overrideTypename === 'Variant') {\n contextValue = transformVariantBuyButtonData(override as VariantBuyButtonDataFragment);\n } else if (fallbackProductSlice) {\n contextValue = transformBuyButtonData(fallbackProductSlice);\n }\n\n return <BuyButtonView contextValue={contextValue} {...viewProps} />;\n}\n\ntype BuyButtonViewProps = Omit<BuyButtonRootProps, '$data' | 'selectedVariantId'> & {\n contextValue: BuyButtonContextValue;\n};\n\nfunction BuyButtonView({ contextValue, className, children, ...props }: BuyButtonViewProps) {\n return (\n <BuyButtonContext value={contextValue}>\n <div {...props} className={className} data-fs-buy-button=\"\">\n {children}\n </div>\n </BuyButtonContext>\n );\n}\n\nexport function BuyButtonButton({\n availableLabel = 'Comprar',\n unavailableLabel = 'Indisponivel',\n className,\n children,\n onClick,\n $content,\n $actions: $actionsProp,\n ...props\n}: BuyButtonButtonProps) {\n const $actions = useActionsOverride($actionsProp);\n const ctx = useBuyButton();\n // `addItem` is async with no optimistic response, so the button owns its pending state locally\n // (the action surface no longer exposes a shared `addItemPending`).\n const [addItemPending, setAddItemPending] = useState(false);\n const { quantity } = useProductQuantity();\n\n if (!ctx) return null;\n\n const { available, variantId, seller } = ctx;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n const addItem = $actions?.cart?.addItem;\n if (addItem) {\n setAddItemPending(true);\n void addItem({ variantId, seller, quantity }).finally(() => setAddItemPending(false));\n }\n onClick?.(e);\n }\n\n const isUnavailable = !available;\n const defaultText = isUnavailable\n ? ($content?.unavailableLabel ?? unavailableLabel)\n : ($content?.availableLabel ?? availableLabel);\n\n return (\n <Button\n {...props}\n className={className}\n onClick={handleClick}\n disabled={isUnavailable || addItemPending}\n aria-busy={addItemPending || undefined}\n data-fs-buy-button-button=\"\"\n {...(isUnavailable ? { 'data-fs-buy-button-unavailable': '' } : {})}\n {...(addItemPending ? { 'data-fs-buy-button-pending': '' } : {})}\n >\n {children ?? defaultText}\n </Button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton\n// ---------------------------------------------------------------------------\n\nexport function BuyButtonSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} data-fs-buy-button-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-buy-button-skeleton-line=\"\" />\n </div>\n );\n}\n\nBuyButtonRoot.Skeleton = BuyButtonSkeleton;\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const BuyButton = {\n Root: BuyButtonRoot,\n Button: BuyButtonButton,\n Skeleton: BuyButtonSkeleton,\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"buy-button.js","names":[],"sources":["../../../src/matter/buy-button/buy-button.tsx"],"sourcesContent":["'use client';\n\nimport { useReactiveVar } from '@apollo/client/react';\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef } from 'react';\nimport { createContext, Suspense, useContext, useState } from 'react';\nimport { Button } from '../../particles/button/button.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { HotDataProvider } from '../../sdk/data/hot-data-provider.js';\nimport { graphql } from '../../sdk/generated/gql.js';\nimport type { VariantBuyButtonDataFragment } from '../../sdk/generated/graphql.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { resolveDefaultSeller } from '../../sdk/seller.js';\nimport { publishedVariantIdFor, selectedVariantVar } from '../../sdk/state/variant-selector.js';\nimport { useProductQuantity } from '../product-quantity/product-quantity.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment BuyButtonData on Query {\n productBySlug(slug: $slug) {\n id\n title\n slug\n images(first: 1) {\n edges {\n node {\n url\n altText\n }\n }\n }\n variants(first: 1) {\n edges {\n node {\n id\n sku\n availableForSale\n sellers {\n id\n isDefault\n offer {\n price { amount currencyCode }\n listPrice { amount currencyCode }\n }\n }\n }\n }\n }\n }\n }\n`;\n\n// Variant slice carrying the selected variant's availability plus its default seller, authored via\n// graphql() so HotDataProvider gets a TypedDocumentNode. Declared so codegen scans the source and\n// emits VariantBuyButtonDataFragment; the fragment is spread into variantQuery at the GraphQL layer,\n// so the variable is unused at runtime. `offer` is selected only as the same purchasability gate the\n// product transform applies — the buy button never displays price.\nconst _variantFragment = graphql(`\n fragment VariantBuyButtonData on Variant {\n __typename\n id\n availableForSale\n sellers {\n id\n isDefault\n offer {\n price { amount currencyCode }\n }\n }\n }\n`);\n\nconst variantQuery = graphql(`\n query VariantBuyButtonQuery($id: ID!) {\n node(id: $id) {\n __typename\n ... on Variant {\n ...VariantBuyButtonData\n }\n }\n }\n`);\n\n// ---------------------------------------------------------------------------\n// Raw data types (shape of the fragment result)\n// ---------------------------------------------------------------------------\n\ntype MoneyValue = {\n amount: number;\n currencyCode: string;\n};\n\ntype RawBuyButtonData = {\n id: string;\n title: string;\n slug: string;\n images: {\n edges: Array<{\n node: {\n url: string;\n altText: string | null;\n };\n }>;\n };\n variants: {\n edges: Array<{\n node: {\n id: string;\n sku: string;\n availableForSale: boolean;\n sellers: Array<{\n id: string;\n isDefault: boolean;\n offer: {\n price: MoneyValue;\n listPrice: MoneyValue;\n } | null;\n }>;\n };\n }>;\n };\n};\n\n// ---------------------------------------------------------------------------\n// Content model\n// ---------------------------------------------------------------------------\n\nexport const BuyButtonLabels = defineContentType({\n id: 'buy-button-labels',\n title: 'Buy Button Labels',\n description: 'Labels of the add-to-cart button.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n availableLabel: {\n type: 'string',\n minLength: 1,\n title: 'Available label',\n format: 'icu-message',\n messageSource: 'Buy',\n },\n unavailableLabel: {\n type: 'string',\n minLength: 1,\n title: 'Unavailable label',\n format: 'icu-message',\n messageSource: 'Unavailable',\n },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype BuyButtonContextData = {\n available: boolean;\n /** Identifiers passed to useCart().addItem when the button is clicked. */\n variantId: string;\n seller: string;\n};\n\ntype BuyButtonContextValue = BuyButtonContextData | null;\n\nconst BUYBUTTON_CONTEXT_UNSET = Symbol('BuyButtonContextUnset');\n\nexport type BuyButtonRootProps = ComponentPropsWithRef<'div'> & {\n $data?: RawBuyButtonData | null;\n /** Page-supplied viewed SKU; adds this variant before the shopper interacts. A published swatch\n * selection wins over it once set. */\n selectedVariantId?: string;\n};\n\nexport type BuyButtonButtonProps = ComponentPropsWithRef<'button'> &\n MessageLocaleProp & {\n $content?: ContentValue<typeof BuyButtonLabels>;\n /** Injected by the compiler from `actions: { cart: ['addItem'] }`; the cart write surface. */\n $actions?: ComponentActions;\n };\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst BuyButtonContext = createContext<BuyButtonContextValue | typeof BUYBUTTON_CONTEXT_UNSET>(BUYBUTTON_CONTEXT_UNSET);\n\nfunction useBuyButton(): BuyButtonContextValue {\n const ctx = useContext(BuyButtonContext);\n if (ctx === BUYBUTTON_CONTEXT_UNSET) {\n throw new Error('BuyButton components must be used inside BuyButtonRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Transform\n// ---------------------------------------------------------------------------\n\n// Builds the add-to-cart context from a variant: the SKU (its Node id), its default seller, and its\n// availability. A variant whose resolved seller has no purchasable offer yields null (the button does\n// not render). Shared by the product-level and selected-variant transforms so the default-seller +\n// offer gate lives in one place.\nfunction buyButtonContextFromVariant(variant: {\n id: string;\n availableForSale: boolean;\n sellers: readonly { id: string; isDefault: boolean; offer: unknown }[];\n}): BuyButtonContextData | null {\n const seller = resolveDefaultSeller(variant.sellers);\n if (!seller?.offer) return null;\n\n return {\n available: variant.availableForSale,\n variantId: variant.id,\n seller: seller.id,\n };\n}\n\nfunction transformBuyButtonData(data: RawBuyButtonData): BuyButtonContextData | null {\n const edge = data.variants.edges[0];\n if (!edge) return null;\n\n return buyButtonContextFromVariant(edge.node);\n}\n\nexport function transformVariantBuyButtonData(variant: VariantBuyButtonDataFragment): BuyButtonContextData | null {\n return buyButtonContextFromVariant(variant);\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const BuyButtonRootDefinition = defineComponent<BuyButtonRootProps>({\n name: 'BuyButtonRoot',\n importPath: '@vtex/faststore/components',\n component: BuyButtonRoot,\n fragment,\n skeleton: BuyButtonSkeleton,\n editor: { label: 'Buy Button', category: 'commerce' },\n schema: {\n selectedVariantId: { type: 'string', label: 'Selected Variant ID' },\n },\n guideline:\n 'Data provider for the buy button; place it on PDPs with BuyButtonButton as a child. Adds the variant the shopper picks (it reads the published VariantSelector selection), sending that SKU and its seller to the cart; the selectedVariantId prop is an optional pre-selection fallback, and it falls back to the product first variant on a variant fetch error. Cart writes flow through $actions.cart, so no CartRoot ancestor is required. See buy-button.md.',\n});\n\nexport const BuyButtonButtonDefinition = defineComponent({\n name: 'BuyButtonButton',\n importPath: '@vtex/faststore/components',\n component: BuyButtonButton,\n content: BuyButtonLabels,\n editor: { label: 'Buy Button Action', category: 'commerce' },\n schema: {},\n actions: { cart: ['addItem'] },\n guideline:\n 'The add-to-cart button; must be a descendant of BuyButtonRoot. Cart writes flow through $actions.cart, so no CartRoot ancestor is required.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\nexport function BuyButtonRoot({ $data, selectedVariantId, children, ...props }: BuyButtonRootProps) {\n const productSlice = $data ?? null;\n\n // Read the shopper's published variant selection so the button adds the variant the shopper picked\n // — the selected SKU, its seller, and its availability — without a page navigation, scoped to this\n // product. The explicit selectedVariantId prop is the pre-selection fallback; the live published\n // selection wins once set.\n const publishedSelection = useReactiveVar(selectedVariantVar);\n const publishedVariantId = publishedVariantIdFor(publishedSelection, productSlice?.id ?? null);\n const activeVariantId = publishedVariantId ?? selectedVariantId;\n\n if (activeVariantId) {\n return (\n <Suspense fallback={null}>\n <HotDataProvider\n query={variantQuery}\n variables={{ id: activeVariantId }}\n field=\"node\"\n fallbackData={productSlice}\n >\n <BuyButtonProvider fallbackProductSlice={productSlice} {...props}>\n {children}\n </BuyButtonProvider>\n </HotDataProvider>\n </Suspense>\n );\n }\n\n const contextValue = productSlice ? transformBuyButtonData(productSlice) : null;\n\n return (\n <BuyButtonView contextValue={contextValue} {...props}>\n {children}\n </BuyButtonView>\n );\n}\n\ntype BuyButtonProviderProps = Omit<BuyButtonRootProps, '$data' | 'selectedVariantId'> & {\n fallbackProductSlice: RawBuyButtonData | null;\n};\n\n// Reads the override written by the nested HotDataProvider: a Variant node when the variant fetch\n// succeeds, or the product slice (fallbackData) on error/null. Dispatch on __typename so the whole\n// add-to-cart context — availability, the SKU (variantId), and the seller — resolves from the\n// selected variant; always source the product path from the explicit fallback prop so a mis-passed\n// Product node id can never crash the variant transform.\nfunction BuyButtonProvider({ fallbackProductSlice, ...viewProps }: BuyButtonProviderProps) {\n const override = useDataOverride<unknown>(null);\n const overrideTypename = (override as { __typename?: string } | null)?.__typename;\n\n let contextValue: BuyButtonContextValue = null;\n if (overrideTypename === 'Variant') {\n contextValue = transformVariantBuyButtonData(override as VariantBuyButtonDataFragment);\n } else if (fallbackProductSlice) {\n contextValue = transformBuyButtonData(fallbackProductSlice);\n }\n\n return <BuyButtonView contextValue={contextValue} {...viewProps} />;\n}\n\ntype BuyButtonViewProps = Omit<BuyButtonRootProps, '$data' | 'selectedVariantId'> & {\n contextValue: BuyButtonContextValue;\n};\n\nfunction BuyButtonView({ contextValue, className, children, ...props }: BuyButtonViewProps) {\n return (\n <BuyButtonContext value={contextValue}>\n <div {...props} className={className} data-fs-buy-button=\"\">\n {children}\n </div>\n </BuyButtonContext>\n );\n}\n\nexport function BuyButtonButton({\n className,\n children,\n onClick,\n $content,\n $locale,\n $actions: $actionsProp,\n ...props\n}: BuyButtonButtonProps) {\n const $actions = useActionsOverride($actionsProp);\n const { format } = useMessageFormatter(BuyButtonLabels, $content);\n const ctx = useBuyButton();\n // `addItem` is async with no optimistic response, so the button owns its pending state locally\n // (the action surface no longer exposes a shared `addItemPending`).\n const [addItemPending, setAddItemPending] = useState(false);\n const { quantity } = useProductQuantity();\n\n if (!ctx) return null;\n\n const { available, variantId, seller } = ctx;\n\n function handleClick(e: React.MouseEvent<HTMLButtonElement>) {\n const addItem = $actions?.cart?.addItem;\n if (addItem) {\n setAddItemPending(true);\n void addItem({ variantId, seller, quantity }).finally(() => setAddItemPending(false));\n }\n onClick?.(e);\n }\n\n const isUnavailable = !available;\n\n return (\n <Button\n {...props}\n className={className}\n onClick={handleClick}\n disabled={isUnavailable || addItemPending}\n aria-busy={addItemPending || undefined}\n data-fs-buy-button-button=\"\"\n {...(isUnavailable ? { 'data-fs-buy-button-unavailable': '' } : {})}\n {...(addItemPending ? { 'data-fs-buy-button-pending': '' } : {})}\n >\n {children ?? format(isUnavailable ? 'unavailableLabel' : 'availableLabel')}\n </Button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton\n// ---------------------------------------------------------------------------\n\nexport function BuyButtonSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} data-fs-buy-button-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-buy-button-skeleton-line=\"\" />\n </div>\n );\n}\n\nBuyButtonRoot.Skeleton = BuyButtonSkeleton;\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const BuyButton = {\n Root: BuyButtonRoot,\n Button: BuyButtonButton,\n Skeleton: BuyButtonSkeleton,\n};\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createContext, useContext, useEffect } from "react";
|
|
2
|
+
import { createContext, useContext, useEffect, useLayoutEffect } from "react";
|
|
3
3
|
//#region src/matter/card-entry/card-capture.tsx
|
|
4
4
|
const CARD_CAPTURE_CONTEXT_UNSET = Symbol("CardCaptureContextUnset");
|
|
5
5
|
const CardCaptureContextInternal = createContext(CARD_CAPTURE_CONTEXT_UNSET);
|
|
@@ -10,15 +10,23 @@ function useCardCapture() {
|
|
|
10
10
|
if (ctx === CARD_CAPTURE_CONTEXT_UNSET) throw new Error("useCardCapture() must be used inside a card-capture provider (PaymentSectionRoot, PaymentSectionController).");
|
|
11
11
|
return ctx;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Registers on mount and on any argument change, so the provider always holds the latest closure.
|
|
15
|
+
* Registration runs in the layout phase: before paint and before any passive effect of the commit, so
|
|
16
|
+
* a click on a render that no discrete event caused cannot resolve the previous commit's closure.
|
|
17
|
+
* The provider is told about the mount from a passive effect, once every layout effect has refreshed it.
|
|
18
|
+
*/
|
|
14
19
|
function useRegisterCardCapture(capture, preflight, explainMissingMethod) {
|
|
15
|
-
const { registerCapture } = useCardCapture();
|
|
16
|
-
|
|
20
|
+
const { registerCapture, onCaptureMounted } = useCardCapture();
|
|
21
|
+
useLayoutEffect(() => registerCapture(capture, preflight, explainMissingMethod), [
|
|
17
22
|
registerCapture,
|
|
18
23
|
capture,
|
|
19
24
|
preflight,
|
|
20
25
|
explainMissingMethod
|
|
21
26
|
]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
onCaptureMounted?.();
|
|
29
|
+
}, [onCaptureMounted]);
|
|
22
30
|
}
|
|
23
31
|
//#endregion
|
|
24
32
|
export { CardCaptureContext, useCardCapture, useRegisterCardCapture };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-capture.js","names":[],"sources":["../../../src/matter/card-entry/card-capture.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useEffect } from 'react';\nimport type { PaymentSubmissionPath } from '../../sdk/payment/submission-registry.js';\n\n/**\n * The `card-capture` context (specs/sfs-3457-card-entry-card-capture-context.md): everything\n * `CardEntry` needs from whichever surface composes it. The fields own the card values; the provider\n * owns the accepted networks, when a capture runs, and where the card goes. This is the PCI context:\n * `CardEntry` is its only consumer.\n */\n\nexport type CardCaptureValidator = Readonly<{\n numberMask: string | null;\n numberRegex: string | null;\n cvvMask: string | null;\n cvvRegex: string | null;\n cvvRequired: boolean;\n expirationRequired: boolean;\n holderNameRequired: boolean;\n}>;\n\n/** One accepted network and its validation rules. `PaymentSectionMethod` is assignable to it. */\nexport type CardCaptureNetwork = Readonly<{\n id: string;\n name: string;\n validator: CardCaptureValidator;\n}>;\n\n/** The card as the fields hold it. Exists only as the argument of one `send` call. */\nexport type CapturedCard = Readonly<{\n number: string;\n securityCode: string;\n expirationDate: string;\n holderName: string;\n}>;\n\nexport type CardCaptureError = Readonly<{ code: string; message: string }>;\n\n/**\n * What a capture and its target resolve (T112). `reachedGateway` is `false` only when no request was\n * issued — `CardEntry`'s own refusals set it, and a target passes through whatever its transport reports.\n * Kept local rather than imported from the SDK: `CardEntry` is surface-agnostic, and the account will\n * tokenize through the same context.\n */\nexport type CardCaptureResult = Readonly<{ reachedGateway: boolean; userErrors: readonly CardCaptureError[] }>;\n\nexport type CardCaptureTarget = (card: CapturedCard) => Promise<CardCaptureResult>;\n\n/** Registered by `CardEntry`; the provider calls it with the target for this one submission. */\nexport type CardCapture = (send: CardCaptureTarget) => Promise<CardCaptureResult>;\n\n/** Synchronous, I/O-free verdict on the draft, with the same contract as `PaymentPreflightCheck`. */\nexport type CardCapturePreflight = () => readonly CardCaptureError[];\n\n/**\n * Synchronous, side-effect-free explanation of why no payment method is selected (T47), with the same\n * contract as `PaymentMissingMethodExplainer`: returns the refusal that names the card as the reason, or\n * `null`. Fixed copy and a fixed code only; it never echoes anything the shopper typed.\n */\nexport type CardCaptureMissingMethodExplainer = () => CardCaptureError | null;\n\n/** The checkout facts `CardEntry` reacts to. Absent outside the checkout. */\nexport type CardCaptureSelection = Readonly<{\n selectMethod: (input: { methodId: string; bin: string }) => void;\n selectNewCard: () => void;\n setDraftBin: (bin: string | null) => void;\n path: PaymentSubmissionPath | null;\n bin: string | null;\n collapsed: boolean;\n cardModeActive: boolean;\n selectedMethodId: string | null;\n selectionOutOfScope: boolean;\n selectionNonCard: boolean;\n}>;\n\nexport type CardCaptureContextValue = Readonly<{\n networks: readonly CardCaptureNetwork[];\n busy: boolean;\n /** When `CardEntry` clears its fields after the target settles. A pre-flight refusal never clears. */\n clearOn: 'success' | 'any-outcome';\n /** Registers the capture, its pre-flight check and, optionally, its missing-method explainer. Returns the unregister function. */\n registerCapture: (\n capture: CardCapture,\n preflight: CardCapturePreflight,\n explainMissingMethod?: CardCaptureMissingMethodExplainer,\n ) => () => void;\n /** Called with the resolved network's id, or `null`, whenever that resolution changes. */\n onNetworkChange?: (networkId: string | null) => void;\n selection?: CardCaptureSelection;\n}>;\n\nconst CARD_CAPTURE_CONTEXT_UNSET = Symbol('CardCaptureContextUnset');\n\nconst CardCaptureContextInternal = createContext<CardCaptureContextValue | typeof CARD_CAPTURE_CONTEXT_UNSET>(\n CARD_CAPTURE_CONTEXT_UNSET,\n);\n\nexport const CardCaptureContext = CardCaptureContextInternal as React.Context<CardCaptureContextValue>;\n\n/** Throws outside a provider, mirroring `usePayment()`: a misplaced `CardEntry` is a composition bug. */\nexport function useCardCapture(): CardCaptureContextValue {\n const ctx = useContext(CardCaptureContextInternal);\n if (ctx === CARD_CAPTURE_CONTEXT_UNSET) {\n throw new Error(\n 'useCardCapture() must be used inside a card-capture provider (PaymentSectionRoot, PaymentSectionController).',\n );\n }\n return ctx;\n}\n\n
|
|
1
|
+
{"version":3,"file":"card-capture.js","names":[],"sources":["../../../src/matter/card-entry/card-capture.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, useEffect, useLayoutEffect } from 'react';\nimport type { PaymentSubmissionPath } from '../../sdk/payment/submission-registry.js';\n\n/**\n * The `card-capture` context (specs/sfs-3457-card-entry-card-capture-context.md): everything\n * `CardEntry` needs from whichever surface composes it. The fields own the card values; the provider\n * owns the accepted networks, when a capture runs, and where the card goes. This is the PCI context:\n * `CardEntry` is its only consumer.\n */\n\nexport type CardCaptureValidator = Readonly<{\n numberMask: string | null;\n numberRegex: string | null;\n cvvMask: string | null;\n cvvRegex: string | null;\n cvvRequired: boolean;\n expirationRequired: boolean;\n holderNameRequired: boolean;\n}>;\n\n/** One accepted network and its validation rules. `PaymentSectionMethod` is assignable to it. */\nexport type CardCaptureNetwork = Readonly<{\n id: string;\n name: string;\n validator: CardCaptureValidator;\n}>;\n\n/** The card as the fields hold it. Exists only as the argument of one `send` call. */\nexport type CapturedCard = Readonly<{\n number: string;\n securityCode: string;\n expirationDate: string;\n holderName: string;\n}>;\n\nexport type CardCaptureError = Readonly<{ code: string; message: string }>;\n\n/**\n * What a capture and its target resolve (T112). `reachedGateway` is `false` only when no request was\n * issued — `CardEntry`'s own refusals set it, and a target passes through whatever its transport reports.\n * Kept local rather than imported from the SDK: `CardEntry` is surface-agnostic, and the account will\n * tokenize through the same context.\n */\nexport type CardCaptureResult = Readonly<{ reachedGateway: boolean; userErrors: readonly CardCaptureError[] }>;\n\nexport type CardCaptureTarget = (card: CapturedCard) => Promise<CardCaptureResult>;\n\n/** Registered by `CardEntry`; the provider calls it with the target for this one submission. */\nexport type CardCapture = (send: CardCaptureTarget) => Promise<CardCaptureResult>;\n\n/** Synchronous, I/O-free verdict on the draft, with the same contract as `PaymentPreflightCheck`. */\nexport type CardCapturePreflight = () => readonly CardCaptureError[];\n\n/**\n * Synchronous, side-effect-free explanation of why no payment method is selected (T47), with the same\n * contract as `PaymentMissingMethodExplainer`: returns the refusal that names the card as the reason, or\n * `null`. Fixed copy and a fixed code only; it never echoes anything the shopper typed.\n */\nexport type CardCaptureMissingMethodExplainer = () => CardCaptureError | null;\n\n/** The checkout facts `CardEntry` reacts to. Absent outside the checkout. */\nexport type CardCaptureSelection = Readonly<{\n selectMethod: (input: { methodId: string; bin: string }) => void;\n selectNewCard: () => void;\n setDraftBin: (bin: string | null) => void;\n /**\n * Publishes whether the entry passes length, Luhn, expiration and security code. A boolean and nothing\n * else: the card values stay inside `CardEntry`, and a sibling reads only the verdict.\n */\n setDraftEntryValid: (valid: boolean) => void;\n path: PaymentSubmissionPath | null;\n bin: string | null;\n collapsed: boolean;\n cardModeActive: boolean;\n selectedMethodId: string | null;\n selectionOutOfScope: boolean;\n selectionNonCard: boolean;\n}>;\n\nexport type CardCaptureContextValue = Readonly<{\n networks: readonly CardCaptureNetwork[];\n busy: boolean;\n /** When `CardEntry` clears its fields after the target settles. A pre-flight refusal never clears. */\n clearOn: 'success' | 'any-outcome';\n /** Registers the capture, its pre-flight check and, optionally, its missing-method explainer. Returns the unregister function. */\n registerCapture: (\n capture: CardCapture,\n preflight: CardCapturePreflight,\n explainMissingMethod?: CardCaptureMissingMethodExplainer,\n ) => () => void;\n /**\n * Told once a registered capture is mounted. Takes and returns nothing: the provider reads its own facts.\n * It runs in a passive effect, after every layout effect of the commit, so those facts are fresh.\n */\n onCaptureMounted?: () => void;\n /** Called with the resolved network's id, or `null`, whenever that resolution changes. */\n onNetworkChange?: (networkId: string | null) => void;\n selection?: CardCaptureSelection;\n}>;\n\nconst CARD_CAPTURE_CONTEXT_UNSET = Symbol('CardCaptureContextUnset');\n\nconst CardCaptureContextInternal = createContext<CardCaptureContextValue | typeof CARD_CAPTURE_CONTEXT_UNSET>(\n CARD_CAPTURE_CONTEXT_UNSET,\n);\n\nexport const CardCaptureContext = CardCaptureContextInternal as React.Context<CardCaptureContextValue>;\n\n/** Throws outside a provider, mirroring `usePayment()`: a misplaced `CardEntry` is a composition bug. */\nexport function useCardCapture(): CardCaptureContextValue {\n const ctx = useContext(CardCaptureContextInternal);\n if (ctx === CARD_CAPTURE_CONTEXT_UNSET) {\n throw new Error(\n 'useCardCapture() must be used inside a card-capture provider (PaymentSectionRoot, PaymentSectionController).',\n );\n }\n return ctx;\n}\n\n/**\n * Registers on mount and on any argument change, so the provider always holds the latest closure.\n * Registration runs in the layout phase: before paint and before any passive effect of the commit, so\n * a click on a render that no discrete event caused cannot resolve the previous commit's closure.\n * The provider is told about the mount from a passive effect, once every layout effect has refreshed it.\n */\nexport function useRegisterCardCapture(\n capture: CardCapture,\n preflight: CardCapturePreflight,\n explainMissingMethod?: CardCaptureMissingMethodExplainer,\n): void {\n const { registerCapture, onCaptureMounted } = useCardCapture();\n\n useLayoutEffect(\n () => registerCapture(capture, preflight, explainMissingMethod),\n [registerCapture, capture, preflight, explainMissingMethod],\n );\n\n useEffect(() => {\n onCaptureMounted?.();\n }, [onCaptureMounted]);\n}\n"],"mappings":";;;AAsGA,MAAM,6BAA6B,OAAO,yBAAyB;AAEnE,MAAM,6BAA6B,cACjC,0BACF;AAEA,MAAa,qBAAqB;;AAGlC,SAAgB,iBAA0C;CACxD,MAAM,MAAM,WAAW,0BAA0B;CACjD,IAAI,QAAQ,4BACV,MAAM,IAAI,MACR,8GACF;CAEF,OAAO;AACT;;;;;;;AAQA,SAAgB,uBACd,SACA,WACA,sBACM;CACN,MAAM,EAAE,iBAAiB,qBAAqB,eAAe;CAE7D,sBACQ,gBAAgB,SAAS,WAAW,oBAAoB,GAC9D;EAAC;EAAiB;EAAS;EAAW;CAAoB,CAC5D;CAEA,gBAAgB;EACd,mBAAmB;CACrB,GAAG,CAAC,gBAAgB,CAAC;AACvB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
1
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
3
|
import "../../core/dist/index.js";
|
|
3
4
|
import "../../sdk/payment/submission-registry.js";
|
|
@@ -27,43 +28,133 @@ import { CardCaptureNetwork } from "./card-capture.js";
|
|
|
27
28
|
* first keystroke off the new-card path records that path locally with `selectNewCard()`
|
|
28
29
|
* (specs/collapse-the-card-form-when-a.md, FR-10).
|
|
29
30
|
*/
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
export declare const CardEntryContent: {
|
|
32
|
+
readonly id: "card-entry";
|
|
33
|
+
readonly title: "Card Entry";
|
|
34
|
+
readonly description: "Copy for the new-card fields and their validation messages.";
|
|
35
|
+
readonly schema: {
|
|
36
|
+
readonly type: "object";
|
|
37
|
+
readonly additionalProperties: false;
|
|
38
|
+
readonly properties: {
|
|
39
|
+
readonly legend: {
|
|
40
|
+
readonly type: "string";
|
|
41
|
+
readonly title: "Legend";
|
|
42
|
+
readonly format: "icu-message";
|
|
43
|
+
readonly messageSource: "Card details";
|
|
44
|
+
};
|
|
45
|
+
readonly numberLabel: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly title: "Number label";
|
|
48
|
+
readonly format: "icu-message";
|
|
49
|
+
readonly messageSource: "Card number";
|
|
50
|
+
};
|
|
51
|
+
readonly holderNameLabel: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
readonly title: "Holder name label";
|
|
54
|
+
readonly format: "icu-message";
|
|
55
|
+
readonly messageSource: "Cardholder name";
|
|
56
|
+
};
|
|
57
|
+
readonly expirationLabel: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly title: "Expiration label";
|
|
60
|
+
readonly format: "icu-message";
|
|
61
|
+
readonly messageSource: "Expiration date";
|
|
62
|
+
};
|
|
63
|
+
readonly expirationPlaceholder: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly title: "Expiration placeholder";
|
|
66
|
+
readonly format: "icu-message";
|
|
67
|
+
readonly messageSource: "MM/YY";
|
|
68
|
+
};
|
|
69
|
+
readonly cvvLabel: {
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly title: "CVV label";
|
|
72
|
+
readonly format: "icu-message";
|
|
73
|
+
readonly messageSource: "Security code";
|
|
74
|
+
};
|
|
75
|
+
readonly cvvDescription: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
readonly title: "CVV description";
|
|
78
|
+
readonly description: "Helper text under the CVV field, linked to the input; blank renders nothing.";
|
|
79
|
+
readonly format: "icu-message";
|
|
80
|
+
readonly messageSource: "The 3-4 digit number on your card";
|
|
81
|
+
readonly messageOptional: true;
|
|
82
|
+
};
|
|
83
|
+
readonly numberRequiredMessage: {
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
readonly title: "Number required message";
|
|
86
|
+
readonly description: "Shown on the number field when it is left blank.";
|
|
87
|
+
readonly format: "icu-message";
|
|
88
|
+
readonly messageSource: "Card number is required";
|
|
89
|
+
};
|
|
90
|
+
readonly numberInvalidMessage: {
|
|
91
|
+
readonly type: "string";
|
|
92
|
+
readonly title: "Number invalid message";
|
|
93
|
+
readonly description: "Shown for a Luhn-invalid number, or one a configured network claims only as a prefix (the wrong length, or two networks at once).";
|
|
94
|
+
readonly format: "icu-message";
|
|
95
|
+
readonly messageSource: "Enter a valid card number";
|
|
96
|
+
};
|
|
97
|
+
readonly networkNotAcceptedMessage: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly title: "Network not accepted message";
|
|
100
|
+
readonly description: "Shown for a Luhn-valid number that no configured network claims at all.";
|
|
101
|
+
readonly format: "icu-message";
|
|
102
|
+
readonly messageSource: "This card is not from a network the store accepts";
|
|
103
|
+
};
|
|
104
|
+
readonly holderNameRequiredMessage: {
|
|
105
|
+
readonly type: "string";
|
|
106
|
+
readonly title: "Holder name required message";
|
|
107
|
+
readonly description: "Shown when the holder name is blank and the detected method requires it.";
|
|
108
|
+
readonly format: "icu-message";
|
|
109
|
+
readonly messageSource: "Cardholder name is required";
|
|
110
|
+
};
|
|
111
|
+
readonly expirationRequiredMessage: {
|
|
112
|
+
readonly type: "string";
|
|
113
|
+
readonly title: "Expiration required message";
|
|
114
|
+
readonly description: "Shown when the expiration is blank and the detected method requires it.";
|
|
115
|
+
readonly format: "icu-message";
|
|
116
|
+
readonly messageSource: "Expiration date is required";
|
|
117
|
+
};
|
|
118
|
+
readonly expirationInvalidMessage: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
readonly title: "Expiration invalid message";
|
|
121
|
+
readonly description: "Shown for a malformed MM/YY.";
|
|
122
|
+
readonly format: "icu-message";
|
|
123
|
+
readonly messageSource: "Enter a valid expiration date";
|
|
124
|
+
};
|
|
125
|
+
readonly expirationExpiredMessage: {
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
readonly title: "Expiration expired message";
|
|
128
|
+
readonly description: "Shown for a well-formed MM/YY that has already passed.";
|
|
129
|
+
readonly format: "icu-message";
|
|
130
|
+
readonly messageSource: "This card has expired";
|
|
131
|
+
};
|
|
132
|
+
readonly cvvRequiredMessage: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly title: "CVV required message";
|
|
135
|
+
readonly description: "Shown when the security code is blank and the detected method requires it.";
|
|
136
|
+
readonly format: "icu-message";
|
|
137
|
+
readonly messageSource: "Security code is required";
|
|
138
|
+
};
|
|
139
|
+
readonly cvvInvalidMessage: {
|
|
140
|
+
readonly type: "string";
|
|
141
|
+
readonly title: "CVV invalid message";
|
|
142
|
+
readonly description: "Shown for a security code that fails the detected method's format.";
|
|
143
|
+
readonly format: "icu-message";
|
|
144
|
+
readonly messageSource: "Enter a valid security code";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export type CardEntryProps = MessageLocaleProp & {
|
|
34
150
|
numberPlaceholder?: string;
|
|
35
|
-
holderNameLabel?: string;
|
|
36
151
|
holderNamePlaceholder?: string;
|
|
37
|
-
expirationLabel?: string;
|
|
38
|
-
expirationPlaceholder?: string;
|
|
39
|
-
cvvLabel?: string;
|
|
40
152
|
cvvPlaceholder?: string;
|
|
41
|
-
/** Helper copy under the CVV field, rendered through `Field.Description` and linked to the
|
|
42
|
-
* input via `aria-describedby`. An empty string renders nothing. Copy configuration only —
|
|
43
|
-
* never the security code itself. */
|
|
44
|
-
cvvDescription?: string;
|
|
45
|
-
/** Shown on the number field when it is left blank. */
|
|
46
|
-
numberRequiredMessage?: string;
|
|
47
|
-
/** Shown on the number field for a Luhn-invalid PAN, or a Luhn-valid one that a configured
|
|
48
|
-
* network claims only as a prefix (the wrong length, or two networks at once). */
|
|
49
|
-
numberInvalidMessage?: string;
|
|
50
|
-
/** Shown on the number field for a Luhn-valid PAN that no configured network claims at all. */
|
|
51
|
-
networkNotAcceptedMessage?: string;
|
|
52
|
-
/** Shown on the holder-name field when it is left blank and the detected method requires it. */
|
|
53
|
-
holderNameRequiredMessage?: string;
|
|
54
|
-
/** Shown on the expiration field when it is left blank and the detected method requires it. */
|
|
55
|
-
expirationRequiredMessage?: string;
|
|
56
|
-
/** Shown on the expiration field for a structurally malformed `MM/YY`. */
|
|
57
|
-
expirationInvalidMessage?: string;
|
|
58
|
-
/** Shown on the expiration field for a structurally valid `MM/YY` that has already passed. */
|
|
59
|
-
expirationExpiredMessage?: string;
|
|
60
|
-
/** Shown on the CVV field when it is left blank and the detected method requires it. */
|
|
61
|
-
cvvRequiredMessage?: string;
|
|
62
|
-
/** Shown on the CVV field for a value that fails the detected method's format. */
|
|
63
|
-
cvvInvalidMessage?: string;
|
|
64
153
|
/** Disables every field. */
|
|
65
154
|
disabled?: boolean;
|
|
66
155
|
className?: string;
|
|
156
|
+
/** Merchant-authored copy: the legend, the field labels, the CVV description and the validation messages. */
|
|
157
|
+
$content?: ContentValue<typeof CardEntryContent>;
|
|
67
158
|
};
|
|
68
159
|
/**
|
|
69
160
|
* First method whose `validator.numberRegex` admits `digits` as a BIN-level prefix, or `null`.
|
|
@@ -117,6 +208,6 @@ export declare const CARD_ENTRY_INVALID_DATA_CODE = "INVALID_CARD_DATA";
|
|
|
117
208
|
*/
|
|
118
209
|
export declare const CARD_ENTRY_COLLAPSED_CODE = "CARD_ENTRY_COLLAPSED";
|
|
119
210
|
export declare const CardEntryDefinition: ComponentDefinition<CardEntryProps>;
|
|
120
|
-
export declare function CardEntry({
|
|
211
|
+
export declare function CardEntry({ numberPlaceholder, holderNamePlaceholder, cvvPlaceholder, disabled, className, $content }: Readonly<CardEntryProps>): import("react/jsx-runtime").JSX.Element;
|
|
121
212
|
//#endregion
|
|
122
213
|
//# sourceMappingURL=card-entry.d.ts.map
|