@24city/web-console 0.3.12 → 0.3.13
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 +17 -0
- package/README.md +13 -1
- package/dist/account/account-api.d.ts +22 -1
- package/dist/account/index.js +76 -72
- package/dist/account/use-track.d.ts +32 -5
- package/dist/chunks/{auth-provider-Cwib6lRM.js → auth-provider-DAxku5aX.js} +1 -1
- package/dist/chunks/{console-layout-BhmLHO5v.js → console-layout-aa4l4x0s.js} +20 -20
- package/dist/chunks/{logout-signal-qvHorCCF.js → logout-signal-XyvlxcEc.js} +166 -163
- package/dist/chunks/{stale-build-CJ5c5sRp.js → stale-build-4Zf1W-0Q.js} +2 -2
- package/dist/chunks/{use-show-once-Cwj5z_Lo.js → use-show-once-DQHhTzlT.js} +140 -140
- package/dist/chunks/wallet-badge-DIJeoyjn.js +700 -0
- package/dist/index.js +198 -194
- package/dist/layout/index.js +1 -1
- package/dist/runtime/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/wallet-badge-DnWl21es.js +0 -629
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { sanitizeInternalReturnPath as A } from "@24city/web-runtime/core/internal-path";
|
|
2
2
|
import { createContext as x, useSyncExternalStore as F, useContext as z } from "react";
|
|
3
3
|
import { summarizeCustomerError as O } from "@24city/web-runtime/error-summary";
|
|
4
|
-
const
|
|
4
|
+
const T = (t) => t.includes("\\") || [...t].some((e) => {
|
|
5
5
|
const s = e.charCodeAt(0);
|
|
6
6
|
return s <= 31 || s === 127;
|
|
7
|
-
}),
|
|
7
|
+
}), ut = (t) => !T(t) && t.startsWith("/") && !t.startsWith("//") && (() => {
|
|
8
8
|
try {
|
|
9
9
|
const e = new URL(t, "https://product.invalid");
|
|
10
10
|
return e.origin === "https://product.invalid" && A(t, e.pathname) === t;
|
|
11
11
|
} catch {
|
|
12
12
|
return !1;
|
|
13
13
|
}
|
|
14
|
-
})(),
|
|
14
|
+
})(), lt = (t, e) => !T(t) && A(t, e) === t, M = (t, e) => !t || T(t) ? e : A(t, e), U = (t) => typeof t == "object" && t !== null && !Array.isArray(t), p = (t, e) => {
|
|
15
15
|
const s = e.data;
|
|
16
16
|
if (!U(s) || s.code !== 0 || !("data" in s))
|
|
17
17
|
throw new Error(`接口 ${t} 返回了无效响应`);
|
|
18
18
|
return s.data;
|
|
19
|
-
},
|
|
19
|
+
}, l = (t, e, s) => {
|
|
20
20
|
if (!U(t)) throw new Error(`接口 ${e} 字段 ${s} 无效`);
|
|
21
21
|
return t;
|
|
22
|
-
},
|
|
22
|
+
}, n = (t, e, s) => {
|
|
23
23
|
const r = t[e];
|
|
24
24
|
if (typeof r != "string" || !r.trim())
|
|
25
25
|
throw new Error(`接口 ${s} 字段 ${e} 无效`);
|
|
@@ -29,7 +29,7 @@ const v = (t) => t.includes("\\") || [...t].some((e) => {
|
|
|
29
29
|
if (typeof r != "number" || !Number.isSafeInteger(r) || r < 0)
|
|
30
30
|
throw new Error(`接口 ${s} 字段 ${e} 无效`);
|
|
31
31
|
return r;
|
|
32
|
-
},
|
|
32
|
+
}, m = "/account", u = `${m}/session`, $ = `${m}/logout`, i = `${m}/spaces`, C = `${i}/switch`, E = `${m}/profile`, h = `${m}/wallet`, P = `${m}/entitlements`, f = `${m}/subscription`, a = `${m}/plans`, b = `${m}/shown-prompts`, W = `${m}/events`, k = `${m}/visits`, q = /^[a-z][a-z0-9_]{0,31}$/, I = (t, e, s) => {
|
|
33
33
|
const r = t[e];
|
|
34
34
|
if (r !== null && typeof r != "string")
|
|
35
35
|
throw new Error(`接口 ${s} 字段 ${e} 无效`);
|
|
@@ -41,11 +41,11 @@ const v = (t) => t.includes("\\") || [...t].some((e) => {
|
|
|
41
41
|
throw new Error(`接口 ${s} 字段 ${e} 无效`);
|
|
42
42
|
return r;
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, V = (t, e, s) => {
|
|
45
45
|
const r = t[e];
|
|
46
|
-
return r === null ? {} :
|
|
47
|
-
},
|
|
48
|
-
const e =
|
|
46
|
+
return r === null ? {} : l(r, s, e);
|
|
47
|
+
}, B = (t) => {
|
|
48
|
+
const e = l(t, $, "data"), s = S(e, "endSessionUrl", $);
|
|
49
49
|
if (!s) return null;
|
|
50
50
|
try {
|
|
51
51
|
return new URL(s).protocol === "https:" ? s : null;
|
|
@@ -53,75 +53,75 @@ const v = (t) => t.includes("\\") || [...t].some((e) => {
|
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
55
|
}, D = (t) => {
|
|
56
|
-
const e =
|
|
56
|
+
const e = l(t, u, "data");
|
|
57
57
|
if (e.purpose !== "user") throw new Error("产品用户 Web 只接受 user Purpose 会话");
|
|
58
58
|
return {
|
|
59
|
-
globalUserId:
|
|
60
|
-
localUserId: g(e, "localUserId",
|
|
61
|
-
activeSpaceId:
|
|
62
|
-
authorityId: g(e, "authorityId",
|
|
63
|
-
orgId: g(e, "orgId",
|
|
59
|
+
globalUserId: n(e, "globalUserId", u),
|
|
60
|
+
localUserId: g(e, "localUserId", u),
|
|
61
|
+
activeSpaceId: n(e, "activeSpaceId", u),
|
|
62
|
+
authorityId: g(e, "authorityId", u),
|
|
63
|
+
orgId: g(e, "orgId", u),
|
|
64
64
|
purpose: "user",
|
|
65
|
-
csrfToken:
|
|
66
|
-
issuedAt:
|
|
67
|
-
lastSeenAt:
|
|
68
|
-
absoluteExpiresAt:
|
|
69
|
-
lastCentralVerifiedAt:
|
|
70
|
-
accountCenterUrl:
|
|
65
|
+
csrfToken: n(e, "csrfToken", u),
|
|
66
|
+
issuedAt: n(e, "issuedAt", u),
|
|
67
|
+
lastSeenAt: n(e, "lastSeenAt", u),
|
|
68
|
+
absoluteExpiresAt: n(e, "absoluteExpiresAt", u),
|
|
69
|
+
lastCentralVerifiedAt: n(e, "lastCentralVerifiedAt", u),
|
|
70
|
+
accountCenterUrl: n(e, "accountCenterUrl", u)
|
|
71
71
|
};
|
|
72
|
-
},
|
|
73
|
-
const r =
|
|
72
|
+
}, _ = (t, e, s) => {
|
|
73
|
+
const r = l(t, e, s);
|
|
74
74
|
return {
|
|
75
|
-
id:
|
|
76
|
-
entitlementCode:
|
|
75
|
+
id: n(r, "id", e),
|
|
76
|
+
entitlementCode: n(r, "entitlementCode", e),
|
|
77
77
|
status: S(r, "status", e),
|
|
78
|
-
startsAt:
|
|
78
|
+
startsAt: n(r, "startsAt", e),
|
|
79
79
|
expiresAt: I(r, "expiresAt", e),
|
|
80
|
-
metadata:
|
|
80
|
+
metadata: V(r, "metadata", e)
|
|
81
81
|
};
|
|
82
|
-
},
|
|
83
|
-
const s =
|
|
84
|
-
if (!Array.isArray(
|
|
82
|
+
}, G = (t, e) => {
|
|
83
|
+
const s = l(t, i, `spaces[${e}]`), r = l(s.entitlementSummary, i, "entitlementSummary"), o = r.codes, c = s.entitlements;
|
|
84
|
+
if (!Array.isArray(o) || o.some((y) => typeof y != "string"))
|
|
85
85
|
throw new Error(`接口 ${i} 字段 entitlementSummary.codes 无效`);
|
|
86
|
-
if (!Array.isArray(
|
|
86
|
+
if (!Array.isArray(c))
|
|
87
87
|
throw new Error(`接口 ${i} 字段 entitlements 无效`);
|
|
88
88
|
return {
|
|
89
|
-
id:
|
|
90
|
-
name:
|
|
91
|
-
slug:
|
|
92
|
-
type:
|
|
93
|
-
role:
|
|
94
|
-
status:
|
|
95
|
-
membershipStatus:
|
|
89
|
+
id: n(s, "id", i),
|
|
90
|
+
name: n(s, "name", i),
|
|
91
|
+
slug: n(s, "slug", i),
|
|
92
|
+
type: n(s, "type", i),
|
|
93
|
+
role: n(s, "role", i),
|
|
94
|
+
status: n(s, "status", i),
|
|
95
|
+
membershipStatus: n(s, "membershipStatus", i),
|
|
96
96
|
entitlementSummary: {
|
|
97
97
|
activeCount: g(r, "activeCount", i),
|
|
98
|
-
codes: [...
|
|
98
|
+
codes: [...o]
|
|
99
99
|
},
|
|
100
|
-
entitlements:
|
|
101
|
-
(
|
|
100
|
+
entitlements: c.map(
|
|
101
|
+
(y, d) => _(y, i, `entitlements[${d}]`)
|
|
102
102
|
)
|
|
103
103
|
};
|
|
104
|
-
},
|
|
105
|
-
const e =
|
|
104
|
+
}, H = (t) => {
|
|
105
|
+
const e = l(t, i, "data"), s = n(e, "activeSpaceId", i);
|
|
106
106
|
if (!Array.isArray(e.spaces)) throw new Error(`接口 ${i} 字段 spaces 无效`);
|
|
107
|
-
const r = e.spaces.map(
|
|
108
|
-
if (!r.some((
|
|
107
|
+
const r = e.spaces.map(G);
|
|
108
|
+
if (!r.some((o) => o.id === s))
|
|
109
109
|
throw new Error(`接口 ${i} 的当前空间不在可用空间列表中`);
|
|
110
110
|
return { activeSpaceId: s, spaces: r };
|
|
111
|
-
}, H = (t) => {
|
|
112
|
-
const e = u(t, $, "data");
|
|
113
|
-
return { nickName: (S(e, "nickName", $) ?? "").trim() };
|
|
114
111
|
}, j = (t) => {
|
|
115
|
-
const e =
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
const e = l(t, E, "data");
|
|
113
|
+
return { nickName: (S(e, "nickName", E) ?? "").trim() };
|
|
114
|
+
}, K = (t) => {
|
|
115
|
+
const e = l(t, h, "data"), s = (r) => {
|
|
116
|
+
const o = e[r];
|
|
117
|
+
if (typeof o != "number" || !Number.isSafeInteger(o))
|
|
118
118
|
throw new Error(`接口 ${h} 字段 ${r} 无效`);
|
|
119
|
-
return
|
|
119
|
+
return o;
|
|
120
120
|
};
|
|
121
121
|
return {
|
|
122
|
-
spaceId:
|
|
123
|
-
globalUserId:
|
|
124
|
-
productCode:
|
|
122
|
+
spaceId: n(e, "spaceId", h),
|
|
123
|
+
globalUserId: n(e, "globalUserId", h),
|
|
124
|
+
productCode: n(e, "productCode", h),
|
|
125
125
|
availablePoints: s("availablePoints"),
|
|
126
126
|
reservedPoints: s("reservedPoints"),
|
|
127
127
|
globalAvailablePoints: s("globalAvailablePoints"),
|
|
@@ -132,152 +132,155 @@ const v = (t) => t.includes("\\") || [...t].some((e) => {
|
|
|
132
132
|
walletReservedPoints: s("walletReservedPoints"),
|
|
133
133
|
walletVersion: g(e, "walletVersion", h)
|
|
134
134
|
};
|
|
135
|
-
},
|
|
135
|
+
}, Y = (t) => {
|
|
136
136
|
if (t === null) return null;
|
|
137
|
-
const e =
|
|
137
|
+
const e = l(t, f, "data"), s = e.tier;
|
|
138
138
|
if (typeof s != "number" || !Number.isSafeInteger(s))
|
|
139
139
|
throw new Error(`接口 ${f} 字段 tier 无效`);
|
|
140
140
|
if (typeof e.isDefault != "boolean")
|
|
141
141
|
throw new Error(`接口 ${f} 字段 isDefault 无效`);
|
|
142
142
|
return {
|
|
143
143
|
subscriptionId: I(e, "subscriptionId", f),
|
|
144
|
-
planCode:
|
|
144
|
+
planCode: n(e, "planCode", f),
|
|
145
145
|
planName: (S(e, "planName", f) ?? "").trim(),
|
|
146
146
|
tier: s,
|
|
147
147
|
isDefault: e.isDefault,
|
|
148
148
|
spaceType: S(e, "spaceType", f) ?? "",
|
|
149
149
|
currentPeriodEnd: I(e, "currentPeriodEnd", f)
|
|
150
150
|
};
|
|
151
|
-
},
|
|
152
|
-
const s =
|
|
153
|
-
if (!
|
|
151
|
+
}, X = /* @__PURE__ */ new Set(["month", "year", "one_time"]), J = (t, e) => {
|
|
152
|
+
const s = l(t, a, e), r = n(s, "billingPeriod", a);
|
|
153
|
+
if (!X.has(r)) throw new Error(`接口 ${a} 字段 ${e}.billingPeriod 无效`);
|
|
154
154
|
return {
|
|
155
|
-
code:
|
|
155
|
+
code: n(s, "code", a),
|
|
156
156
|
amountCents: g(s, "amountCents", a),
|
|
157
|
-
currency:
|
|
157
|
+
currency: n(s, "currency", a),
|
|
158
158
|
billingPeriod: r,
|
|
159
159
|
durationDays: g(s, "durationDays", a),
|
|
160
160
|
pointCycles: g(s, "pointCycles", a)
|
|
161
161
|
};
|
|
162
|
-
},
|
|
163
|
-
const s =
|
|
162
|
+
}, Q = (t, e) => {
|
|
163
|
+
const s = l(t, a, e), r = s.limit;
|
|
164
164
|
if (r != null && (typeof r != "number" || !Number.isSafeInteger(r) || r < 0))
|
|
165
165
|
throw new Error(`接口 ${a} 字段 ${e}.limit 无效`);
|
|
166
|
-
const
|
|
166
|
+
const o = Array.isArray(s.discounts) ? s.discounts.filter((c) => typeof c == "string") : [];
|
|
167
167
|
return {
|
|
168
168
|
key: S(s, "key", a) ?? "",
|
|
169
|
-
name:
|
|
169
|
+
name: n(s, "name", a),
|
|
170
170
|
description: S(s, "description", a) ?? "",
|
|
171
171
|
limit: typeof r == "number" ? r : null,
|
|
172
|
-
discounts:
|
|
172
|
+
discounts: o
|
|
173
173
|
};
|
|
174
|
-
},
|
|
175
|
-
const s = `data[${e}]`, r =
|
|
176
|
-
if (
|
|
174
|
+
}, Z = (t, e) => {
|
|
175
|
+
const s = `data[${e}]`, r = l(t, a, s), o = n(r, "spaceType", a);
|
|
176
|
+
if (o !== "personal" && o !== "team") throw new Error(`接口 ${a} 字段 ${s}.spaceType 无效`);
|
|
177
177
|
if (typeof r.tier != "number" || !Number.isSafeInteger(r.tier)) throw new Error(`接口 ${a} 字段 ${s}.tier 无效`);
|
|
178
178
|
if (typeof r.isDefault != "boolean") throw new Error(`接口 ${a} 字段 ${s}.isDefault 无效`);
|
|
179
179
|
if (!Array.isArray(r.prices)) throw new Error(`接口 ${a} 字段 ${s}.prices 无效`);
|
|
180
|
-
const
|
|
180
|
+
const c = Array.isArray(r.benefits) ? r.benefits : [], y = Array.isArray(r.otherProducts) ? r.otherProducts.filter((d) => typeof d == "string" && d.trim() !== "").map((d) => d.trim()) : [];
|
|
181
181
|
return {
|
|
182
|
-
code:
|
|
183
|
-
name:
|
|
184
|
-
spaceType:
|
|
182
|
+
code: n(r, "code", a),
|
|
183
|
+
name: n(r, "name", a).trim(),
|
|
184
|
+
spaceType: o,
|
|
185
185
|
tier: r.tier,
|
|
186
186
|
isDefault: r.isDefault,
|
|
187
187
|
includedSeats: g(r, "includedSeats", a),
|
|
188
188
|
monthlyPoints: g(r, "monthlyPoints", a),
|
|
189
|
-
prices: r.prices.map((
|
|
190
|
-
benefits:
|
|
191
|
-
otherProducts:
|
|
189
|
+
prices: r.prices.map((d, N) => J(d, `${s}.prices[${N}]`)),
|
|
190
|
+
benefits: c.map((d, N) => Q(d, `${s}.benefits[${N}]`)),
|
|
191
|
+
otherProducts: y
|
|
192
192
|
};
|
|
193
193
|
}, L = (t, e) => {
|
|
194
|
-
const s =
|
|
194
|
+
const s = l(t, b, "data")[e];
|
|
195
195
|
if (!Array.isArray(s) || s.some((r) => typeof r != "string"))
|
|
196
|
-
throw new Error(`接口 ${
|
|
196
|
+
throw new Error(`接口 ${b} 字段 ${e} 无效`);
|
|
197
197
|
return [...s];
|
|
198
|
-
},
|
|
198
|
+
}, tt = (t) => {
|
|
199
199
|
if (!Array.isArray(t)) throw new Error(`接口 ${a} 字段 data 无效`);
|
|
200
|
-
return t.map(
|
|
201
|
-
},
|
|
200
|
+
return t.map(Z);
|
|
201
|
+
}, dt = (t, e) => {
|
|
202
202
|
const s = e === "/" ? "" : e;
|
|
203
203
|
return {
|
|
204
204
|
async reportBehaviorEvents(r) {
|
|
205
205
|
r.length !== 0 && await t.post(W, { events: r });
|
|
206
206
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
async reportVisits(r) {
|
|
208
|
+
r.length !== 0 && await t.post(k, { pageViews: r });
|
|
209
|
+
},
|
|
210
|
+
startLogin(r, o, c) {
|
|
211
|
+
const y = M(r, o), d = c != null && c.entry && q.test(c.entry) ? `&entry=${c.entry}` : "";
|
|
212
|
+
return `${s}${m}/startLogin?returnPath=${encodeURIComponent(y)}${d}`;
|
|
210
213
|
},
|
|
211
214
|
async getSession() {
|
|
212
|
-
return D(
|
|
215
|
+
return D(p(u, await t.get(u)));
|
|
213
216
|
},
|
|
214
217
|
async getSpaces() {
|
|
215
|
-
return
|
|
218
|
+
return H(p(i, await t.get(i)));
|
|
216
219
|
},
|
|
217
220
|
async switchSpace(r) {
|
|
218
|
-
const
|
|
219
|
-
return D(
|
|
221
|
+
const o = p(C, await t.post(C, { globalSpaceId: r }));
|
|
222
|
+
return D(o);
|
|
220
223
|
},
|
|
221
224
|
async getProfile() {
|
|
222
|
-
return
|
|
225
|
+
return j(p(E, await t.get(E)));
|
|
223
226
|
},
|
|
224
227
|
async getWallet() {
|
|
225
|
-
return
|
|
228
|
+
return K(p(h, await t.get(h)));
|
|
226
229
|
},
|
|
227
230
|
async getEntitlements() {
|
|
228
|
-
const r =
|
|
231
|
+
const r = p(P, await t.get(P));
|
|
229
232
|
if (!Array.isArray(r)) throw new Error(`接口 ${P} 字段 data 无效`);
|
|
230
|
-
return r.map((
|
|
233
|
+
return r.map((o, c) => _(o, P, `entitlements[${c}]`));
|
|
231
234
|
},
|
|
232
235
|
async getSubscription() {
|
|
233
|
-
return
|
|
236
|
+
return Y(p(f, await t.get(f)));
|
|
234
237
|
},
|
|
235
238
|
async getPlans() {
|
|
236
|
-
return
|
|
239
|
+
return tt(p(a, await t.get(a)));
|
|
237
240
|
},
|
|
238
241
|
async logout() {
|
|
239
|
-
const r =
|
|
240
|
-
return { endSessionUrl:
|
|
242
|
+
const r = p($, await t.post($));
|
|
243
|
+
return { endSessionUrl: B(r) };
|
|
241
244
|
},
|
|
242
245
|
async getShownPrompts(r) {
|
|
243
|
-
const
|
|
244
|
-
return L(
|
|
246
|
+
const o = await t.get(b, { params: { keys: r.join(",") } });
|
|
247
|
+
return L(p(b, o), "shown");
|
|
245
248
|
},
|
|
246
249
|
async claimShownPrompts(r) {
|
|
247
|
-
const
|
|
248
|
-
return L(
|
|
250
|
+
const o = await t.post(b, { keys: [...r] });
|
|
251
|
+
return L(p(b, o), "claimed");
|
|
249
252
|
}
|
|
250
253
|
};
|
|
251
|
-
},
|
|
254
|
+
}, mt = async (t) => {
|
|
252
255
|
let e = await t.getSession();
|
|
253
256
|
const s = await t.getSpaces();
|
|
254
257
|
if (s.activeSpaceId !== e.activeSpaceId && (e = await t.getSession()), s.activeSpaceId !== e.activeSpaceId)
|
|
255
258
|
throw new Error("产品会话与统一空间上下文不一致");
|
|
256
259
|
return { session: e, spaces: s.spaces };
|
|
257
|
-
},
|
|
260
|
+
}, pt = (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"), ft = (t) => t.toLocaleString("zh-CN", { maximumFractionDigits: 0 }), gt = (t) => t > 0 && t < 0.01 ? "<0.01" : t.toLocaleString("zh-CN", { maximumFractionDigits: 2 }), wt = (t) => t ? `¥${(t / 100).toLocaleString("zh-CN", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : "暂无", ht = (t) => {
|
|
258
261
|
if (t === void 0 || t <= 0) return "";
|
|
259
262
|
const e = Math.floor(t / 60), s = Math.floor(t % 60);
|
|
260
263
|
return `${e}:${String(s).padStart(2, "0")}`;
|
|
261
|
-
},
|
|
264
|
+
}, yt = (t) => {
|
|
262
265
|
if (t === void 0 || t <= 0) return "暂无";
|
|
263
266
|
const e = Math.floor(t / 3600), s = Math.floor(t % 3600 / 60), r = t % 60;
|
|
264
267
|
return e > 0 ? `${e}小时${s}分` : s > 0 ? `${s}分${r}秒` : `${r}秒`;
|
|
265
|
-
},
|
|
268
|
+
}, St = (t) => {
|
|
266
269
|
const e = new Date(t);
|
|
267
270
|
return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "short", timeStyle: "short" }).format(e);
|
|
268
|
-
},
|
|
271
|
+
}, bt = (t) => {
|
|
269
272
|
if (!t) return "长期有效";
|
|
270
273
|
const e = new Date(t);
|
|
271
274
|
return Number.isNaN(e.getTime()) ? "暂无" : new Intl.DateTimeFormat("zh-CN", { dateStyle: "medium" }).format(e);
|
|
272
|
-
},
|
|
275
|
+
}, et = () => ({
|
|
273
276
|
session: null,
|
|
274
277
|
spaces: [],
|
|
275
278
|
bootstrapped: !1,
|
|
276
279
|
serviceUnavailable: !1
|
|
277
|
-
}),
|
|
278
|
-
let t =
|
|
280
|
+
}), Pt = () => {
|
|
281
|
+
let t = et();
|
|
279
282
|
const e = /* @__PURE__ */ new Set(), s = (r) => {
|
|
280
|
-
t = r, e.forEach((
|
|
283
|
+
t = r, e.forEach((o) => o());
|
|
281
284
|
};
|
|
282
285
|
return {
|
|
283
286
|
subscribe(r) {
|
|
@@ -298,88 +301,88 @@ const v = (t) => t.includes("\\") || [...t].some((e) => {
|
|
|
298
301
|
s({ session: null, spaces: [], bootstrapped: !0, serviceUnavailable: r.unavailable ?? !1 });
|
|
299
302
|
}
|
|
300
303
|
};
|
|
301
|
-
},
|
|
302
|
-
const t = z(
|
|
304
|
+
}, R = x(null), $t = R.Provider, rt = () => {
|
|
305
|
+
const t = z(R);
|
|
303
306
|
if (!t) throw new Error("AuthStoreProvider 尚未初始化");
|
|
304
307
|
return t;
|
|
305
|
-
},
|
|
306
|
-
const t =
|
|
308
|
+
}, Et = () => {
|
|
309
|
+
const t = rt();
|
|
307
310
|
return F(t.subscribe, t.getState, t.getState);
|
|
308
|
-
},
|
|
311
|
+
}, Nt = (t) => t instanceof Error && t.message.trim() ? t.message : "请稍后重试;如问题持续,请联系管理员。", It = (t, e) => O(t).status === e, At = (t) => {
|
|
309
312
|
const { category: e, status: s } = O(t);
|
|
310
313
|
return e === "network" || e === "timeout" || s === 502 || s === 503 || s === 504;
|
|
311
|
-
},
|
|
314
|
+
}, v = "24city.console.logout-at", st = 15e3;
|
|
312
315
|
let w = null;
|
|
313
|
-
const
|
|
316
|
+
const nt = () => {
|
|
314
317
|
try {
|
|
315
|
-
return Number(window.localStorage.getItem(
|
|
318
|
+
return Number(window.localStorage.getItem(v) ?? Number.NaN);
|
|
316
319
|
} catch {
|
|
317
320
|
return Number.NaN;
|
|
318
321
|
}
|
|
319
322
|
};
|
|
320
|
-
function
|
|
323
|
+
function Tt(t = Date.now()) {
|
|
321
324
|
try {
|
|
322
|
-
window.localStorage.setItem(
|
|
325
|
+
window.localStorage.setItem(v, String(t));
|
|
323
326
|
} catch {
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
|
-
function
|
|
329
|
+
function ot() {
|
|
327
330
|
try {
|
|
328
|
-
window.localStorage.removeItem(
|
|
331
|
+
window.localStorage.removeItem(v);
|
|
329
332
|
} catch {
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
|
-
function
|
|
335
|
+
function vt() {
|
|
333
336
|
w = "leaving";
|
|
334
337
|
}
|
|
335
|
-
function
|
|
338
|
+
function Ct() {
|
|
336
339
|
return w === "leaving";
|
|
337
340
|
}
|
|
338
|
-
function
|
|
341
|
+
function Dt(t = Date.now()) {
|
|
339
342
|
if (w === "leaving") return !1;
|
|
340
|
-
const e = t -
|
|
341
|
-
return e >= 0 && e <
|
|
343
|
+
const e = t - nt();
|
|
344
|
+
return e >= 0 && e < st && (w = "logged-out"), w === "logged-out";
|
|
342
345
|
}
|
|
343
|
-
function
|
|
346
|
+
function Lt() {
|
|
344
347
|
return w === "logged-out";
|
|
345
348
|
}
|
|
346
|
-
function
|
|
349
|
+
function Ot() {
|
|
347
350
|
w === "logged-out" && (w = null);
|
|
348
351
|
}
|
|
349
|
-
function
|
|
350
|
-
w = null,
|
|
352
|
+
function Ut() {
|
|
353
|
+
w = null, ot();
|
|
351
354
|
}
|
|
352
355
|
export {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
+
$t as A,
|
|
357
|
+
l as B,
|
|
358
|
+
n as C,
|
|
356
359
|
M as D,
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
360
|
+
Nt as E,
|
|
361
|
+
p as F,
|
|
362
|
+
Tt as a,
|
|
363
|
+
Pt as b,
|
|
364
|
+
dt as c,
|
|
365
|
+
Lt as d,
|
|
366
|
+
Ut as e,
|
|
367
|
+
mt as f,
|
|
368
|
+
rt as g,
|
|
369
|
+
gt as h,
|
|
370
|
+
Ct as i,
|
|
371
|
+
ht as j,
|
|
372
|
+
bt as k,
|
|
373
|
+
vt as l,
|
|
374
|
+
St as m,
|
|
375
|
+
Dt as n,
|
|
376
|
+
yt as o,
|
|
377
|
+
pt as p,
|
|
378
|
+
ft as q,
|
|
379
|
+
Ot as r,
|
|
380
|
+
wt as s,
|
|
381
|
+
It as t,
|
|
382
|
+
Et as u,
|
|
383
|
+
lt as v,
|
|
384
|
+
ot as w,
|
|
385
|
+
ut as x,
|
|
386
|
+
At as y,
|
|
384
387
|
g as z
|
|
385
388
|
};
|
|
@@ -2,8 +2,8 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import { QueryClient as c, QueryClientProvider as l } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo as i } from "react";
|
|
4
4
|
import { CustomerRuntimeConfigProvider as f } from "@24city/web-runtime/runtime-config-provider";
|
|
5
|
-
import { A as d } from "./auth-provider-
|
|
6
|
-
import { b as m, A as p } from "./logout-signal-
|
|
5
|
+
import { A as d } from "./auth-provider-DAxku5aX.js";
|
|
6
|
+
import { b as m, A as p } from "./logout-signal-XyvlxcEc.js";
|
|
7
7
|
import { U as C, E as y } from "./unsupported-browser-Dwq1mNRy.js";
|
|
8
8
|
import { C as h } from "./context-CaVim6ZO.js";
|
|
9
9
|
import { parseCustomerRuntimeConfig as R, loadCustomerRuntimeConfig as v } from "@24city/web-runtime/core/runtime-config";
|