yaver-feedback-react-native 0.7.17 → 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.
- package/README.md +40 -6
- package/dist/FeedbackModal.js +259 -203
- package/dist/P2PClient.js +7 -0
- package/dist/QuickActionIcon.d.ts +43 -0
- package/dist/QuickActionIcon.js +324 -0
- package/dist/YaverFeedback.d.ts +26 -0
- package/dist/YaverFeedback.js +62 -0
- package/dist/capture.d.ts +11 -0
- package/dist/capture.js +59 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.js +16 -7
- package/dist/preferences.d.ts +18 -0
- package/dist/preferences.js +57 -0
- package/dist/types.d.ts +56 -0
- package/dist/upload.d.ts +1 -0
- package/dist/upload.js +8 -0
- package/package.json +6 -2
- package/src/FeedbackModal.tsx +311 -243
- package/src/P2PClient.ts +8 -0
- package/src/QuickActionIcon.tsx +375 -0
- package/src/YaverFeedback.ts +69 -0
- package/src/capture.ts +74 -0
- package/src/index.ts +16 -6
- package/src/preferences.ts +55 -0
- package/src/types.ts +53 -0
- package/src/upload.ts +9 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SDK user preferences persisted across launches.
|
|
4
|
+
*
|
|
5
|
+
* Currently only the quick-action icon's user-level dismiss flag
|
|
6
|
+
* lives here: the dev enables the icon via `FeedbackConfig.quickIcon`,
|
|
7
|
+
* but the *user* can long-press → Hide to opt out, and we remember
|
|
8
|
+
* that choice across launches so their next app session still
|
|
9
|
+
* respects it.
|
|
10
|
+
*
|
|
11
|
+
* AsyncStorage is an optional peer dep — if it's not installed the
|
|
12
|
+
* getters return `false` and the setters silently no-op, so the icon
|
|
13
|
+
* still works (it just can't remember the disable beyond the
|
|
14
|
+
* in-memory session).
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getQuickIconDisabled = getQuickIconDisabled;
|
|
18
|
+
exports.setQuickIconDisabled = setQuickIconDisabled;
|
|
19
|
+
exports.clearQuickIconDisabled = clearQuickIconDisabled;
|
|
20
|
+
let AsyncStorage = null;
|
|
21
|
+
try {
|
|
22
|
+
AsyncStorage = require('@react-native-async-storage/async-storage').default;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// not installed — degrade gracefully
|
|
26
|
+
}
|
|
27
|
+
const QUICK_ICON_DISABLED_KEY = 'yaver_feedback_quickicon_disabled';
|
|
28
|
+
/** True if the user has long-pressed the icon and chosen "Hide". */
|
|
29
|
+
async function getQuickIconDisabled() {
|
|
30
|
+
if (!AsyncStorage)
|
|
31
|
+
return false;
|
|
32
|
+
try {
|
|
33
|
+
const v = await AsyncStorage.getItem(QUICK_ICON_DISABLED_KEY);
|
|
34
|
+
return v === '1';
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function setQuickIconDisabled(disabled) {
|
|
41
|
+
if (!AsyncStorage)
|
|
42
|
+
return;
|
|
43
|
+
try {
|
|
44
|
+
if (disabled) {
|
|
45
|
+
await AsyncStorage.setItem(QUICK_ICON_DISABLED_KEY, '1');
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
await AsyncStorage.removeItem(QUICK_ICON_DISABLED_KEY);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// best-effort
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function clearQuickIconDisabled() {
|
|
56
|
+
await setQuickIconDisabled(false);
|
|
57
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -42,6 +42,60 @@ export interface FeedbackConfig {
|
|
|
42
42
|
preferredDeviceId?: string;
|
|
43
43
|
/** How feedback collection is triggered */
|
|
44
44
|
trigger?: 'shake' | 'floating-button' | 'manual';
|
|
45
|
+
/**
|
|
46
|
+
* Small tap-to-open icon that floats above the app so the user
|
|
47
|
+
* doesn't have to shake every time they want to open feedback.
|
|
48
|
+
* Single tap → open the feedback modal; long-press → menu with
|
|
49
|
+
* "Hide icon" (persisted across launches via AsyncStorage).
|
|
50
|
+
*
|
|
51
|
+
* - `'auto'` (default) → `'after-shake'` on iOS/Android, `'off'` on web.
|
|
52
|
+
* - `'always'` → visible from app launch.
|
|
53
|
+
* - `'after-shake'` → hidden until the first shake this session.
|
|
54
|
+
* - `'off'` → never rendered. Shake still works.
|
|
55
|
+
*
|
|
56
|
+
* The user can always override `'always'` / `'auto'` by long-pressing
|
|
57
|
+
* → Hide. Devs can clear that override via
|
|
58
|
+
* `YaverFeedback.resetQuickIconPreference()`.
|
|
59
|
+
*/
|
|
60
|
+
quickIcon?: 'auto' | 'always' | 'after-shake' | 'off';
|
|
61
|
+
/**
|
|
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.
|
|
68
|
+
*/
|
|
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;
|
|
90
|
+
/**
|
|
91
|
+
* Initial position of the quick-action icon, in pixels from the
|
|
92
|
+
* top-left. Default: near the top-right corner of the screen. The
|
|
93
|
+
* icon is draggable at runtime — this is only the first mount.
|
|
94
|
+
*/
|
|
95
|
+
quickIconInitialPosition?: {
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
};
|
|
45
99
|
/** Enable/disable the SDK. Defaults to __DEV__ */
|
|
46
100
|
enabled?: boolean;
|
|
47
101
|
/**
|
|
@@ -160,6 +214,8 @@ export interface FeedbackBundle {
|
|
|
160
214
|
metadata: FeedbackMetadata;
|
|
161
215
|
/** Screen-recording file path, when produced by the "Start Recording" action. */
|
|
162
216
|
video?: string;
|
|
217
|
+
/** Optional audio attachment path. */
|
|
218
|
+
audio?: string;
|
|
163
219
|
screenshots: string[];
|
|
164
220
|
/** Captured errors with stack traces, attached via attachError / wrapErrorHandler. */
|
|
165
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.
|
|
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": {
|