@wayq/beekon-rn 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BeekonRn.podspec +4 -2
- package/CHANGELOG.md +127 -0
- package/README.md +303 -81
- package/android/build.gradle +3 -2
- package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +164 -7
- package/ios/BeekonRn.mm +23 -0
- package/ios/BeekonRn.swift +199 -10
- package/ios/Frameworks/BeekonKit.xcframework/Info.plist +5 -5
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +7784 -2697
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +111 -3
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +7784 -2697
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +111 -3
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +7784 -2697
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +111 -3
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +1 -1
- package/lib/module/NativeBeekonRn.js +20 -0
- package/lib/module/NativeBeekonRn.js.map +1 -1
- package/lib/module/beekon.js +90 -7
- package/lib/module/beekon.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/mappers.js +98 -4
- package/lib/module/internal/mappers.js.map +1 -1
- package/lib/module/types/auth.js +4 -0
- package/lib/module/types/auth.js.map +1 -0
- package/lib/module/types/error.js +13 -3
- package/lib/module/types/error.js.map +1 -1
- package/lib/module/types/license.js +2 -0
- package/lib/module/types/license.js.map +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +84 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
- package/lib/typescript/src/beekon.d.ts +45 -1
- package/lib/typescript/src/beekon.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/mappers.d.ts +12 -1
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
- package/lib/typescript/src/types/auth.d.ts +99 -0
- package/lib/typescript/src/types/auth.d.ts.map +1 -0
- package/lib/typescript/src/types/config.d.ts +29 -0
- package/lib/typescript/src/types/config.d.ts.map +1 -1
- package/lib/typescript/src/types/enums.d.ts +14 -0
- package/lib/typescript/src/types/enums.d.ts.map +1 -1
- package/lib/typescript/src/types/error.d.ts +14 -4
- package/lib/typescript/src/types/error.d.ts.map +1 -1
- package/lib/typescript/src/types/license.d.ts +50 -0
- package/lib/typescript/src/types/license.d.ts.map +1 -0
- package/package.json +10 -2
- package/scripts/fetch-beekonkit.sh +4 -4
- package/src/NativeBeekonRn.ts +93 -0
- package/src/beekon.ts +104 -6
- package/src/index.tsx +4 -0
- package/src/internal/mappers.ts +109 -1
- package/src/types/auth.ts +101 -0
- package/src/types/config.ts +29 -0
- package/src/types/enums.ts +16 -0
- package/src/types/error.ts +19 -4
- package/src/types/license.ts +47 -0
package/src/types/config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthConfig } from './auth';
|
|
1
2
|
import type { AccuracyMode, StationaryMode } from './enums';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -11,6 +12,14 @@ export type NotificationConfig = {
|
|
|
11
12
|
title?: string;
|
|
12
13
|
/** Notification body text. Defaults to no body. */
|
|
13
14
|
text?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Status-bar icon, given as an Android drawable or mipmap resource **name**
|
|
17
|
+
* — `"ic_notification"`, `"drawable/ic_x"`, or `"mipmap/ic_x"`. Android
|
|
18
|
+
* renders the small icon from its alpha channel only, so supply a monochrome
|
|
19
|
+
* silhouette on a transparent background. Falls back to the host app's
|
|
20
|
+
* launcher icon when omitted or unresolvable.
|
|
21
|
+
*/
|
|
22
|
+
smallIcon?: string;
|
|
14
23
|
};
|
|
15
24
|
|
|
16
25
|
/**
|
|
@@ -30,6 +39,13 @@ export type SyncConfig = {
|
|
|
30
39
|
intervalSeconds?: number;
|
|
31
40
|
/** Maximum locations per upload. Clamped to `[1, 1000]`. Default: `100`. */
|
|
32
41
|
batchSize?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Declarative token-refresh recipe. When set, the SDK attaches and natively
|
|
44
|
+
* refreshes the access token (proactively before expiry, reactively on
|
|
45
|
+
* `401`/`403`). Omit to keep the legacy static-{@link SyncConfig.headers}
|
|
46
|
+
* behaviour. Requires the native SDK ≥ 0.0.6. See {@link AuthConfig}.
|
|
47
|
+
*/
|
|
48
|
+
auth?: AuthConfig;
|
|
33
49
|
};
|
|
34
50
|
|
|
35
51
|
/**
|
|
@@ -62,4 +78,17 @@ export type BeekonConfig = {
|
|
|
62
78
|
sync?: SyncConfig;
|
|
63
79
|
/** Android-only notification overrides. Ignored on iOS. */
|
|
64
80
|
notification?: NotificationConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Beekon license token (a `license-format-v1` JWS). The **highest-priority**
|
|
83
|
+
* supply channel (spec §9): it overrides the platform manifest value
|
|
84
|
+
* (`in.wayq.beekon.license` meta-data on Android, `BeekonLicenseKey` in
|
|
85
|
+
* `Info.plist` on iOS). `undefined`, blank, or whitespace-only means unset —
|
|
86
|
+
* the SDK falls through to the manifest, then to evaluation mode.
|
|
87
|
+
*
|
|
88
|
+
* The license **never blocks** the SDK; observe the outcome via
|
|
89
|
+
* {@link Beekon.licenseStatus} / {@link Beekon.onLicenseStatus}. Safe to commit
|
|
90
|
+
* to source control: a token is app-id-bound and product-bound, so it is
|
|
91
|
+
* useless to anyone else. Default: unset.
|
|
92
|
+
*/
|
|
93
|
+
licenseKey?: string;
|
|
65
94
|
};
|
package/src/types/enums.ts
CHANGED
|
@@ -62,3 +62,19 @@ export type ActivityType =
|
|
|
62
62
|
| 'cycling'
|
|
63
63
|
| 'automotive'
|
|
64
64
|
| 'unknown';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* How the access token is attached to upload requests (token refresh).
|
|
68
|
+
*
|
|
69
|
+
* - `'bearer'` — `Authorization: Bearer <accessToken>` (JWT / OAuth2 style, default).
|
|
70
|
+
* - `'raw'` — `Authorization: <accessToken>` (the raw token, no scheme).
|
|
71
|
+
*/
|
|
72
|
+
export type AuthStrategy = 'bearer' | 'raw';
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Encoding of the token-refresh request body.
|
|
76
|
+
*
|
|
77
|
+
* - `'form'` — `application/x-www-form-urlencoded` (default; most OAuth2 endpoints).
|
|
78
|
+
* - `'json'` — `application/json`.
|
|
79
|
+
*/
|
|
80
|
+
export type AuthBodyFormat = 'form' | 'json';
|
package/src/types/error.ts
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Error kinds thrown across the bridge.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
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).
|
|
5
9
|
*
|
|
6
10
|
* - `'storage'` — a local-store (SQLite) read/write failed. Thrown by
|
|
7
11
|
* `getLocations()`, `deleteLocations()`, and `pendingUploadCount()`.
|
|
8
12
|
* - `'invalidGeofence'` — a geofence passed to `addGeofences()` failed
|
|
9
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()`.
|
|
10
20
|
*/
|
|
11
|
-
export type BeekonErrorKind =
|
|
21
|
+
export type BeekonErrorKind =
|
|
22
|
+
| 'storage'
|
|
23
|
+
| 'invalidGeofence'
|
|
24
|
+
| 'permissionDenied'
|
|
25
|
+
| 'locationServicesDisabled'
|
|
26
|
+
| 'locationUnavailable';
|
|
12
27
|
|
|
13
28
|
/**
|
|
14
29
|
* Typed error surfaced from the bridge. The native module rejects promises with
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why an invalid license token failed verification (license-format-v1 §8.1).
|
|
3
|
+
* These are the exact wire-stable identifiers — the string names *are* the
|
|
4
|
+
* contract, shared verbatim with both native SDKs.
|
|
5
|
+
*
|
|
6
|
+
* - `'malformed'` — unparseable: bad encoding, structure, header, or claim types.
|
|
7
|
+
* - `'unknownKey'` — signed with a key this SDK build does not embed (update the SDK).
|
|
8
|
+
* - `'badSignature'` — the ES256 signature does not verify.
|
|
9
|
+
* - `'appIdMismatch'` — the license does not cover this application id.
|
|
10
|
+
* - `'productMismatch'` — the license does not cover this framework (here, `rn`).
|
|
11
|
+
* - `'unsupportedVersion'` — the token's claim schema is newer than this SDK understands.
|
|
12
|
+
*/
|
|
13
|
+
export type LicenseInvalidReason =
|
|
14
|
+
| 'malformed'
|
|
15
|
+
| 'unknownKey'
|
|
16
|
+
| 'badSignature'
|
|
17
|
+
| 'appIdMismatch'
|
|
18
|
+
| 'productMismatch'
|
|
19
|
+
| 'unsupportedVersion';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* License verification status for the **current platform** (license-format-v1
|
|
23
|
+
* §8). Purely observational — no status ever blocks, degrades, or delays the
|
|
24
|
+
* SDK. Use the `status` field as a discriminator.
|
|
25
|
+
*
|
|
26
|
+
* - `'notDetermined'` — before the first (lazy) validation completes.
|
|
27
|
+
* - `'evaluation'` — no license key supplied through any channel; running free.
|
|
28
|
+
* - `'expired'` — the license's expiry has passed.
|
|
29
|
+
* - `'updateEntitlementLapsed'` — this SDK build is newer than the license's
|
|
30
|
+
* covered update window. Still fully functional; renew to cover newer releases.
|
|
31
|
+
* - `'licensed'` — a valid license covering this app, framework, and SDK release;
|
|
32
|
+
* carries the opaque `tier` and `entitlements` (empty when the token carried none).
|
|
33
|
+
* - `'invalid'` — verification failed; see {@link LicenseInvalidReason}.
|
|
34
|
+
*
|
|
35
|
+
* **Platform divergence is legal** (spec §8.2): Android and iOS validate
|
|
36
|
+
* independently, so for one app the two platforms may report different statuses
|
|
37
|
+
* (e.g. a license scoped to `["android"]` reads `licensed` on Android and
|
|
38
|
+
* `invalid` / `productMismatch` on iOS). This value reflects only the platform
|
|
39
|
+
* you are running on; the wrapper never merges across platforms.
|
|
40
|
+
*/
|
|
41
|
+
export type LicenseStatus =
|
|
42
|
+
| { status: 'notDetermined' }
|
|
43
|
+
| { status: 'evaluation' }
|
|
44
|
+
| { status: 'expired' }
|
|
45
|
+
| { status: 'updateEntitlementLapsed' }
|
|
46
|
+
| { status: 'licensed'; tier: string; entitlements: string[] }
|
|
47
|
+
| { status: 'invalid'; reason: LicenseInvalidReason };
|