Skip to content

Commit e362d1f

Browse files
authored
Merge pull request #3560 from Shopify/pos-ui-extensions-2026-01-api-prop-descriptions
[POS UI extensions]: Improved target, API, component descriptions for 2026-01
2 parents 08eea4f + a6e90b4 commit e362d1f

File tree

158 files changed

+6234
-3908
lines changed

Some content is hidden

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

158 files changed

+6234
-3908
lines changed

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

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,60 @@ const generateJsxCodeBlockForActionApi = (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.PosOrderDetailsActionMenuItemRender}
18-
- ${TargetLink.PosOrderDetailsBlockRender}
19-
- ${TargetLink.PosProductDetailsActionMenuItemRender}
20-
- ${TargetLink.PosProductDetailsBlockRender}
21-
- ${TargetLink.PosCustomerDetailsActionMenuItemRender}
22-
- ${TargetLink.PosCustomerDetailsBlockRender}
23-
- ${TargetLink.PosDraftOrderDetailsActionMenuItemRender}
24-
- ${TargetLink.PosDraftOrderDetailsBlockRender}
25-
`,
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.',
2612
isVisualComponent: false,
2713
type: 'APIs',
2814
definitions: [
2915
{
3016
title: 'ActionApi',
31-
description: '',
17+
description:
18+
'The `ActionApi` object provides methods for presenting modal interfaces. Access these methods through `shopify.action` to launch full-screen modal experiences.',
3219
type: 'ActionApiContent',
3320
},
3421
],
35-
category: 'APIs',
22+
category: 'Target APIs',
23+
subCategory: 'Standard APIs',
24+
subSections: [
25+
{
26+
type: 'Generic',
27+
anchorLink: 'best-practices',
28+
title: 'Best practices',
29+
sectionContent: `
30+
- **Use modals for complex workflows:** Reserve for operations requiring more space, multiple steps, or complex interactions.
31+
- **Provide clear entry points:** Use descriptive button labels and titles that indicate what the modal will contain.
32+
- **Handle dismissal gracefully:** Save progress when possible and provide feedback about incomplete operations.
33+
`,
34+
},
35+
{
36+
type: 'Generic',
37+
anchorLink: 'limitations',
38+
title: 'Limitations',
39+
sectionContent: `
40+
Each 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.
41+
`,
42+
},
43+
],
3644
related: [],
3745
examples: {
38-
description: 'Examples of using the Action API.',
46+
description:
47+
'Learn how to launch modal workflows from menu items, tiles, and blocks.',
3948
examples: [
4049
{
4150
codeblock: generateJsxCodeBlockForActionApi(
42-
'Present a modal from post purchase.',
51+
'Launch a modal from a menu item',
4352
'present-modal',
4453
),
54+
description:
55+
'Present a full-screen modal from menu item actions in detail screens. This example shows how to use `shopify.action.presentModal()` to launch a modal workflow from post-purchase, order details, or other action menu item contexts, enabling complex multi-step operations.',
4556
},
4657
{
4758
codeblock: generateJsxCodeBlockForActionApi(
48-
'Present a modal from smart grid.',
59+
'Launch a modal from a smart grid tile',
4960
'present-modal-tile',
5061
),
62+
description:
63+
'Present a full-screen modal from smart grid tiles on the POS home screen. This example demonstrates using `shopify.action.presentModal()` to launch modal workflows from tile interactions, perfect for high-frequency tasks that require additional UI beyond the tile itself.',
5164
},
5265
],
5366
},

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

Lines changed: 136 additions & 74 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: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,59 @@ const generateJsxCodeBlockForCartLineItemApi = (
99

1010
const data: ReferenceEntityTemplateSchema = {
1111
name: 'Cart Line Item API',
12-
description: `
13-
The Cart Line Item API provides an extension with data about the current Cart Line Item.
14-
15-
#### Supporting targets
16-
- ${TargetLink.PosCartLineItemDetailsActionMenuItemRender}
17-
- ${TargetLink.PosCartLineItemDetailsActionRender}
18-
`,
12+
description:
13+
'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.',
1914
isVisualComponent: false,
2015
type: 'APIs',
2116
definitions: [
2217
{
2318
title: 'CartLineItemApi',
24-
description: '',
19+
description:
20+
'The `CartLineItemApi` object provides access to the current line item. Access this property through `api.cartLineItem` to interact with the current line item context.',
2521
type: 'CartLineItemApi',
2622
},
2723
],
24+
subSections: [
25+
{
26+
type: 'Generic',
27+
anchorLink: 'best-practices',
28+
title: 'Best practices',
29+
sectionContent: `
30+
- **Handle optional properties:** Check for \`undefined\` in optional properties like \`price\`, \`productId\`, \`title\`, \`sku\`, and vendor before use.
31+
- **Create contextual experiences:** Use line item data to show different interfaces for gift cards, subscriptions, or vendor-specific information.
32+
- **Implement item-specific validation:** Use properties like \`taxable\`, \`isGiftCard\`, and \`requiresSellingPlan\` for appropriate business logic.
33+
- **Handle selling plans:** When working with subscriptions, check \`requiresSellingPlan\` and \`sellingPlan\` to provide appropriate subscription management.
34+
- **Access related data efficiently:** Use \`productId\` and \`variantId\` to fetch additional info when needed, but avoid unnecessary API calls.
35+
`,
36+
},
37+
{
38+
type: 'Generic',
39+
anchorLink: 'limitations',
40+
title: 'Limitations',
41+
sectionContent: `
42+
- The API provides read-only access to line item data—use the Cart API for modifying line item properties, discounts, selling plans, or other attributes.
43+
- Line item data reflects the current state and may not include real-time inventory, pricing, or selling plan updates until the cart is refreshed.
44+
- Selling plan information may be limited during refund or exchange operations where digest values aren't available.
45+
`,
46+
},
47+
],
2848
examples: {
29-
description: 'Examples of using the Cart Line Item API.',
49+
description:
50+
'Learn how to access line item information in cart line item contexts.',
3051
examples: [
3152
{
3253
codeblock: generateJsxCodeBlockForCartLineItemApi(
33-
'Retrieve the ID of the cart line item.',
54+
'Display the cart line item ID',
3455
'id',
3556
),
57+
description:
58+
'Access the unique identifier of the current cart line item in line item detail contexts. This example shows how to use `shopify.cartLineItem.id` to retrieve the line item ID, which can be used for modifying the item, applying discounts, or implementing item-specific functionality.',
3659
},
3760
],
3861
},
39-
category: 'APIs',
40-
related: [
41-
{
42-
name: ExtensionTargetType.PosCartLineItemDetailsActionMenuItemRender,
43-
url: '/docs/api/pos-ui-extensions/targets/pos-cart-line-item-details-action-menu-item-render',
44-
},
45-
{
46-
name: ExtensionTargetType.PosCartLineItemDetailsActionRender,
47-
url: '/docs/api/pos-ui-extensions/targets/pos-cart-line-item-details-action-render',
48-
},
49-
],
62+
category: 'Target APIs',
63+
subCategory: 'Contextual APIs',
64+
related: [],
5065
};
5166

5267
export default data;

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

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,57 @@ const generateJsxCodeBlockForCashDrawerApi = (
99

1010
const data: ReferenceEntityTemplateSchema = {
1111
name: 'Cash Drawer API',
12-
description: `
13-
The Cash Drawer API is an API exposed to extensions for cash drawer functionality, specifically allowing UI extensions to control cash drawer operations.
14-
15-
#### Supporting targets
16-
- ${TargetLink.PosHomeTileRender}
17-
- ${TargetLink.PosHomeModalRender}
18-
- ${TargetLink.PosPurchasePostActionMenuItemRender}
19-
- ${TargetLink.PosPurchasePostActionRender}
20-
- ${TargetLink.PosPurchasePostBlockRender}
21-
- ${TargetLink.PosReturnPostActionMenuItemRender}
22-
- ${TargetLink.PosReturnPostActionRender}
23-
- ${TargetLink.PosReturnPostBlockRender}
24-
- ${TargetLink.PosExchangePostActionMenuItemRender}
25-
- ${TargetLink.PosExchangePostActionRender}
26-
- ${TargetLink.PosExchangePostBlockRender}
27-
`,
12+
description:
13+
'The Cash Drawer API provides programmatic control over cash drawer hardware connected to POS devices. Use this API to trigger cash drawer operations for manual cash handling, custom payment workflows, or register management tasks.',
2814
isVisualComponent: false,
2915
type: 'APIs',
3016
definitions: [
3117
{
3218
title: 'CashDrawerApi',
33-
description: 'Interface for handling cash drawer operations.',
34-
type: 'CashDrawerApi',
19+
description:
20+
'The `CashDrawerApi` object provides methods for controlling cash drawer hardware. Access these methods through `shopify.cashDrawer` to trigger cash drawer operations.',
21+
type: 'CashDrawerApiContent',
22+
},
23+
],
24+
category: 'Target APIs',
25+
subCategory: 'Platform APIs',
26+
subSections: [
27+
{
28+
type: 'Generic',
29+
anchorLink: 'best-practices',
30+
title: 'Best practices',
31+
sectionContent: `
32+
- **Implement error handling:** Wrap \`cashDrawer.open()\` calls in try-catch blocks. Show clear error messages with resolution steps.
33+
- **Require authorization:** Implement authorization checks before opening for non-transaction operations. Consider PIN entry, manager approval, or staff permissions.
34+
- **Provide user feedback:** Show immediate confirmations like "Cash drawer opened successfully" so staff know the operation completed.
35+
- **Log operations for audit:** Track all openings including timestamps, staff info, and reason for loss prevention and compliance.
36+
- **Test without hardware:** Handle scenarios where no drawer is connected with fallback workflows or clear messaging.
37+
- **Consider timing:** Open at appropriate moments. Avoid opening multiple times in quick succession or in inappropriate workflow states.
38+
`,
39+
},
40+
{
41+
type: 'Generic',
42+
anchorLink: 'limitations',
43+
title: 'Limitations',
44+
sectionContent: `
45+
- The Cash Drawer API requires compatible cash drawer hardware connected to the POS device through supported peripheral connections (USB, network, or Bluetooth depending on device and hardware model).
46+
- The API only triggers the drawer opening mechanism and cannot detect whether the drawer is currently open, closed, or physically jammed. Your extension is responsible for any required state tracking.
47+
- Cash drawer operations are subject to POS hardware capabilities and may not be available on all device configurations. The API will return errors on devices without cash drawer support.
48+
`,
3549
},
3650
],
37-
category: 'APIs',
3851
related: [],
3952
examples: {
40-
description: 'Examples of using the Cash Drawer API',
53+
description:
54+
'Learn how to programmatically control cash drawer hardware operations.',
4155
examples: [
4256
{
4357
codeblock: generateJsxCodeBlockForCashDrawerApi(
44-
'Open the cash drawer',
58+
'Trigger the cash drawer to open',
4559
'default.example',
4660
),
61+
description:
62+
'Open the cash drawer programmatically for manual cash handling or custom workflows. This example shows how to use `shopify.cashDrawer.open()` to trigger the connected cash drawer hardware, useful for no-sale transactions, manual cash operations, or register management tasks that require direct cash access.',
4763
},
4864
],
4965
},

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

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,54 @@ const generateJsxCodeBlockForConnectivityApi = (
99
const data: ReferenceEntityTemplateSchema = {
1010
name: 'Connectivity API',
1111
description:
12-
'The Connectivity API enables POS UI extensions to retrieve device connectivity information, such as whether the device has an internet connection.',
12+
'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.',
1313
isVisualComponent: false,
1414
type: 'APIs',
1515
definitions: [
1616
{
1717
title: 'ConnectivityApi',
18-
description: '',
18+
description:
19+
'The `ConnectivityApi` object provides access to current connectivity information and change notifications. Access these properties through `shopify.connectivity` to monitor network status.',
1920
type: 'ConnectivityApiContent',
2021
},
2122
],
22-
category: 'APIs',
23+
category: 'Target APIs',
24+
subCategory: 'Platform APIs',
25+
subSections: [
26+
{
27+
type: 'Generic',
28+
anchorLink: 'best-practices',
29+
title: 'Best practices',
30+
sectionContent: `
31+
- **Handle changes gracefully:** Use \`subscribe\` to adapt behavior when connectivity changes.
32+
- **Design for network interruptions:** Inform users when network-dependent features are unavailable and provide guidance.
33+
- **Display connectivity status:** Show status when it affects functionality to help users understand limitations.
34+
- **Queue operations during outages:** Implement queuing for non-critical operations that can be deferred until connectivity is restored.
35+
`,
36+
},
37+
{
38+
type: 'Generic',
39+
anchorLink: 'limitations',
40+
title: 'Limitations',
41+
sectionContent: `
42+
- The Connectivity API provides read-only access to connectivity information and can't be used to control or modify network settings on the device.
43+
- Connectivity status reflects Internet connectivity only and may not indicate the quality or speed of the connection, which could affect API performance.
44+
- The API monitors general Internet connectivity but doesn't provide specific information about Shopify service availability or API endpoint availability.
45+
`,
46+
},
47+
],
2348
related: [],
2449
examples: {
25-
description: 'Examples of using the Connectivity API',
50+
description:
51+
'Learn how to monitor network connectivity status and respond to connectivity changes.',
2652
examples: [
2753
{
2854
codeblock: generateJsxCodeBlockForConnectivityApi(
29-
'Subscribe to connectivity changes.',
55+
'Monitor network connectivity changes',
3056
'subscribe',
3157
),
58+
description:
59+
'Subscribe to connectivity changes to monitor network status in real time. This example demonstrates using `shopify.connectivity.subscribe()` and `shopify.connectivity.connected` to detect when the device goes online or offline, enabling adaptive behavior for offline-capable features or network-dependent operations.',
3260
},
3361
],
3462
},

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

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,56 @@ const generateJsxCodeBlockForCustomerApi = (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 `shopify.customer` to interact with the current customer context.',
2419
type: 'CustomerApiContent',
2520
},
2621
],
22+
subSections: [
23+
{
24+
type: 'Generic',
25+
anchorLink: 'best-practices',
26+
title: 'Best practices',
27+
sectionContent: `
28+
- **Use customer ID for lookups:** Fetch additional customer information from external systems or Shopify APIs using the customer ID.
29+
- **Enable personalized features:** Use customer context for customer-specific pricing, loyalty programs, or product recommendations.
30+
- **Validate customer access:** Verify the customer ID is valid before performing operations or API calls.
31+
`,
32+
},
33+
{
34+
type: 'Generic',
35+
anchorLink: 'limitations',
36+
title: 'Limitations',
37+
sectionContent: `
38+
- The API provides only the customer identifier—use Shopify APIs or external systems to fetch additional customer details like name, email, or purchase history.
39+
- Customer data reflects the current POS session and may not include real-time updates from other channels until the session is refreshed.
40+
`,
41+
},
42+
],
2743
examples: {
28-
description: 'Examples of using the Customer API.',
44+
description:
45+
'Learn how to access customer information in customer detail contexts.',
2946
examples: [
3047
{
3148
codeblock: generateJsxCodeBlockForCustomerApi(
32-
'Retrieve the ID of the customer.',
49+
'Display the customer ID',
3350
'id',
3451
),
52+
description:
53+
'Access the unique identifier of the current customer in a customer detail context. This example shows how to use `shopify.customer.id` to retrieve the customer ID, which can be used for fetching additional customer data, implementing loyalty features, or building personalized customer experiences.',
3554
},
3655
],
3756
},
38-
category: 'APIs',
39-
related: [
40-
{
41-
name: ExtensionTargetType.PosCustomerDetailsActionMenuItemRender,
42-
url: '/docs/api/pos-ui-extensions/targets/pos-customer-details-action-menu-item-render',
43-
},
44-
{
45-
name: ExtensionTargetType.PosCustomerDetailsActionRender,
46-
url: '/docs/api/pos-ui-extensions/targets/pos-customer-details-action-render',
47-
},
48-
],
57+
category: 'Target APIs',
58+
subCategory: 'Contextual APIs',
59+
related: [],
4960
};
5061

5162
export default data;

0 commit comments

Comments
 (0)