@mundogamernetwork/shared-ui 1.1.78 → 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,6 +10,7 @@ import {
|
|
|
10
10
|
revealKey,
|
|
11
11
|
requestKey,
|
|
12
12
|
} from "../../services/campaignService"
|
|
13
|
+
import { fetchDetailGameImage } from "../../services/gamesService"
|
|
13
14
|
|
|
14
15
|
// Injected by each front — provide in app.vue / a plugin
|
|
15
16
|
const mgPlatform = inject<string>("mgPlatform", "MGTV")
|
|
@@ -112,11 +113,29 @@ const { data: redeemedUsers } = await useAsyncData(
|
|
|
112
113
|
)
|
|
113
114
|
|
|
114
115
|
// ------------------------------------------------------------------
|
|
115
|
-
// Game gallery (images/videos)
|
|
116
|
+
// Game gallery (images/videos)
|
|
116
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).
|
|
118
123
|
const gameDetailsVideos = computed(() => campaign.value?.game_videos || [])
|
|
119
124
|
|
|
125
|
+
const { data: gameDetailsImages } = await useAsyncData(
|
|
126
|
+
`campaign-game-images-${slug}`,
|
|
127
|
+
async () => {
|
|
128
|
+
if (!campaign.value?.game_slug) return []
|
|
129
|
+
try {
|
|
130
|
+
const response = await fetchDetailGameImage(locale.value, campaign.value.game_slug)
|
|
131
|
+
return response.data.data || []
|
|
132
|
+
} catch {
|
|
133
|
+
return []
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{ watch: [campaign] },
|
|
137
|
+
)
|
|
138
|
+
|
|
120
139
|
const showVideoModal = ref(false)
|
|
121
140
|
const selectedVideoUrl = ref("")
|
|
122
141
|
const showImageModal = ref(false)
|
|
@@ -282,7 +282,6 @@ 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
285
|
game_videos: (k.game?.videos || []) as Array<{ external_id: string; name?: string }>,
|
|
287
286
|
request_id: k.requests?.[0]?.id,
|
|
288
287
|
request_item_id: k.requests?.[0]?.key_item_id,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import axios, { type AxiosInstance } from "axios"
|
|
2
|
+
|
|
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).
|
|
8
|
+
|
|
9
|
+
let _client: AxiosInstance | null = null
|
|
10
|
+
|
|
11
|
+
function getClient(): AxiosInstance {
|
|
12
|
+
if (_client) return _client
|
|
13
|
+
|
|
14
|
+
const baseURL =
|
|
15
|
+
import.meta.env.VITE_BASE_URL_COMMUNITY ||
|
|
16
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
17
|
+
import.meta.env.VITE_CAMPAIGN_API_URL ||
|
|
18
|
+
import.meta.env.VITE_BASE_URL_NETWORK ||
|
|
19
|
+
""
|
|
20
|
+
|
|
21
|
+
_client = axios.create({ baseURL, withCredentials: true })
|
|
22
|
+
|
|
23
|
+
_client.interceptors.request.use((config) => {
|
|
24
|
+
if (
|
|
25
|
+
import.meta.env.VITE_APP_ENV !== "production" &&
|
|
26
|
+
typeof window !== "undefined" &&
|
|
27
|
+
import.meta.env.VITE_BEARER_TOKEN
|
|
28
|
+
) {
|
|
29
|
+
config.headers.Authorization = `Bearer ${import.meta.env.VITE_BEARER_TOKEN}`
|
|
30
|
+
}
|
|
31
|
+
return config
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return _client
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const client = new Proxy({} as AxiosInstance, {
|
|
38
|
+
get(_t, prop) {
|
|
39
|
+
return (getClient() as any)[prop]
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
export interface GameImage {
|
|
44
|
+
url_image_src: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const fetchDetailGameImage = (lang: string, slug: string) =>
|
|
48
|
+
client.get<{ data: GameImage[] }>(`/${lang}/games/details/${slug}/images`)
|