@mundogamernetwork/shared-ui 1.17.18 → 1.18.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/README.md +23 -0
- package/assets/kit/kit-base.css +47 -0
- package/assets/whats-new/tokens.css +43 -0
- package/components/MediaKit/MgRateCardBundleEditor.vue +2 -7
- package/components/MediaKit/MgRateCardEditor.vue +1 -1
- package/components/keys/KeyCampaignDashboardCard.vue +1 -1
- package/components/playtest/PlaytestInviteLanding.vue +17 -6
- package/components/ui/MgBanners.vue +13 -0
- package/components/ui/MgLoginModal.vue +1 -1
- package/components/whats-new/MgWhatsNewDialog.vue +552 -0
- package/components/whats-new/MgWhatsNewMedia.vue +242 -0
- package/components/whats-new/MgWhatsNewModal.vue +285 -0
- package/components/whats-new/MgWhatsNewRichText.vue +90 -0
- package/composables/useForceLogout.ts +0 -1
- package/composables/useLogout.ts +0 -2
- package/composables/useMgCheckout.ts +0 -1
- package/error.vue +1 -1
- package/nuxt.config.ts +11 -2
- package/package.json +5 -11
- package/pages/[slug]/index.vue +1 -1
- package/pages/about.vue +1 -1
- package/pages/blog.vue +1 -1
- package/pages/careers.vue +1 -1
- package/pages/contact.vue +8 -14
- package/pages/faq.vue +1 -1
- package/pages/key-campaigns/index.vue +1 -1
- package/pages/key-campaigns/redeem-key.vue +1 -1
- package/pages/magazine/[slug]/index.vue +1 -1
- package/pages/magazine/[slug]/preview.vue +2 -2
- package/pages/magazine/index.vue +3 -2
- package/pages/partners.vue +1 -1
- package/pages/press.vue +1 -1
- package/pages/presskit/game/[slug].vue +29 -1
- package/pages/roadmap.vue +1 -1
- package/pages/status.vue +1 -1
- package/pages/team.vue +1 -1
- package/pages/whats-new-preview.vue +96 -0
- package/services/campaignService.ts +0 -1
- package/services/creatorNetworkProgramService.ts +47 -0
- package/services/documentService.ts +16 -4
- package/services/httpService.ts +2 -2
- package/services/institutionalService.ts +1 -1
- package/stores/whatsNew.ts +170 -0
- package/types/index.ts +0 -3
- package/utils/clearSession.ts +0 -1
- package/utils/whatsNew.ts +300 -0
- package/utils/whatsNewMessages.ts +133 -0
- package/utils/whatsNewText.ts +10 -0
- package/types/echo.d.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mundogamernetwork/shared-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./nuxt.config.ts",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"dev": "nuxi dev .playground",
|
|
28
|
-
"build": "nuxi build .playground"
|
|
28
|
+
"build": "nuxi build .playground",
|
|
29
|
+
"test": "npx --yes vitest@2.1.9 run"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"@pinia-plugin-persistedstate/nuxt": ">=1.0.0",
|
|
@@ -39,27 +40,20 @@
|
|
|
39
40
|
"vue": ">=3.5.0"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@mundogamernetwork/mgn-flipbook": "0.2.0",
|
|
43
43
|
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
|
44
44
|
"leaflet": "^1.9.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@pinia-plugin-persistedstate/nuxt": "^1.2.1",
|
|
48
48
|
"@pinia/nuxt": "^0.5.5",
|
|
49
|
-
"@nuxtjs/i18n": "^8.3.0",
|
|
50
|
-
"@nuxtjs/color-mode": "^3.5.2",
|
|
51
|
-
"@vueuse/core": "^12.5.0",
|
|
52
|
-
"@types/node": "^22.10.0",
|
|
53
|
-
"sass-embedded": "^1.89.2",
|
|
54
49
|
"@types/leaflet": "^1.9.18",
|
|
55
50
|
"axios": "^1.18.1",
|
|
56
51
|
"hls.js": "^1.6.16",
|
|
57
52
|
"laravel-echo": "^2.3.7",
|
|
58
|
-
"nuxt": "3.15.4",
|
|
53
|
+
"nuxt": "^3.15.4",
|
|
59
54
|
"pinia": "^2.3.1",
|
|
60
55
|
"pusher-js": "^8.5.0",
|
|
61
56
|
"typescript": "^5.0.0",
|
|
62
57
|
"vue-tsc": "^2.2.0"
|
|
63
|
-
}
|
|
64
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
58
|
+
}
|
|
65
59
|
}
|
package/pages/[slug]/index.vue
CHANGED
|
@@ -76,7 +76,7 @@ if (error.value || !getDocument.value?.data?.localized_content) {
|
|
|
76
76
|
content: " ";
|
|
77
77
|
display: block;
|
|
78
78
|
position: absolute;
|
|
79
|
-
background:
|
|
79
|
+
background: url("@/assets/images/bg-privacy-policy.png") no-repeat center center / cover;
|
|
80
80
|
width: 100%;
|
|
81
81
|
height: 100%;
|
|
82
82
|
top: 50%;
|
package/pages/about.vue
CHANGED
|
@@ -71,7 +71,7 @@ definePageMeta({ layout: "default" });
|
|
|
71
71
|
content: " ";
|
|
72
72
|
display: block;
|
|
73
73
|
position: absolute;
|
|
74
|
-
background:
|
|
74
|
+
background: url("@/assets/images/bg-about.png") no-repeat center center / cover;
|
|
75
75
|
width: 100%;
|
|
76
76
|
height: 100%;
|
|
77
77
|
top: 50%;
|
package/pages/blog.vue
CHANGED
|
@@ -260,7 +260,7 @@ onMounted(() => {
|
|
|
260
260
|
content: " ";
|
|
261
261
|
display: block;
|
|
262
262
|
position: absolute;
|
|
263
|
-
background:
|
|
263
|
+
background: url("@/assets/images/bg-blog.png") no-repeat center center / cover;
|
|
264
264
|
width: 100%;
|
|
265
265
|
height: 100%;
|
|
266
266
|
top: 50%;
|
package/pages/careers.vue
CHANGED
|
@@ -188,7 +188,7 @@ onMounted(async () => {
|
|
|
188
188
|
content: " ";
|
|
189
189
|
display: block;
|
|
190
190
|
position: absolute;
|
|
191
|
-
background:
|
|
191
|
+
background: url("@/assets/images/bg-careers.png") no-repeat center center / cover;
|
|
192
192
|
width: 100%;
|
|
193
193
|
height: 100%;
|
|
194
194
|
top: 50%;
|
package/pages/contact.vue
CHANGED
|
@@ -64,20 +64,12 @@ watchEffect(() => { if (formData.value.message) inputErrors.value.message.status
|
|
|
64
64
|
watchEffect(() => { if (formData.value.subject_id) inputErrors.value.subject_id.status = false; });
|
|
65
65
|
watchEffect(() => { if (formData.value.country_id) inputErrors.value.country_id.status = false; });
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
const
|
|
67
|
+
// A double click used to send the message twice; the second answer replaced the success dialog with an error.
|
|
68
|
+
const sending = ref(false);
|
|
69
69
|
|
|
70
70
|
const submitForm = async () => {
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
await sendMessage();
|
|
75
|
-
} finally {
|
|
76
|
-
isSubmitting.value = false;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const sendMessage = async () => {
|
|
71
|
+
if (sending.value) return;
|
|
72
|
+
sending.value = true;
|
|
81
73
|
try {
|
|
82
74
|
const data = {
|
|
83
75
|
...formData.value,
|
|
@@ -107,6 +99,8 @@ const sendMessage = async () => {
|
|
|
107
99
|
modalMessage.value = String($t("more.contact.message_popup.error") || "There was an error sending your message. Please try again.");
|
|
108
100
|
showModal.value = true;
|
|
109
101
|
}
|
|
102
|
+
} finally {
|
|
103
|
+
sending.value = false;
|
|
110
104
|
}
|
|
111
105
|
};
|
|
112
106
|
|
|
@@ -183,7 +177,7 @@ const { $t } = useNuxtApp().$i18n;
|
|
|
183
177
|
<span v-if="inputErrors.message.status" class="error-msg">{{ inputErrors.message.error }}</span>
|
|
184
178
|
</div>
|
|
185
179
|
|
|
186
|
-
<button type="submit" class="btn-contact" :disabled="
|
|
180
|
+
<button type="submit" class="btn-contact" :disabled="sending">
|
|
187
181
|
{{ $t("more.contact.btn_send_message") }}
|
|
188
182
|
</button>
|
|
189
183
|
</form>
|
|
@@ -225,7 +219,7 @@ const { $t } = useNuxtApp().$i18n;
|
|
|
225
219
|
content: " ";
|
|
226
220
|
display: block;
|
|
227
221
|
position: absolute;
|
|
228
|
-
background:
|
|
222
|
+
background: url("@/assets/images/bg-contact.png") no-repeat center center / cover;
|
|
229
223
|
width: 100%;
|
|
230
224
|
height: 100%;
|
|
231
225
|
top: 50%;
|
package/pages/faq.vue
CHANGED
|
@@ -174,7 +174,7 @@ function toggleFaq(index: number) {
|
|
|
174
174
|
content: " ";
|
|
175
175
|
display: block;
|
|
176
176
|
position: absolute;
|
|
177
|
-
background:
|
|
177
|
+
background: url("@/assets/images/bg-faq.png") no-repeat center center / cover;
|
|
178
178
|
width: 100%;
|
|
179
179
|
height: 100%;
|
|
180
180
|
top: 50%;
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<FormAppSelect
|
|
70
70
|
id="keyCampaignsPlatformFilter"
|
|
71
71
|
:model="activePlatformFilter ?? ''"
|
|
72
|
-
@update:model="(val
|
|
72
|
+
@update:model="(val) => setPlatformFilter(val ? Number(val) : null)"
|
|
73
73
|
:label="$t('keys.campaigns.all')"
|
|
74
74
|
:options="platformList.map((p) => [p.id, platformAbbr(p.name)])"
|
|
75
75
|
/>
|
|
@@ -87,7 +87,7 @@ onMounted(async () => {
|
|
|
87
87
|
fetchKeyRegions(keyId),
|
|
88
88
|
fetchAvailableOptions(keyId).catch(() => null),
|
|
89
89
|
])
|
|
90
|
-
|
|
90
|
+
campaign.value = campaignRes?.data?.data || campaignRes?.data || null
|
|
91
91
|
const allPlatforms = platformsRes?.data?.data || platformsRes?.data || []
|
|
92
92
|
const allRegions = regionsRes?.data?.data || regionsRes?.data || []
|
|
93
93
|
|
|
@@ -15,7 +15,7 @@ useSeoMeta({
|
|
|
15
15
|
ogDescription:
|
|
16
16
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
17
17
|
ogImage: "/imgs/seo-magazine-image.jpg",
|
|
18
|
-
ogUrl: "/magazine"
|
|
18
|
+
// No ogUrl: it was the relative "/magazine" for every issue and language. Each front publishes og:url (= its canonical) in app.vue.
|
|
19
19
|
twitterTitle: "MGN Magazine",
|
|
20
20
|
twitterDescription:
|
|
21
21
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
@@ -18,7 +18,7 @@ useSeoMeta({
|
|
|
18
18
|
ogDescription:
|
|
19
19
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
20
20
|
ogImage: "/imgs/seo-magazine-image.jpg",
|
|
21
|
-
ogUrl: "/magazine"
|
|
21
|
+
// No ogUrl: it was the relative "/magazine" for every issue and language. Each front publishes og:url (= its canonical) in app.vue.
|
|
22
22
|
twitterTitle: "MGN Magazine",
|
|
23
23
|
twitterDescription:
|
|
24
24
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
@@ -158,7 +158,7 @@ const flipbookPages = computed<PageData[]>(() => {
|
|
|
158
158
|
page,
|
|
159
159
|
flipbookCode: magazine.value.data?.flipbook_code,
|
|
160
160
|
}),
|
|
161
|
-
}))
|
|
161
|
+
}));
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
// Determine if lead capture modal should show
|
package/pages/magazine/index.vue
CHANGED
|
@@ -184,7 +184,7 @@ useSeoMeta({
|
|
|
184
184
|
ogDescription:
|
|
185
185
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
186
186
|
ogImage: "/imgs/seo-magazine-image.jpg",
|
|
187
|
-
ogUrl: "/magazine"
|
|
187
|
+
// No ogUrl: it was the relative "/magazine" for every language. Each front publishes og:url (= its canonical) in app.vue.
|
|
188
188
|
twitterTitle: "MGN Magazine",
|
|
189
189
|
twitterDescription:
|
|
190
190
|
"Discover, be inspired and connect in the magazine that breathes digital gaming. Welcome to your new source of gamer passion!",
|
|
@@ -764,7 +764,8 @@ const uniqueEditions = computed(() => {
|
|
|
764
764
|
content: " ";
|
|
765
765
|
display: block;
|
|
766
766
|
position: absolute;
|
|
767
|
-
background:
|
|
767
|
+
background: url("@/assets/images/bg-magazine.png") no-repeat center center /
|
|
768
|
+
cover;
|
|
768
769
|
width: 100%;
|
|
769
770
|
height: 100%;
|
|
770
771
|
top: 50%;
|
package/pages/partners.vue
CHANGED
|
@@ -151,7 +151,7 @@ onMounted(() => {
|
|
|
151
151
|
content: " ";
|
|
152
152
|
display: block;
|
|
153
153
|
position: absolute;
|
|
154
|
-
background:
|
|
154
|
+
background: url("@/assets/images/bg-partners.png") no-repeat center center / cover;
|
|
155
155
|
width: 100%;
|
|
156
156
|
height: 100%;
|
|
157
157
|
top: 50%;
|
package/pages/press.vue
CHANGED
|
@@ -130,7 +130,7 @@ onMounted(() => {
|
|
|
130
130
|
content: " ";
|
|
131
131
|
display: block;
|
|
132
132
|
position: absolute;
|
|
133
|
-
background:
|
|
133
|
+
background: url("@/assets/images/bg-press.png") no-repeat center center / cover;
|
|
134
134
|
width: 100%;
|
|
135
135
|
height: 100%;
|
|
136
136
|
top: 50%;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { trackPressKitEvent } from '../../../services/pressKitService';
|
|
3
3
|
import { mgApiUrl } from '../../../services/httpService';
|
|
4
|
+
import { fetchCreatorNetworkProgram, creatorNetworkProgramLink } from '../../../services/creatorNetworkProgramService';
|
|
4
5
|
|
|
5
6
|
definePageMeta({ layout: 'blank' });
|
|
6
7
|
|
|
7
8
|
const route = useRoute();
|
|
8
9
|
const slug = route.params.slug as string;
|
|
9
|
-
const { t } = useI18n();
|
|
10
|
+
const { t, te } = useI18n();
|
|
10
11
|
|
|
11
12
|
const runtimeConfig = useRuntimeConfig();
|
|
12
13
|
const cfg = (runtimeConfig.public?.mgSharedUi || {}) as Record<string, any>;
|
|
@@ -62,6 +63,19 @@ const { data: moreKitsData } = await useAsyncData(
|
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
const kit = computed(() => kitData.value?.data || kitData.value || null);
|
|
66
|
+
|
|
67
|
+
// Does the game have a Creator Network program open? Asked after the page is up and never awaited by
|
|
68
|
+
// it: a missing or slow answer simply means no badge. The strings live in each app's own lang files, so
|
|
69
|
+
// an app that does not carry them yet shows nothing instead of raw keys.
|
|
70
|
+
// The public kit carries its game as `game.id` (it does not carry a top-level `game_id`).
|
|
71
|
+
const kitGameId = computed(() => kit.value?.game?.id ?? kit.value?.game_id ?? null);
|
|
72
|
+
const { data: program } = useAsyncData(
|
|
73
|
+
`press-kit-program-${slug}`,
|
|
74
|
+
() => fetchCreatorNetworkProgram(apiBase, kitGameId.value),
|
|
75
|
+
{ lazy: true, server: false, watch: [kitGameId] },
|
|
76
|
+
);
|
|
77
|
+
const programLink = computed(() => (program.value?.open ? creatorNetworkProgramLink(program.value.url, 'press-kit') : null));
|
|
78
|
+
const showProgram = computed(() => !!programLink.value && te('kit.press.creator_program_cta'));
|
|
65
79
|
const loading = pending;
|
|
66
80
|
|
|
67
81
|
// A request that FAILED is not the same as a kit that does not EXIST. Collapsing
|
|
@@ -355,6 +369,7 @@ const navSections = computed(() => {
|
|
|
355
369
|
if (team.value.length) s.push({ id: 'team', label: 'kit.press.team' });
|
|
356
370
|
if (hasEcosystem.value) s.push({ id: 'events', label: 'kit.press.showcases' });
|
|
357
371
|
if (k.game_id && keyPoolsVisible.value) s.push({ id: 'review-key', label: 'kit.press.request_review_key' });
|
|
372
|
+
if (showProgram.value) s.push({ id: 'creator-network', label: 'kit.press.creator_program_nav' });
|
|
358
373
|
if (k.press_contact_email) s.push({ id: 'contact', label: 'kit.press.contact' });
|
|
359
374
|
return s;
|
|
360
375
|
});
|
|
@@ -509,6 +524,9 @@ useHead(() => ({
|
|
|
509
524
|
<img v-if="kit.cover_image_url" class="kit-cover-poster" :src="kit.cover_image_url" :alt="kit.name" />
|
|
510
525
|
<div class="kit-cover-text">
|
|
511
526
|
<span v-if="kit.release_status" class="kit-eyebrow">{{ String(kit.release_status).replace(/_/g, ' ') }}</span>
|
|
527
|
+
<a v-if="showProgram" class="kit-program-pill" :href="programLink!" @click="track('click')">
|
|
528
|
+
<span class="kit-program-dot" aria-hidden="true" />{{ $t('kit.press.creator_program_open') }}
|
|
529
|
+
</a>
|
|
512
530
|
<h1 class="kit-cover-title">{{ kit.name }}</h1>
|
|
513
531
|
<p v-if="kit.tagline" class="kit-tagline">{{ kit.tagline }}</p>
|
|
514
532
|
<p v-if="kit.developer" class="kit-kicker">{{ kit.developer }}</p>
|
|
@@ -522,6 +540,7 @@ useHead(() => ({
|
|
|
522
540
|
offered when the kit is actually linked to a game with open pools, same
|
|
523
541
|
gate as the section itself, so this never links to an empty/broken state. -->
|
|
524
542
|
<a v-if="kit.game_id" class="kit-btn kit-btn-ghost" href="#review-key" @click.prevent="scrollToSection('review-key')">{{ $t('kit.press.request_review_key') }}</a>
|
|
543
|
+
<a v-if="showProgram" class="kit-btn kit-btn-outline-accent" :href="programLink!" @click="track('click')">{{ $t('kit.press.creator_program_cta') }}</a>
|
|
525
544
|
<a
|
|
526
545
|
v-if="interviewHref"
|
|
527
546
|
class="kit-btn kit-btn-ghost"
|
|
@@ -736,6 +755,15 @@ useHead(() => ({
|
|
|
736
755
|
</div>
|
|
737
756
|
</section>
|
|
738
757
|
|
|
758
|
+
<!-- Creator Network: offered only while the program has a seat to give (see showProgram) -->
|
|
759
|
+
<section v-if="showProgram" id="creator-network" class="kit-block kit-program-block">
|
|
760
|
+
<h2>{{ $t('kit.press.creator_program_title') }}</h2>
|
|
761
|
+
<div class="kit-program-card">
|
|
762
|
+
<p>{{ $t('kit.press.creator_program_desc', { game: kit.name }) }}</p>
|
|
763
|
+
<a class="kit-btn kit-btn-primary" :href="programLink!" @click="track('click')">{{ $t('kit.press.creator_program_cta') }}</a>
|
|
764
|
+
</div>
|
|
765
|
+
</section>
|
|
766
|
+
|
|
739
767
|
<!-- Key pools embed — shown when game has active pools -->
|
|
740
768
|
<section v-if="kit.game_id" v-show="keyPoolsVisible" id="review-key" class="kit-block kit-keys-section">
|
|
741
769
|
<h2 class="kit-keys-title">{{ $t('kit.press.get_key_title') }}</h2>
|
package/pages/roadmap.vue
CHANGED
|
@@ -217,7 +217,7 @@ onMounted(() => {
|
|
|
217
217
|
content: " ";
|
|
218
218
|
display: block;
|
|
219
219
|
position: absolute;
|
|
220
|
-
background:
|
|
220
|
+
background: url("@/assets/images/bg-roadmap.png") no-repeat center center / cover;
|
|
221
221
|
width: 100%;
|
|
222
222
|
height: 100%;
|
|
223
223
|
top: 50%;
|
package/pages/status.vue
CHANGED
|
@@ -124,7 +124,7 @@ onMounted(() => {
|
|
|
124
124
|
content: " ";
|
|
125
125
|
display: block;
|
|
126
126
|
position: absolute;
|
|
127
|
-
background:
|
|
127
|
+
background: url("@/assets/images/bg-status.png") no-repeat center center / cover;
|
|
128
128
|
width: 100%;
|
|
129
129
|
height: 100%;
|
|
130
130
|
top: 50%;
|
package/pages/team.vue
CHANGED
|
@@ -150,7 +150,7 @@ onMounted(async () => {
|
|
|
150
150
|
content: " ";
|
|
151
151
|
display: block;
|
|
152
152
|
position: absolute;
|
|
153
|
-
background:
|
|
153
|
+
background: url("@/assets/images/bg-team.png") no-repeat center center / cover;
|
|
154
154
|
width: 100%;
|
|
155
155
|
height: 100%;
|
|
156
156
|
top: 50%;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Renders a "Novidades" comunicado exactly as the fronts do, for the admin's
|
|
4
|
+
* preview (iframe) and for QA.
|
|
5
|
+
*
|
|
6
|
+
* • Admin: the parent window posts
|
|
7
|
+
* { type: "mg-whats-new-preview", payload: <GET /admin/whats-new/{id}/preview body>,
|
|
8
|
+
* theme?: "light"|"dark", lang?: "pt-BR" }
|
|
9
|
+
* and this page answers { type: "mg-whats-new-preview-ready" } once it listens.
|
|
10
|
+
* • QA: /whats-new-preview?demo=image|video|embed|text&lang=pt-BR&theme=dark
|
|
11
|
+
*
|
|
12
|
+
* Nothing is fetched, stored or reported from here, and the payload goes
|
|
13
|
+
* through the same safe renderer (no HTML, https-only links/media).
|
|
14
|
+
*/
|
|
15
|
+
import { normalizeWnPost, type WnPost } from "../utils/whatsNew";
|
|
16
|
+
|
|
17
|
+
definePageMeta({ layout: false });
|
|
18
|
+
useHead({ meta: [{ name: "robots", content: "noindex,nofollow" }] });
|
|
19
|
+
|
|
20
|
+
const route = useRoute();
|
|
21
|
+
const colorMode = useColorMode();
|
|
22
|
+
|
|
23
|
+
const post = ref<WnPost | null>(null);
|
|
24
|
+
const lang = ref<string>(String(route.query.lang || "") || "en");
|
|
25
|
+
|
|
26
|
+
const DEMO_BASE = {
|
|
27
|
+
id: 0,
|
|
28
|
+
version: 1,
|
|
29
|
+
kind: "release",
|
|
30
|
+
title: "Game Jams, redesigned",
|
|
31
|
+
summary: "Hi, Ana! Creating a jam now takes **4 steps**, and every cover is checked before publishing. [Read more](/game-jams)",
|
|
32
|
+
published_at: "2026-10-22T14:00:00Z",
|
|
33
|
+
display_mode: "once",
|
|
34
|
+
sections: [
|
|
35
|
+
{ type: "feature", title: "", items: [{ body: "Creation wizard in **4 steps**.", link_url: null }, { body: "Jam preview on the site and in the app.", link_url: null }] },
|
|
36
|
+
{ type: "improvement", title: "", items: [{ body: "Cover images need at least **1200x600**.", link_url: null }] },
|
|
37
|
+
{ type: "fix", title: "", items: [{ body: "Registration dates now respect the time zone.", link_url: null }] },
|
|
38
|
+
{ type: "note", title: "", items: [{ body: "Nothing is lost; messages sent later appear normally.", link_url: null }] },
|
|
39
|
+
],
|
|
40
|
+
cta: { label: "Create my jam", type: "app_route", target: "/game-jams/new" },
|
|
41
|
+
links: [
|
|
42
|
+
{ kind: "social", label: "Discord", url: "https://discord.gg/example" },
|
|
43
|
+
{ kind: "social", label: "Instagram", url: "https://instagram.com/example" },
|
|
44
|
+
],
|
|
45
|
+
history_url: "https://example.com/news",
|
|
46
|
+
} as const;
|
|
47
|
+
|
|
48
|
+
function demo(kind: string): WnPost | null {
|
|
49
|
+
const media: Record<string, any> = {
|
|
50
|
+
image: { type: "image", url: "https://placehold.co/1600x900/4a47d6/ffffff.png?text=Game+Jams", poster_url: null, width: 1600, height: 900, duration_s: null, embed: null, description: "The new Game Jams creation wizard." },
|
|
51
|
+
video: { type: "video_upload", url: "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4", poster_url: "https://placehold.co/1280x720/1e2a4a/ffffff.png?text=Video", width: 1280, height: 720, duration_s: 18, embed: null, description: "A short, silent tour of the creation wizard." },
|
|
52
|
+
embed: { type: "video_embed", url: null, poster_url: "https://placehold.co/1280x720/d9468a/ffffff.png?text=Watch", width: 1280, height: 720, duration_s: null, embed: { provider: "youtube", id: "dQw4w9WgXcQ", watch_url: null }, description: "The team presents the redesign." },
|
|
53
|
+
};
|
|
54
|
+
if (!(kind in media) && kind !== "text") return null;
|
|
55
|
+
return normalizeWnPost({ ...DEMO_BASE, media: media[kind] ?? null, cta: kind === "text" ? null : DEMO_BASE.cta, links: kind === "text" ? [] : DEMO_BASE.links });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function applyTheme(theme: unknown) {
|
|
59
|
+
if (theme === "light" || theme === "dark") colorMode.preference = theme;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function onMessage(event: MessageEvent) {
|
|
63
|
+
const data: any = event.data;
|
|
64
|
+
if (!data || data.type !== "mg-whats-new-preview") return;
|
|
65
|
+
const payload = normalizeWnPost(data.payload?.data ?? data.payload);
|
|
66
|
+
if (!payload) return;
|
|
67
|
+
if (typeof data.lang === "string") lang.value = data.lang;
|
|
68
|
+
applyTheme(data.theme);
|
|
69
|
+
post.value = payload;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onMounted(() => {
|
|
73
|
+
// @nuxtjs/color-mode restores the stored preference after mount and would win
|
|
74
|
+
// over the query, so apply the requested theme again once it has settled.
|
|
75
|
+
applyTheme(route.query.theme);
|
|
76
|
+
setTimeout(() => applyTheme(route.query.theme), 150);
|
|
77
|
+
if (route.query.demo) post.value = demo(String(route.query.demo));
|
|
78
|
+
window.addEventListener("message", onMessage);
|
|
79
|
+
if (window.parent !== window) window.parent.postMessage({ type: "mg-whats-new-preview-ready" }, "*");
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
onBeforeUnmount(() => window.removeEventListener("message", onMessage));
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<template>
|
|
86
|
+
<div class="mg-wn-preview-page">
|
|
87
|
+
<MgWhatsNewModal preview :preview-post="post" :locale="lang" />
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<style lang="scss" scoped>
|
|
92
|
+
.mg-wn-preview-page {
|
|
93
|
+
min-height: 100dvh;
|
|
94
|
+
background: var(--mg-wn-surface-2);
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import axios, { type AxiosInstance } from "axios"
|
|
2
2
|
import { clearAuthCredentials } from "../utils/clearSession"
|
|
3
|
-
import { useAuthStore } from "../stores/auth"
|
|
4
3
|
|
|
5
4
|
// Campaign service wraps the key-campaigns API used by TV, community, and agency.
|
|
6
5
|
// Each frontend backend registers the shared key routes through its own provider.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a game has a Creator Network program open, for the public pages that can offer it
|
|
3
|
+
* (the press kit page). The answer comes from the agency API, by the community game id the page
|
|
4
|
+
* already knows: GET public/game-network/by-game/{id}.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface CreatorNetworkProgram {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
/** True only when the network is on AND a seat can still be promised: the only flag a page should act on. */
|
|
10
|
+
open: boolean;
|
|
11
|
+
url: string | null;
|
|
12
|
+
accent_color: string | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The program of a game, or null when there is none to show or the answer could not be had (never throws). */
|
|
16
|
+
export async function fetchCreatorNetworkProgram(
|
|
17
|
+
apiBase: string,
|
|
18
|
+
gameId: number | string | null | undefined,
|
|
19
|
+
): Promise<CreatorNetworkProgram | null> {
|
|
20
|
+
if (!apiBase || !gameId) return null;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const res = await $fetch<{ data?: CreatorNetworkProgram }>(
|
|
24
|
+
`${apiBase.replace(/\/$/, '')}/public/game-network/by-game/${encodeURIComponent(String(gameId))}`,
|
|
25
|
+
);
|
|
26
|
+
return res?.data ?? null;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The join link, tagged with where the visitor came from (the studio's funnel reads `campaign_label`).
|
|
34
|
+
* Only an http(s) address is ever returned, so a bad value can never become a `javascript:` link.
|
|
35
|
+
*/
|
|
36
|
+
export function creatorNetworkProgramLink(url: string | null | undefined, label: string): string | null {
|
|
37
|
+
if (!url) return null;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const link = new URL(url);
|
|
41
|
+
if (link.protocol !== 'https:' && link.protocol !== 'http:') return null;
|
|
42
|
+
link.searchParams.set('campaign_label', label);
|
|
43
|
+
return link.toString();
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -5,12 +5,24 @@ interface SerializeObject {
|
|
|
5
5
|
[key: string]: string | { [key: string]: string | string[] };
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// The institutional documents (terms of use, privacy policy, cookies policy...) live in api-main
|
|
9
|
+
// (`GET /document-website-latest`); the per-product APIs (academy, agency, tv...) do not expose that
|
|
10
|
+
// route. Calling `mgSharedUi.apiBaseURL` (the app's own API) made the shared `[slug]` page answer 404
|
|
11
|
+
// for every document in every front that does not point that URL at api-main, so use the network
|
|
12
|
+
// (main) base URL like institutionalService does.
|
|
13
|
+
const getNetworkBaseUrl = () => {
|
|
14
|
+
// useRuntimeConfig() needs the active Nuxt instance and throws when called from an async Pinia
|
|
15
|
+
// action after the SSR context is gone; fall back to the build-time env in that case.
|
|
16
|
+
try {
|
|
17
|
+
const fromConfig = useRuntimeConfig().public.mgSharedUi?.networkBaseUrl;
|
|
18
|
+
if (fromConfig) return fromConfig as string;
|
|
19
|
+
} catch (_) {
|
|
20
|
+
// outside Nuxt context — use the env fallback below
|
|
21
|
+
}
|
|
22
|
+
return import.meta.env.VITE_BASE_URL_NETWORK;
|
|
11
23
|
};
|
|
12
24
|
|
|
13
25
|
export const fetchDocuments = async (params: SerializeObject): Promise<any> => {
|
|
14
26
|
const paramsSerialized = serialize(params);
|
|
15
|
-
return httpService.get(`/document-website-latest${paramsSerialized}`, { baseURL:
|
|
27
|
+
return httpService.get(`/document-website-latest${paramsSerialized}`, { baseURL: getNetworkBaseUrl() });
|
|
16
28
|
};
|
package/services/httpService.ts
CHANGED
|
@@ -134,13 +134,13 @@ export function mgApiUrl(endpoint: string, usePrefix = true) {
|
|
|
134
134
|
case "login":
|
|
135
135
|
case "logout":
|
|
136
136
|
case "register":
|
|
137
|
-
return
|
|
137
|
+
return [apiBaseURL, usePrefix ? locale : "", endpoint]
|
|
138
138
|
.filter((v) => v)
|
|
139
139
|
.map((part) => part.replace(/^\//, ""))
|
|
140
140
|
.map((part) => part.replace(/\/api\/v1$/, ""))
|
|
141
141
|
.join("/");
|
|
142
142
|
default:
|
|
143
|
-
return
|
|
143
|
+
return [apiBaseURL, usePrefix ? locale : "", endpoint]
|
|
144
144
|
.filter((v) => v)
|
|
145
145
|
.map((part) => part.replace(/^\//, ""))
|
|
146
146
|
.join("/");
|
|
@@ -31,7 +31,7 @@ export const complexSerialize = function (obj: SerializeObject): string {
|
|
|
31
31
|
if (typeof value === "object" && value !== null) {
|
|
32
32
|
appendObject(`${baseKey}[${key}]`, value);
|
|
33
33
|
} else {
|
|
34
|
-
searchParams.append(`${baseKey}[${key}]`,
|
|
34
|
+
searchParams.append(`${baseKey}[${key}]`, value.toString());
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
};
|