@shopify/ui-extensions 2025.10.0-rc.44 → 2025.10.0-rc.45
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/ts/docs/shared/components/ColorField.d.ts.map +1 -1
- package/build/ts/surfaces/admin/api/intents/intents.d.ts +132 -0
- package/build/ts/surfaces/admin/api/intents/intents.d.ts.map +1 -0
- package/build/ts/surfaces/admin/api/intents/intents.doc.d.ts +4 -0
- package/build/ts/surfaces/admin/api/intents/intents.doc.d.ts.map +1 -0
- package/build/ts/surfaces/admin/api/standard/standard.d.ts +2 -7
- package/build/ts/surfaces/admin/api/standard/standard.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/docs/shared/components/ColorField.ts +2 -1
- package/src/surfaces/admin/api/intents/examples/create-article.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-catalog.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-collection.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-customer.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-discount.js +11 -0
- package/src/surfaces/admin/api/intents/examples/create-market.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-menu.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-metafield-definition.js +11 -0
- package/src/surfaces/admin/api/intents/examples/create-metaobject-definition.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-metaobject.js +11 -0
- package/src/surfaces/admin/api/intents/examples/create-page.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-product.js +9 -0
- package/src/surfaces/admin/api/intents/examples/create-variant.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-article.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-catalog.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-collection.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-customer.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-discount.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-market.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-menu.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-metafield-definition.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-metaobject-definition.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-metaobject.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-page.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-product.js +11 -0
- package/src/surfaces/admin/api/intents/examples/edit-variant.js +11 -0
- package/src/surfaces/admin/api/intents/intents.ts +153 -0
- package/src/surfaces/admin/api/standard/standard.ts +2 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorField.d.ts","sourceRoot":"","sources":["../../../../../src/docs/shared/components/ColorField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mCAAmC,EAAC,MAAM,cAAc,CAAC;AAEtE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"ColorField.d.ts","sourceRoot":"","sources":["../../../../../src/docs/shared/components/ColorField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,mCAAmC,EAAC,MAAM,cAAc,CAAC;AAEtE,QAAA,MAAM,IAAI,EAAE,mCAOX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User dismissed or closed the workflow without completing it.
|
|
3
|
+
*/
|
|
4
|
+
export interface ClosedIntentResponse {
|
|
5
|
+
code?: 'closed';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Successful intent completion.
|
|
9
|
+
*/
|
|
10
|
+
export interface SuccessIntentResponse {
|
|
11
|
+
code?: 'ok';
|
|
12
|
+
data?: {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Failed intent completion.
|
|
18
|
+
*/
|
|
19
|
+
export interface ErrorIntentResponse {
|
|
20
|
+
code?: 'error';
|
|
21
|
+
message?: string;
|
|
22
|
+
issues?: {
|
|
23
|
+
/**
|
|
24
|
+
* The path to the field with the issue.
|
|
25
|
+
*/
|
|
26
|
+
path?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* The error message for the issue.
|
|
29
|
+
*/
|
|
30
|
+
message?: string;
|
|
31
|
+
/**
|
|
32
|
+
* A code identifier for the issue.
|
|
33
|
+
*/
|
|
34
|
+
code?: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Result of an intent activity.
|
|
39
|
+
* Discriminated union representing all possible completion outcomes.
|
|
40
|
+
*/
|
|
41
|
+
export type IntentResponse = SuccessIntentResponse | ErrorIntentResponse | ClosedIntentResponse;
|
|
42
|
+
/**
|
|
43
|
+
* Activity handle for tracking intent workflow progress.
|
|
44
|
+
*/
|
|
45
|
+
export interface IntentActivity {
|
|
46
|
+
/**
|
|
47
|
+
* A Promise that resolves when the intent workflow completes, returning the response.
|
|
48
|
+
*/
|
|
49
|
+
complete?: Promise<IntentResponse>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The action to perform on a resource.
|
|
53
|
+
*/
|
|
54
|
+
export type IntentAction = 'create' | 'edit';
|
|
55
|
+
/**
|
|
56
|
+
* Supported resource types that can be targeted by intents.
|
|
57
|
+
*/
|
|
58
|
+
export type IntentType = 'shopify/Article' | 'shopify/Catalog' | 'shopify/Collection' | 'shopify/Customer' | 'shopify/Discount' | 'shopify/Market' | 'shopify/Menu' | 'shopify/MetafieldDefinition' | 'shopify/Metaobject' | 'shopify/MetaobjectDefinition' | 'shopify/Page' | 'shopify/Product' | 'shopify/ProductVariant';
|
|
59
|
+
/**
|
|
60
|
+
* Options for invoking intents when using the query string format.
|
|
61
|
+
*/
|
|
62
|
+
export interface IntentQueryOptions {
|
|
63
|
+
/**
|
|
64
|
+
* The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
|
|
65
|
+
*/
|
|
66
|
+
value?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Additional data required for certain intent types.
|
|
69
|
+
* For example:
|
|
70
|
+
* - Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
|
|
71
|
+
* - ProductVariant creation requires { productId: 'gid://shopify/Product/123' }
|
|
72
|
+
* - Metaobject creation requires { type: 'shopify--color-pattern' }
|
|
73
|
+
*/
|
|
74
|
+
data?: {
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Structured description of an intent to invoke.
|
|
80
|
+
*/
|
|
81
|
+
export interface IntentQuery extends IntentQueryOptions {
|
|
82
|
+
/**
|
|
83
|
+
* The operation to perform on the target resource.
|
|
84
|
+
*/
|
|
85
|
+
action: IntentAction;
|
|
86
|
+
/**
|
|
87
|
+
* The resource type (e.g., 'shopify/Product').
|
|
88
|
+
*/
|
|
89
|
+
type: IntentType;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The invoke API for triggering intent workflows.
|
|
93
|
+
*
|
|
94
|
+
* @param intent - Either a string query or structured object describing the intent
|
|
95
|
+
* @param options - Optional parameters when using string query format
|
|
96
|
+
* @returns A Promise resolving to an activity handle for tracking the workflow
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```javascript
|
|
100
|
+
* // Create a new product
|
|
101
|
+
* const activity = await intents.invoke('create:shopify/Product');
|
|
102
|
+
* const response = await activity.complete;
|
|
103
|
+
*
|
|
104
|
+
* // Edit an existing product
|
|
105
|
+
* const activity = await intents.invoke('edit:shopify/Product,gid://shopify/Product/123');
|
|
106
|
+
* const response = await activity.complete;
|
|
107
|
+
*
|
|
108
|
+
* // Create a discount with required type
|
|
109
|
+
* const activity = await intents.invoke('create:shopify/Discount', {
|
|
110
|
+
* data: { type: 'amount-off-product' }
|
|
111
|
+
* });
|
|
112
|
+
* const response = await activity.complete;
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export interface IntentInvokeApi {
|
|
116
|
+
(query: IntentQuery): Promise<IntentActivity>;
|
|
117
|
+
(intentURL: string, options?: IntentQueryOptions): Promise<IntentActivity>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Intent information provided to the receiver of an intent.
|
|
121
|
+
*/
|
|
122
|
+
export interface Intents {
|
|
123
|
+
/**
|
|
124
|
+
* The URL that was used to launch the intent.
|
|
125
|
+
*/
|
|
126
|
+
launchUrl?: string | URL;
|
|
127
|
+
/**
|
|
128
|
+
* Invoke an intent workflow to create or edit Shopify resources.
|
|
129
|
+
*/
|
|
130
|
+
invoke?: IntentInvokeApi;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=intents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/admin/api/intents/intents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,qBAAq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ot":"","sources":["../../../../../../src/surfaces/admin/api/intents/intents.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA2hBX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -2,12 +2,8 @@ import type { I18n } from '../../../../api';
|
|
|
2
2
|
import { ApiVersion } from '../../../../shared';
|
|
3
3
|
import type { Storage } from './storage';
|
|
4
4
|
import type { ExtensionTarget as AnyExtensionTarget } from '../../extension-targets';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* The URL that was used to launch the intent.
|
|
8
|
-
*/
|
|
9
|
-
launchUrl?: string | URL;
|
|
10
|
-
}
|
|
5
|
+
import type { Intents } from '../intents/intents';
|
|
6
|
+
export type { Intents } from '../intents/intents';
|
|
11
7
|
/**
|
|
12
8
|
* GraphQL error returned by the Shopify Admin API.
|
|
13
9
|
*/
|
|
@@ -64,5 +60,4 @@ export interface StandardApi<ExtensionTarget extends AnyExtensionTarget> {
|
|
|
64
60
|
errors?: GraphQLError[];
|
|
65
61
|
}>;
|
|
66
62
|
}
|
|
67
|
-
export {};
|
|
68
63
|
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/admin/api/standard/standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,eAAe,IAAI,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../../../../../src/surfaces/admin/api/standard/standard.ts"],"names":[],"mappings":"AAAA,OAAO,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