react-native-moengage 7.4.1 → 8.1.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +72 -1
  2. package/ReactNativeMoEngage.podspec +3 -3
  3. package/android/build.gradle +11 -12
  4. package/android/gradle/wrapper/gradle-wrapper.properties +3 -3
  5. package/android/gradle.properties +0 -1
  6. package/android/src/main/java/com/moengage/react/EventEmitterImpl.kt +57 -22
  7. package/android/src/main/java/com/moengage/react/MoEInitializer.kt +44 -13
  8. package/android/src/main/java/com/moengage/react/MoEReactBridge.kt +116 -82
  9. package/android/src/main/java/com/moengage/react/MoEReactHelper.kt +2 -2
  10. package/android/src/main/java/com/moengage/react/PayloadGenerator.kt +41 -17
  11. package/iOS/MoEReactBridge/MoEReactBridge.h +1 -1
  12. package/iOS/MoEReactBridge/MoEReactBridge.m +34 -60
  13. package/iOS/MoEReactBridge/MoEngageInitializer.h +61 -0
  14. package/iOS/MoEReactBridge/MoEngageInitializer.m +164 -0
  15. package/iOS/MoEReactBridge/{MoEReactConstants.h → MoEngageReactConstants.h} +13 -3
  16. package/iOS/MoEReactBridge/{MoEReactConstants.m → MoEngageReactConstants.m} +14 -7
  17. package/iOS/MoEReactBridge/MoEngageReactPluginInfo.h +2 -0
  18. package/iOS/MoEReactBridge.xcodeproj/project.pbxproj +6 -6
  19. package/package.json +8 -3
  20. package/src/index.ts +196 -208
  21. package/src/models/MoEAccountMeta.ts +8 -0
  22. package/src/models/MoEAction.ts +4 -0
  23. package/src/models/MoEActionType.ts +4 -0
  24. package/src/models/MoECampaignContext.ts +10 -0
  25. package/src/models/MoECampaignData.ts +14 -0
  26. package/src/models/MoEClickData.ts +18 -0
  27. package/src/models/MoEGeoLocation.ts +2 -10
  28. package/src/models/MoEInAppCustomAction.ts +8 -13
  29. package/src/models/MoEInAppData.ts +16 -0
  30. package/src/models/MoEInAppNavigation.ts +14 -24
  31. package/src/models/MoENavigationType.ts +4 -0
  32. package/src/models/MoEPlatform.ts +4 -0
  33. package/src/models/MoEProperties.ts +19 -15
  34. package/src/models/MoEPushCampaign.ts +6 -22
  35. package/src/models/MoEPushPayload.ts +14 -0
  36. package/src/models/MoEPushService.ts +4 -4
  37. package/src/models/MoEPushToken.ts +6 -15
  38. package/src/models/MoESelfHandledCampaign.ts +10 -0
  39. package/src/models/MoESelfHandledCampaignData.ts +18 -0
  40. package/src/models/MoEngagePermissionType.ts +3 -0
  41. package/src/models/MoEngagePersimissionResultData.ts +14 -0
  42. package/src/moeParser/MoEInAppParser.ts +192 -0
  43. package/src/moeParser/MoEPushNotificationParser.ts +78 -0
  44. package/src/moeParser/MoEngagePayloadParser.ts +11 -0
  45. package/src/platform/MoERNAndroid.ts +62 -92
  46. package/src/platform/MoERNiOS.ts +27 -60
  47. package/src/utils/MoEConstants.ts +61 -0
  48. package/src/utils/MoEEventHandlerHelper.ts +47 -28
  49. package/src/utils/MoEJsonBuilder.ts +229 -0
  50. package/src/utils/MoEObjectToJson.ts +44 -0
  51. package/iOS/MoEReactBridge/MOReactInitializer.h +0 -46
  52. package/iOS/MoEReactBridge/MOReactInitializer.m +0 -172
  53. package/iOS/MoEReactBridge/MOReactPluginInfo.h +0 -2
  54. package/src/models/MoEInAppCampaign.ts +0 -46
  55. package/src/models/MoEInAppSelfHandledCampaign.ts +0 -34
@@ -0,0 +1,229 @@
1
+ import MoEClickData from "../models/MoEClickData";
2
+ import MoEInAppData from "../models/MoEInAppData";
3
+ import MoEProperties from "../models/MoEProperties";
4
+ import MoESelfHandledCampaignData from "../models/MoESelfHandledCampaignData";
5
+ import { MOE_LOCATION } from "./MoEConstants";
6
+ import { MoEPropertiesToJson} from "./MoEObjectToJson";
7
+ import {MoEngagePermissionType} from "../models/MoEngagePermissionType";
8
+
9
+ export function getInAppCampaignJson(moEInAppData: MoEInAppData, type: string, appId: String) {
10
+ var json: { [k: string]: any } = {
11
+ accountMeta: {
12
+ appId: appId
13
+ },
14
+ data: {
15
+ type: type,
16
+ campaignName: moEInAppData.campaignData.campaignName,
17
+ campaignId: moEInAppData.campaignData.campaignId,
18
+ campaignContext: moEInAppData.campaignData.context,
19
+ platform: moEInAppData.platform
20
+ }
21
+ }
22
+ return json;
23
+ }
24
+
25
+ export function getSelfHandledJson(moESelfHandledCampaignData: MoESelfHandledCampaignData, type: string, appId: String) {
26
+ var json: { [k: string]: any } = {
27
+ accountMeta: {
28
+ appId: appId
29
+ },
30
+ data: {
31
+ type: type,
32
+ campaignName: moESelfHandledCampaignData.campaignData.campaignName,
33
+ campaignId: moESelfHandledCampaignData.campaignData.campaignId,
34
+ campaignContext: moESelfHandledCampaignData.campaignData.context.attributes,
35
+ selfHandled: moESelfHandledCampaignData.campaign,
36
+ platform: moESelfHandledCampaignData.platform
37
+ }
38
+ }
39
+ console.log("getSelfHandledJson(): payload json: ", json)
40
+ return json;
41
+ }
42
+
43
+ export function getInAppClickDataJson(moEClickData: MoEClickData, type: string, appId: String) {
44
+ var json: { [k: string]: any } = {
45
+ accountMeta: {
46
+ appId: appId
47
+ },
48
+ data: {
49
+ type: type,
50
+ campaignName: moEClickData.campaignData.campaignName,
51
+ campaignId: moEClickData.campaignData.campaignId,
52
+ campaignContext: moEClickData.campaignData.context,
53
+ platform: moEClickData.platform
54
+ }
55
+ }
56
+ return json;
57
+ }
58
+
59
+ export function getMoEPropertiesJson(moEProperties: MoEProperties, eventName: String, appId: String) {
60
+ var json: { [k: string]: any } = {
61
+ accountMeta: {
62
+ appId: appId
63
+ },
64
+ data: {
65
+ ...MoEPropertiesToJson(moEProperties),
66
+ eventName,
67
+ }
68
+ }
69
+ return json;
70
+ }
71
+
72
+ export function getMoEPushCampaignJson(pushPayload: object, service: string, appId: String) {
73
+ var json: { [k: string]: any } = {
74
+ accountMeta: {
75
+ appId: appId
76
+ },
77
+ data: {
78
+ payload: pushPayload,
79
+ service:service
80
+ }
81
+ }
82
+ return json;
83
+ }
84
+
85
+ export function getMoEPushTokenJson(pushToken: string, pushService: string, platform: string, appId: String) {
86
+ var json: { [k: string]: any} = {
87
+ accountMeta: {
88
+ appId: appId
89
+ },
90
+ data: {
91
+ token: pushToken,
92
+ service: pushService,
93
+ platform: platform
94
+
95
+ }
96
+ }
97
+ return json;
98
+ }
99
+
100
+ export function getAliasJson(alias: String, appId: String) {
101
+ var json: { [k: string]: any } = {
102
+ accountMeta: {
103
+ appId: appId
104
+ },
105
+ data:
106
+ { alias: alias }
107
+ }
108
+ return json;
109
+ }
110
+ export function getAppStatusJson(appStatus: String, appId: String) {
111
+ var json: { [k: string]: any } = {
112
+ accountMeta: {
113
+ appId: appId
114
+ },
115
+ data: {
116
+ appStatus: appStatus
117
+ }
118
+ }
119
+ return json;
120
+ }
121
+
122
+ export function getUserAttributeJson(name: String, value: String | object, type: String, appId: String) {
123
+ var json: { [k: string]: any } = {
124
+ accountMeta: {
125
+ appId: appId
126
+ },
127
+ data: {
128
+ attributeName: name,
129
+ attributeValue: value,
130
+ type: type,
131
+ }
132
+ }
133
+ return json;
134
+ }
135
+ export function getUserLocAttributeJson(name: String, latitude: Number, longitude: Number, appId: String) {
136
+ var json: { [k: string]: any } = {
137
+ accountMeta: {
138
+ appId: appId
139
+ },
140
+ data: {
141
+ attributeName: name,
142
+ type: MOE_LOCATION,
143
+ locationAttribute: {
144
+ latitude: latitude,
145
+ longitude: longitude,
146
+ }
147
+ }
148
+ }
149
+ return json;
150
+ }
151
+
152
+ export function getInAppContextJson(contexts: Array<String>, appId: String) {
153
+ var json: { [k: string]: any } = {
154
+ accountMeta: {
155
+ appId: appId
156
+ },
157
+ data: {
158
+ contexts: contexts
159
+ }
160
+ }
161
+ return json;
162
+ }
163
+
164
+ export function getSdkStateJson(isSdkEnabled: Boolean, appId: String) {
165
+ var json: { [k: string]: any } = {
166
+ accountMeta: {
167
+ appId: appId
168
+ },
169
+ data: {
170
+ isSdkEnabled: isSdkEnabled,
171
+
172
+ }
173
+ }
174
+ return json;
175
+ }
176
+
177
+ export function getAdIdTrackingJson(isAdIdTrackingEnabled: Boolean, appId: String) {
178
+ var json: { [k: string]: any } = {
179
+ accountMeta: {
180
+ appId: appId
181
+ },
182
+ data: {
183
+ isAdIdTrackingEnabled: isAdIdTrackingEnabled,
184
+ }
185
+ }
186
+ return json;
187
+ }
188
+
189
+ export function getAndroidIdTrackingJson(isAndroidIdTrackingEnabled: Boolean, appId: String) {
190
+ var json: { [k: string]: any } = {
191
+ accountMeta: {
192
+ appId: appId
193
+ },
194
+ data: {
195
+ isAndroidIdTrackingEnabled: isAndroidIdTrackingEnabled
196
+ }
197
+ }
198
+ return json;
199
+ }
200
+
201
+ export function getAppIdJson(appId: String) {
202
+ var json: { [k: string]: any } = {
203
+ accountMeta: {
204
+ appId: appId
205
+ }
206
+ }
207
+ return json;
208
+ }
209
+
210
+ export function getOptOutTrackingJson(type: string, state: boolean, appId: string) {
211
+ var json: { [k: string]: any } = {
212
+ accountMeta: {
213
+ appId: appId
214
+ },
215
+ data: {
216
+ type: type,
217
+ state: state
218
+ }
219
+ }
220
+ return json;
221
+ }
222
+
223
+ export function getPermissionResponseJson(isGranted: boolean, permissionType: MoEngagePermissionType) {
224
+ let json: { [k: string]: any } = {
225
+ isGranted: isGranted,
226
+ type: permissionType.toLowerCase()
227
+ }
228
+ return json;
229
+ }
@@ -0,0 +1,44 @@
1
+ import MoEGeoLocation from "../models/MoEGeoLocation";
2
+ import MoEInAppCustomAction from "../models/MoEInAppCustomAction";
3
+ import MoEProperties from "../models/MoEProperties";
4
+ import MoEPushCampaign from "../models/MoEPushCampaign";
5
+ import MoEPushToken from "../models/MoEPushToken";
6
+
7
+ export function MoEGeoLocationToJson(location: MoEGeoLocation) {
8
+ return {
9
+ latitude: location.latitude,
10
+ longitude: location.longitude,
11
+ };
12
+ }
13
+ export function MoEInAppCustomActionToJson(moEInAppCustomAction: MoEInAppCustomAction | undefined) {
14
+ return {
15
+ kvPair: moEInAppCustomAction?.keyValuePair,
16
+ };
17
+ }
18
+
19
+ export function MoEPropertiesToJson(moEProperties: MoEProperties) {
20
+ return {
21
+ eventAttributes: {
22
+ generalAttributes: moEProperties.getGeneralAttributes(),
23
+ locationAttributes: moEProperties.getLocationAttributess(),
24
+ dateTimeAttributes: moEProperties.getDateTimeAttributes(),
25
+ },
26
+ isNonInteractive: moEProperties.getIsNonInteractive(),
27
+ };
28
+ }
29
+
30
+ export function MoEPushCampaignToJson(moEPushCampaign: MoEPushCampaign) {
31
+ return {
32
+ payload: moEPushCampaign.payload,
33
+ isDefaultAction: moEPushCampaign.isDefaultAction,
34
+ clickAction: moEPushCampaign.clickAction,
35
+
36
+ };
37
+ }
38
+ export function MoEPushTokenToJson(MoEPushToken: MoEPushToken) {
39
+ return {
40
+ platform: MoEPushToken.platform,
41
+ service: MoEPushToken.pushService,
42
+ token: MoEPushToken.token,
43
+ };
44
+ }
@@ -1,46 +0,0 @@
1
- //
2
- // MOReactInitializer.h
3
- // ReactNativeMoEngage
4
- //
5
- // Created by Chengappa C D on 14/02/20.
6
- //
7
-
8
- #import <Foundation/Foundation.h>
9
- #import <UIKit/UIKit.h>
10
- #import <MoEngage/MoEngage.h>
11
- NS_ASSUME_NONNULL_BEGIN
12
-
13
- @interface MOReactInitializer : NSObject
14
-
15
- +(instancetype)sharedInstance;
16
-
17
- /// Initialization Methods to setup SDK with configuration parameters from Info.plist file
18
- /// @param launchOptions Launch Options dictionary
19
- /// @warning Make sure to call only one of the initialization methods available (either with plist OR with MOSDKConfig instance)
20
- /// @version 6.0.0 and above
21
- - (void)intializeSDKWithLaunchOptions:(NSDictionary*)launchOptions;
22
-
23
- /// Initialization Methods to setup SDK with configuration parameters from Info.plist file
24
- /// @param isSdkEnabled Bool indicating if SDK is Enabled/Disabled, refer (link)[https://docs.moengage.com/docs/gdpr-compliance-1#enabledisable-sdk] for more info
25
- /// @param launchOptions Launch Options dictionary
26
- /// @warning Make sure to call only one of the initialization methods available (either with plist OR with MOSDKConfig instance)
27
- /// @version 7.0.0 and above
28
- - (void)intializeSDKWithState:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions;
29
-
30
- /// Initialization Methods to setup SDK with MOSDKConfig instance instead of from Info.plist file
31
- /// @param sdkConfig MOSDKConfig instance for SDK configuration
32
- /// @param launchOptions Launch Options dictionary
33
- /// @warning Make sure to call only one of the initialization methods available (either with plist OR with MOSDKConfig instance)
34
- /// @version 7.0.0 and above
35
- - (void)intializeSDKWithConfig:(MOSDKConfig*)sdkConfig andLaunchOptions:(NSDictionary*)launchOptions;
36
-
37
- /// Initialization Methods to setup SDK with MOSDKConfig instance instead of from Info.plist file
38
- /// @param sdkConfig MOSDKConfig instance for SDK configuration
39
- /// @param isSdkEnabled Bool indicating if SDK is Enabled/Disabled, refer (link)[https://docs.moengage.com/docs/gdpr-compliance-1#enabledisable-sdk] for more info
40
- /// @param launchOptions Launch Options dictionary
41
- /// @warning Make sure to call only one of the initialization methods available (either with plist OR with MOSDKConfig instance)
42
- /// @version 7.0.0 and above
43
- - (void)intializeSDKWithConfig:(MOSDKConfig*)sdkConfig withSDKState:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions;
44
- @end
45
-
46
- NS_ASSUME_NONNULL_END
@@ -1,172 +0,0 @@
1
- //
2
- // MOReactInitializer.m
3
- // ReactNativeMoEngage
4
- //
5
- // Created by Chengappa C D on 14/02/20.
6
- //
7
-
8
- #import "MOReactInitializer.h"
9
- #import "MOReactPluginInfo.h"
10
- #import <MoEngage/MoEngage.h>
11
- #import <MoEPluginBase/MoEPluginBase.h>
12
- #import "MoEReactConstants.h"
13
- #import "MoEReactBridge.h"
14
-
15
- @interface MOReactInitializer() <MoEPluginBridgeDelegate>
16
-
17
- @end
18
-
19
- @implementation MOReactInitializer
20
-
21
- #pragma mark- Initialization
22
-
23
- +(instancetype)sharedInstance{
24
- static dispatch_once_t onceToken;
25
- static MOReactInitializer *instance;
26
- dispatch_once(&onceToken, ^{
27
- instance = [[MOReactInitializer alloc] init];
28
- });
29
- return instance;
30
- }
31
-
32
- // Client Exposed Method
33
- - (void)intializeSDKWithLaunchOptions:(NSDictionary*)launchOptions{
34
- [self intializeSDKWithState:true andLaunchOptions:launchOptions];
35
- }
36
-
37
- - (void)intializeSDKWithState:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions{
38
- MOSDKConfig *sdkConfig = [self fetchSDKConfig];
39
- [self intializeSDKWithConfig:sdkConfig withSDKState:isSdkEnabled andLaunchOptions:launchOptions];
40
- }
41
-
42
- - (void)intializeSDKWithConfig:(MOSDKConfig*)sdkConfig andLaunchOptions:(NSDictionary*)launchOptions{
43
- [self intializeSDKWithConfig:sdkConfig withSDKState:true andLaunchOptions:launchOptions];
44
- }
45
-
46
- - (void)intializeSDKWithConfig:(MOSDKConfig*)sdkConfig withSDKState:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions{
47
- [MoEPluginBridge sharedInstance].bridgeDelegate = self;
48
-
49
- if (sdkConfig.moeAppID == nil || sdkConfig == nil) {
50
- return;
51
- }
52
-
53
- sdkConfig.pluginIntegrationType = REACT_NATIVE;
54
- sdkConfig.pluginIntegrationVersion = MO_REACT_PLUGIN_VERSION;
55
-
56
- [[MoEPluginInitializer sharedInstance] initializeSDKWithConfig:sdkConfig withSDKState:isSdkEnabled andLaunchOptions:launchOptions];
57
- }
58
-
59
- -(MOSDKConfig*)fetchSDKConfig {
60
- NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
61
- MOSDKConfig *sdkConfig = [[MoEngage sharedInstance] getDefaultSDKConfiguration];
62
-
63
- if ( [infoDict objectForKey: kMoEngage] != nil && [infoDict objectForKey: kMoEngage] != [NSNull null]) {
64
- NSDictionary* moeDict = [infoDict objectForKey: kMoEngage];
65
- if ([moeDict objectForKey: kAppId] != nil && [moeDict objectForKey:kAppId] != [NSNull null]) {
66
-
67
- NSString *appId = [moeDict objectForKey: kAppId];
68
-
69
- if (appId.length > 0) {
70
- if (sdkConfig == nil) {
71
- sdkConfig = [[MOSDKConfig alloc] initWithAppID:appId];
72
- }
73
- else{
74
- sdkConfig.moeAppID = appId;
75
- }
76
- }
77
- else{
78
- NSLog(@"%@", kInvalidAppIdAlert);
79
- return nil;
80
- }
81
- }
82
-
83
- if ([moeDict objectForKey: kDataCenter] != nil && [moeDict objectForKey:kDataCenter] != [NSNull null]) {
84
- sdkConfig.moeDataCenter = [self getDataCenterFromString: [moeDict objectForKey: kDataCenter]];
85
- }
86
-
87
- if ([moeDict objectForKey:kAppGroupId] != nil && [moeDict objectForKey:kAppGroupId] != [NSNull null]) {
88
- sdkConfig.appGroupID = [moeDict objectForKey:kAppGroupId];
89
- }
90
-
91
- if ([moeDict objectForKey:kDisablePeriodicFlush] != nil && [moeDict objectForKey:kDisablePeriodicFlush] != [NSNull null]) {
92
- sdkConfig.analyticsDisablePeriodicFlush = [moeDict getBooleanForKey:kDisablePeriodicFlush];
93
- }
94
-
95
- if ([moeDict objectForKey:kPeriodicFlushDuration] != nil && [moeDict objectForKey:kPeriodicFlushDuration] != [NSNull null]) {
96
- sdkConfig.analyticsPeriodicFlushDuration = [moeDict getIntegerForKey:kPeriodicFlushDuration];
97
- }
98
-
99
- if ([moeDict objectForKey:kEncryptNetworkRequests] != nil && [moeDict objectForKey:kEncryptNetworkRequests] != [NSNull null]) {
100
- sdkConfig.encryptNetworkRequests = [moeDict getBooleanForKey:kEncryptNetworkRequests];
101
- }
102
-
103
- if ([moeDict objectForKey:kOptOutDataTracking] != nil && [moeDict objectForKey:kOptOutDataTracking] != [NSNull null]) {
104
- sdkConfig.optOutDataTracking = [moeDict getBooleanForKey:kOptOutDataTracking];
105
- }
106
-
107
- if ([moeDict objectForKey:kOptOutPushNotifications] != nil && [moeDict objectForKey:kOptOutPushNotifications] != [NSNull null]) {
108
- sdkConfig.optOutPushNotification = [moeDict getBooleanForKey:kOptOutPushNotifications];
109
- }
110
-
111
- if ([moeDict objectForKey:kOptOutInApp] != nil && [moeDict objectForKey:kOptOutInApp] != [NSNull null]) {
112
- sdkConfig.optOutInAppCampaign = [moeDict getBooleanForKey:kOptOutInApp];
113
- }
114
-
115
- if ([moeDict objectForKey:kOptOutIDFATracking] != nil && [moeDict objectForKey:kOptOutIDFATracking] != [NSNull null]) {
116
- sdkConfig.optOutIDFATracking = [moeDict getBooleanForKey:kOptOutIDFATracking];
117
- }
118
-
119
- if ([moeDict objectForKey:kOptOutIDFVTracking] != nil && [moeDict objectForKey:kOptOutIDFVTracking] != [NSNull null]) {
120
- sdkConfig.optOutIDFVTracking = [moeDict getBooleanForKey:kOptOutIDFVTracking];
121
- }
122
- }
123
-
124
- return sdkConfig;
125
- }
126
-
127
- - (MODataCenter)getDataCenterFromString:(NSString*)stringVal {
128
- MODataCenter dataCenter = DATA_CENTER_01;
129
-
130
- if ([stringVal isEqual:kDataCenter1])
131
- {
132
- dataCenter = DATA_CENTER_01;
133
- }
134
- else if ([stringVal isEqual:kDataCenter2])
135
- {
136
- dataCenter = DATA_CENTER_02;
137
- }
138
- else if ([stringVal isEqual:kDataCenter3])
139
- {
140
- dataCenter = DATA_CENTER_03;
141
- }
142
- else
143
- {
144
- NSLog(@"%@", kInvalidDataCenterAlert);
145
- }
146
-
147
- return dataCenter;
148
- }
149
-
150
- - (void)sendMessageWithName:(NSString *)name andPayload:(NSDictionary *)payloadDict {
151
- NSMutableDictionary* updatedDict = [NSMutableDictionary dictionary];
152
-
153
- if (payloadDict) {
154
- NSDictionary *payload = payloadDict[kPayload];
155
-
156
- NSError *err;
157
- NSData * jsonData = [NSJSONSerialization dataWithJSONObject:payload options:0 error:&err];
158
- if (jsonData) {
159
- NSString *strPayload = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
160
- updatedDict[kPayload] = strPayload;
161
- } else {
162
- NSLog(@"Error converting to dictionary to string %@", err.localizedDescription);
163
- }
164
- }
165
-
166
- NSDictionary* userInfo = @{kEventName:name,kPayloadDict:updatedDict};
167
- MoEReactBridge *reactBridge = [MoEReactBridge allocWithZone: nil];
168
- [reactBridge sendEventWithName:userInfo];
169
-
170
- }
171
-
172
- @end
@@ -1,2 +0,0 @@
1
- // Generated file, do not edit
2
- #define MO_REACT_PLUGIN_VERSION @"7.3.0"
@@ -1,46 +0,0 @@
1
- import MoEInAppCustomAction from "./MoEInAppCustomAction";
2
- import MoEInAppSelfHandledCampaign from "./MoEInAppSelfHandledCampaign";
3
- import MoEInAppNavigation from "./MoEInAppNavigation";
4
- import { isValidObject } from "../utils/MoEHelper";
5
-
6
- export default class MoEInAppCampaign {
7
- campaignId: String;
8
- campaignName: String;
9
- campaignContext: Map<String, Object>;
10
- customAction: MoEInAppCustomAction;
11
- selfHandled: MoEInAppSelfHandledCampaign;
12
- navigation: MoEInAppNavigation;
13
- platform: String;
14
-
15
- constructor(campaign: Object) {
16
- if (isValidObject(campaign)) {
17
- this.campaignId = campaign["campaignId"];
18
- this.campaignName = campaign["campaignName"];
19
- this.campaignContext = campaign["campaignContext"];
20
- this.platform = campaign["platform"];
21
- this.customAction = new MoEInAppCustomAction(campaign["customAction"]);
22
- this.selfHandled = new MoEInAppSelfHandledCampaign(
23
- campaign["selfHandled"]
24
- );
25
- this.navigation = new MoEInAppNavigation(campaign["navigation"]);
26
- }
27
- }
28
-
29
- toJSON(): Object {
30
- var json = {
31
- campaignId: this.campaignId,
32
- campaignName: this.campaignName,
33
- campaignContext: this.campaignContext,
34
- };
35
- if (isValidObject(this.customAction)) {
36
- json["customAction"] = this.customAction.toJSON();
37
- }
38
- if (isValidObject(this.selfHandled)) {
39
- json["selfHandled"] = this.selfHandled.toJSON();
40
- }
41
- if (isValidObject(this.navigation)) {
42
- json["navigation"] = this.navigation.toJSON();
43
- }
44
- return json;
45
- }
46
- }
@@ -1,34 +0,0 @@
1
- import {
2
- isValidObject,
3
- isValidString,
4
- isValidNumber,
5
- isValidBoolean,
6
- } from "../utils/MoEHelper";
7
-
8
- export default class MoEInAppSelfHandledCampaign {
9
- campaignContent: String;
10
- dismissInterval: Number;
11
- cancellable: Boolean;
12
-
13
- constructor(campaign: Object) {
14
- if (isValidObject(campaign)) {
15
- if (isValidString(campaign["payload"])) {
16
- this.campaignContent = campaign["payload"];
17
- }
18
- if (isValidNumber(campaign["dismissInterval"])) {
19
- this.dismissInterval = campaign["dismissInterval"];
20
- }
21
- if (isValidBoolean(campaign["isCancellable"])) {
22
- this.cancellable = campaign["isCancellable"];
23
- }
24
- }
25
- }
26
-
27
- toJSON() {
28
- return {
29
- payload: this.campaignContent,
30
- dismissInterval: this.dismissInterval,
31
- isCancellable: this.cancellable,
32
- };
33
- }
34
- }