@shopify/ui-extensions 0.0.0-unstable-20230118190150

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 (412) hide show
  1. package/README.md +42 -0
  2. package/build/cjs/index.js +2 -0
  3. package/build/cjs/surfaces/checkout/components/Banner/Banner.js +12 -0
  4. package/build/cjs/surfaces/checkout/components/BlockLayout/BlockLayout.js +14 -0
  5. package/build/cjs/surfaces/checkout/components/BlockSpacer/BlockSpacer.js +15 -0
  6. package/build/cjs/surfaces/checkout/components/BlockStack/BlockStack.js +12 -0
  7. package/build/cjs/surfaces/checkout/components/Button/Button.js +12 -0
  8. package/build/cjs/surfaces/checkout/components/Checkbox/Checkbox.js +12 -0
  9. package/build/cjs/surfaces/checkout/components/Choice/Choice.js +13 -0
  10. package/build/cjs/surfaces/checkout/components/ChoiceList/ChoiceList.js +13 -0
  11. package/build/cjs/surfaces/checkout/components/Divider/Divider.js +12 -0
  12. package/build/cjs/surfaces/checkout/components/Form/Form.js +20 -0
  13. package/build/cjs/surfaces/checkout/components/Grid/Grid.js +12 -0
  14. package/build/cjs/surfaces/checkout/components/GridItem/GridItem.js +14 -0
  15. package/build/cjs/surfaces/checkout/components/Heading/Heading.js +17 -0
  16. package/build/cjs/surfaces/checkout/components/HeadingGroup/HeadingGroup.js +16 -0
  17. package/build/cjs/surfaces/checkout/components/Icon/Icon.js +13 -0
  18. package/build/cjs/surfaces/checkout/components/Image/Image.js +12 -0
  19. package/build/cjs/surfaces/checkout/components/InlineLayout/InlineLayout.js +16 -0
  20. package/build/cjs/surfaces/checkout/components/InlineSpacer/InlineSpacer.js +15 -0
  21. package/build/cjs/surfaces/checkout/components/InlineStack/InlineStack.js +12 -0
  22. package/build/cjs/surfaces/checkout/components/Link/Link.js +12 -0
  23. package/build/cjs/surfaces/checkout/components/List/List.js +12 -0
  24. package/build/cjs/surfaces/checkout/components/ListItem/ListItem.js +14 -0
  25. package/build/cjs/surfaces/checkout/components/PhoneField/PhoneField.js +17 -0
  26. package/build/cjs/surfaces/checkout/components/Pressable/Pressable.js +14 -0
  27. package/build/cjs/surfaces/checkout/components/ScrollView/ScrollView.js +13 -0
  28. package/build/cjs/surfaces/checkout/components/Select/Select.js +13 -0
  29. package/build/cjs/surfaces/checkout/components/SkeletonImage/SkeletonImage.js +12 -0
  30. package/build/cjs/surfaces/checkout/components/SkeletonText/SkeletonText.js +12 -0
  31. package/build/cjs/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.js +12 -0
  32. package/build/cjs/surfaces/checkout/components/Spinner/Spinner.js +13 -0
  33. package/build/cjs/surfaces/checkout/components/Stepper/Stepper.js +12 -0
  34. package/build/cjs/surfaces/checkout/components/Tag/Tag.js +12 -0
  35. package/build/cjs/surfaces/checkout/components/Text/Text.js +13 -0
  36. package/build/cjs/surfaces/checkout/components/TextBlock/TextBlock.js +12 -0
  37. package/build/cjs/surfaces/checkout/components/TextField/TextField.js +12 -0
  38. package/build/cjs/surfaces/checkout/components/Tooltip/Tooltip.js +17 -0
  39. package/build/cjs/surfaces/checkout/components/View/View.js +17 -0
  40. package/build/cjs/surfaces/checkout/extension.js +11 -0
  41. package/build/cjs/surfaces/checkout/style/isEqual.js +29 -0
  42. package/build/cjs/surfaces/checkout/style/memoize.js +139 -0
  43. package/build/cjs/surfaces/checkout/style/style.js +74 -0
  44. package/build/cjs/surfaces/checkout.js +88 -0
  45. package/build/cjs/utilities/registration.js +21 -0
  46. package/build/esm/index.mjs +1 -0
  47. package/build/esm/surfaces/checkout/components/Banner/Banner.mjs +8 -0
  48. package/build/esm/surfaces/checkout/components/BlockLayout/BlockLayout.mjs +10 -0
  49. package/build/esm/surfaces/checkout/components/BlockSpacer/BlockSpacer.mjs +11 -0
  50. package/build/esm/surfaces/checkout/components/BlockStack/BlockStack.mjs +8 -0
  51. package/build/esm/surfaces/checkout/components/Button/Button.mjs +8 -0
  52. package/build/esm/surfaces/checkout/components/Checkbox/Checkbox.mjs +8 -0
  53. package/build/esm/surfaces/checkout/components/Choice/Choice.mjs +9 -0
  54. package/build/esm/surfaces/checkout/components/ChoiceList/ChoiceList.mjs +9 -0
  55. package/build/esm/surfaces/checkout/components/Divider/Divider.mjs +8 -0
  56. package/build/esm/surfaces/checkout/components/Form/Form.mjs +16 -0
  57. package/build/esm/surfaces/checkout/components/Grid/Grid.mjs +8 -0
  58. package/build/esm/surfaces/checkout/components/GridItem/GridItem.mjs +10 -0
  59. package/build/esm/surfaces/checkout/components/Heading/Heading.mjs +13 -0
  60. package/build/esm/surfaces/checkout/components/HeadingGroup/HeadingGroup.mjs +12 -0
  61. package/build/esm/surfaces/checkout/components/Icon/Icon.mjs +9 -0
  62. package/build/esm/surfaces/checkout/components/Image/Image.mjs +8 -0
  63. package/build/esm/surfaces/checkout/components/InlineLayout/InlineLayout.mjs +12 -0
  64. package/build/esm/surfaces/checkout/components/InlineSpacer/InlineSpacer.mjs +11 -0
  65. package/build/esm/surfaces/checkout/components/InlineStack/InlineStack.mjs +8 -0
  66. package/build/esm/surfaces/checkout/components/Link/Link.mjs +8 -0
  67. package/build/esm/surfaces/checkout/components/List/List.mjs +8 -0
  68. package/build/esm/surfaces/checkout/components/ListItem/ListItem.mjs +10 -0
  69. package/build/esm/surfaces/checkout/components/PhoneField/PhoneField.mjs +13 -0
  70. package/build/esm/surfaces/checkout/components/Pressable/Pressable.mjs +10 -0
  71. package/build/esm/surfaces/checkout/components/ScrollView/ScrollView.mjs +9 -0
  72. package/build/esm/surfaces/checkout/components/Select/Select.mjs +9 -0
  73. package/build/esm/surfaces/checkout/components/SkeletonImage/SkeletonImage.mjs +8 -0
  74. package/build/esm/surfaces/checkout/components/SkeletonText/SkeletonText.mjs +8 -0
  75. package/build/esm/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.mjs +8 -0
  76. package/build/esm/surfaces/checkout/components/Spinner/Spinner.mjs +9 -0
  77. package/build/esm/surfaces/checkout/components/Stepper/Stepper.mjs +8 -0
  78. package/build/esm/surfaces/checkout/components/Tag/Tag.mjs +8 -0
  79. package/build/esm/surfaces/checkout/components/Text/Text.mjs +9 -0
  80. package/build/esm/surfaces/checkout/components/TextBlock/TextBlock.mjs +8 -0
  81. package/build/esm/surfaces/checkout/components/TextField/TextField.mjs +8 -0
  82. package/build/esm/surfaces/checkout/components/Tooltip/Tooltip.mjs +13 -0
  83. package/build/esm/surfaces/checkout/components/View/View.mjs +13 -0
  84. package/build/esm/surfaces/checkout/extension.mjs +6 -0
  85. package/build/esm/surfaces/checkout/style/isEqual.mjs +25 -0
  86. package/build/esm/surfaces/checkout/style/memoize.mjs +133 -0
  87. package/build/esm/surfaces/checkout/style/style.mjs +68 -0
  88. package/build/esm/surfaces/checkout.mjs +39 -0
  89. package/build/esm/utilities/registration.mjs +17 -0
  90. package/build/esnext/index.esnext +1 -0
  91. package/build/esnext/surfaces/checkout/components/Banner/Banner.esnext +8 -0
  92. package/build/esnext/surfaces/checkout/components/BlockLayout/BlockLayout.esnext +10 -0
  93. package/build/esnext/surfaces/checkout/components/BlockSpacer/BlockSpacer.esnext +11 -0
  94. package/build/esnext/surfaces/checkout/components/BlockStack/BlockStack.esnext +8 -0
  95. package/build/esnext/surfaces/checkout/components/Button/Button.esnext +8 -0
  96. package/build/esnext/surfaces/checkout/components/Checkbox/Checkbox.esnext +8 -0
  97. package/build/esnext/surfaces/checkout/components/Choice/Choice.esnext +9 -0
  98. package/build/esnext/surfaces/checkout/components/ChoiceList/ChoiceList.esnext +9 -0
  99. package/build/esnext/surfaces/checkout/components/Divider/Divider.esnext +8 -0
  100. package/build/esnext/surfaces/checkout/components/Form/Form.esnext +16 -0
  101. package/build/esnext/surfaces/checkout/components/Grid/Grid.esnext +8 -0
  102. package/build/esnext/surfaces/checkout/components/GridItem/GridItem.esnext +10 -0
  103. package/build/esnext/surfaces/checkout/components/Heading/Heading.esnext +13 -0
  104. package/build/esnext/surfaces/checkout/components/HeadingGroup/HeadingGroup.esnext +12 -0
  105. package/build/esnext/surfaces/checkout/components/Icon/Icon.esnext +9 -0
  106. package/build/esnext/surfaces/checkout/components/Image/Image.esnext +8 -0
  107. package/build/esnext/surfaces/checkout/components/InlineLayout/InlineLayout.esnext +12 -0
  108. package/build/esnext/surfaces/checkout/components/InlineSpacer/InlineSpacer.esnext +11 -0
  109. package/build/esnext/surfaces/checkout/components/InlineStack/InlineStack.esnext +8 -0
  110. package/build/esnext/surfaces/checkout/components/Link/Link.esnext +8 -0
  111. package/build/esnext/surfaces/checkout/components/List/List.esnext +8 -0
  112. package/build/esnext/surfaces/checkout/components/ListItem/ListItem.esnext +10 -0
  113. package/build/esnext/surfaces/checkout/components/PhoneField/PhoneField.esnext +13 -0
  114. package/build/esnext/surfaces/checkout/components/Pressable/Pressable.esnext +10 -0
  115. package/build/esnext/surfaces/checkout/components/ScrollView/ScrollView.esnext +9 -0
  116. package/build/esnext/surfaces/checkout/components/Select/Select.esnext +9 -0
  117. package/build/esnext/surfaces/checkout/components/SkeletonImage/SkeletonImage.esnext +8 -0
  118. package/build/esnext/surfaces/checkout/components/SkeletonText/SkeletonText.esnext +8 -0
  119. package/build/esnext/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.esnext +8 -0
  120. package/build/esnext/surfaces/checkout/components/Spinner/Spinner.esnext +9 -0
  121. package/build/esnext/surfaces/checkout/components/Stepper/Stepper.esnext +8 -0
  122. package/build/esnext/surfaces/checkout/components/Tag/Tag.esnext +8 -0
  123. package/build/esnext/surfaces/checkout/components/Text/Text.esnext +9 -0
  124. package/build/esnext/surfaces/checkout/components/TextBlock/TextBlock.esnext +8 -0
  125. package/build/esnext/surfaces/checkout/components/TextField/TextField.esnext +8 -0
  126. package/build/esnext/surfaces/checkout/components/Tooltip/Tooltip.esnext +13 -0
  127. package/build/esnext/surfaces/checkout/components/View/View.esnext +13 -0
  128. package/build/esnext/surfaces/checkout/extension.esnext +6 -0
  129. package/build/esnext/surfaces/checkout/style/isEqual.esnext +25 -0
  130. package/build/esnext/surfaces/checkout/style/memoize.esnext +133 -0
  131. package/build/esnext/surfaces/checkout/style/style.esnext +68 -0
  132. package/build/esnext/surfaces/checkout.esnext +39 -0
  133. package/build/esnext/utilities/registration.esnext +17 -0
  134. package/build/ts/api.d.ts +4 -0
  135. package/build/ts/api.d.ts.map +1 -0
  136. package/build/ts/extension.d.ts +8 -0
  137. package/build/ts/extension.d.ts.map +1 -0
  138. package/build/ts/index.d.ts +4 -0
  139. package/build/ts/index.d.ts.map +1 -0
  140. package/build/ts/surfaces/checkout/api/cart-line-details/render-after.d.ts +9 -0
  141. package/build/ts/surfaces/checkout/api/cart-line-details/render-after.d.ts.map +1 -0
  142. package/build/ts/surfaces/checkout/api/shared.d.ts +5 -0
  143. package/build/ts/surfaces/checkout/api/shared.d.ts.map +1 -0
  144. package/build/ts/surfaces/checkout/api/standard/standard.d.ts +1122 -0
  145. package/build/ts/surfaces/checkout/api/standard/standard.d.ts.map +1 -0
  146. package/build/ts/surfaces/checkout/api.d.ts +4 -0
  147. package/build/ts/surfaces/checkout/api.d.ts.map +1 -0
  148. package/build/ts/surfaces/checkout/components/Banner/Banner.d.ts +38 -0
  149. package/build/ts/surfaces/checkout/components/Banner/Banner.d.ts.map +1 -0
  150. package/build/ts/surfaces/checkout/components/BlockLayout/BlockLayout.d.ts +41 -0
  151. package/build/ts/surfaces/checkout/components/BlockLayout/BlockLayout.d.ts.map +1 -0
  152. package/build/ts/surfaces/checkout/components/BlockSpacer/BlockSpacer.d.ts +22 -0
  153. package/build/ts/surfaces/checkout/components/BlockSpacer/BlockSpacer.d.ts.map +1 -0
  154. package/build/ts/surfaces/checkout/components/BlockStack/BlockStack.d.ts +42 -0
  155. package/build/ts/surfaces/checkout/components/BlockStack/BlockStack.d.ts.map +1 -0
  156. package/build/ts/surfaces/checkout/components/Button/Button.d.ts +83 -0
  157. package/build/ts/surfaces/checkout/components/Button/Button.d.ts.map +1 -0
  158. package/build/ts/surfaces/checkout/components/Checkbox/Checkbox.d.ts +59 -0
  159. package/build/ts/surfaces/checkout/components/Checkbox/Checkbox.d.ts.map +1 -0
  160. package/build/ts/surfaces/checkout/components/Choice/Choice.d.ts +27 -0
  161. package/build/ts/surfaces/checkout/components/Choice/Choice.d.ts.map +1 -0
  162. package/build/ts/surfaces/checkout/components/ChoiceList/ChoiceList.d.ts +32 -0
  163. package/build/ts/surfaces/checkout/components/ChoiceList/ChoiceList.d.ts.map +1 -0
  164. package/build/ts/surfaces/checkout/components/Divider/Divider.d.ts +30 -0
  165. package/build/ts/surfaces/checkout/components/Divider/Divider.d.ts.map +1 -0
  166. package/build/ts/surfaces/checkout/components/Form/Form.d.ts +32 -0
  167. package/build/ts/surfaces/checkout/components/Form/Form.d.ts.map +1 -0
  168. package/build/ts/surfaces/checkout/components/Grid/Grid.d.ts +95 -0
  169. package/build/ts/surfaces/checkout/components/Grid/Grid.d.ts.map +1 -0
  170. package/build/ts/surfaces/checkout/components/GridItem/GridItem.d.ts +36 -0
  171. package/build/ts/surfaces/checkout/components/GridItem/GridItem.d.ts.map +1 -0
  172. package/build/ts/surfaces/checkout/components/Heading/Heading.d.ts +43 -0
  173. package/build/ts/surfaces/checkout/components/Heading/Heading.d.ts.map +1 -0
  174. package/build/ts/surfaces/checkout/components/HeadingGroup/HeadingGroup.d.ts +15 -0
  175. package/build/ts/surfaces/checkout/components/HeadingGroup/HeadingGroup.d.ts.map +1 -0
  176. package/build/ts/surfaces/checkout/components/Icon/Icon.d.ts +38 -0
  177. package/build/ts/surfaces/checkout/components/Icon/Icon.d.ts.map +1 -0
  178. package/build/ts/surfaces/checkout/components/Image/Image.d.ts +73 -0
  179. package/build/ts/surfaces/checkout/components/Image/Image.d.ts.map +1 -0
  180. package/build/ts/surfaces/checkout/components/InlineLayout/InlineLayout.d.ts +43 -0
  181. package/build/ts/surfaces/checkout/components/InlineLayout/InlineLayout.d.ts.map +1 -0
  182. package/build/ts/surfaces/checkout/components/InlineSpacer/InlineSpacer.d.ts +22 -0
  183. package/build/ts/surfaces/checkout/components/InlineSpacer/InlineSpacer.d.ts.map +1 -0
  184. package/build/ts/surfaces/checkout/components/InlineStack/InlineStack.d.ts +50 -0
  185. package/build/ts/surfaces/checkout/components/InlineStack/InlineStack.d.ts.map +1 -0
  186. package/build/ts/surfaces/checkout/components/Link/Link.d.ts +50 -0
  187. package/build/ts/surfaces/checkout/components/Link/Link.d.ts.map +1 -0
  188. package/build/ts/surfaces/checkout/components/List/List.d.ts +32 -0
  189. package/build/ts/surfaces/checkout/components/List/List.d.ts.map +1 -0
  190. package/build/ts/surfaces/checkout/components/ListItem/ListItem.d.ts +13 -0
  191. package/build/ts/surfaces/checkout/components/ListItem/ListItem.d.ts.map +1 -0
  192. package/build/ts/surfaces/checkout/components/PhoneField/PhoneField.d.ts +58 -0
  193. package/build/ts/surfaces/checkout/components/PhoneField/PhoneField.d.ts.map +1 -0
  194. package/build/ts/surfaces/checkout/components/Pressable/Pressable.d.ts +96 -0
  195. package/build/ts/surfaces/checkout/components/Pressable/Pressable.d.ts.map +1 -0
  196. package/build/ts/surfaces/checkout/components/ScrollView/ScrollView.d.ts +75 -0
  197. package/build/ts/surfaces/checkout/components/ScrollView/ScrollView.d.ts.map +1 -0
  198. package/build/ts/surfaces/checkout/components/Select/Select.d.ts +98 -0
  199. package/build/ts/surfaces/checkout/components/Select/Select.d.ts.map +1 -0
  200. package/build/ts/surfaces/checkout/components/SkeletonImage/SkeletonImage.d.ts +25 -0
  201. package/build/ts/surfaces/checkout/components/SkeletonImage/SkeletonImage.d.ts.map +1 -0
  202. package/build/ts/surfaces/checkout/components/SkeletonText/SkeletonText.d.ts +21 -0
  203. package/build/ts/surfaces/checkout/components/SkeletonText/SkeletonText.d.ts.map +1 -0
  204. package/build/ts/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.d.ts +22 -0
  205. package/build/ts/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.d.ts.map +1 -0
  206. package/build/ts/surfaces/checkout/components/Spinner/Spinner.d.ts +32 -0
  207. package/build/ts/surfaces/checkout/components/Spinner/Spinner.d.ts.map +1 -0
  208. package/build/ts/surfaces/checkout/components/Stepper/Stepper.d.ts +42 -0
  209. package/build/ts/surfaces/checkout/components/Stepper/Stepper.d.ts.map +1 -0
  210. package/build/ts/surfaces/checkout/components/Tag/Tag.d.ts +31 -0
  211. package/build/ts/surfaces/checkout/components/Tag/Tag.d.ts.map +1 -0
  212. package/build/ts/surfaces/checkout/components/Text/Text.d.ts +34 -0
  213. package/build/ts/surfaces/checkout/components/Text/Text.d.ts.map +1 -0
  214. package/build/ts/surfaces/checkout/components/TextBlock/TextBlock.d.ts +32 -0
  215. package/build/ts/surfaces/checkout/components/TextBlock/TextBlock.d.ts.map +1 -0
  216. package/build/ts/surfaces/checkout/components/TextField/TextField.d.ts +175 -0
  217. package/build/ts/surfaces/checkout/components/TextField/TextField.d.ts.map +1 -0
  218. package/build/ts/surfaces/checkout/components/Tooltip/Tooltip.d.ts +16 -0
  219. package/build/ts/surfaces/checkout/components/Tooltip/Tooltip.d.ts.map +1 -0
  220. package/build/ts/surfaces/checkout/components/View/View.d.ts +169 -0
  221. package/build/ts/surfaces/checkout/components/View/View.d.ts.map +1 -0
  222. package/build/ts/surfaces/checkout/components/shared.d.ts +407 -0
  223. package/build/ts/surfaces/checkout/components/shared.d.ts.map +1 -0
  224. package/build/ts/surfaces/checkout/components.d.ts +76 -0
  225. package/build/ts/surfaces/checkout/components.d.ts.map +1 -0
  226. package/build/ts/surfaces/checkout/extension-points.d.ts +98 -0
  227. package/build/ts/surfaces/checkout/extension-points.d.ts.map +1 -0
  228. package/build/ts/surfaces/checkout/extension.d.ts +5 -0
  229. package/build/ts/surfaces/checkout/extension.d.ts.map +1 -0
  230. package/build/ts/surfaces/checkout/globals.d.ts +11 -0
  231. package/build/ts/surfaces/checkout/globals.d.ts.map +1 -0
  232. package/build/ts/surfaces/checkout/shared.d.ts +8 -0
  233. package/build/ts/surfaces/checkout/shared.d.ts.map +1 -0
  234. package/build/ts/surfaces/checkout/style/isEqual.d.ts +8 -0
  235. package/build/ts/surfaces/checkout/style/isEqual.d.ts.map +1 -0
  236. package/build/ts/surfaces/checkout/style/isEqual.test.d.ts +2 -0
  237. package/build/ts/surfaces/checkout/style/isEqual.test.d.ts.map +1 -0
  238. package/build/ts/surfaces/checkout/style/memoize.d.ts +13 -0
  239. package/build/ts/surfaces/checkout/style/memoize.d.ts.map +1 -0
  240. package/build/ts/surfaces/checkout/style/style.d.ts +70 -0
  241. package/build/ts/surfaces/checkout/style/style.d.ts.map +1 -0
  242. package/build/ts/surfaces/checkout/style/style.test.d.ts +2 -0
  243. package/build/ts/surfaces/checkout/style/style.test.d.ts.map +1 -0
  244. package/build/ts/surfaces/checkout/style/types.d.ts +46 -0
  245. package/build/ts/surfaces/checkout/style/types.d.ts.map +1 -0
  246. package/build/ts/surfaces/checkout/style.d.ts +3 -0
  247. package/build/ts/surfaces/checkout/style.d.ts.map +1 -0
  248. package/build/ts/surfaces/checkout.d.ts +8 -0
  249. package/build/ts/surfaces/checkout.d.ts.map +1 -0
  250. package/build/ts/utilities/registration.d.ts +12 -0
  251. package/build/ts/utilities/registration.d.ts.map +1 -0
  252. package/build/tsconfig.tsbuildinfo +1 -0
  253. package/checkout.esnext +1 -0
  254. package/checkout.js +1 -0
  255. package/checkout.mjs +1 -0
  256. package/index.esnext +1 -0
  257. package/index.js +1 -0
  258. package/index.mjs +1 -0
  259. package/package.json +51 -0
  260. package/src/api.ts +3 -0
  261. package/src/extension.ts +19 -0
  262. package/src/index.ts +3 -0
  263. package/src/surfaces/checkout/api/cart-line-details/README.md +1 -0
  264. package/src/surfaces/checkout/api/cart-line-details/render-after.ts +11 -0
  265. package/src/surfaces/checkout/api/shared.ts +810 -0
  266. package/src/surfaces/checkout/api/standard/README.md +1 -0
  267. package/src/surfaces/checkout/api/standard/standard.ts +1340 -0
  268. package/src/surfaces/checkout/api.ts +67 -0
  269. package/src/surfaces/checkout/components/Banner/Banner.ts +37 -0
  270. package/src/surfaces/checkout/components/Banner/README.md +14 -0
  271. package/src/surfaces/checkout/components/Banner/content/guidelines.md +9 -0
  272. package/src/surfaces/checkout/components/Banner/examples/basic-banner.example.ts +11 -0
  273. package/src/surfaces/checkout/components/BlockLayout/BlockLayout.ts +43 -0
  274. package/src/surfaces/checkout/components/BlockLayout/README.md +101 -0
  275. package/src/surfaces/checkout/components/BlockLayout/examples/basic-blockLayout.example.ts +16 -0
  276. package/src/surfaces/checkout/components/BlockSpacer/BlockSpacer.ts +25 -0
  277. package/src/surfaces/checkout/components/BlockSpacer/README.md +14 -0
  278. package/src/surfaces/checkout/components/BlockSpacer/examples/basic-blockspacer.example.ts +11 -0
  279. package/src/surfaces/checkout/components/BlockStack/BlockStack.ts +53 -0
  280. package/src/surfaces/checkout/components/BlockStack/README.md +77 -0
  281. package/src/surfaces/checkout/components/BlockStack/examples/basic-blockstack.example.ts +11 -0
  282. package/src/surfaces/checkout/components/Button/Button.ts +87 -0
  283. package/src/surfaces/checkout/components/Button/README.md +22 -0
  284. package/src/surfaces/checkout/components/Button/content/guidelines.md +10 -0
  285. package/src/surfaces/checkout/components/Button/examples/basic-button.example.ts +11 -0
  286. package/src/surfaces/checkout/components/Checkbox/Checkbox.ts +63 -0
  287. package/src/surfaces/checkout/components/Checkbox/README.md +18 -0
  288. package/src/surfaces/checkout/components/Checkbox/content/guidelines.md +9 -0
  289. package/src/surfaces/checkout/components/Checkbox/examples/basic-checkbox.example.ts +11 -0
  290. package/src/surfaces/checkout/components/Choice/Choice.ts +25 -0
  291. package/src/surfaces/checkout/components/Choice/README.md +14 -0
  292. package/src/surfaces/checkout/components/Choice/content/guidelines.md +9 -0
  293. package/src/surfaces/checkout/components/Choice/examples/basic-choice.example.ts +50 -0
  294. package/src/surfaces/checkout/components/ChoiceList/ChoiceList.ts +33 -0
  295. package/src/surfaces/checkout/components/ChoiceList/README.md +14 -0
  296. package/src/surfaces/checkout/components/ChoiceList/content/guidelines.md +10 -0
  297. package/src/surfaces/checkout/components/ChoiceList/examples/basic-choicelist.example.ts +50 -0
  298. package/src/surfaces/checkout/components/Divider/Divider.ts +33 -0
  299. package/src/surfaces/checkout/components/Divider/README.md +13 -0
  300. package/src/surfaces/checkout/components/Divider/examples/basic-divider.example.ts +7 -0
  301. package/src/surfaces/checkout/components/Form/Form.ts +30 -0
  302. package/src/surfaces/checkout/components/Form/README.md +21 -0
  303. package/src/surfaces/checkout/components/Form/content/guidelines.md +4 -0
  304. package/src/surfaces/checkout/components/Form/examples/basic-form.example.ts +48 -0
  305. package/src/surfaces/checkout/components/Grid/Grid.ts +104 -0
  306. package/src/surfaces/checkout/components/Grid/README.md +105 -0
  307. package/src/surfaces/checkout/components/Grid/content/guidelines.md +3 -0
  308. package/src/surfaces/checkout/components/Grid/examples/basic-grid.example.ts +45 -0
  309. package/src/surfaces/checkout/components/GridItem/GridItem.ts +42 -0
  310. package/src/surfaces/checkout/components/GridItem/README.md +72 -0
  311. package/src/surfaces/checkout/components/GridItem/content/guidelines.md +3 -0
  312. package/src/surfaces/checkout/components/GridItem/examples/basic-griditem.example.ts +42 -0
  313. package/src/surfaces/checkout/components/Heading/Heading.ts +44 -0
  314. package/src/surfaces/checkout/components/Heading/README.md +19 -0
  315. package/src/surfaces/checkout/components/Heading/content/guidelines.md +10 -0
  316. package/src/surfaces/checkout/components/Heading/examples/basic-heading.example.ts +7 -0
  317. package/src/surfaces/checkout/components/HeadingGroup/HeadingGroup.ts +15 -0
  318. package/src/surfaces/checkout/components/HeadingGroup/README.md +7 -0
  319. package/src/surfaces/checkout/components/HeadingGroup/content/guidelines.md +9 -0
  320. package/src/surfaces/checkout/components/HeadingGroup/examples/basic-headinggroup.example.ts +20 -0
  321. package/src/surfaces/checkout/components/Icon/Icon.ts +91 -0
  322. package/src/surfaces/checkout/components/Icon/README.md +15 -0
  323. package/src/surfaces/checkout/components/Icon/examples/basic-icon.example.ts +7 -0
  324. package/src/surfaces/checkout/components/Image/Image.ts +83 -0
  325. package/src/surfaces/checkout/components/Image/README.md +53 -0
  326. package/src/surfaces/checkout/components/Image/examples/basic-image.example.ts +10 -0
  327. package/src/surfaces/checkout/components/InlineLayout/InlineLayout.ts +49 -0
  328. package/src/surfaces/checkout/components/InlineLayout/README.md +103 -0
  329. package/src/surfaces/checkout/components/InlineLayout/examples/basic-inlineLayout.example.ts +16 -0
  330. package/src/surfaces/checkout/components/InlineSpacer/InlineSpacer.ts +24 -0
  331. package/src/surfaces/checkout/components/InlineSpacer/README.md +14 -0
  332. package/src/surfaces/checkout/components/InlineSpacer/examples/basic-inlinespacer.example.ts +20 -0
  333. package/src/surfaces/checkout/components/InlineStack/InlineStack.ts +63 -0
  334. package/src/surfaces/checkout/components/InlineStack/README.md +87 -0
  335. package/src/surfaces/checkout/components/InlineStack/examples/basic-inlinestack.example.ts +18 -0
  336. package/src/surfaces/checkout/components/Link/Link.ts +49 -0
  337. package/src/surfaces/checkout/components/Link/README.md +18 -0
  338. package/src/surfaces/checkout/components/Link/content/guidelines.md +9 -0
  339. package/src/surfaces/checkout/components/Link/examples/basic-link.example.ts +11 -0
  340. package/src/surfaces/checkout/components/List/List.ts +32 -0
  341. package/src/surfaces/checkout/components/List/README.md +19 -0
  342. package/src/surfaces/checkout/components/List/content/guidelines.md +11 -0
  343. package/src/surfaces/checkout/components/List/examples/basic-list.example.ts +11 -0
  344. package/src/surfaces/checkout/components/ListItem/ListItem.ts +12 -0
  345. package/src/surfaces/checkout/components/ListItem/README.md +5 -0
  346. package/src/surfaces/checkout/components/ListItem/content/guidelines.md +3 -0
  347. package/src/surfaces/checkout/components/ListItem/examples/basic-listitem.example.ts +9 -0
  348. package/src/surfaces/checkout/components/PhoneField/PhoneField.ts +77 -0
  349. package/src/surfaces/checkout/components/PhoneField/README.md +49 -0
  350. package/src/surfaces/checkout/components/PhoneField/examples/basic-phonefield.example.ts +10 -0
  351. package/src/surfaces/checkout/components/Pressable/Pressable.ts +128 -0
  352. package/src/surfaces/checkout/components/Pressable/README.md +74 -0
  353. package/src/surfaces/checkout/components/Pressable/examples/basic-pressable.example.ts +27 -0
  354. package/src/surfaces/checkout/components/ScrollView/README.md +62 -0
  355. package/src/surfaces/checkout/components/ScrollView/ScrollView.ts +76 -0
  356. package/src/surfaces/checkout/components/ScrollView/examples/basic-scrollview.example.ts +38 -0
  357. package/src/surfaces/checkout/components/Select/README.md +41 -0
  358. package/src/surfaces/checkout/components/Select/Select.ts +97 -0
  359. package/src/surfaces/checkout/components/Select/content/guidelines.md +4 -0
  360. package/src/surfaces/checkout/components/Select/examples/basic-select.example.ts +36 -0
  361. package/src/surfaces/checkout/components/SkeletonImage/README.md +13 -0
  362. package/src/surfaces/checkout/components/SkeletonImage/SkeletonImage.ts +28 -0
  363. package/src/surfaces/checkout/components/SkeletonImage/examples/basic-skeletonimage.example.ts +10 -0
  364. package/src/surfaces/checkout/components/SkeletonText/README.md +13 -0
  365. package/src/surfaces/checkout/components/SkeletonText/SkeletonText.ts +23 -0
  366. package/src/surfaces/checkout/components/SkeletonText/examples/basic-skeletontext.example.ts +7 -0
  367. package/src/surfaces/checkout/components/SkeletonTextBlock/README.md +13 -0
  368. package/src/surfaces/checkout/components/SkeletonTextBlock/SkeletonTextBlock.ts +24 -0
  369. package/src/surfaces/checkout/components/SkeletonTextBlock/examples/basic-skeletontextblock.example.ts +7 -0
  370. package/src/surfaces/checkout/components/Spinner/README.md +14 -0
  371. package/src/surfaces/checkout/components/Spinner/Spinner.ts +35 -0
  372. package/src/surfaces/checkout/components/Spinner/examples/basic-spinner.example.ts +7 -0
  373. package/src/surfaces/checkout/components/Stepper/README.md +28 -0
  374. package/src/surfaces/checkout/components/Stepper/Stepper.ts +63 -0
  375. package/src/surfaces/checkout/components/Stepper/content/guidelines.md +4 -0
  376. package/src/surfaces/checkout/components/Stepper/examples/basic-stepper.example.ts +10 -0
  377. package/src/surfaces/checkout/components/Tag/README.md +14 -0
  378. package/src/surfaces/checkout/components/Tag/Tag.ts +26 -0
  379. package/src/surfaces/checkout/components/Tag/examples/basic-tag.example.ts +7 -0
  380. package/src/surfaces/checkout/components/Text/README.md +17 -0
  381. package/src/surfaces/checkout/components/Text/Text.ts +44 -0
  382. package/src/surfaces/checkout/components/Text/content/guidelines.md +10 -0
  383. package/src/surfaces/checkout/components/Text/examples/basic-text.example.ts +14 -0
  384. package/src/surfaces/checkout/components/TextBlock/README.md +15 -0
  385. package/src/surfaces/checkout/components/TextBlock/TextBlock.ts +38 -0
  386. package/src/surfaces/checkout/components/TextBlock/content/guidelines.md +9 -0
  387. package/src/surfaces/checkout/components/TextBlock/examples/basic-textblock.example.ts +18 -0
  388. package/src/surfaces/checkout/components/TextField/README.md +49 -0
  389. package/src/surfaces/checkout/components/TextField/TextField.ts +173 -0
  390. package/src/surfaces/checkout/components/TextField/content/guidelines.md +5 -0
  391. package/src/surfaces/checkout/components/TextField/examples/basic-textfield.example.ts +9 -0
  392. package/src/surfaces/checkout/components/Tooltip/README.md +8 -0
  393. package/src/surfaces/checkout/components/Tooltip/Tooltip.ts +15 -0
  394. package/src/surfaces/checkout/components/Tooltip/examples/basic-tooltip.example.ts +23 -0
  395. package/src/surfaces/checkout/components/View/README.md +97 -0
  396. package/src/surfaces/checkout/components/View/View.ts +196 -0
  397. package/src/surfaces/checkout/components/View/examples/basic-view.example.ts +11 -0
  398. package/src/surfaces/checkout/components/shared.ts +581 -0
  399. package/src/surfaces/checkout/components.ts +157 -0
  400. package/src/surfaces/checkout/extension-points.ts +164 -0
  401. package/src/surfaces/checkout/extension.ts +8 -0
  402. package/src/surfaces/checkout/globals.ts +15 -0
  403. package/src/surfaces/checkout/shared.ts +14 -0
  404. package/src/surfaces/checkout/style/isEqual.test.ts +67 -0
  405. package/src/surfaces/checkout/style/isEqual.ts +41 -0
  406. package/src/surfaces/checkout/style/memoize.ts +177 -0
  407. package/src/surfaces/checkout/style/style.test.ts +131 -0
  408. package/src/surfaces/checkout/style/style.ts +161 -0
  409. package/src/surfaces/checkout/style/types.ts +67 -0
  410. package/src/surfaces/checkout/style.ts +16 -0
  411. package/src/surfaces/checkout.ts +7 -0
  412. package/src/utilities/registration.ts +27 -0
@@ -0,0 +1,1340 @@
1
+ import type {StatefulRemoteSubscribable} from '@remote-ui/async-subscription';
2
+
3
+ import type {StandardApi as BaseStandardApi} from '../../../../api';
4
+ import type {ExtensionPoint as AnyExtensionPoint} from '../../extension-points';
5
+ import type {CurrencyCode, CountryCode, Timezone} from '../shared';
6
+
7
+ /**
8
+ * A key-value storage object for extension points.
9
+ *
10
+ * Stored data is only available to this specific app
11
+ * at this specific extension point.
12
+ *
13
+ * The storage backend is implemented with `localStorage` and
14
+ * should persist across the buyer's checkout session.
15
+ * However, data persistence isn't guaranteed.
16
+ */
17
+ export interface Storage {
18
+ /**
19
+ * Read and return a stored value by key.
20
+ *
21
+ * The stored data is deserialized from JSON and returned as
22
+ * its original primitive.
23
+ *
24
+ * Returns `null` if no stored data exists.
25
+ */
26
+ read<T = unknown>(key: string): Promise<T | null>;
27
+
28
+ /**
29
+ * Write stored data for this key.
30
+ *
31
+ * The data must be serializable to JSON.
32
+ */
33
+ write(key: string, data: any): Promise<void>;
34
+
35
+ /**
36
+ * Delete stored data by key.
37
+ */
38
+ delete(key: string): Promise<void>;
39
+ }
40
+
41
+ /**
42
+ * The high-level capabilities an extension is allowed to have access to.
43
+ *
44
+ * * `network_access` allows an extension to make network calls via fetch() and
45
+ * is requested by a partner
46
+ *
47
+ * * `block_progress` allows an extension to block a buyer's progress through
48
+ * checkout and may be granted by a merchant in differing checkout contexts
49
+ */
50
+ export type Capability = 'network_access' | 'block_progress';
51
+
52
+ /**
53
+ * Meta information about an extension point.
54
+ */
55
+ export interface ExtensionInstance {
56
+ /**
57
+ * The published version of the running extension point.
58
+ *
59
+ * For unpublished extensions, the value is `null`.
60
+ *
61
+ * @example 3.0.10
62
+ */
63
+ version?: string;
64
+
65
+ /**
66
+ * The URL to the script that started the extension point.
67
+ */
68
+ scriptUrl: string;
69
+
70
+ /**
71
+ * Whether your extension is currently rendered to the screen.
72
+ *
73
+ * Shopify might render your extension before it's visible in the UI,
74
+ * typically to pre-render extensions that will appear on a later step of the
75
+ * checkout.
76
+ *
77
+ * Your extension might also continue to run after the buyer has navigated away
78
+ * from where it was rendered. The extension continues running so that
79
+ * your extension is immediately available to render if the buyer navigates back.
80
+ */
81
+ rendered: StatefulRemoteSubscribable<boolean>;
82
+
83
+ /**
84
+ * The allowed capabilities of the extension, defined
85
+ * in your `shopify.ui.extension.toml` file .
86
+ *
87
+ * `network_access`:
88
+ * You must [request access](https://shopify.dev/api/checkout-extensions/checkout/configuration#complete-a-request-for-network-access)
89
+ * to make network calls.
90
+ *
91
+ * `block_progress`:
92
+ * Merchants control whether your extension [can block checkout progress](https://shopify.dev/api/checkout-extensions/checkout/configuration#block-progress)
93
+ */
94
+ capabilities: StatefulRemoteSubscribable<Capability[]>;
95
+
96
+ /**
97
+ * Information about the editor where the extension is being rendered.
98
+ *
99
+ * The value is undefined if the extension is not rendering in an editor.
100
+ */
101
+ editor?: Editor;
102
+ }
103
+
104
+ export interface Editor {
105
+ /**
106
+ * Indicates whether the extension is rendering in the checkout editor.
107
+ */
108
+ type: 'checkout';
109
+ }
110
+
111
+ /**
112
+ * Removes a note
113
+ */
114
+ export interface NoteRemoveChange {
115
+ /**
116
+ * The type of the `NoteRemoveChange` API.
117
+ */
118
+ type: 'removeNote';
119
+ }
120
+
121
+ /**
122
+ * An Update to a note on the order.
123
+ * for example, the buyer could request detailed packaging instructions in an order note
124
+ */
125
+ export interface NoteUpdateChange {
126
+ /**
127
+ * The type of the `NoteUpdateChange` API.
128
+ */
129
+ type: 'updateNote';
130
+ /**
131
+ * The new value of the note.
132
+ */
133
+ note: string;
134
+ }
135
+
136
+ export type NoteChange = NoteRemoveChange | NoteUpdateChange;
137
+
138
+ export interface NoteChangeResultSuccess {
139
+ /**
140
+ * The type of the `NoteChangeResultSuccess` API.
141
+ */
142
+ type: 'success';
143
+ }
144
+
145
+ export interface NoteChangeResultError {
146
+ /**
147
+ * The type of the `NoteChangeResultError` API.
148
+ */
149
+ type: 'error';
150
+
151
+ /**
152
+ * A message that explains the error. This message is useful for debugging.
153
+ * It is **not** localized, and therefore should not be presented directly
154
+ * to the buyer.
155
+ */
156
+ message: string;
157
+ }
158
+
159
+ export type NoteChangeResult = NoteChangeResultSuccess | NoteChangeResultError;
160
+
161
+ /**
162
+ * Updates an attribute on the order. If an attribute with the
163
+ * provided key does not already exist, it gets created.
164
+ */
165
+ export interface AttributeUpdateChange {
166
+ /**
167
+ * The type of the `AttributeUpdateChange` API.
168
+ */
169
+ type: 'updateAttribute';
170
+
171
+ /**
172
+ * Key of the attribute to add or update
173
+ */
174
+ key: string;
175
+
176
+ /**
177
+ * Value for the attribute to add or update
178
+ */
179
+ value: string;
180
+ }
181
+
182
+ export type AttributeChange = AttributeUpdateChange;
183
+
184
+ /**
185
+ * The returned result of a successful update to an attribute.
186
+ */
187
+ export interface AttributeChangeResultSuccess {
188
+ /**
189
+ * The type of the `AttributeChangeResultSuccess` API.
190
+ */
191
+ type: 'success';
192
+ }
193
+
194
+ /**
195
+ * The returned result of an unsuccessful update to an attribute
196
+ * with a message detailing the type of error that occurred.
197
+ */
198
+ export interface AttributeChangeResultError {
199
+ /**
200
+ * The type of the `AttributeChangeResultError` API.
201
+ */
202
+ type: 'error';
203
+
204
+ /**
205
+ * A message that explains the error. This message is useful for debugging.
206
+ * It is **not** localized, and therefore should not be presented directly
207
+ * to the buyer.
208
+ */
209
+ message: string;
210
+ }
211
+
212
+ export type AttributeChangeResult =
213
+ | AttributeChangeResultSuccess
214
+ | AttributeChangeResultError;
215
+
216
+ /**
217
+ * Metadata associated with the checkout.
218
+ */
219
+ export interface Metafield {
220
+ /**
221
+ * The name of the metafield. It must be between 3 and 30 characters in
222
+ * length (inclusive).
223
+ */
224
+ key: string;
225
+
226
+ /**
227
+ * A container for a set of metafields. You need to define a custom
228
+ * namespace for your metafields to distinguish them from the metafields
229
+ * used by other apps. This must be between 2 and 20 characters in length (inclusive).
230
+ */
231
+ namespace: string;
232
+
233
+ /**
234
+ * The information to be stored as metadata.
235
+ */
236
+ value: string | number;
237
+
238
+ /** The metafield’s information type. */
239
+ valueType: 'integer' | 'string' | 'json_string';
240
+ }
241
+
242
+ /** Removes a metafield. */
243
+ export interface MetafieldRemoveChange {
244
+ /**
245
+ * The type of the `MetafieldRemoveChange` API.
246
+ */
247
+ type: 'removeMetafield';
248
+
249
+ /**
250
+ * The name of the metafield to remove.
251
+ */
252
+ key: string;
253
+
254
+ /**
255
+ * The namespace of the metafield to remove.
256
+ */
257
+ namespace: string;
258
+ }
259
+
260
+ /**
261
+ * Updates a metafield. If a metafield with the
262
+ * provided key and namespace does not already exist, it gets created.
263
+ */
264
+ export interface MetafieldUpdateChange {
265
+ /**
266
+ * The type of the `MetafieldUpdateChange` API.
267
+ */
268
+ type: 'updateMetafield';
269
+
270
+ /** The name of the metafield to update. */
271
+ key: string;
272
+
273
+ /** The namespace of the metafield to add. */
274
+ namespace: string;
275
+
276
+ /** The new information to store in the metafield. */
277
+ value: string | number;
278
+
279
+ /**
280
+ * The metafield’s information type.
281
+ */
282
+ valueType: 'integer' | 'string' | 'json_string';
283
+ }
284
+
285
+ export type MetafieldChange = MetafieldRemoveChange | MetafieldUpdateChange;
286
+
287
+ export interface MetafieldChangeResultSuccess {
288
+ /**
289
+ * The type of the `MetafieldChangeResultSuccess` API.
290
+ */
291
+ type: 'success';
292
+ }
293
+
294
+ export interface MetafieldChangeResultError {
295
+ /**
296
+ * The type of the `MetafieldChangeResultError` API.
297
+ */
298
+ type: 'error';
299
+
300
+ /**
301
+ * A message that explains the error. This message is useful for debugging.
302
+ * It is **not** localized, and therefore should not be presented directly
303
+ * to the buyer.
304
+ */
305
+ message: string;
306
+ }
307
+
308
+ export type MetafieldChangeResult =
309
+ | MetafieldChangeResultSuccess
310
+ | MetafieldChangeResultError;
311
+
312
+ /**
313
+ * Represents a custom metadata attached to a resource.
314
+ */
315
+ export interface AppMetafield {
316
+ /** The key name of a metafield. */
317
+ key: string;
318
+
319
+ /** The namespace for a metafield. */
320
+ namespace: string;
321
+
322
+ /** The value of a metafield. */
323
+ value: string | number | boolean;
324
+
325
+ /** The metafield’s information type. */
326
+ valueType: 'boolean' | 'float' | 'integer' | 'json_string' | 'string';
327
+ }
328
+
329
+ /**
330
+ * The metafield owner.
331
+ */
332
+ export interface AppMetafieldEntryTarget {
333
+ /** The type of the metafield owner. */
334
+ type: 'customer' | 'product' | 'shop' | 'variant';
335
+
336
+ /** The numeric owner ID that is associated with the metafield. */
337
+ id: string;
338
+ }
339
+
340
+ /**
341
+ * A metafield associated with the shop or a resource on the checkout.
342
+ */
343
+ export interface AppMetafieldEntry {
344
+ /** The target that is associated to the metadata. */
345
+ target: AppMetafieldEntryTarget;
346
+
347
+ /** The metadata information. */
348
+ metafield: AppMetafield;
349
+ }
350
+
351
+ export type Version = 'unstable';
352
+
353
+ /**
354
+ * This defines the i18n.translate() signature.
355
+ */
356
+ export interface I18nTranslate {
357
+ /**
358
+ * This returns a translated string matching a key in a locale file.
359
+ *
360
+ * @example translate("banner.title")
361
+ */
362
+ <ReplacementType = string>(
363
+ key: string,
364
+ options?: {[placeholderKey: string]: ReplacementType | string | number},
365
+ ): ReplacementType extends string | number
366
+ ? string
367
+ : (string | ReplacementType)[];
368
+ }
369
+
370
+ export interface I18n {
371
+ /**
372
+ * Returns a localized number.
373
+ *
374
+ * This function behaves like the standard `Intl.NumberFormat()`
375
+ * with a style of `decimal` applied. It uses the buyer's locale by default.
376
+ *
377
+ * @param options.inExtensionLocale - if true, use the extension's locale
378
+ */
379
+ formatNumber: (
380
+ number: number | bigint,
381
+ options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions,
382
+ ) => string;
383
+
384
+ /**
385
+ * Returns a localized currency value.
386
+ *
387
+ * This function behaves like the standard `Intl.NumberFormat()`
388
+ * with a style of `currency` applied. It uses the buyer's locale by default.
389
+ *
390
+ * @param options.inExtensionLocale - if true, use the extension's locale
391
+ */
392
+ formatCurrency: (
393
+ number: number | bigint,
394
+ options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions,
395
+ ) => string;
396
+
397
+ /**
398
+ * Returns a localized date value.
399
+ *
400
+ * This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses
401
+ * the buyer's locale by default. Formatting options can be passed in as
402
+ * options.
403
+ *
404
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0
405
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options
406
+ *
407
+ * @param options.inExtensionLocale - if true, use the extension's locale
408
+ */
409
+ formatDate: (
410
+ date: Date,
411
+ options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions,
412
+ ) => string;
413
+
414
+ /**
415
+ * Returns translated content in the buyer's locale,
416
+ * as supported by the extension.
417
+ *
418
+ * - `options.count` is a special numeric value used in pluralization.
419
+ * - The other option keys and values are treated as replacements for interpolation.
420
+ * - If the replacements are all primitives, then `translate()` returns a single string.
421
+ * - If replacements contain UI components, then `translate()` returns an array of elements.
422
+ */
423
+ translate: I18nTranslate;
424
+ }
425
+
426
+ export interface Language {
427
+ /**
428
+ * The BCP-47 language tag. It may contain a dash followed by an ISO 3166-1 alpha-2 region code.
429
+ *
430
+ * @example 'en' for English, or 'en-US' for English local to United States.
431
+ * @see https://en.wikipedia.org/wiki/IETF_language_tag
432
+ * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
433
+ */
434
+ isoCode: string;
435
+ }
436
+
437
+ export interface Currency {
438
+ /**
439
+ * The ISO-4217 code for this currency.
440
+ * @see https://www.iso.org/iso-4217-currency-codes.html
441
+ */
442
+ isoCode: CurrencyCode;
443
+ }
444
+
445
+ export interface Localization {
446
+ /**
447
+ * The currency that the buyer sees for money amounts in the checkout.
448
+ */
449
+ currency: StatefulRemoteSubscribable<Currency>;
450
+
451
+ /**
452
+ * The buyer’s time zone.
453
+ */
454
+ timezone: StatefulRemoteSubscribable<Timezone>;
455
+
456
+ /**
457
+ * The language the buyer sees in the checkout.
458
+ */
459
+ language: StatefulRemoteSubscribable<Language>;
460
+
461
+ /**
462
+ * This is the buyer's language, as supported by the extension.
463
+ * If the buyer's actual language is not supported by the extension,
464
+ * this is the fallback locale used for translations.
465
+ *
466
+ * For example, if the buyer's language is 'fr-CA' but your extension
467
+ * only supports translations for 'fr', then the `isoCode` for this
468
+ * language is 'fr'. If your extension does not provide french
469
+ * translations at all, this value is the default locale for your
470
+ * extension (that is, the one matching your .default.json file).
471
+ */
472
+ extensionLanguage: StatefulRemoteSubscribable<Language>;
473
+ }
474
+
475
+ /**
476
+ * The following APIs are provided to all extension points.
477
+ */
478
+ export interface StandardApi<ExtensionPoint extends AnyExtensionPoint>
479
+ extends BaseStandardApi {
480
+ /**
481
+ * The renderer version being used for the extension.
482
+ *
483
+ * @example 'unstable'
484
+ */
485
+ version: Version;
486
+
487
+ /**
488
+ * Provides details on buyer progression through the steps of the checkout.
489
+ */
490
+ buyerJourney: {
491
+ /**
492
+ * A function for intercepting and preventing progress on checkout. You can block
493
+ * checkout progress by returning an object with `{behavior: 'block', reason: InvalidResultReason.InvalidExtensionState}`.
494
+ * If you do, then you're expected to also update some part of your UI to reflect the reason why progress
495
+ * was blocked.
496
+ *
497
+ * To block checkout progress, you must set the [block_progress](https://shopify.dev/api/checkout-extensions/checkout/configuration#block-progress) capability in your extension's configuration.
498
+ */
499
+ intercept(interceptor: Interceptor): Promise<() => void>;
500
+ };
501
+
502
+ /**
503
+ * The identifier of the running extension point.
504
+ * @example 'Checkout::PostPurchase::Render'
505
+ */
506
+ extensionPoint: ExtensionPoint;
507
+
508
+ /**
509
+ * Meta information about the extension.
510
+ */
511
+ extension: ExtensionInstance;
512
+
513
+ /**
514
+ * Key-value storage for the extension point.
515
+ */
516
+ storage: Storage;
517
+
518
+ /**
519
+ * The proposed buyer shipping address. During the information step, the address
520
+ * updates when the field is committed (on change) rather than every keystroke.
521
+ * An address value is only present if delivery is required. Otherwise, the
522
+ * subscribable value is undefined.
523
+ */
524
+ shippingAddress?: StatefulRemoteSubscribable<MailingAddress | undefined>;
525
+
526
+ /**
527
+ * Information about the buyer that is interacting with the checkout.
528
+ */
529
+ buyerIdentity?: BuyerIdentity;
530
+
531
+ /** Shop where the checkout is taking place. */
532
+ shop: Shop;
533
+
534
+ /**
535
+ * Details on the costs the buyer will pay for this checkout.
536
+ */
537
+ cost: CartCost;
538
+
539
+ /**
540
+ * A note left by the customer to the merchant, either in their cart or during checkout.
541
+ */
542
+ note: StatefulRemoteSubscribable<string | undefined>;
543
+
544
+ /**
545
+ * Performs an update on the note attached to the cart and checkout. If
546
+ * successful, this mutation results in an update to the value retrieved
547
+ * through the `note` property.
548
+ */
549
+ applyNoteChange(change: NoteChange): Promise<NoteChangeResult>;
550
+
551
+ /**
552
+ * Custom attributes left by the customer to the merchant, either in their cart or during checkout.
553
+ */
554
+ attributes: StatefulRemoteSubscribable<Attribute[] | undefined>;
555
+
556
+ /**
557
+ * Performs an update on an attribute attached to the cart and checkout. If
558
+ * successful, this mutation results in an update to the value retrieved
559
+ * through the `attributes` property.
560
+ */
561
+ applyAttributeChange(change: AttributeChange): Promise<AttributeChangeResult>;
562
+
563
+ /**
564
+ * The metafields that apply to the current checkout. The actual resource
565
+ * on which these metafields exist depends on the source of the checkout:
566
+ *
567
+ * - If the source is an order, then the metafields are on the order.
568
+ * - If the source is a draft order, then the initial value of metafields are
569
+ * from the draft order, and any new metafields you write are applied
570
+ * to the order created by this checkout.
571
+ * - For all other sources, the metafields are only stored locally on the
572
+ * client creating the checkout, and are applied to the order that
573
+ * results from checkout.
574
+ *
575
+ * These metafields are shared by all extensions running on checkout, and
576
+ * persist for as long as the customer is working on this checkout.
577
+ *
578
+ * Once the order is created, you can query these metafields using the
579
+ * [GraphQL Admin API](https://shopify.dev/docs/admin-api/graphql/reference/orders/order#metafield-2021-01)
580
+ */
581
+ metafields: StatefulRemoteSubscribable<Metafield[]>;
582
+
583
+ /**
584
+ * Performs an update on a piece of metadata attached to the checkout. If
585
+ * successful, this mutation results in an update to the value retrieved
586
+ * through the `metafields` property.
587
+ */
588
+ applyMetafieldChange(change: MetafieldChange): Promise<MetafieldChangeResult>;
589
+
590
+ /**
591
+ * A list of lines containing information about the items the customer intends to purchase.
592
+ */
593
+ lines: StatefulRemoteSubscribable<CartLine[]>;
594
+
595
+ /**
596
+ * A list of the line items displayed in the checkout. These may be the same as lines, or may be a subset.
597
+ */
598
+ presentmentLines: StatefulRemoteSubscribable<PresentmentCartLine[]>;
599
+
600
+ /**
601
+ * Performs an update on the merchandise line items. It resolves when the new
602
+ * line items have been negotiated and results in an update to the value
603
+ * retrieved through the `lines` property.
604
+ */
605
+ applyCartLinesChange(change: CartLineChange): Promise<CartLineChangeResult>;
606
+
607
+ /**
608
+ * A list of discount codes currently applied to the checkout.
609
+ */
610
+ discountCodes: StatefulRemoteSubscribable<CartDiscountCode[]>;
611
+
612
+ /**
613
+ * Discounts that have been applied to the entire cart.
614
+ */
615
+ discountAllocations: StatefulRemoteSubscribable<CartDiscountAllocation[]>;
616
+
617
+ /**
618
+ * Performs an update on the discount codes.
619
+ * It resolves when the new discount codes have been negotiated and results in an update
620
+ * to the value retrieved through the `discountCodes` property.
621
+ */
622
+ applyDiscountCodeChange(
623
+ change: DiscountCodeChange,
624
+ ): Promise<DiscountCodeChangeResult>;
625
+
626
+ /**
627
+ * The metafields requested in the `shopify.ui.extension.toml` file. These metafields are
628
+ * updated when there's a change in the merchandise items being purchased by the customer.
629
+ */
630
+ appMetafields: StatefulRemoteSubscribable<AppMetafieldEntry[]>;
631
+
632
+ /**
633
+ * Details about the location, language, and currency of the buyer. For utilities to easily
634
+ * format and translate content based on these details, you can use the `i18n` object instead.
635
+ */
636
+ localization: Localization;
637
+
638
+ /**
639
+ * Utilities for translating content and formatting values according to the current `localization`
640
+ * of the checkout.
641
+ */
642
+ i18n: I18n;
643
+
644
+ /**
645
+ * The settings matching the settings definition written in the `shopify.ui.extension.toml` file.
646
+ *
647
+ * **Note:** When an extension is being installed in the editor, the settings will be empty until
648
+ * a merchant sets a value. In that case, this object will be updated in real time as a merchant fills in the settings.
649
+ */
650
+ settings: StatefulRemoteSubscribable<ExtensionSettings>;
651
+
652
+ /**
653
+ * Exposes a `analytics.publish` method to publish analytics events.
654
+ */
655
+ analytics: Analytics;
656
+ }
657
+
658
+ export interface BuyerIdentity {
659
+ /**
660
+ * The customer account from the buyer. This value will update when there's a
661
+ * change in the account. The value is undefined if the buyer isn’t a known customer
662
+ * for this shop.
663
+ *
664
+ * Protected resource: Requires approval to access protected customer data.
665
+ * More info - https://shopify.dev/apps/store/data-protection/protected-customer-data
666
+ */
667
+ customer: StatefulRemoteSubscribable<Customer | undefined>;
668
+
669
+ /**
670
+ * The email address of the buyer that is interacting with the cart. This value will update when there's a
671
+ * change in the checkout formulary. The value is undefined if no permission given.
672
+ *
673
+ * Protected resource: Requires approval to access protected customer data (Level 2).
674
+ * More info - https://shopify.dev/apps/store/data-protection/protected-customer-data
675
+ */
676
+ email: StatefulRemoteSubscribable<string | undefined>;
677
+
678
+ /**
679
+ * The phone number of the buyer that is interacting with the cart. This value will update when there's a
680
+ * change in the checkout formulary. The value is undefined if no permission given.
681
+ *
682
+ * Protected resource: Requires approval to access protected customer data (Level 2).
683
+ * More info - https://shopify.dev/apps/store/data-protection/protected-customer-data
684
+ */
685
+ phone: StatefulRemoteSubscribable<string | undefined>;
686
+ }
687
+
688
+ export interface Shop {
689
+ /**
690
+ * The shop ID.
691
+ * @example 'gid://shopify/Shop/123'
692
+ */
693
+ id: string;
694
+ /**
695
+ * The name of the shop.
696
+ */
697
+ name: string;
698
+ /**
699
+ * The primary storefront URL.
700
+ */
701
+ storefrontUrl?: string;
702
+ /**
703
+ * The shop's myshopify.com domain.
704
+ */
705
+ myshopifyDomain: string;
706
+ }
707
+
708
+ export interface MailingAddress {
709
+ /**
710
+ * The buyer's full name.
711
+ * @example 'John Doe'
712
+ */
713
+ name?: string;
714
+
715
+ /**
716
+ * The buyer's first name.
717
+ * @example 'John'
718
+ */
719
+ firstName?: string;
720
+
721
+ /**
722
+ * The buyer's last name.
723
+ * @example 'Doe'
724
+ */
725
+ lastName?: string;
726
+
727
+ /**
728
+ * The buyer's company name.
729
+ * @example 'Shopify'
730
+ */
731
+ company?: string;
732
+
733
+ /**
734
+ * The first line of the buyer's address, including street name and number.
735
+ * @example '151 O'Connor Street'
736
+ */
737
+ address1?: string;
738
+
739
+ /**
740
+ * The second line of the buyer's address, like apartment number, suite, etc.
741
+ * @example 'Ground floor'
742
+ */
743
+ address2?: string;
744
+
745
+ /**
746
+ * The buyer's city.
747
+ * @example 'Ottawa'
748
+ */
749
+ city?: string;
750
+
751
+ /**
752
+ * The buyer's postal or ZIP code.
753
+ * @example 'K2P 2L8'
754
+ */
755
+ zip?: string;
756
+
757
+ /**
758
+ * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html.
759
+ * @example 'CA' for Canada.
760
+ */
761
+ countryCode?: CountryCode;
762
+
763
+ /**
764
+ * The buyer's zone code, such as state, province, prefecture, or region.
765
+ * @example 'ON' for Ontario.
766
+ */
767
+ provinceCode?: string;
768
+
769
+ /**
770
+ * The buyer's phone number.
771
+ * @example '+1 613 111 2222'.
772
+ */
773
+ phone?: string;
774
+ }
775
+
776
+ export interface CartCost {
777
+ /**
778
+ * A `Money` value representing the minimum a buyer can expect to pay at the current
779
+ * step of checkout. This value excludes amounts yet to be negotiated. For example,
780
+ * the information step might not have delivery costs calculated.
781
+ */
782
+ totalAmount: StatefulRemoteSubscribable<Money>;
783
+ }
784
+
785
+ export interface CartLine {
786
+ /**
787
+ * These line item IDs are not stable at the moment, they might change after
788
+ * any operations on the line items. You should always look up for an updated
789
+ * ID before any call to `applyCartLinesChange` because you'll need the ID to
790
+ * create a `CartLineChange` object.
791
+ * @example 'gid://shopify/CartLine/123'
792
+ */
793
+ id: string;
794
+
795
+ /**
796
+ * The merchandise being purchased.
797
+ */
798
+ merchandise: Merchandise;
799
+
800
+ /**
801
+ * The quantity of the merchandise being purchased.
802
+ */
803
+ quantity: number;
804
+
805
+ /**
806
+ * The details about the cost components attributed to the cart line.
807
+ */
808
+ cost: CartLineCost;
809
+
810
+ /**
811
+ * The line item additional custom attributes.
812
+ */
813
+ attributes: Attribute[];
814
+
815
+ /**
816
+ * Discounts applied to the cart line.
817
+ */
818
+ discountAllocations: CartDiscountAllocation[];
819
+
820
+ /** @private */
821
+ __lineComponents: CartLineComponentType[];
822
+ }
823
+
824
+ /** @private */
825
+ type CartLineComponentType = CartBundleLineComponent;
826
+
827
+ /** @private */
828
+ export interface CartBundleLineComponent {
829
+ id: string;
830
+ merchandise: Merchandise;
831
+ quantity: number;
832
+ cost: CartLineCost;
833
+ attributes: Attribute[];
834
+ }
835
+
836
+ export interface CartLineCost {
837
+ /**
838
+ * The total amount the buyer can expect to pay that is directly attributable to a single
839
+ * cart line.
840
+ */
841
+ totalAmount: Money;
842
+ }
843
+
844
+ export interface Money {
845
+ /**
846
+ * The price amount.
847
+ */
848
+ amount: number;
849
+ /**
850
+ * The ISO 4217 format for the currency.
851
+ * @example 'CAD' for Canadian dollar
852
+ */
853
+ currencyCode: CurrencyCode;
854
+ }
855
+
856
+ export type Merchandise = ProductVariant;
857
+
858
+ export interface BaseMerchandise {
859
+ /**
860
+ * The merchandise ID.
861
+ */
862
+ id: string;
863
+ }
864
+
865
+ export interface ProductVariant extends BaseMerchandise {
866
+ type: 'variant';
867
+
868
+ /**
869
+ * A globally-unique identifier.
870
+ * @example 'gid://shopify/ProductVariant/123'
871
+ */
872
+ id: string;
873
+
874
+ /**
875
+ * The product variant’s title.
876
+ */
877
+ title: string;
878
+
879
+ /**
880
+ * The product variant's subtitle.
881
+ */
882
+ subtitle?: string;
883
+
884
+ /**
885
+ * Image associated with the product variant. This field falls back to the product
886
+ * image if no image is available.
887
+ */
888
+ image?: ImageDetails;
889
+
890
+ /**
891
+ * List of product options applied to the variant.
892
+ */
893
+ selectedOptions: SelectedOption[];
894
+
895
+ /**
896
+ * The product object that the product variant belongs to.
897
+ */
898
+ product: Product;
899
+ }
900
+
901
+ export interface Product {
902
+ /**
903
+ * A globally-unique identifier.
904
+ */
905
+ id: string;
906
+
907
+ /**
908
+ * The product’s vendor name.
909
+ */
910
+ vendor: string;
911
+
912
+ /**
913
+ * A categorization that a product can be tagged with, commonly used for filtering and searching.
914
+ */
915
+ productType: string;
916
+ }
917
+
918
+ export interface ImageDetails {
919
+ /**
920
+ * The image URL.
921
+ */
922
+ url: string;
923
+
924
+ /**
925
+ * The alternative text for the image.
926
+ */
927
+ altText?: string;
928
+ }
929
+
930
+ export interface Attribute {
931
+ /**
932
+ * The key for the attribute.
933
+ */
934
+ key: string;
935
+
936
+ /**
937
+ * The value for the attribute.
938
+ */
939
+ value: string;
940
+ }
941
+
942
+ export interface SelectedOption {
943
+ /**
944
+ * The name of the merchandise option.
945
+ */
946
+ name: string;
947
+
948
+ /**
949
+ * The value of the merchandise option.
950
+ */
951
+ value: string;
952
+ }
953
+
954
+ export interface PresentmentCartLine {
955
+ /**
956
+ * The ID of the present cart line. This ID isn't stable and might change after
957
+ * any operations on the line items.
958
+ * @example 'gid://shopify/PresentmentCartLine/123'
959
+ */
960
+ id: string;
961
+
962
+ /**
963
+ * The quantity of the merchandise being purchased.
964
+ */
965
+ quantity: number;
966
+
967
+ /**
968
+ * The details about the cost components attributed to the presentment cart line.
969
+ */
970
+ cost: PresentmentCartLineCost;
971
+
972
+ /**
973
+ * The title of the line item.
974
+ */
975
+ title: string;
976
+
977
+ /**
978
+ * The subtitle of the line item.
979
+ */
980
+ subtitle?: string;
981
+
982
+ /**
983
+ * The image associated with the line item.
984
+ */
985
+ image?: ImageDetails;
986
+
987
+ /**
988
+ * The merchandise lines being purchased.
989
+ */
990
+ lines: CartLine[];
991
+ }
992
+
993
+ export interface PresentmentCartLineCost {
994
+ /**
995
+ * The total cost of the merchandise line.
996
+ */
997
+ totalAmount: Money;
998
+ }
999
+
1000
+ export interface CartLineChangeResultSuccess {
1001
+ /**
1002
+ * Indicates that the line item was changed successfully.
1003
+ */
1004
+ type: 'success';
1005
+ }
1006
+
1007
+ export interface CartLineChangeResultError {
1008
+ /**
1009
+ * Indicates that the line item was not changed successfully. Refer to the `message` property for details about the error.
1010
+ */
1011
+ type: 'error';
1012
+
1013
+ /**
1014
+ * A message that explains the error. This message is useful for debugging.
1015
+ * It is **not** localized, and therefore should not be presented directly
1016
+ * to the buyer.
1017
+ */
1018
+ message: string;
1019
+ }
1020
+
1021
+ export type CartLineChangeResult =
1022
+ | CartLineChangeResultSuccess
1023
+ | CartLineChangeResultError;
1024
+
1025
+ export type CartLineChange =
1026
+ | CartLineAddChange
1027
+ | CartLineRemoveChange
1028
+ | CartLineUpdateChange;
1029
+
1030
+ export interface CartLineAddChange {
1031
+ /**
1032
+ * An identifier for changes that add line items.
1033
+ */
1034
+ type: 'addCartLine';
1035
+
1036
+ /**
1037
+ * The merchandise ID being added.
1038
+ * @example 'gid://shopify/ProductVariant/123'
1039
+ */
1040
+ merchandiseId: string;
1041
+
1042
+ /**
1043
+ * The quantity of the merchandise being added.
1044
+ */
1045
+ quantity: number;
1046
+
1047
+ /**
1048
+ * The attributes associated with the line item.
1049
+ */
1050
+ attributes?: Attribute[];
1051
+ }
1052
+
1053
+ export interface CartLineRemoveChange {
1054
+ /**
1055
+ * An identifier for changes that remove line items.
1056
+ */
1057
+ type: 'removeCartLine';
1058
+
1059
+ /**
1060
+ * Line Item ID.
1061
+ * @example 'gid://shopify/CartLine/123'
1062
+ */
1063
+ id: string;
1064
+
1065
+ /**
1066
+ * The quantity being removed for this line item.
1067
+ */
1068
+ quantity: number;
1069
+ }
1070
+
1071
+ export interface CartLineUpdateChange {
1072
+ /**
1073
+ * An identifier for changes that update line items.
1074
+ */
1075
+ type: 'updateCartLine';
1076
+
1077
+ /**
1078
+ * Line Item ID.
1079
+ * @example 'gid://shopify/CartLine/123'
1080
+ */
1081
+ id: string;
1082
+
1083
+ /**
1084
+ * The new merchandise ID for the line item.
1085
+ * @example 'gid://shopify/ProductVariant/123'
1086
+ */
1087
+
1088
+ merchandiseId?: string;
1089
+ /**
1090
+ * The new quantity for the line item.
1091
+ */
1092
+ quantity?: number;
1093
+
1094
+ /**
1095
+ * The new attributes for the line item.
1096
+ */
1097
+ attributes?: Attribute[];
1098
+ }
1099
+
1100
+ export interface CartDiscountCode {
1101
+ /**
1102
+ * The code for the discount
1103
+ */
1104
+ code: string;
1105
+ }
1106
+
1107
+ export type CartDiscountAllocation =
1108
+ | CartCodeDiscountAllocation
1109
+ | CartAutomaticDiscountAllocation
1110
+ | CartCustomDiscountAllocation;
1111
+
1112
+ export interface CartDiscountAllocationBase {
1113
+ /**
1114
+ * The money amount that has been discounted from the order
1115
+ */
1116
+ discountedAmount: Money;
1117
+ }
1118
+
1119
+ export interface CartCodeDiscountAllocation extends CartDiscountAllocationBase {
1120
+ /**
1121
+ * The code for the discount
1122
+ */
1123
+ code: string;
1124
+
1125
+ /**
1126
+ * The type of the code discount
1127
+ */
1128
+ type: 'code';
1129
+ }
1130
+
1131
+ export interface CartAutomaticDiscountAllocation
1132
+ extends CartDiscountAllocationBase {
1133
+ /**
1134
+ * The title of the automatic discount
1135
+ */
1136
+ title: string;
1137
+
1138
+ /**
1139
+ * The type of the automatic discount
1140
+ */
1141
+ type: 'automatic';
1142
+ }
1143
+
1144
+ export interface CartCustomDiscountAllocation
1145
+ extends CartDiscountAllocationBase {
1146
+ /**
1147
+ * The title of the custom discount
1148
+ */
1149
+ title: string;
1150
+
1151
+ /**
1152
+ * The type of the custom discount
1153
+ */
1154
+ type: 'custom';
1155
+ }
1156
+
1157
+ export type DiscountCodeChange =
1158
+ | DiscountCodeAddChange
1159
+ | DiscountCodeRemoveChange;
1160
+
1161
+ export type DiscountCodeChangeResult =
1162
+ | DiscountCodeChangeResultSuccess
1163
+ | DiscountCodeChangeResultError;
1164
+
1165
+ export interface DiscountCodeAddChange {
1166
+ /**
1167
+ * The type of the `DiscountCodeChange` API.
1168
+ */
1169
+ type: 'addDiscountCode';
1170
+
1171
+ /**
1172
+ * The code for the discount
1173
+ */
1174
+ code: string;
1175
+ }
1176
+
1177
+ export interface DiscountCodeRemoveChange {
1178
+ /**
1179
+ * The type of the `DiscountCodeChange` API.
1180
+ */
1181
+ type: 'removeDiscountCode';
1182
+
1183
+ /**
1184
+ * The code for the discount
1185
+ */
1186
+ code: string;
1187
+ }
1188
+
1189
+ export interface DiscountCodeChangeResultSuccess {
1190
+ /**
1191
+ * Indicates that the discount code change was applied successfully.
1192
+ */
1193
+ type: 'success';
1194
+ }
1195
+
1196
+ export interface DiscountCodeChangeResultError {
1197
+ /**
1198
+ * Indicates that the discount code change failed.
1199
+ */
1200
+ type: 'error';
1201
+
1202
+ /**
1203
+ * A message that explains the error. This message is useful for debugging.
1204
+ * It is **not** localized, and therefore should not be presented directly
1205
+ * to the buyer.
1206
+ */
1207
+ message: string;
1208
+ }
1209
+
1210
+ type InterceptorResult = InterceptorResultAllow | InterceptorResultBlock;
1211
+
1212
+ interface InterceptorResultAllow {
1213
+ /**
1214
+ * Indicates that the buyer was allowed to progress through checkout.
1215
+ */
1216
+ behavior: 'allow';
1217
+ }
1218
+
1219
+ interface InterceptorResultBlock {
1220
+ /**
1221
+ * Indicates that some part of the checkout UI intercepted and prevented
1222
+ * the buyer’s progress. The buyer typically needs to take some action
1223
+ * to resolve this issue and to move on to the next step.
1224
+ */
1225
+ behavior: 'block';
1226
+ }
1227
+
1228
+ export type InterceptorRequest =
1229
+ | InterceptorRequestAllow
1230
+ | InterceptorRequestBlock;
1231
+
1232
+ interface InterceptorRequestAllow {
1233
+ /**
1234
+ * Indicates that the interceptor will allow the buyer's journey to continue.
1235
+ */
1236
+ behavior: 'allow';
1237
+
1238
+ /**
1239
+ * This callback is called when all interceptors finish. We recommend
1240
+ * setting errors or reasons for blocking at this stage, so that all the errors in
1241
+ * the UI show up at once.
1242
+ * @param result InterceptorResult with behavior as either 'allow' or 'block'
1243
+ */
1244
+ perform?(result: InterceptorResult): void | Promise<void>;
1245
+ }
1246
+ // The reason is used for tracing and debugging purposes.
1247
+ interface InterceptorRequestBlock {
1248
+ /**
1249
+ * Indicates that the interceptor will block the buyer's journey from continuing.
1250
+ */
1251
+ behavior: 'block';
1252
+
1253
+ /**
1254
+ * The reason for blocking the interceptor request. This value isn't presented to
1255
+ * the buyer, so it doesn't need to be localized. The value is used only for Shopify’s
1256
+ * own internal debugging and metrics.
1257
+ */
1258
+ reason: string;
1259
+
1260
+ /**
1261
+ * This callback is called when all interceptors finish. We recommend
1262
+ * setting errors or reasons for blocking at this stage, so that all the errors in
1263
+ * the UI show up at once.
1264
+ * @param result InterceptorResult with behavior as either 'allow' or 'block'
1265
+ */
1266
+ perform(result: InterceptorResult): void | Promise<void>;
1267
+ }
1268
+
1269
+ export interface InterceptorProps {
1270
+ /**
1271
+ * Whether the interceptor has the capability to block a buyer's progress through
1272
+ * checkout. This ability might be granted by a merchant in differing checkout contexts.
1273
+ */
1274
+ canBlockProgress: boolean;
1275
+ }
1276
+
1277
+ export interface Interceptor {
1278
+ /**
1279
+ * A function for intercepting and preventing navigation on checkout. You can block
1280
+ * navigation by returning an object with `{behavior: 'block', reason: InvalidResultReason.InvalidExtensionState}`.
1281
+ * If you do, then you're expected to also update some part of your UI to reflect the reason why navigation
1282
+ * was blocked.
1283
+ */
1284
+ (interceptorProps: InterceptorProps):
1285
+ | InterceptorRequest
1286
+ | Promise<InterceptorRequest>;
1287
+ }
1288
+
1289
+ /**
1290
+ * Information about a customer who has previously purchased from this shop.
1291
+ */
1292
+ export interface Customer {
1293
+ /**
1294
+ * Customer ID.
1295
+ * @example 'gid://shopify/Customer/123'
1296
+ */
1297
+ id: string;
1298
+ /**
1299
+ * The email of the customer.
1300
+ */
1301
+ email?: string;
1302
+ /**
1303
+ * The phone number of the customer.
1304
+ */
1305
+ phone?: string;
1306
+ /**
1307
+ * The full name of the customer.
1308
+ */
1309
+ fullName?: string;
1310
+ /**
1311
+ * The first name of the customer.
1312
+ */
1313
+ firstName?: string;
1314
+ /**
1315
+ * The last name of the customer.
1316
+ */
1317
+ lastName?: string;
1318
+ /**
1319
+ * The image associated with the customer.
1320
+ */
1321
+ image: ImageDetails;
1322
+ /**
1323
+ * Defines if the customer accepts marketing activities.
1324
+ */
1325
+ acceptsMarketing: boolean;
1326
+ }
1327
+
1328
+ /**
1329
+ * The merchant-defined setting values for the extension.
1330
+ */
1331
+ export interface ExtensionSettings {
1332
+ [key: string]: string | number | boolean | undefined;
1333
+ }
1334
+
1335
+ /**
1336
+ * Publish method to emit analytics events to Web Pixels.
1337
+ */
1338
+ export interface Analytics {
1339
+ publish(name: string, data: {[key: string]: unknown}): Promise<boolean>;
1340
+ }