@doorstepai/dropoff-sdk 1.0.31 → 1.0.32
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 +2 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +107 -3
- package/ios/DoorstepAI.mm +16 -1
- package/ios/DoorstepAI.swift +53 -2
- 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 +306 -12
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +8 -8
- 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 +816 -791
- 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 +306 -12
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +306 -12
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +12 -2
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +16 -16
- 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 +816 -791
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +815 -793
- package/lib/module/DoorstepAI.js +64 -16
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +2 -1
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +71 -16
package/lib/module/DoorstepAI.js
CHANGED
|
@@ -6,12 +6,31 @@ const {
|
|
|
6
6
|
} = NativeModules;
|
|
7
7
|
class DoorstepAIModule {
|
|
8
8
|
static isInitialized = false;
|
|
9
|
-
static enableDevMode() {
|
|
9
|
+
static async enableDevMode(apiKey) {
|
|
10
|
+
if (apiKey) {
|
|
11
|
+
DoorstepAI.setApiKey(apiKey);
|
|
12
|
+
}
|
|
10
13
|
if (Platform.OS === 'android') {
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
}
|
|
13
23
|
} else {
|
|
14
|
-
|
|
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
|
+
}
|
|
15
34
|
}
|
|
16
35
|
}
|
|
17
36
|
static async init(notificationTitle, notificationText) {
|
|
@@ -21,10 +40,10 @@ class DoorstepAIModule {
|
|
|
21
40
|
}
|
|
22
41
|
try {
|
|
23
42
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
24
|
-
console.log('DoorstepAI initialized');
|
|
43
|
+
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
25
44
|
this.isInitialized = true; // Mark as initialized on success
|
|
26
45
|
} catch (error) {
|
|
27
|
-
console.error('Failed to initialize DoorstepAI:', error);
|
|
46
|
+
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
28
47
|
throw error;
|
|
29
48
|
}
|
|
30
49
|
} // iOS does not require explicit init in the bridge
|
|
@@ -37,10 +56,10 @@ class DoorstepAIModule {
|
|
|
37
56
|
static async startDeliveryByPlaceID(placeID, deliveryId) {
|
|
38
57
|
try {
|
|
39
58
|
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId);
|
|
40
|
-
console.log('Delivery started successfully by Place ID:',
|
|
59
|
+
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
41
60
|
return result; // Return result (e.g., session ID from Android)
|
|
42
61
|
} catch (error) {
|
|
43
|
-
console.error('Failed to start delivery by Place ID:', error);
|
|
62
|
+
console.error('DOORSTEPAI - Failed to start delivery by Place ID:', error);
|
|
44
63
|
throw error; // Re-throw error for caller handling
|
|
45
64
|
}
|
|
46
65
|
}
|
|
@@ -49,10 +68,10 @@ class DoorstepAIModule {
|
|
|
49
68
|
static async startDeliveryByPlusCode(plusCode, deliveryId) {
|
|
50
69
|
try {
|
|
51
70
|
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId);
|
|
52
|
-
console.log('Delivery started successfully by Plus Code:',
|
|
71
|
+
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
53
72
|
return result;
|
|
54
73
|
} catch (error) {
|
|
55
|
-
console.error('Failed to start delivery by Plus Code:', error);
|
|
74
|
+
console.error('DOORSTEPAI - Failed to start delivery by Plus Code:', error);
|
|
56
75
|
throw error;
|
|
57
76
|
}
|
|
58
77
|
}
|
|
@@ -61,21 +80,50 @@ class DoorstepAIModule {
|
|
|
61
80
|
static async startDeliveryByAddress(address, deliveryId) {
|
|
62
81
|
try {
|
|
63
82
|
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
64
|
-
console.log('Delivery started successfully by Address:',
|
|
83
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
84
|
+
return result;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
static async startDeliveryByAddressString(address, deliveryId) {
|
|
91
|
+
try {
|
|
92
|
+
const result = await DoorstepAI.startDeliveryByAddressString(address, deliveryId);
|
|
93
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
65
94
|
return result;
|
|
66
95
|
} catch (error) {
|
|
67
|
-
console.error('Failed to start delivery by Address:', error);
|
|
96
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address String:', error);
|
|
68
97
|
throw error;
|
|
69
98
|
}
|
|
70
99
|
}
|
|
71
100
|
|
|
101
|
+
// static async startDeliveryByLatLng(
|
|
102
|
+
// latitude: number,
|
|
103
|
+
// longitude: number,
|
|
104
|
+
// deliveryId: string
|
|
105
|
+
// ) {
|
|
106
|
+
// try {
|
|
107
|
+
// const result = await DoorstepAI.startDeliveryByLatLng(
|
|
108
|
+
// latitude,
|
|
109
|
+
// longitude,
|
|
110
|
+
// deliveryId
|
|
111
|
+
// );
|
|
112
|
+
// console.log('DOORSTEPAI - Delivery started successfully by LatLng:', latitude, longitude, deliveryId);
|
|
113
|
+
// return result;
|
|
114
|
+
// } catch (error: any) {
|
|
115
|
+
// console.error('DOORSTEPAI - Failed to start delivery by LatLng:', error);
|
|
116
|
+
// throw error;
|
|
117
|
+
// }
|
|
118
|
+
// }
|
|
119
|
+
|
|
72
120
|
// Add deliveryId parameter
|
|
73
121
|
static async stopDelivery(deliveryId) {
|
|
74
122
|
try {
|
|
75
123
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
76
|
-
console.log('Delivery stopped successfully');
|
|
124
|
+
console.log('DOORSTEPAI - Delivery stopped successfully');
|
|
77
125
|
} catch (error) {
|
|
78
|
-
console.error('Failed to stop delivery:', error);
|
|
126
|
+
console.error('DOORSTEPAI - Failed to stop delivery:', error);
|
|
79
127
|
throw error;
|
|
80
128
|
}
|
|
81
129
|
}
|
|
@@ -84,10 +132,10 @@ class DoorstepAIModule {
|
|
|
84
132
|
static async newEvent(eventName, deliveryId) {
|
|
85
133
|
try {
|
|
86
134
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
87
|
-
console.log('Event sent successfully:', result);
|
|
135
|
+
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
88
136
|
return result;
|
|
89
137
|
} catch (error) {
|
|
90
|
-
console.error('Failed to send event:', error);
|
|
138
|
+
console.error('DOORSTEPAI - Failed to send event:', eventName, deliveryId, error);
|
|
91
139
|
throw error;
|
|
92
140
|
}
|
|
93
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","enableDevMode","OS","console","log","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","enableDevMode","apiKey","setApiKey","OS","console","log","result","error","Error","init","notificationTitle","notificationText","startDeliveryByPlaceID","placeID","deliveryId","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","startDeliveryByAddressString","stopDelivery","newEvent","eventName"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AAWpC,MAAMG,gBAAgB,CAAC;EACrB,OAAOC,aAAa,GAAG,KAAK;EAE5B,aAAaC,aAAaA,CAACC,MAAe,EAA2B;IACnE,IAAIA,MAAM,EAAE;MACVJ,UAAU,CAACK,SAAS,CAACD,MAAM,CAAC;IAC9B;IACA,IAAIL,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAI;QACFC,OAAO,CAACC,GAAG,CAAC,2CAA2C,CAAC;QACxD,MAAMC,MAAM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AG,CAAC,+DAA+D,EAAEa,OAAO,EAAEJ,UAAU,CAAC;MACjG,OAAOR,MAAM;IACf,CAAC,CAAC,OAAOC,KAAU,EAAE;MACnBH,OAAO,CAACG,KAAK,CAAC,0DAA0D,EAAEA,KAAK,CAAC;MAChF,MAAMA,KAAK;IACb;EACF;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA,aAAaa,YAAYA,CAACN,UAAkB,EAAE;IAC5C,IAAI;MACF,MAAMjB,UAAU,CAACuB,YAAY,CAACN,UAAU,CAAC;MACzCV,OAAO,CAACC,GAAG,CAAC,4CAA4C,CAAC;IAC3D,CAAC,CAAC,OAAOE,KAAU,EAAE;MACnBH,OAAO,CAACG,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;MAC7D,MAAMA,KAAK;IACb;EACF;;EAEA;EACA,aAAac,QAAQA,CAACC,SAAiB,EAAER,UAAkB,EAAE;IAC3D,IAAI;MACF,MAAMR,MAAM,GAAG,MAAMT,UAAU,CAACwB,QAAQ,CAACC,SAAS,EAAER,UAAU,CAAC;MAC/DV,OAAO,CAACC,GAAG,CAAC,uCAAuC,EAAEC,MAAM,CAAC;MAC5D,OAAOA,MAAM;IACf,CAAC,CAAC,OAAOC,KAAU,EAAE;MACnBH,OAAO,CAACG,KAAK,CAAC,oCAAoC,EAAEe,SAAS,EAAER,UAAU,EAAEP,KAAK,CAAC;MACjF,MAAMA,KAAK;IACb;EACF;AACF;AAEA,SAAST,gBAAgB,IAAID,UAAU","ignoreList":[]}
|
|
@@ -8,12 +8,13 @@ type AddressType = {
|
|
|
8
8
|
};
|
|
9
9
|
declare class DoorstepAIModule {
|
|
10
10
|
static isInitialized: boolean;
|
|
11
|
-
static enableDevMode(): void
|
|
11
|
+
static enableDevMode(apiKey?: string): Promise<boolean | void>;
|
|
12
12
|
static init(notificationTitle?: string, notificationText?: string): Promise<void>;
|
|
13
13
|
static setApiKey(apiKey: string): void;
|
|
14
14
|
static startDeliveryByPlaceID(placeID: string, deliveryId: string): Promise<any>;
|
|
15
15
|
static startDeliveryByPlusCode(plusCode: string, deliveryId: string): Promise<any>;
|
|
16
16
|
static startDeliveryByAddress(address: AddressType, deliveryId: string): Promise<any>;
|
|
17
|
+
static startDeliveryByAddressString(address: string, deliveryId: string): Promise<any>;
|
|
17
18
|
static stopDelivery(deliveryId: string): Promise<void>;
|
|
18
19
|
static newEvent(eventName: string, deliveryId: string): Promise<any>;
|
|
19
20
|
}
|
|
@@ -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;WAEhB,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;WA4BvD,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,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;WAe1D,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;WAe5D,sBAAsB,CACjC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM;WAYP,4BAA4B,CACvC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM;WAmCP,YAAY,CAAC,UAAU,EAAE,MAAM;WAW/B,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAU5D;AAED,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/DoorstepAI.tsx
CHANGED
|
@@ -13,12 +13,31 @@ type AddressType = {
|
|
|
13
13
|
class DoorstepAIModule {
|
|
14
14
|
static isInitialized = false;
|
|
15
15
|
|
|
16
|
-
static enableDevMode() {
|
|
16
|
+
static async enableDevMode(apiKey?: string): Promise<boolean | void> {
|
|
17
|
+
if (apiKey) {
|
|
18
|
+
DoorstepAI.setApiKey(apiKey);
|
|
19
|
+
}
|
|
17
20
|
if (Platform.OS === 'android') {
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
20
30
|
} else {
|
|
21
|
-
|
|
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
|
+
}
|
|
22
41
|
}
|
|
23
42
|
}
|
|
24
43
|
|
|
@@ -32,10 +51,10 @@ class DoorstepAIModule {
|
|
|
32
51
|
}
|
|
33
52
|
try {
|
|
34
53
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
35
|
-
console.log('DoorstepAI initialized');
|
|
54
|
+
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
36
55
|
this.isInitialized = true; // Mark as initialized on success
|
|
37
56
|
} catch (error) {
|
|
38
|
-
console.error('Failed to initialize DoorstepAI:', error);
|
|
57
|
+
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
39
58
|
throw error;
|
|
40
59
|
}
|
|
41
60
|
} // iOS does not require explicit init in the bridge
|
|
@@ -52,10 +71,10 @@ class DoorstepAIModule {
|
|
|
52
71
|
placeID,
|
|
53
72
|
deliveryId
|
|
54
73
|
);
|
|
55
|
-
console.log('Delivery started successfully by Place ID:',
|
|
74
|
+
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
56
75
|
return result; // Return result (e.g., session ID from Android)
|
|
57
76
|
} catch (error: any) {
|
|
58
|
-
console.error('Failed to start delivery by Place ID:', error);
|
|
77
|
+
console.error('DOORSTEPAI - Failed to start delivery by Place ID:', error);
|
|
59
78
|
throw error; // Re-throw error for caller handling
|
|
60
79
|
}
|
|
61
80
|
}
|
|
@@ -67,10 +86,10 @@ class DoorstepAIModule {
|
|
|
67
86
|
plusCode,
|
|
68
87
|
deliveryId
|
|
69
88
|
);
|
|
70
|
-
console.log('Delivery started successfully by Plus Code:',
|
|
89
|
+
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
71
90
|
return result;
|
|
72
91
|
} catch (error: any) {
|
|
73
|
-
console.error('Failed to start delivery by Plus Code:', error);
|
|
92
|
+
console.error('DOORSTEPAI - Failed to start delivery by Plus Code:', error);
|
|
74
93
|
throw error;
|
|
75
94
|
}
|
|
76
95
|
}
|
|
@@ -82,21 +101,57 @@ class DoorstepAIModule {
|
|
|
82
101
|
) {
|
|
83
102
|
try {
|
|
84
103
|
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
85
|
-
console.log('Delivery started successfully by Address:',
|
|
104
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
105
|
+
return result;
|
|
106
|
+
} catch (error: any) {
|
|
107
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static async startDeliveryByAddressString(
|
|
113
|
+
address: string,
|
|
114
|
+
deliveryId: string
|
|
115
|
+
) {
|
|
116
|
+
try {
|
|
117
|
+
const result = await DoorstepAI.startDeliveryByAddressString(
|
|
118
|
+
address,
|
|
119
|
+
deliveryId
|
|
120
|
+
);
|
|
121
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
86
122
|
return result;
|
|
87
123
|
} catch (error: any) {
|
|
88
|
-
console.error('Failed to start delivery by Address:', error);
|
|
124
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address String:', error);
|
|
89
125
|
throw error;
|
|
90
126
|
}
|
|
91
127
|
}
|
|
92
128
|
|
|
129
|
+
// static async startDeliveryByLatLng(
|
|
130
|
+
// latitude: number,
|
|
131
|
+
// longitude: number,
|
|
132
|
+
// deliveryId: string
|
|
133
|
+
// ) {
|
|
134
|
+
// try {
|
|
135
|
+
// const result = await DoorstepAI.startDeliveryByLatLng(
|
|
136
|
+
// latitude,
|
|
137
|
+
// longitude,
|
|
138
|
+
// deliveryId
|
|
139
|
+
// );
|
|
140
|
+
// console.log('DOORSTEPAI - Delivery started successfully by LatLng:', latitude, longitude, deliveryId);
|
|
141
|
+
// return result;
|
|
142
|
+
// } catch (error: any) {
|
|
143
|
+
// console.error('DOORSTEPAI - Failed to start delivery by LatLng:', error);
|
|
144
|
+
// throw error;
|
|
145
|
+
// }
|
|
146
|
+
// }
|
|
147
|
+
|
|
93
148
|
// Add deliveryId parameter
|
|
94
149
|
static async stopDelivery(deliveryId: string) {
|
|
95
150
|
try {
|
|
96
151
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
97
|
-
console.log('Delivery stopped successfully');
|
|
152
|
+
console.log('DOORSTEPAI - Delivery stopped successfully');
|
|
98
153
|
} catch (error: any) {
|
|
99
|
-
console.error('Failed to stop delivery:', error);
|
|
154
|
+
console.error('DOORSTEPAI - Failed to stop delivery:', error);
|
|
100
155
|
throw error;
|
|
101
156
|
}
|
|
102
157
|
}
|
|
@@ -105,10 +160,10 @@ class DoorstepAIModule {
|
|
|
105
160
|
static async newEvent(eventName: string, deliveryId: string) {
|
|
106
161
|
try {
|
|
107
162
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
108
|
-
console.log('Event sent successfully:', result);
|
|
163
|
+
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
109
164
|
return result;
|
|
110
165
|
} catch (error: any) {
|
|
111
|
-
console.error('Failed to send event:', error);
|
|
166
|
+
console.error('DOORSTEPAI - Failed to send event:', eventName, deliveryId, error);
|
|
112
167
|
throw error;
|
|
113
168
|
}
|
|
114
169
|
}
|