yaver-feedback-react-native 0.8.0 → 0.8.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.
@@ -50,7 +50,10 @@ function isRunningInsideYaverHost() {
50
50
  }
51
51
  }
52
52
  const DEFAULT_SIZE = 44;
53
- const DEFAULT_COLOR = '#6366f1';
53
+ const DEFAULT_BACKGROUND_COLOR = '#ff6b2c';
54
+ const DEFAULT_LABEL_COLOR = '#111111';
55
+ const DEFAULT_BORDER_COLOR = 'rgba(255,255,255,0.92)';
56
+ const DEFAULT_SHADOW_COLOR = '#000000';
54
57
  const LONG_PRESS_MS = 550;
55
58
  /**
56
59
  * Small tap-to-open icon for the Yaver Feedback SDK.
@@ -66,7 +69,7 @@ const LONG_PRESS_MS = 550;
66
69
  * hidden the user can still shake to open feedback.
67
70
  *
68
71
  * Visibility is controlled by `FeedbackConfig.quickIcon`:
69
- * - `'auto'` (default) → `'always'` on iOS/Android, `'off'` on web.
72
+ * - `'auto'` (default) → `'after-shake'` on iOS/Android, `'off'` on web.
70
73
  * - `'always'` → visible from first render.
71
74
  * - `'after-shake'` → hidden until `yaverFeedback:firstShake` fires.
72
75
  * - `'off'` → never rendered.
@@ -74,16 +77,29 @@ const LONG_PRESS_MS = 550;
74
77
  * Suppressed entirely when the SDK is loaded inside Yaver's super-host
75
78
  * (the Yaver mobile app owns the shake gesture + overlay in that case).
76
79
  */
77
- const QuickActionIcon = ({ color: colorProp, initialPosition: initialPositionProp, size = DEFAULT_SIZE, }) => {
80
+ const QuickActionIcon = ({ color: colorProp, backgroundColor: backgroundColorProp, foregroundColor: foregroundColorProp, borderColor: borderColorProp, shadowColor: shadowColorProp, initialPosition: initialPositionProp, size = DEFAULT_SIZE, }) => {
78
81
  const config = YaverFeedback_1.YaverFeedback.getConfig();
79
82
  const mode = (() => {
80
83
  const raw = config?.quickIcon ?? 'auto';
81
84
  if (raw === 'auto') {
82
- return react_native_1.Platform.OS === 'web' ? 'off' : 'always';
85
+ return react_native_1.Platform.OS === 'web' ? 'off' : 'after-shake';
83
86
  }
84
87
  return raw;
85
88
  })();
86
- const color = colorProp ?? config?.quickIconColor ?? DEFAULT_COLOR;
89
+ const backgroundColor = backgroundColorProp ??
90
+ colorProp ??
91
+ config?.quickIconBackgroundColor ??
92
+ config?.quickIconColor ??
93
+ DEFAULT_BACKGROUND_COLOR;
94
+ const foregroundColor = foregroundColorProp ??
95
+ config?.quickIconForegroundColor ??
96
+ DEFAULT_LABEL_COLOR;
97
+ const borderColor = borderColorProp ??
98
+ config?.quickIconBorderColor ??
99
+ DEFAULT_BORDER_COLOR;
100
+ const shadowColor = shadowColorProp ??
101
+ config?.quickIconShadowColor ??
102
+ DEFAULT_SHADOW_COLOR;
87
103
  const { width, height } = react_native_1.Dimensions.get('window');
88
104
  const defaultStart = initialPositionProp ??
89
105
  config?.quickIconInitialPosition ?? {
@@ -216,11 +232,21 @@ const QuickActionIcon = ({ color: colorProp, initialPosition: initialPositionPro
216
232
  width: visualSize,
217
233
  height: visualSize,
218
234
  borderRadius: radius,
219
- backgroundColor: color,
235
+ backgroundColor,
236
+ borderColor,
237
+ shadowColor,
220
238
  opacity: pressed ? 0.85 : 1,
221
239
  },
222
240
  ]}>
223
- <react_native_1.Text style={[styles.iconLabel, { fontSize: Math.round(visualSize * 0.5) }]}>y</react_native_1.Text>
241
+ <react_native_1.Text style={[
242
+ styles.iconLabel,
243
+ {
244
+ color: foregroundColor,
245
+ fontSize: Math.round(visualSize * 0.5),
246
+ },
247
+ ]}>
248
+ y
249
+ </react_native_1.Text>
224
250
  </react_native_1.Pressable>
225
251
  {menuOpen ? (<react_native_1.View style={styles.menu}>
226
252
  <react_native_1.Pressable onPress={openFeedback} style={({ pressed }) => [
@@ -253,14 +279,13 @@ const styles = react_native_1.StyleSheet.create({
253
279
  icon: {
254
280
  alignItems: 'center',
255
281
  justifyContent: 'center',
256
- shadowColor: '#000',
257
282
  shadowOffset: { width: 0, height: 2 },
258
- shadowOpacity: 0.25,
259
- shadowRadius: 4,
260
- elevation: 4,
283
+ shadowOpacity: 0.34,
284
+ shadowRadius: 6,
285
+ elevation: 7,
286
+ borderWidth: 2,
261
287
  },
262
288
  iconLabel: {
263
- color: '#ffffff',
264
289
  fontWeight: '700',
265
290
  includeFontPadding: false,
266
291
  },
@@ -76,6 +76,7 @@ class YaverFeedback {
76
76
  autoLogin: true,
77
77
  ...cfg,
78
78
  };
79
+ firstShakeFired = false;
79
80
  // Route the in-SDK login screen to prod yaver.io by default; callers may
80
81
  // override for staging via authConvexSiteUrl / authWebBaseUrl.
81
82
  (0, auth_1.configureAuthEndpoints)({
@@ -818,6 +819,7 @@ class YaverFeedback {
818
819
  shakeDetector.stop();
819
820
  shakeDetector = null;
820
821
  }
822
+ firstShakeFired = false;
821
823
  enabled = false;
822
824
  config = null;
823
825
  p2pClient = null;
package/dist/capture.d.ts CHANGED
@@ -22,6 +22,17 @@
22
22
  * modal. See `FeedbackModal.handleScreenshotForFix`.
23
23
  */
24
24
  export declare function captureScreenshot(): Promise<string>;
25
+ export interface PickedFeedbackFile {
26
+ path: string;
27
+ name: string;
28
+ mimeType?: string;
29
+ kind: 'image' | 'video' | 'audio' | 'unknown';
30
+ }
31
+ /**
32
+ * Pick an existing media file from the device. Requires
33
+ * `expo-document-picker` to be installed.
34
+ */
35
+ export declare function pickFeedbackFile(): Promise<PickedFeedbackFile>;
25
36
  /**
26
37
  * Start a screen-recording session. Requires
27
38
  * `react-native-record-screen` as a peer dep.
package/dist/capture.js CHANGED
@@ -16,6 +16,7 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.captureScreenshot = captureScreenshot;
19
+ exports.pickFeedbackFile = pickFeedbackFile;
19
20
  exports.startVideoRecording = startVideoRecording;
20
21
  exports.stopVideoRecording = stopVideoRecording;
21
22
  exports.isVideoRecording = isVideoRecording;
@@ -45,6 +46,64 @@ async function captureScreenshot() {
45
46
  String(err));
46
47
  }
47
48
  }
49
+ function classifyPickedFile(name, mimeType) {
50
+ const lowerName = name.toLowerCase();
51
+ const lowerMime = (mimeType ?? '').toLowerCase();
52
+ if (lowerMime.startsWith('image/') ||
53
+ lowerName.endsWith('.png') ||
54
+ lowerName.endsWith('.jpg') ||
55
+ lowerName.endsWith('.jpeg') ||
56
+ lowerName.endsWith('.webp')) {
57
+ return 'image';
58
+ }
59
+ if (lowerMime.startsWith('video/') ||
60
+ lowerName.endsWith('.mp4') ||
61
+ lowerName.endsWith('.mov') ||
62
+ lowerName.endsWith('.m4v')) {
63
+ return 'video';
64
+ }
65
+ if (lowerMime.startsWith('audio/') ||
66
+ lowerName.endsWith('.m4a') ||
67
+ lowerName.endsWith('.aac') ||
68
+ lowerName.endsWith('.wav') ||
69
+ lowerName.endsWith('.mp3')) {
70
+ return 'audio';
71
+ }
72
+ return 'unknown';
73
+ }
74
+ /**
75
+ * Pick an existing media file from the device. Requires
76
+ * `expo-document-picker` to be installed.
77
+ */
78
+ async function pickFeedbackFile() {
79
+ try {
80
+ const picker = require('expo-document-picker');
81
+ const result = await picker.getDocumentAsync({
82
+ copyToCacheDirectory: true,
83
+ multiple: false,
84
+ type: ['image/*', 'video/*', 'audio/*'],
85
+ });
86
+ if (result?.canceled) {
87
+ throw new Error('File selection canceled.');
88
+ }
89
+ const asset = result?.assets?.[0];
90
+ if (!asset?.uri) {
91
+ throw new Error('No file selected.');
92
+ }
93
+ const name = asset.name || asset.uri.split('/').pop() || 'attachment';
94
+ const mimeType = asset.mimeType;
95
+ return {
96
+ path: asset.uri,
97
+ name,
98
+ mimeType,
99
+ kind: classifyPickedFile(name, mimeType),
100
+ };
101
+ }
102
+ catch (err) {
103
+ throw new Error('[YaverFeedback] File upload needs `expo-document-picker` as an optional peer dependency. ' +
104
+ String(err));
105
+ }
106
+ }
48
107
  let videoRecorderModule = null;
49
108
  let videoRecordingActive = false;
50
109
  /**
package/dist/index.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * yaver-feedback-react-native — Visual feedback SDK for Yaver.
3
3
  *
4
- * Shake-to-report surface with five one-tap actions:
4
+ * Shake-to-report surface with four core actions:
5
5
  * 1. Hot Reload — instant JS reload
6
- * 2. Screenshot & Fix — capture the screen under the modal and
7
- * kick a fix task on the agent
8
- * 3. Vibing — open a vibing session on the agent
9
- * 4. Start / Stop Recording screen recording toggle
10
- * 5. Send Video — submit the last recording
6
+ * 2. Vibing — open a vibing session on the agent
7
+ * 3. Screenshot / Upload — capture the screen under the modal or
8
+ * upload existing media
9
+ * 4. Screen Recording start, then stop + upload
10
+ *
11
+ * The small quick-access icon stays hidden until the first shake by
12
+ * default on mobile, then remains available unless the user hides it.
11
13
  *
12
14
  * @example
13
15
  * ```tsx
@@ -50,7 +52,7 @@ export { FixReport } from './FixReport';
50
52
  export { getQuickIconDisabled, setQuickIconDisabled, clearQuickIconDisabled, } from './preferences';
51
53
  export { configureAuthEndpoints, getConvexSiteUrl, getWebBaseUrl, getToken, saveToken, clearToken, getUser, saveUser, getSelectedDeviceId, saveSelectedDeviceId, clearSelectedDeviceId, validateToken, signInWithApple, signInWithOAuth, signupWithEmail, loginWithEmail, listReachableDevices, DEFAULT_CONVEX_SITE_URL, DEFAULT_WEB_BASE_URL, DEFAULT_OAUTH_REDIRECT, } from './auth';
52
54
  export type { OAuthProvider, User, RemoteDevice, DeviceList, } from './auth';
53
- export { captureScreenshot, startVideoRecording, stopVideoRecording, isVideoRecording, } from './capture';
55
+ export { captureScreenshot, pickFeedbackFile, startVideoRecording, stopVideoRecording, isVideoRecording, } from './capture';
54
56
  export { uploadFeedback } from './upload';
55
57
  export type { FeedbackConfig, FeedbackBundle, FeedbackMetadata, DeviceInfo, AppInfo, TimelineEvent, FeedbackReport, FeedbackStreamEvent, VoiceCapability, CapturedError, TestFix, TestSession, } from './types';
56
58
  export type { BlackBoxEvent, BlackBoxConfig, BlackBoxCommand, CommandHandler } from './BlackBox';
package/dist/index.js CHANGED
@@ -2,13 +2,15 @@
2
2
  /**
3
3
  * yaver-feedback-react-native — Visual feedback SDK for Yaver.
4
4
  *
5
- * Shake-to-report surface with five one-tap actions:
5
+ * Shake-to-report surface with four core actions:
6
6
  * 1. Hot Reload — instant JS reload
7
- * 2. Screenshot & Fix — capture the screen under the modal and
8
- * kick a fix task on the agent
9
- * 3. Vibing — open a vibing session on the agent
10
- * 4. Start / Stop Recording screen recording toggle
11
- * 5. Send Video — submit the last recording
7
+ * 2. Vibing — open a vibing session on the agent
8
+ * 3. Screenshot / Upload — capture the screen under the modal or
9
+ * upload existing media
10
+ * 4. Screen Recording start, then stop + upload
11
+ *
12
+ * The small quick-access icon stays hidden until the first shake by
13
+ * default on mobile, then remains available unless the user hides it.
12
14
  *
13
15
  * @example
14
16
  * ```tsx
@@ -28,7 +30,7 @@
28
30
  * ```
29
31
  */
30
32
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.uploadFeedback = exports.isVideoRecording = exports.stopVideoRecording = exports.startVideoRecording = exports.captureScreenshot = exports.DEFAULT_OAUTH_REDIRECT = exports.DEFAULT_WEB_BASE_URL = exports.DEFAULT_CONVEX_SITE_URL = exports.listReachableDevices = exports.loginWithEmail = exports.signupWithEmail = exports.signInWithOAuth = exports.signInWithApple = exports.validateToken = exports.clearSelectedDeviceId = exports.saveSelectedDeviceId = exports.getSelectedDeviceId = exports.saveUser = exports.getUser = exports.clearToken = exports.saveToken = exports.getToken = exports.getWebBaseUrl = exports.getConvexSiteUrl = exports.configureAuthEndpoints = exports.clearQuickIconDisabled = exports.setQuickIconDisabled = exports.getQuickIconDisabled = exports.FixReport = exports.QuickActionIcon = exports.FeedbackModal = exports.FloatingButton = exports.ShakeDetector = exports.AuthOverlay = exports.PairDeviceModal = exports.YaverMachinePickerScreen = exports.YaverLoginScreen = exports.YaverConnectionScreen = exports.P2PClient = exports.YaverDiscovery = exports.initExpo = exports.YaverUpdates = exports.BlackBox = exports.YaverFeedback = void 0;
33
+ exports.uploadFeedback = exports.isVideoRecording = exports.stopVideoRecording = exports.startVideoRecording = exports.pickFeedbackFile = exports.captureScreenshot = exports.DEFAULT_OAUTH_REDIRECT = exports.DEFAULT_WEB_BASE_URL = exports.DEFAULT_CONVEX_SITE_URL = exports.listReachableDevices = exports.loginWithEmail = exports.signupWithEmail = exports.signInWithOAuth = exports.signInWithApple = exports.validateToken = exports.clearSelectedDeviceId = exports.saveSelectedDeviceId = exports.getSelectedDeviceId = exports.saveUser = exports.getUser = exports.clearToken = exports.saveToken = exports.getToken = exports.getWebBaseUrl = exports.getConvexSiteUrl = exports.configureAuthEndpoints = exports.clearQuickIconDisabled = exports.setQuickIconDisabled = exports.getQuickIconDisabled = exports.FixReport = exports.QuickActionIcon = exports.FeedbackModal = exports.FloatingButton = exports.ShakeDetector = exports.AuthOverlay = exports.PairDeviceModal = exports.YaverMachinePickerScreen = exports.YaverLoginScreen = exports.YaverConnectionScreen = exports.P2PClient = exports.YaverDiscovery = exports.initExpo = exports.YaverUpdates = exports.BlackBox = exports.YaverFeedback = void 0;
32
34
  var YaverFeedback_1 = require("./YaverFeedback");
33
35
  Object.defineProperty(exports, "YaverFeedback", { enumerable: true, get: function () { return YaverFeedback_1.YaverFeedback; } });
34
36
  var BlackBox_1 = require("./BlackBox");
@@ -88,6 +90,7 @@ Object.defineProperty(exports, "DEFAULT_WEB_BASE_URL", { enumerable: true, get:
88
90
  Object.defineProperty(exports, "DEFAULT_OAUTH_REDIRECT", { enumerable: true, get: function () { return auth_1.DEFAULT_OAUTH_REDIRECT; } });
89
91
  var capture_1 = require("./capture");
90
92
  Object.defineProperty(exports, "captureScreenshot", { enumerable: true, get: function () { return capture_1.captureScreenshot; } });
93
+ Object.defineProperty(exports, "pickFeedbackFile", { enumerable: true, get: function () { return capture_1.pickFeedbackFile; } });
91
94
  Object.defineProperty(exports, "startVideoRecording", { enumerable: true, get: function () { return capture_1.startVideoRecording; } });
92
95
  Object.defineProperty(exports, "stopVideoRecording", { enumerable: true, get: function () { return capture_1.stopVideoRecording; } });
93
96
  Object.defineProperty(exports, "isVideoRecording", { enumerable: true, get: function () { return capture_1.isVideoRecording; } });
package/dist/types.d.ts CHANGED
@@ -48,7 +48,7 @@ export interface FeedbackConfig {
48
48
  * Single tap → open the feedback modal; long-press → menu with
49
49
  * "Hide icon" (persisted across launches via AsyncStorage).
50
50
  *
51
- * - `'auto'` (default) → `'always'` on iOS/Android, `'off'` on web.
51
+ * - `'auto'` (default) → `'after-shake'` on iOS/Android, `'off'` on web.
52
52
  * - `'always'` → visible from app launch.
53
53
  * - `'after-shake'` → hidden until the first shake this session.
54
54
  * - `'off'` → never rendered. Shake still works.
@@ -59,11 +59,34 @@ export interface FeedbackConfig {
59
59
  */
60
60
  quickIcon?: 'auto' | 'always' | 'after-shake' | 'off';
61
61
  /**
62
- * Background color for the quick-action icon. Default: '#6366f1'
63
- * (indigo). Pick something distinctive so the icon never visually
64
- * collides with your own FAB.
62
+ * Deprecated alias for `quickIconBackgroundColor`.
63
+ *
64
+ * Background color for the quick-action icon. The SDK now defaults
65
+ * to a high-visibility safety orange so the icon reads as a utility
66
+ * affordance instead of blending into the common blue/indigo FAB
67
+ * palette many mobile apps already use.
65
68
  */
66
69
  quickIconColor?: string;
70
+ /**
71
+ * Background color for the quick-action icon.
72
+ * Default: '#ff6b2c' (safety orange).
73
+ */
74
+ quickIconBackgroundColor?: string;
75
+ /**
76
+ * Foreground/text color for the quick-action icon label.
77
+ * Default: '#111111'.
78
+ */
79
+ quickIconForegroundColor?: string;
80
+ /**
81
+ * Border color for the quick-action icon.
82
+ * Default: 'rgba(255,255,255,0.92)'.
83
+ */
84
+ quickIconBorderColor?: string;
85
+ /**
86
+ * Shadow color for the quick-action icon.
87
+ * Default: '#000000'.
88
+ */
89
+ quickIconShadowColor?: string;
67
90
  /**
68
91
  * Initial position of the quick-action icon, in pixels from the
69
92
  * top-left. Default: near the top-right corner of the screen. The
@@ -191,6 +214,8 @@ export interface FeedbackBundle {
191
214
  metadata: FeedbackMetadata;
192
215
  /** Screen-recording file path, when produced by the "Start Recording" action. */
193
216
  video?: string;
217
+ /** Optional audio attachment path. */
218
+ audio?: string;
194
219
  screenshots: string[];
195
220
  /** Captured errors with stack traces, attached via attachError / wrapErrorHandler. */
196
221
  errors?: CapturedError[];
package/dist/upload.d.ts CHANGED
@@ -6,6 +6,7 @@ import { FeedbackBundle } from './types';
6
6
  * - `metadata` (JSON string)
7
7
  * - `screenshot_0`, `screenshot_1`, ... (image files)
8
8
  * - `video` (video file, if present)
9
+ * - `audio` (audio file, if present)
9
10
  *
10
11
  * Returns the parsed agent response — typically `{ ok, id, reportId }`.
11
12
  * Callers can inspect `.id` / `.reportId` to drive a follow-up
package/dist/upload.js CHANGED
@@ -9,6 +9,7 @@ const react_native_1 = require("react-native");
9
9
  * - `metadata` (JSON string)
10
10
  * - `screenshot_0`, `screenshot_1`, ... (image files)
11
11
  * - `video` (video file, if present)
12
+ * - `audio` (audio file, if present)
12
13
  *
13
14
  * Returns the parsed agent response — typically `{ ok, id, reportId }`.
14
15
  * Callers can inspect `.id` / `.reportId` to drive a follow-up
@@ -35,6 +36,13 @@ async function uploadFeedback(agentUrl, authToken, bundle) {
35
36
  name: 'screen_recording.mp4',
36
37
  });
37
38
  }
39
+ if (bundle.audio) {
40
+ formData.append('audio', {
41
+ uri: react_native_1.Platform.OS === 'android' ? `file://${bundle.audio}` : bundle.audio,
42
+ type: 'audio/m4a',
43
+ name: 'voice_note.m4a',
44
+ });
45
+ }
38
46
  const url = agentUrl.replace(/\/$/, '') + '/feedback';
39
47
  const response = await fetch(url, {
40
48
  method: 'POST',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaver-feedback-react-native",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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",
@@ -22,7 +22,8 @@
22
22
  "react-native": ">=0.70.0",
23
23
  "@react-native-async-storage/async-storage": ">=1.17.0",
24
24
  "expo-web-browser": ">=12.0.0",
25
- "expo-apple-authentication": ">=6.0.0"
25
+ "expo-apple-authentication": ">=6.0.0",
26
+ "expo-document-picker": ">=13.0.0"
26
27
  },
27
28
  "peerDependenciesMeta": {
28
29
  "@expo/config-plugins": {
@@ -33,6 +34,9 @@
33
34
  },
34
35
  "expo-apple-authentication": {
35
36
  "optional": true
37
+ },
38
+ "expo-document-picker": {
39
+ "optional": true
36
40
  }
37
41
  },
38
42
  "devDependencies": {