react-native-moengage 10.1.0 → 10.3.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.
- package/CHANGELOG.md +24 -0
- package/ReactNativeMoEngage.podspec +2 -2
- package/android/build.gradle +6 -6
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/iOS/MoEReactBridge/MoEngageInitializer.h +5 -0
- package/iOS/MoEReactBridge/MoEngageInitializer.m +12 -0
- package/iOS/MoEReactBridge/MoEngageReactSDKInitializationConfig.h +29 -0
- package/iOS/MoEReactBridge/MoEngageReactSDKInitializationConfig.m +31 -0
- package/package.json +3 -3
- package/src/index.ts +3 -2
- package/src/models/MoEProperties.ts +3 -8
- package/src/models/MoESupportedAttributes.ts +6 -0
- package/src/moeParser/MoEInAppParser.ts +0 -3
- package/src/moeParser/MoEngagePayloadParser.ts +2 -2
- package/src/utils/MoEJsonBuilder.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# 31-07-2024
|
|
2
|
+
|
|
3
|
+
## 10.3.0
|
|
4
|
+
- Fixing the typescript configuration warnings.
|
|
5
|
+
- Android
|
|
6
|
+
- `moe-android-sdk` version updated to `13.04.00`
|
|
7
|
+
- `inapp` version updated to `8.5.0`
|
|
8
|
+
- Added support for AGP `8.4.0` and above
|
|
9
|
+
- Kotlin version updated to `1.9.23`
|
|
10
|
+
- Compile SDK version updated to `34`
|
|
11
|
+
- iOS
|
|
12
|
+
- MoEngage-iOS-SDK version updated to `~>9.18.0`.
|
|
13
|
+
|
|
14
|
+
# 03-07-2024
|
|
15
|
+
|
|
16
|
+
## 10.2.0
|
|
17
|
+
|
|
18
|
+
- Support for JSONArray and JSONObject in Event & User Attributes.
|
|
19
|
+
- Support for forcing SDK to a specific MoEngage Environment.
|
|
20
|
+
|
|
21
|
+
- Android
|
|
22
|
+
- `moe-android-sdk` version updated to `13.02.00`
|
|
23
|
+
- `inapp` version updated to `8.3.1`
|
|
24
|
+
|
|
1
25
|
# 16-05-2024
|
|
2
26
|
|
|
3
27
|
## 10.1.0
|
|
@@ -15,8 +15,8 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.platforms = { :ios => "11.0", :tvos => "11.0" }
|
|
16
16
|
s.source_files = 'iOS/MoEReactBridge/**/*.{h,m,mm}'
|
|
17
17
|
s.dependency 'React'
|
|
18
|
-
s.dependency 'MoEngagePluginBase','>= 4.
|
|
19
|
-
s.ios.dependency '
|
|
18
|
+
s.dependency 'MoEngagePluginBase','>= 4.10.0','< 4.11.0'
|
|
19
|
+
s.ios.dependency 'MoEngage-iOS-SDK/RichNotification'
|
|
20
20
|
|
|
21
21
|
s.prepare_command = <<-CMD
|
|
22
22
|
echo // Generated file, do not edit > iOS/MoEReactBridge/MoEngageReactPluginInfo.h
|
package/android/build.gradle
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
ext.kotlinVersion = '1.
|
|
2
|
+
ext.kotlinVersion = '1.9.23'
|
|
3
3
|
repositories {
|
|
4
4
|
google()
|
|
5
5
|
mavenCentral()
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
9
|
+
classpath 'com.android.tools.build:gradle:8.4.0'
|
|
10
10
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -20,12 +20,12 @@ rootProject.allprojects {
|
|
|
20
20
|
|
|
21
21
|
ext {
|
|
22
22
|
//dependency version
|
|
23
|
-
moengageCoreVersion = "13.
|
|
24
|
-
moengageInAppVersion = "8.
|
|
25
|
-
basePluginVersion = "4.
|
|
23
|
+
moengageCoreVersion = "13.04.00"
|
|
24
|
+
moengageInAppVersion = "8.5.0"
|
|
25
|
+
basePluginVersion = "4.1.0"
|
|
26
26
|
//build versions
|
|
27
27
|
minimumVersion = 21
|
|
28
|
-
compileVersion =
|
|
28
|
+
compileVersion = 34
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
apply plugin: 'com.android.library'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#Thu Aug 18 13:23:11 IST 2022
|
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
|
|
4
4
|
distributionPath=wrapper/dists
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
#import <UIKit/UIKit.h>
|
|
10
10
|
|
|
11
11
|
@protocol SFSafariViewControllerDelegate;
|
|
12
|
+
@class MoEngageReactSDKInitializationConfig;
|
|
12
13
|
#import <MoEngageSDK/MoEngageSDK.h>
|
|
13
14
|
|
|
14
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -31,6 +32,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
31
32
|
/// @warning Make sure to call only one of the initialization methods available (either with plist OR with MOSDKConfig instance)
|
|
32
33
|
/// @version 8.1.0 and above
|
|
33
34
|
- (void)initializeDefaultSDKConfigWithState:(MoEngageSDKConfig*)sdkConfig withSDKState:(MoEngageSDKState)sdkState andLaunchOptions:(NSDictionary*)launchOptions;
|
|
35
|
+
|
|
36
|
+
/// Initialize SDK with MoEngageReactSDKInitializationConfig instance.
|
|
37
|
+
/// @param reactConfig MoEngageSDKConfig instance for SDK configuration
|
|
38
|
+
- (void)initializeInstance:(MoEngageReactSDKInitializationConfig*)reactConfig;
|
|
34
39
|
@end
|
|
35
40
|
|
|
36
41
|
NS_ASSUME_NONNULL_END
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#import <MoEngageSDK/MoEngageSDK.h>
|
|
13
13
|
#import <MoEngageObjCUtils/MoEngageObjCUtils.h>
|
|
14
14
|
#import "MoEReactNativeHandler.h"
|
|
15
|
+
#import "MoEngageReactSDKInitializationConfig.h"
|
|
15
16
|
|
|
16
17
|
@import MoEngagePluginBase;
|
|
17
18
|
|
|
@@ -42,6 +43,17 @@
|
|
|
42
43
|
[self commonSetUp: plugin identifier:sdkConfig.appId];
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
- (void)initializeInstance:(MoEngageReactSDKInitializationConfig*)reactConfig {
|
|
47
|
+
MoEngageSDKInitializationConfig *config = [[MoEngageSDKInitializationConfig alloc] initWithSdkConfig:reactConfig.sdkConfig];
|
|
48
|
+
config.isTestEnvironment = reactConfig.isTestEnvironment;
|
|
49
|
+
config.sdkState = reactConfig.sdkState;
|
|
50
|
+
config.launchOptions = reactConfig.launchOptions;
|
|
51
|
+
config.isDefaultInstance = reactConfig.isDefaultInstance;
|
|
52
|
+
MoEngagePlugin *plugin = [[MoEngagePlugin alloc] init];
|
|
53
|
+
[plugin initializeInstanceWithConfig:config];
|
|
54
|
+
[self commonSetUp: plugin identifier:config.sdkConfig.appId];
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
#pragma mark- Utils
|
|
46
58
|
|
|
47
59
|
- (void)commonSetUp:(MoEngagePlugin *)plugin identifier:(NSString*)identifier {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MoEngageReactSDKInitializationConfig.h
|
|
3
|
+
// ReactNativeMoEngage
|
|
4
|
+
//
|
|
5
|
+
// Created by Babul on 24/06/24.
|
|
6
|
+
|
|
7
|
+
#import <Foundation/Foundation.h>
|
|
8
|
+
@class MoEngageSDKConfig;
|
|
9
|
+
|
|
10
|
+
@interface MoEngageReactSDKInitializationConfig : NSObject
|
|
11
|
+
|
|
12
|
+
/// The SDK configuration to be used.
|
|
13
|
+
@property (nonatomic, readonly, strong) MoEngageSDKConfig * _Nonnull sdkConfig;
|
|
14
|
+
/// The state of SDK.
|
|
15
|
+
/// By default, state is enabled.
|
|
16
|
+
@property (nonatomic) enum MoEngageSDKState sdkState;
|
|
17
|
+
/// The app launch options.
|
|
18
|
+
/// By default, no launch options set..
|
|
19
|
+
@property (nonatomic, copy) NSDictionary<UIApplicationLaunchOptionsKey, id> * _Nullable launchOptions;
|
|
20
|
+
@property (nonatomic) BOOL isTestEnvironment;
|
|
21
|
+
/// Whether the initialized SDK instance is default instance.
|
|
22
|
+
/// By default. set as <code>true</code>.
|
|
23
|
+
@property (nonatomic) BOOL isDefaultInstance;
|
|
24
|
+
/// Creates a new initialization configuration with provided SDK configuration and default options.
|
|
25
|
+
/// \param sdkConfig The SDK configuration to be used
|
|
26
|
+
///
|
|
27
|
+
- (nonnull instancetype)initWithSdkConfig:(MoEngageSDKConfig * _Nonnull)sdkConfig;
|
|
28
|
+
@end
|
|
29
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// MoEngageReactSDKInitializationConfig.m
|
|
3
|
+
// ReactNativeMoEngage
|
|
4
|
+
//
|
|
5
|
+
// Created by Babul on 24/06/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import <MoEngageSDK/MoEngageSDK.h>
|
|
11
|
+
#import "MoEngageReactSDKInitializationConfig.h"
|
|
12
|
+
|
|
13
|
+
@implementation MoEngageReactSDKInitializationConfig
|
|
14
|
+
|
|
15
|
+
- (nonnull instancetype)initWithSdkConfig:(MoEngageSDKConfig * _Nonnull)sdkConfig {
|
|
16
|
+
self = [super init];
|
|
17
|
+
if (self) {
|
|
18
|
+
_sdkConfig = sdkConfig;
|
|
19
|
+
_sdkState = MoEngageSDKStateEnabled;
|
|
20
|
+
_launchOptions = nil;
|
|
21
|
+
#ifdef DEBUG
|
|
22
|
+
_isTestEnvironment = YES;
|
|
23
|
+
#else
|
|
24
|
+
_isTestEnvironment = NO;
|
|
25
|
+
#endif
|
|
26
|
+
_isDefaultInstance = YES;
|
|
27
|
+
}
|
|
28
|
+
return self;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-moengage",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "MoEngage is a mobile marketing automation company. This react-native SDK helps you track events, trigger smart notifications and in-apps, provides a drop-in Inbox Controller for notifications.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"events"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"test": "echo \"
|
|
27
|
+
"test": "echo \"Test cases not available\" && exit 0"
|
|
28
28
|
},
|
|
29
29
|
"author": {
|
|
30
30
|
"name": "MoEngage",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"
|
|
38
|
+
"react-native": "0.73.0"
|
|
39
39
|
},
|
|
40
40
|
"codegenConfig": {
|
|
41
41
|
"name": "NativeMoEngageSpec",
|
package/src/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ import MoEPushPayload from "../src/models/MoEPushPayload";
|
|
|
56
56
|
import MoEInAppData from "../src/models/MoEInAppData";
|
|
57
57
|
import { getUserDeletionData } from "../src/moeParser/MoEngagePayloadParser";
|
|
58
58
|
import { MoEngageNudgePosition } from "../src/models/MoEngageNudgePosition";
|
|
59
|
+
import { MoESupportedAttributes } from "./models/MoESupportedAttributes";
|
|
59
60
|
|
|
60
61
|
const PLATFORM_IOS = "ios";
|
|
61
62
|
const PLATFORM_ANDROID = "android";
|
|
@@ -311,7 +312,7 @@ var ReactMoE = {
|
|
|
311
312
|
* @param userAttributeName attribute name
|
|
312
313
|
* @param userAttributeValue attribute value
|
|
313
314
|
*/
|
|
314
|
-
setUserAttribute: function (userAttributeName: string, userAttributeValue:
|
|
315
|
+
setUserAttribute: function (userAttributeName: string, userAttributeValue: MoESupportedAttributes) {
|
|
315
316
|
MoEngageLogger.verbose(
|
|
316
317
|
"Will track user attribute [attributeName]: " +
|
|
317
318
|
userAttributeName +
|
|
@@ -720,7 +721,7 @@ var ReactMoE = {
|
|
|
720
721
|
try {
|
|
721
722
|
if (Platform.OS == PLATFORM_ANDROID) {
|
|
722
723
|
const deleteUserPayload = await MoEReactBridge.deleteUser(accountMetaJson);
|
|
723
|
-
return getUserDeletionData(deleteUserPayload);
|
|
724
|
+
return getUserDeletionData(deleteUserPayload as string);
|
|
724
725
|
} else {
|
|
725
726
|
MoEngageLogger.debug("This api is not supported on iOS platform.");
|
|
726
727
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
3
3
|
import { MoEGeoLocationToJson } from "../utils/MoEObjectToJson";
|
|
4
4
|
import MoEGeoLocation from "./MoEGeoLocation";
|
|
5
|
+
import { MoESupportedAttributes } from "./MoESupportedAttributes";
|
|
5
6
|
|
|
6
7
|
export default class MoEProperties {
|
|
7
8
|
private generalAttributes: { [k: string]: any }
|
|
@@ -33,19 +34,13 @@ export default class MoEProperties {
|
|
|
33
34
|
/**
|
|
34
35
|
* Call this method to add general attributes
|
|
35
36
|
* @param {String}key : key for the attribute
|
|
36
|
-
* @param {
|
|
37
|
+
* @param {MoESupportedAttributes}value : value for the attribute
|
|
37
38
|
*/
|
|
38
|
-
addAttribute(key: String, value:
|
|
39
|
+
addAttribute(key: String, value: MoESupportedAttributes) {
|
|
39
40
|
|
|
40
41
|
if (!this.validateKeyValue(key, value)) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
|
-
if (Array.isArray(value)) {
|
|
44
|
-
value = (value as Array<any>).filter(e => (this.validateType(["string", "number"], e)));
|
|
45
|
-
} else if (!this.validateType(["string", "number", "boolean"], value)) {
|
|
46
|
-
MoEngageLogger.warn("MoEProperties->addAttribute: invalid attribute");
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
44
|
|
|
50
45
|
this.generalAttributes[key.toString()] = value;
|
|
51
46
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
2
|
-
import MoEAccountMeta from "../models/MoEAccountMeta";
|
|
3
2
|
import MoECampaignContext from "../models/MoECampaignContext";
|
|
4
3
|
import MoECampaignData from "../models/MoECampaignData";
|
|
5
4
|
import MoEClickData from "../models/MoEClickData";
|
|
@@ -10,7 +9,6 @@ import MoESelfHandledCampaign from "../models/MoESelfHandledCampaign";
|
|
|
10
9
|
import MoESelfHandledCampaignData from "../models/MoESelfHandledCampaignData";
|
|
11
10
|
import {
|
|
12
11
|
ACTION_TYPE,
|
|
13
|
-
APP_ID,
|
|
14
12
|
FORMATTED_CAMPAIGN_ID,
|
|
15
13
|
MOE_CAMPAIGN_CONTEXT,
|
|
16
14
|
MOE_CAMPAIGN_ID,
|
|
@@ -26,7 +24,6 @@ import {
|
|
|
26
24
|
MOE_PAYLOAD,
|
|
27
25
|
MOE_PLATFORM,
|
|
28
26
|
MOE_SELF_HANDLED,
|
|
29
|
-
MOE_SELF_HANDLED_OBJ_ERROR,
|
|
30
27
|
MOE_NAVIGATION_VALUE
|
|
31
28
|
} from "../utils/MoEConstants";
|
|
32
29
|
import { isValidObject } from "../utils/MoEHelper";
|
|
@@ -33,11 +33,11 @@ export function getMoEAccountMeta(payload: { [k: string]: any }): MoEAccountMeta
|
|
|
33
33
|
/**
|
|
34
34
|
* Create an instance of {@link UserDeletionData} from json object
|
|
35
35
|
*
|
|
36
|
-
* @param payload - JSON Object with required key
|
|
36
|
+
* @param payload - stringified JSON Object with required key
|
|
37
37
|
* @returns instance of {@link UserDeletionData}
|
|
38
38
|
* @since 8.6.0
|
|
39
39
|
*/
|
|
40
|
-
export function getUserDeletionData(payload:
|
|
40
|
+
export function getUserDeletionData(payload: string): UserDeletionData {
|
|
41
41
|
const payloadJsonObject = JSON.parse(payload);
|
|
42
42
|
return new UserDeletionData(
|
|
43
43
|
getMoEAccountMeta(payloadJsonObject[ACCOUNT_META]),
|
|
@@ -8,6 +8,7 @@ import {MoEngagePermissionType} from "../models/MoEngagePermissionType";
|
|
|
8
8
|
import MoEInitConfig from "../models/MoEInitConfig";
|
|
9
9
|
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
10
10
|
import {MoEngageNudgePosition} from "../models/MoEngageNudgePosition";
|
|
11
|
+
import { MoESupportedAttributes } from "../models/MoESupportedAttributes";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
export function getInAppCampaignJson(moEInAppData: MoEInAppData, type: string, appId: String) {
|
|
@@ -123,7 +124,7 @@ export function getAppStatusJson(appStatus: String, appId: String) {
|
|
|
123
124
|
return JSON.stringify(json);
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
export function getUserAttributeJson(name: String, value:
|
|
127
|
+
export function getUserAttributeJson(name: String, value: MoESupportedAttributes, type: String, appId: String) {
|
|
127
128
|
var json: { [k: string]: any } = {
|
|
128
129
|
accountMeta: {
|
|
129
130
|
appId: appId
|