@doorstepai/dropoff-sdk 1.0.31 → 2.0.0
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 +156 -8
- package/ios/DoorstepAI.mm +26 -1
- package/ios/DoorstepAI.swift +115 -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 +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +62 -8
- 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 +62 -8
- 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 -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/Info.plist +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +62 -8
- 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 +62 -8
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1907 -264
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +62 -8
- 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 +62 -8
- 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 -791
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1446 -793
- package/lib/module/DoorstepAI.js +52 -26
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +6 -4
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +98 -26
package/lib/module/DoorstepAI.js
CHANGED
|
@@ -6,14 +6,6 @@ const {
|
|
|
6
6
|
} = NativeModules;
|
|
7
7
|
class DoorstepAIModule {
|
|
8
8
|
static isInitialized = false;
|
|
9
|
-
static enableDevMode() {
|
|
10
|
-
if (Platform.OS === 'android') {
|
|
11
|
-
console.log('Enabling dev mode on Android');
|
|
12
|
-
DoorstepAI.enableDevMode();
|
|
13
|
-
} else {
|
|
14
|
-
DoorstepAI.setDevMode(true);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
9
|
static async init(notificationTitle, notificationText) {
|
|
18
10
|
if (Platform.OS === 'android') {
|
|
19
11
|
if (this.isInitialized) {
|
|
@@ -21,10 +13,10 @@ class DoorstepAIModule {
|
|
|
21
13
|
}
|
|
22
14
|
try {
|
|
23
15
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
24
|
-
console.log('DoorstepAI initialized');
|
|
16
|
+
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
25
17
|
this.isInitialized = true; // Mark as initialized on success
|
|
26
18
|
} catch (error) {
|
|
27
|
-
console.error('Failed to initialize DoorstepAI:', error);
|
|
19
|
+
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
28
20
|
throw error;
|
|
29
21
|
}
|
|
30
22
|
} // iOS does not require explicit init in the bridge
|
|
@@ -34,37 +26,71 @@ class DoorstepAIModule {
|
|
|
34
26
|
}
|
|
35
27
|
|
|
36
28
|
// Add deliveryId parameter
|
|
37
|
-
static async startDeliveryByPlaceID(placeID, deliveryId) {
|
|
29
|
+
static async startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds) {
|
|
38
30
|
try {
|
|
39
|
-
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId);
|
|
40
|
-
console.log('Delivery started successfully by Place ID:',
|
|
31
|
+
const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds);
|
|
32
|
+
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
41
33
|
return result; // Return result (e.g., session ID from Android)
|
|
42
34
|
} catch (error) {
|
|
43
|
-
console.error('Failed to start delivery by Place ID:', error);
|
|
35
|
+
console.error('DOORSTEPAI - Failed to start delivery by Place ID:', error);
|
|
44
36
|
throw error; // Re-throw error for caller handling
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
// Add deliveryId parameter
|
|
49
|
-
static async startDeliveryByPlusCode(plusCode, deliveryId) {
|
|
41
|
+
static async startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds) {
|
|
50
42
|
try {
|
|
51
|
-
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId);
|
|
52
|
-
console.log('Delivery started successfully by Plus Code:',
|
|
43
|
+
const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds);
|
|
44
|
+
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
53
45
|
return result;
|
|
54
46
|
} catch (error) {
|
|
55
|
-
console.error('Failed to start delivery by Plus Code:', error);
|
|
47
|
+
console.error('DOORSTEPAI - Failed to start delivery by Plus Code:', error);
|
|
56
48
|
throw error;
|
|
57
49
|
}
|
|
58
50
|
}
|
|
59
51
|
|
|
60
52
|
// Add deliveryId parameter and handle platform difference
|
|
61
|
-
static async startDeliveryByAddress(address, deliveryId) {
|
|
53
|
+
static async startDeliveryByAddress(address, deliveryId, timeoutSeconds) {
|
|
62
54
|
try {
|
|
63
|
-
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
|
|
64
|
-
console.log('Delivery started successfully by Address:',
|
|
55
|
+
let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId, timeoutSeconds);
|
|
56
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
65
57
|
return result;
|
|
66
58
|
} catch (error) {
|
|
67
|
-
console.error('Failed to start delivery by Address:', error);
|
|
59
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
static async startDeliveryByAddressString(address, deliveryId, timeoutSeconds) {
|
|
64
|
+
try {
|
|
65
|
+
const result = await DoorstepAI.startDeliveryByAddressString(address, deliveryId, timeoutSeconds);
|
|
66
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
67
|
+
return result;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address String:', error);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
static async startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds) {
|
|
74
|
+
try {
|
|
75
|
+
const result = await DoorstepAI.startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds);
|
|
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);
|
|
68
94
|
throw error;
|
|
69
95
|
}
|
|
70
96
|
}
|
|
@@ -73,9 +99,9 @@ class DoorstepAIModule {
|
|
|
73
99
|
static async stopDelivery(deliveryId) {
|
|
74
100
|
try {
|
|
75
101
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
76
|
-
console.log('Delivery stopped successfully');
|
|
102
|
+
console.log('DOORSTEPAI - Delivery stopped successfully');
|
|
77
103
|
} catch (error) {
|
|
78
|
-
console.error('Failed to stop delivery:', error);
|
|
104
|
+
console.error('DOORSTEPAI - Failed to stop delivery:', error);
|
|
79
105
|
throw error;
|
|
80
106
|
}
|
|
81
107
|
}
|
|
@@ -84,10 +110,10 @@ class DoorstepAIModule {
|
|
|
84
110
|
static async newEvent(eventName, deliveryId) {
|
|
85
111
|
try {
|
|
86
112
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
87
|
-
console.log('Event sent successfully:', result);
|
|
113
|
+
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
88
114
|
return result;
|
|
89
115
|
} catch (error) {
|
|
90
|
-
console.error('Failed to send event:', error);
|
|
116
|
+
console.error('DOORSTEPAI - Failed to send event:', eventName, deliveryId, error);
|
|
91
117
|
throw error;
|
|
92
118
|
}
|
|
93
119
|
}
|
|
@@ -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,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AAWpC,MAAMG,gBAAgB,CAAC;EACrB,OAAOC,aAAa,GAAG,KAAK;EAG5B,aAAaC,IAAIA,CACfC,iBAA0B,EAC1BC,gBAAyB,EACV;IACf,IAAIN,QAAQ,CAACO,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAI,IAAI,CAACJ,aAAa,EAAE;QACtB;MACF;MACA,IAAI;QACF,MAAMF,UAAU,CAACG,IAAI,CAACC,iBAAiB,EAAEC,gBAAgB,CAAC;QAC1DE,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;QAClD,IAAI,CAACN,aAAa,GAAG,IAAI,CAAC,CAAC;MAC7B,CAAC,CAAC,OAAOO,KAAK,EAAE;QACdF,OAAO,CAACE,KAAK,CAAC,+CAA+C,EAAEA,KAAK,CAAC;QACrE,MAAMA,KAAK;MACb;IACF,CAAC,CAAC;EACJ;EAEA,OAAOC,SAASA,CAACC,MAAc,EAAE;IAC/BX,UAAU,CAACU,SAAS,CAACC,MAAM,CAAC;EAC9B;;EAEA;EACA,aAAaC,sBAAsBA,CACjCC,OAAe,EACfC,UAAkB,EAClBC,cAAuB,EACvB;I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B,KAAU,EAAE;MACnBF,OAAO,CAACE,KAAK,CAAC,sCAAsC,EAAEK,UAAU,EAAEa,WAAW,EAAElB,KAAK,CAAC;MACrF,MAAMA,KAAK;IACb;EACF;;EAEA;EACA,aAAaoB,YAAYA,CAACf,UAAkB,EAAE;IAC5C,IAAI;MACF,MAAMd,UAAU,CAAC6B,YAAY,CAACf,UAAU,CAAC;MACzCP,OAAO,CAACC,GAAG,CAAC,4CAA4C,CAAC;IAC3D,CAAC,CAAC,OAAOC,KAAU,EAAE;MACnBF,OAAO,CAACE,KAAK,CAAC,uCAAuC,EAAEA,KAAK,CAAC;MAC7D,MAAMA,KAAK;IACb;EACF;;EAEA;EACA,aAAaqB,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,12 +8,14 @@ type AddressType = {
|
|
|
8
8
|
};
|
|
9
9
|
declare class DoorstepAIModule {
|
|
10
10
|
static isInitialized: boolean;
|
|
11
|
-
static enableDevMode(): 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>;
|
|
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>;
|
|
17
19
|
static stopDelivery(deliveryId: string): Promise<void>;
|
|
18
20
|
static newEvent(eventName: string, deliveryId: string): Promise<any>;
|
|
19
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,14 +13,6 @@ type AddressType = {
|
|
|
13
13
|
class DoorstepAIModule {
|
|
14
14
|
static isInitialized = false;
|
|
15
15
|
|
|
16
|
-
static enableDevMode() {
|
|
17
|
-
if (Platform.OS === 'android') {
|
|
18
|
-
console.log('Enabling dev mode on Android');
|
|
19
|
-
DoorstepAI.enableDevMode();
|
|
20
|
-
} else {
|
|
21
|
-
DoorstepAI.setDevMode(true);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
16
|
|
|
25
17
|
static async init(
|
|
26
18
|
notificationTitle?: string,
|
|
@@ -32,10 +24,10 @@ class DoorstepAIModule {
|
|
|
32
24
|
}
|
|
33
25
|
try {
|
|
34
26
|
await DoorstepAI.init(notificationTitle, notificationText);
|
|
35
|
-
console.log('DoorstepAI initialized');
|
|
27
|
+
console.log('DOORSTEPAI - DoorstepAI initialized');
|
|
36
28
|
this.isInitialized = true; // Mark as initialized on success
|
|
37
29
|
} catch (error) {
|
|
38
|
-
console.error('Failed to initialize DoorstepAI:', error);
|
|
30
|
+
console.error('DOORSTEPAI - Failed to initialize DoorstepAI:', error);
|
|
39
31
|
throw error;
|
|
40
32
|
}
|
|
41
33
|
} // iOS does not require explicit init in the bridge
|
|
@@ -46,31 +38,41 @@ class DoorstepAIModule {
|
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
// Add deliveryId parameter
|
|
49
|
-
static async startDeliveryByPlaceID(
|
|
41
|
+
static async startDeliveryByPlaceID(
|
|
42
|
+
placeID: string,
|
|
43
|
+
deliveryId: string,
|
|
44
|
+
timeoutSeconds?: number
|
|
45
|
+
) {
|
|
50
46
|
try {
|
|
51
47
|
const result = await DoorstepAI.startDeliveryByPlaceID(
|
|
52
48
|
placeID,
|
|
53
|
-
deliveryId
|
|
49
|
+
deliveryId,
|
|
50
|
+
timeoutSeconds
|
|
54
51
|
);
|
|
55
|
-
console.log('Delivery started successfully by Place ID:',
|
|
52
|
+
console.log('DOORSTEPAI - Delivery started successfully by Place ID:', placeID, deliveryId);
|
|
56
53
|
return result; // Return result (e.g., session ID from Android)
|
|
57
54
|
} catch (error: any) {
|
|
58
|
-
console.error('Failed to start delivery by Place ID:', error);
|
|
55
|
+
console.error('DOORSTEPAI - Failed to start delivery by Place ID:', error);
|
|
59
56
|
throw error; // Re-throw error for caller handling
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
// Add deliveryId parameter
|
|
64
|
-
static async startDeliveryByPlusCode(
|
|
61
|
+
static async startDeliveryByPlusCode(
|
|
62
|
+
plusCode: string,
|
|
63
|
+
deliveryId: string,
|
|
64
|
+
timeoutSeconds?: number
|
|
65
|
+
) {
|
|
65
66
|
try {
|
|
66
67
|
const result = await DoorstepAI.startDeliveryByPlusCode(
|
|
67
68
|
plusCode,
|
|
68
|
-
deliveryId
|
|
69
|
+
deliveryId,
|
|
70
|
+
timeoutSeconds
|
|
69
71
|
);
|
|
70
|
-
console.log('Delivery started successfully by Plus Code:',
|
|
72
|
+
console.log('DOORSTEPAI - Delivery started successfully by Plus Code:', plusCode, deliveryId);
|
|
71
73
|
return result;
|
|
72
74
|
} catch (error: any) {
|
|
73
|
-
console.error('Failed to start delivery by Plus Code:', error);
|
|
75
|
+
console.error('DOORSTEPAI - Failed to start delivery by Plus Code:', error);
|
|
74
76
|
throw error;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
@@ -78,14 +80,83 @@ class DoorstepAIModule {
|
|
|
78
80
|
// Add deliveryId parameter and handle platform difference
|
|
79
81
|
static async startDeliveryByAddress(
|
|
80
82
|
address: AddressType,
|
|
81
|
-
deliveryId: string
|
|
83
|
+
deliveryId: string,
|
|
84
|
+
timeoutSeconds?: number
|
|
85
|
+
) {
|
|
86
|
+
try {
|
|
87
|
+
let result = await DoorstepAI.startDeliveryByAddress(
|
|
88
|
+
address,
|
|
89
|
+
deliveryId,
|
|
90
|
+
timeoutSeconds
|
|
91
|
+
);
|
|
92
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address:', address, deliveryId);
|
|
93
|
+
return result;
|
|
94
|
+
} catch (error: any) {
|
|
95
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address:', error);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static async startDeliveryByAddressString(
|
|
101
|
+
address: string,
|
|
102
|
+
deliveryId: string,
|
|
103
|
+
timeoutSeconds?: number
|
|
104
|
+
) {
|
|
105
|
+
try {
|
|
106
|
+
const result = await DoorstepAI.startDeliveryByAddressString(
|
|
107
|
+
address,
|
|
108
|
+
deliveryId,
|
|
109
|
+
timeoutSeconds
|
|
110
|
+
);
|
|
111
|
+
console.log('DOORSTEPAI - Delivery started successfully by Address String:', address, deliveryId);
|
|
112
|
+
return result;
|
|
113
|
+
} catch (error: any) {
|
|
114
|
+
console.error('DOORSTEPAI - Failed to start delivery by Address String:', error);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
static async startDeliveryByLatLng(
|
|
121
|
+
latitude: number,
|
|
122
|
+
longitude: number,
|
|
123
|
+
subUnit: string,
|
|
124
|
+
deliveryId: string,
|
|
125
|
+
timeoutSeconds?: number
|
|
82
126
|
) {
|
|
83
127
|
try {
|
|
84
|
-
|
|
85
|
-
|
|
128
|
+
const result = await DoorstepAI.startDeliveryByLatLng(
|
|
129
|
+
latitude,
|
|
130
|
+
longitude,
|
|
131
|
+
subUnit,
|
|
132
|
+
deliveryId,
|
|
133
|
+
timeoutSeconds
|
|
134
|
+
);
|
|
135
|
+
console.log(
|
|
136
|
+
'DOORSTEPAI - Delivery started successfully by LatLng:',
|
|
137
|
+
latitude,
|
|
138
|
+
longitude,
|
|
139
|
+
subUnit,
|
|
140
|
+
deliveryId
|
|
141
|
+
);
|
|
86
142
|
return result;
|
|
87
143
|
} catch (error: any) {
|
|
88
|
-
console.error('Failed to start delivery by
|
|
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);
|
|
89
160
|
throw error;
|
|
90
161
|
}
|
|
91
162
|
}
|
|
@@ -94,9 +165,9 @@ class DoorstepAIModule {
|
|
|
94
165
|
static async stopDelivery(deliveryId: string) {
|
|
95
166
|
try {
|
|
96
167
|
await DoorstepAI.stopDelivery(deliveryId);
|
|
97
|
-
console.log('Delivery stopped successfully');
|
|
168
|
+
console.log('DOORSTEPAI - Delivery stopped successfully');
|
|
98
169
|
} catch (error: any) {
|
|
99
|
-
console.error('Failed to stop delivery:', error);
|
|
170
|
+
console.error('DOORSTEPAI - Failed to stop delivery:', error);
|
|
100
171
|
throw error;
|
|
101
172
|
}
|
|
102
173
|
}
|
|
@@ -105,13 +176,14 @@ class DoorstepAIModule {
|
|
|
105
176
|
static async newEvent(eventName: string, deliveryId: string) {
|
|
106
177
|
try {
|
|
107
178
|
const result = await DoorstepAI.newEvent(eventName, deliveryId);
|
|
108
|
-
console.log('Event sent successfully:', result);
|
|
179
|
+
console.log('DOORSTEPAI - Event sent successfully:', result);
|
|
109
180
|
return result;
|
|
110
181
|
} catch (error: any) {
|
|
111
|
-
console.error('Failed to send event:', error);
|
|
182
|
+
console.error('DOORSTEPAI - Failed to send event:', eventName, deliveryId, error);
|
|
112
183
|
throw error;
|
|
113
184
|
}
|
|
114
185
|
}
|
|
186
|
+
|
|
115
187
|
}
|
|
116
188
|
|
|
117
189
|
export { DoorstepAIModule as DoorstepAI };
|