Remove deprecated RN accelerated checkout customer shape#262
Open
kieran-osgood-shopify wants to merge 1 commit into
Open
Remove deprecated RN accelerated checkout customer shape#262kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood-shopify wants to merge 1 commit into
Conversation
5e4974e to
e7ace91
Compare
markmur
approved these changes
Jun 8, 2026
Comment on lines
+42
to
+44
| export type AcceleratedCheckoutCustomer = | ||
| | {accessToken: string; email?: never; phoneNumber?: never} | ||
| | {accessToken?: never; email: string; phoneNumber: string}; |
Contributor
There was a problem hiding this comment.
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}; |
Contributor
Author
There was a problem hiding this comment.
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',
};
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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
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 dumpshadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn api checkshadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn lint moduleshadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn lint sampleshadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn test jsshadowenv exec --dir /Users/ko/.claudex/worktrees/Shopify@checkout-kit/cx-remove-deprecated-rn-context -- /opt/dev/bin/dev rn test ios