Skip to content

Prototype protocol-agnostic checkout events for Swift - #748

Draft
markmur wants to merge 4 commits into
mainfrom
prototype/protocol-agnostic-events
Draft

Prototype protocol-agnostic checkout events for Swift#748
markmur wants to merge 4 commits into
mainfrom
prototype/protocol-agnostic-events

Conversation

@markmur

@markmur markmur commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • adds Kit-owned Checkout and CheckoutLink models that exclude raw UCP envelopes, messages, and JSON-RPC metadata
  • translates ECP start, change, and complete notifications through an internal adapter with equal-snapshot deduplication
  • exposes idiomatic SwiftUI onStart, onUpdate, and onComplete modifiers plus UIKit delegate callbacks with default implementations
  • keeps lineItems as a plain array of Kit-owned line-item values without derived inventory annotations
  • maps delegated window-open requests to onLinkClick in SwiftUI and checkoutAction(for:) in UIKit, with .open, .handled, and .cancel policies
  • removes the public client argument from ordinary checkout presentation and updates the sample usage

Design notes

The protocol client remains behind the web bridge. Every ECP checkout change notification (buyer, line items, messages, totals, payment, and fulfillment) becomes the same public update event; registration syntax stays native to SwiftUI and UIKit.

The public checkout snapshot does not infer inventory state from protocol messages. lineItems remains a plain array, leaving any interpretation to the consumer.

Window-open requests are similarly abstracted: consumers receive only a validated URL and return a Kit-owned action. .open preserves the default Safari/system behavior, .handled reports success without opening the URL again, and .cancel rejects the request. The default is .open.

The package tests and public API baseline pass. The full Swift test workflow ran all package suites successfully, then stopped because this worktree does not contain generated storefront configuration for sample apps.

Known prototype constraint

CocoaPods currently compiles the generated EmbeddedCheckoutProtocol sources directly into the ShopifyCheckoutKit module. That makes a new top-level Checkout type collide with the generated protocol Checkout type. The draft intentionally keeps the desired API name so the PR can drive a decision: split ECP into its own CocoaPods module, namespace the generated protocol models, or accept a less desirable public name.

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Sep 8, 2026
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