@vtex/faststore 0.0.8 → 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 +101 -0
- package/README.md +0 -1
- package/dist/actions.json +48 -1
- package/dist/catalog.json +1397 -1594
- 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 +67 -56
- package/dist/components.js +64 -53
- package/dist/content-types.json +5886 -555
- package/dist/core/dist/define-component.d.ts +7 -2
- 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-entry-point.md +4 -4
- package/dist/docs/account-menu.md +16 -17
- package/dist/docs/account-saved-cards.md +306 -0
- 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 +157 -0
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +42 -29
- package/dist/docs/card-summary.md +185 -0
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +251 -0
- package/dist/docs/cart-item.md +48 -15
- package/dist/docs/cart-totalizer.md +8 -6
- package/dist/docs/cart.md +240 -39
- 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/footer-social.md +1 -1
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +18 -13
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/incentives.md +2 -2
- package/dist/docs/installments.md +46 -32
- package/dist/docs/logo.md +1 -1
- 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 +32 -6
- package/dist/docs/payment-methods.md +2 -2
- 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 +14 -10
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +7 -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/select.md +3 -4
- 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 +5 -3
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +45 -16
- package/dist/docs/variant-selector.md +15 -11
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +3 -2
- package/dist/internal/client.d.ts +4 -3
- package/dist/internal/client.js +5 -2
- package/dist/internal/server.d.ts +10 -5
- package/dist/internal/server.js +9 -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 +463 -0
- package/dist/matter/account-saved-cards/account-saved-cards.js +1011 -0
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -0
- 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 +11 -1
- package/dist/matter/cart/cart-namespace.js +11 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +416 -45
- package/dist/matter/cart/cart.js +782 -101
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +233 -0
- package/dist/matter/cart-destination/cart-destination.js +703 -0
- package/dist/matter/cart-destination/cart-destination.js.map +1 -0
- package/dist/matter/cart-item/cart-item.d.ts +145 -16
- package/dist/matter/cart-item/cart-item.js +230 -54
- 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 +49 -19
- 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 +85 -10
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +153 -53
- 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 +8 -3
- package/dist/matter/product-shelf/product-shelf.js +111 -10
- 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 +251 -25
- package/dist/matter/shipping-simulator/shipping-simulator.js +261 -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 +59 -0
- package/dist/particles/binding-switcher/binding-switcher.js +194 -0
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -0
- package/dist/particles/card-summary/card-network.d.ts +17 -0
- package/dist/particles/card-summary/card-network.js +25 -0
- package/dist/particles/card-summary/card-network.js.map +1 -0
- package/dist/particles/card-summary/card-summary.d.ts +113 -0
- package/dist/particles/card-summary/card-summary.js +221 -0
- package/dist/particles/card-summary/card-summary.js.map +1 -0
- 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/footer-social/footer-social.d.ts +1 -1
- package/dist/particles/footer-social/footer-social.js +1 -1
- package/dist/particles/footer-social/footer-social.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/incentives/incentives.d.ts +1 -1
- package/dist/particles/incentives/incentives.js +1 -1
- package/dist/particles/incentives/incentives.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/payment-methods/payment-methods.d.ts +1 -1
- package/dist/particles/payment-methods/payment-methods.js +1 -1
- package/dist/particles/payment-methods/payment-methods.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 +49 -9
- package/dist/particles/toast/toast.js +81 -15
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +461 -89
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/locale-action-provider.d.ts +16 -0
- package/dist/sdk/actions/locale-action-provider.js +20 -0
- package/dist/sdk/actions/locale-action-provider.js.map +1 -0
- package/dist/sdk/actions/saved-card-action-provider.d.ts +12 -0
- package/dist/sdk/actions/saved-card-action-provider.js +16 -0
- package/dist/sdk/actions/saved-card-action-provider.js.map +1 -0
- package/dist/sdk/actions/types.d.ts +6 -2
- 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/cache/storefront-cache.js +2 -1
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/operations.d.ts +2 -1
- package/dist/sdk/cart/operations.js +55 -1
- package/dist/sdk/cart/operations.js.map +1 -1
- package/dist/sdk/cart/optimistic.d.ts +30 -7
- package/dist/sdk/cart/optimistic.js +78 -41
- package/dist/sdk/cart/optimistic.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.d.ts +7 -0
- package/dist/sdk/cart/use-cart-actions.js +61 -15
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-sync-sales-channel.js +70 -0
- package/dist/sdk/cart/use-cart-sync-sales-channel.js.map +1 -0
- 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 +16 -12
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +197 -51
- package/dist/sdk/generated/graphql.js +2318 -91
- 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/locale/binding-switch-provider.d.ts +13 -0
- package/dist/sdk/locale/binding-switch-provider.js +20 -0
- package/dist/sdk/locale/binding-switch-provider.js.map +1 -0
- package/dist/sdk/locale/use-locale-actions.d.ts +16 -0
- package/dist/sdk/locale/use-locale-actions.js +70 -0
- package/dist/sdk/locale/use-locale-actions.js.map +1 -0
- package/dist/sdk/navigation/binding-switch.d.ts +39 -0
- package/dist/sdk/navigation/binding-switch.js +129 -0
- package/dist/sdk/navigation/binding-switch.js.map +1 -0
- package/dist/sdk/navigation/decode-route-params.d.ts +11 -0
- package/dist/sdk/navigation/decode-route-params.js +32 -0
- package/dist/sdk/navigation/decode-route-params.js.map +1 -0
- 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/saved-cards/operations.d.ts +16 -0
- package/dist/sdk/saved-cards/operations.js +41 -0
- package/dist/sdk/saved-cards/operations.js.map +1 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.d.ts +26 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.js +86 -0
- package/dist/sdk/saved-cards/use-saved-card-actions.js.map +1 -0
- 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 +8 -5
- package/dist/sdk/seo/page-alternates.js +11 -14
- 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/shipping-operations.d.ts +1 -1
- package/dist/sdk/shipping/shipping-operations.js +13 -0
- package/dist/sdk/shipping/shipping-operations.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/sdk/state/cart.d.ts +9 -2
- package/dist/sdk/state/cart.js +9 -2
- package/dist/sdk/state/cart.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 +9 -2
- 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 -164
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -159
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -163
- package/dist/sdk/i18n/messages/es-ES.js +0 -164
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -159
- package/dist/sdk/i18n/messages/pt-BR.js +0 -164
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -159
- 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":"use-payment-submit-gate.js","names":[],"sources":["../../../src/matter/payment/use-payment-submit-gate.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { type DocumentType, isValidDocument } from '../../particles/document-field/document-field.js';\nimport type { PaymentUserError } from '../../sdk/payment/operations.js';\nimport { resolveCardholderDocument } from './cardholder-document-rule.js';\nimport { usePayment } from './payment.js';\nimport type { PaymentSectionMethod } from './use-payment-method-selection.js';\n\n/**\n * The submit gate (specs/cardholder-document-submit-gate.md, T24 of the Credit Card epic;\n * docs/features/credit-card/rfc.md § D3, D6). One pure resolver covering the two facts T11's own\n * deferral asked to ship together: a required-but-missing-or-malformed cardholder document, and a\n * declined \"same as delivery\" billing address with nothing persisted yet. `PlaceOrder` (T14) reads the\n * verdict through `usePaymentSubmitGate()` below and forwards it into `usePlaceOrder`'s (T13)\n * pre-flight, which refuses on it before `startTransaction` ever opens a transaction the client already\n * knows it cannot complete.\n *\n * **Only the verdict crosses into `sdk/payment/`.** `usePlaceOrder` never learns *why* it refused —\n * only this opaque `PaymentUserError` — because `sdk/payment/use-place-order.ts` may name no identifier\n * matching `CARD_FIELD_PATTERN` (`sdk/payment/card-field-pattern.ts`), which includes `document`. Every\n * fact the gate reads, and the four codes below, live here in `matter/payment/` instead.\n */\n\n// ---------------------------------------------------------------------------\n// Client-synthesized codes. Distinct from T13's own three (`use-place-order.ts`) and from the\n// gateway's (`gateway.ts`) — these mean \"the client already knows this submission would be refused,\"\n// resolved before any request leaves the browser.\n// ---------------------------------------------------------------------------\n\nexport const PAYMENT_MISSING_DOCUMENT_CODE = 'MISSING_CARDHOLDER_DOCUMENT';\nexport const PAYMENT_INVALID_DOCUMENT_CODE = 'INVALID_CARDHOLDER_DOCUMENT';\nexport const PAYMENT_UNSAVED_BILLING_ADDRESS_CODE = 'UNSAVED_BILLING_ADDRESS';\n/**\n * T192 (issue 948): a document refusal while `CardholderDocument` renders nothing —\n * a method the card form cannot pay with, or a selection outside the section's `group` — so the\n * shopper is told to change the method, never to fill a field that is not on screen. The code and its\n * copy are provisional until Product answers T191's OQ-4; `PlaceOrder` authors the copy\n * (`unavailableMethodMessage`).\n */\nexport const PAYMENT_UNAVAILABLE_METHOD_CODE = 'UNAVAILABLE_PAYMENT_METHOD';\n\nconst MISSING_DOCUMENT_ERROR: PaymentUserError = {\n code: PAYMENT_MISSING_DOCUMENT_CODE,\n message: 'Enter your document before placing the order.',\n};\n\nconst INVALID_DOCUMENT_ERROR: PaymentUserError = {\n code: PAYMENT_INVALID_DOCUMENT_CODE,\n message: 'Enter a valid document before placing the order.',\n};\n\nconst UNSAVED_BILLING_ADDRESS_ERROR: PaymentUserError = {\n code: PAYMENT_UNSAVED_BILLING_ADDRESS_CODE,\n message: 'Save your billing address before placing the order.',\n};\n\nconst UNAVAILABLE_METHOD_ERROR: PaymentUserError = {\n code: PAYMENT_UNAVAILABLE_METHOD_CODE,\n message: 'Choose another payment method before placing the order.',\n};\n\n/**\n * Whether `CardholderDocument` renders for this selection (T192, Decision 3): the one definition, so\n * the field and the gate can never disagree about it. `selectedMethod` is the *scoped* one\n * `usePayment()` serves, so a selection outside `group` shows no field. Nothing shows while the card\n * payment is collapsed either (T191, FR-7), whatever the method's validator says. T42: the method must\n * ask for a document *and* the store's country must resolve to a document type\n * (`resolveCardholderDocument`).\n */\nexport function isCardholderDocumentShown({\n cardPaymentCollapsed,\n selectedMethod,\n countryDocumentType,\n}: Readonly<{\n cardPaymentCollapsed: boolean;\n selectedMethod: PaymentSectionMethod | null;\n countryDocumentType: DocumentType | null;\n}>): boolean {\n return !cardPaymentCollapsed && resolveCardholderDocument({ method: selectedMethod, countryDocumentType }) !== null;\n}\n\n// ---------------------------------------------------------------------------\n// Refusal targets (T212)\n// ---------------------------------------------------------------------------\n\n/**\n * The element a refusal names, opaque to every reader outside `matter/payment/`: `PlaceOrder` hands it to\n * `focusRefusal` without ever spelling what it stands for, because `place-order.tsx` is scanned for\n * `CARD_FIELD_PATTERN` substrings (docs/features/credit-card-r2/rfc.md § D21). The literals are not part\n * of the contract.\n */\nexport type PaymentRefusalTarget = 'cardholder-field' | 'billing-form';\n\n/**\n * Which element a refusal asks the shopper to fix, or `null` when none can be named. Pure and total over\n * any `error.code`: only the gate's own three codes name a target, so a code a backend leg returned\n * verbatim, and `UNAVAILABLE_PAYMENT_METHOD` (no field to fix), move nothing.\n */\nexport function refusalTargetOf({ code }: PaymentUserError): PaymentRefusalTarget | null {\n switch (code) {\n case PAYMENT_MISSING_DOCUMENT_CODE:\n case PAYMENT_INVALID_DOCUMENT_CODE:\n return 'cardholder-field';\n case PAYMENT_UNSAVED_BILLING_ADDRESS_CODE:\n return 'billing-form';\n default:\n return null;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The resolver\n// ---------------------------------------------------------------------------\n\nexport type PaymentSubmitGateInput = Readonly<{\n /**\n * The selected method's `validator.documentRequired`; `false` when no method is resolved yet.\n * `usePaymentSubmitGate()` resolves the method by `selectedMethodId` against `allMethods` — the\n * section's *unscoped* list — never the group-scoped `selectedMethod` (finding S1; see that hook's\n * own doc comment).\n */\n documentRequired: boolean;\n /**\n * The selected method's `validator.documentDisplayable`, resolved the same unscoped way; `false` when\n * no method is resolved yet. Gates *both* document checks below (fix pass, findings R1/S4/S5 — one\n * root cause, three symptoms): `draft.document` is a single fact with a single writer,\n * `CardholderDocument.onValueChange` (`cardholder-document.tsx:111`). When the selected method's\n * validator says the document is not displayable, `CardholderDocument` renders nothing for it\n * (`cardholder-document.tsx:93`) — but nothing clears `draft.document` when that happens: not\n * `CardholderDocument` unmounting, and not `selectMethod` (`use-payment-method-selection.ts`), which\n * writes only `path`/`bin` from its input. So `draft.document` can still hold whatever the shopper\n * typed for a *previously* selected, displayable method. Without this flag, a stale malformed value\n * would refuse forever with no field left to fix it (R1: a mid-typing, not-yet-valid value survives a\n * network-detection re-dispatch to a method that never shows the field; S5: any method whose validator\n * pairs `documentRequired: true` with `documentDisplayable: false` is unconditionally unsatisfiable),\n * and a stale *valid* value would silently vouch for a document the current method never collected\n * (S4). Both are the same mistake: treating `draft.document` as meaningful when there is no field on\n * screen for the shopper to read it from or correct it in. Neither check may run in that state —\n * matching US-1's fourth criterion (\"the gate contributes nothing regardless of what `draft.document`\n * holds\") generalized to every `documentRequired` value, not only `false`. This does not weaken the\n * spec's own settled \"no `CardholderDocument` composed\" deadlock (its Risk R1, US-4 — a different R1\n * than this fix pass's own): that case has `documentDisplayable: true` on the validator (the method\n * genuinely calls for a document) with the leaf simply missing from the schema, so FR-1 still fires and\n * still refuses with a console diagnostic.\n */\n documentDisplayable: boolean;\n /**\n * Whether `CardholderDocument` renders for this selection: `isCardholderDocumentShown(...)` over the\n * *scoped* `selectedMethod` and `cardPaymentCollapsed` (T192, Decision 3). Never a trigger: the two\n * unscoped flags above still decide whether the document refuses (S1). It decides only what the\n * refusal says — the document codes when the field is on screen, `UNAVAILABLE_PAYMENT_METHOD` when it\n * is not, since a shopper cannot fill a field that is not there (issue 948).\n */\n documentFieldShown: boolean;\n /**\n * The document type the field shows and the gate validates with (T42): the store country's type, `null`\n * when the country resolves to none — then no document check runs and the gate never refuses on one,\n * since no field exists for the shopper to fix.\n */\n documentType: DocumentType | null;\n /** `draft.document` — the masked value `CardholderDocument` publishes on change. */\n document: string | null;\n /** `draft.billingAddressUnsaved`. */\n billingAddressUnsaved: boolean | null;\n}>;\n\n/**\n * The document half of the gate: document-missing, then document-invalid, or `null`.\n *\n * FR-1/FR-3: emptiness is its own explicit check, never expressed through `isValidDocument` alone —\n * `isValidDocument('')` returns `true` by design (the document is optional in the general case), which\n * would otherwise silently let a required-but-blank document through. FR-2/Decision 6: validity is\n * checked whenever a value is present, independent of `documentRequired` — a malformed *optional*\n * document blocks too, matching the legacy's own unconditional `pattern`/`validate` rule. Decision 6's\n * own premise is a *displayable* field (a shopper who can see and fix what they typed); `documentDisplayable`\n * therefore gates FR-1 and FR-2 alike (findings R1/S4/S5).\n */\nfunction resolveDocumentRefusal({\n documentRequired,\n documentDisplayable,\n documentType,\n document,\n}: Pick<\n PaymentSubmitGateInput,\n 'documentRequired' | 'documentDisplayable' | 'documentType' | 'document'\n>): PaymentUserError | null {\n if (!documentDisplayable || documentType === null) return null;\n if (documentRequired && (document?.trim() ?? '') === '') return MISSING_DOCUMENT_ERROR;\n if (!isValidDocument(document ?? '', documentType)) return INVALID_DOCUMENT_ERROR;\n return null;\n}\n\n/**\n * The whole gate: at most one refusal, resolved in a fixed order (FR-7) — the document slot\n * (document-missing, then document-invalid), then billing-unsaved. Pure — no hooks, no context, no DOM —\n * so the truth table is unit-testable without rendering, mirroring `card-entry.tsx`'s own exported\n * `isValidLuhn` / `isExpirationInFuture` convention.\n *\n * T192 (Decision 2): the document slot refuses in exactly the states it always did, and `documentFieldShown`\n * changes only its code — `UNAVAILABLE_PAYMENT_METHOD` instead of a document code while `CardholderDocument`\n * renders nothing (INV-1, INV-2). The billing check is unchanged.\n */\nexport function resolvePaymentSubmitGate({\n documentRequired,\n documentDisplayable,\n documentFieldShown,\n documentType,\n document,\n billingAddressUnsaved,\n}: PaymentSubmitGateInput): PaymentUserError | null {\n const documentRefusal = resolveDocumentRefusal({ documentRequired, documentDisplayable, documentType, document });\n if (documentRefusal) {\n return documentFieldShown ? documentRefusal : UNAVAILABLE_METHOD_ERROR;\n }\n\n if (billingAddressUnsaved) {\n return UNSAVED_BILLING_ADDRESS_ERROR;\n }\n\n return null;\n}\n\n/**\n * Reads `usePayment()` and resolves the gate, memoized on the primitives — never on the `draft` object\n * itself (NFR-3): `draft`'s identity changes on every card-number keystroke (`setDraftBin`), and this\n * must not re-run the document check on each one.\n *\n * Resolves the validator by looking `persistedMethodId` up against `allMethods` — the section's\n * *unscoped* fact and *unscoped* method list — rather than the group-scoped `selectedMethod` /\n * `selectedMethodId` `usePayment()` also exposes (T74, Decision 4/7: the ones `CardholderDocument`/\n * `CardEntry` render from). Fix pass, finding S1, carried forward by T74's contract split:\n * `usePlaceOrder`'s own pre-flight (`sdk/payment/use-place-order.ts`) resolves *its* `selectedMethod`\n * the same unscoped way, off its own independent fragment slice (Decision 2 forbids either hook from\n * reading the other's module). Resolving off the scoped `selectedMethodId` here would silently degrade\n * `documentRequired` to `false` whenever the persisted selection's `groupName` sits outside this root's\n * configured `group` set — no attacker needed, just a store whose real credit- or debit-card group name\n * differs from the hardcoded defaults (`payment.tsx`'s `DEFAULT_METHOD_GROUP`, now two groups rather than\n * one) — while `usePlaceOrder` still finds the method by id alone and opens a transaction. Matching\n * `usePlaceOrder`'s own by-id lookup keeps the two\n * in agreement for every method actually reachable through this root, which is the one thing\n * `usePaymentSubmitGate` and `usePlaceOrder` can never be allowed to disagree about.\n *\n * T192 (issue 948): the scoped `selectedMethod` and `cardPaymentCollapsed` are read for one fact only,\n * `documentFieldShown`, through the same `isCardholderDocumentShown` `CardholderDocument` renders by.\n * It never decides whether the gate refuses — only whether a refusal may name the document.\n */\nexport function usePaymentSubmitGate(): PaymentUserError | null {\n const { persistedMethodId, allMethods, selectedMethod, cardPaymentCollapsed, countryDocumentType, draft } =\n usePayment();\n const resolvedMethod = useMemo(\n () => allMethods.find((method) => method.id === persistedMethodId) ?? null,\n [allMethods, persistedMethodId],\n );\n // T42: the same rule the field renders by, over the same unscoped method this gate always read. A\n // country with no document type yields `null`: no check runs and nothing refuses (Decision 7).\n const documentRule = resolveCardholderDocument({ method: resolvedMethod, countryDocumentType });\n const documentRequired = documentRule?.required ?? false;\n const documentDisplayable = documentRule !== null;\n const documentType = documentRule?.type ?? null;\n const documentFieldShown = isCardholderDocumentShown({ cardPaymentCollapsed, selectedMethod, countryDocumentType });\n const { document, billingAddressUnsaved } = draft;\n\n return useMemo(\n () =>\n resolvePaymentSubmitGate({\n documentRequired,\n documentDisplayable,\n documentFieldShown,\n documentType,\n document,\n billingAddressUnsaved,\n }),\n [documentRequired, documentDisplayable, documentFieldShown, documentType, document, billingAddressUnsaved],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gCAAgC;AAC7C,MAAa,gCAAgC;AAC7C,MAAa,uCAAuC;;;;;;;;AAQpD,MAAa,kCAAkC;AAE/C,MAAM,yBAA2C;CAC/C,MAAM;CACN,SAAS;AACX;AAEA,MAAM,yBAA2C;CAC/C,MAAM;CACN,SAAS;AACX;AAEA,MAAM,gCAAkD;CACtD,MAAM;CACN,SAAS;AACX;AAEA,MAAM,2BAA6C;CACjD,MAAM;CACN,SAAS;AACX;;;;;;;;;AAUA,SAAgB,0BAA0B,EACxC,sBACA,gBACA,uBAKW;CACX,OAAO,CAAC,wBAAwB,0BAA0B;EAAE,QAAQ;EAAgB;CAAoB,CAAC,MAAM;AACjH;;;;;;AAmBA,SAAgB,gBAAgB,EAAE,QAAuD;CACvF,QAAQ,MAAR;EACE,KAAK;EACL,KAAK,+BACH,OAAO;EACT,KAAK,sCACH,OAAO;EACT,SACE,OAAO;CACX;AACF;;;;;;;;;;;;AAqEA,SAAS,uBAAuB,EAC9B,kBACA,qBACA,cACA,YAI0B;CAC1B,IAAI,CAAC,uBAAuB,iBAAiB,MAAM,OAAO;CAC1D,IAAI,qBAAqB,UAAU,KAAK,KAAK,QAAQ,IAAI,OAAO;CAChE,IAAI,CAAC,gBAAgB,YAAY,IAAI,YAAY,GAAG,OAAO;CAC3D,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,yBAAyB,EACvC,kBACA,qBACA,oBACA,cACA,UACA,yBACkD;CAClD,MAAM,kBAAkB,uBAAuB;EAAE;EAAkB;EAAqB;EAAc;CAAS,CAAC;CAChH,IAAI,iBACF,OAAO,qBAAqB,kBAAkB;CAGhD,IAAI,uBACF,OAAO;CAGT,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,uBAAgD;CAC9D,MAAM,EAAE,mBAAmB,YAAY,gBAAgB,sBAAsB,qBAAqB,UAChG,WAAW;CACb,MAAM,iBAAiB,cACf,WAAW,MAAM,WAAW,OAAO,OAAO,iBAAiB,KAAK,MACtE,CAAC,YAAY,iBAAiB,CAChC;CAGA,MAAM,eAAe,0BAA0B;EAAE,QAAQ;EAAgB;CAAoB,CAAC;CAC9F,MAAM,mBAAmB,cAAc,YAAY;CACnD,MAAM,sBAAsB,iBAAiB;CAC7C,MAAM,eAAe,cAAc,QAAQ;CAC3C,MAAM,qBAAqB,0BAA0B;EAAE;EAAsB;EAAgB;CAAoB,CAAC;CAClH,MAAM,EAAE,UAAU,0BAA0B;CAE5C,OAAO,cAEH,yBAAyB;EACvB;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,GACH;EAAC;EAAkB;EAAqB;EAAoB;EAAc;EAAU;CAAqB,CAC3G;AACF"}
|
|
1
|
+
{"version":3,"file":"use-payment-submit-gate.js","names":[],"sources":["../../../src/matter/payment/use-payment-submit-gate.ts"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\nimport { type DocumentType, isValidDocument } from '../../particles/document-field/document-field.js';\nimport type { PaymentUserError } from '../../sdk/payment/operations.js';\nimport { resolveCardholderDocument } from './cardholder-document-rule.js';\nimport { type PaymentClientProfile, usePayment } from './payment.js';\nimport type { PaymentSectionMethod } from './use-payment-method-selection.js';\n\n/**\n * The submit gate (specs/cardholder-document-submit-gate.md, T24 of the Credit Card epic;\n * docs/features/credit-card/rfc.md § D3, D6). One pure resolver covering the two facts T11's own\n * deferral asked to ship together: a required-but-missing-or-malformed cardholder document, and a\n * declined \"same as delivery\" billing address with nothing persisted yet. `PlaceOrder` (T14) reads the\n * verdict through `usePaymentSubmitGate()` below and forwards it into `usePlaceOrder`'s (T13)\n * pre-flight, which refuses on it before `startTransaction` ever opens a transaction the client already\n * knows it cannot complete.\n *\n * **Only the verdict crosses into `sdk/payment/`.** `usePlaceOrder` never learns *why* it refused —\n * only this opaque `PaymentUserError` — because `sdk/payment/use-place-order.ts` may name no identifier\n * matching `CARD_FIELD_PATTERN` (`sdk/payment/card-field-pattern.ts`), which includes `document`. Every\n * fact the gate reads, and the four codes below, live here in `matter/payment/` instead.\n */\n\n// ---------------------------------------------------------------------------\n// Client-synthesized codes. Distinct from T13's own three (`use-place-order.ts`) and from the\n// gateway's (`gateway.ts`) — these mean \"the client already knows this submission would be refused,\"\n// resolved before any request leaves the browser.\n// ---------------------------------------------------------------------------\n\nexport const PAYMENT_MISSING_DOCUMENT_CODE = 'MISSING_CARDHOLDER_DOCUMENT';\nexport const PAYMENT_INVALID_DOCUMENT_CODE = 'INVALID_CARDHOLDER_DOCUMENT';\nexport const PAYMENT_UNSAVED_BILLING_ADDRESS_CODE = 'UNSAVED_BILLING_ADDRESS';\n/** The cart's profile lacks a first or last name: VTEX refuses the order with `ORD007`. */\nexport const PAYMENT_MISSING_PROFILE_NAME_CODE = 'MISSING_PROFILE_NAME';\n/** The cart's profile lacks a phone: VTEX refuses the order with `ORD007`, in every country measured. */\nexport const PAYMENT_MISSING_PROFILE_PHONE_CODE = 'MISSING_PROFILE_PHONE';\n/**\n * T192 (issue 948): a document refusal while `CardholderDocument` renders nothing —\n * a method the card form cannot pay with, or a selection outside the section's `group` — so the\n * shopper is told to change the method, never to fill a field that is not on screen. The code and its\n * copy are provisional until Product answers T191's OQ-4; `PlaceOrder` authors the copy\n * (`unavailableMethodMessage`).\n */\nexport const PAYMENT_UNAVAILABLE_METHOD_CODE = 'UNAVAILABLE_PAYMENT_METHOD';\n\n// The `message` of each error below is diagnostic (logs, `onResult`); `PlaceOrder` words the code.\nconst MISSING_DOCUMENT_ERROR: PaymentUserError = {\n code: PAYMENT_MISSING_DOCUMENT_CODE,\n message: 'Enter your document before placing the order.',\n};\n\nconst INVALID_DOCUMENT_ERROR: PaymentUserError = {\n code: PAYMENT_INVALID_DOCUMENT_CODE,\n message: 'Enter a valid document before placing the order.',\n};\n\nconst UNSAVED_BILLING_ADDRESS_ERROR: PaymentUserError = {\n code: PAYMENT_UNSAVED_BILLING_ADDRESS_CODE,\n message: 'Save your billing address before placing the order.',\n};\n\nconst MISSING_PROFILE_NAME_ERROR: PaymentUserError = {\n code: PAYMENT_MISSING_PROFILE_NAME_CODE,\n message: 'Enter your first and last name before placing the order.',\n};\n\nconst MISSING_PROFILE_PHONE_ERROR: PaymentUserError = {\n code: PAYMENT_MISSING_PROFILE_PHONE_CODE,\n message: 'Enter your phone number before placing the order.',\n};\n\nconst UNAVAILABLE_METHOD_ERROR: PaymentUserError = {\n code: PAYMENT_UNAVAILABLE_METHOD_CODE,\n message: 'Choose another payment method before placing the order.',\n};\n\n/**\n * Whether `CardholderDocument` renders for this selection (T192, Decision 3): the one definition, so\n * the field and the gate can never disagree about it. `selectedMethod` is the *scoped* one\n * `usePayment()` serves, so a selection outside `group` shows no field. Nothing shows while the card\n * payment is collapsed either (T191, FR-7), whatever the method's validator says. T42: the method must\n * ask for a document *and* the store's country must resolve to a document type\n * (`resolveCardholderDocument`).\n */\nexport function isCardholderDocumentShown({\n cardPaymentCollapsed,\n selectedMethod,\n countryDocumentType,\n}: Readonly<{\n cardPaymentCollapsed: boolean;\n selectedMethod: PaymentSectionMethod | null;\n countryDocumentType: DocumentType | null;\n}>): boolean {\n return !cardPaymentCollapsed && resolveCardholderDocument({ method: selectedMethod, countryDocumentType }) !== null;\n}\n\n// ---------------------------------------------------------------------------\n// Refusal targets (T212)\n// ---------------------------------------------------------------------------\n\n/**\n * The element a refusal names, opaque to every reader outside `matter/payment/`: `PlaceOrder` hands it to\n * `focusRefusal` without ever spelling what it stands for, because `place-order.tsx` is scanned for\n * `CARD_FIELD_PATTERN` substrings (docs/features/credit-card-r2/rfc.md § D21). The literals are not part\n * of the contract.\n */\nexport type PaymentRefusalTarget = 'cardholder-field' | 'billing-form';\n\n/**\n * Which element a refusal asks the shopper to fix, or `null` when none can be named. Pure and total over\n * any `error.code`: only the gate's own three codes name a target, so a code a backend leg returned\n * verbatim, and `UNAVAILABLE_PAYMENT_METHOD` (no field to fix), move nothing.\n */\nexport function refusalTargetOf({ code }: PaymentUserError): PaymentRefusalTarget | null {\n switch (code) {\n case PAYMENT_MISSING_DOCUMENT_CODE:\n case PAYMENT_INVALID_DOCUMENT_CODE:\n return 'cardholder-field';\n case PAYMENT_UNSAVED_BILLING_ADDRESS_CODE:\n return 'billing-form';\n default:\n return null;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The resolver\n// ---------------------------------------------------------------------------\n\nexport type PaymentSubmitGateInput = Readonly<{\n /**\n * The selected method's `validator.documentRequired`; `false` when no method is resolved yet.\n * `usePaymentSubmitGate()` resolves the method by `selectedMethodId` against `allMethods` — the\n * section's *unscoped* list — never the group-scoped `selectedMethod` (finding S1; see that hook's\n * own doc comment).\n */\n documentRequired: boolean;\n /**\n * The selected method's `validator.documentDisplayable`, resolved the same unscoped way; `false` when\n * no method is resolved yet. Gates *both* document checks below (fix pass, findings R1/S4/S5 — one\n * root cause, three symptoms): `draft.document` is a single fact with a single writer,\n * `CardholderDocument.onValueChange` (`cardholder-document.tsx:111`). When the selected method's\n * validator says the document is not displayable, `CardholderDocument` renders nothing for it\n * (`cardholder-document.tsx:93`) — but nothing clears `draft.document` when that happens: not\n * `CardholderDocument` unmounting, and not `selectMethod` (`use-payment-method-selection.ts`), which\n * writes only `path`/`bin` from its input. So `draft.document` can still hold whatever the shopper\n * typed for a *previously* selected, displayable method. Without this flag, a stale malformed value\n * would refuse forever with no field left to fix it (R1: a mid-typing, not-yet-valid value survives a\n * network-detection re-dispatch to a method that never shows the field; S5: any method whose validator\n * pairs `documentRequired: true` with `documentDisplayable: false` is unconditionally unsatisfiable),\n * and a stale *valid* value would silently vouch for a document the current method never collected\n * (S4). Both are the same mistake: treating `draft.document` as meaningful when there is no field on\n * screen for the shopper to read it from or correct it in. Neither check may run in that state —\n * matching US-1's fourth criterion (\"the gate contributes nothing regardless of what `draft.document`\n * holds\") generalized to every `documentRequired` value, not only `false`. This does not weaken the\n * spec's own settled \"no `CardholderDocument` composed\" deadlock (its Risk R1, US-4 — a different R1\n * than this fix pass's own): that case has `documentDisplayable: true` on the validator (the method\n * genuinely calls for a document) with the leaf simply missing from the schema, so FR-1 still fires and\n * still refuses with a console diagnostic.\n */\n documentDisplayable: boolean;\n /**\n * Whether `CardholderDocument` renders for this selection: `isCardholderDocumentShown(...)` over the\n * *scoped* `selectedMethod` and `cardPaymentCollapsed` (T192, Decision 3). Never a trigger: the two\n * unscoped flags above still decide whether the document refuses (S1). It decides only what the\n * refusal says — the document codes when the field is on screen, `UNAVAILABLE_PAYMENT_METHOD` when it\n * is not, since a shopper cannot fill a field that is not there (issue 948).\n */\n documentFieldShown: boolean;\n /**\n * The document type the field shows and the gate validates with (T42): the store country's type, `null`\n * when the country resolves to none — then no document check runs and the gate never refuses on one,\n * since no field exists for the shopper to fix.\n */\n documentType: DocumentType | null;\n /** `draft.document` — the masked value `CardholderDocument` publishes on change. */\n document: string | null;\n /** `draft.billingAddressUnsaved`. */\n billingAddressUnsaved: boolean | null;\n /**\n * The cart's profile. Absent (`undefined` or `null`) means it was not read, and the profile slot\n * never refuses. A present object counts as read, even with every field `null`: the content of a\n * profile cannot tell \"not yet read\" from \"read and empty\".\n */\n profile?: PaymentClientProfile | null;\n}>;\n\nfunction isBlank(value: string | null | undefined): boolean {\n return (value?.trim() ?? '') === '';\n}\n\n/**\n * The profile half of the gate: a missing name, then a missing phone, or `null`. VTEX refuses the\n * order at `startTransaction` with `ORD007` for each of the three, in every country measured, so no\n * country is consulted.\n */\nfunction resolveProfileRefusal({ profile }: Pick<PaymentSubmitGateInput, 'profile'>): PaymentUserError | null {\n if (!profile) return null;\n if (isBlank(profile.firstName) || isBlank(profile.lastName)) return MISSING_PROFILE_NAME_ERROR;\n if (isBlank(profile.phone)) return MISSING_PROFILE_PHONE_ERROR;\n return null;\n}\n\n/**\n * The document half of the gate: document-missing, then document-invalid, or `null`.\n *\n * FR-1/FR-3: emptiness is its own explicit check, never expressed through `isValidDocument` alone —\n * `isValidDocument('')` returns `true` by design (the document is optional in the general case), which\n * would otherwise silently let a required-but-blank document through. FR-2/Decision 6: validity is\n * checked whenever a value is present, independent of `documentRequired` — a malformed *optional*\n * document blocks too, matching the legacy's own unconditional `pattern`/`validate` rule. Decision 6's\n * own premise is a *displayable* field (a shopper who can see and fix what they typed); `documentDisplayable`\n * therefore gates FR-1 and FR-2 alike (findings R1/S4/S5).\n */\nfunction resolveDocumentRefusal({\n documentRequired,\n documentDisplayable,\n documentType,\n document,\n}: Pick<\n PaymentSubmitGateInput,\n 'documentRequired' | 'documentDisplayable' | 'documentType' | 'document'\n>): PaymentUserError | null {\n if (!documentDisplayable || documentType === null) return null;\n if (documentRequired && (document?.trim() ?? '') === '') return MISSING_DOCUMENT_ERROR;\n if (!isValidDocument(document ?? '', documentType)) return INVALID_DOCUMENT_ERROR;\n return null;\n}\n\n/**\n * The whole gate: at most one refusal, resolved in a fixed order (FR-7) — the document slot\n * (document-missing, then document-invalid), then billing-unsaved, then the profile. Pure — no hooks, no\n * context, no DOM — so the truth table is unit-testable without rendering, mirroring `card-entry.tsx`'s own exported\n * `isValidLuhn` / `isExpirationInFuture` convention.\n *\n * T192 (Decision 2): the document slot refuses in exactly the states it always did, and `documentFieldShown`\n * changes only its code — `UNAVAILABLE_PAYMENT_METHOD` instead of a document code while `CardholderDocument`\n * renders nothing (INV-1, INV-2). The billing check is unchanged.\n */\nexport function resolvePaymentSubmitGate({\n documentRequired,\n documentDisplayable,\n documentFieldShown,\n documentType,\n document,\n billingAddressUnsaved,\n profile,\n}: PaymentSubmitGateInput): PaymentUserError | null {\n const documentRefusal = resolveDocumentRefusal({ documentRequired, documentDisplayable, documentType, document });\n if (documentRefusal) {\n return documentFieldShown ? documentRefusal : UNAVAILABLE_METHOD_ERROR;\n }\n\n if (billingAddressUnsaved) {\n return UNSAVED_BILLING_ADDRESS_ERROR;\n }\n\n return resolveProfileRefusal({ profile });\n}\n\n/**\n * Reads `usePayment()` and resolves the gate, memoized on the primitives — never on the `draft` object\n * itself (NFR-3): `draft`'s identity changes on every card-number keystroke (`setDraftBin`), and this\n * must not re-run the document check on each one.\n *\n * Resolves the validator by looking `persistedMethodId` up against `allMethods` — the section's\n * *unscoped* fact and *unscoped* method list — rather than the group-scoped `selectedMethod` /\n * `selectedMethodId` `usePayment()` also exposes (T74, Decision 4/7: the ones `CardholderDocument`/\n * `CardEntry` render from). Fix pass, finding S1, carried forward by T74's contract split:\n * `usePlaceOrder`'s own pre-flight (`sdk/payment/use-place-order.ts`) resolves *its* `selectedMethod`\n * the same unscoped way, off its own independent fragment slice (Decision 2 forbids either hook from\n * reading the other's module). Resolving off the scoped `selectedMethodId` here would silently degrade\n * `documentRequired` to `false` whenever the persisted selection's `groupName` sits outside this root's\n * configured `group` set — no attacker needed, just a store whose real credit- or debit-card group name\n * differs from the hardcoded defaults (`payment.tsx`'s `DEFAULT_METHOD_GROUP`, now two groups rather than\n * one) — while `usePlaceOrder` still finds the method by id alone and opens a transaction. Matching\n * `usePlaceOrder`'s own by-id lookup keeps the two\n * in agreement for every method actually reachable through this root, which is the one thing\n * `usePaymentSubmitGate` and `usePlaceOrder` can never be allowed to disagree about.\n *\n * T192 (issue 948): the scoped `selectedMethod` and `cardPaymentCollapsed` are read for one fact only,\n * `documentFieldShown`, through the same `isCardholderDocumentShown` `CardholderDocument` renders by.\n * It never decides whether the gate refuses — only whether a refusal may name the document.\n */\nexport function usePaymentSubmitGate(): PaymentUserError | null {\n const {\n persistedMethodId,\n allMethods,\n selectedMethod,\n cardPaymentCollapsed,\n countryDocumentType,\n draft,\n clientProfile,\n } = usePayment();\n const resolvedMethod = useMemo(\n () => allMethods.find((method) => method.id === persistedMethodId) ?? null,\n [allMethods, persistedMethodId],\n );\n // T42: the same rule the field renders by, over the same unscoped method this gate always read. A\n // country with no document type yields `null`: no check runs and nothing refuses (Decision 7).\n const documentRule = resolveCardholderDocument({ method: resolvedMethod, countryDocumentType });\n const documentRequired = documentRule?.required ?? false;\n const documentDisplayable = documentRule !== null;\n const documentType = documentRule?.type ?? null;\n const documentFieldShown = isCardholderDocumentShown({ cardPaymentCollapsed, selectedMethod, countryDocumentType });\n const { document, billingAddressUnsaved } = draft;\n // Primitives only, like the document facts. `profileRead` is part of the key because a present profile\n // with every field `null` refuses and an absent one does not: the three fields alone cannot tell them apart.\n const profileRead = clientProfile != null;\n const firstName = clientProfile?.firstName ?? null;\n const lastName = clientProfile?.lastName ?? null;\n const phone = clientProfile?.phone ?? null;\n\n return useMemo(\n () =>\n resolvePaymentSubmitGate({\n documentRequired,\n documentDisplayable,\n documentFieldShown,\n documentType,\n document,\n billingAddressUnsaved,\n profile: profileRead ? { firstName, lastName, phone } : null,\n }),\n [\n documentRequired,\n documentDisplayable,\n documentFieldShown,\n documentType,\n document,\n billingAddressUnsaved,\n profileRead,\n firstName,\n lastName,\n phone,\n ],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,gCAAgC;AAC7C,MAAa,gCAAgC;AAC7C,MAAa,uCAAuC;;AAEpD,MAAa,oCAAoC;;AAEjD,MAAa,qCAAqC;;;;;;;;AAQlD,MAAa,kCAAkC;AAG/C,MAAM,yBAA2C;CAC/C,MAAM;CACN,SAAS;AACX;AAEA,MAAM,yBAA2C;CAC/C,MAAM;CACN,SAAS;AACX;AAEA,MAAM,gCAAkD;CACtD,MAAM;CACN,SAAS;AACX;AAEA,MAAM,6BAA+C;CACnD,MAAM;CACN,SAAS;AACX;AAEA,MAAM,8BAAgD;CACpD,MAAM;CACN,SAAS;AACX;AAEA,MAAM,2BAA6C;CACjD,MAAM;CACN,SAAS;AACX;;;;;;;;;AAUA,SAAgB,0BAA0B,EACxC,sBACA,gBACA,uBAKW;CACX,OAAO,CAAC,wBAAwB,0BAA0B;EAAE,QAAQ;EAAgB;CAAoB,CAAC,MAAM;AACjH;;;;;;AAmBA,SAAgB,gBAAgB,EAAE,QAAuD;CACvF,QAAQ,MAAR;EACE,KAAK;EACL,KAAK,+BACH,OAAO;EACT,KAAK,sCACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAgEA,SAAS,QAAQ,OAA2C;CAC1D,QAAQ,OAAO,KAAK,KAAK,QAAQ;AACnC;;;;;;AAOA,SAAS,sBAAsB,EAAE,WAA6E;CAC5G,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI,QAAQ,QAAQ,SAAS,KAAK,QAAQ,QAAQ,QAAQ,GAAG,OAAO;CACpE,IAAI,QAAQ,QAAQ,KAAK,GAAG,OAAO;CACnC,OAAO;AACT;;;;;;;;;;;;AAaA,SAAS,uBAAuB,EAC9B,kBACA,qBACA,cACA,YAI0B;CAC1B,IAAI,CAAC,uBAAuB,iBAAiB,MAAM,OAAO;CAC1D,IAAI,qBAAqB,UAAU,KAAK,KAAK,QAAQ,IAAI,OAAO;CAChE,IAAI,CAAC,gBAAgB,YAAY,IAAI,YAAY,GAAG,OAAO;CAC3D,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,yBAAyB,EACvC,kBACA,qBACA,oBACA,cACA,UACA,uBACA,WACkD;CAClD,MAAM,kBAAkB,uBAAuB;EAAE;EAAkB;EAAqB;EAAc;CAAS,CAAC;CAChH,IAAI,iBACF,OAAO,qBAAqB,kBAAkB;CAGhD,IAAI,uBACF,OAAO;CAGT,OAAO,sBAAsB,EAAE,QAAQ,CAAC;AAC1C;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,uBAAgD;CAC9D,MAAM,EACJ,mBACA,YACA,gBACA,sBACA,qBACA,OACA,kBACE,WAAW;CACf,MAAM,iBAAiB,cACf,WAAW,MAAM,WAAW,OAAO,OAAO,iBAAiB,KAAK,MACtE,CAAC,YAAY,iBAAiB,CAChC;CAGA,MAAM,eAAe,0BAA0B;EAAE,QAAQ;EAAgB;CAAoB,CAAC;CAC9F,MAAM,mBAAmB,cAAc,YAAY;CACnD,MAAM,sBAAsB,iBAAiB;CAC7C,MAAM,eAAe,cAAc,QAAQ;CAC3C,MAAM,qBAAqB,0BAA0B;EAAE;EAAsB;EAAgB;CAAoB,CAAC;CAClH,MAAM,EAAE,UAAU,0BAA0B;CAG5C,MAAM,cAAc,iBAAiB;CACrC,MAAM,YAAY,eAAe,aAAa;CAC9C,MAAM,WAAW,eAAe,YAAY;CAC5C,MAAM,QAAQ,eAAe,SAAS;CAEtC,OAAO,cAEH,yBAAyB;EACvB;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,cAAc;GAAE;GAAW;GAAU;EAAM,IAAI;CAC1D,CAAC,GACH;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
1
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
3
|
import "../../core/dist/index.js";
|
|
3
4
|
import { PageRef } from "../../sdk/navigation/types.js";
|
|
@@ -6,74 +7,187 @@ import { ComponentActions } from "../../sdk/actions/types.js";
|
|
|
6
7
|
import { PlaceOrderData } from "../../sdk/payment/use-place-order.js";
|
|
7
8
|
import { ComponentPropsWithRef } from "react";
|
|
8
9
|
//#region src/matter/place-order/place-order.d.ts
|
|
9
|
-
export type PlaceOrderProps = ComponentPropsWithRef<'div'> & {
|
|
10
|
-
/** CTA label while idle. */
|
|
11
|
-
label?: string;
|
|
12
|
-
/** CTA label while the three-call sequence is in flight. */
|
|
13
|
-
placingLabel?: string;
|
|
14
|
-
/** Status message shown beside the button for as long as the order is being placed. Absent or blank renders nothing. */
|
|
15
|
-
placingMessage?: string;
|
|
16
|
-
/**
|
|
17
|
-
* CTA label while a surviving attempt (T29) offers a resume — the card already left the browser
|
|
18
|
-
* (`sent`) or its fate is unknown (`unresolved`), and the next click finalizes it rather than running
|
|
19
|
-
* the full sequence again. Shown instead of `label`, never alongside `placingLabel` (mutually
|
|
20
|
-
* exclusive — `placing` takes priority whenever both could apply).
|
|
21
|
-
*/
|
|
22
|
-
resumeLabel?: string;
|
|
23
|
-
/** Inline message shown once the sequence has settled with no `userErrors`. */
|
|
24
|
-
successMessage?: string;
|
|
25
|
-
/** Shown when `placeOrder()` is invoked with no registered submission for the current path. */
|
|
26
|
-
missingSubmissionMessage?: string;
|
|
27
|
-
/** Shown when no payment method is selected yet. */
|
|
28
|
-
missingMethodMessage?: string;
|
|
29
|
-
/** Shown when `startTransaction` resolves incomplete transaction data. */
|
|
30
|
-
invalidTransactionMessage?: string;
|
|
31
|
-
/** Shown for an infrastructure-level failure reaching the payment gateway action. */
|
|
32
|
-
networkErrorMessage?: string;
|
|
33
|
-
/** Shown when the selected method requires a cardholder document and none is set. */
|
|
34
|
-
missingDocumentMessage?: string;
|
|
35
|
-
/** Shown when the typed cardholder document fails validation. */
|
|
36
|
-
invalidDocumentMessage?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Shown instead of the two document messages above when the selected method calls for a cardholder
|
|
39
|
-
* document the page is not showing — a method the card form cannot pay with, or one outside the
|
|
40
|
-
* section's `group` — so the shopper has to choose another payment method (T192).
|
|
41
|
-
*/
|
|
42
|
-
unavailableMethodMessage?: string;
|
|
43
|
-
/** Shown when the shopper declined "same as delivery" but never saved a billing address. */
|
|
44
|
-
unsavedBillingAddressMessage?: string;
|
|
45
|
-
/** Shown when the new-card draft itself fails validation before ever reaching the gateway. */
|
|
46
|
-
invalidCardDataMessage?: string;
|
|
47
|
-
/** Shown when the typed card number is well-formed but no payment network the store accepts claims it (T47). */
|
|
48
|
-
unsupportedNetworkMessage?: string;
|
|
49
|
-
/** Shown when a saved-card submission is refused for a missing or invalid CVV. */
|
|
50
|
-
invalidSecurityCodeMessage?: string;
|
|
51
|
-
/** Shown when the payment gateway itself refuses the submitted card. */
|
|
52
|
-
gatewayErrorMessage?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Shown when a click lands on an order-placement attempt whose own sequence is still running — a
|
|
55
|
-
* transaction this instance did not open, and which nothing here may finalize or re-run (T170).
|
|
56
|
-
*/
|
|
57
|
-
inFlightMessage?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Shown when the payment was handed to the gateway but the order could not be confirmed, so it may still be
|
|
60
|
-
* processing (T176). Rendered as a status, never as the error alert.
|
|
61
|
-
*/
|
|
62
|
-
unconfirmedMessage?: string;
|
|
10
|
+
export type PlaceOrderProps = ComponentPropsWithRef<'div'> & MessageLocaleProp & {
|
|
63
11
|
/**
|
|
64
12
|
* Where the shopper lands after a successful placement. A page reference gets the placed order's
|
|
65
|
-
*
|
|
66
|
-
* an absolute, protocol-relative, or non-http(s) value, or a `{
|
|
13
|
+
* Node id as its `orderId` param. A string is a logical path of this store, navigated as written;
|
|
14
|
+
* an absolute, protocol-relative, or non-http(s) value, or a `{orderId}` template, is refused
|
|
67
15
|
* rather than navigated to (fail closed, dev-only warn).
|
|
68
16
|
* e.g. `{ standard: 'order-placed' }`
|
|
69
17
|
*/
|
|
70
18
|
successHref?: PageRef | string;
|
|
19
|
+
/**
|
|
20
|
+
* The page the bank sends the shopper back to after a 3D Secure challenge, a page of this store that
|
|
21
|
+
* composes `ChallengeReturn`. A page reference only: a string, or a page the route map does not hold, is
|
|
22
|
+
* refused with a dev-only warning, since the return URL is built from the page's public path. No default:
|
|
23
|
+
* a store that authors none keeps the refusal a challenge answer gets today, with no redirect.
|
|
24
|
+
* e.g. `{ page: 'checkout-challenge-return' }`
|
|
25
|
+
*/
|
|
26
|
+
challengeReturnHref?: PageRef;
|
|
71
27
|
/** `Payment` slice forwarded by the reactive runtime (arity-1, ADR-0015) — `null` until it resolves. */
|
|
72
28
|
$data?: PlaceOrderData;
|
|
73
29
|
/** Compiler-injected action surface; carries `payment.startTransaction`, `payment.gatewayCallback`, `analytics.track`. */
|
|
74
30
|
$actions?: ComponentActions;
|
|
31
|
+
/** The button labels, the message while placing, the success message and the message for each refusal code this CTA words. */
|
|
32
|
+
$content?: ContentValue<typeof PlaceOrderContent>;
|
|
33
|
+
};
|
|
34
|
+
export declare const PlaceOrderContent: {
|
|
35
|
+
readonly id: "place-order";
|
|
36
|
+
readonly title: "Place Order";
|
|
37
|
+
readonly description: "The place-order button labels, the message while placing, the success message, and the message for each refusal it words.";
|
|
38
|
+
readonly schema: {
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly additionalProperties: false;
|
|
41
|
+
readonly properties: {
|
|
42
|
+
readonly label: {
|
|
43
|
+
readonly type: "string";
|
|
44
|
+
readonly title: "Button label";
|
|
45
|
+
readonly format: "icu-message";
|
|
46
|
+
readonly messageSource: "Place order";
|
|
47
|
+
};
|
|
48
|
+
readonly placingLabel: {
|
|
49
|
+
readonly type: "string";
|
|
50
|
+
readonly title: "Button label while placing";
|
|
51
|
+
readonly format: "icu-message";
|
|
52
|
+
readonly messageSource: "Placing order...";
|
|
53
|
+
};
|
|
54
|
+
readonly placingMessage: {
|
|
55
|
+
readonly type: "string";
|
|
56
|
+
readonly title: "Message while placing";
|
|
57
|
+
readonly format: "icu-message";
|
|
58
|
+
readonly messageSource: "Processing your payment. Please keep this page open.";
|
|
59
|
+
readonly messageOptional: true;
|
|
60
|
+
};
|
|
61
|
+
readonly resumeLabel: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
readonly title: "Button label while a surviving attempt offers a resume";
|
|
64
|
+
readonly format: "icu-message";
|
|
65
|
+
readonly messageSource: "Complete your order";
|
|
66
|
+
};
|
|
67
|
+
readonly successMessage: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly title: "Success message";
|
|
70
|
+
readonly format: "icu-message";
|
|
71
|
+
readonly messageSource: "Order placed successfully.";
|
|
72
|
+
};
|
|
73
|
+
readonly missingSubmissionMessage: {
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly title: "Missing payment submission message";
|
|
76
|
+
readonly format: "icu-message";
|
|
77
|
+
readonly messageSource: "Enter your payment details before placing the order.";
|
|
78
|
+
};
|
|
79
|
+
readonly missingMethodMessage: {
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
readonly title: "Missing payment method message";
|
|
82
|
+
readonly format: "icu-message";
|
|
83
|
+
readonly messageSource: "Choose a payment method before placing the order.";
|
|
84
|
+
};
|
|
85
|
+
readonly invalidTransactionMessage: {
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
readonly title: "Invalid transaction message";
|
|
88
|
+
readonly format: "icu-message";
|
|
89
|
+
readonly messageSource: "Unable to start the payment. Please try again.";
|
|
90
|
+
};
|
|
91
|
+
readonly networkErrorMessage: {
|
|
92
|
+
readonly type: "string";
|
|
93
|
+
readonly title: "Network error message";
|
|
94
|
+
readonly format: "icu-message";
|
|
95
|
+
readonly messageSource: "Unable to complete the request. Please try again.";
|
|
96
|
+
};
|
|
97
|
+
readonly missingDocumentMessage: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly title: "Missing document message";
|
|
100
|
+
readonly format: "icu-message";
|
|
101
|
+
readonly messageSource: "Enter your document before placing the order.";
|
|
102
|
+
};
|
|
103
|
+
readonly invalidDocumentMessage: {
|
|
104
|
+
readonly type: "string";
|
|
105
|
+
readonly title: "Invalid document message";
|
|
106
|
+
readonly format: "icu-message";
|
|
107
|
+
readonly messageSource: "Enter a valid document before placing the order.";
|
|
108
|
+
};
|
|
109
|
+
readonly unavailableMethodMessage: {
|
|
110
|
+
readonly type: "string";
|
|
111
|
+
readonly title: "Unavailable payment method message";
|
|
112
|
+
readonly format: "icu-message";
|
|
113
|
+
readonly messageSource: "Choose another payment method before placing the order.";
|
|
114
|
+
};
|
|
115
|
+
readonly unsavedBillingAddressMessage: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
readonly title: "Unsaved billing address message";
|
|
118
|
+
readonly format: "icu-message";
|
|
119
|
+
readonly messageSource: "Save your billing address before placing the order.";
|
|
120
|
+
};
|
|
121
|
+
readonly missingProfileNameMessage: {
|
|
122
|
+
readonly type: "string";
|
|
123
|
+
readonly title: "Missing name message";
|
|
124
|
+
readonly format: "icu-message";
|
|
125
|
+
readonly messageSource: "Enter your first and last name before placing the order.";
|
|
126
|
+
};
|
|
127
|
+
readonly missingProfilePhoneMessage: {
|
|
128
|
+
readonly type: "string";
|
|
129
|
+
readonly title: "Missing phone message";
|
|
130
|
+
readonly format: "icu-message";
|
|
131
|
+
readonly messageSource: "Enter your phone number before placing the order.";
|
|
132
|
+
};
|
|
133
|
+
readonly invalidCardDataMessage: {
|
|
134
|
+
readonly type: "string";
|
|
135
|
+
readonly title: "Invalid card data message";
|
|
136
|
+
readonly format: "icu-message";
|
|
137
|
+
readonly messageSource: "Enter valid card details before placing the order.";
|
|
138
|
+
};
|
|
139
|
+
readonly unsupportedNetworkMessage: {
|
|
140
|
+
readonly type: "string";
|
|
141
|
+
readonly title: "Unsupported card network message";
|
|
142
|
+
readonly format: "icu-message";
|
|
143
|
+
readonly messageSource: "This card is not from a network the store accepts. Use another card or choose another payment method.";
|
|
144
|
+
};
|
|
145
|
+
readonly invalidSecurityCodeMessage: {
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
readonly title: "Invalid security code message";
|
|
148
|
+
readonly format: "icu-message";
|
|
149
|
+
readonly messageSource: "Enter a valid security code before placing the order.";
|
|
150
|
+
};
|
|
151
|
+
readonly gatewayErrorMessage: {
|
|
152
|
+
readonly type: "string";
|
|
153
|
+
readonly title: "Gateway error message";
|
|
154
|
+
readonly format: "icu-message";
|
|
155
|
+
readonly messageSource: "Unable to complete the payment. Please try again.";
|
|
156
|
+
};
|
|
157
|
+
readonly inFlightMessage: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly title: "Order already in flight message";
|
|
160
|
+
readonly format: "icu-message";
|
|
161
|
+
readonly messageSource: "This order is already being placed. Please wait.";
|
|
162
|
+
};
|
|
163
|
+
readonly unconfirmedMessage: {
|
|
164
|
+
readonly type: "string";
|
|
165
|
+
readonly title: "Unconfirmed order message";
|
|
166
|
+
readonly format: "icu-message";
|
|
167
|
+
readonly messageSource: "We could not confirm your order yet. Your payment may still be processing, so please do not pay again.";
|
|
168
|
+
};
|
|
169
|
+
readonly declinedMessage: {
|
|
170
|
+
readonly type: "string";
|
|
171
|
+
readonly title: "Declined payment message";
|
|
172
|
+
readonly format: "icu-message";
|
|
173
|
+
readonly messageSource: "Check your payment information or choose another payment method.";
|
|
174
|
+
};
|
|
175
|
+
readonly lapsedTransactionMessage: {
|
|
176
|
+
readonly type: "string";
|
|
177
|
+
readonly title: "Lapsed payment window message";
|
|
178
|
+
readonly format: "icu-message";
|
|
179
|
+
readonly messageSource: "We could not confirm your order yet. Your payment may still be processing, so please do not pay again.";
|
|
180
|
+
};
|
|
181
|
+
readonly challengeUnavailableMessage: {
|
|
182
|
+
readonly type: "string";
|
|
183
|
+
readonly title: "Unavailable bank verification message";
|
|
184
|
+
readonly format: "icu-message";
|
|
185
|
+
readonly messageSource: "Your bank asked for an extra verification step that we could not open. Your payment may still be processing, so please do not pay again.";
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
};
|
|
75
189
|
};
|
|
76
190
|
export declare const PlaceOrderDefinition: ComponentDefinition<PlaceOrderProps>;
|
|
77
|
-
export declare function PlaceOrder({
|
|
191
|
+
export declare function PlaceOrder({ successHref, challengeReturnHref, $data: $dataProp, $actions: $actionsProp, $content, $locale, className, ...props }: PlaceOrderProps): import("react/jsx-runtime").JSX.Element;
|
|
78
192
|
//#endregion
|
|
79
193
|
//# sourceMappingURL=place-order.d.ts.map
|