@red-hat-developer-hub/backstage-plugin-intelligent-assistant 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/alpha.d.ts +1 -9
  3. package/dist/components/Attachment.esm.js +10 -12
  4. package/dist/components/Attachment.esm.js.map +1 -1
  5. package/dist/components/CollapsedHistoryStrip.esm.js +46 -51
  6. package/dist/components/CollapsedHistoryStrip.esm.js.map +1 -1
  7. package/dist/components/FilePreview.esm.js +3 -2
  8. package/dist/components/FilePreview.esm.js.map +1 -1
  9. package/dist/components/LightSpeedChat.esm.js +655 -787
  10. package/dist/components/LightSpeedChat.esm.js.map +1 -1
  11. package/dist/components/LightspeedChatBox.esm.js +2 -3
  12. package/dist/components/LightspeedChatBox.esm.js.map +1 -1
  13. package/dist/components/LightspeedChatBoxHeader.esm.js +40 -35
  14. package/dist/components/LightspeedChatBoxHeader.esm.js.map +1 -1
  15. package/dist/components/LightspeedChatContainer.esm.js +43 -67
  16. package/dist/components/LightspeedChatContainer.esm.js.map +1 -1
  17. package/dist/components/LightspeedChatModelsState.esm.js +67 -73
  18. package/dist/components/LightspeedChatModelsState.esm.js.map +1 -1
  19. package/dist/components/LightspeedDrawerContext.esm.js.map +1 -1
  20. package/dist/components/LightspeedDrawerProvider.esm.js +13 -16
  21. package/dist/components/LightspeedDrawerProvider.esm.js.map +1 -1
  22. package/dist/components/LightspeedFABContent.esm.js +49 -9
  23. package/dist/components/LightspeedFABContent.esm.js.map +1 -1
  24. package/dist/components/LightspeedPage.esm.js +12 -12
  25. package/dist/components/LightspeedPage.esm.js.map +1 -1
  26. package/dist/components/McpConfigureServerModal.esm.js +81 -89
  27. package/dist/components/McpConfigureServerModal.esm.js.map +1 -1
  28. package/dist/components/McpServersSettings.esm.js +259 -239
  29. package/dist/components/McpServersSettings.esm.js.map +1 -1
  30. package/dist/components/MessageBarModelSelector.esm.js +29 -33
  31. package/dist/components/MessageBarModelSelector.esm.js.map +1 -1
  32. package/dist/components/RenameConversationModal.esm.js +38 -31
  33. package/dist/components/RenameConversationModal.esm.js.map +1 -1
  34. package/dist/components/Router.esm.js +4 -13
  35. package/dist/components/Router.esm.js.map +1 -1
  36. package/dist/components/ToastAlertGroup.esm.js +24 -40
  37. package/dist/components/ToastAlertGroup.esm.js.map +1 -1
  38. package/dist/components/ToolCallContent.esm.js +8 -11
  39. package/dist/components/ToolCallContent.esm.js.map +1 -1
  40. package/dist/components/notebooks/AddDocumentModal.esm.js +232 -252
  41. package/dist/components/notebooks/AddDocumentModal.esm.js.map +1 -1
  42. package/dist/components/notebooks/DeleteDocumentModal.esm.js +35 -77
  43. package/dist/components/notebooks/DeleteDocumentModal.esm.js.map +1 -1
  44. package/dist/components/notebooks/DeleteNotebookModal.esm.js +46 -81
  45. package/dist/components/notebooks/DeleteNotebookModal.esm.js.map +1 -1
  46. package/dist/components/notebooks/DocumentSidebar.esm.js +172 -196
  47. package/dist/components/notebooks/DocumentSidebar.esm.js.map +1 -1
  48. package/dist/components/notebooks/FileListItem.esm.js +69 -57
  49. package/dist/components/notebooks/FileListItem.esm.js.map +1 -1
  50. package/dist/components/notebooks/FileTypeIcon.esm.js +17 -27
  51. package/dist/components/notebooks/FileTypeIcon.esm.js.map +1 -1
  52. package/dist/components/notebooks/NotebookCard.esm.js +86 -25
  53. package/dist/components/notebooks/NotebookCard.esm.js.map +1 -1
  54. package/dist/components/notebooks/NotebookView.esm.js +367 -380
  55. package/dist/components/notebooks/NotebookView.esm.js.map +1 -1
  56. package/dist/components/notebooks/NotebooksTab.esm.js +93 -30
  57. package/dist/components/notebooks/NotebooksTab.esm.js.map +1 -1
  58. package/dist/components/notebooks/OverwriteConfirmModal.esm.js +142 -184
  59. package/dist/components/notebooks/OverwriteConfirmModal.esm.js.map +1 -1
  60. package/dist/components/notebooks/UploadResourceScreen.esm.js +58 -50
  61. package/dist/components/notebooks/UploadResourceScreen.esm.js.map +1 -1
  62. package/dist/components/notebooks/notebookDialogStyles.esm.js +33 -37
  63. package/dist/components/notebooks/notebookDialogStyles.esm.js.map +1 -1
  64. package/dist/const.esm.js +15 -2
  65. package/dist/const.esm.js.map +1 -1
  66. package/dist/hooks/useAllModels.esm.js +2 -1
  67. package/dist/hooks/useAllModels.esm.js.map +1 -1
  68. package/dist/hooks/useAutoScroll.esm.js +11 -11
  69. package/dist/hooks/useAutoScroll.esm.js.map +1 -1
  70. package/dist/hooks/useBufferedMessages.esm.js +5 -5
  71. package/dist/hooks/useBufferedMessages.esm.js.map +1 -1
  72. package/dist/hooks/useConversations.esm.js +2 -1
  73. package/dist/hooks/useConversations.esm.js.map +1 -1
  74. package/dist/hooks/useIaChatPermission.esm.js +15 -0
  75. package/dist/hooks/useIaChatPermission.esm.js.map +1 -0
  76. package/dist/hooks/useIaMcpToolsPermission.esm.js +15 -0
  77. package/dist/hooks/useIaMcpToolsPermission.esm.js.map +1 -0
  78. package/dist/hooks/{notebooks/useLightspeedNotebooksPermission.esm.js → useIaNotebooksPermission.esm.js} +4 -5
  79. package/dist/hooks/useIaNotebooksPermission.esm.js.map +1 -0
  80. package/dist/hooks/useIsMobile.esm.js +3 -3
  81. package/dist/hooks/useIsMobile.esm.js.map +1 -1
  82. package/dist/hooks/useMcpConfigureModal.esm.js +5 -9
  83. package/dist/hooks/useMcpConfigureModal.esm.js.map +1 -1
  84. package/dist/hooks/useNotebookConversationIds.esm.js +2 -1
  85. package/dist/hooks/useNotebookConversationIds.esm.js.map +1 -1
  86. package/dist/hooks/useQuestionValidation.esm.js +3 -2
  87. package/dist/hooks/useQuestionValidation.esm.js.map +1 -1
  88. package/dist/hooks/useWelcomePrompts.esm.js +2 -2
  89. package/dist/hooks/useWelcomePrompts.esm.js.map +1 -1
  90. package/dist/translations/de.esm.js +1 -9
  91. package/dist/translations/de.esm.js.map +1 -1
  92. package/dist/translations/es.esm.js +1 -9
  93. package/dist/translations/es.esm.js.map +1 -1
  94. package/dist/translations/fr.esm.js +1 -9
  95. package/dist/translations/fr.esm.js.map +1 -1
  96. package/dist/translations/it.esm.js +1 -9
  97. package/dist/translations/it.esm.js.map +1 -1
  98. package/dist/translations/ja.esm.js +1 -9
  99. package/dist/translations/ja.esm.js.map +1 -1
  100. package/dist/translations/ref.esm.js +1 -10
  101. package/dist/translations/ref.esm.js.map +1 -1
  102. package/dist/types.esm.js.map +1 -1
  103. package/dist/utils/fab-anchor-utils.esm.js +41 -0
  104. package/dist/utils/fab-anchor-utils.esm.js.map +1 -0
  105. package/dist/utils/scoped-dialog-utils.esm.js +6 -3
  106. package/dist/utils/scoped-dialog-utils.esm.js.map +1 -1
  107. package/package.json +5 -8
  108. package/dist/components/PermissionRequiredIcon.esm.js +0 -18
  109. package/dist/components/PermissionRequiredIcon.esm.js.map +0 -1
  110. package/dist/components/PermissionRequiredState.esm.js +0 -88
  111. package/dist/components/PermissionRequiredState.esm.js.map +0 -1
  112. package/dist/hooks/notebooks/useLightspeedNotebooksPermission.esm.js.map +0 -1
  113. package/dist/hooks/useLightspeedDeletePermission.esm.js +0 -12
  114. package/dist/hooks/useLightspeedDeletePermission.esm.js.map +0 -1
  115. package/dist/hooks/useLightspeedUpdatePermission.esm.js +0 -12
  116. package/dist/hooks/useLightspeedUpdatePermission.esm.js.map +0 -1
  117. package/dist/hooks/useLightspeedViewPermission.esm.js +0 -16
  118. package/dist/hooks/useLightspeedViewPermission.esm.js.map +0 -1
  119. package/dist/images/permission-required.svg +0 -319
  120. package/dist/utils/generateClassName.esm.js +0 -12
  121. package/dist/utils/generateClassName.esm.js.map +0 -1
@@ -1,40 +1,36 @@
1
- const notebookDialogStyles = (theme) => ({
2
- dialogPaper: {
3
- borderRadius: 24,
4
- maxWidth: 578
5
- },
6
- dialogPaperCompact: {
7
- borderRadius: 12,
8
- maxWidth: "300px"
9
- },
10
- dialogTitle: {
11
- display: "flex",
12
- alignItems: "center",
13
- justifyContent: "space-between",
14
- padding: "24px 24px 16px"
15
- },
16
- dialogTitleCompact: {
17
- display: "flex",
18
- alignItems: "center",
19
- justifyContent: "space-between",
20
- padding: "16px 16px 12px !important"
21
- },
22
- titleText: {
23
- fontWeight: 500,
24
- fontSize: "1.25rem",
25
- lineHeight: "1.625rem",
26
- letterSpacing: "-0.25px"
27
- },
28
- closeButton: {
29
- color: theme.palette.text.primary
30
- },
31
- dialogContent: {
32
- padding: "0 24px 24px"
33
- },
34
- dialogContentCompact: {
35
- padding: "0 16px 16px !important"
36
- }
1
+ const notebookDialogPaperSx = (isCompact) => ({
2
+ borderRadius: isCompact ? "12px" : "24px",
3
+ maxWidth: isCompact ? 300 : 578
4
+ });
5
+ const notebookDialogTitleSx = (isCompact) => ({
6
+ display: "flex",
7
+ alignItems: "center",
8
+ justifyContent: "space-between",
9
+ p: isCompact ? "16px 16px 12px !important" : "24px 24px 16px"
10
+ });
11
+ const notebookDialogTitleTextSx = (isCompact) => ({
12
+ fontWeight: isCompact ? 600 : 500,
13
+ fontSize: isCompact ? "1.125rem" : "1.25rem",
14
+ lineHeight: isCompact ? "1.5rem" : "1.625rem",
15
+ letterSpacing: "-0.25px"
37
16
  });
17
+ const notebookDialogCloseButtonSx = {
18
+ color: "text.primary"
19
+ };
20
+ const notebookDialogContentSx = (isCompact) => ({
21
+ p: isCompact ? "0 16px 16px !important" : "0 24px 24px"
22
+ });
23
+ const notebookDialogActionsSx = (isCompact) => ({
24
+ justifyContent: "flex-start",
25
+ p: isCompact ? "12px 16px !important" : "16px 24px",
26
+ gap: 1
27
+ });
28
+ const optionalStyle = (sx) => {
29
+ if (!sx || typeof sx === "function" || Array.isArray(sx)) {
30
+ return false;
31
+ }
32
+ return sx;
33
+ };
38
34
 
39
- export { notebookDialogStyles };
35
+ export { notebookDialogActionsSx, notebookDialogCloseButtonSx, notebookDialogContentSx, notebookDialogPaperSx, notebookDialogTitleSx, notebookDialogTitleTextSx, optionalStyle };
40
36
  //# sourceMappingURL=notebookDialogStyles.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"notebookDialogStyles.esm.js","sources":["../../../src/components/notebooks/notebookDialogStyles.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Theme } from '@material-ui/core/styles';\n\nexport const notebookDialogStyles = (theme: Theme) =>\n ({\n dialogPaper: {\n borderRadius: 24,\n maxWidth: 578,\n },\n dialogPaperCompact: {\n borderRadius: 12,\n maxWidth: '300px',\n },\n dialogTitle: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '24px 24px 16px',\n },\n dialogTitleCompact: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '16px 16px 12px !important',\n },\n titleText: {\n fontWeight: 500,\n fontSize: '1.25rem',\n lineHeight: '1.625rem',\n letterSpacing: '-0.25px',\n },\n closeButton: {\n color: theme.palette.text.primary,\n },\n dialogContent: {\n padding: '0 24px 24px',\n },\n dialogContentCompact: {\n padding: '0 16px 16px !important',\n },\n }) as const;\n"],"names":[],"mappings":"AAkBO,MAAM,oBAAA,GAAuB,CAAC,KAAA,MAClC;AAAA,EACC,WAAA,EAAa;AAAA,IACX,YAAA,EAAc,EAAA;AAAA,IACd,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,kBAAA,EAAoB;AAAA,IAClB,YAAA,EAAc,EAAA;AAAA,IACd,QAAA,EAAU;AAAA,GACZ;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,eAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,kBAAA,EAAoB;AAAA,IAClB,OAAA,EAAS,MAAA;AAAA,IACT,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB,eAAA;AAAA,IAChB,OAAA,EAAS;AAAA,GACX;AAAA,EACA,SAAA,EAAW;AAAA,IACT,UAAA,EAAY,GAAA;AAAA,IACZ,QAAA,EAAU,SAAA;AAAA,IACV,UAAA,EAAY,UAAA;AAAA,IACZ,aAAA,EAAe;AAAA,GACjB;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,aAAA,EAAe;AAAA,IACb,OAAA,EAAS;AAAA,GACX;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,OAAA,EAAS;AAAA;AAEb,CAAA;;;;"}
1
+ {"version":3,"file":"notebookDialogStyles.esm.js","sources":["../../../src/components/notebooks/notebookDialogStyles.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { SxProps, Theme } from '@mui/material/styles';\n\ntype StaticDialogSx = Exclude<\n SxProps<Theme>,\n readonly unknown[] | ((theme: Theme) => unknown)\n>;\n\nexport const notebookDialogPaperSx = (isCompact: boolean): StaticDialogSx => ({\n borderRadius: isCompact ? '12px' : '24px',\n maxWidth: isCompact ? 300 : 578,\n});\n\nexport const notebookDialogTitleSx = (isCompact: boolean): StaticDialogSx => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n p: isCompact ? '16px 16px 12px !important' : '24px 24px 16px',\n});\n\nexport const notebookDialogTitleTextSx = (\n isCompact: boolean,\n): StaticDialogSx => ({\n fontWeight: isCompact ? 600 : 500,\n fontSize: isCompact ? '1.125rem' : '1.25rem',\n lineHeight: isCompact ? '1.5rem' : '1.625rem',\n letterSpacing: '-0.25px',\n});\n\nexport const notebookDialogCloseButtonSx = {\n color: 'text.primary',\n} as const;\n\nexport const notebookDialogContentSx = (\n isCompact: boolean,\n): StaticDialogSx => ({\n p: isCompact ? '0 16px 16px !important' : '0 24px 24px',\n});\n\nexport const notebookDialogActionsSx = (\n isCompact: boolean,\n): StaticDialogSx => ({\n justifyContent: 'flex-start',\n p: isCompact ? '12px 16px !important' : '16px 24px',\n gap: 1,\n});\n\n/** Narrow Dialog Paper `sx` so it can sit in an `sx={[...]}` array. */\nexport const optionalStyle = (\n sx: SxProps<Theme> | undefined,\n): StaticDialogSx | false => {\n if (!sx || typeof sx === 'function' || Array.isArray(sx)) {\n return false;\n }\n return sx as StaticDialogSx;\n};\n"],"names":[],"mappings":"AAuBO,MAAM,qBAAA,GAAwB,CAAC,SAAA,MAAwC;AAAA,EAC5E,YAAA,EAAc,YAAY,MAAA,GAAS,MAAA;AAAA,EACnC,QAAA,EAAU,YAAY,GAAA,GAAM;AAC9B,CAAA;AAEO,MAAM,qBAAA,GAAwB,CAAC,SAAA,MAAwC;AAAA,EAC5E,OAAA,EAAS,MAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,cAAA,EAAgB,eAAA;AAAA,EAChB,CAAA,EAAG,YAAY,2BAAA,GAA8B;AAC/C,CAAA;AAEO,MAAM,yBAAA,GAA4B,CACvC,SAAA,MACoB;AAAA,EACpB,UAAA,EAAY,YAAY,GAAA,GAAM,GAAA;AAAA,EAC9B,QAAA,EAAU,YAAY,UAAA,GAAa,SAAA;AAAA,EACnC,UAAA,EAAY,YAAY,QAAA,GAAW,UAAA;AAAA,EACnC,aAAA,EAAe;AACjB,CAAA;AAEO,MAAM,2BAAA,GAA8B;AAAA,EACzC,KAAA,EAAO;AACT;AAEO,MAAM,uBAAA,GAA0B,CACrC,SAAA,MACoB;AAAA,EACpB,CAAA,EAAG,YAAY,wBAAA,GAA2B;AAC5C,CAAA;AAEO,MAAM,uBAAA,GAA0B,CACrC,SAAA,MACoB;AAAA,EACpB,cAAA,EAAgB,YAAA;AAAA,EAChB,CAAA,EAAG,YAAY,sBAAA,GAAyB,WAAA;AAAA,EACxC,GAAA,EAAK;AACP,CAAA;AAGO,MAAM,aAAA,GAAgB,CAC3B,EAAA,KAC2B;AAC3B,EAAA,IAAI,CAAC,MAAM,OAAO,EAAA,KAAO,cAAc,KAAA,CAAM,OAAA,CAAQ,EAAE,CAAA,EAAG;AACxD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,OAAO,EAAA;AACT;;;;"}
package/dist/const.esm.js CHANGED
@@ -67,9 +67,22 @@ const NOTEBOOK_PROMPT_KEYS = [
67
67
  const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [
68
68
  "lightspeed_question_validity-shield"
69
69
  ];
70
- const DOCKED_CONTENT_OFFSET = "calc(var(--docked-drawer-width, 500px) + 1.5em)";
70
+ const LIGHTSPEED_FAB_ELEMENT_ID = "lightspeed-fab";
71
+ const LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS = "ia-overlay-chatbot-modal";
72
+ const LIGHTSPEED_FAB_ANCHOR_VARS = {
73
+ insetBlockEnd: "--ia-fab-inset-block-end",
74
+ insetInlineEnd: "--ia-fab-inset-inline-end",
75
+ height: "--ia-fab-height",
76
+ overlayGap: "--ia-overlay-gap",
77
+ dockedDrawerGutter: "--ia-docked-drawer-gutter"
78
+ };
79
+ const zero = "0px";
80
+ const DOCKED_CONTENT_OFFSET = `calc(var(--docked-drawer-width, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.dockedDrawerGutter}, ${zero}))`;
81
+ const LIGHTSPEED_OVERLAY_BOTTOM = `calc(var(${LIGHTSPEED_FAB_ANCHOR_VARS.insetBlockEnd}, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.height}, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.overlayGap}, ${zero}))`;
82
+ const LIGHTSPEED_OVERLAY_RIGHT = `var(${LIGHTSPEED_FAB_ANCHOR_VARS.insetInlineEnd}, ${zero})`;
83
+ const LIGHTSPEED_OVERLAY_MAX_WIDTH = `min(30rem, calc(100vw - 2 * var(${LIGHTSPEED_FAB_ANCHOR_VARS.overlayGap}, ${zero})))`;
71
84
  const LIGHTSPEED_PATH = "/intelligent-assistant";
72
85
  const LIGHTSPEED_LEGACY_PATH = "/lightspeed";
73
86
 
74
- export { DEFAULT_SAMPLE_PROMPTS, DOCKED_CONTENT_OFFSET, LIGHTSPEED_APP_DRAWER_ID, LIGHTSPEED_LEGACY_PATH, LIGHTSPEED_PATH, NOTEBOOK_ALLOWED_EXTENSIONS, NOTEBOOK_EXTENSION_TO_FILE_TYPE, NOTEBOOK_MAX_FILES, NOTEBOOK_MAX_FILE_SIZE_BYTES, NOTEBOOK_MAX_TITLE_LENGTH, NOTEBOOK_PROMPT_KEYS, RHDH_SAMPLE_PROMPTS, TEMP_CONVERSATION_ID, UNTITLED_NOTEBOOK_NAME, VALID_TOPIC_RESTRICTION_PROVIDER_IDS, supportedFileTypes };
87
+ export { DEFAULT_SAMPLE_PROMPTS, DOCKED_CONTENT_OFFSET, LIGHTSPEED_APP_DRAWER_ID, LIGHTSPEED_FAB_ANCHOR_VARS, LIGHTSPEED_FAB_ELEMENT_ID, LIGHTSPEED_LEGACY_PATH, LIGHTSPEED_OVERLAY_BOTTOM, LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS, LIGHTSPEED_OVERLAY_MAX_WIDTH, LIGHTSPEED_OVERLAY_RIGHT, LIGHTSPEED_PATH, NOTEBOOK_ALLOWED_EXTENSIONS, NOTEBOOK_EXTENSION_TO_FILE_TYPE, NOTEBOOK_MAX_FILES, NOTEBOOK_MAX_FILE_SIZE_BYTES, NOTEBOOK_MAX_TITLE_LENGTH, NOTEBOOK_PROMPT_KEYS, RHDH_SAMPLE_PROMPTS, TEMP_CONVERSATION_ID, UNTITLED_NOTEBOOK_NAME, VALID_TOPIC_RESTRICTION_PROVIDER_IDS, supportedFileTypes };
75
88
  //# sourceMappingURL=const.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.esm.js","sources":["../src/const.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SamplePrompts } from './types';\n\nexport const TEMP_CONVERSATION_ID = 'temp-conversation-id';\n\nexport const LIGHTSPEED_APP_DRAWER_ID = 'intelligent-assistant';\n\n// Translation keys for disclaimers\nexport const FUNCTION_DISCLAIMER_WITHOUT_QUESTION_VALIDATION_KEY =\n 'disclaimer.withoutValidation';\nexport const FUNCTION_DISCLAIMER_KEY = 'disclaimer.withValidation';\n\nconst createPrompt = (titleKey: string, messageKey: string) => {\n return { titleKey, messageKey };\n};\n\nexport const supportedFileTypes = {\n 'text/plain': ['.txt'],\n 'application/json': ['.json'],\n 'application/yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_MAX_FILES = 10;\nexport const NOTEBOOK_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024; // 25 MB\nexport const NOTEBOOK_MAX_TITLE_LENGTH = 255;\nexport const UNTITLED_NOTEBOOK_NAME = 'Untitled Notebook';\n\nexport const NOTEBOOK_ALLOWED_EXTENSIONS: Record<string, string[]> = {\n 'text/plain': ['.txt', '.log'],\n 'text/markdown': ['.md'],\n 'application/pdf': ['.pdf'],\n 'application/json': ['.json'],\n 'application/x-yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_EXTENSION_TO_FILE_TYPE: Record<string, string> = {\n '.txt': 'txt',\n '.md': 'md',\n '.pdf': 'pdf',\n '.json': 'json',\n '.yaml': 'yaml',\n '.yml': 'yaml',\n '.log': 'log',\n};\n\nexport const DEFAULT_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt(\n 'prompts.codeReadability.title',\n 'prompts.codeReadability.message',\n ),\n createPrompt('prompts.debugging.title', 'prompts.debugging.message'),\n createPrompt(\n 'prompts.developmentConcept.title',\n 'prompts.developmentConcept.message',\n ),\n createPrompt(\n 'prompts.codeOptimization.title',\n 'prompts.codeOptimization.message',\n ),\n createPrompt('prompts.documentation.title', 'prompts.documentation.message'),\n createPrompt('prompts.gitWorkflows.title', 'prompts.gitWorkflows.message'),\n createPrompt(\n 'prompts.testingStrategies.title',\n 'prompts.testingStrategies.message',\n ),\n createPrompt(\n 'prompts.sortingAlgorithms.title',\n 'prompts.sortingAlgorithms.message',\n ),\n createPrompt('prompts.eventDriven.title', 'prompts.eventDriven.message'),\n];\n\nexport const RHDH_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt('prompts.tekton.title', 'prompts.tekton.message'),\n createPrompt('prompts.openshift.title', 'prompts.openshift.message'),\n createPrompt('prompts.rhdh.title', 'prompts.rhdh.message'),\n];\n\nexport const NOTEBOOK_PROMPT_KEYS: string[] = [\n 'notebooks.prompts.coreConcepts.title',\n 'notebooks.prompts.vulnerabilities.title',\n 'notebooks.prompts.accessIssue.title',\n];\n\n// Topic restriction valid provider IDs\nexport const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [\n 'lightspeed_question_validity-shield',\n];\n\n// Matches app shell margin on main when ApplicationDrawer is docked (e.g. Root.tsx).\nexport const DOCKED_CONTENT_OFFSET =\n 'calc(var(--docked-drawer-width, 500px) + 1.5em)';\n\nexport const LIGHTSPEED_PAT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F;AAAA,EACA,YAAA;AAAA,IACE,gCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA,CAAa,+BAA+B,+BAA+B,CAAA;AAAA,EAC3E,YAAA,CAAa,8BAA8B,8BAA8B,CAAA;AAAA,EACzE,YAAA;AAAA,IACE,iCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA;AAAA,IACE,iCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA,YAAA,CAAa,6BAA6B,6BAA6B;AACzE;AAEO,MAAM,mBAAA,GAAqC;AAAA,EAChD,YAAA,CAAa,wBAAwB,wBAAwB,CAAA;AAAA,EAC7D,YAAA,CAAa,2BAA2B,2BAA2B,CAAA;AAAA,EACnE,YAAA,CAAa,sBAAsB,sBAAsB;AAC3D;AAEO,MAAM,oBAAA,GAAiC;AAAA,EAC5C,sCAAA;AAAA,EACA,yCAAA;AAAA,EACA;AACF;AAGO,MAAM,oCAAA,GAAuC;AAAA,EAClD;AACF;AAGO,MAAM,qBAAA,GACX;AAEK,MAAM,eAAA,GAAkB;AACxB,MAAM,sBAAA,GAAyB;;;;"}
1
+ {"version":3,"file":"const.esm.js","sources":["../src/const.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SamplePrompts } from './types';\n\nexport const TEMP_CONVERSATION_ID = 'temp-conversation-id';\n\nexport const LIGHTSPEED_APP_DRAWER_ID = 'intelligent-assistant';\n\n// Translation keys for disclaimers\nexport const FUNCTION_DISCLAIMER_WITHOUT_QUESTION_VALIDATION_KEY =\n 'disclaimer.withoutValidation';\nexport const FUNCTION_DISCLAIMER_KEY = 'disclaimer';\n\nconst createPrompt = (titleKey: string, messageKey: string) => {\n return { titleKey, messageKey };\n};\n\nexport const supportedFileTypes = {\n 'text/plain': ['.txt'],\n 'application/json': ['.json'],\n 'application/yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_MAX_FILES = 10;\nexport const NOTEBOOK_MAX_FILE_SIZE_BYTES = 25 * 1024 * 1024; // 25 MB\nexport const NOTEBOOK_MAX_TITLE_LENGTH = 255;\nexport const UNTITLED_NOTEBOOK_NAME = 'Untitled Notebook';\n\nexport const NOTEBOOK_ALLOWED_EXTENSIONS: Record<string, string[]> = {\n 'text/plain': ['.txt', '.log'],\n 'text/markdown': ['.md'],\n 'application/pdf': ['.pdf'],\n 'application/json': ['.json'],\n 'application/x-yaml': ['.yaml', '.yml'],\n};\n\nexport const NOTEBOOK_EXTENSION_TO_FILE_TYPE: Record<string, string> = {\n '.txt': 'txt',\n '.md': 'md',\n '.pdf': 'pdf',\n '.json': 'json',\n '.yaml': 'yaml',\n '.yml': 'yaml',\n '.log': 'log',\n};\n\nexport const DEFAULT_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt(\n 'prompts.codeReadability.title',\n 'prompts.codeReadability.message',\n ),\n createPrompt('prompts.debugging.title', 'prompts.debugging.message'),\n createPrompt(\n 'prompts.developmentConcept.title',\n 'prompts.developmentConcept.message',\n ),\n createPrompt(\n 'prompts.codeOptimization.title',\n 'prompts.codeOptimization.message',\n ),\n createPrompt('prompts.documentation.title', 'prompts.documentation.message'),\n createPrompt('prompts.gitWorkflows.title', 'prompts.gitWorkflows.message'),\n createPrompt(\n 'prompts.testingStrategies.title',\n 'prompts.testingStrategies.message',\n ),\n createPrompt(\n 'prompts.sortingAlgorithms.title',\n 'prompts.sortingAlgorithms.message',\n ),\n createPrompt('prompts.eventDriven.title', 'prompts.eventDriven.message'),\n];\n\nexport const RHDH_SAMPLE_PROMPTS: SamplePrompts = [\n createPrompt('prompts.tekton.title', 'prompts.tekton.message'),\n createPrompt('prompts.openshift.title', 'prompts.openshift.message'),\n createPrompt('prompts.rhdh.title', 'prompts.rhdh.message'),\n];\n\nexport const NOTEBOOK_PROMPT_KEYS: string[] = [\n 'notebooks.prompts.coreConcepts.title',\n 'notebooks.prompts.vulnerabilities.title',\n 'notebooks.prompts.accessIssue.title',\n];\n\n// Topic restriction valid provider IDs\nexport const VALID_TOPIC_RESTRICTION_PROVIDER_IDS = [\n 'lightspeed_question_validity-shield',\n];\n\nexport const LIGHTSPEED_FAB_ELEMENT_ID = 'lightspeed-fab';\nexport const LIGHTSPEED_OVERLAY_CHATBOT_MODAL_CLASS =\n 'ia-overlay-chatbot-modal';\n\n/** CSS variables published by LightspeedFABContent single source for overlay layout. */\nexport const LIGHTSPEED_FAB_ANCHOR_VARS = {\n insetBlockEnd: '--ia-fab-inset-block-end',\n insetInlineEnd: '--ia-fab-inset-inline-end',\n height: '--ia-fab-height',\n overlayGap: '--ia-overlay-gap',\n dockedDrawerGutter: '--ia-docked-drawer-gutter',\n} as const;\n\nconst zero = '0px';\n\n/** Shift FAB/overlay left when the app drawer is docked (drawer width + theme gutter). */\nexport const DOCKED_CONTENT_OFFSET = `calc(var(--docked-drawer-width, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.dockedDrawerGutter}, ${zero}))`;\n\n/** Overlay bottom: measured FAB bottom inset + FAB height + theme gap. */\nexport const LIGHTSPEED_OVERLAY_BOTTOM = `calc(var(${LIGHTSPEED_FAB_ANCHOR_VARS.insetBlockEnd}, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.height}, ${zero}) + var(${LIGHTSPEED_FAB_ANCHOR_VARS.overlayGap}, ${zero}))`;\n\n/** Overlay right: measured FAB right inset (tracks docked margin via getBoundingClientRect). */\nexport const LIGHTSPEED_OVERLAY_RIGHT = `var(${LIGHTSPEED_FAB_ANCHOR_VARS.insetInlineEnd}, ${zero})`;\n\n/** Overlay max width: PatternFly default capped by viewport minus theme gutters. */\nexport const LIGHTSPEED_OVERLAY_MAX_WIDTH = `min(30rem, calc(100vw - 2 * var(${LIGHTSPEED_FAB_ANCHOR_VARS.overlayGap}, ${zero})))`;\n\nexport const LIGHTSPEED_PATH = '/intelligent-assistant';\nexport const LIGHTSPEED_LEGACY_PATH = '/lightspeed';\n"],"names":[],"mappings":"AAkBO,MAAM,oBAAA,GAAuB;AAE7B,MAAM,wBAAA,GAA2B;AAOxC,MAAM,YAAA,GAAe,CAAC,QAAA,EAAkB,UAAA,KAAuB;AAC7D,EAAA,OAAO,EAAE,UAAU,UAAA,EAAW;AAChC,CAAA;AAEO,MAAM,kBAAA,GAAqB;AAAA,EAChC,YAAA,EAAc,CAAC,MAAM,CAAA;AAAA,EACrB,kBAAA,EAAoB,CAAC,OAAO,CAAA;AAAA,EAC5B,kBAAA,EAAoB,CAAC,OAAA,EAAS,MAAM;AACtC;AAEO,MAAM,kBAAA,GAAqB;AAC3B,MAAM,4BAAA,GAA+B,KAAK,IAAA,GAAO;AACjD,MAAM,yBAAA,GAA4B;AAClC,MAAM,sBAAA,GAAyB;AAE/B,MAAM,2BAAA,GAAwD;AAAA,EACnE,YAAA,EAAc,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,EAC7B,eAAA,EAAiB,CAAC,KAAK,CAAA;AAAA,EACvB,iBAAA,EAAmB,CAAC,MAAM,CAAA;AAAA,EAC1B,kBAAA,EAAoB,CAAC,OAAO,CAAA;AAAA,EAC5B,oBAAA,EAAsB,CAAC,OAAA,EAAS,MAAM;AACxC;AAEO,MAAM,+BAAA,GAA0D;AAAA,EACrE,MAAA,EAAQ,KAAA;AAAA,EACR,KAAA,EAAO,IAAA;AAAA,EACP,MAAA,EAAQ,KAAA;AAAA,EACR,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,MAAA,EAAQ,MAAA;AAAA,EACR,MAAA,EAAQ;AACV;AAEO,MAAM,sBAAA,GAAwC;AAAA,EACnD,YA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KAAK,IAAI,CAAA,QAAA,EAAW,0BAAA,CAA2B,UAAU,KAAK,IAAI,CAAA,EAAA;AAG7M,MAAM,wBAAA,GAA2B,CAAA,IAAA,EAAO,0BAAA,CAA2B,cAAc,KAAK,IAAI,CAAA,CAAA;AAG1F,MAAM,4BAAA,GAA+B,CAAA,gCAAA,EAAmC,0BAAA,CAA2B,UAAU,KAAK,IAAI,CAAA,GAAA;AAEtH,MAAM,eAAA,GAAkB;AACxB,MAAM,sBAAA,GAAyB;;;;"}
@@ -2,7 +2,7 @@ import { useApi } from '@backstage/core-plugin-api';
2
2
  import { useQuery } from '@tanstack/react-query';
3
3
  import { lightspeedApiRef } from '../api/api.esm.js';
4
4
 
5
- const useAllModels = () => {
5
+ const useAllModels = (enabled = true) => {
6
6
  const lightspeedApi = useApi(lightspeedApiRef);
7
7
  return useQuery({
8
8
  queryKey: ["models"],
@@ -10,6 +10,7 @@ const useAllModels = () => {
10
10
  const response = await lightspeedApi.getAllModels();
11
11
  return response;
12
12
  },
13
+ enabled,
13
14
  staleTime: 1e3 * 60 * 5,
14
15
  // 5 minutes
15
16
  refetchOnWindowFocus: false
@@ -1 +1 @@
1
- {"version":3,"file":"useAllModels.esm.js","sources":["../../src/hooks/useAllModels.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { LCSModel } from '../types';\n\n// Fetch all models\nexport const useAllModels = (): UseQueryResult<LCSModel[], Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['models'],\n queryFn: async () => {\n const response = await lightspeedApi.getAllModels();\n return response;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n refetchOnWindowFocus: false,\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,eAAe,MAAyC;AACnE,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,QAAQ,CAAA;AAAA,IACnB,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,YAAA,EAAa;AAClD,MAAA,OAAO,QAAA;AAAA,IACT,CAAA;AAAA,IACA,SAAA,EAAW,MAAO,EAAA,GAAK,CAAA;AAAA;AAAA,IACvB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useAllModels.esm.js","sources":["../../src/hooks/useAllModels.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { LCSModel } from '../types';\n\n// Fetch all models\nexport const useAllModels = (\n enabled = true,\n): UseQueryResult<LCSModel[], Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['models'],\n queryFn: async () => {\n const response = await lightspeedApi.getAllModels();\n return response;\n },\n enabled,\n staleTime: 1000 * 60 * 5, // 5 minutes\n refetchOnWindowFocus: false,\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,YAAA,GAAe,CAC1B,OAAA,GAAU,IAAA,KAC4B;AACtC,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,QAAQ,CAAA;AAAA,IACnB,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,YAAA,EAAa;AAClD,MAAA,OAAO,QAAA;AAAA,IACT,CAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA,EAAW,MAAO,EAAA,GAAK,CAAA;AAAA;AAAA,IACvB,oBAAA,EAAsB;AAAA,GACvB,CAAA;AACH;;;;"}
@@ -1,12 +1,12 @@
1
- import React from 'react';
1
+ import { useState, useRef, useCallback, useEffect } from 'react';
2
2
 
3
3
  const useAutoScroll = (containerRef, options = {}) => {
4
4
  const { deltaUp = 10, deltaDown = 60, delay = 200 } = options;
5
- const [autoScroll, setAutoScroll] = React.useState(true);
6
- const lastScrollTop = React.useRef(0);
7
- const manualScrollInterrupted = React.useRef(false);
8
- const debounceTimeout = React.useRef(null);
9
- const onScroll = React.useCallback(() => {
5
+ const [autoScroll, setAutoScroll] = useState(true);
6
+ const lastScrollTop = useRef(0);
7
+ const manualScrollInterrupted = useRef(false);
8
+ const debounceTimeout = useRef(null);
9
+ const onScroll = useCallback(() => {
10
10
  const container = containerRef.current;
11
11
  if (!container) return;
12
12
  const currentScrollTop = container.scrollTop;
@@ -27,7 +27,7 @@ const useAutoScroll = (containerRef, options = {}) => {
27
27
  }
28
28
  lastScrollTop.current = currentScrollTop;
29
29
  }, [containerRef, deltaUp, deltaDown, delay]);
30
- React.useEffect(() => {
30
+ useEffect(() => {
31
31
  const container = containerRef.current;
32
32
  if (!container) {
33
33
  return void 0;
@@ -38,15 +38,15 @@ const useAutoScroll = (containerRef, options = {}) => {
38
38
  if (debounceTimeout.current) clearTimeout(debounceTimeout.current);
39
39
  };
40
40
  }, [onScroll, containerRef]);
41
- const resumeAutoScroll = React.useCallback(() => {
41
+ const resumeAutoScroll = useCallback(() => {
42
42
  manualScrollInterrupted.current = false;
43
43
  setAutoScroll(true);
44
44
  }, []);
45
- const stopAutoScroll = React.useCallback(() => {
45
+ const stopAutoScroll = useCallback(() => {
46
46
  manualScrollInterrupted.current = true;
47
47
  setAutoScroll(false);
48
48
  }, []);
49
- const scrollToTop = React.useCallback(() => {
49
+ const scrollToTop = useCallback(() => {
50
50
  stopAutoScroll();
51
51
  const container = containerRef.current;
52
52
  if (!container) return;
@@ -55,7 +55,7 @@ const useAutoScroll = (containerRef, options = {}) => {
55
55
  behavior: "smooth"
56
56
  });
57
57
  }, [stopAutoScroll, containerRef]);
58
- const scrollToBottom = React.useCallback(() => {
58
+ const scrollToBottom = useCallback(() => {
59
59
  const container = containerRef.current;
60
60
  if (container) {
61
61
  container.scrollTo({
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoScroll.esm.js","sources":["../../src/hooks/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\ninterface useAutoScrollOptions {\n deltaUp?: number;\n deltaDown?: number;\n delay?: number;\n}\n\nexport const useAutoScroll = (\n containerRef: React.RefObject<HTMLElement>,\n options: useAutoScrollOptions = {},\n) => {\n const { deltaUp = 10, deltaDown = 60, delay = 200 } = options;\n\n const [autoScroll, setAutoScroll] = React.useState(true);\n const lastScrollTop = React.useRef(0);\n const manualScrollInterrupted = React.useRef(false);\n const debounceTimeout = React.useRef<NodeJS.Timeout | null>(null);\n\n const onScroll = React.useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const currentScrollTop = container.scrollTop;\n const isScrollingDown = currentScrollTop > lastScrollTop.current;\n\n const distanceFromBottom =\n container.scrollHeight - container.scrollTop - container.clientHeight;\n\n const delta = isScrollingDown ? deltaDown : deltaUp;\n const isAtBottom = distanceFromBottom <= delta;\n\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n\n if (isAtBottom && manualScrollInterrupted.current && isScrollingDown) {\n debounceTimeout.current = setTimeout(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, delay);\n }\n\n if (!isAtBottom && !manualScrollInterrupted.current) {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }\n\n lastScrollTop.current = currentScrollTop;\n }, [containerRef, deltaUp, deltaDown, delay]);\n\n React.useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return undefined;\n }\n\n container.addEventListener('scroll', onScroll, { passive: true });\n return () => {\n container.removeEventListener('scroll', onScroll);\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n };\n }, [onScroll, containerRef]);\n\n const resumeAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, []);\n\n const stopAutoScroll = React.useCallback(() => {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }, []);\n\n const scrollToTop = React.useCallback(() => {\n stopAutoScroll();\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }, [stopAutoScroll, containerRef]);\n\n const scrollToBottom = React.useCallback(() => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth',\n });\n }\n resumeAutoScroll();\n }, [resumeAutoScroll, containerRef]);\n\n return {\n autoScroll,\n resumeAutoScroll,\n stopAutoScroll,\n scrollToBottom,\n scrollToTop,\n };\n};\n"],"names":[],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,CAAa,OAAA;AAC/B,IAAA,IAAI,CAAC,SAAA,EAAW;AAEhB,IAAA,SAAA,CAAU,QAAA,CAAS;AAAA,MACjB,GAAA,EAAK,CAAA;AAAA,MACL,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,cAAA,EAAgB,YAAY,CAAC,CAAA;AAEjC,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,WAAA,CAAY,MAAM;AAC7C,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,SAAA,CAAU,QAAA,CAAS;AAAA,QACjB,KAAK,SAAA,CAAU,YAAA;AAAA,QACf,QAAA,EAAU;AAAA,OACX,CAAA;AAAA,IACH;AACA,IAAA,gBAAA,EAAiB;AAAA,EACnB,CAAA,EAAG,CAAC,gBAAA,EAAkB,YAAY,CAAC,CAAA;AAEnC,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useAutoScroll.esm.js","sources":["../../src/hooks/useAutoScroll.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RefObject, useCallback, useEffect, useRef, useState } from 'react';\n\ninterface useAutoScrollOptions {\n deltaUp?: number;\n deltaDown?: number;\n delay?: number;\n}\n\nexport const useAutoScroll = (\n containerRef: RefObject<HTMLElement>,\n options: useAutoScrollOptions = {},\n) => {\n const { deltaUp = 10, deltaDown = 60, delay = 200 } = options;\n\n const [autoScroll, setAutoScroll] = useState(true);\n const lastScrollTop = useRef(0);\n const manualScrollInterrupted = useRef(false);\n const debounceTimeout = useRef<NodeJS.Timeout | null>(null);\n\n const onScroll = useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const currentScrollTop = container.scrollTop;\n const isScrollingDown = currentScrollTop > lastScrollTop.current;\n\n const distanceFromBottom =\n container.scrollHeight - container.scrollTop - container.clientHeight;\n\n const delta = isScrollingDown ? deltaDown : deltaUp;\n const isAtBottom = distanceFromBottom <= delta;\n\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n\n if (isAtBottom && manualScrollInterrupted.current && isScrollingDown) {\n debounceTimeout.current = setTimeout(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, delay);\n }\n\n if (!isAtBottom && !manualScrollInterrupted.current) {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }\n\n lastScrollTop.current = currentScrollTop;\n }, [containerRef, deltaUp, deltaDown, delay]);\n\n useEffect(() => {\n const container = containerRef.current;\n if (!container) {\n return undefined;\n }\n\n container.addEventListener('scroll', onScroll, { passive: true });\n return () => {\n container.removeEventListener('scroll', onScroll);\n if (debounceTimeout.current) clearTimeout(debounceTimeout.current);\n };\n }, [onScroll, containerRef]);\n\n const resumeAutoScroll = useCallback(() => {\n manualScrollInterrupted.current = false;\n setAutoScroll(true);\n }, []);\n\n const stopAutoScroll = useCallback(() => {\n manualScrollInterrupted.current = true;\n setAutoScroll(false);\n }, []);\n\n const scrollToTop = useCallback(() => {\n stopAutoScroll();\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }, [stopAutoScroll, containerRef]);\n\n const scrollToBottom = useCallback(() => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({\n top: container.scrollHeight,\n behavior: 'smooth',\n });\n }\n resumeAutoScroll();\n }, [resumeAutoScroll, containerRef]);\n\n return {\n autoScroll,\n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,CAAS;AAAA,MACjB,GAAA,EAAK,CAAA;AAAA,MACL,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH,CAAA,EAAG,CAAC,cAAA,EAAgB,YAAY,CAAC,CAAA;AAEjC,EAAA,MAAM,cAAA,GAAiB,YAAY,MAAM;AACvC,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,SAAA,CAAU,QAAA,CAAS;AAAA,QACjB,KAAK,SAAA,CAAU,YAAA;AAAA,QACf,QAAA,EAAU;AAAA,OACX,CAAA;AAAA,IACH;AACA,IAAA,gBAAA,EAAiB;AAAA,EACnB,CAAA,EAAG,CAAC,gBAAA,EAAkB,YAAY,CAAC,CAAA;AAEnC,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -1,10 +1,10 @@
1
- import React from 'react';
1
+ import { useState, useRef, useEffect } from 'react';
2
2
 
3
3
  const useBufferedMessages = (messages, interval = 30) => {
4
- const [bufferedMessages, setBufferedMessages] = React.useState(messages);
5
- const lastUpdateTime = React.useRef(0);
6
- const animationFrame = React.useRef(null);
7
- React.useEffect(() => {
4
+ const [bufferedMessages, setBufferedMessages] = useState(messages);
5
+ const lastUpdateTime = useRef(0);
6
+ const animationFrame = useRef(null);
7
+ useEffect(() => {
8
8
  const now = Date.now();
9
9
  const update = () => {
10
10
  setBufferedMessages(messages);
@@ -1 +1 @@
1
- {"version":3,"file":"useBufferedMessages.esm.js","sources":["../../src/hooks/useBufferedMessages.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nexport const useBufferedMessages = <T>(messages: T[], interval = 30): T[] => {\n const [bufferedMessages, setBufferedMessages] = React.useState(messages);\n const lastUpdateTime = React.useRef(0);\n const animationFrame = React.useRef<number | null>(null);\n\n React.useEffect(() => {\n const now = Date.now();\n\n const update = () => {\n setBufferedMessages(messages);\n lastUpdateTime.current = now;\n };\n\n if (now - lastUpdateTime.current > interval) {\n update();\n } else {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n animationFrame.current = requestAnimationFrame(update);\n }\n\n return () => {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n };\n }, [messages, interval]);\n\n return bufferedMessages;\n};\n"],"names":[],"mappings":";;AAiBO,MAAM,mBAAA,GAAsB,CAAI,QAAA,EAAe,QAAA,GAAW,EAAA,KAAY;AAC3E,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,KAAA,CAAM,SAAS,QAAQ,CAAA;AACvE,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,CAAO,CAAC,CAAA;AACrC,EAAA,MAAM,cAAA,GAAiB,KAAA,CAAM,MAAA,CAAsB,IAAI,CAAA;AAEvD,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,MAAM,GAAA,GAAM,KAAK,GAAA,EAAI;AAErB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,mBAAA,CAAoB,QAAQ,CAAA;AAC5B,MAAA,cAAA,CAAe,OAAA,GAAU,GAAA;AAAA,IAC3B,CAAA;AAEA,IAAA,IAAI,GAAA,GAAM,cAAA,CAAe,OAAA,GAAU,QAAA,EAAU;AAC3C,MAAA,MAAA,EAAO;AAAA,IACT,CAAA,MAAO;AACL,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AACvE,MAAA,cAAA,CAAe,OAAA,GAAU,sBAAsB,MAAM,CAAA;AAAA,IACvD;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AAAA,IACzE,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAEvB,EAAA,OAAO,gBAAA;AACT;;;;"}
1
+ {"version":3,"file":"useBufferedMessages.esm.js","sources":["../../src/hooks/useBufferedMessages.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useRef, useState } from 'react';\n\nexport const useBufferedMessages = <T>(messages: T[], interval = 30): T[] => {\n const [bufferedMessages, setBufferedMessages] = useState(messages);\n const lastUpdateTime = useRef(0);\n const animationFrame = useRef<number | null>(null);\n\n useEffect(() => {\n const now = Date.now();\n\n const update = () => {\n setBufferedMessages(messages);\n lastUpdateTime.current = now;\n };\n\n if (now - lastUpdateTime.current > interval) {\n update();\n } else {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n animationFrame.current = requestAnimationFrame(update);\n }\n\n return () => {\n if (animationFrame.current) cancelAnimationFrame(animationFrame.current);\n };\n }, [messages, interval]);\n\n return bufferedMessages;\n};\n"],"names":[],"mappings":";;AAkBO,MAAM,mBAAA,GAAsB,CAAI,QAAA,EAAe,QAAA,GAAW,EAAA,KAAY;AAC3E,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,QAAQ,CAAA;AACjE,EAAA,MAAM,cAAA,GAAiB,OAAO,CAAC,CAAA;AAC/B,EAAA,MAAM,cAAA,GAAiB,OAAsB,IAAI,CAAA;AAEjD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,GAAA,GAAM,KAAK,GAAA,EAAI;AAErB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,mBAAA,CAAoB,QAAQ,CAAA;AAC5B,MAAA,cAAA,CAAe,OAAA,GAAU,GAAA;AAAA,IAC3B,CAAA;AAEA,IAAA,IAAI,GAAA,GAAM,cAAA,CAAe,OAAA,GAAU,QAAA,EAAU;AAC3C,MAAA,MAAA,EAAO;AAAA,IACT,CAAA,MAAO;AACL,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AACvE,MAAA,cAAA,CAAe,OAAA,GAAU,sBAAsB,MAAM,CAAA;AAAA,IACvD;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,cAAA,CAAe,OAAA,EAAS,oBAAA,CAAqB,cAAA,CAAe,OAAO,CAAA;AAAA,IACzE,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,QAAA,EAAU,QAAQ,CAAC,CAAA;AAEvB,EAAA,OAAO,gBAAA;AACT;;;;"}
@@ -2,7 +2,7 @@ import { useApi } from '@backstage/core-plugin-api';
2
2
  import { useQuery } from '@tanstack/react-query';
3
3
  import { lightspeedApiRef } from '../api/api.esm.js';
4
4
 
5
- const useConversations = () => {
5
+ const useConversations = (enabled = true) => {
6
6
  const lightspeedApi = useApi(lightspeedApiRef);
7
7
  return useQuery({
8
8
  queryKey: ["conversations"],
@@ -10,6 +10,7 @@ const useConversations = () => {
10
10
  const response = await lightspeedApi.getConversations();
11
11
  return response;
12
12
  },
13
+ enabled,
13
14
  refetchInterval: (query) => {
14
15
  const data = query.state.data;
15
16
  if (!data?.length) return false;
@@ -1 +1 @@
1
- {"version":3,"file":"useConversations.esm.js","sources":["../../src/hooks/useConversations.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { ConversationList } from '../types';\n\n// Fetch all conversations\nexport const useConversations = (): UseQueryResult<ConversationList, Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['conversations'],\n queryFn: async () => {\n const response = await lightspeedApi.getConversations();\n return response;\n },\n refetchInterval: query => {\n const data = query.state.data;\n if (!data?.length) return false;\n const hasNullSummary = data.some(c => !c.topic_summary);\n return hasNullSummary ? 2000 : false;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,mBAAmB,MAA+C;AAC7E,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,eAAe,CAAA;AAAA,IAC1B,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,gBAAA,EAAiB;AACtD,MAAA,OAAO,QAAA;AAAA,IACT,CAAA;AAAA,IACA,iBAAiB,CAAA,KAAA,KAAS;AACxB,MAAA,MAAM,IAAA,GAAO,MAAM,KAAA,CAAM,IAAA;AACzB,MAAA,IAAI,CAAC,IAAA,EAAM,MAAA,EAAQ,OAAO,KAAA;AAC1B,MAAA,MAAM,iBAAiB,IAAA,CAAK,IAAA,CAAK,CAAA,CAAA,KAAK,CAAC,EAAE,aAAa,CAAA;AACtD,MAAA,OAAO,iBAAiB,GAAA,GAAO,KAAA;AAAA,IACjC,CAAA;AAAA,IACA,SAAA,EAAW,MAAO,EAAA,GAAK;AAAA;AAAA,GACxB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"useConversations.esm.js","sources":["../../src/hooks/useConversations.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\n\nimport { useQuery, type UseQueryResult } from '@tanstack/react-query';\n\nimport { lightspeedApiRef } from '../api/api';\nimport { ConversationList } from '../types';\n\n// Fetch all conversations\nexport const useConversations = (\n enabled = true,\n): UseQueryResult<ConversationList, Error> => {\n const lightspeedApi = useApi(lightspeedApiRef);\n return useQuery({\n queryKey: ['conversations'],\n queryFn: async () => {\n const response = await lightspeedApi.getConversations();\n return response;\n },\n enabled,\n refetchInterval: query => {\n const data = query.state.data;\n if (!data?.length) return false;\n const hasNullSummary = data.some(c => !c.topic_summary);\n return hasNullSummary ? 2000 : false;\n },\n staleTime: 1000 * 60 * 5, // 5 minutes\n });\n};\n"],"names":[],"mappings":";;;;AAwBO,MAAM,gBAAA,GAAmB,CAC9B,OAAA,GAAU,IAAA,KACkC;AAC5C,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,QAAA,EAAU,CAAC,eAAe,CAAA;AAAA,IAC1B,SAAS,YAAY;AACnB,MAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,gBAAA,EAAiB;AACtD,MAAA,OAAO,QAAA;AAAA,IACT,CAAA;AAAA,IACA,OAAA;AAAA,IACA,iBAAiB,CAAA,KAAA,KAAS;AACxB,MAAA,MAAM,IAAA,GAAO,MAAM,KAAA,CAAM,IAAA;AACzB,MAAA,IAAI,CAAC,IAAA,EAAM,MAAA,EAAQ,OAAO,KAAA;AAC1B,MAAA,MAAM,iBAAiB,IAAA,CAAK,IAAA,CAAK,CAAA,CAAA,KAAK,CAAC,EAAE,aAAa,CAAA;AACtD,MAAA,OAAO,iBAAiB,GAAA,GAAO,KAAA;AAAA,IACjC,CAAA;AAAA,IACA,SAAA,EAAW,MAAO,EAAA,GAAK;AAAA;AAAA,GACxB,CAAA;AACH;;;;"}
@@ -0,0 +1,15 @@
1
+ import { usePermission } from '@backstage/plugin-permission-react';
2
+ import { iaChatPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';
3
+
4
+ const useIaChatPermission = () => {
5
+ const result = usePermission({
6
+ permission: iaChatPermission
7
+ });
8
+ return {
9
+ loading: result.loading,
10
+ allowed: result.allowed
11
+ };
12
+ };
13
+
14
+ export { useIaChatPermission };
15
+ //# sourceMappingURL=useIaChatPermission.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIaChatPermission.esm.js","sources":["../../src/hooks/useIaChatPermission.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { iaChatPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';\n\nexport const useIaChatPermission = (): {\n loading: boolean;\n allowed: boolean;\n} => {\n const result = usePermission({\n permission: iaChatPermission,\n });\n\n return {\n loading: result.loading,\n allowed: result.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,sBAAsB,MAG9B;AACH,EAAA,MAAM,SAAS,aAAA,CAAc;AAAA,IAC3B,UAAA,EAAY;AAAA,GACb,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO;AAAA,GAClB;AACF;;;;"}
@@ -0,0 +1,15 @@
1
+ import { usePermission } from '@backstage/plugin-permission-react';
2
+ import { iaMcpToolsPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';
3
+
4
+ const useIaMcpToolsPermission = () => {
5
+ const result = usePermission({
6
+ permission: iaMcpToolsPermission
7
+ });
8
+ return {
9
+ loading: result.loading,
10
+ allowed: result.allowed
11
+ };
12
+ };
13
+
14
+ export { useIaMcpToolsPermission };
15
+ //# sourceMappingURL=useIaMcpToolsPermission.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIaMcpToolsPermission.esm.js","sources":["../../src/hooks/useIaMcpToolsPermission.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { iaMcpToolsPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';\n\nexport const useIaMcpToolsPermission = (): {\n loading: boolean;\n allowed: boolean;\n} => {\n const result = usePermission({\n permission: iaMcpToolsPermission,\n });\n\n return {\n loading: result.loading,\n allowed: result.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,0BAA0B,MAGlC;AACH,EAAA,MAAM,SAAS,aAAA,CAAc;AAAA,IAC3B,UAAA,EAAY;AAAA,GACb,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO;AAAA,GAClB;AACF;;;;"}
@@ -1,16 +1,15 @@
1
1
  import { usePermission } from '@backstage/plugin-permission-react';
2
2
  import { iaNotebooksPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';
3
3
 
4
- const useLightspeedNotebooksPermission = () => {
4
+ const useIaNotebooksPermission = () => {
5
5
  const result = usePermission({
6
6
  permission: iaNotebooksPermission
7
7
  });
8
8
  return {
9
9
  loading: result.loading,
10
- allowed: result.allowed,
11
- iaNotebooksPermissionName: iaNotebooksPermission.name
10
+ allowed: result.allowed
12
11
  };
13
12
  };
14
13
 
15
- export { useLightspeedNotebooksPermission };
16
- //# sourceMappingURL=useLightspeedNotebooksPermission.esm.js.map
14
+ export { useIaNotebooksPermission };
15
+ //# sourceMappingURL=useIaNotebooksPermission.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIaNotebooksPermission.esm.js","sources":["../../src/hooks/useIaNotebooksPermission.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { usePermission } from '@backstage/plugin-permission-react';\n\nimport { iaNotebooksPermission } from '@red-hat-developer-hub/backstage-plugin-intelligent-assistant-common';\n\nexport const useIaNotebooksPermission = (): {\n loading: boolean;\n allowed: boolean;\n} => {\n const result = usePermission({\n permission: iaNotebooksPermission,\n });\n\n return {\n loading: result.loading,\n allowed: result.allowed,\n };\n};\n"],"names":[],"mappings":";;;AAoBO,MAAM,2BAA2B,MAGnC;AACH,EAAA,MAAM,SAAS,aAAA,CAAc;AAAA,IAC3B,UAAA,EAAY;AAAA,GACb,CAAA;AAED,EAAA,OAAO;AAAA,IACL,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,SAAS,MAAA,CAAO;AAAA,GAClB;AACF;;;;"}
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
 
3
3
  const useIsMobile = () => {
4
- const [isMobile, setIsMobile] = React.useState(window.innerWidth <= 768);
5
- React.useEffect(() => {
4
+ const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);
5
+ useEffect(() => {
6
6
  const handleResize = () => setIsMobile(window.innerWidth <= 768);
7
7
  window.addEventListener("resize", handleResize);
8
8
  return () => window.removeEventListener("resize", handleResize);
@@ -1 +1 @@
1
- {"version":3,"file":"useIsMobile.esm.js","sources":["../../src/hooks/useIsMobile.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\n\nexport const useIsMobile = () => {\n const [isMobile, setIsMobile] = React.useState(window.innerWidth <= 768);\n\n React.useEffect(() => {\n const handleResize = () => setIsMobile(window.innerWidth <= 768);\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return isMobile;\n};\n"],"names":[],"mappings":";;AAiBO,MAAM,cAAc,MAAM;AAC/B,EAAA,MAAM,CAAC,UAAU,WAAW,CAAA,GAAI,MAAM,QAAA,CAAS,MAAA,CAAO,cAAc,GAAG,CAAA;AAEvE,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,MAAM,YAAA,GAAe,MAAM,WAAA,CAAY,MAAA,CAAO,cAAc,GAAG,CAAA;AAC/D,IAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,YAAY,CAAA;AAE9C,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,EAAU,YAAY,CAAA;AAAA,EAChE,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,QAAA;AACT;;;;"}
1
+ {"version":3,"file":"useIsMobile.esm.js","sources":["../../src/hooks/useIsMobile.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEffect, useState } from 'react';\n\nexport const useIsMobile = () => {\n const [isMobile, setIsMobile] = useState(window.innerWidth <= 768);\n\n useEffect(() => {\n const handleResize = () => setIsMobile(window.innerWidth <= 768);\n window.addEventListener('resize', handleResize);\n\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return isMobile;\n};\n"],"names":[],"mappings":";;AAkBO,MAAM,cAAc,MAAM;AAC/B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,IAAI,QAAA,CAAS,MAAA,CAAO,cAAc,GAAG,CAAA;AAEjE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,YAAA,GAAe,MAAM,WAAA,CAAY,MAAA,CAAO,cAAc,GAAG,CAAA;AAC/D,IAAA,MAAA,CAAO,gBAAA,CAAiB,UAAU,YAAY,CAAA;AAE9C,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,QAAA,EAAU,YAAY,CAAA;AAAA,EAChE,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,QAAA;AACT;;;;"}
@@ -5,7 +5,6 @@ import { useTranslation } from './useTranslation.esm.js';
5
5
  const SAVED_TOKEN_MASK = "********************";
6
6
  const useMcpConfigureModal = ({
7
7
  servers,
8
- canManageMcp,
9
8
  isSaving,
10
9
  patchServer,
11
10
  validateServer,
@@ -201,7 +200,7 @@ const useMcpConfigureModal = ({
201
200
  isDcrServer: editingServer?.auth === "dcr"
202
201
  });
203
202
  const removePersonalToken = useCallback(async () => {
204
- if (!editingServer || !canManageMcp || isUpdatingModalStatus || editingServer.hasOrgToken) {
203
+ if (!editingServer || isUpdatingModalStatus || editingServer.hasOrgToken) {
205
204
  return;
206
205
  }
207
206
  setIsUpdatingModalStatus(true);
@@ -229,7 +228,6 @@ const useMcpConfigureModal = ({
229
228
  setIsUpdatingModalStatus(false);
230
229
  }
231
230
  }, [
232
- canManageMcp,
233
231
  editingServer,
234
232
  editingServerId,
235
233
  isUpdatingModalStatus,
@@ -237,7 +235,7 @@ const useMcpConfigureModal = ({
237
235
  servers
238
236
  ]);
239
237
  const save = useCallback(async () => {
240
- if (!editingServer || !canManageMcp) return;
238
+ if (!editingServer) return;
241
239
  const hasCredentialModeChange = modalCredentialMode !== initialCredentialMode;
242
240
  const hasTokenInputChange = tokenInputValue !== initialTokenInputValue;
243
241
  const hasEnabledInputChange = modalEnabled !== editingServer.enabled;
@@ -335,7 +333,6 @@ const useMcpConfigureModal = ({
335
333
  markFailedTokenAttempt();
336
334
  }
337
335
  }, [
338
- canManageMcp,
339
336
  close,
340
337
  editingServer,
341
338
  initialCredentialMode,
@@ -350,12 +347,12 @@ const useMcpConfigureModal = ({
350
347
  ]);
351
348
  const onModalEnabledChange = useCallback(
352
349
  (_event, checked) => {
353
- if (!editingServer || !canManageMcp) {
350
+ if (!editingServer) {
354
351
  return;
355
352
  }
356
353
  setModalEnabled(checked);
357
354
  },
358
- [editingServer, canManageMcp]
355
+ [editingServer]
359
356
  );
360
357
  const modalVerifiedHasToken = editingServer ? editingServer.auth === "dcr" || getModalVerifiedHasToken({
361
358
  hasOrgToken: editingServer.hasOrgToken,
@@ -373,7 +370,7 @@ const useMcpConfigureModal = ({
373
370
  },
374
371
  modalEnabled
375
372
  ) : "unknown";
376
- const isModalEnabledToggleDisabled = !canManageMcp || !editingServer || isUpdatingModalStatus || isEnabledToggleUnavailable(modalDisplayStatus) || Boolean(isSaving[editingServer?.name ?? ""]);
373
+ const isModalEnabledToggleDisabled = !editingServer || isUpdatingModalStatus || isEnabledToggleUnavailable(modalDisplayStatus) || Boolean(isSaving[editingServer?.name ?? ""]);
377
374
  const isModalEnabledChecked$1 = isModalEnabledChecked({
378
375
  displayStatus: modalDisplayStatus,
379
376
  modalEnabled
@@ -425,7 +422,6 @@ const useMcpConfigureModal = ({
425
422
  close,
426
423
  save,
427
424
  removePersonalToken,
428
- canManageMcp,
429
425
  configureModalTitle,
430
426
  isConfigureModalSaving,
431
427
  isSaveTokenButtonDisabled,