@mundogamernetwork/shared-ui 1.1.77 → 1.1.79
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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
revealKey,
|
|
11
11
|
requestKey,
|
|
12
12
|
} from "../../services/campaignService"
|
|
13
|
-
import { fetchDetailGameImage
|
|
13
|
+
import { fetchDetailGameImage } from "../../services/gamesService"
|
|
14
14
|
|
|
15
15
|
// Injected by each front — provide in app.vue / a plugin
|
|
16
16
|
const mgPlatform = inject<string>("mgPlatform", "MGTV")
|
|
@@ -115,29 +115,22 @@ const { data: redeemedUsers } = await useAsyncData(
|
|
|
115
115
|
// ------------------------------------------------------------------
|
|
116
116
|
// Game gallery (images/videos)
|
|
117
117
|
// ------------------------------------------------------------------
|
|
118
|
+
// Videos are already embedded in the campaign payload (YouTube IDs need no
|
|
119
|
+
// CDN prefix). Screenshots come from the dedicated games endpoint instead —
|
|
120
|
+
// the campaign payload's embedded game.images filenames aren't CDN-resolved,
|
|
121
|
+
// unlike this endpoint's response (same one tv-frontend's production
|
|
122
|
+
// gameDetails.ts already relies on).
|
|
123
|
+
const gameDetailsVideos = computed(() => campaign.value?.game_videos || [])
|
|
124
|
+
|
|
118
125
|
const { data: gameDetailsImages } = await useAsyncData(
|
|
119
126
|
`campaign-game-images-${slug}`,
|
|
120
127
|
async () => {
|
|
121
|
-
if (!campaign.value?.game_slug) return
|
|
128
|
+
if (!campaign.value?.game_slug) return []
|
|
122
129
|
try {
|
|
123
130
|
const response = await fetchDetailGameImage(locale.value, campaign.value.game_slug)
|
|
124
|
-
return response.data.data ||
|
|
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
|
|
131
|
+
return response.data.data || []
|
|
139
132
|
} catch {
|
|
140
|
-
return
|
|
133
|
+
return []
|
|
141
134
|
}
|
|
142
135
|
},
|
|
143
136
|
{ watch: [campaign] },
|
|
@@ -640,10 +633,10 @@ onMounted(async () => {
|
|
|
640
633
|
v-for="(video, index) in gameDetailsVideos.slice(0, 1)"
|
|
641
634
|
:key="'video-' + index"
|
|
642
635
|
class="video-thumbnail"
|
|
643
|
-
@click="openVideoPlayer('https://www.youtube.com/embed/' + video.
|
|
636
|
+
@click="openVideoPlayer('https://www.youtube.com/embed/' + video.external_id)"
|
|
644
637
|
>
|
|
645
638
|
<img
|
|
646
|
-
:src="'https://img.youtube.com/vi/' + video.
|
|
639
|
+
:src="'https://img.youtube.com/vi/' + video.external_id + '/hqdefault.jpg'"
|
|
647
640
|
:alt="$t('common.video_thumbnail')"
|
|
648
641
|
/>
|
|
649
642
|
<div class="play-icon">
|
|
@@ -282,6 +282,7 @@ 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_videos: (k.game?.videos || []) as Array<{ external_id: string; name?: string }>,
|
|
285
286
|
request_id: k.requests?.[0]?.id,
|
|
286
287
|
request_item_id: k.requests?.[0]?.key_item_id,
|
|
287
288
|
request_admin_notes: k.requests?.[0]?.admin_notes ?? null,
|
package/services/gamesService.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import axios, { type AxiosInstance } from "axios"
|
|
2
2
|
|
|
3
|
-
// Game catalog service (
|
|
4
|
-
//
|
|
3
|
+
// Game catalog service (screenshots with CDN-resolved URLs) shared across the
|
|
4
|
+
// network. The keys/campaign API embeds raw game.images filenames without the
|
|
5
|
+
// CDN prefix, so screenshots must come from this dedicated endpoint instead
|
|
6
|
+
// (same one tv-frontend's services/games/gameDetails.ts already calls in
|
|
7
|
+
// production — mirrors that pattern rather than reinventing it).
|
|
5
8
|
|
|
6
9
|
let _client: AxiosInstance | null = null
|
|
7
10
|
|
|
@@ -10,9 +13,9 @@ function getClient(): AxiosInstance {
|
|
|
10
13
|
|
|
11
14
|
const baseURL =
|
|
12
15
|
import.meta.env.VITE_BASE_URL_COMMUNITY ||
|
|
16
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
13
17
|
import.meta.env.VITE_CAMPAIGN_API_URL ||
|
|
14
18
|
import.meta.env.VITE_BASE_URL_NETWORK ||
|
|
15
|
-
import.meta.env.VITE_API_BASE_URL ||
|
|
16
19
|
""
|
|
17
20
|
|
|
18
21
|
_client = axios.create({ baseURL, withCredentials: true })
|
|
@@ -41,12 +44,5 @@ export interface GameImage {
|
|
|
41
44
|
url_image_src: string
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
export interface GameVideo {
|
|
45
|
-
url_youtube: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
47
|
export const fetchDetailGameImage = (lang: string, slug: string) =>
|
|
49
48
|
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`)
|