react-native-radar 3.21.0-beta.1 → 3.21.0-beta.2

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 (95) hide show
  1. package/android/src/newarch/java/com/radar/RadarModule.kt +1 -1
  2. package/android/src/oldarch/java/com/radar/RadarModule.java +1 -1
  3. package/app.plugin.js +1 -1
  4. package/{lib/typescript/src → dist}/@types/RadarNativeInterface.d.ts +0 -1
  5. package/dist/@types/RadarNativeInterface.js +2 -0
  6. package/{lib/typescript/src → dist}/@types/types.d.ts +0 -1
  7. package/dist/@types/types.js +150 -0
  8. package/{lib/typescript/src → dist}/NativeRadar.d.ts +0 -1
  9. package/dist/NativeRadar.js +4 -0
  10. package/dist/helpers.d.ts +2 -0
  11. package/dist/helpers.js +11 -0
  12. package/{lib/typescript/src → dist}/index.d.ts +0 -1
  13. package/dist/index.js +29 -0
  14. package/{lib/typescript/src → dist}/index.native.d.ts +0 -1
  15. package/dist/index.native.js +411 -0
  16. package/dist/index.web.d.ts +113 -0
  17. package/dist/index.web.js +516 -0
  18. package/dist/ui/autocomplete.d.ts +5 -0
  19. package/dist/ui/autocomplete.js +216 -0
  20. package/dist/ui/images.d.ts +5 -0
  21. package/dist/ui/images.js +8 -0
  22. package/dist/ui/map.d.ts +6 -0
  23. package/dist/ui/map.js +132 -0
  24. package/dist/ui/styles.d.ts +172 -0
  25. package/dist/ui/styles.js +125 -0
  26. package/dist/version.d.ts +1 -0
  27. package/dist/version.js +6 -0
  28. package/ios/RNRadar.mm +1 -1
  29. package/package.json +9 -27
  30. package/{src/plugin/types.ts → plugin/build/types.d.ts} +1 -1
  31. package/plugin/build/types.js +2 -0
  32. package/plugin/build/withRadar.d.ts +2 -0
  33. package/plugin/build/withRadar.js +25 -0
  34. package/plugin/build/withRadarAndroid.d.ts +2 -0
  35. package/plugin/build/withRadarAndroid.js +95 -0
  36. package/plugin/build/withRadarIOS.d.ts +2 -0
  37. package/plugin/build/withRadarIOS.js +73 -0
  38. package/src/version.ts +1 -1
  39. package/lib/commonjs/@types/RadarNativeInterface.js +0 -2
  40. package/lib/commonjs/@types/RadarNativeInterface.js.map +0 -1
  41. package/lib/commonjs/@types/types.js +0 -2
  42. package/lib/commonjs/@types/types.js.map +0 -1
  43. package/lib/commonjs/NativeRadar.js +0 -2
  44. package/lib/commonjs/NativeRadar.js.map +0 -1
  45. package/lib/commonjs/helpers.js +0 -2
  46. package/lib/commonjs/helpers.js.map +0 -1
  47. package/lib/commonjs/index.js +0 -2
  48. package/lib/commonjs/index.js.map +0 -1
  49. package/lib/commonjs/index.native.js +0 -2
  50. package/lib/commonjs/index.native.js.map +0 -1
  51. package/lib/commonjs/index.web.js +0 -2
  52. package/lib/commonjs/index.web.js.map +0 -1
  53. package/lib/commonjs/package.json +0 -1
  54. package/lib/commonjs/plugin/types.js +0 -2
  55. package/lib/commonjs/plugin/types.js.map +0 -1
  56. package/lib/commonjs/plugin/withRadar.js +0 -2
  57. package/lib/commonjs/plugin/withRadar.js.map +0 -1
  58. package/lib/commonjs/plugin/withRadarAndroid.js +0 -2
  59. package/lib/commonjs/plugin/withRadarAndroid.js.map +0 -1
  60. package/lib/commonjs/plugin/withRadarIOS.js +0 -2
  61. package/lib/commonjs/plugin/withRadarIOS.js.map +0 -1
  62. package/lib/commonjs/ui/autocomplete.js +0 -2
  63. package/lib/commonjs/ui/autocomplete.js.map +0 -1
  64. package/lib/commonjs/ui/images.js +0 -2
  65. package/lib/commonjs/ui/images.js.map +0 -1
  66. package/lib/commonjs/ui/map.js +0 -2
  67. package/lib/commonjs/ui/map.js.map +0 -1
  68. package/lib/commonjs/ui/styles.js +0 -2
  69. package/lib/commonjs/ui/styles.js.map +0 -1
  70. package/lib/commonjs/version.js +0 -2
  71. package/lib/commonjs/version.js.map +0 -1
  72. package/lib/typescript/src/@types/RadarNativeInterface.d.ts.map +0 -1
  73. package/lib/typescript/src/@types/types.d.ts.map +0 -1
  74. package/lib/typescript/src/NativeRadar.d.ts.map +0 -1
  75. package/lib/typescript/src/index.d.ts.map +0 -1
  76. package/lib/typescript/src/index.native.d.ts.map +0 -1
  77. package/lib/typescript/src/plugin/types.d.ts +0 -13
  78. package/lib/typescript/src/plugin/types.d.ts.map +0 -1
  79. package/lib/typescript/src/plugin/withRadar.d.ts +0 -5
  80. package/lib/typescript/src/plugin/withRadar.d.ts.map +0 -1
  81. package/lib/typescript/src/plugin/withRadarAndroid.d.ts +0 -4
  82. package/lib/typescript/src/plugin/withRadarAndroid.d.ts.map +0 -1
  83. package/lib/typescript/src/plugin/withRadarIOS.d.ts +0 -4
  84. package/lib/typescript/src/plugin/withRadarIOS.d.ts.map +0 -1
  85. package/lib/typescript/src/version.d.ts +0 -2
  86. package/lib/typescript/src/version.d.ts.map +0 -1
  87. package/src/plugin/withRadar.ts +0 -39
  88. package/src/plugin/withRadarAndroid.ts +0 -147
  89. package/src/plugin/withRadarIOS.ts +0 -80
  90. /package/{lib/commonjs → dist}/ui/back.png +0 -0
  91. /package/{lib/commonjs → dist}/ui/close.png +0 -0
  92. /package/{lib/commonjs → dist}/ui/map-logo.png +0 -0
  93. /package/{lib/commonjs → dist}/ui/marker.png +0 -0
  94. /package/{lib/commonjs → dist}/ui/radar-logo.png +0 -0
  95. /package/{lib/commonjs → dist}/ui/search.png +0 -0
@@ -104,7 +104,7 @@ class RadarModule(reactContext: ReactApplicationContext) :
104
104
  override fun initialize(publishableKey: String, fraud: Boolean): Unit {
105
105
  val editor = reactApplicationContext.getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit()
106
106
  editor.putString("x_platform_sdk_type", "ReactNative")
107
- editor.putString("x_platform_sdk_version", "3.21.0-beta.1")
107
+ editor.putString("x_platform_sdk_version", "3.21.0-beta.2")
108
108
  editor.apply()
109
109
 
110
110
  if (fraud) {
@@ -98,7 +98,7 @@ public class RadarModule extends ReactContextBaseJavaModule implements Permissio
98
98
  this.fraud = fraud;
99
99
  SharedPreferences.Editor editor = getReactApplicationContext().getSharedPreferences("RadarSDK", Context.MODE_PRIVATE).edit();
100
100
  editor.putString("x_platform_sdk_type", "ReactNative");
101
- editor.putString("x_platform_sdk_version", "3.21.0-beta.1");
101
+ editor.putString("x_platform_sdk_version", "3.21.0-beta.2");
102
102
  editor.apply();
103
103
  if (fraud) {
104
104
  Radar.initialize(getReactApplicationContext(), publishableKey, receiver, Radar.RadarLocationServicesProvider.GOOGLE, fraud);
package/app.plugin.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./lib/commonjs/plugin/withRadar');
1
+ module.exports = require('./plugin/build/withRadar');
@@ -66,4 +66,3 @@ export interface RadarNativeInterface {
66
66
  getHost: () => Promise<string>;
67
67
  getPublishableKey: () => Promise<string>;
68
68
  }
69
- //# sourceMappingURL=RadarNativeInterface.d.ts.map
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -509,4 +509,3 @@ export interface RadarTrackingOptionsForegroundService {
509
509
  iconColor?: string;
510
510
  }
511
511
  export type RadarTripStatus = "unknown" | "started" | "approaching" | "arrived" | "expired" | "completed" | "canceled";
512
- //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RadarEventVerification = exports.RadarEventConfidence = exports.presetEfficient = exports.presetEfficientAndroid = exports.presetEfficientIOS = exports.presetResponsive = exports.presetResponsiveAndroid = exports.presetResponsiveIOS = exports.presetContinuous = exports.presetContinuousAndroid = exports.presetContinuousIOS = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const platform = react_native_1.Platform.OS;
6
+ exports.presetContinuousIOS = {
7
+ desiredStoppedUpdateInterval: 30,
8
+ desiredMovingUpdateInterval: 30,
9
+ desiredSyncInterval: 20,
10
+ desiredAccuracy: 'high',
11
+ stopDuration: 140,
12
+ stopDistance: 70,
13
+ replay: 'none',
14
+ useStoppedGeofence: false,
15
+ showBlueBar: true,
16
+ startTrackingAfter: undefined,
17
+ stopTrackingAfter: undefined,
18
+ stoppedGeofenceRadius: 0,
19
+ useMovingGeofence: false,
20
+ movingGeofenceRadius: 0,
21
+ syncGeofences: true,
22
+ useVisits: false,
23
+ useSignificantLocationChanges: false,
24
+ beacons: false,
25
+ sync: 'all',
26
+ };
27
+ exports.presetContinuousAndroid = {
28
+ desiredStoppedUpdateInterval: 30,
29
+ fastestStoppedUpdateInterval: 30,
30
+ desiredMovingUpdateInterval: 30,
31
+ fastestMovingUpdateInterval: 30,
32
+ desiredSyncInterval: 20,
33
+ desiredAccuracy: 'high',
34
+ stopDuration: 140,
35
+ stopDistance: 70,
36
+ replay: 'none',
37
+ sync: 'all',
38
+ useStoppedGeofence: false,
39
+ stoppedGeofenceRadius: 0,
40
+ useMovingGeofence: false,
41
+ movingGeofenceRadius: 0,
42
+ syncGeofences: true,
43
+ syncGeofencesLimit: 0,
44
+ foregroundServiceEnabled: true,
45
+ beacons: false,
46
+ startTrackingAfter: undefined,
47
+ stopTrackingAfter: undefined,
48
+ };
49
+ exports.presetContinuous = platform === 'ios' ? exports.presetContinuousIOS : exports.presetContinuousAndroid;
50
+ exports.presetResponsiveIOS = {
51
+ desiredStoppedUpdateInterval: 0,
52
+ desiredMovingUpdateInterval: 150,
53
+ desiredSyncInterval: 20,
54
+ desiredAccuracy: 'medium',
55
+ stopDuration: 140,
56
+ stopDistance: 70,
57
+ replay: 'stops',
58
+ useStoppedGeofence: true,
59
+ showBlueBar: false,
60
+ startTrackingAfter: undefined,
61
+ stopTrackingAfter: undefined,
62
+ stoppedGeofenceRadius: 100,
63
+ useMovingGeofence: true,
64
+ movingGeofenceRadius: 100,
65
+ syncGeofences: true,
66
+ useVisits: true,
67
+ useSignificantLocationChanges: true,
68
+ beacons: false,
69
+ sync: 'all',
70
+ };
71
+ exports.presetResponsiveAndroid = {
72
+ desiredStoppedUpdateInterval: 0,
73
+ fastestStoppedUpdateInterval: 0,
74
+ desiredMovingUpdateInterval: 150,
75
+ fastestMovingUpdateInterval: 30,
76
+ desiredSyncInterval: 20,
77
+ desiredAccuracy: "medium",
78
+ stopDuration: 140,
79
+ stopDistance: 70,
80
+ replay: 'stops',
81
+ sync: 'all',
82
+ useStoppedGeofence: true,
83
+ stoppedGeofenceRadius: 100,
84
+ useMovingGeofence: true,
85
+ movingGeofenceRadius: 100,
86
+ syncGeofences: true,
87
+ syncGeofencesLimit: 10,
88
+ foregroundServiceEnabled: false,
89
+ beacons: false,
90
+ startTrackingAfter: undefined,
91
+ stopTrackingAfter: undefined,
92
+ };
93
+ exports.presetResponsive = platform === 'ios' ? exports.presetResponsiveIOS : exports.presetResponsiveAndroid;
94
+ exports.presetEfficientIOS = {
95
+ desiredStoppedUpdateInterval: 0,
96
+ desiredMovingUpdateInterval: 0,
97
+ desiredSyncInterval: 0,
98
+ desiredAccuracy: "medium",
99
+ stopDuration: 0,
100
+ stopDistance: 0,
101
+ replay: 'stops',
102
+ useStoppedGeofence: false,
103
+ showBlueBar: false,
104
+ startTrackingAfter: undefined,
105
+ stopTrackingAfter: undefined,
106
+ stoppedGeofenceRadius: 0,
107
+ useMovingGeofence: false,
108
+ movingGeofenceRadius: 0,
109
+ syncGeofences: true,
110
+ useVisits: true,
111
+ useSignificantLocationChanges: false,
112
+ beacons: false,
113
+ sync: 'all',
114
+ };
115
+ exports.presetEfficientAndroid = {
116
+ desiredStoppedUpdateInterval: 3600,
117
+ fastestStoppedUpdateInterval: 1200,
118
+ desiredMovingUpdateInterval: 1200,
119
+ fastestMovingUpdateInterval: 360,
120
+ desiredSyncInterval: 140,
121
+ desiredAccuracy: 'medium',
122
+ stopDuration: 140,
123
+ stopDistance: 70,
124
+ replay: 'stops',
125
+ sync: 'all',
126
+ useStoppedGeofence: false,
127
+ stoppedGeofenceRadius: 0,
128
+ useMovingGeofence: false,
129
+ movingGeofenceRadius: 0,
130
+ syncGeofences: true,
131
+ syncGeofencesLimit: 10,
132
+ foregroundServiceEnabled: false,
133
+ beacons: false,
134
+ startTrackingAfter: undefined,
135
+ stopTrackingAfter: undefined,
136
+ };
137
+ exports.presetEfficient = platform === 'ios' ? exports.presetEfficientIOS : exports.presetEfficientAndroid;
138
+ var RadarEventConfidence;
139
+ (function (RadarEventConfidence) {
140
+ RadarEventConfidence[RadarEventConfidence["none"] = 0] = "none";
141
+ RadarEventConfidence[RadarEventConfidence["low"] = 1] = "low";
142
+ RadarEventConfidence[RadarEventConfidence["medium"] = 2] = "medium";
143
+ RadarEventConfidence[RadarEventConfidence["high"] = 3] = "high";
144
+ })(RadarEventConfidence || (exports.RadarEventConfidence = RadarEventConfidence = {}));
145
+ var RadarEventVerification;
146
+ (function (RadarEventVerification) {
147
+ RadarEventVerification[RadarEventVerification["accept"] = 1] = "accept";
148
+ RadarEventVerification[RadarEventVerification["unverify"] = 0] = "unverify";
149
+ RadarEventVerification[RadarEventVerification["reject"] = -1] = "reject";
150
+ })(RadarEventVerification || (exports.RadarEventVerification = RadarEventVerification = {}));
@@ -84,4 +84,3 @@ export interface Spec extends TurboModule {
84
84
  }
85
85
  declare const _default: Spec;
86
86
  export default _default;
87
- //# sourceMappingURL=NativeRadar.d.ts.map
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_native_1 = require("react-native");
4
+ exports.default = react_native_1.TurboModuleRegistry.getEnforcing('RNRadar');
@@ -0,0 +1,2 @@
1
+ export function getHost(): Promise<string>;
2
+ export function getPublishableKey(): Promise<string>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getPublishableKey = exports.getHost = void 0;
7
+ const index_native_1 = __importDefault(require("./index.native"));
8
+ const getHost = () => (index_native_1.default.getHost());
9
+ exports.getHost = getHost;
10
+ const getPublishableKey = () => (index_native_1.default.getPublishableKey());
11
+ exports.getPublishableKey = getPublishableKey;
@@ -9,4 +9,3 @@ declare let Map: any;
9
9
  export { Map };
10
10
  export * from "./@types/types";
11
11
  export * from "./@types/RadarNativeInterface";
12
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Map = exports.Autocomplete = exports.RadarRNWeb = void 0;
18
+ const react_native_1 = require("react-native");
19
+ let nativeModule;
20
+ nativeModule = react_native_1.Platform.OS === "web" ? require("./index.web").default : require("./index.native").default;
21
+ exports.default = nativeModule;
22
+ let RadarRNWeb = react_native_1.Platform.OS === "web" ? require("./index.web").default : {};
23
+ exports.RadarRNWeb = RadarRNWeb;
24
+ let Autocomplete = react_native_1.Platform.OS !== "web" ? require("./ui/autocomplete").default : {};
25
+ exports.Autocomplete = Autocomplete;
26
+ let Map = react_native_1.Platform.OS !== "web" ? require("./ui/map").default : {};
27
+ exports.Map = Map;
28
+ __exportStar(require("./@types/types"), exports);
29
+ __exportStar(require("./@types/RadarNativeInterface"), exports);
@@ -4,4 +4,3 @@ declare global {
4
4
  }
5
5
  declare const Radar: RadarNativeInterface;
6
6
  export default Radar;
7
- //# sourceMappingURL=index.native.d.ts.map
@@ -0,0 +1,411 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const react_native_1 = require("react-native");
13
+ const version_1 = require("./version");
14
+ const isNewArchitecture = global.__turboModuleProxy != null;
15
+ let NativeRadar;
16
+ try {
17
+ if (isNewArchitecture) {
18
+ const NativeRadarModule = require('./NativeRadar');
19
+ NativeRadar = NativeRadarModule.default;
20
+ }
21
+ else {
22
+ NativeRadar = react_native_1.NativeModules.RNRadar;
23
+ }
24
+ }
25
+ catch (error) {
26
+ console.error('[Radar] Error loading NativeRadar module:', error);
27
+ throw error;
28
+ }
29
+ // For old architecture, create a NativeEventEmitter
30
+ const eventEmitter = isNewArchitecture ? null : new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNRadar);
31
+ const locationEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.locationEmitter : null;
32
+ const clientLocationEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.clientLocationEmitter : null;
33
+ const errorEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.errorEmitter : null;
34
+ const logEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.logEmitter : null;
35
+ const eventsEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.eventsEmitter : null;
36
+ const tokenEmitter = isNewArchitecture ? NativeRadar === null || NativeRadar === void 0 ? void 0 : NativeRadar.tokenEmitter : null;
37
+ let locationUpdateSubscription = null;
38
+ let clientLocationUpdateSubscription = null;
39
+ let errorUpdateSubscription = null;
40
+ let logUpdateSubscription = null;
41
+ let eventsUpdateSubscription = null;
42
+ let tokenUpdateSubscription = null;
43
+ const Radar = {
44
+ initialize: (publishableKey, fraud) => {
45
+ return NativeRadar.initialize(publishableKey, !!fraud);
46
+ },
47
+ trackOnce: (options) => __awaiter(void 0, void 0, void 0, function* () {
48
+ return NativeRadar.trackOnce(options || null);
49
+ }),
50
+ onLocationUpdate: (callback) => {
51
+ // Clear any existing subscription
52
+ if (locationUpdateSubscription) {
53
+ locationUpdateSubscription.remove();
54
+ locationUpdateSubscription = null;
55
+ }
56
+ if (isNewArchitecture && locationEmitter) {
57
+ locationUpdateSubscription = locationEmitter((event) => {
58
+ try {
59
+ const locationUpdate = {
60
+ location: event.location,
61
+ user: event.user
62
+ };
63
+ callback(locationUpdate);
64
+ }
65
+ catch (error) {
66
+ console.error('[Radar] Error in location update callback:', error);
67
+ }
68
+ });
69
+ }
70
+ else if (!isNewArchitecture && eventEmitter) {
71
+ locationUpdateSubscription = eventEmitter.addListener('location', (event) => {
72
+ try {
73
+ const locationUpdate = {
74
+ location: event.location,
75
+ user: event.user
76
+ };
77
+ callback(locationUpdate);
78
+ }
79
+ catch (error) {
80
+ console.error('[Radar] Error in location update callback:', error);
81
+ }
82
+ });
83
+ }
84
+ else {
85
+ console.warn('[Radar] No event emitter available for location updates');
86
+ }
87
+ },
88
+ clearLocationUpdate: () => {
89
+ if (locationUpdateSubscription) {
90
+ locationUpdateSubscription.remove();
91
+ locationUpdateSubscription = null;
92
+ }
93
+ },
94
+ onClientLocationUpdate: (callback) => {
95
+ if (clientLocationUpdateSubscription) {
96
+ clientLocationUpdateSubscription.remove();
97
+ clientLocationUpdateSubscription = null;
98
+ }
99
+ if (isNewArchitecture && clientLocationEmitter) {
100
+ clientLocationUpdateSubscription = clientLocationEmitter((event) => {
101
+ try {
102
+ const clientLocationUpdate = {
103
+ location: event.location,
104
+ stopped: event.stopped,
105
+ source: event.source
106
+ };
107
+ callback(clientLocationUpdate);
108
+ }
109
+ catch (error) {
110
+ console.error('[Radar] Error in client location update callback:', error);
111
+ }
112
+ });
113
+ }
114
+ else if (!isNewArchitecture && eventEmitter) {
115
+ clientLocationUpdateSubscription = eventEmitter.addListener('clientLocation', (event) => {
116
+ try {
117
+ const clientLocationUpdate = {
118
+ location: event.location,
119
+ stopped: event.stopped,
120
+ source: event.source
121
+ };
122
+ callback(clientLocationUpdate);
123
+ }
124
+ catch (error) {
125
+ console.error('[Radar] Error in client location update callback:', error);
126
+ }
127
+ });
128
+ }
129
+ else {
130
+ console.warn('[Radar] No event emitter available for client location updates');
131
+ }
132
+ },
133
+ clearClientLocationUpdate: () => {
134
+ if (clientLocationUpdateSubscription) {
135
+ clientLocationUpdateSubscription.remove();
136
+ clientLocationUpdateSubscription = null;
137
+ }
138
+ },
139
+ onError: (callback) => {
140
+ if (errorUpdateSubscription) {
141
+ errorUpdateSubscription.remove();
142
+ errorUpdateSubscription = null;
143
+ }
144
+ if (isNewArchitecture && errorEmitter) {
145
+ errorUpdateSubscription = errorEmitter((event) => {
146
+ callback(event.status);
147
+ });
148
+ }
149
+ else if (!isNewArchitecture && eventEmitter) {
150
+ errorUpdateSubscription = eventEmitter.addListener('error', (event) => {
151
+ callback(event.status);
152
+ });
153
+ }
154
+ else {
155
+ console.warn('[Radar] No event emitter available for error updates');
156
+ }
157
+ },
158
+ clearError: () => {
159
+ if (errorUpdateSubscription) {
160
+ errorUpdateSubscription.remove();
161
+ errorUpdateSubscription = null;
162
+ }
163
+ },
164
+ onLog: (callback) => {
165
+ if (logUpdateSubscription) {
166
+ logUpdateSubscription.remove();
167
+ logUpdateSubscription = null;
168
+ }
169
+ if (isNewArchitecture && logEmitter) {
170
+ logUpdateSubscription = logEmitter((event) => {
171
+ callback(event.message);
172
+ });
173
+ }
174
+ else if (!isNewArchitecture && eventEmitter) {
175
+ logUpdateSubscription = eventEmitter.addListener('log', (event) => {
176
+ callback(event.message);
177
+ });
178
+ }
179
+ else {
180
+ console.warn('[Radar] No event emitter available for log updates');
181
+ }
182
+ },
183
+ clearLog: () => {
184
+ if (logUpdateSubscription) {
185
+ logUpdateSubscription.remove();
186
+ logUpdateSubscription = null;
187
+ }
188
+ },
189
+ onEventUpdate: (callback) => {
190
+ if (eventsUpdateSubscription) {
191
+ eventsUpdateSubscription.remove();
192
+ eventsUpdateSubscription = null;
193
+ }
194
+ if (isNewArchitecture && eventsEmitter) {
195
+ eventsUpdateSubscription = eventsEmitter((event) => {
196
+ try {
197
+ const eventUpdate = {
198
+ user: event.user,
199
+ events: event.events
200
+ };
201
+ callback(eventUpdate);
202
+ }
203
+ catch (error) {
204
+ console.error('[Radar] Error in event update callback:', error);
205
+ }
206
+ });
207
+ }
208
+ else if (!isNewArchitecture && eventEmitter) {
209
+ eventsUpdateSubscription = eventEmitter.addListener('events', (event) => {
210
+ try {
211
+ const eventUpdate = {
212
+ user: event.user,
213
+ events: event.events
214
+ };
215
+ callback(eventUpdate);
216
+ }
217
+ catch (error) {
218
+ console.error('[Radar] Error in event update callback:', error);
219
+ }
220
+ });
221
+ }
222
+ else {
223
+ console.warn('[Radar] No event emitter available for event updates');
224
+ }
225
+ },
226
+ clearEventUpdate: () => {
227
+ if (eventsUpdateSubscription) {
228
+ eventsUpdateSubscription.remove();
229
+ eventsUpdateSubscription = null;
230
+ }
231
+ },
232
+ onTokenUpdate: (callback) => {
233
+ if (tokenUpdateSubscription) {
234
+ tokenUpdateSubscription.remove();
235
+ tokenUpdateSubscription = null;
236
+ }
237
+ if (isNewArchitecture && tokenEmitter) {
238
+ tokenUpdateSubscription = tokenEmitter((event) => {
239
+ callback(event.token);
240
+ });
241
+ }
242
+ else if (!isNewArchitecture && eventEmitter) {
243
+ tokenUpdateSubscription = eventEmitter.addListener('token', (event) => {
244
+ callback(event.token);
245
+ });
246
+ }
247
+ else {
248
+ console.warn('[Radar] No event emitter available for token updates');
249
+ }
250
+ },
251
+ clearTokenUpdate: () => {
252
+ if (tokenUpdateSubscription) {
253
+ tokenUpdateSubscription.remove();
254
+ tokenUpdateSubscription = null;
255
+ }
256
+ },
257
+ requestPermissions: (background) => {
258
+ return NativeRadar.requestPermissions(background);
259
+ },
260
+ setLogLevel: function (level) {
261
+ return NativeRadar.setLogLevel(level);
262
+ },
263
+ setUserId: function (userId) {
264
+ return NativeRadar.setUserId(userId);
265
+ },
266
+ getUserId: function () {
267
+ return NativeRadar.getUserId();
268
+ },
269
+ setDescription: function (description) {
270
+ return NativeRadar.setDescription(description);
271
+ },
272
+ getDescription: function () {
273
+ return NativeRadar.getDescription();
274
+ },
275
+ setMetadata: function (metadata) {
276
+ return NativeRadar.setMetadata(metadata);
277
+ },
278
+ getMetadata: function () {
279
+ return NativeRadar.getMetadata();
280
+ },
281
+ setAnonymousTrackingEnabled: function (enabled) {
282
+ return NativeRadar.setAnonymousTrackingEnabled(enabled);
283
+ },
284
+ getPermissionsStatus: function () {
285
+ return NativeRadar.getPermissionsStatus();
286
+ },
287
+ getLocation: function (desiredAccuracy) {
288
+ return NativeRadar.getLocation(desiredAccuracy);
289
+ },
290
+ trackVerified: function (options) {
291
+ return NativeRadar.trackVerified(options);
292
+ },
293
+ getVerifiedLocationToken: function () {
294
+ return NativeRadar.getVerifiedLocationToken();
295
+ },
296
+ clearVerifiedLocationToken: function () {
297
+ return NativeRadar.clearVerifiedLocationToken();
298
+ },
299
+ startTrackingEfficient: function () {
300
+ return NativeRadar.startTrackingEfficient();
301
+ },
302
+ startTrackingResponsive: function () {
303
+ return NativeRadar.startTrackingResponsive();
304
+ },
305
+ startTrackingContinuous: function () {
306
+ return NativeRadar.startTrackingContinuous();
307
+ },
308
+ startTrackingCustom: function (options) {
309
+ return NativeRadar.startTrackingCustom(options);
310
+ },
311
+ startTrackingVerified: function (options) {
312
+ return NativeRadar.startTrackingVerified(options);
313
+ },
314
+ isTrackingVerified: function () {
315
+ return NativeRadar.isTrackingVerified();
316
+ },
317
+ setProduct: function (product) {
318
+ return NativeRadar.setProduct(product);
319
+ },
320
+ mockTracking: function (options) {
321
+ return NativeRadar.mockTracking(options);
322
+ },
323
+ stopTracking: function () {
324
+ return NativeRadar.stopTracking();
325
+ },
326
+ stopTrackingVerified: function () {
327
+ return NativeRadar.stopTrackingVerified();
328
+ },
329
+ getTrackingOptions: function () {
330
+ return NativeRadar.getTrackingOptions();
331
+ },
332
+ isUsingRemoteTrackingOptions: function () {
333
+ return NativeRadar.isUsingRemoteTrackingOptions();
334
+ },
335
+ isTracking: function () {
336
+ return NativeRadar.isTracking();
337
+ },
338
+ setForegroundServiceOptions: function (options) {
339
+ return NativeRadar.setForegroundServiceOptions(options);
340
+ },
341
+ setNotificationOptions: function (options) {
342
+ return NativeRadar.setNotificationOptions(options);
343
+ },
344
+ getTripOptions: function () {
345
+ return NativeRadar.getTripOptions();
346
+ },
347
+ startTrip: function (options) {
348
+ return NativeRadar.startTrip(options);
349
+ },
350
+ completeTrip: function () {
351
+ return NativeRadar.completeTrip();
352
+ },
353
+ cancelTrip: function () {
354
+ return NativeRadar.cancelTrip();
355
+ },
356
+ updateTrip: function (options) {
357
+ return NativeRadar.updateTrip(options);
358
+ },
359
+ acceptEvent: function (eventId, verifiedPlaceId) {
360
+ return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
361
+ },
362
+ rejectEvent: function (eventId) {
363
+ return NativeRadar.rejectEvent(eventId);
364
+ },
365
+ getContext: function (location) {
366
+ return NativeRadar.getContext(location);
367
+ },
368
+ searchPlaces: function (options) {
369
+ return NativeRadar.searchPlaces(options);
370
+ },
371
+ searchGeofences: function (options) {
372
+ return NativeRadar.searchGeofences(options);
373
+ },
374
+ autocomplete: function (options) {
375
+ return NativeRadar.autocomplete(options);
376
+ },
377
+ geocode: function (options) {
378
+ return NativeRadar.geocode(options);
379
+ },
380
+ reverseGeocode: function (options) {
381
+ return NativeRadar.reverseGeocode(options);
382
+ },
383
+ ipGeocode: function () {
384
+ return NativeRadar.ipGeocode();
385
+ },
386
+ validateAddress: function (address) {
387
+ return NativeRadar.validateAddress(address);
388
+ },
389
+ getDistance: function (option) {
390
+ return NativeRadar.getDistance(option);
391
+ },
392
+ getMatrix: function (option) {
393
+ return NativeRadar.getMatrix(option);
394
+ },
395
+ logConversion: function (options) {
396
+ return NativeRadar.logConversion(options);
397
+ },
398
+ nativeSdkVersion: function () {
399
+ return NativeRadar.nativeSdkVersion();
400
+ },
401
+ rnSdkVersion: function () {
402
+ return version_1.VERSION;
403
+ },
404
+ getHost: function () {
405
+ return NativeRadar.getHost();
406
+ },
407
+ getPublishableKey: function () {
408
+ return NativeRadar.getPublishableKey();
409
+ }
410
+ };
411
+ exports.default = Radar;