@fastr-pro/global-header 1.0.14 → 1.0.15
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +68 -37
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3397,7 +3397,8 @@ function Ht(e) {
|
|
|
3397
3397
|
return e;
|
|
3398
3398
|
}
|
|
3399
3399
|
}
|
|
3400
|
-
|
|
3400
|
+
var Ut = null, Wt = null;
|
|
3401
|
+
function Gt({ config: e, authApiUrl: t, authRedirectUrl: l, redirectOnInvalidSession: d, profileGetter: f, uiTheme: m, apps: h, user: g, logout: _, theme: v, setTheme: x, onThemeChange: S, currentApp: C, navigate: w, onNavigate: T, urls: E = {}, logo: re, onLogoClick: O, categoryData: k = [], chartingCallbacks: oe = {}, products: se, extraRightContent: ce, className: le }) {
|
|
3401
3402
|
let P = i(() => {
|
|
3402
3403
|
let n = {
|
|
3403
3404
|
...t ? { authApiUrl: t } : {},
|
|
@@ -3466,46 +3467,50 @@ function Ut({ config: e, authApiUrl: t, authRedirectUrl: l, redirectOnInvalidSes
|
|
|
3466
3467
|
L,
|
|
3467
3468
|
ue
|
|
3468
3469
|
]);
|
|
3469
|
-
let B = g === void 0 ? P.user === void 0 ? me : P.user : g, [ye, V] = o(() => Array.isArray(k) && k.length > 0 ? k : Pt);
|
|
3470
|
+
let B = g === void 0 ? P.user === void 0 ? me : P.user : g, [ye, V] = o(() => Array.isArray(k) && k.length > 0 ? k : Ut || Pt);
|
|
3470
3471
|
r(() => {
|
|
3471
3472
|
if (Array.isArray(k) && k.length > 0) {
|
|
3472
3473
|
V(k);
|
|
3473
3474
|
return;
|
|
3474
3475
|
}
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
}
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
}
|
|
3476
|
+
if (Ut) {
|
|
3477
|
+
V(Ut);
|
|
3478
|
+
return;
|
|
3479
|
+
}
|
|
3480
|
+
let e = !0, t = P.apps?.macro?.categoriesApiUrl || "https://macropulse-pro-api.datatokenapi.com/api/categories";
|
|
3481
|
+
return Wt ||= fetch(t, { credentials: "include" }).then(async (e) => {
|
|
3482
|
+
if (e.ok) {
|
|
3483
|
+
let t = await e.json(), n = Array.isArray(t) ? t : t?.data || t?.categories || [];
|
|
3484
|
+
if (Array.isArray(n) && n.length > 0) {
|
|
3485
|
+
let e = n.map((e) => {
|
|
3486
|
+
let t = e.id || e._id || e.slug || (e.name || "").toLowerCase().replace(/\s+/g, "_"), n = e.id || e._id || t, r = e.name || e.title || e.label || t, i = Pt.find((e) => e.id === t || e.dbId === n || e.label?.toLowerCase() === r.toLowerCase() || e.value?.toLowerCase() === r.toLowerCase()), a = (e.indicators || e.items || e.sections || i?.items || []).map((e, t) => ({
|
|
3487
|
+
id: e.id || e.slug || `indicator_${t}`,
|
|
3488
|
+
title: e.title || e.name || e.label || "Indicator",
|
|
3489
|
+
desc: e.desc || e.description || e.subtitle || "Lorem ipsum dolor sit amet , consectetuer adipiscing elit...",
|
|
3490
|
+
route: `/${n}`,
|
|
3491
|
+
queryParams: e.id || e.slug ? { indicator: e.id || e.slug } : void 0
|
|
3492
|
+
}));
|
|
3493
|
+
return {
|
|
3494
|
+
id: t,
|
|
3495
|
+
label: r,
|
|
3496
|
+
value: r,
|
|
3497
|
+
dbId: n,
|
|
3498
|
+
route: `/${n}`,
|
|
3499
|
+
icon: i?.icon || ie,
|
|
3500
|
+
description: e.description || e.desc || i?.description || "",
|
|
3501
|
+
items: a
|
|
3502
|
+
};
|
|
3503
|
+
});
|
|
3504
|
+
if (e.length > 0) return Ut = e, e;
|
|
3503
3505
|
}
|
|
3504
|
-
}
|
|
3505
|
-
|
|
3506
|
+
}
|
|
3507
|
+
return null;
|
|
3508
|
+
}).catch((e) => (console.warn("[GlobalHeader] fetchMacroCategories error:", e), null)), Wt.then((t) => {
|
|
3509
|
+
e && t && t.length > 0 && V(t);
|
|
3510
|
+
}), () => {
|
|
3506
3511
|
e = !1;
|
|
3507
3512
|
};
|
|
3508
|
-
}, [
|
|
3513
|
+
}, []);
|
|
3509
3514
|
let be = (e) => {
|
|
3510
3515
|
let t = B?.all_apps || B?.apps || [], n = (e || "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
3511
3516
|
return t.find((t) => {
|
|
@@ -3610,9 +3615,35 @@ function Ut({ config: e, authApiUrl: t, authRedirectUrl: l, redirectOnInvalidSes
|
|
|
3610
3615
|
return null;
|
|
3611
3616
|
}, [B, F]), Ue = n((e, t, n) => {
|
|
3612
3617
|
T ? T(e, t, n) : w && typeof e == "string" && !e.startsWith("http://") && !e.startsWith("https://") ? w(e) : window.location.assign(e);
|
|
3613
|
-
}, [T, w]), We = () => {
|
|
3618
|
+
}, [T, w]), We = async () => {
|
|
3614
3619
|
let e = _ || P.logout;
|
|
3615
|
-
e
|
|
3620
|
+
if (typeof e == "function") try {
|
|
3621
|
+
await Promise.resolve(e());
|
|
3622
|
+
} catch (e) {
|
|
3623
|
+
console.warn("[GlobalHeader] custom logout error:", e);
|
|
3624
|
+
}
|
|
3625
|
+
if (I && typeof window < "u") {
|
|
3626
|
+
let e = I.endsWith("/api") ? `${I}/auth/logout` : `${I}/api/auth/logout`;
|
|
3627
|
+
try {
|
|
3628
|
+
await fetch(e, {
|
|
3629
|
+
method: "POST",
|
|
3630
|
+
credentials: "include",
|
|
3631
|
+
headers: { "Content-Type": "application/json" }
|
|
3632
|
+
}).catch(async () => fetch(e, {
|
|
3633
|
+
method: "GET",
|
|
3634
|
+
credentials: "include"
|
|
3635
|
+
}));
|
|
3636
|
+
} catch (e) {
|
|
3637
|
+
console.warn("[GlobalHeader] SSO logout API error:", e);
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
if (typeof window < "u") {
|
|
3641
|
+
try {
|
|
3642
|
+
localStorage.removeItem("user"), localStorage.removeItem("token"), localStorage.removeItem("auth_token"), sessionStorage.removeItem("user"), sessionStorage.removeItem("token"), sessionStorage.removeItem("auth_token");
|
|
3643
|
+
} catch {}
|
|
3644
|
+
let e = window.location.href, t = `${L}/logout?redirect=${encodeURIComponent(e)}`;
|
|
3645
|
+
window.location.assign(t);
|
|
3646
|
+
}
|
|
3616
3647
|
}, Ge = i(() => {
|
|
3617
3648
|
if (se) return se;
|
|
3618
3649
|
let t = P.apps || {};
|
|
@@ -4270,8 +4301,8 @@ function Ut({ config: e, authApiUrl: t, authRedirectUrl: l, redirectOnInvalidSes
|
|
|
4270
4301
|
}
|
|
4271
4302
|
//#endregion
|
|
4272
4303
|
//#region src/index.js
|
|
4273
|
-
var
|
|
4304
|
+
var Kt = Gt;
|
|
4274
4305
|
//#endregion
|
|
4275
|
-
export { nt as DropdownMenu, at as DropdownMenuContent, ot as DropdownMenuGroup, Q as DropdownMenuItem, st as DropdownMenuLabel, rt as DropdownMenuPortal, ct as DropdownMenuSeparator, it as DropdownMenuTrigger, ve as FasterProLogo,
|
|
4306
|
+
export { nt as DropdownMenu, at as DropdownMenuContent, ot as DropdownMenuGroup, Q as DropdownMenuItem, st as DropdownMenuLabel, rt as DropdownMenuPortal, ct as DropdownMenuSeparator, it as DropdownMenuTrigger, ve as FasterProLogo, Gt as GlobalHeader, Vt as GlobalMegaMenu, $ as NavigationMenu, pt as NavigationMenuContent, gt as NavigationMenuIndicator, ut as NavigationMenuItem, ht as NavigationMenuLink, lt as NavigationMenuList, mt as NavigationMenuPositioner, ft as NavigationMenuTrigger, _t as Popover, yt as PopoverContent, St as PopoverDescription, bt as PopoverHeader, xt as PopoverTitle, vt as PopoverTrigger, kt as appBannerImages, zt as buildItemUrl, Mt as chartingCategories, Z as cn, Lt as createHeaderConfig, Kt as default, It as defaultHeaderConfig, Ft as derivativesCategories, At as getBannerImage, Pt as macroPulseCategories, dt as navigationMenuTriggerStyle, Rt as renderIcon, Nt as scannerCategories, jt as stockXRayCategories, Bt as withThemeParam };
|
|
4276
4307
|
|
|
4277
4308
|
//# sourceMappingURL=index.js.map
|