react-native-moengage 10.1.0 → 10.2.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 +11 -0
- package/ReactNativeMoEngage.podspec +1 -1
- package/android/build.gradle +3 -3
- 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 +1 -1
- package/src/index.ts +2 -1
- package/src/models/MoEProperties.ts +3 -8
- package/src/models/MoESupportedAttributes.ts +6 -0
- package/src/utils/MoEJsonBuilder.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# 03-07-2024
|
|
2
|
+
|
|
3
|
+
## 10.2.0
|
|
4
|
+
|
|
5
|
+
- Support for JSONArray and JSONObject in Event & User Attributes.
|
|
6
|
+
- Support for forcing SDK to a specific MoEngage Environment.
|
|
7
|
+
|
|
8
|
+
- Android
|
|
9
|
+
- `moe-android-sdk` version updated to `13.02.00`
|
|
10
|
+
- `inapp` version updated to `8.3.1`
|
|
11
|
+
|
|
1
12
|
# 16-05-2024
|
|
2
13
|
|
|
3
14
|
## 10.1.0
|
|
@@ -15,7 +15,7 @@ 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.
|
|
18
|
+
s.dependency 'MoEngagePluginBase','>= 4.9.0','< 4.10.0'
|
|
19
19
|
s.ios.dependency 'MoEngageRichNotification','>= 7.16.0','< 7.17.0'
|
|
20
20
|
|
|
21
21
|
s.prepare_command = <<-CMD
|
package/android/build.gradle
CHANGED
|
@@ -20,9 +20,9 @@ rootProject.allprojects {
|
|
|
20
20
|
|
|
21
21
|
ext {
|
|
22
22
|
//dependency version
|
|
23
|
-
moengageCoreVersion = "13.
|
|
24
|
-
moengageInAppVersion = "8.3.
|
|
25
|
-
basePluginVersion = "4.0.
|
|
23
|
+
moengageCoreVersion = "13.02.00"
|
|
24
|
+
moengageInAppVersion = "8.3.1"
|
|
25
|
+
basePluginVersion = "4.0.2"
|
|
26
26
|
//build versions
|
|
27
27
|
minimumVersion = 21
|
|
28
28
|
compileVersion = 33
|
|
@@ -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.2.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": [
|
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 +
|
|
@@ -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
|
}
|
|
@@ -123,7 +123,7 @@ export function getAppStatusJson(appStatus: String, appId: String) {
|
|
|
123
123
|
return JSON.stringify(json);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export function getUserAttributeJson(name: String, value:
|
|
126
|
+
export function getUserAttributeJson(name: String, value: MoESupportedAttributes, type: String, appId: String) {
|
|
127
127
|
var json: { [k: string]: any } = {
|
|
128
128
|
accountMeta: {
|
|
129
129
|
appId: appId
|