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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/radar/RadarModuleImpl.java +110 -0
- package/android/src/newarch/java/com/radar/RadarModule.kt +45 -2
- package/android/src/oldarch/java/com/radar/RadarModule.java +56 -2
- package/dist/@types/RadarNativeInterface.d.ts +9 -2
- package/dist/@types/types.d.ts +45 -4
- package/dist/NativeRadar.d.ts +8 -1
- package/dist/index.native.js +35 -3
- package/dist/index.web.d.ts +6 -0
- package/dist/index.web.js +17 -0
- package/dist/ui/autocomplete.js +9 -2
- package/dist/ui/autocomplete.jsx +6 -1
- package/dist/ui/map.jsx +44 -27
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/ios/RNRadar.mm +155 -3
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar.h +108 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK-Swift.h +101 -7
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDK.h +1 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTrip.h +15 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/RadarUser.h +2 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Info.plist +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.abi.json +1702 -209
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Modules/module.modulemap +0 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/RadarSDK +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/Radar.h +108 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarBeacon.h +10 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarCoordinate.h +1 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarGeofence.h +10 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarInitializeOptions.h +0 -1
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK-Swift.h +204 -16
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDK.h +1 -1
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSDKFraudProtocol.h +26 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarSdkConfiguration.h +23 -28
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrackingOptions.h +20 -1
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTrip.h +15 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripLeg.h +268 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOptions.h +6 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarTripOrder.h +1 -1
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/RadarUser.h +2 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Info.plist +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1702 -209
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1702 -209
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/RadarSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +34 -9
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Modules/module.modulemap +0 -1
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/RadarSDK +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/_CodeSignature/CodeResources +71 -60
- package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
- package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/Info.plist +0 -0
- package/ios/RadarSDKMotion.xcframework/ios-arm64/RadarSDKMotion.framework/RadarSDKMotion +0 -0
- package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Headers/RadarSDKMotion.h +0 -2
- package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/Info.plist +0 -0
- package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/RadarSDKMotion +0 -0
- package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/RadarSDKMotion.xcframework/ios-arm64_x86_64-simulator/RadarSDKMotion.framework/_CodeSignature/CodeResources +3 -3
- package/package.json +8 -4
- package/src/@types/RadarNativeInterface.ts +11 -2
- package/src/@types/maplibre-react-native.d.ts +16 -0
- package/src/@types/types.ts +63 -4
- package/src/NativeRadar.ts +8 -1
- package/src/index.native.ts +42 -3
- package/src/index.web.js +17 -0
- package/src/ui/autocomplete.jsx +6 -1
- package/src/ui/map.jsx +44 -27
- package/src/version.ts +1 -1
- package/ios/RadarSDK.xcframework/ios-arm64/RadarSDK.framework/Headers/Radar-Swift.h +0 -7
- package/ios/RadarSDK.xcframework/ios-arm64_x86_64-simulator/RadarSDK.framework/Headers/Radar-Swift.h +0 -7
|
@@ -46,10 +46,14 @@ import type {
|
|
|
46
46
|
RadarInAppMessageDismissedCallback,
|
|
47
47
|
RadarInAppMessageClickedCallback,
|
|
48
48
|
RadarInAppMessage,
|
|
49
|
+
RadarReorderTripLegsOptions,
|
|
50
|
+
RadarUpdateTripLegOptions,
|
|
51
|
+
RadarTripLegCallback,
|
|
49
52
|
} from "./types";
|
|
50
53
|
|
|
51
54
|
export interface RadarNativeInterface {
|
|
52
|
-
initialize: (publishableKey: string, fraud?: boolean) => void;
|
|
55
|
+
initialize: (publishableKey: string, fraud?: boolean, options?: Object | null) => void;
|
|
56
|
+
initializeWithAuthToken: (authToken: string, fraud?: boolean, options?: Object | null) => void;
|
|
53
57
|
setLogLevel: (level: RadarLogLevel) => void;
|
|
54
58
|
setUserId: (userId: string) => void;
|
|
55
59
|
getUserId: () => Promise<string>;
|
|
@@ -96,6 +100,8 @@ export interface RadarNativeInterface {
|
|
|
96
100
|
completeTrip: () => Promise<RadarTripCallback>;
|
|
97
101
|
cancelTrip: () => Promise<RadarTripCallback>;
|
|
98
102
|
updateTrip: (options: RadarUpdateTripOptions) => Promise<RadarTripCallback>;
|
|
103
|
+
updateTripLeg: (options: RadarUpdateTripLegOptions) => Promise<RadarTripLegCallback>;
|
|
104
|
+
reorderTripLegs: (options: RadarReorderTripLegsOptions) => Promise<RadarTripCallback>;
|
|
99
105
|
acceptEvent: (eventId: string, verifiedPlaceId: string) => void;
|
|
100
106
|
rejectEvent: (eventId: string) => void;
|
|
101
107
|
getContext: (location?: Location) => Promise<RadarContextCallback>;
|
|
@@ -124,7 +130,10 @@ export interface RadarNativeInterface {
|
|
|
124
130
|
nativeSdkVersion: () => Promise<string>;
|
|
125
131
|
rnSdkVersion: () => string;
|
|
126
132
|
showInAppMessage: (inAppMessage: RadarInAppMessage) => void;
|
|
127
|
-
|
|
133
|
+
setPushNotificationToken: (token: string) => void;
|
|
134
|
+
isInitialized: () => Promise<boolean>;
|
|
135
|
+
setAppGroup: (groupId: string) => void;
|
|
136
|
+
setLocationExtensionToken: (token: string) => void;
|
|
128
137
|
onLocationUpdated: (callback: RadarLocationUpdateCallback | null) => void;
|
|
129
138
|
onClientLocationUpdated: (
|
|
130
139
|
callback: RadarClientLocationUpdateCallback | null
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module "@maplibre/maplibre-react-native" {
|
|
2
|
+
export interface MapRef {
|
|
3
|
+
getCenter(): Promise<{ lng: number; lat: number }>;
|
|
4
|
+
getZoom(): Promise<number>;
|
|
5
|
+
getBearing(): Promise<number>;
|
|
6
|
+
getPitch(): Promise<number>;
|
|
7
|
+
getBounds(): Promise<{ ne: [number, number]; sw: [number, number] }>;
|
|
8
|
+
project(coordinate: [number, number]): Promise<{ x: number; y: number }>;
|
|
9
|
+
unproject(point: { x: number; y: number }): Promise<[number, number]>;
|
|
10
|
+
queryRenderedFeatures(
|
|
11
|
+
point: [number, number] | [[number, number], [number, number]],
|
|
12
|
+
filter?: string[],
|
|
13
|
+
layerIDs?: string[],
|
|
14
|
+
): Promise<GeoJSON.FeatureCollection>;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/@types/types.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { Platform } from "react-native";
|
|
3
|
+
import type { MapRef } from "@maplibre/maplibre-react-native";
|
|
2
4
|
const platform = Platform.OS;
|
|
3
5
|
|
|
4
6
|
export type RadarMetadata = Record<string, string | number | boolean>;
|
|
@@ -29,7 +31,7 @@ export interface RadarTrackingOptions {
|
|
|
29
31
|
desiredAccuracy: RadarTrackingOptionsDesiredAccuracy;
|
|
30
32
|
stopDuration: number;
|
|
31
33
|
stopDistance: number;
|
|
32
|
-
sync: "all" | "stopsAndExits" | "none";
|
|
34
|
+
sync: "all" | "stopsAndExits" | "none" | "events";
|
|
33
35
|
replay: "all" | "stops" | "none";
|
|
34
36
|
useStoppedGeofence: boolean;
|
|
35
37
|
showBlueBar?: boolean;
|
|
@@ -314,6 +316,7 @@ export interface RadarTripOptions {
|
|
|
314
316
|
scheduledArrivalAt?: number;
|
|
315
317
|
approachingThreshold?: number;
|
|
316
318
|
startTracking?: boolean; // defaults to true
|
|
319
|
+
legs?: RadarTripLeg[];
|
|
317
320
|
}
|
|
318
321
|
|
|
319
322
|
export interface RadarTrackCallback {
|
|
@@ -576,6 +579,59 @@ export interface RadarTrip {
|
|
|
576
579
|
scheduledArrivalAt?: Date;
|
|
577
580
|
destinationLocation: Location;
|
|
578
581
|
delay: RadarDelay;
|
|
582
|
+
legs?: RadarTripLeg[];
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export type RadarTripLegStatus =
|
|
586
|
+
| "unknown"
|
|
587
|
+
| "pending"
|
|
588
|
+
| "started"
|
|
589
|
+
| "approaching"
|
|
590
|
+
| "arrived"
|
|
591
|
+
| "completed"
|
|
592
|
+
| "canceled"
|
|
593
|
+
| "expired";
|
|
594
|
+
|
|
595
|
+
export type RadarTripLegDestinationType =
|
|
596
|
+
| "unknown"
|
|
597
|
+
| "geofence"
|
|
598
|
+
| "address"
|
|
599
|
+
| "coordinates";
|
|
600
|
+
|
|
601
|
+
export interface RadarTripLeg {
|
|
602
|
+
_id?: string;
|
|
603
|
+
status?: RadarTripLegStatus;
|
|
604
|
+
destinationType?: RadarTripLegDestinationType;
|
|
605
|
+
createdAt?: string;
|
|
606
|
+
updatedAt?: string;
|
|
607
|
+
etaDuration?: number;
|
|
608
|
+
etaDistance?: number;
|
|
609
|
+
destinationGeofenceTag?: string;
|
|
610
|
+
destinationGeofenceExternalId?: string;
|
|
611
|
+
destinationGeofenceId?: string;
|
|
612
|
+
address?: string;
|
|
613
|
+
coordinates?: Location;
|
|
614
|
+
arrivalRadius?: number;
|
|
615
|
+
stopDuration?: number;
|
|
616
|
+
metadata?: RadarMetadata;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export interface RadarUpdateTripLegOptions {
|
|
620
|
+
tripId?: string;
|
|
621
|
+
legId: string;
|
|
622
|
+
status: RadarTripLegStatus;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
export interface RadarReorderTripLegsOptions {
|
|
626
|
+
tripId?: string;
|
|
627
|
+
legIds: string[];
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
export interface RadarTripLegCallback {
|
|
631
|
+
status: string;
|
|
632
|
+
trip?: RadarTrip;
|
|
633
|
+
leg?: RadarTripLeg;
|
|
634
|
+
events?: RadarEvent[];
|
|
579
635
|
}
|
|
580
636
|
|
|
581
637
|
export interface RadarDelay {
|
|
@@ -821,7 +877,7 @@ export interface RadarFraud {
|
|
|
821
877
|
|
|
822
878
|
export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
|
|
823
879
|
|
|
824
|
-
export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
|
|
880
|
+
export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all" | "events";
|
|
825
881
|
|
|
826
882
|
export type RadarRouteMode = "foot" | "bike" | "car" | "truck" | "motorbike";
|
|
827
883
|
|
|
@@ -850,7 +906,8 @@ export type RadarTripStatus =
|
|
|
850
906
|
export interface RadarMapOptions {
|
|
851
907
|
mapStyle?: string;
|
|
852
908
|
showUserLocation?: boolean;
|
|
853
|
-
|
|
909
|
+
mapRef?: React.Ref<MapRef>;
|
|
910
|
+
onRegionDidChange?: (event: RadarMapRegionChangeEvent) => void;
|
|
854
911
|
onDidFinishLoadingMap?: () => void;
|
|
855
912
|
onWillStartLoadingMap?: () => void;
|
|
856
913
|
onDidFailLoadingMap?: () => void;
|
|
@@ -859,7 +916,9 @@ export interface RadarMapOptions {
|
|
|
859
916
|
export interface RadarMapRegionChangeEvent {
|
|
860
917
|
center: [number, number];
|
|
861
918
|
zoom: number;
|
|
862
|
-
bounds?: [number, number, number, number];
|
|
919
|
+
bounds?: [[number, number], [number, number]];
|
|
863
920
|
bearing?: number;
|
|
864
921
|
pitch?: number;
|
|
922
|
+
animated: boolean;
|
|
923
|
+
userInteraction: boolean;
|
|
865
924
|
}
|
package/src/NativeRadar.ts
CHANGED
|
@@ -43,7 +43,8 @@ export type InAppMessageClickedEmitter = {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export interface Spec extends TurboModule {
|
|
46
|
-
initialize(publishableKey: string, fraud: boolean): void;
|
|
46
|
+
initialize(publishableKey: string, fraud: boolean, options: Object | null): void;
|
|
47
|
+
initializeWithAuthToken(authToken: string, fraud: boolean, options: Object | null): void;
|
|
47
48
|
requestPermissions(background: boolean): Promise<string>;
|
|
48
49
|
getPermissionsStatus(): Promise<string>;
|
|
49
50
|
trackOnce(trackOnceOptions: Object | null): Promise<Object>;
|
|
@@ -84,6 +85,8 @@ export interface Spec extends TurboModule {
|
|
|
84
85
|
completeTrip(): Promise<Object>;
|
|
85
86
|
cancelTrip(): Promise<Object>;
|
|
86
87
|
updateTrip(options: Object): Promise<Object>;
|
|
88
|
+
updateTripLeg(options: Object): Promise<Object>;
|
|
89
|
+
reorderTripLegs(options: Object): Promise<Object>;
|
|
87
90
|
acceptEvent(eventId: string, verifiedPlaceId: string): void;
|
|
88
91
|
rejectEvent(eventId: string): void;
|
|
89
92
|
getContext(location: Object | null): Promise<Object>;
|
|
@@ -101,6 +104,10 @@ export interface Spec extends TurboModule {
|
|
|
101
104
|
getHost(): Promise<string>;
|
|
102
105
|
getPublishableKey(): Promise<string>;
|
|
103
106
|
showInAppMessage(inAppMessage: Object): void;
|
|
107
|
+
setPushNotificationToken(token: string): void;
|
|
108
|
+
isInitialized(): Promise<boolean>;
|
|
109
|
+
setAppGroup(groupId: string): void;
|
|
110
|
+
setLocationExtensionToken(token: string): void;
|
|
104
111
|
readonly locationEmitter: EventEmitter<LocationEmitter>;
|
|
105
112
|
readonly clientLocationEmitter: EventEmitter<ClientLocationEmitter>;
|
|
106
113
|
readonly errorEmitter: EventEmitter<ErrorEmitter>;
|
package/src/index.native.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventSubscription } from "react-native";
|
|
2
|
+
import { Platform } from "react-native";
|
|
2
3
|
import type { RadarNativeInterface } from "./@types/RadarNativeInterface";
|
|
3
4
|
import type {
|
|
4
5
|
RadarTrackCallback,
|
|
@@ -51,6 +52,9 @@ import type {
|
|
|
51
52
|
RadarInAppMessageDismissedCallback,
|
|
52
53
|
RadarInAppMessageClickedCallback,
|
|
53
54
|
RadarInAppMessage,
|
|
55
|
+
RadarUpdateTripLegOptions,
|
|
56
|
+
RadarReorderTripLegsOptions,
|
|
57
|
+
RadarTripLegCallback,
|
|
54
58
|
} from "./@types/types";
|
|
55
59
|
import { NativeEventEmitter, NativeModules } from "react-native";
|
|
56
60
|
import { VERSION } from "./version";
|
|
@@ -118,8 +122,16 @@ let inAppMessageDismissedUpdateSubscription: EventSubscription | null = null;
|
|
|
118
122
|
let inAppMessageClickedUpdateSubscription: EventSubscription | null = null;
|
|
119
123
|
|
|
120
124
|
const Radar: RadarNativeInterface = {
|
|
121
|
-
initialize: (publishableKey: string, fraud?: boolean) => {
|
|
122
|
-
NativeRadar.initialize(publishableKey, !!fraud);
|
|
125
|
+
initialize: (publishableKey: string, fraud?: boolean, options?: Object | null) => {
|
|
126
|
+
NativeRadar.initialize(publishableKey, !!fraud, options || null);
|
|
127
|
+
Radar.onNewInAppMessage((inAppMessage) => {
|
|
128
|
+
Radar.showInAppMessage(inAppMessage);
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
initializeWithAuthToken: (authToken: string, fraud?: boolean, options?: Object | null) => {
|
|
134
|
+
NativeRadar.initializeWithAuthToken(authToken, !!fraud, options || null);
|
|
123
135
|
Radar.onNewInAppMessage((inAppMessage) => {
|
|
124
136
|
Radar.showInAppMessage(inAppMessage);
|
|
125
137
|
});
|
|
@@ -316,7 +328,21 @@ const Radar: RadarNativeInterface = {
|
|
|
316
328
|
showInAppMessage: (inAppMessage: RadarInAppMessage) => {
|
|
317
329
|
return NativeRadar.showInAppMessage(inAppMessage);
|
|
318
330
|
},
|
|
319
|
-
|
|
331
|
+
setPushNotificationToken: (token: string) => {
|
|
332
|
+
if (Platform.OS === "android") {
|
|
333
|
+
return NativeRadar.setPushNotificationToken(token);
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
setAppGroup: (groupId: string) => {
|
|
337
|
+
if (Platform.OS === "ios") {
|
|
338
|
+
return NativeRadar.setAppGroup(groupId);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
setLocationExtensionToken: (token: string) => {
|
|
342
|
+
if (Platform.OS === "ios") {
|
|
343
|
+
return NativeRadar.setLocationExtensionToken(token);
|
|
344
|
+
}
|
|
345
|
+
},
|
|
320
346
|
requestPermissions: (background: boolean) => {
|
|
321
347
|
return NativeRadar.requestPermissions(
|
|
322
348
|
background
|
|
@@ -452,6 +478,16 @@ const Radar: RadarNativeInterface = {
|
|
|
452
478
|
): Promise<RadarTripCallback> {
|
|
453
479
|
return NativeRadar.updateTrip(options) as Promise<RadarTripCallback>;
|
|
454
480
|
},
|
|
481
|
+
updateTripLeg: function (
|
|
482
|
+
options: RadarUpdateTripLegOptions
|
|
483
|
+
): Promise<RadarTripLegCallback> {
|
|
484
|
+
return NativeRadar.updateTripLeg(options) as Promise<RadarTripLegCallback>;
|
|
485
|
+
},
|
|
486
|
+
reorderTripLegs: function (
|
|
487
|
+
options: RadarReorderTripLegsOptions
|
|
488
|
+
): Promise<RadarTripCallback> {
|
|
489
|
+
return NativeRadar.reorderTripLegs(options) as Promise<RadarTripCallback>;
|
|
490
|
+
},
|
|
455
491
|
acceptEvent: function (eventId: string, verifiedPlaceId: string): void {
|
|
456
492
|
return NativeRadar.acceptEvent(eventId, verifiedPlaceId);
|
|
457
493
|
},
|
|
@@ -534,6 +570,9 @@ const Radar: RadarNativeInterface = {
|
|
|
534
570
|
getPublishableKey: function (): Promise<string> {
|
|
535
571
|
return NativeRadar.getPublishableKey();
|
|
536
572
|
},
|
|
573
|
+
isInitialized: function (): Promise<boolean> {
|
|
574
|
+
return NativeRadar.isInitialized();
|
|
575
|
+
},
|
|
537
576
|
};
|
|
538
577
|
|
|
539
578
|
export default Radar;
|
package/src/index.web.js
CHANGED
|
@@ -10,6 +10,10 @@ const initialize = (publishableKey) => {
|
|
|
10
10
|
RadarJS.initialize(publishableKey);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
const initializeWithAuthToken = (authToken) => {
|
|
14
|
+
if (throws) throw new Error("initializeWithAuthToken() is not implemented on web");
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
const setLogLevel = (level) => {
|
|
14
18
|
if (throws) throw new Error("setLogLevel() is not implemented on web");
|
|
15
19
|
};
|
|
@@ -259,6 +263,16 @@ const updateTrip = (tripOptions) => {
|
|
|
259
263
|
});
|
|
260
264
|
};
|
|
261
265
|
|
|
266
|
+
const updateTripLeg = (options) => {
|
|
267
|
+
if (throws) throw new Error("updateTripLeg() is not implemented on web");
|
|
268
|
+
return new Promise((resolve, reject) => { reject("updateTripLeg() is not implemented on web") });
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const reorderTripLegs = (options) => {
|
|
272
|
+
if (throws) throw new Error("reorderTripLegs() is not implemented on web");
|
|
273
|
+
return new Promise((resolve, reject) => { reject("reorderTripLegs() is not implemented on web") });
|
|
274
|
+
}
|
|
275
|
+
|
|
262
276
|
const acceptEvent = (eventId, verifiedPlaceId) => {
|
|
263
277
|
if (throws) throw new Error("acceptEvent() is not implemented on web");
|
|
264
278
|
};
|
|
@@ -467,6 +481,7 @@ const rnSdkVersion = () => VERSION;
|
|
|
467
481
|
|
|
468
482
|
const Radar = {
|
|
469
483
|
initialize,
|
|
484
|
+
initializeWithAuthToken,
|
|
470
485
|
setLogLevel,
|
|
471
486
|
setUserId,
|
|
472
487
|
getUserId,
|
|
@@ -499,6 +514,8 @@ const Radar = {
|
|
|
499
514
|
completeTrip,
|
|
500
515
|
cancelTrip,
|
|
501
516
|
updateTrip,
|
|
517
|
+
updateTripLeg,
|
|
518
|
+
reorderTripLegs,
|
|
502
519
|
acceptEvent,
|
|
503
520
|
rejectEvent,
|
|
504
521
|
getContext,
|
package/src/ui/autocomplete.jsx
CHANGED
|
@@ -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,
|
package/src/ui/map.jsx
CHANGED
|
@@ -5,10 +5,19 @@ import { getHost, getPublishableKey } from '../helpers';
|
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
|
|
7
7
|
let MapLibreGL;
|
|
8
|
+
let MapLibreMap;
|
|
9
|
+
let GeoJSONSource;
|
|
10
|
+
let Layer;
|
|
8
11
|
try {
|
|
9
12
|
MapLibreGL = require('@maplibre/maplibre-react-native');
|
|
13
|
+
MapLibreMap = MapLibreGL.Map;
|
|
14
|
+
GeoJSONSource = MapLibreGL.GeoJSONSource;
|
|
15
|
+
Layer = MapLibreGL.Layer;
|
|
10
16
|
} catch (e) {
|
|
11
17
|
MapLibreGL = null;
|
|
18
|
+
MapLibreMap = null;
|
|
19
|
+
GeoJSONSource = null;
|
|
20
|
+
Layer = null;
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
const DEFAULT_STYLE = 'radar-default-v1';
|
|
@@ -25,8 +34,9 @@ const createStyleURL = async (style = DEFAULT_STYLE) => {
|
|
|
25
34
|
* @param {Object} [props.mapOptions] - Map configuration options
|
|
26
35
|
* @param {string} [props.mapOptions.mapStyle] - Map style identifier (defaults to 'radar-default-v1')
|
|
27
36
|
* @param {boolean} [props.mapOptions.showUserLocation] - Whether to show the user's location on the map (default: true)
|
|
37
|
+
* @param {React.Ref} [props.mapOptions.mapRef] - Ref to the underlying MapLibre Map component
|
|
28
38
|
* @param {function} [props.mapOptions.onRegionDidChange] - Callback fired when the map region changes
|
|
29
|
-
* @param {Object} props.mapOptions.onRegionDidChange.
|
|
39
|
+
* @param {Object} props.mapOptions.onRegionDidChange.event - The region event data
|
|
30
40
|
* @param {function} [props.mapOptions.onDidFinishLoadingMap] - Callback fired when the map finishes loading
|
|
31
41
|
* @param {function} [props.mapOptions.onWillStartLoadingMap] - Callback fired when the map starts loading
|
|
32
42
|
* @param {function} [props.mapOptions.onDidFailLoadingMap] - Callback fired when the map fails to load
|
|
@@ -80,54 +90,61 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
80
90
|
};
|
|
81
91
|
|
|
82
92
|
const userLocationMapIndicator = (
|
|
83
|
-
<
|
|
93
|
+
<GeoJSONSource
|
|
84
94
|
id="user-location"
|
|
85
|
-
|
|
95
|
+
data={JSON.stringify(geoJSONUserLocation)}
|
|
86
96
|
>
|
|
87
|
-
<
|
|
97
|
+
<Layer
|
|
88
98
|
id="user-location-inner"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
type="circle"
|
|
100
|
+
paint={{
|
|
101
|
+
'circle-radius': 15,
|
|
102
|
+
'circle-color': '#000257',
|
|
103
|
+
'circle-opacity': 0.2,
|
|
104
|
+
'circle-pitch-alignment': 'map',
|
|
94
105
|
}}
|
|
95
106
|
/>
|
|
96
|
-
<
|
|
107
|
+
<Layer
|
|
97
108
|
id="user-location-middle"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
type="circle"
|
|
110
|
+
paint={{
|
|
111
|
+
'circle-radius': 9,
|
|
112
|
+
'circle-color': '#fff',
|
|
113
|
+
'circle-pitch-alignment': 'map',
|
|
102
114
|
}}
|
|
103
115
|
/>
|
|
104
|
-
<
|
|
116
|
+
<Layer
|
|
105
117
|
id="user-location-outer"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
type="circle"
|
|
119
|
+
paint={{
|
|
120
|
+
'circle-radius': 6,
|
|
121
|
+
'circle-color': '#000257',
|
|
122
|
+
'circle-pitch-alignment': 'map',
|
|
110
123
|
}}
|
|
111
124
|
/>
|
|
112
|
-
</
|
|
125
|
+
</GeoJSONSource>
|
|
113
126
|
);
|
|
114
127
|
|
|
115
128
|
return (
|
|
116
129
|
<View style={styles.mapContainer}>
|
|
117
|
-
<
|
|
130
|
+
<MapLibreMap
|
|
131
|
+
ref={mapOptions?.mapRef}
|
|
118
132
|
style={styles.map}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
onRegionDidChange={mapOptions?.onRegionDidChange
|
|
133
|
+
touchPitch={false}
|
|
134
|
+
compass={false}
|
|
135
|
+
logo={false}
|
|
136
|
+
attribution
|
|
137
|
+
onRegionDidChange={ mapOptions?.onRegionDidChange
|
|
138
|
+
? (event) => mapOptions.onRegionDidChange(event.nativeEvent)
|
|
139
|
+
: null
|
|
140
|
+
}
|
|
124
141
|
onDidFinishLoadingMap={mapOptions?.onDidFinishLoadingMap ? mapOptions.onDidFinishLoadingMap : null}
|
|
125
142
|
onWillStartLoadingMap={mapOptions?.onWillStartLoadingMap ? mapOptions.onWillStartLoadingMap : null}
|
|
126
143
|
onDidFailLoadingMap={mapOptions?.onDidFailLoadingMap ? mapOptions.onDidFailLoadingMap : null}
|
|
127
144
|
mapStyle={styleURL}>
|
|
128
145
|
{mapOptions?.showUserLocation !== false && userLocationMapIndicator}
|
|
129
146
|
{children}
|
|
130
|
-
</
|
|
147
|
+
</MapLibreMap>
|
|
131
148
|
<Image
|
|
132
149
|
source={require('./map-logo.png')}
|
|
133
150
|
style={styles.mapLogo}
|
package/src/version.ts
CHANGED