@doorstepai/dropoff-sdk 2.0.8 → 2.0.9

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 (39) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/com/doorstepai/dropoffsdk/DoorstepAIModule.kt +147 -2
  3. package/ios/DoorstepAI.mm +15 -1
  4. package/ios/DoorstepAI.swift +127 -3
  5. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  6. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Info.plist +0 -0
  7. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.abi.json +5289 -1482
  8. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +88 -4
  9. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  10. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios.swiftinterface +88 -4
  11. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +11 -11
  12. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  13. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2560 -2116
  14. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/DoorstepDropoffSDK +0 -0
  15. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Info.plist +0 -0
  16. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +5289 -1482
  17. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +88 -4
  18. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +88 -4
  20. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +5289 -1482
  21. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +88 -4
  22. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/Modules/DoorstepDropoffSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +88 -4
  24. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/DoorstepDropoffSDK.framework/_CodeSignature/CodeResources +21 -21
  25. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/DWARF/DoorstepDropoffSDK +0 -0
  26. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/aarch64/DoorstepDropoffSDK.yml +2560 -2116
  27. package/ios/DoorstepDropoffSDK.xcframework/ios-arm64_x86_64-simulator/dSYMs/DoorstepDropoffSDK.framework.dSYM/Contents/Resources/Relocations/x86_64/DoorstepDropoffSDK.yml +2551 -2105
  28. package/lib/module/DoorstepAI.js +86 -3
  29. package/lib/module/DoorstepAI.js.map +1 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/typescript/src/DoorstepAI.d.ts +65 -2
  32. package/lib/typescript/src/DoorstepAI.d.ts.map +1 -1
  33. package/lib/typescript/src/RootDoorstepAI.d.ts +1 -1
  34. package/lib/typescript/src/RootDoorstepAI.d.ts.map +1 -1
  35. package/lib/typescript/src/index.d.ts +1 -1
  36. package/lib/typescript/src/index.d.ts.map +1 -1
  37. package/package.json +1 -1
  38. package/src/DoorstepAI.tsx +143 -4
  39. 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.
@@ -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,68 @@ 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
+ /** Stop route geofencing and clear all monitored stops. */
216
+ static async stopRouteGeofencing() {
217
+ try {
218
+ await DoorstepAI.stopRouteGeofencing();
219
+ } catch (error) {
220
+ console.error('DOORSTEPAI - Failed to stop route geofencing:', error);
221
+ throw error;
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Re-arm route geofencing after a process relaunch if a route was active.
227
+ * Safe no-op when no route is persisted.
228
+ */
229
+ static async resumeRouteGeofencingIfNeeded() {
230
+ try {
231
+ await DoorstepAI.resumeRouteGeofencingIfNeeded();
232
+ } catch (error) {
233
+ console.error('DOORSTEPAI - Failed to resume route geofencing:', error);
234
+ throw error;
235
+ }
236
+ }
237
+
238
+ /** The stops currently registered for route geofencing (empty if none). */
239
+ static async getMonitoredStops() {
240
+ try {
241
+ const stops = await DoorstepAI.getMonitoredStops();
242
+ return stops ?? [];
243
+ } catch (error) {
244
+ console.error('DOORSTEPAI - Failed to get monitored stops:', error);
245
+ return [];
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
251
+ * geofence transitions). Returns a subscription — call `.remove()` to
252
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
253
+ */
254
+ static addGeofenceSessionListener(listener) {
255
+ return doorstepEventEmitter?.addListener(GEOFENCE_SESSION_EVENT, listener);
256
+ }
257
+
175
258
  // ---- Dev-mode helpers (Android exposes a richer surface than iOS) ----
176
259
 
177
260
  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,OAAOC,aAAa,GAAG,KAAK;EAE5B,aAAaC,IAAIA,CACfC,iBAA0B,EAC1BC,gBAAyB,EACV;IACf,IAAIb,QAAQ,CAACc,EAAE,KAAK,SAAS,EAAE;MAC7B,IAAI,IAAI,CAACJ,aAAa,EAAE;QACtB;MACF;MACA,IAAI;QACF,MAAMT,UAAU,CAACU,IAAI,CAACC,iBAAiB,EAAEC,gBAAgB,CAAC;QAC1DE,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;QAClD,IAAI,CAACN,aAAa,GAAG,IAAI;MAC3B,CAAC,CAAC,OAAOJ,KAAK,EAAE;QACdS,OAAO,CAACT,KAAK,CAAC,+CAA+C,EAAEA,KAAK,CAAC;QACrE,MAAMA,KAAK;MACb;IACF,CAAC,CAAC;EACJ;EAEA,OAAOW,SAASA,CAACC,MAAc,EAAE;IAC/BjB,UAAU,CAACgB,SAAS,CAACC,MAAM,CAAC;EAC9B;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,qBAAqBA,CAACC,qBAA8B,GAAG,IAAI,EAAE;IAClE,IAAIpB,QAAQ,CAACc,EAAE,KAAK,KAAK,EAAE;MACzBb,UAAU,CAACkB,qBAAqB,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IlB,QAAQ,CAACc,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMb,UAAU,CAACsD,aAAa,CAACrC,MAAM,CAAC;MACtC,OAAO,IAAI;IACb;IACA,OAAOsC,OAAO,CAAC,MAAMvD,UAAU,CAACsD,aAAa,CAAC,CAAC,CAAC;EAClD;;EAEA;EACA,aAAaE,qBAAqBA,CAAA,EAAqB;IACrD,IAAIzD,QAAQ,CAACc,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAO0C,OAAO,CAAC,MAAMvD,UAAU,CAACwD,qBAAqB,CAAC,CAAC,CAAC;EAC1D;;EAEA;EACA,aAAaC,cAAcA,CAAA,EAAqB;IAC9C,IAAI1D,QAAQ,CAACc,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAO0C,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","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","stopRouteGeofencing","resumeRouteGeofencingIfNeeded","getMonitoredStops","addGeofenceSessionListener","listener","addListener","enableDevMode","Boolean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OAAO,CAACT,KAAK,CAAC,6CAA6C,EAAEA,KAAK,CAAC;MACnE,OAAO,EAAE;IACX;EACF;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOwD,0BAA0BA,CAC/BC,QAA+C,EACd;IACjC,OAAO/D,oBAAoB,EAAEgE,WAAW,CAACjE,sBAAsB,EAAEgE,QAAQ,CAAC;EAC5E;;EAEA;;EAEA,aAAaE,aAAaA,CAAC/C,MAAc,EAAoB;IAC3D,IAAIrB,QAAQ,CAACiB,EAAE,KAAK,KAAK,EAAE;MACzB,MAAMhB,UAAU,CAACmE,aAAa,CAAC/C,MAAM,CAAC;MACtC,OAAO,IAAI;IACb;IACA,OAAOgD,OAAO,CAAC,MAAMpE,UAAU,CAACmE,aAAa,CAAC,CAAC,CAAC;EAClD;;EAEA;EACA,aAAaE,qBAAqBA,CAAA,EAAqB;IACrD,IAAItE,QAAQ,CAACiB,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAOoD,OAAO,CAAC,MAAMpE,UAAU,CAACqE,qBAAqB,CAAC,CAAC,CAAC;EAC1D;;EAEA;EACA,aAAaC,cAAcA,CAAA,EAAqB;IAC9C,IAAIvE,QAAQ,CAACiB,EAAE,KAAK,SAAS,EAAE,OAAO,KAAK;IAC3C,OAAOoD,OAAO,CAAC,MAAMpE,UAAU,CAACsE,cAAc,CAAC,CAAC,CAAC;EACnD;AACF;AAEA,SAAS3D,gBAAgB,IAAIX,UAAU","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.
@@ -81,7 +117,34 @@ 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
+ /** Stop route geofencing and clear all monitored stops. */
134
+ static stopRouteGeofencing(): Promise<void>;
135
+ /**
136
+ * Re-arm route geofencing after a process relaunch if a route was active.
137
+ * Safe no-op when no route is persisted.
138
+ */
139
+ static resumeRouteGeofencingIfNeeded(): Promise<void>;
140
+ /** The stops currently registered for route geofencing (empty if none). */
141
+ static getMonitoredStops(): Promise<DeliveryStop[]>;
142
+ /**
143
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
144
+ * geofence transitions). Returns a subscription — call `.remove()` to
145
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
146
+ */
147
+ static addGeofenceSessionListener(listener: (event: GeofenceSessionEvent) => void): EmitterSubscription | undefined;
85
148
  static enableDevMode(apiKey: string): Promise<boolean>;
86
149
  /** Android only. Returns false on iOS. */
87
150
  static validateDevModeAccess(): Promise<boolean>;
@@ -89,5 +152,5 @@ declare class DoorstepAIModule {
89
152
  static disableDevMode(): Promise<boolean>;
90
153
  }
91
154
  export { DoorstepAIModule as DoorstepAI };
92
- export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
155
+ export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel, DeliveryStop, RouteGeofenceOptions, GeofenceSessionEvent, GeofenceSessionEventType, };
93
156
  //# 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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AAI,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,5 @@ 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
+ }): import("react").JSX.Element;
6
6
  //# 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;CAC3B,+BAoDA"}
@@ -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.0.9",
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.
@@ -397,9 +444,21 @@ class DoorstepAIModule {
397
444
  }
398
445
  }
399
446
 
400
- static async newEvent(eventName: string, deliveryId: string) {
447
+ /**
448
+ * Record a custom event on a delivery. `timestamp` is optional epoch SECONDS —
449
+ * when provided the event is recorded at that time instead of "now".
450
+ */
451
+ static async newEvent(
452
+ eventName: string,
453
+ deliveryId: string,
454
+ timestamp?: number
455
+ ) {
401
456
  try {
402
- const result = await DoorstepAI.newEvent(eventName, deliveryId);
457
+ const result = await DoorstepAI.newEvent(
458
+ eventName,
459
+ deliveryId,
460
+ timestamp ?? null
461
+ );
403
462
  console.log('DOORSTEPAI - Event sent successfully:', result);
404
463
  return result;
405
464
  } catch (error: any) {
@@ -413,6 +472,77 @@ class DoorstepAIModule {
413
472
  }
414
473
  }
415
474
 
475
+ // ---- Route geofencing (in-SDK) ----
476
+
477
+ /**
478
+ * Begin in-SDK route geofencing. The SDK fences each stop and auto-starts a
479
+ * delivery session on geofence ENTER / stops it on EXIT (EXIT is gated on
480
+ * `markDropoff`). Requires location permission; background operation needs
481
+ * "Allow all the time" (Android) / Always authorization (iOS). Subscribe to
482
+ * start/stop events via `addGeofenceSessionListener`.
483
+ */
484
+ static async startRouteGeofencing(
485
+ stops: DeliveryStop[],
486
+ options?: RouteGeofenceOptions
487
+ ): Promise<void> {
488
+ try {
489
+ await DoorstepAI.startRouteGeofencing(stops, options ?? null);
490
+ console.log(
491
+ 'DOORSTEPAI - Route geofencing started for',
492
+ stops.length,
493
+ 'stop(s)'
494
+ );
495
+ } catch (error: any) {
496
+ console.error('DOORSTEPAI - Failed to start route geofencing:', error);
497
+ throw error;
498
+ }
499
+ }
500
+
501
+ /** Stop route geofencing and clear all monitored stops. */
502
+ static async stopRouteGeofencing(): Promise<void> {
503
+ try {
504
+ await DoorstepAI.stopRouteGeofencing();
505
+ } catch (error: any) {
506
+ console.error('DOORSTEPAI - Failed to stop route geofencing:', error);
507
+ throw error;
508
+ }
509
+ }
510
+
511
+ /**
512
+ * Re-arm route geofencing after a process relaunch if a route was active.
513
+ * Safe no-op when no route is persisted.
514
+ */
515
+ static async resumeRouteGeofencingIfNeeded(): Promise<void> {
516
+ try {
517
+ await DoorstepAI.resumeRouteGeofencingIfNeeded();
518
+ } catch (error: any) {
519
+ console.error('DOORSTEPAI - Failed to resume route geofencing:', error);
520
+ throw error;
521
+ }
522
+ }
523
+
524
+ /** The stops currently registered for route geofencing (empty if none). */
525
+ static async getMonitoredStops(): Promise<DeliveryStop[]> {
526
+ try {
527
+ const stops = await DoorstepAI.getMonitoredStops();
528
+ return (stops as DeliveryStop[]) ?? [];
529
+ } catch (error: any) {
530
+ console.error('DOORSTEPAI - Failed to get monitored stops:', error);
531
+ return [];
532
+ }
533
+ }
534
+
535
+ /**
536
+ * Subscribe to geofence-session events (auto start/stop of a delivery on
537
+ * geofence transitions). Returns a subscription — call `.remove()` to
538
+ * unsubscribe. Returns `undefined` if the native module is unavailable.
539
+ */
540
+ static addGeofenceSessionListener(
541
+ listener: (event: GeofenceSessionEvent) => void
542
+ ): EmitterSubscription | undefined {
543
+ return doorstepEventEmitter?.addListener(GEOFENCE_SESSION_EVENT, listener);
544
+ }
545
+
416
546
  // ---- Dev-mode helpers (Android exposes a richer surface than iOS) ----
417
547
 
418
548
  static async enableDevMode(apiKey: string): Promise<boolean> {
@@ -437,4 +567,13 @@ class DoorstepAIModule {
437
567
  }
438
568
 
439
569
  export { DoorstepAIModule as DoorstepAI };
440
- export type { AddressType, LatLngObject, StartDeliveryOptions, SDKLogLevel };
570
+ export type {
571
+ AddressType,
572
+ LatLngObject,
573
+ StartDeliveryOptions,
574
+ SDKLogLevel,
575
+ DeliveryStop,
576
+ RouteGeofenceOptions,
577
+ GeofenceSessionEvent,
578
+ GeofenceSessionEventType,
579
+ };
package/src/index.tsx CHANGED
@@ -5,6 +5,10 @@ export type {
5
5
  LatLngObject,
6
6
  StartDeliveryOptions,
7
7
  SDKLogLevel,
8
+ DeliveryStop,
9
+ RouteGeofenceOptions,
10
+ GeofenceSessionEvent,
11
+ GeofenceSessionEventType,
8
12
  } from './DoorstepAI';
9
13
 
10
14
  export { DoorstepAI, RootDoorstepAI };