Skip to content

Commit 633746e

Browse files
authored
Merge pull request #3563 from Shopify/pos-ui-extensions-2025-07-api-prop-descriptions
[POS UI extensions]: Improved target, API, component descriptions for 2025-07
2 parents 768a556 + 84ec95d commit 633746e

File tree

176 files changed

+3772
-2168
lines changed

Some content is hidden

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

176 files changed

+3772
-2168
lines changed

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

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,58 @@ const generateCodeBlockForActionApi = (title: string, fileName: string) =>
77

88
const data: ReferenceEntityTemplateSchema = {
99
name: 'Action API',
10-
description: `
11-
The Action API allows an action extension to modally present its corresponding modal target.
12-
13-
#### Supporting targets
14-
- ${TargetLink.PosHomeTileRender}
15-
- ${TargetLink.PosPurchasePostActionMenuItemRender}
16-
- ${TargetLink.PosPurchasePostBlockRender}
17-
- ${TargetLink.PosReturnPostActionMenuItemRender}
18-
- ${TargetLink.PosReturnPostBlockRender}
19-
- ${TargetLink.PosExchangePostActionMenuItemRender}
20-
- ${TargetLink.PosExchangePostBlockRender}
21-
- ${TargetLink.PosOrderDetailsActionMenuItemRender}
22-
- ${TargetLink.PosOrderDetailsBlockRender}
23-
- ${TargetLink.PosProductDetailsActionMenuItemRender}
24-
- ${TargetLink.PosCustomerDetailsActionMenuItemRender}
25-
- ${TargetLink.PosCustomerDetailsBlockRender}
26-
- ${TargetLink.PosDraftOrderDetailsActionMenuItemRender}
27-
- ${TargetLink.PosDraftOrderDetailsBlockRender}
28-
`,
10+
description:
11+
'The Action API provides modal presentation functionality for POS UI extensions, allowing you to launch full-screen modal interfaces from menu items, tiles, and block targets. The API enables navigation between different targets within your extension.',
2912
isVisualComponent: false,
3013
type: 'APIs',
3114
definitions: [
3215
{
3316
title: 'ActionApi',
34-
description: '',
17+
description:
18+
'The `ActionApi` object provides methods for presenting modal interfaces. Access these methods through `api.action` to launch full-screen modal experiences.',
3519
type: 'ActionApiContent',
3620
},
3721
],
38-
category: 'APIs',
22+
category: 'Target APIs',
23+
subCategory: 'Standard APIs',
3924
related: [],
4025
examples: {
41-
description: 'Examples of using the Action API.',
26+
description:
27+
'Learn how to present full-screen modals from tiles and menu items using the Action API.',
4228
examples: [
4329
{
4430
codeblock: generateCodeBlockForActionApi(
45-
'Present a modal from post purchase.',
31+
'Open a modal from a post-purchase action',
4632
'present-modal',
4733
),
34+
description:
35+
"Create an action menu item that appears after a purchase is completed. When pressed, it launches a full-screen modal view using the Action API's `presentModal()` method, allowing you to display custom workflows or additional functionality in the post-purchase flow.",
4836
},
4937
{
5038
codeblock: generateCodeBlockForActionApi(
51-
'Present a modal from smart grid.',
39+
'Open a modal from a smart grid tile',
5240
'present-modal-tile',
5341
),
42+
description:
43+
"Create a smart grid tile on the POS home screen that launches a full-screen modal when tapped. This example shows how to use the Action API to present detailed views or workflows from your app's home tile, providing quick access to extended functionality.",
5444
},
5545
],
5646
},
47+
48+
subSections: [
49+
{
50+
type: 'Generic',
51+
anchorLink: 'best-practices',
52+
title: 'Best practices',
53+
sectionContent: `\n- **Provide clear entry points:** Use descriptive button labels and titles that clearly indicate what the modal will contain or what action it will perform, helping users understand what to expect.\n- **Handle modal dismissal gracefully:** Ensure your modal-based workflows handle user dismissal, saving progress when possible and providing clear feedback about incomplete operations.\n`,
54+
},
55+
{
56+
type: 'Generic',
57+
anchorLink: 'limitations',
58+
title: 'Limitations',
59+
sectionContent: `\nEach extension can only present one modal at a time. Subsequent calls to \`presentModal()\` while a modal is already open may be ignored or replace the current modal.\n`,
60+
},
61+
],
5762
};
5863

5964
export default data;

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

Lines changed: 118 additions & 68 deletions
Large diffs are not rendered by default.

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

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,48 @@ const generateCodeBlockForCartLineItemApi = (title: string, fileName: string) =>
77

88
const data: ReferenceEntityTemplateSchema = {
99
name: 'Cart Line Item API',
10-
description: `
11-
The Cart Line Item API provides an extension with data about the current Cart Line Item.
12-
13-
#### Supporting targets
14-
- ${TargetLink.PosCartLineItemDetailsActionMenuItemRender}
15-
- ${TargetLink.PosCartLineItemDetailsActionRender}
16-
`,
10+
description:
11+
'The Cart Line Item API provides read-only access to a specific line item in the cart. Use this API to get line item details like product information, pricing, discounts, and custom properties. This allows you to build features that respond to the specific item a customer is viewing or interacting with.',
1712
isVisualComponent: false,
1813
type: 'APIs',
1914
definitions: [
2015
{
2116
title: 'CartLineItemApi',
22-
description: '',
17+
description:
18+
'The `CartLineItemApi` object provides access to line item data. Access this through `api.lineItem` to retrieve information about the specific cart line item in context.',
2319
type: 'CartLineItemApi',
2420
},
2521
],
2622
examples: {
27-
description: 'Examples of using the Cart Line Item API.',
23+
description:
24+
'Learn how to access line item information and build contextual experiences based on specific cart items.',
2825
examples: [
2926
{
3027
codeblock: generateCodeBlockForCartLineItemApi(
31-
'Retrieve the ID of the cart line item.',
28+
'Get the current line item ID',
3229
'id',
3330
),
31+
description:
32+
"Retrieve the unique identifier of the cart line item currently associated with the extension's context. This example shows how to access the line item ID from line item detail screens, enabling you to fetch additional item data, implement custom actions, or track item-specific operations.",
3433
},
3534
],
3635
},
37-
category: 'APIs',
38-
related: [
36+
category: 'Target APIs',
37+
subCategory: 'Contextual APIs',
38+
related: [],
39+
40+
subSections: [
3941
{
40-
name: ExtensionTargetType.PosCartLineItemDetailsActionMenuItemRender,
41-
url: '/docs/api/pos-ui-extensions/targets/pos-cart-line-item-details-action-menu-item-render',
42+
type: 'Generic',
43+
anchorLink: 'best-practices',
44+
title: 'Best practices',
45+
sectionContent: `\n- **Use line item context effectively:** Use the line item data to create contextual experiences—for example, showing different interfaces for gift cards versus regular products, or displaying vendor-specific information.\n- **Implement item-specific validation:** Use line item properties like \`taxable\` and \`isGiftCard\` to implement appropriate validation and business logic for different item types.\n- **Access related data efficiently:** Use \`productId\` and \`variantId\` to fetch additional product information when needed, but avoid unnecessary API calls by using the data already available in the line item.\n`,
4246
},
4347
{
44-
name: ExtensionTargetType.PosCartLineItemDetailsActionRender,
45-
url: '/docs/api/pos-ui-extensions/targets/pos-cart-line-item-details-action-render',
48+
type: 'Generic',
49+
anchorLink: 'limitations',
50+
title: 'Limitations',
51+
sectionContent: `\n- The API provides read-only access to line item data—use the Cart API for modifying line item properties, discounts, or other attributes.\n- Line item data reflects the current state and may not include real-time inventory or pricing updates until the cart is refreshed.\n`,
4652
},
4753
],
4854
};

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

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,49 @@ const generateCodeBlockForConnectivityApi = (title: string, fileName: string) =>
77
const data: ReferenceEntityTemplateSchema = {
88
name: 'Connectivity API',
99
description:
10-
'The Connectivity API enables POS UI extensions to retrieve device connectivity information, such as whether the device has an internet connection.',
10+
'The Connectivity API provides access to device connectivity information, allowing you to monitor Internet connection status and respond to connectivity changes in real-time. The API enables both immediate connectivity checks and dynamic updates when network conditions change.',
1111
isVisualComponent: false,
1212
type: 'APIs',
1313
definitions: [
1414
{
1515
title: 'ConnectivityApi',
16-
description: '',
16+
description:
17+
'The `ConnectivityApi` object provides methods for monitoring network connectivity. Access these methods through `api.connectivity` to check connection status and subscribe to connectivity changes.',
1718
type: 'ConnectivityApiContent',
1819
},
1920
],
20-
category: 'APIs',
21+
category: 'Target APIs',
22+
subCategory: 'Platform APIs',
2123
related: [],
2224
examples: {
23-
description: 'Examples of using the Connectivity API',
25+
description:
26+
'Learn how to monitor internet connectivity status and respond to network changes in your extension.',
2427
examples: [
2528
{
2629
codeblock: generateCodeBlockForConnectivityApi(
27-
'Subscribe to connectivity changes.',
30+
'Monitor network connectivity changes',
2831
'subscribable',
2932
),
33+
description:
34+
'Subscribe to connectivity state changes to respond when the device goes online or offline. This example demonstrates using the connectivity subscription to track network status and display the current connection state, allowing your extension to adapt behavior based on network availability.',
3035
},
3136
],
3237
},
38+
39+
subSections: [
40+
{
41+
type: 'Generic',
42+
anchorLink: 'best-practices',
43+
title: 'Best practices',
44+
sectionContent: `\n- **Design for connectivity awareness:** Design your extension to handle network interruptions, informing users when network-dependent features are unavailable and providing clear guidance on next steps.\n- **Provide clear connectivity feedback:** Display connectivity status to users when it affects functionality, helping them understand why certain features may be limited or unavailable.\n- **Queue operations during outages:** Implement queuing mechanisms for non-critical operations that can be deferred until connectivity is restored.\n`,
45+
},
46+
{
47+
type: 'Generic',
48+
anchorLink: 'limitations',
49+
title: 'Limitations',
50+
sectionContent: `\n- The Connectivity API provides read-only access to connectivity information and can't be used to control or modify network settings on the device.\n- \`RemoteSubscribable\` supports only one subscription at a time. Use \`makeStatefulSubscribable\` if you need multiple components to subscribe to connectivity changes simultaneously.\n- Connectivity status reflects Internet connectivity only and may not indicate the quality or speed of the connection, which could affect API performance.\n- The API monitors general Internet connectivity but doesn't provide specific information about Shopify service availability or API endpoint availability.\n`,
51+
},
52+
],
3353
};
3454

3555
export default data;

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

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,48 @@ const generateCodeBlockForCustomerApi = (title: string, fileName: string) =>
77

88
const data: ReferenceEntityTemplateSchema = {
99
name: 'Customer API',
10-
description: `
11-
The customer API provides an extension with data about the current customer.
12-
13-
#### Supporting targets
14-
- ${TargetLink.PosCustomerDetailsActionMenuItemRender}
15-
- ${TargetLink.PosCustomerDetailsActionRender}
16-
- ${TargetLink.PosCustomerDetailsBlockRender}
17-
`,
10+
description:
11+
'The Customer API provides read-only access to customer data. Use this API to get customer information and build personalized experiences based on the selected customer context. The API offers the customer identifier for linking to customer data and enabling customer-specific features.',
1812
isVisualComponent: false,
1913
type: 'APIs',
2014
definitions: [
2115
{
2216
title: 'CustomerApi',
23-
description: '',
17+
description:
18+
'The `CustomerApi` object provides access to customer data. Access this property through `api.customer` to interact with the current customer context.',
2419
type: 'CustomerApiContent',
2520
},
2621
],
2722
examples: {
28-
description: 'Examples of using the Customer API.',
23+
description:
24+
'Learn how to access customer information and build personalized experiences based on customer context.',
2925
examples: [
3026
{
3127
codeblock: generateCodeBlockForCustomerApi(
32-
'Retrieve the ID of the customer.',
28+
'Get the current customer ID',
3329
'id',
3430
),
31+
description:
32+
"Retrieve the unique identifier of the customer currently associated with the extension's context. This example shows how to access the customer ID from customer details screens, enabling you to fetch additional customer data, track customer-specific actions, or link to external systems.",
3533
},
3634
],
3735
},
38-
category: 'APIs',
39-
related: [
36+
category: 'Target APIs',
37+
subCategory: 'Contextual APIs',
38+
related: [],
39+
40+
subSections: [
4041
{
41-
name: ExtensionTargetType.PosCustomerDetailsActionMenuItemRender,
42-
url: '/docs/api/pos-ui-extensions/targets/pos-customer-details-action-menu-item-render',
42+
type: 'Generic',
43+
anchorLink: 'best-practices',
44+
title: 'Best practices',
45+
sectionContent: `\n- **Implement customer-specific features:** Use the customer context to enable personalized functionality like customer-specific pricing, loyalty program integration, or customized product recommendations.\n- **Validate customer access:** Verify that the customer ID is valid before performing customer-specific operations or external API calls.\n`,
4346
},
4447
{
45-
name: ExtensionTargetType.PosCustomerDetailsActionRender,
46-
url: '/docs/api/pos-ui-extensions/targets/pos-customer-details-action-render',
48+
type: 'Generic',
49+
anchorLink: 'limitations',
50+
title: 'Limitations',
51+
sectionContent: `\n- The API provides only the customer identifier—use Shopify APIs or external systems to fetch additional customer details like name, email, or purchase history.\n- Customer data reflects the current POS session and may not include real-time updates from other channels until the session is refreshed.\n`,
4752
},
4853
],
4954
};

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

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,62 @@ const generateCodeBlockForDeviceApi = (title: string, fileName: string) =>
77
const data: ReferenceEntityTemplateSchema = {
88
name: 'Device API',
99
description:
10-
'The Device API allows the UI Extension to retrieve device information including the device name and ID.',
10+
'The Device API provides access to device information and capabilities, allowing you to retrieve device details, check device types, and adapt your extension behavior based on the POS hardware characteristics. The API enables device-aware functionality and responsive design based on device form factors.',
1111
isVisualComponent: false,
1212
type: 'APIs',
1313
definitions: [
1414
{
1515
title: 'DeviceApi',
16-
description: '',
16+
description:
17+
'The `DeviceApi` object provides access to device information and capabilities. Access these properties and methods through `api.device` to retrieve device details and check device characteristics.',
1718
type: 'DeviceApiContent',
1819
},
1920
],
20-
category: 'APIs',
21+
category: 'Target APIs',
22+
subCategory: 'Platform APIs',
2123
related: [],
2224
examples: {
23-
description: 'Examples of using the Device API.',
25+
description:
26+
'Learn how to access device information and adapt your extension based on hardware characteristics.',
2427
examples: [
2528
{
2629
codeblock: generateCodeBlockForDeviceApi(
27-
'Retrieve name of the device.',
28-
'name',
30+
'Check if the device is a tablet',
31+
'tablet',
2932
),
33+
description:
34+
'Check whether the extension is running on a tablet form factor. This example uses the `isTablet` property to determine the device type, allowing you to adapt layouts, adjust component sizing, or enable tablet-specific features for larger screen experiences.',
3035
},
3136
{
3237
codeblock: generateCodeBlockForDeviceApi(
33-
'Retrieve the ID of the device.',
38+
'Get the device ID',
3439
'device-id',
3540
),
41+
description:
42+
'Retrieve the unique identifier for the device running your extension. This example accesses the device ID, enabling device-specific tracking, settings synchronization, or associating actions with specific POS terminals for audit trails and analytics.',
3643
},
3744
{
38-
codeblock: generateCodeBlockForDeviceApi(
39-
'Check if device is a tablet.',
40-
'tablet',
41-
),
45+
codeblock: generateCodeBlockForDeviceApi('Get the device name', 'name'),
46+
description:
47+
"Retrieve the human-readable name of the device running your extension. This example accesses the device's name, which can be useful for debugging, analytics, device-specific customization, or displaying device information to staff members.",
4248
},
4349
],
4450
},
51+
52+
subSections: [
53+
{
54+
type: 'Generic',
55+
anchorLink: 'best-practices',
56+
title: 'Best practices',
57+
sectionContent: `\n- **Handle async device queries:** Handle the Promise-based device methods with async/await or \`.then()\` patterns, and implement appropriate error handling for device query failures.\n- **Cache device information appropriately:** Consider caching device information after the initial query to avoid repeated async calls, but ensure you handle cases where device characteristics might change during the session.\n- **Provide device-appropriate experiences:** Design different user experiences for tablets versus other devices, taking advantage of larger screens while ensuring functionality works across all supported device types.\n`,
58+
},
59+
{
60+
type: 'Generic',
61+
anchorLink: 'limitations',
62+
title: 'Limitations',
63+
sectionContent: `\n- Device information queries are asynchronous and may take time to resolve, so always handle the Promise-based responses appropriately in your extension logic.\n- The Device API provides read-only access to device information and can't be used to modify device settings or capabilities.\n- Device type detection is limited to basic form factor identification (tablet vs. non-tablet) and doesn't provide detailed hardware specifications or capabilities.\n`,
64+
},
65+
],
4566
};
4667

4768
export default data;

0 commit comments

Comments
 (0)