@huyooo/ui 0.11.2 → 0.11.5
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.
- package/dist/AuthkitAppSetting-CSHkDxQT.js +1914 -0
- package/dist/{Clipboard---tG2Zxz.js → Clipboard-CRZDADLE.js} +1 -1
- package/dist/{Contact-BEUbBGiB.js → Contact-Y0Yczmc9.js} +8 -7
- package/dist/{CustomTable-CVZ4mFzi.js → CustomTable-BUkwlbzN.js} +3 -2
- package/dist/{FeedbackItem-CN041vTm.js → FeedbackItem-D7MpOmoM.js} +3 -3
- package/dist/FeedbackModal-CvNF1D-5.js +1050 -0
- package/dist/LandingPageFAQ-CZJXvor9.js +80 -0
- package/dist/LandingPageLinkGroup-DDNRivMt.js +521 -0
- package/dist/LandingPageSectionHeader-D_74W4My.js +69 -0
- package/dist/{LandingPageSectionTabs-B6ZVxR47.js → LandingPageSectionTabs-Ce3_Rc2L.js} +354 -426
- package/dist/MessageHandle-B12koVQL.js +924 -0
- package/dist/MessageList-Bo6YCfRO.js +233 -0
- package/dist/{MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-F6neJUg3.js → MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-DxDn6Ok8.js} +2 -2
- package/dist/PaySubscriptions-B8jAtG5n.js +515 -0
- package/dist/PricingPlans-CO26OcbJ.js +210 -0
- package/dist/ReferrerReferees-D_Iiw9wZ.js +106 -0
- package/dist/{Upload.vue_vue_type_script_setup_true_lang-D_-oMTOo.js → Upload.vue_vue_type_script_setup_true_lang-CbVSY_vt.js} +1 -1
- package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-DpVadjMH.js +508 -0
- package/dist/WidthContainer-B6d4xrGT.js +693 -0
- package/dist/{apiClients-9b4zNZ2S.js → apiClients-DVz12LeW.js} +81 -75
- package/dist/authkit.d.ts +7 -0
- package/dist/authkit.js +52 -45
- package/dist/common/globalConfig.d.ts +2 -2
- package/dist/common/userMenuModal.d.ts +1 -0
- package/dist/common.js +2 -2
- package/dist/components/Authkit/AppSetting/AuthkitOAuthBinding.vue.d.ts +31 -0
- package/dist/components/Authkit/AppSetting/AuthkitPhoneBinding.vue.d.ts +14 -0
- package/dist/components/Authkit/AppSetting/AuthkitPhoneVerify.vue.d.ts +66 -0
- package/dist/components/Authkit/Auth/AuthkitBindPhone.vue.d.ts +27 -0
- package/dist/components/Authkit/Auth/AuthkitEmailUpdate.vue.d.ts +11 -1
- package/dist/components/Authkit/Auth/AuthkitOauthCallback.vue.d.ts +2 -2
- package/dist/components/Authkit/Auth/AuthkitOauthItem.vue.d.ts +1 -1
- package/dist/components/Authkit/Auth/AuthkitPasswordAuth.vue.d.ts +11 -1
- package/dist/components/Authkit/Auth/AuthkitPhonePasswordUpdateAndVerify.vue.d.ts +68 -0
- package/dist/components/Authkit/Auth/AuthkitSignInEmailCode.vue.d.ts +68 -0
- package/dist/components/Authkit/Auth/AuthkitSwitchSignUpOrResetPassword.vue.d.ts +15 -3
- package/dist/components/Authkit/AuthkitOAuthCallbackProvider.vue.d.ts +11 -0
- package/dist/components/Authkit/AuthkitProvider.vue.d.ts +45 -0
- package/dist/components/Feedback/FeedbackBubbleEnd.vue.d.ts +9 -0
- package/dist/components/Feedback/FeedbackBubbleStart.vue.d.ts +11 -6
- package/dist/components/LandingPage/LandingPageSections.vue.d.ts +1 -1
- package/dist/components/Pay/PaySubscriptions.vue.d.ts +2 -1
- package/dist/components/Pay/PricingFAQ.vue.d.ts +17 -0
- package/dist/components/Pay/PricingPlans.vue.d.ts +12 -0
- package/dist/components/UserMenu/UserMenuModals.vue.d.ts +2 -2
- package/dist/components/UserMenu/parts/UserSubscriptionBaseInformation.vue.d.ts +8 -0
- package/dist/composables/Authkit/useAuthkitAppsAuthPageInfo.d.ts +26 -0
- package/dist/composables/Authkit/useAuthkitAuth.d.ts +21 -9
- package/dist/composables/Authkit/useEnsureAuthenticated.d.ts +26 -0
- package/dist/composables/Authkit/useOauth.d.ts +4 -1
- package/dist/composables/Billing/useBillingPlans.d.ts +201 -0
- package/dist/composables/Billing/useBillingSubscriptionSummary.d.ts +280 -0
- package/dist/composables/Billing/useSubscriptionCheckout.d.ts +12 -0
- package/dist/composables/UserMenu/useUserMenu.d.ts +5 -1
- package/dist/composables.d.ts +2 -0
- package/dist/composables.js +25 -22
- package/dist/feedback.js +3 -3
- package/dist/index-D3Kp6R4z.js +4 -0
- package/dist/landingPage.js +42 -40
- package/dist/main.js +285 -269
- package/dist/message.js +19 -18
- package/dist/pay.d.ts +5 -0
- package/dist/pay.js +9 -2
- package/dist/privateCom.js +1 -1
- package/dist/referrer.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/api/auth.generated.d.ts +103 -39
- package/dist/types/api/billing.generated.d.ts +61 -28
- package/dist/types/api.d.ts +1 -1
- package/dist/types/app.d.ts +14 -0
- package/dist/upload.js +2 -2
- package/dist/{useAuthkitAppsAuthPageInfo-494yLvsu.js → useAuthkitAppsAuthPageInfo-Du5d6VK-.js} +20 -7
- package/dist/{useAuthkitCreateAndUpdate-DyRtFxZS.js → useAuthkitCreateAndUpdate-Bc9D5C6R.js} +1 -1
- package/dist/useAuthkitUsersProfile-CQGyvL7g.js +201 -0
- package/dist/{useDownloads-DaeIY0E9.js → useDownloads-BFx1a-f9.js} +1 -1
- package/dist/useEnsureAuthenticated-Cc64hF1O.js +2247 -0
- package/dist/{useLegalLinks-CPbWqlu6.js → useLegalLinks-Deksq9h-.js} +2 -2
- package/dist/{useMessageNotifications-Dg5q-C_o.js → useMessageNotifications-DY5xKtif.js} +1 -1
- package/dist/{useSEO-CXX9dcBx.js → useSEO-CvfzTZA9.js} +2 -2
- package/dist/useSubscriptionCheckout-BgQJN61l.js +345 -0
- package/dist/{useTableHandle-Cjq4gcC0.js → useTableHandle-D71P3Ez_.js} +1 -1
- package/dist/{useUploadCos-DiJmmbRf.js → useUploadCos-N5pim6q1.js} +501 -515
- package/dist/useUserMenu-ClPBlvaM.js +44 -0
- package/dist/user.js +12 -13
- package/dist/utils/apiMiddlewares.d.ts +6 -0
- package/package.json +1 -1
- package/dist/AuthkitAppSetting-BCrLMpLg.js +0 -1322
- package/dist/AuthkitSignInPhone-DmCQ2fWs.js +0 -1721
- package/dist/FeedbackModal-aI28o-w5.js +0 -1053
- package/dist/LandingPageSectionHeader-Cs1x8i3q.js +0 -584
- package/dist/MessageHandle-BV1nKlxs.js +0 -1147
- package/dist/PaySubscriptions-B3gI1Eme.js +0 -408
- package/dist/ReferrerReferees-DJzPo7X5.js +0 -106
- package/dist/UserAccountMenu-CJ9KKVYa.js +0 -371
- package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-ClAXNSgl.js +0 -81
- package/dist/WidthContainer-BG10rumn.js +0 -669
- package/dist/useAuthkitUsersProfile-lGlQP54m.js +0 -186
- package/dist/useUserMenu-B3HKZKJ4.js +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed as c } from "vue";
|
|
2
|
-
import { g as L } from "./apiClients-
|
|
3
|
-
import { u as m } from "./useAuthkitAppsAuthPageInfo-
|
|
2
|
+
import { g as L } from "./apiClients-DVz12LeW.js";
|
|
3
|
+
import { u as m } from "./useAuthkitAppsAuthPageInfo-Du5d6VK-.js";
|
|
4
4
|
const l = {
|
|
5
5
|
userServiceAgreement: "用户服务协议",
|
|
6
6
|
privacyPolicy: "隐私协议",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref as I, computed as d, watch as _, isRef as G, toValue as B, hasInjectionContext as F, inject as J, watchEffect as Q, getCurrentInstance as Z, onBeforeUnmount as X, onDeactivated as Y, onActivated as ee } from "vue";
|
|
2
2
|
import { useRouter as V, useRoute as K } from "vue-router";
|
|
3
|
-
import { u as R } from "./useAuthkitAppsAuthPageInfo-
|
|
4
|
-
import { a as U } from "./useAuthkitUsersProfile-
|
|
3
|
+
import { u as R } from "./useAuthkitAppsAuthPageInfo-Du5d6VK-.js";
|
|
4
|
+
import { a as U } from "./useAuthkitUsersProfile-CQGyvL7g.js";
|
|
5
5
|
const v = I({
|
|
6
6
|
key: "",
|
|
7
7
|
name: ""
|
|
@@ -0,0 +1,345 @@
|
|
|
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
|
+
};
|