@oneuptime/common 9.2.26 → 9.3.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 (278) hide show
  1. package/Models/DatabaseModels/AIAgent.ts +589 -0
  2. package/Models/DatabaseModels/AIAgentOwnerTeam.ts +434 -0
  3. package/Models/DatabaseModels/AIAgentOwnerUser.ts +433 -0
  4. package/Models/DatabaseModels/AIAgentTask.ts +549 -0
  5. package/Models/DatabaseModels/AIAgentTaskLog.ts +417 -0
  6. package/Models/DatabaseModels/AIAgentTaskPullRequest.ts +731 -0
  7. package/Models/DatabaseModels/AIAgentTaskTelemetryException.ts +388 -0
  8. package/Models/DatabaseModels/Index.ts +15 -0
  9. package/Models/DatabaseModels/Monitor.ts +33 -0
  10. package/Models/DatabaseModels/Project.ts +25 -0
  11. package/Models/DatabaseModels/TelemetryException.ts +1 -1
  12. package/Server/API/AIAgentAPI.ts +200 -0
  13. package/Server/API/AIAgentDataAPI.ts +692 -0
  14. package/Server/API/AIAgentTaskAPI.ts +286 -0
  15. package/Server/API/AIAgentTaskLogAPI.ts +165 -0
  16. package/Server/API/AIAgentTaskPullRequestAPI.ts +14 -0
  17. package/Server/API/GitHubAPI.ts +25 -7
  18. package/Server/API/TelemetryExceptionAPI.ts +169 -0
  19. package/Server/EnvironmentConfig.ts +3 -0
  20. package/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.ts +195 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.ts +31 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.ts +17 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.ts +63 -0
  24. package/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.ts +75 -0
  25. package/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.ts +157 -0
  26. package/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.ts +33 -0
  27. package/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.ts +27 -0
  28. package/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.ts +37 -0
  29. package/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.ts +31 -0
  30. package/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.ts +35 -0
  31. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +22 -0
  32. package/Server/Services/AIAgentOwnerTeamService.ts +10 -0
  33. package/Server/Services/AIAgentOwnerUserService.ts +10 -0
  34. package/Server/Services/AIAgentService.ts +564 -0
  35. package/Server/Services/AIAgentTaskLogService.ts +10 -0
  36. package/Server/Services/AIAgentTaskPullRequestService.ts +10 -0
  37. package/Server/Services/AIAgentTaskService.ts +178 -0
  38. package/Server/Services/AIAgentTaskTelemetryExceptionService.ts +39 -0
  39. package/Server/Services/Index.ts +10 -0
  40. package/Server/Services/TelemetryExceptionService.ts +162 -0
  41. package/Server/Types/Workflow/Components/Index.ts +2 -0
  42. package/Server/Types/Workflow/Components/Telegram/SendMessageToChat.ts +146 -0
  43. package/Server/Utils/Monitor/MonitorResource.ts +228 -0
  44. package/Server/Utils/PushNotificationUtil.ts +29 -0
  45. package/Server/Utils/WhatsAppTemplateUtil.ts +6 -0
  46. package/Tests/UI/Components/Badge.test.tsx +5 -5
  47. package/Tests/UI/Components/Card.test.tsx +4 -8
  48. package/Tests/UI/Components/HiddenText.test.tsx +2 -5
  49. package/Tests/UI/Components/SideMenuItem.test.tsx +4 -2
  50. package/Types/AI/AIAgentTaskMetadata.ts +25 -0
  51. package/Types/AI/AIAgentTaskStatus.ts +65 -0
  52. package/Types/AI/AIAgentTaskType.ts +40 -0
  53. package/Types/Email/EmailTemplateType.ts +2 -0
  54. package/Types/Monitor/MonitorEvaluationSummary.ts +2 -1
  55. package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
  56. package/Types/Permission.ts +176 -0
  57. package/Types/WhatsApp/WhatsAppTemplates.ts +9 -0
  58. package/Types/Workflow/ComponentID.ts +1 -0
  59. package/Types/Workflow/Components/Telegram.ts +76 -0
  60. package/Types/Workflow/Components.ts +7 -0
  61. package/UI/Components/AIAgent/AIAgent.tsx +69 -0
  62. package/UI/Components/Badge/Badge.tsx +9 -5
  63. package/UI/Components/Banner/Banner.tsx +1 -1
  64. package/UI/Components/Card/Card.tsx +14 -12
  65. package/UI/Components/CodeBlock/CodeBlock.tsx +47 -4
  66. package/UI/Components/Detail/Detail.tsx +239 -49
  67. package/UI/Components/Detail/FieldLabel.tsx +35 -11
  68. package/UI/Components/Detail/PlaceholderText.tsx +18 -1
  69. package/UI/Components/Footer/Footer.tsx +9 -7
  70. package/UI/Components/Header/Header.tsx +4 -3
  71. package/UI/Components/Header/HeaderIconDropdownButton.tsx +13 -11
  72. package/UI/Components/Header/IconDropdown/IconDropdownItem.tsx +3 -3
  73. package/UI/Components/Header/IconDropdown/IconDropdownMenu.tsx +1 -1
  74. package/UI/Components/Header/ProjectPicker/CreateNewProjectButton.tsx +4 -4
  75. package/UI/Components/Header/ProjectPicker/ProjectPicker.tsx +6 -6
  76. package/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.tsx +3 -3
  77. package/UI/Components/Header/ProjectPicker/ProjectPickerMenu.tsx +1 -1
  78. package/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.tsx +4 -4
  79. package/UI/Components/HeaderAlert/HeaderAlert.tsx +32 -32
  80. package/UI/Components/HeaderAlert/HeaderAlertGroup.tsx +1 -7
  81. package/UI/Components/HiddenText/HiddenText.tsx +98 -27
  82. package/UI/Components/Icon/Icon.tsx +12 -9
  83. package/UI/Components/InfoCard/InfoCard.tsx +7 -3
  84. package/UI/Components/ModelTable/BaseModelTable.tsx +1 -1
  85. package/UI/Components/ObjectID/ObjectIDView.tsx +73 -0
  86. package/UI/Components/Page/Page.tsx +3 -5
  87. package/UI/Components/SideMenu/SideMenu.tsx +175 -40
  88. package/UI/Components/SideMenu/SideMenuDivider.tsx +17 -0
  89. package/UI/Components/SideMenu/SideMenuItem.tsx +111 -158
  90. package/UI/Components/SideMenu/SideMenuSection.tsx +53 -3
  91. package/UI/Components/Table/Table.tsx +1 -1
  92. package/UI/Components/Types/FieldType.ts +2 -0
  93. package/UI/Config.ts +5 -0
  94. package/build/dist/Models/DatabaseModels/AIAgent.js +614 -0
  95. package/build/dist/Models/DatabaseModels/AIAgent.js.map +1 -0
  96. package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js +452 -0
  97. package/build/dist/Models/DatabaseModels/AIAgentOwnerTeam.js.map +1 -0
  98. package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js +451 -0
  99. package/build/dist/Models/DatabaseModels/AIAgentOwnerUser.js.map +1 -0
  100. package/build/dist/Models/DatabaseModels/AIAgentTask.js +580 -0
  101. package/build/dist/Models/DatabaseModels/AIAgentTask.js.map +1 -0
  102. package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js +438 -0
  103. package/build/dist/Models/DatabaseModels/AIAgentTaskLog.js.map +1 -0
  104. package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js +771 -0
  105. package/build/dist/Models/DatabaseModels/AIAgentTaskPullRequest.js.map +1 -0
  106. package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js +404 -0
  107. package/build/dist/Models/DatabaseModels/AIAgentTaskTelemetryException.js.map +1 -0
  108. package/build/dist/Models/DatabaseModels/Index.js +14 -0
  109. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  110. package/build/dist/Models/DatabaseModels/Monitor.js +34 -0
  111. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  112. package/build/dist/Models/DatabaseModels/Project.js +26 -0
  113. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  114. package/build/dist/Models/DatabaseModels/TelemetryException.js +1 -1
  115. package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -1
  116. package/build/dist/Server/API/AIAgentAPI.js +141 -0
  117. package/build/dist/Server/API/AIAgentAPI.js.map +1 -0
  118. package/build/dist/Server/API/AIAgentDataAPI.js +415 -0
  119. package/build/dist/Server/API/AIAgentDataAPI.js.map +1 -0
  120. package/build/dist/Server/API/AIAgentTaskAPI.js +199 -0
  121. package/build/dist/Server/API/AIAgentTaskAPI.js.map +1 -0
  122. package/build/dist/Server/API/AIAgentTaskLogAPI.js +106 -0
  123. package/build/dist/Server/API/AIAgentTaskLogAPI.js.map +1 -0
  124. package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js +9 -0
  125. package/build/dist/Server/API/AIAgentTaskPullRequestAPI.js.map +1 -0
  126. package/build/dist/Server/API/GitHubAPI.js +23 -8
  127. package/build/dist/Server/API/GitHubAPI.js.map +1 -1
  128. package/build/dist/Server/API/TelemetryExceptionAPI.js +120 -0
  129. package/build/dist/Server/API/TelemetryExceptionAPI.js.map +1 -0
  130. package/build/dist/Server/EnvironmentConfig.js +2 -0
  131. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  132. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js +74 -0
  133. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766590916627-MigrationName.js.map +1 -0
  134. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js +18 -0
  135. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766600860972-MigrationName.js.map +1 -0
  136. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js +12 -0
  137. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766606720183-MigrationName.js.map +1 -0
  138. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js +28 -0
  139. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766688107858-MigrationName.js.map +1 -0
  140. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js +32 -0
  141. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766754182870-MigrationName.js.map +1 -0
  142. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js +60 -0
  143. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766774689743-MigrationName.js.map +1 -0
  144. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js +18 -0
  145. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766777986427-MigrationName.js.map +1 -0
  146. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js +16 -0
  147. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766918848434-AddAIAgentIsDefault.js.map +1 -0
  148. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js +20 -0
  149. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766923324521-MigrationName.js.map +1 -0
  150. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js +16 -0
  151. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1766958924188-AddGitHubAppInstallationIdToProject.js.map +1 -0
  152. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js +18 -0
  153. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1767009661768-MigrationName.js.map +1 -0
  154. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +22 -0
  155. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  156. package/build/dist/Server/Services/AIAgentOwnerTeamService.js +9 -0
  157. package/build/dist/Server/Services/AIAgentOwnerTeamService.js.map +1 -0
  158. package/build/dist/Server/Services/AIAgentOwnerUserService.js +9 -0
  159. package/build/dist/Server/Services/AIAgentOwnerUserService.js.map +1 -0
  160. package/build/dist/Server/Services/AIAgentService.js +471 -0
  161. package/build/dist/Server/Services/AIAgentService.js.map +1 -0
  162. package/build/dist/Server/Services/AIAgentTaskLogService.js +9 -0
  163. package/build/dist/Server/Services/AIAgentTaskLogService.js.map +1 -0
  164. package/build/dist/Server/Services/AIAgentTaskPullRequestService.js +9 -0
  165. package/build/dist/Server/Services/AIAgentTaskPullRequestService.js.map +1 -0
  166. package/build/dist/Server/Services/AIAgentTaskService.js +158 -0
  167. package/build/dist/Server/Services/AIAgentTaskService.js.map +1 -0
  168. package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js +36 -0
  169. package/build/dist/Server/Services/AIAgentTaskTelemetryExceptionService.js.map +1 -0
  170. package/build/dist/Server/Services/Index.js +10 -0
  171. package/build/dist/Server/Services/Index.js.map +1 -1
  172. package/build/dist/Server/Services/TelemetryExceptionService.js +137 -0
  173. package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -1
  174. package/build/dist/Server/Types/Workflow/Components/Index.js +2 -0
  175. package/build/dist/Server/Types/Workflow/Components/Index.js.map +1 -1
  176. package/build/dist/Server/Types/Workflow/Components/Telegram/SendMessageToChat.js +119 -0
  177. package/build/dist/Server/Types/Workflow/Components/Telegram/SendMessageToChat.js.map +1 -0
  178. package/build/dist/Server/Utils/Monitor/MonitorResource.js +168 -0
  179. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  180. package/build/dist/Server/Utils/PushNotificationUtil.js +21 -0
  181. package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -1
  182. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +4 -0
  183. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
  184. package/build/dist/Tests/UI/Components/Badge.test.js +5 -5
  185. package/build/dist/Tests/UI/Components/Badge.test.js.map +1 -1
  186. package/build/dist/Tests/UI/Components/Card.test.js +4 -8
  187. package/build/dist/Tests/UI/Components/Card.test.js.map +1 -1
  188. package/build/dist/Tests/UI/Components/HiddenText.test.js +2 -3
  189. package/build/dist/Tests/UI/Components/HiddenText.test.js.map +1 -1
  190. package/build/dist/Tests/UI/Components/SideMenuItem.test.js +3 -2
  191. package/build/dist/Tests/UI/Components/SideMenuItem.test.js.map +1 -1
  192. package/build/dist/Types/AI/AIAgentTaskMetadata.js +6 -0
  193. package/build/dist/Types/AI/AIAgentTaskMetadata.js.map +1 -0
  194. package/build/dist/Types/AI/AIAgentTaskStatus.js +51 -0
  195. package/build/dist/Types/AI/AIAgentTaskStatus.js.map +1 -0
  196. package/build/dist/Types/AI/AIAgentTaskType.js +29 -0
  197. package/build/dist/Types/AI/AIAgentTaskType.js.map +1 -0
  198. package/build/dist/Types/Email/EmailTemplateType.js +2 -0
  199. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  200. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
  201. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
  202. package/build/dist/Types/Permission.js +160 -0
  203. package/build/dist/Types/Permission.js.map +1 -1
  204. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js +6 -0
  205. package/build/dist/Types/WhatsApp/WhatsAppTemplates.js.map +1 -1
  206. package/build/dist/Types/Workflow/ComponentID.js +1 -0
  207. package/build/dist/Types/Workflow/ComponentID.js.map +1 -1
  208. package/build/dist/Types/Workflow/Components/Telegram.js +69 -0
  209. package/build/dist/Types/Workflow/Components/Telegram.js.map +1 -0
  210. package/build/dist/Types/Workflow/Components.js +7 -0
  211. package/build/dist/Types/Workflow/Components.js.map +1 -1
  212. package/build/dist/UI/Components/AIAgent/AIAgent.js +32 -0
  213. package/build/dist/UI/Components/AIAgent/AIAgent.js.map +1 -0
  214. package/build/dist/UI/Components/Badge/Badge.js +9 -5
  215. package/build/dist/UI/Components/Badge/Badge.js.map +1 -1
  216. package/build/dist/UI/Components/Banner/Banner.js +1 -1
  217. package/build/dist/UI/Components/Banner/Banner.js.map +1 -1
  218. package/build/dist/UI/Components/Card/Card.js +12 -12
  219. package/build/dist/UI/Components/Card/Card.js.map +1 -1
  220. package/build/dist/UI/Components/CodeBlock/CodeBlock.js +22 -2
  221. package/build/dist/UI/Components/CodeBlock/CodeBlock.js.map +1 -1
  222. package/build/dist/UI/Components/Detail/Detail.js +117 -37
  223. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  224. package/build/dist/UI/Components/Detail/FieldLabel.js +12 -7
  225. package/build/dist/UI/Components/Detail/FieldLabel.js.map +1 -1
  226. package/build/dist/UI/Components/Detail/PlaceholderText.js +4 -1
  227. package/build/dist/UI/Components/Detail/PlaceholderText.js.map +1 -1
  228. package/build/dist/UI/Components/Footer/Footer.js +6 -6
  229. package/build/dist/UI/Components/Footer/Footer.js.map +1 -1
  230. package/build/dist/UI/Components/Header/Header.js +4 -3
  231. package/build/dist/UI/Components/Header/Header.js.map +1 -1
  232. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js +7 -7
  233. package/build/dist/UI/Components/Header/HeaderIconDropdownButton.js.map +1 -1
  234. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js +3 -3
  235. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownItem.js.map +1 -1
  236. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js +1 -1
  237. package/build/dist/UI/Components/Header/IconDropdown/IconDropdownMenu.js.map +1 -1
  238. package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js +4 -4
  239. package/build/dist/UI/Components/Header/ProjectPicker/CreateNewProjectButton.js.map +1 -1
  240. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js +6 -6
  241. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPicker.js.map +1 -1
  242. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js +2 -2
  243. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerFilterBox.js.map +1 -1
  244. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js +1 -1
  245. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenu.js.map +1 -1
  246. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js +4 -4
  247. package/build/dist/UI/Components/Header/ProjectPicker/ProjectPickerMenuItem.js.map +1 -1
  248. package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js +31 -29
  249. package/build/dist/UI/Components/HeaderAlert/HeaderAlert.js.map +1 -1
  250. package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js +1 -3
  251. package/build/dist/UI/Components/HeaderAlert/HeaderAlertGroup.js.map +1 -1
  252. package/build/dist/UI/Components/HiddenText/HiddenText.js +33 -14
  253. package/build/dist/UI/Components/HiddenText/HiddenText.js.map +1 -1
  254. package/build/dist/UI/Components/Icon/Icon.js +3 -4
  255. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  256. package/build/dist/UI/Components/InfoCard/InfoCard.js +3 -3
  257. package/build/dist/UI/Components/InfoCard/InfoCard.js.map +1 -1
  258. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +1 -1
  259. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  260. package/build/dist/UI/Components/ObjectID/ObjectIDView.js +30 -0
  261. package/build/dist/UI/Components/ObjectID/ObjectIDView.js.map +1 -0
  262. package/build/dist/UI/Components/Page/Page.js +3 -3
  263. package/build/dist/UI/Components/Page/Page.js.map +1 -1
  264. package/build/dist/UI/Components/SideMenu/SideMenu.js +82 -17
  265. package/build/dist/UI/Components/SideMenu/SideMenu.js.map +1 -1
  266. package/build/dist/UI/Components/SideMenu/SideMenuDivider.js +7 -0
  267. package/build/dist/UI/Components/SideMenu/SideMenuDivider.js.map +1 -0
  268. package/build/dist/UI/Components/SideMenu/SideMenuItem.js +68 -97
  269. package/build/dist/UI/Components/SideMenu/SideMenuItem.js.map +1 -1
  270. package/build/dist/UI/Components/SideMenu/SideMenuSection.js +18 -3
  271. package/build/dist/UI/Components/SideMenu/SideMenuSection.js.map +1 -1
  272. package/build/dist/UI/Components/Table/Table.js +1 -1
  273. package/build/dist/UI/Components/Table/Table.js.map +1 -1
  274. package/build/dist/UI/Components/Types/FieldType.js +2 -0
  275. package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
  276. package/build/dist/UI/Config.js +2 -0
  277. package/build/dist/UI/Config.js.map +1 -1
  278. package/package.json +1 -1
@@ -96,6 +96,21 @@ enum Permission {
96
96
  EditProjectProbe = "EditProjectProbe",
97
97
  ReadProjectProbe = "ReadProjectProbe",
98
98
 
99
+ CreateProjectAIAgent = "CreateProjectAIAgent",
100
+ DeleteProjectAIAgent = "DeleteProjectAIAgent",
101
+ EditProjectAIAgent = "EditProjectAIAgent",
102
+ ReadProjectAIAgent = "ReadProjectAIAgent",
103
+
104
+ CreateProjectAIAgentTask = "CreateProjectAIAgentTask",
105
+ DeleteProjectAIAgentTask = "DeleteProjectAIAgentTask",
106
+ EditProjectAIAgentTask = "EditProjectAIAgentTask",
107
+ ReadProjectAIAgentTask = "ReadProjectAIAgentTask",
108
+
109
+ CreateProjectAIAgentTaskTelemetryException = "CreateProjectAIAgentTaskTelemetryException",
110
+ DeleteProjectAIAgentTaskTelemetryException = "DeleteProjectAIAgentTaskTelemetryException",
111
+ EditProjectAIAgentTaskTelemetryException = "EditProjectAIAgentTaskTelemetryException",
112
+ ReadProjectAIAgentTaskTelemetryException = "ReadProjectAIAgentTaskTelemetryException",
113
+
99
114
  CreateProjectLlm = "CreateProjectLlm",
100
115
  DeleteProjectLlm = "DeleteProjectLlm",
101
116
  EditProjectLlm = "EditProjectLlm",
@@ -646,6 +661,16 @@ enum Permission {
646
661
  EditProbeOwnerUser = "EditProbeOwnerUser",
647
662
  ReadProbeOwnerUser = "ReadProbeOwnerUser",
648
663
 
664
+ CreateAIAgentOwnerTeam = "CreateAIAgentOwnerTeam",
665
+ DeleteAIAgentOwnerTeam = "DeleteAIAgentOwnerTeam",
666
+ EditAIAgentOwnerTeam = "EditAIAgentOwnerTeam",
667
+ ReadAIAgentOwnerTeam = "ReadAIAgentOwnerTeam",
668
+
669
+ CreateAIAgentOwnerUser = "CreateAIAgentOwnerUser",
670
+ DeleteAIAgentOwnerUser = "DeleteAIAgentOwnerUser",
671
+ EditAIAgentOwnerUser = "EditAIAgentOwnerUser",
672
+ ReadAIAgentOwnerUser = "ReadAIAgentOwnerUser",
673
+
649
674
  CreateTableView = "CreateTableView",
650
675
  DeleteTableView = "DeleteTableView",
651
676
  EditTableView = "EditTableView",
@@ -2744,6 +2769,99 @@ export class PermissionHelper {
2744
2769
  isAccessControlPermission: true,
2745
2770
  },
2746
2771
 
2772
+ {
2773
+ permission: Permission.CreateProjectAIAgent,
2774
+ title: "Create AI Agent",
2775
+ description: "This permission can create AI agents for this project.",
2776
+ isAssignableToTenant: true,
2777
+ isAccessControlPermission: true,
2778
+ },
2779
+ {
2780
+ permission: Permission.DeleteProjectAIAgent,
2781
+ title: "Delete AI Agent",
2782
+ description: "This permission can delete AI agents of this project.",
2783
+ isAssignableToTenant: true,
2784
+ isAccessControlPermission: true,
2785
+ },
2786
+ {
2787
+ permission: Permission.EditProjectAIAgent,
2788
+ title: "Edit AI Agent",
2789
+ description: "This permission can edit AI agents of this project.",
2790
+ isAssignableToTenant: true,
2791
+ isAccessControlPermission: true,
2792
+ },
2793
+ {
2794
+ permission: Permission.ReadProjectAIAgent,
2795
+ title: "Read AI Agent",
2796
+ description: "This permission can read AI agents of this project.",
2797
+ isAssignableToTenant: true,
2798
+ isAccessControlPermission: true,
2799
+ },
2800
+
2801
+ {
2802
+ permission: Permission.CreateProjectAIAgentTask,
2803
+ title: "Create AI Agent Task",
2804
+ description:
2805
+ "This permission can create AI agent tasks for this project.",
2806
+ isAssignableToTenant: true,
2807
+ isAccessControlPermission: false,
2808
+ },
2809
+ {
2810
+ permission: Permission.DeleteProjectAIAgentTask,
2811
+ title: "Delete AI Agent Task",
2812
+ description:
2813
+ "This permission can delete AI agent tasks of this project.",
2814
+ isAssignableToTenant: true,
2815
+ isAccessControlPermission: true,
2816
+ },
2817
+ {
2818
+ permission: Permission.EditProjectAIAgentTask,
2819
+ title: "Edit AI Agent Task",
2820
+ description: "This permission can edit AI agent tasks of this project.",
2821
+ isAssignableToTenant: true,
2822
+ isAccessControlPermission: true,
2823
+ },
2824
+ {
2825
+ permission: Permission.ReadProjectAIAgentTask,
2826
+ title: "Read AI Agent Task",
2827
+ description: "This permission can read AI agent tasks of this project.",
2828
+ isAssignableToTenant: true,
2829
+ isAccessControlPermission: true,
2830
+ },
2831
+
2832
+ {
2833
+ permission: Permission.CreateProjectAIAgentTaskTelemetryException,
2834
+ title: "Create AI Agent Task Exception Link",
2835
+ description:
2836
+ "This permission can create links between AI agent tasks and telemetry exceptions.",
2837
+ isAssignableToTenant: true,
2838
+ isAccessControlPermission: false,
2839
+ },
2840
+ {
2841
+ permission: Permission.DeleteProjectAIAgentTaskTelemetryException,
2842
+ title: "Delete AI Agent Task Exception Link",
2843
+ description:
2844
+ "This permission can delete links between AI agent tasks and telemetry exceptions.",
2845
+ isAssignableToTenant: true,
2846
+ isAccessControlPermission: true,
2847
+ },
2848
+ {
2849
+ permission: Permission.EditProjectAIAgentTaskTelemetryException,
2850
+ title: "Edit AI Agent Task Exception Link",
2851
+ description:
2852
+ "This permission can edit links between AI agent tasks and telemetry exceptions.",
2853
+ isAssignableToTenant: true,
2854
+ isAccessControlPermission: true,
2855
+ },
2856
+ {
2857
+ permission: Permission.ReadProjectAIAgentTaskTelemetryException,
2858
+ title: "Read AI Agent Task Exception Link",
2859
+ description:
2860
+ "This permission can read links between AI agent tasks and telemetry exceptions.",
2861
+ isAssignableToTenant: true,
2862
+ isAccessControlPermission: true,
2863
+ },
2864
+
2747
2865
  {
2748
2866
  permission: Permission.CreateProjectLlm,
2749
2867
  title: "Create LLM",
@@ -3306,6 +3424,64 @@ export class PermissionHelper {
3306
3424
  isAccessControlPermission: false,
3307
3425
  },
3308
3426
 
3427
+ {
3428
+ permission: Permission.CreateAIAgentOwnerTeam,
3429
+ title: "Create AI Agent Owner Team",
3430
+ description: "This permission can create team owners for AI agents.",
3431
+ isAssignableToTenant: true,
3432
+ isAccessControlPermission: false,
3433
+ },
3434
+ {
3435
+ permission: Permission.DeleteAIAgentOwnerTeam,
3436
+ title: "Delete AI Agent Owner Team",
3437
+ description: "This permission can delete team owners for AI agents",
3438
+ isAssignableToTenant: true,
3439
+ isAccessControlPermission: false,
3440
+ },
3441
+ {
3442
+ permission: Permission.EditAIAgentOwnerTeam,
3443
+ title: "Edit AI Agent Owner Team",
3444
+ description: "This permission can edit team owners for AI agents",
3445
+ isAssignableToTenant: true,
3446
+ isAccessControlPermission: false,
3447
+ },
3448
+ {
3449
+ permission: Permission.ReadAIAgentOwnerTeam,
3450
+ title: "Read AI Agent Owner Team",
3451
+ description: "This permission can read team owners for AI agents",
3452
+ isAssignableToTenant: true,
3453
+ isAccessControlPermission: false,
3454
+ },
3455
+
3456
+ {
3457
+ permission: Permission.CreateAIAgentOwnerUser,
3458
+ title: "Create AI Agent Owner User",
3459
+ description: "This permission can create user owners for AI agents.",
3460
+ isAssignableToTenant: true,
3461
+ isAccessControlPermission: false,
3462
+ },
3463
+ {
3464
+ permission: Permission.DeleteAIAgentOwnerUser,
3465
+ title: "Delete AI Agent Owner User",
3466
+ description: "This permission can delete user owners for AI agents",
3467
+ isAssignableToTenant: true,
3468
+ isAccessControlPermission: false,
3469
+ },
3470
+ {
3471
+ permission: Permission.EditAIAgentOwnerUser,
3472
+ title: "Edit AI Agent Owner User",
3473
+ description: "This permission can edit user owners for AI agents",
3474
+ isAssignableToTenant: true,
3475
+ isAccessControlPermission: false,
3476
+ },
3477
+ {
3478
+ permission: Permission.ReadAIAgentOwnerUser,
3479
+ title: "Read AI Agent Owner User",
3480
+ description: "This permission can read user owners for AI agents",
3481
+ isAssignableToTenant: true,
3482
+ isAccessControlPermission: false,
3483
+ },
3484
+
3309
3485
  {
3310
3486
  permission: Permission.CreateServiceCatalog,
3311
3487
  title: "Create Service Catalog",
@@ -30,6 +30,8 @@ type TemplateIdsMap = {
30
30
  readonly OnCallUserAddedToPolicyNotification: "oneuptime_oncall_user_added_to_policy_notification";
31
31
  readonly OnCallUserRemovedFromPolicyNotification: "oneuptime_oncall_user_removed_from_policy_notification";
32
32
  readonly OnCallUserNoLongerActiveNotification: "oneuptime_oncall_user_no_longer_active_notification";
33
+ readonly AIAgentStatusChangedOwnerNotification: "oneuptime_ai_agent_status_changed_owner_notification";
34
+ readonly AIAgentOwnerAddedNotification: "oneuptime_ai_agent_owner_added_notification";
33
35
  };
34
36
 
35
37
  const templateIds: TemplateIdsMap = {
@@ -85,6 +87,9 @@ const templateIds: TemplateIdsMap = {
85
87
  "oneuptime_oncall_user_removed_from_policy_notification",
86
88
  OnCallUserNoLongerActiveNotification:
87
89
  "oneuptime_oncall_user_no_longer_active_notification",
90
+ AIAgentStatusChangedOwnerNotification:
91
+ "oneuptime_ai_agent_status_changed_owner_notification",
92
+ AIAgentOwnerAddedNotification: "oneuptime_ai_agent_owner_added_notification",
88
93
  } as const;
89
94
 
90
95
  export const WhatsAppTemplateIds: TemplateIdsMap = templateIds;
@@ -132,6 +137,8 @@ export const WhatsAppTemplateMessages: WhatsAppTemplateMessagesDefinition = {
132
137
  [WhatsAppTemplateIds.OnCallUserAddedToPolicyNotification]: `You have been added to on-call policy {{on_call_policy_name}} for {{on_call_context}}. Review the on-call policy using {{policy_link}} on the OneUptime dashboard for full guidelines.`,
133
138
  [WhatsAppTemplateIds.OnCallUserRemovedFromPolicyNotification]: `You have been removed from on-call policy {{on_call_policy_name}} for {{on_call_context}}. View on-call policies using {{policy_link}} on the OneUptime dashboard for updates.`,
134
139
  [WhatsAppTemplateIds.OnCallUserNoLongerActiveNotification]: `You are no longer on-call for policy {{on_call_policy_name}} on schedule {{schedule_name}}. Review your schedule using {{schedule_link}} on the OneUptime dashboard to stay informed.`,
140
+ [WhatsAppTemplateIds.AIAgentStatusChangedOwnerNotification]: `AI Agent {{ai_agent_name}} status is {{ai_agent_status}}. Review the AI agent using {{ai_agent_link}} on the OneUptime dashboard for specifics.`,
141
+ [WhatsAppTemplateIds.AIAgentOwnerAddedNotification]: `You have been added as an owner of AI Agent {{ai_agent_name}}. Manage the AI agent using {{ai_agent_link}} on the OneUptime dashboard to take action.`,
135
142
  };
136
143
 
137
144
  export const WhatsAppTemplateLanguage: Record<WhatsAppTemplateId, string> = {
@@ -166,6 +173,8 @@ export const WhatsAppTemplateLanguage: Record<WhatsAppTemplateId, string> = {
166
173
  [WhatsAppTemplateIds.OnCallUserAddedToPolicyNotification]: "en",
167
174
  [WhatsAppTemplateIds.OnCallUserRemovedFromPolicyNotification]: "en",
168
175
  [WhatsAppTemplateIds.OnCallUserNoLongerActiveNotification]: "en",
176
+ [WhatsAppTemplateIds.AIAgentStatusChangedOwnerNotification]: "en",
177
+ [WhatsAppTemplateIds.AIAgentOwnerAddedNotification]: "en",
169
178
  };
170
179
 
171
180
  // Authentication templates that require OTP button components
@@ -4,6 +4,7 @@ enum ComponentID {
4
4
  SlackSendMessageToChannel = "slack-send-message-to-channel",
5
5
  MicrosoftTeamsSendMessageToChannel = "microsoft-teams-send-message-to-channel",
6
6
  DiscordSendMessageToChannel = "discord-send-message-to-channel",
7
+ TelegramSendMessageToChat = "telegram-send-message-to-chat",
7
8
  Schedule = "schedule",
8
9
  JavaScriptCode = "javascript",
9
10
  Manual = "manual",
@@ -0,0 +1,76 @@
1
+ import IconProp from "../../Icon/IconProp";
2
+ import ComponentID from "../ComponentID";
3
+ import ComponentMetadata, {
4
+ ComponentInputType,
5
+ ComponentType,
6
+ } from "./../Component";
7
+
8
+ const components: Array<ComponentMetadata> = [
9
+ {
10
+ id: ComponentID.TelegramSendMessageToChat,
11
+ title: "Send Message to Telegram",
12
+ category: "Telegram",
13
+ description: "Send message to Telegram chat",
14
+ iconProp: IconProp.SendMessage,
15
+ componentType: ComponentType.Component,
16
+ arguments: [
17
+ {
18
+ id: "bot-token",
19
+ name: "Telegram Bot Token",
20
+ description:
21
+ "Need help creating a bot? Check docs here: https://core.telegram.org/bots#how-do-i-create-a-bot",
22
+ type: ComponentInputType.Text,
23
+ required: true,
24
+ placeholder: "1234567890:ABCdefGHIjklMNOpqrsTUVwxyZ",
25
+ },
26
+ {
27
+ id: "chat-id",
28
+ name: "Chat ID",
29
+ description:
30
+ "The unique identifier for the target chat or username of the target channel (in the format @channelusername). Please make sure the bot is added to the channel as an administrator.",
31
+ type: ComponentInputType.Text,
32
+ required: true,
33
+ placeholder: "@channelname",
34
+ },
35
+ {
36
+ id: "text",
37
+ name: "Message Text",
38
+ description: "Message to send to Telegram.",
39
+ type: ComponentInputType.LongText,
40
+ required: true,
41
+ placeholder: "Test Telegram message from OneUptime",
42
+ },
43
+ ],
44
+ returnValues: [
45
+ {
46
+ id: "error",
47
+ name: "Error",
48
+ description: "Error, if there is any.",
49
+ type: ComponentInputType.Text,
50
+ required: false,
51
+ },
52
+ ],
53
+ inPorts: [
54
+ {
55
+ title: "In",
56
+ description:
57
+ "Please connect components to this port for this component to work.",
58
+ id: "in",
59
+ },
60
+ ],
61
+ outPorts: [
62
+ {
63
+ title: "Success",
64
+ description: "This is executed when the message is successfully posted",
65
+ id: "success",
66
+ },
67
+ {
68
+ title: "Error",
69
+ description: "This is executed when there is an error",
70
+ id: "error",
71
+ },
72
+ ],
73
+ },
74
+ ];
75
+
76
+ export default components;
@@ -11,6 +11,7 @@ import ManualComponents from "./Components/Manual";
11
11
  import MicrosoftTeamsComponents from "./Components/MicrosoftTeams";
12
12
  import ScheduleComponents from "./Components/Schedule";
13
13
  import SlackComponents from "./Components/Slack";
14
+ import TelegramComponents from "./Components/Telegram";
14
15
  import WebhookComponents from "./Components/Webhook";
15
16
  import WorkflowComponents from "./Components/Workflow";
16
17
 
@@ -20,6 +21,7 @@ const components: Array<ComponentMetadata> = [
20
21
  ...ScheduleComponents,
21
22
  ...SlackComponents,
22
23
  ...DiscordComponents,
24
+ ...TelegramComponents,
23
25
  ...ConditionComponents,
24
26
  ...JsonComponents,
25
27
  ...JavaScriptComponents,
@@ -58,6 +60,11 @@ export const Categories: Array<ComponentCategory> = [
58
60
  description: "Integrate OneUptime with your Microsoft Teams.",
59
61
  icon: IconProp.SendMessage,
60
62
  },
63
+ {
64
+ name: "Telegram",
65
+ description: "Integrate OneUptime with your Telegram chats and channels.",
66
+ icon: IconProp.SendMessage,
67
+ },
61
68
  {
62
69
  name: "Conditions",
63
70
  description: "Add logic to your workflows.",
@@ -0,0 +1,69 @@
1
+ import { FILE_URL } from "../../Config";
2
+ import Icon from "../Icon/Icon";
3
+ import Image from "../Image/Image";
4
+ import BaseModel from "../../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
5
+ import URL from "../../../Types/API/URL";
6
+ import IconProp from "../../../Types/Icon/IconProp";
7
+ import { JSONObject } from "../../../Types/JSON";
8
+ import AIAgent from "../../../Models/DatabaseModels/AIAgent";
9
+ import React, { FunctionComponent, ReactElement } from "react";
10
+
11
+ export interface ComponentProps {
12
+ aiAgent?: AIAgent | JSONObject | undefined | null;
13
+ suffix?: string | undefined;
14
+ }
15
+
16
+ const AIAgentElement: FunctionComponent<ComponentProps> = (
17
+ props: ComponentProps,
18
+ ): ReactElement => {
19
+ let aiAgent: JSONObject | null | undefined = null;
20
+
21
+ if (props.aiAgent instanceof AIAgent) {
22
+ aiAgent = BaseModel.toJSONObject(props.aiAgent, AIAgent);
23
+ } else {
24
+ aiAgent = props.aiAgent;
25
+ }
26
+
27
+ if (!aiAgent) {
28
+ return (
29
+ <div className="flex">
30
+ <div className="bold" data-testid="ai-agent-not-found">
31
+ No AI agent found.
32
+ </div>
33
+ </div>
34
+ );
35
+ }
36
+
37
+ return (
38
+ <div className="flex">
39
+ <div>
40
+ {props.aiAgent?.iconFileId && (
41
+ <Image
42
+ className="h-6 w-6 rounded-full"
43
+ data-testid="ai-agent-image"
44
+ imageUrl={URL.fromString(FILE_URL.toString()).addRoute(
45
+ "/image/" + props.aiAgent?.iconFileId.toString(),
46
+ )}
47
+ alt={aiAgent["name"]?.toString() || "AI Agent"}
48
+ />
49
+ )}
50
+ {!props.aiAgent?.iconFileId && (
51
+ <Icon
52
+ data-testid="ai-agent-icon"
53
+ icon={IconProp.Automation}
54
+ className="text-gray-400 group-hover:text-gray-500 flex-shrink-0 -ml-0.5 mt-0.5 h-6 w-6"
55
+ />
56
+ )}
57
+ </div>
58
+ <div className="mt-1 mr-1 ml-3">
59
+ <div>
60
+ <span data-testid="ai-agent-name">{`${
61
+ (aiAgent["name"]?.toString() as string) || ""
62
+ } ${props.suffix || ""}`}</span>{" "}
63
+ </div>
64
+ </div>
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default AIAgentElement;
@@ -15,19 +15,23 @@ export interface ComponentProps {
15
15
  const Badge: FunctionComponent<ComponentProps> = (
16
16
  props: ComponentProps,
17
17
  ): ReactElement => {
18
+ // Base styling for all badges
18
19
  let className: string =
19
- "bg-white text-gray-600 ring-1 ring-inset ring-gray-300";
20
+ "bg-gradient-to-r from-gray-50 to-gray-100 text-gray-600 ring-1 ring-inset ring-gray-200 shadow-sm";
20
21
 
21
22
  if (props.badgeType === BadgeType.DANGER) {
22
- className = "bg-white text-red-600 ring-1 ring-inset ring-red-300";
23
+ className =
24
+ "bg-gradient-to-r from-red-50 to-red-100 text-red-700 ring-1 ring-inset ring-red-200/80 shadow-sm shadow-red-100";
23
25
  }
24
26
 
25
27
  if (props.badgeType === BadgeType.WARNING) {
26
- className = "bg-white text-yellow-600 ring-1 ring-inset ring-yellow-300";
28
+ className =
29
+ "bg-gradient-to-r from-amber-50 to-amber-100 text-amber-700 ring-1 ring-inset ring-amber-200/80 shadow-sm shadow-amber-100";
27
30
  }
28
31
 
29
32
  if (props.badgeType === BadgeType.SUCCESS) {
30
- className = "bg-white text-emerald-600 ring-1 ring-inset ring-emerald-300";
33
+ className =
34
+ "bg-gradient-to-r from-emerald-50 to-emerald-100 text-emerald-700 ring-1 ring-inset ring-emerald-200/80 shadow-sm shadow-emerald-100";
31
35
  }
32
36
 
33
37
  if (props.badgeCount) {
@@ -35,7 +39,7 @@ const Badge: FunctionComponent<ComponentProps> = (
35
39
  <span
36
40
  id={props.id}
37
41
  data-testid={props.id}
38
- className={`${className} ml-auto w-11 min-w-max whitespace-nowrap rounded-full px-2.5 py-0.5 text-center text-sm font-medium leading-5 `}
42
+ className={`${className} ml-auto min-w-[1.75rem] whitespace-nowrap rounded-full px-2 py-0.5 text-center text-xs font-semibold leading-4 tabular-nums transition-all duration-200`}
39
43
  aria-hidden="true"
40
44
  >
41
45
  {props.badgeCount}
@@ -34,7 +34,7 @@ const Banner: FunctionComponent<ComponentProps> = (
34
34
 
35
35
  return (
36
36
  <div
37
- className={`flex border-gray-200 rounded-xl border-2 py-2.5 px-6 sm:px-3.5${props.hideOnMobile ? " hidden md:flex" : ""}`}
37
+ className={`flex border-gray-200 rounded-xl border-2 py-2.5 px-6 sm:px-3.5 mb-5${props.hideOnMobile ? " hidden md:flex" : ""}`}
38
38
  >
39
39
  <p className="text-sm text-gray-400 hover:text-gray-500">
40
40
  {props.link && (
@@ -32,16 +32,18 @@ const Card: FunctionComponent<ComponentProps> = (
32
32
 
33
33
  return (
34
34
  <React.Fragment>
35
- <div data-testid="card" className={`mb-4 ${props.className || ""}`}>
36
- <div className="shadow md:rounded-md">
37
- <div className="bg-white py-6 px-4 md:p-6">
38
- <div className="flex flex-col md:flex-row md:justify-between">
39
- <div className={`${noRightElementsOrButtons ? "w-full" : ""}`}>
35
+ <div data-testid="card" className={`mb-5 ${props.className || ""}`}>
36
+ <div className="bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden">
37
+ <div className="py-6 px-5 md:px-6">
38
+ <div className="flex flex-col md:flex-row md:justify-between md:items-start">
39
+ <div
40
+ className={`${noRightElementsOrButtons ? "w-full" : "flex-1 min-w-0"}`}
41
+ >
40
42
  {props.title && (
41
43
  <h2
42
44
  data-testid="card-details-heading"
43
45
  id="card-details-heading"
44
- className="text-lg font-medium leading-6 text-gray-900"
46
+ className="text-lg font-semibold leading-6 text-gray-900"
45
47
  >
46
48
  {props.title}
47
49
  </h2>
@@ -49,7 +51,7 @@ const Card: FunctionComponent<ComponentProps> = (
49
51
  {props.description && (
50
52
  <p
51
53
  data-testid="card-description"
52
- className="mt-1 text-sm text-gray-500 w-full hidden md:block"
54
+ className="mt-1.5 text-sm text-gray-500 w-full hidden md:block leading-relaxed"
53
55
  >
54
56
  {props.description}
55
57
  </p>
@@ -57,21 +59,21 @@ const Card: FunctionComponent<ComponentProps> = (
57
59
  </div>
58
60
  {(props.rightElement ||
59
61
  (props.buttons && props.buttons.length > 0)) && (
60
- <div className="flex flex-col md:flex-row md:w-fit mt-4 md:mt-0 gap-2 md:gap-0">
62
+ <div className="flex flex-col md:flex-row md:items-center md:w-fit mt-4 md:mt-0 md:ml-4 gap-2 md:gap-0 flex-shrink-0">
61
63
  {props.rightElement && (
62
- <div className="mb-2 md:mb-0 md:mr-2">
64
+ <div className="mb-2 md:mb-0 md:mr-3">
63
65
  {props.rightElement}
64
66
  </div>
65
67
  )}
66
68
  {props.buttons && props.buttons.length > 0 && (
67
- <div className="flex flex-wrap gap-2 md:gap-0">
69
+ <div className="flex flex-wrap items-center gap-2">
68
70
  {props.buttons.map(
69
71
  (
70
72
  button: CardButtonSchema | ReactElement,
71
73
  i: number,
72
74
  ) => {
73
75
  return (
74
- <div className="md:ml-2 first:md:ml-0" key={i}>
76
+ <div key={i}>
75
77
  {React.isValidElement(button) ? button : null}
76
78
  {React.isValidElement(button) ? null : (
77
79
  <Button
@@ -112,7 +114,7 @@ const Card: FunctionComponent<ComponentProps> = (
112
114
  </div>
113
115
 
114
116
  {props.children && (
115
- <div className={props.bodyClassName || "mt-6"}>
117
+ <div className={props.bodyClassName || "mt-4"}>
116
118
  {props.children}
117
119
  </div>
118
120
  )}
@@ -1,19 +1,62 @@
1
1
  import "highlight.js/styles/a11y-dark.css";
2
- import React, { FunctionComponent, ReactElement } from "react";
2
+ import React, { FunctionComponent, ReactElement, useState } from "react";
3
3
  import Highlight from "react-highlight";
4
+ import Icon from "../Icon/Icon";
5
+ import IconProp from "../../../Types/Icon/IconProp";
4
6
 
5
7
  export interface ComponentProps {
6
8
  code: string | ReactElement;
7
9
  language: string;
10
+ maxHeight?: string | undefined;
11
+ showCopyButton?: boolean | undefined;
8
12
  }
9
13
 
10
14
  const CodeBlock: FunctionComponent<ComponentProps> = (
11
15
  props: ComponentProps,
12
16
  ): ReactElement => {
17
+ const [copied, setCopied] = useState<boolean>(false);
18
+
19
+ const handleCopy: () => void = (): void => {
20
+ if (typeof props.code === "string") {
21
+ navigator.clipboard.writeText(props.code).catch(() => {
22
+ /* ignore clipboard errors */
23
+ });
24
+ setCopied(true);
25
+ setTimeout(() => {
26
+ setCopied(false);
27
+ }, 2000);
28
+ }
29
+ };
30
+
31
+ const maxHeight: string = props.maxHeight || "500px";
32
+ const showCopyButton: boolean = props.showCopyButton !== false;
33
+
13
34
  return (
14
- <Highlight className={`p-3 language-${props.language} rounded-md shadow`}>
15
- {props.code}
16
- </Highlight>
35
+ <div className="relative group">
36
+ {showCopyButton && typeof props.code === "string" && (
37
+ <button
38
+ onClick={handleCopy}
39
+ className="absolute top-2 right-2 p-2 rounded-md bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white transition-all opacity-0 group-hover:opacity-100 z-10"
40
+ title={copied ? "Copied!" : "Copy to clipboard"}
41
+ type="button"
42
+ >
43
+ <Icon
44
+ icon={copied ? IconProp.Check : IconProp.Copy}
45
+ className="h-4 w-4"
46
+ />
47
+ </button>
48
+ )}
49
+ <div
50
+ className="overflow-auto rounded-lg border border-gray-700"
51
+ style={{ maxHeight: maxHeight }}
52
+ >
53
+ <Highlight
54
+ className={`p-4 language-${props.language} text-sm leading-relaxed`}
55
+ >
56
+ {props.code}
57
+ </Highlight>
58
+ </div>
59
+ </div>
17
60
  );
18
61
  };
19
62