Skip to content

[Draft] Expand protocol to expose full envelope#398

Open
markmur wants to merge 2 commits into
web-ts-protocolfrom
protocol-full-envelope
Open

[Draft] Expand protocol to expose full envelope#398
markmur wants to merge 2 commits into
web-ts-protocolfrom
protocol-full-envelope

Conversation

@markmur

@markmur markmur commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

The protocol layer now emits the full JSON-RPC envelope (params: { checkout } / params: { error }) as the UCP spec defines it, instead of pre-narrowing descriptors down to bare payloads. Each host kit re-narrows back to its ergonomic bare-payload API, so public consumer APIs are unchanged — the narrowing just moves from the protocol into the kits.

Scope: ec.* methods only. RN native bridges/JS, sample apps, and Models.* are untouched.

Protocol descriptors now carry the envelope

Kotlin (EmbeddedCheckoutProtocol.kt, generated):

// Before — descriptor pre-narrowed to the bare payload
public val start: NotificationDescriptor<Checkout> = notificationDescriptor(
    method = Event.start,
    paramsSerializer = CheckoutParams.serializer(),
    decode = { it.checkout },
)

// After — descriptor exposes the full params envelope
public val start: NotificationDescriptor<CheckoutParams> = notificationDescriptor(
    method = Event.start,
    paramsSerializer = CheckoutParams.serializer(),
    decode = { it },
)

Swift (EmbeddedCheckoutProtocol+Event.swift, generated) and TypeScript (ProtocolNotifications.ts, generated) get the same treatment — descriptors decode to JSONRPCCheckoutParams / { checkout } rather than Checkout.

Kits re-narrow to keep their public APIs identical

Swift kit (CheckoutProtocol.swift):

// Before
public static let start = EmbeddedCheckoutProtocol.Event.start
// After
public static let start = EmbeddedCheckoutProtocol.Event.start.map { $0.params.checkout }
public static let error = EmbeddedCheckoutProtocol.Event.error.map { $0.params.error }

Android kit (CheckoutProtocol.kt):

// Before
public val start: NotificationDescriptor<Checkout> = EmbeddedCheckoutProtocol.start
// After
public val start: NotificationDescriptor<Checkout> = EmbeddedCheckoutProtocol.start.map { it.checkout }
public val error: NotificationDescriptor<ErrorResponse> = EmbeddedCheckoutProtocol.error.map { it.error }

Web kit (checkout.ts) narrows at the handler site:

// Before
.on(Event.start, (checkout) => {  })
// After
.on(Event.start, ({ params: { checkout } }) => {  })

The Android kit's public .api baseline is unchanged (JVM erasure); the protocol module's .api gains only the two new public CheckoutParams / ErrorParams classes.

@markmur markmur self-assigned this Jul 2, 2026
@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Jul 2, 2026
@markmur markmur changed the title Expand protocol to expose full envelope [Draft] Expand protocol to expose full envelope Jul 2, 2026
@markmur markmur marked this pull request as ready for review July 2, 2026 14:21
@markmur markmur requested a review from a team as a code owner July 2, 2026 14:21
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Web — Coverage Report

Lines Statements Branches Functions
Coverage: 100%
99.55% (222/223) 85.58% (95/111) 100% (61/61)

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.85% (327/356) 87.98% (183/208) 100% (86/86)

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Web npm tarball 66.6 KiB 67.0 KiB +445 B
React Native npm tarball 99.4 KiB 100.2 KiB +743 B
Android release AAR 160.8 KiB 161.2 KiB +418 B
Web file breakdown
File Base Head Delta
dist/index.js.map 179.9 KiB 182.8 KiB +2.9 KiB
dist/index.js 47.6 KiB 48.0 KiB +494 B
dist/custom-elements.json 38.0 KiB 38.0 KiB 0 B
src/checkout.ts 26.5 KiB 26.6 KiB +98 B
README.md 16.4 KiB 16.4 KiB 0 B
dist/checkout.d.ts 6.9 KiB 6.9 KiB 0 B
src/checkout.types.ts 4.1 KiB 4.1 KiB 0 B
dist/checkout.types.d.ts 3.0 KiB 3.0 KiB 0 B
package.json 2.9 KiB 2.9 KiB 0 B
src/checkout.styles.ts 2.8 KiB 2.8 KiB 0 B
src/utils.ts 1.7 KiB 1.7 KiB 0 B
dist/utils.d.ts 1.4 KiB 1.4 KiB 0 B
src/index.ts 1.2 KiB 1.2 KiB 0 B
LICENSE 1.1 KiB 1.1 KiB 0 B
dist/index.d.ts 738 B 738 B 0 B
src/checkout-web-component.ts 271 B 271 B 0 B
dist/checkout-web-component.d.ts 154 B 154 B 0 B
dist/checkout.styles.d.ts 79 B 79 B 0 B
React Native file breakdown
File Base Head Delta
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.ts 85.8 KiB 85.8 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.d.ts 53.2 KiB 53.2 KiB 0 B
ios/ShopifyCheckoutKit.swift 15.0 KiB 15.0 KiB 0 B
ios/AcceleratedCheckoutButtons.swift 14.0 KiB 14.0 KiB 0 B
lib/commonjs/index.js 13.1 KiB 13.1 KiB 0 B
src/components/AcceleratedCheckoutButtons.tsx 12.9 KiB 12.9 KiB 0 B
src/index.ts 12.5 KiB 12.5 KiB 0 B
lib/commonjs/components/AcceleratedCheckoutButtons.js 11.4 KiB 11.4 KiB 0 B
android/src/main/java/com/shopify/reactnative/checkoutkit/ShopifyCheckoutKitModule.java 11.1 KiB 11.1 KiB 0 B
lib/module/index.js 10.4 KiB 10.4 KiB 0 B
lib/commonjs/components/AcceleratedCheckoutButtons.js.map 10.3 KiB 10.3 KiB 0 B
lib/module/components/AcceleratedCheckoutButtons.js 10.2 KiB 10.2 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.ts 8.5 KiB 10.0 KiB +1.5 KiB
lib/module/components/AcceleratedCheckoutButtons.js.map 9.1 KiB 9.1 KiB 0 B
src/index.d.ts 8.9 KiB 8.9 KiB 0 B
lib/module/index.js.map 8.2 KiB 8.2 KiB 0 B
src/present-dispatcher.ts 8.0 KiB 8.0 KiB 0 B
lib/commonjs/index.js.map 7.7 KiB 7.7 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.d.ts 4.5 KiB 6.8 KiB +2.3 KiB
lib/commonjs/present-dispatcher.js 6.8 KiB 6.8 KiB 0 B
…and 105 smaller files
Android file breakdown
File Base Head Delta
classes.jar 170.2 KiB 170.6 KiB +417 B
res/layout/dialog_checkout.xml 1.3 KiB 1.3 KiB 0 B
proguard.txt 798 B 798 B 0 B
AndroidManifest.xml 578 B 578 B 0 B
res/values/values.xml 564 B 564 B 0 B
R.txt 522 B 522 B 0 B
res/drawable/close.xml 431 B 431 B 0 B
res/menu/checkout_menu.xml 354 B 354 B 0 B
META-INF/com/android/build/gradle/aar-metadata.properties 157 B 157 B 0 B

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant