@huyooo/ui 0.11.5 → 0.11.7

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 (47) hide show
  1. package/dist/{AuthkitAppSetting-CSHkDxQT.js → AuthkitAppSetting-DrX6fwKt.js} +11 -10
  2. package/dist/{useEnsureAuthenticated-Cc64hF1O.js → AuthkitGithubBinding-r2oVuCSV.js} +631 -680
  3. package/dist/{Clipboard-CRZDADLE.js → Clipboard-ChMNfcO5.js} +1 -1
  4. package/dist/{Contact-Y0Yczmc9.js → Contact-Yqmjh47e.js} +2 -2
  5. package/dist/{FeedbackItem-D7MpOmoM.js → FeedbackItem-DHp_C0pN.js} +3 -3
  6. package/dist/{FeedbackModal-CvNF1D-5.js → FeedbackModal-Dzl0Alp7.js} +3 -3
  7. package/dist/{MessageHandle-B12koVQL.js → MessageHandle-BcRjYeVi.js} +2 -2
  8. package/dist/{MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-DxDn6Ok8.js → MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-BOtgTje-.js} +2 -2
  9. package/dist/{PaySubscriptions-B8jAtG5n.js → PaySubscriptions-BsU0XmXf.js} +2 -2
  10. package/dist/PricingPlans-Cf20-GqK.js +251 -0
  11. package/dist/{ReferrerReferees-D_Iiw9wZ.js → ReferrerReferees-B-ISyXHw.js} +4 -4
  12. package/dist/{Upload.vue_vue_type_script_setup_true_lang-CbVSY_vt.js → Upload.vue_vue_type_script_setup_true_lang-CDWyo3RL.js} +1 -1
  13. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-DpVadjMH.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-Czix4_tj.js} +8 -8
  14. package/dist/{WidthContainer-B6d4xrGT.js → WidthContainer-CYYbzXj0.js} +20 -19
  15. package/dist/{apiClients-DVz12LeW.js → apiClients-KFp-rs-C.js} +19 -19
  16. package/dist/authkit.js +31 -29
  17. package/dist/common/globalConfig.d.ts +2 -0
  18. package/dist/common.js +1 -1
  19. package/dist/composables/Billing/useBillingPlans.d.ts +29 -1
  20. package/dist/composables.js +41 -40
  21. package/dist/feedback.js +3 -3
  22. package/dist/main.d.ts +1 -0
  23. package/dist/main.js +674 -642
  24. package/dist/message.js +3 -3
  25. package/dist/pay.js +3 -3
  26. package/dist/privateCom.js +1 -1
  27. package/dist/referrer.js +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/upload.js +2 -2
  30. package/dist/{useAuthkitAppsAuthPageInfo-Du5d6VK-.js → useAuthkitAppsAuthPageInfo-B9_VzVkQ.js} +1 -1
  31. package/dist/useAuthkitAuth-Doj5VYjK.js +170 -0
  32. package/dist/{useAuthkitCreateAndUpdate-Bc9D5C6R.js → useAuthkitCreateAndUpdate-DomftQMK.js} +1 -1
  33. package/dist/useAuthkitUsersProfile-FJnHJad-.js +36 -0
  34. package/dist/{useDownloads-BFx1a-f9.js → useDownloads-CzC3gLUV.js} +1 -1
  35. package/dist/useEnsureAuthenticated-D78tsddF.js +56 -0
  36. package/dist/{useLegalLinks-Deksq9h-.js → useLegalLinks-OGVbqXVy.js} +2 -2
  37. package/dist/{useMessageNotifications-DY5xKtif.js → useMessageNotifications-DeHFJFcX.js} +1 -1
  38. package/dist/{useSEO-CvfzTZA9.js → useSEO-BZhVKEZr.js} +2 -2
  39. package/dist/useSubscriptionCheckout-BubIsxjO.js +386 -0
  40. package/dist/{useTableHandle-D71P3Ez_.js → useTableHandle-jw0P7-2a.js} +1 -1
  41. package/dist/{useUploadCos-N5pim6q1.js → useUploadCos-keDKcs0j.js} +1 -1
  42. package/dist/user.js +1 -1
  43. package/dist/utils/legacyApi.d.ts +18 -0
  44. package/package.json +1 -1
  45. package/dist/PricingPlans-CO26OcbJ.js +0 -210
  46. package/dist/useAuthkitUsersProfile-CQGyvL7g.js +0 -201
  47. package/dist/useSubscriptionCheckout-BgQJN61l.js +0 -345
@@ -1,201 +0,0 @@
1
- import { ref as t, readonly as A, computed as E } from "vue";
2
- import { e as d } from "./apiClients-DVz12LeW.js";
3
- const c = t("signIn"), S = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Set(), s = t(null), I = "jwtToken";
4
- function T() {
5
- try {
6
- const e = localStorage.getItem(I);
7
- if (e)
8
- return s.value = e, !0;
9
- } catch (e) {
10
- console.warn("Failed to access localStorage:", e);
11
- }
12
- return !1;
13
- }
14
- function O() {
15
- try {
16
- const e = new URL(window.location.href), o = e.searchParams.get("token");
17
- if (!o) return !1;
18
- const i = e.searchParams.get("userId"), u = e.searchParams.get("appId"), r = e.searchParams.get("needBindIdentity") === "true";
19
- h(o), ["token", "userId", "appId", "needBindIdentity"].forEach((p) => e.searchParams.delete(p));
20
- const g = `${e.pathname}${e.search}${e.hash}`;
21
- return window.history.replaceState({}, "", g), v({
22
- jwtToken: o,
23
- userId: i,
24
- appId: u,
25
- needBindIdentity: r
26
- }), !0;
27
- } catch (e) {
28
- return console.warn("Failed to handle OAuth callback:", e), !1;
29
- }
30
- }
31
- function V() {
32
- return O() ? !0 : T();
33
- }
34
- function j() {
35
- return s.value || T() ? s.value : null;
36
- }
37
- function h(e) {
38
- s.value = e;
39
- try {
40
- localStorage.setItem(I, e);
41
- } catch (o) {
42
- console.warn("Failed to save token to localStorage:", o);
43
- }
44
- }
45
- function b(e) {
46
- h(e.jwtToken), v(e);
47
- }
48
- function F() {
49
- s.value = null;
50
- try {
51
- localStorage.removeItem(I);
52
- } catch (e) {
53
- console.warn("Failed to clear localStorage:", e);
54
- }
55
- $();
56
- }
57
- function w(e, o) {
58
- return e.add(o), () => {
59
- e.delete(o);
60
- };
61
- }
62
- function v(e) {
63
- S.forEach((o) => {
64
- o(e);
65
- });
66
- }
67
- function R() {
68
- k.forEach((e) => void e());
69
- }
70
- function B() {
71
- y.forEach((e) => void e());
72
- }
73
- function $() {
74
- P.forEach((e) => void e());
75
- }
76
- function K(e) {
77
- return w(S, e);
78
- }
79
- function N(e) {
80
- return w(k, e);
81
- }
82
- function _(e) {
83
- return w(y, e);
84
- }
85
- function x(e) {
86
- return w(P, e);
87
- }
88
- function C() {
89
- const e = t(!1), o = t(!1), i = t(!1);
90
- async function u(n) {
91
- e.value = !0;
92
- const {
93
- data: a
94
- } = await d.auth.signIn.unified.post({
95
- identifier: n.identifier || n.email || "",
96
- password: n.password,
97
- code: n.code,
98
- emailVerifyId: n.emailVerifyId,
99
- method: n.method || "password"
100
- });
101
- e.value = !1, a && (h(a.jwtToken), v(a));
102
- }
103
- async function r(n) {
104
- o.value = !0;
105
- const {
106
- error: a
107
- } = n.type === "phone" ? await d.auth.signUp.phone.post({
108
- phone: n.phone || "",
109
- code: n.code || "",
110
- password: n.password,
111
- referrerId: n.referrerId
112
- }) : await d.auth.signUp.post({
113
- email: n.email || "",
114
- userToken: n.userToken || "",
115
- emailVerifyId: n.emailVerifyId || "",
116
- password: n.password || "",
117
- referrerId: n.referrerId
118
- });
119
- o.value = !1, a || (c.value = "signIn", R());
120
- }
121
- async function g(n) {
122
- i.value = !0;
123
- const {
124
- error: a
125
- } = await d.auth.resetPassword.post({
126
- method: n.method || "email",
127
- email: n.email,
128
- phone: n.phone,
129
- userToken: n.userToken,
130
- code: n.code,
131
- emailVerifyId: n.emailVerifyId,
132
- password: n.password
133
- });
134
- i.value = !1, a || (c.value = "signIn", B());
135
- }
136
- function p() {
137
- c.value = "signUp";
138
- }
139
- function U() {
140
- c.value = "resetPassword";
141
- }
142
- function L() {
143
- c.value = "signIn";
144
- }
145
- return {
146
- signInSubmit: u,
147
- signUpSubmit: r,
148
- resetPasswordSubmit: g,
149
- currentView: c,
150
- authSignInLoading: e,
151
- authSignUpLoading: o,
152
- resetPasswordLoading: i,
153
- switchSignUp: p,
154
- switchResetPassword: U,
155
- switchSignIn: L,
156
- onSignIn: K,
157
- onSignUp: N,
158
- onResetPassword: _,
159
- onSignOut: x,
160
- jwtToken: A(s),
161
- getToken: j,
162
- setToken: h,
163
- completeSignIn: b,
164
- restoreSession: V,
165
- clearAuth: F
166
- };
167
- }
168
- const l = t(null), m = t(!1), f = t(!1), G = E(() => !!l.value);
169
- async function Y() {
170
- const {
171
- getToken: e,
172
- clearAuth: o
173
- } = C();
174
- if (!e()) {
175
- console.warn("No authentication token found"), l.value = null;
176
- return;
177
- }
178
- m.value = !0, f.value = !1;
179
- const {
180
- data: u,
181
- error: r
182
- } = await d.users.profile.post({});
183
- m.value = !1, u ? (l.value = u, f.value = !0) : (l.value = null, f.value = !1, ((r == null ? void 0 : r.code) === 401 || (r == null ? void 0 : r.code) === 40101) && (console.warn("认证已过期,清除认证状态"), o()));
184
- }
185
- function q() {
186
- l.value = null;
187
- }
188
- function H() {
189
- return {
190
- userProfile: l,
191
- loading: m,
192
- usersProfileSuccess: f,
193
- isLoggedIn: G,
194
- fetchUserProfile: Y,
195
- clearUserProfile: q
196
- };
197
- }
198
- export {
199
- H as a,
200
- C as u
201
- };
@@ -1,345 +0,0 @@
1
- import { ref as v, computed as C } from "vue";
2
- import { f as p } from "./apiClients-DVz12LeW.js";
3
- /* empty css */
4
- import { Message as m } from "@arco-design/web-vue";
5
- function q(e) {
6
- var o;
7
- const r = (o = e == null ? void 0 : e.metadata) == null ? void 0 : o.originalPrice;
8
- return typeof r == "number" ? r : void 0;
9
- }
10
- function K(e) {
11
- const r = q(e);
12
- return !e || r === void 0 || r <= e.unitAmount ? 0 : Math.round((1 - e.unitAmount / r) * 100);
13
- }
14
- function Q(e) {
15
- var f, u;
16
- const r = (f = e == null ? void 0 : e.metadata) == null ? void 0 : f.discountLabel;
17
- if (typeof r == "string" && r.trim())
18
- return r;
19
- const o = (u = e == null ? void 0 : e.metadata) == null ? void 0 : u.savingMonths;
20
- return typeof o == "number" && o > 0 ? `买 ${12 - o} 个月送 ${o} 个月` : "";
21
- }
22
- function k(e) {
23
- return e === void 0 ? 0 : Math.floor(e / 100);
24
- }
25
- function V(e, r = 1) {
26
- const o = r > 1 ? `每 ${r} ` : "按";
27
- switch (e) {
28
- case "month":
29
- return `${o}月订阅`;
30
- case "year":
31
- return `${o}年订阅`;
32
- case "day":
33
- return `${o}天订阅`;
34
- case "week":
35
- return `${o}周订阅`;
36
- default:
37
- return "";
38
- }
39
- }
40
- function _(e) {
41
- const r = e != null && e.intervalCount && e.intervalCount > 1 ? `${e.intervalCount} ` : "";
42
- switch (e == null ? void 0 : e.interval) {
43
- case "month":
44
- return `/ ${r}月`;
45
- case "year":
46
- return `/ ${r}年`;
47
- case "day":
48
- return `/ ${r}天`;
49
- case "week":
50
- return `/ ${r}周`;
51
- default:
52
- return "";
53
- }
54
- }
55
- function P(e) {
56
- switch (e) {
57
- case "day":
58
- return "每天";
59
- case "week":
60
- return "每周";
61
- case "month":
62
- return "每月";
63
- case "year":
64
- return "每年";
65
- case "lifetime":
66
- return "不重置";
67
- default:
68
- return "";
69
- }
70
- }
71
- function L(e) {
72
- if (e.type === "quota" && e.value !== void 0) {
73
- const r = P(e.quotaPeriod), o = r ? ` / ${r}` : "";
74
- return `${e.name}: ${e.value === -1 ? "无限" : e.value}${o}`;
75
- }
76
- if (e.type === "unlimited") {
77
- const r = P(e.quotaPeriod);
78
- return r ? `${e.name}: 不限 / ${r}` : `${e.name}不限`;
79
- }
80
- return e.type === "boolean" && e.value === !1 ? `${e.name}(不支持)` : e.name;
81
- }
82
- function h(e) {
83
- return e.type !== "recurring" || !e.interval ? null : {
84
- key: `${e.interval}:${e.intervalCount ?? 1}`,
85
- interval: e.interval,
86
- intervalCount: e.intervalCount ?? 1
87
- };
88
- }
89
- function z(e, r) {
90
- const o = {
91
- day: 1,
92
- week: 2,
93
- month: 3,
94
- year: 4
95
- };
96
- return o[e.interval] - o[r.interval] || e.intervalCount - r.intervalCount;
97
- }
98
- function E(e, r) {
99
- let o = 0;
100
- for (const f of e)
101
- for (const u of f.prices) {
102
- const a = h(u);
103
- (a == null ? void 0 : a.key) === r && (o = Math.max(o, K(u)));
104
- }
105
- return o > 0 ? `省 ${o}%` : void 0;
106
- }
107
- function H(e) {
108
- return e.includes(":") ? e : `${e}:1`;
109
- }
110
- function J() {
111
- return !!localStorage.getItem("jwtToken");
112
- }
113
- function ne(e = "month") {
114
- const r = v([]), o = v(null), f = v(!1), u = v(!1), a = v(H(e)), c = C(() => {
115
- const n = /* @__PURE__ */ new Map();
116
- for (const t of r.value)
117
- for (const l of t.prices) {
118
- const i = h(l);
119
- i && n.set(i.key, i);
120
- }
121
- return [...n.values()].sort(z).map((t) => ({
122
- value: t.key,
123
- label: V(t.interval, t.intervalCount),
124
- badge: E(r.value, t.key)
125
- }));
126
- }), g = C(() => {
127
- var t;
128
- const n = [];
129
- for (const l of r.value) {
130
- const i = l.prices.find((d) => {
131
- const s = h(d);
132
- return (s == null ? void 0 : s.key) === a.value;
133
- });
134
- i && n.push({
135
- ...l,
136
- features: (t = i.features) != null && t.length ? i.features : l.features,
137
- selectedPrice: i
138
- });
139
- }
140
- return n;
141
- });
142
- function M(n) {
143
- a.value = n;
144
- }
145
- function y(n) {
146
- const t = o.value;
147
- return t ? t.priceId && n.selectedPrice ? t.priceId === n.selectedPrice.id : t.productId === n.id : !1;
148
- }
149
- function $(n) {
150
- var t;
151
- return ((t = o.value) == null ? void 0 : t.productId) === n.id;
152
- }
153
- function b(n) {
154
- var t;
155
- return ((t = n.metadata) == null ? void 0 : t.recommended) === !0;
156
- }
157
- function B(n) {
158
- var t;
159
- return k((t = n.selectedPrice) == null ? void 0 : t.unitAmount);
160
- }
161
- function S(n) {
162
- const t = q(n.selectedPrice);
163
- return t === void 0 ? void 0 : k(t);
164
- }
165
- function x(n) {
166
- return _(n.selectedPrice);
167
- }
168
- function D(n) {
169
- return Q(n.selectedPrice);
170
- }
171
- function U(n) {
172
- return y(n) ? "当前方案" : b(n) ? "最受欢迎" : "";
173
- }
174
- function F(n) {
175
- const t = [];
176
- return y(n) ? t.push({
177
- label: "当前方案",
178
- type: "current"
179
- }) : b(n) && t.push({
180
- label: "最受欢迎",
181
- type: "recommended"
182
- }), t;
183
- }
184
- function j(n) {
185
- const t = o.value;
186
- return y(n) ? "当前方案" : t ? $(n) ? "切换周期" : typeof t.unitAmount == "number" && n.selectedPrice.unitAmount > t.unitAmount ? "升级方案" : "切换方案" : "立即订阅";
187
- }
188
- function G(n, t) {
189
- const l = n.features.find((i) => i.type === "quota" && i.value !== void 0);
190
- if (l) {
191
- const i = P(l.quotaPeriod), d = l.value === -1 ? "不限量" : l.value;
192
- return `${l.name} ${i ? `${d} / ${i}` : d},覆盖核心使用场景。`;
193
- }
194
- return t === 1 ? "为正式团队准备的高配能力组合。" : "包含入门所需的核心能力。";
195
- }
196
- function T(n) {
197
- return n.filter((t) => t.highlight !== !1).map((t) => ({
198
- title: L(t),
199
- description: t.description || ""
200
- }));
201
- }
202
- function O(n) {
203
- const t = n.filter((s) => s.highlight !== !1), l = t.filter((s) => s.type === "quota" || s.type === "unlimited").map((s) => ({
204
- title: L(s),
205
- description: s.description || ""
206
- })), i = t.filter((s) => s.type === "boolean" && s.value !== !1).map((s) => ({
207
- title: s.name,
208
- description: s.description || ""
209
- })), d = [];
210
- return i.length && d.push({
211
- title: "功能特性",
212
- items: i
213
- }), l.length && d.push({
214
- title: "用量配额",
215
- items: l
216
- }), d;
217
- }
218
- async function I() {
219
- f.value = !0;
220
- try {
221
- const {
222
- data: n,
223
- error: t
224
- } = await p.products.listActive.post();
225
- if (t) {
226
- console.error("加载产品列表失败", t);
227
- return;
228
- }
229
- r.value = Array.isArray(n) ? n : [], !c.value.some((i) => i.value === a.value) && c.value[0] && (a.value = c.value[0].value);
230
- } finally {
231
- f.value = !1;
232
- }
233
- }
234
- async function w() {
235
- if (!J()) {
236
- o.value = null;
237
- return;
238
- }
239
- u.value = !0;
240
- try {
241
- const {
242
- data: n,
243
- error: t
244
- } = await p.subscriptions.summary.post();
245
- if (t) {
246
- console.error("加载当前订阅失败", t);
247
- return;
248
- }
249
- o.value = (n == null ? void 0 : n.current) ?? null;
250
- } finally {
251
- u.value = !1;
252
- }
253
- }
254
- async function R() {
255
- await Promise.all([I(), w()]);
256
- }
257
- return {
258
- products: r,
259
- plans: g,
260
- currentSubscription: o,
261
- listLoading: f,
262
- currentLoading: u,
263
- billingInterval: a,
264
- billingIntervalTabs: c,
265
- setBillingInterval: M,
266
- isCurrentPlan: y,
267
- isSameProduct: $,
268
- isRecommendedPlan: b,
269
- getDisplayPrice: B,
270
- getDisplayOriginalPrice: S,
271
- getDisplayCycle: x,
272
- getPromotionLabel: D,
273
- getBadgeLabel: U,
274
- getBadgeLabels: F,
275
- getButtonLabel: j,
276
- getPlanSummary: G,
277
- getFeatureItems: T,
278
- getFeatureGroups: O,
279
- loadProducts: I,
280
- loadCurrentSubscription: w,
281
- refresh: R
282
- };
283
- }
284
- function N(e) {
285
- window.open(e, "_blank", "noopener,noreferrer");
286
- }
287
- function A(e) {
288
- return e && typeof e == "object" && "message" in e && typeof e.message == "string" ? e.message : "";
289
- }
290
- function W(e) {
291
- return e && typeof e == "object" && "alipayUrl" in e && typeof e.alipayUrl == "string" ? e.alipayUrl : "";
292
- }
293
- function X(e) {
294
- return e && typeof e == "object" && "status" in e && e.status === "trialing";
295
- }
296
- function re(e) {
297
- const r = v(null);
298
- async function o(u) {
299
- if (!u.selectedPrice) {
300
- m.warning("当前方案暂无可购买价格");
301
- return;
302
- }
303
- const a = e.currentSubscription.value;
304
- if ((a == null ? void 0 : a.priceId) === u.selectedPrice.id) {
305
- m.info("当前已经是该方案");
306
- return;
307
- }
308
- r.value = u.id;
309
- try {
310
- const c = a ? await p.subscriptions.change.post({
311
- subscriptionId: a.id,
312
- newPriceId: u.selectedPrice.id,
313
- proration: !0
314
- }) : await p.subscriptions.create.post({
315
- priceId: u.selectedPrice.id
316
- });
317
- if (c.error) {
318
- m.error(c.error.message || "订阅操作失败");
319
- return;
320
- }
321
- const g = W(c.data);
322
- if (g) {
323
- N(g);
324
- return;
325
- }
326
- X(c.data) ? m.success(A(c.data) || "试用已开始") : m.success(A(c.data) || "订阅已更新"), await e.refreshCurrentSubscription();
327
- } catch (c) {
328
- console.error("订阅操作失败", c), m.error("订阅操作失败,请稍后重试");
329
- } finally {
330
- r.value = null;
331
- }
332
- }
333
- function f(u) {
334
- return r.value === u.id;
335
- }
336
- return {
337
- checkoutPlanId: r,
338
- checkout: o,
339
- isCheckingOut: f
340
- };
341
- }
342
- export {
343
- re as a,
344
- ne as u
345
- };