@alliance-droid/status-feedback-system 4.1.5 → 4.2.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,4 +1,21 @@
1
- # Changelog
1
+ # Changelog
2
+
3
+ ## 4.2.0
4
+
5
+ ### Added
6
+
7
+ - Added `@alliance-droid/status-feedback-system/sveltekit/server`, a server-only SvelteKit proxy adapter that lets consuming apps keep the project API key in private server environment variables. The adapter maps the package's existing `/api/...` client paths to `status-feedback-admin`, injects the private `x-api-key`, strips browser `key` query params, validates request bodies, forwards bearer tokens for privileged status endpoints, and can derive feedback `email` / response `author` from the host app's authenticated user.
8
+
9
+ ### Changed
10
+
11
+ - `apiKey` is now optional for `createStatusClient`, `StatusPage`, `StatusBanner`, `FeedbackForm`, `FeedbackButton`, `DevFeedback`, and `createFeedbackBoard`. When omitted, the client no longer appends `?key=...`, which enables same-origin proxy mode with `apiUrl="/svc/feedback"`.
12
+ - Updated README and integration docs to make the SvelteKit proxy the recommended hardened default. Direct admin calls with an embedded project key remain supported for existing consumers.
13
+
14
+ ## 4.1.6
15
+
16
+ ### Fixed
17
+
18
+ - Board status badges: for privileged viewers (Admin / ProductOwner), **every** item now shows its real internal status (e.g. "QA / UAT"), not just the first one. Previously the list badge derived its label solely from the per-item transitions cache, which is only populated lazily (on menu open) plus a one-time privilege probe of `items[0]` — so exactly the first item showed its real status and the rest stayed on the coarse public projection ("In progress"). The badge now derives the privileged label from each item's own `status` (already present on every board item) via a new `internalStatusLabel`, so all rows resolve consistently once privilege is confirmed. Non-privileged viewers are unchanged (they still see the public status bucket).
2
19
 
3
20
  ## 4.1.5
4
21
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Drop-in system status pages and user feedback components for SvelteKit apps.
4
4
 
5
- This is the **client package** — UI components that talk to a [status-feedback-admin](https://alliance.ghe.com/alliance/status-feedback-admin) backend via API. The admin app handles data storage, API key management, and the admin dashboard.
5
+ This package provides UI components plus an optional SvelteKit server proxy for talking to a [status-feedback-admin](https://alliance.ghe.com/alliance/status-feedback-admin) backend. The admin app handles data storage, API key management, and the admin dashboard.
6
6
 
7
7
  ## Architecture
8
8
 
@@ -38,35 +38,66 @@ AZURE_FEEDBACK_BLOB_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName
38
38
  AZURE_FEEDBACK_BLOB_CONTAINER=screenshots
39
39
  ```
40
40
 
41
- ### 2. Create a project and get an API key
42
-
43
- Log into the admin dashboard, create a project, and copy its API key (prefixed `sf_`).
44
-
45
- ### 3. Install the client package
46
-
47
- ```bash
48
- npm install @alliance-droid/status-feedback-system
49
- ```
50
-
51
- **Peer dependencies:** `svelte ^5.0.0`, `@alliance-droid/svelte-component-library >=1.0.0`
41
+ ### 2. Create a project and keep the API key server-side
42
+
43
+ Log into the admin dashboard, create a project, and copy its API key (prefixed `sf_`). Store it in a private server-side environment variable, not a `PUBLIC_` / browser-delivered variable.
44
+
45
+ ### 3. Install the client package
46
+
47
+ ```bash
48
+ npm install @alliance-droid/status-feedback-system
49
+ ```
50
+
51
+ **Peer dependencies:** `svelte ^5.48.0`, `@alliance-droid/svelte-component-library >=1.3.2`
52
+
53
+ > `@alliance-droid/svelte-component-library` must be `>=1.3.2` — earlier versions are incompatible with Svelte `5.56+` and throw `target.exclude.has is not a function` when board components render.
54
+
55
+ ### 4. Add the recommended SvelteKit proxy
56
+
57
+ Use one catch-all route in the consuming app. The package owns the admin API path mapping, request validation, key injection, and `key` query stripping; the app owns auth and app-specific policy.
58
+
59
+ ```ts
60
+ // src/routes/svc/feedback/[...path]/+server.ts
61
+ import { env } from '$env/dynamic/private';
62
+ import { createSvelteKitFeedbackProxy } from '@alliance-droid/status-feedback-system/sveltekit/server';
63
+
64
+ export const { GET, POST, PATCH } = createSvelteKitFeedbackProxy({
65
+ apiUrl: env.SF_API_URL,
66
+ apiKey: env.SF_API_KEY,
67
+ resolveUser: async (event) => {
68
+ const user = event.locals.user;
69
+ return user ? { email: user.email, roles: user.roles } : null;
70
+ },
71
+ requireUser: true,
72
+ canSubmitInAppFeedback: ({ user }) =>
73
+ user.roles.includes('QA') || user.roles.includes('ProductOwner'),
74
+ });
75
+ ```
76
+
77
+ Then point components at the same-origin route and omit `apiKey`:
78
+
79
+ ```svelte
80
+ <DevFeedback apiUrl="/svc/feedback/dev" enabled={canSubmitFeedback} userEmail={user.email} />
81
+ ```
82
+
83
+ Direct admin calls with `apiKey="sf_..."` remain supported for existing integrations, but the proxy is the hardened default.
52
84
 
53
85
  ## Components
54
86
 
55
87
  ### StatusPage
56
88
 
57
- Full status page with systems, incidents, and uptime history bars. Supports **self-fetching** (provide `apiUrl` + `apiKey`) or **pass-through** (provide data directly).
89
+ Full status page with systems, incidents, and uptime history bars. Supports **self-fetching** (provide `apiUrl`; add `apiKey` only for direct admin calls) or **pass-through** (provide data directly).
58
90
 
59
91
  ```svelte
60
92
  <script>
61
93
  import { StatusPage } from '@alliance-droid/status-feedback-system';
62
94
  </script>
63
95
 
64
- <!-- Self-fetching mode -->
65
- <StatusPage
66
- projectName="My App"
67
- apiUrl="https://status-admin.example.com"
68
- apiKey="sf_abc123..."
69
- />
96
+ <!-- Self-fetching through the same-origin proxy -->
97
+ <StatusPage
98
+ projectName="My App"
99
+ apiUrl="/svc/feedback"
100
+ />
70
101
 
71
102
  <!-- Pass-through mode -->
72
103
  <StatusPage
@@ -81,8 +112,8 @@ Full status page with systems, incidents, and uptime history bars. Supports **se
81
112
  | Prop | Type | Default | Description |
82
113
  |------|------|---------|-------------|
83
114
  | `projectName` | `string` | required | Display name in the header |
84
- | `apiUrl` | `string` | — | Admin backend URL (self-fetching mode) |
85
- | `apiKey` | `string` | — | Project API key (self-fetching mode) |
115
+ | `apiUrl` | `string` | — | Proxy URL or direct admin backend URL (self-fetching mode) |
116
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
86
117
  | `systems` | `System[]` | — | Pass-through: system data |
87
118
  | `incidents` | `Incident[]` | — | Pass-through: incident data |
88
119
  | `statusHistory` | `Record<string, StatusHistoryEntry[]>` | — | Pass-through: uptime data |
@@ -93,18 +124,17 @@ Full status page with systems, incidents, and uptime history bars. Supports **se
93
124
  Compact inline status indicator — good for footers or nav bars.
94
125
 
95
126
  ```svelte
96
- <StatusBanner
97
- apiUrl="https://status-admin.example.com"
98
- apiKey="sf_abc123..."
99
- statusUrl="/status"
100
- />
127
+ <StatusBanner
128
+ apiUrl="/svc/feedback"
129
+ statusUrl="/status"
130
+ />
101
131
  ```
102
132
 
103
133
  | Prop | Type | Default | Description |
104
134
  |------|------|---------|-------------|
105
135
  | `systems` | `System[]` | — | Pass-through mode |
106
- | `apiUrl` | `string` | — | Self-fetching mode |
107
- | `apiKey` | `string` | — | Self-fetching mode |
136
+ | `apiUrl` | `string` | — | Proxy URL or direct admin backend URL |
137
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
108
138
  | `statusUrl` | `string` | — | Links to full status page (renders as `<a>`) |
109
139
 
110
140
  ### FeedbackButton
@@ -112,19 +142,18 @@ Compact inline status indicator — good for footers or nav bars.
112
142
  Floating action button with an embedded feedback form. Fixed position, bottom corner.
113
143
 
114
144
  ```svelte
115
- <FeedbackButton
116
- apiKey="sf_abc123..."
117
- apiUrl="https://status-admin.example.com"
118
- position="bottom-right"
119
- categories={['Bug', 'Feature Request', 'General']}
120
- userEmail={currentUser?.email}
145
+ <FeedbackButton
146
+ apiUrl="/svc/feedback"
147
+ position="bottom-right"
148
+ categories={['Bug', 'Feature Request', 'General']}
149
+ userEmail={currentUser?.email}
121
150
  />
122
151
  ```
123
152
 
124
153
  | Prop | Type | Default | Description |
125
154
  |------|------|---------|-------------|
126
- | `apiUrl` | `string` | required | Admin backend URL |
127
- | `apiKey` | `string` | required | Project API key |
155
+ | `apiUrl` | `string` | required | Proxy URL or direct admin backend URL |
156
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
128
157
  | `categories` | `string[]` | `['Bug', 'Feature Request', 'General']` | Category options |
129
158
  | `userEmail` | `string` | — | Pre-fill email field |
130
159
  | `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Button position |
@@ -134,11 +163,10 @@ Floating action button with an embedded feedback form. Fixed position, bottom co
134
163
  Standalone feedback form — embed it wherever you need it.
135
164
 
136
165
  ```svelte
137
- <FeedbackForm
138
- apiKey="sf_abc123..."
139
- apiUrl="https://status-admin.example.com"
140
- categories={['Bug', 'Feature Request']}
141
- userEmail={currentUser?.email}
166
+ <FeedbackForm
167
+ apiUrl="/svc/feedback"
168
+ categories={['Bug', 'Feature Request']}
169
+ userEmail={currentUser?.email}
142
170
  onSuccess={() => toast('Thanks!')}
143
171
  onError={(msg) => toast(msg, 'error')}
144
172
  />
@@ -146,8 +174,8 @@ Standalone feedback form — embed it wherever you need it.
146
174
 
147
175
  | Prop | Type | Default | Description |
148
176
  |------|------|---------|-------------|
149
- | `apiUrl` | `string` | required | Admin backend URL |
150
- | `apiKey` | `string` | required | Project API key |
177
+ | `apiUrl` | `string` | required | Proxy URL or direct admin backend URL |
178
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
151
179
  | `categories` | `string[]` | `['Bug', 'Feature Request', 'General']` | Category options |
152
180
  | `userEmail` | `string` | — | Pre-fill email field |
153
181
  | `onSuccess` | `() => void` | — | Called after successful submission |
@@ -171,12 +199,11 @@ The board is composed from parts around **one shared state** (`createFeedbackBoa
171
199
  type BoardItem,
172
200
  } from '@alliance-droid/status-feedback-system';
173
201
 
174
- let { data } = $props();
175
- const board = createFeedbackBoard({
176
- apiUrl: 'https://status-admin.example.com',
177
- apiKey: 'sf_abc123...',
178
- userEmail: data.user?.email,
179
- getAuthToken: createAuthTokenGetter(), // optional — enables status management
202
+ let { data } = $props();
203
+ const board = createFeedbackBoard({
204
+ apiUrl: '/svc/feedback',
205
+ userEmail: data.user?.email,
206
+ getAuthToken: createAuthTokenGetter(), // optional — enables status management
180
207
  categoryConfig: {
181
208
  Bug: { icon: 'fa-solid fa-bug', label: 'Bugs' },
182
209
  'Feature Request': { icon: 'fa-solid fa-lightbulb', label: 'Ideas' },
@@ -198,8 +225,8 @@ The board is composed from parts around **one shared state** (`createFeedbackBoa
198
225
 
199
226
  | Option | Type | Default | Description |
200
227
  |--------|------|---------|-------------|
201
- | `apiUrl` | `string` | required | Admin backend URL |
202
- | `apiKey` | `string` | required | Project API key (`sf_…`) |
228
+ | `apiUrl` | `string` | required | Proxy URL or direct admin backend URL |
229
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
203
230
  | `userEmail` | `string` | — | Authenticated user (required to submit feedback/replies) |
204
231
  | `categoryConfig` | `Record<string, { label?, icon?, description? }>` | `{}` | Relabel / add icons to sidebar categories |
205
232
  | `getAuthToken` | `() => string \| Promise<string \| null>` | — | Bearer token so privileged users can set status (see below) |
@@ -209,16 +236,18 @@ Exported parts: `createFeedbackBoard`, `FeedbackSidebar`, `FeedbackList`, `Feedb
209
236
 
210
237
  Categories are fixed by the system (**Bug**, **Feature Request**) — `categoryConfig` only relabels or adds icons.
211
238
 
212
- #### Setting status (Admin / ProductOwner)
239
+ #### Setting status (ProductOwner)
240
+
241
+ When you pass `getAuthToken`, a signed-in **ProductOwner** with access to the project can change an item's status from the board (via the status badge → menu) — e.g. Open → Considering → Accepted, or a decline with a reason — without a trip to the admin dashboard. Board status management is **ProductOwner-only**; an Admin role alone does not grant it (Admins still manage status from the dashboard).
213
242
 
214
- When you pass `getAuthToken`, a signed-in **Admin** or **ProductOwner** can change an item's status from the board (via the status badge → menu) — Open → Considering → Accepted, or a decline with a reason — no trip to the admin dashboard.
243
+ Privileged viewers also see each item's **real internal status** on the badge (e.g. "QA / UAT", "Technical review") rather than the coarse public bucket ("In progress") that everyone else sees.
215
244
 
216
- - `getAuthToken` must return the user's **Alliance OIDC access token** whose audience covers **`status-feedback-admin`** (an *id token*, whose `aud` is your app's client id, is rejected). It's called on demand; return `null` for anonymous / non-privileged users and the control simply won't appear.
245
+ - `getAuthToken` must return the user's **Alliance OIDC access token** whose audience covers **`status-feedback-admin`** (an *id token*, whose `aud` is your app's client id, is rejected). It's called on demand; return `null` for anonymous / non-privileged users and the control simply won't appear — the badge stays a plain read-only badge.
217
246
  - **Use the built-in `createAuthTokenGetter()`** for this — it fetches a same-origin token endpoint (`/auth/access-token` by default), caches until just before expiry, single-flights, and returns `null` on any failure. With `@alliance-droid/svelte-auth-core`, set `enableAccessTokenEndpoint: true` and request the `status-feedback-admin` scope so that endpoint exists. Create one instance at module level: `export const getAuthToken = createAuthTokenGetter();`
218
- - The token travels as `Authorization: Bearer …` to the admin backend, which **verifies it against the IdP** and derives the user's roles. Authorization (per-project access + which transitions a role may make, including reason prompts on declines/reopens) is enforced **server-side** by the same logic as the dashboard — the client never decides permissions.
247
+ - The token travels as `Authorization: Bearer …` to the admin backend, which **verifies it against the IdP** and derives the user's roles. Authorization (ProductOwner role + per-project access + which transitions are allowed, including reason prompts on declines/reopens) is enforced **server-side** — the client never decides permissions. The backend returns a `canManage` flag (HTTP 200, not 403) so ordinary signed-in users get no console noise.
219
248
  - The available transitions are returned by the backend per item, so the menu always reflects exactly what that user may do.
220
249
 
221
- > Security note: the project `apiKey` alone never grants status changes — it only identifies the project. Every mutation additionally requires a valid IdP token, so the public board key stays safe to embed.
250
+ > Security note: use the SvelteKit proxy to keep the project `apiKey` out of browser-delivered code. Direct admin calls with an embedded key are still supported for existing integrations, but same-origin proxy mode is the recommended default.
222
251
 
223
252
  ### DevFeedback
224
253
 
@@ -234,19 +263,18 @@ Auto-captures: screenshots (via html2canvas), console errors, viewport size, cur
234
263
  </script>
235
264
 
236
265
  <!-- In your root +layout.svelte -->
237
- <DevFeedback
238
- apiUrl="https://status-admin.example.com"
239
- apiKey="sf_abc123..."
240
- boardUrl="/feedback"
241
- userEmail={user?.email ?? ''}
242
- enabled={userCanGiveFeedback}
266
+ <DevFeedback
267
+ apiUrl="/svc/feedback/dev"
268
+ boardUrl="/feedback"
269
+ userEmail={user?.email ?? ''}
270
+ enabled={userCanGiveFeedback}
243
271
  />
244
272
  ```
245
273
 
246
274
  | Prop | Type | Default | Description |
247
275
  |------|------|---------|-------------|
248
- | `apiUrl` | `string` | required | Admin backend URL |
249
- | `apiKey` | `string` | required | Project API key |
276
+ | `apiUrl` | `string` | required | Proxy URL or direct admin backend URL. Use `/svc/feedback/dev` with the package proxy for stricter widget policy. |
277
+ | `apiKey` | `string` | — | Project API key; omit when using the same-origin proxy |
250
278
  | `enabled` | `boolean` | required | The only gate — wire to your role/permission check |
251
279
  | `userEmail` | `string` | required | Signed-in user's email. Empty string ⇒ renders nothing (anonymous feedback unsupported) |
252
280
  | `boardUrl` | `string` | — | URL for "View Open Issues" link. Hidden if omitted. |
@@ -263,11 +291,10 @@ All components use a shared API client. You can also use it directly:
263
291
  ```typescript
264
292
  import { createStatusClient } from '@alliance-droid/status-feedback-system';
265
293
 
266
- const client = createStatusClient({
267
- apiUrl: 'https://status-admin.example.com',
268
- apiKey: 'sf_abc123...',
269
- fetch: event.fetch, // Optional: pass SvelteKit's fetch for SSR
270
- });
294
+ const client = createStatusClient({
295
+ apiUrl: '/svc/feedback',
296
+ fetch: event.fetch, // Optional: pass SvelteKit's fetch for SSR
297
+ });
271
298
 
272
299
  const { systems, overallStatus } = await client.getStatus();
273
300
  const { incidents } = await client.getIncidents({ limit: 5, includeResolved: true });
@@ -309,15 +336,27 @@ import type {
309
336
  AuthTokenGetter, AuthTokenGetterOptions,
310
337
  } from '@alliance-droid/status-feedback-system';
311
338
 
312
- // API Client
313
- import { createStatusClient } from '@alliance-droid/status-feedback-system';
314
- import type { StatusClient, StatusClientConfig } from '@alliance-droid/status-feedback-system';
339
+ // API Client
340
+ import { createStatusClient } from '@alliance-droid/status-feedback-system';
341
+ import type {
342
+ StatusClient, StatusClientConfig,
343
+ StatusData, IncidentData, UptimeData, BoardData, BoardItem, BoardCategory,
344
+ } from '@alliance-droid/status-feedback-system';
345
+
346
+ // SvelteKit server proxy
347
+ import {
348
+ createSvelteKitFeedbackProxy,
349
+ isFeedbackProxyConfigured,
350
+ } from '@alliance-droid/status-feedback-system/sveltekit/server';
351
+
352
+ // Utilities
353
+ import { deriveOverallStatus } from '@alliance-droid/status-feedback-system';
315
354
 
316
355
  // Types
317
356
  import type {
318
- System, Incident, IncidentUpdate, Feedback, FeedbackResponse,
357
+ Project, System, Incident, IncidentUpdate, Feedback, FeedbackResponse,
358
+ FeedbackVisibility, StatusHistoryEntry, ApiResponse,
319
359
  SystemStatus, IncidentStatus, IncidentSeverity, FeedbackStatus,
320
- StatusData, IncidentData, UptimeData, BoardData, BoardItem,
321
360
  } from '@alliance-droid/status-feedback-system';
322
361
  ```
323
362
 
package/dist/api.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * const client = createStatusClient({
8
8
  * apiUrl: 'https://status-admin.yourcompany.com',
9
- * apiKey: 'sf_abc123...',
9
+ * apiKey: 'sf_abc123...', // omit when apiUrl points at a same-origin proxy
10
10
  * });
11
11
  *
12
12
  * const { systems, incidents } = await client.getStatus();
@@ -15,8 +15,8 @@ import type { System, Incident, StatusHistoryEntry, Feedback, FeedbackResponse,
15
15
  export interface StatusClientConfig {
16
16
  /** Base URL of the status-feedback-admin app */
17
17
  apiUrl: string;
18
- /** API key for the project (sf_ prefixed) */
19
- apiKey: string;
18
+ /** API key for direct admin calls. Omit when using a same-origin proxy. */
19
+ apiKey?: string;
20
20
  /** Optional custom fetch function (for SSR) */
21
21
  fetch?: typeof globalThis.fetch;
22
22
  }
package/dist/api.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * const client = createStatusClient({
8
8
  * apiUrl: 'https://status-admin.yourcompany.com',
9
- * apiKey: 'sf_abc123...',
9
+ * apiKey: 'sf_abc123...', // omit when apiUrl points at a same-origin proxy
10
10
  * });
11
11
  *
12
12
  * const { systems, incidents } = await client.getStatus();
@@ -18,8 +18,11 @@ export function createStatusClient(config) {
18
18
  const { apiUrl, apiKey } = config;
19
19
  const fetchFn = config.fetch ?? globalThis.fetch;
20
20
  const baseUrl = apiUrl.replace(/\/$/, '');
21
+ const resolvedApiKey = apiKey?.trim() ?? '';
21
22
  async function request(path, options) {
22
- const url = `${baseUrl}${path}${path.includes('?') ? '&' : '?'}key=${encodeURIComponent(apiKey)}`;
23
+ const url = resolvedApiKey
24
+ ? `${baseUrl}${path}${path.includes('?') ? '&' : '?'}key=${encodeURIComponent(resolvedApiKey)}`
25
+ : `${baseUrl}${path}`;
23
26
  const response = await fetchFn(url, {
24
27
  ...options,
25
28
  headers: {
@@ -20,9 +20,10 @@
20
20
  getElementHtml,
21
21
  } from './dev/environment.js';
22
22
 
23
- interface Props {
24
- apiUrl: string;
25
- apiKey: string;
23
+ interface Props {
24
+ apiUrl: string;
25
+ /** Omit when apiUrl points at a same-origin proxy. */
26
+ apiKey?: string;
26
27
  /**
27
28
  * The sole gate for the widget — wire it to your role/permission check
28
29
  * (e.g. `enabled={userHasFeedbackRole}`). When false, nothing renders and
@@ -51,9 +52,9 @@
51
52
  renderTokenEndpoint?: string;
52
53
  }
53
54
 
54
- let {
55
- apiUrl,
56
- apiKey,
55
+ let {
56
+ apiUrl,
57
+ apiKey = '',
57
58
  enabled,
58
59
  maxConsoleErrors = 20,
59
60
  showOnboarding = true,
@@ -1,6 +1,7 @@
1
1
  interface Props {
2
2
  apiUrl: string;
3
- apiKey: string;
3
+ /** Omit when apiUrl points at a same-origin proxy. */
4
+ apiKey?: string;
4
5
  /**
5
6
  * The sole gate for the widget — wire it to your role/permission check
6
7
  * (e.g. `enabled={userHasFeedbackRole}`). When false, nothing renders and
@@ -1,16 +1,17 @@
1
1
  <script lang="ts">
2
- import FeedbackForm from './FeedbackForm.svelte';
3
-
4
- interface Props {
5
- apiKey: string;
6
- apiUrl: string;
2
+ import FeedbackForm from './FeedbackForm.svelte';
3
+
4
+ interface Props {
5
+ /** Omit when apiUrl points at a same-origin proxy. */
6
+ apiKey?: string;
7
+ apiUrl: string;
7
8
  categories?: string[];
8
9
  userEmail?: string;
9
10
  position?: 'bottom-right' | 'bottom-left';
10
11
  }
11
12
 
12
- let {
13
- apiKey,
13
+ let {
14
+ apiKey = '',
14
15
  apiUrl,
15
16
  categories,
16
17
  userEmail,
@@ -1,5 +1,6 @@
1
1
  interface Props {
2
- apiKey: string;
2
+ /** Omit when apiUrl points at a same-origin proxy. */
3
+ apiKey?: string;
3
4
  apiUrl: string;
4
5
  categories?: string[];
5
6
  userEmail?: string;
@@ -1,18 +1,19 @@
1
1
  <script lang="ts">
2
2
  import { untrack } from 'svelte';
3
- import { createStatusClient, type StatusClient } from '../api.js';
4
-
5
- interface Props {
6
- apiKey: string;
7
- apiUrl: string;
3
+ import { createStatusClient, type StatusClient } from '../api.js';
4
+
5
+ interface Props {
6
+ /** Omit when apiUrl points at a same-origin proxy. */
7
+ apiKey?: string;
8
+ apiUrl: string;
8
9
  categories?: string[];
9
10
  userEmail?: string;
10
11
  onSuccess?: () => void;
11
12
  onError?: (error: string) => void;
12
13
  }
13
14
 
14
- let {
15
- apiKey,
15
+ let {
16
+ apiKey = '',
16
17
  apiUrl,
17
18
  categories = ['Bug', 'Feature Request', 'General'],
18
19
  userEmail,
@@ -1,5 +1,6 @@
1
1
  interface Props {
2
- apiKey: string;
2
+ /** Omit when apiUrl points at a same-origin proxy. */
3
+ apiKey?: string;
3
4
  apiUrl: string;
4
5
  categories?: string[];
5
6
  userEmail?: string;
@@ -10,34 +10,35 @@
10
10
  systems?: System[];
11
11
  /** API URL for self-fetching mode */
12
12
  apiUrl?: string;
13
- /** API key for self-fetching mode */
14
- apiKey?: string;
13
+ /** API key for direct admin calls. Omit when using a same-origin proxy. */
14
+ apiKey?: string;
15
15
  /** Link to full status page */
16
16
  statusUrl?: string;
17
17
  /** Auto-refresh interval in seconds. 0 = disabled. Default: 60 */
18
18
  refreshInterval?: number;
19
19
  }
20
20
 
21
- let { systems: systemsProp, apiUrl, apiKey, statusUrl, refreshInterval = 60 }: Props = $props();
22
-
23
- let systems = $derived(systemsProp ?? []);
24
- let loading = $derived(!systemsProp && !!apiUrl && !!apiKey);
25
- let fetchFailed = $state(false);
26
-
27
- let usesApi = $derived(!systemsProp && !!apiUrl && !!apiKey);
21
+ let { systems: systemsProp, apiUrl, apiKey, statusUrl, refreshInterval = 60 }: Props = $props();
22
+
23
+ let systems = $derived(systemsProp ?? []);
24
+ let loading = $derived(!systemsProp && !!apiUrl);
25
+ let fetchFailed = $state(false);
26
+
27
+ let usesApi = $derived(!systemsProp && !!apiUrl);
28
28
 
29
29
  let cachedClient: StatusClient | null = null;
30
- let cachedApiUrl = '';
31
- let cachedApiKey = '';
32
-
33
- function getClient(): StatusClient {
34
- if (!cachedClient || cachedApiUrl !== apiUrl || cachedApiKey !== apiKey) {
35
- cachedClient = createStatusClient({ apiUrl: apiUrl!, apiKey: apiKey! });
36
- cachedApiUrl = apiUrl!;
37
- cachedApiKey = apiKey!;
38
- }
39
- return cachedClient;
40
- }
30
+ let cachedApiUrl = '';
31
+ let cachedApiKey = '';
32
+
33
+ function getClient(): StatusClient {
34
+ const nextApiKey = apiKey ?? '';
35
+ if (!cachedClient || cachedApiUrl !== apiUrl || cachedApiKey !== nextApiKey) {
36
+ cachedClient = createStatusClient({ apiUrl: apiUrl!, apiKey: nextApiKey });
37
+ cachedApiUrl = apiUrl!;
38
+ cachedApiKey = nextApiKey;
39
+ }
40
+ return cachedClient;
41
+ }
41
42
 
42
43
  async function fetchData() {
43
44
  if (!usesApi) return;
@@ -4,7 +4,7 @@ interface Props {
4
4
  systems?: System[];
5
5
  /** API URL for self-fetching mode */
6
6
  apiUrl?: string;
7
- /** API key for self-fetching mode */
7
+ /** API key for direct admin calls. Omit when using a same-origin proxy. */
8
8
  apiKey?: string;
9
9
  /** Link to full status page */
10
10
  statusUrl?: string;
@@ -12,8 +12,8 @@
12
12
  projectName: string;
13
13
  /** API URL for fetching data (self-fetching mode) */
14
14
  apiUrl?: string;
15
- /** API key for fetching data (self-fetching mode) */
16
- apiKey?: string;
15
+ /** API key for direct admin calls. Omit when using a same-origin proxy. */
16
+ apiKey?: string;
17
17
  /** Systems data (pass-through mode — overrides API fetching) */
18
18
  systems?: System[];
19
19
  /** Incidents data (pass-through mode) */
@@ -44,21 +44,22 @@
44
44
  let error = $state('');
45
45
 
46
46
  // ── Self-fetching mode ──
47
- const usesApi = $derived(!!apiUrl && !!apiKey && !systemsProp);
48
- let refreshTimer: ReturnType<typeof setInterval> | null = null;
47
+ const usesApi = $derived(!!apiUrl && !systemsProp);
48
+ let refreshTimer: ReturnType<typeof setInterval> | null = null;
49
49
 
50
50
  let cachedClient: StatusClient | null = null;
51
- let cachedApiUrl = '';
52
- let cachedApiKey = '';
53
-
54
- function getClient(): StatusClient {
55
- if (!cachedClient || cachedApiUrl !== apiUrl || cachedApiKey !== apiKey) {
56
- cachedClient = createStatusClient({ apiUrl: apiUrl!, apiKey: apiKey! });
57
- cachedApiUrl = apiUrl!;
58
- cachedApiKey = apiKey!;
59
- }
60
- return cachedClient;
61
- }
51
+ let cachedApiUrl = '';
52
+ let cachedApiKey = '';
53
+
54
+ function getClient(): StatusClient {
55
+ const nextApiKey = apiKey ?? '';
56
+ if (!cachedClient || cachedApiUrl !== apiUrl || cachedApiKey !== nextApiKey) {
57
+ cachedClient = createStatusClient({ apiUrl: apiUrl!, apiKey: nextApiKey });
58
+ cachedApiUrl = apiUrl!;
59
+ cachedApiKey = nextApiKey;
60
+ }
61
+ return cachedClient;
62
+ }
62
63
 
63
64
  async function fetchData() {
64
65
  if (!usesApi) return;
@@ -4,7 +4,7 @@ interface Props {
4
4
  projectName: string;
5
5
  /** API URL for fetching data (self-fetching mode) */
6
6
  apiUrl?: string;
7
- /** API key for fetching data (self-fetching mode) */
7
+ /** API key for direct admin calls. Omit when using a same-origin proxy. */
8
8
  apiKey?: string;
9
9
  /** Systems data (pass-through mode — overrides API fetching) */
10
10
  systems?: System[];
@@ -21,7 +21,7 @@
21
21
  import { onMount } from 'svelte';
22
22
  import type { BoardItem, BoardTransition } from '../../api.js';
23
23
  import type { FeedbackBoardState } from './state.svelte.js';
24
- import { getStatusBadgeVariant, publicStatusLabel } from './utils.js';
24
+ import { getStatusBadgeVariant, publicStatusLabel, internalStatusLabel } from './utils.js';
25
25
 
26
26
  interface Props {
27
27
  board: FeedbackBoardState;
@@ -45,7 +45,15 @@
45
45
 
46
46
  // Read from the board's shared cache so detail + list reuse the same fetch.
47
47
  let txns = $derived(board.transitions[item.id] ?? null);
48
- let badgeLabel = $derived(txns?.current.display ?? publicStatusLabel(item.publicStatus));
48
+ // Label priority: the authoritative loaded transitions display (if this item's
49
+ // transitions have been fetched) → for privileged viewers, the item's own
50
+ // internal status (present on every board item, so ALL rows show their real
51
+ // status, not just the one the privilege probe happened to load) → otherwise
52
+ // the coarse public projection shown to everyone else.
53
+ let badgeLabel = $derived(
54
+ txns?.current.display ??
55
+ (board.canManageStatus ? internalStatusLabel(item.status) : publicStatusLabel(item.publicStatus))
56
+ );
49
57
  // Changes whenever the menu's content (and thus its size) changes — drives a
50
58
  // reposition so the teleported menu stays anchored after it loads/expands.
51
59
  let posKey = $derived(`${menuOpen}:${loading}:${pendingTarget?.status ?? ''}:${txns?.targets.length ?? 0}`);