Files
ambersplace.net/cohost-archive/static/client-preact-components-pages-moderation-manage-user-purge-user.bd958b7f0dd7b5dadc3a.js

2 lines
4.9 KiB
JavaScript

"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[1936],{2735:function(e,r,t){t.d(r,{Qj:function(){return O},zx:function(){return k}});var n=t(65443),o=t.n(n),a=t(94159),l=t(6285);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},c.apply(this,arguments)}const s=l.z.enum(["pill","roundrect","authn"]),u=l.z.enum(["cherry","strawberry","mango","not-black","red","green","accent","secondary","authn-primary","authn-other"]),i=(l.z.object({buttonStyle:s,color:u,className:l.z.string().optional()}),o()("bg-notWhite","hover:text-notWhite")),d=o()("font-atkinson","font-bold","rounded-full","border-2"),b=o()("body-2","rounded-lg"),g=o()("flex","h-12","items-center","justify-center","rounded-lg","px-6","text-lg"),h=o()("border-cherry","hover:bg-cherry","text-cherry","active:bg-cherry-600","active:border-cherry-600","disabled:text-cherry-300","disabled:border-cherry-300","focus:outline-cherry","focus:ring-cherry",i),m=o()("border-strawberry","hover:bg-strawberry","text-strawberry","active:bg-strawberry-600","active:border-strawberry-600","disabled:text-strawberry-300","disabled:border-strawberry-300","focus:outline-strawberry","focus:ring-strawberry",i),y=o()("border-red","hover:bg-red","text-red","active:bg-red-600","active:border-red-600","disabled:text-red-300","disabled:border-red-300","focus:outline-red",i),f=o()("border-green","hover:bg-green","text-green","active:bg-green-600","active:border-green-600","disabled:text-green-300","disabled:border-green-300","focus:outline-green",i),p=o()("border-mango","hover:bg-mango","text-mango","bg-notBlack","hover:text-notBlack"),v=o()("border-notBlack","hover:bg-notBlack","text-notBlack","focus:outline-notBlack","focus:ring-notBlack",i),x=o()("border-accent","text-accent","bg-foreground","hover:bg-accent","hover:text-text"),w=o()("bg-secondary","text-notWhite","dark:text-notBlack","hover:bg-secondary-600"),E=o()("bg-foreground","text-text","hover:bg-foreground-600","active:bg-foreground-700","disabled:bg-foreground-200"),S=o()("border-2","border-foreground","text-foreground","hover:bg-longan-200"),N=e=>o()("leading-none","align-middle","py-2","px-4","no-select",e.className,{[d]:"pill"===e.buttonStyle,[b]:"roundrect"===e.buttonStyle,[g]:"authn"===e.buttonStyle,[h]:"cherry"===e.color,[m]:"strawberry"===e.color,[p]:"mango"===e.color,[v]:"not-black"===e.color,[y]:"red"===e.color,[x]:"accent"===e.color,[f]:"green"===e.color,[w]:"secondary"===e.color,[E]:"authn-primary"===e.color,[S]:"authn-other"===e.color}),k=a.forwardRef((({buttonStyle:e,color:r,className:t,...n},o)=>{const l=N({buttonStyle:e,color:r,className:t,...n});return a.createElement("button",c({},n,{className:l,ref:o}),n.children)}));k.displayName="Button";const O=a.forwardRef((({buttonStyle:e,color:r,...t},n)=>{const o=N({buttonStyle:e,color:r,...t});return a.createElement("a",c({},t,{className:o,ref:n}),t.children)}));O.displayName="LinkButton"},32259:function(e,r,t){t.r(r),t.d(r,{PurgeUserForm:function(){return u}});var n=t(94159),o=t(99838),a=t(2735),l=t(70496),c=t(71860);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},s.apply(this,arguments)}const u=({email:e,userId:r})=>{const{register:t,handleSubmit:u,watch:i}=(0,o.cI)(),d=i(),b=c.S.moderation.user.purge.useMutation(),{data:g}=c.S.moderation.user.hasActiveSubscription.useQuery({userId:r},{suspense:!0});return n.createElement("form",{className:"flex max-w-fit flex-col gap-2 rounded-lg border border-accent p-3",onSubmit:u((async()=>{await b.mutateAsync({userId:r})}))},n.createElement("h4",{className:"h4"},"purge user"),g?n.createElement(l.v,{level:"warning",className:"prose"},n.createElement("p",null,"This user (",e,") cannot currently be purged because they have one or more active subscriptions. Cancel and refund them manually first from the Stripe dashboard.")):n.createElement(n.Fragment,null,n.createElement(l.v,{level:"warning",className:"prose"},n.createElement("p",null,n.createElement("b",null,"HEADS UP!")," This will perform the following irreverseable operations:",n.createElement("ul",null,n.createElement("li",null,"purge this user's self-project;"),n.createElement("li",null,"purge all non-self projects for which this user is the sole editor;"),n.createElement("li",null,"permanently delete this user"))),n.createElement("p",null,"Only use this form if you're doing it at user request!")),n.createElement("label",null,"I've read the warnings and I'm still gonna do it:"),n.createElement("input",s({type:"checkbox"},t("confirmed",{required:!0}))),n.createElement(a.zx,{type:"submit",buttonStyle:"pill",color:"cherry",className:"w-fit",disabled:!d.confirmed},"purge user")))}}}]);
//# sourceMappingURL=client-preact-components-pages-moderation-manage-user-purge-user.bd958b7f0dd7b5dadc3a.js.map