@shopify/ui-extensions 1.0.2 → 2.0.0-alpha.0

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 (314) hide show
  1. package/README.md +57 -1
  2. package/admin.d.ts +2 -0
  3. package/admin.esnext +2 -0
  4. package/admin.js +1 -0
  5. package/admin.mjs +2 -0
  6. package/build/cjs/{types/Banner.js → api.js} +0 -0
  7. package/build/cjs/components/BlockStack/BlockStack.js +11 -0
  8. package/build/cjs/components/BlockStack/README.md +1 -0
  9. package/build/cjs/components/Button/Button.js +11 -0
  10. package/build/cjs/components/Button/README.md +1 -0
  11. package/build/cjs/components/Text/README.md +1 -0
  12. package/build/cjs/components/Text/Text.js +11 -0
  13. package/build/cjs/components/TextField/README.md +1 -0
  14. package/build/cjs/components/TextField/TextField.js +11 -0
  15. package/build/cjs/components/View/README.md +1 -0
  16. package/build/cjs/components/View/View.js +11 -0
  17. package/build/cjs/components/index.js +45 -0
  18. package/build/cjs/components.js +45 -0
  19. package/build/cjs/{types/BlockStack.js → extension.js} +0 -0
  20. package/build/cjs/index.js +44 -1
  21. package/build/cjs/surfaces/admin/api/checkout-editor/README.md +1 -0
  22. package/build/cjs/{types/Heading.js → surfaces/admin/api/checkout-editor/render-settings.js} +0 -0
  23. package/build/cjs/surfaces/admin/api/standard/README.md +1 -0
  24. package/build/cjs/{types/InlineStack.js → surfaces/admin/api/standard/standard.js} +0 -0
  25. package/build/cjs/{types/Button.js → surfaces/admin/api.js} +0 -0
  26. package/build/cjs/{types/shared/index.js → surfaces/admin/components.js} +4 -4
  27. package/build/cjs/{types/index.js → surfaces/admin/extension-points.js} +0 -0
  28. package/build/cjs/surfaces/admin/extension.js +27 -0
  29. package/build/cjs/surfaces/admin/index.js +70 -0
  30. package/build/cjs/{types/shared/Spacing.js → surfaces/admin/shared.js} +0 -0
  31. package/build/cjs/surfaces/checkout/api/cart-line-details/README.md +1 -0
  32. package/build/{node/types/BlockStack.js → cjs/surfaces/checkout/api/cart-line-details/render-after.js} +0 -0
  33. package/build/{node/types/Button.js → cjs/surfaces/checkout/api/shared.js} +0 -0
  34. package/build/cjs/surfaces/checkout/api/standard/README.md +1 -0
  35. package/build/{node/types/Heading.js → cjs/surfaces/checkout/api/standard/standard.js} +0 -0
  36. package/build/{node/types/Banner.js → cjs/surfaces/checkout/api.js} +0 -0
  37. package/build/cjs/surfaces/checkout/components.js +18 -0
  38. package/build/{node/types/InlineStack.js → cjs/surfaces/checkout/extension-points.js} +0 -0
  39. package/build/cjs/surfaces/checkout/extension.js +27 -0
  40. package/build/cjs/surfaces/checkout/index.js +70 -0
  41. package/build/{node/types/index.js → cjs/surfaces/checkout/shared.js} +0 -0
  42. package/build/cjs/utilities/registration.js +110 -0
  43. package/build/esm/{types/Banner.mjs → api.mjs} +0 -0
  44. package/build/esm/components/BlockStack/BlockStack.mjs +2 -0
  45. package/build/esm/components/BlockStack/README.md +1 -0
  46. package/build/esm/components/Button/Button.mjs +2 -0
  47. package/build/esm/components/Button/README.md +1 -0
  48. package/build/esm/components/Text/README.md +1 -0
  49. package/build/esm/components/Text/Text.mjs +2 -0
  50. package/build/esm/components/TextField/README.md +1 -0
  51. package/build/esm/components/TextField/TextField.mjs +2 -0
  52. package/build/esm/components/View/README.md +1 -0
  53. package/build/esm/components/View/View.mjs +2 -0
  54. package/build/esm/components/index.mjs +5 -0
  55. package/build/esm/components.mjs +5 -0
  56. package/build/esm/{types/BlockStack.mjs → extension.mjs} +0 -0
  57. package/build/esm/index.mjs +3 -0
  58. package/build/esm/surfaces/admin/api/checkout-editor/README.md +1 -0
  59. package/build/esm/{types/Heading.mjs → surfaces/admin/api/checkout-editor/render-settings.mjs} +0 -0
  60. package/build/esm/surfaces/admin/api/standard/README.md +1 -0
  61. package/build/esm/{types/InlineStack.mjs → surfaces/admin/api/standard/standard.mjs} +0 -0
  62. package/build/esm/{types/Button.mjs → surfaces/admin/api.mjs} +0 -0
  63. package/build/esm/surfaces/admin/components.mjs +1 -0
  64. package/build/esm/{types/index.mjs → surfaces/admin/extension-points.mjs} +0 -0
  65. package/build/esm/surfaces/admin/extension.mjs +3 -0
  66. package/build/esm/surfaces/admin/index.mjs +5 -0
  67. package/build/esm/{types/shared/Spacing.mjs → surfaces/admin/shared.mjs} +0 -0
  68. package/build/esm/surfaces/checkout/api/cart-line-details/README.md +1 -0
  69. package/build/{esnext/types/BlockStack.esnext → esm/surfaces/checkout/api/cart-line-details/render-after.mjs} +0 -0
  70. package/build/{esnext/types/Button.esnext → esm/surfaces/checkout/api/shared.mjs} +0 -0
  71. package/build/esm/surfaces/checkout/api/standard/README.md +1 -0
  72. package/build/{esnext/types/Heading.esnext → esm/surfaces/checkout/api/standard/standard.mjs} +0 -0
  73. package/build/{esnext/types/Banner.esnext → esm/surfaces/checkout/api.mjs} +0 -0
  74. package/build/esm/surfaces/checkout/components.mjs +1 -0
  75. package/build/{esnext/types/InlineStack.esnext → esm/surfaces/checkout/extension-points.mjs} +0 -0
  76. package/build/esm/surfaces/checkout/extension.mjs +3 -0
  77. package/build/esm/surfaces/checkout/index.mjs +5 -0
  78. package/build/{esnext/types/index.esnext → esm/surfaces/checkout/shared.mjs} +0 -0
  79. package/build/esm/utilities/registration.mjs +101 -0
  80. package/build/esnext/{types/shared/Spacing.esnext → api.esnext} +0 -0
  81. package/build/esnext/components/BlockStack/BlockStack.esnext +2 -0
  82. package/build/esnext/components/BlockStack/README.md +1 -0
  83. package/build/esnext/components/Button/Button.esnext +2 -0
  84. package/build/esnext/components/Button/README.md +1 -0
  85. package/build/esnext/components/Text/README.md +1 -0
  86. package/build/esnext/components/Text/Text.esnext +2 -0
  87. package/build/esnext/components/TextField/README.md +1 -0
  88. package/build/esnext/components/TextField/TextField.esnext +2 -0
  89. package/build/esnext/components/View/README.md +1 -0
  90. package/build/esnext/components/View/View.esnext +2 -0
  91. package/build/esnext/components/index.esnext +5 -0
  92. package/build/esnext/components.esnext +5 -0
  93. package/build/esnext/extension.esnext +0 -0
  94. package/build/esnext/index.esnext +3 -0
  95. package/build/esnext/surfaces/admin/api/checkout-editor/README.md +1 -0
  96. package/build/esnext/surfaces/admin/api/checkout-editor/render-settings.esnext +0 -0
  97. package/build/esnext/surfaces/admin/api/standard/README.md +1 -0
  98. package/build/esnext/surfaces/admin/api/standard/standard.esnext +0 -0
  99. package/build/esnext/surfaces/admin/api.esnext +0 -0
  100. package/build/esnext/surfaces/admin/components.esnext +1 -0
  101. package/build/esnext/surfaces/admin/extension-points.esnext +0 -0
  102. package/build/esnext/surfaces/admin/extension.esnext +3 -0
  103. package/build/esnext/surfaces/admin/index.esnext +5 -0
  104. package/build/esnext/surfaces/admin/shared.esnext +0 -0
  105. package/build/esnext/surfaces/checkout/api/cart-line-details/README.md +1 -0
  106. package/build/esnext/surfaces/checkout/api/cart-line-details/render-after.esnext +0 -0
  107. package/build/esnext/surfaces/checkout/api/shared.esnext +0 -0
  108. package/build/esnext/surfaces/checkout/api/standard/README.md +1 -0
  109. package/build/esnext/surfaces/checkout/api/standard/standard.esnext +0 -0
  110. package/build/esnext/surfaces/checkout/api.esnext +0 -0
  111. package/build/esnext/surfaces/checkout/components.esnext +1 -0
  112. package/build/esnext/surfaces/checkout/extension-points.esnext +0 -0
  113. package/build/esnext/surfaces/checkout/extension.esnext +3 -0
  114. package/build/esnext/surfaces/checkout/index.esnext +5 -0
  115. package/build/esnext/surfaces/checkout/shared.esnext +0 -0
  116. package/build/esnext/utilities/registration.esnext +37 -0
  117. package/build/node/{types/shared/Spacing.js → api.js} +0 -0
  118. package/build/node/components/BlockStack/BlockStack.js +11 -0
  119. package/build/node/components/BlockStack/README.md +1 -0
  120. package/build/node/components/Button/Button.js +11 -0
  121. package/build/node/components/Button/README.md +1 -0
  122. package/build/node/components/Text/README.md +1 -0
  123. package/build/node/components/Text/Text.js +11 -0
  124. package/build/node/components/TextField/README.md +1 -0
  125. package/build/node/components/TextField/TextField.js +11 -0
  126. package/build/node/components/View/README.md +1 -0
  127. package/build/node/components/View/View.js +11 -0
  128. package/build/node/components/index.js +45 -0
  129. package/build/node/components.js +45 -0
  130. package/build/node/extension.js +1 -0
  131. package/build/node/index.js +44 -1
  132. package/build/node/surfaces/admin/api/checkout-editor/README.md +1 -0
  133. package/build/node/surfaces/admin/api/checkout-editor/render-settings.js +1 -0
  134. package/build/node/surfaces/admin/api/standard/README.md +1 -0
  135. package/build/node/surfaces/admin/api/standard/standard.js +1 -0
  136. package/build/node/surfaces/admin/api.js +1 -0
  137. package/build/node/{types/shared/index.js → surfaces/admin/components.js} +4 -4
  138. package/build/node/surfaces/admin/extension-points.js +1 -0
  139. package/build/node/surfaces/admin/extension.js +27 -0
  140. package/build/node/surfaces/admin/index.js +70 -0
  141. package/build/node/surfaces/admin/shared.js +1 -0
  142. package/build/node/surfaces/checkout/api/cart-line-details/README.md +1 -0
  143. package/build/node/surfaces/checkout/api/cart-line-details/render-after.js +1 -0
  144. package/build/node/surfaces/checkout/api/shared.js +1 -0
  145. package/build/node/surfaces/checkout/api/standard/README.md +1 -0
  146. package/build/node/surfaces/checkout/api/standard/standard.js +1 -0
  147. package/build/node/surfaces/checkout/api.js +1 -0
  148. package/build/node/surfaces/checkout/components.js +18 -0
  149. package/build/node/surfaces/checkout/extension-points.js +1 -0
  150. package/build/node/surfaces/checkout/extension.js +27 -0
  151. package/build/node/surfaces/checkout/index.js +70 -0
  152. package/build/node/surfaces/checkout/shared.js +1 -0
  153. package/build/node/utilities/registration.js +44 -0
  154. package/build/ts/api.d.ts +8 -0
  155. package/build/ts/api.d.ts.map +1 -0
  156. package/build/ts/{types/Banner.js → api.js} +0 -0
  157. package/build/ts/components/BlockStack/BlockStack.d.ts +8 -0
  158. package/build/ts/components/BlockStack/BlockStack.d.ts.map +1 -0
  159. package/build/ts/components/BlockStack/BlockStack.js +5 -0
  160. package/build/ts/components/Button/Button.d.ts +12 -0
  161. package/build/ts/components/Button/Button.d.ts.map +1 -0
  162. package/build/ts/components/Button/Button.js +5 -0
  163. package/build/ts/components/Text/Text.d.ts +8 -0
  164. package/build/ts/components/Text/Text.d.ts.map +1 -0
  165. package/build/ts/components/Text/Text.js +5 -0
  166. package/build/ts/components/TextField/TextField.d.ts +43 -0
  167. package/build/ts/components/TextField/TextField.d.ts.map +1 -0
  168. package/build/ts/components/TextField/TextField.js +5 -0
  169. package/build/ts/components/View/View.d.ts +8 -0
  170. package/build/ts/components/View/View.d.ts.map +1 -0
  171. package/build/ts/components/View/View.js +5 -0
  172. package/build/ts/components/index.d.ts +11 -0
  173. package/build/ts/components/index.d.ts.map +1 -0
  174. package/build/ts/components/index.js +13 -0
  175. package/build/ts/components.d.ts +11 -0
  176. package/build/ts/components.d.ts.map +1 -0
  177. package/build/ts/components.js +13 -0
  178. package/build/ts/extension.d.ts +15 -0
  179. package/build/ts/extension.d.ts.map +1 -0
  180. package/build/ts/{types/BlockStack.js → extension.js} +0 -0
  181. package/build/ts/index.d.ts +3 -1
  182. package/build/ts/index.d.ts.map +1 -1
  183. package/build/ts/index.js +17 -0
  184. package/build/ts/index.ts.d.ts +0 -0
  185. package/build/ts/surfaces/admin/api/checkout-editor/render-settings.d.ts +19 -0
  186. package/build/ts/surfaces/admin/api/checkout-editor/render-settings.d.ts.map +1 -0
  187. package/build/ts/{types/Heading.js → surfaces/admin/api/checkout-editor/render-settings.js} +0 -0
  188. package/build/ts/surfaces/admin/api/standard/standard.d.ts +7 -0
  189. package/build/ts/surfaces/admin/api/standard/standard.d.ts.map +1 -0
  190. package/build/ts/{types/InlineStack.js → surfaces/admin/api/standard/standard.js} +0 -0
  191. package/build/ts/surfaces/admin/api.d.ts +3 -0
  192. package/build/ts/surfaces/admin/api.d.ts.map +1 -0
  193. package/build/ts/{types/Button.js → surfaces/admin/api.js} +0 -0
  194. package/build/ts/surfaces/admin/components.d.ts +2 -0
  195. package/build/ts/surfaces/admin/components.d.ts.map +1 -0
  196. package/build/ts/{types/shared/index.js → surfaces/admin/components.js} +1 -1
  197. package/build/ts/surfaces/admin/extension-points.d.ts +9 -0
  198. package/build/ts/surfaces/admin/extension-points.d.ts.map +1 -0
  199. package/build/ts/{types/index.js → surfaces/admin/extension-points.js} +0 -0
  200. package/build/ts/surfaces/admin/extension.d.ts +4 -0
  201. package/build/ts/surfaces/admin/extension.d.ts.map +1 -0
  202. package/build/ts/surfaces/admin/extension.js +20 -0
  203. package/build/ts/surfaces/admin/index.d.ts +6 -0
  204. package/build/ts/surfaces/admin/index.d.ts.map +1 -0
  205. package/build/ts/surfaces/admin/index.js +21 -0
  206. package/build/ts/surfaces/admin/index.ts.d.ts +0 -0
  207. package/build/ts/surfaces/admin/shared.d.ts +8 -0
  208. package/build/ts/surfaces/admin/shared.d.ts.map +1 -0
  209. package/build/ts/{types/shared/Spacing.js → surfaces/admin/shared.js} +0 -0
  210. package/build/ts/surfaces/checkout/api/cart-line-details/render-after.d.ts +6 -0
  211. package/build/ts/surfaces/checkout/api/cart-line-details/render-after.d.ts.map +1 -0
  212. package/build/ts/surfaces/checkout/api/cart-line-details/render-after.js +2 -0
  213. package/build/ts/surfaces/checkout/api/shared.d.ts +4 -0
  214. package/build/ts/surfaces/checkout/api/shared.d.ts.map +1 -0
  215. package/build/ts/surfaces/checkout/api/shared.js +2 -0
  216. package/build/ts/surfaces/checkout/api/standard/standard.d.ts +7 -0
  217. package/build/ts/surfaces/checkout/api/standard/standard.d.ts.map +1 -0
  218. package/build/ts/surfaces/checkout/api/standard/standard.js +2 -0
  219. package/build/ts/surfaces/checkout/api.d.ts +3 -0
  220. package/build/ts/surfaces/checkout/api.d.ts.map +1 -0
  221. package/build/ts/surfaces/checkout/api.js +2 -0
  222. package/build/ts/surfaces/checkout/components.d.ts +2 -0
  223. package/build/ts/surfaces/checkout/components.d.ts.map +1 -0
  224. package/build/ts/surfaces/checkout/components.js +17 -0
  225. package/build/ts/surfaces/checkout/extension-points.d.ts +10 -0
  226. package/build/ts/surfaces/checkout/extension-points.d.ts.map +1 -0
  227. package/build/ts/surfaces/checkout/extension-points.js +2 -0
  228. package/build/ts/surfaces/checkout/extension.d.ts +4 -0
  229. package/build/ts/surfaces/checkout/extension.d.ts.map +1 -0
  230. package/build/ts/surfaces/checkout/extension.js +20 -0
  231. package/build/ts/surfaces/checkout/index.d.ts +6 -0
  232. package/build/ts/surfaces/checkout/index.d.ts.map +1 -0
  233. package/build/ts/surfaces/checkout/index.js +21 -0
  234. package/build/ts/surfaces/checkout/index.ts.d.ts +0 -0
  235. package/build/ts/surfaces/checkout/shared.d.ts +8 -0
  236. package/build/ts/surfaces/checkout/shared.d.ts.map +1 -0
  237. package/build/ts/surfaces/checkout/shared.js +2 -0
  238. package/build/ts/utilities/registration.d.ts +13 -0
  239. package/build/ts/utilities/registration.d.ts.map +1 -0
  240. package/build/ts/utilities/registration.js +111 -0
  241. package/build/tsconfig.tsbuildinfo +1 -1
  242. package/checkout.d.ts +2 -0
  243. package/checkout.esnext +2 -0
  244. package/checkout.js +1 -0
  245. package/checkout.mjs +2 -0
  246. package/index.d.ts +2 -1
  247. package/index.esnext +2 -1
  248. package/index.js +1 -1
  249. package/index.mjs +2 -1
  250. package/package.json +26 -4
  251. package/sewing-kit.config.ts +3 -1
  252. package/src/api.ts +8 -0
  253. package/src/components/BlockStack/BlockStack.ts +7 -0
  254. package/src/components/BlockStack/README.md +1 -0
  255. package/src/components/Button/Button.ts +10 -0
  256. package/src/components/Button/README.md +1 -0
  257. package/src/components/Text/README.md +1 -0
  258. package/src/components/Text/Text.ts +5 -0
  259. package/src/components/TextField/README.md +1 -0
  260. package/src/components/TextField/TextField.ts +45 -0
  261. package/src/components/View/README.md +1 -0
  262. package/src/components/View/View.ts +5 -0
  263. package/src/components/index.ts +14 -0
  264. package/src/components.ts +14 -0
  265. package/src/extension.ts +45 -0
  266. package/src/index.ts +3 -7
  267. package/src/surfaces/admin/api/checkout-editor/README.md +1 -0
  268. package/src/surfaces/admin/api/checkout-editor/render-settings.ts +26 -0
  269. package/src/surfaces/admin/api/standard/README.md +1 -0
  270. package/src/surfaces/admin/api/standard/standard.ts +8 -0
  271. package/src/surfaces/admin/api.ts +2 -0
  272. package/src/surfaces/admin/components.ts +1 -0
  273. package/src/surfaces/admin/extension-points.ts +17 -0
  274. package/src/surfaces/admin/extension.ts +7 -0
  275. package/src/surfaces/admin/index.ts +5 -0
  276. package/src/surfaces/admin/shared.ts +14 -0
  277. package/src/surfaces/checkout/api/cart-line-details/README.md +1 -0
  278. package/src/surfaces/checkout/api/cart-line-details/render-after.ts +7 -0
  279. package/src/surfaces/checkout/api/shared.ts +3 -0
  280. package/src/surfaces/checkout/api/standard/README.md +1 -0
  281. package/src/surfaces/checkout/api/standard/standard.ts +8 -0
  282. package/src/surfaces/checkout/api.ts +2 -0
  283. package/src/surfaces/checkout/components.ts +1 -0
  284. package/src/surfaces/checkout/extension-points.ts +21 -0
  285. package/src/surfaces/checkout/extension.ts +7 -0
  286. package/src/surfaces/checkout/index.ts +5 -0
  287. package/src/surfaces/checkout/shared.ts +14 -0
  288. package/src/utilities/registration.ts +60 -0
  289. package/build/esm/types/shared/index.mjs +0 -1
  290. package/build/esnext/types/shared/index.esnext +0 -1
  291. package/build/ts/types/Banner.d.ts +0 -10
  292. package/build/ts/types/Banner.d.ts.map +0 -1
  293. package/build/ts/types/BlockStack.d.ts +0 -14
  294. package/build/ts/types/BlockStack.d.ts.map +0 -1
  295. package/build/ts/types/Button.d.ts +0 -46
  296. package/build/ts/types/Button.d.ts.map +0 -1
  297. package/build/ts/types/Heading.d.ts +0 -14
  298. package/build/ts/types/Heading.d.ts.map +0 -1
  299. package/build/ts/types/InlineStack.d.ts +0 -19
  300. package/build/ts/types/InlineStack.d.ts.map +0 -1
  301. package/build/ts/types/index.d.ts +0 -6
  302. package/build/ts/types/index.d.ts.map +0 -1
  303. package/build/ts/types/shared/Spacing.d.ts +0 -2
  304. package/build/ts/types/shared/Spacing.d.ts.map +0 -1
  305. package/build/ts/types/shared/index.d.ts +0 -2
  306. package/build/ts/types/shared/index.d.ts.map +0 -1
  307. package/src/types/Banner.ts +0 -12
  308. package/src/types/BlockStack.ts +0 -14
  309. package/src/types/Button.ts +0 -45
  310. package/src/types/Heading.ts +0 -14
  311. package/src/types/InlineStack.ts +0 -19
  312. package/src/types/index.ts +0 -5
  313. package/src/types/shared/Spacing.ts +0 -7
  314. package/src/types/shared/index.ts +0 -1
@@ -0,0 +1,21 @@
1
+ import type {RenderExtension} from '../../extension';
2
+
3
+ import type {AnyComponent} from './shared';
4
+ import type {StandardApi, CartLineDetailsRenderAfterApi} from './api';
5
+
6
+ export interface ExtensionPoints {
7
+ 'Checkout::Dynamic::Render': RenderExtension<
8
+ StandardApi<'Checkout::Dynamic::Render'>,
9
+ AnyComponent
10
+ >;
11
+ 'Checkout::CartLineDetails::RenderAfter': RenderExtension<
12
+ CartLineDetailsRenderAfterApi,
13
+ AnyComponent
14
+ >;
15
+ }
16
+
17
+ export type ExtensionPoint = keyof ExtensionPoints;
18
+
19
+ export type ExtensionForExtensionPoint<
20
+ T extends ExtensionPoint
21
+ > = ExtensionPoints[T];
@@ -0,0 +1,7 @@
1
+ import {createExtensionRegistrationFunction} from '../../utilities/registration';
2
+
3
+ import type {ExtensionPoints} from './extension-points';
4
+
5
+ export * from '../../extension';
6
+
7
+ export const extension = createExtensionRegistrationFunction<ExtensionPoints>();
@@ -0,0 +1,5 @@
1
+ export * from './api';
2
+ export * from './components';
3
+ export * from './extension-points';
4
+ export * from './extension';
5
+ export * from './shared';
@@ -0,0 +1,14 @@
1
+ import type {RemoteComponentType} from '@remote-ui/core';
2
+
3
+ type ComponentTypes = typeof import('./components');
4
+
5
+ export type Components = {
6
+ [K in keyof ComponentTypes]: ComponentTypes[K] extends RemoteComponentType<
7
+ any,
8
+ any
9
+ >
10
+ ? ComponentTypes[K]
11
+ : never;
12
+ };
13
+
14
+ export type AnyComponent = Components[keyof Components];
@@ -0,0 +1,60 @@
1
+ import {createRemoteRoot} from '@remote-ui/core';
2
+ import type {
3
+ RenderExtension,
4
+ RenderExtensionWithRemoteRoot,
5
+ } from '../extension';
6
+
7
+ export interface ExtensionRegistrationFunction<ExtensionPoints> {
8
+ <Point extends keyof ExtensionPoints>(
9
+ _extensionPoint: Point,
10
+ extensionWithRemoteRoot: ExtensionPoints[Point] extends RenderExtension<
11
+ infer Api,
12
+ infer AllowedComponents
13
+ >
14
+ ? RenderExtensionWithRemoteRoot<Api, AllowedComponents>
15
+ : ExtensionPoints[Point],
16
+ ): ExtensionPoints[Point];
17
+ }
18
+
19
+ /**
20
+ * This function takes an extension function that is expecting a `RemoteRoot` as its
21
+ * first argument, and returns a new function that accepts a `RemoteChannel` instead.
22
+ * This is a convenience that allows the raw UI extension API to only expose the simpler
23
+ * `RemoteChannel` type, while allowing the extension to use the more powerful `RemoteRoot`,
24
+ * provided by a version of `@remote-ui/core` that the extension controls.
25
+ */
26
+ export function createExtensionRegistrationFunction<
27
+ ExtensionPoints
28
+ >(): ExtensionRegistrationFunction<ExtensionPoints> {
29
+ const extensionWrapper: ExtensionRegistrationFunction<ExtensionPoints> = (
30
+ _extensionPoint,
31
+ extensionWithRemoteRoot,
32
+ ) => {
33
+ async function extension(...args: any[]) {
34
+ // This handles extensions that do not take a `RemoteChannel` as their first argument.
35
+ // This is true for ”non-rendering” extension points, like `Checkout::PostPurchase::ShouldRender`.
36
+ if (
37
+ args.length === 1 ||
38
+ typeof args[0] !== 'object' ||
39
+ args[0] == null ||
40
+ !('channel' in args[0])
41
+ ) {
42
+ const result = await (extensionWithRemoteRoot as any)(...args);
43
+ return result;
44
+ }
45
+
46
+ const [{channel, components}, ...rest] = args;
47
+
48
+ const root = createRemoteRoot(channel, {components, strict: true});
49
+
50
+ const result = await (extensionWithRemoteRoot as any)(root, ...rest);
51
+ await root.mount();
52
+
53
+ return result;
54
+ }
55
+
56
+ return extension as any;
57
+ };
58
+
59
+ return extensionWrapper;
60
+ }
@@ -1 +0,0 @@
1
- export * from './Spacing';
@@ -1 +0,0 @@
1
- export * from './Spacing';
@@ -1,10 +0,0 @@
1
- export declare type Status = 'critical' | 'info' | 'success' | 'warning';
2
- export interface BaseBannerProps {
3
- /** Callback fired when banner is dismissed. */
4
- onDismiss?: () => void;
5
- /** Visual treatment of the banner based on message purpose. */
6
- status?: Status;
7
- /** Title of the banner. */
8
- title?: string;
9
- }
10
- //# sourceMappingURL=Banner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Banner.d.ts","sourceRoot":"","sources":["../../../src/types/Banner.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjE,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1,14 +0,0 @@
1
- import type { Spacing } from './shared';
2
- export interface BaseBlockStackProps {
3
- /**
4
- * Specifies the inline alignment. This affects the horizontal flow of elements.
5
- * @defaultValue `leading`
6
- */
7
- inlineAlignment?: 'leading' | 'center' | 'trailing';
8
- /**
9
- * Adjusts spacing between children.
10
- * @defaultValue 'base'
11
- **/
12
- spacing?: Spacing;
13
- }
14
- //# sourceMappingURL=BlockStack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockStack.d.ts","sourceRoot":"","sources":["../../../src/types/BlockStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD;;;QAGI;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -1,46 +0,0 @@
1
- export interface BaseButtonProps {
2
- /**
3
- * The type of button that will be rendered.
4
- *
5
- * `primary`: button used for main actions or green-path. Ex: Continue to next step, Discount field
6
- * `secondary`: button used for secondary actions not blocking user progress. Ex: Download Shop app
7
- * `plain`: Renders a button that visually looks like a Link
8
- * @default 'secondary'
9
- */
10
- kind?: 'primary' | 'secondary' | 'plain';
11
- /**
12
- * Specifies the color of the Button. The button will keep the style of the chosen `kind`,
13
- * but replace its color according to the appearance.
14
- *
15
- * `monochrome`: button will inherit the color of its parent
16
- * `critical`: button will take inherit the color of the Critical color group (in Checkout)
17
- * and map to 'destructive' (in Admin/Polaris). Typically used for destructive actions.
18
- *
19
- */
20
- appearance?: 'critical';
21
- /** Changes the size of the button
22
- * @default 'base'
23
- */
24
- size?: 'base' | 'large';
25
- /**
26
- * Whether the button should fill all available inline space.
27
- * */
28
- inlineSize?: 'fill';
29
- /**
30
- * Replaces content with a loading indicator
31
- */
32
- loading?: boolean;
33
- /**
34
- * A label that will be announced to buyers using assistive technologies
35
- */
36
- accessibilityLabel?: string;
37
- /**
38
- * Disables the button, disallowing any interaction
39
- */
40
- disabled?: boolean;
41
- /**
42
- * Callback when pressed
43
- */
44
- onPress?(): void;
45
- }
46
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/types/Button.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IACzC;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;SAEK;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;CAClB"}
@@ -1,14 +0,0 @@
1
- export declare type Level = 1 | 2 | 3;
2
- export interface BaseHeadingProps {
3
- /**
4
- * Unique identifier. Typically used to make the heading a target
5
- * that another component can refer to in order to provide an alternative
6
- * accessibility label.
7
- */
8
- id?: string;
9
- /**
10
- * The visual level of the heading.
11
- */
12
- level?: Level;
13
- }
14
- //# sourceMappingURL=Heading.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../src/types/Heading.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9B,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf"}
@@ -1,19 +0,0 @@
1
- import type { Spacing } from './shared';
2
- export interface BaseInlineStackProps {
3
- /**
4
- * Specifies the block alignment. This affects the vertical flow of elements.
5
- * @defaultValue `leading`
6
- */
7
- blockAlignment?: 'leading' | 'center' | 'trailing' | 'baseline';
8
- /**
9
- * Specifies the inline alignment. This affects the horizontal flow of elements.
10
- * @defaultValue `leading`
11
- */
12
- inlineAlignment?: 'leading' | 'center' | 'trailing';
13
- /**
14
- * Adjust spacing between children.
15
- * @defaultValue 'base'
16
- **/
17
- spacing?: Spacing;
18
- }
19
- //# sourceMappingURL=InlineStack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlineStack.d.ts","sourceRoot":"","sources":["../../../src/types/InlineStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IAChE;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpD;;;QAGI;IACJ,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -1,6 +0,0 @@
1
- export type { BaseBannerProps } from './Banner';
2
- export type { BaseBlockStackProps } from './BlockStack';
3
- export type { BaseButtonProps } from './Button';
4
- export type { BaseHeadingProps } from './Heading';
5
- export type { BaseInlineStackProps } from './InlineStack';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACtD,YAAY,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAChD,YAAY,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare type Spacing = 'none' | 'extraTight' | 'tight' | 'base' | 'loose' | 'extraLoose';
2
- //# sourceMappingURL=Spacing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Spacing.d.ts","sourceRoot":"","sources":["../../../../src/types/shared/Spacing.ts"],"names":[],"mappings":"AAAA,oBAAY,OAAO,GACf,MAAM,GACN,YAAY,GACZ,OAAO,GACP,MAAM,GACN,OAAO,GACP,YAAY,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Spacing';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -1,12 +0,0 @@
1
- export type Status = 'critical' | 'info' | 'success' | 'warning';
2
-
3
- export interface BaseBannerProps {
4
- /** Callback fired when banner is dismissed. */
5
- onDismiss?: () => void;
6
-
7
- /** Visual treatment of the banner based on message purpose. */
8
- status?: Status;
9
-
10
- /** Title of the banner. */
11
- title?: string;
12
- }
@@ -1,14 +0,0 @@
1
- import type {Spacing} from './shared';
2
-
3
- export interface BaseBlockStackProps {
4
- /**
5
- * Specifies the inline alignment. This affects the horizontal flow of elements.
6
- * @defaultValue `leading`
7
- */
8
- inlineAlignment?: 'leading' | 'center' | 'trailing';
9
- /**
10
- * Adjusts spacing between children.
11
- * @defaultValue 'base'
12
- **/
13
- spacing?: Spacing;
14
- }
@@ -1,45 +0,0 @@
1
- export interface BaseButtonProps {
2
- /**
3
- * The type of button that will be rendered.
4
- *
5
- * `primary`: button used for main actions or green-path. Ex: Continue to next step, Discount field
6
- * `secondary`: button used for secondary actions not blocking user progress. Ex: Download Shop app
7
- * `plain`: Renders a button that visually looks like a Link
8
- * @default 'secondary'
9
- */
10
- kind?: 'primary' | 'secondary' | 'plain';
11
- /**
12
- * Specifies the color of the Button. The button will keep the style of the chosen `kind`,
13
- * but replace its color according to the appearance.
14
- *
15
- * `monochrome`: button will inherit the color of its parent
16
- * `critical`: button will take inherit the color of the Critical color group (in Checkout)
17
- * and map to 'destructive' (in Admin/Polaris). Typically used for destructive actions.
18
- *
19
- */
20
- appearance?: 'critical';
21
- /** Changes the size of the button
22
- * @default 'base'
23
- */
24
- size?: 'base' | 'large';
25
- /**
26
- * Whether the button should fill all available inline space.
27
- * */
28
- inlineSize?: 'fill';
29
- /**
30
- * Replaces content with a loading indicator
31
- */
32
- loading?: boolean;
33
- /**
34
- * A label that will be announced to buyers using assistive technologies
35
- */
36
- accessibilityLabel?: string;
37
- /**
38
- * Disables the button, disallowing any interaction
39
- */
40
- disabled?: boolean;
41
- /**
42
- * Callback when pressed
43
- */
44
- onPress?(): void;
45
- }
@@ -1,14 +0,0 @@
1
- export type Level = 1 | 2 | 3;
2
-
3
- export interface BaseHeadingProps {
4
- /**
5
- * Unique identifier. Typically used to make the heading a target
6
- * that another component can refer to in order to provide an alternative
7
- * accessibility label.
8
- */
9
- id?: string;
10
- /**
11
- * The visual level of the heading.
12
- */
13
- level?: Level;
14
- }
@@ -1,19 +0,0 @@
1
- import type {Spacing} from './shared';
2
-
3
- export interface BaseInlineStackProps {
4
- /**
5
- * Specifies the block alignment. This affects the vertical flow of elements.
6
- * @defaultValue `leading`
7
- */
8
- blockAlignment?: 'leading' | 'center' | 'trailing' | 'baseline';
9
- /**
10
- * Specifies the inline alignment. This affects the horizontal flow of elements.
11
- * @defaultValue `leading`
12
- */
13
- inlineAlignment?: 'leading' | 'center' | 'trailing';
14
- /**
15
- * Adjust spacing between children.
16
- * @defaultValue 'base'
17
- **/
18
- spacing?: Spacing;
19
- }
@@ -1,5 +0,0 @@
1
- export type {BaseBannerProps} from './Banner';
2
- export type {BaseBlockStackProps} from './BlockStack';
3
- export type {BaseButtonProps} from './Button';
4
- export type {BaseHeadingProps} from './Heading';
5
- export type {BaseInlineStackProps} from './InlineStack';
@@ -1,7 +0,0 @@
1
- export type Spacing =
2
- | 'none'
3
- | 'extraTight'
4
- | 'tight'
5
- | 'base'
6
- | 'loose'
7
- | 'extraLoose';
@@ -1 +0,0 @@
1
- export * from './Spacing';