@0xchain/header 1.1.0-beta.51 → 1.1.0-beta.53

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.
@@ -26,7 +26,7 @@ function Explorer({ onClick = () => void 0, onExpandChange }) {
26
26
  onClick?.();
27
27
  setAccordionValue("");
28
28
  const url = gotoExplorer({ chain: item.chainSymbol });
29
- const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "";
29
+ const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "";
30
30
  window.location.href = `${baseUrl}${url}`;
31
31
  };
32
32
  useEffect(() => {
package/dist/lib/Logo.js CHANGED
@@ -48,7 +48,7 @@ function Logo() {
48
48
  {
49
49
  suppressHydrationWarning: true,
50
50
  href: `/`,
51
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
51
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
52
52
  className: twMerge("w-auto shrink-0 block cursor-pointer"),
53
53
  children: [
54
54
  /* @__PURE__ */ jsx(
package/dist/lib/Nav.js CHANGED
@@ -16,7 +16,6 @@ import { usePathname } from "next/navigation";
16
16
  import Explorer from "./Explorer.js";
17
17
  import Products from "./Products.js";
18
18
  import { useIsChaindigg } from "./context.js";
19
- import request from "@0xchain/request";
20
19
  function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user }) {
21
20
  const isChaindigg = useIsChaindigg();
22
21
  const { gotoAISQL, gotoChat } = BetterLink();
@@ -36,7 +35,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
36
35
  }
37
36
  },
38
37
  {
39
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
38
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
40
39
  href: gotoAISQL({ locale }),
41
40
  key: "/query",
42
41
  label: "iQuery",
@@ -45,7 +44,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
45
44
  }
46
45
  },
47
46
  {
48
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
47
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
49
48
  key: "/explorer",
50
49
  href: "/explorer",
51
50
  label: /* @__PURE__ */ jsx(Explorer, { onClick, onExpandChange: setExplorerExpanded }),
@@ -54,7 +53,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
54
53
  }
55
54
  },
56
55
  {
57
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
56
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
58
57
  key: "/products",
59
58
  label: /* @__PURE__ */ jsx(Products, { onClick }),
60
59
  show: (pathname2) => {
@@ -62,7 +61,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
62
61
  }
63
62
  },
64
63
  {
65
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
64
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
66
65
  href: `/learn`,
67
66
  key: "/learn",
68
67
  label: /* @__PURE__ */ jsx(Translation, { value: "learn", parentKey: "menu" }),
@@ -71,7 +70,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
71
70
  }
72
71
  },
73
72
  {
74
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
73
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
75
74
  href: `/news`,
76
75
  key: "/news",
77
76
  label: /* @__PURE__ */ jsx(Translation, { value: "news", parentKey: "menu" }),
@@ -80,7 +79,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
80
79
  }
81
80
  },
82
81
  {
83
- baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
82
+ baseUrl: process.env.NEXT_PUBLIC_APP_URL,
84
83
  href: `/ranking`,
85
84
  key: "/ranking",
86
85
  label: /* @__PURE__ */ jsx(Translation, { value: "ranking", parentKey: "menu" }),
@@ -106,12 +105,19 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
106
105
  const NavList = isChaindigg ? chaindiggNavList : ichaingoNavList;
107
106
  const updateUserInfo = useCallback(async () => {
108
107
  try {
109
- const response = await request.get("/api/auth/profile", {
110
- baseURL: process.env.AUTH_INNER_API_URL
108
+ const appUrl = (process.env.NEXT_PUBLIC_APP_URL || "").replace(/\/$/, "");
109
+ const profileUrl = appUrl ? `${appUrl}/api/auth/profile` : "/api/auth/profile";
110
+ const response = await fetch(profileUrl, {
111
+ credentials: "include",
112
+ cache: "no-store"
111
113
  });
112
- setUserInfo(response.data || {});
114
+ if (!response.ok) {
115
+ throw new Error(`Failed to load profile: ${response.status}`);
116
+ }
117
+ const profile = await response.json();
118
+ setUserInfo(profile || {});
113
119
  setUserKey((/* @__PURE__ */ new Date()).getTime().toString());
114
- return response;
120
+ return profile;
115
121
  } catch (error) {
116
122
  console.error(error);
117
123
  setUserInfo({});
@@ -23,7 +23,7 @@ function Products({
23
23
  e?.stopPropagation();
24
24
  onClick?.();
25
25
  setAccordionValue("");
26
- const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || "";
26
+ const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "";
27
27
  window.location.href = `${baseUrl}/${locale}${href}`;
28
28
  };
29
29
  const renderItemContent = (item) => /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium", children: item.label });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xchain/header",
3
- "version": "1.1.0-beta.51",
3
+ "version": "1.1.0-beta.53",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -42,19 +42,19 @@
42
42
  "tailwind-merge": "3.3.1"
43
43
  },
44
44
  "dependencies": {
45
- "@0xchain/i18n": "1.1.0-beta.51",
46
- "@0xchain/auth": "1.1.0-beta.51",
47
- "@0xchain/avatar": "1.1.0-beta.51",
48
- "@0xchain/better-link": "1.1.0-beta.51",
49
- "@0xchain/image": "1.1.0-beta.51",
50
- "@0xchain/link": "1.1.0-beta.51",
51
- "@0xchain/translation": "1.1.0-beta.51",
52
- "@0xchain/ui": "1.1.0-beta.51",
53
- "@0xchain/theme-toggle": "1.1.0-beta.51",
54
- "@0xchain/iconfont": "1.1.0-beta.51",
55
- "@0xchain/request": "1.1.0-beta.51",
56
- "@0xchain/with-login": "1.1.0-beta.51",
57
- "@0xchain/tooltip": "1.1.0-beta.51"
45
+ "@0xchain/i18n": "1.1.0-beta.53",
46
+ "@0xchain/auth": "1.1.0-beta.53",
47
+ "@0xchain/link": "1.1.0-beta.53",
48
+ "@0xchain/ui": "1.1.0-beta.53",
49
+ "@0xchain/translation": "1.1.0-beta.53",
50
+ "@0xchain/image": "1.1.0-beta.53",
51
+ "@0xchain/request": "1.1.0-beta.53",
52
+ "@0xchain/iconfont": "1.1.0-beta.53",
53
+ "@0xchain/with-login": "1.1.0-beta.53",
54
+ "@0xchain/avatar": "1.1.0-beta.53",
55
+ "@0xchain/theme-toggle": "1.1.0-beta.53",
56
+ "@0xchain/tooltip": "1.1.0-beta.53",
57
+ "@0xchain/better-link": "1.1.0-beta.53"
58
58
  },
59
59
  "nx": {
60
60
  "tags": [