@oneuptime/common 13.0.8 → 14.0.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 (333) hide show
  1. package/Models/AnalyticsModels/AuditLog.ts +23 -15
  2. package/Models/DatabaseModels/GlobalConfig.ts +24 -0
  3. package/Models/DatabaseModels/Monitor.ts +3 -2
  4. package/Models/DatabaseModels/MonitorTemplate.ts +2 -1
  5. package/Scripts/generate-service-worker.js +65 -4
  6. package/Server/API/BaseAPI.ts +26 -5
  7. package/Server/API/GlobalConfigAPI.ts +228 -462
  8. package/Server/API/ProjectOIDC.ts +25 -16
  9. package/Server/API/ProjectSSO.ts +24 -16
  10. package/Server/API/StatusPageAPI.ts +100 -42
  11. package/Server/API/TeamMemberAPI.ts +10 -1
  12. package/Server/Enterprise/EnterpriseEdition.ts +649 -0
  13. package/Server/Enterprise/EnterpriseFeature.ts +48 -0
  14. package/Server/Enterprise/EnterpriseLicenseSnapshot.ts +192 -0
  15. package/Server/Enterprise/EnterpriseServerModule.ts +233 -0
  16. package/Server/EnvironmentConfig.ts +147 -2
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.ts +25 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  19. package/Server/Middleware/UserAuthorization.ts +38 -16
  20. package/Server/Services/AuditLogService.ts +84 -1079
  21. package/Server/Services/EnterpriseLicenseService.ts +38 -0
  22. package/Server/Services/GlobalConfigService.ts +80 -1
  23. package/Server/Services/MonitorProbeService.ts +116 -20
  24. package/Server/Services/MonitorService.ts +56 -4
  25. package/Server/Services/MonitorStatusTimelineService.ts +284 -0
  26. package/Server/Services/MonitorTemplateService.ts +26 -0
  27. package/Server/Services/ProjectService.ts +284 -0
  28. package/Server/Services/RumSessionPinService.ts +25 -6
  29. package/Server/Services/StatusPagePrivateUserService.ts +7 -3
  30. package/Server/Services/StatusPageService.ts +78 -1
  31. package/Server/Services/TeamMemberService.ts +11 -0
  32. package/Server/Services/TeamService.ts +10 -0
  33. package/Server/Services/UserService.ts +10 -17
  34. package/Server/Types/Database/Permissions/CreatePermission.ts +15 -0
  35. package/Server/Types/Database/Permissions/EditionPermission.ts +208 -18
  36. package/Server/Types/Database/Permissions/TablePermission.ts +10 -3
  37. package/Server/Types/Database/Permissions/UpdatePermission.ts +29 -0
  38. package/Server/Types/Markdown.ts +41 -0
  39. package/Server/Utils/CommunityEditionSsoReport.ts +361 -0
  40. package/Server/Utils/EditionEnforcement.ts +233 -0
  41. package/Server/Utils/FrontendEnvironment.ts +41 -2
  42. package/Server/Utils/InstanceHealth/RedisHealth.ts +12 -277
  43. package/Server/Utils/Monitor/AffectedResourceList.ts +190 -0
  44. package/Server/Utils/Monitor/Criteria/EvaluateOverTime.ts +10 -1
  45. package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +543 -333
  46. package/Server/Utils/Monitor/MonitoringIntervalValidator.ts +116 -0
  47. package/Server/Utils/Workspace/Slack/Slack.ts +423 -10
  48. package/Tests/App/Accounts/LoginPasskey.test.tsx +18 -0
  49. package/Tests/App/Accounts/LoginSsoEdition.test.tsx +616 -0
  50. package/Tests/App/AdminDashboard/AdminAuthenticationSsoEdition.test.tsx +217 -0
  51. package/Tests/App/AdminDashboard/AdminEnterprisePluginPage.test.tsx +357 -0
  52. package/Tests/App/AdminDashboard/EnterpriseLicensesShell.test.tsx +214 -0
  53. package/Tests/App/AdminDashboard/GlobalSSOEnterpriseShells.test.tsx +271 -0
  54. package/Tests/App/AdminDashboard/HealthShells.test.tsx +659 -0
  55. package/Tests/App/Dashboard/AuditLogsAndComplianceShells.test.tsx +572 -0
  56. package/Tests/App/Dashboard/EnterpriseFeatureUpgrade.test.tsx +547 -0
  57. package/Tests/App/Dashboard/EnterprisePluginPage.test.tsx +667 -0
  58. package/Tests/App/Dashboard/IdentityEnterpriseShells.test.tsx +319 -0
  59. package/Tests/App/Dashboard/OnboardingSsoEmptyState.test.tsx +185 -0
  60. package/Tests/App/Dashboard/SecurityEventConnectionDiagnostics.test.tsx +45 -9
  61. package/Tests/App/Dashboard/SecurityEventDetailPanel.test.tsx +399 -0
  62. package/Tests/App/Dashboard/SecurityEventListRow.test.tsx +214 -0
  63. package/Tests/App/Dashboard/SecurityEventsEmptyState.test.tsx +1 -83
  64. package/Tests/App/Dashboard/SecurityEventsNavTabs.test.tsx +248 -0
  65. package/Tests/App/Dashboard/SecurityEventsViewer.test.tsx +1203 -0
  66. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +11 -91
  67. package/Tests/App/StatusPage/StatusPageSsoEmptyState.test.tsx +319 -0
  68. package/Tests/Helpers/RefreshAwareApiScan.ts +757 -0
  69. package/Tests/Helpers/TenantScopedRequestScan.ts +515 -0
  70. package/Tests/Scripts/GenerateServiceWorker.test.ts +931 -0
  71. package/Tests/Server/API/BaseAPICreateItemDoesNotMutateModel.test.ts +130 -0
  72. package/Tests/Server/API/GlobalConfigLicense.test.ts +742 -497
  73. package/Tests/Server/API/OnCallReadinessAPI.test.ts +35 -909
  74. package/Tests/Server/API/SsoProviderListingsEdition.test.ts +432 -0
  75. package/Tests/Server/API/TeamMemberLeaveScimLockEdition.test.ts +252 -0
  76. package/Tests/Server/Enterprise/EnterpriseEdition.test.ts +824 -0
  77. package/Tests/Server/Enterprise/EnterpriseFeatureActive.test.ts +643 -0
  78. package/Tests/Server/Enterprise/EnterpriseLicenseSnapshot.test.ts +294 -0
  79. package/Tests/Server/Enterprise/EnterpriseModelFeatureMap.test.ts +93 -0
  80. package/Tests/Server/Enterprise/EnterpriseOnlyModulesLiveInEe.test.ts +582 -0
  81. package/Tests/Server/Enterprise/EnterpriseServerModule.test.ts +247 -0
  82. package/Tests/Server/Enterprise/FakeEnterpriseModule.ts +502 -0
  83. package/Tests/Server/Enterprise/TestBillingFlag.ts +70 -0
  84. package/Tests/Server/EnvironmentConfigEnterpriseEdition.test.ts +314 -0
  85. package/Tests/Server/Infrastructure/ContainerBootConfiguration.test.ts +289 -0
  86. package/Tests/Server/Infrastructure/E2EClickHouseFixtureAccess.test.ts +5 -1
  87. package/Tests/Server/Middleware/UserAuthorization.test.ts +37 -2
  88. package/Tests/Server/Middleware/UserAuthorizationEditionEnforcement.test.ts +516 -0
  89. package/Tests/Server/Services/AuditLogService.test.ts +460 -990
  90. package/Tests/Server/Services/CreateAndReadResponsesKeepIds.test.ts +263 -0
  91. package/Tests/Server/Services/EnterpriseLicenseServiceKeyGeneration.test.ts +151 -0
  92. package/Tests/Server/Services/GlobalConfigServiceLicenseColumns.test.ts +357 -0
  93. package/Tests/Server/Services/MonitorDestinationInfoIPv6.test.ts +101 -0
  94. package/Tests/Server/Services/MonitorProbeServiceIntervalScheduling.test.ts +333 -0
  95. package/Tests/Server/Services/MonitorStatusTimelineDailyAggregates.test.ts +303 -0
  96. package/Tests/Server/Services/ProjectServiceAuditLogLicense.test.ts +701 -0
  97. package/Tests/Server/Services/ProjectServiceAuditLogSettingsCache.test.ts +31 -35
  98. package/Tests/Server/Services/ScimPushGroupsTeamLocksEdition.test.ts +431 -0
  99. package/Tests/Server/Services/SsoRequirementReadMasking.test.ts +419 -0
  100. package/Tests/Server/Services/SsoRequirementWriteGuard.test.ts +769 -0
  101. package/Tests/Server/Services/StatusPagePrivateUserInvitationPolicy.test.ts +94 -0
  102. package/Tests/Server/Services/UserAuthenticationService.test.ts +35 -0
  103. package/Tests/Server/Services/UserServiceSeatLimit.test.ts +94 -56
  104. package/Tests/Server/Types/Database/Permissions/EditionPermission.test.ts +1823 -0
  105. package/Tests/Server/Types/Markdown.test.ts +181 -0
  106. package/Tests/Server/Utils/CommunityEditionSsoReport.test.ts +565 -0
  107. package/Tests/Server/Utils/EditionEnforcement.test.ts +303 -0
  108. package/Tests/Server/Utils/FrontendEnvironment.test.ts +367 -0
  109. package/Tests/Server/Utils/InstanceHealth/RedisHealth.test.ts +38 -418
  110. package/Tests/Server/Utils/Monitor/AffectedResourceList.test.ts +518 -0
  111. package/Tests/Server/Utils/Monitor/Criteria/EvaluateOverTime.test.ts +24 -4
  112. package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +934 -96
  113. package/Tests/Server/Utils/Monitor/MonitoringIntervalValidator.test.ts +188 -0
  114. package/Tests/Server/Utils/Workspace/Slack/SlackMarkdownSectionSplit.test.ts +1209 -0
  115. package/Tests/Types/API/HostnameFromAuthority.test.ts +20 -10
  116. package/Tests/Types/API/HostnameIPv6.test.ts +149 -0
  117. package/Tests/Types/Database/CanonicalModelInstance.test.ts +190 -0
  118. package/Tests/UI/Components/EditionLabelLapseCopy.ts +104 -0
  119. package/Tests/UI/Components/EditionLabelLicenseManagerWiring.test.tsx +254 -0
  120. package/Tests/UI/Components/EditionLabelLicenseRefresh.test.tsx +84 -178
  121. package/Tests/UI/Components/EditionLabelLicenseStatus.test.tsx +1586 -0
  122. package/Tests/UI/Components/EditionLabelLicenseWritesGuard.test.tsx +157 -0
  123. package/Tests/UI/Components/Graphs/DayUptimeGraph.test.tsx +49 -2
  124. package/Tests/UI/Components/MarkdownConverters.test.ts +684 -0
  125. package/Tests/UI/Components/ModelListEmptyState.test.tsx +289 -0
  126. package/Tests/UI/Components/TelemetryViewer/TelemetryViewerEmptyContent.test.tsx +131 -0
  127. package/Tests/UI/EsbuildEnterpriseAlias.test.ts +1127 -0
  128. package/Tests/Utils/HostAddressUtil.test.ts +138 -0
  129. package/Tests/Utils/Monitor/MonitorDestinationUtil.test.ts +313 -0
  130. package/Tests/Utils/Monitor/MonitoringIntervalUtil.test.ts +304 -0
  131. package/Tests/Utils/StatusPage/UptimeDailyAggregateUtil.test.ts +248 -0
  132. package/Types/API/Hostname.ts +63 -16
  133. package/Types/Database/AccessControl/ColumnAccessControl.ts +19 -7
  134. package/Types/Database/AccessControl/ColumnBillingAccessControl.ts +19 -7
  135. package/Types/Database/AccessControl/OwnerOnlyColumn.ts +15 -6
  136. package/Types/Database/CanonicalModelInstance.ts +102 -0
  137. package/Types/Database/TableColumn.ts +20 -6
  138. package/Types/EnterpriseLicense/EnterpriseLicensePeriods.ts +29 -0
  139. package/Types/IP/IPv6.ts +6 -1
  140. package/Types/Monitor/MonitorStep.ts +6 -1
  141. package/Types/Monitor/ProxmoxAlertTemplates.ts +1 -1
  142. package/Types/StatusPage/UptimeDailyAggregate.ts +110 -0
  143. package/UI/Components/EditionLabel/EditionLabel.tsx +796 -1195
  144. package/UI/Components/EditionLabel/LicenseManager.ts +119 -0
  145. package/UI/Components/Graphs/DayUptimeGraph.tsx +123 -15
  146. package/UI/Components/Markdown.tsx/MarkdownConverters.ts +0 -0
  147. package/UI/Components/ModelList/ModelList.tsx +11 -1
  148. package/UI/Components/MonitorGraphs/Uptime.tsx +69 -0
  149. package/UI/Components/TelemetryViewer/TelemetryViewer.tsx +28 -12
  150. package/UI/esbuild-enterprise.js +263 -0
  151. package/Utils/EnterpriseLicense/EnterpriseLicenseUsage.ts +7 -2
  152. package/Utils/HostAddressUtil.ts +94 -0
  153. package/Utils/Monitor/MonitorDestinationUtil.ts +157 -0
  154. package/Utils/Monitor/MonitoringIntervalUtil.ts +436 -0
  155. package/Utils/StatusPage/UptimeDailyAggregateUtil.ts +192 -0
  156. package/build/dist/Models/AnalyticsModels/AuditLog.js +23 -15
  157. package/build/dist/Models/AnalyticsModels/AuditLog.js.map +1 -1
  158. package/build/dist/Models/DatabaseModels/GlobalConfig.js +25 -0
  159. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  160. package/build/dist/Models/DatabaseModels/Monitor.js +2 -2
  161. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  162. package/build/dist/Models/DatabaseModels/MonitorTemplate.js +2 -1
  163. package/build/dist/Models/DatabaseModels/MonitorTemplate.js.map +1 -1
  164. package/build/dist/Server/API/BaseAPI.js +26 -5
  165. package/build/dist/Server/API/BaseAPI.js.map +1 -1
  166. package/build/dist/Server/API/GlobalConfigAPI.js +148 -344
  167. package/build/dist/Server/API/GlobalConfigAPI.js.map +1 -1
  168. package/build/dist/Server/API/ProjectOIDC.js +24 -16
  169. package/build/dist/Server/API/ProjectOIDC.js.map +1 -1
  170. package/build/dist/Server/API/ProjectSSO.js +24 -16
  171. package/build/dist/Server/API/ProjectSSO.js.map +1 -1
  172. package/build/dist/Server/API/StatusPageAPI.js +93 -43
  173. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  174. package/build/dist/Server/API/TeamMemberAPI.js +8 -1
  175. package/build/dist/Server/API/TeamMemberAPI.js.map +1 -1
  176. package/build/dist/Server/Enterprise/EnterpriseEdition.js +466 -0
  177. package/build/dist/Server/Enterprise/EnterpriseEdition.js.map +1 -0
  178. package/build/dist/Server/Enterprise/EnterpriseFeature.js +39 -0
  179. package/build/dist/Server/Enterprise/EnterpriseFeature.js.map +1 -0
  180. package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js +70 -0
  181. package/build/dist/Server/Enterprise/EnterpriseLicenseSnapshot.js.map +1 -0
  182. package/build/dist/Server/Enterprise/EnterpriseServerModule.js +84 -0
  183. package/build/dist/Server/Enterprise/EnterpriseServerModule.js.map +1 -0
  184. package/build/dist/Server/EnvironmentConfig.js +84 -2
  185. package/build/dist/Server/EnvironmentConfig.js.map +1 -1
  186. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.js +18 -0
  187. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1793900000000-AddEnterpriseEditionFirstSeenAt.js.map +1 -0
  188. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  189. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  190. package/build/dist/Server/Middleware/UserAuthorization.js +30 -11
  191. package/build/dist/Server/Middleware/UserAuthorization.js.map +1 -1
  192. package/build/dist/Server/Services/AuditLogService.js +71 -740
  193. package/build/dist/Server/Services/AuditLogService.js.map +1 -1
  194. package/build/dist/Server/Services/EnterpriseLicenseService.js +34 -0
  195. package/build/dist/Server/Services/EnterpriseLicenseService.js.map +1 -1
  196. package/build/dist/Server/Services/GlobalConfigService.js +63 -0
  197. package/build/dist/Server/Services/GlobalConfigService.js.map +1 -1
  198. package/build/dist/Server/Services/MonitorProbeService.js +90 -17
  199. package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
  200. package/build/dist/Server/Services/MonitorService.js +45 -4
  201. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  202. package/build/dist/Server/Services/MonitorStatusTimelineService.js +242 -0
  203. package/build/dist/Server/Services/MonitorStatusTimelineService.js.map +1 -1
  204. package/build/dist/Server/Services/MonitorTemplateService.js +16 -0
  205. package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
  206. package/build/dist/Server/Services/ProjectService.js +214 -0
  207. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  208. package/build/dist/Server/Services/RumSessionPinService.js +24 -6
  209. package/build/dist/Server/Services/RumSessionPinService.js.map +1 -1
  210. package/build/dist/Server/Services/StatusPagePrivateUserService.js +7 -3
  211. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  212. package/build/dist/Server/Services/StatusPageService.js +71 -0
  213. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  214. package/build/dist/Server/Services/TeamMemberService.js +10 -0
  215. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  216. package/build/dist/Server/Services/TeamService.js +9 -0
  217. package/build/dist/Server/Services/TeamService.js.map +1 -1
  218. package/build/dist/Server/Services/UserService.js +10 -16
  219. package/build/dist/Server/Services/UserService.js.map +1 -1
  220. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js +10 -0
  221. package/build/dist/Server/Types/Database/Permissions/CreatePermission.js.map +1 -1
  222. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js +154 -14
  223. package/build/dist/Server/Types/Database/Permissions/EditionPermission.js.map +1 -1
  224. package/build/dist/Server/Types/Database/Permissions/TablePermission.js +10 -3
  225. package/build/dist/Server/Types/Database/Permissions/TablePermission.js.map +1 -1
  226. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js +17 -0
  227. package/build/dist/Server/Types/Database/Permissions/UpdatePermission.js.map +1 -1
  228. package/build/dist/Server/Types/Markdown.js +31 -0
  229. package/build/dist/Server/Types/Markdown.js.map +1 -1
  230. package/build/dist/Server/Utils/CommunityEditionSsoReport.js +223 -0
  231. package/build/dist/Server/Utils/CommunityEditionSsoReport.js.map +1 -0
  232. package/build/dist/Server/Utils/EditionEnforcement.js +187 -0
  233. package/build/dist/Server/Utils/EditionEnforcement.js.map +1 -0
  234. package/build/dist/Server/Utils/FrontendEnvironment.js +31 -2
  235. package/build/dist/Server/Utils/FrontendEnvironment.js.map +1 -1
  236. package/build/dist/Server/Utils/InstanceHealth/RedisHealth.js +6 -193
  237. package/build/dist/Server/Utils/InstanceHealth/RedisHealth.js.map +1 -1
  238. package/build/dist/Server/Utils/Monitor/AffectedResourceList.js +96 -0
  239. package/build/dist/Server/Utils/Monitor/AffectedResourceList.js.map +1 -0
  240. package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js +8 -1
  241. package/build/dist/Server/Utils/Monitor/Criteria/EvaluateOverTime.js.map +1 -1
  242. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +449 -261
  243. package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
  244. package/build/dist/Server/Utils/Monitor/MonitoringIntervalValidator.js +88 -0
  245. package/build/dist/Server/Utils/Monitor/MonitoringIntervalValidator.js.map +1 -0
  246. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +331 -11
  247. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  248. package/build/dist/Types/API/Hostname.js +59 -11
  249. package/build/dist/Types/API/Hostname.js.map +1 -1
  250. package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js +19 -7
  251. package/build/dist/Types/Database/AccessControl/ColumnAccessControl.js.map +1 -1
  252. package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js +19 -7
  253. package/build/dist/Types/Database/AccessControl/ColumnBillingAccessControl.js.map +1 -1
  254. package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js +13 -6
  255. package/build/dist/Types/Database/AccessControl/OwnerOnlyColumn.js.map +1 -1
  256. package/build/dist/Types/Database/CanonicalModelInstance.js +88 -0
  257. package/build/dist/Types/Database/CanonicalModelInstance.js.map +1 -0
  258. package/build/dist/Types/Database/TableColumn.js +19 -6
  259. package/build/dist/Types/Database/TableColumn.js.map +1 -1
  260. package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js +28 -0
  261. package/build/dist/Types/EnterpriseLicense/EnterpriseLicensePeriods.js.map +1 -0
  262. package/build/dist/Types/IP/IPv6.js +6 -1
  263. package/build/dist/Types/IP/IPv6.js.map +1 -1
  264. package/build/dist/Types/Monitor/MonitorStep.js +5 -0
  265. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  266. package/build/dist/Types/Monitor/ProxmoxAlertTemplates.js +1 -1
  267. package/build/dist/Types/StatusPage/UptimeDailyAggregate.js +32 -0
  268. package/build/dist/Types/StatusPage/UptimeDailyAggregate.js.map +1 -0
  269. package/build/dist/UI/Components/EditionLabel/EditionLabel.js +414 -585
  270. package/build/dist/UI/Components/EditionLabel/EditionLabel.js.map +1 -1
  271. package/build/dist/UI/Components/EditionLabel/LicenseManager.js +2 -0
  272. package/build/dist/UI/Components/EditionLabel/LicenseManager.js.map +1 -0
  273. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js +90 -17
  274. package/build/dist/UI/Components/Graphs/DayUptimeGraph.js.map +1 -1
  275. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js +0 -0
  276. package/build/dist/UI/Components/Markdown.tsx/MarkdownConverters.js.map +1 -1
  277. package/build/dist/UI/Components/ModelList/ModelList.js +4 -1
  278. package/build/dist/UI/Components/ModelList/ModelList.js.map +1 -1
  279. package/build/dist/UI/Components/MonitorGraphs/Uptime.js +42 -1
  280. package/build/dist/UI/Components/MonitorGraphs/Uptime.js.map +1 -1
  281. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js +2 -2
  282. package/build/dist/UI/Components/TelemetryViewer/TelemetryViewer.js.map +1 -1
  283. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js +6 -2
  284. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseUsage.js.map +1 -1
  285. package/build/dist/Utils/HostAddressUtil.js +80 -0
  286. package/build/dist/Utils/HostAddressUtil.js.map +1 -0
  287. package/build/dist/Utils/Monitor/MonitorDestinationUtil.js +127 -0
  288. package/build/dist/Utils/Monitor/MonitorDestinationUtil.js.map +1 -0
  289. package/build/dist/Utils/Monitor/MonitoringIntervalUtil.js +374 -0
  290. package/build/dist/Utils/Monitor/MonitoringIntervalUtil.js.map +1 -0
  291. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js +148 -0
  292. package/build/dist/Utils/StatusPage/UptimeDailyAggregateUtil.js.map +1 -0
  293. package/jest.config.json +3 -1
  294. package/package.json +1 -1
  295. package/test-setup.sh +103 -34
  296. package/tsconfig.json +13 -0
  297. package/Server/API/EnterpriseLicenseAPI.ts +0 -925
  298. package/Server/API/TeamComplianceAPI.ts +0 -158
  299. package/Server/Middleware/SCIMAuthorization.ts +0 -141
  300. package/Server/Services/TeamComplianceService.ts +0 -733
  301. package/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.ts +0 -186
  302. package/Server/Utils/InstanceHealth/PostgresHealth.ts +0 -286
  303. package/Tests/App/AdminDashboard/EnterpriseLicenseInstanceActivity.test.tsx +0 -451
  304. package/Tests/App/Dashboard/AuditLogsTable.test.tsx +0 -598
  305. package/Tests/App/Dashboard/SecurityEventsExplorer.test.tsx +0 -761
  306. package/Tests/App/Dashboard/SecurityEventsSideMenu.test.tsx +0 -247
  307. package/Tests/App/Dashboard/SecurityEventsTableColumns.test.tsx +0 -382
  308. package/Tests/App/Dashboard/SecurityEventsVolumeChart.test.tsx +0 -321
  309. package/Tests/Server/API/EnterpriseLicenseReportUserCount.test.ts +0 -1851
  310. package/Tests/Server/Middleware/SCIMAuthorization.test.ts +0 -525
  311. package/Tests/Server/Services/TeamComplianceServiceBehaviour.test.ts +0 -1845
  312. package/Tests/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.test.ts +0 -495
  313. package/Tests/Server/Utils/InstanceHealth/PostgresHealth.test.ts +0 -337
  314. package/Tests/Utils/EnterpriseLicenseSeats.test.ts +0 -576
  315. package/Tests/Utils/EnterpriseLicenseSync.test.ts +0 -568
  316. package/Utils/EnterpriseLicense/EnterpriseLicenseSeats.ts +0 -287
  317. package/Utils/EnterpriseLicense/EnterpriseLicenseSync.ts +0 -244
  318. package/build/dist/Server/API/EnterpriseLicenseAPI.js +0 -646
  319. package/build/dist/Server/API/EnterpriseLicenseAPI.js.map +0 -1
  320. package/build/dist/Server/API/TeamComplianceAPI.js +0 -111
  321. package/build/dist/Server/API/TeamComplianceAPI.js.map +0 -1
  322. package/build/dist/Server/Middleware/SCIMAuthorization.js +0 -124
  323. package/build/dist/Server/Middleware/SCIMAuthorization.js.map +0 -1
  324. package/build/dist/Server/Services/TeamComplianceService.js +0 -537
  325. package/build/dist/Server/Services/TeamComplianceService.js.map +0 -1
  326. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js +0 -145
  327. package/build/dist/Server/Utils/EnterpriseLicense/EnterpriseLicenseSeatUtil.js.map +0 -1
  328. package/build/dist/Server/Utils/InstanceHealth/PostgresHealth.js +0 -194
  329. package/build/dist/Server/Utils/InstanceHealth/PostgresHealth.js.map +0 -1
  330. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js +0 -168
  331. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSeats.js.map +0 -1
  332. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSync.js +0 -174
  333. package/build/dist/Utils/EnterpriseLicense/EnterpriseLicenseSync.js.map +0 -1
@@ -1,18 +1,17 @@
1
1
  import Modal, { ModalWidth } from "../Modal/Modal";
2
2
  import Icon from "../Icon/Icon";
3
3
  import IconProp from "../../../Types/Icon/IconProp";
4
- import Input from "../Input/Input";
5
4
  import Button, { ButtonStyleType } from "../Button/Button";
6
- import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
5
+ import React, { useCallback, useEffect, useMemo, useState, } from "react";
7
6
  import GlobalConfig from "../../../Models/DatabaseModels/GlobalConfig";
8
7
  import API from "../../Utils/API/API";
9
8
  import OneUptimeDate from "../../../Types/Date";
10
9
  import HTTPMethod from "../../../Types/API/HTTPMethod";
11
10
  import Route from "../../../Types/API/Route";
12
11
  import URL from "../../../Types/API/URL";
13
- import { APP_API_URL, BILLING_ENABLED, IS_ENTERPRISE_EDITION, } from "../../Config";
14
- import Alert, { AlertType } from "../Alerts/Alert";
12
+ import { APP_API_URL, BILLING_ENABLED, IS_ENTERPRISE_EDITION, env, } from "../../Config";
15
13
  import VersionUtil from "../../../Utils/VersionUtil";
14
+ import { ENTERPRISE_LICENSE_GRACE_PERIOD_IN_DAYS, ENTERPRISE_LICENSE_TRIAL_PERIOD_IN_DAYS, } from "../../../Types/EnterpriseLicense/EnterpriseLicensePeriods";
16
15
  import UserUtil from "../../Utils/User";
17
16
  const ENTERPRISE_URL = "https://oneuptime.com/enterprise/demo";
18
17
  /*
@@ -24,68 +23,60 @@ const ENTERPRISE_URL = "https://oneuptime.com/enterprise/demo";
24
23
  * the docs move in the repository.
25
24
  */
26
25
  const UPGRADE_GUIDE_URL = "https://oneuptime.com/docs/installation/upgrading";
27
- const SALES_EMAIL = "sales@oneuptime.com";
28
26
  const SALES_MAILTO_URL = "mailto:sales@oneuptime.com";
27
+ const DAY_IN_MS = 24 * 60 * 60 * 1000;
28
+ /*
29
+ * What stops when the license lapses, in one sentence set, so every notice in
30
+ * the dialog says it the same way. It has to be said plainly and before it
31
+ * happens: after the trial or the grace period, single sign-on (SAML and
32
+ * OIDC) and SCIM provisioning stop, "Require SSO" is no longer enforced (so
33
+ * nobody is locked out: users sign in with their password), and audit logging
34
+ * stops recording - the Community Edition's behaviour - until a license is
35
+ * activated, when everything resumes without a restart. Core monitoring is
36
+ * never touched.
37
+ */
38
+ export const LICENSE_LAPSE_CONSEQUENCES = 'single sign-on (SAML and OIDC) stops and "Require SSO" is no longer enforced, so users sign in with their password; SCIM provisioning stops; audit logging stops recording; enterprise configuration becomes read-only; and the enterprise admin dashboards are locked. Everything resumes as soon as a license is activated, and core monitoring is never affected.';
39
+ /*
40
+ * The two periods have different names and different lengths: an unlicensed
41
+ * installation's first ENTERPRISE_LICENSE_TRIAL_PERIOD_IN_DAYS days are its
42
+ * trial, and only a license that expired has a grace period
43
+ * (ENTERPRISE_LICENSE_GRACE_PERIOD_IN_DAYS days after its expiry). The
44
+ * numbers come from the constants the license classifier uses.
45
+ */
46
+ export const TRIAL_ENFORCEMENT_SUMMARY = `Without a valid license (after the ${ENTERPRISE_LICENSE_TRIAL_PERIOD_IN_DAYS}-day trial), ${LICENSE_LAPSE_CONSEQUENCES}`;
47
+ export const GRACE_ENFORCEMENT_SUMMARY = `Without a valid license (after the ${ENTERPRISE_LICENSE_GRACE_PERIOD_IN_DAYS}-day grace period), ${LICENSE_LAPSE_CONSEQUENCES}`;
48
+ /*
49
+ * What has stopped once the license lapsed (expired past its grace period,
50
+ * missing after the trial, or invalid), after the reason the notice gives.
51
+ */
52
+ export const LICENSE_LAPSED_STATE = 'Single sign-on (SAML and OIDC) and SCIM provisioning are off: "Require SSO" is not enforced, so users sign in with their password, and your identity provider\'s SCIM requests are refused. Audit logging is not recording. Enterprise configuration is read-only and the enterprise admin dashboards are locked. Everything resumes, without a restart, as soon as a valid license is added, and core monitoring is never affected.';
53
+ const parseLicenseStatus = (value) => {
54
+ if (value === "valid" ||
55
+ value === "grace" ||
56
+ value === "expired" ||
57
+ value === "missing" ||
58
+ value === "invalid") {
59
+ return value;
60
+ }
61
+ return null;
62
+ };
29
63
  /*
30
64
  * Seat usage at or above this percent asks the admin to talk to OneUptime about
31
65
  * expanding. Matches CRITICAL_CAPACITY_PERCENT in
32
66
  * App/FeatureSet/Workers/Jobs/InstanceHealth/EvaluateClickhouseCapacity.ts.
33
67
  */
34
68
  const SEAT_WARNING_PERCENT = 90;
35
- const parseLicenseInstances = (value) => {
36
- if (!Array.isArray(value)) {
37
- return [];
38
- }
39
- const instances = [];
40
- for (const item of value) {
41
- if (!item || typeof item !== "object") {
42
- continue;
43
- }
44
- const instance = item;
45
- instances.push({
46
- instanceId: typeof instance["instanceId"] === "string"
47
- ? instance["instanceId"]
48
- : "",
49
- host: typeof instance["host"] === "string" && instance["host"]
50
- ? instance["host"]
51
- : null,
52
- userCount: typeof instance["userCount"] === "number"
53
- ? instance["userCount"]
54
- : null,
55
- isCountedTowardsUsage: typeof instance["isCountedTowardsUsage"] === "boolean"
56
- ? instance["isCountedTowardsUsage"]
57
- : undefined,
58
- lastReportedAt: typeof instance["lastReportedAt"] === "string"
59
- ? instance["lastReportedAt"]
60
- : null,
61
- version: typeof instance["version"] === "string" && instance["version"]
62
- ? instance["version"]
63
- : null,
64
- });
65
- }
66
- return instances;
67
- };
68
- const formatInstanceReportedAt = (lastReportedAt) => {
69
- if (!lastReportedAt) {
70
- return "No usage reported yet.";
71
- }
72
- const reportedAt = OneUptimeDate.fromString(lastReportedAt);
73
- if (Number.isNaN(reportedAt.getTime())) {
74
- return "No usage reported yet.";
75
- }
76
- return `Last reported ${reportedAt.toLocaleString()}.`;
77
- };
78
69
  const EditionLabel = (props) => {
79
70
  const [isDialogOpen, setIsDialogOpen] = useState(false);
80
71
  const [globalConfig, setGlobalConfig] = useState(null);
72
+ /*
73
+ * The last successful license GET, as the server sent it. Handed to the
74
+ * license manager, which reads its own fields (the instances, the
75
+ * activation mode) from it.
76
+ */
77
+ const [licensePayload, setLicensePayload] = useState(null);
81
78
  const [isConfigLoading, setIsConfigLoading] = useState(false);
82
79
  const [configError, setConfigError] = useState("");
83
- const [licenseKeyInput, setLicenseKeyInput] = useState("");
84
- const [validationError, setValidationError] = useState("");
85
- const [successMessage, setSuccessMessage] = useState("");
86
- const [isValidating, setIsValidating] = useState(false);
87
- const [isRefreshingLicense, setIsRefreshingLicense] = useState(false);
88
- const [isChangingLicense, setIsChangingLicense] = useState(false);
89
80
  /*
90
81
  * The seat limit as this installation actually enforces it, rather than as
91
82
  * oneuptime.com last reported it. The server computes it from the live User
@@ -98,8 +89,6 @@ const EditionLabel = (props) => {
98
89
  const [isSeatLimitEnforced, setIsSeatLimitEnforced] = useState(false);
99
90
  const [enforcedSeatsInUse, setEnforcedSeatsInUse] = useState(null);
100
91
  const [canAddMoreUsers, setCanAddMoreUsers] = useState(true);
101
- const [licenseInstances, setLicenseInstances] = useState([]);
102
- const [thisInstanceId, setThisInstanceId] = useState("");
103
92
  /*
104
93
  * Version state comes from the server rather than APP_VERSION in the
105
94
  * browser bundle: the frontend env var is empty in every build that was
@@ -124,13 +113,56 @@ const EditionLabel = (props) => {
124
113
  * cannot always derive validity from the token itself.
125
114
  */
126
115
  const [serverLicenseValid, setServerLicenseValid] = useState(null);
127
- const licenseInputEditedRef = useRef(false);
128
- if (BILLING_ENABLED) {
129
- return React.createElement(React.Fragment, null);
130
- }
131
116
  /*
132
- * Both the license GET and the two license POSTs answer with the same seat
133
- * fields, so the three responses are unpacked in one place.
117
+ * Where the license stands, as the Enterprise license client classified it:
118
+ * valid, grace (an expired license's grace period, or an unlicensed
119
+ * installation's trial counted from its first run), expired, missing or
120
+ * invalid - and whether it could be verified offline.
121
+ */
122
+ const [licenseStatus, setLicenseStatus] = useState(null);
123
+ const [licenseVerification, setLicenseVerification] = useState("");
124
+ const [graceReason, setGraceReason] = useState("");
125
+ const [graceEndsAt, setGraceEndsAt] = useState("");
126
+ // Why the license is not valid, when the server says (master admins only).
127
+ const [licenseMessage, setLicenseMessage] = useState("");
128
+ const isMasterAdmin = useMemo(() => {
129
+ return Boolean(UserUtil.isMasterAdmin());
130
+ }, []);
131
+ /*
132
+ * The Enterprise Edition's license manager, when the caller passed one (the
133
+ * Dashboard and the Admin Dashboard of the Enterprise image do). Never on
134
+ * the Community Edition, whatever the bundle holds: there is no license to
135
+ * manage there.
136
+ */
137
+ const LicenseManager = IS_ENTERPRISE_EDITION ? props.licenseManager : undefined;
138
+ /*
139
+ * Activating, replacing and refreshing the license are master-admin actions:
140
+ * the license is instance-wide, and its seat limit is what UserService
141
+ * enforces against, so being able to rewrite it is being able to raise the
142
+ * ceiling on the whole installation. The server enforces this
143
+ * (MasterAdminAuthorization on both POSTs, and it answers everybody else
144
+ * with the edition pill's fields only); hiding the controls just stops
145
+ * everyone else being offered a button that can only fail.
146
+ *
147
+ * It also takes a license manager to manage the license with. The login
148
+ * page (where a signed-out visitor sees the same pill) and a Community
149
+ * build pass none, and telling somebody to "add a license below" there
150
+ * would point at nothing.
151
+ */
152
+ const canManageLicense = isMasterAdmin && Boolean(LicenseManager);
153
+ /*
154
+ * The server says it was asked for the Enterprise Edition
155
+ * (IS_ENTERPRISE_EDITION=true) but runs the Community Edition image, which
156
+ * has no enterprise code. Only a master admin can fix that, so only a
157
+ * master admin is told.
158
+ */
159
+ const showEditionMismatchNotice = !IS_ENTERPRISE_EDITION &&
160
+ isMasterAdmin &&
161
+ env("ENTERPRISE_EDITION_REQUESTED_BUT_NOT_LOADED") === "true";
162
+ /*
163
+ * The license GET and the license manager's writes answer with the same
164
+ * seat fields, so every response is unpacked in one place (the manager
165
+ * calls this through applySeatEnforcement).
134
166
  * isSeatLimitEnforced is what tells "this installation does not enforce a
135
167
  * seat limit" apart from "this build did not report one" - without it, an
136
168
  * older server's silence would read as a limit of zero.
@@ -195,19 +227,24 @@ const EditionLabel = (props) => {
195
227
  if (typeof payload["currentUserCount"] === "number") {
196
228
  configModel.enterpriseLicenseCurrentUserCount = payload["currentUserCount"];
197
229
  }
198
- if (payload["userCountUpdatedAt"]) {
199
- configModel.enterpriseLicenseUserCountUpdatedAt =
200
- OneUptimeDate.fromString(payload["userCountUpdatedAt"]);
201
- }
202
230
  setGlobalConfig(configModel);
203
- setLicenseInstances(parseLicenseInstances(payload["instances"]));
204
- setThisInstanceId(typeof payload["instanceId"] === "string"
205
- ? payload["instanceId"]
206
- : "");
231
+ setLicensePayload(payload);
207
232
  setServerLicenseValid(typeof payload["licenseValid"] === "boolean"
208
233
  ? payload["licenseValid"]
209
234
  : null);
210
- setIsEvaluationLicense(payload["isEvaluationLicense"] === true);
235
+ setIsEvaluationLicense(payload["isEvaluation"] === true ||
236
+ payload["isEvaluationLicense"] === true);
237
+ setLicenseStatus(parseLicenseStatus(payload["status"]));
238
+ setLicenseVerification(typeof payload["verification"] === "string"
239
+ ? payload["verification"]
240
+ : "");
241
+ setGraceReason(typeof payload["graceReason"] === "string"
242
+ ? payload["graceReason"]
243
+ : "");
244
+ setGraceEndsAt(typeof payload["graceEndsAt"] === "string"
245
+ ? payload["graceEndsAt"]
246
+ : "");
247
+ setLicenseMessage(typeof payload["message"] === "string" ? payload["message"] : "");
211
248
  setCurrentVersion(typeof payload["currentVersion"] === "string"
212
249
  ? payload["currentVersion"]
213
250
  : "");
@@ -223,15 +260,17 @@ const EditionLabel = (props) => {
223
260
  setIsUpdateAvailable(payload["isUpdateAvailable"] === true);
224
261
  setIsUpdateCheckDisabled(payload["isUpdateCheckDisabled"] === true);
225
262
  applySeatEnforcementPayload(payload);
226
- if (!licenseInputEditedRef.current) {
227
- setLicenseKeyInput(configModel.enterpriseLicenseKey || "");
228
- }
229
263
  }
230
264
  catch (err) {
231
265
  setGlobalConfig(null);
232
- setLicenseInstances([]);
266
+ setLicensePayload(null);
233
267
  setServerLicenseValid(null);
234
268
  setIsEvaluationLicense(false);
269
+ setLicenseStatus(null);
270
+ setLicenseVerification("");
271
+ setGraceReason("");
272
+ setGraceEndsAt("");
273
+ setLicenseMessage("");
235
274
  setCurrentVersion("");
236
275
  setLatestVersion("");
237
276
  setLatestVersionPublishedAt("");
@@ -254,7 +293,7 @@ const EditionLabel = (props) => {
254
293
  * opened rather than adding a request to every page load.
255
294
  */
256
295
  useEffect(() => {
257
- if (!IS_ENTERPRISE_EDITION) {
296
+ if (BILLING_ENABLED || !IS_ENTERPRISE_EDITION) {
258
297
  return;
259
298
  }
260
299
  void fetchGlobalConfig();
@@ -278,6 +317,70 @@ const EditionLabel = (props) => {
278
317
  globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseToken,
279
318
  serverLicenseValid,
280
319
  ]);
320
+ /*
321
+ * Whether a license token IS installed, whatever the license client made of
322
+ * it.
323
+ *
324
+ * It matters because "the unlicensed trial" is no longer only for an
325
+ * installation with no license: one whose token has no expiry recorded
326
+ * beside it falls back to the same trial and the same lapse (the license
327
+ * client's classifyUnverifiedWithoutExpiry), so the copy below must not tell
328
+ * a paying customer that no license is installed.
329
+ *
330
+ * Two signals, because the two audiences are told different things. A master
331
+ * admin is sent the token itself. Everybody else is sent only the
332
+ * verification, and the license client reports "none" there exactly when
333
+ * there was no token to judge - so an "unverified" or "verified" grace
334
+ * period is a grace period with a license behind it. Neither field is new:
335
+ * both already come back from GET /global-config/license.
336
+ */
337
+ const hasLicenseInstalled = IS_ENTERPRISE_EDITION &&
338
+ (Boolean(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseToken) ||
339
+ licenseVerification === "unverified" ||
340
+ licenseVerification === "verified");
341
+ /*
342
+ * The two faces of "grace". An unlicensed installation's trial (counted from
343
+ * the first run of the Enterprise Edition) is not an expired license, and
344
+ * the dialog must not tell somebody who never had a license to renew one.
345
+ */
346
+ const isUnlicensedTrial = IS_ENTERPRISE_EDITION &&
347
+ licenseStatus === "grace" &&
348
+ graceReason === "unlicensed";
349
+ const isExpiredGrace = IS_ENTERPRISE_EDITION &&
350
+ licenseStatus === "grace" &&
351
+ graceReason !== "unlicensed";
352
+ /*
353
+ * A license issued before OneUptime signed its licenses: accepted, but it
354
+ * cannot be verified offline.
355
+ */
356
+ const isUnverifiedLegacyLicense = IS_ENTERPRISE_EDITION &&
357
+ licenseValid &&
358
+ !isUnlicensedTrial &&
359
+ licenseVerification === "unverified";
360
+ const graceEndsAtText = useMemo(() => {
361
+ if (!graceEndsAt) {
362
+ return null;
363
+ }
364
+ const endsAt = OneUptimeDate.fromString(graceEndsAt);
365
+ if (Number.isNaN(endsAt.getTime())) {
366
+ return null;
367
+ }
368
+ return endsAt.toLocaleDateString();
369
+ }, [graceEndsAt]);
370
+ // Whole days left in the trial or the grace period, rounded up; never negative.
371
+ const graceDaysLeft = useMemo(() => {
372
+ if (!graceEndsAt) {
373
+ return null;
374
+ }
375
+ const endsAt = OneUptimeDate.fromString(graceEndsAt);
376
+ if (Number.isNaN(endsAt.getTime())) {
377
+ return null;
378
+ }
379
+ return Math.max(0, Math.ceil((endsAt.getTime() - Date.now()) / DAY_IN_MS));
380
+ }, [graceEndsAt]);
381
+ const graceDaysLeftText = graceDaysLeft === null
382
+ ? ""
383
+ : `${graceDaysLeft} ${graceDaysLeft === 1 ? "day" : "days"} left`;
281
384
  const licenseExpiresAtText = useMemo(() => {
282
385
  if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseExpiresAt)) {
283
386
  return null;
@@ -392,16 +495,6 @@ const EditionLabel = (props) => {
392
495
  }
393
496
  return currentUserCount;
394
497
  }, [isSeatLimitEnforced, enforcedSeatsInUse, currentUserCount]);
395
- const userCountUpdatedAtText = useMemo(() => {
396
- if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseUserCountUpdatedAt)) {
397
- return null;
398
- }
399
- const reportedAt = OneUptimeDate.fromString(globalConfig.enterpriseLicenseUserCountUpdatedAt);
400
- if (Number.isNaN(reportedAt.getTime())) {
401
- return null;
402
- }
403
- return reportedAt.toLocaleString();
404
- }, [globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseUserCountUpdatedAt]);
405
498
  const isUserLimitBreached = useMemo(() => {
406
499
  if (!licenseValid) {
407
500
  return false;
@@ -444,41 +537,6 @@ const EditionLabel = (props) => {
444
537
  }
445
538
  return rounded;
446
539
  }, [rawUserUsagePercent]);
447
- /*
448
- * The displayed percent clamped to 0-100. Drives the bar width and
449
- * aria-valuenow, so the fill can never overflow its track and aria-valuenow
450
- * can never exceed aria-valuemax. Derived from the displayed percent rather
451
- * than the raw ratio so the fill always agrees with the caption beneath it:
452
- * 599/600 reads 99% and fills to 99%, not to a visually full 100%. The true
453
- * figure for a breach goes in aria-valuetext.
454
- */
455
- const seatUsageBarPercent = useMemo(() => {
456
- if (seatUsageDisplayPercent === null) {
457
- return 0;
458
- }
459
- return Math.min(100, Math.max(0, seatUsageDisplayPercent));
460
- }, [seatUsageDisplayPercent]);
461
- const seatsRemaining = useMemo(() => {
462
- if (typeof userLimit !== "number" || userLimit <= 0) {
463
- return null;
464
- }
465
- if (typeof effectiveUserCount !== "number") {
466
- return null;
467
- }
468
- return userLimit - effectiveUserCount;
469
- }, [userLimit, effectiveUserCount]);
470
- const seatsRemainingText = useMemo(() => {
471
- if (typeof seatsRemaining !== "number") {
472
- return "";
473
- }
474
- if (seatsRemaining > 0) {
475
- return `${seatsRemaining.toLocaleString()} ${seatsRemaining === 1 ? "seat" : "seats"} remaining`;
476
- }
477
- if (seatsRemaining === 0) {
478
- return "No seats remaining";
479
- }
480
- return `${Math.abs(seatsRemaining).toLocaleString()} over limit`;
481
- }, [seatsRemaining]);
482
540
  /*
483
541
  * Total and mutually exclusive. isUserLimitBreached is tested first, so
484
542
  * reaching the >= 90 test structurally guarantees the limit is not exceeded
@@ -515,89 +573,39 @@ const EditionLabel = (props) => {
515
573
  canAddMoreUsers,
516
574
  seatUsageDisplayPercent,
517
575
  ]);
518
- /*
519
- * Copy containing apostrophes lives in string literals rather than JSX text,
520
- * because react/no-unescaped-entities is enforced in this repo.
521
- */
522
- const seatAdvisoryTitle = useMemo(() => {
523
- if (seatTone === "breached") {
524
- const over = Math.abs(seatsRemaining || 0);
525
- /*
526
- * Reachable now that "every seat taken" is a breach in its own right:
527
- * an installation sitting exactly on its limit is not "0 users over".
528
- */
529
- if (over === 0) {
530
- return "Every licensed seat is in use";
531
- }
532
- return over === 1
533
- ? "1 user over your licensed seats"
534
- : `${over.toLocaleString()} users over your licensed seats`;
576
+ const editionName = useMemo(() => {
577
+ if (!IS_ENTERPRISE_EDITION) {
578
+ return "Community Edition";
535
579
  }
536
- if (seatTone === "approaching") {
537
- if (seatsRemaining === 0) {
538
- return "Every licensed seat is in use";
539
- }
540
- return seatsRemaining === 1
541
- ? "Only 1 seat left on your license"
542
- : `Only ${(seatsRemaining || 0).toLocaleString()} seats left on your license`;
543
- }
544
- return "";
545
- }, [seatTone, seatsRemaining]);
546
- const seatAdvisoryBody = useMemo(() => {
547
- const limitText = (userLimit || 0).toLocaleString();
548
- const inUse = `${(effectiveUserCount || 0).toLocaleString()} of ${limitText}`;
549
- if (seatTone === "breached") {
550
- /*
551
- * When the limit is being enforced this is no longer advice, it is a
552
- * description of what the installation is already doing to invitations
553
- * and signups - so it says so plainly rather than suggesting an upgrade
554
- * as though adding people were still an option.
555
- */
556
- if (isSeatLimitEnforced && !canAddMoreUsers) {
557
- return `This installation is using ${inUse} licensed seats. New users cannot be invited, signed up or provisioned until a seat is freed up or the license is expanded.`;
558
- }
559
- return `This installation is using ${inUse} licensed seats. Expand your license so it covers everyone on the platform.`;
580
+ if (isConfigLoading) {
581
+ return "Enterprise Edition (Checking...)";
560
582
  }
561
- if (seatTone === "approaching") {
562
- return `You're using ${inUse} licensed seats. Anyone you add beyond ${limitText} puts this installation over its licensed limit — if more people are joining, it's worth talking to OneUptime about expanding now.`;
583
+ if (isUnlicensedTrial) {
584
+ return graceDaysLeftText
585
+ ? `Enterprise Edition (Trial, ${graceDaysLeftText})`
586
+ : "Enterprise Edition (Trial)";
563
587
  }
564
- return "";
565
- }, [
566
- seatTone,
567
- effectiveUserCount,
568
- userLimit,
569
- isSeatLimitEnforced,
570
- canAddMoreUsers,
571
- ]);
572
- const seatUsageAriaValueText = useMemo(() => {
573
- if (typeof seatUsageDisplayPercent !== "number") {
574
- return "";
588
+ if (isExpiredGrace) {
589
+ return "Enterprise Edition (License Expired, Grace Period)";
575
590
  }
576
- if (seatTone === "breached") {
577
- return `${seatUsageDisplayPercent}% of licensed seats in use — ${seatAdvisoryTitle}`;
591
+ if (licenseValid) {
592
+ return "Enterprise Edition";
578
593
  }
579
- if (typeof seatsRemaining === "number") {
580
- return `${seatUsageDisplayPercent}% of licensed seats in use — ${seatsRemainingText}`;
594
+ if (licenseStatus === "expired") {
595
+ return "Enterprise Edition (License Expired)";
581
596
  }
582
- return `${seatUsageDisplayPercent}% of licensed seats in use`;
597
+ if (licenseStatus === "invalid") {
598
+ return "Enterprise Edition (License Invalid)";
599
+ }
600
+ return "Enterprise Edition (License Required)";
583
601
  }, [
584
- seatUsageDisplayPercent,
585
- seatTone,
586
- seatAdvisoryTitle,
587
- seatsRemaining,
588
- seatsRemainingText,
602
+ isConfigLoading,
603
+ licenseValid,
604
+ licenseStatus,
605
+ isUnlicensedTrial,
606
+ isExpiredGrace,
607
+ graceDaysLeftText,
589
608
  ]);
590
- const editionName = useMemo(() => {
591
- if (!IS_ENTERPRISE_EDITION) {
592
- return "Community Edition";
593
- }
594
- if (isConfigLoading) {
595
- return "Enterprise Edition (Checking...)";
596
- }
597
- return licenseValid
598
- ? "Enterprise Edition"
599
- : "Enterprise Edition (License Required)";
600
- }, [isConfigLoading, licenseValid]);
601
609
  const indicatorColor = useMemo(() => {
602
610
  if (!IS_ENTERPRISE_EDITION) {
603
611
  return "bg-indigo-400";
@@ -611,19 +619,31 @@ const EditionLabel = (props) => {
611
619
  if (seatTone === "breached") {
612
620
  return "bg-red-500";
613
621
  }
614
- if (seatTone === "approaching") {
622
+ if (seatTone === "approaching" || licenseStatus === "grace") {
615
623
  return "bg-amber-500";
616
624
  }
617
625
  return "bg-emerald-500";
618
- }, [isConfigLoading, licenseValid, seatTone]);
626
+ }, [isConfigLoading, licenseValid, seatTone, licenseStatus]);
619
627
  const ctaLabel = useMemo(() => {
620
628
  if (!IS_ENTERPRISE_EDITION) {
621
- return "Learn more";
629
+ return showEditionMismatchNotice ? "Action needed" : "Learn more";
622
630
  }
623
631
  if (isConfigLoading) {
624
632
  return "Checking";
625
633
  }
634
+ if (isUnlicensedTrial) {
635
+ return "Add license";
636
+ }
637
+ if (isExpiredGrace) {
638
+ return "Renew license";
639
+ }
626
640
  if (!licenseValid) {
641
+ if (licenseStatus === "expired") {
642
+ return "Renew license";
643
+ }
644
+ if (licenseStatus === "invalid") {
645
+ return "Fix license";
646
+ }
627
647
  return "Validate license";
628
648
  }
629
649
  if (seatTone === "breached") {
@@ -633,24 +653,40 @@ const EditionLabel = (props) => {
633
653
  return "Seats nearly full";
634
654
  }
635
655
  return "View details";
636
- }, [isConfigLoading, licenseValid, seatTone]);
656
+ }, [
657
+ isConfigLoading,
658
+ licenseValid,
659
+ licenseStatus,
660
+ seatTone,
661
+ isUnlicensedTrial,
662
+ isExpiredGrace,
663
+ showEditionMismatchNotice,
664
+ ]);
637
665
  const pillTone = useMemo(() => {
638
- if (!IS_ENTERPRISE_EDITION || isConfigLoading) {
666
+ if (!IS_ENTERPRISE_EDITION) {
667
+ return showEditionMismatchNotice ? "warning" : "normal";
668
+ }
669
+ if (isConfigLoading) {
639
670
  return "normal";
640
671
  }
641
672
  if (seatTone === "breached" ||
642
- (!licenseValid && Boolean(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey))) {
673
+ (!licenseValid &&
674
+ (Boolean(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey) ||
675
+ licenseStatus === "expired" ||
676
+ licenseStatus === "invalid"))) {
643
677
  return "alerted";
644
678
  }
645
- if (seatTone === "approaching") {
679
+ if (seatTone === "approaching" || licenseStatus === "grace") {
646
680
  return "warning";
647
681
  }
648
682
  return "normal";
649
683
  }, [
650
684
  isConfigLoading,
651
685
  licenseValid,
686
+ licenseStatus,
652
687
  seatTone,
653
688
  globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey,
689
+ showEditionMismatchNotice,
654
690
  ]);
655
691
  const modalDescription = useMemo(() => {
656
692
  if (!IS_ENTERPRISE_EDITION) {
@@ -659,33 +695,17 @@ const EditionLabel = (props) => {
659
695
  if (isConfigLoading) {
660
696
  return "Checking your license with OneUptime...";
661
697
  }
698
+ if (isUnlicensedTrial) {
699
+ return "No license is installed yet. Enterprise features are available during the trial.";
700
+ }
701
+ if (isExpiredGrace) {
702
+ return "Your license has expired. Renew it before the grace period ends.";
703
+ }
662
704
  if (!licenseValid) {
663
- return "Validate your license key to activate Enterprise Edition.";
705
+ return "Add a valid license to turn single sign-on, SCIM and audit logging back on and make enterprise configuration editable.";
664
706
  }
665
707
  return "License, version, seat usage, and the instances covered by this key.";
666
- }, [isConfigLoading, licenseValid]);
667
- /*
668
- * The per-instance counts only exceed the unique total when someone actually
669
- * appears on more than one instance, and the component cannot know whether
670
- * they do — it receives per-instance counts and the unique total separately.
671
- * So the summation is stated as a possibility, and is dropped entirely when
672
- * there is no unique total to compare against. It names the unique user count
673
- * rather than "the total above", which would be ambiguous next to a hero
674
- * reading "119 / 120 seats".
675
- */
676
- const instanceOverlapText = useMemo(() => {
677
- const countingRule = `Seats are counted uniquely across all ${licenseInstances.length} instances that share this license — the same person on multiple instances uses one seat.`;
678
- if (typeof currentUserCount !== "number") {
679
- return countingRule;
680
- }
681
- return `${countingRule} Per-instance counts can therefore add up to more than the ${currentUserCount.toLocaleString()} unique ${currentUserCount === 1 ? "user" : "users"} counted above.`;
682
- }, [licenseInstances.length, currentUserCount]);
683
- const licenseKeyHelperText = useMemo(() => {
684
- if (isChangingLicense) {
685
- return "Enter the new enterprise license key and validate it to replace the current one. Your existing license stays active until the new key is validated.";
686
- }
687
- return "You have installed Enterprise Edition of OneUptime. You need to validate your license key. Need a license key? Contact our sales team at";
688
- }, [isChangingLicense]);
708
+ }, [isConfigLoading, licenseValid, isUnlicensedTrial, isExpiredGrace]);
689
709
  const communityFeatures = useMemo(() => {
690
710
  return [
691
711
  "Full OneUptime platform with incident response, status pages, and workflow automation.",
@@ -705,30 +725,16 @@ const EditionLabel = (props) => {
705
725
  "Audit logs and many more enterprise-focused features.",
706
726
  ];
707
727
  }, []);
728
+ /*
729
+ * The license manager clears its own messages (and abandons a license
730
+ * change in progress) when the dialog opens or closes.
731
+ */
708
732
  const openDialog = () => {
709
733
  setIsDialogOpen(true);
710
- setValidationError("");
711
- setSuccessMessage("");
712
734
  void fetchGlobalConfig();
713
735
  };
714
736
  const closeDialog = () => {
715
737
  setIsDialogOpen(false);
716
- setValidationError("");
717
- setSuccessMessage("");
718
- setIsChangingLicense(false);
719
- };
720
- const handleStartChangingLicense = () => {
721
- setIsChangingLicense(true);
722
- setValidationError("");
723
- setSuccessMessage("");
724
- setLicenseKeyInput("");
725
- licenseInputEditedRef.current = true;
726
- };
727
- const handleCancelChangingLicense = () => {
728
- setIsChangingLicense(false);
729
- setValidationError("");
730
- licenseInputEditedRef.current = false;
731
- setLicenseKeyInput((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey) || "");
732
738
  };
733
739
  const handlePrimaryAction = () => {
734
740
  if (typeof window !== "undefined") {
@@ -736,134 +742,11 @@ const EditionLabel = (props) => {
736
742
  }
737
743
  closeDialog();
738
744
  };
739
- const buildSeatExpansionMailto = () => {
740
- const subject = seatTone === "breached"
741
- ? "Expand OneUptime license - over seat limit"
742
- : "Expand OneUptime license - nearly out of seats";
743
- const body = [
744
- "Hi OneUptime,",
745
- "",
746
- "We would like to expand the seat count on our enterprise license.",
747
- "",
748
- `Company: ${(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseCompanyName) || "Not specified"}`,
749
- `Seats in use: ${(effectiveUserCount || 0).toLocaleString()} of ${(userLimit || 0).toLocaleString()}`,
750
- `Instances on this license: ${licenseInstances.length}`,
751
- ].join("\n");
752
- return `${SALES_MAILTO_URL}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
753
- };
754
- const handleRequestMoreSeats = () => {
755
- if (typeof window !== "undefined") {
756
- window.location.href = buildSeatExpansionMailto();
757
- }
758
- };
759
- const runLicenseValidation = useCallback(async (key, setLoading) => {
760
- const trimmedKey = key.trim();
761
- if (!trimmedKey) {
762
- setValidationError("Please enter a license key before validating.");
763
- setSuccessMessage("");
764
- return;
765
- }
766
- setValidationError("");
767
- setSuccessMessage("");
768
- setLoading(true);
769
- try {
770
- const validationUrl = URL.fromURL(APP_API_URL).addRoute(new Route("/global-config/license"));
771
- const response = await API.fetch({
772
- method: HTTPMethod.POST,
773
- url: validationUrl,
774
- data: {
775
- licenseKey: trimmedKey,
776
- },
777
- });
778
- if (!response.isSuccess()) {
779
- throw response;
780
- }
781
- const payload = response.data;
782
- licenseInputEditedRef.current = false;
783
- setLicenseKeyInput(payload["licenseKey"] || trimmedKey);
784
- setSuccessMessage("License validated successfully.");
785
- setIsChangingLicense(false);
786
- await fetchGlobalConfig();
787
- }
788
- catch (err) {
789
- setValidationError(API.getFriendlyMessage(err));
790
- }
791
- finally {
792
- setLoading(false);
793
- }
794
- }, [fetchGlobalConfig]);
795
- const handleValidateClick = () => {
796
- if (isValidating) {
797
- return;
798
- }
799
- void runLicenseValidation(licenseKeyInput, setIsValidating);
800
- };
801
- /*
802
- * Re-ask oneuptime.com about the license this installation already holds.
803
- *
804
- * The seat limit and the expiry are changed on oneuptime.com, and the daily
805
- * report job is what normally carries them here - so without this, an
806
- * administrator who has just bought seats waits up to a day before the
807
- * installation stops refusing invitations. Deliberately sends no key: the
808
- * server refreshes the stored one.
809
- */
810
- const handleRefreshLicense = useCallback(() => {
811
- if (isRefreshingLicense) {
812
- return;
813
- }
814
- const refresh = async () => {
815
- setValidationError("");
816
- setSuccessMessage("");
817
- setIsRefreshingLicense(true);
818
- try {
819
- const refreshUrl = URL.fromURL(APP_API_URL).addRoute(new Route("/global-config/license/refresh"));
820
- const response = await API.fetch({
821
- method: HTTPMethod.POST,
822
- url: refreshUrl,
823
- });
824
- if (!response.isSuccess()) {
825
- throw response;
826
- }
827
- applySeatEnforcementPayload(response.data);
828
- setSuccessMessage("License refreshed from OneUptime.");
829
- /*
830
- * The POST already returned the new terms, but the modal renders from
831
- * what the GET reports - re-reading keeps one source of truth for the
832
- * whole dialog instead of two that can disagree.
833
- */
834
- await fetchGlobalConfig();
835
- }
836
- catch (err) {
837
- setValidationError(API.getFriendlyMessage(err));
838
- }
839
- finally {
840
- setIsRefreshingLicense(false);
841
- }
842
- };
843
- void refresh();
844
- }, [isRefreshingLicense, fetchGlobalConfig, applySeatEnforcementPayload]);
845
745
  const handleRetryFetch = () => {
846
746
  if (!isConfigLoading) {
847
747
  void fetchGlobalConfig();
848
748
  }
849
749
  };
850
- /*
851
- * Activating, replacing and refreshing the license are master-admin actions:
852
- * the license is instance-wide, and its seat limit is what UserService
853
- * enforces against, so being able to rewrite it is being able to raise the
854
- * ceiling on the whole installation. The server enforces this
855
- * (MasterAdminAuthorization on both POSTs); hiding the controls here just
856
- * stops everyone else being offered a button that can only fail.
857
- *
858
- * False for a signed-out visitor, which is what keeps the license key input
859
- * off the login page where this same component renders the edition pill.
860
- */
861
- const canManageLicense = useMemo(() => {
862
- return Boolean(UserUtil.isMasterAdmin());
863
- }, []);
864
- const showLicenseKeyInput = IS_ENTERPRISE_EDITION &&
865
- canManageLicense &&
866
- (!licenseValid || isChangingLicense);
867
750
  /*
868
751
  * Someone who cannot fix the license still needs to be told why the
869
752
  * installation is behaving like an unlicensed one, and who can fix it.
@@ -873,12 +756,18 @@ const EditionLabel = (props) => {
873
756
  !isConfigLoading &&
874
757
  !licenseValid &&
875
758
  !canManageLicense;
876
- const shouldShowEnterpriseValidationButton = showLicenseKeyInput;
877
759
  /*
878
760
  * Collapses the !configError && !isConfigLoading && licenseValid chain that
879
- * gates the stat strip, the seat card and the instances card.
761
+ * gates the stat strip here, and the license manager's seat card, instances
762
+ * card and footer actions.
880
763
  */
881
- const showLicenseDetails = IS_ENTERPRISE_EDITION && !configError && !isConfigLoading && licenseValid;
764
+ const showLicenseDetails = IS_ENTERPRISE_EDITION &&
765
+ !configError &&
766
+ !isConfigLoading &&
767
+ licenseValid &&
768
+ !isUnlicensedTrial;
769
+ // Status notices describe the license, so they wait for it to load.
770
+ const showLicenseStatusNotices = IS_ENTERPRISE_EDITION && !configError && !isConfigLoading;
882
771
  /*
883
772
  * The evaluation notice rides along with the license details: it is only
884
773
  * meaningful once there is a valid license to describe, and it sits at the
@@ -890,7 +779,10 @@ const EditionLabel = (props) => {
890
779
  * admin sees "Evaluation" without opening the modal.
891
780
  */
892
781
  const showEvaluationTag = IS_ENTERPRISE_EDITION && licenseValid && isEvaluationLicense;
893
- const showEnterpriseFeatureList = IS_ENTERPRISE_EDITION && !configError && !isConfigLoading && !licenseValid;
782
+ const showEnterpriseFeatureList = IS_ENTERPRISE_EDITION &&
783
+ !configError &&
784
+ !isConfigLoading &&
785
+ (!licenseValid || isUnlicensedTrial);
894
786
  /*
895
787
  * Gated on neither edition nor licenseValid: which build you run, and
896
788
  * whether a newer one exists, is a property of the installation rather than
@@ -899,32 +791,6 @@ const EditionLabel = (props) => {
899
791
  * anonymous visitor on the login page falls out here.
900
792
  */
901
793
  const showVersionCard = !configError && !isConfigLoading && Boolean(currentVersion);
902
- /*
903
- * GlobalConfigAPI returns userLimit and currentUserCount to anonymous callers
904
- * because the same route serves the signed-out login page, and gates only
905
- * licenseKey, token, instances and instanceId on isAuthenticatedUser. Gate
906
- * the sales ask on a field the server does redact, so a signed-out visitor is
907
- * never shown an administrator-targeted CTA.
908
- */
909
- const canSeeLicenseAdmin = Boolean(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey);
910
- const modalSubmitButtonText = IS_ENTERPRISE_EDITION
911
- ? shouldShowEnterpriseValidationButton
912
- ? "Validate License"
913
- : undefined
914
- : "Talk to Sales";
915
- const modalOnSubmit = IS_ENTERPRISE_EDITION
916
- ? shouldShowEnterpriseValidationButton
917
- ? handleValidateClick
918
- : undefined
919
- : handlePrimaryAction;
920
- const modalIsLoading = IS_ENTERPRISE_EDITION && shouldShowEnterpriseValidationButton
921
- ? isValidating
922
- : false;
923
- const modalDisableSubmitButton = IS_ENTERPRISE_EDITION
924
- ? shouldShowEnterpriseValidationButton
925
- ? !licenseKeyInput.trim() || isValidating || isConfigLoading
926
- : undefined
927
- : false;
928
794
  const modalRightElement = showLicenseDetails ? (React.createElement("span", { className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium ${seatTone === "breached"
929
795
  ? "border-red-200 bg-red-50 text-red-700"
930
796
  : seatTone === "approaching"
@@ -939,10 +805,9 @@ const EditionLabel = (props) => {
939
805
  ? "Seat limit exceeded"
940
806
  : seatTone === "approaching"
941
807
  ? "Seats nearly full"
942
- : "License active")) : undefined;
943
- const modalLeftFooterElement = showLicenseDetails && !isChangingLicense && canManageLicense ? (React.createElement("div", { className: "flex flex-wrap items-center gap-2" },
944
- React.createElement(Button, { title: "Refresh license", icon: IconProp.Refresh, buttonStyle: ButtonStyleType.NORMAL, onClick: handleRefreshLicense, isLoading: isRefreshingLicense, disabled: isRefreshingLicense || isConfigLoading, tooltip: "Fetch the latest seat limit and expiry for this license from OneUptime.", dataTestId: "refresh-enterprise-license", className: "!mt-0 md:!ml-0" }),
945
- React.createElement(Button, { title: "Change license key", icon: IconProp.Edit, buttonStyle: ButtonStyleType.NORMAL, onClick: handleStartChangingLicense, disabled: isRefreshingLicense, className: "!mt-0 md:!ml-0" }))) : undefined;
808
+ : isExpiredGrace
809
+ ? "Grace period"
810
+ : "License active")) : undefined;
946
811
  const pillClassName = pillTone === "alerted"
947
812
  ? "group inline-flex items-center gap-2 rounded-full border border-red-200 bg-red-50 px-3 py-1 text-xs font-medium text-red-700 shadow-sm transition hover:border-red-300 hover:bg-red-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-400"
948
813
  : pillTone === "warning"
@@ -1008,19 +873,123 @@ const EditionLabel = (props) => {
1008
873
  React.createElement("a", { href: `${SALES_MAILTO_URL}?subject=${encodeURIComponent("Moving our OneUptime evaluation to production")}`, className: "inline-flex items-center gap-1.5 rounded-md bg-violet-600 px-3 py-1.5 text-xs font-medium text-white shadow-sm transition hover:bg-violet-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-violet-400 focus-visible:ring-offset-2" },
1009
874
  React.createElement(Icon, { icon: IconProp.Email, className: "h-3 w-3 shrink-0 text-white" }),
1010
875
  "Talk to sales about production")))))) : null;
1011
- return (React.createElement(React.Fragment, null,
1012
- React.createElement("button", { type: "button", onClick: openDialog, className: `${pillClassName} ${props.className ? props.className : ""}`, "aria-label": `${editionName}${showEvaluationTag ? ", Evaluation" : ""}, ${ctaLabel}` },
1013
- pillTone !== "normal" && (React.createElement(Icon, { icon: pillTone === "alerted"
1014
- ? IconProp.Alert
1015
- : IconProp.ExclaimationCircle, className: `h-3 w-3 ${pillTone === "alerted" ? "text-red-600" : "text-amber-600"}` })),
1016
- React.createElement("span", { className: `h-2 w-2 rounded-full transition group-hover:scale-110 ${indicatorColor}` }),
1017
- React.createElement("span", { className: "tracking-wide" }, editionName),
1018
- showEvaluationTag && (React.createElement("span", { className: "inline-flex items-center rounded-full bg-violet-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-violet-700" }, "Evaluation")),
1019
- React.createElement("span", { className: pillCtaTextClassName }, ctaLabel)),
1020
- isDialogOpen && (React.createElement(Modal, { title: editionName, description: modalDescription, rightElement: modalRightElement, submitButtonText: modalSubmitButtonText, closeButtonText: "Close", onClose: closeDialog, onSubmit: modalOnSubmit, modalWidth: ModalWidth.Medium, isLoading: modalIsLoading, disableSubmitButton: modalDisableSubmitButton, isBodyLoading: IS_ENTERPRISE_EDITION ? isConfigLoading : false, leftFooterElement: modalLeftFooterElement },
876
+ /*
877
+ * What the license status means for this installation, in plain words.
878
+ * Before the lapse (the trial, the grace period) every branch warns what
879
+ * will stop and when (LICENSE_LAPSE_CONSEQUENCES); after it, what has
880
+ * stopped (LICENSE_LAPSED_STATE).
881
+ */
882
+ const licenseStatusNoticeElement = (() => {
883
+ if (!showLicenseStatusNotices) {
884
+ return null;
885
+ }
886
+ if (isUnlicensedTrial) {
887
+ return (React.createElement("section", { role: "status", "data-testid": "enterprise-license-trial-notice", className: "rounded-xl border border-amber-200 bg-amber-50 p-5" },
888
+ React.createElement("h4", { className: "text-sm font-semibold text-amber-900" }, graceDaysLeftText
889
+ ? `Enterprise Edition trial: ${graceDaysLeftText}`
890
+ : "Enterprise Edition trial"),
891
+ React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-amber-800" }, `${hasLicenseInstalled
892
+ ? "A license is installed, but this installation cannot tell whether it is still current, so it is treating this as an unlicensed install."
893
+ : "No Enterprise license is installed."} Enterprise features stay fully available${graceEndsAtText ? ` until ${graceEndsAtText}` : ""}, counted from the first time this installation ran the Enterprise Edition. ${TRIAL_ENFORCEMENT_SUMMARY}`),
894
+ hasLicenseInstalled && licenseMessage && (React.createElement("p", { "data-testid": "enterprise-license-status-message", className: "mt-2 text-xs leading-relaxed text-amber-800" }, licenseMessage)),
895
+ React.createElement("p", { className: "mt-2 text-xs leading-relaxed text-amber-800" }, canManageLicense
896
+ ? hasLicenseInstalled
897
+ ? "Re-activate the license below before the trial ends, or let the daily license sync fetch its expiry from OneUptime, to keep single sign-on, SCIM and audit logging running and enterprise configuration editable."
898
+ : "Add a license below before the trial ends to keep single sign-on, SCIM and audit logging running and enterprise configuration editable."
899
+ : hasLicenseInstalled
900
+ ? "Ask a master admin of this installation to re-activate the license."
901
+ : "Ask a master admin of this installation to add a license.")));
902
+ }
903
+ if (isExpiredGrace) {
904
+ return (React.createElement("section", { role: "status", "data-testid": "enterprise-license-grace-notice", className: "rounded-xl border border-amber-200 bg-amber-50 p-5" },
905
+ React.createElement("h4", { className: "text-sm font-semibold text-amber-900" }, graceEndsAtText
906
+ ? `License expired, grace period until ${graceEndsAtText}`
907
+ : "License expired, grace period"),
908
+ React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-amber-800" }, `The Enterprise license expired${licenseExpiresAtText ? ` on ${licenseExpiresAtText}` : ""}. Every enterprise feature keeps working until the grace period ends${graceDaysLeftText ? ` (${graceDaysLeftText})` : ""}. ${GRACE_ENFORCEMENT_SUMMARY}`),
909
+ React.createElement("p", { className: "mt-2 text-xs leading-relaxed text-amber-800" }, canManageLicense
910
+ ? "Renew the license with OneUptime, then refresh it here."
911
+ : "Ask a master admin of this installation to renew the license.")));
912
+ }
913
+ if (!licenseValid) {
914
+ const title = licenseStatus === "expired"
915
+ ? "License expired"
916
+ : licenseStatus === "invalid"
917
+ ? "License not valid"
918
+ : "No valid license";
919
+ const reason = licenseStatus === "expired"
920
+ ? `The Enterprise license expired${licenseExpiresAtText ? ` on ${licenseExpiresAtText}` : ""} and its grace period is over.`
921
+ : licenseStatus === "invalid"
922
+ ? licenseMessage ||
923
+ "The stored license could not be verified. Validate the license again."
924
+ : hasLicenseInstalled
925
+ ? "A license is installed, but this installation cannot confirm that it is current, so nothing is licensed by it."
926
+ : "This installation has no valid Enterprise license.";
927
+ /*
928
+ * Whatever the license client said, for EVERY status and not only
929
+ * "invalid".
930
+ *
931
+ * The reason above is this component's own reading of a status code, and
932
+ * a status code cannot carry a diagnosis: "missing" is both "no license"
933
+ * and "a license whose expiry was never recorded, re-activate it or let
934
+ * the daily sync fetch it" (the license client's
935
+ * classifyUnverifiedWithoutExpiry). The second one is the whole point of
936
+ * the message field, and it used to be rendered nowhere but here in the
937
+ * "invalid" branch - which that state deliberately no longer is.
938
+ *
939
+ * Skipped when the reason already IS the message ("invalid"), so a master
940
+ * admin is never shown the same sentence twice.
941
+ */
942
+ const explanation = licenseMessage && licenseMessage !== reason ? licenseMessage : "";
943
+ return (React.createElement("section", { role: "alert", "data-testid": "enterprise-license-required-notice", className: "rounded-xl border border-red-200 bg-red-50 p-5" },
944
+ React.createElement("h4", { className: "text-sm font-semibold text-red-900" }, title),
945
+ explanation && (React.createElement("p", { "data-testid": "enterprise-license-status-message", className: "mt-1 text-xs leading-relaxed text-red-800" }, explanation)),
946
+ React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-red-800" }, `${reason} ${LICENSE_LAPSED_STATE}`)));
947
+ }
948
+ if (isUnverifiedLegacyLicense && canManageLicense) {
949
+ return (React.createElement("section", { "data-testid": "enterprise-license-unverified-notice", className: "rounded-xl border border-gray-200 bg-gray-50 p-4" },
950
+ React.createElement("h4", { className: "text-sm font-semibold text-gray-900" }, "Legacy license"),
951
+ React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-gray-600" }, "This license was issued before OneUptime signed its licenses, so this installation cannot verify it offline. It keeps working; refreshing the license replaces it with a signed one once OneUptime issues them.")));
952
+ }
953
+ return null;
954
+ })();
955
+ /*
956
+ * What the license manager needs to know, all of it read from the license
957
+ * GET (see LicenseManager.ts).
958
+ */
959
+ const licenseSnapshot = {
960
+ payload: licensePayload,
961
+ isLoading: isConfigLoading,
962
+ loadError: configError,
963
+ canManageLicense: canManageLicense,
964
+ licenseValid: licenseValid,
965
+ isUnlicensedTrial: isUnlicensedTrial,
966
+ showLicenseDetails: showLicenseDetails,
967
+ companyName: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseCompanyName) || "",
968
+ licenseKey: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey) || "",
969
+ userLimit: userLimit,
970
+ currentUserCount: currentUserCount,
971
+ effectiveUserCount: effectiveUserCount,
972
+ isSeatLimitEnforced: isSeatLimitEnforced,
973
+ canAddMoreUsers: canAddMoreUsers,
974
+ seatTone: seatTone,
975
+ seatUsageDisplayPercent: seatUsageDisplayPercent,
976
+ currentVersion: currentVersion,
977
+ latestVersion: latestVersion,
978
+ hasComparableVersion: hasComparableVersion,
979
+ };
980
+ /*
981
+ * The dialog, with whatever the license manager adds to it: its messages,
982
+ * the seat usage and instance cards, the activation input and the footer
983
+ * actions. With no manager (the Community Edition, the login page) the
984
+ * parts are empty and the dialog shows the license status only.
985
+ */
986
+ const renderDialog = (parts) => {
987
+ if (!isDialogOpen) {
988
+ return React.createElement(React.Fragment, null);
989
+ }
990
+ return (React.createElement(Modal, { title: editionName, description: modalDescription, rightElement: modalRightElement, submitButtonText: IS_ENTERPRISE_EDITION ? parts.submitButtonText : "Talk to Sales", closeButtonText: "Close", onClose: closeDialog, onSubmit: IS_ENTERPRISE_EDITION ? parts.onSubmit : handlePrimaryAction, modalWidth: ModalWidth.Medium, isLoading: IS_ENTERPRISE_EDITION ? Boolean(parts.isSubmitting) : false, disableSubmitButton: IS_ENTERPRISE_EDITION ? parts.disableSubmitButton : false, isBodyLoading: IS_ENTERPRISE_EDITION ? isConfigLoading : false, leftFooterElement: IS_ENTERPRISE_EDITION ? parts.leftFooterElement : undefined },
1021
991
  React.createElement("div", { className: "space-y-4 text-sm text-gray-600" }, IS_ENTERPRISE_EDITION ? (React.createElement(React.Fragment, null,
1022
- !configError && successMessage && (React.createElement(Alert, { type: AlertType.SUCCESS, title: successMessage })),
1023
- !configError && validationError && !showLicenseKeyInput && (React.createElement(Alert, { type: AlertType.DANGER, title: validationError })),
992
+ parts.messages,
1024
993
  configError && (React.createElement("div", { className: "rounded-xl border border-red-200 bg-red-50 p-4" },
1025
994
  React.createElement("div", { className: "flex items-start gap-2.5" },
1026
995
  React.createElement(Icon, { icon: IconProp.Alert, className: "mt-0.5 h-4 w-4 shrink-0 text-red-600" }),
@@ -1030,6 +999,7 @@ const EditionLabel = (props) => {
1030
999
  React.createElement("div", { className: "mt-3" },
1031
1000
  React.createElement(Button, { title: "Try again", buttonStyle: ButtonStyleType.DANGER, onClick: handleRetryFetch, isLoading: isConfigLoading, className: "!mt-0 md:!ml-0" })))))),
1032
1001
  evaluationNoticeElement,
1002
+ licenseStatusNoticeElement,
1033
1003
  showLicenseDetails && (React.createElement("dl", { className: "grid grid-cols-1 gap-px overflow-hidden rounded-xl border border-gray-200 bg-gray-200 sm:grid-cols-2" },
1034
1004
  React.createElement("div", { className: "min-w-0 bg-white px-4 py-3" },
1035
1005
  React.createElement("dt", { className: "text-[11px] font-medium uppercase tracking-wide text-gray-500" }, "Licensed to"),
@@ -1038,187 +1008,28 @@ const EditionLabel = (props) => {
1038
1008
  React.createElement("dt", { className: "text-[11px] font-medium uppercase tracking-wide text-gray-500" }, "Expires"),
1039
1009
  React.createElement("dd", { className: "mt-1 text-sm font-medium tabular-nums text-gray-900" }, licenseExpiresAtText || "—")))),
1040
1010
  versionCardElement,
1041
- showLicenseDetails && (React.createElement("section", { "aria-labelledby": "edition-seats-heading", className: "rounded-xl border border-gray-200 bg-white p-5" },
1042
- React.createElement("div", { className: "flex items-start justify-between gap-4" },
1043
- React.createElement("div", { className: "min-w-0" },
1044
- React.createElement("h4", { id: "edition-seats-heading", className: "text-sm font-semibold text-gray-900" }, "Licensed seats"),
1045
- React.createElement("p", { className: "mt-0.5 text-xs text-gray-500" }, "Unique users across every instance on this license.")),
1046
- seatTone !== "healthy" && (React.createElement("span", { className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-xs font-medium ${seatTone === "breached"
1047
- ? "bg-red-100 text-red-700"
1048
- : "bg-amber-100 text-amber-800"}` }, seatTone === "breached"
1049
- ? "Limit exceeded"
1050
- : "Nearly full"))),
1051
- React.createElement("div", { className: "mt-4 flex items-end justify-between gap-4" },
1052
- React.createElement("p", { className: "flex items-baseline gap-1.5" },
1053
- React.createElement("span", { className: `text-3xl font-semibold leading-none tabular-nums ${typeof effectiveUserCount !== "number"
1054
- ? "text-gray-300"
1055
- : seatTone === "breached"
1056
- ? "text-red-700"
1057
- : "text-gray-900"}` }, typeof effectiveUserCount === "number"
1058
- ? effectiveUserCount.toLocaleString()
1059
- : "—"),
1060
- React.createElement("span", { className: "text-sm tabular-nums text-gray-500" },
1061
- " / ",
1062
- typeof userLimit === "number" && userLimit > 0
1063
- ? `${userLimit.toLocaleString()} seats`
1064
- : "unlimited")),
1065
- typeof seatsRemaining === "number" && (React.createElement("p", { className: `text-xs font-medium tabular-nums ${seatTone === "breached"
1066
- ? "text-red-700"
1067
- : seatTone === "approaching"
1068
- ? "text-amber-700"
1069
- : "text-gray-500"}` }, seatsRemainingText))),
1070
- typeof seatUsageDisplayPercent === "number" && (React.createElement("div", { className: "mt-2.5" },
1071
- React.createElement("div", { className: "h-2.5 w-full overflow-hidden rounded-full bg-gray-100", role: "progressbar", "aria-label": "Licensed seat usage", "aria-valuenow": seatUsageBarPercent, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuetext": seatUsageAriaValueText },
1072
- React.createElement("div", { className: `h-full rounded-full transition-all duration-300 ease-out ${seatTone === "breached"
1073
- ? "bg-red-500"
1074
- : seatTone === "approaching"
1075
- ? "bg-amber-500"
1076
- : "bg-emerald-500"}`, style: { width: `${seatUsageBarPercent}%` } })),
1077
- React.createElement("p", { className: "mt-1.5 text-xs tabular-nums text-gray-500" },
1078
- seatUsageDisplayPercent,
1079
- "% of licensed seats in use"))),
1080
- seatTone !== "healthy" && canSeeLicenseAdmin && (React.createElement("div", { role: seatTone === "breached" ? "alert" : "status", className: `mt-4 rounded-lg border p-3.5 ${seatTone === "breached"
1081
- ? "border-red-200 bg-red-50"
1082
- : "border-amber-200 bg-amber-50"}` },
1083
- React.createElement("div", { className: "flex items-start gap-2.5" },
1084
- React.createElement(Icon, { icon: seatTone === "breached"
1085
- ? IconProp.Alert
1086
- : IconProp.ExclaimationCircle, className: `mt-0.5 h-4 w-4 shrink-0 ${seatTone === "breached"
1087
- ? "text-red-600"
1088
- : "text-amber-600"}` }),
1089
- React.createElement("div", { className: "min-w-0 flex-1" },
1090
- React.createElement("h5", { className: `text-sm font-semibold ${seatTone === "breached"
1091
- ? "text-red-900"
1092
- : "text-amber-900"}` }, seatAdvisoryTitle),
1093
- React.createElement("p", { className: `mt-1 text-xs leading-relaxed ${seatTone === "breached"
1094
- ? "text-red-800"
1095
- : "text-amber-800"}` }, seatAdvisoryBody),
1096
- React.createElement("div", { className: "mt-3 flex flex-wrap items-center gap-x-3 gap-y-2" },
1097
- React.createElement(Button, { title: seatTone === "breached"
1098
- ? "Expand your license"
1099
- : "Request more seats", icon: IconProp.Email, buttonStyle: seatTone === "breached"
1100
- ? ButtonStyleType.DANGER
1101
- : ButtonStyleType.PRIMARY, onClick: handleRequestMoreSeats, className: "!mt-0 md:!ml-0" }),
1102
- React.createElement("span", { className: `text-[11px] ${seatTone === "breached"
1103
- ? "text-red-700"
1104
- : "text-amber-700"}` },
1105
- "Or email",
1106
- " ",
1107
- React.createElement("a", { href: SALES_MAILTO_URL, className: `font-medium underline ${seatTone === "breached"
1108
- ? "text-red-800 hover:text-red-900"
1109
- : "text-amber-900 hover:text-amber-950"}` }, SALES_EMAIL),
1110
- " ",
1111
- "directly.")))))),
1112
- React.createElement("div", { className: "mt-4 border-t border-gray-100 pt-3" },
1113
- React.createElement("p", { className: "text-xs text-gray-500" },
1114
- userCountUpdatedAtText
1115
- ? `Last reported to OneUptime on ${userCountUpdatedAtText}.`
1116
- : "User count has not been reported to OneUptime yet. The first report will be sent within 24 hours.",
1117
- isSeatLimitEnforced && (React.createElement(React.Fragment, null,
1118
- " ",
1119
- "This installation enforces the seat limit: users above it cannot be invited, signed up or provisioned.")),
1120
- isSeatLimitEnforced && canManageLicense && (React.createElement(React.Fragment, null,
1121
- " ",
1122
- "Bought more seats? Use \"Refresh license\" below to apply the new limit without waiting for the next daily report.")))))),
1123
- showLicenseDetails && licenseInstances.length > 0 && (React.createElement("section", { "aria-labelledby": "edition-instances-heading", className: "rounded-xl border border-gray-200 bg-white p-5" },
1124
- React.createElement("div", { className: "flex items-center justify-between gap-3" },
1125
- React.createElement("h4", { id: "edition-instances-heading", className: "text-sm font-semibold text-gray-900" }, "Instances on this license"),
1126
- React.createElement("span", { className: "shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium tabular-nums text-gray-600" },
1127
- licenseInstances.length,
1128
- " ",
1129
- licenseInstances.length === 1
1130
- ? "instance"
1131
- : "instances")),
1132
- React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-gray-500" }, "Use the same license key on every instance you deploy (staging, production, and so on). Each instance reports its usage and the version it runs once a day."),
1133
- licenseInstances.length > 1 && (React.createElement("p", { className: "mt-1.5 text-xs leading-relaxed text-gray-500" }, instanceOverlapText)),
1134
- React.createElement("ul", { className: "mt-3 divide-y divide-gray-100 overflow-hidden rounded-lg border border-gray-200" }, licenseInstances.map((instance, index) => {
1135
- const isThisInstance = Boolean(thisInstanceId) &&
1136
- instance.instanceId === thisInstanceId;
1137
- /*
1138
- * The list is a snapshot of what each instance last
1139
- * reported, refreshed at most once a day. For the
1140
- * instance serving this page the server just told us
1141
- * what it is running right now, so prefer that —
1142
- * otherwise this row contradicts the "This
1143
- * installation" card above it for up to a day after
1144
- * an upgrade. hasComparableVersion keeps a dev build
1145
- * from rendering "vunknown".
1146
- */
1147
- const displayVersion = isThisInstance && hasComparableVersion
1148
- ? currentVersion
1149
- : instance.version;
1150
- /*
1151
- * Per-instance, so an admin can see which of their
1152
- * deployments are lagging rather than only the one
1153
- * they happen to be signed in to.
1154
- */
1155
- const isInstanceOutdated = VersionUtil.isUpdateAvailable({
1156
- currentVersion: displayVersion,
1157
- latestVersion: latestVersion,
1158
- });
1159
- return (React.createElement("li", { key: instance.instanceId || index, className: "flex items-center justify-between gap-4 bg-white px-3 py-2.5 transition-colors hover:bg-gray-50" },
1160
- React.createElement("div", { className: "min-w-0 flex-1" },
1161
- React.createElement("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1" },
1162
- React.createElement("span", { className: "min-w-0 max-w-full truncate text-sm font-medium text-gray-900", title: instance.host || "Unknown host" }, instance.host || "Unknown host"),
1163
- isThisInstance && (React.createElement("span", { className: "shrink-0 rounded-full bg-indigo-50 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-indigo-700" }, "This instance")),
1164
- displayVersion && (React.createElement("span", { className: `shrink-0 rounded-full px-1.5 py-0.5 text-[10px] font-medium tabular-nums ${isInstanceOutdated
1165
- ? "bg-amber-50 text-amber-800"
1166
- : "bg-gray-100 text-gray-600"}`, title: isInstanceOutdated
1167
- ? `Running v${displayVersion}. OneUptime v${latestVersion} is available.`
1168
- : `Running v${displayVersion}.` },
1169
- "v",
1170
- displayVersion))),
1171
- React.createElement("p", { className: "mt-0.5 truncate text-xs text-gray-500" },
1172
- formatInstanceReportedAt(instance.lastReportedAt),
1173
- isInstanceOutdated
1174
- ? " Update available."
1175
- : "")),
1176
- React.createElement("div", { className: "flex shrink-0 items-baseline justify-end gap-1" }, typeof instance.userCount === "number" ? (React.createElement(React.Fragment, null,
1177
- React.createElement("span", { className: "text-sm font-medium tabular-nums text-gray-900" }, instance.userCount.toLocaleString()),
1178
- React.createElement("span", { className: "text-xs text-gray-500" }, instance.userCount === 1
1179
- ? "user"
1180
- : "users"))) : (React.createElement("span", { className: "text-sm text-gray-400" }, "\u2014")))));
1181
- })))),
1182
- !configError &&
1183
- !isConfigLoading &&
1184
- !licenseValid &&
1185
- (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enterpriseLicenseKey) && (React.createElement("div", { className: "rounded-xl border border-red-200 bg-red-50 p-4" },
1186
- React.createElement("p", { className: "text-sm font-semibold text-red-900" }, "License validation required"),
1187
- React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-red-800" }, "The stored license information could not be verified. Please validate the license key again."))),
1011
+ parts.usage,
1188
1012
  showLicenseAdminRequiredNotice && (React.createElement("section", { className: "rounded-xl border border-amber-200 bg-amber-50 p-5" },
1189
1013
  React.createElement("h4", { className: "text-sm font-semibold text-amber-900" }, "A master admin has to activate this license"),
1190
1014
  React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-amber-800" }, "This installation does not have a valid enterprise license. Ask a master admin of this OneUptime installation to enter or refresh the license key from this dialog."))),
1191
- !configError && showLicenseKeyInput && (React.createElement("section", { className: "rounded-xl border border-gray-200 bg-white p-5" },
1192
- React.createElement("div", { className: "flex items-start justify-between gap-4" },
1193
- React.createElement("div", { className: "min-w-0" },
1194
- React.createElement("label", { htmlFor: "enterprise-license-key", className: "text-sm font-semibold text-gray-900" }, isChangingLicense
1195
- ? "New license key"
1196
- : "License key"),
1197
- React.createElement("p", { className: "mt-0.5 text-xs leading-relaxed text-gray-500" },
1198
- licenseKeyHelperText,
1199
- !isChangingLicense && (React.createElement(React.Fragment, null,
1200
- " ",
1201
- React.createElement("a", { href: SALES_MAILTO_URL, className: "font-medium text-indigo-600 hover:text-indigo-700" }, SALES_EMAIL),
1202
- ".")))),
1203
- isChangingLicense && (React.createElement(Button, { title: "Cancel", buttonStyle: ButtonStyleType.NORMAL, onClick: handleCancelChangingLicense, className: "!mt-0 shrink-0 md:!ml-0" }))),
1204
- React.createElement("div", { className: "mt-3" },
1205
- React.createElement(Input, { id: "enterprise-license-key", value: licenseKeyInput, onChange: (value) => {
1206
- setLicenseKeyInput(value);
1207
- licenseInputEditedRef.current = true;
1208
- }, placeholder: "Enter your enterprise license key", disableSpellCheck: true })),
1209
- validationError && (React.createElement("div", { className: "mt-3" },
1210
- React.createElement(Alert, { type: AlertType.DANGER, title: validationError }))))),
1015
+ parts.activation,
1211
1016
  showEnterpriseFeatureList && (React.createElement("section", { "aria-labelledby": "edition-features-heading", className: "rounded-xl border border-indigo-100 bg-gradient-to-br from-indigo-50 via-white to-white p-5" },
1212
1017
  React.createElement("h4", { id: "edition-features-heading", className: "text-sm font-semibold text-indigo-900" }, "What your license unlocks"),
1213
- React.createElement("p", { className: "mt-0.5 text-xs text-indigo-700" }, canManageLicense
1214
- ? "Validate your key above to turn these on immediately."
1215
- : "A master admin can activate the license to turn these on."),
1018
+ React.createElement("p", { className: "mt-0.5 text-xs text-indigo-700" },
1019
+ canManageLicense
1020
+ ? "A valid license that includes them keeps single sign-on, SCIM provisioning and audit logging running, enterprise configuration (SSO, SCIM, team compliance, audit log settings) editable and the enterprise admin dashboards unlocked."
1021
+ : "A master admin can add the license to keep single sign-on, SCIM provisioning and audit logging running and enterprise configuration editable.",
1022
+ " ",
1023
+ "Core monitoring never depends on it."),
1216
1024
  React.createElement("ul", { className: "mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2" }, enterpriseFeatures.map((feature, index) => {
1217
1025
  return (React.createElement("li", { key: index, className: "flex items-start gap-2 rounded-lg border border-gray-100 bg-white px-3 py-2.5" },
1218
1026
  React.createElement("span", { className: "mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-indigo-50" },
1219
1027
  React.createElement(Icon, { icon: IconProp.Check, className: "h-3 w-3 text-indigo-600" })),
1220
1028
  React.createElement("span", { className: "text-xs leading-snug text-gray-700" }, feature)));
1221
1029
  })))))) : (React.createElement(React.Fragment, null,
1030
+ showEditionMismatchNotice && (React.createElement("section", { role: "alert", "data-testid": "enterprise-edition-image-mismatch", className: "rounded-xl border border-amber-200 bg-amber-50 p-5" },
1031
+ React.createElement("h4", { className: "text-sm font-semibold text-amber-900" }, "This is the Community Edition image"),
1032
+ React.createElement("p", { className: "mt-1 text-xs leading-relaxed text-amber-800" }, "IS_ENTERPRISE_EDITION is set but this is the Community Edition image \u2014 switch to the enterprise image (the enterprise-* image tags) to use Enterprise Edition features. Until then they are off; everything else keeps working."))),
1222
1033
  versionCardElement,
1223
1034
  React.createElement("p", null, "You are running the Community Edition of OneUptime. Here is a quick comparison to help you decide if Enterprise is the right fit for your team."),
1224
1035
  React.createElement("div", { className: "grid gap-4 md:grid-cols-2" },
@@ -1238,7 +1049,25 @@ const EditionLabel = (props) => {
1238
1049
  React.createElement("span", { className: "leading-snug" }, feature)));
1239
1050
  })),
1240
1051
  React.createElement("p", { className: "mt-3 text-xs text-indigo-700" }, "Everything in Community plus white-glove onboarding, enterprise SLAs, and a partner dedicated to your reliability goals."))),
1241
- React.createElement("p", { className: "text-xs text-gray-500" }, "Ready to unlock enterprise capabilities? Click \"Talk to Sales\" to start the conversation."))))))));
1052
+ React.createElement("p", { className: "text-xs text-gray-500" }, "Ready to unlock enterprise capabilities? Click \"Talk to Sales\" to start the conversation."))))));
1053
+ };
1054
+ /*
1055
+ * Kept after every hook: oneuptime.com (billing enabled) bounds seats and
1056
+ * plans through subscriptions and shows no edition pill at all.
1057
+ */
1058
+ if (BILLING_ENABLED) {
1059
+ return React.createElement(React.Fragment, null);
1060
+ }
1061
+ return (React.createElement(React.Fragment, null,
1062
+ React.createElement("button", { type: "button", onClick: openDialog, className: `${pillClassName} ${props.className ? props.className : ""}`, "aria-label": `${editionName}${showEvaluationTag ? ", Evaluation" : ""}, ${ctaLabel}` },
1063
+ pillTone !== "normal" && (React.createElement(Icon, { icon: pillTone === "alerted"
1064
+ ? IconProp.Alert
1065
+ : IconProp.ExclaimationCircle, className: `h-3 w-3 ${pillTone === "alerted" ? "text-red-600" : "text-amber-600"}` })),
1066
+ React.createElement("span", { className: `h-2 w-2 rounded-full transition group-hover:scale-110 ${indicatorColor}` }),
1067
+ React.createElement("span", { className: "tracking-wide" }, editionName),
1068
+ showEvaluationTag && (React.createElement("span", { className: "inline-flex items-center rounded-full bg-violet-100 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-violet-700" }, "Evaluation")),
1069
+ React.createElement("span", { className: pillCtaTextClassName }, ctaLabel)),
1070
+ LicenseManager ? (React.createElement(LicenseManager, { license: licenseSnapshot, isDialogOpen: isDialogOpen, reloadLicense: fetchGlobalConfig, applySeatEnforcement: applySeatEnforcementPayload, renderDialog: renderDialog })) : (renderDialog({}))));
1242
1071
  };
1243
1072
  export default EditionLabel;
1244
1073
  //# sourceMappingURL=EditionLabel.js.map