@huyooo/ui 2.2.4 → 3.0.0

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 (45) hide show
  1. package/dist/{AuthkitAppSetting-ZopA9Gjq.js → AuthkitAppSetting-DhLRYlL_.js} +97 -91
  2. package/dist/{Contact-BdBQ_FA4.js → Contact-CNLjyOCR.js} +3 -3
  3. package/dist/{FeedbackModal.vue_vue_type_script_setup_true_lang-C7vaGD4R.js → FeedbackModal.vue_vue_type_script_setup_true_lang-BXqxUXuu.js} +2 -2
  4. package/dist/{LegalDocViewer-wbdoeWU9.js → LegalDocViewer-DkVW9tCh.js} +622 -625
  5. package/dist/{PaySubscriptions-OZ6OFeQJ.js → PaySubscriptions-tJSQUmhE.js} +1 -1
  6. package/dist/{PricingPlans-Wf4QkUIz.js → PricingPlans-BhcDv8uk.js} +3 -3
  7. package/dist/{ReferrerReferees-DNE-htF1.js → ReferrerReferees-QTZnOCJB.js} +1 -1
  8. package/dist/{Upload.vue_vue_type_script_setup_true_lang-DtciAodp.js → Upload.vue_vue_type_script_setup_true_lang-CZjNlns_.js} +1 -1
  9. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-ELHt9JGf.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-BQgy_CeZ.js} +5 -5
  10. package/dist/WidthContainer-BEeYYOat.js +688 -0
  11. package/dist/authkit.js +8 -8
  12. package/dist/common/globalConfig.d.ts +5 -0
  13. package/dist/common.js +1 -1
  14. package/dist/components/SvgIcon.vue.d.ts +1 -1
  15. package/dist/composables/Authkit/oauthCallback.d.ts +1 -1
  16. package/dist/composables/Authkit/resolveRoutePermission.d.ts +10 -1
  17. package/dist/composables/Authkit/useAuthkitAppsAuthPageInfo.d.ts +2 -0
  18. package/dist/composables/Authkit/useAuthkitAuth.d.ts +14 -3
  19. package/dist/composables/Authkit/useRoutePermission.d.ts +12 -1
  20. package/dist/composables.d.ts +1 -0
  21. package/dist/composables.js +49 -44
  22. package/dist/feedback.js +1 -1
  23. package/dist/{fetchAuthPageAboutUs-D5w21LkF.js → fetchAuthPageAboutUs--dArFYk6.js} +2 -2
  24. package/dist/main.js +284 -279
  25. package/dist/pay.js +3 -3
  26. package/dist/privateCom.js +1 -1
  27. package/dist/referrer.js +1 -1
  28. package/dist/{runtime-B_xhJ3i8.js → runtime-CDEl4QQl.js} +129 -128
  29. package/dist/style.css +1 -1
  30. package/dist/types/api/auth.generated.d.ts +23 -0
  31. package/dist/types/app.d.ts +4 -0
  32. package/dist/upload.js +2 -2
  33. package/dist/{useAuthkitAppsAuthPageInfo-KHO1mJvF.js → useAuthkitAppsAuthPageInfo-mv7hOnhi.js} +1 -1
  34. package/dist/useAuthkitAuth-CO61XogP.js +295 -0
  35. package/dist/{useAuthkitUsersProfile-BvldvaRx.js → useAuthkitUsersProfile-CF7t2Y7T.js} +1 -1
  36. package/dist/{useEnsureAuthenticated-BdXJDqVv.js → useEnsureAuthenticated-Q7EHguY4.js} +1 -1
  37. package/dist/{useLegalDocs-BCWvu1ft.js → useLegalDocs-DUbab5R9.js} +2 -2
  38. package/dist/{usePageSEO-D7eyLr8d.js → usePageSEO-D8CocvOJ.js} +1 -1
  39. package/dist/useRoutePermission-Bvn-J8bp.js +249 -0
  40. package/dist/{useSubscriptionCheckout-BHI3y7Cx.js → useSubscriptionCheckout-Bic8vKgm.js} +1 -1
  41. package/dist/user.js +1 -1
  42. package/package.json +1 -1
  43. package/dist/WidthContainer-PjmYnZwk.js +0 -706
  44. package/dist/useAuthkitAuth-C0fVP17l.js +0 -273
  45. package/dist/useRoutePermission-BuKMkOTK.js +0 -247
@@ -1,273 +0,0 @@
1
- import { ref as u, computed as h, nextTick as _, readonly as x } from "vue";
2
- import { o as M, g as m, r as $, s as F } from "./apiClients-8_c5cDW5.js";
3
- import { u as D } from "./useAuthkitAppsAuthPageInfo-KHO1mJvF.js";
4
- const g = u(!1), w = u(!1);
5
- let I;
6
- const G = "请先阅读并同意用户协议与隐私政策", K = {
7
- required: !1,
8
- userServiceAgreement: !1,
9
- privacyPolicy: !1
10
- };
11
- function A() {
12
- I && clearTimeout(I), w.value = !1, _(() => {
13
- w.value = !0, I = setTimeout(() => {
14
- w.value = !1;
15
- }, 450);
16
- });
17
- }
18
- function N(e) {
19
- return [{
20
- validator: (r, t) => {
21
- if (!e()) {
22
- t();
23
- return;
24
- }
25
- if (r === !0) {
26
- t();
27
- return;
28
- }
29
- A(), t(G);
30
- }
31
- }];
32
- }
33
- function Y() {
34
- const {
35
- appsData: e
36
- } = D(), r = h(() => e.value.registrationTerms ?? K), t = h(() => {
37
- var n;
38
- return ((n = e.value.signUpAuth) == null ? void 0 : n.enabled) !== !1;
39
- }), l = h(() => t.value && !r.value.required);
40
- function s() {
41
- return t.value && r.value.required;
42
- }
43
- function i() {
44
- return s();
45
- }
46
- function f() {
47
- g.value = !1;
48
- }
49
- function d() {
50
- return !i() || g.value ? !0 : (A(), !1);
51
- }
52
- function v(n) {
53
- g.value = n;
54
- }
55
- function S(n) {
56
- const o = h(() => n === "signUp" ? s() : i()), p = h(() => N(() => o.value));
57
- return {
58
- showTermsField: o,
59
- termsRules: p
60
- };
61
- }
62
- return {
63
- acceptedTerms: g,
64
- termsShaking: w,
65
- registrationTerms: r,
66
- signUpAuthEnabled: t,
67
- registrationBlocked: l,
68
- requiresAcceptanceForSignUp: s,
69
- requiresAcceptanceForOAuth: i,
70
- resetAcceptedTerms: f,
71
- shakeTerms: A,
72
- syncAcceptedTerms: v,
73
- ensureTermsAcceptedForSignIn: d,
74
- useTermsFormField: S
75
- };
76
- }
77
- const c = u("signIn"), O = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Set(), a = u(null), b = "jwtToken";
78
- function U() {
79
- try {
80
- const e = localStorage.getItem(b);
81
- if (e)
82
- return a.value = e, !0;
83
- } catch (e) {
84
- console.warn("Failed to access localStorage:", e);
85
- }
86
- return !1;
87
- }
88
- typeof window < "u" && U();
89
- function z() {
90
- try {
91
- const e = new URL(window.location.href), r = e.searchParams.get("token");
92
- if (!r) return !1;
93
- const t = e.searchParams.get("refreshToken"), l = e.searchParams.get("userId"), s = e.searchParams.get("appId"), i = e.searchParams.get("needBindIdentity") === "true";
94
- t ? F({
95
- jwtToken: r,
96
- refreshToken: t
97
- }) : P(r), ["token", "refreshToken", "userId", "appId", "needBindIdentity", "expiresIn"].forEach((d) => e.searchParams.delete(d));
98
- const f = `${e.pathname}${e.search}${e.hash}`;
99
- return window.history.replaceState({}, "", f), C({
100
- jwtToken: r,
101
- userId: l,
102
- appId: s,
103
- needBindIdentity: i
104
- }), !0;
105
- } catch (e) {
106
- return console.warn("Failed to handle OAuth callback:", e), !1;
107
- }
108
- }
109
- function H() {
110
- return z() ? !0 : U();
111
- }
112
- function q() {
113
- return a.value || U() ? a.value : null;
114
- }
115
- function P(e) {
116
- a.value = e;
117
- try {
118
- localStorage.setItem(b, e);
119
- } catch (r) {
120
- console.warn("Failed to save token to localStorage:", r);
121
- }
122
- }
123
- function k(e) {
124
- e.refreshToken ? F({
125
- jwtToken: e.jwtToken,
126
- refreshToken: e.refreshToken
127
- }) : P(e.jwtToken), C(e);
128
- }
129
- function J() {
130
- a.value = null, Z();
131
- }
132
- M(J);
133
- function y() {
134
- $();
135
- }
136
- async function Q() {
137
- if (!q())
138
- return y(), !0;
139
- const {
140
- error: e
141
- } = await m().auth.auth.signOut.post();
142
- return y(), !e;
143
- }
144
- function T(e, r) {
145
- return e.add(r), () => {
146
- e.delete(r);
147
- };
148
- }
149
- function C(e) {
150
- O.forEach((r) => {
151
- r(e);
152
- });
153
- }
154
- function W() {
155
- L.forEach((e) => void e());
156
- }
157
- function X() {
158
- j.forEach((e) => void e());
159
- }
160
- function Z() {
161
- V.forEach((e) => void e());
162
- }
163
- function ee(e) {
164
- return T(O, e);
165
- }
166
- function ne(e) {
167
- return T(L, e);
168
- }
169
- function re(e) {
170
- return T(j, e);
171
- }
172
- function te(e) {
173
- return T(V, e);
174
- }
175
- function ue() {
176
- const e = u(!1), r = u(!1), t = u(!1);
177
- async function l(n) {
178
- e.value = !0;
179
- const {
180
- data: o,
181
- error: p
182
- } = await m().auth.auth.signIn.unified.post({
183
- identifier: n.identifier || n.email || "",
184
- password: n.password,
185
- code: n.code,
186
- emailVerifyId: n.emailVerifyId,
187
- method: n.method || "password"
188
- });
189
- if (e.value = !1, p || !o)
190
- return;
191
- k(o);
192
- }
193
- function s(n) {
194
- k(n);
195
- }
196
- async function i(n) {
197
- const {
198
- resetAcceptedTerms: o,
199
- acceptedTerms: p,
200
- requiresAcceptanceForSignUp: R
201
- } = Y();
202
- r.value = !0;
203
- const E = R() ? p.value : void 0, {
204
- error: B
205
- } = n.type === "phone" ? await m().auth.auth.signUp.phone.post({
206
- phone: n.phone || "",
207
- code: n.code || "",
208
- password: n.password,
209
- inviteCode: n.inviteCode,
210
- acceptedTerms: E === !0
211
- }) : await m().auth.auth.signUp.post({
212
- email: n.email || "",
213
- userToken: n.userToken || "",
214
- emailVerifyId: n.emailVerifyId || "",
215
- password: n.password || "",
216
- inviteCode: n.inviteCode,
217
- acceptedTerms: E === !0
218
- });
219
- r.value = !1, !B && (o(), c.value = "signIn", W());
220
- }
221
- async function f(n) {
222
- t.value = !0;
223
- const {
224
- error: o
225
- } = await m().auth.auth.resetPassword.post({
226
- method: n.method || "email",
227
- email: n.email,
228
- phone: n.phone,
229
- userToken: n.userToken,
230
- code: n.code,
231
- emailVerifyId: n.emailVerifyId,
232
- password: n.password
233
- });
234
- t.value = !1, !o && (c.value = "signIn", X());
235
- }
236
- function d() {
237
- c.value = "signUp";
238
- }
239
- function v() {
240
- c.value = "resetPassword";
241
- }
242
- function S() {
243
- c.value = "signIn";
244
- }
245
- return {
246
- signInSubmit: l,
247
- passkeySignInSubmit: s,
248
- signUpSubmit: i,
249
- resetPasswordSubmit: f,
250
- currentView: c,
251
- authSignInLoading: e,
252
- authSignUpLoading: r,
253
- resetPasswordLoading: t,
254
- switchSignUp: d,
255
- switchResetPassword: v,
256
- switchSignIn: S,
257
- onSignIn: ee,
258
- onSignUp: ne,
259
- onResetPassword: re,
260
- onSignOut: te,
261
- jwtToken: x(a),
262
- getToken: q,
263
- setToken: P,
264
- completeSignIn: k,
265
- restoreSession: H,
266
- clearAuth: y,
267
- signOut: Q
268
- };
269
- }
270
- export {
271
- Y as a,
272
- ue as u
273
- };
@@ -1,247 +0,0 @@
1
- import { computed as g, ref as L, watch as S } from "vue";
2
- import { useRouter as w, useRoute as C } from "vue-router";
3
- import { u as k } from "./useAuthkitAppsAuthPageInfo-KHO1mJvF.js";
4
- import { u as M } from "./useAuthkitUsersProfile-BvldvaRx.js";
5
- import { u as K } from "./useAuthkitAuth-C0fVP17l.js";
6
- function O(e, s = "default") {
7
- const n = document;
8
- if (n && typeof n.startViewTransition == "function") {
9
- const t = document.body;
10
- t.classList.add(`vt-${s}`), n.startViewTransition(() => {
11
- try {
12
- e();
13
- } catch {
14
- }
15
- }).finished.finally(() => {
16
- t.classList.remove(`vt-${s}`);
17
- });
18
- } else
19
- e();
20
- }
21
- function N() {
22
- const {
23
- appsData: e,
24
- appsAuthPageInfoSuccess: s
25
- } = k(), n = w(), t = g(() => s.value), f = g(() => t.value && e.value.applicationLogoUrl || ""), d = g(() => t.value && e.value.name || "");
26
- function m() {
27
- O(() => {
28
- n.push("/"), window.scrollTo({
29
- top: 0,
30
- behavior: "smooth"
31
- });
32
- });
33
- }
34
- return {
35
- brandReady: t,
36
- brandLogoUrl: f,
37
- brandName: d,
38
- navigateToAppHome: m
39
- };
40
- }
41
- const y = L({
42
- key: "",
43
- name: ""
44
- });
45
- function j() {
46
- function e(s, n) {
47
- y.value.key = s, y.value.name = n;
48
- }
49
- return {
50
- activeDoc: y,
51
- setActiveDoc: e
52
- };
53
- }
54
- function W(e) {
55
- const s = /* @__PURE__ */ new Set();
56
- s.add(e);
57
- const n = e.split("/").filter(Boolean);
58
- for (let t = n.length - 1; t > 0; t--)
59
- s.add(`/${n.slice(0, t).join("/")}`);
60
- return [...s];
61
- }
62
- function A(e, s) {
63
- const n = new Set(s);
64
- return n.has("*") ? !0 : W(e).some((t) => n.has(t));
65
- }
66
- function $(e, s) {
67
- const n = e.endsWith("/") ? e.slice(0, -1) : e;
68
- return n === "" ? !1 : A(n, s) || s.some((t) => t === n ? !0 : t.startsWith(`${n}/`));
69
- }
70
- function T(e, s) {
71
- return Array.isArray(e == null ? void 0 : e.menuTypes) ? e.menuTypes.includes(s) : !1;
72
- }
73
- function F(e, s, n) {
74
- for (let t = e.length - 1; t >= 0; t--) {
75
- const f = e[t];
76
- if (T(f.meta, s))
77
- return f.path;
78
- }
79
- return n;
80
- }
81
- function R(e) {
82
- return e.split("?")[0].split("#")[0];
83
- }
84
- function H(e, s, n) {
85
- const t = R(s), f = (n == null ? void 0 : n.returnParentOnChildMatch) ?? !1;
86
- function d(o, p) {
87
- for (const c of o) {
88
- if (R(c.path) === p)
89
- return c.path;
90
- if (c.children && c.children.length > 0) {
91
- const r = d(c.children, p);
92
- if (r)
93
- return f ? c.path : r;
94
- }
95
- }
96
- return null;
97
- }
98
- const m = d(e, t);
99
- if (m)
100
- return m;
101
- for (const o of e) {
102
- const p = R(o.path);
103
- if (t.startsWith(p + "/") || t === p) {
104
- if (o.children && o.children.length > 0)
105
- for (const c of o.children) {
106
- const v = R(c.path);
107
- if (t.startsWith(v + "/") || t === v)
108
- return f ? o.path : c.path;
109
- }
110
- return o.path;
111
- }
112
- }
113
- return n != null && n.fallback ? n.fallback(t) : t;
114
- }
115
- function q(e) {
116
- const s = w(), {
117
- appsData: n
118
- } = k(), {
119
- isLoggedIn: t,
120
- userProfile: f
121
- } = M(), d = g(() => {
122
- var r;
123
- return !t.value || !f.value ? [] : ((r = f.value.permissions) == null ? void 0 : r.map((u) => u.permissionKey)) || [];
124
- });
125
- function m(r) {
126
- const u = (n.value.publicRoutes || []).map((l) => l.permissionKey);
127
- return A(r, u);
128
- }
129
- function o(r) {
130
- return t.value ? A(r, d.value) : !1;
131
- }
132
- function p(r) {
133
- var u;
134
- return {
135
- path: r.path,
136
- name: r.name,
137
- meta: r.meta,
138
- children: (u = r.children) == null ? void 0 : u.map((l) => p(l))
139
- };
140
- }
141
- function c(r, u) {
142
- const l = [];
143
- for (const a of r) {
144
- if (a.path === "/" || a.path === "/:catchAll(.*)")
145
- continue;
146
- const i = a.meta;
147
- if (T(i, u)) {
148
- const P = a.path;
149
- if (m(P) || $(P, d.value)) {
150
- const h = {
151
- name: (i == null ? void 0 : i.menuName) || (i == null ? void 0 : i.title) || (typeof a.name == "string" ? a.name : a.path),
152
- path: a.path,
153
- icon: (i == null ? void 0 : i.menuIcon) || (i == null ? void 0 : i.icon),
154
- description: (i == null ? void 0 : i.menuDescription) || (i == null ? void 0 : i.description),
155
- hidden: i == null ? void 0 : i.hidden
156
- };
157
- if (a.children && a.children.length > 0) {
158
- const b = c(a.children, u);
159
- b.length > 0 && (h.children = b);
160
- }
161
- l.push(h);
162
- }
163
- } else if (a.children && a.children.length > 0) {
164
- const P = c(a.children, u);
165
- l.push(...P);
166
- }
167
- }
168
- return l;
169
- }
170
- return {
171
- menus: g(() => {
172
- if (!e)
173
- return [];
174
- const r = s.getRoutes(), u = r.find((h) => h.path === "/"), l = u != null && u.children ? u.children.map((h) => p(h)) : [], a = new Set(l.map((h) => h.path)), P = r.filter((h) => h.path === "/" || h.path === "/:catchAll(.*)" || a.has(h.path) ? !1 : h.path.split("/").filter((D) => D).length === 1).map(p), I = [...l, ...P];
175
- return c(I, e);
176
- }),
177
- isRoutePublic: m,
178
- hasPermission: (r) => m(r) ? !0 : o(r),
179
- isLoggedIn: t
180
- };
181
- }
182
- function E() {
183
- const e = w(), s = C(), {
184
- appsData: n,
185
- appsAuthPageInfoSuccess: t
186
- } = k(), {
187
- userProfile: f,
188
- isLoggedIn: d,
189
- usersProfileReady: m
190
- } = M(), o = L(!1);
191
- function p(r) {
192
- const u = n.value.publicRoutes || [];
193
- return A(r, u.map((l) => l.permissionKey));
194
- }
195
- function c(r) {
196
- var l;
197
- if (!d.value || !f.value)
198
- return !1;
199
- const u = ((l = f.value.permissions) == null ? void 0 : l.map((a) => a.permissionKey)) || [];
200
- return A(r, u);
201
- }
202
- function v(r) {
203
- if (!t.value) {
204
- o.value = !0;
205
- return;
206
- }
207
- if (o.value = !0, p(r)) {
208
- o.value = !1;
209
- return;
210
- }
211
- if (!m.value) {
212
- o.value = !0;
213
- return;
214
- }
215
- if (!d.value) {
216
- const {
217
- getToken: u
218
- } = K();
219
- if (u()) {
220
- o.value = !0;
221
- return;
222
- }
223
- e.replace("/"), o.value = !1;
224
- return;
225
- }
226
- c(r) || e.replace("/"), o.value = !1;
227
- }
228
- return S([() => s.path, t, m, d], () => {
229
- v(s.path);
230
- }, {
231
- immediate: !0
232
- }), {
233
- isChecking: o,
234
- isRoutePublic: p,
235
- hasPermission: c
236
- };
237
- }
238
- export {
239
- F as a,
240
- N as b,
241
- q as c,
242
- E as d,
243
- H as f,
244
- R as g,
245
- j as u,
246
- O as w
247
- };