@doorstepai/dropoff-sdk 2.0.2 → 2.0.5
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/doorstepai/dropoffsdk/DoorstepAIModule.kt +43 -58
- package/ios/DoorstepAI.mm +14 -5
- package/ios/DoorstepAI.swift +53 -18
- 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/Headers/DoorstepDropoffSDK.h +1 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Headers/RateReducer.h +117 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +2341 -839
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +24 -24
- 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 +24 -24
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +35 -13
- 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 +2103 -1462
- 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/Headers/DoorstepDropoffSDK.h +1 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Headers/RateReducer.h +117 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +2341 -839
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +24 -24
- 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 +24 -24
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +2341 -839
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +24 -24
- 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 +24 -24
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +45 -23
- 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 +2103 -1462
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2093 -1457
- package/lib/module/DoorstepAI.js +91 -27
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/module/RootDoorstepAI.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +65 -5
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +260 -51
- package/src/RootDoorstepAI.tsx +0 -1
- package/src/index.tsx +6 -0
package/src/DoorstepAI.tsx
CHANGED
|
@@ -10,10 +10,56 @@ type AddressType = {
|
|
|
10
10
|
postalCode: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
type LatLngObject = {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Per-delivery options shared across both platforms. Fields not supported on a
|
|
20
|
+
* given platform are silently ignored.
|
|
21
|
+
*/
|
|
22
|
+
type StartDeliveryOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* Hard upper bound on the delivery's tracking session in seconds. When the
|
|
25
|
+
* timer fires the SDK calls `stopDelivery` automatically. Defaults to 7200
|
|
26
|
+
* (2 hours) when not provided.
|
|
27
|
+
*/
|
|
28
|
+
timeoutSeconds?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Optional countdown (in seconds) to auto-stop the delivery once
|
|
31
|
+
* `markDropoff` is invoked. Survives backgrounding/process death on both
|
|
32
|
+
* platforms (UserDefaults on iOS, AlarmManager on Android).
|
|
33
|
+
*/
|
|
34
|
+
autoStopAfterDropoffSeconds?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Android only. When `true`, the SDK will NOT promote its internal
|
|
37
|
+
* tracking service to the foreground — it expects the host app to already
|
|
38
|
+
* be running its own foreground service that keeps the process alive.
|
|
39
|
+
* Ignored on iOS.
|
|
40
|
+
*/
|
|
41
|
+
manualForeground?: boolean;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Mirrors the iOS SDK's `SDKLogLevel` enum. Only used by
|
|
46
|
+
* `configureRemoteLogging` (iOS only).
|
|
47
|
+
*/
|
|
48
|
+
type SDKLogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
|
|
49
|
+
|
|
50
|
+
const SDK_LOG_LEVEL_RAW: Record<SDKLogLevel, number> = {
|
|
51
|
+
debug: 0,
|
|
52
|
+
info: 1,
|
|
53
|
+
warning: 2,
|
|
54
|
+
error: 3,
|
|
55
|
+
critical: 4,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const DEFAULT_TIMEOUT_SECONDS = 7200;
|
|
59
|
+
|
|
13
60
|
class DoorstepAIModule {
|
|
14
61
|
static isInitialized = false;
|
|
15
62
|
|
|
16
|
-
|
|
17
63
|
static async init(
|
|
18
64
|
notificationTitle?: string,
|
|
19
65
|
notificationText?: string
|
|
@@ -25,7 +71,7 @@ class DoorstepAIModule {
|
|
|
25
71
|
try {
|
|
26
72
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
27
73
|
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
28
|
-
this.isInitialized = true;
|
|
74
|
+
this.isInitialized = true;
|
|
29
75
|
} catch (error) {
|
|
30
76
|
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
31
77
|
throw error;
|
|
@@ -37,59 +83,154 @@ class DoorstepAIModule {
|
|
|
37
83
|
DoorstepAI.setApiKey(apiKey);
|
|
38
84
|
}
|
|
39
85
|
|
|
40
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Triggers iOS Motion/Fitness + Location permission prompts up-front so the
|
|
88
|
+
* host app does not need to manage them itself. No-op on Android — use
|
|
89
|
+
* `PermissionsAndroid` (already wired into `RootDoorstepAI`).
|
|
90
|
+
*/
|
|
91
|
+
static requestAllPermissions(requestAlwaysLocation: boolean = true) {
|
|
92
|
+
if (Platform.OS === 'ios') {
|
|
93
|
+
DoorstepAI.requestAllPermissions(requestAlwaysLocation);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Configures the iOS SDK's remote logging pipeline. No-op on Android (the
|
|
99
|
+
* Android SDK currently configures remote logging via remote config / dev
|
|
100
|
+
* mode rather than a public host-app entry point).
|
|
101
|
+
*/
|
|
102
|
+
static configureRemoteLogging(options: {
|
|
103
|
+
enabled: boolean;
|
|
104
|
+
minLevel?: SDKLogLevel;
|
|
105
|
+
flushIntervalSeconds?: number;
|
|
106
|
+
batchSize?: number;
|
|
107
|
+
maxQueueSize?: number;
|
|
108
|
+
}) {
|
|
109
|
+
if (Platform.OS !== 'ios') return;
|
|
110
|
+
const minLevelRaw =
|
|
111
|
+
options.minLevel != null ? SDK_LOG_LEVEL_RAW[options.minLevel] : null;
|
|
112
|
+
DoorstepAI.configureRemoteLogging(
|
|
113
|
+
options.enabled,
|
|
114
|
+
minLevelRaw,
|
|
115
|
+
options.flushIntervalSeconds ?? null,
|
|
116
|
+
options.batchSize ?? null,
|
|
117
|
+
options.maxQueueSize ?? null
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
41
121
|
static async startDeliveryByPlaceID(
|
|
42
122
|
placeID: string,
|
|
43
123
|
deliveryId: string,
|
|
44
|
-
timeoutSeconds?: number
|
|
124
|
+
timeoutSeconds?: number,
|
|
125
|
+
options?: StartDeliveryOptions
|
|
45
126
|
) {
|
|
46
127
|
try {
|
|
47
|
-
const
|
|
128
|
+
const timeout =
|
|
129
|
+
timeoutSeconds ?? options?.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
|
|
130
|
+
const autoStop = options?.autoStopAfterDropoffSeconds ?? null;
|
|
131
|
+
const result =
|
|
132
|
+
Platform.OS === 'android'
|
|
133
|
+
? await DoorstepAI.startDeliveryByPlaceID(
|
|
134
|
+
placeID,
|
|
135
|
+
deliveryId,
|
|
136
|
+
timeout,
|
|
137
|
+
autoStop,
|
|
138
|
+
options?.manualForeground ?? false
|
|
139
|
+
)
|
|
140
|
+
: await DoorstepAI.startDeliveryByPlaceID(
|
|
141
|
+
placeID,
|
|
142
|
+
deliveryId,
|
|
143
|
+
timeout,
|
|
144
|
+
autoStop
|
|
145
|
+
);
|
|
146
|
+
console.log(
|
|
147
|
+
'DOORSTEPAI - Delivery started successfully by Place ID:',
|
|
48
148
|
placeID,
|
|
49
|
-
deliveryId
|
|
50
|
-
timeoutSeconds ?? 7200
|
|
149
|
+
deliveryId
|
|
51
150
|
);
|
|
52
|
-
|
|
53
|
-
return result; // Return result (e.g., session ID from Android)
|
|
151
|
+
return result;
|
|
54
152
|
} catch (error: any) {
|
|
55
|
-
console.error(
|
|
56
|
-
|
|
153
|
+
console.error(
|
|
154
|
+
'DOORSTEPAI - Failed to start delivery by Place ID:',
|
|
155
|
+
error
|
|
156
|
+
);
|
|
157
|
+
throw error;
|
|
57
158
|
}
|
|
58
159
|
}
|
|
59
160
|
|
|
60
|
-
|
|
161
|
+
/** @deprecated Use `startDeliveryByAddressString` with coordinates instead. */
|
|
61
162
|
static async startDeliveryByPlusCode(
|
|
62
163
|
plusCode: string,
|
|
63
164
|
deliveryId: string,
|
|
64
|
-
timeoutSeconds?: number
|
|
165
|
+
timeoutSeconds?: number,
|
|
166
|
+
options?: StartDeliveryOptions
|
|
65
167
|
) {
|
|
66
168
|
try {
|
|
67
|
-
const
|
|
169
|
+
const timeout =
|
|
170
|
+
timeoutSeconds ?? options?.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
|
|
171
|
+
// Android's deprecated startDeliveryByPlusCode does not accept the new
|
|
172
|
+
// options, so we forward only the supported parameters there.
|
|
173
|
+
const result =
|
|
174
|
+
Platform.OS === 'ios'
|
|
175
|
+
? await DoorstepAI.startDeliveryByPlusCode(
|
|
176
|
+
plusCode,
|
|
177
|
+
deliveryId,
|
|
178
|
+
timeout,
|
|
179
|
+
options?.autoStopAfterDropoffSeconds ?? null
|
|
180
|
+
)
|
|
181
|
+
: await DoorstepAI.startDeliveryByPlusCode(
|
|
182
|
+
plusCode,
|
|
183
|
+
deliveryId,
|
|
184
|
+
timeout
|
|
185
|
+
);
|
|
186
|
+
console.log(
|
|
187
|
+
'DOORSTEPAI - Delivery started successfully by Plus Code:',
|
|
68
188
|
plusCode,
|
|
69
|
-
deliveryId
|
|
70
|
-
timeoutSeconds ?? 7200
|
|
189
|
+
deliveryId
|
|
71
190
|
);
|
|
72
|
-
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
73
191
|
return result;
|
|
74
192
|
} catch (error: any) {
|
|
75
|
-
console.error(
|
|
193
|
+
console.error(
|
|
194
|
+
'DOORSTEPAI - Failed to start delivery by Plus Code:',
|
|
195
|
+
error
|
|
196
|
+
);
|
|
76
197
|
throw error;
|
|
77
198
|
}
|
|
78
199
|
}
|
|
79
200
|
|
|
80
|
-
// Add deliveryId parameter and handle platform difference
|
|
81
201
|
static async startDeliveryByAddress(
|
|
82
202
|
address: AddressType,
|
|
83
203
|
deliveryId: string,
|
|
84
|
-
timeoutSeconds?: number
|
|
204
|
+
timeoutSeconds?: number,
|
|
205
|
+
coordinates?: LatLngObject,
|
|
206
|
+
options?: StartDeliveryOptions
|
|
85
207
|
) {
|
|
86
208
|
try {
|
|
87
|
-
|
|
209
|
+
const timeout =
|
|
210
|
+
timeoutSeconds ?? options?.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
|
|
211
|
+
const autoStop = options?.autoStopAfterDropoffSeconds ?? null;
|
|
212
|
+
const result =
|
|
213
|
+
Platform.OS === 'android'
|
|
214
|
+
? await DoorstepAI.startDeliveryByAddress(
|
|
215
|
+
address,
|
|
216
|
+
deliveryId,
|
|
217
|
+
coordinates ?? null,
|
|
218
|
+
timeout,
|
|
219
|
+
autoStop,
|
|
220
|
+
options?.manualForeground ?? false
|
|
221
|
+
)
|
|
222
|
+
: await DoorstepAI.startDeliveryByAddress(
|
|
223
|
+
address,
|
|
224
|
+
deliveryId,
|
|
225
|
+
coordinates ?? null,
|
|
226
|
+
timeout,
|
|
227
|
+
autoStop
|
|
228
|
+
);
|
|
229
|
+
console.log(
|
|
230
|
+
'DOORSTEPAI - Delivery started successfully by Address:',
|
|
88
231
|
address,
|
|
89
|
-
deliveryId
|
|
90
|
-
timeoutSeconds ?? 7200
|
|
232
|
+
deliveryId
|
|
91
233
|
);
|
|
92
|
-
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
93
234
|
return result;
|
|
94
235
|
} catch (error: any) {
|
|
95
236
|
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
@@ -100,38 +241,77 @@ class DoorstepAIModule {
|
|
|
100
241
|
static async startDeliveryByAddressString(
|
|
101
242
|
address: string,
|
|
102
243
|
deliveryId: string,
|
|
103
|
-
timeoutSeconds?: number
|
|
244
|
+
timeoutSeconds?: number,
|
|
245
|
+
coordinates?: LatLngObject,
|
|
246
|
+
options?: StartDeliveryOptions
|
|
104
247
|
) {
|
|
105
248
|
try {
|
|
106
|
-
const
|
|
249
|
+
const timeout =
|
|
250
|
+
timeoutSeconds ?? options?.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
|
|
251
|
+
const autoStop = options?.autoStopAfterDropoffSeconds ?? null;
|
|
252
|
+
const result =
|
|
253
|
+
Platform.OS === 'android'
|
|
254
|
+
? await DoorstepAI.startDeliveryByAddressString(
|
|
255
|
+
address,
|
|
256
|
+
deliveryId,
|
|
257
|
+
coordinates ?? null,
|
|
258
|
+
timeout,
|
|
259
|
+
autoStop,
|
|
260
|
+
options?.manualForeground ?? false
|
|
261
|
+
)
|
|
262
|
+
: await DoorstepAI.startDeliveryByAddressString(
|
|
263
|
+
address,
|
|
264
|
+
deliveryId,
|
|
265
|
+
coordinates ?? null,
|
|
266
|
+
timeout,
|
|
267
|
+
autoStop
|
|
268
|
+
);
|
|
269
|
+
console.log(
|
|
270
|
+
'DOORSTEPAI - Delivery started successfully by Address String:',
|
|
107
271
|
address,
|
|
108
|
-
deliveryId
|
|
109
|
-
timeoutSeconds ?? 7200
|
|
272
|
+
deliveryId
|
|
110
273
|
);
|
|
111
|
-
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
112
274
|
return result;
|
|
113
275
|
} catch (error: any) {
|
|
114
|
-
console.error(
|
|
276
|
+
console.error(
|
|
277
|
+
'DOORSTEPAI - Failed to start delivery by Address String:',
|
|
278
|
+
error
|
|
279
|
+
);
|
|
115
280
|
throw error;
|
|
116
281
|
}
|
|
117
282
|
}
|
|
118
283
|
|
|
119
|
-
|
|
284
|
+
/** @deprecated Use `startDeliveryByAddress` or `startDeliveryByAddressString` with coordinates instead. */
|
|
120
285
|
static async startDeliveryByLatLng(
|
|
121
286
|
latitude: number,
|
|
122
287
|
longitude: number,
|
|
123
288
|
subUnit: string,
|
|
124
289
|
deliveryId: string,
|
|
125
|
-
timeoutSeconds?: number
|
|
290
|
+
timeoutSeconds?: number,
|
|
291
|
+
options?: StartDeliveryOptions
|
|
126
292
|
) {
|
|
127
293
|
try {
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
294
|
+
const timeout =
|
|
295
|
+
timeoutSeconds ?? options?.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
|
|
296
|
+
// Android's deprecated startDeliveryByLatLng does not accept the new
|
|
297
|
+
// options, so we forward only the supported parameters there.
|
|
298
|
+
const result =
|
|
299
|
+
Platform.OS === 'ios'
|
|
300
|
+
? await DoorstepAI.startDeliveryByLatLng(
|
|
301
|
+
latitude,
|
|
302
|
+
longitude,
|
|
303
|
+
subUnit,
|
|
304
|
+
deliveryId,
|
|
305
|
+
timeout,
|
|
306
|
+
options?.autoStopAfterDropoffSeconds ?? null
|
|
307
|
+
)
|
|
308
|
+
: await DoorstepAI.startDeliveryByLatLng(
|
|
309
|
+
latitude,
|
|
310
|
+
longitude,
|
|
311
|
+
subUnit,
|
|
312
|
+
deliveryId,
|
|
313
|
+
timeout
|
|
314
|
+
);
|
|
135
315
|
console.log(
|
|
136
316
|
'DOORSTEPAI - Delivery started successfully by LatLng:',
|
|
137
317
|
latitude,
|
|
@@ -148,20 +328,23 @@ class DoorstepAIModule {
|
|
|
148
328
|
|
|
149
329
|
static async markDropoff(deliveryId: string, dropoffType: 'pod' | 'non_pod') {
|
|
150
330
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
console.log('DOORSTEPAI - Dropoff marked successfully:', deliveryId, dropoffType);
|
|
331
|
+
await DoorstepAI.markDropoff(deliveryId, dropoffType);
|
|
332
|
+
console.log(
|
|
333
|
+
'DOORSTEPAI - Dropoff marked successfully:',
|
|
334
|
+
deliveryId,
|
|
335
|
+
dropoffType
|
|
336
|
+
);
|
|
158
337
|
} catch (error: any) {
|
|
159
|
-
console.error(
|
|
338
|
+
console.error(
|
|
339
|
+
'DOORSTEPAI - Failed to mark dropoff:',
|
|
340
|
+
deliveryId,
|
|
341
|
+
dropoffType,
|
|
342
|
+
error
|
|
343
|
+
);
|
|
160
344
|
throw error;
|
|
161
345
|
}
|
|
162
346
|
}
|
|
163
347
|
|
|
164
|
-
// Add deliveryId parameter
|
|
165
348
|
static async stopDelivery(deliveryId: string) {
|
|
166
349
|
try {
|
|
167
350
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
@@ -172,18 +355,44 @@ class DoorstepAIModule {
|
|
|
172
355
|
}
|
|
173
356
|
}
|
|
174
357
|
|
|
175
|
-
// Add deliveryId parameter
|
|
176
358
|
static async newEvent(eventName: string, deliveryId: string) {
|
|
177
359
|
try {
|
|
178
360
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
179
361
|
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
180
362
|
return result;
|
|
181
363
|
} catch (error: any) {
|
|
182
|
-
console.error(
|
|
364
|
+
console.error(
|
|
365
|
+
'DOORSTEPAI - Failed to send event:',
|
|
366
|
+
eventName,
|
|
367
|
+
deliveryId,
|
|
368
|
+
error
|
|
369
|
+
);
|
|
183
370
|
throw error;
|
|
184
371
|
}
|
|
185
372
|
}
|
|
186
|
-
|
|
373
|
+
|
|
374
|
+
// ---- Dev-mode helpers (Android exposes a richer surface than iOS) ----
|
|
375
|
+
|
|
376
|
+
static async enableDevMode(apiKey: string): Promise<boolean> {
|
|
377
|
+
if (Platform.OS === 'ios') {
|
|
378
|
+
await DoorstepAI.enableDevMode(apiKey);
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
return Boolean(await DoorstepAI.enableDevMode());
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** Android only. Returns false on iOS. */
|
|
385
|
+
static async validateDevModeAccess(): Promise<boolean> {
|
|
386
|
+
if (Platform.OS !== 'android') return false;
|
|
387
|
+
return Boolean(await DoorstepAI.validateDevModeAccess());
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Android only. No-op on iOS. */
|
|
391
|
+
static async disableDevMode(): Promise<boolean> {
|
|
392
|
+
if (Platform.OS !== 'android') return false;
|
|
393
|
+
return Boolean(await DoorstepAI.disableDevMode());
|
|
394
|
+
}
|
|
187
395
|
}
|
|
188
396
|
|
|
189
397
|
export { DoorstepAIModule as DoorstepAI };
|
|
398
|
+
export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
|
package/src/RootDoorstepAI.tsx
CHANGED
package/src/index.tsx
CHANGED