unleash-server 7.5.0 → 7.5.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.
- package/dist/lib/addons/addon.d.ts +10 -2
- package/dist/lib/addons/addon.d.ts.map +1 -1
- package/dist/lib/addons/addon.js +104 -6
- package/dist/lib/addons/addon.js.map +1 -1
- package/dist/lib/addons/datadog-definition.js +1 -1
- package/dist/lib/addons/datadog-definition.js.map +1 -1
- package/dist/lib/addons/datadog.test.js +2 -0
- package/dist/lib/addons/datadog.test.js.map +1 -1
- package/dist/lib/addons/new-relic.d.ts.map +1 -1
- package/dist/lib/addons/new-relic.js +0 -1
- package/dist/lib/addons/new-relic.js.map +1 -1
- package/dist/lib/addons/new-relic.test.js +0 -1
- package/dist/lib/addons/new-relic.test.js.map +1 -1
- package/dist/lib/addons/slack.test.js +1 -2
- package/dist/lib/addons/slack.test.js.map +1 -1
- package/dist/lib/addons/teams.d.ts.map +1 -1
- package/dist/lib/addons/teams.js +0 -1
- package/dist/lib/addons/teams.js.map +1 -1
- package/dist/lib/addons/teams.test.js +0 -1
- package/dist/lib/addons/teams.test.js.map +1 -1
- package/dist/lib/addons/validate-url.d.ts +18 -0
- package/dist/lib/addons/validate-url.d.ts.map +1 -0
- package/dist/lib/addons/validate-url.js +93 -0
- package/dist/lib/addons/validate-url.js.map +1 -0
- package/dist/lib/addons/validate-url.test.d.ts +2 -0
- package/dist/lib/addons/validate-url.test.d.ts.map +1 -0
- package/dist/lib/addons/validate-url.test.js +199 -0
- package/dist/lib/addons/validate-url.test.js.map +1 -0
- package/dist/lib/create-config.d.ts.map +1 -1
- package/dist/lib/create-config.js +7 -0
- package/dist/lib/create-config.js.map +1 -1
- package/dist/lib/error/bad-data-error.d.ts.map +1 -1
- package/dist/lib/error/bad-data-error.js +10 -2
- package/dist/lib/error/bad-data-error.js.map +1 -1
- package/dist/lib/error/unleash-error.test.js +23 -0
- package/dist/lib/error/unleash-error.test.js.map +1 -1
- package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.d.ts +3 -0
- package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.d.ts.map +1 -1
- package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.js +50 -1
- package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.js.map +1 -1
- package/dist/lib/features/events/event-store.d.ts +4 -0
- package/dist/lib/features/events/event-store.d.ts.map +1 -1
- package/dist/lib/features/events/event-store.js +62 -1
- package/dist/lib/features/events/event-store.js.map +1 -1
- package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts +4 -1
- package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts.map +1 -1
- package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js +5 -1
- package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js.map +1 -1
- package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
- package/dist/lib/features/feature-toggle/feature-toggle-service.js +4 -0
- package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
- package/dist/lib/features/feature-toggle/features-read-model.d.ts +2 -1
- package/dist/lib/features/feature-toggle/features-read-model.d.ts.map +1 -1
- package/dist/lib/features/feature-toggle/features-read-model.js +10 -2
- package/dist/lib/features/feature-toggle/features-read-model.js.map +1 -1
- package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js +17 -0
- package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js.map +1 -1
- package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.d.ts +2 -0
- package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.d.ts.map +1 -0
- package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.js +44 -0
- package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.js.map +1 -0
- package/dist/lib/features/feature-toggle/types/features-read-model-type.d.ts +1 -0
- package/dist/lib/features/feature-toggle/types/features-read-model-type.d.ts.map +1 -1
- package/dist/lib/features/frontend-api/frontend-api-controller.d.ts.map +1 -1
- package/dist/lib/features/frontend-api/frontend-api-controller.js +3 -2
- package/dist/lib/features/frontend-api/frontend-api-controller.js.map +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.d.ts.map +1 -1
- package/dist/lib/features/instance-stats/instance-stats-service.js +2 -6
- package/dist/lib/features/instance-stats/instance-stats-service.js.map +1 -1
- package/dist/lib/features/metrics/instance/metrics.d.ts.map +1 -1
- package/dist/lib/features/metrics/instance/metrics.js +5 -2
- package/dist/lib/features/metrics/instance/metrics.js.map +1 -1
- package/dist/lib/features/metrics/instance/register.d.ts.map +1 -1
- package/dist/lib/features/metrics/instance/register.js +3 -1
- package/dist/lib/features/metrics/instance/register.js.map +1 -1
- package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts +4 -3
- package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts.map +1 -1
- package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.d.ts.map +1 -1
- package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js +5 -2
- package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js.map +1 -1
- package/dist/lib/features/release-plans/release-plan-milestone-strategy.d.ts +1 -0
- package/dist/lib/features/release-plans/release-plan-milestone-strategy.d.ts.map +1 -1
- package/dist/lib/features/release-plans/release-plan-store.d.ts.map +1 -1
- package/dist/lib/features/release-plans/release-plan-store.js +7 -4
- package/dist/lib/features/release-plans/release-plan-store.js.map +1 -1
- package/dist/lib/features/release-plans/release-plan-template-store.d.ts.map +1 -1
- package/dist/lib/features/release-plans/release-plan-template-store.js +2 -1
- package/dist/lib/features/release-plans/release-plan-template-store.js.map +1 -1
- package/dist/lib/metrics.d.ts.map +1 -1
- package/dist/lib/metrics.js +1 -6
- package/dist/lib/metrics.js.map +1 -1
- package/dist/lib/middleware/bearer-token-middleware.test.js +12 -10
- package/dist/lib/middleware/bearer-token-middleware.test.js.map +1 -1
- package/dist/lib/openapi/spec/export-result-schema.d.ts +96 -0
- package/dist/lib/openapi/spec/export-result-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/feature-environment-schema.d.ts +24 -0
- package/dist/lib/openapi/spec/feature-environment-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/feature-schema.d.ts +48 -0
- package/dist/lib/openapi/spec/feature-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts +48 -0
- package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/feature-search-response-schema.d.ts +48 -0
- package/dist/lib/openapi/spec/feature-search-response-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/health-overview-schema.d.ts +96 -0
- package/dist/lib/openapi/spec/health-overview-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/health-report-schema.d.ts +96 -0
- package/dist/lib/openapi/spec/health-report-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/index.d.ts +1 -0
- package/dist/lib/openapi/spec/index.d.ts.map +1 -1
- package/dist/lib/openapi/spec/index.js +1 -0
- package/dist/lib/openapi/spec/index.js.map +1 -1
- package/dist/lib/openapi/spec/profile-schema.d.ts +48 -0
- package/dist/lib/openapi/spec/profile-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/project-overview-schema.d.ts +96 -0
- package/dist/lib/openapi/spec/project-overview-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts +6 -0
- package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts +6 -0
- package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.js +6 -2
- package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.js.map +1 -1
- package/dist/lib/openapi/spec/release-plan-schema.d.ts +12 -0
- package/dist/lib/openapi/spec/release-plan-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/release-plan-template-schema.d.ts +12 -0
- package/dist/lib/openapi/spec/release-plan-template-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/release-plans-schema.d.ts +3337 -0
- package/dist/lib/openapi/spec/release-plans-schema.d.ts.map +1 -0
- package/dist/lib/openapi/spec/release-plans-schema.js +35 -0
- package/dist/lib/openapi/spec/release-plans-schema.js.map +1 -0
- package/dist/lib/openapi/spec/search-features-schema.d.ts +96 -0
- package/dist/lib/openapi/spec/search-features-schema.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/user-admin.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/user-admin.js +3 -2
- package/dist/lib/routes/admin-api/user-admin.js.map +1 -1
- package/dist/lib/routes/auth/simple-password-provider.d.ts.map +1 -1
- package/dist/lib/routes/auth/simple-password-provider.js +2 -1
- package/dist/lib/routes/auth/simple-password-provider.js.map +1 -1
- package/dist/lib/routes/util.d.ts.map +1 -1
- package/dist/lib/routes/util.js +9 -6
- package/dist/lib/routes/util.js.map +1 -1
- package/dist/lib/routes/util.test.d.ts +2 -0
- package/dist/lib/routes/util.test.d.ts.map +1 -0
- package/dist/lib/routes/util.test.js +18 -0
- package/dist/lib/routes/util.test.js.map +1 -0
- package/dist/lib/server-impl.d.ts +5 -2
- package/dist/lib/server-impl.d.ts.map +1 -1
- package/dist/lib/server-impl.js +3 -1
- package/dist/lib/server-impl.js.map +1 -1
- package/dist/lib/services/addon-service.d.ts +6 -1
- package/dist/lib/services/addon-service.d.ts.map +1 -1
- package/dist/lib/services/addon-service.js +16 -1
- package/dist/lib/services/addon-service.js.map +1 -1
- package/dist/lib/services/addon-service.test.js +10 -8
- package/dist/lib/services/addon-service.test.js.map +1 -1
- package/dist/lib/types/experimental.d.ts +1 -1
- package/dist/lib/types/experimental.d.ts.map +1 -1
- package/dist/lib/types/experimental.js +1 -2
- package/dist/lib/types/experimental.js.map +1 -1
- package/dist/lib/types/model.d.ts +3 -4
- package/dist/lib/types/model.d.ts.map +1 -1
- package/dist/lib/types/model.js.map +1 -1
- package/dist/lib/types/option.d.ts +4 -0
- package/dist/lib/types/option.d.ts.map +1 -1
- package/dist/lib/types/stores/event-store.d.ts +4 -0
- package/dist/lib/types/stores/event-store.d.ts.map +1 -1
- package/dist/lib/util/extract-user.d.ts +3 -0
- package/dist/lib/util/extract-user.d.ts.map +1 -1
- package/dist/lib/util/extract-user.js +4 -1
- package/dist/lib/util/extract-user.js.map +1 -1
- package/dist/server-dev.js +0 -1
- package/dist/server-dev.js.map +1 -1
- package/dist/test/e2e/api/admin/addon.e2e.test.js +1 -0
- package/dist/test/e2e/api/admin/addon.e2e.test.js.map +1 -1
- package/dist/test/e2e/services/addon-service.e2e.test.js +2 -0
- package/dist/test/e2e/services/addon-service.e2e.test.js.map +1 -1
- package/dist/test/e2e/stores/event-store.e2e.test.js +140 -2
- package/dist/test/e2e/stores/event-store.e2e.test.js.map +1 -1
- package/dist/test/fixtures/fake-event-store.d.ts +4 -0
- package/dist/test/fixtures/fake-event-store.d.ts.map +1 -1
- package/dist/test/fixtures/fake-event-store.js +6 -0
- package/dist/test/fixtures/fake-event-store.js.map +1 -1
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/AdvancedPlayground-CF0hkpiE.js +3 -0
- package/frontend/build/static/BackendConnections-DhZczar-.js +1 -0
- package/frontend/build/static/{CreateProject-DLXZ-0X5.js → CreateProject-DV-Ad8Sn.js} +1 -1
- package/frontend/build/static/{EnterpriseEdge-CBHzLvsx.js → EnterpriseEdge-D1To2ugP.js} +2 -2
- package/frontend/build/static/{FeatureMetricsChart-OmbUYN9n.js → FeatureMetricsChart-D8sRgx5P.js} +2 -2
- package/frontend/build/static/FeatureStaleDialog-DOkhgvaj.js +7 -0
- package/frontend/build/static/{FeatureViewLazyExport-JSvPNdBO.js → FeatureViewLazyExport-Bsw7-knb.js} +5 -5
- package/frontend/build/static/{FlagMetricsChart-D_AVQDU4.js → FlagMetricsChart-CF_kEyQa.js} +2 -2
- package/frontend/build/static/FrontendNetworkTrafficUsage-C8zJSvoc.js +1 -0
- package/frontend/build/static/GridLayoutWrapper-DpJcUbQB.js +3 -0
- package/frontend/build/static/{ImpactMetricsPage-PgSyQayh.js → ImpactMetricsPage-KLVv-tP4.js} +1 -1
- package/frontend/build/static/{LazyAdminExport-BYVn1j-Y.js → LazyAdminExport-CWQiknO-.js} +12 -12
- package/frontend/build/static/{LazyProjectExport-DkfLitTN.js → LazyProjectExport-DsMn4Yxm.js} +25 -25
- package/frontend/build/static/LifecycleChartComponent-cxR-TN3V.js +7 -0
- package/frontend/build/static/LineChartComponent-_yZEp3dd.js +1 -0
- package/frontend/build/static/{MarkCompletedDialogue-CkeYSNgH.js → MarkCompletedDialogue-DFtLyDN0.js} +1 -1
- package/frontend/build/static/{NetworkOverview-BQlqnxzn.js → NetworkOverview-DxaPXUzZ.js} +1 -1
- package/frontend/build/static/{NetworkPrometheusAPIWarning-Ba6dYYvk.js → NetworkPrometheusAPIWarning-ltyTlXFF.js} +1 -1
- package/frontend/build/static/{NetworkTraffic-p3aQqm31.js → NetworkTraffic-Dhw4yIBs.js} +1 -1
- package/frontend/build/static/{NetworkTrafficUsage-y1jnkey9.js → NetworkTrafficUsage-deKWRhIS.js} +1 -1
- package/frontend/build/static/{PercentageDonut-WlMbDfDd.js → PercentageDonut-JGNh2FVZ.js} +1 -1
- package/frontend/build/static/ReactJSONEditor-GHl7KvdS.js +3864 -0
- package/frontend/build/static/{RoleCell-BtYhy-KF.js → RoleCell-CjVCxBgl.js} +1 -1
- package/frontend/build/static/{aggregateFeatureMetrics-DqOEKfDa.js → aggregateFeatureMetrics-YEdZNNoV.js} +1 -1
- package/frontend/build/static/formatTickValue-BZb4ZIL9.js +6 -0
- package/frontend/build/static/heart-FRDdnX3J.svg +3 -0
- package/frontend/build/static/index-DMSjiFEm.js +583 -0
- package/frontend/build/static/index-DcWBU_a4.js +12 -0
- package/frontend/build/static/networkTrafficUsageHighlightPlugin-BbfAyDiQ.js +1 -0
- package/frontend/build/static/texture-signup-CpC2AFD3.png +0 -0
- package/frontend/build/static/{useApiTokens-BnZdG9it.js → useApiTokens-DBB3NvXL.js} +1 -1
- package/frontend/package.json +14 -9
- package/package.json +47 -47
- package/frontend/build/static/AdvancedPlayground-Bh4g1c_w.js +0 -3
- package/frontend/build/static/BackendConnections-BwktKdeU.js +0 -1
- package/frontend/build/static/FeatureStaleDialog-Ckz7F5lw.js +0 -7
- package/frontend/build/static/FrontendNetworkTrafficUsage-BXS05ybi.js +0 -1
- package/frontend/build/static/GridLayoutWrapper-CyXfGdie.js +0 -3
- package/frontend/build/static/LifecycleChartComponent-Clq_uGBn.js +0 -7
- package/frontend/build/static/LineChartComponent-kHzkQRMt.js +0 -1
- package/frontend/build/static/ReactJSONEditor-CD6u2VLM.js +0 -89
- package/frontend/build/static/formatTickValue-Ca6X6Ivj.js +0 -6
- package/frontend/build/static/index-Bj8wwcOa.js +0 -11
- package/frontend/build/static/index-CiWHTkEm.js +0 -580
- package/frontend/build/static/networkTrafficUsageHighlightPlugin-Y95iEJUb.js +0 -1
- package/frontend/build/static/unleash_logo_dark_no_label-DHgOj_XN.svg +0 -6
- package/frontend/build/static/unleash_logo_white_no_label-BazgWvcx.svg +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{F as _,j as i,H as z,ej as w,jS as k,ei as N,r as d,eg as P,B as W,hk as H,s as u,k as J,K as G,jT as O,jU as D,jV as K,fZ as V,ek as R,cA as B,b7 as L,b9 as T,ee as Y,el as Z,c$ as Q,b as X,bq as tt,jK as et}from"./index-DMSjiFEm.js";import{f as b,T as ot,a as p,p as y,b as g,d as at,c as rt,u as nt,e as st,g as lt,h as ct}from"./LazyAdminExport-CWQiknO-.js";import{f as it}from"./formatTickValue-BZb4ZIL9.js";var f={},ut=z;Object.defineProperty(f,"__esModule",{value:!0});var $=f.default=void 0,dt=ut(_()),pt=i,gt=(0,dt.default)((0,pt.jsx)("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp");$=f.default=gt;const M=(t,e,r=!0)=>{const o=t.getFullYear(),a=t.getMonth(),s=b(t),n=N(t);return{key:s,year:o,month:a,dayCount:n,shortLabel:t.toLocaleString("en-US",{month:"short"}),label:e||t.toLocaleString("en-US",{month:"long",year:"numeric"}),selectable:r}},ht=t=>{const e=[M(t,"Current month")],r=w(t);for(let o=1;o<12;o++){const a=k(r,o);e.push(M(a,void 0,a>=ot))}return e},C=ht(p),mt=Object.fromEntries(C.map(t=>[t.key,t])),q="15rem",S=t=>t.spacing(3),I=u("button",{shouldForwardProp:t=>t!=="selected"})(({theme:t,selected:e})=>({cursor:"pointer",border:"none",backgroundColor:e?t.palette.secondary.light:"inherit",fontSize:t.typography.body1.fontSize,padding:t.spacing(.5),borderRadius:t.shape.borderRadius,color:t.palette.text.primary,transition:"background-color 0.2s ease",":focus-visible":{outline:`2px solid ${t.palette.primary.main}`},":hover:not(:disabled)":{backgroundColor:t.palette.action.hover}})),bt=u(I)(({theme:t})=>({":disabled":{cursor:"default",color:t.palette.text.disabled}})),yt=u(I)(({theme:t})=>({width:"100%",paddingBlock:t.spacing(1),textAlign:"left",borderRadius:0,paddingInline:S(t)})),ft=u(J)(({theme:t})=>({whiteSpace:"nowrap",width:q,justifyContent:"space-between",fontWeight:"normal",color:t.palette.text.primary,borderColor:t.palette.divider,":focus-within":{borderColor:t.palette.primary.main},":hover":{borderColor:t.palette.text.disabled,backgroundColor:"inherit"},transition:"border-color 0.1s ease"})),Ct=u("article")(({theme:t})=>({width:q,paddingBlock:t.spacing(2),display:"flex",flexFlow:"column",gap:t.spacing(2)})),St=u("article")(({theme:t})=>({paddingInline:S(t)})),xt=u("hgroup")(({theme:t})=>({h3:{margin:0,fontSize:t.typography.h3.fontSize},p:{color:t.palette.text.secondary,fontSize:t.typography.body2.fontSize}})),vt=u("ul")(({theme:t})=>({listStyle:"none",padding:0,display:"grid",gridTemplateColumns:"repeat(4, 1fr)",rowGap:t.spacing(1)})),Dt=u("article")(({theme:t})=>({display:"flex",width:"100%",flexFlow:"column",gap:t.spacing(.5)})),Rt=u("p")(({theme:t})=>({paddingInline:S(t),fontSize:t.typography.body2.fontSize,margin:0,color:t.palette.text.secondary,fontWeight:"bold"})),Mt=u("ul")(({theme:t})=>({listStyle:"none",margin:0,padding:0,width:"100%",li:{width:"100%"}})),jt=u(G)(({theme:t})=>({"& .MuiPaper-root":{borderRadius:t.shape.borderRadiusLarge,border:`1px solid ${t.palette.divider}`}})),_t=({selectedPeriod:t,setPeriod:e})=>{const r=[3,6,12].map(l=>({value:l,label:`Last ${l} months`})),[o,a]=d.useState(!1),s=d.useRef(null),n=l=>{e(l),a(!1)},c=t.grouping==="daily"?t.month===P(new Date,"yyyy-MM")?"Current month":y(t.month).toLocaleDateString("en-US",{month:"long",year:"numeric"}):`Last ${t.monthsBack} months`;return i.jsxs(W,{ref:s,children:[i.jsx(ft,{endIcon:o?i.jsx($,{}):i.jsx(H,{}),variant:"outlined",disableRipple:!0,onClick:()=>a(!0),children:c}),i.jsxs(jt,{open:o,anchorEl:s.current,onClose:()=>a(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:[i.jsxs(Ct,{children:[i.jsxs(St,{children:[i.jsxs(xt,{children:[i.jsx("h3",{children:"Select month"}),i.jsx("p",{children:"Last 12 months"})]}),i.jsx(vt,{children:C.map(l=>i.jsx("li",{children:i.jsx(bt,{selected:t.grouping==="daily"&&l.key===t.month,disabled:!l.selectable,onClick:()=>{n({grouping:"daily",month:l.key})},children:l.shortLabel})},l.label))})]}),i.jsxs(Dt,{children:[i.jsx(Rt,{children:"Range"}),i.jsx(Mt,{children:r.map(l=>i.jsx("li",{children:i.jsxs(yt,{selected:t.grouping==="monthly"&&l.value===t.monthsBack,type:"button",onClick:()=>{n({grouping:"monthly",monthsBack:l.value})},children:["Last ",l.value," months"]})},l.label))})]})]})," "]})]})},h={"/api/admin":{label:"Admin",color:"#6D66D9",order:1},"/api/frontend":{label:"Frontend",color:"#A39EFF",order:2},"/api/client":{label:"Server",color:"#D8D6FF",order:3}},wt=(t,e)=>{const{newRecord:r,labels:o}=x(t);return{datasets:t.apiData.filter(s=>!0).sort((s,n)=>h[s.apiPath].order-h[n.apiPath].order).map(s=>{const n=r();for(const l of Object.values(s.dataPoints))n[l.period]=l.trafficTypes[0].count;const c=h[s.apiPath];return{label:c.label,data:Object.values(n),backgroundColor:c.color,hoverBackgroundColor:c.color}}),labels:o}},kt=t=>{const{newRecord:e,labels:r}=x(t);return{datasets:t.apiData.map(a=>{const s=e();for(const c of Object.values(a.dataPoints)){const l=c.connections;s[c.period]=l}const n={label:"Connections",color:"#6D66D9"};return{label:n.label,data:Object.values(s),backgroundColor:n.color,hoverBackgroundColor:n.color}}),labels:r}},Pt=t=>{const{newRecord:e,labels:r}=x(t);return{datasets:t.apiData.map(a=>{const s=e();for(const c of Object.values(a.dataPoints)){const l=c.requests;s[c.period]=l}const n={label:"Frontend requests",color:"#A39EFF"};return{label:n.label,data:Object.values(s),backgroundColor:n.color,hoverBackgroundColor:n.color}}),labels:r}},x=t=>{if(t.grouping==="monthly"){const e=g(t.dateRange.from),r=g(t.dateRange.to),o=Math.abs(O(r,e))+1,a={};for(let n=0;n<o;n++)a[b(D(e,n))]=0;const s=Array.from({length:o}).map((n,c)=>c===o-1?"Current month":b(D(e,c)));return{newRecord:()=>({...a}),labels:s}}else{const e=g(t.dateRange.from),r=g(t.dateRange.to),o=Math.abs(K(r,e))+1,a={};for(let n=0;n<o;n++)a[at(V(e,n))]=0;const s=Array.from({length:o}).map((n,c)=>(c+1).toString());return{newRecord:()=>({...a}),labels:s}}},[Ot,...Bt]=Object.values(h).map(t=>t.label.toLowerCase()).toReversed(),j=`${Bt.toReversed().join(", ")}, and ${Ot}`,zt=t=>t.grouping==="daily"?`A bar chart showing daily traffic usage for ${new Date(t.month).toLocaleDateString("en-US",{month:"long",year:"numeric"})}. Each date shows ${j} requests.`:`A bar chart showing monthly total traffic usage for the current month and the preceding ${t.monthsBack} months. Each month shows ${j} requests.`,v=(t,e=new Date)=>{const r=o=>P(o,"yyyy-MM-dd");if(t.grouping==="daily"){const o=y(t.month),a=r(o),s=r(R(o));return{from:a,to:s}}else{const o=r(w(k(e,t.monthsBack))),a=r(R(e));return{from:o,to:a}}},Lt=t=>{if(t.grouping==="daily")return 0;const e=Math.abs(O(new Date(t.dateRange.to),new Date(t.dateRange.from))),r=t.apiData.map(o=>o.dataPoints.filter(({period:a})=>a!==rt).reduce((a,s)=>a+s.trafficTypes[0].count,0)).reduce((o,a)=>o+a,0);return Math.round(r/e)},Tt=(t,{from:e,to:r})=>{const o=`api/admin/metrics/connection?grouping=${t}&from=${e}&to=${r}`,{data:a,error:s,mutate:n}=B(L(o),$t);return d.useMemo(()=>({refetch:()=>n(),result:a?{state:"success",data:a}:s?{state:"error",error:s}:{state:"loading"}}),[a,s,n])},$t=t=>fetch(t).then(T("Metered Connections Metrics")).then(e=>e.json()),qt=(t,{from:e,to:r})=>{const o=`api/admin/metrics/request?grouping=${t}&from=${e}&to=${r}`,{data:a,error:s,mutate:n}=B(L(o),It);return d.useMemo(()=>({refetch:()=>n(),result:a?{state:"success",data:a}:s?{state:"error",error:s}:{state:"loading"}}),[a,s,n])},It=t=>fetch(t).then(T("Consumption Requests Metrics")).then(e=>e.json()),Nt=(t,e,r)=>{const{result:o}=nt(e.grouping,v(e,p)),{instanceStatus:a}=Y(),{instancePrices:s}=Z(),n=(a==null?void 0:a.billing)==="pay-as-you-go"?s.payg.traffic:s.pro.traffic;return d.useMemo(()=>{if(o.state!=="success")return{chartData:{datasets:[],labels:[]},usageTotal:0,overageCost:0,estimatedMonthlyCost:0,requestSummaryUsage:0};const l=o.data,A=wt(l),m=st(l),F=ct(m,t,n),E=lt(l.apiData,t,p,n),U=e.grouping==="daily"?m:Lt(l);return{chartData:A,usageTotal:m,overageCost:F,estimatedMonthlyCost:E,requestSummaryUsage:U}},[JSON.stringify(o),t,JSON.stringify(e),n])},Wt=t=>{const{result:e}=Tt(t.grouping,v(t,p));return d.useMemo(()=>{if(e.state!=="success")return{chartData:{datasets:[],labels:[]}};const o=e.data;return{chartData:kt(o)}},[JSON.stringify(e),JSON.stringify(t)])},Ht=t=>{const{result:e}=qt(t.grouping,v(t,p));return d.useMemo(()=>{if(e.state!=="success")return{chartData:{datasets:[],labels:[]}};const o=e.data;return{chartData:Pt(o)}},[JSON.stringify(e),JSON.stringify(t)])},Jt=u(Q)(({theme:t})=>({display:"grid",gap:t.spacing(5)})),Gt=u("div")(({theme:t})=>({display:"flex",flexFlow:"row wrap",justifyContent:"space-between",gap:t.spacing(2,4),alignItems:"start"})),Kt=u("span")(({theme:t})=>({fontWeight:"bold"})),At=(t,e,r,o)=>({plugins:{annotation:{clip:!1,annotations:{line:{type:"line",borderDash:[5,5],yMin:r?r/30:0,yMax:r?r/30:0,borderColor:"gray",borderWidth:1,display:!!r&&!!o,label:{backgroundColor:"rgba(192, 192, 192, 0.8)",color:"black",padding:{top:10,bottom:10,left:10,right:10},content:"Average daily requests included in your plan",display:!!r}}}},legend:{position:"bottom",labels:{color:t.palette.text.primary,pointStyle:"circle",usePointStyle:!0,boxHeight:6,padding:15,boxPadding:5}},tooltip:{backgroundColor:t.palette.background.paper,titleColor:t.palette.text.primary,bodyColor:t.palette.text.primary,bodySpacing:6,padding:{top:20,bottom:20,left:30,right:30},borderColor:"rgba(0, 0, 0, 0.05)",borderWidth:3,usePointStyle:!0,caretSize:0,boxPadding:10,callbacks:{title:e}}},responsive:!0,scales:{x:{stacked:!0,ticks:{color:t.palette.text.secondary},grid:{display:!1}},y:{stacked:!0,ticks:{color:t.palette.text.secondary,maxTicksLimit:5,callback:it},grid:{drawBorder:!1}}},elements:{bar:{borderRadius:5}},interaction:{mode:"index",intersect:!1}}),Vt=t=>{const e=X(),{locationSettings:r}=tt(),[o,a]=d.useState({grouping:"daily",month:C[0].key}),s=d.useMemo(()=>At(e,n=>{if(o.grouping==="daily"){const c=mt[o.month];return new Date(c.year,c.month,Number.parseInt(n[0].label,10)).toLocaleDateString((r==null?void 0:r.locale)??"en-US",{month:"long",day:"numeric",year:"numeric"})}else{const c=y(n[0].label);return Number.isNaN(c.getTime())?"Current month to date":c.toLocaleDateString((r==null?void 0:r.locale)??"en-US",{month:"long",year:"numeric"})}},t,o.grouping==="daily"),[e,o,t]);return{chartDataSelection:o,setChartDataSelection:a,options:s}},Yt=et({bottomOverflow:34});export{Kt as B,_t as P,Jt as S,Gt as T,Nt as a,Wt as b,Ht as c,zt as g,Yt as n,Vt as u};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b7 as i,
|
|
1
|
+
import{b7 as i,cA as p,r as n,b9 as u}from"./index-DMSjiFEm.js";const k=(s={})=>{const a=i("api/admin/api-tokens"),{data:t,error:e,mutate:o}=p(a,h,s),r=n.useMemo(()=>t??[],[t]),c=n.useCallback(()=>{o().catch(console.warn)},[o]);return{tokens:r,error:e,loading:!e&&!t,refetch:c}},h=async s=>(await(await fetch(s).then(u("Api tokens"))).json()).tokens;export{k as u};
|
package/frontend/package.json
CHANGED
|
@@ -20,17 +20,20 @@
|
|
|
20
20
|
"start:sandbox:enterprise": "UNLEASH_API=https://sandbox.getunleash.io/ VITE_TEST_REDIRECT=true UNLEASH_BASE_PATH=/enterprise/ yarn run start",
|
|
21
21
|
"start:demo2": "UNLEASH_API=https://sandbox.getunleash.io/ UNLEASH_BASE_PATH=/demo2/ yarn run start",
|
|
22
22
|
"start:demo": "UNLEASH_BASE_PATH=/demo/ UNLEASH_API=https://app.unleash-hosted.com/ yarn run start",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:snapshot": "
|
|
25
|
-
"test:watch": "
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:snapshot": "yarn test -u",
|
|
25
|
+
"test:watch": "vitest watch",
|
|
26
26
|
"lint:material:icons": "./check-imports.rc",
|
|
27
27
|
"lint": "biome lint src --write --error-on-warnings",
|
|
28
28
|
"lint:check": "biome check src --error-on-warnings",
|
|
29
29
|
"fmt": "biome format src --write --error-on-warnings",
|
|
30
30
|
"fmt:check": "biome check src --error-on-warnings",
|
|
31
31
|
"ts:check": "tsc",
|
|
32
|
-
"e2e": "
|
|
33
|
-
"e2e:
|
|
32
|
+
"e2e": "yarn run cypress run --browser chrome --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all --spec \"cypress/oss/**/*.spec.ts\"",
|
|
33
|
+
"e2e:open": "yarn run cypress open --e2e --config baseUrl='http://localhost:3000' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
34
|
+
"e2e:enterprise": "yarn run cypress run --browser chrome --config baseUrl='http://localhost:4242' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
35
|
+
"e2e:enterprise:open": "yarn run cypress open --e2e --config baseUrl='http://localhost:4242' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
36
|
+
"e2e:migrations": "yarn run cypress run --spec \"cypress/oss/feature/**/*.spec.ts\" --config baseUrl=\"http://localhost:${EXPOSED_PORT:-4242}\" --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
|
34
37
|
"gen:api": "orval --config orval.config.ts",
|
|
35
38
|
"gen:api:demo": "UNLEASH_OPENAPI_URL=https://app.unleash-hosted.com/demo/docs/openapi.json yarn run gen:api",
|
|
36
39
|
"gen:api:sandbox": "UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api",
|
|
@@ -115,6 +118,7 @@
|
|
|
115
118
|
"react-router-dom": "6.16.0",
|
|
116
119
|
"react-table": "7.8.0",
|
|
117
120
|
"react-test-renderer": "18.3.1",
|
|
121
|
+
"regenerator-runtime": "0.14.1",
|
|
118
122
|
"sass": "1.85.1",
|
|
119
123
|
"semver": "7.7.2",
|
|
120
124
|
"swr": "2.3.3",
|
|
@@ -122,7 +126,7 @@
|
|
|
122
126
|
"typescript": "5.8.3",
|
|
123
127
|
"unleash-proxy-client": "^3.7.3",
|
|
124
128
|
"use-query-params": "^2.2.1",
|
|
125
|
-
"vanilla-jsoneditor": "^
|
|
129
|
+
"vanilla-jsoneditor": "^3.11.0",
|
|
126
130
|
"vite": "5.4.21",
|
|
127
131
|
"vite-plugin-env-compatible": "2.0.1",
|
|
128
132
|
"vite-plugin-svgr": "3.3.0",
|
|
@@ -131,14 +135,15 @@
|
|
|
131
135
|
"whatwg-fetch": "3.6.20"
|
|
132
136
|
},
|
|
133
137
|
"resolutions": {
|
|
134
|
-
"@codemirror/state": "6.5.
|
|
138
|
+
"@codemirror/state": "6.5.4",
|
|
135
139
|
"@xmldom/xmldom": "^0.9.0",
|
|
136
140
|
"jsonpath-plus": "10.3.0",
|
|
137
141
|
"json5": "^2.2.2",
|
|
138
142
|
"vite": "5.4.21",
|
|
139
143
|
"semver": "7.7.2",
|
|
140
144
|
"ws": "^8.18.0",
|
|
141
|
-
"@types/react": "18.3.23"
|
|
145
|
+
"@types/react": "18.3.23",
|
|
146
|
+
"nwsapi": "2.2.13"
|
|
142
147
|
},
|
|
143
148
|
"jest": {
|
|
144
149
|
"moduleNameMapper": {
|
|
@@ -159,7 +164,7 @@
|
|
|
159
164
|
"last 1 safari version"
|
|
160
165
|
]
|
|
161
166
|
},
|
|
162
|
-
"packageManager": "yarn@4.
|
|
167
|
+
"packageManager": "yarn@4.13.0",
|
|
163
168
|
"dependencies": {
|
|
164
169
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
165
170
|
"json-2-csv": "^5.5.5",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "unleash-server",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.",
|
|
5
|
-
"version": "7.5.
|
|
5
|
+
"version": "7.5.2",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"unleash",
|
|
8
8
|
"feature flag",
|
|
@@ -75,74 +75,74 @@
|
|
|
75
75
|
"@json2csv/plainjs": "^7.0.6",
|
|
76
76
|
"@slack/web-api": "^7.14.1",
|
|
77
77
|
"@wesleytodd/openapi": "^1.1.0",
|
|
78
|
-
"ajv": "^8.
|
|
78
|
+
"ajv": "^8.18.0",
|
|
79
79
|
"ajv-formats": "^3.0.1",
|
|
80
80
|
"async": "^3.2.6",
|
|
81
81
|
"bcryptjs": "^3.0.3",
|
|
82
82
|
"compression": "^1.8.1",
|
|
83
83
|
"connect-session-knex": "^5.0.0",
|
|
84
|
-
"cookie-parser": "^1.4.
|
|
84
|
+
"cookie-parser": "^1.4.7",
|
|
85
85
|
"cookie-session": "^2.1.1",
|
|
86
|
-
"cors": "^2.8.
|
|
86
|
+
"cors": "^2.8.6",
|
|
87
87
|
"date-fns": "^4.1.0",
|
|
88
88
|
"db-migrate": "0.11.14",
|
|
89
89
|
"db-migrate-pg": "1.5.2",
|
|
90
90
|
"db-migrate-shared": "1.2.0",
|
|
91
91
|
"deep-object-diff": "^1.1.9",
|
|
92
92
|
"deepmerge": "^4.3.1",
|
|
93
|
-
"errorhandler": "^1.5.
|
|
93
|
+
"errorhandler": "^1.5.2",
|
|
94
94
|
"express": "^4.22.1",
|
|
95
|
-
"express-rate-limit": "^8.
|
|
96
|
-
"express-session": "^1.
|
|
97
|
-
"fast-json-patch": "^3.1.
|
|
95
|
+
"express-rate-limit": "^8.3.0",
|
|
96
|
+
"express-session": "^1.19.0",
|
|
97
|
+
"fast-json-patch": "^3.1.1",
|
|
98
98
|
"hash-sum": "^2.0.0",
|
|
99
|
-
"helmet": "^8.
|
|
100
|
-
"http-errors": "^2.0.
|
|
99
|
+
"helmet": "^8.1.0",
|
|
100
|
+
"http-errors": "^2.0.1",
|
|
101
101
|
"hyperloglog-lite": "^1.0.2",
|
|
102
|
-
"ip-address": "^10.0
|
|
102
|
+
"ip-address": "^10.1.0",
|
|
103
103
|
"joi": "^18.0.2",
|
|
104
|
-
"js-sha256": "^0.11.
|
|
105
|
-
"js-yaml": "^4.1.
|
|
104
|
+
"js-sha256": "^0.11.1",
|
|
105
|
+
"js-yaml": "^4.1.1",
|
|
106
106
|
"json-diff": "^1.0.6",
|
|
107
107
|
"json-schema-to-ts": "3.1.1",
|
|
108
108
|
"knex": "^3.1.0",
|
|
109
|
-
"ky": "^1.14.
|
|
109
|
+
"ky": "^1.14.3",
|
|
110
110
|
"lodash.groupby": "^4.6.0",
|
|
111
111
|
"lodash.sortby": "^4.7.0",
|
|
112
|
-
"log4js": "^6.
|
|
112
|
+
"log4js": "^6.9.1",
|
|
113
113
|
"memoizee": "^0.4.17",
|
|
114
114
|
"mime": "^4.1.0",
|
|
115
115
|
"murmurhash3js": "^3.0.1",
|
|
116
116
|
"mustache": "^4.2.0",
|
|
117
|
-
"nodemailer": "^7.0.
|
|
118
|
-
"normalize-url": "^8.
|
|
117
|
+
"nodemailer": "^7.0.13",
|
|
118
|
+
"normalize-url": "^8.1.1",
|
|
119
119
|
"openapi-types": "^12.1.3",
|
|
120
120
|
"owasp-password-strength-test": "^1.3.0",
|
|
121
121
|
"parse-database-url": "^0.3.0",
|
|
122
|
-
"pg": "^8.
|
|
123
|
-
"pg-connection-string": "^2.
|
|
122
|
+
"pg": "^8.20.0",
|
|
123
|
+
"pg-connection-string": "^2.12.0",
|
|
124
124
|
"pkginfo": "^0.4.1",
|
|
125
|
-
"prom-client": "^15.
|
|
125
|
+
"prom-client": "^15.1.3",
|
|
126
126
|
"re2js": "^1.2.2",
|
|
127
127
|
"sanitize-filename": "^1.6.3",
|
|
128
|
-
"semver": "^7.7.
|
|
129
|
-
"serve-favicon": "^2.5.
|
|
130
|
-
"slug": "^11.0.
|
|
128
|
+
"semver": "^7.7.4",
|
|
129
|
+
"serve-favicon": "^2.5.1",
|
|
130
|
+
"slug": "^11.0.1",
|
|
131
131
|
"stoppable": "^1.1.0",
|
|
132
|
-
"tldts": "7.0.
|
|
132
|
+
"tldts": "7.0.24",
|
|
133
133
|
"ts-toolbelt": "^9.6.0",
|
|
134
|
-
"type-is": "^2.0.
|
|
134
|
+
"type-is": "^2.0.1",
|
|
135
135
|
"ulidx": "^2.4.1",
|
|
136
|
-
"unleash-client": "^6.
|
|
136
|
+
"unleash-client": "^6.10.1"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
139
|
"@apidevtools/swagger-parser": "12.1.0",
|
|
140
|
-
"@biomejs/biome": "^2.4.
|
|
141
|
-
"@cyclonedx/yarn-plugin-cyclonedx": "^3.
|
|
142
|
-
"@faker-js/faker": "^10.
|
|
140
|
+
"@biomejs/biome": "^2.4.6",
|
|
141
|
+
"@cyclonedx/yarn-plugin-cyclonedx": "^3.3.0",
|
|
142
|
+
"@faker-js/faker": "^10.3.0",
|
|
143
143
|
"@fast-check/vitest": "^0.2.4",
|
|
144
144
|
"@types/cors": "2.8.19",
|
|
145
|
-
"@types/express": "4.17.
|
|
145
|
+
"@types/express": "4.17.25",
|
|
146
146
|
"@types/express-session": "1.18.2",
|
|
147
147
|
"@types/hash-sum": "^1.0.2",
|
|
148
148
|
"@types/js-yaml": "4.0.9",
|
|
@@ -150,35 +150,35 @@
|
|
|
150
150
|
"@types/lodash.isequal": "^4.5.8",
|
|
151
151
|
"@types/memoizee": "0.4.12",
|
|
152
152
|
"@types/murmurhash3js": "^3.0.7",
|
|
153
|
-
"@types/mustache": "^4.2.
|
|
154
|
-
"@types/node": "22.15
|
|
153
|
+
"@types/mustache": "^4.2.6",
|
|
154
|
+
"@types/node": "22.19.15",
|
|
155
155
|
"@types/nodemailer": "^7.0.11",
|
|
156
156
|
"@types/owasp-password-strength-test": "1.3.2",
|
|
157
|
-
"@types/pg": "8.
|
|
157
|
+
"@types/pg": "8.18.0",
|
|
158
158
|
"@types/semver": "7.7.1",
|
|
159
|
-
"@types/slug": "^5.0.
|
|
159
|
+
"@types/slug": "^5.0.9",
|
|
160
160
|
"@types/stoppable": "1.1.3",
|
|
161
161
|
"@types/supertest": "6.0.3",
|
|
162
162
|
"@types/type-is": "1.6.7",
|
|
163
|
-
"@vitest/coverage-v8": "^4.0.
|
|
164
|
-
"@vitest/ui": "^4.0.
|
|
165
|
-
"concurrently": "^9.
|
|
163
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
164
|
+
"@vitest/ui": "^4.0.18",
|
|
165
|
+
"concurrently": "^9.2.1",
|
|
166
166
|
"del-cli": "6.0.0",
|
|
167
|
-
"fast-check": "4.
|
|
167
|
+
"fast-check": "4.5.3",
|
|
168
168
|
"fetch-mock": "^12.6.0",
|
|
169
169
|
"husky": "^9.1.7",
|
|
170
|
-
"lint-staged": "16.2
|
|
171
|
-
"nock": "^14.0.
|
|
170
|
+
"lint-staged": "16.3.2",
|
|
171
|
+
"nock": "^14.0.11",
|
|
172
172
|
"openapi-enforcer": "1.23.0",
|
|
173
173
|
"proxyquire": "2.1.3",
|
|
174
174
|
"source-map-support": "0.5.21",
|
|
175
|
-
"superagent": "10.
|
|
176
|
-
"supertest": "7.
|
|
175
|
+
"superagent": "10.3.0",
|
|
176
|
+
"supertest": "7.2.2",
|
|
177
177
|
"ts-node": "10.9.2",
|
|
178
|
-
"tsc-watch": "7.
|
|
178
|
+
"tsc-watch": "7.2.0",
|
|
179
179
|
"typescript": "5.9.3",
|
|
180
|
-
"vite-node": "^5.
|
|
181
|
-
"vitest": "^4.0.
|
|
180
|
+
"vite-node": "^5.3.0",
|
|
181
|
+
"vitest": "^4.0.18",
|
|
182
182
|
"wait-on": "^9.0.4"
|
|
183
183
|
},
|
|
184
184
|
"resolutions": {
|
|
@@ -191,12 +191,12 @@
|
|
|
191
191
|
"ssh2": "^1.4.0",
|
|
192
192
|
"json-schema": "^0.4.0",
|
|
193
193
|
"ip": "^2.0.1",
|
|
194
|
-
"tar": "7.5.8",
|
|
195
194
|
"semver": "^7.7.3",
|
|
196
195
|
"tough-cookie": "4.1.4",
|
|
197
196
|
"brace-expansion": "2.0.2",
|
|
198
197
|
"@wesleytodd/openapi/path-to-regexp": "6.3.0",
|
|
199
198
|
"router/path-to-regexp": "1.9.0",
|
|
199
|
+
"@types/express-session/@types/express": "4.17.25",
|
|
200
200
|
"prompt": "link:./node_modules/.cache/null"
|
|
201
201
|
},
|
|
202
202
|
"lint-staged": {
|
|
@@ -210,5 +210,5 @@
|
|
|
210
210
|
"yarn biome format --write --no-errors-on-unmatched"
|
|
211
211
|
]
|
|
212
212
|
},
|
|
213
|
-
"packageManager": "yarn@4.
|
|
213
|
+
"packageManager": "yarn@4.13.0"
|
|
214
214
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{u as Tt,g as It,r as p,_ as Pt,j as t,a as xe,s as E,U as Rt,b as A,B as w,C as N,d as Ot,c as Ft,e as Bt,f as _e,h as Lt,i as Z,T as D,G as Nt,k as se,p as Ee,l as Te,m as te,A as Ge,n as At,o as $t,q as Dt,t as Ht,v as Wt,w as zt,I as Mt,x as Ut,y as Ie,P as _t,z as Pe,D as _,L as Gt,E as Vt,F as Ve,H as qe,J as X,K as qt,M as Ke,N as oe,O as Je,Q as Kt,R as Q,S as pe,V as Jt,W as Yt,X as Zt,Y as Ye,Z as re,$ as Qt,a0 as Xt,a1 as en,a2 as tn,a3 as nn,a4 as rn,a5 as an,a6 as sn,a7 as on,a8 as ln,a9 as cn,aa as B,ab as ie,ac as dn,ad as un,ae as hn,af as gn,ag as fn,ah as pn,ai as Re,aj as Ze,ak as be,al as ye,am as Qe,an as ve,ao as Xe,ap as et,aq as tt,ar as nt,as as mn,at as Oe,au as xn,av as bn,aw as de,ax as yn,ay as vn,az as jn,aA as Cn,aB as Sn,aC as kn,aD as wn}from"./index-CiWHTkEm.js";import{c as En,d as Tn,s as In,h as Pn,f as Rn,a as On,l as Fn,b as Bn,e as Ln,g as Nn,i as An,j as $n,k as Dn,m as Hn,E as ae,n as Wn,o as je,p as zn,q as Mn,r as Un,t as _n,u as Gn,v as Vn,w as qn,x as Kn,y as Jn,z as rt,A as U,H as at,B as o,C as Yn,D as Zn,S as Qn,F as Xn,L as er,G as tr,I as nr,J as rr,K as Fe,M as ar,N as sr}from"./index-Bj8wwcOa.js";import{u as or}from"./useApiTokens-BnZdG9it.js";const ir=()=>{const{makeRequest:e,createRequest:n,errors:r,loading:a}=Tt({propagateErrors:!0}),s="api/admin/playground";return{evaluateAdvancedPlayground:async i=>{const h=`${s}/advanced`,m=n(h,{method:"POST",body:JSON.stringify(i)});return(await e(m.caller,m.id)).json()},evaluateChangeRequestPlayground:async(i,h)=>{const m=`${s}/change-request/${i}`,l=n(m,{method:"POST",body:JSON.stringify(h)});return(await e(l.caller,l.id)).json()},errors:r,loading:a}};var Ce={exports:{}};function st(e,n=100,r={}){if(typeof e!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(n<0)throw new RangeError("`wait` must not be negative.");const{immediate:a}=typeof r=="boolean"?{immediate:r}:r;let s,c,d,i,h;function m(){const f=s,x=c;return s=void 0,c=void 0,h=e.apply(f,x),h}function l(){const f=Date.now()-i;f<n&&f>=0?d=setTimeout(l,n-f):(d=void 0,a||(h=m()))}const g=function(...f){if(s&&this!==s&&Object.getPrototypeOf(this)===Object.getPrototypeOf(s))throw new Error("Debounced method called with different contexts of the same prototype.");s=this,c=f,i=Date.now();const x=a&&!d;return d||(d=setTimeout(l,n)),x&&(h=m()),h};return Object.defineProperty(g,"isPending",{get(){return d!==void 0}}),g.clear=()=>{d&&(clearTimeout(d),d=void 0)},g.flush=()=>{d&&g.trigger()},g.trigger=()=>{h=m(),g.clear()},g}Ce.exports.debounce=st;Ce.exports=st;var lr=Ce.exports;const cr=It(lr);var Be=function(n){n===void 0&&(n={});var{crosshairCursor:r=!1}=n,a=[];n.closeBracketsKeymap!==!1&&(a=a.concat(En)),n.defaultKeymap!==!1&&(a=a.concat(Tn)),n.searchKeymap!==!1&&(a=a.concat(In)),n.historyKeymap!==!1&&(a=a.concat(Pn)),n.foldKeymap!==!1&&(a=a.concat(Rn)),n.completionKeymap!==!1&&(a=a.concat(On)),n.lintKeymap!==!1&&(a=a.concat(Fn));var s=[];return n.lineNumbers!==!1&&s.push(Bn()),n.highlightActiveLineGutter!==!1&&s.push(Ln()),n.highlightSpecialChars!==!1&&s.push(Nn()),n.history!==!1&&s.push(An()),n.foldGutter!==!1&&s.push($n()),n.drawSelection!==!1&&s.push(Dn()),n.dropCursor!==!1&&s.push(Hn()),n.allowMultipleSelections!==!1&&s.push(ae.allowMultipleSelections.of(!0)),n.indentOnInput!==!1&&s.push(Wn()),n.syntaxHighlighting!==!1&&s.push(je(zn,{fallback:!0})),n.bracketMatching!==!1&&s.push(Mn()),n.closeBrackets!==!1&&s.push(Un()),n.autocompletion!==!1&&s.push(_n()),n.rectangularSelection!==!1&&s.push(Gn()),r!==!1&&s.push(Vn()),n.highlightActiveLine!==!1&&s.push(qn()),n.highlightSelectionMatches!==!1&&s.push(Kn()),n.tabSize&&typeof n.tabSize=="number"&&s.push(Jn.of(" ".repeat(n.tabSize))),s.concat([rt.of(a.flat())]).filter(Boolean)};const dr="#e5c07b",Le="#e06c75",ur="#56b6c2",hr="#ffffff",ne="#abb2bf",me="#7d8799",gr="#61afef",fr="#98c379",Ne="#d19a66",pr="#c678dd",mr="#21252b",Ae="#2c313a",$e="#282c34",ue="#353a42",xr="#3E4451",De="#528bff",br=U.theme({"&":{color:ne,backgroundColor:$e},".cm-content":{caretColor:De},".cm-cursor, .cm-dropCursor":{borderLeftColor:De},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:xr},".cm-panels":{backgroundColor:mr,color:ne},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:$e,color:me,border:"none"},".cm-activeLineGutter":{backgroundColor:Ae},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:ue},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ue,borderBottomColor:ue},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ae,color:ne}}},{dark:!0}),yr=at.define([{tag:o.keyword,color:pr},{tag:[o.name,o.deleted,o.character,o.propertyName,o.macroName],color:Le},{tag:[o.function(o.variableName),o.labelName],color:gr},{tag:[o.color,o.constant(o.name),o.standard(o.name)],color:Ne},{tag:[o.definition(o.name),o.separator],color:ne},{tag:[o.typeName,o.className,o.number,o.changed,o.annotation,o.modifier,o.self,o.namespace],color:dr},{tag:[o.operator,o.operatorKeyword,o.url,o.escape,o.regexp,o.link,o.special(o.string)],color:ur},{tag:[o.meta,o.comment],color:me},{tag:o.strong,fontWeight:"bold"},{tag:o.emphasis,fontStyle:"italic"},{tag:o.strikethrough,textDecoration:"line-through"},{tag:o.link,color:me,textDecoration:"underline"},{tag:o.heading,fontWeight:"bold",color:Le},{tag:[o.atom,o.bool,o.special(o.variableName)],color:Ne},{tag:[o.processingInstruction,o.string,o.inserted],color:fr},{tag:o.invalid,color:hr}]),vr=[br,je(yr)];var jr=U.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Cr=function(n){n===void 0&&(n={});var{indentWithTab:r=!0,editable:a=!0,readOnly:s=!1,theme:c="light",placeholder:d="",basicSetup:i=!0}=n,h=[];switch(r&&h.unshift(rt.of([Yn])),i&&(typeof i=="boolean"?h.unshift(Be()):h.unshift(Be(i))),d&&h.unshift(Zn(d)),c){case"light":h.push(jr);break;case"dark":h.push(vr);break;case"none":break;default:h.push(c);break}return a===!1&&h.push(U.editable.of(!1)),s&&h.push(ae.readOnly.of(!0)),[...h]},Sr=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(n=>e.state.sliceDoc(n.from,n.to)),selectedText:e.state.selection.ranges.some(n=>!n.empty)}),He=Xn.define(),kr=[];function wr(e){var{value:n,selection:r,onChange:a,onStatistics:s,onCreateEditor:c,onUpdate:d,extensions:i=kr,autoFocus:h,theme:m="light",height:l=null,minHeight:g=null,maxHeight:f=null,width:x=null,minWidth:k=null,maxWidth:T=null,placeholder:y="",editable:R=!0,readOnly:I=!1,indentWithTab:L=!0,basicSetup:P=!0,root:b,initialState:j}=e,[u,v]=p.useState(),[S,O]=p.useState(),[$,z]=p.useState(),J=U.theme({"&":{height:l,minHeight:g,maxHeight:f,width:x,minWidth:k,maxWidth:T},"& .cm-scroller":{height:"100% !important"}}),V=U.updateListener.of(F=>{if(F.docChanged&&typeof a=="function"&&!F.transactions.some(le=>le.annotation(He))){var G=F.state.doc,q=G.toString();a(q,F)}s&&s(Sr(F))}),Y=Cr({theme:m,editable:R,readOnly:I,placeholder:y,indentWithTab:L,basicSetup:P}),H=[V,J,...Y];return d&&typeof d=="function"&&H.push(U.updateListener.of(d)),H=H.concat(i),p.useLayoutEffect(()=>{if(u&&!$){var F={doc:n,selection:r,extensions:H},G=j?ae.fromJSON(j.json,F,j.fields):ae.create(F);if(z(G),!S){var q=new U({state:G,parent:u,root:b});O(q),c&&c(q,G)}}return()=>{S&&(z(void 0),O(void 0))}},[u,$]),p.useEffect(()=>{e.container&&v(e.container)},[e.container]),p.useEffect(()=>()=>{S&&(S.destroy(),O(void 0))},[S]),p.useEffect(()=>{h&&S&&S.focus()},[h,S]),p.useEffect(()=>{S&&S.dispatch({effects:Qn.reconfigure.of(H)})},[m,i,l,g,f,x,k,T,y,R,I,L,P,a,d]),p.useEffect(()=>{if(n!==void 0){var F=S?S.state.doc.toString():"";S&&n!==F&&S.dispatch({changes:{from:0,to:F.length,insert:n||""},annotations:[He.of(!0)]})}},[n,S]),{state:$,setState:z,view:S,setView:O,container:u,setContainer:v}}var Er=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],ot=p.forwardRef((e,n)=>{var{className:r,value:a="",selection:s,extensions:c=[],onChange:d,onStatistics:i,onCreateEditor:h,onUpdate:m,autoFocus:l,theme:g="light",height:f,minHeight:x,maxHeight:k,width:T,minWidth:y,maxWidth:R,basicSetup:I,placeholder:L,indentWithTab:P,editable:b,readOnly:j,root:u,initialState:v}=e,S=Pt(e,Er),O=p.useRef(null),{state:$,view:z,container:J,setContainer:V}=wr({root:u,value:a,autoFocus:l,theme:g,height:f,minHeight:x,maxHeight:k,width:T,minWidth:y,maxWidth:R,basicSetup:I,placeholder:L,indentWithTab:P,editable:b,readOnly:j,selection:s,onChange:d,onStatistics:i,onCreateEditor:h,onUpdate:m,extensions:c,initialState:v});p.useImperativeHandle(n,()=>({editor:O.current,state:$,view:z}),[O,J,$,z]);var Y=p.useCallback(F=>{O.current=F,V(F)},[V]);if(typeof a!="string")throw new Error("value must be typeof string but got "+typeof a);var H=typeof g=="string"?"cm-theme-"+g:"cm-theme";return t.jsx("div",xe({ref:Y,className:""+H+(r?" "+r:"")},S))});ot.displayName="CodeMirror";const Tr=tr.define({name:"json",parser:nr.configure({props:[rr.add({Object:Fe({except:/^\s*\}/}),Array:Fe({except:/^\s*\]/})}),ar.add({"Object Array":sr})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Ir(){return new er(Tr)}var it=e=>{var{theme:n,settings:r={},styles:a=[]}=e,s={".cm-gutters":{}},c={};r.background&&(c.backgroundColor=r.background),r.backgroundImage&&(c.backgroundImage=r.backgroundImage),r.foreground&&(c.color=r.foreground),r.fontSize&&(c.fontSize=r.fontSize),(r.background||r.foreground)&&(s["&"]=c),r.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:r.fontFamily}),r.gutterBackground&&(s[".cm-gutters"].backgroundColor=r.gutterBackground),r.gutterForeground&&(s[".cm-gutters"].color=r.gutterForeground),r.gutterBorder&&(s[".cm-gutters"].borderRightColor=r.gutterBorder),r.caret&&(s[".cm-content"]={caretColor:r.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:r.caret});var d={};r.gutterActiveForeground&&(d.color=r.gutterActiveForeground),r.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:r.lineHighlight},d.backgroundColor=r.lineHighlight),s[".cm-activeLineGutter"]=d,r.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:r.selection+" !important"}),r.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:r.selectionMatch});var i=U.theme(s,{dark:n==="dark"}),h=at.define(a),m=[i,je(h)];return m},Pr={background:"#faf8f5",foreground:"#b29762",caret:"#93abdc",selection:"#e3dcce",selectionMatch:"#e3dcce",gutterBackground:"#faf8f5",gutterForeground:"#cdc4b1",gutterBorder:"transparent",lineHighlight:"#ddceb154"},Rr=[{tag:[o.comment,o.bracket],color:"#b6ad9a"},{tag:[o.atom,o.number,o.keyword,o.link,o.attributeName,o.quote],color:"#063289"},{tag:[o.emphasis,o.heading,o.tagName,o.propertyName,o.variableName],color:"#2d2006"},{tag:[o.typeName,o.url,o.string],color:"#896724"},{tag:[o.operator,o.string],color:"#1659df"},{tag:[o.propertyName],color:"#b29762"},{tag:[o.unit,o.punctuation],color:"#063289"}],Or=e=>{var{theme:n="light",settings:r={},styles:a=[]}={};return it({theme:n,settings:xe({},Pr,r),styles:[...Rr,...a]})},Fr=Or(),Br={background:"#2a2734",foreground:"#6c6783",caret:"#ffad5c",selection:"#91ff6c26",selectionMatch:"#91ff6c26",gutterBackground:"#2a2734",gutterForeground:"#545167",lineHighlight:"#36334280"},Lr=[{tag:[o.comment,o.bracket],color:"#6c6783"},{tag:[o.atom,o.number,o.keyword,o.link,o.attributeName,o.quote],color:"#ffcc99"},{tag:[o.emphasis,o.heading,o.tagName,o.propertyName,o.className,o.variableName],color:"#eeebff"},{tag:[o.typeName,o.url],color:"#7a63ee"},{tag:o.operator,color:"#ffad5c"},{tag:o.string,color:"#ffb870"},{tag:[o.propertyName],color:"#9a86fd"},{tag:[o.unit,o.punctuation],color:"#e09142"}],Nr=e=>{var{theme:n="dark",settings:r={},styles:a=[]}={};return it({theme:n,settings:xe({},Br,r),styles:[...Lr,...a]})},Ar=Nr();const $r=E("aside")(({theme:e})=>({height:"50px",backgroundColor:e.palette.background.paper,borderTopRightRadius:e.shape.borderRadiusMedium,borderTopLeftRadius:e.shape.borderRadiusMedium,padding:e.spacing(1,2),color:e.palette.text.primary,display:"flex",justifyContent:"space-between",alignItems:"center",border:`1px solid ${e.palette.divider}`})),lt=E("div")(({theme:e,style:n})=>({width:e.spacing(3),height:e.spacing(3),display:"flex",alignItems:"center",color:e.palette.background.paper,justifyContent:"center",transition:"background-color 0.5s ease-in-out",borderRadius:"50%",...n})),Dr=E("div")(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.error.dark,marginRight:e.spacing(1)})),Hr=()=>{const e=A();return t.jsx(lt,{style:{backgroundColor:e.palette.success.main},children:t.jsx(Ot,{sx:n=>({width:n.spacing(2),height:n.spacing(2)})})})},Wr=()=>{const e=A();return t.jsx(lt,{style:{backgroundColor:e.palette.error.main},children:t.jsx(Ft,{})})},zr=({context:e,setContext:n,error:r})=>{const{themeMode:a}=p.useContext(Rt),s=A(),c=p.useCallback(i=>{n(i)},[n]),d=`calc(6 * ${s.typography.body1.fontSize} * ${s.typography.body1.lineHeight}) + 8px`;return t.jsxs(w,{sx:{width:"100%"},children:[t.jsxs($r,{children:["JSON",t.jsx(N,{condition:!!r,show:t.jsxs(w,{sx:i=>({display:"flex",alignItems:"center"}),children:[t.jsx(Dr,{children:r}),t.jsx(Wr,{})]}),elseShow:t.jsx(Hr,{})})]}),t.jsx(ot,{value:e,minHeight:d,theme:a==="dark"?Ar:Fr,extensions:[Ir()],onChange:c,style:{border:`1px solid ${s.palette.divider}`,borderTop:"none"},placeholder:JSON.stringify({currentTime:"2022-07-04T14:13:03.929Z",appName:"playground",userId:"test",remoteAddress:"127.0.0.1"},null,2)})]})};function ct(e){return Array.isArray(e)?e:[e]}const Mr=e=>!e||e.length===0||e.length===1&&e[0]==="*"?"*":ct(e),Ur=e=>ct(e),_r=e=>{const n=Gr(e);return n.length>0?n[0]:""},Gr=e=>e.filter(({enabled:n})=>!!n).sort((n,r)=>n.sortOrder-r.sortOrder).map(({name:n})=>n),Vr=(e,n)=>"100%",qr=e=>typeof e=="string"?!0:Array.isArray(e)?e.every(n=>typeof n=="string"):!1,Kr=e=>{const n=new Set(["appName","environment","userId","sessionId","remoteAddress","currentTime","properties"]),r={...e};let a=!1;for(const s in e)n.has(s)||(r.properties||(r.properties={}),r.properties[s]=e[s],delete r[s],a=!0);return!a&&!e.properties&&delete r.properties,r},Jr=e=>{const[n]=e.split("."),[r,a]=n.split(":");if(!r||!a)throw new Error("Invalid token format");if(a==="*")throw new Error("Admin tokens are not supported in the playground")},Yr=e=>{const[n]=e.split(".");return n.split(":")},Zr=e=>Bt({mode:"all"},e),Qr=(e,{groupOptions:n})=>{const r=c=>c.toSorted((d,i)=>d.sortOrder-i.sortOrder).map(d=>({key:d.name,label:d.name}));if(!n)return r(e);const a=e.reduce(({project:c,global:d},i)=>(i.project?c.push(i):d.push(i),{project:c,global:d}),{project:[],global:[]}),s=[];return a.project.length&&s.push({groupHeader:"Project context fields",options:r(a.project)}),a.global.length&&s.push({groupHeader:"Global context fields",options:r(a.global)}),s},Xr=({context:e,setContext:n})=>{const r=A(),{setToastData:a}=_e(),{context:s}=Zr(),c=Lt("projectContextFields"),d=Qr(s,{groupOptions:c}),[i,h]=p.useState(),[m,l]=p.useState(!1),[g,f]=p.useState(""),[x,k]=p.useState(""),T=p.useMemo(()=>cr(b=>{var j;if(!b)return h(void 0);try{const u=JSON.parse(b);l(u[g]!==void 0||((j=u==null?void 0:u.properties)==null?void 0:j[g])!==void 0)}catch(u){return h(Z(u))}return h(void 0)},250),[h,g,l]);p.useEffect(()=>{T(e)},[T,e]);const y=()=>{try{const b=JSON.parse(e||"{}");n(JSON.stringify(Kr({...b,[g]:x}),null,2));const j=s.find(u=>u.name===g);if(j!=null&&j.legalValues&&j.legalValues.length>0||g==="currentTime")return k("")}catch(b){a({type:"error",text:`Error parsing context: ${Z(b)}`})}},R=(b,j)=>{if(qr(j)){if(Array.isArray(j)){const u=(j||[]).length>1?j.join(","):j[0];return k(u)}k(j)}},I=()=>{if(!x||x==="")return[];const b=s.find(u=>u.name===g),j=((b==null?void 0:b.legalValues)||[]).length>1;return x.includes(",")&&j?x.split(","):[x]},L=()=>{if(g==="currentTime"){const j=Ee(x),v=j?Te(j.toISOString()):Te(new Date().toISOString());return t.jsx(te,{id:"date",label:"Date",size:"small",type:"datetime-local",value:v,sx:{width:200,maxWidth:"100%"},onChange:S=>{const O=Ee(S.target.value),$=O==null?void 0:O.toISOString();$&&k($)},InputLabelProps:{shrink:!0},required:!0})}const b=s.find(j=>j.name===g);if(b!=null&&b.legalValues&&b.legalValues.length>0){const j=b.legalValues.map(({value:u})=>u);return t.jsx(Ge,{disablePortal:!0,limitTags:3,id:"context-legal-values",multiple:!0,options:j,disableCloseOnSelect:!0,size:"small",value:I(),onChange:R,getOptionLabel:u=>u,renderOption:(u,v,{selected:S})=>t.jsxs("li",{...u,children:[t.jsx(At,{icon:t.jsx($t,{fontSize:"small"}),checkedIcon:t.jsx(Dt,{fontSize:"small"}),sx:O=>({marginRight:O.spacing(.5)}),checked:S}),v]}),sx:{width:370,maxWidth:"100%"},renderInput:u=>t.jsx(te,{...u,label:"Value"})})}return t.jsx(te,{label:"Value",id:"context-value",sx:{width:370,maxWidth:"100%"},placeholder:"value1,value2,value3",size:"small",value:x,onChange:j=>k(j.target.value||"")})},P=b=>{if(f(b||""),b==="currentTime")return k(new Date().toISOString());k("")};return t.jsxs(w,{children:[t.jsx(w,{sx:{display:"flex",alignItems:"center",mb:2},children:t.jsx(D,{variant:"body2",color:r.palette.text.primary,sx:{ml:1},children:"Unleash context"})}),t.jsxs(w,{sx:{display:"flex",gap:2,flexWrap:"wrap",mb:2},children:[t.jsx(Nt,{label:"Context field",labelId:"context-field-label",id:"context-field",value:g,onChange:P,variant:"outlined",size:"small",sx:{width:200,maxWidth:"100%"},options:d}),L(),t.jsx(se,{variant:"outlined",disabled:!g||!!i,onClick:y,sx:{width:"95px",maxHeight:"40px"},children:`${m?"Replace":"Add"} `})]}),t.jsx(zr,{context:e,setContext:n,error:i})]})},ea=({environments:e,setEnvironments:n,availableEnvironments:r,disabled:a})=>{const s=[...r.map(i=>({label:i,id:i}))],c=s.filter(({id:i})=>e.includes(i)),d=(i,h,m)=>{const l=h;return m==="clear"||l===null?n([]):Array.isArray(l)?l.length===0?n([]):n(l.map(({id:g})=>g)):n([l.id])};return t.jsx(Ge,{disablePortal:!0,limitTags:3,id:"environment",multiple:!0,options:s,sx:{flex:1},renderInput:i=>t.jsx(te,{...i,label:"Environments"}),renderOption:Ht,renderTags:(i,h)=>i.map((m,l)=>{const{key:g,...f}=h({index:l});return t.jsx(Wt,{size:"small",...f,label:m.label},g)}),getOptionLabel:({label:i})=>i,disableCloseOnSelect:!1,size:"small",value:c,onChange:d,disabled:a,"data-testid":"PLAYGROUND_ENVIRONMENT_SELECT"})},he={label:"ALL",id:"*"},We=E(zt)({fontSize:"1.25rem"}),dt=E(Mt)(()=>({width:"100%"})),ta=E(w)(({theme:e})=>({display:"grid",columnGap:e.spacing(2),rowGap:e.spacing(2),gridTemplateColumns:"1fr",[e.breakpoints.up("md")]:{gridTemplateColumns:"1fr 1fr"}})),na=E(dt)(({theme:e})=>({"& label":{WebkitTextFillColor:e.palette.text.secondary},"& input.Mui-disabled":{WebkitTextFillColor:e.palette.text.secondary}})),ra=({environments:e,projects:n,token:r,setProjects:a,setEnvironments:s,setToken:c,availableEnvironments:d,changeRequest:i,onClearChangeRequest:h})=>{const m=A(),{tokens:l}=or(),[g,f]=p.useState(),{projects:x}=Ut(),k=[he,...x.map(({name:u,id:v})=>({label:u,id:v}))],T=async u=>{const v=u.target.value;if(c==null||c(v),v===""){b();return}try{Jr(v),f(void 0),y(v)}catch(S){f(S.message)}},y=u=>{const[v,S]=Yr(u);switch(s([S]),v){case"[]":I(u);break;case"*":L();break;default:P(v)}},R=u=>{!u.projects||u.projects==="*"?a([he.id]):typeof u.projects=="string"?a([u.projects]):Array.isArray(u.projects)&&a(u.projects)},I=u=>{const v=l.find(({secret:S})=>S===u);v?R(v):f("Invalid token. Ensure you use a valid token from this Unleash instance.")},L=()=>{a([he.id])},P=u=>{k.map(v=>v.id).includes(u)?a([u]):f(`Invalid token. Project ${u} does not exist.`)},b=()=>{f(void 0)},j=()=>{c==null||c(""),b()};return t.jsxs(w,{sx:{pb:2},children:[t.jsx(w,{sx:{display:"flex",alignItems:"center",mb:2},children:t.jsx(D,{variant:"body2",color:m.palette.text.primary,sx:{ml:1},children:"Access configuration"})}),t.jsxs(ta,{children:[t.jsx(w,{children:t.jsx(Ie,{arrow:!0,title:r?"Environment is automatically selected because you are using a token":"Select environments to use in the playground",children:t.jsx(w,{children:t.jsx(ea,{environments:e,setEnvironments:s,availableEnvironments:d,disabled:!!(r||i)})})})}),t.jsx(w,{children:t.jsx(Ie,{arrow:!0,title:r?"Project is automatically selected because you are using a token":"Select projects to use in the playground",children:t.jsx(_t,{selectedProjects:n,onChange:a,dataTestId:"PLAYGROUND_PROJECT_SELECT",disabled:!!(r||i),limitTags:3})})}),t.jsx(w,{children:t.jsx(dt,{label:"API token",value:r||(i?" ":""),onChange:T,type:"text",error:!!g,errorText:g,placeholder:"Enter your API token","data-testid":"PLAYGROUND_TOKEN_INPUT",InputProps:{endAdornment:r?t.jsx(Pe,{position:"end","data-testid":"TOKEN_INPUT_CLEAR_BTN",children:t.jsx(_,{"aria-label":"clear API token",onClick:j,edge:"end",children:t.jsx(We,{})})}):null},disabled:!!i})}),t.jsx(N,{condition:!!i,show:t.jsxs(w,{sx:{display:"flex",gap:2},children:[t.jsx(w,{sx:{flex:1},children:t.jsx(na,{label:"Change request",value:i?`Change request #${i}`:"",onChange:()=>{},type:"text",disabled:!0,InputProps:{endAdornment:t.jsx(Pe,{position:"end",children:t.jsx(_,{"aria-label":"clear Change request results",onClick:h,edge:"end",children:t.jsx(We,{})})})}})}),t.jsx(se,{variant:"outlined",size:"small",to:`/projects/${n[0]}/change-requests/${i}`,component:Gt,children:"View change request"})]})})]})]})},aa=({availableEnvironments:e,environments:n,onSubmit:r,projects:a,token:s,setToken:c,setProjects:d,setEnvironments:i,context:h,setContext:m,changeRequest:l,onClearChangeRequest:g})=>t.jsxs(w,{component:"form",onSubmit:r,sx:{display:"flex",flexDirection:"column"},children:[t.jsx(ra,{environments:Array.isArray(n)?n:[n],projects:a,token:s,setToken:c,setEnvironments:i,setProjects:d,availableEnvironments:e.map(({name:f})=>f),changeRequest:l,onClearChangeRequest:g}),t.jsx(Xr,{context:h,setContext:m}),t.jsx(w,{sx:{mt:2,display:"flex",alignItems:"center",justifyContent:"space-between"},children:t.jsx(se,{variant:"contained",size:"large",type:"submit",sx:{marginLeft:"auto"},children:"Try configuration"})})]}),sa=E("div")(({style:e,theme:n})=>({width:"25px",height:"25px",borderRadius:"50%",color:n.palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",...e})),oa=({style:e,children:n,type:r})=>{const a=A(),s={backgroundColor:a.palette.background.alternative,color:a.palette.common.white};return r==="secondary"&&(s.backgroundColor=a.palette.background.paper,s.color=a.palette.text.secondary),t.jsx(sa,{style:{...s,...e},children:n})},ge=({headerText:e,bodyText:n,sectionNumber:r})=>t.jsx(w,{sx:{display:"flex",alignItems:"flex-start",mt:2,flexDirection:"column"},children:t.jsxs(w,{sx:{display:"flex"},children:[t.jsx(w,{children:t.jsx(oa,{children:r})}),t.jsxs(w,{sx:{ml:2,display:"flex",flexDirection:"column"},children:[t.jsx(D,{variant:"body1",sx:{fontWeight:"bold"},children:e}),t.jsx(N,{condition:!!n,show:t.jsx(D,{variant:"body1",sx:{mt:1},children:n})})]})]})}),ut=()=>t.jsxs(w,{sx:{ml:4},children:[t.jsx(D,{variant:"body1",children:"Unleash playground is for helping you to understand how Unleash works, how feature flags are evaluated and for you to easily debug your feature flags."}),t.jsx(Vt,{sx:{mt:2,mb:2}}),t.jsx(D,{variant:"body1",sx:{mb:1},children:"What you need to do is:"}),t.jsx(ge,{headerText:`Select in which environment you want to test your
|
|
2
|
-
feature flag configuration`,bodyText:`You can also specify specific projects, or check
|
|
3
|
-
flags in all projects.`,sectionNumber:"1"}),t.jsx(ge,{headerText:"Select a context field that you'd like to check",bodyText:"You can configure as many context fields as you want. You can also leave the context empty to test against an empty context.",sectionNumber:"2"}),t.jsx(ge,{headerText:"Submit the form to try the configuration",bodyText:"The results of evaluating your feature flags will appear after you submit the form. Then view the results.",sectionNumber:"3"})]});var Se={},ia=qe;Object.defineProperty(Se,"__esModule",{value:!0});var ht=Se.default=void 0,la=ia(Ve()),ca=t,da=(0,la.default)((0,ca.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help");ht=Se.default=da;const ua=E(X)(({theme:e})=>({"& .MuiPaper-root":{borderRadius:e.shape.borderRadiusExtraLarge,border:`1px solid ${e.palette.divider}`,padding:e.spacing(8,4),maxWidth:"500px"}})),ha=()=>{const[e,n]=p.useState(null),r=c=>n(c.currentTarget),a=()=>n(null),s=!!e;return t.jsxs(w,{children:[t.jsx(_,{onClick:r,"aria-label":"Open Playground guidance",children:t.jsx(ht,{})}),t.jsxs(ua,{open:s,anchorEl:e,onClose:a,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},sx:c=>({zIndex:c.zIndex.tooltip,background:"none"}),children:[t.jsx(_,{onClick:a,sx:{position:"absolute",right:25,top:15},children:t.jsx(qt,{})}),t.jsx(ut,{})]})]})},ga=e=>p.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84818 0.184159C8.56367 -0.0789547 8.1234 -0.0575747 7.86482 0.231912C7.60623 0.521399 7.62724 0.96937 7.91175 1.23248C9.48292 2.68551 10.6076 4.74934 10.6076 7C10.6076 9.25066 9.48292 11.3145 7.91175 12.7675C7.62724 13.0306 7.60623 13.4786 7.86482 13.7681C8.1234 14.0576 8.56367 14.079 8.84818 13.8158C10.6396 12.1592 11.9998 9.73702 11.9998 7C11.9998 4.26298 10.6396 1.84083 8.84818 0.184159ZM6.04105 2.23302C6.29109 1.93586 6.73054 1.90121 7.02259 2.15563C8.33146 3.29586 9.35426 5.02309 9.35426 6.99995C9.35426 8.97682 8.33145 10.7039 7.02259 11.8441C6.73054 12.0986 6.29109 12.0639 6.04105 11.7668C5.79101 11.4696 5.82506 11.0225 6.11711 10.768C7.19425 9.82969 7.96199 8.46967 7.96199 6.99995C7.96199 5.53021 7.19423 4.17007 6.11711 3.23173C5.82506 2.97731 5.79101 2.53017 6.04105 2.23302ZM6.56908 7.00015C6.56908 8.56492 5.3224 9.83342 3.78454 9.83342C2.24668 9.83342 1 8.56492 1 7.00015C1 5.43539 2.24668 4.16689 3.78454 4.16689C5.3224 4.16689 6.56908 5.43539 6.56908 7.00015Z",fill:"currentColor"})),fa=e=>p.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84835 0.184159C8.56384 -0.0789547 8.12358 -0.0575747 7.86499 0.231912C7.6064 0.521399 7.62741 0.96937 7.91192 1.23248C9.4831 2.68551 10.6078 4.74934 10.6078 7C10.6078 7.40738 10.5709 7.80863 10.5012 8.20125L11.6597 9.35972C11.8783 8.60937 12 7.81877 12 7C12 4.26298 10.6397 1.84083 8.84835 0.184159ZM9.35443 6.99995L9.35418 7.0542L7.63252 5.33255C7.30901 4.52372 6.76993 3.80029 6.11728 3.23173C5.82523 2.97731 5.79118 2.53017 6.04122 2.23302C6.29127 1.93586 6.73072 1.90121 7.02276 2.15563C8.33164 3.29586 9.35443 5.02309 9.35443 6.99995ZM7.57827 8.79752L6.48307 7.70233C6.17606 8.92745 5.08437 9.83342 3.78471 9.83342C2.24685 9.83342 1.00017 8.56492 1.00017 7.00015C1.00017 5.69492 1.8676 4.59583 3.04789 4.26714L0.458225 1.67748C0.172794 1.39205 0.178843 0.923223 0.471736 0.63033C0.764629 0.337437 1.23345 0.331388 1.51889 0.616819L13.2132 12.3111C13.4986 12.5965 13.4926 13.0654 13.1997 13.3583C12.9068 13.6511 12.4379 13.6572 12.1525 13.3718L10.556 11.7753C10.0694 12.539 9.48623 13.2259 8.84835 13.8158C8.56384 14.079 8.12358 14.0576 7.86499 13.7681C7.6064 13.4786 7.62741 13.0306 7.91192 12.7675C8.54021 12.1865 9.0971 11.5078 9.53922 10.7585L8.62356 9.84281C8.20906 10.6195 7.64861 11.2989 7.02276 11.8441C6.73072 12.0986 6.29127 12.0639 6.04122 11.7668C5.79118 11.4696 5.82523 11.0225 6.11728 10.768C6.73471 10.2302 7.25048 9.55374 7.57827 8.79752Z",fill:"currentColor"})),pa=e=>e==="unknown"||e==="unevaluated"?[oe,"info"]:e===!0?[ga,"success"]:[fa,"error"],K=({enabled:e,label:n,showIcon:r=!0})=>{const[a,s]=pa(e);return t.jsx(Ke,{color:s,icon:r?t.jsx(a,{"aria-hidden":!0,color:s,strokeWidth:"0.25"}):void 0,children:n})},ma=E(w)(({theme:e})=>({display:"flex",alignItems:"center",padding:e.spacing(1,0,1,2)})),xa=E(w)(()=>({marginRight:"auto"})),gt=({feature:e})=>{const[n,r]=(()=>{var a;return e!=null&&e.isEnabled?[!0,"True"]:((a=e==null?void 0:e.strategies)==null?void 0:a.result)==="unknown"?["unknown","Unknown"]:[!1,"False"]})();return t.jsx(ma,{children:t.jsx(xa,{"data-loading":!0,children:t.jsx(K,{enabled:n,label:r,showIcon:n!=="unknown"})})})};function ft(e){return e===void 0?!0:Object.values(e).every(n=>n&&typeof n=="object"?ft(n):n===null)}const ze=e=>{var n,r;return(r=(n=e.strategies)==null?void 0:n.data)==null?void 0:r.find(a=>!Je.includes(a.name))},ba=e=>{var n,r,a,s;return((r=(n=e.strategies)==null?void 0:n.data)==null?void 0:r.length)>0&&!((s=(a=e.strategies)==null?void 0:a.data)!=null&&s.find(c=>Je.includes(c.name)))},ya=E("div")({display:"flex",justifyContent:"space-between",width:"100%"}),va=E("hgroup")(({theme:e})=>({display:"inline-flex",alignItems:"center",gap:e.spacing(1.5)})),ja=E("h3")(({theme:e})=>({fontWeight:"bold",fontSize:e.typography.subtitle1.fontSize,margin:0})),Ca=({feature:e,input:n,onClose:r})=>{var l;const a=A(),[s,c,d]=e.isEnabled?[`This feature flag is True in ${n==null?void 0:n.environment} because `,"at least one strategy is True",a.palette.success.contrastText]:e.hasUnsatisfiedDependency&&!e.isEnabledInCurrentEnvironment?[`This feature flag is False in ${n==null?void 0:n.environment} because `,"parent dependency is not satisfied and the environment is disabled",a.palette.error.contrastText]:e.isEnabledInCurrentEnvironment?ba(e)?[`This feature flag is Unknown in ${n==null?void 0:n.environment} because `,"no strategies could be fully evaluated",a.palette.warning.contrastText]:ze(e)?[`This feature flag is Unknown in ${n==null?void 0:n.environment} because `,"not all strategies could be fully evaluated",a.palette.warning.contrastText]:e.hasUnsatisfiedDependency?[`This feature flag is False in ${n==null?void 0:n.environment} because `,"parent dependency is not satisfied",a.palette.error.contrastText]:[`This feature flag is False in ${n==null?void 0:n.environment} because `,"all strategies are either False or could not be fully evaluated",a.palette.error.contrastText]:[`This feature flag is False in ${n==null?void 0:n.environment} because `,"the environment is disabled",a.palette.error.contrastText],i=ft(n==null?void 0:n.context)?"You did not provide a value for your context field in step 2 of the configuration":void 0,h=ze(e)?"This feature uses custom strategies. Custom strategies can't be evaluated, so they will be marked accordingly.":void 0,m=r&&(g=>{g.stopPropagation(),r()});return t.jsxs(t.Fragment,{children:[t.jsxs(ya,{children:[t.jsxs(va,{children:[t.jsx(ja,{children:e.name}),t.jsx("p",{children:((l=e==null?void 0:e.strategies)==null?void 0:l.result)!=="unknown"?t.jsx(K,{enabled:e.isEnabled,label:e.isEnabled?"True":"False"}):t.jsx(K,{enabled:"unknown",label:"Unknown",showIcon:!1})})]}),t.jsx(_,{"aria-label":"Close",onClick:m,children:t.jsx(Kt,{})})]}),t.jsxs("p",{children:[s,t.jsx(D,{color:d,component:"span",children:c}),"."]}),i?t.jsx(Q,{color:"info",children:i}):null,h?t.jsx(Q,{severity:"warning",color:"info",children:h}):null]})},pt=E("div",{shouldForwardProp:e=>e!=="variant"})(({theme:e,variant:n})=>({"--font-size":e.typography.body2.fontSize,display:"flex",alignItems:"center",gap:e.spacing(1),padding:e.spacing(.5,.25),color:n==="ok"?e.palette.success.dark:e.palette.error.dark,fontSize:"var(--font-size)",svg:{fontSize:"calc(var(--font-size) * 1.25)"}})),Sa=()=>t.jsxs(pt,{variant:"ok",children:[t.jsx(Yt,{"aria-hidden":"true"}),t.jsx("p",{children:"Constraint met by value in context"})]}),ka=({text:e})=>t.jsxs(pt,{variant:"error",children:[t.jsx(Zt,{"aria-hidden":"true"}),t.jsx("p",{children:e})]}),mt=({constraint:e,input:n})=>{if(!e)return null;const r=()=>{const a=n==null?void 0:n.context[e.contextName];return e.operator==="REGEX"&&a&&e.value?`Constraint not met – the value in the context ${e.contextName}: { ${a} } is not matching ${e.operator} ${e.value}`:a?`Constraint not met – the value in the context: { ${a} } is not ${e.operator} ${e.contextName}`:`Constraint not met – no value was specified for ${e.contextName}`};return t.jsx(pe,{children:t.jsxs("div",{children:[t.jsx(Jt,{...e}),e.result?t.jsx(Sa,{}):t.jsx(ka,{text:r()})]})})},wa=E(w)(({theme:e})=>({width:"auto",height:"auto",padding:e.spacing(2,3),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`})),Ea=({segment:e,input:n})=>{const r=e.constraints.length>0?t.jsx(Ye,{children:e.constraints.map(a=>t.jsx(mt,{constraint:a,input:n},re(a)))}):void 0;return t.jsx(Qt,{segment:e,constraintList:r,isExpanded:!0})},Ta=({strategyResult:e,input:n})=>{const{name:r,constraints:a,segments:s,parameters:c}=e,d=Xt(e),{strategies:i}=en(),{isCustomStrategy:h,customStrategyParameters:m}=tn(e,i),l=!!(s&&s.length>0),g=!!(a&&(a==null?void 0:a.length)>0),f=r!=="default"&&Object.keys(nn).includes(r);if(!c)return null;const x=[...l?s.map(y=>t.jsx(Ea,{segment:y,input:n},re(y))):[],...g?a.map(y=>t.jsx(mt,{constraint:y,input:n},re(y))):[],f&&d.map((y,R)=>t.jsx(pe,{children:y},R)),h&&m.map((y,R)=>t.jsx(pe,{children:y},R)),r==="default"&&t.jsxs(wa,{sx:{width:"100%"},children:["The standard strategy is ",t.jsx(Ke,{color:"success",children:"ON"})," for all users."]},"default-on")].filter(Boolean),{variant:k,variants:T}=e.result;return t.jsxs(t.Fragment,{children:[t.jsx(Ye,{children:x}),T!=null&&T.length?t.jsx(rn,{variants:T,selected:k==null?void 0:k.name}):null]})},Ia=({strategy:e,input:n,className:r})=>{const{result:a}=e,s=a.evaluationStatus==="incomplete"||a.evaluationStatus==="unevaluated"?"Not evaluated":a.enabled?"True":"False";return t.jsx(an,{strategy:{...e,id:`${re(e)}`},strategyHeaderLevel:4,className:r,headerItemsLeft:e.disabled?null:t.jsx(K,{showIcon:!1,enabled:a.enabled,label:s}),children:t.jsx(Ta,{strategyResult:e,input:n})})},Pa=E("hgroup")(({theme:e})=>({paddingBottom:e.spacing(2)})),Ra=E("h4")(({theme:e})=>({fontWeight:"normal",fontSize:e.typography.body1.fontSize,margin:0})),Oa=E("p")(({theme:e})=>({fontWeight:"bold",fontSize:e.typography.body2.fontSize})),Fa=E(sn)(({theme:e})=>({marginInline:"calc(var(--popover-inline-padding) * -1)",borderTop:`1px solid ${e.palette.divider}`,"> li:last-of-type":{paddingBottom:0}})),Me=({strategies:e,input:n,titlePrefix:r,infoText:a})=>e.length===0?null:t.jsxs("div",{children:[t.jsxs(Pa,{children:[t.jsx(Ra,{children:`${r?r.concat(" strategies"):"Strategies"} (${e==null?void 0:e.length})`}),a?t.jsx(Oa,{children:a}):null]}),t.jsx(Fa,{children:e==null?void 0:e.map((s,c)=>t.jsxs(on,{children:[c>0?t.jsx(ln,{}):"",t.jsx(Ia,{strategy:s,input:n})]},s.id))})]}),Ba=({feature:e})=>{var r,a;if(!((r=e==null?void 0:e.strategies)!=null&&r.data))return null;let n;if(e.hasUnsatisfiedDependency&&!e.isEnabledInCurrentEnvironment)n="If the environment was enabled and parent dependencies were satisfied";else if(e.hasUnsatisfiedDependency)n="If parent dependencies were satisfied";else if(!e.isEnabledInCurrentEnvironment)n="If the environment was enabled";else return;return t.jsxs(Q,{severity:"info",color:"info",children:[n,", then this feature flag would be"," ",(a=e.strategies)!=null&&a.result?"TRUE":"FALSE"," with strategies evaluated like this:"]})},La=({feature:e,input:n})=>{var c,d,i,h,m;const r=(d=(c=e.strategies)==null?void 0:c.data)==null?void 0:d.filter(l=>!l.disabled),a=(h=(i=e.strategies)==null?void 0:i.data)==null?void 0:h.filter(l=>l.disabled),s=(a==null?void 0:a.length)>0;return(((m=e==null?void 0:e.strategies)==null?void 0:m.data.length)??0)===0?t.jsx(Q,{severity:"info",children:"There are no strategies added to this feature flag in the selected environment."}):t.jsxs(t.Fragment,{children:[t.jsx(Ba,{feature:e}),t.jsx(Me,{strategies:r||[],input:n,titlePrefix:s?"Enabled":void 0}),s?t.jsx(Me,{strategies:a,input:n,titlePrefix:"Disabled",infoText:"Disabled strategies are not evaluated for the overall result."}):null]})},Na=E("div")(({theme:e})=>({alignItems:"flex-end",color:e.palette.divider})),Aa=({feature:e,input:n})=>{const[r,a]=p.useState(!1),s=p.useRef(null),c=()=>{a(!r)};return t.jsxs(Na,{children:[t.jsx(_,{onClick:c,children:t.jsx(oe,{ref:s})}),t.jsxs(X,{open:r,onClose:()=>a(!1),anchorEl:s.current,PaperProps:{sx:d=>({"--popover-inline-padding":d.spacing(4),paddingInline:"var(--popover-inline-padding)",paddingBlock:d.spacing(3),display:"flex",flexDirection:"column",width:728,maxWidth:"100%",height:"auto",gap:d.spacing(3),overflowY:"auto",backgroundColor:d.palette.background.elevation1,borderRadius:d.shape.borderRadius})},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:[t.jsx(Ca,{feature:e,input:n,onClose:()=>a(!1)}),t.jsx(La,{feature:e,input:n})]})]})},xt=e=>e.feature?t.jsx(Aa,{...e}):null;var ke={},$a=qe;Object.defineProperty(ke,"__esModule",{value:!0});var bt=ke.default=void 0,Da=$a(Ve()),Ha=t,Wa=(0,Da.default)((0,Ha.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");bt=ke.default=Wa;const za=E("div")(({theme:e})=>({padding:e.spacing(4),maxWidth:"400px"})),fe=E(D)(({theme:e})=>({marginBottom:e.spacing(2)})),Ma=E(bt)(({theme:e})=>({color:e.palette.success.main})),Ua=({variants:e,selectedVariant:n})=>{const r=A(),a=p.useMemo(()=>e.map(l=>({name:l.name,weight:`${cn(l.weight)}%`,selected:l.name===n})),[e,n]),s=p.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{getTableProps:c,getTableBodyProps:d,headerGroups:i,rows:h,prepareRow:m}=B.useTable({initialState:s,columns:_a,data:a,sortTypes:ie,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},B.useGlobalFilter,B.useSortBy);return t.jsxs(za,{children:[t.jsx(fe,{variant:"subtitle2",children:"Variant Information"}),t.jsx(fe,{variant:"body2",children:"The following table shows the variants defined on this feature toggle and the variant result based on your context configuration."}),t.jsx(fe,{variant:"body2",children:'If you include "userId" or "sessionId" in your context, the variant will be the same every time because unleash uses these properties to ensure that the user receives the same experience.'}),t.jsxs(dn,{...c(),rowHeight:"dense",children:[t.jsx(un,{headerGroups:i}),t.jsx(hn,{...d(),children:h.map(l=>{const g={};l.original.selected||(g.color=r.palette.text.secondary),m(l);const{key:f,...x}=l.getRowProps();return t.jsx(gn,{hover:!0,...x,children:l.cells.map(k=>{const{key:T,...y}=k.getCellProps();return t.jsx(fn,{...y,style:g,children:k.render("Cell")},T)})},f)})})]})]})},_a=[{id:"Icon",Cell:({row:{original:{selected:e}}})=>t.jsx(t.Fragment,{children:t.jsx(N,{condition:e,show:t.jsx(pn,{icon:t.jsx(Ma,{})})})}),maxWidth:25,disableGlobalFilter:!0},{Header:"Name",accessor:"name",searchable:!0,Cell:({row:{original:{name:e}}})=>t.jsx(Re,{children:e}),maxWidth:175,width:175},{Header:"Weight",accessor:"weight",sortType:"alphanumeric",searchable:!0,maxWidth:75,Cell:({row:{original:{weight:e}}})=>t.jsx(Re,{children:e})}],Ga=E("div")(()=>({maxWidth:"100%",display:"flex",alignItems:"center",wordBreak:"break-all"})),Va=({variant:e,variants:n,feature:r,isEnabled:a})=>{const s=A(),[c,d]=p.useState(null),i=l=>d(l.currentTarget),h=()=>d(null),m=!!c;return t.jsxs(Ga,{children:[e,t.jsx(N,{condition:!!n&&n.length>0&&a,show:t.jsxs(t.Fragment,{children:[t.jsx(_,{onClick:i,children:t.jsx(oe,{})}),t.jsx(X,{open:m,id:`${r}-result-variants`,PaperProps:{sx:{borderRadius:`${s.shape.borderRadiusLarge}px`}},onClose:h,anchorEl:c,anchorOrigin:{vertical:"bottom",horizontal:-320},children:t.jsx(Ua,{variants:n,selectedVariant:e})})]})})]})},qa=({features:e})=>{const n=A(),r=Ze(n.breakpoints.down("sm")),a=Object.keys(e[0].context).map(l=>({Header:be(l),accessor:g=>g.context[l],minWidth:160,Cell:ye})),s=p.useMemo(()=>[...a,{Header:"Variant",id:"variant",accessor:"variant.name",sortType:"alphanumeric",filterName:"variant",maxWidth:200,Cell:({value:l,row:{original:{variant:g,feature:f,variants:x,isEnabled:k}}})=>t.jsx(Va,{variant:g!=null&&g.enabled?l:"",variants:x,feature:f,isEnabled:k})},{id:"isEnabled",Header:"isEnabled",filterName:"isEnabled",accessor:l=>{var g;return l!=null&&l.isEnabled?"true":((g=l==null?void 0:l.strategies)==null?void 0:g.result)==="unknown"?"unknown":"false"},Cell:({row:l})=>t.jsx(gt,{feature:l.original}),sortType:"playgroundResultState",maxWidth:120,sortInverted:!0},{Header:"",maxWidth:70,id:"info",Cell:({row:l})=>t.jsx(xt,{feature:l.original,input:{environment:l.original.environment,context:l.original.context}})}],[]),{headerGroups:c,rows:d,prepareRow:i,setHiddenColumns:h}=B.useTable({columns:s,data:e,sortTypes:ie,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},B.useGlobalFilter,B.useFlexLayout,B.useSortBy);Qe([{condition:r,columns:["variant"]}],h,s);const m=p.useRef(null);return t.jsx(w,{ref:m,sx:{overflow:"auto",maxHeight:"800px"},children:t.jsx(ve,{parentRef:m,rows:d,headerGroups:c,prepareRow:i})})},Ka=E("div",{})(({theme:e})=>({flexGrow:0,...Xe,justifyContent:"flex-start",margin:e.spacing(0,1.5)})),Ja=E(w)(({theme:e})=>({display:"flex",flexDirection:"row",gap:e.spacing(1)})),Ya=({value:e})=>{const n=A(),[r,a]=p.useState(null),s=m=>a(m.currentTarget),c=()=>a(null),d=!!r,i=(e||[]).filter(m=>m.isEnabled),h=(e||[]).filter(m=>!m.isEnabled);return t.jsxs(Ka,{children:[t.jsxs(Ja,{children:[t.jsx(N,{condition:i.length>0,show:t.jsx(K,{enabled:!0,label:`${i.length}`,showIcon:!0})}),t.jsx(N,{condition:h.length>0,show:t.jsx(K,{enabled:!1,label:`${h.length}`,showIcon:!0})})]}),t.jsxs(t.Fragment,{children:[t.jsx(_,{onClick:s,children:t.jsx(oe,{})}),t.jsxs(X,{open:d,id:`${e}-result-details`,PaperProps:{sx:{borderRadius:`${n.shape.borderRadiusLarge}px`,padding:n.spacing(3)}},onClose:c,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:[t.jsx(D,{variant:"subtitle2",sx:{mb:3},children:e[0].environment}),t.jsx(qa,{features:e})]})]})]})},Za=({features:e})=>{const n=Object.keys(e),r=e[n[0]],a=r[0].context,s=p.useMemo(()=>r.map((f,x)=>({...Object.fromEntries(n.map(k=>[k,e[k][x]]))})),[JSON.stringify(e)]),c=Object.keys(a).map(f=>({Header:be(f),accessor:x=>x[n[0]].context[f],minWidth:160,Cell:ye})),d=n.map(f=>({Header:f,accessor:x=>{var k,T,y;return(k=x[f])!=null&&k.isEnabled?"true":((y=(T=x[f])==null?void 0:T.strategies)==null?void 0:y.result)==="unknown"?"unknown":"false"},Cell:({row:x})=>t.jsxs(w,{sx:{display:"flex"},children:[t.jsx(gt,{feature:x.original[f]}),t.jsx(xt,{feature:x.original[f],input:{environment:x.original[f].environment,context:x.original[f].context}})]}),sortType:"playgroundResultState",maxWidth:140})),i=p.useMemo(()=>[...c,...d],[]),{headerGroups:h,rows:m,prepareRow:l}=B.useTable({columns:i,data:s,sortTypes:ie,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0},B.useGlobalFilter,B.useFlexLayout,B.useSortBy),g=p.useRef(null);return t.jsx(w,{ref:g,sx:{overflow:"auto",maxHeight:"800px"},children:t.jsx(ve,{parentRef:g,rows:m,headerGroups:h,prepareRow:l})})},Qa=E("div",{})(({theme:e})=>({flexGrow:0,...Xe,justifyContent:"flex-start",margin:e.spacing(0,1.5)})),Xa=E(se)(({theme:e})=>({textAlign:"left",textDecorationStyle:"dotted",textDecorationLine:"underline",textUnderlineOffset:e.spacing(.75),color:e.palette.neutral.dark,padding:0,fontWeight:"normal"})),es=({value:e})=>{const n=A(),[r,a]=p.useState(null),s=i=>a(i.currentTarget),c=()=>a(null),d=!!r;return t.jsx(Qa,{children:t.jsxs(t.Fragment,{children:[t.jsx(Xa,{variant:"text",onClick:s,children:"View diff"}),t.jsxs(X,{open:d,id:`${e}-result-details`,PaperProps:{sx:{borderRadius:`${n.shape.borderRadiusLarge}px`,padding:n.spacing(3)}},onClose:c,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:[t.jsx(D,{variant:"subtitle2",sx:{mb:3},children:"Environments diff"}),t.jsx(Za,{features:e})]})]})})},ts=e=>e.reduce((n,r)=>n+Object.values(r.environments).flatMap(a=>Object.keys(a)).length,0),ns=e=>e<0?"invalid bucket":e>=2e4?"20000+":e>=1e4?"10000-20000":e>=1e3?"1000-10000":e>=100?"100-1000":"0-100",rs={id:"name"},{value:Ue,setValue:as}=et("AdvancedPlaygroundResultsTable:v1",rs),ss=({features:e,input:n,loading:r})=>{const{trackEvent:a}=tt();e&&a("playground",{props:{eventType:"number-of-combinations",count:ns(ts(e))}});const[s,c]=nt(),d=mn(r),[i,h]=p.useState(s.get("search")||""),m=A(),l=Ze(m.breakpoints.down("md")),g=e&&e.length>0?Object.keys(e[0].environments).length:0,f=p.useMemo(()=>{var u;return[{Header:"Name",accessor:"name",searchable:!0,minWidth:160,Cell:({value:v,row:{original:S}})=>t.jsx(Oe,{title:v,to:`/projects/${S==null?void 0:S.projectId}/features/${v}`})},{Header:"Project ID",accessor:"projectId",sortType:"alphanumeric",filterName:"projectId",searchable:!0,minWidth:150,Cell:({value:v})=>t.jsx(Oe,{title:v,to:`/projects/${v}`})},...((u=n==null?void 0:n.environments)==null?void 0:u.map(v=>({Header:r?()=>"":be(v),maxWidth:150,id:`environments.${v}`,align:"flex-start",Cell:({row:S})=>t.jsx(Ya,{value:S.original.environments[v]})})))||[],...g>1?[{Header:"Diff",minWidth:150,id:"diff",align:"left",Cell:({row:v})=>t.jsx(es,{value:v.original.environments})}]:[]]},[n]),{data:x,getSearchText:k,getSearchContext:T}=xn(f,i,e||[]),y=p.useMemo(()=>r?Array(5).fill({name:"Feature name",projectId:"Feature Project",environments:{name:"Feature Environments",variants:[]},enabled:!0}):x,[x,r]),[R]=p.useState(()=>({sortBy:[{id:s.get("sort")||Ue.id,desc:s.has("order")?s.get("order")==="desc":Ue.desc}]})),{headerGroups:I,rows:L,state:{sortBy:P},prepareRow:b,setHiddenColumns:j}=B.useTable({initialState:R,columns:f,data:y,sortTypes:ie,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:ye}},B.useGlobalFilter,B.useFlexLayout,B.useSortBy);return Qe([{condition:l,columns:["projectId"]}],j,f),p.useEffect(()=>{if(r)return;const u=Object.fromEntries(s);u.sort=P[0].id,P[0].desc?u.order="desc":u.order&&delete u.order,i?u.search=i:delete u.search,c(u,{replace:!0}),as({id:P[0].id,desc:P[0].desc||!1})},[r,P,i]),t.jsxs(t.Fragment,{children:[t.jsxs(w,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[t.jsx(D,{variant:"subtitle1",sx:{ml:1},children:e!==void 0&&!r?`Results (${L.length<y.length?`${L.length} of ${y.length}`:y.length})`:"Results"}),t.jsx(bn,{initialValue:i,onChange:h,hasFilters:!0,getSearchContext:T,disabled:r,containerStyles:{marginLeft:"1rem",maxWidth:"400px"}})]}),t.jsx(N,{condition:!r&&!y,show:()=>t.jsx(de,{children:y===void 0?"None of the feature flags were evaluated yet.":"No results found."}),elseShow:()=>t.jsxs(w,{ref:d,sx:{overflow:"auto"},children:[t.jsx(yn,{value:k(i),children:t.jsx(ve,{rows:L,headerGroups:I,prepareRow:b})}),t.jsx(N,{condition:y.length===0&&(i==null?void 0:i.length)>0,show:t.jsxs(de,{children:["No feature flags found matching “",i,"”"]})}),t.jsx(N,{condition:y&&y.length===0&&!i,show:t.jsx(de,{children:"No features flags to display"})})]})})]})},yt=E(Q)(({theme:e})=>({marginBottom:e.spacing(3)})),os=({response:e})=>{var r;const n=(r=e==null?void 0:e.warnings)==null?void 0:r.invalidContextProperties;if(n&&n.length>0){n.sort();const a="Some context properties were not taken into account during evaluation",s=E("details")(({theme:c})=>({"* + *":{marginBlockStart:c.spacing(1)}}));return t.jsx(yt,{severity:"warning",children:t.jsxs(s,{children:[t.jsx("summary",{children:a}),t.jsx("p",{children:"The context you provided for this query contained top-level properties with invalid values. These properties were not taken into consideration when evaluating your query. The properties are:"}),t.jsx("ul",{children:n.map(c=>t.jsx("li",{"data-testid":"context-warning-list-element",children:t.jsx("code",{children:c})},c))}),t.jsxs("p",{children:["Remember that context fields (with the exception of the"," ",t.jsx("code",{children:"properties"})," object) must be strings."]}),t.jsx("p",{children:"Because we didn't take these properties into account during the feature flag evaluation, they will not appear in the results table."})]})})}else return null},ds=({FormComponent:e=aa})=>{const n={projects:[],environments:[]},{value:r,setValue:a}=et("AdvancedPlayground:v1",n),{trackEvent:s}=tt(),{environments:c}=vn(),d=A(),i=!0,[h,m]=p.useState(),[l,g]=p.useState(r.environments),[f,x]=p.useState(r.projects),[k,T]=p.useState(r.token),[y,R]=p.useState(r.context),[I,L]=p.useState(),{setToastData:P}=_e(),[b,j]=nt(),[u,v]=p.useState(),{evaluateAdvancedPlayground:S,evaluateChangeRequestPlayground:O,loading:$,errors:z}=ir(),[J,V]=p.useState(!1);p.useEffect(()=>{(l==null?void 0:l.length)===0&&c.length>0&&g([_r(c)])},[JSON.stringify(l),JSON.stringify(c)]),p.useEffect(()=>{Y()},[]);const Y=async()=>{try{const C=H(),W=F(),ee=G();q(),le(),C&&ee&&await we(C||[],W||"*",ee)}catch(C){P({type:"error",text:`Failed to parse URL parameters: ${Z(C)}`})}},H=()=>{let C=null;const W=b.get("environments");return W&&(C=W.split(","),g(C)),C},F=()=>{let C=null;const W=b.get("projects");return W&&(C=W.split(","),x(C)),C},G=()=>{let C=b.get("context");return C&&(C=decodeURI(C),R(C)),C},q=()=>{let C=b.get("token");return C&&(C=decodeURI(C),T(C)),C},le=()=>{const C=b.get("changeRequest");C&&v(C)},we=async(C,W,ee,ce)=>{try{m(void 0);const M={appName:"playground",...JSON.parse(ee||"{}")},Et=u?await O(u,{context:M}):await S({environments:Ur(C),projects:Mr(W),context:M});ce&&typeof ce=="function"&&ce(),L(Et)}catch(M){M instanceof jn?m(M.message):M instanceof SyntaxError?P({type:"error",text:`Error parsing context: ${Z(M)}`}):P({type:"error",text:Z(M)})}},vt=()=>{let C="default";k&&k!==""?C="api_token":u&&(C="change_request"),s("playground",{props:{eventType:"try-configuration",mode:C}})},jt=async C=>{C.preventDefault(),V(!0),vt(),await we(l,f,y,()=>{St(),u||a({environments:l,projects:f,context:y})})},Ct=()=>{v(void 0)},St=()=>{b.set("context",encodeURI(y||"")),Array.isArray(l)&&l.length>0&&!(l.length===1&&l[0]==="*")?b.set("environments",l.join(",")):b.delete("projects"),Array.isArray(f)&&f.length>0&&!(f.length===1&&f[0]==="*")?b.set("projects",f.join(",")):b.delete("projects"),u?b.set("changeRequest",u):b.delete("changeRequest"),j(b)},kt=I&&!i?"35%":"auto",wt=Vr();return t.jsx(Cn,{header:t.jsx(Sn,{title:"Unleash playground",actions:t.jsx(ha,{})}),disableLoading:!0,bodyClass:"no-padding",children:t.jsxs(w,{sx:{display:"flex",flexDirection:"column"},children:[t.jsx(w,{sx:{background:d.palette.background.elevation2,borderBottomLeftRadius:d.shape.borderRadiusMedium,isolation:"isolate",zIndex:2},children:t.jsx(kn,{elevation:0,sx:{px:4,py:3,background:d.palette.background.elevation2,transition:"width 0.4s ease",minWidth:"auto",width:kt,position:"sticky",top:0},children:t.jsx(e,{onSubmit:jt,context:y,setContext:R,availableEnvironments:c,projects:f,environments:l,token:k,setToken:T,setProjects:x,setEnvironments:g,changeRequest:u||void 0,onClearChangeRequest:Ct})})}),t.jsxs(w,{sx:C=>({width:wt,transition:"width 0.4s ease",padding:C.spacing(4,4),isolation:"isolate",zIndex:1}),children:[t.jsx(N,{condition:!!h,show:t.jsx(yt,{severity:"warning",children:h})}),t.jsx(N,{condition:$,show:t.jsx(wn,{}),elseShow:t.jsxs(t.Fragment,{children:[t.jsx(N,{condition:!!I&&Object.values(z).length===0,show:t.jsxs(t.Fragment,{children:[t.jsx(os,{response:I}),t.jsx(ss,{loading:$,features:I==null?void 0:I.features,input:I==null?void 0:I.input})]})}),t.jsx(N,{condition:!I&&!J,show:t.jsx(ut,{})})]})})]})]})})};export{ds as AdvancedPlayground,ds as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as l,B as n,c$ as c,ba as d,j as e,C as p,R as t,T as g,y as h,f$ as u,jC as x,dO as j,dP as m,dQ as y,jy as C,jz as f,jA as S,jB as B}from"./index-CiWHTkEm.js";import{u as T,b as P,S as b,T as v,P as w,n as k,g as D}from"./networkTrafficUsageHighlightPlugin-Y95iEJUb.js";import{a as q}from"./formatTickValue-Ca6X6Ivj.js";import"./LazyAdminExport-BYVn1j-Y.js";import"./RoleCell-BtYhy-KF.js";import"./useApiTokens-BnZdG9it.js";import"./PercentageDonut-WlMbDfDd.js";const R=l(n)(({theme:s})=>({display:"flex",alignItems:"center",gap:s.spacing(.5)})),$=()=>{c("Network - Backend Connections");const{isOss:s}=d(),{chartDataSelection:a,setChartDataSelection:o,options:i}=T(),{chartData:r}=P(a);return e.jsx(p,{condition:s(),show:e.jsx(t,{severity:"warning",children:"Not enabled."}),elseShow:e.jsx(e.Fragment,{children:e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsx(n,{children:e.jsx(t,{severity:"info",icon:!1,children:e.jsxs(R,{children:[e.jsx(g,{children:"1 connection = 7200 backend SDK requests per day"}),e.jsx(h,{title:"1 connection involves polling every 15 seconds and sending metrics every 60 seconds. This translates to 5 requests per minute, 300 requests per hour, and 7200 requests per day.",children:e.jsx(u,{})})]})})}),e.jsx(w,{selectedPeriod:a,setPeriod:o})]}),e.jsx(x,{data:r,plugins:[k],options:i,"aria-label":D(a)})]})})})};j.register(q,m,y,C,f,S,B);export{$ as BackendConnections,$ as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{F as H,H as W,j as t,A as Y,m as J,C as P,bf as ie,n as le,q as ce,j1 as de,o as ue,s as D,b as K,T as C,u as pe,b8 as me,r as v,b7 as Q,b9 as X,bb as he,aq as Z,ce as ge,de as fe,j2 as ve,d8 as be,dd as M,b3 as V,j3 as je,dc as xe,db as Se,h as Te,j4 as ye,bC as ee,j5 as Ee,br as te,j6 as Ce,j7 as Re,j8 as Ae,j9 as we,ja as ke,ic as Ie,i2 as ae,jb as De,k as Pe,jc as Oe,jd as Fe,aO as U,bz as _e,c9 as se,gc as Ve,f as $,bD as $e,ba as qe,bB as Ue,bI as Be,ca as Ne,cd as Le,je as Me,i as _,cs as ze,aR as Ge,aS as ne,aV as B,R as He,df as We,aP as Ye,bg as z,bd as re,jf as Je,jg as Ke,B as Qe,ao as Xe,i1 as Ze,jh as et,cT as tt,ji as at,ga as st}from"./index-CiWHTkEm.js";var N={},nt=W;Object.defineProperty(N,"__esModule",{value:!0});var oe=N.default=void 0,rt=nt(H()),ot=t,it=(0,rt.default)((0,ot.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-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");oe=N.default=it;const lt=de(),Ut=({options:e,selectedOptions:r,indeterminateOptions:s,tagType:u,existingTags:o,disabled:l=!1,onChange:a})=>{const i=t.jsx(ue,{fontSize:"small"}),d=p=>p.inputValue?p.inputValue:p.title,g=({key:p,...m},n,{selected:h})=>{const x=(s==null?void 0:s.some(S=>S.title===n.title))??!1;return t.jsxs("li",{...m,children:[t.jsx(P,{condition:!!n.inputValue,show:t.jsx(ie,{sx:{mr:S=>S.spacing(.5)}}),elseShow:t.jsx(le,{icon:i,checkedIcon:t.jsx(ce,{fontSize:"small"}),indeterminateIcon:t.jsx(oe,{fontSize:"small"}),sx:{mr:S=>S.spacing(.5)},checked:h&&!x,indeterminate:x})}),n.title]},p)},f=(p,m)=>{const n=m.inputValue.trim(),h=lt(p,{...m,inputValue:n}),x=p.some(S=>n===S.title);return n.length>=2&&!x&&h.push({inputValue:n,title:`Create new value "${n}"`}),h};return t.jsx(Y,{multiple:!0,id:"checkboxes-tag",sx:{marginTop:p=>p.spacing(2),width:500},disableCloseOnSelect:!0,options:e,value:r,isOptionEqualToValue:(p,m)=>m.inputValue&&m.inputValue!==""?p.title===m.inputValue:p.title===m.title,getOptionLabel:d,renderOption:g,filterOptions:f,ListboxProps:{style:{maxHeight:200,overflow:"auto"}},onChange:a,renderInput:p=>t.jsx(J,{...p,label:"Select values",placeholder:"Select values"}),disabled:l})},ct=D("li")({flexDirection:"column"}),Bt=({options:e,value:r,disabled:s=!1,onChange:u})=>{const o=K();return t.jsx(Y,{disablePortal:!0,disabled:s,id:"tag-type-select",sx:{marginTop:l=>l.spacing(2),width:500},options:e,disableClearable:!0,value:r,getOptionLabel:l=>l.name,renderOption:({key:l,...a},i)=>t.jsxs(ct,{...a,style:{alignItems:"flex-start",gap:o.spacing(.5)},children:[t.jsx(C,{variant:"body1",children:i.name}),t.jsx(C,{variant:"caption",children:i.description})]},l),renderInput:l=>t.jsx(J,{...l,label:"Tag type",value:r}),onChange:u,ListboxProps:{style:{maxHeight:200,overflow:"auto"}}})},Nt=()=>{const{makeRequest:e,createRequest:r,errors:s,loading:u}=pe({propagateErrors:!0});return{createTag:async a=>{const d=r("api/admin/tags",{method:"POST",body:JSON.stringify(a)});return e(d.caller,d.id)},bulkUpdateTags:async(a,i)=>{const d=`api/admin/projects/${i}/tags`,g=r(d,{method:"PUT",body:JSON.stringify(a)});return e(g.caller,g.id)},errors:s,loading:u}},Lt=(e,r={})=>{const s=async()=>{const g=Q(`api/admin/tags/${e}`);return(await fetch(g,{method:"GET"}).then(X("Tags"))).json()},u=`api/admin/tags/${e}`,{data:o,error:l}=me(!!e,{tags:[]},u,s,r),[a,i]=v.useState(!l&&!o),d=()=>{he(u)};return v.useEffect(()=>{i(!l&&!o)},[o,l]),{tags:(o==null?void 0:o.tags)||[],error:l,loading:a,refetch:d}},dt=D("div")({display:"flex",flexDirection:"column"}),ut=({strategy:e,setStrategy:r,projectId:s,environment:u,editable:o,permission:l=xe})=>{const{trackEvent:a}=Z(),[i,d]=v.useState([]),g=K(),f=e!=null&&e.parameters&&"stickiness"in(e==null?void 0:e.parameters)?String(e.parameters.stickiness):"default";v.useEffect(()=>{d((e.variants||[]).map(n=>({...n,new:o||!1,isValid:!0,id:crypto.randomUUID(),overrides:[]})))},[]),v.useEffect(()=>{r(n=>({...n,variants:i.map(h=>({stickiness:f,name:h.name,weight:h.weight,payload:h.payload,weightType:h.weightType}))}))},[f,JSON.stringify(i)]);const p=(n,h)=>{d(x=>M(x.map(S=>S.id===h?n:S),1e3))},m=()=>{const n=crypto.randomUUID();d(h=>[...h,{name:"",weightType:Se.VARIABLE,weight:0,stickiness:f,new:!0,isValid:!1,id:n}]),a("strategy-variants",{props:{eventType:"variant added"}})};return t.jsxs(t.Fragment,{children:[t.jsxs(C,{component:"h3",sx:{m:0,display:"flex",gap:"1ch"},variant:"h3",children:["Variants",t.jsx(ge,{htmlTooltip:!0,tooltip:t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Variants allow to attach one or more values to this strategy. Variants at the strategy level override variants at the feature level."}),t.jsx(fe,{target:"_blank",href:"https://docs.getunleash.io/concepts/strategy-variants",children:"Learn more"})]})})]}),t.jsxs(dt,{children:[t.jsx(ve,{}),i.map((n,h)=>t.jsx(be,{disableOverrides:!0,variant:n,variants:i,updateVariant:x=>p(x,n.id),removeVariant:()=>d(x=>M(x.filter(S=>S.id!==n.id),1e3)),decorationColor:g.palette.variants[h%g.palette.variants.length]},n.id))]}),t.jsx(V,{onClick:m,variant:"outlined",permission:l,projectId:s,environmentId:u,"data-testid":"ADD_STRATEGY_VARIANT_BUTTON",children:"Add variant"}),t.jsx(je,{variants:i})]})},pt=D("form")(({theme:e})=>({display:"grid",gap:e.spacing(2)})),G=D("hr")(({theme:e})=>({width:"100%",height:"1px",margin:e.spacing(2,0),border:"none",background:e.palette.background.elevation2})),mt=D("div")(({theme:e})=>({display:"flex",justifyContent:"end",gap:e.spacing(2),paddingBottom:e.spacing(10)})),ht=({projectId:e,environmentId:r,permission:s,onSubmit:u,onCancel:o,loading:l,strategy:a,setStrategy:i,segments:d,setSegments:g,errors:f})=>{const p=Te("strategyFormConsolidation"),m=ye(a.constraints),{strategyDefinition:n}=ee(a==null?void 0:a.name),{segments:h=[]}=Ee(),x=h.length>0||d.length>0,S=te();if(!n)return null;const O=b=>n.parameters.find(y=>y.name===b),w=(b,y)=>{const E=O(b);if(b!=="groupId"){const I=Fe(E,y);return I?(f.setFormError(b,I),!1):(f.removeFormError(b),!0)}return!0},R=()=>n.parameters.map(b=>b.name).map(b=>{var y;return w(b,(y=a.parameters)==null?void 0:y[b])}).every(Boolean),c=()=>{S(`/projects/${e}/settings/default-strategy`)},k=async b=>{if(b.preventDefault(),R())u();else return},F=(b,y)=>{i(Oe(E=>{E.parameters=E.parameters??{},E.parameters[b]=y})),w(b,y)};return t.jsxs(pt,{onSubmit:k,children:[t.jsx(Ce,{title:a.title||"",setTitle:b=>{i(y=>({...y,title:b}))}}),x?t.jsx(Re,{segments:d,setSegments:g,availableSegments:h}):null,t.jsx(Ae,{strategy:a,setStrategy:i}),t.jsx(G,{}),p?t.jsx(we,{strategy:a,strategyDefinition:n,updateParameter:F,errors:f}):t.jsx(ke,{strategy:a,strategyDefinition:n,setStrategy:i,validateParameter:w,errors:f}),t.jsx(P,{condition:a.parameters!=null&&"stickiness"in a.parameters,show:t.jsx(ut,{strategy:a,setStrategy:i,environment:r,projectId:e,permission:[Ie,ae]})}),t.jsx(G,{}),t.jsxs(mt,{children:[t.jsx(V,{permission:s,projectId:e,environmentId:r,variant:"contained",color:"primary",type:"submit",disabled:l||!m||f.hasFormErrors(),"data-testid":De,children:"Save strategy"}),t.jsx(Pe,{type:"button",color:"primary",onClick:o||c,disabled:l,children:"Cancel"})]})]})},gt=(e,r)=>{var a,i;const{project:s,refetch:u}=se(e),o={name:"flexibleRollout",constraints:[],parameters:{rollout:"100",stickiness:s.defaultStickiness||"default",groupId:""}},l=(i=(a=s.environments)==null?void 0:a.find(d=>d.environment===r))==null?void 0:i.defaultStrategy;return{defaultStrategyFallback:o,strategy:l,refetch:u}},Mt=()=>{const e=U("projectId"),r=_e("environmentId"),{refetch:s}=se(e),{defaultStrategyFallback:u,strategy:o,refetch:l}=gt(e,r),[a,i]=v.useState(o||u),[d,g]=v.useState([]),{updateDefaultStrategy:f,loading:p}=Ve(),{strategyDefinition:m}=ee(a==null?void 0:a.name),{setToastData:n,setToastApiError:h}=$(),x=$e(),{uiConfig:S}=qe(),{unleashUrl:O}=S,w=te(),{trackEvent:R}=Z(),{segments:c,refetchSegments:k}=Ue();v.useEffect(()=>{if(c&&(o!=null&&o.segments)){const E=[];for(const I of o==null?void 0:o.segments)E.push(...c.filter(T=>T.id===I));g(E)}},[JSON.stringify(c),JSON.stringify(o==null?void 0:o.segments)]);const F=ft(a,d),b=async E=>{await f(e,r,E),R("default_strategy",{props:{action:"edit",hasTitle:!!E.title}}),k(),s(),n({text:"Default Strategy updated",type:"success"})},y=async()=>{const E=`/projects/${e}/settings/default-strategy`;try{await b(F),await l(),w(E)}catch(I){h(_(I))}};return!m||!a?null:t.jsx(Be,{modal:!0,title:Ne((a==null?void 0:a.name)??""),description:bt,documentationLink:jt,documentationLinkLabel:xt,formatApiCode:()=>vt(e,r,F,m,O),children:t.jsx(ht,{projectId:e,strategy:a,setStrategy:i,segments:d,setSegments:g,environmentId:r,onSubmit:y,loading:p,permission:[Le,ae],errors:x,isChangeRequest:!1})})},ft=(e,r)=>({name:e.name,title:e.title,constraints:e.constraints??[],parameters:e.parameters??{},variants:e.variants??[],segments:r.map(s=>s.id),disabled:e.disabled??!1}),vt=(e,r,s,u,o)=>{if(!o)return"";const l={...s,parameters:Me(s.parameters??{},u)},a=`${o}/api/admin/projects/${e}/environments/${r}/default-strategy}`,i=JSON.stringify(l,void 0,2);return`curl --location --request PUT '${a}' \\
|
|
2
|
-
--header 'Authorization: INSERT_API_KEY' \\
|
|
3
|
-
--header 'Content-Type: application/json' \\
|
|
4
|
-
--data-raw '${i}'`},bt=`
|
|
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
|
-
`,jt="https://docs.getunleash.io/concepts/projects#project-default-strategy",xt="Default strategy documentation",zt=e=>{const{data:r,error:s,mutate:u}=ze(Q(`api/admin/environments/project/${e}`),St),o=v.useMemo(()=>r||[],[r]),l=v.useCallback(async()=>{await u()},[u]);return{environments:o,refetchEnvironments:l,loading:!s&&!r,error:s}},St=async e=>(await fetch(e).then(X("Environments")).then(s=>s.json())).environments.sort((s,u)=>s.sortOrder-u.sortOrder),Tt=e=>{const{setToastData:r,setToastApiError:s}=$(),{addChange:u}=Ge(),{refetch:o}=ne(e),[l,a]=v.useState(!1),[i,d]=v.useState({isOpen:!1}),g=v.useCallback((m,n,h,x)=>{d({featureName:m,environment:n,enabled:h,shouldActivateDisabledStrategies:x,isOpen:!0})},[]),f=v.useCallback(()=>{d(m=>({...m,isOpen:!1}))},[]),p=v.useCallback(async()=>{try{a(!0),await u(e,i.environment,{feature:i.featureName,action:"updateEnabled",payload:{enabled:!!i.enabled,shouldActivateDisabledStrategies:!!i.shouldActivateDisabledStrategies}}),o(),d(m=>({...m,isOpen:!1})),r({type:"success",text:"Changes added to draft"})}catch(m){s(_(m)),d(n=>({...n,isOpen:!1}))}finally{a(!1)}},[u]);return{pending:l,onChangeRequestToggle:g,onChangeRequestToggleClose:f,onChangeRequestToggleConfirm:p,changeRequestDialogDetails:i}},yt=({enabled:e,featureName:r,environment:s})=>t.jsxs(C,{"data-testid":"update-enabled-message",children:[t.jsx("strong",{children:e?"Enable":"Disable"})," feature flag"," ",t.jsx("strong",{children:r})," in ",t.jsx("strong",{children:s})]}),Et=({isOpen:e,disabled:r=!1,onConfirm:s,onClose:u,showBanner:o,environment:l,messageComponent:a})=>{const i=U("projectId"),{data:d}=ne(i),{changeRequestInReviewOrApproved:g,alert:f}=We(d),p=g(l||""),m=p?"Add to existing change request":"Add suggestion to draft";return t.jsxs(B,{open:e,primaryButtonText:m,secondaryButtonText:"Cancel",disabledPrimaryButton:r,onClick:s,onClose:u,title:"Request changes",fullWidth:!0,children:[t.jsx(P,{condition:p,show:f}),t.jsx(P,{condition:!!o,show:t.jsxs(He,{severity:"info",sx:{mb:2},children:["Change requests feature is enabled for ",l,". Your changes need to be approved before they will be live. All the changes you do now will be added into a draft that you can submit for review."]})}),t.jsx(C,{variant:"body2",color:"text.secondary",children:"Your suggestion:"}),a]})},Ct=D("ul")(({theme:e})=>({margin:e.spacing(1),paddingLeft:e.spacing(2)})),Rt=({isOpen:e,onAddDefaultStrategy:r,onActivateDisabledStrategies:s,onClose:u,environment:o,featureId:l})=>{var f,p,m;const a=U("projectId"),{feature:i}=Ye(a,l),d=(m=(p=(f=i.environments)==null?void 0:f.find(({name:n})=>n===o))==null?void 0:p.strategies)==null?void 0:m.filter(({disabled:n})=>n).length,g=d?d===1?"1 disabled strategy":`${d} disabled strategies`:"disabled strategies";return t.jsxs(B,{open:e,secondaryButtonText:"Cancel",permissionButton:t.jsxs(t.Fragment,{children:[t.jsx(V,{type:"button",variant:"outlined",permission:z,projectId:a,environmentId:o,onClick:r,children:"Add default strategy"}),t.jsx(V,{type:"button",variant:"outlined",permission:z,projectId:a,environmentId:o,onClick:s,children:"Enable all strategies"})]}),onClose:u,title:`Enable feature flag in ${o}`,fullWidth:!0,children:[t.jsx(C,{sx:{mb:n=>n.spacing(3)},children:"A feature flag cannot be enabled without an enabled strategy."}),t.jsx(C,{children:"To enable this feature flag you can choose to:"}),t.jsxs(Ct,{children:[t.jsx("li",{children:t.jsx(C,{children:t.jsx("strong",{children:"Add the default strategy"})})}),t.jsx("li",{children:t.jsxs(C,{children:[t.jsx("strong",{children:"Enable all the disabled strategies"})," ","(this feature flag has ",g,")"]})})]})]})},At=e=>{const r=s=>{s<e.length&&e[s](()=>r(s+1))};r(0)},Gt=e=>{const{toggleFeatureEnvironmentOn:r,toggleFeatureEnvironmentOff:s}=re(),{setToastData:u,setToastApiError:o}=$(),[l,a]=v.useState({open:!1,label:"",loading:!1,onClose:()=>{},onClick:()=>{}}),[i,d]=v.useState({isOpen:!1,environment:"",featureId:"",onClose:()=>{},onActivateDisabledStrategies:()=>{},onAddDefaultStrategy:()=>{}}),{pending:g,onChangeRequestToggle:f,onChangeRequestToggleClose:p,onChangeRequestToggleConfirm:m,changeRequestDialogDetails:n}=Tt(e),[h,x]=v.useState(),S=v.useCallback(async(R,c)=>{let k=!1;return At([T=>{if(c.isChangeRequestEnabled||!Ke(c.environmentType||""))return T();a({open:!0,label:`${R?"Enable":"Disable"} Environment`,loading:!1,onClose:()=>{var j;a(A=>({...A,open:!1})),(j=c.onRollback)==null||j.call(c)},onClick:()=>{a(j=>({...j,open:!1,loading:!0})),T()}})},T=>{if(R===!1||!c.hasStrategies||c.hasEnabledStrategies||c.hasReleasePlans)return T();d({isOpen:!0,environment:c.environmentName,featureId:c.featureId,onClose:()=>{var j;d(A=>({...A,isOpen:!1})),(j=c.onRollback)==null||j.call(c)},onActivateDisabledStrategies:()=>{d(j=>({...j,isOpen:!1})),k=!0,T()},onAddDefaultStrategy:()=>{d(j=>({...j,isOpen:!1})),T()}})},T=>{if(!c.isChangeRequestEnabled)return T();x(()=>{var j;x(void 0),(j=c.onRollback)==null||j.call(c)}),f(c.featureId,c.environmentName,R,k)},async T=>{var j,A;if(R!==!1)return T();try{await s(c.projectId,c.featureId,c.environmentName),u({type:"success",text:`Disabled in ${c.environmentName}`}),(j=c.onSuccess)==null||j.call(c)}catch(q){o(_(q)),(A=c.onRollback)==null||A.call(c)}},async T=>{var j,A;if(R!==!0)return T();try{await r(c.projectId,c.featureId,c.environmentName,k),u({type:"success",text:`Enabled in ${c.environmentName}`}),(j=c.onSuccess)==null||j.call(c)}catch(q){o(_(q)),(A=c.onRollback)==null||A.call(c)}}])},[a]),O=i.featureId.length!==0,w=t.jsxs(t.Fragment,{children:[t.jsx(Je,{...l}),t.jsx(P,{condition:O,show:t.jsx(Rt,{...i})}),t.jsx(Et,{isOpen:n.isOpen,onClose:()=>{h==null||h(),p()},environment:n==null?void 0:n.environment,disabled:g,onConfirm:()=>{h==null||h(),m()},messageComponent:t.jsx(yt,{enabled:n==null?void 0:n.enabled,featureName:n==null?void 0:n.featureName,environment:n.environment})})]});return{onToggle:S,modals:w}},wt=e=>{const[r,s]=v.useState(e),u=v.useCallback(()=>s(e),[e]);return v.useEffect(()=>{s(e)},[e]),[r,s,u]},kt=D(Qe)(()=>({mx:"auto",...Xe})),Ht=({projectId:e,featureId:r,environmentName:s,value:u,onToggle:o})=>{const[l,a,i]=wt(u),d=()=>{a(!l),requestAnimationFrame(()=>{o(!l,i)})},g=`${r}-${s}`;return t.jsx(t.Fragment,{children:t.jsx(kt,{"data-testid":`TOGGLE-${g}`,children:t.jsx(Ze,{tooltip:l?`Disable flag in ${s}`:`Enable flag in ${s}`,checked:u,environmentId:s,projectId:e,permission:et,inputProps:{"aria-label":s},onClick:d,"data-testid":"permission-switch",disabled:u!==l})},g)})};var L={},It=W;Object.defineProperty(L,"__esModule",{value:!0});var Dt=L.default=void 0,Pt=It(H()),Ot=t,Ft=(0,Pt.default)((0,Ot.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-5zm3 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 3v5z"}),"CleaningServices");Dt=L.default=Ft;const _t="flag-reminders:v1",Vt=50,$t=7,Wt=({days:e=$t,maxReminders:r=Vt}={})=>{const[s,u]=tt(_t,{});return{shouldShowReminder:a=>{const i=s[a];return!i||at(new Date,new Date(i))},snoozeReminder:(a,i=e)=>{const d=st(new Date,i).getTime();u(g=>{const f={...g,[a]:d},p=Object.entries(f);if(p.length>r){p.sort((n,h)=>n[1]-h[1]);const m=p.slice(p.length-r);return Object.fromEntries(m)}return f})}}},Yt=({isStale:e,isOpen:r,projectId:s,featureId:u,onClose:o})=>{const{setToastData:l,setToastApiError:a}=$(),{patchFeatureToggle:i}=re(),d=t.jsx(C,{children:"Setting a flag to stale marks it for cleanup"}),g=t.jsx(C,{children:"Setting a flag to active marks it as in active use"}),f=e?"active":"stale",p=async m=>{m.stopPropagation();try{await i(s,u,[{op:"replace",path:"/stale",value:!e}]),o()}catch(n){a(_(n))}l(e?{type:"success",text:"The flag is no longer marked as stale"}:{type:"success",text:"The flag has been marked as stale"})};return t.jsx(B,{open:r,secondaryButtonText:"Cancel",primaryButtonText:`Flip to ${f}`,title:`Set feature state to ${f}`,onClick:p,onClose:o,children:t.jsx(P,{condition:e,show:g,elseShow:d})})};export{Et as C,Mt as E,Ht as F,Bt as T,Lt as a,Ut as b,gt as c,zt as d,Gt as e,Wt as f,Dt as g,Yt as h,Nt as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c$ as n,ba as l,j as e,C as c,R as a,B as d,jC as g,dO as h,dP as j,dQ as p,jy as f,jz as u,jA as m,jB as x}from"./index-CiWHTkEm.js";import{a as S}from"./formatTickValue-Ca6X6Ivj.js";import{u as C,c as P,S as w,T as y,P as B,n as T,g as b}from"./networkTrafficUsageHighlightPlugin-Y95iEJUb.js";import"./LazyAdminExport-BYVn1j-Y.js";import"./RoleCell-BtYhy-KF.js";import"./useApiTokens-BnZdG9it.js";import"./PercentageDonut-WlMbDfDd.js";const _=()=>{n("Network - Frontend Traffic Usage");const{isOss:s}=l(),{chartDataSelection:t,setChartDataSelection:r,options:i}=C(),{chartData:o}=P(t);return e.jsx(c,{condition:s(),show:e.jsx(a,{severity:"warning",children:"Not enabled."}),elseShow:e.jsx(e.Fragment,{children:e.jsxs(w,{children:[e.jsxs(y,{children:[e.jsx(d,{children:e.jsx(a,{severity:"info",icon:!1,children:"Frontend traffic is determined by the total SDK requests to the Frontend API"})}),e.jsx(B,{selectedPeriod:t,setPeriod:r})]}),e.jsx(g,{data:o,plugins:[T],options:i,"aria-label":b(t)})]})})})};h.register(S,j,p,f,u,m,x);export{_ as default};
|