Skip to content

Commit 3f6e7d8

Browse files
rename package to @sourcepoint/react-native-cmp
1 parent d20c738 commit 3f6e7d8

File tree

9 files changed

+79
-47
lines changed

9 files changed

+79
-47
lines changed

.eslintrc.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
{
22
"root": true,
3+
"env": {
4+
"browser": true,
5+
"amd": true,
6+
"node": true
7+
},
38
"extends": [
49
"eslint:recommended",
5-
"plugin:@typescript-eslint/recommended"
10+
"plugin:@typescript-eslint/recommended",
11+
"@react-native-community"
612
],
713
"parser": "@typescript-eslint/parser",
8-
"parserOptions": { "project": ["./tsconfig.json"] },
14+
"parserOptions": {
15+
"project": ["./tsconfig.json"]},
916
"plugins": [
1017
"@typescript-eslint"
1118
],
@@ -16,7 +23,18 @@
1623
"allowString" : false,
1724
"allowNumber" : false
1825
}
19-
]
26+
],
27+
"react/jsx-first-prop-new-line": 0,
28+
"react/jsx-max-props-per-line": 0
2029
},
21-
"ignorePatterns": []
30+
"ignorePatterns": [
31+
"node_modules/",
32+
"lib/",
33+
"scripts/",
34+
"example/scripts/",
35+
"example/ios/",
36+
"example/android/",
37+
"example/metro.*",
38+
"*.config.*"
39+
]
2240
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# react-native-sourcepoint-cmp
1+
# @sourcepoint/react-native-cmp
22
Sourcepoint's CMP bridge for React Native
33
## Installation
44

55
```sh
6-
npm install react-native-sourcepoint-cmp
6+
npm install @sourcepoint/react-native-cmp
77
```
88

99
## Usage
1010

1111
```js
1212
//...
1313

14-
import { SPConsentManager } from 'react-native-sourcepoint-cmp';
14+
import { SPConsentManager } from '@sourcepoint/react-native-cmp';
1515

1616
const config = {
1717
accountId: 22,

example/react-native.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require('path');
22

33
module.exports = {
44
dependencies: {
5-
'react-native-sourcepoint-cmp': {
5+
'@sourcepoint/react-native-cmp': {
66
root: path.join(__dirname, '..'),
77
},
88
},

example/src/App.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { View, ScrollView, SafeAreaView, Button, Text } from 'react-native';
33

4-
import { SPConsentManager } from 'react-native-sourcepoint-cmp';
4+
import { SPConsentManager } from '@sourcepoint/react-native-cmp';
55

66
const config = {
77
accountId: 22,
@@ -14,7 +14,7 @@ const config = {
1414
const consentManager = new SPConsentManager(
1515
config.accountId,
1616
config.propertyId,
17-
config.propertyName,
17+
config.propertyName
1818
);
1919

2020
export default function App() {
@@ -23,33 +23,43 @@ export default function App() {
2323
React.useEffect(() => {
2424
consentManager.onFinished(() => {
2525
consentManager.getUserData().then(setUserData);
26-
})
26+
});
2727
consentManager.loadMessage();
2828
consentManager.getUserData().then(setUserData);
2929
}, []);
3030

3131
return (
3232
<SafeAreaView>
3333
<View>
34-
<Button title='Load Messages' onPress={() => {
35-
consentManager.loadMessage();
36-
}}/>
37-
<Button title='Load GDPR PM' onPress={() => {
38-
consentManager.loadGDPRPrivacyManager(config.gdprPMId);
39-
}}/>
40-
<Button title='Load CCPA PM' onPress={() => {
41-
consentManager.loadCCPAPrivacyManager(config.ccpaPMId);
42-
}}/>
43-
<Button title='Clear All' onPress={() => {
44-
consentManager.clearLocalData()
45-
consentManager.getUserData().then(setUserData)
46-
}}/>
34+
<Button
35+
title="Load Messages"
36+
onPress={() => {
37+
consentManager.loadMessage();
38+
}}
39+
/>
40+
<Button
41+
title="Load GDPR PM"
42+
onPress={() => {
43+
consentManager.loadGDPRPrivacyManager(config.gdprPMId);
44+
}}
45+
/>
46+
<Button
47+
title="Load CCPA PM"
48+
onPress={() => {
49+
consentManager.loadCCPAPrivacyManager(config.ccpaPMId);
50+
}}
51+
/>
52+
<Button
53+
title="Clear All"
54+
onPress={() => {
55+
consentManager.clearLocalData();
56+
consentManager.getUserData().then(setUserData);
57+
}}
58+
/>
4759
</View>
4860
<ScrollView>
4961
<ScrollView horizontal={true}>
50-
<Text>
51-
{JSON.stringify(userData, undefined, ' ')}
52-
</Text>
62+
<Text>{JSON.stringify(userData, undefined, ' ')}</Text>
5363
</ScrollView>
5464
</ScrollView>
5565
</SafeAreaView>

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "react-native-sourcepoint-cmp",
2+
"name": "@sourcepoint/react-native-cmp",
33
"version": "0.1.0",
44
"description": "test",
55
"main": "lib/commonjs/index",
@@ -35,13 +35,13 @@
3535
"ios",
3636
"android"
3737
],
38-
"repository": "https://github.com/andresilveirah/react-native-sourcepoint-cmp",
38+
"repository": "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp",
3939
"author": "André Herculano <andre@sourcepoint.com> (https://github.com/andresilveirah)",
4040
"license": "MIT",
4141
"bugs": {
42-
"url": "https://github.com/andresilveirah/react-native-sourcepoint-cmp/issues"
42+
"url": "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp/issues"
4343
},
44-
"homepage": "https://github.com/andresilveirah/react-native-sourcepoint-cmp#readme",
44+
"homepage": "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp#readme",
4545
"publishConfig": {
4646
"registry": "https://registry.npmjs.org/"
4747
},

react-native-sourcepoint-cmp.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
1212
s.authors = package["author"]
1313

1414
s.platforms = { :ios => "10.0" }
15-
s.source = { :git => "https://github.com/andresilveirah/react-native-sourcepoint-cmp.git", :tag => "#{s.version}" }
15+
s.source = { :git => "https://github.com/SourcePointUSA/react-native-sourcepoint-cmp.get", :tag => "#{s.version}" }
1616

1717
s.source_files = "ios/**/*.{h,m,mm,swift}"
1818

scripts/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if (os.type() === 'Windows_NT') {
1717

1818
let result;
1919

20-
if (process.cwd() !== root || args.length) {
20+
if (process.cwd() !== root || args.length > 0) {
2121
// We're not in the root of the project, or additional arguments were passed
2222
// In this case, forward the command to `yarn`
2323
result = child_process.spawnSync('yarn', args, options);

src/index.tsx

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
22

33
const LINKING_ERROR =
4-
`The package 'react-native-sourcepoint-cmp' doesn't seem to be linked. Make sure: \n\n` +
4+
"The package '@sourcepoint/react-native-cmp' doesn't seem to be linked. Make sure: \n\n" +
55
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
66
'- You rebuilt the app after installing the package\n' +
77
'- You are not using Expo managed workflow\n';
88

9-
const SourcepointCmp = NativeModules.SourcepointCmp !== undefined ?
10-
NativeModules.SourcepointCmp :
11-
new Proxy({}, {
12-
get() {
13-
throw new Error(LINKING_ERROR);
14-
},
15-
});
9+
const SourcepointCmp =
10+
NativeModules.SourcepointCmp !== undefined
11+
? NativeModules.SourcepointCmp
12+
: new Proxy(
13+
{},
14+
{
15+
get() {
16+
throw new Error(LINKING_ERROR);
17+
},
18+
}
19+
);
1620
export class SPConsentManager {
1721
accountId: number;
1822
propId: number;
1923
propName: string;
20-
emitter: NativeEventEmitter
24+
emitter: NativeEventEmitter;
2125

22-
constructor (accountId: number, propId: number, propName: string) {
23-
SourcepointCmp.build(accountId, propId, propName)
24-
this.emitter = new NativeEventEmitter(SourcepointCmp)
26+
constructor(accountId: number, propId: number, propName: string) {
27+
SourcepointCmp.build(accountId, propId, propName);
28+
this.emitter = new NativeEventEmitter(SourcepointCmp);
2529
this.accountId = accountId;
2630
this.propId = propId;
2731
this.propName = propName;
2832
}
2933

3034
onFinished(callback: () => void) {
31-
this.emitter.removeAllListeners('onSPFinished')
35+
this.emitter.removeAllListeners('onSPFinished');
3236
this.emitter.addListener('onSPFinished', callback);
3337
}
3438

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"baseUrl": "./",
44
"paths": {
5-
"react-native-sourcepoint-cmp": ["./src/index"]
5+
"@sourcepoint/react-native-cmp": ["./src/index"]
66
},
77
"allowUnreachableCode": false,
88
"allowUnusedLabels": false,

0 commit comments

Comments
 (0)