Make protocol agnostic to usage#307
Draft
markmur wants to merge 1 commit into
Draft
Conversation
markmur
commented
Jun 19, 2026
Comment on lines
+51
to
+58
| epCartReady.method, | ||
| epCartAuth.method, | ||
| epCartError.method, | ||
| epCartStart.method, | ||
| epCartComplete.method, | ||
| epCartLineItemsChange.method, | ||
| epCartBuyerChange.method, | ||
| epCartMessagesChange.method, |
Contributor
Author
There was a problem hiding this comment.
TBD on whether these events should be part of the generated API surface. They're part of the spec so arguably they should.
markmur
commented
Jun 19, 2026
Comment on lines
-1
to
-34
| import Foundation | ||
|
|
||
| public enum CheckoutProtocol { | ||
| public static let specVersion = "2026-04-08" | ||
|
|
||
| public static let defaultDelegations: [String] = ["window.open"] | ||
|
|
||
| package static let readyMethod = "ec.ready" | ||
| package static let parseErrorCode = -32700 | ||
| package static let parseErrorMessage = "Parse error" | ||
| package static let methodNotFoundCode = -32601 | ||
| package static let methodNotFoundMessage = "Method not found" | ||
|
|
||
| public static let complete = NotificationDescriptor<Checkout>(method: "ec.complete") | ||
| public static let error = NotificationDescriptor<ErrorResponse>(method: "ec.error") | ||
| public static let lineItemsChange = NotificationDescriptor<Checkout>( | ||
| method: "ec.line_items.change" | ||
| ) | ||
| public static let messagesChange = NotificationDescriptor<Checkout>( | ||
| method: "ec.messages.change" | ||
| ) | ||
| public static let start = NotificationDescriptor<Checkout>(method: "ec.start") | ||
| public static let totalsChange = NotificationDescriptor<Checkout>(method: "ec.totals.change") | ||
|
|
||
| package static let supportedProtocolMethods: Set<String> = [ | ||
| readyMethod, | ||
| start.method, | ||
| complete.method, | ||
| error.method, | ||
| lineItemsChange.method, | ||
| messagesChange.method, | ||
| totalsChange.method, | ||
| windowOpen.method | ||
| ] |
Contributor
Author
There was a problem hiding this comment.
This change lifts the curation out of the protocol into the kit - since that's where the abstraction should live
markmur
commented
Jun 19, 2026
| public static func url( | ||
| for url: URL, | ||
| delegations: [String] = defaultDelegations | ||
| delegations: [String] = [] |
Contributor
Author
There was a problem hiding this comment.
The protocol should be agnostic to defaults. They should be provided by the kit
9b8bfaf to
a5da2b9
Compare
markmur
commented
Jun 19, 2026
Comment on lines
2
to
26
| #if COCOAPODS | ||
| import ShopifyCheckoutKit | ||
|
|
||
| extension CheckoutProtocol.Client: @retroactive CheckoutCommunicationProtocol {} | ||
| extension CheckoutTransport.Client: @retroactive CheckoutCommunicationProtocol {} | ||
|
|
||
| private enum RelayCuration { | ||
| static let complete = CheckoutProtocol.complete | ||
| static let error = CheckoutProtocol.error | ||
| static let lineItemsChange = CheckoutProtocol.lineItemsChange | ||
| static let messagesChange = CheckoutProtocol.messagesChange | ||
| static let start = CheckoutProtocol.start | ||
| static let totalsChange = CheckoutProtocol.totalsChange | ||
| } | ||
| #else | ||
| import ShopifyCheckoutProtocol | ||
|
|
||
| private enum RelayCuration { | ||
| static let complete = GeneratedProtocolCatalog.ecComplete | ||
| static let error = GeneratedProtocolCatalog.ecError | ||
| static let lineItemsChange = GeneratedProtocolCatalog.ecLineItemsChange | ||
| static let messagesChange = GeneratedProtocolCatalog.ecMessagesChange | ||
| static let start = GeneratedProtocolCatalog.ecStart | ||
| static let totalsChange = GeneratedProtocolCatalog.ecTotalsChange | ||
| } | ||
| #endif |
Contributor
Author
There was a problem hiding this comment.
TODO: figure out if we can remove this mapping
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.
The
protocol/package previously baked in opinions about which checkout events matter and how their payloads should be shaped for consumers, which meant every platform inherited the same curation and any change rippled through the shared layer. This splits those concerns:protocol/is now purely agnostic — transport (CheckoutTransport), the full generated payload type set, and a generatedGeneratedProtocolCatalogdescribing every OpenRPC method with no view on which ones surface — and each platform's CheckoutKit owns curation (whichec.*events it exposes) and consumer-facing transformation. The Swift transport enum was renamedCheckoutProtocol→CheckoutTransportso the kit can own theCheckoutProtocolname as its single curated, consumer-facing namespace. Web and React Native curate the same six events against the generated catalog.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)