Releases: Shopify/checkout-sheet-kit-swift
Releases · Shopify/checkout-sheet-kit-swift
3.1.2
3.1.1
3.1.0
What's Changed
- Expose
invalidate
function to manually clear preload cache by @markmur in #220 - Prevent recovery for multipass URLs with one-time tokens by @markmur in #226
- Open deep links externally by @markmur in #227
- Ignore cancelled redirects, add OS debug logging by @markmur in #225
Full Changelog: 3.0.4...3.1.0
3.0.4
3.0.3
3.0.2
What's Changed
New Contributors
- @allyshiasewdat made their first contribution in #195
Full Changelog: 3.0.1...3.0.2
3.0.1
3.0.0
Version 3.0.0
of the Checkout Sheet Kit ships with numerous improvements to error handling, including graceful degradation. In the event that your app receives an HTTP error on load or crashes mid-experience, the kit will implement a retry in an effort to attempt to recover.
Error handling
func checkoutDidFail(error: ShopifyCheckoutSheetKit.CheckoutError) {
var errorMessage: String = ""
/// Internal Checkout SDK error
if case .sdkError(let underlying, let recoverable) = error {
errorMessage = "\(underlying.localizedDescription)"
}
/// Checkout unavailable error
if case .checkoutUnavailable(let message, let code, let recoverable) = error {
errorMessage = message
switch code {
case .clientError(let clientErrorCode):
errorMessage = "Client Error: \(clientErrorCode)"
case .httpError(let statusCode):
errorMessage = "HTTP Error: \(statusCode)"
}
}
/// Storefront configuration error
if case .configurationError(let message, let code, let recoverable) = error {
errorMessage = message
}
/// Checkout has expired, re-create cart to fetch a new checkout URL
if case .checkoutExpired(let message, let code, let recoverable) = error {
errorMessage = message
}
if !error.isRecoverable {
handleUnrecoverableError(errorMessage)
}
}
Opting out
To opt out of the recovery feature, or to opt-out of the recovery of a specific error, extend the shouldRecoverFromError
delegate method:
class Controller: CheckoutDelegate {
func shouldRecoverFromError(error: CheckoutError) {
// default:
return error.isRecoverable
// Opt-out of all recovery
return false
}
func checkoutDidFail(error: CheckoutError) {
// Error handling...
}
}
Caveats
In the event that the Checkout Sheet Kit has triggered the recovery experience, certain features may not be available.
- Theming may not work as intended.
- Web pixel lifecycle events will not fire.
checkoutDidComplete
lifecycle events will contain only anorderId
.
Also included
- Improve error handling (HTTP + Bridge events) by @markmur in #156
- Graceful degradation with webview reuse by @markmur in #163
- Bump rexml from 3.2.6 to 3.2.8 in the bundler group across 1 directory by @dependabot in #177
Full Changelog: 2.0.1...3.0.0
3.0.0-beta.5
Full Changelog: 3.0.0-beta.4...3.0.0-beta.5
3.0.0-beta.4
Full Changelog: 3.0.0-beta.3...3.0.0-beta.4