UNPKG

@clerk/clerk-js

Version:
1 lines 1.89 kB
"use strict";(globalThis.webpackChunk_clerk_clerk_js=globalThis.webpackChunk_clerk_clerk_js||[]).push([["642"],{3250:function(e,i,o){o.r(i),o.d(i,{RevokeAPIKeyConfirmationModal:()=>h});var t=o(9109),r=o(3799),l=o(1019),n=o(4204),a=o(2418),s=o(431),d=o(9460),p=o(8487),c=o(6459),u=o(7703),k=o(6788);let h=({subject:e,isOpen:i,onOpen:o,onClose:h,apiKeyId:m,apiKeyName:y,modalRoot:b})=>{let f=(0,r.cL)(),{mutate:v}=(0,l.kY)(),{t:C}=(0,u.zJ)(),R=(0,k.Yp)("apiKeyRevokeConfirmation","",{type:"text",label:'Type "Revoke" to confirm',placeholder:"Revoke",isRequired:!0}),g=R.value===C((0,u.u1)("apiKeys.revokeConfirmation.confirmationText")),K=async i=>{i.preventDefault(),m&&g&&(await f.apiKeys.revoke({apiKeyID:m}),v({key:"api-keys",subject:e}),h())};return i?(0,t.tZ)(c.Modal,{handleOpen:o,handleClose:h,canCloseModal:!1,portalRoot:b,containerSx:[{alignItems:"center"},b?e=>({position:"absolute",right:0,bottom:0,backgroundColor:"inherit",backdropFilter:`blur(${e.sizes.$2})`,display:"flex",justifyContent:"center",minHeight:"100%",height:"100%",width:"100%",borderRadius:e.radii.$lg}):{}],children:(0,t.tZ)(a.Z.Root,{role:"alertdialog",elementDescriptor:n.descriptors.apiKeysRevokeModal,children:(0,t.tZ)(a.Z.Content,{sx:e=>({textAlign:"left",padding:`${e.sizes.$4} ${e.sizes.$5} ${e.sizes.$4} ${e.sizes.$6}`}),children:(0,t.tZ)(p.Y,{headerTitle:(0,u.u1)("apiKeys.revokeConfirmation.formTitle",{apiKeyName:y}),headerSubtitle:(0,u.u1)("apiKeys.revokeConfirmation.formHint"),children:(0,t.BX)(s.l.Root,{onSubmit:K,children:[(0,t.tZ)(s.l.ControlRow,{elementId:R.id,elementDescriptor:n.descriptors.apiKeysRevokeModalInput,children:(0,t.tZ)(s.l.PlainInput,{...R.props})}),(0,t.tZ)(d.A,{submitLabel:(0,u.u1)("apiKeys.revokeConfirmation.formButtonPrimary__revoke"),colorScheme:"danger",isDisabled:!g,onReset:h,elementDescriptor:n.descriptors.apiKeysRevokeModalSubmitButton})]})})})})}):null}}}]);