PageSourceSearch

https://codir.pro/assets/AppSettings-BiJHIQ9y.js

js codir.pro collected 2026-10-02 02:05:57 UTC 10,946 bytes, 1 lines download raw bytes

1import{r as i,j as e,X as V,d as b,m as C,L as f,U as W,b as x,t as d,a as Y,u as Z,e as M,f as z,g as F,h as ee}from"./index-B0sM48fE.js";import{B as c}from"./button-CXcf0psP.js";import{I as S}from"./input-CEx6Es-i.js";import{R as se,P as te,C as U,a as ae,T as B,D as H,O as I,b as D}from"./index-DLkBA9oM.js";import{S as q}from"./send-Cui5vdSF.js";import{C as ne}from"./circle-check-CxxoOG2b.js";import{M as ie}from"./mail-Bq5DIA9G.js";const X=se,re=te,$=i.forwardRef(({className:s,...a},r)=>e.jsx(I,{ref:r,className:b("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...a}));$.displayName=I.displayName;const P=i.forwardRef(({className:s,children:a,...r},h)=>e.jsxs(re,{children:[e.jsx($,{}),e.jsxs(U,{ref:h,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",s),...r,children:[a,e.jsxs(ae,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(V,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));P.displayName=U.displayName;const L=({className:s,...a})=>e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",s),...a});L.displayName="DialogHeader";const R=({className:s,...a})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a});R.displayName="DialogFooter";const O=i.forwardRef(({className:s,...a},r)=>e.jsx(B,{ref:r,className:b("text-lg font-semibold leading-none tracking-tight",s),...a}));O.displayName=B.displayName;const T=i.forwardRef(({className:s,...a},r)=>e.jsx(H,{ref:r,className:b("text-sm text-muted-foreground",s),...a}));T.displayName=H.displayName;function oe(){var g,j;const[s,a]=i.useState(!1),[r,h]=i.useState(!1),[y,N]=i.useState(!1),[t,u]=i.useState(null),[l,_]=i.useState(null),p=async()=>{h(!0),u(null);try{const o=await x.functions.invoke("sendShopifyLaunchAnnouncement",{dryRun:!0});u(o.data),a(!0)}catch(o){d.error("Failed to load recipients"),console.error(o)}finally{h(!1)}},w=async()=>{var o;N(!0);try{const m=await x.functions.invoke("sendShopifyLaunchAnnouncement",{});_(m.data),d.success(`Sent to ${((o=m.data)==null?void 0:o.sent)??0} subscribers`),a(!1)}catch(m){d.error("Failed to send announcement"),console.error(m)}finally{N(!1)}};return e.jsxs(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"rounded-2xl border border-primary/30 bg-gradient-to-br from-primary/10 to-accent/5 backdrop-blur-xl p-6",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[e.jsx(q,{className:"h-5 w-5 text-primary mt-1"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-foreground mb-1",children:"Shopify launch announcement"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Send a launch email to every active subscriber, telling them Shopify is now available."})]})]}),l&&e.jsxs("div",{className:"mb-4 rounded-lg bg-green-500/10 border border-green-500/30 px-4 py-3 text-sm text-green-400 flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4"}),"Sent to ",l.sent," / ",l.total," subscribers",((g=l.failures)==null?void 0:g.length)>0&&e.jsxs("span",{className:"text-orange-400",children:["· ",l.failures.length," failed"]})]}),e.jsxs(c,{onClick:p,disabled:r,className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-2",children:[r?e.jsx(f,{className:"h-4 w-4 animate-spin"}):e.jsx(W,{className:"h-4 w-4"}),"Preview recipients"]}),e.jsx(X,{open:s,onOpenChange:a,children:e.jsxs(P,{className:"sm:max-w-md",children:[e.jsxs(L,{children:[e.jsx(O,{children:"Send Shopify launch email"}),e.jsxs(T,{children:["This will email ",e.jsx("span",{className:"font-semibold text-foreground",children:(t==null?void 0:t.recipientCount)??0})," active subscriber",(t==null?void 0:t.recipientCount)===1?"":"s"," to announce Shopify is live. This action is irreversible."]})]}),((j=t==null?void 0:t.recipients)==null?void 0:j.length)>0&&e.jsxs("div",{className:"max-h-40 overflow-y-auto rounded-lg bg-secondary/50 border border-border/50 p-3 text-xs text-muted-foreground space-y-1",children:[t.recipients.slice(0,20).map(o=>e.jsx("div",{children:o},o)),t.recipients.length>20&&e.jsxs("div",{className:"italic",children:["…and ",t.recipients.length-20," more"]})]}),e.jsxs(R,{className:"gap-2",children:[e.jsx(c,{variant:"outline",onClick:()=>a(!1),disabled:y,children:"Cancel"}),e.jsxs(c,{onClick:w,disabled:y||!(t!=null&&t.recipientCount),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-2",children:[y?e.jsx(f,{className:"h-4 w-4 animate-spin"}):e.jsx(q,{className:"h-4 w-4"}),"Send to ",(t==null?void 0:t.recipientCount)??0]})]})]})})]})}function xe(){const{t:s}=Y(),a=Z(),[r,h]=i.useState(null),[y,N]=i.useState(!0),[t,u]=i.useState(!1),[l,_]=i.useState(""),[p,w]=i.useState(""),[g,j]=i.useState(""),[o,m]=i.useState(!1),[v,A]=i.useState(""),[k,E]=i.useState(!1);i.useEffect(()=>{x.auth.me().then(n=>{h(n),_((n==null?void 0:n.email)||""),N(!1)})},[]);const G=async()=>
1{if(!l){d.error(s("settings_toast_email_required"));return}u(!0),await x.auth.updateMe({email:l}),d.success(s("settings_toast_email_updated")),u(!1)},J=async()=>{if(!p||!g){d.error(s("settings_toast_fields_required"));return}if(p!==g){d.error(s("settings_toast_passwords_mismatch"));return}u(!0),await x.auth.updateMe({password:p}),d.success(s("settings_toast_password_updated")),w(""),j(""),u(!1)},K=async()=>{if(!v){d.error(s("settings_toast_password_required"));return}E(!0),await x.auth.updateMe({password:v,delete_account:!0}),d.success(s("settings_toast_account_deleted")),setTimeout(()=>a("/"),1e3),E(!1)};if(y)return e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(f,{className:"h-6 w-6 animate-spin text-muted-foreground"})});const Q=[{icon:ie,title:s("settings_email_title"),description:s("settings_email_desc"),delay:0,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(S,{type:"email",value:l,onChange:n=>_(n.target.value),className:"bg-secondary border-border/50"}),e.jsxs(c,{onClick:G,disabled:t||l===(r==null?void 0:r.email),className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-2",children:[t?e.jsx(f,{className:"h-4 w-4 animate-spin"}):e.jsx(ee,{className:"h-4 w-4"}),s("settings_update_button")]})]})},{icon:M,title:s("settings_password_title"),description:s("settings_password_desc"),delay:.1,content:e.jsxs("div",{className:"space-y-3",children:[e.jsx(S,{type:"password",placeholder:s("settings_password_new"),value:p,onChange:n=>w(n.target.value),className:"bg-secondary border-border/50"}),e.jsx(S,{type:"password",placeholder:s("settings_password_confirm"),value:g,onChange:n=>j(n.target.value),className:"bg-secondary border-border/50"}),e.jsxs(c,{onClick:J,disabled:t||!p||!g,className:"bg-primary hover:bg-primary/90 text-primary-foreground gap-2",children:[t?e.jsx(f,{className:"h-4 w-4 animate-spin"}):e.jsx(M,{className:"h-4 w-4"}),s("settings_update_button")]})]})},{icon:z,title:s("settings_subscription_title"),description:s("settings_subscription_desc"),delay:.2,content:e.jsxs(c,{onClick:()=>a("/app/subscription"),variant:"outline",className:"border-border/50 hover:bg-secondary gap-2",children:[e.jsx(z,{className:"h-4 w-4"}),s("settings_subscription_button")]})},{icon:F,title:s("settings_logout_title"),description:s("settings_logout_desc"),delay:.3,content:e.jsxs(c,{onClick:()=>x.auth.logout(),variant:"destructive",className:"gap-2",children:[e.jsx(F,{className:"h-4 w-4"}),s("settings_logout_button")]})}];return e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs(C.div,{initial:{opacity:0,y:-10,filter:"blur(8px) brightness(2)"},animate:{opacity:1,y:0,filter:"blur(0px) brightness(1)"},transition:{duration:.6,ease:[.22,1,.36,1]},className:"mb-10 text-center",children:[e.jsx("h1",{className:"font-space font-bold text-3xl md:text-4xl text-white tracking-tight",children:s("settings_title")}),e.jsx("p",{className:"text-white/80 mt-2",children:s("settings_subtitle")})]}),e.jsx("h2",{className:"text-xs font-space font-bold text-white uppercase tracking-[0.25em] mb-4",children:s("settings_section")}),e.jsxs("div",{className:"space-y-6",children:[Q.map(n=>e.jsxs(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:n.delay},className:"rounded-2xl border border-border/50 bg-card/80 backdrop-blur-xl p-6",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[e.jsx(n.icon,{className:"h-5 w-5 text-primary mt-1"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-foreground mb-1",children:n.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description})]})]}),n.content]},n.title)),(r==null?void 0:r.role)==="admin"&&e.jsx(oe,{}),e.jsxs(C.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4},className:"rounded-2xl border border-red-500/20 bg-red-500/5 backdrop-blur-xl p-6",children:[e.jsxs("div",{className:"flex items-start gap-4 mb-4",children:[e.jsx(D,{className:"h-5 w-5 text-red-500 mt-1"}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-red-500 mb-1",children:s("settings_delete_title")}),e.jsx("p",{className:"text-sm text-red-500/70",children:s("settings_delete_desc")})]})]}),e.jsxs(c,{onClick:()=>m(!0),className:"bg-red-600 hover:bg-red-700 text-white gap-2",children:[e.jsx(D,{className:"h-4 w-4"}),s("settings_delete_button")]})]})]}),e.jsx(X,{open:o,onOpenChange:m,children:e.jsxs(P,{className:"sm:max-w-md",children:[e.jsxs(L,{children:[e.jsx(O,{className:"text-red-500",children:s("settings_delete_title")}),e.jsx(T,{children:s("settings_delete_dialog_desc")})]}),e.jsx(S,{type:"password",placeholder:s("settings_delete_dialog_placeholder"),value:v,onCh
1ange:n=>A(n.target.value),className:"bg-secondary border-border/50"}),e.jsxs(R,{className:"gap-2",children:[e.jsx(c,{onClick:()=>{m(!1),A("")},variant:"outline",disabled:k,children:s("settings_delete_dialog_cancel")}),e.jsxs(c,{onClick:K,disabled:k||!v,className:"bg-red-600 hover:bg-red-700 text-white gap-2",children:[k?e.jsx(f,{className:"h-4 w-4 animate-spin"}):e.jsx(D,{className:"h-4 w-4"}),s("settings_delete_dialog_confirm")]})]})]})})]})}export{xe as default};

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.