@allboatsrise/expo-marketingcloudsdk 0.0.1
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/README.md +3 -0
- package/app.plugin.js +1 -0
- package/build/MarketingCloudSdk.d.ts +0 -0
- package/build/MarketingCloudSdk.js +1 -0
- package/build/MarketingCloudSdk.js.map +1 -0
- package/package.json +52 -0
- package/plugin/build/types.d.ts +15 -0
- package/plugin/build/types.js +2 -0
- package/plugin/build/withMarketingCloudSdk.d.ts +4 -0
- package/plugin/build/withMarketingCloudSdk.js +26 -0
- package/plugin/build/withMarketingCloudSdkAndroid.d.ts +3 -0
- package/plugin/build/withMarketingCloudSdkAndroid.js +21 -0
- package/plugin/build/withMarketingCloudSdkIOS.d.ts +3 -0
- package/plugin/build/withMarketingCloudSdkIOS.js +24 -0
package/README.md
ADDED
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build/withMarketingCloudSdk')
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=MarketingCloudSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketingCloudSdk.js","sourceRoot":"","sources":["../src/MarketingCloudSdk.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@allboatsrise/expo-marketingcloudsdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Expo module for Salesforce Marketing Cloud SDK",
|
|
5
|
+
"homepage": "https://github.com/allboatsrise/expo-marketingcloudsdk",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react-native",
|
|
8
|
+
"expo",
|
|
9
|
+
"ios",
|
|
10
|
+
"android",
|
|
11
|
+
"salesforce",
|
|
12
|
+
"mobilepush",
|
|
13
|
+
"marketingcloud",
|
|
14
|
+
"marketingcloudsdk"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/allboatsrise/expo-marketingcloudsdk.git"
|
|
19
|
+
},
|
|
20
|
+
"main": "build/MarketingCloudSdk.js",
|
|
21
|
+
"types": "build/MarketingCloudSdk.d.ts",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"files": [
|
|
24
|
+
"/build/**/*",
|
|
25
|
+
"/plugin/build/**/*",
|
|
26
|
+
"/app.plugin.js",
|
|
27
|
+
"/package.json",
|
|
28
|
+
"/README.md"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "expo-module build",
|
|
32
|
+
"clean": "expo-module clean",
|
|
33
|
+
"lint": "expo-module lint",
|
|
34
|
+
"test": "expo-module test",
|
|
35
|
+
"prepare": "expo-module prepare",
|
|
36
|
+
"prepublishOnly": "expo-module prepublishOnly",
|
|
37
|
+
"expo-module": "expo-module"
|
|
38
|
+
},
|
|
39
|
+
"jest": {
|
|
40
|
+
"preset": "expo-module-scripts"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@expo/config-plugins": "^4.0.2"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"expo-module-scripts": "^2.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"expo": "*",
|
|
50
|
+
"react-native-marketingcloudsdk": "^7.4.3"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type MarketingCloudSdkPluginProps = {
|
|
2
|
+
/** Marketing Cloud app id */
|
|
3
|
+
appId: string;
|
|
4
|
+
/** Marketing Cloud access token */
|
|
5
|
+
accessToken: string;
|
|
6
|
+
/** Marketing Cloud server url */
|
|
7
|
+
serverUrl: string;
|
|
8
|
+
/** Marketing Cloud FCM sender id */
|
|
9
|
+
senderId?: string;
|
|
10
|
+
/** Marketing Cloud mid */
|
|
11
|
+
mid?: string;
|
|
12
|
+
inboxEnabled?: boolean;
|
|
13
|
+
locationEnabled?: boolean;
|
|
14
|
+
analyticsEnabled?: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const withMarketingCloudSdkAndroid_1 = require("./withMarketingCloudSdkAndroid");
|
|
5
|
+
const withMarketingCloudSdkIOS_1 = require("./withMarketingCloudSdkIOS");
|
|
6
|
+
const pkg = require('@allboatsrise/expo-marketingcloudsdk/package.json');
|
|
7
|
+
const ERROR_PREFIX = 'Marketing Cloud SDK Plugin:';
|
|
8
|
+
const withMarketingCloudSdk = (config, props) => {
|
|
9
|
+
if (!props) {
|
|
10
|
+
throw new Error(`${ERROR_PREFIX} Must configure plugin options.`);
|
|
11
|
+
}
|
|
12
|
+
const { serverUrl, appId, accessToken } = props;
|
|
13
|
+
if (!serverUrl) {
|
|
14
|
+
throw new Error(`${ERROR_PREFIX} Must provide server url.`);
|
|
15
|
+
}
|
|
16
|
+
if (!appId) {
|
|
17
|
+
throw new Error(`${ERROR_PREFIX} Must provide app id.`);
|
|
18
|
+
}
|
|
19
|
+
if (!accessToken) {
|
|
20
|
+
throw new Error(`${ERROR_PREFIX} Must provide access token.`);
|
|
21
|
+
}
|
|
22
|
+
config = (0, withMarketingCloudSdkAndroid_1.withMarketingCloudSdkAndroid)(config, { ...props, serverUrl, appId, accessToken });
|
|
23
|
+
config = (0, withMarketingCloudSdkIOS_1.withMarketingCloudSdkIOS)(config, { ...props, serverUrl, appId, accessToken });
|
|
24
|
+
return config;
|
|
25
|
+
};
|
|
26
|
+
exports.default = (0, config_plugins_1.createRunOncePlugin)(withMarketingCloudSdk, pkg.name, pkg.version);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withMarketingCloudSdkAndroid = void 0;
|
|
4
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
+
const { addMetaDataItemToMainApplication, getMainApplicationOrThrow, } = config_plugins_1.AndroidConfig.Manifest;
|
|
6
|
+
const withMarketingCloudSdkAndroid = (config, props) => {
|
|
7
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
8
|
+
const mainApplication = getMainApplicationOrThrow(config.modResults);
|
|
9
|
+
addMetaDataItemToMainApplication(mainApplication, 'com.sfmc.appId', props.appId);
|
|
10
|
+
addMetaDataItemToMainApplication(mainApplication, 'com.sfmc.accessToken', props.accessToken);
|
|
11
|
+
addMetaDataItemToMainApplication(mainApplication, 'com.sfmc.serverUrl', props.serverUrl);
|
|
12
|
+
return config;
|
|
13
|
+
});
|
|
14
|
+
config_plugins_1.WarningAggregator.addWarningAndroid('expo-marketingcloudsdk', JSON.stringify(config_plugins_1.withMainApplication, undefined, 2));
|
|
15
|
+
config = (0, config_plugins_1.withMainActivity)(config, (config) => {
|
|
16
|
+
console.log(config);
|
|
17
|
+
return config;
|
|
18
|
+
});
|
|
19
|
+
return config;
|
|
20
|
+
};
|
|
21
|
+
exports.withMarketingCloudSdkAndroid = withMarketingCloudSdkAndroid;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withMarketingCloudSdkIOS = void 0;
|
|
4
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
+
const withMarketingCloudSdkIOS = (config, props) => {
|
|
6
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
7
|
+
config.modResults['SFMC_APP_ID'] = props.appId;
|
|
8
|
+
config.modResults['SFMC_ACCESS_TOKEN'] = props.accessToken;
|
|
9
|
+
config.modResults['SFMC_SERVER_URL'] = props.serverUrl;
|
|
10
|
+
if (typeof props.analyticsEnabled === 'boolean')
|
|
11
|
+
config.modResults['SFMC_ANALYTICS_ENABLED'] = props.analyticsEnabled ? 1 : 0;
|
|
12
|
+
if (typeof props.inboxEnabled === 'boolean')
|
|
13
|
+
config.modResults['SFMC_INBOX_ENABLED'] = props.inboxEnabled ? 1 : 0;
|
|
14
|
+
if (typeof props.locationEnabled === 'boolean')
|
|
15
|
+
config.modResults['SFMC_LOCATION_ENABLED'] = props.locationEnabled ? 1 : 0;
|
|
16
|
+
if (props.mid)
|
|
17
|
+
config.modResults['SFMC_MID'] = props.mid;
|
|
18
|
+
if (props.senderId)
|
|
19
|
+
config.modResults['SFMC_SENDER_ID'] = props.senderId;
|
|
20
|
+
return config;
|
|
21
|
+
});
|
|
22
|
+
return config;
|
|
23
|
+
};
|
|
24
|
+
exports.withMarketingCloudSdkIOS = withMarketingCloudSdkIOS;
|