@shopify/ui-extensions 2023.4.0 → 2023.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/surfaces/admin/components/Pressable/Pressable.js +9 -0
- package/build/cjs/surfaces/admin.js +2 -0
- package/build/esm/surfaces/admin/components/Pressable/Pressable.mjs +5 -0
- package/build/esm/surfaces/admin.mjs +1 -0
- package/build/esnext/surfaces/admin/components/Pressable/Pressable.esnext +5 -0
- package/build/esnext/surfaces/admin.esnext +1 -0
- package/build/ts/api.d.ts +12 -0
- package/build/ts/api.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/action/action.d.ts +3 -3
- package/build/ts/surfaces/admin/api/action/action.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/action/action.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.d.ts +2 -2
- package/build/ts/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/extension-targets/extension-targets.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/standard/standard.d.ts +16 -6
- package/build/ts/surfaces/admin/api/standard/standard.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/standard/standard.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.d.ts +0 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminAction/AdminAction.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.d.ts +0 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/AdminBlock/AdminBlock.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.d.ts +13 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/BlockStack/BlockStack.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Box/Box.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Button/Button.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Checkbox/Checkbox.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Divider/Divider.d.ts +3 -2
- package/build/ts/surfaces/admin/components/Divider/Divider.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Divider/Divider.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/EmailField/EmailField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Form/Form.d.ts +3 -3
- package/build/ts/surfaces/admin/components/Form/Form.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Form/Form.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Heading/Heading.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/HeadingGroup/HeadingGroup.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.d.ts +3 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/Icon.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Icon/IconName.d.ts +2 -0
- package/build/ts/surfaces/admin/components/Icon/IconName.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Image/Image.d.ts +3 -2
- package/build/ts/surfaces/admin/components/Image/Image.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Image/Image.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.d.ts +13 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/InlineStack/InlineStack.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Link/Link.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/NumberField/NumberField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/PasswordField/PasswordField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Pressable/Pressable.d.ts +10 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.doc.d.ts +4 -0
- package/build/ts/surfaces/admin/components/Pressable/Pressable.doc.d.ts.map +1 -0
- package/build/ts/surfaces/admin/components/Select/Select.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.d.ts +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/Text/Text.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/TextArea/TextArea.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/TextField/TextField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/URLField/URLField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components/shared/index.d.ts +4 -4
- package/build/ts/surfaces/admin/components/shared/index.d.ts.map +1 -1
- package/build/ts/surfaces/admin/components.d.ts +2 -0
- package/build/ts/surfaces/admin/components.d.ts.map +1 -1
- package/build/ts/surfaces/admin/{extension-points.d.ts → extension-targets.d.ts} +62 -20
- package/build/ts/surfaces/admin/extension-targets.d.ts.map +1 -0
- package/build/ts/surfaces/admin/extension.d.ts +3 -3
- package/build/ts/surfaces/admin/extension.d.ts.map +1 -1
- package/build/ts/surfaces/admin/globals.d.ts +2 -2
- package/build/ts/surfaces/admin/globals.d.ts.map +1 -1
- package/build/ts/surfaces/admin.d.ts +1 -1
- package/build/ts/surfaces/admin.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/checkout/checkout.d.ts +45 -5
- package/build/ts/surfaces/checkout/api/checkout/checkout.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/shipping/shipping-method-details.d.ts +1 -1
- package/build/ts/surfaces/checkout/api/shipping/shipping-method-details.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api/standard/standard.d.ts +5 -3
- package/build/ts/surfaces/checkout/api/standard/standard.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/api.d.ts +1 -1
- package/build/ts/surfaces/checkout/api.d.ts.map +1 -1
- package/build/ts/surfaces/checkout/extension-points.d.ts +12 -0
- package/build/ts/surfaces/checkout/extension-points.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/api.ts +14 -0
- package/src/surfaces/admin/api/action/action.doc.ts +1 -0
- package/src/surfaces/admin/api/action/action.ts +4 -4
- package/src/surfaces/admin/api/customer-segmentation-template/customer-segmentation-template.ts +3 -3
- package/src/surfaces/admin/api/extension-targets/extension-targets.doc.ts +3 -2
- package/src/surfaces/admin/api/standard/standard.doc.ts +1 -0
- package/src/surfaces/admin/api/standard/standard.ts +21 -6
- package/src/surfaces/admin/components/AdminAction/AdminAction.doc.ts +10 -3
- package/src/surfaces/admin/components/AdminAction/AdminAction.ts +0 -2
- package/src/surfaces/admin/components/AdminAction/examples/basic-adminaction.example.ts +12 -6
- package/src/surfaces/admin/components/AdminBlock/AdminBlock.doc.ts +10 -3
- package/src/surfaces/admin/components/AdminBlock/AdminBlock.ts +0 -2
- package/src/surfaces/admin/components/BlockStack/BlockStack.doc.ts +8 -1
- package/src/surfaces/admin/components/BlockStack/BlockStack.ts +16 -0
- package/src/surfaces/admin/components/BlockStack/examples/basic-blockstack.example.ts +1 -1
- package/src/surfaces/admin/components/Box/Box.doc.ts +1 -0
- package/src/surfaces/admin/components/Box/examples/basic-box.example.ts +1 -1
- package/src/surfaces/admin/components/Button/Button.doc.ts +13 -1
- package/src/surfaces/admin/components/Checkbox/Checkbox.doc.ts +8 -1
- package/src/surfaces/admin/components/Divider/Divider.doc.ts +2 -1
- package/src/surfaces/admin/components/Divider/Divider.ts +3 -2
- package/src/surfaces/admin/components/Divider/examples/basic-divider.example.ts +2 -2
- package/src/surfaces/admin/components/EmailField/EmailField.doc.ts +14 -3
- package/src/surfaces/admin/components/Form/Form.doc.ts +23 -1
- package/src/surfaces/admin/components/Form/Form.ts +3 -3
- package/src/surfaces/admin/components/Form/examples/basic-form.example.ts +8 -6
- package/src/surfaces/admin/components/Heading/Heading.doc.ts +14 -2
- package/src/surfaces/admin/components/HeadingGroup/HeadingGroup.doc.ts +9 -2
- package/src/surfaces/admin/components/HeadingGroup/examples/basic-headinggroup.example.ts +1 -1
- package/src/surfaces/admin/components/Icon/Icon.doc.ts +35 -3
- package/src/surfaces/admin/components/Icon/Icon.ts +3 -1
- package/src/surfaces/admin/components/Icon/IconName.ts +567 -0
- package/src/surfaces/admin/components/Image/Image.doc.ts +9 -2
- package/src/surfaces/admin/components/Image/Image.ts +38 -35
- package/src/surfaces/admin/components/Image/examples/basic-image.example.ts +2 -2
- package/src/surfaces/admin/components/InlineStack/InlineStack.doc.ts +8 -1
- package/src/surfaces/admin/components/InlineStack/InlineStack.ts +16 -0
- package/src/surfaces/admin/components/InlineStack/examples/basic-inlinestack.example.ts +1 -1
- package/src/surfaces/admin/components/Link/Link.doc.ts +15 -8
- package/src/surfaces/admin/components/NumberField/NumberField.doc.ts +9 -2
- package/src/surfaces/admin/components/PasswordField/PasswordField.doc.ts +14 -2
- package/src/surfaces/admin/components/PasswordField/examples/basic-passwordfield.example.ts +10 -9
- package/src/surfaces/admin/components/Pressable/Pressable.doc.ts +49 -0
- package/src/surfaces/admin/components/Pressable/Pressable.ts +9 -0
- package/src/surfaces/admin/components/Pressable/examples/basic-pressable.example.ts +25 -0
- package/src/surfaces/admin/components/Select/Select.doc.ts +9 -2
- package/src/surfaces/admin/components/Text/Text.doc.ts +9 -2
- package/src/surfaces/admin/components/Text/Text.ts +1 -3
- package/src/surfaces/admin/components/Text/examples/basic-text.example.ts +3 -7
- package/src/surfaces/admin/components/TextArea/TextArea.doc.ts +9 -2
- package/src/surfaces/admin/components/TextField/TextField.doc.ts +19 -2
- package/src/surfaces/admin/components/URLField/URLField.doc.ts +9 -3
- package/src/surfaces/admin/components/shared/index.ts +4 -4
- package/src/surfaces/admin/components.ts +2 -0
- package/src/surfaces/admin/{extension-points.ts → extension-targets.ts} +75 -22
- package/src/surfaces/admin/extension.ts +3 -2
- package/src/surfaces/admin/globals.ts +4 -4
- package/src/surfaces/admin.ts +1 -1
- package/src/surfaces/checkout/api/checkout/checkout.ts +57 -5
- package/src/surfaces/checkout/api/shipping/shipping-method-details.ts +1 -1
- package/src/surfaces/checkout/api/standard/README.md +3 -3
- package/src/surfaces/checkout/api/standard/standard.ts +13 -3
- package/src/surfaces/checkout/api.ts +2 -0
- package/src/surfaces/checkout/extension-points.ts +12 -0
- package/src/surfaces/checkout/style/examples/style.example.tsx +1 -1
- package/build/ts/surfaces/admin/extension-points.d.ts.map +0 -1
|
@@ -12,107 +12,160 @@ type CustomerSegmentationTemplateComponent = AnyComponentBuilder<
|
|
|
12
12
|
Pick<Components, 'CustomerSegmentationTemplate'>
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface ExtensionTargets {
|
|
16
|
+
/**
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
16
19
|
Playground: RenderExtension<StandardApi<'Playground'>, AnyComponent>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
17
24
|
'admin.customers.segmentation-templates.render': RenderExtension<
|
|
18
25
|
CustomerSegmentationTemplateApi<'admin.customers.segmentation-templates.render'>,
|
|
19
26
|
CustomerSegmentationTemplateComponent
|
|
20
27
|
>;
|
|
21
28
|
|
|
22
29
|
// Blocks
|
|
30
|
+
/**
|
|
31
|
+
* Renders an Admin Block in the product details page.
|
|
32
|
+
*/
|
|
23
33
|
'admin.product-details.block.render': RenderExtension<
|
|
24
34
|
StandardApi<'admin.product-details.block.render'>,
|
|
25
35
|
AnyComponent
|
|
26
36
|
>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Renders an Admin Block in the order details page.
|
|
40
|
+
*/
|
|
27
41
|
'admin.order-details.block.render': RenderExtension<
|
|
28
42
|
StandardApi<'admin.order-details.block.render'>,
|
|
29
43
|
AnyComponent
|
|
30
44
|
>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Renders an Admin Block in the customer details page.
|
|
48
|
+
*/
|
|
31
49
|
'admin.customer-details.block.render': RenderExtension<
|
|
32
50
|
StandardApi<'admin.customer-details.block.render'>,
|
|
33
51
|
AnyComponent
|
|
34
52
|
>;
|
|
35
53
|
|
|
36
54
|
// Actions
|
|
55
|
+
/**
|
|
56
|
+
* Renders an Admin Action in the product details page. Open this extension from the "More Actions" menu.
|
|
57
|
+
*/
|
|
37
58
|
'admin.product-details.action.render': RenderExtension<
|
|
38
59
|
ActionExtensionApi<'admin.product-details.action.render'>,
|
|
39
60
|
AnyComponent
|
|
40
61
|
>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Renders an Admin Action in the order details page. Open this extension from the "More Actions" menu.
|
|
65
|
+
*/
|
|
41
66
|
'admin.order-details.action.render': RenderExtension<
|
|
42
67
|
ActionExtensionApi<'admin.order-details.action.render'>,
|
|
43
68
|
AnyComponent
|
|
44
69
|
>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Renders an Admin Action in the customer details page. Open this extension from the "More Actions" menu.
|
|
73
|
+
*/
|
|
45
74
|
'admin.customer-details.action.render': RenderExtension<
|
|
46
75
|
ActionExtensionApi<'admin.customer-details.action.render'>,
|
|
47
76
|
AnyComponent
|
|
48
77
|
>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Renders an Admin Action in the product index page. Open this extension from the "More Actions" menu.
|
|
81
|
+
*/
|
|
49
82
|
'admin.product-index.action.render': RenderExtension<
|
|
50
83
|
ActionExtensionApi<'admin.product-index.action.render'>,
|
|
51
84
|
AnyComponent
|
|
52
85
|
>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Renders an Admin Action in the order index page. Open this extension from the "More Actions" menu.
|
|
89
|
+
*/
|
|
53
90
|
'admin.order-index.action.render': RenderExtension<
|
|
54
91
|
ActionExtensionApi<'admin.order-index.action.render'>,
|
|
55
92
|
AnyComponent
|
|
56
93
|
>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Renders an Admin Action in the customer index page. Open this extension from the "More Actions" menu.
|
|
97
|
+
*/
|
|
57
98
|
'admin.customer-index.action.render': RenderExtension<
|
|
58
99
|
ActionExtensionApi<'admin.customer-index.action.render'>,
|
|
59
100
|
AnyComponent
|
|
60
101
|
>;
|
|
61
102
|
|
|
62
103
|
// Bulk Actions
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Renders an Admin Action in the product index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime.
|
|
107
|
+
*/
|
|
63
108
|
'admin.product-index.selection-action.render': RenderExtension<
|
|
64
109
|
ActionExtensionApi<'admin.product-index.selection-action.render'>,
|
|
65
110
|
AnyComponent
|
|
66
111
|
>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Renders an Admin Action in the order index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime.
|
|
115
|
+
*/
|
|
67
116
|
'admin.order-index.selection-action.render': RenderExtension<
|
|
68
117
|
ActionExtensionApi<'admin.order-index.selection-action.render'>,
|
|
69
118
|
AnyComponent
|
|
70
119
|
>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Renders an Admin Action in the customer index page when multiple resources are selected. Open this extension from the "More Actions" menu of the resource list. The resource ids are available to this extension at runtime.
|
|
123
|
+
*/
|
|
71
124
|
'admin.customer-index.selection-action.render': RenderExtension<
|
|
72
125
|
ActionExtensionApi<'admin.customer-index.selection-action.render'>,
|
|
73
126
|
AnyComponent
|
|
74
127
|
>;
|
|
75
128
|
}
|
|
76
129
|
|
|
77
|
-
export type
|
|
130
|
+
export type ExtensionTarget = keyof ExtensionTargets;
|
|
78
131
|
|
|
79
|
-
export type
|
|
80
|
-
|
|
132
|
+
export type ExtensionForExtensionTarget<T extends ExtensionTarget> =
|
|
133
|
+
ExtensionTargets[T];
|
|
81
134
|
|
|
82
135
|
/**
|
|
83
|
-
* For a given extension
|
|
84
|
-
* returned by that extension
|
|
136
|
+
* For a given extension target, returns the value that is expected to be
|
|
137
|
+
* returned by that extension target’s callback type.
|
|
85
138
|
*/
|
|
86
|
-
export type ReturnTypeForExtension<ID extends keyof
|
|
87
|
-
ReturnType<
|
|
139
|
+
export type ReturnTypeForExtension<ID extends keyof ExtensionTargets> =
|
|
140
|
+
ReturnType<ExtensionTargets[ID]>;
|
|
88
141
|
|
|
89
142
|
/**
|
|
90
|
-
* For a given extension
|
|
91
|
-
* be provided to that extension
|
|
143
|
+
* For a given extension target, returns the tuple of arguments that would
|
|
144
|
+
* be provided to that extension target’s callback type.
|
|
92
145
|
*/
|
|
93
|
-
export type ArgumentsForExtension<ID extends keyof
|
|
94
|
-
Parameters<
|
|
146
|
+
export type ArgumentsForExtension<ID extends keyof ExtensionTargets> =
|
|
147
|
+
Parameters<ExtensionTargets[ID]>;
|
|
95
148
|
|
|
96
149
|
/**
|
|
97
|
-
* A union type containing all of the extension
|
|
150
|
+
* A union type containing all of the extension targets that follow the pattern of
|
|
98
151
|
* accepting a [`@remote-ui/core` `RemoteRoot`](https://github.com/Shopify/remote-ui/tree/main/packages/core)
|
|
99
152
|
* and an additional `api` argument, and using those arguments to render
|
|
100
153
|
* UI.
|
|
101
154
|
*/
|
|
102
|
-
export type
|
|
103
|
-
[ID in keyof
|
|
155
|
+
export type RenderExtensionTarget = {
|
|
156
|
+
[ID in keyof ExtensionTargets]: ExtensionTargets[ID] extends RenderExtension<
|
|
104
157
|
any,
|
|
105
158
|
any
|
|
106
159
|
>
|
|
107
160
|
? ID
|
|
108
161
|
: never;
|
|
109
|
-
}[keyof
|
|
162
|
+
}[keyof ExtensionTargets];
|
|
110
163
|
|
|
111
164
|
/**
|
|
112
165
|
* A mapping of each “render extension” name to its callback type.
|
|
113
166
|
*/
|
|
114
167
|
export type RenderExtensions = {
|
|
115
|
-
[ID in
|
|
168
|
+
[ID in RenderExtensionTarget]: ExtensionTargets[ID];
|
|
116
169
|
};
|
|
117
170
|
|
|
118
171
|
type ExtractedApiFromRenderExtension<T> = T extends RenderExtension<
|
|
@@ -126,17 +179,17 @@ type ExtractedAllowedComponentsFromRenderExtension<T> =
|
|
|
126
179
|
T extends RenderExtension<any, infer Components> ? Components : never;
|
|
127
180
|
|
|
128
181
|
/**
|
|
129
|
-
* For a given rendering extension
|
|
182
|
+
* For a given rendering extension target, returns the type of the API that the
|
|
130
183
|
* extension will receive at runtime. This API type is the second argument to
|
|
131
|
-
* the callback for that extension
|
|
132
|
-
* extension
|
|
184
|
+
* the callback for that extension target. The first callback for all of the rendering
|
|
185
|
+
* extension targets each receive a `RemoteRoot` object.
|
|
133
186
|
*/
|
|
134
187
|
export type ApiForRenderExtension<ID extends keyof RenderExtensions> =
|
|
135
188
|
ExtractedApiFromRenderExtension<RenderExtensions[ID]>;
|
|
136
189
|
|
|
137
190
|
/**
|
|
138
|
-
* For a given rendering extension
|
|
139
|
-
* extension
|
|
191
|
+
* For a given rendering extension target, returns the UI components that the
|
|
192
|
+
* extension target supports.
|
|
140
193
|
*/
|
|
141
194
|
export type AllowedComponentsForRenderExtension<
|
|
142
195
|
ID extends keyof RenderExtensions,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {createExtensionRegistrationFunction} from '../../utilities/registration';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {ExtensionTargets} from './extension-targets';
|
|
4
4
|
|
|
5
5
|
export * from '../../extension';
|
|
6
6
|
|
|
7
|
-
export const extension =
|
|
7
|
+
export const extension =
|
|
8
|
+
createExtensionRegistrationFunction<ExtensionTargets>();
|
|
8
9
|
export const extend = extension;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {ExtensionTargets} from './extension-targets';
|
|
2
2
|
|
|
3
3
|
export interface ShopifyGlobal {
|
|
4
|
-
extend<
|
|
5
|
-
|
|
6
|
-
extend:
|
|
4
|
+
extend<ExtensionTarget extends keyof ExtensionTargets>(
|
|
5
|
+
extension: ExtensionTarget,
|
|
6
|
+
extend: ExtensionTargets[ExtensionTarget],
|
|
7
7
|
): void;
|
|
8
8
|
}
|
package/src/surfaces/admin.ts
CHANGED
|
@@ -339,6 +339,24 @@ export interface MetafieldRemoveChange {
|
|
|
339
339
|
namespace: string;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
/** Removes a cart metafield. */
|
|
343
|
+
export interface MetafieldRemoveCartChange {
|
|
344
|
+
/**
|
|
345
|
+
* The type of the `MetafieldRemoveChange` API.
|
|
346
|
+
*/
|
|
347
|
+
type: 'removeCartMetafield';
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* The name of the metafield to remove.
|
|
351
|
+
*/
|
|
352
|
+
key: string;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* The namespace of the metafield to remove.
|
|
356
|
+
*/
|
|
357
|
+
namespace: string;
|
|
358
|
+
}
|
|
359
|
+
|
|
342
360
|
/**
|
|
343
361
|
* Updates a metafield. If a metafield with the
|
|
344
362
|
* provided key and namespace does not already exist, it gets created.
|
|
@@ -364,7 +382,39 @@ export interface MetafieldUpdateChange {
|
|
|
364
382
|
valueType: 'integer' | 'string' | 'json_string';
|
|
365
383
|
}
|
|
366
384
|
|
|
367
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Updates a cart metafield. If a metafield with the
|
|
387
|
+
* provided key and namespace does not already exist, it gets created.
|
|
388
|
+
*/
|
|
389
|
+
export interface MetafieldUpdateCartChange {
|
|
390
|
+
/**
|
|
391
|
+
* The type of the `MetafieldUpdateChange` API.
|
|
392
|
+
*/
|
|
393
|
+
type: 'updateCartMetafield';
|
|
394
|
+
|
|
395
|
+
metafield: {
|
|
396
|
+
/** The name of the metafield to update. */
|
|
397
|
+
key: string;
|
|
398
|
+
|
|
399
|
+
/** The namespace of the metafield to add. */
|
|
400
|
+
namespace: string;
|
|
401
|
+
|
|
402
|
+
/** The new information to store in the metafield. */
|
|
403
|
+
value: string;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* The metafield’s information type.
|
|
407
|
+
* See the [`metafields documentation`](https://shopify.dev/docs/apps/custom-data/metafields/types) for a list of supported types.
|
|
408
|
+
*/
|
|
409
|
+
type: string;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export type MetafieldChange =
|
|
414
|
+
| MetafieldRemoveChange
|
|
415
|
+
| MetafieldUpdateChange
|
|
416
|
+
| MetafieldRemoveCartChange
|
|
417
|
+
| MetafieldUpdateCartChange;
|
|
368
418
|
|
|
369
419
|
export interface MetafieldChangeResultSuccess {
|
|
370
420
|
/**
|
|
@@ -397,7 +447,7 @@ export interface CheckoutApi {
|
|
|
397
447
|
* successful, this mutation results in an update to the value retrieved
|
|
398
448
|
* through the [`attributes`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi#properties-propertydetail-applyattributechange) property.
|
|
399
449
|
*
|
|
400
|
-
* > Note: This
|
|
450
|
+
* > Note: This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
|
|
401
451
|
*/
|
|
402
452
|
applyAttributeChange(change: AttributeChange): Promise<AttributeChangeResult>;
|
|
403
453
|
|
|
@@ -408,7 +458,7 @@ export interface CheckoutApi {
|
|
|
408
458
|
* [`lines`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi#properties-propertydetail-lines)
|
|
409
459
|
* property.
|
|
410
460
|
*
|
|
411
|
-
* > Note: This
|
|
461
|
+
* > Note: This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
|
|
412
462
|
*/
|
|
413
463
|
applyCartLinesChange(change: CartLineChange): Promise<CartLineChangeResult>;
|
|
414
464
|
|
|
@@ -419,6 +469,8 @@ export interface CheckoutApi {
|
|
|
419
469
|
*
|
|
420
470
|
* > Caution:
|
|
421
471
|
* > See [security considerations](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access) if your extension retrieves discount codes through a network call.
|
|
472
|
+
*
|
|
473
|
+
* > Note: This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
|
|
422
474
|
*/
|
|
423
475
|
applyDiscountCodeChange(
|
|
424
476
|
change: DiscountCodeChange,
|
|
@@ -432,7 +484,7 @@ export interface CheckoutApi {
|
|
|
432
484
|
* > Caution:
|
|
433
485
|
* > See [security considerations](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access) if your extension retrieves gift card codes through a network call.
|
|
434
486
|
*
|
|
435
|
-
* > Note: This
|
|
487
|
+
* > Note: This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
|
|
436
488
|
*/
|
|
437
489
|
applyGiftCardChange(change: GiftCardChange): Promise<GiftCardChangeResult>;
|
|
438
490
|
|
|
@@ -448,7 +500,7 @@ export interface CheckoutApi {
|
|
|
448
500
|
* successful, this mutation results in an update to the value retrieved
|
|
449
501
|
* through the [`note`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi#properties-propertydetail-note) property.
|
|
450
502
|
*
|
|
451
|
-
* > Note: This
|
|
503
|
+
* > Note: This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay.
|
|
452
504
|
*/
|
|
453
505
|
applyNoteChange(change: NoteChange): Promise<NoteChangeResult>;
|
|
454
506
|
}
|
|
@@ -6,7 +6,7 @@ export interface ShippingMethodDetailsApi {
|
|
|
6
6
|
/**
|
|
7
7
|
* The shipping option the extension is attached to.
|
|
8
8
|
*/
|
|
9
|
-
target: StatefulRemoteSubscribable<ShippingOption>;
|
|
9
|
+
target: StatefulRemoteSubscribable<ShippingOption | undefined>;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Whether the shipping option the extension is attached to is currently selected in the UI.
|
|
@@ -15,7 +15,7 @@ The UI extension renderer version being used for the extension. Currently, there
|
|
|
15
15
|
The extension point that was run. This can be useful if you register a single function to handle more than one extension point:
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import {extend} from '@shopify/
|
|
18
|
+
import {extend} from '@shopify/ui-extensions/checkout';
|
|
19
19
|
|
|
20
20
|
extend('FirstExtensionPoint', handleExtensionPoint);
|
|
21
21
|
extend('SecondExtensionPoint', handleExtensionPoint);
|
|
@@ -39,7 +39,7 @@ function handleExtensionPoint(input) {
|
|
|
39
39
|
The `lineItems` property gives you access to the merchandise the buyer is purchasing through checkout. Like other resources in checkout, this value is wrapped in a `StatefulRemoteSubscribable` in order to give your extension a way to subscribe to changes to the line items. These changes can happen when there are stock problems that require the buyer to change the contents of their cart, or when other extensions change the line items through the `applyLineItemChange()` APIs documented below.
|
|
40
40
|
|
|
41
41
|
```ts
|
|
42
|
-
import {extend} from '@shopify/
|
|
42
|
+
import {extend} from '@shopify/ui-extensions/checkout';
|
|
43
43
|
|
|
44
44
|
extend('ExtensionPoint', (root, {lineItems}) => {
|
|
45
45
|
const text = root.createText(
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
Link,
|
|
65
65
|
Modal,
|
|
66
66
|
TextBlock,
|
|
67
|
-
} from '@shopify/
|
|
67
|
+
} from '@shopify/ui-extensions/checkout';
|
|
68
68
|
|
|
69
69
|
extend('ExtensionPoint', (root, {ui}) => {
|
|
70
70
|
const modalFragment = root.createFragment();
|
|
@@ -72,7 +72,7 @@ export interface Extension {
|
|
|
72
72
|
/**
|
|
73
73
|
* The API version that was set in the extension config file.
|
|
74
74
|
*
|
|
75
|
-
* @example '2023-
|
|
75
|
+
* @example '2023-04'
|
|
76
76
|
*/
|
|
77
77
|
apiVersion: ApiVersion;
|
|
78
78
|
|
|
@@ -162,6 +162,9 @@ export interface AppMetafield {
|
|
|
162
162
|
|
|
163
163
|
/** The metafield’s information type. */
|
|
164
164
|
valueType: 'boolean' | 'float' | 'integer' | 'json_string' | 'string';
|
|
165
|
+
|
|
166
|
+
/** The metafield's type name. */
|
|
167
|
+
type: string;
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
/**
|
|
@@ -173,7 +176,14 @@ export interface AppMetafieldEntryTarget {
|
|
|
173
176
|
*
|
|
174
177
|
* {% include /apps/checkout/privacy-icon.md %} Requires access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data) when the type is `customer`.
|
|
175
178
|
*/
|
|
176
|
-
type:
|
|
179
|
+
type:
|
|
180
|
+
| 'customer'
|
|
181
|
+
| 'product'
|
|
182
|
+
| 'shop'
|
|
183
|
+
| 'variant'
|
|
184
|
+
| 'company'
|
|
185
|
+
| 'companyLocation'
|
|
186
|
+
| 'cart';
|
|
177
187
|
|
|
178
188
|
/** The numeric owner ID that is associated with the metafield. */
|
|
179
189
|
id: string;
|
|
@@ -194,7 +204,7 @@ export interface AppMetafieldEntry {
|
|
|
194
204
|
metafield: AppMetafield;
|
|
195
205
|
}
|
|
196
206
|
|
|
197
|
-
export type ApiVersion = '
|
|
207
|
+
export type ApiVersion = '2023-04' | 'unstable';
|
|
198
208
|
|
|
199
209
|
export type Version = string;
|
|
200
210
|
|
|
@@ -234,6 +234,8 @@ export interface ExtensionPoints {
|
|
|
234
234
|
AllComponents
|
|
235
235
|
>;
|
|
236
236
|
/**
|
|
237
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
238
|
+
*
|
|
237
239
|
* A static extension point that is rendered before pickup location options.
|
|
238
240
|
*/
|
|
239
241
|
'Checkout::PickupLocations::RenderBefore': RenderExtension<
|
|
@@ -243,6 +245,8 @@ export interface ExtensionPoints {
|
|
|
243
245
|
AllComponents
|
|
244
246
|
>;
|
|
245
247
|
/**
|
|
248
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
249
|
+
*
|
|
246
250
|
* A static extension point that is rendered after pickup location options.
|
|
247
251
|
*/
|
|
248
252
|
'Checkout::PickupLocations::RenderAfter': RenderExtension<
|
|
@@ -252,6 +256,8 @@ export interface ExtensionPoints {
|
|
|
252
256
|
AllComponents
|
|
253
257
|
>;
|
|
254
258
|
/**
|
|
259
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
260
|
+
*
|
|
255
261
|
* A static extension point that is rendered after the shipping method
|
|
256
262
|
* details within the shipping method option list, for each option.
|
|
257
263
|
*/
|
|
@@ -262,6 +268,8 @@ export interface ExtensionPoints {
|
|
|
262
268
|
AllComponents
|
|
263
269
|
>;
|
|
264
270
|
/**
|
|
271
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
272
|
+
*
|
|
265
273
|
* A static extension point that is rendered under the shipping method
|
|
266
274
|
* within the shipping method option list, for each option.
|
|
267
275
|
*/
|
|
@@ -272,6 +280,8 @@ export interface ExtensionPoints {
|
|
|
272
280
|
AllComponents
|
|
273
281
|
>;
|
|
274
282
|
/**
|
|
283
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
284
|
+
*
|
|
275
285
|
* A static extension point that is rendered immediately before the pickup points.
|
|
276
286
|
*/
|
|
277
287
|
'Checkout::PickupPoints::RenderBefore': RenderExtension<
|
|
@@ -281,6 +291,8 @@ export interface ExtensionPoints {
|
|
|
281
291
|
AllComponents
|
|
282
292
|
>;
|
|
283
293
|
/**
|
|
294
|
+
* > Caution: This feature is in developer preview and is subject to change.
|
|
295
|
+
*
|
|
284
296
|
* A static extension point that is rendered immediately after the pickup points.
|
|
285
297
|
*/
|
|
286
298
|
'Checkout::PickupPoints::RenderAfter': RenderExtension<
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension-points.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/admin/extension-points.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC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