dismiss on unrecoverable#153
Draft
kiftio wants to merge 1 commit into
Draft
Conversation
f0930b1 to
46190cc
Compare
363462b to
ef4d437
Compare
ef4d437 to
ab99908
Compare
0e821b5 to
587d706
Compare
ab99908 to
157a83e
Compare
157a83e to
cefdac4
Compare
cefdac4 to
d08ea1b
Compare
d08ea1b to
0a45550
Compare
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.

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.errornotification carries a message withseverity: "unrecoverable". Per the UCP spec,unrecoverablemeans 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:
ec.errorcase handler, after dispatchingcheckout:error, the component callsthis.close()if any message in the payload hasseverity === "unrecoverable". Non-fatal severities (recoverable,requires_buyer_input,requires_buyer_review) do not trigger auto-close.defaultsClientis promoted from astatic letto alazy varonCheckoutWebViewso it can capture[weak self]. Anec.errorhandler is added alongside the existingwindow.openhandler; it callsviewDelegate?.checkoutViewDidFailWithError(...)withrecoverable: falsewhen any message isunrecoverable. The consumer's client still runs first; when it returnsnil(as notifications always do), thedefaultsClienthandler fires.defaultDelegationClientis moved from acompanion objectfunction to an instance method so it can referenceviewandview.getEventProcessor(). Anec.errorhandler is added that callsonCheckoutViewFailedWithErrorwith a non-recoverableClientExceptionwhen any message hasseverity == "unrecoverable". ThehandleClientMessagefallthrough logic is updated so that when the consumer client returnsnull, thedefaultClientalso 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
ec.errornotification withseverity: "unrecoverable"from the embedded checkout.checkout:errorfires first, thencheckout:closefires automatically.viewDelegate?.checkoutViewDidFailWithErroris called withrecoverable == false.onCheckoutViewFailedWithErroris called with a non-recoverableClientException.ec.errorwithseverity: "recoverable","requires_buyer_input", or"requires_buyer_review"and confirm no auto-dismissal occurs on any platform.ec.errorhandler and confirm it still fires before the kit's default handler when severity isunrecoverable, and that both run.Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.