@blueconic/blueconic-react-native 5.1.1 → 5.2.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
@@ -2,6 +2,17 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  `@blueconic/blueconic-react-native` adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [5.2.0] 2026-01-22
6
+
7
+ ### Added
8
+ - React-Android & iOS: Added Geofencing plugin support.
9
+
10
+ ### Changed
11
+ - React-Android & iOS: Optimized profile synchronization in regards to properties and plugins.
12
+
13
+ ### Fixed
14
+ - React-Android: Fixed issue with the SDK crashing when clearing plugins in certain cases.
15
+
5
16
  ## [5.1.1] 2025-10-22
6
17
 
7
18
  ### Fixed
@@ -22,12 +22,12 @@ android {
22
22
 
23
23
  namespace 'com.blueconic.reactnative'
24
24
  defaultConfig {
25
- minSdkVersion 21
25
+ minSdkVersion 23
26
26
  targetSdkVersion 36
27
- versionCode 510
28
- versionName "5.1.1"
27
+ versionCode 520
28
+ versionName "5.2.0"
29
29
  buildConfigField 'String', 'PLATFORM_NAME', "\"React Native\""
30
- buildConfigField 'String', 'PLATFORM_VERSION', "\"5.1.1\""
30
+ buildConfigField 'String', 'PLATFORM_VERSION', "\"5.2.0\""
31
31
  }
32
32
  lintOptions {
33
33
  abortOnError false
@@ -48,16 +48,22 @@ android {
48
48
  repositories {
49
49
  google()
50
50
  mavenCentral()
51
+ maven {
52
+ url = 'https://central.sonatype.com/repository/maven-snapshots/'
53
+ content {
54
+ includeModule("com.blueconic", "blueconic-android-lib")
55
+ }
56
+ }
51
57
  }
52
58
 
53
59
  dependencies {
54
60
  compileOnly 'com.facebook.react:react-android:+'
55
- implementation 'com.blueconic:blueconic-android-lib:7.1.0'
61
+ implementation 'com.blueconic:blueconic-android-lib:7.2.0'
56
62
 
57
63
  testImplementation 'androidx.core:core-ktx:1.17.0'
58
64
  testImplementation 'junit:junit:4.13.2'
59
65
  testImplementation "io.mockk:mockk:1.14.5"
60
66
  testImplementation 'com.facebook.react:react-android:+'
61
- testImplementation 'com.blueconic:blueconic-android-lib:7.1.0'
67
+ testImplementation 'com.blueconic:blueconic-android-lib:7.2.0'
62
68
  implementation "org.jetbrains.kotlin:kotlin-reflect:2.1.21"
63
69
  }
@@ -70,7 +70,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
70
70
 
71
71
  BlueConicConfiguration configuration = new BlueConicConfiguration.Builder()
72
72
  .setHostName((String)Objects.requireNonNull(properties.get("bc_hostname")))
73
- .setDebugMode((Boolean)Objects.requireNonNull(properties.get("bc_debug")))
73
+ .setDebugMode(Boolean.TRUE.equals(properties.get("bc_debug")))
74
74
  .build((Application) getReactApplicationContext().getApplicationContext());
75
75
 
76
76
  if (properties.containsKey("override_app_id") && properties.get("override_app_id") != null) {
@@ -1445,7 +1445,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
1445
1445
  EventHandler eventHandler = switch (eventName) {
1446
1446
  case "propertiesDialogueEvent" -> new PropertiesDialogueHandler(eventName);
1447
1447
  case "recommendationsDialogueEvent" -> new RecommendationsDialogueHandler(eventName);
1448
- default -> event -> {};
1448
+ default -> new ReactNativeEventHandler(eventName);
1449
1449
  };
1450
1450
 
1451
1451
  blueConicClient.getEventManager().subscribe(eventName, eventHandler, onlyOnce, identifier);
@@ -1850,6 +1850,22 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
1850
1850
  }
1851
1851
  }
1852
1852
 
1853
+ class ReactNativeEventHandler implements EventHandler {
1854
+ private final String eventName;
1855
+
1856
+ ReactNativeEventHandler(String eventName) {
1857
+ this.eventName = eventName;
1858
+ }
1859
+
1860
+ @Override
1861
+ public void handleEvent(@NotNull Event event) {
1862
+ Map<String, Object> values = new HashMap<>();
1863
+ values.put("name", event.getName());
1864
+ values.put("context", event.getContext());
1865
+ BlueConicClientModule.publishDialogueEvent(values, "blueConicEvent");
1866
+ }
1867
+ }
1868
+
1853
1869
  class PropertiesDialogueHandler implements EventHandler {
1854
1870
  private final String eventName;
1855
1871
 
@@ -1,7 +1,9 @@
1
1
 
2
2
  package com.blueconic.reactnative;
3
3
 
4
+ import java.util.Collections;
4
5
  import java.util.HashMap;
6
+ import java.util.List;
5
7
  import java.util.Map;
6
8
 
7
9
  import com.blueconic.BlueConicClient;
@@ -66,4 +68,9 @@ public class BlueConicInteraction implements Plugin {
66
68
  BlueConicClientModule.publishDialogueEvent(this.properties, "onBlueConicPluginDestroyed");
67
69
  }
68
70
  }
71
+
72
+ @Override
73
+ public List<String> getPreloadProperties() {
74
+ return Collections.emptyList();
75
+ }
69
76
  }
@@ -7,33 +7,44 @@ open class MockPromise : Promise {
7
7
  override fun resolve(values: Any?) {
8
8
  }
9
9
 
10
- override fun reject(message: String) {
10
+ override fun reject(code: String?, message: String?) {
11
11
  }
12
12
 
13
- override fun reject(code: String, userInfo: WritableMap) {
13
+ override fun reject(code: String?, throwable: Throwable?) {
14
14
  }
15
15
 
16
- override fun reject(code: String, message: String?) {
16
+ override fun reject(code: String?, message: String?, throwable: Throwable?) {
17
17
  }
18
18
 
19
- override fun reject(code: String, message: String?, userInfo: WritableMap) {
19
+ override fun reject(message: String) {
20
20
  }
21
21
 
22
- override fun reject(code: String, message: String?, throwable: Throwable?) {
22
+ override fun reject(p0: String?, p1: String?, p2: Throwable?, p3: WritableMap?) {
23
23
  }
24
24
 
25
- override fun reject(code: String, throwable: Throwable?) {
25
+ override fun reject(throwable: Throwable) {
26
26
  }
27
27
 
28
- override fun reject(code: String, throwable: Throwable?, userInfo: WritableMap) {
28
+ override fun reject(throwable: Throwable, userInfo: WritableMap) {
29
29
  }
30
30
 
31
- override fun reject(p0: String?, p1: String?, p2: Throwable?, p3: WritableMap?) {
31
+ override fun reject(code: String?, userInfo: WritableMap) {
32
+ TODO("Not yet implemented")
32
33
  }
33
34
 
34
- override fun reject(throwable: Throwable) {
35
+ override fun reject(
36
+ code: String?,
37
+ throwable: Throwable?,
38
+ userInfo: WritableMap
39
+ ) {
40
+ TODO("Not yet implemented")
35
41
  }
36
42
 
37
- override fun reject(throwable: Throwable, userInfo: WritableMap) {
43
+ override fun reject(
44
+ code: String?,
45
+ message: String?,
46
+ userInfo: WritableMap
47
+ ) {
48
+ TODO("Not yet implemented")
38
49
  }
39
50
  }
package/index.js CHANGED
@@ -51,7 +51,12 @@ class EventName {
51
51
  };
52
52
 
53
53
  export { EventName };
54
-
54
+
55
+ class Event {
56
+ name;
57
+ context;
58
+ }
59
+
55
60
  class PropertiesDialogueEvent {
56
61
  variantId;
57
62
  position;
@@ -65,7 +70,7 @@ class RecommendationsDialogueEvent {
65
70
  recommendations;
66
71
  };
67
72
 
68
- export { PropertiesDialogueEvent, RecommendationsDialogueEvent };
73
+ export { Event, PropertiesDialogueEvent, RecommendationsDialogueEvent };
69
74
 
70
75
  const { BlueConicClient } = NativeModules;
71
76
 
@@ -9,7 +9,7 @@ import BlueConicClient
9
9
  @objc(BlueConicClientModule)
10
10
  class BlueConicClientModule: RCTEventEmitter {
11
11
  private static var platformName: String = "React Native"
12
- private static var platformVersion: String = "5.1.1"
12
+ private static var platformVersion: String = "5.2.0"
13
13
  private static var moduleInstance: BlueConicClientModule?
14
14
  private static var hasListeners: Bool?
15
15
 
@@ -35,10 +35,13 @@ class BlueConicClientModule: RCTEventEmitter {
35
35
  @objc func initialize(_ properties: [String: Any], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
36
36
  let blueConicConfiguration = BlueConicConfiguration.Builder()
37
37
  .setHostName(properties["bc_hostname"] as! String)
38
- .setDebugMode(properties["bc_debug"] as! Bool)
39
38
  .setShared(false)
40
39
  .build()
41
40
 
41
+ if let debugMode = properties["bc_debug"] as? Bool {
42
+ blueConicConfiguration.isDebugMode = debugMode
43
+ }
44
+
42
45
  if let overrideAppId = properties["override_app_id"] as? String {
43
46
  blueConicConfiguration.appID = overrideAppId
44
47
  }
@@ -601,9 +604,9 @@ class BlueConicClientModule: RCTEventEmitter {
601
604
  case "recommendationsDialogueEvent":
602
605
  eventHandler = RecommendationsDialogueHandler(eventName: eventName)
603
606
  default:
604
- eventHandler = DefaultEventHandler()
607
+ eventHandler = ReactNativeEventHandler(eventName: eventName)
605
608
  }
606
-
609
+
607
610
  self.getBlueConicClientInstance().getEventManager().subscribe(
608
611
  eventName,
609
612
  callbackObject: eventHandler,
@@ -788,12 +791,10 @@ class BlueConicClientModule: RCTEventEmitter {
788
791
  }
789
792
 
790
793
  /**
791
- Static method that is called by the BlueConicInteraction when it receives the parameters of the dialogue,
792
- and when the dialogue is destroyed by the BlueConic SDK. An event is published to which the JavaScript of the app
793
- should subscribe.
794
+ Static method that is called when it receives the parameters of the interaction. An event is published to which the JavaScript of the app should subscribe.
794
795
  - parameter properties: The properties of the dialogue as received from BlueConic.
795
796
  */
796
- static func publishDialogueEvent(_ properties: Dictionary<String, Any>, eventName: String) -> Void {
797
+ static func publishSDKEvent(_ properties: Dictionary<String, Any>, eventName: String) -> Void {
797
798
  if hasListeners ?? false {
798
799
  moduleInstance?.sendEvent(withName: eventName, body: properties)
799
800
  }
@@ -817,7 +818,7 @@ class BlueConicClientModule: RCTEventEmitter {
817
818
  - returns: An array of event names that may be published to the JavaScript.
818
819
  */
819
820
  override func supportedEvents() -> [String]! {
820
- return ["onBlueConicPluginLoad", "onBlueConicPluginDestroyed", "propertiesDialogueEvent", "recommendationsDialogueEvent"]
821
+ return ["blueConicEvent", "onBlueConicPluginLoad", "onBlueConicPluginDestroyed", "propertiesDialogueEvent", "recommendationsDialogueEvent"]
821
822
  }
822
823
 
823
824
  /**
@@ -835,9 +836,18 @@ class BlueConicClientModule: RCTEventEmitter {
835
836
  }
836
837
  }
837
838
 
838
- class DefaultEventHandler: EventHandler {
839
- func handleEvent(_ event: Event) {
840
- // Default implementation does nothing
839
+ class ReactNativeEventHandler: EventHandler {
840
+ private let eventName: String
841
+
842
+ init(eventName: String) {
843
+ self.eventName = eventName
844
+ }
845
+
846
+ func handleEvent(_ event: BlueConicClient.Event) {
847
+ var properties = [String: Any]()
848
+ properties["name"] = event.name
849
+ properties["context"] = event.context
850
+ BlueConicClientModule.publishSDKEvent(properties, eventName: "blueConicEvent")
841
851
  }
842
852
  }
843
853
 
@@ -855,7 +865,7 @@ class PropertiesDialogueHandler: EventHandler {
855
865
  properties["variantId"] = propertiesDialogueEvent.variantId
856
866
  properties["position"] = propertiesDialogueEvent.position
857
867
  properties["data"] = propertiesDialogueEvent.data
858
- BlueConicClientModule.publishDialogueEvent(properties, eventName: self.eventName)
868
+ BlueConicClientModule.publishSDKEvent(properties, eventName: self.eventName)
859
869
  }
860
870
  }
861
871
 
@@ -874,6 +884,6 @@ class RecommendationsDialogueHandler: EventHandler {
874
884
  properties["position"] = recommendationsDialogueEvent.position
875
885
  properties["storeId"] = recommendationsDialogueEvent.storeId
876
886
  properties["recommendations"] = recommendationsDialogueEvent.recommendations
877
- BlueConicClientModule.publishDialogueEvent(properties, eventName: self.eventName)
887
+ BlueConicClientModule.publishSDKEvent(properties, eventName: self.eventName)
878
888
  }
879
889
  }
@@ -48,7 +48,7 @@ public class BlueConicInteraction: BlueConicPlugin {
48
48
  self.properties = properties
49
49
 
50
50
  if (self.properties != nil) {
51
- BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginLoad")
51
+ BlueConicClientModule.publishSDKEvent(properties, eventName: "onBlueConicPluginLoad")
52
52
  }
53
53
  }
54
54
 
@@ -57,7 +57,11 @@ public class BlueConicInteraction: BlueConicPlugin {
57
57
  */
58
58
  public func onDestroy() {
59
59
  if let properties = self.properties {
60
- BlueConicClientModule.publishDialogueEvent(properties, eventName: "onBlueConicPluginDestroyed")
60
+ BlueConicClientModule.publishSDKEvent(properties, eventName: "onBlueConicPluginDestroyed")
61
61
  }
62
62
  }
63
+
64
+ public func getPreloadProperties() -> [String] {
65
+ return []
66
+ }
63
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueconic/blueconic-react-native",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "description": "The BlueConicClient Framework provides the basis for communicating with BlueConic.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -26,8 +26,8 @@
26
26
  "author": "BlueConic (info@blueconic.com)",
27
27
  "license": "SEE LICENSE IN LICENSE",
28
28
  "nativeDependencies": {
29
- "android": "7.1.0",
30
- "ios": "5.1.1"
29
+ "android": "7.2.0",
30
+ "ios": "5.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react-native": "<1.0.0"