Skip to content

Commit 8175e13

Browse files
committed
added open function declaration to the Navigation API
1 parent c2bae31 commit 8175e13

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.changeset/forty-files-relax.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+
Added an open function to the Navigation API to allow for navigation to POS native pages

packages/ui-extensions/src/surfaces/point-of-sale/api/navigation-api/navigation-api.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,39 @@ export interface NavigationApiContent {
1111

1212
/** Dismisses the extension. */
1313
dismiss(): void;
14+
15+
/**
16+
* Open POS screens. Resource screens open in a modal. Tabs close all modals before navigating to the tab.
17+
* Available screens:
18+
* - `gid://shopify/Product/<productId>` to open product details.
19+
* - `gid://shopify/ProductVariant/<variantId>` to open product details for variant.
20+
* - `gid://shopify/Customer/<customerId>` to open customer details.
21+
* - `gid://shopify/Order/<orderId>` to open order details.
22+
* - `gid://shopify/DraftOrder/<draftOrderId>` to open draft order details.
23+
* - `gid://shopify/StaffMember/<staffMemberId>` to open staff details.
24+
* - `pos://home-tab` to open the home tab.
25+
* - `pos://cart-tab` to open the cart tab. Opens home tab on tablets.
26+
* - `pos://products-tab` to open the products tab.
27+
* - `pos://orders-tab` to open the orders tab.
28+
* - `pos://customers-tab` to open the customers tab. Available only on tablets, and throws error on phones.
29+
* - `pos://more-tab` to open the more tab.
30+
*
31+
* @example
32+
* // Open product details screen for product id 123
33+
* openUrl('gid://shopify/Product/123');
34+
*
35+
* @example
36+
* // Open home tab
37+
* openUrl('pos://home-tab');
38+
*
39+
* @example
40+
* // Open home tab
41+
* openUrl(new URL('pos://home-tab'));
42+
*
43+
* @param url - The POS screen to open
44+
* @returns A promise that resolves when the POS screen is opened, rejects when an error occurs like an unsupported GID or POS screen.
45+
*/
46+
open(url: string | URL): Promise<void>;
1447
}
1548

1649
/**

0 commit comments

Comments
 (0)