@wayq/beekon-rn 0.0.1
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 +37 -0
- package/LICENSE.txt +14 -0
- package/README.md +122 -0
- package/android/build.gradle +81 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/wayq/beekonrn/BeekonRnModule.kt +233 -0
- package/android/src/main/java/com/wayq/beekonrn/BeekonRnPackage.kt +31 -0
- package/ios/BeekonRn.h +5 -0
- package/ios/BeekonRn.mm +80 -0
- package/ios/BeekonRn.swift +211 -0
- package/ios/Frameworks/BeekonKit.xcframework/Info.plist +44 -0
- package/ios/Frameworks/BeekonKit.xcframework/LICENSE.txt +14 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +233 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
- 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/PrivacyInfo.xcprivacy +77 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +113 -0
- 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/PrivacyInfo.xcprivacy +77 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +113 -0
- package/lib/module/NativeBeekonRn.js +16 -0
- package/lib/module/NativeBeekonRn.js.map +1 -0
- package/lib/module/beekon.js +107 -0
- package/lib/module/beekon.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/mappers.js +58 -0
- package/lib/module/internal/mappers.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types/config.js +4 -0
- package/lib/module/types/config.js.map +1 -0
- package/lib/module/types/position.js +2 -0
- package/lib/module/types/position.js.map +1 -0
- package/lib/module/types/preset.js +2 -0
- package/lib/module/types/preset.js.map +1 -0
- package/lib/module/types/state.js +2 -0
- package/lib/module/types/state.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +58 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -0
- package/lib/typescript/src/beekon.d.ts +80 -0
- package/lib/typescript/src/beekon.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/internal/mappers.d.ts +8 -0
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -0
- package/lib/typescript/src/types/config.d.ts +41 -0
- package/lib/typescript/src/types/config.d.ts.map +1 -0
- package/lib/typescript/src/types/position.d.ts +24 -0
- package/lib/typescript/src/types/position.d.ts.map +1 -0
- package/lib/typescript/src/types/preset.d.ts +12 -0
- package/lib/typescript/src/types/preset.d.ts.map +1 -0
- package/lib/typescript/src/types/state.d.ts +22 -0
- package/lib/typescript/src/types/state.d.ts.map +1 -0
- package/package.json +137 -0
- package/scripts/fetch-beekonkit.sh +58 -0
- package/src/NativeBeekonRn.ts +64 -0
- package/src/beekon.ts +110 -0
- package/src/index.tsx +5 -0
- package/src/internal/mappers.ts +50 -0
- package/src/types/config.ts +42 -0
- package/src/types/position.ts +23 -0
- package/src/types/preset.ts +11 -0
- package/src/types/state.ts +16 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Info.plist</key>
|
|
8
|
+
<data>
|
|
9
|
+
3d/2OPEwv55L8dW+0woT9NRCNi0=
|
|
10
|
+
</data>
|
|
11
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
12
|
+
<data>
|
|
13
|
+
+Hzj9e+o3dYoDboCDA7ofM2a0kc=
|
|
14
|
+
</data>
|
|
15
|
+
</dict>
|
|
16
|
+
<key>files2</key>
|
|
17
|
+
<dict>
|
|
18
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
19
|
+
<dict>
|
|
20
|
+
<key>hash2</key>
|
|
21
|
+
<data>
|
|
22
|
+
E3plr2RiT1CPWdLg5VfDUw1k7yShykpszuDqfKG4YYw=
|
|
23
|
+
</data>
|
|
24
|
+
</dict>
|
|
25
|
+
</dict>
|
|
26
|
+
<key>rules</key>
|
|
27
|
+
<dict>
|
|
28
|
+
<key>^.*</key>
|
|
29
|
+
<true/>
|
|
30
|
+
<key>^.*\.lproj/</key>
|
|
31
|
+
<dict>
|
|
32
|
+
<key>optional</key>
|
|
33
|
+
<true/>
|
|
34
|
+
<key>weight</key>
|
|
35
|
+
<real>1000</real>
|
|
36
|
+
</dict>
|
|
37
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
38
|
+
<dict>
|
|
39
|
+
<key>omit</key>
|
|
40
|
+
<true/>
|
|
41
|
+
<key>weight</key>
|
|
42
|
+
<real>1100</real>
|
|
43
|
+
</dict>
|
|
44
|
+
<key>^Base\.lproj/</key>
|
|
45
|
+
<dict>
|
|
46
|
+
<key>weight</key>
|
|
47
|
+
<real>1010</real>
|
|
48
|
+
</dict>
|
|
49
|
+
<key>^version.plist$</key>
|
|
50
|
+
<true/>
|
|
51
|
+
</dict>
|
|
52
|
+
<key>rules2</key>
|
|
53
|
+
<dict>
|
|
54
|
+
<key>.*\.dSYM($|/)</key>
|
|
55
|
+
<dict>
|
|
56
|
+
<key>weight</key>
|
|
57
|
+
<real>11</real>
|
|
58
|
+
</dict>
|
|
59
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
60
|
+
<dict>
|
|
61
|
+
<key>omit</key>
|
|
62
|
+
<true/>
|
|
63
|
+
<key>weight</key>
|
|
64
|
+
<real>2000</real>
|
|
65
|
+
</dict>
|
|
66
|
+
<key>^.*</key>
|
|
67
|
+
<true/>
|
|
68
|
+
<key>^.*\.lproj/</key>
|
|
69
|
+
<dict>
|
|
70
|
+
<key>optional</key>
|
|
71
|
+
<true/>
|
|
72
|
+
<key>weight</key>
|
|
73
|
+
<real>1000</real>
|
|
74
|
+
</dict>
|
|
75
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
76
|
+
<dict>
|
|
77
|
+
<key>omit</key>
|
|
78
|
+
<true/>
|
|
79
|
+
<key>weight</key>
|
|
80
|
+
<real>1100</real>
|
|
81
|
+
</dict>
|
|
82
|
+
<key>^Base\.lproj/</key>
|
|
83
|
+
<dict>
|
|
84
|
+
<key>weight</key>
|
|
85
|
+
<real>1010</real>
|
|
86
|
+
</dict>
|
|
87
|
+
<key>^Info\.plist$</key>
|
|
88
|
+
<dict>
|
|
89
|
+
<key>omit</key>
|
|
90
|
+
<true/>
|
|
91
|
+
<key>weight</key>
|
|
92
|
+
<real>20</real>
|
|
93
|
+
</dict>
|
|
94
|
+
<key>^PkgInfo$</key>
|
|
95
|
+
<dict>
|
|
96
|
+
<key>omit</key>
|
|
97
|
+
<true/>
|
|
98
|
+
<key>weight</key>
|
|
99
|
+
<real>20</real>
|
|
100
|
+
</dict>
|
|
101
|
+
<key>^embedded\.provisionprofile$</key>
|
|
102
|
+
<dict>
|
|
103
|
+
<key>weight</key>
|
|
104
|
+
<real>20</real>
|
|
105
|
+
</dict>
|
|
106
|
+
<key>^version\.plist$</key>
|
|
107
|
+
<dict>
|
|
108
|
+
<key>weight</key>
|
|
109
|
+
<real>20</real>
|
|
110
|
+
</dict>
|
|
111
|
+
</dict>
|
|
112
|
+
</dict>
|
|
113
|
+
</plist>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<!--
|
|
4
|
+
Beekon iOS SDK Privacy Manifest
|
|
5
|
+
|
|
6
|
+
Source of truth: this file. Included two ways:
|
|
7
|
+
1. SwiftPM resource via Package.swift `.copy("PrivacyInfo.xcprivacy")`.
|
|
8
|
+
2. Copied to each BeekonKit.framework/ root by scripts/build-xcframework.sh
|
|
9
|
+
so binary consumers of the xcframework find it at the Apple-required
|
|
10
|
+
location.
|
|
11
|
+
|
|
12
|
+
Required by Apple for SDKs distributed via SwiftPM since mid-2024. Validated
|
|
13
|
+
at App Store submission time when consumers archive an app embedding Beekon.
|
|
14
|
+
|
|
15
|
+
See https://developer.apple.com/documentation/bundleresources/privacy_manifest_files
|
|
16
|
+
-->
|
|
17
|
+
<plist version="1.0">
|
|
18
|
+
<dict>
|
|
19
|
+
<!-- We do not track users across apps or websites. -->
|
|
20
|
+
<key>NSPrivacyTracking</key>
|
|
21
|
+
<false/>
|
|
22
|
+
<key>NSPrivacyTrackingDomains</key>
|
|
23
|
+
<array/>
|
|
24
|
+
|
|
25
|
+
<!--
|
|
26
|
+
Collected data. Beekon collects precise location for the host app's own
|
|
27
|
+
functionality (live tracking + history). Data is stored locally in the
|
|
28
|
+
host app's container (GRDB SQLite) and is not linked to user identity
|
|
29
|
+
from the SDK's perspective. The host app may link it to a user; that's
|
|
30
|
+
the host's call to declare in its own manifest.
|
|
31
|
+
-->
|
|
32
|
+
<key>NSPrivacyCollectedDataTypes</key>
|
|
33
|
+
<array>
|
|
34
|
+
<dict>
|
|
35
|
+
<key>NSPrivacyCollectedDataType</key>
|
|
36
|
+
<string>NSPrivacyCollectedDataTypePreciseLocation</string>
|
|
37
|
+
<key>NSPrivacyCollectedDataTypeLinked</key>
|
|
38
|
+
<false/>
|
|
39
|
+
<key>NSPrivacyCollectedDataTypeTracking</key>
|
|
40
|
+
<false/>
|
|
41
|
+
<key>NSPrivacyCollectedDataTypePurposes</key>
|
|
42
|
+
<array>
|
|
43
|
+
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
|
44
|
+
</array>
|
|
45
|
+
</dict>
|
|
46
|
+
</array>
|
|
47
|
+
|
|
48
|
+
<!--
|
|
49
|
+
Required-Reason APIs we use:
|
|
50
|
+
- UserDefaults (CA92.1): StateHolder/TrackingPersistence stores the
|
|
51
|
+
last-known tracking config in the com.wayq.beekon UserDefaults suite
|
|
52
|
+
so SLC-driven relaunches can auto-restore tracking.
|
|
53
|
+
- File timestamp (3B52.1): GRDB queries timestamps on its own SQLite
|
|
54
|
+
database file inside the host app's container.
|
|
55
|
+
Reason codes per https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api
|
|
56
|
+
-->
|
|
57
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
58
|
+
<array>
|
|
59
|
+
<dict>
|
|
60
|
+
<key>NSPrivacyAccessedAPIType</key>
|
|
61
|
+
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
|
62
|
+
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
63
|
+
<array>
|
|
64
|
+
<string>CA92.1</string>
|
|
65
|
+
</array>
|
|
66
|
+
</dict>
|
|
67
|
+
<dict>
|
|
68
|
+
<key>NSPrivacyAccessedAPIType</key>
|
|
69
|
+
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
|
70
|
+
<key>NSPrivacyAccessedAPITypeReasons</key>
|
|
71
|
+
<array>
|
|
72
|
+
<string>3B52.1</string>
|
|
73
|
+
</array>
|
|
74
|
+
</dict>
|
|
75
|
+
</array>
|
|
76
|
+
</dict>
|
|
77
|
+
</plist>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>files</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Info.plist</key>
|
|
8
|
+
<data>
|
|
9
|
+
w9rsPHfS6nhyFAFD48jpWHGzYuc=
|
|
10
|
+
</data>
|
|
11
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
12
|
+
<data>
|
|
13
|
+
+Hzj9e+o3dYoDboCDA7ofM2a0kc=
|
|
14
|
+
</data>
|
|
15
|
+
</dict>
|
|
16
|
+
<key>files2</key>
|
|
17
|
+
<dict>
|
|
18
|
+
<key>PrivacyInfo.xcprivacy</key>
|
|
19
|
+
<dict>
|
|
20
|
+
<key>hash2</key>
|
|
21
|
+
<data>
|
|
22
|
+
E3plr2RiT1CPWdLg5VfDUw1k7yShykpszuDqfKG4YYw=
|
|
23
|
+
</data>
|
|
24
|
+
</dict>
|
|
25
|
+
</dict>
|
|
26
|
+
<key>rules</key>
|
|
27
|
+
<dict>
|
|
28
|
+
<key>^.*</key>
|
|
29
|
+
<true/>
|
|
30
|
+
<key>^.*\.lproj/</key>
|
|
31
|
+
<dict>
|
|
32
|
+
<key>optional</key>
|
|
33
|
+
<true/>
|
|
34
|
+
<key>weight</key>
|
|
35
|
+
<real>1000</real>
|
|
36
|
+
</dict>
|
|
37
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
38
|
+
<dict>
|
|
39
|
+
<key>omit</key>
|
|
40
|
+
<true/>
|
|
41
|
+
<key>weight</key>
|
|
42
|
+
<real>1100</real>
|
|
43
|
+
</dict>
|
|
44
|
+
<key>^Base\.lproj/</key>
|
|
45
|
+
<dict>
|
|
46
|
+
<key>weight</key>
|
|
47
|
+
<real>1010</real>
|
|
48
|
+
</dict>
|
|
49
|
+
<key>^version.plist$</key>
|
|
50
|
+
<true/>
|
|
51
|
+
</dict>
|
|
52
|
+
<key>rules2</key>
|
|
53
|
+
<dict>
|
|
54
|
+
<key>.*\.dSYM($|/)</key>
|
|
55
|
+
<dict>
|
|
56
|
+
<key>weight</key>
|
|
57
|
+
<real>11</real>
|
|
58
|
+
</dict>
|
|
59
|
+
<key>^(.*/)?\.DS_Store$</key>
|
|
60
|
+
<dict>
|
|
61
|
+
<key>omit</key>
|
|
62
|
+
<true/>
|
|
63
|
+
<key>weight</key>
|
|
64
|
+
<real>2000</real>
|
|
65
|
+
</dict>
|
|
66
|
+
<key>^.*</key>
|
|
67
|
+
<true/>
|
|
68
|
+
<key>^.*\.lproj/</key>
|
|
69
|
+
<dict>
|
|
70
|
+
<key>optional</key>
|
|
71
|
+
<true/>
|
|
72
|
+
<key>weight</key>
|
|
73
|
+
<real>1000</real>
|
|
74
|
+
</dict>
|
|
75
|
+
<key>^.*\.lproj/locversion.plist$</key>
|
|
76
|
+
<dict>
|
|
77
|
+
<key>omit</key>
|
|
78
|
+
<true/>
|
|
79
|
+
<key>weight</key>
|
|
80
|
+
<real>1100</real>
|
|
81
|
+
</dict>
|
|
82
|
+
<key>^Base\.lproj/</key>
|
|
83
|
+
<dict>
|
|
84
|
+
<key>weight</key>
|
|
85
|
+
<real>1010</real>
|
|
86
|
+
</dict>
|
|
87
|
+
<key>^Info\.plist$</key>
|
|
88
|
+
<dict>
|
|
89
|
+
<key>omit</key>
|
|
90
|
+
<true/>
|
|
91
|
+
<key>weight</key>
|
|
92
|
+
<real>20</real>
|
|
93
|
+
</dict>
|
|
94
|
+
<key>^PkgInfo$</key>
|
|
95
|
+
<dict>
|
|
96
|
+
<key>omit</key>
|
|
97
|
+
<true/>
|
|
98
|
+
<key>weight</key>
|
|
99
|
+
<real>20</real>
|
|
100
|
+
</dict>
|
|
101
|
+
<key>^embedded\.provisionprofile$</key>
|
|
102
|
+
<dict>
|
|
103
|
+
<key>weight</key>
|
|
104
|
+
<real>20</real>
|
|
105
|
+
</dict>
|
|
106
|
+
<key>^version\.plist$</key>
|
|
107
|
+
<dict>
|
|
108
|
+
<key>weight</key>
|
|
109
|
+
<real>20</real>
|
|
110
|
+
</dict>
|
|
111
|
+
</dict>
|
|
112
|
+
</dict>
|
|
113
|
+
</plist>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Codegen TurboModule spec — DO NOT export Wire* types from `src/index.tsx`.
|
|
5
|
+
* The public TS API in `src/beekon.ts` and `src/types/` is what consumers use;
|
|
6
|
+
* mappers in `src/internal/mappers.ts` convert between the two.
|
|
7
|
+
*
|
|
8
|
+
* Wire types are flat (primitives + nested flat objects) because Codegen's
|
|
9
|
+
* TS-to-Kotlin/ObjC type derivation has limited support for unions and
|
|
10
|
+
* recursive structures. State variants are encoded as a `type` discriminator
|
|
11
|
+
* string with sibling fields nullable per variant.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
15
|
+
export default TurboModuleRegistry.getEnforcing('BeekonRn');
|
|
16
|
+
//# sourceMappingURL=NativeBeekonRn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeBeekonRn.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AAoDlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,UAAU,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NativeBeekon from "./NativeBeekonRn.js";
|
|
4
|
+
import { configToWire, wireToPosition, wireToState } from "./internal/mappers.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Public facade for the Beekon SDK. Mirrors the native APIs:
|
|
8
|
+
*
|
|
9
|
+
* - Android: `com.wayq.beekon.Beekon` (object)
|
|
10
|
+
* - iOS: `Beekon.shared` (actor)
|
|
11
|
+
*
|
|
12
|
+
* Lifecycle: `init()` once → `configure(config)` → `start()` → ... →
|
|
13
|
+
* `stop()` (idempotent) or `shutdown()` (final teardown). Subscribe to
|
|
14
|
+
* `onState` / `onPosition` for live updates; query `history(from, to)` for
|
|
15
|
+
* persisted points.
|
|
16
|
+
*
|
|
17
|
+
* **Threading:** Methods are safe to call from any JS context. Subscribers'
|
|
18
|
+
* callbacks fire on the JS thread.
|
|
19
|
+
*
|
|
20
|
+
* **Persistence invariant:** the SDK persists every gated position natively;
|
|
21
|
+
* JS is a passive observer. In background, the JS engine is not guaranteed to
|
|
22
|
+
* be alive — for past points, use `history()`.
|
|
23
|
+
*/
|
|
24
|
+
class BeekonImpl {
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the SDK. Idempotent; safe to call more than once. Must be
|
|
27
|
+
* called once before `configure()`.
|
|
28
|
+
*
|
|
29
|
+
* Errors:
|
|
30
|
+
* - `NO_GMS_AVAILABLE` (Android) — Google Play Services missing.
|
|
31
|
+
*/
|
|
32
|
+
async init() {
|
|
33
|
+
return NativeBeekon.initialize();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Set sampling and platform-specific config. Replaces any previous config.
|
|
38
|
+
* Must be called before `start()`.
|
|
39
|
+
*
|
|
40
|
+
* Errors:
|
|
41
|
+
* - `NOT_INITIALISED` — `init()` was not called first.
|
|
42
|
+
* - `NOT_CONFIGURED` — Android only, `androidNotification` was missing.
|
|
43
|
+
*/
|
|
44
|
+
async configure(config) {
|
|
45
|
+
return NativeBeekon.configure(configToWire(config));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Begin tracking. Transitions state from `idle` → `starting` → `tracking`.
|
|
50
|
+
*
|
|
51
|
+
* Errors:
|
|
52
|
+
* - `PERMISSION_DENIED` — location permission not granted.
|
|
53
|
+
* - `LOCATION_SERVICES_DISABLED` (iOS) — system location services off.
|
|
54
|
+
* - `SERVICE_FAILED` — native service couldn't start.
|
|
55
|
+
*/
|
|
56
|
+
async start() {
|
|
57
|
+
return NativeBeekon.start();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Stop tracking. Idempotent. State → `stopped`. */
|
|
61
|
+
async stop() {
|
|
62
|
+
return NativeBeekon.stop();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Final teardown — releases native resources. Most apps don't need this;
|
|
67
|
+
* `stop()` is sufficient between sessions.
|
|
68
|
+
*/
|
|
69
|
+
async shutdown() {
|
|
70
|
+
return NativeBeekon.shutdown();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Read persisted positions in the time range [from, to]. Returns positions
|
|
75
|
+
* in chronological order. Reads come from the SDK's local storage (Room on
|
|
76
|
+
* Android, GRDB on iOS) — the source of truth even when JS was asleep.
|
|
77
|
+
*
|
|
78
|
+
* Retention: positions older than 7 days OR beyond the most recent 100K are
|
|
79
|
+
* pruned automatically.
|
|
80
|
+
*/
|
|
81
|
+
async history(from, to) {
|
|
82
|
+
const wires = await NativeBeekon.history(from.getTime(), to.getTime());
|
|
83
|
+
return wires.map(wireToPosition);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Subscribe to state transitions. Returns an unsubscribe function. The
|
|
88
|
+
* current state is delivered to new subscribers immediately (replay-1
|
|
89
|
+
* semantics, matching the native `state` flow).
|
|
90
|
+
*/
|
|
91
|
+
onState(cb) {
|
|
92
|
+
const subscription = NativeBeekon.onState(wire => cb(wireToState(wire)));
|
|
93
|
+
return () => subscription.remove();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Subscribe to gated positions as they arrive. Returns an unsubscribe
|
|
98
|
+
* function. Broadcast (no replay) — only delivers while the JS engine is
|
|
99
|
+
* alive. For points emitted while JS was asleep, use `history()`.
|
|
100
|
+
*/
|
|
101
|
+
onPosition(cb) {
|
|
102
|
+
const subscription = NativeBeekon.onPosition(wire => cb(wireToPosition(wire)));
|
|
103
|
+
return () => subscription.remove();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export const Beekon = new BeekonImpl();
|
|
107
|
+
//# sourceMappingURL=beekon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeBeekon","configToWire","wireToPosition","wireToState","BeekonImpl","init","initialize","configure","config","start","stop","shutdown","history","from","to","wires","getTime","map","onState","cb","subscription","wire","remove","onPosition","Beekon"],"sourceRoot":"../../src","sources":["beekon.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,qBAAkB;AAI3C,SAASC,YAAY,EAAEC,cAAc,EAAEC,WAAW,QAAQ,uBAAoB;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,CAAC;EACf;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,OAAOL,YAAY,CAACM,UAAU,CAAC,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,SAASA,CAACC,MAAoB,EAAiB;IACnD,OAAOR,YAAY,CAACO,SAAS,CAACN,YAAY,CAACO,MAAM,CAAC,CAAC;EACrD;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,KAAKA,CAAA,EAAkB;IAC3B,OAAOT,YAAY,CAACS,KAAK,CAAC,CAAC;EAC7B;;EAEA;EACA,MAAMC,IAAIA,CAAA,EAAkB;IAC1B,OAAOV,YAAY,CAACU,IAAI,CAAC,CAAC;EAC5B;;EAEA;AACF;AACA;AACA;EACE,MAAMC,QAAQA,CAAA,EAAkB;IAC9B,OAAOX,YAAY,CAACW,QAAQ,CAAC,CAAC;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,OAAOA,CAACC,IAAU,EAAEC,EAAQ,EAAuB;IACvD,MAAMC,KAAK,GAAG,MAAMf,YAAY,CAACY,OAAO,CAACC,IAAI,CAACG,OAAO,CAAC,CAAC,EAAEF,EAAE,CAACE,OAAO,CAAC,CAAC,CAAC;IACtE,OAAOD,KAAK,CAACE,GAAG,CAACf,cAAc,CAAC;EAClC;;EAEA;AACF;AACA;AACA;AACA;EACEgB,OAAOA,CAACC,EAA4B,EAAc;IAChD,MAAMC,YAAY,GAAGpB,YAAY,CAACkB,OAAO,CAAEG,IAAI,IAAKF,EAAE,CAAChB,WAAW,CAACkB,IAAI,CAAC,CAAC,CAAC;IAC1E,OAAO,MAAMD,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;;EAEA;AACF;AACA;AACA;AACA;EACEC,UAAUA,CAACJ,EAAyB,EAAc;IAChD,MAAMC,YAAY,GAAGpB,YAAY,CAACuB,UAAU,CAAEF,IAAI,IAChDF,EAAE,CAACjB,cAAc,CAACmB,IAAI,CAAC,CACzB,CAAC;IACD,OAAO,MAAMD,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;AACF;AAEA,OAAO,MAAME,MAAM,GAAG,IAAIpB,UAAU,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Beekon"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export function configToWire(config) {
|
|
4
|
+
return {
|
|
5
|
+
preset: config.preset ?? 'balanced',
|
|
6
|
+
distanceFilterMeters: config.distanceFilterMeters,
|
|
7
|
+
intervalMillis: config.intervalMillis,
|
|
8
|
+
androidNotification: config.androidNotification,
|
|
9
|
+
licenseKey: config.licenseKey
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function wireToPosition(w) {
|
|
13
|
+
return {
|
|
14
|
+
lat: w.lat,
|
|
15
|
+
lng: w.lng,
|
|
16
|
+
accuracy: w.accuracy,
|
|
17
|
+
speed: w.speed,
|
|
18
|
+
bearing: w.bearing,
|
|
19
|
+
altitude: w.altitude,
|
|
20
|
+
timestamp: new Date(w.timestampMs)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function toPauseReason(s) {
|
|
24
|
+
if (s === 'permissionRevoked' || s === 'locationDisabled') return s;
|
|
25
|
+
return 'unknown';
|
|
26
|
+
}
|
|
27
|
+
export function wireToState(w) {
|
|
28
|
+
switch (w.type) {
|
|
29
|
+
case 'idle':
|
|
30
|
+
return {
|
|
31
|
+
kind: 'idle'
|
|
32
|
+
};
|
|
33
|
+
case 'starting':
|
|
34
|
+
return {
|
|
35
|
+
kind: 'starting'
|
|
36
|
+
};
|
|
37
|
+
case 'tracking':
|
|
38
|
+
return {
|
|
39
|
+
kind: 'tracking'
|
|
40
|
+
};
|
|
41
|
+
case 'paused':
|
|
42
|
+
return {
|
|
43
|
+
kind: 'paused',
|
|
44
|
+
reason: toPauseReason(w.pauseReason)
|
|
45
|
+
};
|
|
46
|
+
case 'stopped':
|
|
47
|
+
return {
|
|
48
|
+
kind: 'stopped'
|
|
49
|
+
};
|
|
50
|
+
default:
|
|
51
|
+
// Defensive fallback. Native should never emit an unknown state, but
|
|
52
|
+
// forward-compat: treat as idle rather than throwing.
|
|
53
|
+
return {
|
|
54
|
+
kind: 'idle'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=mappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["configToWire","config","preset","distanceFilterMeters","intervalMillis","androidNotification","licenseKey","wireToPosition","w","lat","lng","accuracy","speed","bearing","altitude","timestamp","Date","timestampMs","toPauseReason","s","wireToState","type","kind","reason","pauseReason"],"sourceRoot":"../../../src","sources":["internal/mappers.ts"],"mappings":";;AAKA,OAAO,SAASA,YAAYA,CAACC,MAAoB,EAAc;EAC7D,OAAO;IACLC,MAAM,EAAED,MAAM,CAACC,MAAM,IAAI,UAAU;IACnCC,oBAAoB,EAAEF,MAAM,CAACE,oBAAoB;IACjDC,cAAc,EAAEH,MAAM,CAACG,cAAc;IACrCC,mBAAmB,EAAEJ,MAAM,CAACI,mBAAmB;IAC/CC,UAAU,EAAEL,MAAM,CAACK;EACrB,CAAC;AACH;AAEA,OAAO,SAASC,cAAcA,CAACC,CAAe,EAAY;EACxD,OAAO;IACLC,GAAG,EAAED,CAAC,CAACC,GAAG;IACVC,GAAG,EAAEF,CAAC,CAACE,GAAG;IACVC,QAAQ,EAAEH,CAAC,CAACG,QAAQ;IACpBC,KAAK,EAAEJ,CAAC,CAACI,KAAK;IACdC,OAAO,EAAEL,CAAC,CAACK,OAAO;IAClBC,QAAQ,EAAEN,CAAC,CAACM,QAAQ;IACpBC,SAAS,EAAE,IAAIC,IAAI,CAACR,CAAC,CAACS,WAAW;EACnC,CAAC;AACH;AAEA,SAASC,aAAaA,CAACC,CAAqB,EAAe;EACzD,IAAIA,CAAC,KAAK,mBAAmB,IAAIA,CAAC,KAAK,kBAAkB,EAAE,OAAOA,CAAC;EACnE,OAAO,SAAS;AAClB;AAEA,OAAO,SAASC,WAAWA,CAACZ,CAAY,EAAe;EACrD,QAAQA,CAAC,CAACa,IAAI;IACZ,KAAK,MAAM;MACT,OAAO;QAAEC,IAAI,EAAE;MAAO,CAAC;IACzB,KAAK,UAAU;MACb,OAAO;QAAEA,IAAI,EAAE;MAAW,CAAC;IAC7B,KAAK,UAAU;MACb,OAAO;QAAEA,IAAI,EAAE;MAAW,CAAC;IAC7B,KAAK,QAAQ;MACX,OAAO;QAAEA,IAAI,EAAE,QAAQ;QAAEC,MAAM,EAAEL,aAAa,CAACV,CAAC,CAACgB,WAAW;MAAE,CAAC;IACjE,KAAK,SAAS;MACZ,OAAO;QAAEF,IAAI,EAAE;MAAU,CAAC;IAC5B;MACE;MACA;MACA,OAAO;QAAEA,IAAI,EAAE;MAAO,CAAC;EAC3B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/config.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/position.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/preset.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/state.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codegen TurboModule spec — DO NOT export Wire* types from `src/index.tsx`.
|
|
3
|
+
* The public TS API in `src/beekon.ts` and `src/types/` is what consumers use;
|
|
4
|
+
* mappers in `src/internal/mappers.ts` convert between the two.
|
|
5
|
+
*
|
|
6
|
+
* Wire types are flat (primitives + nested flat objects) because Codegen's
|
|
7
|
+
* TS-to-Kotlin/ObjC type derivation has limited support for unions and
|
|
8
|
+
* recursive structures. State variants are encoded as a `type` discriminator
|
|
9
|
+
* string with sibling fields nullable per variant.
|
|
10
|
+
*/
|
|
11
|
+
import type { CodegenTypes, TurboModule } from 'react-native';
|
|
12
|
+
export type WireAndroidNotification = {
|
|
13
|
+
channelId: string;
|
|
14
|
+
channelName: string;
|
|
15
|
+
notificationId: number;
|
|
16
|
+
title: string;
|
|
17
|
+
text: string;
|
|
18
|
+
smallIconResName: string;
|
|
19
|
+
};
|
|
20
|
+
export type WireConfig = {
|
|
21
|
+
/** One of: 'saver' | 'balanced' | 'precision'. */
|
|
22
|
+
preset: string;
|
|
23
|
+
distanceFilterMeters?: number;
|
|
24
|
+
intervalMillis?: number;
|
|
25
|
+
androidNotification?: WireAndroidNotification;
|
|
26
|
+
licenseKey?: string;
|
|
27
|
+
};
|
|
28
|
+
export type WirePosition = {
|
|
29
|
+
lat: number;
|
|
30
|
+
lng: number;
|
|
31
|
+
accuracy: number;
|
|
32
|
+
speed: number;
|
|
33
|
+
bearing: number;
|
|
34
|
+
altitude: number;
|
|
35
|
+
timestampMs: number;
|
|
36
|
+
};
|
|
37
|
+
export type WireState = {
|
|
38
|
+
/** One of: 'idle' | 'starting' | 'tracking' | 'paused' | 'stopped'. */
|
|
39
|
+
type: string;
|
|
40
|
+
/**
|
|
41
|
+
* Only populated when `type === 'paused'`. One of:
|
|
42
|
+
* 'permissionRevoked' | 'locationDisabled' | 'unknown'.
|
|
43
|
+
*/
|
|
44
|
+
pauseReason?: string;
|
|
45
|
+
};
|
|
46
|
+
export interface Spec extends TurboModule {
|
|
47
|
+
initialize(): Promise<void>;
|
|
48
|
+
configure(config: WireConfig): Promise<void>;
|
|
49
|
+
start(): Promise<void>;
|
|
50
|
+
stop(): Promise<void>;
|
|
51
|
+
shutdown(): Promise<void>;
|
|
52
|
+
history(fromMs: number, toMs: number): Promise<WirePosition[]>;
|
|
53
|
+
readonly onState: CodegenTypes.EventEmitter<WireState>;
|
|
54
|
+
readonly onPosition: CodegenTypes.EventEmitter<WirePosition>;
|
|
55
|
+
}
|
|
56
|
+
declare const _default: Spec;
|
|
57
|
+
export default _default;
|
|
58
|
+
//# sourceMappingURL=NativeBeekonRn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeBeekonRn.d.ts","sourceRoot":"","sources":["../../../src/NativeBeekonRn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;IAE/D,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;CAC9D;;AAED,wBAAkE"}
|