cm-sdk-react-native-v3 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +10 -0
- package/android/build.gradle +100 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/cmsdkreactnativev3/CmSdkReactNativeV3Module.kt +561 -0
- package/android/src/main/java/com/cmsdkreactnativev3/CmSdkReactNativeV3Package.kt +17 -0
- package/ios/CmSdkReactNativeV3-Bridging-Header.h +2 -0
- package/ios/CmSdkReactNativeV3.mm +120 -0
- package/ios/CmSdkReactNativeV3.swift +302 -0
- package/lib/commonjs/index.js +61 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +57 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +34 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/index.d.ts +34 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +179 -0
- package/react-native-cm-sdk-react-native-v3.podspec +42 -0
- package/src/index.tsx +63 -0
package/package.json
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cm-sdk-react-native-v3",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Consent Management React Native Library by consentmanager.net",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"!ios/build",
|
|
28
|
+
"!android/build",
|
|
29
|
+
"!android/gradle",
|
|
30
|
+
"!android/gradlew",
|
|
31
|
+
"!android/gradlew.bat",
|
|
32
|
+
"!android/local.properties",
|
|
33
|
+
"!**/__tests__",
|
|
34
|
+
"!**/__fixtures__",
|
|
35
|
+
"!**/__mocks__",
|
|
36
|
+
"!**/.*"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"example": "yarn workspace react-native-cm-sdk-react-native-v3-example",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"typecheck": "tsc",
|
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
44
|
+
"prepare": "bob build"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"react-native",
|
|
48
|
+
"ios",
|
|
49
|
+
"android"
|
|
50
|
+
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/iubenda/cm-sdk-react-native-v3.git"
|
|
54
|
+
},
|
|
55
|
+
"author": "Fabio Torre <fabio.torre@iubenda.com> (https://github.com/fabiotorre)",
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/iubenda/cm-sdk-react-native-v3/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/iubenda/cm-sdk-react-native-v3#readme",
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"registry": "https://registry.npmjs.org/"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
66
|
+
"@types/jest": "^29.5.5",
|
|
67
|
+
"@types/react": "^18.2.44",
|
|
68
|
+
"del-cli": "^5.1.0",
|
|
69
|
+
"eslint": "^8.51.0",
|
|
70
|
+
"eslint-config-prettier": "^9.0.0",
|
|
71
|
+
"jest": "^29.7.0",
|
|
72
|
+
"prettier": "^3.0.3",
|
|
73
|
+
"react": "18.3.1",
|
|
74
|
+
"react-native": "0.75.4",
|
|
75
|
+
"react-native-builder-bob": "^0.30.2",
|
|
76
|
+
"typescript": "^5.2.2"
|
|
77
|
+
},
|
|
78
|
+
"resolutions": {
|
|
79
|
+
"@types/react": "^18.2.44"
|
|
80
|
+
},
|
|
81
|
+
"peerDependencies": {
|
|
82
|
+
"react": "*",
|
|
83
|
+
"react-native": "*"
|
|
84
|
+
},
|
|
85
|
+
"workspaces": [
|
|
86
|
+
"example"
|
|
87
|
+
],
|
|
88
|
+
"packageManager": "yarn@3.6.1",
|
|
89
|
+
"jest": {
|
|
90
|
+
"preset": "react-native",
|
|
91
|
+
"modulePathIgnorePatterns": [
|
|
92
|
+
"<rootDir>/example/node_modules",
|
|
93
|
+
"<rootDir>/lib/"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"commitlint": {
|
|
97
|
+
"extends": [
|
|
98
|
+
"@commitlint/config-conventional"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"release-it": {
|
|
102
|
+
"git": {
|
|
103
|
+
"commitMessage": "chore: release ${version}",
|
|
104
|
+
"tagName": "v${version}"
|
|
105
|
+
},
|
|
106
|
+
"npm": {
|
|
107
|
+
"publish": true
|
|
108
|
+
},
|
|
109
|
+
"github": {
|
|
110
|
+
"release": true
|
|
111
|
+
},
|
|
112
|
+
"plugins": {
|
|
113
|
+
"@release-it/conventional-changelog": {
|
|
114
|
+
"preset": "angular"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"eslintConfig": {
|
|
119
|
+
"root": true,
|
|
120
|
+
"extends": [
|
|
121
|
+
"@react-native",
|
|
122
|
+
"prettier"
|
|
123
|
+
],
|
|
124
|
+
"rules": {
|
|
125
|
+
"react/react-in-jsx-scope": "off",
|
|
126
|
+
"prettier/prettier": [
|
|
127
|
+
"error",
|
|
128
|
+
{
|
|
129
|
+
"quoteProps": "consistent",
|
|
130
|
+
"singleQuote": true,
|
|
131
|
+
"tabWidth": 2,
|
|
132
|
+
"trailingComma": "es5",
|
|
133
|
+
"useTabs": false
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"eslintIgnore": [
|
|
139
|
+
"node_modules/",
|
|
140
|
+
"lib/"
|
|
141
|
+
],
|
|
142
|
+
"prettier": {
|
|
143
|
+
"quoteProps": "consistent",
|
|
144
|
+
"singleQuote": true,
|
|
145
|
+
"tabWidth": 2,
|
|
146
|
+
"trailingComma": "es5",
|
|
147
|
+
"useTabs": false
|
|
148
|
+
},
|
|
149
|
+
"react-native-builder-bob": {
|
|
150
|
+
"source": "src",
|
|
151
|
+
"output": "lib",
|
|
152
|
+
"targets": [
|
|
153
|
+
[
|
|
154
|
+
"commonjs",
|
|
155
|
+
{
|
|
156
|
+
"esm": true
|
|
157
|
+
}
|
|
158
|
+
],
|
|
159
|
+
[
|
|
160
|
+
"module",
|
|
161
|
+
{
|
|
162
|
+
"esm": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"typescript",
|
|
167
|
+
{
|
|
168
|
+
"project": "tsconfig.build.json",
|
|
169
|
+
"esm": true
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"create-react-native-library": {
|
|
175
|
+
"type": "module-legacy",
|
|
176
|
+
"languages": "kotlin-swift",
|
|
177
|
+
"version": "0.41.2"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-cm-sdk-react-native-v3"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://github.com/iubenda/cm-sdk-react-native-v3.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
s.dependency "cm-sdk-ios-v3", "3.1.1"
|
|
19
|
+
|
|
20
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
22
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
else
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
|
|
27
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
s.dependency "React-Codegen"
|
|
36
|
+
s.dependency "RCT-Folly"
|
|
37
|
+
s.dependency "RCTRequired"
|
|
38
|
+
s.dependency "RCTTypeSafety"
|
|
39
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'react-native-cm-sdk-react-native-v3' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const CmSdkReactNativeV3 = NativeModules.CmSdkReactNativeV3
|
|
10
|
+
? NativeModules.CmSdkReactNativeV3
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
// Core configuration methods
|
|
21
|
+
export const setUrlConfig = CmSdkReactNativeV3.setUrlConfig;
|
|
22
|
+
export const setWebViewConfig = CmSdkReactNativeV3.setWebViewConfig;
|
|
23
|
+
|
|
24
|
+
// Main interaction methods (new API)
|
|
25
|
+
export const checkAndOpen = CmSdkReactNativeV3.checkAndOpen;
|
|
26
|
+
export const forceOpen = CmSdkReactNativeV3.forceOpen;
|
|
27
|
+
export const jumpToSettings = CmSdkReactNativeV3.jumpToSettings;
|
|
28
|
+
|
|
29
|
+
// Consent status methods
|
|
30
|
+
export const getUserStatus = CmSdkReactNativeV3.getUserStatus;
|
|
31
|
+
export const getStatusForPurpose = CmSdkReactNativeV3.getStatusForPurpose;
|
|
32
|
+
export const getStatusForVendor = CmSdkReactNativeV3.getStatusForVendor;
|
|
33
|
+
export const getGoogleConsentModeStatus = CmSdkReactNativeV3.getGoogleConsentModeStatus;
|
|
34
|
+
export const exportCMPInfo = CmSdkReactNativeV3.exportCMPInfo;
|
|
35
|
+
export const importCMPInfo = CmSdkReactNativeV3.importCMPInfo;
|
|
36
|
+
export const resetConsentManagementData = CmSdkReactNativeV3.resetConsentManagementData;
|
|
37
|
+
|
|
38
|
+
// iOS App Tracking Transparency
|
|
39
|
+
export const getATTAuthorizationStatus = CmSdkReactNativeV3.getATTAuthorizationStatus;
|
|
40
|
+
|
|
41
|
+
// Consent modification methods
|
|
42
|
+
export const acceptVendors = CmSdkReactNativeV3.acceptVendors;
|
|
43
|
+
export const rejectVendors = CmSdkReactNativeV3.rejectVendors;
|
|
44
|
+
export const acceptPurposes = CmSdkReactNativeV3.acceptPurposes;
|
|
45
|
+
export const rejectPurposes = CmSdkReactNativeV3.rejectPurposes;
|
|
46
|
+
export const rejectAll = CmSdkReactNativeV3.rejectAll;
|
|
47
|
+
export const acceptAll = CmSdkReactNativeV3.acceptAll;
|
|
48
|
+
|
|
49
|
+
// Deprecated methods (kept for backward compatibility)
|
|
50
|
+
export const checkWithServerAndOpenIfNecessary = CmSdkReactNativeV3.checkWithServerAndOpenIfNecessary;
|
|
51
|
+
export const openConsentLayer = CmSdkReactNativeV3.openConsentLayer;
|
|
52
|
+
export const checkIfConsentIsRequired = CmSdkReactNativeV3.checkIfConsentIsRequired;
|
|
53
|
+
export const hasUserChoice = CmSdkReactNativeV3.hasUserChoice;
|
|
54
|
+
export const hasPurposeConsent = CmSdkReactNativeV3.hasPurposeConsent;
|
|
55
|
+
export const hasVendorConsent = CmSdkReactNativeV3.hasVendorConsent;
|
|
56
|
+
export const getAllPurposesIDs = CmSdkReactNativeV3.getAllPurposesIDs;
|
|
57
|
+
export const getEnabledPurposesIDs = CmSdkReactNativeV3.getEnabledPurposesIDs;
|
|
58
|
+
export const getDisabledPurposesIDs = CmSdkReactNativeV3.getDisabledPurposesIDs;
|
|
59
|
+
export const getAllVendorsIDs = CmSdkReactNativeV3.getAllVendorsIDs;
|
|
60
|
+
export const getEnabledVendorsIDs = CmSdkReactNativeV3.getEnabledVendorsIDs;
|
|
61
|
+
export const getDisabledVendorsIDs = CmSdkReactNativeV3.getDisabledVendorsIDs;
|
|
62
|
+
|
|
63
|
+
export default CmSdkReactNativeV3;
|