@doorstepai/dropoff-sdk 0.1.0 → 1.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.
@@ -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,197 @@
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 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
+ ```jsx
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
+ ---
44
+
45
+ ## 📲 Example Usage
46
+
47
+ Use the SDK's functions to track and update delivery events. Below are common examples using buttons.
48
+
49
+ ```jsx
50
+ import { Button } from 'react-native';
51
+ import { DoorstepAI } from "@doorstepai/dropoff-sdk"
52
+
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
+ }} />
72
+ ```
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
+ NOTE: You should never need to call this method directly.
83
+
84
+ ---
85
+
86
+ ### `DoorstepAI.setApiKey(apiKey: string): void`
87
+
88
+ Sets the API key to authenticate SDK usage.
89
+
90
+ ---
91
+
92
+ ### `DoorstepAI.startDeliveryByPlaceID(placeID: string): Promise<void>`
93
+
94
+ Starts a delivery using a Google Place ID.
12
95
 
96
+ ---
97
+
98
+ ### `DoorstepAI.startDeliveryByPlusCode(plusCode: string): Promise<void>`
99
+
100
+ Starts a delivery using a Google Plus Code.
101
+
102
+ ---
13
103
 
14
- ```js
15
- import { multiply } from '@doorstepai/dropoff-sdk';
104
+ ### `DoorstepAI.startDeliveryByAddress(address: AddressType): Promise<void>`
16
105
 
17
- // ...
106
+ Starts a delivery using a structured address object.
18
107
 
19
- const result = await multiply(3, 7);
108
+ ```ts
109
+ type AddressType = {
110
+ streetNumber: string;
111
+ route: string;
112
+ locality: string;
113
+ administrativeAreaLevel1: string;
114
+ postalCode: string;
115
+ }
20
116
  ```
21
117
 
118
+ ---
119
+
120
+ ### `DoorstepAI.stopDelivery(): Promise<void>`
121
+
122
+ Stops the current delivery.
123
+
124
+ ---
125
+
126
+ ### `DoorstepAI.newEvent(eventName: string): Promise<void>`
127
+
128
+ Sends a delivery-related event. Supported events include:
129
+ - `"taking_pod"`
130
+ - `"pod_captured"`
131
+
132
+ More can be added per vender/customer relationship.
133
+
134
+ ---
135
+
136
+ ## ✅ Best Practices
137
+
138
+ - Always wrap `DoorstepAI` API calls in `try/catch` or use `.catch()` for better error handling when applicable.
139
+ - Use the `RootDoorstepAI` component only **once** at the **root** of your app.
140
+ - Ensure your API key is securely stored and never hardcoded in production.
141
+
142
+ ---
22
143
 
23
- ## Contributing
144
+ ## 🧪 Debugging
24
145
 
25
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
146
+ If something isn't working as expected:
26
147
 
27
- ## License
148
+ - Check console logs for `DoorstepAI initialized` or error messages.
149
+ - Verify that the API key is valid and accepted by the SDK.
150
+ - Ensure your permissions (e.g., location) are correctly set up on the device.
28
151
 
29
- MIT
152
+ ---
30
153
 
31
154
  ---
32
155
 
33
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
156
+ ## 🔐 Permissions
157
+
158
+ To use the `@doorstepai/dropoff-sdk` effectively, you must include the appropriate permissions in your mobile app's configuration files.
159
+
160
+ ### 📱 iOS
161
+
162
+ In your `Info.plist`, include the following usage descriptions:
163
+
164
+ ```xml
165
+ <key>NSLocationWhenInUseUsageDescription</key>
166
+ <string>This app requires access to your location while in use to track deliveries.</string>
167
+
168
+ <key>NSLocationAlwaysUsageDescription</key>
169
+ <string>This app requires continuous location access to ensure accurate delivery tracking.</string>
170
+
171
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
172
+ <string>This app requires location access at all times to support delivery tracking.</string>
173
+
174
+ <key>NSMotionUsageDescription</key>
175
+ <string>This app uses motion data to improve delivery tracking accuracy.</string>
176
+ ```
177
+
178
+ ### 🤖 Android
179
+
180
+ In your `AndroidManifest.xml`, include the following permissions:
181
+
182
+ ```xml
183
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
184
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
185
+ <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
186
+ <uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
187
+
188
+ <uses-feature android:name="android.hardware.sensor.accelerometer" />
189
+ <uses-feature android:name="android.hardware.sensor.gyroscope" />
190
+ <uses-feature android:name="android.hardware.sensor.barometer" />
191
+ <uses-feature android:name="android.hardware.sensor.compass" />
192
+ <uses-feature android:name="android.hardware.sensor.proximity" />
193
+ ```
194
+
195
+ These permissions enable accurate location and motion tracking during delivery sessions.
196
+
197
+ ---
@@ -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;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rD,CAAC,CAAC;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;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AM;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,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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.ts","sourceRoot":"","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.1",
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.