@wayq/beekon-rn 0.0.1 → 0.0.5

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 (92) hide show
  1. package/BeekonRn.podspec +4 -4
  2. package/README.md +94 -48
  3. package/android/build.gradle +11 -6
  4. package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +428 -0
  5. package/android/src/main/java/{com → in}/wayq/beekonrn/BeekonRnPackage.kt +1 -1
  6. package/ios/BeekonRn.h +5 -1
  7. package/ios/BeekonRn.mm +90 -34
  8. package/ios/BeekonRn.swift +396 -116
  9. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
  10. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
  11. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +8636 -0
  12. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  13. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +236 -0
  14. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/PrivacyInfo.xcprivacy +1 -1
  15. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
  16. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
  17. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +8636 -0
  18. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +236 -0
  20. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +8636 -0
  21. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  22. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +236 -0
  23. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/PrivacyInfo.xcprivacy +1 -1
  24. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +2 -14
  25. package/lib/module/NativeBeekonRn.js +22 -7
  26. package/lib/module/NativeBeekonRn.js.map +1 -1
  27. package/lib/module/beekon.js +209 -60
  28. package/lib/module/beekon.js.map +1 -1
  29. package/lib/module/index.js +1 -0
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/internal/mappers.js +145 -23
  32. package/lib/module/internal/mappers.js.map +1 -1
  33. package/lib/module/types/enums.js +2 -0
  34. package/lib/module/types/{preset.js.map → enums.js.map} +1 -1
  35. package/lib/module/types/error.js +25 -0
  36. package/lib/module/types/error.js.map +1 -0
  37. package/lib/module/types/geofence.js +2 -0
  38. package/lib/module/types/{position.js.map → geofence.js.map} +1 -1
  39. package/lib/module/types/location.js +4 -0
  40. package/lib/module/types/location.js.map +1 -0
  41. package/lib/module/types/sync.js +2 -0
  42. package/lib/module/types/sync.js.map +1 -0
  43. package/lib/typescript/src/NativeBeekonRn.d.ts +113 -35
  44. package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
  45. package/lib/typescript/src/beekon.d.ts +84 -49
  46. package/lib/typescript/src/beekon.d.ts.map +1 -1
  47. package/lib/typescript/src/index.d.ts +7 -4
  48. package/lib/typescript/src/index.d.ts.map +1 -1
  49. package/lib/typescript/src/internal/mappers.d.ts +16 -3
  50. package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
  51. package/lib/typescript/src/types/config.d.ts +53 -31
  52. package/lib/typescript/src/types/config.d.ts.map +1 -1
  53. package/lib/typescript/src/types/enums.d.ts +48 -0
  54. package/lib/typescript/src/types/enums.d.ts.map +1 -0
  55. package/lib/typescript/src/types/error.d.ts +20 -0
  56. package/lib/typescript/src/types/error.d.ts.map +1 -0
  57. package/lib/typescript/src/types/geofence.d.ts +36 -0
  58. package/lib/typescript/src/types/geofence.d.ts.map +1 -0
  59. package/lib/typescript/src/types/location.d.ts +40 -0
  60. package/lib/typescript/src/types/location.d.ts.map +1 -0
  61. package/lib/typescript/src/types/state.d.ts +18 -9
  62. package/lib/typescript/src/types/state.d.ts.map +1 -1
  63. package/lib/typescript/src/types/sync.d.ts +27 -0
  64. package/lib/typescript/src/types/sync.d.ts.map +1 -0
  65. package/package.json +5 -6
  66. package/scripts/fetch-beekonkit.sh +5 -2
  67. package/src/NativeBeekonRn.ts +120 -34
  68. package/src/beekon.ts +235 -63
  69. package/src/index.tsx +23 -4
  70. package/src/internal/mappers.ts +213 -22
  71. package/src/types/config.ts +54 -31
  72. package/src/types/enums.ts +64 -0
  73. package/src/types/error.ts +25 -0
  74. package/src/types/geofence.ts +37 -0
  75. package/src/types/location.ts +45 -0
  76. package/src/types/state.ts +23 -7
  77. package/src/types/sync.ts +23 -0
  78. package/android/src/main/java/com/wayq/beekonrn/BeekonRnModule.kt +0 -233
  79. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
  80. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
  81. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
  82. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +0 -233
  83. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
  84. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +0 -113
  85. package/lib/module/types/position.js +0 -2
  86. package/lib/module/types/preset.js +0 -2
  87. package/lib/typescript/src/types/position.d.ts +0 -24
  88. package/lib/typescript/src/types/position.d.ts.map +0 -1
  89. package/lib/typescript/src/types/preset.d.ts +0 -12
  90. package/lib/typescript/src/types/preset.d.ts.map +0 -1
  91. package/src/types/position.ts +0 -23
  92. package/src/types/preset.ts +0 -11
@@ -1,79 +1,114 @@
1
1
  import type { BeekonConfig } from './types/config';
2
+ import type { BeekonGeofence, GeofenceEvent } from './types/geofence';
3
+ import type { Location } from './types/location';
2
4
  import type { BeekonState } from './types/state';
3
- import type { Position } from './types/position';
5
+ import type { SyncStatus } from './types/sync';
4
6
  /**
5
- * Public facade for the Beekon SDK. Mirrors the native APIs:
7
+ * Public facade for the Beekon SDK a 1:1 mirror of the native APIs:
6
8
  *
7
- * - Android: `com.wayq.beekon.Beekon` (object)
8
- * - iOS: `Beekon.shared` (actor)
9
+ * - Android: `in.wayq.beekon.Beekon` (object)
10
+ * - iOS: `BeekonKit.Beekon.shared` (actor)
9
11
  *
10
- * Lifecycle: `init()` once `configure(config)` `start()` ...
11
- * `stop()` (idempotent) or `shutdown()` (final teardown). Subscribe to
12
- * `onState` / `onPosition` for live updates; query `history(from, to)` for
13
- * persisted points.
12
+ * There is **no `initialize()`** the native SDKs auto-initialize. Lifecycle:
13
+ * `configure(config)` (optional; defaults 30s / 100m) `start()`
14
+ * `stop()`. `start()` / `stop()` **never throw** `onState` is the single
15
+ * source of truth for whether tracking is active and why it stopped.
14
16
  *
15
- * **Threading:** Methods are safe to call from any JS context. Subscribers'
17
+ * **Threading:** methods are safe to call from any JS context; subscriber
16
18
  * callbacks fire on the JS thread.
17
19
  *
18
- * **Persistence invariant:** the SDK persists every gated position natively;
19
- * JS is a passive observer. In background, the JS engine is not guaranteed to
20
- * be alive — for past points, use `history()`.
20
+ * **Persistence invariant:** the SDK persists every gated fix natively; JS is a
21
+ * passive observer that is not guaranteed to be alive in the background. For
22
+ * past fixes use `getLocations()`.
21
23
  */
22
24
  declare class BeekonImpl {
25
+ private readonly hub;
23
26
  /**
24
- * Initialize the SDK. Idempotent; safe to call more than once. Must be
25
- * called once before `configure()`.
26
- *
27
- * Errors:
28
- * - `NO_GMS_AVAILABLE` (Android) — Google Play Services missing.
29
- */
30
- init(): Promise<void>;
31
- /**
32
- * Set sampling and platform-specific config. Replaces any previous config.
33
- * Must be called before `start()`.
34
- *
35
- * Errors:
36
- * - `NOT_INITIALISED` — `init()` was not called first.
37
- * - `NOT_CONFIGURED` — Android only, `androidNotification` was missing.
27
+ * Set tracking parameters. Optional `start()` falls back to the previously
28
+ * persisted config, or the SDK defaults if never configured. While tracking,
29
+ * gate thresholds take effect on the next admitted fix without restarting the
30
+ * location subscription; `accuracyMode` applies on the next `start()`.
38
31
  */
39
32
  configure(config: BeekonConfig): Promise<void>;
40
33
  /**
41
- * Begin tracking. Transitions state from `idle` `starting` → `tracking`.
42
- *
43
- * Errors:
44
- * - `PERMISSION_DENIED` — location permission not granted.
45
- * - `LOCATION_SERVICES_DISABLED` (iOS) — system location services off.
46
- * - `SERVICE_FAILED` — native service couldn't start.
34
+ * Begin tracking. Never throws observe `onState` for the outcome
35
+ * (`stopped(reason)` on a permission / services / system problem). Beekon
36
+ * ships no permission API: request permissions in the host app, then observe
37
+ * `onState`.
47
38
  */
48
39
  start(): Promise<void>;
49
- /** Stop tracking. Idempotent. State `stopped`. */
40
+ /** Stop tracking. Idempotent. Registered geofences keep firing. */
50
41
  stop(): Promise<void>;
51
42
  /**
52
- * Final teardown releases native resources. Most apps don't need this;
53
- * `stop()` is sufficient between sessions.
43
+ * Resume tracking if a session was active before the app was terminated. A
44
+ * no-op if the user explicitly stopped. Call early in app startup.
45
+ *
46
+ * Note: on a background relaunch the JS engine may not be running, so true
47
+ * cold-launch resume also requires native host wiring (Android: call
48
+ * `Beekon.start()` from `Application.onCreate`; iOS: `registerBackgroundTasks`
49
+ * in the AppDelegate). See the README.
54
50
  */
55
- shutdown(): Promise<void>;
51
+ resumeIfNeeded(): Promise<void>;
56
52
  /**
57
- * Read persisted positions in the time range [from, to]. Returns positions
58
- * in chronological order. Reads come from the SDK's local storage (Room on
59
- * Android, GRDB on iOS) — the source of truth even when JS was asleep.
53
+ * Read persisted fixes in the inclusive range `[from, to]`, oldest first.
54
+ * Reads come from the SDK's local storage (Room on Android, GRDB on iOS) — the
55
+ * source of truth even when JS was asleep. With sync enabled, rows are deleted
56
+ * locally once the server accepts them, so this returns only un-uploaded fixes.
60
57
  *
61
- * Retention: positions older than 7 days OR beyond the most recent 100K are
62
- * pruned automatically.
58
+ * Throws `BeekonError` with kind `'storage'` on a database read failure.
59
+ */
60
+ getLocations(from: Date, to: Date): Promise<Location[]>;
61
+ /**
62
+ * Delete stored locations captured at or before `before` (all of them when
63
+ * `before` is omitted). Returns the number of rows removed. Throws
64
+ * `BeekonError` with kind `'storage'` on a failure.
65
+ */
66
+ deleteLocations(before?: Date): Promise<number>;
67
+ /**
68
+ * The number of stored locations not yet uploaded. Throws `BeekonError` with
69
+ * kind `'storage'` on a failure.
70
+ */
71
+ pendingUploadCount(): Promise<number>;
72
+ /**
73
+ * Request an immediate upload. Best-effort and self-retrying; a no-op when
74
+ * sync is not configured.
75
+ */
76
+ sync(): Promise<void>;
77
+ /** Set custom key/value fields (e.g. `user_id`) included with every upload. */
78
+ setExtras(extras: Record<string, string>): Promise<void>;
79
+ /**
80
+ * Register geofences. Re-adding an `id` replaces the existing one. Throws
81
+ * `BeekonError` with kind `'invalidGeofence'` if any entry fails validation —
82
+ * none are added when one is invalid.
63
83
  */
64
- history(from: Date, to: Date): Promise<Position[]>;
84
+ addGeofences(geofences: BeekonGeofence[]): Promise<void>;
85
+ /** Unregister geofences by id. Unknown ids are ignored. */
86
+ removeGeofences(ids: string[]): Promise<void>;
87
+ /** The currently registered geofences. */
88
+ listGeofences(): Promise<BeekonGeofence[]>;
65
89
  /**
66
- * Subscribe to state transitions. Returns an unsubscribe function. The
67
- * current state is delivered to new subscribers immediately (replay-1
68
- * semantics, matching the native `state` flow).
90
+ * Subscribe to tracking-state transitions (`idle` / `tracking` /
91
+ * `stopped(reason)`). The current state is delivered to new subscribers
92
+ * immediately (replay-1). Returns an unsubscribe function.
69
93
  */
70
94
  onState(cb: (s: BeekonState) => void): () => void;
71
95
  /**
72
- * Subscribe to gated positions as they arrive. Returns an unsubscribe
73
- * function. Broadcast (no replay) only delivers while the JS engine is
74
- * alive. For points emitted while JS was asleep, use `history()`.
96
+ * Subscribe to gated locations as they arrive. Broadcast (no replay) — only
97
+ * delivers while the JS engine is alive. For fixes emitted while JS was
98
+ * asleep, use `getLocations()`. Returns an unsubscribe function.
99
+ */
100
+ onLocation(cb: (l: Location) => void): () => void;
101
+ /**
102
+ * Subscribe to geofence enter / exit crossings. Broadcast (no replay).
103
+ * Returns an unsubscribe function.
104
+ */
105
+ onGeofenceEvent(cb: (e: GeofenceEvent) => void): () => void;
106
+ /**
107
+ * Subscribe to upload health (`idle` / `pending` / `failed(reason)`). The
108
+ * current status is delivered to new subscribers immediately (replay-1).
109
+ * Returns an unsubscribe function.
75
110
  */
76
- onPosition(cb: (p: Position) => void): () => void;
111
+ onSyncStatus(cb: (s: SyncStatus) => void): () => void;
77
112
  }
78
113
  export declare const Beekon: BeekonImpl;
79
114
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"beekon.d.ts","sourceRoot":"","sources":["../../../src/beekon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAM,UAAU;IACd;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpD;;;;;;;OAOG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,oDAAoD;IAC9C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;;;;;;OAOG;IACG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAKxD;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI;IAKjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI;CAMlD;AAED,eAAO,MAAM,MAAM,YAAmB,CAAC"}
1
+ {"version":3,"file":"beekon.d.ts","sourceRoot":"","sources":["../../../src/beekon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8F/C;;;;;;;;;;;;;;;;;GAiBG;AACH,cAAM,UAAU;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAkB;IAEtC;;;;;OAKG;IACG,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpD;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,mEAAmE;IAC7D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B;;;;;;;;OAQG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC;;;;;;;OAOG;IACG,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAY7D;;;;OAIG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IASrD;;;OAGG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAQ3C;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,+EAA+E;IACzE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D;;;;OAIG;IACG,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9D,2DAA2D;IACrD,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,0CAA0C;IACpC,aAAa,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAKhD;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI;IAIjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI;IAIjD;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAI3D;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI;CAGtD;AAED,eAAO,MAAM,MAAM,YAAmB,CAAC"}
@@ -1,6 +1,9 @@
1
1
  export { Beekon } from './beekon';
2
- export type { BeekonConfig, AndroidNotificationConfig } from './types/config';
3
- export type { Preset } from './types/preset';
4
- export type { BeekonState, PauseReason } from './types/state';
5
- export type { Position } from './types/position';
2
+ export type { BeekonConfig, SyncConfig, NotificationConfig, } from './types/config';
3
+ export type { AccuracyMode, StationaryMode, LocationTrigger, LocationQuality, MotionState, ActivityType, } from './types/enums';
4
+ export type { Location } from './types/location';
5
+ export type { BeekonGeofence, GeofenceEvent, Transition, } from './types/geofence';
6
+ export type { BeekonState, StopReason } from './types/state';
7
+ export type { SyncStatus, SyncFailure } from './types/sync';
8
+ export { BeekonError, type BeekonErrorKind } from './types/error';
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,YAAY,EACV,YAAY,EACZ,UAAU,EACV,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACV,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -1,8 +1,21 @@
1
1
  import type { BeekonConfig } from '../types/config';
2
+ import type { BeekonGeofence, GeofenceEvent } from '../types/geofence';
3
+ import type { Location } from '../types/location';
2
4
  import type { BeekonState } from '../types/state';
3
- import type { Position } from '../types/position';
4
- import type { WireConfig, WirePosition, WireState } from '../NativeBeekonRn';
5
+ import type { SyncStatus } from '../types/sync';
6
+ import type { WireConfig, WireGeofence, WireGeofenceEvent, WireKeyValue, WireLocation, WireState, WireSyncStatus } from '../NativeBeekonRn';
7
+ export declare function recordToEntries(record: Record<string, string> | undefined): WireKeyValue[];
5
8
  export declare function configToWire(config: BeekonConfig): WireConfig;
6
- export declare function wireToPosition(w: WirePosition): Position;
9
+ export declare function geofenceToWire(g: BeekonGeofence): WireGeofence;
10
+ export declare function wireToLocation(w: WireLocation): Location;
11
+ export declare function wireToGeofence(w: WireGeofence): BeekonGeofence;
12
+ export declare function wireToGeofenceEvent(w: WireGeofenceEvent): GeofenceEvent;
7
13
  export declare function wireToState(w: WireState): BeekonState;
14
+ export declare function wireToSyncStatus(w: WireSyncStatus): SyncStatus;
15
+ /**
16
+ * Re-throw a native promise rejection as a typed {@link BeekonError}. The native
17
+ * modules encode the kind in the error-code string (`STORAGE_FAILURE`,
18
+ * `INVALID_GEOFENCE`); anything else falls through as the original error.
19
+ */
20
+ export declare function rethrowAsBeekonError(e: unknown): never;
8
21
  //# sourceMappingURL=mappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/internal/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7E,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAQ7D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,QAAQ,CAUxD;AAOD,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,WAAW,CAiBrD"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/internal/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACf,MAAM,mBAAmB,CAAC;AAiB3B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACzC,YAAY,EAAE,CAGhB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CA0B7D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,YAAY,CAS9D;AAID,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,QAAQ,CA0CxD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,cAAc,CAS9D;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAOvE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,WAAW,CAYrD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,CAW9D;AAoCD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAQtD"}
@@ -1,41 +1,63 @@
1
- import type { Preset } from './preset';
1
+ import type { AccuracyMode, StationaryMode } from './enums';
2
2
  /**
3
- * Foreground service notification configrequired when running on Android
4
- * because Android 8+ requires a persistent notification while a foreground
5
- * service is active. Ignored on iOS.
3
+ * Foreground-service notification overrides. **Android-only** the platform
4
+ * requires every location foreground service to show a persistent notification.
5
+ * Both fields are optional; missing values fall back to native defaults.
6
+ * Ignored on iOS.
6
7
  */
7
- export type AndroidNotificationConfig = {
8
- /** NotificationChannel id (Android 8+). */
9
- channelId: string;
10
- /** User-visible channel display name. */
11
- channelName: string;
12
- /** Foreground notification id. Must be > 0. */
13
- notificationId: number;
14
- /** Notification title shown in the status bar. */
15
- title: string;
16
- /** Notification body text. */
17
- text: string;
8
+ export type NotificationConfig = {
9
+ /** Notification title. Defaults to "Tracking location". */
10
+ title?: string;
11
+ /** Notification body text. Defaults to no body. */
12
+ text?: string;
13
+ };
14
+ /**
15
+ * Server-upload configuration. Presence of {@link BeekonConfig.sync} turns on
16
+ * batched uploads of stored locations and geofence events; omitting it keeps
17
+ * tracking local-only.
18
+ */
19
+ export type SyncConfig = {
20
+ /** Ingest endpoint — an `http` or `https` URL. */
21
+ url: string;
22
+ /** Extra HTTP headers sent with every upload (e.g. `Authorization`). */
23
+ headers?: Record<string, string>;
18
24
  /**
19
- * Drawable resource name for the notification icon (e.g. `ic_notification`).
20
- * Resolved at runtime via `Resources.getIdentifier()` against the host app's
21
- * `res/drawable*` folders. Pass the resource name without extension or
22
- * `R.drawable.` prefix.
25
+ * Target seconds between uploads. The SDK enforces a 60s floor; background
26
+ * uploads may be delayed to the OS scheduler floor (~15 min). Default: `300`.
23
27
  */
24
- smallIconResName: string;
28
+ intervalSeconds?: number;
29
+ /** Maximum locations per upload. Clamped to `[1, 1000]`. Default: `100`. */
30
+ batchSize?: number;
25
31
  };
32
+ /**
33
+ * Tracking configuration. Every field is optional — `Beekon.start()` falls back
34
+ * to the previously persisted config, or to the documented defaults below if
35
+ * never configured.
36
+ *
37
+ * The two gate knobs (`minTimeBetweenLocationsSeconds`,
38
+ * `minDistanceBetweenLocationsMeters`) admit a fix only when **both** are
39
+ * satisfied; pass `0` to disable a gate.
40
+ */
26
41
  export type BeekonConfig = {
27
- /** Sampling preset. Default: `'balanced'`. */
28
- preset?: Preset;
29
- /** Override the preset's distance gate (meters). */
30
- distanceFilterMeters?: number;
31
- /** Override the preset's interval (milliseconds). */
32
- intervalMillis?: number;
42
+ /** Minimum seconds between admitted fixes (10s floor). Default: `30`. */
43
+ minTimeBetweenLocationsSeconds?: number;
44
+ /** Minimum metres between admitted fixes. `0` disables it. Default: `100`. */
45
+ minDistanceBetweenLocationsMeters?: number;
46
+ /** Accuracy / battery preset. Default: `'balanced'`. */
47
+ accuracyMode?: AccuracyMode;
48
+ /** Behaviour while stationary. Default: `'pause'`. */
49
+ whenStationary?: StationaryMode;
50
+ /** Stationary exit-geofence radius, clamped to `[5, 1000]`. Default: `5`. */
51
+ stationaryRadiusMeters?: number;
33
52
  /**
34
- * Required when running on Android. Ignored on iOS. The plugin throws
35
- * `NOT_CONFIGURED` if missing on Android.
53
+ * Detect physical activity (walking, driving, …). Requires the
54
+ * `ACTIVITY_RECOGNITION` permission on Android and the `NSMotionUsageDescription`
55
+ * Info.plist key on iOS. Default: `false`.
36
56
  */
37
- androidNotification?: AndroidNotificationConfig;
38
- /** Optional license key. Reserved for future use. */
39
- licenseKey?: string;
57
+ detectActivity?: boolean;
58
+ /** Server-upload configuration. Omit to keep tracking local-only. */
59
+ sync?: SyncConfig;
60
+ /** Android-only notification overrides. Ignored on iOS. */
61
+ notification?: NotificationConfig;
40
62
  };
41
63
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;IAChD,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,yEAAyE;IACzE,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,8EAA8E;IAC9E,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,sDAAsD;IACtD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qEAAqE;IACrE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Value enums shared across the public API, expressed as string-literal unions
3
+ * (idiomatic TS). Each mirrors the like-named enum on both native SDKs by value;
4
+ * the wire layer carries them as plain strings and the mappers translate.
5
+ */
6
+ /**
7
+ * Accuracy / battery-life preset for the location provider.
8
+ *
9
+ * - `'high'` — highest precision, highest battery cost (GPS-grade).
10
+ * - `'balanced'` — city-block precision, balanced battery (the default).
11
+ * - `'low'` — coarse, lowest battery.
12
+ */
13
+ export type AccuracyMode = 'high' | 'balanced' | 'low';
14
+ /**
15
+ * Behaviour while the device is stationary.
16
+ *
17
+ * - `'keepTracking'` — GPS stays on.
18
+ * - `'pause'` — GPS off while stationary, silent resume on movement (default).
19
+ * - `'pauseWithCheckIns'` — GPS off, but a location is recorded roughly every
20
+ * 15 minutes.
21
+ */
22
+ export type StationaryMode = 'keepTracking' | 'pause' | 'pauseWithCheckIns';
23
+ /**
24
+ * Why a {@link Location} was admitted and persisted.
25
+ *
26
+ * - `'interval'` — a scheduled fix that passed the time/distance gate.
27
+ * - `'motion'` — the device started or stopped moving.
28
+ * - `'checkIn'` — a periodic check-in while stationary.
29
+ * - `'geofence'` — a geofence crossing.
30
+ * - `'manual'` — an explicit request.
31
+ */
32
+ export type LocationTrigger = 'interval' | 'motion' | 'checkIn' | 'geofence' | 'manual';
33
+ /**
34
+ * The gate's quality verdict for a {@link Location}.
35
+ *
36
+ * - `'ok'` — passed the accuracy and speed checks.
37
+ * - `'lowAccuracy'` — worse than the usable accuracy threshold.
38
+ * - `'implausibleSpeed'` — an implausible jump from the previous fix.
39
+ */
40
+ export type LocationQuality = 'ok' | 'lowAccuracy' | 'implausibleSpeed';
41
+ /** Device motion when a {@link Location} was captured. */
42
+ export type MotionState = 'moving' | 'stationary' | 'unknown';
43
+ /**
44
+ * Detected physical activity. Only populated when
45
+ * {@link BeekonConfig.detectActivity} is enabled; otherwise `null`.
46
+ */
47
+ export type ActivityType = 'stationary' | 'walking' | 'running' | 'cycling' | 'automotive' | 'unknown';
48
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAExE,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Error kinds thrown across the bridge. These are the **only** errors Beekon
3
+ * throws — permission / location-services / lifecycle problems never throw; they
4
+ * surface on the `onState` stream as `stopped(reason)` instead.
5
+ *
6
+ * - `'storage'` — a local-store (SQLite) read/write failed. Thrown by
7
+ * `getLocations()`, `deleteLocations()`, and `pendingUploadCount()`.
8
+ * - `'invalidGeofence'` — a geofence passed to `addGeofences()` failed
9
+ * validation (empty/oversized id, or non-positive radius).
10
+ */
11
+ export type BeekonErrorKind = 'storage' | 'invalidGeofence';
12
+ /**
13
+ * Typed error surfaced from the bridge. The native module rejects promises with
14
+ * the kind encoded as the error code; the facade re-wraps into this.
15
+ */
16
+ export declare class BeekonError extends Error {
17
+ readonly kind: BeekonErrorKind;
18
+ constructor(kind: BeekonErrorKind, message: string);
19
+ }
20
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,iBAAiB,CAAC;AAE5D;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,eAAe,CAAC;gBAE1B,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A circular geofence registered via `Beekon.addGeofences()`. Mirrors
3
+ * `BeekonGeofence` on both native SDKs. The SDK pages registrations
4
+ * automatically, so you may register more than the OS geofence limit.
5
+ */
6
+ export type BeekonGeofence = {
7
+ /** Unique id, 1–100 characters. Re-adding an existing id replaces it. */
8
+ id: string;
9
+ /** Center latitude in degrees, WGS-84. */
10
+ latitude: number;
11
+ /** Center longitude in degrees, WGS-84. */
12
+ longitude: number;
13
+ /** Radius in metres. Must be `> 0`; `>= 100` is recommended for reliability. */
14
+ radiusMeters: number;
15
+ /** Emit an event on entry. Default: `true`. */
16
+ notifyOnEntry?: boolean;
17
+ /** Emit an event on exit. Default: `true`. */
18
+ notifyOnExit?: boolean;
19
+ };
20
+ /** Whether a {@link GeofenceEvent} marks entering or exiting a geofence. */
21
+ export type Transition = 'enter' | 'exit';
22
+ /**
23
+ * A geofence entry/exit crossing, delivered via `Beekon.onGeofenceEvent()`.
24
+ * Mirrors `GeofenceEvent` on both native SDKs.
25
+ */
26
+ export type GeofenceEvent = {
27
+ /** Unique event id. Used as the dedup key on upload. */
28
+ id: string;
29
+ /** The {@link BeekonGeofence.id} that was crossed. */
30
+ geofenceId: string;
31
+ /** Whether the device entered or exited. */
32
+ type: Transition;
33
+ /** When the crossing happened. */
34
+ timestamp: Date;
35
+ };
36
+ //# sourceMappingURL=geofence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geofence.d.ts","sourceRoot":"","sources":["../../../../src/types/geofence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ActivityType, LocationQuality, LocationTrigger, MotionState } from './enums';
2
+ /**
3
+ * A single location fix as emitted by the native SDK after gating. Fields map
4
+ * 1:1 to `in.wayq.beekon.Location` on Android and `BeekonKit.Location` on iOS.
5
+ *
6
+ * `id`, `latitude`, `longitude`, and `timestamp` are always present. The four
7
+ * optional numeric fields are `null` when the OS did not report a value — the
8
+ * SDK never invents a value to mask absence (e.g. a stationary device returns
9
+ * `bearing === null`, not `0`). `activity` is `null` unless
10
+ * {@link BeekonConfig.detectActivity} is enabled.
11
+ */
12
+ export type Location = {
13
+ /** Stable, unique storage id. Used as the dedup key on upload. */
14
+ id: string;
15
+ /** Latitude in degrees, WGS-84. */
16
+ latitude: number;
17
+ /** Longitude in degrees, WGS-84. */
18
+ longitude: number;
19
+ /** Time the OS provider reported this fix (not when JS received it). */
20
+ timestamp: Date;
21
+ /** Horizontal accuracy in meters (1-sigma); `null` if unreported. */
22
+ accuracy: number | null;
23
+ /** Speed in m/s; `null` if unreported. */
24
+ speed: number | null;
25
+ /** Bearing in degrees `[0, 360)` clockwise from true north; `null` if unreported. */
26
+ bearing: number | null;
27
+ /** Altitude in meters above the WGS-84 ellipsoid; `null` if unreported. */
28
+ altitude: number | null;
29
+ /** The gate's quality verdict for this fix. */
30
+ quality: LocationQuality;
31
+ /** Why this fix was captured. */
32
+ trigger: LocationTrigger;
33
+ /** Device motion when this fix was captured. */
34
+ motion: MotionState;
35
+ /** Detected activity, or `null` unless activity detection is enabled. */
36
+ activity: ActivityType | null;
37
+ /** `true` if the OS flagged this fix as mock/simulated. */
38
+ isMock: boolean;
39
+ };
40
+ //# sourceMappingURL=location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../src/types/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,SAAS,EAAE,IAAI,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qFAAqF;IACrF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAC;IACzB,iCAAiC;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAC;IACpB,yEAAyE;IACzE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,2DAA2D;IAC3D,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -1,22 +1,31 @@
1
1
  /**
2
- * Why tracking is paused. Names match the native `PauseReason` enum on both
3
- * platforms byte-for-byte.
2
+ * Reason a tracking session ended. Mirrors `StopReason` on both platforms.
3
+ *
4
+ * - `'user'` — `Beekon.stop()` was called.
5
+ * - `'permissionDenied'` — location permission is missing or was revoked
6
+ * (user-fixable in Settings).
7
+ * - `'locationServicesDisabled'` — system-wide location services are off
8
+ * (user-fixable in Settings).
9
+ * - `'locationUnavailable'` — no usable location backend on this device (e.g.
10
+ * Google Play Services absent/outdated on Android). Not user-fixable.
11
+ * - `'system'` — the OS terminated tracking (e.g. foreground-service kill,
12
+ * or an unrecoverable internal error).
4
13
  */
5
- export type PauseReason = 'permissionRevoked' | 'locationDisabled' | 'unknown';
14
+ export type StopReason = 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable' | 'system';
6
15
  /**
7
- * Tracking state. Mirrors the native `BeekonState` sealed hierarchy on both
16
+ * Tracking state. Mirrors the native `BeekonState` sealed type on both
8
17
  * platforms. Use the `kind` field as a discriminator.
18
+ *
19
+ * Lifecycle: `idle → tracking → stopped(reason)`. `start()` / `stop()` never
20
+ * throw — this stream is the single source of truth for whether tracking is
21
+ * active and why it stopped.
9
22
  */
10
23
  export type BeekonState = {
11
24
  kind: 'idle';
12
- } | {
13
- kind: 'starting';
14
25
  } | {
15
26
  kind: 'tracking';
16
- } | {
17
- kind: 'paused';
18
- reason: PauseReason;
19
27
  } | {
20
28
  kind: 'stopped';
29
+ reason: StopReason;
21
30
  };
22
31
  //# sourceMappingURL=state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,kBAAkB,GAAG,SAAS,CAAC;AAE/E;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,kBAAkB,GAClB,0BAA0B,GAC1B,qBAAqB,GACrB,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Why a server upload failed terminally. Mirrors `SyncFailure` on both
3
+ * platforms.
4
+ *
5
+ * - `'auth'` — `401`/`403`; credentials were rejected. Refresh them (via
6
+ * `Beekon.configure()` with new `sync.headers`) and sync resumes.
7
+ * - `'rejected'` — `400`/`422`; the server rejected the payload. A payload bug;
8
+ * it won't self-resolve.
9
+ */
10
+ export type SyncFailure = 'auth' | 'rejected';
11
+ /**
12
+ * Upload health, delivered via `Beekon.onSyncStatus()`. Mirrors the native
13
+ * `SyncStatus` sealed type. Use the `kind` field as a discriminator.
14
+ *
15
+ * - `'idle'` — caught up, or sync is not configured.
16
+ * - `'pending'` — uploading or retrying (healthy).
17
+ * - `'failed'` — a terminal failure the app must act on.
18
+ */
19
+ export type SyncStatus = {
20
+ kind: 'idle';
21
+ } | {
22
+ kind: 'pending';
23
+ } | {
24
+ kind: 'failed';
25
+ reason: SyncFailure;
26
+ };
27
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/types/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wayq/beekon-rn",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "React Native binding for the Beekon location SDK (Android + iOS).",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -53,15 +53,14 @@
53
53
  ],
54
54
  "repository": {
55
55
  "type": "git",
56
- "url": "git+https://github.com/wayqteam/beekon.git",
57
- "directory": "beekon-rn"
56
+ "url": "git+https://github.com/wayqteam/beekon-rn.git"
58
57
  },
59
58
  "author": "wayqteam <wayqteam@users.noreply.github.com> (https://github.com/wayqteam)",
60
59
  "license": "SEE LICENSE IN LICENSE.txt",
61
60
  "bugs": {
62
- "url": "https://github.com/wayqteam/beekon/issues"
61
+ "url": "https://github.com/wayqteam/beekon-rn/issues"
63
62
  },
64
- "homepage": "https://github.com/wayqteam/beekon/tree/main/beekon-rn#readme",
63
+ "homepage": "https://github.com/wayqteam/beekon-rn#readme",
65
64
  "publishConfig": {
66
65
  "registry": "https://registry.npmjs.org/",
67
66
  "access": "public"
@@ -116,7 +115,7 @@
116
115
  "type": "modules",
117
116
  "jsSrcsDir": "src",
118
117
  "android": {
119
- "javaPackageName": "com.wayq.beekonrn"
118
+ "javaPackageName": "in.wayq.beekonrn"
120
119
  }
121
120
  },
122
121
  "prettier": {