securiti-consent-sdk 1.141.0-1rc → 1.141.0-21rc

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
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -42,20 +47,18 @@ namespace margelo::nitro::securiticonsentsdk {
42
47
 
43
48
  namespace margelo::nitro {
44
49
 
45
- using namespace margelo::nitro::securiticonsentsdk;
46
-
47
50
  // C++ PermissionConsent <> JS PermissionConsent (object)
48
51
  template <>
49
- struct JSIConverter<PermissionConsent> final {
50
- static inline PermissionConsent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::PermissionConsent> final {
53
+ static inline margelo::nitro::securiticonsentsdk::PermissionConsent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
51
54
  jsi::Object obj = arg.asObject(runtime);
52
- return PermissionConsent(
55
+ return margelo::nitro::securiticonsentsdk::PermissionConsent(
53
56
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "permission")),
54
57
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "consentStatus")),
55
58
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timestamp"))
56
59
  );
57
60
  }
58
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const PermissionConsent& arg) {
61
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::PermissionConsent& arg) {
59
62
  jsi::Object obj(runtime);
60
63
  obj.setProperty(runtime, "permission", JSIConverter<std::string>::toJSI(runtime, arg.permission));
61
64
  obj.setProperty(runtime, "consentStatus", JSIConverter<std::string>::toJSI(runtime, arg.consentStatus));
@@ -67,6 +70,9 @@ namespace margelo::nitro {
67
70
  return false;
68
71
  }
69
72
  jsi::Object obj = value.getObject(runtime);
73
+ if (!nitro::isPlainObject(runtime, obj)) {
74
+ return false;
75
+ }
70
76
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "permission"))) return false;
71
77
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "consentStatus"))) return false;
72
78
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timestamp"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
  // Forward declaration of `PurposeConsent` to properly resolve imports.
22
27
  namespace margelo::nitro::securiticonsentsdk { struct PurposeConsent; }
@@ -24,8 +29,8 @@ namespace margelo::nitro::securiticonsentsdk { struct PurposeConsent; }
24
29
  namespace margelo::nitro::securiticonsentsdk { struct PermissionConsent; }
25
30
 
26
31
  #include <string>
27
- #include <vector>
28
32
  #include "PurposeConsent.hpp"
33
+ #include <vector>
29
34
  #include "PermissionConsent.hpp"
30
35
  #include <optional>
31
36
 
@@ -58,21 +63,19 @@ namespace margelo::nitro::securiticonsentsdk {
58
63
 
59
64
  namespace margelo::nitro {
60
65
 
61
- using namespace margelo::nitro::securiticonsentsdk;
62
-
63
66
  // C++ PostConsentsRequest <> JS PostConsentsRequest (object)
64
67
  template <>
65
- struct JSIConverter<PostConsentsRequest> final {
66
- static inline PostConsentsRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
68
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::PostConsentsRequest> final {
69
+ static inline margelo::nitro::securiticonsentsdk::PostConsentsRequest fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
67
70
  jsi::Object obj = arg.asObject(runtime);
68
- return PostConsentsRequest(
71
+ return margelo::nitro::securiticonsentsdk::PostConsentsRequest(
69
72
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
70
73
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "appUUID")),
71
74
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "device")),
72
75
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "implicitConsent")),
73
76
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "version")),
74
- JSIConverter<std::vector<PurposeConsent>>::fromJSI(runtime, obj.getProperty(runtime, "purposeConsents")),
75
- JSIConverter<std::vector<PermissionConsent>>::fromJSI(runtime, obj.getProperty(runtime, "permissions")),
77
+ JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PurposeConsent>>::fromJSI(runtime, obj.getProperty(runtime, "purposeConsents")),
78
+ JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PermissionConsent>>::fromJSI(runtime, obj.getProperty(runtime, "permissions")),
76
79
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isTestMode")),
77
80
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "adId")),
78
81
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "bannerInfo")),
@@ -80,15 +83,15 @@ namespace margelo::nitro {
80
83
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "platform"))
81
84
  );
82
85
  }
83
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const PostConsentsRequest& arg) {
86
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::PostConsentsRequest& arg) {
84
87
  jsi::Object obj(runtime);
85
88
  obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
86
89
  obj.setProperty(runtime, "appUUID", JSIConverter<std::string>::toJSI(runtime, arg.appUUID));
87
90
  obj.setProperty(runtime, "device", JSIConverter<std::string>::toJSI(runtime, arg.device));
88
91
  obj.setProperty(runtime, "implicitConsent", JSIConverter<bool>::toJSI(runtime, arg.implicitConsent));
89
92
  obj.setProperty(runtime, "version", JSIConverter<double>::toJSI(runtime, arg.version));
90
- obj.setProperty(runtime, "purposeConsents", JSIConverter<std::vector<PurposeConsent>>::toJSI(runtime, arg.purposeConsents));
91
- obj.setProperty(runtime, "permissions", JSIConverter<std::vector<PermissionConsent>>::toJSI(runtime, arg.permissions));
93
+ obj.setProperty(runtime, "purposeConsents", JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PurposeConsent>>::toJSI(runtime, arg.purposeConsents));
94
+ obj.setProperty(runtime, "permissions", JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PermissionConsent>>::toJSI(runtime, arg.permissions));
92
95
  obj.setProperty(runtime, "isTestMode", JSIConverter<bool>::toJSI(runtime, arg.isTestMode));
93
96
  obj.setProperty(runtime, "adId", JSIConverter<std::string>::toJSI(runtime, arg.adId));
94
97
  obj.setProperty(runtime, "bannerInfo", JSIConverter<std::string>::toJSI(runtime, arg.bannerInfo));
@@ -101,13 +104,16 @@ namespace margelo::nitro {
101
104
  return false;
102
105
  }
103
106
  jsi::Object obj = value.getObject(runtime);
107
+ if (!nitro::isPlainObject(runtime, obj)) {
108
+ return false;
109
+ }
104
110
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
105
111
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "appUUID"))) return false;
106
112
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
107
113
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "implicitConsent"))) return false;
108
114
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "version"))) return false;
109
- if (!JSIConverter<std::vector<PurposeConsent>>::canConvert(runtime, obj.getProperty(runtime, "purposeConsents"))) return false;
110
- if (!JSIConverter<std::vector<PermissionConsent>>::canConvert(runtime, obj.getProperty(runtime, "permissions"))) return false;
115
+ if (!JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PurposeConsent>>::canConvert(runtime, obj.getProperty(runtime, "purposeConsents"))) return false;
116
+ if (!JSIConverter<std::vector<margelo::nitro::securiticonsentsdk::PermissionConsent>>::canConvert(runtime, obj.getProperty(runtime, "permissions"))) return false;
111
117
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isTestMode"))) return false;
112
118
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "adId"))) return false;
113
119
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "bannerInfo"))) return false;
@@ -17,14 +17,19 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
  // Forward declaration of `SDK` to properly resolve imports.
22
27
  namespace margelo::nitro::securiticonsentsdk { struct SDK; }
23
28
 
24
29
  #include <optional>
25
30
  #include <string>
26
- #include <vector>
27
31
  #include "SDK.hpp"
32
+ #include <vector>
28
33
 
29
34
  namespace margelo::nitro::securiticonsentsdk {
30
35
 
@@ -55,18 +60,16 @@ namespace margelo::nitro::securiticonsentsdk {
55
60
 
56
61
  namespace margelo::nitro {
57
62
 
58
- using namespace margelo::nitro::securiticonsentsdk;
59
-
60
63
  // C++ Purpose <> JS Purpose (object)
61
64
  template <>
62
- struct JSIConverter<Purpose> final {
63
- static inline Purpose fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::Purpose> final {
66
+ static inline margelo::nitro::securiticonsentsdk::Purpose fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
67
  jsi::Object obj = arg.asObject(runtime);
65
- return Purpose(
68
+ return margelo::nitro::securiticonsentsdk::Purpose(
66
69
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "purposeId")),
67
70
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purposeName")),
68
71
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "purposeDescription")),
69
- JSIConverter<std::optional<std::vector<SDK>>>::fromJSI(runtime, obj.getProperty(runtime, "sdks")),
72
+ JSIConverter<std::optional<std::vector<margelo::nitro::securiticonsentsdk::SDK>>>::fromJSI(runtime, obj.getProperty(runtime, "sdks")),
70
73
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "consentStatus")),
71
74
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "disableOptOut")),
72
75
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "optOutText")),
@@ -77,12 +80,12 @@ namespace margelo::nitro {
77
80
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "attDescription"))
78
81
  );
79
82
  }
80
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const Purpose& arg) {
83
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::Purpose& arg) {
81
84
  jsi::Object obj(runtime);
82
85
  obj.setProperty(runtime, "purposeId", JSIConverter<std::optional<double>>::toJSI(runtime, arg.purposeId));
83
86
  obj.setProperty(runtime, "purposeName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purposeName));
84
87
  obj.setProperty(runtime, "purposeDescription", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.purposeDescription));
85
- obj.setProperty(runtime, "sdks", JSIConverter<std::optional<std::vector<SDK>>>::toJSI(runtime, arg.sdks));
88
+ obj.setProperty(runtime, "sdks", JSIConverter<std::optional<std::vector<margelo::nitro::securiticonsentsdk::SDK>>>::toJSI(runtime, arg.sdks));
86
89
  obj.setProperty(runtime, "consentStatus", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.consentStatus));
87
90
  obj.setProperty(runtime, "disableOptOut", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.disableOptOut));
88
91
  obj.setProperty(runtime, "optOutText", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.optOutText));
@@ -98,10 +101,13 @@ namespace margelo::nitro {
98
101
  return false;
99
102
  }
100
103
  jsi::Object obj = value.getObject(runtime);
104
+ if (!nitro::isPlainObject(runtime, obj)) {
105
+ return false;
106
+ }
101
107
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "purposeId"))) return false;
102
108
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purposeName"))) return false;
103
109
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "purposeDescription"))) return false;
104
- if (!JSIConverter<std::optional<std::vector<SDK>>>::canConvert(runtime, obj.getProperty(runtime, "sdks"))) return false;
110
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::securiticonsentsdk::SDK>>>::canConvert(runtime, obj.getProperty(runtime, "sdks"))) return false;
105
111
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "consentStatus"))) return false;
106
112
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "disableOptOut"))) return false;
107
113
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "optOutText"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -43,21 +48,19 @@ namespace margelo::nitro::securiticonsentsdk {
43
48
 
44
49
  namespace margelo::nitro {
45
50
 
46
- using namespace margelo::nitro::securiticonsentsdk;
47
-
48
51
  // C++ PurposeConsent <> JS PurposeConsent (object)
49
52
  template <>
50
- struct JSIConverter<PurposeConsent> final {
51
- static inline PurposeConsent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::PurposeConsent> final {
54
+ static inline margelo::nitro::securiticonsentsdk::PurposeConsent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
55
  jsi::Object obj = arg.asObject(runtime);
53
- return PurposeConsent(
56
+ return margelo::nitro::securiticonsentsdk::PurposeConsent(
54
57
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "purposeID")),
55
58
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "consentStatus")),
56
59
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timestamp")),
57
60
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isEssential"))
58
61
  );
59
62
  }
60
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const PurposeConsent& arg) {
63
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::PurposeConsent& arg) {
61
64
  jsi::Object obj(runtime);
62
65
  obj.setProperty(runtime, "purposeID", JSIConverter<double>::toJSI(runtime, arg.purposeID));
63
66
  obj.setProperty(runtime, "consentStatus", JSIConverter<std::string>::toJSI(runtime, arg.consentStatus));
@@ -70,6 +73,9 @@ namespace margelo::nitro {
70
73
  return false;
71
74
  }
72
75
  jsi::Object obj = value.getObject(runtime);
76
+ if (!nitro::isPlainObject(runtime, obj)) {
77
+ return false;
78
+ }
73
79
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "purposeID"))) return false;
74
80
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "consentStatus"))) return false;
75
81
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timestamp"))) return false;
@@ -17,6 +17,11 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
@@ -50,14 +55,12 @@ namespace margelo::nitro::securiticonsentsdk {
50
55
 
51
56
  namespace margelo::nitro {
52
57
 
53
- using namespace margelo::nitro::securiticonsentsdk;
54
-
55
58
  // C++ SDK <> JS SDK (object)
56
59
  template <>
57
- struct JSIConverter<SDK> final {
58
- static inline SDK fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
60
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::SDK> final {
61
+ static inline margelo::nitro::securiticonsentsdk::SDK fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
59
62
  jsi::Object obj = arg.asObject(runtime);
60
- return SDK(
63
+ return margelo::nitro::securiticonsentsdk::SDK(
61
64
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "sdkId")),
62
65
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "namespaceId")),
63
66
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "sdkName")),
@@ -69,7 +72,7 @@ namespace margelo::nitro {
69
72
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "collectingData"))
70
73
  );
71
74
  }
72
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const SDK& arg) {
75
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::SDK& arg) {
73
76
  jsi::Object obj(runtime);
74
77
  obj.setProperty(runtime, "sdkId", JSIConverter<std::optional<double>>::toJSI(runtime, arg.sdkId));
75
78
  obj.setProperty(runtime, "namespaceId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.namespaceId));
@@ -87,6 +90,9 @@ namespace margelo::nitro {
87
90
  return false;
88
91
  }
89
92
  jsi::Object obj = value.getObject(runtime);
93
+ if (!nitro::isPlainObject(runtime, obj)) {
94
+ return false;
95
+ }
90
96
  if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "sdkId"))) return false;
91
97
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "namespaceId"))) return false;
92
98
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "sdkName"))) return false;
@@ -17,11 +17,16 @@
17
17
  #else
18
18
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
19
  #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
20
25
 
21
26
 
22
27
 
23
- #include <optional>
24
28
  #include <string>
29
+ #include <optional>
25
30
  #include <vector>
26
31
 
27
32
  namespace margelo::nitro::securiticonsentsdk {
@@ -46,14 +51,12 @@ namespace margelo::nitro::securiticonsentsdk {
46
51
 
47
52
  namespace margelo::nitro {
48
53
 
49
- using namespace margelo::nitro::securiticonsentsdk;
50
-
51
54
  // C++ SettingsPrompt <> JS SettingsPrompt (object)
52
55
  template <>
53
- struct JSIConverter<SettingsPrompt> final {
54
- static inline SettingsPrompt fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
56
+ struct JSIConverter<margelo::nitro::securiticonsentsdk::SettingsPrompt> final {
57
+ static inline margelo::nitro::securiticonsentsdk::SettingsPrompt fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
58
  jsi::Object obj = arg.asObject(runtime);
56
- return SettingsPrompt(
59
+ return margelo::nitro::securiticonsentsdk::SettingsPrompt(
57
60
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "promptHeading")),
58
61
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "promptMessage")),
59
62
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "settingsButtonText")),
@@ -61,7 +64,7 @@ namespace margelo::nitro {
61
64
  JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, "permissions"))
62
65
  );
63
66
  }
64
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const SettingsPrompt& arg) {
67
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::securiticonsentsdk::SettingsPrompt& arg) {
65
68
  jsi::Object obj(runtime);
66
69
  obj.setProperty(runtime, "promptHeading", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.promptHeading));
67
70
  obj.setProperty(runtime, "promptMessage", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.promptMessage));
@@ -75,6 +78,9 @@ namespace margelo::nitro {
75
78
  return false;
76
79
  }
77
80
  jsi::Object obj = value.getObject(runtime);
81
+ if (!nitro::isPlainObject(runtime, obj)) {
82
+ return false;
83
+ }
78
84
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "promptHeading"))) return false;
79
85
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "promptMessage"))) return false;
80
86
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "settingsButtonText"))) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securiti-consent-sdk",
3
- "version": "1.141.0-1rc",
3
+ "version": "1.141.0-21rc",
4
4
  "description": "A React Native Library for managing user consent preferences and compliance with privacy regulations. Integrates with Securiti's Consent Management Platform.",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -205,6 +205,16 @@ export interface PermissionObject {
205
205
  permissionId: string
206
206
  }
207
207
 
208
+ // Google Consent Mode (GCM) consent types
209
+ export type GoogleConsentType = string
210
+
211
+ export const GoogleConsentTypeValues = {
212
+ ANALYTICS_STORAGE: 'analytics_storage' as GoogleConsentType,
213
+ AD_STORAGE: 'ad_storage' as GoogleConsentType,
214
+ AD_USER_DATA: 'ad_user_data' as GoogleConsentType,
215
+ AD_PERSONALIZATION: 'ad_personalization' as GoogleConsentType,
216
+ }
217
+
208
218
  export interface ConsentSDK
209
219
  extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
210
220
  // Core methods
@@ -223,6 +233,7 @@ export interface ConsentSDK
223
233
  getSdksInPurpose(purposeId: number): Promise<Array<SDK>>
224
234
  setPurposeConsent(purpose: Purpose, consent: string): boolean
225
235
  setPermissionConsent(permission: AppPermission, consent: string): boolean
236
+ getGCMConsents(): Promise<Record<string, string>>
226
237
 
227
238
  // Configuration
228
239
  getBannerConfig(): Promise<BannerConfig | null>
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ import type {
19
19
  Mode,
20
20
  PurposeObject,
21
21
  PermissionObject,
22
+ GoogleConsentType,
22
23
  } from './ConsentSDK.nitro'
23
24
 
24
25
  // Export all types and constants
@@ -41,6 +42,7 @@ export type {
41
42
  Mode,
42
43
  PurposeObject,
43
44
  PermissionObject,
45
+ GoogleConsentType,
44
46
  }
45
47
 
46
48
  export {
@@ -50,6 +52,7 @@ export {
50
52
  ComplianceTypeValues,
51
53
  BannerPositionValues,
52
54
  ButtonShapeValues,
55
+ GoogleConsentTypeValues,
53
56
  } from './ConsentSDK.nitro'
54
57
 
55
58
  // Create the hybrid object
@@ -131,3 +134,11 @@ export function getSettingsPrompt(): Promise<SettingsPrompt | null> {
131
134
  export function uploadConsents(request: PostConsentsRequest): Promise<boolean> {
132
135
  return ConsentSDKHybridObject.uploadConsents(request)
133
136
  }
137
+
138
+ /**
139
+ * Get Google Consent Mode (GCM) consents
140
+ * Returns a map of Google Consent Type to Consent Status
141
+ */
142
+ export function getGCMConsents(): Promise<Record<string, string>> {
143
+ return ConsentSDKHybridObject.getGCMConsents()
144
+ }
package/lib/index.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { CmpSDKLoggerLevel, CmpSDKOptions, ConsentStatus, Purpose, AppPermission, SDK, BannerConfig, SettingsPrompt, PostConsentsRequest, ComplianceType, BannerPosition, ButtonShape, CustomColors, PurposeConsent, PermissionConsent, Mode, PurposeObject, PermissionObject } from './ConsentSDK.nitro';
2
- export type { CmpSDKLoggerLevel, CmpSDKOptions, ConsentStatus, Purpose, AppPermission, SDK, BannerConfig, SettingsPrompt, PostConsentsRequest, ComplianceType, BannerPosition, ButtonShape, CustomColors, PurposeConsent, PermissionConsent, Mode, PurposeObject, PermissionObject, };
3
- export { LoggerLevel, ModeValues, ConsentStatusValues, ComplianceTypeValues, BannerPositionValues, ButtonShapeValues, } from './ConsentSDK.nitro';
4
- export declare function initialize(sdkOptions: CmpSDKOptions): void;
5
- export declare function presentConsentBanner(): void;
6
- export declare function presentPreferenceCenter(): void;
7
- export declare function isSdkReady(): boolean;
8
- export declare function isReady(callback: (isReady: boolean) => void): void;
9
- export declare function resetConsents(): void;
10
- export declare function getConsentByPurposeId(purposeId: number): Promise<string>;
11
- export declare function getConsentByPermissionId(permissionId: string): Promise<string>;
12
- export declare function getPermissions(): Promise<Array<AppPermission>>;
13
- export declare function getPurposes(): Promise<Array<Purpose>>;
14
- export declare function getSdksInPurpose(purposeId: number): Promise<Array<SDK>>;
15
- export declare function setPurposeConsent(purpose: Purpose, consent: string): boolean;
16
- export declare function setPermissionConsent(permission: AppPermission, consent: string): boolean;
17
- export declare function getBannerConfig(): Promise<BannerConfig | null>;
18
- export declare function options(): CmpSDKOptions | null;
19
- export declare function getSettingsPrompt(): Promise<SettingsPrompt | null>;
20
- export declare function uploadConsents(request: PostConsentsRequest): Promise<boolean>;
@@ -1,52 +0,0 @@
1
- ///
2
- /// Func_void_std__optional_BannerConfig_.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * Wraps a Swift `(_ value: BannerConfig?) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
14
- public final class Func_void_std__optional_BannerConfig_ {
15
- public typealias bridge = margelo.nitro.securiticonsentsdk.bridge.swift
16
-
17
- private let closure: (_ value: BannerConfig?) -> Void
18
-
19
- public init(_ closure: @escaping (_ value: BannerConfig?) -> Void) {
20
- self.closure = closure
21
- }
22
-
23
- @inline(__always)
24
- public func call(value: bridge.std__optional_BannerConfig_) -> Void {
25
- self.closure({ () -> BannerConfig? in
26
- if let __unwrapped = value.value {
27
- return __unwrapped
28
- } else {
29
- return nil
30
- }
31
- }())
32
- }
33
-
34
- /**
35
- * Casts this instance to a retained unsafe raw pointer.
36
- * This acquires one additional strong reference on the object!
37
- */
38
- @inline(__always)
39
- public func toUnsafe() -> UnsafeMutableRawPointer {
40
- return Unmanaged.passRetained(self).toOpaque()
41
- }
42
-
43
- /**
44
- * Casts an unsafe pointer to a `Func_void_std__optional_BannerConfig_`.
45
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_BannerConfig_>`.
46
- * This removes one strong reference from the object!
47
- */
48
- @inline(__always)
49
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_BannerConfig_ {
50
- return Unmanaged<Func_void_std__optional_BannerConfig_>.fromOpaque(pointer).takeRetainedValue()
51
- }
52
- }
@@ -1,52 +0,0 @@
1
- ///
2
- /// Func_void_std__optional_SettingsPrompt_.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * Wraps a Swift `(_ value: SettingsPrompt?) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
14
- public final class Func_void_std__optional_SettingsPrompt_ {
15
- public typealias bridge = margelo.nitro.securiticonsentsdk.bridge.swift
16
-
17
- private let closure: (_ value: SettingsPrompt?) -> Void
18
-
19
- public init(_ closure: @escaping (_ value: SettingsPrompt?) -> Void) {
20
- self.closure = closure
21
- }
22
-
23
- @inline(__always)
24
- public func call(value: bridge.std__optional_SettingsPrompt_) -> Void {
25
- self.closure({ () -> SettingsPrompt? in
26
- if let __unwrapped = value.value {
27
- return __unwrapped
28
- } else {
29
- return nil
30
- }
31
- }())
32
- }
33
-
34
- /**
35
- * Casts this instance to a retained unsafe raw pointer.
36
- * This acquires one additional strong reference on the object!
37
- */
38
- @inline(__always)
39
- public func toUnsafe() -> UnsafeMutableRawPointer {
40
- return Unmanaged.passRetained(self).toOpaque()
41
- }
42
-
43
- /**
44
- * Casts an unsafe pointer to a `Func_void_std__optional_SettingsPrompt_`.
45
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_SettingsPrompt_>`.
46
- * This removes one strong reference from the object!
47
- */
48
- @inline(__always)
49
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_SettingsPrompt_ {
50
- return Unmanaged<Func_void_std__optional_SettingsPrompt_>.fromOpaque(pointer).takeRetainedValue()
51
- }
52
- }