@shopify/ui-extensions 2025.10.0-rc.45 → 2025.10.0-rc.47
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/build/cjs/surfaces/checkout/preact/api.js +1 -1
- package/build/cjs/surfaces/checkout/shared.js +1 -1
- package/build/esm/surfaces/checkout/preact/api.mjs +1 -1
- package/build/esm/surfaces/checkout/shared.mjs +1 -1
- package/build/esnext/surfaces/checkout/preact/api.esnext +1 -1
- package/build/esnext/surfaces/checkout/shared.esnext +1 -1
- package/build/ts/docs/shared/components/ConsentCheckbox.d.ts +4 -0
- package/build/ts/docs/shared/components/ConsentCheckbox.d.ts.map +1 -0
- package/build/ts/docs/shared/components/ConsentPhoneField.d.ts +4 -0
- package/build/ts/docs/shared/components/ConsentPhoneField.d.ts.map +1 -0
- package/build/ts/docs/shared/components/index.d.ts +2 -0
- package/build/ts/docs/shared/components/index.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/components/ConsentCheckbox/ConsentCheckbox.doc.d.ts +4 -0
- package/build/ts/surfaces/checkout/components/ConsentCheckbox/ConsentCheckbox.doc.d.ts.map +1 -0
- package/build/ts/surfaces/checkout/components/ConsentCheckbox.d.ts +84 -0
- package/build/ts/surfaces/checkout/components/ConsentPhoneField/ConsentPhoneField.doc.d.ts +4 -0
- package/build/ts/surfaces/checkout/components/ConsentPhoneField/ConsentPhoneField.doc.d.ts.map +1 -0
- package/build/ts/surfaces/checkout/components/ConsentPhoneField.d.ts +129 -0
- package/build/ts/surfaces/checkout/components/NumberField/NumberField.doc.d.ts +4 -0
- package/build/ts/surfaces/checkout/components/NumberField/NumberField.doc.d.ts.map +1 -0
- package/build/ts/surfaces/checkout/components/NumberField.d.ts +98 -0
- package/build/ts/surfaces/checkout/components/PasswordField.d.ts +1 -1
- package/build/ts/surfaces/checkout/components/components-shared.d.ts +17 -0
- package/build/ts/surfaces/checkout/components/components.d.ts +216 -144
- package/build/ts/surfaces/checkout/shared.d.ts +1 -1
- package/build/ts/surfaces/checkout/shared.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/targets/Checkout::Actions::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::CartLineDetails::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::CartLineDetails::RenderLineComponents.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::CartLines::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::Contact::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::CustomerInformation::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::DeliveryAddress::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::Dynamic::Render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::GiftCard::Render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::HostedFields::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::Render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::RenderRequiredAction.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PickupLocations::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PickupLocations::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PickupPoints::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::PickupPoints::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::Reductions::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::Reductions::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethodDetails::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethodDetails::RenderExpanded.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethods::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethods::RenderBefore.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CartLineDetails::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CartLines::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CustomerInformation::RenderAfter.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::Dynamic::Render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.cart-line-item.line-components.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.actions.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.block.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.cart-line-item.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.cart-line-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.contact.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.delivery-address.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.delivery-address.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.footer.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.gift-card.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.header.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-method-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-method-list.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.action-required.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.details.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.hosted-fields.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-list.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-option-item.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-point-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-point-list.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.reductions.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.reductions.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-item.details.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-item.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-list.render-before.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.announcement.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.block.render.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.cart-line-item.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.cart-line-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.customer-information.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.footer.render-after.d.ts +3 -0
- package/build/ts/surfaces/checkout/targets/purchase.thank-you.header.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/components/ConsentCheckbox.d.ts +84 -0
- package/build/ts/surfaces/customer-account/components/ConsentPhoneField.d.ts +129 -0
- package/build/ts/surfaces/customer-account/components/NumberField.d.ts +98 -0
- package/build/ts/surfaces/customer-account/components/PasswordField.d.ts +1 -1
- package/build/ts/surfaces/customer-account/components/components-shared.d.ts +17 -0
- package/build/ts/surfaces/customer-account/components/components.d.ts +216 -144
- package/build/ts/surfaces/customer-account/targets/customer-account.footer.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-index.announcement.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-index.block.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.announcement.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.block.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.cart-line-item.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.cart-line-list.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.customer-information.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.fulfillment-details.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.payment-details.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.return-details.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order-status.unfulfilled-items.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order.action.menu-item.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order.action.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.order.page.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.page.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.addresses.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.announcement.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.block.render.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-details.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-addresses.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-payment.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-staff.render-after.d.ts +3 -0
- package/build/ts/surfaces/customer-account/targets/customer-account.profile.payment.render-after.d.ts +3 -0
- package/build/ts/surfaces/point-of-sale/components/Badge.d.ts +10 -1
- package/build/ts/surfaces/point-of-sale/components/Banner.d.ts +12 -4
- package/build/ts/surfaces/point-of-sale/components/Box.d.ts +51 -14
- package/build/ts/surfaces/point-of-sale/components/Button.d.ts +12 -2
- package/build/ts/surfaces/point-of-sale/components/Choice.d.ts +3 -2
- package/build/ts/surfaces/point-of-sale/components/ChoiceList/ChoiceList.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/ChoiceList.d.ts +13 -4
- package/build/ts/surfaces/point-of-sale/components/Clickable.d.ts +11 -4
- package/build/ts/surfaces/point-of-sale/components/DateField/DateField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DateField.d.ts +20 -13
- package/build/ts/surfaces/point-of-sale/components/DatePicker/DatePicker.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DatePicker.d.ts +16 -4
- package/build/ts/surfaces/point-of-sale/components/DateSpinner/DateSpinner.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DateSpinner.d.ts +16 -4
- package/build/ts/surfaces/point-of-sale/components/Divider/Divider.doc.d.ts +4 -0
- package/build/ts/surfaces/point-of-sale/components/Divider/Divider.doc.d.ts.map +1 -0
- package/build/ts/surfaces/point-of-sale/components/Divider.d.ts +4 -3
- package/build/ts/surfaces/point-of-sale/components/EmailField/EmailField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/EmailField.d.ts +22 -5
- package/build/ts/surfaces/point-of-sale/components/Heading.d.ts +7 -4
- package/build/ts/surfaces/point-of-sale/components/Icon.d.ts +13 -3
- package/build/ts/surfaces/point-of-sale/components/Image.d.ts +12 -5
- package/build/ts/surfaces/point-of-sale/components/Modal.d.ts +28 -7
- package/build/ts/surfaces/point-of-sale/components/NumberField/NumberField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/NumberField.d.ts +32 -23
- package/build/ts/surfaces/point-of-sale/components/Page.d.ts +25 -11
- package/build/ts/surfaces/point-of-sale/components/PosBlock.d.ts +12 -13
- package/build/ts/surfaces/point-of-sale/components/QrCode.d.ts +12 -8
- package/build/ts/surfaces/point-of-sale/components/ScrollBox.d.ts +47 -15
- package/build/ts/surfaces/point-of-sale/components/SearchField/SearchField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/SearchField.d.ts +17 -5
- package/build/ts/surfaces/point-of-sale/components/Section.d.ts +15 -9
- package/build/ts/surfaces/point-of-sale/components/Stack.d.ts +67 -7
- package/build/ts/surfaces/point-of-sale/components/Text.d.ts +25 -4
- package/build/ts/surfaces/point-of-sale/components/TextArea/TextArea.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TextArea.d.ts +22 -5
- package/build/ts/surfaces/point-of-sale/components/TextField/TextField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TextField.d.ts +22 -5
- package/build/ts/surfaces/point-of-sale/components/Tile.d.ts +12 -2
- package/build/ts/surfaces/point-of-sale/components/TimeField/TimeField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TimeField.d.ts +18 -6
- package/build/ts/surfaces/point-of-sale/components/TimePicker/TimePicker.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TimePicker.d.ts +16 -4
- package/build/ts/surfaces/point-of-sale/components/components-shared.d.ts +102 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -3
- package/src/docs/shared/components/ConsentCheckbox.ts +12 -0
- package/src/docs/shared/components/ConsentPhoneField.ts +12 -0
- package/src/docs/shared/components/index.ts +2 -0
- package/src/surfaces/checkout/components/ConsentCheckbox/examples/basic-consent-checkbox.example.html +5 -0
- package/src/surfaces/checkout/components/ConsentCheckbox.d.ts +84 -0
- package/src/surfaces/checkout/components/ConsentPhoneField/examples/basic-consent-phone-field.example.html +5 -0
- package/src/surfaces/checkout/components/ConsentPhoneField.d.ts +129 -0
- package/src/surfaces/checkout/components/NumberField/examples/basic-number-field.example.html +8 -0
- package/src/surfaces/checkout/components/NumberField.d.ts +98 -0
- package/src/surfaces/checkout/components/PasswordField.d.ts +1 -1
- package/src/surfaces/checkout/components/PhoneField/examples/basic-phone-field.example.html +2 -1
- package/src/surfaces/checkout/components/ProductThumbnail/examples/basic-product-thumbnail.example.html +4 -1
- package/src/surfaces/checkout/components/Stack/examples/basic-stack.example.html +20 -4
- package/src/surfaces/checkout/components/TextArea/examples/basic-text-area.example.html +5 -1
- package/src/surfaces/checkout/components/TextField/examples/basic-text-field.example.html +4 -1
- package/src/surfaces/checkout/components/components-shared.d.ts +17 -0
- package/src/surfaces/checkout/components/components.d.ts +216 -144
- package/src/surfaces/checkout/preact/api.ts +1 -1
- package/src/surfaces/checkout/preact/tests/api.test.tsx +22 -13
- package/src/surfaces/checkout/preact/tests/app-metafields.test.ts +52 -56
- package/src/surfaces/checkout/preact/tests/attributes.test.ts +34 -24
- package/src/surfaces/checkout/preact/tests/billing-address.test.ts +17 -7
- package/src/surfaces/checkout/preact/tests/buyer-identity-businessCustomer.test.ts +16 -9
- package/src/surfaces/checkout/preact/tests/buyer-identity.test.tsx +57 -26
- package/src/surfaces/checkout/preact/tests/buyer-journey.test.ts +71 -74
- package/src/surfaces/checkout/preact/tests/capabilities.test.ts +32 -28
- package/src/surfaces/checkout/preact/tests/cart-line-target.test.ts +31 -24
- package/src/surfaces/checkout/preact/tests/checkout-settings.test.ts +17 -9
- package/src/surfaces/checkout/preact/tests/checkout-token.test.ts +16 -6
- package/src/surfaces/checkout/preact/tests/configuration.test.ts +16 -6
- package/src/surfaces/checkout/preact/tests/country.test.tsx +18 -8
- package/src/surfaces/checkout/preact/tests/currency.test.tsx +18 -8
- package/src/surfaces/checkout/preact/tests/customer-privacy.test.ts +17 -8
- package/src/surfaces/checkout/preact/tests/delivery-group-list-target.test.ts +24 -18
- package/src/surfaces/checkout/preact/tests/delivery-group-target.test.ts +25 -19
- package/src/surfaces/checkout/preact/tests/delivery-group.test.ts +22 -16
- package/src/surfaces/checkout/preact/tests/delivery-groups.test.ts +17 -11
- package/src/surfaces/checkout/preact/tests/delivery-selection-groups.test.ts +31 -24
- package/src/surfaces/checkout/preact/tests/discounts.test.tsx +21 -14
- package/src/surfaces/checkout/preact/tests/extension-language.test.tsx +17 -8
- package/src/surfaces/checkout/preact/tests/gift-cards.test.tsx +17 -8
- package/src/surfaces/checkout/preact/tests/localized-fields.test.ts +58 -59
- package/src/surfaces/checkout/preact/tests/market.test.tsx +17 -7
- package/src/surfaces/checkout/preact/tests/metafield.test.tsx +33 -36
- package/src/surfaces/checkout/preact/tests/metafields.test.tsx +36 -53
- package/src/surfaces/checkout/preact/tests/mount.tsx +60 -17
- package/src/surfaces/checkout/preact/tests/notes.test.tsx +16 -6
- package/src/surfaces/checkout/preact/tests/payment-method.test.ts +87 -60
- package/src/surfaces/checkout/preact/tests/payment-options.test.tsx +26 -24
- package/src/surfaces/checkout/preact/tests/pickup-location-option-target.test.tsx +55 -46
- package/src/surfaces/checkout/preact/tests/redeemable.test.ts +30 -23
- package/src/surfaces/checkout/preact/tests/session-token.test.tsx +12 -6
- package/src/surfaces/checkout/preact/tests/shipping-address.test.ts +17 -7
- package/src/surfaces/checkout/preact/tests/shipping-option-target.test.ts +54 -50
- package/src/surfaces/checkout/preact/tests/shopping-address.test.tsx +18 -10
- package/src/surfaces/checkout/preact/tests/timezone.test.tsx +17 -7
- package/src/surfaces/checkout/preact/tests/translate.test.tsx +18 -13
- package/src/surfaces/checkout/preact/tests/tsconfig.json +1 -1
- package/src/surfaces/checkout/shared.ts +2 -0
- package/src/surfaces/point-of-sale/components/Badge.d.ts +10 -1
- package/src/surfaces/point-of-sale/components/Banner/examples/default.html +8 -8
- package/src/surfaces/point-of-sale/components/Banner.d.ts +12 -4
- package/src/surfaces/point-of-sale/components/Box/examples/default.html +2 -2
- package/src/surfaces/point-of-sale/components/Box.d.ts +51 -14
- package/src/surfaces/point-of-sale/components/Button/examples/default.html +2 -4
- package/src/surfaces/point-of-sale/components/Button.d.ts +12 -2
- package/src/surfaces/point-of-sale/components/Choice.d.ts +3 -2
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/default.html +5 -4
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/multiple-selection.jsx +9 -0
- package/src/surfaces/point-of-sale/components/ChoiceList.d.ts +13 -4
- package/src/surfaces/point-of-sale/components/Clickable/examples/default.html +5 -2
- package/src/surfaces/point-of-sale/components/Clickable.d.ts +11 -4
- package/src/surfaces/point-of-sale/components/DateField/examples/default.html +2 -10
- package/src/surfaces/point-of-sale/components/DateField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/DateField.d.ts +20 -13
- package/src/surfaces/point-of-sale/components/DatePicker/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/DatePicker/examples/default.html +4 -5
- package/src/surfaces/point-of-sale/components/DatePicker/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/DatePicker.d.ts +16 -4
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/default.html +1 -2
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/DateSpinner.d.ts +16 -4
- package/src/surfaces/point-of-sale/components/Divider/examples/default.html +1 -0
- package/src/surfaces/point-of-sale/components/Divider.d.ts +4 -3
- package/src/surfaces/point-of-sale/components/EmailField/examples/accessory-slot.jsx +9 -0
- package/src/surfaces/point-of-sale/components/EmailField/examples/default.html +3 -10
- package/src/surfaces/point-of-sale/components/EmailField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/EmailField.d.ts +22 -5
- package/src/surfaces/point-of-sale/components/Heading/examples/default.html +4 -5
- package/src/surfaces/point-of-sale/components/Heading.d.ts +7 -4
- package/src/surfaces/point-of-sale/components/Icon/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/Icon.d.ts +13 -3
- package/src/surfaces/point-of-sale/components/Image/examples/default.html +1 -1
- package/src/surfaces/point-of-sale/components/Image.d.ts +12 -5
- package/src/surfaces/point-of-sale/components/Modal/examples/default.html +6 -8
- package/src/surfaces/point-of-sale/components/Modal.d.ts +28 -7
- package/src/surfaces/point-of-sale/components/NumberField/examples/controls-constraints.jsx +9 -0
- package/src/surfaces/point-of-sale/components/NumberField/examples/default.html +5 -2
- package/src/surfaces/point-of-sale/components/NumberField/examples/input-mode.jsx +15 -0
- package/src/surfaces/point-of-sale/components/NumberField.d.ts +32 -23
- package/src/surfaces/point-of-sale/components/Page/examples/default.html +3 -4
- package/src/surfaces/point-of-sale/components/Page.d.ts +25 -11
- package/src/surfaces/point-of-sale/components/PosBlock/examples/default.html +3 -9
- package/src/surfaces/point-of-sale/components/PosBlock.d.ts +12 -13
- package/src/surfaces/point-of-sale/components/QrCode.d.ts +12 -8
- package/src/surfaces/point-of-sale/components/ScrollBox/examples/default.html +5 -4
- package/src/surfaces/point-of-sale/components/ScrollBox.d.ts +47 -15
- package/src/surfaces/point-of-sale/components/SearchField/examples/default.html +1 -1
- package/src/surfaces/point-of-sale/components/SearchField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/SearchField.d.ts +17 -5
- package/src/surfaces/point-of-sale/components/Section/examples/default.html +6 -8
- package/src/surfaces/point-of-sale/components/Section.d.ts +15 -9
- package/src/surfaces/point-of-sale/components/Stack/examples/default.html +3 -3
- package/src/surfaces/point-of-sale/components/Stack.d.ts +67 -7
- package/src/surfaces/point-of-sale/components/Text/examples/default.html +3 -6
- package/src/surfaces/point-of-sale/components/Text.d.ts +25 -4
- package/src/surfaces/point-of-sale/components/TextArea/examples/accessory-slot.jsx +9 -0
- package/src/surfaces/point-of-sale/components/TextArea/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/TextArea/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/TextArea/examples/rows-configuration.jsx +7 -0
- package/src/surfaces/point-of-sale/components/TextArea.d.ts +22 -5
- package/src/surfaces/point-of-sale/components/TextField/examples/accessory-slot.jsx +5 -0
- package/src/surfaces/point-of-sale/components/TextField/examples/common-props.jsx +11 -0
- package/src/surfaces/point-of-sale/components/TextField/examples/default.html +5 -3
- package/src/surfaces/point-of-sale/components/TextField/examples/event-handling.jsx +17 -0
- package/src/surfaces/point-of-sale/components/TextField.d.ts +22 -5
- package/src/surfaces/point-of-sale/components/Tile/examples/default.html +2 -5
- package/src/surfaces/point-of-sale/components/Tile.d.ts +12 -2
- package/src/surfaces/point-of-sale/components/TimeField/examples/default.html +1 -9
- package/src/surfaces/point-of-sale/components/TimeField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/TimeField.d.ts +18 -6
- package/src/surfaces/point-of-sale/components/TimePicker/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/TimePicker/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/TimePicker/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/TimePicker.d.ts +16 -4
- package/src/surfaces/point-of-sale/components/components-shared.d.ts +102 -1
- package/src/surfaces/point-of-sale/components.d.ts +957 -472
- package/build/ts/surfaces/checkout/errors.d.ts +0 -10
- package/build/ts/surfaces/checkout/errors.d.ts.map +0 -1
- package/src/surfaces/checkout/errors.ts +0 -13
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
PaymentOption,
|
|
3
3
|
SelectedPaymentOption,
|
|
4
|
-
} from '
|
|
4
|
+
} from '../../api/standard/standard';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
useAvailablePaymentOptions,
|
|
8
8
|
useSelectedPaymentOptions,
|
|
9
9
|
} from '../payment-options';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
mount,
|
|
13
|
+
createMockSubscribableSignalLike,
|
|
14
|
+
setupGlobalShopifyMock,
|
|
15
|
+
tearDownGlobalShopifyMock,
|
|
16
|
+
} from './mount';
|
|
17
|
+
|
|
18
|
+
// See __mocks__/preact/hooks
|
|
19
|
+
jest.mock('preact/hooks');
|
|
13
20
|
|
|
14
|
-
describe
|
|
21
|
+
describe('Payment Methods API hooks', () => {
|
|
22
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
15
23
|
describe('useAvailablePaymentOptions', () => {
|
|
16
24
|
it('returns the available payment methods', async () => {
|
|
17
25
|
const paymentOptions: PaymentOption[] = [
|
|
@@ -19,15 +27,13 @@ describe.skip('Payment Methods API hooks', () => {
|
|
|
19
27
|
{handle: 'direct', type: 'creditCard'},
|
|
20
28
|
];
|
|
21
29
|
|
|
22
|
-
|
|
30
|
+
setupGlobalShopifyMock({
|
|
23
31
|
availablePaymentOptions:
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const {value} = mount.hook(() => useAvailablePaymentOptions(), {
|
|
28
|
-
extensionApi,
|
|
32
|
+
createMockSubscribableSignalLike(paymentOptions),
|
|
29
33
|
});
|
|
30
34
|
|
|
35
|
+
const {value} = mount.hook(() => useAvailablePaymentOptions());
|
|
36
|
+
|
|
31
37
|
expect(value).toBe(paymentOptions);
|
|
32
38
|
});
|
|
33
39
|
});
|
|
@@ -47,19 +53,17 @@ describe.skip('Payment Methods API hooks', () => {
|
|
|
47
53
|
{handle: 'bogus', type: 'other'},
|
|
48
54
|
];
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
availablePaymentOptions:
|
|
56
|
+
setupGlobalShopifyMock({
|
|
57
|
+
availablePaymentOptions: createMockSubscribableSignalLike(
|
|
52
58
|
availablePaymentOptions,
|
|
53
59
|
),
|
|
54
|
-
selectedPaymentOptions:
|
|
60
|
+
selectedPaymentOptions: createMockSubscribableSignalLike(
|
|
55
61
|
selectedPaymentOptionHandles,
|
|
56
62
|
),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const {value} = mount.hook(() => useSelectedPaymentOptions(), {
|
|
60
|
-
extensionApi,
|
|
61
63
|
});
|
|
62
64
|
|
|
65
|
+
const {value} = mount.hook(() => useSelectedPaymentOptions());
|
|
66
|
+
|
|
63
67
|
expect(value).toStrictEqual(selectedPaymentOptions);
|
|
64
68
|
});
|
|
65
69
|
|
|
@@ -79,19 +83,17 @@ describe.skip('Payment Methods API hooks', () => {
|
|
|
79
83
|
{handle: 'direct', type: 'creditCard'},
|
|
80
84
|
];
|
|
81
85
|
|
|
82
|
-
|
|
83
|
-
availablePaymentOptions:
|
|
86
|
+
setupGlobalShopifyMock({
|
|
87
|
+
availablePaymentOptions: createMockSubscribableSignalLike(
|
|
84
88
|
availablePaymentOptions,
|
|
85
89
|
),
|
|
86
|
-
selectedPaymentOptions:
|
|
90
|
+
selectedPaymentOptions: createMockSubscribableSignalLike(
|
|
87
91
|
selectedPaymentOptionHandles,
|
|
88
92
|
),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const {value} = mount.hook(() => useSelectedPaymentOptions(), {
|
|
92
|
-
extensionApi,
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
const {value} = mount.hook(() => useSelectedPaymentOptions());
|
|
96
|
+
|
|
95
97
|
expect(value).toStrictEqual(selectedPaymentOptions);
|
|
96
98
|
});
|
|
97
99
|
});
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
PickupLocationOption,
|
|
4
|
-
} from '@shopify/ui-extensions/checkout';
|
|
1
|
+
import type {PickupLocationOption} from '../../api/standard/standard';
|
|
2
|
+
import type {ExtensionTarget} from '../../extension-targets';
|
|
5
3
|
|
|
6
4
|
import {usePickupLocationOptionTarget} from '../pickup-location-option-target';
|
|
7
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createMockSubscribableSignalLike,
|
|
7
|
+
mount,
|
|
8
|
+
setupGlobalShopifyMock,
|
|
9
|
+
tearDownGlobalShopifyMock,
|
|
10
|
+
createMockExtension,
|
|
11
|
+
} from './mount';
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
// See __mocks__/preact/hooks
|
|
14
|
+
jest.mock('preact/hooks');
|
|
10
15
|
|
|
11
|
-
describe
|
|
12
|
-
|
|
16
|
+
describe('usePickupLocationOptionTarget', () => {
|
|
17
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
18
|
+
const pickupLocationOption: PickupLocationOption = {
|
|
13
19
|
handle: 'pickup_method_1',
|
|
14
20
|
title: 'Pickup method 1',
|
|
15
21
|
description: 'something',
|
|
@@ -18,60 +24,63 @@ describe.skip('usePickupLocationOptionTarget', () => {
|
|
|
18
24
|
location: {
|
|
19
25
|
address: {
|
|
20
26
|
address1: '123 Fake St',
|
|
21
|
-
address2:
|
|
27
|
+
address2: undefined,
|
|
22
28
|
city: 'Ottawa',
|
|
23
|
-
company:
|
|
24
|
-
|
|
29
|
+
company: undefined,
|
|
30
|
+
countryCode: 'CA',
|
|
25
31
|
firstName: 'Bob',
|
|
26
32
|
lastName: 'Bobsen',
|
|
27
33
|
phone: '555-555-5555',
|
|
28
|
-
|
|
34
|
+
provinceCode: 'ON',
|
|
29
35
|
zip: 'K2P0V6',
|
|
30
36
|
},
|
|
31
37
|
},
|
|
32
|
-
|
|
38
|
+
metafields: [],
|
|
39
|
+
};
|
|
33
40
|
|
|
34
|
-
it('throws if extension target has no api.target',
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
extension: {target},
|
|
40
|
-
target: undefined,
|
|
41
|
-
isTargetSelected: createMockStatefulRemoteSubscribable(true),
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
};
|
|
41
|
+
it('throws if extension target has no api.target', () => {
|
|
42
|
+
const target: ExtensionTarget = 'purchase.checkout.block.render';
|
|
43
|
+
setupGlobalShopifyMock({
|
|
44
|
+
extension: createMockExtension(target),
|
|
45
|
+
});
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
expect(() => {
|
|
48
|
+
mount.hook(() => usePickupLocationOptionTarget());
|
|
49
|
+
}).toThrow(
|
|
50
|
+
expect.objectContaining({
|
|
51
|
+
name: 'ExtensionHasNoTargetError',
|
|
52
|
+
}),
|
|
53
|
+
);
|
|
47
54
|
});
|
|
48
55
|
|
|
49
|
-
it('throws if extension target has no api.isTargetSelected',
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
isTargetSelected: undefined,
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
};
|
|
56
|
+
it('throws if extension target has no api.isTargetSelected', () => {
|
|
57
|
+
const target =
|
|
58
|
+
'purchase.checkout.pickup-location-option-item.render-after' as const;
|
|
59
|
+
setupGlobalShopifyMock<typeof target>({
|
|
60
|
+
extension: createMockExtension(target),
|
|
61
|
+
target: createMockSubscribableSignalLike(pickupLocationOption),
|
|
62
|
+
});
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
expect(() => {
|
|
65
|
+
mount.hook(() => usePickupLocationOptionTarget());
|
|
66
|
+
}).toThrow(
|
|
67
|
+
expect.objectContaining({
|
|
68
|
+
name: 'ExtensionHasNoTargetError',
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
62
71
|
});
|
|
63
72
|
|
|
64
|
-
it('returns the pickup location option target if it exists',
|
|
65
|
-
const target
|
|
66
|
-
'purchase.checkout.pickup-location-option-item.render-after';
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
isTargetSelected: createMockStatefulRemoteSubscribable(true),
|
|
72
|
-
},
|
|
73
|
+
it('returns the pickup location option target if it exists', () => {
|
|
74
|
+
const target =
|
|
75
|
+
'purchase.checkout.pickup-location-option-item.render-after' as const;
|
|
76
|
+
setupGlobalShopifyMock<typeof target>({
|
|
77
|
+
extension: createMockExtension(target),
|
|
78
|
+
target: createMockSubscribableSignalLike(pickupLocationOption),
|
|
79
|
+
isTargetSelected: createMockSubscribableSignalLike(true),
|
|
73
80
|
});
|
|
74
81
|
|
|
82
|
+
const {value} = mount.hook(() => usePickupLocationOptionTarget());
|
|
83
|
+
|
|
75
84
|
expect(value).toStrictEqual({
|
|
76
85
|
pickupLocationOptionTarget: pickupLocationOption,
|
|
77
86
|
isTargetSelected: true,
|
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
import type {ExtensionTarget} from '
|
|
1
|
+
import type {ExtensionTarget} from '../../extension-targets';
|
|
2
2
|
|
|
3
3
|
import {useApplyRedeemableChange} from '../redeemable';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
mount,
|
|
6
|
+
setupGlobalShopifyMock,
|
|
7
|
+
tearDownGlobalShopifyMock,
|
|
8
|
+
createMockExtension,
|
|
9
|
+
} from './mount';
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
describe.skip('Redeemable API hooks', () => {
|
|
11
|
+
describe('Redeemable API hooks', () => {
|
|
12
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
9
13
|
describe('useApplyRedeemableChange()', () => {
|
|
10
14
|
it('returns the applyRedeemableChange function', async () => {
|
|
11
|
-
const target
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const {value} = mount.hook(() => useApplyRedeemableChange(), {
|
|
17
|
-
extensionApi,
|
|
15
|
+
const target = 'purchase.checkout.gift-card.render' as const;
|
|
16
|
+
const mockApplyRedeemableChange = jest.fn();
|
|
17
|
+
setupGlobalShopifyMock<typeof target>({
|
|
18
|
+
applyRedeemableChange: mockApplyRedeemableChange,
|
|
19
|
+
extension: createMockExtension(target),
|
|
18
20
|
});
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
const {value} = mount.hook(() => useApplyRedeemableChange());
|
|
23
|
+
expect(value).toBe(mockApplyRedeemableChange);
|
|
20
24
|
});
|
|
21
25
|
|
|
22
|
-
it('raises when applyRedeemableChange is not available',
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
26
|
+
it('raises when applyRedeemableChange is not available', () => {
|
|
27
|
+
const target: ExtensionTarget = 'purchase.checkout.block.render';
|
|
28
|
+
setupGlobalShopifyMock({
|
|
29
|
+
extension: createMockExtension(target),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(() => {
|
|
33
|
+
mount.hook(() => useApplyRedeemableChange());
|
|
34
|
+
}).toThrow(
|
|
35
|
+
expect.objectContaining({
|
|
36
|
+
name: 'ExtensionHasNoMethodError',
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
32
39
|
});
|
|
33
40
|
});
|
|
34
41
|
});
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import {useSessionToken} from '../session-token';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
mount,
|
|
5
|
+
setupGlobalShopifyMock,
|
|
6
|
+
tearDownGlobalShopifyMock,
|
|
7
|
+
} from './mount';
|
|
8
|
+
|
|
9
|
+
describe('useSessionToken', () => {
|
|
10
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
4
11
|
|
|
5
|
-
describe.skip('useSessionToken', () => {
|
|
6
12
|
it('returns sessionToken from the api', () => {
|
|
7
13
|
const mockGetSessionToken = {
|
|
8
14
|
get: jest.fn(),
|
|
9
15
|
};
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
sessionToken: mockGetSessionToken,
|
|
14
|
-
},
|
|
17
|
+
setupGlobalShopifyMock({
|
|
18
|
+
sessionToken: mockGetSessionToken as any,
|
|
15
19
|
});
|
|
16
20
|
|
|
21
|
+
const {value} = mount.hook(() => useSessionToken());
|
|
22
|
+
|
|
17
23
|
expect(value).toMatchObject(mockGetSessionToken);
|
|
18
24
|
});
|
|
19
25
|
});
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import type {MailingAddress} from '
|
|
1
|
+
import type {MailingAddress} from '../../api/shared';
|
|
2
2
|
|
|
3
3
|
import {useShippingAddress} from '../shipping-address';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// See __mocks__/preact/hooks
|
|
6
|
+
jest.mock('preact/hooks');
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
mount,
|
|
10
|
+
createMockSubscribableSignalLike,
|
|
11
|
+
setupGlobalShopifyMock,
|
|
12
|
+
tearDownGlobalShopifyMock,
|
|
13
|
+
} from './mount';
|
|
14
|
+
|
|
15
|
+
describe('useShippingAddress', () => {
|
|
16
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
6
17
|
|
|
7
|
-
describe.skip('useShippingAddress', () => {
|
|
8
18
|
it('returns latest shipping address', async () => {
|
|
9
19
|
const address: MailingAddress = {countryCode: 'CA'};
|
|
10
|
-
|
|
11
|
-
shippingAddress:
|
|
12
|
-
};
|
|
20
|
+
setupGlobalShopifyMock({
|
|
21
|
+
shippingAddress: createMockSubscribableSignalLike(address),
|
|
22
|
+
});
|
|
13
23
|
|
|
14
|
-
const {value} = mount.hook(() => useShippingAddress()
|
|
24
|
+
const {value} = mount.hook(() => useShippingAddress());
|
|
15
25
|
|
|
16
26
|
expect(value).toMatchObject(address);
|
|
17
27
|
});
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
ShippingOption,
|
|
4
|
-
ShippingOptionItemRenderMode,
|
|
5
|
-
} from '@shopify/ui-extensions/checkout';
|
|
1
|
+
import type {ExtensionTarget} from '../../extension-targets';
|
|
2
|
+
import type {ShippingOption} from '../../api/standard/standard';
|
|
6
3
|
|
|
7
4
|
import {useShippingOptionTarget} from '../shipping-option-target';
|
|
8
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
createMockSubscribableSignalLike,
|
|
7
|
+
mount,
|
|
8
|
+
setupGlobalShopifyMock,
|
|
9
|
+
tearDownGlobalShopifyMock,
|
|
10
|
+
createMockExtension,
|
|
11
|
+
} from './mount';
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
// See __mocks__/preact/hooks
|
|
14
|
+
jest.mock('preact/hooks');
|
|
11
15
|
|
|
12
|
-
describe
|
|
13
|
-
|
|
16
|
+
describe('useShippingOptionTarget', () => {
|
|
17
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
18
|
+
const shippingOption: ShippingOption = {
|
|
19
|
+
code: 'shipping_method_1',
|
|
20
|
+
metafields: [],
|
|
14
21
|
handle: 'shipping_method_1',
|
|
15
22
|
title: 'Shipping method 1',
|
|
16
23
|
description: 'something',
|
|
@@ -30,60 +37,57 @@ describe.skip('useShippingOptionTarget', () => {
|
|
|
30
37
|
upper: 10000,
|
|
31
38
|
},
|
|
32
39
|
},
|
|
33
|
-
} as ShippingOption;
|
|
34
|
-
|
|
35
|
-
const renderMode: ShippingOptionItemRenderMode = {
|
|
36
|
-
overlay: false,
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
it('throws if extension target has no api.target',
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
extension: {target},
|
|
45
|
-
target: undefined,
|
|
46
|
-
isTargetSelected: createMockStatefulRemoteSubscribable(true),
|
|
47
|
-
renderMode,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
};
|
|
42
|
+
it('throws if extension target has no api.target', () => {
|
|
43
|
+
const target: ExtensionTarget = 'purchase.checkout.block.render';
|
|
44
|
+
setupGlobalShopifyMock({
|
|
45
|
+
extension: createMockExtension(target),
|
|
46
|
+
});
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
expect(() => {
|
|
49
|
+
mount.hook(() => useShippingOptionTarget());
|
|
50
|
+
}).toThrow(
|
|
51
|
+
expect.objectContaining({
|
|
52
|
+
name: 'ExtensionHasNoTargetError',
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
53
55
|
});
|
|
54
56
|
|
|
55
|
-
it('throws if extension target has no api.isTargetSelected',
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
renderMode,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
};
|
|
57
|
+
it('throws if extension target has no api.isTargetSelected', () => {
|
|
58
|
+
const target =
|
|
59
|
+
'purchase.checkout.shipping-option-item.render-after' as const;
|
|
60
|
+
setupGlobalShopifyMock<typeof target>({
|
|
61
|
+
extension: createMockExtension(target),
|
|
62
|
+
target: createMockSubscribableSignalLike(shippingOption),
|
|
63
|
+
renderMode: {overlay: false},
|
|
64
|
+
});
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
expect(() => {
|
|
67
|
+
mount.hook(() => useShippingOptionTarget());
|
|
68
|
+
}).toThrow(
|
|
69
|
+
expect.objectContaining({
|
|
70
|
+
name: 'ExtensionHasNoTargetError',
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
69
73
|
});
|
|
70
74
|
|
|
71
|
-
it('returns the shipping option target if it exists',
|
|
72
|
-
const target
|
|
73
|
-
'purchase.checkout.shipping-option-item.render-after';
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
renderMode,
|
|
80
|
-
},
|
|
75
|
+
it('returns the shipping option target if it exists', () => {
|
|
76
|
+
const target =
|
|
77
|
+
'purchase.checkout.shipping-option-item.render-after' as const;
|
|
78
|
+
setupGlobalShopifyMock<typeof target>({
|
|
79
|
+
extension: createMockExtension(target),
|
|
80
|
+
target: createMockSubscribableSignalLike(shippingOption),
|
|
81
|
+
isTargetSelected: createMockSubscribableSignalLike(true),
|
|
82
|
+
renderMode: {overlay: false},
|
|
81
83
|
});
|
|
82
84
|
|
|
85
|
+
const {value} = mount.hook(() => useShippingOptionTarget());
|
|
86
|
+
|
|
83
87
|
expect(value).toStrictEqual({
|
|
84
88
|
shippingOptionTarget: shippingOption,
|
|
85
89
|
isTargetSelected: true,
|
|
86
|
-
renderMode,
|
|
90
|
+
renderMode: {overlay: false},
|
|
87
91
|
});
|
|
88
92
|
});
|
|
89
93
|
});
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {ScopeNotGrantedError} from '../../errors';
|
|
2
1
|
import {useShippingAddress} from '../shipping-address';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
// See __mocks__/preact/hooks
|
|
4
|
+
jest.mock('preact/hooks');
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
mount,
|
|
8
|
+
setupGlobalShopifyMock,
|
|
9
|
+
tearDownGlobalShopifyMock,
|
|
10
|
+
} from './mount';
|
|
11
|
+
|
|
12
|
+
describe('useShippingAddress', () => {
|
|
13
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
5
14
|
|
|
6
|
-
describe.skip('useShippingAddress', () => {
|
|
7
15
|
it('raises an exception without approval scopes granted', () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
)
|
|
16
|
+
setupGlobalShopifyMock({
|
|
17
|
+
shippingAddress: undefined,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(() => mount.hook(() => useShippingAddress())).toThrow(
|
|
21
|
+
'Using shipping address requires having shipping address permissions granted to your app.',
|
|
22
|
+
);
|
|
15
23
|
});
|
|
16
24
|
});
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import {useTimezone} from '../timezone';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// See __mocks__/preact/hooks
|
|
4
|
+
jest.mock('preact/hooks');
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
mount,
|
|
8
|
+
createMockSubscribableSignalLike,
|
|
9
|
+
setupGlobalShopifyMock,
|
|
10
|
+
tearDownGlobalShopifyMock,
|
|
11
|
+
} from './mount';
|
|
12
|
+
|
|
13
|
+
describe('useTimezone', () => {
|
|
14
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
4
15
|
|
|
5
|
-
describe.skip('useTimezone', () => {
|
|
6
16
|
it('returns timezone from the api', () => {
|
|
7
17
|
const timezone = 'America/New_York';
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
timezone: createMockStatefulRemoteSubscribable(timezone),
|
|
13
|
-
},
|
|
19
|
+
setupGlobalShopifyMock({
|
|
20
|
+
localization: {
|
|
21
|
+
timezone: createMockSubscribableSignalLike(timezone),
|
|
14
22
|
},
|
|
15
23
|
});
|
|
16
24
|
|
|
25
|
+
const {value} = mount.hook(() => useTimezone());
|
|
26
|
+
|
|
17
27
|
expect(value).toStrictEqual(timezone);
|
|
18
28
|
});
|
|
19
29
|
});
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
+
import type {I18nTranslate} from '../../api/standard/standard';
|
|
1
2
|
import {useTranslate} from '../translate';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
mount,
|
|
6
|
+
setupGlobalShopifyMock,
|
|
7
|
+
tearDownGlobalShopifyMock,
|
|
8
|
+
} from './mount';
|
|
4
9
|
|
|
5
|
-
describe
|
|
10
|
+
describe('useTranslate', () => {
|
|
11
|
+
afterEach(tearDownGlobalShopifyMock);
|
|
6
12
|
it('returns string translation', async () => {
|
|
7
13
|
const simpleTranslation = 'This is a simple string translation';
|
|
8
|
-
const translateInSandbox = jest.fn(() => simpleTranslation);
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
setupGlobalShopifyMock({
|
|
11
16
|
i18n: {
|
|
12
|
-
translate:
|
|
17
|
+
translate: (() => simpleTranslation) as I18nTranslate,
|
|
13
18
|
},
|
|
14
|
-
};
|
|
19
|
+
});
|
|
15
20
|
|
|
16
|
-
const {value} = mount.hook(() => useTranslate()
|
|
21
|
+
const {value} = mount.hook(() => useTranslate());
|
|
17
22
|
const translate = value;
|
|
18
23
|
|
|
19
24
|
expect(translate('exampleKey')).toStrictEqual(simpleTranslation);
|
|
@@ -32,13 +37,13 @@ describe.skip('useTranslate', () => {
|
|
|
32
37
|
];
|
|
33
38
|
const translateInSandbox = jest.fn(() => simpleTranslation);
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
setupGlobalShopifyMock({
|
|
36
41
|
i18n: {
|
|
37
42
|
translate: translateInSandbox,
|
|
38
43
|
},
|
|
39
|
-
};
|
|
44
|
+
});
|
|
40
45
|
|
|
41
|
-
const {value} = mount.hook(() => useTranslate()
|
|
46
|
+
const {value} = mount.hook(() => useTranslate());
|
|
42
47
|
const translate = value;
|
|
43
48
|
|
|
44
49
|
// Expect that a the same array is returned, with any valid components wrapped in a React.Fragment
|
|
@@ -54,13 +59,13 @@ describe.skip('useTranslate', () => {
|
|
|
54
59
|
const simpleTranslation = ['Hello, ', undefined, ' .'];
|
|
55
60
|
const translateInSandbox = jest.fn(() => simpleTranslation);
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
setupGlobalShopifyMock({
|
|
58
63
|
i18n: {
|
|
59
64
|
translate: translateInSandbox,
|
|
60
65
|
},
|
|
61
|
-
};
|
|
66
|
+
});
|
|
62
67
|
|
|
63
|
-
const {value} = mount.hook(() => useTranslate()
|
|
68
|
+
const {value} = mount.hook(() => useTranslate());
|
|
64
69
|
const translate = value;
|
|
65
70
|
|
|
66
71
|
expect(translate('exampleKey')).toStrictEqual(simpleTranslation);
|