Skip to content

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

Open
wants to merge 1 commit into
base: 2025-10-rc
Choose a base branch
from

Conversation

thunderfern
Copy link
Contributor

@thunderfern thunderfern commented Jul 14, 2025

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.

🎩

  • Tophatting instructions can be found in this PR.

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

@thunderfern
Copy link
Contributor Author

/snapit

@shopify-github-actions-access
Copy link
Contributor

🫰✨ Thanks @thunderfern! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/ui-extensions": "0.0.0-snapshot-20250714185545",
"@shopify/ui-extensions-react": "0.0.0-snapshot-20250714185545"

@thunderfern thunderfern force-pushed the linx-navigate-native-api branch from b898014 to 7fe08f4 Compare July 15, 2025 17:59
@thunderfern thunderfern marked this pull request as ready for review July 15, 2025 19:12
@thunderfern thunderfern requested review from katriciab and a team July 15, 2025 19:13
@thunderfern thunderfern changed the base branch from unstable to 2025-10-rc July 15, 2025 19:19
@thunderfern thunderfern changed the base branch from 2025-10-rc to unstable July 15, 2025 19:20
@thunderfern thunderfern force-pushed the linx-navigate-native-api branch from 7fe08f4 to 6ebc2b9 Compare July 15, 2025 19:26
@thunderfern thunderfern changed the base branch from unstable to 2025-10-rc July 15, 2025 19:26
@thunderfern thunderfern requested a review from a team July 15, 2025 19:27
Comment on lines +18 to +29
* - `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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. of note, these comments do not show up on shopify.dev. add as API examples?
  2. should the tabs be typed instead? also self-documents by doing so.

Copy link
Contributor

@NathanJolly NathanJolly Jul 16, 2025

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>;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Documentation will be updated in another PR instead.
  2. As discussed, the tabs are not typed to allow for more frequent updates to the API.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

@thunderfern thunderfern force-pushed the linx-navigate-native-api branch from 6ebc2b9 to 8175e13 Compare July 17, 2025 13:33
@thunderfern thunderfern changed the title Added open function declaration to the Navigation API added open function declaration to the Navigation API Jul 17, 2025
@thunderfern thunderfern marked this pull request as draft July 17, 2025 13:33
Copy link
Contributor Author

@thunderfern thunderfern marked this pull request as ready for review July 17, 2025 15:04
@thunderfern thunderfern changed the title added open function declaration to the Navigation API Added open function declaration to the Navigation API Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants