1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EmailTemplateSetup-DmJMojUQ.js","assets/vendor-query-CML5FxPR.js","assets/vendor-react-oQp4urKO.js","assets/index-D63u7RRD.js","assets/vendor-ui-qQFM1ZHb.js","assets/vendor-supabase-BgQJfCCH.js","assets/vendor-charts-Du44YKL_.js","assets/index-nSPtKqw2.css","assets/card-DrvIgE54.js","assets/textarea-CSX8hOKa.js","assets/switch-DjSfhUOb.js","assets/badge-DJn1BKj4.js","assets/collapsible-9v8bNa23.js","assets/tabs-CPSWf_qg.js","assets/brands-CqVXKaPR.js","assets/emailLayout-9eqONpPn.js","assets/schedule-D9LXy2vU.js","assets/reminderSchedule-Cc-xlDdU.js","assets/chevron-down-kXmZ2NaY.js","assets/pencil-DIRkxP7E.js","assets/WorkflowMonitor-B7h634An.js","assets/checkbox-BGZgoLQy.js","assets/check-F7x_oBud.js","assets/table-Cfx9Xu3P.js","assets/select-BeKiKmL4.js","assets/chevron-up-BejTZMUn.js","assets/DataPagination-B12v3-Jp.js","assets/chevron-left-CmqOSlnn.js","assets/DataToolbar-D5rA8_ue.js","assets/SendTriggerBadge-B1y05BoZ.js","assets/hand-BRXSeHMD.js","assets/flask-conical-BP8ScrgL.js","assets/companyFye-CjqVLzhr.js","assets/types-CkIxQblv.js","assets/format-CzNdI1F_.js","assets/external-link-CimBVVuD.js","assets/zap-D4j-_0Jq.js","assets/play-B5kw7qHv.js","assets/rotate-ccw-uQ5FwdTK.js","assets/square-CodaFRFK.js","assets/ReplyList-DchKAtLB.js","assets/paperclip-DgNdQoTS.js","assets/circle-alert-D_3ogsMq.js","assets/circle-help-DcQOMV6i.js","assets/SendProgressCard-C8kFXkeT.js","assets/progress-C__m9Vnb.js","assets/reminderCohort-CuKsyf5Y.js","assets/loader-circle-_gNaNS3A.js","assets/activity-BjPAqaUL.js","assets/circle-pause-BHGHeX-n.js","assets/send-DMTe9QcR.js","assets/pause-CtgEp5XN.js","assets/radio-group-BJf-HhOg.js","assets/circle-7afuXP9c.js","assets/CompanyCombobox-DQ0Oleqn.js","assets/command-DfQNlaC8.js","assets/chevrons-up-down-DYDKiiWc.js","assets/link-2-Uj_rNfj7.js","assets/triangle-alert-qIrO8F1R.js","assets/mail-check-B0wIx2Bh.js","assets/refresh-cw-BSpBOaJN.js","assets/circle-x-B8IXxvMP.js","assets/usePathTab-DIXg6DtQ.js","assets/PageHeader-CfxguHdq.js","assets/NoAccess-DKdY5S6y.js","assets/shield-off-JTCjBKeh.js","assets/settings-2-BcHlHiOI.js","assets/ReminderScheduleView-D-2xJg3m.js","assets/users-round-CEXciI1-.js","assets/TestingPanel-C-zmDlF3.js","assets/calendar-B0hVmtpw.js","assets/isSameDay-DuRrIZz7.js","assets/addDays-gwgdVUsW.js","assets/startOfMonth-B5T9d2sI.js","assets/addMonths-BcMtGtt3.js","assets/isSameMonth-DaTs0E1a.js","assets/isBefore-DGuU5gVh.js","assets/isAfter-Br-9mqWY.js","assets/addWeeks-Cps2LQVZ.js","assets/endOfWeek-BKJbGtEU.js","assets/addYears-BOqPfuQi.js","assets/subDays-qffkV652.js","assets/calendar-B-zJvlzl.js","assets/trash-2-CTG8YhCg.js","assets/info-D7Uv9ZXV.js","assets/ReminderGeneralSettings-JxH3L6I5.js","assets/useSearchParamState-cnWrbqA0.js","assets/useSettings-vjfv4r9H.js","assets/useWorkspaceId-B2Q3CrB0.js","assets/ReminderBrandsCard-BnbOzyny.js","assets/save-Dy2L5Y6b.js","assets/calendar-days-D0oIipk2.js","assets/reply-CsxmNx4w.js","assets/EmailListEditor-Cu0lhoYu.js","assets/plus-BsSG3PRq.js","assets/types-Bbu0IFp_.js","assets/power-off-D5sD7r-9.js","assets/incorporationEmail-CdiiBRm1.js","assets/useIncorporationEmail-DZ9suB-w.js","assets/upload-Ch1nMiOh.js","assets/taxReviewEmail-Ct-3kFDt.js","assets/file-check-2-weJw1GoJ.js"])))=>i.map(i=>d[i]); 2import{z as v,D as k,aR as N,B as y,m as A,n as E,o as T,p as S,s as R,ax as p,_ as u,r as C,M as _,S as x}from"./index-D63u7RRD.js";import{j as e,u as M}from"./vendor-query-CML5FxPR.js";import{r as l}from"./vendor-react-oQp4urKO.js";import{u as F}from"./usePathTab-DIXg6DtQ.js";import{T as O,a as G,b as c,c as m}from"./tabs-CPSWf_qg.js";import{P as f}from"./PageHeader-CfxguHdq.js";import{N as I}from"./NoAccess-DKdY5S6y.js";import{B as o}from"./badge-DJn1BKj4.js";import{C as q}from"./circle-help-DcQOMV6i.js";import{T as D}from"./triangle-alert-qIrO8F1R.js";import{A as B}from"./activity-BjPAqaUL.js";import{S as L}from"./settings-2-BcHlHiOI.js";import{F as P}from"./flask-conical-BP8ScrgL.js";/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const W=v("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]),be={agm_compliance:"AGM Compliance",tax_filing:"Tax Filing"},we={main:"Main",track_a:"Track A",track_b:"Track B",escalation:"Escalation"},b=[{key:"main",name:"Main track",note:"Starts the sequence. Sent first, everything else is measured from here.",mails:[{step:1,code:"1",label:"Email 1 â Initial compliance notice",when:"Day of / just after financial year-end (offset 0 days)",subject:"Compliance reminder â upcoming statutory deadlines for [Company Name]"}]},{key:"track_a",name:"Track A â AGM & financial statements",note:"Runs in parallel with Track B. Chases the AGM and the financials.",mails:[{step:2,code:"2A",label:"Email 2A â AGM & financials follow-up",when:"1.5 months after Email 1 (45 days)",subject:"Follow-up â AGM and financial statements for [Company Name]"},{step:5,code:"4A",label:"Email 4A â AGM deadline approaching",when:"4 months after Email 1 (120 days)",subject:"Action required â AGM deadline in [X] weeks for [Company Name]"}
7,{step:6,code:"5A",label:"Email 5A â Fifth reminder (AGM critical)",when:"4.5 months after Email 1 (135 days)",subject:"Fifth reminder â AGM deadline critical for [Company Name]"}]},{key:"track_b",name:"Track B â ECI filing",note:"Runs in parallel with Track A. Only about ECI.",mails:[{step:3,code:"2B",label:"Email 2B â ECI follow-up",when:"1.5 months after Email 1 (45 days) â same day as Email 2A",subject:"Reminder â ECI filing required for [Company Name]"},{step:4,code:"3B",label:"Email 3B â ECI deadline urgency",when:"2.5 months after Email 1 (75 days)",subject:"Urgent â ECI filing deadline approaching for [Company Name]"}]},{key:"escalation",name:"Escalation track â senior staff",note:"Last resort. Sent from a senior sender when nothing has been resolved.",mails:[{step:7,code:"6",label:"Email 6 â Senior escalation",when:"5 months after Email 1 (150 days)",subject:"Escalation notice â statutory deadlines for [Company Name]"},{step:8,code:"7+",label:"Email 7+ â Weekly reminders",when:"Every week from 5 months onward, until resolved or stopped",subject:"Reminder [#] â urgent compliance matters for [Company Name]",repeating:!0}]}],w=[{key:"main",name:"Main track (single track)",note:"Fixed calendar dates, the same for every company â the Form C / C-S deadline is 30 November for all of Singapore. Editable in Settings â Reminders â Fixed reminder dates.",mails:[{step:1,code:"1",label:"Email 1 â Initial notice",when:"1 September",subject:"[Entity Name] â FY[FY Year] Corporate Tax Filing Deadline Reminder"},{step:2,code:"2",label:"Email 2 â Friendly reminder",when:"15 September · existing and new clients read differently",subject:"[Entity Name] â FY[FY Year] Tax Filing Arrangement Confirmation"},{step:3,code:"3",label:"Email 3 â 30-day notice",when:"1 October · existing and new clients read differently",subject:"Final Follow-Up â [Entity Name] FY[FY Year] Tax Filing"},{step:4,code:"4",label:"Email 4 â Final notice",when:"1 November",subject:"Final Reminder â FY[FY Year] Corporate Tax Filing Deadline"}]}],j={agm_compliance:b,tax_filing:w};function Y(t,s){var i;return((i=(j[t]||[]).find(n=>n.key===s))==null?void 0:i.mails)??[]}function H(t,s,a){const i=Y(t,s).find(n=>n.step===a);return i||(j[t]||[]).flatMap(n=>n.mails).find(n=>n.step===a)}function je(t,s,a){const i=H(t,s,a);return i?`Email ${i.code}`:`Step ${a}`}const K=[{q:"Why does a Tax (ECI) task appear for some companies and not others?",a:"Because the ECI email opens it. There is no schedule creating ECI tasks: when the AGM sequence reaches Track B â the ECI emails, 2B and 3B â and the email is actually sent, the task is created and the email recorded on it. So a company has no ECI task while its sequence has not reached that email yet, or the sequence is paused or stopped, or it was never enrolled (no year end, no company admin email). And if the company already has an open ECI task due within about four months, the email is recorded on that one instead of opening a second."},{q:"The client accepted the quotation â why is the AGM reminder still going?",a:`Until 30 September the AGM emails stopped only while the task sat at exactly Info Gathering. The flow branches at Email Reminder: answering "the client did not reply" skips Info Gathering and goes straight to Quotation, so a task at Quotation, Chase for Acceptance or Preparing Account/FS was never seen as engaged and the emails carried on. It now stops from Info Gathering onwards, the way tax stops from Quoted onwards. Note that a comment saying the client accepted is not read by the engine â the task's stage is what it looks at.`},{q:"What stops the emails, in one line?",a:"The task reaching its stage (tax: Quoted or later; AGM: Info Gathering or later), the client replying, the task being closed or the milestone marked done or exempt, a bounce, or somebody pressing Stop."}],V=` 8 ENROL 9 Company (Active â "Active?" is excluded from all client email) 10 â 11 âââ Has a company admin with an email? ââââ No âââ¶ Not enrolled ("Needs attention") 12 â â Yes 13 âââ Has a financial year end? ââââââââââââââââ No âââ¶ Waiting for date
14 â â (FYE is the anchor; not needed for fixed dates) 15 â¼ 16 Too late to start on its own? ââââââââââââ Yes âââ¶ Created, but MANUAL 17 â Judged on Email 1's age, not each letter's, so a client 18 â never meets the firm through its escalation notice. 19 â¼ 20 One workflow run is created PER TRACK. 21 Tracks run in PARALLEL, they are not a branch: an AGM company runs Track A and 22 Track B at the same time. This is why a client/audience split is a second body 23 on one step, never a second track. 24 25 SCHEDULE â three kinds, per sequence 26 âââ Fixed dates Corporate Tax Filing. Same calendar dates for every 27 â company (1 Sep, 15 Sep, 1 Oct, 1 Nov), because the 28 â Form C / C-S deadline is 30 November for everyone. 29 â A company joining mid-season gets the CURRENT letter 30 â now -- joining 10 Sep sends Email 1, then Email 2 on 31 â 15 Sep -- but never the backlog before it. 32 âââ Monthly round Off. Built for AGM, kept in place and switched off in 33 â Settings. On the 1st, everyone whose AGM 34 â deadline fell LAST MONTH is chased, and the whole 35 â sequence starts for them, measured FORWARD from that 36 â date (step 1 on the day, 2A +45, escalation +150). 37 â The month window is also the year filter: an August 38 â 2025 deadline is not in August 2026, so earlier years 39 â are never picked up. 40 â A round whose date has already passed is still raised 41 â and goes out late rather than never â but only the 42 â current month. A scheduler off since June does not 43 â chase June, July and August in the same hour. 44 âââ Per company AGM Compliance. Measured FORWARD from the company's 45 financial year end: Email 1 on the year end itself, 46 2A/2B +45, 3B +75, 4A +120, 5A +135, escalation +150 â 47 the last of them about a month before the AGM 48 deadline at FYE + 6 months. 49 The offsets are written in emailMap.ts as "N days 50 after Email 1", and that is now what they mean. They 51 used to be SUBTRACTED from the AGM deadline, which 52 both inverted the order (escalation went out first, 53 the initial notice last) and moved everything six 54 months late. 55 56 All three are set in Settings â Reminders â Timing & replies. 57 58 SEND â hourly scheduler picks up every run whose next send date has passed 59 â 60 âââ Which letter? A step may carry two bodies. A company with a tax job 61 â from an earlier YA gets the existing-client wording; 62 â everyone else gets the new-client one. Override per 63 â company with Tax engagement. 64 â 2026 SEASON: no split. Everyone gets the general 65 â (new-client) version; the existing-client wording 66 â starts with the 2027 season. 67 âââ Tax years Taken from the calendar, not the company. A letter 68 â sent in 2026 says FY2025 and 30 November 2026 to 69 â everyone -- that deadline is for the year that ended 70 â in 2025, whatever the company's year end. 71 âââ Recipients Every company admin email, minus suppressed addresses. 72 â The portal agreement is NOT required. 73 âââ Reply-to Per sequence (tax â [email protected]). Without it 74 â replies go to the brand's no-reply address. 75 âââ Sent Logged in history (green), and RECORDED ON THE TASK 76 â for that compliance cycle â a comment on the existing 77 â AGM/Tax task, or a new task only if none exists. 78 âââ Failed Retry after 1 hour, then daily. Retry / Resolve by hand. 79 âââ Late Only for per-company sequences: the email carries a 80 banner naming what was missing. 81 82 NOT CONNECTED 83 Outstanding does not read email logs. It reads the compliance dates on the 84 company profile. Sending or not sending a reminder changes nothing there. 85`,Q=` 86 Day 0 1.5 mo 2.5 mo 4 mo 4.5 mo 5 mo weekly 87 â â â â â â â 88Main â¶ Email 1 â â â â â â 89Track A âââââââââ¶ Email 2A ââââ¼âââââââââââ¶ Email 4A ââ¶ Email 5A â â 90Track B âââââââââ¶ Email 2B ââ¶ Email 3B â â â â 91Escalation ââââââ¼ââââââââââââââ¼âââââââââââââ¼âââââââââââââ¼âââââââââââ¶ Email 6 ââ¶ Email 7+ (repeats) 92`,U=[{when:"The task moves to its stage",tax:"Tax (CIT) task moves to Quoted â or jumps to any stage after it",agm:"AGM / Yearly FS task moves to Info Gathering â or to any stage after it: Quotation, Chase for Acceptance, Preparing Account/FS and everything later",effect:"Stops at once, the moment the stage changes â not at the next send, and the task does not need to be done. Every email of that sequence for the company stops (AGM: Main, 2A/5/6, ECI 3/4 and escalation). Moving the task back does not restart it."},{when:"The client replies",tax:"A reply to any tax email",agm:"A reply to any AGM email",effect:"Paused, and the reply is recorded on the task and in Client replies â always, even when the sequence had already stopped. Resume sends the next email; only a new reply pauses it again."},{when:"The work is marked finished",tax:"Task closed, or Mark as done on the company",agm:"Task closed, or Mark as done on the company",effect:"Ended for this cycle."},{when:"Someone stops it, or an email bounces",tax:"Stop in the company's details; a bounced or spam-flagged address",agm:"Same",effect:"Stopped. A bounce also suppresses the address."}],z=[{title:"1. Email Templates tab",body:"Define what each step sends. A template is matched by w
92orkflow, track and step order. If no active template matches a step, nothing is sent for that step."},{title:"2. Monitor tab (Ops Console)",body:"The one place reminders are driven from â a company's own page only shows them. The cards on top: Sending, Stopped by task stage, Client replied (waiting on the team), Needs attention (failed, overdue or manual emails) and Sent in the last 7 days; click one to open its list. Tabs: Needs attention; All companies, with Tax Filing and AGM Compliance described in words per company; Client replies, one row per company and sequence with the latest reply, the emails answered, the task's current stage and what the sequence is doing now (red when an email is still due); Stopped, one row per company with why, when, by whom and the task, filterable by reason; Not started; Suppressed. Every row opens the company's details."},{title:"3. Company details",body:`At the top, one card per sequence: its state in a sentence ("Stopped â tax task moved to Quoted, 15 Sep by Kelly"), the task and its stage, and Resume, Restart or Start. Below, Emails by track shows every email as sent / next / stopped here, with Send now, Retry, Skip, Stop and mode switches. The Timeline lists emails sent, client replies, stops and restarts in order; the eye icon previews the exact email delivered. Restart sends again from the email it stopped at, on that email's date (within the hour if the date has passed); after a Restart the task's stage no longer stops it, but moving the task to that stage again does.`},{title:"4. Settings â Reminders",body:"Four sub-tabs. Scheduler is the on/off switch and manual starts. Timing & replies holds the three ways a sequence can be scheduled and where replies land. Brands is the sender identity per Portfolio Owner. Internal notices names the addresses told about website enquiries, document uploads, compliance chases and payment reminders, plus the global CC â all of them addresses now, not roles, because granting somebody a role should not subscribe them to clients' mail. Every change here is confirmed first, because all of them change client email for every company at once."},{title:"5. Testing tab",body:"An isolated sandbox to send any template to yourself. It never touches live runs, live schedules or company history."}],J=['Only Active companies are enrolled. "Active?" means we are not sure enough about the company to email its client, and it is excluded from every automated send.',"A company admin email is required â the portal agreement is NOT required. A client who has never accepted the portal terms still receives every reminder.","The relevant compliance date must exist on the company Overview tab â except for a fixed-date sequence, whose dates belong to the firm rather than the company.","The scheduler must be enabled (see the Monitor KPI row).","Overdue steps are still sent once the blockers are cleared; the email explains the delay.","Suppressed (bounced/complained) addresses are skipped automatically. A company whose only admin is suppressed receives nothing and reschedules daily.","Every send is recorded on the company's compliance task. Outstanding is unaffected either way â it reads the compliance dates, not the email log."];function g({tracks:t}){return e.jsx("div",{className:"space-y-3",children:t.map(s=>e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"bg-muted/50 px-3 py-2",children:[e.jsx("p",{className:"text-sm font-medium",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.note})]}),e.jsx("ul",{className:"divide-y",children:s.mails.map(a=>e.jsxs("li",{className:"px-3 py-2 flex gap-3",children:[e.jsx("span",{className:"mt-0.5 shrink-0 h-5 w-5 rounded-full bg-primary/10 text-primary text-[10px] font-semibold flex items-center justify-center",children:a.step}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-sm font-medium flex items-center gap-2 flex-wrap",children:[a.label,a.repeating&&e.jsx(o,{variant:"secondary",className:"text-[10px]",children:"repeats weekly"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["When: ",a.when]}),e.jsxs("p",{className:"text-xs text-muted-foreground italic truncate",children:["Subject: ",a.subject]})]})]},a.step))})]},s.key))})}function $(){const[t,s]=l.useState(!1);return e.jsxs(k,{open:t,onOpenChange:s,children:[e.jsx(N,{asChild:!0,children:e.jsxs(y,{variant:"outline",size:"sm",className:"gap-1.5 h-9",children:[e.jsx(q,{className:"h-4 w-4"})," How reminders work"]})}),e.jsxs(A,{className:"sm:max-w-3xl max-h-[85vh] overflow-y-auto",children:[e.jsxs(E,{children:[e.jsx(T,{children:"How the reminder engine works"}),e.jsx(S,{children:"End-to-end flow, the conditions that must be met, and how to manage each tab."})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Asked most often"}),e.jsx("div",{className:"space-y-3",children:K.map(a=>e.jsxs("div",{className:"border rounded-lg px-3 py-2",children:[e.jsx("p",{className:"text-sm font-medium",children:a.q}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 leading-relaxed",children:a.a})]},a.q))})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Flow"}),e.jsx("pre",{className:"text-[11px] leading-5 bg-muted/50 rounded-lg p-3 overflow-x-auto",children:V.trim()})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"When emails stop"}),e.jsx("div",{className:"border rounded-lg overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left font-medium px-3 py-2",children:"When"}),e.jsx("th",{className:"text-left font-medium px-3 py-2",children:"Tax Filing"}),e.jsx("th",{className:"text-left font-medium px-3 py-2",children:"AGM Compliance"}),e.jsx("th",{className:"text-left font-medium px-3 py-2",children:"What happens"})]})}),e.jsx("tbody",{className:"divide-y align-top",children:U.map(a=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-3 py-2 font-medium",children:a.when}),e.jsx("td",{className:"px-3 py-2",children:a.tax}),e.jsx("td",{className:"px-3 py-2",children:a.agm}),e.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:a.effect})]},a.when))})]})}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-2",children:"Before every automatic email the scheduler also checks again: Resend's received mail
92(nothing is sent while that check fails), a client reply since the sequence's first email, and the task's stage."})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"AGM Compliance â timeline of every email"}),e.jsx("pre",{className:"text-[11px] leading-5 bg-muted/50 rounded-lg p-3 overflow-x-auto mb-3",children:Q.trim()}),e.jsx(g,{tracks:b})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Corporate Tax Filing â timeline of every email"}),e.jsx(g,{tracks:w})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Conditions to start sending"}),e.jsx("ul",{className:"space-y-1.5",children:J.map(a=>e.jsxs("li",{className:"text-sm flex gap-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"â¢"}),e.jsx("span",{children:a})]},a))})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Managing the module"}),e.jsx("div",{className:"space-y-3",children:z.map(a=>e.jsxs("div",{className:"border rounded-lg p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:a.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:a.body})]},a.title))})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Status legend"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(o,{variant:"outline",children:"scheduled â waiting for its send date"}),e.jsx(o,{variant:"outline",children:"retrying â a send failed and will be attempted again"}),e.jsx(o,{variant:"destructive",children:"failed â needs Retry or Resolve"}),e.jsx(o,{variant:"outline",children:"paused â the client replied; Resume to continue"}),e.jsx(o,{variant:"outline",children:"stopped â by staff or a bounced email; Restart to continue"}),e.jsx(o,{variant:"secondary",children:"resolved â the task reached its stage, was closed or marked done, or every email was sent; Restart where it makes sense"})]})]})]})]})]})}function X(t,s=new Date){const a=new Set;let i=0;for(const n of t){a.add(n.company_id);const r=n.next_send_at?Date.parse(n.next_send_at):NaN;if(Number.isNaN(r))continue;const d=Math.floor((s.getTime()-r)/864e5);d>i&&(i=d)}return{runs:t.length,companies:a.size,oldestDays:i}}function Z({onOpenMonitor:t}){const{data:s}=M({queryKey:["reminder-parked-runs"],staleTime:3e5,queryFn:async()=>{const{data:r,error:d}=await R.from("workflow_runs").select("id, company_id, next_send_at, companies!inner(status, archived_at, auto_reminders_off)").eq("mode","manual").in("status",["scheduled","retrying"]).lte("next_send_at",new Date().toISOString()).eq("companies.status","active").is("companies.archived_at",null).eq("companies.auto_reminders_off",!1).limit(500);if(d)throw d;return r??[]}});if(!(s!=null&&s.length))return null;const{runs:a,companies:i,oldestDays:n}=X(s);return e.jsxs("div",{className:"rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-900 flex items-start gap-3",children:[e.jsx(D,{className:"h-4 w-4 mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"font-medium",children:[a," reminder ",a===1?"sequence is":"sequences are"," waiting for someone",i>1?`, across ${i} companies`:""]}),e.jsxs("p",{className:"text-[12px] leading-snug opacity-90",children:["They start in manual mode because their first letter was already more than 30 days late, so a person decides where the conversation begins. Nothing is sent until then â the oldest has been waiting"," ",e.jsxs("span",{className:"font-medium",children:[n," days"]}),"."]})]}),e.jsx(y,{size:"sm",variant:"outline",className:"shrink-0 border-amber-400 bg-white/60 hover:bg-white",onClick:t,children:"Review them"})]})}const ee=p(()=>u(()=>import("./EmailTemplateSetup-DmJMojUQ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(t=>({default:t.EmailTemplateSetup}))),ae=p(()=>u(()=>import("./WorkflowMonitor-B7h634An.js"),__vite__mapDeps([20,1,2,3,4,5,6,7,11,8,21,22,13,23,24,18,25,26,27,28,29,30,31,32,10,33,34,35,36,37,38,39,40,41,42,43,44,45,12,17,46,47,48,49,50,51,52,53,54,55,56,57,58,14,59,60,61,62,63,64,65,66])).then(t=>({default:t.WorkflowMonitor}))),te=p(()=>u(()=>import("./ReminderScheduleView-D-2xJg3m.js"),__vite__mapDeps([67,1,2,3,4,5,6,7,11,16,17,8,12,18,25,29,30,31,32,46,68,58,50,34,62,13,63,64,65,43,48,66])).then(t=>({default:t.ReminderScheduleView}))),se=p(()=>u(()=>import("./TestingPanel-C-zmDlF3.js"),__vite__mapDeps([69,1,2,3,4,5,6,7,8,21,22,24,18,25,70,71,34,72,73,74,75,76,77,78,79,80,81,27,12,11,15,43,82,47,37,36,83,61,58,84])).then(t=>({default:t.TestingPanel}))),ne=p(()=>u(()=>import("./ReminderGeneralSettings-JxH3L6I5.js"),__vite__mapDeps([85,1,2,3,4,5,6,7,8,10,13,86,87,88,89,21,22,11,14,47,90,16,17,91,60,92,93,94,95,68,44,45,12,32,46,48,49,42,30,18,50,51,37,34,54,55,56,96,52,53,9,97,98,59,99,100,101,62,63,64,65,43,58,66,31])).then(t=>({default:t.ReminderGeneralSettings}))),h=()=>e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{className:"h-10 w-full"}),e.jsx(x,{className:"h-32 w-full"}),e.jsx(x,{className:"h-32 w-full"})]}),ie=()=>{const{isPlatformAdmin:t,role:s,hasPermission:a}=C(),i=t||s==="super_admin",[n,r]=F("templates","/reminders");return a("reminders.view")?e.jsxs("div",{className:"section-gap animate-fade-in",children:[e.jsx(f,{title:"Reminders",subtitle:"View reminder logs and manage email templates",actions:e.jsx($,{})}),e.jsx(Z,{onOpenMonitor:()=>r("monitor")}),e.jsxs(O,{value:n,onValueChange:r,className:"space-y-6",children:[e.jsxs(G,{className:"bg-muted/50 p-1 rounded-full h-auto",children:[e.jsxs(c,{value:"templates",className:"gap-2 rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm px-4 py-2 text-xs",children:[e.jsx(_,{className:"w-3.5 h-3.5"}),"Email Templates"]}),e.jsxs(c,{value:"monitor",className:"gap-2 rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm px-4 py-2 text-xs",children:[e.jsx(B,{className:"w-3.5 h-3.5"}),"Monitor"]}),e.jsxs(c,{value:"schedule",className:"gap-2 rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm px-4 py-2 text-xs",children:[e.jsx(W,{className:"w-3.5 h-3.5"}),"Schedule"]}),e.jsxs(c,{value:"settings",className:"gap-2 rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm px-4 py-2 text-xs",children:[e.jsx(L,{className:"w-3.5 h-3.5"}),"General Settings"]}),t&&e.jsxs(c,{value:"testing",className:"gap-2 rounded-full data-[state=active]:bg-background data-[state=active]:shadow-sm px-4 py-2 text-xs",children:[e.jsx(P,{className:"w-3.5 h-3.5"}),"Testing"]})]}),e.jsx(m,{value:"templates",className:"space-y-4",children:n==="templates"&&e.jsx(l.Suspense,{fallback:e.jsx(h,{}),children:e.jsx(ee,{})})}),e.jsx(m,{value:"monitor",className:"space-y-4",children:n==="monitor"&&e.jsx(l.Suspense,{fallback:e.jsx(h,{}),children:e.jsx(ae,{})})}),e.jsx(m,{value:"schedule",className:"space-y-4",children:n==="schedule"&&e.jsx(l.Suspense,{fallback:e.jsx(h,{}),children:e.jsx(te,{})})}),e.jsx(m,{value:"settings",className:"space-y-4",children:n==="settings"&&e.jsx(l.Suspense,{fallback:e.jsx(h,{}),children:e.jsx(ne,{canEdit:i})})}),t&&e.jsx(m,{value:"testing",className:"space-y-4",children:n==="testing"&&e.jsx(l.Suspense,{fallback:e.jsx(h,{}),children:e.jsx(se,{})})})]})]}):e.jsxs("div",{className:"section-gap animate-fade-in",children:[e.jsx(f,{title:"Reminders",subtitle:"View reminder logs and manage email templates"}),e.jsx(I,{message:"You need the Reminders permission to open this page. Ask a Super Admin to grant it in Roles & Permissions."})]})},ve=Object.freeze(Object.defineProperty({__proto__:null,default:ie},Symbol.toStringTag,{value:"Module"}));
92export{b as A,W as C,K as R,we as T,be as W,ve as a,je as m,Y as t};
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.