@doorstepai/dropoff-sdk 1.0.8 → 1.0.9

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 (2) hide show
  1. package/README.md +33 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  # DoorstepAI Dropoff SDK for React Native
3
2
 
4
3
  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.
@@ -52,22 +51,35 @@ import { DoorstepAI } from "@doorstepai/dropoff-sdk"
52
51
 
53
52
  // Start a delivery using a Google Place ID
54
53
  <Button title="Start Delivery" onPress={() => {
55
- DoorstepAI.startDeliveryByPlaceID("213");
54
+ DoorstepAI.startDeliveryByPlaceID('destination_place_id', 'delivery_id_1');
55
+ }} />
56
+
57
+ // Start a delivery using an address
58
+ <Button title="Start Delivery by Address" onPress={() => {
59
+ const address = {
60
+ streetNumber: '123',
61
+ route: 'Main St',
62
+ subPremise: 'Apt 4B',
63
+ locality: 'New York',
64
+ administrativeAreaLevel1: 'NY',
65
+ postalCode: '10001'
66
+ };
67
+ DoorstepAI.startDeliveryByAddress(address, 'delivery_id_1');
56
68
  }} />
57
69
 
58
70
  // Send "taking_pod" event
59
71
  <Button title="Taking POD" onPress={() => {
60
- DoorstepAI.newEvent("taking_pod");
72
+ DoorstepAI.newEvent('taking_pod', 'delivery_id_1');
61
73
  }} />
62
74
 
63
75
  // Send "pod_captured" event
64
76
  <Button title="POD Captured" onPress={() => {
65
- DoorstepAI.newEvent("pod_captured");
77
+ DoorstepAI.newEvent('pod_captured', 'delivery_id_1');
66
78
  }} />
67
79
 
68
80
  // End the delivery
69
81
  <Button title="End Delivery" onPress={() => {
70
- DoorstepAI.stopDelivery();
82
+ DoorstepAI.stopDelivery('delivery_id_1');
71
83
  }} />
72
84
  ```
73
85
 
@@ -89,43 +101,44 @@ Sets the API key to authenticate SDK usage.
89
101
 
90
102
  ---
91
103
 
92
- ### `DoorstepAI.startDeliveryByPlaceID(placeID: string): Promise<void>`
104
+ ### `DoorstepAI.startDeliveryByPlaceID(placeID: string, deliveryId: string): Promise<string>`
93
105
 
94
- Starts a delivery using a Google Place ID.
106
+ Starts a delivery using a Google Place ID. Returns a session ID on success.
95
107
 
96
108
  ---
97
109
 
98
- ### `DoorstepAI.startDeliveryByPlusCode(plusCode: string): Promise<void>`
110
+ ### `DoorstepAI.startDeliveryByPlusCode(plusCode: string, deliveryId: string): Promise<string>`
99
111
 
100
- Starts a delivery using a Google Plus Code.
112
+ Starts a delivery using a Google Plus Code. Returns a session ID on success.
101
113
 
102
114
  ---
103
115
 
104
- ### `DoorstepAI.startDeliveryByAddress(address: AddressType): Promise<void>`
116
+ ### `DoorstepAI.startDeliveryByAddress(address: AddressType, deliveryId: string): Promise<string>`
105
117
 
106
- Starts a delivery using a structured address object.
118
+ Starts a delivery using a structured address object. Returns a session ID on success.
107
119
 
108
120
  ```ts
109
121
  type AddressType = {
110
122
  streetNumber: string;
111
123
  route: string;
112
- locality: string;
113
- administrativeAreaLevel1: string;
124
+ subPremise: string; // Apartment, suite, unit, etc.
125
+ locality: string; // City
126
+ administrativeAreaLevel1: string; // State/Province
114
127
  postalCode: string;
115
128
  }
116
129
  ```
117
130
 
118
131
  ---
119
132
 
120
- ### `DoorstepAI.stopDelivery(): Promise<void>`
133
+ ### `DoorstepAI.stopDelivery(deliveryId: string): Promise<void>`
121
134
 
122
- Stops the current delivery.
135
+ Stops the specified delivery.
123
136
 
124
137
  ---
125
138
 
126
- ### `DoorstepAI.newEvent(eventName: string): Promise<void>`
139
+ ### `DoorstepAI.newEvent(eventName: string, deliveryId: string): Promise<void>`
127
140
 
128
- Sends a delivery-related event. Supported events include:
141
+ Sends a delivery-related event for the specified delivery. Supported events include:
129
142
  - `"taking_pod"`
130
143
  - `"pod_captured"`
131
144
 
@@ -138,6 +151,8 @@ More can be added per vender/customer relationship.
138
151
  - Always wrap `DoorstepAI` API calls in `try/catch` or use `.catch()` for better error handling when applicable.
139
152
  - Use the `RootDoorstepAI` component only **once** at the **root** of your app.
140
153
  - Ensure your API key is securely stored and never hardcoded in production.
154
+ - Always provide a unique `deliveryId` for each delivery session.
155
+ - Keep track of the `deliveryId` throughout the delivery lifecycle as it's required for all operations.
141
156
 
142
157
  ---
143
158
 
@@ -148,8 +163,7 @@ If something isn't working as expected:
148
163
  - Check console logs for `DoorstepAI initialized` or error messages.
149
164
  - Verify that the API key is valid and accepted by the SDK.
150
165
  - Ensure your permissions (e.g., location) are correctly set up on the device.
151
-
152
- ---
166
+ - Verify that you're using the correct `deliveryId` for each operation.
153
167
 
154
168
  ---
155
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doorstepai/dropoff-sdk",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "doorstep.ai dropoff sdk for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",