yaver-feedback-react-native 0.9.0 → 0.9.3

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 (144) hide show
  1. package/README.md +102 -1
  2. package/app.plugin.js +126 -9
  3. package/dist/AuthOverlay.d.ts +1 -14
  4. package/dist/AuthOverlay.js +9 -62
  5. package/dist/BlackBox.js +9 -1
  6. package/dist/DeployPanel.js +65 -0
  7. package/dist/Discovery.js +13 -8
  8. package/dist/DogfoodRuntime.d.ts +124 -0
  9. package/dist/DogfoodRuntime.js +273 -0
  10. package/dist/FeedbackModal.js +505 -65
  11. package/dist/LoginScreen.d.ts +1 -5
  12. package/dist/LoginScreen.js +2 -6
  13. package/dist/MachinePickerScreen.d.ts +1 -3
  14. package/dist/MachinePickerScreen.js +6 -18
  15. package/dist/P2PClient.d.ts +178 -2
  16. package/dist/P2PClient.js +493 -3
  17. package/dist/P2PDogfoodDriver.d.ts +12 -0
  18. package/dist/P2PDogfoodDriver.js +118 -0
  19. package/dist/PairDeviceModal.d.ts +2 -3
  20. package/dist/ShakeDetector.js +2 -0
  21. package/dist/VibeChatScreen.d.ts +11 -1
  22. package/dist/VibeChatScreen.js +200 -41
  23. package/dist/YaverFeedback.d.ts +132 -0
  24. package/dist/YaverFeedback.js +633 -65
  25. package/dist/YaverModeBadge.d.ts +22 -0
  26. package/dist/YaverModeBadge.js +219 -0
  27. package/dist/__tests__/AuthDevices.test.js +1 -48
  28. package/dist/__tests__/BlackBox.relayPassword.test.d.ts +1 -0
  29. package/dist/__tests__/BlackBox.relayPassword.test.js +105 -0
  30. package/dist/__tests__/BlackBoxAutoStart.test.d.ts +1 -0
  31. package/dist/__tests__/BlackBoxAutoStart.test.js +91 -0
  32. package/dist/__tests__/BlackBoxAutoStartColdStart.test.d.ts +1 -0
  33. package/dist/__tests__/BlackBoxAutoStartColdStart.test.js +156 -0
  34. package/dist/__tests__/BrowserLaneIcon.test.d.ts +3 -0
  35. package/dist/__tests__/BrowserLaneIcon.test.js +80 -0
  36. package/dist/__tests__/DogfoodRuntime.test.d.ts +1 -0
  37. package/dist/__tests__/DogfoodRuntime.test.js +116 -0
  38. package/dist/__tests__/P2PClient.test.js +2 -2
  39. package/dist/__tests__/P2PDogfoodDriver.test.d.ts +1 -0
  40. package/dist/__tests__/P2PDogfoodDriver.test.js +64 -0
  41. package/dist/__tests__/ReportIdentity.test.d.ts +25 -0
  42. package/dist/__tests__/ReportIdentity.test.js +180 -0
  43. package/dist/__tests__/SDKToken.test.js +1 -1
  44. package/dist/__tests__/ShakeToggle.test.d.ts +1 -0
  45. package/dist/__tests__/ShakeToggle.test.js +121 -0
  46. package/dist/__tests__/YaverFeedback.test.js +13 -3
  47. package/dist/__tests__/deviceDogfood.test.d.ts +1 -0
  48. package/dist/__tests__/deviceDogfood.test.js +86 -0
  49. package/dist/__tests__/dogfoodPolicy.test.d.ts +1 -0
  50. package/dist/__tests__/dogfoodPolicy.test.js +33 -0
  51. package/dist/__tests__/pickTargetDevice.test.d.ts +1 -0
  52. package/dist/__tests__/pickTargetDevice.test.js +89 -0
  53. package/dist/__tests__/reloadActions.test.d.ts +1 -0
  54. package/dist/__tests__/reloadActions.test.js +129 -0
  55. package/dist/__tests__/reloadActionsParity.test.d.ts +1 -0
  56. package/dist/__tests__/reloadActionsParity.test.js +42 -0
  57. package/dist/__tests__/types.test.js +5 -5
  58. package/dist/_core/ansi.d.ts +117 -0
  59. package/dist/_core/ansi.js +468 -0
  60. package/dist/_core/ansi.test.d.ts +1 -0
  61. package/dist/_core/ansi.test.js +225 -0
  62. package/dist/_core/buildFeedbackPrompt.d.ts +4 -9
  63. package/dist/_core/buildFeedbackPrompt.js +18 -72
  64. package/dist/_core/constants.d.ts +19 -6
  65. package/dist/_core/constants.js +20 -7
  66. package/dist/_core/device.d.ts +1 -5
  67. package/dist/_core/device.js +5 -14
  68. package/dist/_core/endpoints.d.ts +0 -7
  69. package/dist/_core/endpoints.js +0 -7
  70. package/dist/_core/index.d.ts +4 -0
  71. package/dist/_core/index.js +4 -0
  72. package/dist/_core/remoteless.d.ts +44 -0
  73. package/dist/_core/remoteless.js +75 -0
  74. package/dist/_core/trace.d.ts +47 -0
  75. package/dist/_core/trace.js +38 -0
  76. package/dist/_core/trace.test.d.ts +1 -0
  77. package/dist/_core/trace.test.js +60 -0
  78. package/dist/auth.d.ts +3 -60
  79. package/dist/auth.js +6 -88
  80. package/dist/deviceDogfood.d.ts +53 -0
  81. package/dist/deviceDogfood.js +137 -0
  82. package/dist/dogfoodPolicy.d.ts +25 -0
  83. package/dist/dogfoodPolicy.js +24 -0
  84. package/dist/index.d.ts +17 -4
  85. package/dist/index.js +33 -7
  86. package/dist/reloadActions.d.ts +88 -0
  87. package/dist/reloadActions.js +200 -0
  88. package/dist/storeShots.d.ts +67 -0
  89. package/dist/storeShots.js +137 -0
  90. package/dist/types.d.ts +208 -8
  91. package/package.json +13 -4
  92. package/src/AuthOverlay.tsx +20 -106
  93. package/src/BlackBox.ts +10 -1
  94. package/src/DeployPanel.tsx +74 -0
  95. package/src/Discovery.ts +13 -8
  96. package/src/DogfoodRuntime.ts +373 -0
  97. package/src/FeedbackModal.tsx +619 -79
  98. package/src/LoginScreen.tsx +2 -22
  99. package/src/MachinePickerScreen.tsx +6 -21
  100. package/src/P2PClient.ts +580 -4
  101. package/src/P2PDogfoodDriver.ts +132 -0
  102. package/src/PairDeviceModal.tsx +2 -3
  103. package/src/ShakeDetector.ts +1 -0
  104. package/src/VibeChatScreen.tsx +232 -42
  105. package/src/YaverFeedback.ts +631 -68
  106. package/src/YaverModeBadge.tsx +234 -0
  107. package/src/__tests__/AuthDevices.test.ts +1 -52
  108. package/src/__tests__/BlackBox.relayPassword.test.ts +129 -0
  109. package/src/__tests__/BlackBoxAutoStart.test.ts +111 -0
  110. package/src/__tests__/BlackBoxAutoStartColdStart.test.ts +191 -0
  111. package/src/__tests__/BrowserLaneIcon.test.ts +85 -0
  112. package/src/__tests__/DogfoodRuntime.test.ts +135 -0
  113. package/src/__tests__/P2PClient.test.ts +2 -2
  114. package/src/__tests__/P2PDogfoodDriver.test.ts +80 -0
  115. package/src/__tests__/ReportIdentity.test.ts +212 -0
  116. package/src/__tests__/SDKToken.test.ts +1 -1
  117. package/src/__tests__/ShakeToggle.test.ts +153 -0
  118. package/src/__tests__/YaverFeedback.test.ts +15 -3
  119. package/src/__tests__/deviceDogfood.test.ts +77 -0
  120. package/src/__tests__/dogfoodPolicy.test.ts +34 -0
  121. package/src/__tests__/pickTargetDevice.test.ts +101 -0
  122. package/src/__tests__/reloadActions.test.ts +171 -0
  123. package/src/__tests__/reloadActionsParity.test.ts +49 -0
  124. package/src/__tests__/types.test.ts +5 -5
  125. package/src/_core/ansi.test.ts +250 -0
  126. package/src/_core/ansi.ts +475 -0
  127. package/src/_core/buildFeedbackPrompt.ts +18 -95
  128. package/src/_core/constants.ts +20 -6
  129. package/src/_core/device.ts +5 -16
  130. package/src/_core/endpoints.ts +0 -7
  131. package/src/_core/index.ts +4 -0
  132. package/src/_core/remoteless.ts +110 -0
  133. package/src/_core/trace.test.ts +58 -0
  134. package/src/_core/trace.ts +75 -0
  135. package/src/auth.ts +7 -156
  136. package/src/deviceDogfood.ts +171 -0
  137. package/src/dogfoodPolicy.ts +40 -0
  138. package/src/index.ts +61 -11
  139. package/src/reloadActions.ts +273 -0
  140. package/src/storeShots.ts +189 -0
  141. package/src/types.ts +209 -8
  142. package/dist/GuestOnboardingScreen.d.ts +0 -8
  143. package/dist/GuestOnboardingScreen.js +0 -282
  144. package/src/GuestOnboardingScreen.tsx +0 -307
@@ -1,6 +1,15 @@
1
1
  import { FeedbackConfig, CapturedError } from './types';
2
2
  import { P2PClient } from './P2PClient';
3
+ import { CaptureStoreScreenshotsOptions, CaptureStoreScreenshotsResult } from './storeShots';
3
4
  import { QuickIconColorPreset } from './preferences';
5
+ import { type SDKDogfoodStatus } from './dogfoodPolicy';
6
+ import { type DeviceDogfoodOptions, type DeviceDogfoodSession, type DeviceDogfoodState } from './deviceDogfood';
7
+ export interface DogfoodOnboardingOptions extends DeviceDogfoodOptions {
8
+ /** Hint used to preselect the matching project returned by the owner machine. */
9
+ projectName?: string;
10
+ /** Framework fallback when the machine has not classified the project yet. */
11
+ framework?: string;
12
+ }
4
13
  /**
5
14
  * Main entry point for the Yaver Feedback SDK.
6
15
  * Call `YaverFeedback.init()` once at app startup.
@@ -15,7 +24,26 @@ export declare class YaverFeedback {
15
24
  * If no `agentUrl` is provided, the SDK will attempt auto-discovery
16
25
  * via `YaverDiscovery` on the first `startReport()` call.
17
26
  */
27
+ /** The runtime lane, when running on web inside a Yaver preview WebView. */
28
+ static detectWebLane(): 'browser' | 'webrtc' | null;
29
+ /**
30
+ * Mount a draggable DOM floating "Y" icon for the BROWSER lane (RN-web). It
31
+ * lives in the WebView's document.body (position:fixed, max z-index), so it
32
+ * renders ON TOP of the page inside the WebView and is never occluded by the
33
+ * fullScreen preview modal — the one occlusion-proof affordance on iOS.
34
+ * Tap opens the SDK's existing report flow (the RN FeedbackModal renders in
35
+ * the same WebView DOM, also un-occluded). No-op off-web or off-lane, and
36
+ * idempotent (a re-init reuses the existing node).
37
+ */
38
+ static mountBrowserLaneIcon(): void;
18
39
  static init(cfg: FeedbackConfig): void;
40
+ /**
41
+ * Opt-in global crash handler. This wraps the existing React Native
42
+ * ErrorUtils handler and still calls it, so Sentry/Crashlytics/Bugsnag can
43
+ * remain the system of record. The SDK only uploads a crash report and,
44
+ * when configured, asks the agent to create a fix task.
45
+ */
46
+ static installCrashHandler(): void;
19
47
  /**
20
48
  * Run agent discovery in the background.
21
49
  * Called automatically from init() when no agentUrl is provided.
@@ -46,6 +74,29 @@ export declare class YaverFeedback {
46
74
  static setAuthToken(token: string): Promise<void>;
47
75
  /** Returns true once the SDK has a session token it can use. */
48
76
  static isAuthed(): boolean;
77
+ /**
78
+ * On-device App Store screenshot capture (Engine 2). Walks the routes
79
+ * the host hands us, screenshots each, and uploads to the agent which
80
+ * runs the App Store Connect backend. agentUrl / authToken / relay
81
+ * password default to the SDK's resolved session; the host only has to
82
+ * supply a navigation ref + the ordered route list.
83
+ *
84
+ * YaverFeedback.captureStoreScreenshots({
85
+ * app: 'sfmg',
86
+ * navigationRef,
87
+ * routes: ['/(tabs)/dashboard', '/(tabs)/messages', '/(tabs)/clients'],
88
+ * submit: true,
89
+ * })
90
+ */
91
+ static captureStoreScreenshots(opts: Omit<CaptureStoreScreenshotsOptions, 'agentUrl' | 'authToken' | 'relayPassword'> & Partial<Pick<CaptureStoreScreenshotsOptions, 'agentUrl' | 'authToken' | 'relayPassword'>>): Promise<CaptureStoreScreenshotsResult>;
92
+ /**
93
+ * Let the mobile app / CLI kick THIS device into self-capturing. Registers
94
+ * a BlackBox command listener that fires captureStoreScreenshots when the
95
+ * agent pushes a `capture_store_shots` command (its `data` may override
96
+ * `submit` / `locale`). Returns an unsubscribe fn. Call once after init,
97
+ * passing the app's navigation ref + the routes to walk.
98
+ */
99
+ static enableStoreShotsOnCommand(opts: Omit<CaptureStoreScreenshotsOptions, 'agentUrl' | 'authToken' | 'relayPassword'>): () => void;
49
100
  /**
50
101
  * Request the embedded FeedbackModal to show the login screen. Works by
51
102
  * emitting an event the modal listens for — avoids forcing the host app
@@ -57,6 +108,12 @@ export declare class YaverFeedback {
57
108
  * an active session; no-ops otherwise.
58
109
  */
59
110
  static showMachinePicker(): void;
111
+ /** Begin the reusable host-app Dogfood wizard. Owner OAuth and machine
112
+ * selection intentionally happen before installation enrollment/runtime
113
+ * controls because starting builds or runners is owner-level authority. */
114
+ static beginDogfoodOnboarding(options: DogfoodOnboardingOptions): void;
115
+ static getDogfoodOnboarding(): DogfoodOnboardingOptions | null;
116
+ static clearDogfoodOnboarding(): void;
60
117
  /**
61
118
  * Update the selected remote device. Resets the cached agent URL so the
62
119
  * next `startReport()` (or FloatingButton press) rediscovers against the
@@ -112,10 +169,64 @@ export declare class YaverFeedback {
112
169
  * - All methods become active
113
170
  */
114
171
  static setEnabled(value: boolean): void;
172
+ /**
173
+ * Turn shake-to-report on or off without tearing the SDK down.
174
+ *
175
+ * `trigger` is read only inside init(), so before this the only ways to
176
+ * stop listening for a shake were setEnabled(false) — which also kills the
177
+ * flight recorder and the agent command channel — or a re-init, which used
178
+ * to stack a duplicate command handler. Neither is what "turn the shake
179
+ * catcher off" should cost.
180
+ *
181
+ * Persists onto config.disableShakeGesture, so a later setEnabled(true)
182
+ * honours it rather than resurrecting the listener.
183
+ */
184
+ static setShakeEnabled(value: boolean): void;
185
+ /** Whether the shake listener is currently armed. */
186
+ static isShakeEnabled(): boolean;
187
+ /**
188
+ * Bring the shake listener in line with the current config. Idempotent —
189
+ * safe to call whenever `enabled`, `trigger`, or `disableShakeGesture`
190
+ * moves.
191
+ */
192
+ private static syncShakeDetector;
193
+ private static stopShakeDetector;
194
+ /** Cancel a pending BlackBox auto-start retry chain. */
195
+ private static cancelBlackBoxAutoStart;
196
+ /**
197
+ * Start BlackBox as soon as we have BOTH an agentUrl and a token, polling
198
+ * until then.
199
+ *
200
+ * Both conditions are mandatory and deliberate: starting without a token
201
+ * makes the SSE channel 401 and retry with backoff, which is the tight
202
+ * string-concat + JSON-parse loop that used to SIGSEGV Hermes on iOS 18.3.1
203
+ * during Screenshot & Fix. This only re-checks that same guard over time.
204
+ *
205
+ * Bounded at ~60s: long enough for AsyncStorage hydration plus a Convex
206
+ * discovery round trip on a cold, off-LAN start, short enough that a device
207
+ * whose user never signs in stops polling. Giving up here costs nothing —
208
+ * setAuthToken() and startReport() both reschedule, so signing in later
209
+ * still brings the channel up.
210
+ */
211
+ private static scheduleBlackBoxAutoStart;
115
212
  /** Returns whether the SDK is currently enabled. */
116
213
  static isEnabled(): boolean;
117
214
  /** Returns the current config, or null if not initialized. */
118
215
  static getConfig(): FeedbackConfig | null;
216
+ /** Current third-party SDK mode. Fails closed unless enabled + account match. */
217
+ static getDogfoodStatus(): SDKDogfoodStatus;
218
+ /** One-call, account-free Dogfood bootstrap for third-party apps. On first
219
+ * launch it creates/proves the installation key and returns pending; after
220
+ * owner approval the same call obtains a short-lived scoped Yaver session
221
+ * and enables Dogfood UX without the host app implementing OAuth. */
222
+ static enableDeviceDogfood(options: DeviceDogfoodOptions): Promise<{
223
+ status: DeviceDogfoodState;
224
+ installationId: string;
225
+ session: DeviceDogfoodSession | null;
226
+ }>;
227
+ /** Confirmed by the Y badge/UI before this is called. Reverts this SDK to
228
+ * normal Feedback mode for the remainder of the app run. */
229
+ static exitDogfoodMode(): Promise<void>;
119
230
  /** Returns the resolved relay password the SDK is currently using.
120
231
  * Empty string when no relay routing is in play (direct LAN agent
121
232
  * URLs need no password). Callers attaching it to relay-routed
@@ -150,11 +261,32 @@ export declare class YaverFeedback {
150
261
  * // wrapper, and the chain stays intact.
151
262
  */
152
263
  static wrapErrorHandler(next?: ((error: Error, isFatal?: boolean) => void) | null): (error: Error, isFatal?: boolean) => void;
264
+ /**
265
+ * Upload a crash-aware feedback bundle. Apps can call this from their own
266
+ * error boundary/global handler. If crashReporting.autoFix is true, the SDK
267
+ * also triggers the agent's feedback-fix task; reload delivery still happens
268
+ * through the existing BlackBox command stream.
269
+ */
270
+ static reportCrash(error: Error, opts?: {
271
+ isFatal?: boolean;
272
+ source?: 'manual' | 'global-handler';
273
+ metadata?: Record<string, unknown>;
274
+ autoFix?: boolean;
275
+ }): Promise<{
276
+ reportId?: string;
277
+ taskId?: string;
278
+ }>;
153
279
  /**
154
280
  * Returns the P2P client instance.
155
281
  * Available after init if agentUrl is set, or after first successful discovery.
156
282
  */
157
283
  static getP2PClient(): P2PClient | null;
284
+ /** Renderer/reload route; intentionally distinct from the coding client. */
285
+ static getRenderP2PClient(): P2PClient | null;
286
+ static getMachineRouting(): {
287
+ codingDeviceId?: string;
288
+ renderDeviceId?: string;
289
+ };
158
290
  /**
159
291
  * Record a business event. Routes through BlackBox so the agent
160
292
  * persists it to the analytics ledger (no dashboards — export