@commandersact/tcconsent-react-native 1.4.2-beta.42

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 (38) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +112 -0
  3. package/android/build.gradle +93 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/tcconsentreactnative/TCConsentReactNativeGenerated.java +10 -0
  8. package/android/src/main/java/com/tcconsentreactnative/TcconsentReactNativeModule.java +460 -0
  9. package/android/src/main/java/com/tcconsentreactnative/TcconsentReactNativePackage.java +28 -0
  10. package/android/src/main/proguard-rules.pro +2 -0
  11. package/ios/TCConsentGenerated.swift +10 -0
  12. package/ios/TcconsentReactNative-Bridging-Header.h +2 -0
  13. package/ios/TcconsentReactNative.mm +48 -0
  14. package/ios/TcconsentReactNative.swift +331 -0
  15. package/lib/commonjs/TCConsent.js +190 -0
  16. package/lib/commonjs/TCConsent.js.map +1 -0
  17. package/lib/commonjs/TCConsentAPI.js +125 -0
  18. package/lib/commonjs/TCConsentAPI.js.map +1 -0
  19. package/lib/commonjs/index.js +28 -0
  20. package/lib/commonjs/index.js.map +1 -0
  21. package/lib/module/TCConsent.js +164 -0
  22. package/lib/module/TCConsent.js.map +1 -0
  23. package/lib/module/TCConsentAPI.js +118 -0
  24. package/lib/module/TCConsentAPI.js.map +1 -0
  25. package/lib/module/index.js +3 -0
  26. package/lib/module/index.js.map +1 -0
  27. package/lib/typescript/TCConsent.d.ts +74 -0
  28. package/lib/typescript/TCConsent.d.ts.map +1 -0
  29. package/lib/typescript/TCConsentAPI.d.ts +82 -0
  30. package/lib/typescript/TCConsentAPI.d.ts.map +1 -0
  31. package/lib/typescript/index.d.ts +3 -0
  32. package/lib/typescript/index.d.ts.map +1 -0
  33. package/package.json +177 -0
  34. package/src/TCConsent.tsx +225 -0
  35. package/src/TCConsentAPI.tsx +131 -0
  36. package/src/index.tsx +2 -0
  37. package/tcconsent-react-native-swift.podspec +28 -0
  38. package/tcconsent-react-native.podspec +27 -0
@@ -0,0 +1,28 @@
1
+ package com.tcconsentreactnative;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class TcconsentReactNativePackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new TcconsentReactNativeModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
@@ -0,0 +1,2 @@
1
+ -keep class com.tagcommander.lib.** { *; }
2
+ -keep class com.tcconsentreactnative.** { *; }
@@ -0,0 +1,10 @@
1
+ //
2
+ // Generated file By CommandersAct
3
+ //
4
+
5
+ import Foundation
6
+
7
+ struct TCConsentReactNativeGenerated
8
+ {
9
+ static let version = "1.4.2-beta.42"
10
+ }
@@ -0,0 +1,2 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,48 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(TcconsentReactNative, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(setSiteIDPrivacyID: (double) siteID privacyID: (double) privacyID)
6
+ RCT_EXTERN_METHOD(acceptAllConsent)
7
+ RCT_EXTERN_METHOD(refuseAllConsent)
8
+ RCT_EXTERN_METHOD(showPrivacyCenter: (NSString *) startScreen)
9
+ RCT_EXTERN_METHOD(useACString: (BOOL) value)
10
+ RCT_EXTERN_METHOD(customPCMSetSiteID: (double) siteID privacyID: (double) privacyID)
11
+ RCT_EXTERN_METHOD(setConsentDuration: (double) months)
12
+ RCT_EXTERN_METHOD(useCustomPublisherRestrictions)
13
+ RCT_EXTERN_METHOD(saveConsentFromPopUp: (NSDictionary *) consent)
14
+ RCT_EXTERN_METHOD(saveConsent: (NSDictionary *) consent)
15
+ RCT_EXTERN_METHOD(saveConsentFromConsentSourceWithPrivacyAction: (NSDictionary *) consent source: (NSString *) source action: (NSString *) action)
16
+ RCT_EXTERN_METHOD(statEnterPCToVendorScreen)
17
+ RCT_EXTERN_METHOD(statShowVendorScreen)
18
+ RCT_EXTERN_METHOD(statViewPrivacyPoliciesFromPrivacyCenter)
19
+ RCT_EXTERN_METHOD(statViewPrivacyCenter)
20
+ RCT_EXTERN_METHOD(statViewBanner)
21
+ RCT_EXTERN_METHOD(consentAsJson:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
22
+ RCT_EXTERN_METHOD(resetSavedConsent)
23
+ RCT_EXTERN_METHOD(setLanguage: (NSString *) languageCode)
24
+ RCT_EXTERN_METHOD(statViewPrivacyPoliciesFromBanner)
25
+
26
+ RCT_EXTERN_METHOD(isConsentAlreadyGiven: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
27
+ RCT_EXTERN_METHOD(isCategoryAccepted: (double) ID withResolver: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
28
+ RCT_EXTERN_METHOD(isVendorAccepted: (double) ID withResolver: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
29
+ RCT_EXTERN_METHOD(isIABPurposeAccepted: (double) ID withResolver: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
30
+ RCT_EXTERN_METHOD(isIABVendorAccepted: (double) ID withResolver: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
31
+ RCT_EXTERN_METHOD(isIABSpecialFeatureAccepted: (double) ID withResolver: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
32
+ RCT_EXTERN_METHOD(getAcceptedCategories: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
33
+ RCT_EXTERN_METHOD(getAcceptedVendors: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
34
+ RCT_EXTERN_METHOD(getAcceptedGoogleVendors: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
35
+ RCT_EXTERN_METHOD(getAllAcceptedConsent: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
36
+ RCT_EXTERN_METHOD(shouldDisplayPrivacyCenter: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
37
+ // RCT_EXTERN_METHOD(switchDefaultState: (BOOL) value)
38
+ RCT_EXTERN_METHOD(do_not_track: (BOOL) value)
39
+ RCT_EXTERN_METHOD(setConsentVersion: (NSString *) value)
40
+ RCT_EXTERN_METHOD(getConsentVersion: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
41
+ RCT_EXTERN_METHOD(getLastTimeConsentWasSaved: (RCTPromiseResolveBlock) resolve withRejecter: (RCTPromiseRejectBlock) reject)
42
+
43
+ + (BOOL)requiresMainQueueSetup
44
+ {
45
+ return NO;
46
+ }
47
+
48
+ @end
@@ -0,0 +1,331 @@
1
+ import React
2
+ import TCConsent
3
+ import TCCore
4
+
5
+ @objc(TcconsentReactNative)
6
+ class TcconsentReactNative: RCTEventEmitter, TCPrivacyCallbacks
7
+ {
8
+ @objc(setSiteIDPrivacyID:privacyID:)
9
+ func setSiteIDPrivacyID(siteID: Double, privacyID: Double) -> Void
10
+ {
11
+ TCDebug.setDebugLevel(TCLogLevel_Verbose)
12
+ TCMobileConsent.sharedInstance().registerCallback(self)
13
+ TCMobileConsent.sharedInstance().setSiteID(Int32(siteID), andPrivacyID: Int32(privacyID))
14
+ refreshTCUser()
15
+ }
16
+
17
+ @objc(acceptAllConsent)
18
+ func acceptAllConsent() -> Void
19
+ {
20
+ TCMobileConsent.sharedInstance().acceptAllConsent()
21
+ }
22
+
23
+ @objc(refuseAllConsent)
24
+ func refuseAllConsent() -> Void
25
+ {
26
+ TCMobileConsent.sharedInstance().refuseAllConsent()
27
+ }
28
+
29
+ @objc(showPrivacyCenter:)
30
+ func showPrivacyCenter(startScreen: String?) -> Void
31
+ {
32
+ DispatchQueue.main.async
33
+ {
34
+ let PCM = TCPrivacyCenterViewController()
35
+ self.setPCMStartScreen(PCM: PCM, startScreen: startScreen)
36
+ let viewController = UIApplication.shared.delegate?.window??.rootViewController
37
+ viewController?.present(PCM, animated: true, completion: nil)
38
+ }
39
+ }
40
+
41
+ @objc(useACString:)
42
+ func useACString(value: Bool) -> Void
43
+ {
44
+ TCMobileConsent.sharedInstance().useAcString(value)
45
+ }
46
+
47
+ @objc(customPCMSetSiteID:privacyID:)
48
+ func customPCMSetSiteID(siteID: Double, privacyID: Double) -> Void
49
+ {
50
+ TCDebug.setDebugLevel(TCLogLevel_Verbose)
51
+ TCMobileConsent.sharedInstance().registerCallback(self)
52
+ TCMobileConsent.sharedInstance().customPCMSetSiteID(Int32(siteID), andPrivacyID: Int32(privacyID))
53
+ refreshTCUser()
54
+ }
55
+
56
+ @objc(setConsentDuration:)
57
+ func setConsentDuration(months: Double) -> Void
58
+ {
59
+ TCMobileConsent.sharedInstance().consentDuration = Float(months)
60
+ }
61
+
62
+ @objc(useCustomPublisherRestrictions)
63
+ func useCustomPublisherRestrictions() -> Void
64
+ {
65
+ TCMobileConsent.sharedInstance().useCustomPublisherRestrictions()
66
+ }
67
+
68
+ @objc(saveConsentFromPopUp:)
69
+ func saveConsentFromPopUp(consent: Dictionary<String, String>) -> Void
70
+ {
71
+ TCMobileConsent.sharedInstance().save(fromPopUp: consent)
72
+ }
73
+
74
+ @objc(saveConsent:)
75
+ func saveConsent(consent: Dictionary<String, String>)
76
+ {
77
+ TCMobileConsent.sharedInstance().save(consent)
78
+ }
79
+
80
+ @objc(saveConsentFromConsentSourceWithPrivacyAction:source:action:)
81
+ func saveConsentFromConsentSourceWithPrivacyAction(consent: Dictionary<String, String>, source: String, action: String)
82
+ {
83
+ TCMobileConsent.sharedInstance().save(consent, from: evaluateConsentSource(stringSource: source), withPrivacyAction: evaluateConsentAction(stringAction: action))
84
+ }
85
+
86
+ @objc(statEnterPCToVendorScreen)
87
+ func statEnterPCToVendorScreen()
88
+ {
89
+ TCMobileConsent.sharedInstance().statEnterPCToVendorScreen()
90
+ }
91
+
92
+ @objc(statShowVendorScreen)
93
+ func statShowVendorScreen()
94
+ {
95
+ TCMobileConsent.sharedInstance().statShowVendorScreen()
96
+ }
97
+
98
+ @objc(statViewPrivacyPoliciesFromPrivacyCenter)
99
+ func statViewPrivacyPoliciesFromPrivacyCenter()
100
+ {
101
+ TCMobileConsent.sharedInstance().statViewPrivacyPoliciesFromPrivacyCenter()
102
+ }
103
+
104
+ @objc(statViewPrivacyCenter)
105
+ func statViewPrivacyCenter()
106
+ {
107
+ TCMobileConsent.sharedInstance().statViewPrivacyCenter()
108
+ }
109
+
110
+ @objc(statViewBanner)
111
+ func statViewBanner()
112
+ {
113
+ TCMobileConsent.sharedInstance().statViewBanner()
114
+ }
115
+
116
+ @objc(consentAsJson:withRejecter:)
117
+ func consentAsJson(resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock)
118
+ {
119
+ let rawJson = TCMobileConsent.sharedInstance().getAsJson()
120
+ let consentAsJson: String? = rawJson != nil ? rawJson : ""
121
+ resolve(consentAsJson)
122
+ }
123
+
124
+ @objc(resetSavedConsent)
125
+ func resetSavedConsent()
126
+ {
127
+ TCMobileConsent.sharedInstance().resetSavedConsent()
128
+ }
129
+
130
+ @objc(setLanguage:)
131
+ func setLanguage(languageCode: String)
132
+ {
133
+ TCMobileConsent.sharedInstance().setLanguage(languageCode)
134
+ }
135
+
136
+ @objc(statViewPrivacyPoliciesFromBanner)
137
+ func statViewPrivacyPoliciesFromBanner()
138
+ {
139
+ TCMobileConsent.sharedInstance().statViewPrivacyPoliciesFromBanner()
140
+ }
141
+
142
+ @objc(isConsentAlreadyGiven:withRejecter:)
143
+ func isConsentAlreadyGiven(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
144
+ {
145
+ resolve(TCConsentAPI.isConsentAlreadyGiven())
146
+ }
147
+
148
+ @objc(getLastTimeConsentWasSaved:withRejecter:)
149
+ func getLastTimeConsentWasSaved(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
150
+ {
151
+ resolve(String(TCConsentAPI.getLastTimeConsentWasSaved()))
152
+ }
153
+
154
+ @objc(isCategoryAccepted:withResolver:withRejecter:)
155
+ func isCategoryAccepted(id: Double, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
156
+ {
157
+ resolve(TCConsentAPI.isCategoryAccepted(Int32(id)))
158
+ }
159
+
160
+ @objc(isVendorAccepted:withResolver:withRejecter:)
161
+ func isVendorAccepted(id: Double, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
162
+ {
163
+ resolve(TCConsentAPI.isVendorAccepted(Int32(id)))
164
+ }
165
+
166
+ @objc(isIABPurposeAccepted:withResolver:withRejecter:)
167
+ func isIABPurposeAccepted(id: Double, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
168
+ {
169
+ resolve(TCConsentAPI.isIABPurposeAccepted(Int32(id)))
170
+ }
171
+
172
+ @objc(isIABVendorAccepted:withResolver:withRejecter:)
173
+ func isIABVendorAccepted(id: Double, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
174
+ {
175
+ resolve(TCConsentAPI.isIABVendorAccepted(Int32(id)))
176
+ }
177
+
178
+ @objc(isIABSpecialFeatureAccepted:withResolver:withRejecter:)
179
+ func isIABSpecialFeatureAccepted(id: Double, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
180
+ {
181
+ resolve(TCConsentAPI.isIABSpecialFeatureAccepted(Int32(id)))
182
+ }
183
+
184
+ @objc(getAcceptedCategories:withRejecter:)
185
+ func getAcceptedCategories(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
186
+ {
187
+ resolve(TCConsentAPI.getAcceptedCategories())
188
+ }
189
+
190
+ @objc(getAcceptedVendors:withRejecter:)
191
+ func getAcceptedVendors(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
192
+ {
193
+ resolve(TCConsentAPI.getAcceptedVendors())
194
+ }
195
+
196
+ @objc(getAcceptedGoogleVendors:withRejecter:)
197
+ func getAcceptedGoogleVendors(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
198
+ {
199
+ resolve(TCConsentAPI.getAcceptedGoogleVendors())
200
+ }
201
+
202
+ @objc(getAllAcceptedConsent:withRejecter:)
203
+ func getAllAcceptedConsent(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
204
+ {
205
+ resolve(TCConsentAPI.getAllAcceptedConsent())
206
+ }
207
+
208
+ @objc(shouldDisplayPrivacyCenter:withRejecter:)
209
+ func shouldDisplayPrivacyCenter(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
210
+ {
211
+ resolve(TCConsentAPI.shouldDisplayPrivacyCenter())
212
+ }
213
+
214
+ /*
215
+ @objc(switchDefaultState:withRejecter:)
216
+ func switchDefaultState(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
217
+ {
218
+ resolve(TCConsentAPI.shouldDisplayPrivacyCenter())
219
+ }*/
220
+
221
+ @objc(do_not_track:)
222
+ func do_not_track(value: Bool)
223
+ {
224
+ TCMobileConsent.sharedInstance().do_not_track = true
225
+ }
226
+
227
+ @objc(setConsentVersion:)
228
+ func setConsentVersion(consentVersion: String)
229
+ {
230
+ TCMobileConsent.sharedInstance().consentVersion = consentVersion
231
+ }
232
+
233
+ @objc(getConsentVersion:withRejecter:)
234
+ func getConsentVersion(resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock)
235
+ {
236
+ resolve(TCMobileConsent.sharedInstance().consentVersion)
237
+ }
238
+
239
+ func evaluateConsentSource(stringSource: String) -> ETCConsentSource
240
+ {
241
+ if (stringSource == "POP_UP")
242
+ {
243
+ return ETCConsentSource.Popup;
244
+ }
245
+ else
246
+ {
247
+ return ETCConsentSource.PrivacyCenter;
248
+ }
249
+ }
250
+
251
+ func evaluateConsentAction(stringAction: String) -> ETCConsentAction
252
+ {
253
+ if (stringAction == "ACCEPT_ALL")
254
+ {
255
+ return ETCConsentAction.AcceptAll;
256
+ }
257
+ else if (stringAction == "REFUSE_ALL")
258
+ {
259
+ return ETCConsentAction.RefuseAll;
260
+ }
261
+ else
262
+ {
263
+ return ETCConsentAction.Save;
264
+ }
265
+ }
266
+
267
+ override func supportedEvents() -> [String]
268
+ {
269
+ return ["consentOutdated", "consentUpdated", "consentCategoryChanged", "significantChangesInPrivacy", "refreshTCUser"]
270
+ }
271
+
272
+ func consentOutdated()
273
+ {
274
+ if self.bridge != nil
275
+ {
276
+ self.sendEvent(withName: "consentOutdated", body: [String:String]())
277
+ }
278
+ }
279
+
280
+ func consentUpdated(_ consent: [AnyHashable : Any]!)
281
+ {
282
+ refreshTCUser()
283
+
284
+ if self.bridge != nil
285
+ {
286
+ self.sendEvent(withName: "consentUpdated", body: consent)
287
+ }
288
+ }
289
+
290
+ func consentCategoryChanged()
291
+ {
292
+ if self.bridge != nil
293
+ {
294
+ self.sendEvent(withName: "consentCategoryChanged", body: [String:String]())
295
+ }
296
+ }
297
+
298
+ func significantChangesInPrivacy()
299
+ {
300
+ if self.bridge != nil
301
+ {
302
+ self.sendEvent(withName: "significantChangesInPrivacy", body: [String:String]())
303
+ }
304
+ }
305
+
306
+ func refreshTCUser()
307
+ {
308
+ var TCUserJson = TCUser.sharedInstance().getJsonObject()
309
+ TCUserJson?["consentID"] = TCUser.sharedInstance().consentID
310
+ TCUserJson?["consent_categories"] = TCUser.sharedInstance().consent_categories
311
+ TCUserJson?["consent_vendors"] = TCUser.sharedInstance().consent_vendors
312
+ TCUserJson?["external_consent"] = TCUser.sharedInstance().external_consent
313
+
314
+ if self.bridge != nil
315
+ {
316
+ self.sendEvent(withName: "refreshTCUser", body: TCUserJson)
317
+ }
318
+ }
319
+
320
+ func setPCMStartScreen(PCM: TCPrivacyCenterViewController, startScreen: String?)
321
+ {
322
+ if (startScreen != nil && startScreen == "startWithVendorScreen")
323
+ {
324
+ PCM.startWithVendorScreen()
325
+ }
326
+ else if (startScreen != nil && startScreen == "startWithPurposeScreen")
327
+ {
328
+ PCM.startWithPurposeScreen()
329
+ }
330
+ }
331
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TCConsentBridge = exports.ETCConsentSource = exports.ETCConsentAction = exports.EPrivacyCenterStartScreen = void 0;
7
+ exports.acceptAllConsent = acceptAllConsent;
8
+ exports.deactivateBackButton = deactivateBackButton;
9
+ exports.do_not_track = do_not_track;
10
+ exports.getConsentAsJson = getConsentAsJson;
11
+ exports.getConsentVersion = getConsentVersion;
12
+ exports.refuseAllConsent = refuseAllConsent;
13
+ exports.resetSavedConsent = resetSavedConsent;
14
+ exports.setConsentDuration = setConsentDuration;
15
+ exports.setConsentVersion = setConsentVersion;
16
+ exports.setLanguage = setLanguage;
17
+ exports.setSiteIDPrivacyID = setSiteIDPrivacyID;
18
+ exports.showPrivacyCenter = showPrivacyCenter;
19
+ exports.statEnterPCToVendorScreen = statEnterPCToVendorScreen;
20
+ exports.statShowVendorScreen = statShowVendorScreen;
21
+ exports.statViewBanner = statViewBanner;
22
+ exports.statViewPrivacyCenter = statViewPrivacyCenter;
23
+ exports.statViewPrivacyPoliciesFromBanner = statViewPrivacyPoliciesFromBanner;
24
+ exports.statViewPrivacyPoliciesFromPrivacyCenter = statViewPrivacyPoliciesFromPrivacyCenter;
25
+ exports.useACString = useACString;
26
+ exports.useCustomPublisherRestrictions = useCustomPublisherRestrictions;
27
+ var _reactNative = require("react-native");
28
+ var _tccoreReactNative = require("@commandersact/tccore-react-native");
29
+ const LINKING_ERROR = `The package 'tcconsent-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
30
+ ios: "- You have run 'pod install'\n",
31
+ default: ''
32
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
33
+ const TCConsentBridge = exports.TCConsentBridge = _reactNative.NativeModules.TcconsentReactNative ? _reactNative.NativeModules.TcconsentReactNative : new Proxy({}, {
34
+ get() {
35
+ throw new Error(LINKING_ERROR);
36
+ }
37
+ });
38
+ const eventEmitter = new _reactNative.NativeEventEmitter(TCConsentBridge);
39
+ eventEmitter.addListener('consentUpdated', _ => {});
40
+ eventEmitter.addListener('consentOutdated', _ => {});
41
+ eventEmitter.addListener('consentCategoryChanged', _ => {});
42
+ eventEmitter.addListener('significantChangesInPrivacy', _ => {});
43
+ eventEmitter.addListener('refreshTCUser', refreshTCUser);
44
+
45
+ /**
46
+ * Initialise your TCConsent module with your own siteID/privacyID values
47
+ *
48
+ * @param siteId
49
+ * @param privacyID
50
+ */
51
+ async function setSiteIDPrivacyID(siteId, privacyID) {
52
+ await TCConsentBridge.setSiteIDPrivacyID(siteId, privacyID);
53
+ }
54
+ function acceptAllConsent() {
55
+ TCConsentBridge.acceptAllConsent();
56
+ }
57
+ function refuseAllConsent() {
58
+ TCConsentBridge.refuseAllConsent();
59
+ }
60
+
61
+ /**
62
+ * Show the Privacy Center with the specified options.
63
+ *
64
+ * @param {EPrivacyCenterStartScreen} startScreen - The starting screen for the Privacy Center, could be kTCStartWithVendorScreen or kTCStartWithPurposeScreen.
65
+ * @param {string | null} customAndroidTitle - Optional title value for your privacy center activity on android.
66
+ * @returns {void}
67
+ */
68
+ function showPrivacyCenter(startScreen = EPrivacyCenterStartScreen.kTCStartWithDefault, customAndroidTitle = null) {
69
+ if (_reactNative.Platform.OS === 'ios') {
70
+ TCConsentBridge.showPrivacyCenter(startScreen);
71
+ } else if (_reactNative.Platform.OS === 'android') {
72
+ TCConsentBridge.showPrivacyCenter(startScreen, customAndroidTitle);
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Enable google ACString usage [IAB Users only]
78
+ *
79
+ * @param useACString boolean value.
80
+ */
81
+ function useACString(useACString) {
82
+ TCConsentBridge.useACString(useACString);
83
+ }
84
+ function setConsentDuration(months) {
85
+ TCConsentBridge.setConsentDuration(months);
86
+ }
87
+ function useCustomPublisherRestrictions() {
88
+ TCConsentBridge.useCustomPublisherRestrictions();
89
+ }
90
+ function statEnterPCToVendorScreen() {
91
+ TCConsentBridge.statEnterPCToVendorScreen();
92
+ }
93
+ function statShowVendorScreen() {
94
+ TCConsentBridge.statShowVendorScreen();
95
+ }
96
+ function statViewPrivacyPoliciesFromPrivacyCenter() {
97
+ TCConsentBridge.statViewPrivacyPoliciesFromPrivacyCenter();
98
+ }
99
+ function statViewPrivacyCenter() {
100
+ TCConsentBridge.statViewPrivacyCenter();
101
+ }
102
+ function statViewBanner() {
103
+ TCConsentBridge.statViewBanner();
104
+ }
105
+ async function getConsentAsJson() {
106
+ return TCConsentBridge.consentAsJson();
107
+ }
108
+ async function resetSavedConsent() {
109
+ TCConsentBridge.resetSavedConsent();
110
+ }
111
+ async function setLanguage(languageCode) {
112
+ return TCConsentBridge.setLanguage(languageCode);
113
+ }
114
+ async function statViewPrivacyPoliciesFromBanner() {
115
+ return TCConsentBridge.statViewPrivacyPoliciesFromBanner();
116
+ }
117
+
118
+ /**
119
+ * fetches TCConsent.consentVersion on the device.
120
+ *
121
+ * @returns a Promise for the consentVersion native value.
122
+ */
123
+ async function getConsentVersion() {
124
+ return TCConsentBridge.getConsentVersion();
125
+ }
126
+
127
+ /**
128
+ * set consentVersion manually for your privacy hits.
129
+ *
130
+ * @param consentVersion string value.
131
+ */
132
+ async function setConsentVersion(consentVersion) {
133
+ TCConsentBridge.setConsentVersion(consentVersion);
134
+ }
135
+
136
+ /**
137
+ * set TCConsent.do_not_track value for your privacy hits.
138
+ *
139
+ * @param value boolean value.
140
+ */
141
+ async function do_not_track(value) {
142
+ TCConsentBridge.do_not_track(value);
143
+ }
144
+
145
+ /**
146
+ * Android OS only ! disable the back button on your privacy center.
147
+ *
148
+ * @param value boolean value, true for enabled button, false for disabled.
149
+ */
150
+ async function deactivateBackButton(value) {
151
+ if (_reactNative.Platform.OS === 'android') {
152
+ TCConsentBridge.deactivateBackButton(value);
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Sets the consent switches state first time privacy center is shown.
158
+ *
159
+ * @param value boolean value, true for enabled switch per default, false for disabled.
160
+
161
+ export async function switchDefaultState(value: boolean)
162
+ {
163
+ TCConsentBridge.switchDefaultState(value)
164
+ }*/
165
+
166
+ function refreshTCUser(userScheme) {
167
+ if (_reactNative.Platform.OS === 'ios') {
168
+ _tccoreReactNative.TCUserInstance.initValues(userScheme);
169
+ } else if (_reactNative.Platform.OS === 'android') {
170
+ _tccoreReactNative.TCUserInstance.initValues(JSON.parse(userScheme));
171
+ }
172
+ }
173
+ let ETCConsentSource = exports.ETCConsentSource = /*#__PURE__*/function (ETCConsentSource) {
174
+ ETCConsentSource["POP_UP"] = "POP_UP";
175
+ ETCConsentSource["PRIVACY_CENTER"] = "PRIVACY_CENTER";
176
+ return ETCConsentSource;
177
+ }({});
178
+ let ETCConsentAction = exports.ETCConsentAction = /*#__PURE__*/function (ETCConsentAction) {
179
+ ETCConsentAction["ACCEPT_ALL"] = "ACCEPT_ALL";
180
+ ETCConsentAction["REFUSE_ALL"] = "REFUSE_ALL";
181
+ ETCConsentAction["SAVE"] = "SAVE";
182
+ return ETCConsentAction;
183
+ }({});
184
+ let EPrivacyCenterStartScreen = exports.EPrivacyCenterStartScreen = /*#__PURE__*/function (EPrivacyCenterStartScreen) {
185
+ EPrivacyCenterStartScreen["kTCStartWithVendorScreen"] = "startWithVendorScreen";
186
+ EPrivacyCenterStartScreen["kTCStartWithPurposeScreen"] = "startWithPurposeScreen";
187
+ EPrivacyCenterStartScreen["kTCStartWithDefault"] = "kTCStartWithDefault";
188
+ return EPrivacyCenterStartScreen;
189
+ }({});
190
+ //# sourceMappingURL=TCConsent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_tccoreReactNative","LINKING_ERROR","Platform","select","ios","default","TCConsentBridge","exports","NativeModules","TcconsentReactNative","Proxy","get","Error","eventEmitter","NativeEventEmitter","addListener","_","refreshTCUser","setSiteIDPrivacyID","siteId","privacyID","acceptAllConsent","refuseAllConsent","showPrivacyCenter","startScreen","EPrivacyCenterStartScreen","kTCStartWithDefault","customAndroidTitle","OS","useACString","setConsentDuration","months","useCustomPublisherRestrictions","statEnterPCToVendorScreen","statShowVendorScreen","statViewPrivacyPoliciesFromPrivacyCenter","statViewPrivacyCenter","statViewBanner","getConsentAsJson","consentAsJson","resetSavedConsent","setLanguage","languageCode","statViewPrivacyPoliciesFromBanner","getConsentVersion","setConsentVersion","consentVersion","do_not_track","value","deactivateBackButton","userScheme","TCUserInstance","initValues","JSON","parse","ETCConsentSource","ETCConsentAction"],"sourceRoot":"../../src","sources":["TCConsent.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,MAAME,aAAa,GACjB,iFAAiF,GACjFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAE1B,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,0BAAa,CAACC,oBAAoB,GAC7DD,0BAAa,CAACC,oBAAoB,GAClC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,C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