@declarion/react 0.177.0 → 0.182.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/access-expiry.js +28 -6
- package/dist-lib/api/agents.js +19 -8
- package/dist-lib/api/audience.js +1 -1
- package/dist-lib/api/auth.js +63 -62
- package/dist-lib/api/client.js +39 -37
- package/dist-lib/app.js +101 -101
- package/dist-lib/components/agents/AgentChatPanel.impl.js +275 -177
- package/dist-lib/components/agents/transcript-runs.js +19 -7
- package/dist-lib/components/detail-layout/EvidenceBlock.js +1 -1
- package/dist-lib/components/pages/auth/SignIn.js +4 -2
- package/dist-lib/components/pages/profile/Profile.impl.js +149 -135
- package/dist-lib/hooks/useSchema.js +15 -14
- package/dist-lib/index.d.ts +19 -1
- package/dist-lib/stores/auth.js +55 -46
- package/package.json +1 -1
|
@@ -14,7 +14,29 @@ function n() {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
var r = "declarion.auth.signed_out";
|
|
18
|
+
function i() {
|
|
19
|
+
try {
|
|
20
|
+
window.localStorage.setItem(r, "1");
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function a() {
|
|
26
|
+
try {
|
|
27
|
+
window.localStorage.removeItem(r);
|
|
28
|
+
} catch {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function o() {
|
|
33
|
+
try {
|
|
34
|
+
return window.localStorage.getItem(r) === "1";
|
|
35
|
+
} catch {
|
|
36
|
+
return !1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function s() {
|
|
18
40
|
try {
|
|
19
41
|
let t = Date.parse(window.localStorage.getItem(e) ?? "");
|
|
20
42
|
return Number.isNaN(t) ? null : t;
|
|
@@ -22,11 +44,11 @@ function r() {
|
|
|
22
44
|
return null;
|
|
23
45
|
}
|
|
24
46
|
}
|
|
25
|
-
var
|
|
26
|
-
function
|
|
47
|
+
var c = "/login/sso-callback";
|
|
48
|
+
function l(e, t, n = !1) {
|
|
27
49
|
return n ? "first-wave" : e === null ? "probe-first" : e > t ? "first-wave" : "refresh-first";
|
|
28
50
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
51
|
+
function u() {
|
|
52
|
+
return l(s(), Date.now(), window.location.pathname === c);
|
|
31
53
|
}
|
|
32
|
-
export {
|
|
54
|
+
export { c as SSO_RETURN_PATH, n as clearAccessExpiry, a as clearSignOut, t as recordAccessExpiry, i as recordSignOut, o as signedOutExplicitly, l as startOrder, u as startOrderNow };
|
package/dist-lib/api/agents.js
CHANGED
|
@@ -82,14 +82,25 @@ async function p(e) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
async function m(e) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
let n = [];
|
|
86
|
+
for (let r = 1;; r += 1) {
|
|
87
|
+
let i = await t("agent_message", {
|
|
88
|
+
filters: [{
|
|
89
|
+
field: "conversation_id",
|
|
90
|
+
op: "eq",
|
|
91
|
+
value: e
|
|
92
|
+
}],
|
|
93
|
+
sort: "seq:asc",
|
|
94
|
+
page: r,
|
|
95
|
+
per_page: 1e3
|
|
96
|
+
}), a = i.data ?? [];
|
|
97
|
+
if (n.push(...a.map((e) => ({
|
|
98
|
+
...e,
|
|
99
|
+
bot: e.bot_id ? i.$refs?.agent_bot?.[e.bot_id]?.display_name : void 0,
|
|
100
|
+
sender_user: e.sender_user_id ? i.$refs?.user?.[e.sender_user_id]?.display_name : void 0
|
|
101
|
+
}))), i.meta?.has_more !== !0) return n;
|
|
102
|
+
if (a.length === 0) throw Error("agent_message pagination did not advance");
|
|
103
|
+
}
|
|
93
104
|
}
|
|
94
105
|
async function h(e, n) {
|
|
95
106
|
let r = [];
|
package/dist-lib/api/audience.js
CHANGED
package/dist-lib/api/auth.js
CHANGED
|
@@ -1,85 +1,86 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { recordSignOut as e, signedOutExplicitly as t } from "./access-expiry.js";
|
|
2
|
+
import { beginSessionInPage as n, callHandler as r, scheduleProactiveRefresh as i } from "./client.js";
|
|
2
3
|
// src/api/auth.ts
|
|
3
|
-
var
|
|
4
|
-
async function
|
|
5
|
-
await
|
|
6
|
-
}
|
|
7
|
-
async function
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
async function
|
|
11
|
-
await
|
|
12
|
-
let
|
|
13
|
-
email:
|
|
14
|
-
password:
|
|
15
|
-
remember:
|
|
4
|
+
var a;
|
|
5
|
+
async function o() {
|
|
6
|
+
await a?.catch(() => void 0);
|
|
7
|
+
}
|
|
8
|
+
async function s() {
|
|
9
|
+
return r("auth.check_setup", {}, { credentials: "omit" });
|
|
10
|
+
}
|
|
11
|
+
async function c(e, t, i = !0) {
|
|
12
|
+
await o();
|
|
13
|
+
let a = await r("auth.login", {
|
|
14
|
+
email: e,
|
|
15
|
+
password: t,
|
|
16
|
+
remember: i
|
|
16
17
|
});
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
async function
|
|
20
|
-
await
|
|
21
|
-
let
|
|
22
|
-
email:
|
|
23
|
-
password:
|
|
24
|
-
display_name:
|
|
18
|
+
return n(a.expires_at), a;
|
|
19
|
+
}
|
|
20
|
+
async function l(e, t, i) {
|
|
21
|
+
await o();
|
|
22
|
+
let a = await r("auth.signup", {
|
|
23
|
+
email: e,
|
|
24
|
+
password: t,
|
|
25
|
+
display_name: i
|
|
25
26
|
});
|
|
26
|
-
return
|
|
27
|
+
return a.verification_required || n(a.expires_at), a;
|
|
27
28
|
}
|
|
28
|
-
async function
|
|
29
|
-
await
|
|
30
|
-
let
|
|
31
|
-
email:
|
|
32
|
-
code:
|
|
29
|
+
async function u(e, t) {
|
|
30
|
+
await o();
|
|
31
|
+
let i = await r("auth.confirm_signup", {
|
|
32
|
+
email: e,
|
|
33
|
+
code: t
|
|
33
34
|
});
|
|
34
|
-
return
|
|
35
|
+
return n(i.expires_at), i;
|
|
35
36
|
}
|
|
36
|
-
async function
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
async function u() {
|
|
40
|
-
return t("auth.me");
|
|
41
|
-
}
|
|
42
|
-
async function d() {
|
|
43
|
-
return t("auth.me", {}, { isSessionProbe: !0 });
|
|
37
|
+
async function d(e) {
|
|
38
|
+
return r("auth.resend_signup_code", { email: e });
|
|
44
39
|
}
|
|
45
40
|
async function f() {
|
|
46
|
-
return (
|
|
41
|
+
return r("auth.me");
|
|
47
42
|
}
|
|
48
|
-
async function p(
|
|
49
|
-
|
|
50
|
-
return n(r.expires_at), r;
|
|
43
|
+
async function p() {
|
|
44
|
+
return r("auth.me", {}, { isSessionProbe: !0 });
|
|
51
45
|
}
|
|
52
|
-
function m() {
|
|
53
|
-
return r
|
|
54
|
-
r = void 0;
|
|
55
|
-
}), r;
|
|
46
|
+
async function m() {
|
|
47
|
+
return (await r("auth.list_tenants")).tenants;
|
|
56
48
|
}
|
|
57
49
|
async function h(e) {
|
|
58
|
-
|
|
50
|
+
let t = await r("auth.switch_tenant", { tenant_id: e });
|
|
51
|
+
return i(t.expires_at), t;
|
|
52
|
+
}
|
|
53
|
+
function g() {
|
|
54
|
+
return e(), a ??= r("auth.logout", {}, { keepalive: !0 }).then(() => void 0).finally(() => {
|
|
55
|
+
a = void 0;
|
|
56
|
+
}), a;
|
|
57
|
+
}
|
|
58
|
+
async function _(e) {
|
|
59
|
+
return (await r("auth.list_identity_providers", e ? { tenant_code: e } : {}, { credentials: "omit" })).providers;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${
|
|
61
|
+
function v(e, n, r) {
|
|
62
|
+
let i = new URLSearchParams();
|
|
63
|
+
n && i.set("tenant", n), r && i.set("redirect", r), t() && i.set("after_sign_out", "1");
|
|
64
|
+
let a = i.toString();
|
|
65
|
+
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${a ? `?${a}` : ""}`;
|
|
65
66
|
}
|
|
66
|
-
async function
|
|
67
|
+
async function y(e, t, n) {
|
|
67
68
|
let i = {
|
|
68
69
|
target_user_id: e,
|
|
69
|
-
reason:
|
|
70
|
+
reason: t
|
|
70
71
|
};
|
|
71
|
-
return
|
|
72
|
+
return n != null && (i.duration_minutes = n), r("impersonation.start", i);
|
|
72
73
|
}
|
|
73
|
-
async function
|
|
74
|
-
return
|
|
74
|
+
async function b() {
|
|
75
|
+
return r("impersonation.stop");
|
|
75
76
|
}
|
|
76
|
-
async function
|
|
77
|
-
await
|
|
77
|
+
async function x(e) {
|
|
78
|
+
await r("impersonation.revoke", { session_id: e });
|
|
78
79
|
}
|
|
79
|
-
async function
|
|
80
|
-
await
|
|
80
|
+
async function S(e, t) {
|
|
81
|
+
await r("auth.change_password", {
|
|
81
82
|
current_password: e,
|
|
82
|
-
new_password:
|
|
83
|
+
new_password: t
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
|
-
export {
|
|
86
|
+
export { S as changePassword, s as checkSetup, u as confirmSignup, f as getMe, x as impersonationRevoke, y as impersonationStart, b as impersonationStop, _ as listIdentityProviders, m as listTenants, c as login, g as logout, p as probeSession, d as resendSignupCode, l as signup, v as ssoAuthorizeUrl, h as switchTenant, o as waitForLogout };
|
package/dist-lib/api/client.js
CHANGED
|
@@ -31,7 +31,7 @@ function x(e) {
|
|
|
31
31
|
async function S() {
|
|
32
32
|
let e = navigator.locks;
|
|
33
33
|
if (!e) {
|
|
34
|
-
await
|
|
34
|
+
await P();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
let t = Date.now();
|
|
@@ -43,7 +43,7 @@ async function S() {
|
|
|
43
43
|
} else try {
|
|
44
44
|
b({
|
|
45
45
|
ok: !0,
|
|
46
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await P()
|
|
47
47
|
});
|
|
48
48
|
} catch (e) {
|
|
49
49
|
throw e instanceof C && b({
|
|
@@ -65,27 +65,27 @@ function T() {
|
|
|
65
65
|
}), w;
|
|
66
66
|
}
|
|
67
67
|
function E(e) {
|
|
68
|
-
return O || (
|
|
68
|
+
return O || (F = null, l() || p(e), typeof window > "u") ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
69
69
|
}
|
|
70
70
|
function D() {
|
|
71
71
|
f(), w?.then((e) => e.cancelRenewal());
|
|
72
72
|
}
|
|
73
73
|
var O = !1;
|
|
74
|
-
function
|
|
74
|
+
function ee() {
|
|
75
75
|
O = !0, D();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function k() {
|
|
78
78
|
return O;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return O = !1, E(e);
|
|
80
|
+
function A(e) {
|
|
81
|
+
return O = !1, I += 1, E(e);
|
|
82
82
|
}
|
|
83
83
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
84
84
|
if (e.key !== _ || l()) return;
|
|
85
85
|
let t = y(() => e.newValue);
|
|
86
86
|
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
87
87
|
});
|
|
88
|
-
async function
|
|
88
|
+
async function j(e, n, r) {
|
|
89
89
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
90
90
|
try {
|
|
91
91
|
return await fetch(e, {
|
|
@@ -98,47 +98,49 @@ async function M(e, n, r) {
|
|
|
98
98
|
clearTimeout(a);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function M(e) {
|
|
102
102
|
try {
|
|
103
103
|
return (await e.json())?.result?.expires_at;
|
|
104
104
|
} catch {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
108
|
+
function N() {
|
|
109
|
+
return j("/api/actions/auth.refresh", {
|
|
110
110
|
method: "POST",
|
|
111
111
|
credentials: "include",
|
|
112
112
|
headers: { "Content-Type": "application/json" },
|
|
113
113
|
body: h({})
|
|
114
114
|
}, u);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let t = await
|
|
116
|
+
async function P() {
|
|
117
|
+
let t = await N();
|
|
118
118
|
if (t.status === 429) {
|
|
119
119
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
120
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
120
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await N();
|
|
121
121
|
}
|
|
122
122
|
if (t.status >= 500) {
|
|
123
123
|
let n = await r(t);
|
|
124
124
|
throw new e(t.status, n.body, n.raw);
|
|
125
125
|
}
|
|
126
126
|
if (!t.ok) throw await r(t), new C(t.status);
|
|
127
|
-
let n = await
|
|
127
|
+
let n = await M(t);
|
|
128
128
|
return E(n), n;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
130
|
+
var F = null, I = 0, L = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
131
131
|
function R(n) {
|
|
132
132
|
return n instanceof t || n instanceof e;
|
|
133
133
|
}
|
|
134
134
|
async function z() {
|
|
135
135
|
if (O) throw new C(401);
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
if (F !== null) throw new C(F);
|
|
137
|
+
if (g) return g;
|
|
138
|
+
let e = I;
|
|
139
|
+
return g = S().catch((t) => {
|
|
140
|
+
throw t instanceof C && e === I && (F = t.status), t;
|
|
139
141
|
}).finally(() => {
|
|
140
142
|
g = null;
|
|
141
|
-
}), g
|
|
143
|
+
}), g;
|
|
142
144
|
}
|
|
143
145
|
var B = () => {
|
|
144
146
|
if (typeof window > "u") return;
|
|
@@ -169,7 +171,7 @@ function J(e, t) {
|
|
|
169
171
|
reader: e
|
|
170
172
|
} : null);
|
|
171
173
|
}
|
|
172
|
-
function
|
|
174
|
+
function te(e) {
|
|
173
175
|
G = e ? {
|
|
174
176
|
language: e,
|
|
175
177
|
reader: K ?? null
|
|
@@ -183,58 +185,58 @@ function X(e) {
|
|
|
183
185
|
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
184
186
|
}
|
|
185
187
|
async function Z(t, i, u, f) {
|
|
186
|
-
let p = X(t), m = l(), h = m ? "omit" : i.credentials ?? "include", g = m || h !== "omit", _ = W(i.headers, !!i.body, u, m ? c() : null), v = d(t, i), y = await
|
|
188
|
+
let p = X(t), m = l(), h = m ? "omit" : i.credentials ?? "include", g = m || h !== "omit", _ = W(i.headers, !!i.body, u, m ? c() : null), v = d(t, i), y = I, b = await j(p, {
|
|
187
189
|
...i,
|
|
188
190
|
headers: _,
|
|
189
191
|
credentials: h
|
|
190
192
|
}, v);
|
|
191
|
-
if (a(
|
|
192
|
-
let { raw: t, body: a } = await r(
|
|
193
|
-
if (g &&
|
|
193
|
+
if (a(b.headers), !b.ok) {
|
|
194
|
+
let { raw: t, body: a } = await r(b), c = n(a.type), l = a.title ?? "";
|
|
195
|
+
if (g && b.status === 401 && L.has(c)) try {
|
|
194
196
|
let t = null;
|
|
195
197
|
m ? (s(), t = await o()) : await z();
|
|
196
|
-
let a = W(i.headers, !!i.body, u, t), c = await
|
|
198
|
+
let a = W(i.headers, !!i.body, u, t), c = await j(p, {
|
|
197
199
|
...i,
|
|
198
200
|
headers: a,
|
|
199
201
|
credentials: h
|
|
200
202
|
}, v);
|
|
201
203
|
if (!c.ok) {
|
|
202
204
|
let t = await r(c);
|
|
203
|
-
throw !m && c.status === 401 && L.has(n(t.body.type)) && (
|
|
205
|
+
throw !m && y === I && c.status === 401 && L.has(n(t.body.type)) && (F = 401), c.status === 401 && !u.isSessionProbe && B(), new e(c.status, t.body, t.raw);
|
|
204
206
|
}
|
|
205
207
|
return f(c);
|
|
206
208
|
} catch (n) {
|
|
207
209
|
throw R(n) ? n : (u.isSessionProbe || B(), new e(401, a, t));
|
|
208
210
|
}
|
|
209
|
-
throw g &&
|
|
210
|
-
status:
|
|
211
|
+
throw g && b.status === 401 && !u.isSessionProbe && B(), U({
|
|
212
|
+
status: b.status,
|
|
211
213
|
code: c,
|
|
212
214
|
message: l
|
|
213
|
-
}), new e(
|
|
215
|
+
}), new e(b.status, a, t);
|
|
214
216
|
}
|
|
215
|
-
return f(
|
|
217
|
+
return f(b);
|
|
216
218
|
}
|
|
217
219
|
function Q(e) {
|
|
218
220
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
219
221
|
}
|
|
220
|
-
async function
|
|
222
|
+
async function ne(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
221
223
|
return Z(e, t, {
|
|
222
224
|
setAccept: !1,
|
|
223
225
|
isSessionProbe: n
|
|
224
226
|
}, Q);
|
|
225
227
|
}
|
|
226
|
-
async function
|
|
228
|
+
async function re(e) {
|
|
227
229
|
return {
|
|
228
230
|
blob: await e.blob(),
|
|
229
231
|
filename: $(e.headers),
|
|
230
232
|
headers: e.headers
|
|
231
233
|
};
|
|
232
234
|
}
|
|
233
|
-
async function
|
|
235
|
+
async function ie(e, t = {}) {
|
|
234
236
|
return Z(e, t, {
|
|
235
237
|
setAccept: !0,
|
|
236
238
|
isSessionProbe: !1
|
|
237
|
-
},
|
|
239
|
+
}, re);
|
|
238
240
|
}
|
|
239
241
|
function $(e) {
|
|
240
242
|
let t = e.get("Content-Disposition");
|
|
@@ -246,7 +248,7 @@ function $(e) {
|
|
|
246
248
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
247
249
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
248
250
|
}
|
|
249
|
-
async function
|
|
251
|
+
async function ae(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, credentials: i } = {}) {
|
|
250
252
|
return (await Z(`/api/actions/${encodeURIComponent(e)}`, {
|
|
251
253
|
method: "POST",
|
|
252
254
|
body: h(t),
|
|
@@ -257,4 +259,4 @@ async function ie(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, creden
|
|
|
257
259
|
isSessionProbe: n
|
|
258
260
|
}, Q)).result;
|
|
259
261
|
}
|
|
260
|
-
export { C as RefreshDeadError,
|
|
262
|
+
export { C as RefreshDeadError, ne as apiFetch, ie as apiFetchBlob, A as beginSessionInPage, ae as callHandler, D as cancelProactiveRefresh, Y as currentPublishedLanguage, ee as endSessionInPage, z as ensureRefresh, H as getPersistentAuthFailureHandler, k as isSignedOutInPage, R as isTransientFailure, $ as parseContentDispositionFilename, te as publishLanguage, J as publishLanguageFor, E as scheduleProactiveRefresh, q as setLanguageReader, V as setPersistentAuthFailureHandler, X as withPublishedLanguage };
|