@huyooo/ui 2.0.7 → 2.0.9

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 (51) hide show
  1. package/dist/{AuthkitAppSetting-CX4WTwNd.js → AuthkitAppSetting-DoC2RJh7.js} +787 -752
  2. package/dist/{Contact-CBGSJC2q.js → Contact-Ck3LVLx-.js} +3 -3
  3. package/dist/{FeedbackModal.vue_vue_type_script_setup_true_lang-BNBzOqrv.js → FeedbackModal.vue_vue_type_script_setup_true_lang-hveEkBb4.js} +2 -2
  4. package/dist/{LandingPageLinkGroup-BZJ48Yss.js → LandingPageLinkGroup-DTFhrYK1.js} +1 -1
  5. package/dist/{LandingPageSectionTabs-jRjkWlM-.js → LandingPageSectionTabs-Bm_zZrfT.js} +1 -1
  6. package/dist/LegalDocViewer-DBr0x1ZE.js +2497 -0
  7. package/dist/{Logo-D7fyXyB-.js → Logo-B9DFBxDU.js} +1 -1
  8. package/dist/{PaySubscriptions-BSkcUqHk.js → PaySubscriptions-Bv6LQ_Pf.js} +1 -1
  9. package/dist/{PricingPlans-CyFvgf18.js → PricingPlans-CQaXgOIR.js} +3 -3
  10. package/dist/{ReferrerReferees-Mvv6oiqe.js → ReferrerReferees-CGrH-gYJ.js} +1 -1
  11. package/dist/{Upload.vue_vue_type_script_setup_true_lang-oa6LJgCY.js → Upload.vue_vue_type_script_setup_true_lang-CgZQOZYt.js} +1 -1
  12. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-V5EzZMCL.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-QE1ARaXY.js} +195 -211
  13. package/dist/WidthContainer-Clc_WxY_.js +706 -0
  14. package/dist/authkit.d.ts +1 -0
  15. package/dist/authkit.js +51 -50
  16. package/dist/common/globalConfig.d.ts +0 -5
  17. package/dist/common.js +2 -2
  18. package/dist/components/Authkit/Auth/AuthkitOauthCallback.vue.d.ts +1 -3
  19. package/dist/components/Gradientbackground.vue.d.ts +1 -1
  20. package/dist/components/UserMenu/UserMenu.vue.d.ts +2 -2
  21. package/dist/composables/Authkit/oauthCallback.d.ts +14 -0
  22. package/dist/composables/Authkit/useAppBrand.d.ts +7 -0
  23. package/dist/composables/Authkit/useAuthkitUsersProfile.d.ts +2 -0
  24. package/dist/composables/Authkit/useOAuthCallbackHandler.d.ts +11 -0
  25. package/dist/composables/Authkit/useOauth.d.ts +3 -3
  26. package/dist/composables.d.ts +1 -0
  27. package/dist/composables.js +39 -38
  28. package/dist/feedback.js +1 -1
  29. package/dist/{fetchAuthPageAboutUs-CP5a7jIo.js → fetchAuthPageAboutUs-DV7ArpNZ.js} +1 -1
  30. package/dist/landingPage.js +3 -3
  31. package/dist/main.js +239 -237
  32. package/dist/pay.js +3 -3
  33. package/dist/privateCom.js +1 -1
  34. package/dist/referrer.js +1 -1
  35. package/dist/{runtime-qs4IasEB.js → runtime-Dp7MgwhI.js} +115 -116
  36. package/dist/style.css +1 -1
  37. package/dist/upload.js +2 -2
  38. package/dist/{useAuthkitAuth-BPTZUSkM.js → useAuthkitAuth-cHrJMM8E.js} +48 -47
  39. package/dist/useAuthkitUsersProfile-8FzLTfUJ.js +55 -0
  40. package/dist/{useEnsureAuthenticated-CncOvj2H.js → useEnsureAuthenticated-C8qS8DLL.js} +1 -1
  41. package/dist/{useLegalDocs-BZlntAI7.js → useLegalDocs-C4qk5CTb.js} +1 -1
  42. package/dist/{usePageSEO-DwhbUUjW.js → usePageSEO-Dl6_kBWP.js} +1 -1
  43. package/dist/useRoutePermission-DYPZgvYv.js +247 -0
  44. package/dist/{useSubscriptionCheckout-BDDCRxSs.js → useSubscriptionCheckout-CYU2Ke0y.js} +1 -1
  45. package/dist/user.js +1 -1
  46. package/package.json +1 -1
  47. package/dist/LegalDocViewer-DPUiWxcR.js +0 -2492
  48. package/dist/WidthContainer-Dts5qV1W.js +0 -717
  49. package/dist/components/UserMenu/parts/UserMenuAuthPlaceholder.vue.d.ts +0 -7
  50. package/dist/useAuthkitUsersProfile-BclJWOvR.js +0 -45
  51. package/dist/useRoutePermission-CePjXomb.js +0 -218
@@ -1,2492 +0,0 @@
1
- import { defineComponent as A, computed as R, openBlock as l, createElementBlock as k, normalizeStyle as G, normalizeClass as ge, renderSlot as Z, createBlock as I, unref as e, createCommentVNode as z, createElementVNode as S, toDisplayString as L, ref as P, createVNode as a, withCtx as f, createTextVNode as x, watchEffect as ne, Fragment as D, renderList as le, useModel as Pe, watch as he, mergeModels as Ve, useSlots as Ae, onMounted as E, onUnmounted as re } from "vue";
2
- import { useRouter as ye, useRoute as Ue } from "vue-router";
3
- /* empty css */
4
- /* empty css */
5
- import "./userMenuModal-D-nDaYqM.js";
6
- import { Message as X, Form as H, FormItem as V, Input as U, Button as B, Link as Y, Tabs as ue, TabPane as de, Checkbox as Ce, Modal as $e, List as Te, ListItem as oe, ListItemMeta as ie, Avatar as te, Alert as me, Spin as Re, Empty as qe } from "@arco-design/web-vue";
7
- import { a as M, u as N } from "./useAuthkitAuth-BPTZUSkM.js";
8
- import { g as O, u as we } from "./apiClients-Ctcq8NZs.js";
9
- import { u as j } from "./useAuthkitAppsAuthPageInfo-DZ1p-P3Q.js";
10
- import { o as fe, i as xe, j as ve, k as be, u as Le, l as Be, m as Oe, n as J, p as Me, h as _e, S as K, q as W, r as ke, s as Fe, b as De } from "./AuthkitAppSetting-CX4WTwNd.js";
11
- import { _ as C } from "./_plugin-vue_export-helper-CHgC5LLL.js";
12
- /* empty css */
13
- import "./index-Cn6LcfZO.js";
14
- /* empty css */
15
- import { u as Se, L as Ee, i as He } from "./useLegalDocs-BZlntAI7.js";
16
- import { u as ce } from "./runtime-qs4IasEB.js";
17
- import { u as Ie } from "./useAuthkitUsersProfile-BclJWOvR.js";
18
- /* empty css */
19
- /* empty css */
20
- import "./CustomTable-HDwqEcmB.js";
21
- /* empty css */
22
- import { TiptapEditor as Ge, TiptapTitle as Ne } from "@huyooo/vue-tiptap";
23
- import { f as je } from "./fetchAuthPageAboutUs-CP5a7jIo.js";
24
- const Ke = ["title", "aria-label", "disabled"], We = {
25
- key: 0,
26
- class: "OAuthItem__spinner"
27
- }, Qe = /* @__PURE__ */ A({
28
- __name: "AuthkitOauthItem",
29
- props: {
30
- size: {
31
- type: String,
32
- required: !0
33
- },
34
- icon: {
35
- type: String,
36
- default: ""
37
- },
38
- label: {
39
- type: String,
40
- required: !0
41
- },
42
- loading: {
43
- type: Boolean,
44
- default: !1
45
- },
46
- disabled: {
47
- type: Boolean,
48
- default: !1
49
- }
50
- },
51
- setup(b) {
52
- const u = b, d = R(() => ({
53
- width: `${ve}px`,
54
- height: `${ve}px`,
55
- padding: `${xe}px`,
56
- "--oauth-icon-size": `${fe}px`
57
- }));
58
- return (n, g) => (l(), k("button", {
59
- class: ge(["OAuthItem", {
60
- "OAuthItem--loading": u.loading
61
- }]),
62
- type: "button",
63
- title: u.label,
64
- "aria-label": u.label,
65
- disabled: u.disabled || u.loading,
66
- style: G(d.value)
67
- }, [u.loading ? (l(), k("span", We)) : Z(n.$slots, "icon", {
68
- key: 1
69
- }, () => [u.icon ? (l(), I(be, {
70
- key: 0,
71
- icon: u.icon,
72
- size: e(fe)
73
- }, null, 8, ["icon", "size"])) : z("", !0)], !0)], 14, Ke));
74
- }
75
- }), Q = /* @__PURE__ */ C(Qe, [["__scopeId", "data-v-e00c1d80"]]), Je = {
76
- class: "OAuthList"
77
- }, Xe = {
78
- key: 0,
79
- class: "OAuthDivider"
80
- }, Ye = {
81
- key: 1,
82
- class: "OAuthHint"
83
- }, Ze = /* @__PURE__ */ A({
84
- __name: "AuthkitOauthList",
85
- props: {
86
- size: {
87
- type: String,
88
- default: () => "large"
89
- }
90
- },
91
- emits: ["passkeySubmit"],
92
- setup(b, {
93
- emit: u
94
- }) {
95
- const d = u, {
96
- appsData: n
97
- } = j(), {
98
- loading: g,
99
- supported: h,
100
- loginWithPasskey: o,
101
- formatError: s
102
- } = Le(), {
103
- githubAuth: c,
104
- googleAuth: r,
105
- microsoftAuth: t,
106
- wechatAuth: v
107
- } = _e(), {
108
- acceptedTerms: i,
109
- ensureTermsAcceptedForSignIn: w
110
- } = M();
111
- function p($) {
112
- w() && $({
113
- acceptedTerms: i.value ? !0 : void 0
114
- });
115
- }
116
- const m = b, y = R(() => n.value.authMethods.login.passkey && Be() || ""), _ = R(() => {
117
- const $ = n.value.oauth, T = $.google.enabled || $.microsoft.enabled || $.github.enabled || $.wechat.enabled, F = n.value.authMethods.login.passkey;
118
- return T || F;
119
- });
120
- async function q() {
121
- if (w())
122
- try {
123
- const $ = await o();
124
- if (!$)
125
- return;
126
- d("passkeySubmit", $);
127
- } catch ($) {
128
- const T = s($);
129
- if ($ instanceof Error && $.name === "NotAllowedError") {
130
- X.warning(T);
131
- return;
132
- }
133
- X.error(T);
134
- }
135
- }
136
- return ($, T) => (l(), k("div", Je, [_.value ? (l(), k("div", Xe, [...T[4] || (T[4] = [S("span", null, "其他登录方式", -1)])])) : z("", !0), S("div", {
137
- class: "OAuthIcons",
138
- style: G({
139
- gap: `${e(Oe)}px`
140
- })
141
- }, [e(n).oauth.google.enabled ? (l(), I(Q, {
142
- key: 0,
143
- icon: e(J).google,
144
- label: "Google",
145
- size: m.size,
146
- onClick: T[0] || (T[0] = (F) => p(e(r)))
147
- }, null, 8, ["icon", "size"])) : z("", !0), e(n).oauth.github.enabled ? (l(), I(Q, {
148
- key: 1,
149
- icon: e(J).github,
150
- label: "Github",
151
- size: m.size,
152
- onClick: T[1] || (T[1] = (F) => p(e(c)))
153
- }, null, 8, ["icon", "size"])) : z("", !0), e(n).oauth.microsoft.enabled ? (l(), I(Q, {
154
- key: 2,
155
- icon: e(J).microsoft,
156
- label: "Microsoft",
157
- size: m.size,
158
- onClick: T[2] || (T[2] = (F) => p(e(t)))
159
- }, null, 8, ["icon", "size"])) : z("", !0), e(n).oauth.wechat.enabled ? (l(), I(Q, {
160
- key: 3,
161
- icon: e(J).wechat,
162
- label: "微信",
163
- size: m.size,
164
- onClick: T[3] || (T[3] = (F) => p(e(v)))
165
- }, null, 8, ["icon", "size"])) : z("", !0), e(n).authMethods.login.passkey ? (l(), I(Q, {
166
- key: 4,
167
- icon: e(Me),
168
- label: "Passkey",
169
- size: m.size,
170
- loading: e(g),
171
- disabled: !e(h),
172
- onClick: q
173
- }, null, 8, ["icon", "size", "loading", "disabled"])) : z("", !0)], 4), y.value ? (l(), k("p", Ye, L(y.value), 1)) : z("", !0)]));
174
- }
175
- }), et = /* @__PURE__ */ C(Ze, [["__scopeId", "data-v-aa6a61de"]]), tt = {
176
- class: "content"
177
- }, st = {
178
- class: "sendVerifyCodeItem"
179
- }, at = {
180
- class: "handle"
181
- }, ot = /* @__PURE__ */ A({
182
- __name: "AuthkitPasswordUpdateAndVerify",
183
- props: {
184
- size: {
185
- type: String,
186
- required: !0
187
- },
188
- loading: {
189
- type: Boolean,
190
- required: !0,
191
- default: () => !0
192
- }
193
- },
194
- emits: ["signIn", "submit"],
195
- setup(b, {
196
- emit: u
197
- }) {
198
- const d = u, n = b, g = P(), h = P(!1), o = P(), s = P({
199
- email: void 0,
200
- userToken: void 0,
201
- emailVerifyId: void 0,
202
- password: void 0,
203
- confirmPassword: void 0
204
- });
205
- async function c() {
206
- if (!await o.value.validateField(["email"])) {
207
- h.value = !0;
208
- const v = await O().auth.verify.email.retry.post({
209
- email: s.value.email,
210
- purpose: "resetPassword"
211
- });
212
- h.value = !1, v.data && (s.value.emailVerifyId = v.data.emailVerifyId), W(g.value, v);
213
- }
214
- }
215
- async function r() {
216
- o.value.validate().then((t) => {
217
- t || d("submit", s.value);
218
- });
219
- }
220
- return (t, v) => (l(), k("div", tt, [a(e(H), {
221
- ref_key: "formRef",
222
- ref: o,
223
- model: s.value,
224
- size: n.size,
225
- "auto-label-width": ""
226
- }, {
227
- default: f(() => [a(e(V), {
228
- field: "email",
229
- label: "邮箱",
230
- "hide-label": "",
231
- rules: [{
232
- required: !0,
233
- message: "请输入邮箱"
234
- }, {
235
- type: "email",
236
- message: "请输入有效的邮箱"
237
- }]
238
- }, {
239
- default: f(() => [a(e(U), {
240
- modelValue: s.value.email,
241
- "onUpdate:modelValue": v[0] || (v[0] = (i) => s.value.email = i),
242
- placeholder: "请输入邮箱"
243
- }, null, 8, ["modelValue"])]),
244
- _: 1
245
- }), a(e(V), {
246
- field: "userToken",
247
- label: "验证码",
248
- "hide-label": "",
249
- rules: [{
250
- required: !0,
251
- message: "请输入验证码"
252
- }]
253
- }, {
254
- default: f(() => [S("div", st, [a(e(U), {
255
- modelValue: s.value.userToken,
256
- "onUpdate:modelValue": v[1] || (v[1] = (i) => s.value.userToken = i),
257
- placeholder: "请输入验证码"
258
- }, null, 8, ["modelValue"]), a(K, {
259
- ref_key: "SendVerifyCodeRef",
260
- ref: g,
261
- size: n.size,
262
- loading: h.value,
263
- style: {
264
- "margin-left": "10px"
265
- },
266
- onSend: c
267
- }, null, 8, ["size", "loading"])])]),
268
- _: 1
269
- }), a(e(V), {
270
- field: "password",
271
- label: "密码",
272
- "hide-label": "",
273
- rules: [{
274
- required: !0,
275
- message: "密码请输入"
276
- }, {
277
- minLength: 10,
278
- message: "密码不能少于10字符"
279
- }]
280
- }, {
281
- default: f(() => [a(e(U), {
282
- modelValue: s.value.password,
283
- "onUpdate:modelValue": v[2] || (v[2] = (i) => s.value.password = i),
284
- placeholder: "请输入密码",
285
- type: "password",
286
- autocomplete: ""
287
- }, null, 8, ["modelValue"])]),
288
- _: 1
289
- }), a(e(V), {
290
- field: "confirmPassword",
291
- label: "确认密码",
292
- "hide-label": "",
293
- rules: [{
294
- required: !0,
295
- message: "请输入确认密码"
296
- }, {
297
- minLength: 10,
298
- message: "确认密码不能少于10字符"
299
- }, {
300
- validator: (i, w) => {
301
- i !== s.value.password ? w("两次密码输入不一致,请重新输入") : w();
302
- }
303
- }]
304
- }, {
305
- default: f(() => [a(e(U), {
306
- modelValue: s.value.confirmPassword,
307
- "onUpdate:modelValue": v[3] || (v[3] = (i) => s.value.confirmPassword = i),
308
- placeholder: "请输入确认密码密码",
309
- type: "password",
310
- autocomplete: ""
311
- }, null, 8, ["modelValue"])]),
312
- _: 1
313
- }, 8, ["rules"]), S("div", at, [a(e(B), {
314
- type: "primary",
315
- loading: n.loading,
316
- long: "",
317
- size: n.size,
318
- onClick: r
319
- }, {
320
- default: f(() => [...v[4] || (v[4] = [x(" 提交 ", -1)])]),
321
- _: 1
322
- }, 8, ["loading", "size"])])]),
323
- _: 1
324
- }, 8, ["model", "size"])]));
325
- }
326
- }), it = /* @__PURE__ */ C(ot, [["__scopeId", "data-v-4091e418"]]), nt = {
327
- class: "content"
328
- }, lt = {
329
- class: "sendVerifyCodeItem"
330
- }, rt = /* @__PURE__ */ A({
331
- __name: "AuthkitPhonePasswordUpdateAndVerify",
332
- props: {
333
- size: {
334
- type: String,
335
- required: !0
336
- },
337
- loading: {
338
- type: Boolean,
339
- required: !0,
340
- default: () => !0
341
- }
342
- },
343
- emits: ["submit"],
344
- setup(b, {
345
- emit: u
346
- }) {
347
- const d = u, n = b, g = P(), h = P(!1), o = P(), s = P({
348
- phone: void 0,
349
- code: void 0,
350
- password: void 0,
351
- confirmPassword: void 0
352
- }), c = [{
353
- required: !0,
354
- message: "请输入确认密码"
355
- }, {
356
- minLength: 10,
357
- message: "确认密码不能少于10字符"
358
- }, {
359
- validator: (v, i) => {
360
- if (v !== s.value.password) {
361
- i("两次密码输入不一致,请重新输入");
362
- return;
363
- }
364
- i();
365
- }
366
- }];
367
- async function r() {
368
- if (!await o.value.validateField(["phone"])) {
369
- h.value = !0;
370
- const i = await O().auth.verify.sms.send.post({
371
- phone: s.value.phone,
372
- purpose: "resetPassword"
373
- });
374
- h.value = !1, W(g.value, i);
375
- }
376
- }
377
- async function t() {
378
- o.value.validate().then((v) => {
379
- v || d("submit", {
380
- method: "phone",
381
- phone: s.value.phone,
382
- code: s.value.code,
383
- password: s.value.password
384
- });
385
- });
386
- }
387
- return (v, i) => (l(), k("div", nt, [a(e(H), {
388
- ref_key: "formRef",
389
- ref: o,
390
- model: s.value,
391
- size: n.size,
392
- "auto-label-width": ""
393
- }, {
394
- default: f(() => [a(e(V), {
395
- field: "phone",
396
- label: "手机号",
397
- "hide-label": "",
398
- rules: [{
399
- required: !0,
400
- message: "请输入手机号"
401
- }, {
402
- match: /^1[3-9]\d{9}$/,
403
- message: "请输入有效的手机号"
404
- }]
405
- }, {
406
- default: f(() => [a(e(U), {
407
- modelValue: s.value.phone,
408
- "onUpdate:modelValue": i[0] || (i[0] = (w) => s.value.phone = w),
409
- placeholder: "请输入手机号",
410
- autocomplete: "tel",
411
- type: "tel"
412
- }, null, 8, ["modelValue"])]),
413
- _: 1
414
- }), a(e(V), {
415
- field: "code",
416
- label: "验证码",
417
- "hide-label": "",
418
- rules: [{
419
- required: !0,
420
- message: "请输入验证码"
421
- }]
422
- }, {
423
- default: f(() => [S("div", lt, [a(e(U), {
424
- modelValue: s.value.code,
425
- "onUpdate:modelValue": i[1] || (i[1] = (w) => s.value.code = w),
426
- placeholder: "请输入验证码",
427
- autocomplete: "one-time-code"
428
- }, null, 8, ["modelValue"]), a(K, {
429
- ref_key: "SendVerifyCodeRef",
430
- ref: g,
431
- size: n.size,
432
- loading: h.value,
433
- style: {
434
- "margin-left": "10px"
435
- },
436
- onSend: r
437
- }, null, 8, ["size", "loading"])])]),
438
- _: 1
439
- }), a(e(V), {
440
- field: "password",
441
- label: "密码",
442
- "hide-label": "",
443
- rules: [{
444
- required: !0,
445
- message: "密码请输入"
446
- }, {
447
- minLength: 10,
448
- message: "密码不能少于10字符"
449
- }]
450
- }, {
451
- default: f(() => [a(e(U), {
452
- modelValue: s.value.password,
453
- "onUpdate:modelValue": i[2] || (i[2] = (w) => s.value.password = w),
454
- placeholder: "请输入密码",
455
- type: "password",
456
- autocomplete: "new-password"
457
- }, null, 8, ["modelValue"])]),
458
- _: 1
459
- }), a(e(V), {
460
- field: "confirmPassword",
461
- label: "确认密码",
462
- "hide-label": "",
463
- rules: c
464
- }, {
465
- default: f(() => [a(e(U), {
466
- modelValue: s.value.confirmPassword,
467
- "onUpdate:modelValue": i[3] || (i[3] = (w) => s.value.confirmPassword = w),
468
- placeholder: "请输入确认密码",
469
- type: "password",
470
- autocomplete: "new-password"
471
- }, null, 8, ["modelValue"])]),
472
- _: 1
473
- }), a(e(B), {
474
- type: "primary",
475
- loading: n.loading,
476
- long: "",
477
- size: n.size,
478
- onClick: t
479
- }, {
480
- default: f(() => [...i[4] || (i[4] = [x(" 提交 ", -1)])]),
481
- _: 1
482
- }, 8, ["loading", "size"])]),
483
- _: 1
484
- }, 8, ["model", "size"])]));
485
- }
486
- }), ut = /* @__PURE__ */ C(rt, [["__scopeId", "data-v-a01a994e"]]), dt = {
487
- class: "SwitchSignIn"
488
- }, ct = /* @__PURE__ */ A({
489
- __name: "AuthkitSwitchSignIn",
490
- emits: ["switchSignIn"],
491
- setup(b, {
492
- emit: u
493
- }) {
494
- const d = u;
495
- function n() {
496
- d("switchSignIn");
497
- }
498
- return (g, h) => (l(), k("div", dt, [S("span", null, [h[1] || (h[1] = S("span", null, "已经有账号?", -1)), a(e(Y), {
499
- style: {
500
- padding: "0px"
501
- },
502
- onClick: n
503
- }, {
504
- default: f(() => [...h[0] || (h[0] = [x("去登录", -1)])]),
505
- _: 1
506
- })])]));
507
- }
508
- }), pe = /* @__PURE__ */ C(ct, [["__scopeId", "data-v-c09d6c18"]]), pt = {
509
- class: "ResetPassword"
510
- }, mt = {
511
- key: 0,
512
- class: "tabsContainer"
513
- }, ft = {
514
- key: 3,
515
- class: "empty"
516
- }, vt = /* @__PURE__ */ A({
517
- __name: "AuthkitResetPassword",
518
- props: {
519
- size: {
520
- type: String,
521
- required: !0,
522
- default: () => "large"
523
- },
524
- loading: {
525
- type: Boolean,
526
- required: !0,
527
- default: () => !0
528
- }
529
- },
530
- emits: ["switchSignIn", "submit"],
531
- setup(b, {
532
- emit: u
533
- }) {
534
- const d = u, n = b, {
535
- appsData: g
536
- } = j(), h = R(() => g.value.authMethods), o = R(() => {
537
- const t = [];
538
- return h.value.login.emailPassword && t.push({
539
- key: "email",
540
- title: "邮箱找回"
541
- }), h.value.login.phonePassword && t.push({
542
- key: "phone",
543
- title: "手机号找回"
544
- }), t;
545
- }), s = P("email");
546
- ne(() => {
547
- var t;
548
- o.value.some((v) => v.key === s.value) || (s.value = ((t = o.value[0]) == null ? void 0 : t.key) || "email");
549
- });
550
- function c() {
551
- d("switchSignIn");
552
- }
553
- async function r(t) {
554
- d("submit", {
555
- method: s.value,
556
- ...t
557
- });
558
- }
559
- return (t, v) => (l(), k("div", pt, [o.value.length > 1 ? (l(), k("div", mt, [a(e(ue), {
560
- "active-key": s.value,
561
- "onUpdate:activeKey": v[0] || (v[0] = (i) => s.value = i)
562
- }, {
563
- default: f(() => [(l(!0), k(D, null, le(o.value, (i) => (l(), I(e(de), {
564
- key: i.key,
565
- title: i.title
566
- }, null, 8, ["title"]))), 128))]),
567
- _: 1
568
- }, 8, ["active-key"])])) : z("", !0), s.value === "email" && h.value.login.emailPassword ? (l(), I(it, {
569
- key: 1,
570
- loading: b.loading,
571
- size: n.size,
572
- onSubmit: r
573
- }, null, 8, ["loading", "size"])) : s.value === "phone" && h.value.login.phonePassword ? (l(), I(ut, {
574
- key: 2,
575
- loading: b.loading,
576
- size: n.size,
577
- onSubmit: r
578
- }, null, 8, ["loading", "size"])) : (l(), k("div", ft, "当前应用未开放找回密码")), a(pe, {
579
- onSwitchSignIn: c
580
- })]));
581
- }
582
- }), gt = /* @__PURE__ */ C(vt, [["__scopeId", "data-v-90d789bb"]]);
583
- let se = null, ae = null;
584
- function ht(b) {
585
- se = b.onPrivacyPolicy ?? null, ae = b.onUserServiceAgreement ?? null;
586
- }
587
- function yt() {
588
- se == null || se();
589
- }
590
- function wt() {
591
- ae == null || ae();
592
- }
593
- const bt = {
594
- key: 2
595
- }, _t = /* @__PURE__ */ A({
596
- __name: "AuthkitServiceAgreementAndPrivacyProtection",
597
- props: /* @__PURE__ */ Ve({
598
- currentView: {}
599
- }, {
600
- acceptedTerms: {
601
- type: Boolean,
602
- default: !1
603
- },
604
- acceptedTermsModifiers: {}
605
- }),
606
- emits: ["update:acceptedTerms"],
607
- setup(b) {
608
- const {
609
- config: u
610
- } = ce(), d = b, n = Pe(b, "acceptedTerms"), {
611
- getLink: g,
612
- openLegalDoc: h
613
- } = Se(), {
614
- termsShaking: o,
615
- requiresAcceptanceForSignUp: s,
616
- requiresAcceptanceForOAuth: c,
617
- syncAcceptedTerms: r
618
- } = M();
619
- he(n, (_) => {
620
- r(_);
621
- });
622
- const t = R(() => {
623
- const _ = g("userServiceAgreement");
624
- return _ != null && _.configured ? _ : void 0;
625
- }), v = R(() => {
626
- const _ = g("privacyPolicy");
627
- return _ != null && _.configured ? _ : void 0;
628
- }), i = R(() => !!(t.value || v.value)), w = R(() => d.currentView === "signUp" ? s() : d.currentView === "signIn" ? c() : !1), p = R(() => i.value && w.value);
629
- function m() {
630
- if (u.legalDocsMode === "builtin") {
631
- h("userServiceAgreement");
632
- return;
633
- }
634
- wt();
635
- }
636
- function y() {
637
- if (u.legalDocsMode === "builtin") {
638
- h("privacyPolicy");
639
- return;
640
- }
641
- yt();
642
- }
643
- return (_, q) => p.value ? (l(), k("div", {
644
- key: 0,
645
- class: ge(["ServiceAgreementAndPrivacyProtection", {
646
- "terms-shake": e(o)
647
- }])
648
- }, [i.value ? (l(), k(D, {
649
- key: 0
650
- }, [w.value ? (l(), I(e(Ce), {
651
- key: 0,
652
- modelValue: n.value,
653
- "onUpdate:modelValue": q[0] || (q[0] = ($) => n.value = $),
654
- class: "terms-checkbox"
655
- }, {
656
- default: f(() => [...q[1] || (q[1] = [S("span", {
657
- class: "terms-text"
658
- }, "我已阅读并同意", -1)])]),
659
- _: 1
660
- }, 8, ["modelValue"])) : z("", !0), t.value ? (l(), I(e(Y), {
661
- key: 1,
662
- onClick: m
663
- }, {
664
- default: f(() => [x(L(t.value.label), 1)]),
665
- _: 1
666
- })) : z("", !0), t.value && v.value ? (l(), k("span", bt, "和")) : z("", !0), v.value ? (l(), I(e(Y), {
667
- key: 3,
668
- onClick: y
669
- }, {
670
- default: f(() => [x(L(v.value.label), 1)]),
671
- _: 1
672
- })) : z("", !0)], 64)) : z("", !0)], 2)) : z("", !0);
673
- }
674
- }), ee = /* @__PURE__ */ C(_t, [["__scopeId", "data-v-a0c2f361"]]), kt = {
675
- class: "content"
676
- }, St = {
677
- class: "handle"
678
- }, It = /* @__PURE__ */ A({
679
- __name: "AuthkitPasswordAuth",
680
- props: {
681
- size: {
682
- type: String,
683
- required: !0
684
- },
685
- loading: {
686
- type: Boolean,
687
- required: !0,
688
- default: () => !0
689
- },
690
- allowPhone: {
691
- type: Boolean,
692
- default: !1
693
- }
694
- },
695
- emits: ["submit"],
696
- setup(b, {
697
- emit: u
698
- }) {
699
- const d = u, {
700
- useTermsFormField: n
701
- } = M(), {
702
- showTermsField: g,
703
- termsRules: h
704
- } = n("signIn"), o = b, s = P(), c = P({
705
- identifier: void 0,
706
- password: void 0,
707
- acceptedTerms: !1
708
- });
709
- async function r() {
710
- s.value.validate().then((t) => {
711
- t || d("submit", c.value);
712
- });
713
- }
714
- return (t, v) => (l(), k("div", kt, [a(e(H), {
715
- ref_key: "formRef",
716
- ref: s,
717
- model: c.value,
718
- size: o.size,
719
- "auto-label-width": ""
720
- }, {
721
- default: f(() => [a(e(V), {
722
- field: "identifier",
723
- label: "邮箱或手机号",
724
- "hide-label": "",
725
- rules: [{
726
- required: !0,
727
- message: "请输入邮箱或手机号"
728
- }]
729
- }, {
730
- default: f(() => [a(e(U), {
731
- modelValue: c.value.identifier,
732
- "onUpdate:modelValue": v[0] || (v[0] = (i) => c.value.identifier = i),
733
- placeholder: o.allowPhone ? "请输入邮箱或手机号" : "请输入邮箱",
734
- autocomplete: "email username"
735
- }, null, 8, ["modelValue", "placeholder"])]),
736
- _: 1
737
- }), a(e(V), {
738
- field: "password",
739
- label: "密码",
740
- "hide-label": "",
741
- rules: [{
742
- required: !0,
743
- message: "请输入密码"
744
- }]
745
- }, {
746
- default: f(() => [a(e(U), {
747
- modelValue: c.value.password,
748
- "onUpdate:modelValue": v[1] || (v[1] = (i) => c.value.password = i),
749
- placeholder: "请输入密码",
750
- type: "password",
751
- autocomplete: "current-password"
752
- }, null, 8, ["modelValue"])]),
753
- _: 1
754
- }), S("div", St, [a(e(B), {
755
- type: "primary",
756
- loading: o.loading,
757
- long: "",
758
- size: o.size,
759
- onClick: r
760
- }, {
761
- default: f(() => [...v[3] || (v[3] = [x(" 登录 ", -1)])]),
762
- _: 1
763
- }, 8, ["loading", "size"]), e(g) ? (l(), I(e(V), {
764
- key: 0,
765
- field: "acceptedTerms",
766
- "hide-label": "",
767
- rules: e(h)
768
- }, {
769
- default: f(() => [a(ee, {
770
- "accepted-terms": c.value.acceptedTerms,
771
- "onUpdate:acceptedTerms": v[2] || (v[2] = (i) => c.value.acceptedTerms = i),
772
- "current-view": "signIn"
773
- }, null, 8, ["accepted-terms"])]),
774
- _: 1
775
- }, 8, ["rules"])) : z("", !0)])]),
776
- _: 1
777
- }, 8, ["model", "size"])]));
778
- }
779
- }), zt = /* @__PURE__ */ C(It, [["__scopeId", "data-v-cca59a39"]]), Pt = {
780
- class: "SignInPhone"
781
- }, Vt = {
782
- class: "content"
783
- }, At = {
784
- class: "sendVerifyCodeItem"
785
- }, Ut = {
786
- class: "handle"
787
- }, Ct = /* @__PURE__ */ A({
788
- __name: "AuthkitSignInPhone",
789
- props: {
790
- size: {
791
- type: String,
792
- required: !0
793
- },
794
- loading: {
795
- type: Boolean,
796
- required: !0,
797
- default: () => !1
798
- }
799
- },
800
- emits: ["submit"],
801
- setup(b, {
802
- emit: u
803
- }) {
804
- const d = u, {
805
- useTermsFormField: n
806
- } = M(), {
807
- showTermsField: g,
808
- termsRules: h
809
- } = n("signIn"), o = b, s = P(), c = P(!1), r = P(), t = P({
810
- phone: void 0,
811
- code: void 0,
812
- acceptedTerms: !1
813
- });
814
- async function v() {
815
- if (!await r.value.validateField(["phone"])) {
816
- c.value = !0;
817
- const p = await O().auth.verify.sms.send.post({
818
- phone: t.value.phone,
819
- purpose: "signIn"
820
- });
821
- c.value = !1, W(s.value, p);
822
- }
823
- }
824
- async function i() {
825
- r.value.validate().then((w) => {
826
- w || d("submit", {
827
- identifier: t.value.phone,
828
- code: t.value.code,
829
- method: "code"
830
- });
831
- });
832
- }
833
- return (w, p) => (l(), k("div", Pt, [S("div", Vt, [a(e(H), {
834
- ref_key: "formRef",
835
- ref: r,
836
- model: t.value,
837
- size: o.size,
838
- "auto-label-width": ""
839
- }, {
840
- default: f(() => [a(e(V), {
841
- field: "phone",
842
- label: "手机号",
843
- "hide-label": "",
844
- rules: [{
845
- required: !0,
846
- message: "请输入手机号"
847
- }, {
848
- match: /^1[3-9]\d{9}$/,
849
- message: "请输入有效的手机号"
850
- }]
851
- }, {
852
- default: f(() => [a(e(U), {
853
- modelValue: t.value.phone,
854
- "onUpdate:modelValue": p[0] || (p[0] = (m) => t.value.phone = m),
855
- placeholder: "请输入手机号",
856
- autocomplete: "tel",
857
- type: "tel"
858
- }, null, 8, ["modelValue"])]),
859
- _: 1
860
- }), a(e(V), {
861
- field: "code",
862
- label: "验证码",
863
- "hide-label": "",
864
- rules: [{
865
- required: !0,
866
- message: "请输入验证码"
867
- }]
868
- }, {
869
- default: f(() => [S("div", At, [a(e(U), {
870
- modelValue: t.value.code,
871
- "onUpdate:modelValue": p[1] || (p[1] = (m) => t.value.code = m),
872
- placeholder: "请输入验证码",
873
- autocomplete: "one-time-code"
874
- }, null, 8, ["modelValue"]), a(K, {
875
- ref_key: "SendVerifyCodeRef",
876
- ref: s,
877
- size: o.size,
878
- loading: c.value,
879
- style: {
880
- "margin-left": "10px"
881
- },
882
- onSend: v
883
- }, null, 8, ["size", "loading"])])]),
884
- _: 1
885
- }), S("div", Ut, [a(e(B), {
886
- type: "primary",
887
- loading: o.loading,
888
- long: "",
889
- size: o.size,
890
- onClick: i
891
- }, {
892
- default: f(() => [...p[3] || (p[3] = [x(" 登录 ", -1)])]),
893
- _: 1
894
- }, 8, ["loading", "size"]), e(g) ? (l(), I(e(V), {
895
- key: 0,
896
- field: "acceptedTerms",
897
- "hide-label": "",
898
- rules: e(h)
899
- }, {
900
- default: f(() => [a(ee, {
901
- "accepted-terms": t.value.acceptedTerms,
902
- "onUpdate:acceptedTerms": p[2] || (p[2] = (m) => t.value.acceptedTerms = m),
903
- "current-view": "signIn"
904
- }, null, 8, ["accepted-terms"])]),
905
- _: 1
906
- }, 8, ["rules"])) : z("", !0)])]),
907
- _: 1
908
- }, 8, ["model", "size"])])]));
909
- }
910
- }), $t = /* @__PURE__ */ C(Ct, [["__scopeId", "data-v-ef67e91c"]]), Tt = {
911
- class: "SignInEmailCode"
912
- }, Rt = {
913
- class: "sendVerifyCodeItem"
914
- }, qt = {
915
- class: "handle"
916
- }, xt = /* @__PURE__ */ A({
917
- __name: "AuthkitSignInEmailCode",
918
- props: {
919
- size: {
920
- type: String,
921
- required: !0
922
- },
923
- loading: {
924
- type: Boolean,
925
- required: !0,
926
- default: () => !1
927
- }
928
- },
929
- emits: ["submit"],
930
- setup(b, {
931
- emit: u
932
- }) {
933
- const d = u, {
934
- useTermsFormField: n
935
- } = M(), {
936
- showTermsField: g,
937
- termsRules: h
938
- } = n("signIn"), o = b, s = P(), c = P(!1), r = P(), t = P({
939
- email: void 0,
940
- code: void 0,
941
- emailVerifyId: "",
942
- acceptedTerms: !1
943
- });
944
- async function v() {
945
- var p;
946
- if (!await r.value.validateField(["email"])) {
947
- c.value = !0;
948
- const m = await O().auth.verify.email.retry.post({
949
- email: t.value.email,
950
- purpose: "signIn"
951
- });
952
- c.value = !1, (p = m.data) != null && p.emailVerifyId && (t.value.emailVerifyId = m.data.emailVerifyId), W(s.value, m);
953
- }
954
- }
955
- async function i() {
956
- r.value.validate().then((w) => {
957
- w || d("submit", {
958
- identifier: t.value.email,
959
- code: t.value.code,
960
- emailVerifyId: t.value.emailVerifyId,
961
- method: "code"
962
- });
963
- });
964
- }
965
- return (w, p) => (l(), k("div", Tt, [a(e(H), {
966
- ref_key: "formRef",
967
- ref: r,
968
- model: t.value,
969
- size: o.size,
970
- "auto-label-width": ""
971
- }, {
972
- default: f(() => [a(e(V), {
973
- field: "email",
974
- "hide-label": "",
975
- rules: [{
976
- required: !0,
977
- message: "请输入邮箱"
978
- }, {
979
- type: "email",
980
- message: "请输入有效的邮箱"
981
- }]
982
- }, {
983
- default: f(() => [a(e(U), {
984
- modelValue: t.value.email,
985
- "onUpdate:modelValue": p[0] || (p[0] = (m) => t.value.email = m),
986
- placeholder: "请输入邮箱",
987
- autocomplete: "email"
988
- }, null, 8, ["modelValue"])]),
989
- _: 1
990
- }), a(e(V), {
991
- field: "code",
992
- "hide-label": "",
993
- rules: [{
994
- required: !0,
995
- message: "请输入验证码"
996
- }]
997
- }, {
998
- default: f(() => [S("div", Rt, [a(e(U), {
999
- modelValue: t.value.code,
1000
- "onUpdate:modelValue": p[1] || (p[1] = (m) => t.value.code = m),
1001
- placeholder: "请输入验证码",
1002
- autocomplete: "one-time-code"
1003
- }, null, 8, ["modelValue"]), a(K, {
1004
- ref_key: "SendVerifyCodeRef",
1005
- ref: s,
1006
- size: o.size,
1007
- loading: c.value,
1008
- style: {
1009
- "margin-left": "10px"
1010
- },
1011
- onSend: v
1012
- }, null, 8, ["size", "loading"])])]),
1013
- _: 1
1014
- }), S("div", qt, [a(e(B), {
1015
- type: "primary",
1016
- loading: o.loading,
1017
- long: "",
1018
- size: o.size,
1019
- onClick: i
1020
- }, {
1021
- default: f(() => [...p[3] || (p[3] = [x(" 登录 ", -1)])]),
1022
- _: 1
1023
- }, 8, ["loading", "size"]), e(g) ? (l(), I(e(V), {
1024
- key: 0,
1025
- field: "acceptedTerms",
1026
- "hide-label": "",
1027
- rules: e(h)
1028
- }, {
1029
- default: f(() => [a(ee, {
1030
- "accepted-terms": t.value.acceptedTerms,
1031
- "onUpdate:acceptedTerms": p[2] || (p[2] = (m) => t.value.acceptedTerms = m),
1032
- "current-view": "signIn"
1033
- }, null, 8, ["accepted-terms"])]),
1034
- _: 1
1035
- }, 8, ["rules"])) : z("", !0)])]),
1036
- _: 1
1037
- }, 8, ["model", "size"])]));
1038
- }
1039
- }), Lt = /* @__PURE__ */ C(xt, [["__scopeId", "data-v-fee4702f"]]), Bt = {
1040
- class: "SwitchSignUpOrResetPassword"
1041
- }, Ot = {
1042
- key: 0
1043
- }, Mt = /* @__PURE__ */ A({
1044
- __name: "AuthkitSwitchSignUpOrResetPassword",
1045
- props: {
1046
- showSignUp: {
1047
- type: Boolean,
1048
- default: !0
1049
- },
1050
- showResetPassword: {
1051
- type: Boolean,
1052
- default: !0
1053
- }
1054
- },
1055
- emits: ["switchSignUp", "switchResetPassword"],
1056
- setup(b, {
1057
- emit: u
1058
- }) {
1059
- const d = b, n = u;
1060
- function g() {
1061
- n("switchSignUp");
1062
- }
1063
- function h() {
1064
- n("switchResetPassword");
1065
- }
1066
- return (o, s) => (l(), k("div", Bt, [d.showSignUp ? (l(), k("span", Ot, [s[1] || (s[1] = S("span", null, " 还没有账户?", -1)), a(e(Y), {
1067
- style: {
1068
- padding: "0px"
1069
- },
1070
- onClick: g
1071
- }, {
1072
- default: f(() => [...s[0] || (s[0] = [x("去注册?", -1)])]),
1073
- _: 1
1074
- })])) : z("", !0), d.showResetPassword ? (l(), I(e(Y), {
1075
- key: 1,
1076
- style: {
1077
- padding: "0px"
1078
- },
1079
- onClick: h
1080
- }, {
1081
- default: f(() => [...s[2] || (s[2] = [x(" 忘记密码? ", -1)])]),
1082
- _: 1
1083
- })) : z("", !0)]));
1084
- }
1085
- }), Ft = /* @__PURE__ */ C(Mt, [["__scopeId", "data-v-6ca7b1f2"]]), Dt = {
1086
- class: "SignIn"
1087
- }, Et = {
1088
- key: 0,
1089
- class: "tabsContainer"
1090
- }, Ht = /* @__PURE__ */ A({
1091
- __name: "AuthkitSignIn",
1092
- props: {
1093
- size: {
1094
- type: String,
1095
- required: !0
1096
- },
1097
- loading: {
1098
- type: Boolean,
1099
- required: !0,
1100
- default: () => !0
1101
- }
1102
- },
1103
- emits: ["submit", "switchSignUp", "switchResetPassword"],
1104
- setup(b, {
1105
- emit: u
1106
- }) {
1107
- const d = u, n = b, g = Ae(), h = R(() => !!g.OAuth), {
1108
- appsData: o
1109
- } = j(), {
1110
- signUpAuthEnabled: s
1111
- } = M(), c = R(() => o.value.authMethods), r = R(() => s.value && (c.value.signUp.email || c.value.signUp.phone)), t = R(() => c.value.login.emailPassword || c.value.login.phonePassword), v = R(() => {
1112
- const y = [];
1113
- return (c.value.login.emailPassword || c.value.login.phonePassword) && y.push({
1114
- key: "password",
1115
- title: "密码登录"
1116
- }), c.value.login.phoneCode && y.push({
1117
- key: "phoneCode",
1118
- title: "手机验证码登录"
1119
- }), c.value.login.emailCode && y.push({
1120
- key: "emailCode",
1121
- title: "邮箱验证码登录"
1122
- }), y;
1123
- }), i = P("password");
1124
- ne(() => {
1125
- var y;
1126
- v.value.some((_) => _.key === i.value) || (i.value = ((y = v.value[0]) == null ? void 0 : y.key) || "password");
1127
- });
1128
- function w() {
1129
- d("switchSignUp");
1130
- }
1131
- function p() {
1132
- d("switchResetPassword");
1133
- }
1134
- async function m(y) {
1135
- d("submit", {
1136
- method: i.value === "password" ? "password" : "code",
1137
- ...y
1138
- });
1139
- }
1140
- return (y, _) => (l(), k("div", Dt, [v.value.length > 1 ? (l(), k("div", Et, [a(e(ue), {
1141
- "active-key": i.value,
1142
- "onUpdate:activeKey": _[0] || (_[0] = (q) => i.value = q)
1143
- }, {
1144
- default: f(() => [(l(!0), k(D, null, le(v.value, (q) => (l(), I(e(de), {
1145
- key: q.key,
1146
- title: q.title
1147
- }, null, 8, ["title"]))), 128))]),
1148
- _: 1
1149
- }, 8, ["active-key"])])) : z("", !0), i.value === "password" && (c.value.login.emailPassword || c.value.login.phonePassword) ? (l(), I(zt, {
1150
- key: 1,
1151
- loading: n.loading,
1152
- size: n.size,
1153
- "allow-phone": c.value.login.phonePassword,
1154
- onSubmit: m
1155
- }, null, 8, ["loading", "size", "allow-phone"])) : i.value === "phoneCode" ? (l(), I($t, {
1156
- key: 2,
1157
- loading: n.loading,
1158
- size: n.size,
1159
- onSubmit: m
1160
- }, null, 8, ["loading", "size"])) : i.value === "emailCode" ? (l(), I(Lt, {
1161
- key: 3,
1162
- loading: n.loading,
1163
- size: n.size,
1164
- onSubmit: m
1165
- }, null, 8, ["loading", "size"])) : z("", !0), h.value ? Z(y.$slots, "OAuth", {
1166
- key: 4
1167
- }, void 0, !0) : z("", !0), a(Ft, {
1168
- "show-sign-up": r.value,
1169
- "show-reset-password": t.value,
1170
- onSwitchSignUp: w,
1171
- onSwitchResetPassword: p
1172
- }, null, 8, ["show-sign-up", "show-reset-password"])]));
1173
- }
1174
- }), Gt = /* @__PURE__ */ C(Ht, [["__scopeId", "data-v-a7aef80e"]]), Nt = {
1175
- class: "content"
1176
- }, jt = {
1177
- class: "sendVerifyCodeItem"
1178
- }, Kt = {
1179
- class: "handle"
1180
- }, Wt = /* @__PURE__ */ A({
1181
- __name: "AuthkitEmailUpdate",
1182
- props: {
1183
- size: {
1184
- type: String,
1185
- required: !0
1186
- },
1187
- loading: {
1188
- type: Boolean,
1189
- required: !0,
1190
- default: () => !0
1191
- },
1192
- purpose: {
1193
- type: String,
1194
- default: "signUp"
1195
- }
1196
- },
1197
- emits: ["submit"],
1198
- setup(b, {
1199
- emit: u
1200
- }) {
1201
- const d = u, {
1202
- useTermsFormField: n
1203
- } = M(), {
1204
- showTermsField: g,
1205
- termsRules: h
1206
- } = n("signUp"), o = b, s = P(), c = P(!1), r = P(), t = P({
1207
- email: void 0,
1208
- userToken: void 0,
1209
- emailVerifyId: void 0,
1210
- password: void 0,
1211
- confirmPassword: void 0,
1212
- inviteCode: void 0,
1213
- acceptedTerms: !1
1214
- });
1215
- E(() => {
1216
- const w = ke();
1217
- w && (t.value.inviteCode = w);
1218
- });
1219
- async function v() {
1220
- if (!await r.value.validateField(["email"])) {
1221
- c.value = !0;
1222
- const p = await O().auth.verify.email.retry.post({
1223
- email: t.value.email,
1224
- purpose: o.purpose
1225
- });
1226
- c.value = !1, p.data && (t.value.emailVerifyId = p.data.emailVerifyId), W(s.value, p);
1227
- }
1228
- }
1229
- async function i() {
1230
- r.value.validate().then((w) => {
1231
- w || d("submit", t.value);
1232
- });
1233
- }
1234
- return (w, p) => (l(), k("div", Nt, [a(e(H), {
1235
- ref_key: "formRef",
1236
- ref: r,
1237
- model: t.value,
1238
- size: o.size,
1239
- "auto-label-width": ""
1240
- }, {
1241
- default: f(() => [a(e(V), {
1242
- field: "email",
1243
- label: "邮箱",
1244
- "hide-label": "",
1245
- rules: [{
1246
- required: !0,
1247
- message: "请输入邮箱"
1248
- }, {
1249
- type: "email",
1250
- message: "请输入有效的邮箱"
1251
- }]
1252
- }, {
1253
- default: f(() => [a(e(U), {
1254
- modelValue: t.value.email,
1255
- "onUpdate:modelValue": p[0] || (p[0] = (m) => t.value.email = m),
1256
- placeholder: "请输入邮箱",
1257
- autocomplete: "email username",
1258
- type: "email"
1259
- }, null, 8, ["modelValue"])]),
1260
- _: 1
1261
- }), a(e(V), {
1262
- field: "userToken",
1263
- label: "验证码",
1264
- "hide-label": "",
1265
- rules: [{
1266
- required: !0,
1267
- message: "请输入验证码"
1268
- }]
1269
- }, {
1270
- default: f(() => [S("div", jt, [a(e(U), {
1271
- modelValue: t.value.userToken,
1272
- "onUpdate:modelValue": p[1] || (p[1] = (m) => t.value.userToken = m),
1273
- placeholder: "请输入验证码",
1274
- autocomplete: "one-time-code"
1275
- }, null, 8, ["modelValue"]), a(K, {
1276
- ref_key: "SendVerifyCodeRef",
1277
- ref: s,
1278
- size: o.size,
1279
- loading: c.value,
1280
- style: {
1281
- "margin-left": "10px"
1282
- },
1283
- onSend: v
1284
- }, null, 8, ["size", "loading"])])]),
1285
- _: 1
1286
- }), a(e(V), {
1287
- field: "password",
1288
- label: "密码",
1289
- "hide-label": "",
1290
- rules: [{
1291
- required: !0,
1292
- message: "密码请输入"
1293
- }, {
1294
- minLength: 10,
1295
- message: "密码不能少于10字符"
1296
- }]
1297
- }, {
1298
- default: f(() => [a(e(U), {
1299
- modelValue: t.value.password,
1300
- "onUpdate:modelValue": p[2] || (p[2] = (m) => t.value.password = m),
1301
- placeholder: "请输入密码",
1302
- type: "password",
1303
- autocomplete: "new-password"
1304
- }, null, 8, ["modelValue"])]),
1305
- _: 1
1306
- }), a(e(V), {
1307
- field: "confirmPassword",
1308
- label: "确认密码",
1309
- "hide-label": "",
1310
- rules: [{
1311
- required: !0,
1312
- message: "请输入确认密码"
1313
- }, {
1314
- minLength: 10,
1315
- message: "确认密码不能少于10字符"
1316
- }, {
1317
- validator: (m, y) => {
1318
- m !== t.value.password ? y("两次密码输入不一致,请重新输入") : y();
1319
- }
1320
- }]
1321
- }, {
1322
- default: f(() => [a(e(U), {
1323
- modelValue: t.value.confirmPassword,
1324
- "onUpdate:modelValue": p[3] || (p[3] = (m) => t.value.confirmPassword = m),
1325
- placeholder: "请输入确认密码密码",
1326
- type: "password",
1327
- autocomplete: "new-password"
1328
- }, null, 8, ["modelValue"])]),
1329
- _: 1
1330
- }, 8, ["rules"]), a(e(V), {
1331
- field: "inviteCode",
1332
- label: "邀请码",
1333
- "hide-label": "",
1334
- rules: [{
1335
- required: !1
1336
- }]
1337
- }, {
1338
- default: f(() => [a(e(U), {
1339
- modelValue: t.value.inviteCode,
1340
- "onUpdate:modelValue": p[4] || (p[4] = (m) => t.value.inviteCode = m),
1341
- placeholder: "邀请码(可选)",
1342
- autocomplete: "off"
1343
- }, null, 8, ["modelValue"])]),
1344
- _: 1
1345
- }), S("div", Kt, [a(e(B), {
1346
- type: "primary",
1347
- loading: o.loading,
1348
- long: "",
1349
- size: o.size,
1350
- onClick: i
1351
- }, {
1352
- default: f(() => [...p[6] || (p[6] = [x(" 提交 ", -1)])]),
1353
- _: 1
1354
- }, 8, ["loading", "size"]), e(g) ? (l(), I(e(V), {
1355
- key: 0,
1356
- field: "acceptedTerms",
1357
- "hide-label": "",
1358
- rules: e(h)
1359
- }, {
1360
- default: f(() => [a(ee, {
1361
- "accepted-terms": t.value.acceptedTerms,
1362
- "onUpdate:acceptedTerms": p[5] || (p[5] = (m) => t.value.acceptedTerms = m),
1363
- "current-view": "signUp"
1364
- }, null, 8, ["accepted-terms"])]),
1365
- _: 1
1366
- }, 8, ["rules"])) : z("", !0)])]),
1367
- _: 1
1368
- }, 8, ["model", "size"])]));
1369
- }
1370
- }), Qt = /* @__PURE__ */ C(Wt, [["__scopeId", "data-v-07ef9d49"]]), Jt = {
1371
- class: "SignUpPhone"
1372
- }, Xt = {
1373
- class: "content"
1374
- }, Yt = {
1375
- class: "sendVerifyCodeItem"
1376
- }, Zt = {
1377
- class: "handle"
1378
- }, es = /* @__PURE__ */ A({
1379
- __name: "AuthkitSignUpPhone",
1380
- props: {
1381
- size: {
1382
- type: String,
1383
- required: !0
1384
- },
1385
- loading: {
1386
- type: Boolean,
1387
- required: !0,
1388
- default: () => !1
1389
- },
1390
- /** 是否要求设置密码 */
1391
- requirePassword: {
1392
- type: Boolean,
1393
- default: !1
1394
- }
1395
- },
1396
- emits: ["switchSignIn", "submit"],
1397
- setup(b, {
1398
- emit: u
1399
- }) {
1400
- const d = u, {
1401
- useTermsFormField: n
1402
- } = M(), {
1403
- showTermsField: g,
1404
- termsRules: h
1405
- } = n("signUp"), o = b, s = P(), c = P(!1), r = P(), t = P({
1406
- phone: void 0,
1407
- code: void 0,
1408
- password: void 0,
1409
- confirmPassword: void 0,
1410
- inviteCode: void 0,
1411
- acceptedTerms: !1
1412
- });
1413
- E(() => {
1414
- const m = ke();
1415
- m && (t.value.inviteCode = m);
1416
- });
1417
- const v = [{
1418
- required: !0,
1419
- message: "请输入确认密码"
1420
- }, {
1421
- validator: (m, y) => {
1422
- t.value.password && m !== t.value.password ? y("两次密码输入不一致") : y();
1423
- }
1424
- }];
1425
- function i() {
1426
- d("switchSignIn");
1427
- }
1428
- async function w() {
1429
- if (!await r.value.validateField(["phone"])) {
1430
- c.value = !0;
1431
- const y = await O().auth.verify.sms.send.post({
1432
- phone: t.value.phone,
1433
- purpose: "signUp"
1434
- });
1435
- c.value = !1, W(s.value, y);
1436
- }
1437
- }
1438
- async function p() {
1439
- r.value.validate().then((m) => {
1440
- m || d("submit", {
1441
- type: "phone",
1442
- phone: t.value.phone,
1443
- code: t.value.code,
1444
- password: t.value.password,
1445
- inviteCode: t.value.inviteCode
1446
- });
1447
- });
1448
- }
1449
- return (m, y) => (l(), k("div", Jt, [S("div", Xt, [a(e(H), {
1450
- ref_key: "formRef",
1451
- ref: r,
1452
- model: t.value,
1453
- size: o.size,
1454
- "auto-label-width": ""
1455
- }, {
1456
- default: f(() => [a(e(V), {
1457
- field: "phone",
1458
- label: "手机号",
1459
- "hide-label": "",
1460
- rules: [{
1461
- required: !0,
1462
- message: "请输入手机号"
1463
- }, {
1464
- match: /^1[3-9]\d{9}$/,
1465
- message: "请输入有效的手机号"
1466
- }]
1467
- }, {
1468
- default: f(() => [a(e(U), {
1469
- modelValue: t.value.phone,
1470
- "onUpdate:modelValue": y[0] || (y[0] = (_) => t.value.phone = _),
1471
- placeholder: "请输入手机号",
1472
- autocomplete: "tel",
1473
- type: "tel"
1474
- }, null, 8, ["modelValue"])]),
1475
- _: 1
1476
- }), a(e(V), {
1477
- field: "code",
1478
- label: "验证码",
1479
- "hide-label": "",
1480
- rules: [{
1481
- required: !0,
1482
- message: "请输入验证码"
1483
- }]
1484
- }, {
1485
- default: f(() => [S("div", Yt, [a(e(U), {
1486
- modelValue: t.value.code,
1487
- "onUpdate:modelValue": y[1] || (y[1] = (_) => t.value.code = _),
1488
- placeholder: "请输入验证码",
1489
- autocomplete: "one-time-code"
1490
- }, null, 8, ["modelValue"]), a(K, {
1491
- ref_key: "SendVerifyCodeRef",
1492
- ref: s,
1493
- size: o.size,
1494
- loading: c.value,
1495
- style: {
1496
- "margin-left": "10px"
1497
- },
1498
- onSend: w
1499
- }, null, 8, ["size", "loading"])])]),
1500
- _: 1
1501
- }), o.requirePassword ? (l(), I(e(V), {
1502
- key: 0,
1503
- field: "password",
1504
- label: "密码",
1505
- "hide-label": "",
1506
- rules: [{
1507
- required: o.requirePassword,
1508
- message: "密码请输入"
1509
- }, {
1510
- minLength: 10,
1511
- message: "密码不能少于10字符"
1512
- }]
1513
- }, {
1514
- default: f(() => [a(e(U), {
1515
- modelValue: t.value.password,
1516
- "onUpdate:modelValue": y[2] || (y[2] = (_) => t.value.password = _),
1517
- placeholder: "请输入密码(可选)",
1518
- type: "password",
1519
- autocomplete: "new-password"
1520
- }, null, 8, ["modelValue"])]),
1521
- _: 1
1522
- }, 8, ["rules"])) : z("", !0), o.requirePassword && t.value.password ? (l(), I(e(V), {
1523
- key: 1,
1524
- field: "confirmPassword",
1525
- label: "确认密码",
1526
- "hide-label": "",
1527
- rules: v
1528
- }, {
1529
- default: f(() => [a(e(U), {
1530
- modelValue: t.value.confirmPassword,
1531
- "onUpdate:modelValue": y[3] || (y[3] = (_) => t.value.confirmPassword = _),
1532
- placeholder: "请输入确认密码",
1533
- type: "password",
1534
- autocomplete: "new-password"
1535
- }, null, 8, ["modelValue"])]),
1536
- _: 1
1537
- })) : z("", !0), a(e(V), {
1538
- field: "inviteCode",
1539
- label: "邀请码",
1540
- "hide-label": "",
1541
- rules: [{
1542
- required: !1
1543
- }]
1544
- }, {
1545
- default: f(() => [a(e(U), {
1546
- modelValue: t.value.inviteCode,
1547
- "onUpdate:modelValue": y[4] || (y[4] = (_) => t.value.inviteCode = _),
1548
- placeholder: "邀请码(可选)",
1549
- autocomplete: "off"
1550
- }, null, 8, ["modelValue"])]),
1551
- _: 1
1552
- }), S("div", Zt, [a(e(B), {
1553
- type: "primary",
1554
- loading: o.loading,
1555
- long: "",
1556
- size: o.size,
1557
- onClick: p
1558
- }, {
1559
- default: f(() => [...y[6] || (y[6] = [x(" 注册 ", -1)])]),
1560
- _: 1
1561
- }, 8, ["loading", "size"]), e(g) ? (l(), I(e(V), {
1562
- key: 0,
1563
- field: "acceptedTerms",
1564
- "hide-label": "",
1565
- rules: e(h)
1566
- }, {
1567
- default: f(() => [a(ee, {
1568
- "accepted-terms": t.value.acceptedTerms,
1569
- "onUpdate:acceptedTerms": y[5] || (y[5] = (_) => t.value.acceptedTerms = _),
1570
- "current-view": "signUp"
1571
- }, null, 8, ["accepted-terms"])]),
1572
- _: 1
1573
- }, 8, ["rules"])) : z("", !0)])]),
1574
- _: 1
1575
- }, 8, ["model", "size"])]), a(pe, {
1576
- onSwitchSignIn: i
1577
- })]));
1578
- }
1579
- }), ts = /* @__PURE__ */ C(es, [["__scopeId", "data-v-d0af58fd"]]), ss = {
1580
- class: "SignUp"
1581
- }, as = {
1582
- key: 0,
1583
- class: "tabsContainer"
1584
- }, os = {
1585
- key: 1,
1586
- class: "empty"
1587
- }, is = {
1588
- key: 2,
1589
- class: "empty"
1590
- }, ns = {
1591
- key: 2,
1592
- class: "empty"
1593
- }, ls = /* @__PURE__ */ A({
1594
- __name: "AuthkitSignUp",
1595
- props: {
1596
- size: {
1597
- type: String,
1598
- required: !0
1599
- },
1600
- loading: {
1601
- type: Boolean,
1602
- required: !0,
1603
- default: () => !0
1604
- }
1605
- },
1606
- emits: ["switchSignIn", "submit"],
1607
- setup(b, {
1608
- emit: u
1609
- }) {
1610
- const d = u, n = b, {
1611
- appsData: g
1612
- } = j(), {
1613
- registrationBlocked: h,
1614
- signUpAuthEnabled: o
1615
- } = M(), s = R(() => g.value.authMethods), c = R(() => {
1616
- const i = [];
1617
- return s.value.signUp.email && i.push({
1618
- key: "email",
1619
- title: "邮箱注册"
1620
- }), s.value.signUp.phone && i.push({
1621
- key: "phone",
1622
- title: "手机号注册"
1623
- }), i;
1624
- }), r = P("email");
1625
- ne(() => {
1626
- var i;
1627
- c.value.some((w) => w.key === r.value) || (r.value = ((i = c.value[0]) == null ? void 0 : i.key) || "email");
1628
- });
1629
- function t() {
1630
- d("switchSignIn");
1631
- }
1632
- async function v(i) {
1633
- d("submit", {
1634
- type: r.value,
1635
- ...i
1636
- });
1637
- }
1638
- return (i, w) => (l(), k("div", ss, [c.value.length > 1 ? (l(), k("div", as, [a(e(ue), {
1639
- "active-key": r.value,
1640
- "onUpdate:activeKey": w[0] || (w[0] = (p) => r.value = p)
1641
- }, {
1642
- default: f(() => [(l(!0), k(D, null, le(c.value, (p) => (l(), I(e(de), {
1643
- key: p.key,
1644
- title: p.title
1645
- }, null, 8, ["title"]))), 128))]),
1646
- _: 1
1647
- }, 8, ["active-key"])])) : z("", !0), e(o) ? e(h) ? (l(), k("div", is, " 管理员尚未配置用户协议或隐私政策,暂无法注册。 ")) : (l(), k(D, {
1648
- key: 3
1649
- }, [r.value === "email" && s.value.signUp.email ? (l(), I(Qt, {
1650
- key: 0,
1651
- size: n.size,
1652
- loading: b.loading,
1653
- onSubmit: v
1654
- }, null, 8, ["size", "loading"])) : r.value === "phone" && s.value.signUp.phone ? (l(), I(ts, {
1655
- key: 1,
1656
- size: n.size,
1657
- loading: b.loading,
1658
- onSubmit: v,
1659
- onSwitchSignIn: t
1660
- }, null, 8, ["size", "loading"])) : (l(), k("div", ns, " 当前应用未开放用户注册 ")), r.value === "email" ? (l(), I(pe, {
1661
- key: 3,
1662
- onSwitchSignIn: t
1663
- })) : z("", !0)], 64)) : (l(), k("div", os, " 系统已停止用户注册 "))]));
1664
- }
1665
- }), rs = /* @__PURE__ */ C(ls, [["__scopeId", "data-v-b211d5ef"]]), us = ["src"], ds = /* @__PURE__ */ A({
1666
- __name: "AuthkitAuthTitle",
1667
- props: {
1668
- size: {
1669
- type: [String, Number],
1670
- required: !1,
1671
- default: 30
1672
- },
1673
- fontSize: {
1674
- type: Number,
1675
- required: !1,
1676
- default: 18
1677
- },
1678
- lineHeight: {
1679
- type: Number,
1680
- required: !1,
1681
- default: 60
1682
- }
1683
- },
1684
- setup(b) {
1685
- const u = b, d = `${u.size}px`, n = `${u.fontSize}px`, g = `${u.lineHeight}px`, {
1686
- currentView: h
1687
- } = N(), {
1688
- appsData: o
1689
- } = j(), s = R(() => h.value === "signIn" ? `${o.value.name}登录` : h.value === "signUp" ? `${o.value.name}账号注册` : h.value === "resetPassword" ? `${o.value.name}密码重置` : "");
1690
- return (c, r) => (l(), k("div", {
1691
- class: "Title",
1692
- style: G({
1693
- fontSize: n,
1694
- lineHeight: g
1695
- })
1696
- }, [e(o).applicationLogoUrl ? (l(), k("img", {
1697
- key: 0,
1698
- src: e(o).applicationLogoUrl,
1699
- srcset: "",
1700
- style: G({
1701
- width: d
1702
- })
1703
- }, null, 12, us)) : z("", !0), S("span", null, L(s.value), 1), Z(c.$slots, "default", {}, void 0, !0)], 4));
1704
- }
1705
- }), ze = /* @__PURE__ */ C(ds, [["__scopeId", "data-v-8ebe7939"]]), cs = {
1706
- class: "Auth"
1707
- }, ps = {
1708
- class: "body"
1709
- }, ms = /* @__PURE__ */ A({
1710
- __name: "AuthkitAuth",
1711
- props: {
1712
- size: {
1713
- type: String,
1714
- required: !0
1715
- },
1716
- showTitle: {
1717
- type: Boolean,
1718
- default: () => !0
1719
- }
1720
- },
1721
- setup(b) {
1722
- const u = b, {
1723
- signInSubmit: d,
1724
- passkeySignInSubmit: n,
1725
- signUpSubmit: g,
1726
- resetPasswordSubmit: h,
1727
- currentView: o,
1728
- authSignInLoading: s,
1729
- authSignUpLoading: c,
1730
- resetPasswordLoading: r,
1731
- switchSignUp: t,
1732
- switchResetPassword: v,
1733
- switchSignIn: i
1734
- } = N();
1735
- return (w, p) => (l(), k("div", cs, [b.showTitle ? (l(), I(ze, {
1736
- key: 0,
1737
- size: 32,
1738
- "font-size": 20
1739
- })) : z("", !0), S("div", ps, [e(o) === "signIn" ? (l(), I(Gt, {
1740
- key: 0,
1741
- size: u.size,
1742
- loading: e(s),
1743
- onSwitchSignUp: e(t),
1744
- onSwitchResetPassword: e(v),
1745
- onSubmit: p[0] || (p[0] = (m) => e(d)(m))
1746
- }, {
1747
- OAuth: f(() => [a(et, {
1748
- size: u.size,
1749
- onPasskeySubmit: e(n)
1750
- }, null, 8, ["size", "onPasskeySubmit"])]),
1751
- _: 1
1752
- }, 8, ["size", "loading", "onSwitchSignUp", "onSwitchResetPassword"])) : e(o) === "signUp" ? (l(), I(rs, {
1753
- key: 1,
1754
- size: u.size,
1755
- loading: e(c),
1756
- onSwitchSignIn: e(i),
1757
- onSubmit: p[1] || (p[1] = (m) => e(g)(m))
1758
- }, null, 8, ["size", "loading", "onSwitchSignIn"])) : e(o) === "resetPassword" ? (l(), I(gt, {
1759
- key: 2,
1760
- size: u.size,
1761
- loading: e(r),
1762
- onSwitchSignIn: e(i),
1763
- onSubmit: p[2] || (p[2] = (m) => e(h)(m))
1764
- }, null, 8, ["size", "loading", "onSwitchSignIn"])) : z("", !0)])]));
1765
- }
1766
- }), fs = /* @__PURE__ */ C(ms, [["__scopeId", "data-v-60874d88"]]), vs = /* @__PURE__ */ A({
1767
- __name: "AuthkitAuthModal",
1768
- props: {
1769
- size: {
1770
- default: "large"
1771
- }
1772
- },
1773
- emits: ["close"],
1774
- setup(b, {
1775
- emit: u
1776
- }) {
1777
- const d = u, {
1778
- onSignIn: n,
1779
- switchSignIn: g
1780
- } = N(), {
1781
- close: h
1782
- } = we();
1783
- let o = null;
1784
- E(() => {
1785
- o = n(() => h());
1786
- }), re(() => {
1787
- o == null || o(), o = null;
1788
- });
1789
- function s(r) {
1790
- r || c();
1791
- }
1792
- function c() {
1793
- g(), h(), d("close");
1794
- }
1795
- return (r, t) => (l(), I(e($e), {
1796
- visible: !0,
1797
- footer: !1,
1798
- "mask-closable": !1,
1799
- "title-align": "center",
1800
- width: "auto",
1801
- "modal-class": "SignInModalClass",
1802
- "onUpdate:visible": s,
1803
- onClose: c
1804
- }, {
1805
- title: f(() => [a(ze)]),
1806
- default: f(() => [a(fs, {
1807
- "show-title": !1,
1808
- size: b.size
1809
- }, null, 8, ["size"])]),
1810
- _: 1
1811
- }));
1812
- }
1813
- }), gs = /* @__PURE__ */ C(vs, [["__scopeId", "data-v-19a4d5d0"]]), hs = /* @__PURE__ */ A({
1814
- __name: "AuthkitOAuthCallbackProvider",
1815
- props: {
1816
- bindIdentityRedirect: {
1817
- default: ""
1818
- },
1819
- closePopupOnBindSuccess: {
1820
- type: Boolean,
1821
- default: !0
1822
- },
1823
- restoreRedirectAfterSignIn: {
1824
- type: Boolean,
1825
- default: !0
1826
- }
1827
- },
1828
- setup(b) {
1829
- const u = b, d = ["token", "userId", "appId", "error", "needBindIdentity", "bindSuccess", "provider"], {
1830
- completeSignIn: n
1831
- } = N(), g = ye();
1832
- function h(r) {
1833
- return d.some((t) => r.searchParams.has(t));
1834
- }
1835
- function o(r) {
1836
- d.forEach((v) => r.searchParams.delete(v));
1837
- const t = `${r.pathname}${r.search}${r.hash}`;
1838
- window.history.replaceState({}, "", t);
1839
- }
1840
- function s() {
1841
- if (!u.restoreRedirectAfterSignIn) return null;
1842
- const r = sessionStorage.getItem("auth_redirect");
1843
- if (sessionStorage.removeItem("auth_redirect"), !r) return null;
1844
- const t = window.location.pathname + window.location.search + window.location.hash;
1845
- return r === t ? null : r;
1846
- }
1847
- async function c() {
1848
- if (typeof window > "u") return;
1849
- const r = new URL(window.location.href);
1850
- if (!h(r)) return;
1851
- const t = r.searchParams.get("error");
1852
- if (t) {
1853
- o(r), X.error(t);
1854
- return;
1855
- }
1856
- if (r.searchParams.get("bindSuccess") === "true") {
1857
- const y = r.searchParams.get("provider");
1858
- o(r), X.success(y ? `${y} 绑定成功` : "绑定成功"), u.closePopupOnBindSuccess && window.opener && setTimeout(() => window.close(), 800);
1859
- return;
1860
- }
1861
- const v = r.searchParams.get("token");
1862
- if (!v) return;
1863
- const i = r.searchParams.get("userId"), w = r.searchParams.get("appId"), p = r.searchParams.get("needBindIdentity") === "true";
1864
- if (o(r), n({
1865
- jwtToken: v,
1866
- userId: i,
1867
- appId: w,
1868
- needBindIdentity: p
1869
- }), p && u.bindIdentityRedirect) {
1870
- await g.replace(u.bindIdentityRedirect);
1871
- return;
1872
- }
1873
- const m = s();
1874
- m && await g.replace(m);
1875
- }
1876
- return E(() => {
1877
- c();
1878
- }), (r, t) => null;
1879
- }
1880
- }), ra = /* @__PURE__ */ A({
1881
- __name: "AuthkitProvider",
1882
- props: {
1883
- handleOAuthCallback: {
1884
- type: Boolean,
1885
- default: !0
1886
- },
1887
- restoreSession: {
1888
- type: Boolean,
1889
- default: !0
1890
- },
1891
- fetchAppInfo: {
1892
- type: Boolean,
1893
- default: !0
1894
- },
1895
- showAuthModal: {
1896
- type: Boolean,
1897
- default: !0
1898
- },
1899
- authModalSize: {
1900
- default: "large"
1901
- },
1902
- bindIdentityRedirect: {
1903
- default: ""
1904
- },
1905
- closePopupOnBindSuccess: {
1906
- type: Boolean,
1907
- default: !0
1908
- },
1909
- restoreRedirectAfterSignIn: {
1910
- type: Boolean,
1911
- default: !0
1912
- }
1913
- },
1914
- emits: ["toPrivacyPolicy", "toUserServiceAgreement"],
1915
- setup(b, {
1916
- emit: u
1917
- }) {
1918
- const {
1919
- config: d
1920
- } = ce(), n = b, g = u, h = Ue(), {
1921
- openLegalDoc: o
1922
- } = Se({
1923
- route: h
1924
- }), {
1925
- isOpen: s
1926
- } = we(), {
1927
- restoreSession: c,
1928
- onSignIn: r,
1929
- onSignOut: t
1930
- } = N(), {
1931
- fetchUserProfile: v,
1932
- clearUserProfile: i
1933
- } = Ie(), {
1934
- appsAuthPageInfoApi: w
1935
- } = j(), p = r(() => {
1936
- v();
1937
- }), m = t(() => {
1938
- i();
1939
- });
1940
- function y() {
1941
- if (d.legalDocsMode === "builtin") {
1942
- o("privacyPolicy");
1943
- return;
1944
- }
1945
- g("toPrivacyPolicy");
1946
- }
1947
- function _() {
1948
- if (d.legalDocsMode === "builtin") {
1949
- o("userServiceAgreement");
1950
- return;
1951
- }
1952
- g("toUserServiceAgreement");
1953
- }
1954
- return E(async () => {
1955
- ht({
1956
- onPrivacyPolicy: y,
1957
- onUserServiceAgreement: _
1958
- }), n.fetchAppInfo && await w(), n.restoreSession && c() ? v() : i();
1959
- }), re(() => {
1960
- p(), m();
1961
- }), (q, $) => (l(), k(D, null, [Z(q.$slots, "default"), n.handleOAuthCallback ? (l(), I(hs, {
1962
- key: 0,
1963
- "bind-identity-redirect": n.bindIdentityRedirect,
1964
- "close-popup-on-bind-success": n.closePopupOnBindSuccess,
1965
- "restore-redirect-after-sign-in": n.restoreRedirectAfterSignIn
1966
- }, null, 8, ["bind-identity-redirect", "close-popup-on-bind-success", "restore-redirect-after-sign-in"])) : z("", !0), n.showAuthModal && e(s) ? (l(), I(gs, {
1967
- key: 1,
1968
- size: n.authModalSize
1969
- }, null, 8, ["size"])) : z("", !0)], 64));
1970
- }
1971
- }), ys = {
1972
- class: "header"
1973
- }, ws = ["href"], bs = {
1974
- class: "container"
1975
- }, _s = /* @__PURE__ */ A({
1976
- __name: "AuthkitAuthContainer",
1977
- props: {
1978
- applicationLogoUrl: {
1979
- type: String,
1980
- required: !0,
1981
- default: () => ""
1982
- },
1983
- name: {
1984
- type: String,
1985
- required: !0,
1986
- default: () => ""
1987
- },
1988
- description: {
1989
- type: String,
1990
- required: !0,
1991
- default: () => ""
1992
- },
1993
- appHomePage: {
1994
- type: String,
1995
- required: !0,
1996
- default: () => ""
1997
- },
1998
- backgroundImage: {
1999
- type: String,
2000
- required: !0,
2001
- default: () => ""
2002
- },
2003
- backgroundColor: {
2004
- type: String,
2005
- required: !0,
2006
- default: () => ""
2007
- },
2008
- linkColor: {
2009
- type: String,
2010
- default: "var(--huyooo-accent-primary)"
2011
- },
2012
- backgroundType: {
2013
- type: String,
2014
- default: "color"
2015
- }
2016
- },
2017
- setup(b) {
2018
- const u = b, d = R(() => u.backgroundType === "color" ? {
2019
- backgroundColor: u.backgroundColor
2020
- } : {
2021
- backgroundImage: `url(${u.backgroundImage})`
2022
- });
2023
- return (n, g) => (l(), k("div", {
2024
- class: "auth",
2025
- style: G(d.value)
2026
- }, [S("div", ys, [u.name ? (l(), k("a", {
2027
- key: 0,
2028
- href: u.appHomePage,
2029
- target: "_self",
2030
- class: "link",
2031
- style: G({
2032
- color: u.linkColor
2033
- })
2034
- }, " 返回主页 ", 12, ws)) : z("", !0)]), S("div", bs, [Z(n.$slots, "default", {}, void 0, !0)])], 4));
2035
- }
2036
- }), ua = /* @__PURE__ */ C(_s, [["__scopeId", "data-v-0e13d3ff"]]), ks = {
2037
- class: "box"
2038
- }, Ss = {
2039
- class: "title"
2040
- }, Is = {
2041
- class: "content"
2042
- }, zs = {
2043
- class: "redirect"
2044
- }, Ps = {
2045
- style: {
2046
- "font-weight": "bold",
2047
- "font-size": "12px"
2048
- }
2049
- }, Vs = /* @__PURE__ */ A({
2050
- __name: "AuthkitAuthorize",
2051
- props: {
2052
- size: {
2053
- type: String,
2054
- required: !0
2055
- },
2056
- title: {
2057
- type: String,
2058
- required: !0,
2059
- default: () => "授权登录"
2060
- },
2061
- logo: {
2062
- type: String,
2063
- required: !0,
2064
- default: () => ""
2065
- },
2066
- clientId: {
2067
- type: String,
2068
- required: !0,
2069
- default: () => ""
2070
- },
2071
- responseType: {
2072
- type: String,
2073
- required: !0,
2074
- default: () => ""
2075
- },
2076
- scope: {
2077
- type: String,
2078
- required: !0,
2079
- default: () => ""
2080
- },
2081
- state: {
2082
- type: String,
2083
- required: !0,
2084
- default: () => ""
2085
- },
2086
- redirectUri: {
2087
- type: String,
2088
- required: !0,
2089
- default: () => ""
2090
- },
2091
- userInfo: {
2092
- type: Object,
2093
- required: !0,
2094
- default: () => ""
2095
- }
2096
- },
2097
- setup(b) {
2098
- const u = P(!1), d = b, n = P({
2099
- name: "",
2100
- homePageUrl: "",
2101
- createAt: "",
2102
- authorizationCallback: ""
2103
- });
2104
- async function g() {
2105
- const {
2106
- data: o,
2107
- error: s
2108
- } = await O().auth.apps.authPageInfo.post({});
2109
- s || !o || (n.value = {
2110
- name: o.name,
2111
- homePageUrl: o.homePageUrl || "",
2112
- createAt: "",
2113
- authorizationCallback: o.authorizationCallback || ""
2114
- });
2115
- }
2116
- g();
2117
- async function h() {
2118
- u.value = !0;
2119
- const {
2120
- data: o,
2121
- error: s
2122
- } = await O().auth.oauth2.authorize.post({
2123
- client_id: d.clientId,
2124
- response_type: d.responseType,
2125
- scope: d.scope,
2126
- state: d.state,
2127
- redirect_uri: d.redirectUri
2128
- });
2129
- if (u.value = !1, s || !o)
2130
- return;
2131
- const c = o;
2132
- window.location.href = c.authorizeUrl;
2133
- }
2134
- return (o, s) => (l(), k("div", ks, [S("div", Ss, L(`授权 ${n.value.name}`), 1), S("div", Is, [a(e(Te), null, {
2135
- default: f(() => [a(e(oe), null, {
2136
- default: f(() => {
2137
- var c;
2138
- return [a(e(ie), {
2139
- title: n.value.name,
2140
- description: `想要使用您的${(c = d.userInfo) == null ? void 0 : c.nickname}账户`
2141
- }, {
2142
- avatar: f(() => {
2143
- var r;
2144
- return [a(e(te), {
2145
- shape: "square",
2146
- "image-url": (r = d.userInfo) == null ? void 0 : r.avatar
2147
- }, null, 8, ["image-url"])];
2148
- }),
2149
- _: 1
2150
- }, 8, ["title", "description"])];
2151
- }),
2152
- _: 1
2153
- }), a(e(oe), null, {
2154
- default: f(() => [a(e(ie), {
2155
- title: "公开信息",
2156
- description: "头像、昵称"
2157
- }, {
2158
- avatar: f(() => [a(e(te), {
2159
- shape: "square"
2160
- }, {
2161
- default: f(() => [...s[0] || (s[0] = [S("img", {
2162
- alt: "avatar",
2163
- src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
2164
- }, null, -1)])]),
2165
- _: 1
2166
- })]),
2167
- _: 1
2168
- })]),
2169
- _: 1
2170
- }), a(e(oe), null, {
2171
- default: f(() => [a(e(ie), {
2172
- title: "个人用户数据",
2173
- description: "电子邮件地址"
2174
- }, {
2175
- avatar: f(() => [a(e(te), {
2176
- shape: "square"
2177
- }, {
2178
- default: f(() => [...s[1] || (s[1] = [S("img", {
2179
- alt: "avatar",
2180
- src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
2181
- }, null, -1)])]),
2182
- _: 1
2183
- })]),
2184
- _: 1
2185
- })]),
2186
- _: 1
2187
- })]),
2188
- _: 1
2189
- }), a(e(B), {
2190
- type: "primary",
2191
- size: d.size,
2192
- loading: u.value,
2193
- onClick: h
2194
- }, {
2195
- default: f(() => [...s[2] || (s[2] = [x(" 授权 ", -1)])]),
2196
- _: 1
2197
- }, 8, ["size", "loading"]), S("div", zs, [s[3] || (s[3] = S("div", {
2198
- class: "redirect-hint"
2199
- }, "授权后将跳转至", -1)), S("div", Ps, L(n.value.authorizationCallback), 1)])])]));
2200
- }
2201
- }), da = /* @__PURE__ */ C(Vs, [["__scopeId", "data-v-6c1792d3"]]), As = {
2202
- class: "oauth-callback"
2203
- }, Us = {
2204
- key: 0,
2205
- class: "callback-loading"
2206
- }, Cs = {
2207
- key: 1,
2208
- class: "callback-error"
2209
- }, $s = {
2210
- key: 2,
2211
- class: "callback-success"
2212
- }, Ts = /* @__PURE__ */ A({
2213
- __name: "AuthkitOauthCallback",
2214
- props: {
2215
- defaultRedirect: {},
2216
- loadingText: {},
2217
- bindIdentityRedirect: {}
2218
- },
2219
- emits: ["success", "error", "needBindIdentity"],
2220
- setup(b, {
2221
- emit: u
2222
- }) {
2223
- const d = b, n = u, g = P(!0), h = P(""), o = P("登录成功,正在跳转..."), {
2224
- completeSignIn: s,
2225
- restoreSession: c
2226
- } = N(), r = ye();
2227
- async function t() {
2228
- const i = new URLSearchParams(window.location.search), w = i.get("error");
2229
- if (w) {
2230
- h.value = w, g.value = !1, n("error", h.value);
2231
- return;
2232
- }
2233
- if (i.get("bindSuccess") === "true") {
2234
- o.value = "绑定成功,可以关闭此页面", window.history.replaceState({}, "", window.location.pathname), g.value = !1, setTimeout(() => {
2235
- window.close();
2236
- }, 800);
2237
- return;
2238
- }
2239
- const p = i.get("token"), m = i.get("userId"), y = i.get("appId"), _ = i.get("needBindIdentity") === "true";
2240
- if (!p) {
2241
- h.value = "登录失败:未收到认证令牌", g.value = !1, n("error", h.value);
2242
- return;
2243
- }
2244
- try {
2245
- s({
2246
- jwtToken: p,
2247
- userId: m,
2248
- appId: y,
2249
- needBindIdentity: _
2250
- });
2251
- const q = window.location.pathname;
2252
- if (window.history.replaceState({}, "", q), _ && (n("needBindIdentity", {
2253
- token: p,
2254
- userId: m || "",
2255
- appId: y || ""
2256
- }), d.bindIdentityRedirect)) {
2257
- await r.replace(d.bindIdentityRedirect);
2258
- return;
2259
- }
2260
- n("success", {
2261
- token: p,
2262
- userId: m || "",
2263
- appId: y || "",
2264
- needBindIdentity: _
2265
- });
2266
- const $ = sessionStorage.getItem("auth_redirect");
2267
- sessionStorage.removeItem("auth_redirect");
2268
- const T = $ || d.defaultRedirect || "/";
2269
- await r.replace(T);
2270
- } catch (q) {
2271
- console.error("OAuth 回调处理失败:", q), h.value = "登录处理失败,请重试", g.value = !1, n("error", h.value);
2272
- }
2273
- }
2274
- function v() {
2275
- const i = sessionStorage.getItem("auth_redirect");
2276
- sessionStorage.removeItem("auth_redirect"), r.replace(i || d.defaultRedirect || "/");
2277
- }
2278
- return E(() => {
2279
- const i = new URLSearchParams(window.location.search);
2280
- if (i.has("token") || i.has("error") || i.has("bindSuccess"))
2281
- t();
2282
- else if (c()) {
2283
- const w = sessionStorage.getItem("auth_redirect");
2284
- sessionStorage.removeItem("auth_redirect"), r.replace(w || d.defaultRedirect || "/");
2285
- } else
2286
- h.value = "无效的访问", g.value = !1;
2287
- }), (i, w) => (l(), k("div", As, [g.value ? (l(), k("div", Us, [w[0] || (w[0] = S("div", {
2288
- class: "spinner"
2289
- }, null, -1)), S("p", null, L(b.loadingText), 1)])) : h.value ? (l(), k("div", Cs, [w[1] || (w[1] = S("div", {
2290
- class: "error-icon"
2291
- }, "✕", -1)), w[2] || (w[2] = S("h2", null, "登录失败", -1)), S("p", null, L(h.value), 1), S("button", {
2292
- class: "retry-btn",
2293
- onClick: v
2294
- }, "返回重试")])) : (l(), k("div", $s, [w[3] || (w[3] = S("div", {
2295
- class: "success-icon"
2296
- }, "✓", -1)), S("p", null, L(o.value), 1)]))]));
2297
- }
2298
- }), ca = /* @__PURE__ */ C(Ts, [["__scopeId", "data-v-aa652ea3"]]), Rs = {
2299
- class: "oauth-binding-account"
2300
- }, qs = {
2301
- key: 1,
2302
- class: "oauth-binding-account__icon"
2303
- }, xs = {
2304
- class: "oauth-binding-account__info"
2305
- }, Ls = {
2306
- class: "oauth-binding-account__name"
2307
- }, Bs = /* @__PURE__ */ A({
2308
- __name: "AuthkitGithubBinding",
2309
- props: {
2310
- size: {
2311
- type: String,
2312
- required: !0
2313
- }
2314
- },
2315
- setup(b) {
2316
- const {
2317
- config: u
2318
- } = ce(), {
2319
- userProfile: d,
2320
- fetchUserProfile: n
2321
- } = Ie(), g = P("hidden"), h = P(!1);
2322
- let o;
2323
- const s = b, c = R(() => {
2324
- var m, y, _;
2325
- return ((y = (m = d.value) == null ? void 0 : m.github) == null ? void 0 : y.avatar_url) || ((_ = d.value) == null ? void 0 : _.avatar) || "";
2326
- }), {
2327
- getOauthCallbackUrl: r
2328
- } = _e();
2329
- function t(m) {
2330
- g.value = m;
2331
- }
2332
- async function v() {
2333
- const m = u.appId;
2334
- if (!m) {
2335
- console.error("GitHub OAuth 失败: appId 未配置");
2336
- return;
2337
- }
2338
- const {
2339
- data: y,
2340
- error: _
2341
- } = await O().auth.oauth.github.login.get({
2342
- appId: m,
2343
- mode: "bind",
2344
- redirectUri: r()
2345
- });
2346
- _ || !y || (h.value = !0, window.open(y.redirectUri, "_blank"));
2347
- }
2348
- async function i() {
2349
- const {
2350
- error: m
2351
- } = await O().auth.users.unbind.oauth.post({
2352
- provider: "github"
2353
- });
2354
- m || (X.success("解绑成功"), g.value = "hidden", n());
2355
- }
2356
- function w() {
2357
- g.value === "bind" && (g.value = "hidden", v()), g.value === "unbind" && i();
2358
- }
2359
- function p() {
2360
- h.value && n();
2361
- }
2362
- return E(() => {
2363
- d.value || n(), o = setInterval(p, 1e3);
2364
- }), re(() => {
2365
- o && clearInterval(o);
2366
- }), (m, y) => {
2367
- var _, q, $;
2368
- return l(), k(D, null, [!((_ = e(d)) != null && _.github) && g.value === "hidden" ? (l(), I(e(me), {
2369
- key: 0,
2370
- title: "绑定GitHub"
2371
- }, {
2372
- action: f(() => [a(e(B), {
2373
- size: s.size,
2374
- type: "primary",
2375
- onClick: y[0] || (y[0] = (T) => t("bind"))
2376
- }, {
2377
- default: f(() => [...y[2] || (y[2] = [x(" 绑定GitHub ", -1)])]),
2378
- _: 1
2379
- }, 8, ["size"])]),
2380
- default: f(() => [y[3] || (y[3] = x(" 您还未绑定GitHub账号,请点击绑定。 ", -1))]),
2381
- _: 1
2382
- })) : z("", !0), (q = e(d)) != null && q.github && g.value === "hidden" ? (l(), I(e(me), {
2383
- key: 1,
2384
- title: "解绑GitHub"
2385
- }, {
2386
- action: f(() => [a(e(B), {
2387
- size: s.size,
2388
- type: "primary",
2389
- onClick: y[1] || (y[1] = (T) => t("unbind"))
2390
- }, {
2391
- default: f(() => [...y[5] || (y[5] = [x(" 解绑GitHub ", -1)])]),
2392
- _: 1
2393
- }, 8, ["size"])]),
2394
- default: f(() => {
2395
- var T, F;
2396
- return [S("div", Rs, [c.value ? (l(), I(e(te), {
2397
- key: 0,
2398
- class: "oauth-binding-account__avatar",
2399
- "image-url": c.value,
2400
- size: 42
2401
- }, null, 8, ["image-url"])) : (l(), k("div", qs, [a(be, {
2402
- icon: e(J).github,
2403
- size: e(Fe),
2404
- alt: "GitHub"
2405
- }, null, 8, ["icon", "size"])])), S("div", xs, [y[4] || (y[4] = S("div", {
2406
- class: "oauth-binding-account__provider"
2407
- }, "GitHub", -1)), S("div", Ls, L(((F = (T = e(d)) == null ? void 0 : T.github) == null ? void 0 : F.login) || "GitHub"), 1)])])];
2408
- }),
2409
- _: 1
2410
- })) : z("", !0), g.value === "bind" || g.value === "unbind" ? (l(), I(De, {
2411
- key: 2,
2412
- size: s.size,
2413
- email: ($ = e(d)) == null ? void 0 : $.email,
2414
- onNext: w
2415
- }, null, 8, ["size", "email"])) : z("", !0)], 64);
2416
- };
2417
- }
2418
- }), pa = /* @__PURE__ */ C(Bs, [["__scopeId", "data-v-4f673706"]]), Os = /* @__PURE__ */ A({
2419
- __name: "LegalDocViewer",
2420
- props: {
2421
- type: {},
2422
- appId: {}
2423
- },
2424
- setup(b) {
2425
- const u = b, d = R(() => Ee[u.type] ?? ""), n = P(!1), g = P(null);
2426
- async function h() {
2427
- if (!u.type || !u.appId) {
2428
- g.value = null;
2429
- return;
2430
- }
2431
- n.value = !0;
2432
- const o = await je(u.appId);
2433
- if (n.value = !1, !o) {
2434
- g.value = null;
2435
- return;
2436
- }
2437
- const s = o[u.type];
2438
- g.value = He(s) ? s : null;
2439
- }
2440
- return he(() => [u.type, u.appId], () => {
2441
- h();
2442
- }, {
2443
- immediate: !0
2444
- }), (o, s) => n.value ? (l(), I(e(Re), {
2445
- key: 0,
2446
- loading: n.value,
2447
- class: "legal-doc-viewer-loading"
2448
- }, null, 8, ["loading"])) : g.value ? (l(), I(e(Ge), {
2449
- key: 2,
2450
- modelValue: g.value,
2451
- "onUpdate:modelValue": s[1] || (s[1] = (c) => g.value = c),
2452
- editable: !1
2453
- }, {
2454
- title: f(() => [a(e(Ne), {
2455
- modelValue: d.value,
2456
- "onUpdate:modelValue": s[0] || (s[0] = (c) => d.value = c),
2457
- editable: !1,
2458
- class: "legal-doc-viewer-title"
2459
- }, null, 8, ["modelValue"])]),
2460
- _: 1
2461
- }, 8, ["modelValue"])) : (l(), I(e(qe), {
2462
- key: 1,
2463
- description: "暂无内容"
2464
- }));
2465
- }
2466
- }), ma = /* @__PURE__ */ C(Os, [["__scopeId", "data-v-fe9a3621"]]);
2467
- export {
2468
- fs as A,
2469
- Qt as E,
2470
- ma as L,
2471
- Q as O,
2472
- zt as P,
2473
- gt as R,
2474
- ee as S,
2475
- hs as _,
2476
- ua as a,
2477
- gs as b,
2478
- ze as c,
2479
- da as d,
2480
- pa as e,
2481
- ca as f,
2482
- et as g,
2483
- it as h,
2484
- ut as i,
2485
- ra as j,
2486
- Gt as k,
2487
- $t as l,
2488
- rs as m,
2489
- ts as n,
2490
- pe as o,
2491
- Ft as p
2492
- };