cm-sdk-react-native-v3 3.5.2 → 3.6.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/README.md CHANGED
@@ -1,9 +1,21 @@
1
- # ``consentmanager CMP SDK v3.5.0``
1
+ # ``consentmanager CMP SDK v3.6.0``
2
2
 
3
3
  # cm-sdk-react-native-v3
4
4
 
5
5
  cm-sdk-react-native-v3 is a comprehensive Consent Management Platform (CMP) SDK bridge for React Native developed applications. It provides easy-to-use APIs for handling user consent in compliance with various privacy regulations.
6
6
 
7
+ ## ✨ New Architecture Support
8
+
9
+ **Version 3.6.0 now supports React Native's New Architecture (TurboModules + Fabric)!**
10
+
11
+ - ✅ **Full backward compatibility** with legacy architecture
12
+ - ✅ **Automatic detection** and fallback mechanism
13
+ - ✅ **Zero breaking changes** to existing APIs
14
+ - ✅ **Enhanced performance** with TurboModules
15
+ - ✅ **Type safety** with automatic code generation
16
+
17
+ See [NEW_ARCHITECTURE.md](./NEW_ARCHITECTURE.md) for detailed information.
18
+
7
19
  For further information, please refer to [our documentation](https://help.consentmanager.net/books/cmp/chapter/integration-into-your-app---v3)
8
20
  ## License
9
21
 
@@ -8,7 +8,7 @@ buildscript {
8
8
  }
9
9
 
10
10
  dependencies {
11
- classpath "com.android.tools.build:gradle:7.2.1"
11
+ classpath "com.android.tools.build:gradle:8.11.1"
12
12
  // noinspection DifferentKotlinGradleVersion
13
13
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
14
  }
@@ -58,11 +58,11 @@ android {
58
58
  }
59
59
  }
60
60
 
61
- compileSdkVersion 34
61
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
62
62
 
63
63
  defaultConfig {
64
- minSdkVersion 23
65
- targetSdkVersion 34
64
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
65
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
66
66
 
67
67
  }
68
68
 
@@ -96,5 +96,5 @@ dependencies {
96
96
  //noinspection GradleDynamicVersion
97
97
  implementation "com.facebook.react:react-native:+"
98
98
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
99
- implementation "net.consentmanager.sdkv3:cmsdkv3:3.4.0"
99
+ implementation "net.consentmanager.sdkv3:cmsdkv3:3.6.0"
100
100
  }
@@ -1,5 +1,5 @@
1
- CmSdkReactNativeV3_kotlinVersion=1.7.0
1
+ CmSdkReactNativeV3_kotlinVersion=1.9.22
2
2
  CmSdkReactNativeV3_minSdkVersion=25
3
- CmSdkReactNativeV3_targetSdkVersion=31
4
- CmSdkReactNativeV3_compileSdkVersion=31
3
+ CmSdkReactNativeV3_targetSdkVersion=36
4
+ CmSdkReactNativeV3_compileSdkVersion=36
5
5
  CmSdkReactNativeV3_ndkversion=21.4.7075529
@@ -3,18 +3,17 @@ package com.cmsdkreactnativev3
3
3
  import android.os.Handler
4
4
  import android.os.Looper
5
5
  import android.util.Log
6
+ import com.facebook.fbreact.specs.NativeCmSdkReactNativeV3Spec
6
7
  import com.facebook.react.bridge.Arguments
7
8
  import com.facebook.react.bridge.LifecycleEventListener
8
9
  import com.facebook.react.bridge.Promise
9
10
  import com.facebook.react.bridge.ReactApplicationContext
10
- import com.facebook.react.bridge.ReactContextBaseJavaModule
11
11
  import com.facebook.react.bridge.ReactMethod
12
12
  import com.facebook.react.bridge.ReadableArray
13
13
  import com.facebook.react.bridge.ReadableMap
14
14
  import com.facebook.react.bridge.ReadableType
15
15
  import com.facebook.react.bridge.WritableArray
16
16
  import com.facebook.react.bridge.WritableMap
17
- import com.facebook.react.modules.core.DeviceEventManagerModule
18
17
  import kotlinx.coroutines.CoroutineScope
19
18
  import kotlinx.coroutines.Dispatchers
20
19
  import kotlinx.coroutines.launch
@@ -26,7 +25,7 @@ import net.consentmanager.cm_sdk_android_v3.UrlConfig
26
25
  import net.consentmanager.cm_sdk_android_v3.UserConsentStatus
27
26
 
28
27
  class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
29
- ReactContextBaseJavaModule(reactContext), LifecycleEventListener, CMPManagerDelegate {
28
+ NativeCmSdkReactNativeV3Spec(reactContext), LifecycleEventListener, CMPManagerDelegate {
30
29
 
31
30
  private lateinit var cmpManager: CMPManager
32
31
  private val scope = CoroutineScope(Dispatchers.Main)
@@ -34,6 +33,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
34
33
  private var webViewConfig: ConsentLayerUIConfig
35
34
  private val uiThreadHandler = Handler(Looper.getMainLooper())
36
35
  private var isInitialized = false
36
+ private var storedATTStatus: Int = 0
37
37
 
38
38
 
39
39
  init {
@@ -50,18 +50,25 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
50
50
  }
51
51
 
52
52
  override fun getName(): String = NAME
53
+
54
+ override fun invalidate() {
55
+ super.invalidate()
56
+ if (::cmpManager.isInitialized) {
57
+ cmpManager.onActivityDestroyed()
58
+ }
59
+ }
53
60
 
54
61
  private fun runOnUiThread(runnable: Runnable) {
55
62
  uiThreadHandler.post(runnable)
56
63
  }
57
64
 
58
65
  @ReactMethod
59
- fun addListener(eventName: String?) {
66
+ override fun addListener(eventName: String?) {
60
67
  // Required for NativeEventEmitter - React Native calls this automatically
61
68
  }
62
69
 
63
70
  @ReactMethod
64
- fun removeListeners(count: Int) {
71
+ override fun removeListeners(count: Double) {
65
72
  // Required for NativeEventEmitter - React Native calls this automatically
66
73
  }
67
74
 
@@ -70,7 +77,17 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
70
77
 
71
78
 
72
79
  @ReactMethod
73
- fun setWebViewConfig(config: ReadableMap, promise: Promise) {
80
+ override fun setATTStatus(status: Double, promise: Promise) {
81
+ try {
82
+ this.storedATTStatus = status.toInt()
83
+ promise.resolve(null)
84
+ } catch (e: Exception) {
85
+ promise.reject("ERROR", "Failed to set ATT status: ${e.message}")
86
+ }
87
+ }
88
+
89
+ @ReactMethod
90
+ override fun setWebViewConfig(config: ReadableMap, promise: Promise) {
74
91
  runOnUiThread {
75
92
  try {
76
93
  val position = when (config.getString("position")) {
@@ -97,15 +114,16 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
97
114
  }
98
115
 
99
116
  @ReactMethod
100
- fun setUrlConfig(config: ReadableMap, promise: Promise) {
117
+ override fun setUrlConfig(config: ReadableMap, promise: Promise) {
101
118
  runOnUiThread {
102
119
  try {
103
120
  val id = config.getString("id") ?: throw IllegalArgumentException("Missing 'id'")
104
121
  val domain = config.getString("domain") ?: throw IllegalArgumentException("Missing 'domain'")
105
122
  val language = config.getString("language") ?: throw IllegalArgumentException("Missing 'language'")
106
123
  val appName = config.getString("appName") ?: throw IllegalArgumentException("Missing 'appName'")
124
+ val noHash = if (config.hasKey("noHash")) config.getBoolean("noHash") else false
107
125
 
108
- this.urlConfig = UrlConfig(id, domain, language, appName)
126
+ this.urlConfig = UrlConfig(id, domain, language, appName, noHash = noHash)
109
127
 
110
128
  initializeCMPManager()
111
129
 
@@ -155,7 +173,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
155
173
  * Gets the comprehensive user consent status
156
174
  */
157
175
  @ReactMethod
158
- fun getUserStatus(promise: Promise) {
176
+ override fun getUserStatus(promise: Promise) {
159
177
  try {
160
178
  val userStatus = cmpManager.getUserStatus()
161
179
  val result = Arguments.createMap().apply {
@@ -187,7 +205,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
187
205
  * Gets the consent status for a specific purpose
188
206
  */
189
207
  @ReactMethod
190
- fun getStatusForPurpose(purposeId: String, promise: Promise) {
208
+ override fun getStatusForPurpose(purposeId: String, promise: Promise) {
191
209
  try {
192
210
  val status = cmpManager.getStatusForPurpose(purposeId)
193
211
  promise.resolve(status.toString())
@@ -200,7 +218,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
200
218
  * Gets the consent status for a specific vendor
201
219
  */
202
220
  @ReactMethod
203
- fun getStatusForVendor(vendorId: String, promise: Promise) {
221
+ override fun getStatusForVendor(vendorId: String, promise: Promise) {
204
222
  try {
205
223
  val status = cmpManager.getStatusForVendor(vendorId)
206
224
  promise.resolve(status.toString())
@@ -213,7 +231,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
213
231
  * Gets Google Consent Mode v2 compatible settings
214
232
  */
215
233
  @ReactMethod
216
- fun getGoogleConsentModeStatus(promise: Promise) {
234
+ override fun getGoogleConsentModeStatus(promise: Promise) {
217
235
  try {
218
236
  val consentModeStatus = cmpManager.getGoogleConsentModeStatus()
219
237
  val result = Arguments.createMap()
@@ -232,7 +250,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
232
250
  * Replacement for openConsentLayer - force opens the consent UI
233
251
  */
234
252
  @ReactMethod
235
- fun forceOpen(jumpToSettings: Boolean, promise: Promise) {
253
+ override fun forceOpen(jumpToSettings: Boolean, promise: Promise) {
236
254
  scope.launch {
237
255
  try {
238
256
  currentActivity?.let { cmpManager.setActivity(it) }
@@ -254,7 +272,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
254
272
  * Replacement for checkWithServerAndOpenIfNecessary - checks with server and opens if needed
255
273
  */
256
274
  @ReactMethod
257
- fun checkAndOpen(jumpToSettings: Boolean, promise: Promise) {
275
+ override fun checkAndOpen(jumpToSettings: Boolean, promise: Promise) {
258
276
  scope.launch {
259
277
  try {
260
278
  currentActivity?.let { cmpManager.setActivity(it) }
@@ -276,7 +294,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
276
294
  * Import a CMP information string
277
295
  */
278
296
  @ReactMethod
279
- fun importCMPInfo(cmpString: String, promise: Promise) {
297
+ override fun importCMPInfo(cmpString: String, promise: Promise) {
280
298
  scope.launch {
281
299
  try {
282
300
  cmpManager.importCMPInfo(cmpString) { result ->
@@ -296,7 +314,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
296
314
  * Reset all consent management data
297
315
  */
298
316
  @ReactMethod
299
- fun resetConsentManagementData(promise: Promise) {
317
+ override fun resetConsentManagementData(promise: Promise) {
300
318
  try {
301
319
  cmpManager.resetConsentManagementData()
302
320
  promise.resolve(true)
@@ -306,125 +324,12 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
306
324
  }
307
325
 
308
326
  @ReactMethod
309
- fun checkWithServerAndOpenIfNecessary(promise: Promise) {
310
- scope.launch {
311
- try {
312
- currentActivity?.let { cmpManager.setActivity(it) }
313
-
314
- cmpManager.checkAndOpen(false) { result ->
315
- if (result.isSuccess) {
316
- promise.resolve(true)
317
- } else {
318
- promise.reject("ERROR", result.exceptionOrNull()?.message ?: "Unknown error")
319
- }
320
- }
321
- } catch (e: Exception) {
322
- promise.reject("ERROR", "Failed to check with server: ${e.message}", e)
323
- }
324
- }
325
- }
326
-
327
- @ReactMethod
328
- fun openConsentLayer(promise: Promise) {
329
- scope.launch {
330
- try {
331
- currentActivity?.let { cmpManager.setActivity(it) }
332
- cmpManager.forceOpen(false) { result ->
333
- if (result.isSuccess) {
334
- promise.resolve(true)
335
- } else {
336
- promise.reject("ERROR", result.exceptionOrNull()?.message ?: "Unknown error")
337
- }
338
- }
339
- } catch (e: Exception) {
340
- promise.reject("ERROR", "Failed to open consent layer: ${e.message}", e)
341
- }
342
- }
343
- }
344
-
345
- @ReactMethod
346
- fun jumpToSettings(promise: Promise) {
347
- scope.launch {
348
- try {
349
- currentActivity?.let { cmpManager.setActivity(it) }
350
- cmpManager.forceOpen(true) { result ->
351
- if (result.isSuccess) {
352
- promise.resolve(true)
353
- } else {
354
- promise.reject("ERROR", result.exceptionOrNull()?.message ?: "Unknown error")
355
- }
356
- }
357
- } catch (e: Exception) {
358
- promise.reject("ERROR", "Failed to jump to settings: ${e.message}", e)
359
- }
360
- }
361
- }
362
-
363
- @ReactMethod
364
- fun checkIfConsentIsRequired(promise: Promise) {
365
- scope.launch {
366
- try {
367
- cmpManager.checkIfConsentIsRequired { isRequired ->
368
- promise.resolve(isRequired)
369
- }
370
- } catch (e: Exception) {
371
- promise.reject("ERROR", "Failed to check if consent is required: ${e.message}", e)
372
- }
373
- }
374
- }
375
-
376
- @ReactMethod
377
- fun hasUserChoice(promise: Promise) {
378
- promise.resolve(cmpManager.hasUserChoice())
379
- }
380
-
381
- @ReactMethod
382
- fun hasPurposeConsent(purposeId: String, promise: Promise) {
383
- promise.resolve(cmpManager.hasPurposeConsent(purposeId))
384
- }
385
-
386
- @ReactMethod
387
- fun hasVendorConsent(vendorId: String, promise: Promise) {
388
- promise.resolve(cmpManager.hasVendorConsent(vendorId))
389
- }
390
-
391
- @ReactMethod
392
- fun exportCMPInfo(promise: Promise) {
327
+ override fun exportCMPInfo(promise: Promise) {
393
328
  promise.resolve(cmpManager.exportCMPInfo())
394
329
  }
395
330
 
396
331
  @ReactMethod
397
- fun getAllPurposesIDs(promise: Promise) {
398
- promise.resolve(cmpManager.getAllPurposesIDs().toWritableArray())
399
- }
400
-
401
- @ReactMethod
402
- fun getEnabledPurposesIDs(promise: Promise) {
403
- promise.resolve(cmpManager.getEnabledPurposesIDs().toWritableArray())
404
- }
405
-
406
- @ReactMethod
407
- fun getDisabledPurposesIDs(promise: Promise) {
408
- promise.resolve(cmpManager.getDisabledPurposesIDs().toWritableArray())
409
- }
410
-
411
- @ReactMethod
412
- fun getAllVendorsIDs(promise: Promise) {
413
- promise.resolve(cmpManager.getAllVendorsIDs().toWritableArray())
414
- }
415
-
416
- @ReactMethod
417
- fun getEnabledVendorsIDs(promise: Promise) {
418
- promise.resolve(cmpManager.getEnabledVendorsIDs().toWritableArray())
419
- }
420
-
421
- @ReactMethod
422
- fun getDisabledVendorsIDs(promise: Promise) {
423
- promise.resolve(cmpManager.getDisabledVendorsIDs().toWritableArray())
424
- }
425
-
426
- @ReactMethod
427
- fun acceptVendors(vendors: ReadableArray, promise: Promise) {
332
+ override fun acceptVendors(vendors: ReadableArray, promise: Promise) {
428
333
  scope.launch {
429
334
  try {
430
335
  Log.d("CmSdkReactNativeV3", "Accepting vendors: $vendors")
@@ -443,7 +348,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
443
348
  }
444
349
 
445
350
  @ReactMethod
446
- fun rejectVendors(vendors: ReadableArray, promise: Promise) {
351
+ override fun rejectVendors(vendors: ReadableArray, promise: Promise) {
447
352
  scope.launch {
448
353
  try {
449
354
  Log.d("CmSdkReactNativeV3", "Rejecting vendors: $vendors")
@@ -461,7 +366,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
461
366
  }
462
367
 
463
368
  @ReactMethod
464
- fun acceptPurposes(purposes: ReadableArray, updatePurpose: Boolean, promise: Promise) {
369
+ override fun acceptPurposes(purposes: ReadableArray, updatePurpose: Boolean, promise: Promise) {
465
370
  scope.launch {
466
371
  try {
467
372
  Log.d("Cmsdkreactnativev3", "Rejecting purposes: $purposes")
@@ -480,7 +385,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
480
385
  }
481
386
 
482
387
  @ReactMethod
483
- fun rejectPurposes(purposes: ReadableArray, updateVendor: Boolean, promise: Promise) {
388
+ override fun rejectPurposes(purposes: ReadableArray, updateVendor: Boolean, promise: Promise) {
484
389
  scope.launch {
485
390
  try {
486
391
  Log.d("Cmsdkreactnativev3", "Rejecting purposes: $purposes")
@@ -498,7 +403,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
498
403
  }
499
404
 
500
405
  @ReactMethod
501
- fun rejectAll(promise: Promise) {
406
+ override fun rejectAll(promise: Promise) {
502
407
  scope.launch {
503
408
  try {
504
409
  cmpManager.rejectAll { result ->
@@ -515,7 +420,7 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
515
420
  }
516
421
 
517
422
  @ReactMethod
518
- fun acceptAll(promise: Promise) {
423
+ override fun acceptAll(promise: Promise) {
519
424
  scope.launch {
520
425
  try {
521
426
  cmpManager.acceptAll { result ->
@@ -564,9 +469,8 @@ class CmSdkReactNativeV3Module(reactContext: ReactApplicationContext) :
564
469
 
565
470
  private fun sendEvent(eventName: String, params: WritableMap?) {
566
471
  Log.d("CmSdkReactNativeV3", "sendEvent called: $eventName")
567
- reactApplicationContext
568
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
569
- .emit(eventName, params)
472
+ // Bridgeless-compatible: emitDeviceEvent works in all modes (legacy, new arch, bridgeless)
473
+ reactApplicationContext.emitDeviceEvent(eventName, params)
570
474
  }
571
475
 
572
476
  private fun List<String>.toWritableArray(): WritableArray {
@@ -1,14 +1,34 @@
1
1
  package com.cmsdkreactnativev3
2
2
 
3
- import com.facebook.react.ReactPackage
3
+ import com.facebook.react.TurboReactPackage
4
4
  import com.facebook.react.bridge.NativeModule
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
6
8
  import com.facebook.react.uimanager.ViewManager
7
9
 
10
+ class CmSdkReactNativeV3Package : TurboReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == CmSdkReactNativeV3Module.NAME) {
13
+ CmSdkReactNativeV3Module(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
8
18
 
9
- class CmSdkReactNativeV3Package : ReactPackage {
10
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11
- return listOf(CmSdkReactNativeV3Module(reactContext))
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ mapOf(
22
+ CmSdkReactNativeV3Module.NAME to ReactModuleInfo(
23
+ _name = CmSdkReactNativeV3Module.NAME,
24
+ _className = CmSdkReactNativeV3Module.NAME,
25
+ _canOverrideExistingModule = false,
26
+ _needsEagerInit = false,
27
+ isCxxModule = false,
28
+ isTurboModule = true
29
+ )
30
+ )
31
+ }
12
32
  }
13
33
 
14
34
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
@@ -3,9 +3,6 @@
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(CmSdkReactNativeV3, RCTEventEmitter)
5
5
 
6
- // Event emitter methods
7
- RCT_EXTERN_METHOD(supportedEvents)
8
-
9
6
  // Core methods
10
7
  RCT_EXTERN_METHOD(setUrlConfig:(NSDictionary *)config
11
8
  withResolver:(RCTPromiseResolveBlock)resolve
@@ -15,6 +12,10 @@ RCT_EXTERN_METHOD(setWebViewConfig:(NSDictionary *)config
15
12
  withResolver:(RCTPromiseResolveBlock)resolve
16
13
  withRejecter:(RCTPromiseRejectBlock)reject)
17
14
 
15
+ RCT_EXTERN_METHOD(setATTStatus:(NSInteger)status
16
+ withResolver:(RCTPromiseResolveBlock)resolve
17
+ withRejecter:(RCTPromiseRejectBlock)reject)
18
+
18
19
  // New methods
19
20
  RCT_EXTERN_METHOD(checkAndOpen:(BOOL)jumpToSettings
20
21
  withResolver:(RCTPromiseResolveBlock)resolve
@@ -38,53 +39,9 @@ RCT_EXTERN_METHOD(getStatusForVendor:(NSString *)vendorId
38
39
  RCT_EXTERN_METHOD(getGoogleConsentModeStatus:(RCTPromiseResolveBlock)resolve
39
40
  withRejecter:(RCTPromiseRejectBlock)reject)
40
41
 
41
- // Legacy methods
42
- RCT_EXTERN_METHOD(checkWithServerAndOpenIfNecessary:(RCTPromiseResolveBlock)resolve
43
- withRejecter:(RCTPromiseRejectBlock)reject)
44
-
45
- RCT_EXTERN_METHOD(openConsentLayer:(RCTPromiseResolveBlock)resolve
46
- withRejecter:(RCTPromiseRejectBlock)reject)
47
-
48
- RCT_EXTERN_METHOD(jumpToSettings:(RCTPromiseResolveBlock)resolve
49
- withRejecter:(RCTPromiseRejectBlock)reject)
50
-
51
- RCT_EXTERN_METHOD(checkIfConsentIsRequired:(RCTPromiseResolveBlock)resolve
52
- withRejecter:(RCTPromiseRejectBlock)reject)
53
-
54
- // Consent status methods
55
- RCT_EXTERN_METHOD(hasUserChoice:(RCTPromiseResolveBlock)resolve
56
- withRejecter:(RCTPromiseRejectBlock)reject)
57
-
58
- RCT_EXTERN_METHOD(hasPurposeConsent:(NSString *)purposeId
59
- withResolver:(RCTPromiseResolveBlock)resolve
60
- withRejecter:(RCTPromiseRejectBlock)reject)
61
-
62
- RCT_EXTERN_METHOD(hasVendorConsent:(NSString *)vendorId
63
- withResolver:(RCTPromiseResolveBlock)resolve
64
- withRejecter:(RCTPromiseRejectBlock)reject)
65
-
66
42
  RCT_EXTERN_METHOD(exportCMPInfo:(RCTPromiseResolveBlock)resolve
67
43
  withRejecter:(RCTPromiseRejectBlock)reject)
68
44
 
69
- // Purpose and vendor methods
70
- RCT_EXTERN_METHOD(getAllPurposesIDs:(RCTPromiseResolveBlock)resolve
71
- withRejecter:(RCTPromiseRejectBlock)reject)
72
-
73
- RCT_EXTERN_METHOD(getEnabledPurposesIDs:(RCTPromiseResolveBlock)resolve
74
- withRejecter:(RCTPromiseRejectBlock)reject)
75
-
76
- RCT_EXTERN_METHOD(getDisabledPurposesIDs:(RCTPromiseResolveBlock)resolve
77
- withRejecter:(RCTPromiseRejectBlock)reject)
78
-
79
- RCT_EXTERN_METHOD(getAllVendorsIDs:(RCTPromiseResolveBlock)resolve
80
- withRejecter:(RCTPromiseRejectBlock)reject)
81
-
82
- RCT_EXTERN_METHOD(getEnabledVendorsIDs:(RCTPromiseResolveBlock)resolve
83
- withRejecter:(RCTPromiseRejectBlock)reject)
84
-
85
- RCT_EXTERN_METHOD(getDisabledVendorsIDs:(RCTPromiseResolveBlock)resolve
86
- withRejecter:(RCTPromiseRejectBlock)reject)
87
-
88
45
  // Consent modification methods
89
46
  RCT_EXTERN_METHOD(acceptVendors:(NSArray *)vendors
90
47
  withResolver:(RCTPromiseResolveBlock)resolve
@@ -117,6 +74,10 @@ RCT_EXTERN_METHOD(importCMPInfo:(NSString *)cmpString
117
74
  RCT_EXTERN_METHOD(resetConsentManagementData:(RCTPromiseResolveBlock)resolve
118
75
  withRejecter:(RCTPromiseRejectBlock)reject)
119
76
 
77
+ // Event emitter support methods (required for TurboModule)
78
+ RCT_EXTERN_METHOD(addListener:(NSString *)eventName)
79
+ RCT_EXTERN_METHOD(removeListeners:(double)count)
80
+
120
81
  + (BOOL)requiresMainQueueSetup
121
82
  {
122
83
  return YES;
@@ -142,6 +142,12 @@ class CmSdkReactNativeV3: RCTEventEmitter, CMPManagerDelegate {
142
142
 
143
143
  // MARK: - New methods
144
144
 
145
+ @objc(setATTStatus:withResolver:withRejecter:)
146
+ func setATTStatus(_ status: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
147
+ cmpManager.setATTStatus(status.intValue)
148
+ resolve(nil)
149
+ }
150
+
145
151
  @objc(getUserStatus:withRejecter:)
146
152
  func getUserStatus(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
147
153
  do {
@@ -200,113 +206,12 @@ class CmSdkReactNativeV3: RCTEventEmitter, CMPManagerDelegate {
200
206
  }
201
207
  }
202
208
 
203
- // MARK: - Deprecated but maintained methods
204
-
205
- @objc(checkWithServerAndOpenIfNecessary:withRejecter:)
206
- func checkWithServerAndOpenIfNecessary(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
207
- DispatchQueue.main.async { [weak self] in
208
- guard let self = self else {
209
- reject("ERROR", "Bridge object deallocated", nil)
210
- return
211
- }
212
- self.cmpManager.checkWithServerAndOpenIfNecessary { success in
213
- resolve(success)
214
- }
215
- }
216
- }
217
-
218
- @objc(openConsentLayer:withRejecter:)
219
- func openConsentLayer(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
220
- DispatchQueue.main.async { [weak self] in
221
- guard let self = self else {
222
- reject("ERROR", "Bridge object deallocated", nil)
223
- return
224
- }
225
- self.cmpManager.openConsentLayer { success in
226
- resolve(success)
227
- }
228
- }
229
- }
230
-
231
- @objc(jumpToSettings:withRejecter:)
232
- func jumpToSettings(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
233
- DispatchQueue.main.async { [weak self] in
234
- guard let self = self else {
235
- reject("ERROR", "Bridge object deallocated", nil)
236
- return
237
- }
238
- self.cmpManager.jumpToSettings(completion: { success in resolve(success)})
239
- resolve(nil)
240
- }
241
- }
242
-
243
- @objc(checkIfConsentIsRequired:withRejecter:)
244
- func checkIfConsentIsRequired(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
245
- self.cmpManager.checkIfConsentIsRequired { success in
246
- resolve(success)
247
- }
248
- }
249
-
250
- @objc(hasUserChoice:withRejecter:)
251
- func hasUserChoice(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
252
- let result = self.cmpManager.hasUserChoice()
253
- resolve(result)
254
- }
255
-
256
- @objc(hasPurposeConsent:withResolver:withRejecter:)
257
- func hasPurposeConsent(_ purposeId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
258
- let result = self.cmpManager.hasPurposeConsent(id: purposeId)
259
- resolve(result)
260
- }
261
-
262
- @objc(hasVendorConsent:withResolver:withRejecter:)
263
- func hasVendorConsent(_ vendorId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
264
- let result = self.cmpManager.hasVendorConsent(id: vendorId)
265
- resolve(result)
266
- }
267
-
268
209
  @objc(exportCMPInfo:withRejecter:)
269
210
  func exportCMPInfo(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
270
211
  let info = self.cmpManager.exportCMPInfo()
271
212
  resolve(info)
272
213
  }
273
214
 
274
- @objc(getAllPurposesIDs:withRejecter:)
275
- func getAllPurposesIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
276
- let purposeIDs = self.cmpManager.getAllPurposesIDs()
277
- resolve(purposeIDs)
278
- }
279
-
280
- @objc(getEnabledPurposesIDs:withRejecter:)
281
- func getEnabledPurposesIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
282
- let purposeIDs = self.cmpManager.getEnabledPurposesIDs()
283
- resolve(purposeIDs)
284
- }
285
-
286
- @objc(getDisabledPurposesIDs:withRejecter:)
287
- func getDisabledPurposesIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
288
- let purposeIDs = self.cmpManager.getDisabledPurposesIDs()
289
- resolve(purposeIDs)
290
- }
291
-
292
- @objc(getAllVendorsIDs:withRejecter:)
293
- func getAllVendorsIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
294
- let vendorIDs = self.cmpManager.getAllVendorsIDs()
295
- resolve(vendorIDs)
296
- }
297
-
298
- @objc(getEnabledVendorsIDs:withRejecter:)
299
- func getEnabledVendorsIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
300
- let vendorIDs = self.cmpManager.getEnabledVendorsIDs()
301
- resolve(vendorIDs)
302
- }
303
-
304
- @objc(getDisabledVendorsIDs:withRejecter:)
305
- func getDisabledVendorsIDs(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
306
- let vendorIDs = self.cmpManager.getDisabledVendorsIDs()
307
- resolve(vendorIDs)
308
- }
309
-
310
215
  @objc(acceptVendors:withResolver:withRejecter:)
311
216
  func acceptVendors(_ vendors: [String], resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
312
217
  self.cmpManager.acceptVendors(vendors) { success in
@@ -374,3 +279,11 @@ class CmSdkReactNativeV3: RCTEventEmitter, CMPManagerDelegate {
374
279
  resolve(nil)
375
280
  }
376
281
  }
282
+
283
+ #if RCT_NEW_ARCH_ENABLED
284
+ import CmSdkReactNativeV3Spec
285
+
286
+ extension CmSdkReactNativeV3: NativeCmSdkReactNativeV3Spec {
287
+ // Protocol is automatically satisfied by @objc methods above
288
+ }
289
+ #endif
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ // Event payload types for better TypeScript support
9
+ // Additional type definitions for better TypeScript support
10
+ var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('CmSdkReactNativeV3');
11
+ //# sourceMappingURL=NativeCmSdkReactNativeV3.js.map