yaver-feedback-react-native 0.5.4 → 0.5.5
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/README.md +22 -0
- package/dist/ShakeDetector.js +22 -0
- package/dist/YaverFeedback.js +28 -0
- package/package.json +1 -1
- package/src/ShakeDetector.ts +22 -1
- package/src/YaverFeedback.ts +29 -0
package/README.md
CHANGED
|
@@ -574,12 +574,34 @@ YaverFeedback.init({
|
|
|
574
574
|
});
|
|
575
575
|
```
|
|
576
576
|
|
|
577
|
+
## Running Inside the Yaver Mobile App (super-host)
|
|
578
|
+
|
|
579
|
+
When a third-party app is loaded through Yaver's Hermes-push flow (so the
|
|
580
|
+
Yaver mobile app is the runtime container for your app), the SDK detects
|
|
581
|
+
that situation via the `YaverInfo` native module and **automatically
|
|
582
|
+
no-ops `YaverFeedback.init()`** — no ShakeDetector, no FeedbackModal, no
|
|
583
|
+
BlackBox stream from inside the guest. The user only ever sees Yaver's
|
|
584
|
+
native shake overlay ("Reload" + "Back to Yaver") and uses Yaver's
|
|
585
|
+
built-in feedback flow instead.
|
|
586
|
+
|
|
587
|
+
Standalone installs (TestFlight / App Store / Play from your own dev
|
|
588
|
+
account) are unaffected — the SDK behaves exactly as it did before.
|
|
589
|
+
|
|
590
|
+
If you need to opt out of the auto-suppression in a specific build (for
|
|
591
|
+
example, to compare behaviour in a super-host smoke test), set
|
|
592
|
+
`enabled: true` explicitly — the Yaver-host gate runs before the
|
|
593
|
+
`enabled` flag is evaluated on purpose.
|
|
594
|
+
|
|
577
595
|
## Trigger Modes
|
|
578
596
|
|
|
579
597
|
### Shake (default)
|
|
580
598
|
|
|
581
599
|
Shake the device to open the feedback modal. Uses the built-in shake event on iOS and `ShakeEvent` on Android.
|
|
582
600
|
|
|
601
|
+
When the app is loaded inside the Yaver mobile app (super-host), the
|
|
602
|
+
SDK yields shake handling to Yaver's native overlay — see the
|
|
603
|
+
"Running Inside the Yaver Mobile App" section above.
|
|
604
|
+
|
|
583
605
|
```typescript
|
|
584
606
|
YaverFeedback.init({ authToken, trigger: 'shake' });
|
|
585
607
|
```
|
package/dist/ShakeDetector.js
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShakeDetector = void 0;
|
|
4
4
|
const react_native_1 = require("react-native");
|
|
5
|
+
// Detects that the surrounding runtime is Yaver's super-host bridge. The
|
|
6
|
+
// YaverInfo native module is only registered inside Yaver's container
|
|
7
|
+
// (see mobile/ios/Yaver/YaverInfo.{swift,m} and the Android equivalent),
|
|
8
|
+
// so it is undefined in a standalone third-party app. When the SDK runs
|
|
9
|
+
// inside Yaver we yield shake handling to Yaver's native
|
|
10
|
+
// ShakeDetectingWindow — the user should only ever see the 2-button
|
|
11
|
+
// "Reload / Back to Yaver" overlay, never a FeedbackModal popped from
|
|
12
|
+
// inside the guest bundle.
|
|
13
|
+
function isRunningInsideYaverHost() {
|
|
14
|
+
try {
|
|
15
|
+
return !!react_native_1.NativeModules?.YaverInfo;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
5
21
|
const SHAKE_TIMEOUT_MS = 1000; // minimum time between shakes
|
|
6
22
|
const ACCEL_THRESHOLD_G = 1.8; // peak g-force that qualifies as a shake event
|
|
7
23
|
const ACCEL_MIN_HITS = 3; // peaks within the window before we fire
|
|
@@ -34,6 +50,12 @@ class ShakeDetector {
|
|
|
34
50
|
}
|
|
35
51
|
start(onShake) {
|
|
36
52
|
this.stop();
|
|
53
|
+
// When the app is loaded inside Yaver's super-host (Hermes push),
|
|
54
|
+
// Yaver owns the shake gesture and shows its own "Reload / Back to
|
|
55
|
+
// Yaver" overlay. We must not also fire the guest-side callback,
|
|
56
|
+
// otherwise the user gets both UIs at once.
|
|
57
|
+
if (isRunningInsideYaverHost())
|
|
58
|
+
return;
|
|
37
59
|
this.subscribeDevMenu(onShake);
|
|
38
60
|
this.subscribeAccelerometer(onShake);
|
|
39
61
|
}
|
package/dist/YaverFeedback.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.YaverFeedback = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
4
5
|
const Discovery_1 = require("./Discovery");
|
|
5
6
|
const BlackBox_1 = require("./BlackBox");
|
|
6
7
|
const P2PClient_1 = require("./P2PClient");
|
|
7
8
|
const ShakeDetector_1 = require("./ShakeDetector");
|
|
8
9
|
const auth_1 = require("./auth");
|
|
10
|
+
// Is this JS runtime the Yaver mobile app's super-host bridge? The
|
|
11
|
+
// YaverInfo native module is only registered inside Yaver's container
|
|
12
|
+
// (mobile/ios/Yaver/YaverInfo.{swift,m} + Android counterpart); a
|
|
13
|
+
// standalone app bundled by its own developer has no such module.
|
|
14
|
+
// When the SDK is loaded through Yaver's Hermes-push guest runtime we
|
|
15
|
+
// deliberately no-op every public entry point — Yaver owns the shake
|
|
16
|
+
// gesture ("Reload / Back to Yaver" overlay), the feedback capture
|
|
17
|
+
// flow, and the BlackBox streaming; running a second copy from inside
|
|
18
|
+
// the guest just produces duplicate UIs and double P2P sessions.
|
|
19
|
+
function isRunningInsideYaverHost() {
|
|
20
|
+
try {
|
|
21
|
+
return !!react_native_1.NativeModules?.YaverInfo;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// Suppresses SDK activation when inside Yaver super-host. Callers of
|
|
28
|
+
// YaverFeedback.init / startReport / startBatchRecording / … early-out
|
|
29
|
+
// by checking this first so the SDK's side effects (accelerometer,
|
|
30
|
+
// BlackBox HTTP, SSE command channel, FeedbackModal mount) never start.
|
|
31
|
+
const YAVER_HOST_SUPPRESS = isRunningInsideYaverHost();
|
|
9
32
|
let config = null;
|
|
10
33
|
let enabled = false;
|
|
11
34
|
let p2pClient = null;
|
|
@@ -34,6 +57,11 @@ class YaverFeedback {
|
|
|
34
57
|
* via `YaverDiscovery` on the first `startReport()` call.
|
|
35
58
|
*/
|
|
36
59
|
static init(cfg) {
|
|
60
|
+
if (YAVER_HOST_SUPPRESS) {
|
|
61
|
+
// Running inside Yaver's super-host — yield to Yaver's native UX.
|
|
62
|
+
enabled = false;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
37
65
|
config = {
|
|
38
66
|
trigger: 'shake',
|
|
39
67
|
maxRecordingDuration: 120,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaver-feedback-react-native",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Visual feedback SDK for Yaver — bug reports, screen recording, voice annotations, and local-first developer workflows",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/src/ShakeDetector.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import { DeviceEventEmitter, Platform } from 'react-native';
|
|
1
|
+
import { DeviceEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
// Detects that the surrounding runtime is Yaver's super-host bridge. The
|
|
4
|
+
// YaverInfo native module is only registered inside Yaver's container
|
|
5
|
+
// (see mobile/ios/Yaver/YaverInfo.{swift,m} and the Android equivalent),
|
|
6
|
+
// so it is undefined in a standalone third-party app. When the SDK runs
|
|
7
|
+
// inside Yaver we yield shake handling to Yaver's native
|
|
8
|
+
// ShakeDetectingWindow — the user should only ever see the 2-button
|
|
9
|
+
// "Reload / Back to Yaver" overlay, never a FeedbackModal popped from
|
|
10
|
+
// inside the guest bundle.
|
|
11
|
+
function isRunningInsideYaverHost(): boolean {
|
|
12
|
+
try {
|
|
13
|
+
return !!(NativeModules as any)?.YaverInfo;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
2
18
|
|
|
3
19
|
const SHAKE_TIMEOUT_MS = 1000; // minimum time between shakes
|
|
4
20
|
const ACCEL_THRESHOLD_G = 1.8; // peak g-force that qualifies as a shake event
|
|
@@ -32,6 +48,11 @@ export class ShakeDetector {
|
|
|
32
48
|
|
|
33
49
|
start(onShake: () => void): void {
|
|
34
50
|
this.stop();
|
|
51
|
+
// When the app is loaded inside Yaver's super-host (Hermes push),
|
|
52
|
+
// Yaver owns the shake gesture and shows its own "Reload / Back to
|
|
53
|
+
// Yaver" overlay. We must not also fire the guest-side callback,
|
|
54
|
+
// otherwise the user gets both UIs at once.
|
|
55
|
+
if (isRunningInsideYaverHost()) return;
|
|
35
56
|
this.subscribeDevMenu(onShake);
|
|
36
57
|
this.subscribeAccelerometer(onShake);
|
|
37
58
|
}
|
package/src/YaverFeedback.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
1
2
|
import { FeedbackConfig, CapturedError } from './types';
|
|
2
3
|
import { YaverDiscovery } from './Discovery';
|
|
3
4
|
import { BlackBox } from './BlackBox';
|
|
@@ -12,6 +13,29 @@ import {
|
|
|
12
13
|
DEFAULT_CONVEX_SITE_URL,
|
|
13
14
|
} from './auth';
|
|
14
15
|
|
|
16
|
+
// Is this JS runtime the Yaver mobile app's super-host bridge? The
|
|
17
|
+
// YaverInfo native module is only registered inside Yaver's container
|
|
18
|
+
// (mobile/ios/Yaver/YaverInfo.{swift,m} + Android counterpart); a
|
|
19
|
+
// standalone app bundled by its own developer has no such module.
|
|
20
|
+
// When the SDK is loaded through Yaver's Hermes-push guest runtime we
|
|
21
|
+
// deliberately no-op every public entry point — Yaver owns the shake
|
|
22
|
+
// gesture ("Reload / Back to Yaver" overlay), the feedback capture
|
|
23
|
+
// flow, and the BlackBox streaming; running a second copy from inside
|
|
24
|
+
// the guest just produces duplicate UIs and double P2P sessions.
|
|
25
|
+
function isRunningInsideYaverHost(): boolean {
|
|
26
|
+
try {
|
|
27
|
+
return !!(NativeModules as any)?.YaverInfo;
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Suppresses SDK activation when inside Yaver super-host. Callers of
|
|
34
|
+
// YaverFeedback.init / startReport / startBatchRecording / … early-out
|
|
35
|
+
// by checking this first so the SDK's side effects (accelerometer,
|
|
36
|
+
// BlackBox HTTP, SSE command channel, FeedbackModal mount) never start.
|
|
37
|
+
const YAVER_HOST_SUPPRESS = isRunningInsideYaverHost();
|
|
38
|
+
|
|
15
39
|
let config: FeedbackConfig | null = null;
|
|
16
40
|
let enabled = false;
|
|
17
41
|
let p2pClient: P2PClient | null = null;
|
|
@@ -44,6 +68,11 @@ export class YaverFeedback {
|
|
|
44
68
|
* via `YaverDiscovery` on the first `startReport()` call.
|
|
45
69
|
*/
|
|
46
70
|
static init(cfg: FeedbackConfig): void {
|
|
71
|
+
if (YAVER_HOST_SUPPRESS) {
|
|
72
|
+
// Running inside Yaver's super-host — yield to Yaver's native UX.
|
|
73
|
+
enabled = false;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
47
76
|
config = {
|
|
48
77
|
trigger: 'shake',
|
|
49
78
|
maxRecordingDuration: 120,
|