Skip to content

Remove deprecated RN accelerated checkout customer shape#262

Open
kieran-osgood-shopify wants to merge 1 commit into
mainfrom
cx-remove-deprecated-rn-context
Open

Remove deprecated RN accelerated checkout customer shape#262
kieran-osgood-shopify wants to merge 1 commit into
mainfrom
cx-remove-deprecated-rn-context

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

What?

In v3 we deprecated the customer constructor that allows both access token and email and phone but we released this under a non-breaking change so that we didn't have to bump React by a major and instead we added a development warning to indicate to users that this would become a failure in v4. This PR just implements that.

Why?

We configure this as an error to avoid the footgun for users of combining the state.
This will show up as a typescript error

image.png

The RN v4 API should only expose the two supported customer identification modes: Customer Account access token, or contact fields

Using both is illegal as it introduces an impossible state of the customer being populated from both, and encourages footgun with expectations of fallbacks or combinations of the state.

How to test

  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn api dump
  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn api check
  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn lint module
  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn lint sample
  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn test js
  • shadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn test ios

kieran-osgood-shopify commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kieran-osgood-shopify kieran-osgood-shopify changed the title [RN][CI] Setup release publishing flow (#248) Remove deprecated RN accelerated checkout customer shape Jun 8, 2026
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review June 8, 2026 08:27
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner June 8, 2026 08:27
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.66% (319/348) 87.86% (181/206) 100% (82/82)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the cx-remove-deprecated-rn-context branch from 5e4974e to e7ace91 Compare June 8, 2026 15:38
Comment on lines +42 to +44
export type AcceleratedCheckoutCustomer =
| {accessToken: string; email?: never; phoneNumber?: never}
| {accessToken?: never; email: string; phoneNumber: string};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we harden this?

Suggested change
export type AcceleratedCheckoutCustomer =
| {accessToken: string; email?: never; phoneNumber?: never}
| {accessToken?: never; email: string; phoneNumber: string};
export type AcceleratedCheckoutCustomer =
| {accessToken: string}
| {email: string; phoneNumber: string};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I believe with the union you suggest it softens the enforcements due to structural sharing, at least thats what I was attempting to enforce here

export type FlexibleCustomer =
| {accessToken: string;}
| {email: string; phoneNumber: string};

const customer: FlexibleCustomer = {
  //  ^ this doesn't reject due to structural sharing
  accessToken: 'token',
  email: 'test@example.com',
  phoneNumber: '+123',
};

export type StrictCustomer =
| {accessToken: string; email?: never; phoneNumber?: never}
| {accessToken?: never; email: string; phoneNumber: string};

const strict_customer: StrictCustomer = {
  //  ^ correctly rejects
  accessToken: 'token',
  email: 'test@example.com',
  phoneNumber: '+123',
};

image.png

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