Skip to content

feat(RN): Add wiring for protocol events - add ec.start #170

Open
kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood/05-14-featremoveaddeventlistenerapifrom
kieran-osgood/05-15-feataddfirstprotocolevent
Open

feat(RN): Add wiring for protocol events - add ec.start #170
kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood/05-14-featremoveaddeventlistenerapifrom
kieran-osgood/05-15-feataddfirstprotocolevent

Conversation

@kieran-osgood-shopify
Copy link
Copy Markdown
Contributor

@kieran-osgood-shopify kieran-osgood-shopify commented May 20, 2026

What changes are you making?

Part of the scope of this PR is to add a translation layer between the the core native SDKs and the React native JavaScript runtime. The models that are generated for Swift and Kotlin in automatically camel case at their encode decode boundary, which means the raw Jason is read as snake case and the Swift and Kotlin properties are then turned into camel case when they are turned back into raw Jason, they're back in Snakecase.

This is problematic for React Native because we do not have a schema validation library. we are just using the CodeGen TypeScript interfaces, faces which again are in camel case which means we need some layer to convert that over to camelCase.

I consider doing this on the TypeScript level

  • This would require greater degrees of unsafe mapping due to the types at play
  • I also didn't want to be blocking the main thread with lots of IO intensive work.

How to test


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped the versionName in platforms/android/lib/build.gradle
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

Copy link
Copy Markdown
Contributor Author

kieran-osgood-shopify commented May 20, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 98%
97.05% (264/272) 91.76% (156/170) 100% (70/70)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 0967be1 to ef1aa23 Compare May 20, 2026 11:46
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch 2 times, most recently from bce2e51 to 69d73a1 Compare May 20, 2026 11:49
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from ef1aa23 to 4cf6e67 Compare May 20, 2026 12:04
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch 2 times, most recently from 2fe0f4c to d66e597 Compare May 20, 2026 12:56
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 4cf6e67 to bb2ece5 Compare May 20, 2026 14:16
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch from d66e597 to ec45844 Compare May 20, 2026 14:17
targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
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 added tests for the react native android side (CasingTransform) which added "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3" - this implicitly increased the versions so had to add explicit pins

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from bb2ece5 to f782d21 Compare May 21, 2026 09:28
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch 3 times, most recently from 41dcbf3 to 9dbe6eb Compare May 21, 2026 10:23
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch from 9dbe6eb to 9c2bce2 Compare May 21, 2026 13:38
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from f782d21 to 2a42f7e Compare May 21, 2026 13:38
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review May 21, 2026 14:13
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner May 21, 2026 14:13
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from 2a42f7e to d949cb6 Compare May 21, 2026 14:24
@kieran-osgood-shopify kieran-osgood-shopify changed the title feat: add first protocol event feat(RN): Add wiring for protocol events - add ec.start May 21, 2026
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch from 9c2bce2 to f77c5ca Compare May 21, 2026 14:27
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-14-featremoveaddeventlistenerapi branch from d949cb6 to 3921fb8 Compare May 21, 2026 14:56
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch from f77c5ca to c75d0f4 Compare May 21, 2026 15:08
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the kieran-osgood/05-15-feataddfirstprotocolevent branch from c75d0f4 to 57db8b8 Compare May 21, 2026 16:11
// once we're satisfied the relay is wired correctly we'll route
// protocol events through `useShopifyEventHandlers` (or an
// equivalent) just like the SDK lifecycle ones above.
[CheckoutProtocol.start]: checkout => {
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.

Need to improve the API here - seems like we might need a mapping layer, otherwise this unfortunately gives autocomplete of 'ec.start'

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.

1 participant