@24city/web-console 0.3.7 → 0.3.9
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/CHANGELOG.md +50 -0
- package/GUIDELINES.md +21 -4
- package/README.md +3 -3
- package/dist/account/account-api.d.ts +7 -0
- package/dist/account/index.d.ts +1 -0
- package/dist/account/index.js +60 -59
- package/dist/account/use-show-once.d.ts +26 -0
- package/dist/chunks/{auth-provider-CqiyTeOt.js → auth-provider-7FOj7Y84.js} +1 -1
- package/dist/chunks/{console-layout-Os4sQzMP.js → console-layout-B4OlW1IZ.js} +1 -1
- package/dist/chunks/logout-signal-CLdquzzn.js +378 -0
- package/dist/chunks/{stale-build-DG-Tb2RA.js → stale-build-DwUlkKYm.js} +2 -2
- package/dist/chunks/text-link-WWzQqJ14.js +196 -0
- package/dist/chunks/use-show-once-Bz1ojVqb.js +768 -0
- package/dist/chunks/{wallet-badge-Dt8fv-Du.js → wallet-badge-COpdEDYI.js} +1 -1
- package/dist/chunks/{waterfall-DOeGU8Zs.js → waterfall-Cyw5kl43.js} +170 -170
- package/dist/index.js +190 -188
- package/dist/layout/index.js +1 -1
- package/dist/list/content-square.d.ts +5 -3
- package/dist/list/index.js +1 -1
- package/dist/page/guide-modal.d.ts +37 -0
- package/dist/page/index.d.ts +1 -0
- package/dist/page/index.js +22 -21
- package/dist/runtime/index.js +2 -2
- package/dist/styles.css +302 -94
- package/dist/testing/fixtures.js +33 -27
- package/package.json +1 -1
- package/dist/chunks/logout-signal-CiD_zY5M.js +0 -365
- package/dist/chunks/text-link-Bb5f1eLW.js +0 -106
- package/dist/chunks/upgrade-modal-DyPkV9OB.js +0 -713
package/dist/testing/fixtures.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
const
|
|
1
|
+
import { c as i } from "../chunks/http-B3mTs9KZ.js";
|
|
2
|
+
const r = (e = {}) => ({
|
|
3
3
|
brand: { name: "示例产品", shortName: "示例", mark: "示", description: "@24city/web-console 示例", primaryColor: "#E04E06" },
|
|
4
4
|
routes: { publicHome: "/", login: "/login", app: "/app" },
|
|
5
5
|
api: { baseUrl: "/api" },
|
|
6
6
|
enabledModules: [],
|
|
7
7
|
...e
|
|
8
|
-
}),
|
|
8
|
+
}), c = (e = {}) => ({
|
|
9
9
|
globalUserId: "user-fixture",
|
|
10
10
|
localUserId: 1,
|
|
11
11
|
activeSpaceId: "space-personal",
|
|
@@ -19,7 +19,7 @@ const n = (e = {}) => ({
|
|
|
19
19
|
lastCentralVerifiedAt: "2026-01-01T00:00:00Z",
|
|
20
20
|
accountCenterUrl: "https://account.example.invalid",
|
|
21
21
|
...e
|
|
22
|
-
}),
|
|
22
|
+
}), l = () => [
|
|
23
23
|
{
|
|
24
24
|
id: "space-personal",
|
|
25
25
|
name: "示例用户的空间",
|
|
@@ -42,7 +42,7 @@ const n = (e = {}) => ({
|
|
|
42
42
|
entitlementSummary: { activeCount: 1, codes: ["team-standard"] },
|
|
43
43
|
entitlements: []
|
|
44
44
|
}
|
|
45
|
-
],
|
|
45
|
+
], p = () => ({ nickName: "示例用户" }), u = (e = {}) => ({
|
|
46
46
|
spaceId: "space-personal",
|
|
47
47
|
globalUserId: "user-fixture",
|
|
48
48
|
productCode: "demo",
|
|
@@ -56,7 +56,7 @@ const n = (e = {}) => ({
|
|
|
56
56
|
walletReservedPoints: 0,
|
|
57
57
|
walletVersion: 1,
|
|
58
58
|
...e
|
|
59
|
-
}),
|
|
59
|
+
}), d = () => ({
|
|
60
60
|
subscriptionId: null,
|
|
61
61
|
planCode: "platform-free",
|
|
62
62
|
planName: "免费版",
|
|
@@ -64,7 +64,7 @@ const n = (e = {}) => ({
|
|
|
64
64
|
isDefault: !0,
|
|
65
65
|
spaceType: "personal",
|
|
66
66
|
currentPeriodEnd: null
|
|
67
|
-
}),
|
|
67
|
+
}), m = () => [
|
|
68
68
|
{ code: "platform-free", name: "免费版", spaceType: "personal", tier: 0, isDefault: !0, includedSeats: 1, monthlyPoints: 500, prices: [], benefits: [], otherProducts: [] },
|
|
69
69
|
{
|
|
70
70
|
code: "platform-premium",
|
|
@@ -108,35 +108,41 @@ const n = (e = {}) => ({
|
|
|
108
108
|
benefits: [],
|
|
109
109
|
otherProducts: []
|
|
110
110
|
}
|
|
111
|
-
],
|
|
112
|
-
let t =
|
|
111
|
+
], y = (e = {}) => {
|
|
112
|
+
let t = c();
|
|
113
|
+
const a = /* @__PURE__ */ new Set();
|
|
113
114
|
return {
|
|
114
115
|
startLogin: () => "#",
|
|
115
116
|
getSession: async () => t,
|
|
116
|
-
getSpaces: async () => ({ activeSpaceId: t.activeSpaceId, spaces:
|
|
117
|
+
getSpaces: async () => ({ activeSpaceId: t.activeSpaceId, spaces: l() }),
|
|
117
118
|
switchSpace: async (s) => (t = { ...t, activeSpaceId: s }, t),
|
|
118
|
-
getProfile: async () =>
|
|
119
|
-
getWallet: async () =>
|
|
119
|
+
getProfile: async () => p(),
|
|
120
|
+
getWallet: async () => u({ spaceId: t.activeSpaceId }),
|
|
120
121
|
getEntitlements: async () => [],
|
|
121
|
-
getSubscription: async () =>
|
|
122
|
-
getPlans: async () =>
|
|
122
|
+
getSubscription: async () => d(),
|
|
123
|
+
getPlans: async () => m(),
|
|
123
124
|
logout: async () => ({ endSessionUrl: null }),
|
|
125
|
+
getShownPrompts: async (s) => s.filter((n) => a.has(n)),
|
|
126
|
+
claimShownPrompts: async (s) => {
|
|
127
|
+
const n = [...new Set(s)].filter((o) => !a.has(o));
|
|
128
|
+
return n.forEach((o) => a.add(o)), n;
|
|
129
|
+
},
|
|
124
130
|
...e
|
|
125
131
|
};
|
|
126
|
-
},
|
|
127
|
-
config:
|
|
128
|
-
http:
|
|
129
|
-
accountApi:
|
|
132
|
+
}, P = (e = {}) => ({
|
|
133
|
+
config: r(),
|
|
134
|
+
http: i(),
|
|
135
|
+
accountApi: y(),
|
|
130
136
|
...e
|
|
131
137
|
});
|
|
132
138
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
y as createFixtureAccountApi,
|
|
140
|
+
P as createFixtureRuntime,
|
|
141
|
+
m as fixturePlans,
|
|
142
|
+
p as fixtureProfile,
|
|
143
|
+
r as fixtureRuntimeConfig,
|
|
144
|
+
c as fixtureSession,
|
|
145
|
+
l as fixtureSpaces,
|
|
146
|
+
d as fixtureSubscription,
|
|
147
|
+
u as fixtureWallet
|
|
142
148
|
};
|
package/package.json
CHANGED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { sanitizeInternalReturnPath as I } from "@24city/web-runtime/core/internal-path";
|
|
2
|
-
import { createContext as O, useSyncExternalStore as R, useContext as x } from "react";
|
|
3
|
-
import { summarizeCustomerError as _ } from "@24city/web-runtime/error-summary";
|
|
4
|
-
const A = (t) => t.includes("\\") || [...t].some((e) => {
|
|
5
|
-
const r = e.charCodeAt(0);
|
|
6
|
-
return r <= 31 || r === 127;
|
|
7
|
-
}), ot = (t) => !A(t) && t.startsWith("/") && !t.startsWith("//") && (() => {
|
|
8
|
-
try {
|
|
9
|
-
const e = new URL(t, "https://product.invalid");
|
|
10
|
-
return e.origin === "https://product.invalid" && I(t, e.pathname) === t;
|
|
11
|
-
} catch {
|
|
12
|
-
return !1;
|
|
13
|
-
}
|
|
14
|
-
})(), st = (t, e) => !A(t) && I(t, e) === t, F = (t, e) => !t || A(t) ? e : I(t, e), D = (t) => typeof t == "object" && t !== null && !Array.isArray(t), p = (t, e) => {
|
|
15
|
-
const r = e.data;
|
|
16
|
-
if (!D(r) || r.code !== 0 || !("data" in r))
|
|
17
|
-
throw new Error(`接口 ${t} 返回了无效响应`);
|
|
18
|
-
return r.data;
|
|
19
|
-
}, u = (t, e, r) => {
|
|
20
|
-
if (!D(t)) throw new Error(`接口 ${e} 字段 ${r} 无效`);
|
|
21
|
-
return t;
|
|
22
|
-
}, o = (t, e, r) => {
|
|
23
|
-
const n = t[e];
|
|
24
|
-
if (typeof n != "string" || !n.trim())
|
|
25
|
-
throw new Error(`接口 ${r} 字段 ${e} 无效`);
|
|
26
|
-
return n;
|
|
27
|
-
}, f = (t, e, r) => {
|
|
28
|
-
const n = t[e];
|
|
29
|
-
if (typeof n != "number" || !Number.isSafeInteger(n) || n < 0)
|
|
30
|
-
throw new Error(`接口 ${r} 字段 ${e} 无效`);
|
|
31
|
-
return n;
|
|
32
|
-
}, w = "/account", c = `${w}/session`, P = `${w}/logout`, i = `${w}/spaces`, v = `${i}/switch`, $ = `${w}/profile`, h = `${w}/wallet`, b = `${w}/entitlements`, m = `${w}/subscription`, s = `${w}/plans`, N = (t, e, r) => {
|
|
33
|
-
const n = t[e];
|
|
34
|
-
if (n !== null && typeof n != "string")
|
|
35
|
-
throw new Error(`接口 ${r} 字段 ${e} 无效`);
|
|
36
|
-
return n;
|
|
37
|
-
}, S = (t, e, r) => {
|
|
38
|
-
const n = t[e];
|
|
39
|
-
if (n != null) {
|
|
40
|
-
if (typeof n != "string")
|
|
41
|
-
throw new Error(`接口 ${r} 字段 ${e} 无效`);
|
|
42
|
-
return n;
|
|
43
|
-
}
|
|
44
|
-
}, z = (t, e, r) => {
|
|
45
|
-
const n = t[e];
|
|
46
|
-
return n === null ? {} : u(n, r, e);
|
|
47
|
-
}, M = (t) => {
|
|
48
|
-
const e = u(t, P, "data"), r = S(e, "endSessionUrl", P);
|
|
49
|
-
if (!r) return null;
|
|
50
|
-
try {
|
|
51
|
-
return new URL(r).protocol === "https:" ? r : null;
|
|
52
|
-
} catch {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}, T = (t) => {
|
|
56
|
-
const e = u(t, c, "data");
|
|
57
|
-
if (e.purpose !== "user") throw new Error("产品用户 Web 只接受 user Purpose 会话");
|
|
58
|
-
return {
|
|
59
|
-
globalUserId: o(e, "globalUserId", c),
|
|
60
|
-
localUserId: f(e, "localUserId", c),
|
|
61
|
-
activeSpaceId: o(e, "activeSpaceId", c),
|
|
62
|
-
authorityId: f(e, "authorityId", c),
|
|
63
|
-
orgId: f(e, "orgId", c),
|
|
64
|
-
purpose: "user",
|
|
65
|
-
csrfToken: o(e, "csrfToken", c),
|
|
66
|
-
issuedAt: o(e, "issuedAt", c),
|
|
67
|
-
lastSeenAt: o(e, "lastSeenAt", c),
|
|
68
|
-
absoluteExpiresAt: o(e, "absoluteExpiresAt", c),
|
|
69
|
-
lastCentralVerifiedAt: o(e, "lastCentralVerifiedAt", c),
|
|
70
|
-
accountCenterUrl: o(e, "accountCenterUrl", c)
|
|
71
|
-
};
|
|
72
|
-
}, L = (t, e, r) => {
|
|
73
|
-
const n = u(t, e, r);
|
|
74
|
-
return {
|
|
75
|
-
id: o(n, "id", e),
|
|
76
|
-
entitlementCode: o(n, "entitlementCode", e),
|
|
77
|
-
status: S(n, "status", e),
|
|
78
|
-
startsAt: o(n, "startsAt", e),
|
|
79
|
-
expiresAt: N(n, "expiresAt", e),
|
|
80
|
-
metadata: z(n, "metadata", e)
|
|
81
|
-
};
|
|
82
|
-
}, W = (t, e) => {
|
|
83
|
-
const r = u(t, i, `spaces[${e}]`), n = u(r.entitlementSummary, i, "entitlementSummary"), a = n.codes, l = r.entitlements;
|
|
84
|
-
if (!Array.isArray(a) || a.some((y) => typeof y != "string"))
|
|
85
|
-
throw new Error(`接口 ${i} 字段 entitlementSummary.codes 无效`);
|
|
86
|
-
if (!Array.isArray(l))
|
|
87
|
-
throw new Error(`接口 ${i} 字段 entitlements 无效`);
|
|
88
|
-
return {
|
|
89
|
-
id: o(r, "id", i),
|
|
90
|
-
name: o(r, "name", i),
|
|
91
|
-
slug: o(r, "slug", i),
|
|
92
|
-
type: o(r, "type", i),
|
|
93
|
-
role: o(r, "role", i),
|
|
94
|
-
status: o(r, "status", i),
|
|
95
|
-
membershipStatus: o(r, "membershipStatus", i),
|
|
96
|
-
entitlementSummary: {
|
|
97
|
-
activeCount: f(n, "activeCount", i),
|
|
98
|
-
codes: [...a]
|
|
99
|
-
},
|
|
100
|
-
entitlements: l.map(
|
|
101
|
-
(y, d) => L(y, i, `entitlements[${d}]`)
|
|
102
|
-
)
|
|
103
|
-
};
|
|
104
|
-
}, q = (t) => {
|
|
105
|
-
const e = u(t, i, "data"), r = o(e, "activeSpaceId", i);
|
|
106
|
-
if (!Array.isArray(e.spaces)) throw new Error(`接口 ${i} 字段 spaces 无效`);
|
|
107
|
-
const n = e.spaces.map(W);
|
|
108
|
-
if (!n.some((a) => a.id === r))
|
|
109
|
-
throw new Error(`接口 ${i} 的当前空间不在可用空间列表中`);
|
|
110
|
-
return { activeSpaceId: r, spaces: n };
|
|
111
|
-
}, B = (t) => {
|
|
112
|
-
const e = u(t, $, "data");
|
|
113
|
-
return { nickName: (S(e, "nickName", $) ?? "").trim() };
|
|
114
|
-
}, V = (t) => {
|
|
115
|
-
const e = u(t, h, "data"), r = (n) => {
|
|
116
|
-
const a = e[n];
|
|
117
|
-
if (typeof a != "number" || !Number.isSafeInteger(a))
|
|
118
|
-
throw new Error(`接口 ${h} 字段 ${n} 无效`);
|
|
119
|
-
return a;
|
|
120
|
-
};
|
|
121
|
-
return {
|
|
122
|
-
spaceId: o(e, "spaceId", h),
|
|
123
|
-
globalUserId: o(e, "globalUserId", h),
|
|
124
|
-
productCode: o(e, "productCode", h),
|
|
125
|
-
availablePoints: r("availablePoints"),
|
|
126
|
-
reservedPoints: r("reservedPoints"),
|
|
127
|
-
globalAvailablePoints: r("globalAvailablePoints"),
|
|
128
|
-
globalReservedPoints: r("globalReservedPoints"),
|
|
129
|
-
productAvailablePoints: r("productAvailablePoints"),
|
|
130
|
-
productReservedPoints: r("productReservedPoints"),
|
|
131
|
-
walletAvailablePoints: r("walletAvailablePoints"),
|
|
132
|
-
walletReservedPoints: r("walletReservedPoints"),
|
|
133
|
-
walletVersion: f(e, "walletVersion", h)
|
|
134
|
-
};
|
|
135
|
-
}, k = (t) => {
|
|
136
|
-
if (t === null) return null;
|
|
137
|
-
const e = u(t, m, "data"), r = e.tier;
|
|
138
|
-
if (typeof r != "number" || !Number.isSafeInteger(r))
|
|
139
|
-
throw new Error(`接口 ${m} 字段 tier 无效`);
|
|
140
|
-
if (typeof e.isDefault != "boolean")
|
|
141
|
-
throw new Error(`接口 ${m} 字段 isDefault 无效`);
|
|
142
|
-
return {
|
|
143
|
-
subscriptionId: N(e, "subscriptionId", m),
|
|
144
|
-
planCode: o(e, "planCode", m),
|
|
145
|
-
planName: (S(e, "planName", m) ?? "").trim(),
|
|
146
|
-
tier: r,
|
|
147
|
-
isDefault: e.isDefault,
|
|
148
|
-
spaceType: S(e, "spaceType", m) ?? "",
|
|
149
|
-
currentPeriodEnd: N(e, "currentPeriodEnd", m)
|
|
150
|
-
};
|
|
151
|
-
}, G = /* @__PURE__ */ new Set(["month", "year", "one_time"]), H = (t, e) => {
|
|
152
|
-
const r = u(t, s, e), n = o(r, "billingPeriod", s);
|
|
153
|
-
if (!G.has(n)) throw new Error(`接口 ${s} 字段 ${e}.billingPeriod 无效`);
|
|
154
|
-
return {
|
|
155
|
-
code: o(r, "code", s),
|
|
156
|
-
amountCents: f(r, "amountCents", s),
|
|
157
|
-
currency: o(r, "currency", s),
|
|
158
|
-
billingPeriod: n,
|
|
159
|
-
durationDays: f(r, "durationDays", s),
|
|
160
|
-
pointCycles: f(r, "pointCycles", s)
|
|
161
|
-
};
|
|
162
|
-
}, j = (t, e) => {
|
|
163
|
-
const r = u(t, s, e), n = r.limit;
|
|
164
|
-
if (n != null && (typeof n != "number" || !Number.isSafeInteger(n) || n < 0))
|
|
165
|
-
throw new Error(`接口 ${s} 字段 ${e}.limit 无效`);
|
|
166
|
-
const a = Array.isArray(r.discounts) ? r.discounts.filter((l) => typeof l == "string") : [];
|
|
167
|
-
return {
|
|
168
|
-
key: S(r, "key", s) ?? "",
|
|
169
|
-
name: o(r, "name", s),
|
|
170
|
-
description: S(r, "description", s) ?? "",
|
|
171
|
-
limit: typeof n == "number" ? n : null,
|
|
172
|
-
discounts: a
|
|
173
|
-
};
|
|
174
|
-
}, K = (t, e) => {
|
|
175
|
-
const r = `data[${e}]`, n = u(t, s, r), a = o(n, "spaceType", s);
|
|
176
|
-
if (a !== "personal" && a !== "team") throw new Error(`接口 ${s} 字段 ${r}.spaceType 无效`);
|
|
177
|
-
if (typeof n.tier != "number" || !Number.isSafeInteger(n.tier)) throw new Error(`接口 ${s} 字段 ${r}.tier 无效`);
|
|
178
|
-
if (typeof n.isDefault != "boolean") throw new Error(`接口 ${s} 字段 ${r}.isDefault 无效`);
|
|
179
|
-
if (!Array.isArray(n.prices)) throw new Error(`接口 ${s} 字段 ${r}.prices 无效`);
|
|
180
|
-
const l = Array.isArray(n.benefits) ? n.benefits : [], y = Array.isArray(n.otherProducts) ? n.otherProducts.filter((d) => typeof d == "string" && d.trim() !== "").map((d) => d.trim()) : [];
|
|
181
|
-
return {
|
|
182
|
-
code: o(n, "code", s),
|
|
183
|
-
name: o(n, "name", s).trim(),
|
|
184
|
-
spaceType: a,
|
|
185
|
-
tier: n.tier,
|
|
186
|
-
isDefault: n.isDefault,
|
|
187
|
-
includedSeats: f(n, "includedSeats", s),
|
|
188
|
-
monthlyPoints: f(n, "monthlyPoints", s),
|
|
189
|
-
prices: n.prices.map((d, E) => H(d, `${r}.prices[${E}]`)),
|
|
190
|
-
benefits: l.map((d, E) => j(d, `${r}.benefits[${E}]`)),
|
|
191
|
-
otherProducts: y
|
|
192
|
-
};
|
|
193
|
-
}, X = (t) => {
|
|
194
|
-
if (!Array.isArray(t)) throw new Error(`接口 ${s} 字段 data 无效`);
|
|
195
|
-
return t.map(K);
|
|
196
|
-
}, at = (t, e) => {
|
|
197
|
-
const r = e === "/" ? "" : e;
|
|
198
|
-
return {
|
|
199
|
-
startLogin(n, a) {
|
|
200
|
-
const l = F(n, a);
|
|
201
|
-
return `${r}${w}/startLogin?returnPath=${encodeURIComponent(l)}`;
|
|
202
|
-
},
|
|
203
|
-
async getSession() {
|
|
204
|
-
return T(p(c, await t.get(c)));
|
|
205
|
-
},
|
|
206
|
-
async getSpaces() {
|
|
207
|
-
return q(p(i, await t.get(i)));
|
|
208
|
-
},
|
|
209
|
-
async switchSpace(n) {
|
|
210
|
-
const a = p(v, await t.post(v, { globalSpaceId: n }));
|
|
211
|
-
return T(a);
|
|
212
|
-
},
|
|
213
|
-
async getProfile() {
|
|
214
|
-
return B(p($, await t.get($)));
|
|
215
|
-
},
|
|
216
|
-
async getWallet() {
|
|
217
|
-
return V(p(h, await t.get(h)));
|
|
218
|
-
},
|
|
219
|
-
async getEntitlements() {
|
|
220
|
-
const n = p(b, await t.get(b));
|
|
221
|
-
if (!Array.isArray(n)) throw new Error(`接口 ${b} 字段 data 无效`);
|
|
222
|
-
return n.map((a, l) => L(a, b, `entitlements[${l}]`));
|
|
223
|
-
},
|
|
224
|
-
async getSubscription() {
|
|
225
|
-
return k(p(m, await t.get(m)));
|
|
226
|
-
},
|
|
227
|
-
async getPlans() {
|
|
228
|
-
return X(p(s, await t.get(s)));
|
|
229
|
-
},
|
|
230
|
-
async logout() {
|
|
231
|
-
const n = p(P, await t.post(P));
|
|
232
|
-
return { endSessionUrl: M(n) };
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}, it = async (t) => {
|
|
236
|
-
let e = await t.getSession();
|
|
237
|
-
const r = await t.getSpaces();
|
|
238
|
-
if (r.activeSpaceId !== e.activeSpaceId && (e = await t.getSession()), r.activeSpaceId !== e.activeSpaceId)
|
|
239
|
-
throw new Error("产品会话与统一空间上下文不一致");
|
|
240
|
-
return { session: e, spaces: r.spaces };
|
|
241
|
-
}, ct = (t) => t == null || !Number.isFinite(t) ? "暂无" : t >= 1e8 ? `${(Math.floor(t / 1e7) / 10).toFixed(1)}亿` : t >= 1e4 ? `${(Math.floor(t / 1e3) / 10).toFixed(1)}万` : t.toLocaleString("zh-CN"), ut = (t) => t.toLocaleString("zh-CN", { maximumFractionDigits: 0 }), lt = (t) => t > 0 && t < 0.01 ? "<0.01" : t.toLocaleString("zh-CN", { maximumFractionDigits: 2 }), dt = (t) => t ? `¥${(t / 100).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : "暂无", mt = (t) => {
|
|
242
|
-
if (t === void 0 || t <= 0) return "";
|
|
243
|
-
const e = Math.floor(t / 60), r = Math.floor(t % 60);
|
|
244
|
-
return `${e}:${String(r).padStart(2, "0")}`;
|
|
245
|
-
}, ft = (t) => {
|
|
246
|
-
if (t === void 0 || t <= 0) return "暂无";
|
|
247
|
-
const e = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), n = t % 60;
|
|
248
|
-
return e > 0 ? `${e}小时${r}分` : r > 0 ? `${r}分${n}秒` : `${n}秒`;
|
|
249
|
-
}, pt = (t) => {
|
|
250
|
-
const e = new Date(t);
|
|
251
|
-
return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "short", timeStyle: "short" }).format(e);
|
|
252
|
-
}, gt = (t) => {
|
|
253
|
-
if (!t) return "长期有效";
|
|
254
|
-
const e = new Date(t);
|
|
255
|
-
return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "medium" }).format(e);
|
|
256
|
-
}, Y = () => ({
|
|
257
|
-
session: null,
|
|
258
|
-
spaces: [],
|
|
259
|
-
bootstrapped: !1,
|
|
260
|
-
serviceUnavailable: !1
|
|
261
|
-
}), wt = () => {
|
|
262
|
-
let t = Y();
|
|
263
|
-
const e = /* @__PURE__ */ new Set(), r = (n) => {
|
|
264
|
-
t = n, e.forEach((a) => a());
|
|
265
|
-
};
|
|
266
|
-
return {
|
|
267
|
-
subscribe(n) {
|
|
268
|
-
return e.add(n), () => e.delete(n);
|
|
269
|
-
},
|
|
270
|
-
getState: () => t,
|
|
271
|
-
getCsrfToken: () => {
|
|
272
|
-
var n;
|
|
273
|
-
return ((n = t.session) == null ? void 0 : n.csrfToken) ?? null;
|
|
274
|
-
},
|
|
275
|
-
setContext(n) {
|
|
276
|
-
r({ session: n.session, spaces: [...n.spaces], bootstrapped: !0, serviceUnavailable: !1 });
|
|
277
|
-
},
|
|
278
|
-
setBootstrapping() {
|
|
279
|
-
r({ ...t, bootstrapped: !1, serviceUnavailable: !1 });
|
|
280
|
-
},
|
|
281
|
-
clear(n = {}) {
|
|
282
|
-
r({ session: null, spaces: [], bootstrapped: !0, serviceUnavailable: n.unavailable ?? !1 });
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
}, U = O(null), ht = U.Provider, J = () => {
|
|
286
|
-
const t = x(U);
|
|
287
|
-
if (!t) throw new Error("AuthStoreProvider 尚未初始化");
|
|
288
|
-
return t;
|
|
289
|
-
}, St = () => {
|
|
290
|
-
const t = J();
|
|
291
|
-
return R(t.subscribe, t.getState, t.getState);
|
|
292
|
-
}, yt = (t) => t instanceof Error && t.message.trim() ? t.message : "请稍后重试;如问题持续,请联系管理员。", bt = (t, e) => _(t).status === e, C = "24city.console.logout-at", Q = 15e3;
|
|
293
|
-
let g = null;
|
|
294
|
-
const Z = () => {
|
|
295
|
-
try {
|
|
296
|
-
return Number(window.localStorage.getItem(C) ?? Number.NaN);
|
|
297
|
-
} catch {
|
|
298
|
-
return Number.NaN;
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
function Pt(t = Date.now()) {
|
|
302
|
-
try {
|
|
303
|
-
window.localStorage.setItem(C, String(t));
|
|
304
|
-
} catch {
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function tt() {
|
|
308
|
-
try {
|
|
309
|
-
window.localStorage.removeItem(C);
|
|
310
|
-
} catch {
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
function $t() {
|
|
314
|
-
g = "leaving";
|
|
315
|
-
}
|
|
316
|
-
function Et() {
|
|
317
|
-
return g === "leaving";
|
|
318
|
-
}
|
|
319
|
-
function Nt(t = Date.now()) {
|
|
320
|
-
if (g === "leaving") return !1;
|
|
321
|
-
const e = t - Z();
|
|
322
|
-
return e >= 0 && e < Q && (g = "logged-out"), g === "logged-out";
|
|
323
|
-
}
|
|
324
|
-
function It() {
|
|
325
|
-
return g === "logged-out";
|
|
326
|
-
}
|
|
327
|
-
function At() {
|
|
328
|
-
g === "logged-out" && (g = null);
|
|
329
|
-
}
|
|
330
|
-
function Ct() {
|
|
331
|
-
g = null, tt();
|
|
332
|
-
}
|
|
333
|
-
export {
|
|
334
|
-
ht as A,
|
|
335
|
-
o as B,
|
|
336
|
-
F as C,
|
|
337
|
-
yt as D,
|
|
338
|
-
p as E,
|
|
339
|
-
Pt as a,
|
|
340
|
-
wt as b,
|
|
341
|
-
at as c,
|
|
342
|
-
It as d,
|
|
343
|
-
Ct as e,
|
|
344
|
-
it as f,
|
|
345
|
-
J as g,
|
|
346
|
-
lt as h,
|
|
347
|
-
Et as i,
|
|
348
|
-
mt as j,
|
|
349
|
-
gt as k,
|
|
350
|
-
$t as l,
|
|
351
|
-
pt as m,
|
|
352
|
-
Nt as n,
|
|
353
|
-
ft as o,
|
|
354
|
-
ct as p,
|
|
355
|
-
ut as q,
|
|
356
|
-
At as r,
|
|
357
|
-
dt as s,
|
|
358
|
-
bt as t,
|
|
359
|
-
St as u,
|
|
360
|
-
st as v,
|
|
361
|
-
tt as w,
|
|
362
|
-
ot as x,
|
|
363
|
-
f as y,
|
|
364
|
-
u as z
|
|
365
|
-
};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { jsxs as _, jsx as e, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { Button as b, Typography as p } from "@douyinfe/semi-ui";
|
|
3
|
-
import { IconClose as P } from "@douyinfe/semi-icons";
|
|
4
|
-
import { useNavigate as I } from "react-router";
|
|
5
|
-
import { b as O } from "./context-CaVim6ZO.js";
|
|
6
|
-
import { F as f, e as g } from "./page-YBG0dEN1.js";
|
|
7
|
-
import { useId as z, cloneElement as B, forwardRef as E } from "react";
|
|
8
|
-
const L = "_title_euw1b_10", R = "_medium_euw1b_21", H = "_small_euw1b_26", $ = "_index_euw1b_31", M = "_hero_euw1b_43", q = "_head_euw1b_49", A = "_withSheet_euw1b_60", D = "_bar_euw1b_64", G = "_toolbar_euw1b_75", J = "_close_euw1b_82", Q = "_heroTitle_euw1b_87", U = "_description_euw1b_96", V = "_subject_euw1b_103", W = "_sheet_euw1b_110", X = "_modalContent_euw1b_118", n = {
|
|
9
|
-
title: L,
|
|
10
|
-
medium: R,
|
|
11
|
-
small: H,
|
|
12
|
-
index: $,
|
|
13
|
-
hero: M,
|
|
14
|
-
head: q,
|
|
15
|
-
withSheet: A,
|
|
16
|
-
bar: D,
|
|
17
|
-
toolbar: G,
|
|
18
|
-
close: J,
|
|
19
|
-
heroTitle: Q,
|
|
20
|
-
description: U,
|
|
21
|
-
subject: V,
|
|
22
|
-
sheet: W,
|
|
23
|
-
modalContent: X
|
|
24
|
-
}, w = (...s) => s.filter(Boolean).join(" "), Y = ({ children: s, size: t = "large", level: o = 2, className: a }) => /* @__PURE__ */ e(p.Title, { heading: o, className: w(n.title, t === "large" ? void 0 : n[t], a), children: s }), ue = ({ value: s, className: t }) => /* @__PURE__ */ e("span", { className: w(n.index, t), "aria-hidden": "true", children: String(s).padStart(2, "0") }), me = ({ title: s, description: t, toolbar: o, onClose: a, closeLabel: h = "关闭", subject: i, level: d = 2, className: u, children: r }) => {
|
|
25
|
-
const l = r != null && r !== !1;
|
|
26
|
-
return /* @__PURE__ */ _("div", { className: w(n.hero, l ? n.withSheet : void 0, u), children: [
|
|
27
|
-
/* @__PURE__ */ _("div", { className: n.head, children: [
|
|
28
|
-
o || a ? /* @__PURE__ */ _("div", { className: n.bar, children: [
|
|
29
|
-
/* @__PURE__ */ e("div", { className: n.toolbar, children: o }),
|
|
30
|
-
a ? /* @__PURE__ */ e(b, { theme: "borderless", type: "tertiary", className: n.close, icon: /* @__PURE__ */ e(P, {}), "aria-label": h, onClick: a }) : null
|
|
31
|
-
] }) : null,
|
|
32
|
-
/* @__PURE__ */ e(Y, { level: d, className: n.heroTitle, children: s }),
|
|
33
|
-
t ? /* @__PURE__ */ e(p.Paragraph, { className: n.description, children: t }) : null,
|
|
34
|
-
i ? /* @__PURE__ */ e("div", { className: n.subject, children: i }) : null
|
|
35
|
-
] }),
|
|
36
|
-
l ? /* @__PURE__ */ e("div", { className: n.sheet, children: r }) : null
|
|
37
|
-
] });
|
|
38
|
-
}, he = {
|
|
39
|
-
header: null,
|
|
40
|
-
footer: null,
|
|
41
|
-
closable: !1,
|
|
42
|
-
bodyStyle: { padding: 0 },
|
|
43
|
-
modalContentClass: n.modalContent
|
|
44
|
-
}, be = () => {
|
|
45
|
-
const { config: s } = O(), t = I();
|
|
46
|
-
return /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
47
|
-
g,
|
|
48
|
-
{
|
|
49
|
-
status: "not-found",
|
|
50
|
-
title: "页面不存在",
|
|
51
|
-
description: "请检查地址,或返回产品首页继续。",
|
|
52
|
-
extra: /* @__PURE__ */ e(b, { theme: "solid", type: "primary", onClick: () => t(s.routes.publicHome), children: "返回首页" })
|
|
53
|
-
}
|
|
54
|
-
) });
|
|
55
|
-
}, Z = "_srOnly_1mfs8_2", K = {
|
|
56
|
-
srOnly: Z
|
|
57
|
-
}, pe = ({ label: s, children: t }) => {
|
|
58
|
-
const o = z();
|
|
59
|
-
return /* @__PURE__ */ _(j, { children: [
|
|
60
|
-
/* @__PURE__ */ e("span", { id: o, className: K.srOnly, children: s }),
|
|
61
|
-
B(t, { "aria-labelledby": o })
|
|
62
|
-
] });
|
|
63
|
-
}, we = () => /* @__PURE__ */ e(f, { children: /* @__PURE__ */ e("div", { role: "alert", children: /* @__PURE__ */ e(
|
|
64
|
-
g,
|
|
65
|
-
{
|
|
66
|
-
status: "error",
|
|
67
|
-
title: "应用配置暂时无法加载",
|
|
68
|
-
description: "启动检查未通过。请检查运行时配置和网络连接后重新加载。",
|
|
69
|
-
extra: /* @__PURE__ */ e(b, { theme: "solid", type: "primary", onClick: () => window.location.reload(), children: "重新加载" })
|
|
70
|
-
}
|
|
71
|
-
) }) }), ee = "_link_1mzr6_2", te = "_danger_1mzr6_28", ne = "_warning_1mzr6_33", se = "_icon_1mzr6_38", m = {
|
|
72
|
-
link: ee,
|
|
73
|
-
danger: te,
|
|
74
|
-
warning: ne,
|
|
75
|
-
icon: se
|
|
76
|
-
}, fe = E(function({ href: t, target: o, rel: a, download: h, onClick: i, onKeyDown: d, icon: u, status: r, disabled: l = !1, className: y, style: N, role: x, tabIndex: v, children: k, ...S }, T) {
|
|
77
|
-
const C = [m.link, r === "danger" ? m.danger : r === "warning" ? m.warning : "", y ?? ""].filter(Boolean).join(" "), F = {
|
|
78
|
-
...S,
|
|
79
|
-
ref: T,
|
|
80
|
-
href: t,
|
|
81
|
-
target: o,
|
|
82
|
-
rel: o === "_blank" ? a ?? "noreferrer" : a,
|
|
83
|
-
download: h,
|
|
84
|
-
onClick: l ? void 0 : i,
|
|
85
|
-
onKeyDown: (c) => {
|
|
86
|
-
d == null || d(c), !(c.defaultPrevented || t || l || !i) && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), i(c));
|
|
87
|
-
},
|
|
88
|
-
role: x ?? (t ? void 0 : "button"),
|
|
89
|
-
tabIndex: v ?? (t || l ? void 0 : 0),
|
|
90
|
-
"aria-disabled": l || void 0
|
|
91
|
-
};
|
|
92
|
-
return /* @__PURE__ */ _(p.Text, { link: F, disabled: l, className: C, style: N, children: [
|
|
93
|
-
u ? /* @__PURE__ */ e("span", { className: m.icon, children: u }) : null,
|
|
94
|
-
k
|
|
95
|
-
] });
|
|
96
|
-
});
|
|
97
|
-
export {
|
|
98
|
-
me as F,
|
|
99
|
-
be as N,
|
|
100
|
-
pe as S,
|
|
101
|
-
fe as T,
|
|
102
|
-
ue as a,
|
|
103
|
-
Y as b,
|
|
104
|
-
we as c,
|
|
105
|
-
he as f
|
|
106
|
-
};
|