1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9753],{207:e=>{e.exports={circle:"AccessTokenStatus_circle__7_ntG","status--expired":"AccessTokenStatus_status--expired__oyo0c","status--revoked":"AccessTokenStatus_status--revoked__se3Ts","status--active":"AccessTokenStatus_status--active__M_ZqI"}},286:e=>{e.exports={root:"CreatePersonalAccessTokenForm_root__kGqDc",submitButton:"CreatePersonalAccessTokenForm_submitButton__lIO_J"}},16660:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ApiTokens:()=>U,default:()=>X});var n=a(80263),s=a(94386),r=a(97930),o=a(33894),i=a(43959),l=a(77665),c=a(136),u=a(61528),d=a(66377),p=a(78852),x=a(50016),m=a(13463),h=a(53239),j=a(50005),v=a(42173),_=a(98720),k=a(19009),y=a(24575),C=a(35951),g=a(89654),b=a(51143);let f=e=>({userEmail:e,scope:C.B.PersonalAccessTokens}),A=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],{api:t}=(0,g.gf)(),{user:a}=(0,b.IE)();return(0,_.I)({queryKey:[f(a?.email)],queryFn:()=>t.getPersonalAccessTokens(),enabled:e})};var P=a(54923),S=a(7060),T=a(59486),w=a(92839),F=a(91840),I=a(94002),N=a(22269),E=a(6750),q=a(84001),B=a(286),K=a.n(B);let O={name:""},V=e=>{let{onCloseAttempt:t,onSubmit:a}=e,{locale:s,t:i}=(0,m.c3)();return(0,n.jsx)(q.l1,{initialValues:O,onSubmit:async(e,n)=>{let{setSubmitting:s}=n;try{await a?.(e.name,e.expiration_date),t?.()}catch(e){o.vF.error(e)}finally{s(!1)}},children:e=>{let{isSubmitting:t,values:a,handleChange:o,setFieldValue:l}=e;return(0,n.jsx)(q.lV,{className:K().root,children:(0,n.jsxs)(r.NP,{autoFlow:"column",columns:"1fr auto auto",horizontalSpacing:1,verticalSpacing:1,children:[(0,n.jsx)(N.k,{autoComplete:"off",autoFocus:!0,controlledWhenFocused:!0,label:i("API token name"),name:"name",required:!0,value:a.name,onChange:o}),(0,n.jsx)(I.l,{label:i("Expiration date"),locale:s,name:"expiration_date",value:a.expiration_date??"",onChange:e=>l("expiration_date",e?(0,E.d$)(e):void 0)}),(0,n.jsx)(F.K,{className:K().submitButton,disabled:!a.name,iconComponent:w.iWP,loading:t,title:i("Create API token"),type:"submit"})]})})}})};V.displayName="ActionForm";var M=a(33698),z=a(45740),R=a(40516),W=a(93107),H=a(65963),L=a(3638),G=a(207),$=a.n(G);let Q=e=>{let{status:t}=e,{t:a}=(0,m.c3)();return(0,n.jsxs)("span",{className:(0,L.A)($()[`status--${t}`]),children:[(0,n.jsx)("span",{className:$().circle}),(0,n.jsx)("span",{children:"active"===t?a("Active"):"expired"===t?a("Expired"):"revoked"===t?a("Revoked"):(0,H.ZH)(t)})]})};var Y=a(30714),Z=a.n(Y);let D=()=>{let{locale:e,t}=(0,m.c3)(),{data:a,isFetching:s}=A(!0),r=(()=>{let{api:e}=(0,g.gf)(),t=(0,k.jE)();return(0,y.n)({mutationFn:async t=>{let{id:a}=t;return await e.deletePersonalAccessToken(a)},onError:e=>o.vF.error(e),onSuccess(){let e=(0,b.VM)(t);t.invalidateQueries({queryKey:[f(e?.email)]})}})})(),i=(0,h.useMemo)(()=>[{accessor:"name",width:"*",renderCell:e=>{let{row:t}=e;return t.name},renderHeading:()=>t("Name")},{accessor:"state",width:"100px",renderCell:e=>{let{row:t}=e;return(0,n.jsx)(Q,{status:t.state})},renderHeading:()=>t("State")},{accessor:"created_at",width:"140px",renderCell:t=>{let{row:a}=t;return(0,W.ik)(a.created_at,{locale:e})},renderHeading:()=>t("Created at")},{accessor:"expiration_date",width:"140px",renderCell:t=>{let{row:a}=t;return a.expiration_date&&(0,W.ZP)(a.expiration_date,{locale:e})},renderHeading:()=>t("Expiration date")},{accessor:"action",width:"40px",renderCell:e=>{let{rowId:a}=e;return(0,n.jsx)(F.K,{"aria-label":t("Remove"),className:Z().actionButton,iconComponent:w.CA7,muted:!0,size:"small",variant:"transparent",onClick:async()=>{await (0,M.db)({content:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{children:t("API token will be deleted.")}),(0,n.jsx)("br",{}),(0,n.jsx)("div",{children:t("Are you sure?")})]})})&&r.mutate({id:a},{onSuccess(){o.vF.success("API token has been deleted")}})}})}}],[e,t]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.K,{mt:2}),a?(0,n.jsx)(z.bQ,{columns:i,data:a?.items,fullWidthLoadMore:!0,isLoading:s}):(0,n.jsx)(R.n,{})]})},U=()=>{let{t:e}=(0,m.c3)(),{user:t}=(0,b.IE)();if(!t)throw Error("No user available");let a=(0,h.useRef)(null),{isOpen:_,toggle:C,close:A}=(0,i.F)(),S=(0,P.UV)(e),w=(()=>{let{api:e}=(0,g.gf)(),t=(0,k.jE)();return(0,y.n)({mutationFn:async t=>await e.createPersonalAccessToken(t),onError:e=>o.vF.error(e),onSuccess(){let e=(0,b.VM)(t);t.invalidateQueries({queryKey:[f(e?.email)]})}})})(),[F,I]=(0,h.useState)(),N=(0,h.useCallback)(async(e,t)=>{try{let a=async e=>{A(),I(e.token)};w.mutate({name:e,expiration_date:t},{onSuccess:a})}catch(e){o.vF.error(e)}},[]),E=(0,h.useCallback)(e=>I(e.target.value),[]),q=e("API tokens"),B=(0,h.useMemo)(()=>({title:q}),[q]),K=(0,h.useMemo)(()=>[S.Root,S.UserProfile,{text:q}],[S,q]);return(0,n.jsxs)(T.u,{topLine:(0,n.jsx)(j.I,{pageName:"apiTokens",values:K}),children:[(0,n.jsx)(v.t,{fields:B,microdata:(0,u.Oq)(K),pageName:"apiTokens"}),(0,n.jsx)(p.K,{mt:2}),F?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(p.K,{mt:3}),(0,n.jsx)(x.V,{variant:"h2",children:e("Your token:")}),(0,n.jsx)(p.K,{mt:2}),(0,n.jsx)(l.y,{canClear:!0,canCopy:!0,value:F,onChange:E}),(0,n.jsx)(p.K,{mt:2}),(0,n.jsx)(c.p,{type:"warning",children:e("Make sure you save it â the token will have to be re-generated if lost")})]}):(0,n.jsxs)(r.NP,{alignItems:"center",columns:"1fr auto",horizontalSpacing:1,verticalSpacing:1,children:[(0,n.jsx)(x.V,{variant:"body1",children:e("You can generate API token for each application you use that needs access to the Volumo API")}),(0,n.jsx)(s.$,{innerRef:a,size:"small",onClick:C,children:e("Generate API token")})]}),(0,n.jsx)(p.K,{mt:3}),(0,n.jsx)(x.V,{variant:"h2",children:e("Your API tokens:")}),(0,n.jsx)(p.K,{mt:2}),(0,n.jsx)(D,{}),(0,n.jsx)(d.z,{anchorElement:a.current??void 0,closeOnClickOutside:!0,inPortal:!0,open:_,preferredDirection:"bottomLeft",onCloseAttempt:A,children:(0,n.jsx)(V,{onSubmit:N})})]})};U.getConfig=()=>({isAuthenticationRequired:!0}),U.renderInLayout=S.P;let X=U},25555:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/profile/api-tokens",function(){return a(16660)}])},30714:e=>{e.exports={actionButton:"PersonalAccessTokensTable_actionButton__zjq3O"}},32081:e=>{e.exports={copyButton:"CopyTextInputBase_copyButton__GOcjn",copied:"CopyTextInputBase_copied__rqVVo"}},67921:(e,t,a)=>{"use strict";a.d(t,{W:()=>x});var n=a(80263),s=a(92839),r=a(31322),o=a(36316),i=a(13463),l=a(27129),c=a(3638),u=a(53239),d=a(32081),p=a.n(d);let x=e=>{let{canCopy:t=!0,copiedDelay:a=3e3,postfix:d,...x}=e,{t:m}=(0,i.c3)(),[h,j]=(0,u.useState)(!1),v=(0,u.useRef)(),_=(0,u.useCallback)(()=>{void 0!==x.value&&((0,l.lW)(`${x.value}`),j(!0),clearTimeout(v.current),v.current=setTimeout(()=>j(!1),a))},[x.value]);return(0,n.jsx)(o.l,{readOnly:!0,...x,postfix:(0,n.jsxs)(n.Fragment,{children:[d,t&&(0,n.jsx)(r.n,{className:(0,
1c.A)(p().copyButton,h&&p().copied),iconComponent:s.bzS,onClick:_,children:m(h?"Copied!":"Copy")})]}),validationState:h?"success":x.validationState})}},77665:(e,t,a)=>{"use strict";a.d(t,{y:()=>d});var n=a(80263),s=a(67921),r=a(904),o=a(53239);let i=e=>{let{className:t,error:a,footnote:o,inputContainerClassName:i,label:l,labelOption:c,mini:u,required:d,reserveErrorSpace:p,tooltip:x,...m}=e;return(0,n.jsx)(r.v,{className:t,disabled:m.disabled,error:a,footnote:o,forId:m.id,label:l,labelOption:c,mini:u,required:d,reserveErrorSpace:p,tooltip:x,children:(0,n.jsx)(s.W,{className:i,validationState:a?"error":"normal",...m})})};var l=a(92839),c=a(31322);let u=e=>{let{onClick:t}=e;return(0,n.jsx)(c.n,{"aria-label":"Toggle password visibility",iconComponent:l.r9M,onClick:t})},d=e=>{let[t,a]=(0,o.useState)(!1);return(0,n.jsx)(i,{readOnly:!1,...e,canCopy:e.canCopy??!1,postfix:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u,{onClick:()=>a(e=>!e)}),e.postfix]}),type:t?"text":"password"})}}},e=>{e.O(0,[4001,7236,8288,5720,7874,4802,5599,7095,1488,5740,4002,636,6593,8792],()=>e(e.s=25555)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.