react-native-moengage 8.5.3 → 8.6.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 +18 -0
- package/README.md +1 -8
- package/ReactNativeMoEngage.podspec +2 -2
- package/android/build.gradle +10 -10
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +2 -1
- package/android/src/main/java/com/moengage/react/MoEReactBridge.kt +22 -1
- package/package.json +1 -1
- package/src/index.ts +25 -3
- package/src/models/UserDeletionData.ts +27 -0
- package/src/moeParser/MoEInAppParser.ts +1 -5
- package/src/moeParser/MoEngagePayloadParser.ts +37 -1
- package/src/platform/MoERNAndroid.ts +15 -0
- package/src/utils/MoEConstants.ts +2 -1
- package/src/utils/MoEHelper.ts +1 -1
- package/src/utils/MoEJsonBuilder.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# 29-11-2023
|
|
2
|
+
|
|
3
|
+
## 8.6.0
|
|
4
|
+
- Support for tracking an array of numbers and strings in user attributes
|
|
5
|
+
- Android
|
|
6
|
+
- Added API to delete User details from MoEngage Server
|
|
7
|
+
- Add support for AGP `8.0.2` and above
|
|
8
|
+
- Upgrade Kotlin Version to 1.7.10
|
|
9
|
+
- iOS
|
|
10
|
+
- MoEngage-iOS-SDK version updated to `~>9.13.0`.
|
|
11
|
+
|
|
12
|
+
# 30-10-2023
|
|
13
|
+
|
|
14
|
+
## 8.5.4
|
|
15
|
+
- Android
|
|
16
|
+
- BugFix
|
|
17
|
+
- MoEngage SDK throwing incompatible version error on app open
|
|
18
|
+
|
|
1
19
|
# 31-08-2023
|
|
2
20
|
|
|
3
21
|
## 8.5.3
|
package/README.md
CHANGED
|
@@ -83,13 +83,6 @@ In case you are facing issues with the import add the below import statement in
|
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### iOS
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
NOTE :
|
|
89
|
-
Incase if you get errors in the test targets of the project, go to build settings of the test target and add -lc++ flag to Other Linker Flags as shown below :
|
|
90
|
-
|
|
91
|
-

|
|
92
|
-
|
|
93
|
-
Thats it!! SDK is successfully installed in the project, and ready to use.
|
|
86
|
+
There are no additional steps required for installation.
|
|
94
87
|
|
|
95
88
|
For more info on how to use react-native-moengage, refer to our developer docs: https://developers.moengage.com/hc/en-us/categories/4404199274900-React-Native-SDK
|
|
@@ -15,8 +15,8 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.platform = :ios, "11.0"
|
|
16
16
|
s.source_files = 'iOS/MoEReactBridge/**/*.{h,m}'
|
|
17
17
|
s.dependency 'React'
|
|
18
|
-
s.dependency 'MoEngagePluginBase','>= 4.
|
|
19
|
-
s.dependency 'MoEngageRichNotification','>= 7.
|
|
18
|
+
s.dependency 'MoEngagePluginBase','>= 4.5.0','< 4.6.0'
|
|
19
|
+
s.dependency 'MoEngageRichNotification','>= 7.12.0','< 7.13.0'
|
|
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.7.10'
|
|
3
3
|
repositories {
|
|
4
4
|
google()
|
|
5
5
|
mavenCentral()
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:
|
|
9
|
+
classpath 'com.android.tools.build:gradle:8.0.2'
|
|
10
10
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -20,9 +20,9 @@ rootProject.allprojects {
|
|
|
20
20
|
|
|
21
21
|
ext {
|
|
22
22
|
//dependency version
|
|
23
|
-
moengageCoreVersion = "12.
|
|
24
|
-
moengageInAppVersion = "
|
|
25
|
-
basePluginVersion = "3.
|
|
23
|
+
moengageCoreVersion = "12.10.00"
|
|
24
|
+
moengageInAppVersion = "7.1.0"
|
|
25
|
+
basePluginVersion = "3.4.0"
|
|
26
26
|
//build versions
|
|
27
27
|
minimumVersion = 21
|
|
28
28
|
targetVersion = 33
|
|
@@ -33,11 +33,11 @@ apply plugin: 'com.android.library'
|
|
|
33
33
|
apply plugin: 'kotlin-android'
|
|
34
34
|
|
|
35
35
|
android {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
compileSdk compileVersion
|
|
37
|
+
namespace "com.moengage.react"
|
|
38
38
|
defaultConfig {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
minSdk minimumVersion
|
|
40
|
+
targetSdk targetVersion
|
|
41
41
|
versionCode 1
|
|
42
42
|
versionName "1.0"
|
|
43
43
|
|
|
@@ -63,7 +63,7 @@ android {
|
|
|
63
63
|
dependencies {
|
|
64
64
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
|
67
67
|
|
|
68
68
|
compileOnly ("com.moengage:moe-android-sdk:$moengageCoreVersion")
|
|
69
69
|
api("com.moengage:plugin-base:$basePluginVersion")
|
|
@@ -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-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip
|
|
4
4
|
distributionPath=wrapper/dists
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
android.useAndroidX=true
|
|
1
|
+
android.useAndroidX=true
|
|
2
|
+
android.defaults.buildfeatures.buildconfig=true
|
|
@@ -12,6 +12,7 @@ import com.moengage.core.internal.utils.getSdkVersion
|
|
|
12
12
|
import com.moengage.core.listeners.AppBackgroundListener
|
|
13
13
|
import com.moengage.plugin.base.internal.PluginHelper
|
|
14
14
|
import com.moengage.plugin.base.internal.setEventEmitter
|
|
15
|
+
import com.moengage.plugin.base.internal.userDeletionDataToJson
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* @author Umang Chamaria
|
|
@@ -188,7 +189,7 @@ class MoEReactBridge(private val reactContext: ReactApplicationContext) :
|
|
|
188
189
|
@ReactMethod
|
|
189
190
|
fun validateSdkVersion(promise: Promise) {
|
|
190
191
|
Logger.print { "$tag validateSdkVersion() : Validating Version" }
|
|
191
|
-
if (moeSdkVersion >
|
|
192
|
+
if (moeSdkVersion > 130000) {
|
|
192
193
|
Logger.print(LogLevel.ERROR) { "$tag validateSdkVersion() : invalid version" }
|
|
193
194
|
promise.reject("error", "Use SDK version 12.x.xx")
|
|
194
195
|
} else {
|
|
@@ -273,4 +274,24 @@ class MoEReactBridge(private val reactContext: ReactApplicationContext) :
|
|
|
273
274
|
Logger.print(LogLevel.ERROR, t) { "$tag updatePushPermissionRequestCount() :" }
|
|
274
275
|
}
|
|
275
276
|
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* API to delete the user from MoEngage Server
|
|
280
|
+
|
|
281
|
+
* @param payload - required key-value pair
|
|
282
|
+
* @param promise - promise object which will be resolved based on success / failure
|
|
283
|
+
* @since 8.6.0
|
|
284
|
+
*/
|
|
285
|
+
@ReactMethod
|
|
286
|
+
fun deleteUser(payload: String, promise: Promise) {
|
|
287
|
+
try {
|
|
288
|
+
Logger.print { "$tag deleteUser() : Payload: $payload" }
|
|
289
|
+
pluginHelper.deleteUser(context, payload) { userDeletionData ->
|
|
290
|
+
promise.resolve(userDeletionDataToJson(userDeletionData).toString())
|
|
291
|
+
}
|
|
292
|
+
} catch (t: Throwable) {
|
|
293
|
+
Logger.print(LogLevel.ERROR, t) { "$tag deleteUser() :" }
|
|
294
|
+
promise.reject(t)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
276
297
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-moengage",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.6.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
|
@@ -48,6 +48,8 @@ import MoEngageLogConfig from "./models/MoEngageLogConfig";
|
|
|
48
48
|
import MoEngageLogLevel from "./models/MoEngageLogLevel";
|
|
49
49
|
import MoEngageGlobalCache from "./utils/MoEngageGlobalCache";
|
|
50
50
|
import MoEngageLogger from "./logger/MoEngageLogger";
|
|
51
|
+
import UserDeletionData from "./models/UserDeletionData";
|
|
52
|
+
import MoEAccountMeta from "./models/MoEAccountMeta";
|
|
51
53
|
|
|
52
54
|
const MoEReactBridge = require("react-native").NativeModules.MoEReactBridge;
|
|
53
55
|
const PLATFORM_ANDROID = "android";
|
|
@@ -303,7 +305,6 @@ var ReactMoE = {
|
|
|
303
305
|
commonValidationCheck();
|
|
304
306
|
MoEngageLogger.verbose("Will set Mobile Number: ", mobileNumber);
|
|
305
307
|
const payload = getUserAttributeJson(USER_ATTRIBUTE_USER_MOBILE, mobileNumber, GENERAL, moeAppId)
|
|
306
|
-
|
|
307
308
|
if (Platform.OS == PLATFORM_ANDROID) {
|
|
308
309
|
MoERNAndroid.setUserAttribute(payload);
|
|
309
310
|
} else if (Platform.OS == PLATFORM_IOS) {
|
|
@@ -367,7 +368,7 @@ var ReactMoE = {
|
|
|
367
368
|
* @param userAttributeName attribute name
|
|
368
369
|
* @param userAttributeValue attribute value
|
|
369
370
|
*/
|
|
370
|
-
setUserAttribute: function (userAttributeName: string, userAttributeValue:
|
|
371
|
+
setUserAttribute: function (userAttributeName: string, userAttributeValue: String | Number | Boolean | Array<String> | Array<Number>) {
|
|
371
372
|
commonValidationCheck();
|
|
372
373
|
MoEngageLogger.verbose(
|
|
373
374
|
"Will track user attribute [attributeName]: " +
|
|
@@ -797,8 +798,29 @@ var ReactMoE = {
|
|
|
797
798
|
if (Platform.OS == PLATFORM_ANDROID) {
|
|
798
799
|
MoERNAndroid.disableDeviceIdTracking(payload);
|
|
799
800
|
}
|
|
800
|
-
}
|
|
801
|
+
},
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Delete User Data From MoEngage Server
|
|
805
|
+
* Note: This API is only for Android platform and is a no-operation method for other plaforms.
|
|
806
|
+
*
|
|
807
|
+
* @return instance of {@link UserDeletionData}
|
|
808
|
+
* @since 8.6.0
|
|
809
|
+
*/
|
|
810
|
+
deleteUser: async function (): Promise<UserDeletionData> {
|
|
811
|
+
MoEngageLogger.verbose("Will delete user");
|
|
812
|
+
const accountMetaJson = getAppIdJson(moeAppId);
|
|
801
813
|
|
|
814
|
+
try {
|
|
815
|
+
if (Platform.OS == PLATFORM_ANDROID) {
|
|
816
|
+
return await MoERNAndroid.deleteUser(accountMetaJson);
|
|
817
|
+
}
|
|
818
|
+
} catch(error) {
|
|
819
|
+
MoEngageLogger.error(`deleteUser(): ${error}`)
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return new UserDeletionData(new MoEAccountMeta(moeAppId), false)
|
|
823
|
+
}
|
|
802
824
|
};
|
|
803
825
|
|
|
804
826
|
export {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import MoEAccountMeta from "./MoEAccountMeta";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delete User State Data while deleting the user from MoEngage SDK
|
|
5
|
+
*
|
|
6
|
+
* @author Abhishek Kumar
|
|
7
|
+
* @since 8.6.0
|
|
8
|
+
*/
|
|
9
|
+
export default class UserDeletionData {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Account Data, instance of {@link MoEAccountMeta}
|
|
13
|
+
* @since 8.6.0
|
|
14
|
+
*/
|
|
15
|
+
accountMeta: MoEAccountMeta;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* User State, true if user delete succeeded else false
|
|
19
|
+
* @since 8.6.0
|
|
20
|
+
*/
|
|
21
|
+
isSuccess: boolean;
|
|
22
|
+
|
|
23
|
+
constructor(accountMeta: MoEAccountMeta, isSuccess: boolean) {
|
|
24
|
+
this.accountMeta = accountMeta;
|
|
25
|
+
this.isSuccess = isSuccess;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
MOE_NAVIGATION_VALUE
|
|
31
31
|
} from "../utils/MoEConstants";
|
|
32
32
|
import { isValidObject } from "../utils/MoEHelper";
|
|
33
|
+
import { getMoEAccountMeta } from "./MoEngagePayloadParser";
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
@@ -52,11 +53,6 @@ export function isMoEInAppCampaignValid(obj: { [k: string]: any }) {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
function getMoEAccountMeta(accountMeta: { [k: string]: any }) {
|
|
57
|
-
return new MoEAccountMeta(accountMeta[APP_ID]);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
56
|
function getMoECampaignData(json: { [k: string]: any }) {
|
|
61
57
|
MoEngageLogger.verbose("getMoECampaignData(): Payload: ", json);
|
|
62
58
|
var campaignId = json[MOE_CAMPAIGN_ID];
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import MoEAccountMeta from "../models/MoEAccountMeta";
|
|
1
2
|
import MoEngagePersimissionResultData from "../models/MoEngagePersimissionResultData";
|
|
2
|
-
import
|
|
3
|
+
import UserDeletionData from "../models/UserDeletionData";
|
|
4
|
+
import {
|
|
5
|
+
ACCOUNT_META,
|
|
6
|
+
APP_ID,
|
|
7
|
+
IS_USER_DELETION_SUCCESS,
|
|
8
|
+
MOE_DATA,
|
|
9
|
+
MOE_PERMISSION_STATE,
|
|
10
|
+
MOE_PERMISSION_TYPE,
|
|
11
|
+
MOE_PLATFORM
|
|
12
|
+
} from "../utils/MoEConstants";
|
|
3
13
|
|
|
4
14
|
export function getPermissionResult(payload: { [k: string]: any }) {
|
|
5
15
|
return new MoEngagePersimissionResultData(
|
|
@@ -7,4 +17,30 @@ export function getPermissionResult(payload: { [k: string]: any }) {
|
|
|
7
17
|
payload[MOE_PERMISSION_STATE],
|
|
8
18
|
payload[MOE_PERMISSION_TYPE]
|
|
9
19
|
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Create an instance of {@link MoEAccountMeta} from json object
|
|
24
|
+
*
|
|
25
|
+
* @param payload - JSON Object with required key
|
|
26
|
+
* @returns instance of {@link MoEAccountMeta}
|
|
27
|
+
* @since 8.6.0
|
|
28
|
+
*/
|
|
29
|
+
export function getMoEAccountMeta(payload: { [k: string]: any }): MoEAccountMeta {
|
|
30
|
+
return new MoEAccountMeta(payload[APP_ID]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create an instance of {@link UserDeletionData} from json object
|
|
35
|
+
*
|
|
36
|
+
* @param payload - JSON Object with required key
|
|
37
|
+
* @returns instance of {@link UserDeletionData}
|
|
38
|
+
* @since 8.6.0
|
|
39
|
+
*/
|
|
40
|
+
export function getUserDeletionData(payload: string): UserDeletionData {
|
|
41
|
+
const payloadJsonObject = JSON.parse(payload);
|
|
42
|
+
return new UserDeletionData(
|
|
43
|
+
getMoEAccountMeta(payloadJsonObject[ACCOUNT_META]),
|
|
44
|
+
payloadJsonObject[MOE_DATA][IS_USER_DELETION_SUCCESS]
|
|
45
|
+
);
|
|
10
46
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import MoEngageLogger from "../logger/MoEngageLogger";
|
|
2
2
|
import { MoEngagePermissionType } from "../models/MoEngagePermissionType";
|
|
3
|
+
import UserDeletionData from "../models/UserDeletionData";
|
|
4
|
+
import { getUserDeletionData } from "../moeParser/MoEngagePayloadParser";
|
|
3
5
|
import { getPermissionResponseJson } from "../utils/MoEJsonBuilder";
|
|
4
6
|
|
|
5
7
|
const MoEReactBridge = require("react-native").NativeModules.MoEReactBridge;
|
|
@@ -146,4 +148,17 @@ export class MoERNAndroid {
|
|
|
146
148
|
static disableDeviceIdTracking(payload: { [k: string]: any }) {
|
|
147
149
|
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
148
150
|
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* API which connects with Android Native bridge to delete the current User
|
|
154
|
+
* from MoEngage Server.
|
|
155
|
+
*
|
|
156
|
+
* @param payload in required format to delete user
|
|
157
|
+
* @returns instance of {@link UserDeletionData}
|
|
158
|
+
* @since 8.6.0
|
|
159
|
+
*/
|
|
160
|
+
static async deleteUser(payload: { [k: string]: any }): Promise<UserDeletionData> {
|
|
161
|
+
const deleteUserPayload = await MoEReactBridge.deleteUser(JSON.stringify(payload));
|
|
162
|
+
return getUserDeletionData(deleteUserPayload);
|
|
163
|
+
}
|
|
149
164
|
}
|
|
@@ -74,4 +74,5 @@ export const DEFAULT_CONFIG_LOG_LEVEL = MoEngageLogLevel.INFO;
|
|
|
74
74
|
// Default Logging For Production Build
|
|
75
75
|
export const DEFAULT_CONFIG_RELEASE_BUILD_LOG_ENABLED = false;
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
// Key to get the user deletion state while deleting user from native bridge
|
|
78
|
+
export const IS_USER_DELETION_SUCCESS = "isUserDeletionSuccess";
|
package/src/utils/MoEHelper.ts
CHANGED
|
@@ -121,7 +121,7 @@ export function getAppStatusJson(appStatus: String, appId: String) {
|
|
|
121
121
|
return json;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export function getUserAttributeJson(name: String, value: String |
|
|
124
|
+
export function getUserAttributeJson(name: String, value: String | Number | Boolean | Array<String> | Array<Number>, type: String, appId: String) {
|
|
125
125
|
var json: { [k: string]: any } = {
|
|
126
126
|
accountMeta: {
|
|
127
127
|
appId: appId
|
|
@@ -134,6 +134,7 @@ export function getUserAttributeJson(name: String, value: String | object, type:
|
|
|
134
134
|
}
|
|
135
135
|
return json;
|
|
136
136
|
}
|
|
137
|
+
|
|
137
138
|
export function getUserLocAttributeJson(name: String, latitude: Number, longitude: Number, appId: String) {
|
|
138
139
|
var json: { [k: string]: any } = {
|
|
139
140
|
accountMeta: {
|