@blueconic/blueconic-react-native 3.1.0 → 3.2.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
@@ -2,6 +2,16 @@
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
+ ## [3.2.1] 2024-06-14
6
+
7
+ ### Fixed
8
+ - React-Android: Fixed issue with behaviour listener not processing values correctly in rule sets.
9
+
10
+ ## [3.2.0] 2024-06-14
11
+
12
+ ### Added
13
+ - Added support for timeline events in the SDK.
14
+
5
15
  ## [3.1.0] 2024-03-12
6
16
 
7
17
  ### Added
@@ -19,10 +19,10 @@ android {
19
19
  defaultConfig {
20
20
  minSdkVersion 21
21
21
  targetSdkVersion 33
22
- versionCode 300
23
- versionName "3.1.0"
22
+ versionCode 320
23
+ versionName "3.2.1"
24
24
  buildConfigField 'String', 'PLATFORM_NAME', "\"React Native\""
25
- buildConfigField 'String', 'PLATFORM_VERSION', "\"3.1.0\""
25
+ buildConfigField 'String', 'PLATFORM_VERSION', "\"3.2.1\""
26
26
  }
27
27
  lintOptions {
28
28
  abortOnError false
@@ -36,5 +36,5 @@ repositories {
36
36
 
37
37
  dependencies {
38
38
  compileOnly 'com.facebook.react:react-android:+'
39
- implementation 'com.blueconic:blueconic-android-lib:5.1.0'
39
+ implementation 'com.blueconic:blueconic-android-lib:5.2.2'
40
40
  }
@@ -22,12 +22,7 @@ import com.facebook.react.bridge.WritableNativeArray;
22
22
  import com.facebook.react.bridge.WritableNativeMap;
23
23
  import com.facebook.react.modules.core.DeviceEventManagerModule;
24
24
 
25
- import java.util.Map;
26
- import java.util.HashMap;
27
- import java.util.Collections;
28
- import java.util.Collection;
29
- import java.util.List;
30
- import java.util.ArrayList;
25
+ import java.util.*;
31
26
 
32
27
  import javax.annotation.Nonnull;
33
28
 
@@ -610,7 +605,6 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
610
605
  callback.invoke(Arguments.createArray());
611
606
  }
612
607
 
613
-
614
608
  /**
615
609
  * Update sync the BlueConic Profile
616
610
  */
@@ -750,6 +744,142 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
750
744
  }
751
745
  }
752
746
 
747
+ /**
748
+ * Create Timeline Event.
749
+ * @param eventType The type of event
750
+ * @param eventDate The date of the event
751
+ * @param readableMap The readable map retrieved from React native
752
+ */
753
+ @ReactMethod
754
+ public void registerTimelineEvent(@Nonnull String eventType, double eventDate, ReadableMap readableMap) {
755
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
756
+ final Map<String, Object> properties = readableMap.toHashMap();
757
+
758
+ if (blueConicClient != null) {
759
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, null);
760
+ }
761
+ }
762
+
763
+ /**
764
+ * Create Timeline Event.
765
+ * @param eventType The type of event
766
+ * @param eventDate The date of the event
767
+ * @param readableMap The readable map retrieved from React native
768
+ * @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
769
+ * Native Modules to pass values back to the JavaScript.
770
+ */
771
+ @ReactMethod
772
+ public void registerTimelineEventSync(@Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Promise promise) {
773
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
774
+ final Map<String, Object> properties = readableMap.toHashMap();
775
+
776
+ if (blueConicClient != null) {
777
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, new Runnable() {
778
+ @Override
779
+ public void run() {
780
+ promise.resolve(Arguments.createArray());
781
+ }
782
+ });
783
+ return;
784
+ }
785
+
786
+ promise.resolve(Arguments.createArray());
787
+ }
788
+
789
+ /**
790
+ * Create Timeline Event.
791
+ * @param eventType The type of event
792
+ * @param eventDate The date of the event
793
+ * @param readableMap The readable map retrieved from React native
794
+ * @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
795
+ * to pass values back to the JavaScript.
796
+ */
797
+ @ReactMethod
798
+ public void registerTimelineEventSyncWithCallback(@Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Callback callback) {
799
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
800
+ final Map<String, Object> properties = readableMap.toHashMap();
801
+
802
+ if (blueConicClient != null) {
803
+ blueConicClient.createTimelineEvent(eventType, new Date((long) eventDate), properties, new Runnable() {
804
+ @Override
805
+ public void run() {
806
+ callback.invoke(Arguments.createArray());
807
+ }
808
+ });
809
+ return;
810
+ }
811
+
812
+ callback.invoke(Arguments.createArray());
813
+ }
814
+
815
+ /**
816
+ * Create Timeline Event.
817
+ * @param eventType The type of event
818
+ * @param eventDate The date of the event
819
+ * @param readableMap The readable map retrieved from React native
820
+ */
821
+ @ReactMethod
822
+ public void registerTimelineEventById(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap) {
823
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
824
+ final Map<String, Object> properties = readableMap.toHashMap();
825
+
826
+ if (blueConicClient != null) {
827
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, null);
828
+ }
829
+ }
830
+
831
+ /**
832
+ * Create Timeline Event.
833
+ * @param eventType The type of event
834
+ * @param eventDate The date of the event
835
+ * @param readableMap The readable map retrieved from React native
836
+ * @param promise The promise to handle the obtained value. Promises are necessary in Native Modules
837
+ * Native Modules to pass values back to the JavaScript.
838
+ */
839
+ @ReactMethod
840
+ public void registerTimelineEventByIdSync(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Promise promise) {
841
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
842
+ final Map<String, Object> properties = readableMap.toHashMap();
843
+
844
+ if (blueConicClient != null) {
845
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, new Runnable() {
846
+ @Override
847
+ public void run() {
848
+ promise.resolve(Arguments.createArray());
849
+ }
850
+ });
851
+ return;
852
+ }
853
+
854
+ promise.resolve(Arguments.createArray());
855
+ }
856
+
857
+ /**
858
+ * Create Timeline Event.
859
+ * @param eventType The type of event
860
+ * @param eventDate The date of the event
861
+ * @param readableMap The readable map retrieved from React native
862
+ * @param callback The Callback function to handle the obtained values. Callbacks are necessary in Native Modules
863
+ * to pass values back to the JavaScript.
864
+ */
865
+ @ReactMethod
866
+ public void registerTimelineEventByIdSyncWithCallback(@Nonnull String eventId, @Nonnull String eventType, double eventDate, ReadableMap readableMap, @Nonnull final Callback callback) {
867
+ final BlueConicClient blueConicClient = getBlueConicClientInstance();
868
+ final Map<String, Object> properties = readableMap.toHashMap();
869
+
870
+ if (blueConicClient != null) {
871
+ blueConicClient.createTimelineEventById(eventId, eventType, new Date((long) eventDate), properties, new Runnable() {
872
+ @Override
873
+ public void run() {
874
+ callback.invoke(Arguments.createArray());
875
+ }
876
+ });
877
+ return;
878
+ }
879
+
880
+ callback.invoke(Arguments.createArray());
881
+ }
882
+
753
883
  /**
754
884
  * Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
755
885
  * @param selector The selector to identify the clicked component.
@@ -865,7 +995,7 @@ public class BlueConicClientModule extends ReactContextBaseJavaModule {
865
995
  BlueConicClient instance = BlueConicClientFactory.INSTANCE.getInstance(currentActivity);
866
996
  //Set platform information
867
997
  BlueConicClientImpl implInstance = (BlueConicClientImpl) instance;
868
- //implInstance.setPlatformInformation(BuildConfig.PLATFORM_NAME, BuildConfig.PLATFORM_VERSION);
998
+ implInstance.setPlatformInformation(BuildConfig.PLATFORM_NAME, BuildConfig.PLATFORM_VERSION);
869
999
  return instance;
870
1000
  }
871
1001
 
@@ -55,7 +55,7 @@ RCT_EXTERN_METHOD(hasSegmentWithCallback:(NSString *)segmentId withCallback:(RCT
55
55
 
56
56
  RCT_EXTERN_METHOD(createEvent:(NSString *)eventName withProperties:(NSDictionary *)properties)
57
57
  RCT_EXTERN_METHOD(createEventSync:(NSString *)eventName withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
58
- RCT_EXTERN_METHOD(createEventSyncWithCallback:eventName withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
58
+ RCT_EXTERN_METHOD(createEventSyncWithCallback:(NSString *)eventName withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
59
59
 
60
60
  RCT_EXTERN_METHOD(updateProfile)
61
61
  RCT_EXTERN_METHOD(updateProfileSync:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
@@ -65,6 +65,14 @@ RCT_EXTERN_METHOD(registerPageView:(NSString *)screenName)
65
65
  RCT_EXTERN_METHOD(registerPageViewSync:(NSString *)screenName withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
66
66
  RCT_EXTERN_METHOD(registerPageViewSyncWithCallback:(NSString *)screenName withCallback:(RCTResponseSenderBlock)callback)
67
67
 
68
+ RCT_EXTERN_METHOD(registerTimelineEvent:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties)
69
+ RCT_EXTERN_METHOD(registerTimelineEventSync:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
70
+ RCT_EXTERN_METHOD(registerTimelineEventSyncWithCallback:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
71
+
72
+ RCT_EXTERN_METHOD(registerTimelineEventById:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties)
73
+ RCT_EXTERN_METHOD(registerTimelineEventByIdSync:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withResolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
74
+ RCT_EXTERN_METHOD(registerTimelineEventByIdSyncWithCallback:(NSString *)eventId withType:(NSString *)eventType withDate:(NSDate *)eventDate withProperties:(NSDictionary *)properties withCallback:(RCTResponseSenderBlock)callback)
75
+
68
76
  RCT_EXTERN_METHOD(registerClickEvent:(NSString *)selector)
69
77
  RCT_EXTERN_METHOD(registerClickEventWithContext:(NSString *)selector withValues:(NSArray *)values)
70
78
  RCT_EXTERN_METHOD(registerFormSubmitEvent:(NSString *)selector)
@@ -1,4 +1,5 @@
1
1
  import UIKit
2
+ import Foundation
2
3
  import BlueConicClient
3
4
 
4
5
  /**
@@ -8,7 +9,7 @@ import BlueConicClient
8
9
  @objc(BlueConicClientModule)
9
10
  class BlueConicClientModule: RCTEventEmitter {
10
11
  private static var platformName: String = "React Native"
11
- private static var platformVersion: String = "3.1.0"
12
+ private static var platformVersion: String = "3.2.0"
12
13
  private static var moduleInstance: BlueConicClientModule?
13
14
  private static var hasListeners: Bool?
14
15
 
@@ -381,6 +382,40 @@ class BlueConicClientModule: RCTEventEmitter {
381
382
  })
382
383
  }
383
384
 
385
+ /**
386
+ Calls the createTimelineEvent method of the BlueConicClient.
387
+ */
388
+ @objc func registerTimelineEvent(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any]) -> Void {
389
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties)
390
+ }
391
+ @objc func registerTimelineEventSync(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
392
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties, completion: {
393
+ resolve([])
394
+ })
395
+ }
396
+ @objc func registerTimelineEventSyncWithCallback(_ eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
397
+ self.getBlueConicClientInstance().createTimelineEvent(eventType, eventDate: eventDate, properties: properties, completion: {
398
+ callback([])
399
+ })
400
+ }
401
+
402
+ /**
403
+ Calls the createTimelineEventById method of the BlueConicClient.
404
+ */
405
+ @objc func registerTimelineEventById(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any]) -> Void {
406
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties)
407
+ }
408
+ @objc func registerTimelineEventByIdSync(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withResolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
409
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties, completion: {
410
+ resolve([])
411
+ })
412
+ }
413
+ @objc func registerTimelineEventByIdSyncWithCallback(_ eventId: String, withType eventType: String, withDate eventDate: Date, withProperties properties: [String: Any], withCallback callback: @escaping RCTResponseSenderBlock) -> Void {
414
+ self.getBlueConicClientInstance().createTimelineEventById(eventId, eventType: eventType, eventDate: eventDate, properties: properties, completion: {
415
+ callback([])
416
+ })
417
+ }
418
+
384
419
  /**
385
420
  Creates a ClickEvent for the given selector and publishes the event to BlueConic using the EventManager.
386
421
  - parameter selector: The selector to identify the clicked component.
@@ -466,7 +501,7 @@ class BlueConicClientModule: RCTEventEmitter {
466
501
  */
467
502
  private func getBlueConicClientInstance() -> BlueConic {
468
503
  let instance = BlueConic.getInstance()
469
- //BlueConic.setPlatformInformation(platformName: BlueConicClientModule.platformName, platformVersion: BlueConicClientModule.platformVersion)
504
+ BlueConic.setPlatformInformation(platformName: BlueConicClientModule.platformName, platformVersion: BlueConicClientModule.platformVersion)
470
505
  return instance
471
506
  }
472
507
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueconic/blueconic-react-native",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
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": "5.1.0",
30
- "ios": "3.2.0"
29
+ "android": "5.2.2",
30
+ "ios": "3.3.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react-native": "<1.0.0"