unleash-server 8.0.1 → 8.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/index.d.ts.map +1 -1
- package/dist/lib/addons/index.js +2 -0
- package/dist/lib/addons/index.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-definition.d.ts.map +1 -1
- package/dist/lib/addons/teams-definition.js +1 -0
- package/dist/lib/addons/teams-definition.js.map +1 -1
- package/dist/lib/addons/teams-workflow-definition.d.ts +4 -0
- package/dist/lib/addons/teams-workflow-definition.d.ts.map +1 -0
- package/dist/lib/addons/teams-workflow-definition.js +66 -0
- package/dist/lib/addons/teams-workflow-definition.js.map +1 -0
- package/dist/lib/addons/teams-workflow.d.ts +15 -0
- package/dist/lib/addons/teams-workflow.d.ts.map +1 -0
- package/dist/lib/addons/teams-workflow.js +110 -0
- package/dist/lib/addons/teams-workflow.js.map +1 -0
- package/dist/lib/addons/teams-workflow.test.d.ts +2 -0
- package/dist/lib/addons/teams-workflow.test.d.ts.map +1 -0
- package/dist/lib/addons/teams-workflow.test.js +202 -0
- package/dist/lib/addons/teams-workflow.test.js.map +1 -0
- 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/frontend-api/frontend-api-service.d.ts.map +1 -1
- package/dist/lib/features/frontend-api/frontend-api-service.js +17 -20
- package/dist/lib/features/frontend-api/frontend-api-service.js.map +1 -1
- package/dist/lib/features/metrics/integrations/integration-metrics.d.ts +1 -1
- package/dist/lib/features/metrics/integrations/integration-metrics.d.ts.map +1 -1
- package/dist/lib/features/metrics/integrations/integration-metrics.js +2 -0
- package/dist/lib/features/metrics/integrations/integration-metrics.js.map +1 -1
- package/dist/lib/middleware/secure-headers.d.ts.map +1 -1
- package/dist/lib/middleware/secure-headers.js +20 -1
- package/dist/lib/middleware/secure-headers.js.map +1 -1
- package/dist/lib/openapi/spec/addon-create-update-schema.d.ts +1 -1
- package/dist/lib/openapi/spec/addon-create-update-schema.js +1 -1
- package/dist/lib/openapi/spec/addons-schema.d.ts +15 -0
- package/dist/lib/openapi/spec/addons-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/addons-schema.js +51 -0
- package/dist/lib/openapi/spec/addons-schema.js.map +1 -1
- package/dist/lib/openapi/spec/profile-schema.d.ts +6 -1
- package/dist/lib/openapi/spec/profile-schema.d.ts.map +1 -1
- package/dist/lib/openapi/spec/profile-schema.js +13 -1
- package/dist/lib/openapi/spec/profile-schema.js.map +1 -1
- package/dist/lib/openapi/spec/profile-schema.test.js +1 -0
- package/dist/lib/openapi/spec/profile-schema.test.js.map +1 -1
- package/dist/lib/routes/admin-api/addon.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/addon.js +6 -2
- package/dist/lib/routes/admin-api/addon.js.map +1 -1
- package/dist/lib/routes/admin-api/user/user.d.ts.map +1 -1
- package/dist/lib/routes/admin-api/user/user.js +3 -1
- package/dist/lib/routes/admin-api/user/user.js.map +1 -1
- package/dist/lib/routes/admin-api/user/user.test.js +32 -7
- package/dist/lib/routes/admin-api/user/user.test.js.map +1 -1
- package/dist/lib/routes/util.d.ts.map +1 -1
- package/dist/lib/routes/util.js +8 -1
- 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/schema/html-input.d.ts +4 -0
- package/dist/lib/schema/html-input.d.ts.map +1 -0
- package/dist/lib/schema/html-input.js +38 -0
- package/dist/lib/schema/html-input.js.map +1 -0
- package/dist/lib/schema/html-input.test.d.ts +2 -0
- package/dist/lib/schema/html-input.test.d.ts.map +1 -0
- package/dist/lib/schema/html-input.test.js +98 -0
- package/dist/lib/schema/html-input.test.js.map +1 -0
- package/dist/lib/server-impl.d.ts +2 -1
- package/dist/lib/server-impl.d.ts.map +1 -1
- package/dist/lib/server-impl.js +2 -1
- package/dist/lib/server-impl.js.map +1 -1
- package/dist/lib/services/addon-service.d.ts +8 -1
- package/dist/lib/services/addon-service.d.ts.map +1 -1
- package/dist/lib/services/addon-service.js +24 -1
- package/dist/lib/services/addon-service.js.map +1 -1
- package/dist/lib/services/addon-service.test.js +75 -8
- package/dist/lib/services/addon-service.test.js.map +1 -1
- package/dist/lib/services/project-schema.d.ts +1 -2
- package/dist/lib/services/project-schema.d.ts.map +1 -1
- package/dist/lib/services/project-schema.js +4 -2
- package/dist/lib/services/project-schema.js.map +1 -1
- package/dist/lib/services/user-service.d.ts +1 -0
- package/dist/lib/services/user-service.d.ts.map +1 -1
- package/dist/lib/services/user-service.js +7 -0
- package/dist/lib/services/user-service.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 +21 -0
- package/dist/lib/types/experimental.js.map +1 -1
- package/dist/lib/types/model.d.ts +2 -0
- 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/ui-config/ui-config-service.d.ts.map +1 -1
- package/dist/lib/ui-config/ui-config-service.js +4 -2
- package/dist/lib/ui-config/ui-config-service.js.map +1 -1
- package/dist/lib/ui-config/ui-config.test.js +21 -2
- package/dist/lib/ui-config/ui-config.test.js.map +1 -1
- package/dist/lib/util/anonymise.d.ts +1 -0
- package/dist/lib/util/anonymise.d.ts.map +1 -1
- package/dist/lib/util/anonymise.js +3 -0
- package/dist/lib/util/anonymise.js.map +1 -1
- package/dist/lib/util/anonymise.test.js +4 -1
- package/dist/lib/util/anonymise.test.js.map +1 -1
- package/dist/migrations/20260617115403-update-flag-descriptions.d.ts +3 -0
- package/dist/migrations/20260617115403-update-flag-descriptions.d.ts.map +1 -0
- package/dist/migrations/20260617115403-update-flag-descriptions.js +38 -0
- package/dist/migrations/20260617115403-update-flag-descriptions.js.map +1 -0
- package/dist/migrations/20260624120000-servicenow-change-references.d.ts +3 -0
- package/dist/migrations/20260624120000-servicenow-change-references.d.ts.map +1 -0
- package/dist/migrations/20260624120000-servicenow-change-references.js +22 -0
- package/dist/migrations/20260624120000-servicenow-change-references.js.map +1 -0
- package/dist/server-dev.js +5 -1
- package/dist/server-dev.js.map +1 -1
- package/dist/test/e2e/api/admin/addon.e2e.test.js +2 -1
- 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/frontend/build/index.html +2 -2
- package/frontend/build/static/{AdvancedPlayground-BEYkf6Xg.js → AdvancedPlayground-DdeMb-6I.js} +2 -2
- package/frontend/build/static/{BackendConnections-DdvotR_8.js → BackendConnections-kgR0xyIH.js} +1 -1
- package/frontend/build/static/DialogWithAside-DzCSDyWo.js +1110 -0
- package/frontend/build/static/{EnterpriseEdge-DN23kaQp.js → EnterpriseEdge-CjslqYDM.js} +4 -4
- package/frontend/build/static/{FeatureMetricsChart-CmVkRuwG.js → FeatureMetricsChart-B4WryxcW.js} +2 -2
- package/frontend/build/static/FeatureStaleDialog-EzReRTI5.js +8 -0
- package/frontend/build/static/FeatureViewLazyExport-8eQKTvdS.js +10 -0
- package/frontend/build/static/{FlagMetricsChart-ZjHSwulg.js → FlagMetricsChart-hNQuwOxW.js} +2 -2
- package/frontend/build/static/{FrontendNetworkTrafficUsage-BmLOJdK9.js → FrontendNetworkTrafficUsage-pcr83PWo.js} +1 -1
- package/frontend/build/static/GridLayoutWrapper-B_YyjZ7l.js +5 -0
- package/frontend/build/static/{ImpactMetricsPage-D1CETZR_.js → ImpactMetricsPage-DGH_S9oz.js} +1 -1
- package/frontend/build/static/ImpactViewsPage-DZqKPFvE.js +1 -0
- package/frontend/build/static/{LazyAdminExport-BvtR_me3.js → LazyAdminExport-B1ReAViz.js} +15 -15
- package/frontend/build/static/LazyProjectExport-BMVcGpNI.js +46 -0
- package/frontend/build/static/LifecycleChartComponent-BeoRUO9q.js +2 -0
- package/frontend/build/static/{LineChartComponent-d80f3Tky.js → LineChartComponent-BbCMbJ-m.js} +1 -1
- package/frontend/build/static/{MarkCompletedDialogue-CtzRfovJ.js → MarkCompletedDialogue-CcXyp8UE.js} +1 -1
- package/frontend/build/static/{NetworkOverview-D1UOxIaf.js → NetworkOverview-0mBnFAZX.js} +1 -1
- package/frontend/build/static/{NetworkTraffic-CLnhub6c.js → NetworkTraffic-DmG5Iv25.js} +1 -1
- package/frontend/build/static/{NetworkTrafficUsage-PgI0lqze.js → NetworkTrafficUsage-DccaVLYs.js} +1 -1
- package/frontend/build/static/OnboardingProgress-Bp9sZ-ZM.js +1 -0
- package/frontend/build/static/{PercentageDonut-C6I2UOES.js → PercentageDonut-DBDGNJlh.js} +1 -1
- package/frontend/build/static/PermissionButton-B-IfzChn.js +1 -0
- package/frontend/build/static/ReactJSONEditor-DeBI7JPg.js +4 -0
- package/frontend/build/static/RoleCell-DhYvu4YH.js +1 -0
- package/frontend/build/static/Safeguard-DErU6fSK.js +1 -0
- package/frontend/build/static/{SelectSdk-D2NaTubs.js → SelectSdk-Dr_pzQgX.js} +1 -1
- package/frontend/build/static/StoriesPage-frGP1Bfr.js +2 -0
- package/frontend/build/static/{aggregateFeatureMetrics-DBivHCcj.js → aggregateFeatureMetrics-B-67HaIZ.js} +1 -1
- package/frontend/build/static/chartjs-plugin-annotation.esm-DP4wCpdA.js +1 -0
- package/frontend/build/static/differenceInSeconds-DMZGQwjK.js +1 -0
- package/frontend/build/static/endOfMonth-CkSR_DAx.js +1 -0
- package/frontend/build/static/esm-DdgY1Q5s.js +12 -0
- package/frontend/build/static/formatDistanceToNow-CyouiCIY.js +1 -0
- package/frontend/build/static/index-C04TEs4k.js +290 -0
- package/frontend/build/static/{metricsFormatters-BEX2qb8Y.js → metricsFormatters-DhX-aU17.js} +1 -1
- package/frontend/build/static/networkTrafficUsageHighlightPlugin-DlOtHZg3.js +1 -0
- package/frontend/build/static/parse-Chj4PyAg.js +1 -0
- package/frontend/build/static/startOfHour-P0Sr6h8e.js +1 -0
- package/frontend/build/static/themeStyles-DGVpwkcv.js +1 -0
- package/frontend/build/static/{useConditionallyHiddenColumns-DTDzRlyO.js → useConditionallyHiddenColumns-C5q9zdfJ.js} +1 -1
- package/frontend/build/static/useCustomEvent-Dj2V5RVb.js +1 -0
- package/frontend/build/static/{useGroupedImpactMetricsData-CK8Pz2an.js → useGroupedImpactMetricsData-CW9qnV2y.js} +1 -1
- package/frontend/build/static/{useInstanceTrafficMetrics-CIpyIGYi.js → useInstanceTrafficMetrics-CRCDB4TX.js} +1 -1
- package/frontend/package.json +9 -7
- package/package.json +11 -9
- package/frontend/build/static/ChatOutlined-jZlhx14o.js +0 -1
- package/frontend/build/static/CloudCircle-BjnxUYAO.js +0 -1
- package/frontend/build/static/DialogWithAside-BvaGTcqO.js +0 -1106
- package/frontend/build/static/FeatureStaleDialog-BkyjUGR9.js +0 -8
- package/frontend/build/static/FeatureViewLazyExport-C5FggFea.js +0 -10
- package/frontend/build/static/GridLayoutWrapper-D93wkNEo.js +0 -3
- package/frontend/build/static/ImpactViewsPage-DeBga4lU.js +0 -1
- package/frontend/build/static/LazyProjectExport-BkOu6pHf.js +0 -46
- package/frontend/build/static/LifecycleChartComponent-BYvIFr7Q.js +0 -2
- package/frontend/build/static/PermissionButton-BIeM26DH.js +0 -1
- package/frontend/build/static/ReactJSONEditor-C-paZV5Q.js +0 -4
- package/frontend/build/static/RoleCell-BCPNstXC.js +0 -1
- package/frontend/build/static/Safeguard-9zs64Bna.js +0 -1
- package/frontend/build/static/StoriesPage-5lbMiQlA.js +0 -1
- package/frontend/build/static/chartjs-plugin-annotation.esm-BxKcCGhA.js +0 -1
- package/frontend/build/static/esm-CFWP4-MJ.js +0 -15
- package/frontend/build/static/index-BJ2iUk24.js +0 -289
- package/frontend/build/static/networkTrafficUsageHighlightPlugin-DVWh8Lrd.js +0 -1
- package/frontend/build/static/parse-BhYjTMCL.js +0 -1
- package/frontend/build/static/startOfHour-KiLZtdEa.js +0 -1
- package/frontend/build/static/themeStyles-BPY8RNQO.js +0 -1
- package/frontend/build/static/useCustomEvent-CwoY8S5F.js +0 -1
- /package/frontend/build/static/{connect-DbjGV9Hl.png → cr-DbjGV9Hl.png} +0 -0
|
@@ -1,1106 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./react-GZhdek4G.js";import{j as n,s as r,t as i}from"./useTheme-CQqAmDLr.js";import{t as a}from"./jsx-runtime-BnvnyDTF.js";import{v as o}from"./createSimplePaletteValueFilter-BRAMrHWJ.js";import{t as s}from"./useMediaQuery-DGx8zAkf.js";import{t as c}from"./Tooltip-BaILXXti.js";import{n as ee,r as te}from"./TextField-oipjeg6n.js";import{r as l,t as u}from"./Alert-_bLyWbvx.js";import{t as d}from"./Typography-BTdLWIUX.js";import{t as f}from"./Box-BQsxfFmC.js";import{t as p}from"./Button-CebB8EPB.js";import{t as m}from"./Dialog-C-xQxqWX.js";import{a as h,i as ne,n as g,o as re}from"./TooltipResolver-4A1YhwBy.js";import{t as _}from"./Close-DyTASMSq.js";import{t as v,u as y}from"./httpErrorResponseHandler-FMtt7Zqh.js";import{n as b,r as x}from"./formatPath-j72gcKwy.js";import{t as ie}from"./Truncator-D2bO9ub6.js";import{n as ae,t as oe}from"./FileCopy-B8HZEA83.js";import{Ha as S,Js as se,Ot as ce,St as le,Va as C,fo as ue,kt as de}from"./index-BJ2iUk24.js";var w=e(t()),T=a(),fe=e=>(0,T.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:20,height:20,viewBox:`0 0 20 20`,fill:`none`,...e,children:(0,T.jsx)(`path`,{d:`M4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V5.41667C2.5 5.22222 2.53125 5.03819 2.59375 4.86458C2.65625 4.69097 2.75 4.52778 2.875 4.375L4.04167 2.95833C4.16667 2.80556 4.30903 2.69097 4.46875 2.61458C4.62847 2.53819 4.80556 2.5 5 2.5H15C15.1944 2.5 15.3715 2.53819 15.5312 2.61458C15.691 2.69097 15.8333 2.80556 15.9583 2.95833L17.125 4.375C17.25 4.52778 17.3438 4.69097 17.4062 4.86458C17.4688 5.03819 17.5 5.22222 17.5 5.41667V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM4.5 5H15.5L14.7917 4.16667H5.20833L4.5 5ZM4.16667 15.8333H15.8333V6.66667H4.16667V15.8333ZM12.125 14.2083L15.0833 11.25L12.125 8.29167L10.9167 9.5L12.6667 11.25L10.9167 13L12.125 14.2083ZM7.91667 14.2083L9.125 13L7.375 11.25L9.125 9.5L7.91667 8.29167L4.95833 11.25L7.91667 14.2083Z`,fill:`#6E6E70`})}),E=o(se)(({theme:e})=>({width:e.spacing(3),height:e.spacing(3)})),D=C.filter(e=>e.type===`server`).map(({name:e})=>({name:S[e].title,icon:S[e].icon})),O=C.filter(e=>e.type===`client`).map(({name:e})=>({name:S[e].title,icon:S[e].icon})),pe=[...D,...O],me=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(3),backgroundColor:e.palette.background.paper})),k=o(`div`)(({theme:e})=>({fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body1.fontSize})),A=o(`div`)(({theme:e})=>({marginTop:e.spacing(.5),marginBottom:e.spacing(2),fontSize:e.typography.body2.fontSize,color:e.palette.text.secondary})),he=o(`div`)(({theme:e})=>({display:`flex`,columnGap:e.spacing(1.5),rowGap:e.spacing(1.5),alignItems:`center`,justifyContent:`flex-start`,flexWrap:`wrap`})),ge=o(p,{shouldForwardProp:e=>e!==`isSelected`})(({theme:e,isSelected:t})=>({fontSize:e.typography.body2.fontSize,border:`1px solid ${t?e.palette.primary.main:e.palette.divider}`,borderRadius:e.shape.borderRadius,padding:e.spacing(1,1.5),minWidth:e.spacing(30),display:`flex`,alignItems:`center`,gap:e.spacing(1)})),_e=o(`div`)(({theme:e})=>({color:e.palette.text.primary,display:`flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`})),ve=o(`span`)(({theme:e})=>({color:e.palette.primary.main,fontSize:e.typography.body2.fontSize,fontWeight:700})),j=({sdks:e,type:t,selectedSdkName:n,onSelect:r})=>(0,T.jsx)(he,{children:e.map(e=>{let i=n===e.name;return(0,T.jsxs)(ge,{onClick:()=>r({name:e.name,type:t}),variant:`text`,isSelected:i,children:[(0,T.jsx)(E,{src:x(e.icon),alt:``}),(0,T.jsxs)(_e,{children:[(0,T.jsx)(`b`,{children:e.name}),(0,T.jsx)(ve,{children:i?`Selected`:`Select`})]})]},e.name)})}),ye=({onSelect:e,sdk:t})=>{let n=t?.name;return(0,T.jsxs)(me,{children:[(0,T.jsxs)(f,{children:[(0,T.jsx)(k,{children:`Backend SDKs`}),(0,T.jsx)(A,{children:`Backend SDKs need a backend API key.`}),(0,T.jsx)(j,{sdks:D,type:`client`,selectedSdkName:n,onSelect:e})]}),(0,T.jsxs)(f,{children:[(0,T.jsx)(k,{children:`Frontend SDKs`}),(0,T.jsx)(A,{children:`Frontend SDKs need a frontend API key.`}),(0,T.jsx)(j,{sdks:O,type:`frontend`,selectedSdkName:n,onSelect:e})]})]})},M=(e,t={})=>{let{data:n,error:r,mutate:i}=y(b(`api/admin/projects/${e}/api-tokens`),be,t),a=(0,w.useMemo)(()=>n??[],[n]),o=(0,w.useCallback)(()=>{i().catch(console.warn)},[i]);return{tokens:a,error:r,loading:!r&&!n,refetch:o}},be=async e=>(await(await fetch(e).then(v(`Project Api tokens`))).json()).tokens,N=()=>{let{makeRequest:e,createRequest:t,errors:n,loading:r}=g({propagateErrors:!0});return{deleteToken:async(n,r)=>{let i=t(`api/admin/projects/${r}/api-tokens/${n}`,{method:`DELETE`});return e(i.caller,i.id)},createToken:async(n,r)=>{let i=t(`api/admin/projects/${r}/api-tokens`,{method:`POST`,body:JSON.stringify(n)});return e(i.caller,i.id)},errors:n,loading:r}},xe=e=>{if(!e)return null;let[t,n]=e.split(`:`,2);if(!n)return null;let[r,i,...a]=n.split(`.`);return t&&r&&i&&a.length===0?{project:t,environment:r,secret:i}:null},P=de(),Se=o(`div`)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,borderRadius:e.shape.borderRadius,padding:e.spacing(3),display:`flex`,flexDirection:`column`,alignItems:`center`})),F=o(`div`)({wordBreak:`break-all`}),I=o(`div`)(({theme:e})=>({borderRadius:e.shape.borderRadius,padding:e.spacing(2),flex:1,color:e.palette.text.secondary,fontSize:e.typography.body2.fontSize,background:e.palette.background.default})),L=o(I)(({theme:e})=>({border:`1px solid ${e.palette.primary.main}`})),R=o(I)(({theme:e})=>({border:`1px solid ${e.palette.success.main}`})),z=o(I)(({theme:e})=>({border:`1px solid ${e.palette.text.secondary}`})),Ce=o(`div`)(({theme:e})=>({display:`flex`,gap:e.spacing(2),alignItems:`flex-start`,marginTop:e.spacing(8),flexWrap:`wrap`})),we=o(`div`)({width:`100%`}),Te=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(1),marginTop:e.spacing(2),width:`100%`})),B=o(`span`)(({theme:e})=>({fontFamily:`Sen`,fontSize:e.typography.body2.fontSize,fontStyle:`normal`,fontWeight:400,lineHeight:`20px`})),V=o(B)(({theme:e})=>({color:e.palette.primary.main})),H=o(B)(({theme:e})=>({color:e.palette.success.main})),U=o(B)(({theme:e})=>({color:e.palette.text.secondary})),W=o(B)(({theme:e})=>({color:e.palette.text.disabled})),G={project:`The project this API key can retrieve feature flags from`,environment:`The environment this API key can retrieve feature flag configuration from`,secret:`The API key secret`},K=({project:e,environment:t,secret:n})=>{let r=i(),a=s(r.breakpoints.up(`lg`));return(0,T.jsx)(we,{children:(0,T.jsx)(P.ArcherContainer,{strokeColor:r.palette.secondary.border,endMarker:!1,lineStyle:`curve`,children:(0,T.jsxs)(Se,{children:[(0,T.jsxs)(F,{children:[(0,T.jsx)(P.ArcherElement,{id:`project`,children:(0,T.jsx)(V,{children:e})}),(0,T.jsx)(W,{children:`:`}),(0,T.jsx)(P.ArcherElement,{id:`environment`,children:(0,T.jsx)(H,{children:t})}),(0,T.jsx)(W,{children:`.`}),(0,T.jsx)(P.ArcherElement,{id:`secret`,children:(0,T.jsx)(U,{children:n})})]}),a?(0,T.jsxs)(Ce,{children:[(0,T.jsx)(P.ArcherElement,{id:`project-description`,relations:[{targetId:`project`,targetAnchor:`bottom`,sourceAnchor:`top`,style:{strokeColor:r.palette.primary.main,strokeWidth:2}}],children:(0,T.jsx)(L,{children:G.project})}),(0,T.jsx)(P.ArcherElement,{id:`environment-description`,relations:[{targetId:`environment`,targetAnchor:`bottom`,sourceAnchor:`top`,style:{strokeColor:r.palette.success.main,strokeWidth:2}}],children:(0,T.jsx)(R,{children:G.environment})}),(0,T.jsx)(P.ArcherElement,{id:`secret-description`,relations:[{targetId:`secret`,targetAnchor:`bottom`,sourceAnchor:`top`,style:{strokeColor:r.palette.text.secondary,strokeWidth:2}}],children:(0,T.jsx)(z,{children:G.secret})})]}):(0,T.jsxs)(Te,{children:[(0,T.jsxs)(L,{children:[(0,T.jsx)(V,{children:e}),(0,T.jsx)(`div`,{children:G.project})]}),(0,T.jsxs)(R,{children:[(0,T.jsx)(H,{children:t}),(0,T.jsx)(`div`,{children:G.environment})]}),(0,T.jsxs)(z,{children:[(0,T.jsx)(F,{children:(0,T.jsx)(U,{children:n})}),(0,T.jsx)(`div`,{children:G.secret})]})]})]})})})},Ee={client:`Backend`,frontend:`Frontend`},De=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(3)})),q=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,alignItems:`flex-start`,gap:e.spacing(2),padding:e.spacing(2),borderRadius:e.shape.borderRadiusMedium,border:`1px solid ${e.palette.divider}`,backgroundColor:e.palette.background.elevation1})),J=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`column`,gap:e.spacing(.5)})),Y=o(`div`)(({theme:e})=>({fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body1.fontSize})),X=o(`p`)(({theme:e})=>({fontSize:e.typography.body2.fontSize})),Oe=o(`div`)({display:`flex`,width:`100%`,justifyContent:`flex-end`}),ke=({projectId:e,environments:t,sdk:n,onApiKeyChange:r,onNext:i})=>{let{trackEvent:a}=re(),{tokens:o,loading:s,refetch:c}=M(e),{createToken:l,loading:u}=N(),{setToastApiError:d}=h(),[f,m]=(0,w.useState)(t[0]||``),g=o.find(e=>e.environment===f&&e.type===n?.type),_=xe(g?.secret);if((0,w.useEffect)(()=>{r(g?.secret)},[g?.secret,r]),!n)return null;let v=async()=>{try{await l({environment:f,type:n.type,projects:[e],tokenName:`api-key-${e}-${f}`},e),c(),a(`onboarding`,{props:{eventType:`api-key-generated`}})}catch(e){d(ne(e))}},y=t.length>0?Math.max(...t.map(e=>e.length)):0,b=s||u,x=Ee[n.type];return(0,T.jsxs)(De,{children:[(0,T.jsxs)(q,{children:[(0,T.jsxs)(J,{children:[(0,T.jsx)(Y,{children:`First select environment`}),(0,T.jsx)(X,{children:`The environment connects to an SDK to retrieve information.`})]}),(0,T.jsx)(ee,{value:f,onChange:e=>m(e.target.value),size:`small`,inputProps:{"aria-label":`Select environment`},sx:{minWidth:`${y+5}ch`},children:t.map(e=>(0,T.jsx)(te,{value:e,children:e},e))})]}),(0,T.jsxs)(q,{children:[(0,T.jsx)(J,{children:_?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(Y,{children:[x,` API Key`]}),(0,T.jsxs)(X,{children:[`Here is your generated`,` `,x.toLowerCase(),` API key. We will use it to connect to the`,` `,(0,T.jsx)(`b`,{children:_.project}),` project in the`,` `,(0,T.jsx)(`b`,{children:_.environment}),` environment.`]})]}):(0,T.jsxs)(Y,{children:[`Then generate a `,x,` API Key`]})}),_?(0,T.jsx)(K,{project:_.project,environment:_.environment,secret:_.secret}):(0,T.jsxs)(p,{variant:`contained`,disabled:b,onClick:v,children:[`Generate `,x,` API Key`]})]}),_&&(0,T.jsx)(Oe,{children:(0,T.jsx)(p,{variant:`contained`,onClick:i,children:`Next`})})]})},Ae=({apiKey:e})=>e?(0,T.jsx)(ue,{color:`neutral`,children:(0,T.jsx)(ie,{title:e,sx:{maxWidth:200},children:e})}):null,je=e(ae(),1),Me={Android:`1\\. Install the SDK
|
|
2
|
-
|
|
3
|
-
\`\`\`gradle
|
|
4
|
-
implementation("io.getunleash:unleash-android:+")
|
|
5
|
-
\`\`\`
|
|
6
|
-
|
|
7
|
-
2\\. Enable required [permissions](https://developer.android.com/guide/topics/manifest/uses-permission-element)
|
|
8
|
-
|
|
9
|
-
\`\`\`xml
|
|
10
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
11
|
-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
12
|
-
\`\`\`
|
|
13
|
-
|
|
14
|
-
3\\. Initialize Unleash in your application
|
|
15
|
-
|
|
16
|
-
\`\`\`kotlin
|
|
17
|
-
class MyApplication: Application() {
|
|
18
|
-
val unleash: Unleash by lazy {
|
|
19
|
-
val instance = DefaultUnleash(
|
|
20
|
-
androidContext = this,
|
|
21
|
-
unleashConfig = UnleashConfig.newBuilder(appName = "unleash-onboarding-android")
|
|
22
|
-
.proxyUrl("<YOUR_API_URL>")
|
|
23
|
-
.clientKey("<YOUR_API_TOKEN>")
|
|
24
|
-
.build()
|
|
25
|
-
)
|
|
26
|
-
instance.start()
|
|
27
|
-
instance
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override fun onTerminate() {
|
|
31
|
-
super.onTerminate()
|
|
32
|
-
unleash.close()
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
\`\`\`
|
|
36
|
-
|
|
37
|
-
4\\. Check flag status
|
|
38
|
-
|
|
39
|
-
\`\`\`kotlin
|
|
40
|
-
class MainActivity : ComponentActivity() {
|
|
41
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
42
|
-
super.onCreate(savedInstanceState)
|
|
43
|
-
val unleashInstance = (application as MyApplication).unleash
|
|
44
|
-
|
|
45
|
-
setContent {
|
|
46
|
-
var flagStatus by remember { mutableStateOf("loading") }
|
|
47
|
-
LaunchedEffect(Unit) {
|
|
48
|
-
while (isActive) {
|
|
49
|
-
val isFlagEnabled = unleashInstance.isEnabled("<YOUR_FLAG>")
|
|
50
|
-
flagStatus = if (isFlagEnabled) {
|
|
51
|
-
"Flag is enabled"
|
|
52
|
-
} else {
|
|
53
|
-
"Flag is disabled"
|
|
54
|
-
}
|
|
55
|
-
delay(3.seconds)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
Text(text = flagStatus)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
\`\`\`
|
|
65
|
-
ℹ️ **Info:** The Android SDK takes at least 60 seconds to post metrics to Unleash.
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
---
|
|
69
|
-
- [SDK repository with documentation and example](https://github.com/Unleash/unleash-android)
|
|
70
|
-
- [Android SDK basic example](hhttps://github.com/Unleash/unleash-sdk-examples/tree/main/Android)
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
\`\`\`kotlin
|
|
75
|
-
if (unleash.isEnabled("<YOUR_FLAG>")) {
|
|
76
|
-
println("<YOUR_FLAG> is enabled")
|
|
77
|
-
} else {
|
|
78
|
-
println("<YOUR_FLAG> is disabled")
|
|
79
|
-
}
|
|
80
|
-
\`\`\`
|
|
81
|
-
|
|
82
|
-
ℹ️ **Info:** The Android SDK takes at least 60 seconds to post metrics to Unleash.
|
|
83
|
-
`,Go:`1\\. Install the SDK
|
|
84
|
-
\`\`\`sh
|
|
85
|
-
go get github.com/Unleash/unleash-go-sdk/v6@latest
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
88
|
-
2\\. Run Unleash
|
|
89
|
-
\`\`\`go
|
|
90
|
-
package main
|
|
91
|
-
|
|
92
|
-
import (
|
|
93
|
-
unleash "github.com/Unleash/unleash-go-sdk/v6"
|
|
94
|
-
"net/http"
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
func main() {
|
|
98
|
-
err := unleash.Initialize(
|
|
99
|
-
unleash.WithAppName("unleash-onboarding-golang"),
|
|
100
|
-
unleash.WithUrl("<YOUR_API_URL>"),
|
|
101
|
-
unleash.WithCustomHeaders(http.Header{"Authorization": {"<YOUR_API_TOKEN>"}}), // in production use environment variable
|
|
102
|
-
)
|
|
103
|
-
if err != nil {
|
|
104
|
-
panic(err)
|
|
105
|
-
}
|
|
106
|
-
defer unleash.Close()
|
|
107
|
-
unleash.WaitForReady() // optional: blocks until first sync
|
|
108
|
-
|
|
109
|
-
if unleash.IsEnabled("<YOUR_FLAG>", unleash.FeatureOptions{}) {
|
|
110
|
-
// New behaviour
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
\`\`\`
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
\`\`\`go
|
|
117
|
-
package main
|
|
118
|
-
|
|
119
|
-
import (
|
|
120
|
-
unleash "github.com/Unleash/unleash-go-sdk/v6"
|
|
121
|
-
"net/http"
|
|
122
|
-
"os"
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
func main() {
|
|
126
|
-
err := unleash.Initialize(
|
|
127
|
-
unleash.WithAppName("unleash-onboarding-golang"),
|
|
128
|
-
unleash.WithUrl("<YOUR_API_URL>"),
|
|
129
|
-
unleash.WithCustomHeaders(http.Header{
|
|
130
|
-
"Authorization": {os.Getenv("UNLEASH_API_KEY")},
|
|
131
|
-
}),
|
|
132
|
-
)
|
|
133
|
-
if err != nil {
|
|
134
|
-
panic(err)
|
|
135
|
-
}
|
|
136
|
-
defer unleash.Close()
|
|
137
|
-
|
|
138
|
-
if unleash.IsEnabled("<YOUR_FLAG>", unleash.FeatureOptions{}) {
|
|
139
|
-
// New behaviour
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
\`\`\`
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-go-sdk)
|
|
146
|
-
- [Go SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Go)
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
\`\`\`go
|
|
151
|
-
if unleash.IsEnabled("<YOUR_FLAG>", unleash.FeatureOptions{}) {
|
|
152
|
-
fmt.Println("<YOUR_FLAG> is enabled")
|
|
153
|
-
} else {
|
|
154
|
-
fmt.Println("<YOUR_FLAG> is disabled")
|
|
155
|
-
}
|
|
156
|
-
\`\`\`
|
|
157
|
-
`,JavaScript:`1\\. Install the SDK
|
|
158
|
-
\`\`\`sh
|
|
159
|
-
npm install unleash-proxy-client
|
|
160
|
-
\`\`\`
|
|
161
|
-
|
|
162
|
-
2\\. Run Unleash
|
|
163
|
-
\`\`\`js
|
|
164
|
-
const { UnleashClient } = require('unleash-proxy-client');
|
|
165
|
-
|
|
166
|
-
const unleash = new UnleashClient({
|
|
167
|
-
url: '<YOUR_API_URL>',
|
|
168
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
|
169
|
-
appName: 'unleash-onboarding-javascript',
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
unleash.start();
|
|
173
|
-
|
|
174
|
-
setInterval(() => {
|
|
175
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
176
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
177
|
-
} else {
|
|
178
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
179
|
-
}
|
|
180
|
-
}, 1000);
|
|
181
|
-
\`\`\`
|
|
182
|
-
---
|
|
183
|
-
\`\`\`js
|
|
184
|
-
const unleash = new UnleashClient({
|
|
185
|
-
url: '<YOUR_API_URL>',
|
|
186
|
-
clientKey: process.env.UNLEASH_API_TOKEN,
|
|
187
|
-
appName: 'unleash-onboarding-javascript',
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
setInterval(() => {
|
|
191
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
192
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
193
|
-
} else {
|
|
194
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
195
|
-
}
|
|
196
|
-
}, 1000);
|
|
197
|
-
|
|
198
|
-
unleash.start();
|
|
199
|
-
\`\`\`
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-proxy-client-js)
|
|
203
|
-
- [JavaScript SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/JavaScript)
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
|
-
\`\`\`js
|
|
208
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
209
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
210
|
-
} else {
|
|
211
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
212
|
-
}
|
|
213
|
-
\`\`\`
|
|
214
|
-
`,"Node.js":`1\\. Install the SDK
|
|
215
|
-
\`\`\`sh
|
|
216
|
-
npm install unleash-client
|
|
217
|
-
\`\`\`
|
|
218
|
-
|
|
219
|
-
2\\. Run Unleash
|
|
220
|
-
\`\`\`js
|
|
221
|
-
const { initialize } = require('unleash-client');
|
|
222
|
-
|
|
223
|
-
const unleash = initialize({
|
|
224
|
-
url: '<YOUR_API_URL>',
|
|
225
|
-
appName: 'unleash-onboarding-node',
|
|
226
|
-
customHeaders: {
|
|
227
|
-
Authorization: '<YOUR_API_TOKEN>' // in production use environment variable
|
|
228
|
-
},
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
setInterval(() => {
|
|
232
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
233
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
234
|
-
} else {
|
|
235
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
236
|
-
}
|
|
237
|
-
}, 1000);
|
|
238
|
-
\`\`\`
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
\`\`\`js
|
|
242
|
-
const { initialize } = require('unleash-client');
|
|
243
|
-
|
|
244
|
-
const unleash = initialize({
|
|
245
|
-
url: '<YOUR_API_URL>',
|
|
246
|
-
appName: 'unleash-onboarding-node',
|
|
247
|
-
customHeaders: { Authorization: process.env.UNLEASH_API_KEY },
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
unleash.on('synchronized', () => {
|
|
251
|
-
console.log('Unleash synchronized');
|
|
252
|
-
});
|
|
253
|
-
unleash.on('error', console.error);
|
|
254
|
-
unleash.on('warn', console.warn);
|
|
255
|
-
|
|
256
|
-
setInterval(() => {
|
|
257
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
258
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
259
|
-
} else {
|
|
260
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
261
|
-
}
|
|
262
|
-
}, 1000);
|
|
263
|
-
\`\`\`
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-node)
|
|
267
|
-
- [Node.js SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Node.js)
|
|
268
|
-
- [Node.js SDK tutorial](https://dev.to/reeshee/how-to-implement-feature-flags-in-nodejs-using-unleash-3907)
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
\`\`\`js
|
|
273
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
274
|
-
console.log('<YOUR_FLAG> is enabled');
|
|
275
|
-
} else {
|
|
276
|
-
console.log('<YOUR_FLAG> is disabled');
|
|
277
|
-
}
|
|
278
|
-
\`\`\`
|
|
279
|
-
`,Python:`1\\. Install the SDK
|
|
280
|
-
\`\`\`sh
|
|
281
|
-
pip install UnleashClient
|
|
282
|
-
\`\`\`
|
|
283
|
-
|
|
284
|
-
2\\. Run Unleash
|
|
285
|
-
\`\`\`python
|
|
286
|
-
from UnleashClient import UnleashClient
|
|
287
|
-
import time
|
|
288
|
-
|
|
289
|
-
client = UnleashClient(
|
|
290
|
-
url="<YOUR_API_URL>",
|
|
291
|
-
app_name="unleash-onboarding-python",
|
|
292
|
-
custom_headers={'Authorization': '<YOUR_API_TOKEN>'}) # in production use environment variable
|
|
293
|
-
|
|
294
|
-
client.initialize_client()
|
|
295
|
-
|
|
296
|
-
while True:
|
|
297
|
-
if client.is_enabled("<YOUR_FLAG>"):
|
|
298
|
-
print("<YOUR_FLAG> is enabled")
|
|
299
|
-
else:
|
|
300
|
-
print("<YOUR_FLAG> is disabled")
|
|
301
|
-
time.sleep(2)
|
|
302
|
-
\`\`\`
|
|
303
|
-
---
|
|
304
|
-
\`\`\`python
|
|
305
|
-
from UnleashClient import UnleashClient
|
|
306
|
-
import os
|
|
307
|
-
|
|
308
|
-
client = UnleashClient(
|
|
309
|
-
url="<YOUR_API_URL>",
|
|
310
|
-
app_name="unleash-onboarding-python",
|
|
311
|
-
custom_headers={'Authorization': os.getenv('UNLEASH_API_TOKEN')})
|
|
312
|
-
|
|
313
|
-
client.initialize_client()
|
|
314
|
-
|
|
315
|
-
\`\`\`
|
|
316
|
-
|
|
317
|
-
---
|
|
318
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-python)
|
|
319
|
-
- [Python SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Python)
|
|
320
|
-
- [How to Implement Feature Flags in Python](https://docs.getunleash.io/guides/implement-feature-flags-in-python)
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
\`\`\`python
|
|
325
|
-
if client.is_enabled("<YOUR_FLAG>"):
|
|
326
|
-
print("<YOUR_FLAG> is enabled")
|
|
327
|
-
else:
|
|
328
|
-
print("<YOUR_FLAG> is disabled")
|
|
329
|
-
\`\`\`
|
|
330
|
-
`,Ruby:`1\\. Install the SDK
|
|
331
|
-
\`\`\`sh
|
|
332
|
-
gem install unleash
|
|
333
|
-
\`\`\`
|
|
334
|
-
|
|
335
|
-
2\\. Run Unleash
|
|
336
|
-
\`\`\`rb
|
|
337
|
-
require 'unleash'
|
|
338
|
-
|
|
339
|
-
@unleash = Unleash::Client.new(
|
|
340
|
-
url: "<YOUR_API_URL>",
|
|
341
|
-
custom_http_headers: { 'Authorization': "<YOUR_API_TOKEN>" }, # in production use environment variable
|
|
342
|
-
app_name: 'unleash-onboarding-ruby',
|
|
343
|
-
instance_id: 'unleash-onboarding-ruby',
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
while true
|
|
347
|
-
if @unleash.is_enabled?("<YOUR_FLAG>")
|
|
348
|
-
puts "Flag is enabled"
|
|
349
|
-
else
|
|
350
|
-
puts "Flag is not enabled"
|
|
351
|
-
end
|
|
352
|
-
sleep 3
|
|
353
|
-
end
|
|
354
|
-
|
|
355
|
-
\`\`\`
|
|
356
|
-
---
|
|
357
|
-
\`\`\`rb
|
|
358
|
-
@unleash = Unleash::Client.new(
|
|
359
|
-
url: "<YOUR_API_URL>",
|
|
360
|
-
custom_http_headers: { 'Authorization': ENV['UNLEASH_API_TOKEN'] },
|
|
361
|
-
app_name: 'unleash-onboarding-ruby',
|
|
362
|
-
instance_id: 'unleash-onboarding-ruby',
|
|
363
|
-
)
|
|
364
|
-
\`\`\`
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-ruby)
|
|
368
|
-
- [Ruby example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Ruby)
|
|
369
|
-
- [How to Implement Feature Flags in Ruby](https://docs.getunleash.io/guides/implement-feature-flags-in-ruby)
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
373
|
-
\`\`\`rb
|
|
374
|
-
if @unleash.is_enabled?("<YOUR_FLAG>")
|
|
375
|
-
puts "<YOUR_FLAG> is enabled"
|
|
376
|
-
else
|
|
377
|
-
puts "<YOUR_FLAG> is disabled"
|
|
378
|
-
end
|
|
379
|
-
\`\`\`
|
|
380
|
-
`,Svelte:`1\\. Install the SDK
|
|
381
|
-
\`\`\`sh
|
|
382
|
-
npm install @unleash/proxy-client-svelte
|
|
383
|
-
\`\`\`
|
|
384
|
-
|
|
385
|
-
2\\. Initialize Unleash
|
|
386
|
-
\`\`\`svelte
|
|
387
|
-
<script>
|
|
388
|
-
import { FlagProvider } from '@unleash/proxy-client-svelte';
|
|
389
|
-
const { children } = $props();
|
|
390
|
-
|
|
391
|
-
const config = {
|
|
392
|
-
url: '<YOUR_API_URL>',
|
|
393
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
|
394
|
-
appName: 'unleash-onboarding-svelte',
|
|
395
|
-
};
|
|
396
|
-
<\/script>
|
|
397
|
-
|
|
398
|
-
<div class="app">
|
|
399
|
-
<FlagProvider {config}>
|
|
400
|
-
<main>
|
|
401
|
-
{@render children()}
|
|
402
|
-
</main>
|
|
403
|
-
</FlagProvider>
|
|
404
|
-
</div>
|
|
405
|
-
\`\`\`
|
|
406
|
-
|
|
407
|
-
3\\. Check feature flag status
|
|
408
|
-
\`\`\`svelte
|
|
409
|
-
<script lang="ts">
|
|
410
|
-
import { useFlag } from '@unleash/proxy-client-svelte';
|
|
411
|
-
const enabled = useFlag('<YOUR_FLAG>');
|
|
412
|
-
<\/script>
|
|
413
|
-
|
|
414
|
-
<section>
|
|
415
|
-
{#if $enabled}
|
|
416
|
-
<p><YOUR_FLAG> is enabled!</p>
|
|
417
|
-
{:else}
|
|
418
|
-
<p><YOUR_FLAG> is disabled!</p>
|
|
419
|
-
{/if}
|
|
420
|
-
</section>
|
|
421
|
-
\`\`\`
|
|
422
|
-
---
|
|
423
|
-
\`\`\`svelte
|
|
424
|
-
const config = {
|
|
425
|
-
url: '<YOUR_API_URL>',
|
|
426
|
-
clientKey: import.meta.env.VITE_UNLEASH_API_TOKEN,
|
|
427
|
-
appName: 'unleash-onboarding-svelte',
|
|
428
|
-
};
|
|
429
|
-
\`\`\`
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
- [SDK repository with documentation](https://github.com/Unleash/proxy-client-svelte)
|
|
433
|
-
- [Svelte example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Svelte)
|
|
434
|
-
- [How to Implement Feature Flags in SvelteKit](https://docs.getunleash.io/guides/implement-feature-flags-in-sveltekit)
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
\`\`\`svelte
|
|
439
|
-
<script lang="ts">
|
|
440
|
-
import { useFlag } from '@unleash/proxy-client-svelte';
|
|
441
|
-
const enabled = useFlag('<YOUR_FLAG>');
|
|
442
|
-
<\/script>
|
|
443
|
-
|
|
444
|
-
<section>
|
|
445
|
-
{#if $enabled}
|
|
446
|
-
<p><YOUR_FLAG> is enabled!</p>
|
|
447
|
-
{:else}
|
|
448
|
-
<p><YOUR_FLAG> is disabled!</p>
|
|
449
|
-
{/if}
|
|
450
|
-
</section>
|
|
451
|
-
\`\`\`
|
|
452
|
-
`,Vue:`1\\. Install the SDK
|
|
453
|
-
\`\`\`sh
|
|
454
|
-
npm install @unleash/proxy-client-vue
|
|
455
|
-
\`\`\`
|
|
456
|
-
|
|
457
|
-
2\\. Initialize Unleash
|
|
458
|
-
\`\`\`vue
|
|
459
|
-
<script setup lang="ts">
|
|
460
|
-
import { FlagProvider } from '@unleash/proxy-client-vue'
|
|
461
|
-
|
|
462
|
-
const config = {
|
|
463
|
-
url: '<YOUR_API_URL>',
|
|
464
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
|
465
|
-
appName: 'unleash-onboarding-vue',
|
|
466
|
-
}
|
|
467
|
-
<\/script>
|
|
468
|
-
|
|
469
|
-
<template>
|
|
470
|
-
<FlagProvider :config="config">
|
|
471
|
-
<!-- <YourComponent /> -->
|
|
472
|
-
</FlagProvider>
|
|
473
|
-
</template>
|
|
474
|
-
\`\`\`
|
|
475
|
-
|
|
476
|
-
3\\. Check feature flag status
|
|
477
|
-
\`\`\`vue
|
|
478
|
-
<script setup lang="ts">
|
|
479
|
-
import { useFlag } from '@unleash/proxy-client-vue'
|
|
480
|
-
|
|
481
|
-
const flagEnabled = useFlag('<YOUR_FLAG>')
|
|
482
|
-
<\/script>
|
|
483
|
-
|
|
484
|
-
<template>
|
|
485
|
-
<div>
|
|
486
|
-
<div v-if="flagEnabled"><YOUR_FLAG> is enabled</div>
|
|
487
|
-
<div v-else><YOUR_FLAG> is disabled</div>
|
|
488
|
-
</div>
|
|
489
|
-
</template>
|
|
490
|
-
\`\`\`
|
|
491
|
-
---
|
|
492
|
-
\`\`\`svelte
|
|
493
|
-
const config = {
|
|
494
|
-
url: '<YOUR_API_URL>',
|
|
495
|
-
clientKey: import.meta.env.VITE_UNLEASH_API_TOKEN,
|
|
496
|
-
appName: 'unleash-onboarding-vue',
|
|
497
|
-
}
|
|
498
|
-
\`\`\`
|
|
499
|
-
|
|
500
|
-
---
|
|
501
|
-
- [SDK repository with documentation](https://github.com/Unleash/proxy-client-vue)
|
|
502
|
-
- [Vue example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Vue)
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
\`\`\`vue
|
|
507
|
-
<script setup lang="ts">
|
|
508
|
-
import { useFlag } from '@unleash/proxy-client-vue'
|
|
509
|
-
|
|
510
|
-
const flagEnabled = useFlag('<YOUR_FLAG>')
|
|
511
|
-
<\/script>
|
|
512
|
-
|
|
513
|
-
<template>
|
|
514
|
-
<div>
|
|
515
|
-
<div v-if="flagEnabled"><YOUR_FLAG> is enabled</div>
|
|
516
|
-
<div v-else><YOUR_FLAG> is disabled</div>
|
|
517
|
-
</div>
|
|
518
|
-
</template>
|
|
519
|
-
\`\`\`
|
|
520
|
-
`,Flutter:`1\\. Install the SDK
|
|
521
|
-
\`\`\`sh
|
|
522
|
-
flutter pub add unleash_proxy_client_flutter
|
|
523
|
-
\`\`\`
|
|
524
|
-
|
|
525
|
-
2\\. Run Unleash
|
|
526
|
-
\`\`\`dart
|
|
527
|
-
import 'package:unleash_proxy_client_flutter/unleash_proxy_client_flutter.dart';
|
|
528
|
-
import 'dart:async';
|
|
529
|
-
|
|
530
|
-
final unleash = UnleashClient(
|
|
531
|
-
url: Uri.parse('<YOUR_API_URL>'),
|
|
532
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
|
533
|
-
appName: 'unleash-onboarding-flutter');
|
|
534
|
-
|
|
535
|
-
unleash.start();
|
|
536
|
-
|
|
537
|
-
Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
|
538
|
-
if (unleash.isEnabled('<YOUR_FLAG>')) {
|
|
539
|
-
print('<YOUR_FLAG> is enabled');
|
|
540
|
-
} else {
|
|
541
|
-
print('<YOUR_FLAG> is disabled');
|
|
542
|
-
}
|
|
543
|
-
});
|
|
544
|
-
\`\`\`
|
|
545
|
-
---
|
|
546
|
-
\`\`\`dart
|
|
547
|
-
import 'package:unleash_proxy_client_flutter/unleash_proxy_client_flutter.dart';
|
|
548
|
-
import 'dart:io';
|
|
549
|
-
|
|
550
|
-
final unleash = UnleashClient(
|
|
551
|
-
url: Uri.parse('<YOUR_API_URL>'),
|
|
552
|
-
clientKey: Platform.environment['UNLEASH_CLIENT_KEY']!,
|
|
553
|
-
appName: 'unleash-onboarding-flutter');
|
|
554
|
-
|
|
555
|
-
unleash.start();
|
|
556
|
-
\`\`\`
|
|
557
|
-
|
|
558
|
-
---
|
|
559
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash_proxy_client_flutter)
|
|
560
|
-
- [Flutter example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Flutter)
|
|
561
|
-
- [A/B Testing in Flutter using Unleash and Mixpanel](https://docs.getunleash.io/guides/implement-ab-test-in-flutter)
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
\`\`\`dart
|
|
566
|
-
if (unleash.isEnabled("<YOUR_FLAG>")) {
|
|
567
|
-
print("<YOUR_FLAG> is enabled");
|
|
568
|
-
} else {
|
|
569
|
-
print("<YOUR_FLAG> is disabled");
|
|
570
|
-
}
|
|
571
|
-
\`\`\`
|
|
572
|
-
`,Java:`1\\. Install the SDK
|
|
573
|
-
\`\`\`xml
|
|
574
|
-
<dependency>
|
|
575
|
-
<groupId>io.getunleash</groupId>
|
|
576
|
-
<artifactId>unleash-client-java</artifactId>
|
|
577
|
-
<version>LATEST</version>
|
|
578
|
-
</dependency>
|
|
579
|
-
\`\`\`
|
|
580
|
-
|
|
581
|
-
2\\. Run Unleash
|
|
582
|
-
\`\`\`java
|
|
583
|
-
UnleashConfig config = UnleashConfig.builder()
|
|
584
|
-
.appName("unleash-onboarding-java")
|
|
585
|
-
.instanceId("unleash-onboarding-instance")
|
|
586
|
-
.unleashAPI("<YOUR_API_URL>")
|
|
587
|
-
.apiKey("<YOUR_API_TOKEN>") // in production use environment variable
|
|
588
|
-
.build();
|
|
589
|
-
|
|
590
|
-
Unleash unleash = new DefaultUnleash(config);
|
|
591
|
-
|
|
592
|
-
while (true) {
|
|
593
|
-
boolean featureEnabled = unleash.isEnabled("<YOUR_FLAG>");
|
|
594
|
-
System.out.println("Feature enabled: " + featureEnabled);
|
|
595
|
-
Thread.sleep(1000);
|
|
596
|
-
}
|
|
597
|
-
\`\`\`
|
|
598
|
-
|
|
599
|
-
---
|
|
600
|
-
\`\`\`java
|
|
601
|
-
UnleashConfig config = UnleashConfig.builder()
|
|
602
|
-
.appName("unleash-onboarding-java")
|
|
603
|
-
.instanceId("unleash-onboarding-instance")
|
|
604
|
-
.unleashAPI("<YOUR_API_URL>")
|
|
605
|
-
.apiKey(System.getenv("UNLEASH_API_KEY"))
|
|
606
|
-
.build();
|
|
607
|
-
\`\`\`
|
|
608
|
-
|
|
609
|
-
---
|
|
610
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-java-sdk)
|
|
611
|
-
- [Java SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Java)
|
|
612
|
-
- [How to Implement Feature Flags in Java](https://docs.getunleash.io/guides/implement-feature-flags-in-java)
|
|
613
|
-
|
|
614
|
-
---
|
|
615
|
-
|
|
616
|
-
\`\`\`java
|
|
617
|
-
if (unleash.isEnabled("<YOUR_FLAG>")) {
|
|
618
|
-
System.out.println("<YOUR_FLAG> is enabled");
|
|
619
|
-
} else {
|
|
620
|
-
System.out.println("<YOUR_FLAG> is disabled");
|
|
621
|
-
}
|
|
622
|
-
\`\`\`
|
|
623
|
-
`,".NET":`1\\. Install the SDK
|
|
624
|
-
\`\`\`sh
|
|
625
|
-
dotnet add package unleash.client
|
|
626
|
-
// If you do not have a json library in your project:
|
|
627
|
-
dotnet add package Newtonsoft.Json
|
|
628
|
-
\`\`\`
|
|
629
|
-
|
|
630
|
-
2\\. Initialize Unleash
|
|
631
|
-
\`\`\`csharp
|
|
632
|
-
using Unleash;
|
|
633
|
-
using Unleash.ClientFactory;
|
|
634
|
-
|
|
635
|
-
public class Program
|
|
636
|
-
{
|
|
637
|
-
public static async Task Main()
|
|
638
|
-
{
|
|
639
|
-
var settings = new UnleashSettings()
|
|
640
|
-
{
|
|
641
|
-
AppName = "unleash-onboarding-dotnet",
|
|
642
|
-
UnleashApi = new Uri("<YOUR_API_URL>"),
|
|
643
|
-
CustomHttpHeaders = new Dictionary<string, string>()
|
|
644
|
-
{
|
|
645
|
-
{"Authorization","<YOUR_API_TOKEN>"} // in production use environment variable
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
|
|
649
|
-
var unleash = new DefaultUnleash(settings);
|
|
650
|
-
|
|
651
|
-
while (true) {
|
|
652
|
-
if (unleash.IsEnabled("<YOUR_FLAG>"))
|
|
653
|
-
{
|
|
654
|
-
Console.WriteLine("<YOUR_FLAG> is enabled");
|
|
655
|
-
}
|
|
656
|
-
else
|
|
657
|
-
{
|
|
658
|
-
Console.WriteLine("<YOUR_FLAG> is disabled");
|
|
659
|
-
}
|
|
660
|
-
await Task.Delay(1000);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
\`\`\`
|
|
666
|
-
|
|
667
|
-
---
|
|
668
|
-
\`\`\`csharp
|
|
669
|
-
var settings = new UnleashSettings()
|
|
670
|
-
{
|
|
671
|
-
AppName = "unleash-onboarding-dotnet",
|
|
672
|
-
UnleashApi = new Uri("<YOUR_API_URL>"),
|
|
673
|
-
CustomHttpHeaders = new Dictionary<string, string>()
|
|
674
|
-
{
|
|
675
|
-
{"Authorization",Environment.GetEnvironmentVariable("UNLEASH_API_KEY")}
|
|
676
|
-
}
|
|
677
|
-
};
|
|
678
|
-
\`\`\`
|
|
679
|
-
|
|
680
|
-
---
|
|
681
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-dotnet)
|
|
682
|
-
- [.NET/C# SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Csharp)
|
|
683
|
-
|
|
684
|
-
---
|
|
685
|
-
|
|
686
|
-
\`\`\`csharp
|
|
687
|
-
if (unleash.IsEnabled("<YOUR_FLAG>"))
|
|
688
|
-
{
|
|
689
|
-
Console.WriteLine("<YOUR_FLAG> is enabled");
|
|
690
|
-
}
|
|
691
|
-
else
|
|
692
|
-
{
|
|
693
|
-
Console.WriteLine("<YOUR_FLAG> is disabled");
|
|
694
|
-
}
|
|
695
|
-
\`\`\`
|
|
696
|
-
`,PHP:`1\\. Install the SDK
|
|
697
|
-
\`\`\`sh
|
|
698
|
-
composer require unleash/client guzzlehttp/guzzle symfony/cache
|
|
699
|
-
\`\`\`
|
|
700
|
-
or
|
|
701
|
-
\`\`\`sh
|
|
702
|
-
composer require unleash/client symfony/http-client nyholm/psr7 symfony/cache
|
|
703
|
-
\`\`\`
|
|
704
|
-
|
|
705
|
-
2\\. Initialize Unleash
|
|
706
|
-
\`\`\`php
|
|
707
|
-
<?php
|
|
708
|
-
|
|
709
|
-
use Unleash\\\\Client\\\\UnleashBuilder;
|
|
710
|
-
|
|
711
|
-
require 'vendor/autoload.php';
|
|
712
|
-
|
|
713
|
-
$unleash = UnleashBuilder::create()
|
|
714
|
-
->withAppName('unleash-onboarding-php')
|
|
715
|
-
->withAppUrl('<YOUR_API_URL>')
|
|
716
|
-
->withHeader('Authorization', '<YOUR_API_TOKEN>') // in production use environment variable
|
|
717
|
-
->withInstanceId('unleash-onboarding-instance')
|
|
718
|
-
->build();
|
|
719
|
-
|
|
720
|
-
while (true) {
|
|
721
|
-
if ($unleash->isEnabled('<YOUR_FLAG>')) {
|
|
722
|
-
echo '<YOUR_FLAG> is enabled' . PHP_EOL;
|
|
723
|
-
} else {
|
|
724
|
-
echo '<YOUR_FLAG> is disabled' . PHP_EOL;
|
|
725
|
-
}
|
|
726
|
-
sleep(1);
|
|
727
|
-
}
|
|
728
|
-
\`\`\`
|
|
729
|
-
---
|
|
730
|
-
\`\`\`php
|
|
731
|
-
$unleash = UnleashBuilder::create()
|
|
732
|
-
->withAppName('unleash-onboarding-php')
|
|
733
|
-
->withAppUrl('<YOUR_API_URL>')
|
|
734
|
-
->withHeader('Authorization', getenv('UNLEASH_API_TOKEN'))
|
|
735
|
-
->withInstanceId('unleash-onboarding-instance')
|
|
736
|
-
->build();
|
|
737
|
-
\`\`\`
|
|
738
|
-
|
|
739
|
-
---
|
|
740
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-php)
|
|
741
|
-
- [PHP SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/PHP)
|
|
742
|
-
|
|
743
|
-
---
|
|
744
|
-
|
|
745
|
-
\`\`\`php
|
|
746
|
-
if ($unleash->isEnabled('<YOUR_FLAG>')) {
|
|
747
|
-
echo '<YOUR_FLAG> is enabled' . PHP_EOL;
|
|
748
|
-
} else {
|
|
749
|
-
echo '<YOUR_FLAG> is disabled' . PHP_EOL;
|
|
750
|
-
}
|
|
751
|
-
\`\`\`
|
|
752
|
-
`,React:`1\\. Install the SDK
|
|
753
|
-
\`\`\`sh
|
|
754
|
-
npm install @unleash/proxy-client-react unleash-proxy-client
|
|
755
|
-
\`\`\`
|
|
756
|
-
|
|
757
|
-
2\\. Initialize Unleash
|
|
758
|
-
\`\`\`jsx
|
|
759
|
-
import React from 'react';
|
|
760
|
-
import { createRoot } from 'react-dom/client';
|
|
761
|
-
import { FlagProvider } from '@unleash/proxy-client-react';
|
|
762
|
-
|
|
763
|
-
const config = {
|
|
764
|
-
url: '<YOUR_API_URL>',
|
|
765
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variable
|
|
766
|
-
appName: 'unleash-onboarding-react',
|
|
767
|
-
};
|
|
768
|
-
|
|
769
|
-
const root = createRoot(document.getElementById('root'));
|
|
770
|
-
|
|
771
|
-
root.render(
|
|
772
|
-
<React.StrictMode>
|
|
773
|
-
<FlagProvider config={config}>
|
|
774
|
-
<App />
|
|
775
|
-
</FlagProvider>
|
|
776
|
-
</React.StrictMode>
|
|
777
|
-
);
|
|
778
|
-
\`\`\`
|
|
779
|
-
|
|
780
|
-
3\\. Check feature flag status
|
|
781
|
-
\`\`\`jsx
|
|
782
|
-
import { useFlag } from '@unleash/proxy-client-react';
|
|
783
|
-
|
|
784
|
-
export const TestComponent = () => {
|
|
785
|
-
const enabled = useFlag('<YOUR_FLAG>');
|
|
786
|
-
|
|
787
|
-
return enabled ? 'Flag is enabled' : 'Flag is disabled'
|
|
788
|
-
};
|
|
789
|
-
\`\`\`
|
|
790
|
-
---
|
|
791
|
-
\`\`\`jsx
|
|
792
|
-
const config = {
|
|
793
|
-
url: '<YOUR_API_URL>',
|
|
794
|
-
clientKey: process.env.UNLEASH_API_TOKEN,
|
|
795
|
-
appName: 'unleash-onboarding-react',
|
|
796
|
-
};
|
|
797
|
-
\`\`\`
|
|
798
|
-
|
|
799
|
-
---
|
|
800
|
-
- [SDK repository with documentation](https://github.com/Unleash/proxy-client-react)
|
|
801
|
-
- [React SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/React)
|
|
802
|
-
- [https://docs.getunleash.io/guides/implement-feature-flags-in-react](https://docs.getunleash.io/guides/implement-feature-flags-in-react)
|
|
803
|
-
|
|
804
|
-
---
|
|
805
|
-
|
|
806
|
-
\`\`\`jsx
|
|
807
|
-
const TestComponent = () => {
|
|
808
|
-
const enabled = useFlag('<YOUR_FLAG>');
|
|
809
|
-
|
|
810
|
-
if (enabled) {
|
|
811
|
-
return (<div>{'<YOUR_FLAG> is enabled'}</div>);
|
|
812
|
-
} else {
|
|
813
|
-
return (<div>{'<YOUR_FLAG> is disabled'}</div>);
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
\`\`\`
|
|
817
|
-
|
|
818
|
-
`,Rust:`1\\. Install the SDK
|
|
819
|
-
\`\`\`sh
|
|
820
|
-
cargo add unleash-api-client --features reqwest
|
|
821
|
-
cargo add serde --features derive
|
|
822
|
-
cargo add reqwest@0.12 --features json
|
|
823
|
-
cargo add tokio --features full
|
|
824
|
-
cargo add enum-map
|
|
825
|
-
\`\`\`
|
|
826
|
-
|
|
827
|
-
2\\. Run Unleash
|
|
828
|
-
\`\`\`rust
|
|
829
|
-
use enum_map::Enum;
|
|
830
|
-
use serde::{Deserialize, Serialize};
|
|
831
|
-
use std::error::Error;
|
|
832
|
-
use std::time::Duration;
|
|
833
|
-
use tokio::time::sleep;
|
|
834
|
-
use unleash_api_client::client::ClientBuilder;
|
|
835
|
-
use unleash_api_client::Client;
|
|
836
|
-
|
|
837
|
-
#[derive(Debug, Deserialize, Serialize, Enum, Clone)]
|
|
838
|
-
enum Flags {
|
|
839
|
-
#[serde(rename = "<YOUR_FLAG>")]
|
|
840
|
-
TestFlag,
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
#[tokio::main]
|
|
844
|
-
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|
845
|
-
let client: Client<Flags, reqwest::Client> = ClientBuilder::default()
|
|
846
|
-
.into_client(
|
|
847
|
-
"<YOUR_API_URL>",
|
|
848
|
-
"unleash-onboarding-rust",
|
|
849
|
-
"unleash-onboarding-instance",
|
|
850
|
-
Some("<YOUR_API_TOKEN>".to_owned()), // in production use environment variable
|
|
851
|
-
)?;
|
|
852
|
-
client.register().await?;
|
|
853
|
-
|
|
854
|
-
let (_, _) = tokio::join!(client.poll_for_updates(), async {
|
|
855
|
-
sleep(Duration::from_millis(1000)).await;
|
|
856
|
-
|
|
857
|
-
let is_enabled = client.is_enabled(Flags::TestFlag, None, true);
|
|
858
|
-
println!("\\nIs flag enabled: {}\\n", is_enabled);
|
|
859
|
-
|
|
860
|
-
sleep(Duration::from_millis(5000)).await;
|
|
861
|
-
|
|
862
|
-
client.stop_poll().await;
|
|
863
|
-
Ok::<(), Box<dyn Error + Send + Sync>>(())
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
Ok(())
|
|
867
|
-
}
|
|
868
|
-
\`\`\`
|
|
869
|
-
---
|
|
870
|
-
\`\`\`rust
|
|
871
|
-
let api_token = env::var("UNLEASH_API_TOKEN").expect("UNLEASH_API_TOKEN environment variable not set");
|
|
872
|
-
|
|
873
|
-
let client: Client<Flags, reqwest::Client> = ClientBuilder::default()
|
|
874
|
-
.into_client(
|
|
875
|
-
"<YOUR_API_URL>",
|
|
876
|
-
"unleash-onboarding-rust",
|
|
877
|
-
"unleash-onboarding-instance",
|
|
878
|
-
Some(api_token.to_owned()),
|
|
879
|
-
)?;
|
|
880
|
-
client.register().await?;
|
|
881
|
-
\`\`\`
|
|
882
|
-
|
|
883
|
-
---
|
|
884
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-rust)
|
|
885
|
-
- [Rust example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/Rust)
|
|
886
|
-
- [How to Implement Feature Flags in Rust](https://docs.getunleash.io/guides/implement-feature-flags-in-rust)
|
|
887
|
-
|
|
888
|
-
---
|
|
889
|
-
|
|
890
|
-
\`\`\`rust
|
|
891
|
-
enum Flags {
|
|
892
|
-
#[serde(rename = "<YOUR_FLAG>")]
|
|
893
|
-
TestFlag,
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
if client.is_enabled(Flags::TestFlag, None, true) {
|
|
897
|
-
println!("<YOUR_FLAG> is enabled");
|
|
898
|
-
} else {
|
|
899
|
-
println!("<YOUR_FLAG> is disabled");
|
|
900
|
-
}
|
|
901
|
-
\`\`\`
|
|
902
|
-
`,Swift:`1\\. Install the SDK
|
|
903
|
-
\`\`\`swift
|
|
904
|
-
.package(url: "https://github.com/Unleash/unleash-ios-sdk.git", from: "0.0.0")
|
|
905
|
-
\`\`\`
|
|
906
|
-
|
|
907
|
-
2\\. Run Unleash
|
|
908
|
-
\`\`\`swift
|
|
909
|
-
import Foundation
|
|
910
|
-
import UnleashProxyClientSwift
|
|
911
|
-
|
|
912
|
-
var unleash = UnleashProxyClientSwift.UnleashClient(
|
|
913
|
-
unleashUrl: "<YOUR_API_URL>",
|
|
914
|
-
clientKey: "<YOUR_API_TOKEN>", // in production use environment variable
|
|
915
|
-
appName: "unleash-onboarding-swift",
|
|
916
|
-
context: [:])
|
|
917
|
-
|
|
918
|
-
unleash.start()
|
|
919
|
-
|
|
920
|
-
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in
|
|
921
|
-
MainActor.assumeIsolated {
|
|
922
|
-
if unleash.isEnabled(name: "<YOUR_FLAG>") {
|
|
923
|
-
print("<YOUR_FLAG> is enabled")
|
|
924
|
-
} else {
|
|
925
|
-
print("<YOUR_FLAG> is disabled")
|
|
926
|
-
}
|
|
927
|
-
fflush(stdout)
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
RunLoop.main.run()
|
|
932
|
-
\`\`\`
|
|
933
|
-
ℹ️ **Info:** The Swift SDK takes at least 60 seconds to post metrics to Unleash.
|
|
934
|
-
---
|
|
935
|
-
---
|
|
936
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-ios-sdk)
|
|
937
|
-
---
|
|
938
|
-
|
|
939
|
-
\`\`\`swift
|
|
940
|
-
if unleash.isEnabled(name: "<YOUR_FLAG>") {
|
|
941
|
-
print("<YOUR_FLAG> is enabled")
|
|
942
|
-
} else {
|
|
943
|
-
print("<YOUR_FLAG> is disabled")
|
|
944
|
-
}
|
|
945
|
-
\`\`\`
|
|
946
|
-
|
|
947
|
-
ℹ️ **Info:** The Swift SDK takes at least 60 seconds to post metrics to Unleash.
|
|
948
|
-
`,"Next.js":`1\\. Install the SDK
|
|
949
|
-
\`\`\`sh
|
|
950
|
-
npm install @unleash/nextjs
|
|
951
|
-
\`\`\`
|
|
952
|
-
|
|
953
|
-
2\\. Wrap your app with FlagProvider
|
|
954
|
-
\`\`\`jsx
|
|
955
|
-
"use client";
|
|
956
|
-
|
|
957
|
-
import { FlagProvider } from '@unleash/nextjs/client';
|
|
958
|
-
|
|
959
|
-
const config = {
|
|
960
|
-
url: '<YOUR_API_URL>',
|
|
961
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variables
|
|
962
|
-
appName: 'unleash-onboarding-nextjs',
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
export default function Home() {
|
|
966
|
-
return (
|
|
967
|
-
<FlagProvider config={config}>
|
|
968
|
-
<App />
|
|
969
|
-
</FlagProvider>
|
|
970
|
-
);
|
|
971
|
-
}
|
|
972
|
-
\`\`\`
|
|
973
|
-
|
|
974
|
-
3\\. Check feature flag status
|
|
975
|
-
\`\`\`jsx
|
|
976
|
-
"use client";
|
|
977
|
-
|
|
978
|
-
import { useFlag } from '@unleash/nextjs/client';
|
|
979
|
-
|
|
980
|
-
export default function MyComponent() {
|
|
981
|
-
const isEnabled = useFlag('<YOUR_FLAG>');
|
|
982
|
-
|
|
983
|
-
if (isEnabled) {
|
|
984
|
-
return (<div>{'<YOUR_FLAG> is enabled'}</div>);
|
|
985
|
-
} else {
|
|
986
|
-
return (<div>{'<YOUR_FLAG> is disabled'}</div>);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
\`\`\`
|
|
990
|
-
---
|
|
991
|
-
\`\`\`jsx
|
|
992
|
-
// Set NEXT_PUBLIC_UNLEASH_FRONTEND_API_URL, NEXT_PUBLIC_UNLEASH_FRONTEND_API_TOKEN
|
|
993
|
-
// and NEXT_PUBLIC_UNLEASH_APP_NAME in your environment
|
|
994
|
-
export default function Home() {
|
|
995
|
-
return (
|
|
996
|
-
<FlagProvider>
|
|
997
|
-
<App />
|
|
998
|
-
</FlagProvider>
|
|
999
|
-
);
|
|
1000
|
-
}
|
|
1001
|
-
\`\`\`
|
|
1002
|
-
|
|
1003
|
-
---
|
|
1004
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-nextjs-sdk)
|
|
1005
|
-
- [Next.js SDK example](https://github.com/Unleash/unleash-sdk-examples/tree/main/Next.js)
|
|
1006
|
-
- [https://docs.getunleash.io/sdks/next-js](https://docs.getunleash.io/sdks/next-js)
|
|
1007
|
-
|
|
1008
|
-
---
|
|
1009
|
-
|
|
1010
|
-
\`\`\`jsx
|
|
1011
|
-
"use client";
|
|
1012
|
-
|
|
1013
|
-
import { useFlag } from '@unleash/nextjs/client';
|
|
1014
|
-
|
|
1015
|
-
export default function MyComponent() {
|
|
1016
|
-
const isEnabled = useFlag('<YOUR_FLAG>');
|
|
1017
|
-
|
|
1018
|
-
if (isEnabled) {
|
|
1019
|
-
return (<div>{'<YOUR_FLAG> is enabled'}</div>);
|
|
1020
|
-
} else {
|
|
1021
|
-
return (<div>{'<YOUR_FLAG> is disabled'}</div>);
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
\`\`\`
|
|
1025
|
-
`,"React Native":`1\\. Install the SDK
|
|
1026
|
-
\`\`\`sh
|
|
1027
|
-
npm install @unleash/unleash-react-native-sdk unleash-proxy-client
|
|
1028
|
-
\`\`\`
|
|
1029
|
-
|
|
1030
|
-
2\\. Initialize Unleash
|
|
1031
|
-
\`\`\`tsx
|
|
1032
|
-
import { FlagProvider, useFlag } from '@unleash/unleash-react-native-sdk';
|
|
1033
|
-
|
|
1034
|
-
const config = {
|
|
1035
|
-
url: '<YOUR_API_URL>',
|
|
1036
|
-
clientKey: '<YOUR_API_TOKEN>', // in production use environment variables
|
|
1037
|
-
appName: 'unleash-onboarding-react-native',
|
|
1038
|
-
};
|
|
1039
|
-
|
|
1040
|
-
function FlagStatus() {
|
|
1041
|
-
const isEnabled = useFlag('<YOUR_FLAG>');
|
|
1042
|
-
|
|
1043
|
-
if (isEnabled) {
|
|
1044
|
-
return <Text>{'<YOUR_FLAG> is enabled'}</Text>;
|
|
1045
|
-
} else {
|
|
1046
|
-
return <Text>{'<YOUR_FLAG> is disabled'}</Text>;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
export default function App() {
|
|
1051
|
-
return (
|
|
1052
|
-
<FlagProvider config={config}>
|
|
1053
|
-
<FlagStatus />
|
|
1054
|
-
</FlagProvider>
|
|
1055
|
-
);
|
|
1056
|
-
}
|
|
1057
|
-
\`\`\`
|
|
1058
|
-
---
|
|
1059
|
-
\`\`\`tsx
|
|
1060
|
-
// Use environment variables instead of hardcoded values.
|
|
1061
|
-
// The variable names depend on your setup (e.g. EXPO_PUBLIC_* for Expo,
|
|
1062
|
-
// or your chosen library for bare React Native).
|
|
1063
|
-
const config = {
|
|
1064
|
-
url: process.env.YOUR_UNLEASH_URL,
|
|
1065
|
-
clientKey: process.env.YOUR_UNLEASH_CLIENT_KEY,
|
|
1066
|
-
appName: 'unleash-onboarding-react-native',
|
|
1067
|
-
};
|
|
1068
|
-
\`\`\`
|
|
1069
|
-
|
|
1070
|
-
---
|
|
1071
|
-
- [SDK repository with documentation](https://github.com/Unleash/unleash-react-native-sdk)
|
|
1072
|
-
- [React Native SDK example](https://github.com/Unleash/unleash-sdk-examples/tree/main/ReactNative)
|
|
1073
|
-
- [https://docs.getunleash.io/sdks/react-native](https://docs.getunleash.io/sdks/react-native)
|
|
1074
|
-
|
|
1075
|
-
---
|
|
1076
|
-
|
|
1077
|
-
\`\`\`tsx
|
|
1078
|
-
import { useFlag } from '@unleash/unleash-react-native-sdk';
|
|
1079
|
-
|
|
1080
|
-
function MyComponent() {
|
|
1081
|
-
const isEnabled = useFlag('<YOUR_FLAG>');
|
|
1082
|
-
|
|
1083
|
-
if (isEnabled) {
|
|
1084
|
-
return <Text>{'<YOUR_FLAG> is enabled'}</Text>;
|
|
1085
|
-
} else {
|
|
1086
|
-
return <Text>{'<YOUR_FLAG> is disabled'}</Text>;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
\`\`\`
|
|
1090
|
-
`},Ne=o(`pre`)(({theme:e})=>({backgroundColor:e.palette.background.elevation1,padding:e.spacing(2),borderRadius:e.shape.borderRadius,overflow:`auto`,fontSize:e.typography.body2.fontSize,wordBreak:`break-all`,whiteSpace:`pre-wrap`,position:`relative`,maxHeight:e.spacing(90)})),Pe=o(c)(({theme:e})=>({position:`absolute`,top:e.spacing(1),right:e.spacing(1)})),Fe=({title:e,code:t})=>{let n=e=>()=>{(0,je.default)(e),r({type:`success`,text:`Copied to clipboard`})},{setToastData:r}=h();return(0,T.jsxs)(Ne,{children:[t,(0,T.jsx)(Pe,{title:e,arrow:!0,children:(0,T.jsx)(l,{onClick:n(t),size:`small`,children:(0,T.jsx)(oe,{})})})]})},Ie=({children:e,className:t})=>{let n=!!t,r=Array.isArray(e)?e[0]:e;return n&&typeof r==`string`?(0,T.jsx)(Fe,{code:r,title:`Copy code`}):(0,T.jsx)(`code`,{className:t,children:e})},Le=o(`span`)(({theme:e})=>{let t=n`
|
|
1091
|
-
0% {
|
|
1092
|
-
box-shadow:
|
|
1093
|
-
0 0 0 0 ${r(e.palette.primary.main,.5)},
|
|
1094
|
-
0 0 0 0 ${r(e.palette.primary.main,.3)};
|
|
1095
|
-
}
|
|
1096
|
-
70% {
|
|
1097
|
-
box-shadow:
|
|
1098
|
-
0 0 0 6px ${r(e.palette.primary.main,0)},
|
|
1099
|
-
0 0 0 12px ${r(e.palette.primary.main,0)};
|
|
1100
|
-
}
|
|
1101
|
-
100% {
|
|
1102
|
-
box-shadow:
|
|
1103
|
-
0 0 0 0 ${r(e.palette.primary.main,0)},
|
|
1104
|
-
0 0 0 0 ${r(e.palette.primary.main,0)};
|
|
1105
|
-
}
|
|
1106
|
-
`;return{display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,width:e.spacing(3),height:e.spacing(3),borderRadius:`50%`,backgroundColor:e.palette.primary.main,color:e.palette.common.white,animation:`${t} 1.8s ease-out infinite`,"@media (prefers-reduced-motion: reduce)":{animation:`none`}}}),Z=()=>(0,T.jsx)(Le,{children:(0,T.jsx)(le,{fontSize:`small`})}),Q=o(`div`)(({theme:e})=>({display:`flex`,flexDirection:`row`,gap:e.spacing(2),padding:e.spacing(2),fontSize:e.typography.body2.fontSize,borderRadius:e.shape.borderRadiusMedium,backgroundColor:e.palette.secondary.light,border:`1px solid ${e.palette.secondary.border}`})),Re=o(Q)(({theme:e})=>({backgroundColor:e.palette.success.light,border:`1px solid ${e.palette.success.border}`})),ze=o(`div`)(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(1)})),Be=o(ce)(({theme:e})=>({marginLeft:e.spacing(1),marginTop:e.spacing(1),width:e.spacing(3),height:e.spacing(3),color:e.palette.success.main})),Ve=o(u)(({theme:e})=>({marginTop:e.spacing(2),padding:e.spacing(2,3),"& .MuiAlert-message":{padding:0},"& .MuiAlert-icon":{marginRight:e.spacing(1)}})),He=({sdkConnected:e,connectedTitle:t,connectedBody:n,waitingTitle:r,waitingBody:i,showTroubleshooting:a,troubleshootingText:o})=>e?(0,T.jsxs)(Re,{children:[(0,T.jsx)(`div`,{children:(0,T.jsx)(Be,{})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`strong`,{children:t}),(0,T.jsx)(d,{variant:`body2`,color:`textSecondary`,children:n})]})]}):(0,T.jsxs)(Q,{children:[(0,T.jsx)(ze,{children:(0,T.jsx)(Z,{})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`strong`,{children:r}),(0,T.jsx)(d,{variant:`body2`,color:`textSecondary`,children:i}),a&&(0,T.jsx)(Ve,{severity:`warning`,children:o})]})]}),Ue=40,$=`md`,We=o(m,{shouldForwardProp:e=>e!==`dialogMaxWidth`&&e!==`fullHeight`})(({theme:e,dialogMaxWidth:t=170,fullHeight:n})=>({"& .MuiDialog-paper":{borderRadius:e.shape.borderRadiusLarge,maxWidth:e.spacing(t),width:`100%`,...n&&{height:`100%`},overflow:`hidden`,display:`flex`,flexDirection:`column`,backgroundColor:e.palette.background.sidebar}})),Ge=o(`div`)(({theme:e})=>({display:`flex`,flexShrink:0,borderBottom:`1px solid ${e.palette.divider}`})),Ke=o(`div`)(({theme:e})=>({flex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`,backgroundColor:e.palette.background.paper,paddingRight:e.spacing(1.5),"& .closeButton":{[e.breakpoints.up($)]:{display:`none`}}})),qe=o(`h2`)(({theme:e})=>({margin:0,padding:e.spacing(1.5,3),fontWeight:e.typography.fontWeightBold,fontSize:e.typography.body1.fontSize,lineHeight:e.spacing(2.75)})),Je=o(`div`)(({theme:e})=>({width:e.spacing(Ue),flexShrink:0,backgroundColor:e.palette.background.sidebar,color:e.palette.primary.contrastText,display:`flex`,alignItems:`center`,justifyContent:`flex-end`,paddingRight:e.spacing(1.5),[e.breakpoints.down($)]:{display:`none`}})),Ye=o(`div`)({display:`flex`,flex:1,overflow:`hidden`}),Xe=o(`div`)(({theme:e})=>({flex:1,overflowY:`auto`,backgroundColor:e.palette.background.paper})),Ze=o(`aside`)(({theme:e})=>({width:e.spacing(Ue),flexShrink:0,backgroundColor:e.palette.background.sidebar,color:e.palette.primary.contrastText,[e.breakpoints.down($)]:{display:`none`}})),Qe=({open:e,onClose:t,title:n,aside:r,children:i,maxWidth:a,fullHeight:o})=>(0,T.jsxs)(We,{open:e,onClose:t,maxWidth:!1,dialogMaxWidth:a,fullHeight:o,children:[(0,T.jsxs)(Ge,{children:[(0,T.jsxs)(Ke,{children:[(0,T.jsx)(qe,{children:n}),(0,T.jsx)(l,{size:`small`,className:`closeButton`,onClick:t,children:(0,T.jsx)(_,{})})]}),(0,T.jsx)(Je,{children:(0,T.jsx)(l,{size:`small`,onClick:t,sx:{color:`inherit`},children:(0,T.jsx)(_,{})})})]}),(0,T.jsxs)(Ye,{children:[(0,T.jsx)(Xe,{children:i}),(0,T.jsx)(Ze,{children:r})]})]});export{Me as a,K as c,ye as d,pe as f,fe as g,E as h,Ie as i,N as l,D as m,He as n,Ae as o,O as p,Z as r,ke as s,Qe as t,M as u};
|