@mundogamernetwork/shared-ui 1.0.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 +283 -0
- package/components/PressKit/AssetGallery.vue +349 -0
- package/components/PressKit/Awards.vue +100 -0
- package/components/PressKit/Credits.vue +78 -0
- package/components/PressKit/FactSheet.vue +204 -0
- package/components/PressKit/Hero.vue +143 -0
- package/components/PressKit/Quotes.vue +80 -0
- package/components/PressKit/VideoPlayer.vue +134 -0
- package/components/checkout/MgCartItemList.vue +214 -0
- package/components/checkout/MgCartSummary.vue +204 -0
- package/components/checkout/MgCheckoutSidebar.vue +230 -0
- package/components/checkout/MgGuestEmailForm.vue +97 -0
- package/components/checkout/MgPaymentMethodSelector.vue +162 -0
- package/components/checkout/MgPixQRCode.vue +222 -0
- package/components/indie-wall/IndieWallLeaderboard.vue +208 -0
- package/components/indie-wall/MuralCanvas.vue +481 -0
- package/components/indie-wall/StepBlock.vue +314 -0
- package/components/indie-wall/StepCustomize.vue +530 -0
- package/components/indie-wall/StepGoal.vue +169 -0
- package/components/indie-wall/StepPackage.vue +145 -0
- package/components/indie-wall/StepPay.vue +209 -0
- package/components/indie-wall/SupportStepper.vue +372 -0
- package/components/invoices/MgInvoiceDownload.vue +50 -0
- package/components/pricing/MgBillingToggle.vue +74 -0
- package/components/pricing/MgPricingCard.vue +245 -0
- package/components/ui/Header/MgMessageCard.vue +147 -0
- package/components/ui/Header/MgMessageModal.vue +414 -0
- package/components/ui/Header/MgNotificationCard.vue +200 -0
- package/components/ui/Header/MgNotificationsModal.vue +125 -0
- package/components/ui/MgAnnouncementBanner.vue +147 -0
- package/components/ui/MgBanners.vue +23 -0
- package/components/ui/MgHeaderComponent.vue +283 -0
- package/components/ui/MgHeaderUIConfig.vue +225 -0
- package/components/ui/MgHeaderUIUser.vue +301 -0
- package/components/ui/MgLoginModal.vue +156 -0
- package/components/ui/MgPromotionBanner.vue +185 -0
- package/composables/useLogout.ts +42 -0
- package/composables/useMgCheckout.ts +287 -0
- package/composables/useMgUserNotifications.ts +122 -0
- package/composables/usePaymentMethods.ts +75 -0
- package/composables/useSubscription.ts +163 -0
- package/middleware/auth.global.ts +40 -0
- package/nuxt.config.ts +31 -0
- package/package.json +40 -0
- package/pages/[slug]/index.vue +112 -0
- package/pages/about.vue +133 -0
- package/pages/blog.vue +430 -0
- package/pages/careers.vue +329 -0
- package/pages/contact.vue +339 -0
- package/pages/faq.vue +317 -0
- package/pages/health-check.vue +20 -0
- package/pages/icons.vue +58 -0
- package/pages/magazine/[slug].vue +209 -0
- package/pages/magazine/index.vue +267 -0
- package/pages/media-kit/[slug].vue +625 -0
- package/pages/mural/[slug].vue +1058 -0
- package/pages/partners.vue +290 -0
- package/pages/press.vue +237 -0
- package/pages/presskit/[slug].vue +191 -0
- package/pages/roadmap.vue +355 -0
- package/pages/status.vue +199 -0
- package/pages/team.vue +266 -0
- package/pages/wall/[slug].vue +11 -0
- package/plugins/auth.client.ts +17 -0
- package/plugins/echo.client.ts +132 -0
- package/services/authService.ts +95 -0
- package/services/chatService.ts +53 -0
- package/services/contactService.ts +35 -0
- package/services/documentService.ts +16 -0
- package/services/httpService.ts +95 -0
- package/services/indieWallService.ts +174 -0
- package/services/institutionalService.ts +248 -0
- package/services/mediaKitService.ts +51 -0
- package/services/notificationsService.ts +20 -0
- package/services/pressKitService.ts +55 -0
- package/stores/announcement.ts +129 -0
- package/stores/auth.ts +86 -0
- package/stores/chat.ts +150 -0
- package/stores/contact.ts +28 -0
- package/stores/document.ts +27 -0
- package/stores/index.ts +34 -0
- package/stores/institutional.ts +231 -0
- package/stores/login.ts +27 -0
- package/stores/notifications.ts +133 -0
- package/stores/promotion.ts +154 -0
- package/types/index.ts +135 -0
- package/utils/serialize.ts +29 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { UseFetchOptions } from "#app";
|
|
2
|
+
import axios, { type AxiosInstance } from "axios";
|
|
3
|
+
|
|
4
|
+
let _httpService: AxiosInstance | null = null;
|
|
5
|
+
|
|
6
|
+
export function getHttpService(): AxiosInstance {
|
|
7
|
+
if (_httpService) return _httpService;
|
|
8
|
+
|
|
9
|
+
_httpService = axios.create({
|
|
10
|
+
baseURL: import.meta.env.VITE_API_BASE_URL,
|
|
11
|
+
withCredentials: true,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
_httpService.interceptors.response.use(
|
|
15
|
+
(response) => response,
|
|
16
|
+
(error) => {
|
|
17
|
+
if (typeof window !== "undefined" && error?.response) {
|
|
18
|
+
const status = error.response.status;
|
|
19
|
+
const url = error.config?.url ?? "";
|
|
20
|
+
const isAuthEndpoint = url.includes("/auth/");
|
|
21
|
+
|
|
22
|
+
if (!isAuthEndpoint && (status === 403 || status === 500 || status === 502 || status === 503)) {
|
|
23
|
+
console.error(`[HTTP] Error ${status}:`, error.response?.data?.message || "");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return Promise.reject(error);
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
_httpService.interceptors.request.use((config) => {
|
|
31
|
+
const SUPPORTED_LOCALES = ["en", "pt-BR", "es", "de", "ro"];
|
|
32
|
+
const _seg = typeof location === "undefined" ? "" : location.pathname.split("/")[1] || "";
|
|
33
|
+
const lang = SUPPORTED_LOCALES.includes(_seg) ? _seg : "en";
|
|
34
|
+
|
|
35
|
+
config.withCredentials = true;
|
|
36
|
+
config.params = { ...config.params, lang };
|
|
37
|
+
|
|
38
|
+
if (import.meta.env.VITE_APP_ENV !== "production" && typeof window !== "undefined") {
|
|
39
|
+
if (import.meta.env.VITE_BEARER_TOKEN) {
|
|
40
|
+
config.headers.Authorization = `Bearer ${import.meta.env.VITE_BEARER_TOKEN}`;
|
|
41
|
+
}
|
|
42
|
+
config.headers.set("X-Timezone", Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return _httpService;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const httpService = new Proxy({} as AxiosInstance, {
|
|
52
|
+
get(_target, prop) {
|
|
53
|
+
return (getHttpService() as any)[prop];
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
export default httpService;
|
|
58
|
+
|
|
59
|
+
export function mgApiUrl(endpoint: string, usePrefix = true) {
|
|
60
|
+
const locale = useNuxtApp().$i18n.locale.value;
|
|
61
|
+
const runtimeConfig = useRuntimeConfig();
|
|
62
|
+
const apiBaseURL = runtimeConfig.public.mgSharedUi?.apiBaseURL || runtimeConfig.public.apiBaseURL;
|
|
63
|
+
|
|
64
|
+
switch (endpoint) {
|
|
65
|
+
case "login":
|
|
66
|
+
case "logout":
|
|
67
|
+
case "register":
|
|
68
|
+
return [apiBaseURL, usePrefix ? locale : "", endpoint]
|
|
69
|
+
.filter((v) => v)
|
|
70
|
+
.map((part) => part.replace(/^\//, ""))
|
|
71
|
+
.map((part) => part.replace(/\/api\/v1$/, ""))
|
|
72
|
+
.join("/");
|
|
73
|
+
default:
|
|
74
|
+
return [apiBaseURL, usePrefix ? locale : "", endpoint]
|
|
75
|
+
.filter((v) => v)
|
|
76
|
+
.map((part) => part.replace(/^\//, ""))
|
|
77
|
+
.join("/");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function useFetchApi<T>(endpoint: string, options?: UseFetchOptions<T>) {
|
|
82
|
+
const url = mgApiUrl(endpoint);
|
|
83
|
+
const runtimeConfig = useRuntimeConfig();
|
|
84
|
+
const headers = useRequestHeaders(["cookie", "authorization"]);
|
|
85
|
+
|
|
86
|
+
if (process.env.NODE_ENV === "development" && runtimeConfig.appEnvToken)
|
|
87
|
+
headers["authorization"] = `Bearer ${runtimeConfig.appEnvToken}`;
|
|
88
|
+
|
|
89
|
+
const defaultOptions = {
|
|
90
|
+
credentials: "include",
|
|
91
|
+
headers: headers,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return $fetch<T>(url, { ...defaultOptions, ...options } as any);
|
|
95
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import axios, { type AxiosInstance } from "axios"
|
|
2
|
+
|
|
3
|
+
// Build a dedicated HTTP client for indie-wall calls.
|
|
4
|
+
// Community-frontend points VITE_INDIE_WALL_API_URL at its main API (api-main).
|
|
5
|
+
// TV / agency leave it unset → falls back to their own VITE_API_BASE_URL.
|
|
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_INDIE_WALL_API_URL ||
|
|
13
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
14
|
+
""
|
|
15
|
+
|
|
16
|
+
_client = axios.create({ baseURL, withCredentials: true })
|
|
17
|
+
|
|
18
|
+
_client.interceptors.request.use((config) => {
|
|
19
|
+
const SUPPORTED_LOCALES = ["en", "pt-BR", "es", "de", "ro", "ar-AE"]
|
|
20
|
+
const seg =
|
|
21
|
+
typeof location === "undefined" ? "" : location.pathname.split("/")[1] || ""
|
|
22
|
+
const lang = SUPPORTED_LOCALES.includes(seg) ? seg : "en"
|
|
23
|
+
config.params = { ...config.params, lang }
|
|
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
|
+
// Lazy proxy so the client is only built after env is resolved.
|
|
38
|
+
const iw = new Proxy({} as AxiosInstance, {
|
|
39
|
+
get(_t, prop) {
|
|
40
|
+
return (getClient() as any)[prop]
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export default iw
|
|
45
|
+
|
|
46
|
+
// ── Public / supporter-facing ──────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
export const fetchPublicWall = (slug: string | number) =>
|
|
49
|
+
iw.get(`/api/v1/indie-walls/${slug}`)
|
|
50
|
+
|
|
51
|
+
export const fetchPublicWallGoals = (wallId: string | number) =>
|
|
52
|
+
iw.get(`/api/v1/indie-walls/${wallId}/goals`)
|
|
53
|
+
|
|
54
|
+
export const getWallSupporters = (
|
|
55
|
+
wallId: string | number,
|
|
56
|
+
params?: Record<string, any>,
|
|
57
|
+
) => {
|
|
58
|
+
const q = params
|
|
59
|
+
? "?" +
|
|
60
|
+
new URLSearchParams(
|
|
61
|
+
Object.entries(params)
|
|
62
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
63
|
+
.map(([k, v]) => [k, String(v)]),
|
|
64
|
+
).toString()
|
|
65
|
+
: ""
|
|
66
|
+
return iw.get(`/api/v1/indie-walls/${wallId}/supporters${q}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const suggestPosition = (
|
|
70
|
+
wallId: string | number,
|
|
71
|
+
width: number,
|
|
72
|
+
height: number,
|
|
73
|
+
) =>
|
|
74
|
+
iw.get(
|
|
75
|
+
`/api/v1/indie-walls/${wallId}/suggest-position?width=${width}&height=${height}`,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
export const supportIndieWall = (
|
|
79
|
+
wallId: string | number,
|
|
80
|
+
data: Record<string, any>,
|
|
81
|
+
) => iw.post(`/api/v1/indie-walls/${wallId}/support`, data)
|
|
82
|
+
|
|
83
|
+
// ── Owner / dashboard ──────────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
export const getIndieWall = (id: number | string) =>
|
|
86
|
+
iw.get(`/api/v1/indie-walls/${id}`)
|
|
87
|
+
|
|
88
|
+
export const getIndieWalls = (params?: Record<string, any>) => {
|
|
89
|
+
const q = params
|
|
90
|
+
? "?" +
|
|
91
|
+
new URLSearchParams(
|
|
92
|
+
Object.entries(params)
|
|
93
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
94
|
+
.map(([k, v]) => [k, String(v)]),
|
|
95
|
+
).toString()
|
|
96
|
+
: ""
|
|
97
|
+
return iw.get(`/api/v1/indie-walls${q}`)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const getMyIndieWalls = () => iw.get("/api/v1/indie-walls/my-walls")
|
|
101
|
+
|
|
102
|
+
export const createIndieWall = (data: Record<string, any>) =>
|
|
103
|
+
iw.post("/api/v1/indie-walls", data)
|
|
104
|
+
|
|
105
|
+
export const updateIndieWall = (
|
|
106
|
+
id: number | string,
|
|
107
|
+
data: Record<string, any>,
|
|
108
|
+
) => iw.put(`/api/v1/indie-walls/${id}`, data)
|
|
109
|
+
|
|
110
|
+
export const deleteIndieWall = (id: number | string) =>
|
|
111
|
+
iw.delete(`/api/v1/indie-walls/${id}`)
|
|
112
|
+
|
|
113
|
+
export const fetchStreamerActiveWalls = (userId: number | string) =>
|
|
114
|
+
iw.get(`/api/v1/users/${userId}/indie-walls`)
|
|
115
|
+
|
|
116
|
+
export const addGoalToWall = (wallId: number | string, data: Record<string, any>) =>
|
|
117
|
+
iw.post(`/api/v1/indie-walls/${wallId}/goals`, data)
|
|
118
|
+
|
|
119
|
+
export const addTierToWall = (wallId: number | string, data: Record<string, any>) =>
|
|
120
|
+
iw.post(`/api/v1/indie-walls/${wallId}/tiers`, data)
|
|
121
|
+
|
|
122
|
+
export const getWidgetToken = (wallId: number | string) =>
|
|
123
|
+
iw.get(`/api/v1/indie-walls/${wallId}/token`)
|
|
124
|
+
|
|
125
|
+
export const generateWidgetToken = (wallId: number | string) =>
|
|
126
|
+
iw.post(`/api/v1/indie-walls/${wallId}/token`)
|
|
127
|
+
|
|
128
|
+
export const revokeWidgetToken = (wallId: number | string) =>
|
|
129
|
+
iw.delete(`/api/v1/indie-walls/${wallId}/token`)
|
|
130
|
+
|
|
131
|
+
export const checkSlugAvailability = (slug: string) =>
|
|
132
|
+
iw.get(`/api/v1/indie-walls/slug-check?slug=${encodeURIComponent(slug)}`)
|
|
133
|
+
|
|
134
|
+
export const getWallEventsUrl = (
|
|
135
|
+
wallId: number | string,
|
|
136
|
+
token: string,
|
|
137
|
+
): string => {
|
|
138
|
+
const baseURL =
|
|
139
|
+
import.meta.env.VITE_INDIE_WALL_API_URL ||
|
|
140
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
141
|
+
""
|
|
142
|
+
return `${baseURL}/api/v1/indie-walls/${wallId}/events?token=${encodeURIComponent(token)}`
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const fetchMyEarnings = () => iw.get("/api/v1/indie-walls/my-earnings")
|
|
146
|
+
|
|
147
|
+
export const requestGlobalPayout = () =>
|
|
148
|
+
iw.post("/api/v1/indie-walls/my-earnings/payout", {})
|
|
149
|
+
|
|
150
|
+
export const getPaymentSettings = (wallId: number | string) =>
|
|
151
|
+
iw.get(`/api/v1/indie-walls/${wallId}/payment-settings`)
|
|
152
|
+
|
|
153
|
+
export const updatePaymentSettings = (
|
|
154
|
+
wallId: number | string,
|
|
155
|
+
data: { payout_delay_days?: 7 | 14 | 30; min_payout_amount?: number },
|
|
156
|
+
) => iw.put(`/api/v1/indie-walls/${wallId}/payment-settings`, data)
|
|
157
|
+
|
|
158
|
+
export const listPayouts = (
|
|
159
|
+
wallId: number | string,
|
|
160
|
+
params?: Record<string, any>,
|
|
161
|
+
) => {
|
|
162
|
+
const q = params
|
|
163
|
+
? "?" +
|
|
164
|
+
new URLSearchParams(
|
|
165
|
+
Object.entries(params)
|
|
166
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
167
|
+
.map(([k, v]) => [k, String(v)]),
|
|
168
|
+
).toString()
|
|
169
|
+
: ""
|
|
170
|
+
return iw.get(`/api/v1/indie-walls/${wallId}/payouts${q}`)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export const requestPayout = (wallId: number | string) =>
|
|
174
|
+
iw.post(`/api/v1/indie-walls/${wallId}/payouts`, {})
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import httpService from "./httpService";
|
|
2
|
+
import { serialize } from "../utils/serialize";
|
|
3
|
+
|
|
4
|
+
interface NestedObject {
|
|
5
|
+
[key: string]: string | string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface SerializeObject {
|
|
9
|
+
[key: string]: string | NestedObject;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const getNetworkBaseUrl = () => {
|
|
13
|
+
const config = useRuntimeConfig();
|
|
14
|
+
return config.public.mgSharedUi?.networkBaseUrl || import.meta.env.VITE_BASE_URL_NETWORK;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const complexSerialize = function (obj: SerializeObject): string {
|
|
18
|
+
const searchParams = new URLSearchParams();
|
|
19
|
+
|
|
20
|
+
const appendObject = (baseKey: string, object: NestedObject | any) => {
|
|
21
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
22
|
+
if (typeof value === "object" && value !== null) {
|
|
23
|
+
appendObject(`${baseKey}[${key}]`, value);
|
|
24
|
+
} else {
|
|
25
|
+
searchParams.append(`${baseKey}[${key}]`, value.toString());
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
for (const key in obj) {
|
|
31
|
+
const item = obj[key];
|
|
32
|
+
if (Array.isArray(item)) {
|
|
33
|
+
item.forEach((arrayItem: any, index: number) => {
|
|
34
|
+
if (typeof arrayItem === "object" && arrayItem !== null) {
|
|
35
|
+
appendObject(`${key}[${index}]`, arrayItem);
|
|
36
|
+
} else {
|
|
37
|
+
searchParams.append(`${key}[${index}]`, arrayItem.toString());
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
} else if (typeof item === "object" && item !== null) {
|
|
41
|
+
appendObject(key, item);
|
|
42
|
+
} else {
|
|
43
|
+
searchParams.append(key, item.toString());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return `?${decodeURIComponent(searchParams.toString())}`;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const fetchPress = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
51
|
+
params["filter[language]"] = lang;
|
|
52
|
+
const paramsSerialized = serialize(params);
|
|
53
|
+
return httpService({
|
|
54
|
+
url: `/press-posts${paramsSerialized}`,
|
|
55
|
+
baseURL: getNetworkBaseUrl(),
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const fetchCareer = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
60
|
+
const paramsSerialized = serialize(params);
|
|
61
|
+
return httpService({
|
|
62
|
+
url: `/careers${paramsSerialized}`,
|
|
63
|
+
baseURL: getNetworkBaseUrl(),
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const fetchStatus = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
68
|
+
params["filter[language]"] = lang;
|
|
69
|
+
const paramsSerialized = serialize(params);
|
|
70
|
+
return httpService({
|
|
71
|
+
url: `/network-systems${paramsSerialized}`,
|
|
72
|
+
baseURL: getNetworkBaseUrl(),
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const fetchGeneralStatus = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
77
|
+
params["filter[language]"] = lang;
|
|
78
|
+
const paramsSerialized = serialize(params);
|
|
79
|
+
return httpService({
|
|
80
|
+
url: `/network-systems-general-status${paramsSerialized}`,
|
|
81
|
+
baseURL: getNetworkBaseUrl(),
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const fetchRoadmap = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
86
|
+
params["filter[language]"] = lang;
|
|
87
|
+
const paramsSerialized = serialize(params);
|
|
88
|
+
return httpService({
|
|
89
|
+
url: `/roadmaps-public${paramsSerialized}`,
|
|
90
|
+
baseURL: getNetworkBaseUrl(),
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const fetchCountry = async (params: SerializeObject): Promise<any> => {
|
|
95
|
+
const paramsSerialized = serialize(params);
|
|
96
|
+
return httpService({
|
|
97
|
+
url: `/careers-countries${paramsSerialized}`,
|
|
98
|
+
baseURL: getNetworkBaseUrl(),
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const fetchDepartment = async (params: SerializeObject): Promise<any> => {
|
|
103
|
+
const paramsSerialized = serialize(params);
|
|
104
|
+
return httpService({
|
|
105
|
+
url: `/operational-area-careers${paramsSerialized}`,
|
|
106
|
+
baseURL: getNetworkBaseUrl(),
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export const fetchTeam = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
111
|
+
const paramsSerialized = serialize(params);
|
|
112
|
+
return httpService({
|
|
113
|
+
url: `/teams-members-public${paramsSerialized}`,
|
|
114
|
+
baseURL: getNetworkBaseUrl(),
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const fetchOperationalArea = async (params: SerializeObject): Promise<any> => {
|
|
119
|
+
const paramsSerialized = serialize(params);
|
|
120
|
+
return httpService({
|
|
121
|
+
url: `/operational-areas-public${paramsSerialized}`,
|
|
122
|
+
baseURL: getNetworkBaseUrl(),
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const fetchPartner = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
127
|
+
const paramsSerialized = serialize(params);
|
|
128
|
+
return httpService({
|
|
129
|
+
url: `/partners-public${paramsSerialized}`,
|
|
130
|
+
baseURL: getNetworkBaseUrl(),
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const fetchBlog = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
135
|
+
params["filter[language]"] = lang;
|
|
136
|
+
const paramsSerialized = serialize(params);
|
|
137
|
+
return httpService({
|
|
138
|
+
url: `/blog-posts${paramsSerialized}`,
|
|
139
|
+
baseURL: getNetworkBaseUrl(),
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export const fetchBlogCategory = async (params: SerializeObject): Promise<any> => {
|
|
144
|
+
const paramsSerialized = serialize(params);
|
|
145
|
+
return httpService({
|
|
146
|
+
url: `/blog-categories${paramsSerialized}`,
|
|
147
|
+
baseURL: getNetworkBaseUrl(),
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const fetchBlogTag = async (params: SerializeObject): Promise<any> => {
|
|
152
|
+
const paramsSerialized = serialize(params);
|
|
153
|
+
return httpService({
|
|
154
|
+
url: `/blog-tags${paramsSerialized}`,
|
|
155
|
+
baseURL: getNetworkBaseUrl(),
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const fetchFaq = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
160
|
+
const paramsSerialized = serialize(params);
|
|
161
|
+
return httpService({
|
|
162
|
+
url: `/faq${paramsSerialized}`,
|
|
163
|
+
baseURL: getNetworkBaseUrl(),
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const fetchMagazine = async (params: SerializeObject): Promise<any> => {
|
|
168
|
+
const paramsSerialized = serialize(params);
|
|
169
|
+
return httpService({
|
|
170
|
+
url: `/public/magazines${paramsSerialized}`,
|
|
171
|
+
baseURL: getNetworkBaseUrl(),
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export const fetchMagazines = async (id: number): Promise<any> => {
|
|
176
|
+
return httpService({
|
|
177
|
+
url: `/public/magazines/${id}`,
|
|
178
|
+
baseURL: getNetworkBaseUrl(),
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const getMagazine = async (magazine: string): Promise<any> => {
|
|
183
|
+
return httpService({
|
|
184
|
+
url: `/public/magazines/${magazine}`,
|
|
185
|
+
baseURL: getNetworkBaseUrl(),
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const getMagazinePages = async (slug: string): Promise<any> => {
|
|
190
|
+
return httpService({
|
|
191
|
+
url: `/public/magazines/${slug}/pages`,
|
|
192
|
+
baseURL: getNetworkBaseUrl(),
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const trackMagazineAnalytic = async (slug: string, eventType: string): Promise<any> => {
|
|
197
|
+
return httpService({
|
|
198
|
+
url: `/public/magazines/${slug}/analytics`,
|
|
199
|
+
baseURL: getNetworkBaseUrl(),
|
|
200
|
+
method: "POST",
|
|
201
|
+
data: { event_type: eventType },
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const captureMagazineLead = async (slug: string, name: string, email: string): Promise<any> => {
|
|
206
|
+
return httpService({
|
|
207
|
+
url: `/public/magazines/${slug}/leads`,
|
|
208
|
+
baseURL: getNetworkBaseUrl(),
|
|
209
|
+
method: "POST",
|
|
210
|
+
data: { name, email },
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const fetchLanguage = async (params: SerializeObject): Promise<any> => {
|
|
215
|
+
const paramsSerialized = serialize(params);
|
|
216
|
+
return httpService({
|
|
217
|
+
url: `/languages${paramsSerialized}`,
|
|
218
|
+
baseURL: getNetworkBaseUrl(),
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const storeNewsletter = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
223
|
+
params["filter[language]"] = lang;
|
|
224
|
+
const paramsSerialized = serialize(params);
|
|
225
|
+
return httpService({
|
|
226
|
+
url: `/newsletters${paramsSerialized}`,
|
|
227
|
+
baseURL: getNetworkBaseUrl(),
|
|
228
|
+
method: "POST",
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const fetchNewsletter = async (lang: string, params: SerializeObject): Promise<any> => {
|
|
233
|
+
params["filter[language]"] = lang;
|
|
234
|
+
const paramsSerialized = complexSerialize(params);
|
|
235
|
+
return httpService({
|
|
236
|
+
url: `/newsletters${paramsSerialized}`,
|
|
237
|
+
baseURL: getNetworkBaseUrl(),
|
|
238
|
+
method: "POST",
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export const fetchTopCompany = async (params: SerializeObject): Promise<any> => {
|
|
243
|
+
const paramsSerialized = serialize(params);
|
|
244
|
+
return httpService({
|
|
245
|
+
url: `/companies/top${paramsSerialized}`,
|
|
246
|
+
baseURL: import.meta.env.VITE_API_BASE_URL,
|
|
247
|
+
});
|
|
248
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import axios, { type AxiosInstance } from "axios"
|
|
2
|
+
|
|
3
|
+
// Media-kit data lives in the TV API.
|
|
4
|
+
// TV / agency leave VITE_MEDIA_KIT_API_URL unset → fall back to VITE_API_BASE_URL.
|
|
5
|
+
// Community sets VITE_MEDIA_KIT_API_URL=https://api-tv.mgnetwork.xyz
|
|
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_MEDIA_KIT_API_URL ||
|
|
13
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
14
|
+
""
|
|
15
|
+
|
|
16
|
+
_client = axios.create({ baseURL, withCredentials: true })
|
|
17
|
+
|
|
18
|
+
_client.interceptors.request.use((config) => {
|
|
19
|
+
const SUPPORTED_LOCALES = ["en", "pt-BR", "es", "de", "ro", "ar-AE"]
|
|
20
|
+
const seg =
|
|
21
|
+
typeof location === "undefined" ? "" : location.pathname.split("/")[1] || ""
|
|
22
|
+
const lang = SUPPORTED_LOCALES.includes(seg) ? seg : "en"
|
|
23
|
+
config.params = { ...config.params, lang }
|
|
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 mk = new Proxy({} as AxiosInstance, {
|
|
38
|
+
get(_t, prop) {
|
|
39
|
+
return (getClient() as any)[prop]
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
export default mk
|
|
44
|
+
|
|
45
|
+
export const fetchPublicMediaKit = (slug: string) =>
|
|
46
|
+
mk.get(`/api/v1/media-kit/${slug}`)
|
|
47
|
+
|
|
48
|
+
export const trackMediaKitEvent = (
|
|
49
|
+
userId: number | string,
|
|
50
|
+
data: { type?: "view" | "click" | "download" | "contact"; referrer?: string } = {},
|
|
51
|
+
) => mk.post(`/api/v1/media-kit/${userId}/track`, data)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import httpService from "./httpService";
|
|
2
|
+
import { serialize, type SerializeObject } from "../utils/serialize";
|
|
3
|
+
|
|
4
|
+
export const getAllNotifications = async (params: SerializeObject): Promise<any> => {
|
|
5
|
+
const paramsSerialized: string = serialize(params);
|
|
6
|
+
return await httpService.get(`/public/user/notifications${paramsSerialized}`);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const markNotificationAsRead = async (notificationId: string): Promise<any> => {
|
|
10
|
+
return await httpService.get(`/public/user/notifications/${notificationId}`);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const markAllNotificationsAsRead = async (): Promise<any> => {
|
|
14
|
+
const response = await httpService.post(`/public/user/notifications/mark-all-as-read`);
|
|
15
|
+
if (response.status === 200) return response.data;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const deleteNotification = async (notificationId: string): Promise<any> => {
|
|
19
|
+
return await httpService.delete(`/public/user/notifications/${notificationId}`);
|
|
20
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import axios, { type AxiosInstance } from "axios"
|
|
2
|
+
|
|
3
|
+
// Press-kit data lives in the Agency API.
|
|
4
|
+
// Agency leaves VITE_PRESS_KIT_API_URL unset → falls back to VITE_API_BASE_URL.
|
|
5
|
+
// Community sets VITE_PRESS_KIT_API_URL=https://api-agency.mgnetwork.xyz/api/v1
|
|
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_PRESS_KIT_API_URL ||
|
|
13
|
+
import.meta.env.VITE_API_BASE_URL ||
|
|
14
|
+
""
|
|
15
|
+
|
|
16
|
+
_client = axios.create({ baseURL, withCredentials: true })
|
|
17
|
+
|
|
18
|
+
_client.interceptors.request.use((config) => {
|
|
19
|
+
const SUPPORTED_LOCALES = ["en", "pt-BR", "es", "de", "ro", "ar-AE"]
|
|
20
|
+
const seg =
|
|
21
|
+
typeof location === "undefined" ? "" : location.pathname.split("/")[1] || ""
|
|
22
|
+
const lang = SUPPORTED_LOCALES.includes(seg) ? seg : "en"
|
|
23
|
+
config.params = { ...config.params, lang }
|
|
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 pk = new Proxy({} as AxiosInstance, {
|
|
38
|
+
get(_t, prop) {
|
|
39
|
+
return (getClient() as any)[prop]
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
export default pk
|
|
44
|
+
|
|
45
|
+
export const fetchPublicPressKit = (slug: string) =>
|
|
46
|
+
pk.get(`/public/press-kits/${slug}?include=assets,videos,credits,awards,quotes`)
|
|
47
|
+
|
|
48
|
+
export const trackPressKitEvent = (
|
|
49
|
+
slug: string,
|
|
50
|
+
data: {
|
|
51
|
+
event_type: "view" | "click" | "download" | "contact"
|
|
52
|
+
referrer?: string
|
|
53
|
+
metadata?: Record<string, any>
|
|
54
|
+
},
|
|
55
|
+
) => pk.post(`/public/press-kits/${slug}/analytics`, data)
|