PageSourceSearch

https://waiste.ai/_next/static/chunks/8423-1cbde0f904b2dc84.js

js waiste.ai collected 2026-10-05 14:37:46 UTC 26,156 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8423],{14002:(e,n,t)=>{t.d(n,{RunBillingButton:()=>c});var s=t(95155),a=t(57549),o=t(93950),l=t(30926);let r=(0,l.createServerReference)("003896a60c6caffe1e9f736927edbbaae0a3602c0d",l.callServer,void 0,l.findSourceMapURL,"runBillingAction");function c(e){let{dueCount:n,onClose:t}=e;return(0,s.jsx)("span",{className:"flex items-center gap-2",children:(0,s.jsx)(o.S,{label:t?void 0:"Run billing",initialOpen:!!t,onClose:t,sends:"none",fallback:"Billing run failed; nothing was created.",action:async()=>{let e=await r();return e.refused?{ok:!1,error:e.refused}:{ok:!0,created:e.created}},said:e=>e.ok?0===e.created?"Nothing was due; no invoices created.":"".concat(e.created," draft ").concat((0,a.X)(e.created,"invoice")," created; review and send below."):null,title:"Run billing now?",body:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:"This creates draft invoices for every regular service that is due; you review before anything is sent."}),(0,s.jsx)("p",{className:"mt-2",children:0===n?"No regular services are due right now, so this will most likely create nothing.":"".concat(n," regular ").concat((0,a.X)(n,"service is","services are")," due, so up to ").concat((0,a.r)(n,"draft")," will be created.")})]}),confirmLabel:"Create draft invoices"})})}},35982:(e,n,t)=>{t.d(n,{A:()=>a});var s=t(30926);let a=(0,s.createServerReference)("7836b1827ddb9067446f2c4507fba5da19d295e2e7",s.callServer,void 0,s.findSourceMapURL,"sendInvoiceAction")},37934:(e,n,t)=>{t.d(n,{FQ:()=>j,IT:()=>m,Op:()=>k,Px:()=>M,T9:()=>f,V2:()=>_,bE:()=>L,by:()=>h,eN:()=>b,fn:()=>N,iQ:()=>C,pL:()=>d,q9:()=>v,qx:()=>A,rw:()=>S,sJ:()=>g,ui:()=>x,vx:()=>w,w0:()=>p,w8:()=>u,y4:()=>I});var s=t(37551),a=t(57549),o=t(84208),l=t(42738),r=t(30761),c=t(50431);let i="no SMS number or email";function d(e,n){let t=new Map,s={},a=0,o=null;for(let r of e){var l,c,d,u,h,m,f;if(!r.runId||!n.includes(r.runId)||"scheduled"!==r.status||"collection"!==r.type||!r.customerId){a++;continue}null===o&&r.date&&(o=r.date);let e=null!=(m=t.get(r.customerId))?m:{customerName:null!=(d=null!=(c=r.customerName)?c:r.label)?d:r.customerId,channels:r.reminderChannels?[...r.reminderChannels]:null,hold:null!=(u=r.reminderHold)?u:null,remindedAt:null!=(h=r.remindedAt)?h:null,sites:new Set};e.sites.add(null!=(f=r.siteId)?f:r.id),t.set(r.customerId,e),null!=s[l=r.customerId]||(s[l]=r.runId)}let g=[...t].map(e=>{let[n,t]=e;return{customerId:n,...t,sites:t.sites.size}}),p=e=>({customerId:e.customerId,customerName:e.customerName,channels:e.channels,sites:e.sites}),b=g.filter(e=>e.remindedAt).map(e=>({...p(e),remindedAt:e.remindedAt})),v=g.filter(e=>!e.remindedAt),y=v.filter(e=>null===e.channels||e.channels.length>0).map(p),w=v.filter(e=>null!==e.channels&&0===e.channels.length).map(e=>{var n;return{...p(e),reason:null!=(n=e.hold)?n:i}}),x=b.reduce((e,n)=>!e||n.remindedAt.at>e.at?n.remindedAt:e,null);return{customers:y,unreachable:w,alreadyReminded:b,lastPass:x,dateWords:o?(0,r.OS)(o):null,excluded:a,smsCount:y.filter(e=>{var n;return null==(n=e.channels)?void 0:n.includes("sms")}).length,emailCount:y.filter(e=>{var n;return null==(n=e.channels)?void 0:n.includes("email")}).length,runByCustomer:s}}function u(e,n){let t=e.filter(e=>"number"==typeof n[e.id]),s=t.reduce((e,t)=>e+n[t.id],0),a=e.length-t.length,o=["".concat(e.length," selected")];return t.length>0&&o.push((0,l.up)(s)),a>0&&o.push("".concat(a," unpriced")),o.join(" \xb7 ")}function h(e){if(null===e)return"channel decided on send";if(0===e.length)return"no SMS number or email";let n=e.includes("sms"),t=e.includes("email");return n&&t?"SMS + email":n?"SMS":"Email"}function m(e){var n;let t=e.customers.length,s=e.alreadyReminded.length,o=null!=(n=e.dateWords)?n:"this collection day",l=e.lastPass?"last pass ".concat(e.lastPass.label):"earlier",r=null;return s>0&&0===t&&0===e.unreachable.length?r="Everyone on this run was already reminded for ".concat(o,": ").concat((0,a.r)(s,"customer"),", ").concat(l,"."):s>0&&(r="".concat((0,a.r)(s,"customer")," ").concat((0,a.X)(s,"was","were")," already reminded for ").concat(o," (").concat(l,") and ").concat((0,a.X)(s,"is","are")," not in this send.")),{footer:"".concat((0,a.r)(t,"customer")," \xb7 ").concat(e.smsCount," SMS \xb7 ").concat((0,a.r)(e.emailCount,"email")),sendLabel:"Send ".concat((0,a.r)(t,"reminder")),alreadyRemindedLine
1:r}}function f(e){return e.map(e=>({...e,state:"pending",reason:null}))}async function g(e,n,t){let a=f(e),o=0,l=0,r=0,c=0;for(let i of e){let e;try{e=(await n(i.customerId)).notices>0?{...a[c],state:"sent",reason:null}:{...a[c],state:"no notice",reason:"No notice was staged: already reminded for this day, reminders switched off, or nobody on file."}}catch(n){e={...a[c],state:"failed",reason:(0,s.g)(n)}}a[c]=e,"sent"===e.state?o++:"no notice"===e.state?l++:r++,t([...a]),c++}return{rows:a,sent:o,held:l,failed:r}}function p(e){let n=["Sent ".concat(e.sent," of ").concat(e.rows.length)];return e.held&&n.push("".concat(e.held," no notice")),e.failed&&n.push("".concat(e.failed," failed")),n.join(" \xb7 ")}function b(e,n){let t=e.filter(e=>e.invoiceId&&null!=e.daysPastDue&&e.daysPastDue>=n);return{rows:t,excluded:e.length-t.length,sentence:"Chase ".concat((0,a.r)(t.length,"customer")," whose oldest invoice is at least ").concat(n," days overdue.")}}function v(e,n,t,s){return 0===s?"".concat(e," ").concat(t," of ").concat(n,"."):0===t?"".concat(e," 0 of ").concat(n,". ").concat(s," failed or were held; nothing else changed."):"".concat(e," ").concat(t," of ").concat(n,". ").concat(s," failed and ").concat((0,a.X)(s,"is","are")," unchanged.")}let y={recipients:500,subject:120,body:1200,reason:120};function w(e){let n=new Map,t=[],s=0;e.forEach((e,a)=>{var o,l,r;let c=(null==(o=e.customerName)?void 0:o.trim())||e.customerId||"A pin with no customer";if(!e.customerId)return void t.push({key:"pin_".concat(a),customerId:null,customerName:c,reason:"no customer record behind this pin"});if(n.has(e.customerId)){s+=1;return}n.set(e.customerId,{customerName:c,channels:null!=(l=e.channels)?l:null,hold:null!=(r=e.hold)?r:null})});let a=[];for(let[e,s]of n){if(null!==s.channels&&0===s.channels.length){var o;t.push({key:e,customerId:e,customerName:s.customerName,reason:null!=(o=s.hold)?o:i});continue}let n=null===s.channels?null:s.channels.includes("email")?["email"]:["sms"];a.push({customerId:e,customerName:s.customerName,channels:n})}return{recipients:a,unreachable:t,folded:s,smsCount:a.filter(e=>{var n;return null==(n=e.channels)?void 0:n.includes("sms")}).length,emailCount:a.filter(e=>{var n;return null==(n=e.channels)?void 0:n.includes("email")}).length,ungradedCount:a.filter(e=>null===e.channels).length}}function x(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=e.recipients.length+e.unreachable.length,s=e.recipients.length,o=[];e.smsCount>0&&o.push("".concat(e.smsCount," by SMS")),e.emailCount>0&&o.push("".concat(e.emailCount," by email")),e.ungradedCount>0&&o.push("".concat(e.ungradedCount," channel not checked"));let l=n>0?["".concat(n," will send"),...s>n?["".concat(s-n," will stage")]:[]]:["".concat(s," will stage")];return{title:"Message ".concat((0,a.r)(t,"customer")),subtitle:"Email where there is one \xb7 SMS otherwise",stageLine:[...l,"".concat(e.unreachable.length," unreachable"),...o.length?[o.join(", ")]:[]].join(" \xb7 "),stageLabel:n>0?"Send ".concat((0,a.r)(n,"message")):"Stage messages",foldedLine:e.folded>0?"".concat(e.folded," repeated ").concat((0,a.X)(e.folded,"selection")," folded: one customer gets one message however many of their stops you picked."):null}}function j(e,n){if(e.recipients.some(e=>null==e.channels))return[];let t="your message",s=[],o=e=>"".concat((0,a.r)(e,"customer")),l=e.recipients.filter(e=>{var n;return null==(n=e.channels)?void 0:n.includes("email")}).length,r=e.recipients.filter(e=>null!==e.channels&&!e.channels.includes("email")&&e.channels.includes("sms")).length;return n.sms&&r>0&&s.push({channel:"sms",toLabel:"".concat(o(r)," by SMS"),body:null,what:t,count:r}),n.email&&l>0&&s.push({channel:"email",toLabel:"".concat(o(l)," by email"),body:null,what:t,count:l}),s}function S(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n?"Demo: nothing sends. Each message is recorded under Messages as what it would have said.":e.sms||e.email?"Comms are live for this operator: a message you send leaves inside the send window.":"Nothing sends until the owner flips comms."}function N(e,n){if(n<=0)return null;let t=(0,c.KX)(e);if(0===t.segments)return null;let s="".concat(t.segments," SMS ").concat((0,a.X)(t.segments,"segment")," each"),o="".concat(t.segments*n," in total for ").concat((0,a.r)(n,"recipient"));return t.forcedBy.length>0?"".concat(s,", ").concat(o,". ").concat(t.forcedBy.slice(0,4).join(" ")," ").concat(1===t.forcedBy.length?"forces":"force"," the longer encoding, which more than halves what fits in a segment."):"".concat(s,", ").concat(o,". ").concat((0,a.r)(t.remaining,"character")," left before it needs another.")}function k(e){return e.replace(/\s+/g," ").trim()}function C(e){let n=(e,n,t)=>{let s=k(e).length;return 0===s?"".concat(n," is required."):s>t?"".concat(n," is ").concat(s," characters; the door takes ").concat(t,"."):null};
1return{subject:n(e.subject,"A subject",y.subject),body:n(e.body,"A message",y.body)}}function I(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=[];0===e.recipients.length?s.push(0===e.unreachable.length?"Choose who this goes to.":"Nobody in this selection can be messaged, so there is nothing to stage."):e.recipients.length>y.recipients&&s.push("The message door takes ".concat(y.recipients," customers at once and this selection has ").concat(e.recipients.length,". Select fewer."));let a=C(n);for(let e of[a.subject,a.body])e&&s.push(e);let o=(0,c.MC)(n.subject,n.body);o.length>0&&s.push("".concat(o.join(", ")," ").concat(1===o.length?"is not a field":"are not fields"," we can fill in, so ").concat(1===o.length?"it would reach":"they would reach"," your customer unfilled. Use ").concat(c.Kh.join(", "),", or take ").concat(1===o.length?"it":"them"," out."));let l=e.recipients.map(e=>{var s;return{name:e.customerName,missing:(0,c.Xt)(null!=(s=t[e.customerId])?s:{},n.subject,n.body)}}).filter(e=>e.missing.length>0);if(l.length>0){let e=[...new Set(l.flatMap(e=>e.missing))].join(", "),n=l.slice(0,3).map(e=>e.name).join(", "),t=l.length>3?" and ".concat(l.length-3," more"):"";s.push("".concat(l.length," of these customers have nothing to put in ").concat(e,": ").concat(n).concat(t,". ")+"Nobody is sent to until you untick them or take the field out.")}return s}function M(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3;return e.recipients.slice(0,s).map(e=>{var s;let a=null!=(s=t[e.customerId])?s:{};return{customerId:e.customerId,customerName:e.customerName,subject:(0,c.Hv)(n.subject,a),body:k((0,c.Hv)(n.body,a))}})}function A(e,n){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{plansShown:!1,ticked:!1},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=e.recipients.every(e=>null!=e.channels),l=(0,o.be)(a&&t.plansShown,t.ticked),r={},c={};for(let n of e.recipients){var i;(null==(i=n.channels)?void 0:i.length)===1&&(r[n.customerId]=n.channels[0]);let e=s[n.customerId];e&&(c[n.customerId]={...e})}return{customerIds:e.recipients.map(e=>e.customerId),subject:n.subject,body:n.body,reason:(k(n.reason)||k(n.subject)).slice(0,y.reason),...l?{comms:l}:{},...Object.keys(r).length>0?{routes:r}:{},...Object.keys(c).length>0?{merge:c}:{}}}function L(e,n){let t=new Map(e.recipients.map(e=>[e.customerId,e.customerName]));return n.skipped.map(e=>{var n;return{customerId:e.customerId,customerName:null!=(n=t.get(e.customerId))?n:e.customerId,reason:e.reason}})}function _(e){var n;let t=null!=(n=e.sent)?n:0,s=e.staged-t,o=e=>"".concat((0,a.r)(e,"message")),l=t>0?"".concat(o(t)," sent or queued for the send window").concat(s>0?", ".concat(o(s)," staged under Messages"):""):"".concat(o(e.staged)," staged under Messages, nothing sent");return 0===e.skipped.length?"".concat(l,"."):"".concat(l," \xb7 ").concat(e.skipped.length," could not be staged, listed below.")}},50431:(e,n,t)=>{t.d(n,{EJ:()=>s,FE:()=>m,Hv:()=>h,KX:()=>d,Kh:()=>a,MC:()=>r,Vy:()=>p,XI:()=>g,Xt:()=>c,dv:()=>i,ur:()=>f,xW:()=>u});let s=[{slot:"{CUSTOMER_NAME}",label:"Customer name",means:"The name on the customer record this message is being sent to.",example:"Fern Lawson"},{slot:"{BUSINESS_NAME}",label:"Your business name",means:"Your business name, from Settings.",example:"Your business"},{slot:"{BUSINESS_PHONE}",label:"Your phone number",means:"The public phone number customers reach you on, from Settings.",example:"0400 000 000"},{slot:"{COLLECTION_DAY}",label:"Their usual collection day",means:"The weekday this customer is normally collected on. Customers with no ongoing service have none, and the send is refused rather than sent with a blank.",example:"Thursday"}],a=s.map(e=>e.slot),o=/\{[A-Z][A-Z0-9_]*\}/g;function l(){for(var e,n=arguments.length,t=Array(n),s=0;s<n;s++)t[s]=arguments[s];let a=new Set;for(let n of t)for(let t of null!=(e=(null!=n?n:"").match(o))?e:[])a.add(t);return[...a]}function r(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];return l(...n).filter(e=>!a.includes(e))}function c(e){for(var n=arguments.length,t=Array(n>1?n-1:0),s=1;s<n;s++)t[s-1]=arguments[s];return l(...t).filter(e=>a.includes(e)).filter(n=>{var t;return 0===(null!=(t=e[n])?t:"").trim().length})}function i(e){let n=null!=e?e:"",t=new Set,s=0;for(let e of[...n])"@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\n\xd8\xf8\r\xc5\xe5Δ_ΦΓΛΩΠΨΣΘΞ\xc6\xe6\xdf\xc9 !\"#\xa4%&'()*+,-./0123456789:;<=>?\xa1ABCDEFGHIJKLMNOPQRSTUVWXYZ\xc4\xd6\xd1\xdc\xa7\xbfabcdefghijklmnopqrstuvwxyz\xe4\xf6\xf1\xfc\xe0".includes(e)?s+=1:"^{}[]~|\\€".includes(e)?s+=2:t.add(e);if(t.size>0){let e=n.length,s=0===e?0:e<=70?1:Math.ceil(e/67);return{encoding:"UCS-2",units:e,segments:s,remaining:(s<=1?70:67*s)-e,forcedBy:[...t]}}let a=0===s?0:s<=160?1:Math.ceil(s/153);return{encoding:"GSM-7",units:s,segments:a,remaining:(a<=1?160:153*a)-s,forcedBy:[]}}
1function d(e,n){return i(h(e,null!=n?n:u()))}function u(e){return Object.fromEntries(s.map(n=>{var t;return[n.slot,(null!=(t=null==e?void 0:e[n.slot])?t:"").trim()||n.example]}))}function h(e,n){let t=null!=e?e:"";for(let[e,s]of Object.entries(n))t=t.split(e).join(s);return t}let m={entries:60,name:60,subject:120,body:1200,reason:120},f="A saved wording is text and a name. It is never switched on, never scheduled, and never sends by itself.";function g(e){var n,t,s,o;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],c=arguments.length>2?arguments[2]:void 0,i=[],d=(null!=(n=e.name)?n:"").trim(),u=(null!=(t=e.subject)?t:"").trim(),h=(null!=(s=e.body)?s:"").trim(),f=(null!=(o=e.reason)?o:"").trim();for(let e of(d?d.length>m.name?i.push("The name is ".concat(d.length," characters; the limit is ").concat(m.name,".")):l.some(e=>e.id!==c&&e.name.trim().toLowerCase()===d.toLowerCase())&&i.push('You already have a wording called "'.concat(d,'". Give this one a different name.')):i.push("Give this wording a name so you can find it later."),[{value:u,what:"A subject",max:m.subject},{value:h,what:"A message",max:m.body},{value:f,what:"A reason",max:m.reason}]))e.value?e.value.length>e.max&&i.push("".concat(e.what," is ").concat(e.value.length," characters; the door takes ").concat(e.max,".")):i.push("".concat(e.what," is required."));let g=r(u,h);return g.length>0&&i.push("".concat(g.join(", ")," ").concat(1===g.length?"is not a field":"are not fields"," we can fill in, so ").concat(1===g.length?"it would reach":"they would reach"," your customer unfilled. Use ").concat(a.join(", "),", or take ").concat(1===g.length?"it":"them"," out.")),l.length>=m.entries&&!l.some(e=>e.id===c)&&i.push("You have ".concat(m.entries," saved wordings, which is the limit. Delete one first.")),i}function p(e,n){let t="Copy of ".concat(e).slice(0,m.name),s=new Set(n.map(e=>e.name.trim().toLowerCase()));if(!s.has(t.trim().toLowerCase()))return t;for(let e=2;e<100;e+=1){let n="".concat(t," ").concat(e).slice(0,m.name);if(!s.has(n.trim().toLowerCase()))return n}return t}},63640:(e,n,t)=>{t.d(n,{n:()=>a});let s={agreement_cancel:{word:"CANCEL",basis:"many_jobs"},hire_cancel:{word:"CANCEL",basis:"ledger"},invoice_void:{word:"VOID",basis:"ledger"},run_postpone:{word:"POSTPONE",basis:"many_jobs"},schedule_all_future:{word:"APPLY",basis:"many_jobs"},send_all_drafts:{word:"SEND",basis:"ledger"},send_scheduled:{word:"SEND",basis:"ledger"}};function a(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=s[e],a=n.items;if((void 0===a||!(a<=0))&&("many_jobs"!==t.basis||void 0===a||!(a<=1)))return t.word}},65443:(e,n,t)=>{t.d(n,{B:()=>a});var s=t(30926);let a=(0,s.createServerReference)("404869d8160b216b6dc94953fb44eb53c12eb6a345",s.callServer,void 0,s.findSourceMapURL,"remindInvoiceNowAction")},88423:(e,n,t)=>{t.d(n,{S3:()=>I,j3:()=>C,Nt:()=>M,TX:()=>S,RR:()=>N,PC:()=>k});var s=t(95155),a=t(12115),o=t(93950),l=t(57549),r=t(35982),c=t(63640),i=t(84208);let d={email:"email",sms:"SMS"},u=["email","sms"];function h(e){let n=[];for(let t of u){let s=e.filter(e=>e.via===t).length;0!==s&&n.push({channel:t,toLabel:"".concat((0,l.r)(s,"customer")," by ").concat(d[t]),count:s,body:null,what:"the invoice"})}return n}function m(e){let{drafts:n,outlook:t,onClose:a}=e;if(0===n.length)return null;let d=n.filter(e=>null!==e.via),u=function(e,n){let t=h(e),s=t.map(e=>{var t;let s=e.channel,a=n[s];return{channel:s,count:null!=(t=e.count)?t:1,leaves:a.enabled,heldReason:a.enabled?null:a.reason,text:"".concat(e.what," to ").concat(e.toLabel)}}),a=s.reduce((e,n)=>e+n.count,0),o=e.length-a,l=s.filter(e=>e.leaves).reduce((e,n)=>e+n.count,0),r=a>0?(0,i.EC)(t):null,c=0===a?"Nothing can be sent: no draft has an email or phone on file.":l===a?"Every one of them leaves for the customer the moment you confirm.":0===l?"None of them leaves: each is previewed under Messages for the office, and every invoice is still issued to the ledger.":"".concat(l," of ").concat(a," leave for the customer; the rest are previewed under Messages, and every invoice is still issued to the ledger.");return{sendable:a,skipped:o,heading:r,channels:s,leaving:l,verdict:c}}(n,t);async function m(){let e=0,n=0;for(let t of d)try{await (0,r.A)(t.id,t.via),e++}catch(e){n++}return{sent:e,failed:n}}return(0,s.jsx)("span",{className:"flex items-center gap-2",children:(0,s.jsx)(o.S,{label:a?void 0:"Send all drafts (".concat(n.length,")"),initialOpen:!!a,onClose:a,sends:"invoice.send",plans:h(n),sendsDeclareOnly:!0,action:m,said:e=>{let{sent:n,failed:t}=e;return"".concat(n," issued").concat(t>0?", ".concat(t," failed"):"").concat(u.skipped>0?", ".concat(u.skipped," skipped (no contact)"):"",".")},title:"Send ".concat(u.sendable," draft ").concat((0,l.X)(u.sendable,"invoice"),"?"),body:(0,s.jsxs)("div",{"data-slot":"sendDrafts.summary",children:[u.heading?(0,s.jsx)("p",{className:"font-medium text-ink",children:u.heading}):null,(0,s.jsx)("ul",{className:"mt-1.5 space-y-1 text-note text-ink-soft",children:u.channels.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsx)("span",{className:"font-medium text-ink",children:e.text}),e.leaves?" \xb7 leaves now":" \xb7 previewed under Messages, nothing leaves: ".concat(e.heldReason)]},e.channel))}),(0,s.jsx)("p",{className:"mt-2",children:u.verdict}),u.skipped>0?(0,s.jsxs)("p",{className:"mt-2 text-[var(--st-warn-ink)]",children:[u.skipped," ",(0,l.X)(u.ski
1pped,"draft has","drafts have")," no email or phone on file and will be skipped."]}):null,(0,s.jsx)("p",{className:"mt-2 text-ink",children:"Each draft goes by the contact its customer has on file (email where they have one, otherwise SMS), and every send is logged under Messages. There is no un-send: a mistake has to be voided invoice by invoice."})]}),confirmLabel:u.sendable>0?"Send ".concat((0,l.r)(u.sendable,"invoice")):"Nothing sendable",ready:u.sendable>0,typedWord:(0,c.n)("send_all_drafts",{items:u.sendable})})})}var f=t(14002),g=t(20063),p=t(65443),b=t(37934),v=t(63578);function y(e){let{candidates:n,autoSendComms:t}=e,o=(0,g.useRouter)(),[l,r]=(0,a.useState)(30),[c,i]=(0,a.useState)(!1),[d,u]=(0,a.useState)(null),[h,m]=(0,a.useTransition)(),f=(0,b.eN)(n,l),y={suppressed:"held by a suppression",not_due:"not due yet",settled:"already settled",refunding:"being refunded",imported_history:"imported history, never chased",do_not_chase:"set to never be chased"};return(0,s.jsxs)(v.WCard,{as:"section",padded:!1,className:"p-3",slot:"arrears.bulk",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("label",{className:"text-meta font-medium",htmlFor:"arrears-days",children:"Chase everyone at least"}),(0,s.jsx)(v.WSelect,{layout:"bare",id:"arrears-days",value:String(l),onChange:e=>{r(Number(e)),i(!1)},options:[7,14,30,60].map(e=>({value:String(e),label:"".concat(e," days overdue")}))}),(0,s.jsxs)(v.WButton,{size:"sm",disabled:h||!f.rows.length,onClick:()=>i(!0),children:["Preview ",f.rows.length]})]}),c?(0,s.jsxs)("div",{className:"mt-2 rounded-lg bg-haze p-2 text-meta",children:[(0,s.jsxs)("p",{children:[f.sentence," Each invoice uses the existing reminder door and remains subject to holds and send windows."]}),(0,s.jsx)(v.WButton,{size:"sm",className:"mt-2",disabled:h,onClick:()=>m(async()=>{var e,n;let s=0,a=0,l=new Map;for(let n of f.rows)try{let t=await (0,p.B)(n.invoiceId);"staged"===t.result?s+=1:l.set(t.result,(null!=(e=l.get(t.result))?e:0)+1)}catch(e){a+=1}let r=[(0,b.q9)(t?"Sent reminders for":"Held reminders for",f.rows.length,s,a)];for(let[e,t]of l)r.push("".concat(t," ").concat(null!=(n=y[e])?n:e,"."));u(r.join(" ")),i(!1),o.refresh()}),children:h?t?"Chasing…":"Holding…":"".concat(t?"Send":"Hold"," ").concat(f.rows.length)})]}):null,d?(0,s.jsx)("p",{className:"mt-2 text-meta","data-slot":"arrears.bulk.receipt",children:d}):null]})}var w=t(30926);let x=(0,w.createServerReference)("4090d9edf29986ee7d78596818b4be1a8560086ead",w.callServer,void 0,w.findSourceMapURL,"releaseHeldStopAction");var j=t(30761);function S(e){let{invoice:n,autoSendComms:t}=e,[o,l]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(v.WButton,{type:"button",onClick:()=>l(!0),"data-slot":"money.reminder",children:[t?"Send":"Hold"," reminder"]}),(0,s.jsx)(N,{invoice:n,autoSendComms:t,open:o,onClose:()=>l(!1)})]})}function N(e){let{invoice:n,autoSendComms:t,open:l,onClose:r}=e,[c,i]=(0,a.useState)(null),d=t?"Send":"Hold";return(0,s.jsxs)(s.Fragment,{children:[c?(0,s.jsx)("p",{className:"text-meta text-ink-soft","data-slot":"money.reminder-outcome",children:c.detail}):null,l?(0,s.jsx)(o.S,{initialOpen:!0,sends:"none",fallback:"Nothing was staged and nothing was sent.",title:"".concat(d," a reminder for ").concat(n.number,"?"),body:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"The existing invoice reminder policy chooses the due stage, residual amount and customer channel. It still honours suppression, deduplication and the delivery window."}),t?null:(0,s.jsx)("p",{className:"mt-2 text-[var(--st-warn-ink)]",children:"Automatic sending is off. This records a held preview in Messages; it does not contact the customer."})]}),confirmLabel:"".concat(d," reminder"),onClose:r,action:()=>(0,p.B)(n.id),onDone:i}):null]})}function k(e,n){return[...e.drafts.length>0?[{key:"send-drafts",label:"Send all drafts (".concat(e.drafts.length,")"),hint:"Asks before anything is sent",onSelect:()=>n("drafts")}]:[],...e.dueCount>0?[{key:"run-billing",label:"Run billing",hint:"Creates drafts for services that are due",onSelect:()=>n("billing")}]:[]]}function C(e){let{money:n,which:t,onClose:a}=e;return"drafts"===t?(0,s.jsx)(m,{drafts:n.drafts,outlook:n.draftSendOutlook,onClose:a}):"billing"===t?(0,s.jsx)(f.RunBillingButton,{dueCount:n.dueCount,onClose:a}):null}function I(e){let{money:n,rows:t}=e;return(0,s.jsx)(y,{autoSendComms:n.autoSendComms,candidates:t.map(e=>({customerId:e.customerId,customerName:e.name,invoiceId:e.oldestInvoiceId,invoiceNumber:e.olde
1stInvoiceNumber,daysPastDue:e.daysPastDue}))})}function M(e){let{stops:n}=e,[t,l]=(0,a.useState)(""),[r,c]=(0,a.useState)(null);return 0===n.length?(0,s.jsx)("p",{className:"text-meta text-ink-soft","data-slot":"money.held-stops-none",children:"No stops are being held off a run for this customer."}):(0,s.jsxs)("div",{"data-slot":"money.held-stops",children:[(0,s.jsxs)("p",{className:"text-meta text-[var(--st-warn-ink)]",children:[1===n.length?"1 stop is held":"".concat(n.length," stops are held")," off a run until this is paid."]}),(0,s.jsx)("ul",{className:"mt-2 space-y-1.5",children:n.map(e=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 text-meta",children:[(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"font-semibold",children:(0,j.es)(e.date)}),(0,s.jsxs)("span",{className:"block text-ink-soft",children:[e.address,e.runId?"":" \xb7 never placed on a run"]})]}),(0,s.jsx)(o.S,{label:"Send anyway",size:"sm",className:"shrink-0",slot:"money.held-stop-release",sends:"none",fallback:"The stop was not released and nothing else changed.",onOpen:()=>{c(null),l("")},title:"Send the truck to the stop on ".concat((0,j.es)(e.date),"?"),body:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{children:"The invoice stays owing and this customer is not messaged. The stop goes back on its run and the reason you type is the only record of why a truck was sent to an unpaid stop."}),(0,s.jsx)("div",{className:"mt-2",children:(0,s.jsx)(v.WTextField,{label:"Why are you sending it anyway?",value:t,onChange:l,maxLength:200,placeholder:"Agreed with the customer on the phone"})})]}),confirmLabel:"Put the stop back",ready:t.trim().length>=3,action:()=>x({jobId:e.jobId,reason:t.trim()}),onDone:e=>c(e.note)})]},e.jobId))}),r?(0,s.jsx)("p",{className:"mt-2 text-meta text-ink-soft","data-slot":"money.held-stop-outcome",children:r}):null]})}}}]);

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.