Skip to content
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

Add checkoutToken api to unstable release #1315

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

dnagoda
Copy link
Contributor

@dnagoda dnagoda commented Sep 5, 2023

Background

Resolves https://github.com/Shopify/checkout-web/issues/22608

NOTE: I only included my changes. There's an issue with the current customer-account changes that blows up the build.

Solution

Provides stable id in checkout that can be mapped to WebPixel checkout payloads (via token in checkout payload) and Orders resource (via Admin REST API Orders checkout_token).

🎩

  • Create a spin instance that includes the ui-extensions repo and checkout this branch: denii/unstable-release-2023-09-05
  • Create a new app with checkout ui extension locally: yarn create @shopify/app and yarn generate extension
  • In the local extension, use the new api, both directly and through the hook:
const { checkoutToken } = useApi();

const value = useSubscription(
  checkoutToken,
);

or

const hookValue = useCheckoutToken();
  • In your app directory, run the following to copy the ui-extensions code into your app:
VM=direct.$(spin show -o fqdn)
rsync -av --delete $VM:~/src/github.com/Shopify/ui-extensions/packages/ui-extensions node_modules/@shopify/ && \
rsync -av --delete $VM:~/src/github.com/Shopify/ui-extensions/packages/ui-extensions-react node_modules/@shopify/
  • Run yarn dev or yarn build to check that the app builds and can execute without error using the updated unstable api

Checklist

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

Copy link
Contributor

@jamesvidler jamesvidler left a comment

Choose a reason for hiding this comment

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

Nicely done 👍 Just a comment regarding the changeset description. Otherwise good to go.

.changeset/yellow-frogs-help.md Outdated Show resolved Hide resolved
@dnagoda dnagoda force-pushed the denii/unstable-release-2023-09-05 branch from 2f4c19b to 9831e6d Compare September 6, 2023 16:50
@dnagoda dnagoda force-pushed the denii/unstable-release-2023-09-05 branch from 9831e6d to 22f7143 Compare September 6, 2023 16:56
@dnagoda dnagoda merged commit 9ac5e27 into unstable Sep 6, 2023
5 checks passed
@dnagoda dnagoda deleted the denii/unstable-release-2023-09-05 branch September 6, 2023 17:34
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.

2 participants