@huyooo/ui 1.0.7 → 2.0.1

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 (75) hide show
  1. package/dist/AuthkitAppSetting-DCQH9IpU.js +2678 -0
  2. package/dist/{Contact-BWuVR9ho.js → Contact-C7ROEqe-.js} +9 -9
  3. package/dist/{CustomTable-BzGfaAVH.js → CustomTable-GgvDEidl.js} +1 -1
  4. package/dist/FeedbackModal.vue_vue_type_script_setup_true_lang-C1hPqnNT.js +1531 -0
  5. package/dist/{LegalDocViewer-DM8FYBpf.js → LegalDocViewer-D_QUh0uf.js} +747 -748
  6. package/dist/MessageHandle-DKoySsCG.js +1233 -0
  7. package/dist/{MessageList-Ce-_LNTk.js → MessageList-HSiKkUoD.js} +4 -4
  8. package/dist/PaySubscriptions-NcATVJGm.js +1331 -0
  9. package/dist/{PricingPlans-CV97ck9p.js → PricingPlans-CZn6eJby.js} +99 -105
  10. package/dist/{ReferrerReferees-DgygiIiE.js → ReferrerReferees-BoOQIssE.js} +47 -46
  11. package/dist/Upload.vue_vue_type_script_setup_true_lang-CkS2S9Xc.js +83 -0
  12. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-0Td42Nb3.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-BrNx6JWe.js} +64 -65
  13. package/dist/WidthContainer-BJLdZfzF.js +717 -0
  14. package/dist/api/billingSubscriptionApi.d.ts +4 -1
  15. package/dist/apiClients-CR-hEwog.js +245 -0
  16. package/dist/authkit.js +10 -10
  17. package/dist/common/globalConfig.d.ts +36 -18
  18. package/dist/common.js +2 -2
  19. package/dist/components/Authkit/Auth/AuthkitOauthCallback.vue.d.ts +2 -2
  20. package/dist/components/Authkit/AuthkitProvider.vue.d.ts +0 -5
  21. package/dist/components/Feedback/FeedbackDetails.vue.d.ts +11 -0
  22. package/dist/components/Upload/Upload.vue.d.ts +7 -6
  23. package/dist/composables/Authkit/useAuthkitAuth.d.ts +3 -0
  24. package/dist/composables/Billing/usePaymentReturn.d.ts +1 -0
  25. package/dist/composables/uploadFeedbackAttachment.d.ts +8 -1
  26. package/dist/composables/useMessageList.d.ts +2 -1
  27. package/dist/composables.d.ts +2 -2
  28. package/dist/composables.js +46 -46
  29. package/dist/feedback.js +2 -2
  30. package/dist/{fetchAuthPageAboutUs-dzTSwRsB.js → fetchAuthPageAboutUs-BnKWq_TL.js} +4 -4
  31. package/dist/{index-BkLvw1PU.js → index-BhVwozr0.js} +1 -1
  32. package/dist/legalDocs/resolveAppId.d.ts +1 -1
  33. package/dist/main.d.ts +4 -3
  34. package/dist/main.js +464 -469
  35. package/dist/message.js +53 -52
  36. package/dist/pay.js +4 -4
  37. package/dist/privateCom.js +1 -1
  38. package/dist/referrer.js +1 -1
  39. package/dist/{useUploadCos-C8BqFPkx.js → runtime-DMCyhVcI.js} +2305 -2185
  40. package/dist/runtime.d.ts +22 -0
  41. package/dist/style.css +1 -1
  42. package/dist/types/api/auth.generated.d.ts +0 -10
  43. package/dist/upload/browserCosTransport.d.ts +22 -0
  44. package/dist/upload/browserUploadService.d.ts +21 -0
  45. package/dist/upload.d.ts +2 -1
  46. package/dist/upload.js +5 -4
  47. package/dist/{useAuthkitAppsAuthPageInfo-CNudJd04.js → useAuthkitAppsAuthPageInfo-Byu0yvrx.js} +18 -21
  48. package/dist/useAuthkitAuth-M2vTpEcb.js +272 -0
  49. package/dist/{useAuthkitCreateAndUpdate-BsINsI-E.js → useAuthkitCreateAndUpdate-D2_Bdazi.js} +1 -1
  50. package/dist/useAuthkitUsersProfile-DdUAENic.js +39 -0
  51. package/dist/useBillingStatusOptions-Jq6Wqfxb.js +61 -0
  52. package/dist/{useEnsureAuthenticated-DNkCCy_Y.js → useEnsureAuthenticated-Hel8hWLJ.js} +2 -2
  53. package/dist/{useLegalDocs-DQP_Yq6B.js → useLegalDocs-BOjqYRyQ.js} +25 -25
  54. package/dist/useMessageNotifications-AznFeFMD.js +80 -0
  55. package/dist/{useRoutePermission-CEiya9AM.js → useRoutePermission-BmUXTwQc.js} +2 -2
  56. package/dist/{useSEO-CDWxbk8B.js → useSEO-Chz4Zxuu.js} +89 -86
  57. package/dist/useSubscriptionCheckout-3ivcOcgC.js +353 -0
  58. package/dist/user.js +1 -1
  59. package/dist/utils/apiClients.d.ts +20 -12
  60. package/dist/utils/apiMiddlewares.d.ts +9 -23
  61. package/package.json +1 -1
  62. package/dist/AuthkitAppSetting-BN8-xgNq.js +0 -2674
  63. package/dist/FeedbackModal.vue_vue_type_script_setup_true_lang-DrL_XBqf.js +0 -1481
  64. package/dist/MessageHandle-mEkCsv9e.js +0 -1173
  65. package/dist/PaySubscriptions-CXkEjqr2.js +0 -1326
  66. package/dist/Upload.vue_vue_type_script_setup_true_lang-VGh2V4o0.js +0 -76
  67. package/dist/WidthContainer-CFMQRsCy.js +0 -721
  68. package/dist/apiClients-BcXOLuYu.js +0 -272
  69. package/dist/composables/Upload/useUploadCos.d.ts +0 -12
  70. package/dist/useAuthkitAuth-3m0yW6uP.js +0 -267
  71. package/dist/useAuthkitUsersProfile-DJlMsftY.js +0 -40
  72. package/dist/useBillingStatusOptions-CfHQOFNw.js +0 -71
  73. package/dist/useMessageNotifications-CAphguOm.js +0 -75
  74. package/dist/useSubscriptionCheckout-d_M_rKRa.js +0 -368
  75. package/dist/utils/billingFetch.d.ts +0 -1
@@ -1,272 +0,0 @@
1
- import { eden as n, defineMiddleware as f, createClient as B } from "@vafast/api-client";
2
- import { ref as b, computed as w } from "vue";
3
- /* empty css */
4
- import { Message as O } from "@arco-design/web-vue";
5
- function h(e, r = 3) {
6
- const t = e.indexOf("@");
7
- if (t > 1) {
8
- const i = e.slice(0, r), a = e.slice(t);
9
- return i + "***" + a;
10
- }
11
- return e;
12
- }
13
- function z(e) {
14
- const r = e.trim();
15
- return r.length < 7 ? r : `${r.slice(0, 3)}****${r.slice(-4)}`;
16
- }
17
- const D = {
18
- normal: "正常",
19
- pending: "待完善",
20
- forbidden: "已禁用",
21
- deleted: "已注销"
22
- };
23
- function se(e) {
24
- return e ? D[e] ?? e : "-";
25
- }
26
- function le(e) {
27
- var t, i, a, c, u, d, v, x, y;
28
- const r = [];
29
- if ((t = e.email) != null && t.trim() && r.push(h(e.email.trim())), (i = e.phone) != null && i.trim() && r.push(z(e.phone.trim())), e.wechat) {
30
- const T = (a = e.wechat.nickname) == null ? void 0 : a.trim();
31
- r.push(T ? `微信(${T})` : "微信");
32
- }
33
- return (u = (c = e.github) == null ? void 0 : c.login) != null && u.trim() && r.push(`GitHub(${e.github.login.trim()})`), (v = (d = e.google) == null ? void 0 : d.email) != null && v.trim() && r.push(h(e.google.email.trim())), (y = (x = e.microsoft) == null ? void 0 : x.email) != null && y.trim() && r.push(h(e.microsoft.email.trim())), r.length > 0 ? r.join(" / ") : "-";
34
- }
35
- const k = /* @__PURE__ */ new Set();
36
- function ce(e) {
37
- return k.add(e), () => {
38
- k.delete(e);
39
- };
40
- }
41
- function L() {
42
- try {
43
- localStorage.removeItem("jwtToken"), localStorage.removeItem("refreshToken");
44
- } catch (e) {
45
- console.warn("Failed to clear localStorage:", e);
46
- }
47
- k.forEach((e) => e());
48
- }
49
- function ue(e) {
50
- try {
51
- localStorage.setItem("jwtToken", e.jwtToken), localStorage.setItem("refreshToken", e.refreshToken);
52
- } catch (r) {
53
- console.warn("Failed to set localStorage:", r);
54
- }
55
- }
56
- function K() {
57
- try {
58
- return localStorage.getItem("refreshToken");
59
- } catch (e) {
60
- return console.warn("Failed to get refreshToken from localStorage:", e), null;
61
- }
62
- }
63
- function _(e) {
64
- try {
65
- localStorage.setItem("jwtToken", e);
66
- } catch (r) {
67
- console.warn("Failed to update jwtToken in localStorage:", r);
68
- }
69
- }
70
- const S = b(void 0);
71
- function R(e) {
72
- var r, t;
73
- return e === "system" ? typeof window < "u" && ((t = (r = window.matchMedia) == null ? void 0 : r.call(window, "(prefers-color-scheme: dark)")) != null && t.matches) ? "dark" : "light" : e;
74
- }
75
- function j(e) {
76
- typeof document > "u" || (e === "dark" ? (document.body.setAttribute("arco-theme", "dark"), document.body.classList.add("dark")) : (document.body.removeAttribute("arco-theme"), document.body.classList.remove("dark")));
77
- }
78
- function de(e) {
79
- S.value = e, j(R(e));
80
- }
81
- let o = {
82
- appId: "",
83
- onesPrefixUrl: "/onesRestfulApi",
84
- authPrefixUrl: "/authRestfulApi",
85
- billingPrefixUrl: "/billingRestfulApi",
86
- logPrefixUrl: "/logRestfulApi",
87
- aiPrefixUrl: "/aiRestfulApi",
88
- webhookPrefixUrl: "/webhookRestfulApi",
89
- oauthCallbackUrl: "",
90
- pricingUrl: "/Pricing",
91
- avatarBucketId: "68350c206888f565dc7d09e9",
92
- feedbackBucketId: "6826e4db6888f565dc775dce",
93
- bucket: "ones-1358549778",
94
- region: "ap-beijing",
95
- web3formsAccessKey: "72604aac-d55e-4df0-9bcf-31b2206b3753",
96
- legalDocsMode: "builtin"
97
- }, F = {};
98
- function fe(e) {
99
- Object.assign(F, e);
100
- }
101
- function he(e) {
102
- o.appId = e.appId, e.theme !== void 0 && (S.value = e.theme, j(R(e.theme))), o.authPrefixUrl = e.authPrefixUrl || "/authRestfulApi", (e.onesPrefixUrl !== void 0 || e.prefixUrl !== void 0) && (o.onesPrefixUrl = e.onesPrefixUrl ?? e.prefixUrl ?? o.onesPrefixUrl), e.billingPrefixUrl !== void 0 && (o.billingPrefixUrl = e.billingPrefixUrl), e.logPrefixUrl !== void 0 && (o.logPrefixUrl = e.logPrefixUrl), e.aiPrefixUrl !== void 0 && (o.aiPrefixUrl = e.aiPrefixUrl), e.webhookPrefixUrl !== void 0 && (o.webhookPrefixUrl = e.webhookPrefixUrl), e.pricingUrl !== void 0 && (o.pricingUrl = e.pricingUrl || "/Pricing"), e.openPricing !== void 0 && (o.openPricing = e.openPricing), e.oauthCallbackUrl !== void 0 ? o.oauthCallbackUrl = e.oauthCallbackUrl : typeof window < "u" && (o.oauthCallbackUrl = `${window.location.origin}/`), e.avatarBucketId !== void 0 && (o.avatarBucketId = e.avatarBucketId), e.feedbackBucketId !== void 0 && (o.feedbackBucketId = e.feedbackBucketId), e.bucket !== void 0 && (o.bucket = e.bucket), e.region !== void 0 && (o.region = e.region), e.web3formsAccessKey !== void 0 && (o.web3formsAccessKey = e.web3formsAccessKey), e.legalDocsMode !== void 0 && (o.legalDocsMode = e.legalDocsMode);
103
- }
104
- function N(e) {
105
- return n(e);
106
- }
107
- function q(e) {
108
- return n(e);
109
- }
110
- function G(e) {
111
- return n(e);
112
- }
113
- function H(e) {
114
- return n(e);
115
- }
116
- function J(e) {
117
- return n(e);
118
- }
119
- function V(e) {
120
- return n(e);
121
- }
122
- const g = b(!1), U = b("signIn");
123
- function W(e) {
124
- e != null && e.view && (U.value = e.view), g.value = !0;
125
- }
126
- function X() {
127
- g.value = !1, U.value = "signIn";
128
- }
129
- function Z() {
130
- return {
131
- open: W,
132
- close: X,
133
- isOpen: w(() => g.value),
134
- view: w(() => U.value)
135
- };
136
- }
137
- const P = 40101, I = 401;
138
- function Q(e) {
139
- var r;
140
- return e.status === I || ((r = e.error) == null ? void 0 : r.code) === I;
141
- }
142
- function Y(e) {
143
- var r;
144
- return Q(e) && ((r = e.error) == null ? void 0 : r.code) !== P;
145
- }
146
- function C() {
147
- const {
148
- open: e
149
- } = Z();
150
- e();
151
- }
152
- function M() {
153
- L(), C();
154
- }
155
- let m = !1, p = [];
156
- function A(e, r = null) {
157
- p.forEach(({
158
- resolve: t,
159
- reject: i
160
- }) => {
161
- e ? i(e) : r && t(r);
162
- }), p = [];
163
- }
164
- async function ee() {
165
- const e = K();
166
- if (!e)
167
- throw new Error("No refresh token available");
168
- try {
169
- const t = await (await fetch(`${o.authPrefixUrl}/auth/refresh`, {
170
- method: "POST",
171
- headers: {
172
- "Content-Type": "application/json",
173
- "app-id": o.appId
174
- },
175
- body: JSON.stringify({
176
- refreshToken: e
177
- })
178
- })).json();
179
- if (t.jwtToken)
180
- return _(t.jwtToken), t.refreshToken && localStorage.setItem("refreshToken", t.refreshToken), t.jwtToken;
181
- throw new Error(t.message || "Token refresh failed");
182
- } catch (r) {
183
- throw console.error("Token refresh failed:", r), r;
184
- }
185
- }
186
- const re = f(async (e, r) => (e.headers.set("app-id", o.appId), r()), {
187
- name: "app-id"
188
- }), te = f(async (e, r) => {
189
- const t = localStorage.getItem("jwtToken");
190
- return t && e.headers.set("authorization", `Bearer ${t}`), r();
191
- }, {
192
- name: "token"
193
- }), E = f(async (e, r) => {
194
- var i;
195
- const t = await r();
196
- if (((i = t.error) == null ? void 0 : i.code) === P) {
197
- if (m)
198
- return new Promise((a, c) => {
199
- p.push({
200
- resolve: async (u) => {
201
- e.headers.set("authorization", `Bearer ${u}`);
202
- const d = await r();
203
- a(d);
204
- },
205
- reject: () => {
206
- c(t);
207
- }
208
- });
209
- });
210
- m = !0;
211
- try {
212
- const a = await ee();
213
- return A(null, a), e.headers.set("authorization", `Bearer ${a}`), await r();
214
- } catch (a) {
215
- return A(a, null), M(), t;
216
- } finally {
217
- m = !1;
218
- }
219
- }
220
- return t;
221
- }, {
222
- name: "token-refresh"
223
- }), $ = f(async (e, r) => {
224
- const t = await r();
225
- return Y(t) ? (M(), t) : (t.error && t.error.code !== P && O.error(t.error.message || "请求失败"), t);
226
- }, {
227
- name: "error-message"
228
- });
229
- function me(e) {
230
- return e.use(E).use($);
231
- }
232
- function s(e) {
233
- return B({
234
- baseURL: e,
235
- timeout: 3e4
236
- }).use(re).use(te).use(E).use($);
237
- }
238
- function l(e) {
239
- let r = null;
240
- return new Proxy({}, {
241
- get(t, i) {
242
- return r || (r = e()), r[i];
243
- }
244
- });
245
- }
246
- const ke = l(() => q(s(o.authPrefixUrl))), pe = l(() => G(s(o.billingPrefixUrl))), be = l(() => J(s(o.onesPrefixUrl))), ge = l(() => H(s(o.logPrefixUrl))), Ue = l(() => N(s(o.aiPrefixUrl))), Pe = l(() => V(s(o.webhookPrefixUrl)));
247
- export {
248
- F as a,
249
- S as b,
250
- fe as c,
251
- de as d,
252
- ke as e,
253
- pe as f,
254
- o as g,
255
- re as h,
256
- E as i,
257
- $ as j,
258
- ce as k,
259
- ue as l,
260
- Ue as m,
261
- ge as n,
262
- be as o,
263
- me as p,
264
- se as q,
265
- L as r,
266
- he as s,
267
- te as t,
268
- Z as u,
269
- le as v,
270
- Pe as w,
271
- h as x
272
- };
@@ -1,12 +0,0 @@
1
- import { default as COS } from 'cos-js-sdk-v5';
2
- interface UploadType {
3
- file: File;
4
- onProgress?: (info: COS.ProgressInfo) => void;
5
- onFileFinish?: COS.onFileFinish;
6
- onError?: (error: COS.CosSdkError) => void;
7
- bucketId: string;
8
- }
9
- export declare function useUploadCos(): {
10
- uploadFile: ({ file, onProgress, onFileFinish, onError, bucketId, }: UploadType) => Promise<void>;
11
- };
12
- export {};
@@ -1,267 +0,0 @@
1
- import { ref as a, computed as p, nextTick as C, readonly as B } from "vue";
2
- import { k as _, r as x, l as P, e as h } from "./apiClients-BcXOLuYu.js";
3
- import { u as M } from "./useAuthkitAppsAuthPageInfo-CNudJd04.js";
4
- const g = a(!1), w = a(!1);
5
- let I;
6
- const $ = "请先阅读并同意用户协议与隐私政策", D = {
7
- required: !1,
8
- userServiceAgreement: !1,
9
- privacyPolicy: !1
10
- };
11
- function A() {
12
- I && clearTimeout(I), w.value = !1, C(() => {
13
- w.value = !0, I = setTimeout(() => {
14
- w.value = !1;
15
- }, 450);
16
- });
17
- }
18
- function G(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($);
30
- }
31
- }];
32
- }
33
- function K() {
34
- const {
35
- appsData: e
36
- } = M(), r = p(() => e.value.registrationTerms ?? D), t = p(() => {
37
- var n;
38
- return ((n = e.value.signUpAuth) == null ? void 0 : n.enabled) !== !1;
39
- }), l = p(() => 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 d() {
47
- g.value = !1;
48
- }
49
- function f() {
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 = p(() => n === "signUp" ? s() : i()), m = p(() => G(() => o.value));
57
- return {
58
- showTermsField: o,
59
- termsRules: m
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: d,
71
- shakeTerms: A,
72
- syncAcceptedTerms: v,
73
- ensureTermsAcceptedForSignIn: f,
74
- useTermsFormField: S
75
- };
76
- }
77
- const c = a("signIn"), E = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), u = a(null), O = "jwtToken";
78
- function j() {
79
- try {
80
- const e = localStorage.getItem(O);
81
- if (e)
82
- return u.value = e, !0;
83
- } catch (e) {
84
- console.warn("Failed to access localStorage:", e);
85
- }
86
- return !1;
87
- }
88
- function N() {
89
- try {
90
- const e = new URL(window.location.href), r = e.searchParams.get("token");
91
- if (!r) return !1;
92
- const t = e.searchParams.get("refreshToken"), l = e.searchParams.get("userId"), s = e.searchParams.get("appId"), i = e.searchParams.get("needBindIdentity") === "true";
93
- t ? P({
94
- jwtToken: r,
95
- refreshToken: t
96
- }) : y(r), ["token", "refreshToken", "userId", "appId", "needBindIdentity", "expiresIn"].forEach((f) => e.searchParams.delete(f));
97
- const d = `${e.pathname}${e.search}${e.hash}`;
98
- return window.history.replaceState({}, "", d), V({
99
- jwtToken: r,
100
- userId: l,
101
- appId: s,
102
- needBindIdentity: i
103
- }), !0;
104
- } catch (e) {
105
- return console.warn("Failed to handle OAuth callback:", e), !1;
106
- }
107
- }
108
- function Y() {
109
- return N() ? !0 : j();
110
- }
111
- function z() {
112
- return u.value || j() ? u.value : null;
113
- }
114
- function y(e) {
115
- u.value = e;
116
- try {
117
- localStorage.setItem(O, e);
118
- } catch (r) {
119
- console.warn("Failed to save token to localStorage:", r);
120
- }
121
- }
122
- function k(e) {
123
- e.refreshToken ? P({
124
- jwtToken: e.jwtToken,
125
- refreshToken: e.refreshToken
126
- }) : y(e.jwtToken), V(e);
127
- }
128
- function H() {
129
- u.value = null, X();
130
- }
131
- _(H);
132
- function J() {
133
- x();
134
- }
135
- function T(e, r) {
136
- return e.add(r), () => {
137
- e.delete(r);
138
- };
139
- }
140
- function V(e) {
141
- E.forEach((r) => {
142
- r(e);
143
- });
144
- }
145
- function Q() {
146
- F.forEach((e) => void e());
147
- }
148
- function W() {
149
- R.forEach((e) => void e());
150
- }
151
- function X() {
152
- L.forEach((e) => void e());
153
- }
154
- function Z(e) {
155
- return T(E, e);
156
- }
157
- function ee(e) {
158
- return T(F, e);
159
- }
160
- function ne(e) {
161
- return T(R, e);
162
- }
163
- function re(e) {
164
- return T(L, e);
165
- }
166
- function ie() {
167
- const e = a(!1), r = a(!1), t = a(!1);
168
- async function l(n) {
169
- e.value = !0;
170
- try {
171
- const {
172
- data: o,
173
- error: m
174
- } = await h.auth.signIn.unified.post({
175
- identifier: n.identifier || n.email || "",
176
- password: n.password,
177
- code: n.code,
178
- emailVerifyId: n.emailVerifyId,
179
- method: n.method || "password"
180
- });
181
- if (m || !o)
182
- return;
183
- k(o);
184
- } finally {
185
- e.value = !1;
186
- }
187
- }
188
- function s(n) {
189
- k(n);
190
- }
191
- async function i(n) {
192
- const {
193
- resetAcceptedTerms: o,
194
- acceptedTerms: m,
195
- requiresAcceptanceForSignUp: b
196
- } = K();
197
- r.value = !0;
198
- const U = b() ? m.value : void 0, {
199
- error: q
200
- } = n.type === "phone" ? await h.auth.signUp.phone.post({
201
- phone: n.phone || "",
202
- code: n.code || "",
203
- password: n.password,
204
- inviteCode: n.inviteCode,
205
- acceptedTerms: U === !0
206
- }) : await h.auth.signUp.post({
207
- email: n.email || "",
208
- userToken: n.userToken || "",
209
- emailVerifyId: n.emailVerifyId || "",
210
- password: n.password || "",
211
- inviteCode: n.inviteCode,
212
- acceptedTerms: U === !0
213
- });
214
- r.value = !1, !q && (o(), c.value = "signIn", Q());
215
- }
216
- async function d(n) {
217
- t.value = !0;
218
- const {
219
- error: o
220
- } = await h.auth.resetPassword.post({
221
- method: n.method || "email",
222
- email: n.email,
223
- phone: n.phone,
224
- userToken: n.userToken,
225
- code: n.code,
226
- emailVerifyId: n.emailVerifyId,
227
- password: n.password
228
- });
229
- t.value = !1, !o && (c.value = "signIn", W());
230
- }
231
- function f() {
232
- c.value = "signUp";
233
- }
234
- function v() {
235
- c.value = "resetPassword";
236
- }
237
- function S() {
238
- c.value = "signIn";
239
- }
240
- return {
241
- signInSubmit: l,
242
- passkeySignInSubmit: s,
243
- signUpSubmit: i,
244
- resetPasswordSubmit: d,
245
- currentView: c,
246
- authSignInLoading: e,
247
- authSignUpLoading: r,
248
- resetPasswordLoading: t,
249
- switchSignUp: f,
250
- switchResetPassword: v,
251
- switchSignIn: S,
252
- onSignIn: Z,
253
- onSignUp: ee,
254
- onResetPassword: ne,
255
- onSignOut: re,
256
- jwtToken: B(u),
257
- getToken: z,
258
- setToken: y,
259
- completeSignIn: k,
260
- restoreSession: Y,
261
- clearAuth: J
262
- };
263
- }
264
- export {
265
- K as a,
266
- ie as u
267
- };
@@ -1,40 +0,0 @@
1
- import { ref as o, computed as r } from "vue";
2
- import { e as f } from "./apiClients-BcXOLuYu.js";
3
- import { u as i } from "./useAuthkitAuth-3m0yW6uP.js";
4
- const t = o(null), l = o(!1), u = o(!1), c = r(() => !!t.value);
5
- async function v() {
6
- const {
7
- getToken: a,
8
- clearAuth: s
9
- } = i();
10
- if (!a()) {
11
- console.warn("No authentication token found"), t.value = null, u.value = !0;
12
- return;
13
- }
14
- l.value = !0, u.value = !1;
15
- try {
16
- const {
17
- data: n,
18
- error: e
19
- } = await f.users.profile.post({});
20
- n ? t.value = n : ((e == null ? void 0 : e.code) === 401 || (e == null ? void 0 : e.code) === 40101) && (t.value = null, console.warn("认证已过期,清除认证状态"), s());
21
- } finally {
22
- l.value = !1, u.value = !0;
23
- }
24
- }
25
- function d() {
26
- t.value = null, u.value = !0;
27
- }
28
- function P() {
29
- return {
30
- userProfile: t,
31
- loading: l,
32
- usersProfileReady: u,
33
- isLoggedIn: c,
34
- fetchUserProfile: v,
35
- clearUserProfile: d
36
- };
37
- }
38
- export {
39
- P as u
40
- };
@@ -1,71 +0,0 @@
1
- import { createClient as f } from "@vafast/api-client";
2
- import { g, h as d, t as v, i as O, j as w, f as u } from "./apiClients-BcXOLuYu.js";
3
- import { ref as c } from "vue";
4
- async function b(i, n) {
5
- const {
6
- data: e,
7
- error: r
8
- } = await y.request("POST", i, n);
9
- if (r)
10
- throw new Error(r.message ?? "请求失败");
11
- if (e == null)
12
- throw new Error("请求失败");
13
- return e;
14
- }
15
- const y = f({
16
- baseURL: g.billingPrefixUrl,
17
- timeout: 3e4
18
- }).use(d).use(v).use(O).use(w), M = {
19
- productOptions: () => b("/products/options")
20
- };
21
- function p(i, n, e, r) {
22
- var t;
23
- const a = ((t = n == null ? void 0 : n.toLowerCase) == null ? void 0 : t.call(n)) ?? n, o = i.find((s) => s.key === n || s.key === a);
24
- return o != null && o[e] ? o[e] : r;
25
- }
26
- function l(i) {
27
- const n = c(!1), e = c([]);
28
- async function r() {
29
- if (e.value.length > 0)
30
- return e.value;
31
- n.value = !0;
32
- try {
33
- const {
34
- data: t,
35
- error: s
36
- } = await i();
37
- return s ? (e.value = [], e.value) : t != null && t.length ? (e.value = t, e.value) : (e.value = [], e.value);
38
- } finally {
39
- n.value = !1;
40
- }
41
- }
42
- function a(t) {
43
- return p(e.value, t, "label", t);
44
- }
45
- function o(t) {
46
- return p(e.value, t, "color", "gray");
47
- }
48
- return {
49
- statusOptionsLoading: n,
50
- statusOptionsList: e,
51
- statusOptionsApi: r,
52
- getStatusLabel: a,
53
- getStatusColor: o
54
- };
55
- }
56
- function C() {
57
- return l(async () => u.pointsRecharge.statusOptions.post({}));
58
- }
59
- function L() {
60
- return l(async () => u.refund.statusOptions.post({}));
61
- }
62
- function R() {
63
- return l(async () => u.invoices.statusOptions.post({}));
64
- }
65
- export {
66
- C as a,
67
- L as b,
68
- l as c,
69
- M as d,
70
- R as u
71
- };