Skip to content

Commit 4619dd5

Browse files
authored
Merge pull request #53 from contentpass/CP-4020-consentmanager-cmp-wrapper
Add CMP wrapper for Consentmanager
2 parents 399e1c4 + 2f4c102 commit 4619dd5

29 files changed

Lines changed: 1584 additions & 0 deletions

examples/consentmanager/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# dependencies
2+
node_modules/
3+
4+
# Expo
5+
.expo/
6+
dist/
7+
web-build/
8+
expo-env.d.ts
9+
10+
# Native (generated by expo prebuild)
11+
ios/
12+
android/
13+
14+
# Native
15+
*.orig.*
16+
*.jks
17+
*.p8
18+
*.p12
19+
*.key
20+
*.mobileprovision
21+
22+
# Metro
23+
.metro-health-check*
24+
25+
# debug
26+
npm-debug.*
27+
yarn-debug.*
28+
yarn-error.*
29+
30+
# macOS
31+
.DS_Store
32+
*.pem
33+
34+
# local env files
35+
.env*.local
36+
37+
# typescript
38+
*.tsbuildinfo

examples/consentmanager/app.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"expo": {
3+
"name": "ContentpassConsentmanagerExample",
4+
"slug": "consentmanagerExample",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash-icon.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"ios": {
15+
"supportsTablet": true,
16+
"bundleIdentifier": "com.contentpassConsentmanagerExample.consentmanagerExample"
17+
},
18+
"android": {
19+
"adaptiveIcon": {
20+
"foregroundImage": "./assets/adaptive-icon.png",
21+
"backgroundColor": "#ffffff"
22+
},
23+
"package": "com.contentpassConsentmanagerExample.consentmanagerExample"
24+
},
25+
"web": {
26+
"favicon": "./assets/favicon.png"
27+
},
28+
"plugins": [
29+
"react-native-app-auth"
30+
]
31+
}
32+
}
17.1 KB
Loading
1.43 KB
Loading
21.9 KB
Loading
17.1 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['babel-preset-expo'],
3+
};

examples/consentmanager/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { registerRootComponent } from 'expo';
2+
3+
import App from './src/App';
4+
5+
registerRootComponent(App);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
const { getDefaultConfig } = require('expo/metro-config');
2+
const { getConfig } = require('react-native-builder-bob/metro-config');
3+
const path = require('path');
4+
5+
const workspaceRoot = path.resolve(__dirname, '..', '..');
6+
const workspacePath = (name) => path.resolve(workspaceRoot, name);
7+
8+
const workspacePackages = [
9+
{
10+
name: '@contentpass/react-native-contentpass',
11+
root: workspacePath('packages/react-native-contentpass'),
12+
},
13+
{
14+
name: '@contentpass/react-native-contentpass-ui',
15+
root: workspacePath('packages/react-native-contentpass-ui'),
16+
},
17+
{
18+
name: '@contentpass/react-native-contentpass-cmp-consentmanager',
19+
root: workspacePath('packages/react-native-contentpass-cmp-consentmanager'),
20+
},
21+
];
22+
23+
const pkg = require('../../packages/react-native-contentpass/package.json');
24+
const root = path.resolve(__dirname, '..', '..');
25+
26+
/** @type {import('expo/metro-config').MetroConfig} */
27+
const config = getConfig(getDefaultConfig(__dirname), {
28+
root,
29+
pkg,
30+
project: __dirname,
31+
});
32+
33+
config.watchFolders = [
34+
...(config.watchFolders || []),
35+
...workspacePackages.flatMap(({ root }) => [path.join(root, 'src'), root]),
36+
];
37+
38+
const exampleNodeModules = path.resolve(__dirname, 'node_modules');
39+
const rootNodeModules = path.resolve(__dirname, '..', '..', 'node_modules');
40+
const libraryNodeModules = path.join(
41+
workspacePath('packages/react-native-contentpass'),
42+
'node_modules'
43+
);
44+
const workspaceExtraNodeModules = Object.fromEntries(
45+
workspacePackages.map(({ name, root }) => [name, path.join(root, 'src')])
46+
);
47+
48+
config.resolver = {
49+
...config.resolver,
50+
disableHierarchicalLookup: true,
51+
extraNodeModules: {
52+
...config.resolver?.extraNodeModules,
53+
'react': path.join(exampleNodeModules, 'react'),
54+
'react-native': path.join(exampleNodeModules, 'react-native'),
55+
...workspaceExtraNodeModules,
56+
},
57+
nodeModulesPaths: [
58+
exampleNodeModules,
59+
rootNodeModules,
60+
libraryNodeModules,
61+
...(config.resolver?.nodeModulesPaths || []),
62+
],
63+
unstable_enablePackageExports: false,
64+
};
65+
66+
module.exports = config;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@contentpass/examples-consentmanager",
3+
"version": "0.0.1",
4+
"main": "index.ts",
5+
"scripts": {
6+
"start": "expo start",
7+
"android": "expo run:android",
8+
"ios": "expo run:ios"
9+
},
10+
"dependencies": {
11+
"@contentpass/react-native-contentpass": "workspace:*",
12+
"@contentpass/react-native-contentpass-cmp-consentmanager": "workspace:*",
13+
"@contentpass/react-native-contentpass-ui": "workspace:*",
14+
"cm-sdk-react-native-v3": "^3.10.0",
15+
"expo": "~54.0.33",
16+
"expo-status-bar": "~3.0.9",
17+
"react": "19.1.0",
18+
"react-native": "0.81.5",
19+
"react-native-app-auth": "^8.1.0",
20+
"react-native-encrypted-storage": "^4.0.3",
21+
"react-native-webview": "^13.15.0"
22+
},
23+
"devDependencies": {
24+
"@babel/core": "^7.29.0",
25+
"@babel/preset-env": "^7.29.0",
26+
"@babel/runtime": "^7.28.6",
27+
"@react-native-community/cli": "19.1.2",
28+
"@react-native-community/cli-platform-android": "19.1.2",
29+
"@react-native-community/cli-platform-ios": "19.1.2",
30+
"@react-native/babel-preset": "0.81.5",
31+
"@react-native/metro-config": "0.81.5",
32+
"@react-native/typescript-config": "0.81.5",
33+
"babel-preset-expo": "^54.0.10",
34+
"react-native-builder-bob": "^0.40.17"
35+
},
36+
"private": true
37+
}

0 commit comments

Comments
 (0)