@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.
Files changed (34) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +53 -9
  3. package/ios/DoorstepAI.mm +24 -14
  4. package/ios/DoorstepAI.swift +64 -5
  5. package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -5
  6. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  7. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
  8. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +1487 -138
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +54 -10
  10. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +54 -10
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1451 -816
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1487 -138
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +54 -10
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +54 -10
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1487 -138
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +54 -10
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +54 -10
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +1451 -816
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +1446 -815
  29. package/lib/module/DoorstepAI.js +32 -54
  30. package/lib/module/DoorstepAI.js.map +1 -1
  31. package/lib/typescript/src/DoorstepAI.d.ts +6 -5
  32. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/DoorstepAI.tsx +70 -53
@@ -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
- // 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
- // }
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","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,GAAG,MAAMT,UAAU,CAACG,aAAa,CAAC,CAAC;QAC/CI,OAAO,CAACC,GAAG,CAAC,2CAA2C,EAAEC,MAAM,CAAC;QAChE,OAAOA,MAAM;MACf,CAAC,CAAC,OAAOC,KAAK,EAAE;QACdH,OAAO,CAACG,KAAK,CAAC,oDAAoD,EAAEA,KAAK,CAAC;QAC1E,MAAMA,KAAK;MACb;IACF,CAAC,MAAM;MACL,IAAI,CAACN,MAAM,EAAE;QACX,MAAM,IAAIO,KAAK,CAAC,4DAA4D,CAAC;MAC/E;MACA,IAAI;QACF,MAAMX,UAAU,CAACG,aAAa,CAACC,MAAM,CAAC;QACtCG,OAAO,CAACC,GAAG,CAAC,sCAAsC,CAAC;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,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":[]}
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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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,E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AAM,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doorstepai/dropoff-sdk",
3
- "version": "1.0.32",
3
+ "version": "2.0.1",
4
4
  "description": "doorstep.ai dropoff sdk for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -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(placeID: string, deliveryId: string) {
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(plusCode: string, deliveryId: string) {
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(address, deliveryId);
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
- // 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
- // }
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 };