Skip to content

[Swift] 4.0.0-alpha.5

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 17 Aug 09:24
Immutable release. Only release title and notes can be modified.
08e6494

Breaking changes

Preload failure state includes a diagnostic message

PreloadState.failed now carries a best-effort diagnostic message alongside the failure reason. Pattern matches over the preload state must bind or ignore the new associated value:

 preload?.onStateChange = { state in
-    if case .failed(let reason) = state {
+    if case .failed(let reason, let message) = state {
         discardPreload(reason)
     }
 }

The message is diagnostic context only. It is not a stable, machine-readable value; use FailureReason to determine how to handle the failure.

Preload failure reasons consolidated

PreloadState.FailureReason replaces keepAliveLost and webContentProcessTerminated with a single webContentUnavailable case. Exhaustive switches over preload failures must be updated:

 switch reason {
 case .httpError(let statusCode):
     recordHTTPFailure(statusCode)
 case .navigationFailed:
     recordNavigationFailure()
-case .keepAliveLost, .webContentProcessTerminated, .protocolError:
+case .webContentUnavailable, .protocolError:
     discardPreload()
 }

Renderer termination during a background preload now reports .failed(reason: .webContentUnavailable, ...) instead of keepAliveLost. This applies only to the preload state; CheckoutErrorCode.webContentProcessTerminated for a presented checkout is unchanged.

Removed onMessageRejected from configuration

Configuration.onMessageRejected and the MessageRejection type have been removed:

 ShopifyCheckoutKit.configure {
     $0.allowedMessageOrigins = [
         "https://checkout.example.com",
         "https://*.example.com"
     ]
-    $0.onMessageRejected = { rejection in
-        logger.warning(
-            "Rejected message from \(rejection.origin): \(rejection.reason)"
-        )
-    }
 }

Messages dropped by origin validation are never silently discarded: the SDK logs each rejection as a warning with the trusted origin and reason. The untrusted message body is not logged. allowedMessageOrigins is unchanged.

Additive changes

Stable Apple Pay button selector

The ShopifyAcceleratedCheckouts Apple Pay button now exposes a stable apple-pay-button accessibility identifier, giving UI automation a reliable selector that does not depend on localized button text.

Behaviour changes

window.open links stay in an in-app browser

Links checkout opens via window.open now present web URLs in an in-app SFSafariViewController sheet instead of leaving the app through UIApplication.shared.open. Non-web URLs (mailto:, tel:, app deep links) still open externally. Consumers can override this by handling windowOpen in their own protocol client.

Origin-validation drops are logged as warnings

Rejected checkout messages were previously logged at debug level, invisible at the default logLevel of .warn. They are now logged as warnings, so drops are visible without opting into debug logging. Child-frame messages are ignored at debug level as ambient noise.