@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in.js","names":[],"sources":["../../../src/matter/sign-in/sign-in.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';\nimport { Button } from '../../particles/button/button.js';\nimport { EmailField } from '../../particles/email-field/email-field.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport { useEntityDataResolved } from '../../sdk/data/entity-resolution-context.js';\nimport { useReactiveDataSettled } from '../../sdk/data/use-reactive-data-settled.js';\nimport { useSession } from '../session/session.js';\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment (colocated, ADR-0011) — one read of the account's enabled sign-in methods plus\n// the profile email that seeds the shared draft. Authored as a raw string, as access-code-sign-in does.\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment SignInData on Query {\n clientProfile {\n __typename\n id\n email\n }\n sessionAuthProviders {\n __typename\n id\n passwordAuthentication\n accessKeyAuthentication\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/** Colocated fragment slice forwarded by the reactive runtime — one key per root field. */\nexport type SignInSlice = {\n clientProfile: { email: string | null } | null;\n sessionAuthProviders: { passwordAuthentication: boolean; accessKeyAuthentication: boolean } | null;\n};\n\nexport type SignInMethod = 'password' | 'accessCode';\n\nexport type SignInContextValue = Readonly<{\n /** The one email draft every sign-in method shares. Seeded from `clientProfile.email` until the shopper edits it. */\n email: string;\n /** Updates the draft; marks it as shopper-touched so the seed no longer overwrites it. */\n setEmail: (email: string) => void;\n /** The active method: the shopper's choice, else the access code when enabled, else the password. */\n method: SignInMethod;\n setMethod: (method: SignInMethod) => void;\n passwordEnabled: boolean;\n accessCodeEnabled: boolean;\n anyMethodEnabled: boolean;\n bothMethodsEnabled: boolean;\n /** Whether the account configuration has arrived. Gate on this before reading any flag above. */\n resolved: boolean;\n}>;\n\nexport type SignInRootProps = Readonly<{ $data?: SignInSlice | null; children?: ReactNode }>;\n\nexport type SignInEmailControlProps = ComponentPropsWithRef<'div'> & {\n label?: string;\n placeholder?: string;\n invalidEmailMessage?: string;\n /** The input's `name`. Defaults to `EmailField`'s own (`'email'`). */\n name?: string;\n /** The input's `autocomplete` token. Defaults to `'username'`, the identifier half of the credential pair. */\n autoComplete?: string;\n};\n\nexport type SignInMethodSwitchProps = ComponentPropsWithRef<'div'> & {\n toAccessCodeLabel?: string;\n toPasswordLabel?: string;\n};\n\nexport type SignInMethodOptionProps = ComponentPropsWithRef<'div'> & {\n /** Which method this option selects. Required — the option has no meaning without it. */\n method: SignInMethod;\n label?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst SIGN_IN_CONTEXT_UNSET = Symbol('SignInContextUnset');\n\nconst SignInContext = createContext<SignInContextValue | typeof SIGN_IN_CONTEXT_UNSET>(SIGN_IN_CONTEXT_UNSET);\n\n/**\n * Read the shared email draft, active method and account flags from the nearest `SignInRoot`.\n * Throws outside that subtree — a misplaced part is a composition bug that should surface\n * immediately, mirroring `useSession()`/`useAccessCodeSignIn()`.\n */\nexport function useSignIn(): SignInContextValue {\n const ctx = useContext(SignInContext);\n if (ctx === SIGN_IN_CONTEXT_UNSET) {\n throw new Error('useSignIn() must be used inside a <SignInRoot> subtree.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const SignInRootDefinition = defineComponent<SignInRootProps>({\n name: 'SignInRoot',\n importPath: '@vtex/faststore/components',\n component: SignInRoot,\n fragment,\n fetchStrategy: 'reactive',\n skeleton: SignInRootSkeleton,\n requiresContext: 'session',\n providesContext: 'sign-in',\n editor: { label: 'Sign-In Root', category: 'identity' },\n schema: {},\n guideline:\n 'Provider of the sign-in surface: the single read of which sign-in methods the account enables, plus one shared email draft and the active method, published to the SignIn parts below it. Renders no element of its own and always renders its children, whatever the session state or the account configuration. Compose SignInEmailControl and either SignInMethodSwitch or SignInMethodOption inside it. Must be inside SessionRoot. See sign-in.md.',\n});\n\nexport const SignInEmailControlDefinition = defineComponent<SignInEmailControlProps>({\n name: 'SignInEmailControl',\n importPath: '@vtex/faststore/components',\n component: SignInEmailControl,\n skeleton: SignInEmailControlSkeleton,\n requiresContext: 'sign-in',\n editor: { label: 'Sign-In Email', category: 'identity' },\n schema: {\n label: { type: 'string', label: 'Label' },\n placeholder: { type: 'string', label: 'Placeholder' },\n invalidEmailMessage: { type: 'string', label: 'Invalid email message' },\n },\n guideline:\n 'The one email field shared by every sign-in method. Draws a placeholder while the account configuration loads, and renders nothing once signed in or when the account enables no method. Must be inside SignInRoot. See sign-in.md.',\n});\n\nexport const SignInMethodSwitchDefinition = defineComponent<SignInMethodSwitchProps>({\n name: 'SignInMethodSwitch',\n importPath: '@vtex/faststore/components',\n component: SignInMethodSwitch,\n requiresContext: 'sign-in',\n editor: { label: 'Sign-In Method Switch', category: 'identity' },\n schema: {\n toAccessCodeLabel: { type: 'string', label: 'Switch to access code label' },\n toPasswordLabel: { type: 'string', label: 'Switch to password label' },\n },\n guideline:\n 'One toggle button that moves the active sign-in method between the access code and the password. Renders nothing unless the account enables both methods. Must be inside SignInRoot. See sign-in.md.',\n});\n\nexport const SignInMethodOptionDefinition = defineComponent<SignInMethodOptionProps>({\n name: 'SignInMethodOption',\n importPath: '@vtex/faststore/components',\n component: SignInMethodOption,\n requiresContext: 'sign-in',\n editor: { label: 'Sign-In Method Option', category: 'identity' },\n schema: {\n method: { type: ['password', 'accessCode'] as const, label: 'Method' },\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'One selectable sign-in method. Renders nothing when the account disables the method it names, so composing one per method gives a store exactly the options its account enables. Compose it instead of SignInMethodSwitch when both methods should be visible at once, or beside the default method as an escape hatch. Must be inside SignInRoot. See sign-in.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/**\n * Data-owning provider of the sign-in surface. Reads `sessionAuthProviders` once, owns the shared\n * email draft and the active method, and publishes all of it as the `sign-in` context. It renders no\n * element of its own and always renders `children` — a provider that returned `null` while hosted in\n * a shared layout would take the page with it.\n *\n * `resolved` is the three-condition gate the entity fieldsets use: a reactive `$data` is never `null`\n * at runtime (it falls back to a placeholder slice), so only the two resolution signals plus the\n * presence of `sessionAuthProviders` tell \"not arrived yet\" from \"arrived and disabled\".\n */\nexport function SignInRoot({ $data: $dataProp, children }: SignInRootProps) {\n const $data = useDataOverride($dataProp);\n const settled = useReactiveDataSettled();\n const sliceResolved = useEntityDataResolved();\n const providers = $data?.sessionAuthProviders ?? null;\n const resolved = settled && sliceResolved && providers != null;\n\n const { state } = useSession();\n\n const passwordEnabled = resolved && providers.passwordAuthentication;\n const accessCodeEnabled = resolved && providers.accessKeyAuthentication;\n\n const savedEmail = $data?.clientProfile?.email ?? '';\n const [email, setEmail] = useState('');\n const [touched, setTouched] = useState(false);\n\n // Seed from the resolving/known profile email until the shopper edits the draft — the untouched-field\n // re-seed of ClientProfileRoot, never clobbering an in-progress edit.\n useEffect(() => {\n if (!touched) setEmail(savedEmail);\n }, [savedEmail, touched]);\n\n // Signing in ends the shopper's edit: the Root never unmounts (it must always render its children), so\n // without this the typed address would outlive the session and greet whoever uses the page next. Dropping\n // `touched` lets the seed above replace the edit with the profile email; it pins nothing, so it is not a freeze.\n useEffect(() => {\n if (state === 'loggedIn') setTouched(false);\n }, [state]);\n\n // The context's `setEmail`: the same write, plus the record that the shopper has edited the draft,\n // which is what stops the seed above from replacing it.\n const editEmail = useCallback((next: string) => {\n setTouched(true);\n setEmail(next);\n }, []);\n\n // The shopper's explicit choice, or null. The default is derived, so a choice made before the\n // configuration resolved cannot pin a stale default. Once resolved, a choice the account no longer enables\n // falls back to the default; while unresolved no flag is read, so a choice is kept rather than flapping.\n const [chosenMethod, setChosenMethod] = useState<SignInMethod | null>(null);\n const keepChosen =\n chosenMethod !== null && (!resolved || (chosenMethod === 'password' ? passwordEnabled : accessCodeEnabled));\n const defaultMethod: SignInMethod = accessCodeEnabled ? 'accessCode' : 'password';\n const method = keepChosen ? chosenMethod : defaultMethod;\n\n const contextValue = useMemo<SignInContextValue>(\n () => ({\n email,\n setEmail: editEmail,\n method,\n setMethod: setChosenMethod,\n passwordEnabled,\n accessCodeEnabled,\n anyMethodEnabled: passwordEnabled || accessCodeEnabled,\n bothMethodsEnabled: passwordEnabled && accessCodeEnabled,\n resolved,\n }),\n [email, editEmail, method, passwordEnabled, accessCodeEnabled, resolved],\n );\n\n return <SignInContext value={contextValue}>{children}</SignInContext>;\n}\n\n/**\n * Catalog metadata only: `SignInRoot` has no loading look because it always renders its children, so\n * this declares that by rendering nothing. The compiler records the `skeleton` name and never renders\n * it; no component body references it.\n */\nexport function SignInRootSkeleton() {\n return null;\n}\n\nexport function SignInEmailControlSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} data-fs-sign-in-email-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-sign-in-email-skeleton-line=\"\" />\n </div>\n );\n}\n\n/**\n * The one email field, bound to the Root's shared draft. Renders its skeleton while the account\n * configuration is unresolved, so a slow read does not look like a store with no sign-in, and nothing\n * once the shopper is signed in or the account enables no method.\n */\nexport function SignInEmailControl({\n label,\n placeholder,\n invalidEmailMessage,\n name,\n autoComplete = 'username',\n className,\n ...props\n}: SignInEmailControlProps) {\n const signIn = useSignIn();\n const { state } = useSession();\n\n if (state === 'loggedIn') return null;\n if (!signIn.resolved) return <SignInEmailControlSkeleton {...props} className={className} />;\n if (!signIn.anyMethodEnabled) return null;\n\n return (\n <div {...props} className={className} data-fs-sign-in-email=\"\">\n <EmailField\n label={label}\n placeholder={placeholder}\n value={signIn.email}\n onValueChange={signIn.setEmail}\n errorMessage={invalidEmailMessage}\n name={name}\n autoComplete={autoComplete}\n />\n </div>\n );\n}\n\n/**\n * One toggle button that moves the active method. Renders only when the account enables both\n * methods; the button is labelled with the method it moves to.\n */\nexport function SignInMethodSwitch({\n toAccessCodeLabel,\n toPasswordLabel,\n className,\n ...props\n}: SignInMethodSwitchProps) {\n const signIn = useSignIn();\n const { state } = useSession();\n\n if (state === 'loggedIn' || !signIn.resolved) return null;\n if (!signIn.bothMethodsEnabled) return null;\n\n const { method, setMethod } = signIn;\n\n return (\n <div {...props} className={className} data-fs-sign-in-method-switch=\"\" data-fs-sign-in-method={method}>\n <Button\n type=\"button\"\n onClick={() => setMethod(method === 'accessCode' ? 'password' : 'accessCode')}\n data-fs-sign-in-method-switch-button=\"\"\n >\n {method === 'password' ? toAccessCodeLabel : toPasswordLabel}\n </Button>\n </div>\n );\n}\n\n/**\n * One selectable method. Renders only when the account enables the method named by `method`, and\n * carries a selected state while that method is the active one — so one option per method gives a\n * store exactly the options its account enables.\n */\nexport function SignInMethodOption({ method, label, className, ...props }: SignInMethodOptionProps) {\n const signIn = useSignIn();\n const { state } = useSession();\n\n if (state === 'loggedIn' || !signIn.resolved) return null;\n if (method !== 'password' && method !== 'accessCode') return null;\n if (!(method === 'password' ? signIn.passwordEnabled : signIn.accessCodeEnabled)) return null;\n\n const selected = signIn.method === method;\n\n return (\n <div\n {...props}\n className={className}\n data-fs-sign-in-method-option={method}\n {...(selected ? { 'data-fs-sign-in-method-option-selected': '' } : {})}\n >\n <Button\n type=\"button\"\n aria-pressed={selected}\n onClick={() => signIn.setMethod(method)}\n data-fs-sign-in-method-option-button=\"\"\n >\n {label}\n </Button>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const SignIn = {\n Root: SignInRoot,\n EmailControl: SignInEmailControl,\n MethodSwitch: SignInMethodSwitch,\n MethodOption: SignInMethodOption,\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,WAAyB;;;;;;;;;;;;;;;AAuE/B,MAAM,wBAAwB,OAAO,oBAAoB;AAEzD,MAAM,gBAAgB,cAAiE,qBAAqB;;;;;;AAO5G,SAAgB,YAAgC;CAC9C,MAAM,MAAM,WAAW,aAAa;CACpC,IAAI,QAAQ,uBACV,MAAM,IAAI,MAAM,yDAAyD;CAE3E,OAAO;AACT;AAMA,MAAa,uBAAuB,gBAAiC;CACnE,MAAM;CACN,YAAY;CACZ,WAAW;CACX;CACA,eAAe;CACf,UAAU;CACV,iBAAiB;CACjB,iBAAiB;CACjB,QAAQ;EAAE,OAAO;EAAgB,UAAU;CAAW;CACtD,QAAQ,CAAC;CACT,WACE;AACJ,CAAC;AAED,MAAa,+BAA+B,gBA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
|
1
|
+
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
|
+
import "../../core/dist/index.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
4
|
+
//#region src/matter/sign-in-disclosure/sign-in-disclosure.d.ts
|
|
5
|
+
export type SignInDisclosureContextValue = Readonly<{
|
|
6
|
+
/** Whether the panel is showing. Derived: `false` whenever the session reports `loggedIn`. */
|
|
7
|
+
open: boolean;
|
|
8
|
+
setOpen: (open: boolean) => void;
|
|
9
|
+
}>;
|
|
10
|
+
export type SignInDisclosureRootProps = Readonly<{
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
export type SignInDisclosureTriggerProps = ComponentPropsWithRef<'button'> & {
|
|
14
|
+
label?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Extends the div props except the four the panel owns: a caller value would reopen the closed panel to
|
|
18
|
+
* assistive technology, or rename the dialog.
|
|
19
|
+
*/
|
|
20
|
+
export type SignInModalPanelProps = Omit<ComponentPropsWithRef<'div'>, 'hidden' | 'tabIndex' | 'aria-label' | 'aria-labelledby'> & {
|
|
21
|
+
/** The dialog's accessible name, rendered in the title. */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** The close control's text and accessible name. */
|
|
24
|
+
closeLabel?: string;
|
|
25
|
+
/** Written into the focus anchor once the shopper is signed in, so the self-close is announced. */
|
|
26
|
+
signedInFocusLabel?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Read whether the sign-in panel is showing, and set it, from the nearest `SignInDisclosureRoot`.
|
|
30
|
+
* Throws outside that subtree — a misplaced part is a composition bug that should surface immediately,
|
|
31
|
+
* mirroring `useSignIn()`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useSignInDisclosure(): SignInDisclosureContextValue;
|
|
34
|
+
export declare const SignInDisclosureRootDefinition: ComponentDefinition<Readonly<{
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
}>>;
|
|
37
|
+
export declare const SignInDisclosureTriggerDefinition: ComponentDefinition<SignInDisclosureTriggerProps>;
|
|
38
|
+
export declare const SignInModalPanelDefinition: ComponentDefinition<SignInModalPanelProps>;
|
|
39
|
+
/**
|
|
40
|
+
* Owns the open state and publishes it as the `sign-in-disclosure` context. It renders no element of
|
|
41
|
+
* its own and always renders `children`.
|
|
42
|
+
*
|
|
43
|
+
* The published `open` is derived — `localOpen && state !== 'loggedIn'` — so no render ever shows an
|
|
44
|
+
* open panel to a signed-in shopper: every part inside the panel has already returned `null` by then,
|
|
45
|
+
* which would leave an empty dialog for one committed frame. The effect only clears the stored latch,
|
|
46
|
+
* so a later sign-out does not pop the panel open again with nobody having asked.
|
|
47
|
+
*/
|
|
48
|
+
export declare function SignInDisclosureRoot({ children }: SignInDisclosureRootProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
/**
|
|
50
|
+
* Silent placeholder while the account configuration is in flight: `aria-hidden`, no role, not
|
|
51
|
+
* focusable, mirroring `SignInEmailControlSkeleton`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function SignInDisclosureTriggerSkeleton({ className }: Readonly<{
|
|
54
|
+
className?: string;
|
|
55
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* The login button. Gates on `resolved` before it reads any flag: an unresolved account reports no
|
|
58
|
+
* method enabled, which would otherwise hide the button from a store that offers sign-in.
|
|
59
|
+
*/
|
|
60
|
+
export declare function SignInDisclosureTrigger({ label, className, onClick, ...props }: SignInDisclosureTriggerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
61
|
+
/**
|
|
62
|
+
* The sign-in modal. Renders Base UI's `Dialog` controlled from the context, with the portal kept
|
|
63
|
+
* mounted: the children — and the access-code stepper's token inside them — survive a close, while the
|
|
64
|
+
* closed popup carries `hidden`, so it is out of the accessibility tree and the tab order.
|
|
65
|
+
*
|
|
66
|
+
* Focus returns to the trigger that opened the panel on a shopper-driven close. A self-close removes
|
|
67
|
+
* that trigger, so focus goes to an in-flow anchor instead of `document.body`. The anchor is mounted
|
|
68
|
+
* empty and receives its text on the pass the session flips, which is the shape that announces; it is
|
|
69
|
+
* clipped, so the text reaches assistive technology and never the page.
|
|
70
|
+
*
|
|
71
|
+
* `hidden`, `tabIndex`, `aria-label` and `aria-labelledby` are the panel's own: closed means hidden, and
|
|
72
|
+
* the title names the dialog.
|
|
73
|
+
*/
|
|
74
|
+
export declare function SignInModalPanel({ title, closeLabel, signedInFocusLabel, className, children, ...props }: SignInModalPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
export declare const SignInDisclosure: {
|
|
76
|
+
Root: typeof SignInDisclosureRoot;
|
|
77
|
+
Trigger: typeof SignInDisclosureTrigger;
|
|
78
|
+
ModalPanel: typeof SignInModalPanel;
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
//# sourceMappingURL=sign-in-disclosure.d.ts.map
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { defineComponent } from "../../core/dist/define-component.js";
|
|
3
|
+
import "../../core/dist/index.js";
|
|
4
|
+
import { useSession } from "../session/session.js";
|
|
5
|
+
import { useSignIn } from "../sign-in/sign-in.js";
|
|
6
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
9
|
+
//#region src/matter/sign-in-disclosure/sign-in-disclosure.tsx
|
|
10
|
+
const SIGN_IN_DISCLOSURE_CONTEXT_UNSET = Symbol("SignInDisclosureContextUnset");
|
|
11
|
+
const SignInDisclosureContext = createContext(SIGN_IN_DISCLOSURE_CONTEXT_UNSET);
|
|
12
|
+
/**
|
|
13
|
+
* Read whether the sign-in panel is showing, and set it, from the nearest `SignInDisclosureRoot`.
|
|
14
|
+
* Throws outside that subtree — a misplaced part is a composition bug that should surface immediately,
|
|
15
|
+
* mirroring `useSignIn()`.
|
|
16
|
+
*/
|
|
17
|
+
function useSignInDisclosure() {
|
|
18
|
+
const ctx = useContext(SignInDisclosureContext);
|
|
19
|
+
if (ctx === SIGN_IN_DISCLOSURE_CONTEXT_UNSET) throw new Error("useSignInDisclosure() must be used inside a <SignInDisclosureRoot> subtree.");
|
|
20
|
+
return ctx;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether the nearest `SignInDisclosureRoot` is showing its panel, or `undefined` outside one. For the
|
|
24
|
+
* parts inside the panel that hold shopper input and must drop it when the panel closes, yet still
|
|
25
|
+
* render without a disclosure. Unlike `useSignInDisclosure()` it never throws, and it is not part of the
|
|
26
|
+
* package barrel.
|
|
27
|
+
*/
|
|
28
|
+
function useSignInDisclosureOpen() {
|
|
29
|
+
const ctx = useContext(SignInDisclosureContext);
|
|
30
|
+
return ctx === SIGN_IN_DISCLOSURE_CONTEXT_UNSET ? void 0 : ctx.open;
|
|
31
|
+
}
|
|
32
|
+
const SignInDisclosureRootDefinition = defineComponent({
|
|
33
|
+
name: "SignInDisclosureRoot",
|
|
34
|
+
importPath: "@vtex/faststore/components",
|
|
35
|
+
component: SignInDisclosureRoot,
|
|
36
|
+
requiresContext: "sign-in",
|
|
37
|
+
providesContext: "sign-in-disclosure",
|
|
38
|
+
editor: {
|
|
39
|
+
label: "Sign-In Disclosure Root",
|
|
40
|
+
category: "identity"
|
|
41
|
+
},
|
|
42
|
+
schema: {},
|
|
43
|
+
guideline: "Owns whether the sign-in modal is showing and shares it with the triggers and the panel below it. Renders no element of its own and always renders its children. Compose any number of SignInDisclosureTrigger and exactly one SignInModalPanel inside it. Must be inside SignInRoot. See sign-in-disclosure.md."
|
|
44
|
+
});
|
|
45
|
+
const SignInDisclosureTriggerDefinition = defineComponent({
|
|
46
|
+
name: "SignInDisclosureTrigger",
|
|
47
|
+
importPath: "@vtex/faststore/components",
|
|
48
|
+
component: SignInDisclosureTrigger,
|
|
49
|
+
skeleton: SignInDisclosureTriggerSkeleton,
|
|
50
|
+
requiresContext: "sign-in-disclosure",
|
|
51
|
+
editor: {
|
|
52
|
+
label: "Sign-In Trigger",
|
|
53
|
+
category: "action"
|
|
54
|
+
},
|
|
55
|
+
schema: { label: {
|
|
56
|
+
type: "string",
|
|
57
|
+
label: "Label"
|
|
58
|
+
} },
|
|
59
|
+
guideline: "The login button: opens the sign-in modal. Compose as many as the store needs, they all open the one panel. Draws a silent placeholder while the account configuration loads, and renders nothing for a signed-in shopper or when the account enables no sign-in method. Must be inside SignInDisclosureRoot. See sign-in-disclosure.md."
|
|
60
|
+
});
|
|
61
|
+
const SignInModalPanelDefinition = defineComponent({
|
|
62
|
+
name: "SignInModalPanel",
|
|
63
|
+
importPath: "@vtex/faststore/components",
|
|
64
|
+
component: SignInModalPanel,
|
|
65
|
+
requiresContext: "sign-in-disclosure",
|
|
66
|
+
editor: {
|
|
67
|
+
label: "Sign-In Modal Panel",
|
|
68
|
+
category: "layout"
|
|
69
|
+
},
|
|
70
|
+
schema: {
|
|
71
|
+
title: {
|
|
72
|
+
type: "string",
|
|
73
|
+
label: "Title"
|
|
74
|
+
},
|
|
75
|
+
closeLabel: {
|
|
76
|
+
type: "string",
|
|
77
|
+
label: "Close label"
|
|
78
|
+
},
|
|
79
|
+
signedInFocusLabel: {
|
|
80
|
+
type: "string",
|
|
81
|
+
label: "Signed-in announcement"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
guideline: "The sign-in modal. Compose the sign-in parts (SignInEmailControl, the method parts, the access-code parts) as its children; they stay mounted while it is closed, so a shopper who steps out to read a code returns to the step they left. It closes by itself the moment the session becomes signed in. Author the title: it is what names the dialog for assistive technology. Must be inside SignInDisclosureRoot. Use it instead of a bare DialogRoot, which cannot close itself. See sign-in-disclosure.md."
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* The focus anchor is not page copy: it exists to take focus and be announced. It sits in the layout's flow,
|
|
88
|
+
* outside the panel, where no `style` the merchant authors on the panel reaches it, so it is clipped here
|
|
89
|
+
* rather than left to a swatch. A clip keeps it in the accessibility tree, which `display: none` would not.
|
|
90
|
+
*/
|
|
91
|
+
const FOCUS_ANCHOR_STYLE = {
|
|
92
|
+
position: "absolute",
|
|
93
|
+
width: 1,
|
|
94
|
+
height: 1,
|
|
95
|
+
margin: -1,
|
|
96
|
+
padding: 0,
|
|
97
|
+
overflow: "hidden",
|
|
98
|
+
clip: "rect(0, 0, 0, 0)",
|
|
99
|
+
whiteSpace: "nowrap",
|
|
100
|
+
border: 0
|
|
101
|
+
};
|
|
102
|
+
/** Props the panel owns, discarded whatever a caller passes: the type omits them, a spread or a cast does not. */
|
|
103
|
+
function withoutPanelOwnedKeys({ hidden: _hidden, tabIndex: _tabIndex, "aria-label": _ariaLabel, "aria-labelledby": _ariaLabelledBy, ...rest }) {
|
|
104
|
+
return rest;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Owns the open state and publishes it as the `sign-in-disclosure` context. It renders no element of
|
|
108
|
+
* its own and always renders `children`.
|
|
109
|
+
*
|
|
110
|
+
* The published `open` is derived — `localOpen && state !== 'loggedIn'` — so no render ever shows an
|
|
111
|
+
* open panel to a signed-in shopper: every part inside the panel has already returned `null` by then,
|
|
112
|
+
* which would leave an empty dialog for one committed frame. The effect only clears the stored latch,
|
|
113
|
+
* so a later sign-out does not pop the panel open again with nobody having asked.
|
|
114
|
+
*/
|
|
115
|
+
function SignInDisclosureRoot({ children }) {
|
|
116
|
+
useSignIn();
|
|
117
|
+
const { state } = useSession();
|
|
118
|
+
const signedIn = state === "loggedIn";
|
|
119
|
+
const [localOpen, setLocalOpen] = useState(false);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (signedIn) setLocalOpen(false);
|
|
122
|
+
}, [signedIn]);
|
|
123
|
+
const setOpen = useCallback((next) => setLocalOpen(next && !signedIn), [signedIn]);
|
|
124
|
+
const contextValue = useMemo(() => ({
|
|
125
|
+
open: localOpen && !signedIn,
|
|
126
|
+
setOpen
|
|
127
|
+
}), [
|
|
128
|
+
localOpen,
|
|
129
|
+
signedIn,
|
|
130
|
+
setOpen
|
|
131
|
+
]);
|
|
132
|
+
return /* @__PURE__ */ jsx(SignInDisclosureContext, {
|
|
133
|
+
value: contextValue,
|
|
134
|
+
children
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Silent placeholder while the account configuration is in flight: `aria-hidden`, no role, not
|
|
139
|
+
* focusable, mirroring `SignInEmailControlSkeleton`.
|
|
140
|
+
*/
|
|
141
|
+
function SignInDisclosureTriggerSkeleton({ className }) {
|
|
142
|
+
return /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className,
|
|
144
|
+
"data-fs-sign-in-disclosure-trigger-skeleton": "",
|
|
145
|
+
"data-fs-sign-in-state": "loading",
|
|
146
|
+
"aria-hidden": "true"
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The login button. Gates on `resolved` before it reads any flag: an unresolved account reports no
|
|
151
|
+
* method enabled, which would otherwise hide the button from a store that offers sign-in.
|
|
152
|
+
*/
|
|
153
|
+
function SignInDisclosureTrigger({ label, className, onClick, ...props }) {
|
|
154
|
+
const { setOpen } = useSignInDisclosure();
|
|
155
|
+
const signIn = useSignIn();
|
|
156
|
+
const { state } = useSession();
|
|
157
|
+
if (state === "loggedIn") return null;
|
|
158
|
+
if (!signIn.resolved) return /* @__PURE__ */ jsx(SignInDisclosureTriggerSkeleton, { className });
|
|
159
|
+
if (!signIn.anyMethodEnabled) return null;
|
|
160
|
+
return /* @__PURE__ */ jsx("button", {
|
|
161
|
+
...props,
|
|
162
|
+
type: "button",
|
|
163
|
+
className,
|
|
164
|
+
"data-fs-sign-in-disclosure-trigger": "",
|
|
165
|
+
"data-fs-sign-in-state": "ready",
|
|
166
|
+
onClick: (event) => {
|
|
167
|
+
onClick?.(event);
|
|
168
|
+
if (!event.defaultPrevented) setOpen(true);
|
|
169
|
+
},
|
|
170
|
+
children: label
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The sign-in modal. Renders Base UI's `Dialog` controlled from the context, with the portal kept
|
|
175
|
+
* mounted: the children — and the access-code stepper's token inside them — survive a close, while the
|
|
176
|
+
* closed popup carries `hidden`, so it is out of the accessibility tree and the tab order.
|
|
177
|
+
*
|
|
178
|
+
* Focus returns to the trigger that opened the panel on a shopper-driven close. A self-close removes
|
|
179
|
+
* that trigger, so focus goes to an in-flow anchor instead of `document.body`. The anchor is mounted
|
|
180
|
+
* empty and receives its text on the pass the session flips, which is the shape that announces; it is
|
|
181
|
+
* clipped, so the text reaches assistive technology and never the page.
|
|
182
|
+
*
|
|
183
|
+
* `hidden`, `tabIndex`, `aria-label` and `aria-labelledby` are the panel's own: closed means hidden, and
|
|
184
|
+
* the title names the dialog.
|
|
185
|
+
*/
|
|
186
|
+
function SignInModalPanel({ title, closeLabel, signedInFocusLabel, className, children, ...props }) {
|
|
187
|
+
const { open, setOpen } = useSignInDisclosure();
|
|
188
|
+
const { state, loading } = useSession();
|
|
189
|
+
const signedIn = state === "loggedIn";
|
|
190
|
+
const focusAnchorRef = useRef(null);
|
|
191
|
+
const [sawSignedOut, setSawSignedOut] = useState(false);
|
|
192
|
+
if (!loading && !signedIn && !sawSignedOut) setSawSignedOut(true);
|
|
193
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("output", {
|
|
194
|
+
ref: focusAnchorRef,
|
|
195
|
+
tabIndex: -1,
|
|
196
|
+
style: FOCUS_ANCHOR_STYLE,
|
|
197
|
+
"data-fs-sign-in-modal-focus-anchor": "",
|
|
198
|
+
children: signedIn && sawSignedOut ? signedInFocusLabel : null
|
|
199
|
+
}), /* @__PURE__ */ jsx(Dialog.Root, {
|
|
200
|
+
open,
|
|
201
|
+
onOpenChange: setOpen,
|
|
202
|
+
modal: true,
|
|
203
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, {
|
|
204
|
+
keepMounted: true,
|
|
205
|
+
children: [/* @__PURE__ */ jsx(Dialog.Backdrop, { "data-fs-sign-in-modal-backdrop": "" }), /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
206
|
+
...withoutPanelOwnedKeys(props),
|
|
207
|
+
className,
|
|
208
|
+
finalFocus: signedIn ? focusAnchorRef : true,
|
|
209
|
+
"data-fs-sign-in-modal-panel": "",
|
|
210
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
211
|
+
"data-fs-sign-in-modal-header": "",
|
|
212
|
+
children: [/* @__PURE__ */ jsx(Dialog.Title, {
|
|
213
|
+
"data-fs-sign-in-modal-title": "",
|
|
214
|
+
children: title
|
|
215
|
+
}), /* @__PURE__ */ jsx(Dialog.Close, {
|
|
216
|
+
"data-fs-sign-in-modal-close": "",
|
|
217
|
+
children: closeLabel
|
|
218
|
+
})]
|
|
219
|
+
}), children]
|
|
220
|
+
})]
|
|
221
|
+
})
|
|
222
|
+
})] });
|
|
223
|
+
}
|
|
224
|
+
const SignInDisclosure = {
|
|
225
|
+
Root: SignInDisclosureRoot,
|
|
226
|
+
Trigger: SignInDisclosureTrigger,
|
|
227
|
+
ModalPanel: SignInModalPanel
|
|
228
|
+
};
|
|
229
|
+
//#endregion
|
|
230
|
+
export { SignInDisclosure, SignInDisclosureRoot, SignInDisclosureRootDefinition, SignInDisclosureTrigger, SignInDisclosureTriggerDefinition, SignInDisclosureTriggerSkeleton, SignInModalPanel, SignInModalPanelDefinition, useSignInDisclosure, useSignInDisclosureOpen };
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=sign-in-disclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in-disclosure.js","names":["BaseDialog"],"sources":["../../../src/matter/sign-in-disclosure/sign-in-disclosure.tsx"],"sourcesContent":["'use client';\n\nimport { Dialog as BaseDialog } from '@base-ui/react/dialog';\nimport { defineComponent } from '@vtex/fs-core';\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from 'react';\nimport { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { useSession } from '../session/session.js';\nimport { useSignIn } from '../sign-in/sign-in.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type SignInDisclosureContextValue = Readonly<{\n /** Whether the panel is showing. Derived: `false` whenever the session reports `loggedIn`. */\n open: boolean;\n setOpen: (open: boolean) => void;\n}>;\n\nexport type SignInDisclosureRootProps = Readonly<{ children?: ReactNode }>;\n\nexport type SignInDisclosureTriggerProps = ComponentPropsWithRef<'button'> & {\n label?: string;\n};\n\n/**\n * Extends the div props except the four the panel owns: a caller value would reopen the closed panel to\n * assistive technology, or rename the dialog.\n */\nexport type SignInModalPanelProps = Omit<\n ComponentPropsWithRef<'div'>,\n 'hidden' | 'tabIndex' | 'aria-label' | 'aria-labelledby'\n> & {\n /** The dialog's accessible name, rendered in the title. */\n title?: string;\n /** The close control's text and accessible name. */\n closeLabel?: string;\n /** Written into the focus anchor once the shopper is signed in, so the self-close is announced. */\n signedInFocusLabel?: string;\n};\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst SIGN_IN_DISCLOSURE_CONTEXT_UNSET = Symbol('SignInDisclosureContextUnset');\n\nconst SignInDisclosureContext = createContext<SignInDisclosureContextValue | typeof SIGN_IN_DISCLOSURE_CONTEXT_UNSET>(\n SIGN_IN_DISCLOSURE_CONTEXT_UNSET,\n);\n\n/**\n * Read whether the sign-in panel is showing, and set it, from the nearest `SignInDisclosureRoot`.\n * Throws outside that subtree — a misplaced part is a composition bug that should surface immediately,\n * mirroring `useSignIn()`.\n */\nexport function useSignInDisclosure(): SignInDisclosureContextValue {\n const ctx = useContext(SignInDisclosureContext);\n if (ctx === SIGN_IN_DISCLOSURE_CONTEXT_UNSET) {\n throw new Error('useSignInDisclosure() must be used inside a <SignInDisclosureRoot> subtree.');\n }\n return ctx;\n}\n\n/**\n * Whether the nearest `SignInDisclosureRoot` is showing its panel, or `undefined` outside one. For the\n * parts inside the panel that hold shopper input and must drop it when the panel closes, yet still\n * render without a disclosure. Unlike `useSignInDisclosure()` it never throws, and it is not part of the\n * package barrel.\n */\nexport function useSignInDisclosureOpen(): boolean | undefined {\n const ctx = useContext(SignInDisclosureContext);\n return ctx === SIGN_IN_DISCLOSURE_CONTEXT_UNSET ? undefined : ctx.open;\n}\n\n// ---------------------------------------------------------------------------\n// Definitions\n// ---------------------------------------------------------------------------\n\nexport const SignInDisclosureRootDefinition = defineComponent<SignInDisclosureRootProps>({\n name: 'SignInDisclosureRoot',\n importPath: '@vtex/faststore/components',\n component: SignInDisclosureRoot,\n requiresContext: 'sign-in',\n providesContext: 'sign-in-disclosure',\n editor: { label: 'Sign-In Disclosure Root', category: 'identity' },\n schema: {},\n guideline:\n 'Owns whether the sign-in modal is showing and shares it with the triggers and the panel below it. Renders no element of its own and always renders its children. Compose any number of SignInDisclosureTrigger and exactly one SignInModalPanel inside it. Must be inside SignInRoot. See sign-in-disclosure.md.',\n});\n\nexport const SignInDisclosureTriggerDefinition = defineComponent<SignInDisclosureTriggerProps>({\n name: 'SignInDisclosureTrigger',\n importPath: '@vtex/faststore/components',\n component: SignInDisclosureTrigger,\n skeleton: SignInDisclosureTriggerSkeleton,\n requiresContext: 'sign-in-disclosure',\n editor: { label: 'Sign-In Trigger', category: 'action' },\n schema: {\n label: { type: 'string', label: 'Label' },\n },\n guideline:\n 'The login button: opens the sign-in modal. Compose as many as the store needs, they all open the one panel. Draws a silent placeholder while the account configuration loads, and renders nothing for a signed-in shopper or when the account enables no sign-in method. Must be inside SignInDisclosureRoot. See sign-in-disclosure.md.',\n});\n\nexport const SignInModalPanelDefinition = defineComponent<SignInModalPanelProps>({\n name: 'SignInModalPanel',\n importPath: '@vtex/faststore/components',\n component: SignInModalPanel,\n requiresContext: 'sign-in-disclosure',\n editor: { label: 'Sign-In Modal Panel', category: 'layout' },\n schema: {\n title: { type: 'string', label: 'Title' },\n closeLabel: { type: 'string', label: 'Close label' },\n signedInFocusLabel: { type: 'string', label: 'Signed-in announcement' },\n },\n guideline:\n 'The sign-in modal. Compose the sign-in parts (SignInEmailControl, the method parts, the access-code parts) as its children; they stay mounted while it is closed, so a shopper who steps out to read a code returns to the step they left. It closes by itself the moment the session becomes signed in. Author the title: it is what names the dialog for assistive technology. Must be inside SignInDisclosureRoot. Use it instead of a bare DialogRoot, which cannot close itself. See sign-in-disclosure.md.',\n});\n\n// ---------------------------------------------------------------------------\n// Implementations\n// ---------------------------------------------------------------------------\n\n/**\n * The focus anchor is not page copy: it exists to take focus and be announced. It sits in the layout's flow,\n * outside the panel, where no `style` the merchant authors on the panel reaches it, so it is clipped here\n * rather than left to a swatch. A clip keeps it in the accessibility tree, which `display: none` would not.\n */\nconst FOCUS_ANCHOR_STYLE: CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n padding: 0,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: 0,\n};\n\n/** Props the panel owns, discarded whatever a caller passes: the type omits them, a spread or a cast does not. */\nfunction withoutPanelOwnedKeys({\n hidden: _hidden,\n tabIndex: _tabIndex,\n 'aria-label': _ariaLabel,\n 'aria-labelledby': _ariaLabelledBy,\n ...rest\n}: Record<string, unknown>) {\n return rest;\n}\n\n/**\n * Owns the open state and publishes it as the `sign-in-disclosure` context. It renders no element of\n * its own and always renders `children`.\n *\n * The published `open` is derived — `localOpen && state !== 'loggedIn'` — so no render ever shows an\n * open panel to a signed-in shopper: every part inside the panel has already returned `null` by then,\n * which would leave an empty dialog for one committed frame. The effect only clears the stored latch,\n * so a later sign-out does not pop the panel open again with nobody having asked.\n */\nexport function SignInDisclosureRoot({ children }: SignInDisclosureRootProps) {\n // Called for its throw: a disclosure outside `SignInRoot` names the ancestor to add first.\n useSignIn();\n const { state } = useSession();\n const signedIn = state === 'loggedIn';\n\n const [localOpen, setLocalOpen] = useState(false);\n\n useEffect(() => {\n if (signedIn) setLocalOpen(false);\n }, [signedIn]);\n\n // A signed-in shopper cannot arm the latch: it would outlive the session and open on sign-out.\n const setOpen = useCallback((next: boolean) => setLocalOpen(next && !signedIn), [signedIn]);\n\n const contextValue = useMemo<SignInDisclosureContextValue>(\n () => ({ open: localOpen && !signedIn, setOpen }),\n [localOpen, signedIn, setOpen],\n );\n\n return <SignInDisclosureContext value={contextValue}>{children}</SignInDisclosureContext>;\n}\n\n/**\n * Silent placeholder while the account configuration is in flight: `aria-hidden`, no role, not\n * focusable, mirroring `SignInEmailControlSkeleton`.\n */\nexport function SignInDisclosureTriggerSkeleton({ className }: Readonly<{ className?: string }>) {\n return (\n <span\n className={className}\n data-fs-sign-in-disclosure-trigger-skeleton=\"\"\n data-fs-sign-in-state=\"loading\"\n aria-hidden=\"true\"\n />\n );\n}\n\n/**\n * The login button. Gates on `resolved` before it reads any flag: an unresolved account reports no\n * method enabled, which would otherwise hide the button from a store that offers sign-in.\n */\nexport function SignInDisclosureTrigger({ label, className, onClick, ...props }: SignInDisclosureTriggerProps) {\n const { setOpen } = useSignInDisclosure();\n const signIn = useSignIn();\n const { state } = useSession();\n\n if (state === 'loggedIn') return null;\n if (!signIn.resolved) return <SignInDisclosureTriggerSkeleton className={className} />;\n if (!signIn.anyMethodEnabled) return null;\n\n return (\n <button\n {...props}\n type=\"button\"\n className={className}\n data-fs-sign-in-disclosure-trigger=\"\"\n data-fs-sign-in-state=\"ready\"\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setOpen(true);\n }}\n >\n {label}\n </button>\n );\n}\n\n/**\n * The sign-in modal. Renders Base UI's `Dialog` controlled from the context, with the portal kept\n * mounted: the children — and the access-code stepper's token inside them — survive a close, while the\n * closed popup carries `hidden`, so it is out of the accessibility tree and the tab order.\n *\n * Focus returns to the trigger that opened the panel on a shopper-driven close. A self-close removes\n * that trigger, so focus goes to an in-flow anchor instead of `document.body`. The anchor is mounted\n * empty and receives its text on the pass the session flips, which is the shape that announces; it is\n * clipped, so the text reaches assistive technology and never the page.\n *\n * `hidden`, `tabIndex`, `aria-label` and `aria-labelledby` are the panel's own: closed means hidden, and\n * the title names the dialog.\n */\nexport function SignInModalPanel({\n title,\n closeLabel,\n signedInFocusLabel,\n className,\n children,\n ...props\n}: SignInModalPanelProps) {\n const { open, setOpen } = useSignInDisclosure();\n const { state, loading } = useSession();\n const signedIn = state === 'loggedIn';\n const focusAnchorRef = useRef<HTMLOutputElement>(null);\n\n // A shopper who was already signed in when the page loaded was never told anything, so there is nothing to\n // announce. The session is anonymous until it resolves, so only a settled, not-signed-in render arms it.\n const [sawSignedOut, setSawSignedOut] = useState(false);\n if (!loading && !signedIn && !sawSignedOut) setSawSignedOut(true);\n\n return (\n <>\n <output ref={focusAnchorRef} tabIndex={-1} style={FOCUS_ANCHOR_STYLE} data-fs-sign-in-modal-focus-anchor=\"\">\n {signedIn && sawSignedOut ? signedInFocusLabel : null}\n </output>\n <BaseDialog.Root open={open} onOpenChange={setOpen} modal>\n <BaseDialog.Portal keepMounted>\n <BaseDialog.Backdrop data-fs-sign-in-modal-backdrop=\"\" />\n <BaseDialog.Popup\n {...withoutPanelOwnedKeys(props)}\n className={className}\n finalFocus={signedIn ? focusAnchorRef : true}\n data-fs-sign-in-modal-panel=\"\"\n >\n <div data-fs-sign-in-modal-header=\"\">\n <BaseDialog.Title data-fs-sign-in-modal-title=\"\">{title}</BaseDialog.Title>\n <BaseDialog.Close data-fs-sign-in-modal-close=\"\">{closeLabel}</BaseDialog.Close>\n </div>\n {children}\n </BaseDialog.Popup>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const SignInDisclosure = {\n Root: SignInDisclosureRoot,\n Trigger: SignInDisclosureTrigger,\n ModalPanel: SignInModalPanel,\n};\n"],"mappings":";;;;;;;;;AA6CA,MAAM,mCAAmC,OAAO,8BAA8B;AAE9E,MAAM,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AAM,WAAW,UAAU;CAC3B,MAAM,iBAAiB,OAA0B,IAAI;CAIrD,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CACtD,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,cAAc,gBAAgB,IAAI;CAEhE,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EAAQ,KAAK;EAAgB,UAAU;EAAI,OAAO;EAAoB,sCAAmC;EACtG,UAAA,YAAY,eAAe,qBAAqB;CAC3C,CAAA,GACR,oBAACA,OAAW,MAAZ;EAAuB;EAAM,cAAc;EAAS,OAAA;EAClD,UAAA,qBAACA,OAAW,QAAZ;GAAmB,aAAA;GAAnB,UAAA,CACE,oBAACA,OAAW,UAAZ,EAAqB,kCAA+B,GAAI,CAAA,GACxD,qBAACA,OAAW,OAAZ;IACE,GAAI,sBAAsB,KAAK;IACpB;IACX,YAAY,WAAW,iBAAiB;IACxC,+BAA4B;IAJ9B,UAAA,CAME,qBAAC,OAAD;KAAK,gCAA6B;KAAlC,UAAA,CACE,oBAACA,OAAW,OAAZ;MAAkB,+BAA4B;MAAI,UAAA;KAAwB,CAAA,GAC1E,oBAACA,OAAW,OAAZ;MAAkB,+BAA4B;MAAI,UAAA;KAA6B,CAAA,CAC5E;IACJ,CAAA,GAAA,QACe;GACD,CAAA,CAAA;;CACJ,CAAA,CACjB,EAAA,CAAA;AAEN;AAMA,MAAa,mBAAmB;CAC9B,MAAM;CACN,SAAS;CACT,YAAY;AACd"}
|
|
@@ -1,79 +1,110 @@
|
|
|
1
|
+
import { ContentValue, MessageFieldName, MessageLocaleProp } from "../../core/dist/define-content-type.js";
|
|
1
2
|
import { ComponentDefinition } from "../../core/dist/define-component.js";
|
|
2
3
|
import "../../core/dist/index.js";
|
|
3
4
|
import { SessionUserError } from "../../sdk/session/auth-operations.js";
|
|
4
5
|
import { ComponentActions } from "../../sdk/actions/types.js";
|
|
5
6
|
//#region src/matter/sign-in-form/sign-in-form.d.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
export declare const SignInFormContent: {
|
|
8
|
+
readonly id: "sign-in-form";
|
|
9
|
+
readonly title: "Sign In Form";
|
|
10
|
+
readonly description: "Labels and error messages of the password sign-in step.";
|
|
11
|
+
readonly schema: {
|
|
12
|
+
readonly type: "object";
|
|
13
|
+
readonly additionalProperties: false;
|
|
14
|
+
readonly properties: {
|
|
15
|
+
readonly passwordLabel: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly title: "Password label";
|
|
18
|
+
readonly format: "icu-message";
|
|
19
|
+
readonly messageSource: "Password";
|
|
20
|
+
};
|
|
21
|
+
readonly showPasswordLabel: {
|
|
22
|
+
readonly type: "string";
|
|
23
|
+
readonly title: "Show password label";
|
|
24
|
+
readonly format: "icu-message";
|
|
25
|
+
readonly messageSource: "Show password";
|
|
26
|
+
};
|
|
27
|
+
readonly hidePasswordLabel: {
|
|
28
|
+
readonly type: "string";
|
|
29
|
+
readonly title: "Hide password label";
|
|
30
|
+
readonly format: "icu-message";
|
|
31
|
+
readonly messageSource: "Hide password";
|
|
32
|
+
};
|
|
33
|
+
readonly submitLabel: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly title: "Submit label";
|
|
36
|
+
readonly format: "icu-message";
|
|
37
|
+
readonly messageSource: "Sign In";
|
|
38
|
+
};
|
|
39
|
+
readonly passwordRequiredMessage: {
|
|
40
|
+
readonly type: "string";
|
|
41
|
+
readonly title: "Password required message";
|
|
42
|
+
readonly format: "icu-message";
|
|
43
|
+
readonly messageSource: "Enter your password.";
|
|
44
|
+
};
|
|
45
|
+
readonly invalidCredentialsMessage: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly title: "Invalid credentials message";
|
|
48
|
+
readonly format: "icu-message";
|
|
49
|
+
readonly messageSource: "Incorrect email or password. Please try again.";
|
|
50
|
+
};
|
|
51
|
+
readonly blockedMessage: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
readonly title: "Blocked account message";
|
|
54
|
+
readonly format: "icu-message";
|
|
55
|
+
readonly messageSource: "Access to this account is temporarily blocked. Please try again later.";
|
|
56
|
+
};
|
|
57
|
+
readonly networkErrorMessage: {
|
|
58
|
+
readonly type: "string";
|
|
59
|
+
readonly title: "Network error message";
|
|
60
|
+
readonly format: "icu-message";
|
|
61
|
+
readonly messageSource: "Unable to complete the request. Please try again.";
|
|
62
|
+
};
|
|
63
|
+
readonly genericErrorMessage: {
|
|
64
|
+
readonly type: "string";
|
|
65
|
+
readonly title: "Generic error message";
|
|
66
|
+
readonly format: "icu-message";
|
|
67
|
+
readonly messageSource: "Unable to sign in. Please try again.";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** The `sign-in-form` message a rejected sign-in renders. */
|
|
73
|
+
export type SignInFormErrorField = Extract<MessageFieldName<typeof SignInFormContent>, 'passwordRequiredMessage' | 'invalidCredentialsMessage' | 'blockedMessage' | 'networkErrorMessage' | 'genericErrorMessage'>;
|
|
74
|
+
export type SignInFormProps = MessageLocaleProp & Readonly<{
|
|
20
75
|
passwordPlaceholder?: string;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
submitLabel?: string;
|
|
24
|
-
/** Inline error for an invalid email format (mirrors EmailIdentificationControl). */
|
|
25
|
-
invalidEmailMessage?: string;
|
|
26
|
-
/** Inline error when the password field is submitted empty (this form owns the presence check). */
|
|
27
|
-
passwordRequiredMessage?: string;
|
|
28
|
-
invalidCredentialsMessage?: string;
|
|
29
|
-
blockedMessage?: string;
|
|
30
|
-
networkErrorMessage?: string;
|
|
31
|
-
genericErrorMessage?: string;
|
|
32
|
-
/** ClientProfile slice forwarded by the reactive runtime; `null` until the entity resolves. */
|
|
33
|
-
$data?: SignInFormSlice | null;
|
|
76
|
+
/** Labels and error messages; see `SignInFormContent`. */
|
|
77
|
+
$content?: ContentValue<typeof SignInFormContent>;
|
|
34
78
|
/** Compiler-injected action surface; carries `session.loginWithPassword`. */
|
|
35
79
|
$actions?: ComponentActions;
|
|
36
80
|
className?: string;
|
|
37
81
|
}>;
|
|
38
82
|
/**
|
|
39
|
-
* Maps the first resolved SessionUserError to
|
|
40
|
-
* ACCESS_CODE_SEND_LIMIT, and MISSING_AUTH_CONTEXT are contractually unreachable
|
|
41
|
-
* loginWithPassword but share the untyped `code: string` field, so they fall through to the
|
|
83
|
+
* Maps the first resolved SessionUserError to the `sign-in-form` message that words it.
|
|
84
|
+
* INVALID_ACCESS_CODE, ACCESS_CODE_SEND_LIMIT, and MISSING_AUTH_CONTEXT are contractually unreachable
|
|
85
|
+
* from loginWithPassword but share the untyped `code: string` field, so they fall through to the
|
|
42
86
|
* generic message defensively, alongside any future/unknown code.
|
|
43
87
|
*/
|
|
44
|
-
export declare function
|
|
45
|
-
export declare const SignInFormDefinition: ComponentDefinition<
|
|
46
|
-
emailLabel?: string;
|
|
47
|
-
emailPlaceholder?: string;
|
|
48
|
-
passwordLabel?: string;
|
|
49
|
-
passwordPlaceholder?: string;
|
|
50
|
-
showPasswordLabel?: string;
|
|
51
|
-
hidePasswordLabel?: string;
|
|
52
|
-
submitLabel?: string;
|
|
53
|
-
/** Inline error for an invalid email format (mirrors EmailIdentificationControl). */
|
|
54
|
-
invalidEmailMessage?: string;
|
|
55
|
-
/** Inline error when the password field is submitted empty (this form owns the presence check). */
|
|
56
|
-
passwordRequiredMessage?: string;
|
|
57
|
-
invalidCredentialsMessage?: string;
|
|
58
|
-
blockedMessage?: string;
|
|
59
|
-
networkErrorMessage?: string;
|
|
60
|
-
genericErrorMessage?: string;
|
|
61
|
-
/** ClientProfile slice forwarded by the reactive runtime; `null` until the entity resolves. */
|
|
62
|
-
$data?: SignInFormSlice | null;
|
|
63
|
-
/** Compiler-injected action surface; carries `session.loginWithPassword`. */
|
|
64
|
-
$actions?: ComponentActions;
|
|
65
|
-
className?: string;
|
|
66
|
-
}>>;
|
|
88
|
+
export declare function mapSessionErrorField(error: SessionUserError | undefined): SignInFormErrorField | null;
|
|
89
|
+
export declare const SignInFormDefinition: ComponentDefinition<SignInFormProps>;
|
|
67
90
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* (
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
91
|
+
* Password method of the sign-in surface. It declares no fragment and reads no data of its own: the
|
|
92
|
+
* gate is the `sign-in` context (`resolved`, `passwordEnabled` and `method === 'password'`) plus the
|
|
93
|
+
* session read (`state !== 'loggedIn'`), so a store enabling both methods shows the password step only
|
|
94
|
+
* while it is the method showing, and a store that disables passwords never shows it. It returns `null`
|
|
95
|
+
* rather than unmounting, so a half-typed password survives a method switch.
|
|
96
|
+
*
|
|
97
|
+
* The email is the shared draft `SignInRoot` owns, read at submit time and trimmed; this form renders no
|
|
98
|
+
* email field, and the submit stays disabled until that draft is a valid address. The password-presence
|
|
99
|
+
* check runs on submit. The awaited dispatch's first `userError` maps to a `sign-in-form` message:
|
|
100
|
+
* `INVALID_CREDENTIALS` is a claim about the password the shopper typed, so it renders on the
|
|
101
|
+
* `PasswordField`; every other code is a claim about the account or the request and renders in
|
|
102
|
+
* `data-fs-sign-in-form-error`. A dispatched attempt clears the password, accepted or rejected, and leaves the shared email alone.
|
|
103
|
+
* While the write is in flight the password and submit are disabled and `data-fs-sign-in-form-pending` is
|
|
104
|
+
* present so a checkout-CTA guard can block. The password clears when the session reaches `loggedIn`, and
|
|
105
|
+
* when a `SignInModalPanel` hosting it closes: this form never unmounts, so it would otherwise outlive the
|
|
106
|
+
* session it was typed for, and sit in the hidden panel after the shopper changed their mind.
|
|
76
107
|
*/
|
|
77
|
-
export declare function SignInForm({
|
|
108
|
+
export declare function SignInForm({ passwordPlaceholder, $content, $actions: $actionsProp, className }: SignInFormProps): import("react/jsx-runtime").JSX.Element | null;
|
|
78
109
|
//#endregion
|
|
79
110
|
//# sourceMappingURL=sign-in-form.d.ts.map
|