react-native-moengage 11.2.1 → 12.0.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 CHANGED
@@ -1,3 +1,27 @@
1
+ # 17-07-2025
2
+
3
+ ## 12.0.0
4
+
5
+ - Added support for Simplify Inapp Triggers.
6
+ - Added support for file based initialisation configuration
7
+ - Android
8
+ - Min SDK version updated to `23`
9
+ - Compiled SDK version updated to `35`
10
+ - Removed deprecated APIs
11
+ | Then | Now |
12
+ |:--------------------------------------------------------------:|:------------------------------------------------------------------------------:|
13
+ | MoEInitializer#initialize(Context, MoEngage.Builder) | MoEInitializer#initializeDefaultInstance(Context, MoEngage.Builder) |
14
+ | MoEInitializer#initialize(Context, MoEngage.Builder, SdkState) | MoEInitializer#initializeDefaultInstance(Context, MoEngage.Builder, SdkState) |
15
+ - iOS
16
+ - Minimum iOS and tvOS deployment target updated to `13`
17
+ - `MoEngage-iOS-SDK` version updated to `10.03.1`
18
+
19
+ # 24-04-2025
20
+
21
+ ## 11.2.2
22
+ - Android
23
+ - `inapp` version updated to `8.8.1`
24
+
1
25
  # 16-04-2025
2
26
 
3
27
  ## 11.2.1
@@ -12,11 +12,12 @@ Pod::Spec.new do |s|
12
12
  s.license = package['license']
13
13
  s.authors = "MoEngage Inc."
14
14
  s.source = {:file => './' }
15
- s.platforms = { :ios => "11.0", :tvos => "11.0" }
15
+ s.platforms = { :ios => "13.0", :tvos => "13.0" }
16
16
  s.source_files = 'iOS/MoEReactBridge/**/*.{h,m,mm}'
17
17
  s.public_header_files = 'iOS/MoEReactBridge/{MoEngageInitializer,MoEngageReactSDKInitializationConfig,MoEngageReactUtils}.h'
18
+ s.weak_framework = 'UserNotifications'
18
19
  s.dependency 'React'
19
- s.dependency 'MoEngagePluginBase','5.3.2'
20
+ s.dependency 'MoEngagePluginBase','6.2.1'
20
21
  s.ios.dependency 'MoEngage-iOS-SDK/RichNotification'
21
22
 
22
23
  s.prepare_command = <<-CMD
@@ -20,12 +20,12 @@ rootProject.allprojects {
20
20
 
21
21
  ext {
22
22
  //dependency version
23
- moengageCoreVersion = "13.06.00"
24
- moengageInAppVersion = "8.8.0"
25
- basePluginVersion = "4.3.0"
23
+ moengageCoreVersion = "14.03.00"
24
+ moengageInAppVersion = "9.2.0"
25
+ basePluginVersion = "5.1.0"
26
26
  //build versions
27
- minimumVersion = 21
28
- compileVersion = 34
27
+ minimumVersion = 23
28
+ compileVersion = 35
29
29
  }
30
30
 
31
31
  apply plugin: 'com.android.library'
@@ -7,6 +7,7 @@ import com.moengage.core.internal.logger.Logger
7
7
  import com.moengage.core.internal.model.IntegrationMeta
8
8
  import com.moengage.core.model.SdkState
9
9
  import com.moengage.plugin.base.internal.PluginInitializer
10
+ import android.app.Application
10
11
 
11
12
 
12
13
  /**
@@ -16,30 +17,6 @@ import com.moengage.plugin.base.internal.PluginInitializer
16
17
  object MoEInitializer {
17
18
  private const val tag = "${MODULE_TAG}MoEInitializer"
18
19
 
19
- @Deprecated(
20
- "",
21
- level = DeprecationLevel.WARNING,
22
- replaceWith = ReplaceWith(
23
- "initializeDefaultInstance(context, builder)",
24
- "com.moengage.react.MoEInitializer.initializeDefaultInstance"
25
- )
26
- )
27
- fun initialize(context: Context, builder: MoEngage.Builder) {
28
- initializeDefaultInstance(context, builder)
29
- }
30
-
31
- @Deprecated(
32
- "",
33
- level = DeprecationLevel.WARNING,
34
- replaceWith = ReplaceWith(
35
- "initializeDefaultInstance(context, builder, sdkState)",
36
- "com.moengage.react.MoEInitializer.initializeDefaultInstance"
37
- )
38
- )
39
- fun initialize(context: Context, builder: MoEngage.Builder, sdkState: SdkState) {
40
- initializeDefaultInstance(context, builder, sdkState)
41
- }
42
-
43
20
  @JvmOverloads
44
21
  fun initializeDefaultInstance(
45
22
  context: Context,
@@ -79,5 +56,32 @@ object MoEInitializer {
79
56
  }
80
57
  }
81
58
 
82
-
59
+ /**
60
+ * Initialize SDK using file based configuration.
61
+ *
62
+ * Note: While using this function to intialize the SDK, make sure you have configured all the
63
+ * required configuration in the xml as resource value
64
+ */
65
+ @JvmOverloads
66
+ fun initializeDefaultInstance(
67
+ application: Application,
68
+ lifecycleAwareCallbackEnabled: Boolean = false,
69
+ sdkState: SdkState? = null,
70
+ ) {
71
+ try {
72
+ Logger.print { "$tag initialize(): Initialising MoEngage SDK" }
73
+ GlobalCache.lifecycleAwareCallbackEnabled = lifecycleAwareCallbackEnabled
74
+ PluginInitializer.initialize(
75
+ application = application,
76
+ integrationMeta = IntegrationMeta(
77
+ INTEGRATION_TYPE,
78
+ BuildConfig.MOENGAGE_REACT_LIBRARY_VERSION
79
+ ),
80
+ sdkState = sdkState
81
+ )
82
+ Logger.print { "$tag initialize(): " }
83
+ } catch (t: Throwable) {
84
+ Logger.print(LogLevel.ERROR, t) { "$tag initialize(): " }
85
+ }
86
+ }
83
87
  }
@@ -10,9 +10,7 @@
10
10
  #import <React/RCTLog.h>
11
11
  #import <React/RCTConvert.h>
12
12
  #import <React/RCTBundleURLProvider.h>
13
- #import "MoEngageInitializer.h"
14
13
  #import "MoEngageReactConstants.h"
15
- #import <MoEngageSDK/MoEngageSDK.h>
16
14
  #import "MoEReactNativeHandler.h"
17
15
 
18
16
  @interface MoEReactBridge()
@@ -10,6 +10,11 @@
10
10
 
11
11
  @protocol SFSafariViewControllerDelegate;
12
12
  @class MoEngageReactSDKInitializationConfig;
13
+ @class MoEngageSDKDefaultInitializationConfig;
14
+ @class MoEngageReactSDKDefaultInitializationConfig;
15
+
16
+ // Moving imports above causes build error
17
+ #import <UserNotifications/UserNotifications.h>
13
18
  #import <MoEngageSDK/MoEngageSDK.h>
14
19
 
15
20
  NS_ASSUME_NONNULL_BEGIN
@@ -36,6 +41,14 @@ NS_ASSUME_NONNULL_BEGIN
36
41
  /// Initialize SDK with MoEngageReactSDKInitializationConfig instance.
37
42
  /// @param reactConfig MoEngageSDKConfig instance for SDK configuration
38
43
  - (void)initializeInstance:(MoEngageReactSDKInitializationConfig*)reactConfig;
44
+
45
+ /// Initialize Default Instance of SDK with Application's `Info.plist` data with optional config.
46
+ /// @param config Additional MoEngageSDKDefaultInitializationConfig.
47
+ - (void)initializeDefaultInstanceWithAdditionalConfig:(MoEngageSDKDefaultInitializationConfig*)config;
48
+
49
+ /// Initialize Default Instance of SDK with Application's `Info.plist` data with optional react config.
50
+ /// @param ractConfig Additional MoEngageReactSDKDefaultInitializationConfig.
51
+ - (void)initializeDefaultInstanceWithAdditionalReactConfig:(MoEngageReactSDKDefaultInitializationConfig*)ractConfig;
39
52
  @end
40
53
 
41
54
  NS_ASSUME_NONNULL_END
@@ -10,7 +10,7 @@
10
10
  #import "MoEngageReactConstants.h"
11
11
  #import "MoEngageReactUtils.h"
12
12
  #import <MoEngageSDK/MoEngageSDK.h>
13
- #import <MoEngageObjCUtils/MoEngageObjCUtils.h>
13
+ #import <MoEngageCore/MoEngageCore.h>
14
14
  #import "MoEReactNativeHandler.h"
15
15
  #import "MoEngageReactSDKInitializationConfig.h"
16
16
 
@@ -54,6 +54,22 @@
54
54
  [self commonSetUp: plugin identifier:config.sdkConfig.appId];
55
55
  }
56
56
 
57
+ - (void)initializeDefaultInstanceWithAdditionalConfig:(MoEngageSDKDefaultInitializationConfig*)config {
58
+ MoEngagePlugin* plugin = [[MoEngagePlugin alloc] init];
59
+ MoEngageSDKConfig* sdkConfig = [plugin initializeDefaultInstanceWithAdditionalConfig:config];
60
+ if (!sdkConfig) {
61
+ return;
62
+ }
63
+ [self commonSetUp:plugin identifier:sdkConfig.appId];
64
+ }
65
+
66
+ - (void)initializeDefaultInstanceWithAdditionalReactConfig:(MoEngageReactSDKDefaultInitializationConfig*)ractConfig {
67
+ MoEngageSDKDefaultInitializationConfig *config = [[MoEngageSDKDefaultInitializationConfig alloc] init];
68
+ config.launchOptions = ractConfig.launchOptions;
69
+ config.environment = ractConfig.environment;
70
+ [self initializeDefaultInstanceWithAdditionalConfig:config];
71
+ }
72
+
57
73
  #pragma mark- Utils
58
74
 
59
75
  - (void)commonSetUp:(MoEngagePlugin *)plugin identifier:(NSString*)identifier {
@@ -27,3 +27,16 @@
27
27
  - (nonnull instancetype)initWithSdkConfig:(MoEngageSDKConfig * _Nonnull)sdkConfig;
28
28
  @end
29
29
 
30
+ @interface MoEngageReactSDKDefaultInitializationConfig : NSObject
31
+
32
+ /// The app launch options.
33
+ /// By default, no launch options set..
34
+ @property (nonatomic, copy) NSDictionary<UIApplicationLaunchOptionsKey, id> * _Nullable launchOptions;
35
+ /// The initialized SDK workspace environment.
36
+ ///
37
+ /// By default, environment set in `Info.plist` file is used.
38
+ @property (nonatomic) enum MoEngageWorkspaceEnvironment environment;
39
+ /// Creates a new initialization configuration.
40
+ - (nonnull instancetype)init;
41
+ @end
42
+
@@ -29,3 +29,16 @@
29
29
  }
30
30
 
31
31
  @end
32
+
33
+ @implementation MoEngageReactSDKDefaultInitializationConfig
34
+
35
+ - (nonnull instancetype)init {
36
+ self = [super init];
37
+ if (self) {
38
+ _launchOptions = nil;
39
+ _environment = MoEngageWorkspaceEnvironmentDefault;
40
+ }
41
+ return self;
42
+ }
43
+
44
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-moengage",
3
- "version": "11.2.1",
3
+ "version": "12.0.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
@@ -60,6 +60,9 @@ import { MoEngageNudgePosition } from "../src/models/MoEngageNudgePosition";
60
60
  import MoEAnalyticsConfig from "../src/models/MoEAnalyticsConfig";
61
61
  import { MoESupportedAttributes } from "./models/MoESupportedAttributes";
62
62
  import * as MoECoreHandler from "./utils/MoECoreHandler";
63
+ import MoEAccessibilityData from "./models/campaignsCore/MoEAccessibilityData";
64
+ import { KEY_ACCESSIBILITY } from "./utils/MoEConstants";
65
+
63
66
 
64
67
  const PLATFORM_IOS = "ios";
65
68
  const PLATFORM_ANDROID = "android";
@@ -795,7 +798,9 @@ export {
795
798
  MoEngageLogLevel,
796
799
  MoEngageLogger,
797
800
  MoEngageNudgePosition,
798
- MoEAnalyticsConfig
801
+ MoEAnalyticsConfig,
802
+ MoEAccessibilityData,
803
+ KEY_ACCESSIBILITY
799
804
  };
800
805
  export default ReactMoE;
801
806
 
@@ -4,17 +4,24 @@
4
4
  */
5
5
  export default class MoEInAppRules {
6
6
  /**
7
- * Screenname for which InApp was configured to be shown.
8
- */
9
- screenName: string | null
7
+ * Screenname for which InApp was configured to be shown.
8
+ * @deprecated Use the 'screenNames' property instead.
9
+ */
10
+ screenName: string | null;
10
11
 
11
12
  /**
12
13
  * contexts for which InApp was configured to be shown.
13
14
  */
14
- contexts: Array<string>
15
+ contexts: Array<string>;
16
+
17
+ /**
18
+ * Screennames for which InApp was configured to be shown.
19
+ */
20
+ screenNames: Array<string>;
15
21
 
16
- constructor(screenName: string | null, contexts: Array<string> = []) {
22
+ constructor(screenName: string | null, contexts: Array<string> = [], screenNames: Array<string> = []) {
17
23
  this.screenName = screenName;
18
24
  this.contexts = contexts;
25
+ this.screenNames = screenNames;
19
26
  }
20
27
  }
@@ -0,0 +1,29 @@
1
+ import { KEY_ACCESSIBILITY_HINT, KEY_ACCESSIBILITY_TEXT } from "../../utils/MoEConstants";
2
+
3
+ export default class MoEAccessibilityData {
4
+ text: string | null;
5
+ hint: string | null;
6
+
7
+ constructor(text: string | null, hint: string | null) {
8
+ this.text = text;
9
+ this.hint = hint;
10
+ }
11
+
12
+ static fromJson(json: { [key: string]: any }): MoEAccessibilityData {
13
+ return new MoEAccessibilityData(
14
+ typeof json[KEY_ACCESSIBILITY_TEXT] === 'string' ? json[KEY_ACCESSIBILITY_TEXT] : null,
15
+ typeof json[KEY_ACCESSIBILITY_HINT] === 'string' ? json[KEY_ACCESSIBILITY_HINT] : null
16
+ );
17
+ }
18
+
19
+ toJson(): { [key: string]: any } {
20
+ return {
21
+ [KEY_ACCESSIBILITY_TEXT]: this.text,
22
+ [KEY_ACCESSIBILITY_HINT]: this.hint,
23
+ };
24
+ }
25
+
26
+ toString(): string {
27
+ return `MoEAccessibilityData(text: ${this.text}, hint: ${this.hint})`;
28
+ }
29
+ }
@@ -32,7 +32,8 @@ import {
32
32
  MOE_INAPP_SCREEN_NAME,
33
33
  MOE_INAPP_CONTEXTS,
34
34
  MOE_DATA,
35
- ACCOUNT_META
35
+ ACCOUNT_META,
36
+ MOE_INAPP_SCREEN_NAMES
36
37
  } from "../utils/MoEConstants";
37
38
  import { isValidObject } from "../utils/MoEHelper";
38
39
  import { getMoEAccountMeta } from "./MoEngagePayloadParser";
@@ -78,13 +79,14 @@ function getMoESelfHandledCampaign(json: { [k: string]: any }) {
78
79
  return new MoESelfHandledCampaign(payload, dismissInterval, displayRules);
79
80
  }
80
81
 
81
- function getMoEInAppRules(json: { [k: string]: any }) {
82
+ export function getMoEInAppRules(json: { [k: string]: any }) {
82
83
  var screenName: string | null = null;
83
84
  if (json[MOE_INAPP_SCREEN_NAME] != undefined) {
84
85
  screenName = json[MOE_INAPP_SCREEN_NAME];
85
86
  }
86
87
  var contexts = json[MOE_INAPP_CONTEXTS];
87
- return new MoEInAppRules(screenName, contexts);
88
+ var screenNames = json[MOE_INAPP_SCREEN_NAMES]
89
+ return new MoEInAppRules(screenName, contexts, screenNames);
88
90
  }
89
91
 
90
92
  function getMoEInAppCustomAction(json: { [k: string]: any }) {
@@ -32,6 +32,7 @@ export const MOE_CAMPAIGNS = 'campaigns'
32
32
  export const MOE_INAPP_DISPLAY_RULES = 'displayRules'
33
33
  export const MOE_INAPP_SCREEN_NAME = 'screenName'
34
34
  export const MOE_INAPP_CONTEXTS = 'contexts'
35
+ export const MOE_INAPP_SCREEN_NAMES = 'screenNames'
35
36
 
36
37
  //IN APP NAVIGATION
37
38
  export const MOE_NAVIGATION_TYPE = 'navigationType'
@@ -85,4 +86,9 @@ export const IS_USER_DELETION_SUCCESS = "isUserDeletionSuccess";
85
86
 
86
87
  // Identify User
87
88
  export const USER_IDENTITY = 'identity';
88
- export const USER_UNIQUE_IDENTITY = 'uid';
89
+ export const USER_UNIQUE_IDENTITY = 'uid';
90
+
91
+ // Accessibility Keys
92
+ export const KEY_ACCESSIBILITY = 'accessibility';
93
+ export const KEY_ACCESSIBILITY_TEXT = 'text';
94
+ export const KEY_ACCESSIBILITY_HINT = 'hint';
@@ -302,7 +302,8 @@ export function getSelfHandledCampaignJson(moESelfHandledCampaign: MoESelfHandle
302
302
  export function getDisplayRulesJson(displayRules: MoEInAppRules) {
303
303
  var json: { [k: string]: any } = {
304
304
  contexts: displayRules.contexts,
305
- screenName: displayRules.screenName
305
+ screenName: displayRules.screenName,
306
+ screenNames: displayRules.screenNames
306
307
  }
307
308
  MoEngageLogger.verbose("getDisplayRulesJson(): payload json: ", json);
308
309
  return json;