@epam/ai-dial-chat-hooks 1.3.0-dev.294 → 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.
@@ -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;AAEtD,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,0BAeD,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 { ExternalServiceAuthStatus as e, ExternalServiceAuthType as t, ExternalServiceCredentialsLevel as n } from "../external-services/useExternalServiceLogin.js";
2
- import { CredentialStatus as r, ToolsetAuthenticationType as i } from "@epam/ai-dial-catalog";
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 a = (n, { isOfflineConnected: a, dialNativeHint: o }) => n.map((n) => {
5
- let s = n.authenticationType === t.DialNative, c = s ? a && n.appLevelAuthStatus === e.SignedIn : n.userLevelAuthStatus === e.SignedIn;
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: n.id,
8
- name: n.displayName || n.id,
9
- description: n.description,
10
- authenticationType: n.authenticationType === t.ApiKey ? i.ApiKey : i.OAuth,
11
- status: c ? r.SignedIn : r.SignedOut,
12
- hasSharedCredentials: !s && !c && (n.globalAuthStatus === e.SignedIn || n.appLevelAuthStatus === e.SignedIn),
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
- }), o = (t, r, i) => ({
18
- appId: t,
19
- serviceId: r.id,
20
- ...i,
21
- credentialsLevel: n.User,
22
- authenticationType: r.authenticationType,
23
- oauthSettings: {
24
- clientId: r.clientId,
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 { o as buildApplicationCredentialLoginParams, a as mapApplicationCredentials };
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;AAS3D,2EAA2E;AAC3E,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,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kFAAkF;IAClF,aAAa,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,KACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,oEAAoE;IACpE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3D,yDAAyD;IACzD,MAAM,EAAE,wBAAwB,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,CAAC,YAAY,EAAE,8BAA8B,KAAK,IAAI,CAAC;CAClE;AAED,4DAA4D;AAC5D,MAAM,WAAW,kCAAkC;IACjD,WAAW,EAAE,CACX,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACjD,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,YAAY,EAAE,CACZ,IAAI,EAAE,WAAW,EACjB,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,kCAiLvC,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,KA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B,KACtB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,kFAAkF;IAClF,aAAa,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,KACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,oEAAoE;IACpE,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3D,yDAAyD;IACzD,MAAM,EAAE,wBAAwB,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,CAAC,YAAY,EAAE,8BAA8B,KAAK,IAAI,CAAC;CAClE;AAED,4DAA4D;AAC5D,MAAM,WAAW,kCAAkC;IACjD,WAAW,EAAE,CACX,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE;QAAE,KAAK,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KACjD,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,YAAY,EAAE,CACZ,IAAI,EAAE,WAAW,EACjB,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 { ToolsetLoginOutcomeType as r, useToolsetLogin as i } from "../../oauth/useToolsetLogin/useToolsetLogin.js";
4
- import { useCallback as a } from "react";
5
- import { NotificationVariant as o } from "@epam/ai-dial-ui-kit";
6
- import { CredentialStatus as s, CredentialsLevel as c, ToolsetAuthenticationType as l } from "@epam/ai-dial-catalog";
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 u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
9
+ var d = (e, t, n) => e === l.User ? n.user : t ? n.org : n.global, f = (e) => {
9
10
  switch (e) {
10
- case l.ApiKey: return t.ApiKey;
11
- case l.OAuth: return t.OAuth;
12
- case l.None:
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
- }, f = ({ isAdmin: t, toolsets: f, refetchToolsets: p, callbackPath: m, loginToolset: h, logoutToolset: g, getToolset: _, labels: v, onNotify: y }) => {
16
- let b = a((e, t) => t === c.User ? e.credentials?.userStatus : e.credentials?.globalStatus, []), x = a((e, n) => {
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 === l.ApiKey) {
19
- let t = u(n, r, v.apiKeyAddedSuccess);
20
- y({
21
- variant: o.Success,
22
- title: v.apiKeyAddedSuccessTitle,
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 = u(n, r, v.loginSuccess);
31
- y({
32
- variant: o.Success,
33
- title: v.loginSuccessTitle,
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
- v,
42
- y
43
- ]), S = a((e, n) => {
42
+ y,
43
+ b
44
+ ]), C = o((e, n) => {
44
45
  let r = t && !!e.credentials?.isPublic;
45
- if (e.credentials?.authenticationType === l.ApiKey) {
46
- let t = u(n, r, v.apiKeyDeletedSuccess);
47
- y({
48
- variant: o.Success,
49
- title: v.apiKeyDeletedSuccessTitle,
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 = u(n, r, v.logoutSuccess);
58
- y({
59
- variant: o.Success,
60
- title: v.logoutSuccessTitle,
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
- v,
69
- y
70
- ]), { login: C } = i({
71
- callbackPath: m,
72
- loginToolset: h,
73
- logoutToolset: g,
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: a(async (e, t) => {
78
- let i = e.credentials?.authenticationType, a = t.level === c.User ? n.User : n.Global, l = f.find((t) => t.id === e.id);
79
- switch ((await C({
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: a,
82
- authenticationType: d(i),
82
+ credentialsLevel: o,
83
+ authenticationType: f(a),
83
84
  apiKey: t.apiKey,
84
- oauthSettings: {
85
- clientId: l?.authSettings?.clientId,
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 r.Success:
94
- x(e, t.level), await p();
88
+ case i.Success:
89
+ S(e, t.level), await m();
95
90
  return;
96
- case r.PopupBlocked:
97
- y({
98
- variant: o.Error,
99
- message: v.popupBlockedError
91
+ case i.PopupBlocked:
92
+ b({
93
+ variant: s.Error,
94
+ message: y.popupBlockedError
100
95
  });
101
96
  return;
102
- case r.Failure:
103
- y({
104
- variant: o.Error,
105
- message: v.loginFailedError
97
+ case i.Failure:
98
+ b({
99
+ variant: s.Error,
100
+ message: y.loginFailedError
106
101
  });
107
102
  return;
108
- case r.Cancelled: return;
103
+ case i.Cancelled: return;
109
104
  }
110
105
  }, [
111
- f,
112
- v,
106
+ p,
113
107
  y,
114
108
  b,
115
109
  x,
116
- p,
117
- C
110
+ S,
111
+ m,
112
+ w
118
113
  ]),
119
- handleLogout: a(async (t, r) => {
120
- let i = r.level === c.User ? n.User : n.Global;
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 g(t.id, e), S(t, r.level), await p();
122
+ await _(t.id, e), C(t, r.level), await m();
128
123
  } catch (t) {
129
124
  let { traceId: n } = await e(t);
130
- y({
131
- variant: o.Error,
132
- message: v.logoutFailedError,
125
+ b({
126
+ variant: s.Error,
127
+ message: y.logoutFailedError,
133
128
  requestId: n
134
129
  });
135
130
  }
136
131
  }, [
137
- g,
138
- v,
132
+ _,
139
133
  y,
140
- S,
141
- p
134
+ b,
135
+ C,
136
+ m
142
137
  ])
143
138
  };
144
139
  };
145
140
  //#endregion
146
- export { f as useCatalogToolsetCredentials };
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,2BAwTnC,CAAC"}
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()), b = e((e, t) => {
5
- t ? y.current.set(e, t) : y.current.delete(e);
6
- }, []), x = r(null), S = e((e) => {
7
- x.current = e;
8
- }, []), C = e((e, t) => {
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
- }, []), w = e(() => {
14
+ }, []), E = e(() => {
15
15
  m.current && (m.current.style.height = "0px"), h.current = !1, g.current = !1, _.current = null;
16
- }, []), T = e(() => {
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
- }, []), E = e((e = !1) => {
22
- let t = T();
23
- t != null && C(Math.max(t, 0), e);
24
- }, [C, T]), D = e(() => {
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
- }, []), O = e(() => {
29
+ }, []), A = e(() => {
30
30
  if (!g.current) return;
31
- let e = D();
32
- e == null || e < -1 || w();
33
- }, [w, D]), k = e((e) => {
34
- let t = f.current, n = y.current.get(e);
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
- }, []), A = e((e, t = !1) => {
39
- let n = k(e);
40
- n != null && C(n, t);
41
- }, [k, C]), j = e(() => {
42
- let e = T();
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
- }, [T]), M = e(() => {
44
+ }, [D]), P = e(() => {
45
45
  if (!h.current) return null;
46
- let e = _.current, t = j();
46
+ let e = _.current, t = N();
47
47
  return e == null || t == null ? null : Math.max(e, t);
48
- }, [j]), N = e(() => {
49
- let e = f.current, t = M();
48
+ }, [N]), F = e(() => {
49
+ let e = f.current, t = P();
50
50
  e && t != null && e.scrollTop > t + o && (e.scrollTop = t);
51
- }, [M]), P = e((e) => {
52
- let t = m.current, n = j();
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
- }, [j]), F = e((e) => {
57
- let t = k(e);
58
- t != null && (P(t), A(e, !1));
56
+ }, [N]), L = e((e) => {
57
+ let t = j(e);
58
+ t != null && (I(t), M(e, !1));
59
59
  }, [
60
- P,
61
- k,
62
- A
63
- ]), I = e(() => {
64
- let e = D();
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
- }, [D]), L = r(s.length), R = r(null);
68
+ }, [k]), z = r(s.length), B = r(null);
69
69
  n(() => {
70
- let e = s.length !== L.current, t = l !== R.current, n = () => {
71
- L.current = s.length, R.current = l;
70
+ let e = s.length !== z.current, t = l !== B.current, n = () => {
71
+ z.current = s.length, B.current = l;
72
72
  };
73
- t && w();
74
- let r = x.current;
75
- r != null && y.current.has(r) ? (x.current = null, F(r), n()) : c || ((e || t) && E(!1), n());
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
- E,
81
- F,
82
- w
80
+ O,
81
+ L,
82
+ E
83
83
  ]), n(() => {
84
- !c && h.current && (g.current = !0, O());
85
- }, [c, O]);
86
- let z = e(() => {
87
- N(), O(), I();
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
- N,
90
- O,
91
- I
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", z, { passive: !0 }), () => e.removeEventListener("scroll", z);
96
- }, [z]), t(() => {
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
- N(), e && E(!0), O(), I();
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
- N,
106
- O,
107
- I,
108
- E
106
+ F,
107
+ A,
108
+ R,
109
+ O
109
110
  ]), {
110
111
  containerRef: f,
111
112
  contentRef: p,
112
113
  spacerRef: m,
113
- setMessageRef: b,
114
+ setMessageRef: S,
114
115
  isScrollButtonVisible: u,
115
116
  scrollToBottom: e(() => {
116
- E(!1);
117
- }, [E]),
118
- armAnchor: S
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 — a subset of an external service's `auth_settings`. */
38
- export interface ExternalServiceOAuthSettings {
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;AAevC,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,8EAA8E,CAAC;AAGtF,8CAA8C;AAC9C,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,MAAM,YAAY;IAClB,KAAK,UAAU;IACf,UAAU,gBAAgB;CAC3B;AACD,wFAAwF;AACxF,oBAAY,yBAAyB;IACnC,QAAQ,cAAc;IACtB,SAAS,eAAe;IACxB,MAAM,WAAW;CAClB;AACD,kCAAkC;AAClC,oBAAY,+BAA+B;IACzC,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,IAAI,SAAS;CACd;AACD,sDAAsD;AACtD,MAAM,WAAW,2BAA2B;IAC1C,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC5C,sCAAsC;IACtC,qBAAqB,EAAE,CACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,4BAA4B,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,gCAAgC;IAChC,sBAAsB,EAAE,CACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,4BAA4B,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,2CAA2C;IAC3C,qBAAqB,EAAE,MAAM,OAAO,CAAC,gCAAgC,CAAC,CAAC;IACvE,oDAAoD;IACpD,uBAAuB,EAAE,UAAU,CACjC,OAAO,0BAA0B,CAClC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A0B,KAC/B,OAAO,CAAC,2BAA2B,CAAC,CAAC;CA0P3C,CAAC"}
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;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAW5D,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,8EAA8E,CAAC;AAGtF,8CAA8C;AAC9C,oBAAY,uBAAuB;IACjC,IAAI,SAAS;IACb,MAAM,YAAY;IAClB,KAAK,UAAU;IACf,UAAU,gBAAgB;CAC3B;AACD,wFAAwF;AACxF,oBAAY,yBAAyB;IACnC,QAAQ,cAAc;IACtB,SAAS,eAAe;IACxB,MAAM,WAAW;CAClB;AACD,kCAAkC;AAClC,oBAAY,+BAA+B;IACzC,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,IAAI,SAAS;CACd;AACD,sDAAsD;AACtD,MAAM,WAAW,2BAA2B;IAC1C,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,kBAAkB,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC5C,sCAAsC;IACtC,qBAAqB,EAAE,CACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,4BAA4B,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,gCAAgC;IAChC,sBAAsB,EAAE,CACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,4BAA4B,KAC/B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,2CAA2C;IAC3C,qBAAqB,EAAE,MAAM,O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