@huyooo/ui 2.1.4 → 2.1.8
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-BJWwY3T-.js → AuthkitAppSetting-CHVSyEY1.js} +1 -1
- package/dist/{FeedbackModal.vue_vue_type_script_setup_true_lang-BJj1bNKu.js → FeedbackModal.vue_vue_type_script_setup_true_lang-FIZdBxIZ.js} +1 -1
- package/dist/{LegalDocViewer-DCDSLVjc.js → LegalDocViewer-DiNoy_oj.js} +2 -2
- package/dist/PaySubscriptions-pEZtjp1g.js +1287 -0
- package/dist/{PricingPlans-CXk2DNb4.js → PricingPlans-qRWHwi9x.js} +2 -2
- package/dist/{ReferrerReferees-ZhroFXBA.js → ReferrerReferees-t5s4LzbY.js} +1 -1
- package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-DbkGYZ2f.js +601 -0
- package/dist/{WidthContainer-CDf1GiFk.js → WidthContainer-FXZqDMid.js} +4 -4
- package/dist/authkit.js +3 -3
- package/dist/common.js +1 -1
- package/dist/components/Authkit/AuthkitAppSetting.vue.d.ts +2 -2
- package/dist/components/Feedback/FeedbackModal.vue.d.ts +2 -2
- package/dist/components/LandingPage/LandingPageSections.vue.d.ts +1 -1
- package/dist/components/Message/MessageTabs.vue.d.ts +2 -2
- package/dist/components/Pay/PaySubscriptions.vue.d.ts +2 -2
- package/dist/components/UserMenu/UserMenuModals.vue.d.ts +9 -9
- package/dist/composables/Billing/useBillingPlans.d.ts +10 -2
- package/dist/composables/Billing/useBillingSubscriptionSummary.d.ts +77 -258
- package/dist/composables.js +3 -3
- package/dist/feedback.js +1 -1
- package/dist/main.js +103 -102
- package/dist/pay.d.ts +1 -1
- package/dist/pay.js +18 -17
- package/dist/referrer.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/api/billing.generated.d.ts +2 -2
- package/dist/types/subscription.d.ts +57 -0
- package/dist/types/user.d.ts +3 -0
- package/dist/useAuthkitUsersProfile-D4H_Gxgd.js +67 -0
- package/dist/useBillingSubscriptionSummary-BC3G0N4t.js +43 -0
- package/dist/{useRoutePermission-ZOeRg6Wq.js → useRoutePermission-CGq_LIZM.js} +1 -1
- package/dist/useSubscriptionCheckout-Dmg0kt4F.js +399 -0
- package/dist/user.js +1 -1
- package/dist/utils/subscriptionDisplay.d.ts +6 -6
- package/package.json +1 -1
- package/dist/PaySubscriptions-CXLqpfgf.js +0 -1331
- package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-COM36ViG.js +0 -598
- package/dist/useAuthkitUsersProfile-DX2PYmdU.js +0 -59
- package/dist/useSubscriptionCheckout-DAwwBVAk.js +0 -353
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
import { ref as g, computed as q } from "vue";
|
|
2
|
-
import { d as z } from "./useBillingStatusOptions-C6edto7H.js";
|
|
3
|
-
import { g as $ } from "./apiClients-CWSwNzGk.js";
|
|
4
|
-
/* empty css */
|
|
5
|
-
import { Message as h } from "@arco-design/web-vue";
|
|
6
|
-
import { u as H } from "./useEnsureAuthenticated-RZ1DflLz.js";
|
|
7
|
-
function D(e) {
|
|
8
|
-
var i;
|
|
9
|
-
const r = (i = e == null ? void 0 : e.metadata) == null ? void 0 : i.originalPrice;
|
|
10
|
-
return typeof r == "number" ? r : void 0;
|
|
11
|
-
}
|
|
12
|
-
function F(e) {
|
|
13
|
-
const r = D(e);
|
|
14
|
-
return !e || r === void 0 || r <= e.unitAmount ? 0 : r - e.unitAmount;
|
|
15
|
-
}
|
|
16
|
-
function J(e) {
|
|
17
|
-
const r = F(e);
|
|
18
|
-
return r > 0 ? `优惠 ¥${p(r)}` : "";
|
|
19
|
-
}
|
|
20
|
-
function p(e) {
|
|
21
|
-
return e === void 0 ? 0 : Math.floor(e / 100);
|
|
22
|
-
}
|
|
23
|
-
function N(e, r = 1) {
|
|
24
|
-
const i = r > 1 ? `每 ${r} ` : "按";
|
|
25
|
-
switch (e) {
|
|
26
|
-
case "month":
|
|
27
|
-
return `${i}月订阅`;
|
|
28
|
-
case "year":
|
|
29
|
-
return `${i}年订阅`;
|
|
30
|
-
case "day":
|
|
31
|
-
return `${i}天订阅`;
|
|
32
|
-
case "week":
|
|
33
|
-
return `${i}周订阅`;
|
|
34
|
-
default:
|
|
35
|
-
return "";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function W(e) {
|
|
39
|
-
const r = e != null && e.intervalCount && e.intervalCount > 1 ? `${e.intervalCount} ` : "";
|
|
40
|
-
switch (e == null ? void 0 : e.interval) {
|
|
41
|
-
case "month":
|
|
42
|
-
return `/ ${r}月`;
|
|
43
|
-
case "year":
|
|
44
|
-
return `/ ${r}年`;
|
|
45
|
-
case "day":
|
|
46
|
-
return `/ ${r}天`;
|
|
47
|
-
case "week":
|
|
48
|
-
return `/ ${r}周`;
|
|
49
|
-
default:
|
|
50
|
-
return "";
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function X(e) {
|
|
54
|
-
const r = (e == null ? void 0 : e.intervalCount) ?? 1;
|
|
55
|
-
switch (e == null ? void 0 : e.interval) {
|
|
56
|
-
case "month":
|
|
57
|
-
return `${r} 个月`;
|
|
58
|
-
case "year":
|
|
59
|
-
return `${r} 年`;
|
|
60
|
-
case "day":
|
|
61
|
-
return `${r} 天`;
|
|
62
|
-
case "week":
|
|
63
|
-
return `${r} 周`;
|
|
64
|
-
default:
|
|
65
|
-
return "";
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function I(e) {
|
|
69
|
-
switch (e) {
|
|
70
|
-
case "day":
|
|
71
|
-
return "每天";
|
|
72
|
-
case "week":
|
|
73
|
-
return "每周";
|
|
74
|
-
case "month":
|
|
75
|
-
return "每月";
|
|
76
|
-
case "year":
|
|
77
|
-
return "每年";
|
|
78
|
-
case "lifetime":
|
|
79
|
-
return "不重置";
|
|
80
|
-
default:
|
|
81
|
-
return "";
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function S(e) {
|
|
85
|
-
if (e.type === "quota" && e.value !== void 0) {
|
|
86
|
-
const r = I(e.quotaPeriod), i = r ? ` / ${r}` : "";
|
|
87
|
-
return `${e.name}: ${e.value === -1 ? "无限" : e.value}${i}`;
|
|
88
|
-
}
|
|
89
|
-
if (e.type === "unlimited") {
|
|
90
|
-
const r = I(e.quotaPeriod);
|
|
91
|
-
return r ? `${e.name}: 不限 / ${r}` : `${e.name}不限`;
|
|
92
|
-
}
|
|
93
|
-
return e.type === "boolean" && e.value === !1 ? `${e.name}(不支持)` : e.name;
|
|
94
|
-
}
|
|
95
|
-
function w(e) {
|
|
96
|
-
return e.type !== "recurring" || !e.interval ? null : {
|
|
97
|
-
key: `${e.interval}:${e.intervalCount ?? 1}`,
|
|
98
|
-
interval: e.interval,
|
|
99
|
-
intervalCount: e.intervalCount ?? 1
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function Y(e, r) {
|
|
103
|
-
const i = {
|
|
104
|
-
day: 1,
|
|
105
|
-
week: 2,
|
|
106
|
-
month: 3,
|
|
107
|
-
year: 4
|
|
108
|
-
};
|
|
109
|
-
return i[e.interval] - i[r.interval] || e.intervalCount - r.intervalCount;
|
|
110
|
-
}
|
|
111
|
-
function Z(e, r) {
|
|
112
|
-
let i = 0;
|
|
113
|
-
for (const f of e)
|
|
114
|
-
for (const d of f.prices) {
|
|
115
|
-
const s = w(d);
|
|
116
|
-
(s == null ? void 0 : s.key) === r && (i = Math.max(i, F(d)));
|
|
117
|
-
}
|
|
118
|
-
return i > 0 ? `最高优惠 ¥${p(i)}` : void 0;
|
|
119
|
-
}
|
|
120
|
-
function ee(e) {
|
|
121
|
-
return e.includes(":") ? e : `${e}:1`;
|
|
122
|
-
}
|
|
123
|
-
function B() {
|
|
124
|
-
return !!localStorage.getItem("jwtToken");
|
|
125
|
-
}
|
|
126
|
-
function ae(e = "month") {
|
|
127
|
-
const r = g([]), i = g(null), f = g(null), d = g(!1), s = g(!1), l = g(ee(e)), m = q(() => {
|
|
128
|
-
const t = /* @__PURE__ */ new Map();
|
|
129
|
-
for (const n of r.value)
|
|
130
|
-
for (const u of n.prices) {
|
|
131
|
-
const c = w(u);
|
|
132
|
-
c && t.set(c.key, c);
|
|
133
|
-
}
|
|
134
|
-
return [...t.values()].sort(Y).map((n) => ({
|
|
135
|
-
value: n.key,
|
|
136
|
-
label: N(n.interval, n.intervalCount),
|
|
137
|
-
badge: Z(r.value, n.key)
|
|
138
|
-
}));
|
|
139
|
-
}), y = q(() => {
|
|
140
|
-
const t = [];
|
|
141
|
-
for (const n of r.value) {
|
|
142
|
-
const u = n.prices.find((o) => {
|
|
143
|
-
const b = w(o);
|
|
144
|
-
return (b == null ? void 0 : b.key) === l.value;
|
|
145
|
-
}), c = n.prices.find((o) => o.type === "free"), a = u ?? (c && n.prices.every((o) => o.type === "free") ? c : void 0);
|
|
146
|
-
a && t.push({
|
|
147
|
-
...n,
|
|
148
|
-
features: a.features ?? [],
|
|
149
|
-
selectedPrice: a
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
return t;
|
|
153
|
-
});
|
|
154
|
-
function x(t) {
|
|
155
|
-
l.value = t;
|
|
156
|
-
}
|
|
157
|
-
function P(t) {
|
|
158
|
-
const n = i.value, u = f.value;
|
|
159
|
-
return n != null && n.priceId && t.selectedPrice ? n.priceId === t.selectedPrice.id : n ? n.productId === t.id : u != null && u.priceId && t.selectedPrice ? u.priceId === t.selectedPrice.id : u ? u.productId === t.id : !1;
|
|
160
|
-
}
|
|
161
|
-
function A(t) {
|
|
162
|
-
var n;
|
|
163
|
-
return ((n = i.value) == null ? void 0 : n.productId) === t.id;
|
|
164
|
-
}
|
|
165
|
-
function v(t) {
|
|
166
|
-
var n;
|
|
167
|
-
return ((n = t.selectedPrice) == null ? void 0 : n.type) === "free";
|
|
168
|
-
}
|
|
169
|
-
function U() {
|
|
170
|
-
return !!i.value;
|
|
171
|
-
}
|
|
172
|
-
function M(t) {
|
|
173
|
-
return !!(!t.selectedPrice || P(t) || v(t) && U());
|
|
174
|
-
}
|
|
175
|
-
function C(t) {
|
|
176
|
-
var n;
|
|
177
|
-
return ((n = t.metadata) == null ? void 0 : n.recommended) === !0;
|
|
178
|
-
}
|
|
179
|
-
function G(t) {
|
|
180
|
-
var n;
|
|
181
|
-
return p((n = t.selectedPrice) == null ? void 0 : n.unitAmount);
|
|
182
|
-
}
|
|
183
|
-
function O(t) {
|
|
184
|
-
const n = D(t.selectedPrice);
|
|
185
|
-
return n === void 0 ? void 0 : p(n);
|
|
186
|
-
}
|
|
187
|
-
function T(t) {
|
|
188
|
-
return v(t) ? "" : W(t.selectedPrice);
|
|
189
|
-
}
|
|
190
|
-
function j(t) {
|
|
191
|
-
if (v(t)) {
|
|
192
|
-
const n = X(t.selectedPrice);
|
|
193
|
-
return n ? `${n}免费体验` : "免费体验";
|
|
194
|
-
}
|
|
195
|
-
return J(t.selectedPrice);
|
|
196
|
-
}
|
|
197
|
-
function R(t) {
|
|
198
|
-
const n = [];
|
|
199
|
-
return P(t) ? n.push({
|
|
200
|
-
label: "当前方案",
|
|
201
|
-
type: "current"
|
|
202
|
-
}) : v(t) ? n.push({
|
|
203
|
-
label: "免费体验",
|
|
204
|
-
type: "trial"
|
|
205
|
-
}) : C(t) && n.push({
|
|
206
|
-
label: "最受欢迎",
|
|
207
|
-
type: "recommended"
|
|
208
|
-
}), n;
|
|
209
|
-
}
|
|
210
|
-
function E(t) {
|
|
211
|
-
const n = i.value;
|
|
212
|
-
return P(t) ? "当前方案" : v(t) ? n ? "已订阅付费方案" : B() ? "免费开通" : "免费注册" : n ? A(t) ? "切换周期" : typeof n.unitAmount == "number" && t.selectedPrice.unitAmount > n.unitAmount ? "升级方案" : "切换方案" : "立即订阅";
|
|
213
|
-
}
|
|
214
|
-
function K(t, n) {
|
|
215
|
-
const u = t.features.find((c) => c.type === "quota" && c.value !== void 0);
|
|
216
|
-
if (u) {
|
|
217
|
-
const c = I(u.quotaPeriod), a = u.value === -1 ? "不限量" : u.value;
|
|
218
|
-
return `${u.name} ${c ? `${a} / ${c}` : a},覆盖核心使用场景。`;
|
|
219
|
-
}
|
|
220
|
-
return v(t) ? "注册后自动开通免费权益,适合先体验核心能力。" : n === 1 ? "为正式团队准备的高配能力组合。" : "包含入门所需的核心能力。";
|
|
221
|
-
}
|
|
222
|
-
function Q(t) {
|
|
223
|
-
return t.filter((n) => n.highlight !== !1).map((n) => ({
|
|
224
|
-
title: S(n),
|
|
225
|
-
description: n.description || ""
|
|
226
|
-
}));
|
|
227
|
-
}
|
|
228
|
-
function V(t) {
|
|
229
|
-
const n = t.filter((o) => o.highlight !== !1), u = n.filter((o) => o.type === "quota" || o.type === "unlimited").map((o) => ({
|
|
230
|
-
title: S(o),
|
|
231
|
-
description: o.description || ""
|
|
232
|
-
})), c = n.filter((o) => o.type === "boolean" && o.value !== !1).map((o) => ({
|
|
233
|
-
title: o.name,
|
|
234
|
-
description: o.description || ""
|
|
235
|
-
})), a = [];
|
|
236
|
-
return c.length && a.push({
|
|
237
|
-
title: "功能特性",
|
|
238
|
-
items: c
|
|
239
|
-
}), u.length && a.push({
|
|
240
|
-
title: "用量配额",
|
|
241
|
-
items: u
|
|
242
|
-
}), a;
|
|
243
|
-
}
|
|
244
|
-
async function k() {
|
|
245
|
-
d.value = !0;
|
|
246
|
-
const {
|
|
247
|
-
data: t,
|
|
248
|
-
error: n
|
|
249
|
-
} = await z.productOptions();
|
|
250
|
-
if (d.value = !1, n)
|
|
251
|
-
return;
|
|
252
|
-
r.value = Array.isArray(t) ? t : [], !m.value.some((c) => c.value === l.value) && m.value[0] && (l.value = m.value[0].value);
|
|
253
|
-
}
|
|
254
|
-
async function L() {
|
|
255
|
-
if (!B()) {
|
|
256
|
-
i.value = null, f.value = null;
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
s.value = !0;
|
|
260
|
-
const {
|
|
261
|
-
data: t,
|
|
262
|
-
error: n
|
|
263
|
-
} = await $().billing.subscriptions.summary.post();
|
|
264
|
-
s.value = !1, !n && (i.value = (t == null ? void 0 : t.current) ?? null, f.value = (t == null ? void 0 : t.trial) ?? null);
|
|
265
|
-
}
|
|
266
|
-
async function _() {
|
|
267
|
-
await Promise.all([k(), L()]);
|
|
268
|
-
}
|
|
269
|
-
return {
|
|
270
|
-
products: r,
|
|
271
|
-
plans: y,
|
|
272
|
-
currentSubscription: i,
|
|
273
|
-
currentTrial: f,
|
|
274
|
-
listLoading: d,
|
|
275
|
-
currentLoading: s,
|
|
276
|
-
billingInterval: l,
|
|
277
|
-
billingIntervalTabs: m,
|
|
278
|
-
setBillingInterval: x,
|
|
279
|
-
isCurrentPlan: P,
|
|
280
|
-
isSameProduct: A,
|
|
281
|
-
isRecommendedPlan: C,
|
|
282
|
-
isFreePlan: v,
|
|
283
|
-
isPlanActionDisabled: M,
|
|
284
|
-
getDisplayPrice: G,
|
|
285
|
-
getDisplayOriginalPrice: O,
|
|
286
|
-
getDisplayCycle: T,
|
|
287
|
-
getPromotionLabel: j,
|
|
288
|
-
getBadgeLabels: R,
|
|
289
|
-
getButtonLabel: E,
|
|
290
|
-
getPlanSummary: K,
|
|
291
|
-
getFeatureItems: Q,
|
|
292
|
-
getFeatureGroups: V,
|
|
293
|
-
loadProducts: k,
|
|
294
|
-
loadCurrentSubscription: L,
|
|
295
|
-
refresh: _
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
function te(e) {
|
|
299
|
-
window.open(e, "_blank", "noopener,noreferrer");
|
|
300
|
-
}
|
|
301
|
-
function ne(e) {
|
|
302
|
-
return e && typeof e == "object" && "message" in e && typeof e.message == "string" ? e.message : "";
|
|
303
|
-
}
|
|
304
|
-
function re(e) {
|
|
305
|
-
return e && typeof e == "object" && "alipayUrl" in e && typeof e.alipayUrl == "string" ? e.alipayUrl : "";
|
|
306
|
-
}
|
|
307
|
-
function fe(e) {
|
|
308
|
-
const r = g(null), {
|
|
309
|
-
ensureAuthenticated: i
|
|
310
|
-
} = H();
|
|
311
|
-
async function f(s) {
|
|
312
|
-
if (!s.selectedPrice) {
|
|
313
|
-
h.warning("当前方案暂无可购买价格");
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
if (!i(() => f(s))) return;
|
|
317
|
-
const l = e.currentSubscription.value;
|
|
318
|
-
if ((l == null ? void 0 : l.priceId) === s.selectedPrice.id) {
|
|
319
|
-
h.info("当前已经是该方案");
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
if (s.selectedPrice.type === "free")
|
|
323
|
-
return;
|
|
324
|
-
r.value = s.id;
|
|
325
|
-
const m = l ? await $().billing.subscriptions.change.post({
|
|
326
|
-
subscriptionId: l.id,
|
|
327
|
-
newPriceId: s.selectedPrice.id,
|
|
328
|
-
proration: !0
|
|
329
|
-
}) : await $().billing.subscriptions.create.post({
|
|
330
|
-
priceId: s.selectedPrice.id
|
|
331
|
-
});
|
|
332
|
-
if (r.value = null, m.error)
|
|
333
|
-
return;
|
|
334
|
-
const y = re(m.data);
|
|
335
|
-
if (y) {
|
|
336
|
-
te(y);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
h.success(ne(m.data) || "订阅已更新"), await e.refreshCurrentSubscription();
|
|
340
|
-
}
|
|
341
|
-
function d(s) {
|
|
342
|
-
return r.value === s.id;
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
checkoutPlanId: r,
|
|
346
|
-
checkout: f,
|
|
347
|
-
isCheckingOut: d
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
export {
|
|
351
|
-
fe as a,
|
|
352
|
-
ae as u
|
|
353
|
-
};
|