You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-native-moengage

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-moengage - npm Package Compare versions

Comparing version

to
11.2.0

11

CHANGELOG.md

@@ -0,1 +1,12 @@

# 24-03-2025
## 11.2.0
- Added support to identify user on multiple identities
- Android
- Added support for AGP `8.7.3` and above
- `moe-android-sdk` version updated to `13.06.00`
- `inapp` version updated to `8.8.0`
- iOS
- `MoEngage-iOS-SDK` version updated to `9.23.1`
# 11-03-2025

@@ -2,0 +13,0 @@

11

package.json
{
"name": "react-native-moengage",
"version": "11.1.4",
"version": "11.2.0",
"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.",

@@ -27,3 +27,3 @@ "main": "src/index.ts",

"scripts": {
"test": "echo \"Test cases not available\" && exit 0"
"test": "jest"
},

@@ -39,3 +39,6 @@ "author": {

"devDependencies": {
"react-native": "0.73.0"
"react-native": "0.73.0",
"@types/jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^4.3.0"
},

@@ -50,2 +53,2 @@ "codegenConfig": {

}
}
}

@@ -29,3 +29,4 @@ import { NativeEventEmitter, Platform } from "react-native";

getPermissionResponseJson,
getNudgeDisplayJson
getNudgeDisplayJson,
getIdentifyUserPayload
} from "./utils/MoEJsonBuilder";

@@ -58,3 +59,3 @@ import {

import MoEInAppData from "../src/models/MoEInAppData";
import { getUserDeletionData } from "../src/moeParser/MoEngagePayloadParser";
import { getUserDeletionData, getUserIdentitiesData } from "../src/moeParser/MoEngagePayloadParser";
import { MoEngageNudgePosition } from "../src/models/MoEngageNudgePosition";

@@ -208,4 +209,7 @@ import MoEAnalyticsConfig from "../src/models/MoEAnalyticsConfig";

* @param uniqueId unique id to be set
*
* @deprecated This function is deprecated in favour of identifyUser(). This function will be removed in 13.0.0"
*/
setUserUniqueID: function (uniqueId: string) {
MoEngageLogger.warn("Deprecated function usage `setUserUniqueID`, use `identifyUser`");
MoEngageLogger.verbose("Will set unique ID: ", uniqueId);

@@ -219,4 +223,7 @@ const payload = getUserAttributeJson(USER_ATTRIBUTE_UNIQUE_ID, uniqueId, GENERAL, moeAppId);

* @param alias updated unique id.
*
* @deprecated This function is deprecated in favour of identifyUser(). This function will be removed in 13.0.0"
*/
setAlias: function (alias: string) {
MoEngageLogger.warn("Deprecated function usage `setAlias`, use `identifyUser`");
MoEngageLogger.verbose("Will set alias: ", alias);

@@ -757,2 +764,25 @@ let payload = getAliasJson(alias, moeAppId);

},
/**
* Identify the user with the given identity.
* @since Todo: Add Version
*/
identifyUser(identity: string | { [k: string]: string }) {
MoEReactBridge.identifyUser(getIdentifyUserPayload(identity, moeAppId));
},
/**
* Return Identities of the user that has been set.
* @since Todo: Add Version
*/
getUserIdentities: async function (): Promise<{ [k: string]: string } | null> {
try {
return getUserIdentitiesData(
await MoEReactBridge.getUserIdentities(getAppIdJson(moeAppId))
);
} catch (error) {
MoEngageLogger.error(`getUserIdentities(): ${error}`);
return null;
}
}
};

@@ -759,0 +789,0 @@

@@ -46,2 +46,14 @@ import MoEAccountMeta from "../models/MoEAccountMeta";

);
}
export function getUserIdentitiesData(payload: string | null): { [k: string]: string } | null {
if (payload === null) {
return null;
}
const payloadJsonObject: { [k: string]: string } = JSON.parse(payload);
const mappedIdentities: { [k: string]: string } = {};
for (let [key, value] of Object.entries(payloadJsonObject)) {
mappedIdentities[key] = value;
}
return mappedIdentities;
}

@@ -126,2 +126,14 @@ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';

/**
* Identify the user with the given identifiers.
* @param payload Stringified JSON payload
*/
identifyUser: (payload: string) => void;
/**
* Return Identities of the user that has been set.
* @param payload Stringified JSON payload
*/
getUserIdentities: (payload: string) => Promise<string | null>;
/// Anroid specific

@@ -128,0 +140,0 @@

@@ -84,2 +84,6 @@ import MoEngageLogLevel from "../models/MoEngageLogLevel"

// Key to get the user deletion state while deleting user from native bridge
export const IS_USER_DELETION_SUCCESS = "isUserDeletionSuccess";
export const IS_USER_DELETION_SUCCESS = "isUserDeletionSuccess";
// Identify User
export const USER_IDENTITY = 'identity';
export const USER_UNIQUE_IDENTITY = 'uid';

@@ -14,2 +14,3 @@ import MoEClickData from "../models/MoEClickData";

import MoEInAppRules from "../models/MoEInAppRules";
import { ACCOUNT_META, APP_ID, MOE_DATA, USER_IDENTITY, USER_UNIQUE_IDENTITY } from "./MoEConstants";

@@ -309,2 +310,20 @@ export function getInAppCampaignJson(moEInAppData: MoEInAppData, type: string, appId: String) {

return json;
}
export function getIdentifyUserPayload(identity: string | { [k: string]: string }, appId: string): string {
var payload: { [k: string]: any } = {
[ACCOUNT_META]: {
[APP_ID]: appId
},
};
if (typeof identity === 'string') {
payload[MOE_DATA] = {
[USER_IDENTITY]: { [USER_UNIQUE_IDENTITY]: identity }
};
} else {
payload[MOE_DATA] = {
[USER_IDENTITY]: identity
};
}
return JSON.stringify(payload);
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet