unleash-server 7.2.3 → 7.4.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 (1324) hide show
  1. package/README.md +33 -33
  2. package/dist/lib/addons/datadog.js +1 -1
  3. package/dist/lib/addons/datadog.js.map +1 -1
  4. package/dist/lib/addons/datadog.test.js +11 -11
  5. package/dist/lib/addons/datadog.test.js.map +1 -1
  6. package/dist/lib/addons/feature-event-formatter-md-events.d.ts.map +1 -1
  7. package/dist/lib/addons/feature-event-formatter-md-events.js +11 -1
  8. package/dist/lib/addons/feature-event-formatter-md-events.js.map +1 -1
  9. package/dist/lib/addons/feature-event-formatter-md.test.js +8 -6
  10. package/dist/lib/addons/feature-event-formatter-md.test.js.map +1 -1
  11. package/dist/lib/addons/new-relic-definition.js +1 -1
  12. package/dist/lib/addons/new-relic-definition.js.map +1 -1
  13. package/dist/lib/addons/new-relic.js +4 -4
  14. package/dist/lib/addons/new-relic.js.map +1 -1
  15. package/dist/lib/addons/new-relic.test.js +4 -4
  16. package/dist/lib/addons/new-relic.test.js.map +1 -1
  17. package/dist/lib/addons/slack-app-definition.d.ts.map +1 -1
  18. package/dist/lib/addons/slack-app-definition.js +3 -1
  19. package/dist/lib/addons/slack-app-definition.js.map +1 -1
  20. package/dist/lib/addons/slack-app.test.js +1 -2
  21. package/dist/lib/addons/slack-app.test.js.map +1 -1
  22. package/dist/lib/addons/slack.js +1 -1
  23. package/dist/lib/addons/slack.js.map +1 -1
  24. package/dist/lib/addons/slack.test.js +1 -1
  25. package/dist/lib/addons/slack.test.js.map +1 -1
  26. package/dist/lib/addons/teams-definition.d.ts.map +1 -1
  27. package/dist/lib/addons/teams-definition.js +3 -1
  28. package/dist/lib/addons/teams-definition.js.map +1 -1
  29. package/dist/lib/addons/teams.js +1 -1
  30. package/dist/lib/addons/teams.js.map +1 -1
  31. package/dist/lib/addons/teams.test.js +1 -1
  32. package/dist/lib/addons/teams.test.js.map +1 -1
  33. package/dist/lib/addons/webhook-definition.d.ts.map +1 -1
  34. package/dist/lib/addons/webhook-definition.js +4 -2
  35. package/dist/lib/addons/webhook-definition.js.map +1 -1
  36. package/dist/lib/addons/webhook.js +1 -1
  37. package/dist/lib/addons/webhook.js.map +1 -1
  38. package/dist/lib/addons/webhook.test.js +3 -3
  39. package/dist/lib/addons/webhook.test.js.map +1 -1
  40. package/dist/lib/app.js +2 -2
  41. package/dist/lib/app.js.map +1 -1
  42. package/dist/lib/app.test.js +2 -2
  43. package/dist/lib/app.test.js.map +1 -1
  44. package/dist/lib/create-config.d.ts.map +1 -1
  45. package/dist/lib/create-config.js +8 -0
  46. package/dist/lib/create-config.js.map +1 -1
  47. package/dist/lib/create-config.test.js +9 -2
  48. package/dist/lib/create-config.test.js.map +1 -1
  49. package/dist/lib/db/access-store.d.ts +1 -2
  50. package/dist/lib/db/access-store.d.ts.map +1 -1
  51. package/dist/lib/db/access-store.js +2 -3
  52. package/dist/lib/db/access-store.js.map +1 -1
  53. package/dist/lib/db/access-store.test.js +5 -1
  54. package/dist/lib/db/access-store.test.js.map +1 -1
  55. package/dist/lib/db/api-token-store.d.ts +1 -2
  56. package/dist/lib/db/api-token-store.d.ts.map +1 -1
  57. package/dist/lib/db/api-token-store.js +1 -2
  58. package/dist/lib/db/api-token-store.js.map +1 -1
  59. package/dist/lib/db/client-applications-store.d.ts.map +1 -1
  60. package/dist/lib/db/client-applications-store.js +32 -2
  61. package/dist/lib/db/client-applications-store.js.map +1 -1
  62. package/dist/lib/db/favorite-features-store.d.ts +1 -3
  63. package/dist/lib/db/favorite-features-store.d.ts.map +1 -1
  64. package/dist/lib/db/favorite-features-store.js +1 -3
  65. package/dist/lib/db/favorite-features-store.js.map +1 -1
  66. package/dist/lib/db/favorite-projects-store.d.ts +2 -3
  67. package/dist/lib/db/favorite-projects-store.d.ts.map +1 -1
  68. package/dist/lib/db/favorite-projects-store.js +20 -4
  69. package/dist/lib/db/favorite-projects-store.js.map +1 -1
  70. package/dist/lib/db/feature-environment-store.d.ts +1 -2
  71. package/dist/lib/db/feature-environment-store.d.ts.map +1 -1
  72. package/dist/lib/db/feature-environment-store.js +1 -2
  73. package/dist/lib/db/feature-environment-store.js.map +1 -1
  74. package/dist/lib/db/feature-type-store.d.ts +1 -2
  75. package/dist/lib/db/feature-type-store.d.ts.map +1 -1
  76. package/dist/lib/db/feature-type-store.js +1 -2
  77. package/dist/lib/db/feature-type-store.js.map +1 -1
  78. package/dist/lib/db/project-stats-store.d.ts +1 -2
  79. package/dist/lib/db/project-stats-store.d.ts.map +1 -1
  80. package/dist/lib/db/project-stats-store.js +1 -2
  81. package/dist/lib/db/project-stats-store.js.map +1 -1
  82. package/dist/lib/db/public-signup-token-store.d.ts +1 -2
  83. package/dist/lib/db/public-signup-token-store.d.ts.map +1 -1
  84. package/dist/lib/db/public-signup-token-store.js +1 -2
  85. package/dist/lib/db/public-signup-token-store.js.map +1 -1
  86. package/dist/lib/db/reset-token-store.d.ts +2 -3
  87. package/dist/lib/db/reset-token-store.d.ts.map +1 -1
  88. package/dist/lib/db/reset-token-store.js +31 -6
  89. package/dist/lib/db/reset-token-store.js.map +1 -1
  90. package/dist/lib/db/user-feedback-store.d.ts +1 -1
  91. package/dist/lib/db/user-feedback-store.d.ts.map +1 -1
  92. package/dist/lib/db/user-feedback-store.js +1 -1
  93. package/dist/lib/db/user-feedback-store.js.map +1 -1
  94. package/dist/lib/db/user-splash-store.d.ts +1 -1
  95. package/dist/lib/db/user-splash-store.d.ts.map +1 -1
  96. package/dist/lib/db/user-splash-store.js +1 -1
  97. package/dist/lib/db/user-splash-store.js.map +1 -1
  98. package/dist/lib/default-custom-auth-deny-all.js +1 -1
  99. package/dist/lib/default-custom-auth-deny-all.js.map +1 -1
  100. package/dist/lib/domain/project-health/project-health.js +1 -1
  101. package/dist/lib/domain/project-health/project-health.js.map +1 -1
  102. package/dist/lib/error/unleash-error.test.js +4 -1
  103. package/dist/lib/error/unleash-error.test.js.map +1 -1
  104. package/dist/lib/events/index.d.ts +6 -1
  105. package/dist/lib/events/index.d.ts.map +1 -1
  106. package/dist/lib/events/index.js +10 -0
  107. package/dist/lib/events/index.js.map +1 -1
  108. package/dist/lib/features/access/createAccessService.d.ts +5 -1
  109. package/dist/lib/features/access/createAccessService.d.ts.map +1 -1
  110. package/dist/lib/features/access/createAccessService.js +2 -2
  111. package/dist/lib/features/access/createAccessService.js.map +1 -1
  112. package/dist/lib/features/change-request-segment-usage-service/change-request-segment-usage-read-model.test.js.map +1 -1
  113. package/dist/lib/features/client-feature-toggles/client-feature-toggle-service.d.ts +1 -2
  114. package/dist/lib/features/client-feature-toggles/client-feature-toggle-service.d.ts.map +1 -1
  115. package/dist/lib/features/client-feature-toggles/client-feature-toggle-service.js +1 -2
  116. package/dist/lib/features/client-feature-toggles/client-feature-toggle-service.js.map +1 -1
  117. package/dist/lib/features/client-feature-toggles/client-feature-toggle.controller.d.ts.map +1 -1
  118. package/dist/lib/features/client-feature-toggles/client-feature-toggle.controller.js +4 -2
  119. package/dist/lib/features/client-feature-toggles/client-feature-toggle.controller.js.map +1 -1
  120. package/dist/lib/features/client-feature-toggles/delta/delta-cache.test.js +1 -1
  121. package/dist/lib/features/client-feature-toggles/delta/delta-cache.test.js.map +1 -1
  122. package/dist/lib/features/client-feature-toggles/tests/client-feature-toggles.e2e.test.js +1 -1
  123. package/dist/lib/features/client-feature-toggles/tests/client-feature-toggles.e2e.test.js.map +1 -1
  124. package/dist/lib/features/context/context-field-store.d.ts +1 -3
  125. package/dist/lib/features/context/context-field-store.d.ts.map +1 -1
  126. package/dist/lib/features/context/context-field-store.js +1 -3
  127. package/dist/lib/features/context/context-field-store.js.map +1 -1
  128. package/dist/lib/features/context/context-service.d.ts +1 -3
  129. package/dist/lib/features/context/context-service.d.ts.map +1 -1
  130. package/dist/lib/features/context/context-service.js +2 -4
  131. package/dist/lib/features/context/context-service.js.map +1 -1
  132. package/dist/lib/features/context/context.d.ts +1 -2
  133. package/dist/lib/features/context/context.d.ts.map +1 -1
  134. package/dist/lib/features/context/context.js +5 -6
  135. package/dist/lib/features/context/context.js.map +1 -1
  136. package/dist/lib/features/dependent-features/fake-dependent-features-read-model.d.ts +1 -1
  137. package/dist/lib/features/dependent-features/fake-dependent-features-read-model.d.ts.map +1 -1
  138. package/dist/lib/features/dependent-features/fake-dependent-features-read-model.js +1 -1
  139. package/dist/lib/features/dependent-features/fake-dependent-features-read-model.js.map +1 -1
  140. package/dist/lib/features/environments/environments-controller.d.ts +1 -2
  141. package/dist/lib/features/environments/environments-controller.d.ts.map +1 -1
  142. package/dist/lib/features/environments/environments-controller.js +2 -3
  143. package/dist/lib/features/environments/environments-controller.js.map +1 -1
  144. package/dist/lib/features/events/event-created-by-migration.test.js +3 -3
  145. package/dist/lib/features/events/event-created-by-migration.test.js.map +1 -1
  146. package/dist/lib/features/events/event-search-controller.js +1 -1
  147. package/dist/lib/features/events/event-search-controller.js.map +1 -1
  148. package/dist/lib/features/events/event-service.test.js.map +1 -1
  149. package/dist/lib/features/events/event-store.d.ts.map +1 -1
  150. package/dist/lib/features/events/event-store.js +8 -6
  151. package/dist/lib/features/events/event-store.js.map +1 -1
  152. package/dist/lib/features/export-import-toggles/export-import-api-usage.test.js +1 -1
  153. package/dist/lib/features/export-import-toggles/export-import-api-usage.test.js.map +1 -1
  154. package/dist/lib/features/export-import-toggles/export-import-controller.d.ts +0 -1
  155. package/dist/lib/features/export-import-toggles/export-import-controller.d.ts.map +1 -1
  156. package/dist/lib/features/export-import-toggles/export-import-controller.js +5 -6
  157. package/dist/lib/features/export-import-toggles/export-import-controller.js.map +1 -1
  158. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-read-model.d.ts +1 -1
  159. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-read-model.d.ts.map +1 -1
  160. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-read-model.js +1 -1
  161. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-read-model.js.map +1 -1
  162. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-store.js +1 -1
  163. package/dist/lib/features/feature-lifecycle/fake-feature-lifecycle-store.js.map +1 -1
  164. package/dist/lib/features/feature-lifecycle/feature-lifecycle-store.d.ts.map +1 -1
  165. package/dist/lib/features/feature-lifecycle/feature-lifecycle-store.js +3 -2
  166. package/dist/lib/features/feature-lifecycle/feature-lifecycle-store.js.map +1 -1
  167. package/dist/lib/features/feature-lifecycle/feature-lifecycle.e2e.test.js +4 -1
  168. package/dist/lib/features/feature-lifecycle/feature-lifecycle.e2e.test.js.map +1 -1
  169. package/dist/lib/features/feature-links/fake-feature-links-read-model.d.ts +1 -1
  170. package/dist/lib/features/feature-links/fake-feature-links-read-model.d.ts.map +1 -1
  171. package/dist/lib/features/feature-links/fake-feature-links-read-model.js +1 -1
  172. package/dist/lib/features/feature-links/fake-feature-links-read-model.js.map +1 -1
  173. package/dist/lib/features/feature-links/feature-link-service.js +2 -2
  174. package/dist/lib/features/feature-links/feature-link-service.js.map +1 -1
  175. package/dist/lib/features/feature-naming-pattern/feature-naming-validation.test.js +10 -2
  176. package/dist/lib/features/feature-naming-pattern/feature-naming-validation.test.js.map +1 -1
  177. package/dist/lib/features/feature-search/fake-feature-search-store.d.ts +1 -1
  178. package/dist/lib/features/feature-search/fake-feature-search-store.d.ts.map +1 -1
  179. package/dist/lib/features/feature-search/fake-feature-search-store.js +1 -1
  180. package/dist/lib/features/feature-search/fake-feature-search-store.js.map +1 -1
  181. package/dist/lib/features/feature-search/feature-search-service.d.ts +1 -2
  182. package/dist/lib/features/feature-search/feature-search-service.d.ts.map +1 -1
  183. package/dist/lib/features/feature-search/feature-search-service.js +1 -2
  184. package/dist/lib/features/feature-search/feature-search-service.js.map +1 -1
  185. package/dist/lib/features/feature-search/feature-search-store.d.ts +1 -3
  186. package/dist/lib/features/feature-search/feature-search-store.d.ts.map +1 -1
  187. package/dist/lib/features/feature-search/feature-search-store.js +1 -3
  188. package/dist/lib/features/feature-search/feature-search-store.js.map +1 -1
  189. package/dist/lib/features/feature-search/feature.search.e2e.test.js +1 -1
  190. package/dist/lib/features/feature-search/feature.search.e2e.test.js.map +1 -1
  191. package/dist/lib/features/feature-toggle/archive-feature-toggle-controller.js +1 -1
  192. package/dist/lib/features/feature-toggle/archive-feature-toggle-controller.js.map +1 -1
  193. package/dist/lib/features/feature-toggle/converters/feature-toggle-row-converter.d.ts +3 -4
  194. package/dist/lib/features/feature-toggle/converters/feature-toggle-row-converter.d.ts.map +1 -1
  195. package/dist/lib/features/feature-toggle/converters/feature-toggle-row-converter.js +2 -3
  196. package/dist/lib/features/feature-toggle/converters/feature-toggle-row-converter.js.map +1 -1
  197. package/dist/lib/features/feature-toggle/createFeatureToggleService.d.ts.map +1 -1
  198. package/dist/lib/features/feature-toggle/createFeatureToggleService.js +1 -12
  199. package/dist/lib/features/feature-toggle/createFeatureToggleService.js.map +1 -1
  200. package/dist/lib/features/feature-toggle/fake-feature-collaborators-read-model.d.ts +1 -1
  201. package/dist/lib/features/feature-toggle/fake-feature-collaborators-read-model.d.ts.map +1 -1
  202. package/dist/lib/features/feature-toggle/fake-feature-collaborators-read-model.js +1 -1
  203. package/dist/lib/features/feature-toggle/fake-feature-collaborators-read-model.js.map +1 -1
  204. package/dist/lib/features/feature-toggle/fakes/fake-feature-strategies-store.d.ts +5 -5
  205. package/dist/lib/features/feature-toggle/fakes/fake-feature-strategies-store.d.ts.map +1 -1
  206. package/dist/lib/features/feature-toggle/fakes/fake-feature-strategies-store.js +6 -6
  207. package/dist/lib/features/feature-toggle/fakes/fake-feature-strategies-store.js.map +1 -1
  208. package/dist/lib/features/feature-toggle/fakes/fake-feature-toggle-store.d.ts +8 -8
  209. package/dist/lib/features/feature-toggle/fakes/fake-feature-toggle-store.d.ts.map +1 -1
  210. package/dist/lib/features/feature-toggle/fakes/fake-feature-toggle-store.js +10 -12
  211. package/dist/lib/features/feature-toggle/fakes/fake-feature-toggle-store.js.map +1 -1
  212. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts +1 -1
  213. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts.map +1 -1
  214. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js +1 -1
  215. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js.map +1 -1
  216. package/dist/lib/features/feature-toggle/feature-toggle-controller.d.ts.map +1 -1
  217. package/dist/lib/features/feature-toggle/feature-toggle-controller.js +4 -3
  218. package/dist/lib/features/feature-toggle/feature-toggle-controller.js.map +1 -1
  219. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts +3 -10
  220. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
  221. package/dist/lib/features/feature-toggle/feature-toggle-service.js +10 -26
  222. package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
  223. package/dist/lib/features/feature-toggle/feature-toggle-store.d.ts.map +1 -1
  224. package/dist/lib/features/feature-toggle/feature-toggle-store.js +7 -3
  225. package/dist/lib/features/feature-toggle/feature-toggle-store.js.map +1 -1
  226. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.d.ts +1 -3
  227. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.d.ts.map +1 -1
  228. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js +1 -3
  229. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js.map +1 -1
  230. package/dist/lib/features/feature-toggle/legacy/feature-toggle-legacy-controller.d.ts +0 -1
  231. package/dist/lib/features/feature-toggle/legacy/feature-toggle-legacy-controller.d.ts.map +1 -1
  232. package/dist/lib/features/feature-toggle/legacy/feature-toggle-legacy-controller.js +0 -1
  233. package/dist/lib/features/feature-toggle/legacy/feature-toggle-legacy-controller.js.map +1 -1
  234. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js +1 -1
  235. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js.map +1 -1
  236. package/dist/lib/features/feature-toggle/tests/feature-toggle-store.e2e.test.js +1 -1
  237. package/dist/lib/features/feature-toggle/tests/feature-toggle-store.e2e.test.js.map +1 -1
  238. package/dist/lib/features/feature-toggle/tests/feature-toggle-strategies-store.e2e.test.js +2 -2
  239. package/dist/lib/features/feature-toggle/tests/feature-toggle-strategies-store.e2e.test.js.map +1 -1
  240. package/dist/lib/features/feature-toggle/tests/feature-toggles.e2e.test.js +3 -3
  241. package/dist/lib/features/feature-toggle/tests/feature-toggles.e2e.test.js.map +1 -1
  242. package/dist/lib/features/frontend-api/frontend-api-controller.js +2 -2
  243. package/dist/lib/features/frontend-api/frontend-api-controller.js.map +1 -1
  244. package/dist/lib/features/frontend-api/frontend-api-repository.d.ts +1 -3
  245. package/dist/lib/features/frontend-api/frontend-api-repository.d.ts.map +1 -1
  246. package/dist/lib/features/frontend-api/frontend-api-repository.js +6 -6
  247. package/dist/lib/features/frontend-api/frontend-api-repository.js.map +1 -1
  248. package/dist/lib/features/frontend-api/frontend-api-service.d.ts.map +1 -1
  249. package/dist/lib/features/frontend-api/frontend-api-service.js +3 -1
  250. package/dist/lib/features/frontend-api/frontend-api-service.js.map +1 -1
  251. package/dist/lib/features/frontend-api/frontend-api-service.test.js +2 -2
  252. package/dist/lib/features/frontend-api/frontend-api.concurrency.e2e.test.js +1 -1
  253. package/dist/lib/features/frontend-api/frontend-api.concurrency.e2e.test.js.map +1 -1
  254. package/dist/lib/features/frontend-api/global-frontend-api-cache.d.ts +0 -2
  255. package/dist/lib/features/frontend-api/global-frontend-api-cache.d.ts.map +1 -1
  256. package/dist/lib/features/frontend-api/global-frontend-api-cache.js +0 -7
  257. package/dist/lib/features/frontend-api/global-frontend-api-cache.js.map +1 -1
  258. package/dist/lib/features/frontend-api/proxy-repository.js +1 -1
  259. package/dist/lib/features/frontend-api/proxy-repository.js.map +1 -1
  260. package/dist/lib/features/instance-stats/createInstanceStatsService.d.ts.map +1 -1
  261. package/dist/lib/features/instance-stats/createInstanceStatsService.js +8 -2
  262. package/dist/lib/features/instance-stats/createInstanceStatsService.js.map +1 -1
  263. package/dist/lib/features/instance-stats/getEdgeInstances.d.ts +6 -0
  264. package/dist/lib/features/instance-stats/getEdgeInstances.d.ts.map +1 -0
  265. package/dist/lib/features/instance-stats/getEdgeInstances.e2e.test.d.ts +2 -0
  266. package/dist/lib/features/instance-stats/getEdgeInstances.e2e.test.d.ts.map +1 -0
  267. package/dist/lib/features/instance-stats/getEdgeInstances.e2e.test.js +146 -0
  268. package/dist/lib/features/instance-stats/getEdgeInstances.e2e.test.js.map +1 -0
  269. package/dist/lib/features/instance-stats/getEdgeInstances.js +48 -0
  270. package/dist/lib/features/instance-stats/getEdgeInstances.js.map +1 -0
  271. package/dist/lib/features/instance-stats/getProductionChanges.e2e.test.js +2 -2
  272. package/dist/lib/features/instance-stats/getProductionChanges.e2e.test.js.map +1 -1
  273. package/dist/lib/features/instance-stats/getReadOnlyUsers.d.ts +5 -0
  274. package/dist/lib/features/instance-stats/getReadOnlyUsers.d.ts.map +1 -0
  275. package/dist/lib/features/instance-stats/getReadOnlyUsers.e2e.test.d.ts +2 -0
  276. package/dist/lib/features/instance-stats/getReadOnlyUsers.e2e.test.d.ts.map +1 -0
  277. package/dist/lib/features/instance-stats/getReadOnlyUsers.e2e.test.js +36 -0
  278. package/dist/lib/features/instance-stats/getReadOnlyUsers.e2e.test.js.map +1 -0
  279. package/dist/lib/features/instance-stats/getReadOnlyUsers.js +24 -0
  280. package/dist/lib/features/instance-stats/getReadOnlyUsers.js.map +1 -0
  281. package/dist/lib/features/instance-stats/instance-stats-service.d.ts +6 -2
  282. package/dist/lib/features/instance-stats/instance-stats-service.d.ts.map +1 -1
  283. package/dist/lib/features/instance-stats/instance-stats-service.js +9 -4
  284. package/dist/lib/features/instance-stats/instance-stats-service.js.map +1 -1
  285. package/dist/lib/features/instance-stats/instance-stats-service.test.js +9 -6
  286. package/dist/lib/features/instance-stats/instance-stats-service.test.js.map +1 -1
  287. package/dist/lib/features/integration-events/integration-events-service.d.ts +1 -3
  288. package/dist/lib/features/integration-events/integration-events-service.d.ts.map +1 -1
  289. package/dist/lib/features/integration-events/integration-events-service.js +1 -3
  290. package/dist/lib/features/integration-events/integration-events-service.js.map +1 -1
  291. package/dist/lib/features/maintenance/maintenance-controller.d.ts +1 -1
  292. package/dist/lib/features/maintenance/maintenance-controller.d.ts.map +1 -1
  293. package/dist/lib/features/maintenance/maintenance-controller.js +1 -1
  294. package/dist/lib/features/maintenance/maintenance-controller.js.map +1 -1
  295. package/dist/lib/features/maintenance/maintenance-service.js +1 -1
  296. package/dist/lib/features/maintenance/maintenance-service.js.map +1 -1
  297. package/dist/lib/features/metrics/client-metrics/client-metrics-service.e2e.test.js +10 -10
  298. package/dist/lib/features/metrics/client-metrics/client-metrics-service.e2e.test.js.map +1 -1
  299. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.d.ts +1 -3
  300. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.d.ts.map +1 -1
  301. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.js +2 -4
  302. package/dist/lib/features/metrics/client-metrics/client-metrics-store-v2.js.map +1 -1
  303. package/dist/lib/features/metrics/client-metrics/client-metrics.d.ts +0 -1
  304. package/dist/lib/features/metrics/client-metrics/client-metrics.d.ts.map +1 -1
  305. package/dist/lib/features/metrics/client-metrics/client-metrics.js +0 -1
  306. package/dist/lib/features/metrics/client-metrics/client-metrics.js.map +1 -1
  307. package/dist/lib/features/metrics/client-metrics/fake-client-metrics-store-v2.d.ts +10 -10
  308. package/dist/lib/features/metrics/client-metrics/fake-client-metrics-store-v2.d.ts.map +1 -1
  309. package/dist/lib/features/metrics/client-metrics/fake-client-metrics-store-v2.js +13 -11
  310. package/dist/lib/features/metrics/client-metrics/fake-client-metrics-store-v2.js.map +1 -1
  311. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts +1 -1
  312. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts.map +1 -1
  313. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js +3 -3
  314. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js.map +1 -1
  315. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.test.js +2 -2
  316. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.test.js.map +1 -1
  317. package/dist/lib/features/metrics/custom/custom-metrics-controller.d.ts +2 -2
  318. package/dist/lib/features/metrics/custom/custom-metrics-controller.d.ts.map +1 -1
  319. package/dist/lib/features/metrics/custom/custom-metrics-controller.js +2 -2
  320. package/dist/lib/features/metrics/custom/custom-metrics-controller.js.map +1 -1
  321. package/dist/lib/features/metrics/impact/metrics-translator.js +3 -1
  322. package/dist/lib/features/metrics/impact/metrics-translator.js.map +1 -1
  323. package/dist/lib/features/metrics/instance/instance-service.d.ts.map +1 -1
  324. package/dist/lib/features/metrics/instance/instance-service.js +1 -0
  325. package/dist/lib/features/metrics/instance/instance-service.js.map +1 -1
  326. package/dist/lib/features/metrics/instance/instance-service.test.js +2 -2
  327. package/dist/lib/features/metrics/instance/instance-service.test.js.map +1 -1
  328. package/dist/lib/features/metrics/instance/metrics.d.ts +1 -0
  329. package/dist/lib/features/metrics/instance/metrics.d.ts.map +1 -1
  330. package/dist/lib/features/metrics/instance/metrics.js +22 -6
  331. package/dist/lib/features/metrics/instance/metrics.js.map +1 -1
  332. package/dist/lib/features/metrics/last-seen/fake-last-seen-read-model.d.ts +1 -1
  333. package/dist/lib/features/metrics/last-seen/fake-last-seen-read-model.d.ts.map +1 -1
  334. package/dist/lib/features/metrics/last-seen/fake-last-seen-read-model.js +1 -1
  335. package/dist/lib/features/metrics/last-seen/fake-last-seen-read-model.js.map +1 -1
  336. package/dist/lib/features/metrics/shared/schema.test.js +0 -1
  337. package/dist/lib/features/metrics/shared/schema.test.js.map +1 -1
  338. package/dist/lib/features/metrics/sizes/fake-largest-resources-read-model.d.ts +2 -2
  339. package/dist/lib/features/metrics/sizes/fake-largest-resources-read-model.d.ts.map +1 -1
  340. package/dist/lib/features/metrics/sizes/fake-largest-resources-read-model.js +2 -2
  341. package/dist/lib/features/metrics/sizes/fake-largest-resources-read-model.js.map +1 -1
  342. package/dist/lib/features/metrics/unknown-flags/unknown-flags-service.d.ts +1 -2
  343. package/dist/lib/features/metrics/unknown-flags/unknown-flags-service.d.ts.map +1 -1
  344. package/dist/lib/features/metrics/unknown-flags/unknown-flags-service.js +1 -2
  345. package/dist/lib/features/metrics/unknown-flags/unknown-flags-service.js.map +1 -1
  346. package/dist/lib/features/onboarding/fake-onboarding-store.d.ts +2 -2
  347. package/dist/lib/features/onboarding/fake-onboarding-store.d.ts.map +1 -1
  348. package/dist/lib/features/onboarding/fake-onboarding-store.js +2 -2
  349. package/dist/lib/features/onboarding/fake-onboarding-store.js.map +1 -1
  350. package/dist/lib/features/onboarding/onboarding-service.d.ts +1 -3
  351. package/dist/lib/features/onboarding/onboarding-service.d.ts.map +1 -1
  352. package/dist/lib/features/onboarding/onboarding-service.js +2 -4
  353. package/dist/lib/features/onboarding/onboarding-service.js.map +1 -1
  354. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.d.ts +3 -3
  355. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.d.ts.map +1 -1
  356. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.js +3 -3
  357. package/dist/lib/features/personal-dashboard/fake-personal-dashboard-read-model.js.map +1 -1
  358. package/dist/lib/features/playground/feature-evaluator/constraint.js +1 -1
  359. package/dist/lib/features/playground/feature-evaluator/constraint.js.map +1 -1
  360. package/dist/lib/features/playground/feature-evaluator/repository/index.js +1 -1
  361. package/dist/lib/features/playground/feature-evaluator/repository/index.js.map +1 -1
  362. package/dist/lib/features/playground/feature-evaluator/strategy/gradual-rollout-random.d.ts +1 -1
  363. package/dist/lib/features/playground/feature-evaluator/strategy/gradual-rollout-random.d.ts.map +1 -1
  364. package/dist/lib/features/playground/feature-evaluator/strategy/gradual-rollout-random.js +1 -1
  365. package/dist/lib/features/playground/feature-evaluator/strategy/gradual-rollout-random.js.map +1 -1
  366. package/dist/lib/features/playground/feature-evaluator/strategy/remote-address-strategy.js +1 -1
  367. package/dist/lib/features/playground/feature-evaluator/strategy/remote-address-strategy.js.map +1 -1
  368. package/dist/lib/features/playground/feature-evaluator/strategy/strategy.d.ts +1 -1
  369. package/dist/lib/features/playground/feature-evaluator/strategy/strategy.d.ts.map +1 -1
  370. package/dist/lib/features/playground/feature-evaluator/strategy/strategy.js +1 -1
  371. package/dist/lib/features/playground/feature-evaluator/strategy/strategy.js.map +1 -1
  372. package/dist/lib/features/playground/feature-evaluator/strategy/unknown-strategy.d.ts +1 -1
  373. package/dist/lib/features/playground/feature-evaluator/strategy/unknown-strategy.d.ts.map +1 -1
  374. package/dist/lib/features/playground/feature-evaluator/strategy/unknown-strategy.js +1 -1
  375. package/dist/lib/features/playground/feature-evaluator/strategy/unknown-strategy.js.map +1 -1
  376. package/dist/lib/features/playground/offline-unleash-client.test.js +6 -2
  377. package/dist/lib/features/playground/offline-unleash-client.test.js.map +1 -1
  378. package/dist/lib/features/playground/playground-service.d.ts.map +1 -1
  379. package/dist/lib/features/playground/playground-service.js +3 -2
  380. package/dist/lib/features/playground/playground-service.js.map +1 -1
  381. package/dist/lib/features/playground/playground.test.js +1 -1
  382. package/dist/lib/features/playground/playground.test.js.map +1 -1
  383. package/dist/lib/features/private-project/fakePrivateProjectChecker.d.ts +3 -3
  384. package/dist/lib/features/private-project/fakePrivateProjectChecker.d.ts.map +1 -1
  385. package/dist/lib/features/private-project/fakePrivateProjectChecker.js +3 -3
  386. package/dist/lib/features/private-project/fakePrivateProjectChecker.js.map +1 -1
  387. package/dist/lib/features/private-project/privateProjectStore.d.ts +1 -2
  388. package/dist/lib/features/private-project/privateProjectStore.d.ts.map +1 -1
  389. package/dist/lib/features/private-project/privateProjectStore.js +1 -2
  390. package/dist/lib/features/private-project/privateProjectStore.js.map +1 -1
  391. package/dist/lib/features/project/fake-project-flag-creators-read-model.d.ts +1 -1
  392. package/dist/lib/features/project/fake-project-flag-creators-read-model.d.ts.map +1 -1
  393. package/dist/lib/features/project/fake-project-flag-creators-read-model.js +1 -1
  394. package/dist/lib/features/project/fake-project-flag-creators-read-model.js.map +1 -1
  395. package/dist/lib/features/project/project-controller.d.ts +1 -1
  396. package/dist/lib/features/project/project-controller.d.ts.map +1 -1
  397. package/dist/lib/features/project/project-controller.js +1 -1
  398. package/dist/lib/features/project/project-controller.js.map +1 -1
  399. package/dist/lib/features/project/project-read-model.d.ts +1 -2
  400. package/dist/lib/features/project/project-read-model.d.ts.map +1 -1
  401. package/dist/lib/features/project/project-read-model.js +1 -2
  402. package/dist/lib/features/project/project-read-model.js.map +1 -1
  403. package/dist/lib/features/project/project-service.e2e.test.js +10 -3
  404. package/dist/lib/features/project/project-service.e2e.test.js.map +1 -1
  405. package/dist/lib/features/project/project-store.d.ts +2 -3
  406. package/dist/lib/features/project/project-store.d.ts.map +1 -1
  407. package/dist/lib/features/project/project-store.js +43 -3
  408. package/dist/lib/features/project/project-store.js.map +1 -1
  409. package/dist/lib/features/project/projects.e2e.test.js +1 -1
  410. package/dist/lib/features/project/projects.e2e.test.js.map +1 -1
  411. package/dist/lib/features/project-environments/environment-service.d.ts +1 -0
  412. package/dist/lib/features/project-environments/environment-service.d.ts.map +1 -1
  413. package/dist/lib/features/project-environments/environment-service.js +4 -1
  414. package/dist/lib/features/project-environments/environment-service.js.map +1 -1
  415. package/dist/lib/features/project-environments/fake-environment-store.d.ts +3 -3
  416. package/dist/lib/features/project-environments/fake-environment-store.d.ts.map +1 -1
  417. package/dist/lib/features/project-environments/fake-environment-store.js +5 -5
  418. package/dist/lib/features/project-environments/fake-environment-store.js.map +1 -1
  419. package/dist/lib/features/project-insights/project-insights-service.e2e.test.js +1 -1
  420. package/dist/lib/features/project-insights/project-insights-service.e2e.test.js.map +1 -1
  421. package/dist/lib/features/project-status/projects-status.e2e.test.js +1 -1
  422. package/dist/lib/features/project-status/projects-status.e2e.test.js.map +1 -1
  423. package/dist/lib/features/scheduler/job-service.js +1 -1
  424. package/dist/lib/features/scheduler/job-service.js.map +1 -1
  425. package/dist/lib/features/scheduler/job-service.test.js +1 -1
  426. package/dist/lib/features/scheduler/job-service.test.js.map +1 -1
  427. package/dist/lib/features/scheduler/job-store.d.ts +0 -1
  428. package/dist/lib/features/scheduler/job-store.d.ts.map +1 -1
  429. package/dist/lib/features/scheduler/job-store.js +0 -1
  430. package/dist/lib/features/scheduler/job-store.js.map +1 -1
  431. package/dist/lib/features/scheduler/schedule-services.js +1 -1
  432. package/dist/lib/features/scheduler/schedule-services.js.map +1 -1
  433. package/dist/lib/features/segment/admin-segment.e2e.test.js +7 -25
  434. package/dist/lib/features/segment/admin-segment.e2e.test.js.map +1 -1
  435. package/dist/lib/features/segment/fake-segment-read-model.d.ts +2 -2
  436. package/dist/lib/features/segment/fake-segment-read-model.d.ts.map +1 -1
  437. package/dist/lib/features/segment/fake-segment-read-model.js +2 -2
  438. package/dist/lib/features/segment/fake-segment-read-model.js.map +1 -1
  439. package/dist/lib/features/segment/segment-controller.d.ts +1 -2
  440. package/dist/lib/features/segment/segment-controller.d.ts.map +1 -1
  441. package/dist/lib/features/segment/segment-controller.js +1 -2
  442. package/dist/lib/features/segment/segment-controller.js.map +1 -1
  443. package/dist/lib/features/segment/segment-service.d.ts +0 -1
  444. package/dist/lib/features/segment/segment-service.d.ts.map +1 -1
  445. package/dist/lib/features/segment/segment-service.js +0 -1
  446. package/dist/lib/features/segment/segment-service.js.map +1 -1
  447. package/dist/lib/features/tag-type/fake-tag-type-store.d.ts.map +1 -1
  448. package/dist/lib/features/tag-type/fake-tag-type-store.js +3 -1
  449. package/dist/lib/features/tag-type/fake-tag-type-store.js.map +1 -1
  450. package/dist/lib/features/tag-type/tag-type.d.ts +1 -2
  451. package/dist/lib/features/tag-type/tag-type.d.ts.map +1 -1
  452. package/dist/lib/features/tag-type/tag-type.js +1 -2
  453. package/dist/lib/features/tag-type/tag-type.js.map +1 -1
  454. package/dist/lib/features/traffic-data-usage/fake-traffic-data-usage-store.d.ts +4 -4
  455. package/dist/lib/features/traffic-data-usage/fake-traffic-data-usage-store.d.ts.map +1 -1
  456. package/dist/lib/features/traffic-data-usage/fake-traffic-data-usage-store.js +4 -4
  457. package/dist/lib/features/traffic-data-usage/fake-traffic-data-usage-store.js.map +1 -1
  458. package/dist/lib/features/traffic-data-usage/traffic-data-usage-store.d.ts +1 -2
  459. package/dist/lib/features/traffic-data-usage/traffic-data-usage-store.d.ts.map +1 -1
  460. package/dist/lib/features/traffic-data-usage/traffic-data-usage-store.js +3 -4
  461. package/dist/lib/features/traffic-data-usage/traffic-data-usage-store.js.map +1 -1
  462. package/dist/lib/features/ui-observability-controller/ui-observability-controller.js +1 -1
  463. package/dist/lib/features/ui-observability-controller/ui-observability-controller.js.map +1 -1
  464. package/dist/lib/features/unique-connection/unique-connection-service.d.ts +0 -1
  465. package/dist/lib/features/unique-connection/unique-connection-service.d.ts.map +1 -1
  466. package/dist/lib/features/unique-connection/unique-connection-service.js +0 -1
  467. package/dist/lib/features/unique-connection/unique-connection-service.js.map +1 -1
  468. package/dist/lib/features/user-subscriptions/fake-user-subscriptions-read-model.d.ts +2 -2
  469. package/dist/lib/features/user-subscriptions/fake-user-subscriptions-read-model.d.ts.map +1 -1
  470. package/dist/lib/features/user-subscriptions/fake-user-subscriptions-read-model.js +2 -2
  471. package/dist/lib/features/user-subscriptions/fake-user-subscriptions-read-model.js.map +1 -1
  472. package/dist/lib/features/user-subscriptions/user-subscriptions-read-model.test.js +1 -1
  473. package/dist/lib/features/user-subscriptions/user-subscriptions-read-model.test.js.map +1 -1
  474. package/dist/lib/features/user-subscriptions/user-subscriptions-service.d.ts +1 -2
  475. package/dist/lib/features/user-subscriptions/user-subscriptions-service.d.ts.map +1 -1
  476. package/dist/lib/features/user-subscriptions/user-subscriptions-service.js +1 -2
  477. package/dist/lib/features/user-subscriptions/user-subscriptions-service.js.map +1 -1
  478. package/dist/lib/features/users/user-store.d.ts +1 -2
  479. package/dist/lib/features/users/user-store.d.ts.map +1 -1
  480. package/dist/lib/features/users/user-store.js +1 -2
  481. package/dist/lib/features/users/user-store.js.map +1 -1
  482. package/dist/lib/features/users/user-updates-read-model.d.ts +1 -2
  483. package/dist/lib/features/users/user-updates-read-model.d.ts.map +1 -1
  484. package/dist/lib/features/users/user-updates-read-model.js +1 -2
  485. package/dist/lib/features/users/user-updates-read-model.js.map +1 -1
  486. package/dist/lib/logger.test.js +2 -2
  487. package/dist/lib/logger.test.js.map +1 -1
  488. package/dist/lib/metrics.d.ts.map +1 -1
  489. package/dist/lib/metrics.js +8 -2
  490. package/dist/lib/metrics.js.map +1 -1
  491. package/dist/lib/metrics.test.js +14 -8
  492. package/dist/lib/metrics.test.js.map +1 -1
  493. package/dist/lib/middleware/api-token-middleware.js +1 -1
  494. package/dist/lib/middleware/api-token-middleware.js.map +1 -1
  495. package/dist/lib/middleware/api-token-middleware.test.js +4 -1
  496. package/dist/lib/middleware/api-token-middleware.test.js.map +1 -1
  497. package/dist/lib/middleware/audit-middleware.js +1 -1
  498. package/dist/lib/middleware/audit-middleware.js.map +1 -1
  499. package/dist/lib/middleware/catch-all-error-handler.js +1 -1
  500. package/dist/lib/middleware/catch-all-error-handler.js.map +1 -1
  501. package/dist/lib/middleware/content_type_checker.test.js +3 -6
  502. package/dist/lib/middleware/content_type_checker.test.js.map +1 -1
  503. package/dist/lib/middleware/cors-origin-middleware.js +1 -1
  504. package/dist/lib/middleware/cors-origin-middleware.js.map +1 -1
  505. package/dist/lib/middleware/demo-authentication.js +3 -3
  506. package/dist/lib/middleware/demo-authentication.js.map +1 -1
  507. package/dist/lib/middleware/no-authentication.js +3 -3
  508. package/dist/lib/middleware/no-authentication.js.map +1 -1
  509. package/dist/lib/middleware/origin-middleware.d.ts +1 -1
  510. package/dist/lib/middleware/origin-middleware.d.ts.map +1 -1
  511. package/dist/lib/middleware/origin-middleware.js +2 -9
  512. package/dist/lib/middleware/origin-middleware.js.map +1 -1
  513. package/dist/lib/middleware/origin-middleware.test.js +0 -16
  514. package/dist/lib/middleware/origin-middleware.test.js.map +1 -1
  515. package/dist/lib/middleware/oss-authentication.test.js +2 -2
  516. package/dist/lib/middleware/oss-authentication.test.js.map +1 -1
  517. package/dist/lib/middleware/pat-middleware.js +1 -1
  518. package/dist/lib/middleware/pat-middleware.js.map +1 -1
  519. package/dist/lib/middleware/rbac-middleware.js +1 -1
  520. package/dist/lib/middleware/rbac-middleware.js.map +1 -1
  521. package/dist/lib/middleware/rbac-middleware.test.js +7 -3
  522. package/dist/lib/middleware/rbac-middleware.test.js.map +1 -1
  523. package/dist/lib/middleware/response-time-metrics.js +1 -1
  524. package/dist/lib/middleware/response-time-metrics.js.map +1 -1
  525. package/dist/lib/middleware/response-time-metrics.test.js +4 -1
  526. package/dist/lib/middleware/response-time-metrics.test.js.map +1 -1
  527. package/dist/lib/middleware/secure-headers.js +1 -1
  528. package/dist/lib/middleware/secure-headers.js.map +1 -1
  529. package/dist/lib/openapi/meta-schema-rules.test.js +1 -1
  530. package/dist/lib/openapi/meta-schema-rules.test.js.map +1 -1
  531. package/dist/lib/openapi/spec/addon-create-update-schema.d.ts +2 -2
  532. package/dist/lib/openapi/spec/addon-create-update-schema.js +6 -6
  533. package/dist/lib/openapi/spec/addon-create-update-schema.js.map +1 -1
  534. package/dist/lib/openapi/spec/addon-parameter-schema.js +1 -1
  535. package/dist/lib/openapi/spec/addon-parameter-schema.js.map +1 -1
  536. package/dist/lib/openapi/spec/addon-schema.d.ts +1 -1
  537. package/dist/lib/openapi/spec/addon-schema.js +1 -1
  538. package/dist/lib/openapi/spec/addon-schema.js.map +1 -1
  539. package/dist/lib/openapi/spec/addon-type-schema.d.ts +2 -2
  540. package/dist/lib/openapi/spec/addon-type-schema.js +2 -2
  541. package/dist/lib/openapi/spec/addon-type-schema.js.map +1 -1
  542. package/dist/lib/openapi/spec/addons-schema.d.ts +5 -5
  543. package/dist/lib/openapi/spec/addons-schema.js +2 -2
  544. package/dist/lib/openapi/spec/addons-schema.js.map +1 -1
  545. package/dist/lib/openapi/spec/admin-segment-schema.d.ts +6 -4
  546. package/dist/lib/openapi/spec/admin-segment-schema.d.ts.map +1 -1
  547. package/dist/lib/openapi/spec/admin-segment-schema.js +1 -1
  548. package/dist/lib/openapi/spec/admin-segment-schema.js.map +1 -1
  549. package/dist/lib/openapi/spec/advanced-playground-environment-feature-schema.d.ts +14 -14
  550. package/dist/lib/openapi/spec/advanced-playground-feature-schema.d.ts +28 -28
  551. package/dist/lib/openapi/spec/advanced-playground-response-schema.d.ts +61 -59
  552. package/dist/lib/openapi/spec/advanced-playground-response-schema.d.ts.map +1 -1
  553. package/dist/lib/openapi/spec/api-token-schema.d.ts +1 -1
  554. package/dist/lib/openapi/spec/api-token-schema.js +1 -1
  555. package/dist/lib/openapi/spec/api-token-schema.js.map +1 -1
  556. package/dist/lib/openapi/spec/api-token-schema.test.js +5 -1
  557. package/dist/lib/openapi/spec/api-token-schema.test.js.map +1 -1
  558. package/dist/lib/openapi/spec/api-tokens-schema.d.ts +2 -2
  559. package/dist/lib/openapi/spec/api-tokens-schema.js +1 -1
  560. package/dist/lib/openapi/spec/api-tokens-schema.js.map +1 -1
  561. package/dist/lib/openapi/spec/application-schema.d.ts +1 -1
  562. package/dist/lib/openapi/spec/application-schema.js +1 -1
  563. package/dist/lib/openapi/spec/application-schema.js.map +1 -1
  564. package/dist/lib/openapi/spec/applications-schema.d.ts +1 -1
  565. package/dist/lib/openapi/spec/bulk-metrics-schema.d.ts +2 -2
  566. package/dist/lib/openapi/spec/bulk-registration-schema.d.ts +2 -2
  567. package/dist/lib/openapi/spec/bulk-registration-schema.js +2 -2
  568. package/dist/lib/openapi/spec/bulk-registration-schema.js.map +1 -1
  569. package/dist/lib/openapi/spec/client-feature-schema.d.ts +20 -18
  570. package/dist/lib/openapi/spec/client-feature-schema.d.ts.map +1 -1
  571. package/dist/lib/openapi/spec/client-feature-schema.js +3 -3
  572. package/dist/lib/openapi/spec/client-feature-schema.js.map +1 -1
  573. package/dist/lib/openapi/spec/client-features-delta-schema.d.ts +37 -35
  574. package/dist/lib/openapi/spec/client-features-delta-schema.d.ts.map +1 -1
  575. package/dist/lib/openapi/spec/client-features-schema.d.ts +38 -36
  576. package/dist/lib/openapi/spec/client-features-schema.d.ts.map +1 -1
  577. package/dist/lib/openapi/spec/client-features-schema.js +1 -1
  578. package/dist/lib/openapi/spec/client-features-schema.js.map +1 -1
  579. package/dist/lib/openapi/spec/client-metrics-schema.d.ts +1 -1
  580. package/dist/lib/openapi/spec/client-metrics-schema.js +1 -1
  581. package/dist/lib/openapi/spec/client-metrics-schema.js.map +1 -1
  582. package/dist/lib/openapi/spec/client-segment-schema.d.ts +5 -3
  583. package/dist/lib/openapi/spec/client-segment-schema.d.ts.map +1 -1
  584. package/dist/lib/openapi/spec/clone-feature-schema.d.ts +1 -1
  585. package/dist/lib/openapi/spec/clone-feature-schema.js +1 -1
  586. package/dist/lib/openapi/spec/clone-feature-schema.js.map +1 -1
  587. package/dist/lib/openapi/spec/constraint-schema.d.ts +7 -5
  588. package/dist/lib/openapi/spec/constraint-schema.d.ts.map +1 -1
  589. package/dist/lib/openapi/spec/constraint-schema.js +2 -2
  590. package/dist/lib/openapi/spec/constraint-schema.js.map +1 -1
  591. package/dist/lib/openapi/spec/constraint-schema.test.js +2 -0
  592. package/dist/lib/openapi/spec/constraint-schema.test.js.map +1 -1
  593. package/dist/lib/openapi/spec/context-field-schema.d.ts +2 -2
  594. package/dist/lib/openapi/spec/context-field-schema.js +2 -2
  595. package/dist/lib/openapi/spec/context-field-schema.js.map +1 -1
  596. package/dist/lib/openapi/spec/context-fields-schema.d.ts +2 -2
  597. package/dist/lib/openapi/spec/create-api-token-schema.d.ts +2 -2
  598. package/dist/lib/openapi/spec/create-api-token-schema.js +1 -1
  599. package/dist/lib/openapi/spec/create-api-token-schema.js.map +1 -1
  600. package/dist/lib/openapi/spec/create-application-schema.d.ts +1 -1
  601. package/dist/lib/openapi/spec/create-application-schema.js +1 -1
  602. package/dist/lib/openapi/spec/create-application-schema.js.map +1 -1
  603. package/dist/lib/openapi/spec/create-context-field-schema.d.ts +1 -1
  604. package/dist/lib/openapi/spec/create-feature-schema.d.ts +3 -3
  605. package/dist/lib/openapi/spec/create-feature-schema.js +1 -1
  606. package/dist/lib/openapi/spec/create-feature-schema.js.map +1 -1
  607. package/dist/lib/openapi/spec/create-feature-strategy-schema.d.ts +9 -7
  608. package/dist/lib/openapi/spec/create-feature-strategy-schema.d.ts.map +1 -1
  609. package/dist/lib/openapi/spec/create-feature-strategy-schema.js +1 -1
  610. package/dist/lib/openapi/spec/create-feature-strategy-schema.js.map +1 -1
  611. package/dist/lib/openapi/spec/create-pat-schema.d.ts +1 -1
  612. package/dist/lib/openapi/spec/create-pat-schema.js +1 -1
  613. package/dist/lib/openapi/spec/create-pat-schema.js.map +1 -1
  614. package/dist/lib/openapi/spec/create-strategy-schema.d.ts +2 -2
  615. package/dist/lib/openapi/spec/create-strategy-schema.js +2 -2
  616. package/dist/lib/openapi/spec/create-strategy-schema.js.map +1 -1
  617. package/dist/lib/openapi/spec/create-strategy-variant-schema.d.ts +3 -3
  618. package/dist/lib/openapi/spec/create-strategy-variant-schema.js +3 -3
  619. package/dist/lib/openapi/spec/create-strategy-variant-schema.js.map +1 -1
  620. package/dist/lib/openapi/spec/create-tag-schema.d.ts +2 -2
  621. package/dist/lib/openapi/spec/create-tag-schema.js +1 -1
  622. package/dist/lib/openapi/spec/create-tag-schema.js.map +1 -1
  623. package/dist/lib/openapi/spec/create-user-response-schema.d.ts +1 -1
  624. package/dist/lib/openapi/spec/create-user-response-schema.js +1 -1
  625. package/dist/lib/openapi/spec/create-user-response-schema.js.map +1 -1
  626. package/dist/lib/openapi/spec/edge-token-schema.d.ts +3 -3
  627. package/dist/lib/openapi/spec/edge-token-schema.js +3 -3
  628. package/dist/lib/openapi/spec/edge-token-schema.js.map +1 -1
  629. package/dist/lib/openapi/spec/environment-project-schema.d.ts +15 -13
  630. package/dist/lib/openapi/spec/environment-project-schema.d.ts.map +1 -1
  631. package/dist/lib/openapi/spec/environment-project-schema.js +1 -1
  632. package/dist/lib/openapi/spec/environment-project-schema.js.map +1 -1
  633. package/dist/lib/openapi/spec/environment-schema.d.ts +1 -1
  634. package/dist/lib/openapi/spec/environment-schema.js +1 -1
  635. package/dist/lib/openapi/spec/environment-schema.js.map +1 -1
  636. package/dist/lib/openapi/spec/environments-project-schema.d.ts +26 -24
  637. package/dist/lib/openapi/spec/environments-project-schema.d.ts.map +1 -1
  638. package/dist/lib/openapi/spec/environments-schema.d.ts +1 -1
  639. package/dist/lib/openapi/spec/event-schema.d.ts +7 -7
  640. package/dist/lib/openapi/spec/event-schema.js +1 -1
  641. package/dist/lib/openapi/spec/event-schema.js.map +1 -1
  642. package/dist/lib/openapi/spec/event-search-response-schema.d.ts +9 -9
  643. package/dist/lib/openapi/spec/events-schema.d.ts +9 -9
  644. package/dist/lib/openapi/spec/export-query-schema.d.ts +1 -1
  645. package/dist/lib/openapi/spec/export-query-schema.js +1 -1
  646. package/dist/lib/openapi/spec/export-query-schema.js.map +1 -1
  647. package/dist/lib/openapi/spec/export-result-schema.d.ts +1986 -529
  648. package/dist/lib/openapi/spec/export-result-schema.d.ts.map +1 -1
  649. package/dist/lib/openapi/spec/export-result-schema.js +6 -0
  650. package/dist/lib/openapi/spec/export-result-schema.js.map +1 -1
  651. package/dist/lib/openapi/spec/feature-environment-schema.d.ts +372 -107
  652. package/dist/lib/openapi/spec/feature-environment-schema.d.ts.map +1 -1
  653. package/dist/lib/openapi/spec/feature-environment-schema.js +12 -0
  654. package/dist/lib/openapi/spec/feature-environment-schema.js.map +1 -1
  655. package/dist/lib/openapi/spec/feature-events-schema.d.ts +9 -9
  656. package/dist/lib/openapi/spec/feature-schema.d.ts +950 -215
  657. package/dist/lib/openapi/spec/feature-schema.d.ts.map +1 -1
  658. package/dist/lib/openapi/spec/feature-schema.js +17 -0
  659. package/dist/lib/openapi/spec/feature-schema.js.map +1 -1
  660. package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts +729 -213
  661. package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts.map +1 -1
  662. package/dist/lib/openapi/spec/feature-search-response-schema.d.ts +745 -229
  663. package/dist/lib/openapi/spec/feature-search-response-schema.d.ts.map +1 -1
  664. package/dist/lib/openapi/spec/feature-strategy-schema.d.ts +9 -7
  665. package/dist/lib/openapi/spec/feature-strategy-schema.d.ts.map +1 -1
  666. package/dist/lib/openapi/spec/feature-strategy-schema.js +1 -1
  667. package/dist/lib/openapi/spec/feature-strategy-schema.js.map +1 -1
  668. package/dist/lib/openapi/spec/feature-tag-schema.d.ts +2 -2
  669. package/dist/lib/openapi/spec/feature-tag-schema.js +2 -2
  670. package/dist/lib/openapi/spec/feature-tag-schema.js.map +1 -1
  671. package/dist/lib/openapi/spec/feature-type-schema.d.ts +2 -2
  672. package/dist/lib/openapi/spec/feature-type-schema.js +2 -2
  673. package/dist/lib/openapi/spec/feature-type-schema.js.map +1 -1
  674. package/dist/lib/openapi/spec/feature-types-schema.d.ts +3 -3
  675. package/dist/lib/openapi/spec/feature-types-schema.js +1 -1
  676. package/dist/lib/openapi/spec/feature-types-schema.js.map +1 -1
  677. package/dist/lib/openapi/spec/feature-variants-schema.d.ts +3 -3
  678. package/dist/lib/openapi/spec/group-schema.d.ts +2 -2
  679. package/dist/lib/openapi/spec/group-user-model-schema.d.ts +1 -1
  680. package/dist/lib/openapi/spec/groups-schema.d.ts +5 -5
  681. package/dist/lib/openapi/spec/groups-schema.js +1 -1
  682. package/dist/lib/openapi/spec/groups-schema.js.map +1 -1
  683. package/dist/lib/openapi/spec/health-overview-schema.d.ts +1784 -535
  684. package/dist/lib/openapi/spec/health-overview-schema.d.ts.map +1 -1
  685. package/dist/lib/openapi/spec/health-overview-schema.js +3 -3
  686. package/dist/lib/openapi/spec/health-overview-schema.js.map +1 -1
  687. package/dist/lib/openapi/spec/health-report-schema.d.ts +1783 -534
  688. package/dist/lib/openapi/spec/health-report-schema.d.ts.map +1 -1
  689. package/dist/lib/openapi/spec/import-toggles-schema.d.ts +66 -27262
  690. package/dist/lib/openapi/spec/import-toggles-schema.d.ts.map +1 -1
  691. package/dist/lib/openapi/spec/import-toggles-schema.js +40 -31
  692. package/dist/lib/openapi/spec/import-toggles-schema.js.map +1 -1
  693. package/dist/lib/openapi/spec/import-toggles-validate-schema.d.ts +1 -1
  694. package/dist/lib/openapi/spec/import-toggles-validate-schema.js +1 -1
  695. package/dist/lib/openapi/spec/import-toggles-validate-schema.js.map +1 -1
  696. package/dist/lib/openapi/spec/index.d.ts +4 -0
  697. package/dist/lib/openapi/spec/index.d.ts.map +1 -1
  698. package/dist/lib/openapi/spec/index.js +4 -0
  699. package/dist/lib/openapi/spec/index.js.map +1 -1
  700. package/dist/lib/openapi/spec/instance-admin-stats-schema.d.ts +13 -0
  701. package/dist/lib/openapi/spec/instance-admin-stats-schema.d.ts.map +1 -1
  702. package/dist/lib/openapi/spec/instance-admin-stats-schema.js +13 -0
  703. package/dist/lib/openapi/spec/instance-admin-stats-schema.js.map +1 -1
  704. package/dist/lib/openapi/spec/integration-event-schema.d.ts +12 -12
  705. package/dist/lib/openapi/spec/integration-events-schema.d.ts +24 -24
  706. package/dist/lib/openapi/spec/me-schema.d.ts +2 -2
  707. package/dist/lib/openapi/spec/metric-query-schema.d.ts +44 -0
  708. package/dist/lib/openapi/spec/metric-query-schema.d.ts.map +1 -0
  709. package/dist/lib/openapi/spec/metric-query-schema.js +42 -0
  710. package/dist/lib/openapi/spec/metric-query-schema.js.map +1 -0
  711. package/dist/lib/openapi/spec/pat-schema.d.ts +1 -1
  712. package/dist/lib/openapi/spec/pat-schema.js +1 -1
  713. package/dist/lib/openapi/spec/pat-schema.js.map +1 -1
  714. package/dist/lib/openapi/spec/pats-schema.d.ts +2 -2
  715. package/dist/lib/openapi/spec/pats-schema.js +1 -1
  716. package/dist/lib/openapi/spec/pats-schema.js.map +1 -1
  717. package/dist/lib/openapi/spec/permission-schema.d.ts +1 -1
  718. package/dist/lib/openapi/spec/permission-schema.js +1 -1
  719. package/dist/lib/openapi/spec/permission-schema.js.map +1 -1
  720. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.d.ts +1 -1
  721. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.js +1 -1
  722. package/dist/lib/openapi/spec/personal-dashboard-project-details-schema.js.map +1 -1
  723. package/dist/lib/openapi/spec/personal-dashboard-schema.d.ts +1 -1
  724. package/dist/lib/openapi/spec/personal-dashboard-schema.js +1 -1
  725. package/dist/lib/openapi/spec/personal-dashboard-schema.js.map +1 -1
  726. package/dist/lib/openapi/spec/playground-constraint-schema.d.ts +5 -3
  727. package/dist/lib/openapi/spec/playground-constraint-schema.d.ts.map +1 -1
  728. package/dist/lib/openapi/spec/playground-feature-schema.d.ts +17 -15
  729. package/dist/lib/openapi/spec/playground-feature-schema.d.ts.map +1 -1
  730. package/dist/lib/openapi/spec/playground-response-schema.d.ts +33 -31
  731. package/dist/lib/openapi/spec/playground-response-schema.d.ts.map +1 -1
  732. package/dist/lib/openapi/spec/playground-response-schema.test.js +1 -1
  733. package/dist/lib/openapi/spec/playground-response-schema.test.js.map +1 -1
  734. package/dist/lib/openapi/spec/playground-segment-schema.d.ts +5 -3
  735. package/dist/lib/openapi/spec/playground-segment-schema.d.ts.map +1 -1
  736. package/dist/lib/openapi/spec/playground-strategy-schema.d.ts +10 -8
  737. package/dist/lib/openapi/spec/playground-strategy-schema.d.ts.map +1 -1
  738. package/dist/lib/openapi/spec/profile-schema.d.ts +947 -214
  739. package/dist/lib/openapi/spec/profile-schema.d.ts.map +1 -1
  740. package/dist/lib/openapi/spec/project-environment-schema.d.ts +9 -9
  741. package/dist/lib/openapi/spec/project-feature-schema.d.ts +2 -2
  742. package/dist/lib/openapi/spec/project-features-schema.d.ts +4 -4
  743. package/dist/lib/openapi/spec/project-insights-schema.d.ts +2 -2
  744. package/dist/lib/openapi/spec/project-insights-schema.js +2 -2
  745. package/dist/lib/openapi/spec/project-insights-schema.js.map +1 -1
  746. package/dist/lib/openapi/spec/project-overview-schema.d.ts +1781 -532
  747. package/dist/lib/openapi/spec/project-overview-schema.d.ts.map +1 -1
  748. package/dist/lib/openapi/spec/project-overview-schema.js +2 -2
  749. package/dist/lib/openapi/spec/project-overview-schema.js.map +1 -1
  750. package/dist/lib/openapi/spec/project-schema.d.ts +2 -2
  751. package/dist/lib/openapi/spec/project-schema.js +2 -2
  752. package/dist/lib/openapi/spec/project-schema.js.map +1 -1
  753. package/dist/lib/openapi/spec/projects-schema.d.ts +2 -2
  754. package/dist/lib/openapi/spec/public-signup-token-create-schema.d.ts +1 -1
  755. package/dist/lib/openapi/spec/public-signup-token-create-schema.js +1 -1
  756. package/dist/lib/openapi/spec/public-signup-token-create-schema.js.map +1 -1
  757. package/dist/lib/openapi/spec/public-signup-token-schema.d.ts +2 -2
  758. package/dist/lib/openapi/spec/public-signup-token-schema.js +1 -1
  759. package/dist/lib/openapi/spec/public-signup-token-schema.js.map +1 -1
  760. package/dist/lib/openapi/spec/public-signup-tokens-schema.d.ts +3 -3
  761. package/dist/lib/openapi/spec/push-variants-schema.d.ts +3 -3
  762. package/dist/lib/openapi/spec/ready-check-schema.d.ts +19 -0
  763. package/dist/lib/openapi/spec/ready-check-schema.d.ts.map +1 -0
  764. package/dist/lib/openapi/spec/ready-check-schema.js +17 -0
  765. package/dist/lib/openapi/spec/ready-check-schema.js.map +1 -0
  766. package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts +45 -25
  767. package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts.map +1 -1
  768. package/dist/lib/openapi/spec/release-plan-milestone-schema.js +12 -1
  769. package/dist/lib/openapi/spec/release-plan-milestone-schema.js.map +1 -1
  770. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts +15 -13
  771. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts.map +1 -1
  772. package/dist/lib/openapi/spec/release-plan-schema.d.ts +283 -48
  773. package/dist/lib/openapi/spec/release-plan-schema.d.ts.map +1 -1
  774. package/dist/lib/openapi/spec/release-plan-schema.js +13 -0
  775. package/dist/lib/openapi/spec/release-plan-schema.js.map +1 -1
  776. package/dist/lib/openapi/spec/release-plan-template-schema.d.ts +68 -48
  777. package/dist/lib/openapi/spec/release-plan-template-schema.d.ts.map +1 -1
  778. package/dist/lib/openapi/spec/safeguard-schema.d.ts +149 -0
  779. package/dist/lib/openapi/spec/safeguard-schema.d.ts.map +1 -0
  780. package/dist/lib/openapi/spec/safeguard-schema.js +59 -0
  781. package/dist/lib/openapi/spec/safeguard-schema.js.map +1 -0
  782. package/dist/lib/openapi/spec/safeguard-trigger-condition-schema.d.ts +24 -0
  783. package/dist/lib/openapi/spec/safeguard-trigger-condition-schema.d.ts.map +1 -0
  784. package/dist/lib/openapi/spec/safeguard-trigger-condition-schema.js +22 -0
  785. package/dist/lib/openapi/spec/safeguard-trigger-condition-schema.js.map +1 -0
  786. package/dist/lib/openapi/spec/search-features-schema.d.ts +1578 -548
  787. package/dist/lib/openapi/spec/search-features-schema.d.ts.map +1 -1
  788. package/dist/lib/openapi/spec/segment-schema.d.ts +5 -3
  789. package/dist/lib/openapi/spec/segment-schema.d.ts.map +1 -1
  790. package/dist/lib/openapi/spec/segments-schema.d.ts +9 -7
  791. package/dist/lib/openapi/spec/segments-schema.d.ts.map +1 -1
  792. package/dist/lib/openapi/spec/segments-schema.js +1 -1
  793. package/dist/lib/openapi/spec/segments-schema.js.map +1 -1
  794. package/dist/lib/openapi/spec/strategies-schema.d.ts +1 -1
  795. package/dist/lib/openapi/spec/strategy-schema.d.ts +1 -1
  796. package/dist/lib/openapi/spec/strategy-schema.js +1 -1
  797. package/dist/lib/openapi/spec/strategy-schema.js.map +1 -1
  798. package/dist/lib/openapi/spec/strategy-variant-schema.d.ts +3 -3
  799. package/dist/lib/openapi/spec/tag-schema.d.ts +2 -2
  800. package/dist/lib/openapi/spec/tag-schema.js +2 -2
  801. package/dist/lib/openapi/spec/tag-schema.js.map +1 -1
  802. package/dist/lib/openapi/spec/tag-with-version-schema.d.ts +2 -2
  803. package/dist/lib/openapi/spec/tags-bulk-add-schema.d.ts +4 -4
  804. package/dist/lib/openapi/spec/tags-schema.d.ts +2 -2
  805. package/dist/lib/openapi/spec/update-context-field-schema.d.ts +1 -1
  806. package/dist/lib/openapi/spec/update-context-field-schema.js +1 -1
  807. package/dist/lib/openapi/spec/update-context-field-schema.js.map +1 -1
  808. package/dist/lib/openapi/spec/update-feature-schema.d.ts +6 -4
  809. package/dist/lib/openapi/spec/update-feature-schema.d.ts.map +1 -1
  810. package/dist/lib/openapi/spec/update-feature-schema.js +1 -1
  811. package/dist/lib/openapi/spec/update-feature-schema.js.map +1 -1
  812. package/dist/lib/openapi/spec/update-feature-strategy-schema.d.ts +6 -4
  813. package/dist/lib/openapi/spec/update-feature-strategy-schema.d.ts.map +1 -1
  814. package/dist/lib/openapi/spec/update-feature-strategy-schema.js +1 -1
  815. package/dist/lib/openapi/spec/update-feature-strategy-schema.js.map +1 -1
  816. package/dist/lib/openapi/spec/update-feature-type-lifetime-schema.d.ts +1 -1
  817. package/dist/lib/openapi/spec/update-feature-type-lifetime-schema.js +1 -1
  818. package/dist/lib/openapi/spec/update-feature-type-lifetime-schema.js.map +1 -1
  819. package/dist/lib/openapi/spec/update-strategy-schema.d.ts +1 -1
  820. package/dist/lib/openapi/spec/update-strategy-schema.js +1 -1
  821. package/dist/lib/openapi/spec/update-strategy-schema.js.map +1 -1
  822. package/dist/lib/openapi/spec/update-tags-schema.d.ts +2 -2
  823. package/dist/lib/openapi/spec/upsert-segment-schema.d.ts +5 -3
  824. package/dist/lib/openapi/spec/upsert-segment-schema.d.ts.map +1 -1
  825. package/dist/lib/openapi/spec/upsert-segment-schema.test.js +6 -2
  826. package/dist/lib/openapi/spec/upsert-segment-schema.test.js.map +1 -1
  827. package/dist/lib/openapi/spec/user-access-overview-schema.d.ts +1 -1
  828. package/dist/lib/openapi/spec/user-schema.d.ts +1 -1
  829. package/dist/lib/openapi/spec/user-schema.js +1 -1
  830. package/dist/lib/openapi/spec/user-schema.js.map +1 -1
  831. package/dist/lib/openapi/spec/users-groups-base-schema.d.ts +4 -4
  832. package/dist/lib/openapi/spec/users-schema.d.ts +2 -2
  833. package/dist/lib/openapi/spec/users-schema.js +1 -1
  834. package/dist/lib/openapi/spec/users-schema.js.map +1 -1
  835. package/dist/lib/openapi/spec/users-search-schema.d.ts +1 -1
  836. package/dist/lib/openapi/spec/validated-edge-tokens-schema.d.ts +3 -3
  837. package/dist/lib/openapi/spec/variant-schema.d.ts +3 -3
  838. package/dist/lib/openapi/spec/variant-schema.js +3 -3
  839. package/dist/lib/openapi/spec/variant-schema.js.map +1 -1
  840. package/dist/lib/openapi/spec/variants-schema.d.ts +3 -3
  841. package/dist/lib/openapi/util/openapi-tags.d.ts +40 -40
  842. package/dist/lib/openapi/util/openapi-tags.js +20 -20
  843. package/dist/lib/openapi/util/openapi-tags.js.map +1 -1
  844. package/dist/lib/openapi/validate.d.ts +2 -2
  845. package/dist/lib/openapi/validate.d.ts.map +1 -1
  846. package/dist/lib/routes/admin-api/addon.d.ts +1 -2
  847. package/dist/lib/routes/admin-api/addon.d.ts.map +1 -1
  848. package/dist/lib/routes/admin-api/addon.js +1 -2
  849. package/dist/lib/routes/admin-api/addon.js.map +1 -1
  850. package/dist/lib/routes/admin-api/api-token.js +2 -2
  851. package/dist/lib/routes/admin-api/api-token.js.map +1 -1
  852. package/dist/lib/routes/admin-api/event.d.ts +1 -1
  853. package/dist/lib/routes/admin-api/event.d.ts.map +1 -1
  854. package/dist/lib/routes/admin-api/event.js +1 -1
  855. package/dist/lib/routes/admin-api/event.js.map +1 -1
  856. package/dist/lib/routes/admin-api/events.test.js +1 -1
  857. package/dist/lib/routes/admin-api/events.test.js.map +1 -1
  858. package/dist/lib/routes/admin-api/feature-type.d.ts +1 -2
  859. package/dist/lib/routes/admin-api/feature-type.d.ts.map +1 -1
  860. package/dist/lib/routes/admin-api/feature-type.js +2 -3
  861. package/dist/lib/routes/admin-api/feature-type.js.map +1 -1
  862. package/dist/lib/routes/admin-api/instance-admin.d.ts +1 -3
  863. package/dist/lib/routes/admin-api/instance-admin.d.ts.map +1 -1
  864. package/dist/lib/routes/admin-api/instance-admin.js +8 -4
  865. package/dist/lib/routes/admin-api/instance-admin.js.map +1 -1
  866. package/dist/lib/routes/admin-api/metrics.d.ts +2 -3
  867. package/dist/lib/routes/admin-api/metrics.d.ts.map +1 -1
  868. package/dist/lib/routes/admin-api/metrics.js +2 -3
  869. package/dist/lib/routes/admin-api/metrics.js.map +1 -1
  870. package/dist/lib/routes/admin-api/project/api-token.d.ts +0 -1
  871. package/dist/lib/routes/admin-api/project/api-token.d.ts.map +1 -1
  872. package/dist/lib/routes/admin-api/project/api-token.js +3 -4
  873. package/dist/lib/routes/admin-api/project/api-token.js.map +1 -1
  874. package/dist/lib/routes/admin-api/project/health-report.js +1 -1
  875. package/dist/lib/routes/admin-api/project/health-report.js.map +1 -1
  876. package/dist/lib/routes/admin-api/public-signup.d.ts +2 -4
  877. package/dist/lib/routes/admin-api/public-signup.d.ts.map +1 -1
  878. package/dist/lib/routes/admin-api/public-signup.js +2 -4
  879. package/dist/lib/routes/admin-api/public-signup.js.map +1 -1
  880. package/dist/lib/routes/admin-api/search/index.d.ts +1 -1
  881. package/dist/lib/routes/admin-api/search/index.d.ts.map +1 -1
  882. package/dist/lib/routes/admin-api/search/index.js +1 -1
  883. package/dist/lib/routes/admin-api/search/index.js.map +1 -1
  884. package/dist/lib/routes/admin-api/strategy.d.ts +1 -2
  885. package/dist/lib/routes/admin-api/strategy.d.ts.map +1 -1
  886. package/dist/lib/routes/admin-api/strategy.js +7 -8
  887. package/dist/lib/routes/admin-api/strategy.js.map +1 -1
  888. package/dist/lib/routes/admin-api/strategy.test.js +25 -1
  889. package/dist/lib/routes/admin-api/strategy.test.js.map +1 -1
  890. package/dist/lib/routes/admin-api/tag.d.ts +2 -4
  891. package/dist/lib/routes/admin-api/tag.d.ts.map +1 -1
  892. package/dist/lib/routes/admin-api/tag.js +4 -6
  893. package/dist/lib/routes/admin-api/tag.js.map +1 -1
  894. package/dist/lib/routes/admin-api/telemetry.d.ts +1 -1
  895. package/dist/lib/routes/admin-api/telemetry.d.ts.map +1 -1
  896. package/dist/lib/routes/admin-api/telemetry.js +1 -1
  897. package/dist/lib/routes/admin-api/telemetry.js.map +1 -1
  898. package/dist/lib/routes/admin-api/user/pat.js +3 -3
  899. package/dist/lib/routes/admin-api/user/pat.js.map +1 -1
  900. package/dist/lib/routes/admin-api/user/user.test.js +2 -2
  901. package/dist/lib/routes/admin-api/user/user.test.js.map +1 -1
  902. package/dist/lib/routes/admin-api/user-admin.d.ts +3 -3
  903. package/dist/lib/routes/admin-api/user-admin.d.ts.map +1 -1
  904. package/dist/lib/routes/admin-api/user-admin.js +4 -4
  905. package/dist/lib/routes/admin-api/user-admin.js.map +1 -1
  906. package/dist/lib/routes/admin-api/user-feedback.d.ts +0 -1
  907. package/dist/lib/routes/admin-api/user-feedback.d.ts.map +1 -1
  908. package/dist/lib/routes/admin-api/user-feedback.js +2 -3
  909. package/dist/lib/routes/admin-api/user-feedback.js.map +1 -1
  910. package/dist/lib/routes/admin-api/user-splash.d.ts +0 -1
  911. package/dist/lib/routes/admin-api/user-splash.d.ts.map +1 -1
  912. package/dist/lib/routes/admin-api/user-splash.js +0 -1
  913. package/dist/lib/routes/admin-api/user-splash.js.map +1 -1
  914. package/dist/lib/routes/auth/reset-password-controller.d.ts +0 -1
  915. package/dist/lib/routes/auth/reset-password-controller.d.ts.map +1 -1
  916. package/dist/lib/routes/auth/reset-password-controller.js +0 -1
  917. package/dist/lib/routes/auth/reset-password-controller.js.map +1 -1
  918. package/dist/lib/routes/auth/simple-password-provider.d.ts +0 -1
  919. package/dist/lib/routes/auth/simple-password-provider.d.ts.map +1 -1
  920. package/dist/lib/routes/auth/simple-password-provider.js +0 -1
  921. package/dist/lib/routes/auth/simple-password-provider.js.map +1 -1
  922. package/dist/lib/routes/auth/simple-password-provider.test.js +2 -2
  923. package/dist/lib/routes/auth/simple-password-provider.test.js.map +1 -1
  924. package/dist/lib/routes/backstage.js +3 -3
  925. package/dist/lib/routes/backstage.js.map +1 -1
  926. package/dist/lib/routes/health-check.d.ts +0 -2
  927. package/dist/lib/routes/health-check.d.ts.map +1 -1
  928. package/dist/lib/routes/health-check.js +0 -2
  929. package/dist/lib/routes/health-check.js.map +1 -1
  930. package/dist/lib/routes/health-check.test.js +2 -2
  931. package/dist/lib/routes/health-check.test.js.map +1 -1
  932. package/dist/lib/routes/index.d.ts.map +1 -1
  933. package/dist/lib/routes/index.js +2 -0
  934. package/dist/lib/routes/index.js.map +1 -1
  935. package/dist/lib/routes/logout.test.js +5 -5
  936. package/dist/lib/routes/logout.test.js.map +1 -1
  937. package/dist/lib/routes/public-invite.d.ts +0 -1
  938. package/dist/lib/routes/public-invite.d.ts.map +1 -1
  939. package/dist/lib/routes/public-invite.js +0 -1
  940. package/dist/lib/routes/public-invite.js.map +1 -1
  941. package/dist/lib/routes/ready-check.d.ts +14 -0
  942. package/dist/lib/routes/ready-check.d.ts.map +1 -0
  943. package/dist/lib/routes/ready-check.js +86 -0
  944. package/dist/lib/routes/ready-check.js.map +1 -0
  945. package/dist/lib/schema/constraint-value-types.d.ts +1 -1
  946. package/dist/lib/schema/constraint-value-types.d.ts.map +1 -1
  947. package/dist/lib/server-impl.d.ts +6 -6
  948. package/dist/lib/server-impl.d.ts.map +1 -1
  949. package/dist/lib/server-impl.js +14 -4
  950. package/dist/lib/server-impl.js.map +1 -1
  951. package/dist/lib/services/access-service.d.ts +2 -1
  952. package/dist/lib/services/access-service.d.ts.map +1 -1
  953. package/dist/lib/services/access-service.js +20 -1
  954. package/dist/lib/services/access-service.js.map +1 -1
  955. package/dist/lib/services/access-service.test.js +21 -4
  956. package/dist/lib/services/access-service.test.js.map +1 -1
  957. package/dist/lib/services/account-service.d.ts.map +1 -1
  958. package/dist/lib/services/account-service.js +1 -0
  959. package/dist/lib/services/account-service.js.map +1 -1
  960. package/dist/lib/services/addon-service.d.ts +2 -2
  961. package/dist/lib/services/addon-service.d.ts.map +1 -1
  962. package/dist/lib/services/addon-service.js +22 -21
  963. package/dist/lib/services/addon-service.js.map +1 -1
  964. package/dist/lib/services/addon-service.test.js +1 -1
  965. package/dist/lib/services/addon-service.test.js.map +1 -1
  966. package/dist/lib/services/api-token-service.limit.test.js.map +1 -1
  967. package/dist/lib/services/api-token-service.test.js +2 -2
  968. package/dist/lib/services/api-token-service.test.js.map +1 -1
  969. package/dist/lib/services/client-spec-service.d.ts +1 -2
  970. package/dist/lib/services/client-spec-service.d.ts.map +1 -1
  971. package/dist/lib/services/client-spec-service.js +1 -2
  972. package/dist/lib/services/client-spec-service.js.map +1 -1
  973. package/dist/lib/services/favorites-service.d.ts +1 -3
  974. package/dist/lib/services/favorites-service.d.ts.map +1 -1
  975. package/dist/lib/services/favorites-service.js +2 -4
  976. package/dist/lib/services/favorites-service.js.map +1 -1
  977. package/dist/lib/services/feature-tag-service.d.ts.map +1 -1
  978. package/dist/lib/services/feature-tag-service.js +1 -0
  979. package/dist/lib/services/feature-tag-service.js.map +1 -1
  980. package/dist/lib/services/group-service.d.ts +2 -2
  981. package/dist/lib/services/group-service.d.ts.map +1 -1
  982. package/dist/lib/services/group-service.js +3 -2
  983. package/dist/lib/services/group-service.js.map +1 -1
  984. package/dist/lib/services/health-service.d.ts +1 -3
  985. package/dist/lib/services/health-service.d.ts.map +1 -1
  986. package/dist/lib/services/health-service.js +1 -2
  987. package/dist/lib/services/health-service.js.map +1 -1
  988. package/dist/lib/services/index.js +1 -1
  989. package/dist/lib/services/index.js.map +1 -1
  990. package/dist/lib/services/openapi-service.js +7 -5
  991. package/dist/lib/services/openapi-service.js.map +1 -1
  992. package/dist/lib/services/public-signup-token-service.d.ts +0 -1
  993. package/dist/lib/services/public-signup-token-service.d.ts.map +1 -1
  994. package/dist/lib/services/public-signup-token-service.js +0 -1
  995. package/dist/lib/services/public-signup-token-service.js.map +1 -1
  996. package/dist/lib/services/reset-token-service.js +3 -3
  997. package/dist/lib/services/reset-token-service.js.map +1 -1
  998. package/dist/lib/services/strategy-service.d.ts +4 -2
  999. package/dist/lib/services/strategy-service.d.ts.map +1 -1
  1000. package/dist/lib/services/strategy-service.js +15 -3
  1001. package/dist/lib/services/strategy-service.js.map +1 -1
  1002. package/dist/lib/services/user-service.js +2 -2
  1003. package/dist/lib/services/user-service.js.map +1 -1
  1004. package/dist/lib/services/user-service.test.js +5 -1
  1005. package/dist/lib/services/user-service.test.js.map +1 -1
  1006. package/dist/lib/services/user-splash-service.d.ts.map +1 -1
  1007. package/dist/lib/services/user-splash-service.js +7 -1
  1008. package/dist/lib/services/user-splash-service.js.map +1 -1
  1009. package/dist/lib/services/version-service.d.ts +8 -1
  1010. package/dist/lib/services/version-service.d.ts.map +1 -1
  1011. package/dist/lib/services/version-service.js +5 -1
  1012. package/dist/lib/services/version-service.js.map +1 -1
  1013. package/dist/lib/services/version-service.test.js +44 -0
  1014. package/dist/lib/services/version-service.test.js.map +1 -1
  1015. package/dist/lib/types/events.d.ts +5 -18
  1016. package/dist/lib/types/events.d.ts.map +1 -1
  1017. package/dist/lib/types/events.js +6 -15
  1018. package/dist/lib/types/events.js.map +1 -1
  1019. package/dist/lib/types/experimental.d.ts +1 -1
  1020. package/dist/lib/types/experimental.d.ts.map +1 -1
  1021. package/dist/lib/types/experimental.js +12 -12
  1022. package/dist/lib/types/experimental.js.map +1 -1
  1023. package/dist/lib/types/option.d.ts +8 -0
  1024. package/dist/lib/types/option.d.ts.map +1 -1
  1025. package/dist/lib/ui-config/ui-config-controller.d.ts +2 -8
  1026. package/dist/lib/ui-config/ui-config-controller.d.ts.map +1 -1
  1027. package/dist/lib/ui-config/ui-config-controller.js +3 -59
  1028. package/dist/lib/ui-config/ui-config-controller.js.map +1 -1
  1029. package/dist/lib/ui-config/ui-config-service.d.ts.map +1 -1
  1030. package/dist/lib/ui-config/ui-config-service.js.map +1 -1
  1031. package/dist/lib/ui-config/ui-config.test.js +2 -2
  1032. package/dist/lib/ui-config/ui-config.test.js.map +1 -1
  1033. package/dist/lib/users/inactive/fakes/fake-inactive-users-store.d.ts.map +1 -1
  1034. package/dist/lib/users/inactive/fakes/fake-inactive-users-store.js +1 -0
  1035. package/dist/lib/users/inactive/fakes/fake-inactive-users-store.js.map +1 -1
  1036. package/dist/lib/users/inactive/inactive-users-store.d.ts +1 -3
  1037. package/dist/lib/users/inactive/inactive-users-store.d.ts.map +1 -1
  1038. package/dist/lib/users/inactive/inactive-users-store.js +1 -3
  1039. package/dist/lib/users/inactive/inactive-users-store.js.map +1 -1
  1040. package/dist/lib/util/anonymise.test.js.map +1 -1
  1041. package/dist/lib/util/batchExecute.d.ts.map +1 -1
  1042. package/dist/lib/util/batchExecute.js +3 -1
  1043. package/dist/lib/util/batchExecute.js.map +1 -1
  1044. package/dist/lib/util/flag-resolver.d.ts.map +1 -1
  1045. package/dist/lib/util/flag-resolver.js +11 -3
  1046. package/dist/lib/util/flag-resolver.js.map +1 -1
  1047. package/dist/lib/util/flag-resolver.test.js +66 -15
  1048. package/dist/lib/util/flag-resolver.test.js.map +1 -1
  1049. package/dist/lib/util/graceful-shutdown.js +1 -1
  1050. package/dist/lib/util/graceful-shutdown.js.map +1 -1
  1051. package/dist/lib/util/parseEnvVar.d.ts +2 -0
  1052. package/dist/lib/util/parseEnvVar.d.ts.map +1 -1
  1053. package/dist/lib/util/parseEnvVar.js +21 -1
  1054. package/dist/lib/util/parseEnvVar.js.map +1 -1
  1055. package/dist/lib/util/parseEnvVar.test.js +24 -1
  1056. package/dist/lib/util/parseEnvVar.test.js.map +1 -1
  1057. package/dist/lib/util/postgres-version-checker.test.js +17 -5
  1058. package/dist/lib/util/postgres-version-checker.test.js.map +1 -1
  1059. package/dist/lib/util/semver.js +1 -1
  1060. package/dist/lib/util/semver.js.map +1 -1
  1061. package/dist/lib/util/validateJsonString.js +1 -1
  1062. package/dist/lib/util/validateJsonString.js.map +1 -1
  1063. package/dist/mailtemplates/getting-started/getting-started.html.mustache +1 -1
  1064. package/dist/migrations/20251027094509-milestone-progression-natural-pk.d.ts +3 -0
  1065. package/dist/migrations/20251027094509-milestone-progression-natural-pk.d.ts.map +1 -0
  1066. package/dist/migrations/20251027094509-milestone-progression-natural-pk.js +22 -0
  1067. package/dist/migrations/20251027094509-milestone-progression-natural-pk.js.map +1 -0
  1068. package/dist/migrations/20251103114221-milestone-progression-paused-at.d.ts +3 -0
  1069. package/dist/migrations/20251103114221-milestone-progression-paused-at.d.ts.map +1 -0
  1070. package/dist/migrations/20251103114221-milestone-progression-paused-at.js +14 -0
  1071. package/dist/migrations/20251103114221-milestone-progression-paused-at.js.map +1 -0
  1072. package/dist/migrations/20251105153729-create-safeguards-table.d.ts +3 -0
  1073. package/dist/migrations/20251105153729-create-safeguards-table.d.ts.map +1 -0
  1074. package/dist/migrations/20251105153729-create-safeguards-table.js +17 -0
  1075. package/dist/migrations/20251105153729-create-safeguards-table.js.map +1 -0
  1076. package/dist/migrations/20251118131212-edge-observability-hosting.d.ts +3 -0
  1077. package/dist/migrations/20251118131212-edge-observability-hosting.d.ts.map +1 -0
  1078. package/dist/migrations/20251118131212-edge-observability-hosting.js +14 -0
  1079. package/dist/migrations/20251118131212-edge-observability-hosting.js.map +1 -0
  1080. package/dist/migrations/20251209090115-add-default-release-plan-template.d.ts +3 -0
  1081. package/dist/migrations/20251209090115-add-default-release-plan-template.d.ts.map +1 -0
  1082. package/dist/migrations/20251209090115-add-default-release-plan-template.js +45 -0
  1083. package/dist/migrations/20251209090115-add-default-release-plan-template.js.map +1 -0
  1084. package/dist/server-dev.js +3 -7
  1085. package/dist/server-dev.js.map +1 -1
  1086. package/dist/test/arbitraries.test.d.ts.map +1 -1
  1087. package/dist/test/arbitraries.test.js +1 -0
  1088. package/dist/test/arbitraries.test.js.map +1 -1
  1089. package/dist/test/config/create-config.test.js +2 -2
  1090. package/dist/test/config/create-config.test.js.map +1 -1
  1091. package/dist/test/e2e/api/admin/addon.e2e.test.js +4 -1
  1092. package/dist/test/e2e/api/admin/addon.e2e.test.js.map +1 -1
  1093. package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js +6 -3
  1094. package/dist/test/e2e/api/admin/api-token.auth.e2e.test.js.map +1 -1
  1095. package/dist/test/e2e/api/admin/api-token.e2e.test.js +12 -3
  1096. package/dist/test/e2e/api/admin/api-token.e2e.test.js.map +1 -1
  1097. package/dist/test/e2e/api/admin/conditional-middleware.e2e.test.js +8 -8
  1098. package/dist/test/e2e/api/admin/conditional-middleware.e2e.test.js.map +1 -1
  1099. package/dist/test/e2e/api/admin/feature-type.test.js +4 -1
  1100. package/dist/test/e2e/api/admin/feature-type.test.js.map +1 -1
  1101. package/dist/test/e2e/api/admin/feature.custom-auth.e2e.test.js +3 -3
  1102. package/dist/test/e2e/api/admin/feature.custom-auth.e2e.test.js.map +1 -1
  1103. package/dist/test/e2e/api/admin/feedback.e2e.test.js +3 -3
  1104. package/dist/test/e2e/api/admin/feedback.e2e.test.js.map +1 -1
  1105. package/dist/test/e2e/api/admin/metrics.e2e.test.js +3 -3
  1106. package/dist/test/e2e/api/admin/metrics.e2e.test.js.map +1 -1
  1107. package/dist/test/e2e/api/admin/playground.e2e.test.js +1 -1
  1108. package/dist/test/e2e/api/admin/playground.e2e.test.js.map +1 -1
  1109. package/dist/test/e2e/api/admin/project/project.api.tokens.e2e.test.js +5 -1
  1110. package/dist/test/e2e/api/admin/project/project.api.tokens.e2e.test.js.map +1 -1
  1111. package/dist/test/e2e/api/admin/project/project.health.e2e.test.js +1 -1
  1112. package/dist/test/e2e/api/admin/project/project.health.e2e.test.js.map +1 -1
  1113. package/dist/test/e2e/api/admin/project/variants.e2e.test.js +2 -2
  1114. package/dist/test/e2e/api/admin/project/variants.e2e.test.js.map +1 -1
  1115. package/dist/test/e2e/api/admin/public-signup-token.e2e.test.js +12 -12
  1116. package/dist/test/e2e/api/admin/public-signup-token.e2e.test.js.map +1 -1
  1117. package/dist/test/e2e/api/admin/splash.e2e.test.js +3 -3
  1118. package/dist/test/e2e/api/admin/splash.e2e.test.js.map +1 -1
  1119. package/dist/test/e2e/api/admin/user/pat.e2e.test.d.ts +1 -1
  1120. package/dist/test/e2e/api/admin/user/pat.e2e.test.js +1 -1
  1121. package/dist/test/e2e/api/admin/user-admin.e2e.test.js +1 -1
  1122. package/dist/test/e2e/api/admin/user-admin.e2e.test.js.map +1 -1
  1123. package/dist/test/e2e/api/client/bulk-metrics-rejections.e2e.test.d.ts +2 -0
  1124. package/dist/test/e2e/api/client/bulk-metrics-rejections.e2e.test.d.ts.map +1 -0
  1125. package/dist/test/e2e/api/client/bulk-metrics-rejections.e2e.test.js +173 -0
  1126. package/dist/test/e2e/api/client/bulk-metrics-rejections.e2e.test.js.map +1 -0
  1127. package/dist/test/e2e/api/client/feature.auth-none.e2e.test.js +1 -1
  1128. package/dist/test/e2e/api/client/feature.auth-none.e2e.test.js.map +1 -1
  1129. package/dist/test/e2e/api/client/feature.optimal304.e2e.test.js.map +1 -1
  1130. package/dist/test/e2e/api/client/feature.token.access.e2e.test.js +1 -1
  1131. package/dist/test/e2e/api/client/feature.token.access.e2e.test.js.map +1 -1
  1132. package/dist/test/e2e/api/client/metrics.e2e.test.js +2 -1
  1133. package/dist/test/e2e/api/client/metrics.e2e.test.js.map +1 -1
  1134. package/dist/test/e2e/api/client/register.e2e.test.js +4 -4
  1135. package/dist/test/e2e/api/client/register.e2e.test.js.map +1 -1
  1136. package/dist/test/e2e/custom-auth.test.js +2 -2
  1137. package/dist/test/e2e/custom-auth.test.js.map +1 -1
  1138. package/dist/test/e2e/features-created-by-user-id-data-migration.e2e.test.js +4 -4
  1139. package/dist/test/e2e/features-created-by-user-id-data-migration.e2e.test.js.map +1 -1
  1140. package/dist/test/e2e/helpers/database-init.d.ts +1 -1
  1141. package/dist/test/e2e/helpers/database-init.d.ts.map +1 -1
  1142. package/dist/test/e2e/helpers/database-init.js +1 -1
  1143. package/dist/test/e2e/helpers/database-init.js.map +1 -1
  1144. package/dist/test/e2e/ready.e2e.test.d.ts +2 -0
  1145. package/dist/test/e2e/ready.e2e.test.d.ts.map +1 -0
  1146. package/dist/test/e2e/ready.e2e.test.js +66 -0
  1147. package/dist/test/e2e/ready.e2e.test.js.map +1 -0
  1148. package/dist/test/e2e/seed/segment.seed.js +2 -2
  1149. package/dist/test/e2e/seed/segment.seed.js.map +1 -1
  1150. package/dist/test/e2e/services/access-service.e2e.test.js +34 -2
  1151. package/dist/test/e2e/services/access-service.e2e.test.js.map +1 -1
  1152. package/dist/test/e2e/services/addon-service.e2e.test.js +1 -1
  1153. package/dist/test/e2e/services/addon-service.e2e.test.js.map +1 -1
  1154. package/dist/test/e2e/services/api-token-service.e2e.test.js +1 -1
  1155. package/dist/test/e2e/services/api-token-service.e2e.test.js.map +1 -1
  1156. package/dist/test/e2e/services/playground-service.test.js +18 -12
  1157. package/dist/test/e2e/services/playground-service.test.js.map +1 -1
  1158. package/dist/test/e2e/services/setting-service.test.js +2 -2
  1159. package/dist/test/e2e/services/setting-service.test.js.map +1 -1
  1160. package/dist/test/e2e/services/user-service.e2e.test.js +1 -1
  1161. package/dist/test/e2e/services/user-service.e2e.test.js.map +1 -1
  1162. package/dist/test/e2e/stores/client-application-store.e2e.test.js +22 -23
  1163. package/dist/test/e2e/stores/client-application-store.e2e.test.js.map +1 -1
  1164. package/dist/test/e2e/stores/client-instance-store.e2e.test.js +2 -2
  1165. package/dist/test/e2e/stores/client-instance-store.e2e.test.js.map +1 -1
  1166. package/dist/test/e2e/stores/context-field-store.e2e.test.js +2 -2
  1167. package/dist/test/e2e/stores/context-field-store.e2e.test.js.map +1 -1
  1168. package/dist/test/fixtures/access-service-mock.d.ts +13 -13
  1169. package/dist/test/fixtures/access-service-mock.d.ts.map +1 -1
  1170. package/dist/test/fixtures/access-service-mock.js +13 -13
  1171. package/dist/test/fixtures/access-service-mock.js.map +1 -1
  1172. package/dist/test/fixtures/fake-access-store.d.ts +38 -34
  1173. package/dist/test/fixtures/fake-access-store.d.ts.map +1 -1
  1174. package/dist/test/fixtures/fake-access-store.js +37 -35
  1175. package/dist/test/fixtures/fake-access-store.js.map +1 -1
  1176. package/dist/test/fixtures/fake-account-store.d.ts +2 -2
  1177. package/dist/test/fixtures/fake-account-store.d.ts.map +1 -1
  1178. package/dist/test/fixtures/fake-account-store.js +2 -2
  1179. package/dist/test/fixtures/fake-account-store.js.map +1 -1
  1180. package/dist/test/fixtures/fake-client-applications-store.d.ts +2 -2
  1181. package/dist/test/fixtures/fake-client-applications-store.d.ts.map +1 -1
  1182. package/dist/test/fixtures/fake-client-applications-store.js +6 -4
  1183. package/dist/test/fixtures/fake-client-applications-store.js.map +1 -1
  1184. package/dist/test/fixtures/fake-client-instance-store.d.ts +1 -1
  1185. package/dist/test/fixtures/fake-client-instance-store.d.ts.map +1 -1
  1186. package/dist/test/fixtures/fake-client-instance-store.js +4 -2
  1187. package/dist/test/fixtures/fake-client-instance-store.js.map +1 -1
  1188. package/dist/test/fixtures/fake-event-store.d.ts +3 -3
  1189. package/dist/test/fixtures/fake-event-store.d.ts.map +1 -1
  1190. package/dist/test/fixtures/fake-event-store.js +3 -3
  1191. package/dist/test/fixtures/fake-event-store.js.map +1 -1
  1192. package/dist/test/fixtures/fake-favorite-features-store.d.ts +5 -5
  1193. package/dist/test/fixtures/fake-favorite-features-store.d.ts.map +1 -1
  1194. package/dist/test/fixtures/fake-favorite-features-store.js +5 -5
  1195. package/dist/test/fixtures/fake-favorite-features-store.js.map +1 -1
  1196. package/dist/test/fixtures/fake-favorite-projects-store.d.ts +5 -5
  1197. package/dist/test/fixtures/fake-favorite-projects-store.d.ts.map +1 -1
  1198. package/dist/test/fixtures/fake-favorite-projects-store.js +5 -5
  1199. package/dist/test/fixtures/fake-favorite-projects-store.js.map +1 -1
  1200. package/dist/test/fixtures/fake-feature-environment-store.d.ts +9 -9
  1201. package/dist/test/fixtures/fake-feature-environment-store.d.ts.map +1 -1
  1202. package/dist/test/fixtures/fake-feature-environment-store.js +19 -19
  1203. package/dist/test/fixtures/fake-feature-environment-store.js.map +1 -1
  1204. package/dist/test/fixtures/fake-feature-tag-store.d.ts +1 -1
  1205. package/dist/test/fixtures/fake-feature-tag-store.d.ts.map +1 -1
  1206. package/dist/test/fixtures/fake-feature-tag-store.js +2 -2
  1207. package/dist/test/fixtures/fake-feature-tag-store.js.map +1 -1
  1208. package/dist/test/fixtures/fake-group-store.d.ts +16 -16
  1209. package/dist/test/fixtures/fake-group-store.d.ts.map +1 -1
  1210. package/dist/test/fixtures/fake-group-store.js +16 -16
  1211. package/dist/test/fixtures/fake-group-store.js.map +1 -1
  1212. package/dist/test/fixtures/fake-impact-metrics.d.ts +12 -4
  1213. package/dist/test/fixtures/fake-impact-metrics.d.ts.map +1 -1
  1214. package/dist/test/fixtures/fake-impact-metrics.js +50 -26
  1215. package/dist/test/fixtures/fake-impact-metrics.js.map +1 -1
  1216. package/dist/test/fixtures/fake-pat-store.d.ts +9 -9
  1217. package/dist/test/fixtures/fake-pat-store.d.ts.map +1 -1
  1218. package/dist/test/fixtures/fake-pat-store.js +9 -9
  1219. package/dist/test/fixtures/fake-pat-store.js.map +1 -1
  1220. package/dist/test/fixtures/fake-project-store.d.ts +11 -11
  1221. package/dist/test/fixtures/fake-project-store.d.ts.map +1 -1
  1222. package/dist/test/fixtures/fake-project-store.js +16 -16
  1223. package/dist/test/fixtures/fake-project-store.js.map +1 -1
  1224. package/dist/test/fixtures/fake-public-signup-store.d.ts +2 -2
  1225. package/dist/test/fixtures/fake-public-signup-store.d.ts.map +1 -1
  1226. package/dist/test/fixtures/fake-public-signup-store.js +2 -2
  1227. package/dist/test/fixtures/fake-public-signup-store.js.map +1 -1
  1228. package/dist/test/fixtures/fake-role-store.d.ts +9 -9
  1229. package/dist/test/fixtures/fake-role-store.d.ts.map +1 -1
  1230. package/dist/test/fixtures/fake-role-store.js +9 -9
  1231. package/dist/test/fixtures/fake-role-store.js.map +1 -1
  1232. package/dist/test/fixtures/fake-strategies-store.d.ts.map +1 -1
  1233. package/dist/test/fixtures/fake-strategies-store.js +0 -2
  1234. package/dist/test/fixtures/fake-strategies-store.js.map +1 -1
  1235. package/dist/test/fixtures/fake-tag-store.d.ts.map +1 -1
  1236. package/dist/test/fixtures/fake-tag-store.js +4 -2
  1237. package/dist/test/fixtures/fake-tag-store.js.map +1 -1
  1238. package/dist/test/fixtures/fake-user-feedback-store.d.ts +6 -6
  1239. package/dist/test/fixtures/fake-user-feedback-store.d.ts.map +1 -1
  1240. package/dist/test/fixtures/fake-user-feedback-store.js +6 -6
  1241. package/dist/test/fixtures/fake-user-feedback-store.js.map +1 -1
  1242. package/dist/test/fixtures/fake-user-splash-store.d.ts +6 -6
  1243. package/dist/test/fixtures/fake-user-splash-store.d.ts.map +1 -1
  1244. package/dist/test/fixtures/fake-user-splash-store.js +6 -6
  1245. package/dist/test/fixtures/fake-user-splash-store.js.map +1 -1
  1246. package/dist/test/fixtures/fake-user-store.d.ts +2 -2
  1247. package/dist/test/fixtures/fake-user-store.d.ts.map +1 -1
  1248. package/dist/test/fixtures/fake-user-store.js +2 -2
  1249. package/dist/test/fixtures/fake-user-store.js.map +1 -1
  1250. package/dist/test/fixtures/permissions.js +1 -1
  1251. package/dist/test/fixtures/permissions.js.map +1 -1
  1252. package/frontend/build/index.html +2 -2
  1253. package/frontend/build/static/{AdvancedPlayground-HWcSRQrt.js → AdvancedPlayground-CmMV64it.js} +2 -2
  1254. package/frontend/build/static/BackendConnections-MqHimHCS.js +1 -0
  1255. package/frontend/build/static/{CreateProject-3uUrdDWJ.js → CreateProject-ChlGOrPC.js} +1 -1
  1256. package/frontend/build/static/EnterpriseEdge-cJFso1xz.js +1 -0
  1257. package/frontend/build/static/FeatureMetricsChart-Bt6HiI-s.js +2 -0
  1258. package/frontend/build/static/FeatureStaleDialog-DZEtcHDT.js +7 -0
  1259. package/frontend/build/static/FeatureViewLazyExport-BPB1jWYz.js +10 -0
  1260. package/frontend/build/static/{FlagMetricsChart-DFDJ4xPh.js → FlagMetricsChart-CvsBPrQG.js} +2 -2
  1261. package/frontend/build/static/FrontendNetworkTrafficUsage-D8l5Nldl.js +1 -0
  1262. package/frontend/build/static/GridLayoutWrapper-2osRRgh4.js +3 -0
  1263. package/frontend/build/static/ImpactMetricsPage-Chv_7_jx.js +1 -0
  1264. package/frontend/build/static/LazyAdminExport-BOTczpO1.js +38 -0
  1265. package/frontend/build/static/LazyProjectExport-DPAYnCIy.js +728 -0
  1266. package/frontend/build/static/{LifecycleChartComponent-BOcT_Zpy.js → LifecycleChartComponent-DubZNJlv.js} +3 -3
  1267. package/frontend/build/static/{LineChartComponent-CudSs6ri.js → LineChartComponent-CY-8M35z.js} +1 -1
  1268. package/frontend/build/static/{MarkCompletedDialogue-4XT7ryE9.js → MarkCompletedDialogue-BwS_OP77.js} +1 -1
  1269. package/frontend/build/static/NetworkOverview-p_eqqiwO.js +1 -0
  1270. package/frontend/build/static/{NetworkPrometheusAPIWarning-Cy93jJcu.js → NetworkPrometheusAPIWarning-BhqdG7Dp.js} +1 -1
  1271. package/frontend/build/static/{NetworkTraffic-BTN3OABv.js → NetworkTraffic-NxX5X_w8.js} +1 -1
  1272. package/frontend/build/static/NetworkTrafficUsage-B-4F8Mzq.js +1 -0
  1273. package/frontend/build/static/{PercentageDonut-CmWbqKEA.js → PercentageDonut-BoaVP9ed.js} +1 -1
  1274. package/frontend/build/static/{ReactJSONEditor-xNDjbhPU.js → ReactJSONEditor-DfZdSwoC.js} +1 -1
  1275. package/frontend/build/static/RoleCell-Da0TjMne.js +1 -0
  1276. package/frontend/build/static/aggregateFeatureMetrics-yZy5qwho.js +1 -0
  1277. package/frontend/build/static/banner-progression-B6JPzTEE.svg +52 -0
  1278. package/frontend/build/static/enterpriseEdgeCloud-DzRtm8v6.svg +58 -0
  1279. package/frontend/build/static/enterpriseEdgeSelfHosted-4bnmOQVF.svg +44 -0
  1280. package/frontend/build/static/{formatTickValue-4OyGeZqN.js → formatTickValue-Csg87IVi.js} +2 -2
  1281. package/frontend/build/static/index-BAMIkcom.js +542 -0
  1282. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-CT-MfVrm.js → networkTrafficUsageHighlightPlugin-Dje5Vuvo.js} +1 -1
  1283. package/frontend/build/static/new-feature-badge-FwMmHlwT.svg +7 -0
  1284. package/frontend/build/static/style-BfdqROT6.css +1 -0
  1285. package/frontend/build/static/useApiTokens-Btk4Hd2u.js +1 -0
  1286. package/frontend/package.json +4 -5
  1287. package/package.json +45 -50
  1288. package/dist/lib/features/release-plans/release-plan-read-model-type.d.ts +0 -5
  1289. package/dist/lib/features/release-plans/release-plan-read-model-type.d.ts.map +0 -1
  1290. package/dist/lib/features/release-plans/release-plan-read-model-type.js +0 -2
  1291. package/dist/lib/features/release-plans/release-plan-read-model-type.js.map +0 -1
  1292. package/dist/lib/features/release-plans/release-plan-read-model.d.ts +0 -11
  1293. package/dist/lib/features/release-plans/release-plan-read-model.d.ts.map +0 -1
  1294. package/dist/lib/features/release-plans/release-plan-read-model.js +0 -133
  1295. package/dist/lib/features/release-plans/release-plan-read-model.js.map +0 -1
  1296. package/dist/lib/features/release-plans/release-plan-read-model.test.d.ts +0 -2
  1297. package/dist/lib/features/release-plans/release-plan-read-model.test.d.ts.map +0 -1
  1298. package/dist/lib/features/release-plans/release-plan-read-model.test.js +0 -166
  1299. package/dist/lib/features/release-plans/release-plan-read-model.test.js.map +0 -1
  1300. package/dist/test/fixtures/fake/fake-release-plan-read-model.d.ts +0 -8
  1301. package/dist/test/fixtures/fake/fake-release-plan-read-model.d.ts.map +0 -1
  1302. package/dist/test/fixtures/fake/fake-release-plan-read-model.js +0 -9
  1303. package/dist/test/fixtures/fake/fake-release-plan-read-model.js.map +0 -1
  1304. package/frontend/build/static/BackendConnections-Cug76pb0.js +0 -1
  1305. package/frontend/build/static/FeatureMetricsChart-DLvE4xPU.js +0 -2
  1306. package/frontend/build/static/FeatureStaleDialog-BFWmPzw7.js +0 -7
  1307. package/frontend/build/static/FeatureViewLazyExport-DfivW7sC.js +0 -10
  1308. package/frontend/build/static/FrontendNetworkTrafficUsage-DVa2I8CC.js +0 -1
  1309. package/frontend/build/static/GridLayoutWrapper-Mt7n_5lt.js +0 -3
  1310. package/frontend/build/static/ImpactMetricsPage-B3ERxAH0.js +0 -1
  1311. package/frontend/build/static/LazyAdminExport-s8FIvcqq.js +0 -38
  1312. package/frontend/build/static/LazyProjectExport-DN00bJrc.js +0 -728
  1313. package/frontend/build/static/NetworkConnectedEdges-CnEFuyuC.js +0 -1
  1314. package/frontend/build/static/NetworkOverview-KDe9n7ZE.js +0 -1
  1315. package/frontend/build/static/NetworkTrafficUsage-DwnXvons.js +0 -1
  1316. package/frontend/build/static/RoleCell-DSglYWti.js +0 -1
  1317. package/frontend/build/static/aggregateFeatureMetrics-B7oOoe9g.js +0 -1
  1318. package/frontend/build/static/howToApplyReleaseTemplates-CkjJPTRh.png +0 -0
  1319. package/frontend/build/static/howToApplyReleaseTemplatesDark-CfwfIMua.png +0 -0
  1320. package/frontend/build/static/index-D02pkj6r.js +0 -542
  1321. package/frontend/build/static/merge-C7IT0rZd.svg +0 -3
  1322. package/frontend/build/static/metricsFormatters-7MLBOEud.js +0 -1
  1323. package/frontend/build/static/style-BW9ZTER3.css +0 -1
  1324. package/frontend/build/static/useApiTokens-wTDjjd8a.js +0 -1
@@ -0,0 +1,38 @@
1
+ import{dJ as yo,j as e,dK as ve,dL as xn,dM as gn,dN as De,aC as se,aD as ne,ax as ue,dO as bo,dP as So,dQ as Qa,dR as Xa,dS as Yt,dT as ei,x as vo,dU as ti,s as u,bR as si,e as K,bc as W,bt as Ce,r as d,cY as Jt,bK as Ee,dV as Co,dW as Fs,h as V,dX as Pe,A as wo,l as X,C as T,dY as To,ba as Kt,b9 as te,dZ as ni,d_ as ko,bb as ce,d$ as Ge,dw as f,e0 as re,e1 as me,F as Zt,u as ge,e2 as ot,V as J,I as oi,S as ai,M as ze,i as N,aY as Q,T as A,e3 as Eo,cm as we,L as oe,B as M,cJ as Gs,dp as Ws,e4 as at,e5 as ii,c$ as it,d0 as _,e6 as zs,aE as Ye,E as rt,e7 as Je,e8 as Hs,e9 as kt,ea as Ao,eb as Ro,ec as ri,ed as li,d as qs,ee as ci,ef as Vs,eg as di,N as Ie,eh as ui,ac as z,ad as fe,ak as ae,ae as hi,af as pi,ag as Ys,ah as Tt,ai as mi,ay as le,ei as je,D as Oe,ej as xi,bd as gi,G as lt,H as ct,ek as tt,cM as Qt,cf as Xt,bp as es,cN as ts,el as ji,au as Et,em as ee,bs as Do,en as fi,eo as Io,ep as Po,eq as de,bv as Lo,cg as jn,er as Bo,es as Uo,J as $o,y as Te,a_ as Oo,a$ as _o,b0 as bs,b1 as At,b2 as Wt,b3 as Le,bm as yi,bn as bi,b4 as ss,et as Si,eu as Js,b8 as fn,ev as Ht,ew as vi,ex as Ci,ey as wi,ez as Ti,eA as ki,eB as Ss,m as ns,n as Ei,o as Ai,eC as Ke,an as Se,ap as ye,bC as Mo,d1 as os,eD as No,at as Fo,al as xe,dv as Be,eE as Ks,bh as as,eF as Ri,az as Ne,w as Ze,dI as Di,t as Ii,eG as Pi,eH as Li,c7 as st,eI as Bi,eJ as Ui,aQ as is,eK as Zs,ar as $i,b as Rt,eL as Me,eM as Oi,aw as dt,cG as Ue,eN as _i,eO as Mi,eP as Ni,eQ as Fi,db as yn,eR as Go,v as Gi,as as Qs,eS as Wi,dy as ut,dl as Wo,dm as zo,av as Ho,eT as bn,eU as $e,eV as nt,eW as Sn,eX as zi,eY as Hi,eZ as qo,e_ as qi,e$ as Vo,f0 as Vi,f1 as Yi,d3 as Ji,f2 as Ki,f3 as Zi,f4 as Qi,f5 as Yo,aj as Jo,f6 as Xi,ao as Dt,f7 as vn,f8 as er,f9 as Ko,fa as qt,fb as Zo,fc as tr,cK as Xs,fd as sr,fe as Cn,ff as rs,fg as vs,fh as nr,fi as or,fj as ar,aT as Qo,b5 as ir,fk as rr,fl as ls,fm as Xo,fn as lr,fo as cr,fp as dr,fq as ur,fr as hr,fs as pr,ft as mr,dF as xr,dG as gr,fu as jr,cQ as ea,fv as ta,K as sa,fw as na,aq as fr,dA as yr,aA as br,dC as wn,fx as oa,fy as aa,fz as Sr,fA as vr,fB as Cr,fC as ia,fD as wr,fE as Tr,fF as kr,fG as Er,fH as Ar}from"./index-BAMIkcom.js";import{u as Rr,C as Dr,A as Ir,a as Pr,R as Lr,S as Br,T as Ur,b as $r,c as Or,d as _r,e as Mr,E as Nr,f as Fr,m as Gr,g as It,h as cs,i as en}from"./RoleCell-Da0TjMne.js";import{u as ds}from"./useApiTokens-Btk4Hd2u.js";import{P as Wr}from"./PercentageDonut-BoaVP9ed.js";const zr=()=>{const{tokens:t,loading:s,refetch:n}=ds(),{deleteToken:o}=yo(),{headerGroups:a,rows:i,prepareRow:r,state:{globalFilter:l},setGlobalFilter:c,setHiddenColumns:m,columns:p}=Rr(t,h=>{const g=h.row.original.type==="client"?xn:h.row.original.type==="frontend"?gn:De,x=h.row.original.type==="client"?Qa:h.row.original.type==="frontend"?Xa:De;return e.jsxs(Yt,{children:[e.jsx(Pr,{token:h.row.original,permission:g}),e.jsx(Lr,{token:h.row.original,permission:x,onRemove:async()=>{await o(h.row.original.secret),n()}})]})});return e.jsx(ve,{permissions:[xn,gn,De],children:e.jsx(se,{header:e.jsx(ne,{title:`API access (${i.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:l,onChange:c}),e.jsx(ne.Divider,{}),e.jsx(Dr,{permission:[bo,So,De],path:"/admin/api/create-token"})]})}),children:e.jsx(Ir,{loading:s,headerGroups:a,setHiddenColumns:m,prepareRow:r,rows:i,columns:p,globalFilter:l})})})},Hr=({type:t,projects:s,setProjects:n,errors:o,clearErrors:a})=>{const i=ei("projectId"),{projects:r}=vo(),l=r.map(c=>({value:c.id,label:c.name}));return i?null:e.jsxs(e.Fragment,{children:[e.jsx(Br,{children:"Which project do you want to give access to?"}),e.jsx(ti,{disabled:t===Ur.ADMIN,options:l,defaultValue:s,onChange:n,error:o==null?void 0:o.projects,onFocus:()=>a("projects")})]})},Tn="Create API token",qr=u(si)(({theme:t})=>({margin:t.spacing(2,0,4)})),Vr=()=>{const{tokens:t,loading:s}=ds(),{uiConfig:n,loading:o}=W(),a=n.resourceLimits.apiTokens;return{limit:a,currentValue:t.length,limitReached:t.length>=a,loading:o||s}},Yr=({modal:t=!1})=>{const{setToastApiError:s}=K(),{uiConfig:n}=W(),o=Ce(),[a,i]=d.useState(!1),[r,l]=d.useState(""),{limit:c,currentValue:m,limitReached:p,loading:h}=Vr(),{getApiTokenPayload:g,tokenName:x,type:j,projects:y,environment:b,setTokenName:C,setTokenType:k,setProjects:S,setEnvironment:R,isValid:v,errors:P,clearErrors:B,apiTokenTypes:w}=$r(),{createToken:H,loading:I}=yo(),{refetch:U}=ds();Jt(Tn);const E="api/admin/api-tokens",D=async $=>{if($.preventDefault(),!!v())try{const G=g();await H(G).then(F=>F.json()).then(F=>{Fs(),l(F.secret),i(!0),U()})}catch(G){s(V(G))}},L=()=>{i(!1),o(Pe)},O=()=>`curl --location --request POST '${n.unleashUrl}/${E}' \\
2
+ --header 'Authorization: INSERT_API_KEY' \\
3
+ --header 'Content-Type: application/json' \\
4
+ --data-raw '${JSON.stringify(g(),void 0,2)}'`,Y=()=>{o(Pe)};return e.jsxs(Ee,{loading:I,title:Tn,modal:t,description:"Unleash SDKs use API tokens to authenticate with the Unleash API. An SDK must be configured with a token of the corresponding type, so they can fetch feature flags and post usage metrics.",documentationLink:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys",documentationLinkLabel:"API tokens documentation",formatApiCode:O,children:[e.jsxs(Or,{handleSubmit:D,handleCancel:Y,mode:"Create",actions:e.jsx(Co,{name:"token",permission:[De,So,bo],disabled:p||h||I}),children:[e.jsx(_r,{tokenName:x,setTokenName:C,errors:P,clearErrors:B}),e.jsx(Mr,{type:j,setType:k,apiTokenTypes:w}),e.jsx(Hr,{type:j,projects:y,setProjects:S,errors:P,clearErrors:B}),e.jsx(Nr,{type:j,environment:b,setEnvironment:R}),e.jsx(qr,{name:"API tokens",shortName:"tokens",currentValue:m,limit:c})]}),e.jsx(Fr,{open:a,setOpen:i,closeConfirm:L,token:r,type:j})]})},Jr=u("div")(({theme:t})=>({display:"flex",flexDirection:"column","& > span:last-of-type":{fontSize:t.fontSizes.smallerBody,color:t.palette.text.secondary}})),us=({roles:t,value:s,setValue:n,required:o,hideDescription:a,...i})=>{const r=(l,c)=>e.jsx("li",{...l,children:e.jsxs(Jr,{children:[e.jsx("span",{children:c.name}),e.jsx("span",{children:c.description})]})});return e.jsxs(e.Fragment,{children:[e.jsx(wo,{openOnFocus:!0,size:"small",value:s,onChange:(l,c)=>n(c||null),options:t,renderOption:r,getOptionLabel:l=>l.name,renderInput:l=>e.jsx(X,{...l,label:"Role",required:o}),...i}),e.jsx(T,{condition:!!s&&!a,show:()=>e.jsx(To,{sx:{marginTop:1},roleId:s.id})})]})},Pt=()=>{const{isEnterprise:t}=W(),{data:s,error:n,mutate:o}=Kt(t(),{roles:[],projectRoles:[]},te("api/admin/roles"),Kr);return d.useMemo(()=>({roles:(s==null?void 0:s.roles.filter(({type:a})=>ni.includes(a)).sort(kn))??[],projectRoles:(s==null?void 0:s.roles.filter(({type:a})=>ko.includes(a)).sort(kn))??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},Kr=t=>fetch(t).then(ce("Roles")).then(s=>s.json()),kn=(t,s)=>Ge.includes(t.type)&&!Ge.includes(s.type)?-1:!Ge.includes(t.type)&&Ge.includes(s.type)?1:t.name.localeCompare(s.name),ra=({data:t={enabled:!1,autoCreate:!1},setValue:s,onUpdateRole:n,disabled:o=!1})=>{const{roles:a}=Pt(),i=()=>{s("autoCreate",!t.autoCreate)},r=c=>{s(c.target.name,c.target.value)},l=({defaultRootRole:c,defaultRootRoleId:m})=>m?a.find(({id:p})=>p===m)||null:a.find(({name:p})=>p===c)||null;return e.jsxs(d.Fragment,{children:[e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Auto-create users"}),e.jsx("p",{children:"Enable automatic creation of new users when signing in."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:i,name:"enabled",checked:t.autoCreate,disabled:!t.enabled||o}),label:"Auto-create users"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Default Root Role"}),e.jsx("p",{children:"Choose which root role the user should get when no explicit role mapping exists."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(Zt,{style:{width:"400px"},children:e.jsx(us,{roles:a,value:l(t),setValue:n,disabled:!t.autoCreate||!t.enabled||o,required:!0,hideDescription:!0})})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Email domains"}),e.jsx("p",{children:"Comma separated list of email domains that should be allowed to sign in."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:r,label:"Email domains",name:"emailDomains",disabled:!t.autoCreate||!t.enabled||o,required:!!t.autoCreate,value:t.emailDomains||"",placeholder:"@company.com, @anotherCompany.com",style:{width:"400px"},rows:2,variant:"outlined",size:"small"})})]})]})},Zr=async(t,s)=>{var n,o;if(t){if(s){const a=await s.json(),i=((o=(n=a.details)==null?void 0:n[0])==null?void 0:o.message)??a.message;throw t({message:i}),new Error(i)}throw new Error}},hs=t=>{const{makeRequest:s,createRequest:n,errors:o,loading:a}=ge({propagateErrors:!0,handleBadRequest:Zr});return{updateSettings:async r=>{const l=`api/admin/auth/${t}/settings`,c=n(l,{method:"POST",body:JSON.stringify(r)});await s(c.caller,c.id)},errors:o,loading:a}},tn=t=>{const n=Object.entries(t).filter(([,o])=>o!=="");return Object.fromEntries(n)},la=({ssoType:t,data:s={enabled:!1,enableGroupSyncing:!1,groupJsonPath:"",addGroupsScope:!1},setValue:n,disabled:o=!1})=>{const a=()=>{n("enableGroupSyncing",!s.enableGroupSyncing)},i=l=>{n(l.target.name,l.target.value)},r=()=>{n("addGroupsScope",!s.addGroupsScope)};return e.jsxs(e.Fragment,{children:[e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Enable Group Syncing"}),e.jsxs("p",{children:["Enables automatically syncing of users from the"," ",t," provider when a user logs in."]})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:a,value:s.enableGroupSyncing,name:"enableGroupSyncing",checked:s.enableGroupSyncing,disabled:!s.enabled||o}),label:s.enableGroupSyncing?"Enabled":"Disabled"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Group Field JSON Path"}),e.jsxs("p",{children:["Specifies the path in the ",t," token response from which to read the groups the user belongs to."]})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:i,label:"Group JSON Path",name:"groupJsonPath",value:s.groupJsonPath,disabled:!s.enableGroupSyncing||o,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsx(T,{condition:t==="OIDC",show:e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Request 'groups' Scope"}),e.jsx("p",{children:"When enabled Unleash will also request the 'groups' scope as part of the login request."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:r,value:s.addGroupsScope,disabled:!s.enableGroupSyncing||o,name:"addGroupsScope",checked:s.addGroupsScope}),label:s.addGroupsScope?"Enabled":"Disabled"})})]})})]})},Qr={enabled:!1,enableSingleSignOut:!1,addGroupsScope:!1,enableGroupSyncing:!1,autoCreate:!1,unleashHostname:location.hostname,groupJsonPath:"",clientId:"",discoverUrl:"",secret:"",acrValues:"",idTokenSigningAlgorithm:"RS256",enablePkce:!1},Xr=()=>{var k;const{setToastData:t,setToastApiError:s}=K(),{uiConfig:n}=W(),{oidcConfiguredThroughEnv:o}=n,a=!!((k=n.flags)!=null&&k.oidcPkceSupport),[i,r]=d.useState(Qr),{config:l}=ot("oidc"),{updateSettings:c,errors:m,loading:p}=hs("oidc");d.useEffect(()=>{l.discoverUrl&&r(l)},[l]);const h=S=>{y(S.target.name,S.target.value)},g=S=>{y(S.target.name,S.target.value.trim())},x=()=>{r({...i,enabled:!i.enabled})},j=()=>{r({...i,enableSingleSignOut:!i.enableSingleSignOut})},y=(S,R)=>{r({...i,[S]:R})},b=S=>{r({...i,defaultRootRole:void 0,defaultRootRoleId:S==null?void 0:S.id})},C=async S=>{S.preventDefault();try{await c(tn(i)),t({text:"Settings stored",type:"success"})}catch(R){s(V(R))}};return e.jsxs(e.Fragment,{children:[e.jsx(f,{container:!0,sx:{mb:3},children:e.jsxs(f,{item:!0,md:12,children:[e.jsx(T,{condition:!!o,show:e.jsxs(J,{sx:{mb:2},severity:"warning",children:["OIDC is currently configured via environment variables. Please refer to the"," ",e.jsx("a",{href:"https://www.unleash-hosted.com/docs/enterprise-authentication",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for detailed instructions on how to set up OIDC using these variables."]})}),e.jsxs(J,{severity:"info",children:["Please read the"," ",e.jsx("a",{href:"https://www.unleash-hosted.com/docs/enterprise-authentication",target:"_blank",rel:"noreferrer",children:"documentation"})," ","to learn how to integrate with specific OpenID Connect providers (such as Okta and Keycloak). ",e.jsx("br",{}),"Callback URL:"," ",e.jsxs("code",{children:[n.unleashUrl,"/auth/oidc/callback"]})]})]})}),e.jsxs("form",{onSubmit:C,children:[e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Enable"}),e.jsx("p",{children:"Enable Open Id Connect Authentication."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:x,value:i.enabled,name:"enabled",checked:i.enabled}),label:i.enabled?"Enabled":"Disabled",disabled:o})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Discover URL"}),e.jsx("p",{children:"(Required) Issuer discover metadata URL"})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:g,label:"Discover URL",name:"discoverUrl",value:i.discoverUrl,disabled:!i.enabled||o,style:{width:"400px"},variant:"outlined",size:"small"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Client ID"}),e.jsx("p",{children:"(Required) Client ID of your OpenID application"})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:g,label:"Client ID",name:"clientId",value:i.clientId,disabled:!i.enabled||o,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsxs(f,{container:!0,spacing:3,mb:4,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Client secret"}),e.jsxs("p",{children:["(Required) Client secret of your OpenID application."," "]})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:g,label:"Client Secret",name:"secret",value:i.secret,disabled:!i.enabled||o,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsx("h3",{children:"Optional Configuration"}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Enable Single Sign-Out"}),e.jsx("p",{children:"If you enable Single Sign-Out Unleash will redirect the user to the IDP as part of the Sign-out process."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:j,value:i.enableSingleSignOut,disabled:!i.enabled||o,name:"enableSingleSignOut",checked:i.enableSingleSignOut}),label:i.enableSingleSignOut?"Enabled":"Disabled"})})]}),e.jsx(T,{condition:a,show:e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Enable PKCE"}),e.jsx("p",{children:"Require Proof Key for Code Exchange (PKCE) to add an extra layer of security for the authorization code flow."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:S=>y("enablePkce",S.target.checked),name:"enablePkce",checked:!!i.enablePkce,disabled:!i.enabled||o}),label:i.enablePkce?"Enabled":"Disabled"})})]})}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"ACR Values"}),e.jsx("p",{children:'Requested Authentication Context Class Reference values. If multiple values are specified they should be "space" separated. Will be sent as "acr_values" as part of the authentication request. Unleash will validate the acr value in the id token claims against the list of acr values.'})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:h,label:"ACR Values",name:"acrValues",value:i.acrValues,disabled:!i.enabled||o,style:{width:"400px"},variant:"outlined",size:"small"})})]}),e.jsx(la,{ssoType:"OIDC",data:i,setValue:y,disabled:o}),e.jsx(ra,{data:i,setValue:y,onUpdateRole:b,disabled:o}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"ID Signing algorithm"}),e.jsxs("p",{children:["Which signing algorithm to use. ",e.jsx("br",{}),' Leave this alone unless you see errors that look like "unexpected JWT alg received, expected RS256, got: RS512" in your logs.']})]}),e.jsx(f,{item:!0,md:6,children:e.jsxs(Zt,{style:{minWidth:"200px"},children:[e.jsx(oi,{id:"defaultRootRole-label",children:"Signing algorithm"}),e.jsxs(ai,{label:"Signing algorithm",labelId:"idTokenSigningAlgorithm-label",id:"idTokenSigningAlgorithm",name:"idTokenSigningAlgorithm",value:i.idTokenSigningAlgorithm||"RS256",onChange:S=>y("idTokenSigningAlgorithm",S.target.value),disabled:o,children:[e.jsx(ze,{value:"RS256",children:"RS256"}),e.jsx(ze,{value:"RS384",children:"RS384"}),e.jsx(ze,{value:"RS512",children:"RS512"})]})]})})]}),e.jsx(f,{container:!0,spacing:3,children:e.jsxs(f,{item:!0,md:12,children:[e.jsx(N,{variant:"contained",color:"primary",type:"submit",disabled:p||o,children:"Save"})," ",e.jsx("p",{children:e.jsx("small",{style:{color:"red"},children:m==null?void 0:m.message})})]})})]})]})},el={enabled:!1,autoCreate:!1,enableGroupSyncing:!1,addGroupsScope:!1,unleashHostname:location.hostname,entityId:"",signOnUrl:"",certificate:"",signOutUrl:"",spCertificate:"",groupJsonPath:""},tl=()=>{const{setToastData:t,setToastApiError:s}=K(),{uiConfig:n}=W(),{samlConfiguredThroughEnv:o}=n,[a,i]=d.useState(el),{config:r}=ot("saml"),{updateSettings:l,errors:c,loading:m}=hs("saml");d.useEffect(()=>{r.entityId&&i(r)},[r]);const p=b=>{x(b.target.name,b.target.value)},h=b=>{x(b.target.name,b.target.value.trim())},g=()=>{i({...a,enabled:!a.enabled})},x=(b,C)=>{i({...a,[b]:C})},j=b=>{i({...a,defaultRootRole:void 0,defaultRootRoleId:b==null?void 0:b.id})},y=async b=>{b.preventDefault();try{await l(tn(a)),t({text:"Settings stored",type:"success"})}catch(C){s(V(C))}};return e.jsxs(e.Fragment,{children:[e.jsx(f,{container:!0,sx:{mb:3},children:e.jsxs(f,{item:!0,md:12,children:[e.jsx(T,{condition:!!o,show:e.jsxs(J,{sx:{mb:2},severity:"warning",children:["SAML is currently configured via environment variables. Please refer to the"," ",e.jsx("a",{href:"https://www.unleash-hosted.com/docs/enterprise-authentication",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for detailed instructions on how to set up SAML using these variables."]})}),e.jsxs(J,{severity:"info",children:["Please read the"," ",e.jsx("a",{href:"https://www.unleash-hosted.com/docs/enterprise-authentication",target:"_blank",rel:"noreferrer",children:"documentation"})," ","to learn how to integrate with specific SAML 2.0 providers (such as Okta, Keycloak, and Microsoft Entra ID). ",e.jsx("br",{}),"Callback URL:"," ",e.jsxs("code",{children:[n.unleashUrl,"/auth/saml/callback"]})]})]})}),e.jsxs("form",{onSubmit:y,children:[e.jsxs(f,{container:!0,spacing:3,children:[e.jsxs(f,{item:!0,md:5,mb:2,children:[e.jsx("strong",{children:"Enable"}),e.jsx("p",{children:"Enable SAML 2.0 Authentication."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(re,{control:e.jsx(me,{onChange:g,value:a.enabled,name:"enabled",checked:a.enabled,disabled:o}),label:a.enabled?"Enabled":"Disabled"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Entity ID"}),e.jsx("p",{children:"(Required) The Entity Identity provider issuer."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:h,label:"Entity ID",name:"entityId",value:a.entityId,disabled:!a.enabled||o,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Single Sign-On URL"}),e.jsx("p",{children:"(Required) The url to redirect the user to for signing in."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:h,label:"Single Sign-On URL",name:"signOnUrl",value:a.signOnUrl,disabled:!a.enabled||o,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsxs(f,{container:!0,spacing:3,mb:4,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"X.509 Certificate"}),e.jsx("p",{children:"(Required) The certificate used to sign the SAML 2.0 request."})]}),e.jsx(f,{item:!0,md:7,children:e.jsx(X,{onChange:p,label:"X.509 Certificate",name:"certificate",value:a.certificate,disabled:!a.enabled||o,style:{width:"100%"},InputProps:{style:{fontSize:"0.6em",fontFamily:"monospace"}},multiline:!0,rows:14,maxRows:14,variant:"outlined",size:"small",required:!0})})]}),e.jsx("h3",{children:"Optional Configuration"}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Single Sign-out URL"}),e.jsx("p",{children:"(Optional) The url to redirect the user to for signing out of the IDP."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:h,label:"Single Sign-out URL",name:"signOutUrl",value:a.signOutUrl,disabled:!a.enabled||o,style:{width:"400px"},variant:"outlined",size:"small"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Service Provider X.509 Certificate"}),e.jsx("p",{children:"(Optional) The private certificate used by the Service Provider used to sign the SAML 2.0 request towards the IDP. E.g. used to sign single logout requests (SLO)."})]}),e.jsx(f,{item:!0,md:7,children:e.jsx(X,{onChange:p,label:"X.509 Certificate",name:"spCertificate",value:a.spCertificate,disabled:!a.enabled||o,style:{width:"100%"},InputProps:{style:{fontSize:"0.6em",fontFamily:"monospace"}},multiline:!0,rows:14,maxRows:14,variant:"outlined",size:"small"})})]}),e.jsx(la,{ssoType:"SAML",data:a,setValue:x,disabled:o}),e.jsx(ra,{data:a,setValue:x,onUpdateRole:j,disabled:o}),e.jsx(f,{container:!0,spacing:3,children:e.jsxs(f,{item:!0,md:5,children:[e.jsx(N,{variant:"contained",color:"primary",type:"submit",disabled:m||o,children:"Save"})," ",e.jsx("p",{children:e.jsx("small",{style:{color:"red"},children:c==null?void 0:c.message})})]})})]})]})},sl=u(J)(({theme:t})=>({marginBottom:t.spacing(3)})),nl=({open:t,setOpen:s,onConfirm:n})=>e.jsx(Q,{open:t,secondaryButtonText:"Close",onClose:(o,a)=>{a||s(!1)},primaryButtonText:"Generate new token",onClick:n,title:"Generate new SCIM API token?",children:e.jsxs(sl,{severity:"error",children:["Generating a new token will ",e.jsx("strong",{children:"immediately revoke"})," the current one, which may break any existing provision integrations currently using it."]})}),ol=u(J)(({theme:t})=>({marginBottom:t.spacing(3)})),al=({open:t,setOpen:s,token:n})=>e.jsxs(Q,{open:t,secondaryButtonText:"Close",onClose:(o,a)=>{a||s(!1)},title:"SCIM API token created",children:[e.jsx(ol,{severity:"info",children:"Make sure to copy your SCIM API token now. You won't be able to see it again!"}),e.jsx(A,{variant:"body1",children:"Your token:"}),e.jsx(Eo,{token:n||""})]}),En="api/admin/scim-settings",il=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0});return{saveSettings:async r=>{const c=n(En,{method:"POST",body:JSON.stringify(r)},"saveSettings");await s(c.caller,c.id)},generateNewToken:async()=>{const l=n(`${En}/generate-new-token`,{method:"POST"},"generateNewToken"),c=await s(l.caller,l.id),{token:m}=await c.json();return m},errors:o,loading:t}},rl="api/admin/scim-settings",An={enabled:!1,hasToken:!1},Lt=()=>{const{isEnterprise:t}=W(),{data:s,error:n,mutate:o}=Kt(t(),An,te(rl),ll);return d.useMemo(()=>({settings:s??An,loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},ll=t=>fetch(t).then(ce("SCIM settings")).then(s=>s.json());u(J)(({theme:t})=>({marginBottom:t.spacing(3)}));const Rn=({open:t,closeDialog:s,deleteEntities:n,entityType:o})=>e.jsx(Q,{open:t,primaryButtonText:`Delete SCIM ${o}`,secondaryButtonText:"Cancel",title:`Do you really want to delete ALL SCIM ${o}?`,onClose:s,onClick:n,children:e.jsxs(A,{variant:"body1",children:["This will delete all ",o.toLocaleLowerCase()," created or managed by SCIM."]})}),Vt="removeUser",Qe=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0});return{addUser:async h=>{const x=n("api/admin/user-admin",{method:"POST",body:JSON.stringify(h)},"addUser");return s(x.caller,x.id)},updateUser:async h=>{const x=n(`api/admin/user-admin/${h.id}`,{method:"PUT",body:JSON.stringify(h)},"updateUser");return s(x.caller,x.id)},removeUser:async h=>{const x=n(`api/admin/user-admin/${h}`,{method:"DELETE"},"removeUser");return s(x.caller,x.id)},changePassword:async(h,g)=>{const j=n(`api/admin/user-admin/${h}/change-password`,{method:"POST",body:JSON.stringify({password:g})},"changePassword");return s(j.caller,j.id)},validatePassword:async h=>{const x=n("api/admin/user-admin/validate-password",{method:"POST",body:JSON.stringify({password:h})},"validatePassword");return s(x.caller,x.id)},resetPassword:async h=>{const x=n("api/admin/user-admin/reset-password",{method:"POST",body:JSON.stringify({id:h})},"resetPassword");return s(x.caller,x.id)},deleteScimUsers:async()=>{const g=n("api/admin/user-admin/scim-users",{method:"DELETE"},"deleteScimUsers");return s(g.caller,g.id)},userApiErrors:o,userLoading:t}},ht=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0});return{createGroup:async c=>{const p=s("api/admin/groups",{method:"POST",body:JSON.stringify(c)});return(await t(p.caller,p.id)).json()},updateGroup:async(c,m)=>{const p=`api/admin/groups/${c}`,h=s(p,{method:"PUT",body:JSON.stringify(m)});await t(h.caller,h.id)},removeGroup:async c=>{const m=`api/admin/groups/${c}`,p=s(m,{method:"DELETE"});await t(p.caller,p.id)},deleteScimGroups:async()=>{const m=s("api/admin/groups/scim-groups",{method:"DELETE"});await t(m.caller,m.id)},errors:n,loading:o}},cl=u("div")(({theme:t})=>({padding:t.spacing(3),border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge})),Cs=u("div")(({theme:t})=>({marginBottom:t.spacing(1)})),dl=()=>{const{uiConfig:t}=W(),{setToastData:s,setToastApiError:n}=K(),[o,a]=d.useState(""),[i,r]=d.useState(!1),[l,c]=d.useState(!1),[m,p]=d.useState(!1),[h,g]=d.useState(!1),{settings:x,refetch:j}=Lt(),{deleteScimUsers:y}=Qe(),{deleteScimGroups:b}=ht(),[C,k]=d.useState(x.enabled??!0);d.useEffect(()=>{k(x.enabled??!1)},[x]);const{saveSettings:S,generateNewToken:R,errors:v,loading:P}=il(),B=async()=>{r(!0)},w=async()=>{try{await b(),s({text:"Scim Groups have been deleted",type:"success"}),c(!1),j()}catch(E){n(V(E))}},H=async()=>{try{await y(),s({text:"Scim Users have been deleted",type:"success"}),p(!1),j()}catch(E){n(V(E))}},I=async()=>{r(!1);const E=await R();a(E),g(!0)},U=async E=>{try{if(k(E),await S({enabled:E}),E&&!x.hasToken){const D=await R();a(D),g(!0)}s({text:"Settings stored",type:"success"}),await j()}catch(D){n(V(D))}};return e.jsxs(e.Fragment,{children:[e.jsx(f,{container:!0,sx:{mb:3},children:e.jsx(f,{item:!0,md:12,children:e.jsxs(J,{severity:"info",children:["Please read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/concepts/scim",target:"_blank",rel:"noreferrer",children:"documentation"})," ","to learn how to integrate with specific SCIM clients (Microsoft Entra, Okta, etc). ",e.jsx("br",{}),"SCIM API URL: ",e.jsxs("code",{children:[t.unleashUrl,"/scim"]})]})})}),e.jsxs(cl,{children:[e.jsxs(f,{container:!0,spacing:3,children:[e.jsxs(f,{item:!0,md:10.5,mb:2,children:[e.jsx(Cs,{children:e.jsx("strong",{children:"SCIM provisioning"})}),e.jsx("p",{children:"Enables SCIM provisioning. If SCIM provisioning has not previously been enabled here this will also set up a new auth token to use with your SCIM client, and display it to the user. After the dialog has been closed, this token will not be displayed again. If you need a new token you can click the Generate new token button below which will replace the old token with a new token, and similarly display the new token one time to the user."})]}),e.jsx(f,{item:!0,md:1.5,children:e.jsx(re,{control:e.jsx(me,{onChange:(E,D)=>{U(D)},value:C,name:"enabled",checked:C}),label:C?"Enabled":"Disabled"})})]}),e.jsx(f,{container:!0,spacing:3,children:e.jsx(f,{item:!0,md:5,mb:2,children:e.jsx(T,{condition:!!x.hasToken,show:e.jsx(N,{variant:"outlined",color:"error",disabled:P,onClick:B,children:"Generate new token"})})})}),e.jsxs(f,{container:!0,spacing:3,children:[e.jsxs(f,{item:!0,md:10.5,mb:2,children:[e.jsx(Cs,{children:e.jsx("strong",{children:"Delete SCIM Users"})}),e.jsx("p",{children:"This will remove all SCIM users from the Unleash database. This action cannot be undone through Unleash but the upstream SCIM provider may re sync these users."})]}),e.jsx(f,{item:!0,md:1.5,children:e.jsx(N,{variant:"outlined",color:"error",disabled:P,onClick:()=>{p(!0)},children:"Delete Users"})}),e.jsxs(f,{item:!0,md:10.5,mb:2,children:[e.jsx(Cs,{children:e.jsx("strong",{children:"Delete SCIM Groups"})}),e.jsx("p",{children:"This will remove all SCIM groups from the Unleash database. This action cannot be undone through Unleash but the upstream SCIM provider may re sync these groups. Note that this may affect the permissions of users present in those groups."})]}),e.jsx(f,{item:!0,md:1.5,children:e.jsx(N,{variant:"outlined",color:"error",disabled:P,onClick:()=>{c(!0)},children:"Delete Groups"})})]}),e.jsx(nl,{open:i,setOpen:r,onConfirm:I}),e.jsx(al,{open:h,setOpen:g,token:o}),e.jsx(Rn,{open:m,closeDialog:()=>p(!1),deleteEntities:H,entityType:"Users"}),e.jsx(Rn,{open:l,closeDialog:()=>c(!1),deleteEntities:w,entityType:"Groups"})]})]})},ul=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/user-admin/admin-count"),hl);return{data:t,loading:!s&&!t,refetch:()=>n(),error:s}},hl=t=>fetch(t).then(ce("Admin count")).then(s=>s.json()),pl=({open:t,setOpen:s,onClick:n,adminCount:o,tokens:a})=>e.jsxs(Q,{open:t,onClose:()=>{s(!1)},onClick:n,title:"Disable password based login?",primaryButtonText:"Disable password based login",secondaryButtonText:"Cancel",children:[e.jsxs(J,{severity:"warning",children:[e.jsx("strong",{children:"Warning!"})," Disabling password based login may lock you out of the system permanently if you do not have any alternative admin credentials (such as an admin SSO account or admin API token) secured beforehand.",e.jsx("br",{}),e.jsx("br",{}),e.jsx("strong",{children:"Password based administrators: "})," ",o==null?void 0:o.password,e.jsx("br",{}),e.jsx("strong",{children:"Other administrators: "})," ",o==null?void 0:o.noPassword,e.jsx("br",{}),e.jsx("strong",{children:"Admin service accounts: "})," ",o==null?void 0:o.service,e.jsx("br",{}),e.jsx("strong",{children:"Admin API tokens: "})," ",a.filter(({type:i})=>i==="admin").length]}),e.jsx(A,{sx:{mt:3},children:"You are about to disable password based login. Are you sure you want to proceed?"})]}),ml=()=>{const{setToastData:t,setToastApiError:s}=K(),{config:n,refetch:o}=ot("simple"),[a,i]=d.useState(!1),{updateSettings:r,errors:l,loading:c}=hs("simple"),[m,p]=d.useState(!1),{data:h}=ul(),{tokens:g}=ds();d.useEffect(()=>{i(!!n.disabled)},[n.disabled]);const x=()=>{i(!a)},j=async b=>{b.preventDefault(),!n.disabled&&a?p(!0):y()},y=async()=>{try{await r({disabled:a}),o(),t({text:"Password authentication settings stored",autoHideDuration:4e3,type:"success",show:!0})}catch(b){s(V(b)),i(n.disabled)}};return e.jsx(e.Fragment,{children:e.jsxs("form",{onSubmit:j,children:[e.jsxs(J,{severity:"info",sx:{mb:3},children:["Overview of administrators on your Unleash instance:",e.jsx("br",{}),e.jsx("br",{}),e.jsx("strong",{children:"Password based administrators: "})," ",e.jsx(oe,{to:"/admin/users",children:h==null?void 0:h.password}),e.jsx("br",{}),e.jsx("strong",{children:"Other administrators: "})," ",e.jsx(oe,{to:"/admin/users",children:h==null?void 0:h.noPassword}),e.jsx("br",{}),e.jsx("strong",{children:"Admin service accounts: "})," ",e.jsx(oe,{to:"/admin/service-accounts",children:h==null?void 0:h.service}),e.jsx("br",{}),e.jsx("strong",{children:"Admin API tokens: "})," ",e.jsx(oe,{to:"/admin/api",children:g.filter(({type:b})=>b==="admin").length})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Password based login"}),e.jsx("p",{children:"Allow users to login with username & password"})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:x,value:!a,name:"disabled",checked:!a}),label:a?"Disabled":"Enabled"})})]}),e.jsx(f,{container:!0,spacing:3,children:e.jsxs(f,{item:!0,md:12,children:[e.jsx(N,{variant:"contained",color:"primary",type:"submit",disabled:c,children:"Save"})," ",e.jsx("p",{children:e.jsx("small",{style:{color:"red"},children:l==null?void 0:l.message})})]})}),e.jsx(pl,{open:m,setOpen:p,onClick:()=>{p(!1),y()},adminCount:h,tokens:g})]})})},xl={enabled:!1,autoCreate:!1,unleashHostname:location.hostname,clientId:"",clientSecret:"",emailDomains:""},gl=()=>{const{setToastData:t,setToastApiError:s}=K(),{uiConfig:n}=W(),[o,a]=d.useState(xl),{config:i}=ot("google"),{updateSettings:r,errors:l,loading:c}=hs("google");d.useEffect(()=>{i.clientId&&a(i)},[i]);const m=x=>{a({...o,[x.target.name]:x.target.value})},p=()=>{a({...o,enabled:!o.enabled})},h=()=>{a({...o,autoCreate:!o.autoCreate})},g=async x=>{x.preventDefault();try{await r(tn(o)),t({text:"Settings stored",type:"success"})}catch(j){s(V(j))}};return e.jsxs(e.Fragment,{children:[e.jsxs(M,{children:[e.jsxs(J,{severity:"error",sx:{mb:2},children:["This integration is deprecated and will be removed in next major version. Please use ",e.jsx("strong",{children:"OpenID Connect"})," to enable Google SSO."]}),e.jsxs(J,{severity:"info",sx:{mb:3},children:["Read the"," ",e.jsx("a",{href:"https://www.unleash-hosted.com/docs/enterprise-authentication/google",target:"_blank",rel:"noreferrer",children:"documentation"})," ","to learn how to integrate with Google OAuth 2.0. ",e.jsx("br",{}),"Callback URL:"," ",e.jsxs("code",{children:[n.unleashUrl,"/auth/google/callback"]})]})]}),e.jsxs("form",{onSubmit:g,children:[e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,xs:5,children:[e.jsx("strong",{children:"Enable"}),e.jsx("p",{children:"Enable Google users to login. Value is ignored if Client ID and Client Secret are not defined."})]}),e.jsx(f,{item:!0,xs:6,style:{padding:"20px"},children:e.jsx(re,{control:e.jsx(me,{onChange:p,value:o.enabled,name:"enabled",checked:o.enabled}),label:o.enabled?"Enabled":"Disabled"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,xs:5,children:[e.jsx("strong",{children:"Client ID"}),e.jsx("p",{children:"(Required) The Client ID provided by Google when registering the application."})]}),e.jsx(f,{item:!0,xs:6,children:e.jsx(X,{onChange:m,label:"Client ID",name:"clientId",placeholder:"",value:o.clientId,style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Client Secret"}),e.jsx("p",{children:"(Required) Client Secret provided by Google when registering the application."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:m,label:"Client Secret",name:"clientSecret",value:o.clientSecret,placeholder:"",style:{width:"400px"},variant:"outlined",size:"small",required:!0})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Unleash hostname"}),e.jsxs("p",{children:["(Required) The hostname you are running Unleash on that Google should send the user back to. The final callback URL will be"," ",e.jsx("small",{children:e.jsx("code",{children:"https://[unleash.hostname.com]/auth/google/callback"})})]})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:m,label:"Unleash Hostname",name:"unleashHostname",placeholder:"",value:o.unleashHostname||"",style:{width:"400px"},variant:"outlined",size:"small"})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Auto-create users"}),e.jsx("p",{children:"Enable automatic creation of new users when signing in with Google."})]}),e.jsx(f,{item:!0,md:6,style:{padding:"20px"},children:e.jsx(me,{onChange:h,name:"enabled",checked:o.autoCreate})})]}),e.jsxs(f,{container:!0,spacing:3,mb:2,children:[e.jsxs(f,{item:!0,md:5,children:[e.jsx("strong",{children:"Email domains"}),e.jsx("p",{children:"(Optional) Comma separated list of email domains that should be allowed to sign in."})]}),e.jsx(f,{item:!0,md:6,children:e.jsx(X,{onChange:m,label:"Email domains",name:"emailDomains",value:o.emailDomains,placeholder:"@company.com, @anotherCompany.com",style:{width:"400px"},rows:2,multiline:!0,variant:"outlined",size:"small"})})]}),e.jsx(f,{container:!0,spacing:3,children:e.jsxs(f,{item:!0,md:5,children:[e.jsx(N,{variant:"contained",color:"primary",type:"submit",disabled:c,children:"Save"})," ",e.jsx("p",{children:e.jsx("small",{style:{color:"error.dark"},children:l==null?void 0:l.message})})]})})]})]})},jl=()=>{var i;const{isEnterprise:t}=W(),s=Gs("googleAuthEnabled"),n=[{label:"Single sign-on: OpenID Connect",path:"/admin/auth/oidc"},{label:"Single sign-on: SAML 2.0",path:"/admin/auth/saml"},{label:"Password login",path:"/admin/auth/password"},{label:"Single sign-on: Google",path:"/admin/auth/google"},{label:"Single sign-on: SCIM",path:"/admin/auth/scim"}],{pathname:o}=Ws(),a=((i=n.find(r=>o===r.path))==null?void 0:i.label)||"Single sign-on: OpenID Connect";return Jt(a),t()?e.jsx("div",{children:e.jsx(ve,{permissions:[De,ii],children:e.jsx(se,{header:a,children:e.jsxs(it,{children:[e.jsx(_,{path:"/",index:!0,element:e.jsx(zs,{to:"/admin/auth/oidc"})}),e.jsx(_,{path:"/oidc",index:!0,element:e.jsx(Xr,{})}),e.jsx(_,{path:"/saml",element:e.jsx(tl,{})}),e.jsx(_,{path:"/password",element:e.jsx(ml,{})}),s&&e.jsx(_,{path:"/google",element:e.jsx(gl,{})}),e.jsx(_,{path:"/scim",element:e.jsx(dl,{})})]})})})}):e.jsx(at,{feature:"sso",page:!0})},fl=te("api/admin/invoices"),yl=u(N)(({theme:t})=>({width:"100%",marginBottom:t.spacing(1.5)})),bl=({update:t})=>e.jsx(yl,{href:`${fl}/${t?"portal":"checkout"}`,variant:t?"outlined":"contained",children:t?"Update billing information":"Add billing information"}),Dn=u(Ye)(({theme:t})=>({padding:t.spacing(4),height:"100%",borderRadius:t.shape.borderRadiusLarge,backgroundColor:t.palette.background.paper})),Sl=u(A)(({theme:t})=>({marginBottom:t.spacing(4)})),vl=u(J)(({theme:t})=>({marginBottom:t.spacing(4)})),ws=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary})),Cl=u(rt)(({theme:t})=>({margin:`${t.spacing(2.5)} 0`,borderColor:t.palette.divider})),wl=()=>{const{instanceStatus:t}=Je(),{uiConfig:{billing:s}}=W(),n=s==="pay-as-you-go";if(!t)return e.jsx(f,{item:!0,xs:12,md:5,children:e.jsx(Dn,{"data-loading":!0,sx:{flex:1,height:"400px"}})});const o=`${t.plan}${n?" Pay-as-You-Go":""}`,a=t.state!==Hs.ACTIVE,{isCustomBilling:i}=t;return e.jsx(f,{item:!0,xs:12,md:5,children:e.jsxs(Dn,{children:[e.jsx(Sl,{variant:"body1",children:"Billing information"}),e.jsx(T,{condition:!!i,show:e.jsx(ws,{children:"Your billing is managed by Unleash"}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:a,show:e.jsxs(vl,{severity:"warning",children:["In order to"," ",e.jsx("strong",{children:"Upgrade trial"})," you need to provide us your billing information."]})}),e.jsx(bl,{update:!a}),e.jsx(ws,{children:a?"Once we have received your billing information we will upgrade your trial within 1 business day":"Update your credit card and business information and change which email address we send invoices to"})]})}),e.jsx(Cl,{}),e.jsxs(ws,{children:[e.jsx("a",{href:`mailto:support@getunleash.io?subject=${o} plan clarifications`,children:"Get in touch with us"})," ","for any clarification"]})]})})},Tl=u(f)(({theme:t})=>({flexWrap:"nowrap",gap:t.spacing(1)})),ke=({sx:t,children:s})=>e.jsx(Tl,{container:!0,item:!0,justifyContent:"space-between",alignItems:"center",sx:t,children:s}),ie=({children:t,vertical:s=!1})=>e.jsx(f,{container:s,item:!0,display:"flex",alignItems:s?"start":"center",direction:s?"column":void 0,children:t}),kl=u("span")(({theme:t})=>({fontSize:t.fontSizes.smallBody,marginLeft:t.spacing(1)})),Ct=({children:t})=>e.jsxs(kl,{children:["(",t,")"]}),be=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/user-admin"),El);return d.useMemo(()=>({users:(t==null?void 0:t.users)??[],roles:(t==null?void 0:t.rootRoles)??[],loading:!s&&!t,refetch:()=>n(),error:s}),[t,s,n])},El=t=>fetch(t).then(ce("Users")).then(s=>s.json()),ca=new Date,Mx=kt(ca,"yyyy-MM");Ao(ca);const Nx=t=>kt(t,"yyyy-MM"),Fx=t=>kt(t,"yyyy-MM-dd"),Gx=t=>Ro(t,"yyyy-MM",new Date),Al=t=>Ro(t,"yyyy-MM-dd",new Date),sn=5,nn=1e6,Rl=Al("2024-05-01"),Dl=["/api/admin","/api/frontend","/api/client"],Il=t=>{const{apiData:s,...n}=t;return{apiData:s.filter(a=>Dl.includes(a.apiPath)).map(a=>(a.dataPoints=a.dataPoints.filter(({period:i})=>new Date(i)>=Rl),a)),...n}},Pl=(t,s)=>t.reduce((n,o)=>{const a=o.dataPoints.find(({period:r})=>r===s),i=(a==null?void 0:a.trafficTypes.reduce((r,l)=>r+l.count,0))??0;return n+i},0),da=t=>t.flatMap(s=>s.dataPoints.flatMap(n=>n.trafficTypes.map(o=>o.count))).reduce((s,n)=>s+n,0),Ll=t=>{const{grouping:s,apiData:n}=t;if(s==="monthly"){const o=kt(new Date(t.dateRange.to),"yyyy-MM");return Pl(n,o)}else return da(n)},Bl=(t,s=sn,n=nn)=>Math.ceil(t/n)*s,ua=(t,s,n=sn,o=nn)=>{if(t===0)return 0;const a=Math.floor((t-s)/o)*o;return a>0?Bl(a,n,o):0},Ul=({dayOfMonth:t,daysInMonth:s,trafficData:n})=>{if(t<5)return 0;const o=n.map(i=>({...i,dataPoints:i.dataPoints.filter(r=>Number(r.period.slice(-2))<t)}));return da(o)/(t-1)*s},Wx=(t,s,n,o=sn,a=nn)=>{if(!t)return 0;const i=n.getDate(),r=Ao(n),l=Ul({dayOfMonth:i,daysInMonth:r,trafficData:t});return ua(l,s,o,a)},$l=(t,{from:s,to:n})=>{const o=`api/admin/metrics/traffic?grouping=${t}&from=${s}&to=${n}`,{data:a,error:i,mutate:r}=we(te(o),Ol);return d.useMemo(()=>{const l=a?{state:"success",data:Il(a)}:i?{state:"error",error:i}:{state:"loading"};return{refetch:()=>r(),result:l}},[a,i,r])},Ol=t=>fetch(t).then(ce("Instance Metrics")).then(s=>s.json()),ha=t=>{var m,p;const s=new Date,n=h=>kt(h,"yyyy-MM-dd"),o=n(ri(s)),a=n(li(s)),{instanceStatus:i}=Je(),r=((p=(m=i==null?void 0:i.prices)==null?void 0:m[(i==null?void 0:i.billing)==="pay-as-you-go"?"payg":"pro"])==null?void 0:p.traffic)??on,{result:l}=$l("daily",{from:o,to:a});return d.useMemo(()=>{if(l.state!=="success")return 0;const h=Ll(l.data);return ua(h,t,r)},[t,JSON.stringify(l),r])},Ts=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary})),_l=u(qs)(({theme:t})=>({fontSize:"1rem",marginRight:t.spacing(1)})),Ml=u(rt)(({theme:t})=>({margin:`${t.spacing(3)} 0`})),Nl=({instanceStatus:t})=>{var x,j,y,b,C,k;const{users:s,loading:n}=be(),o=s.filter(S=>S.email),a=((j=(x=t.prices)==null?void 0:x.pro)==null?void 0:j.base)??pa,i=((b=(y=t.prices)==null?void 0:y.pro)==null?void 0:b.seat)??ma,r=((k=(C=t.prices)==null?void 0:C.pro)==null?void 0:k.traffic)??on,l=xa,c=Math.min(o.length,l),m=o.length-c,p=i*m,h=ha(ga),g=a+p+h;return n?null:e.jsxs(e.Fragment,{children:[e.jsxs(f,{container:!0,children:[e.jsxs(ke,{sx:S=>({marginBottom:S.spacing(1.5)}),children:[e.jsxs(ie,{vertical:!0,children:[e.jsxs(A,{children:[e.jsx("strong",{children:"Included members"}),e.jsx(Ct,{children:e.jsxs(oe,{to:"/admin/users",children:[c," of ",l," assigned"]})})]}),e.jsxs(Ts,{children:["You have ",l," team members included in your PRO plan"]})]}),e.jsxs(ie,{children:[e.jsx(_l,{}),e.jsx(A,{variant:"body2",children:"included"})]})]}),e.jsxs(ke,{sx:S=>({marginBottom:S.spacing(1.5)}),children:[e.jsxs(ie,{vertical:!0,children:[e.jsxs(A,{children:[e.jsx("strong",{children:"Paid members"}),e.jsx(Ct,{children:e.jsxs(oe,{to:"/admin/users",children:[m," assigned"]})})]}),e.jsxs(Ts,{children:["$",i,"/month per paid member"]})]}),e.jsx(ie,{children:e.jsxs(A,{sx:S=>({fontSize:S.fontSizes.mainHeader}),children:["$",p.toFixed(2)]})})]}),e.jsx(T,{condition:h>0,show:e.jsxs(ke,{children:[e.jsxs(ie,{vertical:!0,children:[e.jsxs(A,{children:[e.jsx("strong",{children:"Accrued traffic charges"}),e.jsx(Ct,{children:e.jsx(oe,{to:"/admin/network/data-usage",children:"view details"})})]}),e.jsxs(Ts,{children:["$",r," per 1 million started above included data"]})]}),e.jsx(ie,{children:e.jsxs(A,{sx:S=>({fontSize:S.fontSizes.mainHeader}),children:["$",h.toFixed(2)]})})]})})]}),e.jsx(Ml,{}),e.jsx(f,{container:!0,children:e.jsxs(ke,{children:[e.jsx(ie,{children:e.jsx(A,{sx:S=>({fontWeight:S.fontWeight.bold,fontSize:S.fontSizes.mainHeader}),children:"Total"})}),e.jsx(ie,{children:e.jsxs(A,{sx:S=>({fontWeight:S.fontWeight.bold,fontSize:"2rem"}),children:["$",g.toFixed(2)]})})]})})]})},In=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary})),Fl=u(rt)(({theme:t})=>({margin:`${t.spacing(3)} 0`})),Gl=({instanceStatus:t})=>{var h,g,x,j;const{users:s,loading:n}=be(),o=s.filter(y=>y.email),a=((g=(h=t.prices)==null?void 0:h.payg)==null?void 0:g.seat)??ql,i=((j=(x=t.prices)==null?void 0:x.payg)==null?void 0:j.traffic)??on,r=t.minSeats??Vl,l=Math.max(o.length,r),c=a*l,m=ha(ga),p=c+m;return n?null:e.jsxs(e.Fragment,{children:[e.jsxs(f,{container:!0,children:[e.jsxs(ke,{sx:y=>({marginBottom:y.spacing(1.5)}),children:[e.jsxs(ie,{vertical:!0,children:[e.jsxs(A,{children:[e.jsx("strong",{children:"Paid members"}),e.jsx(Ct,{children:e.jsxs(oe,{to:"/admin/users",children:[o.length," assigned of"," ",r," minimum"]})})]}),e.jsxs(In,{children:["$",a,"/month per paid member"]})]}),e.jsx(ie,{children:e.jsxs(A,{sx:y=>({fontSize:y.fontSizes.mainHeader}),children:["$",c.toFixed(2)]})})]}),e.jsx(T,{condition:m>0,show:e.jsxs(ke,{children:[e.jsxs(ie,{vertical:!0,children:[e.jsxs(A,{children:[e.jsx("strong",{children:"Accrued traffic charges"}),e.jsx(Ct,{children:e.jsx(oe,{to:"/admin/network/data-usage",children:"view details"})})]}),e.jsxs(In,{children:["$",i," per 1 million started above included data"]})]}),e.jsx(ie,{children:e.jsxs(A,{sx:y=>({fontSize:y.fontSizes.mainHeader}),children:["$",m.toFixed(2)]})})]})})]}),e.jsx(Fl,{}),e.jsx(f,{container:!0,children:e.jsxs(ke,{children:[e.jsx(ie,{children:e.jsx(A,{sx:y=>({fontWeight:y.fontWeight.bold,fontSize:y.fontSizes.mainHeader}),children:"Total"})}),e.jsx(ie,{children:e.jsxs(A,{sx:y=>({fontWeight:y.fontWeight.bold,fontSize:"2rem"}),children:["$",p.toFixed(2)]})})]})})]})};u(A)(({theme:t})=>({fontSize:t.fontSizes.smallerBody,color:t.palette.text.secondary}));const Wl=u(N)(({theme:t})=>({marginTop:t.spacing(1),display:"inline-flex",alignItems:"center"})),zl=()=>{const t=te("api/admin/invoices/portal");return e.jsx(e.Fragment,{children:e.jsx(f,{container:!0,children:e.jsx(ke,{sx:s=>({marginBottom:s.spacing(3)}),children:e.jsx(ie,{vertical:!0,children:e.jsx(Wl,{href:t,variant:"outlined",endIcon:e.jsx(ci,{}),children:"View usage charges"})})})})})},Hl=({instanceStatus:t,isPAYG:s,isEnterpriseConsumption:n})=>s?e.jsx(Gl,{instanceStatus:t}):t.plan===Vs.PRO?e.jsx(Nl,{instanceStatus:t}):n?e.jsx(zl,{}):null,pa=80,ma=15,ql=75,on=5,Vl=5,xa=5,ga=53e6,Pn=u(Ye)(({theme:t})=>({padding:t.spacing(4),height:"100%",borderRadius:t.shape.borderRadiusLarge,backgroundColor:t.palette.background.paper})),Yl=u("span")(({theme:t})=>({fontSize:"3.25rem",lineHeight:1,color:t.palette.primary.main,fontWeight:800,marginRight:t.spacing(1.5)})),Jl=u("span")(({theme:t})=>({fontWeight:t.fontWeight.bold})),Kl=u("span")(({theme:t})=>({fontWeight:t.fontWeight.bold})),Zl=u("span")(({theme:t})=>({color:t.palette.primary.main,fontSize:t.fontSizes.mainHeader,fontWeight:t.fontWeight.bold})),Ql=u(J)(({theme:t})=>({fontSize:t.fontSizes.smallerBody,marginBottom:t.spacing(3),marginTop:t.spacing(-1.5),[t.breakpoints.up("md")]:{marginTop:t.spacing(-4.5)}})),Xl=()=>{var m,p;const{uiConfig:{billing:t}}=W(),{instanceStatus:s}=Je(),n=(s==null?void 0:s.plan)&&(s==null?void 0:s.plan)===Vs.PRO,o=t==="pay-as-you-go",a=t==="enterprise-consumption";if(!s)return e.jsx(f,{item:!0,xs:12,md:7,children:e.jsx(Pn,{"data-loading":!0,sx:{flex:1,height:"400px"}})});const i=di(s),r=((p=(m=s.prices)==null?void 0:m.pro)==null?void 0:p.base)??pa,l=`${s.plan}${o?" Pay-as-You-Go":""}`,c=s.state!==Hs.ACTIVE;return e.jsx(f,{item:!0,xs:12,md:7,children:e.jsxs(Pn,{children:[e.jsx(T,{condition:c,show:e.jsxs(Ql,{severity:"info",children:["After you have sent your billing information, your instance will be upgraded - you don't have to do anything."," ",e.jsx("a",{href:`mailto:support@getunleash.io?subject=${l} plan clarifications`,children:"Get in touch with us"})," ","for any clarification"]})}),e.jsx(Ie,{color:"success",children:"Current plan"}),e.jsxs(f,{container:!0,sx:h=>({marginBottom:h.spacing(3)}),children:[e.jsxs(ke,{children:[e.jsxs(ie,{children:[e.jsx(Yl,{children:s.plan}),e.jsx(T,{condition:ui(s),show:e.jsx(Kl,{sx:h=>({color:i?h.palette.error.dark:h.palette.warning.dark}),children:i?"Trial expired":s.trialExtended?"Extended Trial":"Trial"})})]}),e.jsx(ie,{children:e.jsx(T,{condition:!!n,show:e.jsxs(Zl,{children:["$",r.toFixed(2)]})})})]}),e.jsx(ke,{children:e.jsx(T,{condition:o||a,show:e.jsxs(Jl,{children:["Pay-as-You-Go"," ",a?"Consumption":""]})})})]}),e.jsx(Hl,{instanceStatus:s,isPAYG:o,isEnterpriseConsumption:a})]})})},ec=()=>e.jsxs(f,{container:!0,spacing:2,children:[e.jsx(wl,{}),e.jsx(Xl,{})]}),tc=u(A)(({theme:t})=>({marginTop:t.spacing(6),marginBottom:t.spacing(2.5),fontSize:t.fontSizes.mainHeader})),sc=[{Header:"Amount",accessor:"amountFormatted"},{Header:"Status",accessor:"status",disableGlobalFilter:!0},{Header:"Created date",accessor:"created",Cell:je,disableGlobalFilter:!0},{Header:"Due date",accessor:"dueDate",Cell:je,disableGlobalFilter:!0},{Header:"Download",accessor:"invoicePDF",align:"center",Cell:({value:t})=>e.jsx(M,{sx:{display:"flex",justifyContent:"center"},"data-loading":!0,children:e.jsx(Oe,{href:t,children:e.jsx(xi,{})})}),width:100,disableGlobalFilter:!0,disableSortBy:!0}],nc=({data:t,isLoading:s=!1})=>{const n=d.useMemo(()=>({sortBy:[{id:"created",desc:!0}]}),[]),{getTableProps:o,getTableBodyProps:a,headerGroups:i,rows:r,prepareRow:l}=z.useTable({columns:sc,data:t,initialState:n,sortTypes:fe,autoResetGlobalFilter:!1,disableSortRemove:!0,defaultColumn:{Cell:ae}},z.useGlobalFilter,z.useSortBy);return e.jsxs(se,{isLoading:s,disablePadding:!0,children:[e.jsx(tc,{children:"Payment history"}),e.jsxs(hi,{...o(),children:[e.jsx(pi,{headerGroups:i}),e.jsx(Ys,{...a(),children:r.map(c=>{l(c);const{key:m,...p}=c.getRowProps();return e.jsx(Tt,{hover:!0,...p,children:c.cells.map(h=>{const{key:g,...x}=h.getCellProps();return e.jsx(mi,{...x,children:h.render("Cell")},g)})},m)})})]}),e.jsx(T,{condition:r.length===0,show:e.jsx(le,{children:"No invoices to show."})})]})},Ns="api/admin/invoices",oc=te(Ns),ja=(t={})=>{const s=()=>fetch(oc,{method:"GET"}).then(ce("Invoices")).then(l=>l.json()),{data:n,error:o}=we(Ns,s,t),[a,i]=d.useState(!o&&!n),r=()=>{gi(Ns)};return d.useEffect(()=>{i(!o&&!n)},[n,o]),{invoices:(n==null?void 0:n.invoices)||[],error:o,loading:a,refetchInvoices:r}};var an={},ac=ct;Object.defineProperty(an,"__esModule",{value:!0});var fa=an.default=void 0,ic=ac(lt()),rc=e,lc=(0,ic.default)((0,rc.jsx)("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"}),"DownloadOutlined");fa=an.default=lc;const He=(t,s)=>s&&s.toLocaleLowerCase()==="usd"?`$${t.toLocaleString("en-US")}`:s&&s.toLocaleLowerCase()==="eur"?`€ ${t.toLocaleString("no-NO")}`:`${t}${s?" ":""}${s||""}`,ya=u("div",{shouldForwardProp:t=>t!=="withBackground"})(({theme:t,withBackground:s})=>({display:"grid",gridTemplateColumns:"subgrid",gridColumn:"1 / -1",background:s?t.palette.background.elevation1:"transparent",margin:t.spacing(.5,0),padding:s?t.spacing(2,2,3):t.spacing(.5,2,1.5),borderRadius:t.shape.borderRadiusLarge,gap:t.spacing(2)})),qe=u("div")(({theme:t})=>({textAlign:"right",paddingRight:t.spacing(1.5)})),ba=u("div",{shouldForwardProp:t=>t!=="expand"})(({expand:t})=>({display:"flex",flexDirection:"column",gridColumn:t?"1 / span 2":void 0})),cc=u(ya)(({theme:t})=>({gridColumn:"3 / -1",padding:t.spacing(1,1,0,0),gap:0})),ks=u("div")(({theme:t,last:s})=>({marginRight:t.spacing(1),display:"grid",gridColumn:"1 / -1",gridTemplateColumns:"subgrid",...s?{fontWeight:t.typography.fontWeightBold}:{borderBottom:`1px solid ${t.palette.divider}`},padding:t.spacing(1.25,0)})),We=u("div",{shouldForwardProp:t=>t!=="colSpan"})(({theme:t,colSpan:s})=>({padding:t.spacing(0,0,0,.5),...s?{gridColumn:`span ${s}`}:{}})),dc=({value:t,percentage:s,currency:n,status:o})=>{if(t===void 0)return e.jsx(We,{colSpan:2,children:"Customer tax is exempt"});const i=o==="estimate"&&s!==void 0?`Tax (${s}%)`:"Tax";return e.jsxs(e.Fragment,{children:[e.jsx(We,{children:i}),e.jsx(We,{children:e.jsx(qe,{children:He(t,n)})})]})},uc=({subTotal:t,taxAmount:s,taxPercentage:n,totalAmount:o,currency:a,status:i})=>e.jsxs(cc,{children:[e.jsxs(ks,{children:[e.jsx(We,{children:"Sub total"}),e.jsx(We,{children:e.jsx(qe,{children:He(t||0,a)})})]}),e.jsx(ks,{children:e.jsx(dc,{value:s,percentage:n,currency:a,status:i})}),e.jsxs(ks,{last:!0,children:[e.jsx(We,{children:"Total"}),e.jsx(We,{children:e.jsx(qe,{children:He(o,a)})})]})]}),hc=({percentage:t})=>e.jsx(Wr,{percentage:t,size:"1.25rem",strokeRatio:.3}),rn=(t,s)=>!!(t&&s),Ln=(t,s)=>rn(t,s)?Math.floor(Math.max(0,t-s)):0,pc=(t,s)=>rn(t,s)?Math.min(t,s):t,mc=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1),maxHeight:t.spacing(2.5)})),xc=({quantity:t,consumption:s,limit:n,description:o,totalAmount:a,unitPrice:i,invoiceCurrency:r,invoiceStatus:l})=>{const c=n&&n>0?Math.min(100,Math.round((s||0)/n*100)):void 0,m=l==="estimate",p=rn(s,n),h=m&&p?Ln(s,n):t,g=m&&p?pc(s,n):s,x=m&&i&&p?Ln(s,n)*i:a,j=x&&x>0,y=p,b=()=>g!==void 0&&n!==void 0?`${tt(g)}/${tt(n)}`:g!==void 0?tt(g):n!==void 0?tt(n):"–";return e.jsxs(e.Fragment,{children:[e.jsx(ba,{children:o}),y?e.jsxs(mc,{children:[e.jsx(hc,{percentage:c||0}),e.jsx("div",{children:b()})]}):e.jsx("div",{}),e.jsx("div",{children:h?tt(h):""}),j?e.jsx(qe,{children:He(x,r)}):e.jsx("div",{})]})},gc=u(A)(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.typography.caption.fontSize})),jc=({quantity:t,description:s,currency:n,totalAmount:o,startDate:a,endDate:i,invoiceCurrency:r})=>{const l=a?new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"}):void 0,c=i?new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"}):void 0;return e.jsxs(e.Fragment,{children:[e.jsxs(ba,{expand:!0,children:[e.jsx("div",{children:s}),l||c?e.jsxs(gc,{children:[l," - ",c]}):null]}),e.jsx("div",{children:t?tt(t):"–"}),e.jsx(qe,{children:He(o||0,r)})]})},fc=(t,s,n,o,a,i,r)=>{if(t!=="estimate")return{subtotal:s,taxAmount:n,totalAmount:o};const l=i.reduce((g,x)=>g+(x.totalAmount||0),0),c=r.reduce((g,x)=>{const j=x.consumption&&x.limit?Math.floor(Math.max(0,x.consumption-x.limit)):0;return g+j*(x.unitPrice||0)},0),m=l+c,p=a?m*(a/100):0,h=m+p;return{subtotal:m,taxAmount:p,totalAmount:h}},yc=u(Qt)(({theme:t})=>({background:t.palette.background.paper,borderRadius:t.shape.borderRadiusLarge,boxShadow:t.boxShadows.card,"&:before":{display:"none"},"&.MuiAccordion-root":{margin:0,border:"none"}})),bc=u(Xt)(({theme:t})=>({padding:t.spacing(2,4),gap:t.spacing(1.5),"& .MuiAccordionSummary-content":{margin:0,display:"flex",alignItems:"center",gap:t.spacing(1.5),"&.Mui-expanded":{margin:0}}})),Sc=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1.5),flex:1,minWidth:0})),vc=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(2)})),Cc=u("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"45% 20% 15% 20%",padding:t.spacing(0,2,2)})),_e=u("div")(({theme:t})=>({fontSize:t.typography.body2.fontSize,fontWeight:t.typography.fontWeightMedium,color:t.palette.text.secondary})),Bn=({children:t,title:s})=>e.jsx(ya,{withBackground:!!s,children:t}),Ut=u("div")(({theme:t})=>({display:"grid",gridColumn:"1 / -1",gridTemplateColumns:"subgrid"})),wc=u("span")(({theme:t})=>({color:t.palette.text.primary,fontSize:t.typography.body1.fontSize})),Tc=u(rt)(({theme:t})=>({gridColumn:"1 / -1",margin:t.spacing(0,2)})),kc=u("div")(({theme:t})=>({display:"flex",justifyContent:"flex-end",gap:t.spacing(1),padding:t.spacing(0,2,2)})),Ec=({status:t,invoiceDate:s,invoicePDF:n,invoiceURL:o,totalAmount:a,subtotal:i,taxAmount:r,taxPercentage:l,currency:c,mainLines:m,usageLines:p,monthText:h,defaultExpanded:g})=>{const x=s?new Date(s).toLocaleDateString(void 0,{month:"long",day:"numeric"}):"",y=new Date(s).getFullYear()===new Date().getFullYear()?`, ${new Date(s).getFullYear()}`:"",{subtotal:b,taxAmount:C,totalAmount:k}=fc(t,i,r,a,l,m,p);return e.jsxs(yc,{defaultExpanded:!!g,children:[e.jsxs(bc,{expandIcon:e.jsx(es,{}),id:`billing-invoice-${x}-header`,children:[e.jsx(Sc,{children:e.jsxs(A,{variant:"h2",component:"h3",sx:{fontWeight:700},children:[x,y]})}),e.jsxs(vc,{children:[t==="estimate"?e.jsx(Ie,{color:"disabled",children:"Estimate"}):null,t==="upcoming"?e.jsx(Ie,{color:"info",children:"Next invoice"}):null,t==="invoiced"?e.jsx(Ie,{color:"success",children:"Invoiced"}):null,t==="paid"?e.jsx(Ie,{color:"success",children:"Paid"}):null,e.jsx(A,{variant:"body1",sx:{fontWeight:700},children:He(k,c)})]})]}),e.jsxs(ts,{sx:S=>({padding:S.spacing(2,0,0),borderTop:`1px solid ${S.palette.divider}`}),children:[e.jsxs(Cc,{children:[e.jsxs(Bn,{children:[e.jsxs(Ut,{children:[e.jsx(_e,{children:"Description"}),e.jsx(_e,{}),e.jsx(_e,{children:"Quantity"}),e.jsx(_e,{children:e.jsx(qe,{children:"Amount"})})]}),m.map(S=>e.jsx(Ut,{children:e.jsx(jc,{...S,invoiceCurrency:c})},S.description))]}),p.length?e.jsxs(Bn,{title:"Usage",children:[e.jsxs(Ut,{children:[e.jsx(_e,{children:e.jsxs(wc,{children:["Usage – ",h]})}),e.jsx(_e,{children:"Included"}),e.jsx(_e,{children:"Overages"}),e.jsx(_e,{children:e.jsx(qe,{children:"Amount"})})]}),p.map(S=>e.jsx(Ut,{children:e.jsx(xc,{...S,invoiceCurrency:c,invoiceStatus:t})},S.description))]},"usage"):e.jsx(Tc,{}),e.jsx(uc,{subTotal:b,taxAmount:C,taxPercentage:l,totalAmount:k,currency:c,status:t})]}),o||n?e.jsxs(kc,{children:[o?e.jsx(N,{variant:"outlined",href:o,target:"_blank",rel:"noreferrer",startIcon:e.jsx(ji,{}),children:"View invoice"}):null,n?e.jsx(N,{variant:"outlined",href:n,target:"_blank",rel:"noreferrer",startIcon:e.jsx(fa,{}),children:"Download PDF"}):null]}):null]})]})},Ac=u(Qt)(({theme:t})=>({background:t.palette.background.paper,borderRadius:t.shape.borderRadiusLarge})),Rc=u(Xt)(({theme:t})=>({padding:t.spacing(2,4),gap:t.spacing(1.5)})),Dc=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1.5),flex:1,minWidth:0})),Ic=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(2)})),Pc=u("div")(({theme:t})=>({height:t.spacing(2.5),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(.5,0)})),Lc=u("div")(({theme:t})=>({height:t.spacing(3),width:t.spacing(10),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(1.5)})),Bc=u("div")(({theme:t})=>({height:t.spacing(3),width:t.spacing(12.5),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5)})),Uc=u("div")(({theme:t})=>({height:t.spacing(25),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(2,4)})),$c=()=>e.jsxs(Ac,{defaultExpanded:!0,"data-loading":!0,children:[e.jsxs(Rc,{expandIcon:e.jsx(es,{}),children:[e.jsx(Dc,{children:e.jsx(Pc,{sx:{width:t=>t.spacing(15),height:t=>t.spacing(4)}})}),e.jsxs(Ic,{children:[e.jsx(Lc,{}),e.jsx(Bc,{})]})]}),e.jsx(ts,{children:e.jsx(Uc,{})})]}),Sa="api/admin/invoices/list",Oc=te(Sa),va=(t={})=>{const s=()=>fetch(Oc,{method:"GET"}).then(ce("Detailed invoices")).then(c=>c.json()),{data:n,error:o,isLoading:a}=we(Sa,s,t),i=d.useMemo(()=>(n==null?void 0:n.invoices)??[],[n]),r=n==null?void 0:n.planPrice,l=n==null?void 0:n.planCurrency;return{invoices:i,planPrice:r,planCurrency:l,error:o,loading:a}},Un=u(M)(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2)})),_c=()=>{const{invoices:t,loading:s}=va(),n=Et(s);return s?e.jsx(Un,{ref:n,children:[1,2,3].map(o=>e.jsx($c,{},o))}):e.jsx(Un,{children:t.length>0?e.jsx(e.Fragment,{children:t.map((o,a)=>e.jsx(Ec,{defaultExpanded:a===0,...o},o.invoiceDate))}):e.jsx(le,{children:"There are no invoices or estimates available right now."})})};var ln={},Mc=ct;Object.defineProperty(ln,"__esModule",{value:!0});var Ca=ln.default=void 0,Nc=Mc(lt()),Fc=e,Gc=(0,Nc.default)((0,Fc.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"}),"CreditCard");Ca=ln.default=Gc;const Wc=u(Ye)(({theme:t})=>({padding:t.spacing(2),borderRadius:t.shape.borderRadiusLarge,display:"flex",flexDirection:"column",gap:t.spacing(1)})),$n=u("div")(({theme:t})=>({display:"flex",justifyContent:"space-between",fontSize:t.typography.body2.fontSize})),$t=u("div")(({theme:t})=>({height:t.spacing(2.5),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(.5,0)})),zc=u("div")(({theme:t})=>({height:t.spacing(4),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(.5,0),width:t.spacing(20)})),Hc=u("div")(({theme:t})=>({height:t.spacing(5),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(1,0),width:"100%"})),qc=u("div")(({theme:t})=>({height:t.spacing(.125),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(1.5,0),width:"100%"})),On=u("div")(({theme:t})=>({height:t.spacing(2),backgroundColor:t.palette.action.hover,borderRadius:t.spacing(.5),margin:t.spacing(.5,0),width:t.spacing(25)})),Vc=()=>e.jsxs(Wc,{"data-loading":!0,children:[e.jsx(zc,{}),e.jsxs($n,{children:[e.jsx($t,{sx:{width:t=>t.spacing(12)}}),e.jsx($t,{sx:{width:t=>t.spacing(8)}})]}),e.jsxs($n,{children:[e.jsx($t,{sx:{width:t=>t.spacing(10)}}),e.jsx($t,{sx:{width:t=>t.spacing(6)}})]}),e.jsx(qc,{}),e.jsx(Hc,{}),e.jsx(On,{}),e.jsx(On,{sx:{width:t=>t.spacing(20)}})]}),Yc=te("api/admin/invoices"),Es=u(Ye)(({theme:t})=>({padding:t.spacing(2),borderRadius:t.shape.borderRadiusLarge,boxShadow:t.boxShadows.card,display:"flex",flexDirection:"column",gap:t.spacing(1)})),_n=u("div")(({theme:t})=>({display:"flex",justifyContent:"space-between",fontSize:t.typography.body2.fontSize})),Mn=u("span")(({theme:t})=>({color:t.palette.text.secondary,whiteSpace:"nowrap"})),Nn=u("span")(({theme:t})=>({textAlign:"right"})),Jc=u(N)(({theme:t})=>({margin:t.spacing(0,0,1,0)})),zt=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary})),Kc=u(rt)(({theme:t})=>({margin:t.spacing(1.5,0),borderColor:t.palette.divider})),As=()=>e.jsxs(zt,{children:[e.jsx("a",{href:"mailto:support@getunleash.io?subject=Billing plan clarifications",children:"Get in touch with us"})," ","for any clarification"]}),Zc=()=>{const{instanceStatus:t,loading:s}=Je(),{uiConfig:{billing:n}}=W(),{planPrice:o,planCurrency:a,loading:i}=va();if(s||i)return e.jsx(Vc,{});if(!t)return e.jsxs(Es,{children:[e.jsx(A,{variant:"h3",children:"Billing details"}),e.jsx(zt,{children:"Your billing is managed by Unleash"}),e.jsx(As,{})]});const r=n==="pay-as-you-go",l=t.state!==Hs.ACTIVE,{isCustomBilling:c}=t;return c?e.jsxs(Es,{children:[e.jsx(A,{variant:"h3",children:"Billing details"}),e.jsx(zt,{children:"Your billing is managed by Unleash"}),e.jsx(As,{})]}):e.jsxs(Es,{children:[e.jsx(A,{variant:"h3",children:"Billing details"}),e.jsxs(_n,{children:[e.jsx(Mn,{children:"Current plan"})," ",e.jsx(Nn,{children:r?"Pay-as-You-Go":"Consumption"})]}),e.jsxs(_n,{children:[e.jsx(Mn,{children:"Plan price"})," ",e.jsx(Nn,{children:o!==void 0?`${He(o,a)} ${r?"per seat":"/ month"}`:"-"})]}),e.jsx(Kc,{}),e.jsx(Jc,{href:`${Yc}/${l?"checkout":"portal"}`,variant:l?"contained":"outlined",startIcon:e.jsx(Ca,{}),children:l?"Add billing details":"Edit billing details"}),l?e.jsx(zt,{children:"Once we have received your billing information we will upgrade your trial within 1 business day."}):null,e.jsx(As,{})]})},Qc=u(A)(({theme:t})=>({fontSize:t.fontSizes.mainHeader,color:t.palette.text.primary})),Xc=u(M)(({theme:t})=>({display:"grid",gridTemplateColumns:"1fr 320px",gap:t.spacing(2),[t.breakpoints.down("md")]:{display:"flex",flexDirection:"column-reverse"}})),ed=()=>{const{isBilling:t,refetchInstanceStatus:s,refresh:n,loading:o}=Je(),{invoices:a}=ja(),{uiConfig:{billing:i}}=W(),r=i==="pay-as-you-go"||i==="enterprise-consumption";return d.useEffect(()=>{(async()=>{await n(),s()})()},[s,n]),r?e.jsxs(M,{sx:l=>({display:"flex",flexDirection:"column",gap:l.spacing(4)}),children:[e.jsx(Qc,{children:"Usage and invoices"}),e.jsxs(Xc,{children:[e.jsx(_c,{}),e.jsx("div",{children:e.jsx(Zc,{})})]})]}):e.jsx("div",{children:e.jsx(se,{header:"Billing",isLoading:o,children:e.jsx(T,{condition:t,show:e.jsx(ve,{permissions:ee,children:e.jsxs(e.Fragment,{children:[e.jsx(ec,{}),e.jsx(nc,{data:a})]})}),elseShow:e.jsx(J,{severity:"error",children:"Billing is not enabled for this instance."})})})})},td=te("api/admin/invoices/portal"),sd=()=>{const{refetchInvoices:t,invoices:s}=ja(),[n,o]=d.useState(!1),{locationSettings:a}=Do();return d.useEffect(()=>{t(),o(!0)},[]),e.jsx(T,{condition:s.length>0,show:e.jsx(se,{header:e.jsx(ne,{title:"Invoices",actions:e.jsx(N,{href:td,rel:"noreferrer",target:"_blank",endIcon:e.jsx(fi,{}),children:"Billing portal"})}),children:e.jsx("div",{children:e.jsxs(Io,{children:[e.jsx(Po,{children:e.jsxs(Tt,{children:[e.jsx(de,{children:"Amount"}),e.jsx(de,{children:"Status"}),e.jsx(de,{children:"Due date"}),e.jsx(de,{children:"PDF"}),e.jsx(de,{children:"Link"})]})}),e.jsx(Ys,{children:s.map(i=>e.jsxs(Tt,{style:{backgroundColor:i.status==="past-due"?"error.dark":"inherit"},children:[e.jsx(de,{style:{textAlign:"left"},children:i.amountFormatted}),e.jsx(de,{style:{textAlign:"left"},children:i.status}),e.jsx(de,{style:{textAlign:"left"},children:i.dueDate&&Lo(i.dueDate,a.locale)}),e.jsx(de,{style:{textAlign:"left"},children:e.jsx("a",{href:i.invoicePDF,children:"PDF"})}),e.jsx(de,{style:{textAlign:"left"},children:e.jsx("a",{href:i.invoiceURL,target:"_blank",rel:"noreferrer",children:"Payment link"})})]},i.invoiceURL))})]})})}),elseShow:e.jsx(se,{children:n&&"No invoices to show."})})},nd=()=>e.jsx("div",{children:e.jsx(ve,{permissions:ee,children:e.jsx(sd,{})})}),od=()=>{const{uiConfig:t,loading:s}=W();return s?null:t.flags.UNLEASH_CLOUD?e.jsx(zs,{to:"/admin/billing",replace:!0}):e.jsx(nd,{})},ad=()=>e.jsxs(J,{severity:"info",children:[e.jsxs("p",{children:["Use this page to configure allowed CORS origins for the Frontend API (",e.jsx("code",{children:"/api/frontend"}),")."]}),e.jsxs("p",{children:["This configuration will not affect the Admin API (",e.jsx("code",{children:"/api/admin"}),") nor the Client API (",e.jsx("code",{children:"/api/client"}),")."]}),e.jsxs("p",{children:["An asterisk (",e.jsx("code",{children:"*"}),") may be used to allow API calls from any origin."]}),e.jsx("br",{}),e.jsx("p",{children:"Be aware that changes here will take up to two minutes to be updated. In addition, there is a maxAge on the Access-Control-Allow-Origin header that will instruct browsers to cache this header for some time. The cache period is set to the maxium that the browser allows (2h for Chrome, 24h for Firefox)."})]}),id=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0});return{setCors:async i=>{const r=s("api/admin/ui-config/cors",{method:"POST",body:JSON.stringify({frontendApiOrigins:i})},"setCors");await t(r.caller,r.id)},loading:o,errors:n}},rd=({frontendApiOrigins:t})=>{const{setCors:s}=id(),{setToastData:n,setToastApiError:o}=K(),[a,i]=d.useState(Fn(t)),r=jn(),l=jn(),c=async m=>{try{const p=ld(a);m.preventDefault(),await s(p),i(Fn(p)),n({text:"Settings saved",type:"success"})}catch(p){o(V(p))}};return e.jsx("form",{onSubmit:c,children:e.jsxs(M,{sx:{display:"grid",gap:1},children:[e.jsxs("label",{htmlFor:r,children:["Which origins should be allowed to call the Frontend API? Add only one origin per line. The CORS specification does not support wildcard for subdomains, it needs to be a fully qualified domain, including the protocol.",e.jsx("br",{}),e.jsx("br",{}),'If you specify "*" it will be the chosen origin.',e.jsx("br",{}),e.jsx("br",{}),"Example:"]}),e.jsxs("code",{style:{fontSize:"0.7em"},children:["https://www.example.com",e.jsx("br",{}),"https://www.example2.com"]}),e.jsx(X,{id:r,"aria-describedby":l,placeholder:cd,value:a,onChange:m=>i(m.target.value),multiline:!0,rows:12,variant:"outlined",fullWidth:!0,InputProps:{style:{fontFamily:"monospace",fontSize:"0.8em"}}}),e.jsx(Bo,{permission:[De,Uo]})]})})},ld=t=>t.split(/[,\n\s]+/).map(s=>s.replace(/\/$/,"")).filter(Boolean),Fn=t=>(t==null?void 0:t.join(`
5
+ `))??"",cd=["https://example.com","https://example.org"].join(`
6
+ `),dd=()=>e.jsx("div",{children:e.jsx(ve,{permissions:[De,Uo],children:e.jsx(ud,{})})}),ud=()=>{const{uiConfig:t,loading:s}=W();return s?null:e.jsx(se,{header:e.jsx(ne,{title:"CORS origins"}),children:e.jsxs(M,{sx:{display:"grid",gap:4},children:[e.jsx(ad,{}),e.jsx(rd,{frontendApiOrigins:t.frontendApiOrigins})]})})},Ve=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/groups"),hd);return d.useMemo(()=>({groups:(t==null?void 0:t.groups.map(o=>({...o,users:Gr(o.users??[])})))??[],loading:!s&&!t,refetchGroups:()=>n(),error:s}),[t,s,n])},hd=t=>fetch(t).then(ce("Groups")).then(s=>s.json());var cn={},pd=ct;Object.defineProperty(cn,"__esModule",{value:!0});var wa=cn.default=void 0,md=pd(lt()),xd=e,gd=(0,md.default)((0,xd.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5s-3 1.34-3 3 1.34 3 3 3zm-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5 5 6.34 5 8s1.34 3 3 3zm0 2c-2.33 0-7 1.17-7 3.5V18c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-1.5c0-2.33-4.67-3.5-7-3.5zm8 0c-.29 0-.62.02-.97.05.02.01.03.03.04.04 1.14.83 1.93 1.94 1.93 3.41V18c0 .35-.07.69-.18 1H22c.55 0 1-.45 1-1v-1.5c0-2.33-4.67-3.5-7-3.5z"}),"GroupRounded");wa=cn.default=gd;const wt="This group is managed by your SCIM provider, only the role and description can be changed manually",jd=u("div")(({theme:t})=>({margin:t.spacing(-1),marginLeft:t.spacing(-.5),display:"flex",justifyContent:"center",alignItems:"center"})),fd=u($o)(({theme:t})=>({borderRadius:t.shape.borderRadiusLarge,padding:t.spacing(1,1.5)})),yd=({groupId:t,onEditUsers:s,onRemove:n,isScimGroup:o})=>{const[a,i]=d.useState(null),r=!!a,l=h=>{i(h.currentTarget)},c=()=>{i(null)},m=`group-${t}-actions`,p=`${m}-menu`;return e.jsxs(jd,{onClick:h=>{h.preventDefault(),h.stopPropagation()},children:[e.jsx(Te,{title:o?wt:"Group actions",arrow:!0,describeChild:!0,children:e.jsx("div",{children:e.jsx(Oe,{id:m,"aria-controls":r?p:void 0,"aria-haspopup":"true","aria-expanded":r?"true":void 0,onClick:l,type:"button",size:"small",children:e.jsx(Oo,{})})})}),e.jsx(fd,{id:p,anchorEl:a,open:r,onClose:c,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:e.jsxs(_o,{"aria-labelledby":m,children:[e.jsxs(ze,{onClick:c,component:oe,to:`/admin/groups/${t}/edit`,children:[e.jsx(bs,{children:e.jsx(At,{})}),e.jsx(Wt,{children:e.jsx(A,{variant:"body2",children:"Edit group"})})]}),e.jsxs(ze,{disabled:o,onClick:()=>{s(),c()},children:[e.jsx(bs,{children:e.jsx(wa,{})}),e.jsx(Wt,{children:e.jsx(A,{variant:"body2",children:"Edit group users"})})]}),e.jsxs(ze,{onClick:()=>{n(),c()},children:[e.jsx(bs,{children:e.jsx(Le,{})}),e.jsx(Wt,{children:e.jsx(A,{variant:"body2",children:"Delete group"})})]})]})})]})},bd=u(yi)(({theme:t})=>({height:t.spacing(2.5),width:t.spacing(2.5),marginLeft:t.spacing(-.75)})),Sd=u(M)(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(1),maxWidth:t.spacing(25)})),vd=u(Ie)({cursor:"pointer",overflowWrap:"anywhere"}),Cd=({group:t})=>{const s=Ce();return e.jsxs(e.Fragment,{children:[t.users.length>0?e.jsx(bi,{users:t.users,AvatarComponent:bd}):e.jsx("span",{children:"This group has no users"}),t.projects.length>0&&e.jsx(ss,{component:"span",tooltip:e.jsx(Sd,{children:t.projects.map(n=>e.jsx(vd,{onClick:o=>{o.preventDefault(),s(`/projects/${n}/settings/access`)},color:"secondary",icon:e.jsx(Si,{}),children:n},n))}),children:e.jsxs("span",{children:[t.projects.length," project",t.projects.length!==1&&"s"]})})]})},wd=u(oe)(({theme:t})=>({color:"inherit",textDecoration:"none",border:"none",padding:"0",background:"transparent",fontFamily:t.typography.fontFamily,pointer:"cursor"})),Td=u("h3")(({theme:t})=>({margin:0,marginRight:"auto",fontWeight:t.typography.fontWeightRegular,fontSize:t.typography.body1.fontSize,lineHeight:"1.2"})),kd=({group:t,onEditUsers:s,onRemoveGroup:n})=>{const{searchQuery:o}=Js(),{settings:{enabled:a}}=Lt(),i=a&&!!t.scimId,r=e.jsx(fn,{title:t.name,arrow:!0,component:Td,children:e.jsx(Ht,{search:o,children:t.name})}),l=e.jsxs(e.Fragment,{children:[t.rootRole&&e.jsx(vi,{roleId:t.rootRole,hideIcon:!0}),e.jsx(yd,{groupId:t.id,onEditUsers:()=>s(t),onRemove:()=>n(t),isScimGroup:i})]}),c=t.description&&e.jsx(fn,{lines:2,title:t.description,arrow:!0,children:e.jsx(Ht,{search:o,children:t.description})});return e.jsx(wd,{to:`/admin/groups/${t.id}`,children:e.jsx(Ci,{title:r,icon:e.jsx(wi,{}),headerActions:l,footer:e.jsx(Cd,{group:t}),children:c})})},Ed=()=>{const t=u("div")(({theme:n})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:n.spacing(6),marginLeft:"auto",marginRight:"auto"})),s=u(A)(({theme:n})=>({fontSize:n.fontSizes.bodySize,marginBottom:n.spacing(2.5)}));return e.jsxs(t,{children:[e.jsx(s,{children:"No groups available. Get started by adding a new group."}),e.jsx(N,{to:"/admin/groups/create-group",component:oe,variant:"outlined",color:"primary",children:"Create your first group"})]})},Ad=u("div")(({theme:t})=>({display:"flex",flexDirection:"column","& > span:first-of-type":{color:t.palette.text.secondary}})),Rd=u("div")(({theme:t})=>({paddingLeft:t.spacing(1)})),Dd=u("div")(({theme:t})=>({display:"flex",marginBottom:t.spacing(3),"& > div:first-of-type":{width:"100%",maxWidth:t.spacing(50),marginRight:t.spacing(1)}})),Id=u("li")({width:"100%"}),Pd=(t,s,{selected:n})=>d.createElement(Id,{...t,key:s.id},e.jsx(ns,{icon:e.jsx(Ei,{fontSize:"small"}),checkedIcon:e.jsx(Ai,{fontSize:"small"}),style:{marginRight:8},checked:n}),e.jsxs(Ad,{children:[e.jsx("span",{children:s.name||s.username}),e.jsx("span",{children:s.name&&s.username?s.username:s.email})]})),Ld=t=>e.jsx(Rd,{children:t.length>1?`${t.length} users selected`:t[0].name||t[0].username||t[0].email}),Ta=({users:t,setUsers:s})=>{const{users:n,loading:o}=be(),{serviceAccounts:a,loading:i}=It(),r=o||i,l=r?[]:[...n.map(c=>({...c,type:"USERS"})).sort((c,m)=>{const p=c.name||c.username||"",h=m.name||m.username||"";return p.localeCompare(h)}),...a.map(c=>({...c,type:"SERVICE ACCOUNTS"})).sort((c,m)=>{const p=c.name||c.username||"",h=m.name||m.username||"";return p.localeCompare(h)})];return l.length>200,e.jsx(Dd,{children:e.jsx(Ti,{"data-testid":ki,size:"small",limitTags:1,openOnFocus:!0,multiple:!0,disableCloseOnSelect:!0,value:t,onChange:(c,m,p)=>{c.type==="keydown"&&c.key==="Backspace"&&p==="removeOption"||s(m)},options:l,groupBy:c=>c.type,renderOption:Pd,filterOptions:(c,{inputValue:m})=>c.filter(({name:p,username:h,email:g})=>Ss(m,g)||Ss(m,p)||Ss(m,h)),isOptionEqualToValue:(c,m)=>c.id===m.id,getOptionLabel:c=>c.email||c.name||c.username||"",renderInput:c=>e.jsx(X,{...c,label:"Select users"}),renderTags:c=>Ld(c),noOptionsText:r?"Loading…":"No options"})})},ka=({users:t,setUsers:s})=>{const n=d.useMemo(()=>[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:l}})=>e.jsx(ae,{children:e.jsx(Ke,{user:l})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:l=>l.name||"",Cell:({value:l,row:{original:c}})=>e.jsx(Se,{value:l,subtitle:c.email||c.username}),minWidth:100,searchable:!0},{Header:"Action",id:"Action",align:"center",Cell:({row:{original:l}})=>e.jsx(Yt,{children:e.jsx(Te,{title:"Remove user from group",arrow:!0,describeChild:!0,children:e.jsx(Oe,{onClick:()=>s(c=>c.filter(m=>m.id!==l.id)),children:e.jsx(Le,{})})})}),maxWidth:100,disableSortBy:!0},{accessor:l=>l.username||"",Header:"Username",searchable:!0},{accessor:l=>l.email||"",Header:"Email",searchable:!0}],[s]),[o]=d.useState(()=>({hiddenColumns:["Username","Email"]})),{headerGroups:a,rows:i,prepareRow:r}=z.useTable({columns:n,data:t,initialState:o,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return e.jsx(T,{condition:i.length>0,show:e.jsx(ye,{rows:i,headerGroups:a,prepareRow:r})})},dn=(t="",s="",n=[],o=[],a=null)=>{const r=Mo().get("name"),[l,c]=d.useState(r||t),[m,p]=d.useState(s),[h,g]=d.useState(n),[x,j]=d.useState(o),[y,b]=d.useState(a),[C,k]=d.useState({});return{name:l,setName:c,description:m,setDescription:p,mappingsSSO:h,setMappingsSSO:g,users:x,setUsers:j,getGroupPayload:()=>({name:l,description:m,mappingsSSO:h,users:x.map(({id:v})=>({user:{id:v}})),rootRole:y||void 0}),clearErrors:()=>{k({})},errors:C,setErrors:k,rootRole:y,setRootRole:b}},Bd=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Ud=u("p")(({theme:t})=>({color:t.palette.text.secondary,marginBottom:t.spacing(1)})),$d=u("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),Od=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),_d=u(M)(({theme:t})=>({marginTop:t.spacing(2)})),Ea=({open:t,setOpen:s,group:n})=>{const{refetchGroup:o}=cs(n.id),{refetchGroups:a}=Ve(),{updateGroup:i,loading:r}=ht(),{setToastData:l,setToastApiError:c}=K(),{uiConfig:m}=W(),{users:p,setUsers:h,getGroupPayload:g}=dn(n.name,n.description,n.mappingsSSO,n.users,n.rootRole);d.useEffect(()=>{h(n.users)},[n.users,t,h]);const x=async y=>{y.preventDefault();try{await i(n.id,g()),o(),a(),s(!1),l({text:"Group users saved successfully",type:"success"})}catch(b){c(V(b))}},j=()=>`curl --location --request PUT '${m.unleashUrl}/api/admin/groups/${n.id}' \\
7
+ --header 'Authorization: INSERT_API_KEY' \\
8
+ --header 'Content-Type: application/json' \\
9
+ --data-raw '${JSON.stringify(g(),void 0,2)}'`;return e.jsx(os,{open:t,onClose:()=>{s(!1)},label:"Edit users",children:e.jsx(Ee,{loading:r,modal:!0,title:"Edit users",description:"Groups is the best and easiest way to organize users and then use them in projects to assign a specific role in one go to all the users in a group.",documentationLink:"https://docs.getunleash.io/concepts/rbac#user-groups",documentationLinkLabel:"Groups documentation",formatApiCode:j,children:e.jsxs(Bd,{onSubmit:x,children:[e.jsxs("div",{children:[e.jsx(Ud,{children:"Edit users in this group"}),e.jsx(Ta,{users:p,setUsers:h}),e.jsx(ka,{users:p,setUsers:h})]}),e.jsx($d,{children:e.jsxs(_d,{children:[e.jsx(N,{type:"submit",variant:"contained",color:"primary","data-testid":No,children:"Save"}),e.jsx(Od,{onClick:()=>{s(!1)},children:"Cancel"})]})})]})})})},Aa=({open:t,setOpen:s,group:n})=>{const{refetchGroups:o}=Ve(),{removeGroup:a}=ht(),{setToastData:i,setToastApiError:r}=K(),l=Ce(),c=async()=>{try{await a(n.id),o(),s(!1),l("/admin/groups"),i({text:"Group removed successfully",type:"success"})}catch(m){r(V(m))}};return e.jsx(Q,{open:t,primaryButtonText:"Delete group",secondaryButtonText:"Cancel",onClick:c,onClose:()=>{s(!1)},title:"Delete group?",children:e.jsxs(A,{children:["Do you really want to delete ",e.jsx("strong",{children:n.name}),"? Users who are granted access to projects only via this group will lose access to those projects."]})})},Md=u("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:t.spacing(2),gridAutoRows:"1fr"})),Nd=(t,s)=>{var a,i,r,l,c,m,p;const n=s.toLowerCase(),o={names:(a=t.users)==null?void 0:a.map(h=>{var g;return((g=h.name)==null?void 0:g.toLowerCase())||""}),usernames:(i=t.users)==null?void 0:i.map(h=>{var g;return((g=h.username)==null?void 0:g.toLowerCase())||""}),emails:(r=t.users)==null?void 0:r.map(h=>{var g;return((g=h.email)==null?void 0:g.toLowerCase())||""})};return t.name.toLowerCase().includes(n)||((l=t.description)==null?void 0:l.toLowerCase().includes(n))||((c=o.names)==null?void 0:c.some(h=>h.includes(n)))||((m=o.usernames)==null?void 0:m.some(h=>h.includes(n)))||((p=o.emails)==null?void 0:p.some(h=>h.includes(n)))},Fd=()=>{const t=Ce(),[s,n]=d.useState(!1),[o,a]=d.useState(!1),[i,r]=d.useState(void 0),{groups:l=[],loading:c}=Ve(),[m,p]=Fo(),[h,g]=d.useState(m.get("search")||""),x=xe(Be.breakpoints.down("md"));d.useEffect(()=>{const C={};h&&(C.search=h),p(C,{replace:!0})},[h,p]);const j=d.useMemo(()=>{const C=l.sort((k,S)=>k.name.localeCompare(S.name));return h?C.filter(k=>Nd(k,h)):C},[l,h]),y=C=>{r(C),n(!0)},b=C=>{r(C),a(!0)};return e.jsxs(se,{isLoading:c,header:e.jsx(ne,{title:`Groups (${j.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:!x,show:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:h,onChange:g}),e.jsx(ne.Divider,{})]})}),e.jsx(Ks,{onClick:()=>t("/admin/groups/create-group"),maxWidth:"700px",Icon:as,permission:ee,"data-testid":Ri,children:"New group"})]}),children:e.jsx(T,{condition:x,show:e.jsx(ue,{initialValue:h,onChange:g})})}),children:[e.jsx(Ne,{value:h,children:e.jsx(Md,{children:j.map(C=>e.jsx(kd,{group:C,onEditUsers:y,onRemoveGroup:b},C.id))})}),e.jsx(T,{condition:!c&&j.length===0,show:e.jsx(T,{condition:(h==null?void 0:h.length)>0,show:e.jsxs(le,{children:["No groups found matching “",h,"”"]}),elseShow:e.jsx(Ed,{})})}),e.jsx(T,{condition:!!i,show:e.jsx(Ea,{open:s,setOpen:n,group:i})}),e.jsx(T,{condition:!!i,show:e.jsx(Aa,{open:o,setOpen:a,group:i})})]})},Gd=u("div")(({theme:t})=>({display:"flex",marginBottom:t.spacing(1),"& > div:first-of-type":{width:"100%",marginRight:t.spacing(1),"& > div:first-of-type":{width:"100%"}}})),Wd=({label:t,value:s,onChange:n,...o})=>{const[a,i]=d.useState(""),r=()=>{n(c=>[...c,a]),i("")},l=c=>{n(m=>m.filter(p=>p!==c))};return e.jsxs("div",{...o,children:[e.jsxs(Gd,{children:[e.jsx(Ze,{label:t,value:a,onChange:c=>i(c.target.value),onKeyPress:c=>{c.key==="Enter"&&r()}}),e.jsx(N,{startIcon:e.jsx(as,{}),onClick:r,variant:"outlined",color:"primary",disabled:!a.trim()||s.includes(a),children:"Add"})]}),e.jsx(Di,{flexDirection:"row",flexWrap:"wrap",gap:1,children:s==null?void 0:s.map((c,m)=>e.jsx(Ii,{label:c,onDelete:()=>l(c)},m))})]})},zd=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),gt=u("p")(({theme:t})=>({color:t.palette.text.secondary,marginBottom:t.spacing(1)})),Gn=u(Ze)(({theme:t})=>({width:"100%",maxWidth:t.spacing(60),marginBottom:t.spacing(2)})),Hd=u(Wd)(({theme:t})=>({width:"100%",maxWidth:t.spacing(60),marginBottom:t.spacing(2)})),qd=u("div")(({theme:t})=>({marginBottom:t.spacing(6)})),Vd=u("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),Yd=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),Jd=u("div")(({theme:t})=>({width:"100%",maxWidth:t.spacing(60),padding:t.spacing(3),backgroundColor:t.palette.neutral.light,color:t.palette.text.primary,fontSize:t.fontSizes.smallBody,borderRadius:t.shape.borderRadiusMedium,marginBottom:t.spacing(2),a:{color:t.palette.links}})),Kd=u("div")(({theme:t})=>({"& > div:first-of-type":{width:"100%",maxWidth:t.spacing(50),marginBottom:t.spacing(2)}})),Ra=({name:t,description:s,mappingsSSO:n,users:o,rootRole:a,isScimGroup:i,setName:r,setDescription:l,setMappingsSSO:c,setUsers:m,handleSubmit:p,handleCancel:h,setRootRole:g,errors:x,mode:j,children:y})=>{const{config:b}=ot("oidc"),{config:C}=ot("saml"),{roles:k}=be(),S=(b==null?void 0:b.enabled)&&b.enableGroupSyncing||(C==null?void 0:C.enabled)&&C.enableGroupSyncing,R=v=>k.find(P=>P.id===v)||null;return e.jsxs(zd,{onSubmit:p,children:[e.jsxs("div",{children:[e.jsx(gt,{children:"What would you like to call your group?"}),e.jsx(Gn,{autoFocus:!0,label:"Name",id:"group-name",error:!!x.name,errorText:x.name,value:t,onChange:v=>r(v.target.value),"data-testid":Pi,required:!0,disabled:i}),e.jsx(gt,{children:"How would you describe your group?"}),e.jsx(Gn,{multiline:!0,rows:4,label:"Description",placeholder:"A short description of the group",value:s,onChange:v=>l(v.target.value),"data-testid":Li}),e.jsx(T,{condition:S&&!i,show:e.jsxs(e.Fragment,{children:[e.jsx(gt,{children:"Is this group associated with SSO groups?"}),e.jsx(Hd,{label:"SSO group ID / name",value:n,onChange:c})]}),elseShow:()=>e.jsxs(Jd,{children:[e.jsxs(M,{sx:{display:"flex"},children:["You can enable SSO groups synchronization if needed",e.jsx(st,{tooltip:"SSO groups synchronization allows SSO groups to be mapped to Unleash groups, so that user group membership is properly synchronized."})]}),e.jsx(oe,{"data-loading":!0,to:"/admin/auth",children:e.jsx("span",{"data-loading":!0,children:"View SSO configuration"})})]})}),e.jsx(gt,{children:e.jsxs(M,{sx:{display:"flex"},children:["Do you want to associate a root role with this group?",e.jsx(st,{tooltip:"When you associate a root role with this group, users in this group will automatically inherit the role globally."})]})}),e.jsx(Kd,{children:e.jsx(us,{"data-testid":"GROUP_ROOT_ROLE",roles:k,value:R(a),setValue:v=>g((v==null?void 0:v.id)||null)})}),e.jsx(T,{condition:j==="Create",show:e.jsxs(e.Fragment,{children:[e.jsx(gt,{children:"Add users to this group"}),e.jsx(Ta,{users:o,setUsers:m}),e.jsx(qd,{children:e.jsx(ka,{users:o,setUsers:m})})]})})]}),e.jsxs(Vd,{children:[y,e.jsx(Yd,{onClick:h,children:"Cancel"})]})]})},Zd=()=>{const{setToastData:t,setToastApiError:s}=K(),{uiConfig:n}=W(),o=Ce(),{name:a,setName:i,description:r,setDescription:l,mappingsSSO:c,setMappingsSSO:m,users:p,setUsers:h,rootRole:g,setRootRole:x,getGroupPayload:j,clearErrors:y,errors:b,setErrors:C}=dn(),{groups:k}=Ve(),{createGroup:S,loading:R}=ht(),v=async E=>{if(E.preventDefault(),y(),!I)return;const D=j();try{const L=await S(D);o(`/admin/groups/${L.id}`),t({text:"Group created successfully",type:"success"})}catch(L){s(V(L))}},P=()=>`curl --location --request POST '${n.unleashUrl}/api/admin/groups' \\
10
+ --header 'Authorization: INSERT_API_KEY' \\
11
+ --header 'Content-Type: application/json' \\
12
+ --data-raw '${JSON.stringify(j(),void 0,2)}'`,B=()=>{o(Pe)},w=E=>E.length,H=E=>!(k!=null&&k.filter(D=>D.name===E).length),I=w(a)&&H(a),U=E=>{y(),H(E)||C({name:"A group with that name already exists."}),i(E)};return e.jsx(Ee,{loading:R,title:"Create group",description:"Groups is the best and easiest way to organize users and then use them in projects to assign a specific role in one go to all the users in a group.",documentationLink:"https://docs.getunleash.io/concepts/rbac#user-groups",documentationLinkLabel:"Groups documentation",formatApiCode:P,children:e.jsx(Ra,{name:a,description:r,mappingsSSO:c,rootRole:g,users:p,setName:U,setDescription:l,setMappingsSSO:m,setRootRole:x,setUsers:h,errors:b,handleSubmit:v,handleCancel:B,mode:Bi,isScimGroup:!1,children:e.jsx(N,{type:"submit",variant:"contained",color:"primary",disabled:!I,"data-testid":Ui,children:"Create group"})})})},Qd=()=>{const t=Number(is("groupId")),{group:s,refetchGroup:n}=cs(t);return s?e.jsx(Xd,{group:s,groupId:t,refetchGroup:n}):null},Xd=({group:t,groupId:s,refetchGroup:n})=>{const{refetchGroups:o}=Ve(),{setToastData:a,setToastApiError:i}=K(),{uiConfig:r}=W(),l=Ce(),{settings:{enabled:c}}=Lt(),m=c&&!!(t!=null&&t.scimId),{name:p,setName:h,description:g,setDescription:x,mappingsSSO:j,setMappingsSSO:y,users:b,setUsers:C,rootRole:k,setRootRole:S,getGroupPayload:R,clearErrors:v,errors:P,setErrors:B}=dn(t==null?void 0:t.name,t==null?void 0:t.description,t==null?void 0:t.mappingsSSO,t==null?void 0:t.users,t==null?void 0:t.rootRole),{groups:w}=Ve(),{updateGroup:H,loading:I}=ht(),U=async G=>{G.preventDefault(),v();const F=R();try{await H(s,F),n(),o(),l(Pe),a({text:"Group updated successfully",type:"success"})}catch(he){i(V(he))}},E=()=>`curl --location --request PUT '${r.unleashUrl}/api/admin/groups/${s}' \\
13
+ --header 'Authorization: INSERT_API_KEY' \\
14
+ --header 'Content-Type: application/json' \\
15
+ --data-raw '${JSON.stringify(R(),void 0,2)}'`,D=()=>{l(Pe)},L=G=>G.length,O=G=>!(w!=null&&w.filter(F=>F.name===G&&F.id!==s).length),Y=L(p)&&O(p),$=G=>{v(),O(G)||B({name:"A group with that name already exists."}),h(G)};return e.jsx(Ee,{loading:I,title:"Edit group",description:"Groups is the best and easiest way to organize users and then use them in projects to assign a specific role in one go to all the users in a group.",documentationLink:"https://docs.getunleash.io/concepts/rbac#user-groups",documentationLinkLabel:"Groups documentation",formatApiCode:E,children:e.jsx(Ra,{name:p,description:g,mappingsSSO:j,users:b,rootRole:k,setName:$,setDescription:x,setMappingsSSO:y,setUsers:C,setRootRole:S,errors:P,handleSubmit:U,handleCancel:D,mode:Zs,isScimGroup:m,children:e.jsx(Te,{title:m?wt:"",arrow:!0,children:e.jsx("div",{children:e.jsx(N,{type:"submit",variant:"contained",color:"primary",disabled:!Y,"data-testid":No,children:"Save"})})})})})},eu=u(Ye)(({theme:t})=>({borderRadius:t.shape.borderRadiusLarge,padding:t.spacing(2.5,4),boxShadow:"none",marginBottom:t.spacing(2),fontSize:t.fontSizes.smallBody})),tu=u("div")(({theme:t})=>({display:"flex",alignItems:"center",justifyContent:"space-between"})),su=u("h1")(({theme:t})=>({fontSize:t.fontSizes.mainHeader})),nu=u("div")(({theme:t})=>({display:"flex"})),ou=u("span")(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginLeft:t.spacing(1)})),au=({title:t,description:s,actions:n})=>(Jt(t),e.jsxs(eu,{children:[e.jsxs(tu,{children:[e.jsx(su,{children:t}),e.jsx(nu,{children:n})]}),e.jsx(T,{condition:!!(s!=null&&s.length),show:e.jsxs(e.Fragment,{children:["Description:",e.jsx(ou,{children:s})]})})]})),iu=({open:t,setOpen:s,user:n,group:o})=>{const{refetchGroup:a}=cs(o.id),{updateGroup:i}=ht(),{setToastData:r,setToastApiError:l}=K(),c=async()=>{try{const p={...o,users:o.users.filter(({id:h})=>h!==(n==null?void 0:n.id)).map(({id:h})=>({user:{id:h}}))};await i(o.id,p),a(),s(!1),r({text:"User removed from group successfully",type:"success"})}catch(p){l(V(p))}},m=(n==null?void 0:n.name)||(n==null?void 0:n.username)||(n==null?void 0:n.email);return e.jsx(Q,{open:t&&!!n,primaryButtonText:"Remove user",secondaryButtonText:"Cancel",onClick:c,onClose:()=>{s(!1)},title:"Remove user from group?",children:e.jsxs(A,{children:["Do you really want to remove ",e.jsx("strong",{children:m})," from"," ",e.jsx("strong",{children:o.name}),"? ",e.jsx("strong",{children:m})," will lose all access rights granted by this group."]})})},ru=Array(15).fill({name:"Name of the user",username:"Username of the user"}),lu={id:"joinedAt",desc:!0},{value:Wn,setValue:cu}=$i("Group:v1",lu),du=()=>{const t=Number(is("groupId")),s=Rt(),n=xe(s.breakpoints.down("md")),{group:o,loading:a}=cs(t),[i,r]=d.useState(!1),[l,c]=d.useState(!1),[m,p]=d.useState(!1),[h,g]=d.useState(),{settings:{enabled:x}}=Lt(),j=x&&!!(o!=null&&o.scimId),y=d.useMemo(()=>[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:D}})=>e.jsx(ae,{children:e.jsx(Ke,{user:D})}),maxWidth:85,disableSortBy:!0},{id:"name",Header:"Name",accessor:D=>D.name||"",Cell:({value:D,row:{original:L}})=>e.jsx(Se,{value:D,subtitle:L.email||L.username}),minWidth:100,searchable:!0},{Header:"Joined",accessor:"joinedAt",Cell:je,maxWidth:150},{id:"createdBy",Header:"Added by",accessor:"createdBy",Cell:Se,minWidth:90,searchable:!0},{Header:"Last login",accessor:"seenAt",Cell:Me,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:D}})=>e.jsx(Yt,{children:e.jsx(Te,{title:j?wt:"Remove user from group",arrow:!0,describeChild:!0,children:e.jsx("span",{children:e.jsx(Oe,{"data-testid":`${Oi}-${D.id}`,onClick:()=>{g(D),p(!0)},disabled:j,children:e.jsx(Le,{})})})})}),maxWidth:100,disableSortBy:!0},{accessor:D=>D.username||"",Header:"Username",searchable:!0},{accessor:D=>D.email||"",Header:"Email",searchable:!0}],[g,p]),[b,C]=Fo(),[k]=d.useState(()=>({sortBy:[{id:b.get("sort")||Wn.id,desc:b.has("order")?b.get("order")==="desc":Wn.desc}],hiddenColumns:["Username","Email"],globalFilter:b.get("search")||""})),[S,R]=d.useState(k.globalFilter),{data:v,getSearchText:P,getSearchContext:B}=dt(y,S,(o==null?void 0:o.users)??[]),w=d.useMemo(()=>(v==null?void 0:v.length)===0&&a?ru:v,[v,a]),{headerGroups:H,rows:I,prepareRow:U,state:{sortBy:E}}=z.useTable({columns:y,data:w,initialState:k,sortTypes:fe,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return d.useEffect(()=>{const D={};D.sort=E[0].id,E[0].desc&&(D.order="desc"),S&&(D.search=S),C(D,{replace:!0}),cu({id:E[0].id,desc:E[0].desc||!1})},[E,S,C]),e.jsx(T,{condition:!!o,show:e.jsxs(e.Fragment,{children:[e.jsx(au,{title:o==null?void 0:o.name,description:o==null?void 0:o.description,actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{"data-testid":_i,to:`/admin/groups/${t}/edit`,component:oe,"data-loading":!0,permission:ee,tooltipProps:{title:j?wt:"Edit group"},children:e.jsx(At,{})}),e.jsx(Ue,{"data-testid":Mi,"data-loading":!0,onClick:()=>r(!0),permission:ee,tooltipProps:{title:"Delete group"},children:e.jsx(Le,{})})]})}),e.jsxs(se,{isLoading:a,header:e.jsx(ne,{secondary:!0,title:`Users (${I.length<w.length?`${I.length} of ${w.length}`:w.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:!n,show:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:S,onChange:R,hasFilters:!0,getSearchContext:B}),e.jsx(ne.Divider,{})]})}),e.jsx(Ks,{"data-testid":Ni,onClick:()=>{c(!0)},maxWidth:"700px",Icon:as,permission:ee,disabled:j,tooltipProps:{title:j?wt:""},children:"Edit users"})]}),children:e.jsx(T,{condition:n,show:e.jsx(ue,{initialValue:S,onChange:R,hasFilters:!0,getSearchContext:B})})}),children:[e.jsx(Ne,{value:P(S),children:e.jsx(ye,{rows:I,headerGroups:H,prepareRow:U})}),e.jsx(T,{condition:I.length===0,show:e.jsx(T,{condition:(S==null?void 0:S.length)>0,show:e.jsxs(le,{children:["No users found matching “",S,"” in this group."]}),elseShow:e.jsx(le,{children:"This group is empty. Get started by adding a user to the group."})})}),e.jsx(Aa,{open:i,setOpen:r,group:o}),e.jsx(Ea,{open:l,setOpen:c,group:o}),e.jsx(iu,{open:m,setOpen:p,user:h,group:o})]})]})})},uu=()=>{const{uiConfig:t,isEnterprise:s}=W();return s()||t.flags[Fi]===!0?e.jsx("div",{children:e.jsx(ve,{permissions:De,children:e.jsxs(it,{children:[e.jsx(_,{index:!0,element:e.jsx(Fd,{})}),e.jsx(_,{path:"create-group",element:e.jsx(Zd,{})}),e.jsx(_,{path:":groupId/edit",element:e.jsx(Qd,{})}),e.jsx(_,{path:":groupId",element:e.jsx(du,{})})]})})}):e.jsx(at,{feature:"groups",page:!0})},Da=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/instance-admin/statistics"),hu);return d.useMemo(()=>({stats:t,loading:!s&&!t,refetchGroup:()=>n(),error:s}),[t,s,n])},hu=t=>fetch(t).then(ce("Instance Stats")).then(s=>s.json()),pu=()=>{var i,r,l;const{stats:t}=Da();let s,n;t!=null&&t.versionEnterprise?(s="Unleash Enterprise version",n=t.versionEnterprise):(s="Unleash OSS version",n=t==null?void 0:t.versionOSS);const o=Object.values((t==null?void 0:t.apiTokens)??{}).reduce((c,m)=>c+m,0),a=[{title:"Instance Id",value:t==null?void 0:t.instanceId,offset:!1},{title:s,value:n},{title:"Users",value:t==null?void 0:t.users},{title:"Feature flags",value:t==null?void 0:t.featureToggles},{title:"Projects",value:t==null?void 0:t.projects},{title:"Environments",value:t==null?void 0:t.environments},{title:"Roles",value:t==null?void 0:t.roles},{title:"Groups",value:t==null?void 0:t.groups},{title:"Context fields",value:t==null?void 0:t.contextFields},{title:"Strategies",value:t==null?void 0:t.strategies},{title:"Feature exports",value:t==null?void 0:t.featureExports},{title:"Feature imports",value:t==null?void 0:t.featureImports},{title:"Admin API tokens",value:(i=t==null?void 0:t.apiTokens)==null?void 0:i.admin},{title:"Client API tokens",value:(r=t==null?void 0:t.apiTokens)==null?void 0:r.client},{title:"Frontend API tokens",value:(l=t==null?void 0:t.apiTokens)==null?void 0:l.frontend},{title:"API tokens total",value:o},{title:"Segments",value:t==null?void 0:t.segments},{title:"Highest number of strategies used for a single flag in a single environment",value:t==null?void 0:t.maxEnvironmentStrategies},{title:"Highest number of constraints used on a single strategy",value:t==null?void 0:t.maxConstraints},{title:"Highest number of values used for a single constraint",value:t==null?void 0:t.maxConstraintValues},{title:"Release templates",value:t==null?void 0:t.releaseTemplates},{title:"Release plans",value:t==null?void 0:t.releasePlans}];return t!=null&&t.versionEnterprise&&a.push({title:"SAML enabled",value:t!=null&&t.SAMLenabled?"Yes":"No"},{title:"OIDC enabled",value:t!=null&&t.OIDCenabled?"Yes":"No"}),e.jsx(se,{header:e.jsx(ne,{title:"Instance Statistics"}),children:e.jsxs(yn,{sx:{display:"grid",gap:4},children:[e.jsxs(Io,{"aria-label":"Instance statistics",children:[e.jsx(Po,{children:e.jsxs(Tt,{children:[e.jsx(de,{children:"Field"}),e.jsx(de,{align:"right",children:"Value"})]})}),e.jsx(Ys,{children:a.map(c=>e.jsxs(Tt,{children:[e.jsx(de,{component:"th",scope:"row",children:e.jsx(yn,{component:"span",sx:m=>({marginLeft:c.offset?m.spacing(2):0}),children:c.title})}),e.jsx(de,{align:"right",children:c.value})]},c.title))})]}),e.jsx("span",{style:{textAlign:"center"},children:e.jsx(N,{startIcon:e.jsx(Go,{}),"aria-label":"Download instance statistics",color:"primary",variant:"contained",target:"_blank",rel:"noreferrer",href:te("/api/admin/instance-admin/statistics/csv"),children:"Download"})})]})})},mu=()=>e.jsx("div",{children:e.jsx(pu,{})}),xu=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",padding:t.spacing(3),border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge})),gu=u(M)(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"})),ju=u(M)(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginTop:t.spacing(2)})),fu=u("p")(({theme:t})=>({display:"table-cell",fontWeight:t.fontWeight.bold,paddingTop:t.spacing(2)})),yu=u("p")(({theme:t})=>({display:"table-cell",paddingTop:t.spacing(2),paddingLeft:t.spacing(4)})),bu=u("div")(({theme:t})=>({display:"table-cell",width:"75%",paddingTop:t.spacing(2),paddingBottom:t.spacing(2)})),Su=u("div")(({theme:t})=>({display:"table-cell"})),vu=u("span")(({theme:t})=>({display:"block",textAlign:"right",color:t.palette.neutral.dark})),Cu=u("div")(({theme:t})=>({maxWidth:t.spacing(50),color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody})),wu=u("div")(()=>({display:"table-row"})),zn=u("div")(()=>({display:"table"})),Tu=u("div")(()=>({display:"table-cell"})),ku=({changeInfoText:t,variablesText:s,dependsOnText:n})=>e.jsxs(Cu,{children:[e.jsx(Hn,{children:t}),e.jsx(Eu,{children:e.jsx("div",{children:s})}),e.jsx(T,{condition:!!n,show:e.jsx(Hn,{children:n})})]}),Eu=u("code")(({theme:t})=>({display:"block",color:t.palette.text.primary,backgroundColor:t.palette.background.application,fontSize:t.fontSizes.smallerBody,marginTop:t.spacing(1),padding:t.spacing(1),border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadius,borderWidth:1,wordWrap:"break-word",whiteSpace:"pre-wrap",fontFamily:"monospace",lineHeight:1.5})),Hn=u("p")(({theme:t})=>({color:t.palette.text.primary,fontSize:t.fontSizes.smallBody,marginTop:t.spacing(1)})),qn=({title:t,infoText:s,concreteDetails:n,enabled:o,changeInfoText:a,variablesText:i,dependsOnText:r})=>e.jsxs(xu,{children:[e.jsxs(gu,{children:[e.jsx("b",{children:t}),e.jsx(Su,{children:e.jsx(T,{condition:o,show:e.jsx(Ie,{color:"success",icon:e.jsx(qs,{}),children:"Data is collected"}),elseShow:e.jsx(Ie,{color:"neutral",icon:e.jsx(Gi,{}),children:"No data is collected"})})})]}),e.jsxs(ju,{children:[e.jsxs(zn,{children:[e.jsx(bu,{children:s}),e.jsx(Tu,{children:e.jsx(vu,{children:e.jsx(ss,{tooltip:e.jsx(ku,{changeInfoText:a,variablesText:i,dependsOnText:r}),children:o?"How to disable collecting data?":"How to enable collecting data?"})})})]}),e.jsx(zn,{children:Object.entries(n).map(([l,c])=>e.jsxs(wu,{children:[e.jsx(fu,{children:l}),e.jsx(yu,{children:c})]},l))})]})]}),Au=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/telemetry/settings"),Ru);return d.useMemo(()=>({settings:t,loading:!s&&!t,refetchGroup:()=>n(),error:s}),[t,s,n])},Ru=t=>fetch(t).then(ce("Telemetry Settings")).then(s=>s.json()),Du=u(M)(({theme:t})=>({display:"grid",gap:t.spacing(4)})),Rs={title:"Version data collection",infoText:"We collect the version of Unleash that you're using. We use this information to inform your Unleash instance of latest updates and critical security patches.",concreteDetails:{"Instance ID":"A unique ID generated for your instance",Version:"The version of Unleash that you're using"}},Ds={title:"Feature data collection",infoText:"We collect data about your instance to improve the Unleash product user experience. We may also use the data in case you need help from our support team. Data collection is for internal use only and is not shared with third parties outside Unleash. As we want you to be in control of your data, we will leave it up to you to allow us to collect your data.",concreteDetails:{"Feature flags":"The number of feature flags in your instance",Users:"The number of users registered in your instance",Projects:"The number of projects in your instance","Context Fields":"The number of custom context fields in use",Groups:"The number of groups present in your instance",Roles:"The number of custom roles defined in your instance","Custom Root Roles":"The number of custom root roles defined in your instance","Custom Root Roles In Use":"The number of custom root roles that are in use by entities (users, groups, service accounts)",Environments:"The number of environments in your instance",Segments:"The number of segments defined in your instance",Strategies:"The number of strategies defined in your instance","Feature Exports":"The number of feature exports performed","Feature Imports":"The number of feature imports performed","Custom Strategies":"The number of custom strategies defined in your instance","Custom Strategies In Use":"The number of custom strategies that are in use by feature flags"}},Vn={enabled:{environmentVariables:"CHECK_VERSION=false",changeInfoText:"Version info collection can be disabled by setting the environment variable `CHECK_VERSION` to `false` and restarting Unleash."},disabled:{environmentVariables:"CHECK_VERSION=true",changeInfoText:"Version info collection can be enabled by setting the environment variable to true and restarting Unleash."}},Yn={enabled:{environmentVariables:"SEND_TELEMETRY=false",changeInfoText:"Feature usage collection can be disabled by setting the environment variable to false and restarting Unleash."},disabled:{environmentVariables:"SEND_TELEMETRY=true",changeInfoText:"To enable feature usage collection set the environment variable to true and restart Unleash."}},Iu=()=>{const{settings:t}=Au(),{loading:s}=W();if(s)return null;const n=t!=null&&t.versionInfoCollectionEnabled?Vn.enabled:Vn.disabled,o=t!=null&&t.featureInfoCollectionEnabled?Yn.enabled:Yn.disabled;let a;return t!=null&&t.versionInfoCollectionEnabled||(a=t!=null&&t.featureInfoCollectionEnabled?"Note: Feature usage collection is enabled, but for it to be active you must also enable version info collection":"When you enable feature usage collection you must also enable version info collection"),e.jsx(se,{header:e.jsx(ne,{title:"Instance Privacy"}),children:e.jsxs(Du,{children:[e.jsx(qn,{title:Rs.title,infoText:Rs.infoText,concreteDetails:Rs.concreteDetails,enabled:t==null?void 0:t.versionInfoCollectionEnabled,changeInfoText:n.changeInfoText,variablesText:n.environmentVariables}),e.jsx(qn,{title:Ds.title,infoText:Ds.infoText,concreteDetails:Ds.concreteDetails,enabled:(t==null?void 0:t.featureInfoCollectionEnabled)&&(t==null?void 0:t.versionInfoCollectionEnabled),changeInfoText:o.changeInfoText,variablesText:o.environmentVariables,dependsOnText:a})]})})},Pu=()=>e.jsx(J,{severity:"warning",children:e.jsxs("p",{children:[e.jsx("b",{children:"Heads up!"})," If you enable maintenance mode, edit access in the entire system will be disabled for all the users (admins, editors, custom roles, etc). During this time nobody will be able to do changes or to make new configurations."]})}),Lu=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/maintenance"),Bu);return d.useMemo(()=>({enabled:!!(t!=null&&t.enabled),loading:!s&&!t,refetchMaintenance:n,error:s}),[t,s,n])},Bu=t=>fetch(t).then(ce("Maintenance")).then(s=>s.json()),Uu=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0});return{toggleMaintenance:async i=>{const l=s("api/admin/maintenance",{method:"POST",body:JSON.stringify(i)});await t(l.caller,l.id)},errors:n,loading:o}},$u=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",padding:t.spacing(3),border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge})),Ou=u(M)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),_u=u(M)(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginTop:t.spacing(2)})),Mu=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody})),Nu=()=>{const{enabled:t,refetchMaintenance:s}=Lu(),{refetch:n}=W(),{toggleMaintenance:o}=Uu(),{trackEvent:a}=Qs(),{setToastData:i}=K(),r=async()=>{i({type:"success",text:`Maintenance mode has been successfully ${t?"disabled":"enabled"}`}),a("maintenance",{props:{eventType:`maintenance ${t?"de":""}activated`}}),await o({enabled:!t}),s(),n()};return e.jsxs($u,{children:[e.jsxs(Ou,{children:[e.jsx("b",{children:"Maintenance Mode"}),e.jsx(re,{sx:{margin:0},control:e.jsx(me,{onChange:r,value:t,name:"enabled",checked:t}),label:e.jsx(Mu,{children:t?"Enabled":"Disabled"})})]}),e.jsx(_u,{children:"Maintenance Mode is useful when you want to freeze your system so nobody can do any changes during this time. When enabled it will show a banner at the top of the applications and only an admin can enable it or disable it."})]})},Fu=()=>e.jsx("div",{children:e.jsx(ve,{permissions:[ee,Wi],children:e.jsx(Wu,{})})}),Gu=u(M)(({theme:t})=>({display:"grid",gap:t.spacing(4)})),Wu=()=>{const{loading:t}=W();return t?null:e.jsx(se,{header:e.jsx(ne,{title:"Maintenance"}),children:e.jsxs(Gu,{children:[e.jsx(Pu,{}),e.jsx(Nu,{})]})})},zu=u(oe)(({theme:t})=>({display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%",textDecoration:"none",color:"inherit",padding:t.spacing(0,5),"&.active":{fontWeight:"bold"}})),Ia=({to:t,children:s})=>e.jsx(zu,{to:t,children:s}),Hu=d.lazy(()=>ut(()=>import("./NetworkOverview-p_eqqiwO.js"),[])),qu=d.lazy(()=>ut(()=>import("./NetworkTraffic-NxX5X_w8.js"),[])),Vu=d.lazy(()=>ut(()=>import("./NetworkTrafficUsage-B-4F8Mzq.js"),[])),Yu=d.lazy(()=>ut(()=>import("./BackendConnections-MqHimHCS.js"),[])),Ju=d.lazy(()=>ut(()=>import("./FrontendNetworkTrafficUsage-D8l5Nldl.js"),[])),Jn=[{label:"Overview",path:"/admin/network"},{label:"Traffic",path:"/admin/network/traffic"}],Ku=[{label:"Data Usage",path:"/admin/network/data-usage"}],Zu=[{label:"Backend Connections",path:"/admin/network/backend-connections"},{label:"Frontend Traffic",path:"/admin/network/frontend-data-usage"}],Qu=()=>{const{pathname:t}=Ws(),n=Gs("consumptionModelUI")?[...Jn,...Zu]:[...Jn,...Ku];return e.jsx("div",{children:e.jsx(se,{withTabs:!0,header:e.jsx(Wo,{value:t,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:n.map(({label:o,path:a})=>e.jsx(zo,{value:a,label:e.jsx(Ia,{to:a,children:e.jsx("span",{children:o})}),sx:{padding:0}},o))}),children:e.jsxs(it,{children:[e.jsx(_,{path:"*",element:e.jsx(Hu,{})}),e.jsx(_,{path:"traffic",element:e.jsx(qu,{})}),e.jsx(_,{path:"connected-edges",element:e.jsx(zs,{to:"/admin/enterprise-edge",replace:!0})}),e.jsx(_,{path:"data-usage",element:e.jsx(Vu,{})}),e.jsx(_,{path:"backend-connections",element:e.jsx(Yu,{})}),e.jsx(_,{path:"frontend-data-usage",element:e.jsx(Ju,{})})]})})})},Xu=u(M)(()=>({display:"flex",justifyContent:"center"})),eh=({role:t,onEdit:s,onDelete:n})=>{const o=Ge.includes(t.type);return e.jsxs(Xu,{children:[e.jsx(Ue,{"data-loading":!0,onClick:s,permission:ee,disabled:o,tooltipProps:{title:o?"You cannot edit a predefined role":"Edit role"},children:e.jsx(At,{})}),e.jsx(Ue,{"data-loading":!0,onClick:n,permission:ee,disabled:o,tooltipProps:{title:o?"You cannot remove a predefined role":"Remove role"},children:e.jsx(Le,{})})]})},th=u(Ie)(({theme:t})=>({marginLeft:t.spacing(1)})),sh=({role:t})=>e.jsx(Se,{value:t.name,subtitle:t.description,afterTitle:e.jsx(T,{condition:Ge.includes(t.type),show:e.jsx(th,{color:"success",children:"Predefined"})})}),nh=({users:t})=>{const[s]=d.useState(()=>({sortBy:[{id:"last-login",desc:!0}]})),n=d.useMemo(()=>[{id:"name",Header:"Name",accessor:r=>r.name||"",minWidth:200,Cell:({row:{original:r}})=>e.jsx(Se,{value:r.name,subtitle:r.email||r.username})},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"last-login",Header:"Last login",accessor:"seenAt",Cell:Me,maxWidth:150}],[]),{headerGroups:o,rows:a,prepareRow:i}=z.useTable({columns:n,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return e.jsx(ye,{rows:a,headerGroups:o,prepareRow:i})},oh=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallerBody})),Pa=({serviceAccount:t,value:s,onCreateToken:n})=>{var a,i,r;const{searchQuery:o}=Js();return!t.tokens||t.tokens.length===0?n?e.jsx(Ho,{title:"Create token",onClick:n}):e.jsx(ae,{children:"0 tokens"}):e.jsx(ae,{children:e.jsx(ss,{tooltip:e.jsx(e.Fragment,{children:(a=t.tokens)==null?void 0:a.map(({id:l,description:c})=>e.jsx(oh,{children:e.jsx(Ht,{search:o,children:c})},l))}),highlighted:o.length>0&&s.toLowerCase().includes(o.toLowerCase()),children:((i=t.tokens)==null?void 0:i.length)===1?"1 token":`${(r=t.tokens)==null?void 0:r.length} tokens`})})},ah=({serviceAccounts:t})=>{const[s]=d.useState(()=>({sortBy:[{id:"seenAt",desc:!0}]})),n=d.useMemo(()=>[{id:"name",Header:"Name",accessor:r=>r.name||"",minWidth:200,Cell:({row:{original:r}})=>e.jsx(Se,{value:r.name,subtitle:r.username})},{id:"tokens",Header:"Tokens",accessor:r=>{var l;return((l=r.tokens)==null?void 0:l.map(({description:c})=>c).join(`
16
+ `))||""},Cell:({row:{original:r},value:l})=>e.jsx(Pa,{serviceAccount:r,value:l}),maxWidth:100},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"seenAt",Header:"Last seen",accessor:r=>{var l;return(l=r.tokens.sort((c,m)=>{const p=new Date(c.seenAt||0),h=new Date(m.seenAt||0);return(h==null?void 0:h.getTime())-(p==null?void 0:p.getTime())})[0])==null?void 0:l.seenAt},Cell:Me,maxWidth:150}],[]),{headerGroups:o,rows:a,prepareRow:i}=z.useTable({columns:n,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return e.jsx(ye,{rows:a,headerGroups:o,prepareRow:i})},ih=({groups:t})=>{const[s]=d.useState(()=>({sortBy:[{id:"createdAt",desc:!0}]})),n=d.useMemo(()=>[{id:"name",Header:"Name",accessor:r=>r.name||"",minWidth:200,Cell:({row:{original:r}})=>e.jsx(Se,{value:r.name,subtitle:r.description})},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"users",Header:"Users",accessor:r=>r.users.length===1?"1 user":`${r.users.length} users`,Cell:ae,maxWidth:150}],[]),{headerGroups:o,rows:a,prepareRow:i}=z.useTable({columns:n,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return e.jsx(ye,{rows:a,headerGroups:o,prepareRow:i})},Is=u("div")(({theme:t})=>({marginTop:t.spacing(1.5)})),Ps=u("p")(({theme:t})=>({marginTop:t.spacing(3)})),rh=({role:t,open:s,setOpen:n,onConfirm:o})=>{const{users:a}=be(),{serviceAccounts:i}=It(),{groups:r}=Ve(),l=a.filter(({rootRole:h})=>h===(t==null?void 0:t.id)),c=i.filter(({rootRole:h})=>h===(t==null?void 0:t.id)),m=r==null?void 0:r.filter(({rootRole:h})=>h===(t==null?void 0:t.id)),p=!!(l.length||c.length||m!=null&&m.length);return e.jsx(Q,{title:"Delete root role?",open:s,primaryButtonText:"Delete role",secondaryButtonText:"Cancel",disabledPrimaryButton:p,onClick:()=>o(t),onClose:()=>{n(!1)},children:e.jsx(T,{condition:p,show:e.jsxs(e.Fragment,{children:[e.jsx(J,{severity:"error",children:"You are not allowed to delete a role that is currently in use. Please change the role of the following entities first:"}),e.jsx(T,{condition:!!l.length,show:e.jsxs(e.Fragment,{children:[e.jsxs(Ps,{children:["Users (",l.length,"):"]}),e.jsx(Is,{children:e.jsx(nh,{users:l})})]})}),e.jsx(T,{condition:!!c.length,show:e.jsxs(e.Fragment,{children:[e.jsxs(Ps,{children:["Service accounts (",c.length,"):"]}),e.jsx(Is,{children:e.jsx(ah,{serviceAccounts:c})})]})}),e.jsx(T,{condition:!!(m!=null&&m.length),show:e.jsxs(e.Fragment,{children:[e.jsxs(Ps,{children:["Groups (",m==null?void 0:m.length,"):"]}),e.jsx(Is,{children:e.jsx(ih,{groups:m})})]})})]}),elseShow:e.jsxs("p",{children:["You are about to delete role:"," ",e.jsx("strong",{children:t==null?void 0:t.name})]})})})},lh=t=>{const{isEnterprise:s}=W(),{data:n,error:o,mutate:a}=Kt(s()&&t,{projects:[]},te(`api/admin/projects/roles/${t}/access`),ch);return d.useMemo(()=>({projects:(n==null?void 0:n.projects)??[],loading:!o&&!n,refetch:()=>a(),error:o}),[n,o,a])},ch=t=>fetch(t).then(ce("Project role usage")).then(s=>s.json()),dh=({projects:t})=>{const[s]=d.useState(()=>({sortBy:[{id:"name"}]})),n=d.useMemo(()=>[{id:"name",Header:"Project name",accessor:r=>r.project||"",minWidth:200,Cell:({row:{original:r}})=>e.jsx(Ho,{title:r.project,to:`/projects/${r.project}`})},{id:"users",Header:"Assigned users",accessor:r=>r.userCount===1?"1 user":`${r.userCount} users`,Cell:ae,maxWidth:150},{id:"serviceAccounts",Header:"Service accounts",accessor:r=>r.serviceAccountCount===1?"1 account":`${r.serviceAccountCount} accounts`,Cell:ae,maxWidth:150},{id:"groups",Header:"Assigned groups",accessor:r=>r.groupCount===1?"1 group":`${r.groupCount} groups`,Cell:ae,maxWidth:150}],[]),{headerGroups:o,rows:a,prepareRow:i}=z.useTable({columns:n,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return e.jsx(ye,{rows:a,headerGroups:o,prepareRow:i})},uh=u("div")(({theme:t})=>({marginTop:t.spacing(1.5)})),hh=u("p")(({theme:t})=>({marginTop:t.spacing(3)})),ph=({role:t,open:s,setOpen:n,onConfirm:o})=>{const{projects:a}=lh(t==null?void 0:t.id),i=!!(a!=null&&a.length);return e.jsx(Q,{title:"Delete project role?",open:s,primaryButtonText:"Delete role",secondaryButtonText:"Cancel",disabledPrimaryButton:i,onClick:()=>o(t),onClose:()=>{n(!1)},maxWidth:"md",children:e.jsx(T,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsx(J,{severity:"error",children:"You are not allowed to delete a role that is currently in use. Please change the role of the following entities first:"}),e.jsx(T,{condition:!!(a!=null&&a.length),show:e.jsxs(e.Fragment,{children:[e.jsxs(hh,{children:["Role assigned in ",a==null?void 0:a.length," ","projects:"]}),e.jsx(uh,{children:e.jsx(dh,{projects:a})})]})})]}),elseShow:e.jsxs("p",{children:["You are about to delete role:"," ",e.jsx("strong",{children:t==null?void 0:t.name})]})})})},mh="custom",xh=({role:t,open:s,setOpen:n,onConfirm:o})=>(t==null?void 0:t.type)===mh?e.jsx(ph,{role:t,open:s,setOpen:n,onConfirm:o}):e.jsx(rh,{role:t,open:s,setOpen:n,onConfirm:o}),La=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0});return{addRole:async c=>{const p=n("api/admin/roles",{method:"POST",body:JSON.stringify(c)},"addRole");return(await s(p.caller,p.id)).json()},updateRole:async(c,m)=>{const h=n(`api/admin/roles/${c}`,{method:"PUT",body:JSON.stringify(m)},"updateRole");await s(h.caller,h.id)},removeRole:async c=>{const p=n(`api/admin/roles/${c}`,{method:"DELETE"},"removeRole");await s(p.caller,p.id)},validateRole:async c=>{const p=n("api/admin/roles/validate",{method:"POST",body:JSON.stringify(c)},"validateRole");await s(p.caller,p.id)},errors:o,loading:t}},Kn={name:void 0,description:void 0,permissions:void 0},gh=(t="",s="",n=[])=>{const{roles:o,projectRoles:a}=Pt(),[i,r]=d.useState(t),l=E=>r(E.trim()),[c,m]=d.useState(s),[p,h]=d.useState({}),[g,x]=d.useState(Kn),[j,y]=d.useState(!1);d.useEffect(()=>{r(t)},[t]),d.useEffect(()=>{m(s)},[s]),d.useEffect(()=>{const E=bn(n);h(E)},[n.length]);const b=(E=$e)=>({name:i,description:c,type:E===$e?"root-custom":"custom",permissions:Object.values(p).map(({name:D,environment:L})=>({name:D,environment:L}))}),C=E=>![...o,...a].some(D=>D.name!==t&&D.name.toLowerCase()===E.toLowerCase()),k=E=>E.length,S=E=>Object.keys(E).length>0,R=E=>{x(D=>({...D,[E]:void 0}))},v=(E,D)=>{x(L=>({...L,[E]:D}))},P=E=>{const D=E.trim();return k(D)?C(D)?(R("name"),!0):(v("name","Name must be unique."),!1):(v("name","Name is required."),!1)},B=E=>{const D=E.trim();return k(D)?(R("description"),!0):(v("description","Description is required."),!1)},w=E=>S(E)?(R("permissions"),!0):(v("permissions","You must select at least one permission."),!1),H=()=>{const E=P(i),D=B(c),L=w(p);return y(!0),E&&D&&L},I=j&&Object.values(g).some(Boolean);return{name:i,setName:l,validateName:P,description:c,setDescription:m,validateDescription:B,checkedPermissions:p,setCheckedPermissions:h,validatePermissions:w,getRolePayload:b,errors:g,showErrors:I,validate:H,reload:()=>{r(t),m(s),h(bn(n)),y(!1),x(Kn)}}};var un={},jh=ct;Object.defineProperty(un,"__esModule",{value:!0});var Ba=un.default=void 0,fh=jh(lt()),yh=e,bh=(0,fh.default)((0,yh.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-6 10H6v-2h8v2zm4-4H6v-2h12v2z"}),"Topic");Ba=un.default=bh;const Sh=({permissions:t,checkedPermissions:s,onPermissionChange:n})=>e.jsx(M,{display:"grid",gridTemplateColumns:{sm:"1fr 1fr",xs:"1fr"},children:t==null?void 0:t.map(o=>e.jsx(re,{"data-testid":nt(o),control:e.jsx(ns,{checked:!!s[nt(o)],onChange:()=>n(o),color:"primary"}),label:o.displayName},nt(o)))}),Ua=t=>{const s=(t==null?void 0:t.map(i=>nt(i)).sort())||[],n=Sn.flatMap(i=>i.permissions.map(([r])=>r)).sort(),o=s.filter(i=>!n.includes(i));return[...Sn,{label:"Other",permissions:o.map(i=>[i])}].map(i=>({label:i.label,permissions:i.permissions.filter(([r])=>s.includes(r)).map(([r,l])=>[t.find(c=>nt(c)===r),l])})).filter(i=>i.permissions.length>0)},vh=({permission:t,onChange:s,isChecked:n,hasParentPermission:o,isParentPermissionChecked:a})=>e.jsx(M,{sx:i=>({marginLeft:o?i.spacing(1.5):0}),children:e.jsx(re,{"data-testid":t,control:e.jsx(ns,{checked:!!(n||a),onChange:s,color:"primary",disabled:a}),label:t.displayName},t.name)}),Ch=u("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"1fr 1fr",gap:t.spacing(1),[t.breakpoints.down("md")]:{gridTemplateColumns:"1fr"}})),wh=u(A)(({theme:t})=>({fontWeight:t.typography.fontWeightBold,marginTop:t.spacing(2),marginBottom:t.spacing(1)})),Th=({permissions:t,checkedPermissions:s,onPermissionChange:n})=>{const o=d.useMemo(()=>Ua(t),[t]);return e.jsx(Ch,{children:o.map(a=>e.jsxs("div",{children:[e.jsx(wh,{children:a.label}),e.jsx("div",{children:a.permissions.map(([i,r])=>e.jsx(vh,{permission:i,onChange:()=>n(i),isChecked:!!s[i.name],hasParentPermission:!!r,isParentPermissionChecked:!!(r&&s[r])}))})]}))})},kh=u(M)(({theme:t})=>({display:"flex",alignItems:"center",[t.breakpoints.down(500)]:{flexDirection:"column",alignItems:"flex-start"}})),Eh=u(zi)(({theme:t})=>({fontWeight:t.typography.fontWeightBold,marginRight:t.spacing(1)})),Ah=({title:t,permissions:s,checkedPermissions:n,Icon:o,isInitiallyExpanded:a=!1,context:i,children:r,onCheckAll:l})=>{const[c,m]=d.useState(a),p=d.useMemo(()=>(s==null?void 0:s.reduce((x,j)=>(x[nt(j)]=!0,x),{}))||{},[s]),h=d.useMemo(()=>Object.keys(n).filter(x=>p[x]).length||0,[n,p]),g=d.useMemo(()=>h===(s==null?void 0:s.length),[h,s]);return e.jsx(M,{sx:{my:2,pb:1},children:e.jsxs(Qt,{expanded:c,onChange:()=>m(!c),sx:{boxShadow:"none",px:3,py:1,border:x=>`1px solid ${x.palette.divider}`,borderRadius:x=>`${x.shape.borderRadiusLarge}px`},children:[e.jsx(Xt,{expandIcon:e.jsx(Oe,{children:e.jsx(es,{titleAccess:"Toggle"})}),sx:{boxShadow:"none",padding:"0"},children:e.jsxs(kh,{children:[o,e.jsx(Eh,{text:t,maxWidth:"120",maxLength:25})," ",e.jsxs(A,{variant:"body2",color:"text.secondary",children:["(",h," / ",s==null?void 0:s.length," ","permissions)"]})]})}),e.jsxs(ts,{sx:{px:0,py:1,flexWrap:"wrap"},children:[e.jsx(rt,{sx:{mb:1}}),e.jsxs(N,{variant:"text",size:"small",onClick:l,sx:{fontWeight:x=>x.typography.fontWeightRegular},children:[g?"Unselect ":"Select ","all ",i," permissions"]}),r]})]})})},Rh=({type:t,checkedPermissions:s,setCheckedPermissions:n,validatePermissions:o})=>{const{permissions:a}=Hi({revalidateIfStale:!1,revalidateOnReconnect:!1,revalidateOnFocus:!1}),i=ko.includes(t),r=d.useMemo(()=>i?qo(qi(a.project,a.environments)):Vo(a.root),[a,i]),l=m=>{const p=Zi(s,m);o(p),n(p)},c=m=>{const p=Qi(s,m);o(p),n(p)};return d.useMemo(()=>e.jsx(e.Fragment,{children:r.map(({label:m,type:p,permissions:h})=>e.jsx(Ah,{title:m,context:m.toLowerCase(),Icon:p===Vi?e.jsx(Ba,{color:"disabled",sx:{mr:1}}):p===Yi?e.jsx(Ji,{color:"disabled",sx:{mr:1}}):e.jsx(Ki,{color:"disabled",sx:{mr:1}}),permissions:h,checkedPermissions:s,onCheckAll:()=>c(h),children:p==="project"?e.jsx(Th,{permissions:h,checkedPermissions:s,onPermissionChange:l}):e.jsx(Sh,{permissions:h,checkedPermissions:s,onPermissionChange:l})},m))}),[r,s])},Ls=u("p")(({theme:t})=>({display:"flex",color:t.palette.text.primary,marginBottom:t.spacing(1),"&:not(:first-of-type)":{marginTop:t.spacing(4)}})),Dh=u(Ze)(({theme:t})=>({width:"100%",maxWidth:t.spacing(50)})),Ih=u(Ze)({width:"100%"}),Ph=({type:t=$e,name:s,setName:n,description:o,setDescription:a,checkedPermissions:i,setCheckedPermissions:r,errors:l,showErrors:c,validateName:m,validateDescription:p,validatePermissions:h})=>{const g=x=>{setTimeout(()=>x(),300)};return e.jsxs("div",{children:[e.jsx(Ls,{children:"What is your new role name?"}),e.jsx(Dh,{autoFocus:!0,label:"Role name *",error:!!l.name,errorText:l.name,value:s,onChange:x=>{m(x.target.value),n(x.target.value)},onBlur:x=>g(()=>m(x.target.value)),autoComplete:"off"}),e.jsx(Ls,{children:"What is your new role description?"}),e.jsx(Ih,{label:"Role description *",error:!!l.description,errorText:l.description,value:o,onChange:x=>{p(x.target.value),a(x.target.value)},onBlur:x=>g(()=>p(x.target.value)),autoComplete:"off"}),e.jsx(Ls,{children:"What is your role allowed to do?"}),e.jsx(J,{severity:"info",children:"You must select at least one permission."}),e.jsx(Rh,{type:t,checkedPermissions:i,setCheckedPermissions:r,validatePermissions:h}),e.jsx(T,{condition:c,show:()=>e.jsx(J,{severity:"error",icon:!1,children:e.jsx("ul",{children:Object.values(l).filter(Boolean).map(x=>e.jsx("li",{children:x},x))})})})]})},Lh=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Bh=u("div")(({theme:t})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:t.spacing(4)})),Uh=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),$h=({type:t=$e,roleId:s,open:n,setOpen:o})=>{const{role:a,refetch:i}=Yo(s==null?void 0:s.toString()),{name:r,setName:l,validateName:c,description:m,setDescription:p,validateDescription:h,checkedPermissions:g,setCheckedPermissions:x,validatePermissions:j,getRolePayload:y,errors:b,showErrors:C,validate:k,reload:S}=gh(a==null?void 0:a.name,a==null?void 0:a.description,a==null?void 0:a.permissions),{refetch:R}=Pt(),{addRole:v,updateRole:P,loading:B}=La(),{setToastData:w,setToastApiError:H}=K(),{uiConfig:I}=W(),U=a!==void 0,E=y(t),D=()=>`curl --location --request ${U?"PUT":"POST"} '${I.unleashUrl}/api/admin/roles${U?`/${a.id}`:""}' \\
17
+ --header 'Authorization: INSERT_API_KEY' \\
18
+ --header 'Content-Type: application/json' \\
19
+ --data-raw '${JSON.stringify(E,void 0,2)}'`,L=()=>{R(),i()},O=async $=>{if($.preventDefault(),!!k())try{U?await P(a.id,E):await v(E),w({text:`Role ${U?"updated":"added"} successfully`,type:"success"}),L(),o(!1)}catch(G){H(V(G))}};d.useEffect(()=>{S()},[n]);const Y=t[0].toUpperCase()+t.slice(1);return e.jsx(os,{open:n,onClose:()=>{o(!1)},label:U?`Edit ${t} role`:`New ${t} role`,children:e.jsx(Ee,{loading:B,modal:!0,title:U?`Edit ${t} role`:`New ${t} role`,description:`${Y} roles allow you to control access to ${t} resources. Besides the built-in ${t} roles, you can create and manage custom ${t} roles to fit your needs.`,documentationLink:`https://docs.getunleash.io/concepts/rbac${t===$e?"#custom-root-roles":"#custom-project-roles"}`,documentationLinkLabel:"Roles documentation",formatApiCode:D,children:e.jsxs(Lh,{onSubmit:O,children:[e.jsx(Ph,{type:t,name:r,setName:l,validateName:c,description:m,setDescription:p,validateDescription:h,checkedPermissions:g,setCheckedPermissions:x,validatePermissions:j,errors:b,showErrors:C}),e.jsxs(Bh,{children:[e.jsxs(N,{type:"submit",variant:"contained",color:"primary",children:[U?"Save":"Add"," role"]}),e.jsx(Uh,{onClick:()=>{o(!1)},children:"Cancel"})]})]})})})},Oh=({row:t})=>{var o,a;const{original:s}=t,{role:n}=Yo(s.id.toString());return!n||Ge.includes(n.type)?null:e.jsx(ae,{children:e.jsx(ss,{tooltip:e.jsx(To,{roleId:s.id,tooltip:!0}),children:((o=n.permissions)==null?void 0:o.length)===1?"1 permission":`${(a=n.permissions)==null?void 0:a.length} permissions`})})},Zn=({type:t=$e,searchValue:s="",modalOpen:n,setModalOpen:o,selectedRole:a,setSelectedRole:i})=>{const{setToastData:r,setToastApiError:l}=K(),c=Rt(),{roles:m,projectRoles:p,refetch:h,loading:g}=Pt(),{removeRole:x}=La(),[j,y]=d.useState(!1),b=async I=>{try{await x(I.id),r({text:`${I.name} has been deleted`,type:"success"}),h(),y(!1)}catch(U){l(V(U))}},C=xe(c.breakpoints.down("md")),k=d.useMemo(()=>[{id:"Icon",Cell:()=>e.jsx(Jo,{icon:e.jsx(Xi,{color:"disabled"})}),disableGlobalFilter:!0,maxWidth:50},{Header:"Role",accessor:"name",Cell:({row:{original:I}})=>e.jsx(sh,{role:I}),searchable:!0,minWidth:100},{id:"permissions",Header:"Permissions",Cell:Oh,maxWidth:140},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:I}})=>e.jsx(eh,{role:I,onEdit:()=>{i(I),o(!0)},onDelete:()=>{i(I),y(!0)}}),width:150,disableSortBy:!0},{accessor:"description",Header:"Description",searchable:!0}],[]),[S]=d.useState({sortBy:[{id:"name"}],hiddenColumns:["description"]}),{data:R,getSearchText:v}=dt(k,s,t===$e?m:p),{headerGroups:P,rows:B,prepareRow:w,setHiddenColumns:H}=z.useTable({columns:k,data:R,initialState:S,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ae}},z.useSortBy,z.useFlexLayout);return Dt([{condition:C,columns:["Icon"]}],H,k),e.jsxs(se,{isLoading:g,children:[e.jsx(Ne,{value:v(s),children:e.jsx(ye,{rows:B,headerGroups:P,prepareRow:w})}),e.jsx(T,{condition:B.length===0,show:e.jsx(T,{condition:(s==null?void 0:s.length)>0,show:e.jsxs(le,{children:["No ",t," roles found matching “",s,"”"]}),elseShow:e.jsxs(le,{children:["No ",t," roles available. Get started by adding one."]})})}),e.jsx($h,{type:t,roleId:a==null?void 0:a.id,open:n,setOpen:o}),e.jsx(xh,{role:a,open:j,setOpen:y,onConfirm:b})]})},_h=u("div")(()=>({display:"flex",justifyContent:"space-between",alignItems:"center"})),Mh=u("div")({flex:1}),Nh=u("div")({display:"flex",alignItems:"center"}),Fh=()=>{Jt("Roles");const{pathname:t}=Ws(),{roles:s,projectRoles:n,loading:o}=Pt(),[a,i]=d.useState(""),[r,l]=d.useState(!1),[c,m]=d.useState(),p=[{label:"Root roles",path:"/admin/roles",total:s.length},{label:"Project roles",path:"/admin/roles/project-roles",total:n.length}],h=xe(Be.breakpoints.down("md")),g=t.includes("project-roles")?vn:$e;return e.jsx(se,{withTabs:!0,bodyClass:"page-body",isLoading:o,header:e.jsxs(e.Fragment,{children:[e.jsxs(_h,{children:[e.jsx(Mh,{children:e.jsx(Wo,{value:t,indicatorColor:"primary",textColor:"primary",variant:"scrollable",allowScrollButtonsMobile:!0,children:p.map(({label:x,path:j,total:y})=>e.jsx(zo,{value:j,label:e.jsxs(Ia,{to:j,children:[x," (",y,")"]}),sx:{padding:0}},x))})}),e.jsxs(Nh,{children:[e.jsx(T,{condition:!h,show:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:a,onChange:i}),e.jsx(ne.Divider,{})]})}),e.jsxs(Ks,{onClick:()=>{m(void 0),l(!0)},maxWidth:`${Be.breakpoints.values.sm}px`,Icon:as,permission:ee,children:["New ",g," role"]})]})]}),e.jsx(T,{condition:h,show:e.jsx(ue,{initialValue:a,onChange:i})})]}),children:e.jsxs(it,{children:[e.jsx(_,{path:"project-roles",element:e.jsx(Zn,{type:vn,searchValue:a,modalOpen:r,setModalOpen:l,selectedRole:c,setSelectedRole:m})}),e.jsx(_,{path:"*",element:e.jsx(Zn,{type:$e,searchValue:a,modalOpen:r,setModalOpen:l,selectedRole:c,setSelectedRole:m})})]})})},Gh=()=>{const{isEnterprise:t}=W();return t()?e.jsx("div",{children:e.jsx(ve,{permissions:[er,ee],children:e.jsx(Fh,{})})}):e.jsx(at,{feature:"project-roles",page:!0})},$a=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0});return{addServiceAccount:async l=>{const m=n("api/admin/service-account",{method:"POST",body:JSON.stringify(l)},"addServiceAccount");return(await s(m.caller,m.id)).json()},updateServiceAccount:async(l,c)=>{const p=n(`api/admin/service-account/${l}`,{method:"PUT",body:JSON.stringify(c)},"updateServiceAccount");await s(p.caller,p.id)},removeServiceAccount:async l=>{const m=n(`api/admin/service-account/${l}`,{method:"DELETE"},"removeServiceAccount");await s(m.caller,m.id)},errors:o,loading:t}},Oa=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0});return{createServiceAccountToken:async(r,l)=>{const c=s(`api/admin/service-account/${r}/token`,{method:"POST",body:JSON.stringify(l)});return(await t(c.caller,c.id)).json()},deleteServiceAccountToken:async(r,l)=>{const c=s(`api/admin/service-account/${r}/token/${l}`,{method:"DELETE"});await t(c.caller,c.id)},errors:n,loading:o}},Wh=t=>{const{isEnterprise:s}=W(),{data:n,error:o,mutate:a}=Kt(s(),{pats:[]},te(`api/admin/service-account/${t}/token`),zh);return{tokens:n?n.pats:void 0,loading:!o&&!n,refetchTokens:()=>a(),error:o}},zh=t=>fetch(t).then(ce("Service Account Tokens")).then(s=>s.json()),Ot=Ko["30DAYS"],Hh=({open:t,setOpen:s,tokens:n,onCreateClick:o})=>{const[a,i]=d.useState(""),[r,l]=d.useState(Ot),[c,m]=d.useState(qt(Ot)),[p,h]=d.useState({});d.useEffect(()=>{i(""),l(Ot),m(qt(Ot)),h({})},[t]);const g=j=>!(n!=null&&n.some(y=>y.description===j)),x=a.length&&g(a)&&c>new Date;return e.jsx(Q,{open:t,primaryButtonText:"Create token",secondaryButtonText:"Cancel",onClick:()=>o({description:a,expiresAt:c}),disabledPrimaryButton:!x,onClose:()=>{s(!1)},title:"New token",children:e.jsx(Zo,{description:a,setDescription:i,isDescriptionUnique:g,expiration:r,setExpiration:l,expiresAt:c,setExpiresAt:m,errors:p,setErrors:h})})},qh=u(J)(({theme:t})=>({marginBottom:t.spacing(3)})),_a=({open:t,setOpen:s,token:n})=>e.jsxs(Q,{open:t,secondaryButtonText:"Close",onClose:(o,a)=>{a||s(!1)},title:"Service account token created",children:[e.jsx(qh,{severity:"info",children:"Make sure to copy your service account API token now. You won't be able to see it again!"}),e.jsx(A,{variant:"body1",children:"Your token:"}),e.jsx(Eo,{token:(n==null?void 0:n.secret)||""})]}),Vh=u("div")(({theme:t})=>({display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:t.spacing(2),gap:t.spacing(2),"& > div":{[t.breakpoints.down("md")]:{marginTop:0}}})),Yh=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:t.spacing(3)})),Jh=u(A)(({theme:t})=>({fontSize:t.fontSizes.bodySize,marginBottom:t.spacing(.5)})),Kh=u(A)(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary,marginBottom:t.spacing(1.5)})),Zh={id:"createdAt",desc:!0},Ma=({serviceAccount:t,readOnly:s})=>{const n=Rt(),{setToastData:o,setToastApiError:a}=K(),i=xe(n.breakpoints.down("md")),r=xe(n.breakpoints.down("sm")),{tokens:l=[],refetchTokens:c}=Wh(t.id),{refetch:m}=It(),{createServiceAccountToken:p,deleteServiceAccountToken:h}=Oa(),[g]=d.useState(()=>({sortBy:s?[{id:"seenAt"}]:[Zh]})),[x,j]=d.useState(""),[y,b]=d.useState(!1),[C,k]=d.useState(!1),[S,R]=d.useState(!1),[v,P]=d.useState(),[B,w]=d.useState(),H=async F=>{try{const he=await p(t.id,F);m(),c(),b(!1),P(he),k(!0),o({text:"Token created successfully",type:"success"})}catch(he){a(V(he))}},I=async()=>{if(B)try{await h(t.id,B==null?void 0:B.id),m(),c(),R(!1),o({text:"Token deleted successfully",type:"success"})}catch(F){a(V(F))}},U=d.useMemo(()=>[{Header:"Description",accessor:"description",Cell:Se,minWidth:100,searchable:!0},{Header:"Expires",accessor:"expiresAt",Cell:({value:F})=>new Date(F).getFullYear()>new Date().getFullYear()+100?e.jsx(ae,{children:"Never"}):e.jsx(je,{value:F}),maxWidth:150},{Header:"Created",accessor:"createdAt",Cell:je,maxWidth:150},{Header:"Last seen",accessor:"seenAt",Cell:Me,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:F}})=>e.jsx(Yt,{children:e.jsx(Te,{title:"Delete token",arrow:!0,describeChild:!0,children:e.jsx("span",{children:e.jsx(Oe,{onClick:()=>{w(F),R(!0)},children:e.jsx(Le,{})})})})}),maxWidth:100,disableSortBy:!0}],[w,R]),{data:E,getSearchText:D,getSearchContext:L}=dt(U,x,l),{headerGroups:O,rows:Y,prepareRow:$,setHiddenColumns:G}=z.useTable({columns:U,data:E,initialState:g,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},z.useSortBy,z.useFlexLayout);return Dt([{condition:r,columns:["expiresAt"]},{condition:i,columns:["createdAt"]},{condition:!!s,columns:["Actions","expiresAt","createdAt"]}],G,U),e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:!s,show:e.jsxs(Vh,{children:[e.jsx(ue,{initialValue:x,onChange:j,getSearchContext:L}),e.jsx(N,{variant:"contained",color:"primary",disabled:l.length>=tr,onClick:()=>b(!0),children:"New token"})]})}),e.jsx(Ne,{value:D(x),children:e.jsx(ye,{rows:Y,headerGroups:O,prepareRow:$})}),e.jsx(T,{condition:Y.length===0,show:e.jsx(T,{condition:(x==null?void 0:x.length)>0,show:e.jsxs(le,{children:["No tokens found matching “",x,"”"]}),elseShow:e.jsxs(Yh,{children:[e.jsx(Jh,{children:"You have no tokens for this service account yet."}),e.jsx(Kh,{children:"Create a service account token for access to the Unleash API."}),e.jsx(N,{variant:"outlined",onClick:()=>b(!0),children:"Create new service account token"})]})})}),e.jsx(Hh,{open:y,setOpen:b,tokens:l,onCreateClick:H}),e.jsx(_a,{open:C,setOpen:k,token:v}),e.jsx(Q,{open:S,primaryButtonText:"Delete token",secondaryButtonText:"Cancel",onClick:I,onClose:()=>{R(!1)},title:"Delete token?",children:e.jsxs(A,{children:['Any applications or scripts using this token "',e.jsx("strong",{children:B==null?void 0:B.description}),'" will no longer be able to access the Unleash API. You cannot undo this action.']})})]})},Qh=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),jt=u("p")(({theme:t})=>({display:"flex",color:t.palette.text.primary,marginBottom:t.spacing(1),"&:not(:first-of-type)":{marginTop:t.spacing(4)}})),Qn=u("p")(({theme:t})=>({color:t.palette.text.secondary,marginBottom:t.spacing(1)})),Xn=u(Ze)(({theme:t})=>({width:"100%",maxWidth:t.spacing(50)})),Xh=u(us)(({theme:t})=>({width:"100%",maxWidth:t.spacing(50)})),ep=u("div")(({theme:t})=>({padding:t.spacing(3),backgroundColor:t.palette.background.elevation2,borderRadius:t.shape.borderRadiusMedium,marginTop:t.spacing(4),marginBottom:t.spacing(2)})),tp=u("div")(({theme:t})=>({padding:t.spacing(0,4),"& > p:not(:first-of-type)":{marginTop:t.spacing(2)}})),sp=u("div")(({theme:t})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:t.spacing(4)})),np=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),_t=Ko["30DAYS"],op=({serviceAccount:t,open:s,setOpen:n,newToken:o})=>{const{users:a}=be(),{serviceAccounts:i,roles:r,refetch:l}=It(),{addServiceAccount:c,updateServiceAccount:m,loading:p}=$a(),{createServiceAccountToken:h}=Oa(),{setToastData:g,setToastApiError:x}=K(),{uiConfig:j}=W(),[y,b]=d.useState(""),[C,k]=d.useState(""),[S,R]=d.useState(null),[v,P]=d.useState("later"),[B,w]=d.useState({}),H=Z=>{w(pe=>({...pe,[Z]:void 0}))},I=(Z,pe)=>{w(xt=>({...xt,[Z]:pe}))},[U,E]=d.useState(""),[D,L]=d.useState(_t),[O,Y]=d.useState(qt(_t)),[$,G]=d.useState({}),F=t!==void 0;d.useEffect(()=>{b((t==null?void 0:t.name)||""),k((t==null?void 0:t.username)||""),R(r.find(({id:Z})=>Z===(t==null?void 0:t.rootRole))||null),P("later"),w({}),E(""),L(_t),Y(qt(_t)),G({})},[s,t]);const he=()=>({name:y,username:C,rootRole:(S==null?void 0:S.id)||0}),ps=async Z=>{Z.preventDefault();try{if(F)await m(t.id,he());else{const{id:pe}=await c(he());if(v==="now"){const xt=await h(pe,{description:U,expiresAt:O});o(xt)}}g({text:`Service account ${F?"updated":"added"} successfully`,type:"success"}),l(),n(!1)}catch(pe){x(V(pe))}},ms=()=>`curl --location --request ${F?"PUT":"POST"} '${j.unleashUrl}/api/admin/service-account${F?`/${t.id}`:""}' \\
20
+ --header 'Authorization: INSERT_API_KEY' \\
21
+ --header 'Content-Type: application/json' \\
22
+ --data-raw '${JSON.stringify(he(),void 0,2)}'`,Fe=Z=>Z.length,pt=Z=>!(a!=null&&a.some(pe=>pe.username===Z))&&!(i!=null&&i.some(pe=>pe.username===Z)),xs=S!==null,gs=v==="later"||Fe(U)&&O>new Date,js=Fe(y)&&Fe(C)&&(F||pt(C))&&xs&&gs,mt=()=>{if(Fe(y)&&!Fe(C)){const Z=`service-${y.toLowerCase().replace(/ /g,"-").replace(/[^\w_-]/g,"")}`;pt(Z)&&k(Z)}},fs=Z=>{H("username"),pt(Z)||I("username","A service account or user with that username already exists."),k(Z)};return e.jsx(os,{open:s,onClose:()=>{n(!1)},label:F?"Edit service account":"New service account",children:e.jsx(Ee,{loading:p,modal:!0,title:F?"Edit service account":"New service account",description:"A service account is a special type of account that can only be used to authenticate with the Unleash API. Service accounts can be used to automate tasks.",documentationLink:"https://docs.getunleash.io/concepts/service-accounts",documentationLinkLabel:"Service accounts documentation",formatApiCode:ms,children:e.jsxs(Qh,{onSubmit:ps,children:[e.jsxs("div",{children:[e.jsx(jt,{children:"What is your new service account name?"}),e.jsx(Xn,{autoFocus:!0,label:"Service account name",value:y,onChange:Z=>b(Z.target.value),onBlur:mt,autoComplete:"off",required:!0}),e.jsx(jt,{children:"What is your new service account username?"}),e.jsx(Xn,{label:"Service account username",error:!!B.username,errorText:B.username,value:C,onChange:Z=>fs(Z.target.value),autoComplete:"off",required:!0,disabled:F}),e.jsx(jt,{children:"What is your service account allowed to do?"}),e.jsx(Xh,{roles:r,value:S,setValue:R,required:!0}),e.jsx(T,{condition:!F,show:e.jsxs(ep,{children:[e.jsx(jt,{children:"Token"}),e.jsxs(Qn,{children:["In order to connect your newly created service account, you will also need a token."," ",e.jsx(Xs,{href:"https://docs.getunleash.io/concepts/api-tokens-and-client-keys",target:"_blank",rel:"noreferrer",children:"Read more about API tokens"}),"."]}),e.jsx(Zt,{children:e.jsxs(sr,{value:v,onChange:Z=>P(Z.target.value),name:"token-generation",children:[e.jsx(re,{value:"later",control:e.jsx(Cn,{}),label:"I want to generate a token later"}),e.jsx(re,{value:"now",control:e.jsx(Cn,{}),label:"Generate a token now"})]})}),e.jsxs(tp,{children:[e.jsx(Qn,{children:"A new personal access token (PAT) will be generated for the service account, so you can get started right away."}),e.jsx(T,{condition:v==="now",show:e.jsx(Zo,{description:U,setDescription:E,expiration:D,setExpiration:L,expiresAt:O,setExpiresAt:Y,errors:$,setErrors:G})})]})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(jt,{children:"Service account tokens"}),e.jsx(Ma,{serviceAccount:t})]})})]}),e.jsxs(sp,{children:[e.jsxs(N,{type:"submit",variant:"contained",color:"primary",disabled:!js,children:[F?"Save":"Add"," service account"]}),e.jsx(np,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},ap=u("div")(({theme:t})=>({marginTop:t.spacing(1.5)})),eo=u("p")(({theme:t})=>({marginTop:t.spacing(3)})),ip=({serviceAccount:t,open:s,setOpen:n,onConfirm:o})=>{const a=e.jsxs(e.Fragment,{children:["You are about to delete service account:"," ",e.jsx("strong",{children:t==null?void 0:t.name})]});return e.jsx(Q,{title:"Delete service account?",open:s,primaryButtonText:"Delete service account",secondaryButtonText:"Cancel",onClick:()=>o(t),onClose:()=>{n(!1)},children:e.jsx(T,{condition:!!(t!=null&&t.tokens.length),show:e.jsxs(e.Fragment,{children:[e.jsx(J,{severity:"error",children:"Deleting this service account may break any existing implementations currently using it."}),e.jsx(eo,{children:a}),e.jsx(eo,{children:"Service account tokens:"}),e.jsx(ap,{children:e.jsx(Ma,{serviceAccount:t,readOnly:!0})})]}),elseShow:e.jsx("p",{children:a})})})},rp=u(M)(()=>({display:"flex",justifyContent:"center"})),lp=({onEdit:t,onDelete:s})=>e.jsxs(rp,{children:[e.jsx(Ue,{"data-loading":!0,onClick:t,permission:ee,tooltipProps:{title:"Edit service account"},children:e.jsx(At,{})}),e.jsx(Ue,{"data-loading":!0,onClick:s,permission:ee,tooltipProps:{title:"Remove service account"},children:e.jsx(Le,{})})]}),cp=()=>{const{setToastData:t,setToastApiError:s}=K(),{serviceAccounts:n,roles:o,refetch:a,loading:i}=It(),{removeServiceAccount:r}=$a(),[l,c]=d.useState(""),[m,p]=d.useState(!1),[h,g]=d.useState(!1),[x,j]=d.useState(),[y,b]=d.useState(!1),[C,k]=d.useState(),S=async L=>{try{await r(L.id),t({text:`${L.name} has been deleted`,type:"success"}),a(),b(!1)}catch(O){s(V(O))}},R=xe(Be.breakpoints.down("sm")),v=xe(Be.breakpoints.down("md")),P=d.useMemo(()=>[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:L}})=>e.jsx(ae,{children:e.jsx(Ke,{user:L})}),disableSortBy:!0,maxWidth:80},{id:"name",Header:"Name",accessor:L=>L.name||"",minWidth:200,Cell:({row:{original:L}})=>e.jsx(Se,{value:L.name,subtitle:L.username}),searchable:!0},{id:"role",Header:"Role",accessor:L=>{var O;return((O=o.find(Y=>Y.id===L.rootRole))==null?void 0:O.name)||""},Cell:({row:{original:L},value:O})=>e.jsx(en,{value:O,role:L.rootRole}),maxWidth:120},{id:"tokens",Header:"Tokens",accessor:L=>{var O;return((O=L.tokens)==null?void 0:O.map(({description:Y})=>Y).join(`
23
+ `))||""},Cell:({row:{original:L},value:O})=>e.jsx(Pa,{serviceAccount:L,value:O,onCreateToken:()=>{k(L),p(!0)}}),searchable:!0},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"seenAt",Header:"Last seen",accessor:L=>{var O;return(O=L.tokens.sort((Y,$)=>{const G=new Date(Y.seenAt||0),F=new Date($.seenAt||0);return(F==null?void 0:F.getTime())-(G==null?void 0:G.getTime())})[0])==null?void 0:O.seenAt},Cell:Me,maxWidth:150},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:L}})=>e.jsx(lp,{onEdit:()=>{k(L),p(!0)},onDelete:()=>{k(L),b(!0)}}),width:150,disableSortBy:!0},{accessor:"username",Header:"Username",searchable:!0}],[o]),[B]=d.useState({sortBy:[{id:"createdAt",desc:!0}],hiddenColumns:["username"]}),{data:w,getSearchText:H}=dt(P,l,n),{headerGroups:I,rows:U,prepareRow:E,setHiddenColumns:D}=z.useTable({columns:P,data:w,initialState:B,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ae}},z.useSortBy,z.useFlexLayout);return Dt([{condition:R,columns:["role","seenAt"]},{condition:v,columns:["imageUrl","tokens","createdAt"]}],D,P),e.jsxs(se,{isLoading:i,header:e.jsx(ne,{title:`Service Accounts (${U.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:!v,show:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:l,onChange:c}),e.jsx(ne.Divider,{})]})}),e.jsx(N,{variant:"contained",color:"primary",onClick:()=>{k(void 0),p(!0)},children:"New service account"})]}),children:e.jsx(T,{condition:v,show:e.jsx(ue,{initialValue:l,onChange:c})})}),children:[e.jsx(Ne,{value:H(l),children:e.jsx(ye,{rows:U,headerGroups:I,prepareRow:E})}),e.jsx(T,{condition:U.length===0,show:e.jsx(T,{condition:(l==null?void 0:l.length)>0,show:e.jsxs(le,{children:["No service accounts found matching “",l,"”"]}),elseShow:e.jsx(le,{children:"No service accounts available. Get started by adding one."})})}),e.jsx(op,{serviceAccount:C,open:m,setOpen:p,newToken:L=>{j(L),g(!0)}}),e.jsx(_a,{open:h,setOpen:g,token:x}),e.jsx(ip,{serviceAccount:C,open:y,setOpen:b,onConfirm:S})]})},dp=()=>{const{isEnterprise:t}=W();return e.jsx("div",{children:e.jsx(T,{condition:t(),show:e.jsx(ve,{permissions:ee,children:e.jsx(cp,{})}),elseShow:e.jsx(at,{feature:"service-accounts",page:!0})})})},up=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),hp=u("div")(({theme:t})=>({maxWidth:t.spacing(50)})),pp=u("p")(({theme:t})=>({marginBottom:t.spacing(1)})),to=u(Ze)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),so=u(A)(({theme:t})=>({margin:t.spacing(1,0)})),mp=u("div")(()=>({display:"flex",alignItems:"center"})),xp=u("div")(()=>({marginTop:"auto",display:"flex",justifyContent:"flex-end"})),gp=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),Na=({children:t,email:s,name:n,rootRole:o,sendEmail:a,setEmail:i,setName:r,setSendEmail:l,setRootRole:c,handleSubmit:m,handleCancel:p,errors:h,clearErrors:g,mode:x})=>{const{uiConfig:j}=W(),{roles:y}=be();return e.jsxs(up,{onSubmit:m,children:[e.jsxs(hp,{children:[e.jsx(pp,{children:"Who is the new Unleash user?"}),e.jsx(to,{label:"Full name",value:n,onChange:b=>r(b.target.value),error:!!h.name,errorText:h.name,onFocus:()=>g(),autoFocus:!0}),e.jsx(to,{label:"Email",type:"email",value:s,onChange:b=>i(b.target.value),error:!!h.email,errorText:h.email,onFocus:()=>g()}),e.jsx(so,{variant:"subtitle1","data-loading":!0,children:"What is your team member allowed to do?"}),e.jsx(us,{roles:y,value:o,setValue:c,required:!0}),e.jsx(T,{condition:x!==Zs&&!!(j!=null&&j.emailEnabled),show:e.jsxs(Zt,{children:[e.jsx(so,{variant:"subtitle1","data-loading":!0,children:"Should we send an email to your new team member"}),e.jsxs(mp,{children:[e.jsx(me,{name:"sendEmail",onChange:()=>l(!a),checked:a}),e.jsx(A,{children:a?"Yes":"No"})]})]})})]}),e.jsxs(xp,{children:[t,e.jsx(gp,{onClick:p,children:"Cancel"})]})]})},Fa=(t="",s="",n=null)=>{const{uiConfig:o}=W(),{users:a,roles:i}=be(),[r,l]=d.useState(t),[c,m]=d.useState(s),[p,h]=d.useState(!1),[g,x]=d.useState(i.find(({id:R})=>R===n)||null),[j,y]=d.useState({});return d.useEffect(()=>{l(t)},[t]),d.useEffect(()=>{m(s)},[s]),d.useEffect(()=>{h((o==null?void 0:o.emailEnabled)||!1)},[o==null?void 0:o.emailEnabled]),d.useEffect(()=>{x(i.find(({id:R})=>R===n)||null)},[n]),{name:r,setName:l,email:c,setEmail:m,sendEmail:p,setSendEmail:h,rootRole:g,setRootRole:x,getAddUserPayload:()=>({name:r,email:c,sendEmail:p,rootRole:(g==null?void 0:g.id)||0}),validateName:()=>r.length===0?(y(R=>({...R,name:"Name can not be empty."})),!1):c.length===0?(y(R=>({...R,email:"Email can not be empty."})),!1):!0,validateEmail:()=>a.some(R=>R.email===c)?(y(R=>({...R,email:"Email already exists"})),!1):!0,clearErrors:()=>{y({})},errors:j}},jp=t=>d.createElement("svg",{width:197,height:177,viewBox:"0 0 197 177",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},d.createElement("g",{clipPath:"url(#clip0)"},d.createElement("path",{d:"M195.272 67.6884C195.201 67.6884 195.132 67.6668 195.074 67.6264L99.4918 1.00044C99.2009 0.798626 98.8553 0.690774 98.5013 0.691378C98.1474 0.691982 97.8021 0.801012 97.5119 1.00382L2.61779 67.6257C2.54273 67.6784 2.44984 67.6991 2.35954 67.6832C2.26924 67.6674 2.18893 67.6163 2.13629 67.5411C2.08364 67.466 2.06297 67.373 2.07881 67.2826C2.09466 67.1923 2.14573 67.1119 2.22079 67.0592L97.115 0.437299C97.5213 0.153417 98.0047 0.000817369 98.5002 2.3283e-06C98.9957 -0.000812712 99.4796 0.150195 99.8868 0.432738L195.469 67.0585C195.53 67.1006 195.575 67.1609 195.599 67.2306C195.623 67.3004 195.624 67.3758 195.602 67.4461C195.58 67.5164 195.536 67.5778 195.476 67.6214C195.417 67.6649 195.345 67.6884 195.272 67.6884L195.272 67.6884Z",fill:"#3F3D56"}),d.createElement("path",{d:"M8.04028 70.0501L98.5953 2.87773L189.837 74.8297L103.261 126.199L56.2576 115.476L8.04028 70.0501Z",fill:"#E6E6E6"}),d.createElement("path",{d:"M60.2251 157.928H15.4887C15.214 157.928 14.942 157.875 14.6881 157.77C14.4342 157.665 14.2035 157.511 14.0091 157.316C13.8147 157.122 13.6606 156.891 13.5554 156.637C13.4502 156.383 13.396 156.111 13.396 155.836C13.396 155.561 13.4502 155.289 13.5554 155.035C13.6606 154.781 13.8147 154.55 14.0091 154.356C14.2035 154.162 14.4342 154.008 14.6881 153.903C14.942 153.798 15.214 153.744 15.4887 153.744H60.2251C60.4998 153.744 60.7719 153.798 61.0258 153.903C61.2797 154.008 61.5104 154.162 61.7048 154.356C61.8991 154.55 62.0533 154.781 62.1585 155.035C62.2637 155.289 62.3179 155.561 62.3179 155.836C62.3179 156.111 62.2637 156.383 62.1585 156.637C62.0533 156.891 61.8991 157.122 61.7048 157.316C61.5104 157.511 61.2797 157.665 61.0258 157.77C60.7719 157.875 60.4998 157.928 60.2251 157.928Z",fill:"#607D8B"}),d.createElement("path",{d:"M31.5392 148.934H15.4887C15.214 148.934 14.942 148.88 14.6881 148.776C14.4342 148.671 14.2035 148.516 14.0091 148.322C13.8147 148.128 13.6606 147.897 13.5554 147.643C13.4502 147.389 13.396 147.117 13.396 146.842C13.396 146.567 13.4502 146.295 13.5554 146.041C13.6606 145.787 13.8147 145.556 14.0091 145.362C14.2035 145.168 14.4342 145.014 14.6881 144.909C14.942 144.804 15.214 144.75 15.4887 144.75H31.5392C31.8139 144.75 32.0859 144.804 32.3398 144.909C32.5937 145.014 32.8244 145.168 33.0188 145.362C33.2132 145.556 33.3674 145.787 33.4726 146.041C33.5778 146.295 33.6319 146.567 33.6319 146.842C33.6319 147.117 33.5778 147.389 33.4726 147.643C33.3674 147.897 33.2132 148.128 33.0188 148.322C32.8244 148.516 32.5937 148.671 32.3398 148.776C32.0859 148.88 31.8139 148.934 31.5392 148.934Z",fill:"#607D8B"}),d.createElement("path",{d:"M99.8687 107.464C99.5287 107.465 99.1918 107.399 98.8771 107.27L43.0291 84.0761V11.4759C43.0298 10.8339 43.2849 10.2184 43.7385 9.76446C44.192 9.31051 44.8069 9.05515 45.4484 9.0544H152.589C153.23 9.05515 153.845 9.31051 154.299 9.76446C154.752 10.2184 155.007 10.8339 155.008 11.4759V84.1267L154.903 84.1717L100.89 107.258C100.567 107.394 100.22 107.464 99.8687 107.464Z",fill:"white"}),d.createElement("path",{d:"M99.8687 107.637C99.5061 107.637 99.1469 107.567 98.8112 107.43L42.8562 84.1916V11.4759C42.857 10.788 43.1303 10.1286 43.6163 9.64218C44.1022 9.1558 44.7611 8.88221 45.4483 8.88143H152.589C153.276 8.88221 153.935 9.1558 154.421 9.64218C154.907 10.1286 155.18 10.788 155.181 11.4759V84.2409L100.958 107.417C100.613 107.563 100.243 107.637 99.8687 107.637ZM43.5474 83.7295L99.0748 106.79C99.5928 107.001 100.173 106.997 100.688 106.781L154.49 83.7842V11.4759C154.489 10.9714 154.288 10.4879 153.932 10.1312C153.576 9.77452 153.093 9.57387 152.589 9.57328H45.4483C44.9444 9.57387 44.4612 9.77452 44.1049 10.1312C43.7485 10.4879 43.548 10.9714 43.5474 11.4759L43.5474 83.7295Z",fill:"#3F3D56"}),d.createElement("path",{d:"M194.581 66.9965H194.512L154.835 83.9537L100.55 107.155C100.337 107.244 100.11 107.291 99.8797 107.292C99.6496 107.293 99.4215 107.249 99.2084 107.162L43.2018 83.9052L2.55059 67.0242L2.48849 66.9965H2.4193C1.77788 66.9972 1.16293 67.2526 0.70938 67.7066C0.255828 68.1605 0.000711706 68.776 0 69.418V174.579C0.000712619 175.221 0.255828 175.836 0.70938 176.29C1.16293 176.744 1.77788 176.999 2.4193 177H194.581C195.222 176.999 195.837 176.744 196.291 176.29C196.744 175.836 196.999 175.221 197 174.579V69.418C196.999 68.776 196.744 68.1605 196.291 67.7066C195.837 67.2526 195.222 66.9972 194.581 66.9965ZM196.309 174.579C196.309 175.037 196.126 175.477 195.802 175.801C195.478 176.126 195.039 176.308 194.581 176.308H2.4193C1.96104 176.308 1.52161 176.126 1.19757 175.801C0.873536 175.477 0.691411 175.037 0.691228 174.579V69.418C0.691855 68.9707 0.865197 68.541 1.17501 68.2187C1.48483 67.8963 1.90713 67.7063 2.35365 67.6884L43.2018 84.6524L98.9425 107.802C99.5459 108.047 100.222 108.044 100.823 107.791L154.835 84.7043L194.65 67.6884C195.096 67.7076 195.517 67.8982 195.826 68.2203C196.135 68.5425 196.308 68.9714 196.309 69.418V174.579Z",fill:"#3F3D56"}),d.createElement("path",{d:"M99.3104 86.8775C97.2487 86.8813 95.2416 86.214 93.5919 84.9762L93.4896 84.8994L71.9541 68.3963C70.9567 67.6314 70.1197 66.6774 69.4907 65.5888C68.8617 64.5001 68.4531 63.2981 68.2882 62.0514C68.1233 60.8047 68.2054 59.5377 68.5297 58.3228C68.8541 57.1078 69.4143 55.9687 70.1785 54.9704C70.9426 53.9722 71.8958 53.1344 72.9835 52.5048C74.0711 51.8753 75.2721 51.4663 76.5177 51.3013C77.7632 51.1362 79.0291 51.2184 80.243 51.543C81.4569 51.8676 82.595 52.4284 83.5923 53.1932L97.5414 63.8988L130.505 20.8706C131.27 19.8726 132.223 19.0351 133.311 18.4059C134.399 17.7767 135.6 17.3682 136.846 17.2036C138.091 17.039 139.357 17.1216 140.571 17.4467C141.785 17.7718 142.923 18.333 143.92 19.0982L143.715 19.3767L143.925 19.1023C145.936 20.6494 147.252 22.9319 147.584 25.449C147.916 27.9661 147.237 30.5122 145.696 32.5287L106.922 83.1402C106.026 84.3065 104.872 85.2503 103.552 85.8984C102.232 86.5466 100.781 86.8816 99.3104 86.8775Z",fill:"#607D8B"})),d.createElement("defs",null,d.createElement("clipPath",{id:"clip0"},d.createElement("rect",{width:197,height:177,fill:"white"})))),fp=({open:t,closeConfirm:s,inviteLink:n})=>e.jsxs(Q,{open:t,title:"Team member added",primaryButtonText:"Close",onClick:s,children:[e.jsx(A,{children:"A new team member has been added. We’ve sent an email on your behalf to inform them of their new account and role. No further steps are required."}),e.jsx(M,{sx:{width:"100%",textAlign:"center",px:"auto",py:4},children:e.jsx(jp,{})}),e.jsx(A,{style:{fontWeight:"bold"},variant:"subtitle1",children:"In a rush?"}),e.jsx(A,{children:"You may also copy the invite link and send it to the user."}),e.jsx(rs,{inviteLink:n})]}),yp=({open:t,closeConfirm:s,inviteLink:n})=>e.jsxs(Q,{open:t,onClick:s,primaryButtonText:"Close",title:"Team member added",children:[e.jsx(A,{variant:"body1",sx:{mb:2},children:"A new team member has been added."}),e.jsx(A,{variant:"body1",children:"Please provide them with the following link. This will allow them to set up their password and get started with their Unleash account."}),e.jsx(rs,{inviteLink:n}),e.jsx(J,{severity:"info",sx:{mt:2},children:e.jsxs(A,{variant:"body2",children:["Want to avoid this step in the future?"," ",e.jsx("a",{href:"https://docs.getunleash.io/docs/deploy/email",target:"_blank",rel:"noopener noreferrer",children:"If you configure an email server for Unleash"})," ","we'll automatically send informational getting started emails to new users once you add them."]})})]}),Ga=({open:t,closeConfirm:s,emailSent:n,inviteLink:o})=>n?e.jsx(fp,{open:t,closeConfirm:s,inviteLink:o}):e.jsx(yp,{open:t,closeConfirm:s,inviteLink:o}),hn=t=>{const{instanceStatus:s}=Je(),n=(s==null?void 0:s.plan)===Vs.PRO,o=xa,a=d.useMemo(()=>bp(t,n,o),[t,n,o]),i=a.filter(r=>r.paid).length;return{seats:o,extraSeats:i,planUsers:a,isBillingUsers:n}},bp=(t,s,n=0)=>(!s||!n||t.sort((o,a)=>o.createdAt.localeCompare(a.createdAt)).forEach((o,a)=>{o.paid=!1,a>=n&&(o.paid=!0)}),t),Sp=()=>{var r,l;const{users:t}=be(),{isBillingUsers:s,seats:n,planUsers:o}=hn(t),{instanceStatus:a}=Je(),i=((l=(r=a==null?void 0:a.prices)==null?void 0:r.pro)==null?void 0:l.seat)??ma;return!s||o.length<n?null:e.jsx(J,{severity:"info",sx:{marginBottom:c=>c.spacing(3)},children:e.jsxs("p",{children:[e.jsx("strong",{children:"Heads up!"})," You are exceeding your allocated free members included in your plan (",o.length," of ",n,"). Creating this user will add ",e.jsxs("strong",{children:["$",i,"/month"]})," ","to your invoice, starting with your next payment."]})})},vp=()=>{const{setToastApiError:t}=K(),{uiConfig:s}=W(),n=Ce(),o=Mo(),a=o.get("name")||"",i=o.get("email")||"",{name:r,setName:l,email:c,setEmail:m,sendEmail:p,setSendEmail:h,rootRole:g,setRootRole:x,getAddUserPayload:j,validateName:y,validateEmail:b,errors:C,clearErrors:k}=Fa(a,i),[S,R]=d.useState(!1),[v,P]=d.useState(""),{addUser:B,userLoading:w}=Qe(),H=async D=>{D.preventDefault(),k();const L=y(),O=b();if(L&&O){const Y=j();try{await B(Y).then($=>$.json()).then($=>{Fs(),P($.inviteLink),R(!0)})}catch($){t(V($))}}},I=()=>{R(!1),n("/admin/users")},U=()=>`curl --location --request POST '${s.unleashUrl}/api/admin/user-admin' \\
24
+ --header 'Authorization: INSERT_API_KEY' \\
25
+ --header 'Content-Type: application/json' \\
26
+ --data-raw '${JSON.stringify(j(),void 0,2)}'`,E=()=>{n(Pe)};return e.jsxs(Ee,{loading:w,title:"Create Unleash user",description:"In order for a user to get access to Unleash, they need to be assigned a root role, such as Viewer, Editor, or Admin.",documentationLink:"https://docs.getunleash.io/concepts/rbac#predefined-roles",documentationLinkLabel:"User management documentation",formatApiCode:U,children:[e.jsx(Sp,{}),e.jsx(Na,{errors:C,handleSubmit:H,handleCancel:E,name:r,setName:l,email:c,setEmail:m,sendEmail:p,setSendEmail:h,rootRole:g,setRootRole:x,clearErrors:k,children:e.jsx(Co,{name:"user",permission:ee})}),e.jsx(Ga,{open:S,closeConfirm:I,emailSent:p,inviteLink:v})]})},no=[{key:vs(new Date,{hours:48}).toISOString(),label:"48 hours"},{key:vs(new Date,{weeks:1}).toISOString(),label:"1 week"},{key:vs(new Date,{months:1}).toISOString(),label:"1 month"}],Cp=(t,s)=>{const{uiConfig:n}=W();return t?()=>`curl --location --request PUT '${n.unleashUrl}/api/admin/invite-link/tokens/default' \\
27
+ --header 'Authorization: INSERT_API_KEY' \\
28
+ --header 'Content-Type: application/json' \\
29
+ --data-raw '${JSON.stringify({expiresAt:s},void 0,2)}'`:()=>`curl --location --request POST '${n.unleashUrl}/api/admin/invite-link/tokens' \\
30
+ --header 'Authorization: INSERT_API_KEY' \\
31
+ --header 'Content-Type: application/json' \\
32
+ --data-raw '${JSON.stringify({name:"default",expiresAt:s},void 0,2)}'`},wp=()=>{var B;const t=Ce(),{data:s,loading:n}=nr(),[o,a]=d.useState(""),{mutate:i}=or(),{trackEvent:r}=Qs(),[l,c]=d.useState(no[0].key),[m,p]=d.useState(!1),h=(B=s==null?void 0:s.tokens)==null?void 0:B.find(w=>w.name==="default"),g=!!h,x=Cp(g,l),[j,y]=d.useState(!1),{setToastApiError:b}=K(),{createToken:C,updateToken:k}=ar(),S=async w=>{w.preventDefault(),y(!0),r("invite",{props:{eventType:g?"link update submitted":"link created"}});try{if(g)await k(h.secret,{expiresAt:l}),a(h.url);else{const I=await(await C({name:"default",expiresAt:l})).json();a(I.url)}}catch(H){b(V(H))}finally{y(!1),i(rr)}},R=async()=>{y(!0);try{await k(h.secret,{enabled:!1}),t(Pe)}catch(w){b(V(w))}finally{y(!1)}},v=async()=>{p(!0)},P=()=>{a(""),t("/admin/users")};return e.jsxs(Ee,{loading:n||j,title:g?"Update invite link":"Create invite link",description:"When you send an invite link to someone, they will be able to create an account and get access to Unleash. This new user will only have read access, until you change their assigned role.",documentationLink:"https://docs.getunleash.io/concepts/public-signup",documentationLinkLabel:"Invite link documentation",formatApiCode:x,children:[e.jsxs(M,{component:"form",onSubmit:S,sx:{display:"flex",flexDirection:"column",flexGrow:1},"data-testid":"create-invite-link-form",children:[e.jsxs(M,{sx:{maxWidth:"400px"},children:[e.jsxs(M,{sx:{mb:2},children:[e.jsx(A,{sx:{mb:1},children:"Expiration period for the invite link"}),e.jsx(Qo,{label:"Link will expire in",name:"type",options:no,value:l,onChange:c,fullWidth:!0})]}),e.jsx(A,{sx:{mb:1},children:"People using this link will be invited as:"}),e.jsxs(M,{sx:{p:2,borderRadius:w=>`${w.shape.borderRadiusMedium}px`,backgroundColor:w=>w.palette.background.elevation2},children:[e.jsx(A,{variant:"body2",fontWeight:"bold",children:"Viewer"}),e.jsx(A,{variant:"body2",color:"text.secondary",children:"Users with this role can only read root resources in Unleash. The viewer can be added to specific projects as project member. Viewers may not view API tokens."})]})]}),e.jsxs(M,{sx:{display:"flex",justifyContent:"flex-end",mt:"auto"},children:[e.jsx(ir,{type:"submit",permission:ee,disabled:j,children:g?"Update invite link":"Create invite link"}),e.jsx(T,{condition:g,show:e.jsx(N,{sx:{ml:2},onClick:v,color:"error",children:"Delete link"})}),e.jsx(N,{sx:{ml:2},onClick:()=>{t(Pe)},children:"Cancel"})]})]}),e.jsx(Q,{open:!!o,onClick:P,primaryButtonText:"Close",title:"Invite link created",children:e.jsxs(M,{children:[e.jsx(A,{variant:"body1",sx:{mb:2},children:"Using this link, new team members can now sign-up to Unleash."}),e.jsx(A,{variant:"body1",children:"Please provide them with the following link to get started. This will allow them to set up their password and get started with their Unleash account."}),e.jsx(rs,{inviteLink:o})]})}),e.jsx(Q,{open:m,onClose:()=>p(!1),onClick:R,title:"Are you sure you want to delete your invite link?"})]})},Wa={overlay:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.25)",zIndex:5},content:{width:"500px",maxWidth:"90%",margin:"0",top:"50%",left:"50%",right:"auto",bottom:"auto",transform:"translate(-50%, -50%)"}},Tp=u(Ke)(({theme:t})=>({width:t.spacing(5),height:t.spacing(5),margin:0})),kp=({showDialog:t,closeDialog:s,user:n})=>{const[o,a]=d.useState({}),[i,r]=d.useState(),[l,c]=d.useState(!1),{classes:m}=ls(),{changePassword:p}=Qe(),{setToastData:h,setToastApiError:g}=K(),x=b=>{r(void 0),a({...o,[b.target.name]:dr(b.target.value)})},j=async b=>{if(b.preventDefault(),o.password===o.confirm){if(!l){r(ur);return}try{await p(n.id,o.password),a({}),s(),h({text:"Password changed successfully",type:"success"})}catch(C){const k=V(C);r(k),g(k)}}},y=b=>{b.preventDefault(),a({}),r(void 0),s()};return e.jsx(Q,{open:t,onClick:j,style:Wa,onClose:y,primaryButtonText:"Save",title:"Update password",secondaryButtonText:"Cancel",maxWidth:"xs",children:e.jsxs("form",{onSubmit:j,className:Xo(m.contentSpacingY,m.flexColumn),children:[e.jsx(A,{variant:"subtitle1",children:"Changing password for user"}),e.jsxs("div",{className:m.flexRow,children:[e.jsx(Tp,{user:n,variant:"rounded"}),e.jsx(A,{variant:"subtitle1",style:{marginLeft:"1rem"},children:n.username||n.email})]}),e.jsx(lr,{password:o.password,callback:c}),e.jsx(X,{label:"New password",name:"password",type:"password",value:o.password,error:!!i,helperText:i,onChange:x,variant:"outlined",size:"small"}),e.jsx(X,{label:"Confirm password",name:"confirm",type:"password",value:o.confirm,onChange:x,variant:"outlined",size:"small"}),e.jsx(cr,{started:!!(o.password&&o.confirm),passwordsDoNotMatch:o.password!==o.confirm})]})})},Ep=u(Ke)(({theme:t})=>({width:t.spacing(5),height:t.spacing(5),margin:0})),Ap=({showDialog:t,closeDialog:s,user:n})=>{const{classes:o}=ls(),{resetPassword:a}=Qe(),{setToastApiError:i}=K(),[r,l]=d.useState(""),c=async h=>{if(h.preventDefault(),!n.email){i("You can't reset the password of a user who doesn't have an email address.");return}try{const g=await a(n.email).then(x=>x.ok?x.json():void 0);g?l(g.resetPasswordUrl):i("Could not reset password. This may be to prevent too many resets. Try again in a minute.")}catch(g){i(V(g))}},m=h=>{h.preventDefault(),s()},p=()=>{l(""),s()};return e.jsxs(Q,{open:t,onClick:c,style:Wa,onClose:m,primaryButtonText:"Generate Link",title:"Reset password",secondaryButtonText:"Cancel",maxWidth:"xs",children:[e.jsxs("form",{onSubmit:c,className:Xo(o.contentSpacingY,o.flexColumn),children:[e.jsx(A,{variant:"subtitle1",children:"Resetting password for user"}),e.jsxs("div",{className:o.flexRow,children:[e.jsx(Ep,{user:n,variant:"rounded"}),e.jsx(A,{variant:"subtitle1",style:{marginLeft:"1rem"},children:n.username||n.email})]})]}),e.jsx(Q,{open:!!r,onClick:p,primaryButtonText:"Close",title:"Reset password link created",children:e.jsxs(M,{children:[e.jsx(A,{variant:"body1",children:"The user can use this link to reset their password. You should not share this link with anyone but the user in question."}),e.jsx(rs,{inviteLink:r})]})})]})},Rp=u(Ke)(({theme:t})=>({width:t.spacing(5),height:t.spacing(5),margin:0})),Dp=({showDialog:t,closeDialog:s,user:n,userLoading:o,removeUser:a,userApiErrors:i})=>{const r=Et(o),{classes:l}=ls();return e.jsx(Q,{open:t,title:"Really delete user?",onClose:s,onClick:a,primaryButtonText:"Delete user",secondaryButtonText:"Cancel",children:e.jsxs("div",{ref:r,children:[e.jsx(T,{condition:!!i[Vt],show:e.jsx(J,{"data-loading":!0,severity:"error",style:{margin:"1rem 0"},children:i[Vt]})}),e.jsxs("div",{"data-loading":!0,className:l.flexRow,children:[e.jsx(Rp,{user:n,variant:"rounded"}),e.jsx(A,{variant:"subtitle1",style:{marginLeft:"1rem"},children:n.username||n.email})]}),e.jsxs(A,{"data-loading":!0,variant:"body1",style:{marginTop:"1rem"},children:["Are you sure you want to delete"," ",n?`${n.name||"user"} (${n.email||n.username})`:"","?",n.scimId?" This user is currently managed by SCIM and may be re-added by your SCIM provider.":""]})]})})},Ip=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0});return{downloadCSV:async()=>{const r=n("api/admin/access/overview",{method:"GET",responseType:"blob",headers:{Accept:"text/csv"}},"downloadCSV"),l=await(await s(r.caller,r.id)).blob(),c=window.URL.createObjectURL(l);window.location.assign(c)},errors:o,loading:t}};var pn={},Pp=ct;Object.defineProperty(pn,"__esModule",{value:!0});var za=pn.default=void 0,Lp=Pp(lt()),Bp=e,Up=(0,Lp.default)((0,Bp.jsx)("path",{d:"M11.8 10.9c-2.27-.59-3-1.2-3-2.15 0-1.09 1.01-1.85 2.7-1.85 1.42 0 2.13.54 2.39 1.4.12.4.45.7.87.7h.3c.66 0 1.13-.65.9-1.27-.42-1.18-1.4-2.16-2.96-2.54V4.5c0-.83-.67-1.5-1.5-1.5S10 3.67 10 4.5v.66c-1.94.42-3.5 1.68-3.5 3.61 0 2.31 1.91 3.46 4.7 4.13 2.5.6 3 1.48 3 2.41 0 .69-.49 1.79-2.7 1.79-1.65 0-2.5-.59-2.83-1.43-.15-.39-.49-.67-.9-.67h-.28c-.67 0-1.14.68-.89 1.3.57 1.39 1.9 2.21 3.4 2.53v.67c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-.65c1.95-.37 3.5-1.5 3.5-3.55 0-2.84-2.43-3.81-4.7-4.4z"}),"AttachMoneyRounded");za=pn.default=Up;const $p=u(za)(({theme:t})=>({color:t.palette.primary.light,fontSize:"1.5rem",backgroundColor:"#F1F0FC",borderRadius:t.shape.borderRadiusLarge})),Op=({value:t})=>e.jsx(ae,{children:e.jsx(T,{condition:t,show:e.jsx(Te,{title:"Paid user",arrow:!0,children:e.jsx($p,{})}),elseShow:"Included"})}),_p=u("div")(({theme:t})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:t.spacing(-1),marginLeft:t.spacing(-.5)})),Mp=u($o)(({theme:t})=>({borderRadius:t.shape.borderRadiusLarge,padding:t.spacing(1,1.5)})),Np=({onEdit:t,onViewAccess:s,onChangePassword:n,onResetPassword:o,onDelete:a,isScimUser:i,userId:r})=>{const[l,c]=d.useState(null),m=!!l,p=j=>{c(j.currentTarget)},h=()=>{c(null)},g=`user-${r}-actions`,x=`${g}-menu`;return e.jsxs(_p,{children:[e.jsx(Te,{title:"User actions",arrow:!0,describeChild:!0,children:e.jsx(Oe,{id:g,"aria-controls":m?"actions-menu":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:p,type:"button",size:"small",children:e.jsx(Oo,{})})}),e.jsx(Mp,{id:x,anchorEl:l,open:m,onClose:h,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:"right",vertical:"bottom"},disableScrollLock:!0,children:e.jsxs(_o,{"aria-labelledby":g,children:[e.jsx(ft,{onClick:t,isScimUser:i,children:"Edit user"}),s&&e.jsx(ft,{onClick:s,children:"Access overview"}),e.jsx(ft,{onClick:()=>{n(),h()},isScimUser:i,children:"Change password"}),e.jsx(ft,{onClick:()=>{o(),h()},isScimUser:i,children:"Reset password"}),e.jsx(ft,{onClick:()=>{a(),h()},children:"Remove user"})]})})]})},ft=({onClick:t,isScimUser:s,children:n})=>e.jsx(Te,{title:s?"This user is managed by your SCIM provider and cannot be changed manually":"",arrow:!0,placement:"left",children:e.jsx("div",{children:e.jsx(ze,{onClick:t,disabled:s,children:e.jsx(Wt,{children:e.jsx(A,{variant:"body2",children:n})})})})}),oo=20,Fp=()=>{const{users:t}=be(),{isBillingUsers:s,planUsers:n}=hn(t);return!s||(n==null?void 0:n.length)<oo?null:e.jsx(J,{severity:"info",sx:{marginBottom:o=>o.spacing(3)},children:e.jsxs("p",{children:[e.jsx("strong",{children:"Heads up!"})," You have reached your maximum number of registered users for you PRO account (up to max ",oo," ","users). If you need more users please"," ",e.jsx(Xs,{component:oe,to:"https://www.getunleash.io/signup-enterprise",children:"get in touch with us"}),"."]})})},Ha=u("div")(({theme:t})=>({marginTop:t.spacing(-2),paddingBottom:t.spacing(2)})),Gp=({count:t})=>!t||t<4?null:e.jsx(Jo,{icon:e.jsx(e.Fragment,{children:e.jsx(Te,{title:`Multiple parallel browser sessions (${t})`,children:e.jsx(hr,{"aria-label":"Multiple parallel browser sessions",color:"warning"})})})}),Wp=u("article")(({theme:t})=>({display:"flex",flexFlow:"row wrap",gap:t.spacing(2),justifyContent:"space-between",alignItems:"center"})),zp=()=>{const{trackEvent:t}=Qs(),s=n=>{t("invite",{props:{eventType:n?"link bar action: edit":"link bar action: create"}})};return e.jsx(Wp,{children:e.jsx(pr,{onActionClick:s})})},Hp=({licensedUsers:t})=>{const s=Rt(),n={datasets:[{label:"Seats used",data:t,borderColor:s.palette.primary.main,backgroundColor:s.palette.primary.main,fill:!1}]};return e.jsx(mr,{data:n,overrideOptions:{parsing:{yAxisKey:"count",xAxisKey:"date"},plugins:{legend:{display:!1}},scales:{x:{time:{unit:"month",tooltipFormat:"MMM yyyy",displayFormats:{month:"MMM"}}}}}})},ao="api/admin/licensed-users",qp={seatCount:0,licensedUsers:{current:0,history:[]}},qa=()=>{const{data:t,refetch:s,loading:n,error:o}=xr(te(ao),()=>gr(te(ao),"Seats used"));return{data:t||qp,refetch:s,loading:n,error:o}},Vp=u("section")(({theme:t})=>({minHeight:"100vh",maxWidth:700,width:"95vw",backgroundColor:t.palette.background.default,display:"flex",flexFlow:"column",gap:t.spacing(4),paddingInline:t.spacing(4),paddingBlock:t.spacing(3.75)})),Yp=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(9)})),Jp=u("div")(({theme:t})=>({display:"flex",alignItems:"center",gap:t.spacing(1.5)})),Kp=u("h3")(({theme:t})=>({fontSize:t.typography.h2.fontSize,margin:0,fontWeight:t.typography.h4.fontWeight})),io=u("h4")(({theme:t})=>({margin:0,fontWeight:t.typography.h4.fontWeight,fontSize:t.spacing(1.75)})),ro=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2)})),Zp=u("div")(({theme:t})=>({display:"flex",justifyContent:"flex-end",marginBlockStart:"auto",gap:t.spacing(4)})),Qp=u("div")(({theme:t})=>({display:"flex",gap:t.spacing(2),width:"100%"})),Xp=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",width:"100%",background:t.palette.background.elevation1,padding:t.spacing(3,2,3,2),borderRadius:t.shape.borderRadiusLarge})),em=({open:t,close:s})=>{const{data:n}=qa();return e.jsx(jr,{open:t,onClose:s,label:"Project status",onClick:o=>{o.target instanceof HTMLAnchorElement&&s()},children:e.jsxs(Vp,{children:[e.jsx(Jp,{children:e.jsx(Kp,{children:"Seats used"})}),e.jsxs(Yp,{children:[e.jsxs(ro,{children:[e.jsx(io,{children:"Last 30 days"}),e.jsxs(Qp,{children:[e.jsxs(Xp,{children:[e.jsxs(A,{fontWeight:"bold",children:[n.licensedUsers.current,"/",n.seatCount]}),e.jsx(A,{variant:"body2",children:"Seats used over the last 30 days"})]}),e.jsx(J,{severity:"info",children:"A licensed seat is a unique user that had access to your Unleash instance within the last 30 days, and thereby occupied a seat."})]})]}),e.jsxs(ro,{children:[e.jsx(io,{children:"Last year"}),e.jsx(Hp,{licensedUsers:n.licensedUsers.history})]})]}),e.jsx(Zp,{children:e.jsx(N,{variant:"outlined",onClick:s,children:"Close"})})]})})},tm=u("button")(({theme:t})=>({background:"none",border:"none",fontSize:"inherit",textDecoration:"underline",color:t.palette.primary.main,cursor:"pointer",padding:0,textAlign:"left"})),sm=u("div")(({theme:t})=>({display:"flex",justifyContent:"space-between",gap:t.spacing(2)})),nm=u("figcaption")(({theme:t})=>({fontSize:t.typography.body2.fontSize,display:"flex",flexFlow:"row wrap",gap:t.spacing(1),justifyContent:"space-between"})),om=u("figure")(({theme:t})=>({margin:0,display:"flex",flexFlow:"column",justifyContent:"center"})),am=u("span")(({theme:t})=>({fontSize:t.typography.body1.fontSize,fontWeight:"bold"})),im=()=>{const[t,s]=d.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(tm,{onClick:()=>{s(!0)},children:"View graph over time"}),e.jsx(em,{open:t,close:()=>s(!1)})]})},rm=()=>{const{data:t,loading:s}=qa(),n=Et(s,"[data-loading-licensed-users=true]");return e.jsxs(om,{ref:n,children:[e.jsxs(sm,{children:[e.jsxs(am,{"data-loading-licensed-users":!0,children:[t.licensedUsers.current,"/",t.seatCount]}),e.jsx(st,{htmlTooltip:!0,tooltip:e.jsx(M,{children:"A licensed seat is a unique user that had access to your instance within the last 30 days, and thereby occupied a seat."})})]}),e.jsxs(nm,{children:[e.jsx("span",{children:"Seats used over the last 30 days"}),e.jsx(im,{})]})]})},lm=u(M)(({theme:t})=>({display:"flex",flexFlow:"row",gap:t.spacing(2),paddingBottom:t.spacing(3)})),lo=u(M)(({theme:t})=>({backgroundColor:t.palette.background.paper,padding:t.spacing(2,3,2,2),borderRadius:`${t.shape.borderRadiusLarge}px`,border:"2px solid",borderColor:t.palette.divider,flex:"auto",display:"flex",flexFlow:"column",justifyContent:"center"})),cm=()=>{const{isEnterprise:t,uiConfig:{billing:s}}=W(),n=t()&&s!=="pay-as-you-go";return e.jsxs(lm,{children:[e.jsx(lo,{children:e.jsx(zp,{})}),n&&e.jsx(lo,{children:e.jsx(rm,{})})]})},dm="/static/upgradeSso-DCY0_83O.png",um=u(M)(({theme:t})=>({marginTop:t.spacing(10),width:"100%",backgroundColor:t.palette.background.elevation1,borderRadius:t.shape.borderRadiusMedium,padding:t.spacing(2),display:"flex",justifyContent:"center",position:"relative"})),hm=u(Xs)(({theme:t})=>({textDecoration:"none",fontWeight:t.typography.fontWeightBold})),pm=u("img")(({theme:t})=>({width:t.spacing(14)})),mm=u(Oe)(({theme:t})=>({position:"absolute",top:t.spacing(1.25),right:t.spacing(1.5)})),xm=u(M)(({theme:t})=>({display:"flex",gap:t.spacing(3),marginTop:t.spacing(1),marginBottom:t.spacing(1)})),gm=u(M)(({theme:t})=>({display:"flex",flexDirection:"column",justifyContent:"center",gap:t.spacing(1),maxWidth:t.spacing(60)})),jm=()=>{const[t,s]=ea("upgrade-sso:v1","open");return t==="closed"?null:e.jsxs(um,{children:[e.jsxs(xm,{children:[e.jsx(pm,{src:ta(dm),alt:"Single sign-on"}),e.jsxs(gm,{children:[e.jsxs("p",{children:["Streamline access and account management, reduce setup time and enhance security with ",e.jsx("b",{children:"Single Sign-On"})," and"," ",e.jsx("b",{children:"Automatic User Provisioning via SCIM"}),"."]}),e.jsx(hm,{href:"https://www.getunleash.io/upgrade-unleash?utm_source=oss&utm_medium=feature&utm_content=sso",target:"_blank",children:"View our Enterprise offering"})]})]}),e.jsx(Te,{title:"Dismiss",arrow:!0,children:e.jsx(mm,{"aria-label":"dismiss",onClick:()=>{s("closed")},size:"small",children:e.jsx(sa,{fontSize:"inherit"})})})]})},fm=()=>{const t=Ce(),{isEnterprise:s,isOss:n}=W(),{users:o,roles:a,refetch:i,loading:r}=be(),{setToastData:l,setToastApiError:c}=K(),{removeUser:m,userLoading:p,userApiErrors:h}=Qe(),{downloadCSV:g}=Ip(),[x,j]=d.useState({open:!1}),[y,b]=d.useState({open:!1}),C=Gs("showUserDeviceCount"),k=n()&&o.length>3,{settings:{enabled:S}}=Lt(),[R,v]=d.useState(!1),[P,B]=d.useState(!1),[w,H]=d.useState(!1),[I,U]=d.useState(""),[E,D]=d.useState(),{planUsers:L,isBillingUsers:O}=hn(o),[Y,$]=d.useState(""),G=xe(Be.breakpoints.down("sm")),F=xe(Be.breakpoints.down("md")),he=()=>{v(!1),D(void 0)},ps=q=>()=>{v(!0),D(q)},ms=q=>()=>{j({open:!0,user:q})},Fe=q=>()=>{b({open:!0,user:q})},pt=()=>{j({open:!1})},xs=()=>{b({open:!1})},gs=async q=>{try{await m(q.id),l({text:`${q.name} has been deleted`,type:"success"}),i(),he()}catch(Xe){c(V(Xe))}},js=()=>{B(!1),H(!1),U("")},mt=d.useMemo(()=>[{Header:"Avatar",accessor:"imageUrl",Cell:({row:{original:q}})=>e.jsx(ae,{children:e.jsx(Ke,{user:q})}),disableSortBy:!0,maxWidth:80},{id:"name",Header:"Name",accessor:q=>q.name||"",minWidth:180,Cell:({row:{original:q}})=>e.jsx(Se,{value:q.name,subtitle:q.email||q.username}),searchable:!0},...C?[{id:"warning",Header:" ",accessor:q=>q.name||"",maxWidth:40,Cell:({row:{original:q}})=>e.jsx(Gp,{count:q.activeSessions}),searchable:!1,disableSortBy:!0}]:[],{id:"role",Header:"Role",accessor:q=>{var Xe;return((Xe=a.find(Za=>Za.id===q.rootRole))==null?void 0:Xe.name)||""},Cell:({row:{original:q},value:Xe})=>e.jsx(en,{value:Xe,role:q.rootRole}),maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"last-login",Header:"Last login",accessor:"seenAt",Cell:Me,maxWidth:150},{id:"type",Header:"Type",accessor:"paid",maxWidth:100,Cell:({row:{original:q}})=>e.jsx(Op,{value:O&&q.paid}),sortType:"boolean"},{Header:"",id:"Actions",align:"center",Cell:({row:{original:q}})=>e.jsx(Np,{onEdit:()=>{t(`/admin/users/${q.id}/edit`)},onViewAccess:()=>{t(`/admin/users/${q.id}/access`)},onChangePassword:ms(q),onResetPassword:Fe(q),onDelete:ps(q),isScimUser:S&&!!q.scimId,userId:q.id}),width:80,disableSortBy:!0},{accessor:"username",Header:"Username",searchable:!0},{accessor:"email",Header:"Email",searchable:!0}],[a,t,O]),fs=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}],hiddenColumns:O?["username","email"]:["type","username","email"]}),[O]),{data:Z,getSearchText:pe}=dt(mt,Y,O?L:o),{headerGroups:xt,rows:ys,prepareRow:Ja,setHiddenColumns:Ka}=z.useTable({columns:mt,data:Z,initialState:fs,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ae}},z.useSortBy,z.useFlexLayout);return Dt([{condition:!O||F,columns:["type"]},{condition:G,columns:["imageUrl","role"]},{condition:F,columns:["createdAt","last-login","warning"]}],Ka,mt),e.jsxs(se,{isLoading:r,header:e.jsx(ne,{title:`Users (${ys.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:Y,onChange:$}),e.jsx(ne.Divider,{}),e.jsx(Te,{title:"Exports user access information",arrow:!0,describeChild:!0,children:e.jsx(Oe,{onClick:g,children:e.jsx(Go,{})})}),e.jsx(N,{variant:"contained",color:"primary",onClick:()=>t("/admin/create-user"),children:"Add new user"})]})}),children:[e.jsx(Fp,{}),e.jsx(T,{condition:s(),show:e.jsx(Ha,{children:e.jsx(oe,{to:"/admin/users/inactive",children:"View inactive users"})})}),e.jsx(cm,{}),e.jsx(Ne,{value:pe(Y),children:e.jsx(ye,{rows:ys,headerGroups:xt,prepareRow:Ja})}),e.jsx(T,{condition:ys.length===0,show:e.jsx(T,{condition:(Y==null?void 0:Y.length)>0,show:e.jsxs(le,{children:["No users found matching “",Y,"”"]}),elseShow:e.jsx(le,{children:e.jsx("span",{"data-loading":!0,children:"No users available. Get started by adding one."})})})}),e.jsx(Ga,{open:P,closeConfirm:js,emailSent:w,inviteLink:I}),e.jsx(T,{condition:!!x.user,show:()=>e.jsx(kp,{showDialog:x.open,closeDialog:pt,user:x.user})}),e.jsx(T,{condition:!!y.user,show:()=>e.jsx(Ap,{showDialog:y.open,closeDialog:xs,user:y.user})}),e.jsx(T,{condition:!!E,show:e.jsx(Dp,{showDialog:R,closeDialog:he,user:E,removeUser:()=>gs(E),userLoading:p,userApiErrors:h})}),k?e.jsx(jm,{}):null]})},ym=()=>{d.useEffect(()=>{Fs()},[]);const{uiConfig:t}=W(),{setToastData:s,setToastApiError:n}=K(),o=is("id"),{user:a,refetch:i}=na(o),{updateUser:r,userLoading:l}=Qe(),c=Ce(),{name:m,setName:p,email:h,setEmail:g,sendEmail:x,setSendEmail:j,rootRole:y,setRootRole:b,getAddUserPayload:C,validateName:k,errors:S,clearErrors:R}=Fa(a==null?void 0:a.name,a==null?void 0:a.email,a==null?void 0:a.rootRole),v=()=>`curl --location --request PUT '${t.unleashUrl}/api/admin/user-admin/${o}' \\
33
+ --header 'Authorization: INSERT_API_KEY' \\
34
+ --header 'Content-Type: application/json' \\
35
+ --data-raw '${JSON.stringify(C(),void 0,2)}'`,P=async w=>{w.preventDefault();const H=C();if(k())try{await r({...H,id:o}),i(),c("/admin/users"),s({text:"User information updated",type:"success"})}catch(U){n(V(U))}},B=()=>{c(Pe)};return e.jsx(Ee,{loading:l,title:"Edit user",description:"In order for a user to get access to Unleash, they need to be assigned a root role, such as Viewer, Editor, or Admin.",documentationLink:"https://docs.getunleash.io/concepts/rbac#predefined-roles",documentationLinkLabel:"User management documentation",formatApiCode:v,children:e.jsx(Na,{errors:S,handleSubmit:P,handleCancel:B,name:m,setName:p,email:h,setEmail:g,sendEmail:x,setSendEmail:j,rootRole:y,setRootRole:b,clearErrors:R,mode:Zs,children:e.jsx(Bo,{permission:ee})})})},bm=()=>{const{data:t,error:s,mutate:n}=we(te("api/admin/user-admin/inactive"),Sm);return d.useMemo(()=>({inactiveUsers:(t==null?void 0:t.inactiveUsers)??[],error:s,refetchInactiveUsers:()=>n(),loading:!s&&!t}),[t,s,n])},Sm=t=>fetch(t).then(ce("User")).then(s=>s.json()),co="delInactiveUsers",vm=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0});return{deleteInactiveUsers:async i=>{const l=s("api/admin/user-admin/inactive/delete",{method:"POST",body:JSON.stringify({ids:i})});return t(l.caller,l.id)},errors:n,loading:o}},Cm=u(M)(()=>({display:"flex",justifyContent:"center"})),wm=({onDelete:t})=>e.jsx(Cm,{children:e.jsx(Ue,{"data-loading":!0,onClick:t,permission:ee,tooltipProps:{title:"Remove user"},children:e.jsx(Le,{})})}),Tm=({showDialog:t,closeDialog:s,user:n,userLoading:o,removeUser:a,userApiErrors:i})=>{const r=Et(o),{classes:l}=ls();return e.jsx(Q,{open:t,title:"Really delete user?",onClose:s,onClick:a,primaryButtonText:"Delete user",secondaryButtonText:"Cancel",children:e.jsxs("div",{ref:r,children:[e.jsx(T,{condition:!!i[Vt],show:e.jsx(J,{"data-loading":!0,severity:"error",style:{margin:"1rem 0"},children:i[Vt]})}),e.jsx("div",{"data-loading":!0,className:l.flexRow,children:e.jsx(A,{variant:"subtitle1",style:{marginLeft:"1rem"},children:n.username||n.email})}),e.jsxs(A,{"data-loading":!0,variant:"body1",style:{marginTop:"1rem"},children:["Are you sure you want to delete"," ",`${n.name||"user"} (${n.email||n.username})`]})]})})},km=({showDialog:t,closeDialog:s,inactiveUsersLoading:n,removeInactiveUsers:o,inactiveUserApiErrors:a,inactiveUsers:i})=>{const r=Et(n);return e.jsx(Q,{open:t,title:"Really delete all inactive users?",onClose:s,onClick:o,primaryButtonText:"Delete all inactive users",secondaryButtonText:"Cancel",children:e.jsxs("div",{ref:r,children:[e.jsx(T,{condition:!!a[co],show:e.jsx(J,{"data-loading":!0,severity:"error",style:{margin:"1rem 0"},children:a[co]})}),e.jsx("div",{style:fr,children:e.jsxs(A,{variant:"subtitle1",children:["You will be deleting"," ",i.length===1?"1 inactive user":`${i.length} inactive users`]})})]})})},Em=()=>{const{removeUser:t,userApiErrors:s}=Qe(),{deleteInactiveUsers:n,errors:o}=vm(),{setToastData:a,setToastApiError:i}=K(),{inactiveUsers:r,refetchInactiveUsers:l,loading:c,error:m}=bm(),{users:p,roles:h,loading:g,refetch:x,error:j}=be(),[y,b]=d.useState(!1),[C,k]=d.useState(),[S,R]=d.useState(!1),v=()=>{b(!1),k(void 0)},P=$=>G=>{G.preventDefault(),b(!0),k($)},B=$=>{$.preventDefault(),R(!0)},w=()=>{R(!1)},H=async()=>{try{await n(r.map($=>$.id)),a({text:"Inactive users has been deleted",type:"success"}),R(!1),l()}catch($){i(V($))}},I=async $=>{try{await t($),a({text:"User has been deleted",type:"success"}),l(),v()}catch(G){i(V(G))}},U=d.useMemo(()=>r.map($=>{const G=p.find(F=>F.id===$.id);return{...$,rootRole:G==null?void 0:G.rootRole}}),[r,p]),E=d.useMemo(()=>[{id:"name",Header:"Name",accessor:$=>$.name||"",minWidth:200,Cell:({row:{original:$}})=>e.jsx(Se,{value:$.name,subtitle:$.email||$.username}),searchable:!0},{id:"role",Header:"Role",accessor:$=>{var G;return((G=h.find(F=>F.id===$.rootRole))==null?void 0:G.name)||""},Cell:({row:{original:$},value:G})=>e.jsx(en,{value:G,role:$.rootRole}),maxWidth:120},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{id:"last-login",Header:"Last login",accessor:"seenAt",Cell:Me,maxWidth:150},{id:"pat-last-login",Header:"PAT last used",accessor:"patSeenAt",Cell:Me,maxWidth:150},{id:"Actions",Header:"Actions",align:"center",Cell:({row:{original:$}})=>e.jsx(wm,{onDelete:P($)}),width:200,disableSortBy:!0}],[h]),D=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}],hiddenColumns:["username","email"]}),[]),{headerGroups:L,rows:O,prepareRow:Y}=z.useTable({columns:E,data:U,initialState:D,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ae}},z.useSortBy,z.useFlexLayout);return e.jsxs(se,{isLoading:c,header:e.jsx(ne,{title:`Inactive users (${O.length})`,actions:e.jsx(e.Fragment,{children:e.jsx(N,{variant:"contained",color:"primary",onClick:B,disabled:r.length===0,children:"Delete all inactive users"})})}),children:[e.jsx(Ha,{children:e.jsx(oe,{to:"/admin/users",children:"View all users"})}),e.jsx(ye,{rows:O,headerGroups:L,prepareRow:Y}),e.jsx(T,{condition:O.length===0,show:e.jsx(le,{children:"No inactive users found."})}),e.jsx(T,{condition:!!C,show:e.jsx(Tm,{showDialog:y,closeDialog:v,user:C,userLoading:g,removeUser:()=>I(C.id),userApiErrors:s})}),e.jsx(km,{showDialog:S,closeDialog:w,inactiveUsersLoading:c,inactiveUserApiErrors:o,inactiveUsers:r,removeInactiveUsers:H})]})},uo=({label:t,options:s,value:n,setValue:o,...a})=>e.jsx(wo,{options:s,value:n,onChange:(i,r)=>o(r),renderInput:i=>e.jsx(X,{...i,label:t,fullWidth:!0}),size:"small",fullWidth:!0,...a}),Am=(t,s,n)=>{const o=`${s?`?project=${s}`:""}${n?`${s?"&":"?"}environment=${n}`:""}`,a=`api/admin/user-admin/${t}/permissions${o}`,{data:i,error:r,mutate:l}=we(te(a),Rm);return d.useMemo(()=>({overview:i==null?void 0:i.overview,projectRoles:i==null?void 0:i.projectRoles,rootRole:i==null?void 0:i.rootRole,user:i==null?void 0:i.user,loading:!r&&!i,refetch:()=>l(),error:r}),[i,r,l])},Rm=t=>fetch(t).then(ce("User access matrix")).then(s=>s.json()),ho=u("ul")(({theme:t})=>({listStyle:"none",padding:0,margin:0,fontSize:t.fontSizes.smallBody,"& > li":{display:"flex",justifyContent:"space-between",padding:t.spacing(2),borderBottom:`1px solid ${t.palette.divider}`},"& ul li":{paddingLeft:t.spacing(4)},"& ul:last-of-type > li:last-child":{borderBottom:"none"}})),Dm=u("div",{shouldForwardProp:t=>t!=="hasPermission"})(({theme:t,hasPermission:s})=>({display:"flex",gap:t.spacing(1),alignItems:"center",width:t.spacing(17.5),color:s?t.palette.text.primary:t.palette.text.secondary,"& > svg":{color:s?t.palette.success.main:t.palette.error.main}})),Im=({categories:t})=>{const{searchQuery:s}=Js();return e.jsx(M,{sx:{maxHeight:500,overflow:"auto"},children:e.jsx(ho,{children:t.map(n=>e.jsxs(e.Fragment,{children:[e.jsx("li",{children:e.jsx("strong",{children:n.label})},n.label),e.jsx(ho,{children:n.permissions.map(o=>e.jsxs("li",{children:[e.jsx("div",{children:e.jsx(Ht,{search:s,children:o.displayName})}),e.jsx(Pm,{hasPermission:o.hasPermission})]},o.name))})]}))})})},Pm=({hasPermission:t})=>e.jsx(Dm,{hasPermission:t,children:t?e.jsxs(e.Fragment,{children:[e.jsx(qs,{}),"Has permission"]}):e.jsxs(e.Fragment,{children:[e.jsx(sa,{}),"No permission"]})}),Lm=u(Qt)(({theme:t})=>({border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusLarge,overflow:"hidden",boxShadow:"none",margin:0,"&:before":{display:"none"}})),Bm=u(Xt)(({theme:t})=>({backgroundColor:t.palette.background.elevation1,"& .MuiAccordionSummary-content":{justifyContent:"space-between",alignItems:"center",minHeight:"30px"}})),Um=u("div")(({theme:t})=>({display:"flex",alignItems:"start",flexDirection:"column",gap:t.spacing(.5)})),$m=u("span")(({theme:t})=>({fontWeight:t.fontWeight.bold})),Om=u("span")(({theme:t})=>({color:t.palette.text.secondary,fontSize:t.fontSizes.smallBody,marginRight:t.spacing(1)})),_m=u(ts)(({theme:t})=>({padding:0})),Bs=({categories:t,children:s})=>{const n=t.flatMap(({permissions:o})=>o);return e.jsxs(Lm,{children:[e.jsxs(Bm,{expandIcon:e.jsx(es,{}),children:[e.jsx(Um,{children:e.jsx($m,{children:s})}),e.jsxs(Om,{children:[n.filter(({hasPermission:o})=>o).length,"/",n.length," permissions"]})]}),e.jsx(_m,{children:e.jsx(Im,{categories:t})})]})},Mm=u("div")(({theme:t})=>({display:"flex",flex:1,gap:t.spacing(1),maxWidth:800,[t.breakpoints.down("md")]:{flexDirection:"column",maxWidth:"100%"},"& > div":{width:"100%"}})),Nm=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2)})),Us=(t,s)=>{const n=s.toLowerCase(),o=t.permissions.filter(({displayName:a})=>a.toLowerCase().includes(n));if(o.length)return{...t,permissions:o}},Fm=()=>{const t=is("id"),[s,n]=yr({project:wn,environment:wn}),{projects:o}=vo(),{environments:a}=br(),{user:i,loading:r}=na(t),l=xe(Be.breakpoints.down("md")),[c,m]=d.useState(""),[p,h]=d.useState(s.project??""),[g,x]=d.useState(s.environment??void 0),{overview:j,rootRole:y,projectRoles:b}=Am(t,p,g);d.useEffect(()=>{n({project:p||void 0,environment:g},"replace")},[p,g]);const C=e.jsxs(Mm,{children:[e.jsx(ue,{initialValue:c,onChange:m}),e.jsx(uo,{label:"Project",options:o,getOptionLabel:v=>(v==null?void 0:v.name)??"",value:o.find(({id:v})=>v===p),setValue:v=>h((v==null?void 0:v.id)??"")}),e.jsx(uo,{label:"Environment",options:a,getOptionLabel:v=>(v==null?void 0:v.name.concat(v.enabled?"":" - deprecated"))??"",value:a.find(({name:v})=>v===g),setValue:v=>x(v==null?void 0:v.name)})]}),k=d.useMemo(()=>{const v=Vo((j==null?void 0:j.root)??[]);return c?v.map(P=>Us(P,c)).filter(Boolean):v},[j==null?void 0:j.root,c]),S=d.useMemo(()=>Ua((j==null?void 0:j.project)??[]).map(({label:P,permissions:B})=>({label:P,permissions:B.map(([w])=>w)})).map(P=>Us(P,c)).filter(Boolean),[j==null?void 0:j.project,c]),R=d.useMemo(()=>qo((j==null?void 0:j.environment)??[]).map(P=>Us(P,c)).filter(Boolean),[j==null?void 0:j.environment,c]);return e.jsx(se,{isLoading:r,header:e.jsx(ne,{title:`Access overview for ${i.name||i.email||i.username}`,actions:e.jsx(T,{condition:!l,show:C}),children:e.jsx(T,{condition:l,show:C})}),children:e.jsx(Nm,{children:e.jsxs(Ne,{value:c,children:[e.jsxs(Bs,{categories:k,children:["Root permissions for role ",y==null?void 0:y.name]}),e.jsxs(Bs,{categories:S,children:["Project permissions",p?` for project ${p}${b!=null&&b.length?` with project role${b.length!==1?"s":""} ${b==null?void 0:b.map(v=>v.name).join(", ")}`:""}`:""]}),g&&e.jsxs(Bs,{categories:R,children:["Environment permissions for ",g]})]})})})},Gm=()=>{const{isEnterprise:t}=W();return e.jsx("div",{children:e.jsx(ve,{permissions:ee,children:e.jsxs(it,{children:[e.jsx(_,{index:!0,element:e.jsx(e.Fragment,{children:e.jsx(fm,{})})}),e.jsx(_,{path:":id/edit",element:e.jsx(ym,{})}),e.jsx(_,{path:":id/access",element:e.jsx(Fm,{})}),e.jsx(_,{path:"inactive",element:e.jsx(T,{condition:t(),show:e.jsx(Em,{}),elseShow:e.jsx(at,{feature:"inactive-users",page:!0})})}),e.jsx(_,{path:"*",element:e.jsx(oa,{})})]})})})},yt="api/admin/banners",Va=()=>{const{loading:t,makeRequest:s,createRequest:n,errors:o}=ge({propagateErrors:!0}),a=async p=>{const g=n(yt,{method:"POST",body:JSON.stringify(p)},"addBanner");return(await s(g.caller,g.id)).json()},i=async(p,h)=>{const x=n(`${yt}/${p}`,{method:"PUT",body:JSON.stringify(h)},"updateBanner");await s(x.caller,x.id)},r=async p=>{const g=n(`${yt}/${p}/on`,{method:"POST"},"enableBanner");await s(g.caller,g.id)},l=async p=>{const g=n(`${yt}/${p}/off`,{method:"POST"},"disableBanner");await s(g.caller,g.id)};return{addBanner:a,updateBanner:i,removeBanner:async p=>{const g=n(`${yt}/${p}`,{method:"DELETE"},"removeBanner");await s(g.caller,g.id)},toggleBanner:async(p,h)=>{h?await r(p):await l(p)},errors:o,loading:t}},Wm=u(M)(()=>({display:"flex",justifyContent:"center"})),zm=({onEdit:t,onDelete:s})=>e.jsxs(Wm,{children:[e.jsx(Ue,{"data-loading":!0,onClick:t,permission:ee,tooltipProps:{title:"Edit banner"},children:e.jsx(At,{})}),e.jsx(Ue,{"data-loading":!0,onClick:s,permission:ee,tooltipProps:{title:"Remove banner"},children:e.jsx(Le,{})})]}),Hm=({banner:t,open:s,setOpen:n,onConfirm:o})=>e.jsx(Q,{title:"Delete banner?",open:s,primaryButtonText:"Delete banner",secondaryButtonText:"Cancel",onClick:()=>o(t),onClose:()=>{n(!1)},children:e.jsxs("p",{children:["You are about to delete banner: ",e.jsx("strong",{children:t==null?void 0:t.message})]})}),qm=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(4)})),Vm=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"center",padding:t.spacing(1.5),gap:t.spacing(1.5),border:`1px solid ${t.palette.divider}`,borderRadius:t.shape.borderRadiusMedium})),Ym=u("p")(({theme:t})=>({fontSize:t.fontSizes.smallBody,color:t.palette.text.secondary})),Jm=u("div")(({theme:t})=>({background:t.palette.background.elevation1,padding:t.spacing(2,3),borderRadius:t.shape.borderRadiusLarge})),$s=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(1.5)})),Os=u("p")(({theme:t})=>({fontWeight:t.fontWeight.bold})),Ae=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(1)})),Re=u("p")(({theme:t})=>({display:"flex",color:t.palette.text.primary})),et=u(Ze)({width:"100%"}),_s=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",padding:t.spacing(.5),gap:t.spacing(.5)})),Ms=u(Qo)(({theme:t})=>({width:"100%",maxWidth:t.spacing(50)})),Km=u(N)(({theme:t})=>({marginRight:"auto"})),Zm=[{key:"info",label:"Information"},{key:"warning",label:"Warning"},{key:"error",label:"Error"},{key:"success",label:"Success"}],po=t=>t===""?"Default":t==="none"?"None":"Custom",mo=t=>t===""?"None":t==="dialog"?"Dialog":"Link",Qm=({enabled:t,message:s,variant:n,sticky:o,icon:a,link:i,linkText:r,dialogTitle:l,dialog:c,setEnabled:m,setMessage:p,setVariant:h,setSticky:g,setIcon:x,setLink:j,setLinkText:y,setDialogTitle:b,setDialog:C})=>{const[k,S]=d.useState(!1),[R,v]=d.useState(()=>po(a)),[P,B]=d.useState(()=>mo(i));return d.useEffect(()=>{v(po(a)),B(mo(i))},[a,i]),e.jsxs(qm,{children:[e.jsxs(Vm,{children:[e.jsx(Ym,{children:"Banner preview:"}),e.jsx(aa,{banner:{message:s||"*No message set. Please enter a message below.*",variant:n,sticky:!1,icon:a,link:i,linkText:r,dialogTitle:l,dialog:c},inline:!0})]}),e.jsx(Jm,{children:e.jsx(Sr,{checked:t,setChecked:m,children:"Banner status"})}),e.jsxs($s,{children:[e.jsx(Os,{children:"Configuration"}),e.jsxs(Ae,{children:[e.jsx(Re,{children:"What type of banner is it?"}),e.jsx(Ms,{size:"small",value:n,onChange:w=>h(w),options:Zm})]}),e.jsxs(Ae,{children:[e.jsx(Re,{children:"What icon should be displayed on the banner?"}),e.jsx(Ms,{size:"small",value:R,onChange:w=>{v(w),x(w==="None"?"none":"")},options:["Default","Custom","None"].map(w=>({key:w,label:w}))})]}),e.jsx(T,{condition:R==="Custom",show:e.jsxs(Ae,{children:[e.jsxs(Re,{children:["Which custom icon?",e.jsx(st,{htmlTooltip:!0,tooltip:e.jsxs(_s,{children:[e.jsxs("p",{children:["Choose an icon from"," ",e.jsx("a",{href:"https://fonts.google.com/icons",target:"_blank",rel:"noreferrer",children:"Material Symbols"}),"."]}),e.jsx("p",{children:'For example, if you want to display the "Rocket Launch" icon, you can enter "rocket_launch" in the field below.'})]})})]}),e.jsx(et,{label:"Banner icon",value:a,onChange:w=>x(w.target.value),autoComplete:"off"})]})}),e.jsxs(Ae,{children:[e.jsxs(Re,{children:["What is your banner message?",e.jsx(st,{htmlTooltip:!0,tooltip:e.jsx(_s,{children:e.jsxs("p",{children:[e.jsx("a",{href:"https://www.markdownguide.org/basic-syntax/",target:"_blank",rel:"noreferrer",children:"Markdown"})," ","is supported."]})})})]}),e.jsx(et,{autoFocus:!0,label:"Banner message",multiline:!0,minRows:2,maxRows:6,value:s,onChange:w=>p(w.target.value),autoComplete:"off",required:!0})]})]}),e.jsxs($s,{children:[e.jsx(Os,{children:"Banner action"}),e.jsxs(Ae,{children:[e.jsx(Re,{children:"What action should be available in the banner?"}),e.jsx(Ms,{size:"small",value:P,onChange:w=>{B(w),j(w==="Dialog"?"dialog":""),y(""),b(""),C("")},options:["None","Link","Dialog"].map(w=>({key:w,label:w}))})]}),e.jsx(T,{condition:P==="Link",show:e.jsxs(Ae,{children:[e.jsx(Re,{children:"What URL should be opened?"}),e.jsx(et,{label:"URL",value:i,onChange:w=>j(w.target.value),onBlur:()=>{r||y(i)},autoComplete:"off"})]})}),e.jsx(T,{condition:P!=="None",show:e.jsxs(Ae,{children:[e.jsx(Re,{children:"What is the action text?"}),e.jsx(et,{label:"Action text",value:r,onChange:w=>y(w.target.value),autoComplete:"off"})]})}),e.jsx(T,{condition:P==="Dialog",show:e.jsxs(e.Fragment,{children:[e.jsxs(Ae,{children:[e.jsx(Re,{children:"What is the dialog title?"}),e.jsx(et,{label:"Dialog title",value:l,onChange:w=>b(w.target.value),autoComplete:"off"})]}),e.jsxs(Ae,{children:[e.jsxs(Re,{children:["What is the dialog content?",e.jsx(st,{htmlTooltip:!0,tooltip:e.jsx(_s,{children:e.jsxs("p",{children:[e.jsx("a",{href:"https://www.markdownguide.org/basic-syntax/",target:"_blank",rel:"noreferrer",children:"Markdown"})," ","is supported."]})})})]}),e.jsx(et,{label:"Dialog content",multiline:!0,minRows:4,value:c,onChange:w=>C(w.target.value),autoComplete:"off"})]}),e.jsx(Km,{variant:"outlined",color:"primary",startIcon:e.jsx(vr,{}),onClick:()=>S(!0),children:"Preview dialog"}),e.jsx(Cr,{open:k,setOpen:S,title:l||r,children:c})]})})]}),e.jsxs($s,{children:[e.jsx(Os,{children:"Sticky banner"}),e.jsx(re,{control:e.jsx(ns,{checked:o,onChange:w=>g(w.target.checked)}),label:"Make the banner sticky on the screen when scrolling"})]})]})},Xm=u("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),ex=u("div")(({theme:t})=>({marginTop:"auto",display:"flex",justifyContent:"flex-end",paddingTop:t.spacing(4)})),tx=u(N)(({theme:t})=>({marginLeft:t.spacing(3)})),sx=({banner:t,open:s,setOpen:n})=>{const{refetch:o}=ia(),{addBanner:a,updateBanner:i,loading:r}=Va(),{setToastData:l,setToastApiError:c}=K(),{uiConfig:m}=W(),[p,h]=d.useState(!0),[g,x]=d.useState(""),[j,y]=d.useState("info"),[b,C]=d.useState(!1),[k,S]=d.useState(""),[R,v]=d.useState(""),[P,B]=d.useState(""),[w,H]=d.useState(""),[I,U]=d.useState("");d.useEffect(()=>{h((t==null?void 0:t.enabled)??!0),x((t==null?void 0:t.message)||""),y((t==null?void 0:t.variant)||"info"),C((t==null?void 0:t.sticky)||!1),S((t==null?void 0:t.icon)||""),v((t==null?void 0:t.link)||""),B((t==null?void 0:t.linkText)||""),H((t==null?void 0:t.dialogTitle)||""),U(typeof(t==null?void 0:t.dialog)=="string"?t==null?void 0:t.dialog:"")},[s,t]);const E=t!==void 0,D=E?"Edit banner":"New banner",L=g.length,O={enabled:p,variant:j,icon:k,message:g,link:R,linkText:P,dialogTitle:w,dialog:I,sticky:b},Y=()=>`curl --location --request ${E?"PUT":"POST"} '${m.unleashUrl}/api/admin/banners${E?`/${t.id}`:""}' \\
36
+ --header 'Authorization: INSERT_API_KEY' \\
37
+ --header 'Content-Type: application/json' \\
38
+ --data-raw '${JSON.stringify(O,void 0,2)}'`,$=async G=>{if(G.preventDefault(),!!L)try{E?await i(t.id,O):await a(O),l({text:`Banner ${E?"updated":"added"} successfully`,type:"success"}),o(),n(!1)}catch(F){c(V(F))}};return e.jsx(os,{open:s,onClose:()=>{n(!1)},label:D,children:e.jsx(Ee,{loading:r,modal:!0,title:D,description:"Banners allow you to display messages to other users inside your Unleash instance.",documentationLink:"https://docs.getunleash.io/concepts/banners",documentationLinkLabel:"Banners documentation",formatApiCode:Y,children:e.jsxs(Xm,{onSubmit:$,children:[e.jsx(Qm,{enabled:p,message:g,variant:j,sticky:b,icon:k,link:R,linkText:P,dialogTitle:w,dialog:I,setEnabled:h,setMessage:x,setVariant:y,setSticky:C,setIcon:S,setLink:v,setLinkText:B,setDialogTitle:H,setDialog:U}),e.jsxs(ex,{children:[e.jsxs(N,{type:"submit",variant:"contained",color:"primary",disabled:!L,children:[E?"Save":"Add"," banner"]}),e.jsx(tx,{onClick:()=>{n(!1)},children:"Cancel"})]})]})})})},nx=()=>{const{setToastData:t,setToastApiError:s}=K(),{banners:n,refetch:o,loading:a}=ia(),{toggleBanner:i,removeBanner:r}=Va(),[l,c]=d.useState(""),[m,p]=d.useState(!1),[h,g]=d.useState(!1),[x,j]=d.useState(),y=async(I,U)=>{try{await i(I.id,U),t({text:`"${I.message}" has been ${U?"enabled":"disabled"}`,type:"success"}),o()}catch(E){s(V(E))}},b=async I=>{try{await r(I.id),t({text:`"${I.message}" has been deleted`,type:"success"}),o(),g(!1)}catch(U){s(V(U))}},C=xe(Be.breakpoints.down("md")),k=d.useMemo(()=>[{Header:"Banner",accessor:"message",Cell:({row:{original:I}})=>e.jsx(aa,{banner:{...I,sticky:!1},inline:!0,maxHeight:42}),disableSortBy:!0,minWidth:200,searchable:!0},{Header:"Created",accessor:"createdAt",Cell:je,width:120,maxWidth:120},{Header:"Enabled",accessor:"enabled",Cell:({row:{original:I}})=>e.jsx(wr,{checked:I.enabled,setChecked:U=>y(I,U)}),sortType:"boolean",width:90,maxWidth:90},{Header:"Actions",id:"Actions",align:"center",Cell:({row:{original:I}})=>e.jsx(zm,{onEdit:()=>{j(I),p(!0)},onDelete:()=>{j(I),g(!0)}}),width:100,disableSortBy:!0}],[]),[S]=d.useState({sortBy:[{id:"createdAt",desc:!0}]}),{data:R,getSearchText:v}=dt(k,l,n),{headerGroups:P,rows:B,prepareRow:w,setHiddenColumns:H}=z.useTable({columns:k,data:R,initialState:S,sortTypes:fe,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ae}},z.useSortBy,z.useFlexLayout);return Dt([{condition:C,columns:["createdAt"]}],H,k),e.jsxs(se,{isLoading:a,header:e.jsx(ne,{title:`Banners (${B.length})`,actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{condition:!C,show:e.jsxs(e.Fragment,{children:[e.jsx(ue,{initialValue:l,onChange:c}),e.jsx(ne.Divider,{})]})}),e.jsx(N,{variant:"contained",color:"primary",onClick:()=>{j(void 0),p(!0)},children:"New banner"})]}),children:e.jsx(T,{condition:C,show:e.jsx(ue,{initialValue:l,onChange:c})})}),children:[e.jsx(Ne,{value:v(l),children:e.jsx(ye,{rows:B,headerGroups:P,prepareRow:w})}),e.jsx(T,{condition:B.length===0,show:e.jsx(T,{condition:(l==null?void 0:l.length)>0,show:e.jsxs(le,{children:["No banners found matching “",l,"”"]}),elseShow:e.jsx(le,{children:"No banners available. Get started by adding one."})})}),e.jsx(sx,{banner:x,open:m,setOpen:p}),e.jsx(Hm,{banner:x,open:h,setOpen:g,onConfirm:b})]})},ox=()=>{const{isEnterprise:t}=W();return t()?e.jsx("div",{children:e.jsx(ve,{permissions:[ee,Tr],children:e.jsx(nx,{})})}):e.jsx(at,{feature:"banners",page:!0})},ax=async(t,s)=>{if(t){if(s){const n=await s.json();throw t({message:n.message}),new Error(n.message)}throw new Error("Did not receive a response from the server.")}},ix=()=>{const{makeRequest:t,createRequest:s,errors:n,loading:o}=ge({propagateErrors:!0,handleBadRequest:ax});return{updateLicenseKey:async i=>{const l=s("api/admin/license",{method:"POST",body:JSON.stringify({token:i})});await t(l.caller,l.id)},errors:n,loading:o}},rx=u(M)(({theme:t})=>({display:"grid",gap:t.spacing(4)})),bt=u("div")(()=>({display:"table-row"})),St=u("p")(({theme:t})=>({display:"table-cell",fontWeight:t.fontWeight.bold,paddingTop:t.spacing(2)})),vt=u("p")(({theme:t})=>({display:"table-cell",paddingTop:t.spacing(2),paddingLeft:t.spacing(4)})),lx=()=>{const{setToastData:t,setToastApiError:s}=K(),{license:n,error:o,refetchLicense:a}=kr(),{reCheckLicense:i}=Er(),{loading:r}=W(),{locationSettings:l}=Do(),[c,m]=d.useState(""),{updateLicenseKey:p}=ix(),h=j=>{m(j.target.value.trim())};if(r||!n)return null;const g=async j=>{j.preventDefault();try{await p(c),t({text:"License key updated",type:"success"}),a(),i()}catch(y){s(V(y))}},x={Seats:n.resources.seats,"Release templates":n.resources.releaseTemplates,"Edge instances":n.resources.edgeInstances};return e.jsx(se,{header:e.jsx(ne,{title:"Unleash Enterprise License"}),children:e.jsxs(rx,{children:[e.jsx(T,{condition:!!n.token,show:e.jsxs("div",{children:[e.jsxs(bt,{children:[e.jsx(St,{children:"Customer"}),e.jsx(vt,{children:n.customer})]}),e.jsxs(bt,{children:[e.jsx(St,{children:"Instance Name"}),e.jsx(vt,{children:n.instanceName})]}),e.jsxs(bt,{children:[e.jsx(St,{children:"Plan"}),e.jsx(vt,{children:n.plan})]}),Object.entries(x).map(([j,y])=>y&&e.jsxs(bt,{children:[e.jsx(St,{children:j}),e.jsx(vt,{children:y})]},j)),e.jsxs(bt,{children:[e.jsx(St,{children:"Expire at"}),e.jsx(vt,{children:Lo(n.expireAt,l.locale)})]})]}),elseShow:e.jsx("p",{children:"You do not have a registered Unleash Enterprise License."})}),e.jsxs("form",{onSubmit:g,children:[e.jsx(X,{onChange:h,label:"New license key",name:"licenseKey",value:c,style:{width:"100%"},variant:"outlined",size:"small",multiline:!0,rows:6,required:!0}),e.jsx(f,{container:!0,spacing:3,marginTop:2,children:e.jsxs(f,{item:!0,md:5,children:[e.jsx(N,{variant:"contained",color:"primary",type:"submit",disabled:r,children:"Update license key"})," ",e.jsx("p",{children:e.jsx("small",{style:{color:"red"},children:o==null?void 0:o.message})})]})})]})]})})};var mn={},cx=ct;Object.defineProperty(mn,"__esModule",{value:!0});var Ya=mn.default=void 0,dx=cx(lt()),ux=e,hx=(0,dx.default)((0,ux.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");Ya=mn.default=hx;const px="/static/easyToDeploy-rluTX8sF.png",mx=t=>d.createElement("svg",{width:312,height:145,viewBox:"0 0 312 145",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},d.createElement("rect",{width:312,height:144.519,rx:8,fill:"#F1F0FC"}),d.createElement("g",{opacity:.2},d.createElement("circle",{cx:159.392,cy:72.1494,r:59.9326,stroke:"#657A80",strokeWidth:1.35669,strokeLinecap:"square"}),d.createElement("ellipse",{cx:159.392,cy:72.2595,rx:43.5873,ry:60.2595,stroke:"#657A80",strokeWidth:1.35669,strokeLinecap:"square"}),d.createElement("ellipse",{cx:159.828,cy:72.1494,rx:27.2421,ry:59.9326,stroke:"#657A80",strokeWidth:1.35669,strokeLinecap:"square"}),d.createElement("ellipse",{cx:159.828,cy:72.1494,rx:10.8968,ry:59.9326,stroke:"#657A80",strokeWidth:1.35669,strokeLinecap:"square"})),d.createElement("g",{opacity:.2},d.createElement("mask",{id:"mask0_35832_1341",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:99,y:12,width:121,height:121},d.createElement("circle",{cx:159.392,cy:72.1494,r:59.2542,fill:"#92A1A5",stroke:"#657A80",strokeWidth:1.35669})),d.createElement("g",{mask:"url(#mask0_35832_1341)"},d.createElement("path",{d:"M99.4591 48.1777C99.4591 48.1777 112.535 59.2925 159.392 59.2925C206.248 59.2925 219.324 48.1777 219.324 48.1777",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M99.4591 28.3438C99.4591 28.3438 112.535 45.7787 159.392 45.7787C206.248 45.7787 219.324 28.3438 219.324 28.3438",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M99.4591 2.19141C99.4591 2.19141 112.535 33.1384 159.392 33.1384C206.248 33.1384 219.324 2.19141 219.324 2.19141",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M99.4591 -39.4336C99.4591 -39.4336 112.535 21.3707 159.392 21.3707C206.248 21.3707 219.324 -39.4336 219.324 -39.4336",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("line",{x1:99.4591,y1:71.472,x2:219.324,y2:71.472,stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M219.325 95.6855C219.325 95.6855 206.249 84.5708 159.392 84.5708C112.536 84.5708 99.4596 95.6855 99.4596 95.6855",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M219.325 115.518C219.325 115.518 206.249 98.0826 159.392 98.0826C112.536 98.0826 99.4596 115.518 99.4596 115.518",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M219.325 141.672C219.325 141.672 206.249 110.725 159.392 110.725C112.536 110.725 99.4596 141.672 99.4596 141.672",stroke:"#657A80",strokeWidth:1.35669}),d.createElement("path",{d:"M219.325 183.297C219.325 183.297 206.248 122.493 159.392 122.493C112.536 122.493 99.4594 183.297 99.4594 183.297",stroke:"#657A80",strokeWidth:1.35669}))),d.createElement("rect",{x:184.932,y:83.9727,width:51.1664,height:25.5832,rx:12.7916,transform:"rotate(-180 184.932 83.9727)",fill:"url(#paint0_linear_35832_1341)"}),d.createElement("ellipse",{cx:172.107,cy:71.1803,rx:12.8251,ry:12.7916,fill:"#817AFE"}),d.createElement("path",{d:"M175.693 67.627H168.587V74.7334H175.693V67.627Z",fill:"white"}),d.createElement("path",{d:"M139.097 58.4531L139.004 51.4804L133.012 55.0473L139.097 58.4531ZM123.133 50.0488L129.385 53.1377L128.934 46.1789L123.133 50.0488ZM136.317 53.7832L136.728 53.3399C135.792 52.474 134.566 51.5847 132.963 50.7408L132.682 51.2751L132.4 51.8095C133.918 52.6085 135.055 53.4382 135.907 54.2265L136.317 53.7832ZM132.682 51.2751L132.963 50.7408C131.36 49.8968 129.933 49.3899 128.69 49.1084L128.556 49.6974L128.423 50.2864C129.555 50.5427 130.883 51.0105 132.4 51.8095L132.682 51.2751Z",fill:"#6C65E5"}),d.createElement("path",{d:"M183.041 43.7773L176.874 40.5221L177.139 47.4904L183.041 43.7773ZM167.263 56.659L172.082 51.6188L165.308 49.9655L167.263 56.659ZM177.61 43.9834L177.42 43.4101C175.852 43.9294 174.048 44.8631 172.087 46.4639L172.469 46.9317L172.851 47.3995C174.707 45.8841 176.383 45.026 177.8 44.5567L177.61 43.9834ZM172.469 46.9317L172.087 46.4639C170.126 48.0648 168.851 49.6454 168.028 51.0778L168.552 51.3785L169.076 51.6792C169.819 50.3847 170.995 48.9149 172.851 47.3995L172.469 46.9317Z",fill:"#6C65E5"}),d.createElement("path",{d:"M161.818 87.9746L165.538 93.8726L158.57 94.1455L161.818 87.9746ZM152.37 104.338L156.09 98.4405L159.338 104.611L152.37 104.338ZM162.03 93.4062L162.617 93.5508C162.284 94.9012 161.682 96.4622 160.667 98.2196L160.144 97.9176L159.621 97.6157C160.584 95.948 161.14 94.4924 161.444 93.2617L162.03 93.4062ZM160.144 97.9176L160.667 98.2196C159.652 99.977 158.602 101.279 157.599 102.242L157.18 101.807L156.762 101.371C157.676 100.493 158.658 99.2834 159.621 97.6157L160.144 97.9176Z",fill:"#6C65E5"}),d.createElement("rect",{x:122.135,y:56.5781,width:29.4595,height:14.7297,rx:7.36487,transform:"rotate(-180 122.135 56.5781)",fill:"url(#paint1_linear_35832_1341)"}),d.createElement("ellipse",{cx:114.751,cy:49.2125,rx:7.38412,ry:7.36487,fill:"#1A4049"}),d.createElement("path",{d:"M116.816 47.168H112.724V51.2596H116.816V47.168Z",fill:"#EDF0F1"}),d.createElement("rect",{x:215.746,y:51.1504,width:29.4595,height:14.7297,rx:7.36487,transform:"rotate(-180 215.746 51.1504)",fill:"url(#paint2_linear_35832_1341)"}),d.createElement("ellipse",{cx:208.362,cy:43.7848,rx:7.38412,ry:7.36487,fill:"#1A4049"}),d.createElement("path",{d:"M210.428 41.7383H206.336V45.8299H210.428V41.7383Z",fill:"#EDF0F1"}),d.createElement("rect",{x:150.626,y:116.271,width:29.4595,height:14.7297,rx:7.36487,transform:"rotate(-180 150.626 116.271)",fill:"url(#paint3_linear_35832_1341)"}),d.createElement("ellipse",{cx:143.241,cy:108.906,rx:7.38412,ry:7.36487,fill:"#1A4049"}),d.createElement("path",{d:"M145.306 106.859H141.215V110.951H145.306V106.859Z",fill:"#EDF0F1"}),d.createElement("defs",null,d.createElement("linearGradient",{id:"paint0_linear_35832_1341",x1:184.921,y1:96.703,x2:236.126,y2:96.703,gradientUnits:"userSpaceOnUse"},d.createElement("stop",{stopColor:"#1A4049",stopOpacity:0}),d.createElement("stop",{offset:1,stopColor:"#0E1A1D"})),d.createElement("linearGradient",{id:"paint1_linear_35832_1341",x1:122.129,y1:63.9077,x2:151.611,y2:63.9077,gradientUnits:"userSpaceOnUse"},d.createElement("stop",{stopColor:"#657A80",stopOpacity:0}),d.createElement("stop",{offset:1,stopColor:"#1A4049",stopOpacity:.75})),d.createElement("linearGradient",{id:"paint2_linear_35832_1341",x1:215.74,y1:58.48,x2:245.222,y2:58.48,gradientUnits:"userSpaceOnUse"},d.createElement("stop",{stopColor:"#657A80",stopOpacity:0}),d.createElement("stop",{offset:1,stopColor:"#1A4049",stopOpacity:.75})),d.createElement("linearGradient",{id:"paint3_linear_35832_1341",x1:150.619,y1:123.601,x2:180.101,y2:123.601,gradientUnits:"userSpaceOnUse"},d.createElement("stop",{stopColor:"#657A80",stopOpacity:0}),d.createElement("stop",{offset:1,stopColor:"#1A4049",stopOpacity:.75})))),xx=u(J)(({theme:t})=>({fontSize:t.typography.body1.fontSize,"& > .MuiAlert-icon":{paddingBlock:"7px"},"& > .MuiAlert-message":{padding:t.spacing(1),display:"flex",flexFlow:"row wrap",justifyContent:"space-between",width:"100%",gap:t.spacing(1)},"&.MuiPaper-root":{backgroundColor:t.palette.secondary.light,color:t.palette.text.primary,border:`1px solid ${t.palette.secondary.border}`}})),gx=u("div")(({theme:t})=>({width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:t.spacing(2)})),xo=u("div")(({theme:t})=>({display:"flex",flexDirection:"column",alignItems:"start",gap:t.spacing(1),flex:"1 1 auto"})),jx=u(N)(({theme:t})=>({"&&":{marginTop:t.spacing(1),color:"white"}})),fx=u(mx)(({theme:t})=>({flex:0,width:"auto",display:"block",[t.breakpoints.down("md")]:{display:"none"}})),yx=({...t})=>{const[s,n]=ea("enterpriseEdgeUIDismissibleAlert","open");return e.jsx(Ar,{in:s==="open",children:e.jsx(xx,{onClose:()=>n("closed"),icon:!1,...t,children:e.jsxs(gx,{children:[e.jsxs(xo,{children:[e.jsx(A,{variant:"h3",children:"Instant flag updates worldwide"}),e.jsx(A,{variant:"body2",color:"text.secondary",children:"Enterprise Edge is a high-performance proxy between your SDKs and Unleash, giving you global reach, minimal latency, and making flag changes instantly available to your users."}),e.jsx(jx,{component:oe,to:"/admin/enterprise-edge",variant:"contained",children:"Check out Enterprise Edge"})]}),e.jsx(xo,{sx:{alignItems:"end"},children:e.jsx(fx,{})})]})})})},Bt=1505,bx=u(f)(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(2)})),Sx=u(Ye)(({theme:t})=>({height:t.spacing(44),padding:t.spacing(3),borderRadius:`${t.shape.borderRadiusLarge}px`,boxShadow:"none",color:"white",backgroundColor:t.palette.web.main,overflow:"hidden",[t.breakpoints.down(Bt)]:{height:t.spacing(24)},[t.breakpoints.down(800)]:{height:t.spacing(30)}})),vx=u(Ye)(({theme:t})=>({minHeight:t.spacing(44),padding:t.spacing(3),borderRadius:`${t.shape.borderRadiusLarge}px`,boxShadow:"none",[t.breakpoints.up("md")]:{flexDirection:"row",flexWrap:"nowrap"}})),Cx=u(A)(({theme:t})=>({width:"100%",fontSize:t.fontSizes.largeHeader,fontWeight:"bold",marginBottom:t.spacing(1)})),wx=u("div")(({theme:t})=>({marginBottom:t.spacing(6),[t.breakpoints.down(Bt)]:{marginBottom:t.spacing(2)}})),go=u(A)(({theme:t})=>({fontSize:t.fontSizes.bodySize,marginTop:t.spacing(2),marginBottom:t.spacing(2),flexDirection:"row",display:"flex",gap:t.spacing(1),justifyContent:"space-between",[t.breakpoints.down(Bt)]:{maxWidth:t.spacing(65)},[t.breakpoints.down(800)]:{flexDirection:"column",justifyContent:"start"}})),jo=u("span")(({theme:t})=>({fontSize:t.fontSizes.bodySize,fontWeight:"bold"})),fo=u("span")({color:"white"}),Tx=u(A)(({theme:t})=>({fontSize:t.fontSizes.mainHeader,marginTop:t.spacing(2),marginBottom:t.spacing(4)})),kx=u(f)(({theme:t})=>({display:"flex",flexDirection:"row",gap:t.spacing(2),justifyContent:"space-between",marginBottom:t.spacing(7)})),Mt=u(f)(({theme:t})=>({width:t.spacing(16),aspectRatio:"1 / 1",padding:t.spacing(2),alignItems:"center",borderRadius:"50%",backgroundColor:t.mode==="light"?"#F1F0FC":"#302E42"})),Nt=u(M)({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"}),Ft=u(A)(({theme:t})=>({color:t.palette.primary.main,fontSize:t.fontSizes.largeHeader,fontWeight:"bold",marginTop:t.spacing(1)})),Gt=u(A)(({theme:t})=>({color:t.palette.text.primary,fontSize:t.fontSizes.bodySize})),Ex=u("div")(({theme:t})=>({display:"flex",justifyContent:"flex-start",marginTop:t.spacing(3)})),Ax=u("div")(({theme:t})=>({display:"flex",justifyContent:"flex-end",marginTop:t.spacing(-6),marginRight:t.spacing(-10),[t.breakpoints.down(Bt)]:{marginTop:t.spacing(-22),marginRight:t.spacing(-12)}})),Rx=u("img")(({theme:t})=>({width:t.spacing(33),transform:"rotate(180deg)",clipPath:"polygon(21% 28%, 100% 28%, 21% 94%)"})),Dx=({plan:t,instanceId:s,version:n})=>e.jsxs(Sx,{children:[e.jsxs(wx,{children:[e.jsx("div",{children:"Current plan"}),e.jsx(Cx,{variant:"h3",children:t})]}),e.jsxs(go,{children:[e.jsx(jo,{children:"Instance id"}),e.jsx(fo,{children:s})]}),e.jsxs(go,{children:[e.jsx(jo,{children:"Unleash version"}),e.jsx(fo,{children:n})]}),e.jsx(Ax,{children:e.jsx(Rx,{src:ta(px)})})]}),Ix=({users:t,featureToggles:s,projects:n,environments:o})=>{const a=Ce();return e.jsxs(vx,{children:[e.jsx(Tx,{children:"Instance statistics"}),e.jsxs(kx,{container:!0,children:[e.jsx(Mt,{item:!0,children:e.jsxs(Nt,{children:[e.jsx(Ft,{children:t}),e.jsx(Gt,{children:"Users"})]})}),e.jsx(Mt,{item:!0,children:e.jsxs(Nt,{children:[e.jsx(Ft,{children:s}),e.jsx(Gt,{children:"Feature flags"})]})}),e.jsx(Mt,{item:!0,children:e.jsxs(Nt,{children:[e.jsx(Ft,{children:n}),e.jsx(Gt,{children:"Projects"})]})}),e.jsx(Mt,{item:!0,children:e.jsxs(Nt,{children:[e.jsx(Ft,{children:o}),e.jsx(Gt,{children:"Environments"})]})})]}),e.jsx(Ex,{children:e.jsx(N,{rel:"noreferrer",endIcon:e.jsx(Ya,{}),onClick:()=>{a("/admin/instance")},children:"View all instance statistics"})})]})},Px=()=>{var m,p,h,g,x,j;const t=Da(),s=Rt(),n=xe(s.breakpoints.down(Bt)),o=n?12:7,a=n?12:5,{isOss:i,isPro:r,isEnterprise:l}=W(),c=i()?"Open source":r()?"Pro":l()?"Enterprise":"Unknown";return e.jsxs(bx,{children:[e.jsx(yx,{}),t&&!t.loading&&e.jsxs(f,{container:!0,spacing:3,children:[e.jsx(f,{item:!0,md:a,sm:12,xs:12,children:e.jsx(Dx,{plan:c,instanceId:((m=t.stats)==null?void 0:m.instanceId)??"unknown",version:((p=t.stats)==null?void 0:p.versionEnterprise)??"unknown"})}),e.jsx(f,{item:!0,md:o,sm:12,xs:12,children:e.jsx(Ix,{environments:((h=t.stats)==null?void 0:h.environments)??0,featureToggles:((g=t.stats)==null?void 0:g.featureToggles)??0,projects:((x=t.stats)==null?void 0:x.projects)??0,users:((j=t.stats)==null?void 0:j.users)??0})})]})]})},Lx=d.lazy(()=>ut(()=>import("./EnterpriseEdge-cJFso1xz.js"),[])),Bx=()=>e.jsx(e.Fragment,{children:e.jsxs(it,{children:[e.jsx(_,{index:!0,element:e.jsx(Px,{})}),e.jsx(_,{path:"users/*",element:e.jsx(Gm,{})}),e.jsx(_,{path:"api",element:e.jsx(zr,{})}),e.jsx(_,{path:"api/create-token",element:e.jsx(Yr,{})}),e.jsx(_,{path:"service-accounts",element:e.jsx(dp,{})}),e.jsx(_,{path:"create-user",element:e.jsx(vp,{})}),e.jsx(_,{path:"invite-link",element:e.jsx(wp,{})}),e.jsx(_,{path:"groups/*",element:e.jsx(uu,{})}),e.jsx(_,{path:"roles/*",element:e.jsx(Gh,{})}),e.jsx(_,{path:"instance",element:e.jsx(mu,{})}),e.jsx(_,{path:"enterprise-edge",element:e.jsx(Lx,{})}),e.jsx(_,{path:"network/*",element:e.jsx(Qu,{})}),e.jsx(_,{path:"maintenance",element:e.jsx(Fu,{})}),e.jsx(_,{path:"banners",element:e.jsx(ox,{})}),e.jsx(_,{path:"license",element:e.jsx(lx,{})}),e.jsx(_,{path:"cors",element:e.jsx(dd,{})}),e.jsx(_,{path:"auth/*",element:e.jsx(jl,{})}),e.jsx(_,{path:"admin-invoices",element:e.jsx(od,{})}),e.jsx(_,{path:"billing",element:e.jsx(ed,{})}),e.jsx(_,{path:"instance-privacy",element:e.jsx(Iu,{})}),e.jsx(_,{path:"*",element:e.jsx(oa,{})})]})}),zx=Object.freeze(Object.defineProperty({__proto__:null,default:Bx},Symbol.toStringTag,{value:"Module"}));export{on as B,zx as L,mx as S,Rl as T,ca as a,Al as b,Mx as c,Fx as d,Ll as e,Nx as f,ua as g,Wx as h,Gx as p,$l as u};