@shopify/ui-extensions 2025.10.0-rc.44 → 2025.10.0-rc.46
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/ts/surfaces/point-of-sale/components/ChoiceList/ChoiceList.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/ChoiceList.d.ts +3 -1
- package/build/ts/surfaces/point-of-sale/components/DateField/DateField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DateField.d.ts +7 -9
- package/build/ts/surfaces/point-of-sale/components/DatePicker/DatePicker.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DatePicker.d.ts +6 -2
- package/build/ts/surfaces/point-of-sale/components/DateSpinner/DateSpinner.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/DateSpinner.d.ts +10 -2
- package/build/ts/surfaces/point-of-sale/components/Divider/Divider.doc.d.ts +4 -0
- package/build/ts/surfaces/point-of-sale/components/Divider/Divider.doc.d.ts.map +1 -0
- package/build/ts/surfaces/point-of-sale/components/EmailField/EmailField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/EmailField.d.ts +9 -2
- package/build/ts/surfaces/point-of-sale/components/NumberField/NumberField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/NumberField.d.ts +19 -20
- package/build/ts/surfaces/point-of-sale/components/SearchField/SearchField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/SearchField.d.ts +6 -2
- package/build/ts/surfaces/point-of-sale/components/TextArea/TextArea.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TextArea.d.ts +9 -2
- package/build/ts/surfaces/point-of-sale/components/TextField/TextField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TextField.d.ts +17 -2
- package/build/ts/surfaces/point-of-sale/components/TimeField/TimeField.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TimeField.d.ts +8 -4
- package/build/ts/surfaces/point-of-sale/components/TimePicker/TimePicker.doc.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/components/TimePicker.d.ts +6 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -3
- 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
- package/src/surfaces/point-of-sale/components/Banner/examples/default.html +8 -8
- package/src/surfaces/point-of-sale/components/Box/examples/default.html +2 -2
- package/src/surfaces/point-of-sale/components/Button/examples/default.html +2 -4
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/default.html +5 -4
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/ChoiceList/examples/multiple-selection.jsx +9 -0
- package/src/surfaces/point-of-sale/components/ChoiceList.d.ts +3 -1
- package/src/surfaces/point-of-sale/components/Clickable/examples/default.html +5 -2
- package/src/surfaces/point-of-sale/components/DateField/examples/default.html +2 -10
- package/src/surfaces/point-of-sale/components/DateField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/DateField.d.ts +7 -9
- package/src/surfaces/point-of-sale/components/DatePicker/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/DatePicker/examples/default.html +4 -5
- package/src/surfaces/point-of-sale/components/DatePicker/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/DatePicker.d.ts +6 -2
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/default.html +1 -2
- package/src/surfaces/point-of-sale/components/DateSpinner/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/DateSpinner.d.ts +10 -2
- package/src/surfaces/point-of-sale/components/Divider/examples/default.html +1 -0
- package/src/surfaces/point-of-sale/components/EmailField/examples/accessory-slot.jsx +9 -0
- package/src/surfaces/point-of-sale/components/EmailField/examples/default.html +3 -10
- package/src/surfaces/point-of-sale/components/EmailField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/EmailField.d.ts +9 -2
- package/src/surfaces/point-of-sale/components/Heading/examples/default.html +4 -5
- package/src/surfaces/point-of-sale/components/Icon/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/Image/examples/default.html +1 -1
- package/src/surfaces/point-of-sale/components/Modal/examples/default.html +6 -8
- package/src/surfaces/point-of-sale/components/NumberField/examples/controls-constraints.jsx +9 -0
- package/src/surfaces/point-of-sale/components/NumberField/examples/default.html +5 -2
- package/src/surfaces/point-of-sale/components/NumberField/examples/input-mode.jsx +15 -0
- package/src/surfaces/point-of-sale/components/NumberField.d.ts +19 -20
- package/src/surfaces/point-of-sale/components/Page/examples/default.html +3 -4
- package/src/surfaces/point-of-sale/components/PosBlock/examples/default.html +3 -9
- package/src/surfaces/point-of-sale/components/ScrollBox/examples/default.html +5 -4
- package/src/surfaces/point-of-sale/components/SearchField/examples/default.html +1 -1
- package/src/surfaces/point-of-sale/components/SearchField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/SearchField.d.ts +6 -2
- package/src/surfaces/point-of-sale/components/Section/examples/default.html +6 -8
- package/src/surfaces/point-of-sale/components/Stack/examples/default.html +3 -3
- package/src/surfaces/point-of-sale/components/Text/examples/default.html +3 -6
- package/src/surfaces/point-of-sale/components/TextArea/examples/accessory-slot.jsx +9 -0
- package/src/surfaces/point-of-sale/components/TextArea/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/TextArea/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/TextArea/examples/rows-configuration.jsx +7 -0
- package/src/surfaces/point-of-sale/components/TextArea.d.ts +9 -2
- package/src/surfaces/point-of-sale/components/TextField/examples/accessory-slot.jsx +5 -0
- package/src/surfaces/point-of-sale/components/TextField/examples/common-props.jsx +11 -0
- package/src/surfaces/point-of-sale/components/TextField/examples/default.html +5 -3
- package/src/surfaces/point-of-sale/components/TextField/examples/event-handling.jsx +17 -0
- package/src/surfaces/point-of-sale/components/TextField.d.ts +17 -2
- package/src/surfaces/point-of-sale/components/Tile/examples/default.html +2 -5
- package/src/surfaces/point-of-sale/components/TimeField/examples/default.html +1 -9
- package/src/surfaces/point-of-sale/components/TimeField/examples/event-handling.jsx +8 -0
- package/src/surfaces/point-of-sale/components/TimeField.d.ts +8 -4
- package/src/surfaces/point-of-sale/components/TimePicker/examples/command-system.jsx +10 -0
- package/src/surfaces/point-of-sale/components/TimePicker/examples/default.html +4 -1
- package/src/surfaces/point-of-sale/components/TimePicker/examples/event-handling.jsx +7 -0
- package/src/surfaces/point-of-sale/components/TimePicker.d.ts +6 -2
- package/src/surfaces/point-of-sale/components.d.ts +169 -72
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/ui-extensions",
|
|
3
|
-
"version": "2025.10.0-rc.
|
|
3
|
+
"version": "2025.10.0-rc.46",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"docs:admin": "node ./docs/surfaces/admin/build-docs.mjs",
|
|
6
6
|
"docs:checkout": "bash ./docs/surfaces/checkout/build-docs.sh",
|
|
@@ -129,12 +129,22 @@
|
|
|
129
129
|
"@remote-ui/async-subscription": "^2.1.16",
|
|
130
130
|
"@shopify/generate-docs": "0.19.6",
|
|
131
131
|
"typescript": "^4.9.0",
|
|
132
|
-
"@faker-js/faker": "^8.4.1"
|
|
132
|
+
"@faker-js/faker": "^8.4.1",
|
|
133
|
+
"preact": "^10.10.x",
|
|
134
|
+
"@preact/signals": "^2.3.x"
|
|
133
135
|
},
|
|
134
|
-
"
|
|
136
|
+
"peerDependencies": {
|
|
135
137
|
"preact": "*",
|
|
136
138
|
"@preact/signals": "*"
|
|
137
139
|
},
|
|
140
|
+
"peerDependenciesMeta": {
|
|
141
|
+
"preact": {
|
|
142
|
+
"optional": true
|
|
143
|
+
},
|
|
144
|
+
"@preact/signals": {
|
|
145
|
+
"optional": true
|
|
146
|
+
}
|
|
147
|
+
},
|
|
138
148
|
"publishConfig": {
|
|
139
149
|
"access": "public",
|
|
140
150
|
"@shopify:registry": "https://registry.npmjs.org/"
|
|
@@ -2,7 +2,8 @@ import type {SharedReferenceEntityTemplateSchema} from '../docs-type';
|
|
|
2
2
|
|
|
3
3
|
const data: SharedReferenceEntityTemplateSchema = {
|
|
4
4
|
name: 'ColorField',
|
|
5
|
-
description:
|
|
5
|
+
description:
|
|
6
|
+
'Allow users to select a color with a color picker or as a text input.',
|
|
6
7
|
category: 'Polaris web components',
|
|
7
8
|
subCategory: 'Forms',
|
|
8
9
|
related: [],
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('create:shopify/Discount', {
|
|
4
|
+
data: {type: 'amount-off-product'},
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Discount created:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('create:shopify/MetafieldDefinition', {
|
|
4
|
+
data: {ownerType: 'product'},
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Metafield definition created:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('create:shopify/Metaobject', {
|
|
4
|
+
data: {type: 'shopify--color-pattern'},
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Metaobject created:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('create:shopify/ProductVariant', {
|
|
4
|
+
data: {productId: 'gid://shopify/Product/123456789'},
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Product variant created:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Article', {
|
|
4
|
+
value: 'gid://shopify/Article/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Article updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Catalog', {
|
|
4
|
+
value: 'gid://shopify/Catalog/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Catalog updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Collection', {
|
|
4
|
+
value: 'gid://shopify/Collection/987654321',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Collection updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Customer', {
|
|
4
|
+
value: 'gid://shopify/Customer/456789123',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Customer updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Discount', {
|
|
4
|
+
value: 'gid://shopify/Discount/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Discount updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Market', {
|
|
4
|
+
value: 'gid://shopify/Market/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Market updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Menu', {
|
|
4
|
+
value: 'gid://shopify/Menu/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Menu updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/MetafieldDefinition', {
|
|
4
|
+
value: 'gid://shopify/MetafieldDefinition/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Metafield definition updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/MetaobjectDefinition', {
|
|
4
|
+
value: 'gid://shopify/MetaobjectDefinition/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Metaobject definition updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Metaobject', {
|
|
4
|
+
value: 'gid://shopify/Metaobject/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Metaobject updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Page', {
|
|
4
|
+
value: 'gid://shopify/Page/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Page updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/Product', {
|
|
4
|
+
value: 'gid://shopify/Product/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Product updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {intents} = useApi(TARGET);
|
|
2
|
+
|
|
3
|
+
const activity = await intents.invoke('edit:shopify/ProductVariant', {
|
|
4
|
+
value: 'gid://shopify/ProductVariant/123456789',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const response = await activity.complete;
|
|
8
|
+
|
|
9
|
+
if (response.code === 'ok') {
|
|
10
|
+
console.log('Product variant updated:', response.data);
|
|
11
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User dismissed or closed the workflow without completing it.
|
|
3
|
+
*/
|
|
4
|
+
export interface ClosedIntentResponse {
|
|
5
|
+
code?: 'closed';
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Successful intent completion.
|
|
10
|
+
*/
|
|
11
|
+
export interface SuccessIntentResponse {
|
|
12
|
+
code?: 'ok';
|
|
13
|
+
data?: {[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
|
+
/**
|
|
39
|
+
* Result of an intent activity.
|
|
40
|
+
* Discriminated union representing all possible completion outcomes.
|
|
41
|
+
*/
|
|
42
|
+
export type IntentResponse =
|
|
43
|
+
| SuccessIntentResponse
|
|
44
|
+
| ErrorIntentResponse
|
|
45
|
+
| ClosedIntentResponse;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Activity handle for tracking intent workflow progress.
|
|
49
|
+
*/
|
|
50
|
+
export interface IntentActivity {
|
|
51
|
+
/**
|
|
52
|
+
* A Promise that resolves when the intent workflow completes, returning the response.
|
|
53
|
+
*/
|
|
54
|
+
complete?: Promise<IntentResponse>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The action to perform on a resource.
|
|
59
|
+
*/
|
|
60
|
+
export type IntentAction = 'create' | 'edit';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Supported resource types that can be targeted by intents.
|
|
64
|
+
*/
|
|
65
|
+
export type IntentType =
|
|
66
|
+
| 'shopify/Article'
|
|
67
|
+
| 'shopify/Catalog'
|
|
68
|
+
| 'shopify/Collection'
|
|
69
|
+
| 'shopify/Customer'
|
|
70
|
+
| 'shopify/Discount'
|
|
71
|
+
| 'shopify/Market'
|
|
72
|
+
| 'shopify/Menu'
|
|
73
|
+
| 'shopify/MetafieldDefinition'
|
|
74
|
+
| 'shopify/Metaobject'
|
|
75
|
+
| 'shopify/MetaobjectDefinition'
|
|
76
|
+
| 'shopify/Page'
|
|
77
|
+
| 'shopify/Product'
|
|
78
|
+
| 'shopify/ProductVariant';
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Options for invoking intents when using the query string format.
|
|
82
|
+
*/
|
|
83
|
+
export interface IntentQueryOptions {
|
|
84
|
+
/**
|
|
85
|
+
* The resource identifier for edit actions (e.g., 'gid://shopify/Product/123').
|
|
86
|
+
*/
|
|
87
|
+
value?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Additional data required for certain intent types.
|
|
90
|
+
* For example:
|
|
91
|
+
* - Discount creation requires { type: 'amount-off-product' | 'amount-off-order' | 'buy-x-get-y' | 'free-shipping' }
|
|
92
|
+
* - ProductVariant creation requires { productId: 'gid://shopify/Product/123' }
|
|
93
|
+
* - Metaobject creation requires { type: 'shopify--color-pattern' }
|
|
94
|
+
*/
|
|
95
|
+
data?: {[key: string]: unknown};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Structured description of an intent to invoke.
|
|
100
|
+
*/
|
|
101
|
+
export interface IntentQuery extends IntentQueryOptions {
|
|
102
|
+
/**
|
|
103
|
+
* The operation to perform on the target resource.
|
|
104
|
+
*/
|
|
105
|
+
action: IntentAction;
|
|
106
|
+
/**
|
|
107
|
+
* The resource type (e.g., 'shopify/Product').
|
|
108
|
+
*/
|
|
109
|
+
type: IntentType;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The invoke API for triggering intent workflows.
|
|
114
|
+
*
|
|
115
|
+
* @param intent - Either a string query or structured object describing the intent
|
|
116
|
+
* @param options - Optional parameters when using string query format
|
|
117
|
+
* @returns A Promise resolving to an activity handle for tracking the workflow
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```javascript
|
|
121
|
+
* // Create a new product
|
|
122
|
+
* const activity = await intents.invoke('create:shopify/Product');
|
|
123
|
+
* const response = await activity.complete;
|
|
124
|
+
*
|
|
125
|
+
* // Edit an existing product
|
|
126
|
+
* const activity = await intents.invoke('edit:shopify/Product,gid://shopify/Product/123');
|
|
127
|
+
* const response = await activity.complete;
|
|
128
|
+
*
|
|
129
|
+
* // Create a discount with required type
|
|
130
|
+
* const activity = await intents.invoke('create:shopify/Discount', {
|
|
131
|
+
* data: { type: 'amount-off-product' }
|
|
132
|
+
* });
|
|
133
|
+
* const response = await activity.complete;
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export interface IntentInvokeApi {
|
|
137
|
+
(query: IntentQuery): Promise<IntentActivity>;
|
|
138
|
+
(intentURL: string, options?: IntentQueryOptions): Promise<IntentActivity>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Intent information provided to the receiver of an intent.
|
|
143
|
+
*/
|
|
144
|
+
export interface Intents {
|
|
145
|
+
/**
|
|
146
|
+
* The URL that was used to launch the intent.
|
|
147
|
+
*/
|
|
148
|
+
launchUrl?: string | URL;
|
|
149
|
+
/**
|
|
150
|
+
* Invoke an intent workflow to create or edit Shopify resources.
|
|
151
|
+
*/
|
|
152
|
+
invoke?: IntentInvokeApi;
|
|
153
|
+
}
|
|
@@ -2,13 +2,9 @@ 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
|
+
import type {Intents} from '../intents/intents';
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
-
/**
|
|
8
|
-
* The URL that was used to launch the intent.
|
|
9
|
-
*/
|
|
10
|
-
launchUrl?: string | URL;
|
|
11
|
-
}
|
|
7
|
+
export type {Intents} from '../intents/intents';
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* GraphQL error returned by the Shopify Admin API.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<s-banner heading="
|
|
2
|
-
<s-button slot="primary-action">
|
|
1
|
+
<s-banner heading="Marked as delivered" tone="success">
|
|
2
|
+
<s-button slot="primary-action">Dismiss</s-button>
|
|
3
3
|
</s-banner>
|
|
4
4
|
|
|
5
|
-
<s-banner heading="
|
|
6
|
-
<s-button slot="primary-action">
|
|
5
|
+
<s-banner heading="Ready for shipping" tone="info">
|
|
6
|
+
<s-button slot="primary-action">Dismiss</s-button>
|
|
7
7
|
</s-banner>
|
|
8
8
|
|
|
9
|
-
<s-banner heading="
|
|
10
|
-
<s-button slot="primary-action">
|
|
9
|
+
<s-banner heading="Couldn't restock items" tone="warning">
|
|
10
|
+
<s-button slot="primary-action">Dismiss</s-button>
|
|
11
11
|
</s-banner>
|
|
12
12
|
|
|
13
|
-
<s-banner heading="
|
|
14
|
-
<s-button slot="primary-action">
|
|
13
|
+
<s-banner heading="Action failed. Contact developer" tone="critical">
|
|
14
|
+
<s-button slot="primary-action">Dismiss</s-button>
|
|
15
15
|
</s-banner>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<s-box>
|
|
2
|
-
<s-text>
|
|
1
|
+
<s-box padding="base">
|
|
2
|
+
<s-text>View shipping settings</s-text>
|
|
3
3
|
</s-box>
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
<s-button variant="primary">
|
|
2
|
-
<s-button variant="secondary">
|
|
3
|
-
<s-button tone="critical">Label</s-button>
|
|
4
|
-
<s-button disabled>Label</s-button>
|
|
1
|
+
<s-button variant="primary">Add customer</s-button>
|
|
2
|
+
<s-button variant="secondary">Select more items</s-button>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<s-choice-list>
|
|
2
|
-
<s-choice value="
|
|
3
|
-
<s-choice value="
|
|
4
|
-
<s-choice value="
|
|
5
|
-
</s-choice
|
|
2
|
+
<s-choice value="s" selected>Small</s-choice>
|
|
3
|
+
<s-choice value="m">Medium</s-choice>
|
|
4
|
+
<s-choice value="l">Large</s-choice>
|
|
5
|
+
<s-choice value="xl">Extra large</s-choice>
|
|
6
|
+
</s-choice-list>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<s-choice-list
|
|
2
|
+
onChange={(event) => console.log('onChange:', event.target.values)}
|
|
3
|
+
onInput={(event) => console.log('onInput:', event.target.values)}
|
|
4
|
+
>
|
|
5
|
+
<s-choice value="option1">Option 1</s-choice>
|
|
6
|
+
<s-choice value="option2" disabled>Option 2 (disabled)</s-choice>
|
|
7
|
+
<s-choice value="option3">Option 3</s-choice>
|
|
8
|
+
</s-choice-list>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<s-choice-list
|
|
2
|
+
multiple
|
|
3
|
+
values={['small', 'medium']}
|
|
4
|
+
onChange={(event) => console.log('Selected:', event.target.values)}
|
|
5
|
+
>
|
|
6
|
+
<s-choice value="small">Small</s-choice>
|
|
7
|
+
<s-choice value="medium">Medium</s-choice>
|
|
8
|
+
<s-choice value="large">Large</s-choice>
|
|
9
|
+
</s-choice-list>
|
|
@@ -39,8 +39,10 @@ export interface CallbackEvent<T extends keyof HTMLElementTagNameMap> {
|
|
|
39
39
|
declare const tagName = 's-choice-list';
|
|
40
40
|
export interface ChoiceListJSXProps
|
|
41
41
|
extends Pick<ChoiceListProps, 'values' | 'multiple'> {
|
|
42
|
-
|
|
42
|
+
/** Function called when the user changes a choice. Fires simultaneously with onChange. */
|
|
43
43
|
onInput?: ((event: CallbackEvent<typeof tagName>) => void) | null;
|
|
44
|
+
/** Function called when the user changes a choice. Fires simultaneously with onInput. */
|
|
45
|
+
onChange?: ((event: CallbackEvent<typeof tagName>) => void) | null;
|
|
44
46
|
children?: ComponentChildren;
|
|
45
47
|
}
|
|
46
48
|
declare global {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<s-date-field
|
|
2
|
+
label="Order date"
|
|
3
|
+
value="2024-10-26"
|
|
4
|
+
onInput={(event) => console.log('Input:', event.target.value)}
|
|
5
|
+
onChange={(event) => console.log('Change:', event.target.value)}
|
|
6
|
+
onFocus={(event) => console.log('Focused with:', event.target.value)}
|
|
7
|
+
onBlur={(event) => console.log('Blurred with:', event.target.value)}
|
|
8
|
+
/>
|