All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.ImportForm-DKqAXas0.js Maven / Gradle / Ivy

import{jsxs as i,Fragment as F,jsx as r}from"react/jsx-runtime";import{u as v,a as y,d as b,c as w,g as S,f as A,P as x,F as T,x as j,A as E,p as I,h as V,L as P,aQ as k,Q as L,a6 as O,a7 as H,a8 as N,S as U,j as $,aR as z}from"./index-C1LIsRX7.js";import{useState as D}from"react";import{F as K}from"./FormAccess-BcY70QlP.js";import{F as Q}from"./FileUploadForm-DXJKFbGA.js";import{V as R}from"./ViewHeader-qjLr6U82.js";import{C as W,a as B}from"./ClientDescription-fxtapCoH.js";import{L as G}from"./CodeEditor-CIeIZGz7.js";import"react-dom";import"./copy-icon-DOS8MmN7.js";import"./FileUpload-T43Q4AfB.js";import"./SwitchControl-C3zDl-9W.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";const J=a=>a.match(/(<.[^(><.)]+>)/g);function ce(){const{adminClient:a}=v(),{t:s}=y(),c=b(),{realm:o}=w(),n=S(),{handleSubmit:m,setValue:p,formState:d}=n,[u,h]=D({}),{addAlert:f,addError:l}=A(),g=async t=>{try{const e=await C(t);L(e,p),h(e)}catch(e){l("importParseError",e)}};async function C(t){if(!J(t))return JSON.parse(t);const e=await O(`${N(a.baseUrl)}admin/realms/${o}/client-description-converter`,{method:"POST",body:t,headers:H(await a.getAccessToken())});if(!e.ok)throw new Error(`Server responded with invalid status: ${e.statusText}`);return e.json()}return i(F,{children:[r(R,{titleKey:"importClient",subKey:"clientsExplain"}),r(x,{variant:"light",children:r(K,{isHorizontal:!0,onSubmit:m(async t=>{try{const e=await a.clients.create({...u,...U({...t,attributes:t.attributes||{}})});f(s("clientImportSuccess"),$.success),c(z({realm:o,clientId:e.id,tab:"settings"}))}catch(e){l("clientImportError",e)}}),role:"manage-clients",children:i(T,{...n,children:[r(Q,{id:"realm-file",language:G.json,extension:".json,.xml",helpText:s("helpFileUploadClient"),onChange:g}),r(W,{hasConfigureAccess:!0}),r(j,{name:"protocol",label:s("type"),readOnly:!0}),r(B,{unWrap:!0}),i(E,{children:[r(I,{formState:d,allowInvalid:!0,allowNonDirty:!0,children:s("save")}),r(V,{variant:"link",component:t=>r(P,{...t,to:k({realm:o})}),children:s("cancel")})]})]})})})]})}export{ce as default};
//# sourceMappingURL=ImportForm-DKqAXas0.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy