@doorstepai/dropoff-sdk-capacitor 1.0.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.
Files changed (30) hide show
  1. package/README.md +29 -2
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/ai/doorstep/dropoffsdk/capacitor/DoorstepAIDropoffSDKPlugin.kt +51 -7
  4. package/dist/docs.json +35 -0
  5. package/dist/esm/definitions.d.ts +40 -5
  6. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  7. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
  8. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +260 -178
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +7 -7
  10. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +7 -7
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2113 -2103
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +260 -178
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +7 -7
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -7
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +260 -178
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +7 -7
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +7 -7
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2113 -2103
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2102 -2093
  29. package/ios/Plugin/DoorstepAIDropoffSDKPlugin.swift +19 -5
  30. package/package.json +2 -2
package/README.md CHANGED
@@ -131,9 +131,36 @@ await DoorstepAIDropoffSDK.startDeliveryByLatLng({
131
131
  });
132
132
  ```
133
133
 
134
- > All `startDelivery*` methods accept an optional `timeoutSeconds` to bound the
135
- > destination resolution step. The address-based methods also accept an optional
134
+ > **Shared optional fields** every `startDelivery*` method also accepts:
135
+ >
136
+ > - `customerId?: string` — your identifier for the customer on this delivery.
137
+ > - `autoStopAfterDropoffSeconds?: number` — auto-stops tracking the given
138
+ > number of seconds after `markDropoff` is called. If omitted, the SDK falls
139
+ > back to zero seconds, effectively no timeout.
140
+ > _On Android this is honored by `startDeliveryByPlaceID`,
141
+ > `startDeliveryByAddress(String)` and `startDeliveryByAddressType`; the
142
+ > (deprecated) `startDeliveryByPlusCode` and `startDeliveryByLatLng` methods
143
+ > ignore it. iOS honors it everywhere._
144
+ > - `timeoutSeconds?: number` — auto-stops tracking after the given duration, as
145
+ > a backstop in case an exit geofence is missed.
146
+ >
147
+ > The address-based methods additionally accept an optional
136
148
  > `coordinates: { lat, lng }` hint to skip geocoding when you already have it.
149
+ >
150
+ > ```ts
151
+ > await DoorstepAIDropoffSDK.startDeliveryByAddress({
152
+ > address: {
153
+ > streetNumber: '123',
154
+ > route: 'Main St',
155
+ > locality: 'New York',
156
+ > administrativeAreaLevel1: 'NY',
157
+ > postalCode: '10001',
158
+ > },
159
+ > deliveryId: 'unique_delivery_id',
160
+ > customerId: 'customer_42', // optional
161
+ > autoStopAfterDropoffSeconds: 120, // optional
162
+ > });
163
+ > ```
137
164
 
138
165
  ### `newEvent`
139
166
 
@@ -43,6 +43,6 @@ dependencies {
43
43
  implementation "com.capacitorjs:core:$capacitorAndroidVersion"
44
44
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
45
45
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
46
- implementation "ai.doorstep.com:doorstepai-dropoff-sdk:2.0.6"
46
+ implementation "ai.doorstep.com:doorstepai-dropoff-sdk:2.0.9"
47
47
  testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.0"
48
48
  }
@@ -105,12 +105,20 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
105
105
  val placeID = call.getString("placeID")
106
106
  val deliveryId = call.getString("deliveryId")
107
107
  val timeoutSeconds = call.getDouble("timeoutSeconds")
108
- Log.d(TAG, "startDeliveryByPlaceID: placeID=$placeID deliveryId=$deliveryId timeout=$timeoutSeconds")
108
+ val customerId = call.getString("customerId")
109
+ val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
110
+ Log.d(TAG, "startDeliveryByPlaceID: placeID=$placeID deliveryId=$deliveryId timeout=$timeoutSeconds customerId=$customerId autoStop=$autoStopAfterDropoffSeconds")
109
111
  if (placeID == null || deliveryId == null) {
110
112
  return call.reject("placeID or deliveryId missing", "BAD_ARGS")
111
113
  }
112
114
  try {
113
- DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds) { sdkResult ->
115
+ DoorstepAI.startDeliveryByPlaceID(
116
+ placeID = placeID,
117
+ deliveryId = deliveryId,
118
+ timeoutSeconds = timeoutSeconds,
119
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
120
+ customerId = customerId,
121
+ ) { sdkResult ->
114
122
  sdkResult.onSuccess { call.resolve() }
115
123
  .onFailure { error ->
116
124
  call.reject(error.message ?: "Failed to start delivery by Place ID", "DELIVERY_ERROR")
@@ -126,11 +134,19 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
126
134
  val plusCode = call.getString("plusCode")
127
135
  val deliveryId = call.getString("deliveryId")
128
136
  val timeoutSeconds = call.getDouble("timeoutSeconds")
137
+ val customerId = call.getString("customerId")
138
+ // Note: the Android SDK's Plus Code method does not accept
139
+ // autoStopAfterDropoffSeconds, so it is intentionally not forwarded here.
129
140
  if (plusCode == null || deliveryId == null) {
130
141
  return call.reject("plusCode or deliveryId missing", "BAD_ARGS")
131
142
  }
132
143
  try {
133
- DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds) { sdkResult ->
144
+ DoorstepAI.startDeliveryByPlusCode(
145
+ plusCode = plusCode,
146
+ deliveryId = deliveryId,
147
+ timeoutSeconds = timeoutSeconds,
148
+ customerId = customerId,
149
+ ) { sdkResult ->
134
150
  sdkResult.onSuccess { call.resolve() }
135
151
  .onFailure { error ->
136
152
  call.reject(error.message ?: "Failed to start delivery by Plus Code", "DELIVERY_ERROR")
@@ -151,6 +167,8 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
151
167
  val addrObj = call.getObject("address")
152
168
  val deliveryId = call.getString("deliveryId")
153
169
  val timeoutSeconds = call.getDouble("timeoutSeconds")
170
+ val customerId = call.getString("customerId")
171
+ val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
154
172
  val coordinates = parseCoordinates(call.getObject("coordinates"))
155
173
 
156
174
  if (addrObj == null
@@ -173,7 +191,14 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
173
191
  administrativeAreaLevel1 = addrObj.getString("administrativeAreaLevel1")!!,
174
192
  postalCode = addrObj.getString("postalCode")!!,
175
193
  )
176
- DoorstepAI.startDeliveryByAddressType(addressType, deliveryId, coordinates, timeoutSeconds) { sdkResult ->
194
+ DoorstepAI.startDeliveryByAddressType(
195
+ address = addressType,
196
+ deliveryId = deliveryId,
197
+ coordinates = coordinates,
198
+ timeoutSeconds = timeoutSeconds,
199
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
200
+ customerId = customerId,
201
+ ) { sdkResult ->
177
202
  sdkResult.onSuccess { call.resolve() }
178
203
  .onFailure { error ->
179
204
  call.reject(error.message ?: "Failed to start delivery by address", "DELIVERY_ERROR")
@@ -189,12 +214,21 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
189
214
  val address = call.getString("address")
190
215
  val deliveryId = call.getString("deliveryId")
191
216
  val timeoutSeconds = call.getDouble("timeoutSeconds")
217
+ val customerId = call.getString("customerId")
218
+ val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
192
219
  val coordinates = parseCoordinates(call.getObject("coordinates"))
193
220
  if (address == null || deliveryId == null) {
194
221
  return call.reject("address or deliveryId missing", "BAD_ARGS")
195
222
  }
196
223
  try {
197
- DoorstepAI.startDeliveryByAddressString(address, deliveryId, coordinates, timeoutSeconds) { sdkResult ->
224
+ DoorstepAI.startDeliveryByAddressString(
225
+ address = address,
226
+ deliveryId = deliveryId,
227
+ coordinates = coordinates,
228
+ timeoutSeconds = timeoutSeconds,
229
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
230
+ customerId = customerId,
231
+ ) { sdkResult ->
198
232
  sdkResult.onSuccess { call.resolve() }
199
233
  .onFailure { error ->
200
234
  call.reject(error.message ?: "Failed to start delivery by address string", "DELIVERY_ERROR")
@@ -212,12 +246,22 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
212
246
  val subUnit = call.getString("subUnit") ?: ""
213
247
  val deliveryId = call.getString("deliveryId")
214
248
  val timeoutSeconds = call.getDouble("timeoutSeconds")
215
- Log.d(TAG, "startDeliveryByLatLng: lat=$latitude lng=$longitude subUnit='$subUnit' deliveryId=$deliveryId timeout=$timeoutSeconds")
249
+ val customerId = call.getString("customerId")
250
+ // Note: the Android SDK's LatLng method does not accept
251
+ // autoStopAfterDropoffSeconds, so it is intentionally not forwarded here.
252
+ Log.d(TAG, "startDeliveryByLatLng: lat=$latitude lng=$longitude subUnit='$subUnit' deliveryId=$deliveryId timeout=$timeoutSeconds customerId=$customerId")
216
253
  if (latitude == null || longitude == null || deliveryId == null) {
217
254
  return call.reject("latitude, longitude or deliveryId missing", "BAD_ARGS")
218
255
  }
219
256
  try {
220
- DoorstepAI.startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds) { sdkResult ->
257
+ DoorstepAI.startDeliveryByLatLng(
258
+ latitude = latitude,
259
+ longitude = longitude,
260
+ subUnit = subUnit,
261
+ deliveryId = deliveryId,
262
+ timeoutSeconds = timeoutSeconds,
263
+ customerId = customerId,
264
+ ) { sdkResult ->
221
265
  sdkResult.onSuccess { call.resolve() }
222
266
  .onFailure { error ->
223
267
  call.reject(error.message ?: "Failed to start delivery by LatLng", "DELIVERY_ERROR")
package/dist/docs.json CHANGED
@@ -304,6 +304,13 @@
304
304
  "docs": "",
305
305
  "complexTypes": [],
306
306
  "type": "number | undefined"
307
+ },
308
+ {
309
+ "name": "autoStopAfterDropoffSeconds",
310
+ "tags": [],
311
+ "docs": "Auto-stop the delivery this many seconds after a dropoff is detected.\nOptional; if omitted the SDK's remote config value applies.",
312
+ "complexTypes": [],
313
+ "type": "number | undefined"
307
314
  }
308
315
  ]
309
316
  },
@@ -334,6 +341,13 @@
334
341
  "docs": "",
335
342
  "complexTypes": [],
336
343
  "type": "number | undefined"
344
+ },
345
+ {
346
+ "name": "autoStopAfterDropoffSeconds",
347
+ "tags": [],
348
+ "docs": "Auto-stop the delivery this many seconds after a dropoff is detected.\niOS only — the Android SDK does not accept this on the (deprecated)\nPlus Code method, where it is ignored.",
349
+ "complexTypes": [],
350
+ "type": "number | undefined"
337
351
  }
338
352
  ]
339
353
  },
@@ -375,6 +389,13 @@
375
389
  "docs": "",
376
390
  "complexTypes": [],
377
391
  "type": "number | undefined"
392
+ },
393
+ {
394
+ "name": "autoStopAfterDropoffSeconds",
395
+ "tags": [],
396
+ "docs": "Auto-stop the delivery this many seconds after a dropoff is detected.\nOptional; if omitted the SDK's remote config value applies.",
397
+ "complexTypes": [],
398
+ "type": "number | undefined"
378
399
  }
379
400
  ]
380
401
  },
@@ -488,6 +509,13 @@
488
509
  "docs": "",
489
510
  "complexTypes": [],
490
511
  "type": "number | undefined"
512
+ },
513
+ {
514
+ "name": "autoStopAfterDropoffSeconds",
515
+ "tags": [],
516
+ "docs": "Auto-stop the delivery this many seconds after a dropoff is detected.\nOptional; if omitted the SDK's remote config value applies.",
517
+ "complexTypes": [],
518
+ "type": "number | undefined"
491
519
  }
492
520
  ]
493
521
  },
@@ -532,6 +560,13 @@
532
560
  "docs": "",
533
561
  "complexTypes": [],
534
562
  "type": "number | undefined"
563
+ },
564
+ {
565
+ "name": "autoStopAfterDropoffSeconds",
566
+ "tags": [],
567
+ "docs": "Auto-stop the delivery this many seconds after a dropoff is detected.\niOS only — the Android SDK does not accept this on the (deprecated)\nLatLng method, where it is ignored.",
568
+ "complexTypes": [],
569
+ "type": "number | undefined"
535
570
  }
536
571
  ]
537
572
  },
@@ -30,35 +30,69 @@ export interface InitOptions {
30
30
  export interface SetApiKeyOptions {
31
31
  key: string;
32
32
  }
33
- export interface StartDeliveryByPlaceIDOptions {
33
+ /**
34
+ * Optional caller-supplied identifier for the customer associated with the
35
+ * delivery. Forwarded verbatim to the native SDK. Optional on every platform.
36
+ */
37
+ declare type CustomerIdOption = {
38
+ customerId?: string;
39
+ };
40
+ export interface StartDeliveryByPlaceIDOptions extends CustomerIdOption {
34
41
  placeID: string;
35
42
  deliveryId: string;
36
43
  timeoutSeconds?: number;
44
+ /**
45
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
46
+ * Optional; if omitted the SDK's remote config value applies.
47
+ */
48
+ autoStopAfterDropoffSeconds?: number;
37
49
  }
38
- export interface StartDeliveryByPlusCodeOptions {
50
+ export interface StartDeliveryByPlusCodeOptions extends CustomerIdOption {
39
51
  plusCode: string;
40
52
  deliveryId: string;
41
53
  timeoutSeconds?: number;
54
+ /**
55
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
56
+ * iOS only — the Android SDK does not accept this on the (deprecated)
57
+ * Plus Code method, where it is ignored.
58
+ */
59
+ autoStopAfterDropoffSeconds?: number;
42
60
  }
43
- export interface StartDeliveryByAddressOptions {
61
+ export interface StartDeliveryByAddressOptions extends CustomerIdOption {
44
62
  address: AddressType;
45
63
  deliveryId: string;
46
64
  coordinates?: LatLngObject;
47
65
  timeoutSeconds?: number;
66
+ /**
67
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
68
+ * Optional; if omitted the SDK's remote config value applies.
69
+ */
70
+ autoStopAfterDropoffSeconds?: number;
48
71
  }
49
- export interface StartDeliveryByAddressStringOptions {
72
+ export interface StartDeliveryByAddressStringOptions extends CustomerIdOption {
50
73
  address: string;
51
74
  deliveryId: string;
52
75
  coordinates?: LatLngObject;
53
76
  timeoutSeconds?: number;
77
+ /**
78
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
79
+ * Optional; if omitted the SDK's remote config value applies.
80
+ */
81
+ autoStopAfterDropoffSeconds?: number;
54
82
  }
55
- export interface StartDeliveryByLatLngOptions {
83
+ export interface StartDeliveryByLatLngOptions extends CustomerIdOption {
56
84
  latitude: number;
57
85
  longitude: number;
58
86
  /** Apartment / unit. Optional, defaults to `""`. */
59
87
  subUnit?: string;
60
88
  deliveryId: string;
61
89
  timeoutSeconds?: number;
90
+ /**
91
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
92
+ * iOS only — the Android SDK does not accept this on the (deprecated)
93
+ * LatLng method, where it is ignored.
94
+ */
95
+ autoStopAfterDropoffSeconds?: number;
62
96
  }
63
97
  export interface MarkDropoffOptions {
64
98
  deliveryId: string;
@@ -113,3 +147,4 @@ export interface DoorstepAIDropoffSDKPlugin {
113
147
  */
114
148
  requestPermissions(options?: PermissionRequestOptions): Promise<PermissionStatus>;
115
149
  }
150
+ export {};