-
Notifications
You must be signed in to change notification settings - Fork 33
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session navigation scanner toast api examples for pos ui ext docs #1973
Conversation
d9de9fa
to
2218eb9
Compare
packages/ui-extensions/docs/surfaces/point-of-sale/reference/helpers/returnExtensionTarget.ts
Outdated
Show resolved
Hide resolved
@@ -16,6 +20,11 @@ const data: ReferenceEntityTemplateSchema = { | |||
], | |||
category: 'APIs', | |||
related: [], | |||
requires: `the ${returnExtensionTarget( |
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.
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.
@merkoyep @NathanJolly @js-goupil good to know!
4d838c5
to
ffc700e
Compare
packages/ui-extensions/docs/surfaces/point-of-sale/reference/helpers/returnExtensionTarget.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/action-api.doc.ts
Outdated
Show resolved
Hide resolved
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.
Mostly looks ready! Just a couple comments. I'm going to wait on this to merge, since I think there's a lot of overlap in the Screen and Navigator doc examples and these ones. We'll be able to reuse the examples. Mine does add a sheet presentation example that I can add to the navigation API docs as well
@@ -0,0 +1,8 @@ | |||
// You can navigate to any of these three screens since they all exist within the same Navigator. | |||
return ( | |||
<Navigator> |
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.
This example seems incomplete compared to its TS counterpart.
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.
What do you mean?
...s/ui-extensions/docs/surfaces/point-of-sale/reference/examples/navigation-api/two-screen.tsx
Outdated
Show resolved
Hide resolved
packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/scanner-api.doc.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/docs/surfaces/point-of-sale/reference/apis/scanner-api.doc.ts
Outdated
Show resolved
Hide resolved
...-extensions/docs/surfaces/point-of-sale/reference/examples/navigation-api/navigation-tree.ts
Outdated
Show resolved
Hide resolved
...ns/docs/surfaces/point-of-sale/reference/examples/scanner-api/conditional-scanner-example.ts
Outdated
Show resolved
Hide resolved
...sions/docs/surfaces/point-of-sale/reference/examples/scanner-api/hardware-scanner-example.ts
Outdated
Show resolved
Hide resolved
...sions/docs/surfaces/point-of-sale/reference/examples/scanner-api/hardware-scanner-example.ts
Outdated
Show resolved
Hide resolved
const addProductToCart = (data: string | undefined) => { | ||
if (data) { | ||
api.cart.addLineItem(Number(data), 1); | ||
} | ||
}; | ||
addProductToCart(data); | ||
}, [data]); |
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.
Doesn't shopify assign productID's regardless of what the scanned data is? In other words, does this logic actually make sense?
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.
Hm I need more clarification on this. I don't understand
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.
The example says "whatever barcode is scanned, add the product with that productID to the cart"
I'm wondering if that example is misleading because a barcode doesn't necessarily match a productID. I think a more accurate example would be to just put the text on the screen somehow.
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.
It's also not async so I don't think there's a reason to do the whole "make a function call a function" thing
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.
if (data) { api.cart.addLineItem(Number(data), 1); }
My understanding is more of "if theres a barcode data scanned then it will attempt to add that productID to the cart". If the productID doesn't exist than nothing happens to the cart. Maybe the description of the example can be written better.
I agree the async is excessive and not useful here so I'll update that as well!
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.
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.
ProductId is that 760...104 number, and the barcode is a manually-entered user field
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.
Makes sense, thank you for helping me understand! This logic is unnecessary I'll remove it
...xtensions/docs/surfaces/point-of-sale/reference/examples/scanner-api/subscribable-events.tsx
Outdated
Show resolved
Hide resolved
...tensions/docs/surfaces/point-of-sale/reference/examples/scanner-api/subscribable-sources.tsx
Outdated
Show resolved
Hide resolved
packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/toast-api/show.ts
Outdated
Show resolved
Hide resolved
packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/toast-api/show.tsx
Outdated
Show resolved
Hide resolved
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.
Great!
Add rest of examples
3b28f75
to
120677e
Compare
Resolves https://github.com/Shopify/pos-next-react-native/issues/36279
Resolves https://github.com/Shopify/pos-next-react-native/issues/36288
Background
This PR adds the examples for navigation, session, scanner, toast apis to the docs.
Some important changes you can look below at the comments to find more information but
required
field for docs to help us clarify which targets are needed for usage馃帺
Checklist