@yuku123/z-team-component 0.2.24 → 0.2.28

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 (29) hide show
  1. package/dist/ChangeLogView-CG-o5YP1.js +502 -0
  2. package/dist/{InvitationManagementPage-BnvfjueJ.js → InvitationManagementPage-DpA3Xlq1.js} +2 -2
  3. package/dist/{OnboardingPage-B1uHZfRm.js → OnboardingPage-DFRAwruv.js} +2 -2
  4. package/dist/{ProjectApp-C6GUGbAD.js → ProjectApp-BquB_X7K.js} +2 -2
  5. package/dist/{SystemShell-DSbSJWXv.js → SystemShell-BLXTOqFb.js} +1 -1
  6. package/dist/{api-BwXzkm3f.js → api-CX7MUpws.js} +1 -1
  7. package/dist/ctc-sso-DtJHC-2M.js +117 -0
  8. package/dist/index-BYEx4vlI.js +6652 -0
  9. package/dist/{index-C1C2qyDr.js → index-BafC42Cl.js} +96 -66
  10. package/dist/{index-mv7nvapp.js → index-BylksTyk.js} +1 -1
  11. package/dist/{index-BMRIUhOL.js → index-C2aPiQSz.js} +1 -1
  12. package/dist/{index-Jrz1Ho0h.js → index-C9BOtjtQ.js} +1 -3
  13. package/dist/index-CPF3LS0x.js +914 -0
  14. package/dist/{index-8V37FP9c.js → index-CTD7k9dP.js} +1 -1
  15. package/dist/{index-3AXvDKQz.js → index-CcTdM5kT.js} +2 -2
  16. package/dist/index-CiMxCTOS.js +8 -0
  17. package/dist/{index-DkcpD37-.js → index-DIxwe_pk.js} +1 -1
  18. package/dist/{index-CGDpGIZC.js → index-Da7ls5q6.js} +1 -1
  19. package/dist/{index-B3ikipDf.js → index-Dao4uqQd.js} +1 -1
  20. package/dist/{index-BmK_rWsV.js → index-UsGqMo11.js} +17 -9
  21. package/dist/{index-CkH1OY5_.js → index-dSnK7qcL.js} +815 -767
  22. package/dist/index.js +1 -1
  23. package/dist/pages.js +1 -1
  24. package/dist/z-team-component.css +2 -2
  25. package/package.json +1 -1
  26. package/dist/ctc-sso-B62FfkZg.js +0 -70
  27. package/dist/index-Bsh58cwF.js +0 -975
  28. package/dist/index-DK_aR-Vu.js +0 -499
  29. package/dist/index-DPnfP7Cb.js +0 -6879
@@ -0,0 +1,117 @@
1
+ function d() {
2
+ if (typeof window > "u") return null;
3
+ try {
4
+ const t = localStorage.getItem("USER_INFO");
5
+ if (t) return JSON.parse(t);
6
+ const a = localStorage.getItem("userInfo") || localStorage.getItem("user_info");
7
+ if (!a) return null;
8
+ const n = JSON.parse(a), r = {
9
+ name: String(n.nickname || n.name || ""),
10
+ jobNumber: String(n.userId || n.jobNumber || ""),
11
+ username: String(n.username || n.account || n.name || ""),
12
+ staffId: typeof n.userId == "number" ? n.userId : Number(n.userId) || 0
13
+ };
14
+ return localStorage.setItem("USER_INFO", JSON.stringify(r)), window.USER_INFO = r, r;
15
+ } catch {
16
+ return null;
17
+ }
18
+ }
19
+ async function m() {
20
+ const t = () => {
21
+ localStorage.removeItem("USER_INFO"), window.USER_INFO = void 0;
22
+ };
23
+ try {
24
+ const a = new AbortController(), n = setTimeout(() => a.abort(), 1500), r = await fetch("/kapi/z-ctc/api/ctc/authn/whoami", {
25
+ method: "GET",
26
+ credentials: "include",
27
+ headers: { Accept: "application/json" },
28
+ signal: a.signal
29
+ });
30
+ if (clearTimeout(n), r.status === 401) {
31
+ const s = await u();
32
+ return s ? { kind: "authenticated", user: s } : (t(), { kind: "unauthenticated" });
33
+ }
34
+ if (!r.ok) {
35
+ const s = await u();
36
+ return s ? { kind: "authenticated", user: s } : { kind: "unavailable" };
37
+ }
38
+ const e = await r.json();
39
+ if (!e.success || !e.data)
40
+ return t(), { kind: "unauthenticated" };
41
+ const o = e.data.user_id ?? e.data.userId, i = {
42
+ name: e.data.nickname || e.data.username,
43
+ jobNumber: o != null ? String(o) : "",
44
+ username: e.data.username
45
+ };
46
+ localStorage.setItem("USER_INFO", JSON.stringify(i)), localStorage.setItem(
47
+ "ctcUrl",
48
+ encodeURIComponent(window.location.origin)
49
+ ), window.USER_INFO = i;
50
+ const c = localStorage.getItem("token") || localStorage.getItem("z_team_token");
51
+ c && localStorage.setItem("token", c);
52
+ const l = {
53
+ userId: o,
54
+ id: o,
55
+ userName: e.data.username,
56
+ username: e.data.username,
57
+ nickname: e.data.nickname
58
+ };
59
+ return localStorage.setItem("userInfo", JSON.stringify(l)), { kind: "authenticated", user: i };
60
+ } catch {
61
+ const a = await u();
62
+ return a ? { kind: "authenticated", user: a } : (t(), { kind: "unavailable" });
63
+ }
64
+ }
65
+ async function u() {
66
+ if (typeof window > "u") return null;
67
+ let t = null;
68
+ try {
69
+ t = localStorage.getItem("token") || localStorage.getItem("z_team_token");
70
+ } catch {
71
+ return null;
72
+ }
73
+ if (!t || !t.trim()) return null;
74
+ try {
75
+ const a = new AbortController(), n = setTimeout(() => a.abort(), 2e3), r = await fetch("/kapi/z-ctc/api/ctc/authn/whoami", {
76
+ method: "GET",
77
+ headers: {
78
+ Accept: "application/json",
79
+ Authorization: `Bearer ${t.trim()}`
80
+ },
81
+ signal: a.signal
82
+ });
83
+ if (clearTimeout(n), !r.ok) return null;
84
+ const e = await r.json();
85
+ if (!e.success || !e.data) return null;
86
+ const o = e.data.user_id ?? e.data.userId, i = {
87
+ name: e.data.nickname || e.data.username,
88
+ jobNumber: o != null ? String(o) : "",
89
+ username: e.data.username
90
+ };
91
+ localStorage.setItem("USER_INFO", JSON.stringify(i)), localStorage.setItem(
92
+ "ctcUrl",
93
+ encodeURIComponent(window.location.origin)
94
+ ), window.USER_INFO = i;
95
+ const c = {
96
+ userId: o,
97
+ id: o,
98
+ userName: e.data.username,
99
+ username: e.data.username,
100
+ nickname: e.data.nickname
101
+ };
102
+ return localStorage.setItem("userInfo", JSON.stringify(c)), i;
103
+ } catch {
104
+ return null;
105
+ }
106
+ }
107
+ function f() {
108
+ const t = new URL(window.location.href);
109
+ t.searchParams.has("_from_login") || t.searchParams.set("_from_login", "1");
110
+ const a = `/login?redirect=${encodeURIComponent(t.toString())}`;
111
+ window.location.href = a;
112
+ }
113
+ export {
114
+ m as f,
115
+ f as r,
116
+ d as s
117
+ };