@doorstepai/dropoff-sdk 1.0.6 → 1.0.8

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 (32) hide show
  1. package/README.md +2 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +42 -32
  4. package/ios/DoorstepAI.mm +8 -2
  5. package/ios/DoorstepAI.swift +27 -22
  6. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  7. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +215 -57
  8. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +6 -5
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +6 -5
  10. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +8 -8
  11. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +735 -677
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +215 -57
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +6 -5
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -5
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +215 -57
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +6 -5
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +6 -5
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +16 -16
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +759 -701
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +759 -700
  24. package/lib/module/DoorstepAI.js +56 -29
  25. package/lib/module/DoorstepAI.js.map +1 -1
  26. package/lib/module/RootDoorstepAI.js.map +1 -1
  27. package/lib/typescript/src/DoorstepAI.d.ts +6 -5
  28. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  29. package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/src/DoorstepAI.tsx +64 -42
  32. package/src/RootDoorstepAI.tsx +4 -7
@@ -6,6 +6,9 @@ const {
6
6
  } = NativeModules;
7
7
  class DoorstepAIModule {
8
8
  static isInitialized = false;
9
+ static enableDevMode() {
10
+ DoorstepAI.setDevMode(true);
11
+ }
9
12
  static async init() {
10
13
  if (Platform.OS === 'android') {
11
14
  if (this.isInitialized) {
@@ -14,50 +17,74 @@ class DoorstepAIModule {
14
17
  try {
15
18
  await DoorstepAI.init();
16
19
  console.log('DoorstepAI initialized');
20
+ this.isInitialized = true; // Mark as initialized on success
17
21
  } catch (error) {
18
22
  console.error('Failed to initialize DoorstepAI:', error);
19
23
  throw error;
20
24
  }
21
- }
25
+ } // iOS does not require explicit init in the bridge
22
26
  }
23
27
  static setApiKey(apiKey) {
24
- console.log(DoorstepAI);
25
28
  DoorstepAI.setApiKey(apiKey);
26
29
  }
27
- static async startDeliveryByPlaceID(placeID) {
28
- DoorstepAI.startDeliveryByPlaceID(placeID).then(() => {
29
- console.log('Delivery started successfully');
30
- }).catch(error => {
31
- console.error('Failed to start delivery:', error);
32
- });
30
+
31
+ // Add deliveryId parameter
32
+ static async startDeliveryByPlaceID(placeID, deliveryId) {
33
+ try {
34
+ const result = await DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId);
35
+ console.log('Delivery started successfully by Place ID:', result);
36
+ return result; // Return result (e.g., session ID from Android)
37
+ } catch (error) {
38
+ console.error('Failed to start delivery by Place ID:', error);
39
+ throw error; // Re-throw error for caller handling
40
+ }
33
41
  }
34
- static startDeliveryByPlusCode(plusCode) {
35
- DoorstepAI.startDeliveryByPlusCode(plusCode).then(() => {
36
- console.log('Delivery started successfully');
37
- }).catch(error => {
38
- console.error('Failed to start delivery:', error);
39
- });
42
+
43
+ // Add deliveryId parameter
44
+ static async startDeliveryByPlusCode(plusCode, deliveryId) {
45
+ try {
46
+ const result = await DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId);
47
+ console.log('Delivery started successfully by Plus Code:', result);
48
+ return result;
49
+ } catch (error) {
50
+ console.error('Failed to start delivery by Plus Code:', error);
51
+ throw error;
52
+ }
40
53
  }
41
- static startDeliveryByAddress(address) {
42
- DoorstepAI.startDeliveryByAddress(address).then(() => {
43
- console.log('Delivery started successfully');
44
- }).catch(error => {
45
- console.error('Failed to start delivery:', error);
46
- });
54
+
55
+ // Add deliveryId parameter and handle platform difference
56
+ static async startDeliveryByAddress(address, deliveryId) {
57
+ try {
58
+ let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
59
+ console.log('Delivery started successfully by Address:', result);
60
+ return result;
61
+ } catch (error) {
62
+ console.error('Failed to start delivery by Address:', error);
63
+ throw error;
64
+ }
47
65
  }
48
- static stopDelivery() {
49
- DoorstepAI.stopDelivery().then(() => {
66
+
67
+ // Add deliveryId parameter
68
+ static async stopDelivery(deliveryId) {
69
+ try {
70
+ await DoorstepAI.stopDelivery(deliveryId);
50
71
  console.log('Delivery stopped successfully');
51
- }).catch(error => {
72
+ } catch (error) {
52
73
  console.error('Failed to stop delivery:', error);
53
- });
74
+ throw error;
75
+ }
54
76
  }
55
- static newEvent(eventName) {
56
- DoorstepAI.newEvent(eventName).then(() => {
57
- console.log('Event sent successfully');
58
- }).catch(error => {
77
+
78
+ // Add deliveryId parameter
79
+ static async newEvent(eventName, deliveryId) {
80
+ try {
81
+ const result = await DoorstepAI.newEvent(eventName, deliveryId);
82
+ console.log('Event sent successfully:', result);
83
+ return result;
84
+ } catch (error) {
59
85
  console.error('Failed to send event:', error);
60
- });
86
+ throw error;
87
+ }
61
88
  }
62
89
  }
63
90
  export { DoorstepAIModule as DoorstepAI };
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","init","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","then","catch","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","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,IAAIA,CAAA,EAAkB;IACjC,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAI,IAAI,CAACF,aAAa,EAAE;QACtB;MACF;MACA,IAAI;QACF,MAAMF,UAAU,CAACG,IAAI,CAAC,CAAC;QACvBE,OAAO,CAACC,GAAG,CAAC,wBAAwB,CAAC;MACvC,CAAC,CAAC,OAAOC,KAAK,EAAE;QACdF,OAAO,CAACE,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;QACxD,MAAMA,KAAK;MACb;IACF;EACF;EAEA,OAAOC,SAASA,CAACC,MAAc,EAAE;IAC/BJ,OAAO,CAACC,GAAG,CAACN,UAAU,CAAC;IACvBA,UAAU,CAACQ,SAAS,CAACC,MAAM,CAAC;EAC9B;EAEA,aAAaC,sBAAsBA,CAACC,OAAe,EAAE;IACnDX,UAAU,CAACU,sBAAsB,CAACC,OAAO,CAAC,CACvCC,IAAI,CAAC,MAAM;MACVP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAC9C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACrBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACnD,CAAC,CAAC;EACN;EAEA,OAAOO,uBAAuBA,CAACC,QAAgB,EAAE;IAC/Cf,UAAU,CAACc,uBAAuB,CAACC,QAAQ,CAAC,CACzCH,IAAI,CAAC,MAAM;MACVP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAC9C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACrBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACnD,CAAC,CAAC;EACN;EAEA,OAAOS,sBAAsBA,CAACC,OAAoB,EAAE;IAClDjB,UAAU,CAACgB,sBAAsB,CAACC,OAAO,CAAC,CACvCL,IAAI,CAAC,MAAM;MACVP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAC9C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACrBF,OAAO,CAACE,KAAK,CAAC,2BAA2B,EAAEA,KAAK,CAAC;IACnD,CAAC,CAAC;EACN;EAEA,OAAOW,YAAYA,CAAA,EAAG;IACpBlB,UAAU,CAACkB,YAAY,CAAC,CAAC,CACtBN,IAAI,CAAC,MAAM;MACVP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAC9C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACrBF,OAAO,CAACE,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IAClD,CAAC,CAAC;EACN;EAEA,OAAOY,QAAQA,CAACC,SAAiB,EAAE;IACjCpB,UAAU,CAACmB,QAAQ,CAACC,SAAS,CAAC,CAC3BR,IAAI,CAAC,MAAM;MACVP,OAAO,CAACC,GAAG,CAAC,yBAAyB,CAAC;IACxC,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACrBF,OAAO,CAACE,KAAK,CAAC,uBAAuB,EAAEA,KAAK,CAAC;IAC/C,CAAC,CAAC;EACN;AACF;AAEA,SAASN,gBAAgB,IAAID,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","DoorstepAI","DoorstepAIModule","isInitialized","enableDevMode","setDevMode","init","OS","console","log","error","setApiKey","apiKey","startDeliveryByPlaceID","placeID","deliveryId","result","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","stopDelivery","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AAO,CAACE,KAAK,CAAC,uBAAuB,EAAEA,KAAK,CAAC;MAC7C,MAAMA,KAAK;IACb;EACF;AACF;AAEA,SAASR,gBAAgB,IAAID,UAAU","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,QACb,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGT,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASU,cAAcA,CAACC,KAAyB,EAAE;EACxDN,SAAS,CAAC,MAAM;IACd,MAAMO,+BAA+B,GAAG,MAAAA,CAAA,KAAY;MAElD,IAAIV,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMP,UAAU,CAACQ,IAAI,CAAC,CAAC;MACzB;MACAR,UAAU,CAACS,SAAS,CAACJ,KAAK,CAACK,MAAM,CAAC;MAGlC,IAAId,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;QAC7B,IAAI;UACF,MAAMI,oBAAoB,GAAG,CAC3Bb,kBAAkB,CAACc,WAAW,CAACC,oBAAoB,EACnDf,kBAAkB,CAACc,WAAW,CAACE,oBAAoB,CACpD;UAGD,MAAMC,OAAO,GAAG,MAAMjB,kBAAkB,CAACkB,eAAe,CACtDL,oBACF,CAAC;UAED,IACEI,OAAO,CAACjB,kBAAkB,CAACc,WAAW,CAACC,oBAAoB,CAAC,KAC1Df,kBAAkB,CAACmB,OAAO,CAACC,OAAO,IACpCH,OAAO,CAACjB,kBAAkB,CAACc,WAAW,CAACE,oBAAoB,CAAC,KAC1DhB,kBAAkB,CAACmB,OAAO,CAACC,OAAO,EACpC;YACAC,OAAO,CAACC,GAAG,CAAC,sCAAsC,CAAC;UACrD,CAAC,MAAM;YACLD,OAAO,CAACE,IAAI,CAAC,iDAAiD,CAAC;UACjE;QACF,CAAC,CAAC,OAAOC,GAAG,EAAE;UACZH,OAAO,CAACE,IAAI,CAAC,uCAAuC,EAAEC,GAAG,CAAC;QAC5D;MACF,CAAC,MAAM,IAAI1B,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;QAChCY,OAAO,CAACC,GAAG,CACT,sEACF,CAAC;MACH;IACF,CAAC;IAEDd,+BAA+B,CAAC,CAAC;EACnC,CAAC,EAAE,CAACD,KAAK,CAACK,MAAM,CAAC,CAAC;;EAElB;EACA;EACA,oBACER,IAAA,CAACP,IAAI;IAAC4B,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3B9B,QAAQ,CAACW,EAAE,KAAK,KAAK,gBAAGL,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAMqB,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","style","styles","container","children","create","height","width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GAAG,CAAC;QAC5D;MACF,CAAC,MAAM,IAAI1B,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;QAChCY,OAAO,CAACC,GAAG,CACT,sEACF,CAAC;MACH;IACF,CAAC;IAEDd,+BAA+B,CAAC,CAAC;EACnC,CAAC,EAAE,CAACD,KAAK,CAACK,MAAM,CAAC,CAAC;;EAElB;EACA;EACA,oBACER,IAAA,CAACP,IAAI;IAAC4B,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3B9B,QAAQ,CAACW,EAAE,KAAK,KAAK,gBAAGL,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAMqB,MAAM,GAAG3B,UAAU,CAAC8B,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
@@ -8,13 +8,14 @@ type AddressType = {
8
8
  };
9
9
  declare class DoorstepAIModule {
10
10
  static isInitialized: boolean;
11
+ static enableDevMode(): void;
11
12
  static init(): Promise<void>;
12
13
  static setApiKey(apiKey: string): void;
13
- static startDeliveryByPlaceID(placeID: string): Promise<void>;
14
- static startDeliveryByPlusCode(plusCode: string): void;
15
- static startDeliveryByAddress(address: AddressType): void;
16
- static stopDelivery(): void;
17
- static newEvent(eventName: 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 stopDelivery(deliveryId: string): Promise<void>;
18
+ static newEvent(eventName: string, deliveryId: string): Promise<any>;
18
19
  }
19
20
  export { DoorstepAIModule as DoorstepAI };
20
21
  //# sourceMappingURL=DoorstepAI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepA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AM,EAAE,UAAU,EAAE,MAAM;WAe5D,sBAAsB,CACjC,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM;WAaP,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAoDvD"}
1
+ {"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAiDvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doorstepai/dropoff-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "doorstep.ai dropoff sdk for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -13,6 +13,10 @@ type AddressType = {
13
13
  class DoorstepAIModule {
14
14
  static isInitialized = false;
15
15
 
16
+ static enableDevMode() {
17
+ DoorstepAI.setDevMode(true);
18
+ }
19
+
16
20
  static async init(): Promise<void> {
17
21
  if (Platform.OS === 'android') {
18
22
  if (this.isInitialized) {
@@ -21,66 +25,84 @@ class DoorstepAIModule {
21
25
  try {
22
26
  await DoorstepAI.init();
23
27
  console.log('DoorstepAI initialized');
28
+ this.isInitialized = true; // Mark as initialized on success
24
29
  } catch (error) {
25
30
  console.error('Failed to initialize DoorstepAI:', error);
26
31
  throw error;
27
32
  }
28
- }
33
+ } // iOS does not require explicit init in the bridge
29
34
  }
30
35
 
31
36
  static setApiKey(apiKey: string) {
32
- console.log(DoorstepAI);
33
37
  DoorstepAI.setApiKey(apiKey);
34
38
  }
35
39
 
36
- static async startDeliveryByPlaceID(placeID: string) {
37
- DoorstepAI.startDeliveryByPlaceID(placeID)
38
- .then(() => {
39
- console.log('Delivery started successfully');
40
- })
41
- .catch((error: any) => {
42
- console.error('Failed to start delivery:', error);
43
- });
40
+ // Add deliveryId parameter
41
+ static async startDeliveryByPlaceID(placeID: string, deliveryId: string) {
42
+ try {
43
+ const result = await DoorstepAI.startDeliveryByPlaceID(
44
+ placeID,
45
+ deliveryId
46
+ );
47
+ console.log('Delivery started successfully by Place ID:', result);
48
+ return result; // Return result (e.g., session ID from Android)
49
+ } catch (error: any) {
50
+ console.error('Failed to start delivery by Place ID:', error);
51
+ throw error; // Re-throw error for caller handling
52
+ }
44
53
  }
45
54
 
46
- static startDeliveryByPlusCode(plusCode: string) {
47
- DoorstepAI.startDeliveryByPlusCode(plusCode)
48
- .then(() => {
49
- console.log('Delivery started successfully');
50
- })
51
- .catch((error: any) => {
52
- console.error('Failed to start delivery:', error);
53
- });
55
+ // Add deliveryId parameter
56
+ static async startDeliveryByPlusCode(plusCode: string, deliveryId: string) {
57
+ try {
58
+ const result = await DoorstepAI.startDeliveryByPlusCode(
59
+ plusCode,
60
+ deliveryId
61
+ );
62
+ console.log('Delivery started successfully by Plus Code:', result);
63
+ return result;
64
+ } catch (error: any) {
65
+ console.error('Failed to start delivery by Plus Code:', error);
66
+ throw error;
67
+ }
54
68
  }
55
69
 
56
- static startDeliveryByAddress(address: AddressType) {
57
- DoorstepAI.startDeliveryByAddress(address)
58
- .then(() => {
59
- console.log('Delivery started successfully');
60
- })
61
- .catch((error: any) => {
62
- console.error('Failed to start delivery:', error);
63
- });
70
+ // Add deliveryId parameter and handle platform difference
71
+ static async startDeliveryByAddress(
72
+ address: AddressType,
73
+ deliveryId: string
74
+ ) {
75
+ try {
76
+ let result = await DoorstepAI.startDeliveryByAddress(address, deliveryId);
77
+ console.log('Delivery started successfully by Address:', result);
78
+ return result;
79
+ } catch (error: any) {
80
+ console.error('Failed to start delivery by Address:', error);
81
+ throw error;
82
+ }
64
83
  }
65
84
 
66
- static stopDelivery() {
67
- DoorstepAI.stopDelivery()
68
- .then(() => {
69
- console.log('Delivery stopped successfully');
70
- })
71
- .catch((error: any) => {
72
- console.error('Failed to stop delivery:', error);
73
- });
85
+ // Add deliveryId parameter
86
+ static async stopDelivery(deliveryId: string) {
87
+ try {
88
+ await DoorstepAI.stopDelivery(deliveryId);
89
+ console.log('Delivery stopped successfully');
90
+ } catch (error: any) {
91
+ console.error('Failed to stop delivery:', error);
92
+ throw error;
93
+ }
74
94
  }
75
95
 
76
- static newEvent(eventName: string) {
77
- DoorstepAI.newEvent(eventName)
78
- .then(() => {
79
- console.log('Event sent successfully');
80
- })
81
- .catch((error: any) => {
82
- console.error('Failed to send event:', error);
83
- });
96
+ // Add deliveryId parameter
97
+ static async newEvent(eventName: string, deliveryId: string) {
98
+ try {
99
+ const result = await DoorstepAI.newEvent(eventName, deliveryId);
100
+ console.log('Event sent successfully:', result);
101
+ return result;
102
+ } catch (error: any) {
103
+ console.error('Failed to send event:', error);
104
+ throw error;
105
+ }
84
106
  }
85
107
  }
86
108
 
@@ -14,24 +14,21 @@ const DoorstepAIView = requireNativeComponent('RootDoorstepAIView');
14
14
  export function RootDoorstepAI(props: { apiKey: string }) {
15
15
  useEffect(() => {
16
16
  const initializeAndRequestPermissions = async () => {
17
-
18
17
  if (Platform.OS === 'android') {
19
18
  await DoorstepAI.init();
20
19
  }
20
+
21
21
  DoorstepAI.setApiKey(props.apiKey);
22
22
 
23
-
24
23
  if (Platform.OS === 'android') {
25
24
  try {
26
25
  const permissionsToRequest = [
27
26
  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
28
27
  PermissionsAndroid.PERMISSIONS.ACTIVITY_RECOGNITION,
29
28
  ];
30
-
31
29
 
32
- const granted = await PermissionsAndroid.requestMultiple(
33
- permissionsToRequest,
34
- );
30
+ const granted =
31
+ await PermissionsAndroid.requestMultiple(permissionsToRequest);
35
32
 
36
33
  if (
37
34
  granted[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] ===
@@ -48,7 +45,7 @@ export function RootDoorstepAI(props: { apiKey: string }) {
48
45
  }
49
46
  } else if (Platform.OS === 'ios') {
50
47
  console.log(
51
- 'iOS: Ensure location and motion usage descriptions are in Info.plist',
48
+ 'iOS: Ensure location and motion usage descriptions are in Info.plist'
52
49
  );
53
50
  }
54
51
  };