securiti-consent-sdk 1.141.0-12rc → 1.141.0-14rc

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.
Files changed (94) hide show
  1. package/NitroSecuritiConsentSdk.podspec +1 -1
  2. package/README.md +508 -2
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/com/margelo/nitro/securiticonsentsdk/HybridConsentSDK.kt +168 -34
  5. package/android/src/main/java/com/margelo/nitro/securiticonsentsdk/NullTypeCompat.kt +19 -0
  6. package/ios/HybridConsentSDK.swift +78 -32
  7. package/lib/ConsentSDK.nitro.d.ts +8 -0
  8. package/lib/ConsentSDK.nitro.js +6 -0
  9. package/lib/index.js +8 -1
  10. package/nitrogen/generated/.gitattributes +1 -1
  11. package/nitrogen/generated/android/NitroSecuritiConsentSdk+autolinking.cmake +10 -4
  12. package/nitrogen/generated/android/NitroSecuritiConsentSdkOnLoad.cpp +1 -3
  13. package/nitrogen/generated/android/c++/JAppPermission.hpp +5 -1
  14. package/nitrogen/generated/android/c++/JBannerConfig.hpp +5 -1
  15. package/nitrogen/generated/android/c++/JCmpSDKOptions.hpp +5 -1
  16. package/nitrogen/generated/android/c++/JCustomColors.hpp +5 -1
  17. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +2 -1
  18. package/nitrogen/generated/android/c++/JHybridConsentSDKSpec.cpp +55 -14
  19. package/nitrogen/generated/android/c++/JHybridConsentSDKSpec.hpp +7 -3
  20. package/nitrogen/generated/android/c++/JPermissionConsent.hpp +5 -1
  21. package/nitrogen/generated/android/c++/JPostConsentsRequest.hpp +9 -3
  22. package/nitrogen/generated/android/c++/JPurpose.hpp +7 -2
  23. package/nitrogen/generated/android/c++/JPurposeConsent.hpp +5 -1
  24. package/nitrogen/generated/android/c++/JSDK.hpp +7 -2
  25. package/nitrogen/generated/android/c++/JSettingsPrompt.hpp +7 -2
  26. package/nitrogen/generated/android/c++/JVariant_NullType_BannerConfig.cpp +26 -0
  27. package/nitrogen/generated/android/c++/JVariant_NullType_BannerConfig.hpp +76 -0
  28. package/nitrogen/generated/android/c++/JVariant_NullType_CmpSDKOptions.cpp +26 -0
  29. package/nitrogen/generated/android/c++/JVariant_NullType_CmpSDKOptions.hpp +73 -0
  30. package/nitrogen/generated/android/c++/JVariant_NullType_SettingsPrompt.cpp +26 -0
  31. package/nitrogen/generated/android/c++/JVariant_NullType_SettingsPrompt.hpp +74 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/AppPermission.kt +44 -16
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/BannerConfig.kt +113 -39
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/CmpSDKOptions.kt +50 -18
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/CustomColors.kt +41 -15
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/Func_void_bool.kt +1 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/HybridConsentSDKSpec.kt +16 -5
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/PermissionConsent.kt +24 -8
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/PostConsentsRequest.kt +53 -19
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/Purpose.kt +53 -19
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/PurposeConsent.kt +27 -9
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/SDK.kt +44 -16
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/SettingsPrompt.kt +30 -10
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/Variant_NullType_BannerConfig.kt +59 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/Variant_NullType_CmpSDKOptions.kt +59 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/securiticonsentsdk/Variant_NullType_SettingsPrompt.kt +59 -0
  47. package/nitrogen/generated/ios/NitroSecuritiConsentSdk-Swift-Cxx-Bridge.cpp +28 -19
  48. package/nitrogen/generated/ios/NitroSecuritiConsentSdk-Swift-Cxx-Bridge.hpp +313 -163
  49. package/nitrogen/generated/ios/NitroSecuritiConsentSdk-Swift-Cxx-Umbrella.hpp +4 -1
  50. package/nitrogen/generated/ios/NitroSecuritiConsentSdkAutolinking.mm +1 -1
  51. package/nitrogen/generated/ios/NitroSecuritiConsentSdkAutolinking.swift +2 -2
  52. package/nitrogen/generated/ios/c++/HybridConsentSDKSpecSwift.hpp +25 -10
  53. package/nitrogen/generated/ios/swift/AppPermission.swift +21 -7
  54. package/nitrogen/generated/ios/swift/BannerConfig.swift +111 -38
  55. package/nitrogen/generated/ios/swift/CmpSDKOptions.swift +9 -4
  56. package/nitrogen/generated/ios/swift/CustomColors.swift +17 -8
  57. package/nitrogen/generated/ios/swift/Func_void_bool.swift +6 -5
  58. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -0
  59. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -0
  60. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__std__string_.swift +55 -0
  61. package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__BannerConfig_.swift +59 -0
  62. package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__SettingsPrompt_.swift +59 -0
  63. package/nitrogen/generated/ios/swift/Func_void_std__vector_AppPermission_.swift +1 -0
  64. package/nitrogen/generated/ios/swift/Func_void_std__vector_Purpose_.swift +1 -0
  65. package/nitrogen/generated/ios/swift/Func_void_std__vector_SDK_.swift +1 -0
  66. package/nitrogen/generated/ios/swift/HybridConsentSDKSpec.swift +13 -4
  67. package/nitrogen/generated/ios/swift/HybridConsentSDKSpec_cxx.swift +85 -40
  68. package/nitrogen/generated/ios/swift/PermissionConsent.swift +1 -0
  69. package/nitrogen/generated/ios/swift/PostConsentsRequest.swift +5 -2
  70. package/nitrogen/generated/ios/swift/Purpose.swift +47 -11
  71. package/nitrogen/generated/ios/swift/PurposeConsent.swift +1 -0
  72. package/nitrogen/generated/ios/swift/SDK.swift +23 -8
  73. package/nitrogen/generated/ios/swift/SettingsPrompt.swift +11 -5
  74. package/nitrogen/generated/ios/swift/Variant_NullType_BannerConfig.swift +18 -0
  75. package/nitrogen/generated/ios/swift/Variant_NullType_CmpSDKOptions.swift +18 -0
  76. package/nitrogen/generated/ios/swift/Variant_NullType_SettingsPrompt.swift +18 -0
  77. package/nitrogen/generated/shared/c++/AppPermission.hpp +12 -6
  78. package/nitrogen/generated/shared/c++/BannerConfig.hpp +15 -9
  79. package/nitrogen/generated/shared/c++/CmpSDKOptions.hpp +12 -6
  80. package/nitrogen/generated/shared/c++/CustomColors.hpp +13 -7
  81. package/nitrogen/generated/shared/c++/HybridConsentSDKSpec.cpp +1 -0
  82. package/nitrogen/generated/shared/c++/HybridConsentSDKSpec.hpp +9 -6
  83. package/nitrogen/generated/shared/c++/PermissionConsent.hpp +12 -6
  84. package/nitrogen/generated/shared/c++/PostConsentsRequest.hpp +19 -13
  85. package/nitrogen/generated/shared/c++/Purpose.hpp +16 -10
  86. package/nitrogen/generated/shared/c++/PurposeConsent.hpp +12 -6
  87. package/nitrogen/generated/shared/c++/SDK.hpp +12 -6
  88. package/nitrogen/generated/shared/c++/SettingsPrompt.hpp +13 -7
  89. package/package.json +1 -1
  90. package/src/ConsentSDK.nitro.ts +11 -0
  91. package/src/index.ts +11 -0
  92. package/lib/index.d.ts +0 -20
  93. package/nitrogen/generated/ios/swift/Func_void_std__optional_BannerConfig_.swift +0 -52
  94. package/nitrogen/generated/ios/swift/Func_void_std__optional_SettingsPrompt_.swift +0 -52
@@ -32,6 +32,6 @@ Pod::Spec.new do |s|
32
32
 
33
33
  s.dependency 'React-jsi'
34
34
  s.dependency 'React-callinvoker'
35
- s.dependency 'ConsentUI', "1.141.0-12rc"
35
+ s.dependency 'ConsentUI', "1.141.0-14rc"
36
36
  install_modules_dependencies(s)
37
37
  end
package/README.md CHANGED
@@ -29,10 +29,12 @@ A React Native Library for managing user consent preferences and compliance with
29
29
  - [options()](#options)
30
30
  - [getSettingsPrompt()](#getsettingsprompt)
31
31
  - [uploadConsents(request)](#uploadconsentsrequest)
32
+ - [getGCMConsents()](#getgcmconsents)
32
33
  - [presentConsentBanner()](#presentconsentbanner)
33
34
  - [presentPreferenceCenter()](#presentpreferencecenter)
34
- 6. [Types and Properties](#types-and-properties)
35
- 7. [Using Methods](#using-methods)
35
+ 6. [Google Consent Mode Integration](#google-consent-mode-integration)
36
+ 7. [Types and Properties](#types-and-properties)
37
+ 8. [Using Methods](#using-methods)
36
38
 
37
39
  ---
38
40
 
@@ -554,6 +556,85 @@ uploadConsents(consentRequest)
554
556
 
555
557
  ---
556
558
 
559
+ ### getGCMConsents()
560
+
561
+ **Description:**
562
+ Retrieves Google Consent Mode (GCM) consent statuses for all configured Google consent types. This method is specifically designed for integration with Google services that require consent mode signals.
563
+
564
+ **Return Value:**
565
+ `Promise<GCMConsents>`
566
+
567
+ **GCMConsents Interface:**
568
+ A map of Google Consent Type strings to Consent Status strings.
569
+
570
+ **Google Consent Type Values:**
571
+ - `analytics_storage` - Controls consent for analytics cookies/storage
572
+ - `ad_storage` - Controls consent for advertising cookies/storage
573
+ - `ad_user_data` - Controls consent for sending user data to Google for advertising purposes
574
+ - `ad_personalization` - Controls consent for personalized advertising
575
+
576
+ **ConsentStatus Values:**
577
+ - `granted`
578
+ - `declined`
579
+ - `not_determined`
580
+ - `withdrawn`
581
+
582
+ **Example:**
583
+ ```js
584
+ import { getGCMConsents, GoogleConsentTypeValues } from 'securiti-consent-sdk';
585
+
586
+ getGCMConsents()
587
+ .then((gcmConsents) => {
588
+ console.log('Google Consent Mode Statuses:', gcmConsents);
589
+
590
+ // Check specific consent types
591
+ const analyticsConsent = gcmConsents[GoogleConsentTypeValues.ANALYTICS_STORAGE];
592
+ const adStorageConsent = gcmConsents[GoogleConsentTypeValues.AD_STORAGE];
593
+ const adUserDataConsent = gcmConsents[GoogleConsentTypeValues.AD_USER_DATA];
594
+ const adPersonalizationConsent = gcmConsents[GoogleConsentTypeValues.AD_PERSONALIZATION];
595
+
596
+ // Example output format:
597
+ // {
598
+ // "analytics_storage": "granted",
599
+ // "ad_storage": "declined",
600
+ // "ad_user_data": "granted",
601
+ // "ad_personalization": "declined"
602
+ // }
603
+ })
604
+ .catch((error) => {
605
+ console.error('Failed to get GCM consents:', error);
606
+ });
607
+ ```
608
+
609
+ **Integration with Google Analytics/Ads:**
610
+ ```js
611
+ import { getGCMConsents } from 'securiti-consent-sdk';
612
+
613
+ // Update Google Consent Mode based on user preferences
614
+ async function updateGoogleConsentMode() {
615
+ try {
616
+ const gcmConsents = await getGCMConsents();
617
+
618
+ // For Google Analytics 4 (gtag.js)
619
+ if (typeof gtag !== 'undefined') {
620
+ gtag('consent', 'update', {
621
+ 'analytics_storage': gcmConsents['analytics_storage'] === 'granted' ? 'granted' : 'denied',
622
+ 'ad_storage': gcmConsents['ad_storage'] === 'granted' ? 'granted' : 'denied',
623
+ 'ad_user_data': gcmConsents['ad_user_data'] === 'granted' ? 'granted' : 'denied',
624
+ 'ad_personalization': gcmConsents['ad_personalization'] === 'granted' ? 'granted' : 'denied'
625
+ });
626
+ }
627
+ } catch (error) {
628
+ console.error('Error updating Google Consent Mode:', error);
629
+ }
630
+ }
631
+
632
+ // Call after user makes consent choices
633
+ updateGoogleConsentMode();
634
+ ```
635
+
636
+ ---
637
+
557
638
  ### presentConsentBanner()
558
639
 
559
640
  **Description:**
@@ -594,6 +675,356 @@ presentPreferenceCenter();
594
675
 
595
676
  ---
596
677
 
678
+ ## Google Consent Mode Integration
679
+
680
+ Google Consent Mode is a framework that allows you to adjust how Google tags behave based on user consent choices. The Securiti Consent SDK provides seamless integration with Google Consent Mode through the `getGCMConsents()` method.
681
+
682
+ ### Overview
683
+
684
+ Google Consent Mode v2 requires mobile apps to signal user consent choices for four specific consent types:
685
+
686
+ 1. **analytics_storage** - Permission to store analytics data
687
+ 2. **ad_storage** - Permission to store advertising data
688
+ 3. **ad_user_data** - Permission to send user data to Google for advertising
689
+ 4. **ad_personalization** - Permission to use data for personalized ads
690
+
691
+ The SDK automatically maps your configured purposes to these Google consent types based on your Securiti platform configuration.
692
+
693
+ ### How It Works
694
+
695
+ 1. Configure purpose-to-Google-consent-type mappings in your Securiti platform
696
+ 2. Initialize the SDK in your React Native app
697
+ 3. Call `getGCMConsents()` to retrieve mapped consent statuses
698
+ 4. Pass the consent signals to Google Analytics or Google Ads SDKs
699
+
700
+ ### Configuration in Securiti Platform
701
+
702
+ Before using Google Consent Mode in your app, ensure you have configured the mappings in the Securiti Privacy Center:
703
+
704
+ 1. Navigate to your mobile app configuration
705
+ 2. Go to the Purposes section
706
+ 3. For each purpose, configure the Google Consent Mode mapping
707
+ 4. Select which Google consent type (analytics_storage, ad_storage, etc.) each purpose should map to
708
+
709
+ ### Basic Usage
710
+
711
+ ```js
712
+ import { getGCMConsents, GoogleConsentTypeValues } from 'securiti-consent-sdk';
713
+
714
+ async function checkGoogleConsents() {
715
+ try {
716
+ const gcmConsents = await getGCMConsents();
717
+
718
+ // gcmConsents is an object with consent statuses:
719
+ // {
720
+ // "analytics_storage": "granted",
721
+ // "ad_storage": "declined",
722
+ // "ad_user_data": "granted",
723
+ // "ad_personalization": "declined"
724
+ // }
725
+
726
+ return gcmConsents;
727
+ } catch (error) {
728
+ console.error('Error fetching GCM consents:', error);
729
+ return {};
730
+ }
731
+ }
732
+ ```
733
+
734
+ ### Integration with Firebase Analytics
735
+
736
+ If you're using Firebase Analytics with Google Analytics 4, you can integrate consent signals:
737
+
738
+ ```js
739
+ import analytics from '@react-native-firebase/analytics';
740
+ import { getGCMConsents } from 'securiti-consent-sdk';
741
+
742
+ async function updateFirebaseConsent() {
743
+ try {
744
+ const gcmConsents = await getGCMConsents();
745
+
746
+ // Set consent mode for Firebase Analytics
747
+ await analytics().setConsent({
748
+ analytics_storage: gcmConsents['analytics_storage'] === 'granted',
749
+ ad_storage: gcmConsents['ad_storage'] === 'granted',
750
+ ad_user_data: gcmConsents['ad_user_data'] === 'granted',
751
+ ad_personalization: gcmConsents['ad_personalization'] === 'granted'
752
+ });
753
+
754
+ console.log('Firebase consent updated successfully');
755
+ } catch (error) {
756
+ console.error('Error updating Firebase consent:', error);
757
+ }
758
+ }
759
+ ```
760
+
761
+ ### Integration with Google Mobile Ads SDK
762
+
763
+ For Google Mobile Ads (AdMob), you need to handle consent before initializing the ads:
764
+
765
+ **iOS (Swift/Objective-C bridge):**
766
+
767
+ ```js
768
+ import { NativeModules } from 'react-native';
769
+ import { getGCMConsents } from 'securiti-consent-sdk';
770
+
771
+ const { GoogleAdsConsentBridge } = NativeModules;
772
+
773
+ async function updateGoogleAdsConsent() {
774
+ try {
775
+ const gcmConsents = await getGCMConsents();
776
+
777
+ // Pass consent to native module
778
+ await GoogleAdsConsentBridge.updateConsent({
779
+ analytics_storage: gcmConsents['analytics_storage'],
780
+ ad_storage: gcmConsents['ad_storage'],
781
+ ad_user_data: gcmConsents['ad_user_data'],
782
+ ad_personalization: gcmConsents['ad_personalization']
783
+ });
784
+ } catch (error) {
785
+ console.error('Error updating Google Ads consent:', error);
786
+ }
787
+ }
788
+ ```
789
+
790
+ **Android (Kotlin bridge):**
791
+
792
+ ```js
793
+ import { NativeModules } from 'react-native';
794
+ import { getGCMConsents } from 'securiti-consent-sdk';
795
+
796
+ const { GoogleAdsConsentBridge } = NativeModules;
797
+
798
+ async function updateGoogleAdsConsent() {
799
+ try {
800
+ const gcmConsents = await getGCMConsents();
801
+
802
+ // Pass consent to native module
803
+ await GoogleAdsConsentBridge.updateConsent(gcmConsents);
804
+ } catch (error) {
805
+ console.error('Error updating Google Ads consent:', error);
806
+ }
807
+ }
808
+ ```
809
+
810
+ ### Real-World Example: Complete Integration
811
+
812
+ Here's a complete example showing how to integrate Google Consent Mode into your app:
813
+
814
+ ```jsx
815
+ import React, { useEffect, useState } from 'react';
816
+ import { View, Button, Alert } from 'react-native';
817
+ import {
818
+ initialize,
819
+ presentConsentBanner,
820
+ isReady,
821
+ getGCMConsents,
822
+ GoogleConsentTypeValues,
823
+ LoggerLevel
824
+ } from 'securiti-consent-sdk';
825
+ import analytics from '@react-native-firebase/analytics';
826
+
827
+ export default function ConsentManager() {
828
+ const [sdkReady, setSdkReady] = useState(false);
829
+ const [consentsApplied, setConsentsApplied] = useState(false);
830
+
831
+ useEffect(() => {
832
+ initializeConsentSDK();
833
+ }, []);
834
+
835
+ const initializeConsentSDK = () => {
836
+ // Initialize SDK
837
+ const options = {
838
+ appURL: 'YOUR_APP_URL',
839
+ cdnURL: 'YOUR_CDN_URL',
840
+ tenantID: 'YOUR_TENANT_ID',
841
+ appID: 'YOUR_APP_ID',
842
+ testingMode: false,
843
+ loggerLevel: LoggerLevel.INFO,
844
+ consentsCheckInterval: 3600,
845
+ languageCode: 'en',
846
+ locationCode: 'US'
847
+ };
848
+
849
+ initialize(options);
850
+
851
+ // Check when SDK is ready
852
+ isReady(async (ready) => {
853
+ if (ready) {
854
+ setSdkReady(ready);
855
+
856
+ // Apply Google Consent Mode
857
+ await applyGoogleConsentMode();
858
+
859
+ // Show consent banner if needed
860
+ presentConsentBanner();
861
+ }
862
+ });
863
+ };
864
+
865
+ const applyGoogleConsentMode = async () => {
866
+ try {
867
+ const gcmConsents = await getGCMConsents();
868
+
869
+ // Log consent statuses
870
+ console.log('Google Consent Mode statuses:', gcmConsents);
871
+
872
+ // Apply to Firebase Analytics
873
+ await analytics().setConsent({
874
+ analytics_storage: gcmConsents[GoogleConsentTypeValues.ANALYTICS_STORAGE] === 'granted',
875
+ ad_storage: gcmConsents[GoogleConsentTypeValues.AD_STORAGE] === 'granted',
876
+ ad_user_data: gcmConsents[GoogleConsentTypeValues.AD_USER_DATA] === 'granted',
877
+ ad_personalization: gcmConsents[GoogleConsentTypeValues.AD_PERSONALIZATION] === 'granted'
878
+ });
879
+
880
+ setConsentsApplied(true);
881
+ console.log('Google Consent Mode applied successfully');
882
+ } catch (error) {
883
+ console.error('Error applying Google Consent Mode:', error);
884
+ Alert.alert('Error', 'Failed to apply consent settings');
885
+ }
886
+ };
887
+
888
+ const refreshConsents = async () => {
889
+ if (!sdkReady) {
890
+ Alert.alert('SDK Not Ready', 'Please wait for the SDK to initialize');
891
+ return;
892
+ }
893
+
894
+ await applyGoogleConsentMode();
895
+ Alert.alert('Success', 'Consent settings refreshed');
896
+ };
897
+
898
+ const showConsentBanner = () => {
899
+ if (!sdkReady) {
900
+ Alert.alert('SDK Not Ready', 'Please wait for the SDK to initialize');
901
+ return;
902
+ }
903
+
904
+ presentConsentBanner();
905
+ };
906
+
907
+ return (
908
+ <View style={{ padding: 20 }}>
909
+ <Button
910
+ title="Show Consent Banner"
911
+ onPress={showConsentBanner}
912
+ disabled={!sdkReady}
913
+ />
914
+ <View style={{ marginTop: 10 }} />
915
+ <Button
916
+ title="Refresh Google Consent Mode"
917
+ onPress={refreshConsents}
918
+ disabled={!sdkReady}
919
+ />
920
+ </View>
921
+ );
922
+ }
923
+ ```
924
+
925
+ ### Listening to Consent Changes
926
+
927
+ You may want to refresh Google Consent Mode settings when users update their preferences:
928
+
929
+ ```js
930
+ import { useEffect } from 'react';
931
+ import { getGCMConsents } from 'securiti-consent-sdk';
932
+ import analytics from '@react-native-firebase/analytics';
933
+
934
+ function useConsentSync() {
935
+ useEffect(() => {
936
+ // Sync consents periodically or after preference center closes
937
+ const syncInterval = setInterval(async () => {
938
+ try {
939
+ const gcmConsents = await getGCMConsents();
940
+
941
+ await analytics().setConsent({
942
+ analytics_storage: gcmConsents['analytics_storage'] === 'granted',
943
+ ad_storage: gcmConsents['ad_storage'] === 'granted',
944
+ ad_user_data: gcmConsents['ad_user_data'] === 'granted',
945
+ ad_personalization: gcmConsents['ad_personalization'] === 'granted'
946
+ });
947
+ } catch (error) {
948
+ console.error('Error syncing consents:', error);
949
+ }
950
+ }, 60000); // Check every minute
951
+
952
+ return () => clearInterval(syncInterval);
953
+ }, []);
954
+ }
955
+ ```
956
+
957
+ ### Testing Google Consent Mode
958
+
959
+ To verify your integration is working correctly:
960
+
961
+ 1. **Enable Debug Logging:**
962
+ ```js
963
+ const options = {
964
+ // ... other options
965
+ loggerLevel: LoggerLevel.DEBUG,
966
+ testingMode: true
967
+ };
968
+ ```
969
+
970
+ 2. **Check Console Output:**
971
+ Look for log messages showing the consent statuses being retrieved and applied.
972
+
973
+ 3. **Use Google Analytics DebugView:**
974
+ - Enable debug mode in Firebase Analytics
975
+ - Check that consent signals are being sent correctly
976
+ - Verify events are being processed according to consent choices
977
+
978
+ 4. **Verify Consent Updates:**
979
+ ```js
980
+ async function verifyConsents() {
981
+ const gcmConsents = await getGCMConsents();
982
+ console.log('Current GCM Consents:', JSON.stringify(gcmConsents, null, 2));
983
+
984
+ // Expected output:
985
+ // {
986
+ // "analytics_storage": "granted",
987
+ // "ad_storage": "declined",
988
+ // "ad_user_data": "granted",
989
+ // "ad_personalization": "declined"
990
+ // }
991
+ }
992
+ ```
993
+
994
+ ### Best Practices
995
+
996
+ 1. **Initialize Early:** Call `initialize()` as early as possible in your app lifecycle
997
+ 2. **Apply Before Tracking:** Update Google Consent Mode before sending any analytics events
998
+ 3. **Handle Errors:** Always wrap consent calls in try-catch blocks
999
+ 4. **Sync After Updates:** Refresh consent signals after users update preferences
1000
+ 5. **Test Thoroughly:** Test with different consent combinations to ensure proper behavior
1001
+ 6. **Check SDK Ready:** Always verify the SDK is ready before calling `getGCMConsents()`
1002
+
1003
+ ### Troubleshooting
1004
+
1005
+ **Issue: getGCMConsents() returns empty object**
1006
+ - Ensure SDK is initialized and ready
1007
+ - Verify purpose-to-GCM mappings are configured in Securiti platform
1008
+ - Check that purposes have been loaded successfully
1009
+
1010
+ **Issue: Consent signals not applied to Google services**
1011
+ - Verify you're calling the correct Google SDK consent methods
1012
+ - Check that consent updates happen before any tracking calls
1013
+ - Ensure proper integration with Firebase/Google Ads SDKs
1014
+
1015
+ **Issue: Consent statuses not updating**
1016
+ - Call `getGCMConsents()` after user makes consent changes
1017
+ - Verify the SDK is returning updated values
1018
+ - Check for any errors in console logs
1019
+
1020
+ ### Additional Resources
1021
+
1022
+ - [Google Consent Mode Documentation](https://developers.google.com/tag-platform/security/concepts/consent-mode)
1023
+ - [Firebase Analytics Consent](https://firebase.google.com/docs/analytics/configure-data-collection?platform=ios)
1024
+ - [Google Mobile Ads Consent](https://developers.google.com/admob/ump/android/quick-start)
1025
+
1026
+ ---
1027
+
597
1028
  ## Types and Properties
598
1029
 
599
1030
  ### ConsentStatus Values
@@ -671,6 +1102,49 @@ See [getSdksInPurpose(purposeId)](#getsdksinpurposepurposeid).
671
1102
  | sdkVersion | string | No | SDK version |
672
1103
  | platform | string | No | Platform information |
673
1104
 
1105
+ ### GoogleConsentType
1106
+
1107
+ Google Consent Mode consent type identifiers:
1108
+
1109
+ | Constant | Value | Description |
1110
+ |--------------------------|----------------------|--------------------------------------------------|
1111
+ | ANALYTICS_STORAGE | analytics_storage | Controls consent for analytics cookies/storage |
1112
+ | AD_STORAGE | ad_storage | Controls consent for advertising cookies/storage |
1113
+ | AD_USER_DATA | ad_user_data | Controls consent for sending user data to Google |
1114
+ | AD_PERSONALIZATION | ad_personalization | Controls consent for personalized advertising |
1115
+
1116
+ **Usage:**
1117
+ ```js
1118
+ import { GoogleConsentTypeValues } from 'securiti-consent-sdk';
1119
+
1120
+ // Access consent type constants
1121
+ const analyticsType = GoogleConsentTypeValues.ANALYTICS_STORAGE; // "analytics_storage"
1122
+ const adStorageType = GoogleConsentTypeValues.AD_STORAGE; // "ad_storage"
1123
+ const adUserDataType = GoogleConsentTypeValues.AD_USER_DATA; // "ad_user_data"
1124
+ const adPersonalizationType = GoogleConsentTypeValues.AD_PERSONALIZATION; // "ad_personalization"
1125
+ ```
1126
+
1127
+ ### GCMConsents
1128
+
1129
+ The response type from `getGCMConsents()` - a map of Google Consent Type strings to Consent Status strings.
1130
+
1131
+ **Interface:**
1132
+ ```typescript
1133
+ interface GCMConsents {
1134
+ [consentType: string]: ConsentStatus
1135
+ }
1136
+ ```
1137
+
1138
+ **Example:**
1139
+ ```js
1140
+ {
1141
+ "analytics_storage": "granted",
1142
+ "ad_storage": "declined",
1143
+ "ad_user_data": "granted",
1144
+ "ad_personalization": "declined"
1145
+ }
1146
+ ```
1147
+
674
1148
  ---
675
1149
 
676
1150
  ## Using Methods
@@ -708,9 +1182,11 @@ import {
708
1182
  setPermissionConsent,
709
1183
  getBannerConfig,
710
1184
  getSettingsPrompt,
1185
+ getGCMConsents,
711
1186
  options,
712
1187
  LoggerLevel,
713
1188
  ConsentStatusValues,
1189
+ GoogleConsentTypeValues,
714
1190
  } from 'securiti-consent-sdk';
715
1191
 
716
1192
  // For types
@@ -965,6 +1441,29 @@ export default function App() {
965
1441
  }
966
1442
  };
967
1443
 
1444
+ const handleGetGCMConsents = async () => {
1445
+ setResponse(null);
1446
+ setIsLoading(true);
1447
+ try {
1448
+ const gcmConsents = await getGCMConsents();
1449
+ setResponse({
1450
+ gcmConsents: gcmConsents,
1451
+ timestamp: new Date().toISOString(),
1452
+ details: {
1453
+ analytics_storage: gcmConsents[GoogleConsentTypeValues.ANALYTICS_STORAGE],
1454
+ ad_storage: gcmConsents[GoogleConsentTypeValues.AD_STORAGE],
1455
+ ad_user_data: gcmConsents[GoogleConsentTypeValues.AD_USER_DATA],
1456
+ ad_personalization: gcmConsents[GoogleConsentTypeValues.AD_PERSONALIZATION]
1457
+ }
1458
+ });
1459
+ } catch (error) {
1460
+ console.error('Error getting GCM consents:', error);
1461
+ setResponse({ error: 'Failed to get GCM consents: ' + error });
1462
+ } finally {
1463
+ setIsLoading(false);
1464
+ }
1465
+ };
1466
+
968
1467
  const handleGetConsentForPurpose = async (purposeId: number) => {
969
1468
  setResponse(null);
970
1469
  setIsLoading(true);
@@ -1188,6 +1687,13 @@ export default function App() {
1188
1687
  >
1189
1688
  <Text style={styles.buttonText}>SDK Options</Text>
1190
1689
  </TouchableOpacity>
1690
+
1691
+ <TouchableOpacity
1692
+ style={[styles.button, styles.secondaryButton]}
1693
+ onPress={handleGetGCMConsents}
1694
+ >
1695
+ <Text style={styles.buttonText}>GCM Consents</Text>
1696
+ </TouchableOpacity>
1191
1697
  </View>
1192
1698
  </View>
1193
1699
 
@@ -126,7 +126,7 @@ repositories {
126
126
  mavenCentral()
127
127
  google()
128
128
  maven {
129
- url = uri("https://cdn-prod.securiti.ai/consent/maven")
129
+ url = uri("https://cdn-dev-intg-2.securiti.xyz/consent/maven")
130
130
  }
131
131
  }
132
132
 
@@ -138,7 +138,7 @@ dependencies {
138
138
  implementation "com.facebook.react:react-native:+"
139
139
 
140
140
 
141
- implementation 'ai.securiti.cmpsdkcore:consent-sdk:1.139.0'
141
+ implementation 'ai.securiti.cmpsdkcore:consent-sdk:1.140.0'
142
142
 
143
143
  // Add a dependency on NitroModules
144
144
  implementation project(":react-native-nitro-modules")