@everframe/react-native 0.9.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.
Files changed (38) hide show
  1. package/EverframeRN.podspec +88 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +8 -0
  4. package/README.md +505 -0
  5. package/android/build.gradle.kts +209 -0
  6. package/android/settings.gradle.kts +8 -0
  7. package/android/src/main/AndroidManifest.xml +9 -0
  8. package/android/src/main/java/dev/everframe/rn/EverframeModule.kt +1670 -0
  9. package/android/src/main/java/dev/everframe/rn/EverframePackage.kt +40 -0
  10. package/android/src/main/java/dev/everframe/rn/EverframeSensitiveViewManager.kt +20 -0
  11. package/android/src/main/java/dev/everframe/rn/RnVideoPrivacyAdapter.kt +65 -0
  12. package/dist/NativeEverframe.d.ts +308 -0
  13. package/dist/NativeEverframe.js +1 -0
  14. package/dist/browser-ZQAY6B4M.js +1 -0
  15. package/dist/chunk-LPIKPZNX.js +1 -0
  16. package/dist/chunk-QRPINMCR.js +1 -0
  17. package/dist/chunk-QZRTTQRS.js +1 -0
  18. package/dist/chunk-XFLFA52R.js +1 -0
  19. package/dist/chunk-XUSV3KOD.js +1 -0
  20. package/dist/index.d.ts +1006 -0
  21. package/dist/index.js +51 -0
  22. package/dist/integrations/console.d.ts +8 -0
  23. package/dist/integrations/console.js +1 -0
  24. package/dist/integrations/react-native-video.d.ts +44 -0
  25. package/dist/integrations/react-native-video.js +1 -0
  26. package/dist/integrations/react-navigation.d.ts +21 -0
  27. package/dist/integrations/react-navigation.js +1 -0
  28. package/dist/integrations/theoplayer.d.ts +37 -0
  29. package/dist/integrations/theoplayer.js +1 -0
  30. package/dist/types-D5e4kWaw.d.ts +12 -0
  31. package/ios/Sources/EverframeBridge.swift +1043 -0
  32. package/ios/Sources/EverframeEventEmitter.swift +204 -0
  33. package/ios/Sources/EverframeModule.h +36 -0
  34. package/ios/Sources/EverframeModule.mm +489 -0
  35. package/ios/Sources/RemoteVitalsBridge.swift +99 -0
  36. package/package.json +121 -0
  37. package/src/NativeEverframe.ts +439 -0
  38. package/src/codegen-types.ts +11 -0
@@ -0,0 +1,204 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // SPDX-FileCopyrightText: 2026 ScriptX
3
+ //
4
+ // Plan 06.2-11 — RCTEventEmitter subclass for the phone-companion bridge.
5
+ //
6
+ // iOS RN event emission requires an `RCTEventEmitter` subclass (one per
7
+ // module — the base class enforces a single supportedEvents() list). We
8
+ // can't bolt event emission onto the existing `EverframeModule` because:
9
+ //
10
+ // 1. `EverframeModule` already has `RCT_EXPORT_MODULE(Everframe)` and
11
+ // conforms to the codegen-generated `NativeEverframeSpec`. RCTEventEmitter
12
+ // requires `requiresMainQueueSetup` + `supportedEvents` overrides on a
13
+ // class that subclasses RCTEventEmitter — Objective-C single-inheritance.
14
+ // 2. Splitting concerns lets the JS facade use `new
15
+ // NativeEventEmitter(NativeModules.EverframeEventEmitter)` (matching
16
+ // the same idiom Sentry/Notifee/Reanimated all use).
17
+ //
18
+ // Registration is via `RCT_EXPORT_MODULE` from the `@objc(EverframeEventEmitter)`
19
+ // Swift class — CocoaPods + the podspec's source globs autodiscover it and
20
+ // expose it on `NativeModules.EverframeEventEmitter` from JS. No `.mm` shim
21
+ // needed: RCTEventEmitter's RN-side wiring (`addListener` / `removeListeners`
22
+ // / `supportedEvents`) is reachable from pure Swift via the inherited
23
+ // Objective-C base.
24
+ //
25
+ // Threading: `sendEvent(withName:body:)` is thread-safe across the RN core
26
+ // (the internal bridge enqueues the event on the JS thread). Combine sinks
27
+ // installed in `EverframeBridge` may fire on the URLSession delegate queue;
28
+ // we forward straight to the emitter without a main-thread hop.
29
+ //
30
+ // Event names — duplicated in JS facade `src/companion.ts`. Keep in lock-step.
31
+ import Foundation
32
+ import React
33
+
34
+ @objc(EverframeEventEmitter)
35
+ public final class EverframeEventEmitter: RCTEventEmitter {
36
+
37
+ /// Event name forwarded as `everframe.companion.state`.
38
+ /// Payload: String — one of "unpaired" | "paired" | "report_in_progress" | "phone_disconnected".
39
+ public static let stateEvent = "everframe.companion.state"
40
+
41
+ /// Event name forwarded as `everframe.companion.pairUrl`.
42
+ /// Payload: String | NSNull (NSNull crosses to JS as `null`).
43
+ public static let pairUrlEvent = "everframe.companion.pairUrl"
44
+
45
+ /// Event name forwarded as `everframe.companion.code`.
46
+ /// The short display code returned by `/api/companion/announce`
47
+ /// (spec 2026-08-07) — hosts render it beside the QR so a team member
48
+ /// reading the TV screen can pick this device out of the dashboard list.
49
+ /// Payload: String | NSNull (NSNull crosses to JS as `null`).
50
+ public static let codeEvent = "everframe.companion.code"
51
+
52
+ /// Event name forwarded as `everframe.companion.attachedUserName`.
53
+ /// The dashboard member who attached to this device; nil on an ordinary
54
+ /// QR bond. Payload: String | NSNull (NSNull crosses to JS as `null`).
55
+ public static let attachedUserNameEvent = "everframe.companion.attachedUserName"
56
+
57
+ /// Event name forwarded as `everframe.companion.resolvedName` (naming spec
58
+ /// 2026-08-24). The server-resolved device display name for THIS device
59
+ /// (e.g. an org-configured friendly name), or nil before the first
60
+ /// successful announce / when discovery never ran. Payload: String |
61
+ /// NSNull (NSNull crosses to JS as `null`).
62
+ public static let resolvedNameEvent = "everframe.companion.resolvedName"
63
+
64
+ /// Event name forwarded as `everframe.companion.attachChallenge` (spec
65
+ /// 2026-08-19). The pending dashboard-initiated attach-PIN challenge, or
66
+ /// nil when none is outstanding. Forwarded in every `attachPinUi` mode,
67
+ /// including `'builtin'` (which renders the PIN natively AND still
68
+ /// fires this event) — it's only NEEDED by hosts configured with
69
+ /// `'custom'`, which must read it to build their own surface.
70
+ /// Payload: `{ code, requestedByName, ttlMs }` | NSNull.
71
+ public static let attachChallengeEvent = "everframe.companion.attachChallenge"
72
+
73
+ /// Fired when a `report.request` arrives from the paired phone. This
74
+ /// used to give JS a window to walk the React fiber tree and call
75
+ /// `attachReactTree`; both are gone (spec 2026-08-29). The event and
76
+ /// the bridge's brief wait survive as the companion's JS-ready
77
+ /// handshake (see CompanionCaptureBridge.awaitJsReactTreeAttach).
78
+ /// Payload: String — the correlation_id of the inbound request.
79
+ public static let reportRequestedEvent = "everframe.companion.reportRequested"
80
+
81
+ /// Fired right before native drains pending attachments for ANY report
82
+ /// (spec 2026-09-17 setExtra-resolver) — NOT just the companion flow:
83
+ /// the plain in-app `openReporter()` and native shake both trigger this
84
+ /// too, since both funnel through `Everframe.shared.report.open()` →
85
+ /// `__consumePendingAttachments()`. Only fires when JS has a resolver
86
+ /// CURRENTLY registered (`EverframeBridge.setExtraResolverActive`) — see
87
+ /// `EverframeBridge.awaitJsExtraResolve`. Payload: String — the
88
+ /// correlation_id JS echoes back via `signalExtraResolverReady`.
89
+ public static let extraResolveRequestedEvent = "everframe.extra.resolveRequested"
90
+
91
+ /// Shared instance accessor — RN constructs the emitter via the standard
92
+ /// module registry. The first init stores `self` here so `EverframeBridge`
93
+ /// can dispatch into the live instance without going through a JS-side
94
+ /// `NativeModules` lookup. Mirrors the pattern documented in the RN
95
+ /// `RCTEventEmitter` headers (and used by `RNEventEmitter` exports across
96
+ /// the ecosystem).
97
+ @objc public static private(set) weak var shared: EverframeEventEmitter?
98
+
99
+ public override init() {
100
+ super.init()
101
+ EverframeEventEmitter.shared = self
102
+ }
103
+
104
+ public override class func requiresMainQueueSetup() -> Bool {
105
+ // Pure value-passing emitter — no UIKit reads at init time.
106
+ return false
107
+ }
108
+
109
+ /// EVERY event this class can ever send MUST be listed here. RN's
110
+ /// `RCTEventEmitter` silently drops `sendEvent(withName:)` for a name
111
+ /// absent from this array — no throw, no warning on the JS side, the
112
+ /// listener simply never fires. Adding a `…Event` constant above without
113
+ /// adding it here is the exact failure this comment exists to prevent.
114
+ public override func supportedEvents() -> [String] {
115
+ return [
116
+ Self.stateEvent,
117
+ Self.pairUrlEvent,
118
+ Self.codeEvent,
119
+ Self.attachedUserNameEvent,
120
+ Self.resolvedNameEvent,
121
+ Self.attachChallengeEvent,
122
+ Self.reportRequestedEvent,
123
+ Self.extraResolveRequestedEvent,
124
+ ]
125
+ }
126
+
127
+ // MARK: - Static helpers used by EverframeBridge
128
+
129
+ /// Forward a companion-state change to JS. Silently dropped if no
130
+ /// emitter instance is alive (e.g. before any listeners attached). The
131
+ /// RN base class also warns when `sendEvent` fires with zero listeners,
132
+ /// which is the documented behavior — our JS facade attaches listeners
133
+ /// inside `useCompanion()`, so the warning surfaces only when no React
134
+ /// subtree is rendering the companion screen.
135
+ @objc public static func sendState(_ state: String) {
136
+ shared?.sendEvent(withName: stateEvent, body: state)
137
+ }
138
+
139
+ /// Forward a pairUrl change to JS. `nil` is passed across the bridge as
140
+ /// `NSNull()` so the JS handler receives an actual `null`. Note: pairUrl is
141
+ /// now nulled only on socket close, so this `nil` branch fires rarely —
142
+ /// hosts drive QR teardown off `state`, the reliably-delivered signal.
143
+ @objc public static func sendPairUrl(_ url: String?) {
144
+ if let url = url {
145
+ shared?.sendEvent(withName: pairUrlEvent, body: url)
146
+ } else {
147
+ shared?.sendEvent(withName: pairUrlEvent, body: NSNull())
148
+ }
149
+ }
150
+
151
+ /// Forward an announce display-code change to JS. `nil` crosses as
152
+ /// `NSNull()` so the JS handler receives an actual `null` — that happens
153
+ /// when companion discovery was never attempted (no SDK key configured),
154
+ /// when the announce failed, or when the relay socket closed terminally.
155
+ @objc public static func sendCode(_ code: String?) {
156
+ if let code = code {
157
+ shared?.sendEvent(withName: codeEvent, body: code)
158
+ } else {
159
+ shared?.sendEvent(withName: codeEvent, body: NSNull())
160
+ }
161
+ }
162
+
163
+ /// Forward an attached-dashboard-user change to JS. `nil` crosses as
164
+ /// `NSNull()` — an ordinary QR bond carries no `companion_user` block, so
165
+ /// the nil branch is the common case here (unlike `sendPairUrl`).
166
+ @objc public static func sendAttachedUserName(_ name: String?) {
167
+ if let name = name {
168
+ shared?.sendEvent(withName: attachedUserNameEvent, body: name)
169
+ } else {
170
+ shared?.sendEvent(withName: attachedUserNameEvent, body: NSNull())
171
+ }
172
+ }
173
+
174
+ /// Forward a resolved device display-name change to JS (naming spec
175
+ /// 2026-08-24). `nil` crosses as `NSNull()` — before the first successful
176
+ /// announce, or when discovery never ran, this is the common case.
177
+ @objc public static func sendResolvedName(_ name: String?) {
178
+ if let name = name {
179
+ shared?.sendEvent(withName: resolvedNameEvent, body: name)
180
+ } else {
181
+ shared?.sendEvent(withName: resolvedNameEvent, body: NSNull())
182
+ }
183
+ }
184
+
185
+ /// Forward a `report.request` correlation id to JS. JS signals the
186
+ /// bridge back via `signalCompanionReportRequestReady` when it is
187
+ /// ready for capture to proceed.
188
+ @objc public static func sendReportRequested(_ correlationId: String) {
189
+ shared?.sendEvent(withName: reportRequestedEvent, body: correlationId)
190
+ }
191
+
192
+ /// Forward an attach-PIN challenge to JS. nil crosses as NSNull() → JS null.
193
+ @objc public static func sendAttachChallenge(_ payload: [String: Any]?) {
194
+ shared?.sendEvent(withName: attachChallengeEvent, body: payload ?? NSNull())
195
+ }
196
+
197
+ /// Forward an extra-resolver ask correlation id to JS (spec 2026-09-17
198
+ /// setExtra-resolver). Mirrors `sendReportRequested` exactly — JS signals
199
+ /// the bridge back via `signalExtraResolverReady` when it has pushed a
200
+ /// freshly resolved value (or given up) for this correlation id.
201
+ @objc public static func sendExtraResolveRequested(_ correlationId: String) {
202
+ shared?.sendEvent(withName: extraResolveRequestedEvent, body: correlationId)
203
+ }
204
+ }
@@ -0,0 +1,36 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // SPDX-FileCopyrightText: 2026 ScriptX
3
+ //
4
+ // Plain-ObjC public interface for the @everframe/react-native TurboModule.
5
+ //
6
+ // IMPORTANT — KEEP THIS FILE FREE OF C++ INCLUDES.
7
+ //
8
+ // Under `use_frameworks!` (which our spm_dependency setup mandates), CocoaPods
9
+ // builds the Everframe pod as a framework with an auto-generated umbrella
10
+ // header that re-imports every `public_header_files` entry. The umbrella is
11
+ // processed in plain-ObjC context. If we re-export the codegen
12
+ // `<EverframeSpec/EverframeSpec.h>` here (which has
13
+ // `#error This file must be compiled as Obj-C++`), every consumer of the
14
+ // framework — including unrelated pods like RCTAppDependencyProvider —
15
+ // fails to compile.
16
+ //
17
+ // The `<NativeEverframeSpec>` protocol conformance therefore lives in a private
18
+ // class extension in `EverframeModule.mm` (which IS compiled as ObjC++).
19
+ // RN's TurboModule registry doesn't need the conformance to be public — it
20
+ // resolves the class via `RCT_EXPORT_MODULE(Everframe)`, locates the
21
+ // `<NativeEverframeSpec>` conformance at runtime via Objective-C method
22
+ // resolution, and binds the JSI methods through codegen.
23
+
24
+ #import <Foundation/Foundation.h>
25
+ #import <React/RCTBridgeModule.h>
26
+ // Plan 06.2-11: EverframeEventEmitter (Swift) inherits from RCTEventEmitter.
27
+ // CocoaPods generates a `EverframeRN-Swift.h` that declares the @interface
28
+ // for the Swift class — that declaration needs the full RCTEventEmitter
29
+ // interface visible at the point the umbrella header is processed.
30
+ // RCTEventEmitter.h is plain Objective-C (no C++), so it's safe to expose
31
+ // through the public umbrella without violating the "no C++ in this header"
32
+ // rule at the top of this file.
33
+ #import <React/RCTEventEmitter.h>
34
+
35
+ @interface EverframeModule : NSObject <RCTBridgeModule>
36
+ @end