@epam/ai-dial-chat-hooks 1.5.0-dev.35 → 1.5.0-dev.36
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/external-services/useExternalServiceLogin.js +7 -7
- package/external-services.js +3 -3
- package/index.js +247 -247
- package/oauth/batch-channel.d.ts +42 -0
- package/oauth/batch-channel.d.ts.map +1 -0
- package/oauth/batch-channel.js +90 -0
- package/oauth/handshake.d.ts +59 -2
- package/oauth/handshake.d.ts.map +1 -1
- package/oauth/handshake.js +204 -35
- package/oauth/models.d.ts +90 -1
- package/oauth/models.d.ts.map +1 -1
- package/oauth/popup.d.ts +35 -1
- package/oauth/popup.d.ts.map +1 -1
- package/oauth/popup.js +35 -15
- package/oauth/redirect-state.d.ts +12 -0
- package/oauth/redirect-state.d.ts.map +1 -0
- package/oauth/redirect-state.js +20 -0
- package/oauth/types.d.ts +41 -2
- package/oauth/types.d.ts.map +1 -1
- package/oauth/types.js +9 -3
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts +11 -5
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +1 -1
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +95 -66
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts +11 -1
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
- package/oauth/useToolsetLogin/useToolsetLogin.js +96 -45
- package/oauth.js +10 -10
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js +5 -5
- package/package.json +17 -17
- package/signin-interrupt/models.d.ts +25 -1
- package/signin-interrupt/models.d.ts.map +1 -1
- package/signin-interrupt/types.d.ts +12 -1
- package/signin-interrupt/types.d.ts.map +1 -1
- package/signin-interrupt/types.js +4 -2
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts +29 -5
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.d.ts.map +1 -1
- package/signin-interrupt/useSigninInterrupt/useSigninInterrupt.js +412 -134
|
@@ -1,82 +1,133 @@
|
|
|
1
|
-
import { OAuthResourceKind as e, ToolsetAuthStatus as t, ToolsetAuthTypes as n,
|
|
2
|
-
import { selectToolsetAuthStatus as
|
|
3
|
-
import { toToolsetOAuthSettings as
|
|
4
|
-
import { emitToolsetLoginSuccess as
|
|
5
|
-
import { waitForToolsetOAuthResult as c } from "../handshake.js";
|
|
1
|
+
import { OAuthResourceKind as e, ToolsetAuthStatus as t, ToolsetAuthTypes as n, ToolsetOAuthBatchStepOutcomeType as r, ToolsetOAuthInitiationResultType as i, ToolsetOAuthResultType as a } from "../types.js";
|
|
2
|
+
import { selectToolsetAuthStatus as o } from "../toolset-id.js";
|
|
3
|
+
import { toToolsetOAuthSettings as s } from "../authorize-url.js";
|
|
4
|
+
import { emitToolsetLoginSuccess as c } from "../../shared/toolset-login-events.js";
|
|
6
5
|
import { initiateOAuthLogin as l, navigateToolsetOAuthPopup as u, openToolsetOAuthPopup as d } from "../popup.js";
|
|
7
|
-
import {
|
|
6
|
+
import { createToolsetOAuthBatchSession as f, waitForToolsetOAuthResult as p } from "../handshake.js";
|
|
7
|
+
import { useCallback as m } from "react";
|
|
8
8
|
//#region src/oauth/useToolsetLogin/useToolsetLogin.ts
|
|
9
|
-
var
|
|
10
|
-
return e.Success = "success", e.Failure = "failure", e.PopupBlocked = "popup-blocked", e.Cancelled = "cancelled", e;
|
|
11
|
-
}({}),
|
|
12
|
-
let
|
|
9
|
+
var h = /* @__PURE__ */ function(e) {
|
|
10
|
+
return e.Success = "success", e.Failure = "failure", e.PopupBlocked = "popup-blocked", e.Cancelled = "cancelled", e.WindowLost = "window-lost", e;
|
|
11
|
+
}({}), g = ({ callbackPath: h, loginToolset: g, logoutToolset: _, getToolset: v, shouldFetchOAuthSettings: y = !1 }) => {
|
|
12
|
+
let b = m(async (e, t, n) => {
|
|
13
13
|
try {
|
|
14
|
-
await
|
|
14
|
+
await _(e, {
|
|
15
15
|
url: e,
|
|
16
16
|
credentialsLevel: t,
|
|
17
17
|
authenticationType: n
|
|
18
18
|
});
|
|
19
19
|
} catch {}
|
|
20
|
-
}, [
|
|
21
|
-
let { toolsetId:
|
|
22
|
-
if (
|
|
20
|
+
}, [_]), x = m(async (r) => {
|
|
21
|
+
let { toolsetId: f, credentialsLevel: m, oauthSettings: g, forceStale: _, offlineUsageConsent: x } = r, S = g ?? {}, C;
|
|
22
|
+
if (_ || y) {
|
|
23
23
|
let t = d();
|
|
24
24
|
if (!t) return { type: "popup-blocked" };
|
|
25
|
-
|
|
25
|
+
_ && await b(f, m, n.OAuth);
|
|
26
26
|
let r = S;
|
|
27
|
-
if (
|
|
28
|
-
let { authSettings: e } = await
|
|
27
|
+
if (y) try {
|
|
28
|
+
let { authSettings: e } = await v(f);
|
|
29
29
|
if (t.closed) return { type: "cancelled" };
|
|
30
30
|
if (e?.authenticationType !== n.OAuth) return t.close(), { type: "failure" };
|
|
31
|
-
r =
|
|
31
|
+
r = s(e);
|
|
32
32
|
} catch {
|
|
33
33
|
return t.close(), { type: "failure" };
|
|
34
34
|
}
|
|
35
|
-
C = u(t, r,
|
|
36
|
-
} else C = l(S,
|
|
37
|
-
if (C.type ===
|
|
38
|
-
if (C.type !==
|
|
39
|
-
let w = await
|
|
40
|
-
toolsetId:
|
|
41
|
-
credentialsLevel:
|
|
42
|
-
callbackPath:
|
|
35
|
+
C = u(t, r, f, h, m, e.Toolset, x);
|
|
36
|
+
} else C = l(S, f, h, m, x);
|
|
37
|
+
if (C.type === i.Blocked) return { type: "popup-blocked" };
|
|
38
|
+
if (C.type !== i.Started) return { type: "failure" };
|
|
39
|
+
let w = await p(C.popup, C.flowId, {
|
|
40
|
+
toolsetId: f,
|
|
41
|
+
credentialsLevel: m,
|
|
42
|
+
callbackPath: h
|
|
43
43
|
});
|
|
44
|
-
if (w.type ===
|
|
45
|
-
toolsetId:
|
|
46
|
-
credentialsLevel:
|
|
44
|
+
if (w.type === a.Success) return c({
|
|
45
|
+
toolsetId: f,
|
|
46
|
+
credentialsLevel: m
|
|
47
47
|
}), { type: "success" };
|
|
48
|
-
if (w.type ===
|
|
48
|
+
if (w.type === a.Failure) return { type: "failure" };
|
|
49
49
|
try {
|
|
50
|
-
let e = await
|
|
51
|
-
if (
|
|
52
|
-
toolsetId:
|
|
53
|
-
credentialsLevel:
|
|
50
|
+
let e = await v(f);
|
|
51
|
+
if (o(e.authSettings, m) === t.SignedIn) return c({
|
|
52
|
+
toolsetId: f,
|
|
53
|
+
credentialsLevel: m
|
|
54
54
|
}), { type: "success" };
|
|
55
55
|
} catch {}
|
|
56
56
|
return { type: "cancelled" };
|
|
57
57
|
}, [
|
|
58
|
-
|
|
59
|
-
g,
|
|
58
|
+
h,
|
|
60
59
|
v,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
b,
|
|
61
|
+
y
|
|
62
|
+
]), S = m(async (e, n) => {
|
|
64
63
|
try {
|
|
65
|
-
|
|
64
|
+
let r = await v(e);
|
|
65
|
+
return o(r.authSettings, n) === t.SignedIn;
|
|
66
|
+
} catch {
|
|
67
|
+
return !1;
|
|
68
|
+
}
|
|
69
|
+
}, [v]), C = m(async (t, i) => {
|
|
70
|
+
let { toolsetId: a, credentialsLevel: o, oauthSettings: l, forceStale: u, offlineUsageConsent: d } = t;
|
|
71
|
+
u && await b(a, o, n.OAuth);
|
|
72
|
+
let f = l ?? {};
|
|
73
|
+
if (y) try {
|
|
74
|
+
let { authSettings: e } = await v(a);
|
|
75
|
+
if (e?.authenticationType !== n.OAuth) return { type: "failure" };
|
|
76
|
+
f = s(e);
|
|
77
|
+
} catch {
|
|
78
|
+
return { type: "failure" };
|
|
79
|
+
}
|
|
80
|
+
switch ((await i.runStep({
|
|
81
|
+
auth: f,
|
|
82
|
+
toolsetId: a,
|
|
83
|
+
credentialsLevel: o,
|
|
84
|
+
resourceKind: e.Toolset,
|
|
85
|
+
offlineUsageConsent: d
|
|
86
|
+
})).type) {
|
|
87
|
+
case r.Success: return c({
|
|
88
|
+
toolsetId: a,
|
|
89
|
+
credentialsLevel: o
|
|
90
|
+
}), { type: "success" };
|
|
91
|
+
case r.Stopped: return { type: "cancelled" };
|
|
92
|
+
case r.WindowLost: return await S(a, o) ? (c({
|
|
93
|
+
toolsetId: a,
|
|
94
|
+
credentialsLevel: o
|
|
95
|
+
}), { type: "success" }) : { type: "window-lost" };
|
|
96
|
+
default: return { type: "failure" };
|
|
97
|
+
}
|
|
98
|
+
}, [
|
|
99
|
+
v,
|
|
100
|
+
S,
|
|
101
|
+
b,
|
|
102
|
+
y
|
|
103
|
+
]), w = m(async (e) => {
|
|
104
|
+
let { toolsetId: t, credentialsLevel: n, authenticationType: r, apiKey: i, isCurrentlyFailed: a, forceStale: o, offlineUsageConsent: s } = e;
|
|
105
|
+
try {
|
|
106
|
+
return (o || a) && await b(t, n, r), await g(t, {
|
|
66
107
|
url: t,
|
|
67
108
|
credentialsLevel: n,
|
|
68
109
|
authenticationType: r,
|
|
69
110
|
apiKey: i?.trim(),
|
|
70
|
-
offlineUsageConsent:
|
|
71
|
-
}),
|
|
111
|
+
offlineUsageConsent: s
|
|
112
|
+
}), c({
|
|
72
113
|
toolsetId: t,
|
|
73
114
|
credentialsLevel: n
|
|
74
115
|
}), { type: "success" };
|
|
75
116
|
} catch {
|
|
76
117
|
return { type: "failure" };
|
|
77
118
|
}
|
|
78
|
-
}, [
|
|
79
|
-
return {
|
|
119
|
+
}, [g, b]);
|
|
120
|
+
return {
|
|
121
|
+
login: m((e) => e.authenticationType === n.OAuth ? e.batchSession ? C(e, e.batchSession) : x(e) : w(e), [
|
|
122
|
+
x,
|
|
123
|
+
C,
|
|
124
|
+
w
|
|
125
|
+
]),
|
|
126
|
+
createBatchSession: m((e = {}) => f({
|
|
127
|
+
...e,
|
|
128
|
+
callbackPath: h
|
|
129
|
+
}), [h])
|
|
130
|
+
};
|
|
80
131
|
};
|
|
81
132
|
//#endregion
|
|
82
|
-
export {
|
|
133
|
+
export { h as ToolsetLoginOutcomeType, g as useToolsetLogin };
|
package/oauth.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { OAuthResourceKind as e, TOOLSET_REDIRECT_STATE_KEY as t, ToolsetAuthStatus as n, ToolsetAuthTypes as r, ToolsetCredentialsLevel as i,
|
|
2
|
-
import { decodeToolsetId as
|
|
3
|
-
import { buildToolsetAuthorizeUrl as
|
|
4
|
-
import { emitToolsetLoginSuccess as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { ToolsetLoginOutcomeType as
|
|
8
|
-
import { createOAuthCallbackExchange as
|
|
9
|
-
import { useOAuthCallbackCompletion as
|
|
10
|
-
export { e as OAuthResourceKind, t as TOOLSET_REDIRECT_STATE_KEY, n as ToolsetAuthStatus, r as ToolsetAuthTypes, i as ToolsetCredentialsLevel,
|
|
1
|
+
import { OAuthResourceKind as e, TOOLSET_REDIRECT_STATE_KEY as t, ToolsetAuthStatus as n, ToolsetAuthTypes as r, ToolsetCredentialsLevel as i, ToolsetOAuthBatchMessageType as a, ToolsetOAuthBatchStepOutcomeType as o, ToolsetOAuthBatchWindowPhase as s, ToolsetOAuthCallbackQuery as c, ToolsetOAuthChannelControlType as l, ToolsetOAuthFailureReason as u, ToolsetOAuthInitiationResultType as d, ToolsetOAuthResultType as f, WithLogin as p } from "./oauth/types.js";
|
|
2
|
+
import { decodeToolsetId as m, encodeToolsetId as h, getToolsetFallbackName as g, isPublicToolsetId as _, normalizeToolsetId as v, resolveToolsetCredentialsLevel as y, selectToolsetAuthStatus as b } from "./oauth/toolset-id.js";
|
|
3
|
+
import { buildToolsetAuthorizeUrl as x, getToolsetRedirectUri as S, toToolsetOAuthSettings as C } from "./oauth/authorize-url.js";
|
|
4
|
+
import { emitToolsetLoginSuccess as w, subscribeToolsetLoginSuccess as T } from "./shared/toolset-login-events.js";
|
|
5
|
+
import { buildToolsetOAuthBatchStep as E, getToolsetOAuthBatchWindowUrl as D, initiateOAuthLogin as O, navigateToolsetOAuthPopup as k, openToolsetOAuthBatchWindow as A, openToolsetOAuthPopup as j } from "./oauth/popup.js";
|
|
6
|
+
import { createToolsetOAuthBatchSession as M, getToolsetOAuthChannelName as N, waitForToolsetOAuthResult as P } from "./oauth/handshake.js";
|
|
7
|
+
import { ToolsetLoginOutcomeType as F, useToolsetLogin as I } from "./oauth/useToolsetLogin/useToolsetLogin.js";
|
|
8
|
+
import { createOAuthCallbackExchange as L } from "./oauth/callback-exchange.js";
|
|
9
|
+
import { useOAuthCallbackCompletion as R } from "./oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js";
|
|
10
|
+
export { e as OAuthResourceKind, t as TOOLSET_REDIRECT_STATE_KEY, n as ToolsetAuthStatus, r as ToolsetAuthTypes, i as ToolsetCredentialsLevel, F as ToolsetLoginOutcomeType, a as ToolsetOAuthBatchMessageType, o as ToolsetOAuthBatchStepOutcomeType, s as ToolsetOAuthBatchWindowPhase, c as ToolsetOAuthCallbackQuery, l as ToolsetOAuthChannelControlType, u as ToolsetOAuthFailureReason, d as ToolsetOAuthInitiationResultType, f as ToolsetOAuthResultType, p as WithLogin, x as buildToolsetAuthorizeUrl, E as buildToolsetOAuthBatchStep, L as createOAuthCallbackExchange, M as createToolsetOAuthBatchSession, m as decodeToolsetId, w as emitToolsetLoginSuccess, h as encodeToolsetId, g as getToolsetFallbackName, D as getToolsetOAuthBatchWindowUrl, N as getToolsetOAuthChannelName, S as getToolsetRedirectUri, O as initiateOAuthLogin, _ as isPublicToolsetId, k as navigateToolsetOAuthPopup, v as normalizeToolsetId, A as openToolsetOAuthBatchWindow, j as openToolsetOAuthPopup, y as resolveToolsetCredentialsLevel, b as selectToolsetAuthStatus, T as subscribeToolsetLoginSuccess, C as toToolsetOAuthSettings, R as useOAuthCallbackCompletion, I as useToolsetLogin, P as waitForToolsetOAuthResult };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OAuthResourceKind as e, ToolsetAuthTypes as t, ToolsetCredentialsLevel as n, ToolsetOAuthInitiationResultType as r, ToolsetOAuthResultType as i, WithLogin as a } from "../../oauth/types.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { navigateToolsetOAuthPopup as o, openToolsetOAuthPopup as s } from "../../oauth/popup.js";
|
|
3
|
+
import { waitForToolsetOAuthResult as c } from "../../oauth/handshake.js";
|
|
4
4
|
import { useCallback as l } from "react";
|
|
5
5
|
//#region src/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.ts
|
|
6
6
|
var u = "offline-credentials", d = 3e5, f = /* @__PURE__ */ function(e) {
|
|
@@ -13,11 +13,11 @@ var u = "offline-credentials", d = 3e5, f = /* @__PURE__ */ function(e) {
|
|
|
13
13
|
clientId: l.clientId,
|
|
14
14
|
authorizationEndpoint: l.authorizationEndpoint,
|
|
15
15
|
scopes: l.scopes
|
|
16
|
-
}, g = m ??
|
|
16
|
+
}, g = m ?? s();
|
|
17
17
|
if (!g) return { type: "popup-blocked" };
|
|
18
|
-
let _ =
|
|
18
|
+
let _ = o(g, h, u, f, n.User, e.OfflineCredentials);
|
|
19
19
|
if (_.type !== r.Started) return { type: "failure" };
|
|
20
|
-
let v = Date.now(), y = await
|
|
20
|
+
let v = Date.now(), y = await c(_.popup, _.flowId, {
|
|
21
21
|
toolsetId: u,
|
|
22
22
|
credentialsLevel: n.User,
|
|
23
23
|
callbackPath: f,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.5.0-dev.
|
|
4
|
+
"version": "1.5.0-dev.36",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
|
-
"@epam/ai-dial-chat-api-client": "1.5.0-dev.
|
|
134
|
+
"@epam/ai-dial-chat-api-client": "1.5.0-dev.36",
|
|
135
135
|
"dompurify": "3.4.17",
|
|
136
136
|
"fflate": "^0.8.3",
|
|
137
137
|
"lru-cache": "^10.4.3",
|
|
@@ -140,23 +140,23 @@
|
|
|
140
140
|
},
|
|
141
141
|
"peerDependencies": {
|
|
142
142
|
"react": "^19.2.8",
|
|
143
|
-
"@epam/ai-dial-attachment-canvas": "1.5.0-dev.
|
|
144
|
-
"@epam/ai-dial-attachment-input": "1.5.0-dev.
|
|
145
|
-
"@epam/ai-dial-catalog": "1.5.0-dev.
|
|
146
|
-
"@epam/ai-dial-chat-overlay": "1.5.0-dev.
|
|
147
|
-
"@epam/ai-dial-chat-shared": "1.5.0-dev.
|
|
148
|
-
"@epam/ai-dial-conversation-input": "1.5.0-dev.
|
|
149
|
-
"@epam/ai-dial-mcp-apps": "1.5.0-dev.
|
|
150
|
-
"@epam/ai-dial-projects": "1.5.0-dev.
|
|
151
|
-
"@epam/ai-dial-publish-panel": "1.5.0-dev.
|
|
152
|
-
"@epam/ai-dial-quotations": "1.5.0-dev.
|
|
143
|
+
"@epam/ai-dial-attachment-canvas": "1.5.0-dev.36",
|
|
144
|
+
"@epam/ai-dial-attachment-input": "1.5.0-dev.36",
|
|
145
|
+
"@epam/ai-dial-catalog": "1.5.0-dev.36",
|
|
146
|
+
"@epam/ai-dial-chat-overlay": "1.5.0-dev.36",
|
|
147
|
+
"@epam/ai-dial-chat-shared": "1.5.0-dev.36",
|
|
148
|
+
"@epam/ai-dial-conversation-input": "1.5.0-dev.36",
|
|
149
|
+
"@epam/ai-dial-mcp-apps": "1.5.0-dev.36",
|
|
150
|
+
"@epam/ai-dial-projects": "1.5.0-dev.36",
|
|
151
|
+
"@epam/ai-dial-publish-panel": "1.5.0-dev.36",
|
|
152
|
+
"@epam/ai-dial-quotations": "1.5.0-dev.36",
|
|
153
153
|
"@epam/ai-dial-react-file-manager": "^0.5.3",
|
|
154
|
-
"@epam/ai-dial-scheduled-tasks": "1.5.0-dev.
|
|
155
|
-
"@epam/ai-dial-share": "1.5.0-dev.
|
|
156
|
-
"@epam/ai-dial-skill-editor": "1.5.0-dev.
|
|
157
|
-
"@epam/ai-dial-source-panel": "1.5.0-dev.
|
|
154
|
+
"@epam/ai-dial-scheduled-tasks": "1.5.0-dev.36",
|
|
155
|
+
"@epam/ai-dial-share": "1.5.0-dev.36",
|
|
156
|
+
"@epam/ai-dial-skill-editor": "1.5.0-dev.36",
|
|
157
|
+
"@epam/ai-dial-source-panel": "1.5.0-dev.36",
|
|
158
158
|
"@epam/ai-dial-ui-kit": "^0.17.0",
|
|
159
|
-
"@epam/ai-dial-usage-dashboard": "1.5.0-dev.
|
|
159
|
+
"@epam/ai-dial-usage-dashboard": "1.5.0-dev.36",
|
|
160
160
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
161
161
|
"@epam/pdf-highlighter-kit": "^0.0.23"
|
|
162
162
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExternalServiceAuthType, ExternalServiceCredentialsLevel, ExternalServiceOAuthSettings } from '../external-services/useExternalServiceLogin';
|
|
2
2
|
import { ToolsetCredentialsLevel } from '../oauth/types';
|
|
3
3
|
import { PendingSigninEvent } from '../shared/client-channel';
|
|
4
|
-
import { SigninInterruptAnnouncementKind, SigninInterruptRowError, SigninInterruptRowStatus } from './types';
|
|
4
|
+
import { SigninInterruptAnnouncementKind, SigninInterruptRowError, SigninInterruptRowStatus, SigninInterruptRunPhase } from './types';
|
|
5
5
|
/** Display and login metadata resolved for the resource behind a pending sign-in event. */
|
|
6
6
|
export interface SigninRowInfo {
|
|
7
7
|
/** Resource display name, or a fallback derived from its id while metadata is missing. */
|
|
@@ -37,6 +37,30 @@ export interface SigninInterruptRow {
|
|
|
37
37
|
isDialNative: boolean;
|
|
38
38
|
/** Whether `Log in` can be submitted: always, except an API-key row with a blank key. */
|
|
39
39
|
canSubmitLogin: boolean;
|
|
40
|
+
/** Whether `Log in` is unavailable because a Log in all run owns the window. */
|
|
41
|
+
isLoginDisabled: boolean;
|
|
42
|
+
/** Whether the row's login succeeded and only its report is outstanding, so the row offers a report retry. */
|
|
43
|
+
isReportRetry: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Progress of a running Log in all run. */
|
|
46
|
+
export interface SigninInterruptRunState {
|
|
47
|
+
/** Whether a step runs or the run waits for Continue. */
|
|
48
|
+
phase: SigninInterruptRunPhase;
|
|
49
|
+
/** Display name of the current target. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** One-based position of the current target in the run. */
|
|
52
|
+
position: number;
|
|
53
|
+
/** Number of targets in the run. */
|
|
54
|
+
total: number;
|
|
55
|
+
/** Id of the first pending event of the current target, when it still has one. */
|
|
56
|
+
eventId?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Request to move focus to a row's API key field; a new `requestId` repeats the request. */
|
|
59
|
+
export interface SigninInterruptFocusRequest {
|
|
60
|
+
/** Event id of the row whose key field takes focus. */
|
|
61
|
+
eventId: string;
|
|
62
|
+
/** Increases with every request. */
|
|
63
|
+
requestId: number;
|
|
40
64
|
}
|
|
41
65
|
/** Status a sign-in interrupt announces after resolving an event. */
|
|
42
66
|
export interface SigninInterruptAnnouncement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/signin-interrupt/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EACV,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":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8G;IAC9G,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACtC,yDAAyD;IACzD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,6FAA6F;AAC7F,MAAM,WAAW,2BAA2B;IAC1C,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,2BAA2B;IAC1C,iCAAiC;IACjC,IAAI,EAAE,+BAA+B,CAAC;IACtC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -16,7 +16,18 @@ export declare enum SigninInterruptRowError {
|
|
|
16
16
|
/** A DIAL administrator must approve the application's access first. */
|
|
17
17
|
AdminConsentRequired = "admin-consent-required",
|
|
18
18
|
/** Offline access is not configured for the user's account. */
|
|
19
|
-
OfflineUnavailable = "offline-unavailable"
|
|
19
|
+
OfflineUnavailable = "offline-unavailable",
|
|
20
|
+
/** Log in all cannot start while this row's API key is empty. */
|
|
21
|
+
ApiKeyRequired = "api-key-required",
|
|
22
|
+
/** The login succeeded, but reporting it to DIAL Core failed; only the report is retried. */
|
|
23
|
+
ReportFailed = "report-failed"
|
|
24
|
+
}
|
|
25
|
+
/** Phase of a running Log in all run. */
|
|
26
|
+
export declare enum SigninInterruptRunPhase {
|
|
27
|
+
/** A step is running or about to start. */
|
|
28
|
+
Running = "running",
|
|
29
|
+
/** The run's authorization window was lost; the run waits for Continue. */
|
|
30
|
+
Paused = "paused"
|
|
20
31
|
}
|
|
21
32
|
/** Kind of status a sign-in interrupt announces after resolving an event. */
|
|
22
33
|
export declare enum SigninInterruptAnnouncementKind {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/signin-interrupt/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,oBAAY,wBAAwB;IAClC,4CAA4C;IAC5C,IAAI,SAAS;IACb,oDAAoD;IACpD,UAAU,eAAe;CAC1B;AAED,qFAAqF;AACrF,oBAAY,uBAAuB;IACjC,sEAAsE;IACtE,WAAW,iBAAiB;IAC5B,2CAA2C;IAC3C,YAAY,kBAAkB;IAC9B,iDAAiD;IACjD,aAAa,mBAAmB;IAChC,wEAAwE;IACxE,oBAAoB,2BAA2B;IAC/C,+DAA+D;IAC/D,kBAAkB,wBAAwB;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/signin-interrupt/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,oBAAY,wBAAwB;IAClC,4CAA4C;IAC5C,IAAI,SAAS;IACb,oDAAoD;IACpD,UAAU,eAAe;CAC1B;AAED,qFAAqF;AACrF,oBAAY,uBAAuB;IACjC,sEAAsE;IACtE,WAAW,iBAAiB;IAC5B,2CAA2C;IAC3C,YAAY,kBAAkB;IAC9B,iDAAiD;IACjD,aAAa,mBAAmB;IAChC,wEAAwE;IACxE,oBAAoB,2BAA2B;IAC/C,+DAA+D;IAC/D,kBAAkB,wBAAwB;IAC1C,iEAAiE;IACjE,cAAc,qBAAqB;IACnC,6FAA6F;IAC7F,YAAY,kBAAkB;CAC/B;AAED,yCAAyC;AACzC,oBAAY,uBAAuB;IACjC,2CAA2C;IAC3C,OAAO,YAAY;IACnB,2EAA2E;IAC3E,MAAM,WAAW;CAClB;AAED,6EAA6E;AAC7E,oBAAY,+BAA+B;IACzC,iEAAiE;IACjE,cAAc,oBAAoB;IAClC,sDAAsD;IACtD,QAAQ,aAAa;CACtB"}
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
3
|
return e.Idle = "idle", e.Processing = "processing", e;
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
|
-
return e.LoginFailed = "login-failed", e.PopupBlocked = "popup-blocked", e.DeclineFailed = "decline-failed", e.AdminConsentRequired = "admin-consent-required", e.OfflineUnavailable = "offline-unavailable", e;
|
|
5
|
+
return e.LoginFailed = "login-failed", e.PopupBlocked = "popup-blocked", e.DeclineFailed = "decline-failed", e.AdminConsentRequired = "admin-consent-required", e.OfflineUnavailable = "offline-unavailable", e.ApiKeyRequired = "api-key-required", e.ReportFailed = "report-failed", e;
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.Running = "running", e.Paused = "paused", e;
|
|
8
|
+
}({}), r = /* @__PURE__ */ function(e) {
|
|
7
9
|
return e.LoginSucceeded = "login-succeeded", e.Declined = "declined", e;
|
|
8
10
|
}({});
|
|
9
11
|
//#endregion
|
|
10
|
-
export {
|
|
12
|
+
export { r as SigninInterruptAnnouncementKind, t as SigninInterruptRowError, e as SigninInterruptRowStatus, n as SigninInterruptRunPhase };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DialToolsetDto, GetExternalServiceResponseDto, ReportClientChannelDtoResultEnum } from '@epam/ai-dial-chat-api-client';
|
|
2
2
|
import { ExternalServiceLoginOutcome, ExternalServiceLoginParams } from '../../external-services/useExternalServiceLogin';
|
|
3
|
+
import { CreateToolsetOAuthBatchSessionOptions, ToolsetOAuthBatchSession } from '../../oauth/handshake';
|
|
3
4
|
import { ToolsetLoginOutcome, ToolsetLoginParams } from '../../oauth/useToolsetLogin/useToolsetLogin';
|
|
4
5
|
import { PendingSigninEvent } from '../../shared/client-channel';
|
|
5
|
-
import { SigninInterruptAnnouncement, SigninInterruptRow } from '../models';
|
|
6
|
+
import { SigninInterruptAnnouncement, SigninInterruptFocusRequest, SigninInterruptRow, SigninInterruptRunState } from '../models';
|
|
6
7
|
/** Host data and operations `useSigninInterrupt` resolves pending sign-in events with. */
|
|
7
8
|
export interface UseSigninInterruptOptions {
|
|
8
9
|
/** Pending client-channel sign-in events, in display order. */
|
|
@@ -23,8 +24,17 @@ export interface UseSigninInterruptOptions {
|
|
|
23
24
|
loginExternalService: (params: ExternalServiceLoginParams) => Promise<ExternalServiceLoginOutcome>;
|
|
24
25
|
/** Refreshes the host's toolset list after a successful toolset login, before success is reported. */
|
|
25
26
|
refetchToolsets: () => Promise<unknown>;
|
|
26
|
-
/**
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Reports an event's resolution on the client channel; a rejection leaves the event pending.
|
|
29
|
+
* Receives the channel the event was raised on as `channelId` whenever `channelId` is given.
|
|
30
|
+
*/
|
|
31
|
+
reportEvent: (eventId: string, result: ReportClientChannelDtoResultEnum, channelId?: string | null) => Promise<unknown>;
|
|
32
|
+
/** Current client-channel id; reports of a login are bound to the channel current when it started. */
|
|
33
|
+
channelId?: string | null;
|
|
34
|
+
/** Whether Log in all is offered. Defaults to `false`. */
|
|
35
|
+
isBulkLoginEnabled?: boolean;
|
|
36
|
+
/** Creates a bulk sign-in run for OAuth steps, e.g. `useToolsetLogin().createBatchSession`; required for Log in all with OAuth toolsets. */
|
|
37
|
+
createBatchSession?: (options: Omit<CreateToolsetOAuthBatchSessionOptions, 'callbackPath'>) => ToolsetOAuthBatchSession;
|
|
28
38
|
}
|
|
29
39
|
/** Rows, announcement and actions of a sign-in interrupt dialog. */
|
|
30
40
|
export interface UseSigninInterruptResult {
|
|
@@ -44,9 +54,23 @@ export interface UseSigninInterruptResult {
|
|
|
44
54
|
login: (eventId: string) => void;
|
|
45
55
|
/** Reports a row as `denied`. */
|
|
46
56
|
decline: (eventId: string) => Promise<void>;
|
|
47
|
-
/**
|
|
57
|
+
/** Stops a Log in all run, then declines every pending event. */
|
|
48
58
|
declineAll: () => void;
|
|
59
|
+
/** Resends only the outstanding success report of a row whose login succeeded. */
|
|
60
|
+
retryReport: (eventId: string) => Promise<void>;
|
|
61
|
+
/** Whether Log in all can start now. */
|
|
62
|
+
canLogInAll: boolean;
|
|
63
|
+
/** Progress of the active Log in all run, or `undefined` without one. */
|
|
64
|
+
run?: SigninInterruptRunState;
|
|
65
|
+
/** Starts Log in all; synchronous up to opening the run's window, so call it inside the click. */
|
|
66
|
+
logInAll: () => void;
|
|
67
|
+
/** Resumes a paused run; opens a replacement window inside the click when the run needs one. */
|
|
68
|
+
continueRun: () => void;
|
|
69
|
+
/** Stops the run without declining any pending event. */
|
|
70
|
+
stopRun: () => void;
|
|
71
|
+
/** Latest request to focus a row's API key field. */
|
|
72
|
+
apiKeyFocusRequest?: SigninInterruptFocusRequest;
|
|
49
73
|
}
|
|
50
74
|
/** Resolves pending sign-in events into dialog rows and runs their login, decline and result reporting. */
|
|
51
|
-
export declare const useSigninInterrupt: ({ pendingEvents, toolsets, activeLocale, primaryLocale, getToolset, getExternalService, loginToolset, loginExternalService, refetchToolsets, reportEvent, }: UseSigninInterruptOptions) => UseSigninInterruptResult;
|
|
75
|
+
export declare const useSigninInterrupt: ({ pendingEvents, toolsets, activeLocale, primaryLocale, getToolset, getExternalService, loginToolset, loginExternalService, refetchToolsets, reportEvent, channelId, isBulkLoginEnabled, createBatchSession, }: UseSigninInterruptOptions) => UseSigninInterruptResult;
|
|
52
76
|
//# sourceMappingURL=useSigninInterrupt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSigninInterrupt.d.ts","sourceRoot":"","sources":["../../../src/signin-interrupt/useSigninInterrupt/useSigninInterrupt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,6BAA6B,EAClC,gCAAgC,EACjC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAGL,KAAK,2BAA2B,EAEhC,KAAK,0BAA0B,EAChC,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"useSigninInterrupt.d.ts","sourceRoot":"","sources":["../../../src/signin-interrupt/use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