@doorstepai/dropoff-sdk 0.1.0 → 1.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.
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => min_ios_version_supported }
14
- s.source = { :git => "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk.git", :tag => "#{s.version}" }
14
+ s.source = { :git => "https://github.com/doorstep-ai/DoorstepAIDropoffReactNativeSDK", :tag => "#{s.version}" }
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
package/README.md CHANGED
@@ -1,33 +1,195 @@
1
- # @doorstepai/dropoff-sdk
2
1
 
3
-
2
+ # DoorstepAI Dropoff SDK for React Native
4
3
 
5
- ## Installation
4
+ The `@doorstepai/dropoff-sdk` provides a set of tools to integrate delivery tracking and Proof of Delivery (POD) events into your React Native application. This SDK enables seamless coordination between your delivery interface and DoorstepAI's backend systems.
6
5
 
7
- ```sh
6
+ ## 📦 Installation
7
+
8
+ ```bash
8
9
  npm install @doorstepai/dropoff-sdk
9
10
  ```
10
11
 
11
- ## Usage
12
+ ---
13
+
14
+ ## 🚀 Getting Started
15
+
16
+ ### 1. **Import Components**
17
+
18
+ ```tsx
19
+ import {
20
+ RootDoorstepAI,
21
+ DoorstepAI
22
+ } from '@doorstepai/dropoff-sdk';
23
+ ```
24
+
25
+ ### 2. **Add `RootDoorstepAI` to Root File**
26
+
27
+ Place the following component in the root of your `App.tsx` or main entry file:
28
+
29
+ ```tsx
30
+ import { RootDoorstepAI } from "@doorstepai/dropoff-sdk"
31
+
32
+ const App = () => {
33
+ return (
34
+ <View>
35
+ <RootDoorstepAI apiKey="YOUR_API_KEY_HERE" />
36
+ {/** Your App Components */}
37
+ )
38
+ }
39
+ ```
40
+
41
+ This sets the API key and initializes the SDK when the app launches.
42
+
43
+ ---
12
44
 
45
+ ## 📲 Example Usage
13
46
 
14
- ```js
15
- import { multiply } from '@doorstepai/dropoff-sdk';
47
+ Use the SDK's functions to track and update delivery events. Below are common examples using buttons.
16
48
 
17
- // ...
49
+ ```jsx
50
+ import { Button } from 'react-native';
51
+ import { DoorstepAI } from "@doorstepai/dropoff-sdk"
18
52
 
19
- const result = await multiply(3, 7);
53
+ // Start a delivery using a Google Place ID
54
+ <Button title="Start Delivery" onPress={() => {
55
+ DoorstepAI.startDeliveryByPlaceID("213");
56
+ }} />
57
+
58
+ // Send "taking_pod" event
59
+ <Button title="Taking POD" onPress={() => {
60
+ DoorstepAI.newEvent("taking_pod");
61
+ }} />
62
+
63
+ // Send "pod_captured" event
64
+ <Button title="POD Captured" onPress={() => {
65
+ DoorstepAI.newEvent("pod_captured");
66
+ }} />
67
+
68
+ // End the delivery
69
+ <Button title="End Delivery" onPress={() => {
70
+ DoorstepAI.stopDelivery();
71
+ }} />
20
72
  ```
21
73
 
74
+ ---
75
+
76
+ ## 🔧 SDK API
77
+
78
+ ### `DoorstepAI.init(): Promise<void>`
79
+
80
+ Initializes the DoorstepAI module on Android. Automatically handled by `RootDoorstepAI` if used properly.
81
+
82
+ ---
83
+
84
+ ### `DoorstepAI.setApiKey(apiKey: string): void`
85
+
86
+ Sets the API key to authenticate SDK usage.
87
+
88
+ ---
89
+
90
+ ### `DoorstepAI.startDeliveryByPlaceID(placeID: string): Promise<void>`
22
91
 
23
- ## Contributing
92
+ Starts a delivery using a Google Place ID.
24
93
 
25
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
94
+ ---
26
95
 
27
- ## License
96
+ ### `DoorstepAI.startDeliveryByPlusCode(plusCode: string): Promise<void>`
28
97
 
29
- MIT
98
+ Starts a delivery using a Google Plus Code.
30
99
 
31
100
  ---
32
101
 
33
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
102
+ ### `DoorstepAI.startDeliveryByAddress(address: AddressType): Promise<void>`
103
+
104
+ Starts a delivery using a structured address object.
105
+
106
+ ```ts
107
+ type AddressType = {
108
+ streetNumber: string;
109
+ route: string;
110
+ locality: string;
111
+ administrativeAreaLevel1: string;
112
+ postalCode: string;
113
+ }
114
+ ```
115
+
116
+ ---
117
+
118
+ ### `DoorstepAI.stopDelivery(): Promise<void>`
119
+
120
+ Stops the current delivery.
121
+
122
+ ---
123
+
124
+ ### `DoorstepAI.newEvent(eventName: string): Promise<void>`
125
+
126
+ Sends a delivery-related event. Supported events include:
127
+ - `"taking_pod"`
128
+ - `"pod_captured"`
129
+
130
+ More can be added per vender/customer relationship.
131
+
132
+ ---
133
+
134
+ ## ✅ Best Practices
135
+
136
+ - Always wrap `DoorstepAI` API calls in `try/catch` or use `.catch()` for better error handling when applicable.
137
+ - Use the `RootDoorstepAI` component only **once** at the **root** of your app.
138
+ - Ensure your API key is securely stored and never hardcoded in production.
139
+
140
+ ---
141
+
142
+ ## 🧪 Debugging
143
+
144
+ If something isn't working as expected:
145
+
146
+ - Check console logs for `DoorstepAI initialized` or error messages.
147
+ - Verify that the API key is valid and accepted by the SDK.
148
+ - Ensure your permissions (e.g., location) are correctly set up on the device.
149
+
150
+ ---
151
+
152
+ ---
153
+
154
+ ## 🔐 Permissions
155
+
156
+ To use the `@doorstepai/dropoff-sdk` effectively, you must include the appropriate permissions in your mobile app's configuration files.
157
+
158
+ ### 📱 iOS
159
+
160
+ In your `Info.plist`, include the following usage descriptions:
161
+
162
+ ```xml
163
+ <key>NSLocationWhenInUseUsageDescription</key>
164
+ <string>This app requires access to your location while in use to track deliveries.</string>
165
+
166
+ <key>NSLocationAlwaysUsageDescription</key>
167
+ <string>This app requires continuous location access to ensure accurate delivery tracking.</string>
168
+
169
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
170
+ <string>This app requires location access at all times to support delivery tracking.</string>
171
+
172
+ <key>NSMotionUsageDescription</key>
173
+ <string>This app uses motion data to improve delivery tracking accuracy.</string>
174
+ ```
175
+
176
+ ### 🤖 Android
177
+
178
+ In your `AndroidManifest.xml`, include the following permissions:
179
+
180
+ ```xml
181
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
182
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
183
+ <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
184
+ <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
185
+
186
+ <uses-feature android:name="android.hardware.sensor.accelerometer" />
187
+ <uses-feature android:name="android.hardware.sensor.gyroscope" />
188
+ <uses-feature android:name="android.hardware.sensor.barometer" />
189
+ <uses-feature android:name="android.hardware.sensor.compass" />
190
+ <uses-feature android:name="android.hardware.sensor.proximity" />
191
+ ```
192
+
193
+ These permissions enable accurate location and motion tracking during delivery sessions.
194
+
195
+ ---
@@ -13,52 +13,50 @@ class DoorstepAIModule {
13
13
  }
14
14
  try {
15
15
  await DoorstepAI.init();
16
- console.log("DoorstepAI initialized");
16
+ console.log('DoorstepAI initialized');
17
17
  } catch (error) {
18
- console.error("Failed to initialize DoorstepAI:", error);
18
+ console.error('Failed to initialize DoorstepAI:', error);
19
19
  throw error;
20
20
  }
21
21
  }
22
22
  }
23
23
  static setApiKey(apiKey) {
24
- console.log("DOORSTEPAI MODULE: ", DoorstepAIModule);
25
- console.log("setting api key");
26
24
  console.log(DoorstepAI);
27
25
  DoorstepAI.setApiKey(apiKey);
28
26
  }
29
27
  static async startDeliveryByPlaceID(placeID) {
30
- await DoorstepAI.startDeliveryByPlaceID(placeID).then(() => {
31
- console.log("Delivery started successfully");
28
+ DoorstepAI.startDeliveryByPlaceID(placeID).then(() => {
29
+ console.log('Delivery started successfully');
32
30
  }).catch(error => {
33
- console.error("Failed to start delivery:", error);
31
+ console.error('Failed to start delivery:', error);
34
32
  });
35
33
  }
36
34
  static startDeliveryByPlusCode(plusCode) {
37
35
  DoorstepAI.startDeliveryByPlusCode(plusCode).then(() => {
38
- console.log("Delivery started successfully");
36
+ console.log('Delivery started successfully');
39
37
  }).catch(error => {
40
- console.error("Failed to start delivery:", error);
38
+ console.error('Failed to start delivery:', error);
41
39
  });
42
40
  }
43
41
  static startDeliveryByAddress(address) {
44
42
  DoorstepAI.startDeliveryByAddress(address).then(() => {
45
- console.log("Delivery started successfully");
43
+ console.log('Delivery started successfully');
46
44
  }).catch(error => {
47
- console.error("Failed to start delivery:", error);
45
+ console.error('Failed to start delivery:', error);
48
46
  });
49
47
  }
50
48
  static stopDelivery() {
51
49
  DoorstepAI.stopDelivery().then(() => {
52
- console.log("Delivery stopped successfully");
50
+ console.log('Delivery stopped successfully');
53
51
  }).catch(error => {
54
- console.error("Failed to stop delivery:", error);
52
+ console.error('Failed to stop delivery:', error);
55
53
  });
56
54
  }
57
55
  static newEvent(eventName) {
58
56
  DoorstepAI.newEvent(eventName).then(() => {
59
- console.log("Event sent successfully");
57
+ console.log('Event sent successfully');
60
58
  }).catch(error => {
61
- console.error("Failed to send event:", error);
59
+ console.error('Failed to send event:', error);
62
60
  });
63
61
  }
64
62
  }
@@ -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;EAACC;AAAU,CAAC,GAAGF,aAAa;AAUlC,MAAMG,gBAAgB,CAAC;EACnB,OAAOC,aAAa,GAAG,KAAK;EAE5B,aAAaC,IAAIA,CAAA,EAAkB;IAC/B,IAAIJ,QAAQ,CAACK,EAAE,KAAK,SAAS,EAAE;MAC3B,IAAI,IAAI,CAACF,aAAa,EAAE;QACpB;MACJ;MACA,IAAI;QACA,MAAMF,UAAU,CAACG,IAAI,CAAC,CAAC;QACvBE,OAAO,CAACC,GAAG,CAAC,wBAAwB,CAAC;MACzC,CAAC,C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C;EACV;EAEA,OAAOW,YAAYA,CAAA,EAAG;IAClBlB,UAAU,CAACkB,YAAY,CAAC,CAAC,CACpBN,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;IAChD,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,0BAA0B,EAAEA,KAAK,CAAC;IACpD,CAAC,CAAC;EACV;EAEA,OAAOY,QAAQA,CAACC,SAAiB,EAAE;IAC/BpB,UAAU,CAACmB,QAAQ,CAACC,SAAS,CAAC,CACzBR,IAAI,CAAC,MAAM;MACRP,OAAO,CAACC,GAAG,CAAC,yBAAyB,CAAC;IAC1C,CAAC,CAAC,CACDO,KAAK,CAAEN,KAAU,IAAK;MACnBF,OAAO,CAACE,KAAK,CAAC,uBAAuB,EAAEA,KAAK,CAAC;IACjD,CAAC,CAAC;EACV;AAEJ;AAEA,SACIN,gBAAgB,IAAID,UAAU","ignoreList":[]}
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;AAUpC,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,C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O,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,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { requireNativeComponent, View, Platform } from 'react-native';
3
+ import { requireNativeComponent, View, Platform, StyleSheet } from 'react-native';
4
4
  import { useEffect } from 'react';
5
5
  import { DoorstepAI } from "./DoorstepAI.js";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -13,13 +13,16 @@ export function RootDoorstepAI(props) {
13
13
  }
14
14
  DoorstepAI.setApiKey(props.apiKey);
15
15
  })();
16
- }, []);
16
+ }, [props.apiKey]);
17
17
  return /*#__PURE__*/_jsx(View, {
18
- style: {
19
- height: 0,
20
- width: 0
21
- },
18
+ style: styles.container,
22
19
  children: Platform.OS === 'ios' ? /*#__PURE__*/_jsx(DoorstepAIView, {}) : null
23
20
  });
24
21
  }
22
+ const styles = StyleSheet.create({
23
+ container: {
24
+ height: 0,
25
+ width: 0
26
+ }
27
+ });
25
28
  //# sourceMappingURL=RootDoorstepAI.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["requireNativeComponent","View","Platform","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","OS","init","setApiKey","apiKey","style","height","width","children"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACIA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,QACL,cAAc;AAErB,SACIC,SAAS,QACN,OAAO;AAEd,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGP,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASQ,cAAcA,CAACC,KAAyB,EAAE;EAEtDN,SAAS,CAAC,MAAM;IACZ,CAAC,YAAY;MACT,IAAID,QAAQ,CAACQ,EAAE,KAAK,SAAS,EAAE;QAC3B,MAAMN,UAAU,CAACO,IAAI,CAAC,CAAC;MAC3B;MACAP,UAAU,CAACQ,SAAS,CAACH,KAAK,CAACI,MAAM,CAAC;IACtC,CAAC,EAAE,CAAC;EAER,CAAC,EAAE,EAAE,CAAC;EACN,oBACIP,IAAA,CAACL,IAAI;IAACa,KAAK,EAAE;MAACC,MAAM,EAAE,CAAC;MAAEC,KAAK,EAAE;IAAC,CAAE;IAAAC,QAAA,EAC9Bf,QAAQ,CAACQ,EAAE,KAAK,KAAK,gBAAGJ,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAChD,CAAC;AAEf","ignoreList":[]}
1
+ {"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","OS","init","setApiKey","apiKey","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,QACL,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGR,sBAAsB,CAAC,oBAAoB,CAAC;AACnE,OAAO,SAASS,cAAcA,CAACC,KAAyB,EAAE;EACxDN,SAAS,CAAC,MAAM;IACd,CAAC,YAAY;MACX,IAAIF,QAAQ,CAACS,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMN,UAAU,CAACO,IAAI,CAAC,CAAC;MACzB;MACAP,UAAU,CAACQ,SAAS,CAACH,KAAK,CAACI,MAAM,CAAC;IACpC,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,CAACJ,KAAK,CAACI,MAAM,CAAC,CAAC;EAClB,oBACEP,IAAA,CAACN,IAAI;IAACc,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3BhB,QAAQ,CAACS,EAAE,KAAK,KAAK,gBAAGJ,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAMQ,MAAM,GAAGb,UAAU,CAACgB,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["RootDoorstepAI","DoorstepAI"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAAQA,cAAc,QAAO,qBAAkB;AAC/C,SAASC,UAAU,QAAQ,iBAAc;AAEzC,SACEA,UAAU,EACVD,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["RootDoorstepAI","DoorstepAI"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,qBAAkB;AACjD,SAASC,UAAU,QAAQ,iBAAc;AAEzC,SAASA,UAAU,EAAED,cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAw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"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAaA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAgBvD"}
1
+ {"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,2CAcvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EACL,UAAU,EACV,cAAc,EACf,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@doorstepai/dropoff-sdk",
3
- "version": "0.1.0",
4
- "description": "doorstep.ai dropoff sdk",
3
+ "version": "1.0.0",
4
+ "description": "doorstep.ai dropoff sdk for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
7
7
  "private": false,
@@ -47,14 +47,11 @@
47
47
  ],
48
48
  "repository": {
49
49
  "type": "git",
50
- "url": "git+https://github.com/sheelpatel0118/doorstepai-dropoff-sdk.git"
50
+ "url": "git+https://github.com/doorstep-ai/DoorstepAIDropoffReactNativeSDK"
51
51
  },
52
- "author": "Sheel Patel <sheel@doorstep.ai> (https://github.com/sheelpatel0118)",
52
+ "author": "Doing Doorstep Better, Inc. (Sheel Patel)",
53
53
  "license": "MIT",
54
- "bugs": {
55
- "url": "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk/issues"
56
- },
57
- "homepage": "https://github.com/sheelpatel0118/doorstepai-dropoff-sdk#readme",
54
+ "homepage": "https://github.com/doorstep-ai/DoorstepAIDropoffReactNativeSDK#readme",
58
55
  "publishConfig": {
59
56
  "registry": "https://registry.npmjs.org/"
60
57
  },
@@ -1,92 +1,86 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
- const {DoorstepAI} = NativeModules;
2
+ const { DoorstepAI } = NativeModules;
3
3
 
4
4
  type AddressType = {
5
- streetNumber: string;
6
- route: string;
7
- locality: string;
8
- administrativeAreaLevel1: string;
9
- postalCode: string;
10
- }
5
+ streetNumber: string;
6
+ route: string;
7
+ locality: string;
8
+ administrativeAreaLevel1: string;
9
+ postalCode: string;
10
+ };
11
11
 
12
12
  class DoorstepAIModule {
13
- static isInitialized = false;
14
-
15
- static async init(): Promise<void> {
16
- if (Platform.OS === 'android') {
17
- if (this.isInitialized) {
18
- return;
19
- }
20
- try {
21
- await DoorstepAI.init();
22
- console.log("DoorstepAI initialized");
23
- } catch (error) {
24
- console.error("Failed to initialize DoorstepAI:", error);
25
- throw error;
26
- }
27
- }
28
-
29
- }
13
+ static isInitialized = false;
30
14
 
31
- static setApiKey(apiKey: string) {
32
- console.log("DOORSTEPAI MODULE: ", DoorstepAIModule)
33
- console.log("setting api key");
34
- console.log(DoorstepAI);
35
- DoorstepAI.setApiKey(apiKey);
15
+ static async init(): Promise<void> {
16
+ if (Platform.OS === 'android') {
17
+ if (this.isInitialized) {
18
+ return;
19
+ }
20
+ try {
21
+ await DoorstepAI.init();
22
+ console.log('DoorstepAI initialized');
23
+ } catch (error) {
24
+ console.error('Failed to initialize DoorstepAI:', error);
25
+ throw error;
26
+ }
36
27
  }
28
+ }
37
29
 
38
- static async startDeliveryByPlaceID(placeID: string) {
39
- await DoorstepAI.startDeliveryByPlaceID(placeID)
40
- .then(() => {
41
- console.log("Delivery started successfully");
42
- })
43
- .catch((error: any) => {
44
- console.error("Failed to start delivery:", error);
45
- });
46
- }
30
+ static setApiKey(apiKey: string) {
31
+ console.log(DoorstepAI);
32
+ DoorstepAI.setApiKey(apiKey);
33
+ }
47
34
 
48
- static startDeliveryByPlusCode(plusCode: string) {
49
- DoorstepAI.startDeliveryByPlusCode(plusCode)
50
- .then(() => {
51
- console.log("Delivery started successfully");
52
- })
53
- .catch((error: any) => {
54
- console.error("Failed to start delivery:", error);
55
- });
56
- }
35
+ static async startDeliveryByPlaceID(placeID: string) {
36
+ DoorstepAI.startDeliveryByPlaceID(placeID)
37
+ .then(() => {
38
+ console.log('Delivery started successfully');
39
+ })
40
+ .catch((error: any) => {
41
+ console.error('Failed to start delivery:', error);
42
+ });
43
+ }
57
44
 
58
- static startDeliveryByAddress(address: AddressType) {
59
- DoorstepAI.startDeliveryByAddress(address)
60
- .then(() => {
61
- console.log("Delivery started successfully");
62
- })
63
- .catch((error: any) => {
64
- console.error("Failed to start delivery:", error);
65
- });
66
- }
45
+ static startDeliveryByPlusCode(plusCode: string) {
46
+ DoorstepAI.startDeliveryByPlusCode(plusCode)
47
+ .then(() => {
48
+ console.log('Delivery started successfully');
49
+ })
50
+ .catch((error: any) => {
51
+ console.error('Failed to start delivery:', error);
52
+ });
53
+ }
67
54
 
68
- static stopDelivery() {
69
- DoorstepAI.stopDelivery()
70
- .then(() => {
71
- console.log("Delivery stopped successfully");
72
- })
73
- .catch((error: any) => {
74
- console.error("Failed to stop delivery:", error);
75
- });
76
- }
55
+ static startDeliveryByAddress(address: AddressType) {
56
+ DoorstepAI.startDeliveryByAddress(address)
57
+ .then(() => {
58
+ console.log('Delivery started successfully');
59
+ })
60
+ .catch((error: any) => {
61
+ console.error('Failed to start delivery:', error);
62
+ });
63
+ }
77
64
 
78
- static newEvent(eventName: string) {
79
- DoorstepAI.newEvent(eventName)
80
- .then(() => {
81
- console.log("Event sent successfully");
82
- })
83
- .catch((error: any) => {
84
- console.error("Failed to send event:", error);
85
- });
86
- }
65
+ static stopDelivery() {
66
+ DoorstepAI.stopDelivery()
67
+ .then(() => {
68
+ console.log('Delivery stopped successfully');
69
+ })
70
+ .catch((error: any) => {
71
+ console.error('Failed to stop delivery:', error);
72
+ });
73
+ }
87
74
 
75
+ static newEvent(eventName: string) {
76
+ DoorstepAI.newEvent(eventName)
77
+ .then(() => {
78
+ console.log('Event sent successfully');
79
+ })
80
+ .catch((error: any) => {
81
+ console.error('Failed to send event:', error);
82
+ });
83
+ }
88
84
  }
89
85
 
90
- export {
91
- DoorstepAIModule as DoorstepAI
92
- }
86
+ export { DoorstepAIModule as DoorstepAI };
@@ -1,30 +1,34 @@
1
1
  import {
2
- requireNativeComponent,
3
- View,
4
- Platform
2
+ requireNativeComponent,
3
+ View,
4
+ Platform,
5
+ StyleSheet,
5
6
  } from 'react-native';
6
7
 
7
- import {
8
- useEffect,
9
- } from 'react';
8
+ import { useEffect } from 'react';
10
9
 
11
10
  import { DoorstepAI } from './DoorstepAI';
12
11
 
13
12
  const DoorstepAIView = requireNativeComponent('RootDoorstepAIView');
14
13
  export function RootDoorstepAI(props: { apiKey: string }) {
14
+ useEffect(() => {
15
+ (async () => {
16
+ if (Platform.OS === 'android') {
17
+ await DoorstepAI.init();
18
+ }
19
+ DoorstepAI.setApiKey(props.apiKey);
20
+ })();
21
+ }, [props.apiKey]);
22
+ return (
23
+ <View style={styles.container}>
24
+ {Platform.OS === 'ios' ? <DoorstepAIView /> : null}
25
+ </View>
26
+ );
27
+ }
15
28
 
16
- useEffect(() => {
17
- (async () => {
18
- if (Platform.OS === 'android') {
19
- await DoorstepAI.init();
20
- }
21
- DoorstepAI.setApiKey(props.apiKey);
22
- })()
23
-
24
- }, [])
25
- return (
26
- <View style={{height: 0, width: 0}} >
27
- {Platform.OS === 'ios' ? <DoorstepAIView /> : null}
28
- </View>
29
- )
30
- }
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ height: 0,
32
+ width: 0,
33
+ },
34
+ });
package/src/index.tsx CHANGED
@@ -1,8 +1,4 @@
1
- import {RootDoorstepAI} from './RootDoorstepAI'
1
+ import { RootDoorstepAI } from './RootDoorstepAI';
2
2
  import { DoorstepAI } from './DoorstepAI';
3
3
 
4
- export {
5
- DoorstepAI,
6
- RootDoorstepAI
7
- }
8
-
4
+ export { DoorstepAI, RootDoorstepAI };
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Sheel Patel
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.