@doorstepai/dropoff-sdk-capacitor 1.0.0 → 1.0.2

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 +57 -7
  4. package/dist/docs.json +35 -0
  5. package/dist/esm/definitions.d.ts +51 -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,22 @@ 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
+ val manualForeground = call.getBoolean("manualForeground", false) ?: false
111
+ Log.d(TAG, "startDeliveryByPlaceID: placeID=$placeID deliveryId=$deliveryId timeout=$timeoutSeconds customerId=$customerId autoStop=$autoStopAfterDropoffSeconds manualForeground=$manualForeground")
109
112
  if (placeID == null || deliveryId == null) {
110
113
  return call.reject("placeID or deliveryId missing", "BAD_ARGS")
111
114
  }
112
115
  try {
113
- DoorstepAI.startDeliveryByPlaceID(placeID, deliveryId, timeoutSeconds) { sdkResult ->
116
+ DoorstepAI.startDeliveryByPlaceID(
117
+ placeID = placeID,
118
+ deliveryId = deliveryId,
119
+ timeoutSeconds = timeoutSeconds,
120
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
121
+ customerId = customerId,
122
+ manualForeground = manualForeground,
123
+ ) { sdkResult ->
114
124
  sdkResult.onSuccess { call.resolve() }
115
125
  .onFailure { error ->
116
126
  call.reject(error.message ?: "Failed to start delivery by Place ID", "DELIVERY_ERROR")
@@ -126,11 +136,19 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
126
136
  val plusCode = call.getString("plusCode")
127
137
  val deliveryId = call.getString("deliveryId")
128
138
  val timeoutSeconds = call.getDouble("timeoutSeconds")
139
+ val customerId = call.getString("customerId")
140
+ // Note: the Android SDK's Plus Code method does not accept
141
+ // autoStopAfterDropoffSeconds, so it is intentionally not forwarded here.
129
142
  if (plusCode == null || deliveryId == null) {
130
143
  return call.reject("plusCode or deliveryId missing", "BAD_ARGS")
131
144
  }
132
145
  try {
133
- DoorstepAI.startDeliveryByPlusCode(plusCode, deliveryId, timeoutSeconds) { sdkResult ->
146
+ DoorstepAI.startDeliveryByPlusCode(
147
+ plusCode = plusCode,
148
+ deliveryId = deliveryId,
149
+ timeoutSeconds = timeoutSeconds,
150
+ customerId = customerId,
151
+ ) { sdkResult ->
134
152
  sdkResult.onSuccess { call.resolve() }
135
153
  .onFailure { error ->
136
154
  call.reject(error.message ?: "Failed to start delivery by Plus Code", "DELIVERY_ERROR")
@@ -151,6 +169,9 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
151
169
  val addrObj = call.getObject("address")
152
170
  val deliveryId = call.getString("deliveryId")
153
171
  val timeoutSeconds = call.getDouble("timeoutSeconds")
172
+ val customerId = call.getString("customerId")
173
+ val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
174
+ val manualForeground = call.getBoolean("manualForeground", false) ?: false
154
175
  val coordinates = parseCoordinates(call.getObject("coordinates"))
155
176
 
156
177
  if (addrObj == null
@@ -173,7 +194,15 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
173
194
  administrativeAreaLevel1 = addrObj.getString("administrativeAreaLevel1")!!,
174
195
  postalCode = addrObj.getString("postalCode")!!,
175
196
  )
176
- DoorstepAI.startDeliveryByAddressType(addressType, deliveryId, coordinates, timeoutSeconds) { sdkResult ->
197
+ DoorstepAI.startDeliveryByAddressType(
198
+ address = addressType,
199
+ deliveryId = deliveryId,
200
+ coordinates = coordinates,
201
+ timeoutSeconds = timeoutSeconds,
202
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
203
+ customerId = customerId,
204
+ manualForeground = manualForeground,
205
+ ) { sdkResult ->
177
206
  sdkResult.onSuccess { call.resolve() }
178
207
  .onFailure { error ->
179
208
  call.reject(error.message ?: "Failed to start delivery by address", "DELIVERY_ERROR")
@@ -189,12 +218,23 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
189
218
  val address = call.getString("address")
190
219
  val deliveryId = call.getString("deliveryId")
191
220
  val timeoutSeconds = call.getDouble("timeoutSeconds")
221
+ val customerId = call.getString("customerId")
222
+ val autoStopAfterDropoffSeconds = call.getDouble("autoStopAfterDropoffSeconds")
223
+ val manualForeground = call.getBoolean("manualForeground", false) ?: false
192
224
  val coordinates = parseCoordinates(call.getObject("coordinates"))
193
225
  if (address == null || deliveryId == null) {
194
226
  return call.reject("address or deliveryId missing", "BAD_ARGS")
195
227
  }
196
228
  try {
197
- DoorstepAI.startDeliveryByAddressString(address, deliveryId, coordinates, timeoutSeconds) { sdkResult ->
229
+ DoorstepAI.startDeliveryByAddressString(
230
+ address = address,
231
+ deliveryId = deliveryId,
232
+ coordinates = coordinates,
233
+ timeoutSeconds = timeoutSeconds,
234
+ autoStopAfterDropoffSeconds = autoStopAfterDropoffSeconds,
235
+ customerId = customerId,
236
+ manualForeground = manualForeground,
237
+ ) { sdkResult ->
198
238
  sdkResult.onSuccess { call.resolve() }
199
239
  .onFailure { error ->
200
240
  call.reject(error.message ?: "Failed to start delivery by address string", "DELIVERY_ERROR")
@@ -212,12 +252,22 @@ class DoorstepAIDropoffSDKPlugin : Plugin() {
212
252
  val subUnit = call.getString("subUnit") ?: ""
213
253
  val deliveryId = call.getString("deliveryId")
214
254
  val timeoutSeconds = call.getDouble("timeoutSeconds")
215
- Log.d(TAG, "startDeliveryByLatLng: lat=$latitude lng=$longitude subUnit='$subUnit' deliveryId=$deliveryId timeout=$timeoutSeconds")
255
+ val customerId = call.getString("customerId")
256
+ // Note: the Android SDK's LatLng method does not accept
257
+ // autoStopAfterDropoffSeconds, so it is intentionally not forwarded here.
258
+ Log.d(TAG, "startDeliveryByLatLng: lat=$latitude lng=$longitude subUnit='$subUnit' deliveryId=$deliveryId timeout=$timeoutSeconds customerId=$customerId")
216
259
  if (latitude == null || longitude == null || deliveryId == null) {
217
260
  return call.reject("latitude, longitude or deliveryId missing", "BAD_ARGS")
218
261
  }
219
262
  try {
220
- DoorstepAI.startDeliveryByLatLng(latitude, longitude, subUnit, deliveryId, timeoutSeconds) { sdkResult ->
263
+ DoorstepAI.startDeliveryByLatLng(
264
+ latitude = latitude,
265
+ longitude = longitude,
266
+ subUnit = subUnit,
267
+ deliveryId = deliveryId,
268
+ timeoutSeconds = timeoutSeconds,
269
+ customerId = customerId,
270
+ ) { sdkResult ->
221
271
  sdkResult.onSuccess { call.resolve() }
222
272
  .onFailure { error ->
223
273
  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,80 @@ 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
+ /**
41
+ * Android-only option shared by every `startDelivery*` method.
42
+ */
43
+ declare type ManualForegroundOption = {
44
+ /**
45
+ * Android only: when `true`, the host app is responsible for its own
46
+ * foreground service/notification and the SDK will not start a second one.
47
+ * Ignored on iOS. Defaults to `false`.
48
+ */
49
+ manualForeground?: boolean;
50
+ };
51
+ export interface StartDeliveryByPlaceIDOptions extends CustomerIdOption, ManualForegroundOption {
34
52
  placeID: string;
35
53
  deliveryId: string;
36
54
  timeoutSeconds?: number;
55
+ /**
56
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
57
+ * Optional; if omitted the SDK's remote config value applies.
58
+ */
59
+ autoStopAfterDropoffSeconds?: number;
37
60
  }
38
- export interface StartDeliveryByPlusCodeOptions {
61
+ export interface StartDeliveryByPlusCodeOptions extends CustomerIdOption {
39
62
  plusCode: string;
40
63
  deliveryId: string;
41
64
  timeoutSeconds?: number;
65
+ /**
66
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
67
+ * iOS only — the Android SDK does not accept this on the (deprecated)
68
+ * Plus Code method, where it is ignored.
69
+ */
70
+ autoStopAfterDropoffSeconds?: number;
42
71
  }
43
- export interface StartDeliveryByAddressOptions {
72
+ export interface StartDeliveryByAddressOptions extends CustomerIdOption, ManualForegroundOption {
44
73
  address: AddressType;
45
74
  deliveryId: string;
46
75
  coordinates?: LatLngObject;
47
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;
48
82
  }
49
- export interface StartDeliveryByAddressStringOptions {
83
+ export interface StartDeliveryByAddressStringOptions extends CustomerIdOption, ManualForegroundOption {
50
84
  address: string;
51
85
  deliveryId: string;
52
86
  coordinates?: LatLngObject;
53
87
  timeoutSeconds?: number;
88
+ /**
89
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
90
+ * Optional; if omitted the SDK's remote config value applies.
91
+ */
92
+ autoStopAfterDropoffSeconds?: number;
54
93
  }
55
- export interface StartDeliveryByLatLngOptions {
94
+ export interface StartDeliveryByLatLngOptions extends CustomerIdOption {
56
95
  latitude: number;
57
96
  longitude: number;
58
97
  /** Apartment / unit. Optional, defaults to `""`. */
59
98
  subUnit?: string;
60
99
  deliveryId: string;
61
100
  timeoutSeconds?: number;
101
+ /**
102
+ * Auto-stop the delivery this many seconds after a dropoff is detected.
103
+ * iOS only — the Android SDK does not accept this on the (deprecated)
104
+ * LatLng method, where it is ignored.
105
+ */
106
+ autoStopAfterDropoffSeconds?: number;
62
107
  }
63
108
  export interface MarkDropoffOptions {
64
109
  deliveryId: string;
@@ -113,3 +158,4 @@ export interface DoorstepAIDropoffSDKPlugin {
113
158
  */
114
159
  requestPermissions(options?: PermissionRequestOptions): Promise<PermissionStatus>;
115
160
  }
161
+ export {};