@doorstepai/dropoff-sdk 1.0.32 → 2.0.1
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 +53 -9
- package/ios/DoorstepAI.mm +24 -14
- package/ios/DoorstepAI.swift +64 -5
- 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/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +1487 -138
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +54 -10
- 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 +54 -10
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
- 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 +1451 -816
- 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/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1487 -138
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +54 -10
- 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 +54 -10
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1487 -138
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +54 -10
- 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 +54 -10
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
- 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 +1451 -816
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1446 -815
- package/lib/module/DoorstepAI.js +32 -54
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +6 -5
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +70 -53
package/lib/module/DoorstepAI.js
CHANGED
|
@@ -6,33 +6,6 @@ const {
|
|
|
6
6
|
} = NativeModules;
|
|
7
7
|
class DoorstepAIModule {
|
|
8
8
|
static isInitialized = false;
|
|
9
|
-
static async enableDevMode(apiKey) {
|
|
10
|
-
if (apiKey) {
|
|
11
|
-
DoorstepAI.setApiKey(apiKey);
|
|
12
|
-
}
|
|
13
|
-
if (Platform.OS === 'android') {
|
|
14
|
-
try {
|
|
15
|
-
console.log('DOORSTEPAI - Enabling dev mode on Android');
|
|
16
|
-
const result = await DoorstepAI.enableDevMode();
|
|
17
|
-
console.log('DOORSTEPAI - Dev mode enabled on Android:', result);
|
|
18
|
-
return result;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error('DOORSTEPAI - Failed to enable dev mode on Android:', error);
|
|
21
|
-
throw error;
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
if (!apiKey) {
|
|
25
|
-
throw new Error('DOORSTEPAI - API key is required to enable dev mode on iOS');
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
await DoorstepAI.enableDevMode(apiKey);
|
|
29
|
-
console.log('DOORSTEPAI - Dev mode enabled on iOS');
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('DOORSTEPAI - Failed to enable dev mode on iOS:', error);
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
9
|
static async init(notificationTitle, notificationText) {
|
|
37
10
|
if (Platform.OS === 'android') {
|
|
38
11
|
if (this.isInitialized) {
|
|
@@ -53,9 +26,9 @@ class DoorstepAIModule {
|
|
|
53
26
|
}
|
|
54
27
|
|
|
55
28
|
// Add deliveryId parameter
|
|
56
|
-
static async startDeliveryByPlaceID(placeID, deliveryId) {
|
|
29
|
+
static async startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds) {
|
|
57
30
|
try {
|
|
58
|
-
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId);
|
|
31
|
+
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds ?? 7200);
|
|
59
32
|
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
60
33
|
return result; // Return result (e.g., session ID from Android)
|
|
61
34
|
} catch (error) {
|
|
@@ -65,9 +38,9 @@ class DoorstepAIModule {
|
|
|
65
38
|
}
|
|
66
39
|
|
|
67
40
|
// Add deliveryId parameter
|
|
68
|
-
static async startDeliveryByPlusCode(plusCode, deliveryId) {
|
|
41
|
+
static async startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds) {
|
|
69
42
|
try {
|
|
70
|
-
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId);
|
|
43
|
+
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds ?? 7200);
|
|
71
44
|
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
72
45
|
return result;
|
|
73
46
|
} catch (error) {
|
|
@@ -77,9 +50,9 @@ class DoorstepAIModule {
|
|
|
77
50
|
}
|
|
78
51
|
|
|
79
52
|
// Add deliveryId parameter and handle platform difference
|
|
80
|
-
static async startDeliveryByAddress(address, deliveryId) {
|
|
53
|
+
static async startDeliveryByAddress(address, deliveryId, timeoutSeconds) {
|
|
81
54
|
try {
|
|
82
|
-
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
55
|
+
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId, timeoutSeconds ?? 7200);
|
|
83
56
|
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
84
57
|
return result;
|
|
85
58
|
} catch (error) {
|
|
@@ -87,9 +60,9 @@ class DoorstepAIModule {
|
|
|
87
60
|
throw error;
|
|
88
61
|
}
|
|
89
62
|
}
|
|
90
|
-
static async startDeliveryByAddressString(address, deliveryId) {
|
|
63
|
+
static async startDeliveryByAddressString(address, deliveryId, timeoutSeconds) {
|
|
91
64
|
try {
|
|
92
|
-
const result = await DoorstepAI.startDeliveryByAddressString(address, deliveryId);
|
|
65
|
+
const result = await DoorstepAI.startDeliveryByAddressString(address, deliveryId, timeoutSeconds ?? 7200);
|
|
93
66
|
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
94
67
|
return result;
|
|
95
68
|
} catch (error) {
|
|
@@ -97,25 +70,30 @@ class DoorstepAIModule {
|
|
|
97
70
|
throw error;
|
|
98
71
|
}
|
|
99
72
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
73
|
+
static async startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds) {
|
|
74
|
+
try {
|
|
75
|
+
const result = await DoorstepAI.startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds ?? 7200);
|
|
76
|
+
console.log('DOORSTEPAI - Delivery started successfully by LatLng:', latitude, longitude, subUnit, deliveryId);
|
|
77
|
+
return result;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error('DOORSTEPAI - Failed to start delivery by LatLng:', error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
static async markDropoff(deliveryId, dropoffType) {
|
|
84
|
+
try {
|
|
85
|
+
if (Platform.OS === 'android') {
|
|
86
|
+
const androidDropoffType = dropoffType === 'pod' ? 'POD' : 'NON_POD';
|
|
87
|
+
await DoorstepAI.markDropoff(deliveryId, androidDropoffType);
|
|
88
|
+
} else {
|
|
89
|
+
await DoorstepAI.markDropoff(deliveryId, dropoffType);
|
|
90
|
+
}
|
|
91
|
+
console.log('DOORSTEPAI - Dropoff marked successfully:', deliveryId, dropoffType);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('DOORSTEPAI - Failed to mark dropoff:', deliveryId, dropoffType, error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
119
97
|
|
|
120
98
|
// Add deliveryId parameter
|
|
121
99
|
static async stopDelivery(deliveryId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","init","notificationTitle","notificationText","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","deliveryId","timeoutSeconds","result","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","startDeliveryByAddressString","startDeliveryByLatLng","latitude","longitude","subUnit","markDropoff","dropoffType","androidDropoffType","stopDelivery","newEvent","eventName"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,MA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,QAAQA,CAACC,SAAiB,EAAEjB,UAAkB,EAAE;IAC3D,IAAI;MACF,MAAME,MAAM,GAAG,MAAMhB,UAAU,CAAC8B,QAAQ,CAACC,SAAS,EAAEjB,UAAU,CAAC;MAC/DP,OAAO,CAACC,GAAG,CAAC,uCAAuC,EAAEQ,MAAM,CAAC;MAC5D,OAAOA,MAAM;IACf,CAAC,CAAC,OAAOP,KAAU,EAAE;MACnBF,OAAO,CAACE,KAAK,CAAC,oCAAoC,EAAEsB,SAAS,EAAEjB,UAAU,EAAEL,KAAK,CAAC;MACjF,MAAMA,KAAK;IACb;EACF;AAEF;AAEA,SAASR,gBAAgB,IAAID,UAAU","ignoreList":[]}
|
|
@@ -8,13 +8,14 @@ type AddressType = {
|
|
|
8
8
|
};
|
|
9
9
|
declare class DoorstepAIModule {
|
|
10
10
|
static isInitialized: boolean;
|
|
11
|
-
static enableDevMode(apiKey?: string): Promise<boolean | void>;
|
|
12
11
|
static init(notificationTitle?: string, notificationText?: string): Promise<void>;
|
|
13
12
|
static setApiKey(apiKey: string): void;
|
|
14
|
-
static startDeliveryByPlaceID(placeID: string, deliveryId: string): Promise<any>;
|
|
15
|
-
static startDeliveryByPlusCode(plusCode: string, deliveryId: string): Promise<any>;
|
|
16
|
-
static startDeliveryByAddress(address: AddressType, deliveryId: string): Promise<any>;
|
|
17
|
-
static startDeliveryByAddressString(address: string, deliveryId: string): Promise<any>;
|
|
13
|
+
static startDeliveryByPlaceID(placeID: string, deliveryId: string, timeoutSeconds?: number): Promise<any>;
|
|
14
|
+
static startDeliveryByPlusCode(plusCode: string, deliveryId: string, timeoutSeconds?: number): Promise<any>;
|
|
15
|
+
static startDeliveryByAddress(address: AddressType, deliveryId: string, timeoutSeconds?: number): Promise<any>;
|
|
16
|
+
static startDeliveryByAddressString(address: string, deliveryId: string, timeoutSeconds?: number): Promise<any>;
|
|
17
|
+
static startDeliveryByLatLng(latitude: number, longitude: number, subUnit: string, deliveryId: string, timeoutSeconds?: number): Promise<any>;
|
|
18
|
+
static markDropoff(deliveryId: string, dropoffType: 'pod' | 'non_pod'): Promise<void>;
|
|
18
19
|
static stopDelivery(deliveryId: string): Promise<void>;
|
|
19
20
|
static newEvent(eventName: string, deliveryId: string): Promise<any>;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,cAAM,gBAAgB;IACpB,MAAM,CAAC,aAAa,UAAS;
|
|
1
|
+
{"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,cAAM,gBAAgB;IACpB,MAAM,CAAC,aAAa,UAAS;WAGhB,IAAI,CACf,iBAAiB,CAAC,EAAE,MAAM,EAC1B,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;IAgBhB,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM;WAKlB,sBAAsB,CACjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM;WAiBZ,uBAAuB,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM;WAiBZ,sBAAsB,CACjC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM;WAgBZ,4BAA4B,CACvC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM;WAiBZ,qBAAqB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM;WAwBZ,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,GAAG,SAAS;WAgB9D,YAAY,CAAC,UAAU,EAAE,MAAM;WAW/B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAW5D;AAED,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/DoorstepAI.tsx
CHANGED
|
@@ -13,33 +13,6 @@ type AddressType = {
|
|
|
13
13
|
class DoorstepAIModule {
|
|
14
14
|
static isInitialized = false;
|
|
15
15
|
|
|
16
|
-
static async enableDevMode(apiKey?: string): Promise<boolean | void> {
|
|
17
|
-
if (apiKey) {
|
|
18
|
-
DoorstepAI.setApiKey(apiKey);
|
|
19
|
-
}
|
|
20
|
-
if (Platform.OS === 'android') {
|
|
21
|
-
try {
|
|
22
|
-
console.log('DOORSTEPAI - Enabling dev mode on Android');
|
|
23
|
-
const result = await DoorstepAI.enableDevMode();
|
|
24
|
-
console.log('DOORSTEPAI - Dev mode enabled on Android:', result);
|
|
25
|
-
return result;
|
|
26
|
-
} catch (error) {
|
|
27
|
-
console.error('DOORSTEPAI - Failed to enable dev mode on Android:', error);
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
} else {
|
|
31
|
-
if (!apiKey) {
|
|
32
|
-
throw new Error('DOORSTEPAI - API key is required to enable dev mode on iOS');
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
await DoorstepAI.enableDevMode(apiKey);
|
|
36
|
-
console.log('DOORSTEPAI - Dev mode enabled on iOS');
|
|
37
|
-
} catch (error) {
|
|
38
|
-
console.error('DOORSTEPAI - Failed to enable dev mode on iOS:', error);
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
16
|
|
|
44
17
|
static async init(
|
|
45
18
|
notificationTitle?: string,
|
|
@@ -65,11 +38,16 @@ class DoorstepAIModule {
|
|
|
65
38
|
}
|
|
66
39
|
|
|
67
40
|
// Add deliveryId parameter
|
|
68
|
-
static async startDeliveryByPlaceID(
|
|
41
|
+
static async startDeliveryByPlaceID(
|
|
42
|
+
placeID: string,
|
|
43
|
+
deliveryId: string,
|
|
44
|
+
timeoutSeconds?: number
|
|
45
|
+
) {
|
|
69
46
|
try {
|
|
70
47
|
const result = await DoorstepAI.startDeliveryByPlaceID(
|
|
71
48
|
placeID,
|
|
72
|
-
deliveryId
|
|
49
|
+
deliveryId,
|
|
50
|
+
timeoutSeconds ?? 7200
|
|
73
51
|
);
|
|
74
52
|
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
75
53
|
return result; // Return result (e.g., session ID from Android)
|
|
@@ -80,11 +58,16 @@ class DoorstepAIModule {
|
|
|
80
58
|
}
|
|
81
59
|
|
|
82
60
|
// Add deliveryId parameter
|
|
83
|
-
static async startDeliveryByPlusCode(
|
|
61
|
+
static async startDeliveryByPlusCode(
|
|
62
|
+
plusCode: string,
|
|
63
|
+
deliveryId: string,
|
|
64
|
+
timeoutSeconds?: number
|
|
65
|
+
) {
|
|
84
66
|
try {
|
|
85
67
|
const result = await DoorstepAI.startDeliveryByPlusCode(
|
|
86
68
|
plusCode,
|
|
87
|
-
deliveryId
|
|
69
|
+
deliveryId,
|
|
70
|
+
timeoutSeconds ?? 7200
|
|
88
71
|
);
|
|
89
72
|
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
90
73
|
return result;
|
|
@@ -97,10 +80,15 @@ class DoorstepAIModule {
|
|
|
97
80
|
// Add deliveryId parameter and handle platform difference
|
|
98
81
|
static async startDeliveryByAddress(
|
|
99
82
|
address: AddressType,
|
|
100
|
-
deliveryId: string
|
|
83
|
+
deliveryId: string,
|
|
84
|
+
timeoutSeconds?: number
|
|
101
85
|
) {
|
|
102
86
|
try {
|
|
103
|
-
let result = await DoorstepAI.startDeliveryByAddress(
|
|
87
|
+
let result = await DoorstepAI.startDeliveryByAddress(
|
|
88
|
+
address,
|
|
89
|
+
deliveryId,
|
|
90
|
+
timeoutSeconds ?? 7200
|
|
91
|
+
);
|
|
104
92
|
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
105
93
|
return result;
|
|
106
94
|
} catch (error: any) {
|
|
@@ -111,12 +99,14 @@ class DoorstepAIModule {
|
|
|
111
99
|
|
|
112
100
|
static async startDeliveryByAddressString(
|
|
113
101
|
address: string,
|
|
114
|
-
deliveryId: string
|
|
102
|
+
deliveryId: string,
|
|
103
|
+
timeoutSeconds?: number
|
|
115
104
|
) {
|
|
116
105
|
try {
|
|
117
106
|
const result = await DoorstepAI.startDeliveryByAddressString(
|
|
118
107
|
address,
|
|
119
|
-
deliveryId
|
|
108
|
+
deliveryId,
|
|
109
|
+
timeoutSeconds ?? 7200
|
|
120
110
|
);
|
|
121
111
|
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
122
112
|
return result;
|
|
@@ -126,24 +116,50 @@ class DoorstepAIModule {
|
|
|
126
116
|
}
|
|
127
117
|
}
|
|
128
118
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
119
|
+
|
|
120
|
+
static async startDeliveryByLatLng(
|
|
121
|
+
latitude: number,
|
|
122
|
+
longitude: number,
|
|
123
|
+
subUnit: string,
|
|
124
|
+
deliveryId: string,
|
|
125
|
+
timeoutSeconds?: number
|
|
126
|
+
) {
|
|
127
|
+
try {
|
|
128
|
+
const result = await DoorstepAI.startDeliveryByLatLng(
|
|
129
|
+
latitude,
|
|
130
|
+
longitude,
|
|
131
|
+
subUnit,
|
|
132
|
+
deliveryId,
|
|
133
|
+
timeoutSeconds ?? 7200
|
|
134
|
+
);
|
|
135
|
+
console.log(
|
|
136
|
+
'DOORSTEPAI - Delivery started successfully by LatLng:',
|
|
137
|
+
latitude,
|
|
138
|
+
longitude,
|
|
139
|
+
subUnit,
|
|
140
|
+
deliveryId
|
|
141
|
+
);
|
|
142
|
+
return result;
|
|
143
|
+
} catch (error: any) {
|
|
144
|
+
console.error('DOORSTEPAI - Failed to start delivery by LatLng:', error);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static async markDropoff(deliveryId: string, dropoffType: 'pod' | 'non_pod') {
|
|
150
|
+
try {
|
|
151
|
+
if (Platform.OS === 'android') {
|
|
152
|
+
const androidDropoffType = dropoffType === 'pod' ? 'POD' : 'NON_POD';
|
|
153
|
+
await DoorstepAI.markDropoff(deliveryId, androidDropoffType);
|
|
154
|
+
} else {
|
|
155
|
+
await DoorstepAI.markDropoff(deliveryId, dropoffType);
|
|
156
|
+
}
|
|
157
|
+
console.log('DOORSTEPAI - Dropoff marked successfully:', deliveryId, dropoffType);
|
|
158
|
+
} catch (error: any) {
|
|
159
|
+
console.error('DOORSTEPAI - Failed to mark dropoff:', deliveryId, dropoffType, error);
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
147
163
|
|
|
148
164
|
// Add deliveryId parameter
|
|
149
165
|
static async stopDelivery(deliveryId: string) {
|
|
@@ -167,6 +183,7 @@ class DoorstepAIModule {
|
|
|
167
183
|
throw error;
|
|
168
184
|
}
|
|
169
185
|
}
|
|
186
|
+
|
|
170
187
|
}
|
|
171
188
|
|
|
172
189
|
export { DoorstepAIModule as DoorstepAI };
|