@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":"order-placed.js","names":[],"sources":["../../../src/matter/order-placed/order-placed.tsx"],"sourcesContent":["'use client';\n\nimport type { ErrorLike } from '@apollo/client';\nimport { CombinedGraphQLErrors } from '@apollo/client/errors';\nimport { defineComponent } from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { substituteTemplate } from '../../utils/substitute-template.js';\nimport { formatPrice } from '../cart/cart.js';\n\n/**\n * Order Placed matters (docs/features/order-placed/rfc-particles.md, Parts, part 2).\n * `OrderPlacedRoot` owns the placed order: it reads `Query.order(orderGroup: $orderGroup)` once through\n * its own fragment and provides it as the `order-placed` context, or shows an authored message in\n * place of its children when the read is refused or fails. The leaves read the order's own record,\n * never the live cart or profile, so a confirmation reopened later shows what the purchase carried.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragments\n// ---------------------------------------------------------------------------\n\nconst rootFragment = /* GraphQL */ `\n fragment OrderPlacedRootData on Query {\n order(orderGroup: $orderGroup) {\n __typename\n id\n reference\n status\n total {\n amount\n currencyCode\n }\n totals {\n id\n name\n value {\n amount\n currencyCode\n }\n }\n }\n }\n`;\n\nconst customerFragment = /* GraphQL */ `\n fragment OrderPlacedCustomerData on Query {\n order(orderGroup: $orderGroup) {\n __typename\n id\n customer {\n firstName\n lastName\n email\n phone\n document\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** `amount` is the API's `Decimal`, a string (\"12.50\"). */\nexport type OrderPlacedMoney = { amount: string; currencyCode: string };\n\nexport type OrderPlacedStatusValue = 'APPROVED' | 'PENDING' | 'DENIED' | 'UNKNOWN';\n\nexport type OrderPlacedTotalLine = { id: string; name: string; value: OrderPlacedMoney };\n\n/**\n * The `$data` slice forwarded by the reactive runtime: the unwrapped `order` field, never a\n * `{ order: … }` wrapper (ADR-0015). `null` when the order group does not resolve.\n */\nexport type OrderPlacedData = {\n id: string;\n reference: string;\n status: OrderPlacedStatusValue;\n total?: OrderPlacedMoney | null;\n totals: readonly OrderPlacedTotalLine[];\n} | null;\n\n/** `OrderPlacedCustomer`'s own `$data` slice, the unwrapped `order` field of its fragment. */\nexport type OrderPlacedCustomerData = {\n customer?: {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n phone?: string | null;\n document?: string | null;\n } | null;\n} | null;\n\nexport type OrderPlacedContextValue = Readonly<{\n order: OrderPlacedData;\n loading: boolean;\n error: ErrorLike | null;\n}>;\n\nexport type OrderPlacedRootProps = {\n className?: string;\n children?: ReactNode;\n /** Shown in place of the order when the read is refused: after 15 minutes, or from another browser. */\n refusedOrderLabel?: string;\n /** Shown in place of the order when the read fails or the order group resolves to no order. */\n unresolvedOrderLabel?: string;\n /** Unwrapped `Order` slice forwarded by the reactive runtime. */\n $data?: OrderPlacedData;\n};\n\nexport type OrderPlacedStatusProps = {\n className?: string;\n /** An optional `Icon`, shown on every outcome. */\n children?: ReactNode;\n approvedTitle?: string;\n approvedMessage?: string;\n pendingTitle?: string;\n pendingMessage?: string;\n deniedTitle?: string;\n deniedMessage?: string;\n};\n\nexport type OrderPlacedReferenceProps = {\n className?: string;\n /** `{reference}` placeholder. */\n template?: string;\n};\n\nexport type OrderPlacedCustomerProps = {\n className?: string;\n nameLabel?: string;\n emailLabel?: string;\n phoneLabel?: string;\n documentLabel?: string;\n /** Unwrapped `Order` slice of this component's own fragment. */\n $data?: OrderPlacedCustomerData;\n};\n\nexport type OrderPlacedTotalsProps = {\n className?: string;\n itemsLabel?: string;\n shippingLabel?: string;\n discountsLabel?: string;\n taxLabel?: string;\n totalLabel?: string;\n /** Shown instead of a zero shipping value. Omitted to show the formatted zero. */\n shippingZeroLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ORDER_PLACED_UNSET = Symbol('OrderPlacedContextUnset');\n\nconst OrderPlacedContext = createContext<OrderPlacedContextValue | typeof ORDER_PLACED_UNSET>(ORDER_PLACED_UNSET);\n\n/** The placed order, its loading flag and the root query's error, from the nearest OrderPlacedRoot. */\nexport function useOrderPlaced(): OrderPlacedContextValue {\n const ctx = useContext(OrderPlacedContext);\n if (ctx === ORDER_PLACED_UNSET) {\n throw new Error('useOrderPlaced() must be used inside an <OrderPlacedRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\ntype RootState = 'refused' | 'loading' | 'unresolved' | 'order';\n\n/**\n * The API refuses the read with a top-level `UNAUTHORIZED`: without both checkout cookies, and when\n * the order system answers 401 or 403, as it does after 15 minutes. Under `errorPolicy: 'all'` the\n * refusal also carries `order: null`, so it is checked before the order is.\n */\nfunction isRefusal(error: ErrorLike | null): boolean {\n if (!error || !CombinedGraphQLErrors.is(error)) return false;\n return error.errors.some((graphQLError) => graphQLError.extensions?.code === 'UNAUTHORIZED');\n}\n\nfunction resolveRootState({ order, loading, error }: OrderPlacedContextValue): RootState {\n if (isRefusal(error)) return 'refused';\n if (loading && order == null) return 'loading';\n if (order == null) return 'unresolved';\n return 'order';\n}\n\nfunction isZero(money: OrderPlacedMoney): boolean {\n return Number(money.amount) === 0;\n}\n\nfunction formatMoney(money: OrderPlacedMoney, locale: string): string {\n return formatPrice(Number(money.amount), locale, money.currencyCode);\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedRootDefinition = defineComponent<OrderPlacedRootProps>({\n name: 'OrderPlacedRoot',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedRoot,\n fragment: rootFragment,\n fetchStrategy: 'reactive',\n skeleton: OrderPlacedRootSkeleton,\n providesContext: 'order-placed',\n editor: { label: 'Order Placed Root', category: 'commerce' },\n schema: {\n refusedOrderLabel: {\n type: 'string',\n default: 'This order can no longer be shown here',\n label: 'Refused order label',\n },\n unresolvedOrderLabel: { type: 'string', default: 'Could not load this order', label: 'Unresolved order label' },\n },\n guideline:\n 'Owner of an order confirmation page: reads the placed order (Query.order, keyed on the order group from the route) once and provides it as the order-placed context to OrderPlacedStatus, OrderPlacedReference, OrderPlacedCustomer, OrderPlacedTotals and the other order-placed blocks composed as its children. Renders its children only once the order resolves. While the read is in flight it shows a skeleton; when the API refuses the read (after 15 minutes, or from another browser) it shows refusedOrderLabel; when the read fails or the order group resolves to no order it shows unresolvedOrderLabel. Each message replaces every child. Never reads the cart or the live profile. See order-placed.md.',\n});\n\nexport const OrderPlacedStatusDefinition = defineComponent<OrderPlacedStatusProps>({\n name: 'OrderPlacedStatus',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedStatus,\n requiresContext: 'order-placed',\n editor: { label: 'Order Placed Status', category: 'commerce' },\n schema: {\n approvedTitle: { type: 'string', default: 'Your order is confirmed', label: 'Approved title' },\n approvedMessage: { type: 'string', default: 'Your payment was approved.', label: 'Approved message' },\n pendingTitle: { type: 'string', default: \"We're confirming your payment\", label: 'Pending title' },\n pendingMessage: {\n type: 'string',\n default: 'Your order was placed, and its payment is still being processed or reviewed.',\n label: 'Pending message',\n },\n deniedTitle: { type: 'string', default: 'Your payment was not approved', label: 'Denied title' },\n deniedMessage: {\n type: 'string',\n default: 'This purchase did not go through. You can place a new order with another payment method.',\n label: 'Denied message',\n },\n },\n guideline:\n 'The payment outcome of the placed order, as a banner with a title and a message: approved, pending (which also covers a payment under anti-fraud review) or denied. Renders nothing when the outcome is unknown, so the page shows the order without asserting success or failure. Author the title and message of each outcome through the props (approvedTitle, approvedMessage, pendingTitle, pendingMessage, deniedTitle, deniedMessage); a blank value omits its line. Marks the outcome with data-fs-order-placed-status-approved, -pending or -denied, so the page styles each tone. An Icon composed as its child shows on every outcome, so never compose one that implies success. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedReferenceDefinition = defineComponent<OrderPlacedReferenceProps>({\n name: 'OrderPlacedReference',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedReference,\n requiresContext: 'order-placed',\n editor: { label: 'Order Placed Reference', category: 'commerce' },\n schema: {\n template: { type: 'string', default: 'Order #{reference}', label: 'Template' },\n },\n guideline:\n 'The order number the shopper gives support: the order group, one per purchase even when it was split across sellers. Set template with a {reference} placeholder (e.g. \"Order #{reference}\"). Plain text, so it can be selected and copied. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedCustomerDefinition = defineComponent<OrderPlacedCustomerProps>({\n name: 'OrderPlacedCustomer',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedCustomer,\n fragment: customerFragment,\n fetchStrategy: 'reactive',\n requiresContext: 'order-placed',\n editor: { label: 'Order Placed Customer', category: 'commerce' },\n schema: {\n nameLabel: { type: 'string', default: 'Name', label: 'Name label' },\n emailLabel: { type: 'string', default: 'Email', label: 'Email label' },\n phoneLabel: { type: 'string', default: 'Phone', label: 'Phone label' },\n documentLabel: { type: 'string', default: 'Document', label: 'Document label' },\n },\n guideline:\n 'Who the order is for, as the order recorded them at placement, never the live profile: name, email, phone and document as label/value rows, each left out when empty. Selects the customer through its own fragment, so a page without this block never fetches the customer. Shows the values as the order system returns them, masked included (e.g. \"J*** D***\"). Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedTotalsDefinition = defineComponent<OrderPlacedTotalsProps>({\n name: 'OrderPlacedTotals',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedTotals,\n requiresContext: 'order-placed',\n editor: { label: 'Order Placed Totals', category: 'commerce' },\n schema: {\n itemsLabel: { type: 'string', default: 'Subtotal', label: 'Items label' },\n shippingLabel: { type: 'string', default: 'Shipping', label: 'Shipping label' },\n discountsLabel: { type: 'string', default: 'Discounts', label: 'Discounts label' },\n taxLabel: { type: 'string', default: 'Tax', label: 'Tax label' },\n totalLabel: { type: 'string', default: 'Total', label: 'Total label' },\n shippingZeroLabel: { type: 'string', label: 'Shipping zero label' },\n },\n guideline:\n 'What the shopper was charged: each money line of the placed order in the order the API returns them (subtotal, discounts, shipping, tax, any custom tax under its own name), then the total, each in the order\\'s own currency. A zero discount line is left out; set shippingZeroLabel (e.g. \"Free\") to show it instead of a zero shipping value. No total row when the order has no total. Reads the order, never the cart, so it composes no CartTotalizerLine. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/** Placeholder for the order's blocks while the read is in flight. */\nexport function OrderPlacedRootSkeleton() {\n return (\n <div aria-hidden=\"true\" data-fs-order-placed-root-skeleton=\"\">\n <span />\n <span />\n <span />\n </div>\n );\n}\n\n/** Provides the placed order to its descendants, or a message in their place. Mirrors CartRoot's read side. */\nexport function OrderPlacedRoot({\n className,\n children,\n refusedOrderLabel = 'This order can no longer be shown here',\n unresolvedOrderLabel = 'Could not load this order',\n $data: $dataProp,\n}: Readonly<OrderPlacedRootProps>) {\n const order = useDataOverride($dataProp) ?? null;\n const { loading, error } = useContext(ReactiveRootContext);\n const value: OrderPlacedContextValue = useMemo(\n () => ({ order, loading, error: error ?? null }),\n [order, loading, error],\n );\n const state = resolveRootState(value);\n\n return (\n <OrderPlacedContext value={value}>\n <div className={className} data-fs-order-placed-root=\"\">\n {state === 'order' ? children : null}\n {state === 'loading' ? <OrderPlacedRootSkeleton /> : null}\n {state === 'refused' ? (\n <p role=\"alert\" data-fs-order-placed-root-refused=\"\">\n {refusedOrderLabel}\n </p>\n ) : null}\n {state === 'unresolved' ? (\n <p role=\"alert\" data-fs-order-placed-root-unresolved=\"\">\n {unresolvedOrderLabel}\n </p>\n ) : null}\n </div>\n </OrderPlacedContext>\n );\n}\n\nconst TONE_ATTRIBUTES = {\n approved: { 'data-fs-order-placed-status-approved': '' },\n pending: { 'data-fs-order-placed-status-pending': '' },\n denied: { 'data-fs-order-placed-status-denied': '' },\n} as const;\n\n/**\n * The outcome banner. `UNKNOWN` (seller orders that disagree, or a state the mapping does not\n * classify) renders nothing, so the page shows the order without asserting success or failure.\n */\nexport function OrderPlacedStatus({\n className,\n children,\n approvedTitle = 'Your order is confirmed',\n approvedMessage = 'Your payment was approved.',\n pendingTitle = \"We're confirming your payment\",\n pendingMessage = 'Your order was placed, and its payment is still being processed or reviewed.',\n deniedTitle = 'Your payment was not approved',\n deniedMessage = 'This purchase did not go through. You can place a new order with another payment method.',\n}: Readonly<OrderPlacedStatusProps>) {\n const { order } = useOrderPlaced();\n const status = order?.status;\n\n let copy: { tone: keyof typeof TONE_ATTRIBUTES; title?: string; message?: string };\n if (status === 'APPROVED') {\n copy = {\n tone: 'approved',\n title: approvedTitle,\n message: approvedMessage,\n };\n } else if (status === 'PENDING') {\n copy = {\n tone: 'pending',\n title: pendingTitle,\n message: pendingMessage,\n };\n } else if (status === 'DENIED') {\n copy = {\n tone: 'denied',\n title: deniedTitle,\n message: deniedMessage,\n };\n } else {\n return null;\n }\n\n return (\n <output className={className} data-fs-order-placed-status=\"\" {...TONE_ATTRIBUTES[copy.tone]}>\n {children}\n {copy.title?.trim() ? <span data-fs-order-placed-status-title=\"\">{copy.title}</span> : null}\n {copy.message?.trim() ? <span data-fs-order-placed-status-message=\"\">{copy.message}</span> : null}\n </output>\n );\n}\n\n/**\n * The order group, the one reference a split purchase has, so support resolves the whole purchase\n * from it rather than one seller's order.\n */\nexport function OrderPlacedReference({\n className,\n template = 'Order #{reference}',\n}: Readonly<OrderPlacedReferenceProps>) {\n const { order } = useOrderPlaced();\n if (!order) return null;\n return (\n <p className={className} data-fs-order-placed-reference=\"\">\n {substituteTemplate(template, { reference: order.reference })}\n </p>\n );\n}\n\ntype DefinitionRow = { key: string; term: string; value: string };\n\n/**\n * The customer as the order recorded them, never the live profile: masked values show as the order\n * system returns them, and an empty field is left out.\n */\nexport function OrderPlacedCustomer({\n className,\n nameLabel = 'Name',\n emailLabel = 'Email',\n phoneLabel = 'Phone',\n documentLabel = 'Document',\n $data: $dataProp,\n}: Readonly<OrderPlacedCustomerProps>) {\n // The call only enforces that the root is an ancestor; the root withholds its children until the\n // order resolves. The customer itself comes from this component's own fragment.\n useOrderPlaced();\n const customer = useDataOverride($dataProp)?.customer;\n if (!customer) return null;\n\n const name = [customer.firstName, customer.lastName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ');\n const rows: DefinitionRow[] = [\n { key: 'name', term: nameLabel, value: name },\n { key: 'email', term: emailLabel, value: customer.email ?? '' },\n { key: 'phone', term: phoneLabel, value: customer.phone ?? '' },\n { key: 'document', term: documentLabel, value: customer.document ?? '' },\n ].filter((row) => row.value.trim() !== '');\n if (rows.length === 0) return null;\n\n return (\n <dl className={className} data-fs-order-placed-customer=\"\">\n {rows.map(({ key, term, value }) => (\n <div key={key}>\n <dt data-fs-order-placed-customer-term=\"\">{term}</dt>\n <dd data-fs-order-placed-customer-value=\"\">{value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/**\n * The order's money lines in API order, then the total, each in its own currency. `Items`,\n * `Shipping`, `Discounts` and `Tax` take the authored label, since the order system names them in\n * English; any other line (a custom tax) shows its own name. The API sums lines on id and name, so\n * two custom taxes that share an id are two rows.\n */\nexport function OrderPlacedTotals({\n className,\n itemsLabel = 'Subtotal',\n shippingLabel = 'Shipping',\n discountsLabel = 'Discounts',\n taxLabel = 'Tax',\n totalLabel = 'Total',\n shippingZeroLabel,\n}: Readonly<OrderPlacedTotalsProps>) {\n const { order } = useOrderPlaced();\n const { locale } = useStorefrontContext();\n if (!order) return null;\n\n // A Map, so an upstream id such as \"constructor\" never resolves to an Object.prototype member.\n const labels = new Map([\n ['Items', itemsLabel],\n ['Shipping', shippingLabel],\n ['Discounts', discountsLabel],\n ['Tax', taxLabel],\n ]);\n const rows: (DefinitionRow & { line: string })[] = [];\n order.totals.forEach((line, index) => {\n if (line.id === 'Discounts' && isZero(line.value)) return;\n const value =\n line.id === 'Shipping' && isZero(line.value) && shippingZeroLabel?.trim()\n ? shippingZeroLabel\n : formatMoney(line.value, locale);\n rows.push({\n key: `${line.id}:${line.name}:${index}`,\n term: labels.get(line.id) ?? line.name,\n value,\n line: line.id,\n });\n });\n\n return (\n <dl className={className} data-fs-order-placed-totals=\"\">\n {rows.map(({ key, term, value, line }) => (\n <div key={key} data-fs-order-placed-totals-line={line}>\n <dt data-fs-order-placed-totals-term=\"\">{term}</dt>\n <dd data-fs-order-placed-totals-value=\"\">{value}</dd>\n </div>\n ))}\n {order.total ? (\n <div data-fs-order-placed-totals-total=\"\">\n <dt data-fs-order-placed-totals-term=\"\">{totalLabel}</dt>\n <dd data-fs-order-placed-totals-value=\"\">{formatMoney(order.total, locale)}</dd>\n </div>\n ) : null}\n </dl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAM,eAA6B;;;;;;;;;;;;;;;;;;;;;;AAuBnC,MAAM,mBAAiC;;;;;;;;;;;;;;;AA8GvC,MAAM,qBAAqB,OAAO,yBAAyB;AAE3D,MAAM,qBAAqB,cAAmE,kBAAkB;;AAGhH,SAAgB,iBAA0C;CACxD,MAAM,MAAM,WAAW,kBAAkB;CACzC,IAAI,QAAQ,oBACV,MAAM,IAAI,MAAM,oEAAoE;CAEtF,OAAO;AACT;;;;;;AAaA,SAAS,UAAU,OAAkC;CACnD,IAAI,CAAC,SAAS,CAAC,sB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AAA;GAAU,CAAA,CACjD;EAHK,GAAA,GAGL,CACN,GACA,MAAM,QACL,qBAAC,OAAD;GAAK,qCAAkC;GAAvC,UAAA,CACE,oBAAC,MAAD;IAAI,oCAAiC;IAAI,UAAA;GAAe,CAAA,GACxD,oBAAC,MAAD;IAAI,qCAAkC;IAAI,UAAA,YAAY,MAAM,OAAO,MAAM;GAAM,CAAA,CAC5E;EACH,CAAA,IAAA,IACF;;AAER"}
|
|
1
|
+
{"version":3,"file":"order-placed.js","names":[],"sources":["../../../src/matter/order-placed/order-placed.tsx"],"sourcesContent":["'use client';\n\nimport type { ErrorLike } from '@apollo/client';\nimport { CombinedGraphQLErrors } from '@apollo/client/errors';\nimport {\n type ContentValue,\n defineComponent,\n defineContentType,\n type MessageFieldName,\n type MessageLocaleProp,\n} from '@vtex/fs-core';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { useStorefrontContext } from '../../sdk/context/storefront-context.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { ReactiveRootContext } from '../../sdk/data/page-reactive-data-root.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\nimport { formatPrice } from '../cart/cart.js';\n\n/**\n * Order Placed matters (docs/features/order-placed/rfc-particles.md, Parts, part 2).\n * `OrderPlacedRoot` owns the placed order: it reads `Query.order(id: $orderId)` once through\n * its own fragment and provides it as the `order-placed` context, or shows an authored message in\n * place of its children when the read is refused or fails. The leaves read the order's own record,\n * never the live cart or profile, so a confirmation reopened later shows what the purchase carried.\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragments\n// ---------------------------------------------------------------------------\n\nconst rootFragment = /* GraphQL */ `\n fragment OrderPlacedRootData on Query {\n order(id: $orderId) {\n __typename\n id\n reference\n status\n total {\n amount\n currencyCode\n }\n totals {\n id\n name\n value {\n amount\n currencyCode\n }\n }\n }\n }\n`;\n\nconst customerFragment = /* GraphQL */ `\n fragment OrderPlacedCustomerData on Query {\n order(id: $orderId) {\n __typename\n id\n customer {\n firstName\n lastName\n email\n phone\n document\n }\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Content models. A message field is read only from `$content`.\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedRootContent = defineContentType({\n id: 'order-placed-root',\n title: 'Order Placed Root',\n description: 'Messages shown in place of the order when it cannot be shown.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n refusedOrderLabel: {\n type: 'string',\n title: 'Refused order',\n description: 'Shown when the read is refused: after 15 minutes, or from another browser.',\n format: 'icu-message',\n messageSource: 'This order can no longer be shown here',\n },\n unresolvedOrderLabel: {\n type: 'string',\n title: 'Unresolved order',\n description: 'Shown when the read fails or the order group resolves to no order.',\n format: 'icu-message',\n messageSource: 'Could not load this order',\n },\n },\n },\n});\n\nexport const OrderPlacedStatusContent = defineContentType({\n id: 'order-placed-status',\n title: 'Order Placed Status',\n description: 'Title and message of each payment outcome.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n approvedTitle: {\n type: 'string',\n title: 'Approved title',\n format: 'icu-message',\n messageSource: 'Your order is confirmed',\n },\n approvedMessage: {\n type: 'string',\n title: 'Approved message',\n format: 'icu-message',\n messageSource: 'Your payment was approved.',\n },\n pendingTitle: {\n type: 'string',\n title: 'Pending title',\n format: 'icu-message',\n messageSource: \"We're confirming your payment\",\n },\n pendingMessage: {\n type: 'string',\n title: 'Pending message',\n format: 'icu-message',\n messageSource: 'Your order was placed, and its payment is still being processed or reviewed.',\n },\n deniedTitle: {\n type: 'string',\n title: 'Denied title',\n format: 'icu-message',\n messageSource: 'Your payment was not approved',\n },\n deniedMessage: {\n type: 'string',\n title: 'Denied message',\n format: 'icu-message',\n messageSource: 'This purchase did not go through. You can place a new order with another payment method.',\n },\n },\n },\n});\n\nexport const OrderPlacedReferenceContent = defineContentType({\n id: 'order-placed-reference',\n title: 'Order Placed Reference',\n description: 'Text of the order number.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n template: {\n type: 'string',\n title: 'Reference text',\n description: '`reference` is the order group.',\n format: 'icu-message',\n messageSource: 'Order #{reference}',\n messageArguments: { type: 'object', properties: { reference: { type: 'string' } } },\n messageExample: { reference: '1335290583288' },\n },\n },\n },\n});\n\nexport const OrderPlacedCustomerContent = defineContentType({\n id: 'order-placed-customer',\n title: 'Order Placed Customer',\n description: 'Labels of the customer rows.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n nameLabel: { type: 'string', title: 'Name label', format: 'icu-message', messageSource: 'Name' },\n emailLabel: { type: 'string', title: 'Email label', format: 'icu-message', messageSource: 'Email' },\n phoneLabel: { type: 'string', title: 'Phone label', format: 'icu-message', messageSource: 'Phone' },\n documentLabel: { type: 'string', title: 'Document label', format: 'icu-message', messageSource: 'Document' },\n },\n },\n});\n\nexport const OrderPlacedTotalsContent = defineContentType({\n id: 'order-placed-totals',\n title: 'Order Placed Totals',\n description: 'Labels of the money lines and the total.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n itemsLabel: { type: 'string', title: 'Items label', format: 'icu-message', messageSource: 'Subtotal' },\n shippingLabel: { type: 'string', title: 'Shipping label', format: 'icu-message', messageSource: 'Shipping' },\n discountsLabel: { type: 'string', title: 'Discounts label', format: 'icu-message', messageSource: 'Discounts' },\n taxLabel: { type: 'string', title: 'Tax label', format: 'icu-message', messageSource: 'Tax' },\n totalLabel: { type: 'string', title: 'Total label', format: 'icu-message', messageSource: 'Total' },\n },\n },\n});\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** `amount` is the API's `Decimal`, a string (\"12.50\"). */\nexport type OrderPlacedMoney = { amount: string; currencyCode: string };\n\nexport type OrderPlacedStatusValue = 'APPROVED' | 'PENDING' | 'DENIED' | 'UNKNOWN';\n\nexport type OrderPlacedTotalLine = { id: string; name: string; value: OrderPlacedMoney };\n\n/**\n * The `$data` slice forwarded by the reactive runtime: the unwrapped `order` field, never a\n * `{ order: … }` wrapper (ADR-0015). `null` when the order group does not resolve.\n */\nexport type OrderPlacedData = {\n id: string;\n reference: string;\n status: OrderPlacedStatusValue;\n total?: OrderPlacedMoney | null;\n totals: readonly OrderPlacedTotalLine[];\n} | null;\n\n/** `OrderPlacedCustomer`'s own `$data` slice, the unwrapped `order` field of its fragment. */\nexport type OrderPlacedCustomerData = {\n customer?: {\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n phone?: string | null;\n document?: string | null;\n } | null;\n} | null;\n\nexport type OrderPlacedContextValue = Readonly<{\n order: OrderPlacedData;\n loading: boolean;\n error: ErrorLike | null;\n}>;\n\nexport type OrderPlacedRootProps = MessageLocaleProp & {\n className?: string;\n children?: ReactNode;\n /** The messages shown in place of the order when it is refused or does not resolve. */\n $content?: ContentValue<typeof OrderPlacedRootContent>;\n /** Unwrapped `Order` slice forwarded by the reactive runtime. */\n $data?: OrderPlacedData;\n};\n\nexport type OrderPlacedStatusProps = MessageLocaleProp & {\n className?: string;\n /** An optional `Icon`, shown on every outcome. */\n children?: ReactNode;\n /** The title and message of each outcome. */\n $content?: ContentValue<typeof OrderPlacedStatusContent>;\n};\n\nexport type OrderPlacedReferenceProps = MessageLocaleProp & {\n className?: string;\n /** The order number text, with a `reference` argument. */\n $content?: ContentValue<typeof OrderPlacedReferenceContent>;\n};\n\nexport type OrderPlacedCustomerProps = MessageLocaleProp & {\n className?: string;\n /** The row labels. */\n $content?: ContentValue<typeof OrderPlacedCustomerContent>;\n /** Unwrapped `Order` slice of this component's own fragment. */\n $data?: OrderPlacedCustomerData;\n};\n\nexport type OrderPlacedTotalsProps = MessageLocaleProp & {\n className?: string;\n /** Shown instead of a zero shipping value. Omitted to show the formatted zero. */\n shippingZeroLabel?: string;\n /** The line labels and the total label. */\n $content?: ContentValue<typeof OrderPlacedTotalsContent>;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ORDER_PLACED_UNSET = Symbol('OrderPlacedContextUnset');\n\nconst OrderPlacedContext = createContext<OrderPlacedContextValue | typeof ORDER_PLACED_UNSET>(ORDER_PLACED_UNSET);\n\n/** The placed order, its loading flag and the root query's error, from the nearest OrderPlacedRoot. */\nexport function useOrderPlaced(): OrderPlacedContextValue {\n const ctx = useContext(OrderPlacedContext);\n if (ctx === ORDER_PLACED_UNSET) {\n throw new Error('useOrderPlaced() must be used inside an <OrderPlacedRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Resolution\n// ---------------------------------------------------------------------------\n\ntype RootState = 'refused' | 'loading' | 'unresolved' | 'order';\n\n/**\n * The API refuses the read with a top-level `UNAUTHORIZED`: without both checkout cookies, and when\n * the order system answers 401 or 403, as it does after 15 minutes. Under `errorPolicy: 'all'` the\n * refusal also carries `order: null`, so it is checked before the order is.\n */\nfunction isRefusal(error: ErrorLike | null): boolean {\n if (!error || !CombinedGraphQLErrors.is(error)) return false;\n return error.errors.some((graphQLError) => graphQLError.extensions?.code === 'UNAUTHORIZED');\n}\n\nfunction resolveRootState({ order, loading, error }: OrderPlacedContextValue): RootState {\n if (isRefusal(error)) return 'refused';\n if (loading && order == null) return 'loading';\n if (order == null) return 'unresolved';\n return 'order';\n}\n\nfunction isZero(money: OrderPlacedMoney): boolean {\n return Number(money.amount) === 0;\n}\n\nfunction formatMoney(money: OrderPlacedMoney, locale: string): string {\n return formatPrice(Number(money.amount), locale, money.currencyCode);\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const OrderPlacedRootDefinition = defineComponent<OrderPlacedRootProps>({\n name: 'OrderPlacedRoot',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedRoot,\n fragment: rootFragment,\n fetchStrategy: 'reactive',\n skeleton: OrderPlacedRootSkeleton,\n providesContext: 'order-placed',\n content: OrderPlacedRootContent,\n editor: { label: 'Order Placed Root', category: 'commerce' },\n schema: {},\n guideline:\n 'Owner of an order confirmation page: reads the placed order (Query.order, keyed on the order Node id from the route) once and provides it as the order-placed context to OrderPlacedStatus, OrderPlacedReference, OrderPlacedCustomer, OrderPlacedTotals and the other order-placed blocks composed as its children. Renders its children only once the order resolves. While the read is in flight it shows a skeleton; when the API refuses the read (after 15 minutes, or from another browser) it shows the $content message refusedOrderLabel; when the read fails or the order group resolves to no order it shows unresolvedOrderLabel. Each message replaces every child. Never reads the cart or the live profile. See order-placed.md.',\n});\n\nexport const OrderPlacedStatusDefinition = defineComponent<OrderPlacedStatusProps>({\n name: 'OrderPlacedStatus',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedStatus,\n requiresContext: 'order-placed',\n content: OrderPlacedStatusContent,\n editor: { label: 'Order Placed Status', category: 'commerce' },\n schema: {},\n guideline:\n 'The payment outcome of the placed order, as a banner with a title and a message: approved, pending (which also covers a payment under anti-fraud review) or denied. Renders nothing when the outcome is unknown, so the page shows the order without asserting success or failure. The title and message of each outcome are $content messages (approvedTitle, approvedMessage, pendingTitle, pendingMessage, deniedTitle, deniedMessage); an unauthored one omits its line and logs. Marks the outcome with data-fs-order-placed-status-approved, -pending or -denied, so the page styles each tone. An Icon composed as its child shows on every outcome, so never compose one that implies success. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedReferenceDefinition = defineComponent<OrderPlacedReferenceProps>({\n name: 'OrderPlacedReference',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedReference,\n requiresContext: 'order-placed',\n content: OrderPlacedReferenceContent,\n editor: { label: 'Order Placed Reference', category: 'commerce' },\n schema: {},\n guideline:\n 'The order number the shopper gives support: the order group, one per purchase even when it was split across sellers. Its $content field template is an ICU message with a reference argument (e.g. \"Order #{reference}\"). Plain text, so it can be selected and copied. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedCustomerDefinition = defineComponent<OrderPlacedCustomerProps>({\n name: 'OrderPlacedCustomer',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedCustomer,\n fragment: customerFragment,\n fetchStrategy: 'reactive',\n requiresContext: 'order-placed',\n content: OrderPlacedCustomerContent,\n editor: { label: 'Order Placed Customer', category: 'commerce' },\n schema: {},\n guideline:\n 'Who the order is for, as the order recorded them at placement, never the live profile: name, email, phone and document as label/value rows, each left out when empty; the labels are $content messages. Selects the customer through its own fragment, so a page without this block never fetches the customer. Shows the values as the order system returns them, masked included (e.g. \"J*** D***\"). Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\nexport const OrderPlacedTotalsDefinition = defineComponent<OrderPlacedTotalsProps>({\n name: 'OrderPlacedTotals',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedTotals,\n requiresContext: 'order-placed',\n content: OrderPlacedTotalsContent,\n editor: { label: 'Order Placed Totals', category: 'commerce' },\n schema: {\n shippingZeroLabel: { type: 'string', label: 'Shipping zero label' },\n },\n guideline:\n 'What the shopper was charged: each money line of the placed order in the order the API returns them (subtotal, discounts, shipping, tax, any custom tax under its own name), then the total, each in the order\\'s own currency. The line labels are $content messages (itemsLabel, shippingLabel, discountsLabel, taxLabel, totalLabel). A zero discount line is left out; set shippingZeroLabel (e.g. \"Free\") to show it instead of a zero shipping value. No total row when the order has no total. Reads the order, never the cart, so it composes no CartTotalizerLine. Must be inside OrderPlacedRoot. See order-placed.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/** Placeholder for the order's blocks while the read is in flight. */\nexport function OrderPlacedRootSkeleton() {\n return (\n <div aria-hidden=\"true\" data-fs-order-placed-root-skeleton=\"\">\n <span />\n <span />\n <span />\n </div>\n );\n}\n\n/** Provides the placed order to its descendants, or a message in their place. Mirrors CartRoot's read side. */\nexport function OrderPlacedRoot({\n className,\n children,\n $content,\n $locale,\n $data: $dataProp,\n}: Readonly<OrderPlacedRootProps>) {\n const { format } = useMessageFormatter(OrderPlacedRootContent, $content);\n const order = useDataOverride($dataProp) ?? null;\n const { loading, error } = useContext(ReactiveRootContext);\n const value: OrderPlacedContextValue = useMemo(\n () => ({ order, loading, error: error ?? null }),\n [order, loading, error],\n );\n const state = resolveRootState(value);\n\n return (\n <OrderPlacedContext value={value}>\n <div className={className} data-fs-order-placed-root=\"\">\n {state === 'order' ? children : null}\n {state === 'loading' ? <OrderPlacedRootSkeleton /> : null}\n {state === 'refused' ? (\n <p role=\"alert\" data-fs-order-placed-root-refused=\"\">\n {format('refusedOrderLabel')}\n </p>\n ) : null}\n {state === 'unresolved' ? (\n <p role=\"alert\" data-fs-order-placed-root-unresolved=\"\">\n {format('unresolvedOrderLabel')}\n </p>\n ) : null}\n </div>\n </OrderPlacedContext>\n );\n}\n\nconst TONE_ATTRIBUTES = {\n approved: { 'data-fs-order-placed-status-approved': '' },\n pending: { 'data-fs-order-placed-status-pending': '' },\n denied: { 'data-fs-order-placed-status-denied': '' },\n} as const;\n\n/**\n * The outcome banner. `UNKNOWN` (seller orders that disagree, or a state the mapping does not\n * classify) renders nothing, so the page shows the order without asserting success or failure.\n */\nexport function OrderPlacedStatus({ className, children, $content, $locale }: Readonly<OrderPlacedStatusProps>) {\n const { order } = useOrderPlaced();\n const { format } = useMessageFormatter(OrderPlacedStatusContent, $content);\n const status = order?.status;\n\n let copy: { tone: keyof typeof TONE_ATTRIBUTES; title: string; message: string };\n if (status === 'APPROVED') {\n copy = { tone: 'approved', title: format('approvedTitle'), message: format('approvedMessage') };\n } else if (status === 'PENDING') {\n copy = { tone: 'pending', title: format('pendingTitle'), message: format('pendingMessage') };\n } else if (status === 'DENIED') {\n copy = { tone: 'denied', title: format('deniedTitle'), message: format('deniedMessage') };\n } else {\n return null;\n }\n\n return (\n <output className={className} data-fs-order-placed-status=\"\" {...TONE_ATTRIBUTES[copy.tone]}>\n {children}\n {copy.title.trim() ? <span data-fs-order-placed-status-title=\"\">{copy.title}</span> : null}\n {copy.message.trim() ? <span data-fs-order-placed-status-message=\"\">{copy.message}</span> : null}\n </output>\n );\n}\n\n/**\n * The order group, the one reference a split purchase has, so support resolves the whole purchase\n * from it rather than one seller's order.\n */\nexport function OrderPlacedReference({ className, $content, $locale }: Readonly<OrderPlacedReferenceProps>) {\n const { order } = useOrderPlaced();\n const { format } = useMessageFormatter(OrderPlacedReferenceContent, $content);\n if (!order) return null;\n return (\n <p className={className} data-fs-order-placed-reference=\"\">\n {format('template', { reference: order.reference })}\n </p>\n );\n}\n\ntype DefinitionRow = { key: string; term: string; value: string };\n\n/**\n * The customer as the order recorded them, never the live profile: masked values show as the order\n * system returns them, and an empty field is left out.\n */\nexport function OrderPlacedCustomer({\n className,\n $content,\n $locale,\n $data: $dataProp,\n}: Readonly<OrderPlacedCustomerProps>) {\n // The call only enforces that the root is an ancestor; the root withholds its children until the\n // order resolves. The customer itself comes from this component's own fragment.\n useOrderPlaced();\n const { format } = useMessageFormatter(OrderPlacedCustomerContent, $content);\n const customer = useDataOverride($dataProp)?.customer;\n if (!customer) return null;\n\n const name = [customer.firstName, customer.lastName]\n .map((part) => part?.trim())\n .filter(Boolean)\n .join(' ');\n const rows: DefinitionRow[] = (\n [\n { key: 'name', field: 'nameLabel', value: name },\n { key: 'email', field: 'emailLabel', value: customer.email ?? '' },\n { key: 'phone', field: 'phoneLabel', value: customer.phone ?? '' },\n { key: 'document', field: 'documentLabel', value: customer.document ?? '' },\n ] as const\n )\n .filter((row) => row.value.trim() !== '')\n .map(({ key, field, value }) => ({ key, term: format(field), value }));\n if (rows.length === 0) return null;\n\n return (\n <dl className={className} data-fs-order-placed-customer=\"\">\n {rows.map(({ key, term, value }) => (\n <div key={key}>\n <dt data-fs-order-placed-customer-term=\"\">{term}</dt>\n <dd data-fs-order-placed-customer-value=\"\">{value}</dd>\n </div>\n ))}\n </dl>\n );\n}\n\n/**\n * The order's money lines in API order, then the total, each in its own currency. `Items`,\n * `Shipping`, `Discounts` and `Tax` take the authored label, since the order system names them in\n * English; any other line (a custom tax) shows its own name. The API sums lines on id and name, so\n * two custom taxes that share an id are two rows.\n */\nexport function OrderPlacedTotals({\n className,\n shippingZeroLabel,\n $content,\n $locale,\n}: Readonly<OrderPlacedTotalsProps>) {\n const { order } = useOrderPlaced();\n const { locale } = useStorefrontContext();\n const { format } = useMessageFormatter(OrderPlacedTotalsContent, $content);\n if (!order) return null;\n\n // A Map, so an upstream id such as \"constructor\" never resolves to an Object.prototype member.\n const labels = new Map<string, MessageFieldName<typeof OrderPlacedTotalsContent>>([\n ['Items', 'itemsLabel'],\n ['Shipping', 'shippingLabel'],\n ['Discounts', 'discountsLabel'],\n ['Tax', 'taxLabel'],\n ]);\n const rows: (DefinitionRow & { line: string })[] = [];\n order.totals.forEach((line, index) => {\n if (line.id === 'Discounts' && isZero(line.value)) return;\n const value =\n line.id === 'Shipping' && isZero(line.value) && shippingZeroLabel?.trim()\n ? shippingZeroLabel\n : formatMoney(line.value, locale);\n const field = labels.get(line.id);\n rows.push({\n key: `${line.id}:${line.name}:${index}`,\n term: field ? format(field) : line.name,\n value,\n line: line.id,\n });\n });\n\n return (\n <dl className={className} data-fs-order-placed-totals=\"\">\n {rows.map(({ key, term, value, line }) => (\n <div key={key} data-fs-order-placed-totals-line={line}>\n <dt data-fs-order-placed-totals-term=\"\">{term}</dt>\n <dd data-fs-order-placed-totals-value=\"\">{value}</dd>\n </div>\n ))}\n {order.total ? (\n <div data-fs-order-placed-totals-total=\"\">\n <dt data-fs-order-placed-totals-term=\"\">{format('totalLabel')}</dt>\n <dd data-fs-order-placed-totals-value=\"\">{formatMoney(order.total, locale)}</dd>\n </div>\n ) : null}\n </dl>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,eAA6B;;;;;;;;;;;;;;;;;;;;;;AAuBnC,MAAM,mBAAiC;;;;;;;;;;;;;;;AAoBvC,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY;GACV,mBAAmB;IACjB,MAAM;IACN,OAAO;IACP,aAAa;IACb,QAAQ;IACR,eAAe;GACjB;GACA,sBAAsB;IACpB,MAAM;IACN,OAAO;IACP,aAAa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KAAK,EAAE,KAAK,MAAM,OAAO,WAC7B,qBAAC,OAAD;GAAe,oCAAkC;GAAjD,UAAA,CACE,oBAAC,MAAD;IAAI,oCAAiC;IAAI,UAAA;GAAS,CAAA,GAClD,oBAAC,MAAD;IAAI,qCAAkC;IAAI,UAAA;GAAU,CAAA,CACjD;EAHK,GAAA,GAGL,CACN,GACA,MAAM,QACL,qBAAC,OAAD;GAAK,qCAAkC;GAAvC,UAAA,CACE,oBAAC,MAAD;IAAI,oCAAiC;IAAI,UAAA,OAAO,YAAY;GAAM,CAAA,GAClE,oBAAC,MAAD;IAAI,qCAAkC;IAAI,UAAA,YAAY,MAAM,OAAO,MAAM;GAAM,CAAA,CAC5E;EACH,CAAA,IAAA,IACF;;AAER"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentValue } from "../../core/dist/define-content-type.js";
|
|
1
|
+
import { ContentValue, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
2
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
3
3
|
import "../../core/dist/index.js";
|
|
4
4
|
import { ComponentPropsWithRef, Ref } from "react";
|
|
@@ -14,6 +14,8 @@ export declare const OrderPlacedDateContent: {
|
|
|
14
14
|
readonly label: {
|
|
15
15
|
readonly type: "string";
|
|
16
16
|
readonly title: "Label";
|
|
17
|
+
readonly format: "icu-message";
|
|
18
|
+
readonly messageSource: "Order placed";
|
|
17
19
|
};
|
|
18
20
|
};
|
|
19
21
|
};
|
|
@@ -27,18 +29,13 @@ export type OrderPlacedDateData = {
|
|
|
27
29
|
id: string;
|
|
28
30
|
placedAt: string | null;
|
|
29
31
|
} | null;
|
|
30
|
-
export type OrderPlacedDateProps = Readonly<{
|
|
32
|
+
export type OrderPlacedDateProps = MessageLocaleProp & Readonly<{
|
|
31
33
|
$data?: OrderPlacedDateData | null;
|
|
32
34
|
$content?: OrderPlacedDateContentValue;
|
|
33
35
|
className?: string;
|
|
34
36
|
ref?: Ref<HTMLDivElement>;
|
|
35
37
|
}>;
|
|
36
|
-
export declare const OrderPlacedDateDefinition: ComponentDefinition<
|
|
37
|
-
$data?: OrderPlacedDateData | null;
|
|
38
|
-
$content?: OrderPlacedDateContentValue;
|
|
39
|
-
className?: string;
|
|
40
|
-
ref?: Ref<HTMLDivElement>;
|
|
41
|
-
}>>;
|
|
38
|
+
export declare const OrderPlacedDateDefinition: ComponentDefinition<OrderPlacedDateProps>;
|
|
42
39
|
export declare function OrderPlacedDateSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
43
40
|
export declare function OrderPlacedDate({ $data, $content, className, ref }: OrderPlacedDateProps): import("react/jsx-runtime").JSX.Element | null;
|
|
44
41
|
//#endregion
|
|
@@ -3,7 +3,7 @@ import { defineComponent } from "../../core/dist/define-component.js";
|
|
|
3
3
|
import { defineContentType } from "../../core/dist/define-content-type.js";
|
|
4
4
|
import "../../core/dist/index.js";
|
|
5
5
|
import { useStorefrontFormatters } from "../../sdk/format/client.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/matter/order-placed-date/order-placed-date.tsx
|
|
9
9
|
const fragment = `
|
|
@@ -23,7 +23,9 @@ const OrderPlacedDateContent = defineContentType({
|
|
|
23
23
|
additionalProperties: false,
|
|
24
24
|
properties: { label: {
|
|
25
25
|
type: "string",
|
|
26
|
-
title: "Label"
|
|
26
|
+
title: "Label",
|
|
27
|
+
format: "icu-message",
|
|
28
|
+
messageSource: "Order placed"
|
|
27
29
|
} }
|
|
28
30
|
}
|
|
29
31
|
});
|
|
@@ -40,11 +42,8 @@ const OrderPlacedDateDefinition = defineComponent({
|
|
|
40
42
|
category: "content"
|
|
41
43
|
},
|
|
42
44
|
schema: {},
|
|
43
|
-
guideline: "The date and time one order was placed, formatted for the page locale. The label is content
|
|
45
|
+
guideline: "The date and time one order was placed, formatted for the page locale. The label is content. Place it anywhere on the order details page; it renders nothing when the order has no placed date."
|
|
44
46
|
});
|
|
45
|
-
function authored(value, fallback) {
|
|
46
|
-
return value?.trim() || fallback;
|
|
47
|
-
}
|
|
48
47
|
const PLACED_FORMAT = {
|
|
49
48
|
year: "numeric",
|
|
50
49
|
month: "numeric",
|
|
@@ -67,7 +66,7 @@ function OrderPlacedDateSkeleton({ className, ...props }) {
|
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
68
|
function OrderPlacedDate({ $data, $content, className, ref }) {
|
|
70
|
-
const
|
|
69
|
+
const { format } = useMessageFormatter(OrderPlacedDateContent, $content);
|
|
71
70
|
const { formatDate } = useStorefrontFormatters();
|
|
72
71
|
const placedAt = $data?.placedAt;
|
|
73
72
|
const placed = instant(placedAt);
|
|
@@ -78,7 +77,7 @@ function OrderPlacedDate({ $data, $content, className, ref }) {
|
|
|
78
77
|
"data-fs-order-placed-date": "",
|
|
79
78
|
children: [/* @__PURE__ */ jsx("span", {
|
|
80
79
|
"data-fs-order-placed-date-label": "",
|
|
81
|
-
children:
|
|
80
|
+
children: format("label")
|
|
82
81
|
}), /* @__PURE__ */ jsx("time", {
|
|
83
82
|
dateTime: placedAt ?? void 0,
|
|
84
83
|
"data-fs-order-placed-date-value": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-placed-date.js","names":[],"sources":["../../../src/matter/order-placed-date/order-placed-date.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, Ref } from 'react';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport {
|
|
1
|
+
{"version":3,"file":"order-placed-date.js","names":[],"sources":["../../../src/matter/order-placed-date/order-placed-date.tsx"],"sourcesContent":["'use client';\n\nimport { type ContentValue, defineComponent, defineContentType, type MessageLocaleProp } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, Ref } from 'react';\nimport { useStorefrontFormatters } from '../../sdk/format/client.js';\nimport { useMessageFormatter } from '../../sdk/i18n/use-message-formatter.js';\n\nconst fragment = /* GraphQL */ `\n fragment OrderPlacedDateData on Query {\n customerOrder(id: $orderId) {\n id\n placedAt\n }\n }\n`;\n\nexport const OrderPlacedDateContent = defineContentType({\n id: 'order-placed-date',\n title: 'Order Placed Date',\n description: 'The label beside the date the order was placed.',\n schema: {\n type: 'object',\n additionalProperties: false,\n properties: {\n label: { type: 'string', title: 'Label', format: 'icu-message', messageSource: 'Order placed' },\n },\n },\n});\n\nexport type OrderPlacedDateContentValue = ContentValue<typeof OrderPlacedDateContent>;\n\n/**\n * The `customerOrder` root the generator passes as `$data`. A single-root fragment is bound to\n * that field's value, so this is the order itself, or null when the read resolves nothing.\n */\nexport type OrderPlacedDateData = {\n id: string;\n placedAt: string | null;\n} | null;\n\nexport type OrderPlacedDateProps = MessageLocaleProp &\n Readonly<{\n $data?: OrderPlacedDateData | null;\n $content?: OrderPlacedDateContentValue;\n className?: string;\n ref?: Ref<HTMLDivElement>;\n }>;\n\nexport const OrderPlacedDateDefinition = defineComponent<OrderPlacedDateProps>({\n name: 'OrderPlacedDate',\n importPath: '@vtex/faststore/components',\n component: OrderPlacedDate,\n content: OrderPlacedDateContent,\n fragment,\n fetchStrategy: 'static',\n skeleton: OrderPlacedDateSkeleton,\n editor: { label: 'Order Placed Date', category: 'content' },\n schema: {},\n guideline:\n 'The date and time one order was placed, formatted for the page locale. The label is content. Place it anywhere on the order details page; it renders nothing when the order has no placed date.',\n});\n\nconst PLACED_FORMAT: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: 'numeric',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n};\n\nfunction instant(value: string | null | undefined): Date | null {\n if (!value) {\n return null;\n }\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nexport function OrderPlacedDateSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} data-fs-order-placed-date-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-order-placed-date-skeleton-fact=\"\" />\n <span data-fs-order-placed-date-skeleton-fact=\"\" />\n </div>\n );\n}\n\nexport function OrderPlacedDate({ $data, $content, className, ref }: OrderPlacedDateProps) {\n const { format } = useMessageFormatter(OrderPlacedDateContent, $content);\n const { formatDate } = useStorefrontFormatters();\n const placedAt = $data?.placedAt;\n const placed = instant(placedAt);\n\n if (!placed) {\n return null;\n }\n\n return (\n <div ref={ref} className={className} data-fs-order-placed-date=\"\">\n <span data-fs-order-placed-date-label=\"\">{format('label')}</span>\n <time dateTime={placedAt ?? undefined} data-fs-order-placed-date-value=\"\">\n {formatDate(placed, PLACED_FORMAT)}\n </time>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAOA,MAAM,WAAyB;;;;;;;;AAS/B,MAAa,yBAAyB,kBAAkB;CACtD,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;EACN,MAAM;EACN,sBAAsB;EACtB,YAAY,EACV,OAAO;GAAE,MAAM;GAAU,OAAO;GAAS,QAAQ;GAAe,eAAe;EAAe,EAChG;CACF;AACF,CAAC;AAqBD,MAAa,4BAA4B,gBAAsC;CAC7E,MAAM;CACN,YAAY;CACZ,WAAW;CACX,SAAS;CACT;CACA,eAAe;CACf,UAAU;CACV,QAAQ;EAAE,OAAO;EAAqB,UAAU;CAAU;CAC1D,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAM,gBAA4C;CAChD,MAAM;CACN,OAAO;CACP,KAAK;CACL,MAAM;CACN,QAAQ;AACV;AAEA,SAAS,QAAQ,OAA+C;CAC9D,IAAI,CAAC,OACH,OAAO;CAET,MAAM,OAAO,IAAI,KAAK,KAAK;CAC3B,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,IAAI,OAAO;AAC/C;AAEA,SAAgB,wBAAwB,EAAE,WAAW,GAAG,SAAuC;CAC7F,OACE,qBAAC,OAAD;EAAK,GAAI;EAAkB;EAAW,sCAAmC;EAAG,eAAY;EAAxF,UAAA,CACE,oBAAC,QAAD,EAAM,2CAAwC,GAAI,CAAA,GAClD,oBAAC,QAAD,EAAM,2CAAwC,GAAI,CAAA,CAC/C;;AAET;AAEA,SAAgB,gBAAgB,EAAE,OAAO,UAAU,WAAW,OAA6B;CACzF,MAAM,EAAE,WAAW,oBAAoB,wBAAwB,QAAQ;CACvE,MAAM,EAAE,eAAe,wBAAwB;CAC/C,MAAM,WAAW,OAAO;CACxB,MAAM,SAAS,QAAQ,QAAQ;CAE/B,IAAI,CAAC,QACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAU;EAAgB;EAAW,6BAA0B;EAA/D,UAAA,CACE,oBAAC,QAAD;GAAM,mCAAgC;GAAI,UAAA,OAAO,OAAO;EAAQ,CAAA,GAChE,oBAAC,QAAD;GAAM,UAAU,YAAY,KAAA;GAAW,mCAAgC;GACpE,UAAA,WAAW,QAAQ,aAAa;EAC7B,CAAA,CACH;;AAET"}
|
|
@@ -1,6 +1,90 @@
|
|
|
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
|
//#region src/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts
|
|
5
|
+
export declare const OrderPlacedPaymentSummaryContent: {
|
|
6
|
+
readonly id: "order-placed-payment-summary";
|
|
7
|
+
readonly title: "Order Placed Payment Summary";
|
|
8
|
+
readonly description: "Copy of the payment recap on the order confirmation.";
|
|
9
|
+
readonly schema: {
|
|
10
|
+
readonly type: "object";
|
|
11
|
+
readonly additionalProperties: false;
|
|
12
|
+
readonly properties: {
|
|
13
|
+
readonly lastFourTemplate: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly title: "Last four";
|
|
16
|
+
readonly description: "Rendered only when the last four digits resolve.";
|
|
17
|
+
readonly format: "icu-message";
|
|
18
|
+
readonly messageSource: "•••• {lastFour}";
|
|
19
|
+
readonly messageArguments: {
|
|
20
|
+
readonly type: "object";
|
|
21
|
+
readonly properties: {
|
|
22
|
+
readonly lastFour: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly messageExample: {
|
|
28
|
+
readonly lastFour: "4242";
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly noPaymentRecordLabel: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly title: "No payment record";
|
|
34
|
+
readonly description: "Shown when the order resolves but carries no projectable payment record.";
|
|
35
|
+
readonly format: "icu-message";
|
|
36
|
+
readonly messageSource: "Payment method not available";
|
|
37
|
+
};
|
|
38
|
+
readonly unresolvedOrderLabel: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
readonly title: "Unresolved order";
|
|
41
|
+
readonly description: "Shown when the order group does not resolve to a settled order.";
|
|
42
|
+
readonly format: "icu-message";
|
|
43
|
+
readonly messageSource: "Could not load the payment details";
|
|
44
|
+
};
|
|
45
|
+
readonly installmentTemplate: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly title: "Installment";
|
|
48
|
+
readonly description: "`total` is the formatted settled payment, never a per-installment amount, which is why the source says \"total\" instead of \"of\".";
|
|
49
|
+
readonly format: "icu-message";
|
|
50
|
+
readonly messageSource: "{count}x total {total}";
|
|
51
|
+
readonly messageArguments: {
|
|
52
|
+
readonly type: "object";
|
|
53
|
+
readonly properties: {
|
|
54
|
+
readonly count: {
|
|
55
|
+
readonly type: "integer";
|
|
56
|
+
};
|
|
57
|
+
readonly total: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly messageExample: {
|
|
63
|
+
readonly count: 3;
|
|
64
|
+
readonly total: "R$ 600,00";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly installmentCountTemplate: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
readonly title: "Installment count";
|
|
70
|
+
readonly description: "Rendered instead of the installment message when the settled record has no total.";
|
|
71
|
+
readonly format: "icu-message";
|
|
72
|
+
readonly messageSource: "{count}x";
|
|
73
|
+
readonly messageArguments: {
|
|
74
|
+
readonly type: "object";
|
|
75
|
+
readonly properties: {
|
|
76
|
+
readonly count: {
|
|
77
|
+
readonly type: "integer";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly messageExample: {
|
|
82
|
+
readonly count: 3;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
4
88
|
/**
|
|
5
89
|
* The installment plan the order was charged in (T33, specs/settle-and-project-the-placed-
|
|
6
90
|
* order.md). Null when the settled record reports none — never fabricated, never defaulted to
|
|
@@ -22,27 +106,16 @@ export type OrderPlacedInstallment = {
|
|
|
22
106
|
* when the order group does not resolve to a settled order.
|
|
23
107
|
*/
|
|
24
108
|
export type OrderPlacedPaymentSummaryData = {
|
|
109
|
+
/** The order group. Compared with the carried last four's own order group, never rendered. */
|
|
110
|
+
reference?: string | null;
|
|
25
111
|
network?: string | null;
|
|
26
112
|
lastFourDigits?: string | null;
|
|
27
113
|
installment?: OrderPlacedInstallment;
|
|
28
114
|
} | null;
|
|
29
|
-
export type OrderPlacedPaymentSummaryProps = {
|
|
115
|
+
export type OrderPlacedPaymentSummaryProps = MessageLocaleProp & {
|
|
30
116
|
className?: string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** Shown when the order resolves but carries no projectable payment record. */
|
|
34
|
-
noPaymentRecordLabel?: string;
|
|
35
|
-
/** Shown when the order group does not resolve to a settled order. */
|
|
36
|
-
unresolvedOrderLabel?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Rendered only when `installment` resolves; `{count}`/`{total}` placeholders. When the source
|
|
39
|
-
* carries the count but not enough to build a total from (US-2 — never a fabricated per-installment
|
|
40
|
-
* amount), `{total}` is dropped together with everything between `{count}`'s own glued suffix (if
|
|
41
|
-
* any) and `{total}` — but a run glued directly to `{count}`, with no whitespace, is a suffix of the
|
|
42
|
-
* count, not a connector, and is kept. A null total therefore degrades `'{count}x of {total}'` to
|
|
43
|
-
* "6x" — never "6x of" or a bare "6" (see `stripTotalToken`).
|
|
44
|
-
*/
|
|
45
|
-
installmentTemplate?: string;
|
|
117
|
+
/** The last-four, no-record, unresolved and installment messages. */
|
|
118
|
+
$content?: ContentValue<typeof OrderPlacedPaymentSummaryContent>;
|
|
46
119
|
/** Unwrapped `Order` slice forwarded by the reactive runtime — never a `{ order: … }` wrapper. */
|
|
47
120
|
$data?: OrderPlacedPaymentSummaryData;
|
|
48
121
|
};
|
|
@@ -55,6 +128,6 @@ export declare const OrderPlacedPaymentSummaryDefinition: ComponentDefinition<Or
|
|
|
55
128
|
* last four (whenever present) plus the installment line (whenever the settled record reports one,
|
|
56
129
|
* T33). Requires no context — composable standalone.
|
|
57
130
|
*/
|
|
58
|
-
export declare function OrderPlacedPaymentSummary({ className,
|
|
131
|
+
export declare function OrderPlacedPaymentSummary({ className, $content, $locale, $data: $dataProp }: Readonly<OrderPlacedPaymentSummaryProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
59
132
|
//#endregion
|
|
60
133
|
//# sourceMappingURL=order-placed-payment-summary.d.ts.map
|