Skip to content

dismiss on unrecoverable#153

Draft
kiftio wants to merge 1 commit into
mainfrom
05-19-dismiss_on_unrecoverable
Draft

dismiss on unrecoverable#153
kiftio wants to merge 1 commit into
mainfrom
05-19-dismiss_on_unrecoverable

Conversation

@kiftio
Copy link
Copy Markdown
Contributor

@kiftio kiftio commented May 19, 2026

What changes are you making?

CONTRIBUTES TO https://github.com/shop/issues-checkout-kit/issues/935

Adds automatic dismissal of the embedded checkout when an ec.error notification carries a message with severity: "unrecoverable". Per the UCP spec, unrecoverable means no valid resource exists to act on, so the kit now handles dismissal by default — consumers no longer need to wire up their own close logic in every error handler.

The behaviour is consistent across all three platforms:

  • Web: In the ec.error case handler, after dispatching checkout:error, the component calls this.close() if any message in the payload has severity === "unrecoverable". Non-fatal severities (recoverable, requires_buyer_input, requires_buyer_review) do not trigger auto-close.
  • Swift: defaultsClient is promoted from a static let to a lazy var on CheckoutWebView so it can capture [weak self]. An ec.error handler is added alongside the existing window.open handler; it calls viewDelegate?.checkoutViewDidFailWithError(...) with recoverable: false when any message is unrecoverable. The consumer's client still runs first; when it returns nil (as notifications always do), the defaultsClient handler fires.
  • Android: defaultDelegationClient is moved from a companion object function to an instance method so it can reference view and view.getEventProcessor(). An ec.error handler is added that calls onCheckoutViewFailedWithError with a non-recoverable ClientException when any message has severity == "unrecoverable". The handleClientMessage fallthrough logic is updated so that when the consumer client returns null, the defaultClient also gets to process the message — allowing both the consumer's typed handler and the kit's default handler to fire for notifications.

How to test

  1. Trigger an ec.error notification with severity: "unrecoverable" from the embedded checkout.
    • Web: Verify checkout:error fires first, then checkout:close fires automatically.
    • Swift: Verify viewDelegate?.checkoutViewDidFailWithError is called with recoverable == false.
    • Android: Verify onCheckoutViewFailedWithError is called with a non-recoverable ClientException.
  2. Trigger ec.error with severity: "recoverable", "requires_buyer_input", or "requires_buyer_review" and confirm no auto-dismissal occurs on any platform.
  3. Register a consumer-side ec.error handler and confirm it still fires before the kit's default handler when severity is unrecoverable, and that both run.
  4. Run the unit test suites for all three platforms — all new and existing tests should pass.

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

kiftio commented May 19, 2026

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

@kiftio kiftio mentioned this pull request May 19, 2026
11 tasks
@kiftio kiftio force-pushed the 05-19-parse_all_error_messages branch from f0930b1 to 46190cc Compare May 19, 2026 14:59
@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch 3 times, most recently from 363462b to ef4d437 Compare May 19, 2026 16:39
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Web — Coverage Report

Lines Statements Branches Functions
Coverage: 98%
98.96% (574/580) 90.53% (153/169) 100% (55/55)

@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch from ef4d437 to ab99908 Compare May 20, 2026 09:25
@kiftio kiftio force-pushed the 05-19-parse_all_error_messages branch 2 times, most recently from 0e821b5 to 587d706 Compare May 20, 2026 09:28
@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch from ab99908 to 157a83e Compare May 20, 2026 09:28
@kiftio kiftio changed the base branch from 05-19-parse_all_error_messages to graphite-base/153 May 20, 2026 09:47
@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch from 157a83e to cefdac4 Compare May 20, 2026 09:47
@kiftio kiftio force-pushed the graphite-base/153 branch from 587d706 to 6156c75 Compare May 20, 2026 09:47
@graphite-app graphite-app Bot changed the base branch from graphite-base/153 to main May 20, 2026 09:48
@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch from cefdac4 to d08ea1b Compare May 20, 2026 09:48
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 95%
95.52% (192/201) 92.3% (108/117) 100% (60/60)

@kiftio kiftio force-pushed the 05-19-dismiss_on_unrecoverable branch from d08ea1b to 0a45550 Compare May 20, 2026 11:10
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