@alliance-droid/status-feedback-system 1.4.0 → 2.0.0
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- `userEmail` prop on `DevFeedback` is now **required** (was optional). Pass the authenticated user's email; pass an empty string when no user is signed in.
|
|
8
|
+
- Widget renders nothing (no bubble, no context menu) when `userEmail` is empty. The previous lock-screen UI for unauthenticated users is removed.
|
|
9
|
+
- Anonymous feedback submission is no longer possible through the widget.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Dev-mode console warning when `userEmail` is empty, to surface misconfigurations in consumer apps.
|
|
14
|
+
|
|
3
15
|
## 1.3.0
|
|
4
16
|
|
|
5
17
|
- Add composable FeedbackBoard components (FeedbackSidebar, FeedbackList, FeedbackItem, FeedbackDetail, FeedbackSubmitForm)
|
|
@@ -31,8 +31,14 @@
|
|
|
31
31
|
showOnboarding?: boolean;
|
|
32
32
|
/** URL to the feedback board page. If omitted, "View Open Issues" is hidden from the context menu. */
|
|
33
33
|
boardUrl?: string;
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Authenticated user email. Required.
|
|
36
|
+
*
|
|
37
|
+
* Pass an empty string when the user is not signed in — the widget will
|
|
38
|
+
* render nothing (no floating bubble, no menu, no form). Anonymous
|
|
39
|
+
* feedback is not supported.
|
|
40
|
+
*/
|
|
41
|
+
userEmail: string;
|
|
36
42
|
/**
|
|
37
43
|
* Custom screenshot provider. When supplied, this is called instead of
|
|
38
44
|
* the default html2canvas client-side capture. Use this to delegate
|
|
@@ -54,6 +60,21 @@
|
|
|
54
60
|
screenshotProvider,
|
|
55
61
|
}: Props = $props();
|
|
56
62
|
|
|
63
|
+
// Dev-mode warning when userEmail is empty
|
|
64
|
+
$effect(() => {
|
|
65
|
+
if (!userEmail && typeof console !== 'undefined') {
|
|
66
|
+
// eslint-disable-next-line no-restricted-globals -- safe typeof guard for universal code
|
|
67
|
+
const proc = typeof globalThis !== 'undefined' ? (globalThis as Record<string, unknown>).process as { env?: Record<string, string> } | undefined : undefined;
|
|
68
|
+
const env = proc?.env?.NODE_ENV || 'development';
|
|
69
|
+
if (env !== 'production') {
|
|
70
|
+
console.warn(
|
|
71
|
+
'[status-feedback-system] <DevFeedback> was rendered with an empty userEmail. ' +
|
|
72
|
+
"The widget will not appear. Pass the authenticated user's email, or do not render <DevFeedback> when no user is signed in.",
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
57
78
|
// --- Client (lazy, stable) ---
|
|
58
79
|
let client: StatusClient | null = $state(null);
|
|
59
80
|
let lastApiUrl = '';
|
|
@@ -70,6 +91,7 @@
|
|
|
70
91
|
|
|
71
92
|
// --- Environment gate ---
|
|
72
93
|
let isEnabled = $state(false);
|
|
94
|
+
let hasUserEmail = $derived(!!userEmail);
|
|
73
95
|
|
|
74
96
|
// --- State ---
|
|
75
97
|
let menuOpen = $state(false);
|
|
@@ -125,7 +147,7 @@
|
|
|
125
147
|
let formTitle = $state('');
|
|
126
148
|
let formMessage = $state('');
|
|
127
149
|
|
|
128
|
-
|
|
150
|
+
|
|
129
151
|
let submitting = $state(false);
|
|
130
152
|
let submitResult = $state<'success' | 'error' | null>(null);
|
|
131
153
|
|
|
@@ -171,7 +193,7 @@
|
|
|
171
193
|
const ONBOARDING_KEY = 'sf-devfeedback-onboarded';
|
|
172
194
|
|
|
173
195
|
onMount(() => {
|
|
174
|
-
isEnabled = detectEnvironment(enabled);
|
|
196
|
+
isEnabled = detectEnvironment(enabled) && !!userEmail;
|
|
175
197
|
if (!isEnabled) return;
|
|
176
198
|
|
|
177
199
|
// Hook console.error
|
|
@@ -258,7 +280,7 @@
|
|
|
258
280
|
}
|
|
259
281
|
|
|
260
282
|
async function handleSubmit() {
|
|
261
|
-
if (!formMessage.trim() || !
|
|
283
|
+
if (!formMessage.trim() || !hasUserEmail) return;
|
|
262
284
|
submitting = true;
|
|
263
285
|
submitResult = null;
|
|
264
286
|
|
|
@@ -381,11 +403,6 @@
|
|
|
381
403
|
{formType === 'bug' ? "We'll look into this." : "Thanks for the suggestion!"}
|
|
382
404
|
</p>
|
|
383
405
|
</div>
|
|
384
|
-
{:else if !isAuthenticated}
|
|
385
|
-
<div class="text-center py-6 text-foreground-tertiary">
|
|
386
|
-
<i class="fa-solid fa-lock text-2xl" aria-hidden="true"></i>
|
|
387
|
-
<p class="mt-2 text-sm">Sign in to submit feedback</p>
|
|
388
|
-
</div>
|
|
389
406
|
{:else}
|
|
390
407
|
<div class="flex items-center gap-1.5 text-xs text-foreground-tertiary">
|
|
391
408
|
<i class="fa-solid fa-user" aria-hidden="true"></i>
|
|
@@ -482,7 +499,7 @@
|
|
|
482
499
|
</div>
|
|
483
500
|
|
|
484
501
|
<!-- Footer -->
|
|
485
|
-
{#if submitResult !== 'success' &&
|
|
502
|
+
{#if submitResult !== 'success' && hasUserEmail}
|
|
486
503
|
<div class="flex justify-end gap-2 px-5 py-4 border-t border-border shrink-0">
|
|
487
504
|
<Button variant="neutral" style="outline" onclick={() => (formOpen = false)}>
|
|
488
505
|
Cancel
|
|
@@ -10,8 +10,14 @@ interface Props {
|
|
|
10
10
|
showOnboarding?: boolean;
|
|
11
11
|
/** URL to the feedback board page. If omitted, "View Open Issues" is hidden from the context menu. */
|
|
12
12
|
boardUrl?: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Authenticated user email. Required.
|
|
15
|
+
*
|
|
16
|
+
* Pass an empty string when the user is not signed in — the widget will
|
|
17
|
+
* render nothing (no floating bubble, no menu, no form). Anonymous
|
|
18
|
+
* feedback is not supported.
|
|
19
|
+
*/
|
|
20
|
+
userEmail: string;
|
|
15
21
|
/**
|
|
16
22
|
* Custom screenshot provider. When supplied, this is called instead of
|
|
17
23
|
* the default html2canvas client-side capture. Use this to delegate
|
package/package.json
CHANGED