@tyrads.com/tyrads-sdk 1.1.6-beta.1 → 1.1.6-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -11
- package/android/build.gradle +101 -101
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/AndroidManifestNew.xml +2 -2
- package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +43 -44
- package/android/src/main/java/com/tyradssdk/TyradsSdkPackage.kt +17 -17
- package/ios/Tyrads/AcmoConfig.swift +31 -31
- package/ios/Tyrads/InitModel.swift +46 -46
- package/ios/Tyrads/Tyrads.swift +176 -151
- package/ios/TyradsSdk-Bridging-Header.h +2 -2
- package/ios/TyradsSdk.mm +11 -9
- package/ios/TyradsSdk.swift +27 -26
- package/lib/commonjs/index.js +20 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +20 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +9 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +9 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +187 -187
- package/readme.md +24 -24
- package/src/index.tsx +40 -19
- package/tyrads-sdk.podspec +41 -41
    
        package/ios/Tyrads/Tyrads.swift
    CHANGED
    
    | @@ -1,151 +1,176 @@ | |
| 1 | 
            -
            import Foundation
         | 
| 2 | 
            -
            import UIKit
         | 
| 3 | 
            -
            import AppTrackingTransparency
         | 
| 4 | 
            -
            import AdSupport
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
                 | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
                private var  | 
| 15 | 
            -
                private var  | 
| 16 | 
            -
                private var  | 
| 17 | 
            -
                private var  | 
| 18 | 
            -
                var  | 
| 19 | 
            -
                 | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
                ///
         | 
| 29 | 
            -
                /// | 
| 30 | 
            -
                /// | 
| 31 | 
            -
                ///   -  | 
| 32 | 
            -
                 | 
| 33 | 
            -
             | 
| 34 | 
            -
                    self. | 
| 35 | 
            -
                    self. | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                ///
         | 
| 40 | 
            -
                /// | 
| 41 | 
            -
                 | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
                        
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                         | 
| 47 | 
            -
                         | 
| 48 | 
            -
             | 
| 49 | 
            -
                             | 
| 50 | 
            -
             | 
| 51 | 
            -
                                 | 
| 52 | 
            -
             | 
| 53 | 
            -
                                     | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
                                     | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
                                     | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
                                     | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
                             | 
| 70 | 
            -
             | 
| 71 | 
            -
                         | 
| 72 | 
            -
             | 
| 73 | 
            -
                            " | 
| 74 | 
            -
                            " | 
| 75 | 
            -
                            " | 
| 76 | 
            -
             | 
| 77 | 
            -
                        
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                        
         | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
                             | 
| 83 | 
            -
             | 
| 84 | 
            -
                        
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                        request | 
| 87 | 
            -
                        request. | 
| 88 | 
            -
                        request.setValue(AcmoConfig. | 
| 89 | 
            -
                        request.setValue( | 
| 90 | 
            -
                        request.setValue( | 
| 91 | 
            -
                        request.setValue(self. | 
| 92 | 
            -
                        
         | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
                             | 
| 98 | 
            -
             | 
| 99 | 
            -
                        
         | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 104 | 
            -
                             | 
| 105 | 
            -
             | 
| 106 | 
            -
                        
         | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
                             | 
| 110 | 
            -
             | 
| 111 | 
            -
                        
         | 
| 112 | 
            -
             | 
| 113 | 
            -
             | 
| 114 | 
            -
             | 
| 115 | 
            -
             | 
| 116 | 
            -
                            let  | 
| 117 | 
            -
                             | 
| 118 | 
            -
             | 
| 119 | 
            -
                                 | 
| 120 | 
            -
             | 
| 121 | 
            -
                             | 
| 122 | 
            -
                            self. | 
| 123 | 
            -
                            self. | 
| 124 | 
            -
                            self. | 
| 125 | 
            -
                            self. | 
| 126 | 
            -
             | 
| 127 | 
            -
                        
         | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
                         | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
                     | 
| 146 | 
            -
             | 
| 147 | 
            -
                     | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 1 | 
            +
            import Foundation
         | 
| 2 | 
            +
            import UIKit
         | 
| 3 | 
            +
            import AppTrackingTransparency
         | 
| 4 | 
            +
            import AdSupport
         | 
| 5 | 
            +
            import WebKit
         | 
| 6 | 
            +
             | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            /// The TyradsSdk class provides methods for configuring the SDK and displaying offers.
         | 
| 10 | 
            +
            public class Tyrads {
         | 
| 11 | 
            +
                /// Shared instance of the TyradsSdk.
         | 
| 12 | 
            +
                public static let instance = Tyrads()
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                private var apiKey: String = ""
         | 
| 15 | 
            +
                private var apiSecret: String = ""
         | 
| 16 | 
            +
                private var publisherUserID: String = ""
         | 
| 17 | 
            +
                private var newUser: Bool = false
         | 
| 18 | 
            +
                private var loginData: AcmoInitModel?
         | 
| 19 | 
            +
                var initializationWait = DispatchSemaphore(value: 0)
         | 
| 20 | 
            +
                private var debugMode: Bool = false
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                private func log(_ message: String) {
         | 
| 23 | 
            +
                    if debugMode {
         | 
| 24 | 
            +
                        NSLog(message)
         | 
| 25 | 
            +
                    }
         | 
| 26 | 
            +
                }
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                /// Configures the Tyrads SDK with the provided API key and secret key.
         | 
| 29 | 
            +
                ///
         | 
| 30 | 
            +
                /// - Parameters:
         | 
| 31 | 
            +
                ///   - apiKey: The API key provided by Tyrads.
         | 
| 32 | 
            +
                ///   - secretKey: The secret key provided by Tyrads.
         | 
| 33 | 
            +
                @objc public func configure( apiKey: String, secretKey: String, debugMode: Bool = false) {
         | 
| 34 | 
            +
                    self.apiKey = apiKey
         | 
| 35 | 
            +
                    self.apiSecret = secretKey
         | 
| 36 | 
            +
                    self.debugMode = debugMode
         | 
| 37 | 
            +
                }
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                /// Logs in the user with the provided user ID or retrieves the user ID from UserDefaults.
         | 
| 40 | 
            +
                ///
         | 
| 41 | 
            +
                /// - Parameter userID: Optional. The user ID to log in with. If nil, the SDK will attempt to retrieve the user ID from UserDefaults.
         | 
| 42 | 
            +
                @objc public func loginUser(_ userID: String? = nil) {
         | 
| 43 | 
            +
                    do {
         | 
| 44 | 
            +
                        let userId = userID ?? UserDefaults.standard.string(forKey: "acmo-tyrads-sdk-user-id") ?? ""
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                        let identifierType = "IDFA"
         | 
| 47 | 
            +
                        var advertisingId = ""
         | 
| 48 | 
            +
                        if #available(iOS 14, *) {
         | 
| 49 | 
            +
                            log("Requesting tracking authorization for iOS 14+")
         | 
| 50 | 
            +
                            ATTrackingManager.requestTrackingAuthorization { status in
         | 
| 51 | 
            +
                                switch status {
         | 
| 52 | 
            +
                                case .authorized:
         | 
| 53 | 
            +
                                    advertisingId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
         | 
| 54 | 
            +
                                    self.log("Tracking authorized. Advertising ID: \(advertisingId)")
         | 
| 55 | 
            +
                                case .denied:
         | 
| 56 | 
            +
                                    advertisingId = ""
         | 
| 57 | 
            +
                                    self.log("Tracking denied")
         | 
| 58 | 
            +
                                case .restricted:
         | 
| 59 | 
            +
                                    advertisingId = ""
         | 
| 60 | 
            +
                                    self.log("Tracking restricted")
         | 
| 61 | 
            +
                                case .notDetermined:
         | 
| 62 | 
            +
                                    advertisingId = ""
         | 
| 63 | 
            +
                                    self.log("Tracking not determined")
         | 
| 64 | 
            +
                                @unknown default:
         | 
| 65 | 
            +
                                    self.log("Unknown tracking status")
         | 
| 66 | 
            +
                                }
         | 
| 67 | 
            +
                            }
         | 
| 68 | 
            +
                        } else {
         | 
| 69 | 
            +
                            advertisingId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
         | 
| 70 | 
            +
                            log("iOS version < 14. Advertising ID: \(advertisingId)")
         | 
| 71 | 
            +
                        }
         | 
| 72 | 
            +
                        let fd: [String: Any] = [
         | 
| 73 | 
            +
                            "publisherUserId": userId,
         | 
| 74 | 
            +
                            "platform": "iOS",
         | 
| 75 | 
            +
                            "identifierType": identifierType,
         | 
| 76 | 
            +
                            "identifier": advertisingId
         | 
| 77 | 
            +
                        ]
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                        log("Initializing with data: \(fd)")
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                        guard let url = URL(string: AcmoConfig.BASE_URL + "initialize") else {
         | 
| 82 | 
            +
                            log("Failed to create URL")
         | 
| 83 | 
            +
                            return
         | 
| 84 | 
            +
                        }
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                        var request = URLRequest(url: url)
         | 
| 87 | 
            +
                        request.httpMethod = "POST"
         | 
| 88 | 
            +
                        request.setValue(AcmoConfig.SDK_PLATFORM, forHTTPHeaderField: "X-SDK-Platform")
         | 
| 89 | 
            +
                        request.setValue(AcmoConfig.SDK_VERSION, forHTTPHeaderField: "X-SDK-Version")
         | 
| 90 | 
            +
                        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
         | 
| 91 | 
            +
                        request.setValue(self.apiKey, forHTTPHeaderField: "X-API-Key")
         | 
| 92 | 
            +
                        request.setValue(self.apiSecret, forHTTPHeaderField: "X-API-Secret")
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                        do {
         | 
| 95 | 
            +
                            request.httpBody = try JSONSerialization.data(withJSONObject: fd)
         | 
| 96 | 
            +
                        } catch {
         | 
| 97 | 
            +
                            log("Failed to serialize request body: \(error)")
         | 
| 98 | 
            +
                            return
         | 
| 99 | 
            +
                        }
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                        let task = URLSession.shared.dataTask(with: request) { data, response, error in
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                        if let error = error {
         | 
| 104 | 
            +
                            self.log("Network request failed: \(error)")
         | 
| 105 | 
            +
                            return
         | 
| 106 | 
            +
                        }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                        guard let data = data else {
         | 
| 109 | 
            +
                            self.log("No data received from the server")
         | 
| 110 | 
            +
                            return
         | 
| 111 | 
            +
                        }
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                        if let responseString = String(data: data, encoding: .utf8) {
         | 
| 114 | 
            +
                            self.log("Received response: \(responseString)")
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                            let jsonData = responseString.data(using: .utf8)!
         | 
| 117 | 
            +
                            let decoder = JSONDecoder()
         | 
| 118 | 
            +
                            guard let acmoInitModel = try? decoder.decode(AcmoInitModel.self, from: jsonData) else {
         | 
| 119 | 
            +
                                self.log("Failed to decode response")
         | 
| 120 | 
            +
                                return
         | 
| 121 | 
            +
                            }
         | 
| 122 | 
            +
                            self.loginData = acmoInitModel
         | 
| 123 | 
            +
                            self.publisherUserID = self.loginData?.data.user.publisherUserId ?? ""
         | 
| 124 | 
            +
                            self.newUser = self.loginData?.data.newRegisteredUser ?? false
         | 
| 125 | 
            +
                            self.log("Login successful. Publisher User ID: \(self.publisherUserID), New User: \(self.newUser)")
         | 
| 126 | 
            +
                            self.initializationWait.signal()
         | 
| 127 | 
            +
                        }
         | 
| 128 | 
            +
             | 
| 129 | 
            +
             | 
| 130 | 
            +
                        }
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                        task.resume()
         | 
| 133 | 
            +
                        log("Network request started")
         | 
| 134 | 
            +
             | 
| 135 | 
            +
             | 
| 136 | 
            +
                    } catch {
         | 
| 137 | 
            +
                        log("An error occurred: \(error)")
         | 
| 138 | 
            +
                    }
         | 
| 139 | 
            +
                }
         | 
| 140 | 
            +
             | 
| 141 | 
            +
             | 
| 142 | 
            +
             | 
| 143 | 
            +
             | 
| 144 | 
            +
                 public func showOffers(_ launchMode: Int = 3, route: String? = nil, campaignID: Int? = nil) {
         | 
| 145 | 
            +
                    self.initializationWait.wait()
         | 
| 146 | 
            +
                    var urlString =
         | 
| 147 | 
            +
                    "https://websdk.tyrads.com/?apiKey=\(Tyrads.instance.apiKey)&apiSecret=\(Tyrads.instance.apiSecret)&userID=\(Tyrads.instance.publisherUserID)&newUser=\(Tyrads.instance.newUser)&platform=\(AcmoConfig.SDK_PLATFORM)&hc=\(Tyrads.instance.loginData?.data.publisherApp.headerColor ?? "")&mc=\(Tyrads.instance.loginData?.data.publisherApp.mainColor ?? "")&launchMode=\(launchMode)&route=\(route ?? "")&campaignID=\(campaignID)"
         | 
| 148 | 
            +
             | 
| 149 | 
            +
             | 
| 150 | 
            +
                    if let url = URL(string: urlString) {
         | 
| 151 | 
            +
                        switch launchMode {
         | 
| 152 | 
            +
                        case 1, 2:
         | 
| 153 | 
            +
                            DispatchQueue.main.async {
         | 
| 154 | 
            +
                                let webView = WKWebView(frame: UIScreen.main.bounds)
         | 
| 155 | 
            +
                                webView.load(URLRequest(url: url))
         | 
| 156 | 
            +
             | 
| 157 | 
            +
                                let viewController = UIViewController()
         | 
| 158 | 
            +
                                viewController.view = webView
         | 
| 159 | 
            +
                                viewController.modalPresentationStyle = .fullScreen // Add this line to set the presentation style
         | 
| 160 | 
            +
             | 
| 161 | 
            +
                                if let rootViewController = UIApplication.shared.windows.first?.rootViewController {
         | 
| 162 | 
            +
                                    rootViewController.present(viewController, animated: true, completion: nil)
         | 
| 163 | 
            +
                                }
         | 
| 164 | 
            +
                            }
         | 
| 165 | 
            +
                        case 3:
         | 
| 166 | 
            +
                            DispatchQueue.main.async {
         | 
| 167 | 
            +
                                UIApplication.shared.open(url, options: [:], completionHandler: nil)
         | 
| 168 | 
            +
                            }
         | 
| 169 | 
            +
                        default:
         | 
| 170 | 
            +
                            DispatchQueue.main.async {
         | 
| 171 | 
            +
                                UIApplication.shared.open(url, options: [:], completionHandler: nil)
         | 
| 172 | 
            +
                            }
         | 
| 173 | 
            +
                        }
         | 
| 174 | 
            +
                    }
         | 
| 175 | 
            +
                }
         | 
| 176 | 
            +
            }
         | 
| @@ -1,2 +1,2 @@ | |
| 1 | 
            -
            #import <React/RCTBridgeModule.h>
         | 
| 2 | 
            -
            #import <React/RCTViewManager.h>
         | 
| 1 | 
            +
            #import <React/RCTBridgeModule.h>
         | 
| 2 | 
            +
            #import <React/RCTViewManager.h>
         | 
    
        package/ios/TyradsSdk.mm
    CHANGED
    
    | @@ -1,9 +1,11 @@ | |
| 1 | 
            -
            #import <React/RCTBridgeModule.h>
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            @interface RCT_EXTERN_MODULE(TyradsSdk, NSObject)
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            RCT_EXTERN_METHOD(init:(NSString *)apiKey secretKey:(NSString *)secretKey)
         | 
| 6 | 
            -
            RCT_EXTERN_METHOD(loginUser:(NSString *)userId)
         | 
| 7 | 
            -
            RCT_EXTERN_METHOD(showOffers)
         | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 1 | 
            +
            #import <React/RCTBridgeModule.h>
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            @interface RCT_EXTERN_MODULE(TyradsSdk, NSObject)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            RCT_EXTERN_METHOD(init:(NSString *)apiKey secretKey:(NSString *)secretKey)
         | 
| 6 | 
            +
            RCT_EXTERN_METHOD(loginUser:(NSString *)userId)
         | 
| 7 | 
            +
            RCT_EXTERN_METHOD(showOffers:(NSInteger)launchMode
         | 
| 8 | 
            +
                              route:(NSString)route
         | 
| 9 | 
            +
                              campaignID:(NSInteger)campaignID)
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            @end
         | 
    
        package/ios/TyradsSdk.swift
    CHANGED
    
    | @@ -1,26 +1,27 @@ | |
| 1 | 
            -
            import Foundation
         | 
| 2 | 
            -
            import UIKit
         | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
            @objc(TyradsSdk)
         | 
| 6 | 
            -
            class TyradsSdk: NSObject {
         | 
| 7 | 
            -
             | 
| 8 | 
            -
              @objc
         | 
| 9 | 
            -
              func `init`(_ apiKey: String, secretKey: String) {
         | 
| 10 | 
            -
                NSLog("TyradsModule: init called with apiKey: \(apiKey) and secretKey: \(secretKey)")
         | 
| 11 | 
            -
                Tyrads.instance.configure(apiKey: apiKey, secretKey: secretKey)
         | 
| 12 | 
            -
              }
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              @objc
         | 
| 15 | 
            -
              func loginUser(_ userId: String) {
         | 
| 16 | 
            -
                NSLog("TyradsModule: loginUser called with userId: \(userId)")
         | 
| 17 | 
            -
                Tyrads.instance.loginUser(userId)
         | 
| 18 | 
            -
                // Implement your login logic here
         | 
| 19 | 
            -
              }
         | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
                NSLog("TyradsModule: showOffers called")
         | 
| 24 | 
            -
                Tyrads.instance.showOffers()
         | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 1 | 
            +
            import Foundation
         | 
| 2 | 
            +
            import UIKit
         | 
| 3 | 
            +
             | 
| 4 | 
            +
             | 
| 5 | 
            +
            @objc(TyradsSdk)
         | 
| 6 | 
            +
            class TyradsSdk: NSObject {
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              @objc
         | 
| 9 | 
            +
              func `init`(_ apiKey: String, secretKey: String) {
         | 
| 10 | 
            +
                NSLog("TyradsModule: init called with apiKey: \(apiKey) and secretKey: \(secretKey)")
         | 
| 11 | 
            +
                Tyrads.instance.configure(apiKey: apiKey, secretKey: secretKey)
         | 
| 12 | 
            +
              }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              @objc
         | 
| 15 | 
            +
              func loginUser(_ userId: String) {
         | 
| 16 | 
            +
                NSLog("TyradsModule: loginUser called with userId: \(userId)")
         | 
| 17 | 
            +
                Tyrads.instance.loginUser(userId)
         | 
| 18 | 
            +
                // Implement your login logic here
         | 
| 19 | 
            +
              }
         | 
| 20 | 
            +
             | 
| 21 | 
            +
             | 
| 22 | 
            +
            @objc func showOffers(_ launchMode: Int = 3, route: String? = nil, campaignID: Int = 0) {
         | 
| 23 | 
            +
                NSLog("TyradsModule: showOffers called")
         | 
| 24 | 
            +
                Tyrads.instance.showOffers(launchMode, route: route, campaignID:  campaignID == 0 ? nil : campaignID )
         | 
| 25 | 
            +
            }
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            }
         | 
    
        package/lib/commonjs/index.js
    CHANGED
    
    | @@ -9,10 +9,29 @@ const LINKING_ERROR = `The package 'tyrads-sdk' doesn't seem to be linked. Make | |
| 9 9 | 
             
              ios: "- You have run 'pod install'\n",
         | 
| 10 10 | 
             
              default: ''
         | 
| 11 11 | 
             
            }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
         | 
| 12 | 
            -
            const  | 
| 12 | 
            +
            const TyradsSdk = _reactNative.NativeModules.TyradsSdk ? _reactNative.NativeModules.TyradsSdk : new Proxy({}, {
         | 
| 13 13 | 
             
              get() {
         | 
| 14 14 | 
             
                throw new Error(LINKING_ERROR);
         | 
| 15 15 | 
             
              }
         | 
| 16 16 | 
             
            });
         | 
| 17 | 
            +
            const Tyrads = {
         | 
| 18 | 
            +
              init: (apiKey, apiSecret) => {
         | 
| 19 | 
            +
                return TyradsSdk.init(apiKey, apiSecret);
         | 
| 20 | 
            +
              },
         | 
| 21 | 
            +
              loginUser: userId => {
         | 
| 22 | 
            +
                return TyradsSdk.loginUser(userId);
         | 
| 23 | 
            +
              },
         | 
| 24 | 
            +
              showOffers: ({
         | 
| 25 | 
            +
                launchMode = 3,
         | 
| 26 | 
            +
                route,
         | 
| 27 | 
            +
                campaignID = 0
         | 
| 28 | 
            +
              } = {}) => {
         | 
| 29 | 
            +
                if (_reactNative.Platform.OS === 'ios') {
         | 
| 30 | 
            +
                  return TyradsSdk.showOffers(launchMode, route, campaignID);
         | 
| 31 | 
            +
                } else {
         | 
| 32 | 
            +
                  return TyradsSdk.showOffers(route, campaignID);
         | 
| 33 | 
            +
                }
         | 
| 34 | 
            +
              }
         | 
| 35 | 
            +
            };
         | 
| 17 36 | 
             
            var _default = exports.default = Tyrads;
         | 
| 18 37 | 
             
            //# sourceMappingURL=index.js.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default"," | 
| 1 | 
            +
            {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","TyradsSdk","NativeModules","Proxy","get","Error","Tyrads","init","apiKey","apiSecret","loginUser","userId","showOffers","launchMode","route","campaignID","OS","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,qEAAqE,GACrEC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGC,0BAAa,CAACD,SAAS,GACrCC,0BAAa,CAACD,SAAS,GACvB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMU,MAAM,GAAG;EACbC,IAAI,EAAEA,CAACC,MAAc,EAAEC,SAAiB,KAAK;IAC3C,OAAOR,SAAS,CAACM,IAAI,CAACC,MAAM,EAAEC,SAAS,CAAC;EAC1C,CAAC;EACDC,SAAS,EAAGC,MAAc,IAAK;IAC7B,OAAOV,SAAS,CAACS,SAAS,CAACC,MAAM,CAAC;EACpC,CAAC;EACDC,UAAU,EAAEA,CAAC;IACXC,UAAU,GAAG,CAAC;IACdC,KAAK;IACLC,UAAU,GAAG;EAC+C,CAAC,GAAG,CAAC,CAAC,KAAK;IACvE,IAAIlB,qBAAQ,CAACmB,EAAE,KAAK,KAAK,EAAE;MACzB,OAAOf,SAAS,CAACW,UAAU,CAACC,UAAU,EAAEC,KAAK,EAAEC,UAAU,CAAC;IAC5D,CAAC,MAAM;MACL,OAAOd,SAAS,CAACW,UAAU,CAACE,KAAK,EAAEC,UAAU,CAAC;IAChD;EACF;AACF,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAlB,OAAA,GAEaM,MAAM","ignoreList":[]}
         | 
    
        package/lib/module/index.js
    CHANGED
    
    | @@ -5,10 +5,29 @@ const LINKING_ERROR = `The package 'tyrads-sdk' doesn't seem to be linked. Make | |
| 5 5 | 
             
              ios: "- You have run 'pod install'\n",
         | 
| 6 6 | 
             
              default: ''
         | 
| 7 7 | 
             
            }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
         | 
| 8 | 
            -
            const  | 
| 8 | 
            +
            const TyradsSdk = NativeModules.TyradsSdk ? NativeModules.TyradsSdk : new Proxy({}, {
         | 
| 9 9 | 
             
              get() {
         | 
| 10 10 | 
             
                throw new Error(LINKING_ERROR);
         | 
| 11 11 | 
             
              }
         | 
| 12 12 | 
             
            });
         | 
| 13 | 
            +
            const Tyrads = {
         | 
| 14 | 
            +
              init: (apiKey, apiSecret) => {
         | 
| 15 | 
            +
                return TyradsSdk.init(apiKey, apiSecret);
         | 
| 16 | 
            +
              },
         | 
| 17 | 
            +
              loginUser: userId => {
         | 
| 18 | 
            +
                return TyradsSdk.loginUser(userId);
         | 
| 19 | 
            +
              },
         | 
| 20 | 
            +
              showOffers: ({
         | 
| 21 | 
            +
                launchMode = 3,
         | 
| 22 | 
            +
                route,
         | 
| 23 | 
            +
                campaignID = 0
         | 
| 24 | 
            +
              } = {}) => {
         | 
| 25 | 
            +
                if (Platform.OS === 'ios') {
         | 
| 26 | 
            +
                  return TyradsSdk.showOffers(launchMode, route, campaignID);
         | 
| 27 | 
            +
                } else {
         | 
| 28 | 
            +
                  return TyradsSdk.showOffers(route, campaignID);
         | 
| 29 | 
            +
                }
         | 
| 30 | 
            +
              }
         | 
| 31 | 
            +
            };
         | 
| 13 32 | 
             
            export default Tyrads;
         | 
| 14 33 | 
             
            //# sourceMappingURL=index.js.map
         | 
    
        package/lib/module/index.js.map
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default"," | 
| 1 | 
            +
            {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","TyradsSdk","Proxy","get","Error","Tyrads","init","apiKey","apiSecret","loginUser","userId","showOffers","launchMode","route","campaignID","OS"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,qEAAqE,GACrED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,SAAS,GAAGN,aAAa,CAACM,SAAS,GACrCN,aAAa,CAACM,SAAS,GACvB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMQ,MAAM,GAAG;EACbC,IAAI,EAAEA,CAACC,MAAc,EAAEC,SAAiB,KAAK;IAC3C,OAAOP,SAAS,CAACK,IAAI,CAACC,MAAM,EAAEC,SAAS,CAAC;EAC1C,CAAC;EACDC,SAAS,EAAGC,MAAc,IAAK;IAC7B,OAAOT,SAAS,CAACQ,SAAS,CAACC,MAAM,CAAC;EACpC,CAAC;EACDC,UAAU,EAAEA,CAAC;IACXC,UAAU,GAAG,CAAC;IACdC,KAAK;IACLC,UAAU,GAAG;EAC+C,CAAC,GAAG,CAAC,CAAC,KAAK;IACvE,IAAIlB,QAAQ,CAACmB,EAAE,KAAK,KAAK,EAAE;MACzB,OAAOd,SAAS,CAACU,UAAU,CAACC,UAAU,EAAEC,KAAK,EAAEC,UAAU,CAAC;IAC5D,CAAC,MAAM;MACL,OAAOb,SAAS,CAACU,UAAU,CAACE,KAAK,EAAEC,UAAU,CAAC;IAChD;EACF;AACF,CAAC;AAED,eAAeT,MAAM","ignoreList":[]}
         | 
| @@ -1,3 +1,11 @@ | |
| 1 | 
            -
            declare const Tyrads:  | 
| 1 | 
            +
            declare const Tyrads: {
         | 
| 2 | 
            +
                init: (apiKey: string, apiSecret: string) => any;
         | 
| 3 | 
            +
                loginUser: (userId: string) => any;
         | 
| 4 | 
            +
                showOffers: ({ launchMode, route, campaignID, }?: {
         | 
| 5 | 
            +
                    launchMode?: number;
         | 
| 6 | 
            +
                    route?: string;
         | 
| 7 | 
            +
                    campaignID?: number;
         | 
| 8 | 
            +
                }) => any;
         | 
| 9 | 
            +
            };
         | 
| 2 10 | 
             
            export default Tyrads;
         | 
| 3 11 | 
             
            //# sourceMappingURL=index.d.ts.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":" | 
| 1 | 
            +
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,MAAM;mBACK,MAAM,aAAa,MAAM;wBAGpB,MAAM;sDAOvB;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAOhE,CAAC;AAEF,eAAe,MAAM,CAAC"}
         | 
| @@ -1,3 +1,11 @@ | |
| 1 | 
            -
            declare const Tyrads:  | 
| 1 | 
            +
            declare const Tyrads: {
         | 
| 2 | 
            +
                init: (apiKey: string, apiSecret: string) => any;
         | 
| 3 | 
            +
                loginUser: (userId: string) => any;
         | 
| 4 | 
            +
                showOffers: ({ launchMode, route, campaignID, }?: {
         | 
| 5 | 
            +
                    launchMode?: number;
         | 
| 6 | 
            +
                    route?: string;
         | 
| 7 | 
            +
                    campaignID?: number;
         | 
| 8 | 
            +
                }) => any;
         | 
| 9 | 
            +
            };
         | 
| 2 10 | 
             
            export default Tyrads;
         | 
| 3 11 | 
             
            //# sourceMappingURL=index.d.ts.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":" | 
| 1 | 
            +
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,MAAM;mBACK,MAAM,aAAa,MAAM;wBAGpB,MAAM;sDAOvB;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;CAOhE,CAAC;AAEF,eAAe,MAAM,CAAC"}
         |