@doorstepai/dropoff-sdk 2.2.6 → 2.2.8
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/README.md +35 -10
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +41 -6
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepEmbedViewManager.kt +64 -1
- package/ios/DoorstepAI.mm +10 -0
- package/ios/DoorstepAI.swift +50 -6
- package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +10 -10
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +5069 -3867
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +20 -20
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +5064 -3862
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +5032 -3836
- package/ios/DoorstepEmbedViewManager.mm +9 -0
- package/ios/DoorstepEmbedViewManager.swift +46 -5
- package/ios/RootDoorstepAIViewManager.swift +1 -0
- package/lib/module/DoorstepAI.js +21 -2
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/module/DoorstepEmbedView.js +19 -1
- package/lib/module/DoorstepEmbedView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +26 -8
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/DoorstepEmbedView.d.ts +32 -3
- package/lib/typescript/src/DoorstepEmbedView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +10 -6
- package/src/DoorstepAI.tsx +42 -7
- package/src/DoorstepEmbedView.tsx +58 -9
- package/src/index.tsx +2 -0
package/src/DoorstepAI.tsx
CHANGED
|
@@ -27,23 +27,24 @@ type LatLngObject = {
|
|
|
27
27
|
/**
|
|
28
28
|
* A single stop the SDK should geofence in `startRouteGeofencing`. On geofence
|
|
29
29
|
* ENTER the SDK auto-starts a delivery session for `deliveryId`; on EXIT it stops
|
|
30
|
-
* it
|
|
31
|
-
* timeout backstop applies).
|
|
30
|
+
* it according to server-owned `misc.geofence.waitForDropoff` policy.
|
|
32
31
|
*/
|
|
33
32
|
type DeliveryStop = {
|
|
34
33
|
deliveryId: string;
|
|
35
34
|
address: string;
|
|
36
35
|
latitude: number;
|
|
37
36
|
longitude: number;
|
|
38
|
-
/**
|
|
37
|
+
/** Stable stop identity, defaulting to deliveryId in the native SDK. */
|
|
38
|
+
routeStopId?: string;
|
|
39
|
+
/** @deprecated Ignored; the server owns geofence radius. */
|
|
39
40
|
radiusMeters?: number;
|
|
40
41
|
customerId?: string;
|
|
41
42
|
driverId?: string;
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
/** Route-wide options for `startRouteGeofencing`. */
|
|
45
|
-
type
|
|
46
|
-
/**
|
|
46
|
+
type RouteOptions = {
|
|
47
|
+
/** @deprecated Ignored; the server owns geofence radius. */
|
|
47
48
|
defaultRadiusMeters?: number;
|
|
48
49
|
/** Per-session safety timeout (s) forwarded to the auto-started delivery. */
|
|
49
50
|
timeoutSeconds?: number;
|
|
@@ -51,8 +52,19 @@ type RouteGeofenceOptions = {
|
|
|
51
52
|
autoStopAfterDropoffSeconds?: number;
|
|
52
53
|
/** Android only. Host owns the foreground service; SDK won't promote its own. Ignored on iOS. */
|
|
53
54
|
manualForeground?: boolean;
|
|
55
|
+
/** Android only. Maximum age of durable route intent in seconds. */
|
|
56
|
+
maxAgeSeconds?: number;
|
|
57
|
+
/** Optional host business route identifier. */
|
|
58
|
+
clientRouteId?: string;
|
|
59
|
+
/** Optional driver identifier for the whole route. */
|
|
60
|
+
driverId?: string;
|
|
61
|
+
/** Small business metadata; native route options accept string values. */
|
|
62
|
+
metadata?: Record<string, string>;
|
|
54
63
|
};
|
|
55
64
|
|
|
65
|
+
/** @deprecated Use RouteOptions. Kept for existing integrations. */
|
|
66
|
+
type RouteGeofenceOptions = RouteOptions;
|
|
67
|
+
|
|
56
68
|
type GeofenceSessionEventType = 'STARTED' | 'STOPPED';
|
|
57
69
|
|
|
58
70
|
/** Emitted whenever route geofencing auto-starts or auto-stops a session. */
|
|
@@ -80,7 +92,7 @@ type StartDeliveryOptions = {
|
|
|
80
92
|
timeoutSeconds?: number;
|
|
81
93
|
/**
|
|
82
94
|
* Optional countdown (in seconds) to auto-stop the delivery once
|
|
83
|
-
* `
|
|
95
|
+
* `stopDelivery` is invoked. Survives backgrounding/process death on both
|
|
84
96
|
* platforms (UserDefaults on iOS, AlarmManager on Android).
|
|
85
97
|
*/
|
|
86
98
|
autoStopAfterDropoffSeconds?: number;
|
|
@@ -1032,7 +1044,7 @@ class DoorstepAIModule {
|
|
|
1032
1044
|
*/
|
|
1033
1045
|
static async startRouteGeofencing(
|
|
1034
1046
|
stops: DeliveryStop[],
|
|
1035
|
-
options?:
|
|
1047
|
+
options?: RouteOptions
|
|
1036
1048
|
): Promise<void> {
|
|
1037
1049
|
try {
|
|
1038
1050
|
await DoorstepAI.startRouteGeofencing(stops, options ?? null);
|
|
@@ -1071,6 +1083,28 @@ class DoorstepAIModule {
|
|
|
1071
1083
|
}
|
|
1072
1084
|
}
|
|
1073
1085
|
|
|
1086
|
+
/** Durable route intent, independent of an active delivery session. */
|
|
1087
|
+
static async isRouteGeofencingActive(): Promise<boolean> {
|
|
1088
|
+
return Boolean(await DoorstepAI.isRouteGeofencingActive());
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/** Canonical SDK route UUID, or null when no route is active. */
|
|
1092
|
+
static async getActiveRouteId(): Promise<string | null> {
|
|
1093
|
+
return (await DoorstepAI.getActiveRouteId()) ?? null;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
static async getActiveRouteRevision(): Promise<number | null> {
|
|
1097
|
+
return (await DoorstepAI.getActiveRouteRevision()) ?? null;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
/** Attach JSON metadata to a delivery before or after its session starts. */
|
|
1101
|
+
static async addMetadata(
|
|
1102
|
+
deliveryId: string,
|
|
1103
|
+
metadata: Record<string, unknown>
|
|
1104
|
+
): Promise<void> {
|
|
1105
|
+
await DoorstepAI.addMetadata(deliveryId, metadata);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1074
1108
|
/**
|
|
1075
1109
|
* Re-arm route geofencing after a process relaunch if a route was active.
|
|
1076
1110
|
* Safe no-op when no route is persisted.
|
|
@@ -1147,6 +1181,7 @@ export type {
|
|
|
1147
1181
|
SDKLogLevel,
|
|
1148
1182
|
DeliveryStop,
|
|
1149
1183
|
RouteGeofenceOptions,
|
|
1184
|
+
RouteOptions,
|
|
1150
1185
|
GeofenceSessionEvent,
|
|
1151
1186
|
GeofenceSessionEventType,
|
|
1152
1187
|
};
|
|
@@ -8,6 +8,19 @@ import {
|
|
|
8
8
|
|
|
9
9
|
export type DoorstepEmbedMode = 'preview' | 'compact';
|
|
10
10
|
|
|
11
|
+
export type DoorstepEmbedError = {
|
|
12
|
+
code:
|
|
13
|
+
| 'INVALID_API_KEY'
|
|
14
|
+
| 'DESTINATION_NOT_MAPPED'
|
|
15
|
+
| 'NETWORK_ERROR'
|
|
16
|
+
| 'INTERNAL_SERVER_ERROR';
|
|
17
|
+
stage: 'linkGeneration' | 'webNavigation' | 'initialization' | 'rendering';
|
|
18
|
+
message: string;
|
|
19
|
+
isRetryable: boolean;
|
|
20
|
+
httpStatusCode?: number;
|
|
21
|
+
requestId?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
11
24
|
export type DoorstepEmbedViewProps = ViewProps & {
|
|
12
25
|
/** Delivery address shown by Doorstep Go. */
|
|
13
26
|
address: string;
|
|
@@ -31,23 +44,37 @@ export type DoorstepEmbedViewProps = ViewProps & {
|
|
|
31
44
|
polygonColor?: string;
|
|
32
45
|
/** Parking overlay color as a CSS-compatible color string. */
|
|
33
46
|
parkingColor?: string;
|
|
34
|
-
/**
|
|
47
|
+
/** Optional destination coordinates, forwarded to the signed embed URL. */
|
|
48
|
+
endpoint?: { lat: number; lng: number };
|
|
49
|
+
/** Show the native map-style selector. Default true. */
|
|
50
|
+
mapStyleToggle?: boolean;
|
|
51
|
+
/** Show the native recenter button. Default true. */
|
|
52
|
+
gpsRecenterToggle?: boolean;
|
|
53
|
+
/** Show the page-owned Street View entry point. Default true. */
|
|
54
|
+
streetViewToggle?: boolean;
|
|
55
|
+
/** Show the native expand/collapse button. Default true. */
|
|
56
|
+
expandContractToggle?: boolean;
|
|
57
|
+
/** Initially fit both GPS and destination. Default false. */
|
|
58
|
+
fitGpsOnStart?: boolean;
|
|
59
|
+
/** Page-readiness timeout in seconds. Default 15. */
|
|
60
|
+
readyTimeoutSeconds?: number;
|
|
61
|
+
/** Called after native or host-driven mode changes. */
|
|
35
62
|
onModeChanged?: (mode: DoorstepEmbedMode) => void;
|
|
63
|
+
/** Called when page navigation starts after link creation. */
|
|
64
|
+
onLoading?: () => void;
|
|
65
|
+
/** Called when the page reports readiness. */
|
|
66
|
+
onSuccess?: () => void;
|
|
36
67
|
/** Called when link minting, navigation, or page loading fails. */
|
|
37
|
-
onError?: (message: string) => void;
|
|
68
|
+
onError?: (message: string, error: DoorstepEmbedError) => void;
|
|
38
69
|
};
|
|
39
70
|
|
|
40
71
|
type ModeChangedEvent = {
|
|
41
72
|
mode: DoorstepEmbedMode;
|
|
42
73
|
};
|
|
43
74
|
|
|
44
|
-
type ErrorEvent = {
|
|
45
|
-
message: string;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
75
|
type NativeDoorstepEmbedViewProps = Omit<
|
|
49
76
|
DoorstepEmbedViewProps,
|
|
50
|
-
'onModeChanged' | 'onError'
|
|
77
|
+
'onModeChanged' | 'onError' | 'onLoading' | 'onSuccess'
|
|
51
78
|
> & {
|
|
52
79
|
mode: DoorstepEmbedMode;
|
|
53
80
|
inlineHeight: number;
|
|
@@ -59,7 +86,9 @@ type NativeDoorstepEmbedViewProps = Omit<
|
|
|
59
86
|
polygonColor: string;
|
|
60
87
|
parkingColor: string;
|
|
61
88
|
onModeChanged?: (event: NativeSyntheticEvent<ModeChangedEvent>) => void;
|
|
62
|
-
|
|
89
|
+
onLoading?: (event: NativeSyntheticEvent<Record<string, never>>) => void;
|
|
90
|
+
onSuccess?: (event: NativeSyntheticEvent<Record<string, never>>) => void;
|
|
91
|
+
onError?: (event: NativeSyntheticEvent<DoorstepEmbedError>) => void;
|
|
63
92
|
};
|
|
64
93
|
|
|
65
94
|
const DEFAULT_LINK_API = 'https://api.core.doorstep.ai';
|
|
@@ -86,7 +115,16 @@ export function DoorstepEmbedView({
|
|
|
86
115
|
markerColor = '#027FB8',
|
|
87
116
|
polygonColor = '#3291BC',
|
|
88
117
|
parkingColor = '#FF847B',
|
|
118
|
+
endpoint,
|
|
119
|
+
mapStyleToggle = true,
|
|
120
|
+
gpsRecenterToggle = true,
|
|
121
|
+
streetViewToggle = true,
|
|
122
|
+
expandContractToggle = true,
|
|
123
|
+
fitGpsOnStart = false,
|
|
124
|
+
readyTimeoutSeconds = 15,
|
|
89
125
|
onModeChanged,
|
|
126
|
+
onLoading,
|
|
127
|
+
onSuccess,
|
|
90
128
|
onError,
|
|
91
129
|
style,
|
|
92
130
|
...viewProps
|
|
@@ -112,13 +150,24 @@ export function DoorstepEmbedView({
|
|
|
112
150
|
markerColor={markerColor}
|
|
113
151
|
polygonColor={polygonColor}
|
|
114
152
|
parkingColor={parkingColor}
|
|
153
|
+
endpoint={endpoint}
|
|
154
|
+
mapStyleToggle={mapStyleToggle}
|
|
155
|
+
gpsRecenterToggle={gpsRecenterToggle}
|
|
156
|
+
streetViewToggle={streetViewToggle}
|
|
157
|
+
expandContractToggle={expandContractToggle}
|
|
158
|
+
fitGpsOnStart={fitGpsOnStart}
|
|
159
|
+
readyTimeoutSeconds={readyTimeoutSeconds}
|
|
115
160
|
style={[styles.container, heightStyle, style]}
|
|
116
161
|
onModeChanged={(event) => {
|
|
117
162
|
const nextMode = event.nativeEvent.mode;
|
|
118
163
|
setUncontrolledMode(nextMode);
|
|
119
164
|
onModeChanged?.(nextMode);
|
|
120
165
|
}}
|
|
121
|
-
|
|
166
|
+
onLoading={() => onLoading?.()}
|
|
167
|
+
onSuccess={() => onSuccess?.()}
|
|
168
|
+
onError={(event) =>
|
|
169
|
+
onError?.(event.nativeEvent.message, event.nativeEvent)
|
|
170
|
+
}
|
|
122
171
|
/>
|
|
123
172
|
);
|
|
124
173
|
}
|
package/src/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { DoorstepAI } from './DoorstepAI';
|
|
|
3
3
|
import { DoorstepEmbedView } from './DoorstepEmbedView';
|
|
4
4
|
export type {
|
|
5
5
|
DoorstepEmbedMode,
|
|
6
|
+
DoorstepEmbedError,
|
|
6
7
|
DoorstepEmbedViewProps,
|
|
7
8
|
} from './DoorstepEmbedView';
|
|
8
9
|
export type {
|
|
@@ -22,6 +23,7 @@ export type {
|
|
|
22
23
|
SDKLogLevel,
|
|
23
24
|
DeliveryStop,
|
|
24
25
|
RouteGeofenceOptions,
|
|
26
|
+
RouteOptions,
|
|
25
27
|
GeofenceSessionEvent,
|
|
26
28
|
GeofenceSessionEventType,
|
|
27
29
|
} from './DoorstepAI';
|