yaver-feedback-react-native 0.5.3 → 0.5.4
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 +8 -0
- package/dist/AuthOverlay.d.ts +16 -0
- package/dist/AuthOverlay.js +104 -0
- package/dist/BlackBox.d.ts +154 -0
- package/dist/BlackBox.js +395 -0
- package/dist/ConnectionScreen.d.ts +13 -0
- package/dist/ConnectionScreen.js +373 -0
- package/dist/Discovery.d.ts +59 -0
- package/dist/Discovery.js +293 -0
- package/dist/FeedbackModal.d.ts +11 -0
- package/dist/FeedbackModal.js +623 -0
- package/dist/FixReport.d.ts +23 -0
- package/dist/FixReport.js +282 -0
- package/dist/FloatingButton.d.ts +71 -0
- package/dist/FloatingButton.js +778 -0
- package/dist/LoginScreen.d.ts +14 -0
- package/dist/LoginScreen.js +317 -0
- package/dist/MachinePickerScreen.d.ts +19 -0
- package/dist/MachinePickerScreen.js +175 -0
- package/dist/P2PClient.d.ts +136 -0
- package/dist/P2PClient.js +357 -0
- package/dist/ShakeDetector.d.ts +39 -0
- package/dist/ShakeDetector.js +111 -0
- package/dist/YaverFeedback.d.ts +198 -0
- package/dist/YaverFeedback.js +679 -0
- package/dist/YaverUpdates.d.ts +78 -0
- package/dist/YaverUpdates.js +272 -0
- package/dist/__tests__/Discovery.test.d.ts +1 -0
- package/dist/__tests__/Discovery.test.js +164 -0
- package/dist/__tests__/P2PClient.test.d.ts +1 -0
- package/dist/__tests__/P2PClient.test.js +169 -0
- package/dist/__tests__/SDKToken.test.d.ts +1 -0
- package/dist/__tests__/SDKToken.test.js +215 -0
- package/dist/__tests__/YaverFeedback.test.d.ts +1 -0
- package/dist/__tests__/YaverFeedback.test.js +161 -0
- package/dist/__tests__/types.test.d.ts +1 -0
- package/dist/__tests__/types.test.js +219 -0
- package/dist/auth.d.ts +105 -0
- package/dist/auth.js +282 -0
- package/dist/capture.d.ts +27 -0
- package/dist/capture.js +74 -0
- package/dist/expo.d.ts +15 -0
- package/dist/expo.js +62 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +80 -0
- package/dist/types.d.ts +282 -0
- package/dist/types.js +2 -0
- package/dist/upload.d.ts +13 -0
- package/dist/upload.js +59 -0
- package/package.json +6 -3
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { FeedbackConfig, CapturedError } from './types';
|
|
2
|
+
import { P2PClient } from './P2PClient';
|
|
3
|
+
/**
|
|
4
|
+
* Main entry point for the Yaver Feedback SDK.
|
|
5
|
+
* Call `YaverFeedback.init()` once at app startup.
|
|
6
|
+
*/
|
|
7
|
+
export declare class YaverFeedback {
|
|
8
|
+
/**
|
|
9
|
+
* Initialize the feedback SDK with the given configuration.
|
|
10
|
+
* Typically called in your app's root component or entry file.
|
|
11
|
+
*
|
|
12
|
+
* If no `agentUrl` is provided, the SDK will attempt auto-discovery
|
|
13
|
+
* via `YaverDiscovery` on the first `startReport()` call.
|
|
14
|
+
*/
|
|
15
|
+
static init(cfg: FeedbackConfig): void;
|
|
16
|
+
/**
|
|
17
|
+
* Run agent discovery in the background.
|
|
18
|
+
* Called automatically from init() when no agentUrl is provided.
|
|
19
|
+
* Sets config.agentUrl and creates P2PClient on success.
|
|
20
|
+
*/
|
|
21
|
+
static discoverAgent(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Pull a cached session token + selected device from AsyncStorage (populated
|
|
24
|
+
* by the in-SDK login + machine-picker screens). When present the SDK can
|
|
25
|
+
* reconnect silently on launch without re-prompting the user. Safe to call
|
|
26
|
+
* multiple times — it only overrides values the caller did not already set.
|
|
27
|
+
*/
|
|
28
|
+
static hydrateSession(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Update the signed-in session token (e.g. after the in-SDK login screen
|
|
31
|
+
* succeeds). Rebuilds the P2P client and kicks off agent discovery.
|
|
32
|
+
*/
|
|
33
|
+
static setAuthToken(token: string): Promise<void>;
|
|
34
|
+
/** Returns true once the SDK has a session token it can use. */
|
|
35
|
+
static isAuthed(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Request the embedded FeedbackModal to show the login screen. Works by
|
|
38
|
+
* emitting an event the modal listens for — avoids forcing the host app
|
|
39
|
+
* to mount a second navigator.
|
|
40
|
+
*/
|
|
41
|
+
static showLogin(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Request the embedded FeedbackModal to show the machine picker. Requires
|
|
44
|
+
* an active session; no-ops otherwise.
|
|
45
|
+
*/
|
|
46
|
+
static showMachinePicker(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Update the selected remote device. Resets the cached agent URL so the
|
|
49
|
+
* next `startReport()` (or FloatingButton press) rediscovers against the
|
|
50
|
+
* newly-selected machine.
|
|
51
|
+
*/
|
|
52
|
+
static setPreferredDevice(deviceId: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Sign out: clear cached token + device, tear down the P2P client. The
|
|
55
|
+
* SDK stays enabled; the next feedback trigger will re-prompt for login.
|
|
56
|
+
*/
|
|
57
|
+
static signOut(): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Manually trigger the feedback collection flow.
|
|
60
|
+
* Opens the feedback modal if the SDK is initialized and enabled.
|
|
61
|
+
*
|
|
62
|
+
* If no agentUrl was configured, runs auto-discovery first.
|
|
63
|
+
*/
|
|
64
|
+
static startReport(): Promise<void>;
|
|
65
|
+
/** Returns true if the SDK has been initialized. */
|
|
66
|
+
static isInitialized(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Enable or disable the entire feedback SDK at runtime.
|
|
69
|
+
*
|
|
70
|
+
* **Disable (false):**
|
|
71
|
+
* - Stops BlackBox streaming (flushes remaining events first)
|
|
72
|
+
* - Restores console.log/warn/error if wrapped
|
|
73
|
+
* - Clears error buffer
|
|
74
|
+
* - All methods become no-ops (attachError, wrapErrorHandler still safe to call but do nothing)
|
|
75
|
+
* - P2P client is kept alive (no reconnection cost on re-enable)
|
|
76
|
+
*
|
|
77
|
+
* **Enable (true):**
|
|
78
|
+
* - Restarts BlackBox streaming if it was running before disable
|
|
79
|
+
* - Error buffer starts collecting again
|
|
80
|
+
* - All methods become active
|
|
81
|
+
*/
|
|
82
|
+
static setEnabled(value: boolean): void;
|
|
83
|
+
/** Returns whether the SDK is currently enabled. */
|
|
84
|
+
static isEnabled(): boolean;
|
|
85
|
+
/** Returns the current config, or null if not initialized. */
|
|
86
|
+
static getConfig(): FeedbackConfig | null;
|
|
87
|
+
/**
|
|
88
|
+
* Manually attach an error with optional metadata.
|
|
89
|
+
* Use this in catch blocks to give the agent extra context.
|
|
90
|
+
*/
|
|
91
|
+
static attachError(error: Error, metadata?: Record<string, unknown>): void;
|
|
92
|
+
/**
|
|
93
|
+
* Returns the current captured errors buffer.
|
|
94
|
+
* Called internally when building a FeedbackBundle.
|
|
95
|
+
*/
|
|
96
|
+
static getCapturedErrors(): CapturedError[];
|
|
97
|
+
/** Clears the captured errors buffer. */
|
|
98
|
+
static clearCapturedErrors(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Returns a pass-through error handler that records the error in Yaver's
|
|
101
|
+
* buffer and then calls `next`. Use this to insert Yaver into your
|
|
102
|
+
* existing error handler chain without replacing anything.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* // Works alongside Sentry, Crashlytics, or any other tool:
|
|
106
|
+
* const originalHandler = ErrorUtils.getGlobalHandler();
|
|
107
|
+
* ErrorUtils.setGlobalHandler(
|
|
108
|
+
* YaverFeedback.wrapErrorHandler(originalHandler)
|
|
109
|
+
* );
|
|
110
|
+
* // Sentry can still be initialized after this — it will wrap our
|
|
111
|
+
* // wrapper, and the chain stays intact.
|
|
112
|
+
*/
|
|
113
|
+
static wrapErrorHandler(next?: ((error: Error, isFatal?: boolean) => void) | null): (error: Error, isFatal?: boolean) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the P2P client instance.
|
|
116
|
+
* Available after init if agentUrl is set, or after first successful discovery.
|
|
117
|
+
*/
|
|
118
|
+
static getP2PClient(): P2PClient | null;
|
|
119
|
+
/** Returns the current feedback mode. */
|
|
120
|
+
static getFeedbackMode(): 'live' | 'narrated' | 'batch';
|
|
121
|
+
/** Returns the agent commentary level (0-10). */
|
|
122
|
+
static getCommentaryLevel(): number;
|
|
123
|
+
/**
|
|
124
|
+
* Record a business event. Routes through BlackBox so the agent
|
|
125
|
+
* persists it to the analytics ledger (no dashboards — export
|
|
126
|
+
* via CSV or webhook into PostHog).
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* YaverFeedback.track('purchase_completed', { amount: '9.99' });
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
static track(name: string, props?: Record<string, unknown>, route?: string): void;
|
|
134
|
+
/**
|
|
135
|
+
* Evaluate a single feature flag for a user. Results are cached
|
|
136
|
+
* for 30 seconds inside YaverFeedback so a tight loop evaluating
|
|
137
|
+
* the same key doesn't hammer the agent.
|
|
138
|
+
*
|
|
139
|
+
* @param key — flag key (must exist on the agent)
|
|
140
|
+
* @param defaultValue — returned if the flag is missing / offline
|
|
141
|
+
* @param userId — stable user identifier for rollout bucketing
|
|
142
|
+
*/
|
|
143
|
+
static getFlag<T = boolean | string>(key: string, defaultValue: T, userId?: string): Promise<T>;
|
|
144
|
+
/**
|
|
145
|
+
* Bulk evaluate every flag for a user. Cached on the same 30s
|
|
146
|
+
* window as getFlag — use this when boot needs a handful of
|
|
147
|
+
* flags in one roundtrip.
|
|
148
|
+
*/
|
|
149
|
+
static getFlags(userId?: string): Promise<Record<string, unknown>>;
|
|
150
|
+
/**
|
|
151
|
+
* Ask what bundle this device should run. Returns the latest
|
|
152
|
+
* release manifest in the configured channel plus a rollout
|
|
153
|
+
* gate. The dev can then compare against what's currently
|
|
154
|
+
* running and prompt the user to reload.
|
|
155
|
+
*
|
|
156
|
+
* On-disk bundle swap is platform-specific — see
|
|
157
|
+
* `YaverFeedback.onUpdateAvailable` if you want a hook.
|
|
158
|
+
*/
|
|
159
|
+
static checkUpdate(channel?: string, deviceId?: string): Promise<Awaited<ReturnType<P2PClient['releasesLatest']>>>;
|
|
160
|
+
/** Clear the in-memory flag cache. Useful for tests or after sign-out. */
|
|
161
|
+
static clearFlagCache(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Reporting-only mode: auto-capture screenshot + errors and send
|
|
164
|
+
* to the agent's /feedback endpoint. No modal UI — just shake and go.
|
|
165
|
+
*
|
|
166
|
+
* This is triggered by shake when `reportingOnly: true` is set.
|
|
167
|
+
* The agent receives the report via the same P2P channel and logs it.
|
|
168
|
+
*/
|
|
169
|
+
static sendAutoReport(): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Default reload handler. Tries three strategies in order:
|
|
172
|
+
*
|
|
173
|
+
* 1. **YaverBundleLoader** — running inside Yaver's native container.
|
|
174
|
+
* Pulls fresh Hermes bundle from agent and reloads the RN bridge.
|
|
175
|
+
*
|
|
176
|
+
* 2. **YaverHotReload** — standalone app with feedback SDK's native module
|
|
177
|
+
* (added via Expo config plugin). Downloads Hermes bundle from agent,
|
|
178
|
+
* saves to Documents, and reloads the RN bridge.
|
|
179
|
+
*
|
|
180
|
+
* 3. **DevSettings.reload()** — standalone dev build connected to Metro.
|
|
181
|
+
*/
|
|
182
|
+
private static defaultReload;
|
|
183
|
+
/**
|
|
184
|
+
* Default reload_bundle handler. Receives a compiled Hermes bundle URL
|
|
185
|
+
* from the agent and loads it via the best available native mechanism.
|
|
186
|
+
*/
|
|
187
|
+
private static defaultReloadBundle;
|
|
188
|
+
/**
|
|
189
|
+
* Core bundle reload logic. Tries native loaders in order:
|
|
190
|
+
*
|
|
191
|
+
* 1. YaverBundleLoader (Yaver container — full validation + bridge reload)
|
|
192
|
+
* 2. YaverHotReload (SDK's own native module — download + bridge reload)
|
|
193
|
+
* 3. DevSettings.reload() (Metro dev server fallback)
|
|
194
|
+
*/
|
|
195
|
+
private static loadBundleAndReload;
|
|
196
|
+
/** Tear down the SDK (stop shake detector, clear state). */
|
|
197
|
+
static destroy(): void;
|
|
198
|
+
}
|