@epam/ai-dial-chat-hooks 1.3.0-dev.276 → 1.3.0-dev.282

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.
Files changed (76) hide show
  1. package/attachment/attach-constraints.d.ts +31 -0
  2. package/attachment/attach-constraints.d.ts.map +1 -0
  3. package/attachment/attach-constraints.js +18 -0
  4. package/attachments.js +2 -1
  5. package/catalog/catalog-derivations.d.ts +2 -0
  6. package/catalog/catalog-derivations.d.ts.map +1 -1
  7. package/catalog/catalog-derivations.js +12 -6
  8. package/catalog/usage-limit-rows.d.ts +14 -0
  9. package/catalog/usage-limit-rows.d.ts.map +1 -0
  10. package/catalog/usage-limit-rows.js +19 -0
  11. package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +24 -24
  12. package/catalog.js +17 -16
  13. package/conversation/conversation-list.d.ts +6 -0
  14. package/conversation/conversation-list.d.ts.map +1 -0
  15. package/conversation/conversation-list.js +5 -0
  16. package/conversation/message-utils.d.ts +6 -0
  17. package/conversation/message-utils.d.ts.map +1 -1
  18. package/conversation/message-utils.js +14 -10
  19. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +4 -2
  20. package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +1 -1
  21. package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -12
  22. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts +16 -0
  23. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts.map +1 -0
  24. package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.js +17 -0
  25. package/conversation.js +35 -33
  26. package/entry-points/attachments.d.ts +1 -0
  27. package/entry-points/attachments.d.ts.map +1 -1
  28. package/entry-points/catalog.d.ts +1 -0
  29. package/entry-points/catalog.d.ts.map +1 -1
  30. package/entry-points/conversation.d.ts +2 -0
  31. package/entry-points/conversation.d.ts.map +1 -1
  32. package/entry-points/file-manager.d.ts +1 -0
  33. package/entry-points/file-manager.d.ts.map +1 -1
  34. package/entry-points/offline-credentials.d.ts +1 -0
  35. package/entry-points/offline-credentials.d.ts.map +1 -1
  36. package/file-manager-canvas.js +3 -3
  37. package/file-manager.js +32 -31
  38. package/files/attachment-canvas.d.ts +12 -0
  39. package/files/attachment-canvas.d.ts.map +1 -1
  40. package/files/attachment-canvas.js +18 -10
  41. package/files/dial-file.d.ts +17 -0
  42. package/files/dial-file.d.ts.map +1 -1
  43. package/files/dial-file.js +20 -12
  44. package/files/useDialFileListing/useDialFileListing.js +111 -111
  45. package/files/useDialFileMutations/useDialFileMutations.js +22 -22
  46. package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts +23 -0
  47. package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts.map +1 -0
  48. package/files/useUnshareConfirmationState/useUnshareConfirmationState.js +18 -0
  49. package/index.d.ts +6 -0
  50. package/index.d.ts.map +1 -1
  51. package/index.js +204 -197
  52. package/oauth/toolset-id.d.ts +7 -0
  53. package/oauth/toolset-id.d.ts.map +1 -1
  54. package/oauth/toolset-id.js +9 -2
  55. package/oauth.js +8 -8
  56. package/offline-credentials/scheduled-tasks-login-banner.d.ts +31 -0
  57. package/offline-credentials/scheduled-tasks-login-banner.d.ts.map +1 -0
  58. package/offline-credentials/scheduled-tasks-login-banner.js +17 -0
  59. package/offline-credentials.js +3 -2
  60. package/package.json +18 -18
  61. package/project/use-project-actions.d.ts +1 -2
  62. package/project/use-project-actions.d.ts.map +1 -1
  63. package/project/use-project-actions.js +7 -20
  64. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  65. package/scheduled-task/scheduled-task-trigger.js +7 -8
  66. package/shared/external-services.d.ts +1 -1
  67. package/shared/usage-stat.d.ts +3 -0
  68. package/shared/usage-stat.d.ts.map +1 -0
  69. package/shared/usage-stat.js +4 -0
  70. package/usage/usage-banner-source.d.ts +2 -2
  71. package/usage/usage-banner-source.d.ts.map +1 -1
  72. package/usage/usage-banner-source.js +19 -18
  73. package/usage-limits.js +4 -3
  74. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +2 -0
  75. package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +1 -1
  76. package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +25 -21
@@ -0,0 +1,31 @@
1
+ /** The limits an attach dialog enforces; an absent or non-positive value is no limit. */
2
+ export interface AttachConstraints {
3
+ /** Allowed MIME types; `*` or `*\/*` allows every type. */
4
+ allowedTypes?: readonly string[];
5
+ /** Host-written label for the allowed types, used instead of one derived from `allowedTypes`. */
6
+ allowedTypesLabel?: string;
7
+ /** Largest file size, in bytes. */
8
+ maxFileSize?: number;
9
+ /** Most files per attach. */
10
+ maxCount?: number;
11
+ }
12
+ /** Localized pieces of the constraint description. */
13
+ export interface AttachConstraintLabels {
14
+ /** Type label when every type is allowed, e.g. `'All types'`. */
15
+ allTypes: string;
16
+ /** Sentence naming the size limit and the allowed types. */
17
+ maxSizeWithTypes: (maxSize: string, allowedTypes: string) => string;
18
+ /** Sentence naming only the size limit. */
19
+ maxSizeOnly: (maxSize: string) => string;
20
+ /** Sentence naming the file-count limit. */
21
+ upToFiles: (count: number) => string;
22
+ }
23
+ /** Returns `true` when the MIME-type list allows every type (`*` or `*\/*`). */
24
+ export declare const areAllMimeTypesAllowed: (types: readonly string[]) => boolean;
25
+ /**
26
+ * Returns the attach dialog's constraint description — the size and type
27
+ * limits as one sentence, then the count limit, joined with `. ` and ending
28
+ * in `.` — or `null` when nothing is limited.
29
+ */
30
+ export declare const buildAttachConstraintDescription: (constraints: AttachConstraints, labels: AttachConstraintLabels) => string | null;
31
+ //# sourceMappingURL=attach-constraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attach-constraints.d.ts","sourceRoot":"","sources":["../../src/attachment/attach-constraints.ts"],"names":[],"mappings":"AAGA,yFAAyF;AACzF,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iGAAiG;IACjG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mCAAmC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,sDAAsD;AACtD,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IACpE,2CAA2C;IAC3C,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,4CAA4C;IAC5C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC;AAED,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,GAAI,OAAO,SAAS,MAAM,EAAE,KAAG,OACZ,CAAC;AAYvD;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,GAC3C,aAAa,iBAAiB,EAC9B,QAAQ,sBAAsB,KAC7B,MAAM,GAAG,IA+BX,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { formatFileSize as e } from "@epam/ai-dial-chat-shared";
2
+ import { mimeTypesToExtensionLabels as t } from "@epam/ai-dial-attachment-input";
3
+ //#region src/attachment/attach-constraints.ts
4
+ var n = (e) => e.some((e) => e === "*" || e === "*/*"), r = ({ allowedTypes: e, allowedTypesLabel: r }, i) => {
5
+ if (r != null) return r;
6
+ if (e != null && e.length !== 0) return n(e) ? i.allTypes : t([...e]);
7
+ }, i = (t, n) => {
8
+ let { allowedTypes: i, maxFileSize: a, maxCount: o } = t, s = i != null && i.length > 0, c = a != null && a > 0, l = o != null && o > 0 && Number.isFinite(o);
9
+ if (!s && !c && !l) return null;
10
+ let u = [];
11
+ if (s || c) {
12
+ let i = r(t, n), o = c ? e(a) : void 0;
13
+ i != null && o != null ? u.push(n.maxSizeWithTypes(o, i)) : o == null ? i != null && u.push(i) : u.push(n.maxSizeOnly(o));
14
+ }
15
+ return l && u.push(n.upToFiles(o)), `${u.join(". ")}.`;
16
+ };
17
+ //#endregion
18
+ export { n as areAllMimeTypesAllowed, i as buildAttachConstraintDescription };
package/attachments.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import { downloadAttachment as e, isDownloadableAttachment as t, useAttachmentAction as n } from "./attachment/useAttachmentAction/useAttachmentAction.js";
2
2
  import { AttachmentValidationErrorReason as r, useAttachmentValidation as i } from "./attachment/useAttachmentValidation/useAttachmentValidation.js";
3
- export { r as AttachmentValidationErrorReason, e as downloadAttachment, t as isDownloadableAttachment, n as useAttachmentAction, i as useAttachmentValidation };
3
+ import { areAllMimeTypesAllowed as a, buildAttachConstraintDescription as o } from "./attachment/attach-constraints.js";
4
+ export { r as AttachmentValidationErrorReason, a as areAllMimeTypesAllowed, o as buildAttachConstraintDescription, e as downloadAttachment, t as isDownloadableAttachment, n as useAttachmentAction, i as useAttachmentValidation };
@@ -24,4 +24,6 @@ export declare const deriveAvailableTabIds: <T extends CatalogEntityType>(items:
24
24
  * `items`. Returns a new Set and never mutates either input.
25
25
  */
26
26
  export declare const reconcileFilterTopics: (persistedTopics: ReadonlySet<string>, items: readonly CatalogItem[]) => Set<string>;
27
+ /** Whether a share link for a catalog entity of this type may grant edit access. */
28
+ export declare const canEditShareAccess: (type: CatalogEntityType) => boolean;
27
29
  //# sourceMappingURL=catalog-derivations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog-derivations.d.ts","sourceRoot":"","sources":["../../src/catalog/catalog-derivations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,OAAO,SAAS,WAAW,EAAE,EAC7B,cAAc,WAAW,CAAC,iBAAiB,CAAC,KAC3C,WAAW,EAKX,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,WAAW,EAAE,EAC7B,WAAW,OAAO,KACjB,WAAW,EACkD,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,WAAW,EAAE,KAC5B,WAAW,EACiD,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,iBAAiB,EAC/D,OAAO,SAAS,WAAW,EAAE,EAC7B,UAAU,SAAS,CAAC,EAAE,KACrB,CAAC,EAGH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,iBAAiB,WAAW,CAAC,MAAM,CAAC,EACpC,OAAO,SAAS,WAAW,EAAE,KAC5B,GAAG,CAAC,MAAM,CAKZ,CAAC"}
1
+ {"version":3,"file":"catalog-derivations.d.ts","sourceRoot":"","sources":["../../src/catalog/catalog-derivations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,OAAO,SAAS,WAAW,EAAE,EAC7B,cAAc,WAAW,CAAC,iBAAiB,CAAC,KAC3C,WAAW,EAKX,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,WAAW,EAAE,EAC7B,WAAW,OAAO,KACjB,WAAW,EACkD,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,SAAS,WAAW,EAAE,KAC5B,WAAW,EACiD,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,iBAAiB,EAC/D,OAAO,SAAS,WAAW,EAAE,EAC7B,UAAU,SAAS,CAAC,EAAE,KACrB,CAAC,EAGH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,iBAAiB,WAAW,CAAC,MAAM,CAAC,EACpC,OAAO,SAAS,WAAW,EAAE,KAC5B,GAAG,CAAC,MAAM,CAKZ,CAAC;AAeF,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,MAAM,iBAAiB,KAAG,OAC5B,CAAC"}
@@ -1,11 +1,17 @@
1
- import { getCatalogItemTabs as e } from "@epam/ai-dial-catalog";
1
+ import { CatalogEntityType as e } from "@epam/ai-dial-chat-shared";
2
+ import { getCatalogItemTabs as t } from "@epam/ai-dial-catalog";
2
3
  //#region src/catalog/catalog-derivations.ts
3
- var t = (t, n) => t.filter((t) => e(t).some((e) => n.has(e)) && t.supportsChat !== !1), n = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], r = (e) => e.filter((e) => e.isUserFavorite && !e.isHidden), i = (t, n) => {
4
- let r = new Set(t.flatMap(e));
4
+ var n = (e, n) => e.filter((e) => t(e).some((e) => n.has(e)) && e.supportsChat !== !1), r = (e, t) => t ? e.filter((e) => !e.isMyApp) : [...e], i = (e) => e.filter((e) => e.isUserFavorite && !e.isHidden), a = (e, n) => {
5
+ let r = new Set(e.flatMap(t));
5
6
  return n.filter((e) => r.has(e));
6
- }, a = (e, t) => {
7
+ }, o = (e, t) => {
7
8
  let n = new Set(t.flatMap((e) => e.topics));
8
9
  return new Set(Array.from(e).filter((e) => n.has(e)));
9
- };
10
+ }, s = /* @__PURE__ */ new Set([
11
+ e.Agent,
12
+ e.Prompt,
13
+ e.Skill,
14
+ e.Toolset
15
+ ]), c = (e) => s.has(e);
10
16
  //#endregion
11
- export { i as deriveAvailableTabIds, r as deriveFavoriteItems, t as filterCatalogItemsBySelector, n as filterHiddenOwnedItems, a as reconcileFilterTopics };
17
+ export { c as canEditShareAccess, a as deriveAvailableTabIds, i as deriveFavoriteItems, n as filterCatalogItemsBySelector, r as filterHiddenOwnedItems, o as reconcileFilterTopics };
@@ -0,0 +1,14 @@
1
+ import { CatalogItemLimits } from '@epam/ai-dial-catalog';
2
+ /** The capped row closest to its limit, with its consumed percentage. */
3
+ export interface WorstCappedRow {
4
+ /** Period label of that row, e.g. `'Today'`. */
5
+ label: string;
6
+ /** Consumed share of that row's limit, rounded and clamped to 0–100. */
7
+ usedPercent: number;
8
+ }
9
+ /**
10
+ * Returns the capped row with the highest used/total ratio across every group,
11
+ * or `undefined` when no row is capped.
12
+ */
13
+ export declare const findWorstCappedRow: (limits: CatalogItemLimits | undefined) => WorstCappedRow | undefined;
14
+ //# sourceMappingURL=usage-limit-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-limit-rows.d.ts","sourceRoot":"","sources":["../../src/catalog/usage-limit-rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,uBAAuB,CAAC;AAG/B,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;CACrB;AAKD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,iBAAiB,GAAG,SAAS,KACpC,cAAc,GAAG,SAwBnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { isCappedStat as e } from "../shared/usage-stat.js";
2
+ //#region src/catalog/usage-limit-rows.ts
3
+ var t = (t) => t.isUnlimited !== !0 && e(t.total), n = (e) => {
4
+ let n;
5
+ for (let r of e?.groups ?? []) for (let e of r.rows) {
6
+ if (!t(e)) continue;
7
+ let r = Math.max(e.used, 0) / e.total;
8
+ (n == null || r > n.ratio) && (n = {
9
+ label: e.label,
10
+ ratio: r
11
+ });
12
+ }
13
+ if (n != null) return {
14
+ label: n.label,
15
+ usedPercent: Math.min(100, Math.round(n.ratio * 100))
16
+ };
17
+ };
18
+ //#endregion
19
+ export { n as findWorstCappedRow };
@@ -2,23 +2,23 @@ import { getApiErrorDetails as e } from "../../api-error/api-error.js";
2
2
  import { ToolsetAuthTypes as t, ToolsetCredentialsLevel as n } from "../../oauth/types.js";
3
3
  import { ToolsetLoginOutcomeType as r, useToolsetLogin as i } from "../../oauth/useToolsetLogin/useToolsetLogin.js";
4
4
  import { useCallback as a } from "react";
5
- import { CredentialStatus as o, CredentialsLevel as s, ToolsetAuthenticationType as c } from "@epam/ai-dial-catalog";
6
- import { NotificationVariant as l } from "@epam/ai-dial-ui-kit";
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";
7
7
  //#region src/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.ts
8
- var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
8
+ var u = (e, t, n) => e === c.User ? n.user : t ? n.org : n.global, d = (e) => {
9
9
  switch (e) {
10
- case c.ApiKey: return t.ApiKey;
11
- case c.OAuth: return t.OAuth;
12
- case c.None:
10
+ case l.ApiKey: return t.ApiKey;
11
+ case l.OAuth: return t.OAuth;
12
+ case l.None:
13
13
  case void 0: return t.None;
14
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 === s.User ? e.credentials?.userStatus : e.credentials?.globalStatus, []), x = a((e, n) => {
16
+ let b = a((e, t) => t === c.User ? e.credentials?.userStatus : e.credentials?.globalStatus, []), x = a((e, n) => {
17
17
  let r = t && !!e.credentials?.isPublic;
18
- if (e.credentials?.authenticationType === c.ApiKey) {
18
+ if (e.credentials?.authenticationType === l.ApiKey) {
19
19
  let t = u(n, r, v.apiKeyAddedSuccess);
20
20
  y({
21
- variant: l.Success,
21
+ variant: o.Success,
22
22
  title: v.apiKeyAddedSuccessTitle,
23
23
  message: t({
24
24
  name: e.name,
@@ -29,7 +29,7 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
29
29
  }
30
30
  let i = u(n, r, v.loginSuccess);
31
31
  y({
32
- variant: l.Success,
32
+ variant: o.Success,
33
33
  title: v.loginSuccessTitle,
34
34
  message: i({
35
35
  name: e.name,
@@ -42,10 +42,10 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
42
42
  y
43
43
  ]), S = a((e, n) => {
44
44
  let r = t && !!e.credentials?.isPublic;
45
- if (e.credentials?.authenticationType === c.ApiKey) {
45
+ if (e.credentials?.authenticationType === l.ApiKey) {
46
46
  let t = u(n, r, v.apiKeyDeletedSuccess);
47
47
  y({
48
- variant: l.Success,
48
+ variant: o.Success,
49
49
  title: v.apiKeyDeletedSuccessTitle,
50
50
  message: t({
51
51
  name: e.name,
@@ -56,7 +56,7 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
56
56
  }
57
57
  let i = u(n, r, v.logoutSuccess);
58
58
  y({
59
- variant: l.Success,
59
+ variant: o.Success,
60
60
  title: v.logoutSuccessTitle,
61
61
  message: i({
62
62
  name: e.name,
@@ -75,33 +75,33 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
75
75
  });
76
76
  return {
77
77
  handleLogin: a(async (e, t) => {
78
- let i = e.credentials?.authenticationType, a = t.level === s.User ? n.User : n.Global, c = f.find((t) => t.id === e.id);
78
+ let i = e.credentials?.authenticationType, a = t.level === c.User ? n.User : n.Global, l = f.find((t) => t.id === e.id);
79
79
  switch ((await C({
80
80
  toolsetId: e.id,
81
81
  credentialsLevel: a,
82
82
  authenticationType: d(i),
83
83
  apiKey: t.apiKey,
84
84
  oauthSettings: {
85
- clientId: c?.authSettings?.clientId,
86
- authorizationEndpoint: c?.authSettings?.authorizationEndpoint,
87
- scopes: c?.authSettings?.scopesSupported,
88
- codeChallenge: c?.authSettings?.codeChallenge,
89
- codeChallengeMethod: c?.authSettings?.codeChallengeMethod
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
90
  },
91
- isCurrentlyFailed: b(e, t.level) === o.Failed
91
+ isCurrentlyFailed: b(e, t.level) === s.Failed
92
92
  })).type) {
93
93
  case r.Success:
94
94
  x(e, t.level), await p();
95
95
  return;
96
96
  case r.PopupBlocked:
97
97
  y({
98
- variant: l.Error,
98
+ variant: o.Error,
99
99
  message: v.popupBlockedError
100
100
  });
101
101
  return;
102
102
  case r.Failure:
103
103
  y({
104
- variant: l.Error,
104
+ variant: o.Error,
105
105
  message: v.loginFailedError
106
106
  });
107
107
  return;
@@ -117,7 +117,7 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
117
117
  C
118
118
  ]),
119
119
  handleLogout: a(async (t, r) => {
120
- let i = r.level === s.User ? n.User : n.Global;
120
+ let i = r.level === c.User ? n.User : n.Global;
121
121
  try {
122
122
  let e = {
123
123
  url: t.id,
@@ -128,7 +128,7 @@ var u = (e, t, n) => e === s.User ? n.user : t ? n.org : n.global, d = (e) => {
128
128
  } catch (t) {
129
129
  let { traceId: n } = await e(t);
130
130
  y({
131
- variant: l.Error,
131
+ variant: o.Error,
132
132
  message: v.logoutFailedError,
133
133
  requestId: n
134
134
  });
package/catalog.js CHANGED
@@ -11,19 +11,20 @@ import { PUBLIC_SKILL_BUCKET as E, SKILL_LISTING_MAX_PAGES as D, SKILL_LISTING_P
11
11
  import { buildSkillContentTree as M, buildSkillOverview as N, mapSkillToCatalogItem as P, readSkillFileBytes as F, readSkillFilePreviewBytes as I, readSkillManifest as L, resolveSkillFileDownloadPath as R, resolveSkillManifestFileId as z } from "./catalog/map-skill-to-catalog-item.js";
12
12
  import { McpResourceKind as B, buildApplicationMcpUrl as V, buildConnectApi as H, buildToolsetMcpUrl as U, resolveMcpResourceKind as W } from "./catalog/mcp-endpoint-url.js";
13
13
  import { getPublicCatalogEntityFolderPath as G, isPublicCatalogEntityId as K, mapPublishConversationResultDto as q, mapPublishHistoryEntryDto as J, toPublishEntityType as Y } from "./catalog/publish.js";
14
- import { deriveAvailableTabIds as X, deriveFavoriteItems as Z, filterCatalogItemsBySelector as Q, filterHiddenOwnedItems as $, reconcileFilterTopics as ee } from "./catalog/catalog-derivations.js";
15
- import { CatalogEntityKind as te, findSchemaDisplayName as ne, resolveCatalogEntityKind as re } from "./catalog/catalog-entity-kind.js";
16
- import { FavoriteEntityType as ie, useFavoriteEntitiesState as ae } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
17
- import { resolveFavoriteEntityType as oe } from "./catalog/favorite-entity-type.js";
18
- import { parseCatalogFilterTopics as se, resolveCatalogActiveTab as ce, resolveCatalogSortKey as le } from "./catalog/catalog-preferences.js";
19
- import { CatalogPrimaryActionType as ue, resolveCatalogPrimaryAction as de } from "./catalog/catalog-primary-action.js";
20
- import { useCatalogEditNavigation as fe } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
21
- import { useSkillItemDetails as pe } from "./catalog/useSkillItemDetails.js";
22
- import { useCatalogItemDetails as me } from "./catalog/useCatalogItemDetails.js";
23
- import { useCatalogToolsetCredentials as he } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
24
- import { buildApplicationCredentialLoginParams as ge, mapApplicationCredentials as _e } from "./catalog/application-credentials.js";
25
- import { useApplicationCredentials as ve } from "./catalog/useApplicationCredentials/useApplicationCredentials.js";
26
- import { useSkillDetailsPanelData as ye } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
27
- import { usePublishFolders as be } from "./catalog/usePublishFolders/usePublishFolders.js";
28
- import { SkillPreviewErrorKind as xe, useSkillFilePreview as Se } from "./skill/useSkillFilePreview.js";
29
- export { u as AuthenticationType, te as CatalogEntityKind, ue as CatalogPrimaryActionType, m as DEFAULT_ENTITY_DETAILS_LABELS, ie as FavoriteEntityType, B as McpResourceKind, E as PUBLIC_SKILL_BUCKET, D as SKILL_LISTING_MAX_PAGES, O as SKILL_LISTING_PAGE_SIZE, k as SKILL_MANIFEST_MAX_BYTES, xe as SkillPreviewErrorKind, A as SkillSource, ge as buildApplicationCredentialLoginParams, V as buildApplicationMcpUrl, n as buildChatCompletionsUrl, H as buildConnectApi, r as buildDeploymentConnectApi, C as buildPromptOverview, d as buildResetFields, i as buildResponsesUrl, M as buildSkillContentTree, N as buildSkillOverview, U as buildToolsetMcpUrl, a as createDeploymentLookup, e as createPublishApiClient, o as decodeDeploymentId, X as deriveAvailableTabIds, Z as deriveFavoriteItems, s as encodeDeploymentId, Q as filterCatalogItemsBySelector, $ as filterHiddenOwnedItems, c as findDeploymentByIdOrReference, ne as findSchemaDisplayName, G as getPublicCatalogEntityFolderPath, w as isOrganisationPromptItem, K as isPublicCatalogEntityId, _e as mapApplicationCredentials, h as mapDeploymentDetailsDtoToEntityDetails, p as mapDeploymentLimitsDtoToCatalogLimits, f as mapDeploymentLimitsToInput, v as mapDeploymentToCatalogItem, y as mapDeploymentToolsetCredentials, g as mapEntityDetailsToCatalogDetails, T as mapPromptToCatalogItem, q as mapPublishConversationResultDto, J as mapPublishHistoryEntryDto, P as mapSkillToCatalogItem, _ as mapToolsetCredentials, b as mapToolsetToCatalogItem, l as normalizeDeploymentId, se as parseCatalogFilterTopics, j as parseSkillResourceUrl, F as readSkillFileBytes, I as readSkillFilePreviewBytes, L as readSkillManifest, ee as reconcileFilterTopics, ce as resolveCatalogActiveTab, re as resolveCatalogEntityKind, de as resolveCatalogPrimaryAction, le as resolveCatalogSortKey, x as resolveDeploymentFolder, oe as resolveFavoriteEntityType, W as resolveMcpResourceKind, R as resolveSkillFileDownloadPath, z as resolveSkillManifestFileId, S as supportsChatInterface, Y as toPublishEntityType, t as toPublishRuleDto, ve as useApplicationCredentials, fe as useCatalogEditNavigation, me as useCatalogItemDetails, he as useCatalogToolsetCredentials, ae as useFavoriteEntitiesState, be as usePublishFolders, ye as useSkillDetailsPanelData, Se as useSkillFilePreview, pe as useSkillItemDetails };
14
+ import { canEditShareAccess as X, deriveAvailableTabIds as Z, deriveFavoriteItems as Q, filterCatalogItemsBySelector as $, filterHiddenOwnedItems as ee, reconcileFilterTopics as te } from "./catalog/catalog-derivations.js";
15
+ import { CatalogEntityKind as ne, findSchemaDisplayName as re, resolveCatalogEntityKind as ie } from "./catalog/catalog-entity-kind.js";
16
+ import { FavoriteEntityType as ae, useFavoriteEntitiesState as oe } from "./catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js";
17
+ import { resolveFavoriteEntityType as se } from "./catalog/favorite-entity-type.js";
18
+ import { parseCatalogFilterTopics as ce, resolveCatalogActiveTab as le, resolveCatalogSortKey as ue } from "./catalog/catalog-preferences.js";
19
+ import { findWorstCappedRow as de } from "./catalog/usage-limit-rows.js";
20
+ import { CatalogPrimaryActionType as fe, resolveCatalogPrimaryAction as pe } from "./catalog/catalog-primary-action.js";
21
+ import { useCatalogEditNavigation as me } from "./catalog/useCatalogEditNavigation/useCatalogEditNavigation.js";
22
+ import { useSkillItemDetails as he } from "./catalog/useSkillItemDetails.js";
23
+ import { useCatalogItemDetails as ge } from "./catalog/useCatalogItemDetails.js";
24
+ import { useCatalogToolsetCredentials as _e } from "./catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js";
25
+ import { buildApplicationCredentialLoginParams as ve, mapApplicationCredentials as ye } from "./catalog/application-credentials.js";
26
+ import { useApplicationCredentials as be } from "./catalog/useApplicationCredentials/useApplicationCredentials.js";
27
+ import { useSkillDetailsPanelData as xe } from "./catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js";
28
+ import { usePublishFolders as Se } from "./catalog/usePublishFolders/usePublishFolders.js";
29
+ import { SkillPreviewErrorKind as Ce, useSkillFilePreview as we } from "./skill/useSkillFilePreview.js";
30
+ export { u as AuthenticationType, ne as CatalogEntityKind, fe as CatalogPrimaryActionType, m as DEFAULT_ENTITY_DETAILS_LABELS, ae as FavoriteEntityType, B as McpResourceKind, E as PUBLIC_SKILL_BUCKET, D as SKILL_LISTING_MAX_PAGES, O as SKILL_LISTING_PAGE_SIZE, k as SKILL_MANIFEST_MAX_BYTES, Ce as SkillPreviewErrorKind, A as SkillSource, ve as buildApplicationCredentialLoginParams, V as buildApplicationMcpUrl, n as buildChatCompletionsUrl, H as buildConnectApi, r as buildDeploymentConnectApi, C as buildPromptOverview, d as buildResetFields, i as buildResponsesUrl, M as buildSkillContentTree, N as buildSkillOverview, U as buildToolsetMcpUrl, X as canEditShareAccess, a as createDeploymentLookup, e as createPublishApiClient, o as decodeDeploymentId, Z as deriveAvailableTabIds, Q as deriveFavoriteItems, s as encodeDeploymentId, $ as filterCatalogItemsBySelector, ee as filterHiddenOwnedItems, c as findDeploymentByIdOrReference, re as findSchemaDisplayName, de as findWorstCappedRow, G as getPublicCatalogEntityFolderPath, w as isOrganisationPromptItem, K as isPublicCatalogEntityId, ye as mapApplicationCredentials, h as mapDeploymentDetailsDtoToEntityDetails, p as mapDeploymentLimitsDtoToCatalogLimits, f as mapDeploymentLimitsToInput, v as mapDeploymentToCatalogItem, y as mapDeploymentToolsetCredentials, g as mapEntityDetailsToCatalogDetails, T as mapPromptToCatalogItem, q as mapPublishConversationResultDto, J as mapPublishHistoryEntryDto, P as mapSkillToCatalogItem, _ as mapToolsetCredentials, b as mapToolsetToCatalogItem, l as normalizeDeploymentId, ce as parseCatalogFilterTopics, j as parseSkillResourceUrl, F as readSkillFileBytes, I as readSkillFilePreviewBytes, L as readSkillManifest, te as reconcileFilterTopics, le as resolveCatalogActiveTab, ie as resolveCatalogEntityKind, pe as resolveCatalogPrimaryAction, ue as resolveCatalogSortKey, x as resolveDeploymentFolder, se as resolveFavoriteEntityType, W as resolveMcpResourceKind, R as resolveSkillFileDownloadPath, z as resolveSkillManifestFileId, S as supportsChatInterface, Y as toPublishEntityType, t as toPublishRuleDto, be as useApplicationCredentials, me as useCatalogEditNavigation, ge as useCatalogItemDetails, _e as useCatalogToolsetCredentials, oe as useFavoriteEntitiesState, Se as usePublishFolders, xe as useSkillDetailsPanelData, we as useSkillFilePreview, he as useSkillItemDetails };
@@ -0,0 +1,6 @@
1
+ import { ConversationDeletionResultDto } from '@epam/ai-dial-chat-api-client';
2
+ /** Returns `true` when a delete-all request removed nothing: some conversations failed and none was deleted or already gone. */
3
+ export declare const isTotalDeletionFailure: (result: Pick<ConversationDeletionResultDto, "failed" | "deleted" | "alreadyAbsent">) => boolean;
4
+ /** Returns the pin state a dragged conversation takes in its target group: `true` to pin, `false` to unpin, `undefined` to leave it. */
5
+ export declare const resolveConversationPinChange: (targetGroupKey: string, isPinned: boolean | undefined) => boolean | undefined;
6
+ //# sourceMappingURL=conversation-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-list.d.ts","sourceRoot":"","sources":["../../src/conversation/conversation-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAGnF,gIAAgI;AAChI,eAAO,MAAM,sBAAsB,GACjC,QAAQ,IAAI,CACV,6BAA6B,EAC7B,QAAQ,GAAG,SAAS,GAAG,eAAe,CACvC,KACA,OAGyB,CAAC;AAE7B,wIAAwI;AACxI,eAAO,MAAM,4BAA4B,GACvC,gBAAgB,MAAM,EACtB,UAAU,OAAO,GAAG,SAAS,KAC5B,OAAO,GAAG,SAIZ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { FilterTab as e } from "@epam/ai-dial-chat-shared";
2
+ //#region src/conversation/conversation-list.ts
3
+ var t = (e) => e.failed.length > 0 && e.deleted === 0 && e.alreadyAbsent === 0, n = (t, n) => t === e.Pinned || !n && void 0;
4
+ //#endregion
5
+ export { t as isTotalDeletionFailure, n as resolveConversationPinChange };
@@ -20,6 +20,12 @@ export declare const isMessageStreaming: (message: Message, messageIndex: number
20
20
  * because it *is* the regenerated message.
21
21
  */
22
22
  export declare const getLastDeploymentId: (messages: Message[]) => string | null;
23
+ /**
24
+ * Returns, for each message, the deployment it ran on: its own `deploymentId`,
25
+ * otherwise the model set by the latest preceding `model_changed` status
26
+ * message, otherwise `initialModelId`.
27
+ */
28
+ export declare const getEffectiveDeploymentIds: (messages: readonly Message[], initialModelId?: string) => (string | undefined)[];
23
29
  /** True when `message` is an assistant message carrying at least one stage. */
24
30
  export declare const messageHasStages: (message: Message) => boolean;
25
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../src/conversation/message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAElC,OAAO,EAEP,cAAc,EAGf,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,OAAO,EAChB,cAAc,MAAM,EACpB,eAAe,MAAM,EACrB,mBAAmB,OAAO,KACzB,OAGqC,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,EAAE,KAAG,MAAM,GAAG,IAYlE,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,OAED,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,GAC9C,UAAU,OAAO,EAAE,KAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAO5B,CAAC;AA2BF;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,GAC7C,YAAY,6BAA6B,GAAG,SAAS,KACpD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAQ5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,OAAO,EAAE,KAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,UAAU,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EAAE,KACzB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,SAoBrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,MAAM,GAAG,SAAS,KACxB,cAIF,CAAC"}
1
+ {"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../src/conversation/message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,6BAA6B,EAElC,OAAO,EAEP,cAAc,EAGf,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,OAAO,EAChB,cAAc,MAAM,EACpB,eAAe,MAAM,EACrB,mBAAmB,OAAO,KACzB,OAGqC,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,EAAE,KAAG,MAAM,GAAG,IAYlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GACpC,UAAU,SAAS,OAAO,EAAE,EAC5B,iBAAiB,MAAM,KACtB,CAAC,MAAM,GAAG,SAAS,CAAC,EActB,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,OAED,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,GAC9C,UAAU,OAAO,EAAE,KAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAO5B,CAAC;AA2BF;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,GAC7C,YAAY,6BAA6B,GAAG,SAAS,KACpD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAQ5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,UAAU,OAAO,EAAE,KAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACnC,gBAAgB,MAAM,EACtB,UAAU,OAAO,EAAE,EACnB,SAAS,SAAS,MAAM,EAAE,KACzB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,SAoBrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,MAAM,GAAG,SAAS,KACxB,cAIF,CAAC"}
@@ -7,24 +7,28 @@ var i = (t, n, r, i) => i && n === r - 1 && t.role === e.Assistant, a = (e) => {
7
7
  if (i.deploymentId) return i.deploymentId;
8
8
  }
9
9
  return null;
10
- }, o = (t) => t.role === e.Assistant && (t.custom_content?.stages?.length ?? 0) > 0, s = (t) => {
10
+ }, o = (e, t) => {
11
+ let i = [], a = t;
12
+ for (let t of e) r(t) && t.custom_content?.event_type === n.ModelChanged && (a = t.custom_content.new_deployment_id), i.push(t.deploymentId ?? a);
13
+ return i;
14
+ }, s = (t) => t.role === e.Assistant && (t.custom_content?.stages?.length ?? 0) > 0, c = (t) => {
11
15
  for (let n = t.length - 1; n >= 0; n--) if (t[n].role === e.User) return t[n].custom_content?.configuration_value;
12
- }, c = (e) => {
16
+ }, l = (e) => {
13
17
  if (typeof e.default == "boolean") return e.default;
14
18
  let t = e.oneOf;
15
19
  if (Array.isArray(t) && t.length === 1) {
16
20
  let e = t[0];
17
21
  if (typeof e == "object" && e && "const" in e && typeof e.const == "boolean") return e.const;
18
22
  }
19
- }, l = (e) => {
23
+ }, u = (e) => {
20
24
  let t = e?.properties;
21
25
  if (t == null) return;
22
26
  let n = Object.entries(t).flatMap(([e, t]) => {
23
- let n = c(t);
27
+ let n = l(t);
24
28
  return n === void 0 ? [] : [[e, n]];
25
29
  });
26
30
  return n.length > 0 ? Object.fromEntries(n) : void 0;
27
- }, u = (t) => {
31
+ }, d = (t) => {
28
32
  let n = -1;
29
33
  for (let r = t.length - 1; r >= 0; r--) if (t[r].role === e.User) {
30
34
  n = r;
@@ -34,23 +38,23 @@ var i = (t, n, r, i) => i && n === r - 1 && t.role === e.Assistant, a = (e) => {
34
38
  for (let i = n + 1; i < t.length; i++) {
35
39
  let n = t[i];
36
40
  if (n.role !== e.Assistant) continue;
37
- let a = l(n.custom_content?.form_schema);
41
+ let a = u(n.custom_content?.form_schema);
38
42
  a && (r = {
39
43
  ...r,
40
44
  ...a
41
45
  });
42
46
  }
43
47
  return r;
44
- }, d = (t, n, r) => {
48
+ }, f = (t, n, r) => {
45
49
  let i = n.length - 1, a = n[i];
46
50
  if (a?.role !== e.Assistant) return;
47
- let o = l(a.custom_content?.form_schema);
51
+ let o = u(a.custom_content?.form_schema);
48
52
  if (!o) return;
49
53
  let s = Object.fromEntries(r.filter((e) => e in o).sort().map((e) => [e, o[e]]));
50
54
  if (Object.keys(s).length !== 0) return {
51
55
  key: `${t}|${i}|${JSON.stringify(s)}`,
52
56
  values: s
53
57
  };
54
- }, f = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? t.PlainText : t.Markdown;
58
+ }, p = (e) => (e ?? "").toLowerCase().replace(/[^a-z]/g, "") === "plaintext" ? t.PlainText : t.Markdown;
55
59
  //#endregion
56
- export { d as getFormSchemaToolSyncKey, a as getLastDeploymentId, s as getLastUserMessageToolConfiguration, u as getLatestToolConfiguration, l as getToolConfigurationFromFormSchema, i as isMessageStreaming, o as messageHasStages, f as normalizeResponseFormat };
60
+ export { o as getEffectiveDeploymentIds, f as getFormSchemaToolSyncKey, a as getLastDeploymentId, c as getLastUserMessageToolConfiguration, d as getLatestToolConfiguration, u as getToolConfigurationFromFormSchema, i as isMessageStreaming, s as messageHasStages, p as normalizeResponseFormat };
@@ -19,6 +19,8 @@ export interface UseActiveConversationSyncParams {
19
19
  conversationIdsMatch: (a: string, b: string) => boolean;
20
20
  /** Converts a raw context id to the panel-space id. App-specific. */
21
21
  toPanelConversationId: (id: string) => string;
22
+ /** Whether the active listed conversation should be marked viewed. Defaults to marking every one. */
23
+ shouldMarkViewed?: (item: ConversationListItemDto) => boolean;
22
24
  }
23
25
  /**
24
26
  * Synchronises the active conversation with the conversation list and returns
@@ -29,7 +31,7 @@ export interface UseActiveConversationSyncParams {
29
31
  * refresh. The list and refresh callback are intentionally excluded from
30
32
  * the dependency array to avoid a refresh-loop on every list update.
31
33
  * 2. Marks the active conversation as viewed when its matching identity becomes
32
- * available. List refreshes and persistence rollback do not retry the write.
34
+ * available and `shouldMarkViewed` accepts it. List refreshes and persistence rollback do not retry the write.
33
35
  */
34
- export declare const useActiveConversationSync: ({ activeConversationId, items, refreshConversations, markConversationViewed, conversationIdsMatch, toPanelConversationId, }: UseActiveConversationSyncParams) => string | undefined;
36
+ export declare const useActiveConversationSync: ({ activeConversationId, items, refreshConversations, markConversationViewed, conversationIdsMatch, toPanelConversationId, shouldMarkViewed, }: UseActiveConversationSyncParams) => string | undefined;
35
37
  //# sourceMappingURL=useActiveConversationSync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useActiveConversationSync.d.ts","sourceRoot":"","sources":["../../../src/conversation/useActiveConversationSync/useActiveConversationSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E,kDAAkD;AAClD,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,0CAA0C;IAC1C,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,4CAA4C;IAC5C,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,0EAA0E;IAC1E,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;OAGG;IACH,oBAAoB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IACxD,qEAAqE;IACrE,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,6HAOvC,+BAA+B,KAAG,MAAM,GAAG,SAkC7C,CAAC"}
1
+ {"version":3,"file":"useActiveConversationSync.d.ts","sourceRoot":"","sources":["../../../src/conversation/useActiveConversationSync/useActiveConversationSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAG7E,kDAAkD;AAClD,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,0CAA0C;IAC1C,KAAK,EAAE,uBAAuB,EAAE,CAAC;IACjC,4CAA4C;IAC5C,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,0EAA0E;IAC1E,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;OAGG;IACH,oBAAoB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IACxD,qEAAqE;IACrE,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,qGAAqG;IACrG,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,uBAAuB,KAAK,OAAO,CAAC;CAC/D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,GAAI,+IAQvC,+BAA+B,KAAG,MAAM,GAAG,SAmD7C,CAAC"}
@@ -1,18 +1,25 @@
1
- import { useEffect as e, useMemo as t } from "react";
1
+ import { useEffect as e, useMemo as t, useRef as n } from "react";
2
2
  //#region src/conversation/useActiveConversationSync/useActiveConversationSync.ts
3
- var n = ({ activeConversationId: n, items: r, refreshConversations: i, markConversationViewed: a, conversationIdsMatch: o, toPanelConversationId: s }) => {
4
- let c = t(() => n ? s(n) : void 0, [n, s]);
3
+ var r = ({ activeConversationId: r, items: i, refreshConversations: a, markConversationViewed: o, conversationIdsMatch: s, toPanelConversationId: c, shouldMarkViewed: l }) => {
4
+ let u = t(() => r ? c(r) : void 0, [r, c]);
5
5
  e(() => {
6
- c && (r.some((e) => o(e.id, c)) || i());
7
- }, [c, o]);
8
- let l = c ? r.find((e) => o(e.id, c))?.id : void 0;
6
+ u && (i.some((e) => s(e.id, u)) || a());
7
+ }, [u, s]);
8
+ let d = u ? i.find((e) => s(e.id, u)) : void 0, f = d?.id, p = d != null && (l?.(d) ?? !0), m = n(void 0);
9
9
  return e(() => {
10
- c && l && a(l);
10
+ if (!u || !f) {
11
+ m.current = void 0;
12
+ return;
13
+ }
14
+ if (!p) return;
15
+ let e = `${u}\u0000${f}`;
16
+ m.current !== e && (m.current = e, o(f));
11
17
  }, [
12
- c,
13
- l,
14
- a
15
- ]), c;
18
+ u,
19
+ f,
20
+ p,
21
+ o
22
+ ]), u;
16
23
  };
17
24
  //#endregion
18
- export { n as useActiveConversationSync };
25
+ export { r as useActiveConversationSync };
@@ -0,0 +1,16 @@
1
+ /** Parameters of `useVisibleConversationIdsReporter`. */
2
+ export interface UseVisibleConversationIdsReporterParams {
3
+ /** Conversations the view lists, by their list resource id. */
4
+ items: readonly {
5
+ id: string;
6
+ }[];
7
+ /** Whether the view is shown; a hidden view reports `null` but keeps its last ids. */
8
+ isVisible: boolean;
9
+ /** Maps a list resource id to the id the rendered panel reports. */
10
+ toPanelConversationId: (id: string) => string;
11
+ /** Registers this view's visible list ids, or `null` to withdraw them; usually from `useConversationTitleEnrichmentController`. */
12
+ setVisibleConversationIds: (viewKey: string, ids: string[] | null) => void;
13
+ }
14
+ /** Returns the panel's visible-ids callback, which registers the matching list ids under this view while it is visible. */
15
+ export declare const useVisibleConversationIdsReporter: ({ items, isVisible, toPanelConversationId, setVisibleConversationIds, }: UseVisibleConversationIdsReporterParams) => ((panelIds: string[]) => void);
16
+ //# sourceMappingURL=useVisibleConversationIdsReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVisibleConversationIdsReporter.d.ts","sourceRoot":"","sources":["../../../src/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,MAAM,WAAW,uCAAuC;IACtD,+DAA+D;IAC/D,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjC,sFAAsF;IACtF,SAAS,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,mIAAmI;IACnI,yBAAyB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5E;AAOD,2HAA2H;AAC3H,eAAO,MAAM,iCAAiC,GAAI,yEAK/C,uCAAuC,KAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAoCzE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { useCallback as e, useEffect as t, useId as n, useMemo as r, useRef as i } from "react";
2
+ //#region src/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.ts
3
+ var a = ({ items: a, isVisible: o, toPanelConversationId: s, setVisibleConversationIds: c }) => {
4
+ let l = n(), u = r(() => new Map(a.map((e) => [s(e.id), e.id])), [a, s]), d = i([]), f = i(o), p = e(() => {
5
+ c(l, f.current ? d.current : null);
6
+ }, [c, l]), m = e((e) => {
7
+ d.current = e.flatMap((e) => {
8
+ let t = u.get(e);
9
+ return t ? [t] : [];
10
+ }), p();
11
+ }, [u, p]);
12
+ return t(() => {
13
+ f.current = o, p();
14
+ }, [o, p]), t(() => () => c(l, null), [c, l]), m;
15
+ };
16
+ //#endregion
17
+ export { a as useVisibleConversationIdsReporter };