@mundogamernetwork/shared-ui 1.17.18 → 1.18.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.
Files changed (56) hide show
  1. package/README.md +23 -0
  2. package/assets/kit/kit-base.css +47 -0
  3. package/assets/whats-new/tokens.css +43 -0
  4. package/components/MediaKit/MgRateCardBundleEditor.vue +2 -7
  5. package/components/MediaKit/MgRateCardEditor.vue +1 -1
  6. package/components/keys/KeyBrowser.vue +4 -9
  7. package/components/keys/KeyCampaignDashboardCard.vue +1 -1
  8. package/components/playtest/PlaytestInviteLanding.vue +17 -6
  9. package/components/ui/MgBanners.vue +13 -0
  10. package/components/ui/MgLoginModal.vue +1 -1
  11. package/components/whats-new/MgWhatsNewDialog.vue +552 -0
  12. package/components/whats-new/MgWhatsNewMedia.vue +242 -0
  13. package/components/whats-new/MgWhatsNewModal.vue +285 -0
  14. package/components/whats-new/MgWhatsNewRichText.vue +90 -0
  15. package/composables/useForceLogout.ts +0 -1
  16. package/composables/useLogout.ts +0 -2
  17. package/composables/useMgCheckout.ts +0 -1
  18. package/error.vue +1 -1
  19. package/locales/de.json +6 -0
  20. package/locales/en.json +6 -0
  21. package/locales/es.json +6 -0
  22. package/locales/pt-BR.json +6 -0
  23. package/locales/ro.json +6 -0
  24. package/nuxt.config.ts +11 -2
  25. package/package.json +5 -11
  26. package/pages/[slug]/index.vue +1 -1
  27. package/pages/about.vue +1 -1
  28. package/pages/blog.vue +1 -1
  29. package/pages/careers.vue +1 -1
  30. package/pages/contact.vue +8 -14
  31. package/pages/faq.vue +1 -1
  32. package/pages/key-campaigns/index.vue +1 -1
  33. package/pages/key-campaigns/redeem-key.vue +5 -11
  34. package/pages/magazine/[slug]/index.vue +1 -1
  35. package/pages/magazine/[slug]/preview.vue +2 -2
  36. package/pages/magazine/index.vue +3 -2
  37. package/pages/partners.vue +1 -1
  38. package/pages/press.vue +1 -1
  39. package/pages/presskit/game/[slug].vue +29 -1
  40. package/pages/roadmap.vue +1 -1
  41. package/pages/status.vue +1 -1
  42. package/pages/team.vue +1 -1
  43. package/pages/whats-new-preview.vue +96 -0
  44. package/services/campaignService.ts +0 -1
  45. package/services/creatorNetworkProgramService.ts +47 -0
  46. package/services/documentService.ts +16 -4
  47. package/services/httpService.ts +2 -2
  48. package/services/institutionalService.ts +1 -1
  49. package/stores/whatsNew.ts +170 -0
  50. package/types/index.ts +0 -3
  51. package/utils/clearSession.ts +0 -1
  52. package/utils/keyRequestError.ts +54 -0
  53. package/utils/whatsNew.ts +300 -0
  54. package/utils/whatsNewMessages.ts +133 -0
  55. package/utils/whatsNewText.ts +10 -0
  56. package/types/echo.d.ts +0 -7
@@ -0,0 +1,552 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
3
+ import { classifyHref, isRtl, toApiLang, type WnPost } from "../../utils/whatsNew";
4
+ import { wnText, type WnTextKey } from "../../utils/whatsNewText";
5
+
6
+ const props = defineProps<{
7
+ post: WnPost;
8
+ locale: string;
9
+ // Maps an in-app path to the final route, or null when this front has no such route.
10
+ resolveInternal: (path: string) => string | null;
11
+ }>();
12
+
13
+ const emit = defineEmits<{
14
+ (e: "close", reason: "button" | "later" | "esc" | "backdrop"): void;
15
+ (e: "cta"): void;
16
+ (e: "navigate", path: string): void;
17
+ (e: "link", target: string): void;
18
+ (e: "video-play"): void;
19
+ }>();
20
+
21
+ const uid = Math.random().toString(36).slice(2, 8);
22
+ const titleId = `mg-wn-title-${uid}`;
23
+ const summaryId = `mg-wn-summary-${uid}`;
24
+
25
+ const panel = ref<HTMLElement | null>(null);
26
+ const titleEl = ref<HTMLElement | null>(null);
27
+ let returnFocusTo: HTMLElement | null = null;
28
+ let previousOverflow = "";
29
+
30
+ const t = (key: WnTextKey) => wnText(props.locale, key);
31
+ const dir = computed(() => (isRtl(props.locale) ? "rtl" : "ltr"));
32
+
33
+ const dateLabel = computed(() => {
34
+ if (!props.post.published_at) return "";
35
+ try {
36
+ return new Intl.DateTimeFormat(toApiLang(props.locale), { dateStyle: "long" }).format(
37
+ new Date(props.post.published_at),
38
+ );
39
+ } catch {
40
+ return "";
41
+ }
42
+ });
43
+
44
+ const kindLabel = computed(() => t(`kind_${props.post.kind}` as WnTextKey));
45
+ const subtitle = computed(() => [dateLabel.value, kindLabel.value].filter(Boolean).join(" · "));
46
+
47
+ // The CTA only renders when its target resolves to something this front can open.
48
+ const cta = computed(() => {
49
+ const c = props.post.cta;
50
+ if (!c || !c.label) return null;
51
+ const kind = classifyHref(c.target);
52
+ if (kind === "external") return { label: c.label, href: c.target, external: true };
53
+ if (kind === "internal") {
54
+ const resolved = props.resolveInternal(c.target);
55
+ return resolved ? { label: c.label, href: resolved, external: false } : null;
56
+ }
57
+ return null;
58
+ });
59
+
60
+ const historyLink = computed(() => {
61
+ const url = props.post.history_url;
62
+ const kind = classifyHref(url);
63
+ if (!url || !kind) return null;
64
+ if (kind === "external") return { href: url, external: true };
65
+ const resolved = props.resolveInternal(url);
66
+ return resolved ? { href: resolved, external: false } : null;
67
+ });
68
+
69
+ const footerLinks = computed(() =>
70
+ (props.post.links || []).filter((l) => classifyHref(l.url) === "external" && l.label),
71
+ );
72
+
73
+ function sectionLabel(section: WnPost["sections"][number]) {
74
+ return section.title || t(section.type as WnTextKey);
75
+ }
76
+
77
+ function onCta(event: MouseEvent) {
78
+ emit("cta");
79
+ if (cta.value && !cta.value.external) {
80
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0) return;
81
+ event.preventDefault();
82
+ emit("navigate", cta.value.href);
83
+ }
84
+ }
85
+
86
+ function onHistory(event: MouseEvent) {
87
+ if (!historyLink.value) return;
88
+ emit("link", props.post.history_url as string);
89
+ if (!historyLink.value.external && !(event.metaKey || event.ctrlKey || event.shiftKey)) {
90
+ event.preventDefault();
91
+ emit("navigate", historyLink.value.href);
92
+ }
93
+ }
94
+
95
+ function onFooterLink(url: string) {
96
+ emit("link", url);
97
+ }
98
+
99
+ function onBackdrop(event: MouseEvent) {
100
+ if (event.target === event.currentTarget) emit("close", "backdrop");
101
+ }
102
+
103
+ // ── focus management ──────────────────────────────────────────────────────
104
+ const FOCUSABLE =
105
+ 'a[href], button:not([disabled]), iframe, video[controls], [tabindex]:not([tabindex="-1"])';
106
+
107
+ function focusables(): HTMLElement[] {
108
+ if (!panel.value) return [];
109
+ return Array.from(panel.value.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(
110
+ (el) => !el.hasAttribute("inert") && el.getClientRects().length > 0,
111
+ );
112
+ }
113
+
114
+ function onKeydown(event: KeyboardEvent) {
115
+ if (event.key === "Escape") {
116
+ event.stopPropagation();
117
+ emit("close", "esc");
118
+ return;
119
+ }
120
+ if (event.key !== "Tab") return;
121
+ const items = focusables();
122
+ if (!items.length) {
123
+ event.preventDefault();
124
+ titleEl.value?.focus();
125
+ return;
126
+ }
127
+ const first = items[0];
128
+ const last = items[items.length - 1];
129
+ const active = document.activeElement as HTMLElement | null;
130
+ const inside = !!active && !!panel.value?.contains(active);
131
+ if (event.shiftKey && (active === first || active === titleEl.value || !inside)) {
132
+ event.preventDefault();
133
+ last.focus();
134
+ } else if (!event.shiftKey && (active === last || !inside)) {
135
+ event.preventDefault();
136
+ first.focus();
137
+ }
138
+ }
139
+
140
+ onMounted(async () => {
141
+ returnFocusTo = document.activeElement instanceof HTMLElement ? document.activeElement : null;
142
+ previousOverflow = document.documentElement.style.overflow;
143
+ document.documentElement.style.overflow = "hidden";
144
+ document.addEventListener("keydown", onKeydown, true);
145
+ await nextTick();
146
+ titleEl.value?.focus({ preventScroll: true });
147
+ });
148
+
149
+ onBeforeUnmount(() => {
150
+ document.removeEventListener("keydown", onKeydown, true);
151
+ document.documentElement.style.overflow = previousOverflow;
152
+ if (returnFocusTo && document.contains(returnFocusTo)) returnFocusTo.focus({ preventScroll: true });
153
+ });
154
+ </script>
155
+
156
+ <template>
157
+ <div class="mg-wn-overlay" data-mg-wn :dir="dir" @mousedown="onBackdrop">
158
+ <div
159
+ ref="panel"
160
+ class="mg-wn-panel"
161
+ role="dialog"
162
+ aria-modal="true"
163
+ :aria-labelledby="titleId"
164
+ :aria-describedby="post.summary ? summaryId : undefined"
165
+ >
166
+ <header class="mg-wn-head">
167
+ <div class="mg-wn-head__text">
168
+ <p class="mg-wn-eyebrow">{{ t("title") }}</p>
169
+ <h2 :id="titleId" ref="titleEl" class="mg-wn-title" tabindex="-1">{{ post.title }}</h2>
170
+ <p v-if="subtitle" class="mg-wn-sub">{{ subtitle }}</p>
171
+ </div>
172
+ <button type="button" class="mg-wn-x" :aria-label="t('close')" @click="emit('close', 'button')">
173
+ <span aria-hidden="true">✕</span>
174
+ </button>
175
+ </header>
176
+
177
+ <div class="mg-wn-body" tabindex="0" role="region" :aria-labelledby="titleId">
178
+ <MgWhatsNewMedia
179
+ v-if="post.media"
180
+ :media="post.media"
181
+ :locale="locale"
182
+ @video-play="emit('video-play')"
183
+ />
184
+
185
+ <p v-if="post.summary" :id="summaryId" class="mg-wn-summary">
186
+ <MgWhatsNewRichText
187
+ :text="post.summary"
188
+ :locale="locale"
189
+ :resolve-internal="resolveInternal"
190
+ @link="(u: string) => emit('link', u)"
191
+ @navigate="(p: string) => emit('navigate', p)"
192
+ />
193
+ </p>
194
+
195
+ <section
196
+ v-for="(section, si) in post.sections"
197
+ :key="si"
198
+ class="mg-wn-section"
199
+ :class="`mg-wn-section--${section.type}`"
200
+ >
201
+ <h3 class="mg-wn-section__title">{{ sectionLabel(section) }}</h3>
202
+ <ul class="mg-wn-section__list">
203
+ <li v-for="(item, ii) in section.items" :key="ii">
204
+ <a
205
+ v-if="item.link_url && classifyHref(item.link_url) === 'external'"
206
+ class="mg-wn-item-link"
207
+ :href="item.link_url"
208
+ target="_blank"
209
+ rel="noopener noreferrer"
210
+ @click="emit('link', item.link_url as string)"
211
+ >
212
+ <MgWhatsNewRichText :text="item.body" :allow-links="false" :locale="locale" />
213
+ </a>
214
+ <a
215
+ v-else-if="item.link_url && classifyHref(item.link_url) === 'internal' && resolveInternal(item.link_url)"
216
+ class="mg-wn-item-link"
217
+ :href="resolveInternal(item.link_url) as string"
218
+ @click.prevent="
219
+ emit('link', item.link_url as string);
220
+ emit('navigate', resolveInternal(item.link_url as string) as string);
221
+ "
222
+ >
223
+ <MgWhatsNewRichText :text="item.body" :allow-links="false" :locale="locale" />
224
+ </a>
225
+ <MgWhatsNewRichText
226
+ v-else
227
+ :text="item.body"
228
+ :locale="locale"
229
+ :resolve-internal="resolveInternal"
230
+ @link="(u: string) => emit('link', u)"
231
+ @navigate="(p: string) => emit('navigate', p)"
232
+ />
233
+ </li>
234
+ </ul>
235
+ </section>
236
+ </div>
237
+
238
+ <div v-if="cta" class="mg-wn-actions">
239
+ <a
240
+ class="mg-wn-btn mg-wn-btn--primary"
241
+ :href="cta.href"
242
+ :target="cta.external ? '_blank' : undefined"
243
+ :rel="cta.external ? 'noopener noreferrer' : undefined"
244
+ @click="onCta"
245
+ >
246
+ {{ cta.label }}
247
+ </a>
248
+ <button type="button" class="mg-wn-btn" @click="emit('close', 'later')">{{ t("later") }}</button>
249
+ </div>
250
+
251
+ <footer v-if="footerLinks.length || historyLink" class="mg-wn-foot">
252
+ <nav v-if="footerLinks.length" class="mg-wn-social" :aria-label="t('follow')">
253
+ <a
254
+ v-for="link in footerLinks"
255
+ :key="link.url"
256
+ class="mg-wn-social__link"
257
+ :href="link.url"
258
+ target="_blank"
259
+ rel="noopener noreferrer"
260
+ @click="onFooterLink(link.url)"
261
+ >
262
+ {{ link.label }}
263
+ </a>
264
+ </nav>
265
+ <a
266
+ v-if="historyLink"
267
+ class="mg-wn-history"
268
+ :href="historyLink.href"
269
+ :target="historyLink.external ? '_blank' : undefined"
270
+ :rel="historyLink.external ? 'noopener noreferrer' : undefined"
271
+ @click="onHistory"
272
+ >
273
+ {{ t("view_all") }} <span aria-hidden="true" class="mg-wn-history__arrow">→</span>
274
+ </a>
275
+ </footer>
276
+ </div>
277
+ </div>
278
+ </template>
279
+
280
+ <style lang="scss" scoped>
281
+ .mg-wn-overlay {
282
+ position: fixed;
283
+ inset: 0;
284
+ z-index: 10050;
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ padding: 16px;
289
+ background: var(--mg-wn-overlay);
290
+ font-family: inherit;
291
+ }
292
+
293
+ .mg-wn-panel {
294
+ display: flex;
295
+ flex-direction: column;
296
+ width: 100%;
297
+ max-width: 440px;
298
+ max-height: min(88dvh, 760px);
299
+ color: var(--mg-wn-text);
300
+ background: var(--mg-wn-surface);
301
+ border: 1px solid var(--mg-wn-border);
302
+ border-radius: 0;
303
+ box-shadow: 0 18px 50px var(--mg-wn-shadow);
304
+ overflow: hidden;
305
+
306
+ &:focus-visible,
307
+ & :focus-visible {
308
+ outline: 2px solid var(--mg-wn-accent);
309
+ outline-offset: 2px;
310
+ }
311
+ }
312
+
313
+ .mg-wn-head {
314
+ display: flex;
315
+ align-items: flex-start;
316
+ justify-content: space-between;
317
+ gap: 12px;
318
+ padding: 16px 18px 10px;
319
+
320
+ &__text {
321
+ min-width: 0;
322
+ }
323
+ }
324
+
325
+ .mg-wn-eyebrow {
326
+ margin: 0 0 2px;
327
+ font-size: 0.6875rem;
328
+ font-weight: 700;
329
+ letter-spacing: 0.09em;
330
+ text-transform: uppercase;
331
+ color: var(--mg-wn-accent);
332
+ }
333
+
334
+ .mg-wn-title {
335
+ margin: 0;
336
+ font-size: 1.25rem;
337
+ line-height: 1.25;
338
+ font-weight: 700;
339
+ color: var(--mg-wn-text);
340
+ overflow-wrap: anywhere;
341
+
342
+ &:focus {
343
+ outline: none;
344
+ }
345
+ }
346
+
347
+ .mg-wn-sub {
348
+ margin: 4px 0 0;
349
+ font-size: 0.75rem;
350
+ color: var(--mg-wn-text-muted);
351
+ }
352
+
353
+ .mg-wn-x {
354
+ flex: none;
355
+ display: grid;
356
+ place-items: center;
357
+ width: 32px;
358
+ height: 32px;
359
+ padding: 0;
360
+ font-size: 0.875rem;
361
+ color: var(--mg-wn-text-muted);
362
+ background: transparent;
363
+ border: 1px solid var(--mg-wn-border);
364
+ border-radius: 0;
365
+ cursor: pointer;
366
+
367
+ &:hover {
368
+ color: var(--mg-wn-text);
369
+ background: var(--mg-wn-surface-2);
370
+ }
371
+ }
372
+
373
+ .mg-wn-body {
374
+ display: flex;
375
+ flex-direction: column;
376
+ gap: 12px;
377
+ padding: 4px 18px 8px;
378
+ overflow-y: auto;
379
+ overscroll-behavior: contain;
380
+ }
381
+
382
+ .mg-wn-summary {
383
+ margin: 0;
384
+ font-size: 0.9rem;
385
+ line-height: 1.5;
386
+ color: var(--mg-wn-text);
387
+ }
388
+
389
+ .mg-wn-section {
390
+ &__title {
391
+ display: flex;
392
+ align-items: center;
393
+ gap: 8px;
394
+ margin: 0 0 6px;
395
+ font-size: 0.6875rem;
396
+ font-weight: 700;
397
+ letter-spacing: 0.09em;
398
+ text-transform: uppercase;
399
+ color: var(--mg-wn-section-color);
400
+
401
+ &::after {
402
+ content: "";
403
+ flex: 1;
404
+ height: 1px;
405
+ background: var(--mg-wn-border);
406
+ }
407
+ }
408
+
409
+ &__list {
410
+ margin: 0;
411
+ padding-inline-start: 18px;
412
+ font-size: 0.84rem;
413
+ line-height: 1.5;
414
+
415
+ li {
416
+ margin-bottom: 4px;
417
+ padding-inline-start: 2px;
418
+ color: var(--mg-wn-text);
419
+
420
+ &::marker {
421
+ color: var(--mg-wn-section-color);
422
+ }
423
+ }
424
+ }
425
+
426
+ // Section colour per type — success / accent / warning / neutral from the theme.
427
+ &--feature {
428
+ --mg-wn-section-color: var(--mg-wn-success);
429
+ }
430
+ &--improvement {
431
+ --mg-wn-section-color: var(--mg-wn-accent);
432
+ }
433
+ &--fix {
434
+ --mg-wn-section-color: var(--mg-wn-warning);
435
+ }
436
+ &--note {
437
+ --mg-wn-section-color: var(--mg-wn-neutral);
438
+ }
439
+ }
440
+
441
+ .mg-wn-item-link {
442
+ color: inherit;
443
+ text-decoration: underline;
444
+ text-decoration-color: var(--mg-wn-section-color);
445
+ text-underline-offset: 2px;
446
+ }
447
+
448
+ .mg-wn-actions {
449
+ display: flex;
450
+ flex-wrap: wrap;
451
+ gap: 8px;
452
+ padding: 8px 18px 4px;
453
+ }
454
+
455
+ .mg-wn-btn {
456
+ display: inline-flex;
457
+ align-items: center;
458
+ justify-content: center;
459
+ padding: 9px 16px;
460
+ font: inherit;
461
+ font-size: 0.8125rem;
462
+ font-weight: 600;
463
+ color: var(--mg-wn-text);
464
+ text-decoration: none;
465
+ background: transparent;
466
+ border: 1px solid var(--mg-wn-border);
467
+ border-radius: 0;
468
+ cursor: pointer;
469
+
470
+ &:hover {
471
+ background: var(--mg-wn-surface-2);
472
+ }
473
+
474
+ &--primary {
475
+ color: var(--mg-wn-on-accent);
476
+ background: var(--mg-wn-accent);
477
+ border-color: transparent;
478
+
479
+ &:hover {
480
+ background: var(--mg-wn-accent);
481
+ filter: brightness(1.08);
482
+ }
483
+ }
484
+ }
485
+
486
+ .mg-wn-foot {
487
+ display: flex;
488
+ flex-wrap: wrap;
489
+ align-items: center;
490
+ justify-content: space-between;
491
+ gap: 8px 16px;
492
+ margin-top: 10px;
493
+ padding: 10px 18px;
494
+ font-size: 0.75rem;
495
+ color: var(--mg-wn-text-muted);
496
+ background: var(--mg-wn-surface-2);
497
+ border-top: 1px solid var(--mg-wn-border);
498
+ }
499
+
500
+ .mg-wn-social {
501
+ display: flex;
502
+ flex-wrap: wrap;
503
+ gap: 6px;
504
+
505
+ &__link {
506
+ padding: 2px 10px;
507
+ color: var(--mg-wn-text);
508
+ text-decoration: none;
509
+ background: var(--mg-wn-surface);
510
+ border: 1px solid var(--mg-wn-border);
511
+ border-radius: 0;
512
+
513
+ &:hover {
514
+ border-color: var(--mg-wn-accent);
515
+ }
516
+ }
517
+ }
518
+
519
+ .mg-wn-history {
520
+ margin-inline-start: auto;
521
+ color: var(--mg-wn-accent);
522
+ font-weight: 600;
523
+ text-decoration: none;
524
+
525
+ &:hover {
526
+ text-decoration: underline;
527
+ }
528
+
529
+ &__arrow {
530
+ display: inline-block;
531
+ }
532
+ }
533
+
534
+ [dir="rtl"] .mg-wn-history__arrow {
535
+ transform: scaleX(-1);
536
+ }
537
+
538
+ // Phones: bottom sheet.
539
+ @media (max-width: 560px) {
540
+ .mg-wn-overlay {
541
+ align-items: flex-end;
542
+ padding: 0;
543
+ }
544
+
545
+ .mg-wn-panel {
546
+ max-width: none;
547
+ max-height: 92dvh;
548
+ border-radius: 0;
549
+ border-bottom: 0;
550
+ }
551
+ }
552
+ </style>