1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6144],{12492:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/program/[slug]/emails",function(){return l(33453)}])},33453:(e,t,l)=>{"use strict";l.r(t),l.d(t,{__N_SSP:()=>R,default:()=>O});var r=l(61110),a=l(18153),i=l(82736),n=l(51362),s=l(91921),u=l(34205),d=l(89099),o=l(14232),c=l(49783),h=l(41130),m=l(44228),p=l(46862),A=l(20099),S=l(45514),T=l(99407),g=l(63973),E=l(2665),_=l(55791),$=l(43043),Y=l(64435),w=l(2791),L=l(44824),f=l(78919),v=l(74856);let b={...(0,v.SN)("external_api_request")(["id","type","payload","group","scheduled_date","execute_at","completed_date","successful","num_attempts","created_at","updated_at","deleted_at"]),where:({executeAtLte:e,type:t,group:l,numAttemptsLte:r,completed:a,limit:i=null,paranoid:n=!0,order:s=null},u=null)=>(0,f.Xs)` 2 FROM ${b} 3 WHERE 4 ${null!=e?(0,f.Xs)`${b.execute_at} <= ${e} AND`:(0,f.Xs)``} 5 ${null!=t?(0,f.Xs)`${b.type} = ${t} AND `:(0,f.Xs)``} 6 ${null!=l?(0,f.Xs)`${b.group} = ${l} AND `:(0,f.Xs)``} 7 ${null!=r?(0,f.Xs)`${b.num_attempts} <= ${r} AND `:(0,f.Xs)``} 8 ${null!=a?a?(0,f.Xs)`${b.completed_date} IS NOT NULL AND `:(0,f.Xs)`${b.completed_date} IS NULL AND `:(0,f.Xs)``} 9 ${n?(0,f.Xs)`${b.deleted_at} IS NULL AND`:(0,f.Xs)``} 10 ${null!=u?u:(0,f.Xs)`TRUE`} 11 ${(0,v.RA)(i)} 12 ${(0,v.k5)(s)} 13 `};var D=l(54443),y=l(61330);function k({worldSlug:e}){let t=(0,D.I)(),l=(0,y.LL)(),r=null!=e?`(${e})`:null,i=t.many(b.where({type:"scheduleEmails",order:[[(0,f.Xs)`COALESCE(${b.completed_date}, ${b.execute_at})`,"asc"]]},null!=r?(0,f.Xs)`${b.group} ~* ${r}`:(0,f.Xs)`TRUE`)).map(e=>{let t=e(b.group),[l,r,a]=t?.split(":")??[null,null,null],i=e(b.payload);return{id:e(b.id),key:e(b.group)??"",programPrefix:r,emailTemplate:a,iterationSlug:`${i?.payload.iterationSlug}`,executeAt:null!=e(b.execute_at)?L.c9.fromISO(`${e(b.execute_at)}`):null,completedDate:null!=e(b.completed_date)?L.c9.fromISO(`${e(b.completed_date)}`):null,successful:e(b.successful)}}).filter(e=>{let t=e.completedDate??e.executeAt;return null!=t&&t>l.minus({weeks:4})});return 0===i.length?(0,a.Y)(s.E,{children:"No scheduled emails to display for these templates."}):(0,a.FD)(T.X,{variant:"simple",children:[(0,a.Y)(g.d,{children:(0,a.FD)(E.Tr,{children:[(0,a.Y)(_.Th,{children:"Status"}),(0,a.Y)(_.Th,{children:"Scheduled For"}),(0,a.Y)(_.Th,{children:"Program Prefix"}),(0,a.Y)(_.Th,{children:"Email Template"}),(0,a.Y)(_.Th,{children:"Iteration Slug"})]})}),(0,a.Y)($.N,{children:i.map(({id:e,programPrefix:t,emailTemplate:r,executeAt:i,completedDate:n,successful:s,iterationSlug:u})=>{let d;return(0,a.FD)(E.Tr,{children:[(0,a.Y)(Y.Td,{children:!0===s?(0,a.Y)(w.vw,{colorScheme:"green",children:"Completed"}):!1===s&&null!=n?(0,a.Y)(w.vw,{colorScheme:"red",children:"Failed"}):null!=i&&i<l?(0,a.Y)(w.vw,{colorScheme:"red",children:"Overdue"}):(0,a.Y)(w.vw,{colorScheme:"blue",children:"Pending"})}),(0,a.Y)(Y.Td,{children:null!=(d=n??i)?`${d.toLocaleString(L.c9.DATETIME_SHORT_WITH_SECONDS)} ${d.toFormat("ZZZZ")}`:""}),(0,a.Y)(Y.Td,{children:t}),(0,a.Y)(Y.Td,{children:r}),(0,a.Y)(Y.Td,{children:u})]},`${e}`)})})]})}var W=l(9496),C=l(80632),x=l(75934),I=l(75078),N=l(22147),X=l(48564);let F=["KALEPastTutorInvite","KALEEligibleTutorInvite","KALETutorPublishDeadline","KALETutorPrepforFirstSession","KALETutorSeriesStartsThisWeek","KALELearnerSeriesStartsThisWeek","KALETutorFirstWeek","KALELearnerFirstWeek","KALETutorHalfway","KALELearnerHalfway","KALETutorThankYou","KALELearnerThankYou"],P={[x.Bv]:{title:"CAW",iterationDetails:C.Hj.map(e=>({title:C.v4[e].title,slug:e})),scheduleEmails:async e=>{await W.Ay.admin_scheduleProgramEmails({programSlug:x.Bv,iterationSlug:e})},templateIds:["CAWPastTutorInvite","CAWEligibleTutorInviteInSubworld","CAWEligibleTutorInviteNotInSubworld","CAWTutorPublishDeadline","CAWTutorPrepforFirstSession","CAWTutorSeriesStartsThisWeek","CAWLearnerSeriesStartsThisWeek","CAWTutorFirstWeek","CAWLearnerFirstWeek","CAWTutorHalfway","CAWLearnerHalfway","CAWTutorThankYou","CAWLearnerThankYou"]}
13,[x.q5]:{title:"Algebra 2 Learning Labs",iterationDetails:N.eI.map(e=>({title:I.C8[e].title,slug:e})),scheduleEmails:async e=>{await W.Ay.admin_scheduleProgramEmails({programSlug:x.q5,iterationSlug:e})},templateIds:F},[x.Qm]:{title:"Pre-Calculus Learning Labs",iterationDetails:N.Uz.map(e=>({title:X.If[e].title,slug:e})),scheduleEmails:async e=>{await W.Ay.admin_scheduleProgramEmails({programSlug:x.Qm,iterationSlug:e})},templateIds:F}},K=(0,r.A)(function(){let e=(0,h._)(),t=(0,d.useRouter)(),l=`${t.query.slug}`,{title:r,iterationDetails:T,scheduleEmails:g,templateIds:E}=P[l]??{},_=[{label:"Iteration",type:"select",name:"iterationSlug",options:(T??[]).map(({slug:e,title:t})=>({label:t,value:e})),required:!0,size:3}],$=(0,o.useCallback)(async t=>{e({title:`Scheduling ${r} emails...`,status:"info"});let l=`${t.iterationSlug}`;await g(l),e({title:`Scheduled ${r} emails!`,status:"success"})},[r,e,g]);return(0,a.Y)(c.A,{title:`Scheduled Automated ${r} Emails`,children:(0,a.Y)(A.A,{children:null==r?(0,a.FD)(i.D,{size:"2xl",mb:6,children:['No program with slug "',l,'" found']}):(0,a.FD)(a.FK,{children:[(0,a.Y)(S.A,{title:`Schedule Automated ${r} Emails`,body:()=>(0,a.FD)(n.T,{spacing:"20px",alignItems:"left",maxWidth:"600px",children:[(0,a.Y)(s.E,{children:"These are the emails that will be scheduled to be sent out:"}),(0,a.Y)(u.Xy,{children:E.map(e=>(0,a.Y)(u.ck,{children:e},e))}),(0,a.Y)(m.A,{variant:"warning",children:"For now, you will need to consult the relevant documentation to determine when each of these emails is scheduled for."}),(0,a.Y)(m.A,{variant:"info-blue",children:"Emails that have already been scheduled will be overwritten."}),(0,a.Y)(p.A,{name:"Schedule Automated Emails",blocks:_,onSubmit:$})]})}),(0,a.Y)(S.A,{title:"Scheduled Emails",body:()=>(0,a.Y)(k,{worldSlug:l})})]})})})},{userRoles:["admin:super"]});var R=!0;let O=K},45514:(e,t,l)=>{"use strict";l.d(t,{A:()=>c});var r=l(18153),a=l(39955),i=l(82736),n=l(76032),s=l(86623),u=l(44517),d=l(97460),o=l(14232);function c({title:e,body:t,collapsible:l=!1,closeCollapsible:h=!1,asSubsection:m=!1,...p}){let[A,S]=o.useState(!h);return l?(0,r.FD)(a.a,{...p,children:[(0,r.FD)(n.B,{direction:"row",cursor:"pointer",align:"center",onClick:()=>S(e=>!e),spacing:"8px",mt:m?void 0:"48px",children:[(0,r.Y)(i.D,{size:m?"md":"xl",children:e}),(0,r.Y)(d.g,{icon:A?u.Jt$:u.XkK})]}),(0,r.Y)(s.S,{in:A,children:(0,r.Y)(a.a,{mt:"16px",children:t()})})]}):(0,r.FD)(a.a,{...p,children:[(0,r.Y)(i.D,{size:m?"md":"xl",mt:m?void 0:"48px",mb:"16px",children:e}),(0,r.Y)(a.a,{children:t()})]})}},55791:(e,t,l)=>{"use strict";l.d(t,{Th:()=>s});var r=l(37876),a=l(99407),i=l(11842),n=l(85696);let s=(0,i.R)(({isNumeric:e,...t},l)=>{let i=(0,a.k)();return(0,r.jsx)(n.B.th,{...t,ref:l,__css:i.th,"data-is-numeric":e})})},61110:(e,t,l)=>{"use strict";l.d(t,{A:()=>a});var r=l(16425);function a(e,t){return null!=t.userRoles&&t.userRoles.forEach(e=>{if(!e.startsWith("admin:"))throw Error("Cannot expose admin page to non-admins!")}),(0,r.A)(e,{authScopes:t.authScopes,userRoles:t.userRoles,onboardingUsers:"disallowed"})}},63973:(e,t,l)=>{"use strict";l.d(t,{d:()=>s});var r=l(37876),a=l(99407),i=l(11842),n=l(85696);let s=(0,i.R)((e,t)=>{let l=(0,a.k)();return(0,r.jsx)(n.B.thead,{...e,ref:t,__css:l.thead})})}},e=>{e.O(0,[6425,636,6593,8792],()=>e(e.s=12492)),_N_E=e.O()}]); 14//# sourceMappingURL=emails-435f982a4660a4a1.js.map
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.