@doorstepai/dropoff-sdk 2.0.3 → 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 +29 -57
- package/ios/DoorstepAI.mm +12 -5
- package/ios/DoorstepAI.swift +41 -20
- 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 +1248 -261
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +13 -11
- 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 +13 -11
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +24 -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 -1583
- 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 +1248 -261
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +13 -11
- 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 +13 -11
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1248 -261
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +13 -11
- 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 +13 -11
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +34 -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 -1583
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2093 -1578
- package/lib/module/DoorstepAI.js +90 -19
- 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 +61 -6
- 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 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +252 -47
- package/src/RootDoorstepAI.tsx +0 -1
- package/src/index.tsx +6 -1
package/src/DoorstepAI.tsx
CHANGED
|
@@ -15,10 +15,51 @@ type LatLngObject = {
|
|
|
15
15
|
lng: number;
|
|
16
16
|
};
|
|
17
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
|
+
|
|
18
60
|
class DoorstepAIModule {
|
|
19
61
|
static isInitialized = false;
|
|
20
62
|
|
|
21
|
-
|
|
22
63
|
static async init(
|
|
23
64
|
notificationTitle?: string,
|
|
24
65
|
notificationText?: string
|
|
@@ -30,7 +71,7 @@ class DoorstepAIModule {
|
|
|
30
71
|
try {
|
|
31
72
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
32
73
|
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
33
|
-
this.isInitialized = true;
|
|
74
|
+
this.isInitialized = true;
|
|
34
75
|
} catch (error) {
|
|
35
76
|
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
36
77
|
throw error;
|
|
@@ -42,42 +83,117 @@ class DoorstepAIModule {
|
|
|
42
83
|
DoorstepAI.setApiKey(apiKey);
|
|
43
84
|
}
|
|
44
85
|
|
|
45
|
-
|
|
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
|
+
|
|
46
121
|
static async startDeliveryByPlaceID(
|
|
47
122
|
placeID: string,
|
|
48
123
|
deliveryId: string,
|
|
49
|
-
timeoutSeconds?: number
|
|
124
|
+
timeoutSeconds?: number,
|
|
125
|
+
options?: StartDeliveryOptions
|
|
50
126
|
) {
|
|
51
127
|
try {
|
|
52
|
-
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:',
|
|
53
148
|
placeID,
|
|
54
|
-
deliveryId
|
|
55
|
-
timeoutSeconds ?? 7200
|
|
149
|
+
deliveryId
|
|
56
150
|
);
|
|
57
|
-
|
|
58
|
-
return result; // Return result (e.g., session ID from Android)
|
|
151
|
+
return result;
|
|
59
152
|
} catch (error: any) {
|
|
60
|
-
console.error(
|
|
61
|
-
|
|
153
|
+
console.error(
|
|
154
|
+
'DOORSTEPAI - Failed to start delivery by Place ID:',
|
|
155
|
+
error
|
|
156
|
+
);
|
|
157
|
+
throw error;
|
|
62
158
|
}
|
|
63
159
|
}
|
|
64
160
|
|
|
65
|
-
|
|
161
|
+
/** @deprecated Use `startDeliveryByAddressString` with coordinates instead. */
|
|
66
162
|
static async startDeliveryByPlusCode(
|
|
67
163
|
plusCode: string,
|
|
68
164
|
deliveryId: string,
|
|
69
|
-
timeoutSeconds?: number
|
|
165
|
+
timeoutSeconds?: number,
|
|
166
|
+
options?: StartDeliveryOptions
|
|
70
167
|
) {
|
|
71
168
|
try {
|
|
72
|
-
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:',
|
|
73
188
|
plusCode,
|
|
74
|
-
deliveryId
|
|
75
|
-
timeoutSeconds ?? 7200
|
|
189
|
+
deliveryId
|
|
76
190
|
);
|
|
77
|
-
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
78
191
|
return result;
|
|
79
192
|
} catch (error: any) {
|
|
80
|
-
console.error(
|
|
193
|
+
console.error(
|
|
194
|
+
'DOORSTEPAI - Failed to start delivery by Plus Code:',
|
|
195
|
+
error
|
|
196
|
+
);
|
|
81
197
|
throw error;
|
|
82
198
|
}
|
|
83
199
|
}
|
|
@@ -86,16 +202,35 @@ class DoorstepAIModule {
|
|
|
86
202
|
address: AddressType,
|
|
87
203
|
deliveryId: string,
|
|
88
204
|
timeoutSeconds?: number,
|
|
89
|
-
coordinates?: LatLngObject
|
|
205
|
+
coordinates?: LatLngObject,
|
|
206
|
+
options?: StartDeliveryOptions
|
|
90
207
|
) {
|
|
91
208
|
try {
|
|
92
|
-
|
|
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:',
|
|
93
231
|
address,
|
|
94
|
-
deliveryId
|
|
95
|
-
coordinates ?? null,
|
|
96
|
-
timeoutSeconds ?? 7200
|
|
232
|
+
deliveryId
|
|
97
233
|
);
|
|
98
|
-
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
99
234
|
return result;
|
|
100
235
|
} catch (error: any) {
|
|
101
236
|
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
@@ -107,39 +242,76 @@ class DoorstepAIModule {
|
|
|
107
242
|
address: string,
|
|
108
243
|
deliveryId: string,
|
|
109
244
|
timeoutSeconds?: number,
|
|
110
|
-
coordinates?: LatLngObject
|
|
245
|
+
coordinates?: LatLngObject,
|
|
246
|
+
options?: StartDeliveryOptions
|
|
111
247
|
) {
|
|
112
248
|
try {
|
|
113
|
-
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:',
|
|
114
271
|
address,
|
|
115
|
-
deliveryId
|
|
116
|
-
coordinates ?? null,
|
|
117
|
-
timeoutSeconds ?? 7200
|
|
272
|
+
deliveryId
|
|
118
273
|
);
|
|
119
|
-
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
120
274
|
return result;
|
|
121
275
|
} catch (error: any) {
|
|
122
|
-
console.error(
|
|
276
|
+
console.error(
|
|
277
|
+
'DOORSTEPAI - Failed to start delivery by Address String:',
|
|
278
|
+
error
|
|
279
|
+
);
|
|
123
280
|
throw error;
|
|
124
281
|
}
|
|
125
282
|
}
|
|
126
283
|
|
|
127
|
-
|
|
284
|
+
/** @deprecated Use `startDeliveryByAddress` or `startDeliveryByAddressString` with coordinates instead. */
|
|
128
285
|
static async startDeliveryByLatLng(
|
|
129
286
|
latitude: number,
|
|
130
287
|
longitude: number,
|
|
131
288
|
subUnit: string,
|
|
132
289
|
deliveryId: string,
|
|
133
|
-
timeoutSeconds?: number
|
|
290
|
+
timeoutSeconds?: number,
|
|
291
|
+
options?: StartDeliveryOptions
|
|
134
292
|
) {
|
|
135
293
|
try {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
+
);
|
|
143
315
|
console.log(
|
|
144
316
|
'DOORSTEPAI - Delivery started successfully by LatLng:',
|
|
145
317
|
latitude,
|
|
@@ -157,14 +329,22 @@ class DoorstepAIModule {
|
|
|
157
329
|
static async markDropoff(deliveryId: string, dropoffType: 'pod' | 'non_pod') {
|
|
158
330
|
try {
|
|
159
331
|
await DoorstepAI.markDropoff(deliveryId, dropoffType);
|
|
160
|
-
console.log(
|
|
332
|
+
console.log(
|
|
333
|
+
'DOORSTEPAI - Dropoff marked successfully:',
|
|
334
|
+
deliveryId,
|
|
335
|
+
dropoffType
|
|
336
|
+
);
|
|
161
337
|
} catch (error: any) {
|
|
162
|
-
console.error(
|
|
338
|
+
console.error(
|
|
339
|
+
'DOORSTEPAI - Failed to mark dropoff:',
|
|
340
|
+
deliveryId,
|
|
341
|
+
dropoffType,
|
|
342
|
+
error
|
|
343
|
+
);
|
|
163
344
|
throw error;
|
|
164
345
|
}
|
|
165
346
|
}
|
|
166
347
|
|
|
167
|
-
// Add deliveryId parameter
|
|
168
348
|
static async stopDelivery(deliveryId: string) {
|
|
169
349
|
try {
|
|
170
350
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
@@ -175,19 +355,44 @@ class DoorstepAIModule {
|
|
|
175
355
|
}
|
|
176
356
|
}
|
|
177
357
|
|
|
178
|
-
// Add deliveryId parameter
|
|
179
358
|
static async newEvent(eventName: string, deliveryId: string) {
|
|
180
359
|
try {
|
|
181
360
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
182
361
|
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
183
362
|
return result;
|
|
184
363
|
} catch (error: any) {
|
|
185
|
-
console.error(
|
|
364
|
+
console.error(
|
|
365
|
+
'DOORSTEPAI - Failed to send event:',
|
|
366
|
+
eventName,
|
|
367
|
+
deliveryId,
|
|
368
|
+
error
|
|
369
|
+
);
|
|
186
370
|
throw error;
|
|
187
371
|
}
|
|
188
372
|
}
|
|
189
|
-
|
|
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
|
+
}
|
|
190
395
|
}
|
|
191
396
|
|
|
192
397
|
export { DoorstepAIModule as DoorstepAI };
|
|
193
|
-
export type { AddressType, LatLngObject };
|
|
398
|
+
export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
|
package/src/RootDoorstepAI.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { RootDoorstepAI } from './RootDoorstepAI';
|
|
2
2
|
import { DoorstepAI } from './DoorstepAI';
|
|
3
|
-
export type {
|
|
3
|
+
export type {
|
|
4
|
+
AddressType,
|
|
5
|
+
LatLngObject,
|
|
6
|
+
StartDeliveryOptions,
|
|
7
|
+
SDKLogLevel,
|
|
8
|
+
} from './DoorstepAI';
|
|
4
9
|
|
|
5
10
|
export { DoorstepAI, RootDoorstepAI };
|