From 2ae6a1e91e64309557146ced70a34164a0e98de4 Mon Sep 17 00:00:00 2001 From: Kieran Osgood Date: Wed, 13 May 2026 11:31:10 +0100 Subject: [PATCH] Use checked Sendable GraphQL JSON values --- .../ShopifyAcceleratedCheckoutsApp.swift | 25 +- platforms/swift/Scripts/lint | 9 +- .../Internal/Clock.swift | 2 +- .../Internal/Extensions/Task.swift | 2 +- .../GraphQLClient/GraphQLClient.swift | 8 +- .../GraphQLRequest+Directives.swift | 2 +- .../GraphQLRequest/GraphQLRequest.swift | 24 +- .../GraphQLClient/GraphQLResponse.swift | 2 +- .../Internal/GraphQLClient/GraphQLTypes.swift | 124 +++- .../StorefrontAPI/StorefrontAPI+Queries.swift | 15 +- .../StorefrontAPI/StorefrontAPI.swift | 4 +- ...fyAcceleratedCheckouts+Configuration.swift | 47 +- .../ApplePayState.swift | 2 +- .../ShopifyCheckoutKit/CheckoutError.swift | 4 +- .../TestHelpers.swift | 4 +- .../Wallets/ApplePay/PKEncoderTests.swift | 16 +- .../api/ShopifyAcceleratedCheckouts.json | 594 +++--------------- platforms/swift/api/ShopifyCheckoutKit.json | 28 + 18 files changed, 287 insertions(+), 625 deletions(-) diff --git a/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp.swift b/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp.swift index 2cafbbae..a730a465 100644 --- a/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp.swift +++ b/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp.swift @@ -11,14 +11,16 @@ struct ShopifyAcceleratedCheckoutsApp: App { @AppStorage(AppStorageKeys.email.rawValue) var email: String = "" @AppStorage(AppStorageKeys.phone.rawValue) var phone: String = "" @AppStorage(AppStorageKeys.supportedCountries.rawValue) var supportedCountriesString: String = "" + @StateObject private var configuration: ShopifyAcceleratedCheckouts.Configuration - var configuration: ShopifyAcceleratedCheckouts.Configuration { - .init( - storefrontDomain: EnvironmentVariables.storefrontDomain, - storefrontAccessToken: EnvironmentVariables.storefrontAccessToken, - customer: ShopifyAcceleratedCheckouts.Customer( - email: email.isEmpty ? nil : email, - phoneNumber: phone.isEmpty ? nil : phone + init() { + let email = UserDefaults.standard.string(forKey: AppStorageKeys.email.rawValue) ?? "" + let phone = UserDefaults.standard.string(forKey: AppStorageKeys.phone.rawValue) ?? "" + _configuration = StateObject( + wrappedValue: ShopifyAcceleratedCheckouts.Configuration( + storefrontDomain: EnvironmentVariables.storefrontDomain, + storefrontAccessToken: EnvironmentVariables.storefrontAccessToken, + customer: Self.customer(email: email, phone: phone) ) ) } @@ -47,6 +49,7 @@ struct ShopifyAcceleratedCheckoutsApp: App { } .onAppear { ShopifyAcceleratedCheckouts.logLevel = logLevel + updateConfiguration() } .environmentObject(configuration) .environmentObject(applePayConfiguration) @@ -54,12 +57,16 @@ struct ShopifyAcceleratedCheckoutsApp: App { .environment(\.locale, Locale(identifier: locale)) } - private func updateConfiguration() { - configuration.customer = ShopifyAcceleratedCheckouts.Customer( + private static func customer(email: String, phone: String) -> ShopifyAcceleratedCheckouts.Customer { + ShopifyAcceleratedCheckouts.Customer( email: email.isEmpty ? nil : email, phoneNumber: phone.isEmpty ? nil : phone ) } + + private func updateConfiguration() { + configuration.customer = Self.customer(email: email, phone: phone) + } } private func createApplePayConfiguration( diff --git a/platforms/swift/Scripts/lint b/platforms/swift/Scripts/lint index 62c457b6..a863cf40 100755 --- a/platforms/swift/Scripts/lint +++ b/platforms/swift/Scripts/lint @@ -104,15 +104,16 @@ if [[ "$VERBOSE" == "false" ]]; then QUIET_FLAG="--quiet" fi +# Run from the directory containing .swiftlint.yml so its `included:` and +# `excluded:` paths resolve consistently. +PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" + if [[ "$MODE" == "fix" ]]; then - $SWIFTLINT lint --fix --no-cache $QUIET_FLAG + (cd "$PROJECT_ROOT" && $SWIFTLINT lint --fix --no-cache $QUIET_FLAG) fi # SwiftLint doesn't report errors when running in fix mode # Running again in strict mode to ensure no errors are missed. -# Run from the directory containing .swiftlint.yml so its `included:` paths -# resolve consistently. -PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" (cd "$PROJECT_ROOT" && $SWIFTLINT lint --strict --no-cache $QUIET_FLAG) LINT_STATUS=$? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Clock.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Clock.swift index cb8b08cb..8b6b2cf1 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Clock.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Clock.swift @@ -1,7 +1,7 @@ import Foundation /// Protocol for abstracting time-based operations to enable testing -protocol Clock { +protocol Clock: Sendable { /// Sleep for the specified number of nanoseconds func sleep(nanoseconds: UInt64) async throws } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Extensions/Task.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Extensions/Task.swift index 75858b8b..d04a18a0 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Extensions/Task.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/Extensions/Task.swift @@ -18,7 +18,7 @@ func exponentialDelay(for attempt: Int = 1, with retryDelay: TimeInterval) -> UI return UInt64(delayInNanoseconds) } -extension Task where Failure == Error { +extension Task where Failure == Error, Success: Sendable { @discardableResult static func retrying( priority: TaskPriority? = nil, maxRetryCount: Int = 3, diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLClient.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLClient.swift index e88abed3..efa7eaae 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLClient.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLClient.swift @@ -3,7 +3,7 @@ import ShopifyCheckoutKit /// A lightweight GraphQL client for the Storefront API without external dependencies @available(iOS 16.0, *) -class GraphQLClient { +final class GraphQLClient: Sendable { let url: URL private let headers: [String: String] private let session: URLSession @@ -30,19 +30,19 @@ class GraphQLClient { /// Execute a GraphQL query /// - Parameter operation: The GraphQL query operation /// - Returns: The decoded response - func query(_ operation: GraphQLRequest) async throws -> GraphQLResponse { + func query(_ operation: GraphQLRequest) async throws -> GraphQLResponse { return try await execute(operation: operation) } /// Execute a GraphQL mutation /// - Parameter operation: The GraphQL mutation operation /// - Returns: The decoded response - func mutate(_ operation: GraphQLRequest) async throws -> GraphQLResponse { + func mutate(_ operation: GraphQLRequest) async throws -> GraphQLResponse { return try await execute(operation: operation) } /// Execute a raw GraphQL request - private func execute( + private func execute( operation: GraphQLRequest ) async throws -> GraphQLResponse { let urlRequest = try getURLRequest( diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift index 7362d68b..a963074e 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest+Directives.swift @@ -63,7 +63,7 @@ extension GraphQLRequest { return GraphQLRequest( query: lines.joined(separator: "\n"), responseType: responseType, - variables: variables + encodedVariables: encodedVariables ) } } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest.swift index a1002d1e..f6be5c1e 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLRequest/GraphQLRequest.swift @@ -4,10 +4,14 @@ import Foundation /// GraphQLOperation binds a query (data to be requested) /// with a response Decoder(Codable to decode the data requested). -struct GraphQLRequest: Encodable { +struct GraphQLRequest: Encodable { private(set) var query: String let responseType: T.Type - let variables: [String: Any] + let encodedVariables: [String: AnyCodable] + + var variables: [String: Any] { + encodedVariables.mapValues { $0.value } + } enum CodingKeys: String, CodingKey { case query @@ -15,9 +19,17 @@ struct GraphQLRequest: Encodable { } init(query: String, responseType: T.Type, variables: [String: Any] = [:]) { + self.init( + query: query, + responseType: responseType, + encodedVariables: variables.mapValues(AnyCodable.init) + ) + } + + init(query: String, responseType: T.Type, encodedVariables: [String: AnyCodable]) { self.query = query self.responseType = responseType - self.variables = variables + self.encodedVariables = encodedVariables } init( @@ -50,8 +62,8 @@ struct GraphQLRequest: Encodable { try container.encode(query, forKey: .query) - if !variables.isEmpty { - try container.encode(AnyCodable(variables), forKey: .variables) + if !encodedVariables.isEmpty { + try container.encode(encodedVariables, forKey: .variables) } } @@ -79,7 +91,7 @@ struct GraphQLRequest: Encodable { return GraphQLRequest( query: minifiedQuery, responseType: responseType, - variables: variables + encodedVariables: encodedVariables ) } } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift index 0af53c99..c129aeca 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLResponse.swift @@ -1,5 +1,5 @@ /// GraphQL response structure -struct GraphQLResponse: Decodable { +struct GraphQLResponse: Decodable { let data: T? let errors: [GraphQLResponseError]? let extensions: [String: AnyCodable]? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift index 7fbe3ea3..415f2940 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/GraphQLClient/GraphQLTypes.swift @@ -28,31 +28,115 @@ enum GraphQLError: LocalizedError { } } -/// Helper type for encoding/decoding Any values +private enum GraphQLJSONValue { + case bool(Bool) + case int(Int) + case double(Double) + case string(String) + case null + case array([GraphQLJSONValue]) + case object([String: GraphQLJSONValue]) + case unsupported(String) + + init(_ value: Any) { + switch value { + case let value as Bool: + self = .bool(value) + case let value as Int: + self = .int(value) + case let value as Double: + self = .double(value) + case let value as String: + self = .string(value) + case let value as [String: Any]: + self = .object(value.mapValues(GraphQLJSONValue.init)) + case let value as [Any]: + self = .array(value.map(GraphQLJSONValue.init)) + case let value as AnyCodable: + self = value.storage + case is NSNull: + self = .null + default: + self = .unsupported(String(describing: type(of: value))) + } + } + + var value: Any { + switch self { + case let .bool(value): + return value + case let .int(value): + return value + case let .double(value): + return value + case let .string(value): + return value + case .null: + return NSNull() + case let .array(values): + return values.map(\.value) + case let .object(values): + return values.mapValues { $0.value } + case let .unsupported(typeName): + return typeName + } + } + + func encode(to container: inout SingleValueEncodingContainer) throws { + switch self { + case let .bool(value): + try container.encode(value) + case let .int(value): + try container.encode(value) + case let .double(value): + try container.encode(value) + case let .string(value): + try container.encode(value) + case let .array(values): + try container.encode(values.map(AnyCodable.init)) + case let .object(values): + try container.encode(values.mapValues { AnyCodable($0) }) + case .null: + try container.encodeNil() + case let .unsupported(typeName): + throw EncodingError.invalidValue(typeName, EncodingError.Context(codingPath: container.codingPath, debugDescription: "Unable to encode value of type \(typeName)")) + } + } +} + +/// Helper type for encoding/decoding dynamically-shaped JSON values. struct AnyCodable: Codable { - let value: Any + fileprivate let storage: GraphQLJSONValue + + var value: Any { + storage.value + } init(_ value: Any) { - self.value = value + storage = GraphQLJSONValue(value) + } + + fileprivate init(_ storage: GraphQLJSONValue) { + self.storage = storage } init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer() if let value = try? container.decode(Bool.self) { - self.value = value + storage = .bool(value) } else if let value = try? container.decode(Int.self) { - self.value = value + storage = .int(value) } else if let value = try? container.decode(Double.self) { - self.value = value + storage = .double(value) } else if let value = try? container.decode(String.self) { - self.value = value + storage = .string(value) } else if let value = try? container.decode([String: AnyCodable].self) { - self.value = value.mapValues { $0.value } + storage = .object(value.mapValues(\.storage)) } else if let value = try? container.decode([AnyCodable].self) { - self.value = value.map { $0.value } + storage = .array(value.map(\.storage)) } else if container.decodeNil() { - value = NSNull() + storage = .null } else { throw DecodingError.dataCorruptedError(in: container, debugDescription: "Unable to decode value") } @@ -60,24 +144,6 @@ struct AnyCodable: Codable { func encode(to encoder: Encoder) throws { var container = encoder.singleValueContainer() - - switch value { - case let value as Bool: - try container.encode(value) - case let value as Int: - try container.encode(value) - case let value as Double: - try container.encode(value) - case let value as String: - try container.encode(value) - case let value as [String: Any]: - try container.encode(value.mapValues { AnyCodable($0) }) - case let value as [Any]: - try container.encode(value.map { AnyCodable($0) }) - case is NSNull: - try container.encodeNil() - default: - throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: container.codingPath, debugDescription: "Unable to encode value")) - } + try storage.encode(to: &container) } } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Queries.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Queries.swift index 4af94ed2..7a707088 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Queries.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI+Queries.swift @@ -22,11 +22,12 @@ extension StorefrontAPI { /// Get shop information /// - Returns: Shop details func shop() async throws -> Shop { - try await QueryCache.shared.load( + let client = client + return try await QueryCache.shared.load( cacheKey: "shop", url: client.url, query: { - let response = try await self.client.query(Operations.getShop()) + let response = try await client.query(Operations.getShop()) guard let shop = response.data?.shop else { throw StorefrontAPI.Errors.payload(propertyName: "shop") } @@ -41,16 +42,16 @@ extension StorefrontAPI { actor QueryCache { static let shared = QueryCache() - private var cache: [String: Any] = [:] - private var inflightRequests: [String: Any] = [:] + private var cache: [String: any Sendable] = [:] + private var inflightRequests: [String: any Sendable] = [:] private init() {} /// Loads data with deduplication - multiple simultaneous calls will share the same request - func load( + func load( cacheKey: String, url: URL, - query: @escaping () async throws -> T + query: @Sendable @escaping () async throws -> T ) async throws -> T { let key = buildCacheKey(queryKey: cacheKey, url: url) @@ -80,7 +81,7 @@ actor QueryCache { } } - private func cache(_ result: some Any, for key: String) { + private func cache(_ result: some Sendable, for key: String) { cache[key] = result } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI.swift index 6a864b0f..4d48720b 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Internal/StorefrontAPI/StorefrontAPI.swift @@ -2,7 +2,7 @@ import Foundation /// High-level API for Storefront operations using the custom GraphQL client @available(iOS 16.0, *) -class StorefrontAPI: ObservableObject, StorefrontAPIProtocol { +final class StorefrontAPI: ObservableObject, StorefrontAPIProtocol { let client: GraphQLClient /// Initialize the Storefront API @@ -33,7 +33,7 @@ class StorefrontAPI: ObservableObject, StorefrontAPIProtocol { } @available(iOS 16.0, *) -protocol StorefrontAPIProtocol { +protocol StorefrontAPIProtocol: Sendable { // MARK: - Query Methods func cart(by id: GraphQLScalars.ID) async throws -> StorefrontAPI.Cart? diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift index ff251d7d..1db9586a 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/ShopifyAcceleratedCheckouts+Configuration.swift @@ -36,57 +36,30 @@ extension ShopifyAcceleratedCheckouts { package required init(copy: Configuration) { storefrontDomain = copy.storefrontDomain storefrontAccessToken = copy.storefrontAccessToken - customer = copy.customer?.copy() + customer = copy.customer } } - public class Customer: ObservableObject, Copyable { + public struct Customer: Sendable, Equatable { /// The email to attribute an order to on `buyerIdentity` - @Published public var email: String? + public let email: String? /// The phoneNumber to attribute an order to on `buyerIdentity` - @Published public var phoneNumber: String? + public let phoneNumber: String? /// The customer access token to attribute an order to on `buyerIdentity` - @Published public var customerAccessToken: String? + public let customerAccessToken: String? - /// Creates a customer for authenticated Shopify users. - /// - /// Use this initializer when you have a customer access token from Shopify authentication. - /// The customer's email and phone will be fetched from their Shopify account. - /// - /// - Parameter customerAccessToken: The access token from Shopify customer authentication - public init(customerAccessToken: String) { - self.customerAccessToken = customerAccessToken - email = nil - phoneNumber = nil - } - - /// Creates a customer for guest checkout or explicit contact override. - /// - /// Use this initializer when you want to pre-fill customer contact information - /// without Shopify authentication. + /// Creates customer identity data to attach to checkout buyer identity. /// /// - Parameters: - /// - email: The customer's email address - /// - phoneNumber: The customer's phone number - public init(email: String?, phoneNumber: String?) { - self.email = email - self.phoneNumber = phoneNumber - customerAccessToken = nil - } - - @available(*, deprecated, message: "Use init(customerAccessToken:) for customer accounts or init(email:phoneNumber:) for other users.") - public init(email: String?, phoneNumber: String?, customerAccessToken: String? = nil) { + /// - email: The customer's email address. + /// - phoneNumber: The customer's phone number. + /// - customerAccessToken: The access token from Shopify customer authentication. + public init(email: String? = nil, phoneNumber: String? = nil, customerAccessToken: String? = nil) { self.email = email self.phoneNumber = phoneNumber self.customerAccessToken = customerAccessToken } - - package required init(copy: Customer) { - email = copy.email - phoneNumber = copy.phoneNumber - customerAccessToken = copy.customerAccessToken - } } } diff --git a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayState.swift b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayState.swift index 42c701e1..e11c9301 100644 --- a/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayState.swift +++ b/platforms/swift/Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayAuthorizationDelegate/ApplePayState.swift @@ -2,7 +2,7 @@ import Foundation import PassKit @available(iOS 16.0, *) -enum ApplePayState: Equatable { +enum ApplePayState: Equatable, @unchecked Sendable { static func == (lhs: ApplePayState, rhs: ApplePayState) -> Bool { return String(describing: lhs.self) == String(describing: rhs.self) } diff --git a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutError.swift b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutError.swift index 4c9001d3..a19c7608 100644 --- a/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutError.swift +++ b/platforms/swift/Sources/ShopifyCheckoutKit/CheckoutError.swift @@ -1,6 +1,6 @@ import Foundation -public enum CheckoutErrorCode: String, Codable { +public enum CheckoutErrorCode: String, Codable, Sendable { case storefrontPasswordRequired = "storefront_password_required" case cartExpired = "cart_expired" case cartCompleted = "cart_completed" @@ -18,7 +18,7 @@ public enum CheckoutErrorCode: String, Codable { } } -public enum CheckoutUnavailable { +public enum CheckoutUnavailable: Sendable { case clientError(code: CheckoutErrorCode) case httpError(statusCode: Int) } diff --git a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/TestHelpers.swift b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/TestHelpers.swift index 70e2281c..115d6e6a 100644 --- a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/TestHelpers.swift +++ b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/TestHelpers.swift @@ -275,7 +275,7 @@ extension StorefrontAPI.Cart { /// This class conforms to StorefrontAPIProtocol with not implemented errors /// Extend this class and override only the methods you need, per test file @available(iOS 16.0, *) -class MockStorefrontAPI: StorefrontAPIProtocol { +class MockStorefrontAPI: StorefrontAPIProtocol, @unchecked Sendable { func cart(by _: GraphQLScalars.ID) async throws -> StorefrontAPI.Cart? { fatalError("cart(by:) not implemented in test. Override this method in your test class.") } @@ -360,7 +360,7 @@ class MockStorefrontAPI: StorefrontAPIProtocol { // MARK: - Test StorefrontAPI @available(iOS 16.0, *) -class TestStorefrontAPI: MockStorefrontAPI { +class TestStorefrontAPI: MockStorefrontAPI, @unchecked Sendable { var cartResult: Result? override func cart(by _: GraphQLScalars.ID) async throws -> StorefrontAPI.Cart? { diff --git a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/PKEncoderTests.swift b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/PKEncoderTests.swift index 81051b72..a344abb8 100644 --- a/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/PKEncoderTests.swift +++ b/platforms/swift/Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/PKEncoderTests.swift @@ -96,7 +96,7 @@ class PKEncoderTests: XCTestCase { func test_email_withoutContactEmailButWithCustomerEmail_shouldReturnCustomerEmail() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = "customer@example.com" + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(email: "customer@example.com") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) @@ -110,7 +110,7 @@ class PKEncoderTests: XCTestCase { func test_email_withEmptyContactEmail_shouldFallbackToCustomerEmail() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = "customer@example.com" + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(email: "customer@example.com") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) @@ -164,8 +164,7 @@ class PKEncoderTests: XCTestCase { func test_phone_withoutContactPhoneButWithCustomerPhone_shouldReturnCustomerPhone() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = nil - configWithCustomer.common.customer?.phoneNumber = "+0987654321" + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(phoneNumber: "+0987654321") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) @@ -179,8 +178,7 @@ class PKEncoderTests: XCTestCase { func test_phone_withEmptyContactPhone_shouldFallbackToCustomerPhone() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = nil - configWithCustomer.common.customer?.phoneNumber = "+0987654321" + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(phoneNumber: "+0987654321") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) @@ -217,8 +215,7 @@ class PKEncoderTests: XCTestCase { func test_email_configCustomerTakesPrecedenceOverContact() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = "customer@example.com" - configWithCustomer.common.customer?.phoneNumber = nil + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(email: "customer@example.com") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) @@ -237,8 +234,7 @@ class PKEncoderTests: XCTestCase { func test_phone_configCustomerTakesPrecedenceOverContact() { let configWithCustomer = ApplePayConfigurationWrapper.testConfiguration.copy() - configWithCustomer.common.customer?.email = nil - configWithCustomer.common.customer?.phoneNumber = "+0987654321" + configWithCustomer.common.customer = ShopifyAcceleratedCheckouts.Customer(phoneNumber: "+0987654321") let encoderWithCustomer = PKEncoder(configuration: configWithCustomer, cart: cart) diff --git a/platforms/swift/api/ShopifyAcceleratedCheckouts.json b/platforms/swift/api/ShopifyAcceleratedCheckouts.json index d5daeb64..f1294ff4 100644 --- a/platforms/swift/api/ShopifyAcceleratedCheckouts.json +++ b/platforms/swift/api/ShopifyAcceleratedCheckouts.json @@ -494,15 +494,15 @@ "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" } ], "usr": "s:Sq" } ], "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvp", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvp", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvp", "moduleName": "ShopifyAcceleratedCheckouts", "declAttributes": [ "ProjectedValueProperty", @@ -523,15 +523,15 @@ "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" } ], "usr": "s:Sq" } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvg", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvg", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvg", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, "accessorKind": "get" @@ -555,15 +555,15 @@ "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" } ], "usr": "s:Sq" } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerCSgvs", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvs", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC8customerAB8CustomerVSgvs", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, "intro_Macosx": "10.15", @@ -593,8 +593,8 @@ } ], "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvp", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvp", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvp", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, "accessors": [ @@ -611,8 +611,8 @@ } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvg", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvg", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvg", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, "accessorKind": "get" @@ -635,8 +635,8 @@ } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerCSg_Gvs", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvs", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC9$customer7Combine9PublishedV9PublisherVyAB8CustomerVSg_Gvs", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, "intro_Macosx": "11.0", @@ -685,7 +685,7 @@ "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" } ], "hasDefaultArg": true, @@ -693,8 +693,8 @@ } ], "declKind": "Constructor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC16storefrontDomain0E11AccessToken8customerADSS_SSAB8CustomerCSgtcfc", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC16storefrontDomain0E11AccessToken8customerADSS_SSAB8CustomerCSgtcfc", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO13ConfigurationC16storefrontDomain0E11AccessToken8customerADSS_SSAB8CustomerVSgtcfc", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO13ConfigurationC16storefrontDomain0E11AccessToken8customerADSS_SSAB8CustomerVSgtcfc", "moduleName": "ShopifyAcceleratedCheckouts", "init_kind": "Designated" }, @@ -820,13 +820,14 @@ } ], "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvp", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV5emailSSSgvp", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV5emailSSSgvp", "moduleName": "ShopifyAcceleratedCheckouts", "declAttributes": [ - "ProjectedValueProperty", - "Custom" + "HasStorage" ], + "isLet": true, + "hasStorage": true, "accessors": [ { "kind": "Accessor", @@ -849,126 +850,14 @@ } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "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:27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC5emailSSSgvs", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV5emailSSSgvg", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV5emailSSSgvg", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, - "intro_Macosx": "10.15", - "intro_iOS": "16.0", - "intro_tvOS": "13.0", - "intro_watchOS": "6.0", "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "$email", - "printedName": "$email", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvp", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } + "Transparent" ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC6$email7Combine9PublishedV9PublisherVySSSg_Gvs", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "intro_Macosx": "11.0", - "intro_iOS": "16.0", - "intro_tvOS": "14.0", - "intro_watchOS": "7.0", - "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" } ] }, @@ -993,13 +882,14 @@ } ], "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvp", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV11phoneNumberSSSgvp", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV11phoneNumberSSSgvp", "moduleName": "ShopifyAcceleratedCheckouts", "declAttributes": [ - "ProjectedValueProperty", - "Custom" + "HasStorage" ], + "isLet": true, + "hasStorage": true, "accessors": [ { "kind": "Accessor", @@ -1022,126 +912,14 @@ } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "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:27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC11phoneNumberSSSgvs", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV11phoneNumberSSSgvg", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV11phoneNumberSSSgvg", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, - "intro_Macosx": "10.15", - "intro_iOS": "16.0", - "intro_tvOS": "13.0", - "intro_watchOS": "6.0", "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "$phoneNumber", - "printedName": "$phoneNumber", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvp", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } + "Transparent" ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC12$phoneNumber7Combine9PublishedV9PublisherVySSSg_Gvs", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "intro_Macosx": "11.0", - "intro_iOS": "16.0", - "intro_tvOS": "14.0", - "intro_watchOS": "7.0", - "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" } ] }, @@ -1166,13 +944,14 @@ } ], "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvp", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV19customerAccessTokenSSSgvp", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV19customerAccessTokenSSSgvp", "moduleName": "ShopifyAcceleratedCheckouts", "declAttributes": [ - "ProjectedValueProperty", - "Custom" + "HasStorage" ], + "isLet": true, + "hasStorage": true, "accessors": [ { "kind": "Accessor", @@ -1195,199 +974,17 @@ } ], "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "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:27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenSSSgvs", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV19customerAccessTokenSSSgvg", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV19customerAccessTokenSSSgvg", "moduleName": "ShopifyAcceleratedCheckouts", "implicit": true, - "intro_Macosx": "10.15", - "intro_iOS": "16.0", - "intro_tvOS": "13.0", - "intro_watchOS": "6.0", "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" - } - ] - }, - { - "kind": "Var", - "name": "$customerAccessToken", - "printedName": "$customerAccessToken", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Var", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvp", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvp", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "accessors": [ - { - "kind": "Accessor", - "name": "Get", - "printedName": "Get()", - "children": [ - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } + "Transparent" ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvg", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvg", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, "accessorKind": "get" - }, - { - "kind": "Accessor", - "name": "Set", - "printedName": "Set()", - "children": [ - { - "kind": "TypeNominal", - "name": "Void", - "printedName": "()" - }, - { - "kind": "TypeNominal", - "name": "Publisher", - "printedName": "Combine.Published.Publisher", - "usr": "s:7Combine9PublishedV9PublisherV" - } - ], - "declKind": "Accessor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvs", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC20$customerAccessToken7Combine9PublishedV9PublisherVySSSg_Gvs", - "moduleName": "ShopifyAcceleratedCheckouts", - "implicit": true, - "intro_Macosx": "11.0", - "intro_iOS": "16.0", - "intro_tvOS": "14.0", - "intro_watchOS": "7.0", - "declAttributes": [ - "Available", - "Available", - "Available", - "Available" - ], - "accessorKind": "set" } ] }, - { - "kind": "Constructor", - "name": "init", - "printedName": "init(customerAccessToken:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Customer", - "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" - }, - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "declKind": "Constructor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenADSS_tcfc", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC19customerAccessTokenADSS_tcfc", - "moduleName": "ShopifyAcceleratedCheckouts", - "init_kind": "Designated" - }, - { - "kind": "Constructor", - "name": "init", - "printedName": "init(email:phoneNumber:)", - "children": [ - { - "kind": "TypeNominal", - "name": "Customer", - "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" - }, - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sq" - }, - { - "kind": "TypeNominal", - "name": "Optional", - "printedName": "Swift.String?", - "children": [ - { - "kind": "TypeNominal", - "name": "String", - "printedName": "Swift.String", - "usr": "s:SS" - } - ], - "usr": "s:Sq" - } - ], - "declKind": "Constructor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC5email11phoneNumberADSSSg_AGtcfc", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC5email11phoneNumberADSSSg_AGtcfc", - "moduleName": "ShopifyAcceleratedCheckouts", - "init_kind": "Designated" - }, { "kind": "Constructor", "name": "init", @@ -1397,7 +994,7 @@ "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" }, { "kind": "TypeNominal", @@ -1411,6 +1008,7 @@ "usr": "s:SS" } ], + "hasDefaultArg": true, "usr": "s:Sq" }, { @@ -1425,6 +1023,7 @@ "usr": "s:SS" } ], + "hasDefaultArg": true, "usr": "s:Sq" }, { @@ -1444,94 +1043,73 @@ } ], "declKind": "Constructor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC5email11phoneNumber19customerAccessTokenADSSSg_A2Htcfc", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC5email11phoneNumber19customerAccessTokenADSSSg_A2Htcfc", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV5email11phoneNumber19customerAccessTokenADSSSg_A2Htcfc", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV5email11phoneNumber19customerAccessTokenADSSSg_A2Htcfc", "moduleName": "ShopifyAcceleratedCheckouts", - "deprecated": true, - "declAttributes": [ - "Available" - ], "init_kind": "Designated" }, { - "kind": "Constructor", - "name": "init", - "printedName": "init(copy:)", + "kind": "Function", + "name": "__derived_struct_equals", + "printedName": "__derived_struct_equals(_:_:)", "children": [ { "kind": "TypeNominal", - "name": "Customer", - "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" + "name": "Bool", + "printedName": "Swift.Bool", + "usr": "s:Sb" }, { "kind": "TypeNominal", "name": "Customer", "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC" - } - ], - "declKind": "Constructor", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC4copyA2D_tcfc", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC4copyA2D_tcfc", - "moduleName": "ShopifyAcceleratedCheckouts", - "isInternal": true, - "declAttributes": [ - "Required" - ], - "init_kind": "Designated" - }, - { - "kind": "TypeAlias", - "name": "ObjectWillChangePublisher", - "printedName": "ObjectWillChangePublisher", - "children": [ + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" + }, { "kind": "TypeNominal", - "name": "ObservableObjectPublisher", - "printedName": "Combine.ObservableObjectPublisher", - "usr": "s:7Combine25ObservableObjectPublisherC" + "name": "Customer", + "printedName": "ShopifyAcceleratedCheckouts.ShopifyAcceleratedCheckouts.Customer", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV" } ], - "declKind": "TypeAlias", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC25ObjectWillChangePublishera", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC25ObjectWillChangePublishera", + "declKind": "Func", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV23__derived_struct_equalsySbAD_ADtFZ", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV23__derived_struct_equalsySbAD_ADtFZ", "moduleName": "ShopifyAcceleratedCheckouts", + "static": true, "implicit": true, - "intro_iOS": "16.0", "declAttributes": [ - "Available" - ] + "Implements" + ], + "funcSelfKind": "NonMutating" } ], - "declKind": "Class", - "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerC", - "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerC", + "declKind": "Struct", + "usr": "s:27ShopifyAcceleratedCheckoutsAAO8CustomerV", + "mangledName": "$s27ShopifyAcceleratedCheckoutsAAO8CustomerV", "moduleName": "ShopifyAcceleratedCheckouts", "isFromExtension": true, - "hasMissingDesignatedInitializers": true, "conformances": [ { "kind": "Conformance", - "name": "ObservableObject", - "printedName": "ObservableObject", - "children": [ - { - "kind": "TypeWitness", - "name": "ObjectWillChangePublisher", - "printedName": "ObjectWillChangePublisher", - "children": [ - { - "kind": "TypeNominal", - "name": "ObservableObjectPublisher", - "printedName": "Combine.ObservableObjectPublisher", - "usr": "s:7Combine25ObservableObjectPublisherC" - } - ] - } - ], - "usr": "s:7Combine16ObservableObjectP", - "mangledName": "$s7Combine16ObservableObjectP" + "name": "Sendable", + "printedName": "Sendable", + "usr": "s:s8SendableP", + "mangledName": "$ss8SendableP" + }, + { + "kind": "Conformance", + "name": "Equatable", + "printedName": "Equatable", + "usr": "s:SQ", + "mangledName": "$sSQ" + }, + { + "kind": "Conformance", + "name": "SendableMetatype", + "printedName": "SendableMetatype", + "usr": "s:s16SendableMetatypeP", + "mangledName": "$ss16SendableMetatypeP" }, { "kind": "Conformance", diff --git a/platforms/swift/api/ShopifyCheckoutKit.json b/platforms/swift/api/ShopifyCheckoutKit.json index 8ca66d23..11795c42 100644 --- a/platforms/swift/api/ShopifyCheckoutKit.json +++ b/platforms/swift/api/ShopifyCheckoutKit.json @@ -644,6 +644,20 @@ "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", @@ -786,6 +800,20 @@ "moduleName": "ShopifyCheckoutKit", "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",