Skip to content

Commit 7e8cc96

Browse files
committed
Add more pos ui extension doc examples
1 parent 56ffb6c commit 7e8cc96

File tree

15 files changed

+308
-3
lines changed

15 files changed

+308
-3
lines changed

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/draft-order-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ The Draft Order API provides an extension with data about the current draft orde
3636
'id',
3737
),
3838
},
39+
{
40+
codeblock: generateJsxCodeBlockForDraftOrderApi(
41+
'Access draft order details including name and customer ID',
42+
'draft-order-details',
43+
),
44+
},
3945
],
4046
},
4147
category: 'APIs',

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/order-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ The Order API provides an extension with data about the current order.
3838
'id',
3939
),
4040
},
41+
{
42+
codeblock: generateJsxCodeBlockForOrderApi(
43+
'Access order details including name and customer ID',
44+
'order-details',
45+
),
46+
},
4147
],
4248
},
4349
};

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/pinpad-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ const data: ReferenceEntityTemplateSchema = {
2828
'validation',
2929
),
3030
},
31+
{
32+
codeblock: generateJsxCodeBlockForToastApi(
33+
'Use PinPad with options and handle dismissal callback',
34+
'validation-with-options',
35+
),
36+
},
3137
],
3238
},
3339
};

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/product-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ The Product API provides an extension with data about the current Product.
3333
'id',
3434
),
3535
},
36+
{
37+
codeblock: generateJsxCodeBlockForProductApi(
38+
'Access both product ID and variant ID',
39+
'product-variant',
40+
),
41+
},
3642
],
3743
},
3844
category: 'APIs',

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/scanner-api.doc.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ The Scanner API enables an extension to access scanner data and available scanni
3434
examples: [
3535
{
3636
codeblock: generateCodeBlockForScannerApi(
37-
'Conditional scanner source rendering example',
37+
'Conditional rendering based on available scanner sources',
3838
'conditional-scanner-example',
3939
),
4040
},
41+
{
42+
codeblock: generateCodeBlockForScannerApi(
43+
'Subscribe to scanner data events and track scan history',
44+
'scanner-data-subscribe',
45+
),
46+
},
4147
],
4248
},
4349
};

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/session-api.doc.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,16 @@ const data: ReferenceEntityTemplateSchema = {
2424
examples: [
2525
{
2626
codeblock: generateJsxCodeBlockForSessionApi(
27-
'Retrieve the current session data',
27+
'Get a session token for backend communication',
2828
'token',
2929
),
3030
},
31+
{
32+
codeblock: generateJsxCodeBlockForSessionApi(
33+
'Access current session properties',
34+
'current-session',
35+
),
36+
},
3137
],
3238
},
3339
};

packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/toast-api.doc.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ const data: ReferenceEntityTemplateSchema = {
2727
'show',
2828
),
2929
},
30+
{
31+
codeblock: generateJsxCodeBlockForToastApi(
32+
'Display toasts with custom duration',
33+
'show-with-duration',
34+
),
35+
},
3036
],
3137
},
3238
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {render} from 'preact';
2+
3+
export default async () => {
4+
render(<Extension />, document.body);
5+
};
6+
7+
const Extension = () => {
8+
const {id, name, customerId} = shopify.draftOrder;
9+
10+
return (
11+
<s-page heading="Draft Order Details">
12+
<s-scroll-box>
13+
<s-stack direction="block">
14+
<s-text>Draft Order ID: {id}</s-text>
15+
<s-text>Draft Order Name: {name}</s-text>
16+
{customerId ? (
17+
<s-text>Customer ID: {customerId}</s-text>
18+
) : (
19+
<s-text>No customer associated with this draft order</s-text>
20+
)}
21+
</s-stack>
22+
</s-scroll-box>
23+
</s-page>
24+
);
25+
};
26+
27+
28+

packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/navigation-api/native-screen.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render } from "preact";
1+
import {render} from 'preact';
22

33
export default async () => {
44
render(<Extension />, document.body);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import {render} from 'preact';
2+
3+
export default async () => {
4+
render(<Extension />, document.body);
5+
};
6+
7+
const Extension = () => {
8+
const {id, name, customerId} = shopify.order;
9+
10+
return (
11+
<s-page heading="Order Details">
12+
<s-scroll-box>
13+
<s-stack direction="block">
14+
<s-text>Order ID: {id}</s-text>
15+
<s-text>Order Name: {name}</s-text>
16+
{customerId ? (
17+
<s-text>Customer ID: {customerId}</s-text>
18+
) : (
19+
<s-text>No customer associated with this order</s-text>
20+
)}
21+
</s-stack>
22+
</s-scroll-box>
23+
</s-page>
24+
);
25+
};
26+
27+
28+

0 commit comments

Comments
 (0)