-
Notifications
You must be signed in to change notification settings - Fork 47
Added open function declaration to the Navigation API #3079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2025-10-rc
Are you sure you want to change the base?
Conversation
/snapit |
🫰✨ Thanks @thunderfern! Your snapshots have been published to npm. Test the snapshots by updating your "@shopify/ui-extensions": "0.0.0-snapshot-20250714185545",
"@shopify/ui-extensions-react": "0.0.0-snapshot-20250714185545" |
packages/ui-extensions/src/surfaces/point-of-sale/render/api/navigation-api/navigation-api.ts
Outdated
Show resolved
Hide resolved
b898014
to
7fe08f4
Compare
7fe08f4
to
6ebc2b9
Compare
* - `gid://shopify/Product/<productId>` to open product details. | ||
* - `gid://shopify/ProductVariant/<variantId>` to open product details for variant. | ||
* - `gid://shopify/Customer/<customerId>` to open customer details. | ||
* - `gid://shopify/Order/<orderId>` to open order details. | ||
* - `gid://shopify/DraftOrder/<draftOrderId>` to open draft order details. | ||
* - `gid://shopify/StaffMember/<staffMemberId>` to open staff details. | ||
* - `pos://home-tab` to open the home tab. | ||
* - `pos://cart-tab` to open the cart tab. Opens home tab on tablets. | ||
* - `pos://products-tab` to open the products tab. | ||
* - `pos://orders-tab` to open the orders tab. | ||
* - `pos://customers-tab` to open the customers tab. Available only on tablets, and throws error on phones. | ||
* - `pos://more-tab` to open the more tab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- of note, these comments do not show up on shopify.dev. add as API examples?
- should the tabs be typed instead? also self-documents by doing so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, something like this would be helpful:
type HomeTab = 'pos://home-tab'
type ProductPage = `gid://shopify/Product/${string}`
...
export type PosScreen = HomeTab | ProductPage ...
open(url: PosScreen): Promise<void>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Documentation will be updated in another PR instead.
- As discussed, the tabs are not typed to allow for more frequent updates to the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NathanJolly, we decided against typed APIs to allow for more frequent updates to the API, since you would only add changes to the pos-next-react-native
repo instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, when we add more options, wouldn't we have to update this comment anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds like the idea is to leave this open-ended string
so it's not api version restricted. so new nav path X can be used in api version 2025.10
even if added in 2026.10
.
NOTE: documentation-wise though this needs maintaining with POS version support.
6ebc2b9
to
8175e13
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Background
Resolves https://github.com/shop/issues-retail/issues/1810. This PR is made alongside this PR.
Solution
Created an open function in the Navigation API to open the resource pages.
🎩
Checklist