react-native-radar 4.0.0 → 4.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.
Files changed (81) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/radar/RadarModuleImpl.java +110 -0
  3. package/android/src/newarch/java/com/radar/RadarModule.kt +45 -2
  4. package/android/src/oldarch/java/com/radar/RadarModule.java +56 -2
  5. package/dist/@types/RadarNativeInterface.d.ts +9 -2
  6. package/dist/@types/types.d.ts +47 -6
  7. package/dist/NativeRadar.d.ts +8 -1
  8. package/dist/index.native.js +35 -3
  9. package/dist/index.web.d.ts +6 -0
  10. package/dist/index.web.js +17 -0
  11. package/dist/version.d.ts +1 -1
  12. package/dist/version.js +1 -1
  13. package/ios/RNRadar.mm +155 -3
  14. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar.h +108 -0
  15. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
  16. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
  17. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
  18. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
  19. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK-Swift.h +101 -7
  20. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK.h +1 -1
  21. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
  22. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
  23. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
  24. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrip.h +15 -0
  25. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
  26. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
  27. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
  28. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarUser.h +2 -0
  29. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Info.plist +0 -0
  30. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.abi.json +1702 -209
  31. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +34 -9
  32. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  33. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftinterface +34 -9
  34. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/module.modulemap +0 -1
  35. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/RadarSDK +0 -0
  36. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/Radar.h +108 -0
  37. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
  38. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
  39. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
  40. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
  41. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK-Swift.h +204 -16
  42. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK.h +1 -1
  43. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
  44. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
  45. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
  46. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrip.h +15 -0
  47. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
  48. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
  49. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
  50. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarUser.h +2 -0
  51. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Info.plist +0 -0
  52. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1702 -209
  53. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +34 -9
  54. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  55. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +34 -9
  56. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1702 -209
  57. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +34 -9
  58. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  59. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +34 -9
  60. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/module.modulemap +0 -1
  61. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/RadarSDK +0 -0
  62. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeDirectory +0 -0
  63. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeResources +71 -60
  64. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
  65. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Info.plist +0 -0
  66. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/RadarSDKMotion +0 -0
  67. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
  68. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Info.plist +0 -0
  69. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/RadarSDKMotion +0 -0
  70. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeDirectory +0 -0
  71. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeResources +3 -3
  72. package/package.json +2 -2
  73. package/src/@types/RadarNativeInterface.ts +11 -2
  74. package/src/@types/maplibre-react-native.d.ts +1 -14
  75. package/src/@types/types.ts +65 -7
  76. package/src/NativeRadar.ts +8 -1
  77. package/src/index.native.ts +42 -3
  78. package/src/index.web.js +17 -0
  79. package/src/version.ts +1 -1
  80. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar-Swift.h +0 -7
  81. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/Radar-Swift.h +0 -7
@@ -1,4 +1,4 @@
1
- def radar_sdk_version = '3.24.2'
1
+ def radar_sdk_version = '3.30.0'
2
2
 
3
3
  buildscript {
4
4
  ext.getExtOrDefault = {name ->
@@ -40,6 +40,7 @@ import io.radar.sdk.model.RadarUser;
40
40
  import io.radar.sdk.model.RadarVerifiedLocationToken;
41
41
  import io.radar.sdk.model.RadarInAppMessage;
42
42
  import io.radar.sdk.RadarNotificationOptions;
43
+ import io.radar.sdk.model.RadarTripLeg;
43
44
 
44
45
  import org.json.JSONException;
45
46
  import org.json.JSONObject;
@@ -734,6 +735,96 @@ public class RadarModuleImpl {
734
735
  }
735
736
  }
736
737
 
738
+ public void updateTripLeg(ReadableMap optionsMap, final Promise promise) {
739
+ if (promise == null) {
740
+ return;
741
+ }
742
+
743
+ if (optionsMap == null || !optionsMap.hasKey("legId") || optionsMap.isNull("legId") || !optionsMap.hasKey("status") || optionsMap.isNull("status")) {
744
+ promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), Radar.RadarStatus.ERROR_BAD_REQUEST.toString());
745
+ return;
746
+ }
747
+
748
+ String legId = optionsMap.getString("legId");
749
+ String statusStr = optionsMap.getString("status");
750
+ RadarTripLeg.RadarTripLegStatus legStatus = RadarTripLeg.statusForString(statusStr);
751
+
752
+ Radar.RadarTripLegCallback callback = new Radar.RadarTripLegCallback() {
753
+ public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarTripLeg leg, @Nullable RadarEvent[] events) {
754
+ try {
755
+ if (status == Radar.RadarStatus.SUCCESS) {
756
+ WritableMap map = Arguments.createMap();
757
+ map.putString("status", status.toString());
758
+ if (trip != null) {
759
+ map.putMap("trip", RadarUtils.mapForJson(trip.toJson()));
760
+ }
761
+ if (leg != null) {
762
+ map.putMap("leg", RadarUtils.mapForJson(leg.toJson()));
763
+ }
764
+ if (events != null) {
765
+ map.putArray("events", RadarUtils.arrayForJson(RadarEvent.toJson(events)));
766
+ }
767
+ promise.resolve(map);
768
+ } else {
769
+ promise.reject(status.toString(), status.toString());
770
+ }
771
+ } catch (JSONException e) {
772
+ Log.e(TAG, "JSONException", e);
773
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
774
+ }
775
+ }
776
+ };
777
+
778
+ String tripId = (optionsMap.hasKey("tripId") && !optionsMap.isNull("tripId")) ? optionsMap.getString("tripId") : null;
779
+ if (tripId != null) {
780
+ Radar.updateTripLeg(tripId, legId, legStatus, callback);
781
+ } else {
782
+ Radar.updateTripLeg(legId, legStatus, callback);
783
+ }
784
+ }
785
+
786
+ public void reorderTripLegs(ReadableMap optionsMap, final Promise promise) {
787
+ if (promise == null) {
788
+ return;
789
+ }
790
+
791
+ if (optionsMap == null || !optionsMap.hasKey("legIds") || optionsMap.isNull("legIds")) {
792
+ promise.reject(Radar.RadarStatus.ERROR_BAD_REQUEST.toString(), Radar.RadarStatus.ERROR_BAD_REQUEST.toString());
793
+ return;
794
+ }
795
+
796
+ String[] legIds = RadarUtils.stringArrayForArray(optionsMap.getArray("legIds"));
797
+
798
+ Radar.RadarTripCallback callback = new Radar.RadarTripCallback() {
799
+ public void onComplete(@NonNull Radar.RadarStatus status, @Nullable RadarTrip trip, @Nullable RadarEvent[] events) {
800
+ try {
801
+ if (status == Radar.RadarStatus.SUCCESS) {
802
+ WritableMap map = Arguments.createMap();
803
+ map.putString("status", status.toString());
804
+ if (trip != null) {
805
+ map.putMap("trip", RadarUtils.mapForJson(trip.toJson()));
806
+ }
807
+ if (events != null) {
808
+ map.putArray("events", RadarUtils.arrayForJson(RadarEvent.toJson(events)));
809
+ }
810
+ promise.resolve(map);
811
+ } else {
812
+ promise.reject(status.toString(), status.toString());
813
+ }
814
+ } catch (JSONException e) {
815
+ Log.e(TAG, "JSONException", e);
816
+ promise.reject(Radar.RadarStatus.ERROR_SERVER.toString(), Radar.RadarStatus.ERROR_SERVER.toString());
817
+ }
818
+ }
819
+ };
820
+
821
+ String tripId = (optionsMap.hasKey("tripId") && !optionsMap.isNull("tripId")) ? optionsMap.getString("tripId") : null;
822
+ if (tripId != null) {
823
+ Radar.reorderTripLegs(tripId, legIds, callback);
824
+ } else {
825
+ Radar.reorderTripLegs(legIds, callback);
826
+ }
827
+ }
737
828
 
738
829
  public void getContext(@Nullable ReadableMap locationMap, final Promise promise) {
739
830
  if (promise == null) {
@@ -1298,4 +1389,23 @@ public class RadarModuleImpl {
1298
1389
  }
1299
1390
  Radar.showInAppMessage(inAppMessage);
1300
1391
  }
1392
+
1393
+ public void setPushNotificationToken(String token) {
1394
+ Radar.setPushNotificationToken(token);
1395
+ }
1396
+
1397
+ public void isInitialized(final Promise promise) {
1398
+ if (promise == null) {
1399
+ return;
1400
+ }
1401
+ promise.resolve(Radar.isInitialized());
1402
+ }
1403
+
1404
+ public void setAppGroup(String groupId) {
1405
+ // No-op on Android - app groups are iOS-specific
1406
+ }
1407
+
1408
+ public void setLocationExtensionToken(String token) {
1409
+ // No-op on Android - location extensions are iOS-specific
1410
+ }
1301
1411
  }
@@ -140,10 +140,10 @@ class RadarModule(reactContext: ReactApplicationContext) :
140
140
  return NAME
141
141
  }
142
142
 
143
- override fun initialize(publishableKey: String, fraud: Boolean): Unit {
143
+ override fun initialize(publishableKey: String, fraud: Boolean, options: ReadableMap?): Unit {
144
144
  val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
145
145
  editor.putString("x_platform_sdk_type", "ReactNative")
146
- editor.putString("x_platform_sdk_version", "4.0.0")
146
+ editor.putString("x_platform_sdk_version", "4.2.0")
147
147
  editor.apply()
148
148
 
149
149
  Radar.initialize(reactApplicationContext, publishableKey, radarReceiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, radarInAppMessageReceiver, currentActivity)
@@ -152,6 +152,26 @@ class RadarModule(reactContext: ReactApplicationContext) :
152
152
  }
153
153
  }
154
154
 
155
+ override fun initializeWithAuthToken(authToken: String, fraud: Boolean, options: ReadableMap?): Unit {
156
+ val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
157
+ editor.putString("x_platform_sdk_type", "ReactNative")
158
+ editor.putString("x_platform_sdk_version", "4.2.0")
159
+ editor.apply()
160
+
161
+ val initOptions = io.radar.sdk.RadarInitializeOptions.builder()
162
+ .authToken(authToken)
163
+ .radarReceiver(radarReceiver)
164
+ .locationProvider(Radar.RadarLocationServicesProvider.GOOGLE)
165
+ .fraud(fraud)
166
+ .inAppMessageReceiver(radarInAppMessageReceiver)
167
+ .apply { currentActivity?.let { activity(it) } }
168
+ .build()
169
+ Radar.initialize(reactApplicationContext, initOptions)
170
+ if (fraud) {
171
+ Radar.setVerifiedReceiver(radarVerifiedReceiver)
172
+ }
173
+ }
174
+
155
175
  override fun setLogLevel(level: String): Unit {
156
176
  radarModuleImpl.setLogLevel(level)
157
177
  }
@@ -364,6 +384,14 @@ class RadarModule(reactContext: ReactApplicationContext) :
364
384
  radarModuleImpl.updateTrip(options, promise)
365
385
  }
366
386
 
387
+ override fun updateTripLeg(options: ReadableMap, promise: Promise): Unit {
388
+ radarModuleImpl.updateTripLeg(options, promise)
389
+ }
390
+
391
+ override fun reorderTripLegs(options: ReadableMap, promise: Promise): Unit {
392
+ radarModuleImpl.reorderTripLegs(options, promise)
393
+ }
394
+
367
395
  override fun acceptEvent(eventId: String, verifiedPlaceId: String): Unit {
368
396
  radarModuleImpl.acceptEvent(eventId, verifiedPlaceId)
369
397
  }
@@ -432,6 +460,21 @@ class RadarModule(reactContext: ReactApplicationContext) :
432
460
  radarModuleImpl.showInAppMessage(inAppMessage)
433
461
  }
434
462
 
463
+ override fun setPushNotificationToken(token: String): Unit {
464
+ radarModuleImpl.setPushNotificationToken(token)
465
+ }
466
+
467
+ override fun isInitialized(promise: Promise): Unit {
468
+ radarModuleImpl.isInitialized(promise)
469
+ }
470
+
471
+ override fun setAppGroup(groupId: String): Unit {
472
+ radarModuleImpl.setAppGroup(groupId)
473
+ }
474
+
475
+ override fun setLocationExtensionToken(token: String): Unit {
476
+ radarModuleImpl.setLocationExtensionToken(token)
477
+ }
435
478
 
436
479
  companion object {
437
480
  const val NAME = "RNRadar"
@@ -98,11 +98,11 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
98
98
  }
99
99
 
100
100
  @ReactMethod
101
- public void initialize(String publishableKey, boolean fraud) {
101
+ public void initialize(String publishableKey, boolean fraud, ReadableMap options) {
102
102
  this.fraud = fraud;
103
103
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
104
104
  editor.putString("x_platform_sdk_type", "ReactNative");
105
- editor.putString("x_platform_sdk_version", "4.0.0");
105
+ editor.putString("x_platform_sdk_version", "4.2.0");
106
106
  editor.apply();
107
107
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud, null, inAppMessageReceiver, getCurrentActivity());
108
108
  if (fraud) {
@@ -110,6 +110,31 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
110
110
  }
111
111
  }
112
112
 
113
+ @ReactMethod
114
+ public void initializeWithAuthToken(String authToken, boolean fraud, ReadableMap options) {
115
+ this.fraud = fraud;
116
+ SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
117
+ editor.putString("x_platform_sdk_type", "ReactNative");
118
+ editor.putString("x_platform_sdk_version", "4.2.0");
119
+ editor.apply();
120
+
121
+ io.radar.sdk.RadarInitializeOptions.Builder builder = io.radar.sdk.RadarInitializeOptions.builder()
122
+ .authToken(authToken)
123
+ .radarReceiver(receiver)
124
+ .locationProvider(Radar.RadarLocationServicesProvider.GOOGLE)
125
+ .fraud(fraud)
126
+ .inAppMessageReceiver(inAppMessageReceiver);
127
+ if (getCurrentActivity() != null) {
128
+ builder.activity(getCurrentActivity());
129
+ }
130
+ io.radar.sdk.RadarInitializeOptions initOptions = builder.build();
131
+
132
+ Radar.initialize(getReactApplicationContext(), initOptions);
133
+ if (fraud) {
134
+ Radar.setVerifiedReceiver(verifiedReceiver);
135
+ }
136
+ }
137
+
113
138
  @ReactMethod
114
139
  public void setLogLevel(String level) {
115
140
  radarModuleImpl.setLogLevel(level);
@@ -374,6 +399,16 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
374
399
  radarModuleImpl.updateTrip(optionsMap, promise);
375
400
  }
376
401
 
402
+ @ReactMethod
403
+ public void updateTripLeg(ReadableMap optionsMap, final Promise promise) {
404
+ radarModuleImpl.updateTripLeg(optionsMap, promise);
405
+ }
406
+
407
+ @ReactMethod
408
+ public void reorderTripLegs(ReadableMap optionsMap, final Promise promise) {
409
+ radarModuleImpl.reorderTripLegs(optionsMap, promise);
410
+ }
411
+
377
412
  @ReactMethod
378
413
  public void getContext(@Nullable ReadableMap locationMap, final Promise promise) {
379
414
  radarModuleImpl.getContext(locationMap, promise);
@@ -444,4 +479,23 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
444
479
  radarModuleImpl.showInAppMessage(inAppMessageMap);
445
480
  }
446
481
 
482
+ @ReactMethod
483
+ public void setPushNotificationToken(String token) {
484
+ radarModuleImpl.setPushNotificationToken(token);
485
+ }
486
+
487
+ @ReactMethod
488
+ public void isInitialized(final Promise promise) {
489
+ radarModuleImpl.isInitialized(promise);
490
+ }
491
+
492
+ @ReactMethod
493
+ public void setAppGroup(String groupId) {
494
+ radarModuleImpl.setAppGroup(groupId);
495
+ }
496
+
497
+ @ReactMethod
498
+ public void setLocationExtensionToken(String token) {
499
+ radarModuleImpl.setLocationExtensionToken(token);
500
+ }
447
501
  }
@@ -1,6 +1,7 @@
1
- import type { RadarPermissionsStatus, RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarClientLocationUpdateCallback, RadarErrorCallback, RadarLogUpdateCallback, RadarEventUpdateCallback, RadarTokenUpdateCallback, RadarLogLevel, RadarMetadata, RadarTrackingOptionsDesiredAccuracy, RadarLocationCallback, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarMockTrackingOptions, RadarTrackingOptionsForegroundService, RadarNotificationOptions, RadarTripOptions, RadarStartTripOptions, RadarTripCallback, RadarUpdateTripOptions, RadarContextCallback, RadarSearchPlacesOptions, RadarSearchPlacesCallback, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarAutocompleteOptions, RadarAddressCallback, RadarReverseGeocodeOptions, RadarGeocodeOptions, RadarValidateAddressCallback, RadarIPGeocodeCallback, RadarAddress, RadarLogConversionOptions, RadarGetDistanceOptions, RadarRouteCallback, RadarGetMatrixOptions, RadarLogConversionCallback, RadarRouteMatrix, Location, RadarNewInAppMessageCallback, RadarInAppMessageDismissedCallback, RadarInAppMessageClickedCallback, RadarInAppMessage } from "./types";
1
+ import type { RadarPermissionsStatus, RadarTrackCallback, RadarTrackOnceOptions, RadarLocationUpdateCallback, RadarClientLocationUpdateCallback, RadarErrorCallback, RadarLogUpdateCallback, RadarEventUpdateCallback, RadarTokenUpdateCallback, RadarLogLevel, RadarMetadata, RadarTrackingOptionsDesiredAccuracy, RadarLocationCallback, RadarTrackVerifiedCallback, RadarTrackVerifiedOptions, RadarTrackingOptions, RadarVerifiedTrackingOptions, RadarMockTrackingOptions, RadarTrackingOptionsForegroundService, RadarNotificationOptions, RadarTripOptions, RadarStartTripOptions, RadarTripCallback, RadarUpdateTripOptions, RadarContextCallback, RadarSearchPlacesOptions, RadarSearchPlacesCallback, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarAutocompleteOptions, RadarAddressCallback, RadarReverseGeocodeOptions, RadarGeocodeOptions, RadarValidateAddressCallback, RadarIPGeocodeCallback, RadarAddress, RadarLogConversionOptions, RadarGetDistanceOptions, RadarRouteCallback, RadarGetMatrixOptions, RadarLogConversionCallback, RadarRouteMatrix, Location, RadarNewInAppMessageCallback, RadarInAppMessageDismissedCallback, RadarInAppMessageClickedCallback, RadarInAppMessage, RadarReorderTripLegsOptions, RadarUpdateTripLegOptions, RadarTripLegCallback } from "./types";
2
2
  export interface RadarNativeInterface {
3
- initialize: (publishableKey: string, fraud?: boolean) => void;
3
+ initialize: (publishableKey: string, fraud?: boolean, options?: Object | null) => void;
4
+ initializeWithAuthToken: (authToken: string, fraud?: boolean, options?: Object | null) => void;
4
5
  setLogLevel: (level: RadarLogLevel) => void;
5
6
  setUserId: (userId: string) => void;
6
7
  getUserId: () => Promise<string>;
@@ -41,6 +42,8 @@ export interface RadarNativeInterface {
41
42
  completeTrip: () => Promise<RadarTripCallback>;
42
43
  cancelTrip: () => Promise<RadarTripCallback>;
43
44
  updateTrip: (options: RadarUpdateTripOptions) => Promise<RadarTripCallback>;
45
+ updateTripLeg: (options: RadarUpdateTripLegOptions) => Promise<RadarTripLegCallback>;
46
+ reorderTripLegs: (options: RadarReorderTripLegsOptions) => Promise<RadarTripCallback>;
44
47
  acceptEvent: (eventId: string, verifiedPlaceId: string) => void;
45
48
  rejectEvent: (eventId: string) => void;
46
49
  getContext: (location?: Location) => Promise<RadarContextCallback>;
@@ -57,6 +60,10 @@ export interface RadarNativeInterface {
57
60
  nativeSdkVersion: () => Promise<string>;
58
61
  rnSdkVersion: () => string;
59
62
  showInAppMessage: (inAppMessage: RadarInAppMessage) => void;
63
+ setPushNotificationToken: (token: string) => void;
64
+ isInitialized: () => Promise<boolean>;
65
+ setAppGroup: (groupId: string) => void;
66
+ setLocationExtensionToken: (token: string) => void;
60
67
  onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => void;
61
68
  onClientLocationUpdated: (callback: RadarClientLocationUpdateCallback | null) => void;
62
69
  onError: (callback: RadarErrorCallback | null) => void;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { type NativeSyntheticEvent } from "react-native";
2
3
  import type { MapRef } from "@maplibre/maplibre-react-native";
3
4
  export type RadarMetadata = Record<string, string | number | boolean>;
4
5
  export interface RadarTrackOnceOptions {
@@ -25,7 +26,7 @@ export interface RadarTrackingOptions {
25
26
  desiredAccuracy: RadarTrackingOptionsDesiredAccuracy;
26
27
  stopDuration: number;
27
28
  stopDistance: number;
28
- sync: "all" | "stopsAndExits" | "none";
29
+ sync: "all" | "stopsAndExits" | "none" | "events";
29
30
  replay: "all" | "stops" | "none";
30
31
  useStoppedGeofence: boolean;
31
32
  showBlueBar?: boolean;
@@ -159,6 +160,7 @@ export interface RadarTripOptions {
159
160
  scheduledArrivalAt?: number;
160
161
  approachingThreshold?: number;
161
162
  startTracking?: boolean;
163
+ legs?: RadarTripLeg[];
162
164
  }
163
165
  export interface RadarTrackCallback {
164
166
  status: string;
@@ -344,6 +346,41 @@ export interface RadarTrip {
344
346
  scheduledArrivalAt?: Date;
345
347
  destinationLocation: Location;
346
348
  delay: RadarDelay;
349
+ legs?: RadarTripLeg[];
350
+ }
351
+ export type RadarTripLegStatus = "unknown" | "pending" | "started" | "approaching" | "arrived" | "completed" | "canceled" | "expired";
352
+ export type RadarTripLegDestinationType = "unknown" | "geofence" | "address" | "coordinates";
353
+ export interface RadarTripLeg {
354
+ _id?: string;
355
+ status?: RadarTripLegStatus;
356
+ destinationType?: RadarTripLegDestinationType;
357
+ createdAt?: string;
358
+ updatedAt?: string;
359
+ etaDuration?: number;
360
+ etaDistance?: number;
361
+ destinationGeofenceTag?: string;
362
+ destinationGeofenceExternalId?: string;
363
+ destinationGeofenceId?: string;
364
+ address?: string;
365
+ coordinates?: Location;
366
+ arrivalRadius?: number;
367
+ stopDuration?: number;
368
+ metadata?: RadarMetadata;
369
+ }
370
+ export interface RadarUpdateTripLegOptions {
371
+ tripId?: string;
372
+ legId: string;
373
+ status: RadarTripLegStatus;
374
+ }
375
+ export interface RadarReorderTripLegsOptions {
376
+ tripId?: string;
377
+ legIds: string[];
378
+ }
379
+ export interface RadarTripLegCallback {
380
+ status: string;
381
+ trip?: RadarTrip;
382
+ leg?: RadarTripLeg;
383
+ events?: RadarEvent[];
347
384
  }
348
385
  export interface RadarDelay {
349
386
  delayed: boolean;
@@ -528,7 +565,7 @@ export interface RadarFraud {
528
565
  sharing: boolean;
529
566
  }
530
567
  export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
531
- export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
568
+ export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all" | "events";
532
569
  export type RadarRouteMode = "foot" | "bike" | "car" | "truck" | "motorbike";
533
570
  export interface RadarTrackingOptionsForegroundService {
534
571
  text?: string;
@@ -548,14 +585,18 @@ export interface RadarMapOptions {
548
585
  showUserLocation?: boolean;
549
586
  mapRef?: React.Ref<MapRef>;
550
587
  onRegionDidChange?: (event: RadarMapRegionChangeEvent) => void;
551
- onDidFinishLoadingMap?: () => void;
552
- onWillStartLoadingMap?: () => void;
553
- onDidFailLoadingMap?: () => void;
588
+ onDidFinishLoadingMap?: (event: NativeSyntheticEvent<null>) => void;
589
+ onWillStartLoadingMap?: (event: NativeSyntheticEvent<null>) => void;
590
+ onDidFailLoadingMap?: (event: NativeSyntheticEvent<null>) => void;
554
591
  }
555
592
  export interface RadarMapRegionChangeEvent {
556
593
  center: [number, number];
557
594
  zoom: number;
558
- bounds?: [[number, number], [number, number]];
595
+ /**
596
+ * Geographic bounds in `[west, south, east, north]` order (south-west corner
597
+ * then north-east corner, per GeoJSON RFC 7946).
598
+ */
599
+ bounds?: [west: number, south: number, east: number, north: number];
559
600
  bearing?: number;
560
601
  pitch?: number;
561
602
  animated: boolean;
@@ -32,7 +32,8 @@ export type InAppMessageClickedEmitter = {
32
32
  inAppMessage: Object;
33
33
  };
34
34
  export interface Spec extends TurboModule {
35
- initialize(publishableKey: string, fraud: boolean): void;
35
+ initialize(publishableKey: string, fraud: boolean, options: Object | null): void;
36
+ initializeWithAuthToken(authToken: string, fraud: boolean, options: Object | null): void;
36
37
  requestPermissions(background: boolean): Promise<string>;
37
38
  getPermissionsStatus(): Promise<string>;
38
39
  trackOnce(trackOnceOptions: Object | null): Promise<Object>;
@@ -73,6 +74,8 @@ export interface Spec extends TurboModule {
73
74
  completeTrip(): Promise<Object>;
74
75
  cancelTrip(): Promise<Object>;
75
76
  updateTrip(options: Object): Promise<Object>;
77
+ updateTripLeg(options: Object): Promise<Object>;
78
+ reorderTripLegs(options: Object): Promise<Object>;
76
79
  acceptEvent(eventId: string, verifiedPlaceId: string): void;
77
80
  rejectEvent(eventId: string): void;
78
81
  getContext(location: Object | null): Promise<Object>;
@@ -90,6 +93,10 @@ export interface Spec extends TurboModule {
90
93
  getHost(): Promise<string>;
91
94
  getPublishableKey(): Promise<string>;
92
95
  showInAppMessage(inAppMessage: Object): void;
96
+ setPushNotificationToken(token: string): void;
97
+ isInitialized(): Promise<boolean>;
98
+ setAppGroup(groupId: string): void;
99
+ setLocationExtensionToken(token: string): void;
93
100
  readonly locationEmitter: EventEmitter<LocationEmitter>;
94
101
  readonly clientLocationEmitter: EventEmitter<ClientLocationEmitter>;
95
102
  readonly errorEmitter: EventEmitter<ErrorEmitter>;
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.addListener = addListener;
16
16
  const react_native_1 = require("react-native");
17
+ const react_native_2 = require("react-native");
17
18
  const version_1 = require("./version");
18
19
  const NativeRadar_1 = __importDefault(require("./NativeRadar"));
19
20
  const NativeRadar = NativeRadar_1.default;
@@ -31,7 +32,7 @@ const NativeRadar = NativeRadar_1.default;
31
32
  // },
32
33
  // });
33
34
  const compatEventEmitter = NativeRadar.locationEmitter == null
34
- ? new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNRadar)
35
+ ? new react_native_2.NativeEventEmitter(react_native_2.NativeModules.RNRadar)
35
36
  : null;
36
37
  function addListener(event, handler) {
37
38
  if (compatEventEmitter != null) {
@@ -49,8 +50,15 @@ let newInAppMessageUpdateSubscription = null;
49
50
  let inAppMessageDismissedUpdateSubscription = null;
50
51
  let inAppMessageClickedUpdateSubscription = null;
51
52
  const Radar = {
52
- initialize: (publishableKey, fraud) => {
53
- NativeRadar.initialize(publishableKey, !!fraud);
53
+ initialize: (publishableKey, fraud, options) => {
54
+ NativeRadar.initialize(publishableKey, !!fraud, options || null);
55
+ Radar.onNewInAppMessage((inAppMessage) => {
56
+ Radar.showInAppMessage(inAppMessage);
57
+ });
58
+ return;
59
+ },
60
+ initializeWithAuthToken: (authToken, fraud, options) => {
61
+ NativeRadar.initializeWithAuthToken(authToken, !!fraud, options || null);
54
62
  Radar.onNewInAppMessage((inAppMessage) => {
55
63
  Radar.showInAppMessage(inAppMessage);
56
64
  });
@@ -191,6 +199,21 @@ const Radar = {
191
199
  showInAppMessage: (inAppMessage) => {
192
200
  return NativeRadar.showInAppMessage(inAppMessage);
193
201
  },
202
+ setPushNotificationToken: (token) => {
203
+ if (react_native_1.Platform.OS === "android") {
204
+ return NativeRadar.setPushNotificationToken(token);
205
+ }
206
+ },
207
+ setAppGroup: (groupId) => {
208
+ if (react_native_1.Platform.OS === "ios") {
209
+ return NativeRadar.setAppGroup(groupId);
210
+ }
211
+ },
212
+ setLocationExtensionToken: (token) => {
213
+ if (react_native_1.Platform.OS === "ios") {
214
+ return NativeRadar.setLocationExtensionToken(token);
215
+ }
216
+ },
194
217
  requestPermissions: (background) => {
195
218
  return NativeRadar.requestPermissions(background);
196
219
  },
@@ -308,6 +331,12 @@ const Radar = {
308
331
  updateTrip: function (options) {
309
332
  return NativeRadar.updateTrip(options);
310
333
  },
334
+ updateTripLeg: function (options) {
335
+ return NativeRadar.updateTripLeg(options);
336
+ },
337
+ reorderTripLegs: function (options) {
338
+ return NativeRadar.reorderTripLegs(options);
339
+ },
311
340
  acceptEvent: function (eventId, verifiedPlaceId) {
312
341
  return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
313
342
  },
@@ -359,5 +388,8 @@ const Radar = {
359
388
  getPublishableKey: function () {
360
389
  return NativeRadar.getPublishableKey();
361
390
  },
391
+ isInitialized: function () {
392
+ return NativeRadar.isInitialized();
393
+ },
362
394
  };
363
395
  exports.default = Radar;
@@ -1,6 +1,7 @@
1
1
  export default Radar;
2
2
  declare namespace Radar {
3
3
  export { initialize };
4
+ export { initializeWithAuthToken };
4
5
  export { setLogLevel };
5
6
  export { setUserId };
6
7
  export { getUserId };
@@ -33,6 +34,8 @@ declare namespace Radar {
33
34
  export { completeTrip };
34
35
  export { cancelTrip };
35
36
  export { updateTrip };
37
+ export { updateTripLeg };
38
+ export { reorderTripLegs };
36
39
  export { acceptEvent };
37
40
  export { rejectEvent };
38
41
  export { getContext };
@@ -57,6 +60,7 @@ declare namespace Radar {
57
60
  export { setRequestHeaders };
58
61
  }
59
62
  declare function initialize(publishableKey: any): void;
63
+ declare function initializeWithAuthToken(authToken: any): void;
60
64
  declare function setLogLevel(level: any): void;
61
65
  declare function setUserId(userId: any): void;
62
66
  declare function getUserId(): Promise<any>;
@@ -89,6 +93,8 @@ declare function startTrip(options: any): Promise<any>;
89
93
  declare function completeTrip(): Promise<any>;
90
94
  declare function cancelTrip(): Promise<any>;
91
95
  declare function updateTrip(tripOptions: any): Promise<any>;
96
+ declare function updateTripLeg(options: any): Promise<any>;
97
+ declare function reorderTripLegs(options: any): Promise<any>;
92
98
  declare function acceptEvent(eventId: any, verifiedPlaceId: any): void;
93
99
  declare function rejectEvent(eventId: any): void;
94
100
  declare function getContext(options: any): Promise<any>;
package/dist/index.web.js CHANGED
@@ -12,6 +12,10 @@ const throwOnUnimplemented = (value) => {
12
12
  const initialize = (publishableKey) => {
13
13
  radar_sdk_js_1.default.initialize(publishableKey);
14
14
  };
15
+ const initializeWithAuthToken = (authToken) => {
16
+ if (throws)
17
+ throw new Error("initializeWithAuthToken() is not implemented on web");
18
+ };
15
19
  const setLogLevel = (level) => {
16
20
  if (throws)
17
21
  throw new Error("setLogLevel() is not implemented on web");
@@ -250,6 +254,16 @@ const updateTrip = (tripOptions) => {
250
254
  radar_sdk_js_1.default.updateTrip(tripOptions.options, tripOptions.status, callback);
251
255
  });
252
256
  };
257
+ const updateTripLeg = (options) => {
258
+ if (throws)
259
+ throw new Error("updateTripLeg() is not implemented on web");
260
+ return new Promise((resolve, reject) => { reject("updateTripLeg() is not implemented on web"); });
261
+ };
262
+ const reorderTripLegs = (options) => {
263
+ if (throws)
264
+ throw new Error("reorderTripLegs() is not implemented on web");
265
+ return new Promise((resolve, reject) => { reject("reorderTripLegs() is not implemented on web"); });
266
+ };
253
267
  const acceptEvent = (eventId, verifiedPlaceId) => {
254
268
  if (throws)
255
269
  throw new Error("acceptEvent() is not implemented on web");
@@ -457,6 +471,7 @@ const nativeSdkVersion = () => {
457
471
  const rnSdkVersion = () => version_1.VERSION;
458
472
  const Radar = {
459
473
  initialize,
474
+ initializeWithAuthToken,
460
475
  setLogLevel,
461
476
  setUserId,
462
477
  getUserId,
@@ -489,6 +504,8 @@ const Radar = {
489
504
  completeTrip,
490
505
  cancelTrip,
491
506
  updateTrip,
507
+ updateTripLeg,
508
+ reorderTripLegs,
492
509
  acceptEvent,
493
510
  rejectEvent,
494
511
  getContext,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "4.0.0";
1
+ export declare const VERSION = "4.2.0";
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // This file contains the version of the react-native-radar package
5
5
  // It should be updated to match the version in package.json
6
- exports.VERSION = '4.0.0';
6
+ exports.VERSION = '4.2.0';