diff --git a/platforms/swift/Samples/CheckoutKitSwiftDemo/CheckoutKitSwiftDemo/Sources/CheckoutProtocolClient.swift b/platforms/swift/Samples/CheckoutKitSwiftDemo/CheckoutKitSwiftDemo/Sources/CheckoutProtocolClient.swift index ca311f05..64ee0433 100644 --- a/platforms/swift/Samples/CheckoutKitSwiftDemo/CheckoutKitSwiftDemo/Sources/CheckoutProtocolClient.swift +++ b/platforms/swift/Samples/CheckoutKitSwiftDemo/CheckoutKitSwiftDemo/Sources/CheckoutProtocolClient.swift @@ -1,4 +1,5 @@ import SafariServices +import ShopifyCheckoutKit import ShopifyCheckoutProtocol import UIKit diff --git a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutCommunicationProtocol.swift b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutCommunicationProtocol.swift index 709d9889..6db88436 100644 --- a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutCommunicationProtocol.swift +++ b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutCommunicationProtocol.swift @@ -7,4 +7,4 @@ public protocol CheckoutCommunicationProtocol: Sendable { func process(_ message: String) async -> String? } -extension CheckoutProtocol.Client: CheckoutCommunicationProtocol {} +extension EmbeddedCheckoutProtocol.Client: CheckoutCommunicationProtocol {} diff --git a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutProtocol.swift b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutProtocol.swift new file mode 100644 index 00000000..3ac07ce4 --- /dev/null +++ b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutProtocol.swift @@ -0,0 +1,145 @@ +#if !COCOAPODS + import ShopifyCheckoutProtocol +#endif +import Foundation + +public enum CheckoutProtocol { + public typealias Client = EmbeddedCheckoutProtocol.Client + + public static func url(for url: URL) -> URL { + EmbeddedCheckoutProtocol.url(for: url, delegations: defaultDelegations) + } + + static let defaultDelegations: [String] = ["window.open"] + + static let methodNotFoundCode = -32601 + static let methodNotFoundMessage = "Method not found" + + public static let complete = EmbeddedCheckoutProtocol.Event.complete + public static let error = EmbeddedCheckoutProtocol.Event.error + public static let lineItemsChange = EmbeddedCheckoutProtocol.Event.lineItemsChange + public static let messagesChange = EmbeddedCheckoutProtocol.Event.messagesChange + public static let start = EmbeddedCheckoutProtocol.Event.start + public static let totalsChange = EmbeddedCheckoutProtocol.Event.totalsChange + + static let supportedProtocolMethods: Set = [ + EmbeddedCheckoutProtocol.readyMethod, + start.method, + complete.method, + error.method, + lineItemsChange.method, + messagesChange.method, + totalsChange.method, + windowOpen.method + ] + + static func supportedProtocolMethod(_ message: String) -> String? { + guard + let envelope = try? JSONDecoder().decode(MethodEnvelope.self, from: Data(message.utf8)), + envelope.jsonrpc == "2.0", + supportedProtocolMethods.contains(envelope.method) + else { + return nil + } + + return envelope.method + } + + static func methodNotFoundResponse(forUnsupportedProtocolRequest message: String) -> String? { + guard + let request = try? JSONDecoder().decode(RequestEnvelope.self, from: Data(message.utf8)), + request.jsonrpc == "2.0", + !supportedProtocolMethods.contains(request.method), + let id = request.id + else { + return nil + } + + let response = MethodNotFoundResponse( + id: id, + error: MethodNotFoundError(code: methodNotFoundCode, message: methodNotFoundMessage) + ) + let encoder = JSONEncoder() + encoder.outputFormatting = [.sortedKeys] + guard let data = try? encoder.encode(response) else { return nil } + return String(data: data, encoding: .utf8) + } +} + +private struct MethodEnvelope: Decodable { + let jsonrpc: String + let method: String +} + +private struct RequestEnvelope: Decodable { + let jsonrpc: String + let method: String + let id: RequestID? + + private enum CodingKeys: String, CodingKey { + case jsonrpc + case method + case id + } + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + jsonrpc = try container.decode(String.self, forKey: .jsonrpc) + method = try container.decode(String.self, forKey: .method) + if container.contains(.id) { + id = try container.decode(RequestID.self, forKey: .id) + } else { + id = nil + } + } +} + +enum RequestID: Codable, Equatable { + case string(String) + case int(Int64) + case null + + init(from decoder: Decoder) throws { + let container = try decoder.singleValueContainer() + + if container.decodeNil() { + self = .null + } else if let value = try? container.decode(String.self) { + self = .string(value) + } else if let value = try? container.decode(Int64.self) { + self = .int(value) + } else { + throw DecodingError.typeMismatch( + RequestID.self, + DecodingError.Context( + codingPath: decoder.codingPath, + debugDescription: "JSON-RPC id must be a string, integer, or null" + ) + ) + } + } + + func encode(to encoder: Encoder) throws { + var container = encoder.singleValueContainer() + + switch self { + case let .string(value): + try container.encode(value) + case let .int(value): + try container.encode(value) + case .null: + try container.encodeNil() + } + } +} + +private struct MethodNotFoundResponse: Encodable { + let jsonrpc = "2.0" + let id: RequestID + let error: MethodNotFoundError +} + +private struct MethodNotFoundError: Encodable { + let code: Int + let message: String +} diff --git a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutWebView.swift b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutWebView.swift index 8b12c432..06635530 100644 --- a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutWebView.swift +++ b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutWebView.swift @@ -230,7 +230,7 @@ class CheckoutWebView: WKWebView { /// the kit via `viewDelegate`. Per UCP spec, `unrecoverable` means no valid /// resource exists to act on, so consumers don't have to wire dismissal in /// every error handler. - lazy var defaultsClient: CheckoutProtocol.Client = .init() + lazy var defaultsClient: EmbeddedCheckoutProtocol.Client = .init() .on(CheckoutProtocol.complete) { _ in CheckoutWebView.invalidate(disconnect: false) } @@ -458,7 +458,9 @@ extension CheckoutWebView: WKScriptMessageHandler { return } - if method == CheckoutProtocol.readyMethod, let response = CheckoutProtocol.acknowledgeReady(body) { + if method == EmbeddedCheckoutProtocol.readyMethod, + let response = EmbeddedCheckoutProtocol.acknowledgeReady(body, supportedDelegations: CheckoutProtocol.defaultDelegations) + { OSLogger.shared.debug("Handling ec.ready: sending UCP ready acknowledgement, isPreload: \(isPreloadRequest)") Task { @MainActor in await checkoutBridge.sendResponse(self, messageBody: response) diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/WindowOpen.swift b/platforms/swift/Sources/ShopifyCheckoutKit/WindowOpen.swift similarity index 77% rename from protocol/languages/swift/Sources/ShopifyCheckoutProtocol/WindowOpen.swift rename to platforms/swift/Sources/ShopifyCheckoutKit/WindowOpen.swift index 213e15eb..a0838cb5 100644 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/WindowOpen.swift +++ b/platforms/swift/Sources/ShopifyCheckoutKit/WindowOpen.swift @@ -1,3 +1,6 @@ +#if !COCOAPODS + import ShopifyCheckoutProtocol +#endif import Foundation public struct WindowOpenRequest: EventPayload { @@ -37,12 +40,12 @@ public enum WindowOpenResult: ResponsePayload { public func encode(to encoder: Encoder) throws { switch self { case .success: - try UCPSuccessResult( - ucp: UCPSuccess(version: CheckoutProtocol.specVersion) + try WindowOpenSuccessBody( + ucp: WindowOpenUCP(version: EmbeddedCheckoutProtocol.specVersion, status: "success") ).encode(to: encoder) case let .rejected(reason): try WindowOpenRejectedBody( - ucp: UCPError(version: CheckoutProtocol.specVersion), + ucp: WindowOpenUCP(version: EmbeddedCheckoutProtocol.specVersion, status: "error"), messages: [ WindowOpenRejectedMessage(content: reason ?? "Window open rejected") ] @@ -53,7 +56,7 @@ public enum WindowOpenResult: ResponsePayload { extension CheckoutProtocol { public static let windowOpen = DelegationDescriptor( - method: "ec.window.open_request", + method: EmbeddedCheckoutProtocol.Event.windowOpenRequest.method, delegation: "window.open", decode: { params in try? JSONDecoder().decode(WindowOpenRequest.self, from: params) @@ -61,8 +64,17 @@ extension CheckoutProtocol { ) } +private struct WindowOpenUCP: Encodable { + let version: String + let status: String +} + +private struct WindowOpenSuccessBody: Encodable { + let ucp: WindowOpenUCP +} + private struct WindowOpenRejectedBody: Encodable { - let ucp: UCPError + let ucp: WindowOpenUCP let messages: [WindowOpenRejectedMessage] } diff --git a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutProtocolTests.swift b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutProtocolTests.swift new file mode 100644 index 00000000..85e15b31 --- /dev/null +++ b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutProtocolTests.swift @@ -0,0 +1,157 @@ +import Foundation +#if !COCOAPODS + import ShopifyCheckoutProtocol +#endif +@testable import ShopifyCheckoutKit +import Testing + +@Suite("Embedded Checkout Protocol Curation") +struct CheckoutProtocolTests { + @Test func defaultDelegationsAdvertiseWindowOpen() { + #expect(CheckoutProtocol.defaultDelegations == ["window.open"]) + } + + @Test func supportedProtocolMethodsCoverReadyCuratedNotificationsAndWindowOpen() { + #expect(CheckoutProtocol.supportedProtocolMethods == [ + EmbeddedCheckoutProtocol.readyMethod, + "ec.start", + "ec.complete", + "ec.error", + "ec.line_items.change", + "ec.messages.change", + "ec.totals.change", + "ec.window.open_request" + ]) + } + + @Test func supportedProtocolMethodsExcludeUncuratedCatalogMethods() { + #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ec.payment.credential_request")) + #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ec.fulfillment.change")) + #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ep.cart.ready")) + } + + @Test func supportedProtocolMethodParsesValidSupportedMessage() { + let message = #"{"jsonrpc":"2.0","method":"ec.start","params":{"checkout":{}}}"# + #expect(CheckoutProtocol.supportedProtocolMethod(message) == "ec.start") + } + + @Test func supportedProtocolMethodRejectsUnsupportedOrInvalidMessage() { + #expect(CheckoutProtocol.supportedProtocolMethod(#"{"jsonrpc":"2.0","method":"custom"}"#) == nil) + #expect(CheckoutProtocol.supportedProtocolMethod(#"{"jsonrpc":"1.0","method":"ec.start"}"#) == nil) + #expect(CheckoutProtocol.supportedProtocolMethod("not json") == nil) + } + + @Test func methodNotFoundResponseEncodesUnsupportedRequests() throws { + let response = try #require( + CheckoutProtocol.methodNotFoundResponse( + forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":"unsupported","params":{}}"# + ) + ) + let object = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) + + #expect(object["jsonrpc"] as? String == "2.0") + #expect(object["id"] as? String == "unsupported") + let error = try #require(object["error"] as? [String: Any]) + #expect(error["code"] as? Int == CheckoutProtocol.methodNotFoundCode) + #expect(error["message"] as? String == CheckoutProtocol.methodNotFoundMessage) + } + + @Test func methodNotFoundResponsePreservesNumericRequestID() throws { + let response = try #require( + CheckoutProtocol.methodNotFoundResponse( + forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":7,"params":{}}"# + ) + ) + let object = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) + #expect(object["id"] as? Int == 7) + } + + @Test func methodNotFoundResponsePreservesNullRequestID() throws { + let response = try #require( + CheckoutProtocol.methodNotFoundResponse( + forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":null,"params":{}}"# + ) + ) + let object = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) + #expect(object["id"] is NSNull) + } + + @Test func methodNotFoundResponseRejectsInvalidRequestIDs() { + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":true,"params":{}}"#) == nil) + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":{},"params":{}}"#) == nil) + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":1.5,"params":{}}"#) == nil) + } + + @Test func methodNotFoundResponseRejectsSupportedNotificationsOrInvalidMessages() { + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom"}"#) == nil) + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"ec.start","id":"supported"}"#) == nil) + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"1.0","method":"custom","id":"unsupported"}"#) == nil) + #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: "not json") == nil) + } +} + +@Suite("Window Open Delegation") +struct WindowOpenDelegationTests { + @Test func descriptorBindsWindowOpenMethodAndDelegation() { + #expect(CheckoutProtocol.windowOpen.method == "ec.window.open_request") + #expect(CheckoutProtocol.windowOpen.delegation == "window.open") + } + + @Test func requestPayloadDecodesValidURL() throws { + let payload = try JSONDecoder().decode( + WindowOpenRequest.self, + from: Data(#"{"url":"https://example.com/terms"}"#.utf8) + ) + #expect(payload.url == URL(string: "https://example.com/terms")) + } + + @Test func requestPayloadRejectsEmptyURL() { + #expect((try? JSONDecoder().decode(WindowOpenRequest.self, from: Data(#"{"url":""}"#.utf8))) == nil) + } + + @Test func requestPayloadRejectsMissingURL() { + #expect((try? JSONDecoder().decode(WindowOpenRequest.self, from: Data("{}".utf8))) == nil) + } + + @Test func requestPayloadRejectsNullURL() { + #expect((try? JSONDecoder().decode(WindowOpenRequest.self, from: Data(#"{"url":null}"#.utf8))) == nil) + } + + private struct EncodingFailure: Error {} + + private func encode(_ result: WindowOpenResult) throws -> [String: Any] { + let encoder = JSONEncoder() + encoder.outputFormatting = [.sortedKeys] + let data = try encoder.encode(result) + guard let object = try JSONSerialization.jsonObject(with: data) as? [String: Any] else { + throw EncodingFailure() + } + return object + } + + @Test func resultEncodesSuccessBody() throws { + let body = try encode(.success) + let ucp = try #require(body["ucp"] as? [String: Any]) + #expect(ucp["status"] as? String == "success") + #expect(ucp["version"] as? String == EmbeddedCheckoutProtocol.specVersion) + } + + @Test func resultEncodesRejectedBody() throws { + let body = try encode(.rejected(reason: "canOpenURL returned false")) + let ucp = try #require(body["ucp"] as? [String: Any]) + #expect(ucp["status"] as? String == "error") + + let messages = try #require(body["messages"] as? [[String: Any]]) + #expect(messages.count == 1) + #expect(messages[0]["type"] as? String == "error") + #expect(messages[0]["code"] as? String == "window_open_rejected_error") + #expect(messages[0]["severity"] as? String == "unrecoverable") + #expect(messages[0]["content"] as? String == "canOpenURL returned false") + } + + @Test func resultEncodesRejectedWithNilReason() throws { + let body = try encode(.rejected(reason: nil)) + let messages = try #require(body["messages"] as? [[String: Any]]) + #expect(messages[0]["content"] as? String != "") + } +} diff --git a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewControllerTests.swift b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewControllerTests.swift index 2666ebee..67fcbc2e 100644 --- a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewControllerTests.swift +++ b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewControllerTests.swift @@ -75,7 +75,7 @@ class CheckoutWebViewControllerTests: XCTestCase { func test_presentationControllerDidDismiss_doesNotCleanUpBeforeViewDisappears() throws { ShopifyCheckoutKit.configuration.preloading.enabled = true ShopifyCheckoutKit.preload(checkout: url) - let viewController = TestableCheckoutWebViewController(checkoutURL: CheckoutProtocol.url(for: url), entryPoint: nil) + let viewController = TestableCheckoutWebViewController(checkoutURL: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations), entryPoint: nil) viewController.loadViewIfNeeded() let checkoutView = try XCTUnwrap(viewController.checkoutView) @@ -93,7 +93,7 @@ class CheckoutWebViewControllerTests: XCTestCase { func test_viewDidDisappear_cleansUpConsumedPreloadedWebViewWhenDismissed() throws { ShopifyCheckoutKit.configuration.preloading.enabled = true ShopifyCheckoutKit.preload(checkout: url) - let viewController = TestableCheckoutWebViewController(checkoutURL: CheckoutProtocol.url(for: url), entryPoint: nil) + let viewController = TestableCheckoutWebViewController(checkoutURL: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations), entryPoint: nil) viewController.loadViewIfNeeded() let checkoutView = try XCTUnwrap(viewController.checkoutView) diff --git a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift index 4894c9f8..45c9cb3b 100644 --- a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift +++ b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift @@ -276,7 +276,7 @@ class CheckoutWebViewTests: XCTestCase { XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) XCTAssertTrue(CheckoutWebView.preloadCache.hasActiveKeepAlive()) - let cached = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) + let cached = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations)) XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) XCTAssertFalse(CheckoutWebView.preloadCache.hasActiveKeepAlive()) @@ -286,7 +286,7 @@ class CheckoutWebViewTests: XCTestCase { func testRepeatedPreloadForMatchingCheckoutDoesNotReloadCachedWebView() { let webView = LoadedRequestObservableWebView() - let checkoutURL = CheckoutProtocol.url(for: url) + let checkoutURL = EmbeddedCheckoutProtocol.url(for: url) _ = CheckoutWebView.preloadCache.store(webView, for: PreloadKey(url: checkoutURL, entryPoint: nil)) CheckoutWebView.preload(checkout: checkoutURL) @@ -297,8 +297,8 @@ class CheckoutWebViewTests: XCTestCase { func testPresentingMatchingCheckoutReusesCachedWebViewWithoutEvictingIt() { ShopifyCheckoutKit.preload(checkout: url) - let first = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) - let second = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) + let first = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations)) + let second = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations)) XCTAssertTrue(first === second) XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) @@ -308,7 +308,7 @@ class CheckoutWebViewTests: XCTestCase { ShopifyCheckoutKit.preload(checkout: url) let otherURL = try XCTUnwrap(URL(string: "http://shopify1.shopify.com/checkouts/cn/456")) - let fresh = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: otherURL)) + let fresh = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: otherURL)) XCTAssertNil(fresh.url) XCTAssertFalse(CheckoutWebView.preloadCache.hasEntry()) @@ -316,9 +316,9 @@ class CheckoutWebViewTests: XCTestCase { } func testPresentWithDifferentEntryPointDoesNotReusePreloadedWebView() { - CheckoutWebView.preload(checkout: CheckoutProtocol.url(for: url), entryPoint: .acceleratedCheckouts) + CheckoutWebView.preload(checkout: EmbeddedCheckoutProtocol.url(for: url), entryPoint: .acceleratedCheckouts) - let fresh = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url), entryPoint: nil) + let fresh = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url), entryPoint: nil) XCTAssertNil(fresh.url) XCTAssertFalse(CheckoutWebView.preloadCache.hasEntry()) @@ -338,12 +338,12 @@ class CheckoutWebViewTests: XCTestCase { func testStalePreloadCacheIsRejectedImmediately() { let staleCreatedAt = Date(timeIntervalSinceNow: -6 * 60) - CheckoutWebView.preload(checkout: CheckoutProtocol.url(for: url), createdAt: staleCreatedAt) + CheckoutWebView.preload(checkout: EmbeddedCheckoutProtocol.url(for: url), createdAt: staleCreatedAt) XCTAssertFalse(CheckoutWebView.preloadCache.hasEntry()) XCTAssertFalse(CheckoutWebView.preloadCache.hasActiveKeepAlive()) - let fresh = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) + let fresh = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url)) XCTAssertNil(fresh.url) XCTAssertTrue(fresh.isBridgeAttached) @@ -353,7 +353,7 @@ class CheckoutWebViewTests: XCTestCase { func testPreloadCacheExpiresAndStopsKeepAlive() { let nearlyStaleCreatedAt = Date(timeIntervalSinceNow: -(5 * 60 - 0.1)) - CheckoutWebView.preload(checkout: CheckoutProtocol.url(for: url), createdAt: nearlyStaleCreatedAt) + CheckoutWebView.preload(checkout: EmbeddedCheckoutProtocol.url(for: url), createdAt: nearlyStaleCreatedAt) XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) XCTAssertTrue(CheckoutWebView.preloadCache.hasActiveKeepAlive()) @@ -378,7 +378,7 @@ class CheckoutWebViewTests: XCTestCase { func testPreloadKeepAliveFailureInvalidatesCache() { let webView = ThrowingEvaluateJavaScriptWebView() - _ = CheckoutWebView.preloadCache.store(webView, for: PreloadKey(url: CheckoutProtocol.url(for: url), entryPoint: nil)) + _ = CheckoutWebView.preloadCache.store(webView, for: PreloadKey(url: EmbeddedCheckoutProtocol.url(for: url), entryPoint: nil)) XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) XCTAssertTrue(CheckoutWebView.preloadCache.hasActiveKeepAlive()) @@ -403,7 +403,7 @@ class CheckoutWebViewTests: XCTestCase { func testInvalidateDetachesCachedPreloadedWebView() { ShopifyCheckoutKit.preload(checkout: url) - let cached = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) + let cached = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations)) XCTAssertTrue(cached.isBridgeAttached) ShopifyCheckoutKit.invalidate() @@ -414,7 +414,7 @@ class CheckoutWebViewTests: XCTestCase { func testHTTPErrorInvalidatesPreloadCache() throws { ShopifyCheckoutKit.preload(checkout: url) - let cached = CheckoutWebView.for(checkout: CheckoutProtocol.url(for: url)) + let cached = CheckoutWebView.for(checkout: EmbeddedCheckoutProtocol.url(for: url, delegations: CheckoutProtocol.defaultDelegations)) let link = try XCTUnwrap(cached.url) let response = try XCTUnwrap(HTTPURLResponse(url: link, statusCode: 403, httpVersion: nil, headerFields: nil)) @@ -536,7 +536,7 @@ class CheckoutWebViewTests: XCTestCase { let result = try XCTUnwrap(parsed["result"] as? [String: Any]) let ucp = try XCTUnwrap(result["ucp"] as? [String: Any]) XCTAssertEqual(ucp["status"] as? String, "success") - XCTAssertEqual(ucp["version"] as? String, CheckoutProtocol.specVersion) + XCTAssertEqual(ucp["version"] as? String, EmbeddedCheckoutProtocol.specVersion) } @MainActor @@ -707,7 +707,7 @@ class CheckoutWebViewTests: XCTestCase { let body = #"{"jsonrpc":"2.0","method":"ec.window.open_request","id":"\#(id)","params":{"url":"https://example.com/terms"}}"# let responseSent = expectation(description: "response sent") MockCheckoutBridge.sendResponseExpectation = responseSent - view.client = CheckoutProtocol.Client() + view.client = EmbeddedCheckoutProtocol.Client() .on(CheckoutProtocol.windowOpen) { _ in .rejected(reason: "consumer override") } @@ -772,7 +772,7 @@ class CheckoutWebViewTests: XCTestCase { /// and bypass the handler entirely. private func ecErrorBody(severity: String) -> String { return """ - {"jsonrpc":"2.0","method":"ec.error","params":{"error":{"ucp":{"status":"error","version":"\(CheckoutProtocol.specVersion)"},"messages":[{"type":"error","code":"session_failed","content":"Session failed","severity":"\(severity)"}]}}} + {"jsonrpc":"2.0","method":"ec.error","params":{"error":{"ucp":{"status":"error","version":"\(EmbeddedCheckoutProtocol.specVersion)"},"messages":[{"type":"error","code":"session_failed","content":"Session failed","severity":"\(severity)"}]}}} """ } @@ -840,7 +840,7 @@ class CheckoutWebViewTests: XCTestCase { let consumerHandlerFired = expectation(description: "consumer handler fired") let dismissed = expectation(description: "viewDelegate received failure") mockDelegate.didFailWithErrorExpectation = dismissed - view.client = CheckoutProtocol.Client() + view.client = EmbeddedCheckoutProtocol.Client() .on(CheckoutProtocol.error) { _ in consumerHandlerFired.fulfill() } diff --git a/platforms/swift/api/ShopifyCheckoutKit.json b/platforms/swift/api/ShopifyCheckoutKit.json index 217349a5..046119f4 100644 --- a/platforms/swift/api/ShopifyCheckoutKit.json +++ b/platforms/swift/api/ShopifyCheckoutKit.json @@ -1062,6 +1062,545 @@ } ] }, + { + "kind": "TypeDecl", + "name": "CheckoutProtocol", + "printedName": "CheckoutProtocol", + "children": [ + { + "kind": "TypeAlias", + "name": "Client", + "printedName": "Client", + "children": [ + { + "kind": "TypeNominal", + "name": "Client", + "printedName": "ShopifyCheckoutProtocol.EmbeddedCheckoutProtocol.Client", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV" + } + ], + "declKind": "TypeAlias", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO6Clienta", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO6Clienta", + "moduleName": "ShopifyCheckoutKit" + }, + { + "kind": "Function", + "name": "url", + "printedName": "url(for:)", + "children": [ + { + "kind": "TypeNominal", + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" + }, + { + "kind": "TypeNominal", + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" + } + ], + "declKind": "Func", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO3url3for10Foundation3URLVAH_tFZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO3url3for10Foundation3URLVAH_tFZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "funcSelfKind": "NonMutating" + }, + { + "kind": "Var", + "name": "complete", + "printedName": "complete", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO8complete0abD022NotificationDescriptorVyAE0B0VGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO8complete0abD022NotificationDescriptorVyAE0B0VGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO8complete0abD022NotificationDescriptorVyAE0B0VGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO8complete0abD022NotificationDescriptorVyAE0B0VGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "error", + "printedName": "error", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "ErrorResponse", + "printedName": "ShopifyCheckoutProtocol.ErrorResponse", + "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO5error0abD022NotificationDescriptorVyAE13ErrorResponseVGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO5error0abD022NotificationDescriptorVyAE13ErrorResponseVGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "ErrorResponse", + "printedName": "ShopifyCheckoutProtocol.ErrorResponse", + "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO5error0abD022NotificationDescriptorVyAE13ErrorResponseVGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO5error0abD022NotificationDescriptorVyAE13ErrorResponseVGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "lineItemsChange", + "printedName": "lineItemsChange", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO15lineItemsChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO15lineItemsChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO15lineItemsChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO15lineItemsChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "messagesChange", + "printedName": "messagesChange", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO14messagesChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO14messagesChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO14messagesChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO14messagesChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "start", + "printedName": "start", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO5start0abD022NotificationDescriptorVyAE0B0VGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO5start0abD022NotificationDescriptorVyAE0B0VGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO5start0abD022NotificationDescriptorVyAE0B0VGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO5start0abD022NotificationDescriptorVyAE0B0VGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "totalsChange", + "printedName": "totalsChange", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO12totalsChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO12totalsChange0abD022NotificationDescriptorVyAE0B0VGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO12totalsChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO12totalsChange0abD022NotificationDescriptorVyAE0B0VGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "windowOpen", + "printedName": "windowOpen", + "children": [ + { + "kind": "TypeNominal", + "name": "DelegationDescriptor", + "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenRequest", + "printedName": "ShopifyCheckoutKit.WindowOpenRequest", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV" + }, + { + "kind": "TypeNominal", + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + } + ], + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO10windowOpen0abD020DelegationDescriptorVyAA06WindowF7RequestVAA0iF6ResultOGvpZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO10windowOpen0abD020DelegationDescriptorVyAA06WindowF7RequestVAA0iF6ResultOGvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isFromExtension": true, + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "DelegationDescriptor", + "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenRequest", + "printedName": "ShopifyCheckoutKit.WindowOpenRequest", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV" + }, + { + "kind": "TypeNominal", + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + } + ], + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO10windowOpen0abD020DelegationDescriptorVyAA06WindowF7RequestVAA0iF6ResultOGvgZ", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO10windowOpen0abD020DelegationDescriptorVyAA06WindowF7RequestVAA0iF6ResultOGvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "isFromExtension": true, + "accessorKind": "get" + } + ] + } + ], + "declKind": "Enum", + "usr": "s:18ShopifyCheckoutKit0B8ProtocolO", + "mangledName": "$s18ShopifyCheckoutKit0B8ProtocolO", + "moduleName": "ShopifyCheckoutKit", + "isEnumExhaustive": true, + "conformances": [ + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] + }, { "kind": "TypeDecl", "name": "CheckoutURL", @@ -5984,37 +6523,211 @@ }, { "kind": "TypeDecl", - "name": "SwiftVersion", - "printedName": "SwiftVersion", + "name": "SwiftVersion", + "printedName": "SwiftVersion", + "children": [ + { + "kind": "Var", + "name": "current", + "printedName": "current", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Swift.String?", + "children": [ + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + } + ], + "usr": "s:Sq" + } + ], + "declKind": "Var", + "usr": "s:18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvpZ", + "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvpZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "isInternal": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Swift.String?", + "children": [ + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + } + ], + "usr": "s:Sq" + } + ], + "declKind": "Accessor", + "usr": "s:18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvgZ", + "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvgZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "implicit": true, + "isInternal": true, + "accessorKind": "get" + } + ] + } + ], + "declKind": "Enum", + "usr": "s:18ShopifyCheckoutKit12SwiftVersionO", + "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO", + "moduleName": "ShopifyCheckoutKit", + "isInternal": true, + "isEnumExhaustive": true, + "conformances": [ + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + } + ] + }, + { + "kind": "TypeDecl", + "name": "UserAgent", + "printedName": "UserAgent", + "children": [ + { + "kind": "Function", + "name": "string", + "printedName": "string(platform:entryPoint:)", + "children": [ + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + }, + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "ShopifyCheckoutKit.Platform?", + "children": [ + { + "kind": "TypeNominal", + "name": "Platform", + "printedName": "ShopifyCheckoutKit.Platform", + "usr": "s:18ShopifyCheckoutKit8PlatformV" + } + ], + "hasDefaultArg": true, + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "ShopifyCheckoutKit.MetaData.EntryPoint?", + "children": [ + { + "kind": "TypeNominal", + "name": "EntryPoint", + "printedName": "ShopifyCheckoutKit.MetaData.EntryPoint", + "usr": "s:18ShopifyCheckoutKit8MetaDataO10EntryPointO" + } + ], + "hasDefaultArg": true, + "usr": "s:Sq" + } + ], + "declKind": "Func", + "usr": "s:18ShopifyCheckoutKit9UserAgentO6string8platform10entryPointSSAA8PlatformVSg_AA8MetaDataO05EntryI0OSgtFZ", + "mangledName": "$s18ShopifyCheckoutKit9UserAgentO6string8platform10entryPointSSAA8PlatformVSg_AA8MetaDataO05EntryI0OSgtFZ", + "moduleName": "ShopifyCheckoutKit", + "static": true, + "isInternal": true, + "funcSelfKind": "NonMutating" + } + ], + "declKind": "Enum", + "usr": "s:18ShopifyCheckoutKit9UserAgentO", + "mangledName": "$s18ShopifyCheckoutKit9UserAgentO", + "moduleName": "ShopifyCheckoutKit", + "isEnumExhaustive": true, + "conformances": [ + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] + }, + { + "kind": "TypeDecl", + "name": "WindowOpenRequest", + "printedName": "WindowOpenRequest", "children": [ { "kind": "Var", - "name": "current", - "printedName": "current", + "name": "url", + "printedName": "url", "children": [ { "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sq" + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" } ], "declKind": "Var", - "usr": "s:18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvpZ", - "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvpZ", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV3url10Foundation3URLVvp", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV3url10Foundation3URLVvp", "moduleName": "ShopifyCheckoutKit", - "static": true, - "isInternal": true, "declAttributes": [ - "HasInitialValue", "HasStorage" ], "isLet": true, @@ -6027,38 +6740,116 @@ "children": [ { "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sq" + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" } ], "declKind": "Accessor", - "usr": "s:18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvgZ", - "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO7currentSSSgvgZ", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV3url10Foundation3URLVvg", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV3url10Foundation3URLVvg", "moduleName": "ShopifyCheckoutKit", - "static": true, "implicit": true, - "isInternal": true, + "declAttributes": [ + "Transparent" + ], "accessorKind": "get" } ] + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(url:)", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenRequest", + "printedName": "ShopifyCheckoutKit.WindowOpenRequest", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV" + }, + { + "kind": "TypeNominal", + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" + } + ], + "declKind": "Constructor", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV3urlAC10Foundation3URLV_tcfc", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV3urlAC10Foundation3URLV_tcfc", + "moduleName": "ShopifyCheckoutKit", + "init_kind": "Designated" + }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(from:)", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenRequest", + "printedName": "ShopifyCheckoutKit.WindowOpenRequest", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV" + }, + { + "kind": "TypeNominal", + "name": "Decoder", + "printedName": "any Swift.Decoder", + "usr": "s:s7DecoderP" + } + ], + "declKind": "Constructor", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV4fromACs7Decoder_p_tKcfc", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV4fromACs7Decoder_p_tKcfc", + "moduleName": "ShopifyCheckoutKit", + "throwing": true, + "init_kind": "Designated" + }, + { + "kind": "Function", + "name": "encode", + "printedName": "encode(to:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Void", + "printedName": "()" + }, + { + "kind": "TypeNominal", + "name": "Encoder", + "printedName": "any Swift.Encoder", + "usr": "s:s7EncoderP" + } + ], + "declKind": "Func", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV6encode2toys7Encoder_p_tKF", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV6encode2toys7Encoder_p_tKF", + "moduleName": "ShopifyCheckoutKit", + "throwing": true, + "funcSelfKind": "NonMutating" } ], - "declKind": "Enum", - "usr": "s:18ShopifyCheckoutKit12SwiftVersionO", - "mangledName": "$s18ShopifyCheckoutKit12SwiftVersionO", + "declKind": "Struct", + "usr": "s:18ShopifyCheckoutKit17WindowOpenRequestV", + "mangledName": "$s18ShopifyCheckoutKit17WindowOpenRequestV", "moduleName": "ShopifyCheckoutKit", - "isInternal": true, - "isEnumExhaustive": true, "conformances": [ + { + "kind": "Conformance", + "name": "EventPayload", + "printedName": "EventPayload", + "usr": "s:23ShopifyCheckoutProtocol12EventPayloadP", + "mangledName": "$s23ShopifyCheckoutProtocol12EventPayloadP" + }, + { + "kind": "Conformance", + "name": "Decodable", + "printedName": "Decodable", + "usr": "s:Se", + "mangledName": "$sSe" + }, { "kind": "Conformance", "name": "Sendable", @@ -6066,6 +6857,13 @@ "usr": "s:s8SendableP", "mangledName": "$ss8SendableP" }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, { "kind": "Conformance", "name": "Copyable", @@ -6079,78 +6877,175 @@ "printedName": "Escapable", "usr": "s:s9EscapableP", "mangledName": "$ss9EscapableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" } ] }, { "kind": "TypeDecl", - "name": "UserAgent", - "printedName": "UserAgent", + "name": "WindowOpenResult", + "printedName": "WindowOpenResult", "children": [ { - "kind": "Function", - "name": "string", - "printedName": "string(platform:entryPoint:)", + "kind": "Var", + "name": "success", + "printedName": "success", "children": [ { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - }, - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "ShopifyCheckoutKit.Platform?", + "kind": "TypeFunc", + "name": "Function", + "printedName": "(ShopifyCheckoutKit.WindowOpenResult.Type) -> ShopifyCheckoutKit.WindowOpenResult", "children": [ { "kind": "TypeNominal", - "name": "Platform", - "printedName": "ShopifyCheckoutKit.Platform", - "usr": "s:18ShopifyCheckoutKit8PlatformV" + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + }, + { + "kind": "TypeNominal", + "name": "Metatype", + "printedName": "ShopifyCheckoutKit.WindowOpenResult.Type", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + } + ] } - ], - "hasDefaultArg": true, - "usr": "s:Sq" - }, + ] + } + ], + "declKind": "EnumElement", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO7successyA2CmF", + "mangledName": "$s18ShopifyCheckoutKit16WindowOpenResultO7successyA2CmF", + "moduleName": "ShopifyCheckoutKit" + }, + { + "kind": "Var", + "name": "rejected", + "printedName": "rejected", + "children": [ { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "ShopifyCheckoutKit.MetaData.EntryPoint?", + "kind": "TypeFunc", + "name": "Function", + "printedName": "(ShopifyCheckoutKit.WindowOpenResult.Type) -> (Swift.String?) -> ShopifyCheckoutKit.WindowOpenResult", "children": [ + { + "kind": "TypeFunc", + "name": "Function", + "printedName": "(Swift.String?) -> ShopifyCheckoutKit.WindowOpenResult", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + }, + { + "kind": "TypeNominal", + "name": "Tuple", + "printedName": "(reason: Swift.String?)", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Swift.String?", + "children": [ + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + } + ], + "usr": "s:Sq" + } + ] + } + ] + }, { "kind": "TypeNominal", - "name": "EntryPoint", - "printedName": "ShopifyCheckoutKit.MetaData.EntryPoint", - "usr": "s:18ShopifyCheckoutKit8MetaDataO10EntryPointO" + "name": "Metatype", + "printedName": "ShopifyCheckoutKit.WindowOpenResult.Type", + "children": [ + { + "kind": "TypeNominal", + "name": "WindowOpenResult", + "printedName": "ShopifyCheckoutKit.WindowOpenResult", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO" + } + ] } - ], - "hasDefaultArg": true, - "usr": "s:Sq" + ] + } + ], + "declKind": "EnumElement", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO8rejectedyACSSSg_tcACmF", + "mangledName": "$s18ShopifyCheckoutKit16WindowOpenResultO8rejectedyACSSSg_tcACmF", + "moduleName": "ShopifyCheckoutKit" + }, + { + "kind": "Function", + "name": "encode", + "printedName": "encode(to:)", + "children": [ + { + "kind": "TypeNominal", + "name": "Void", + "printedName": "()" + }, + { + "kind": "TypeNominal", + "name": "Encoder", + "printedName": "any Swift.Encoder", + "usr": "s:s7EncoderP" } ], "declKind": "Func", - "usr": "s:18ShopifyCheckoutKit9UserAgentO6string8platform10entryPointSSAA8PlatformVSg_AA8MetaDataO05EntryI0OSgtFZ", - "mangledName": "$s18ShopifyCheckoutKit9UserAgentO6string8platform10entryPointSSAA8PlatformVSg_AA8MetaDataO05EntryI0OSgtFZ", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO6encode2toys7Encoder_p_tKF", + "mangledName": "$s18ShopifyCheckoutKit16WindowOpenResultO6encode2toys7Encoder_p_tKF", "moduleName": "ShopifyCheckoutKit", - "static": true, - "isInternal": true, + "throwing": true, "funcSelfKind": "NonMutating" } ], "declKind": "Enum", - "usr": "s:18ShopifyCheckoutKit9UserAgentO", - "mangledName": "$s18ShopifyCheckoutKit9UserAgentO", + "usr": "s:18ShopifyCheckoutKit16WindowOpenResultO", + "mangledName": "$s18ShopifyCheckoutKit16WindowOpenResultO", "moduleName": "ShopifyCheckoutKit", "isEnumExhaustive": true, "conformances": [ + { + "kind": "Conformance", + "name": "ResponsePayload", + "printedName": "ResponsePayload", + "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", + "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP" + }, + { + "kind": "Conformance", + "name": "Encodable", + "printedName": "Encodable", + "usr": "s:SE", + "mangledName": "$sSE" + }, + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, { "kind": "Conformance", "name": "Copyable", @@ -6172,8 +7067,8 @@ "name": "Client", "printedName": "Client", "declKind": "Struct", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientV", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV", "moduleName": "ShopifyCheckoutProtocol", "isFromExtension": true, "isExternal": true, diff --git a/platforms/swift/api/ShopifyCheckoutProtocol.json b/platforms/swift/api/ShopifyCheckoutProtocol.json index 15d3f7bd..84a25a1d 100644 --- a/platforms/swift/api/ShopifyCheckoutProtocol.json +++ b/platforms/swift/api/ShopifyCheckoutProtocol.json @@ -41,13 +41,107 @@ }, { "kind": "TypeDecl", - "name": "CheckoutProtocol", - "printedName": "CheckoutProtocol", + "name": "EventPayload", + "printedName": "EventPayload", + "declKind": "Protocol", + "usr": "s:23ShopifyCheckoutProtocol12EventPayloadP", + "mangledName": "$s23ShopifyCheckoutProtocol12EventPayloadP", + "moduleName": "ShopifyCheckoutProtocol", + "genericSig": "", + "conformances": [ + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, + { + "kind": "Conformance", + "name": "Decodable", + "printedName": "Decodable", + "usr": "s:Se", + "mangledName": "$sSe" + } + ] + }, + { + "kind": "TypeDecl", + "name": "ResponsePayload", + "printedName": "ResponsePayload", + "declKind": "Protocol", + "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", + "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP", + "moduleName": "ShopifyCheckoutProtocol", + "genericSig": "", + "conformances": [ + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, + { + "kind": "Conformance", + "name": "Encodable", + "printedName": "Encodable", + "usr": "s:SE", + "mangledName": "$sSE" + } + ] + }, + { + "kind": "TypeDecl", + "name": "NotificationDescriptor", + "printedName": "NotificationDescriptor", "children": [ { "kind": "Var", - "name": "specVersion", - "printedName": "specVersion", + "name": "method", + "printedName": "method", "children": [ { "kind": "TypeNominal", @@ -57,12 +151,10 @@ } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O11specVersionSSvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O11specVersionSSvpZ", + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvp", + "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvp", "moduleName": "ShopifyCheckoutProtocol", - "static": true, "declAttributes": [ - "HasInitialValue", "HasStorage" ], "isLet": true, @@ -81,10 +173,10 @@ } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O11specVersionSSvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O11specVersionSSvgZ", + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvg", + "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvg", "moduleName": "ShopifyCheckoutProtocol", - "static": true, + "genericSig": "", "implicit": true, "declAttributes": [ "Transparent" @@ -92,34 +184,66 @@ "accessorKind": "get" } ] + } + ], + "declKind": "Struct", + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV", + "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV", + "moduleName": "ShopifyCheckoutProtocol", + "genericSig": "", + "conformances": [ + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] + }, + { + "kind": "TypeDecl", + "name": "DelegationDescriptor", + "printedName": "DelegationDescriptor", + "children": [ { "kind": "Var", - "name": "defaultDelegations", - "printedName": "defaultDelegations", + "name": "method", + "printedName": "method", "children": [ { "kind": "TypeNominal", - "name": "Array", - "printedName": "[Swift.String]", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sa" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O18defaultDelegationsSaySSGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O18defaultDelegationsSaySSGvpZ", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvp", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvp", "moduleName": "ShopifyCheckoutProtocol", - "static": true, "declAttributes": [ - "HasInitialValue", "HasStorage" ], "isLet": true, @@ -132,24 +256,16 @@ "children": [ { "kind": "TypeNominal", - "name": "Array", - "printedName": "[Swift.String]", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sa" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O18defaultDelegationsSaySSGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O18defaultDelegationsSaySSGvgZ", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvg", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvg", "moduleName": "ShopifyCheckoutProtocol", - "static": true, + "genericSig": "", "implicit": true, "declAttributes": [ "Transparent" @@ -160,8 +276,8 @@ }, { "kind": "Var", - "name": "readyMethod", - "printedName": "readyMethod", + "name": "delegation", + "printedName": "delegation", "children": [ { "kind": "TypeNominal", @@ -171,13 +287,10 @@ } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O11readyMethodSSvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O11readyMethodSSvpZ", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvp", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvp", "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "isInternal": true, "declAttributes": [ - "HasInitialValue", "HasStorage" ], "isLet": true, @@ -196,34 +309,146 @@ } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O11readyMethodSSvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O11readyMethodSSvgZ", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvg", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvg", "moduleName": "ShopifyCheckoutProtocol", - "static": true, + "genericSig": "", "implicit": true, - "isInternal": true, + "declAttributes": [ + "Transparent" + ], "accessorKind": "get" } ] }, + { + "kind": "Constructor", + "name": "init", + "printedName": "init(method:delegation:decode:)", + "children": [ + { + "kind": "TypeNominal", + "name": "DelegationDescriptor", + "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "GenericTypeParam", + "printedName": "Payload" + }, + { + "kind": "TypeNominal", + "name": "GenericTypeParam", + "printedName": "Result" + } + ], + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + }, + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + }, + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + }, + { + "kind": "TypeFunc", + "name": "Function", + "printedName": "(Foundation.Data) -> Payload?", + "children": [ + { + "kind": "TypeNominal", + "name": "Optional", + "printedName": "Payload?", + "children": [ + { + "kind": "TypeNominal", + "name": "GenericTypeParam", + "printedName": "Payload" + } + ], + "usr": "s:Sq" + }, + { + "kind": "TypeNominal", + "name": "Data", + "printedName": "Foundation.Data", + "usr": "s:10Foundation4DataV" + } + ] + } + ], + "declKind": "Constructor", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6method10delegation6decodeACyxq_GSS_SSxSg10Foundation4DataVYbctcfc", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6method10delegation6decodeACyxq_GSS_SSxSg10Foundation4DataVYbctcfc", + "moduleName": "ShopifyCheckoutProtocol", + "genericSig": "", + "init_kind": "Designated" + } + ], + "declKind": "Struct", + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV", + "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV", + "moduleName": "ShopifyCheckoutProtocol", + "genericSig": "", + "conformances": [ + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] + }, + { + "kind": "TypeDecl", + "name": "EmbeddedCheckoutProtocol", + "printedName": "EmbeddedCheckoutProtocol", + "children": [ { "kind": "Var", - "name": "parseErrorCode", - "printedName": "parseErrorCode", + "name": "specVersion", + "printedName": "specVersion", "children": [ { "kind": "TypeNominal", - "name": "Int", - "printedName": "Swift.Int", - "usr": "s:Si" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O14parseErrorCodeSivpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O14parseErrorCodeSivpZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O11specVersionSSvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O11specVersionSSvpZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, - "isInternal": true, "declAttributes": [ "HasInitialValue", "HasStorage" @@ -238,26 +463,28 @@ "children": [ { "kind": "TypeNominal", - "name": "Int", - "printedName": "Swift.Int", - "usr": "s:Si" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O14parseErrorCodeSivgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O14parseErrorCodeSivgZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O11specVersionSSvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O11specVersionSSvgZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "implicit": true, - "isInternal": true, + "declAttributes": [ + "Transparent" + ], "accessorKind": "get" } ] }, { "kind": "Var", - "name": "parseErrorMessage", - "printedName": "parseErrorMessage", + "name": "readyMethod", + "printedName": "readyMethod", "children": [ { "kind": "TypeNominal", @@ -267,8 +494,8 @@ } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O17parseErrorMessageSSvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O17parseErrorMessageSSvpZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O11readyMethodSSvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O11readyMethodSSvpZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "isInternal": true, @@ -292,8 +519,8 @@ } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O17parseErrorMessageSSvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O17parseErrorMessageSSvgZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O11readyMethodSSvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O11readyMethodSSvgZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "implicit": true, @@ -304,8 +531,8 @@ }, { "kind": "Var", - "name": "methodNotFoundCode", - "printedName": "methodNotFoundCode", + "name": "parseErrorCode", + "printedName": "parseErrorCode", "children": [ { "kind": "TypeNominal", @@ -315,8 +542,8 @@ } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O18methodNotFoundCodeSivpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O18methodNotFoundCodeSivpZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O14parseErrorCodeSivpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O14parseErrorCodeSivpZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "isInternal": true, @@ -340,8 +567,8 @@ } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O18methodNotFoundCodeSivgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O18methodNotFoundCodeSivgZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O14parseErrorCodeSivgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O14parseErrorCodeSivgZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "implicit": true, @@ -352,8 +579,8 @@ }, { "kind": "Var", - "name": "methodNotFoundMessage", - "printedName": "methodNotFoundMessage", + "name": "parseErrorMessage", + "printedName": "parseErrorMessage", "children": [ { "kind": "TypeNominal", @@ -363,8 +590,8 @@ } ], "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O21methodNotFoundMessageSSvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O21methodNotFoundMessageSSvpZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O17parseErrorMessageSSvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O17parseErrorMessageSSvpZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "isInternal": true, @@ -388,8 +615,8 @@ } ], "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O21methodNotFoundMessageSSvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O21methodNotFoundMessageSSvgZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O17parseErrorMessageSSvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O17parseErrorMessageSSvgZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "implicit": true, @@ -399,437 +626,193 @@ ] }, { - "kind": "Var", - "name": "complete", - "printedName": "complete", + "kind": "Function", + "name": "url", + "printedName": "url(for:delegations:)", "children": [ { "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" + }, + { + "kind": "TypeNominal", + "name": "URL", + "printedName": "Foundation.URL", + "usr": "s:10Foundation3URLV" + }, + { + "kind": "TypeNominal", + "name": "Array", + "printedName": "[Swift.String]", "children": [ { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + "hasDefaultArg": true, + "usr": "s:Sa" } ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O8completeAA22NotificationDescriptorVyAA0B0VGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O8completeAA22NotificationDescriptorVyAA0B0VGvpZ", + "declKind": "Func", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O3url3for11delegations10Foundation3URLVAI_SaySSGtFZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O3url3for11delegations10Foundation3URLVAI_SaySSGtFZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ - { - "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O8completeAA22NotificationDescriptorVyAA0B0VGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O8completeAA22NotificationDescriptorVyAA0B0VGvgZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, - "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] + "funcSelfKind": "NonMutating" }, { - "kind": "Var", - "name": "error", - "printedName": "error", + "kind": "TypeDecl", + "name": "Client", + "printedName": "Client", "children": [ { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "kind": "Constructor", + "name": "init", + "printedName": "init()", "children": [ { "kind": "TypeNominal", - "name": "ErrorResponse", - "printedName": "ShopifyCheckoutProtocol.ErrorResponse", - "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" + "name": "Client", + "printedName": "ShopifyCheckoutProtocol.EmbeddedCheckoutProtocol.Client", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV" } ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ + "declKind": "Constructor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientVAEycfc", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientVAEycfc", + "moduleName": "ShopifyCheckoutProtocol", + "init_kind": "Designated" + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Function", + "name": "on", + "printedName": "on(_:perform:)", "children": [ + { + "kind": "TypeNominal", + "name": "Client", + "printedName": "ShopifyCheckoutProtocol.EmbeddedCheckoutProtocol.Client", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV" + }, { "kind": "TypeNominal", "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor

", "children": [ { "kind": "TypeNominal", - "name": "ErrorResponse", - "printedName": "ShopifyCheckoutProtocol.ErrorResponse", - "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" + "name": "GenericTypeParam", + "printedName": "P" } ], "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + }, + { + "kind": "TypeFunc", + "name": "Function", + "printedName": "(P) -> Swift.Void", + "children": [ + { + "kind": "TypeNameAlias", + "name": "Void", + "printedName": "Swift.Void", + "children": [ + { + "kind": "TypeNominal", + "name": "Void", + "printedName": "()" + } + ] + }, + { + "kind": "TypeNominal", + "name": "GenericTypeParam", + "printedName": "P" + } + ] } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvgZ", + "declKind": "Func", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV2on_7performAeA22NotificationDescriptorVyxG_yxYbScMYcctAA12EventPayloadRzlF", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV2on_7performAeA22NotificationDescriptorVyxG_yxYbScMYcctAA12EventPayloadRzlF", "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, + "genericSig": "

", "declAttributes": [ - "Transparent" + "DiscardableResult" ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "lineItemsChange", - "printedName": "lineItemsChange", - "children": [ + "funcSelfKind": "NonMutating" + }, { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "kind": "Function", + "name": "on", + "printedName": "on(_:perform:)", "children": [ { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ + "name": "Client", + "printedName": "ShopifyCheckoutProtocol.EmbeddedCheckoutProtocol.Client", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV" + }, { "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "name": "DelegationDescriptor", + "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, - "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "messagesChange", - "printedName": "messagesChange", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ - { - "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O14messagesChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O14messagesChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ + "name": "GenericTypeParam", + "printedName": "P" + }, { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" + "name": "GenericTypeParam", + "printedName": "R" } ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O14messagesChangeAA22NotificationDescriptorVyAA0B0VGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O14messagesChangeAA22NotificationDescriptorVyAA0B0VGvgZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, - "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "start", - "printedName": "start", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ - { - "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O5startAA22NotificationDescriptorVyAA0B0VGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O5startAA22NotificationDescriptorVyAA0B0VGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ + "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + }, { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "kind": "TypeFunc", + "name": "Function", + "printedName": "(P) async -> R", "children": [ { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O5startAA22NotificationDescriptorVyAA0B0VGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O5startAA22NotificationDescriptorVyAA0B0VGvgZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, - "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "totalsChange", - "printedName": "totalsChange", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ - { - "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" - } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O12totalsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O12totalsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", - "children": [ + "name": "GenericTypeParam", + "printedName": "R" + }, { "kind": "TypeNominal", - "name": "Checkout", - "printedName": "ShopifyCheckoutProtocol.Checkout", - "usr": "s:23ShopifyCheckoutProtocol0B0V" + "name": "GenericTypeParam", + "printedName": "P" } - ], - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + ] } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O12totalsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O12totalsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "declKind": "Func", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV2on_7performAeA20DelegationDescriptorVyxq_G_q_xYaYbScMYcctAA12EventPayloadRzAA08ResponseK0R_r0_lF", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV2on_7performAeA20DelegationDescriptorVyxq_G_q_xYaYbScMYcctAA12EventPayloadRzAA08ResponseK0R_r0_lF", "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, + "genericSig": "", "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "supportedProtocolMethods", - "printedName": "supportedProtocolMethods", - "children": [ - { - "kind": "TypeNominal", - "name": "Set", - "printedName": "Swift.Set", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } + "DiscardableResult" ], - "usr": "s:Sh" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O09supportedC7MethodsShySSGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O09supportedC7MethodsShySSGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "isInternal": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ + "funcSelfKind": "NonMutating" + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Function", + "name": "process", + "printedName": "process(_:)", "children": [ { "kind": "TypeNominal", - "name": "Set", - "printedName": "Swift.Set", + "name": "Optional", + "printedName": "Swift.String?", "children": [ { "kind": "TypeNominal", @@ -838,30 +821,8 @@ "usr": "s:SS" } ], - "usr": "s:Sh" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O09supportedC7MethodsShySSGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O09supportedC7MethodsShySSGvgZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "implicit": true, - "isInternal": true, - "accessorKind": "get" - } - ] - }, - { - "kind": "Function", - "name": "supportedProtocolMethod", - "printedName": "supportedProtocolMethod(_:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ + "usr": "s:Sq" + }, { "kind": "TypeNominal", "name": "String", @@ -869,27 +830,53 @@ "usr": "s:SS" } ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "declKind": "Func", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV7processySSSgSSYaF", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV7processySSSgSSYaF", + "moduleName": "ShopifyCheckoutProtocol", + "funcSelfKind": "NonMutating" } ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O09supportedC6MethodySSSgSSFZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O09supportedC6MethodySSSgSSFZ", + "declKind": "Struct", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O6ClientV", "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "isInternal": true, - "funcSelfKind": "NonMutating" + "isFromExtension": true, + "conformances": [ + { + "kind": "Conformance", + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" + }, + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] }, { "kind": "Function", - "name": "methodNotFoundResponse", - "printedName": "methodNotFoundResponse(forUnsupportedProtocolRequest:)", + "name": "acknowledgeReady", + "printedName": "acknowledgeReady(_:supportedDelegations:)", "children": [ { "kind": "TypeNominal", @@ -910,32 +897,6 @@ "name": "String", "printedName": "Swift.String", "usr": "s:SS" - } - ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O22methodNotFoundResponse014forUnsupportedC7RequestSSSgSS_tFZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O22methodNotFoundResponse014forUnsupportedC7RequestSSSgSS_tFZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "isInternal": true, - "funcSelfKind": "NonMutating" - }, - { - "kind": "Function", - "name": "url", - "printedName": "url(for:delegations:)", - "children": [ - { - "kind": "TypeNominal", - "name": "URL", - "printedName": "Foundation.URL", - "usr": "s:10Foundation3URLV" - }, - { - "kind": "TypeNominal", - "name": "URL", - "printedName": "Foundation.URL", - "usr": "s:10Foundation3URLV" }, { "kind": "TypeNominal", @@ -954,8 +915,8 @@ } ], "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O3url3for11delegations10Foundation3URLVAI_SaySSGtFZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O3url3for11delegations10Foundation3URLVAI_SaySSGtFZ", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O16acknowledgeReady_20supportedDelegationsSSSgSS_SaySSGtFZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O16acknowledgeReady_20supportedDelegationsSSSgSS_SaySSGtFZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, "isFromExtension": true, @@ -963,735 +924,1080 @@ }, { "kind": "TypeDecl", - "name": "Client", - "printedName": "Client", + "name": "Event", + "printedName": "Event", "children": [ { - "kind": "Constructor", - "name": "init", - "printedName": "init()", + "kind": "Var", + "name": "ready", + "printedName": "ready", "children": [ { "kind": "TypeNominal", - "name": "Client", - "printedName": "ShopifyCheckoutProtocol.CheckoutProtocol.Client", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Constructor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientVAEycfc", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientVAEycfc", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5readyAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5readyAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "init_kind": "Designated" + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5readyAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5readyAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "Function", - "name": "on", - "printedName": "on(_:perform:)", + "kind": "Var", + "name": "auth", + "printedName": "auth", "children": [ - { - "kind": "TypeNominal", - "name": "Client", - "printedName": "ShopifyCheckoutProtocol.CheckoutProtocol.Client", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV" - }, { "kind": "TypeNominal", "name": "NotificationDescriptor", - "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor

", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "P" + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" } ], "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" - }, + } + ], + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO4authAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO4authAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(P) -> Swift.Void", + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", "children": [ { - "kind": "TypeNameAlias", - "name": "Void", - "printedName": "Swift.Void", + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "Void", - "printedName": "()" + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" } - ] - }, + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO4authAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO4authAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "error", + "printedName": "error", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "P" + "name": "ErrorResponse", + "printedName": "ShopifyCheckoutProtocol.ErrorResponse", + "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" } - ] + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV2on_7performAeA22NotificationDescriptorVyxG_yxYbScMYcctAA12EventPayloadRzlF", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientV2on_7performAeA22NotificationDescriptorVyxG_yxYbScMYcctAA12EventPayloadRzlF", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "

", + "static": true, "declAttributes": [ - "DiscardableResult" + "HasInitialValue", + "HasStorage" ], - "funcSelfKind": "NonMutating" + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "ErrorResponse", + "printedName": "ShopifyCheckoutProtocol.ErrorResponse", + "usr": "s:23ShopifyCheckoutProtocol13ErrorResponseV" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5errorAA22NotificationDescriptorVyAA13ErrorResponseVGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "Function", - "name": "on", - "printedName": "on(_:perform:)", + "kind": "Var", + "name": "start", + "printedName": "start", "children": [ { "kind": "TypeNominal", - "name": "Client", - "printedName": "ShopifyCheckoutProtocol.CheckoutProtocol.Client", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV" - }, - { - "kind": "TypeNominal", - "name": "DelegationDescriptor", - "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "P" - }, - { - "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "R" + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" } ], - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" - }, + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5startAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5startAA22NotificationDescriptorVyAA0B0VGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(P) async -> R", + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "R" - }, + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5startAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO5startAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, + { + "kind": "Var", + "name": "complete", + "printedName": "complete", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "P" + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" } - ] + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV2on_7performAeA20DelegationDescriptorVyxq_G_q_xYaYbScMYcctAA12EventPayloadRzAA08ResponseJ0R_r0_lF", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientV2on_7performAeA20DelegationDescriptorVyxq_G_q_xYaYbScMYcctAA12EventPayloadRzAA08ResponseJ0R_r0_lF", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO8completeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO8completeAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", + "static": true, "declAttributes": [ - "DiscardableResult" + "HasInitialValue", + "HasStorage" ], - "funcSelfKind": "NonMutating" + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO8completeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO8completeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "Function", - "name": "process", - "printedName": "process(_:)", + "kind": "Var", + "name": "messagesChange", + "printedName": "messagesChange", "children": [ { "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" } ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV7processySSSgSSYaF", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientV7processySSSgSSYaF", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO14messagesChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO14messagesChangeAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "funcSelfKind": "NonMutating" - } - ], - "declKind": "Struct", - "usr": "s:23ShopifyCheckoutProtocol0bC0O6ClientV", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O6ClientV", - "moduleName": "ShopifyCheckoutProtocol", - "isFromExtension": true, - "conformances": [ - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO14messagesChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO14messagesChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - } - ] - }, - { - "kind": "Function", - "name": "acknowledgeReady", - "printedName": "acknowledgeReady(_:supportedDelegations:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", + "kind": "Var", + "name": "lineItemsChange", + "printedName": "lineItemsChange", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO15lineItemsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "TypeNominal", - "name": "Array", - "printedName": "[Swift.String]", + "kind": "Var", + "name": "buyerChange", + "printedName": "buyerChange", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "hasDefaultArg": true, - "usr": "s:Sa" - } - ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol0bC0O16acknowledgeReady_20supportedDelegationsSSSgSS_SaySSGtFZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O16acknowledgeReady_20supportedDelegationsSSSgSS_SaySSGtFZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "isFromExtension": true, - "funcSelfKind": "NonMutating" - }, - { - "kind": "Var", - "name": "windowOpen", - "printedName": "windowOpen", - "children": [ - { - "kind": "TypeNominal", - "name": "DelegationDescriptor", - "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenRequest", - "printedName": "ShopifyCheckoutProtocol.WindowOpenRequest", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV" - }, + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO11buyerChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO11buyerChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO11buyerChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO11buyerChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" } - ], - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol0bC0O10windowOpenAA20DelegationDescriptorVyAA06WindowE7RequestVAA0hE6ResultOGvpZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O10windowOpenAA20DelegationDescriptorVyAA06WindowE7RequestVAA0hE6ResultOGvpZ", - "moduleName": "ShopifyCheckoutProtocol", - "static": true, - "declAttributes": [ - "HasInitialValue", - "HasStorage" - ], - "isFromExtension": true, - "isLet": true, - "hasStorage": true, - "accessors": [ + ] + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Var", + "name": "totalsChange", + "printedName": "totalsChange", "children": [ { "kind": "TypeNominal", - "name": "DelegationDescriptor", - "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", "children": [ { "kind": "TypeNominal", - "name": "WindowOpenRequest", - "printedName": "ShopifyCheckoutProtocol.WindowOpenRequest", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV" - }, - { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" } ], - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol0bC0O10windowOpenAA20DelegationDescriptorVyAA06WindowE7RequestVAA0hE6ResultOGvgZ", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O10windowOpenAA20DelegationDescriptorVyAA06WindowE7RequestVAA0hE6ResultOGvgZ", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO12totalsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO12totalsChangeAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", "static": true, - "implicit": true, "declAttributes": [ - "Transparent" + "HasInitialValue", + "HasStorage" ], - "isFromExtension": true, - "accessorKind": "get" - } - ] - } - ], - "declKind": "Enum", - "usr": "s:23ShopifyCheckoutProtocol0bC0O", - "mangledName": "$s23ShopifyCheckoutProtocol0bC0O", - "moduleName": "ShopifyCheckoutProtocol", - "isEnumExhaustive": true, - "conformances": [ - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - } - ] - }, - { - "kind": "TypeDecl", - "name": "EventPayload", - "printedName": "EventPayload", - "declKind": "Protocol", - "usr": "s:23ShopifyCheckoutProtocol12EventPayloadP", - "mangledName": "$s23ShopifyCheckoutProtocol12EventPayloadP", - "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "conformances": [ - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Decodable", - "printedName": "Decodable", - "usr": "s:Se", - "mangledName": "$sSe" - } - ] - }, - { - "kind": "TypeDecl", - "name": "ResponsePayload", - "printedName": "ResponsePayload", - "declKind": "Protocol", - "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", - "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP", - "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "conformances": [ - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Encodable", - "printedName": "Encodable", - "usr": "s:SE", - "mangledName": "$sSE" - } - ] - }, - { - "kind": "TypeDecl", - "name": "NotificationDescriptor", - "printedName": "NotificationDescriptor", - "children": [ - { - "kind": "Var", - "name": "method", - "printedName": "method", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvp", - "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvp", - "moduleName": "ShopifyCheckoutProtocol", - "declAttributes": [ - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO12totalsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO12totalsChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Var", + "name": "paymentChange", + "printedName": "paymentChange", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvg", - "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV6methodSSvg", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO13paymentChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO13paymentChangeAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "implicit": true, + "static": true, "declAttributes": [ - "Transparent" + "HasInitialValue", + "HasStorage" ], - "accessorKind": "get" - } - ] - } - ], - "declKind": "Struct", - "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV", - "mangledName": "$s23ShopifyCheckoutProtocol22NotificationDescriptorV", - "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "conformances": [ - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - } - ] - }, - { - "kind": "TypeDecl", - "name": "DelegationDescriptor", - "printedName": "DelegationDescriptor", - "children": [ - { - "kind": "Var", - "name": "method", - "printedName": "method", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvp", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvp", - "moduleName": "ShopifyCheckoutProtocol", - "declAttributes": [ - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO13paymentChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO13paymentChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Var", + "name": "paymentInstrumentsChangeRequest", + "printedName": "paymentInstrumentsChangeRequest", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvg", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6methodSSvg", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31paymentInstrumentsChangeRequestAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31paymentInstrumentsChangeRequestAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "implicit": true, + "static": true, "declAttributes": [ - "Transparent" + "HasInitialValue", + "HasStorage" ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Var", - "name": "delegation", - "printedName": "delegation", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvp", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvp", - "moduleName": "ShopifyCheckoutProtocol", - "declAttributes": [ - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31paymentInstrumentsChangeRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31paymentInstrumentsChangeRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", + "kind": "Var", + "name": "paymentCredentialRequest", + "printedName": "paymentCredentialRequest", "children": [ { "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvg", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV10delegationSSvg", + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO24paymentCredentialRequestAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO24paymentCredentialRequestAA22NotificationDescriptorVyAA0B0VGvpZ", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "implicit": true, + "static": true, "declAttributes": [ - "Transparent" + "HasInitialValue", + "HasStorage" ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Constructor", - "name": "init", - "printedName": "init(method:delegation:decode:)", - "children": [ + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO24paymentCredentialRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO24paymentCredentialRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] + }, { - "kind": "TypeNominal", - "name": "DelegationDescriptor", - "printedName": "ShopifyCheckoutProtocol.DelegationDescriptor", + "kind": "Var", + "name": "windowOpenRequest", + "printedName": "windowOpenRequest", "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "Payload" - }, - { - "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "Result" + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" } ], - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV" + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17windowOpenRequestAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17windowOpenRequestAA22NotificationDescriptorVyAA7JSONAnyCGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "JSONAny", + "printedName": "ShopifyCheckoutProtocol.JSONAny", + "usr": "s:23ShopifyCheckoutProtocol7JSONAnyC" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17windowOpenRequestAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17windowOpenRequestAA22NotificationDescriptorVyAA7JSONAnyCGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "kind": "Var", + "name": "fulfillmentChange", + "printedName": "fulfillmentChange", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17fulfillmentChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17fulfillmentChangeAA22NotificationDescriptorVyAA0B0VGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17fulfillmentChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO17fulfillmentChangeAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" + "kind": "Var", + "name": "fulfillmentAddressChangeRequest", + "printedName": "fulfillmentAddressChangeRequest", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31fulfillmentAddressChangeRequestAA22NotificationDescriptorVyAA0B0VGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31fulfillmentAddressChangeRequestAA22NotificationDescriptorVyAA0B0VGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ + { + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "NotificationDescriptor", + "printedName": "ShopifyCheckoutProtocol.NotificationDescriptor", + "children": [ + { + "kind": "TypeNominal", + "name": "Checkout", + "printedName": "ShopifyCheckoutProtocol.Checkout", + "usr": "s:23ShopifyCheckoutProtocol0B0V" + } + ], + "usr": "s:23ShopifyCheckoutProtocol22NotificationDescriptorV" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31fulfillmentAddressChangeRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO31fulfillmentAddressChangeRequestAA22NotificationDescriptorVyAA0B0VGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" + } + ] }, { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(Foundation.Data) -> Payload?", + "kind": "Var", + "name": "all", + "printedName": "all", "children": [ { "kind": "TypeNominal", - "name": "Optional", - "printedName": "Payload?", + "name": "Array", + "printedName": "[Swift.String]", "children": [ { "kind": "TypeNominal", - "name": "GenericTypeParam", - "printedName": "Payload" + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" } ], - "usr": "s:Sq" - }, + "usr": "s:Sa" + } + ], + "declKind": "Var", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO3allSaySSGvpZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO3allSaySSGvpZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "declAttributes": [ + "HasInitialValue", + "HasStorage" + ], + "isLet": true, + "hasStorage": true, + "accessors": [ { - "kind": "TypeNominal", - "name": "Data", - "printedName": "Foundation.Data", - "usr": "s:10Foundation4DataV" + "kind": "Accessor", + "name": "Get", + "printedName": "Get()", + "children": [ + { + "kind": "TypeNominal", + "name": "Array", + "printedName": "[Swift.String]", + "children": [ + { + "kind": "TypeNominal", + "name": "String", + "printedName": "Swift.String", + "usr": "s:SS" + } + ], + "usr": "s:Sa" + } + ], + "declKind": "Accessor", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO3allSaySSGvgZ", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO3allSaySSGvgZ", + "moduleName": "ShopifyCheckoutProtocol", + "static": true, + "implicit": true, + "declAttributes": [ + "Transparent" + ], + "accessorKind": "get" } ] } ], - "declKind": "Constructor", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV6method10delegation6decodeACyxq_GSS_SSxSg10Foundation4DataVYbctcfc", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV6method10delegation6decodeACyxq_GSS_SSxSg10Foundation4DataVYbctcfc", + "declKind": "Enum", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O5EventO", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", - "init_kind": "Designated" + "isFromExtension": true, + "isEnumExhaustive": true, + "conformances": [ + { + "kind": "Conformance", + "name": "Copyable", + "printedName": "Copyable", + "usr": "s:s8CopyableP", + "mangledName": "$ss8CopyableP" + }, + { + "kind": "Conformance", + "name": "Escapable", + "printedName": "Escapable", + "usr": "s:s9EscapableP", + "mangledName": "$ss9EscapableP" + } + ] } ], - "declKind": "Struct", - "usr": "s:23ShopifyCheckoutProtocol20DelegationDescriptorV", - "mangledName": "$s23ShopifyCheckoutProtocol20DelegationDescriptorV", + "declKind": "Enum", + "usr": "s:23ShopifyCheckoutProtocol08EmbeddedbC0O", + "mangledName": "$s23ShopifyCheckoutProtocol08EmbeddedbC0O", "moduleName": "ShopifyCheckoutProtocol", - "genericSig": "", + "isEnumExhaustive": true, "conformances": [ - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, { "kind": "Conformance", "name": "Copyable", @@ -58842,13 +59148,6 @@ "printedName": "Escapable", "usr": "s:s9EscapableP", "mangledName": "$ss9EscapableP" - }, - { - "kind": "Conformance", - "name": "ResponsePayload", - "printedName": "ResponsePayload", - "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", - "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP" } ] }, @@ -66729,13 +67028,6 @@ "printedName": "Escapable", "usr": "s:s9EscapableP", "mangledName": "$ss9EscapableP" - }, - { - "kind": "Conformance", - "name": "ResponsePayload", - "printedName": "ResponsePayload", - "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", - "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP" } ] }, @@ -67523,362 +67815,13 @@ "printedName": "Escapable", "usr": "s:s9EscapableP", "mangledName": "$ss9EscapableP" - } - ] - }, - { - "kind": "TypeDecl", - "name": "WindowOpenRequest", - "printedName": "WindowOpenRequest", - "children": [ - { - "kind": "Var", - "name": "url", - "printedName": "url", - "children": [ - { - "kind": "TypeNominal", - "name": "URL", - "printedName": "Foundation.URL", - "usr": "s:10Foundation3URLV" - } - ], - "declKind": "Var", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV3url10Foundation3URLVvp", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV3url10Foundation3URLVvp", - "moduleName": "ShopifyCheckoutProtocol", - "declAttributes": [ - "HasStorage" - ], - "isLet": true, - "hasStorage": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "URL", - "printedName": "Foundation.URL", - "usr": "s:10Foundation3URLV" - } - ], - "declKind": "Accessor", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV3url10Foundation3URLVvg", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV3url10Foundation3URLVvg", - "moduleName": "ShopifyCheckoutProtocol", - "implicit": true, - "declAttributes": [ - "Transparent" - ], - "accessorKind": "get" - } - ] - }, - { - "kind": "Constructor", - "name": "init", - "printedName": "init(url:)", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenRequest", - "printedName": "ShopifyCheckoutProtocol.WindowOpenRequest", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV" - }, - { - "kind": "TypeNominal", - "name": "URL", - "printedName": "Foundation.URL", - "usr": "s:10Foundation3URLV" - } - ], - "declKind": "Constructor", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV3urlAC10Foundation3URLV_tcfc", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV3urlAC10Foundation3URLV_tcfc", - "moduleName": "ShopifyCheckoutProtocol", - "init_kind": "Designated" - }, - { - "kind": "Constructor", - "name": "init", - "printedName": "init(from:)", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenRequest", - "printedName": "ShopifyCheckoutProtocol.WindowOpenRequest", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV" - }, - { - "kind": "TypeNominal", - "name": "Decoder", - "printedName": "any Swift.Decoder", - "usr": "s:s7DecoderP" - } - ], - "declKind": "Constructor", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV4fromACs7Decoder_p_tKcfc", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV4fromACs7Decoder_p_tKcfc", - "moduleName": "ShopifyCheckoutProtocol", - "throwing": true, - "init_kind": "Designated" }, - { - "kind": "Function", - "name": "encode", - "printedName": "encode(to:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "kind": "TypeNominal", - "name": "Encoder", - "printedName": "any Swift.Encoder", - "usr": "s:s7EncoderP" - } - ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV6encode2toys7Encoder_p_tKF", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV6encode2toys7Encoder_p_tKF", - "moduleName": "ShopifyCheckoutProtocol", - "throwing": true, - "funcSelfKind": "NonMutating" - } - ], - "declKind": "Struct", - "usr": "s:23ShopifyCheckoutProtocol17WindowOpenRequestV", - "mangledName": "$s23ShopifyCheckoutProtocol17WindowOpenRequestV", - "moduleName": "ShopifyCheckoutProtocol", - "conformances": [ { "kind": "Conformance", "name": "EventPayload", "printedName": "EventPayload", "usr": "s:23ShopifyCheckoutProtocol12EventPayloadP", "mangledName": "$s23ShopifyCheckoutProtocol12EventPayloadP" - }, - { - "kind": "Conformance", - "name": "Decodable", - "printedName": "Decodable", - "usr": "s:Se", - "mangledName": "$sSe" - }, - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" - } - ] - }, - { - "kind": "TypeDecl", - "name": "WindowOpenResult", - "printedName": "WindowOpenResult", - "children": [ - { - "kind": "Var", - "name": "success", - "printedName": "success", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(ShopifyCheckoutProtocol.WindowOpenResult.Type) -> ShopifyCheckoutProtocol.WindowOpenResult", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" - }, - { - "kind": "TypeNominal", - "name": "Metatype", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult.Type", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" - } - ] - } - ] - } - ], - "declKind": "EnumElement", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO7successyA2CmF", - "mangledName": "$s23ShopifyCheckoutProtocol16WindowOpenResultO7successyA2CmF", - "moduleName": "ShopifyCheckoutProtocol" - }, - { - "kind": "Var", - "name": "rejected", - "printedName": "rejected", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(ShopifyCheckoutProtocol.WindowOpenResult.Type) -> (Swift.String?) -> ShopifyCheckoutProtocol.WindowOpenResult", - "children": [ - { - "kind": "TypeFunc", - "name": "Function", - "printedName": "(Swift.String?) -> ShopifyCheckoutProtocol.WindowOpenResult", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" - }, - { - "kind": "TypeNominal", - "name": "Tuple", - "printedName": "(reason: Swift.String?)", - "children": [ - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sq" - } - ] - } - ] - }, - { - "kind": "TypeNominal", - "name": "Metatype", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult.Type", - "children": [ - { - "kind": "TypeNominal", - "name": "WindowOpenResult", - "printedName": "ShopifyCheckoutProtocol.WindowOpenResult", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO" - } - ] - } - ] - } - ], - "declKind": "EnumElement", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO8rejectedyACSSSg_tcACmF", - "mangledName": "$s23ShopifyCheckoutProtocol16WindowOpenResultO8rejectedyACSSSg_tcACmF", - "moduleName": "ShopifyCheckoutProtocol" - }, - { - "kind": "Function", - "name": "encode", - "printedName": "encode(to:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "kind": "TypeNominal", - "name": "Encoder", - "printedName": "any Swift.Encoder", - "usr": "s:s7EncoderP" - } - ], - "declKind": "Func", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO6encode2toys7Encoder_p_tKF", - "mangledName": "$s23ShopifyCheckoutProtocol16WindowOpenResultO6encode2toys7Encoder_p_tKF", - "moduleName": "ShopifyCheckoutProtocol", - "throwing": true, - "funcSelfKind": "NonMutating" - } - ], - "declKind": "Enum", - "usr": "s:23ShopifyCheckoutProtocol16WindowOpenResultO", - "mangledName": "$s23ShopifyCheckoutProtocol16WindowOpenResultO", - "moduleName": "ShopifyCheckoutProtocol", - "isEnumExhaustive": true, - "conformances": [ - { - "kind": "Conformance", - "name": "ResponsePayload", - "printedName": "ResponsePayload", - "usr": "s:23ShopifyCheckoutProtocol15ResponsePayloadP", - "mangledName": "$s23ShopifyCheckoutProtocol15ResponsePayloadP" - }, - { - "kind": "Conformance", - "name": "Encodable", - "printedName": "Encodable", - "usr": "s:SE", - "mangledName": "$sSE" - }, - { - "kind": "Conformance", - "name": "Sendable", - "printedName": "Sendable", - "usr": "s:s8SendableP", - "mangledName": "$ss8SendableP" - }, - { - "kind": "Conformance", - "name": "SendableMetatype", - "printedName": "SendableMetatype", - "usr": "s:s16SendableMetatypeP", - "mangledName": "$ss16SendableMetatypeP" - }, - { - "kind": "Conformance", - "name": "Copyable", - "printedName": "Copyable", - "usr": "s:s8CopyableP", - "mangledName": "$ss8CopyableP" - }, - { - "kind": "Conformance", - "name": "Escapable", - "printedName": "Escapable", - "usr": "s:s9EscapableP", - "mangledName": "$ss9EscapableP" } ] } diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol.swift deleted file mode 100644 index 55c6c31d..00000000 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol.swift +++ /dev/null @@ -1,67 +0,0 @@ -import Foundation - -public enum CheckoutProtocol { - public static let specVersion = "2026-04-08" - - public static let defaultDelegations: [String] = ["window.open"] - - package static let readyMethod = "ec.ready" - package static let parseErrorCode = -32700 - package static let parseErrorMessage = "Parse error" - package static let methodNotFoundCode = -32601 - package static let methodNotFoundMessage = "Method not found" - - public static let complete = NotificationDescriptor(method: "ec.complete") - public static let error = NotificationDescriptor(method: "ec.error") - public static let lineItemsChange = NotificationDescriptor( - method: "ec.line_items.change" - ) - public static let messagesChange = NotificationDescriptor( - method: "ec.messages.change" - ) - public static let start = NotificationDescriptor(method: "ec.start") - public static let totalsChange = NotificationDescriptor(method: "ec.totals.change") - - package static let supportedProtocolMethods: Set = [ - readyMethod, - start.method, - complete.method, - error.method, - lineItemsChange.method, - messagesChange.method, - totalsChange.method, - windowOpen.method - ] - - package static func supportedProtocolMethod(_ message: String) -> String? { - guard - let envelope = try? JSONDecoder().decode(JSONRPCEnvelope.self, from: Data(message.utf8)), - envelope.jsonrpc == "2.0", - supportedProtocolMethods.contains(envelope.method) - else { - return nil - } - - return envelope.method - } - - package static func methodNotFoundResponse(forUnsupportedProtocolRequest message: String) -> String? { - guard - let request = try? JSONDecoder().decode(JSONRPCEnvelope.self, from: Data(message.utf8)), - request.jsonrpc == "2.0", - !supportedProtocolMethods.contains(request.method), - let id = request.id - else { - return nil - } - - let response = JSONRPCErrorResponse( - id: id, - error: JSONRPCError(code: methodNotFoundCode, message: methodNotFoundMessage) - ) - let encoder = JSONEncoder() - encoder.outputFormatting = [.sortedKeys] - guard let data = try? encoder.encode(response) else { return nil } - return String(data: data, encoding: .utf8) - } -} diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Descriptors.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Descriptors.swift index 488dff15..36574e80 100644 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Descriptors.swift +++ b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Descriptors.swift @@ -10,11 +10,6 @@ public protocol EventPayload: Decodable, Sendable {} /// is explicit — preventing arbitrary `Encodable & Sendable` types from silently matching. public protocol ResponsePayload: Encodable, Sendable {} -extension Checkout: EventPayload {} -extension ErrorResponse: EventPayload {} -extension InstrumentsChangeResult: ResponsePayload {} -extension CredentialResult: ResponsePayload {} - public struct NotificationDescriptor: Sendable { public let method: String } diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Client.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Client.swift similarity index 85% rename from protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Client.swift rename to protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Client.swift index 9a3c992c..96da8135 100644 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Client.swift +++ b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Client.swift @@ -1,6 +1,6 @@ import Foundation -extension CheckoutProtocol { +extension EmbeddedCheckoutProtocol { public struct Client: Sendable, MutableCopyable { private var notificationHandlers: [String: @MainActor @Sendable (any EventPayload) -> Void] private var delegationEntries: [String: DelegationEntry] @@ -38,22 +38,22 @@ extension CheckoutProtocol { handler: { id, params in guard let payload = descriptor.decode(params) else { return nil } let result = await perform(payload) - return CheckoutProtocol.encodeResponse(id: id, result: result) + return EmbeddedCheckoutProtocol.encodeResponse(id: id, result: result) } ) } } public func process(_ message: String) async -> String? { - let decoded = CheckoutProtocol.decode(jsonRpc: message) + let decoded = EmbeddedCheckoutProtocol.decode(jsonRpc: message) switch decoded { case let .ready(id, requested): let accepted = requested.filter(Set(delegations).contains) - return CheckoutProtocol.encodeReadyResponse(id: id, acceptedDelegations: accepted) + return EmbeddedCheckoutProtocol.encodeReadyResponse(id: id, acceptedDelegations: accepted) case let .error(id, code, message): - return CheckoutProtocol.encodeErrorResponse(id: id, code: code, message: message) + return EmbeddedCheckoutProtocol.encodeErrorResponse(id: id, code: code, message: message) case let .notification(method, payload): await notificationHandlers[method]?(payload) diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Codec.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Codec.swift similarity index 97% rename from protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Codec.swift rename to protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Codec.swift index 2bde1ae7..f3f65399 100644 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Codec.swift +++ b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol+Codec.swift @@ -1,12 +1,12 @@ import Foundation -extension CheckoutProtocol { +extension EmbeddedCheckoutProtocol { /// Returns an `ec.ready` response if the given message is an `ec.ready` request, /// otherwise `nil`. The response echoes the intersection of the merchant's /// requested delegations with `supportedDelegations` under a `delegate` array. public static func acknowledgeReady( _ message: String, - supportedDelegations: [String] = CheckoutProtocol.defaultDelegations + supportedDelegations: [String] = [] ) -> String? { switch decode(jsonRpc: message) { case let .ready(id, requested): @@ -22,7 +22,7 @@ extension CheckoutProtocol { } } -extension CheckoutProtocol { +extension EmbeddedCheckoutProtocol { static func decode(jsonRpc: String) -> UCPMessage { guard let data = jsonRpc.data(using: .utf8) else { return .unknown(method: "", rawParams: jsonRpc) diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol+URL.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol.swift similarity index 75% rename from protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol+URL.swift rename to protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol.swift index a876879b..8104a9d9 100644 --- a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/CheckoutProtocol+URL.swift +++ b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/EmbeddedCheckoutProtocol.swift @@ -1,12 +1,18 @@ import Foundation -extension CheckoutProtocol { +public enum EmbeddedCheckoutProtocol { + public static let specVersion = "2026-04-08" + + package static let readyMethod = "ec.ready" + package static let parseErrorCode = -32700 + package static let parseErrorMessage = "Parse error" + /// Returns the given checkout URL with the query parameters required to /// initiate the Embedded Checkout Protocol handshake (`ec_version`, /// `ec_delegate`). public static func url( for url: URL, - delegations: [String] = defaultDelegations + delegations: [String] = [] ) -> URL { guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return url diff --git a/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Generated/EmbeddedCheckoutProtocol+Event.swift b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Generated/EmbeddedCheckoutProtocol+Event.swift new file mode 100644 index 00000000..8f62528a --- /dev/null +++ b/protocol/languages/swift/Sources/ShopifyCheckoutProtocol/Generated/EmbeddedCheckoutProtocol+Event.swift @@ -0,0 +1,46 @@ +// This file is generated by protocol/scripts/generate_swift_catalog.mjs. +// Do not edit directly. + +import Foundation + +extension Checkout: EventPayload {} +extension ErrorResponse: EventPayload {} +extension JSONAny: EventPayload {} + +extension EmbeddedCheckoutProtocol { + public enum Event { + public static let ready = NotificationDescriptor(method: "ec.ready") + public static let auth = NotificationDescriptor(method: "ec.auth") + public static let error = NotificationDescriptor(method: "ec.error") + public static let start = NotificationDescriptor(method: "ec.start") + public static let complete = NotificationDescriptor(method: "ec.complete") + public static let messagesChange = NotificationDescriptor(method: "ec.messages.change") + public static let lineItemsChange = NotificationDescriptor(method: "ec.line_items.change") + public static let buyerChange = NotificationDescriptor(method: "ec.buyer.change") + public static let totalsChange = NotificationDescriptor(method: "ec.totals.change") + public static let paymentChange = NotificationDescriptor(method: "ec.payment.change") + public static let paymentInstrumentsChangeRequest = NotificationDescriptor(method: "ec.payment.instruments_change_request") + public static let paymentCredentialRequest = NotificationDescriptor(method: "ec.payment.credential_request") + public static let windowOpenRequest = NotificationDescriptor(method: "ec.window.open_request") + public static let fulfillmentChange = NotificationDescriptor(method: "ec.fulfillment.change") + public static let fulfillmentAddressChangeRequest = NotificationDescriptor(method: "ec.fulfillment.address_change_request") + + public static let all: [String] = [ + ready.method, + auth.method, + error.method, + start.method, + complete.method, + messagesChange.method, + lineItemsChange.method, + buyerChange.method, + totalsChange.method, + paymentChange.method, + paymentInstrumentsChangeRequest.method, + paymentCredentialRequest.method, + windowOpenRequest.method, + fulfillmentChange.method, + fulfillmentAddressChangeRequest.method, + ] + } +} diff --git a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/ClientTests.swift b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/ClientTests.swift index 3f32d899..d3add317 100644 --- a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/ClientTests.swift +++ b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/ClientTests.swift @@ -2,6 +2,49 @@ import Foundation @testable import ShopifyCheckoutProtocol import Testing +private struct TestURLPayload: EventPayload { + let url: URL? + + init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let raw = try container.decode(String.self, forKey: .url) + url = URL(string: raw) + } + + private enum CodingKeys: String, CodingKey { + case url + } +} + +private enum TestDelegationResult: ResponsePayload { + case success + case rejected(reason: String) + + func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + switch self { + case .success: + try container.encode(["status": "success"], forKey: .ucp) + case let .rejected(reason): + try container.encode(["status": "error"], forKey: .ucp) + try container.encode([["content": reason]], forKey: .messages) + } + } + + private enum CodingKeys: String, CodingKey { + case ucp + case messages + } +} + +private let windowOpenDescriptor = DelegationDescriptor( + method: EmbeddedCheckoutProtocol.Event.windowOpenRequest.method, + delegation: "window.open", + decode: { params in + try? JSONDecoder().decode(TestURLPayload.self, from: params) + } +) + @Suite("Client Tests") struct ClientTests { private func notificationFixture() throws -> String { @@ -16,8 +59,8 @@ struct ClientTests { @Test @MainActor func notificationDispatchesToRegisteredHandler() async throws { var receivedCheckout: Checkout? - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.start) { checkout in + let client = EmbeddedCheckoutProtocol.Client() + .on(EmbeddedCheckoutProtocol.Event.start) { checkout in receivedCheckout = checkout } @@ -30,8 +73,8 @@ struct ClientTests { @Test @MainActor func notificationDoesNotFireUnregisteredHandler() async throws { var completeFired = false - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.complete) { (_: Checkout) in + let client = EmbeddedCheckoutProtocol.Client() + .on(EmbeddedCheckoutProtocol.Event.complete) { (_: Checkout) in completeFired = true } @@ -42,8 +85,8 @@ struct ClientTests { } @Test @MainActor func notificationReturnsNil() async throws { - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.start) { (_: Checkout) in } + let client = EmbeddedCheckoutProtocol.Client() + .on(EmbeddedCheckoutProtocol.Event.start) { (_: Checkout) in } let response = try await client.process(notificationFixture()) @@ -53,9 +96,9 @@ struct ClientTests { @Test @MainActor func multipleNotificationHandlersOnDifferentEvents() async throws { var startFired = false var completeFired = false - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.start) { (_: Checkout) in startFired = true } - .on(CheckoutProtocol.complete) { (_: Checkout) in completeFired = true } + let client = EmbeddedCheckoutProtocol.Client() + .on(EmbeddedCheckoutProtocol.Event.start) { (_: Checkout) in startFired = true } + .on(EmbeddedCheckoutProtocol.Event.complete) { (_: Checkout) in completeFired = true } _ = try await client.process(notificationFixture()) @@ -64,24 +107,22 @@ struct ClientTests { } @Test @MainActor func unknownMessageReturnsNil() async { - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.start) { (_: Checkout) in } + let client = EmbeddedCheckoutProtocol.Client() + .on(EmbeddedCheckoutProtocol.Event.start) { (_: Checkout) in } let response = await client.process("not valid json") #expect(response == nil) } - @Test @MainActor func windowOpenRequestDispatchesToRegisteredHandler() async throws { + @Test @MainActor func delegationRequestDispatchesToRegisteredHandler() async throws { let request = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":"https://example.com/terms"}} """# - var receivedURL: URL? - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.windowOpen) { payload in - receivedURL = payload.url - return .success + let client = EmbeddedCheckoutProtocol.Client() + .on(windowOpenDescriptor) { payload in + payload.url == URL(string: "https://example.com/terms") ? .success : .rejected(reason: "unexpected url") } let response = try #require(await client.process(request)) @@ -91,16 +132,15 @@ struct ClientTests { let result = try #require(parsed["result"] as? [String: Any]) let ucp = try #require(result["ucp"] as? [String: Any]) #expect(ucp["status"] as? String == "success") - #expect(receivedURL == URL(string: "https://example.com/terms")) } - @Test @MainActor func windowOpenRequestEncodesRejectedResult() async throws { + @Test @MainActor func delegationRequestEncodesRejectedResult() async throws { let request = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":"https://example.com"}} """# - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.windowOpen) { _ in + let client = EmbeddedCheckoutProtocol.Client() + .on(windowOpenDescriptor) { _ in .rejected(reason: "no presenter available") } @@ -115,8 +155,8 @@ struct ClientTests { #expect(messages[0]["content"] as? String == "no presenter available") } - @Test @MainActor func windowOpenRequestReturnsNilWhenHandlerNotRegistered() async { - let client = CheckoutProtocol.Client() + @Test @MainActor func delegationRequestReturnsNilWhenHandlerNotRegistered() async { + let client = EmbeddedCheckoutProtocol.Client() let request = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":"https://example.com"}} """# @@ -125,9 +165,9 @@ struct ClientTests { #expect(response == nil) } - @Test @MainActor func windowOpenRequestWithNullURLReturnsInvalidParamsError() async throws { - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.windowOpen) { _ in .success } + @Test @MainActor func delegationRequestWithNullURLReturnsInvalidParamsError() async throws { + let client = EmbeddedCheckoutProtocol.Client() + .on(windowOpenDescriptor) { _ in .success } let request = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":null}} """# @@ -141,14 +181,14 @@ struct ClientTests { #expect(error["message"] as? String == "Invalid params") } - @Test @MainActor func windowOpenRequestLastHandlerWins() async throws { + @Test @MainActor func delegationRequestLastHandlerWins() async throws { let request = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":"https://example.com"}} """# - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.windowOpen) { _ in .rejected(reason: "first") } - .on(CheckoutProtocol.windowOpen) { _ in .success } + let client = EmbeddedCheckoutProtocol.Client() + .on(windowOpenDescriptor) { _ in .rejected(reason: "first") } + .on(windowOpenDescriptor) { _ in .success } let response = try #require(await client.process(request)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) @@ -157,13 +197,13 @@ struct ClientTests { #expect(ucp["status"] as? String == "success") } - @Test @MainActor func windowOpenRequestAdvertisesDelegationInReadyResponse() async throws { + @Test @MainActor func delegationAdvertisesDelegationInReadyResponse() async throws { let ready = #""" {"jsonrpc":"2.0","id":"ready-1","method":"ec.ready","params":{"delegate":["window.open"]}} """# - let client = CheckoutProtocol.Client() - .on(CheckoutProtocol.windowOpen) { _ in .success } + let client = EmbeddedCheckoutProtocol.Client() + .on(windowOpenDescriptor) { _ in .success } let response = try #require(await client.process(ready)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) @@ -177,18 +217,18 @@ struct ClientTests { {"jsonrpc":"2.0","id":"ready-bad","method":"ec.ready","params":{"delegate":[null]}} """# - let client = CheckoutProtocol.Client() + let client = EmbeddedCheckoutProtocol.Client() let response = try #require(await client.process(ready)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) #expect(parsed["id"] as? String == "ready-bad") let error = try #require(parsed["error"] as? [String: Any]) - #expect(error["code"] as? Int == CheckoutProtocol.parseErrorCode) - #expect(error["message"] as? String == CheckoutProtocol.parseErrorMessage) + #expect(error["code"] as? Int == EmbeddedCheckoutProtocol.parseErrorCode) + #expect(error["message"] as? String == EmbeddedCheckoutProtocol.parseErrorMessage) } @Test @MainActor func readyReturnsResponse() async throws { - let client = CheckoutProtocol.Client() + let client = EmbeddedCheckoutProtocol.Client() let response = try await client.process(readyFixture()) @@ -199,7 +239,7 @@ struct ClientTests { #expect(parsed["params"] == nil) let result = try #require(parsed["result"] as? [String: Any]) let ucp = try #require(result["ucp"] as? [String: Any]) - #expect(ucp["version"] as? String == CheckoutProtocol.specVersion) + #expect(ucp["version"] as? String == EmbeddedCheckoutProtocol.specVersion) #expect(ucp["status"] as? String == "success") } } diff --git a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecDecodeTests.swift b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecDecodeTests.swift index c8d46cf3..a2dfefe9 100644 --- a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecDecodeTests.swift +++ b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecDecodeTests.swift @@ -6,7 +6,7 @@ import Testing struct CodecDecodeTests { @Test func decodesNotification() throws { let json = try fixtureString("notification") - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .notification(method, payload) = message else { Issue.record("Expected .notification, got \(message)") @@ -25,7 +25,7 @@ struct CodecDecodeTests { let json = #""" {"jsonrpc":"2.0","method":"ec.error","params":{"error":{"ucp":{"version":"2026-04-08","status":"error"},"messages":[{"type":"error","code":"unrecoverable","content":"Boom.","severity":"recoverable"}]}}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .notification(method, payload) = message else { Issue.record("Expected .notification, got \(message)") @@ -41,7 +41,7 @@ struct CodecDecodeTests { @Test func decodesRequestCarriesRawParams() throws { let json = try fixtureString("request") - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .request(id, method, params) = message else { Issue.record("Expected .request, got \(message)") @@ -59,9 +59,9 @@ struct CodecDecodeTests { #expect(checkout["currency"] as? String == "CAD") } - @Test func decodesWindowOpenRequest() throws { + @Test func decodesWindowOpenRequestAsRawRequest() throws { let json = try fixtureString("window_open_request") - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .request(id, method, params) = message else { Issue.record("Expected .request, got \(message)") @@ -71,15 +71,15 @@ struct CodecDecodeTests { #expect(id == "req-window-1") #expect(method == "ec.window.open_request") - let payload = try #require(CheckoutProtocol.windowOpen.decode(params)) - #expect(payload.url == URL(string: "https://example.com/terms")) + let parsed = try #require(JSONSerialization.jsonObject(with: params) as? [String: Any]) + #expect(parsed["url"] as? String == "https://example.com/terms") } @Test func windowOpenRequestDropsUnknownParamsBeforeDispatch() throws { let json = #""" {"jsonrpc":"2.0","id":"req-window-1","method":"ec.window.open_request","params":{"url":"https://example.com/terms","unknown":"value"}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .request(_, _, params) = message else { Issue.record("Expected .request, got \(message)") @@ -91,26 +91,11 @@ struct CodecDecodeTests { #expect(parsed["unknown"] == nil) } - @Test func windowOpenDescriptorRejectsEmptyURL() { - let params = Data(#"{"url":""}"#.utf8) - #expect(CheckoutProtocol.windowOpen.decode(params) == nil) - } - - @Test func windowOpenDescriptorRejectsMissingURL() { - let params = Data("{}".utf8) - #expect(CheckoutProtocol.windowOpen.decode(params) == nil) - } - - @Test func windowOpenDescriptorRejectsNullURL() { - let params = Data(#"{"url":null}"#.utf8) - #expect(CheckoutProtocol.windowOpen.decode(params) == nil) - } - @Test func decodesMalformedWindowOpenParamsAsInvalidParamsError() { let json = #""" {"jsonrpc":"2.0","id":"req-window-bad","method":"ec.window.open_request","params":{"url":null}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .error(id, code, responseMessage) = message else { Issue.record("Expected .error, got \(message)") @@ -126,7 +111,7 @@ struct CodecDecodeTests { let json = """ {"jsonrpc":"2.0","method":"ec.unknown","params":{"something":"else"}} """ - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .unknown(method, _) = message else { Issue.record("Expected .unknown, got \(message)") @@ -140,7 +125,7 @@ struct CodecDecodeTests { let json = #""" {"jsonrpc":"2.0","id":1,"method":"ec.ready","params":{"delegate":[]}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .ready(id, delegations) = message else { Issue.record("Expected .ready, got \(message)") @@ -155,7 +140,7 @@ struct CodecDecodeTests { let json = #""" {"jsonrpc":"2.0","id":null,"method":"ec.ready","params":{"delegate":[]}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .ready(id, delegations) = message else { Issue.record("Expected .ready, got \(message)") @@ -170,7 +155,7 @@ struct CodecDecodeTests { let json = #""" {"jsonrpc":"2.0","id":"ready-no-params","method":"ec.ready"} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .ready(id, delegations) = message else { Issue.record("Expected .ready, got \(message)") @@ -185,7 +170,7 @@ struct CodecDecodeTests { let json = #""" {"jsonrpc":"2.0","id":"ready-bad","method":"ec.ready","params":{"delegate":[null]}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .error(id, code, responseMessage) = message else { Issue.record("Expected .error, got \(message)") @@ -193,15 +178,15 @@ struct CodecDecodeTests { } #expect(id == "ready-bad") - #expect(code == CheckoutProtocol.parseErrorCode) - #expect(responseMessage == CheckoutProtocol.parseErrorMessage) + #expect(code == EmbeddedCheckoutProtocol.parseErrorCode) + #expect(responseMessage == EmbeddedCheckoutProtocol.parseErrorMessage) } @Test func decodesNullReadyParamsAsParseError() { let json = #""" {"jsonrpc":"2.0","id":"ready-null","method":"ec.ready","params":null} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .error(id, code, responseMessage) = message else { Issue.record("Expected .error, got \(message)") @@ -209,15 +194,15 @@ struct CodecDecodeTests { } #expect(id == "ready-null") - #expect(code == CheckoutProtocol.parseErrorCode) - #expect(responseMessage == CheckoutProtocol.parseErrorMessage) + #expect(code == EmbeddedCheckoutProtocol.parseErrorCode) + #expect(responseMessage == EmbeddedCheckoutProtocol.parseErrorMessage) } @Test func rejectsFractionalJSONRPCID() { let json = #""" {"jsonrpc":"2.0","id":1.5,"method":"ec.ready","params":{"delegate":[]}} """# - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .unknown(method, _) = message else { Issue.record("Expected .unknown for fractional id, got \(message)") @@ -229,7 +214,7 @@ struct CodecDecodeTests { @Test func handlesMalformedJSON() { let json = "not valid json at all" - let message = CheckoutProtocol.decode(jsonRpc: json) + let message = EmbeddedCheckoutProtocol.decode(jsonRpc: json) guard case let .unknown(method, _) = message else { Issue.record("Expected .unknown for malformed JSON, got \(message)") diff --git a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecEncodeTests.swift b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecEncodeTests.swift index f0c431ca..df780a4d 100644 --- a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecEncodeTests.swift +++ b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CodecEncodeTests.swift @@ -14,12 +14,12 @@ struct CodecEncodeTests { paymentHandlers: nil, services: nil, status: .success, - version: CheckoutProtocol.specVersion + version: EmbeddedCheckoutProtocol.specVersion ), continueURL: nil, messages: nil ) - let json = CheckoutProtocol.encodeResponse(id: "req-456", result: result) + let json = EmbeddedCheckoutProtocol.encodeResponse(id: "req-456", result: result) let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) #expect(parsed["jsonrpc"] as? String == "2.0") @@ -28,7 +28,7 @@ struct CodecEncodeTests { } @Test func encodesReadyResponseWithResultEnvelope() throws { - let json = CheckoutProtocol.encodeReadyResponse(id: "ready-1", acceptedDelegations: []) + let json = EmbeddedCheckoutProtocol.encodeReadyResponse(id: "ready-1", acceptedDelegations: []) let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) #expect(parsed["jsonrpc"] as? String == "2.0") @@ -38,13 +38,13 @@ struct CodecEncodeTests { let result = try #require(parsed["result"] as? [String: Any]) let ucp = try #require(result["ucp"] as? [String: Any]) - #expect(ucp["version"] as? String == CheckoutProtocol.specVersion) + #expect(ucp["version"] as? String == EmbeddedCheckoutProtocol.specVersion) #expect(ucp["status"] as? String == "success") #expect(result["delegate"] == nil, "Empty delegate list must be omitted") } @Test func encodesReadyResponseEchoesAcceptedDelegations() throws { - let json = CheckoutProtocol.encodeReadyResponse(id: "ready-1", acceptedDelegations: ["window.open"]) + let json = EmbeddedCheckoutProtocol.encodeReadyResponse(id: "ready-1", acceptedDelegations: ["window.open"]) let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) let result = try #require(parsed["result"] as? [String: Any]) @@ -53,14 +53,14 @@ struct CodecEncodeTests { } @Test func encodesReadyResponseWithNumericID() throws { - let json = CheckoutProtocol.encodeReadyResponse(id: 7, acceptedDelegations: []) + let json = EmbeddedCheckoutProtocol.encodeReadyResponse(id: 7, acceptedDelegations: []) let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) #expect(parsed["id"] as? Int == 7) } @Test func encodesReadyResponseWithNullID() throws { - let json = CheckoutProtocol.encodeReadyResponse(id: .null, acceptedDelegations: []) + let json = EmbeddedCheckoutProtocol.encodeReadyResponse(id: .null, acceptedDelegations: []) let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) #expect(parsed["id"] is NSNull) @@ -71,13 +71,13 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-1","method":"ec.ready","params":{"delegate":["payment.credential"]}} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message)) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) #expect(parsed["id"] as? String == "ready-1") let result = try #require(parsed["result"] as? [String: Any]) let ucp = try #require(result["ucp"] as? [String: Any]) - #expect(ucp["version"] as? String == CheckoutProtocol.specVersion) + #expect(ucp["version"] as? String == EmbeddedCheckoutProtocol.specVersion) #expect(ucp["status"] as? String == "success") } @@ -86,7 +86,7 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-1","method":"ec.ready","params":{"delegate":["payment.credential","window.open","fulfillment.address_change"]}} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message, supportedDelegations: ["window.open"])) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message, supportedDelegations: ["window.open"])) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) let result = try #require(parsed["result"] as? [String: Any]) @@ -99,7 +99,7 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-1","method":"ec.ready","params":{"delegate":["payment.credential"]}} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message, supportedDelegations: ["window.open"])) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message, supportedDelegations: ["window.open"])) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) let result = try #require(parsed["result"] as? [String: Any]) @@ -111,7 +111,7 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-no-params","method":"ec.ready"} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message)) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) #expect(parsed["id"] as? String == "ready-no-params") @@ -124,13 +124,13 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-bad","method":"ec.ready","params":{"delegate":[null]}} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message)) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) #expect(parsed["id"] as? String == "ready-bad") let error = try #require(parsed["error"] as? [String: Any]) - #expect(error["code"] as? Int == CheckoutProtocol.parseErrorCode) - #expect(error["message"] as? String == CheckoutProtocol.parseErrorMessage) + #expect(error["code"] as? Int == EmbeddedCheckoutProtocol.parseErrorCode) + #expect(error["message"] as? String == EmbeddedCheckoutProtocol.parseErrorMessage) } @Test func acknowledgeReadyReturnsParseErrorForNullParams() throws { @@ -138,13 +138,13 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","id":"ready-null","method":"ec.ready","params":null} """# - let response = try #require(CheckoutProtocol.acknowledgeReady(message)) + let response = try #require(EmbeddedCheckoutProtocol.acknowledgeReady(message)) let parsed = try #require(JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) #expect(parsed["id"] as? String == "ready-null") let error = try #require(parsed["error"] as? [String: Any]) - #expect(error["code"] as? Int == CheckoutProtocol.parseErrorCode) - #expect(error["message"] as? String == CheckoutProtocol.parseErrorMessage) + #expect(error["code"] as? Int == EmbeddedCheckoutProtocol.parseErrorCode) + #expect(error["message"] as? String == EmbeddedCheckoutProtocol.parseErrorMessage) } @Test func acknowledgeReadyReturnsNilForNonReadyMessage() { @@ -152,54 +152,10 @@ struct CodecEncodeTests { {"jsonrpc":"2.0","method":"ec.start","params":{"checkout":{"id":"c"}}} """# - #expect(CheckoutProtocol.acknowledgeReady(message) == nil) + #expect(EmbeddedCheckoutProtocol.acknowledgeReady(message) == nil) } @Test func acknowledgeReadyReturnsNilForMalformedJSON() { - #expect(CheckoutProtocol.acknowledgeReady("not json") == nil) - } - - @Test func windowOpenResultEncodesSuccessBody() throws { - let json = CheckoutProtocol.encodeResponse(id: "req-window-1", result: WindowOpenResult.success) - let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) - - #expect(parsed["jsonrpc"] as? String == "2.0") - #expect(parsed["id"] as? String == "req-window-1") - let result = try #require(parsed["result"] as? [String: Any]) - let ucp = try #require(result["ucp"] as? [String: Any]) - #expect(ucp["status"] as? String == "success") - #expect(ucp["version"] as? String == CheckoutProtocol.specVersion) - } - - @Test func windowOpenResultEncodesRejectedBody() throws { - let json = CheckoutProtocol.encodeResponse( - id: "req-window-1", - result: WindowOpenResult.rejected(reason: "canOpenURL returned false") - ) - let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) - - #expect(parsed["id"] as? String == "req-window-1") - let result = try #require(parsed["result"] as? [String: Any]) - let ucp = try #require(result["ucp"] as? [String: Any]) - #expect(ucp["status"] as? String == "error") - - let messages = try #require(result["messages"] as? [[String: Any]]) - #expect(messages.count == 1) - #expect(messages[0]["type"] as? String == "error") - #expect(messages[0]["code"] as? String == "window_open_rejected_error") - #expect(messages[0]["severity"] as? String == "unrecoverable") - #expect(messages[0]["content"] as? String == "canOpenURL returned false") - } - - @Test func windowOpenResultEncodesRejectedWithNilReason() throws { - let json = CheckoutProtocol.encodeResponse( - id: "req-window-1", - result: WindowOpenResult.rejected(reason: nil) - ) - let parsed = try #require(JSONSerialization.jsonObject(with: Data(json.utf8)) as? [String: Any]) - - let result = try #require(parsed["result"] as? [String: Any]) - let messages = try #require(result["messages"] as? [[String: Any]]) - #expect(messages[0]["content"] as? String != "", "Content is required per message_error schema") + #expect(EmbeddedCheckoutProtocol.acknowledgeReady("not json") == nil) } } diff --git a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/DescriptorTests.swift b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/DescriptorTests.swift index dc981217..c5390e55 100644 --- a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/DescriptorTests.swift +++ b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/DescriptorTests.swift @@ -7,121 +7,35 @@ struct DescriptorTests { @Suite("Spec Version") struct SpecVersion { @Test func matchesOpenRPCInfoVersion() { - #expect(CheckoutProtocol.specVersion == "2026-04-08") + #expect(EmbeddedCheckoutProtocol.specVersion == "2026-04-08") } } - @Suite("Notifications") - struct Notifications { - @Test func startMethod() { - #expect(CheckoutProtocol.start.method == "ec.start") + @Suite("Event Catalog") + struct EventCatalog { + @Test func bindsNotificationMethods() { + #expect(EmbeddedCheckoutProtocol.Event.start.method == "ec.start") + #expect(EmbeddedCheckoutProtocol.Event.complete.method == "ec.complete") + #expect(EmbeddedCheckoutProtocol.Event.messagesChange.method == "ec.messages.change") + #expect(EmbeddedCheckoutProtocol.Event.lineItemsChange.method == "ec.line_items.change") + #expect(EmbeddedCheckoutProtocol.Event.totalsChange.method == "ec.totals.change") + #expect(EmbeddedCheckoutProtocol.Event.error.method == "ec.error") } - @Test func completeMethod() { - #expect(CheckoutProtocol.complete.method == "ec.complete") + @Test func exposesEveryOpenRPCMethod() { + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.start")) + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.complete")) + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.window.open_request")) } - @Test func messagesChangeMethod() { - #expect(CheckoutProtocol.messagesChange.method == "ec.messages.change") + @Test func includesMethodsBeyondTheCuratedConsumerSubset() { + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.payment.credential_request")) + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.fulfillment.change")) + #expect(EmbeddedCheckoutProtocol.Event.all.contains("ec.buyer.change")) } - @Test func lineItemsChangeMethod() { - #expect(CheckoutProtocol.lineItemsChange.method == "ec.line_items.change") - } - - @Test func totalsChangeMethod() { - #expect(CheckoutProtocol.totalsChange.method == "ec.totals.change") - } - - @Test func errorMethod() { - #expect(CheckoutProtocol.error.method == "ec.error") - } - } - - @Suite("Supported Protocol Methods") - struct SupportedProtocolMethods { - @Test func includesReadyNotificationsAndDelegations() { - #expect(CheckoutProtocol.supportedProtocolMethods == [ - CheckoutProtocol.readyMethod, - CheckoutProtocol.start.method, - CheckoutProtocol.complete.method, - CheckoutProtocol.error.method, - CheckoutProtocol.lineItemsChange.method, - CheckoutProtocol.messagesChange.method, - CheckoutProtocol.totalsChange.method, - CheckoutProtocol.windowOpen.method - ]) - } - - @Test func excludesInternalOrUnsupportedMethods() { - #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ec.buyer.change")) - #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ec.payment.credential_request")) - #expect(!CheckoutProtocol.supportedProtocolMethods.contains("ep.cart.ready")) - } - - @Test func supportedProtocolMethodParsesValidSupportedMessage() { - let message = #"{"jsonrpc":"2.0","method":"ec.start","params":{"checkout":{}}}"# - - #expect(CheckoutProtocol.supportedProtocolMethod(message) == CheckoutProtocol.start.method) - } - - @Test func supportedProtocolMethodRejectsUnsupportedOrInvalidMessage() { - #expect(CheckoutProtocol.supportedProtocolMethod(#"{"jsonrpc":"2.0","method":"custom"}"#) == nil) - #expect(CheckoutProtocol.supportedProtocolMethod(#"{"jsonrpc":"1.0","method":"ec.start"}"#) == nil) - #expect(CheckoutProtocol.supportedProtocolMethod("not json") == nil) - } - - @Test func methodNotFoundResponseEncodesUnsupportedRequests() throws { - let response = try #require( - CheckoutProtocol.methodNotFoundResponse( - forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":"unsupported","params":{}}"# - ) - ) - let data = try #require(response.data(using: .utf8)) - let object = try #require(try JSONSerialization.jsonObject(with: data) as? [String: Any]) - - #expect(object["jsonrpc"] as? String == "2.0") - #expect(object["id"] as? String == "unsupported") - let error = try #require(object["error"] as? [String: Any]) - #expect(error["code"] as? Int == CheckoutProtocol.methodNotFoundCode) - #expect(error["message"] as? String == CheckoutProtocol.methodNotFoundMessage) - } - - @Test func methodNotFoundResponsePreservesNumericRequestID() throws { - let response = try #require( - CheckoutProtocol.methodNotFoundResponse( - forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":7,"params":{}}"# - ) - ) - let data = try #require(response.data(using: .utf8)) - let object = try #require(try JSONSerialization.jsonObject(with: data) as? [String: Any]) - - #expect(object["id"] as? Int == 7) - } - - @Test func methodNotFoundResponsePreservesNullRequestID() throws { - let response = try #require( - CheckoutProtocol.methodNotFoundResponse( - forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":null,"params":{}}"# - ) - ) - let data = try #require(response.data(using: .utf8)) - let object = try #require(try JSONSerialization.jsonObject(with: data) as? [String: Any]) - - #expect(object["id"] is NSNull) - } - - @Test func methodNotFoundResponseRejectsInvalidRequestIDs() { - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":true,"params":{}}"#) == nil) - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":{},"params":{}}"#) == nil) - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom","id":1.5,"params":{}}"#) == nil) - } - - @Test func methodNotFoundResponseRejectsSupportedNotificationsOrInvalidMessages() { - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"custom"}"#) == nil) - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"2.0","method":"ec.start","id":"supported"}"#) == nil) - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: #"{"jsonrpc":"1.0","method":"custom","id":"unsupported"}"#) == nil) - #expect(CheckoutProtocol.methodNotFoundResponse(forUnsupportedProtocolRequest: "not json") == nil) + @Test func methodsAreUnique() { + #expect(Set(EmbeddedCheckoutProtocol.Event.all).count == EmbeddedCheckoutProtocol.Event.all.count) } } } diff --git a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CheckoutProtocolURLTests.swift b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/EmbeddedCheckoutProtocolURLTests.swift similarity index 64% rename from protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CheckoutProtocolURLTests.swift rename to protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/EmbeddedCheckoutProtocolURLTests.swift index 4595583c..c0cb9976 100644 --- a/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/CheckoutProtocolURLTests.swift +++ b/protocol/languages/swift/Tests/ShopifyCheckoutProtocolTests/EmbeddedCheckoutProtocolURLTests.swift @@ -2,7 +2,7 @@ import Foundation @testable import ShopifyCheckoutProtocol import Testing -@Suite("CheckoutProtocol URL Tests") +@Suite("EmbeddedCheckoutProtocol URL Tests") struct CheckoutProtocolURLTests { private let baseURL = URL(string: "https://shop.com/cart/c/abc")! @@ -11,17 +11,22 @@ struct CheckoutProtocolURLTests { } @Test func appendsEcVersion() { - let items = queryItems(CheckoutProtocol.url(for: baseURL)) - #expect(items.contains(URLQueryItem(name: "ec_version", value: CheckoutProtocol.specVersion))) + let items = queryItems(EmbeddedCheckoutProtocol.url(for: baseURL)) + #expect(items.contains(URLQueryItem(name: "ec_version", value: EmbeddedCheckoutProtocol.specVersion))) } - @Test func appendsDefaultDelegate() { - let items = queryItems(CheckoutProtocol.url(for: baseURL)) + @Test func omitsDelegateByDefault() { + let items = queryItems(EmbeddedCheckoutProtocol.url(for: baseURL)) + #expect(!items.contains(where: { $0.name == "ec_delegate" })) + } + + @Test func appendsSuppliedDelegate() { + let items = queryItems(EmbeddedCheckoutProtocol.url(for: baseURL, delegations: ["window.open"])) #expect(items.contains(URLQueryItem(name: "ec_delegate", value: "window.open"))) } @Test func joinsMultipleDelegationsWithComma() { - let result = CheckoutProtocol.url( + let result = EmbeddedCheckoutProtocol.url( for: baseURL, delegations: ["window.open", "payment.credential"] ) @@ -30,29 +35,29 @@ struct CheckoutProtocolURLTests { } @Test func omitsDelegateWhenEmpty() { - let items = queryItems(CheckoutProtocol.url(for: baseURL, delegations: [])) + let items = queryItems(EmbeddedCheckoutProtocol.url(for: baseURL, delegations: [])) #expect(!items.contains(where: { $0.name == "ec_delegate" })) } @Test func preservesExistingQueryItems() throws { let url = try #require(URL(string: "https://shop.com/cart/c/abc?key=cart_token&utm_source=email")) - let items = queryItems(CheckoutProtocol.url(for: url)) + let items = queryItems(EmbeddedCheckoutProtocol.url(for: url)) #expect(items.contains(URLQueryItem(name: "key", value: "cart_token"))) #expect(items.contains(URLQueryItem(name: "utm_source", value: "email"))) - #expect(items.contains(URLQueryItem(name: "ec_version", value: CheckoutProtocol.specVersion))) + #expect(items.contains(URLQueryItem(name: "ec_version", value: EmbeddedCheckoutProtocol.specVersion))) } @Test func replacesCallerSuppliedProtocolQueryItems() throws { let url = try #require(URL(string: "https://shop.com/cart/c/abc?ec_version=stale&ec_delegate=custom")) - let items = queryItems(CheckoutProtocol.url(for: url)) + let items = queryItems(EmbeddedCheckoutProtocol.url(for: url, delegations: ["window.open"])) - #expect(items.filter { $0.name == "ec_version" }.map(\.value) == [CheckoutProtocol.specVersion]) + #expect(items.filter { $0.name == "ec_version" }.map(\.value) == [EmbeddedCheckoutProtocol.specVersion]) #expect(items.filter { $0.name == "ec_delegate" }.map(\.value) == ["window.open"]) } @Test func isIdempotentOnRecall() { - let once = CheckoutProtocol.url(for: baseURL) - let twice = CheckoutProtocol.url(for: once) + let once = EmbeddedCheckoutProtocol.url(for: baseURL, delegations: ["window.open"]) + let twice = EmbeddedCheckoutProtocol.url(for: once, delegations: ["window.open"]) let items = queryItems(twice) #expect(items.filter { $0.name == "ec_version" }.count == 1) @@ -61,9 +66,9 @@ struct CheckoutProtocolURLTests { @Test func removesExistingDelegationWhenDelegationsAreEmpty() throws { let url = try #require(URL(string: "https://shop.com/cart/c/abc?ec_delegate=custom")) - let items = queryItems(CheckoutProtocol.url(for: url, delegations: [])) + let items = queryItems(EmbeddedCheckoutProtocol.url(for: url, delegations: [])) - #expect(items.contains(URLQueryItem(name: "ec_version", value: CheckoutProtocol.specVersion))) + #expect(items.contains(URLQueryItem(name: "ec_version", value: EmbeddedCheckoutProtocol.specVersion))) #expect(!items.contains { $0.name == "ec_delegate" }) } } diff --git a/protocol/scripts/generate_models.mjs b/protocol/scripts/generate_models.mjs index 6ea0583f..8f6f31a9 100755 --- a/protocol/scripts/generate_models.mjs +++ b/protocol/scripts/generate_models.mjs @@ -363,6 +363,8 @@ async function generateSwift(specDir, output) { return `${source.slice(0, helperStart)}${SWIFT_JSON_HELPER_REPLACEMENT}`; }); + + await run("node", [path.join(PROTOCOL_DIR, "scripts", "generate_swift_catalog.mjs")]); } async function generateTypescript(specDir, output) { diff --git a/protocol/scripts/generate_swift_catalog.mjs b/protocol/scripts/generate_swift_catalog.mjs new file mode 100644 index 00000000..2019797c --- /dev/null +++ b/protocol/scripts/generate_swift_catalog.mjs @@ -0,0 +1,148 @@ +#!/usr/bin/env node +import fs from 'node:fs'; +import path from 'node:path'; +import {fileURLToPath} from 'node:url'; + +const scriptDir = path.dirname(fileURLToPath(import.meta.url)); +const protocolRoot = path.resolve(scriptDir, '..'); + +const openRpcPath = path.resolve( + protocolRoot, + 'services/shopping/embedded.openrpc.json', +); +const outputPath = path.resolve( + protocolRoot, + 'languages/swift/Sources/ShopifyCheckoutProtocol/Generated/EmbeddedCheckoutProtocol+Event.swift', +); + +const fallbackPayload = 'JSONAny'; + +const refPayloadMappings = new Map([ + ['checkout.json', 'Checkout'], + ['cart.json', fallbackPayload], + ['types/error_response.json', 'ErrorResponse'], + ['error_response.json', 'ErrorResponse'], +]); + +function normalizeRef(ref) { + return ref + .replace(/^\.\.\/\.\.\/schemas\/shopping\//, '') + .replace(/^\.\.\/\.\.\/schemas\/common\//, '') + .replace(/#.*$/, ''); +} + +function methodNameToIdentifier(methodName) { + // Drop the leading `ec` capability segment; the enclosing + // EmbeddedCheckoutProtocol.Event namespace already conveys it. + const [, ...parts] = methodName.split(/[._]/g).filter(Boolean); + + return parts + .map((part, index) => + index === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1), + ) + .join(''); +} + +function resolveMethod(method, openRpcDir) { + if (typeof method.$ref !== 'string') { + return method; + } + + const [filePart, pointer] = method.$ref.split('#'); + const filePath = path.resolve(openRpcDir, filePart); + const document = JSON.parse(fs.readFileSync(filePath, 'utf8')); + + const segments = (pointer ?? '').split('/').filter(Boolean); + let resolved = document; + for (const segment of segments) { + resolved = resolved?.[segment.replace(/~1/g, '/').replace(/~0/g, '~')]; + } + + if (!resolved || typeof resolved.name !== 'string') { + throw new Error(`Cannot resolve OpenRPC method $ref: ${method.$ref}`); + } + + return resolved; +} + +function payloadType(method) { + const params = method.params ?? []; + if (params.length === 0) { + return fallbackPayload; + } + + const ref = params[0]?.schema?.$ref; + if (typeof ref !== 'string') { + return fallbackPayload; + } + + const normalized = normalizeRef(ref); + return refPayloadMappings.get(normalized) ?? fallbackPayload; +} + +const openRpcDir = path.dirname(openRpcPath); +const openRpc = JSON.parse(fs.readFileSync(openRpcPath, 'utf8')); +const entries = []; + +for (const rawMethod of openRpc.methods ?? []) { + const method = resolveMethod(rawMethod, openRpcDir); + if (typeof method.name !== 'string') { + throw new Error('Encountered OpenRPC method without a name'); + } + + // Scope the Swift catalog to the Embedded Checkout (`ec.*`) capability. + // Sibling capabilities (e.g. `ep.cart.*`) are excluded until they have a + // typed payload and a consumer. + if (!method.name.startsWith('ec.')) { + continue; + } + + entries.push({ + identifier: methodNameToIdentifier(method.name), + method: method.name, + payload: payloadType(method), + }); +} + +const seen = new Set(); +for (const entry of entries) { + if (seen.has(entry.identifier)) { + throw new Error(`Duplicate catalog identifier: ${entry.identifier}`); + } + seen.add(entry.identifier); +} + +const payloadTypes = Array.from( + new Set(entries.map(entry => entry.payload)), +).sort(); + +const conformances = payloadTypes + .map(type => `extension ${type}: EventPayload {}`) + .join('\n'); + +const generated = `// This file is generated by protocol/scripts/generate_swift_catalog.mjs. +// Do not edit directly. + +import Foundation + +${conformances} + +extension EmbeddedCheckoutProtocol { + public enum Event { +${entries + .map( + entry => + ` public static let ${entry.identifier} = NotificationDescriptor<${entry.payload}>(method: "${entry.method}")`, + ) + .join('\n')} + + public static let all: [String] = [ +${entries.map(entry => ` ${entry.identifier}.method,`).join('\n')} + ] + } +} +`; + +fs.mkdirSync(path.dirname(outputPath), {recursive: true}); +fs.writeFileSync(outputPath, generated); +console.log(`Generated ${outputPath}`);