@bigcrunch/react-native-ads 0.6.0 → 0.9.0
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/android/bigcrunch-ads/com/bigcrunch/ads/BigCrunchAds.kt +6 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/BidRequestClient.kt +5 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/ConfigManager.kt +11 -4
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/DeviceContext.kt +1 -1
- package/android/bigcrunch-ads/com/bigcrunch/ads/core/SessionManager.kt +1 -0
- package/android/bigcrunch-ads/com/bigcrunch/ads/models/SessionInfo.kt +1 -0
- package/android/src/main/java/com/bigcrunch/ads/react/BigCrunchAdsModule.kt +14 -2
- package/ios/BigCrunchAds/Sources/BigCrunchAds.swift +6 -0
- package/ios/BigCrunchAds/Sources/Core/AdOrchestrator.swift +2 -2
- package/ios/BigCrunchAds/Sources/Core/BidRequestClient.swift +5 -0
- package/ios/BigCrunchAds/Sources/Core/ConfigManager.swift +14 -5
- package/ios/BigCrunchAds/Sources/Core/DeviceContext.swift +1 -1
- package/ios/BigCrunchAds/Sources/Models/AppConfig.swift +12 -0
- package/ios/BigCrunchAds/Sources/Models/SessionInfo.swift +5 -0
- package/ios/BigCrunchAdsModule.swift +10 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/types/index.ts +2 -0
|
@@ -108,6 +108,7 @@ object BigCrunchAds {
|
|
|
108
108
|
* @param propertyId Your BigCrunch property ID
|
|
109
109
|
* @param env Environment (Prod or Staging)
|
|
110
110
|
* @param useMockConfig If true, uses hardcoded mock config for testing (default: false)
|
|
111
|
+
* @param useTestAds If true, uses Google's test ad units instead of production units (default: false)
|
|
111
112
|
* @param callback Optional callback to be notified when initialization is complete
|
|
112
113
|
*/
|
|
113
114
|
fun initialize(
|
|
@@ -115,6 +116,7 @@ object BigCrunchAds {
|
|
|
115
116
|
propertyId: String,
|
|
116
117
|
env: Environment = Environment.Prod,
|
|
117
118
|
useMockConfig: Boolean = false,
|
|
119
|
+
useTestAds: Boolean = false,
|
|
118
120
|
callback: InitializationCallback? = null
|
|
119
121
|
) {
|
|
120
122
|
if (initialized) {
|
|
@@ -160,6 +162,9 @@ object BigCrunchAds {
|
|
|
160
162
|
val baseUrl = "https://pipeline.bigcrunch.com"
|
|
161
163
|
|
|
162
164
|
configManager = ConfigManager(httpClient, storage, moshi)
|
|
165
|
+
if (useTestAds) {
|
|
166
|
+
configManager.useTestAdsOverride = true
|
|
167
|
+
}
|
|
163
168
|
analyticsClient = AnalyticsClient(appContext, httpClient, moshi, baseUrl)
|
|
164
169
|
privacyStore = PrivacyStore(appContext)
|
|
165
170
|
|
|
@@ -308,6 +313,7 @@ object BigCrunchAds {
|
|
|
308
313
|
return SessionInfo(
|
|
309
314
|
sessionId = SessionManager.getSessionId(),
|
|
310
315
|
startTime = SessionManager.getSessionStartTime(),
|
|
316
|
+
sessionDepth = SessionManager.getSessionDepth(),
|
|
311
317
|
screenViewCount = SessionManager.getScreenViewCount(),
|
|
312
318
|
adRequestCount = SessionManager.getAdRequestCount(),
|
|
313
319
|
adImpressionCount = SessionManager.getAdImpressionCount(),
|
|
@@ -54,6 +54,11 @@ internal class BidRequestClient(
|
|
|
54
54
|
* @return Targeting KVPs to apply to GAM request, or null
|
|
55
55
|
*/
|
|
56
56
|
suspend fun fetchDemand(placement: PlacementConfig): Map<String, String>? {
|
|
57
|
+
if (!s2sConfig.enabled) {
|
|
58
|
+
BCLogger.d(TAG, "S2S is disabled, skipping bid request")
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
|
|
57
62
|
val deferred = CompletableDeferred<Map<String, String>?>()
|
|
58
63
|
|
|
59
64
|
mutex.withLock {
|
|
@@ -150,14 +150,16 @@ internal class ConfigManager(
|
|
|
150
150
|
val config = try {
|
|
151
151
|
adapter.fromJson(json)
|
|
152
152
|
} catch (e: Exception) {
|
|
153
|
-
BCLogger.e("ConfigManager", "Failed to parse config JSON", e)
|
|
153
|
+
BCLogger.e("ConfigManager", "Failed to parse config JSON from $url", e)
|
|
154
154
|
null
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
if (config != null) {
|
|
158
158
|
cachedConfig = config
|
|
159
159
|
saveToStorage(json)
|
|
160
|
-
|
|
160
|
+
val placementIds = config.placements.map { it.placementId }
|
|
161
|
+
BCLogger.i("ConfigManager", "Config loaded successfully from network (${config.placements.size} placements): $placementIds")
|
|
162
|
+
BCLogger.v("ConfigManager", "Config JSON: $json")
|
|
161
163
|
Result.success(config)
|
|
162
164
|
} else {
|
|
163
165
|
BCLogger.e("ConfigManager", "Invalid config JSON")
|
|
@@ -166,12 +168,13 @@ internal class ConfigManager(
|
|
|
166
168
|
}
|
|
167
169
|
storedConfig != null -> {
|
|
168
170
|
// Network failed but we have cached version
|
|
169
|
-
|
|
171
|
+
val cachedIds = storedConfig.placements.map { it.placementId }
|
|
172
|
+
BCLogger.w("ConfigManager", "Config fetch failed for $url: ${result.exceptionOrNull()?.message}. Using cached config (cached placements: $cachedIds)")
|
|
170
173
|
Result.success(storedConfig)
|
|
171
174
|
}
|
|
172
175
|
else -> {
|
|
173
176
|
// Network failed and no cache available
|
|
174
|
-
BCLogger.e("ConfigManager", "Config load failed and no cache available")
|
|
177
|
+
BCLogger.e("ConfigManager", "Config load failed for $url and no cache available")
|
|
175
178
|
Result.failure(result.exceptionOrNull() ?: Exception("Config load failed"))
|
|
176
179
|
}
|
|
177
180
|
}
|
|
@@ -255,12 +258,16 @@ internal class ConfigManager(
|
|
|
255
258
|
return cachedConfig?.refresh
|
|
256
259
|
}
|
|
257
260
|
|
|
261
|
+
/** Override for useTestAds, set via initialize() options. Takes precedence over config value. */
|
|
262
|
+
var useTestAdsOverride: Boolean? = null
|
|
263
|
+
|
|
258
264
|
/**
|
|
259
265
|
* Check if test ads mode is enabled in config
|
|
260
266
|
*
|
|
261
267
|
* @return true if test ads should be used, false otherwise
|
|
262
268
|
*/
|
|
263
269
|
fun shouldUseTestAds(): Boolean {
|
|
270
|
+
useTestAdsOverride?.let { return it }
|
|
264
271
|
return cachedConfig?.useTestAds ?: false
|
|
265
272
|
}
|
|
266
273
|
|
|
@@ -28,7 +28,7 @@ internal class DeviceContext private constructor(context: Context) {
|
|
|
28
28
|
|
|
29
29
|
companion object {
|
|
30
30
|
private const val TAG = "DeviceContext"
|
|
31
|
-
internal const val SDK_VERSION = "0.
|
|
31
|
+
internal const val SDK_VERSION = "0.9.0"
|
|
32
32
|
|
|
33
33
|
@Volatile
|
|
34
34
|
private var instance: DeviceContext? = null
|
|
@@ -71,6 +71,7 @@ internal class SessionManager private constructor(private val storage: KeyValueS
|
|
|
71
71
|
// Static accessors for tracking counters
|
|
72
72
|
fun getSessionId(): String = getInstance().sessionId
|
|
73
73
|
fun getSessionStartTime(): String = getInstance().sessionStartTime
|
|
74
|
+
fun getSessionDepth(): Int = getInstance().sessionDepth
|
|
74
75
|
fun getScreenViewCount(): Int = getInstance().screenViewCounter.get()
|
|
75
76
|
fun getAdRequestCount(): Int = getInstance().adRequestCounter.get()
|
|
76
77
|
fun getAdImpressionCount(): Int = getInstance().adImpressionCounter.get()
|
|
@@ -33,12 +33,16 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
33
33
|
?: throw IllegalArgumentException("propertyId is required")
|
|
34
34
|
val environment = options.getString("environment") ?: "production"
|
|
35
35
|
val debug = if (options.hasKey("debug")) options.getBoolean("debug") else false
|
|
36
|
+
val useMockConfig = if (options.hasKey("useMockConfig")) options.getBoolean("useMockConfig") else false
|
|
37
|
+
val useTestAds = if (options.hasKey("useTestAds")) options.getBoolean("useTestAds") else false
|
|
36
38
|
|
|
37
39
|
// Initialize the native SDK
|
|
38
40
|
val context = reactApplicationContext.applicationContext
|
|
39
41
|
|
|
40
42
|
scope.launch {
|
|
41
43
|
try {
|
|
44
|
+
android.util.Log.d("BigCrunchRNBridge", "initialize() called: propertyId=$propertyId env=$environment mock=$useMockConfig testAds=$useTestAds")
|
|
45
|
+
|
|
42
46
|
BigCrunchAds.initialize(
|
|
43
47
|
context = context,
|
|
44
48
|
propertyId = propertyId,
|
|
@@ -46,22 +50,29 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
46
50
|
BigCrunchAds.Environment.Staging
|
|
47
51
|
else
|
|
48
52
|
BigCrunchAds.Environment.Prod,
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
useMockConfig = useMockConfig,
|
|
54
|
+
useTestAds = useTestAds
|
|
51
55
|
)
|
|
52
56
|
|
|
57
|
+
android.util.Log.d("BigCrunchRNBridge", "native initialize() returned, isInitialized=${BigCrunchAds.isInitialized()}")
|
|
58
|
+
|
|
53
59
|
if (debug) {
|
|
54
60
|
BigCrunchAds.setDebugMode(true)
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
// Wait for config to be loaded before resolving the promise
|
|
58
64
|
// This ensures placements are available when the app starts loading ads
|
|
65
|
+
android.util.Log.d("BigCrunchRNBridge", "waiting for config...")
|
|
59
66
|
val configLoaded = BigCrunchAds.waitForConfig()
|
|
67
|
+
android.util.Log.d("BigCrunchRNBridge", "waitForConfig returned: $configLoaded, isConfigReady=${BigCrunchAds.isConfigReady()}")
|
|
68
|
+
|
|
60
69
|
if (!configLoaded) {
|
|
70
|
+
android.util.Log.e("BigCrunchRNBridge", "config failed to load, rejecting promise")
|
|
61
71
|
promise.reject("INIT_ERROR", "Failed to load configuration", null)
|
|
62
72
|
return@launch
|
|
63
73
|
}
|
|
64
74
|
|
|
75
|
+
android.util.Log.d("BigCrunchRNBridge", "init complete, resolving promise")
|
|
65
76
|
promise.resolve(null)
|
|
66
77
|
} catch (e: Exception) {
|
|
67
78
|
promise.reject("INIT_ERROR", "Failed to initialize SDK: ${e.message}", e)
|
|
@@ -618,6 +629,7 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
618
629
|
val map = Arguments.createMap()
|
|
619
630
|
map.putString("sessionId", info.sessionId)
|
|
620
631
|
map.putString("startTime", info.startTime) // Changed from toDouble() - now ISO 8601 string
|
|
632
|
+
map.putInt("sessionDepth", info.sessionDepth)
|
|
621
633
|
map.putInt("screenViewCount", info.screenViewCount)
|
|
622
634
|
map.putInt("adRequestCount", info.adRequestCount)
|
|
623
635
|
map.putInt("adImpressionCount", info.adImpressionCount)
|
|
@@ -62,12 +62,14 @@ public final class BigCrunchAds {
|
|
|
62
62
|
* - propertyId: Your BigCrunch property ID
|
|
63
63
|
* - env: Environment (prod or staging)
|
|
64
64
|
* - useMockConfig: If true, uses hardcoded mock config for testing (default: false)
|
|
65
|
+
* - useTestAds: If true, uses Google's test ad units instead of production units (default: false)
|
|
65
66
|
* - callback: Optional callback to be notified when initialization is complete
|
|
66
67
|
*/
|
|
67
68
|
public static func initialize(
|
|
68
69
|
propertyId: String,
|
|
69
70
|
env: BigCrunchEnv = .prod,
|
|
70
71
|
useMockConfig: Bool = false,
|
|
72
|
+
useTestAds: Bool = false,
|
|
71
73
|
callback: BigCrunchInitializationCallback? = nil
|
|
72
74
|
) {
|
|
73
75
|
if _isInitialized {
|
|
@@ -99,6 +101,9 @@ public final class BigCrunchAds {
|
|
|
99
101
|
let baseURL = "https://pipeline.bigcrunch.com"
|
|
100
102
|
|
|
101
103
|
configManager = ConfigManager(httpClient: httpClient, storage: storage)
|
|
104
|
+
if useTestAds {
|
|
105
|
+
configManager.useTestAdsOverride = true
|
|
106
|
+
}
|
|
102
107
|
analyticsClient = AnalyticsClient(httpClient: httpClient, baseURL: baseURL)
|
|
103
108
|
|
|
104
109
|
// Mark as initialized before async config load
|
|
@@ -202,6 +207,7 @@ public final class BigCrunchAds {
|
|
|
202
207
|
sessionId: sm.sessionId,
|
|
203
208
|
userId: sm.userId,
|
|
204
209
|
startTime: sm.sessionStartTime,
|
|
210
|
+
sessionDepth: sm.sessionDepth,
|
|
205
211
|
screenViewCount: sm.sessionDepth,
|
|
206
212
|
adRequestCount: sm.adRequestCount,
|
|
207
213
|
adImpressionCount: sm.adImpressionCount,
|
|
@@ -422,7 +422,7 @@ internal class AdOrchestrator {
|
|
|
422
422
|
*/
|
|
423
423
|
private class BannerCallbackWrapper {
|
|
424
424
|
let placementId: String
|
|
425
|
-
|
|
425
|
+
var callback: BannerCallback?
|
|
426
426
|
var delegateWrapper: BannerDelegateAdapterWrapper?
|
|
427
427
|
|
|
428
428
|
init(placementId: String, callback: BannerCallback) {
|
|
@@ -436,7 +436,7 @@ private class BannerCallbackWrapper {
|
|
|
436
436
|
*/
|
|
437
437
|
private class InterstitialCallbackWrapper {
|
|
438
438
|
let placementId: String
|
|
439
|
-
|
|
439
|
+
var callback: InterstitialCallback?
|
|
440
440
|
var delegateWrapper: InterstitialDelegateAdapterWrapper?
|
|
441
441
|
|
|
442
442
|
init(placementId: String, callback: InterstitialCallback) {
|
|
@@ -60,6 +60,11 @@ internal class BidRequestClient {
|
|
|
60
60
|
* - Returns: Targeting KVPs to apply to GAM request, or nil
|
|
61
61
|
*/
|
|
62
62
|
func fetchDemand(placement: PlacementConfig) async -> [String: String]? {
|
|
63
|
+
guard s2sConfig.enabled else {
|
|
64
|
+
BCLogger.debug("BidRequestClient: S2S is disabled, skipping bid request")
|
|
65
|
+
return nil
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
return await withCheckedContinuation { continuation in
|
|
64
69
|
lock.lock()
|
|
65
70
|
pendingRequests.append(PendingRequest(
|
|
@@ -147,20 +147,23 @@ internal class ConfigManager {
|
|
|
147
147
|
let config = try JSONDecoder().decode(AppConfig.self, from: data)
|
|
148
148
|
cachedConfig = config
|
|
149
149
|
saveToStorage(json)
|
|
150
|
-
|
|
150
|
+
let placementIds = config.placements.map { $0.placementId }
|
|
151
|
+
BCLogger.info("Config loaded successfully from network (\(config.placements.count) placements): \(placementIds)")
|
|
152
|
+
BCLogger.verbose("Config JSON: \(json)")
|
|
151
153
|
return .success(config)
|
|
152
154
|
} catch {
|
|
153
|
-
BCLogger.error("Failed to parse config JSON: \(error)")
|
|
155
|
+
BCLogger.error("Failed to parse config JSON from \(url): \(error)")
|
|
154
156
|
return .failure(error)
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
case .failure(let error):
|
|
158
160
|
// Network failed, check for cached version
|
|
159
161
|
if let cached = cachedConfig {
|
|
160
|
-
|
|
162
|
+
let cachedIds = cached.placements.map { $0.placementId }
|
|
163
|
+
BCLogger.warning("Config fetch failed for \(url): \(error). Using cached config (cached placements: \(cachedIds))")
|
|
161
164
|
return .success(cached)
|
|
162
165
|
} else {
|
|
163
|
-
BCLogger.error("Config load failed and no cache available")
|
|
166
|
+
BCLogger.error("Config load failed for \(url) and no cache available")
|
|
164
167
|
return .failure(error)
|
|
165
168
|
}
|
|
166
169
|
}
|
|
@@ -227,15 +230,21 @@ internal class ConfigManager {
|
|
|
227
230
|
return cachedConfig
|
|
228
231
|
}
|
|
229
232
|
|
|
233
|
+
/// Override for useTestAds, set via initialize() options. Takes precedence over config value.
|
|
234
|
+
var useTestAdsOverride: Bool?
|
|
235
|
+
|
|
230
236
|
/**
|
|
231
237
|
* Check if test ads should be used
|
|
232
238
|
*
|
|
233
|
-
* Returns true if the cached config has useTestAds enabled.
|
|
239
|
+
* Returns true if the override is set, or if the cached config has useTestAds enabled.
|
|
234
240
|
* When true, GoogleAdsAdapter should substitute production ad units with Google's test ad units.
|
|
235
241
|
*
|
|
236
242
|
* - Returns: True if test ads should be used, false otherwise
|
|
237
243
|
*/
|
|
238
244
|
func shouldUseTestAds() -> Bool {
|
|
245
|
+
if let override = useTestAdsOverride {
|
|
246
|
+
return override
|
|
247
|
+
}
|
|
239
248
|
lock.lock()
|
|
240
249
|
defer { lock.unlock() }
|
|
241
250
|
return cachedConfig?.useTestAds ?? false
|
|
@@ -39,6 +39,18 @@ public struct AppConfig: Codable {
|
|
|
39
39
|
self.placements = placements
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
public init(from decoder: Decoder) throws {
|
|
43
|
+
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
44
|
+
propertyId = try container.decode(String.self, forKey: .propertyId)
|
|
45
|
+
appName = try container.decode(String.self, forKey: .appName)
|
|
46
|
+
gamNetworkCode = try container.decode(String.self, forKey: .gamNetworkCode)
|
|
47
|
+
s2s = try container.decode(S2SConfig.self, forKey: .s2s)
|
|
48
|
+
bidders = try container.decodeIfPresent([String: BidderEntry].self, forKey: .bidders)
|
|
49
|
+
amazonAps = try container.decodeIfPresent(GlobalAmazonConfig.self, forKey: .amazonAps)
|
|
50
|
+
useTestAds = try container.decodeIfPresent(Bool.self, forKey: .useTestAds) ?? false
|
|
51
|
+
refresh = try container.decodeIfPresent(RefreshConfig.self, forKey: .refresh)
|
|
52
|
+
placements = try container.decode([PlacementConfig].self, forKey: .placements)
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
/**
|
|
@@ -16,6 +16,9 @@ public struct SessionInfo {
|
|
|
16
16
|
/// ISO 8601 timestamp when the session started
|
|
17
17
|
public let startTime: String
|
|
18
18
|
|
|
19
|
+
/// Number of page views in current session (same as screenViewCount)
|
|
20
|
+
public let sessionDepth: Int
|
|
21
|
+
|
|
19
22
|
/// Number of screen views in this session
|
|
20
23
|
public let screenViewCount: Int
|
|
21
24
|
|
|
@@ -32,6 +35,7 @@ public struct SessionInfo {
|
|
|
32
35
|
sessionId: String,
|
|
33
36
|
userId: String,
|
|
34
37
|
startTime: String,
|
|
38
|
+
sessionDepth: Int,
|
|
35
39
|
screenViewCount: Int,
|
|
36
40
|
adRequestCount: Int,
|
|
37
41
|
adImpressionCount: Int,
|
|
@@ -40,6 +44,7 @@ public struct SessionInfo {
|
|
|
40
44
|
self.sessionId = sessionId
|
|
41
45
|
self.userId = userId
|
|
42
46
|
self.startTime = startTime
|
|
47
|
+
self.sessionDepth = sessionDepth
|
|
43
48
|
self.screenViewCount = screenViewCount
|
|
44
49
|
self.adRequestCount = adRequestCount
|
|
45
50
|
self.adImpressionCount = adImpressionCount
|
|
@@ -132,10 +132,12 @@ class InitCallbackBridge: NSObject, BigCrunchInitializationCallback {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
func onInitialized() {
|
|
135
|
+
NSLog("[BigCrunchRNBridge] callback onInitialized fired, resolving promise")
|
|
135
136
|
onSuccess()
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
func onInitializationFailed(error: String) {
|
|
140
|
+
NSLog("[BigCrunchRNBridge] callback onInitializationFailed: %@", error)
|
|
139
141
|
onFailure(error)
|
|
140
142
|
}
|
|
141
143
|
}
|
|
@@ -224,19 +226,24 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
224
226
|
let environment = options["environment"] as? String ?? "production"
|
|
225
227
|
let debug = options["debug"] as? Bool ?? false
|
|
226
228
|
let useMockConfig = options["useMockConfig"] as? Bool ?? false
|
|
229
|
+
let useTestAds = options["useTestAds"] as? Bool ?? false
|
|
227
230
|
|
|
228
231
|
DispatchQueue.main.async {
|
|
229
232
|
// Map environment strings to SDK enum - "sandbox" maps to .staging
|
|
230
233
|
let env: BigCrunchEnv = environment == "sandbox" ? .staging : .prod
|
|
231
234
|
|
|
235
|
+
NSLog("[BigCrunchRNBridge] initialize() called: propertyId=%@ env=%@ mock=%d testAds=%d", propertyId, environment, useMockConfig ? 1 : 0, useTestAds ? 1 : 0)
|
|
236
|
+
|
|
232
237
|
// Use callback to wait for config to load before resolving the promise
|
|
233
238
|
// This ensures placements are available when the app starts loading ads
|
|
234
239
|
let callbackBridge = InitCallbackBridge(
|
|
235
240
|
onSuccess: {
|
|
241
|
+
NSLog("[BigCrunchRNBridge] init complete, setting isSDKInitialized=true, resolving promise")
|
|
236
242
|
BigCrunchAdsModule.isSDKInitialized = true
|
|
237
243
|
resolver(nil)
|
|
238
244
|
},
|
|
239
245
|
onFailure: { error in
|
|
246
|
+
NSLog("[BigCrunchRNBridge] init failed: %@, rejecting promise", error)
|
|
240
247
|
rejecter("INIT_ERROR", "Failed to load configuration: \(error)", nil)
|
|
241
248
|
}
|
|
242
249
|
)
|
|
@@ -247,8 +254,10 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
247
254
|
propertyId: propertyId,
|
|
248
255
|
env: env,
|
|
249
256
|
useMockConfig: useMockConfig,
|
|
257
|
+
useTestAds: useTestAds,
|
|
250
258
|
callback: callbackBridge
|
|
251
259
|
)
|
|
260
|
+
NSLog("[BigCrunchRNBridge] native initialize() returned, waiting for callback...")
|
|
252
261
|
}
|
|
253
262
|
}
|
|
254
263
|
|
|
@@ -510,6 +519,7 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
510
519
|
"sessionId": info.sessionId,
|
|
511
520
|
"userId": info.userId,
|
|
512
521
|
"startTime": info.startTime,
|
|
522
|
+
"sessionDepth": info.sessionDepth,
|
|
513
523
|
"screenViewCount": info.screenViewCount,
|
|
514
524
|
"adRequestCount": info.adRequestCount,
|
|
515
525
|
"adImpressionCount": info.adImpressionCount,
|
package/lib/types/index.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface InitializationOptions {
|
|
|
36
36
|
debug?: boolean;
|
|
37
37
|
/** Use mock configuration for testing (no backend required) */
|
|
38
38
|
useMockConfig?: boolean;
|
|
39
|
+
/** Use Google's test ad units instead of production units */
|
|
40
|
+
useTestAds?: boolean;
|
|
39
41
|
/** Custom backend URL (optional) */
|
|
40
42
|
customBackendUrl?: string;
|
|
41
43
|
/** Session timeout in seconds (default: 1800) */
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;AAEnD;;GAEG;AACH,MAA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,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,EAAE,EAAE,KAAK,GAAG,SAAS,CAAC;IACtB,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC9D,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigcrunch/react-native-ads",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with S2S demand and Google Ad Manager",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
package/src/types/index.ts
CHANGED
|
@@ -49,6 +49,8 @@ export interface InitializationOptions {
|
|
|
49
49
|
debug?: boolean;
|
|
50
50
|
/** Use mock configuration for testing (no backend required) */
|
|
51
51
|
useMockConfig?: boolean;
|
|
52
|
+
/** Use Google's test ad units instead of production units */
|
|
53
|
+
useTestAds?: boolean;
|
|
52
54
|
/** Custom backend URL (optional) */
|
|
53
55
|
customBackendUrl?: string;
|
|
54
56
|
/** Session timeout in seconds (default: 1800) */
|