@mundogamernetwork/shared-ui 1.19.5 → 1.19.7

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.
@@ -453,6 +453,11 @@ const handleToggleOnline = () => {
453
453
  .menu-group--nav {
454
454
  // The host's own links keep their markup; they only get the shared edge.
455
455
  gap: 0;
456
+ // Hosts may slide a second pane in here (community's "More": two panes side by side, translated). As a flex item the
457
+ // group would grow to the width of both panes (min-width:auto) and the whole menu would scroll sideways; clipping
458
+ // it keeps the panes inside the 240px column.
459
+ min-width: 0;
460
+ overflow: hidden;
456
461
  }
457
462
 
458
463
  .logout-row {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mundogamernetwork/shared-ui",
3
- "version": "1.19.5",
3
+ "version": "1.19.7",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -51,6 +51,20 @@ function getConfig() {
51
51
  };
52
52
  }
53
53
 
54
+ // Without an Accept header a browser sends */*, and the API answers a signed-out request with a redirect to the login page:
55
+ // across origins that surfaces as a CORS error. Asking for JSON makes it a plain 401.
56
+ const JSON_HEADERS = { Accept: "application/json" };
57
+
58
+ /**
59
+ * Who is asking, for the signed-in-only reads (history, unread count, one post). Most fronts live on another site than the
60
+ * network API, so its session cookie never reaches it: the device is the identity, and `signed_in` says this front only
61
+ * asks for people who are signed in (see the API's WhatsNewEligibility::eligible). A front on the API's own site still
62
+ * resolves the user from the cookie, which wins.
63
+ */
64
+ function identityParams(platformId: number): Record<string, string> {
65
+ return { platform_id: String(platformId), surface: "web", device_id: getDeviceId(), signed_in: "1" };
66
+ }
67
+
54
68
  // Kept outside state: never serialized, never shared between tabs.
55
69
  let pendingEvents: WnReceiptEvent[] = [];
56
70
  let flushTimer: ReturnType<typeof setTimeout> | null = null;
@@ -106,9 +120,11 @@ export const useWhatsNewStore = defineStore("whats-new-store", {
106
120
  surface: "web",
107
121
  lang: toApiLang(locale),
108
122
  device_id: getDeviceId(),
123
+ signed_in: "1",
109
124
  });
110
125
  const res: any = await $fetch(`${networkBaseUrl}/whats-new/pending?${params.toString()}`, {
111
126
  credentials: "include",
127
+ headers: JSON_HEADERS,
112
128
  timeout: 8000,
113
129
  retry: 0,
114
130
  });
@@ -163,6 +179,7 @@ export const useWhatsNewStore = defineStore("whats-new-store", {
163
179
  platform_id: platformId,
164
180
  surface: "web",
165
181
  device_id: getDeviceId(),
182
+ signed_in: true,
166
183
  occurred_at: new Date().toISOString(),
167
184
  };
168
185
  if (target) entry.target = target;
@@ -204,9 +221,10 @@ export const useWhatsNewStore = defineStore("whats-new-store", {
204
221
  if (!networkBaseUrl || !platformId) return;
205
222
  this.unreadFor = identity;
206
223
  try {
207
- const params = new URLSearchParams({ platform_id: String(platformId), surface: "web" });
224
+ const params = new URLSearchParams(identityParams(platformId));
208
225
  const res: any = await $fetch(`${networkBaseUrl}/whats-new/unread-count?${params.toString()}`, {
209
226
  credentials: "include",
227
+ headers: JSON_HEADERS,
210
228
  timeout: 8000,
211
229
  retry: 0,
212
230
  });
@@ -258,14 +276,14 @@ export const useWhatsNewStore = defineStore("whats-new-store", {
258
276
  requestHistoryPage(locale: string, page: number) {
259
277
  const { networkBaseUrl, platformId } = getConfig();
260
278
  const params = new URLSearchParams({
261
- platform_id: String(platformId),
262
- surface: "web",
279
+ ...identityParams(platformId),
263
280
  lang: toApiLang(locale),
264
281
  page: String(page),
265
282
  per_page: String(WN_HISTORY_PAGE),
266
283
  });
267
284
  return $fetch(`${networkBaseUrl}/whats-new?${params.toString()}`, {
268
285
  credentials: "include",
286
+ headers: JSON_HEADERS,
269
287
  timeout: 10000,
270
288
  retry: 0,
271
289
  });
@@ -332,12 +350,12 @@ export const useWhatsNewStore = defineStore("whats-new-store", {
332
350
  this.openError = false;
333
351
  try {
334
352
  const params = new URLSearchParams({
335
- platform_id: String(platformId),
336
- surface: "web",
353
+ ...identityParams(platformId),
337
354
  lang: toApiLang(locale),
338
355
  });
339
356
  const res: any = await $fetch(`${networkBaseUrl}/whats-new/${item.id}?${params.toString()}`, {
340
357
  credentials: "include",
358
+ headers: JSON_HEADERS,
341
359
  timeout: 10000,
342
360
  retry: 0,
343
361
  });
package/utils/whatsNew.ts CHANGED
@@ -266,6 +266,8 @@ export interface WnReceiptEvent {
266
266
  platform_id: number;
267
267
  surface: "web";
268
268
  device_id: string;
269
+ /** The front only reports events for signed-in people; the API cannot see the session on another site. */
270
+ signed_in?: boolean;
269
271
  occurred_at: string;
270
272
  target?: string;
271
273
  }