PageSourceSearch

https://www.goodcompany.com.au/_next/static/chunks/pages/admin/backoffice/chooseday-emails-5fa48920f04f5870.js

js goodcompany.com.au collected 2026-10-02 11:24:21 UTC 16,835 bytes, 2 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="37f07bee-c715-404a-b2fd-18e08157caac",e._sentryDebugIdIdentifier="sentry-dbid-37f07bee-c715-404a-b2fd-18e08157caac")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9359],{13819:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>I});var i=n(37876),a=n(14232),s=n(532),o=n(49246),l=n(28751),r=n(20982),d=n(60371),c=n(69034),u=n(89099),h=n.n(u),p=n(14921),g=n(22395),m=n(81903),y=n(32395),f=n(83334),x=n(42997),b=n(84218),v=n(8949),w=n(53965);let j="Send";function C(){let e=new Date(Date.now()+36e6),t=(2-e.getUTCDay()+7)%7;return e.setUTCDate(e.getUTCDate()+t),e.toISOString().slice(0,10)}let S=e=>{let{open:t,emails:n,loading:s,onClose:o,onSend:l}=e,[r,d]=(0,a.useState)(""),[c,u]=(0,a.useState)(!1),[h,S]=(0,a.useState)(C),[k,A]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t&&(d(""),u(!1),A(!1),S(C()))},[t]);let E=(0,p.Ay)((0,g._)(h),"dS mmmm, yyyy"),D=n.find(e=>{var t;return e.status===w.ChoosedayEmailStatus.Published&&(null==(t=e.weekDate)?void 0:t.slice(0,10))===h});return(0,i.jsx)(m.a,{open:t,onClose:o,title:"Send Chooseday email now?",primaryAction:{content:"Send",destructive:!0,loading:s,disabled:!D||r!==j,onAction:()=>{let e=C();if(e!==h){S(e),d(""),u(!1),A(!0);return}l(c)}},secondaryActions:[{content:"Cancel",onAction:o}],children:(0,i.jsx)(m.a.Section,{children:(0,i.jsxs)(y.a,{gap:"400",children:[k&&(0,i.jsxs)(f.lZ,{tone:"critical",children:["It is now past midnight AEST — the send target has rolled over to Tuesday ",E,". Review the details below and confirm again."]}),D?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(f.lZ,{tone:"warning",children:["This immediately sends Episode ",D.episodeNumber,":"," ",D.title," to every subscribed user, for Tuesday"," ",E,". It cannot be recalled."]}),(0,i.jsx)(x.S,{label:"Force re-send even if this week's email has already been sent",helpText:"Without this, the send is skipped if the weekly dispatch already ran. Forcing re-runs the dispatch, but users who already received this episode are automatically skipped — only recipients who haven't been sent to yet (e.g. new opt-ins, or ones that failed last time) will get an email.",checked:c,onChange:u}),(0,i.jsx)(b.A,{label:'Type "'.concat(j,'" to confirm'),autoComplete:"",value:r,onChange:d})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(f.lZ,{tone:"critical",children:["There is no published Chooseday email for the upcoming Tuesday (",E,"), so there is nothing to send."]}),(0,i.jsx)(v.E,{as:"p",tone:"subdued",children:"Sending always targets the upcoming Tuesday. Emails with a week date further in the future cannot be sent in advance — they go out in their own week."})]})]})})})};var k=n(41674),A=n(89219),E=n(88052),D=n(35070),N=n(80425);let I=(0,r.Y)(l.x.BackOffice_ManageBusinessUnits)(()=>{let[e,t]=(0,a.useState)([]),[n,l]=(0,a.useState)(!0),[r,u]=(0,a.useState)(),[y,x]=(0,a.useState)(!1),[b,j]=(0,a.useState)(),[I,T]=(0,a.useState)(),[P,_]=(0,a.useState)(!1),[z,K]=(0,a.useState)(),[M,$]=(0,a.useState)(),[Y,B]=(0,a.useState)(),F=async()=>{l(!0);let e=await (0,d.fJ)(1,500);if((0,c.JN)(e))return void l(!1);t(e.result||[]),l(!1)};(0,a.useEffect)(()=>{F()},[]);let H=async()=>{if(!b)return;u(void 0),x(!0);let e=await (0,d.JL)(b.id);if((0,c.bJ)(e)){u("Error publishing Chooseday email — another email may already be published for this week."),x(!1);return}x(!1),j(void 0),F()},J=async e=>{u(void 0),K(void 0),x(!0);let t=await (0,d.hf)(e);if((0,c.bJ)(t)){u("Error requesting Chooseday email dispatch"),x(!1),_(!1);return}x(!1),_(!1),K(e?"Chooseday email dispatch requested (force re-send). Emails will go out shortly.":"Chooseday email dispatch requested. Emails will go out shortly unless this week's email was already sent.")},W=async()=>{if(!I)return;u(void 0),x(!0);let e=await (0,d.j5)(I.id);if((0,c.bJ)(e)){u("Error deleting Chooseday email"),x(!1);return}x(!1),T(void 0),F()},Z=async e=>{u(void 0),B(e.id);let t=await (0,d.YZ)(e.id);if(B(void 0),(0,c.JN)(t))return void u("Error loading Chooseday email preview");$(t)},L=C(),O=e=>{var t;return(null==(t=e.weekDate)?void 0:t.slice(0,10))===L},R=[{title:"Week date",sortable:!0,sortKey:"weekDate",render:e=>(0,i.jsx)(v.E,{as:"span",children:(0,p.Ay)((0,g._)(e.weekDate),"dS mmmm, yyyy")})},{title:"Title",sortable:!0,sortKey:"title",render:e=>(0,i.jsxs)(v.E,{as:"span",children:["Episode ",e.episodeNumber,": ",e.title]})},{title:"Status",sortable:!0,sortKey:"status",render:e=>(0,i.jsxs)(A.o,{gap:"100",children:[(0,i.jsx)(E.E,{tone:e.status===w.Cho
1osedayEmailStatus.Published?"success":"attention",children:e.status}),e.status===w.ChoosedayEmailStatus.Published&&O(e)&&(0,i.jsx)(E.E,{tone:"info",children:"Next send"})]})},{title:"Actions",render:e=>(e=>{var t,n;return(null!=(n=null==(t=e.weekDate)?void 0:t.slice(0,10))?n:"")<L})(e)?(0,i.jsxs)(A.o,{gap:"200",children:[(0,i.jsx)(D.$,{variant:"plain",loading:Y===e.id,onClick:()=>Z(e),children:"Preview"}),e.status===w.ChoosedayEmailStatus.Draft&&(0,i.jsx)(D.$,{variant:"plain",tone:"critical",onClick:()=>T(e),children:"Delete"})]}):(0,i.jsxs)(A.o,{gap:"200",children:[(0,i.jsx)(D.$,{variant:"plain",onClick:()=>h().push("/admin/backoffice/chooseday-emails/".concat(e.id,"/edit")),children:"Edit"}),e.status===w.ChoosedayEmailStatus.Draft&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(D.$,{variant:"plain",onClick:()=>j(e),children:"Publish"}),(0,i.jsx)(D.$,{variant:"plain",tone:"critical",onClick:()=>T(e),children:"Delete"})]})]})}];return(0,i.jsxs)(s.yB,{adminArea:"backoffice",title:"Chooseday Emails",primaryAction:{content:"Create Chooseday Email",onAction:()=>h().push("/admin/backoffice/chooseday-emails/new")},secondaryActions:[{content:"Send now",destructive:!0,onAction:()=>_(!0)}],children:[(0,i.jsx)(N.P,{children:(0,i.jsxs)(N.P.Section,{children:[r&&(0,i.jsx)(f.lZ,{tone:"critical",children:r}),z&&(0,i.jsx)(f.lZ,{tone:"success",onDismiss:()=>K(void 0),children:z}),(0,i.jsx)(o.H,{data:e,columns:R,searchableFields:["title",e=>String(e.episodeNumber)],resourceName:{singular:"Chooseday Email",plural:"Chooseday Emails"},loading:n,searchPlaceholder:"Search by title...",resourceIDResolver:e=>e.id,emptyState:(0,i.jsx)(v.E,{as:"p",children:"No Chooseday emails found"}),pagination:{enabled:!0,defaultPageSize:20,pageSizeOptions:[10,20,50,100]}})]})}),(0,i.jsx)(k.A,{open:!!M,onClose:()=>$(void 0),episodeNumber:null==M?void 0:M.episodeNumber,title:null==M?void 0:M.title,weekDate:null==M?void 0:M.weekDate,headerImageUrl:null==M?void 0:M.headerImageUrl,bodyHtml:null==M?void 0:M.bodyHtml}),(0,i.jsx)(S,{open:P,emails:e,loading:y,onClose:()=>_(!1),onSend:J}),(0,i.jsx)(m.a,{open:!!b,onClose:()=>j(void 0),title:"Publish Chooseday email?",primaryAction:{content:"Publish",loading:y,onAction:H},secondaryActions:[{content:"Cancel",onAction:()=>j(void 0)}],children:(0,i.jsx)(m.a.Section,{children:(0,i.jsxs)(v.E,{as:"p",children:["This will publish the email for Tuesday"," ",b&&(0,p.Ay)((0,g._)(b.weekDate),"dS mmmm, yyyy"),"."," ",b&&O(b)?"This is the upcoming Tuesday, so it becomes the email that the weekly schedule (and Send now) dispatches.":"Its week is further ahead — it will not send until its own week arrives."," ","Continue?"]})})}),(0,i.jsx)(m.a,{open:!!I,onClose:()=>T(void 0),title:"Delete Chooseday email?",primaryAction:{content:"Delete",destructive:!0,loading:y,onAction:W},secondaryActions:[{content:"Cancel",onAction:()=>T(void 0)}],children:(0,i.jsx)(m.a.Section,{children:(0,i.jsx)(v.E,{as:"p",children:"Are you sure you want to delete this Chooseday email? This cannot be undone."})})})]})})},23753:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/backoffice/chooseday-emails",function(){return n(13819)}])},26195:(e,t,n)=>{"use strict";n.d(t,{N:()=>s,x:()=>a});var i=n(80992);function a(e){return"\n    font-size: ".concat({extraSmall:.625,small:1.2/1.6,medium:1.4/1.6,large:1.125,extraLarge:2.4/1.6}[e],"rem;\n  ")}function s(e){let t={positive:"color:".concat((0,i.y)("green","dark"),";"),negative:"color:".concat((0,i.y)("red","dark"),";"),strong:"font-weight: 600;",subdued:"opacity:0.5;"}[e];return"\n    ".concat(t,";\n  ")}},41729:(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var i=n(80992);function a(e){return({base:"3px",large:"6px"})[e]}(0,i.y)("sky"),(0,i.y)("sky","dark")},45991:(e,t,n)=>{"use strict";n.d(t,{A:()=>f});var i=n(37876);n(14232);var a=n(44264),s=n(61436),o=n(67299),l=n(64850),r=n(41943),d=n(56362);let c=a.Ay.div.withConfig({componentId:"sc-daf0229e-0"})(["display:flex;justify-content:space-between;background:",";"],(0,s.yW)("white")),u=a.Ay.div.withConfig({componentId:"sc-daf0229e-1"})(["flex:0 1 90%;padding:",";display:flex;justify-content:center;align-items:center;flex-wrap:wrap;"],(0,s.YK)("extra-tight")),h=a.Ay.div.withConfig({componentId:"sc-daf0229e-2"})(["flex:0 1 5%;padding:",";text-align:right;"],(0,s.YK)("tight")),p=a.Ay.div.withConfig({componentId:"sc-daf0229e-3"})(["flex:0 1 5%;padding:",";"],(0,s.YK)("tight")),g=a.Ay.div.withConfig({componentId:"sc-daf0229e-4"})(["",""],e=>{let{$selected:t}=e;return(0,a.AH)(["display:flex;flex-direction:column;align-items:center;margin:0.7rem 0.7rem;@media (max-width:","){& > *{display:none;}
1height:15px;width:10px;background-color:",";border-radius:50%;display:inline-block;}"],o.f.tabletLandscape+"px",t?(0,s.yW)("primary"):"#e9e9e9")}),m=a.Ay.span.withConfig({componentId:"sc-daf0229e-5"})([""," ",";position:relative;margin-bottom:0.35rem;"],e=>{let{$selected:t}=e;return t?"\n    ".concat((0,s.xP)("extraLarge"),";\n    color: #0b1f59;\n  "):"\n    ".concat((0,s.xP)("large"),";\n    color: #e9e9e9;\n  ")},(0,s.N9)("strong")),y=a.Ay.span.withConfig({componentId:"sc-daf0229e-6"})(["background-color:",";height:",";width:150px;"],e=>e.$selected?(0,s.yW)("primary"):"#e9e9e9",(0,s.YK)("extra-tight"));function f(e){let{stepList:t,currentStep:n,onNavigate:a,hideButtons:s,hideLeftButton:o,hideRightButton:f,onClickBack:x}=e;return(0,i.jsxs)(c,{children:[!s&&!o&&(0,i.jsx)(p,{children:(0,i.jsx)(l.A,{primary:!0,icon:r.S,direction:"left",onClick:x,children:"Back"})}),(0,i.jsx)(u,{children:t.map(e=>{let{id:t,label:a}=e,s=n===t;return(0,i.jsxs)(g,{$selected:s,children:[(0,i.jsx)(m,{$selected:s,children:a}),(0,i.jsx)(y,{$selected:s})]},t)})}),!s&&!f&&(0,i.jsx)(h,{children:(0,i.jsx)(l.A,{primary:!0,icon:d.S,direction:"right",onClick:a,children:"Next"})})]})}},49246:(e,t,n)=>{"use strict";n.d(t,{H:()=>v});var i=n(37876),a=n(14232),s=n(8303),o=n(84662),l=n(69666),r=n(32395),d=n(89219),c=n(84218),u=n(77742),h=n(35070),p=n(67409),g=n(8949),m=n(84548),y=n(72442),f=n(45890),x=n(6449),b=n(89099);function v(e){var t;let{data:n,columns:v,searchableFields:w,bulkActions:j,resourceName:C,loading:S=!1,searchPlaceholder:k="Search...",resourceIDResolver:A,getRowUrl:E,emptyState:D,pagination:N}=e,I=(0,b.useRouter)(),[T,P]=(0,a.useState)(""),[_,z]=(0,a.useState)(1),[K,M]=(0,a.useState)((null==N?void 0:N.defaultPageSize)||10),[$,Y]=(0,a.useState)(null),[B,F]=(0,a.useState)("ascending"),[H,J]=(0,a.useState)(!1),W=null!=(t=null==N?void 0:N.enabled)&&t,Z=(null==N?void 0:N.pageSizeOptions)||[10,20,50,100],L=(0,a.useMemo)(()=>v.some(e=>e.sortable),[v]),O=(0,a.useCallback)(()=>J(e=>!e),[]),R=(0,a.useCallback)(e=>{Y(e),$!==e&&F("ascending"),z(1)},[$]),U=(0,a.useCallback)(e=>{F(e),z(1)},[]),q=(0,a.useCallback)(()=>{Y(null),F("ascending"),J(!1)},[]),V=(0,a.useMemo)(()=>{if(null===$)return"Sort";let e=v[$],t="ascending"===B?"Ascending":"Descending";return"".concat(e.title," (").concat(t,")")},[$,B,v]),X=(0,a.useMemo)(()=>{if(!T.trim())return n;let e=T.toLowerCase();return n.filter(t=>w.some(n=>{let i;if("function"==typeof n)i=n(t);else{var a;i=String(null!=(a=t[n])?a:"")}return i.toLowerCase().includes(e)}))},[n,T]),G=(0,a.useMemo)(()=>{if(null===$)return X;let e=v[$];return e.sortable&&e.sortKey?[...X].sort((t,n)=>{let i,a;if("function"==typeof e.sortKey?(i=e.sortKey(t),a=e.sortKey(n)):(i=t[e.sortKey],a=n[e.sortKey]),null==i&&null==a)return 0;if(null==i)return 1;if(null==a)return -1;let s=0;return s="string"==typeof i&&"string"==typeof a?i.localeCompare(a):"number"==typeof i&&"number"==typeof a?i-a:String(i).localeCompare(String(a)),"ascending"===B?s:-s}):X},[X,$,B,v]);(0,a.useMemo)(()=>{z(1)},[T]);let Q=(0,a.useMemo)(()=>{if(!W)return G;let e=(_-1)*K,t=e+K;return G.slice(e,t)},[G,_,K,W]),ee=Math.ceil(G.length/K),et=W?Q:G,{selectedResources:en,allResourcesSelected:ei,handleSelectionChange:ea}=(0,s.D)(et,{resourceIDResolver:e=>A(e)}),es=null==j?void 0:j.map(e=>({content:e.content,onAction:()=>{let t=ei?n:n.filter(e=>en.includes(A(e)));e.onAction(t,ei)}})),eo=et.map((e,t)=>{let n=A(e),a=E?E(e):void 0;return(0,i.jsx)(o.h.Row,{id:n,...j&&j.length>0?{selected:en.includes(n)}:{},position:t,onClick:a?()=>{a&&I.push(a)}:void 0,children:v.map((t,n)=>(0,i.jsx)(o.h.Cell,{children:(0,i.jsx)("div",{style:{padding:"0.5rem 0"},children:t.render(e)})},n))},n)});return(0,i.jsxs)(l.Z,{padding:"0",children:[(0,i.jsx)("div",{style:{padding:"1rem"},children:(0,i.jsxs)(r.a,{gap:"400",children:[(0,i.jsxs)(d.o,{gap:"200",blockAlign:"start",children:[(0,i.jsx)("div",{style:{flex:1},children:(0,i.jsx)(c.A,{label:"Search",labelHidden:!0,value:T,onChange:P,placeholder:k,autoComplete:"off",clearButton:!0,onClearButtonClick:()=>P("")})}),L&&(0,i.jsx)(u.A,{active:H,preferredAlignment:"left",preferredPosition:"below",activator:(0,i.jsx)(h.$,{onClick:O,disclosure:"down",icon:x.S,children:V}),onClose:O,children:(0,i.jsx)(p.l,{actionRole:"menuitem",sections:[...null!==$?[{items:[{content:"Clear sort",onAction:q}]}]:[],{items:v.map((e,t)=>e.sortable?{content:e.title,active:$===t,onAction:()=>R(t)}
1:null).filter(Boolean)},{title:"Sort direction",items:[{content:"Ascending",prefix:"ascending"===B?"●":"○",onAction:()=>U("ascending")},{content:"Descending",prefix:"descending"===B?"●":"○",onAction:()=>U("descending")}]}]})})]}),W&&(0,i.jsxs)(d.o,{align:"space-between",blockAlign:"center",children:[(0,i.jsxs)(d.o,{gap:"200",blockAlign:"center",children:[(0,i.jsx)(g.E,{as:"span",variant:"bodyMd",children:"Items per page:"}),(0,i.jsx)("div",{style:{width:"80px"},children:(0,i.jsx)(m.l,{label:"Items per page",labelHidden:!0,options:Z.map(e=>({label:e.toString(),value:e.toString()})),value:K.toString(),onChange:e=>{M(Number(e)),z(1)}})})]}),(0,i.jsx)(g.E,{as:"span",variant:"bodyMd",tone:"subdued",children:G.length>0?"".concat((_-1)*K+1,"-").concat(Math.min(_*K,G.length)," of ").concat(G.length):"0 items"})]})]})}),S?(0,i.jsx)("div",{style:{padding:"2rem",textAlign:"center"},children:(0,i.jsx)(y.y,{size:"large"})}):0===et.length&&D?(0,i.jsx)("div",{style:{padding:"2rem"},children:D}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.h,{resourceName:C,itemCount:et.length,selectable:!!(j&&j.length>0),selectedItemsCount:j&&j.length>0?ei?"All":en.length:void 0,onSelectionChange:j&&j.length>0?ea:void 0,promotedBulkActions:j&&j.length>0?es:void 0,headings:v.map(e=>({title:e.title})),children:eo}),W&&ee>1&&(0,i.jsx)("div",{style:{padding:"1rem",display:"flex",justifyContent:"center",borderTop:"1px solid var(--p-color-border-subdued)"},children:(0,i.jsx)(f.d,{hasPrevious:_>1,onPrevious:()=>z(_-1),hasNext:_<ee,onNext:()=>z(_+1),label:"Page ".concat(_," of ").concat(ee)})})]})]})}},61436:(e,t,n)=>{"use strict";n.d(t,{Vq:()=>i.V,yW:()=>a.y,p0:()=>l,cz:()=>o,r7:()=>r,YK:()=>s.Y,xP:()=>d.x,N9:()=>d.N});var i=n(41729),a=n(80992),s=n(84578);function o(e){return({base:"cubic-bezier(0.64, 0, 0.35, 1)",in:"cubic-bezier(0.36, 0, 1, 1)",out:"cubic-bezier(0, 0, 0.42, 1)",excite:"cubic-bezier(0.18, 0.67, 0.6, 1.22)",overshoot:"cubic-bezier(0.07, 0.28, 0.32, 1.22)",anticipate:"cubic-bezier(0.38, -0.4, 0.88, 0.65)"})[e]}function l(e){return({fast:100,base:200,slow:300,slower:400,slowest:500})[e]+"ms"}function r(e){return({faint:"0 1px 0 0 rgba(22, 29, 37, 0.05)",base:"0 0 0 1px rgba(63, 63, 68, 0.05), 0 1px 3px 0 rgba(63, 63, 68, 0.15)",deep:"0 0 0 1px rgba(6, 44, 82, 0.1), 0 2px 16px rgba(33, 43, 54, 0.08)",layer:"0 31px 41px 0 rgba(32, 42, 53, 0.2), 0 2px 16px 0 rgba(32, 42, 54, 0.08)",transparent:"0 0 0 0 transparent"})[e]}var d=n(26195)},64850:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(37876);n(14232);var a=n(35070);let s=e=>{let{children:t,icon:n,onClick:s,...o}=e;return(0,i.jsx)(a.$,{external:!0,variant:"primary",size:"large",fullWidth:!0,icon:n,onClick:s,...o,children:t})}},84578:(e,t,n)=>{"use strict";function i(e){let t={none:0,"extra-tight":.625,tight:1.25,base:2.5,loose:3.125,"extra-loose":5}[e];return 0===t?0:"".concat(t,"rem")}n.d(t,{Y:()=>i})}},e=>{e.O(0,[2026,9879,6494,6960,2120,7930,1286,7083,4465,8777,3399,4974,6190,6186,636,6593,8792],()=>e(e.s=23753)),_N_E=e.O()}]);
2//# sourceMappingURL=chooseday-emails-5fa48920f04f5870.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.