@declarion/react 0.175.0 → 0.180.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.
@@ -14,7 +14,29 @@ function n() {
14
14
  return;
15
15
  }
16
16
  }
17
- function r() {
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 i = "/login/sso-callback";
26
- function a(e, t, n = !1) {
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 o() {
30
- return a(r(), Date.now(), window.location.pathname === i);
51
+ function u() {
52
+ return l(s(), Date.now(), window.location.pathname === c);
31
53
  }
32
- export { i as SSO_RETURN_PATH, n as clearAccessExpiry, t as recordAccessExpiry, a as startOrder, o as startOrderNow };
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 };
@@ -82,14 +82,25 @@ async function p(e) {
82
82
  });
83
83
  }
84
84
  async function m(e) {
85
- return h("agent_message", {
86
- filters: [{
87
- field: "conversation_id",
88
- op: "eq",
89
- value: e
90
- }],
91
- sort: "seq:asc"
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 = [];
@@ -1,85 +1,86 @@
1
- import { beginSessionInPage as e, callHandler as t, scheduleProactiveRefresh as n } from "./client.js";
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 r;
4
- async function i() {
5
- await r?.catch(() => void 0);
6
- }
7
- async function a() {
8
- return t("auth.check_setup", {}, { credentials: "omit" });
9
- }
10
- async function o(n, r, a = !0) {
11
- await i();
12
- let o = await t("auth.login", {
13
- email: n,
14
- password: r,
15
- remember: a
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 e(o.expires_at), o;
18
- }
19
- async function s(n, r, a) {
20
- await i();
21
- let o = await t("auth.signup", {
22
- email: n,
23
- password: r,
24
- display_name: a
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 o.verification_required || e(o.expires_at), o;
27
+ return a.verification_required || n(a.expires_at), a;
27
28
  }
28
- async function c(n, r) {
29
- await i();
30
- let a = await t("auth.confirm_signup", {
31
- email: n,
32
- code: r
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 e(a.expires_at), a;
35
+ return n(i.expires_at), i;
35
36
  }
36
- async function l(e) {
37
- return t("auth.resend_signup_code", { email: e });
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 (await t("auth.list_tenants")).tenants;
41
+ return r("auth.me");
47
42
  }
48
- async function p(e) {
49
- let r = await t("auth.switch_tenant", { tenant_id: e });
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 ??= t("auth.logout", {}, { keepalive: !0 }).then(() => void 0).finally(() => {
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
- return (await t("auth.list_identity_providers", e ? { tenant_code: e } : {}, { credentials: "omit" })).providers;
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 g(e, t, n) {
61
- let r = new URLSearchParams();
62
- t && r.set("tenant", t), n && r.set("redirect", n);
63
- let i = r.toString();
64
- return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
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 _(e, n, r) {
67
+ async function y(e, t, n) {
67
68
  let i = {
68
69
  target_user_id: e,
69
- reason: n
70
+ reason: t
70
71
  };
71
- return r != null && (i.duration_minutes = r), t("impersonation.start", i);
72
+ return n != null && (i.duration_minutes = n), r("impersonation.start", i);
72
73
  }
73
- async function v() {
74
- return t("impersonation.stop");
74
+ async function b() {
75
+ return r("impersonation.stop");
75
76
  }
76
- async function y(e) {
77
- await t("impersonation.revoke", { session_id: e });
77
+ async function x(e) {
78
+ await r("impersonation.revoke", { session_id: e });
78
79
  }
79
- async function b(e, n) {
80
- await t("auth.change_password", {
80
+ async function S(e, t) {
81
+ await r("auth.change_password", {
81
82
  current_password: e,
82
- new_password: n
83
+ new_password: t
83
84
  });
84
85
  }
85
- export { b as changePassword, a as checkSetup, c as confirmSignup, u as getMe, y as impersonationRevoke, _ as impersonationStart, v as impersonationStop, h as listIdentityProviders, f as listTenants, o as login, m as logout, d as probeSession, l as resendSignupCode, s as signup, g as ssoAuthorizeUrl, p as switchTenant, i as waitForLogout };
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 };