@doorstepai/dropoff-sdk 2.0.8 → 2.1.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 (43) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +159 -2
  3. package/ios/DoorstepAI.mm +20 -2
  4. package/ios/DoorstepAI.swift +140 -5
  5. package/ios/DoorstepDropoffSDK.xcframework/Info.plist +5 -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 +5341 -1609
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +77 -4
  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 +77 -4
  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 +2630 -2116
  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 +5341 -1609
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +77 -4
  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 +77 -4
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +5341 -1609
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +77 -4
  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 +77 -4
  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 +2630 -2116
  28. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2616 -2105
  29. package/lib/module/DoorstepAI.js +102 -5
  30. package/lib/module/DoorstepAI.js.map +1 -1
  31. package/lib/module/RootDoorstepAI.js +10 -1
  32. package/lib/module/RootDoorstepAI.js.map +1 -1
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/typescript/src/DoorstepAI.d.ts +72 -3
  35. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  36. package/lib/typescript/src/RootDoorstepAI.d.ts +4 -1
  37. package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -1
  38. package/lib/typescript/src/index.d.ts +1 -1
  39. package/lib/typescript/src/index.d.ts.map +1 -1
  40. package/package.json +1 -1
  41. package/src/DoorstepAI.tsx +162 -6
  42. package/src/RootDoorstepAI.tsx +18 -1
  43. package/src/index.tsx +4 -0
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
2
 
3
- import { NativeModules, Platform } from 'react-native';
3
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
4
4
  const {
5
5
  DoorstepAI
6
6
  } = NativeModules;
7
7
 
8
+ // Bridges the native geofence-session event stream (iOS RCTEventEmitter /
9
+ // Android DeviceEventManagerModule) to JS. See `addGeofenceSessionListener`.
10
+ const GEOFENCE_SESSION_EVENT = 'DoorstepGeofenceSessionEvent';
11
+ const doorstepEventEmitter = DoorstepAI ? new NativeEventEmitter(DoorstepAI) : undefined;
12
+
13
+ /**
14
+ * A single stop the SDK should geofence in `startRouteGeofencing`. On geofence
15
+ * ENTER the SDK auto-starts a delivery session for `deliveryId`; on EXIT it stops
16
+ * it (only if `markDropoff` was called for that id — otherwise the per-session
17
+ * timeout backstop applies).
18
+ */
19
+
20
+ /** Route-wide options for `startRouteGeofencing`. */
21
+
22
+ /** Emitted whenever route geofencing auto-starts or auto-stops a session. */
23
+
8
24
  /**
9
25
  * Per-delivery options shared across both platforms. Fields not supported on a
10
26
  * given platform are silently ignored.
@@ -49,9 +65,9 @@ class DoorstepAIModule {
49
65
  * host app does not need to manage them itself. No-op on Android — use
50
66
  * `PermissionsAndroid` (already wired into `RootDoorstepAI`).
51
67
  */
52
- static requestAllPermissions(requestAlwaysLocation = true) {
68
+ static requestAllPermissions(requestAlwaysLocation = true, requestBluetooth = false) {
53
69
  if (Platform.OS === 'ios') {
54
- DoorstepAI.requestAllPermissions(requestAlwaysLocation);
70
+ DoorstepAI.requestAllPermissions(requestAlwaysLocation, requestBluetooth);
55
71
  }
56
72
  }
57
73
 
@@ -161,9 +177,14 @@ class DoorstepAIModule {
161
177
  throw error;
162
178
  }
163
179
  }
164
- static async newEvent(eventName, deliveryId) {
180
+
181
+ /**
182
+ * Record a custom event on a delivery. `timestamp` is optional epoch SECONDS —
183
+ * when provided the event is recorded at that time instead of "now".
184
+ */
185
+ static async newEvent(eventName, deliveryId, timestamp) {
165
186
  try {
166
- const result = await DoorstepAI.newEvent(eventName, deliveryId);
187
+ const result = await DoorstepAI.newEvent(eventName, deliveryId, timestamp ?? null);
167
188
  console.log('DOORSTEPAI - Event sent successfully:', result);
168
189
  return result;
169
190
  } catch (error) {
@@ -172,6 +193,82 @@ class DoorstepAIModule {
172
193
  }
173
194
  }
174
195
 
196
+ // ---- Route geofencing (in-SDK) ----
197
+
198
+ /**
199
+ * Begin in-SDK route geofencing. The SDK fences each stop and auto-starts a
200
+ * delivery session on geofence ENTER / stops it on EXIT (EXIT is gated on
201
+ * `markDropoff`). Requires location permission; background operation needs
202
+ * "Allow all the time" (Android) / Always authorization (iOS). Subscribe to
203
+ * start/stop events via `addGeofenceSessionListener`.
204
+ */
205
+ static async startRouteGeofencing(stops, options) {
206
+ try {
207
+ await DoorstepAI.startRouteGeofencing(stops, options ?? null);
208
+ console.log('DOORSTEPAI - Route geofencing started for', stops.length, 'stop(s)');
209
+ } catch (error) {
210
+ console.error('DOORSTEPAI - Failed to start route geofencing:', error);
211
+ throw error;
212
+ }
213
+ }
214
+
215
+ /**
216
+ * Replace the monitored stops in place without tearing down still-present
217
+ * stops' sessions. Stops dropped from the list are removed (their session is
218
+ * stopped only if a dropoff was marked); new stops are added and armed.
219
+ */
220
+ static async updateRouteStops(stops) {
221
+ try {
222
+ await DoorstepAI.updateRouteStops(stops);
223
+ } catch (error) {
224
+ console.error('DOORSTEPAI - Failed to update route stops:', error);
225
+ throw error;
226
+ }
227
+ }
228
+
229
+ /** Stop route geofencing and clear all monitored stops. */
230
+ static async stopRouteGeofencing() {
231
+ try {
232
+ await DoorstepAI.stopRouteGeofencing();
233
+ } catch (error) {
234
+ console.error('DOORSTEPAI - Failed to stop route geofencing:', error);
235
+ throw error;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Re-arm route geofencing after a process relaunch if a route was active.
241
+ * Safe no-op when no route is persisted.
242
+ */
243
+ static async resumeRouteGeofencingIfNeeded() {
244
+ try {
245
+ await DoorstepAI.resumeRouteGeofencingIfNeeded();
246
+ } catch (error) {
247
+ console.error('DOORSTEPAI - Failed to resume route geofencing:', error);
248
+ throw error;
249
+ }
250
+ }
251
+
252
+ /** The stops currently registered for route geofencing (empty if none). */
253
+ static async getMonitoredStops() {
254
+ try {
255
+ const stops = await DoorstepAI.getMonitoredStops();
256
+ return stops ?? [];
257
+ } catch (error) {
258
+ console.error('DOORSTEPAI - Failed to get monitored stops:', error);
259
+ return [];
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
265
+ * geofence transitions). Returns a subscription — call `.remove()` to
266
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
267
+ */
268
+ static addGeofenceSessionListener(listener) {
269
+ return doorstepEventEmitter?.addListener(GEOFENCE_SESSION_EVENT, listener);
270
+ }
271
+
175
272
  // ---- Dev-mode helpers (Android exposes a richer surface than iOS) ----
176
273
 
177
274
  static async enableDevMode(apiKey) {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","DoorstepAI","SDK_LOG_LEVEL_RAW","debug","info","warning","error","critical","DEFAULT_TIMEOUT_SECONDS","DoorstepAIModule","isInitialized","init","notificationTitle","notificationText","OS","console","log","setApiKey","apiKey","requestAllPermissions","requestAlwaysLocation","configureRemoteLogging","options","minLevelRaw","minLevel","enabled","flushIntervalSeconds","batchSize","maxQueueSize","startDeliveryByPlaceID","placeID","deliveryId","timeoutSeconds","timeout","autoStop","autoStopAfterDropoffSeconds","customerId","driverId","result","manualForeground","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","coordinates","startDeliveryByAddressString","startDeliveryByLatLng","latitude","longitude","subUnit","markDropoff","dropoffType","stopDelivery","newEvent","eventName","enableDevMode","Boolean","validateDevModeAccess","disableDevMode"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;;AAgBpC;AACA;AACA;AACA;;AAiCA;AACA;AACA;AACA;;AAGA,MAAMG,iBAA8C,GAAG;EACrDC,KAAK,EAAE,CAAC;EACRC,IAAI,EAAE,CAAC;EACPC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE;AACZ,CAAC;AAED,MAAMC,uBAAuB,GAAG,IAAI;AAEpC,MAAMC,gBAAgB,CAAC;EACrB,OA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AAO0C,OAAO,CAAC,MAAMvD,UAAU,CAACyD,cAAc,CAAC,CAAC,CAAC;EACnD;AACF;AAEA,SAASjD,gBAAgB,IAAIR,UAAU","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","Platform","DoorstepAI","GEOFENCE_SESSION_EVENT","doorstepEventEmitter","undefined","SDK_LOG_LEVEL_RAW","debug","info","warning","error","critical","DEFAULT_TIMEOUT_SECONDS","DoorstepAIModule","isInitialized","init","notificationTitle","notificationText","OS","console","log","setApiKey","apiKey","requestAllPermissions","requestAlwaysLocation","requestBluetooth","configureRemoteLogging","options","minLevelRaw","minLevel","enabled","flushIntervalSeconds","batchSize","maxQueueSize","startDeliveryByPlaceID","placeID","deliveryId","timeoutSeconds","timeout","autoStop","autoStopAfterDropoffSeconds","customerId","driverId","result","manualForeground","startDeliveryByPlusCode","plusCode","startDeliveryByAddress","address","coordinates","startDeliveryByAddressString","startDeliveryByLatLng","latitude","longitude","subUnit","markDropoff","dropoffType","stopDelivery","newEvent","eventName","timestamp","startRouteGeofencing","stops","length","updateRouteStops","stopRouteGeofencing","resumeRouteGeofencingIfNeeded","getMonitoredStops","addGeofenceSessionListener","listener","addListener","enableDevMode","Boolean","validateDevModeAccess","disableDevMode"],"sourceRoot":"../../src","sources":["DoorstepAI.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,MAAM;EAAEC;AAAW,CAAC,GAAGH,aAAa;;AAEpC;AACA;AACA,MAAMI,sBAAsB,GAAG,8BAA8B;AAC7D,MAAMC,oBAAoB,GAAGF,UAAU,GACnC,IAAIF,kBAAkB,CAACE,UAAU,CAAC,GAClCG,SAAS;;AAgBb;AACA;AACA;AACA;AACA;AACA;;AAYA;;AAcA;;AAQA;AACA;AACA;AACA;;AAiCA;AACA;AACA;AACA;;AAGA,MAAMC,iBAA8C,GAAG;EACrDC,KAAK,EAAE,CAAC;EACRC,IAAI,EAAE,C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WAAW,CAACnE,sBAAsB,EAAEkE,QAAQ,CAAC;EAC5E;;EAEA;;EAEA,aAAaE,aAAaA,CAACjD,MAAc,EAAoB;IAC3D,IAAIrB,QAAQ,CAACiB,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMhB,UAAU,CAACqE,aAAa,CAACjD,MAAM,CAAC;MACtC,OAAO,IAAI;IACb;IACA,OAAOkD,OAAO,CAAC,MAAMtE,UAAU,CAACqE,aAAa,CAAC,CAAC,CAAC;EAClD;;EAEA;EACA,aAAaE,qBAAqBA,CAAA,EAAqB;IACrD,IAAIxE,QAAQ,CAACiB,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAOsD,OAAO,CAAC,MAAMtE,UAAU,CAACuE,qBAAqB,CAAC,CAAC,CAAC;EAC1D;;EAEA;EACA,aAAaC,cAAcA,CAAA,EAAqB;IAC9C,IAAIzE,QAAQ,CAACiB,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAOsD,OAAO,CAAC,MAAMtE,UAAU,CAACwE,cAAc,CAAC,CAAC,CAAC;EACnD;AACF;AAEA,SAAS7D,gBAAgB,IAAIX,UAAU","ignoreList":[]}
@@ -15,6 +15,10 @@ export function RootDoorstepAI(props) {
15
15
  if (Platform.OS === 'android') {
16
16
  try {
17
17
  const permissionsToRequest = [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, PermissionsAndroid.PERMISSIONS.ACTIVITY_RECOGNITION];
18
+ // Opt-in Bluetooth (BLE) — Android 12+ "Nearby devices" (BLUETOOTH_SCAN).
19
+ if (props.requestBluetooth && PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN) {
20
+ permissionsToRequest.push(PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN);
21
+ }
18
22
  const granted = await PermissionsAndroid.requestMultiple(permissionsToRequest);
19
23
  if (granted[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] === PermissionsAndroid.RESULTS.GRANTED && granted[PermissionsAndroid.PERMISSIONS.ACTIVITY_RECOGNITION] === PermissionsAndroid.RESULTS.GRANTED) {
20
24
  console.log('Required Android permissions granted');
@@ -26,10 +30,15 @@ export function RootDoorstepAI(props) {
26
30
  }
27
31
  } else if (Platform.OS === 'ios') {
28
32
  console.log('iOS: Ensure location and motion usage descriptions are in Info.plist');
33
+ // Opt-in Bluetooth: triggers the iOS BT prompt (needs
34
+ // NSBluetoothAlwaysUsageDescription in the host Info.plist).
35
+ if (props.requestBluetooth) {
36
+ DoorstepAI.requestAllPermissions(true, true);
37
+ }
29
38
  }
30
39
  };
31
40
  initializeAndRequestPermissions();
32
- }, [props.apiKey, props.notificationTitle, props.notificationText]);
41
+ }, [props.apiKey, props.notificationTitle, props.notificationText, props.requestBluetooth]);
33
42
 
34
43
  // On iOS, the native view might handle triggering permission prompts if needed.
35
44
  // The main setup involves Info.plist configuration.
@@ -1 +1 @@
1
- {"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","notificationTitle","notificationText","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,QACb,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGT,sBAAsB,CAAC,oBAAoB,CAAC;AAEnE,OAAO,SAASU,cAAcA,CAACC,KAI9B,EAAE;EACDN,SAAS,CAAC,MAAM;IACd,MAAMO,+BAA+B,GAAG,MAAAA,CAAA,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P,IAAI;IAAC8B,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3BhC,QAAQ,CAACW,EAAE,KAAK,KAAK,gBAAGL,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAMuB,MAAM,GAAG7B,UAAU,CAACgC,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["requireNativeComponent","View","Platform","StyleSheet","PermissionsAndroid","useEffect","DoorstepAI","jsx","_jsx","DoorstepAIView","RootDoorstepAI","props","initializeAndRequestPermissions","OS","init","notificationTitle","notificationText","setApiKey","apiKey","permissionsToRequest","PERMISSIONS","ACCESS_FINE_LOCATION","ACTIVITY_RECOGNITION","requestBluetooth","BLUETOOTH_SCAN","push","granted","requestMultiple","RESULTS","GRANTED","console","log","warn","err","requestAllPermissions","style","styles","container","children","create","height","width"],"sourceRoot":"../../src","sources":["RootDoorstepAI.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,IAAI,EACJC,QAAQ,EACRC,UAAU,EACVC,kBAAkB,QACb,cAAc;AAErB,SAASC,SAAS,QAAQ,OAAO;AAEjC,SAASC,UAAU,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1C,MAAMC,cAAc,GAAGT,sBAAsB,CAAC,oBAAoB,CAAC;AAEnE,OAAO,SAASU,cAAcA,CAACC,KAO9B,EAAE;EACDN,SAAS,CAAC,MAAM;IACd,MAAMO,+BAA+B,GAAG,MAAAA,CAAA,KAAY;MAClD,IAAIV,QAAQ,CAACW,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAMP,UAAU,CAACQ,IAAI,CACnBH,KAAK,CAACI,iBAAiB,IAAI,EAAE,EAC7BJ,KAAK,CAACK,gBAAgB,IAAI,EAC5B,CAAC;MACH;MAEAV,UAAU,CAACW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,iBAAiB,EACvBJ,KAAK,CAACK,gBAAgB,EACtBL,KAAK,CAACY,gBAAgB,CACvB,CAAC;;EAEF;EACA;EACA,oBACEf,IAAA,CAACP,IAAI;IAACkC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,EAC3BpC,QAAQ,CAACW,EAAE,KAAK,KAAK,gBAAGL,IAAA,CAACC,cAAc,IAAE,CAAC,GAAG;EAAI,CAC9C,CAAC;AAEX;AAEA,MAAM2B,MAAM,GAAGjC,UAAU,CAACoC,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,MAAM,EAAE,CAAC;IACTC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["RootDoorstepAI","DoorstepAI"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,qBAAkB;AACjD,SAASC,UAAU,QAAQ,iBAAc;AAQzC,SAASA,UAAU,EAAED,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["RootDoorstepAI","DoorstepAI"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,qBAAkB;AACjD,SAASC,UAAU,QAAQ,iBAAc;AAYzC,SAASA,UAAU,EAAED,cAAc","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import type { EmitterSubscription } from 'react-native';
1
2
  type AddressType = {
2
3
  streetNumber: string;
3
4
  route: string;
@@ -10,6 +11,41 @@ type LatLngObject = {
10
11
  lat: number;
11
12
  lng: number;
12
13
  };
14
+ /**
15
+ * A single stop the SDK should geofence in `startRouteGeofencing`. On geofence
16
+ * ENTER the SDK auto-starts a delivery session for `deliveryId`; on EXIT it stops
17
+ * it (only if `markDropoff` was called for that id — otherwise the per-session
18
+ * timeout backstop applies).
19
+ */
20
+ type DeliveryStop = {
21
+ deliveryId: string;
22
+ address: string;
23
+ latitude: number;
24
+ longitude: number;
25
+ /** Fence radius in meters. Falls back to `RouteGeofenceOptions.defaultRadiusMeters` (250 m). */
26
+ radiusMeters?: number;
27
+ customerId?: string;
28
+ driverId?: string;
29
+ };
30
+ /** Route-wide options for `startRouteGeofencing`. */
31
+ type RouteGeofenceOptions = {
32
+ /** Radius (m) for stops that don't set their own `radiusMeters`. Default 250. */
33
+ defaultRadiusMeters?: number;
34
+ /** Per-session safety timeout (s) forwarded to the auto-started delivery. */
35
+ timeoutSeconds?: number;
36
+ /** Auto-stop countdown (s) applied when `stopDelivery` is called for a stop. */
37
+ autoStopAfterDropoffSeconds?: number;
38
+ /** Android only. Host owns the foreground service; SDK won't promote its own. Ignored on iOS. */
39
+ manualForeground?: boolean;
40
+ };
41
+ type GeofenceSessionEventType = 'STARTED' | 'STOPPED';
42
+ /** Emitted whenever route geofencing auto-starts or auto-stops a session. */
43
+ type GeofenceSessionEvent = {
44
+ deliveryId: string;
45
+ type: GeofenceSessionEventType;
46
+ /** Short trigger tag, e.g. "geofence", "distance", "route_cleared". */
47
+ reason: string;
48
+ };
13
49
  /**
14
50
  * Per-delivery options shared across both platforms. Fields not supported on a
15
51
  * given platform are silently ignored.
@@ -59,7 +95,7 @@ declare class DoorstepAIModule {
59
95
  * host app does not need to manage them itself. No-op on Android — use
60
96
  * `PermissionsAndroid` (already wired into `RootDoorstepAI`).
61
97
  */
62
- static requestAllPermissions(requestAlwaysLocation?: boolean): void;
98
+ static requestAllPermissions(requestAlwaysLocation?: boolean, requestBluetooth?: boolean): void;
63
99
  /**
64
100
  * Configures the iOS SDK's remote logging pipeline. No-op on Android (the
65
101
  * Android SDK currently configures remote logging via remote config / dev
@@ -81,7 +117,40 @@ declare class DoorstepAIModule {
81
117
  static startDeliveryByLatLng(latitude: number, longitude: number, subUnit: string, deliveryId: string, timeoutSeconds?: number, options?: StartDeliveryOptions): Promise<any>;
82
118
  static markDropoff(deliveryId: string, dropoffType: 'pod' | 'non_pod'): Promise<void>;
83
119
  static stopDelivery(deliveryId: string): Promise<void>;
84
- static newEvent(eventName: string, deliveryId: string): Promise<any>;
120
+ /**
121
+ * Record a custom event on a delivery. `timestamp` is optional epoch SECONDS —
122
+ * when provided the event is recorded at that time instead of "now".
123
+ */
124
+ static newEvent(eventName: string, deliveryId: string, timestamp?: number): Promise<any>;
125
+ /**
126
+ * Begin in-SDK route geofencing. The SDK fences each stop and auto-starts a
127
+ * delivery session on geofence ENTER / stops it on EXIT (EXIT is gated on
128
+ * `markDropoff`). Requires location permission; background operation needs
129
+ * "Allow all the time" (Android) / Always authorization (iOS). Subscribe to
130
+ * start/stop events via `addGeofenceSessionListener`.
131
+ */
132
+ static startRouteGeofencing(stops: DeliveryStop[], options?: RouteGeofenceOptions): Promise<void>;
133
+ /**
134
+ * Replace the monitored stops in place without tearing down still-present
135
+ * stops' sessions. Stops dropped from the list are removed (their session is
136
+ * stopped only if a dropoff was marked); new stops are added and armed.
137
+ */
138
+ static updateRouteStops(stops: DeliveryStop[]): Promise<void>;
139
+ /** Stop route geofencing and clear all monitored stops. */
140
+ static stopRouteGeofencing(): Promise<void>;
141
+ /**
142
+ * Re-arm route geofencing after a process relaunch if a route was active.
143
+ * Safe no-op when no route is persisted.
144
+ */
145
+ static resumeRouteGeofencingIfNeeded(): Promise<void>;
146
+ /** The stops currently registered for route geofencing (empty if none). */
147
+ static getMonitoredStops(): Promise<DeliveryStop[]>;
148
+ /**
149
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
150
+ * geofence transitions). Returns a subscription — call `.remove()` to
151
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
152
+ */
153
+ static addGeofenceSessionListener(listener: (event: GeofenceSessionEvent) => void): EmitterSubscription | undefined;
85
154
  static enableDevMode(apiKey: string): Promise<boolean>;
86
155
  /** Android only. Returns false on iOS. */
87
156
  static validateDevModeAccess(): Promise<boolean>;
@@ -89,5 +158,5 @@ declare class DoorstepAIModule {
89
158
  static disableDevMode(): Promise<boolean>;
90
159
  }
91
160
  export { DoorstepAIModule as DoorstepAI };
92
- export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
161
+ export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel, DeliveryStop, RouteGeofenceOptions, GeofenceSessionEvent, GeofenceSessionEventType, };
93
162
  //# sourceMappingURL=DoorstepAI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/DoorstepAI.tsx"],"names":[],"mappings":"AAGA,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB,EAAE,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,KAAK,oBAAoB,GAAG;IAC1B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,KAAK,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAYvE,cAAM,gBAAgB;IACpB,MAAM,CAAC,aAAa,UAAS;WAEhB,IAAI,CACf,iBAAiB,CAAC,EAAE,MAAM,EAC1B,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC;IAgBhB,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM;IAI/B;;;;OAIG;IACH,MAAM,C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,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IASnE,2DAA2D;WAC9C,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IASjD;;;OAGG;WACU,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3D,2EAA2E;WAC9D,iBAAiB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAUzD;;;;OAIG;IACH,MAAM,CAAC,0BAA0B,CAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,GAC9C,mBAAmB,GAAG,SAAS;WAMrB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ5D,0CAA0C;WAC7B,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAKtD,kCAAkC;WACrB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;CAIhD;AAED,OAAO,EAAE,gBAAgB,IAAI,UAAU,EAAE,CAAC;AAC1C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,CAAC"}
@@ -2,5 +2,8 @@ export declare function RootDoorstepAI(props: {
2
2
  apiKey: string;
3
3
  notificationTitle?: string;
4
4
  notificationText?: string;
5
- }): import("react/jsx-runtime").JSX.Element;
5
+ /** Opt-in: also request Bluetooth (BLE) permission. Off by default — only
6
+ * needed if the `ble` config section is enabled for your fleet. */
7
+ requestBluetooth?: boolean;
8
+ }): import("react").JSX.Element;
6
9
  //# sourceMappingURL=RootDoorstepAI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAcA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,2CAoDA"}
1
+ {"version":3,"file":"RootDoorstepAI.d.ts","sourceRoot":"","sources":["../../../src/RootDoorstepAI.tsx"],"names":[],"mappings":"AAcA,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;wEACoE;IACpE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,+BAkEA"}
@@ -1,5 +1,5 @@
1
1
  import { RootDoorstepAI } from './RootDoorstepAI';
2
2
  import { DoorstepAI } from './DoorstepAI';
3
- export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel, } from './DoorstepAI';
3
+ export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel, DeliveryStop, RouteGeofenceOptions, GeofenceSessionEvent, GeofenceSessionEventType, } from './DoorstepAI';
4
4
  export { DoorstepAI, RootDoorstepAI };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doorstepai/dropoff-sdk",
3
- "version": "2.0.8",
3
+ "version": "2.1.0",
4
4
  "description": "doorstep.ai dropoff sdk for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -1,6 +1,14 @@
1
- import { NativeModules, Platform } from 'react-native';
1
+ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
2
+ import type { EmitterSubscription } from 'react-native';
2
3
  const { DoorstepAI } = NativeModules;
3
4
 
5
+ // Bridges the native geofence-session event stream (iOS RCTEventEmitter /
6
+ // Android DeviceEventManagerModule) to JS. See `addGeofenceSessionListener`.
7
+ const GEOFENCE_SESSION_EVENT = 'DoorstepGeofenceSessionEvent';
8
+ const doorstepEventEmitter = DoorstepAI
9
+ ? new NativeEventEmitter(DoorstepAI)
10
+ : undefined;
11
+
4
12
  type AddressType = {
5
13
  streetNumber: string;
6
14
  route: string;
@@ -15,6 +23,45 @@ type LatLngObject = {
15
23
  lng: number;
16
24
  };
17
25
 
26
+ /**
27
+ * A single stop the SDK should geofence in `startRouteGeofencing`. On geofence
28
+ * ENTER the SDK auto-starts a delivery session for `deliveryId`; on EXIT it stops
29
+ * it (only if `markDropoff` was called for that id — otherwise the per-session
30
+ * timeout backstop applies).
31
+ */
32
+ type DeliveryStop = {
33
+ deliveryId: string;
34
+ address: string;
35
+ latitude: number;
36
+ longitude: number;
37
+ /** Fence radius in meters. Falls back to `RouteGeofenceOptions.defaultRadiusMeters` (250 m). */
38
+ radiusMeters?: number;
39
+ customerId?: string;
40
+ driverId?: string;
41
+ };
42
+
43
+ /** Route-wide options for `startRouteGeofencing`. */
44
+ type RouteGeofenceOptions = {
45
+ /** Radius (m) for stops that don't set their own `radiusMeters`. Default 250. */
46
+ defaultRadiusMeters?: number;
47
+ /** Per-session safety timeout (s) forwarded to the auto-started delivery. */
48
+ timeoutSeconds?: number;
49
+ /** Auto-stop countdown (s) applied when `stopDelivery` is called for a stop. */
50
+ autoStopAfterDropoffSeconds?: number;
51
+ /** Android only. Host owns the foreground service; SDK won't promote its own. Ignored on iOS. */
52
+ manualForeground?: boolean;
53
+ };
54
+
55
+ type GeofenceSessionEventType = 'STARTED' | 'STOPPED';
56
+
57
+ /** Emitted whenever route geofencing auto-starts or auto-stops a session. */
58
+ type GeofenceSessionEvent = {
59
+ deliveryId: string;
60
+ type: GeofenceSessionEventType;
61
+ /** Short trigger tag, e.g. "geofence", "distance", "route_cleared". */
62
+ reason: string;
63
+ };
64
+
18
65
  /**
19
66
  * Per-delivery options shared across both platforms. Fields not supported on a
20
67
  * given platform are silently ignored.
@@ -98,9 +145,12 @@ class DoorstepAIModule {
98
145
  * host app does not need to manage them itself. No-op on Android — use
99
146
  * `PermissionsAndroid` (already wired into `RootDoorstepAI`).
100
147
  */
101
- static requestAllPermissions(requestAlwaysLocation: boolean = true) {
148
+ static requestAllPermissions(
149
+ requestAlwaysLocation: boolean = true,
150
+ requestBluetooth: boolean = false
151
+ ) {
102
152
  if (Platform.OS === 'ios') {
103
- DoorstepAI.requestAllPermissions(requestAlwaysLocation);
153
+ DoorstepAI.requestAllPermissions(requestAlwaysLocation, requestBluetooth);
104
154
  }
105
155
  }
106
156
 
@@ -397,9 +447,21 @@ class DoorstepAIModule {
397
447
  }
398
448
  }
399
449
 
400
- static async newEvent(eventName: string, deliveryId: string) {
450
+ /**
451
+ * Record a custom event on a delivery. `timestamp` is optional epoch SECONDS —
452
+ * when provided the event is recorded at that time instead of "now".
453
+ */
454
+ static async newEvent(
455
+ eventName: string,
456
+ deliveryId: string,
457
+ timestamp?: number
458
+ ) {
401
459
  try {
402
- const result = await DoorstepAI.newEvent(eventName, deliveryId);
460
+ const result = await DoorstepAI.newEvent(
461
+ eventName,
462
+ deliveryId,
463
+ timestamp ?? null
464
+ );
403
465
  console.log('DOORSTEPAI - Event sent successfully:', result);
404
466
  return result;
405
467
  } catch (error: any) {
@@ -413,6 +475,91 @@ class DoorstepAIModule {
413
475
  }
414
476
  }
415
477
 
478
+ // ---- Route geofencing (in-SDK) ----
479
+
480
+ /**
481
+ * Begin in-SDK route geofencing. The SDK fences each stop and auto-starts a
482
+ * delivery session on geofence ENTER / stops it on EXIT (EXIT is gated on
483
+ * `markDropoff`). Requires location permission; background operation needs
484
+ * "Allow all the time" (Android) / Always authorization (iOS). Subscribe to
485
+ * start/stop events via `addGeofenceSessionListener`.
486
+ */
487
+ static async startRouteGeofencing(
488
+ stops: DeliveryStop[],
489
+ options?: RouteGeofenceOptions
490
+ ): Promise<void> {
491
+ try {
492
+ await DoorstepAI.startRouteGeofencing(stops, options ?? null);
493
+ console.log(
494
+ 'DOORSTEPAI - Route geofencing started for',
495
+ stops.length,
496
+ 'stop(s)'
497
+ );
498
+ } catch (error: any) {
499
+ console.error('DOORSTEPAI - Failed to start route geofencing:', error);
500
+ throw error;
501
+ }
502
+ }
503
+
504
+ /**
505
+ * Replace the monitored stops in place without tearing down still-present
506
+ * stops' sessions. Stops dropped from the list are removed (their session is
507
+ * stopped only if a dropoff was marked); new stops are added and armed.
508
+ */
509
+ static async updateRouteStops(stops: DeliveryStop[]): Promise<void> {
510
+ try {
511
+ await DoorstepAI.updateRouteStops(stops);
512
+ } catch (error: any) {
513
+ console.error('DOORSTEPAI - Failed to update route stops:', error);
514
+ throw error;
515
+ }
516
+ }
517
+
518
+ /** Stop route geofencing and clear all monitored stops. */
519
+ static async stopRouteGeofencing(): Promise<void> {
520
+ try {
521
+ await DoorstepAI.stopRouteGeofencing();
522
+ } catch (error: any) {
523
+ console.error('DOORSTEPAI - Failed to stop route geofencing:', error);
524
+ throw error;
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Re-arm route geofencing after a process relaunch if a route was active.
530
+ * Safe no-op when no route is persisted.
531
+ */
532
+ static async resumeRouteGeofencingIfNeeded(): Promise<void> {
533
+ try {
534
+ await DoorstepAI.resumeRouteGeofencingIfNeeded();
535
+ } catch (error: any) {
536
+ console.error('DOORSTEPAI - Failed to resume route geofencing:', error);
537
+ throw error;
538
+ }
539
+ }
540
+
541
+ /** The stops currently registered for route geofencing (empty if none). */
542
+ static async getMonitoredStops(): Promise<DeliveryStop[]> {
543
+ try {
544
+ const stops = await DoorstepAI.getMonitoredStops();
545
+ return (stops as DeliveryStop[]) ?? [];
546
+ } catch (error: any) {
547
+ console.error('DOORSTEPAI - Failed to get monitored stops:', error);
548
+ return [];
549
+ }
550
+ }
551
+
552
+ /**
553
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
554
+ * geofence transitions). Returns a subscription — call `.remove()` to
555
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
556
+ */
557
+ static addGeofenceSessionListener(
558
+ listener: (event: GeofenceSessionEvent) => void
559
+ ): EmitterSubscription | undefined {
560
+ return doorstepEventEmitter?.addListener(GEOFENCE_SESSION_EVENT, listener);
561
+ }
562
+
416
563
  // ---- Dev-mode helpers (Android exposes a richer surface than iOS) ----
417
564
 
418
565
  static async enableDevMode(apiKey: string): Promise<boolean> {
@@ -437,4 +584,13 @@ class DoorstepAIModule {
437
584
  }
438
585
 
439
586
  export { DoorstepAIModule as DoorstepAI };
440
- export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
587
+ export type {
588
+ AddressType,
589
+ LatLngObject,
590
+ StartDeliveryOptions,
591
+ SDKLogLevel,
592
+ DeliveryStop,
593
+ RouteGeofenceOptions,
594
+ GeofenceSessionEvent,
595
+ GeofenceSessionEventType,
596
+ };
@@ -16,6 +16,9 @@ export function RootDoorstepAI(props: {
16
16
  apiKey: string;
17
17
  notificationTitle?: string;
18
18
  notificationText?: string;
19
+ /** Opt-in: also request Bluetooth (BLE) permission. Off by default — only
20
+ * needed if the `ble` config section is enabled for your fleet. */
21
+ requestBluetooth?: boolean;
19
22
  }) {
20
23
  useEffect(() => {
21
24
  const initializeAndRequestPermissions = async () => {
@@ -34,6 +37,10 @@ export function RootDoorstepAI(props: {
34
37
  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
35
38
  PermissionsAndroid.PERMISSIONS.ACTIVITY_RECOGNITION,
36
39
  ];
40
+ // Opt-in Bluetooth (BLE) — Android 12+ "Nearby devices" (BLUETOOTH_SCAN).
41
+ if (props.requestBluetooth && PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN) {
42
+ permissionsToRequest.push(PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN);
43
+ }
37
44
 
38
45
  const granted =
39
46
  await PermissionsAndroid.requestMultiple(permissionsToRequest);
@@ -55,11 +62,21 @@ export function RootDoorstepAI(props: {
55
62
  console.log(
56
63
  'iOS: Ensure location and motion usage descriptions are in Info.plist'
57
64
  );
65
+ // Opt-in Bluetooth: triggers the iOS BT prompt (needs
66
+ // NSBluetoothAlwaysUsageDescription in the host Info.plist).
67
+ if (props.requestBluetooth) {
68
+ DoorstepAI.requestAllPermissions(true, true);
69
+ }
58
70
  }
59
71
  };
60
72
 
61
73
  initializeAndRequestPermissions();
62
- }, [props.apiKey, props.notificationTitle, props.notificationText]);
74
+ }, [
75
+ props.apiKey,
76
+ props.notificationTitle,
77
+ props.notificationText,
78
+ props.requestBluetooth,
79
+ ]);
63
80
 
64
81
  // On iOS, the native view might handle triggering permission prompts if needed.
65
82
  // The main setup involves Info.plist configuration.