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

Use Customer Account API in templates/skeleton & template/demo-store #1576

Merged
merged 22 commits into from
Jan 18, 2024

Conversation

michenly
Copy link
Contributor

@michenly michenly commented Dec 14, 2023

WHY are these changes introduced?

The Customer Account API will be officially release in Jan of 2024. This PR aim to replaced all current storefront API customer usage with the new API.

WHAT is this pull request doing?

  • Add app/graphql/customer folder to contain all Customer Account API GraphQL query & mutation. This is needed because currently you cannot use the #graphql comment annotation in type generation with multiple schema in one file.

  • Change codegen to exclude graphql type generation for app/graphql folder. This folder will be dedicated for any graphql usage that is not Storefront API.

  • 🔥 remove account activate, recover, register and reset. Since these are not supported in the new CA API with new customer flow.

  • Create customerClient in remix context like the example and also set up login/logout flow.

Pages to update in templates/skeleton

  • /account fall back wild card
  • /account index
  • /account/orders
  • /account/order/$id
  • /account/profile
  • /account/addresses
  • root.tsx
  • cart.tsx (no change, but add run customerAccessToken into customerAccount utility to keep it uniform in case for future change)
  • Add error when createCustomerClient is use without all the variables. ie. when using mock.shop

Other templates & examples with usage of customerAccessToken:

  • templates/demo-store
  • examples/multipass/ (keeping it as it. new project coming for this)

HOW to test your changes?

Follow customer-api example for ngrok setup and interact with any /account route.

Ensure the customer information will be passed to cart when a login customer try to view cart.

Post-merge steps

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@michenly michenly force-pushed the mc-customer-account-templates-update branch from a345d38 to 59045a0 Compare December 14, 2023 22:19
Copy link
Contributor

@frandiox frandiox left a comment

Choose a reason for hiding this comment

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

Great job! I've left a few comments with issues related to GraphQL / Codegen 🙏 (especially #1576 (comment) is important).

Also, I noticed the generated types for CAAPI weren't prettified... I've fixed that in #1578 👍

packages/cli/src/lib/codegen.ts Outdated Show resolved Hide resolved
packages/cli/src/lib/codegen.ts Outdated Show resolved Hide resolved
packages/hydrogen-codegen/src/pluck.ts Outdated Show resolved Hide resolved
templates/skeleton/server.ts Outdated Show resolved Hide resolved
michenly and others added 5 commits January 17, 2024 16:35
Co-authored-by: Bret Little <bret.little@shopify.com>
Co-authored-by: Bret Little <bret.little@shopify.com>
* ✨ move demo-store to caapi

* update login button

* login flow + account page

* customer profile edit

* address edit

* cart edit

* order id page

* fix eslint error, strange my VS code is giving different suggestions

* Update packages/hydrogen/src/customer/customer.ts

Co-authored-by: Bret Little <bret.little@shopify.com>

* Update packages/hydrogen/src/customer/customer.ts

Co-authored-by: Bret Little <bret.little@shopify.com>

* remove redirectPath from authorize

---------

Co-authored-by: Bret Little <bret.little@shopify.com>
Copy link
Contributor

@blittle blittle left a comment

Choose a reason for hiding this comment

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

Looking good!

@michenly michenly force-pushed the mc-customer-account-templates-update branch from 41cd7e0 to 3f085ba Compare January 18, 2024 23:24
@michenly michenly merged commit 1820241 into main Jan 18, 2024
10 checks passed
@michenly michenly deleted the mc-customer-account-templates-update branch January 18, 2024 23:50
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.

None yet

7 participants