Skip to content

Commit c41336e

Browse files
authored
Merge pull request #2862 from Shopify/merge-apis-from-unstable
Merge apis from unstable
2 parents 50e763d + 416bf62 commit c41336e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+961
-58
lines changed

.changeset/famous-parents-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Defaulting to string type for enabled features passed to the templates

.changeset/lemon-dots-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Add Picker

.changeset/slimy-knives-decide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': minor
3+
---
4+
5+
Add discount function settings api

.changeset/sweet-toes-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': patch
3+
---
4+
5+
Sync picker and resourcePicker docs with app-bridge
188 KB
Loading
188 KB
Loading
102 KB
Loading
58.4 KB
Loading

packages/ui-extensions/docs/surfaces/admin/staticPages/admin-extensions.doc.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ const data: LandingTemplateSchema = {
4343
url: '/docs/api/admin-extensions/api/network-features',
4444
type: 'globe',
4545
},
46+
{
47+
subtitle: 'Using Forms',
48+
name: 'Use the Form component to integrate with the contextual save bar of the resource page',
49+
url: '#using-forms',
50+
type: 'tool',
51+
},
52+
{
53+
subtitle: 'Picking resources',
54+
name: 'Prompt the user to select resources',
55+
url: '#picking-resources',
56+
type: 'tool',
57+
},
4658
],
4759
},
4860
{
@@ -120,6 +132,47 @@ const data: LandingTemplateSchema = {
120132
],
121133
},
122134
},
135+
{
136+
type: 'GenericAccordion',
137+
title: 'Picking Resources',
138+
sectionContent:
139+
"Use the Resource Picker and Picker API's to allow users to select resources for your extension to use.",
140+
anchorLink: 'picking-resources',
141+
accordionContent: [
142+
{
143+
title: 'Resource Picker',
144+
description:
145+
'Use the `resourcePicker` API to display a search-based interface to help users find and select one or more products, collections, or product variants, and then return the selected resources to your extension. Both the app and the user must have the necessary permissions to access the resources selected.',
146+
image: 'resource-picker.png',
147+
codeblock: {
148+
title: 'resourcePicker',
149+
tabs: [
150+
{
151+
title: 'Selecting a product',
152+
language: 'tsx',
153+
code: './examples/resource-picker-product.jsx',
154+
},
155+
],
156+
},
157+
},
158+
{
159+
title: 'Picker',
160+
description:
161+
'Use the `picker` API to display a search-based interface to help users find and select one or more custom data types that you provide, such as product reviews, email templates, or subscription options.',
162+
image: 'picker.png',
163+
codeblock: {
164+
title: 'picker',
165+
tabs: [
166+
{
167+
title: 'Selecting an email template',
168+
language: 'tsx',
169+
code: './examples/picker-email-template.jsx',
170+
},
171+
],
172+
},
173+
},
174+
],
175+
},
123176
{
124177
type: 'Generic',
125178
title: 'Deploying',
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { render } from 'preact';
2+
3+
export default function extension() {
4+
render(<Extension />, document.body);
5+
}
6+
7+
function Extension() {
8+
const { picker } = shopify;
9+
10+
const handleSelectEmailTemplate = async () => {
11+
const pickerInstance = await picker({
12+
heading: 'Select a template',
13+
multiple: false,
14+
headers: [
15+
{ content: 'Templates' },
16+
{ content: 'Created by' },
17+
{ content: 'Times used', type: 'number' },
18+
],
19+
items: [
20+
{
21+
id: '1',
22+
heading: 'Full width, 1 column',
23+
data: ['Karine Ruby', '0'],
24+
badges: [{ content: 'Draft', tone: 'info' }, { content: 'Marketing' }],
25+
},
26+
{
27+
id: '2',
28+
heading: 'Large graphic, 3 column',
29+
data: ['Charlie Mitchell', '5'],
30+
badges: [
31+
{ content: 'Published', tone: 'success' },
32+
{ content: 'New feature' },
33+
],
34+
selected: true,
35+
},
36+
{
37+
id: '3',
38+
heading: 'Promo header, 2 column',
39+
data: ['Russell Winfield', '10'],
40+
badges: [{ content: 'Published', tone: 'success' }],
41+
},
42+
],
43+
});
44+
45+
const selected = await pickerInstance.selected;
46+
console.log(selected);
47+
};
48+
49+
return (
50+
<s-button onClick={handleSelectEmailTemplate}>Select email template</s-button>
51+
);
52+
}

0 commit comments

Comments
 (0)