@epam/ai-dial-chat-hooks 1.3.0-dev.296 → 1.3.0-dev.304
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/catalog/application-credentials.d.ts.map +1 -1
- package/catalog/application-credentials.js +20 -25
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.d.ts.map +1 -1
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +72 -77
- package/conversation/useConversationScroll/useConversationScroll.d.ts.map +1 -1
- package/conversation/useConversationScroll/useConversationScroll.js +64 -63
- package/external-services/useExternalServiceLogin.d.ts +3 -13
- package/external-services/useExternalServiceLogin.d.ts.map +1 -1
- package/external-services/useExternalServiceLogin.js +49 -58
- package/index.js +168 -168
- package/mcp-apps/useMcpAppTools/useMcpAppTools.d.ts.map +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +42 -39
- package/oauth/authorize-url.d.ts +7 -1
- package/oauth/authorize-url.d.ts.map +1 -1
- package/oauth/authorize-url.js +13 -3
- package/oauth/models.d.ts +25 -0
- package/oauth/models.d.ts.map +1 -1
- package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -1
- package/oauth/useToolsetLogin/useToolsetLogin.js +45 -56
- package/oauth.js +7 -7
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-credentials.d.ts","sourceRoot":"","sources":["../../src/catalog/application-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"application-credentials.d.ts","sourceRoot":"","sources":["../../src/catalog/application-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,gCAAgC,EACtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,8CAA8C,CAAC;AAGtD,2DAA2D;AAC3D,MAAM,WAAW,gCAAgC;IAC/C,oGAAoG;IACpG,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,8EAA8E;AAC9E,eAAO,MAAM,yBAAyB,GACpC,UAAU,SAAS,6BAA6B,EAAE,EAClD,wCAAwC,gCAAgC,KACvE,qBAAqB,EA8BpB,CAAC;AAEL,gHAAgH;AAChH,eAAO,MAAM,qCAAqC,GAChD,OAAO,MAAM,EACb,SAAS,6BAA6B,EACtC,QAAQ,gCAAgC,KACvC,0BASD,CAAC"}
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { toToolsetOAuthSettings as e } from "../oauth/authorize-url.js";
|
|
2
|
+
import { ExternalServiceAuthStatus as t, ExternalServiceAuthType as n, ExternalServiceCredentialsLevel as r } from "../external-services/useExternalServiceLogin.js";
|
|
3
|
+
import { CredentialStatus as i, ToolsetAuthenticationType as a } from "@epam/ai-dial-catalog";
|
|
3
4
|
//#region src/catalog/application-credentials.ts
|
|
4
|
-
var
|
|
5
|
-
let s =
|
|
5
|
+
var o = (e, { isOfflineConnected: r, dialNativeHint: o }) => e.map((e) => {
|
|
6
|
+
let s = e.authenticationType === n.DialNative, c = s ? r && e.appLevelAuthStatus === t.SignedIn : e.userLevelAuthStatus === t.SignedIn;
|
|
6
7
|
return {
|
|
7
|
-
id:
|
|
8
|
-
name:
|
|
9
|
-
description:
|
|
10
|
-
authenticationType:
|
|
11
|
-
status: c ?
|
|
12
|
-
hasSharedCredentials: !s && !c && (
|
|
8
|
+
id: e.id,
|
|
9
|
+
name: e.displayName || e.id,
|
|
10
|
+
description: e.description,
|
|
11
|
+
authenticationType: e.authenticationType === n.ApiKey ? a.ApiKey : a.OAuth,
|
|
12
|
+
status: c ? i.SignedIn : i.SignedOut,
|
|
13
|
+
hasSharedCredentials: !s && !c && (e.globalAuthStatus === t.SignedIn || e.appLevelAuthStatus === t.SignedIn),
|
|
13
14
|
canLogout: !s,
|
|
14
15
|
canConsentToOfflineUsage: !s,
|
|
15
16
|
hint: s ? o : void 0
|
|
16
17
|
};
|
|
17
|
-
}),
|
|
18
|
-
appId:
|
|
19
|
-
serviceId:
|
|
20
|
-
...
|
|
21
|
-
credentialsLevel:
|
|
22
|
-
authenticationType:
|
|
23
|
-
oauthSettings:
|
|
24
|
-
|
|
25
|
-
authorizationEndpoint: r.authorizationEndpoint,
|
|
26
|
-
scopes: r.scopesSupported,
|
|
27
|
-
codeChallenge: r.codeChallenge,
|
|
28
|
-
codeChallengeMethod: r.codeChallengeMethod
|
|
29
|
-
},
|
|
30
|
-
forceStale: r.userLevelAuthStatus === e.Failed
|
|
18
|
+
}), s = (n, i, a) => ({
|
|
19
|
+
appId: n,
|
|
20
|
+
serviceId: i.id,
|
|
21
|
+
...a,
|
|
22
|
+
credentialsLevel: r.User,
|
|
23
|
+
authenticationType: i.authenticationType,
|
|
24
|
+
oauthSettings: e(i),
|
|
25
|
+
forceStale: i.userLevelAuthStatus === t.Failed
|
|
31
26
|
});
|
|
32
27
|
//#endregion
|
|
33
|
-
export {
|
|
28
|
+
export { s as buildApplicationCredentialLoginParams, o as mapApplicationCredentials };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCatalogToolsetCredentials.d.ts","sourceRoot":"","sources":["../../../src/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"useCatalogToolsetCredentials.d.ts","sourceRoot":"","sources":["../../../src/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,gBAAgB,EAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAU3D,2EAA2E;AAC3E,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iEAAiE;AACjE,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC7D,GAAG,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC5D,MAAM,EAAE,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;CAChE;AAED,2FAA2F;AAC3F,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,+BAA+B,CAAC;IAC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jB,MAAM,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAA;KAAE,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAwCD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,kHAU1C,kCAAkC,KAAG,kCA2KvC,CAAC"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { getApiErrorDetails as e } from "../../api-error/api-error.js";
|
|
2
2
|
import { ToolsetAuthTypes as t, ToolsetCredentialsLevel as n } from "../../oauth/types.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { toToolsetOAuthSettings as r } from "../../oauth/authorize-url.js";
|
|
4
|
+
import { ToolsetLoginOutcomeType as i, useToolsetLogin as a } from "../../oauth/useToolsetLogin/useToolsetLogin.js";
|
|
5
|
+
import { useCallback as o } from "react";
|
|
6
|
+
import { NotificationVariant as s } from "@epam/ai-dial-ui-kit";
|
|
7
|
+
import { CredentialStatus as c, CredentialsLevel as l, ToolsetAuthenticationType as u } from "@epam/ai-dial-catalog";
|
|
7
8
|
//#region src/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.ts
|
|
8
|
-
var
|
|
9
|
+
var d = (e, t, n) => e === l.User ? n.user : t ? n.org : n.global, f = (e) => {
|
|
9
10
|
switch (e) {
|
|
10
|
-
case
|
|
11
|
-
case
|
|
12
|
-
case
|
|
11
|
+
case u.ApiKey: return t.ApiKey;
|
|
12
|
+
case u.OAuth: return t.OAuth;
|
|
13
|
+
case u.None:
|
|
13
14
|
case void 0: return t.None;
|
|
14
15
|
}
|
|
15
|
-
},
|
|
16
|
-
let
|
|
16
|
+
}, p = ({ isAdmin: t, toolsets: p, refetchToolsets: m, callbackPath: h, loginToolset: g, logoutToolset: _, getToolset: v, labels: y, onNotify: b }) => {
|
|
17
|
+
let x = o((e, t) => t === l.User ? e.credentials?.userStatus : e.credentials?.globalStatus, []), S = o((e, n) => {
|
|
17
18
|
let r = t && !!e.credentials?.isPublic;
|
|
18
|
-
if (e.credentials?.authenticationType ===
|
|
19
|
-
let t =
|
|
20
|
-
|
|
21
|
-
variant:
|
|
22
|
-
title:
|
|
19
|
+
if (e.credentials?.authenticationType === u.ApiKey) {
|
|
20
|
+
let t = d(n, r, y.apiKeyAddedSuccess);
|
|
21
|
+
b({
|
|
22
|
+
variant: s.Success,
|
|
23
|
+
title: y.apiKeyAddedSuccessTitle,
|
|
23
24
|
message: t({
|
|
24
25
|
name: e.name,
|
|
25
26
|
version: e.version
|
|
@@ -27,10 +28,10 @@ var u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
|
|
|
27
28
|
});
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
let i =
|
|
31
|
-
|
|
32
|
-
variant:
|
|
33
|
-
title:
|
|
31
|
+
let i = d(n, r, y.loginSuccess);
|
|
32
|
+
b({
|
|
33
|
+
variant: s.Success,
|
|
34
|
+
title: y.loginSuccessTitle,
|
|
34
35
|
message: i({
|
|
35
36
|
name: e.name,
|
|
36
37
|
version: e.version
|
|
@@ -38,15 +39,15 @@ var u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
|
|
|
38
39
|
});
|
|
39
40
|
}, [
|
|
40
41
|
t,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
]),
|
|
42
|
+
y,
|
|
43
|
+
b
|
|
44
|
+
]), C = o((e, n) => {
|
|
44
45
|
let r = t && !!e.credentials?.isPublic;
|
|
45
|
-
if (e.credentials?.authenticationType ===
|
|
46
|
-
let t =
|
|
47
|
-
|
|
48
|
-
variant:
|
|
49
|
-
title:
|
|
46
|
+
if (e.credentials?.authenticationType === u.ApiKey) {
|
|
47
|
+
let t = d(n, r, y.apiKeyDeletedSuccess);
|
|
48
|
+
b({
|
|
49
|
+
variant: s.Success,
|
|
50
|
+
title: y.apiKeyDeletedSuccessTitle,
|
|
50
51
|
message: t({
|
|
51
52
|
name: e.name,
|
|
52
53
|
version: e.version
|
|
@@ -54,10 +55,10 @@ var u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
|
|
|
54
55
|
});
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
let i =
|
|
58
|
-
|
|
59
|
-
variant:
|
|
60
|
-
title:
|
|
58
|
+
let i = d(n, r, y.logoutSuccess);
|
|
59
|
+
b({
|
|
60
|
+
variant: s.Success,
|
|
61
|
+
title: y.logoutSuccessTitle,
|
|
61
62
|
message: i({
|
|
62
63
|
name: e.name,
|
|
63
64
|
version: e.version
|
|
@@ -65,82 +66,76 @@ var u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
|
|
|
65
66
|
});
|
|
66
67
|
}, [
|
|
67
68
|
t,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]), { login:
|
|
71
|
-
callbackPath:
|
|
72
|
-
loginToolset:
|
|
73
|
-
logoutToolset:
|
|
74
|
-
getToolset:
|
|
69
|
+
y,
|
|
70
|
+
b
|
|
71
|
+
]), { login: w } = a({
|
|
72
|
+
callbackPath: h,
|
|
73
|
+
loginToolset: g,
|
|
74
|
+
logoutToolset: _,
|
|
75
|
+
getToolset: v
|
|
75
76
|
});
|
|
76
77
|
return {
|
|
77
|
-
handleLogin:
|
|
78
|
-
let
|
|
79
|
-
switch ((await
|
|
78
|
+
handleLogin: o(async (e, t) => {
|
|
79
|
+
let a = e.credentials?.authenticationType, o = t.level === l.User ? n.User : n.Global, u = p.find((t) => t.id === e.id);
|
|
80
|
+
switch ((await w({
|
|
80
81
|
toolsetId: e.id,
|
|
81
|
-
credentialsLevel:
|
|
82
|
-
authenticationType:
|
|
82
|
+
credentialsLevel: o,
|
|
83
|
+
authenticationType: f(a),
|
|
83
84
|
apiKey: t.apiKey,
|
|
84
|
-
oauthSettings:
|
|
85
|
-
|
|
86
|
-
authorizationEndpoint: l?.authSettings?.authorizationEndpoint,
|
|
87
|
-
scopes: l?.authSettings?.scopesSupported,
|
|
88
|
-
codeChallenge: l?.authSettings?.codeChallenge,
|
|
89
|
-
codeChallengeMethod: l?.authSettings?.codeChallengeMethod
|
|
90
|
-
},
|
|
91
|
-
isCurrentlyFailed: b(e, t.level) === s.Failed
|
|
85
|
+
oauthSettings: r(u?.authSettings),
|
|
86
|
+
isCurrentlyFailed: x(e, t.level) === c.Failed
|
|
92
87
|
})).type) {
|
|
93
|
-
case
|
|
94
|
-
|
|
88
|
+
case i.Success:
|
|
89
|
+
S(e, t.level), await m();
|
|
95
90
|
return;
|
|
96
|
-
case
|
|
97
|
-
|
|
98
|
-
variant:
|
|
99
|
-
message:
|
|
91
|
+
case i.PopupBlocked:
|
|
92
|
+
b({
|
|
93
|
+
variant: s.Error,
|
|
94
|
+
message: y.popupBlockedError
|
|
100
95
|
});
|
|
101
96
|
return;
|
|
102
|
-
case
|
|
103
|
-
|
|
104
|
-
variant:
|
|
105
|
-
message:
|
|
97
|
+
case i.Failure:
|
|
98
|
+
b({
|
|
99
|
+
variant: s.Error,
|
|
100
|
+
message: y.loginFailedError
|
|
106
101
|
});
|
|
107
102
|
return;
|
|
108
|
-
case
|
|
103
|
+
case i.Cancelled: return;
|
|
109
104
|
}
|
|
110
105
|
}, [
|
|
111
|
-
|
|
112
|
-
v,
|
|
106
|
+
p,
|
|
113
107
|
y,
|
|
114
108
|
b,
|
|
115
109
|
x,
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
S,
|
|
111
|
+
m,
|
|
112
|
+
w
|
|
118
113
|
]),
|
|
119
|
-
handleLogout:
|
|
120
|
-
let i = r.level ===
|
|
114
|
+
handleLogout: o(async (t, r) => {
|
|
115
|
+
let i = r.level === l.User ? n.User : n.Global;
|
|
121
116
|
try {
|
|
122
117
|
let e = {
|
|
123
118
|
url: t.id,
|
|
124
119
|
credentialsLevel: i,
|
|
125
120
|
authenticationType: t.credentials?.authenticationType
|
|
126
121
|
};
|
|
127
|
-
await
|
|
122
|
+
await _(t.id, e), C(t, r.level), await m();
|
|
128
123
|
} catch (t) {
|
|
129
124
|
let { traceId: n } = await e(t);
|
|
130
|
-
|
|
131
|
-
variant:
|
|
132
|
-
message:
|
|
125
|
+
b({
|
|
126
|
+
variant: s.Error,
|
|
127
|
+
message: y.logoutFailedError,
|
|
133
128
|
requestId: n
|
|
134
129
|
});
|
|
135
130
|
}
|
|
136
131
|
}, [
|
|
137
|
-
|
|
138
|
-
v,
|
|
132
|
+
_,
|
|
139
133
|
y,
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
b,
|
|
135
|
+
C,
|
|
136
|
+
m
|
|
142
137
|
])
|
|
143
138
|
};
|
|
144
139
|
};
|
|
145
140
|
//#endregion
|
|
146
|
-
export {
|
|
141
|
+
export { p as useCatalogToolsetCredentials };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConversationScroll.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationScroll/useConversationScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,+HAA+H;AAC/H,MAAM,WAAW,2BAA2B,CAAC,CAAC;IAC5C,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,+DAA+D;IAC/D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,2BAA2B;IAC1C,qDAAqD;IACrD,YAAY,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,4FAA4F;IAC5F,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C,kFAAkF;IAClF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAClE,2DAA2D;IAC3D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,kDAItC,2BAA2B,CAAC,CAAC,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"useConversationScroll.d.ts","sourceRoot":"","sources":["../../../src/conversation/useConversationScroll/useConversationScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,+HAA+H;AAC/H,MAAM,WAAW,2BAA2B,CAAC,CAAC;IAC5C,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,EAAE,CAAC;IACd,+DAA+D;IAC/D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,2BAA2B;IAC1C,qDAAqD;IACrD,YAAY,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,4FAA4F;IAC5F,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC5C,kFAAkF;IAClF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAClE,2DAA2D;IAC3D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,EAAE,kDAItC,2BAA2B,CAAC,CAAC,CAAC,KAAG,2BAmVnC,CAAC"}
|
|
@@ -1,121 +1,122 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
2
2
|
//#region src/conversation/useConversationScroll/useConversationScroll.ts
|
|
3
3
|
var a = 80, o = 1, s = ({ messages: s, isAssistantTyping: c, conversationId: l }) => {
|
|
4
|
-
let [u, d] = i(!1), f = r(null), p = r(null), m = r(null), h = r(!1), g = r(!1), _ = r(null), v = r(!0), y = r(/* @__PURE__ */ new Map()),
|
|
5
|
-
t ?
|
|
6
|
-
}, []),
|
|
7
|
-
|
|
8
|
-
}, []),
|
|
4
|
+
let [u, d] = i(!1), f = r(null), p = r(null), m = r(null), h = r(!1), g = r(!1), _ = r(null), v = r(!0), y = r(!1), b = r(0), x = r(/* @__PURE__ */ new Map()), S = e((e, t) => {
|
|
5
|
+
t ? x.current.set(e, t) : x.current.delete(e);
|
|
6
|
+
}, []), C = r(null), w = e((e) => {
|
|
7
|
+
C.current = e;
|
|
8
|
+
}, []), T = e((e, t) => {
|
|
9
9
|
let n = f.current;
|
|
10
10
|
n && n.scrollTo({
|
|
11
11
|
top: e,
|
|
12
12
|
behavior: t ? "instant" : "smooth"
|
|
13
13
|
});
|
|
14
|
-
}, []),
|
|
14
|
+
}, []), E = e(() => {
|
|
15
15
|
m.current && (m.current.style.height = "0px"), h.current = !1, g.current = !1, _.current = null;
|
|
16
|
-
}, []),
|
|
16
|
+
}, []), D = e(() => {
|
|
17
17
|
let e = f.current, t = p.current;
|
|
18
18
|
if (!e || !t) return null;
|
|
19
19
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
20
20
|
return e.scrollTop + (r.bottom - n.top) - e.clientHeight;
|
|
21
|
-
}, []),
|
|
22
|
-
let t =
|
|
23
|
-
t != null &&
|
|
24
|
-
}, [
|
|
21
|
+
}, []), O = e((e = !1) => {
|
|
22
|
+
let t = D();
|
|
23
|
+
t != null && T(Math.max(t, 0), e);
|
|
24
|
+
}, [T, D]), k = e(() => {
|
|
25
25
|
let e = f.current, t = p.current;
|
|
26
26
|
if (!e || !t) return null;
|
|
27
27
|
let n = e.getBoundingClientRect();
|
|
28
28
|
return t.getBoundingClientRect().bottom - n.top - e.clientHeight;
|
|
29
|
-
}, []),
|
|
29
|
+
}, []), A = e(() => {
|
|
30
30
|
if (!g.current) return;
|
|
31
|
-
let e =
|
|
32
|
-
e == null || e < -1 ||
|
|
33
|
-
}, [
|
|
34
|
-
let t = f.current, n =
|
|
31
|
+
let e = k();
|
|
32
|
+
e == null || e < -1 || E();
|
|
33
|
+
}, [E, k]), j = e((e) => {
|
|
34
|
+
let t = f.current, n = x.current.get(e);
|
|
35
35
|
if (!t || !n) return null;
|
|
36
36
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = t.scrollTop + (i.top - r.top);
|
|
37
37
|
return Math.max(a, 0);
|
|
38
|
-
}, []),
|
|
39
|
-
let n =
|
|
40
|
-
n != null &&
|
|
41
|
-
}, [
|
|
42
|
-
let e =
|
|
38
|
+
}, []), M = e((e, t = !1) => {
|
|
39
|
+
let n = j(e);
|
|
40
|
+
n != null && T(n, t);
|
|
41
|
+
}, [j, T]), N = e(() => {
|
|
42
|
+
let e = D();
|
|
43
43
|
return e == null ? null : Math.max(e, 0);
|
|
44
|
-
}, [
|
|
44
|
+
}, [D]), P = e(() => {
|
|
45
45
|
if (!h.current) return null;
|
|
46
|
-
let e = _.current, t =
|
|
46
|
+
let e = _.current, t = N();
|
|
47
47
|
return e == null || t == null ? null : Math.max(e, t);
|
|
48
|
-
}, [
|
|
49
|
-
let e = f.current, t =
|
|
48
|
+
}, [N]), F = e(() => {
|
|
49
|
+
let e = f.current, t = P();
|
|
50
50
|
e && t != null && e.scrollTop > t + o && (e.scrollTop = t);
|
|
51
|
-
}, [
|
|
52
|
-
let t = m.current, n =
|
|
51
|
+
}, [P]), I = e((e) => {
|
|
52
|
+
let t = m.current, n = N();
|
|
53
53
|
if (!t || n == null) return;
|
|
54
54
|
let r = Math.max(e - n, 0);
|
|
55
55
|
t.style.height = `${r}px`, h.current = r > 0, g.current = !1, _.current = r > 0 ? e : null;
|
|
56
|
-
}, [
|
|
57
|
-
let t =
|
|
58
|
-
t != null && (
|
|
56
|
+
}, [N]), L = e((e) => {
|
|
57
|
+
let t = j(e);
|
|
58
|
+
t != null && (I(t), M(e, !1));
|
|
59
59
|
}, [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]),
|
|
64
|
-
let e =
|
|
60
|
+
I,
|
|
61
|
+
j,
|
|
62
|
+
M
|
|
63
|
+
]), R = e(() => {
|
|
64
|
+
let e = k();
|
|
65
65
|
if (e == null) return;
|
|
66
66
|
let t = e < a;
|
|
67
67
|
v.current = t, d(!t);
|
|
68
|
-
}, [
|
|
68
|
+
}, [k]), z = r(s.length), B = r(null);
|
|
69
69
|
n(() => {
|
|
70
|
-
let e = s.length !==
|
|
71
|
-
|
|
70
|
+
let e = s.length !== z.current, t = l !== B.current, n = () => {
|
|
71
|
+
z.current = s.length, B.current = l;
|
|
72
72
|
};
|
|
73
|
-
t &&
|
|
74
|
-
let r =
|
|
75
|
-
r != null &&
|
|
73
|
+
t && (E(), y.current = !1);
|
|
74
|
+
let r = C.current;
|
|
75
|
+
r != null && x.current.has(r) ? (C.current = null, y.current = !1, L(r), n()) : c ? y.current = !1 : ((e || t) && (y.current = !0, O(!1)), n());
|
|
76
76
|
}, [
|
|
77
77
|
s,
|
|
78
78
|
c,
|
|
79
79
|
l,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
O,
|
|
81
|
+
L,
|
|
82
|
+
E
|
|
83
83
|
]), n(() => {
|
|
84
|
-
!c && h.current && (g.current = !0,
|
|
85
|
-
}, [c,
|
|
86
|
-
let
|
|
87
|
-
|
|
84
|
+
!c && h.current && (g.current = !0, A());
|
|
85
|
+
}, [c, A]);
|
|
86
|
+
let V = e(() => {
|
|
87
|
+
let e = f.current;
|
|
88
|
+
e && (e.scrollTop < b.current - o && (y.current = !1), b.current = e.scrollTop), F(), A(), R();
|
|
88
89
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
F,
|
|
91
|
+
A,
|
|
92
|
+
R
|
|
92
93
|
]);
|
|
93
94
|
return t(() => {
|
|
94
95
|
let e = f.current;
|
|
95
|
-
if (e) return e.addEventListener("scroll",
|
|
96
|
-
}, [
|
|
96
|
+
if (e) return e.addEventListener("scroll", V, { passive: !0 }), () => e.removeEventListener("scroll", V);
|
|
97
|
+
}, [V]), t(() => {
|
|
97
98
|
let e = p.current;
|
|
98
99
|
if (!e) return;
|
|
99
100
|
let t = new ResizeObserver(() => {
|
|
100
|
-
let e = v.current && !h.current;
|
|
101
|
-
|
|
101
|
+
let e = (v.current || y.current) && !h.current;
|
|
102
|
+
F(), e && O(!0), A(), R();
|
|
102
103
|
});
|
|
103
104
|
return t.observe(e), () => t.disconnect();
|
|
104
105
|
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
F,
|
|
107
|
+
A,
|
|
108
|
+
R,
|
|
109
|
+
O
|
|
109
110
|
]), {
|
|
110
111
|
containerRef: f,
|
|
111
112
|
contentRef: p,
|
|
112
113
|
spacerRef: m,
|
|
113
|
-
setMessageRef:
|
|
114
|
+
setMessageRef: S,
|
|
114
115
|
isScrollButtonVisible: u,
|
|
115
116
|
scrollToBottom: e(() => {
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
armAnchor:
|
|
117
|
+
O(!1);
|
|
118
|
+
}, [O]),
|
|
119
|
+
armAnchor: w
|
|
119
120
|
};
|
|
120
121
|
};
|
|
121
122
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GetExternalServiceResponseDto, ExternalServiceSigninBodyDto, ExternalServiceLogoutBodyDto, GetOfflineCredentialsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { ToolsetOAuthSettings } from '../oauth/models';
|
|
2
3
|
import { useOfflineCredentialsLogin } from '../offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin';
|
|
3
4
|
/** External-service authentication method. */
|
|
4
5
|
export declare enum ExternalServiceAuthType {
|
|
@@ -34,19 +35,8 @@ export interface ExternalServiceLoginOptions {
|
|
|
34
35
|
/** Composes the existing offline login protocol. */
|
|
35
36
|
loginOfflineCredentials: ReturnType<typeof useOfflineCredentialsLogin>['login'];
|
|
36
37
|
}
|
|
37
|
-
/** OAuth client settings needed to build the authorize URL —
|
|
38
|
-
export
|
|
39
|
-
/** OAuth client identity. */
|
|
40
|
-
clientId?: string;
|
|
41
|
-
/** Authorize URL supplied by the host. */
|
|
42
|
-
authorizationEndpoint?: string;
|
|
43
|
-
/** Requested OAuth scopes. */
|
|
44
|
-
scopes?: string[];
|
|
45
|
-
/** PKCE challenge. */
|
|
46
|
-
codeChallenge?: string;
|
|
47
|
-
/** PKCE challenge method. */
|
|
48
|
-
codeChallengeMethod?: string;
|
|
49
|
-
}
|
|
38
|
+
/** OAuth client settings needed to build the authorize URL — the same shape a toolset login takes. */
|
|
39
|
+
export type ExternalServiceOAuthSettings = ToolsetOAuthSettings;
|
|
50
40
|
/** Terminal external-service login outcome. */
|
|
51
41
|
export declare enum ExternalServiceLoginOutcomeType {
|
|
52
42
|
Success = "success",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExternalServiceLogin.d.ts","sourceRoot":"","sources":["../../src/external-services/useExternalServiceLogin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAC5B,4BAA4B,EAC5B,gCAAgC,EACjC,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"useExternalServiceLogin.d.ts","sourceRoot":"","sources":["../../src/external-services/useExternalServiceLogin.ts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