@ichaingo/header 1.4.51 → 1.4.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.
- package/dist/index.d.ts +8 -1
- package/dist/index.js +34 -23
- package/dist/lib/User/SignIn.js +26 -27
- package/package.json +15 -15
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
export declare function emitUserEvent(eventName: string, data?: any): void;
|
|
5
5
|
|
|
6
|
-
declare function HeaderBar({ extra, children, className, hideNews, hideLogin }: HeaderBarProps): Promise<JSX.Element>;
|
|
6
|
+
declare function HeaderBar({ extra, children, className, hideNews, hideLogin, source }: HeaderBarProps): Promise<JSX.Element>;
|
|
7
7
|
export default HeaderBar;
|
|
8
8
|
|
|
9
9
|
export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
@@ -11,6 +11,13 @@ export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDiv
|
|
|
11
11
|
children?: default_2.ReactNode;
|
|
12
12
|
hideNews?: boolean;
|
|
13
13
|
hideLogin?: boolean;
|
|
14
|
+
source?: HeaderSource;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export declare enum HeaderSource {
|
|
18
|
+
EXPLORER = "explorer",
|
|
19
|
+
CHAT = "chat",
|
|
20
|
+
DEFAULT = "default"
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
export declare function onUserEvent(eventName: string, callback: (data?: any) => void): () => void;
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,53 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { twMerge as
|
|
3
|
-
import
|
|
4
|
-
import { cookies as
|
|
1
|
+
import { jsxs as r, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge as a } from "tailwind-merge";
|
|
3
|
+
import p from "@ichaingo/request";
|
|
4
|
+
import { cookies as h } from "next/headers";
|
|
5
5
|
import x from "./lib/Right.js";
|
|
6
|
-
import
|
|
7
|
-
import { USER_EVENTS as _, emitUserEvent as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
import E from "./lib/Logo.js";
|
|
7
|
+
import { USER_EVENTS as _, emitUserEvent as A, onUserEvent as j } from "./lib/events.js";
|
|
8
|
+
var g = /* @__PURE__ */ ((e) => (e.EXPLORER = "explorer", e.CHAT = "chat", e.DEFAULT = "default", e))(g || {});
|
|
9
|
+
async function b({
|
|
10
|
+
extra: e,
|
|
11
|
+
children: c,
|
|
12
|
+
className: d,
|
|
13
|
+
hideNews: l,
|
|
14
|
+
hideLogin: m,
|
|
15
|
+
source: i = "default"
|
|
16
|
+
/* DEFAULT */
|
|
17
|
+
}) {
|
|
18
|
+
var s;
|
|
19
|
+
let t = {
|
|
11
20
|
data: {}
|
|
12
21
|
};
|
|
13
22
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (typeof
|
|
23
|
+
const n = (s = (await h()).get("refresh_token")) == null ? void 0 : s.value;
|
|
24
|
+
if (typeof n < "u" && n !== "")
|
|
16
25
|
try {
|
|
17
|
-
|
|
26
|
+
t = await p.get("/v2/users/profile", {
|
|
18
27
|
baseURL: process.env.AUTH_INNER_API_URL
|
|
19
28
|
});
|
|
20
29
|
} catch (f) {
|
|
21
|
-
console.error(f),
|
|
30
|
+
console.error(f), t = { data: {} };
|
|
22
31
|
}
|
|
23
32
|
} catch {
|
|
24
|
-
|
|
33
|
+
t = { data: {} };
|
|
25
34
|
}
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
35
|
+
return /* @__PURE__ */ r("div", { className: a("sticky left-0 right-0 top-0 bg-background h-16 z-999", d), children: [
|
|
36
|
+
/* @__PURE__ */ r("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
|
|
37
|
+
/* @__PURE__ */ r("div", { className: a("items-center flex-1 gap-6", i === "chat" ? "hidden md:flex" : "flex"), children: [
|
|
38
|
+
/* @__PURE__ */ o(E, {}),
|
|
39
|
+
c
|
|
31
40
|
] }),
|
|
32
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ o("div", { className: a(i === "chat" ? "flex-1 md:hidden" : "hidden"), children: " " }),
|
|
42
|
+
/* @__PURE__ */ o(x, { hideNews: l, hideLogin: m, user: (t == null ? void 0 : t.data) || {} })
|
|
33
43
|
] }),
|
|
34
|
-
|
|
44
|
+
e
|
|
35
45
|
] });
|
|
36
46
|
}
|
|
37
47
|
export {
|
|
48
|
+
g as HeaderSource,
|
|
38
49
|
_ as USER_EVENTS,
|
|
39
50
|
b as default,
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
A as emitUserEvent,
|
|
52
|
+
j as onUserEvent
|
|
42
53
|
};
|
package/dist/lib/User/SignIn.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { jsxs as a, jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as a, Fragment as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import l from "@ichaingo/translation";
|
|
3
3
|
import { twMerge as c } from "tailwind-merge";
|
|
4
|
-
import { useLogin as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
4
|
+
import { useLogin as p, OpenLoginType as d } from "@ichaingo/with-login";
|
|
5
|
+
function x({ onClick: n = () => {
|
|
6
|
+
}, className: e }) {
|
|
7
|
+
const r = async () => {
|
|
8
|
+
n == null || n(), window.location.reload();
|
|
9
|
+
}, { openLogin: t, LoginModal: i } = p({ loginSuccessCallback: r });
|
|
10
|
+
return /* @__PURE__ */ a(s, { children: [
|
|
11
|
+
/* @__PURE__ */ o(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
onClick: () => {
|
|
15
|
+
t(d.LOGIN);
|
|
16
|
+
},
|
|
17
|
+
style: { cursor: "pointer" },
|
|
18
|
+
className: c(
|
|
19
|
+
"cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
|
|
20
|
+
e
|
|
21
|
+
),
|
|
22
|
+
children: /* @__PURE__ */ o(l, { value: "signIn", parentKey: "account" })
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ o(i, {})
|
|
26
|
+
] });
|
|
28
27
|
}
|
|
29
28
|
export {
|
|
30
|
-
|
|
29
|
+
x as default
|
|
31
30
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"rollup-plugin-preserve-use-client": "^1.0.0",
|
|
30
30
|
"tailwind-merge": "^2.5.5",
|
|
31
31
|
"next": "15.1.6",
|
|
32
|
-
"@ichaingo/auth": "1.4.
|
|
33
|
-
"@ichaingo/
|
|
34
|
-
"@ichaingo/
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
32
|
+
"@ichaingo/auth": "1.4.53",
|
|
33
|
+
"@ichaingo/image": "1.4.53",
|
|
34
|
+
"@ichaingo/better-link": "1.4.53",
|
|
35
|
+
"@ichaingo/link": "1.4.53",
|
|
36
|
+
"@ichaingo/translation": "1.4.53",
|
|
37
|
+
"@ichaingo/ui": "1.4.53",
|
|
38
|
+
"@ichaingo/i18n": "1.4.53",
|
|
39
|
+
"@ichaingo/theme-toggle": "1.4.53",
|
|
40
|
+
"@ichaingo/with-login": "1.4.53",
|
|
41
|
+
"@ichaingo/avatar": "1.4.53",
|
|
42
|
+
"@ichaingo/iconfont": "1.4.53",
|
|
43
|
+
"@ichaingo/providers": "1.4.53",
|
|
44
|
+
"@ichaingo/tooltip": "1.4.53",
|
|
45
|
+
"@ichaingo/request": "1.4.53"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/js-cookie": "^3.0.6"
|