react-native-radar 3.31.0 → 4.1.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 (86) 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 +45 -4
  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/ui/autocomplete.js +9 -2
  12. package/dist/ui/autocomplete.jsx +6 -1
  13. package/dist/ui/map.jsx +44 -27
  14. package/dist/version.d.ts +1 -1
  15. package/dist/version.js +1 -1
  16. package/ios/RNRadar.mm +155 -3
  17. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar.h +108 -0
  18. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
  19. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
  20. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
  21. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
  22. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK-Swift.h +101 -7
  23. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK.h +1 -1
  24. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
  25. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
  26. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
  27. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrip.h +15 -0
  28. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
  29. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
  30. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
  31. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarUser.h +2 -0
  32. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Info.plist +0 -0
  33. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.abi.json +1702 -209
  34. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +34 -9
  35. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  36. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftinterface +34 -9
  37. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/module.modulemap +0 -1
  38. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/RadarSDK +0 -0
  39. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/Radar.h +108 -0
  40. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
  41. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
  42. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
  43. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
  44. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK-Swift.h +204 -16
  45. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK.h +1 -1
  46. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
  47. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
  48. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
  49. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrip.h +15 -0
  50. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
  51. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
  52. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
  53. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarUser.h +2 -0
  54. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Info.plist +0 -0
  55. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1702 -209
  56. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +34 -9
  57. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  58. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +34 -9
  59. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1702 -209
  60. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +34 -9
  61. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  62. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +34 -9
  63. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/module.modulemap +0 -1
  64. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/RadarSDK +0 -0
  65. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeDirectory +0 -0
  66. package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeResources +71 -60
  67. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
  68. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Info.plist +0 -0
  69. package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/RadarSDKMotion +0 -0
  70. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
  71. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Info.plist +0 -0
  72. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/RadarSDKMotion +0 -0
  73. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeDirectory +0 -0
  74. package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeResources +3 -3
  75. package/package.json +8 -4
  76. package/src/@types/RadarNativeInterface.ts +11 -2
  77. package/src/@types/maplibre-react-native.d.ts +16 -0
  78. package/src/@types/types.ts +63 -4
  79. package/src/NativeRadar.ts +8 -1
  80. package/src/index.native.ts +42 -3
  81. package/src/index.web.js +17 -0
  82. package/src/ui/autocomplete.jsx +6 -1
  83. package/src/ui/map.jsx +44 -27
  84. package/src/version.ts +1 -1
  85. package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar-Swift.h +0 -7
  86. 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", "3.31.0")
146
+ editor.putString("x_platform_sdk_version", "4.1.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.1.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", "3.31.0");
105
+ editor.putString("x_platform_sdk_version", "4.1.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.1.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,3 +1,5 @@
1
+ import React from "react";
2
+ import type { MapRef } from "@maplibre/maplibre-react-native";
1
3
  export type RadarMetadata = Record<string, string | number | boolean>;
2
4
  export interface RadarTrackOnceOptions {
3
5
  location?: Location;
@@ -23,7 +25,7 @@ export interface RadarTrackingOptions {
23
25
  desiredAccuracy: RadarTrackingOptionsDesiredAccuracy;
24
26
  stopDuration: number;
25
27
  stopDistance: number;
26
- sync: "all" | "stopsAndExits" | "none";
28
+ sync: "all" | "stopsAndExits" | "none" | "events";
27
29
  replay: "all" | "stops" | "none";
28
30
  useStoppedGeofence: boolean;
29
31
  showBlueBar?: boolean;
@@ -157,6 +159,7 @@ export interface RadarTripOptions {
157
159
  scheduledArrivalAt?: number;
158
160
  approachingThreshold?: number;
159
161
  startTracking?: boolean;
162
+ legs?: RadarTripLeg[];
160
163
  }
161
164
  export interface RadarTrackCallback {
162
165
  status: string;
@@ -342,6 +345,41 @@ export interface RadarTrip {
342
345
  scheduledArrivalAt?: Date;
343
346
  destinationLocation: Location;
344
347
  delay: RadarDelay;
348
+ legs?: RadarTripLeg[];
349
+ }
350
+ export type RadarTripLegStatus = "unknown" | "pending" | "started" | "approaching" | "arrived" | "completed" | "canceled" | "expired";
351
+ export type RadarTripLegDestinationType = "unknown" | "geofence" | "address" | "coordinates";
352
+ export interface RadarTripLeg {
353
+ _id?: string;
354
+ status?: RadarTripLegStatus;
355
+ destinationType?: RadarTripLegDestinationType;
356
+ createdAt?: string;
357
+ updatedAt?: string;
358
+ etaDuration?: number;
359
+ etaDistance?: number;
360
+ destinationGeofenceTag?: string;
361
+ destinationGeofenceExternalId?: string;
362
+ destinationGeofenceId?: string;
363
+ address?: string;
364
+ coordinates?: Location;
365
+ arrivalRadius?: number;
366
+ stopDuration?: number;
367
+ metadata?: RadarMetadata;
368
+ }
369
+ export interface RadarUpdateTripLegOptions {
370
+ tripId?: string;
371
+ legId: string;
372
+ status: RadarTripLegStatus;
373
+ }
374
+ export interface RadarReorderTripLegsOptions {
375
+ tripId?: string;
376
+ legIds: string[];
377
+ }
378
+ export interface RadarTripLegCallback {
379
+ status: string;
380
+ trip?: RadarTrip;
381
+ leg?: RadarTripLeg;
382
+ events?: RadarEvent[];
345
383
  }
346
384
  export interface RadarDelay {
347
385
  delayed: boolean;
@@ -526,7 +564,7 @@ export interface RadarFraud {
526
564
  sharing: boolean;
527
565
  }
528
566
  export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
529
- export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
567
+ export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all" | "events";
530
568
  export type RadarRouteMode = "foot" | "bike" | "car" | "truck" | "motorbike";
531
569
  export interface RadarTrackingOptionsForegroundService {
532
570
  text?: string;
@@ -544,7 +582,8 @@ export type RadarTripStatus = "unknown" | "started" | "approaching" | "arrived"
544
582
  export interface RadarMapOptions {
545
583
  mapStyle?: string;
546
584
  showUserLocation?: boolean;
547
- onRegionDidChange?: (feature: RadarMapRegionChangeEvent) => void;
585
+ mapRef?: React.Ref<MapRef>;
586
+ onRegionDidChange?: (event: RadarMapRegionChangeEvent) => void;
548
587
  onDidFinishLoadingMap?: () => void;
549
588
  onWillStartLoadingMap?: () => void;
550
589
  onDidFailLoadingMap?: () => void;
@@ -552,7 +591,9 @@ export interface RadarMapOptions {
552
591
  export interface RadarMapRegionChangeEvent {
553
592
  center: [number, number];
554
593
  zoom: number;
555
- bounds?: [number, number, number, number];
594
+ bounds?: [[number, number], [number, number]];
556
595
  bearing?: number;
557
596
  pitch?: number;
597
+ animated: boolean;
598
+ userInteraction: boolean;
558
599
  }
@@ -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,
@@ -48,6 +48,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  // Autocomplete.js
49
49
  const react_1 = __importStar(require("react"));
50
50
  const react_native_1 = require("react-native");
51
+ let SafeAreaView;
52
+ try {
53
+ SafeAreaView = require('react-native-safe-area-context').SafeAreaView;
54
+ }
55
+ catch (e) {
56
+ SafeAreaView = require('react-native').SafeAreaView;
57
+ }
51
58
  const index_native_1 = __importDefault(require("../index.native"));
52
59
  const images_1 = require("./images");
53
60
  const styles_1 = __importDefault(require("./styles"));
@@ -183,7 +190,7 @@ const autocompleteUI = ({ options = {} }) => {
183
190
  </react_native_1.Animated.View>
184
191
  <react_native_1.Modal animationType="slide" transparent={false} visible={isOpen} onRequestClose={() => setIsOpen(false)}>
185
192
  <react_native_1.Animated.View style={{ flex: 1, opacity: modalOpacity }}>
186
- <react_native_1.SafeAreaView>
193
+ <SafeAreaView>
187
194
  <react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === "ios" ? "padding" : "height"} keyboardVerticalOffset={50} style={styles.container}>
188
195
  <react_native_1.View style={styles.modalInputContainer}>
189
196
  <react_native_1.TouchableOpacity onPress={() => {
@@ -208,7 +215,7 @@ const autocompleteUI = ({ options = {} }) => {
208
215
  {renderFooter()}
209
216
  </react_native_1.View>)}
210
217
  </react_native_1.KeyboardAvoidingView>
211
- </react_native_1.SafeAreaView>
218
+ </SafeAreaView>
212
219
  </react_native_1.Animated.View>
213
220
  </react_native_1.Modal>
214
221
  </react_native_1.View>);
@@ -14,10 +14,15 @@ import {
14
14
  Dimensions,
15
15
  Easing,
16
16
  Keyboard,
17
- SafeAreaView,
18
17
  Pressable,
19
18
  Platform,
20
19
  } from 'react-native';
20
+ let SafeAreaView;
21
+ try {
22
+ SafeAreaView = require('react-native-safe-area-context').SafeAreaView;
23
+ } catch (e) {
24
+ SafeAreaView = require('react-native').SafeAreaView;
25
+ }
21
26
  import Radar from '../index.native';
22
27
  import {
23
28
  BACK_ICON,