@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,21 +1,81 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
3
4
|
import "../../core/dist/index.js";
|
|
4
5
|
import { resolveSiteRelativeHref } from "../../utils/safe-href.js";
|
|
6
|
+
import { resolveStorefrontHref } from "../../sdk/navigation/resolve-storefront-href.js";
|
|
7
|
+
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
8
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
9
|
+
import { useRouteMap } from "../../sdk/navigation/route-map-provider.js";
|
|
5
10
|
import { useStorefrontNavigation } from "../../sdk/navigation/use-storefront-navigation.js";
|
|
6
11
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
12
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
7
13
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
8
14
|
import { Button } from "../../particles/button/button.js";
|
|
9
15
|
import { usePayment } from "../payment/payment.js";
|
|
10
16
|
import { refusalTargetOf, usePaymentSubmitGate } from "../payment/use-payment-submit-gate.js";
|
|
17
|
+
import { buildChallengeReturnQuery } from "../../sdk/payment/challenge-return.js";
|
|
18
|
+
import { useSettledOrderRead } from "../../sdk/payment/resumed-purchase.js";
|
|
11
19
|
import { usePlaceOrder } from "../../sdk/payment/use-place-order.js";
|
|
12
|
-
import { useEffect, useId, useLayoutEffect, useState } from "react";
|
|
20
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
13
21
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
//#region src/matter/place-order/place-order.tsx
|
|
23
|
+
/**
|
|
24
|
+
* The `PlaceOrder` CTA matter (specs/place-order.md, T14 of the Credit Card epic;
|
|
25
|
+
* docs/features/credit-card/rfc.md § D9). Drives T13's `usePlaceOrder` orchestration hook and renders
|
|
26
|
+
* the three v1 states the RFC names: the idle CTA, a blocking loading state while the three-call
|
|
27
|
+
* sequence runs, and an inline outcome (error or success) once it settles.
|
|
28
|
+
*
|
|
29
|
+
* **Composes as a sibling of the card entry (T7) and the saved cards list (T12) under the payment
|
|
30
|
+
* root, never nested inside either.** That placement is what lets this one CTA serve both the
|
|
31
|
+
* new-card and saved-card paths — nesting it inside a card form, as the legacy `CardForm` does,
|
|
32
|
+
* would force a second CTA for the saved-card path. This is a documented authoring convention, not a
|
|
33
|
+
* compiler guarantee: `requiresContext: 'payment'` (ADR-0009) only fails the build when *no* ancestor
|
|
34
|
+
* at any depth declares `providesContext: 'payment'` — there is no `forbidsAncestor` token, so a
|
|
35
|
+
* schema that nests this component inside `CardEntry`/`SavedCards` instead of beside them still
|
|
36
|
+
* compiles and still resolves the context from the payment root further up. This component throws
|
|
37
|
+
* at runtime only when rendered entirely outside a `PaymentSectionRoot`/`Controller` subtree — both
|
|
38
|
+
* `usePayment()` (read directly below, for `draft.billingAddressDifferent`) and `usePlaceOrder` (via
|
|
39
|
+
* the submission channel those roots provide) enforce that guard, with `usePayment()` throwing first
|
|
40
|
+
* since its value feeds `usePlaceOrder`'s own argument — a real, load-bearing guard, but a weaker one
|
|
41
|
+
* than "must be a sibling." See specs/place-order.md's open items for this gap.
|
|
42
|
+
*
|
|
43
|
+
* **This component never touches card data.** It declares its own thin fragment for the read-model
|
|
44
|
+
* slice `usePlaceOrder` needs (`selectedMethodId`, `selectedInstallment`, `methods` — ADR-0011,
|
|
45
|
+
* mirroring `PaymentSummaryData`/`PaymentSectionData`) and forwards it plus `$actions` straight into
|
|
46
|
+
* the hook. The one fact it reads off `usePayment()`'s context directly is `draft.billingAddressDifferent`
|
|
47
|
+
* (T11's widening of `PaymentDraft`), forwarded into `usePlaceOrder`'s own optional argument of the
|
|
48
|
+
* same name so the gateway descriptor carries the shopper's choice (fix pass, PR #544 review F1) —
|
|
49
|
+
* still not a card field, since `PaymentDraft` never carries one. `usePaymentSubmitGate()` (T24)
|
|
50
|
+
* resolves the client-side document/billing refusal off that same context and is forwarded as
|
|
51
|
+
* `usePlaceOrder`'s `submitGate` argument — an opaque `PaymentUserError | null`, never the facts
|
|
52
|
+
* behind it. The hook already owns `placing`, `userErrors`, and `orderId` — including releasing
|
|
53
|
+
* `placing` on every failure path — so this component only reflects that state, never re-implements it.
|
|
54
|
+
*
|
|
55
|
+
* `attempted` is the one bit of state this component adds, and it is not a duplicate of anything the
|
|
56
|
+
* hook owns: `usePlaceOrder`'s `userErrors: []` is both the pre-attempt state and the settled-success
|
|
57
|
+
* state (T13 does not disambiguate the two, by design — see `UsePlaceOrder`'s doc), so distinguishing
|
|
58
|
+
* "never attempted" from "attempted and succeeded" is exactly this component's job. `succeeded` is
|
|
59
|
+
* derived, not stored: `attempted && !placing && userErrors.length === 0`.
|
|
60
|
+
*
|
|
61
|
+
* **T29 widens both `succeeded` and the button label with the surviving `attempt` record read off
|
|
62
|
+
* `usePayment()`** (specs/make-an-order-attempt-survive-a.md), never mirrored into local state:
|
|
63
|
+
* `attempted`/`userErrors`/`orderId` all restart at their pre-attempt defaults on every mount, but the
|
|
64
|
+
* attempt record does not, so a remount renders its truth rather than this instance's own fresh state.
|
|
65
|
+
* `succeeded` is `true` whenever the record's own phase is `'settled'`, independent of `attempted`; the
|
|
66
|
+
* button shows `resumeLabel` instead of `label` whenever the phase is `'sent'` or `'unresolved'` — the
|
|
67
|
+
* card already left the browser (or its fate is unknown) and the next click finalizes it through
|
|
68
|
+
* `usePlaceOrder`'s `resume()` rather than opening a new transaction.
|
|
69
|
+
*
|
|
70
|
+
* The button disables on `placing` (the required blocking state) and, deliberately, on `succeeded`
|
|
71
|
+
* too — an already-placed order has nothing left to submit, and a second click risks exactly the
|
|
72
|
+
* duplicate-transaction outcome T13's own concurrency guard (Decision 6) calls "the worst outcome
|
|
73
|
+
* this task's surface has". `usePlaceOrder`'s in-flight ref is the inner guard; this is the outer one.
|
|
74
|
+
* Fix pass, finding S-F1: it also disables on the *shared* `usePayment().placing`, since a second
|
|
75
|
+
* composed `PlaceOrder` has no other way to learn a sibling instance already opened a transaction —
|
|
76
|
+
* each `usePlaceOrder()` call owns its own, independent `inFlight` ref.
|
|
77
|
+
*/
|
|
78
|
+
const fragment = `
|
|
19
79
|
fragment PlaceOrderData on Query {
|
|
20
80
|
payment {
|
|
21
81
|
__typename
|
|
@@ -37,7 +97,168 @@ const PlaceOrderDefinition = defineComponent({
|
|
|
37
97
|
}
|
|
38
98
|
}
|
|
39
99
|
}
|
|
40
|
-
|
|
100
|
+
`;
|
|
101
|
+
const PlaceOrderContent = defineContentType({
|
|
102
|
+
id: "place-order",
|
|
103
|
+
title: "Place Order",
|
|
104
|
+
description: "The place-order button labels, the message while placing, the success message, and the message for each refusal it words.",
|
|
105
|
+
schema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
properties: {
|
|
109
|
+
label: {
|
|
110
|
+
type: "string",
|
|
111
|
+
title: "Button label",
|
|
112
|
+
format: "icu-message",
|
|
113
|
+
messageSource: "Place order"
|
|
114
|
+
},
|
|
115
|
+
placingLabel: {
|
|
116
|
+
type: "string",
|
|
117
|
+
title: "Button label while placing",
|
|
118
|
+
format: "icu-message",
|
|
119
|
+
messageSource: "Placing order..."
|
|
120
|
+
},
|
|
121
|
+
placingMessage: {
|
|
122
|
+
type: "string",
|
|
123
|
+
title: "Message while placing",
|
|
124
|
+
format: "icu-message",
|
|
125
|
+
messageSource: "Processing your payment. Please keep this page open.",
|
|
126
|
+
messageOptional: true
|
|
127
|
+
},
|
|
128
|
+
resumeLabel: {
|
|
129
|
+
type: "string",
|
|
130
|
+
title: "Button label while a surviving attempt offers a resume",
|
|
131
|
+
format: "icu-message",
|
|
132
|
+
messageSource: "Complete your order"
|
|
133
|
+
},
|
|
134
|
+
successMessage: {
|
|
135
|
+
type: "string",
|
|
136
|
+
title: "Success message",
|
|
137
|
+
format: "icu-message",
|
|
138
|
+
messageSource: "Order placed successfully."
|
|
139
|
+
},
|
|
140
|
+
missingSubmissionMessage: {
|
|
141
|
+
type: "string",
|
|
142
|
+
title: "Missing payment submission message",
|
|
143
|
+
format: "icu-message",
|
|
144
|
+
messageSource: "Enter your payment details before placing the order."
|
|
145
|
+
},
|
|
146
|
+
missingMethodMessage: {
|
|
147
|
+
type: "string",
|
|
148
|
+
title: "Missing payment method message",
|
|
149
|
+
format: "icu-message",
|
|
150
|
+
messageSource: "Choose a payment method before placing the order."
|
|
151
|
+
},
|
|
152
|
+
invalidTransactionMessage: {
|
|
153
|
+
type: "string",
|
|
154
|
+
title: "Invalid transaction message",
|
|
155
|
+
format: "icu-message",
|
|
156
|
+
messageSource: "Unable to start the payment. Please try again."
|
|
157
|
+
},
|
|
158
|
+
networkErrorMessage: {
|
|
159
|
+
type: "string",
|
|
160
|
+
title: "Network error message",
|
|
161
|
+
format: "icu-message",
|
|
162
|
+
messageSource: "Unable to complete the request. Please try again."
|
|
163
|
+
},
|
|
164
|
+
missingDocumentMessage: {
|
|
165
|
+
type: "string",
|
|
166
|
+
title: "Missing document message",
|
|
167
|
+
format: "icu-message",
|
|
168
|
+
messageSource: "Enter your document before placing the order."
|
|
169
|
+
},
|
|
170
|
+
invalidDocumentMessage: {
|
|
171
|
+
type: "string",
|
|
172
|
+
title: "Invalid document message",
|
|
173
|
+
format: "icu-message",
|
|
174
|
+
messageSource: "Enter a valid document before placing the order."
|
|
175
|
+
},
|
|
176
|
+
unavailableMethodMessage: {
|
|
177
|
+
type: "string",
|
|
178
|
+
title: "Unavailable payment method message",
|
|
179
|
+
format: "icu-message",
|
|
180
|
+
messageSource: "Choose another payment method before placing the order."
|
|
181
|
+
},
|
|
182
|
+
unsavedBillingAddressMessage: {
|
|
183
|
+
type: "string",
|
|
184
|
+
title: "Unsaved billing address message",
|
|
185
|
+
format: "icu-message",
|
|
186
|
+
messageSource: "Save your billing address before placing the order."
|
|
187
|
+
},
|
|
188
|
+
missingProfileNameMessage: {
|
|
189
|
+
type: "string",
|
|
190
|
+
title: "Missing name message",
|
|
191
|
+
format: "icu-message",
|
|
192
|
+
messageSource: "Enter your first and last name before placing the order."
|
|
193
|
+
},
|
|
194
|
+
missingProfilePhoneMessage: {
|
|
195
|
+
type: "string",
|
|
196
|
+
title: "Missing phone message",
|
|
197
|
+
format: "icu-message",
|
|
198
|
+
messageSource: "Enter your phone number before placing the order."
|
|
199
|
+
},
|
|
200
|
+
invalidCardDataMessage: {
|
|
201
|
+
type: "string",
|
|
202
|
+
title: "Invalid card data message",
|
|
203
|
+
format: "icu-message",
|
|
204
|
+
messageSource: "Enter valid card details before placing the order."
|
|
205
|
+
},
|
|
206
|
+
unsupportedNetworkMessage: {
|
|
207
|
+
type: "string",
|
|
208
|
+
title: "Unsupported card network message",
|
|
209
|
+
format: "icu-message",
|
|
210
|
+
messageSource: "This card is not from a network the store accepts. Use another card or choose another payment method."
|
|
211
|
+
},
|
|
212
|
+
invalidSecurityCodeMessage: {
|
|
213
|
+
type: "string",
|
|
214
|
+
title: "Invalid security code message",
|
|
215
|
+
format: "icu-message",
|
|
216
|
+
messageSource: "Enter a valid security code before placing the order."
|
|
217
|
+
},
|
|
218
|
+
gatewayErrorMessage: {
|
|
219
|
+
type: "string",
|
|
220
|
+
title: "Gateway error message",
|
|
221
|
+
format: "icu-message",
|
|
222
|
+
messageSource: "Unable to complete the payment. Please try again."
|
|
223
|
+
},
|
|
224
|
+
inFlightMessage: {
|
|
225
|
+
type: "string",
|
|
226
|
+
title: "Order already in flight message",
|
|
227
|
+
format: "icu-message",
|
|
228
|
+
messageSource: "This order is already being placed. Please wait."
|
|
229
|
+
},
|
|
230
|
+
unconfirmedMessage: {
|
|
231
|
+
type: "string",
|
|
232
|
+
title: "Unconfirmed order message",
|
|
233
|
+
format: "icu-message",
|
|
234
|
+
messageSource: "We could not confirm your order yet. Your payment may still be processing, so please do not pay again."
|
|
235
|
+
},
|
|
236
|
+
declinedMessage: {
|
|
237
|
+
type: "string",
|
|
238
|
+
title: "Declined payment message",
|
|
239
|
+
format: "icu-message",
|
|
240
|
+
messageSource: "Check your payment information or choose another payment method."
|
|
241
|
+
},
|
|
242
|
+
lapsedTransactionMessage: {
|
|
243
|
+
type: "string",
|
|
244
|
+
title: "Lapsed payment window message",
|
|
245
|
+
format: "icu-message",
|
|
246
|
+
messageSource: "We could not confirm your order yet. Your payment may still be processing, so please do not pay again."
|
|
247
|
+
},
|
|
248
|
+
challengeUnavailableMessage: {
|
|
249
|
+
type: "string",
|
|
250
|
+
title: "Unavailable bank verification message",
|
|
251
|
+
format: "icu-message",
|
|
252
|
+
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."
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
const PlaceOrderDefinition = defineComponent({
|
|
258
|
+
name: "PlaceOrder",
|
|
259
|
+
importPath: "@vtex/faststore/components",
|
|
260
|
+
component: PlaceOrder,
|
|
261
|
+
fragment,
|
|
41
262
|
fetchStrategy: "reactive",
|
|
42
263
|
actions: {
|
|
43
264
|
payment: ["startTransaction", "gatewayCallback"],
|
|
@@ -48,116 +269,27 @@ const PlaceOrderDefinition = defineComponent({
|
|
|
48
269
|
label: "Place Order",
|
|
49
270
|
category: "commerce"
|
|
50
271
|
},
|
|
272
|
+
content: PlaceOrderContent,
|
|
51
273
|
schema: {
|
|
52
|
-
label: {
|
|
53
|
-
type: "string",
|
|
54
|
-
default: "Place order",
|
|
55
|
-
label: "Button label"
|
|
56
|
-
},
|
|
57
|
-
placingLabel: {
|
|
58
|
-
type: "string",
|
|
59
|
-
default: "Placing order...",
|
|
60
|
-
label: "Button label while placing"
|
|
61
|
-
},
|
|
62
|
-
placingMessage: {
|
|
63
|
-
type: "string",
|
|
64
|
-
label: "Message shown while placing the order"
|
|
65
|
-
},
|
|
66
|
-
resumeLabel: {
|
|
67
|
-
type: "string",
|
|
68
|
-
default: "Complete your order",
|
|
69
|
-
label: "Button label while a surviving attempt offers a resume"
|
|
70
|
-
},
|
|
71
|
-
successMessage: {
|
|
72
|
-
type: "string",
|
|
73
|
-
default: "Order placed successfully.",
|
|
74
|
-
label: "Success message"
|
|
75
|
-
},
|
|
76
|
-
missingSubmissionMessage: {
|
|
77
|
-
type: "string",
|
|
78
|
-
default: "Enter your payment details before placing the order.",
|
|
79
|
-
label: "Missing payment submission message"
|
|
80
|
-
},
|
|
81
|
-
missingMethodMessage: {
|
|
82
|
-
type: "string",
|
|
83
|
-
default: "Choose a payment method before placing the order.",
|
|
84
|
-
label: "Missing payment method message"
|
|
85
|
-
},
|
|
86
|
-
invalidTransactionMessage: {
|
|
87
|
-
type: "string",
|
|
88
|
-
default: "Unable to start the payment. Please try again.",
|
|
89
|
-
label: "Invalid transaction message"
|
|
90
|
-
},
|
|
91
|
-
networkErrorMessage: {
|
|
92
|
-
type: "string",
|
|
93
|
-
default: "Unable to complete the request. Please try again.",
|
|
94
|
-
label: "Network error message"
|
|
95
|
-
},
|
|
96
|
-
missingDocumentMessage: {
|
|
97
|
-
type: "string",
|
|
98
|
-
default: "Enter your document before placing the order.",
|
|
99
|
-
label: "Missing document message"
|
|
100
|
-
},
|
|
101
|
-
invalidDocumentMessage: {
|
|
102
|
-
type: "string",
|
|
103
|
-
default: "Enter a valid document before placing the order.",
|
|
104
|
-
label: "Invalid document message"
|
|
105
|
-
},
|
|
106
|
-
unavailableMethodMessage: {
|
|
107
|
-
type: "string",
|
|
108
|
-
default: "Choose another payment method before placing the order.",
|
|
109
|
-
label: "Unavailable payment method message"
|
|
110
|
-
},
|
|
111
|
-
unsavedBillingAddressMessage: {
|
|
112
|
-
type: "string",
|
|
113
|
-
default: "Save your billing address before placing the order.",
|
|
114
|
-
label: "Unsaved billing address message"
|
|
115
|
-
},
|
|
116
|
-
invalidCardDataMessage: {
|
|
117
|
-
type: "string",
|
|
118
|
-
default: "Enter valid card details before placing the order.",
|
|
119
|
-
label: "Invalid card data message"
|
|
120
|
-
},
|
|
121
|
-
unsupportedNetworkMessage: {
|
|
122
|
-
type: "string",
|
|
123
|
-
default: "This card is not from a network the store accepts. Use another card or choose another payment method.",
|
|
124
|
-
label: "Unsupported card network message"
|
|
125
|
-
},
|
|
126
|
-
invalidSecurityCodeMessage: {
|
|
127
|
-
type: "string",
|
|
128
|
-
default: "Enter a valid security code before placing the order.",
|
|
129
|
-
label: "Invalid security code message"
|
|
130
|
-
},
|
|
131
|
-
gatewayErrorMessage: {
|
|
132
|
-
type: "string",
|
|
133
|
-
default: "Unable to complete the payment. Please try again.",
|
|
134
|
-
label: "Gateway error message"
|
|
135
|
-
},
|
|
136
|
-
inFlightMessage: {
|
|
137
|
-
type: "string",
|
|
138
|
-
default: "This order is already being placed. Please wait.",
|
|
139
|
-
label: "Order already in flight message"
|
|
140
|
-
},
|
|
141
|
-
unconfirmedMessage: {
|
|
142
|
-
type: "string",
|
|
143
|
-
default: "We could not confirm your order yet. Your payment may still be processing, so please do not pay again.",
|
|
144
|
-
label: "Unconfirmed order message"
|
|
145
|
-
},
|
|
146
274
|
successHref: {
|
|
147
275
|
type: "link",
|
|
148
276
|
default: { standard: "order-placed" },
|
|
149
|
-
fills: ["
|
|
277
|
+
fills: ["orderId"],
|
|
150
278
|
label: "Confirmation Page"
|
|
279
|
+
},
|
|
280
|
+
challengeReturnHref: {
|
|
281
|
+
type: "link",
|
|
282
|
+
label: "Bank challenge return page"
|
|
151
283
|
}
|
|
152
284
|
},
|
|
153
|
-
guideline: "The place-order CTA: invokes usePlaceOrder's three-call sequence (start transaction, the registered submission's own direct-to-gateway leg, then the gateway callback) and blocks interaction while it runs. Compose it as a sibling — never a child — of every other payment-entry leaf under the same PaymentSectionRoot or PaymentSectionController, so the one CTA serves every entry path. Renders one inline outcome after settling: the first userError's
|
|
285
|
+
guideline: "The place-order CTA: invokes usePlaceOrder's three-call sequence (start transaction, the registered submission's own direct-to-gateway leg, then the gateway callback) and blocks interaction while it runs. Compose it as a sibling — never a child — of every other payment-entry leaf under the same PaymentSectionRoot or PaymentSectionController, so the one CTA serves every entry path. Its button labels and messages are $content fields (label, placingLabel, placingMessage, resumeLabel, successMessage, and one message per refusal code it words). Renders one inline outcome after settling: the message for the first userError's code (networkErrorMessage for a code it does not word), or successMessage on a clean settle. While the order is being placed it renders nothing but the button, unless the placingMessage message is authored: then a status message shows beside the button, and the rest of the payment form is blocked for as long as it shows. When challengeReturnHref names a return page of the store and the bank asks for a challenge, the shopper is sent to the bank with the form blocked and no success or error shown; the return page finishes the order. This component reaches no payment-sensitive input. Must be inside a payment root. See place-order.md."
|
|
154
286
|
});
|
|
155
287
|
/** The default confirmation page. */
|
|
156
288
|
const ORDER_PLACED_PAGE = { standard: "order-placed" };
|
|
157
289
|
/**
|
|
158
290
|
* Fail-closed warning for a string `successHref` that is not a path of this store. Nothing upstream
|
|
159
291
|
* validates a string prop's shape, and an absolute or protocol-relative value would turn this CTA into
|
|
160
|
-
* an open redirect that fires right after a real purchase, carrying the shopper's own order
|
|
292
|
+
* an open redirect that fires right after a real purchase, carrying the shopper's own order id to
|
|
161
293
|
* another origin. Dev-only, like every other authoring warning in this component.
|
|
162
294
|
*/
|
|
163
295
|
function warnUnsafeSuccessHref(successHref, reason) {
|
|
@@ -167,38 +299,109 @@ function warnUnsafeSuccessHref(successHref, reason) {
|
|
|
167
299
|
/**
|
|
168
300
|
* Fail-closed warning for a string `successHref` that still carries a `{token}`, the template form this
|
|
169
301
|
* prop took before page references. Nothing fills the token any more, so navigating would land the
|
|
170
|
-
* shopper on a literal `%
|
|
302
|
+
* shopper on a literal `%7BorderId%7D` 404 right after paying. Dev-only.
|
|
171
303
|
*/
|
|
172
304
|
function warnTemplateSuccessHref(successHref) {
|
|
173
305
|
if (process.env.NODE_ENV === "production") return;
|
|
174
306
|
console.warn(`[PlaceOrder] successHref "${successHref}" is a route template; refusing to navigate there. Reference the confirmation page instead: { standard: 'order-placed' }.`);
|
|
175
307
|
}
|
|
176
308
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
309
|
+
* Dev-only warning for a `challengeReturnHref` this CTA cannot build a return URL from. Nothing upstream
|
|
310
|
+
* validates a link prop's shape at runtime, and a string would have to be turned into an absolute URL the
|
|
311
|
+
* bank must come back to; so the prop is a page reference or nothing, and the shopper keeps the refusal
|
|
312
|
+
* a challenge answer gets without a return page.
|
|
313
|
+
*/
|
|
314
|
+
function warnUnusableChallengeReturnHref(reason) {
|
|
315
|
+
if (process.env.NODE_ENV === "production") return;
|
|
316
|
+
console.warn(`[PlaceOrder] challengeReturnHref ${reason}; sending no return URL, so a bank challenge cannot be followed. Reference a page of this store instead: { page: 'checkout-challenge-return' }.`);
|
|
317
|
+
}
|
|
318
|
+
function isPageRef(value) {
|
|
319
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The builder `usePlaceOrder` calls with an opened order's group: the absolute URL of the authored return
|
|
323
|
+
* page, carrying the group and the literal flag, or `null` when the store authored none or it cannot be
|
|
324
|
+
* built. Resolved through `resolveStorefrontHref`, which never logs, so an unusable prop warns exactly once
|
|
325
|
+
* here, naming itself. Keyed on the serialized reference, not its identity: a reference authored in a
|
|
326
|
+
* schema arrives as a new object on every server render.
|
|
327
|
+
*/
|
|
328
|
+
function useChallengeReturn(challengeReturnHref) {
|
|
329
|
+
const { bindingId, basePath } = useStorefrontContext();
|
|
330
|
+
const { routeMap } = useRouteMap();
|
|
331
|
+
const authoredKey = challengeReturnHref === void 0 ? null : JSON.stringify(challengeReturnHref);
|
|
332
|
+
return useCallback((orderGroup) => {
|
|
333
|
+
if (authoredKey === null) return null;
|
|
334
|
+
const authored = JSON.parse(authoredKey);
|
|
335
|
+
if (!isPageRef(authored)) {
|
|
336
|
+
warnUnusableChallengeReturnHref("is not a page reference");
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
const query = buildChallengeReturnQuery(orderGroup);
|
|
340
|
+
if (query === null) return null;
|
|
341
|
+
const resolved = resolveStorefrontHref({
|
|
342
|
+
bindingId,
|
|
343
|
+
basePath
|
|
344
|
+
}, routeMap, {
|
|
345
|
+
...authored,
|
|
346
|
+
query: {
|
|
347
|
+
...authored.query,
|
|
348
|
+
...query
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
if (resolved.href === null) {
|
|
352
|
+
warnUnusableChallengeReturnHref(`names a page this store does not serve (${resolved.reason})`);
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
return `${globalThis.location.origin}${resolved.href}`;
|
|
356
|
+
}, [
|
|
357
|
+
authoredKey,
|
|
358
|
+
bindingId,
|
|
359
|
+
basePath,
|
|
360
|
+
routeMap
|
|
361
|
+
]);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Hands the document to the bank once `redirectUrl` is set. `useStorefrontNavigation().push` makes an
|
|
365
|
+
* absolute URL a document load, which unloads this page: nothing here draws a success or an error, and the
|
|
366
|
+
* hook keeps `placing` true so the form stays blocked until the browser leaves. A ref remembers the URL
|
|
367
|
+
* already navigated to, so neither a re-render nor StrictMode's second effect pass navigates twice.
|
|
368
|
+
*/
|
|
369
|
+
function PlaceOrderNavigateOnRedirect({ redirectUrl }) {
|
|
370
|
+
const { push } = useStorefrontNavigation();
|
|
371
|
+
const navigatedTo = useRef(null);
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (!redirectUrl || navigatedTo.current === redirectUrl) return;
|
|
374
|
+
navigatedTo.current = redirectUrl;
|
|
375
|
+
push(redirectUrl);
|
|
376
|
+
}, [redirectUrl, push]);
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Navigates once `orderNodeId` transitions to a non-empty value — not on `succeeded` (Decision 4) — so a
|
|
381
|
+
* null or empty order Node id and every failure path never navigate. `userErrors` is also consulted
|
|
179
382
|
* directly (INV-1): this component does not own `usePlaceOrder`, so it does not rely on that hook never
|
|
180
383
|
* settling an order id beside an error.
|
|
181
384
|
*
|
|
182
|
-
* The call site passes `
|
|
183
|
-
* mount-local `
|
|
184
|
-
* has an empty local `
|
|
385
|
+
* The call site passes `displayOrderNodeId` (`orderNodeId ?? the surviving attempt's own orderNodeId`),
|
|
386
|
+
* not the mount-local `orderNodeId` this type is named for: a remounted CTA whose own `usePlaceOrder()`
|
|
387
|
+
* never ran has an empty local `orderNodeId` forever, and would otherwise leave the shopper on the payment page.
|
|
185
388
|
*
|
|
186
389
|
* The effect keys on the serialized `successHref`, not on its identity: a reference authored in a
|
|
187
390
|
* schema arrives as a new object on every server render, and keying on it would navigate again on a
|
|
188
391
|
* `router.refresh()`.
|
|
189
392
|
*/
|
|
190
|
-
function PlaceOrderNavigateOnSuccess({ successHref,
|
|
393
|
+
function PlaceOrderNavigateOnSuccess({ successHref, orderNodeId, userErrors }) {
|
|
191
394
|
const { replace } = useStorefrontNavigation();
|
|
192
395
|
const successKey = JSON.stringify(successHref);
|
|
193
396
|
useEffect(() => {
|
|
194
|
-
if (!
|
|
397
|
+
if (!orderNodeId || userErrors.length > 0) return;
|
|
195
398
|
const authored = JSON.parse(successKey);
|
|
196
399
|
if (typeof authored !== "string") {
|
|
197
400
|
replace({
|
|
198
401
|
...authored,
|
|
199
402
|
params: {
|
|
200
403
|
...authored.params,
|
|
201
|
-
|
|
404
|
+
orderId: orderNodeId
|
|
202
405
|
}
|
|
203
406
|
});
|
|
204
407
|
return;
|
|
@@ -214,7 +417,7 @@ function PlaceOrderNavigateOnSuccess({ successHref, orderId, userErrors }) {
|
|
|
214
417
|
}
|
|
215
418
|
replace(destination.href);
|
|
216
419
|
}, [
|
|
217
|
-
|
|
420
|
+
orderNodeId,
|
|
218
421
|
successKey,
|
|
219
422
|
userErrors,
|
|
220
423
|
replace
|
|
@@ -222,75 +425,70 @@ function PlaceOrderNavigateOnSuccess({ successHref, orderId, userErrors }) {
|
|
|
222
425
|
return null;
|
|
223
426
|
}
|
|
224
427
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* use-
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* direct unit testing, mirroring card-entry.tsx's convention for its own pure helpers:
|
|
231
|
-
* place-order.test.tsx imports the five files' own real exported code constants and asserts this
|
|
232
|
-
* function's returned key set equals their union.
|
|
428
|
+
* The message field for each code in `PlaceOrderErrorCode`. The codes are literal strings, never imported
|
|
429
|
+
* constants: importing them from card-entry.tsx / saved-cards.tsx / use-place-order.ts /
|
|
430
|
+
* use-payment-submit-gate.ts / gateway.ts would make this file a matter -> matter dependency (R5).
|
|
431
|
+
* `CARD_ENTRY_COLLAPSED` reads as an unavailable method; the two cart codes and `NETWORK_ERROR` share the
|
|
432
|
+
* generic message; `ORDER_GROUP_MISMATCH`, like a lapsed cookie, means the card POST was accepted.
|
|
233
433
|
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
434
|
+
const PLACE_ORDER_ERROR_FIELDS = {
|
|
435
|
+
MISSING_PAYMENT_SUBMISSION: "missingSubmissionMessage",
|
|
436
|
+
MISSING_PAYMENT_METHOD_SELECTION: "missingMethodMessage",
|
|
437
|
+
INVALID_TRANSACTION_DATA: "invalidTransactionMessage",
|
|
438
|
+
NETWORK_ERROR: "networkErrorMessage",
|
|
439
|
+
MISSING_CARDHOLDER_DOCUMENT: "missingDocumentMessage",
|
|
440
|
+
INVALID_CARDHOLDER_DOCUMENT: "invalidDocumentMessage",
|
|
441
|
+
UNSAVED_BILLING_ADDRESS: "unsavedBillingAddressMessage",
|
|
442
|
+
MISSING_PROFILE_NAME: "missingProfileNameMessage",
|
|
443
|
+
MISSING_PROFILE_PHONE: "missingProfilePhoneMessage",
|
|
444
|
+
INVALID_CARD_DATA: "invalidCardDataMessage",
|
|
445
|
+
UNSUPPORTED_CARD_NETWORK: "unsupportedNetworkMessage",
|
|
446
|
+
CARD_ENTRY_COLLAPSED: "unavailableMethodMessage",
|
|
447
|
+
INVALID_SECURITY_CODE: "invalidSecurityCodeMessage",
|
|
448
|
+
GATEWAY_ERROR: "gatewayErrorMessage",
|
|
449
|
+
PLACE_ORDER_IN_FLIGHT: "inFlightMessage",
|
|
450
|
+
PLACE_ORDER_UNCONFIRMED: "unconfirmedMessage",
|
|
451
|
+
UNAVAILABLE_PAYMENT_METHOD: "unavailableMethodMessage",
|
|
452
|
+
MISSING_CART_CONTEXT: "networkErrorMessage",
|
|
453
|
+
CART_NOT_FOUND: "networkErrorMessage",
|
|
454
|
+
PAYMENT_DECLINED: "declinedMessage",
|
|
455
|
+
MISSING_TRANSACTION_COOKIES: "lapsedTransactionMessage",
|
|
456
|
+
ORDER_GROUP_MISMATCH: "lapsedTransactionMessage",
|
|
457
|
+
REDIRECT_REQUIRED: "challengeUnavailableMessage"
|
|
458
|
+
};
|
|
252
459
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* (US-2 AC2 — a server-returned code this component does not author must render verbatim).
|
|
256
|
-
*
|
|
257
|
-
* `||`, not `??` (fix pass, finding 7): a store author can write `""` for a code's authored message —
|
|
258
|
-
* a valid, if unusual, `type: 'string'` prop value — and `??` only falls through on `null`/`undefined`,
|
|
259
|
-
* so an authored empty string would render as an empty `role="alert"` on a genuine gateway refusal,
|
|
260
|
-
* leaving the shopper with no feedback at all where the unauthored default always rendered
|
|
261
|
-
* `error.message`. Falling through on any falsy authored value is the exception on this surface, not
|
|
262
|
-
* the rule: eight sibling `??` resolutions elsewhere (`access-code-sign-in.tsx`, `region.tsx`) stay on
|
|
263
|
-
* `??`; `billing-address.tsx`'s `fieldLabels` fallback (fix pass round 2, finding N1) is fixed the
|
|
264
|
-
* same way, for the same reason.
|
|
460
|
+
* The alert's message for one `PaymentUserError`: the message field for its `code`, or networkErrorMessage
|
|
461
|
+
* for a code this CTA does not word. A missing message renders empty and the formatter logs it.
|
|
265
462
|
*/
|
|
266
|
-
function resolveErrorMessage(error,
|
|
267
|
-
return
|
|
463
|
+
function resolveErrorMessage(error, format) {
|
|
464
|
+
return formatErrorCode(PlaceOrderContent, PLACE_ORDER_ERROR_FIELDS, error, format, "networkErrorMessage");
|
|
268
465
|
}
|
|
269
466
|
/**
|
|
270
467
|
* The CTA's feedback nodes: the authored placing message, the alert for a refusal, the status notice for
|
|
271
468
|
* an order that could not be confirmed (T176), and the success line. Rendered as the CTA's own children,
|
|
272
469
|
* so none of them adds a wrapper.
|
|
273
470
|
*/
|
|
274
|
-
function PlaceOrderFeedback({ placing,
|
|
471
|
+
function PlaceOrderFeedback({ placing, firstError, unconfirmed, succeeded, displayOrderId, format }) {
|
|
472
|
+
const placingMessage = placing ? format("placingMessage") : "";
|
|
275
473
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
276
|
-
|
|
474
|
+
placingMessage.trim() ? /* @__PURE__ */ jsx("output", {
|
|
277
475
|
"data-fs-place-order-placing": "",
|
|
278
476
|
children: placingMessage
|
|
279
477
|
}) : null,
|
|
280
478
|
firstError && !unconfirmed ? /* @__PURE__ */ jsx("div", {
|
|
281
479
|
role: "alert",
|
|
282
480
|
"data-fs-place-order-error": "",
|
|
283
|
-
children: resolveErrorMessage(firstError,
|
|
481
|
+
children: resolveErrorMessage(firstError, format)
|
|
284
482
|
}) : null,
|
|
285
483
|
firstError && unconfirmed && !succeeded ? /* @__PURE__ */ jsx("output", {
|
|
286
484
|
"data-fs-place-order-unconfirmed": "",
|
|
287
|
-
children: resolveErrorMessage(firstError,
|
|
485
|
+
children: resolveErrorMessage(firstError, format)
|
|
288
486
|
}) : null,
|
|
289
487
|
succeeded ? /* @__PURE__ */ jsxs("output", {
|
|
290
488
|
"data-fs-place-order-success": "",
|
|
291
489
|
children: [/* @__PURE__ */ jsx("span", {
|
|
292
490
|
"data-fs-place-order-success-message": "",
|
|
293
|
-
children: successMessage
|
|
491
|
+
children: format("successMessage")
|
|
294
492
|
}), displayOrderId ? /* @__PURE__ */ jsx("span", {
|
|
295
493
|
"data-fs-place-order-success-order-id": "",
|
|
296
494
|
children: displayOrderId
|
|
@@ -307,36 +505,25 @@ function refusalFocusTarget(refusals, reachedGateway) {
|
|
|
307
505
|
const [refusal] = refusals;
|
|
308
506
|
return reachedGateway === false && refusal ? refusalTargetOf(refusal) : null;
|
|
309
507
|
}
|
|
310
|
-
function PlaceOrder({
|
|
508
|
+
function PlaceOrder({ successHref = ORDER_PLACED_PAGE, challengeReturnHref, $data: $dataProp, $actions: $actionsProp, $content, $locale, className, ...props }) {
|
|
311
509
|
const $data = useDataOverride($dataProp);
|
|
312
510
|
const $actions = useActionsOverride($actionsProp);
|
|
313
511
|
const instanceKey = useId();
|
|
314
512
|
const { draft, placing: sectionPlacing, setPlacing, attempt, setAttempt, focusRefusal } = usePayment();
|
|
315
513
|
const submitGate = usePaymentSubmitGate();
|
|
316
|
-
const
|
|
514
|
+
const challengeReturn = useChallengeReturn(challengeReturnHref);
|
|
515
|
+
const readSettledOrder = useSettledOrderRead();
|
|
516
|
+
const { placeOrder, placing, userErrors, orderId, orderNodeId, redirectUrl } = usePlaceOrder({
|
|
317
517
|
$data,
|
|
318
518
|
$actions,
|
|
319
519
|
attempt,
|
|
320
520
|
setAttempt,
|
|
321
521
|
billingAddressDifferent: draft.billingAddressDifferent,
|
|
322
|
-
submitGate
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
missingSubmissionMessage,
|
|
326
|
-
missingMethodMessage,
|
|
327
|
-
invalidTransactionMessage,
|
|
328
|
-
networkErrorMessage,
|
|
329
|
-
missingDocumentMessage,
|
|
330
|
-
invalidDocumentMessage,
|
|
331
|
-
unsavedBillingAddressMessage,
|
|
332
|
-
invalidCardDataMessage,
|
|
333
|
-
unsupportedNetworkMessage,
|
|
334
|
-
invalidSecurityCodeMessage,
|
|
335
|
-
gatewayErrorMessage,
|
|
336
|
-
inFlightMessage,
|
|
337
|
-
unconfirmedMessage,
|
|
338
|
-
unavailableMethodMessage
|
|
522
|
+
submitGate,
|
|
523
|
+
challengeReturn,
|
|
524
|
+
readSettledOrder
|
|
339
525
|
});
|
|
526
|
+
const { format } = useMessageFormatter(PlaceOrderContent, $content);
|
|
340
527
|
const [attempted, setAttempted] = useState(false);
|
|
341
528
|
useLayoutEffect(() => {
|
|
342
529
|
setPlacing(instanceKey, placing);
|
|
@@ -351,9 +538,11 @@ function PlaceOrder({ label = "Place order", placingLabel = "Placing order...",
|
|
|
351
538
|
]);
|
|
352
539
|
const [firstError] = userErrors;
|
|
353
540
|
const settledAttemptOrderId = attempt?.phase === "settled" ? attempt.orderId : null;
|
|
541
|
+
const settledAttemptOrderNodeId = attempt?.phase === "settled" ? attempt.orderNodeId ?? null : null;
|
|
354
542
|
const succeeded = attempted && !placing && userErrors.length === 0 || attempt?.phase === "settled";
|
|
355
543
|
const resumable = attempt?.phase === "sent" || attempt?.phase === "unresolved";
|
|
356
544
|
const displayOrderId = orderId ?? settledAttemptOrderId;
|
|
545
|
+
const displayOrderNodeId = orderNodeId ?? settledAttemptOrderNodeId;
|
|
357
546
|
const unconfirmed = firstError?.code === "PLACE_ORDER_UNCONFIRMED";
|
|
358
547
|
const blockedByOtherInstance = sectionPlacing && !resumable;
|
|
359
548
|
function handleClick() {
|
|
@@ -364,6 +553,9 @@ function PlaceOrder({ label = "Place order", placingLabel = "Placing order...",
|
|
|
364
553
|
if (target) focusRefusal(target);
|
|
365
554
|
});
|
|
366
555
|
}
|
|
556
|
+
let buttonLabelField = "label";
|
|
557
|
+
if (placing) buttonLabelField = "placingLabel";
|
|
558
|
+
else if (resumable) buttonLabelField = "resumeLabel";
|
|
367
559
|
return /* @__PURE__ */ jsxs("div", {
|
|
368
560
|
...props,
|
|
369
561
|
className,
|
|
@@ -376,27 +568,26 @@ function PlaceOrder({ label = "Place order", placingLabel = "Placing order...",
|
|
|
376
568
|
"aria-busy": placing || void 0,
|
|
377
569
|
"data-fs-place-order-button": "",
|
|
378
570
|
...placing ? { "data-fs-place-order-button-pending": "" } : {},
|
|
379
|
-
children:
|
|
571
|
+
children: format(buttonLabelField)
|
|
380
572
|
}),
|
|
381
573
|
/* @__PURE__ */ jsx(PlaceOrderFeedback, {
|
|
382
574
|
placing,
|
|
383
|
-
placingMessage,
|
|
384
575
|
firstError,
|
|
385
576
|
unconfirmed,
|
|
386
577
|
succeeded,
|
|
387
|
-
successMessage,
|
|
388
578
|
displayOrderId,
|
|
389
|
-
|
|
579
|
+
format
|
|
390
580
|
}),
|
|
391
581
|
/* @__PURE__ */ jsx(PlaceOrderNavigateOnSuccess, {
|
|
392
582
|
successHref,
|
|
393
|
-
|
|
583
|
+
orderNodeId: displayOrderNodeId,
|
|
394
584
|
userErrors
|
|
395
|
-
})
|
|
585
|
+
}),
|
|
586
|
+
/* @__PURE__ */ jsx(PlaceOrderNavigateOnRedirect, { redirectUrl })
|
|
396
587
|
]
|
|
397
588
|
});
|
|
398
589
|
}
|
|
399
590
|
//#endregion
|
|
400
|
-
export { PlaceOrder,
|
|
591
|
+
export { PLACE_ORDER_ERROR_FIELDS, PlaceOrder, PlaceOrderContent, PlaceOrderDefinition, resolveErrorMessage };
|
|
401
592
|
|
|
402
593
|
//# sourceMappingURL=place-order.js.map
|