@shopify/ui-extensions 2025.10.0-rc.46 → 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.
Files changed (243) hide show
  1. package/build/cjs/surfaces/checkout/preact/api.js +1 -1
  2. package/build/cjs/surfaces/checkout/shared.js +1 -1
  3. package/build/esm/surfaces/checkout/preact/api.mjs +1 -1
  4. package/build/esm/surfaces/checkout/shared.mjs +1 -1
  5. package/build/esnext/surfaces/checkout/preact/api.esnext +1 -1
  6. package/build/esnext/surfaces/checkout/shared.esnext +1 -1
  7. package/build/ts/docs/shared/components/ConsentCheckbox.d.ts +4 -0
  8. package/build/ts/docs/shared/components/ConsentCheckbox.d.ts.map +1 -0
  9. package/build/ts/docs/shared/components/ConsentPhoneField.d.ts +4 -0
  10. package/build/ts/docs/shared/components/ConsentPhoneField.d.ts.map +1 -0
  11. package/build/ts/docs/shared/components/index.d.ts +2 -0
  12. package/build/ts/docs/shared/components/index.d.ts.map +1 -1
  13. package/build/ts/surfaces/checkout/components/ConsentCheckbox/ConsentCheckbox.doc.d.ts +4 -0
  14. package/build/ts/surfaces/checkout/components/ConsentCheckbox/ConsentCheckbox.doc.d.ts.map +1 -0
  15. package/build/ts/surfaces/checkout/components/ConsentCheckbox.d.ts +84 -0
  16. package/build/ts/surfaces/checkout/components/ConsentPhoneField/ConsentPhoneField.doc.d.ts +4 -0
  17. package/build/ts/surfaces/checkout/components/ConsentPhoneField/ConsentPhoneField.doc.d.ts.map +1 -0
  18. package/build/ts/surfaces/checkout/components/ConsentPhoneField.d.ts +129 -0
  19. package/build/ts/surfaces/checkout/components/NumberField/NumberField.doc.d.ts +4 -0
  20. package/build/ts/surfaces/checkout/components/NumberField/NumberField.doc.d.ts.map +1 -0
  21. package/build/ts/surfaces/checkout/components/NumberField.d.ts +98 -0
  22. package/build/ts/surfaces/checkout/components/PasswordField.d.ts +1 -1
  23. package/build/ts/surfaces/checkout/components/components-shared.d.ts +17 -0
  24. package/build/ts/surfaces/checkout/components/components.d.ts +216 -144
  25. package/build/ts/surfaces/checkout/shared.d.ts +1 -1
  26. package/build/ts/surfaces/checkout/shared.d.ts.map +1 -1
  27. package/build/ts/surfaces/checkout/targets/Checkout::Actions::RenderBefore.d.ts +3 -0
  28. package/build/ts/surfaces/checkout/targets/Checkout::CartLineDetails::RenderAfter.d.ts +3 -0
  29. package/build/ts/surfaces/checkout/targets/Checkout::CartLineDetails::RenderLineComponents.d.ts +3 -0
  30. package/build/ts/surfaces/checkout/targets/Checkout::CartLines::RenderAfter.d.ts +3 -0
  31. package/build/ts/surfaces/checkout/targets/Checkout::Contact::RenderAfter.d.ts +3 -0
  32. package/build/ts/surfaces/checkout/targets/Checkout::CustomerInformation::RenderAfter.d.ts +3 -0
  33. package/build/ts/surfaces/checkout/targets/Checkout::DeliveryAddress::RenderBefore.d.ts +3 -0
  34. package/build/ts/surfaces/checkout/targets/Checkout::Dynamic::Render.d.ts +3 -0
  35. package/build/ts/surfaces/checkout/targets/Checkout::GiftCard::Render.d.ts +3 -0
  36. package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::HostedFields::RenderAfter.d.ts +3 -0
  37. package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::Render.d.ts +3 -0
  38. package/build/ts/surfaces/checkout/targets/Checkout::PaymentMethod::RenderRequiredAction.d.ts +3 -0
  39. package/build/ts/surfaces/checkout/targets/Checkout::PickupLocations::RenderAfter.d.ts +3 -0
  40. package/build/ts/surfaces/checkout/targets/Checkout::PickupLocations::RenderBefore.d.ts +3 -0
  41. package/build/ts/surfaces/checkout/targets/Checkout::PickupPoints::RenderAfter.d.ts +3 -0
  42. package/build/ts/surfaces/checkout/targets/Checkout::PickupPoints::RenderBefore.d.ts +3 -0
  43. package/build/ts/surfaces/checkout/targets/Checkout::Reductions::RenderAfter.d.ts +3 -0
  44. package/build/ts/surfaces/checkout/targets/Checkout::Reductions::RenderBefore.d.ts +3 -0
  45. package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethodDetails::RenderAfter.d.ts +3 -0
  46. package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethodDetails::RenderExpanded.d.ts +3 -0
  47. package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethods::RenderAfter.d.ts +3 -0
  48. package/build/ts/surfaces/checkout/targets/Checkout::ShippingMethods::RenderBefore.d.ts +3 -0
  49. package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CartLineDetails::RenderAfter.d.ts +3 -0
  50. package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CartLines::RenderAfter.d.ts +3 -0
  51. package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::CustomerInformation::RenderAfter.d.ts +3 -0
  52. package/build/ts/surfaces/checkout/targets/Checkout::ThankYou::Dynamic::Render.d.ts +3 -0
  53. package/build/ts/surfaces/checkout/targets/purchase.cart-line-item.line-components.render.d.ts +3 -0
  54. package/build/ts/surfaces/checkout/targets/purchase.checkout.actions.render-before.d.ts +3 -0
  55. package/build/ts/surfaces/checkout/targets/purchase.checkout.block.render.d.ts +3 -0
  56. package/build/ts/surfaces/checkout/targets/purchase.checkout.cart-line-item.render-after.d.ts +3 -0
  57. package/build/ts/surfaces/checkout/targets/purchase.checkout.cart-line-list.render-after.d.ts +3 -0
  58. package/build/ts/surfaces/checkout/targets/purchase.checkout.contact.render-after.d.ts +3 -0
  59. package/build/ts/surfaces/checkout/targets/purchase.checkout.delivery-address.render-after.d.ts +3 -0
  60. package/build/ts/surfaces/checkout/targets/purchase.checkout.delivery-address.render-before.d.ts +3 -0
  61. package/build/ts/surfaces/checkout/targets/purchase.checkout.footer.render-after.d.ts +3 -0
  62. package/build/ts/surfaces/checkout/targets/purchase.checkout.gift-card.render.d.ts +3 -0
  63. package/build/ts/surfaces/checkout/targets/purchase.checkout.header.render-after.d.ts +3 -0
  64. package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-method-list.render-after.d.ts +3 -0
  65. package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-method-list.render-before.d.ts +3 -0
  66. package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.action-required.render.d.ts +3 -0
  67. package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.details.render.d.ts +3 -0
  68. package/build/ts/surfaces/checkout/targets/purchase.checkout.payment-option-item.hosted-fields.render-after.d.ts +3 -0
  69. package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-list.render-after.d.ts +3 -0
  70. package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-list.render-before.d.ts +3 -0
  71. package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-location-option-item.render-after.d.ts +3 -0
  72. package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-point-list.render-after.d.ts +3 -0
  73. package/build/ts/surfaces/checkout/targets/purchase.checkout.pickup-point-list.render-before.d.ts +3 -0
  74. package/build/ts/surfaces/checkout/targets/purchase.checkout.reductions.render-after.d.ts +3 -0
  75. package/build/ts/surfaces/checkout/targets/purchase.checkout.reductions.render-before.d.ts +3 -0
  76. package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-item.details.render.d.ts +3 -0
  77. package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-item.render-after.d.ts +3 -0
  78. package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-list.render-after.d.ts +3 -0
  79. package/build/ts/surfaces/checkout/targets/purchase.checkout.shipping-option-list.render-before.d.ts +3 -0
  80. package/build/ts/surfaces/checkout/targets/purchase.thank-you.announcement.render.d.ts +3 -0
  81. package/build/ts/surfaces/checkout/targets/purchase.thank-you.block.render.d.ts +3 -0
  82. package/build/ts/surfaces/checkout/targets/purchase.thank-you.cart-line-item.render-after.d.ts +3 -0
  83. package/build/ts/surfaces/checkout/targets/purchase.thank-you.cart-line-list.render-after.d.ts +3 -0
  84. package/build/ts/surfaces/checkout/targets/purchase.thank-you.customer-information.render-after.d.ts +3 -0
  85. package/build/ts/surfaces/checkout/targets/purchase.thank-you.footer.render-after.d.ts +3 -0
  86. package/build/ts/surfaces/checkout/targets/purchase.thank-you.header.render-after.d.ts +3 -0
  87. package/build/ts/surfaces/customer-account/components/ConsentCheckbox.d.ts +84 -0
  88. package/build/ts/surfaces/customer-account/components/ConsentPhoneField.d.ts +129 -0
  89. package/build/ts/surfaces/customer-account/components/NumberField.d.ts +98 -0
  90. package/build/ts/surfaces/customer-account/components/PasswordField.d.ts +1 -1
  91. package/build/ts/surfaces/customer-account/components/components-shared.d.ts +17 -0
  92. package/build/ts/surfaces/customer-account/components/components.d.ts +216 -144
  93. package/build/ts/surfaces/customer-account/targets/customer-account.footer.render-after.d.ts +3 -0
  94. package/build/ts/surfaces/customer-account/targets/customer-account.order-index.announcement.render.d.ts +3 -0
  95. package/build/ts/surfaces/customer-account/targets/customer-account.order-index.block.render.d.ts +3 -0
  96. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.announcement.render.d.ts +3 -0
  97. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.block.render.d.ts +3 -0
  98. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.cart-line-item.render-after.d.ts +3 -0
  99. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.cart-line-list.render-after.d.ts +3 -0
  100. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.customer-information.render-after.d.ts +3 -0
  101. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.fulfillment-details.render-after.d.ts +3 -0
  102. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.payment-details.render-after.d.ts +3 -0
  103. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.return-details.render-after.d.ts +3 -0
  104. package/build/ts/surfaces/customer-account/targets/customer-account.order-status.unfulfilled-items.render-after.d.ts +3 -0
  105. package/build/ts/surfaces/customer-account/targets/customer-account.order.action.menu-item.render.d.ts +3 -0
  106. package/build/ts/surfaces/customer-account/targets/customer-account.order.action.render.d.ts +3 -0
  107. package/build/ts/surfaces/customer-account/targets/customer-account.order.page.render.d.ts +3 -0
  108. package/build/ts/surfaces/customer-account/targets/customer-account.page.render.d.ts +3 -0
  109. package/build/ts/surfaces/customer-account/targets/customer-account.profile.addresses.render-after.d.ts +3 -0
  110. package/build/ts/surfaces/customer-account/targets/customer-account.profile.announcement.render.d.ts +3 -0
  111. package/build/ts/surfaces/customer-account/targets/customer-account.profile.block.render.d.ts +3 -0
  112. package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-details.render-after.d.ts +3 -0
  113. package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-addresses.render-after.d.ts +3 -0
  114. package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-payment.render-after.d.ts +3 -0
  115. package/build/ts/surfaces/customer-account/targets/customer-account.profile.company-location-staff.render-after.d.ts +3 -0
  116. package/build/ts/surfaces/customer-account/targets/customer-account.profile.payment.render-after.d.ts +3 -0
  117. package/build/ts/surfaces/point-of-sale/components/Badge.d.ts +10 -1
  118. package/build/ts/surfaces/point-of-sale/components/Banner.d.ts +12 -4
  119. package/build/ts/surfaces/point-of-sale/components/Box.d.ts +51 -14
  120. package/build/ts/surfaces/point-of-sale/components/Button.d.ts +12 -2
  121. package/build/ts/surfaces/point-of-sale/components/Choice.d.ts +3 -2
  122. package/build/ts/surfaces/point-of-sale/components/ChoiceList.d.ts +12 -5
  123. package/build/ts/surfaces/point-of-sale/components/Clickable.d.ts +11 -4
  124. package/build/ts/surfaces/point-of-sale/components/DateField.d.ts +17 -8
  125. package/build/ts/surfaces/point-of-sale/components/DatePicker.d.ts +14 -6
  126. package/build/ts/surfaces/point-of-sale/components/DateSpinner.d.ts +10 -6
  127. package/build/ts/surfaces/point-of-sale/components/Divider.d.ts +4 -3
  128. package/build/ts/surfaces/point-of-sale/components/EmailField.d.ts +17 -7
  129. package/build/ts/surfaces/point-of-sale/components/Heading.d.ts +7 -4
  130. package/build/ts/surfaces/point-of-sale/components/Icon.d.ts +13 -3
  131. package/build/ts/surfaces/point-of-sale/components/Image.d.ts +12 -5
  132. package/build/ts/surfaces/point-of-sale/components/Modal.d.ts +28 -7
  133. package/build/ts/surfaces/point-of-sale/components/NumberField.d.ts +17 -7
  134. package/build/ts/surfaces/point-of-sale/components/Page.d.ts +25 -11
  135. package/build/ts/surfaces/point-of-sale/components/PosBlock.d.ts +12 -13
  136. package/build/ts/surfaces/point-of-sale/components/QrCode.d.ts +12 -8
  137. package/build/ts/surfaces/point-of-sale/components/ScrollBox.d.ts +47 -15
  138. package/build/ts/surfaces/point-of-sale/components/SearchField.d.ts +15 -7
  139. package/build/ts/surfaces/point-of-sale/components/Section.d.ts +15 -9
  140. package/build/ts/surfaces/point-of-sale/components/Stack.d.ts +67 -7
  141. package/build/ts/surfaces/point-of-sale/components/Text.d.ts +25 -4
  142. package/build/ts/surfaces/point-of-sale/components/TextArea.d.ts +17 -7
  143. package/build/ts/surfaces/point-of-sale/components/TextField.d.ts +9 -7
  144. package/build/ts/surfaces/point-of-sale/components/Tile.d.ts +12 -2
  145. package/build/ts/surfaces/point-of-sale/components/TimeField.d.ts +14 -6
  146. package/build/ts/surfaces/point-of-sale/components/TimePicker.d.ts +14 -6
  147. package/build/ts/surfaces/point-of-sale/components/components-shared.d.ts +102 -1
  148. package/build/tsconfig.tsbuildinfo +1 -1
  149. package/package.json +2 -1
  150. package/src/docs/shared/components/ConsentCheckbox.ts +12 -0
  151. package/src/docs/shared/components/ConsentPhoneField.ts +12 -0
  152. package/src/docs/shared/components/index.ts +2 -0
  153. package/src/surfaces/checkout/components/ConsentCheckbox/examples/basic-consent-checkbox.example.html +5 -0
  154. package/src/surfaces/checkout/components/ConsentCheckbox.d.ts +84 -0
  155. package/src/surfaces/checkout/components/ConsentPhoneField/examples/basic-consent-phone-field.example.html +5 -0
  156. package/src/surfaces/checkout/components/ConsentPhoneField.d.ts +129 -0
  157. package/src/surfaces/checkout/components/NumberField/examples/basic-number-field.example.html +8 -0
  158. package/src/surfaces/checkout/components/NumberField.d.ts +98 -0
  159. package/src/surfaces/checkout/components/PasswordField.d.ts +1 -1
  160. package/src/surfaces/checkout/components/PhoneField/examples/basic-phone-field.example.html +2 -1
  161. package/src/surfaces/checkout/components/ProductThumbnail/examples/basic-product-thumbnail.example.html +4 -1
  162. package/src/surfaces/checkout/components/Stack/examples/basic-stack.example.html +20 -4
  163. package/src/surfaces/checkout/components/TextArea/examples/basic-text-area.example.html +5 -1
  164. package/src/surfaces/checkout/components/TextField/examples/basic-text-field.example.html +4 -1
  165. package/src/surfaces/checkout/components/components-shared.d.ts +17 -0
  166. package/src/surfaces/checkout/components/components.d.ts +216 -144
  167. package/src/surfaces/checkout/preact/api.ts +1 -1
  168. package/src/surfaces/checkout/preact/tests/api.test.tsx +22 -13
  169. package/src/surfaces/checkout/preact/tests/app-metafields.test.ts +52 -56
  170. package/src/surfaces/checkout/preact/tests/attributes.test.ts +34 -24
  171. package/src/surfaces/checkout/preact/tests/billing-address.test.ts +17 -7
  172. package/src/surfaces/checkout/preact/tests/buyer-identity-businessCustomer.test.ts +16 -9
  173. package/src/surfaces/checkout/preact/tests/buyer-identity.test.tsx +57 -26
  174. package/src/surfaces/checkout/preact/tests/buyer-journey.test.ts +71 -74
  175. package/src/surfaces/checkout/preact/tests/capabilities.test.ts +32 -28
  176. package/src/surfaces/checkout/preact/tests/cart-line-target.test.ts +31 -24
  177. package/src/surfaces/checkout/preact/tests/checkout-settings.test.ts +17 -9
  178. package/src/surfaces/checkout/preact/tests/checkout-token.test.ts +16 -6
  179. package/src/surfaces/checkout/preact/tests/configuration.test.ts +16 -6
  180. package/src/surfaces/checkout/preact/tests/country.test.tsx +18 -8
  181. package/src/surfaces/checkout/preact/tests/currency.test.tsx +18 -8
  182. package/src/surfaces/checkout/preact/tests/customer-privacy.test.ts +17 -8
  183. package/src/surfaces/checkout/preact/tests/delivery-group-list-target.test.ts +24 -18
  184. package/src/surfaces/checkout/preact/tests/delivery-group-target.test.ts +25 -19
  185. package/src/surfaces/checkout/preact/tests/delivery-group.test.ts +22 -16
  186. package/src/surfaces/checkout/preact/tests/delivery-groups.test.ts +17 -11
  187. package/src/surfaces/checkout/preact/tests/delivery-selection-groups.test.ts +31 -24
  188. package/src/surfaces/checkout/preact/tests/discounts.test.tsx +21 -14
  189. package/src/surfaces/checkout/preact/tests/extension-language.test.tsx +17 -8
  190. package/src/surfaces/checkout/preact/tests/gift-cards.test.tsx +17 -8
  191. package/src/surfaces/checkout/preact/tests/localized-fields.test.ts +58 -59
  192. package/src/surfaces/checkout/preact/tests/market.test.tsx +17 -7
  193. package/src/surfaces/checkout/preact/tests/metafield.test.tsx +33 -36
  194. package/src/surfaces/checkout/preact/tests/metafields.test.tsx +36 -53
  195. package/src/surfaces/checkout/preact/tests/mount.tsx +60 -17
  196. package/src/surfaces/checkout/preact/tests/notes.test.tsx +16 -6
  197. package/src/surfaces/checkout/preact/tests/payment-method.test.ts +87 -60
  198. package/src/surfaces/checkout/preact/tests/payment-options.test.tsx +26 -24
  199. package/src/surfaces/checkout/preact/tests/pickup-location-option-target.test.tsx +55 -46
  200. package/src/surfaces/checkout/preact/tests/redeemable.test.ts +30 -23
  201. package/src/surfaces/checkout/preact/tests/session-token.test.tsx +12 -6
  202. package/src/surfaces/checkout/preact/tests/shipping-address.test.ts +17 -7
  203. package/src/surfaces/checkout/preact/tests/shipping-option-target.test.ts +54 -50
  204. package/src/surfaces/checkout/preact/tests/shopping-address.test.tsx +18 -10
  205. package/src/surfaces/checkout/preact/tests/timezone.test.tsx +17 -7
  206. package/src/surfaces/checkout/preact/tests/translate.test.tsx +18 -13
  207. package/src/surfaces/checkout/preact/tests/tsconfig.json +1 -1
  208. package/src/surfaces/checkout/shared.ts +2 -0
  209. package/src/surfaces/point-of-sale/components/Badge.d.ts +10 -1
  210. package/src/surfaces/point-of-sale/components/Banner.d.ts +12 -4
  211. package/src/surfaces/point-of-sale/components/Box.d.ts +51 -14
  212. package/src/surfaces/point-of-sale/components/Button.d.ts +12 -2
  213. package/src/surfaces/point-of-sale/components/Choice.d.ts +3 -2
  214. package/src/surfaces/point-of-sale/components/ChoiceList.d.ts +12 -5
  215. package/src/surfaces/point-of-sale/components/Clickable.d.ts +11 -4
  216. package/src/surfaces/point-of-sale/components/DateField.d.ts +17 -8
  217. package/src/surfaces/point-of-sale/components/DatePicker.d.ts +14 -6
  218. package/src/surfaces/point-of-sale/components/DateSpinner.d.ts +10 -6
  219. package/src/surfaces/point-of-sale/components/Divider.d.ts +4 -3
  220. package/src/surfaces/point-of-sale/components/EmailField.d.ts +17 -7
  221. package/src/surfaces/point-of-sale/components/Heading.d.ts +7 -4
  222. package/src/surfaces/point-of-sale/components/Icon.d.ts +13 -3
  223. package/src/surfaces/point-of-sale/components/Image.d.ts +12 -5
  224. package/src/surfaces/point-of-sale/components/Modal.d.ts +28 -7
  225. package/src/surfaces/point-of-sale/components/NumberField.d.ts +17 -7
  226. package/src/surfaces/point-of-sale/components/Page.d.ts +25 -11
  227. package/src/surfaces/point-of-sale/components/PosBlock.d.ts +12 -13
  228. package/src/surfaces/point-of-sale/components/QrCode.d.ts +12 -8
  229. package/src/surfaces/point-of-sale/components/ScrollBox.d.ts +47 -15
  230. package/src/surfaces/point-of-sale/components/SearchField.d.ts +15 -7
  231. package/src/surfaces/point-of-sale/components/Section.d.ts +15 -9
  232. package/src/surfaces/point-of-sale/components/Stack.d.ts +67 -7
  233. package/src/surfaces/point-of-sale/components/Text.d.ts +25 -4
  234. package/src/surfaces/point-of-sale/components/TextArea.d.ts +17 -7
  235. package/src/surfaces/point-of-sale/components/TextField.d.ts +9 -7
  236. package/src/surfaces/point-of-sale/components/Tile.d.ts +12 -2
  237. package/src/surfaces/point-of-sale/components/TimeField.d.ts +14 -6
  238. package/src/surfaces/point-of-sale/components/TimePicker.d.ts +14 -6
  239. package/src/surfaces/point-of-sale/components/components-shared.d.ts +102 -1
  240. package/src/surfaces/point-of-sale/components.d.ts +869 -481
  241. package/build/ts/surfaces/checkout/errors.d.ts +0 -10
  242. package/build/ts/surfaces/checkout/errors.d.ts.map +0 -1
  243. package/src/surfaces/checkout/errors.ts +0 -13
@@ -26,7 +26,7 @@ export function useApi<
26
26
 
27
27
  if (!api) {
28
28
  throw new CheckoutUIExtensionError(
29
- 'You can only call this hook when running as a checkout UI extension on at least API version 2025-07.',
29
+ 'You can only call this hook when running as a checkout UI extension on at least API version 2025-10.',
30
30
  );
31
31
  }
32
32
  return api;
@@ -1,30 +1,39 @@
1
- /* eslint-disable jest/no-disabled-tests */
2
1
  import {useApi} from '../api';
3
2
 
4
- import {mount} from './mount';
3
+ import {
4
+ mount,
5
+ setupGlobalShopifyMock,
6
+ tearDownGlobalShopifyMock,
7
+ } from './mount';
8
+
9
+ describe('useApi', () => {
10
+ beforeEach(() => {
11
+ setupGlobalShopifyMock({});
12
+ });
13
+
14
+ afterEach(tearDownGlobalShopifyMock);
5
15
 
6
- describe.skip('useApi', () => {
7
16
  it('returns api', async () => {
8
- const extensionApi = {
9
- extension: {target: 'purchase.checkout.block.render' as const},
10
- };
11
- const {value} = mount.hook(
12
- () => useApi<'purchase.checkout.block.render'>(),
13
- {
14
- extensionApi,
15
- },
17
+ const {value} = mount.hook(() =>
18
+ useApi<'purchase.checkout.block.render'>(),
16
19
  );
17
20
 
18
- expect(value).toMatchObject(extensionApi);
21
+ expect(value).toMatchObject({
22
+ extension: {target: 'purchase.checkout.block.render'},
23
+ });
19
24
  });
20
25
 
21
26
  it('throws when not run inside a checkout UI extension', async () => {
27
+ tearDownGlobalShopifyMock();
28
+
22
29
  const runner = async () => {
23
30
  return mount.hook(() => useApi());
24
31
  };
25
32
 
26
33
  await expect(runner).rejects.toThrow(
27
- 'You can only call this hook when running as a checkout UI extension.',
34
+ expect.objectContaining({
35
+ name: 'CheckoutUIExtensionError',
36
+ }),
28
37
  );
29
38
  });
30
39
  });
@@ -1,22 +1,28 @@
1
1
  import {faker} from '@faker-js/faker';
2
2
 
3
- import type {Metafield} from '@shopify/ui-extensions/checkout';
4
-
3
+ import type {AppMetafield} from '../../api/standard/standard';
5
4
  import {useAppMetafields} from '../app-metafields';
6
5
 
7
- import {mount, createMockStatefulRemoteSubscribable} from './mount';
6
+ import {
7
+ mount,
8
+ createMockSubscribableSignalLike,
9
+ setupGlobalShopifyMock,
10
+ tearDownGlobalShopifyMock,
11
+ } from './mount';
8
12
 
9
- describe.skip('useAppMetafields', () => {
10
- afterEach(() => {
11
- jest.clearAllMocks();
12
- });
13
+ // See __mocks__/preact/hooks
14
+ jest.mock('preact/hooks');
15
+
16
+ describe('useAppMetafields', () => {
17
+ afterEach(tearDownGlobalShopifyMock);
13
18
 
14
- function createMetafield(props: Partial<Metafield> = {}): Metafield {
19
+ function createMetafield(props: Partial<AppMetafield> = {}): AppMetafield {
15
20
  return {
16
21
  key: `key-${faker.string.uuid()}`,
17
22
  namespace: 'example-namespace',
18
23
  value: 'example-value',
19
24
  valueType: 'string',
25
+ type: 'string' as const,
20
26
  ...props,
21
27
  };
22
28
  }
@@ -33,25 +39,23 @@ describe.skip('useAppMetafields', () => {
33
39
 
34
40
  it('returns all app metafield entries', () => {
35
41
  const appMetaFieldEntries = [productEntry, variantEntry];
36
- const extensionApi = {
37
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
38
- };
42
+ setupGlobalShopifyMock({
43
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
44
+ });
39
45
 
40
- const {value} = mount.hook(() => useAppMetafields(), {extensionApi});
46
+ const {value} = mount.hook(() => useAppMetafields());
41
47
 
42
48
  expect(value).toMatchObject(appMetaFieldEntries);
43
49
  });
44
50
 
45
51
  it('returns filtered app metafield entries based on type', () => {
46
52
  const appMetaFieldEntries = [productEntry, variantEntry];
47
- const extensionApi = {
48
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
49
- };
50
-
51
- const {value} = mount.hook(() => useAppMetafields({type: 'product'}), {
52
- extensionApi,
53
+ setupGlobalShopifyMock({
54
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
53
55
  });
54
56
 
57
+ const {value} = mount.hook(() => useAppMetafields({type: 'product'}));
58
+
55
59
  expect(value).toMatchObject([productEntry]);
56
60
  });
57
61
 
@@ -63,14 +67,12 @@ describe.skip('useAppMetafields', () => {
63
67
  };
64
68
 
65
69
  const appMetaFieldEntries = [newEntry, variantEntry];
66
- const extensionApi = {
67
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
68
- };
69
-
70
- const {value} = mount.hook(() => useAppMetafields({id: testId}), {
71
- extensionApi,
70
+ setupGlobalShopifyMock({
71
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
72
72
  });
73
73
 
74
+ const {value} = mount.hook(() => useAppMetafields({id: testId}));
75
+
74
76
  expect(value).toMatchObject([newEntry]);
75
77
  });
76
78
 
@@ -82,13 +84,12 @@ describe.skip('useAppMetafields', () => {
82
84
  };
83
85
 
84
86
  const appMetaFieldEntries = [newEntry, productEntry, variantEntry];
85
- const extensionApi = {
86
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
87
- };
87
+ setupGlobalShopifyMock({
88
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
89
+ });
88
90
 
89
- const {value} = mount.hook(
90
- () => useAppMetafields({namespace: testNamespace}),
91
- {extensionApi},
91
+ const {value} = mount.hook(() =>
92
+ useAppMetafields({namespace: testNamespace}),
92
93
  );
93
94
 
94
95
  expect(value).toMatchObject([newEntry]);
@@ -103,13 +104,12 @@ describe.skip('useAppMetafields', () => {
103
104
  };
104
105
 
105
106
  const appMetaFieldEntries = [newEntry, productEntry, variantEntry];
106
- const extensionApi = {
107
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
108
- };
107
+ setupGlobalShopifyMock({
108
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
109
+ });
109
110
 
110
- const {value} = mount.hook(
111
- () => useAppMetafields({namespace: testNamespace, key: testKey}),
112
- {extensionApi},
111
+ const {value} = mount.hook(() =>
112
+ useAppMetafields({namespace: testNamespace, key: testKey}),
113
113
  );
114
114
 
115
115
  expect(value).toMatchObject([newEntry]);
@@ -119,15 +119,13 @@ describe.skip('useAppMetafields', () => {
119
119
  jest.spyOn(console, 'error').mockImplementation();
120
120
 
121
121
  const appMetaFieldEntries = [productEntry, variantEntry];
122
- const extensionApi = {
123
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
124
- };
122
+ setupGlobalShopifyMock({
123
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
124
+ });
125
125
 
126
- expect(() =>
127
- mount.hook(() => useAppMetafields({key: 'test_key'}), {
128
- extensionApi,
129
- }),
130
- ).toThrow('You must pass in a namespace with a key');
126
+ expect(() => mount.hook(() => useAppMetafields({key: 'test_key'}))).toThrow(
127
+ 'You must pass in a namespace with a key',
128
+ );
131
129
  });
132
130
 
133
131
  it('returns filtered app metafield entries based on all searchable fields', () => {
@@ -141,19 +139,17 @@ describe.skip('useAppMetafields', () => {
141
139
  };
142
140
 
143
141
  const appMetaFieldEntries = [newEntry, productEntry, variantEntry];
144
- const extensionApi = {
145
- appMetafields: createMockStatefulRemoteSubscribable(appMetaFieldEntries),
146
- };
142
+ setupGlobalShopifyMock({
143
+ appMetafields: createMockSubscribableSignalLike(appMetaFieldEntries),
144
+ });
147
145
 
148
- const {value} = mount.hook(
149
- () =>
150
- useAppMetafields({
151
- namespace: testNamespace,
152
- key: testKey,
153
- id: testId,
154
- type: 'product',
155
- }),
156
- {extensionApi},
146
+ const {value} = mount.hook(() =>
147
+ useAppMetafields({
148
+ namespace: testNamespace,
149
+ key: testKey,
150
+ id: testId,
151
+ type: 'product',
152
+ }),
157
153
  );
158
154
 
159
155
  expect(value).toMatchObject([newEntry]);
@@ -1,54 +1,64 @@
1
1
  import {useAttributeValues, useAttributes} from '../attributes';
2
2
 
3
- import {mount, createMockStatefulRemoteSubscribable} from './mount';
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('Attributes API hooks', () => {
14
+ afterEach(tearDownGlobalShopifyMock);
4
15
 
5
- describe.skip('Attributes API hooks', () => {
6
16
  describe('useAttributes', () => {
7
17
  it('returns an empty array if no attributes are available', () => {
8
- const {value} = mount.hook(() => useAttributes(), {
9
- extensionApi: {
10
- attributes: createMockStatefulRemoteSubscribable([]),
11
- },
18
+ setupGlobalShopifyMock({
19
+ attributes: createMockSubscribableSignalLike([]),
12
20
  });
13
21
 
22
+ const {value} = mount.hook(() => useAttributes());
23
+
14
24
  expect(value).toStrictEqual([]);
15
25
  });
16
26
 
17
27
  it('returns an array of attributes if available', () => {
18
- const {value} = mount.hook(() => useAttributes(), {
19
- extensionApi: {
20
- attributes: createMockStatefulRemoteSubscribable([
21
- {key: 'foo', value: 'bar'},
22
- ]),
23
- },
28
+ setupGlobalShopifyMock({
29
+ attributes: createMockSubscribableSignalLike([
30
+ {key: 'foo', value: 'bar'},
31
+ ]),
24
32
  });
25
33
 
34
+ const {value} = mount.hook(() => useAttributes());
35
+
26
36
  expect(value).toStrictEqual([{key: 'foo', value: 'bar'}]);
27
37
  });
28
38
  });
29
39
 
30
40
  describe('useAttributeValues', () => {
31
41
  it('returns an array of attribute values if available', () => {
32
- const {value} = mount.hook(() => useAttributeValues(['foo']), {
33
- extensionApi: {
34
- attributes: createMockStatefulRemoteSubscribable([
35
- {key: 'foo', value: 'bar'},
36
- ]),
37
- },
42
+ setupGlobalShopifyMock({
43
+ attributes: createMockSubscribableSignalLike([
44
+ {key: 'foo', value: 'bar'},
45
+ ]),
38
46
  });
39
47
 
48
+ const {value} = mount.hook(() => useAttributeValues(['foo']));
49
+
40
50
  expect(value).toStrictEqual(['bar']);
41
51
  });
42
52
 
43
53
  it('returns an array with undefined values if a non-existent attribute is requested', () => {
44
- const {value} = mount.hook(() => useAttributeValues(['foo', 'bar']), {
45
- extensionApi: {
46
- attributes: createMockStatefulRemoteSubscribable([
47
- {key: 'bar', value: 'baz'},
48
- ]),
49
- },
54
+ setupGlobalShopifyMock({
55
+ attributes: createMockSubscribableSignalLike([
56
+ {key: 'bar', value: 'baz'},
57
+ ]),
50
58
  });
51
59
 
60
+ const {value} = mount.hook(() => useAttributeValues(['foo', 'bar']));
61
+
52
62
  expect(value).toStrictEqual([undefined, 'baz']);
53
63
  });
54
64
  });
@@ -1,17 +1,27 @@
1
- import type {MailingAddress} from '@shopify/ui-extensions/checkout';
1
+ import type {MailingAddress} from '../../api/shared';
2
2
 
3
3
  import {useBillingAddress} from '../billing-address';
4
4
 
5
- import {mount, createMockStatefulRemoteSubscribable} from './mount';
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('useBillingAddress', () => {
16
+ afterEach(tearDownGlobalShopifyMock);
6
17
 
7
- describe.skip('useBillingAddress', () => {
8
18
  it('returns latest billing address', async () => {
9
19
  const address: MailingAddress = {countryCode: 'CA'};
10
- const extensionApi = {
11
- billingAddress: createMockStatefulRemoteSubscribable(address),
12
- };
20
+ setupGlobalShopifyMock({
21
+ billingAddress: createMockSubscribableSignalLike(address),
22
+ });
13
23
 
14
- const {value} = mount.hook(() => useBillingAddress(), {extensionApi});
24
+ const {value} = mount.hook(() => useBillingAddress());
15
25
 
16
26
  expect(value).toMatchObject(address);
17
27
  });
@@ -1,8 +1,18 @@
1
1
  import {usePurchasingCompany} from '../buyer-identity';
2
2
 
3
- import {mount, createMockStatefulRemoteSubscribable} from './mount';
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('usePurchasingCompany', () => {
14
+ afterEach(tearDownGlobalShopifyMock);
4
15
 
5
- describe.skip('usePurchasingCompany', () => {
6
16
  it('returns purchasing company from the api', () => {
7
17
  const purchasingCompany = {
8
18
  company: {
@@ -17,17 +27,14 @@ describe.skip('usePurchasingCompany', () => {
17
27
  },
18
28
  };
19
29
 
20
- const extensionApi = {
30
+ setupGlobalShopifyMock({
21
31
  buyerIdentity: {
22
- purchasingCompany:
23
- createMockStatefulRemoteSubscribable(purchasingCompany),
32
+ purchasingCompany: createMockSubscribableSignalLike(purchasingCompany),
24
33
  },
25
- };
26
-
27
- const {value} = mount.hook(() => usePurchasingCompany(), {
28
- extensionApi,
29
34
  });
30
35
 
36
+ const {value} = mount.hook(() => usePurchasingCompany());
37
+
31
38
  expect(value).toStrictEqual(purchasingCompany);
32
39
  });
33
40
  });
@@ -1,11 +1,18 @@
1
- import type {SubscribableSignalLike} from '../../shared';
2
1
  import {faker} from '@faker-js/faker';
3
2
 
4
- import {ScopeNotGrantedError} from '../../errors';
3
+ import type {SubscribableSignalLike} from '../../shared';
5
4
  import {useCustomer, useEmail, usePhone} from '../buyer-identity';
6
5
 
7
- import {mount} from './mount';
8
- function createMockCustomer(customer = {}) {
6
+ import {
7
+ mount,
8
+ setupGlobalShopifyMock,
9
+ tearDownGlobalShopifyMock,
10
+ } from './mount';
11
+
12
+ // See __mocks__/preact/hooks
13
+ jest.mock('preact/hooks');
14
+
15
+ function createMockCustomer(customer = {}): any {
9
16
  const firstName = faker.person.firstName();
10
17
  const lastName = faker.person.lastName();
11
18
 
@@ -21,26 +28,29 @@ function createMockCustomer(customer = {}) {
21
28
  }
22
29
 
23
30
  function createEmptyContext() {
24
- return {
25
- extensionApi: {
26
- buyerIdentity: undefined,
27
- },
28
- };
31
+ // Set up a global shopify object without buyerIdentity to trigger ScopeNotGrantedError
32
+ setupGlobalShopifyMock({
33
+ buyerIdentity: undefined,
34
+ });
35
+ return {};
29
36
  }
30
37
 
31
38
  function createUseEmailContext(email?: string) {
32
- return createMockHookContext(email, undefined, undefined);
39
+ setupGlobalShopify(email, undefined, undefined);
40
+ return {};
33
41
  }
34
42
 
35
43
  function createUseCustomerContext(customer = {}) {
36
- return createMockHookContext(undefined, undefined, customer);
44
+ setupGlobalShopify(undefined, undefined, customer);
45
+ return {};
37
46
  }
38
47
 
39
48
  function createUsePhoneContext(phone?: string) {
40
- return createMockHookContext(undefined, phone, undefined);
49
+ setupGlobalShopify(undefined, phone, undefined);
50
+ return {};
41
51
  }
42
52
 
43
- function createMockSuscribable<T>(data: T): SubscribableSignalLike<T> {
53
+ function createMockSubscribable<T>(data: T): SubscribableSignalLike<T> {
44
54
  return {
45
55
  current: data,
46
56
  value: data,
@@ -49,24 +59,37 @@ function createMockSuscribable<T>(data: T): SubscribableSignalLike<T> {
49
59
  };
50
60
  }
51
61
 
52
- function createMockHookContext(email?: string, phone?: string, customer = {}) {
53
- return {
54
- extensionApi: {
55
- buyerIdentity: {
56
- customer: createMockSuscribable(customer),
57
- email: createMockSuscribable(email),
58
- phone: createMockSuscribable(phone),
59
- },
62
+ function setupGlobalShopify(
63
+ email?: string,
64
+ phone?: string,
65
+ customer: any = {},
66
+ ) {
67
+ const customerData =
68
+ email || Object.keys(customer).length > 0
69
+ ? createMockCustomer(customer)
70
+ : undefined;
71
+ setupGlobalShopifyMock({
72
+ buyerIdentity: {
73
+ customer: createMockSubscribable(customerData),
74
+ email: createMockSubscribable(email),
75
+ phone: createMockSubscribable(phone),
76
+ purchasingCompany: createMockSubscribable(undefined),
60
77
  },
61
- };
78
+ });
62
79
  }
63
80
 
64
- describe.skip('buyerIdentity Hooks', () => {
81
+ describe('buyerIdentity Hooks', () => {
82
+ afterEach(tearDownGlobalShopifyMock);
83
+
65
84
  describe('useCustomer()', () => {
66
85
  it('raises an exception without CustomerPersonalData ApprovalScope', () => {
67
86
  expect(() => {
68
87
  mount.hook(() => useCustomer(), createEmptyContext());
69
- }).toThrow(ScopeNotGrantedError);
88
+ }).toThrow(
89
+ expect.objectContaining({
90
+ name: 'ScopeNotGrantedError',
91
+ }),
92
+ );
70
93
  });
71
94
 
72
95
  it('returns undefined fields with CustomerPersonalData ApprovalScopes only', () => {
@@ -113,7 +136,11 @@ describe.skip('buyerIdentity Hooks', () => {
113
136
  it('raises an exception without CustomerPersonalData ApprovalScope', () => {
114
137
  expect(() => {
115
138
  mount.hook(() => useEmail(), createEmptyContext());
116
- }).toThrow(ScopeNotGrantedError);
139
+ }).toThrow(
140
+ expect.objectContaining({
141
+ name: 'ScopeNotGrantedError',
142
+ }),
143
+ );
117
144
  });
118
145
 
119
146
  it('returns undefined with CustomerPersonalData ApprovalScope only', () => {
@@ -135,7 +162,11 @@ describe.skip('buyerIdentity Hooks', () => {
135
162
  it('raises an exception without CustomerPersonalData ApprovalScope', () => {
136
163
  expect(() => {
137
164
  mount.hook(() => usePhone(), createEmptyContext());
138
- }).toThrow(ScopeNotGrantedError);
165
+ }).toThrow(
166
+ expect.objectContaining({
167
+ name: 'ScopeNotGrantedError',
168
+ }),
169
+ );
139
170
  });
140
171
 
141
172
  it('returns undefined with CustomerPersonalData ApprovalScope only', () => {