@mundogamernetwork/shared-ui 1.1.77 → 1.1.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mundogamernetwork/shared-ui",
3
- "version": "1.1.77",
3
+ "version": "1.1.78",
4
4
  "description": "Mundo Gamer Network - Shared UI Layer (Nuxt 3)",
5
5
  "type": "module",
6
6
  "main": "./nuxt.config.ts",
@@ -10,7 +10,6 @@ import {
10
10
  revealKey,
11
11
  requestKey,
12
12
  } from "../../services/campaignService"
13
- import { fetchDetailGameImage, fetchDetailGameVideo } from "../../services/gamesService"
14
13
 
15
14
  // Injected by each front — provide in app.vue / a plugin
16
15
  const mgPlatform = inject<string>("mgPlatform", "MGTV")
@@ -113,35 +112,10 @@ const { data: redeemedUsers } = await useAsyncData(
113
112
  )
114
113
 
115
114
  // ------------------------------------------------------------------
116
- // Game gallery (images/videos)
115
+ // Game gallery (images/videos) — already embedded in the campaign payload
117
116
  // ------------------------------------------------------------------
118
- const { data: gameDetailsImages } = await useAsyncData(
119
- `campaign-game-images-${slug}`,
120
- async () => {
121
- if (!campaign.value?.game_slug) return null
122
- try {
123
- const response = await fetchDetailGameImage(locale.value, campaign.value.game_slug)
124
- return response.data.data || null
125
- } catch {
126
- return null
127
- }
128
- },
129
- { watch: [campaign] },
130
- )
131
-
132
- const { data: gameDetailsVideos } = await useAsyncData(
133
- `campaign-game-videos-${slug}`,
134
- async () => {
135
- if (!campaign.value?.game_slug) return null
136
- try {
137
- const response = await fetchDetailGameVideo(locale.value, campaign.value.game_slug)
138
- return response.data.data || null
139
- } catch {
140
- return null
141
- }
142
- },
143
- { watch: [campaign] },
144
- )
117
+ const gameDetailsImages = computed(() => campaign.value?.game_images || [])
118
+ const gameDetailsVideos = computed(() => campaign.value?.game_videos || [])
145
119
 
146
120
  const showVideoModal = ref(false)
147
121
  const selectedVideoUrl = ref("")
@@ -640,10 +614,10 @@ onMounted(async () => {
640
614
  v-for="(video, index) in gameDetailsVideos.slice(0, 1)"
641
615
  :key="'video-' + index"
642
616
  class="video-thumbnail"
643
- @click="openVideoPlayer('https://www.youtube.com/embed/' + video.url_youtube)"
617
+ @click="openVideoPlayer('https://www.youtube.com/embed/' + video.external_id)"
644
618
  >
645
619
  <img
646
- :src="'https://img.youtube.com/vi/' + video.url_youtube + '/hqdefault.jpg'"
620
+ :src="'https://img.youtube.com/vi/' + video.external_id + '/hqdefault.jpg'"
647
621
  :alt="$t('common.video_thumbnail')"
648
622
  />
649
623
  <div class="play-icon">
@@ -282,6 +282,8 @@ export const fetchCampaignBySlug = async (slug: string) => {
282
282
  available_at_for_user: k.available_at_for_user ?? null,
283
283
  max_keys_for_user: k.max_keys_for_user ?? 1,
284
284
  game_summary: k.game?.summary,
285
+ game_images: (k.game?.images || []) as Array<{ url_image_src: string }>,
286
+ game_videos: (k.game?.videos || []) as Array<{ external_id: string; name?: string }>,
285
287
  request_id: k.requests?.[0]?.id,
286
288
  request_item_id: k.requests?.[0]?.key_item_id,
287
289
  request_admin_notes: k.requests?.[0]?.admin_notes ?? null,
@@ -1,52 +0,0 @@
1
- import axios, { type AxiosInstance } from "axios"
2
-
3
- // Game catalog service (images, videos, summary) shared across the network.
4
- // Mirrors tv-frontend's services/games/gameDetails.ts pattern.
5
-
6
- let _client: AxiosInstance | null = null
7
-
8
- function getClient(): AxiosInstance {
9
- if (_client) return _client
10
-
11
- const baseURL =
12
- import.meta.env.VITE_BASE_URL_COMMUNITY ||
13
- import.meta.env.VITE_CAMPAIGN_API_URL ||
14
- import.meta.env.VITE_BASE_URL_NETWORK ||
15
- import.meta.env.VITE_API_BASE_URL ||
16
- ""
17
-
18
- _client = axios.create({ baseURL, withCredentials: true })
19
-
20
- _client.interceptors.request.use((config) => {
21
- if (
22
- import.meta.env.VITE_APP_ENV !== "production" &&
23
- typeof window !== "undefined" &&
24
- import.meta.env.VITE_BEARER_TOKEN
25
- ) {
26
- config.headers.Authorization = `Bearer ${import.meta.env.VITE_BEARER_TOKEN}`
27
- }
28
- return config
29
- })
30
-
31
- return _client
32
- }
33
-
34
- const client = new Proxy({} as AxiosInstance, {
35
- get(_t, prop) {
36
- return (getClient() as any)[prop]
37
- },
38
- })
39
-
40
- export interface GameImage {
41
- url_image_src: string
42
- }
43
-
44
- export interface GameVideo {
45
- url_youtube: string
46
- }
47
-
48
- export const fetchDetailGameImage = (lang: string, slug: string) =>
49
- client.get<{ data: GameImage[] }>(`/${lang}/games/details/${slug}/images`)
50
-
51
- export const fetchDetailGameVideo = (lang: string, slug: string) =>
52
- client.get<{ data: GameVideo[] }>(`/${lang}/games/details/${slug}/videos`)