@declarion/react 0.109.0 → 0.110.0
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-lib/api/agents.js +2 -1
- package/dist-lib/api/audience.js +12 -0
- package/dist-lib/api/auth.js +1 -1
- package/dist-lib/api/client.js +100 -91
- package/dist-lib/api/schema.js +31 -31
- package/dist-lib/components/agents/ChatAttachments.js +20 -10
- package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
- package/dist-lib/components/file-widgets/FileList.js +1 -1
- package/dist-lib/components/file-widgets/Grid.js +1 -1
- package/dist-lib/components/file-widgets/upload.js +64 -61
- package/dist-lib/hooks/useAgentConversation.js +112 -104
- package/dist-lib/hooks/useAuth.js +4 -1
- package/dist-lib/hooks/useSchema.js +21 -29
- package/dist-lib/index.d.ts +3 -3
- package/dist-lib/stores/auth.js +35 -35
- package/dist-lib/test/seed-schema.js +4 -3
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-DODbtSrY.d.ts → useResponsiveMode-C4MeAgoS.d.ts} +0 -1
- package/package.json +1 -1
package/dist-lib/api/agents.js
CHANGED
|
@@ -10,10 +10,11 @@ async function r(t) {
|
|
|
10
10
|
status: "active"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
async function i(t, n, r, i) {
|
|
13
|
+
async function i(t, n, r, i, a) {
|
|
14
14
|
return {
|
|
15
15
|
id: (await e("agents.send_message", {
|
|
16
16
|
conversation_id: n,
|
|
17
|
+
idempotency_key: a,
|
|
17
18
|
...t ? { text: t } : {},
|
|
18
19
|
...i?.length ? { attachments: i } : {},
|
|
19
20
|
...r ? { context: r } : {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/api/audience.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e.isLoading) return !e.isAuthenticated || !e.user ? null : {
|
|
4
|
+
user_id: e.user.id,
|
|
5
|
+
tenant_id: e.activeTenant?.id ?? ""
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function t(e, t) {
|
|
9
|
+
return e === t || e !== null && t !== null && e.user_id === t.user_id && e.tenant_id === t.tenant_id;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as sameAudience, e as sessionCaller };
|
package/dist-lib/api/auth.js
CHANGED
|
@@ -43,7 +43,7 @@ async function u(n) {
|
|
|
43
43
|
return t(r.expires_at), r;
|
|
44
44
|
}
|
|
45
45
|
async function d() {
|
|
46
|
-
await e("auth.logout");
|
|
46
|
+
await e("auth.logout", {}, { keepalive: !0 });
|
|
47
47
|
}
|
|
48
48
|
async function f(t) {
|
|
49
49
|
return (await e("auth.list_identity_providers", t ? { tenant_code: t } : {})).providers;
|
package/dist-lib/api/client.js
CHANGED
|
@@ -4,9 +4,10 @@ import { awaitEmbedToken as a, clearEmbedToken as o, getEmbedToken as s, isEmbed
|
|
|
4
4
|
import { observe as l } from "../lib/versionTracker.js";
|
|
5
5
|
import { REFRESH_TIMEOUT_MS as u, requestTimeoutMs as d } from "./request-bounds.js";
|
|
6
6
|
import { clearAccessExpiry as f, recordAccessExpiry as p } from "./access-expiry.js";
|
|
7
|
+
import { sameAudience as m } from "./audience.js";
|
|
7
8
|
//#region src/api/client.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
9
|
+
var h = (e) => JSON.stringify(e ?? {}), g = null, _ = "declarion.auth.refresh.result", v = "declarion.auth.refresh";
|
|
10
|
+
function y(e = () => window.localStorage.getItem(_)) {
|
|
10
11
|
try {
|
|
11
12
|
let t = JSON.parse(e() ?? "null");
|
|
12
13
|
return typeof t?.ok == "boolean" && typeof t.updated_at == "number" ? t : null;
|
|
@@ -14,9 +15,9 @@ function v(e = () => window.localStorage.getItem(g)) {
|
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function b(e) {
|
|
18
19
|
try {
|
|
19
|
-
window.localStorage.setItem(
|
|
20
|
+
window.localStorage.setItem(_, JSON.stringify({
|
|
20
21
|
updated_at: Date.now(),
|
|
21
22
|
...e
|
|
22
23
|
}));
|
|
@@ -24,57 +25,57 @@ function y(e) {
|
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return e.ok ? (e.access_expires_at &&
|
|
28
|
+
function x(e) {
|
|
29
|
+
return e.ok ? (e.access_expires_at && E(e.access_expires_at), null) : new C(e.status ?? 401);
|
|
29
30
|
}
|
|
30
|
-
async function
|
|
31
|
+
async function S() {
|
|
31
32
|
let e = navigator.locks;
|
|
32
33
|
if (!e) {
|
|
33
|
-
await
|
|
34
|
+
await j();
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
let t = Date.now();
|
|
37
|
-
await e.request(
|
|
38
|
-
let e =
|
|
38
|
+
await e.request(v, { mode: "exclusive" }, async () => {
|
|
39
|
+
let e = y();
|
|
39
40
|
if (e && e.updated_at >= t) {
|
|
40
|
-
let t =
|
|
41
|
+
let t = x(e);
|
|
41
42
|
if (t) throw t;
|
|
42
43
|
} else try {
|
|
43
|
-
|
|
44
|
+
b({
|
|
44
45
|
ok: !0,
|
|
45
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await j()
|
|
46
47
|
});
|
|
47
48
|
} catch (e) {
|
|
48
|
-
throw e instanceof
|
|
49
|
+
throw e instanceof C && b({
|
|
49
50
|
ok: !1,
|
|
50
51
|
status: e.status
|
|
51
52
|
}), e;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
var
|
|
56
|
+
var C = class extends Error {
|
|
56
57
|
status;
|
|
57
58
|
constructor(e) {
|
|
58
59
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
59
60
|
}
|
|
60
|
-
},
|
|
61
|
-
function
|
|
62
|
-
return
|
|
63
|
-
throw
|
|
64
|
-
}),
|
|
61
|
+
}, w = null;
|
|
62
|
+
function T() {
|
|
63
|
+
return w ??= import("./session-renewal.js").catch((e) => {
|
|
64
|
+
throw w = null, e;
|
|
65
|
+
}), w;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
67
|
+
function E(e) {
|
|
68
|
+
return M = null, c() || p(e), typeof window > "u" ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
f(),
|
|
70
|
+
function D() {
|
|
71
|
+
f(), w?.then((e) => e.cancelRenewal());
|
|
71
72
|
}
|
|
72
73
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
73
|
-
if (e.key !==
|
|
74
|
-
let t =
|
|
75
|
-
t?.ok && t.access_expires_at &&
|
|
74
|
+
if (e.key !== _ || c()) return;
|
|
75
|
+
let t = y(() => e.newValue);
|
|
76
|
+
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
76
77
|
});
|
|
77
|
-
async function
|
|
78
|
+
async function O(e, n, r) {
|
|
78
79
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
79
80
|
try {
|
|
80
81
|
return await fetch(e, {
|
|
@@ -87,107 +88,114 @@ async function D(e, n, r) {
|
|
|
87
88
|
clearTimeout(a);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
async function
|
|
91
|
+
async function k(e) {
|
|
91
92
|
try {
|
|
92
93
|
return (await e.json())?.result?.expires_at;
|
|
93
94
|
} catch {
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
98
|
+
function A() {
|
|
99
|
+
return O("/api/actions/auth.refresh", {
|
|
99
100
|
method: "POST",
|
|
100
101
|
credentials: "include",
|
|
101
102
|
headers: { "Content-Type": "application/json" },
|
|
102
|
-
body:
|
|
103
|
+
body: h({})
|
|
103
104
|
}, u);
|
|
104
105
|
}
|
|
105
|
-
async function
|
|
106
|
-
let t = await
|
|
106
|
+
async function j() {
|
|
107
|
+
let t = await A();
|
|
107
108
|
if (t.status === 429) {
|
|
108
109
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
109
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
110
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await A();
|
|
110
111
|
}
|
|
111
112
|
if (t.status >= 500) {
|
|
112
113
|
let n = await r(t);
|
|
113
114
|
throw new e(t.status, n.body, n.raw);
|
|
114
115
|
}
|
|
115
|
-
if (!t.ok) throw await r(t), new
|
|
116
|
-
let n = await
|
|
117
|
-
return
|
|
116
|
+
if (!t.ok) throw await r(t), new C(t.status);
|
|
117
|
+
let n = await k(t);
|
|
118
|
+
return E(n), n;
|
|
118
119
|
}
|
|
119
|
-
var
|
|
120
|
-
function
|
|
120
|
+
var M = null, N = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
121
|
+
function P(n) {
|
|
121
122
|
return n instanceof t || n instanceof e;
|
|
122
123
|
}
|
|
123
|
-
async function
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
126
|
-
throw e instanceof
|
|
124
|
+
async function F() {
|
|
125
|
+
if (M !== null) throw new C(M);
|
|
126
|
+
return g || (g = S().catch((e) => {
|
|
127
|
+
throw e instanceof C && (M = e.status), e;
|
|
127
128
|
}).finally(() => {
|
|
128
|
-
|
|
129
|
-
}),
|
|
129
|
+
g = null;
|
|
130
|
+
}), g);
|
|
130
131
|
}
|
|
131
|
-
var
|
|
132
|
+
var I = () => {
|
|
132
133
|
if (typeof window > "u") return;
|
|
133
134
|
let { pathname: e } = window.location;
|
|
134
135
|
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = i());
|
|
135
136
|
};
|
|
136
|
-
function
|
|
137
|
-
let t =
|
|
138
|
-
return
|
|
137
|
+
function L(e) {
|
|
138
|
+
let t = I;
|
|
139
|
+
return I = e, t;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
141
|
+
function R() {
|
|
142
|
+
return I;
|
|
142
143
|
}
|
|
143
|
-
var
|
|
144
|
+
var z = ({ status: e, code: t, message: n }) => {
|
|
144
145
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
145
146
|
};
|
|
146
|
-
function
|
|
147
|
+
function B(e, t, n, r) {
|
|
147
148
|
let i = new Headers(e);
|
|
148
149
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
149
150
|
}
|
|
150
|
-
var
|
|
151
|
-
function
|
|
152
|
-
e
|
|
153
|
-
}
|
|
154
|
-
function U() {
|
|
155
|
-
return V;
|
|
151
|
+
var V = null, H;
|
|
152
|
+
function U(e) {
|
|
153
|
+
H = e, V && e !== void 0 && !m(V.reader, e) && (V = null);
|
|
156
154
|
}
|
|
157
155
|
function W(e, t) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
function
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
156
|
+
(H === void 0 || m(e, H)) && (V = t ? {
|
|
157
|
+
language: t,
|
|
158
|
+
reader: e
|
|
159
|
+
} : null);
|
|
160
|
+
}
|
|
161
|
+
function G(e) {
|
|
162
|
+
V = e ? {
|
|
163
|
+
language: e,
|
|
164
|
+
reader: H ?? null
|
|
165
|
+
} : null;
|
|
166
|
+
}
|
|
167
|
+
function K() {
|
|
168
|
+
return V?.language ?? null;
|
|
169
|
+
}
|
|
170
|
+
function q(e) {
|
|
171
|
+
let t = K();
|
|
172
|
+
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
173
|
+
}
|
|
174
|
+
async function J(t, i, u, f) {
|
|
175
|
+
let p = q(t), m = c(), h = m ? "omit" : "include", g = B(i.headers, !!i.body, u, m ? s() : null), _ = d(t, i), v = await O(p, {
|
|
168
176
|
...i,
|
|
169
177
|
headers: g,
|
|
170
178
|
credentials: h
|
|
171
179
|
}, _);
|
|
172
180
|
if (l(v.headers), !v.ok) {
|
|
173
181
|
let { raw: t, body: s } = await r(v), c = n(s.type), l = s.title ?? "";
|
|
174
|
-
if (v.status === 401 &&
|
|
182
|
+
if (v.status === 401 && N.has(c)) try {
|
|
175
183
|
let t = null;
|
|
176
|
-
m ? (o(), t = await a()) : await
|
|
177
|
-
let s =
|
|
184
|
+
m ? (o(), t = await a()) : await F();
|
|
185
|
+
let s = B(i.headers, !!i.body, u, t), c = await O(p, {
|
|
178
186
|
...i,
|
|
179
187
|
headers: s,
|
|
180
188
|
credentials: h
|
|
181
189
|
}, _);
|
|
182
190
|
if (!c.ok) {
|
|
183
191
|
let t = await r(c);
|
|
184
|
-
throw !m && c.status === 401 &&
|
|
192
|
+
throw !m && c.status === 401 && N.has(n(t.body.type)) && (M = 401), c.status === 401 && !u.isSessionProbe && I(), new e(c.status, t.body, t.raw);
|
|
185
193
|
}
|
|
186
194
|
return f(c);
|
|
187
195
|
} catch (n) {
|
|
188
|
-
throw
|
|
196
|
+
throw P(n) ? n : (u.isSessionProbe || I(), new e(401, s, t));
|
|
189
197
|
}
|
|
190
|
-
throw v.status === 401 && !u.isSessionProbe &&
|
|
198
|
+
throw v.status === 401 && !u.isSessionProbe && I(), z({
|
|
191
199
|
status: v.status,
|
|
192
200
|
code: c,
|
|
193
201
|
message: l
|
|
@@ -195,29 +203,29 @@ async function q(t, i, u, f) {
|
|
|
195
203
|
}
|
|
196
204
|
return f(v);
|
|
197
205
|
}
|
|
198
|
-
function
|
|
206
|
+
function Y(e) {
|
|
199
207
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
200
208
|
}
|
|
201
|
-
async function
|
|
202
|
-
return
|
|
209
|
+
async function X(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
210
|
+
return J(e, t, {
|
|
203
211
|
setAccept: !1,
|
|
204
212
|
isSessionProbe: n
|
|
205
|
-
},
|
|
213
|
+
}, Y);
|
|
206
214
|
}
|
|
207
|
-
async function
|
|
215
|
+
async function Z(e) {
|
|
208
216
|
return {
|
|
209
217
|
blob: await e.blob(),
|
|
210
|
-
filename:
|
|
218
|
+
filename: $(e.headers),
|
|
211
219
|
headers: e.headers
|
|
212
220
|
};
|
|
213
221
|
}
|
|
214
|
-
async function
|
|
215
|
-
return
|
|
222
|
+
async function Q(e, t = {}) {
|
|
223
|
+
return J(e, t, {
|
|
216
224
|
setAccept: !0,
|
|
217
225
|
isSessionProbe: !1
|
|
218
|
-
},
|
|
226
|
+
}, Z);
|
|
219
227
|
}
|
|
220
|
-
function
|
|
228
|
+
function $(e) {
|
|
221
229
|
let t = e.get("Content-Disposition");
|
|
222
230
|
if (!t) return "";
|
|
223
231
|
let n = t.match(/filename\*\s*=\s*([^']*)'([^']*)'([^;]+)/i);
|
|
@@ -227,14 +235,15 @@ function Q(e) {
|
|
|
227
235
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
228
236
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
229
237
|
}
|
|
230
|
-
async function
|
|
231
|
-
return (await
|
|
238
|
+
async function ee(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1 } = {}) {
|
|
239
|
+
return (await J(`/api/actions/${encodeURIComponent(e)}`, {
|
|
232
240
|
method: "POST",
|
|
233
|
-
body:
|
|
241
|
+
body: h(t),
|
|
242
|
+
keepalive: r
|
|
234
243
|
}, {
|
|
235
244
|
setAccept: !1,
|
|
236
245
|
isSessionProbe: n
|
|
237
|
-
},
|
|
246
|
+
}, Y)).result;
|
|
238
247
|
}
|
|
239
248
|
//#endregion
|
|
240
|
-
export {
|
|
249
|
+
export { C as RefreshDeadError, X as apiFetch, Q as apiFetchBlob, ee as callHandler, D as cancelProactiveRefresh, K as currentPublishedLanguage, F as ensureRefresh, R as getPersistentAuthFailureHandler, P as isTransientFailure, $ as parseContentDispositionFilename, G as publishLanguage, W as publishLanguageFor, E as scheduleProactiveRefresh, U as setLanguageReader, L as setPersistentAuthFailureHandler, q as withPublishedLanguage };
|
package/dist-lib/api/schema.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { recordActionTimeouts as e } from "./request-bounds.js";
|
|
2
|
-
import { apiFetch as t,
|
|
3
|
-
import { OrderedMap as
|
|
2
|
+
import { apiFetch as t, publishLanguageFor as n } from "./client.js";
|
|
3
|
+
import { OrderedMap as r } from "../types/ordmap.js";
|
|
4
4
|
//#region src/api/schema.ts
|
|
5
|
-
function
|
|
5
|
+
function i(e) {
|
|
6
6
|
return {
|
|
7
7
|
...e,
|
|
8
|
-
params: e.params ?
|
|
8
|
+
params: e.params ? r.fromWire(e.params) : void 0
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function a(e) {
|
|
12
12
|
return {
|
|
13
13
|
...e,
|
|
14
|
-
resolved_params: e.resolved_params ?
|
|
14
|
+
resolved_params: e.resolved_params ? r.fromWire(e.resolved_params) : void 0
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function o(e) {
|
|
18
18
|
let t = {};
|
|
19
|
-
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] =
|
|
19
|
+
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] = i(r);
|
|
20
20
|
let n = {};
|
|
21
|
-
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] =
|
|
21
|
+
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] = a(r);
|
|
22
22
|
return {
|
|
23
23
|
...e,
|
|
24
|
-
fields:
|
|
25
|
-
files: e.files ?
|
|
26
|
-
variants: e.variants ?
|
|
24
|
+
fields: r.fromWire(e.fields),
|
|
25
|
+
files: e.files ? r.fromWire(e.files) : void 0,
|
|
26
|
+
variants: e.variants ? r.fromWire(e.variants) : void 0,
|
|
27
27
|
handlers: e.handlers ? t : void 0,
|
|
28
28
|
actions: e.actions ? n : void 0
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function s(e) {
|
|
32
32
|
let t = {};
|
|
33
|
-
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] =
|
|
33
|
+
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] = o(r);
|
|
34
34
|
let n = {};
|
|
35
|
-
if (e.structures) for (let [t,
|
|
36
|
-
...
|
|
37
|
-
fields:
|
|
35
|
+
if (e.structures) for (let [t, i] of Object.entries(e.structures)) n[t] = {
|
|
36
|
+
...i,
|
|
37
|
+
fields: r.fromWire(i.fields)
|
|
38
38
|
};
|
|
39
|
-
let
|
|
40
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers))
|
|
39
|
+
let s = {};
|
|
40
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) s[t] = i(n);
|
|
41
41
|
let c = {};
|
|
42
|
-
if (e.actions) for (let [t, n] of Object.entries(e.actions)) c[t] =
|
|
42
|
+
if (e.actions) for (let [t, n] of Object.entries(e.actions)) c[t] = a(n);
|
|
43
43
|
let l = { ...e.screens };
|
|
44
44
|
for (let [e, t] of Object.entries(l)) {
|
|
45
45
|
let n = t;
|
|
46
46
|
l[e] = {
|
|
47
47
|
...t,
|
|
48
|
-
variants: n.variants ?
|
|
48
|
+
variants: n.variants ? r.fromWire(n.variants) : void 0
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
return {
|
|
52
52
|
...e,
|
|
53
53
|
entities: t,
|
|
54
54
|
structures: n,
|
|
55
|
-
handlers:
|
|
55
|
+
handlers: s,
|
|
56
56
|
actions: c,
|
|
57
57
|
screens: l
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
schema:
|
|
66
|
-
audience:
|
|
67
|
-
requestedAt:
|
|
60
|
+
async function c() {
|
|
61
|
+
let r = performance.now(), { audience: i, ...a } = await t("/api/schema", { cache: "no-cache" });
|
|
62
|
+
if (i === void 0) throw Error("/api/schema answered without its audience");
|
|
63
|
+
let o = s(a);
|
|
64
|
+
return n(i, o.language), e(o), {
|
|
65
|
+
schema: o,
|
|
66
|
+
audience: i,
|
|
67
|
+
requestedAt: r
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
-
export {
|
|
71
|
+
export { c as fetchSchema };
|
|
@@ -29,7 +29,9 @@ function u({ selections: r, onCancel: i, onRemove: a }) {
|
|
|
29
29
|
padding: "0 0 6px",
|
|
30
30
|
display: "flex",
|
|
31
31
|
flexDirection: "column",
|
|
32
|
-
gap: 4
|
|
32
|
+
gap: 4,
|
|
33
|
+
maxHeight: "30vh",
|
|
34
|
+
overflowY: "auto"
|
|
33
35
|
},
|
|
34
36
|
children: r.map((n) => /* @__PURE__ */ c("li", {
|
|
35
37
|
"data-selection-state": n.state,
|
|
@@ -39,18 +41,26 @@ function u({ selections: r, onCancel: i, onRemove: a }) {
|
|
|
39
41
|
},
|
|
40
42
|
children: [
|
|
41
43
|
/* @__PURE__ */ s(e.paperclip, { size: 11 }),
|
|
42
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ c("span", {
|
|
43
45
|
style: {
|
|
44
46
|
flex: 1,
|
|
45
47
|
minWidth: 0,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: n.state === "failed" ? "column" : "row",
|
|
50
|
+
gap: n.state === "failed" ? 2 : 6
|
|
49
51
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
children: [/* @__PURE__ */ s("span", {
|
|
53
|
+
style: {
|
|
54
|
+
flex: 1,
|
|
55
|
+
minWidth: 0,
|
|
56
|
+
overflow: "hidden",
|
|
57
|
+
textOverflow: "ellipsis",
|
|
58
|
+
whiteSpace: "nowrap"
|
|
59
|
+
},
|
|
60
|
+
title: n.filename,
|
|
61
|
+
children: n.filename
|
|
62
|
+
}), /* @__PURE__ */ s(d, { selection: n })]
|
|
52
63
|
}),
|
|
53
|
-
/* @__PURE__ */ s(d, { selection: n }),
|
|
54
64
|
n.state === "uploading" ? /* @__PURE__ */ s(t, {
|
|
55
65
|
size: 20,
|
|
56
66
|
icon: /* @__PURE__ */ s(e.x, { size: 11 }),
|
|
@@ -91,7 +101,7 @@ function d({ selection: e }) {
|
|
|
91
101
|
});
|
|
92
102
|
case "ready": return /* @__PURE__ */ s("span", {
|
|
93
103
|
style: { color: "var(--text-3)" },
|
|
94
|
-
children: r(e.sizeBytes)
|
|
104
|
+
children: r(e.sizeBytes, t.language)
|
|
95
105
|
});
|
|
96
106
|
}
|
|
97
107
|
}
|
|
@@ -128,7 +138,7 @@ function p({ files: i, align: u }) {
|
|
|
128
138
|
}),
|
|
129
139
|
/* @__PURE__ */ s("span", {
|
|
130
140
|
style: { color: "var(--text-3)" },
|
|
131
|
-
children: r(n.size_bytes)
|
|
141
|
+
children: r(n.size_bytes, d.language)
|
|
132
142
|
}),
|
|
133
143
|
/* @__PURE__ */ s(t, {
|
|
134
144
|
size: 20,
|
|
@@ -189,7 +189,7 @@ function S(e) {
|
|
|
189
189
|
/* @__PURE__ */ b("div", {
|
|
190
190
|
className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
|
|
191
191
|
children: [
|
|
192
|
-
D && /* @__PURE__ */ y("span", { children: o(D.size_bytes) }),
|
|
192
|
+
D && /* @__PURE__ */ y("span", { children: o(D.size_bytes, W.language) }),
|
|
193
193
|
D?.page_count != null && /* @__PURE__ */ y("span", { children: n(W, "file.document.pages", D.page_count, {
|
|
194
194
|
one: "{count} page",
|
|
195
195
|
other: "{count} pages"
|