PageSourceSearch

https://living-corporate.com/assets/naas-issue-editor-CxU03dxA.js

js living-corporate.com collected 2026-10-02 05:00:28 UTC 5,716 bytes, 1 lines download raw bytes

1import{u as I,D as A,v as M,b as H,f as Q,r as m,i as b,j as s,L as v,B as r,o as u,I as P,aM as R,aO as g}from"./index-QiiZ-xPT.js";import{N as $}from"./Navigation-r93ZBuy6.js";import{F as q}from"./Footer-3JNsJayo.js";import{C as x,a as p,b as N,c as w}from"./card-DkXabqFf.js";import{B as E}from"./badge-IOHUIid2.js";import{L as T}from"./label-BA9Xin3m.js";import{T as K}from"./textarea-Bd1mcSz8.js";import{a as z}from"./sanitize-DKP1LTNb.js";import{A as O}from"./arrow-left-B-CeY16K.js";import{C as D}from"./check-KTa2Xihg.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./select-B1P2Vx_w.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./chevron-down-BWOHa16b.js";import"./dialog-D2VXyQJN.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-Bj3iuRQR.js";import"./chevron-right-f4G5e4zR.js";import"./circle-2nw1jhuN.js";import"./useTranslation-XedzLvcK.js";import"./globe-3tsuvpPT.js";import"./log-out-CqAuLeet.js";import"./building-2-Bz-h5bHH.js";import"./BrandSponsor-DEW6i_On.js";import"./mail-Cr62Xklx.js";import"./twitter-BzZd48jL.js";function Ns(){const{isAuthenticated:c}=I(),i=A().id??"",j=M(),[,F]=H(),e=Q({queryKey:[`/api/offerings/naas/issues/${i}`],enabled:c&&!!i}),[C,y]=m.useState(""),[S,k]=m.useState(""),[f,L]=m.useState("");m.useEffect(()=>{e.data?.issue&&(y(e.data.issue.subjectLine),k(e.data.issue.previewText??""),L(e.data.issue.htmlContent))},[e.data?.issue?.id]);const n=b({mutationFn:async()=>(await g("PATCH",`/api/offerings/naas/issues/${i}`,{subjectLine:C,previewText:S,htmlContent:f})).json(),onSuccess:()=>j.invalidateQueries({queryKey:[`/api/offerings/naas/issues/${i}`]})}),d=b({mutationFn:async()=>(await g("POST",`/api/offerings/naas/issues/${i}/approve`,{})).json(),onSuccess:()=>j.invalidateQueries()}),o=b({mutationFn:async()=>(await g("POST",`/api/offerings/naas/issues/${i}/send`,{})).json(),onSuccess:()=>{j.invalidateQueries(),F("/app/newsletter")}});if(!c)return s.jsx(h,{children:s.jsx("div",{className:"text-center py-32",children:s.jsx(v,{href:"/login",children:s.jsx(r,{children:"Sign in"})})})});if(e.isLoading)return s.jsx(h,{children:s.jsx("div",{className:"flex justify-center py-32",children:s.jsx(u,{className:"w-6 h-6 animate-spin text-muted-foreground"})})});if(!e.data?.issue)return s.jsx(h,{children:s.jsxs("div",{className:"text-center py-32",children:[s.jsx("p",{className:"mb-4",children:"Issue not found."}),s.jsx(v,{href:"/app/newsletter",children:s.jsx(r,{children:"Back to dashboard"})})]})});const t=e.data.issue,l=t.status==="draft",B=t.status==="approved";return s.jsx(h,{children:s.jsxs("main",{className:"max-w-4xl mx-auto px-6 py-12","data-testid":"page-naas-issue-editor",children:[s.jsx("div",{className:"mb-6",children:s.jsx(v,{href:"/app/newsletter",children:s.jsxs(r,{variant:"ghost",size:"sm","data-testid":"link-back",children:[s.jsx(O,{className:"w-4 h-4 mr-2"})," Back"]})})}),s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsxs("h1",{className:"text-2xl font-bold","data-testid":"text-issue-title",children:["Issue #",t.issueNumber]}),s.jsx(E,{"data-testid":"badge-status",children:t.status})]}),t.flagReason&&s.jsx(x,{className:"mb-4 border-red-500/50 bg-red-50 dark:bg-red-500/5",children:s.jsxs(p,{className:"p-4 text-sm","data-testid":"text-flag-reason",children:[s.jsx("strong",{children:"Flagged:"})," ",t.flagReason]})}),s.jsxs(x,{className:"mb-6",children:[s.jsx(N,{children:s.jsx(w,{className:"text-base",children:"Subject & preview"})}),s.jsxs(p,{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx(T,{htmlFor:"subject",children:"Subject line"}),s.jsx(P,{id:"subject","data-testid":"input-subject",value:C,onChange:a=>y(a.target.value),disabled:!l})]}),s.jsxs("div",{children:[s.jsx(T,{htmlFor:"preview",children:"Preview text"}),s.jsx(P,{id:"preview","data-testid":"input-preview",value:S,onChange:a=>k(a.target.value),disabled:!l})]})]})]}),s.jsxs(x,{className:"mb-6",children:[s.jsx(N,{children:s.jsx(w,{className:"text-base",children:"HTML body"})}),s.jsx(p,{children:s.jsx(K,{"data-testid":"input-html",rows:16,value:f,onChange:a=>L(a.target.value),disabled:!l,className:"font-mono text-xs"})})]}),s.jsxs(x,{className:"mb-6",children:[s.jsx(N,{children:s.jsx(w,{className:"text-base",children:"Preview"})}),s.jsx(p,{children:s.jsx("div",{className:"border rounded p-4 bg-white dark:bg-zinc-900 max-h-96 overflow-auto prose prose-sm max-w-none dark:prose-invert","data-testid":"preview-html",dangerouslySetInnerHTML:{__html:z(f)}})})]}),s.jsxs("div",{className:"flex flex-wrap gap-3",children:[l&&s.jsxs(s.Fragment,{children:[s.jsxs(r,{onClick:()=>n.mutate(),disabled:n.isPending,variant:"outline","data-testid":"button-save",children:[n.isPending?s.jsx(u,{className:"w-4 h-4 mr-2 animate-spin"}):null,"Save changes"]}),s.jsxs(r,{onClick:()=>d.mutate(),disabled:d.isPending,"data-testid":"button-approve",children:[d.isPending?s.jsx(u,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(D,{className:"w-4 h-4 mr-2"}),"Approve"]})]}),B&&s.jsxs(r,{onClick:()=>o.mutate(),disabled:o.isPending,"data-testid":"button-send",children:[o.isPending?s.jsx(u,{className:"w-4 h-4 mr-2 animate-spin"}):s.jsx(R,{className:"w-4 h-4 mr-2"}),"Send via Kit"]}),t.kitBroadcastId&&s.jsxs("span",{className:"text-sm text-muted-foreground self-center","data-testid":"text-broadcast-id",children:["Kit broadcast: ",t.kitBroadcastId]})]}),(n.error||d.error||o.error)&&s.jsx("p",{className:"text-sm text-red-600 mt-4","data-testid":"text-error",children:(n.error||d.error||o.error)?.message})]})})}function h({children:c}){return s.jsxs("div",{className:"min-h-screen bg-background",children:[s.jsx($,{}),c,s.jsx(q,{})]})}
1export{Ns 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.