@wayq/beekon-rn 0.0.8 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BeekonRn.podspec +3 -3
- package/CHANGELOG.md +58 -6
- package/LICENSE.txt +3 -3
- package/README.md +85 -264
- package/android/build.gradle +2 -2
- package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +133 -8
- package/ios/BeekonRn.mm +40 -0
- package/ios/BeekonRn.swift +176 -8
- package/ios/Frameworks/BeekonKit.xcframework/Info.plist +5 -5
- package/ios/Frameworks/BeekonKit.xcframework/LICENSE.txt +3 -3
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +5839 -3482
- 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 +93 -16
- 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/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +5839 -3482
- 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 +93 -16
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +5839 -3482
- 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 +93 -16
- package/lib/module/NativeBeekonRn.js +6 -0
- package/lib/module/NativeBeekonRn.js.map +1 -1
- package/lib/module/beekon.js +109 -1
- package/lib/module/beekon.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/licenseNudge.js +64 -0
- package/lib/module/internal/licenseNudge.js.map +1 -0
- package/lib/module/internal/mappers.js +68 -8
- package/lib/module/internal/mappers.js.map +1 -1
- package/lib/module/types/config.js +73 -1
- package/lib/module/types/config.js.map +1 -1
- package/lib/module/types/log.js +4 -0
- package/lib/module/types/log.js.map +1 -0
- package/lib/module/types/permission.js +2 -0
- package/lib/module/types/permission.js.map +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +66 -2
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
- package/lib/typescript/src/beekon.d.ts +56 -1
- package/lib/typescript/src/beekon.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/licenseNudge.d.ts +38 -0
- package/lib/typescript/src/internal/licenseNudge.d.ts.map +1 -0
- package/lib/typescript/src/internal/mappers.d.ts +5 -1
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
- package/lib/typescript/src/types/config.d.ts +90 -7
- package/lib/typescript/src/types/config.d.ts.map +1 -1
- package/lib/typescript/src/types/enums.d.ts +8 -0
- package/lib/typescript/src/types/enums.d.ts.map +1 -1
- package/lib/typescript/src/types/log.d.ts +22 -0
- package/lib/typescript/src/types/log.d.ts.map +1 -0
- package/lib/typescript/src/types/permission.d.ts +42 -0
- package/lib/typescript/src/types/permission.d.ts.map +1 -0
- package/lib/typescript/src/types/state.d.ts +4 -1
- package/lib/typescript/src/types/state.d.ts.map +1 -1
- package/package.json +5 -5
- package/scripts/fetch-beekonkit.sh +6 -6
- package/src/NativeBeekonRn.ts +70 -2
- package/src/beekon.ts +114 -1
- package/src/index.tsx +12 -1
- package/src/internal/licenseNudge.ts +80 -0
- package/src/internal/mappers.ts +93 -7
- package/src/types/config.ts +99 -7
- package/src/types/enums.ts +9 -0
- package/src/types/log.ts +22 -0
- package/src/types/permission.ts +48 -0
- package/src/types/state.ts +4 -0
|
Binary file
|
|
@@ -106,14 +106,20 @@ public struct AuthTokens : Swift.Sendable, Swift.Equatable {
|
|
|
106
106
|
public var licenseStatusUpdates: _Concurrency.AsyncStream<BeekonKit.LicenseStatus> {
|
|
107
107
|
get
|
|
108
108
|
}
|
|
109
|
-
public func configure(_ config: BeekonKit.BeekonConfig) async
|
|
109
|
+
public func configure(_ config: BeekonKit.BeekonConfig) async throws
|
|
110
110
|
public func start() async
|
|
111
111
|
public func stop() async
|
|
112
112
|
public func resumeIfNeeded() async
|
|
113
113
|
public func getLocations(from: Foundation.Date, to: Foundation.Date) async throws -> [BeekonKit.Location]
|
|
114
114
|
public func getCurrentLocation(timeout: Foundation.TimeInterval = 15, accuracy: BeekonKit.AccuracyMode? = nil) async throws -> BeekonKit.Location?
|
|
115
|
+
nonisolated public func getPermissionStatus() -> BeekonKit.PermissionStatus
|
|
115
116
|
public func deleteLocations(before: Foundation.Date?) async throws -> Swift.Int
|
|
116
117
|
public func pendingUploadCount() async throws -> Swift.Int
|
|
118
|
+
nonisolated public func setLogLevel(_ level: BeekonKit.LogLevel)
|
|
119
|
+
public func getLog(from: Foundation.Date, to: Foundation.Date) async throws -> [BeekonKit.LogEntry]
|
|
120
|
+
public func exportLog() async throws -> Swift.String
|
|
121
|
+
public func clearLog() async throws
|
|
122
|
+
nonisolated public func log(_ level: BeekonKit.LogLevel, _ message: Swift.String)
|
|
117
123
|
public func sync()
|
|
118
124
|
public func setExtras(_ extras: [Swift.String : Swift.String])
|
|
119
125
|
public func addGeofences(_ geofences: [BeekonKit.BeekonGeofence]) async throws
|
|
@@ -134,26 +140,23 @@ public struct AuthTokens : Swift.Sendable, Swift.Equatable {
|
|
|
134
140
|
public var authChanges: _Concurrency.AsyncStream<BeekonKit.AuthTokens> {
|
|
135
141
|
get
|
|
136
142
|
}
|
|
143
|
+
public var logs: _Concurrency.AsyncStream<BeekonKit.LogEntry> {
|
|
144
|
+
get
|
|
145
|
+
}
|
|
137
146
|
@objc deinit
|
|
138
147
|
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
|
|
139
148
|
@_semantics("defaultActor") nonisolated final public var unownedExecutor: _Concurrency.UnownedSerialExecutor {
|
|
140
149
|
get
|
|
141
150
|
}
|
|
142
151
|
}
|
|
143
|
-
public struct BeekonConfig : Swift.Sendable, Swift.Equatable
|
|
144
|
-
public
|
|
145
|
-
public var minDistanceBetweenLocationsMeters: Swift.Double
|
|
146
|
-
public var accuracyMode: BeekonKit.AccuracyMode
|
|
147
|
-
public var whenStationary: BeekonKit.StationaryMode
|
|
148
|
-
public var stationaryRadiusMeters: Swift.Double
|
|
149
|
-
public var detectActivity: Swift.Bool
|
|
150
|
-
public var sync: BeekonKit.SyncConfig?
|
|
151
|
-
public var licenseKey: Swift.String?
|
|
152
|
-
public static let minimumLocationIntervalSeconds: Swift.Double
|
|
152
|
+
public struct BeekonConfig : Swift.Sendable, Swift.Equatable {
|
|
153
|
+
public static let minimumLocationIntervalSeconds: Foundation.TimeInterval
|
|
153
154
|
public static let minimumStationaryRadiusMeters: Swift.Double
|
|
154
|
-
public
|
|
155
|
-
public
|
|
156
|
-
public
|
|
155
|
+
public static func selfManaged(minTimeBetweenLocationsSeconds: Foundation.TimeInterval = 30, minDistanceBetweenLocationsMeters: Swift.Double = 100, accuracyMode: BeekonKit.AccuracyMode = .balanced, whenStationary: BeekonKit.StationaryMode = .pause, stationaryRadiusMeters: Swift.Double = 5, detectActivity: Swift.Bool = false, sync: BeekonKit.SyncConfig? = nil, licenseKey: Swift.String? = nil, logLevel: BeekonKit.LogLevel = .info) -> BeekonKit.BeekonConfig
|
|
156
|
+
public static func cloud(projectKey: Swift.String, endpoint: Swift.String? = nil, logLevel: BeekonKit.LogLevel = .info) throws -> BeekonKit.BeekonConfig
|
|
157
|
+
public var logLevel: BeekonKit.LogLevel {
|
|
158
|
+
get
|
|
159
|
+
}
|
|
157
160
|
public static func == (a: BeekonKit.BeekonConfig, b: BeekonKit.BeekonConfig) -> Swift.Bool
|
|
158
161
|
}
|
|
159
162
|
public struct SyncConfig : Swift.Sendable, Swift.Equatable, Swift.Codable {
|
|
@@ -161,14 +164,17 @@ public struct SyncConfig : Swift.Sendable, Swift.Equatable, Swift.Codable {
|
|
|
161
164
|
public var headers: [Swift.String : Swift.String]
|
|
162
165
|
public var intervalSeconds: Foundation.TimeInterval
|
|
163
166
|
public var batchSize: Swift.Int
|
|
167
|
+
public var syncThreshold: Swift.Int
|
|
164
168
|
public var auth: BeekonKit.AuthConfig?
|
|
165
|
-
public init(url: Foundation.URL, headers: [Swift.String : Swift.String] = [:], intervalSeconds: Foundation.TimeInterval = 300, batchSize: Swift.Int = 100, auth: BeekonKit.AuthConfig? = nil)
|
|
169
|
+
public init(url: Foundation.URL, headers: [Swift.String : Swift.String] = [:], intervalSeconds: Foundation.TimeInterval = 300, batchSize: Swift.Int = 100, syncThreshold: Swift.Int = 0, auth: BeekonKit.AuthConfig? = nil)
|
|
170
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
166
171
|
public static func == (a: BeekonKit.SyncConfig, b: BeekonKit.SyncConfig) -> Swift.Bool
|
|
167
172
|
public func encode(to encoder: any Swift.Encoder) throws
|
|
168
|
-
public init(from decoder: any Swift.Decoder) throws
|
|
169
173
|
}
|
|
170
174
|
public enum BeekonError : Swift.Error, Swift.Sendable, Swift.Equatable {
|
|
175
|
+
case invalidConfiguration(reason: Swift.String)
|
|
171
176
|
case invalidGeofence(reason: Swift.String)
|
|
177
|
+
case geofencesManagedByServer
|
|
172
178
|
case storage(reason: Swift.String)
|
|
173
179
|
case locationUnavailable(reason: BeekonKit.LocationUnavailableReason)
|
|
174
180
|
public static func == (a: BeekonKit.BeekonError, b: BeekonKit.BeekonError) -> Swift.Bool
|
|
@@ -207,6 +213,7 @@ public enum StopReason : Swift.String, Swift.Sendable, Swift.Equatable, Swift.Ha
|
|
|
207
213
|
case locationServicesDisabled
|
|
208
214
|
case locationUnavailable
|
|
209
215
|
case system
|
|
216
|
+
case cloudModeUnavailable
|
|
210
217
|
public init?(rawValue: Swift.String)
|
|
211
218
|
public typealias RawValue = Swift.String
|
|
212
219
|
public var rawValue: Swift.String {
|
|
@@ -282,6 +289,37 @@ public enum LocationTrigger : Swift.String, Swift.Sendable, Swift.Equatable, Swi
|
|
|
282
289
|
get
|
|
283
290
|
}
|
|
284
291
|
}
|
|
292
|
+
public struct LogEntry : Swift.Sendable, Swift.Equatable, Swift.Identifiable {
|
|
293
|
+
public let id: Swift.String
|
|
294
|
+
public let timestamp: Foundation.Date
|
|
295
|
+
public let level: BeekonKit.LogLevel
|
|
296
|
+
public let category: Swift.String
|
|
297
|
+
public let message: Swift.String
|
|
298
|
+
public init(id: Swift.String, timestamp: Foundation.Date, level: BeekonKit.LogLevel, category: Swift.String, message: Swift.String)
|
|
299
|
+
public static func == (a: BeekonKit.LogEntry, b: BeekonKit.LogEntry) -> Swift.Bool
|
|
300
|
+
public typealias ID = Swift.String
|
|
301
|
+
}
|
|
302
|
+
public enum LogLevel : Swift.String, Swift.Sendable, Swift.Codable, Swift.CaseIterable, Swift.Comparable {
|
|
303
|
+
case off
|
|
304
|
+
case error
|
|
305
|
+
case warn
|
|
306
|
+
case info
|
|
307
|
+
case debug
|
|
308
|
+
case verbose
|
|
309
|
+
public var ordinal: Swift.Int {
|
|
310
|
+
get
|
|
311
|
+
}
|
|
312
|
+
public static func < (lhs: BeekonKit.LogLevel, rhs: BeekonKit.LogLevel) -> Swift.Bool
|
|
313
|
+
public init?(rawValue: Swift.String)
|
|
314
|
+
public typealias AllCases = [BeekonKit.LogLevel]
|
|
315
|
+
public typealias RawValue = Swift.String
|
|
316
|
+
nonisolated public static var allCases: [BeekonKit.LogLevel] {
|
|
317
|
+
get
|
|
318
|
+
}
|
|
319
|
+
public var rawValue: Swift.String {
|
|
320
|
+
get
|
|
321
|
+
}
|
|
322
|
+
}
|
|
285
323
|
public enum MotionState : Swift.String, Swift.Sendable, Swift.Equatable, Swift.Hashable, Swift.Codable {
|
|
286
324
|
case moving
|
|
287
325
|
case stationary
|
|
@@ -292,6 +330,41 @@ public enum MotionState : Swift.String, Swift.Sendable, Swift.Equatable, Swift.H
|
|
|
292
330
|
get
|
|
293
331
|
}
|
|
294
332
|
}
|
|
333
|
+
public struct PermissionStatus : Swift.Sendable, Swift.Equatable, Swift.Codable {
|
|
334
|
+
public enum Level : Swift.String, Swift.Sendable, Swift.Equatable, Swift.Hashable, Swift.Codable {
|
|
335
|
+
case notDetermined
|
|
336
|
+
case denied
|
|
337
|
+
case restricted
|
|
338
|
+
case foreground
|
|
339
|
+
case background
|
|
340
|
+
public init?(rawValue: Swift.String)
|
|
341
|
+
public typealias RawValue = Swift.String
|
|
342
|
+
public var rawValue: Swift.String {
|
|
343
|
+
get
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
public enum Accuracy : Swift.String, Swift.Sendable, Swift.Equatable, Swift.Hashable, Swift.Codable {
|
|
347
|
+
case full
|
|
348
|
+
case reduced
|
|
349
|
+
public init?(rawValue: Swift.String)
|
|
350
|
+
public typealias RawValue = Swift.String
|
|
351
|
+
public var rawValue: Swift.String {
|
|
352
|
+
get
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
public let level: BeekonKit.PermissionStatus.Level
|
|
356
|
+
public let accuracy: BeekonKit.PermissionStatus.Accuracy?
|
|
357
|
+
public init(level: BeekonKit.PermissionStatus.Level, accuracy: BeekonKit.PermissionStatus.Accuracy?)
|
|
358
|
+
public var isAuthorized: Swift.Bool {
|
|
359
|
+
get
|
|
360
|
+
}
|
|
361
|
+
public var canTrackInBackground: Swift.Bool {
|
|
362
|
+
get
|
|
363
|
+
}
|
|
364
|
+
public static func == (a: BeekonKit.PermissionStatus, b: BeekonKit.PermissionStatus) -> Swift.Bool
|
|
365
|
+
public func encode(to encoder: any Swift.Encoder) throws
|
|
366
|
+
public init(from decoder: any Swift.Decoder) throws
|
|
367
|
+
}
|
|
295
368
|
public enum StationaryMode : Swift.String, Swift.Sendable, Swift.Equatable, Swift.Hashable, Swift.Codable {
|
|
296
369
|
case keepTracking
|
|
297
370
|
case pause
|
|
@@ -338,7 +411,11 @@ extension BeekonKit.LicenseInvalidReason : Swift.Hashable {}
|
|
|
338
411
|
extension BeekonKit.LicenseInvalidReason : Swift.RawRepresentable {}
|
|
339
412
|
extension BeekonKit.LocationQuality : Swift.RawRepresentable {}
|
|
340
413
|
extension BeekonKit.LocationTrigger : Swift.RawRepresentable {}
|
|
414
|
+
extension BeekonKit.LogLevel : Swift.Hashable {}
|
|
415
|
+
extension BeekonKit.LogLevel : Swift.RawRepresentable {}
|
|
341
416
|
extension BeekonKit.MotionState : Swift.RawRepresentable {}
|
|
417
|
+
extension BeekonKit.PermissionStatus.Level : Swift.RawRepresentable {}
|
|
418
|
+
extension BeekonKit.PermissionStatus.Accuracy : Swift.RawRepresentable {}
|
|
342
419
|
extension BeekonKit.StationaryMode : Swift.RawRepresentable {}
|
|
343
420
|
extension BeekonKit.SyncFailure : Swift.RawRepresentable {}
|
|
344
421
|
extension BeekonKit.Transition : Swift.RawRepresentable {}
|
|
@@ -47,5 +47,11 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
47
47
|
* otherwise), and `reason` only when `status === 'invalid'`.
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Flat wire form of the current location-permission grant (read-only). `level`
|
|
52
|
+
* is the wire-stable identifier; `accuracy` is `''` (not null — Codegen has no
|
|
53
|
+
* portable nullable-enum) when location is not granted, else 'full' | 'reduced'.
|
|
54
|
+
*/
|
|
55
|
+
|
|
50
56
|
export default TurboModuleRegistry.getEnforcing('BeekonRn');
|
|
51
57
|
//# sourceMappingURL=NativeBeekonRn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeBeekonRn.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;;AAMA;;AAQA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeBeekonRn.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;;AAMA;;AAQA;AACA;AACA;AACA;AACA;;AAyBA;;AAwHA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAkBA;AACA;AACA;AACA;AACA;;AAsFA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,UAAU,CAAC","ignoreList":[]}
|
package/lib/module/beekon.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import NativeBeekon from "./NativeBeekonRn.js";
|
|
4
|
-
import {
|
|
4
|
+
import { LicenseNudge } from "./internal/licenseNudge.js";
|
|
5
|
+
import { configToWire, geofenceToWire, recordToEntries, rethrowAsBeekonError, wireToAuthTokens, wireToGeofence, wireToGeofenceEvent, wireToLicenseStatus, wireToLocation, wireToLogEntry, wireToPermissionStatus, wireToState, wireToSyncStatus } from "./internal/mappers.js";
|
|
5
6
|
/**
|
|
6
7
|
* Fans the five native EventEmitters out to multiple JS subscribers and adds
|
|
7
8
|
* replay-1 semantics for `state` / `syncStatus` / `authTokens` (RN EventEmitters
|
|
@@ -21,6 +22,7 @@ class EventHub {
|
|
|
21
22
|
syncListeners = new Set();
|
|
22
23
|
authTokenListeners = new Set();
|
|
23
24
|
licenseListeners = new Set();
|
|
25
|
+
logListeners = new Set();
|
|
24
26
|
/** Idempotent: opens the native subscriptions the first time it is called. */
|
|
25
27
|
ensureSubscribed() {
|
|
26
28
|
if (this.subscribed) return;
|
|
@@ -53,6 +55,10 @@ class EventHub {
|
|
|
53
55
|
this.lastLicenseStatus = s;
|
|
54
56
|
this.licenseListeners.forEach(cb => cb(s));
|
|
55
57
|
});
|
|
58
|
+
NativeBeekon.onLog(w => {
|
|
59
|
+
const e = wireToLogEntry(w);
|
|
60
|
+
this.logListeners.forEach(cb => cb(e));
|
|
61
|
+
});
|
|
56
62
|
}
|
|
57
63
|
onState(cb) {
|
|
58
64
|
this.ensureSubscribed();
|
|
@@ -100,6 +106,13 @@ class EventHub {
|
|
|
100
106
|
this.licenseListeners.delete(cb);
|
|
101
107
|
};
|
|
102
108
|
}
|
|
109
|
+
onLog(cb) {
|
|
110
|
+
this.ensureSubscribed();
|
|
111
|
+
this.logListeners.add(cb);
|
|
112
|
+
return () => {
|
|
113
|
+
this.logListeners.delete(cb);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
103
116
|
}
|
|
104
117
|
|
|
105
118
|
/**
|
|
@@ -122,6 +135,20 @@ class EventHub {
|
|
|
122
135
|
*/
|
|
123
136
|
class BeekonImpl {
|
|
124
137
|
hub = new EventHub();
|
|
138
|
+
licenseNudge = new LicenseNudge();
|
|
139
|
+
licenseNudgeAttached = false;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Echo the evaluation-mode nudge to the JS console once, on first lifecycle
|
|
143
|
+
* use — so it only activates for apps actually using the SDK. Metro shows JS
|
|
144
|
+
* console only, so this is how the native nudge reaches an RN dev. See
|
|
145
|
+
* {@link LicenseNudge}.
|
|
146
|
+
*/
|
|
147
|
+
activateLicenseNudge() {
|
|
148
|
+
if (this.licenseNudgeAttached) return;
|
|
149
|
+
this.licenseNudgeAttached = true;
|
|
150
|
+
this.licenseNudge.attach(cb => this.hub.onLicenseStatus(cb));
|
|
151
|
+
}
|
|
125
152
|
|
|
126
153
|
/**
|
|
127
154
|
* Set tracking parameters. Optional — `start()` falls back to the previously
|
|
@@ -131,6 +158,7 @@ class BeekonImpl {
|
|
|
131
158
|
*/
|
|
132
159
|
async configure(config) {
|
|
133
160
|
this.hub.ensureSubscribed();
|
|
161
|
+
this.activateLicenseNudge();
|
|
134
162
|
await NativeBeekon.configure(configToWire(config));
|
|
135
163
|
}
|
|
136
164
|
|
|
@@ -142,6 +170,7 @@ class BeekonImpl {
|
|
|
142
170
|
*/
|
|
143
171
|
async start() {
|
|
144
172
|
this.hub.ensureSubscribed();
|
|
173
|
+
this.activateLicenseNudge();
|
|
145
174
|
await NativeBeekon.start();
|
|
146
175
|
}
|
|
147
176
|
|
|
@@ -162,6 +191,7 @@ class BeekonImpl {
|
|
|
162
191
|
*/
|
|
163
192
|
async resumeIfNeeded() {
|
|
164
193
|
this.hub.ensureSubscribed();
|
|
194
|
+
this.activateLicenseNudge();
|
|
165
195
|
await NativeBeekon.resumeIfNeeded();
|
|
166
196
|
}
|
|
167
197
|
|
|
@@ -280,6 +310,75 @@ class BeekonImpl {
|
|
|
280
310
|
return wireToLicenseStatus(await NativeBeekon.licenseStatus());
|
|
281
311
|
}
|
|
282
312
|
|
|
313
|
+
/**
|
|
314
|
+
* The current location-permission grant — a point-in-time read for
|
|
315
|
+
* **pre-start** checks, returned without ever prompting. Beekon never requests
|
|
316
|
+
* permission; the app owns that. A snapshot, not an observer: once tracking is
|
|
317
|
+
* running, permission loss surfaces on `onState` as
|
|
318
|
+
* `{ kind: 'stopped', reason: 'permissionDenied' }`. On Android, "not yet
|
|
319
|
+
* asked" and "denied" both report `'notDetermined'`; `'restricted'` is iOS-only.
|
|
320
|
+
*/
|
|
321
|
+
async getPermissionStatus() {
|
|
322
|
+
return wireToPermissionStatus(await NativeBeekon.getPermissionStatus());
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Read persisted diagnostic log entries in the inclusive range `[from, to]`,
|
|
327
|
+
* oldest first. Entries survive process death, so this recovers what the SDK
|
|
328
|
+
* did during a background session — the key to diagnosing field issues. Throws
|
|
329
|
+
* `BeekonError` with kind `'storage'` on a read failure. Requires native ≥ 0.0.9.
|
|
330
|
+
*/
|
|
331
|
+
async getLog(from, to) {
|
|
332
|
+
try {
|
|
333
|
+
const wires = await NativeBeekon.getLog(from.getTime(), to.getTime());
|
|
334
|
+
return wires.map(wireToLogEntry);
|
|
335
|
+
} catch (e) {
|
|
336
|
+
rethrowAsBeekonError(e);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Serialize the whole diagnostic log buffer to an NDJSON file and resolve its
|
|
342
|
+
* path. The app owns the file — attach it to a support email, share it, or
|
|
343
|
+
* upload it. Throws `BeekonError` with kind `'storage'` on a failure. Requires
|
|
344
|
+
* native ≥ 0.0.9.
|
|
345
|
+
*/
|
|
346
|
+
async exportLog() {
|
|
347
|
+
try {
|
|
348
|
+
return await NativeBeekon.exportLog();
|
|
349
|
+
} catch (e) {
|
|
350
|
+
rethrowAsBeekonError(e);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Delete all persisted diagnostic log entries. Requires native ≥ 0.0.9. */
|
|
355
|
+
async clearLog() {
|
|
356
|
+
try {
|
|
357
|
+
await NativeBeekon.clearLog();
|
|
358
|
+
} catch (e) {
|
|
359
|
+
rethrowAsBeekonError(e);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Set the diagnostic log verbosity threshold at runtime — no restart needed.
|
|
365
|
+
* Raise to `'debug'`/`'verbose'` for field diagnosis, then lower again. A later
|
|
366
|
+
* `configure` re-applies `BeekonConfig.logLevel` and supersedes this. Requires
|
|
367
|
+
* native ≥ 0.0.9.
|
|
368
|
+
*/
|
|
369
|
+
async setLogLevel(level) {
|
|
370
|
+
await NativeBeekon.setLogLevel(level);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Write a host-app breadcrumb into the same pipeline as the SDK's own logs
|
|
375
|
+
* (category `app`), so app and SDK events interleave in one timeline. Requires
|
|
376
|
+
* native ≥ 0.0.9.
|
|
377
|
+
*/
|
|
378
|
+
async log(level, message) {
|
|
379
|
+
await NativeBeekon.log(level, message);
|
|
380
|
+
}
|
|
381
|
+
|
|
283
382
|
/**
|
|
284
383
|
* Subscribe to tracking-state transitions (`idle` / `tracking` /
|
|
285
384
|
* `stopped(reason)`). The current state is delivered to new subscribers
|
|
@@ -334,6 +433,15 @@ class BeekonImpl {
|
|
|
334
433
|
onLicenseStatus(cb) {
|
|
335
434
|
return this.hub.onLicenseStatus(cb);
|
|
336
435
|
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Subscribe to diagnostic log entries as they are recorded — SDK subsystems
|
|
439
|
+
* plus host breadcrumbs from {@link log}. Broadcast (no replay); read history
|
|
440
|
+
* with {@link getLog}. Returns an unsubscribe function. Requires native ≥ 0.0.9.
|
|
441
|
+
*/
|
|
442
|
+
onLog(cb) {
|
|
443
|
+
return this.hub.onLog(cb);
|
|
444
|
+
}
|
|
337
445
|
}
|
|
338
446
|
export const Beekon = new BeekonImpl();
|
|
339
447
|
//# sourceMappingURL=beekon.js.map
|
package/lib/module/beekon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeBeekon","configToWire","geofenceToWire","recordToEntries","rethrowAsBeekonError","wireToAuthTokens","wireToGeofence","wireToGeofenceEvent","wireToLicenseStatus","wireToLocation","wireToState","wireToSyncStatus","EventHub","subscribed","stateListeners","Set","locationListeners","geofenceListeners","syncListeners","authTokenListeners","licenseListeners","ensureSubscribed","onState","w","s","lastState","forEach","cb","onLocation","l","onGeofenceEvent","g","onSyncStatus","lastSyncStatus","onAuthTokens","t","lastAuthTokens","onLicenseStatus","lastLicenseStatus","add","undefined","delete","BeekonImpl","hub","configure","config","start","stop","resumeIfNeeded","getCurrentLocation","options","wires","timeoutMs","accuracy","length","e","getLocations","from","to","getTime","map","deleteLocations","before","pendingUploadCount","sync","setExtras","extras","addGeofences","geofences","removeGeofences","ids","listGeofences","licenseStatus","Beekon"],"sourceRoot":"../../src","sources":["beekon.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,qBAAkB;AAS3C,SACEC,YAAY,EACZC,cAAc,EACdC,eAAe,EACfC,oBAAoB,EACpBC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,mBAAmB,EACnBC,cAAc,EACdC,WAAW,EACXC,gBAAgB,QACX,uBAAoB;AAI3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,CAAC;EACLC,UAAU,GAAG,KAAK;EACTC,cAAc,GAAG,IAAIC,GAAG,CAAwB,CAAC;EACjDC,iBAAiB,GAAG,IAAID,GAAG,CAAqB,CAAC;EACjDE,iBAAiB,GAAG,IAAIF,GAAG,CAA0B,CAAC;EACtDG,aAAa,GAAG,IAAIH,GAAG,CAAuB,CAAC;EAC/CI,kBAAkB,GAAG,IAAIJ,GAAG,CAAuB,CAAC;EACpDK,gBAAgB,GAAG,IAAIL,GAAG,CAA0B,CAAC;EAMtE;EACAM,gBAAgBA,CAAA,EAAS;IACvB,IAAI,IAAI,CAACR,UAAU,EAAE;IACrB,IAAI,CAACA,UAAU,GAAG,IAAI;IACtBb,YAAY,CAACsB,OAAO,CAAEC,CAAC,IAA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;EAEA;AACF;AACA;AACA;AACA;EACElD,OAAOA,CAACK,EAA4B,EAAc;IAChD,OAAO,IAAI,CAACgB,GAAG,CAACrB,OAAO,CAACK,EAAE,CAAC;EAC7B;;EAEA;AACF;AACA;AACA;AACA;EACEC,UAAUA,CAACD,EAAyB,EAAc;IAChD,OAAO,IAAI,CAACgB,GAAG,CAACf,UAAU,CAACD,EAAE,CAAC;EAChC;;EAEA;AACF;AACA;AACA;EACEG,eAAeA,CAACH,EAA8B,EAAc;IAC1D,OAAO,IAAI,CAACgB,GAAG,CAACb,eAAe,CAACH,EAAE,CAAC;EACrC;;EAEA;AACF;AACA;AACA;AACA;EACEK,YAAYA,CAACL,EAA2B,EAAc;IACpD,OAAO,IAAI,CAACgB,GAAG,CAACX,YAAY,CAACL,EAAE,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAACP,EAA2B,EAAc;IACpD,OAAO,IAAI,CAACgB,GAAG,CAACT,YAAY,CAACP,EAAE,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEU,eAAeA,CAACV,EAA8B,EAAc;IAC1D,OAAO,IAAI,CAACgB,GAAG,CAACN,eAAe,CAACV,EAAE,CAAC;EACrC;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAG,IAAI/B,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeBeekon","LicenseNudge","configToWire","geofenceToWire","recordToEntries","rethrowAsBeekonError","wireToAuthTokens","wireToGeofence","wireToGeofenceEvent","wireToLicenseStatus","wireToLocation","wireToLogEntry","wireToPermissionStatus","wireToState","wireToSyncStatus","EventHub","subscribed","stateListeners","Set","locationListeners","geofenceListeners","syncListeners","authTokenListeners","licenseListeners","logListeners","ensureSubscribed","onState","w","s","lastState","forEach","cb","onLocation","l","onGeofenceEvent","g","onSyncStatus","lastSyncStatus","onAuthTokens","t","lastAuthTokens","onLicenseStatus","lastLicenseStatus","onLog","e","add","undefined","delete","BeekonImpl","hub","licenseNudge","licenseNudgeAttached","activateLicenseNudge","attach","configure","config","start","stop","resumeIfNeeded","getCurrentLocation","options","wires","timeoutMs","accuracy","length","getLocations","from","to","getTime","map","deleteLocations","before","pendingUploadCount","sync","setExtras","extras","addGeofences","geofences","removeGeofences","ids","listGeofences","licenseStatus","getPermissionStatus","getLog","exportLog","clearLog","setLogLevel","level","log","message","Beekon"],"sourceRoot":"../../src","sources":["beekon.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,qBAAkB;AAC3C,SAASC,YAAY,QAAQ,4BAAyB;AAWtD,SACEC,YAAY,EACZC,cAAc,EACdC,eAAe,EACfC,oBAAoB,EACpBC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,mBAAmB,EACnBC,cAAc,EACdC,cAAc,EACdC,sBAAsB,EACtBC,WAAW,EACXC,gBAAgB,QACX,uBAAoB;AAI3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,CAAC;EACLC,UAAU,GAAG,KAAK;EACTC,cAAc,GAAG,IAAIC,GAAG,CAAwB,CAAC;EACjDC,iBAAiB,GAAG,IAAID,GAAG,CAAqB,CAAC;EACjDE,iBAAiB,GAAG,IAAIF,GAAG,CAA0B,CAAC;EACtDG,aAAa,GAAG,IAAIH,GAAG,CAAuB,CAAC;EAC/CI,kBAAkB,GAAG,IAAIJ,GAAG,CAAuB,CAAC;EACpDK,gBAAgB,GAAG,IAAIL,GAAG,CAA0B,CAAC;EACrDM,YAAY,GAAG,IAAIN,GAAG,CAAqB,CAAC;EAM7D;EACAO,gBAAgBA,CAAA,EAAS;IACvB,IAAI,IAAI,CAACT,UAAU,EAAE;IACrB,IAAI,CAACA,UAAU,GAAG,IAAI;IACtBhB,YAAY,CAAC0B,OAAO,CAAEC,CAAC,IAAK;MAC1B,MAAMC,CAAC,GAAGf,WAAW,CAACc,CAAC,CAAC;MACxB,IAAI,CAACE,SAAS,GAAGD,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AAO,IAAI,CAACkB,GAAG,CAACb,YAAY,CAACL,EAAE,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAACP,EAA2B,EAAc;IACpD,OAAO,IAAI,CAACkB,GAAG,CAACX,YAAY,CAACP,EAAE,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEU,eAAeA,CAACV,EAA8B,EAAc;IAC1D,OAAO,IAAI,CAACkB,GAAG,CAACR,eAAe,CAACV,EAAE,CAAC;EACrC;;EAEA;AACF;AACA;AACA;AACA;EACEY,KAAKA,CAACZ,EAAyB,EAAc;IAC3C,OAAO,IAAI,CAACkB,GAAG,CAACN,KAAK,CAACZ,EAAE,CAAC;EAC3B;AACF;AAEA,OAAO,MAAM2D,MAAM,GAAG,IAAI1C,UAAU,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export { Beekon } from "./beekon.js";
|
|
4
|
+
|
|
5
|
+
// `BeekonConfig` is a merged type + value (the `cloud` / `selfManaged`
|
|
6
|
+
// factories), so it is a value export — its type meaning travels with it.
|
|
7
|
+
export { BeekonConfig } from "./types/config.js";
|
|
4
8
|
export { BeekonError } from "./types/error.js";
|
|
5
9
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Beekon","BeekonError"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;
|
|
1
|
+
{"version":3,"names":["Beekon","BeekonConfig","BeekonError"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;;AAEjC;AACA;AACA,SAASC,YAAY,QAAQ,mBAAgB;AAkC7C,SAASC,WAAW,QAA8B,kBAAe","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// The debug nudge: a prominent multi-line banner mirroring the native debug
|
|
4
|
+
// banner. Every line carries the prefix (greppability). Neutral by design — no
|
|
5
|
+
// "release is unaffected", no advertised opt-out — so it nudges toward a key.
|
|
6
|
+
const BANNER = ['[Beekon][license] ════════════════════════════════════════════════════', '[Beekon][license] Beekon is running without a license key.', '[Beekon][license] Get one: https://getbeekon.com/pricing', '[Beekon][license] Then add it via BeekonConfig.licenseKey.', '[Beekon][license] ════════════════════════════════════════════════════'].join('\n');
|
|
7
|
+
function isDev() {
|
|
8
|
+
const g = globalThis;
|
|
9
|
+
return g.__DEV__ === true;
|
|
10
|
+
}
|
|
11
|
+
function acknowledged() {
|
|
12
|
+
const g = globalThis;
|
|
13
|
+
return g.BEEKON_EVALUATION_MODE === true;
|
|
14
|
+
}
|
|
15
|
+
function defaultLog(message) {
|
|
16
|
+
// The dev-console nudge: Metro surfaces JS console output, not native logs.
|
|
17
|
+
console.warn(message);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Echoes the evaluation-mode license nudge into the JS console.
|
|
22
|
+
*
|
|
23
|
+
* The native SDKs log the license notice to the platform stream (iOS unified
|
|
24
|
+
* logging, Android Logcat), but Metro shows only JS `console.*` — neither native
|
|
25
|
+
* stream reaches it, so a React Native developer never sees the "you're
|
|
26
|
+
* unlicensed" nudge in the terminal they actually watch. This mirrors the
|
|
27
|
+
* **evaluation** notice (no key supplied) onto `console.warn` so it surfaces in
|
|
28
|
+
* Metro, on **both** platforms.
|
|
29
|
+
*
|
|
30
|
+
* Debug-only (`__DEV__`): a release bundle never console-warns. Fires **at most
|
|
31
|
+
* once per JS context** on the first `evaluation` status, mirroring the native
|
|
32
|
+
* once-per-transition guarantee. Purely a log line — it never blocks, degrades,
|
|
33
|
+
* or delays the SDK (license-format-v1 policy anchor).
|
|
34
|
+
*
|
|
35
|
+
* Silence it without a key by setting `globalThis.BEEKON_EVALUATION_MODE = true`
|
|
36
|
+
* before the SDK initializes — the JS analog of the native `BeekonEvaluationMode`
|
|
37
|
+
* plist / `in.wayq.beekon.evaluationMode` manifest acknowledgment.
|
|
38
|
+
*/
|
|
39
|
+
export class LicenseNudge {
|
|
40
|
+
emitted = false;
|
|
41
|
+
constructor(options) {
|
|
42
|
+
this.log = options?.log ?? defaultLog;
|
|
43
|
+
this.enabled = options?.enabled ?? (isDev() && !acknowledged());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Subscribe via [subscribe] — a replay-1 license-status subscription that
|
|
48
|
+
* returns an unsubscribe function — and emit the banner the first time the
|
|
49
|
+
* status is `evaluation`. A no-op when disabled; idempotent.
|
|
50
|
+
*/
|
|
51
|
+
attach(subscribe) {
|
|
52
|
+
if (!this.enabled || this.unsubscribe !== undefined) return;
|
|
53
|
+
this.unsubscribe = subscribe(status => this.onStatus(status));
|
|
54
|
+
}
|
|
55
|
+
onStatus(status) {
|
|
56
|
+
if (this.emitted || status.status !== 'evaluation') return;
|
|
57
|
+
this.emitted = true;
|
|
58
|
+
this.log(BANNER);
|
|
59
|
+
// One-shot per process — drop the subscription once nudged.
|
|
60
|
+
this.unsubscribe?.();
|
|
61
|
+
this.unsubscribe = undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=licenseNudge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BANNER","join","isDev","g","globalThis","__DEV__","acknowledged","BEEKON_EVALUATION_MODE","defaultLog","message","console","warn","LicenseNudge","emitted","constructor","options","log","enabled","attach","subscribe","unsubscribe","undefined","status","onStatus"],"sourceRoot":"../../../src","sources":["internal/licenseNudge.ts"],"mappings":";;AAEA;AACA;AACA;AACA,MAAMA,MAAM,GAAG,CACb,wEAAwE,EACxE,6DAA6D,EAC7D,4DAA4D,EAC5D,6DAA6D,EAC7D,wEAAwE,CACzE,CAACC,IAAI,CAAC,IAAI,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List":[]}
|
|
@@ -12,12 +12,14 @@ const DEFAULTS = {
|
|
|
12
12
|
detectActivity: false,
|
|
13
13
|
syncIntervalSeconds: 300,
|
|
14
14
|
syncBatchSize: 100,
|
|
15
|
+
syncThreshold: 0,
|
|
15
16
|
authStrategy: 'bearer',
|
|
16
17
|
authBodyFormat: 'form',
|
|
17
18
|
authSkewMarginSeconds: 60,
|
|
18
19
|
authRefreshHeaders: {
|
|
19
20
|
Authorization: 'Bearer {accessToken}'
|
|
20
|
-
}
|
|
21
|
+
},
|
|
22
|
+
logLevel: 'info'
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
// --- Public → wire ---------------------------------------------------------
|
|
@@ -29,9 +31,48 @@ export function recordToEntries(record) {
|
|
|
29
31
|
value: record[key]
|
|
30
32
|
}));
|
|
31
33
|
}
|
|
34
|
+
function notificationToWire(config) {
|
|
35
|
+
return config.notification ? {
|
|
36
|
+
title: config.notification.title,
|
|
37
|
+
text: config.notification.text,
|
|
38
|
+
smallIcon: config.notification.smallIcon
|
|
39
|
+
} : undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Switches on the sealed-config arm (cloud-mode-v1 §2). The wire form is flat
|
|
43
|
+
// and carries both arms' slots; only the active arm's fields are populated. The
|
|
44
|
+
// tracking-param slots are filled with defaults regardless so the wire struct
|
|
45
|
+
// stays fully-populated — the native cloud arm ignores them and derives config
|
|
46
|
+
// from the server.
|
|
32
47
|
export function configToWire(config) {
|
|
48
|
+
const tracking = {
|
|
49
|
+
minTimeBetweenLocationsSeconds: DEFAULTS.minTimeBetweenLocationsSeconds,
|
|
50
|
+
minDistanceBetweenLocationsMeters: DEFAULTS.minDistanceBetweenLocationsMeters,
|
|
51
|
+
accuracyMode: DEFAULTS.accuracyMode,
|
|
52
|
+
whenStationary: DEFAULTS.whenStationary,
|
|
53
|
+
stationaryRadiusMeters: DEFAULTS.stationaryRadiusMeters,
|
|
54
|
+
detectActivity: DEFAULTS.detectActivity
|
|
55
|
+
};
|
|
56
|
+
if (config.mode === 'cloud') {
|
|
57
|
+
return {
|
|
58
|
+
mode: 'cloud',
|
|
59
|
+
// Passed through verbatim; the native cloud arm trims and validates it.
|
|
60
|
+
projectKey: config.projectKey,
|
|
61
|
+
// Omitted means the native baked-in default (https://api.getbeekon.com).
|
|
62
|
+
endpoint: config.endpoint,
|
|
63
|
+
...tracking,
|
|
64
|
+
// Cloud config is server-owned: no local sync or license key.
|
|
65
|
+
sync: undefined,
|
|
66
|
+
notification: notificationToWire(config),
|
|
67
|
+
licenseKey: undefined,
|
|
68
|
+
logLevel: config.logLevel ?? DEFAULTS.logLevel
|
|
69
|
+
};
|
|
70
|
+
}
|
|
33
71
|
const sync = config.sync;
|
|
34
72
|
return {
|
|
73
|
+
mode: 'selfManaged',
|
|
74
|
+
projectKey: undefined,
|
|
75
|
+
endpoint: undefined,
|
|
35
76
|
minTimeBetweenLocationsSeconds: config.minTimeBetweenLocationsSeconds ?? DEFAULTS.minTimeBetweenLocationsSeconds,
|
|
36
77
|
minDistanceBetweenLocationsMeters: config.minDistanceBetweenLocationsMeters ?? DEFAULTS.minDistanceBetweenLocationsMeters,
|
|
37
78
|
accuracyMode: config.accuracyMode ?? DEFAULTS.accuracyMode,
|
|
@@ -43,17 +84,15 @@ export function configToWire(config) {
|
|
|
43
84
|
headers: recordToEntries(sync.headers),
|
|
44
85
|
intervalSeconds: sync.intervalSeconds ?? DEFAULTS.syncIntervalSeconds,
|
|
45
86
|
batchSize: sync.batchSize ?? DEFAULTS.syncBatchSize,
|
|
87
|
+
syncThreshold: sync.syncThreshold ?? DEFAULTS.syncThreshold,
|
|
46
88
|
auth: sync.auth ? authToWire(sync.auth) : undefined
|
|
47
89
|
} : undefined,
|
|
48
|
-
notification: config
|
|
49
|
-
title: config.notification.title,
|
|
50
|
-
text: config.notification.text,
|
|
51
|
-
smallIcon: config.notification.smallIcon
|
|
52
|
-
} : undefined,
|
|
90
|
+
notification: notificationToWire(config),
|
|
53
91
|
// Passed through verbatim — `undefined` is omitted and the native SDK falls
|
|
54
92
|
// through to manifest/Info.plist. No wrapper-side trimming or fallback
|
|
55
93
|
// (blank/whitespace handling lives in the native SDK; spec §9).
|
|
56
|
-
licenseKey: config.licenseKey
|
|
94
|
+
licenseKey: config.licenseKey,
|
|
95
|
+
logLevel: config.logLevel ?? DEFAULTS.logLevel
|
|
57
96
|
};
|
|
58
97
|
}
|
|
59
98
|
export function geofenceToWire(g) {
|
|
@@ -127,6 +166,15 @@ export function wireToGeofenceEvent(w) {
|
|
|
127
166
|
timestamp: new Date(w.timestampMs)
|
|
128
167
|
};
|
|
129
168
|
}
|
|
169
|
+
export function wireToLogEntry(w) {
|
|
170
|
+
return {
|
|
171
|
+
id: w.id,
|
|
172
|
+
timestamp: new Date(w.timestampMs),
|
|
173
|
+
level: oneOf(w.level, ['off', 'error', 'warn', 'info', 'debug', 'verbose'], 'info'),
|
|
174
|
+
category: w.category,
|
|
175
|
+
message: w.message
|
|
176
|
+
};
|
|
177
|
+
}
|
|
130
178
|
export function wireToState(w) {
|
|
131
179
|
switch (w.type) {
|
|
132
180
|
case 'idle':
|
|
@@ -149,6 +197,18 @@ export function wireToState(w) {
|
|
|
149
197
|
};
|
|
150
198
|
}
|
|
151
199
|
}
|
|
200
|
+
export function wireToPermissionStatus(w) {
|
|
201
|
+
const level = oneOf(w.level, ['notDetermined', 'denied', 'restricted', 'foreground', 'background'], 'notDetermined');
|
|
202
|
+
// '' is the wire encoding of null (not granted); an unknown non-empty value
|
|
203
|
+
// degrades to null rather than guessing a precision.
|
|
204
|
+
const accuracy = w.accuracy === 'full' || w.accuracy === 'reduced' ? w.accuracy : null;
|
|
205
|
+
return {
|
|
206
|
+
level,
|
|
207
|
+
accuracy,
|
|
208
|
+
isAuthorized: level === 'foreground' || level === 'background',
|
|
209
|
+
canTrackInBackground: level === 'background'
|
|
210
|
+
};
|
|
211
|
+
}
|
|
152
212
|
export function wireToSyncStatus(w) {
|
|
153
213
|
switch (w.type) {
|
|
154
214
|
case 'idle':
|
|
@@ -224,7 +284,7 @@ export function wireToLicenseStatus(w) {
|
|
|
224
284
|
}
|
|
225
285
|
}
|
|
226
286
|
function toStopReason(s) {
|
|
227
|
-
return oneOf(s, ['user', 'permissionDenied', 'locationServicesDisabled', 'locationUnavailable', 'system'],
|
|
287
|
+
return oneOf(s, ['user', 'permissionDenied', 'locationServicesDisabled', 'locationUnavailable', 'cloudModeUnavailable', 'system'],
|
|
228
288
|
// The native side always populates the reason for a `stopped` state; an
|
|
229
289
|
// unknown/missing value means the wire contract was violated — fall back to
|
|
230
290
|
// `system` rather than throwing on a subscriber.
|