react-native-moengage 12.7.0 → 12.8.1

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 CHANGED
@@ -1,3 +1,18 @@
1
+ # 11-06-2026
2
+
3
+ ## 12.8.1
4
+
5
+ - iOS
6
+ - Added compatibility for React Native pre-built libraries.
7
+ - Android
8
+ - Downgrading Compile Java Version to 17
9
+
10
+ # 19-05-2026
11
+
12
+ ## 12.8.0
13
+
14
+ - Added support for logout completion callback
15
+
1
16
  # 07-05-2026
2
17
 
3
18
  ## 12.7.0
@@ -15,7 +15,7 @@ buildscript {
15
15
  dependencies {
16
16
  classpath 'com.android.tools.build:gradle:8.13.2'
17
17
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
18
- classpath "com.moengage.android.hybrid.module.config.plugin:com.moengage.android.hybrid.module.config.plugin.gradle.plugin:0.0.4"
18
+ classpath "com.moengage.android.hybrid.module.config.plugin:com.moengage.android.hybrid.module.config.plugin.gradle.plugin:0.0.5"
19
19
  }
20
20
  }
21
21
 
@@ -23,6 +23,7 @@ import com.moengage.pushbase.NAVIGATION_TYPE_RICH_LANDING
23
23
  import com.moengage.pushbase.NAVIGATION_TYPE_SCREEN_NAME
24
24
  import com.moengage.pushbase.NAV_ACTION
25
25
  import com.moengage.pushbase.model.action.NavigationAction
26
+ import com.moengage.plugin.base.internal.model.events.LogoutCompleteEvent
26
27
 
27
28
 
28
29
  /**
@@ -44,6 +45,7 @@ class EventEmitterImpl(private val reactContext: ReactContext) : EventEmitter {
44
45
  )
45
46
  EventType.INAPP_SELF_HANDLED_AVAILABLE -> emitInAppSelfHandled(event as InAppSelfHandledEvent)
46
47
  EventType.PERMISSION -> emitPermissionResult(event as PermissionEvent)
48
+ EventType.LOGOUT_COMPLETE -> emitLogoutComplete(event as LogoutCompleteEvent)
47
49
  else -> {}
48
50
  }
49
51
  } catch (t: Throwable) {
@@ -102,6 +104,13 @@ class EventEmitterImpl(private val reactContext: ReactContext) : EventEmitter {
102
104
  val payload = PayloadGenerator().permissionResultToWriteableMap(event.result)
103
105
  emit(eventName, payload)
104
106
  }
107
+
108
+ private fun emitLogoutComplete(event: LogoutCompleteEvent) {
109
+ Logger.print { "$tag emitLogoutComplete() : Event $event" }
110
+ val eventName = eventMapping[event.eventType] ?: return
111
+ val payload = PayloadGenerator().logoutResultToWritableMap(event)
112
+ emit(eventName, payload)
113
+ }
105
114
  }
106
115
 
107
116
  val eventMapping = mapOf<EventType, String>(
@@ -112,5 +121,6 @@ val eventMapping = mapOf<EventType, String>(
112
121
  EventType.INAPP_CUSTOM_ACTION to "MoEInAppCampaignCustomAction",
113
122
  EventType.INAPP_SELF_HANDLED_AVAILABLE to "MoEInAppCampaignSelfHandled",
114
123
  EventType.PUSH_TOKEN_GENERATED to "MoEPushTokenGenerated",
115
- EventType.PERMISSION to "MoEPermissionResult"
124
+ EventType.PERMISSION to "MoEPermissionResult",
125
+ EventType.LOGOUT_COMPLETE to "MoELogoutComplete"
116
126
  )
@@ -11,6 +11,7 @@ import com.moengage.plugin.base.internal.*
11
11
  import com.moengage.plugin.base.internal.model.PermissionResult
12
12
  import com.moengage.plugin.base.internal.model.PushPayload
13
13
  import com.moengage.plugin.base.internal.model.events.push.TokenEvent
14
+ import com.moengage.plugin.base.internal.model.events.LogoutCompleteEvent
14
15
 
15
16
  /**
16
17
  * @author Umang Chamaria
@@ -70,4 +71,12 @@ internal class PayloadGenerator {
70
71
  map.putString(ARGUMENT_PAYLOAD, json.toString())
71
72
  return map
72
73
  }
74
+
75
+ fun logoutResultToWritableMap(event: LogoutCompleteEvent): WritableMap {
76
+ val map = Arguments.createMap()
77
+ val resultJson = logoutCompleteEventToJson(event)
78
+ Logger.print { "$tag logoutResultToWritableMap() : Payload Json: $resultJson" }
79
+ map.putString(ARGUMENT_PAYLOAD, resultJson.toString())
80
+ return map
81
+ }
73
82
  }
@@ -81,7 +81,7 @@ RCT_EXPORT_MODULE(MoEReactBridge);
81
81
  #pragma mark- Event Emitters
82
82
  - (NSArray<NSString *> *)supportedEvents
83
83
  {
84
- return @[kPushClicked, kPushTokenGenerated, kInAppShown, kInAppClicked, kInAppDismissed, kInAppCustomAction, kInAppSelfHandled, kPermissionResult];
84
+ return @[kPushClicked, kPushTokenGenerated, kInAppShown, kInAppClicked, kInAppDismissed, kInAppCustomAction, kInAppSelfHandled, kPermissionResult, kLogoutComplete];
85
85
  }
86
86
 
87
87
  #pragma mark- Initialization Method
@@ -8,7 +8,18 @@
8
8
 
9
9
  #import <Foundation/Foundation.h>
10
10
  #import <UIKit/UIKit.h>
11
- #import <React/RCTEventEmitter.h>
11
+
12
+ // Defined locally to avoid importing non-modular React headers in this public
13
+ // framework header, which breaks builds using USE_FRAMEWORKS=static.
14
+ // These match the typedefs in <React/RCTBridgeMethod.h>.
15
+ #ifndef RCTPromiseResolveBlock_defined
16
+ #define RCTPromiseResolveBlock_defined
17
+ typedef void (^RCTPromiseResolveBlock)(id result);
18
+ #endif
19
+ #ifndef RCTPromiseRejectBlock_defined
20
+ #define RCTPromiseRejectBlock_defined
21
+ typedef void (^RCTPromiseRejectBlock)(NSString *code, NSString *message, NSError *error);
22
+ #endif
12
23
 
13
24
  @protocol MoEReactEventDispatcher;
14
25
 
@@ -13,6 +13,7 @@
13
13
  #import <MoEngageCore/MoEngageCore.h>
14
14
  #import "MoEReactNativeHandler.h"
15
15
  #import "MoEngageReactSDKInitializationConfig.h"
16
+ #import <React/RCTEventEmitter.h>
16
17
 
17
18
  @import MoEngagePluginBase;
18
19
 
@@ -46,3 +46,4 @@ extern NSString* const kInAppSelfHandled;
46
46
  extern NSString* const kPushTokenGenerated;
47
47
  extern NSString* const kPushClicked;
48
48
  extern NSString* const kPermissionResult;
49
+ extern NSString* const kLogoutComplete;
@@ -43,3 +43,4 @@ NSString* const kInAppSelfHandled = @"MoEInAppCampaignSelfHandled";
43
43
  NSString* const kPushTokenGenerated = @"MoEPushTokenGenerated";
44
44
  NSString* const kPushClicked = @"MoEPushClicked";
45
45
  NSString* const kPermissionResult = @"MoEPermissionResult";
46
+ NSString* const kLogoutComplete = @"MoELogoutComplete";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-moengage",
3
- "version": "12.7.0",
3
+ "version": "12.8.1",
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
@@ -64,6 +64,7 @@ import MoEAccessibilityData from "./models/campaignsCore/MoEAccessibilityData";
64
64
  import { KEY_ACCESSIBILITY } from "./utils/MoEConstants";
65
65
 
66
66
  import MoEngagePersimissionResultData from "./models/MoEngagePersimissionResultData";
67
+ import MoELogoutCompleteData from "./models/MoELogoutCompleteData";
67
68
 
68
69
  const PLATFORM_IOS = "ios";
69
70
  const PLATFORM_ANDROID = "android";
@@ -78,6 +79,7 @@ const MOE_INAPP_DISMISSED = "MoEInAppCampaignDismissed";
78
79
  const MOE_INAPP_CUSTOM_ACTION = "MoEInAppCampaignCustomAction";
79
80
  const MOE_INAPP_SELF_HANDLE = "MoEInAppCampaignSelfHandled";
80
81
  const MOE_PERMISSION_RESULT = "MoEPermissionResult";
82
+ const MOE_LOGOUT_COMPLETE = "MoELogoutComplete";
81
83
 
82
84
  const eventBroadcastNames = [
83
85
  MOE_PUSH_CLICKED,
@@ -87,7 +89,8 @@ const eventBroadcastNames = [
87
89
  MOE_INAPP_DISMISSED,
88
90
  MOE_INAPP_CUSTOM_ACTION,
89
91
  MOE_INAPP_SELF_HANDLE,
90
- MOE_PERMISSION_RESULT
92
+ MOE_PERMISSION_RESULT,
93
+ MOE_LOGOUT_COMPLETE
91
94
  ];
92
95
 
93
96
  // JS Event Names
@@ -99,6 +102,7 @@ const INAPP_DISMISSED = "inAppCampaignDismissed";
99
102
  const INAPP_CUTOM_ACTION = "inAppCampaignCustomAction";
100
103
  const INAPP_SELF_HANDLE = "inAppCampaignSelfHandled";
101
104
  export const PERMISSION_RESULT = "permissionResult";
105
+ export const LOGOUT_COMPLETE = "logoutComplete";
102
106
 
103
107
  const PUSH_SERVICE_FCM = "FCM"
104
108
  const PUSH_SERVICE_PUSH_KIT = "PUSH_KIT"
@@ -111,7 +115,8 @@ const _eventNames = [
111
115
  INAPP_DISMISSED,
112
116
  INAPP_CUTOM_ACTION,
113
117
  INAPP_SELF_HANDLE,
114
- PERMISSION_RESULT
118
+ PERMISSION_RESULT,
119
+ LOGOUT_COMPLETE
115
120
  ];
116
121
 
117
122
  var _eventTypeHandler = new Map();
@@ -135,14 +140,15 @@ function handleEventBroadcast(type: string | String, broadcast: string) {
135
140
  });
136
141
  }
137
142
 
138
- export type NotificationEventName = 'pushTokenGenerated' |
139
- 'pushClicked' |
140
- 'inAppCampaignShown' |
141
- 'inAppCampaignClicked' |
142
- 'inAppCampaignDismissed' |
143
- 'inAppCampaignCustomAction' |
144
- 'inAppCampaignSelfHandled' |
145
- 'permissionResult';
143
+ export type NotificationEventName = 'pushTokenGenerated' |
144
+ 'pushClicked' |
145
+ 'inAppCampaignShown' |
146
+ 'inAppCampaignClicked' |
147
+ 'inAppCampaignDismissed' |
148
+ 'inAppCampaignCustomAction' |
149
+ 'inAppCampaignSelfHandled' |
150
+ 'permissionResult' |
151
+ 'logoutComplete';
146
152
 
147
153
  type NotificationEventTypeMap = {
148
154
  "pushTokenGenerated": MoEPushToken,
@@ -152,7 +158,8 @@ type NotificationEventTypeMap = {
152
158
  "inAppCampaignDismissed": MoEInAppData,
153
159
  "inAppCampaignCustomAction": MoEInAppData,
154
160
  "inAppCampaignSelfHandled": MoESelfHandledCampaignData,
155
- "permissionResult": MoEngagePersimissionResultData
161
+ "permissionResult": MoEngagePersimissionResultData,
162
+ "logoutComplete": MoELogoutCompleteData
156
163
  }
157
164
 
158
165
  var ReactMoE = {
@@ -794,6 +801,7 @@ var ReactMoE = {
794
801
  };
795
802
 
796
803
  export {
804
+ MoELogoutCompleteData,
797
805
  MoEInAppCustomAction,
798
806
  MoEInAppNavigation,
799
807
  MoESelfHandledCampaignData,
@@ -0,0 +1,28 @@
1
+ import MoEAccountMeta from "./MoEAccountMeta";
2
+ import { MoEPlatform } from "./MoEPlatform";
3
+
4
+ /**
5
+ * Data class containing the result of logout operation
6
+ *
7
+ * @author Anirudha Mayya
8
+ * @since 12.7.0
9
+ */
10
+ export default class MoELogoutCompleteData {
11
+
12
+ /**
13
+ * Account meta data, instance of {@link MoEAccountMeta}
14
+ * @since 12.7.0
15
+ */
16
+ accountMeta: MoEAccountMeta;
17
+
18
+ /**
19
+ * Platform on which the logout was performed
20
+ * @since 12.7.0
21
+ */
22
+ platform: MoEPlatform;
23
+
24
+ constructor(accountMeta: MoEAccountMeta, platform: MoEPlatform) {
25
+ this.accountMeta = accountMeta;
26
+ this.platform = platform;
27
+ }
28
+ }
@@ -1,4 +1,5 @@
1
1
  import MoEAccountMeta from "../models/MoEAccountMeta";
2
+ import MoELogoutCompleteData from "../models/MoELogoutCompleteData";
2
3
  import MoEngagePersimissionResultData from "../models/MoEngagePersimissionResultData";
3
4
  import UserDeletionData from "../models/UserDeletionData";
4
5
  import {
@@ -45,6 +46,24 @@ export function getUserDeletionData(payload: string): UserDeletionData {
45
46
  );
46
47
  }
47
48
 
49
+ /**
50
+ * Create an instance of {@link MoELogoutCompleteData} from json object
51
+ *
52
+ * @param payload - JSON Object with required keys
53
+ * @returns instance of {@link MoELogoutCompleteData} or null if parsing fails
54
+ * @since 12.7.0
55
+ */
56
+ export function getLogoutCompleteData(payload: { [k: string]: any }): MoELogoutCompleteData | null {
57
+ try {
58
+ return new MoELogoutCompleteData(
59
+ getMoEAccountMeta(payload[ACCOUNT_META]),
60
+ payload[MOE_PLATFORM]
61
+ );
62
+ } catch (e) {
63
+ return null;
64
+ }
65
+ }
66
+
48
67
  export function getUserIdentitiesData(payload: string | null): { [k: string]: string } | null {
49
68
  if (payload === null) {
50
69
  return null;
@@ -7,8 +7,8 @@ import {
7
7
  } from "../moeParser/MoEInAppParser";
8
8
  import {getMoEPushPayload, getMoEPushToken} from "../moeParser/MoEPushNotificationParser";
9
9
  import {MOE_DATA, ACCOUNT_META, MOE_PAYLOAD} from "./MoEConstants";
10
- import {PERMISSION_RESULT} from "..";
11
- import {getPermissionResult} from "../moeParser/MoEngagePayloadParser";
10
+ import {PERMISSION_RESULT, LOGOUT_COMPLETE} from "..";
11
+ import {getPermissionResult, getLogoutCompleteData} from "../moeParser/MoEngagePayloadParser";
12
12
 
13
13
  export function executeHandler(
14
14
  handler: Function,
@@ -25,6 +25,9 @@ export function executeHandler(
25
25
  } else if (type == PERMISSION_RESULT) {
26
26
  let payload = getPermissionResult(notificationPayload)
27
27
  handler(payload)
28
+ } else if (type == LOGOUT_COMPLETE) {
29
+ let logoutData = getLogoutCompleteData(notificationPayload);
30
+ logoutData != undefined ? handler(logoutData) : null;
28
31
  } else {
29
32
  const accountMeta = notificationPayload[ACCOUNT_META];
30
33
  if (accountMeta != undefined && isValidObject(accountMeta)) {