PageSourceSearch

https://cruciblekravmaga.com/assets/newsletter-settings-DXfUWIGy.js

js cruciblekravmaga.com collected 2026-10-04 15:12:18 UTC 10,517 bytes, 1 lines download raw bytes

1import{r as f,j as e,L as k}from"./vendor-DG7D-edB.js";import{a as F,n as C,b as S,o as R,i as j,B as N,k as A,a7 as o,a8 as d,a9 as c,v as G,aa as m,ab as u,L as r,ai as O,I as p,a4 as V,K as E,$ as I}from"./index-bIu2iPWS.js";import{R as y,a as l}from"./radio-group-wMLHn4Ou.js";import{S as L}from"./switch-BY2wETRg.js";import{p as b}from"./editorial-formulas-CX6nu4Bq.js";import{A as P}from"./arrow-left-DX7WGM_L.js";import{S as q}from"./save-DuIn2_kS.js";import"./ui-BYpPUPUG.js";function Q(){const{toast:g}=F(),v=C(),{data:t,isLoading:w}=S({queryKey:["/api/admin/settings/organization"],queryFn:async()=>{const s=await fetch("/api/admin/settings/organization");if(!s.ok)throw new Error("Failed to fetch settings");return s.json()}}),[i,n]=f.useState({publicationType:"local_events",publicationName:"",region:"",defaultTone:"warm_professional",brandVoiceNotes:"",defaultGreeting:"",signOffName:"",autoReferralFooter:!0});f.useEffect(()=>{t&&n({publicationType:t.publicationType||"local_events",publicationName:t.publicationName||"",region:t.region||"",defaultTone:t.defaultTone||"warm_professional",brandVoiceNotes:t.brandVoiceNotes||"",defaultGreeting:t.defaultGreeting||"",signOffName:t.signOffName||"",autoReferralFooter:t.autoReferralFooter!==!1})},[t]);const h=R({mutationFn:async s=>{const a=await fetch("/api/admin/settings/organization",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!a.ok)throw new Error("Failed to save settings");return a.json()},onSuccess:()=>{v.invalidateQueries({queryKey:["/api/admin/settings/organization"]}),g({title:"Settings saved successfully"})},onError:s=>{g({title:s.message,variant:"destructive"})}}),T=()=>{h.mutate(i)};if(w)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(j,{className:"w-8 h-8 animate-spin text-primary"})});const x=b.find(s=>s.id===i.publicationType);return e.jsx("div",{className:"min-h-screen bg-muted/30",children:e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(k,{href:"/admin/newsletters",children:e.jsxs(N,{variant:"ghost",size:"sm",children:[e.jsx(P,{className:"w-4 h-4 mr-2"})," Back to Newsletters"]})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-display font-bold flex items-center gap-2",children:[e.jsx(A,{className:"w-6 h-6"})," Newsletter Settings"]}),e.jsx("p",{className:"text-muted-foreground",children:"Configure your publication type and AI writing preferences"})]})]}),e.jsxs(N,{onClick:T,disabled:h.isPending,"data-testid":"button-save-settings",children:[h.isPending?e.jsx(j,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(q,{className:"w-4 h-4 mr-2"}),"Save Settings"]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(o,{children:[e.jsxs(d,{children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-5 h-5 text-primary"})," Publication Type"]}),e.jsx(m,{children:"Choose what your newsletter is about. This helps our AI co-author suggest relevant content and writing styles."})]}),e.jsxs(u,{children:[e.jsxs(y,{value:i.publicationType,onValueChange:s=>n(a=>({...a,publicationType:s})),className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[b.map(s=>e.jsxs("div",{className:"relative",children:[e.jsx(l,{value:s.id,id:s.id,className:"peer sr-only"}),e.jsxs(r,{htmlFor:s.id,className:"flex items-start gap-3 p-4 rounded-lg border-2 cursor-pointer transition-all peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5 hover:border-primary/50",children:[e.jsx("span",{className:"text-2xl",children:s.icon}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:s.name}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s.description})]})]})]},s.id)),e.jsxs("div",{className:"relative",children:[e.jsx(l,{value:"custom",id:"custom",className:"peer sr-only"}),e.jsxs(r,{htmlFor:"custom",className:"flex items-start gap-3 p-4 rounded-lg border-2 border-dashed cursor-pointer transition-all peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5 hover:border-primary/50",children:[e.jsx("span",{className:"text-2xl",children:"✨"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Custom"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Define your own structure (coming soon)"})]})]})]})]}),x&&e.jsxs("div",{className:"mt-6 p-4 bg-muted rounded-lg",children:[e.jsxs("h4",{className:"font-medium mb-2",children:["Available Newsletter Types for ",x.name,":"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:x.formulas.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-background rounded-full text-sm",children:[s.icon," ",s.name]},s.id))})]})]})]}),e.jsxs(o,{children:[e.jsxs(d,{children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(O,{className:"w-5 h-5 text-primary"})," Region & Identity"]}),e.jsx(m,{children:"Help the AI understand your local context for more relevant content suggestions."})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"publicationName",children:"Publication Name"}),e.jsx(p,{id:"publicationName",placeholder:"e.g., Talk of Texoma",value:i.publicationName,onChange:s=>n(a=>({...a,publicationName:s.target.value})),"data-testid":"input-publication-name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"region",children:"Region / Location"}),e.jsx(p,{id:"region",placeholder:"e.g., Texoma (TX/OK Border Region)",value:i.region,onChange:s=>n(a=>({...a,region:s.target.value})),"data-testid":"input-region"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"defaultGreeting",children:"Default Greeting"}),e.jsx(p,{id:"defaultGreeting",placeholder:"e.g., Hey Texoma!",value:i.defaultGreeting,onChange:s=>n(a=>({...a,defaultGreeting:s.target.value})),"data-testid":"input-greeting"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"signOffName",children:"Sign-off Name"}),e.jsx(p,{id:"signOffName",placeholder:"e.g., The Talk of Texoma Team",value:i.signOffName,onChange:s=>n(a=>({...a,signOffName:s.target.value})),"data-testid":"input-signoff"})]})]})]})]}),e.jsxs(o,{children:[e.jsxs(d,{children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(V,{className:"w-5 h-5 text-primary"})," Writing Tone"]}),e.jsx(m,{children:"Set the default tone for AI-generated content. You can always adjust per newsletter."})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs(y,{value:i.defaultTone,onValueChange:s=>n(a=>({...a,defaultTone:s})),className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(l,{value:"casual",id:"casual",className:"peer sr-only"}),e.jsxs(r,{htmlFor:"casual",className:"flex flex-col p-4 rounded-lg border-2 cursor-pointer transition-all peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5 hover:border-primary/50",children:[e.jsx("span",{className:"font-semibold",children:"Casual & Friendly"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Like texting a friend"})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(l,{value:"warm_professional",id:"warm_professional",className:"peer sr-only"}),e.jsxs(r,{htmlFor:"warm_professional",className:"flex flex-col p-4 rounded-lg border-2 cursor-pointer transition-all peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5 hover:border-primary/50",children:[e.jsx("span",{className:"font-semibold",children:"Warm & Professional"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Trusted local publication"})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(l,{value:"formal",id:"formal",className:"peer sr-only"}),e.jsxs(r,{htmlFor:"formal",className:"flex flex-col p-4 rounded-lg border-2 cursor-pointer transition-all peer-data-[state=checked]:border-primary peer-data-[state=checked]:bg-primary/5 hover:border-primary/50",children:[e.jsx("span",{className:"font-semibold",children:"Formal & Editorial"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Traditional newspaper style"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{htmlFor:"brandVoiceNotes",children:"Brand Voice Notes (Optional)"}),e.jsx(E,{id:"brandVoiceNotes",placeholder:"Describe your brand voice in more detail. E.g., 'We're like a friendly neighbor who always knows what's happening around town. We use local slang like y'all and love celebrating our community...'",value:i.brandVoiceNotes,onChange:s=>n(a=>({...a,brandVoiceNotes:s.target.value})),rows:4,"data-testid":"input-brand-voice"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"These notes are included in AI prompts to help match your unique voice."})]})]})]}),e.jsxs(o,{children:[e.jsxs(d,{children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(I,{className:"w-5 h-5 text-primary"})," Referral Program"]}),e.jsx(m,{children:"Grow your subscriber list by adding personalized referral links to every newsletter."})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg border bg-muted/30",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(r,{htmlFor:"autoReferralFooter",className:"font-medium",children:"Auto-Add Referral Footer"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:'Automatically include a personalized "Refer a Friend" section at the bottom of every newsletter. Each subscriber sees their own referral link, stats, and progress toward rewards.'})]}),e.jsx(L,{id:"autoReferralFooter",checked:i.autoReferralFooter,onCheckedChange:s=>n(a=>({...a,autoReferralFooter:s})),"data-testid":"switch-auto-referral-footer"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground bg-primary/5 p-3 rounded-lg",children:[e.jsx("strong",{children:"How it works:"})," Subscribers with accounts will see their unique referral link, conversion count, tokens earned, and progress toward the next milestone. Newsletter-only subscribers without accounts won't see the referral section."]})]})]})]})]})})}export{Q 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.