@ichaingo/header 1.4.69 → 1.4.72

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -25
  2. package/package.json +14 -13
package/dist/index.js CHANGED
@@ -1,46 +1,44 @@
1
- import { jsxs as r, Fragment as x, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as t, Fragment as p, jsx as a } from "react/jsx-runtime";
2
2
  import { twMerge as i } from "tailwind-merge";
3
- import k from "@ichaingo/request";
4
- import { cookies as g } from "next/headers";
5
- import m, { HeaderSource as a } from "./lib/Right.js";
6
- import E from "./lib/Logo.js";
7
- import { USER_EVENTS as _, emitUserEvent as w, onUserEvent as j } from "./lib/events.js";
8
- async function N({ extra: l, children: p, className: f, hideNews: d, hideLogin: c, source: t = a.DEFAULT }) {
9
- var n;
3
+ import h from "@ichaingo/request";
4
+ import c, { HeaderSource as d } from "./lib/Right.js";
5
+ import g from "./lib/Logo.js";
6
+ import { isLogin as x } from "@ichaingo/with-login";
7
+ import { USER_EVENTS as u, emitUserEvent as y, onUserEvent as R } from "./lib/events.js";
8
+ async function N({ extra: l, children: s, className: n, hideNews: m, hideLogin: o, source: r = d.DEFAULT }) {
10
9
  let e = {
11
10
  data: {}
12
11
  };
13
12
  try {
14
- const s = (n = (await g()).get("refresh_token")) == null ? void 0 : n.value;
15
- if (typeof s < "u" && s !== "")
13
+ if (x())
16
14
  try {
17
- e = await k.get("/v2/users/profile", {
15
+ e = await h.get("/v2/users/profile", {
18
16
  baseURL: process.env.AUTH_INNER_API_URL
19
17
  });
20
- } catch (h) {
21
- console.error(h), e = { data: {} };
18
+ } catch (f) {
19
+ console.error(f), e = { data: {} };
22
20
  }
23
21
  } catch {
24
22
  e = { data: {} };
25
23
  }
26
- return /* @__PURE__ */ r(x, { children: [
27
- /* @__PURE__ */ r("div", { className: i("sticky left-0 right-0 top-0 bg-background h-16 z-999", t === a.CHAT ? "hidden md:block" : "block", f), children: [
28
- /* @__PURE__ */ r("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
29
- /* @__PURE__ */ r("div", { className: i("items-center flex-1 gap-6", t === a.CHAT ? "hidden md:flex" : "flex"), children: [
30
- /* @__PURE__ */ o(E, {}),
31
- p
24
+ return /* @__PURE__ */ t(p, { children: [
25
+ /* @__PURE__ */ t("div", { className: i("sticky left-0 right-0 top-0 bg-background h-16 z-999", r === d.CHAT ? "hidden md:block" : "block", n), children: [
26
+ /* @__PURE__ */ t("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
27
+ /* @__PURE__ */ t("div", { className: i("items-center flex-1 gap-6", r === d.CHAT ? "hidden md:flex" : "flex"), children: [
28
+ /* @__PURE__ */ a(g, {}),
29
+ s
32
30
  ] }),
33
- /* @__PURE__ */ o(m, { hideNews: d, hideLogin: c, user: (e == null ? void 0 : e.data) || {} })
31
+ /* @__PURE__ */ a(c, { hideNews: m, hideLogin: o, user: (e == null ? void 0 : e.data) || {} })
34
32
  ] }),
35
33
  l
36
34
  ] }),
37
- /* @__PURE__ */ o("div", { className: i(t === a.CHAT ? "block md:hidden" : "hidden"), children: /* @__PURE__ */ o(m, { hideNews: d, source: t, hideLogin: c, user: (e == null ? void 0 : e.data) || {} }) })
35
+ /* @__PURE__ */ a("div", { className: i(r === d.CHAT ? "block md:hidden" : "hidden"), children: /* @__PURE__ */ a(c, { hideNews: m, source: r, hideLogin: o, user: (e == null ? void 0 : e.data) || {} }) })
38
36
  ] });
39
37
  }
40
38
  export {
41
- a as HeaderSource,
42
- _ as USER_EVENTS,
39
+ d as HeaderSource,
40
+ u as USER_EVENTS,
43
41
  N as default,
44
- w as emitUserEvent,
45
- j as onUserEvent
42
+ y as emitUserEvent,
43
+ R as onUserEvent
46
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/header",
3
- "version": "1.4.69",
3
+ "version": "1.4.72",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -27,18 +27,19 @@
27
27
  "react-dom": "^19.1.0",
28
28
  "tailwind-merge": "^2.5.5",
29
29
  "next": "15.1.6",
30
- "@ichaingo/better-link": "1.4.69",
31
- "@ichaingo/image": "1.4.69",
32
- "@ichaingo/link": "1.4.69",
33
- "@ichaingo/auth": "1.4.69",
34
- "@ichaingo/translation": "1.4.69",
35
- "@ichaingo/theme-toggle": "1.4.69",
36
- "@ichaingo/request": "1.4.69",
37
- "@ichaingo/with-login": "1.4.69",
38
- "@ichaingo/avatar": "1.4.69",
39
- "@ichaingo/ui": "1.4.69",
40
- "@ichaingo/iconfont": "1.4.69",
41
- "@ichaingo/tooltip": "1.4.69"
30
+ "@ichaingo/auth": "1.4.72",
31
+ "@ichaingo/image": "1.4.72",
32
+ "@ichaingo/better-link": "1.4.72",
33
+ "@ichaingo/link": "1.4.72",
34
+ "@ichaingo/avatar": "1.4.72",
35
+ "@ichaingo/translation": "1.4.72",
36
+ "@ichaingo/request": "1.4.72",
37
+ "@ichaingo/ui": "1.4.72",
38
+ "@ichaingo/iconfont": "1.4.72",
39
+ "@ichaingo/tooltip": "1.4.72",
40
+ "@ichaingo/with-login": "1.4.72",
41
+ "@ichaingo/theme-toggle": "1.4.72",
42
+ "@ichaingo/token": "1.4.72"
42
43
  },
43
44
  "devDependencies": {
44
45
  "rollup-plugin-preserve-use-client": "^1.0.0",