@doorstepai/dropoff-sdk 2.2.7 → 2.2.8
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.
- package/README.md +35 -10
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +41 -6
- package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepEmbedViewManager.kt +63 -0
- package/ios/DoorstepAI.mm +10 -0
- package/ios/DoorstepAI.swift +50 -6
- package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -5
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +10 -10
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +5069 -3867
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +12846 -6562
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +142 -9
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +20 -20
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +5064 -3862
- package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +5032 -3836
- package/ios/DoorstepEmbedViewManager.mm +9 -0
- package/ios/DoorstepEmbedViewManager.swift +46 -5
- package/lib/module/DoorstepAI.js +21 -2
- package/lib/module/DoorstepAI.js.map +1 -1
- package/lib/module/DoorstepEmbedView.js +19 -1
- package/lib/module/DoorstepEmbedView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/DoorstepAI.d.ts +26 -8
- package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
- package/lib/typescript/src/DoorstepEmbedView.d.ts +32 -3
- package/lib/typescript/src/DoorstepEmbedView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DoorstepAI.tsx +42 -7
- package/src/DoorstepEmbedView.tsx +58 -9
- package/src/index.tsx +2 -0
package/README.md
CHANGED
|
@@ -142,7 +142,6 @@ DoorstepAI.setDoorstepGoApiKey('YOUR_DOORSTEP_GO_API_KEY');
|
|
|
142
142
|
<DoorstepEmbedView
|
|
143
143
|
address="1600 Pennsylvania Avenue NW, Washington, DC"
|
|
144
144
|
deliveryID="delivery-123"
|
|
145
|
-
mode="preview"
|
|
146
145
|
inlineHeight={300}
|
|
147
146
|
expandedHeight={600}
|
|
148
147
|
linkAPI="https://api.core.doorstep.ai"
|
|
@@ -152,7 +151,9 @@ DoorstepAI.setDoorstepGoApiKey('YOUR_DOORSTEP_GO_API_KEY');
|
|
|
152
151
|
polygonColor="#3291BC"
|
|
153
152
|
parkingColor="#FF847B"
|
|
154
153
|
onModeChanged={(mode) => console.log('embed mode', mode)}
|
|
155
|
-
|
|
154
|
+
onLoading={() => console.log('embed loading')}
|
|
155
|
+
onSuccess={() => console.log('embed ready')}
|
|
156
|
+
onError={(message, error) => console.warn(error.code, error.stage, message)}
|
|
156
157
|
/>
|
|
157
158
|
```
|
|
158
159
|
|
|
@@ -163,6 +164,17 @@ prop. The component defaults its height to the active mode's `inlineHeight` or
|
|
|
163
164
|
view mounted while it is visible, because detaching Android's WebGL-backed map
|
|
164
165
|
destroys its graphics context.
|
|
165
166
|
|
|
167
|
+
The optional `mapStyleToggle`, `gpsRecenterToggle`, `streetViewToggle`, and
|
|
168
|
+
`expandContractToggle` props default to `true` on both platforms. `endpoint={{lat, lng}}`
|
|
169
|
+
forwards destination coordinates, `fitGpsOnStart` defaults to `false`, and
|
|
170
|
+
`readyTimeoutSeconds` defaults to `15`. Native button analytics travel directly through
|
|
171
|
+
the native SDK's WebView bridge to Doorstep Go; React Native does not need to forward them.
|
|
172
|
+
|
|
173
|
+
`onError(message, error)` keeps the legacy message as its first argument and supplies a
|
|
174
|
+
`DoorstepEmbedError` as its second: `code`, `stage`, `message`, `isRetryable`, and optional
|
|
175
|
+
`httpStatusCode`/`requestId`. Both platforms use the same field names and enum values.
|
|
176
|
+
`onLoading` reports navigation starting; `onSuccess` reports page readiness.
|
|
177
|
+
|
|
166
178
|
### Deliveries
|
|
167
179
|
|
|
168
180
|
All four starters take the same trailing `StartDeliveryOptions`:
|
|
@@ -210,10 +222,12 @@ signal, not a truthy return value. On iOS, listen for the SDK's
|
|
|
210
222
|
|
|
211
223
|
### Route geofencing
|
|
212
224
|
|
|
213
|
-
The SDK fences each stop
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
225
|
+
The SDK fences each stop and auto-starts a delivery on qualified ENTER. The server owns
|
|
226
|
+
radius and EXIT policy (`misc.geofence.waitForDropoff`): true/missing requires `markDropoff`
|
|
227
|
+
before EXIT stops the session; false permits unmarked EXIT and keeps the stop armed.
|
|
228
|
+
Whole-route telemetry is also server controlled. Background routes require location
|
|
229
|
+
authorization and the native SDK's supported foreground/background execution setup;
|
|
230
|
+
Always authorization provides the broadest recovery support.
|
|
217
231
|
|
|
218
232
|
```ts
|
|
219
233
|
type DeliveryStop = {
|
|
@@ -221,16 +235,23 @@ type DeliveryStop = {
|
|
|
221
235
|
address: string;
|
|
222
236
|
latitude: number;
|
|
223
237
|
longitude: number;
|
|
224
|
-
|
|
238
|
+
routeStopId?: string; // stable identity; defaults to deliveryId
|
|
239
|
+
radiusMeters?: number; // deprecated, ignored; radius is server controlled
|
|
225
240
|
customerId?: string;
|
|
226
241
|
driverId?: string;
|
|
227
242
|
};
|
|
228
243
|
|
|
229
|
-
type
|
|
230
|
-
defaultRadiusMeters?: number; //
|
|
244
|
+
type RouteOptions = {
|
|
245
|
+
defaultRadiusMeters?: number; // deprecated, ignored
|
|
231
246
|
timeoutSeconds?: number; // per auto-started session
|
|
247
|
+
autoStopAfterDropoffSeconds?: number;
|
|
232
248
|
manualForeground?: boolean; // Android only; ignored on iOS
|
|
249
|
+
maxAgeSeconds?: number; // Android only
|
|
250
|
+
clientRouteId?: string;
|
|
251
|
+
driverId?: string;
|
|
252
|
+
metadata?: Record<string, string>;
|
|
233
253
|
};
|
|
254
|
+
// RouteGeofenceOptions remains a deprecated alias for source compatibility.
|
|
234
255
|
```
|
|
235
256
|
|
|
236
257
|
| method | notes |
|
|
@@ -240,13 +261,17 @@ type RouteGeofenceOptions = {
|
|
|
240
261
|
| `stopRouteGeofencing(): Promise<void>` | Teardown is handed to the tracking service / region manager, so `getMonitoredStops()` can still show the old list for a moment. |
|
|
241
262
|
| `resumeRouteGeofencingIfNeeded(): Promise<void>` | **Call this on every launch.** A per-launch host obligation: without it Android silently loses route monitoring across a process kill. |
|
|
242
263
|
| `getMonitoredStops(): Promise<DeliveryStop[]>` | The SDK's *intent* registry, not the OS's registered-region set. |
|
|
264
|
+
| `isRouteGeofencingActive(): Promise<boolean>` | Durable route intent, independent of an active delivery. |
|
|
265
|
+
| `getActiveRouteId(): Promise<string \| null>` | Canonical SDK route UUID on either platform. |
|
|
266
|
+
| `getActiveRouteRevision(): Promise<number \| null>` | Current manifest revision, or null without a route. |
|
|
267
|
+
| `addMetadata(deliveryId, metadata): Promise<void>` | Attach JSON metadata before or after a delivery session starts. |
|
|
243
268
|
| `addGeofenceSessionListener(cb): EmitterSubscription \| undefined` | `{ deliveryId, type: 'STARTED' \| 'STOPPED', reason }`. Call `.remove()` to unsubscribe. |
|
|
244
269
|
|
|
245
270
|
```ts
|
|
246
271
|
const sub = DoorstepAI.addGeofenceSessionListener(({ deliveryId, type, reason }) => {
|
|
247
272
|
console.log(type, deliveryId, reason);
|
|
248
273
|
});
|
|
249
|
-
await DoorstepAI.startRouteGeofencing(stops, {
|
|
274
|
+
await DoorstepAI.startRouteGeofencing(stops, { clientRouteId: 'route-123', driverId: 'driver-123' });
|
|
250
275
|
// ...later
|
|
251
276
|
sub?.remove();
|
|
252
277
|
```
|
package/android/build.gradle
CHANGED
|
@@ -90,7 +90,7 @@ dependencies {
|
|
|
90
90
|
// `onRequestPermissionsResult` to `DoorstepAI.notePermissionRequestResult(...)`
|
|
91
91
|
// (the only way the SDK can tell a re-askable denial from a permanent one), so
|
|
92
92
|
// the SDK's types have to be on the host's compile classpath.
|
|
93
|
-
api("ai.doorstep.com:doorstepai-dropoff-sdk:2.2.
|
|
93
|
+
api("ai.doorstep.com:doorstepai-dropoff-sdk:2.2.13")
|
|
94
94
|
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -24,7 +24,7 @@ import com.facebook.react.bridge.Arguments
|
|
|
24
24
|
import com.facebook.react.bridge.UiThreadUtil
|
|
25
25
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
26
26
|
import com.doorstepai.sdks.tracking.DeliveryStop
|
|
27
|
-
import com.doorstepai.sdks.tracking.
|
|
27
|
+
import com.doorstepai.sdks.tracking.RouteOptions
|
|
28
28
|
import com.doorstepai.sdks.tracking.DoorstepPermission
|
|
29
29
|
import com.doorstepai.sdks.tracking.DoorstepPermissionState
|
|
30
30
|
import com.doorstepai.sdks.tracking.DoorstepPermissionStatus
|
|
@@ -884,6 +884,33 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
886
|
|
|
887
|
+
@ReactMethod
|
|
888
|
+
fun isRouteGeofencingActive(promise: Promise) {
|
|
889
|
+
promise.resolve(DoorstepAI.isRouteGeofencingActive())
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
@ReactMethod
|
|
893
|
+
fun getActiveRouteId(promise: Promise) {
|
|
894
|
+
promise.resolve(DoorstepAI.activeRouteInstanceId)
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
@ReactMethod
|
|
898
|
+
fun getActiveRouteRevision(promise: Promise) {
|
|
899
|
+
promise.resolve(DoorstepAI.activeRouteRevision)
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
@ReactMethod
|
|
903
|
+
fun addMetadata(deliveryId: String, metadata: ReadableMap, promise: Promise) {
|
|
904
|
+
try {
|
|
905
|
+
DoorstepAI.addMetadata(deliveryId, metadata.toHashMap()) { result ->
|
|
906
|
+
result.onSuccess { promise.resolve(null) }
|
|
907
|
+
.onFailure { promise.reject("METADATA_ERROR", it.message ?: "Failed to add metadata") }
|
|
908
|
+
}
|
|
909
|
+
} catch (e: Exception) {
|
|
910
|
+
promise.reject("METADATA_ERROR", e.message ?: "Failed to add metadata")
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
887
914
|
@ReactMethod
|
|
888
915
|
fun removeListeners(count: Int) {
|
|
889
916
|
// Required stub for NativeEventEmitter on Android. The single Flow collector
|
|
@@ -920,20 +947,27 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
920
947
|
longitude = m.getDouble("longitude"),
|
|
921
948
|
radiusMeters = if (m.hasKey("radiusMeters") && !m.isNull("radiusMeters")) m.getDouble("radiusMeters") else null,
|
|
922
949
|
customerId = if (m.hasKey("customerId")) m.getString("customerId") else null,
|
|
923
|
-
driverId = if (m.hasKey("driverId")) m.getString("driverId") else null
|
|
950
|
+
driverId = if (m.hasKey("driverId")) m.getString("driverId") else null,
|
|
951
|
+
routeStopId = if (m.hasKey("routeStopId")) m.getString("routeStopId") else null
|
|
924
952
|
)
|
|
925
953
|
)
|
|
926
954
|
}
|
|
927
955
|
return out
|
|
928
956
|
}
|
|
929
957
|
|
|
930
|
-
private fun parseRouteOptions(m: ReadableMap?):
|
|
931
|
-
if (m == null) return
|
|
932
|
-
return
|
|
958
|
+
private fun parseRouteOptions(m: ReadableMap?): RouteOptions {
|
|
959
|
+
if (m == null) return RouteOptions()
|
|
960
|
+
return RouteOptions(
|
|
933
961
|
defaultRadiusMeters = if (m.hasKey("defaultRadiusMeters") && !m.isNull("defaultRadiusMeters")) m.getDouble("defaultRadiusMeters") else 250.0,
|
|
934
962
|
timeoutSeconds = if (m.hasKey("timeoutSeconds") && !m.isNull("timeoutSeconds")) m.getDouble("timeoutSeconds") else null,
|
|
935
963
|
autoStopAfterDropoffSeconds = if (m.hasKey("autoStopAfterDropoffSeconds") && !m.isNull("autoStopAfterDropoffSeconds")) m.getDouble("autoStopAfterDropoffSeconds") else null,
|
|
936
|
-
manualForeground = if (m.hasKey("manualForeground") && !m.isNull("manualForeground")) m.getBoolean("manualForeground") else false
|
|
964
|
+
manualForeground = if (m.hasKey("manualForeground") && !m.isNull("manualForeground")) m.getBoolean("manualForeground") else false,
|
|
965
|
+
maxAgeSeconds = if (m.hasKey("maxAgeSeconds") && !m.isNull("maxAgeSeconds")) m.getDouble("maxAgeSeconds") else null,
|
|
966
|
+
clientRouteId = if (m.hasKey("clientRouteId")) m.getString("clientRouteId") else null,
|
|
967
|
+
driverId = if (m.hasKey("driverId")) m.getString("driverId") else null,
|
|
968
|
+
metadata = if (m.hasKey("metadata") && !m.isNull("metadata")) m.getMap("metadata")?.toHashMap()?.mapValues {
|
|
969
|
+
it.value as? String ?: throw IllegalArgumentException("Route metadata values must be strings")
|
|
970
|
+
}.orEmpty() else emptyMap()
|
|
937
971
|
)
|
|
938
972
|
}
|
|
939
973
|
|
|
@@ -946,6 +980,7 @@ class DoorstepAIModule(private val reactContext: ReactApplicationContext) :
|
|
|
946
980
|
s.radiusMeters?.let { m.putDouble("radiusMeters", it) }
|
|
947
981
|
s.customerId?.let { m.putString("customerId", it) }
|
|
948
982
|
s.driverId?.let { m.putString("driverId", it) }
|
|
983
|
+
s.routeStopId?.let { m.putString("routeStopId", it) }
|
|
949
984
|
return m
|
|
950
985
|
}
|
|
951
986
|
|
|
@@ -2,6 +2,9 @@ package com.doorstepai.dropoffsdk
|
|
|
2
2
|
|
|
3
3
|
import com.doorstepai.sdks.tracking.DoorstepEmbedView
|
|
4
4
|
import com.doorstepai.sdks.tracking.EmbedMode
|
|
5
|
+
import com.doorstepai.sdks.tracking.LatLngObject
|
|
6
|
+
import com.doorstepai.sdks.tracking.DoorstepEmbedError
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
8
|
import com.facebook.react.bridge.Arguments
|
|
6
9
|
import com.facebook.react.bridge.ReactContext
|
|
7
10
|
import com.facebook.react.common.MapBuilder
|
|
@@ -24,6 +27,11 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
24
27
|
var markerColor: String = "#027FB8",
|
|
25
28
|
var polygonColor: String = "#3291BC",
|
|
26
29
|
var parkingColor: String = "#FF847B",
|
|
30
|
+
var endpointLat: Double? = null,
|
|
31
|
+
var endpointLng: Double? = null,
|
|
32
|
+
var streetViewToggle: Boolean = true,
|
|
33
|
+
var fitGpsOnStart: Boolean = false,
|
|
34
|
+
var readyTimeoutSeconds: Double = 15.0,
|
|
27
35
|
var loadedRequest: LoadRequest? = null,
|
|
28
36
|
)
|
|
29
37
|
|
|
@@ -36,6 +44,11 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
36
44
|
val markerColor: String,
|
|
37
45
|
val polygonColor: String,
|
|
38
46
|
val parkingColor: String,
|
|
47
|
+
val endpointLat: Double?,
|
|
48
|
+
val endpointLng: Double?,
|
|
49
|
+
val streetViewToggle: Boolean,
|
|
50
|
+
val fitGpsOnStart: Boolean,
|
|
51
|
+
val readyTimeoutSeconds: Double,
|
|
39
52
|
)
|
|
40
53
|
|
|
41
54
|
private val propsByView = WeakHashMap<DoorstepEmbedView, Props>()
|
|
@@ -46,13 +59,26 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
46
59
|
val view = DoorstepEmbedView(reactContext)
|
|
47
60
|
propsByView[view] = Props()
|
|
48
61
|
view.onModeChanged = { mode ->
|
|
62
|
+
props(view).mode = mode
|
|
49
63
|
emit(view, MODE_CHANGED_EVENT, Arguments.createMap().apply {
|
|
50
64
|
putString("mode", mode.value)
|
|
51
65
|
})
|
|
52
66
|
}
|
|
67
|
+
view.onLoading = { emit(view, LOADING_EVENT, Arguments.createMap()) }
|
|
68
|
+
view.onSuccess = { emit(view, SUCCESS_EVENT, Arguments.createMap()) }
|
|
53
69
|
view.onError = { error ->
|
|
54
70
|
emit(view, ERROR_EVENT, Arguments.createMap().apply {
|
|
55
71
|
putString("message", error.message)
|
|
72
|
+
putString("code", error.code.name)
|
|
73
|
+
putString("stage", when (error.stage) {
|
|
74
|
+
DoorstepEmbedError.Stage.LINK_GENERATION -> "linkGeneration"
|
|
75
|
+
DoorstepEmbedError.Stage.WEB_NAVIGATION -> "webNavigation"
|
|
76
|
+
DoorstepEmbedError.Stage.INITIALIZATION -> "initialization"
|
|
77
|
+
DoorstepEmbedError.Stage.RENDERING -> "rendering"
|
|
78
|
+
})
|
|
79
|
+
putBoolean("isRetryable", error.isRetryable)
|
|
80
|
+
error.httpStatusCode?.let { putInt("httpStatusCode", it) }
|
|
81
|
+
error.requestId?.let { putString("requestId", it) }
|
|
56
82
|
})
|
|
57
83
|
}
|
|
58
84
|
return view
|
|
@@ -113,6 +139,30 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
113
139
|
props(view).parkingColor = value ?: "#FF847B"
|
|
114
140
|
}
|
|
115
141
|
|
|
142
|
+
@ReactProp(name = "endpoint")
|
|
143
|
+
fun setEndpoint(view: DoorstepEmbedView, value: ReadableMap?) {
|
|
144
|
+
props(view).endpointLat = if (value != null && value.hasKey("lat") && !value.isNull("lat")) value.getDouble("lat") else null
|
|
145
|
+
props(view).endpointLng = if (value != null && value.hasKey("lng") && !value.isNull("lng")) value.getDouble("lng") else null
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactProp(name = "mapStyleToggle", defaultBoolean = true)
|
|
149
|
+
fun setMapStyleToggle(view: DoorstepEmbedView, value: Boolean) { view.mapStyleToggle = value }
|
|
150
|
+
|
|
151
|
+
@ReactProp(name = "gpsRecenterToggle", defaultBoolean = true)
|
|
152
|
+
fun setGpsRecenterToggle(view: DoorstepEmbedView, value: Boolean) { view.gpsRecenterToggle = value }
|
|
153
|
+
|
|
154
|
+
@ReactProp(name = "expandContractToggle", defaultBoolean = true)
|
|
155
|
+
fun setExpandContractToggle(view: DoorstepEmbedView, value: Boolean) { view.expandContractToggle = value }
|
|
156
|
+
|
|
157
|
+
@ReactProp(name = "streetViewToggle", defaultBoolean = true)
|
|
158
|
+
fun setStreetViewToggle(view: DoorstepEmbedView, value: Boolean) { props(view).streetViewToggle = value }
|
|
159
|
+
|
|
160
|
+
@ReactProp(name = "fitGpsOnStart", defaultBoolean = false)
|
|
161
|
+
fun setFitGpsOnStart(view: DoorstepEmbedView, value: Boolean) { props(view).fitGpsOnStart = value }
|
|
162
|
+
|
|
163
|
+
@ReactProp(name = "readyTimeoutSeconds", defaultDouble = 15.0)
|
|
164
|
+
fun setReadyTimeoutSeconds(view: DoorstepEmbedView, value: Double) { props(view).readyTimeoutSeconds = value }
|
|
165
|
+
|
|
116
166
|
override fun onAfterUpdateTransaction(view: DoorstepEmbedView) {
|
|
117
167
|
super.onAfterUpdateTransaction(view)
|
|
118
168
|
val props = props(view)
|
|
@@ -130,6 +180,11 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
130
180
|
markerColor = props.markerColor,
|
|
131
181
|
polygonColor = props.polygonColor,
|
|
132
182
|
parkingColor = props.parkingColor,
|
|
183
|
+
endpointLat = props.endpointLat,
|
|
184
|
+
endpointLng = props.endpointLng,
|
|
185
|
+
streetViewToggle = props.streetViewToggle,
|
|
186
|
+
fitGpsOnStart = props.fitGpsOnStart,
|
|
187
|
+
readyTimeoutSeconds = props.readyTimeoutSeconds,
|
|
133
188
|
)
|
|
134
189
|
if (request == props.loadedRequest) return
|
|
135
190
|
props.loadedRequest = request
|
|
@@ -142,6 +197,10 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
142
197
|
request.markerColor,
|
|
143
198
|
request.polygonColor,
|
|
144
199
|
request.parkingColor,
|
|
200
|
+
if (request.endpointLat != null && request.endpointLng != null) LatLngObject(request.endpointLat, request.endpointLng) else null,
|
|
201
|
+
request.streetViewToggle,
|
|
202
|
+
request.fitGpsOnStart,
|
|
203
|
+
request.readyTimeoutSeconds,
|
|
145
204
|
)
|
|
146
205
|
}
|
|
147
206
|
|
|
@@ -154,6 +213,8 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
154
213
|
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> =
|
|
155
214
|
MapBuilder.builder<String, Any>()
|
|
156
215
|
.put(MODE_CHANGED_EVENT, MapBuilder.of("registrationName", "onModeChanged"))
|
|
216
|
+
.put(LOADING_EVENT, MapBuilder.of("registrationName", "onLoading"))
|
|
217
|
+
.put(SUCCESS_EVENT, MapBuilder.of("registrationName", "onSuccess"))
|
|
157
218
|
.put(ERROR_EVENT, MapBuilder.of("registrationName", "onError"))
|
|
158
219
|
.build()
|
|
159
220
|
|
|
@@ -171,6 +232,8 @@ class DoorstepEmbedViewManager : SimpleViewManager<DoorstepEmbedView>() {
|
|
|
171
232
|
const val REACT_CLASS = "DoorstepEmbedView"
|
|
172
233
|
const val MODE_CHANGED_EVENT = "topModeChanged"
|
|
173
234
|
const val ERROR_EVENT = "topError"
|
|
235
|
+
const val LOADING_EVENT = "topLoading"
|
|
236
|
+
const val SUCCESS_EVENT = "topSuccess"
|
|
174
237
|
const val DEFAULT_LINK_API = "https://api.core.doorstep.ai"
|
|
175
238
|
const val DEFAULT_INLINE_HEIGHT = 300f
|
|
176
239
|
const val DEFAULT_EXPANDED_HEIGHT = 600f
|
package/ios/DoorstepAI.mm
CHANGED
|
@@ -95,5 +95,15 @@ RCT_EXTERN_METHOD(resumeRouteGeofencingIfNeeded:(RCTPromiseResolveBlock)resolve
|
|
|
95
95
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
96
96
|
RCT_EXTERN_METHOD(getMonitoredStops:(RCTPromiseResolveBlock)resolve
|
|
97
97
|
rejecter:(RCTPromiseRejectBlock)reject)
|
|
98
|
+
RCT_EXTERN_METHOD(isRouteGeofencingActive:(RCTPromiseResolveBlock)resolve
|
|
99
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
100
|
+
RCT_EXTERN_METHOD(getActiveRouteId:(RCTPromiseResolveBlock)resolve
|
|
101
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
102
|
+
RCT_EXTERN_METHOD(getActiveRouteRevision:(RCTPromiseResolveBlock)resolve
|
|
103
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
104
|
+
RCT_EXTERN_METHOD(addMetadata:(nonnull NSString *)deliveryId
|
|
105
|
+
metadata:(nonnull NSDictionary *)metadata
|
|
106
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
107
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
98
108
|
|
|
99
109
|
@end
|
package/ios/DoorstepAI.swift
CHANGED
|
@@ -464,6 +464,10 @@ class DoorstepAIBridge: RCTEventEmitter {
|
|
|
464
464
|
options: NSDictionary?,
|
|
465
465
|
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
466
466
|
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
467
|
+
if let metadata = options?["metadata"], !(metadata is NSNull), !(metadata is [String: String]) {
|
|
468
|
+
reject("E_ROUTE_GEOFENCING", "Route metadata values must be strings", nil)
|
|
469
|
+
return
|
|
470
|
+
}
|
|
467
471
|
let parsed: [DeliveryStop] = (stops as? [[String: Any]] ?? []).compactMap { parseDeliveryStop($0) }
|
|
468
472
|
if parsed.isEmpty {
|
|
469
473
|
reject("E_ROUTE_GEOFENCING", "startRouteGeofencing requires at least one valid stop (deliveryId + latitude + longitude)", nil)
|
|
@@ -513,6 +517,42 @@ class DoorstepAIBridge: RCTEventEmitter {
|
|
|
513
517
|
}
|
|
514
518
|
}
|
|
515
519
|
|
|
520
|
+
@objc
|
|
521
|
+
func isRouteGeofencingActive(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
522
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
523
|
+
DispatchQueue.main.async { resolve(DoorstepAI.isRouteGeofencingActive()) }
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
@objc
|
|
527
|
+
func getActiveRouteId(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
528
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
529
|
+
DispatchQueue.main.async { resolve(DoorstepAI.activeRouteId) }
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
@objc
|
|
533
|
+
func getActiveRouteRevision(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
534
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
535
|
+
DispatchQueue.main.async { resolve(DoorstepAI.activeRouteRevision) }
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@objc
|
|
539
|
+
func addMetadata(_ deliveryId: String, metadata: NSDictionary,
|
|
540
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
541
|
+
rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
542
|
+
guard let values = metadata as? [String: Any] else {
|
|
543
|
+
reject("E_METADATA", "Metadata must be a JSON object", nil)
|
|
544
|
+
return
|
|
545
|
+
}
|
|
546
|
+
Task {
|
|
547
|
+
do {
|
|
548
|
+
try await DoorstepAI.addMetadata(deliveryId, values)
|
|
549
|
+
resolve(nil)
|
|
550
|
+
} catch {
|
|
551
|
+
reject("E_METADATA", error.localizedDescription, error)
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
516
556
|
private func parseDeliveryStop(_ raw: [String: Any]) -> DeliveryStop? {
|
|
517
557
|
guard let deliveryId = raw["deliveryId"] as? String,
|
|
518
558
|
let latitude = (raw["latitude"] as? NSNumber)?.doubleValue,
|
|
@@ -520,6 +560,7 @@ class DoorstepAIBridge: RCTEventEmitter {
|
|
|
520
560
|
return nil
|
|
521
561
|
}
|
|
522
562
|
return DeliveryStop(
|
|
563
|
+
routeStopId: raw["routeStopId"] as? String,
|
|
523
564
|
deliveryId: deliveryId,
|
|
524
565
|
address: (raw["address"] as? String) ?? "",
|
|
525
566
|
latitude: latitude,
|
|
@@ -530,14 +571,16 @@ class DoorstepAIBridge: RCTEventEmitter {
|
|
|
530
571
|
)
|
|
531
572
|
}
|
|
532
573
|
|
|
533
|
-
private func parseRouteOptions(_ raw: NSDictionary?) ->
|
|
534
|
-
guard let o = raw as? [String: Any] else { return
|
|
535
|
-
//
|
|
536
|
-
|
|
537
|
-
return RouteGeofenceOptions(
|
|
574
|
+
private func parseRouteOptions(_ raw: NSDictionary?) -> RouteOptions {
|
|
575
|
+
guard let o = raw as? [String: Any] else { return RouteOptions() }
|
|
576
|
+
// manualForeground and maxAgeSeconds are Android-only options.
|
|
577
|
+
return RouteOptions(
|
|
538
578
|
defaultRadiusMeters: (o["defaultRadiusMeters"] as? NSNumber)?.doubleValue ?? 250,
|
|
539
579
|
timeoutSeconds: (o["timeoutSeconds"] as? NSNumber)?.doubleValue,
|
|
540
|
-
autoStopAfterDropoffSeconds: (o["autoStopAfterDropoffSeconds"] as? NSNumber)?.doubleValue
|
|
580
|
+
autoStopAfterDropoffSeconds: (o["autoStopAfterDropoffSeconds"] as? NSNumber)?.doubleValue,
|
|
581
|
+
clientRouteId: o["clientRouteId"] as? String,
|
|
582
|
+
driverId: o["driverId"] as? String,
|
|
583
|
+
metadata: o["metadata"] as? [String: String]
|
|
541
584
|
)
|
|
542
585
|
}
|
|
543
586
|
|
|
@@ -551,6 +594,7 @@ class DoorstepAIBridge: RCTEventEmitter {
|
|
|
551
594
|
if let r = s.radiusMeters { m["radiusMeters"] = r }
|
|
552
595
|
if let c = s.customerId { m["customerId"] = c }
|
|
553
596
|
if let d = s.driverId { m["driverId"] = d }
|
|
597
|
+
if let id = s.routeStopId { m["routeStopId"] = id }
|
|
554
598
|
return m
|
|
555
599
|
}
|
|
556
600
|
|
|
@@ -10,15 +10,18 @@
|
|
|
10
10
|
<key>DebugSymbolsPath</key>
|
|
11
11
|
<string>dSYMs</string>
|
|
12
12
|
<key>LibraryIdentifier</key>
|
|
13
|
-
<string>ios-
|
|
13
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
14
14
|
<key>LibraryPath</key>
|
|
15
15
|
<string>DoorstepDropoffSDK.framework</string>
|
|
16
16
|
<key>SupportedArchitectures</key>
|
|
17
17
|
<array>
|
|
18
18
|
<string>arm64</string>
|
|
19
|
+
<string>x86_64</string>
|
|
19
20
|
</array>
|
|
20
21
|
<key>SupportedPlatform</key>
|
|
21
22
|
<string>ios</string>
|
|
23
|
+
<key>SupportedPlatformVariant</key>
|
|
24
|
+
<string>simulator</string>
|
|
22
25
|
</dict>
|
|
23
26
|
<dict>
|
|
24
27
|
<key>BinaryPath</key>
|
|
@@ -26,18 +29,15 @@
|
|
|
26
29
|
<key>DebugSymbolsPath</key>
|
|
27
30
|
<string>dSYMs</string>
|
|
28
31
|
<key>LibraryIdentifier</key>
|
|
29
|
-
<string>ios-
|
|
32
|
+
<string>ios-arm64</string>
|
|
30
33
|
<key>LibraryPath</key>
|
|
31
34
|
<string>DoorstepDropoffSDK.framework</string>
|
|
32
35
|
<key>SupportedArchitectures</key>
|
|
33
36
|
<array>
|
|
34
37
|
<string>arm64</string>
|
|
35
|
-
<string>x86_64</string>
|
|
36
38
|
</array>
|
|
37
39
|
<key>SupportedPlatform</key>
|
|
38
40
|
<string>ios</string>
|
|
39
|
-
<key>SupportedPlatformVariant</key>
|
|
40
|
-
<string>simulator</string>
|
|
41
41
|
</dict>
|
|
42
42
|
</array>
|
|
43
43
|
<key>CFBundlePackageType</key>
|