theme.keycloak.v2.admin.resources.assets.ScopeForm-CeG_pANI.js Maven / Gradle / Ivy
import{jsx as a,jsxs as c,Fragment as x}from"react/jsx-runtime";import{useEffect as T}from"react";import{a as C,g as V,c as k,aG as D,aH as O,aI as E,ab as g,aJ as t,Q as L,F as A,y as r,v as f,O as N,A as P,h as j,i as q,L as w,aw as G}from"./main-C7ps2lmX.js";import{g as R}from"./utils-DeGqqWSp.js";import{D as i}from"./SwitchControl-C_9Y74oV.js";import{b as S}from"./ClientScopeTypes-BnGjMgG5.js";import{F as $}from"./FormAccess-DyLNkc18.js";const X=({clientScope:o,save:h})=>{const{t:e}=C(),l=V({mode:"onChange"}),{control:m,handleSubmit:F,setValue:p,formState:I}=l,{realm:v}=k(),u=D(),d=O()(E.DynamicScopes),b=g({control:m,name:t("attributes.display.on.consent.screen"),defaultValue:o?.attributes?.["display.on.consent.screen"]??"true"}),H=g({control:m,name:t("attributes.is.dynamic.scope"),defaultValue:"false"}),y=(n,s)=>p(t("attributes.dynamic.scope.regexp"),s?`${n}:*`:n);return T(()=>{L(o??{},p)},[o]),a($,{role:"manage-clients",onSubmit:F(h),isHorizontal:!0,children:c(A,{...l,children:[a(r,{name:"name",label:e("name"),labelIcon:e("scopeNameHelp"),rules:{required:{value:!0,message:e("required")},onChange:n=>{d&&y(n.target.validated,!0)}}}),d&&c(x,{children:[a(i,{name:t("attributes.is.dynamic.scope"),label:e("dynamicScope"),labelIcon:e("dynamicScopeHelp"),onChange:(n,s)=>{y(s&&l.getValues("name")||"",s)},stringify:!0}),H==="true"&&a(r,{name:t("attributes.dynamic.scope.regexp"),label:e("dynamicScopeFormat"),labelIcon:e("dynamicScopeFormatHelp"),isDisabled:!0})]}),a(r,{name:"description",label:e("description"),labelIcon:e("scopeDescriptionHelp"),rules:{maxLength:{value:255,message:e("maxLength")}}}),a(f,{id:"kc-type",name:"type",label:e("type"),labelIcon:e("scopeTypeHelp"),controller:{defaultValue:S[0]},options:S.map(n=>({key:n,value:e(`clientScopeType.${n}`)}))}),!o&&a(f,{id:"kc-protocol",name:"protocol",label:e("protocol"),labelIcon:e("protocolHelp"),controller:{defaultValue:u[0]},options:u.map(n=>({key:n,value:R(e,n)}))}),a(i,{name:t("attributes.display.on.consent.screen"),defaultValue:b,label:e("displayOnConsentScreen"),labelIcon:e("displayOnConsentScreenHelp"),stringify:!0}),b==="true"&&a(N,{name:t("attributes.consent.screen.text"),label:e("consentScreenText"),labelIcon:e("consentScreenTextHelp")}),a(i,{name:t("attributes.include.in.token.scope"),label:e("includeInTokenScope"),labelIcon:e("includeInTokenScopeHelp"),stringify:!0}),a(r,{name:t("attributes.gui.order"),label:e("guiOrder"),labelIcon:e("guiOrderHelp"),type:"number",min:0}),c(P,{children:[a(j,{formState:I,children:e("save")}),a(q,{variant:"link",component:n=>a(w,{...n,to:G({realm:v})}),children:e("cancel")})]})]})})};export{X as S};
//# sourceMappingURL=ScopeForm-CeG_pANI.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy