@wayq/beekon-rn 0.0.3 → 0.0.6

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 (84) hide show
  1. package/BeekonRn.podspec +5 -3
  2. package/CHANGELOG.md +103 -0
  3. package/README.md +326 -52
  4. package/android/build.gradle +9 -4
  5. package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +411 -59
  6. package/ios/BeekonRn.mm +103 -24
  7. package/ios/BeekonRn.swift +465 -61
  8. package/ios/Frameworks/BeekonKit.xcframework/Info.plist +5 -5
  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 +11424 -1279
  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 +262 -36
  14. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
  15. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
  16. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +11424 -1279
  17. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  18. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +262 -36
  19. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +11424 -1279
  20. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  21. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +262 -36
  22. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +2 -80
  23. package/lib/module/NativeBeekonRn.js +35 -7
  24. package/lib/module/NativeBeekonRn.js.map +1 -1
  25. package/lib/module/beekon.js +246 -45
  26. package/lib/module/beekon.js.map +1 -1
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/internal/mappers.js +166 -25
  29. package/lib/module/internal/mappers.js.map +1 -1
  30. package/lib/module/types/auth.js +4 -0
  31. package/lib/module/types/auth.js.map +1 -0
  32. package/lib/module/types/config.js +2 -0
  33. package/lib/module/types/enums.js +2 -0
  34. package/lib/module/types/enums.js.map +1 -0
  35. package/lib/module/types/error.js +20 -4
  36. package/lib/module/types/error.js.map +1 -1
  37. package/lib/module/types/geofence.js +2 -0
  38. package/lib/module/types/geofence.js.map +1 -0
  39. package/lib/module/types/location.js +2 -0
  40. package/lib/module/types/sync.js +2 -0
  41. package/lib/module/types/sync.js.map +1 -0
  42. package/lib/typescript/src/NativeBeekonRn.d.ts +150 -20
  43. package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
  44. package/lib/typescript/src/beekon.d.ts +110 -33
  45. package/lib/typescript/src/beekon.d.ts.map +1 -1
  46. package/lib/typescript/src/index.d.ts +6 -2
  47. package/lib/typescript/src/index.d.ts.map +1 -1
  48. package/lib/typescript/src/internal/mappers.d.ts +16 -6
  49. package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
  50. package/lib/typescript/src/types/auth.d.ts +99 -0
  51. package/lib/typescript/src/types/auth.d.ts.map +1 -0
  52. package/lib/typescript/src/types/config.d.ts +66 -20
  53. package/lib/typescript/src/types/config.d.ts.map +1 -1
  54. package/lib/typescript/src/types/enums.d.ts +62 -0
  55. package/lib/typescript/src/types/enums.d.ts.map +1 -0
  56. package/lib/typescript/src/types/error.d.ts +21 -5
  57. package/lib/typescript/src/types/error.d.ts.map +1 -1
  58. package/lib/typescript/src/types/geofence.d.ts +36 -0
  59. package/lib/typescript/src/types/geofence.d.ts.map +1 -0
  60. package/lib/typescript/src/types/location.d.ts +22 -8
  61. package/lib/typescript/src/types/location.d.ts.map +1 -1
  62. package/lib/typescript/src/types/state.d.ts +13 -4
  63. package/lib/typescript/src/types/state.d.ts.map +1 -1
  64. package/lib/typescript/src/types/sync.d.ts +27 -0
  65. package/lib/typescript/src/types/sync.d.ts.map +1 -0
  66. package/package.json +8 -5
  67. package/scripts/fetch-beekonkit.sh +5 -5
  68. package/src/NativeBeekonRn.ts +165 -20
  69. package/src/beekon.ts +278 -48
  70. package/src/index.tsx +24 -2
  71. package/src/internal/mappers.ts +242 -27
  72. package/src/types/auth.ts +101 -0
  73. package/src/types/config.ts +68 -20
  74. package/src/types/enums.ts +80 -0
  75. package/src/types/error.ts +23 -5
  76. package/src/types/geofence.ts +37 -0
  77. package/src/types/location.ts +28 -8
  78. package/src/types/state.ts +13 -3
  79. package/src/types/sync.ts +23 -0
  80. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
  81. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
  82. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +0 -296
  83. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
  84. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +0 -146
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/types/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,cAAc,CAAC;IACnC,kFAAkF;IAClF,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iGAAiG;IACjG,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,33 +1,79 @@
1
+ import type { AuthConfig } from './auth';
2
+ import type { AccuracyMode, StationaryMode } from './enums';
1
3
  /**
2
- * Foreground-service notification overrides. Android-only — required by the
3
- * platform because every location foreground service must show a persistent
4
- * notification. All fields are optional; missing values resolve at runtime
5
- * against the host app's label and icon. Ignored on iOS.
4
+ * Foreground-service notification overrides. **Android-only**the platform
5
+ * requires every location foreground service to show a persistent notification.
6
+ * Both fields are optional; missing values fall back to native defaults.
7
+ * Ignored on iOS.
6
8
  */
7
- export type AndroidNotificationConfig = {
8
- /** Notification title. Defaults to "Location active". */
9
+ export type NotificationConfig = {
10
+ /** Notification title. Defaults to "Tracking location". */
9
11
  title?: string;
10
- /** Notification body text. Defaults to the host app's label. */
12
+ /** Notification body text. Defaults to no body. */
11
13
  text?: string;
12
14
  /**
13
- * Drawable resource name (e.g. `ic_notification`) resolved at runtime via
14
- * `Resources.getIdentifier()` against the host app's `res/drawable*` folders.
15
- * Pass the resource name without extension or `R.drawable.` prefix. Defaults
16
- * to the host app's `applicationInfo.icon`.
15
+ * Status-bar icon, given as an Android drawable or mipmap resource **name**
16
+ * `"ic_notification"`, `"drawable/ic_x"`, or `"mipmap/ic_x"`. Android
17
+ * renders the small icon from its alpha channel only, so supply a monochrome
18
+ * silhouette on a transparent background. Falls back to the host app's
19
+ * launcher icon when omitted or unresolvable.
17
20
  */
18
- smallIconResName?: string;
21
+ smallIcon?: string;
19
22
  };
20
23
  /**
21
- * Tracking configuration. Two knobs: a minimum time interval and a minimum
22
- * distance between emitted fixes. A fix is admitted only when **both** gates
23
- * are satisfied. Pass `0` to disable a gate.
24
+ * Server-upload configuration. Presence of {@link BeekonConfig.sync} turns on
25
+ * batched uploads of stored locations and geofence events; omitting it keeps
26
+ * tracking local-only.
24
27
  */
25
- export type BeekonConfig = {
26
- /** Minimum seconds between admitted fixes. Default: `30`. `0` disables the time gate. */
28
+ export type SyncConfig = {
29
+ /** Ingest endpoint an `http` or `https` URL. */
30
+ url: string;
31
+ /** Extra HTTP headers sent with every upload (e.g. `Authorization`). */
32
+ headers?: Record<string, string>;
33
+ /**
34
+ * Target seconds between uploads. The SDK enforces a 60s floor; background
35
+ * uploads may be delayed to the OS scheduler floor (~15 min). Default: `300`.
36
+ */
27
37
  intervalSeconds?: number;
28
- /** Minimum metres between admitted fixes. Default: `100`. `0` disables the distance gate. */
29
- distanceMeters?: number;
38
+ /** Maximum locations per upload. Clamped to `[1, 1000]`. Default: `100`. */
39
+ batchSize?: number;
40
+ /**
41
+ * Declarative token-refresh recipe. When set, the SDK attaches and natively
42
+ * refreshes the access token (proactively before expiry, reactively on
43
+ * `401`/`403`). Omit to keep the legacy static-{@link SyncConfig.headers}
44
+ * behaviour. Requires the native SDK ≥ 0.0.6. See {@link AuthConfig}.
45
+ */
46
+ auth?: AuthConfig;
47
+ };
48
+ /**
49
+ * Tracking configuration. Every field is optional — `Beekon.start()` falls back
50
+ * to the previously persisted config, or to the documented defaults below if
51
+ * never configured.
52
+ *
53
+ * The two gate knobs (`minTimeBetweenLocationsSeconds`,
54
+ * `minDistanceBetweenLocationsMeters`) admit a fix only when **both** are
55
+ * satisfied; pass `0` to disable a gate.
56
+ */
57
+ export type BeekonConfig = {
58
+ /** Minimum seconds between admitted fixes (10s floor). Default: `30`. */
59
+ minTimeBetweenLocationsSeconds?: number;
60
+ /** Minimum metres between admitted fixes. `0` disables it. Default: `100`. */
61
+ minDistanceBetweenLocationsMeters?: number;
62
+ /** Accuracy / battery preset. Default: `'balanced'`. */
63
+ accuracyMode?: AccuracyMode;
64
+ /** Behaviour while stationary. Default: `'pause'`. */
65
+ whenStationary?: StationaryMode;
66
+ /** Stationary exit-geofence radius, clamped to `[5, 1000]`. Default: `5`. */
67
+ stationaryRadiusMeters?: number;
68
+ /**
69
+ * Detect physical activity (walking, driving, …). Requires the
70
+ * `ACTIVITY_RECOGNITION` permission on Android and the `NSMotionUsageDescription`
71
+ * Info.plist key on iOS. Default: `false`.
72
+ */
73
+ detectActivity?: boolean;
74
+ /** Server-upload configuration. Omit to keep tracking local-only. */
75
+ sync?: SyncConfig;
30
76
  /** Android-only notification overrides. Ignored on iOS. */
31
- androidNotification?: AndroidNotificationConfig;
77
+ notification?: NotificationConfig;
32
78
  };
33
79
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;CACjD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,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;IACd;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,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;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB,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,62 @@
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
+ /**
49
+ * How the access token is attached to upload requests (token refresh).
50
+ *
51
+ * - `'bearer'` — `Authorization: Bearer <accessToken>` (JWT / OAuth2 style, default).
52
+ * - `'raw'` — `Authorization: <accessToken>` (the raw token, no scheme).
53
+ */
54
+ export type AuthStrategy = 'bearer' | 'raw';
55
+ /**
56
+ * Encoding of the token-refresh request body.
57
+ *
58
+ * - `'form'` — `application/x-www-form-urlencoded` (default; most OAuth2 endpoints).
59
+ * - `'json'` — `application/json`.
60
+ */
61
+ export type AuthBodyFormat = 'form' | 'json';
62
+ //# 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;AAEd;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC"}
@@ -1,11 +1,27 @@
1
1
  /**
2
- * Error kinds thrown from `Beekon.start()` / `Beekon.history()`. Match the
3
- * native `BeekonError` cases byte-for-byte.
2
+ * Error kinds thrown across the bridge.
3
+ *
4
+ * Lifecycle problems on the tracking path never throw — they surface on the
5
+ * `onState` stream as `stopped(reason)`. The exceptions are the storage/geofence
6
+ * kinds below and the precondition kinds thrown by the explicit one-shot
7
+ * `getCurrentLocation()` (which has no `onState` arc of its own to report on; a
8
+ * plain timeout returns `null` instead of throwing).
9
+ *
10
+ * - `'storage'` — a local-store (SQLite) read/write failed. Thrown by
11
+ * `getLocations()`, `deleteLocations()`, and `pendingUploadCount()`.
12
+ * - `'invalidGeofence'` — a geofence passed to `addGeofences()` failed
13
+ * validation (empty/oversized id, or non-positive radius).
14
+ * - `'permissionDenied'` — location permission is missing. Thrown by
15
+ * `getCurrentLocation()`.
16
+ * - `'locationServicesDisabled'` — system location services are off. Thrown by
17
+ * `getCurrentLocation()`.
18
+ * - `'locationUnavailable'` — location is otherwise unavailable (e.g. Play
19
+ * Services absent/old). Thrown by `getCurrentLocation()`.
4
20
  */
5
- export type BeekonErrorKind = 'permissionDenied' | 'locationServicesDisabled' | 'storageFailure';
21
+ export type BeekonErrorKind = 'storage' | 'invalidGeofence' | 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable';
6
22
  /**
7
- * Typed error surfaced from the bridge. The native module rejects promises
8
- * with the kind encoded as the error code; the facade re-wraps into this.
23
+ * Typed error surfaced from the bridge. The native module rejects promises with
24
+ * the kind encoded as the error code; the facade re-wraps into this.
9
25
  */
10
26
  export declare class BeekonError extends Error {
11
27
  readonly kind: BeekonErrorKind;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,0BAA0B,GAC1B,gBAAgB,CAAC;AAErB;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,eAAe,CAAC;gBAE1B,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,iBAAiB,GACjB,kBAAkB,GAClB,0BAA0B,GAC1B,qBAAqB,CAAC;AAE1B;;;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"}
@@ -1,17 +1,23 @@
1
+ import type { ActivityType, LocationQuality, LocationTrigger, MotionState } from './enums';
1
2
  /**
2
3
  * A single location fix as emitted by the native SDK after gating. Fields map
3
4
  * 1:1 to `in.wayq.beekon.Location` on Android and `BeekonKit.Location` on iOS.
4
5
  *
5
- * `lat`, `lng`, and `timestamp` are always present. The four optional fields
6
- * are `null` when the OS did not report a value — the SDK never invents a
7
- * value to mask absence (e.g. a stationary device returns `bearing === null`,
8
- * not `0`).
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.
9
11
  */
10
12
  export type Location = {
13
+ /** Stable, unique storage id. Used as the dedup key on upload. */
14
+ id: string;
11
15
  /** Latitude in degrees, WGS-84. */
12
- lat: number;
16
+ latitude: number;
13
17
  /** Longitude in degrees, WGS-84. */
14
- lng: number;
18
+ longitude: number;
19
+ /** Time the OS provider reported this fix (not when JS received it). */
20
+ timestamp: Date;
15
21
  /** Horizontal accuracy in meters (1-sigma); `null` if unreported. */
16
22
  accuracy: number | null;
17
23
  /** Speed in m/s; `null` if unreported. */
@@ -20,7 +26,15 @@ export type Location = {
20
26
  bearing: number | null;
21
27
  /** Altitude in meters above the WGS-84 ellipsoid; `null` if unreported. */
22
28
  altitude: number | null;
23
- /** Time the OS provider reported this fix (not when JS received it). */
24
- timestamp: Date;
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;
25
39
  };
26
40
  //# sourceMappingURL=location.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../src/types/location.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,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,wEAAwE;IACxE,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}
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,15 +1,24 @@
1
1
  /**
2
2
  * Reason a tracking session ended. Mirrors `StopReason` on both platforms.
3
3
  *
4
- * `'system'` is Android-only surfaces when the OS terminates the foreground
5
- * service (memory pressure, force-stop). iOS will never emit `'system'`.
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).
6
13
  */
7
- export type StopReason = 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'system';
14
+ export type StopReason = 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable' | 'system';
8
15
  /**
9
16
  * Tracking state. Mirrors the native `BeekonState` sealed type on both
10
17
  * platforms. Use the `kind` field as a discriminator.
11
18
  *
12
- * Lifecycle: `idle → tracking → stopped(reason)`.
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.
13
22
  */
14
23
  export type BeekonState = {
15
24
  kind: 'idle';
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,kBAAkB,GAClB,0BAA0B,GAC1B,QAAQ,CAAC;AAEb;;;;;GAKG;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"}
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.3",
3
+ "version": "0.0.6",
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",
@@ -20,6 +20,7 @@
20
20
  "scripts/fetch-beekonkit.sh",
21
21
  "*.podspec",
22
22
  "LICENSE.txt",
23
+ "CHANGELOG.md",
23
24
  "!ios/build",
24
25
  "!android/build",
25
26
  "!android/gradle",
@@ -45,23 +46,25 @@
45
46
  "android",
46
47
  "location",
47
48
  "tracking",
49
+ "location-tracking",
48
50
  "gps",
51
+ "gps-tracking",
49
52
  "background-location",
50
53
  "geolocation",
54
+ "geofencing",
51
55
  "beekon",
52
56
  "turbo-module"
53
57
  ],
54
58
  "repository": {
55
59
  "type": "git",
56
- "url": "git+https://github.com/wayqteam/beekon.git",
57
- "directory": "beekon-rn"
60
+ "url": "git+https://github.com/wayqteam/beekon-rn.git"
58
61
  },
59
62
  "author": "wayqteam <wayqteam@users.noreply.github.com> (https://github.com/wayqteam)",
60
63
  "license": "SEE LICENSE IN LICENSE.txt",
61
64
  "bugs": {
62
- "url": "https://github.com/wayqteam/beekon/issues"
65
+ "url": "https://github.com/wayqteam/beekon-rn/issues"
63
66
  },
64
- "homepage": "https://github.com/wayqteam/beekon/tree/main/beekon-rn#readme",
67
+ "homepage": "https://github.com/wayqteam/beekon-rn#readme",
65
68
  "publishConfig": {
66
69
  "registry": "https://registry.npmjs.org/",
67
70
  "access": "public"
@@ -13,12 +13,12 @@
13
13
 
14
14
  set -euo pipefail
15
15
 
16
- VERSION="0.0.3"
16
+ VERSION="0.0.6"
17
17
  URL="https://github.com/wayqteam/beekon-ios-binary/releases/download/v${VERSION}/BeekonKit.xcframework.zip"
18
- # TODO(0.0.3): replace with the SHA256 emitted by `scripts/build-xcframework.sh`
19
- # when the v0.0.3 BeekonKit binary is cut and uploaded. v0.0.3 is the first
20
- # release with nullable Location fields (accuracy/speed/bearing/altitude).
21
- EXPECTED_SHA="c2f1990dd7064314deffc4af430839b0c8b7e61851e591c34fb683aed2fff127"
18
+ # SHA256 of the v0.0.6 BeekonKit.xcframework.zip. Matches the SwiftPM
19
+ # `binaryTarget` checksum in beekon-ios-binary's Package.swift at tag v0.0.6
20
+ # (SwiftPM's compute-checksum is the SHA256 of the zip).
21
+ EXPECTED_SHA="eb0cd87c869cdbce5374569efa2d47f0f7e6c01ce18461c0653ef701163cf343"
22
22
 
23
23
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
24
24
  DEST_DIR="${ROOT}/ios/Frameworks"