@vtex/faststore 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +0 -1
- package/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/actions.json +6 -1
- package/dist/catalog.json +789 -1701
- package/dist/cli/index.d.ts +66 -28
- package/dist/cli/index.js +7371 -512
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/server-runtime.js +41 -60
- package/dist/cli/server-runtime.js.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/components.d.ts +63 -57
- package/dist/components.js +60 -54
- package/dist/content-types.json +5785 -754
- package/dist/core/dist/define-component.d.ts +1 -1
- package/dist/core/dist/define-content-type.d.ts +50 -2
- package/dist/core/dist/define-content-type.js +107 -3
- package/dist/core/dist/define-content-type.js.map +1 -1
- package/dist/core/dist/index.d.ts +2 -2
- package/dist/docs/access-code-field.md +1 -1
- package/dist/docs/access-code-sign-in.md +126 -77
- package/dist/docs/account-address-book.md +210 -95
- package/dist/docs/account-menu.md +14 -15
- package/dist/docs/account-saved-cards.md +44 -39
- package/dist/docs/alert-dialog.md +3 -1
- package/dist/docs/avatar.md +4 -2
- package/dist/docs/billing-address.md +99 -30
- package/dist/docs/binding-switcher.md +5 -2
- package/dist/docs/buy-button.md +7 -8
- package/dist/docs/card-entry.md +39 -26
- package/dist/docs/card-summary.md +18 -8
- package/dist/docs/cardholder-document.md +5 -3
- package/dist/docs/carousel.md +5 -4
- package/dist/docs/cart-destination.md +39 -26
- package/dist/docs/cart-item.md +29 -14
- package/dist/docs/cart-totalizer.md +7 -5
- package/dist/docs/cart.md +135 -41
- package/dist/docs/challenge-return.md +135 -0
- package/dist/docs/client-preferences-fieldset.md +10 -5
- package/dist/docs/client-preferences.md +31 -8
- package/dist/docs/client-profile-fieldset.md +20 -6
- package/dist/docs/client-profile.md +12 -3
- package/dist/docs/copy-text.md +9 -7
- package/dist/docs/document-field.md +1 -1
- package/dist/docs/email-field.md +2 -1
- package/dist/docs/email-identification.md +12 -2
- package/dist/docs/footer-copyright.md +4 -2
- package/dist/docs/form.md +54 -18
- package/dist/docs/free-shipping-progress.md +6 -5
- package/dist/docs/identity-edit.md +8 -2
- package/dist/docs/identity-summary.md +18 -5
- package/dist/docs/installments.md +46 -32
- package/dist/docs/my-account-profile.md +16 -11
- package/dist/docs/navigation-link.md +5 -3
- package/dist/docs/order-cancel.md +3 -1
- package/dist/docs/order-delivery-address.md +7 -5
- package/dist/docs/order-delivery-group.md +1 -3
- package/dist/docs/order-details-back.md +1 -1
- package/dist/docs/order-details-header.md +1 -4
- package/dist/docs/order-invoice-download.md +60 -0
- package/dist/docs/order-list-row.md +1 -1
- package/dist/docs/order-list-search.md +13 -20
- package/dist/docs/order-list-views.md +11 -17
- package/dist/docs/order-list.md +12 -5
- package/dist/docs/order-payment.md +9 -7
- package/dist/docs/order-placed-date.md +1 -1
- package/dist/docs/order-placed-payment-summary.md +28 -15
- package/dist/docs/order-placed.md +49 -14
- package/dist/docs/order-progress.md +1 -1
- package/dist/docs/order-status-badge.md +20 -9
- package/dist/docs/order-summary.md +2 -2
- package/dist/docs/order-tracking-link.md +58 -0
- package/dist/docs/payment-method-badges.md +30 -4
- package/dist/docs/payment-methods.md +1 -1
- package/dist/docs/payment.md +36 -17
- package/dist/docs/phone-field.md +4 -4
- package/dist/docs/place-order.md +84 -36
- package/dist/docs/postal-code-field.md +3 -1
- package/dist/docs/pricing.md +21 -23
- package/dist/docs/product-gallery.md +19 -20
- package/dist/docs/product-information.md +13 -9
- package/dist/docs/product-list.md +7 -6
- package/dist/docs/product-shelf.md +0 -1
- package/dist/docs/promotion.md +4 -2
- package/dist/docs/region.md +23 -15
- package/dist/docs/save-card.md +7 -6
- package/dist/docs/saved-cards.md +65 -36
- package/dist/docs/shipping-address.md +57 -21
- package/dist/docs/shipping-simulator.md +53 -15
- package/dist/docs/sign-in-disclosure.md +176 -0
- package/dist/docs/sign-in-form.md +78 -47
- package/dist/docs/sign-in-redirect.md +4 -2
- package/dist/docs/sign-in.md +173 -0
- package/dist/docs/toast.md +15 -4
- package/dist/docs/variant-selector.md +15 -11
- package/dist/domain-logic/dist/checkout/rules.js +33 -0
- package/dist/domain-logic/dist/checkout/rules.js.map +1 -0
- package/dist/graphql/types.d.ts +4 -14
- package/dist/index.d.ts +2 -2
- package/dist/internal/client.d.ts +1 -3
- package/dist/internal/client.js +1 -1
- package/dist/internal/server.d.ts +7 -4
- package/dist/internal/server.js +7 -4
- package/dist/matter/access-code-sign-in/access-code-sign-in.d.ts +250 -66
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +459 -188
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-delete.d.ts +78 -40
- package/dist/matter/account-address-book/account-address-book-delete.js +86 -50
- package/dist/matter/account-address-book/account-address-book-delete.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-deliverability.d.ts +21 -4
- package/dist/matter/account-address-book/account-address-book-deliverability.js +45 -17
- package/dist/matter/account-address-book/account-address-book-deliverability.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-form-parts.d.ts +74 -19
- package/dist/matter/account-address-book/account-address-book-form-parts.js +77 -26
- package/dist/matter/account-address-book/account-address-book-form-parts.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book-profile-notice.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-book-profile-notice.js +55 -28
- package/dist/matter/account-address-book/account-address-book-profile-notice.js.map +1 -1
- package/dist/matter/account-address-book/account-address-book.d.ts +67 -14
- package/dist/matter/account-address-book/account-address-book.js +74 -33
- package/dist/matter/account-address-book/account-address-book.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country-switch.js +3 -3
- package/dist/matter/account-address-book/account-address-country-switch.js.map +1 -1
- package/dist/matter/account-address-book/account-address-country.d.ts +66 -20
- package/dist/matter/account-address-book/account-address-country.js +83 -49
- package/dist/matter/account-address-book/account-address-country.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form-context.d.ts +8 -4
- package/dist/matter/account-address-book/account-address-form-context.js.map +1 -1
- package/dist/matter/account-address-book/account-address-form.d.ts +468 -45
- package/dist/matter/account-address-book/account-address-form.js +518 -155
- package/dist/matter/account-address-book/account-address-form.js.map +1 -1
- package/dist/matter/account-address-book/account-address-record.d.ts +27 -6
- package/dist/matter/account-address-book/account-address-record.js +32 -17
- package/dist/matter/account-address-book/account-address-record.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +34 -17
- package/dist/matter/account-menu/account-menu.js +46 -54
- package/dist/matter/account-menu/account-menu.js.map +1 -1
- package/dist/matter/account-menu-identity/account-menu-identity.js +1 -1
- package/dist/matter/account-saved-cards/account-saved-cards.d.ts +108 -28
- package/dist/matter/account-saved-cards/account-saved-cards.js +177 -122
- package/dist/matter/account-saved-cards/account-saved-cards.js.map +1 -1
- package/dist/matter/billing-address/billing-address.d.ts +156 -74
- package/dist/matter/billing-address/billing-address.js +227 -156
- package/dist/matter/billing-address/billing-address.js.map +1 -1
- package/dist/matter/breadcrumb/breadcrumb.d.ts +21 -3
- package/dist/matter/breadcrumb/breadcrumb.js +24 -9
- package/dist/matter/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/matter/buy-button/buy-button.d.ts +8 -11
- package/dist/matter/buy-button/buy-button.js +10 -19
- package/dist/matter/buy-button/buy-button.js.map +1 -1
- package/dist/matter/card-entry/card-capture.js +12 -4
- package/dist/matter/card-entry/card-capture.js.map +1 -1
- package/dist/matter/card-entry/card-entry.d.ts +123 -32
- package/dist/matter/card-entry/card-entry.js +348 -221
- package/dist/matter/card-entry/card-entry.js.map +1 -1
- package/dist/matter/cart/cart-namespace.d.ts +7 -1
- package/dist/matter/cart/cart-namespace.js +7 -1
- package/dist/matter/cart/cart-namespace.js.map +1 -1
- package/dist/matter/cart/cart.d.ts +402 -61
- package/dist/matter/cart/cart.js +624 -153
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/cart-destination/cart-destination.d.ts +30 -19
- package/dist/matter/cart-destination/cart-destination.js +160 -70
- package/dist/matter/cart-destination/cart-destination.js.map +1 -1
- package/dist/matter/cart-item/cart-item.d.ts +144 -17
- package/dist/matter/cart-item/cart-item.js +166 -49
- package/dist/matter/cart-item/cart-item.js.map +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js +1 -1
- package/dist/matter/cart-item-compositions/cart-item-compositions.js.map +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js +1 -1
- package/dist/matter/cart-item-customizations/cart-item-customizations.js.map +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js +1 -1
- package/dist/matter/cart-item-discounts/cart-item-discounts.js.map +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js +1 -1
- package/dist/matter/cart-item-seller-info/cart-item-seller-info.js.map +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js +1 -1
- package/dist/matter/cart-item-variations/cart-item-variations.js.map +1 -1
- package/dist/matter/cart-totalizer/cart-totalizer.d.ts +43 -9
- package/dist/matter/cart-totalizer/cart-totalizer.js +46 -17
- package/dist/matter/cart-totalizer/cart-totalizer.js.map +1 -1
- package/dist/matter/challenge-return/challenge-return.d.ts +62 -0
- package/dist/matter/challenge-return/challenge-return.js +241 -0
- package/dist/matter/challenge-return/challenge-return.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +86 -17
- package/dist/matter/client-preferences/client-preferences-fieldset.js +126 -54
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences.d.ts +50 -7
- package/dist/matter/client-preferences/client-preferences.js +84 -15
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +44 -9
- package/dist/matter/client-profile/client-profile.js +64 -24
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -22
- package/dist/matter/client-profile-form/client-profile-fieldset.js +161 -73
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-accordion.d.ts +49 -4
- package/dist/matter/delivery-options/delivery-options-accordion.js +67 -14
- package/dist/matter/delivery-options/delivery-options-accordion.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options-controller.d.ts +69 -9
- package/dist/matter/delivery-options/delivery-options-controller.js +80 -14
- package/dist/matter/delivery-options/delivery-options-controller.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.d.ts +37 -2
- package/dist/matter/delivery-options/delivery-options.js +75 -12
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.d.ts +1 -0
- package/dist/matter/delivery-options/use-delivery-option-selection.js +1 -1
- package/dist/matter/delivery-options/use-delivery-option-selection.js.map +1 -1
- package/dist/matter/email-identification/email-identification.d.ts +25 -3
- package/dist/matter/email-identification/email-identification.js +49 -12
- package/dist/matter/email-identification/email-identification.js.map +1 -1
- package/dist/matter/free-shipping-progress/free-shipping-progress.d.ts +79 -7
- package/dist/matter/free-shipping-progress/free-shipping-progress.js +77 -20
- package/dist/matter/free-shipping-progress/free-shipping-progress.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.d.ts +52 -10
- package/dist/matter/identity-edit/identity-edit.js +47 -19
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.d.ts +76 -22
- package/dist/matter/identity-summary/identity-summary.js +95 -45
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +98 -16
- package/dist/matter/installments/installments-select.js +156 -48
- package/dist/matter/installments/installments-select.js.map +1 -1
- package/dist/matter/installments/installments.d.ts +96 -16
- package/dist/matter/installments/installments.js +115 -40
- package/dist/matter/installments/installments.js.map +1 -1
- package/dist/matter/installments/use-installments-selection.d.ts +1 -0
- package/dist/matter/installments/use-installments-selection.js +8 -3
- package/dist/matter/installments/use-installments-selection.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +358 -103
- package/dist/matter/my-account-profile/my-account-profile.js +370 -174
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-cancel/order-cancel.d.ts +65 -19
- package/dist/matter/order-cancel/order-cancel.js +118 -51
- package/dist/matter/order-cancel/order-cancel.js.map +1 -1
- package/dist/matter/order-delivery-address/order-delivery-address.d.ts +8 -18
- package/dist/matter/order-delivery-address/order-delivery-address.js +14 -23
- package/dist/matter/order-delivery-address/order-delivery-address.js.map +1 -1
- package/dist/matter/order-delivery-group/order-delivery-group.d.ts +40 -24
- package/dist/matter/order-delivery-group/order-delivery-group.js +64 -74
- package/dist/matter/order-delivery-group/order-delivery-group.js.map +1 -1
- package/dist/matter/order-details-header/order-details-header.d.ts +32 -15
- package/dist/matter/order-details-header/order-details-header.js +66 -58
- package/dist/matter/order-details-header/order-details-header.js.map +1 -1
- package/dist/matter/order-invoice-download/order-invoice-download.d.ts +78 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js +173 -0
- package/dist/matter/order-invoice-download/order-invoice-download.js.map +1 -0
- package/dist/matter/order-list/order-list.d.ts +164 -19
- package/dist/matter/order-list/order-list.js +229 -87
- package/dist/matter/order-list/order-list.js.map +1 -1
- package/dist/matter/order-list-row/order-list-row.d.ts +6 -1
- package/dist/matter/order-list-row/order-list-row.js +3 -2
- package/dist/matter/order-list-row/order-list-row.js.map +1 -1
- package/dist/matter/order-list-search/order-list-search.d.ts +18 -26
- package/dist/matter/order-list-search/order-list-search.js +30 -69
- package/dist/matter/order-list-search/order-list-search.js.map +1 -1
- package/dist/matter/order-list-views/order-list-views.d.ts +15 -22
- package/dist/matter/order-list-views/order-list-views.js +22 -68
- package/dist/matter/order-list-views/order-list-views.js.map +1 -1
- package/dist/matter/order-payment/order-payment.d.ts +33 -10
- package/dist/matter/order-payment/order-payment.js +44 -39
- package/dist/matter/order-payment/order-payment.js.map +1 -1
- package/dist/matter/order-placed/order-placed-deliveries.d.ts +144 -12
- package/dist/matter/order-placed/order-placed-deliveries.js +115 -40
- package/dist/matter/order-placed/order-placed-deliveries.js.map +1 -1
- package/dist/matter/order-placed/order-placed.d.ts +198 -31
- package/dist/matter/order-placed/order-placed.js +230 -139
- package/dist/matter/order-placed/order-placed.js.map +1 -1
- package/dist/matter/order-placed-date/order-placed-date.d.ts +5 -8
- package/dist/matter/order-placed-date/order-placed-date.js +7 -8
- package/dist/matter/order-placed-date/order-placed-date.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +90 -17
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +93 -117
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -1
- package/dist/matter/order-progress/order-progress.d.ts +19 -8
- package/dist/matter/order-progress/order-progress.js +37 -45
- package/dist/matter/order-progress/order-progress.js.map +1 -1
- package/dist/matter/order-summary/order-summary.d.ts +19 -9
- package/dist/matter/order-summary/order-summary.js +38 -44
- package/dist/matter/order-summary/order-summary.js.map +1 -1
- package/dist/matter/order-tracking-link/order-tracking-link.d.ts +43 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js +107 -0
- package/dist/matter/order-tracking-link/order-tracking-link.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.js +17 -10
- package/dist/matter/payment/payment-card-capture.js.map +1 -1
- package/dist/matter/payment/payment-controller.d.ts +4 -2
- package/dist/matter/payment/payment-controller.js +30 -9
- package/dist/matter/payment/payment-controller.js.map +1 -1
- package/dist/matter/payment/payment-method-badges.js +1 -1
- package/dist/matter/payment/payment.d.ts +69 -19
- package/dist/matter/payment/payment.js +101 -35
- package/dist/matter/payment/payment.js.map +1 -1
- package/dist/matter/payment/use-payment-method-selection.d.ts +25 -4
- package/dist/matter/payment/use-payment-method-selection.js +94 -32
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -1
- package/dist/matter/payment/use-payment-submit-gate.d.ts +14 -3
- package/dist/matter/payment/use-payment-submit-gate.js +47 -8
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -1
- package/dist/matter/place-order/place-order.d.ts +171 -57
- package/dist/matter/place-order/place-order.js +376 -185
- package/dist/matter/place-order/place-order.js.map +1 -1
- package/dist/matter/pricing/pricing.d.ts +152 -13
- package/dist/matter/pricing/pricing.js +153 -52
- package/dist/matter/pricing/pricing.js.map +1 -1
- package/dist/matter/product-information/product-information.d.ts +27 -4
- package/dist/matter/product-information/product-information.js +32 -15
- package/dist/matter/product-information/product-information.js.map +1 -1
- package/dist/matter/product-list/product-list.d.ts +24 -6
- package/dist/matter/product-list/product-list.js +32 -26
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -3
- package/dist/matter/product-shelf/product-shelf.js +2 -15
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.d.ts +33 -16
- package/dist/matter/region/region.js +59 -52
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +43 -8
- package/dist/matter/save-card/save-card.js +61 -23
- package/dist/matter/save-card/save-card.js.map +1 -1
- package/dist/matter/saved-cards/saved-cards.d.ts +113 -21
- package/dist/matter/saved-cards/saved-cards.js +349 -77
- package/dist/matter/saved-cards/saved-cards.js.map +1 -1
- package/dist/matter/shipping-address/address-payload.js +25 -0
- package/dist/matter/shipping-address/address-payload.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +71 -71
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/library-country-descriptors.js +136 -0
- package/dist/matter/shipping-address/library-country-descriptors.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.d.ts +312 -45
- package/dist/matter/shipping-address/shipping-address.js +443 -188
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.d.ts +250 -24
- package/dist/matter/shipping-simulator/shipping-simulator.js +257 -51
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/sign-in/sign-in.d.ts +108 -0
- package/dist/matter/sign-in/sign-in.js +285 -0
- package/dist/matter/sign-in/sign-in.js.map +1 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.d.ts +81 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js +232 -0
- package/dist/matter/sign-in-disclosure/sign-in-disclosure.js.map +1 -0
- package/dist/matter/sign-in-form/sign-in-form.d.ts +93 -62
- package/dist/matter/sign-in-form/sign-in-form.js +134 -144
- package/dist/matter/sign-in-form/sign-in-form.js.map +1 -1
- package/dist/particles/binding-switcher/binding-switcher.d.ts +29 -8
- package/dist/particles/binding-switcher/binding-switcher.js +37 -26
- package/dist/particles/binding-switcher/binding-switcher.js.map +1 -1
- package/dist/particles/card-summary/card-summary.d.ts +38 -8
- package/dist/particles/card-summary/card-summary.js +55 -22
- package/dist/particles/card-summary/card-summary.js.map +1 -1
- package/dist/particles/carousel/carousel.d.ts +99 -11
- package/dist/particles/carousel/carousel.js +103 -35
- package/dist/particles/carousel/carousel.js.map +1 -1
- package/dist/particles/copy-text/copy-text.js +5 -15
- package/dist/particles/copy-text/copy-text.js.map +1 -1
- package/dist/particles/dialog/dialog.d.ts +14 -6
- package/dist/particles/dialog/dialog.js +6 -3
- package/dist/particles/dialog/dialog.js.map +1 -1
- package/dist/particles/drawer/drawer.js +1 -1
- package/dist/particles/drawer/drawer.js.map +1 -1
- package/dist/particles/email-field/email-field.d.ts +2 -1
- package/dist/particles/email-field/email-field.js +2 -1
- package/dist/particles/email-field/email-field.js.map +1 -1
- package/dist/particles/footer-link-group/footer-link-group.js +1 -0
- package/dist/particles/footer-link-group/footer-link-group.js.map +1 -1
- package/dist/particles/form/form.d.ts +85 -13
- package/dist/particles/form/form.js +91 -42
- package/dist/particles/form/form.js.map +1 -1
- package/dist/particles/gallery/gallery.d.ts +129 -12
- package/dist/particles/gallery/gallery.js +121 -34
- package/dist/particles/gallery/gallery.js.map +1 -1
- package/dist/particles/order-details-back/order-details-back.d.ts +5 -3
- package/dist/particles/order-details-back/order-details-back.js +8 -10
- package/dist/particles/order-details-back/order-details-back.js.map +1 -1
- package/dist/particles/order-status-badge/order-status-badge.d.ts +3 -3
- package/dist/particles/order-status-badge/order-status-badge.js +4 -20
- package/dist/particles/order-status-badge/order-status-badge.js.map +1 -1
- package/dist/particles/password-field/password-field.d.ts +1 -1
- package/dist/particles/password-field/password-field.js +2 -4
- package/dist/particles/password-field/password-field.js.map +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +4 -4
- package/dist/particles/phone-field/phone-field.js +8 -11
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/spinner/spinner.d.ts +24 -4
- package/dist/particles/spinner/spinner.js +25 -9
- package/dist/particles/spinner/spinner.js.map +1 -1
- package/dist/particles/switch/switch.d.ts +4 -1
- package/dist/particles/switch/switch.js +3 -1
- package/dist/particles/switch/switch.js.map +1 -1
- package/dist/particles/toast/toast.d.ts +29 -3
- package/dist/particles/toast/toast.js +34 -10
- package/dist/particles/toast/toast.js.map +1 -1
- package/dist/schema.graphql +164 -56
- package/dist/sdk/address/address-fields.js +4 -4
- package/dist/sdk/address/address-fields.js.map +1 -1
- package/dist/sdk/address/constants.js +1 -6
- package/dist/sdk/address/constants.js.map +1 -1
- package/dist/sdk/address/messages.js +44 -44
- package/dist/sdk/address/messages.js.map +1 -1
- package/dist/sdk/address/postal-code.js +15 -2
- package/dist/sdk/address/postal-code.js.map +1 -1
- package/dist/sdk/address/types.d.ts +5 -3
- package/dist/sdk/address/validate-address.js +3 -3
- package/dist/sdk/address/validate-address.js.map +1 -1
- package/dist/sdk/analytics/use-analytics-actions.d.ts +1 -1
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/data/index.js +2 -2
- package/dist/sdk/data/reactive-list-item-data-provider.js +2 -2
- package/dist/sdk/generated/gql.js +1 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.d.ts +20 -5
- package/dist/sdk/generated/graphql.js +6 -0
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/format-error-code.js +23 -0
- package/dist/sdk/i18n/format-error-code.js.map +1 -0
- package/dist/sdk/i18n/message-formatter.d.ts +22 -0
- package/dist/sdk/i18n/message-formatter.js +140 -0
- package/dist/sdk/i18n/message-formatter.js.map +1 -0
- package/dist/sdk/i18n/use-message-formatter.d.ts +8 -0
- package/dist/sdk/i18n/use-message-formatter.js +18 -0
- package/dist/sdk/i18n/use-message-formatter.js.map +1 -0
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/navigation/redirect.d.ts +2 -0
- package/dist/sdk/navigation/redirect.js +19 -1
- package/dist/sdk/navigation/redirect.js.map +1 -1
- package/dist/sdk/navigation/types.d.ts +13 -0
- package/dist/sdk/payment/bin-format.js +21 -0
- package/dist/sdk/payment/bin-format.js.map +1 -0
- package/dist/sdk/payment/challenge-return.js +37 -0
- package/dist/sdk/payment/challenge-return.js.map +1 -0
- package/dist/sdk/payment/confirmation-last-four.js +39 -0
- package/dist/sdk/payment/confirmation-last-four.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +1 -1
- package/dist/sdk/payment/gateway.js +8 -2
- package/dist/sdk/payment/gateway.js.map +1 -1
- package/dist/sdk/payment/operations.d.ts +1 -0
- package/dist/sdk/payment/operations.js +28 -6
- package/dist/sdk/payment/operations.js.map +1 -1
- package/dist/sdk/payment/resumed-purchase.d.ts +1 -0
- package/dist/sdk/payment/resumed-purchase.js +119 -0
- package/dist/sdk/payment/resumed-purchase.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +16 -23
- package/dist/sdk/payment/security-code-mask.js.map +1 -1
- package/dist/sdk/payment/submission-registry.js +6 -2
- package/dist/sdk/payment/submission-registry.js.map +1 -1
- package/dist/sdk/payment/use-payment-actions.d.ts +18 -3
- package/dist/sdk/payment/use-payment-actions.js +23 -4
- package/dist/sdk/payment/use-payment-actions.js.map +1 -1
- package/dist/sdk/payment/use-place-order.d.ts +10 -2
- package/dist/sdk/payment/use-place-order.js +138 -76
- package/dist/sdk/payment/use-place-order.js.map +1 -1
- package/dist/sdk/provider/storefront-provider.d.ts +1 -7
- package/dist/sdk/provider/storefront-provider.js +4 -11
- package/dist/sdk/provider/storefront-provider.js.map +1 -1
- package/dist/sdk/seo/entity-landing.d.ts +24 -0
- package/dist/sdk/seo/entity-landing.js +30 -0
- package/dist/sdk/seo/entity-landing.js.map +1 -0
- package/dist/sdk/seo/page-alternates.d.ts +3 -2
- package/dist/sdk/seo/page-alternates.js +4 -2
- package/dist/sdk/seo/page-alternates.js.map +1 -1
- package/dist/sdk/seo/search-landing.d.ts +42 -0
- package/dist/sdk/seo/search-landing.js +85 -0
- package/dist/sdk/seo/search-landing.js.map +1 -0
- package/dist/sdk/session/mock-session.d.ts +9 -0
- package/dist/sdk/session/mock-session.js +31 -0
- package/dist/sdk/session/mock-session.js.map +1 -0
- package/dist/sdk/session/read-server-session.d.ts +3 -0
- package/dist/sdk/session/read-server-session.js +5 -0
- package/dist/sdk/session/read-server-session.js.map +1 -1
- package/dist/sdk/session/return-path-segment.d.ts +10 -0
- package/dist/sdk/session/return-path-segment.js +15 -0
- package/dist/sdk/session/return-path-segment.js.map +1 -0
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/shipping/use-cart-shipping-simulation.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-simulation.js.map +1 -1
- package/dist/utils/safe-href.d.ts +2 -0
- package/package.json +4 -3
- package/skills/storefront-asset/SKILL.md +2 -2
- package/skills/storefront-asset/references/api-side.md +27 -14
- package/skills/storefront-asset/references/findings.md +5 -2
- package/src/styles/tailwind.css +8 -0
- package/dist/matter/shipping-address/country-descriptors.d.ts +0 -1
- package/dist/message-locales.json +0 -7
- package/dist/sdk/i18n/client.d.ts +0 -4
- package/dist/sdk/i18n/client.js +0 -4
- package/dist/sdk/i18n/locales.d.ts +0 -8
- package/dist/sdk/i18n/locales.js +0 -57
- package/dist/sdk/i18n/locales.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.js +0 -183
- package/dist/sdk/i18n/messages/en-US.js.map +0 -1
- package/dist/sdk/i18n/messages/en-US.json +0 -178
- package/dist/sdk/i18n/messages/en-US.json.d.ts +0 -182
- package/dist/sdk/i18n/messages/es-ES.js +0 -183
- package/dist/sdk/i18n/messages/es-ES.js.map +0 -1
- package/dist/sdk/i18n/messages/es-ES.json +0 -178
- package/dist/sdk/i18n/messages/pt-BR.js +0 -183
- package/dist/sdk/i18n/messages/pt-BR.js.map +0 -1
- package/dist/sdk/i18n/messages/pt-BR.json +0 -178
- package/dist/sdk/i18n/provider.d.ts +0 -1
- package/dist/sdk/i18n/provider.js +0 -30
- package/dist/sdk/i18n/provider.js.map +0 -1
- package/dist/sdk/i18n/server.d.ts +0 -28
- package/dist/sdk/i18n/server.js +0 -59
- package/dist/sdk/i18n/server.js.map +0 -1
- package/dist/utils/resolve-authored-copy.js +0 -18
- package/dist/utils/resolve-authored-copy.js.map +0 -1
- package/dist/utils/substitute-template.js +0 -33
- package/dist/utils/substitute-template.js.map +0 -1
package/dist/matter/cart/cart.js
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
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
|
+
import { resolveSafeHref } from "../../utils/safe-href.js";
|
|
5
6
|
import { useStorefrontContext } from "../../sdk/context/storefront-context.js";
|
|
7
|
+
import { useMessageFormatter } from "../../sdk/i18n/use-message-formatter.js";
|
|
6
8
|
import { useStorefrontNavigation } from "../../sdk/navigation/use-storefront-navigation.js";
|
|
7
9
|
import { graphql } from "../../sdk/generated/gql.js";
|
|
8
10
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
11
|
+
import { formatErrorCode } from "../../sdk/i18n/format-error-code.js";
|
|
9
12
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
10
|
-
import { NavigationLink } from "../../particles/navigation-link/navigation-link.js";
|
|
11
13
|
import { loggableErrorName } from "../../utils/loggable-error-name.js";
|
|
12
|
-
import { ListItemRefContext } from "../../sdk/data/list-item-ref-context.js";
|
|
13
14
|
import { ReactiveRootContext } from "../../sdk/data/page-reactive-data-root.js";
|
|
15
|
+
import { NavigationLink } from "../../particles/navigation-link/navigation-link.js";
|
|
16
|
+
import { ListItemRefContext } from "../../sdk/data/list-item-ref-context.js";
|
|
14
17
|
import { useOptionalToast } from "../../particles/toast/toast.js";
|
|
15
18
|
import { Icon } from "../../particles/icon/icon.js";
|
|
16
19
|
import { DrawerClose } from "../../particles/drawer/drawer.js";
|
|
@@ -43,18 +46,246 @@ const CartDisclaimerContent = defineContentType({
|
|
|
43
46
|
const CartCheckoutLabelContent = defineContentType({
|
|
44
47
|
id: "cart-checkout-label",
|
|
45
48
|
title: "Cart Checkout Label",
|
|
46
|
-
description: "
|
|
49
|
+
description: "Label for the checkout call to action.",
|
|
47
50
|
schema: {
|
|
48
51
|
type: "object",
|
|
49
52
|
additionalProperties: false,
|
|
50
|
-
required: ["label"],
|
|
51
53
|
properties: { label: {
|
|
52
54
|
type: "string",
|
|
53
55
|
minLength: 1,
|
|
54
|
-
title: "Checkout label"
|
|
56
|
+
title: "Checkout label",
|
|
57
|
+
format: "icu-message",
|
|
58
|
+
messageSource: "Checkout"
|
|
59
|
+
} }
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const CartCountContent = defineContentType({
|
|
63
|
+
id: "cart-count",
|
|
64
|
+
title: "Cart Count",
|
|
65
|
+
description: "Text of the cart item count.",
|
|
66
|
+
schema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
additionalProperties: false,
|
|
69
|
+
properties: { template: {
|
|
70
|
+
type: "string",
|
|
71
|
+
title: "Item count",
|
|
72
|
+
format: "icu-message",
|
|
73
|
+
messageSource: "{count}",
|
|
74
|
+
messageArguments: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: { count: { type: "integer" } }
|
|
77
|
+
},
|
|
78
|
+
messageExample: { count: 3 }
|
|
79
|
+
} }
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const CartCouponFormContent = defineContentType({
|
|
83
|
+
id: "cart-coupon-form",
|
|
84
|
+
title: "Cart Coupon Form",
|
|
85
|
+
description: "Copy for the coupon code input, its apply button and the applied toast.",
|
|
86
|
+
schema: {
|
|
87
|
+
type: "object",
|
|
88
|
+
additionalProperties: false,
|
|
89
|
+
properties: {
|
|
90
|
+
placeholder: {
|
|
91
|
+
type: "string",
|
|
92
|
+
title: "Input placeholder",
|
|
93
|
+
description: "Also the accessible name of the input.",
|
|
94
|
+
format: "icu-message",
|
|
95
|
+
messageSource: "Coupon code"
|
|
96
|
+
},
|
|
97
|
+
applyLabel: {
|
|
98
|
+
type: "string",
|
|
99
|
+
title: "Apply button label",
|
|
100
|
+
format: "icu-message",
|
|
101
|
+
messageSource: "Apply"
|
|
102
|
+
},
|
|
103
|
+
appliedMessage: {
|
|
104
|
+
type: "string",
|
|
105
|
+
title: "Applied toast title",
|
|
106
|
+
description: "Raised after an apply whose code comes back matched; blank raises no toast.",
|
|
107
|
+
format: "icu-message",
|
|
108
|
+
messageSource: "Coupon applied"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const CartAppliedCouponsContent = defineContentType({
|
|
114
|
+
id: "cart-applied-coupons",
|
|
115
|
+
title: "Cart Applied Coupons",
|
|
116
|
+
description: "Copy for the built-in remove control of each applied coupon chip.",
|
|
117
|
+
schema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
additionalProperties: false,
|
|
120
|
+
properties: { removeLabel: {
|
|
121
|
+
type: "string",
|
|
122
|
+
title: "Remove control accessible label",
|
|
123
|
+
format: "icu-message",
|
|
124
|
+
messageSource: "Remove coupon {code}",
|
|
125
|
+
messageArguments: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: { code: { type: "string" } }
|
|
128
|
+
},
|
|
129
|
+
messageExample: { code: "SAVE10" }
|
|
55
130
|
} }
|
|
56
131
|
}
|
|
57
132
|
});
|
|
133
|
+
const CartCouponUnmatchedContent = defineContentType({
|
|
134
|
+
id: "cart-coupon-unmatched",
|
|
135
|
+
title: "Cart Coupon Unmatched",
|
|
136
|
+
description: "Notice shown on an applied coupon whose conditions do not match the cart.",
|
|
137
|
+
schema: {
|
|
138
|
+
type: "object",
|
|
139
|
+
additionalProperties: false,
|
|
140
|
+
properties: { message: {
|
|
141
|
+
type: "string",
|
|
142
|
+
title: "Notice",
|
|
143
|
+
format: "icu-message",
|
|
144
|
+
messageSource: "This coupon is not being applied to your cart"
|
|
145
|
+
} }
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
const CartCouponSavingsContent = defineContentType({
|
|
149
|
+
id: "cart-coupon-savings",
|
|
150
|
+
title: "Cart Coupon Savings",
|
|
151
|
+
description: "Text of the amount an applied coupon saves.",
|
|
152
|
+
schema: {
|
|
153
|
+
type: "object",
|
|
154
|
+
additionalProperties: false,
|
|
155
|
+
properties: { template: {
|
|
156
|
+
type: "string",
|
|
157
|
+
title: "Savings text",
|
|
158
|
+
description: "`amount` is the formatted saving.",
|
|
159
|
+
format: "icu-message",
|
|
160
|
+
messageSource: "{amount}",
|
|
161
|
+
messageArguments: {
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: { amount: { type: "string" } }
|
|
164
|
+
},
|
|
165
|
+
messageExample: { amount: "-$10.00" }
|
|
166
|
+
} }
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
const CartUnavailableCountContent = defineContentType({
|
|
170
|
+
id: "cart-unavailable-count",
|
|
171
|
+
title: "Cart Unavailable Count",
|
|
172
|
+
description: "Summary of how many cart lines are unavailable.",
|
|
173
|
+
schema: {
|
|
174
|
+
type: "object",
|
|
175
|
+
additionalProperties: false,
|
|
176
|
+
properties: { template: {
|
|
177
|
+
type: "string",
|
|
178
|
+
title: "Unavailable count",
|
|
179
|
+
format: "icu-message",
|
|
180
|
+
messageSource: "{count, plural, one {# item unavailable} other {# items unavailable}}",
|
|
181
|
+
messageArguments: {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: { count: { type: "integer" } }
|
|
184
|
+
},
|
|
185
|
+
messageExample: { count: 2 }
|
|
186
|
+
} }
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const CartRemoveUnavailableContent = defineContentType({
|
|
190
|
+
id: "cart-remove-unavailable",
|
|
191
|
+
title: "Cart Remove Unavailable",
|
|
192
|
+
description: "Label for the button that removes every unavailable cart line.",
|
|
193
|
+
schema: {
|
|
194
|
+
type: "object",
|
|
195
|
+
additionalProperties: false,
|
|
196
|
+
properties: { label: {
|
|
197
|
+
type: "string",
|
|
198
|
+
title: "Button label",
|
|
199
|
+
format: "icu-message",
|
|
200
|
+
messageSource: "Remove unavailable items"
|
|
201
|
+
} }
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
const ClearCartButtonContent = defineContentType({
|
|
205
|
+
id: "clear-cart-button",
|
|
206
|
+
title: "Clear Cart Button",
|
|
207
|
+
description: "Label for the button that removes every cart line.",
|
|
208
|
+
schema: {
|
|
209
|
+
type: "object",
|
|
210
|
+
additionalProperties: false,
|
|
211
|
+
properties: { label: {
|
|
212
|
+
type: "string",
|
|
213
|
+
title: "Button label",
|
|
214
|
+
format: "icu-message",
|
|
215
|
+
messageSource: "Clear cart"
|
|
216
|
+
} }
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
const CartErrorContent = defineContentType({
|
|
220
|
+
id: "cart-error",
|
|
221
|
+
title: "Cart Error",
|
|
222
|
+
description: "Messages shown when a cart item write is refused, one per error code the shopper can act on.",
|
|
223
|
+
schema: {
|
|
224
|
+
type: "object",
|
|
225
|
+
additionalProperties: false,
|
|
226
|
+
properties: {
|
|
227
|
+
invalidQuantityMessage: {
|
|
228
|
+
type: "string",
|
|
229
|
+
title: "Invalid quantity message",
|
|
230
|
+
description: "Shown when the requested quantity is not accepted.",
|
|
231
|
+
format: "icu-message",
|
|
232
|
+
messageSource: "Choose a valid quantity."
|
|
233
|
+
},
|
|
234
|
+
itemNotFoundMessage: {
|
|
235
|
+
type: "string",
|
|
236
|
+
title: "Item not found message",
|
|
237
|
+
description: "Shown when the item is no longer in the cart.",
|
|
238
|
+
format: "icu-message",
|
|
239
|
+
messageSource: "This item is no longer in your cart."
|
|
240
|
+
},
|
|
241
|
+
genericErrorMessage: {
|
|
242
|
+
type: "string",
|
|
243
|
+
title: "Generic failure message",
|
|
244
|
+
description: "Shown for a network failure and for every refusal the shopper cannot act on.",
|
|
245
|
+
format: "icu-message",
|
|
246
|
+
messageSource: "Unable to update cart. Please try again."
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const CartCouponErrorContent = defineContentType({
|
|
252
|
+
id: "cart-coupon-error",
|
|
253
|
+
title: "Cart Coupon Error",
|
|
254
|
+
description: "Messages shown when a coupon apply or remove is refused, one per error code the shopper can act on.",
|
|
255
|
+
schema: {
|
|
256
|
+
type: "object",
|
|
257
|
+
additionalProperties: false,
|
|
258
|
+
properties: {
|
|
259
|
+
couponNotFoundMessage: {
|
|
260
|
+
type: "string",
|
|
261
|
+
title: "Coupon not found message",
|
|
262
|
+
description: "Shown when the code is unknown or not accepted by this cart.",
|
|
263
|
+
format: "icu-message",
|
|
264
|
+
messageSource: "This coupon is not valid for your cart."
|
|
265
|
+
},
|
|
266
|
+
couponExpiredMessage: {
|
|
267
|
+
type: "string",
|
|
268
|
+
title: "Coupon expired message",
|
|
269
|
+
format: "icu-message",
|
|
270
|
+
messageSource: "This coupon has expired."
|
|
271
|
+
},
|
|
272
|
+
couponNotCombinedMessage: {
|
|
273
|
+
type: "string",
|
|
274
|
+
title: "Coupon not combined message",
|
|
275
|
+
description: "Shown when the code is refused while another coupon is applied. The platform does not say whether the code is unknown or cannot be combined.",
|
|
276
|
+
format: "icu-message",
|
|
277
|
+
messageSource: "This coupon cannot be used with the coupons already applied."
|
|
278
|
+
},
|
|
279
|
+
genericErrorMessage: {
|
|
280
|
+
type: "string",
|
|
281
|
+
title: "Generic failure message",
|
|
282
|
+
description: "Shown for a network failure and for every refusal the shopper cannot act on.",
|
|
283
|
+
format: "icu-message",
|
|
284
|
+
messageSource: "Unable to update your coupons. Please try again."
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
});
|
|
58
289
|
const fragment = graphql(`
|
|
59
290
|
fragment CartData on Query {
|
|
60
291
|
cart {
|
|
@@ -170,6 +401,34 @@ const CartListDefinition = defineComponent({
|
|
|
170
401
|
providesContext: "cart-item",
|
|
171
402
|
guideline: "Renders its children once per cart item; wrap the line-item template in a CartItemRoot and place CartItem* components inside it to define the template (e.g. CartItemImage, CartItemName, CartItemPrice, a CartItemQuantity stepper, CartItemRemove). While the cart is loading it renders skeletonCount CartItemSkeleton placeholders instead. In a mini-cart it is the scrollable body of the DrawerPopup. Must be inside CartRoot."
|
|
172
403
|
});
|
|
404
|
+
const CartAvailableItemsDefinition = defineComponent({
|
|
405
|
+
name: "CartAvailableItems",
|
|
406
|
+
importPath: "@vtex/faststore/components",
|
|
407
|
+
component: CartAvailableItems,
|
|
408
|
+
editor: {
|
|
409
|
+
label: "Cart Available Items",
|
|
410
|
+
category: "commerce"
|
|
411
|
+
},
|
|
412
|
+
schema: { skeletonCount: {
|
|
413
|
+
type: "number",
|
|
414
|
+
default: 3,
|
|
415
|
+
label: "Skeleton Count"
|
|
416
|
+
} },
|
|
417
|
+
providesContext: "cart-item",
|
|
418
|
+
guideline: "Renders its children once per purchasable cart line (availability AVAILABLE); wrap the line-item template in a CartItemRoot. Place it under CartFilled in the place of CartList, together with CartUnavailableSection for the lines the shopper cannot buy; do not compose CartList beside it. Gift lines follow their availability. Renders skeletonCount skeletons while the cart is loading and nothing when no line is purchasable. Must be inside CartRoot. See cart.md."
|
|
419
|
+
});
|
|
420
|
+
const CartUnavailableItemsDefinition = defineComponent({
|
|
421
|
+
name: "CartUnavailableItems",
|
|
422
|
+
importPath: "@vtex/faststore/components",
|
|
423
|
+
component: CartUnavailableItems,
|
|
424
|
+
editor: {
|
|
425
|
+
label: "Cart Unavailable Items",
|
|
426
|
+
category: "commerce"
|
|
427
|
+
},
|
|
428
|
+
schema: {},
|
|
429
|
+
providesContext: "cart-item",
|
|
430
|
+
guideline: "Renders its children once per unavailable cart line (any availability other than AVAILABLE); wrap the line-item template in a CartItemRoot and compose the line leaves (for example CartItemImage, CartItemName, CartItemVariations, CartItemRemove), adding CartItemUnavailable only when the line itself must state its reason. Renders nothing when no line is unavailable or while the cart is loading. Place it inside CartUnavailableSection after its header. Gift lines follow their availability and show no per-line remove. Must be inside CartRoot. See cart.md."
|
|
431
|
+
});
|
|
173
432
|
const CartTotalDefinition = defineComponent({
|
|
174
433
|
name: "CartTotal",
|
|
175
434
|
importPath: "@vtex/faststore/components",
|
|
@@ -188,33 +447,25 @@ const CartCountDefinition = defineComponent({
|
|
|
188
447
|
name: "CartCount",
|
|
189
448
|
importPath: "@vtex/faststore/components",
|
|
190
449
|
component: CartCount,
|
|
450
|
+
content: CartCountContent,
|
|
191
451
|
editor: {
|
|
192
452
|
label: "Cart Count",
|
|
193
453
|
category: "commerce"
|
|
194
454
|
},
|
|
195
|
-
schema: {
|
|
196
|
-
|
|
197
|
-
type: "string",
|
|
198
|
-
default: "{count}",
|
|
199
|
-
label: "Template"
|
|
200
|
-
},
|
|
201
|
-
templateOne: {
|
|
202
|
-
type: "string",
|
|
203
|
-
label: "Template (one)"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
guideline: "Renders the total item count in the cart; use the template prop to customize the format (e.g. '{count} produtos'). Set templateOne (e.g. '{count} produto') to word the count of exactly 1; template covers every other count, including 0, and is also used when templateOne is unset. A count that is not a finite number renders nothing. Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot."
|
|
455
|
+
schema: {},
|
|
456
|
+
guideline: "Renders the total item count in the cart; the text comes from the $content field template, an ICU message with a count argument (e.g. '{count, plural, =1 {# produto} other {# produtos}}'). A count that is not a finite number renders nothing. Gift lines are excluded from the count — a promotional gift is not something the shopper added — so a cart holding only gifts shows 0. In a mini-cart, place it as the badge on the header DrawerTrigger and again in the DrawerPopup header. Must be inside CartRoot."
|
|
207
457
|
});
|
|
208
458
|
const CartErrorDefinition = defineComponent({
|
|
209
459
|
name: "CartError",
|
|
210
460
|
importPath: "@vtex/faststore/components",
|
|
211
461
|
component: CartError,
|
|
462
|
+
content: CartErrorContent,
|
|
212
463
|
editor: {
|
|
213
464
|
label: "Cart Error",
|
|
214
465
|
category: "commerce"
|
|
215
466
|
},
|
|
216
467
|
schema: {},
|
|
217
|
-
guideline: "Inline error banner that surfaces cart
|
|
468
|
+
guideline: "Inline error banner that surfaces cart item write errors; renders nothing when there are none. Words each error code from its $content (genericErrorMessage for a network failure, every refusal the shopper cannot act on, and an unknown code). Authored children replace the message. Must be inside CartRoot."
|
|
218
469
|
});
|
|
219
470
|
const CartGoCheckoutDefinition = defineComponent({
|
|
220
471
|
name: "CartGoCheckout",
|
|
@@ -225,58 +476,39 @@ const CartGoCheckoutDefinition = defineComponent({
|
|
|
225
476
|
label: "Cart Go Checkout",
|
|
226
477
|
category: "commerce"
|
|
227
478
|
},
|
|
228
|
-
schema: {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
label: {
|
|
235
|
-
type: "string",
|
|
236
|
-
default: "Checkout",
|
|
237
|
-
label: "Checkout label"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
479
|
+
schema: { href: {
|
|
480
|
+
type: "link",
|
|
481
|
+
default: { standard: "checkout" },
|
|
482
|
+
label: "Checkout URL"
|
|
483
|
+
} },
|
|
240
484
|
actions: { cart: ["validate"] },
|
|
241
|
-
guideline: "Navigation link to the checkout page (default href the checkout page); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal.
|
|
485
|
+
guideline: "Navigation link to the checkout page (default href the checkout page); use as the checkout CTA inside the cart summary. In a mini-cart it is the DrawerPopup footer CTA, next to CartTotal. Composed children are the button content; without them the text comes from the $content field label. The destination is not content-editable: href stays an authored prop, because re-pointing checkout is not a copy decision. Before routing it runs a stock validation and only navigates when the re-checked cart has no unavailable line; a validation that cannot run falls open and navigates anyway. When it leaves for the checkout it closes the mini-cart drawer it sits in, so do not wrap it in DrawerClose. During a client-side route transition to checkout it surfaces a loading state on its content wrapper as aria-busy plus data-fs-cart-go-checkout-pending, and while the pre-checkout validation runs it exposes data-fs-cart-go-checkout-validating — there is no built-in spinner, so opt into one by styling those attributes (e.g. composing a Spinner). For an external or hard checkout navigation there is no client-side transition, so the loading state simply does not show (a graceful no-op). The enriched footer checkout CTA is CartCheckoutGuard wrapping CartTotal and this CartGoCheckout: the guard makes the CTA inert (data-fs-cart-checkout-blocked) while any item is unavailable, and CartTotal shows the grand total at the button. Must be inside CartRoot."
|
|
242
486
|
});
|
|
243
487
|
const CartCouponFormDefinition = defineComponent({
|
|
244
488
|
name: "CartCouponForm",
|
|
245
489
|
importPath: "@vtex/faststore/components",
|
|
246
490
|
component: CartCouponForm,
|
|
491
|
+
content: CartCouponFormContent,
|
|
247
492
|
editor: {
|
|
248
493
|
label: "Cart Coupon Form",
|
|
249
494
|
category: "commerce"
|
|
250
495
|
},
|
|
251
|
-
schema: {
|
|
252
|
-
placeholder: {
|
|
253
|
-
type: "string",
|
|
254
|
-
label: "Placeholder"
|
|
255
|
-
},
|
|
256
|
-
applyLabel: {
|
|
257
|
-
type: "string",
|
|
258
|
-
label: "Apply Label"
|
|
259
|
-
},
|
|
260
|
-
appliedMessage: {
|
|
261
|
-
type: "string",
|
|
262
|
-
default: "Coupon applied",
|
|
263
|
-
label: "Applied message"
|
|
264
|
-
}
|
|
265
|
-
},
|
|
496
|
+
schema: {},
|
|
266
497
|
actions: { cart: ["applyCoupon"] },
|
|
267
|
-
guideline: "Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). For a single-coupon store, wrap the entry (the accordion holding this form) in CartCouponEmpty so it hides once a code is applied. When an apply returns no errors and the submitted code comes back matched, it raises a toast titled appliedMessage (needs a ToastProvider with a ToastList in the layout; with none, no toast shows and the apply still works). An unmatched code raises no toast; compose CartCouponUnmatched in the chip for that case. The toast still shows when CartCouponEmpty removes the form. Must be inside CartRoot."
|
|
498
|
+
guideline: "Coupon code input plus an apply button; root-agnostic (dispatches $actions.cart.applyCoupon). While an apply is in flight it disables the input and button and exposes data-fs-cart-coupon-pending. In a mini-cart it sits in the DrawerPopup footer above the totals; pair it with CartAppliedCoupons (the applied list) and CartCouponError (the error banner). For a single-coupon store, wrap the entry (the accordion holding this form) in CartCouponEmpty so it hides once a code is applied. When an apply returns no errors and the submitted code comes back matched, it raises a toast titled by the $content field appliedMessage (needs a ToastProvider with a ToastList in the layout; with none, no toast shows and the apply still works). An unmatched code raises no toast; compose CartCouponUnmatched in the chip for that case. The toast still shows when CartCouponEmpty removes the form. Must be inside CartRoot."
|
|
268
499
|
});
|
|
269
500
|
const CartAppliedCouponsDefinition = defineComponent({
|
|
270
501
|
name: "CartAppliedCoupons",
|
|
271
502
|
importPath: "@vtex/faststore/components",
|
|
272
503
|
component: CartAppliedCoupons,
|
|
504
|
+
content: CartAppliedCouponsContent,
|
|
273
505
|
editor: {
|
|
274
506
|
label: "Cart Applied Coupons",
|
|
275
507
|
category: "commerce"
|
|
276
508
|
},
|
|
277
509
|
schema: {},
|
|
278
510
|
actions: { cart: ["removeCoupon"] },
|
|
279
|
-
guideline: "Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control; renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Composed children replace the built-in remove control, so a chip template that adds CartCouponUnmatched (the unmatched-coupon notice) or CartCouponSavings (the amount the coupon saves) must also compose CartCouponRemove. Must be inside CartRoot."
|
|
511
|
+
guideline: "Renders one chip per applied coupon (cart.appliedCoupons), each showing its code and a CartCouponRemove control (named by the $content field removeLabel); renders nothing when no coupons are applied. A coupon whose conditions did not match is marked with data-fs-cart-coupon-unmatched. Place it next to CartCouponForm in the mini-cart footer. Composed children replace the built-in remove control, so a chip template that adds CartCouponUnmatched (the unmatched-coupon notice) or CartCouponSavings (the amount the coupon saves) must also compose CartCouponRemove. Must be inside CartRoot."
|
|
280
512
|
});
|
|
281
513
|
const CartCouponRemoveDefinition = defineComponent({
|
|
282
514
|
name: "CartCouponRemove",
|
|
@@ -297,12 +529,13 @@ const CartCouponErrorDefinition = defineComponent({
|
|
|
297
529
|
name: "CartCouponError",
|
|
298
530
|
importPath: "@vtex/faststore/components",
|
|
299
531
|
component: CartCouponError,
|
|
532
|
+
content: CartCouponErrorContent,
|
|
300
533
|
editor: {
|
|
301
534
|
label: "Cart Coupon Error",
|
|
302
535
|
category: "commerce"
|
|
303
536
|
},
|
|
304
537
|
schema: {},
|
|
305
|
-
guideline: "Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Must be inside CartRoot."
|
|
538
|
+
guideline: "Inline error banner that surfaces coupon apply/remove errors next to the CartCouponForm; renders nothing when there are none. Reads a dedicated coupon error channel, separate from CartError. Words each error code from its $content (genericErrorMessage for a network failure, every refusal the shopper cannot act on, and an unknown code). Authored children replace the message. Must be inside CartRoot."
|
|
306
539
|
});
|
|
307
540
|
const CartCouponEmptyDefinition = defineComponent({
|
|
308
541
|
name: "CartCouponEmpty",
|
|
@@ -319,31 +552,25 @@ const CartCouponUnmatchedDefinition = defineComponent({
|
|
|
319
552
|
name: "CartCouponUnmatched",
|
|
320
553
|
importPath: "@vtex/faststore/components",
|
|
321
554
|
component: CartCouponUnmatched,
|
|
555
|
+
content: CartCouponUnmatchedContent,
|
|
322
556
|
editor: {
|
|
323
557
|
label: "Cart Coupon Unmatched",
|
|
324
558
|
category: "commerce"
|
|
325
559
|
},
|
|
326
|
-
schema: {
|
|
327
|
-
|
|
328
|
-
default: "This coupon is not being applied to your cart",
|
|
329
|
-
label: "Message"
|
|
330
|
-
} },
|
|
331
|
-
guideline: "Per-chip notice for an applied coupon that grants nothing: renders the message copy in an <output> live region only while the enclosing chip's coupon has isUnmatchedCondition (its conditions stopped matching, were never met, or the code was accepted without validation), and nothing once it matches again, outside a chip, or when the copy is blank. Place it inside CartAppliedCoupons next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. It does not remove the coupon; the shopper removes it with the X. See cart.md."
|
|
560
|
+
schema: {},
|
|
561
|
+
guideline: "Per-chip notice for an applied coupon that grants nothing: renders the $content field message in an <output> live region only while the enclosing chip's coupon has isUnmatchedCondition (its conditions stopped matching, were never met, or the code was accepted without validation), and nothing once it matches again, outside a chip, or when the copy is blank. Place it inside CartAppliedCoupons next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. It does not remove the coupon; the shopper removes it with the X. See cart.md."
|
|
332
562
|
});
|
|
333
563
|
const CartCouponSavingsDefinition = defineComponent({
|
|
334
564
|
name: "CartCouponSavings",
|
|
335
565
|
importPath: "@vtex/faststore/components",
|
|
336
566
|
component: CartCouponSavings,
|
|
567
|
+
content: CartCouponSavingsContent,
|
|
337
568
|
editor: {
|
|
338
569
|
label: "Cart Coupon Savings",
|
|
339
570
|
category: "commerce"
|
|
340
571
|
},
|
|
341
|
-
schema: {
|
|
342
|
-
|
|
343
|
-
default: "{amount}",
|
|
344
|
-
label: "Template"
|
|
345
|
-
} },
|
|
346
|
-
guideline: "Per-chip amount a fixed-amount coupon took off, summed from cart.discounts for the enclosing chip's code. Renders nothing for an unmatched, free-shipping or percentage coupon (the API attributes no amount to them), outside a chip, or when the sum is not above zero. Set template to word the chip text, e.g. 'Economia de {amount}' or '{code} — Economia de {amount}': every {amount} becomes the saving and every {code} the chip's code; the default is '{amount}' and a blank template counts as unset. The chip already shows the code before its children, so {code} repeats it. Place it inside a CartAppliedCoupons chip template next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. Must be inside CartRoot. See cart.md."
|
|
572
|
+
schema: {},
|
|
573
|
+
guideline: "Per-chip amount a fixed-amount coupon took off, summed from cart.discounts for the enclosing chip's code. Renders nothing for an unmatched, free-shipping or percentage coupon (the API attributes no amount to them), outside a chip, or when the sum is not above zero. The chip text is the $content field template, an ICU message whose {amount} argument is the formatted saving, e.g. '{amount}' or 'Economia de {amount}'. The chip already shows the code before its children. Place it inside a CartAppliedCoupons chip template next to CartCouponRemove: composed children replace the built-in remove control, so a chip template without CartCouponRemove loses the X. Must be inside CartRoot. See cart.md."
|
|
347
574
|
});
|
|
348
575
|
const useIsomorphicLayoutEffect = globalThis.window === void 0 ? useEffect : useLayoutEffect;
|
|
349
576
|
function CartRoot({ $data: $dataProp, $actions: $actionsProp, className, children, ...props }) {
|
|
@@ -401,6 +628,52 @@ function CartList({ className, children, skeletonCount = 3, ...props }) {
|
|
|
401
628
|
}, item.id))
|
|
402
629
|
});
|
|
403
630
|
}
|
|
631
|
+
function CartLines({ items, className, children, attribute, rest }) {
|
|
632
|
+
return /* @__PURE__ */ jsx("div", {
|
|
633
|
+
...rest,
|
|
634
|
+
className,
|
|
635
|
+
...attribute,
|
|
636
|
+
children: items.map((item) => /* @__PURE__ */ jsx(ListItemRefContext, {
|
|
637
|
+
value: {
|
|
638
|
+
__typename: "CartItem",
|
|
639
|
+
id: item.id,
|
|
640
|
+
fallbackData: item
|
|
641
|
+
},
|
|
642
|
+
children
|
|
643
|
+
}, item.id))
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function CartAvailableItems({ className, children, skeletonCount = 3, ...props }) {
|
|
647
|
+
const { cart } = useCart();
|
|
648
|
+
const { loading } = useContext(ReactiveRootContext);
|
|
649
|
+
if (loading && cart == null) return /* @__PURE__ */ jsx("div", {
|
|
650
|
+
...props,
|
|
651
|
+
className,
|
|
652
|
+
"data-fs-cart-available-items": "",
|
|
653
|
+
children: Array.from({ length: skeletonCount }, (_, i) => /* @__PURE__ */ jsx(CartItemSkeleton, {}, i))
|
|
654
|
+
});
|
|
655
|
+
const items = (cart?.items ?? []).filter((item) => !isUnavailable(item));
|
|
656
|
+
if (items.length === 0) return null;
|
|
657
|
+
return /* @__PURE__ */ jsx(CartLines, {
|
|
658
|
+
items,
|
|
659
|
+
className,
|
|
660
|
+
attribute: { "data-fs-cart-available-items": "" },
|
|
661
|
+
rest: props,
|
|
662
|
+
children
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
function CartUnavailableItems({ className, children, ...props }) {
|
|
666
|
+
const { cart } = useCart();
|
|
667
|
+
const items = (cart?.items ?? []).filter(isUnavailable);
|
|
668
|
+
if (items.length === 0) return null;
|
|
669
|
+
return /* @__PURE__ */ jsx(CartLines, {
|
|
670
|
+
items,
|
|
671
|
+
className,
|
|
672
|
+
attribute: { "data-fs-cart-unavailable-items": "" },
|
|
673
|
+
rest: props,
|
|
674
|
+
children
|
|
675
|
+
});
|
|
676
|
+
}
|
|
404
677
|
function CartTotal({ label, className, children, ...props }) {
|
|
405
678
|
const total = useContext(CartTotalValueContext);
|
|
406
679
|
const { locale, currency } = useStorefrontContext();
|
|
@@ -413,20 +686,13 @@ function CartTotal({ label, className, children, ...props }) {
|
|
|
413
686
|
children: label == null ? value : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", { children: label }), /* @__PURE__ */ jsx("span", { children: value })] })
|
|
414
687
|
});
|
|
415
688
|
}
|
|
416
|
-
/**
|
|
417
|
-
* Fills `{count}` in the template for the count. `templateOne` is used only at exactly 1 and only when
|
|
418
|
-
* it is not blank. A count that is not a finite number yields `null`.
|
|
419
|
-
*/
|
|
420
|
-
function formatCount(count, template, templateOne) {
|
|
421
|
-
if (!Number.isFinite(count)) return null;
|
|
422
|
-
return (count === 1 && templateOne?.trim() ? templateOne : template).replace("{count}", String(count));
|
|
423
|
-
}
|
|
424
689
|
function addToCount(sum, item) {
|
|
425
690
|
if (item.gift) return sum;
|
|
426
691
|
return Number.isFinite(item.quantity) ? sum + item.quantity : NaN;
|
|
427
692
|
}
|
|
428
|
-
function CartCount({ className, children,
|
|
693
|
+
function CartCount({ className, children, $content, $locale, ...props }) {
|
|
429
694
|
const { cart } = useCart();
|
|
695
|
+
const { format } = useMessageFormatter(CartCountContent, $content);
|
|
430
696
|
const count = cart?.items.reduce(addToCount, 0) ?? 0;
|
|
431
697
|
if (!Number.isFinite(count)) return null;
|
|
432
698
|
return /* @__PURE__ */ jsx("span", {
|
|
@@ -434,11 +700,37 @@ function CartCount({ className, children, template = "{count}", templateOne, ...
|
|
|
434
700
|
className,
|
|
435
701
|
"data-fs-cart-count": "",
|
|
436
702
|
"data-fs-text": "",
|
|
437
|
-
children: children ??
|
|
703
|
+
children: children ?? format("template", { count })
|
|
438
704
|
});
|
|
439
705
|
}
|
|
440
|
-
|
|
441
|
-
|
|
706
|
+
/**
|
|
707
|
+
* The message for each code an item write can publish: the five item mutations' codes plus the
|
|
708
|
+
* client-minted transport failure. A code this map does not know (a newer server) shows genericErrorMessage.
|
|
709
|
+
*/
|
|
710
|
+
const CART_ERROR_FIELDS = {
|
|
711
|
+
INVALID_QUANTITY: "invalidQuantityMessage",
|
|
712
|
+
ITEM_NOT_FOUND: "itemNotFoundMessage",
|
|
713
|
+
MISSING_CART_CONTEXT: "genericErrorMessage",
|
|
714
|
+
CART_NOT_FOUND: "genericErrorMessage",
|
|
715
|
+
INVALID_VARIANT_ID: "genericErrorMessage",
|
|
716
|
+
INVALID_SELLER_ID: "genericErrorMessage",
|
|
717
|
+
NO_LINE_IDS_PROVIDED: "genericErrorMessage",
|
|
718
|
+
UPSTREAM_ERROR: "genericErrorMessage",
|
|
719
|
+
NETWORK_ERROR: "genericErrorMessage"
|
|
720
|
+
};
|
|
721
|
+
/** The message for each code a coupon write can publish, plus the client-minted transport failure. */
|
|
722
|
+
const CART_COUPON_ERROR_FIELDS = {
|
|
723
|
+
COUPON_NOT_FOUND: "couponNotFoundMessage",
|
|
724
|
+
COUPON_EXPIRED: "couponExpiredMessage",
|
|
725
|
+
COUPON_NOT_COMBINED: "couponNotCombinedMessage",
|
|
726
|
+
MISSING_CART_CONTEXT: "genericErrorMessage",
|
|
727
|
+
CART_NOT_FOUND: "genericErrorMessage",
|
|
728
|
+
NETWORK_ERROR: "genericErrorMessage"
|
|
729
|
+
};
|
|
730
|
+
function CartError({ $content, $locale, className, children, ...props }) {
|
|
731
|
+
const userErrors = useReactiveVar(cartUserErrorsVar);
|
|
732
|
+
const { format } = useMessageFormatter(CartErrorContent, $content);
|
|
733
|
+
const [firstError] = userErrors;
|
|
442
734
|
if (!firstError) return null;
|
|
443
735
|
return /* @__PURE__ */ jsx("div", {
|
|
444
736
|
...props,
|
|
@@ -446,7 +738,7 @@ function CartError({ className, children, ...props }) {
|
|
|
446
738
|
className,
|
|
447
739
|
"data-fs-cart-error": "",
|
|
448
740
|
"data-fs-text": "",
|
|
449
|
-
children: children ?? firstError
|
|
741
|
+
children: children ?? formatErrorCode(CartErrorContent, CART_ERROR_FIELDS, firstError, format, "genericErrorMessage")
|
|
450
742
|
});
|
|
451
743
|
}
|
|
452
744
|
function CartGoCheckoutPending({ children }) {
|
|
@@ -463,19 +755,29 @@ function configuredLabel(value) {
|
|
|
463
755
|
}
|
|
464
756
|
/** The default destination of both checkout navigations. Module-level, so an effect keyed on it is stable. */
|
|
465
757
|
const CHECKOUT_PAGE = { standard: "checkout" };
|
|
466
|
-
function
|
|
758
|
+
function isPlainLeftClick(e) {
|
|
759
|
+
return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey;
|
|
760
|
+
}
|
|
761
|
+
function CartGoCheckout({ href = CHECKOUT_PAGE, className, children, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
|
|
467
762
|
const $actions = useActionsOverride($actionsProp);
|
|
763
|
+
const { format } = useMessageFormatter(CartCheckoutLabelContent, $content);
|
|
468
764
|
const client = useApolloClient();
|
|
469
765
|
const { push } = useStorefrontNavigation();
|
|
470
766
|
const [validating, setValidating] = useState(false);
|
|
471
767
|
const inFlight = useRef(false);
|
|
472
|
-
const
|
|
473
|
-
|
|
768
|
+
const resolvedLabel = (typeof children === "string" ? configuredLabel(children) : children) ?? format("label");
|
|
769
|
+
function leave() {
|
|
770
|
+
miniCartOpenVar(false);
|
|
771
|
+
push(href);
|
|
772
|
+
}
|
|
474
773
|
async function handleClick(e) {
|
|
475
774
|
onClick?.(e);
|
|
775
|
+
if (!isPlainLeftClick(e)) return;
|
|
476
776
|
const validate = $actions?.cart?.validate;
|
|
477
|
-
if (!validate)
|
|
478
|
-
|
|
777
|
+
if (!validate) {
|
|
778
|
+
miniCartOpenVar(false);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
479
781
|
e.preventDefault();
|
|
480
782
|
if (inFlight.current) return;
|
|
481
783
|
inFlight.current = true;
|
|
@@ -483,10 +785,10 @@ function CartGoCheckout({ href = CHECKOUT_PAGE, label, className, children, onCl
|
|
|
483
785
|
try {
|
|
484
786
|
await awaitCartWrites();
|
|
485
787
|
if ((await validate()).length > 0) {
|
|
486
|
-
|
|
788
|
+
leave();
|
|
487
789
|
return;
|
|
488
790
|
}
|
|
489
|
-
if (!(readCartFromCache(client)?.items ?? []).some((item) => item.variant.availability !== "AVAILABLE"))
|
|
791
|
+
if (!(readCartFromCache(client)?.items ?? []).some((item) => item.variant.availability !== "AVAILABLE")) leave();
|
|
490
792
|
} finally {
|
|
491
793
|
inFlight.current = false;
|
|
492
794
|
setValidating(false);
|
|
@@ -502,8 +804,9 @@ function CartGoCheckout({ href = CHECKOUT_PAGE, label, className, children, onCl
|
|
|
502
804
|
children: /* @__PURE__ */ jsx(CartGoCheckoutPending, { children: resolvedLabel })
|
|
503
805
|
});
|
|
504
806
|
}
|
|
505
|
-
function CartCouponForm({
|
|
807
|
+
function CartCouponForm({ className, children, onSubmit, $content, $locale, $actions: $actionsProp, ...props }) {
|
|
506
808
|
const $actions = useActionsOverride($actionsProp);
|
|
809
|
+
const { format } = useMessageFormatter(CartCouponFormContent, $content);
|
|
507
810
|
const toast = useOptionalToast();
|
|
508
811
|
const { client } = useContext(getApolloContext());
|
|
509
812
|
const [code, setCode] = useState("");
|
|
@@ -517,10 +820,11 @@ function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", app
|
|
|
517
820
|
try {
|
|
518
821
|
const errors = await $actions?.cart?.applyCoupon?.({ code: trimmed });
|
|
519
822
|
if (!errors || errors.length === 0) setCode("");
|
|
520
|
-
if (errors?.length === 0 && client &&
|
|
823
|
+
if (errors?.length === 0 && client && toast) {
|
|
521
824
|
const submitted = trimmed.toLowerCase();
|
|
522
|
-
|
|
523
|
-
|
|
825
|
+
const title = (readCartFromCache(client)?.appliedCoupons ?? []).some((coupon) => coupon.code.trim().toLowerCase() === submitted && coupon.isUnmatchedCondition === false) ? format("appliedMessage") : "";
|
|
826
|
+
if (title) toast.add({
|
|
827
|
+
title,
|
|
524
828
|
type: "success"
|
|
525
829
|
});
|
|
526
830
|
}
|
|
@@ -528,6 +832,7 @@ function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", app
|
|
|
528
832
|
setPending(false);
|
|
529
833
|
}
|
|
530
834
|
}
|
|
835
|
+
const placeholder = children == null ? format("placeholder") : void 0;
|
|
531
836
|
return /* @__PURE__ */ jsx("form", {
|
|
532
837
|
...props,
|
|
533
838
|
className,
|
|
@@ -547,12 +852,13 @@ function CartCouponForm({ placeholder = "Coupon code", applyLabel = "Apply", app
|
|
|
547
852
|
disabled: pending,
|
|
548
853
|
"data-fs-cart-coupon-apply": "",
|
|
549
854
|
"data-fs-button": "",
|
|
550
|
-
children: applyLabel
|
|
855
|
+
children: format("applyLabel")
|
|
551
856
|
})] })
|
|
552
857
|
});
|
|
553
858
|
}
|
|
554
|
-
function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...props }) {
|
|
859
|
+
function CartAppliedCoupons({ className, children, $content, $locale, $actions: $actionsProp, ...props }) {
|
|
555
860
|
const $actions = useActionsOverride($actionsProp);
|
|
861
|
+
const { format } = useMessageFormatter(CartAppliedCouponsContent, $content);
|
|
556
862
|
const { cart } = useCart();
|
|
557
863
|
const coupons = cart?.appliedCoupons ?? [];
|
|
558
864
|
if (coupons.length === 0) return null;
|
|
@@ -564,12 +870,13 @@ function CartAppliedCoupons({ className, children, $actions: $actionsProp, ...pr
|
|
|
564
870
|
value: coupon,
|
|
565
871
|
children: /* @__PURE__ */ jsx(CartCouponChip, {
|
|
566
872
|
$actions,
|
|
873
|
+
removeLabel: children == null ? format("removeLabel", { code: coupon.code }) : void 0,
|
|
567
874
|
children
|
|
568
875
|
})
|
|
569
876
|
}, coupon.code))
|
|
570
877
|
});
|
|
571
878
|
}
|
|
572
|
-
function CartCouponChip({ children, $actions }) {
|
|
879
|
+
function CartCouponChip({ children, removeLabel, $actions }) {
|
|
573
880
|
const coupon = useContext(CartCouponContext);
|
|
574
881
|
if (!coupon) return null;
|
|
575
882
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -581,7 +888,7 @@ function CartCouponChip({ children, $actions }) {
|
|
|
581
888
|
children: coupon.code
|
|
582
889
|
}), children ?? /* @__PURE__ */ jsx(CartCouponRemove, {
|
|
583
890
|
$actions,
|
|
584
|
-
"aria-label":
|
|
891
|
+
"aria-label": removeLabel,
|
|
585
892
|
children: "×"
|
|
586
893
|
})]
|
|
587
894
|
});
|
|
@@ -604,8 +911,10 @@ function CartCouponRemove({ code, className, children, onClick, $actions: $actio
|
|
|
604
911
|
children
|
|
605
912
|
});
|
|
606
913
|
}
|
|
607
|
-
function CartCouponError({ className, children, ...props }) {
|
|
608
|
-
const
|
|
914
|
+
function CartCouponError({ $content, $locale, className, children, ...props }) {
|
|
915
|
+
const couponErrors = useReactiveVar(cartCouponErrorsVar);
|
|
916
|
+
const { format } = useMessageFormatter(CartCouponErrorContent, $content);
|
|
917
|
+
const [firstError] = couponErrors;
|
|
609
918
|
if (!firstError) return null;
|
|
610
919
|
return /* @__PURE__ */ jsx("div", {
|
|
611
920
|
...props,
|
|
@@ -613,7 +922,7 @@ function CartCouponError({ className, children, ...props }) {
|
|
|
613
922
|
className,
|
|
614
923
|
"data-fs-cart-coupon-error": "",
|
|
615
924
|
"data-fs-text": "",
|
|
616
|
-
children: children ?? firstError
|
|
925
|
+
children: children ?? formatErrorCode(CartCouponErrorContent, CART_COUPON_ERROR_FIELDS, firstError, format, "genericErrorMessage")
|
|
617
926
|
});
|
|
618
927
|
}
|
|
619
928
|
function CartCouponEmpty({ className, children, ...props }) {
|
|
@@ -626,28 +935,25 @@ function CartCouponEmpty({ className, children, ...props }) {
|
|
|
626
935
|
children
|
|
627
936
|
});
|
|
628
937
|
}
|
|
629
|
-
function CartCouponUnmatched({
|
|
630
|
-
|
|
631
|
-
|
|
938
|
+
function CartCouponUnmatched({ className, children, $content, $locale, ...props }) {
|
|
939
|
+
const coupon = useContext(CartCouponContext);
|
|
940
|
+
const { format } = useMessageFormatter(CartCouponUnmatchedContent, $content);
|
|
941
|
+
if (coupon?.isUnmatchedCondition !== true) return null;
|
|
942
|
+
const notice = children ?? format("message");
|
|
943
|
+
if (notice === "") return null;
|
|
632
944
|
return /* @__PURE__ */ jsx("output", {
|
|
633
945
|
...props,
|
|
634
946
|
className,
|
|
635
947
|
"data-fs-cart-coupon-unmatched-notice": "",
|
|
636
948
|
"data-fs-text": "",
|
|
637
|
-
children:
|
|
949
|
+
children: notice
|
|
638
950
|
});
|
|
639
951
|
}
|
|
640
|
-
|
|
641
|
-
* Fills every `{code}` and `{amount}` in one pass. A function replacer keeps `$` sequences in the
|
|
642
|
-
* values literal, and a substituted value is never scanned again for placeholders.
|
|
643
|
-
*/
|
|
644
|
-
function fillCouponTemplate(template, { code, amount }) {
|
|
645
|
-
return template.replaceAll(/\{(code|amount)\}/g, (_, key) => key === "code" ? code : amount);
|
|
646
|
-
}
|
|
647
|
-
function CartCouponSavings({ className, template = "{amount}", ...props }) {
|
|
952
|
+
function CartCouponSavings({ className, $content, $locale, ...props }) {
|
|
648
953
|
const coupon = useContext(CartCouponContext);
|
|
649
954
|
const { cart } = useCart();
|
|
650
955
|
const { locale, currency } = useStorefrontContext();
|
|
956
|
+
const { format } = useMessageFormatter(CartCouponSavingsContent, $content);
|
|
651
957
|
if (!cart || !coupon || coupon.isUnmatchedCondition || coupon.code === "") return null;
|
|
652
958
|
const saved = cart.discounts.reduce((sum, discount) => discount.kind === "COUPON" && discount.name === coupon.code && isFiniteAmount(discount.value.amount) ? sum + Number(discount.value.amount) : sum, 0);
|
|
653
959
|
if (saved <= 0) return null;
|
|
@@ -656,10 +962,7 @@ function CartCouponSavings({ className, template = "{amount}", ...props }) {
|
|
|
656
962
|
className,
|
|
657
963
|
"data-fs-cart-coupon-savings": "",
|
|
658
964
|
"data-fs-text": "",
|
|
659
|
-
children:
|
|
660
|
-
code: coupon.code,
|
|
661
|
-
amount: formatPrice(-saved, locale, currency)
|
|
662
|
-
})
|
|
965
|
+
children: format("template", { amount: formatPrice(-saved, locale, currency) })
|
|
663
966
|
});
|
|
664
967
|
}
|
|
665
968
|
const CartCheckoutGuardDefinition = defineComponent({
|
|
@@ -704,52 +1007,45 @@ const CartFilledDefinition = defineComponent({
|
|
|
704
1007
|
category: "commerce"
|
|
705
1008
|
},
|
|
706
1009
|
schema: {},
|
|
707
|
-
guideline: "The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList, the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md."
|
|
1010
|
+
guideline: "The filled branch of the three-state mini-cart (loading / empty / filled): renders its children only when the cart has one or more items. Wrap the CartList (or the CartAvailableItems and CartUnavailableItems pair that replaces it, the latter inside a CartUnavailableSection with a CartUnavailableLabel), the order summary, and the checkout CTA in it so they hide when the cart is empty. Pair with CartLoading and CartEmpty. Must be inside CartRoot. See cart.md."
|
|
708
1011
|
});
|
|
709
1012
|
const CartUnavailableCountDefinition = defineComponent({
|
|
710
1013
|
name: "CartUnavailableCount",
|
|
711
1014
|
importPath: "@vtex/faststore/components",
|
|
712
1015
|
component: CartUnavailableCount,
|
|
1016
|
+
content: CartUnavailableCountContent,
|
|
713
1017
|
editor: {
|
|
714
1018
|
label: "Cart Unavailable Count",
|
|
715
1019
|
category: "commerce"
|
|
716
1020
|
},
|
|
717
|
-
schema: {
|
|
718
|
-
|
|
719
|
-
type: "string",
|
|
720
|
-
default: "{count} items unavailable",
|
|
721
|
-
label: "Template"
|
|
722
|
-
},
|
|
723
|
-
templateOne: {
|
|
724
|
-
type: "string",
|
|
725
|
-
label: "Template (one)"
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
guideline: "Cart-level summary of how many lines are unavailable; self-hides when none. Set templateOne to word the count of exactly 1 line; template covers every other count, including 0, and is also used when templateOne is unset. See cart.md."
|
|
1021
|
+
schema: {},
|
|
1022
|
+
guideline: "Cart-level summary of how many lines are unavailable; self-hides when none. The text is the $content field template, an ICU message with a count argument. See cart.md."
|
|
729
1023
|
});
|
|
730
1024
|
const CartRemoveUnavailableDefinition = defineComponent({
|
|
731
1025
|
name: "CartRemoveUnavailable",
|
|
732
1026
|
importPath: "@vtex/faststore/components",
|
|
733
1027
|
component: CartRemoveUnavailable,
|
|
1028
|
+
content: CartRemoveUnavailableContent,
|
|
734
1029
|
editor: {
|
|
735
1030
|
label: "Cart Remove Unavailable",
|
|
736
1031
|
category: "commerce"
|
|
737
1032
|
},
|
|
738
1033
|
schema: {},
|
|
739
1034
|
actions: { cart: ["removeItems"] },
|
|
740
|
-
guideline: "Button that removes every unavailable line in one batch call; self-hides when none. See cart.md."
|
|
1035
|
+
guideline: "Button that removes every unavailable line in one batch call; self-hides when none. Composed children are the label; without them it is the $content field label. See cart.md."
|
|
741
1036
|
});
|
|
742
1037
|
const ClearCartButtonDefinition = defineComponent({
|
|
743
1038
|
name: "ClearCartButton",
|
|
744
1039
|
importPath: "@vtex/faststore/components",
|
|
745
1040
|
component: ClearCartButton,
|
|
1041
|
+
content: ClearCartButtonContent,
|
|
746
1042
|
editor: {
|
|
747
1043
|
label: "Clear Cart Button",
|
|
748
1044
|
category: "commerce"
|
|
749
1045
|
},
|
|
750
1046
|
schema: {},
|
|
751
1047
|
actions: { cart: ["removeItems"] },
|
|
752
|
-
guideline: "Button that removes every line in the cart (gift and unavailable lines included) in one batch call; self-hides when the cart has no lines. Disabled, with data-fs-clear-cart-button-pending, while the call is in flight. No confirmation and no toast. The write is optimistic: CartEmpty replaces CartFilled as soon as it is clicked; on failure the lines come back and the error shows in CartError, so compose a CartError outside the CartFilled/CartEmpty branches.
|
|
1048
|
+
guideline: "Button that removes every line in the cart (gift and unavailable lines included) in one batch call; self-hides when the cart has no lines. Disabled, with data-fs-clear-cart-button-pending, while the call is in flight. No confirmation and no toast. The write is optimistic: CartEmpty replaces CartFilled as soon as it is clicked; on failure the lines come back and the error shows in CartError, so compose a CartError outside the CartFilled/CartEmpty branches. Composed children are the label; without them it is the $content field label. Must be inside CartRoot. See cart.md."
|
|
753
1049
|
});
|
|
754
1050
|
function isUnavailable(item) {
|
|
755
1051
|
return item.variant.availability !== "AVAILABLE";
|
|
@@ -767,8 +1063,9 @@ function CartCheckoutGuard({ className, children, ...props }) {
|
|
|
767
1063
|
children
|
|
768
1064
|
});
|
|
769
1065
|
}
|
|
770
|
-
function CartUnavailableCount({ className, children,
|
|
1066
|
+
function CartUnavailableCount({ className, children, $content, $locale, ...props }) {
|
|
771
1067
|
const { cart } = useCart();
|
|
1068
|
+
const { format } = useMessageFormatter(CartUnavailableCountContent, $content);
|
|
772
1069
|
const count = (cart?.items ?? []).filter(isUnavailable).length;
|
|
773
1070
|
if (count === 0) return null;
|
|
774
1071
|
return /* @__PURE__ */ jsx("span", {
|
|
@@ -776,11 +1073,12 @@ function CartUnavailableCount({ className, children, template = "{count} items u
|
|
|
776
1073
|
className,
|
|
777
1074
|
"data-fs-cart-unavailable-count": "",
|
|
778
1075
|
"data-fs-text": "",
|
|
779
|
-
children: children ??
|
|
1076
|
+
children: children ?? format("template", { count })
|
|
780
1077
|
});
|
|
781
1078
|
}
|
|
782
|
-
function CartRemoveUnavailable({ className, children, onClick, $actions: $actionsProp, ...props }) {
|
|
1079
|
+
function CartRemoveUnavailable({ className, children, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
|
|
783
1080
|
const $actions = useActionsOverride($actionsProp);
|
|
1081
|
+
const { format } = useMessageFormatter(CartRemoveUnavailableContent, $content);
|
|
784
1082
|
const { cart } = useCart();
|
|
785
1083
|
const unavailableIds = (cart?.items ?? []).filter(isUnavailable).map((item) => item.id);
|
|
786
1084
|
if (unavailableIds.length === 0) return null;
|
|
@@ -795,11 +1093,190 @@ function CartRemoveUnavailable({ className, children, onClick, $actions: $action
|
|
|
795
1093
|
onClick: handleClick,
|
|
796
1094
|
"data-fs-cart-remove-unavailable": "",
|
|
797
1095
|
"data-fs-button": "",
|
|
798
|
-
children: children ?? "
|
|
1096
|
+
children: children ?? format("label")
|
|
799
1097
|
});
|
|
800
1098
|
}
|
|
801
|
-
|
|
1099
|
+
const CartUnavailableLabelContent = defineContentType({
|
|
1100
|
+
id: "cart-unavailable-label",
|
|
1101
|
+
title: "Cart Unavailable Label",
|
|
1102
|
+
description: "Heading copy of the cart section that holds the lines the shopper cannot buy.",
|
|
1103
|
+
schema: {
|
|
1104
|
+
type: "object",
|
|
1105
|
+
additionalProperties: false,
|
|
1106
|
+
properties: { text: {
|
|
1107
|
+
type: "string",
|
|
1108
|
+
title: "Unavailable section label",
|
|
1109
|
+
format: "icu-message",
|
|
1110
|
+
messageSource: "Unavailable"
|
|
1111
|
+
} }
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
const CartUnavailableSectionDefinition = defineComponent({
|
|
1115
|
+
name: "CartUnavailableSection",
|
|
1116
|
+
importPath: "@vtex/faststore/components",
|
|
1117
|
+
component: CartUnavailableSection,
|
|
1118
|
+
editor: {
|
|
1119
|
+
label: "Cart Unavailable Section",
|
|
1120
|
+
category: "commerce"
|
|
1121
|
+
},
|
|
1122
|
+
schema: {},
|
|
1123
|
+
guideline: "Renders its children only when at least one cart line is unavailable, so the section card, header and list disappear together; it carries no copy (compose CartUnavailableLabel and CartUnavailableItems inside it). Pair with CartAvailableItems under CartFilled. Must be inside CartRoot. See cart.md."
|
|
1124
|
+
});
|
|
1125
|
+
const CartUnavailableLabelDefinition = defineComponent({
|
|
1126
|
+
name: "CartUnavailableLabel",
|
|
1127
|
+
importPath: "@vtex/faststore/components",
|
|
1128
|
+
component: CartUnavailableLabel,
|
|
1129
|
+
content: CartUnavailableLabelContent,
|
|
1130
|
+
editor: {
|
|
1131
|
+
label: "Cart Unavailable Label",
|
|
1132
|
+
category: "commerce"
|
|
1133
|
+
},
|
|
1134
|
+
schema: {},
|
|
1135
|
+
guideline: "Heading copy of the unavailable section, rendered as plain text from the $content field text; blank copy renders nothing. It renders only while at least one line is unavailable. Compose one inside CartUnavailableSection as its header, grouped with an Icon in a Container when the header carries one. Must be inside CartRoot. See cart.md."
|
|
1136
|
+
});
|
|
1137
|
+
function CartUnavailableSection({ className, children, ...props }) {
|
|
1138
|
+
const { cart } = useCart();
|
|
1139
|
+
if (!cart?.items.some(isUnavailable)) return null;
|
|
1140
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1141
|
+
...props,
|
|
1142
|
+
className,
|
|
1143
|
+
"data-fs-cart-unavailable-section": "",
|
|
1144
|
+
children
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
function CartUnavailableLabel({ $content, $locale, className, ...props }) {
|
|
1148
|
+
const { cart } = useCart();
|
|
1149
|
+
const { format } = useMessageFormatter(CartUnavailableLabelContent, $content);
|
|
1150
|
+
if (!cart?.items.some(isUnavailable)) return null;
|
|
1151
|
+
const copy = format("text");
|
|
1152
|
+
if (!copy.trim()) return null;
|
|
1153
|
+
return /* @__PURE__ */ jsx("p", {
|
|
1154
|
+
...props,
|
|
1155
|
+
className,
|
|
1156
|
+
"data-fs-cart-unavailable-label": "",
|
|
1157
|
+
"data-fs-text": "",
|
|
1158
|
+
children: copy
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
const CartAllUnavailableMessageContent = defineContentType({
|
|
1162
|
+
id: "cart-all-unavailable-message",
|
|
1163
|
+
title: "Cart All Unavailable Message",
|
|
1164
|
+
description: "Warning shown in the cart when none of the lines the shopper added can be bought, with an optional link.",
|
|
1165
|
+
schema: {
|
|
1166
|
+
type: "object",
|
|
1167
|
+
additionalProperties: false,
|
|
1168
|
+
properties: {
|
|
1169
|
+
text: {
|
|
1170
|
+
type: "string",
|
|
1171
|
+
title: "Nothing purchasable message",
|
|
1172
|
+
format: "icu-message",
|
|
1173
|
+
messageSource: "No items are available for purchase right now"
|
|
1174
|
+
},
|
|
1175
|
+
linkText: {
|
|
1176
|
+
type: "string",
|
|
1177
|
+
minLength: 1,
|
|
1178
|
+
title: "Link text"
|
|
1179
|
+
},
|
|
1180
|
+
linkHref: {
|
|
1181
|
+
type: "string",
|
|
1182
|
+
minLength: 1,
|
|
1183
|
+
title: "Link destination",
|
|
1184
|
+
format: "uri-reference",
|
|
1185
|
+
pattern: "^(?:https?://.*|mailto:.+|tel:.+|/(?:[^/].*)?)$"
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
const CartAllUnavailableDefinition = defineComponent({
|
|
1191
|
+
name: "CartAllUnavailable",
|
|
1192
|
+
importPath: "@vtex/faststore/components",
|
|
1193
|
+
component: CartAllUnavailable,
|
|
1194
|
+
editor: {
|
|
1195
|
+
label: "Cart All Unavailable",
|
|
1196
|
+
category: "commerce"
|
|
1197
|
+
},
|
|
1198
|
+
schema: {},
|
|
1199
|
+
guideline: "Renders its children only when the cart has at least one line the shopper added and every such line is unavailable; gift lines are ignored, so a gift-only cart never shows it and a cart whose only available line is a gift does. Distinct from CartEmpty (zero lines). Carries no copy: compose CartAllUnavailableMessage inside it, which carries the optional link. While it holds no rendered CartAllUnavailableMessage (blank copy, or no message composed), the store stylesheet hides it with display: none, so put the box on the gate: blank copy leaves no empty box, and a display class cannot show it. Place under CartFilled. Must be inside CartRoot. See cart.md."
|
|
1200
|
+
});
|
|
1201
|
+
const CartAllUnavailableMessageDefinition = defineComponent({
|
|
1202
|
+
name: "CartAllUnavailableMessage",
|
|
1203
|
+
importPath: "@vtex/faststore/components",
|
|
1204
|
+
component: CartAllUnavailableMessage,
|
|
1205
|
+
content: CartAllUnavailableMessageContent,
|
|
1206
|
+
editor: {
|
|
1207
|
+
label: "Cart All Unavailable Message",
|
|
1208
|
+
category: "commerce"
|
|
1209
|
+
},
|
|
1210
|
+
schema: {
|
|
1211
|
+
linkText: {
|
|
1212
|
+
type: "string",
|
|
1213
|
+
label: "Link text"
|
|
1214
|
+
},
|
|
1215
|
+
linkHref: {
|
|
1216
|
+
type: "link",
|
|
1217
|
+
label: "Link destination"
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
guideline: "The warning that nothing in the cart can be bought, inside CartAllUnavailable, announced to screen readers as an alert. The message is the $content field text; blank copy renders nothing. It renders only while the cart has nothing purchasable. An optional link follows the text: set linkText and linkHref (a page reference such as { \"page\": \"<page name>\" }), or the same CMS fields; it renders only when both are set, there is no default, and a destination that is not a page reference or an http, https, mailto, tel or site-relative URL is dropped. A non-blank CMS field wins over its prop, so a CMS store authors no link props. Must be inside CartRoot. See cart.md."
|
|
1221
|
+
});
|
|
1222
|
+
/** True when the cart has a shopper-added line and every shopper-added line is unavailable. */
|
|
1223
|
+
function hasNothingPurchasable(items) {
|
|
1224
|
+
const shopperLines = items.filter((item) => !item.gift);
|
|
1225
|
+
return shopperLines.length > 0 && shopperLines.every(isUnavailable);
|
|
1226
|
+
}
|
|
1227
|
+
function CartAllUnavailable({ className, children, ...props }) {
|
|
1228
|
+
const { cart } = useCart();
|
|
1229
|
+
if (cart == null || !hasNothingPurchasable(cart.items)) return null;
|
|
1230
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1231
|
+
...props,
|
|
1232
|
+
className,
|
|
1233
|
+
"data-fs-cart-all-unavailable": "",
|
|
1234
|
+
children
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* A page reference skips the string allowlist. A string is checked, and a refusal drops the link.
|
|
1239
|
+
* The runtime content slice does not enforce the model's `pattern`, so this is the only gate on a CMS string.
|
|
1240
|
+
*/
|
|
1241
|
+
function resolveMessageLinkHref(href) {
|
|
1242
|
+
if (href == null) return null;
|
|
1243
|
+
if (typeof href !== "string") return href;
|
|
1244
|
+
if (!href.trim()) return null;
|
|
1245
|
+
const destination = resolveSafeHref(href);
|
|
1246
|
+
if (!destination.safe) {
|
|
1247
|
+
console.warn("[CartAllUnavailableMessage] link destination rejected", { reason: destination.reason });
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
return destination.href;
|
|
1251
|
+
}
|
|
1252
|
+
function CartAllUnavailableMessage({ linkText, linkHref, $content, $locale, className, ...props }) {
|
|
1253
|
+
const { cart } = useCart();
|
|
1254
|
+
const { format } = useMessageFormatter(CartAllUnavailableMessageContent, $content);
|
|
1255
|
+
if (cart == null || !hasNothingPurchasable(cart.items)) return null;
|
|
1256
|
+
const copy = format("text");
|
|
1257
|
+
if (!copy.trim()) return null;
|
|
1258
|
+
const resolvedLinkText = configuredLabel($content?.linkText) ?? configuredLabel(linkText);
|
|
1259
|
+
const rawHref = $content?.linkHref?.trim() ? $content.linkHref : linkHref;
|
|
1260
|
+
const destination = resolvedLinkText ? resolveMessageLinkHref(rawHref) : null;
|
|
1261
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1262
|
+
...props,
|
|
1263
|
+
role: "alert",
|
|
1264
|
+
className,
|
|
1265
|
+
"data-fs-cart-all-unavailable-message": "",
|
|
1266
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1267
|
+
"data-fs-cart-all-unavailable-message-text": "",
|
|
1268
|
+
"data-fs-text": "",
|
|
1269
|
+
children: copy
|
|
1270
|
+
}), resolvedLinkText && destination != null ? /* @__PURE__ */ jsx(NavigationLink, {
|
|
1271
|
+
href: destination,
|
|
1272
|
+
"data-fs-cart-all-unavailable-message-link": "",
|
|
1273
|
+
children: resolvedLinkText
|
|
1274
|
+
}) : null]
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
function ClearCartButton({ className, children, disabled, onClick, $content, $locale, $actions: $actionsProp, ...props }) {
|
|
802
1278
|
const $actions = useActionsOverride($actionsProp);
|
|
1279
|
+
const { format } = useMessageFormatter(ClearCartButtonContent, $content);
|
|
803
1280
|
const { cart } = useCart();
|
|
804
1281
|
const [pending, setPending] = useState(false);
|
|
805
1282
|
const inFlight = useRef(false);
|
|
@@ -833,7 +1310,7 @@ function ClearCartButton({ className, children, disabled, onClick, $actions: $ac
|
|
|
833
1310
|
"data-fs-clear-cart-button": "",
|
|
834
1311
|
"data-fs-button": "",
|
|
835
1312
|
...pending ? { "data-fs-clear-cart-button-pending": "" } : {},
|
|
836
|
-
children: children ?? "
|
|
1313
|
+
children: children ?? format("label")
|
|
837
1314
|
});
|
|
838
1315
|
}
|
|
839
1316
|
const CartOpenOnAddDefinition = defineComponent({
|
|
@@ -1169,12 +1646,12 @@ const CartEmptyMessageContent = defineContentType({
|
|
|
1169
1646
|
schema: {
|
|
1170
1647
|
type: "object",
|
|
1171
1648
|
additionalProperties: false,
|
|
1172
|
-
required: ["text"],
|
|
1173
1649
|
properties: { text: {
|
|
1174
1650
|
type: "string",
|
|
1175
1651
|
minLength: 1,
|
|
1176
1652
|
title: "Empty cart message",
|
|
1177
|
-
|
|
1653
|
+
format: "icu-message",
|
|
1654
|
+
messageSource: "Your cart is empty"
|
|
1178
1655
|
} }
|
|
1179
1656
|
}
|
|
1180
1657
|
});
|
|
@@ -1185,12 +1662,12 @@ const CartContinueShoppingContent = defineContentType({
|
|
|
1185
1662
|
schema: {
|
|
1186
1663
|
type: "object",
|
|
1187
1664
|
additionalProperties: false,
|
|
1188
|
-
required: ["label"],
|
|
1189
1665
|
properties: { label: {
|
|
1190
1666
|
type: "string",
|
|
1191
1667
|
minLength: 1,
|
|
1192
1668
|
title: "Continue shopping label",
|
|
1193
|
-
|
|
1669
|
+
format: "icu-message",
|
|
1670
|
+
messageSource: "Continue shopping"
|
|
1194
1671
|
} }
|
|
1195
1672
|
}
|
|
1196
1673
|
});
|
|
@@ -1203,12 +1680,8 @@ const CartEmptyMessageDefinition = defineComponent({
|
|
|
1203
1680
|
label: "Cart Empty Message",
|
|
1204
1681
|
category: "commerce"
|
|
1205
1682
|
},
|
|
1206
|
-
schema: {
|
|
1207
|
-
|
|
1208
|
-
default: "Your cart is empty",
|
|
1209
|
-
label: "Empty cart message"
|
|
1210
|
-
} },
|
|
1211
|
-
guideline: "The empty-cart message, rendered as plain text inside CartEmpty. CMS content wins over the text prop, which defaults to \"Your cart is empty\"; blank resolved copy renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md."
|
|
1683
|
+
schema: {},
|
|
1684
|
+
guideline: "The empty-cart message, rendered as plain text inside CartEmpty. The text is the $content field text; a blank message renders nothing. It carries no layout — group and space it with Container, and pair it with CartContinueShopping for the way back to browsing. See cart.md."
|
|
1212
1685
|
});
|
|
1213
1686
|
const CartContinueShoppingDefinition = defineComponent({
|
|
1214
1687
|
name: "CartContinueShopping",
|
|
@@ -1219,16 +1692,13 @@ const CartContinueShoppingDefinition = defineComponent({
|
|
|
1219
1692
|
label: "Cart Continue Shopping",
|
|
1220
1693
|
category: "action"
|
|
1221
1694
|
},
|
|
1222
|
-
schema: {
|
|
1223
|
-
|
|
1224
|
-
default: "Continue shopping",
|
|
1225
|
-
label: "Continue shopping label"
|
|
1226
|
-
} },
|
|
1227
|
-
guideline: "Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. CMS content wins over the label prop, and composed children win over both (compose an icon that way). See cart.md."
|
|
1695
|
+
schema: {},
|
|
1696
|
+
guideline: "Dismisses the cart overlay so the shopper can keep browsing; dispatches no cart write. Place it in the empty panel inside CartEmpty, commonly in a footer Container. It closes the drawer, so it requires a DrawerRoot ancestor — on a cart page with no drawer, compose a NavigationLink back to browsing instead of this control. Composed children are the button content (compose an icon that way); without them the text is the $content field label. See cart.md."
|
|
1228
1697
|
});
|
|
1229
|
-
function CartEmptyMessage({
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1698
|
+
function CartEmptyMessage({ $content, $locale, className, ...props }) {
|
|
1699
|
+
const { format } = useMessageFormatter(CartEmptyMessageContent, $content);
|
|
1700
|
+
const message = format("text");
|
|
1701
|
+
if (message === "") return null;
|
|
1232
1702
|
return /* @__PURE__ */ jsx("p", {
|
|
1233
1703
|
...props,
|
|
1234
1704
|
className,
|
|
@@ -1237,18 +1707,19 @@ function CartEmptyMessage({ text = "Your cart is empty", $content, className, ..
|
|
|
1237
1707
|
children: message
|
|
1238
1708
|
});
|
|
1239
1709
|
}
|
|
1240
|
-
function CartContinueShopping({
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1710
|
+
function CartContinueShopping({ $content, $locale, className, children, ...props }) {
|
|
1711
|
+
const { format } = useMessageFormatter(CartContinueShoppingContent, $content);
|
|
1712
|
+
const content = children ?? format("label");
|
|
1713
|
+
if (content === "") return null;
|
|
1243
1714
|
return /* @__PURE__ */ jsx(DrawerClose, {
|
|
1244
1715
|
...props,
|
|
1245
1716
|
className,
|
|
1246
1717
|
"data-fs-cart-continue-shopping": "",
|
|
1247
1718
|
"data-fs-button": "",
|
|
1248
|
-
children:
|
|
1719
|
+
children: content
|
|
1249
1720
|
});
|
|
1250
1721
|
}
|
|
1251
1722
|
//#endregion
|
|
1252
|
-
export { CART_ALERT_ICON_NAMES, CartAlertContent, CartAlertIcon, CartAlertIconDefinition, CartAlertRoot, CartAlertRootDefinition, CartAlertText, CartAlertTextDefinition, CartAppliedCoupons, CartAppliedCouponsDefinition, CartCheckoutGuard, CartCheckoutGuardDefinition, CartCheckoutLabelContent, CartContinueShopping, CartContinueShoppingContent, CartContinueShoppingDefinition, CartCount, CartCountDefinition, CartCouponEmpty, CartCouponEmptyDefinition, CartCouponError, CartCouponErrorDefinition, CartCouponForm, CartCouponFormDefinition, CartCouponRemove, CartCouponRemoveDefinition, CartCouponSavings, CartCouponSavingsDefinition, CartCouponUnmatched, CartCouponUnmatchedDefinition, CartDataContext, CartDisclaimer, CartDisclaimerContent, CartDisclaimerDefinition, CartEmpty, CartEmptyDefinition, CartEmptyMessage, CartEmptyMessageContent, CartEmptyMessageDefinition, CartError, CartErrorDefinition, CartFilled, CartFilledDefinition, CartGoCheckout, CartGoCheckoutDefinition, CartItemSkeleton, CartList, CartListDefinition, CartLoading, CartLoadingDefinition, CartOpenOnAdd, CartOpenOnAddDefinition, CartRedirectOnAdd, CartRedirectOnAddDefinition, CartRemoveUnavailable, CartRemoveUnavailableDefinition, CartRoot, CartRootDefinition, CartTotal, CartTotalDefinition, CartTotalValueContext, CartUnavailableCount, CartUnavailableCountDefinition, ClearCartButton,
|
|
1723
|
+
export { CART_ALERT_ICON_NAMES, CART_COUPON_ERROR_FIELDS, CART_ERROR_FIELDS, CartAlertContent, CartAlertIcon, CartAlertIconDefinition, CartAlertRoot, CartAlertRootDefinition, CartAlertText, CartAlertTextDefinition, CartAllUnavailable, CartAllUnavailableDefinition, CartAllUnavailableMessage, CartAllUnavailableMessageContent, CartAllUnavailableMessageDefinition, CartAppliedCoupons, CartAppliedCouponsContent, CartAppliedCouponsDefinition, CartAvailableItems, CartAvailableItemsDefinition, CartCheckoutGuard, CartCheckoutGuardDefinition, CartCheckoutLabelContent, CartContinueShopping, CartContinueShoppingContent, CartContinueShoppingDefinition, CartCount, CartCountContent, CartCountDefinition, CartCouponEmpty, CartCouponEmptyDefinition, CartCouponError, CartCouponErrorContent, CartCouponErrorDefinition, CartCouponForm, CartCouponFormContent, CartCouponFormDefinition, CartCouponRemove, CartCouponRemoveDefinition, CartCouponSavings, CartCouponSavingsContent, CartCouponSavingsDefinition, CartCouponUnmatched, CartCouponUnmatchedContent, CartCouponUnmatchedDefinition, CartDataContext, CartDisclaimer, CartDisclaimerContent, CartDisclaimerDefinition, CartEmpty, CartEmptyDefinition, CartEmptyMessage, CartEmptyMessageContent, CartEmptyMessageDefinition, CartError, CartErrorContent, CartErrorDefinition, CartFilled, CartFilledDefinition, CartGoCheckout, CartGoCheckoutDefinition, CartItemSkeleton, CartList, CartListDefinition, CartLoading, CartLoadingDefinition, CartOpenOnAdd, CartOpenOnAddDefinition, CartRedirectOnAdd, CartRedirectOnAddDefinition, CartRemoveUnavailable, CartRemoveUnavailableContent, CartRemoveUnavailableDefinition, CartRoot, CartRootDefinition, CartTotal, CartTotalDefinition, CartTotalValueContext, CartUnavailableCount, CartUnavailableCountContent, CartUnavailableCountDefinition, CartUnavailableItems, CartUnavailableItemsDefinition, CartUnavailableLabel, CartUnavailableLabelContent, CartUnavailableLabelDefinition, CartUnavailableSection, CartUnavailableSectionDefinition, ClearCartButton, ClearCartButtonContent, ClearCartButtonDefinition, formatPrice, isFiniteAmount, useCart };
|
|
1253
1724
|
|
|
1254
1725
|
//# sourceMappingURL=cart.js.map
|