@mundogamernetwork/shared-ui 1.1.36 → 1.1.37

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/nuxt.config.ts CHANGED
@@ -9,6 +9,8 @@ export default defineNuxtConfig({
9
9
  platform: "", // e.g. MGC, MGTV, MGN
10
10
  systemId: "", // VITE_SYSTEM_ID for notification filtering
11
11
  apiBaseURL: "", // VITE_API_BASE_URL
12
+ pressKitApiUrl: "", // VITE_PRESS_KIT_API_URL — override per-service; falls back to apiBaseURL
13
+ agencyBaseUrl: "", // VITE_BASE_URL_AGENCY — used for "create your press kit" CTA link
12
14
  accountsBaseUrl: "", // VITE_BASE_ACCOUNTS_URL
13
15
  networkBaseUrl: "", // VITE_BASE_URL_NETWORK (institutional APIs)
14
16
  features: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mundogamernetwork/shared-ui",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -1,28 +1,49 @@
1
1
  <script setup lang="ts">
2
- import { fetchPublicPressKit, trackPressKitEvent } from '../../services/pressKitService';
2
+ import { trackPressKitEvent } from '../../services/pressKitService';
3
3
 
4
- definePageMeta({ ssr: false, layout: 'blank' });
4
+ definePageMeta({ layout: 'blank' });
5
5
 
6
6
  const route = useRoute();
7
7
  const slug = route.params.slug as string;
8
8
 
9
- const kit = ref<Record<string, any> | null>(null);
10
- const loading = ref(true);
11
- const error = ref(false);
9
+ const runtimeConfig = useRuntimeConfig();
10
+ const cfg = (runtimeConfig.public?.mgSharedUi || {}) as Record<string, any>;
11
+ // Consuming apps may set apiBaseURL at public root (agency/community/tv pattern)
12
+ // or inside mgSharedUi. pressKitApiUrl overrides both (e.g. community points to agency API).
13
+ const apiBase: string =
14
+ cfg.pressKitApiUrl ||
15
+ (runtimeConfig.public as any)?.pressKitApiUrl ||
16
+ cfg.apiBaseURL ||
17
+ (runtimeConfig.public as any)?.apiBaseURL ||
18
+ '';
12
19
 
13
- onMounted(async () => {
14
- try {
15
- const { data } = await fetchPublicPressKit(slug);
16
- kit.value = data?.data || data;
20
+ const agencyBase: string =
21
+ cfg.agencyBaseUrl ||
22
+ (runtimeConfig.public as any)?.agencyBaseUrl ||
23
+ '';
17
24
 
25
+ const SUPPORTED_LOCALES = ['en', 'pt-BR', 'es', 'de', 'ro', 'ar-AE'];
26
+ const routePath = route.path.split('/');
27
+ const lang = SUPPORTED_LOCALES.find(l => routePath.includes(l)) || 'en';
28
+
29
+ const { data: kitData, error: fetchError, pending } = await useAsyncData(
30
+ `press-kit-${slug}`,
31
+ () => $fetch<any>(`${apiBase}/public/press-kits/${slug}`, {
32
+ params: { include: 'assets,videos,credits,awards,quotes', lang },
33
+ }),
34
+ { lazy: false },
35
+ );
36
+
37
+ const kit = computed(() => kitData.value?.data || kitData.value || null);
38
+ const loading = pending;
39
+ const error = computed(() => !!fetchError.value || (!pending.value && !kit.value));
40
+
41
+ onMounted(() => {
42
+ if (kit.value) {
18
43
  trackPressKitEvent(slug, {
19
44
  event_type: 'view',
20
45
  referrer: document.referrer || undefined,
21
46
  }).catch(() => {});
22
- } catch {
23
- error.value = true;
24
- } finally {
25
- loading.value = false;
26
47
  }
27
48
  });
28
49
 
@@ -244,7 +265,7 @@ useHead(() => ({
244
265
 
245
266
  <p class="kit-madewith">
246
267
  {{ $t('kit.press.made_with') }} <strong>Mundo Gamer</strong> —
247
- <a :href="kit.create_kit_url || '/dashboard/press-kit'">{{ $t('kit.press.create_yours') }}</a>
268
+ <a :href="kit.create_kit_url || `${agencyBase}/presskit`" target="_blank" rel="noopener">{{ $t('kit.press.create_yours') }}</a>
248
269
  </p>
249
270
  </main>
250
271
  </div>