2424import Foundation
2525import PassKit
2626import React
27- import ShopifyCheckoutKit
27+ import ShopifyCheckoutSheetKit
2828import SwiftUI
2929import UIKit
3030
@@ -46,8 +46,8 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
4646 }
4747
4848 override init ( ) {
49- ShopifyCheckoutKit . configure {
50- $0. platform = ShopifyCheckoutKit . Platform. reactNative
49+ ShopifyCheckoutSheetKit . configure {
50+ $0. platform = ShopifyCheckoutSheetKit . Platform. reactNative
5151 }
5252
5353 super. init ( )
@@ -75,13 +75,13 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
7575 return error. isRecoverable
7676 }
7777
78- func checkoutDidFail( error: ShopifyCheckoutKit . CheckoutError ) {
78+ func checkoutDidFail( error: ShopifyCheckoutSheetKit . CheckoutError ) {
7979 guard hasListeners else { return }
8080
8181 sendEvent ( withName: " error " , body: ShopifyEventSerialization . serialize ( checkoutError: error) )
8282 }
8383
84- func checkoutDidEmitWebPixelEvent( event: ShopifyCheckoutKit . PixelEvent ) {
84+ func checkoutDidEmitWebPixelEvent( event: ShopifyCheckoutSheetKit . PixelEvent ) {
8585 if hasListeners {
8686 sendEvent ( withName: " pixel " , body: ShopifyEventSerialization . serialize ( pixelEvent: event) )
8787 }
@@ -99,7 +99,7 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
9999
100100 @objc override func constantsToExport( ) -> [ AnyHashable : Any ] ! {
101101 return [
102- " version " : ShopifyCheckoutKit . version
102+ " version " : ShopifyCheckoutSheetKit . version
103103 ]
104104 }
105105
@@ -140,7 +140,7 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
140140 }
141141
142142 @objc func invalidateCache( ) {
143- ShopifyCheckoutKit . invalidate ( )
143+ ShopifyCheckoutSheetKit . invalidate ( )
144144 }
145145
146146 @objc func present( _ checkoutURL: String ) {
@@ -156,23 +156,23 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
156156 @objc func preload( _ checkoutURL: String ) {
157157 DispatchQueue . main. async {
158158 if let url = URL ( string: checkoutURL) {
159- ShopifyCheckoutKit . preload ( checkout: url)
159+ ShopifyCheckoutSheetKit . preload ( checkout: url)
160160 }
161161 }
162162 }
163163
164- private func getColorScheme( _ colorScheme: String ) -> ShopifyCheckoutKit . Configuration . ColorScheme {
164+ private func getColorScheme( _ colorScheme: String ) -> ShopifyCheckoutSheetKit . Configuration . ColorScheme {
165165 switch colorScheme {
166166 case " web_default " :
167- return ShopifyCheckoutKit . Configuration. ColorScheme. web
167+ return ShopifyCheckoutSheetKit . Configuration. ColorScheme. web
168168 case " automatic " :
169- return ShopifyCheckoutKit . Configuration. ColorScheme. automatic
169+ return ShopifyCheckoutSheetKit . Configuration. ColorScheme. automatic
170170 case " light " :
171- return ShopifyCheckoutKit . Configuration. ColorScheme. light
171+ return ShopifyCheckoutSheetKit . Configuration. ColorScheme. light
172172 case " dark " :
173- return ShopifyCheckoutKit . Configuration. ColorScheme. dark
173+ return ShopifyCheckoutSheetKit . Configuration. ColorScheme. dark
174174 default :
175- return ShopifyCheckoutKit . Configuration. ColorScheme. automatic
175+ return ShopifyCheckoutSheetKit . Configuration. ColorScheme. automatic
176176 }
177177 }
178178
@@ -181,47 +181,47 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
181181 let iosConfig = colorConfig ? [ " ios " ] as? [ String : String ]
182182
183183 if let title = configuration [ " title " ] as? String {
184- ShopifyCheckoutKit . configuration. title = title
184+ ShopifyCheckoutSheetKit . configuration. title = title
185185 }
186186
187187 if let preloading = configuration [ " preloading " ] as? Bool {
188- ShopifyCheckoutKit . configuration. preloading. enabled = preloading
188+ ShopifyCheckoutSheetKit . configuration. preloading. enabled = preloading
189189 }
190190
191191 if let colorScheme = configuration [ " colorScheme " ] as? String {
192- ShopifyCheckoutKit . configuration. colorScheme = getColorScheme ( colorScheme)
192+ ShopifyCheckoutSheetKit . configuration. colorScheme = getColorScheme ( colorScheme)
193193 }
194194
195195 if let tintColorHex = iosConfig ? [ " tintColor " ] as? String {
196- ShopifyCheckoutKit . configuration. tintColor = UIColor ( hex: tintColorHex)
196+ ShopifyCheckoutSheetKit . configuration. tintColor = UIColor ( hex: tintColorHex)
197197 }
198198
199199 if let backgroundColorHex = iosConfig ? [ " backgroundColor " ] as? String {
200- ShopifyCheckoutKit . configuration. backgroundColor = UIColor ( hex: backgroundColorHex)
200+ ShopifyCheckoutSheetKit . configuration. backgroundColor = UIColor ( hex: backgroundColorHex)
201201 }
202202
203203 if let closeButtonColorHex = iosConfig ? [ " closeButtonColor " ] as? String {
204- ShopifyCheckoutKit . configuration. closeButtonTintColor = UIColor ( hex: closeButtonColorHex)
204+ ShopifyCheckoutSheetKit . configuration. closeButtonTintColor = UIColor ( hex: closeButtonColorHex)
205205 }
206206
207207 if let logLevel = configuration [ " logLevel " ] as? String {
208- ShopifyCheckoutKit . configuration. logLevel = ShopifyCheckoutKit . LogLevel ( rawValue: logLevel. lowercased ( ) ) ?? defaultLogLevel
208+ ShopifyCheckoutSheetKit . configuration. logLevel = ShopifyCheckoutSheetKit . LogLevel ( rawValue: logLevel. lowercased ( ) ) ?? defaultLogLevel
209209 } else {
210- ShopifyCheckoutKit . configuration. logLevel = defaultLogLevel
210+ ShopifyCheckoutSheetKit . configuration. logLevel = defaultLogLevel
211211 }
212212
213213 NotificationCenter . default. post ( name: Notification . Name ( " CheckoutKitConfigurationUpdated " ) , object: nil )
214214 }
215215
216216 @objc func getConfig( ) -> NSDictionary {
217217 return [
218- " title " : ShopifyCheckoutKit . configuration. title,
219- " preloading " : ShopifyCheckoutKit . configuration. preloading. enabled,
220- " colorScheme " : ShopifyCheckoutKit . configuration. colorScheme. rawValue,
221- " tintColor " : ShopifyCheckoutKit . configuration. tintColor,
222- " backgroundColor " : ShopifyCheckoutKit . configuration. backgroundColor,
223- " closeButtonColor " : ShopifyCheckoutKit . configuration. closeButtonTintColor,
224- " logLevel " : logLevelToString ( ShopifyCheckoutKit . configuration. logLevel)
218+ " title " : ShopifyCheckoutSheetKit . configuration. title,
219+ " preloading " : ShopifyCheckoutSheetKit . configuration. preloading. enabled,
220+ " colorScheme " : ShopifyCheckoutSheetKit . configuration. colorScheme. rawValue,
221+ " tintColor " : ShopifyCheckoutSheetKit . configuration. tintColor,
222+ " backgroundColor " : ShopifyCheckoutSheetKit . configuration. backgroundColor,
223+ " closeButtonColor " : ShopifyCheckoutSheetKit . configuration. closeButtonTintColor,
224+ " logLevel " : logLevelToString ( ShopifyCheckoutSheetKit . configuration. logLevel)
225225 ]
226226 }
227227
@@ -303,8 +303,8 @@ class RCTShopifyCheckoutKit: RCTEventEmitter, CheckoutDelegate {
303303 return try contactFields. compactMap {
304304 guard let field = ShopifyAcceleratedCheckouts . RequiredContactFields ( rawValue: $0) , field != nil else {
305305 let message = " Unknown contactField option: \( String ( describing: $0) ) "
306- print ( " [ShopifyCheckoutKit ] \( message) " )
307- throw NSError ( domain: " ShopifyCheckoutKit " , code: 1 , userInfo: [ " message " : message] )
306+ print ( " [ShopifyCheckoutSheetKit ] \( message) " )
307+ throw NSError ( domain: " ShopifyCheckoutSheetKit " , code: 1 , userInfo: [ " message " : message] )
308308 }
309309 return field
310310 }
0 commit comments