react-native-moengage 8.4.0 → 8.5.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/CHANGELOG.md +17 -0
- package/ReactNativeMoEngage.podspec +3 -3
- package/android/build.gradle +5 -5
- package/android/src/main/java/com/moengage/react/EventEmitterImpl.kt +8 -19
- package/android/src/main/java/com/moengage/react/GlobalCache.kt +1 -19
- package/android/src/main/java/com/moengage/react/MoEInitializer.kt +4 -4
- package/android/src/main/java/com/moengage/react/MoEReactBridge.kt +12 -6
- package/iOS/MoEReactBridge/MoEngageInitializer.m +5 -6
- package/iOS/MoEReactBridge/MoEngageReactConstants.h +1 -0
- package/iOS/MoEReactBridge/MoEngageReactConstants.m +1 -0
- package/package.json +13 -2
- package/src/index.ts +102 -95
- package/src/logger/MoEngageLogger.ts +77 -0
- package/src/models/MoEInitConfig.ts +36 -0
- package/src/models/MoEProperties.ts +8 -7
- package/src/models/MoEPushCampaign.ts +3 -1
- package/src/models/MoEPushConfig.ts +25 -0
- package/src/models/MoEngageLogConfig.ts +69 -0
- package/src/moeParser/MoEInAppParser.ts +28 -7
- package/src/moeParser/MoEPushNotificationParser.ts +8 -4
- package/src/moeParser/MoEngagePayloadParser.ts +0 -1
- package/src/platform/MoERNAndroid.ts +5 -17
- package/src/platform/MoERNiOS.ts +2 -2
- package/src/utils/MoEConstants.ts +16 -0
- package/src/utils/MoEJsonBuilder.ts +17 -1
- package/src/utils/MoEngageGlobalCache.ts +22 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// Helper class to track event attributes.
|
|
2
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
2
3
|
import { MoEGeoLocationToJson } from "../utils/MoEObjectToJson";
|
|
3
4
|
import MoEGeoLocation from "./MoEGeoLocation";
|
|
4
5
|
|
|
@@ -42,7 +43,7 @@ export default class MoEProperties {
|
|
|
42
43
|
if (Array.isArray(value)) {
|
|
43
44
|
value = (value as Array<any>).filter(e => (this.validateType(["string", "number"], e)));
|
|
44
45
|
} else if (!this.validateType(["string", "number", "boolean"], value)) {
|
|
45
|
-
|
|
46
|
+
MoEngageLogger.warn("MoEProperties->addAttribute: invalid attribute");
|
|
46
47
|
return
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -60,7 +61,7 @@ export default class MoEProperties {
|
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
63
|
if (!this.validateType(["string"], date)) {
|
|
63
|
-
|
|
64
|
+
MoEngageLogger.warn("MoEProperties->addDateAttribute: invalid date attribute");
|
|
64
65
|
return
|
|
65
66
|
}
|
|
66
67
|
this.dateTimeAttributes[key.toString()] = date;
|
|
@@ -81,7 +82,7 @@ export default class MoEProperties {
|
|
|
81
82
|
if (this.validateLatLong(location)) {
|
|
82
83
|
this.locationAttributes[key.toString()] = MoEGeoLocationToJson(location)
|
|
83
84
|
} else {
|
|
84
|
-
|
|
85
|
+
MoEngageLogger.warn("MoEGeoLocation->addLocationAttribute: invalid coordinates");
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -103,10 +104,10 @@ export default class MoEProperties {
|
|
|
103
104
|
|
|
104
105
|
private validateLatLong(location: MoEGeoLocation) {
|
|
105
106
|
return (
|
|
106
|
-
location.latitude > -91 &&
|
|
107
|
-
location.latitude < 91 &&
|
|
108
|
-
location.longitude > -181 &&
|
|
109
|
-
location.longitude < 181
|
|
107
|
+
location.latitude.valueOf() > -91 &&
|
|
108
|
+
location.latitude.valueOf() < 91 &&
|
|
109
|
+
location.longitude.valueOf() > -181 &&
|
|
110
|
+
location.longitude.valueOf() < 181
|
|
110
111
|
);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
@@ -2,10 +2,12 @@ export default class MoEPushCampaign {
|
|
|
2
2
|
payload: Map<String, Object>;
|
|
3
3
|
isDefaultAction: Boolean;
|
|
4
4
|
clickAction: Map<String, Object>;
|
|
5
|
+
selfHandledPushRedirection: boolean;
|
|
5
6
|
|
|
6
|
-
constructor(payload: Map<String, Object>, isDefaultAction: Boolean, clickAction: Map<String, Object
|
|
7
|
+
constructor(payload: Map<String, Object>, isDefaultAction: Boolean, clickAction: Map<String, Object>, selfHandledPushRedirection: boolean) {
|
|
7
8
|
this.payload = payload;
|
|
8
9
|
this.isDefaultAction = isDefaultAction;
|
|
9
10
|
this.clickAction = clickAction;
|
|
11
|
+
this.selfHandledPushRedirection = selfHandledPushRedirection;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config class for Push Notification
|
|
3
|
+
* Note: This Config is only for Android platform and is a no-operation method for other plaforms.
|
|
4
|
+
*/
|
|
5
|
+
export default class MoEPushConfig {
|
|
6
|
+
|
|
7
|
+
shouldDeliverCallbackOnForegroundClick: boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Create an instance of {@link MoEPushConfig}
|
|
11
|
+
*
|
|
12
|
+
* @param shouldDeliverCallbackOnForegroundClick true to handle the callback in the hybrid side
|
|
13
|
+
* if notification is clicked in foreground,
|
|
14
|
+
*/
|
|
15
|
+
constructor (shouldDeliverCallbackOnForegroundClick: boolean) {
|
|
16
|
+
this.shouldDeliverCallbackOnForegroundClick = shouldDeliverCallbackOnForegroundClick;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Default Config for {@link MoEPushConfig}
|
|
21
|
+
*/
|
|
22
|
+
static defaultConfig() {
|
|
23
|
+
return new MoEPushConfig(false);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CONFIG_LOG_LEVEL,
|
|
3
|
+
DEFAULT_CONFIG_RELEASE_BUILD_LOG_ENABLED
|
|
4
|
+
} from "../utils/MoEConstants";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Config class to configure the React-Native Plugin log.
|
|
8
|
+
* Notes: To configure Native Module log check on Android / iOS initialisation config.
|
|
9
|
+
*/
|
|
10
|
+
export default class MoEngageLogConfig {
|
|
11
|
+
|
|
12
|
+
logLevel: MoEngageLogLevel = DEFAULT_CONFIG_LOG_LEVEL;
|
|
13
|
+
|
|
14
|
+
isEnabledForReleaseBuild: boolean = DEFAULT_CONFIG_RELEASE_BUILD_LOG_ENABLED;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create an instance for MoEngageLogConfig
|
|
18
|
+
*
|
|
19
|
+
* @param logLevel - Min log level which need to be printed on console
|
|
20
|
+
* @param isEnabledForReleaseBuild - enable / disable the log in release build
|
|
21
|
+
*/
|
|
22
|
+
constructor(logLevel: MoEngageLogLevel, isEnabledForReleaseBuild: boolean) {
|
|
23
|
+
this.logLevel = logLevel;
|
|
24
|
+
this.isEnabledForReleaseBuild = isEnabledForReleaseBuild;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Default config for the log
|
|
29
|
+
*/
|
|
30
|
+
static defaultConfig() {
|
|
31
|
+
return new MoEngageLogConfig(DEFAULT_CONFIG_LOG_LEVEL, DEFAULT_CONFIG_RELEASE_BUILD_LOG_ENABLED);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Different Log Level Supported by the {@link MoEngageLogConfig}
|
|
37
|
+
*/
|
|
38
|
+
export const enum MoEngageLogLevel {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* No logs from the SDK would be printed.
|
|
42
|
+
*/
|
|
43
|
+
NO_LOG = 0,
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Error logs from the SDK would be printed.
|
|
47
|
+
*/
|
|
48
|
+
ERROR = 1,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Warning logs from the SDK would be printed.
|
|
52
|
+
*/
|
|
53
|
+
WARN = 2,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Info logs from the SDK would be printed.
|
|
57
|
+
*/
|
|
58
|
+
INFO = 3,
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Debug logs from the SDK would be printed.
|
|
62
|
+
*/
|
|
63
|
+
DEBUG = 4,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Verbose logs from the SDK would be printed.
|
|
67
|
+
*/
|
|
68
|
+
VERBOSE = 5
|
|
69
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
1
2
|
import MoEAccountMeta from "../models/MoEAccountMeta";
|
|
2
3
|
import MoECampaignContext from "../models/MoECampaignContext";
|
|
3
4
|
import MoECampaignData from "../models/MoECampaignData";
|
|
@@ -7,7 +8,27 @@ import MoEInAppData from "../models/MoEInAppData";
|
|
|
7
8
|
import MoEInAppNavigation from "../models/MoEInAppNavigation";
|
|
8
9
|
import MoESelfHandledCampaign from "../models/MoESelfHandledCampaign";
|
|
9
10
|
import MoESelfHandledCampaignData from "../models/MoESelfHandledCampaignData";
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
ACTION_TYPE,
|
|
13
|
+
APP_ID,
|
|
14
|
+
FORMATTED_CAMPAIGN_ID,
|
|
15
|
+
MOE_CAMPAIGN_CONTEXT,
|
|
16
|
+
MOE_CAMPAIGN_ID,
|
|
17
|
+
MOE_CAMPAIGN_NAME,
|
|
18
|
+
MOE_CUSTOM_ACTION,
|
|
19
|
+
MOE_CUSTOM_ACTION_OBJ_ERROR,
|
|
20
|
+
MOE_DISMISSINTERVAL,
|
|
21
|
+
MOE_IN_APP_OBJECT_ERROR,
|
|
22
|
+
MOE_KEY_VALUE_PAIR,
|
|
23
|
+
MOE_NAVIGATION,
|
|
24
|
+
MOE_NAVIGATION_OBJ_ERROR,
|
|
25
|
+
MOE_NAVIGATION_TYPE,
|
|
26
|
+
MOE_PAYLOAD,
|
|
27
|
+
MOE_PLATFORM,
|
|
28
|
+
MOE_SELF_HANDLED,
|
|
29
|
+
MOE_SELF_HANDLED_OBJ_ERROR,
|
|
30
|
+
MOE_NAVIGATION_VALUE
|
|
31
|
+
} from "../utils/MoEConstants";
|
|
11
32
|
import { isValidObject } from "../utils/MoEHelper";
|
|
12
33
|
|
|
13
34
|
/**
|
|
@@ -26,7 +47,7 @@ export function isMoEInAppCampaignValid(obj: { [k: string]: any }) {
|
|
|
26
47
|
}
|
|
27
48
|
}
|
|
28
49
|
catch (error: any) {
|
|
29
|
-
|
|
50
|
+
MoEngageLogger.error(error?.message);
|
|
30
51
|
return false;
|
|
31
52
|
}
|
|
32
53
|
}
|
|
@@ -37,7 +58,7 @@ function getMoEAccountMeta(accountMeta: { [k: string]: any }) {
|
|
|
37
58
|
}
|
|
38
59
|
|
|
39
60
|
function getMoECampaignData(json: { [k: string]: any }) {
|
|
40
|
-
|
|
61
|
+
MoEngageLogger.verbose("getMoECampaignData(): Payload: ", json);
|
|
41
62
|
var campaignId = json[MOE_CAMPAIGN_ID];
|
|
42
63
|
var campaignName = json[MOE_CAMPAIGN_NAME];
|
|
43
64
|
var campaignContext = json[MOE_CAMPAIGN_CONTEXT];
|
|
@@ -86,7 +107,7 @@ export function getMoEInAppData(json: { [k: string]: any }, accountMetaPayload:
|
|
|
86
107
|
* this funtion creates MoESelfHandledCampaignData Object from json
|
|
87
108
|
*/
|
|
88
109
|
export function getMoESelfHandledCampaignData(json: { [k: string]: any }, accountMetaPayload: { [k: string]: any }) {
|
|
89
|
-
|
|
110
|
+
MoEngageLogger.verbose("getMoESelfHandledCampaignData(): Payload: ", json);
|
|
90
111
|
if (isSelfHandledCampaignValid(json)) {
|
|
91
112
|
var campaignData = getMoECampaignData(json);
|
|
92
113
|
var platform = json[MOE_PLATFORM];
|
|
@@ -111,7 +132,7 @@ export function isInAppCustomActionValid(obj: { [k: string]: any }) {
|
|
|
111
132
|
}
|
|
112
133
|
}
|
|
113
134
|
catch (error: any) {
|
|
114
|
-
|
|
135
|
+
MoEngageLogger.error(error?.message);
|
|
115
136
|
return false;
|
|
116
137
|
}
|
|
117
138
|
}
|
|
@@ -153,7 +174,7 @@ export function isSelfHandledCampaignValid(obj: { [k: string]: any }) {
|
|
|
153
174
|
}
|
|
154
175
|
}
|
|
155
176
|
catch (error: any) {
|
|
156
|
-
|
|
177
|
+
MoEngageLogger.error(error?.message);
|
|
157
178
|
return false;
|
|
158
179
|
}
|
|
159
180
|
}
|
|
@@ -171,7 +192,7 @@ export function isNavigationValid(obj: { [k: string]: any }) {
|
|
|
171
192
|
}
|
|
172
193
|
}
|
|
173
194
|
catch (error: any) {
|
|
174
|
-
|
|
195
|
+
MoEngageLogger.error(error?.message);
|
|
175
196
|
return false;
|
|
176
197
|
}
|
|
177
198
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
1
2
|
import MoEAccountMeta from "../models/MoEAccountMeta";
|
|
2
3
|
import MoEPushCampaign from "../models/MoEPushCampaign";
|
|
3
4
|
import MoEPushPayload from "../models/MoEPushPayload";
|
|
4
5
|
import MoEPushToken from "../models/MoEPushToken";
|
|
5
|
-
import { APP_ID, MOE_CLICKED_ACTION, MOE_IS_DEFAULT_ACTION, MOE_PAYLOAD, MOE_PLATFORM, MOE_PUSH_CAMPAIGN_OBJ_ERROR, MOE_PUSH_SERVICE, MOE_PUSH_TOKEN_OBJ_ERROR, MOE_TOKEN } from "../utils/MoEConstants";
|
|
6
|
+
import { APP_ID, MOE_CLICKED_ACTION, MOE_IS_DEFAULT_ACTION, MOE_PAYLOAD, MOE_PLATFORM, MOE_PUSH_CAMPAIGN_OBJ_ERROR, MOE_PUSH_SERVICE, MOE_PUSH_TOKEN_OBJ_ERROR, MOE_TOKEN, SELF_HANDLED_PUSH_REDIRECTION_KEY } from "../utils/MoEConstants";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -19,7 +20,7 @@ export function isPushTokenValid(tokenPayload: { [k: string]: any }) {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
catch (error: any) {
|
|
22
|
-
|
|
23
|
+
MoEngageLogger.error(error?.message);
|
|
23
24
|
return false;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -54,7 +55,7 @@ export function isPushCampaignObjectValid(pushPayload: { [k: string]: any }) {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
catch (error: any) {
|
|
57
|
-
|
|
58
|
+
MoEngageLogger.error(error?.message);
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -68,7 +69,10 @@ export function getMoEPushPayload(pushPayload: { [k: string]: any },accountMetaP
|
|
|
68
69
|
var payload = pushPayload[MOE_PAYLOAD];
|
|
69
70
|
var isDefaultAction = pushPayload[MOE_IS_DEFAULT_ACTION];
|
|
70
71
|
var clickAction = pushPayload[MOE_CLICKED_ACTION];
|
|
71
|
-
var
|
|
72
|
+
var selfHandledPushRedirection = SELF_HANDLED_PUSH_REDIRECTION_KEY in pushPayload
|
|
73
|
+
? pushPayload[SELF_HANDLED_PUSH_REDIRECTION_KEY]
|
|
74
|
+
: false;
|
|
75
|
+
var pushCampaignPayload = new MoEPushCampaign(payload, isDefaultAction, clickAction, selfHandledPushRedirection);
|
|
72
76
|
var accountMeta = new MoEAccountMeta(accountMetaPayload[APP_ID])
|
|
73
77
|
var platform = pushPayload[MOE_PLATFORM];
|
|
74
78
|
return new MoEPushPayload(accountMeta, pushCampaignPayload,platform);
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
1
2
|
import { MoEngagePermissionType } from "../models/MoEngagePermissionType";
|
|
2
|
-
import {
|
|
3
|
-
getAdIdTrackingJson,
|
|
4
|
-
getAndroidIdTrackingJson,
|
|
5
|
-
getAppIdJson,
|
|
6
|
-
getMoEPushCampaignJson,
|
|
7
|
-
getMoEPushTokenJson,
|
|
8
|
-
getOptOutTrackingJson,
|
|
9
|
-
getPermissionResponseJson,
|
|
10
|
-
getSdkStateJson
|
|
11
|
-
} from "../utils/MoEJsonBuilder";
|
|
3
|
+
import { getPermissionResponseJson } from "../utils/MoEJsonBuilder";
|
|
12
4
|
|
|
13
5
|
const MoEReactBridge = require("react-native").NativeModules.MoEReactBridge;
|
|
14
|
-
const PLATFORM_ANDROID = "android";
|
|
15
6
|
|
|
16
7
|
export class MoERNAndroid {
|
|
17
8
|
static initialize(payload: { [k: string]: any }) {
|
|
@@ -96,7 +87,7 @@ export class MoERNAndroid {
|
|
|
96
87
|
|
|
97
88
|
static validateSDKVersion() {
|
|
98
89
|
MoEReactBridge.validateSdkVersion().catch((error: Error) => {
|
|
99
|
-
|
|
90
|
+
MoEngageLogger.error(error.message);
|
|
100
91
|
});
|
|
101
92
|
}
|
|
102
93
|
|
|
@@ -116,7 +107,7 @@ export class MoERNAndroid {
|
|
|
116
107
|
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
117
108
|
}
|
|
118
109
|
|
|
119
|
-
static disableAdIdTracking(payload: { [k: string]: any }) {
|
|
110
|
+
static disableAdIdTracking(payload: { [k: string]: any }) {
|
|
120
111
|
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
121
112
|
}
|
|
122
113
|
|
|
@@ -155,7 +146,4 @@ export class MoERNAndroid {
|
|
|
155
146
|
static disableDeviceIdTracking(payload: { [k: string]: any }) {
|
|
156
147
|
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
157
148
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const PUSH_SERVICE_FCM = "FCM"
|
|
161
|
-
const PUSH_SERVICE_PUSH_KIT = "PUSH_KIT"
|
|
149
|
+
}
|
package/src/platform/MoERNiOS.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
2
2
|
|
|
3
3
|
const MoEReactBridge = require("react-native").NativeModules.MoEReactBridge;
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ export class MoERNiOS {
|
|
|
65
65
|
|
|
66
66
|
static validateSDKVersion() {
|
|
67
67
|
MoEReactBridge.validateSDKVersion().catch((error: Error) => {
|
|
68
|
-
|
|
68
|
+
MoEngageLogger.error(error.message);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MoEngageLogLevel } from "../models/MoEngageLogConfig"
|
|
2
|
+
|
|
1
3
|
export const MOE_PLATFORM = 'platform'
|
|
2
4
|
export const MOE_PAYLOAD = 'payload'
|
|
3
5
|
export const MOE_DATA = 'data'
|
|
@@ -59,3 +61,17 @@ export const USER_ATTRIBUTE_USER_LOCATION = 'USER_ATTRIBUTE_USER_LOCATION';
|
|
|
59
61
|
export const MOE_PERMISSION_TYPE = "type";
|
|
60
62
|
export const MOE_PERMISSION_STATE = "isGranted";
|
|
61
63
|
|
|
64
|
+
// INIT CONFIG
|
|
65
|
+
export const KEY_MOE_CONFIG = "config";
|
|
66
|
+
export const KEY_PUSH_CONFIG = "pushConfig";
|
|
67
|
+
|
|
68
|
+
// PUSH CLICK KEY
|
|
69
|
+
export const SELF_HANDLED_PUSH_REDIRECTION_KEY = "selfHandledPushRedirection";
|
|
70
|
+
|
|
71
|
+
// Default Log Level For MoEngage React Plugin
|
|
72
|
+
export const DEFAULT_CONFIG_LOG_LEVEL = MoEngageLogLevel.INFO;
|
|
73
|
+
|
|
74
|
+
// Default Logging For Production Build
|
|
75
|
+
export const DEFAULT_CONFIG_RELEASE_BUILD_LOG_ENABLED = false;
|
|
76
|
+
|
|
77
|
+
|
|
@@ -5,6 +5,8 @@ import MoESelfHandledCampaignData from "../models/MoESelfHandledCampaignData";
|
|
|
5
5
|
import { MOE_LOCATION } from "./MoEConstants";
|
|
6
6
|
import { MoEPropertiesToJson} from "./MoEObjectToJson";
|
|
7
7
|
import {MoEngagePermissionType} from "../models/MoEngagePermissionType";
|
|
8
|
+
import MoEInitConfig from "../models/MoEInitConfig";
|
|
9
|
+
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
8
10
|
|
|
9
11
|
export function getInAppCampaignJson(moEInAppData: MoEInAppData, type: string, appId: String) {
|
|
10
12
|
var json: { [k: string]: any } = {
|
|
@@ -36,7 +38,7 @@ export function getSelfHandledJson(moESelfHandledCampaignData: MoESelfHandledCam
|
|
|
36
38
|
platform: moESelfHandledCampaignData.platform
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
MoEngageLogger.verbose("getSelfHandledJson(): payload json: ", json);
|
|
40
42
|
return json;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -250,4 +252,18 @@ export function getDeviceIdTrackingJson(isDeviceIdTrackingEnabled: Boolean, appI
|
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
254
|
return json;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function getInitConfigJson(appId: String, initConfig: MoEInitConfig) {
|
|
258
|
+
var json: { [k: string]: any } = {
|
|
259
|
+
accountMeta: {
|
|
260
|
+
appId: appId
|
|
261
|
+
},
|
|
262
|
+
initConfig: {
|
|
263
|
+
pushConfig: {
|
|
264
|
+
shouldDeliverCallbackOnForegroundClick: initConfig.pushConfig.shouldDeliverCallbackOnForegroundClick
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return json;
|
|
253
269
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import MoEInitConfig from "../models/MoEInitConfig";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* In Memory Cache for Plugin
|
|
5
|
+
*/
|
|
6
|
+
namespace MoEngageGlobalCache {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Plugin Init Config
|
|
10
|
+
*/
|
|
11
|
+
let initConfig: MoEInitConfig = MoEInitConfig.defaultConfig();
|
|
12
|
+
|
|
13
|
+
export function updateInitConfig(updatedConfig: MoEInitConfig) {
|
|
14
|
+
initConfig = updatedConfig;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getInitConfig(): MoEInitConfig {
|
|
18
|
+
return initConfig;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default MoEngageGlobalCache;
|