@mundogamernetwork/shared-ui 1.19.6 → 1.19.9
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.
|
@@ -165,6 +165,13 @@ const submitChatMessage = async () => {
|
|
|
165
165
|
message: chatMessageInput.value,
|
|
166
166
|
});
|
|
167
167
|
chatMessageInput.value = "";
|
|
168
|
+
// The websocket is what normally draws the sent message; with no live connection (not configured, blocked, still
|
|
169
|
+
// connecting) it never would, so the conversation is read again instead.
|
|
170
|
+
if ((window as any).Echo?.connector?.pusher?.connection?.state !== "connected") {
|
|
171
|
+
const response = await getChat({ chat_id: selectedChatId.value });
|
|
172
|
+
chatMessages.value = response.data;
|
|
173
|
+
chatStore.setChatMessagesWidget(response.data, true);
|
|
174
|
+
}
|
|
168
175
|
scrollToBottom(true);
|
|
169
176
|
} catch {
|
|
170
177
|
// silent fail
|
|
@@ -296,6 +296,9 @@ const handleToggleOnline = () => {
|
|
|
296
296
|
<style scoped lang="scss">
|
|
297
297
|
.ui-config-user {
|
|
298
298
|
position: absolute;
|
|
299
|
+
// The menu reads left to right from its own left edge, whatever the host page does: some hosts set text-align on an
|
|
300
|
+
// ancestor of the header (right/center), which this subtree would inherit and push every label to the far side.
|
|
301
|
+
text-align: start;
|
|
299
302
|
// A fixed width, not width:100%. This is position:absolute, so a
|
|
300
303
|
// percentage width resolves against the nearest positioned ancestor —
|
|
301
304
|
// every real host's profile-icon <li> (32px, position:relative for its
|
|
@@ -400,7 +403,7 @@ const handleToggleOnline = () => {
|
|
|
400
403
|
height: 40px;
|
|
401
404
|
width: 40px;
|
|
402
405
|
border-radius: 0;
|
|
403
|
-
background:
|
|
406
|
+
background: var(--header-ui-config-border);
|
|
404
407
|
// Was a hardcoded blue (--ck-highlight-marker-blue), the same on
|
|
405
408
|
// every host regardless of that platform's own accent — fell
|
|
406
409
|
// through to the same fallback chain .plans-pricing-link already
|
|
@@ -450,6 +453,13 @@ const handleToggleOnline = () => {
|
|
|
450
453
|
}
|
|
451
454
|
}
|
|
452
455
|
|
|
456
|
+
// The XP bar brings its own side padding (it is a card elsewhere); inside the menu it must start and end on the same
|
|
457
|
+
// edges as every other row (the 16px of .info-row), or it sits 8px further in than the rows around it.
|
|
458
|
+
.menu-group--identity :deep(.mg-xp-bar--compact) {
|
|
459
|
+
padding-left: 0;
|
|
460
|
+
padding-right: 0;
|
|
461
|
+
}
|
|
462
|
+
|
|
453
463
|
.menu-group--nav {
|
|
454
464
|
// The host's own links keep their markup; they only get the shared edge.
|
|
455
465
|
gap: 0;
|
|
@@ -557,7 +567,7 @@ const handleToggleOnline = () => {
|
|
|
557
567
|
font-size: 0.75rem;
|
|
558
568
|
font-weight: 400;
|
|
559
569
|
// Each platform brands this differently (TV's own fork used a fixed
|
|
560
|
-
// lavender tint of its purple,
|
|
570
|
+
// lavender tint of its purple, rather than plain body text) —
|
|
561
571
|
// falling through the same accent tokens MgWalletPlanBadge/MgXpLevelBar
|
|
562
572
|
// use lets every front's real accent take over here without a per-front
|
|
563
573
|
// override.
|
|
@@ -84,8 +84,11 @@ function open() {
|
|
|
84
84
|
font-size: 0.6875rem;
|
|
85
85
|
font-weight: 700;
|
|
86
86
|
line-height: 1;
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
// A quiet outline in the row's own text colour, not a solid block: the menu is a list of text rows, and a filled
|
|
88
|
+
// chip on one of them reads as an alert. The avatar badge (MgWhatsNewBadge) keeps the solid fill, it sits on a photo.
|
|
89
|
+
color: var(--mg-wn-text);
|
|
90
|
+
background: transparent;
|
|
91
|
+
border: 1px solid var(--mg-wn-border);
|
|
89
92
|
border-radius: 0;
|
|
90
93
|
}
|
|
91
94
|
}
|
package/package.json
CHANGED
package/stores/whatsNew.ts
CHANGED
|
@@ -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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|