@doorstepai/dropoff-sdk-capacitor 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.
Files changed (57) hide show
  1. package/DoorstepaiDropoffSdkCapacitor.podspec +22 -0
  2. package/LICENSE +20 -0
  3. package/README.md +401 -0
  4. package/android/build.gradle +48 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/java/ai/doorstep/dropoffsdk/capacitor/DoorstepAIDropoffSDKPlugin.kt +291 -0
  7. package/dist/docs.json +705 -0
  8. package/dist/esm/definitions.d.ts +115 -0
  9. package/dist/esm/definitions.js +2 -0
  10. package/dist/esm/definitions.js.map +1 -0
  11. package/dist/esm/index.d.ts +4 -0
  12. package/dist/esm/index.js +27 -0
  13. package/dist/esm/index.js.map +1 -0
  14. package/dist/esm/web.d.ts +23 -0
  15. package/dist/esm/web.js +51 -0
  16. package/dist/esm/web.js.map +1 -0
  17. package/dist/plugin.cjs.js +87 -0
  18. package/dist/plugin.cjs.js.map +1 -0
  19. package/dist/plugin.js +90 -0
  20. package/dist/plugin.js.map +1 -0
  21. package/ios/DoorstepDropoffSDK.xcframework/Info.plist +48 -0
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Headers/DoorstepDropoffSDK.h +19 -0
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Headers/RateReducer.h +117 -0
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +5281 -0
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +117 -0
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  29. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +117 -0
  30. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/module.modulemap +6 -0
  31. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
  32. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +201 -0
  33. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Info.plist +20 -0
  34. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  35. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2108 -0
  36. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  37. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Headers/DoorstepDropoffSDK.h +19 -0
  38. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Headers/RateReducer.h +117 -0
  39. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  40. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +5281 -0
  41. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +117 -0
  42. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  43. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +117 -0
  44. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +5281 -0
  45. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +117 -0
  46. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  47. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +117 -0
  48. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/module.modulemap +6 -0
  49. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/PrivacyInfo.xcprivacy +39 -0
  50. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +256 -0
  51. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Info.plist +20 -0
  52. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  53. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2108 -0
  54. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2098 -0
  55. package/ios/Plugin/DoorstepAIDropoffSDKPlugin.m +22 -0
  56. package/ios/Plugin/DoorstepAIDropoffSDKPlugin.swift +313 -0
  57. package/package.json +78 -0
@@ -0,0 +1,22 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'DoorstepaiDropoffSdkCapacitor'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m}'
14
+ s.ios.deployment_target = '14.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.9'
17
+ s.vendored_frameworks = 'ios/DoorstepDropoffSDK.xcframework'
18
+ s.pod_target_xcconfig = {
19
+ 'DEFINES_MODULE' => 'YES',
20
+ 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386'
21
+ }
22
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Proprietary Software License
2
+
3
+ Copyright (c) 2024 Doing Doorstep Better, Inc.. All Rights Reserved.
4
+
5
+ This software and associated documentation files (the "Software") are proprietary and confidential.
6
+ The Software is protected by copyright laws and international copyright treaties, as well as other
7
+ intellectual property laws and treaties.
8
+
9
+ No part of this Software may be reproduced, distributed, or transmitted in any form or by any means,
10
+ including photocopying, recording, or other electronic or mechanical methods, without the prior
11
+ written permission of DoorstepAI.
12
+
13
+ Unauthorized copying, modification, distribution, or use of this Software, via any medium, is
14
+ strictly prohibited and will be prosecuted to the maximum extent possible under the law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
17
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,401 @@
1
+ # DoorstepAI Dropoff SDK for Capacitor
2
+
3
+ The `@doorstepai/dropoff-sdk-capacitor` package provides Capacitor bindings to DoorstepAI's Dropoff SDK, enabling delivery tracking functionality through the Capacitor bridge and native platform integration.
4
+
5
+ ## 📦 Installation
6
+
7
+ Add the SDK to your Capacitor app:
8
+
9
+ ```bash
10
+ npm install @doorstepai/dropoff-sdk-capacitor
11
+ npx cap sync
12
+ ```
13
+
14
+ ---
15
+
16
+ ## 🔌 Imports
17
+
18
+ In your TypeScript/JavaScript code, import the SDK:
19
+
20
+ ```ts
21
+ import {
22
+ DoorstepAIDropoffSDK,
23
+ AddressType,
24
+ } from '@doorstepai/dropoff-sdk-capacitor';
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 🗺️ AddressType
30
+
31
+ A helper interface to represent a structured address for deliveries:
32
+
33
+ ```ts
34
+ interface AddressType {
35
+ streetNumber: string;
36
+ route: string;
37
+ subPremise?: string; // optional
38
+ locality: string;
39
+ administrativeAreaLevel1: string;
40
+ postalCode: string;
41
+ }
42
+ ```
43
+
44
+ ---
45
+
46
+ ## 🚚 DoorstepAI API
47
+
48
+ All calls go through the Capacitor bridge under the plugin name `DoorstepAIDropoffSDK`. Be sure to `await` each call and wrap in `try/catch`.
49
+
50
+ ### `init` (Android Only)
51
+
52
+ Initializes the native SDK on Android. This is automatically called by `bootstrapDoorstepAI`, so you typically don't need to call this directly.
53
+
54
+ ```ts
55
+ // Android only: call once before any other API methods
56
+ await DoorstepAIDropoffSDK.init({
57
+ notificationTitle: 'Delivery in progress', // optional
58
+ notificationText: 'Tap to return to the app', // optional
59
+ });
60
+ ```
61
+
62
+ ### `setApiKey`
63
+
64
+ Set your DoorstepAI API key. This should be called after initialization. Again, you typically don't need to call this directly.
65
+
66
+ ```ts
67
+ await DoorstepAIDropoffSDK.setApiKey({ key: 'YOUR_API_KEY' });
68
+ ```
69
+
70
+ ### `startDeliveryByPlaceID`
71
+
72
+ Begin a delivery session using a Google Place ID:
73
+
74
+ ```ts
75
+ await DoorstepAIDropoffSDK.startDeliveryByPlaceID({
76
+ placeID: 'destination_place_id',
77
+ deliveryId: 'unique_delivery_id',
78
+ });
79
+ ```
80
+
81
+ ### `startDeliveryByPlusCode`
82
+
83
+ Begin a delivery via Google Plus Code:
84
+
85
+ ```ts
86
+ await DoorstepAIDropoffSDK.startDeliveryByPlusCode({
87
+ plusCode: 'destination_plus_code',
88
+ deliveryId: 'unique_delivery_id',
89
+ });
90
+ ```
91
+
92
+ ### `startDeliveryByAddress`
93
+
94
+ Begin a delivery with a structured address:
95
+
96
+ ```ts
97
+ await DoorstepAIDropoffSDK.startDeliveryByAddress({
98
+ address: {
99
+ streetNumber: '123',
100
+ route: 'Main St',
101
+ subPremise: 'Apt 4B',
102
+ locality: 'New York',
103
+ administrativeAreaLevel1: 'NY',
104
+ postalCode: '10001',
105
+ },
106
+ deliveryId: 'unique_delivery_id',
107
+ });
108
+ ```
109
+
110
+ ### `startDeliveryByAddressString`
111
+
112
+ Begin a delivery with a free-form address string:
113
+
114
+ ```ts
115
+ await DoorstepAIDropoffSDK.startDeliveryByAddressString({
116
+ address: '123 Main St, Apt 4B, New York, NY 10001',
117
+ deliveryId: 'unique_delivery_id',
118
+ });
119
+ ```
120
+
121
+ ### `startDeliveryByLatLng`
122
+
123
+ Begin a delivery with raw coordinates and an optional sub-unit:
124
+
125
+ ```ts
126
+ await DoorstepAIDropoffSDK.startDeliveryByLatLng({
127
+ latitude: 40.7128,
128
+ longitude: -74.006,
129
+ subUnit: 'Apt 4B', // optional
130
+ deliveryId: 'unique_delivery_id',
131
+ });
132
+ ```
133
+
134
+ > All `startDelivery*` methods accept an optional `timeoutSeconds` to bound the
135
+ > destination resolution step. The address-based methods also accept an optional
136
+ > `coordinates: { lat, lng }` hint to skip geocoding when you already have it.
137
+
138
+ ### `newEvent`
139
+
140
+ Send a delivery event (`taking_pod`, `pod_captured`, etc.):
141
+
142
+ ```ts
143
+ await DoorstepAIDropoffSDK.newEvent({
144
+ eventName: 'taking_pod',
145
+ deliveryId: 'unique_delivery_id',
146
+ });
147
+ ```
148
+
149
+ ### `markDropoff`
150
+
151
+ Mark the dropoff outcome for the active delivery as either proof-of-delivery
152
+ (`pod`) or non-POD (`non_pod`):
153
+
154
+ ```ts
155
+ await DoorstepAIDropoffSDK.markDropoff({
156
+ deliveryId: 'unique_delivery_id',
157
+ dropoffType: 'pod', // or 'non_pod'
158
+ });
159
+ ```
160
+
161
+ ### `stopDelivery`
162
+
163
+ End the delivery session:
164
+
165
+ ```ts
166
+ await DoorstepAIDropoffSDK.stopDelivery({
167
+ deliveryId: 'unique_delivery_id',
168
+ });
169
+ ```
170
+
171
+ ### `requestPermissions` / `checkPermissions`
172
+
173
+ Request or inspect the runtime permissions the SDK uses (foreground location
174
+ and activity/motion). `bootstrapDoorstepAI` calls `requestPermissions` for
175
+ you; call these directly only if you need finer-grained control.
176
+
177
+ ```ts
178
+ const status = await DoorstepAIDropoffSDK.requestPermissions({
179
+ permissions: ['location', 'activity'], // omit to request all
180
+ });
181
+ // status.location, status.activity → 'granted' | 'denied' | 'prompt' | 'prompt-with-rationale'
182
+
183
+ const current = await DoorstepAIDropoffSDK.checkPermissions();
184
+ ```
185
+
186
+ ---
187
+
188
+ ## 📱 Bootstrap Helper: `bootstrapDoorstepAI`
189
+
190
+ The `bootstrapDoorstepAI` recipe handles SDK initialization, API key setting, and permission requests in one call. Run it once at app startup, before any `startDelivery*` calls.
191
+
192
+ ```ts
193
+ import { DoorstepAIDropoffSDK } from '@doorstepai/dropoff-sdk-capacitor';
194
+
195
+ async function bootstrapDoorstepAI(opts: {
196
+ apiKey: string;
197
+ notificationTitle?: string;
198
+ notificationText?: string;
199
+ }) {
200
+ await DoorstepAIDropoffSDK.init({
201
+ notificationTitle: opts.notificationTitle,
202
+ notificationText: opts.notificationText,
203
+ });
204
+ await DoorstepAIDropoffSDK.setApiKey({ key: opts.apiKey });
205
+ await DoorstepAIDropoffSDK.requestPermissions({
206
+ permissions: ['location', 'activity'],
207
+ });
208
+ }
209
+
210
+ // Call once at app startup:
211
+ await bootstrapDoorstepAI({
212
+ apiKey: 'YOUR_API_KEY',
213
+ notificationTitle: 'Tracking Delivery',
214
+ notificationText: 'Tap to return',
215
+ });
216
+ ```
217
+
218
+ ### What `bootstrapDoorstepAI` Does Automatically:
219
+
220
+ 1. **Initialization**: Calls `DoorstepAIDropoffSDK.init()` on Android (no-op on iOS).
221
+ 2. **API Key Setting**: Calls `DoorstepAIDropoffSDK.setApiKey()` with the provided key.
222
+ 3. **Permission Handling**: Requests location and activity recognition permissions.
223
+ 4. **Platform Support**: Behaves correctly on each platform — the plugin transparently mounts its hidden host view on iOS when the API key is set.
224
+
225
+ ---
226
+
227
+ ## ✅ Best Practices
228
+
229
+ - Run `bootstrapDoorstepAI` once at app startup to handle automatic initialization.
230
+ - Wrap all SDK calls in `try/catch` for robust error handling.
231
+ - Keep your `deliveryId` unique per session.
232
+ - Securely store your API key; don't hardcode it in production.
233
+ - Use the same `deliveryId` for all operations within a single delivery session.
234
+
235
+ ---
236
+
237
+ ## 🔧 Platform-Specific Setup
238
+
239
+ ### Android
240
+
241
+ Add the following permissions to `android/app/src/main/AndroidManifest.xml`:
242
+
243
+ ```xml
244
+ <uses-permission android:name="android.permission.INTERNET" />
245
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
246
+
247
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
248
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
249
+ <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
250
+
251
+ <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
252
+
253
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
254
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
255
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
256
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
257
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
258
+
259
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
260
+
261
+ <uses-feature android:name="android.hardware.sensor.accelerometer" />
262
+ <uses-feature android:name="android.hardware.sensor.gyroscope" />
263
+ <uses-feature android:name="android.hardware.sensor.barometer" />
264
+ <uses-feature android:name="android.hardware.sensor.compass" />
265
+ <uses-feature android:name="android.hardware.sensor.proximity" />
266
+ ```
267
+
268
+ ### iOS
269
+
270
+ Add usage descriptions to `ios/App/App/Info.plist`:
271
+
272
+ ```xml
273
+ <key>NSLocationWhenInUseUsageDescription</key>
274
+ <string>This app requires access to your location for enhanced delivery intelligence</string>
275
+
276
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
277
+ <string>This app requires access to your location for enhanced delivery intelligence</string>
278
+
279
+ <key>NSMotionUsageDescription</key>
280
+ <string>This app requires access to motion data for enhanced delivery intelligence</string>
281
+
282
+ <key>UIBackgroundModes</key>
283
+ <array>
284
+ <string>location</string>
285
+ </array>
286
+
287
+ ```
288
+
289
+ ---
290
+
291
+ ## 🧪 Example App
292
+
293
+ A working Capacitor + Next.js + Ionic example app lives in `example/`. It
294
+ exposes one card per public SDK method so you can drive a delivery end-to-end.
295
+
296
+ ### Setup
297
+
298
+ ```bash
299
+ cd example
300
+ cp .env.example .env.local # set NEXT_PUBLIC_DOORSTEPAI_API_KEY
301
+ npm install
302
+ npx cap add ios # first time only
303
+ npx cap add android # first time only
304
+ ```
305
+
306
+ ### Build & run
307
+
308
+ ```bash
309
+ # from example/
310
+ npm run build && npm run sync && npm run ios # or: npm run android
311
+ ```
312
+
313
+ ### Permissions after first launch
314
+
315
+ iOS only shows each permission prompt **once per install**. If the user
316
+ denied (or the prompt didn't appear because an earlier build was missing the
317
+ required `Info.plist` keys), grant manually:
318
+
319
+ - **iOS** — Settings → Privacy & Security → Location Services → DoorstepAI
320
+ Dropoff Example → "While Using" or "Always" (Always is required for
321
+ background tracking; the plugin doesn't request it directly). Then Motion &
322
+ Fitness → toggle on.
323
+ - **Android** — Settings → Apps → DoorstepAI Dropoff Example → Permissions
324
+ → enable Location and Physical activity.
325
+
326
+ To reset for testing, delete the app and reinstall.
327
+
328
+ ---
329
+
330
+ ## 🧪 Debugging
331
+
332
+ - Check your debug console for errors thrown by `try/catch` blocks.
333
+ - On Android, verify notification permissions and channel configuration.
334
+ - Use the example app in the `example/` directory to test functionality.
335
+
336
+ ---
337
+
338
+ ## 📋 Complete Example
339
+
340
+ ```ts
341
+ import {
342
+ DoorstepAIDropoffSDK,
343
+ AddressType,
344
+ } from '@doorstepai/dropoff-sdk-capacitor';
345
+
346
+ async function bootstrapDoorstepAI(opts: {
347
+ apiKey: string;
348
+ notificationTitle?: string;
349
+ notificationText?: string;
350
+ }) {
351
+ await DoorstepAIDropoffSDK.init({
352
+ notificationTitle: opts.notificationTitle,
353
+ notificationText: opts.notificationText,
354
+ });
355
+ await DoorstepAIDropoffSDK.setApiKey({ key: opts.apiKey });
356
+ await DoorstepAIDropoffSDK.requestPermissions({
357
+ permissions: ['location', 'activity'],
358
+ });
359
+ }
360
+
361
+ let currentDeliveryId: string | null = null;
362
+
363
+ async function startDelivery() {
364
+ try {
365
+ const deliveryId = `delivery_${Date.now()}`;
366
+
367
+ await DoorstepAIDropoffSDK.startDeliveryByAddress({
368
+ address: {
369
+ streetNumber: '123',
370
+ route: 'Main St',
371
+ locality: 'New York',
372
+ administrativeAreaLevel1: 'NY',
373
+ postalCode: '10001',
374
+ },
375
+ deliveryId,
376
+ });
377
+
378
+ currentDeliveryId = deliveryId;
379
+ } catch (e) {
380
+ console.error('Error starting delivery:', e);
381
+ }
382
+ }
383
+
384
+ async function stopDelivery() {
385
+ if (currentDeliveryId !== null) {
386
+ try {
387
+ await DoorstepAIDropoffSDK.stopDelivery({ deliveryId: currentDeliveryId });
388
+ currentDeliveryId = null;
389
+ } catch (e) {
390
+ console.error('Error stopping delivery:', e);
391
+ }
392
+ }
393
+ }
394
+
395
+ // At app startup:
396
+ await bootstrapDoorstepAI({
397
+ apiKey: 'YOUR_API_KEY',
398
+ notificationTitle: 'Delivery Update',
399
+ notificationText: 'Your driver is approaching',
400
+ });
401
+ ```
@@ -0,0 +1,48 @@
1
+ ext {
2
+ capacitorAndroidVersion = project.hasProperty('capacitorAndroidVersion') ? rootProject.ext.capacitorAndroidVersion : '7.0.0'
3
+ }
4
+
5
+ buildscript {
6
+ ext.kotlin_version = '1.9.25'
7
+ repositories {
8
+ google()
9
+ mavenCentral()
10
+ }
11
+ dependencies {
12
+ classpath 'com.android.tools.build:gradle:8.7.2'
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ apply plugin: 'com.android.library'
18
+ apply plugin: 'kotlin-android'
19
+
20
+ android {
21
+ namespace 'ai.doorstep.dropoffsdk.capacitor'
22
+ compileSdk project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.compileSdkVersion : 35
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.targetSdkVersion : 35
26
+ }
27
+ compileOptions {
28
+ sourceCompatibility JavaVersion.VERSION_21
29
+ targetCompatibility JavaVersion.VERSION_21
30
+ }
31
+ kotlinOptions {
32
+ jvmTarget = JavaVersion.VERSION_21.toString()
33
+ }
34
+ }
35
+
36
+ repositories {
37
+ google()
38
+ mavenCentral()
39
+ }
40
+
41
+ dependencies {
42
+ implementation "androidx.appcompat:appcompat:1.6.1"
43
+ implementation "com.capacitorjs:core:$capacitorAndroidVersion"
44
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
45
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
46
+ implementation "ai.doorstep.com:doorstepai-dropoff-sdk:2.0.6"
47
+ testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
48
+ }
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+ </manifest>