PageSourceSearch

https://socialloop.ai/_next/static/chunks/3548.adfc985ce6c61bcb.js

js socialloop.ai collected 2026-10-05 12:46:30 UTC 7,664 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3548],{33548:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var n=a(95155),s=a(29567),l=a(10639),r=a(12115),i=a(60724),d=a(55619),c=a(5780);let o=e=>"".concat(e.getFullYear(),"-").concat(String(e.getMonth()+1).padStart(2,"0"),"-").concat(String(e.getDate()).padStart(2,"0")),m="px-3 py-2 rounded-lg border border-white/15 text-sm disabled:opacity-40";function h(e){let{onOpen:t}=e,a=(0,l.Kg)(),[h,x]=(0,r.useState)(()=>new Date(new Date().getFullYear(),new Date().getMonth(),1)),[u,g]=(0,r.useState)([]),[p,f]=(0,r.useState)(null),[b,j]=(0,r.useState)(!1),[w,N]=(0,r.useState)(""),[D,v]=(0,r.useState)(!1),[k,y]=(0,r.useState)(o(new Date)),[S,M]=(0,r.useState)(null),[C,T]=(0,r.useState)(""),[F,Y]=(0,r.useState)(""),P=(0,r.useRef)(0),A=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",L=function(e){for(let a of["longGeneric","long"])try{var t;let n=null==(t=new Intl.DateTimeFormat(void 0,{timeZone:e,timeZoneName:a}).formatToParts(new Date).find(e=>"timeZoneName"===e.type))?void 0:t.value;if(n)return n}catch(e){}return e}(A),[R,E]=(0,r.useState)(!1),_=new Date(h.getFullYear(),h.getMonth(),1);_.setDate(_.getDate()-_.getDay());let I=Array.from({length:42},(e,t)=>new Date(_.getFullYear(),_.getMonth(),_.getDate()+t)),Z=new Date(_.getFullYear(),_.getMonth(),_.getDate()+42),Q=async e=>{let t=++P.current;j(!0),N("");try{let n=await a("calendar",{startAtMs:_.getTime(),endAtMs:Z.getTime(),...e&&{cursor:e}});if(t!==P.current)return;g(t=>e?[...t,...n.entries.filter(e=>!t.some(t=>t.id===e.id))]:n.entries),f(n.nextCursor),v(n.preparing)}catch(e){t===P.current&&N((0,c.Q)(e))}finally{t===P.current&&j(!1)}};(0,r.useEffect)(()=>(g([]),f(null),Q(),()=>{P.current++}),[h]);let G=async()=>{if(S){j(!0),N("");try{if(await a("plan",{campaignId:S.id,plannedAtMs:C?(0,i.e)(C,"09:00",A):null,note:F,expectedEditorialRevision:S.editorialRevision}),M(null),C){y(C);let e=new Date("".concat(C,"T12:00:00"));x(new Date(e.getFullYear(),e.getMonth(),1))}else await Q()}catch(e){N((0,c.Q)(e)),j(!1)}}},K=R?u:u.filter(e=>"draft"!==e.kind),O=K.filter(e=>o(new Date(e.atMs))===k).sort((e,t)=>e.atMs-t.atMs);return(0,n.jsxs)("section",{"aria-label":"Campaign calendar",className:"space-y-5",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsx)("button",{"aria-label":"Previous month",className:m,onClick:()=>{let e=new Date(h.getFullYear(),h.getMonth()-1,1);x(e),y(o(e))},children:"←"}),(0,n.jsx)("h3",{className:"font-semibold min-w-44 text-center",children:h.toLocaleDateString(void 0,{month:"long",year:"numeric"})}),(0,n.jsx)("button",{"aria-label":"Next month",className:m,onClick:()=>{let e=new Date(h.getFullYear(),h.getMonth()+1,1);x(e),y(o(e))},children:"→"}),(0,n.jsx)("button",{className:m,onClick:()=>{x(new Date(new Date().getFullYear(),new Date().getMonth(),1)),y(o(new Date))},children:"Today"}),(0,n.jsx)("button",{disabled:b,className:"text-sm underline ml-auto",onClick:()=>void Q(),children:"Refresh"})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-t3",children:[(0,n.jsxs)("span",{children:["Times in ",L]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"→"})," Approved send"]}),(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"○"})," Planned draft"]}),R&&(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{"aria-hidden":"true",children:"\xb7"})," Draft"]}),(0,n.jsxs)("label",{className:"flex items-center gap-2 text-t2",children:[(0,n.jsx)("input",{type:"checkbox",checked:R,onChange:e=>E(e.target.checked)}),"Show unplanned drafts"]})]}),w&&!S&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-negative-ink",children:w}),D&&(0,n.jsx)("p",{role:"status",className:"text-sm text-t2",children:"Your earlier emails are still loading. Refresh in a moment to see them here."}),(0,n.jsxs)("div",{className:"grid grid-cols-7 gap-1","aria-label":"Publishing dates",children:[["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(e=>(0,n.jsx)("span",{className:"text-xs text-t3 text-center py-2",children:e},e)),I.map(e=>
1{let t=o(e),a=K.filter(e=>o(new Date(e.atMs))===t);return(0,n.jsxs)("button",{"aria-pressed":k===t,"aria-label":"".concat(e.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"}),", ").concat(a.length," ").concat(1===a.length?"item":"items"),className:"min-w-0 min-h-20 sm:min-h-28 flex flex-col items-start p-2 rounded-lg text-left border ".concat(k===t?"border-current bg-white/10":"border-white/10"," ").concat(e.getMonth()===h.getMonth()?"text-t1":"text-t3"),onClick:()=>y(t),children:[(0,n.jsx)("span",{className:"text-sm",children:e.getDate()}),a.slice(0,2).map(e=>(0,n.jsxs)("span",{className:"hidden sm:block max-w-full text-xs mt-2 truncate",title:e.name,children:["send"===e.kind?"→":"plan"===e.kind?"○":"\xb7"," ",e.name]},e.id)),a.length>0&&(0,n.jsx)("span",{className:"sm:hidden text-xs text-t2 mt-2",children:a.length}),a.length>2&&(0,n.jsxs)("span",{className:"hidden sm:block text-xs text-t2",children:["+",a.length-2," more"]})]},t)})]}),(0,n.jsx)("p",{role:"status",className:"text-xs text-t3",children:b?"Loading calendar…":p?"Some dates have more emails. Load them to see the full month.":""}),p&&(0,n.jsx)("button",{disabled:b,className:m,onClick:()=>void Q(p),children:"Load more emails"}),(0,n.jsxs)("section",{className:"space-y-3","aria-label":"Selected publishing date",children:[(0,n.jsx)("h3",{className:"font-semibold",children:new Date("".concat(k,"T12:00:00")).toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}),O.length?O.map(e=>(0,n.jsxs)("article",{className:"p-4 rounded-xl border border-white/10 flex flex-wrap justify-between gap-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("button",{className:"font-medium text-left hover:underline",onClick:()=>t(e.id,e.status),children:e.name}),(0,n.jsx)("p",{className:"text-xs text-t2 mt-2",children:"send"===e.kind?"Approved send \xb7 ".concat((0,s.lc)(e.status)):"plan"===e.kind?"Planned draft \xb7 won’t send on its own":(0,s.lc)(e.status)}),e.note&&(0,n.jsx)("p",{className:"text-sm text-t2 mt-2 whitespace-pre-wrap",children:e.note})]}),2===e.schemaVersion&&["draft","ready","preparing"].includes(e.status)&&(0,n.jsx)("button",{className:"text-sm underline self-start",onClick:()=>{M(e),T("plan"===e.kind?o(new Date(e.atMs)):""),Y(e.note),N("")},children:"Plan this draft"})]},e.id)):(0,n.jsx)("p",{className:"text-sm text-t2",children:"Nothing planned for this date."})]}),S&&(0,n.jsx)(d.A,{title:"Plan your draft",onClose:()=>{b||M(null)},children:(0,n.jsxs)("div",{className:"space-y-5",children:[(0,n.jsx)("h3",{className:"font-semibold",children:S.name}),(0,n.jsx)("p",{className:"text-sm text-t2",children:"This is an editorial reminder. Review and approve the campaign separately when you are ready to send."}),(0,n.jsxs)("label",{className:"block text-sm",children:["Planned date",(0,n.jsx)("input",{type:"date",className:"block mt-2 p-3 rounded-lg border border-white/15 bg-card",value:C,onChange:e=>T(e.target.value)})]}),(0,n.jsxs)("label",{className:"block text-sm",children:["Editorial note",(0,n.jsx)("textarea",{maxLength:2e3,className:"block w-full mt-2 p-3 rounded-lg border border-white/15 bg-card",value:F,onChange:e=>Y(e.target.value)})]}),(0,n.jsxs)("p",{className:"text-xs text-t3",children:["Clear the date to return this item to its original draft-creation date. Dates use ",L,"."]}),w&&(0,n.jsx)("p",{role:"alert",className:"text-sm text-negative-ink",children:w}),(0,n.jsx)("button",{disabled:b,className:m,onClick:()=>void G(),children:"Save editorial plan"})]})})]})}}}]);

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.