unleash-server 8.0.1 → 8.0.2

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 (221) hide show
  1. package/dist/lib/addons/addon.d.ts +10 -2
  2. package/dist/lib/addons/addon.d.ts.map +1 -1
  3. package/dist/lib/addons/addon.js +104 -6
  4. package/dist/lib/addons/addon.js.map +1 -1
  5. package/dist/lib/addons/datadog-definition.js +1 -1
  6. package/dist/lib/addons/datadog-definition.js.map +1 -1
  7. package/dist/lib/addons/datadog.test.js +2 -0
  8. package/dist/lib/addons/datadog.test.js.map +1 -1
  9. package/dist/lib/addons/index.d.ts.map +1 -1
  10. package/dist/lib/addons/index.js +2 -0
  11. package/dist/lib/addons/index.js.map +1 -1
  12. package/dist/lib/addons/new-relic.d.ts.map +1 -1
  13. package/dist/lib/addons/new-relic.js +0 -1
  14. package/dist/lib/addons/new-relic.js.map +1 -1
  15. package/dist/lib/addons/new-relic.test.js +0 -1
  16. package/dist/lib/addons/new-relic.test.js.map +1 -1
  17. package/dist/lib/addons/slack.test.js +1 -2
  18. package/dist/lib/addons/slack.test.js.map +1 -1
  19. package/dist/lib/addons/teams-definition.d.ts.map +1 -1
  20. package/dist/lib/addons/teams-definition.js +1 -0
  21. package/dist/lib/addons/teams-definition.js.map +1 -1
  22. package/dist/lib/addons/teams-workflow-definition.d.ts +4 -0
  23. package/dist/lib/addons/teams-workflow-definition.d.ts.map +1 -0
  24. package/dist/lib/addons/teams-workflow-definition.js +66 -0
  25. package/dist/lib/addons/teams-workflow-definition.js.map +1 -0
  26. package/dist/lib/addons/teams-workflow.d.ts +15 -0
  27. package/dist/lib/addons/teams-workflow.d.ts.map +1 -0
  28. package/dist/lib/addons/teams-workflow.js +110 -0
  29. package/dist/lib/addons/teams-workflow.js.map +1 -0
  30. package/dist/lib/addons/teams-workflow.test.d.ts +2 -0
  31. package/dist/lib/addons/teams-workflow.test.d.ts.map +1 -0
  32. package/dist/lib/addons/teams-workflow.test.js +202 -0
  33. package/dist/lib/addons/teams-workflow.test.js.map +1 -0
  34. package/dist/lib/addons/teams.d.ts.map +1 -1
  35. package/dist/lib/addons/teams.js +0 -1
  36. package/dist/lib/addons/teams.js.map +1 -1
  37. package/dist/lib/addons/teams.test.js +0 -1
  38. package/dist/lib/addons/teams.test.js.map +1 -1
  39. package/dist/lib/addons/validate-url.d.ts +18 -0
  40. package/dist/lib/addons/validate-url.d.ts.map +1 -0
  41. package/dist/lib/addons/validate-url.js +93 -0
  42. package/dist/lib/addons/validate-url.js.map +1 -0
  43. package/dist/lib/addons/validate-url.test.d.ts +2 -0
  44. package/dist/lib/addons/validate-url.test.d.ts.map +1 -0
  45. package/dist/lib/addons/validate-url.test.js +199 -0
  46. package/dist/lib/addons/validate-url.test.js.map +1 -0
  47. package/dist/lib/create-config.d.ts.map +1 -1
  48. package/dist/lib/create-config.js +7 -0
  49. package/dist/lib/create-config.js.map +1 -1
  50. package/dist/lib/error/bad-data-error.d.ts.map +1 -1
  51. package/dist/lib/error/bad-data-error.js +10 -2
  52. package/dist/lib/error/bad-data-error.js.map +1 -1
  53. package/dist/lib/error/unleash-error.test.js +23 -0
  54. package/dist/lib/error/unleash-error.test.js.map +1 -1
  55. package/dist/lib/features/frontend-api/frontend-api-service.d.ts.map +1 -1
  56. package/dist/lib/features/frontend-api/frontend-api-service.js +17 -20
  57. package/dist/lib/features/frontend-api/frontend-api-service.js.map +1 -1
  58. package/dist/lib/features/metrics/integrations/integration-metrics.d.ts +1 -1
  59. package/dist/lib/features/metrics/integrations/integration-metrics.d.ts.map +1 -1
  60. package/dist/lib/features/metrics/integrations/integration-metrics.js +2 -0
  61. package/dist/lib/features/metrics/integrations/integration-metrics.js.map +1 -1
  62. package/dist/lib/middleware/secure-headers.d.ts.map +1 -1
  63. package/dist/lib/middleware/secure-headers.js +20 -1
  64. package/dist/lib/middleware/secure-headers.js.map +1 -1
  65. package/dist/lib/openapi/spec/addon-create-update-schema.d.ts +1 -1
  66. package/dist/lib/openapi/spec/addon-create-update-schema.js +1 -1
  67. package/dist/lib/openapi/spec/addons-schema.d.ts +15 -0
  68. package/dist/lib/openapi/spec/addons-schema.d.ts.map +1 -1
  69. package/dist/lib/openapi/spec/addons-schema.js +51 -0
  70. package/dist/lib/openapi/spec/addons-schema.js.map +1 -1
  71. package/dist/lib/openapi/spec/profile-schema.d.ts +6 -1
  72. package/dist/lib/openapi/spec/profile-schema.d.ts.map +1 -1
  73. package/dist/lib/openapi/spec/profile-schema.js +13 -1
  74. package/dist/lib/openapi/spec/profile-schema.js.map +1 -1
  75. package/dist/lib/openapi/spec/profile-schema.test.js +1 -0
  76. package/dist/lib/openapi/spec/profile-schema.test.js.map +1 -1
  77. package/dist/lib/routes/admin-api/addon.d.ts.map +1 -1
  78. package/dist/lib/routes/admin-api/addon.js +6 -2
  79. package/dist/lib/routes/admin-api/addon.js.map +1 -1
  80. package/dist/lib/routes/admin-api/user/user.d.ts.map +1 -1
  81. package/dist/lib/routes/admin-api/user/user.js +3 -1
  82. package/dist/lib/routes/admin-api/user/user.js.map +1 -1
  83. package/dist/lib/routes/admin-api/user/user.test.js +32 -7
  84. package/dist/lib/routes/admin-api/user/user.test.js.map +1 -1
  85. package/dist/lib/routes/util.d.ts.map +1 -1
  86. package/dist/lib/routes/util.js +8 -1
  87. package/dist/lib/routes/util.js.map +1 -1
  88. package/dist/lib/routes/util.test.d.ts +2 -0
  89. package/dist/lib/routes/util.test.d.ts.map +1 -0
  90. package/dist/lib/routes/util.test.js +18 -0
  91. package/dist/lib/routes/util.test.js.map +1 -0
  92. package/dist/lib/schema/html-input.d.ts +4 -0
  93. package/dist/lib/schema/html-input.d.ts.map +1 -0
  94. package/dist/lib/schema/html-input.js +38 -0
  95. package/dist/lib/schema/html-input.js.map +1 -0
  96. package/dist/lib/schema/html-input.test.d.ts +2 -0
  97. package/dist/lib/schema/html-input.test.d.ts.map +1 -0
  98. package/dist/lib/schema/html-input.test.js +98 -0
  99. package/dist/lib/schema/html-input.test.js.map +1 -0
  100. package/dist/lib/server-impl.d.ts +2 -1
  101. package/dist/lib/server-impl.d.ts.map +1 -1
  102. package/dist/lib/server-impl.js +2 -1
  103. package/dist/lib/server-impl.js.map +1 -1
  104. package/dist/lib/services/addon-service.d.ts +8 -1
  105. package/dist/lib/services/addon-service.d.ts.map +1 -1
  106. package/dist/lib/services/addon-service.js +24 -1
  107. package/dist/lib/services/addon-service.js.map +1 -1
  108. package/dist/lib/services/addon-service.test.js +75 -8
  109. package/dist/lib/services/addon-service.test.js.map +1 -1
  110. package/dist/lib/services/project-schema.d.ts +1 -2
  111. package/dist/lib/services/project-schema.d.ts.map +1 -1
  112. package/dist/lib/services/project-schema.js +4 -2
  113. package/dist/lib/services/project-schema.js.map +1 -1
  114. package/dist/lib/services/user-service.d.ts +1 -0
  115. package/dist/lib/services/user-service.d.ts.map +1 -1
  116. package/dist/lib/services/user-service.js +7 -0
  117. package/dist/lib/services/user-service.js.map +1 -1
  118. package/dist/lib/types/experimental.d.ts +1 -1
  119. package/dist/lib/types/experimental.d.ts.map +1 -1
  120. package/dist/lib/types/experimental.js +21 -0
  121. package/dist/lib/types/experimental.js.map +1 -1
  122. package/dist/lib/types/model.d.ts +2 -0
  123. package/dist/lib/types/model.d.ts.map +1 -1
  124. package/dist/lib/types/model.js.map +1 -1
  125. package/dist/lib/types/option.d.ts +4 -0
  126. package/dist/lib/types/option.d.ts.map +1 -1
  127. package/dist/lib/ui-config/ui-config-service.d.ts.map +1 -1
  128. package/dist/lib/ui-config/ui-config-service.js +4 -2
  129. package/dist/lib/ui-config/ui-config-service.js.map +1 -1
  130. package/dist/lib/ui-config/ui-config.test.js +21 -2
  131. package/dist/lib/ui-config/ui-config.test.js.map +1 -1
  132. package/dist/lib/util/anonymise.d.ts +1 -0
  133. package/dist/lib/util/anonymise.d.ts.map +1 -1
  134. package/dist/lib/util/anonymise.js +3 -0
  135. package/dist/lib/util/anonymise.js.map +1 -1
  136. package/dist/lib/util/anonymise.test.js +4 -1
  137. package/dist/lib/util/anonymise.test.js.map +1 -1
  138. package/dist/migrations/20260617115403-update-flag-descriptions.d.ts +3 -0
  139. package/dist/migrations/20260617115403-update-flag-descriptions.d.ts.map +1 -0
  140. package/dist/migrations/20260617115403-update-flag-descriptions.js +38 -0
  141. package/dist/migrations/20260617115403-update-flag-descriptions.js.map +1 -0
  142. package/dist/migrations/20260624120000-servicenow-change-references.d.ts +3 -0
  143. package/dist/migrations/20260624120000-servicenow-change-references.d.ts.map +1 -0
  144. package/dist/migrations/20260624120000-servicenow-change-references.js +22 -0
  145. package/dist/migrations/20260624120000-servicenow-change-references.js.map +1 -0
  146. package/dist/server-dev.js +5 -1
  147. package/dist/server-dev.js.map +1 -1
  148. package/dist/test/e2e/api/admin/addon.e2e.test.js +2 -1
  149. package/dist/test/e2e/api/admin/addon.e2e.test.js.map +1 -1
  150. package/dist/test/e2e/services/addon-service.e2e.test.js +2 -0
  151. package/dist/test/e2e/services/addon-service.e2e.test.js.map +1 -1
  152. package/frontend/build/index.html +2 -2
  153. package/frontend/build/static/{AdvancedPlayground-BEYkf6Xg.js → AdvancedPlayground-DdeMb-6I.js} +2 -2
  154. package/frontend/build/static/{BackendConnections-DdvotR_8.js → BackendConnections-kgR0xyIH.js} +1 -1
  155. package/frontend/build/static/DialogWithAside-DzCSDyWo.js +1110 -0
  156. package/frontend/build/static/{EnterpriseEdge-DN23kaQp.js → EnterpriseEdge-CjslqYDM.js} +4 -4
  157. package/frontend/build/static/{FeatureMetricsChart-CmVkRuwG.js → FeatureMetricsChart-B4WryxcW.js} +2 -2
  158. package/frontend/build/static/FeatureStaleDialog-EzReRTI5.js +8 -0
  159. package/frontend/build/static/FeatureViewLazyExport-8eQKTvdS.js +10 -0
  160. package/frontend/build/static/{FlagMetricsChart-ZjHSwulg.js → FlagMetricsChart-hNQuwOxW.js} +2 -2
  161. package/frontend/build/static/{FrontendNetworkTrafficUsage-BmLOJdK9.js → FrontendNetworkTrafficUsage-pcr83PWo.js} +1 -1
  162. package/frontend/build/static/GridLayoutWrapper-B_YyjZ7l.js +5 -0
  163. package/frontend/build/static/{ImpactMetricsPage-D1CETZR_.js → ImpactMetricsPage-DGH_S9oz.js} +1 -1
  164. package/frontend/build/static/ImpactViewsPage-DZqKPFvE.js +1 -0
  165. package/frontend/build/static/{LazyAdminExport-BvtR_me3.js → LazyAdminExport-B1ReAViz.js} +15 -15
  166. package/frontend/build/static/LazyProjectExport-BMVcGpNI.js +46 -0
  167. package/frontend/build/static/LifecycleChartComponent-BeoRUO9q.js +2 -0
  168. package/frontend/build/static/{LineChartComponent-d80f3Tky.js → LineChartComponent-BbCMbJ-m.js} +1 -1
  169. package/frontend/build/static/{MarkCompletedDialogue-CtzRfovJ.js → MarkCompletedDialogue-CcXyp8UE.js} +1 -1
  170. package/frontend/build/static/{NetworkOverview-D1UOxIaf.js → NetworkOverview-0mBnFAZX.js} +1 -1
  171. package/frontend/build/static/{NetworkTraffic-CLnhub6c.js → NetworkTraffic-DmG5Iv25.js} +1 -1
  172. package/frontend/build/static/{NetworkTrafficUsage-PgI0lqze.js → NetworkTrafficUsage-DccaVLYs.js} +1 -1
  173. package/frontend/build/static/OnboardingProgress-Bp9sZ-ZM.js +1 -0
  174. package/frontend/build/static/{PercentageDonut-C6I2UOES.js → PercentageDonut-DBDGNJlh.js} +1 -1
  175. package/frontend/build/static/PermissionButton-B-IfzChn.js +1 -0
  176. package/frontend/build/static/ReactJSONEditor-DeBI7JPg.js +4 -0
  177. package/frontend/build/static/RoleCell-DhYvu4YH.js +1 -0
  178. package/frontend/build/static/Safeguard-DErU6fSK.js +1 -0
  179. package/frontend/build/static/{SelectSdk-D2NaTubs.js → SelectSdk-Dr_pzQgX.js} +1 -1
  180. package/frontend/build/static/StoriesPage-frGP1Bfr.js +2 -0
  181. package/frontend/build/static/{aggregateFeatureMetrics-DBivHCcj.js → aggregateFeatureMetrics-B-67HaIZ.js} +1 -1
  182. package/frontend/build/static/chartjs-plugin-annotation.esm-DP4wCpdA.js +1 -0
  183. package/frontend/build/static/differenceInSeconds-DMZGQwjK.js +1 -0
  184. package/frontend/build/static/endOfMonth-CkSR_DAx.js +1 -0
  185. package/frontend/build/static/esm-DdgY1Q5s.js +12 -0
  186. package/frontend/build/static/formatDistanceToNow-CyouiCIY.js +1 -0
  187. package/frontend/build/static/index-C04TEs4k.js +290 -0
  188. package/frontend/build/static/{metricsFormatters-BEX2qb8Y.js → metricsFormatters-DhX-aU17.js} +1 -1
  189. package/frontend/build/static/networkTrafficUsageHighlightPlugin-DlOtHZg3.js +1 -0
  190. package/frontend/build/static/parse-Chj4PyAg.js +1 -0
  191. package/frontend/build/static/startOfHour-P0Sr6h8e.js +1 -0
  192. package/frontend/build/static/themeStyles-DGVpwkcv.js +1 -0
  193. package/frontend/build/static/{useConditionallyHiddenColumns-DTDzRlyO.js → useConditionallyHiddenColumns-C5q9zdfJ.js} +1 -1
  194. package/frontend/build/static/useCustomEvent-Dj2V5RVb.js +1 -0
  195. package/frontend/build/static/{useGroupedImpactMetricsData-CK8Pz2an.js → useGroupedImpactMetricsData-CW9qnV2y.js} +1 -1
  196. package/frontend/build/static/{useInstanceTrafficMetrics-CIpyIGYi.js → useInstanceTrafficMetrics-CRCDB4TX.js} +1 -1
  197. package/frontend/package.json +9 -7
  198. package/package.json +11 -9
  199. package/frontend/build/static/ChatOutlined-jZlhx14o.js +0 -1
  200. package/frontend/build/static/CloudCircle-BjnxUYAO.js +0 -1
  201. package/frontend/build/static/DialogWithAside-BvaGTcqO.js +0 -1106
  202. package/frontend/build/static/FeatureStaleDialog-BkyjUGR9.js +0 -8
  203. package/frontend/build/static/FeatureViewLazyExport-C5FggFea.js +0 -10
  204. package/frontend/build/static/GridLayoutWrapper-D93wkNEo.js +0 -3
  205. package/frontend/build/static/ImpactViewsPage-DeBga4lU.js +0 -1
  206. package/frontend/build/static/LazyProjectExport-BkOu6pHf.js +0 -46
  207. package/frontend/build/static/LifecycleChartComponent-BYvIFr7Q.js +0 -2
  208. package/frontend/build/static/PermissionButton-BIeM26DH.js +0 -1
  209. package/frontend/build/static/ReactJSONEditor-C-paZV5Q.js +0 -4
  210. package/frontend/build/static/RoleCell-BCPNstXC.js +0 -1
  211. package/frontend/build/static/Safeguard-9zs64Bna.js +0 -1
  212. package/frontend/build/static/StoriesPage-5lbMiQlA.js +0 -1
  213. package/frontend/build/static/chartjs-plugin-annotation.esm-BxKcCGhA.js +0 -1
  214. package/frontend/build/static/esm-CFWP4-MJ.js +0 -15
  215. package/frontend/build/static/index-BJ2iUk24.js +0 -289
  216. package/frontend/build/static/networkTrafficUsageHighlightPlugin-DVWh8Lrd.js +0 -1
  217. package/frontend/build/static/parse-BhYjTMCL.js +0 -1
  218. package/frontend/build/static/startOfHour-KiLZtdEa.js +0 -1
  219. package/frontend/build/static/themeStyles-BPY8RNQO.js +0 -1
  220. package/frontend/build/static/useCustomEvent-CwoY8S5F.js +0 -1
  221. /package/frontend/build/static/{connect-DbjGV9Hl.png → cr-DbjGV9Hl.png} +0 -0
@@ -1,8 +0,0 @@
1
- import{o as e,t}from"./react-GZhdek4G.js";import{u as n}from"./chunk-QUQL4437-Dr42NpoL.js";import{t as r}from"./useTheme-CQqAmDLr.js";import{t as i}from"./jsx-runtime-BnvnyDTF.js";import{v as a}from"./createSimplePaletteValueFilter-BRAMrHWJ.js";import{D as o,b as s,t as c}from"./TextField-oipjeg6n.js";import{i as l}from"./CircularProgress-C_LUU3DK.js";import{t as u}from"./ConditionallyRender---uTpMBn.js";import{n as d,r as f,t as p}from"./AccordionSummary-wye3oOm6.js";import{t as m}from"./Typography-BTdLWIUX.js";import{t as h}from"./Box-BQsxfFmC.js";import{t as g}from"./Button-CebB8EPB.js";import{t as _}from"./Link-CfIScd2f.js";import{a as v,i as y,n as b,o as x}from"./TooltipResolver-4A1YhwBy.js";import{u as S}from"./themeStyles-BPY8RNQO.js";import{o as C}from"./parse-BhYjTMCL.js";import{t as w,u as T,y as ee}from"./httpErrorResponseHandler-FMtt7Zqh.js";import{n as E,r as D}from"./formatPath-j72gcKwy.js";import{St as O,c as k,t as A,wt as te,x as ne,z as re}from"./PermissionButton-BIeM26DH.js";import{n as ie}from"./useCustomEvent-CwoY8S5F.js";import{t as j}from"./useUiConfig-DbVjTDpE.js";import{it as ae}from"./testIds-B_Ev-uQn.js";import{r as oe}from"./FileCopy-B8HZEA83.js";import{t as se}from"./useConditionalSWR-DGgzun6i.js";import{$r as M,Ai as N,Di as P,Ea as F,Ei as I,Fi as L,Fr as R,Go as z,Gs as B,Ii as V,Ja as H,Oi as U,Pi as W,Pr as G,R as K,Ri as ce,Ti as le,_s as ue,do as de,eo as q,es as fe,fo as J,hs as pe,ls as me,no as he,so as ge,wi as _e,ws as ve}from"./index-BJ2iUk24.js";import{a as ye,d as be,f as xe,h as Se,i as Ce,n as we,o as Te,p as Ee,s as De,t as Oe}from"./DialogWithAside-BvaGTcqO.js";var Y=i(),ke=l((0,Y.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10H7v-2h10z`}),`IndeterminateCheckBox`),Ae=o(),je=({options:e,selectedOptions:t,indeterminateOptions:n,tagType:r,existingTags:i,disabled:a=!1,onChange:o})=>{let l=(0,Y.jsx)(R,{fontSize:`small`});return(0,Y.jsx)(s,{multiple:!0,id:`checkboxes-tag`,sx:{marginTop:e=>e.spacing(2),width:500},disableCloseOnSelect:!0,options:e,value:t,isOptionEqualToValue:(e,t)=>t.inputValue&&t.inputValue!==``?e.title===t.inputValue:e.title===t.title,getOptionLabel:e=>e.inputValue?e.inputValue:e.title,renderOption:({key:e,...t},r,{selected:i})=>{let a=n?.some(e=>e.title===r.title)??!1;return(0,Y.jsxs)(`li`,{...t,children:[(0,Y.jsx)(u,{condition:!!r.inputValue,show:(0,Y.jsx)(he,{sx:{mr:e=>e.spacing(.5)}}),elseShow:(0,Y.jsx)(B,{icon:l,checkedIcon:(0,Y.jsx)(G,{fontSize:`small`}),indeterminateIcon:(0,Y.jsx)(ke,{fontSize:`small`}),sx:{mr:e=>e.spacing(.5)},checked:i&&!a,indeterminate:a})}),r.title]},e)},filterOptions:(e,t)=>{let n=t.inputValue.trim(),r=Ae(e,{...t,inputValue:n}),i=e.some(e=>n===e.title);return n.length>=2&&!i&&r.push({inputValue:n,title:`Create new value "${n}"`}),r},onChange:o,renderInput:e=>(0,Y.jsx)(c,{...e,label:`Select values`,placeholder:`Select values`}),disabled:a,slotProps:{listbox:{style:{maxHeight:200,overflow:`auto`}}}})},Me=a(`li`)({flexDirection:`column`}),Ne=({options:e,value:t,disabled:n=!1,onChange:i})=>{let a=r();return(0,Y.jsx)(s,{disablePortal:!0,disabled:n,id:`tag-type-select`,sx:{marginTop:e=>e.spacing(2),width:500},options:e,disableClearable:!0,value:t,getOptionLabel:e=>e.name,renderOption:({key:e,...t},n)=>(0,Y.jsxs)(Me,{...t,style:{alignItems:`flex-start`,gap:a.spacing(.5)},children:[(0,Y.jsx)(m,{variant:`body1`,children:n.name}),(0,Y.jsx)(m,{variant:`caption`,children:n.description})]},e),renderInput:e=>(0,Y.jsx)(c,{...e,label:`Tag type`,value:t}),onChange:i,slotProps:{listbox:{style:{maxHeight:200,overflow:`auto`}}}})},Pe=()=>{let{makeRequest:e,createRequest:t,errors:n,loading:r}=b({propagateErrors:!0});return{createTag:async n=>{let r=t(`api/admin/tags`,{method:`POST`,body:JSON.stringify(n)});return e(r.caller,r.id)},bulkUpdateTags:async(n,r)=>{let i=t(`api/admin/projects/${r}/tags`,{method:`PUT`,body:JSON.stringify(n)});return e(i.caller,i.id)},errors:n,loading:r}},X=e(t(),1),Fe=(e,t={})=>{let n=async()=>{let t=E(`api/admin/tags/${e}`);return(await fetch(t,{method:`GET`}).then(w(`Tags`))).json()},r=`api/admin/tags/${e}`,{data:i,error:a}=se(!!e,{tags:[]},r,n,t),[o,s]=(0,X.useState)(!a&&!i);return(0,X.useEffect)(()=>{s(!a&&!i)},[i,a]),{tags:i?.tags||[],error:a,loading:o,refetch:()=>{ee(r)}}},Z=(e,t)=>{let{project:n,refetch:r}=k(e);return{defaultStrategyFallback:{name:`flexibleRollout`,constraints:[],parameters:{rollout:`100`,stickiness:n.defaultStickiness||`default`,groupId:``}},strategy:n.environments?.find(e=>e.environment===t)?.defaultStrategy,refetch:r}},Ie=()=>{let e=q(`projectId`),t=ce(`environmentId`),{refetch:r}=k(e),{defaultStrategyFallback:i,strategy:a,refetch:o}=Z(e,t),[s,c]=(0,X.useState)(a||i),{updateDefaultStrategy:l,loading:u}=ge(),{strategyDefinition:d}=L(s.name),{setToastData:f,setToastApiError:p}=v(),m=V(),{uiConfig:h}=j(),{unleashUrl:_}=h,b=n(),{trackEvent:S}=x(),C=I(s.constraints);if(!d)return null;let w=Le(s);return(0,Y.jsx)(ie,{modal:!0,disablePadding:!0,description:ze,documentationLink:Be,documentationLinkLabel:Ve,formatApiCode:()=>Re(e,t,w,d,_),children:(0,Y.jsxs)(M,{strategy:s,setStrategy:c,strategyDefinition:d,errors:m,groupIdTooltip:`Defaults to the feature flag name if not set.`,onSubmit:async()=>{let n=`/projects/${e}/settings/default-strategy`;try{await l(e,t,w),S(`default_strategy`,{props:{action:`edit`,hasTitle:!!w.title}}),r(),f({text:`Default Strategy updated`,type:`success`}),await o(),b(n)}catch(e){p(y(e))}},children:[(0,Y.jsx)(A,{permission:[ne,re],projectId:e,environmentId:t,variant:`contained`,color:`primary`,type:`submit`,disabled:u||!C||m.hasFormErrors(),"data-testid":ae,children:`Save strategy`}),(0,Y.jsx)(g,{type:`button`,onClick:()=>b(`/projects/${e}/settings/default-strategy`),children:`Cancel`})]})})},Le=e=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:Object.fromEntries(Object.entries(e.parameters??{}).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])),variants:e.variants??[],segments:e.segments??[],disabled:e.disabled??!1}),Re=(e,t,n,r,i)=>{if(!i)return``;let a={...n,parameters:W(n.parameters??{},r)};return`curl --location --request POST '${`${i}/api/admin/projects/${e}/environments/${t}/default-strategy`}' \\
2
- --header 'Authorization: INSERT_API_KEY' \\
3
- --header 'Content-Type: application/json' \\
4
- --data-raw '${JSON.stringify(a,void 0,2)}'`},ze=`
5
- An activation strategy will only run when a feature flag is enabled and provides a way to control who will get access to the feature.
6
- If any of a feature flag's activation strategies returns true, the user will get access.
7
- `,Be=`https://docs.getunleash.io/concepts/projects#project-default-strategy`,Ve=`Default strategy documentation`,He=e=>{let{data:t,error:n,mutate:r}=T(E(`api/admin/environments/project/${e}`),Ue);return{environments:(0,X.useMemo)(()=>t||[],[t]),refetchEnvironments:(0,X.useCallback)(async()=>{await r()},[r]),loading:!n&&!t,error:n}},Ue=async e=>(await fetch(e).then(w(`Environments`)).then(e=>e.json())).environments.sort((e,t)=>e.sortOrder-t.sortOrder),We=e=>{let{setToastData:t,setToastApiError:n}=v(),{addChange:r}=N(),{refetch:i}=U(e),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)({isOpen:!1});return{pending:a,onChangeRequestToggle:(0,X.useCallback)((e,t,n,r)=>{c({featureName:e,environment:t,enabled:n,shouldActivateDisabledStrategies:r,isOpen:!0})},[]),onChangeRequestToggleClose:(0,X.useCallback)(()=>{c(e=>({...e,isOpen:!1}))},[]),onChangeRequestToggleConfirm:(0,X.useCallback)(async()=>{try{o(!0),await r(e,s.environment,{feature:s.featureName,action:`updateEnabled`,payload:{enabled:!!s.enabled,shouldActivateDisabledStrategies:!!s.shouldActivateDisabledStrategies}}),i(),c(e=>({...e,isOpen:!1})),t({type:`success`,text:`Changes added to draft`})}catch(e){n(y(e)),c(e=>({...e,isOpen:!1}))}finally{o(!1)}},[r]),changeRequestDialogDetails:s}},Ge=({enabled:e,featureName:t,environment:n})=>(0,Y.jsxs)(m,{"data-testid":`update-enabled-message`,children:[(0,Y.jsx)(`strong`,{children:e?`Enable`:`Disable`}),` feature flag`,` `,(0,Y.jsx)(`strong`,{children:t}),` in `,(0,Y.jsx)(`strong`,{children:n})]}),Ke=a(`ul`)(({theme:e})=>({margin:e.spacing(1),paddingLeft:e.spacing(2)})),qe=({isOpen:e,onAddDefaultStrategy:t,onActivateDisabledStrategies:n,onClose:r,environment:i,featureId:a})=>{let o=q(`projectId`),{feature:s}=de(o,a),c=s.environments?.find(({name:e})=>e===i)?.strategies?.filter(({disabled:e})=>e).length,l=c?c===1?`1 disabled strategy`:`${c} disabled strategies`:`disabled strategies`;return(0,Y.jsxs)(z,{open:e,secondaryButtonText:`Cancel`,permissionButton:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{type:`button`,variant:`outlined`,permission:O,projectId:o,environmentId:i,onClick:t,children:`Add default strategy`}),(0,Y.jsx)(A,{type:`button`,variant:`outlined`,permission:O,projectId:o,environmentId:i,onClick:n,children:`Enable all strategies`})]}),onClose:r,title:`Enable feature flag in ${i}`,fullWidth:!0,children:[(0,Y.jsx)(m,{sx:{mb:e=>e.spacing(3)},children:`A feature flag cannot be enabled without an enabled strategy.`}),(0,Y.jsx)(m,{children:`To enable this feature flag you can choose to:`}),(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(`li`,{children:(0,Y.jsx)(m,{children:(0,Y.jsx)(`strong`,{children:`Add the default strategy`})})}),(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(m,{children:[(0,Y.jsx)(`strong`,{children:`Enable all the disabled strategies`}),` `,`(this feature flag has `,l,`)`]})})]})]})},Je=e=>{let t=n=>{n<e.length&&e[n](()=>t(n+1))};t(0)},Ye=e=>{let{toggleFeatureEnvironmentOn:t,toggleFeatureEnvironmentOff:n}=P(),{setToastData:r,setToastApiError:i}=v(),[a,o]=(0,X.useState)({open:!1,label:``,loading:!1,onClose:()=>{},onClick:()=>{}}),[s,c]=(0,X.useState)({isOpen:!1,environment:``,featureId:``,onClose:()=>{},onActivateDisabledStrategies:()=>{},onAddDefaultStrategy:()=>{}}),{pending:l,onChangeRequestToggle:d,onChangeRequestToggleClose:f,onChangeRequestToggleConfirm:p,changeRequestDialogDetails:m}=We(e),[h,g]=(0,X.useState)(),_=(0,X.useCallback)(async(e,a)=>{let s=!1;return Je([t=>{if(a.isChangeRequestEnabled||!le(a.environmentType||``))return t();o({open:!0,label:`${e?`Enable`:`Disable`} Environment`,loading:!1,onClose:()=>{o(e=>({...e,open:!1})),a.onRollback?.()},onClick:()=>{o(e=>({...e,open:!1,loading:!0})),t()}})},t=>{if(e===!1||!a.hasStrategies||a.hasEnabledStrategies||a.hasReleasePlans)return t();c({isOpen:!0,environment:a.environmentName,featureId:a.featureId,onClose:()=>{c(e=>({...e,isOpen:!1})),a.onRollback?.()},onActivateDisabledStrategies:()=>{c(e=>({...e,isOpen:!1})),s=!0,t()},onAddDefaultStrategy:()=>{c(e=>({...e,isOpen:!1})),t()}})},t=>{if(!a.isChangeRequestEnabled)return t();g(()=>{g(void 0),a.onRollback?.()}),d(a.featureId,a.environmentName,e,s)},async t=>{if(e!==!1)return t();try{await n(a.projectId,a.featureId,a.environmentName),r({type:`success`,text:`Disabled in ${a.environmentName}`}),a.onSuccess?.()}catch(e){i(y(e)),a.onRollback?.()}},async n=>{if(e!==!0)return n();try{await t(a.projectId,a.featureId,a.environmentName,s),r({type:`success`,text:`Enabled in ${a.environmentName}`}),a.onSuccess?.()}catch(e){i(y(e)),a.onRollback?.()}}])},[o]),b=s.featureId.length!==0;return{onToggle:_,modals:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_e,{...a}),(0,Y.jsx)(u,{condition:b,show:(0,Y.jsx)(qe,{...s})}),(0,Y.jsx)(K,{isOpen:m.isOpen,onClose:()=>{h?.(),f()},environment:m?.environment,disabled:l,onConfirm:()=>{h?.(),p()},messageComponent:(0,Y.jsx)(Ge,{enabled:m?.enabled,featureName:m?.featureName,environment:m.environment})})]})}},Xe=e=>{let[t,n]=(0,X.useState)(e),r=(0,X.useCallback)(()=>n(e),[e]);return(0,X.useEffect)(()=>{n(e)},[e]),[t,n,r]},Ze=a(h)(()=>({mx:`auto`,...S})),Qe=({projectId:e,featureId:t,environmentName:n,value:r,onToggle:i})=>{let[a,o,s]=Xe(r),c=()=>{o(!a),requestAnimationFrame(()=>{i(!a,s)})},l=`${t}-${n}`;return(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsx)(Ze,{"data-testid":`TOGGLE-${l}`,children:(0,Y.jsx)(H,{tooltip:a?`Disable flag in ${n}`:`Enable flag in ${n}`,checked:r,environmentId:n,projectId:e,permission:te,slotProps:{input:{"aria-label":n}},onClick:c,"data-testid":`permission-switch`,disabled:r!==a})},l)})},$e=l((0,Y.jsx)(`path`,{d:`M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5m3 10h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3z`}),`CleaningServices`),et=`flag-reminders:v1`,tt=50,nt=7,rt=({days:e=nt,maxReminders:t=tt}={})=>{let[n,r]=fe(et,{});return{shouldShowReminder:e=>{let t=n[e];return!t||ve(new Date,new Date(t))},snoozeReminder:(n,i=e)=>{let a=C(new Date,i).getTime();r(e=>{let r={...e,[n]:a},i=Object.entries(r);if(i.length>t){i.sort((e,t)=>e[1]-t[1]);let e=i.slice(i.length-t);return Object.fromEntries(e)}return r})}}},it=a(m)(({theme:e})=>({fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold,marginBottom:e.spacing(1.25)})),at=a(m)(({theme:e})=>({fontWeight:e.typography.fontWeightBold,marginTop:e.spacing(2.75),marginBottom:e.spacing(1.75)})),ot=a(`ul`)(({theme:e})=>({padding:0,margin:0,listStyle:`none`,display:`flex`,flexDirection:`column`,gap:e.spacing(1.5)})),Q=a(_)(({theme:e})=>({display:`flex`,alignItems:`center`,gap:e.spacing(1),color:`inherit`,fontSize:e.typography.body2.fontSize,fontWeight:e.typography.fontWeightBold,paddingLeft:e.spacing(1),textDecoration:`none`,"&:hover, &:focus":{textDecoration:`underline`}})),st=()=>(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(it,{children:`Why do I need an SDK?`}),(0,Y.jsx)(m,{variant:`body2`,children:`SDKs serve to bind your application to Unleash. The SDK can connect to Unleash via HTTP and retrieve feature flag configuration that is then cached in your application. Making sure none of your application data ever leaves your servers.`}),(0,Y.jsx)(at,{children:`Other resources`}),(0,Y.jsxs)(ot,{children:[(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(Q,{href:`https://docs.getunleash.io/sdks`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(oe,{fontSize:`small`}),`SDK overview`]})}),(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(Q,{href:`https://github.com/Unleash/unleash-sdk-examples`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(me,{fontSize:`small`}),`SDK code examples repo`]})})]})]}),ct=a(f)(({theme:e})=>({boxShadow:`none`,border:`1px solid ${e.palette.divider}`,borderRadius:`${e.shape.borderRadiusLarge}px !important`,"&:before":{display:`none`},"&.Mui-disabled":{backgroundColor:e.palette.background.paper}})),lt=a(p)(({theme:e})=>({gap:e.spacing(1.5),fontWeight:e.typography.fontWeightBold,"& .MuiAccordionSummary-content":{alignItems:`center`,gap:e.spacing(1.5)},"&.Mui-disabled":{opacity:1,"& .MuiAccordionSummary-expandIconWrapper":{opacity:.5}}})),ut=a(J)(({theme:e})=>({display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:e.palette.success.main,color:`white`,border:`1px solid ${e.palette.success.main}`,"& svg":{width:e.spacing(2.5),height:e.spacing(2.5)}})),dt=a(h)({marginLeft:`auto`}),ft=a(d)(({theme:e})=>({borderTop:`1px solid ${e.palette.divider}`,padding:e.spacing(2),paddingLeft:e.spacing(6.5)})),$=({stepNumber:e,title:t,isExpanded:n,isCompleted:r,isDisabled:i,onExpand:a,summary:o,children:s})=>(0,Y.jsxs)(ct,{expanded:n,disabled:i,onChange:a,children:[(0,Y.jsxs)(lt,{expandIcon:(0,Y.jsx)(pe,{}),children:[r?(0,Y.jsx)(ut,{round:!0,children:(0,Y.jsx)(ue,{})}):(0,Y.jsx)(J,{color:n?`primary`:`neutral`,round:!0,children:e}),t,o&&(0,Y.jsx)(dt,{children:o})]}),(0,Y.jsx)(ft,{children:s})]}),pt=a(h)(({theme:e})=>({display:`flex`,alignItems:`center`,gap:e.spacing(1)})),mt=({sdk:e})=>{if(!e)return null;let t=xe.find(t=>t.name===e.name)?.icon;return(0,Y.jsxs)(pt,{children:[t&&(0,Y.jsx)(Se,{src:D(t),alt:``}),e.name]})},ht=(e,t)=>`${e}/api${Ee.some(e=>e.name===t)?`/frontend`:``}/`,gt=a(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(3)})),_t=({projectId:e,sdk:t,apiKey:n,feature:r,isActive:i,onSdkConnected:a})=>{let{uiConfig:o}=j(),[s,c]=(0,X.useState)(r),[l,u]=(0,X.useState)(!1);(0,X.useEffect)(()=>{r&&c(r)},[r]);let{project:d}=k(e,{refreshInterval:1e3}),f=d.onboardingStatus.status===`sdk-connected`;if((0,X.useEffect)(()=>{f&&a()},[f,a]),(0,X.useEffect)(()=>{if(f||!i)return;let e=setTimeout(()=>u(!0),3e4);return()=>clearTimeout(e)},[f,i]),!t||!n)return null;let p=ht(o.unleashUrl,t.name),[m]=(ye[t.name]||``).replace(`<YOUR_API_TOKEN>`,n).replace(`<YOUR_API_URL>`,p).replaceAll(`<YOUR_FLAG>`,s||`<YOUR_FLAG>`).split(`---
8
- `);return(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(`div`,{children:(0,Y.jsx)(F,{components:{code:Ce},children:m})}),(0,Y.jsx)(we,{sdkConnected:f,connectedTitle:`We received metrics from your application`,connectedBody:`Your SDK is connected and evaluating flags.`,waitingTitle:`Waiting for SDK data...`,waitingBody:`Run your app and evaluate your flag. This step completes on its own.`,showTroubleshooting:l,troubleshootingText:`Not seeing evaluations after ~30s? Make sure your app has started and that the client was initialized with the API key from step 2.`})]})},vt=a(h)({display:`flex`,justifyContent:`flex-end`}),yt=a(`div`)(({theme:e})=>({flex:1,padding:e.spacing(3),display:`flex`,flexDirection:`column`,gap:e.spacing(2)})),bt=a(`div`)(({theme:e})=>({padding:e.spacing(3),display:`flex`,flexDirection:`column`})),xt=({open:e,onClose:t,projectId:n,environments:r,feature:i})=>{let{trackEvent:a}=x(),[o,s]=(0,X.useState)(0),[c,l]=(0,X.useState)(0),[u,d]=(0,X.useState)(),[f,p]=(0,X.useState)(),m=[{title:`Select SDK`,content:(0,Y.jsx)(be,{sdk:u,onSelect:e=>{d(e),s(1),l(1)}}),summary:(0,Y.jsx)(mt,{sdk:u})},{title:`Generate API key`,content:(0,Y.jsx)(De,{projectId:n,sdk:u,environments:r,onApiKeyChange:e=>{!e&&u&&s(1),p(e)},onNext:()=>{s(2),l(2)}}),summary:(0,Y.jsx)(Te,{apiKey:f})},{title:`Configure the SDK`,content:(0,Y.jsx)(_t,{projectId:n,sdk:u,apiKey:f,feature:i,isActive:o>=2,onSdkConnected:()=>s(3)})}],h=o>=m.length&&u,_=e=>{let t=e+1;c===e&&t<m.length&&t<=o?l(t):c!==e&&l(e)};return e?(0,Y.jsx)(Oe,{open:!0,onClose:t,title:`Connect SDK`,fullHeight:!0,aside:(0,Y.jsx)(bt,{children:(0,Y.jsx)(st,{})}),children:(0,Y.jsxs)(yt,{children:[m.map(({title:e,content:t,summary:n},r)=>{let i=r<o,a=r>o;return(0,Y.jsx)($,{stepNumber:r+1,title:e,isExpanded:c===r,isCompleted:i,isDisabled:a,onExpand:()=>_(r),summary:i&&n,children:t},e)}),(0,Y.jsx)(vt,{children:(0,Y.jsx)(g,{variant:`contained`,disabled:!h,onClick:()=>{h&&(a(`onboarding`,{props:{eventType:`onboarding-finished`,onboardedSdk:u.name}}),t())},children:`Finish setup`})})]})}):null},St=({isStale:e,isOpen:t,projectId:n,featureId:r,onClose:i})=>{let{setToastData:a,setToastApiError:o}=v(),{patchFeatureToggle:s}=P(),c=(0,Y.jsx)(m,{children:`Setting a flag to stale marks it for cleanup`}),l=(0,Y.jsx)(m,{children:`Setting a flag to active marks it as in active use`}),d=e?`active`:`stale`;return(0,Y.jsx)(z,{open:t,secondaryButtonText:`Cancel`,primaryButtonText:`Flip to ${d}`,title:`Set feature state to ${d}`,onClick:async t=>{t.stopPropagation();try{await s(n,r,[{op:`replace`,path:`/stale`,value:!e}]),i()}catch(e){o(y(e))}a(e?{type:`success`,text:`The flag is no longer marked as stale`}:{type:`success`,text:`The flag has been marked as stale`})},onClose:i,children:(0,Y.jsx)(u,{condition:e,show:l,elseShow:c})})};export{Qe as a,Ie as c,Pe as d,Ne as f,$e as i,Z as l,xt as n,Ye as o,je as p,rt as r,He as s,St as t,Fe as u};