@huyooo/ui 2.1.6 → 2.1.10
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/{PricingPlans-DNPKQwFa.js → PricingPlans-qRWHwi9x.js} +1 -1
- package/dist/composables/Billing/useBillingPlans.d.ts +10 -2
- package/dist/composables.js +1 -1
- package/dist/main.js +2 -2
- package/dist/pay.js +2 -2
- package/dist/{useSubscriptionCheckout-3BtQARep.js → useSubscriptionCheckout-Dmg0kt4F.js} +138 -127
- package/package.json +29 -15
|
@@ -9,7 +9,7 @@ import { a as we } from "./PaySubscriptions-pEZtjp1g.js";
|
|
|
9
9
|
import { _ as U } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
10
10
|
import { L as Ie, a as Ce, b as Be } from "./LandingPageSectionHeader-3hiuw6G0.js";
|
|
11
11
|
import { Icon as te } from "@iconify/vue";
|
|
12
|
-
import { u as Le, a as Re } from "./useSubscriptionCheckout-
|
|
12
|
+
import { u as Le, a as Re } from "./useSubscriptionCheckout-Dmg0kt4F.js";
|
|
13
13
|
import { u as Ae } from "./useEnsureAuthenticated-RZ1DflLz.js";
|
|
14
14
|
const kt = "/Pay/Return";
|
|
15
15
|
function G(l) {
|
|
@@ -17,6 +17,8 @@ export interface BillingPrice {
|
|
|
17
17
|
unitAmount: number;
|
|
18
18
|
interval?: "day" | "week" | BillingInterval;
|
|
19
19
|
intervalCount?: number;
|
|
20
|
+
/** 订阅支付成功后附送积分 */
|
|
21
|
+
bonusPoints?: number;
|
|
20
22
|
metadata?: Record<string, unknown>;
|
|
21
23
|
features?: BillingProductFeature[];
|
|
22
24
|
}
|
|
@@ -103,7 +105,10 @@ export declare function useBillingPlans(defaultInterval?: BillingInterval | Bill
|
|
|
103
105
|
currency: string;
|
|
104
106
|
unitAmount: number;
|
|
105
107
|
interval?: ("day" | "week" | BillingInterval) | undefined;
|
|
106
|
-
intervalCount?: number
|
|
108
|
+
intervalCount?: number
|
|
109
|
+
/** 订阅支付成功后附送积分 */
|
|
110
|
+
| undefined;
|
|
111
|
+
bonusPoints?: number | undefined;
|
|
107
112
|
metadata?: Record<string, unknown> | undefined;
|
|
108
113
|
features?: {
|
|
109
114
|
key: string;
|
|
@@ -127,7 +132,10 @@ export declare function useBillingPlans(defaultInterval?: BillingInterval | Bill
|
|
|
127
132
|
currency: string;
|
|
128
133
|
unitAmount: number;
|
|
129
134
|
interval?: ("day" | "week" | BillingInterval) | undefined;
|
|
130
|
-
intervalCount?: number
|
|
135
|
+
intervalCount?: number
|
|
136
|
+
/** 订阅支付成功后附送积分 */
|
|
137
|
+
| undefined;
|
|
138
|
+
bonusPoints?: number | undefined;
|
|
131
139
|
metadata?: Record<string, unknown> | undefined;
|
|
132
140
|
features?: {
|
|
133
141
|
key: string;
|
package/dist/composables.js
CHANGED
|
@@ -10,7 +10,7 @@ import { u as E } from "./useMessageNotifications-pxa5LHjV.js";
|
|
|
10
10
|
import { c as y, g as B, a as H, s as I, u as _ } from "./runtime-DDJRAtkv.js";
|
|
11
11
|
import { u as F, a as K, b as N, c as V, d as Y } from "./usePageSEO-B3stKP3n.js";
|
|
12
12
|
import { u as q } from "./useUserMenu-ClPBlvaM.js";
|
|
13
|
-
import { u as J, a as Q } from "./useSubscriptionCheckout-
|
|
13
|
+
import { u as J, a as Q } from "./useSubscriptionCheckout-Dmg0kt4F.js";
|
|
14
14
|
import { c as X, u as Z, a as $, b as ee } from "./useBillingStatusOptions-C6edto7H.js";
|
|
15
15
|
export {
|
|
16
16
|
r as LEGAL_DOCS,
|
package/dist/main.js
CHANGED
|
@@ -13,7 +13,7 @@ import { H as x3, b as v3, d as Z3, c as V3, a as H3, s as U3, u as E3 } from ".
|
|
|
13
13
|
import { b as N } from "./usePageSEO-B3stKP3n.js";
|
|
14
14
|
import { u as S3, a as A3, c as G3, d as D3 } from "./usePageSEO-B3stKP3n.js";
|
|
15
15
|
import { u as b3 } from "./useUserMenu-ClPBlvaM.js";
|
|
16
|
-
import { u as O3, a as T3 } from "./useSubscriptionCheckout-
|
|
16
|
+
import { u as O3, a as T3 } from "./useSubscriptionCheckout-Dmg0kt4F.js";
|
|
17
17
|
import { c as $3, u as N3, a as R3, b as j3 } from "./useBillingStatusOptions-C6edto7H.js";
|
|
18
18
|
import { A as W3, B as Y3, a as q3, _ as Q3, b as K3, O as J3, P as X3, c as e4, d as t4, e as o4, f as a4, S as s4, g as i4, h as n4, u as r4, i as c4 } from "./AuthkitAppSetting-CHVSyEY1.js";
|
|
19
19
|
import { A as l4, a as d4, b as p4, c as f4, d as u4, E as h4, e as g4, f as _4, g as m4, O as L4, h as F4, P as w4, i as y4, j as M4, _ as x4, R as v4, S as Z4, k as V4, l as H4, m as U4, n as E4, o as k4, p as S4, L as A4 } from "./LegalDocViewer-DiNoy_oj.js";
|
|
@@ -32,7 +32,7 @@ import { C as h7, a as g7 } from "./CollapseItem-DUzZA6tx.js";
|
|
|
32
32
|
import { C as m7, E as L7 } from "./CustomTable-BY0oHLXc.js";
|
|
33
33
|
import { M as w7, a as y7 } from "./Menu-uCexrsKP.js";
|
|
34
34
|
import { P as x7, u as v7, a as Z7, v as V7 } from "./PaySubscriptions-pEZtjp1g.js";
|
|
35
|
-
import { P as U7, a as E7, b as k7, c as S7, p as A7, r as G7 } from "./PricingPlans-
|
|
35
|
+
import { P as U7, a as E7, b as k7, c as S7, p as A7, r as G7 } from "./PricingPlans-qRWHwi9x.js";
|
|
36
36
|
import { useBillingSubscriptionSummary as P7 } from "./useBillingSubscriptionSummary-BC3G0N4t.js";
|
|
37
37
|
import { R as B7 } from "./ReferrerReferees-t5s4LzbY.js";
|
|
38
38
|
import { _ as T7 } from "./Upload.vue_vue_type_script_setup_true_lang-DsrqOACa.js";
|
package/dist/pay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as e, u as t, a as n, v as r } from "./PaySubscriptions-pEZtjp1g.js";
|
|
2
|
-
import { P as i, a as o, b as P, c as p, p as m, r as c } from "./PricingPlans-
|
|
3
|
-
import { u as g, a as y } from "./useSubscriptionCheckout-
|
|
2
|
+
import { P as i, a as o, b as P, c as p, p as m, r as c } from "./PricingPlans-qRWHwi9x.js";
|
|
3
|
+
import { u as g, a as y } from "./useSubscriptionCheckout-Dmg0kt4F.js";
|
|
4
4
|
import { useBillingSubscriptionSummary as R } from "./useBillingSubscriptionSummary-BC3G0N4t.js";
|
|
5
5
|
import { c as b, u as x, a as v, b as O } from "./useBillingStatusOptions-C6edto7H.js";
|
|
6
6
|
export {
|
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { d as
|
|
1
|
+
import { ref as g, computed as S } from "vue";
|
|
2
|
+
import { d as V } from "./useBillingStatusOptions-C6edto7H.js";
|
|
3
3
|
import { g as $ } from "./apiClients-CWSwNzGk.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { Message as h } from "@arco-design/web-vue";
|
|
6
|
-
import { u as
|
|
6
|
+
import { u as _ } from "./useEnsureAuthenticated-RZ1DflLz.js";
|
|
7
7
|
function D(e) {
|
|
8
8
|
var u;
|
|
9
|
-
const
|
|
10
|
-
return typeof
|
|
9
|
+
const r = (u = e == null ? void 0 : e.metadata) == null ? void 0 : u.originalPrice;
|
|
10
|
+
return typeof r == "number" ? r : void 0;
|
|
11
11
|
}
|
|
12
12
|
function F(e) {
|
|
13
|
-
const
|
|
14
|
-
return !e ||
|
|
13
|
+
const r = D(e);
|
|
14
|
+
return !e || r === void 0 || r <= e.unitAmount ? 0 : r - e.unitAmount;
|
|
15
15
|
}
|
|
16
16
|
function H(e) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
var d;
|
|
18
|
+
const r = [], u = (d = e == null ? void 0 : e.metadata) == null ? void 0 : d.includedPointsLabel;
|
|
19
|
+
if (typeof u == "string" && u.trim())
|
|
20
|
+
r.push(u.trim());
|
|
21
|
+
else {
|
|
22
|
+
const s = typeof (e == null ? void 0 : e.bonusPoints) == "number" ? e.bonusPoints : 0;
|
|
23
|
+
s > 0 && r.push(`含 ${s.toLocaleString("zh-CN")} 积分`);
|
|
24
|
+
}
|
|
25
|
+
const l = F(e);
|
|
26
|
+
return l > 0 && r.push(`优惠 ¥${P(l)}`), r.join(" · ");
|
|
19
27
|
}
|
|
20
28
|
function P(e) {
|
|
21
29
|
return e === void 0 ? 0 : Math.floor(e / 100);
|
|
22
30
|
}
|
|
23
|
-
function J(e,
|
|
24
|
-
const u =
|
|
31
|
+
function J(e, r = 1) {
|
|
32
|
+
const u = r > 1 ? `每 ${r} ` : "按";
|
|
25
33
|
switch (e) {
|
|
26
34
|
case "month":
|
|
27
35
|
return `${u}月订阅`;
|
|
@@ -36,31 +44,31 @@ function J(e, i = 1) {
|
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
function W(e) {
|
|
39
|
-
const
|
|
47
|
+
const r = e != null && e.intervalCount && e.intervalCount > 1 ? `${e.intervalCount} ` : "";
|
|
40
48
|
switch (e == null ? void 0 : e.interval) {
|
|
41
49
|
case "month":
|
|
42
|
-
return `/ ${
|
|
50
|
+
return `/ ${r}月`;
|
|
43
51
|
case "year":
|
|
44
|
-
return `/ ${
|
|
52
|
+
return `/ ${r}年`;
|
|
45
53
|
case "day":
|
|
46
|
-
return `/ ${
|
|
54
|
+
return `/ ${r}天`;
|
|
47
55
|
case "week":
|
|
48
|
-
return `/ ${
|
|
56
|
+
return `/ ${r}周`;
|
|
49
57
|
default:
|
|
50
58
|
return "";
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
function X(e) {
|
|
54
|
-
const
|
|
62
|
+
const r = (e == null ? void 0 : e.intervalCount) ?? 1;
|
|
55
63
|
switch (e == null ? void 0 : e.interval) {
|
|
56
64
|
case "month":
|
|
57
|
-
return `${
|
|
65
|
+
return `${r} 个月`;
|
|
58
66
|
case "year":
|
|
59
|
-
return `${
|
|
67
|
+
return `${r} 年`;
|
|
60
68
|
case "day":
|
|
61
|
-
return `${
|
|
69
|
+
return `${r} 天`;
|
|
62
70
|
case "week":
|
|
63
|
-
return `${
|
|
71
|
+
return `${r} 周`;
|
|
64
72
|
default:
|
|
65
73
|
return "";
|
|
66
74
|
}
|
|
@@ -81,14 +89,14 @@ function A(e) {
|
|
|
81
89
|
return "";
|
|
82
90
|
}
|
|
83
91
|
}
|
|
84
|
-
function
|
|
92
|
+
function q(e) {
|
|
85
93
|
if (e.type === "quota" && e.value !== void 0) {
|
|
86
|
-
const
|
|
94
|
+
const r = A(e.quotaPeriod), u = r ? ` / ${r}` : "";
|
|
87
95
|
return `${e.name}: ${e.value === -1 ? "无限" : e.value}${u}`;
|
|
88
96
|
}
|
|
89
97
|
if (e.type === "unlimited") {
|
|
90
|
-
const
|
|
91
|
-
return
|
|
98
|
+
const r = A(e.quotaPeriod);
|
|
99
|
+
return r ? `${e.name}: 不限 / ${r}` : `${e.name}不限`;
|
|
92
100
|
}
|
|
93
101
|
return e.type === "boolean" && e.value === !1 ? `${e.name}(不支持)` : e.name;
|
|
94
102
|
}
|
|
@@ -99,21 +107,21 @@ function I(e) {
|
|
|
99
107
|
intervalCount: e.intervalCount ?? 1
|
|
100
108
|
};
|
|
101
109
|
}
|
|
102
|
-
function Y(e,
|
|
110
|
+
function Y(e, r) {
|
|
103
111
|
const u = {
|
|
104
112
|
day: 1,
|
|
105
113
|
week: 2,
|
|
106
114
|
month: 3,
|
|
107
115
|
year: 4
|
|
108
116
|
};
|
|
109
|
-
return u[e.interval] - u[
|
|
117
|
+
return u[e.interval] - u[r.interval] || e.intervalCount - r.intervalCount;
|
|
110
118
|
}
|
|
111
|
-
function Z(e,
|
|
119
|
+
function Z(e, r) {
|
|
112
120
|
let u = 0;
|
|
113
121
|
for (const l of e)
|
|
114
|
-
for (const
|
|
115
|
-
const s = I(
|
|
116
|
-
(s == null ? void 0 : s.key) ===
|
|
122
|
+
for (const d of l.prices) {
|
|
123
|
+
const s = I(d);
|
|
124
|
+
(s == null ? void 0 : s.key) === r && (u = Math.max(u, F(d)));
|
|
117
125
|
}
|
|
118
126
|
return u > 0 ? `最高优惠 ¥${P(u)}` : void 0;
|
|
119
127
|
}
|
|
@@ -124,39 +132,39 @@ function B() {
|
|
|
124
132
|
return !!localStorage.getItem("jwtToken");
|
|
125
133
|
}
|
|
126
134
|
function ae(e = "month") {
|
|
127
|
-
const
|
|
135
|
+
const r = g([]), u = g(null), l = g(null), d = g(!1), s = g(!1), f = g(ee(e)), m = S(() => {
|
|
128
136
|
const n = /* @__PURE__ */ new Map();
|
|
129
|
-
for (const t of
|
|
130
|
-
for (const
|
|
131
|
-
const
|
|
132
|
-
|
|
137
|
+
for (const t of r.value)
|
|
138
|
+
for (const i of t.prices) {
|
|
139
|
+
const c = I(i);
|
|
140
|
+
c && n.set(c.key, c);
|
|
133
141
|
}
|
|
134
142
|
return [...n.values()].sort(Y).map((t) => ({
|
|
135
143
|
value: t.key,
|
|
136
144
|
label: J(t.interval, t.intervalCount),
|
|
137
|
-
badge: Z(
|
|
145
|
+
badge: Z(r.value, t.key)
|
|
138
146
|
}));
|
|
139
|
-
}),
|
|
147
|
+
}), p = S(() => {
|
|
140
148
|
const n = [];
|
|
141
|
-
for (const t of
|
|
142
|
-
const
|
|
143
|
-
const b = I(
|
|
144
|
-
return (b == null ? void 0 : b.key) ===
|
|
145
|
-
}),
|
|
146
|
-
|
|
149
|
+
for (const t of r.value) {
|
|
150
|
+
const i = t.prices.find((o) => {
|
|
151
|
+
const b = I(o);
|
|
152
|
+
return (b == null ? void 0 : b.key) === f.value;
|
|
153
|
+
}), c = t.prices.find((o) => o.type === "free"), a = i ?? (c && t.prices.every((o) => o.type === "free") ? c : void 0);
|
|
154
|
+
a && n.push({
|
|
147
155
|
...t,
|
|
148
|
-
features:
|
|
149
|
-
selectedPrice:
|
|
156
|
+
features: a.features ?? [],
|
|
157
|
+
selectedPrice: a
|
|
150
158
|
});
|
|
151
159
|
}
|
|
152
160
|
return n;
|
|
153
161
|
});
|
|
154
162
|
function x(n) {
|
|
155
|
-
|
|
163
|
+
f.value = n;
|
|
156
164
|
}
|
|
157
165
|
function y(n) {
|
|
158
|
-
const t = u.value,
|
|
159
|
-
return t != null && t.priceId && n.selectedPrice ? t.priceId === n.selectedPrice.id : t ? t.productId === n.id :
|
|
166
|
+
const t = u.value, i = l.value;
|
|
167
|
+
return t != null && t.priceId && n.selectedPrice ? t.priceId === n.selectedPrice.id : t ? t.productId === n.id : i != null && i.priceId && n.selectedPrice ? i.priceId === n.selectedPrice.id : i ? i.productId === n.id : !1;
|
|
160
168
|
}
|
|
161
169
|
function C(n) {
|
|
162
170
|
var t;
|
|
@@ -180,21 +188,21 @@ function ae(e = "month") {
|
|
|
180
188
|
var t;
|
|
181
189
|
return P((t = n.selectedPrice) == null ? void 0 : t.unitAmount);
|
|
182
190
|
}
|
|
183
|
-
function
|
|
191
|
+
function j(n) {
|
|
184
192
|
const t = D(n.selectedPrice);
|
|
185
193
|
return t === void 0 ? void 0 : P(t);
|
|
186
194
|
}
|
|
187
|
-
function
|
|
195
|
+
function G(n) {
|
|
188
196
|
return v(n) ? "" : W(n.selectedPrice);
|
|
189
197
|
}
|
|
190
|
-
function
|
|
198
|
+
function O(n) {
|
|
191
199
|
if (v(n)) {
|
|
192
200
|
const t = X(n.selectedPrice);
|
|
193
201
|
return t ? `${t}免费体验` : "免费体验";
|
|
194
202
|
}
|
|
195
203
|
return H(n.selectedPrice);
|
|
196
204
|
}
|
|
197
|
-
function
|
|
205
|
+
function T(n) {
|
|
198
206
|
const t = [];
|
|
199
207
|
return y(n) ? t.push({
|
|
200
208
|
label: "当前方案",
|
|
@@ -212,47 +220,50 @@ function ae(e = "month") {
|
|
|
212
220
|
return y(n) ? "当前方案" : v(n) ? t ? "已订阅付费方案" : B() ? "免费开通" : "免费注册" : t ? C(n) ? "切换周期" : typeof t.unitAmount == "number" && n.selectedPrice.unitAmount > t.unitAmount ? "升级方案" : "切换方案" : "立即订阅";
|
|
213
221
|
}
|
|
214
222
|
function R(n, t) {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
|
|
218
|
-
|
|
223
|
+
const i = typeof n.description == "string" ? n.description.trim() : "";
|
|
224
|
+
if (i)
|
|
225
|
+
return i;
|
|
226
|
+
const c = n.features.find((a) => a.type === "quota" && a.value !== void 0);
|
|
227
|
+
if (c) {
|
|
228
|
+
const a = A(c.quotaPeriod), o = c.value === -1 ? "不限量" : c.value;
|
|
229
|
+
return `${c.name} ${a ? `${o} / ${a}` : o},覆盖核心使用场景。`;
|
|
219
230
|
}
|
|
220
231
|
return v(n) ? "注册后自动开通免费权益,适合先体验核心能力。" : t === 1 ? "为正式团队准备的高配能力组合。" : "包含入门所需的核心能力。";
|
|
221
232
|
}
|
|
222
|
-
function
|
|
233
|
+
function z(n) {
|
|
223
234
|
return n.filter((t) => t.highlight !== !1).map((t) => ({
|
|
224
|
-
title:
|
|
235
|
+
title: q(t),
|
|
225
236
|
description: t.description || ""
|
|
226
237
|
}));
|
|
227
238
|
}
|
|
228
|
-
function
|
|
229
|
-
const t = n.filter((
|
|
230
|
-
title:
|
|
231
|
-
description:
|
|
232
|
-
})),
|
|
233
|
-
title:
|
|
234
|
-
description:
|
|
235
|
-
})),
|
|
236
|
-
return
|
|
239
|
+
function K(n) {
|
|
240
|
+
const t = n.filter((o) => o.highlight !== !1), i = t.filter((o) => o.type === "quota" || o.type === "unlimited").map((o) => ({
|
|
241
|
+
title: q(o),
|
|
242
|
+
description: o.description || ""
|
|
243
|
+
})), c = t.filter((o) => o.type === "boolean" && o.value !== !1).map((o) => ({
|
|
244
|
+
title: o.name,
|
|
245
|
+
description: o.description || ""
|
|
246
|
+
})), a = [];
|
|
247
|
+
return c.length && a.push({
|
|
237
248
|
title: "功能特性",
|
|
238
|
-
items:
|
|
239
|
-
}),
|
|
249
|
+
items: c
|
|
250
|
+
}), i.length && a.push({
|
|
240
251
|
title: "用量配额",
|
|
241
|
-
items:
|
|
242
|
-
}),
|
|
252
|
+
items: i
|
|
253
|
+
}), a;
|
|
243
254
|
}
|
|
244
255
|
async function k() {
|
|
245
|
-
|
|
256
|
+
d.value = !0;
|
|
246
257
|
const {
|
|
247
258
|
data: n,
|
|
248
259
|
error: t
|
|
249
|
-
} = await
|
|
250
|
-
if (
|
|
260
|
+
} = await V.productOptions();
|
|
261
|
+
if (d.value = !1, t)
|
|
251
262
|
return;
|
|
252
|
-
|
|
263
|
+
r.value = Array.isArray(n) ? n : [], !m.value.some((c) => c.value === f.value) && m.value[0] && (f.value = m.value[0].value);
|
|
253
264
|
}
|
|
254
265
|
async function L() {
|
|
255
|
-
var
|
|
266
|
+
var c;
|
|
256
267
|
if (!B()) {
|
|
257
268
|
u.value = null, l.value = null;
|
|
258
269
|
return;
|
|
@@ -264,51 +275,51 @@ function ae(e = "month") {
|
|
|
264
275
|
} = await $().billing.subscriptions.summary.post();
|
|
265
276
|
if (s.value = !1, t)
|
|
266
277
|
return;
|
|
267
|
-
const
|
|
268
|
-
if (!(
|
|
278
|
+
const i = n;
|
|
279
|
+
if (!(i != null && i.entitlement) || !i.product) {
|
|
269
280
|
u.value = null, l.value = null;
|
|
270
281
|
return;
|
|
271
282
|
}
|
|
272
|
-
if (
|
|
283
|
+
if (i.entitlement.acquiredBy === "subscribe" && i.price) {
|
|
273
284
|
u.value = {
|
|
274
|
-
id:
|
|
275
|
-
productId:
|
|
276
|
-
productName:
|
|
277
|
-
priceId:
|
|
278
|
-
interval:
|
|
279
|
-
intervalCount:
|
|
280
|
-
unitAmount:
|
|
281
|
-
currency:
|
|
282
|
-
status:
|
|
283
|
-
currentPeriodStart:
|
|
284
|
-
currentPeriodEnd:
|
|
285
|
-
cancelAtPeriodEnd: !!
|
|
286
|
-
pendingChange:
|
|
285
|
+
id: i.entitlement.sourceId,
|
|
286
|
+
productId: i.product.id,
|
|
287
|
+
productName: i.product.name,
|
|
288
|
+
priceId: i.price.id,
|
|
289
|
+
interval: i.price.interval || void 0,
|
|
290
|
+
intervalCount: i.price.intervalCount || void 0,
|
|
291
|
+
unitAmount: i.price.unitAmount || void 0,
|
|
292
|
+
currency: i.price.currency || void 0,
|
|
293
|
+
status: i.entitlement.status,
|
|
294
|
+
currentPeriodStart: i.entitlement.startAt || void 0,
|
|
295
|
+
currentPeriodEnd: i.entitlement.endAt,
|
|
296
|
+
cancelAtPeriodEnd: !!i.entitlement.cancelAtPeriodEnd,
|
|
297
|
+
pendingChange: i.entitlement.pendingChange || null,
|
|
287
298
|
trialEnd: null
|
|
288
299
|
}, l.value = null;
|
|
289
300
|
return;
|
|
290
301
|
}
|
|
291
302
|
u.value = null, l.value = {
|
|
292
|
-
id:
|
|
293
|
-
productId:
|
|
294
|
-
productName:
|
|
295
|
-
priceId: (
|
|
296
|
-
status:
|
|
297
|
-
startAt:
|
|
298
|
-
endAt:
|
|
303
|
+
id: i.entitlement.sourceId,
|
|
304
|
+
productId: i.product.id,
|
|
305
|
+
productName: i.product.name,
|
|
306
|
+
priceId: (c = i.price) == null ? void 0 : c.id,
|
|
307
|
+
status: i.entitlement.status,
|
|
308
|
+
startAt: i.entitlement.startAt,
|
|
309
|
+
endAt: i.entitlement.endAt
|
|
299
310
|
};
|
|
300
311
|
}
|
|
301
|
-
async function
|
|
312
|
+
async function Q() {
|
|
302
313
|
await Promise.all([k(), L()]);
|
|
303
314
|
}
|
|
304
315
|
return {
|
|
305
|
-
products:
|
|
306
|
-
plans:
|
|
316
|
+
products: r,
|
|
317
|
+
plans: p,
|
|
307
318
|
currentSubscription: u,
|
|
308
319
|
currentTrial: l,
|
|
309
|
-
listLoading:
|
|
320
|
+
listLoading: d,
|
|
310
321
|
currentLoading: s,
|
|
311
|
-
billingInterval:
|
|
322
|
+
billingInterval: f,
|
|
312
323
|
billingIntervalTabs: m,
|
|
313
324
|
setBillingInterval: x,
|
|
314
325
|
isCurrentPlan: y,
|
|
@@ -317,17 +328,17 @@ function ae(e = "month") {
|
|
|
317
328
|
isFreePlan: v,
|
|
318
329
|
isPlanActionDisabled: E,
|
|
319
330
|
getDisplayPrice: M,
|
|
320
|
-
getDisplayOriginalPrice:
|
|
321
|
-
getDisplayCycle:
|
|
322
|
-
getPromotionLabel:
|
|
323
|
-
getBadgeLabels:
|
|
331
|
+
getDisplayOriginalPrice: j,
|
|
332
|
+
getDisplayCycle: G,
|
|
333
|
+
getPromotionLabel: O,
|
|
334
|
+
getBadgeLabels: T,
|
|
324
335
|
getButtonLabel: N,
|
|
325
336
|
getPlanSummary: R,
|
|
326
|
-
getFeatureItems:
|
|
327
|
-
getFeatureGroups:
|
|
337
|
+
getFeatureItems: z,
|
|
338
|
+
getFeatureGroups: K,
|
|
328
339
|
loadProducts: k,
|
|
329
340
|
loadCurrentSubscription: L,
|
|
330
|
-
refresh:
|
|
341
|
+
refresh: Q
|
|
331
342
|
};
|
|
332
343
|
}
|
|
333
344
|
function te(e) {
|
|
@@ -340,46 +351,46 @@ function re(e) {
|
|
|
340
351
|
return e && typeof e == "object" && "alipayUrl" in e && typeof e.alipayUrl == "string" ? e.alipayUrl : "";
|
|
341
352
|
}
|
|
342
353
|
function de(e) {
|
|
343
|
-
const
|
|
354
|
+
const r = g(null), {
|
|
344
355
|
ensureAuthenticated: u
|
|
345
|
-
} =
|
|
356
|
+
} = _();
|
|
346
357
|
async function l(s) {
|
|
347
358
|
if (!s.selectedPrice) {
|
|
348
359
|
h.warning("当前方案暂无可购买价格");
|
|
349
360
|
return;
|
|
350
361
|
}
|
|
351
362
|
if (!u(() => l(s))) return;
|
|
352
|
-
const
|
|
353
|
-
if ((
|
|
363
|
+
const f = e.currentSubscription.value;
|
|
364
|
+
if ((f == null ? void 0 : f.priceId) === s.selectedPrice.id) {
|
|
354
365
|
h.info("当前已经是该方案");
|
|
355
366
|
return;
|
|
356
367
|
}
|
|
357
368
|
if (s.selectedPrice.type === "free")
|
|
358
369
|
return;
|
|
359
|
-
|
|
360
|
-
const m =
|
|
361
|
-
subscriptionId:
|
|
370
|
+
r.value = s.id;
|
|
371
|
+
const m = f ? await $().billing.subscriptions.change.post({
|
|
372
|
+
subscriptionId: f.id,
|
|
362
373
|
newPriceId: s.selectedPrice.id,
|
|
363
374
|
proration: !0
|
|
364
375
|
}) : await $().billing.subscriptions.create.post({
|
|
365
376
|
priceId: s.selectedPrice.id
|
|
366
377
|
});
|
|
367
|
-
if (
|
|
378
|
+
if (r.value = null, m.error)
|
|
368
379
|
return;
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
te(
|
|
380
|
+
const p = re(m.data);
|
|
381
|
+
if (p) {
|
|
382
|
+
te(p);
|
|
372
383
|
return;
|
|
373
384
|
}
|
|
374
385
|
h.success(ne(m.data) || "订阅已更新"), await e.refreshCurrentSubscription();
|
|
375
386
|
}
|
|
376
|
-
function
|
|
377
|
-
return
|
|
387
|
+
function d(s) {
|
|
388
|
+
return r.value === s.id;
|
|
378
389
|
}
|
|
379
390
|
return {
|
|
380
|
-
checkoutPlanId:
|
|
391
|
+
checkoutPlanId: r,
|
|
381
392
|
checkout: l,
|
|
382
|
-
isCheckingOut:
|
|
393
|
+
isCheckingOut: d
|
|
383
394
|
};
|
|
384
395
|
}
|
|
385
396
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huyooo/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -11,60 +11,74 @@
|
|
|
11
11
|
"types": "dist/main.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./dist/main.d.ts",
|
|
14
15
|
"import": "./dist/main.js",
|
|
15
|
-
"
|
|
16
|
+
"default": "./dist/main.js"
|
|
16
17
|
},
|
|
17
18
|
"./authkit": {
|
|
19
|
+
"types": "./dist/authkit.d.ts",
|
|
18
20
|
"import": "./dist/authkit.js",
|
|
19
|
-
"
|
|
21
|
+
"default": "./dist/authkit.js"
|
|
20
22
|
},
|
|
21
23
|
"./message": {
|
|
24
|
+
"types": "./dist/message.d.ts",
|
|
22
25
|
"import": "./dist/message.js",
|
|
23
|
-
"
|
|
26
|
+
"default": "./dist/message.js"
|
|
24
27
|
},
|
|
25
28
|
"./messageCenter": {
|
|
29
|
+
"types": "./dist/messageCenter.d.ts",
|
|
26
30
|
"import": "./dist/messageCenter.js",
|
|
27
|
-
"
|
|
31
|
+
"default": "./dist/messageCenter.js"
|
|
28
32
|
},
|
|
29
33
|
"./feedback": {
|
|
34
|
+
"types": "./dist/feedback.d.ts",
|
|
30
35
|
"import": "./dist/feedback.js",
|
|
31
|
-
"
|
|
36
|
+
"default": "./dist/feedback.js"
|
|
32
37
|
},
|
|
33
38
|
"./landingPage": {
|
|
39
|
+
"types": "./dist/landingPage.d.ts",
|
|
34
40
|
"import": "./dist/landingPage.js",
|
|
35
|
-
"
|
|
41
|
+
"default": "./dist/landingPage.js"
|
|
36
42
|
},
|
|
37
43
|
"./common": {
|
|
44
|
+
"types": "./dist/common.d.ts",
|
|
38
45
|
"import": "./dist/common.js",
|
|
39
|
-
"
|
|
46
|
+
"default": "./dist/common.js"
|
|
40
47
|
},
|
|
41
48
|
"./styles": {
|
|
49
|
+
"types": "./dist/styles.d.ts",
|
|
42
50
|
"import": "./dist/styles.js",
|
|
43
|
-
"
|
|
51
|
+
"default": "./dist/styles.js"
|
|
44
52
|
},
|
|
45
53
|
"./composables": {
|
|
54
|
+
"types": "./dist/composables.d.ts",
|
|
46
55
|
"import": "./dist/composables.js",
|
|
47
|
-
"
|
|
56
|
+
"default": "./dist/composables.js"
|
|
48
57
|
},
|
|
49
58
|
"./pay": {
|
|
59
|
+
"types": "./dist/pay.d.ts",
|
|
50
60
|
"import": "./dist/pay.js",
|
|
51
|
-
"
|
|
61
|
+
"default": "./dist/pay.js"
|
|
52
62
|
},
|
|
53
63
|
"./referrer": {
|
|
64
|
+
"types": "./dist/referrer.d.ts",
|
|
54
65
|
"import": "./dist/referrer.js",
|
|
55
|
-
"
|
|
66
|
+
"default": "./dist/referrer.js"
|
|
56
67
|
},
|
|
57
68
|
"./upload": {
|
|
69
|
+
"types": "./dist/upload.d.ts",
|
|
58
70
|
"import": "./dist/upload.js",
|
|
59
|
-
"
|
|
71
|
+
"default": "./dist/upload.js"
|
|
60
72
|
},
|
|
61
73
|
"./user": {
|
|
74
|
+
"types": "./dist/user.d.ts",
|
|
62
75
|
"import": "./dist/user.js",
|
|
63
|
-
"
|
|
76
|
+
"default": "./dist/user.js"
|
|
64
77
|
},
|
|
65
78
|
"./privateCom": {
|
|
79
|
+
"types": "./dist/privateCom.d.ts",
|
|
66
80
|
"import": "./dist/privateCom.js",
|
|
67
|
-
"
|
|
81
|
+
"default": "./dist/privateCom.js"
|
|
68
82
|
},
|
|
69
83
|
"./style.css": "./dist/style.css",
|
|
70
84
|
"./dist/*": "./dist/*"
|