infobip-mobile-messaging-react-native-plugin 12.5.6 → 13.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/README.md CHANGED
@@ -12,7 +12,7 @@ The document describes library integration steps for your React Native project.
12
12
  ## Requirements
13
13
  - node (v16.10.0 or higher)
14
14
  - ruby (2.6.10 or higher)
15
- - React Native (v0.70.8)
15
+ - React Native (v0.75.4)
16
16
 
17
17
  For iOS project:
18
18
  - Xcode and Command Line Tools (16.1)
@@ -21,7 +21,7 @@ For iOS project:
21
21
 
22
22
  For Android project:
23
23
  - Android Studio (Bumblebee | 2021.1.1)
24
- - Gradle (v7.3.3)
24
+ - Gradle (v8.5.2)
25
25
  - Supported API Levels: 21 (Android 5.0 - [Lollipop](https://developer.android.com/about/versions/lollipop)) - 34 ([Android 14.0](https://developer.android.com/about/versions/14))
26
26
 
27
27
  ## Quick start guide
@@ -1,7 +1,7 @@
1
- def defaultCompileSDKVersion = 33
2
- def defaultBuildToolsVersion = '33.0.0'
1
+ def defaultCompileSDKVersion = 34
2
+ def defaultBuildToolsVersion = '34.0.0'
3
3
  def defaultMinSDKVersion = 21
4
- def defaultTargetSDKVersion = 33
4
+ def defaultTargetSDKVersion = 34
5
5
 
6
6
  def getRootProjectProperty(property, fallback) {
7
7
  rootProject.ext.has(property) ? rootProject.ext.get(property) : fallback
@@ -34,7 +34,7 @@ buildscript {
34
34
  }
35
35
  }
36
36
  dependencies {
37
- classpath 'com.android.tools.build:gradle:7.2.2'
37
+ classpath 'com.android.tools.build:gradle:8.5.2'
38
38
  }
39
39
  }
40
40
  }
@@ -43,6 +43,7 @@ apply plugin: 'com.android.library'
43
43
  apply plugin: 'maven-publish'
44
44
 
45
45
  android {
46
+ namespace "org.infobip.reactlibrary.mobilemessaging"
46
47
  compileSdkVersion getRootProjectProperty('compileSdkVersion', defaultCompileSDKVersion)
47
48
  buildToolsVersion getRootProjectProperty('buildToolsVersion', defaultBuildToolsVersion)
48
49
  defaultConfig {
@@ -86,7 +87,7 @@ repositories {
86
87
  }
87
88
 
88
89
  dependencies {
89
- def mmVersion = '13.2.3'
90
+ def mmVersion = '13.4.0'
90
91
  //react and mm dependencies clash
91
92
  if (!overrideKotlinVersion.empty) {
92
93
  constraints {
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
3
3
  distributionPath=wrapper/dists
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
6
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
@@ -1,5 +1,5 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="org.infobip.reactlibrary.mobilemessaging">
2
+ xmlns:tools="http://schemas.android.com/tools">
3
3
 
4
4
  <!-- Mobile Messaging permissions -->
5
5
 
@@ -26,7 +26,10 @@
26
26
  <uses-permission android:name="android.permission.CAMERA" />
27
27
  <!-- Infobip rtc ui permissions -->
28
28
 
29
- <application>
29
+ <application
30
+ tools:replace="android:usesCleartextTraffic"
31
+ android:usesCleartextTraffic="true"
32
+ >
30
33
  <!-- Mobile Messaging components -->
31
34
  <service
32
35
  android:name="org.infobip.mobile.messaging.cloud.MobileMessagingCloudService"
@@ -33,6 +33,7 @@ import org.infobip.mobile.messaging.mobileapi.Result;
33
33
  import org.infobip.mobile.messaging.util.StringUtils;
34
34
  import org.infobip.reactlibrary.mobilemessaging.datamappers.ReactNativeJson;
35
35
  import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
36
+ import org.infobip.mobile.messaging.chat.core.MultithreadStrategy;
36
37
  import org.json.JSONException;
37
38
  import org.json.JSONObject;
38
39
 
@@ -120,9 +121,10 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
120
121
  }
121
122
 
122
123
  @ReactMethod
123
- public void sendContextualData(String data, Boolean allMultiThreadStrategy, Callback onSuccess, Callback onError) {
124
+ public void sendContextualData(String data, String multithreadStrategyFlag, Callback onSuccess, Callback onError) {
124
125
  try {
125
- InAppChat.getInstance(reactContext).sendContextualData(data, allMultiThreadStrategy);
126
+ MultithreadStrategy multithreadStrategy = MultithreadStrategy.valueOf(multithreadStrategyFlag);
127
+ InAppChat.getInstance(reactContext).sendContextualData(data, multithreadStrategy);
126
128
  onSuccess.invoke();
127
129
  } catch (Throwable t) {
128
130
  onError.invoke(Utils.callbackError(t.getMessage(), null));
@@ -19,10 +19,10 @@ Pod::Spec.new do |s|
19
19
  s.requires_arc = true
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "MobileMessaging/Core", "12.14.1"
23
- s.dependency "MobileMessaging/InAppChat", "12.14.1"
24
- s.dependency "MobileMessaging/Inbox", "12.14.1"
22
+ s.dependency "MobileMessaging/Core", "12.17.0"
23
+ s.dependency "MobileMessaging/InAppChat", "12.17.0"
24
+ s.dependency "MobileMessaging/Inbox", "12.17.0"
25
25
  if defined?($WebRTCUIEnabled)
26
- s.dependency "MobileMessaging/WebRTCUI", "12.14.1"
26
+ s.dependency "MobileMessaging/WebRTCUI", "12.17.0"
27
27
  end
28
28
  end
@@ -159,20 +159,31 @@ class RNMMChat: NSObject {
159
159
  }
160
160
  }
161
161
 
162
- @objc(sendContextualData:multiThreadStrategy:onSuccess:onError:)
163
- func sendContextualData(data: NSString, multiThreadStrategy: Bool, onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
164
- if let chatVC = RNMMChatView.viewController {
165
- chatVC.sendContextualData(String(data), multiThreadStrategy: multiThreadStrategy ? .ALL : .ACTIVE) { error in
166
- if let error = error {
167
- onError([error.reactNativeObject])
168
- } else {
169
- onSuccess(nil)
170
- }
171
- }
172
- } else if let inAppChat = MobileMessaging.inAppChat {
173
- inAppChat.sendContextualData(String(data), multiThreadStrategy: multiThreadStrategy ? .ALL : .ACTIVE)
174
- onSuccess(nil)
162
+ @objc(sendContextualData:chatMultiThreadStrategy:onSuccess:onError:)
163
+ func sendContextualData(data: NSString, chatMultiThreadStrategy: NSString, onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
164
+ var strategy: MMChatMultiThreadStrategy
165
+ switch chatMultiThreadStrategy {
166
+ case "ACTIVE": strategy = .ACTIVE
167
+ case "ALL": strategy = .ALL
168
+ case "ALL_PLUS_NEW": strategy = .ALL_PLUS_NEW
169
+ default:
170
+ onError([NSError(type: .InvalidArguments)])
171
+ return
175
172
  }
173
+
174
+
175
+ if let chatVC = RNMMChatView.viewController {
176
+ chatVC.sendContextualData(String(data), multiThreadStrategy: strategy) { error in
177
+ if let error = error {
178
+ onError([error.reactNativeObject])
179
+ } else {
180
+ onSuccess(nil)
181
+ }
182
+ }
183
+ } else if let inAppChat = MobileMessaging.inAppChat {
184
+ inAppChat.sendContextualData(String(data), multiThreadStrategy: strategy)
185
+ onSuccess(nil)
186
+ }
176
187
  }
177
188
 
178
189
  @objc(setJwt:)
@@ -24,6 +24,7 @@ RCT_EXTERN_METHOD(setupChatSettings:)
24
24
  RCT_EXTERN_METHOD(setLanguage:(NSString *)data onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
25
25
  RCT_EXTERN_METHOD(setJwt:)
26
26
  RCT_EXTERN_METHOD(sendContextualData:(NSString *)data multiThreadStrategy:(BOOL)multiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
27
+ RCT_EXTERN_METHOD(sendContextualData:(NSString *)data chatMultiThreadStrategy:(NSString *)chatMultiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
27
28
  RCT_EXTERN_METHOD(showThreadsList)
28
29
  RCT_EXTERN_METHOD(restartConnection)
29
30
  RCT_EXTERN_METHOD(stopConnection)
@@ -182,7 +182,7 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
182
182
  if let error = error {
183
183
  onError([error.reactNativeObject])
184
184
  } else {
185
- onSuccess([inbox?.dictionary ?? [:]])
185
+ onSuccess([inbox?.dictionary() ?? [:]])
186
186
  }
187
187
  })
188
188
  }
@@ -198,7 +198,7 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
198
198
  if let error = error {
199
199
  onError([error.reactNativeObject])
200
200
  } else {
201
- onSuccess([inbox?.dictionary ?? [:]])
201
+ onSuccess([inbox?.dictionary() ?? [:]])
202
202
  }
203
203
  })
204
204
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "infobip-mobile-messaging-react-native-plugin",
3
3
  "title": "Infobip Mobile Messaging React Native Plugin",
4
- "version": "12.5.6",
4
+ "version": "13.0.0",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "./src/index.js",
7
7
  "scripts": {
@@ -32,12 +32,12 @@
32
32
  "url": "https://github.com/infobip/mobile-messaging-react-native-plugin/issues"
33
33
  },
34
34
  "peerDependencies": {
35
- "react": "^18.1.0",
35
+ "react": "^18.3.1",
36
36
  "react-native": ">=0.68.0 <1.0.x"
37
37
  },
38
38
  "devDependencies": {
39
- "metro-react-native-babel-preset": "^0.72.3",
40
- "react": "^18.1.0",
41
- "react-native": "^0.70.8"
39
+ "metro-react-native-babel-preset": "^0.77.0",
40
+ "react": "^18.3.1",
41
+ "react-native": "^0.75.4"
42
42
  }
43
43
  }
package/src/index.d.ts CHANGED
@@ -129,6 +129,7 @@ declare namespace MobileMessagingReactNative {
129
129
  userIdentity: UserIdentity;
130
130
  userAttributes?: Record<string, string | number | boolean | object[]> | undefined;
131
131
  forceDepersonalize?: boolean | undefined;
132
+ keepAsLead?: boolean | undefined;
132
133
  }
133
134
 
134
135
  export interface Message {
@@ -325,6 +326,12 @@ declare namespace MobileMessagingReactNative {
325
326
  inputTextAppearance: string;
326
327
  }
327
328
 
329
+ export enum ChatMultithreadStrategy {
330
+ active = "ACTIVE",
331
+ all = "ALL",
332
+ allPlusNew = "ALL_PLUS_NEW"
333
+ }
334
+
328
335
  interface Api {
329
336
 
330
337
  inAppChatEvents: [
@@ -604,6 +611,7 @@ declare namespace MobileMessagingReactNative {
604
611
  setWidgetTheme(widgetTheme: string): void;
605
612
 
606
613
  /**
614
+ * @deprecated use sendContextualData with chatMultiThreadStrategy string param instead of allMultiThreadStrategy bool.
607
615
  * Set contextual data of the Livechat Widget.
608
616
  * If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
609
617
  * Every function invocation will overwrite the previous contextual data.
@@ -616,6 +624,19 @@ declare namespace MobileMessagingReactNative {
616
624
  */
617
625
  sendContextualData(data: string, allMultiThreadStrategy: boolean, onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
618
626
 
627
+ /**
628
+ * Set contextual data of the Livechat Widget.
629
+ * If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
630
+ * Every function invocation will overwrite the previous contextual data.
631
+ *
632
+ * @name sendContextualData
633
+ * @param data contextual data in the form of JSON string
634
+ * @param chatMultiThreadStrategy multi-thread strategy: 'ACTIVE', 'ALL', 'ALL_PLUS_NEW'
635
+ * @param {Function} onSuccess success callback
636
+ * @param {Function} onError error callback
637
+ */
638
+ sendContextualData(data: string, chatMultiThreadStrategy: ChatMultithreadStrategy, onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
639
+
619
640
  /**
620
641
  * Set chat language
621
642
  * @name setLanguage
@@ -726,4 +747,4 @@ declare namespace WebRTCUI {
726
747
  * @param {Function} onError error callback
727
748
  */
728
749
  function disableCalls(onSuccess:() => void, onError:(error: MobileMessagingError) => void):void;
729
- }
750
+ }
package/src/index.js CHANGED
@@ -615,6 +615,7 @@ class MobileMessaging {
615
615
  };
616
616
 
617
617
  /**
618
+ * @deprecated use sendContextualData with chatMultiThreadStrategy string param instead of allMultiThreadStrategy bool.
618
619
  * Set contextual data of the Livechat Widget.
619
620
  * If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
620
621
  * Every function invocation will overwrite the previous contextual data.
@@ -626,7 +627,26 @@ class MobileMessaging {
626
627
  * @param {Function} onError error callback
627
628
  */
628
629
  sendContextualData(data, allMultiThreadStrategy = false, onSuccess = function() {}, onError = function() {}) {
629
- RNMMChat.sendContextualData(data, allMultiThreadStrategy, onSuccess, onError);
630
+ if (allMultiThreadStrategy) {
631
+ sendContextualData(data, 'ALL', onSuccess, onError)
632
+ } else {
633
+ sendContextualData(data, 'ACTIVE', onSuccess, onError)
634
+ }
635
+ };
636
+
637
+ /**
638
+ * Set contextual data of the Livechat Widget.
639
+ * If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
640
+ * Every function invocation will overwrite the previous contextual data.
641
+ *
642
+ * @name sendContextualData
643
+ * @param data - contextual data in the form of JSON string
644
+ * @param chatMultiThreadStrategy - multi-thread strategy flag: ACTIVE, ALL, ALL_PLUS_NEW
645
+ * @param {Function} onSuccess success callback
646
+ * @param {Function} onError error callback
647
+ */
648
+ sendContextualData(data, chatMultiThreadStrategy = 'ACTIVE', onSuccess = function() {}, onError = function() {}) {
649
+ RNMMChat.sendContextualData(data, chatMultiThreadStrategy, onSuccess, onError);
630
650
  };
631
651
 
632
652
  /**