@remit/web-client-dist 0.0.340 → 0.0.342
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{BriefPane-W5Q0492F.js → BriefPane-KYNl4mL6.js} +1 -1
- package/assets/{ErrorState-CuqqswXJ.js → ErrorState-WApPEaDG.js} +1 -1
- package/assets/{FlaggedPane-DkSVqAGg.js → FlaggedPane-B309puX5.js} +1 -1
- package/assets/{MailListHeader-DXn6Xbo6.js → MailListHeader-XYk1qiUs.js} +3 -3
- package/assets/{MailViewChrome-CLDvCrh0.js → MailViewChrome-eJ4mjZK8.js} +1 -1
- package/assets/{MailboxPane-DPfwXNE8.js → MailboxPane-Cptv9NrX.js} +1 -1
- package/assets/{NavMenuButton-Ck9C5gc9.js → NavMenuButton-DqHqOJc-.js} +1 -1
- package/assets/{OnboardingWizard-CyvjlhZk.js → OnboardingWizard-BpH3hNAY.js} +1 -1
- package/assets/{OutboxPane-DLn3bUcx.js → OutboxPane-EiBKX20W.js} +1 -1
- package/assets/_mailboxId-8brPz8c7.js +1 -0
- package/assets/_messageId-KSdjNu-G.js +1 -0
- package/assets/_messageId-OpJluv7Y.js +1 -0
- package/assets/_messageId-TU7gCiOt.js +1 -0
- package/assets/_outboxMessageId-CG8Lgfwr.js +1 -0
- package/assets/_threadId-D6tsIzdR.js +1 -0
- package/assets/_threadId-DoSlVsAr.js +1 -0
- package/assets/_threadId-Q-YWsyrF.js +1 -0
- package/assets/{account-form-helpers-Bbf0P_qV.js → account-form-helpers-ivUrHOn-.js} +1 -1
- package/assets/{accounts-Ce-T6JsO.js → accounts-pMIKKJ6I.js} +1 -1
- package/assets/{advanced-eDuNKZfI.js → advanced-CfqiDyCh.js} +1 -1
- package/assets/{appearance-D6THSCaN.js → appearance-CsmEkdKl.js} +1 -1
- package/assets/{avatar-B5Q17PQq.js → avatar-5v8CsQPw.js} +1 -1
- package/assets/{bottom-sheet-B7MyK_a2.js → bottom-sheet-JE9XidJf.js} +1 -1
- package/assets/{brief-B3fKfjAO.js → brief-BiAhq6DB.js} +1 -1
- package/assets/brief-tItgPbz2.js +1 -0
- package/assets/{browser-ponyfill-Y3xZUvaq.js → browser-ponyfill-CMvMBPJM.js} +1 -1
- package/assets/{bug-BsCa7ozj.js → bug-CYrcyzKD.js} +1 -1
- package/assets/{circle-check-DQR6p1_p.js → circle-check-DyvDllK0.js} +1 -1
- package/assets/{circle-check-big-lTs5t5fh.js → circle-check-big-C5D6DMtM.js} +1 -1
- package/assets/{circle-help-B5dLfYZy.js → circle-help-DcLBg9wT.js} +1 -1
- package/assets/{clock-zB5tpIDB.js → clock-qLthdmxi.js} +1 -1
- package/assets/{confirm-dialog-CbO-qi9L.js → confirm-dialog-CKwSJaYW.js} +1 -1
- package/assets/{download-Cav3dE9M.js → download-DWaNCU-a.js} +1 -1
- package/assets/{filters-D6xXsmAV.js → filters-DD2K7HS6.js} +1 -1
- package/assets/{flagged-C_JI3UYQ.js → flagged-BnN4x3aM.js} +1 -1
- package/assets/flagged-tW4QRP_j.js +1 -0
- package/assets/{folders-D50Znb07.js → folders-DFI7cVr5.js} +1 -1
- package/assets/index-34-894MO.js +1 -0
- package/assets/index-B9vHhRFh.js +1 -0
- package/assets/index-Bbb330sb.js +1 -0
- package/assets/{index-WW7Z17dj.js → index-CS4WRs19.js} +4 -4
- package/assets/index-CSu-_HsH.js +1 -0
- package/assets/index-D-AJcvPG.js +1 -0
- package/assets/index-DTcH-CL2.js +1 -0
- package/assets/index-OpJluv7Y.js +1 -0
- package/assets/index-TU7gCiOt.js +1 -0
- package/assets/{kbd-B3K3HpZY.js → kbd-gTxkTuYe.js} +1 -1
- package/assets/{labels-eNB_l_N0.js → labels-DcOJB-nd.js} +1 -1
- package/assets/{mail-BPE5SjbB.js → mail-DTH16qJu.js} +1 -1
- package/assets/{menu-BMHseCqP.js → menu-B0pBSe31.js} +1 -1
- package/assets/{move-options-BpzLkHQ5.js → move-options-Bqiul3uG.js} +1 -1
- package/assets/{nav-link-0hpuk3Sr.js → nav-link-CQ7Z4WT-.js} +1 -1
- package/assets/{onboarding-CP3FPmAc.js → onboarding-jNIjVoYv.js} +1 -1
- package/assets/outbox-73iDPbsJ.js +1 -0
- package/assets/{pencil-DDAAza1K.js → pencil-B2Fl3N7B.js} +1 -1
- package/assets/{rich-text-BvQN_4GT.js → rich-text-D0rQzQiH.js} +1 -1
- package/assets/{rotate-ccw-CZwL8aJ9.js → rotate-ccw-CbxFvIKx.js} +1 -1
- package/assets/{row-actions-DiETrL7-.js → row-actions-CVXXiahD.js} +1 -1
- package/assets/{search-scope-lXobMmHE.js → search-scope-CiJO7L67.js} +1 -1
- package/assets/{search-token-index-DwcocRbP.js → search-token-index-DT41FctS.js} +1 -1
- package/assets/{search-view-CNqklJn4.js → search-view-XSNikzls.js} +1 -1
- package/assets/{senders-HMcF2K-p.js → senders-BTDqW0mb.js} +1 -1
- package/assets/settings-CJOrD7WU.js +1 -0
- package/assets/{settings-screen-BOGydvXt.js → settings-screen-Bt-HQCfV.js} +1 -1
- package/assets/{shield-check-DPc0NfT9.js → shield-check-2JF-XI2A.js} +1 -1
- package/assets/{suggested-vips-BO0yj4iE.js → suggested-vips-B7YMDelO.js} +1 -1
- package/assets/{use-match-media-zgI0-sti.js → use-match-media-cQP6kb5N.js} +1 -1
- package/assets/{useDebouncedValue-DzPE_QOs.js → useDebouncedValue-C0SXwgbW.js} +1 -1
- package/assets/{useFilters-BE-RO_SE.js → useFilters-BKTWdrHN.js} +1 -1
- package/assets/{useLabels-CaMfrXk0.js → useLabels-k8VIZMmD.js} +1 -1
- package/assets/{useRefreshControl-XHvvpGhP.js → useRefreshControl-Dai7_R2P.js} +1 -1
- package/assets/{useSearchMirror-Di_zNuQ8.js → useSearchMirror-Cn7iym8r.js} +1 -1
- package/assets/{useSearchTokenContext-CdJ77DCX.js → useSearchTokenContext-CI55IeG6.js} +1 -1
- package/assets/{useSemanticSearch-lVJDbCE7.js → useSemanticSearch-CTggCJhI.js} +1 -1
- package/assets/{useSignature-Ko6ziiyT.js → useSignature-BkFbqoBh.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_mailboxId-Cce340g_.js +0 -1
- package/assets/_messageId-BLBFe8KF.js +0 -1
- package/assets/_messageId-CR7pJle4.js +0 -1
- package/assets/_messageId-MuxpDTu4.js +0 -1
- package/assets/_outboxMessageId-De_EW-wa.js +0 -1
- package/assets/_threadId-BbU4s0PC.js +0 -1
- package/assets/_threadId-C-6Z6j9o.js +0 -1
- package/assets/_threadId-P8wvBy8H.js +0 -1
- package/assets/brief-9mnRhhk_.js +0 -1
- package/assets/flagged-D6445LrN.js +0 -1
- package/assets/index-BLBFe8KF.js +0 -1
- package/assets/index-BWr2AnWv.js +0 -1
- package/assets/index-BnehNBy4.js +0 -1
- package/assets/index-BsoIG6zg.js +0 -1
- package/assets/index-C6mi-Ur8.js +0 -1
- package/assets/index-CR7pJle4.js +0 -1
- package/assets/index-CZ9m8dd5.js +0 -1
- package/assets/index-Ctyq2UXo.js +0 -1
- package/assets/outbox-MuY38FZl.js +0 -1
- package/assets/settings-_yzEdCe-.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as e,J as b,b as o}from"./index-
|
|
1
|
+
import{r as n,j as e,J as b,b as o}from"./index-CS4WRs19.js";const h=({isOpen:s,title:i,description:l,confirmLabel:d,cancelLabel:m="Cancel",destructive:u=!1,isBusy:f=!1,onConfirm:x,onCancel:r})=>{const c=n.useRef(null),a=n.useCallback(t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),r())},[r]);return n.useEffect(()=>{if(s)return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s,a]),n.useEffect(()=>{if(!s)return;const t=document.activeElement instanceof HTMLElement?document.activeElement:null;return c.current?.focus(),()=>{t?.isConnected&&t.focus()}},[s]),s?e.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[e.jsx(b,{label:"Dismiss confirmation",onDismiss:r,className:"backdrop-blur-sm"}),e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i,className:o("relative z-10 w-full max-w-sm","bg-surface border border-line rounded-sm shadow-lg","p-6"),children:[e.jsx("h2",{className:"text-lg font-semibold",children:i}),l&&e.jsx("p",{className:"mt-2 text-sm text-fg-muted",children:l}),e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-2",children:[e.jsx("button",{ref:c,type:"button",onClick:r,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors","border border-line hover:bg-surface-raised"),children:m}),e.jsx("button",{type:"button",onClick:x,disabled:f,className:o("min-h-11 inline-flex items-center justify-center px-4 rounded text-sm font-medium transition-colors",u?"bg-danger text-canvas hover:bg-danger/90":"bg-accent text-accent-fg hover:bg-accent-hover","disabled:opacity-50 disabled:cursor-not-allowed"),children:d})]})]})]}):null};export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o}from"./index-
|
|
1
|
+
import{c as o}from"./index-CS4WRs19.js";const a=o("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);export{a as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as Z,af as X,aW as ee,aX as te,r as x,j as t,aY as ae,aZ as se,an as R,B as N,av as ie,aB as ne,a_ as re,a$ as oe,T as le,x as z,w as ce,z as de,E as me,p as ue,Z as pe,az as xe,aD as fe}from"./index-WW7Z17dj.js";import{S as he}from"./settings-screen-BOGydvXt.js";import{B as ge}from"./bottom-sheet-B7MyK_a2.js";import{b as ve,N as S,p as be,u as ye,r as je,a as Ne,S as L,c as Ce,n as Se,d as Fe,f as Me,e as Ie,g as we,h as Ee}from"./useFilters-BE-RO_SE.js";import{u as Oe,a as De,b as Ae,f as Le}from"./move-options-BpzLkHQ5.js";import{u as Te,a as ke}from"./useLabels-CaMfrXk0.js";import{C as A}from"./circle-check-DQR6p1_p.js";import{E as P}from"./ErrorState-CuqqswXJ.js";import"./avatar-B5Q17PQq.js";import"./menu-BMHseCqP.js";import"./circle-help-B5dLfYZy.js";import"./use-match-media-zgI0-sti.js";import"./layout-breakpoints-BWjiUQKh.js";import"./enums-CCxx0t2v.js";const Re=(e,a)=>{const r=Z(),i=X({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:ve(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},ze=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?Pe(e.expiresAt):void 0,name:e.name}),Pe=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,a)=>k(e)!==k(a),$e=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),$(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=be(e.until??""))),r};function _e({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>ze(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=ye(e,je(n)),j=Re(e,a.filterId),v=Ne(e),{createFolderIn:F}=Oe(e),{createLabel:E}=Te(e),I=async o=>{const s=await E(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},O=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),B=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,s=Se(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:s}:D)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},K=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),Q=o=>l(s=>({...s,matchOperator:o})),G=o=>l(s=>({...s,moveMailboxId:o||void 0})),H=o=>l(s=>({...s,labelId:o||void 0})),J=o=>l(s=>({...s,name:o})),V=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),q=o=>l(s=>({...s,until:o})),W=()=>{const o=$(n,f)||_(n,f),s=$e(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},Y=()=>v.start(Ce(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Qe,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(Be,{}):j.isError?t.jsx(Ge,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ke,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(se,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:K,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:Q,onChangeMove:G,onCreateFolder:F,onChangeLabel:H,onCreateLabel:I,onChangeName:J,onChangeScope:V,onChangeUntil:q,onCommit:W,onCancel:d})}function Be(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Ke({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Qe({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ge({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function He({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Fe(),n=t.jsx(_e,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(ge,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Me(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Ie(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(ne,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=we(a),{deleteFilter:f,deletingFilterId:n}=Ee(a),[l,m]=x.useState(),{data:u}=z({...ce({path:{accountId:a}}),staleTime:1/0}),h=De(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return me(w,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>Ae({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=Le(u?.items??[]),{labels:v}=ke(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(He,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx(P,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:M,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function dt(){const e=ue(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=z(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx(P,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,dt as component};
|
|
1
|
+
import{s as Z,af as X,aW as ee,aX as te,r as x,j as t,aY as ae,aZ as se,an as R,B as N,av as ie,aB as ne,a_ as re,a$ as oe,T as le,x as z,w as ce,z as de,E as me,p as ue,Z as pe,az as xe,aD as fe}from"./index-CS4WRs19.js";import{S as he}from"./settings-screen-Bt-HQCfV.js";import{B as ge}from"./bottom-sheet-JE9XidJf.js";import{b as ve,N as S,p as be,u as ye,r as je,a as Ne,S as L,c as Ce,n as Se,d as Fe,f as Me,e as Ie,g as we,h as Ee}from"./useFilters-BKTWdrHN.js";import{u as Oe,a as De,b as Ae,f as Le}from"./move-options-Bqiul3uG.js";import{u as Te,a as ke}from"./useLabels-k8VIZMmD.js";import{C as A}from"./circle-check-DyvDllK0.js";import{E as P}from"./ErrorState-WApPEaDG.js";import"./avatar-5v8CsQPw.js";import"./menu-B0pBSe31.js";import"./circle-help-DcLBg9wT.js";import"./use-match-media-cQP6kb5N.js";import"./layout-breakpoints-BWjiUQKh.js";import"./enums-CCxx0t2v.js";const Re=(e,a)=>{const r=Z(),i=X({...te(),onSuccess:()=>{e&&(r.invalidateQueries({queryKey:ve(e)}),a&&r.invalidateQueries({queryKey:ee({path:{accountId:e,filterId:a}})}))}}),{mutate:c}=i;return{updateFilter:x.useCallback(d=>{!e||!a||c({path:{accountId:e,filterId:a},body:d})},[e,a,c]),isPending:i.isPending,isSuccess:i.isSuccess,isError:i.isError,error:i.error,reset:i.reset}},ze=(e,a=!1)=>({clauses:e.literalClauses.map((i,c)=>({id:`clause-${c}`,field:i.field,value:i.value})),matchOperator:e.matchOperator==="And"?"all":"any",widen:e.hasAnchor?{anchorCount:1,...a?{inactive:!0}:{}}:void 0,moveMailboxId:e.actionMailboxId!==S?e.actionMailboxId:void 0,labelId:e.actionLabelId!==S?e.actionLabelId:void 0,scope:e.scope==="Temporary"?"until":"standing",until:e.scope==="Temporary"?Pe(e.expiresAt):void 0,name:e.name}),Pe=e=>{if(!e)return"";const a=Date.parse(e);if(Number.isNaN(a))return"";const r=new Date(a),i=c=>String(c).padStart(2,"0");return`${r.getFullYear()}-${i(r.getMonth()+1)}-${i(r.getDate())}`},T=e=>JSON.stringify({clauses:e.clauses.map(a=>[a.field,a.value]),operator:e.matchOperator,move:e.moveMailboxId??null,label:e.labelId??null,widen:e.widen?e.widen.inactive?"inactive":"active":"none"}),$=(e,a)=>T(e)!==T(a),k=e=>JSON.stringify({scope:e.scope==="until"?"until":"standing",until:e.scope==="until"?e.until??"":""}),_=(e,a)=>k(e)!==k(a),$e=(e,a)=>{const r={},i=(e.name??"").trim();return i!==(a.name??"").trim()&&(r.name=i),$(e,a)&&(r.matchOperator=e.matchOperator==="all"?"And":"Or",r.literalClauses=e.clauses.map(c=>({field:c.field,value:c.value})),r.actionMailboxId=e.moveMailboxId??S,r.actionLabelId=e.labelId??S),_(e,a)&&(r.scope=e.scope==="until"?"Temporary":"Standing",e.scope==="until"&&(r.expiresAt=be(e.until??""))),r};function _e({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g=!1,onClose:d}){const f=x.useMemo(()=>ze(a,g),[a,g]),[n,l]=x.useState(f),[m,u]=x.useState(),[h,b]=x.useState(!1),M=x.useRef(0),{count:C}=ye(e,je(n)),j=Re(e,a.filterId),v=Ne(e),{createFolderIn:F}=Oe(e),{createLabel:E}=Te(e),I=async o=>{const s=await E(o);return{id:s.labelId,name:s.name,color:s.color}},p=()=>u({mode:"add",draft:{field:L[0],value:""}}),w=o=>{const s=n.clauses.find(y=>y.id===o);s&&u({mode:"edit",clauseId:o,draft:{field:s.field,value:s.value}})},O=o=>u(s=>s&&{...s,draft:{...s.draft,field:o}}),B=o=>u(s=>s&&{...s,draft:{...s.draft,value:o}}),U=()=>{if(!m)return;const o=m.draft.field,s=Se(o,m.draft.value);s!==""&&(l(y=>m.mode==="edit"&&m.clauseId?{...y,clauses:y.clauses.map(D=>D.id===m.clauseId?{id:D.id,field:o,value:s}:D)}:(M.current+=1,{...y,clauses:[...y.clauses,{id:`new-${M.current}`,field:o,value:s}]})),u(void 0))},K=o=>l(s=>({...s,clauses:s.clauses.filter(y=>y.id!==o)})),Q=o=>l(s=>({...s,matchOperator:o})),G=o=>l(s=>({...s,moveMailboxId:o||void 0})),H=o=>l(s=>({...s,labelId:o||void 0})),J=o=>l(s=>({...s,name:o})),V=o=>l(s=>({...s,scope:o,until:o==="until"?s.until:void 0})),q=o=>l(s=>({...s,until:o})),W=()=>{const o=$(n,f)||_(n,f),s=$e(n,f);if(Object.keys(s).length===0){d();return}b(o),j.updateFilter(s)},Y=()=>v.start(Ce(n));return v.isStarting||v.isRunning||v.isDone?t.jsx(Qe,{progress:v.progress,isDone:v.isDone,onClose:d}):j.isPending?t.jsx(Be,{}):j.isError?t.jsx(Ge,{onRetry:j.reset,onClose:d}):j.isSuccess?h?t.jsx(Ke,{preview:ae(C),blocked:C.status!=="ready"||C.stale===!0,onReapply:Y,onClose:d}):t.jsx(Ue,{onClose:d}):t.jsx(se,{rule:n,folders:r,delimiter:i,labels:c,preview:C,semanticAvailable:!1,clauseFields:L,anchorLocked:!0,clauseEdit:m,onStartAddClause:p,onStartEditClause:w,onRemoveClause:K,onChangeDraftField:O,onChangeDraftValue:B,onSubmitClause:U,onCancelClause:()=>u(void 0),onChangeMatchOperator:Q,onChangeMove:G,onCreateFolder:F,onChangeLabel:H,onCreateLabel:I,onChangeName:J,onChangeScope:V,onChangeUntil:q,onCommit:W,onCancel:d})}function Be(){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Saving changes…"})]})}function Ue({onClose:e}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Filter updated"}),t.jsx(N,{variant:"primary",onClick:e,className:"mt-2",children:"Done"})]})}function Ke({preview:e,blocked:a,onReapply:r,onClose:i}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx(A,{className:"size-8 text-positive"}),t.jsx("p",{className:"text-sm font-medium text-fg",children:"Rule saved"}),t.jsxs("p",{className:"max-w-xs text-xs text-fg-muted",children:["New mail follows the rule automatically. ",e," — move the mail already in your mailbox too?"]}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:r,disabled:a,children:"Move existing mail"}),t.jsx(N,{variant:"ghost",onClick:i,children:"Not now"})]})]})}function Qe({progress:e,isDone:a,onClose:r}){const i=e.state==="Failed";return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[a?i?t.jsx("span",{className:"text-sm font-semibold text-danger",children:"Move failed"}):t.jsx(A,{className:"size-8 text-positive"}):t.jsx(R,{className:"size-8 animate-spin text-accent-2"}),!a&&t.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving existing mail…"}),a&&!i&&t.jsxs("div",{className:"text-sm text-fg",children:[t.jsx("p",{className:"font-medium",children:"Done"}),t.jsxs("p",{className:"mt-1 text-xs text-fg-muted",children:[e.appliedCount," of ",e.matchedCount," moved",e.failedCount>0?` · ${e.failedCount} failed`:"","."]})]}),a&&i&&t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:e.errorMessage||"Something went wrong. Please try again."}),a&&t.jsx(N,{variant:"primary",onClick:r,className:"mt-2",children:"Done"})]})}function Ge({onRetry:e,onClose:a}){return t.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-8 text-center",children:[t.jsx("p",{className:"text-sm font-medium text-danger",children:"Couldn't save changes"}),t.jsx("p",{className:"max-w-xs text-xs text-fg-muted",children:"Please try again."}),t.jsxs("div",{className:"mt-2 flex gap-2",children:[t.jsx(N,{variant:"primary",onClick:e,children:"Try again"}),t.jsx(N,{variant:"ghost",onClick:a,children:"Not now"})]})]})}function He({accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d}){const f=Fe(),n=t.jsx(_e,{accountId:e,filter:a,folders:r,delimiter:i,labels:c,semanticUnavailable:g,onClose:d});return f?t.jsx(ie,{open:!0,onClose:d,title:"Filter rule",children:n}):t.jsx(ge,{open:!0,onClose:d,dismissLabel:"Dismiss filter rule",children:n})}function Je({filters:e,mailboxName:a,labelById:r,onEdit:i,onDelete:c,deletingFilterId:g,semanticUnavailable:d=!1,now:f=Date.now()}){return e.length===0?t.jsx("p",{className:"py-6 text-sm text-fg-muted",children:"No filters yet. Select a few messages in the inbox and choose Organize to make one."}):t.jsx("ul",{className:"divide-y divide-line rounded-md border border-line",children:e.map(n=>{const l=Me(n,f),m=l==="Expired",u=n.actionMailboxId!==S?a(n.actionMailboxId):void 0,h=n.actionLabelId!==S?r.get(n.actionLabelId):void 0,b=Ie(n.expiresAt);return t.jsxs("li",{className:"flex items-start gap-3 px-3 py-2.5",children:[t.jsxs("button",{type:"button",onClick:()=>i(n.filterId),"aria-label":`Edit filter ${n.name}`,className:"min-w-0 flex-1 rounded-sm text-left hover:opacity-80",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:`truncate text-sm font-medium ${m?"text-fg-muted":"text-fg"}`,children:n.name}),t.jsx(ne,{tone:m?"neutral":"positive",dot:!0,children:l})]}),t.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[u?`Moves matches to ${u}`:"No move action",n.scope==="Temporary"&&b?m?` · expired ${b}`:` · until ${b}`:n.scope==="Standing"?" · always":""]}),(n.hasAnchor||h)&&t.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[n.hasAnchor&&t.jsx(re,{widen:{anchorCount:1,...d?{inactive:!0}:{}}}),h&&t.jsx(oe,{label:{labelId:h.id,name:h.name,color:h.color}})]})]}),t.jsx(N,{variant:"ghost",size:"sm",icon:t.jsx(le,{className:"size-4 text-danger"}),onClick:()=>c(n.filterId),disabled:g===n.filterId,"aria-label":`Delete filter ${n.name}`})]},n.filterId)})})}const Ve=t.jsxs("div",{className:"space-y-3",children:[t.jsxs("p",{children:["Filters are the standing rules Organize creates. A"," ",t.jsx("strong",{children:"Standing"})," filter keeps working on new mail; a"," ",t.jsx("strong",{children:"Temporary"})," one stops on its own at the date you picked."]}),t.jsx("p",{children:"An expired filter isn't deleted the instant it lapses — it stays here, marked Expired, so you can see what it did and when it stopped."})]});function qe({account:e}){const a=e.accountId,{filters:r,isPending:i,isError:c,error:g,refetch:d}=we(a),{deleteFilter:f,deletingFilterId:n}=Ee(a),[l,m]=x.useState(),{data:u}=z({...ce({path:{accountId:a}}),staleTime:1/0}),h=De(),b=x.useMemo(()=>de(e.folderAppointments),[e.folderAppointments]),M=x.useCallback(p=>{const w=u?.items.find(O=>O.mailboxId===p);if(w)return me(w,b.get(p),h)},[u?.items,b,h]),C=x.useMemo(()=>Ae({mailboxes:u?.items??[],folderAppointments:e.folderAppointments,translator:h}),[u?.items,e.folderAppointments,h]),j=Le(u?.items??[]),{labels:v}=ke(a),F=x.useMemo(()=>v.map(p=>({id:p.labelId,name:p.name,color:p.color})),[v]),E=x.useMemo(()=>new Map(F.map(p=>[p.id,p])),[F]),I=r.find(p=>p.filterId===l);return t.jsxs("section",{className:"space-y-2",children:[t.jsx("h2",{className:"text-sm font-semibold text-fg",children:e.email}),I&&t.jsx(He,{accountId:a,filter:I,folders:C,delimiter:j,labels:F,onClose:()=>m(void 0)}),i?t.jsx("div",{className:"h-16 animate-pulse rounded-md border border-line bg-surface","aria-busy":"true","aria-label":`Loading filters for ${e.email}`}):c?t.jsx(P,{variant:"inline",title:`Couldn't load filters for ${e.email}`,error:g,onRetry:()=>{d()}}):t.jsx(Je,{filters:r,mailboxName:M,labelById:E,onEdit:m,onDelete:f,deletingFilterId:n})]})}function dt(){const e=ue(),[a,r]=x.useState(!0),{data:i,isPending:c,isError:g,error:d,refetch:f}=z(pe()),n=l=>{const m=fe[l];m&&e({to:m})};return t.jsx(he,{items:xe,activeId:"filters",title:"Filters",description:"Standing and temporary rules created by Organize, per account.",help:Ve,helpOpen:a,onToggleHelp:()=>r(l=>!l),onSelect:n,onBackToMail:()=>{e({to:"/mail"})},children:c?t.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):g?t.jsx(P,{title:"Couldn't load accounts",error:d,onRetry:()=>{f()}}):i.accounts.length===0?t.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):t.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>t.jsx(qe,{account:l},l.accountId))})})}export{qe as AccountFilters,dt as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./index-
|
|
1
|
+
import{j as r}from"./index-CS4WRs19.js";import{E as o}from"./ErrorState-WApPEaDG.js";const l=({error:t,reset:e})=>r.jsx("div",{className:"flex h-full items-center justify-center bg-canvas p-4",children:r.jsx(o,{title:"Couldn't load your starred mail",error:t,onRetry:e})});export{l as errorComponent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o,a0 as i}from"./index-CS4WRs19.js";import{a as m}from"./search-view-XSNikzls.js";import{F as r}from"./FlaggedPane-B309puX5.js";import{u as p}from"./useSearchMirror-Cn7iym8r.js";import"./nav-link-CQ7Z4WT-.js";import{u as e}from"./MailListHeader-XYk1qiUs.js";import"./useSearchTokenContext-CI55IeG6.js";import"./kbd-gTxkTuYe.js";import"./use-match-media-cQP6kb5N.js";import"./enums-CCxx0t2v.js";import"./search-scope-CiJO7L67.js";import"./MailViewChrome-eJ4mjZK8.js";import"./search-token-index-DT41FctS.js";import"./layout-breakpoints-BWjiUQKh.js";import"./avatar-5v8CsQPw.js";import"./account-form-helpers-ivUrHOn-.js";import"./menu-B0pBSe31.js";import"./ErrorState-WApPEaDG.js";import"./useFilters-BKTWdrHN.js";import"./useSignature-BkFbqoBh.js";import"./useDebouncedValue-C0SXwgbW.js";import"./format-De9HZKjg.js";import"./download-DWaNCU-a.js";import"./shield-check-2JF-XI2A.js";import"./move-options-Bqiul3uG.js";import"./confirm-dialog-CKwSJaYW.js";import"./clock-qLthdmxi.js";function v(){const t=e();return p({to:"/mail/flagged"}),o.jsx(r,{thread:t,children:o.jsx(m,{phone:o.jsx(r.Phone,{}),list:o.jsx(r.List,{}),reading:o.jsx(i,{}),intelligence:o.jsx(r.Intelligence,{}),hasThread:!!t})})}export{v as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,B as j,T as z,b0 as H,r as u,av as G,X as V,aE as ie,al as Y,F as le,aI as Z,b1 as ce,ak as de,ao as me,aH as xe,s as W,Q as X,a1 as J,b2 as ue,b3 as he,b4 as fe,b5 as U,E as R,z as ee,an as B,aA as se,b6 as pe,ab as ge,p as be,x as te,Z as je,az as ve,aD as ye,w as Ne,af as Q,b7 as Ce,b8 as ke,aL as Me,b9 as we}from"./index-WW7Z17dj.js";import{P as Ie}from"./pencil-DDAAza1K.js";import{S as Se}from"./settings-screen-BOGydvXt.js";import{c as Oe,d as F,e as Ae,M as De,i as q,u as ae,a as re,b as Ee,m as K,g as Te}from"./move-options-BpzLkHQ5.js";import{E as ne}from"./ErrorState-CuqqswXJ.js";import"./avatar-B5Q17PQq.js";import"./menu-BMHseCqP.js";import"./circle-help-B5dLfYZy.js";import"./enums-CCxx0t2v.js";const Fe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:i,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=i?`${r(s)} — ${i}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:i,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),"aria-label":c,disabled:i!==void 0,onClick:t})})]})},Pe=({folders:s,onRename:n,onDelete:t,onCreateFolder:i,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(H,{folders:s,onCreateFolder:i,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Fe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},ze=({open:s,folderLabel:n,defaultLabel:t,name:i,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const l=u.useId(),p=`Rename ${n}`;return s?e.jsxs(G,{open:s,onClose:c,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ie,{htmlFor:l,children:"Folder name"}),e.jsx(Y,{id:l,value:i,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},Re=["inbox","drafts","sent","archive","junk","trash"],L="";function Le(s){const n=s.messageCount===1?"msg":"msgs";return`${Z(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:i,onAppoint:d,onRename:r}){const[c,o]=u.useState(i),a=n.find(m=>m.mailboxId===t)??null,l=xe(s),p=a!=null&&c.trim()!==i.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[ce(s),l]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??L,"aria-label":`Folder for ${l}`,onChange:m=>d(s,m.target.value===L?null:m.target.value),children:[e.jsx("option",{value:L,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:Le(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:i={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Re.map(a=>{const l=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:l,displayName:l?i[l]??"":"",onAppoint:d,onRename:r},a)})}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:o.map(a=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:Z(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,Be=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:Be(n)})),Qe=async(s,n,t,i)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(i.aborted)return d;const{data:o}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},qe=async(s,n)=>{let t=0,i;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:i},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;i=r.continuationToken}return t};function Ke({accountId:s,mailboxId:n,onDeleted:t}){const i=W(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,l]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{i.invalidateQueries({queryKey:X({path:{accountId:s}})}),i.invalidateQueries({queryKey:J()})},[i,s]),N=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){l(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),l(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){l(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(Qe(n,k,De,f));if(f.aborted)return;if(!v.ok){h=F(h,v.error),o(h),l(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=F(h,A.error),o(h),l(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const y=await T(qe(n,f));if(!f.aborted){if(!y.ok){h=F(h,y.error),o(h),l(y.error),r("error");return}if(y.value>0){const v=`${y.value} ${y.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=F(h,v),o(h),l(v),r("error"),m();return}await N()}},[n,C,N,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),l(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:N,moveThenDelete:w,cancel:E,reset:D}}const P=s=>`${s} ${s===1?"email":"emails"}`;function He({open:s,accountId:n,folder:t,mailboxes:i,appointments:d,onClose:r}){const[c,o]=u.useState(()=>q(t.messageCount)),[a,l]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:N,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Ke({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(q(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&l(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:i,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[i,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>R(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const y=`Delete ${k}`,v=N==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:C?K(C):"Moved 0 of 0"})]}):N==="deleting"||N==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):N==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[K(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",P(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(z,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>o("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(pe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k})," and its"," ",P(t.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",P(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(H,{folders:I,selectedId:a,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:l,onCreateFolder:p,onCancel:()=>{l(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${P(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(G,{open:s,onClose:f,title:y,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:y}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const Ge=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function Ve({account:s}){const n=W(),t=s.accountId,i=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(Ne({path:{accountId:t}})),{createFolderIn:l}=ae(t),p=Q({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:J()})}}),m=Q({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:X({path:{accountId:t}})})}}),[N,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:R(x,f.get(x.mailboxId),i),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,i,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const y=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(N);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:y,appointments:v,displayNames:M,onAppoint:h,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Pe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:l,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(ze,{open:!0,folderLabel:R(S,f.get(S.mailboxId),i),defaultLabel:R({fullPath:S.fullPath},f.get(S.mailboxId),i),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(He,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function as(){const s=be(),[n,t]=u.useState(!0),{data:i,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=l=>{const p=ye[l];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:Ge,helpOpen:n,onToggleHelp:()=>t(l=>!l),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):i.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>e.jsx(Ve,{account:l},l.accountId))})})}export{as as component};
|
|
1
|
+
import{j as e,B as j,T as z,b0 as H,r as u,av as G,X as V,aE as ie,al as Y,F as le,aI as Z,b1 as ce,ak as de,ao as me,aH as xe,s as W,Q as X,a1 as J,b2 as ue,b3 as he,b4 as fe,b5 as U,E as R,z as ee,an as B,aA as se,b6 as pe,ab as ge,p as be,x as te,Z as je,az as ve,aD as ye,w as Ne,af as Q,b7 as Ce,b8 as ke,aL as Me,b9 as we}from"./index-CS4WRs19.js";import{P as Ie}from"./pencil-B2Fl3N7B.js";import{S as Se}from"./settings-screen-Bt-HQCfV.js";import{c as Oe,d as F,e as Ae,M as De,i as q,u as ae,a as re,b as Ee,m as K,g as Te}from"./move-options-Bqiul3uG.js";import{E as ne}from"./ErrorState-WApPEaDG.js";import"./avatar-5v8CsQPw.js";import"./menu-B0pBSe31.js";import"./circle-help-DcLBg9wT.js";import"./enums-CCxx0t2v.js";const Fe=({label:s,onRename:n,onDelete:t,deleteBlockedReason:i,renameLabel:d=c=>`Rename ${c}`,deleteLabel:r=c=>`Delete ${c}`})=>{const c=i?`${r(s)} — ${i}`:r(s);return e.jsxs("span",{className:"flex shrink-0 items-center gap-0.5 pr-2",children:[e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(Ie,{className:"size-3.5"}),"aria-label":d(s),onClick:n}),e.jsx("span",{title:i,children:e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),"aria-label":c,disabled:i!==void 0,onClick:t})})]})},Pe=({folders:s,onRename:n,onDelete:t,onCreateFolder:i,delimiter:d,labels:r})=>{const c=new Map(s.map(o=>[o.id,o]));return e.jsx(H,{folders:s,onCreateFolder:i,delimiter:d,labels:{treeAriaLabel:"Your folders",optionLabel:o=>o,...r},rowActions:o=>{const a=c.get(o.id);return a?e.jsx(Fe,{label:a.label,deleteBlockedReason:a.deleteBlockedReason,renameLabel:r?.rename,deleteLabel:r?.remove,onRename:()=>n(a),onDelete:()=>t(a)}):null}})},ze=({open:s,folderLabel:n,defaultLabel:t,name:i,onNameChange:d,onSubmit:r,onClose:c,pending:o=!1,error:a})=>{const l=u.useId(),p=`Rename ${n}`;return s?e.jsxs(G,{open:s,onClose:c,title:p,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:p}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:c,"aria-label":"Cancel"})]}),e.jsxs("div",{className:"space-y-3 px-5 py-4",children:[e.jsxs("div",{children:[e.jsx(ie,{htmlFor:l,children:"Folder name"}),e.jsx(Y,{id:l,value:i,placeholder:t,onChange:m=>d(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),r())}})]}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Shown everywhere in Remit. Leave it blank to use"," ",e.jsx("span",{className:"font-medium text-fg",children:t}),"."]}),a&&e.jsx("p",{className:"text-xs text-danger",role:"alert",children:a})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:c,children:"Cancel"}),e.jsx(j,{variant:"primary",size:"sm",onClick:r,disabled:o,children:o?"Saving…":"Save name"})]})]}):null},Re=["inbox","drafts","sent","archive","junk","trash"],L="";function Le(s){const n=s.messageCount===1?"msg":"msgs";return`${Z(s.providerPath)} · ${s.messageCount} ${n}`}function $e({role:s,folders:n,appointedId:t,displayName:i,onAppoint:d,onRename:r}){const[c,o]=u.useState(i),a=n.find(m=>m.mailboxId===t)??null,l=xe(s),p=a!=null&&c.trim()!==i.trim();return e.jsxs("div",{className:"flex flex-col gap-1 border-b border-line px-row-inset py-2.5 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex w-28 shrink-0 items-center gap-2 text-sm font-medium text-fg",children:[ce(s),l]}),e.jsxs(de,{className:"w-56 shrink-0",value:t??L,"aria-label":`Folder for ${l}`,onChange:m=>d(s,m.target.value===L?null:m.target.value),children:[e.jsx("option",{value:L,children:"None"}),n.map(m=>e.jsx("option",{value:m.mailboxId,children:Le(m)},m.mailboxId))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"flex-1",value:c,placeholder:l,"aria-label":`Display name for ${l}`,onChange:m=>o(m.target.value)}),p&&e.jsx(j,{variant:"ghost",size:"sm",className:"shrink-0",icon:e.jsx(me,{className:"size-4"}),"aria-label":"Save display name",onClick:()=>r(a.mailboxId,c)})]})]}),a&&e.jsxs("span",{className:"truncate pl-[7.5rem] text-2xs text-fg-subtle",title:a.providerPath,children:[a.providerPath," · ",a.messageCount," ",a.messageCount===1?"message":"messages"]})]})}function _e({accountEmail:s,folders:n,appointments:t,displayNames:i={},onAppoint:d,onRename:r}){const c=new Set(Object.values(t).filter(a=>a!=null)),o=n.filter(a=>!c.has(a.mailboxId));return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("header",{className:"space-y-1",children:[e.jsxs("h2",{className:"text-sm font-semibold text-fg",children:["Folder roles — ",s]}),e.jsx("p",{className:"text-xs text-fg-muted",children:"Each role points to one folder. Pick the folder that holds the mail — the counts help you tell real folders from empty look-alikes. Appointing a folder here removes it from any other role."})]}),e.jsx("div",{className:"rounded-sm border border-line bg-surface",children:Re.map(a=>{const l=t[a]??null;return e.jsx($e,{role:a,folders:n,appointedId:l,displayName:l?i[l]??"":"",onAppoint:d,onRename:r},a)})}),o.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-xs font-medium text-fg-muted",children:"Other folders"}),e.jsx("ul",{className:"rounded-sm border border-line bg-surface",children:o.map(a=>e.jsxs("li",{className:"flex items-center gap-2 border-b border-line px-row-inset py-2 text-sm text-fg last:border-b-0",children:[e.jsx(le,{className:"size-4 shrink-0 text-fg-subtle"}),e.jsx("span",{className:"truncate",children:Z(a.providerPath)}),e.jsxs("span",{className:"ml-auto shrink-0 text-2xs text-fg-subtle",children:[a.messageCount," ",a.messageCount===1?"message":"messages"]})]},a.mailboxId))})]})]})}const oe=50,Be=s=>s instanceof Error?s.message:"Something went wrong.",T=s=>s.then(n=>({ok:!0,value:n}),n=>({ok:!1,error:Be(n)})),Qe=async(s,n,t,i)=>{const d=[];let r;for(let c=0;c<oe;c+=1){if(i.aborted)return d;const{data:o}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:r},throwOnError:!0});for(const a of o.items)if(!a.isDeleted&&!n.has(a.messageId)&&!d.includes(a.messageId)&&(d.push(a.messageId),d.length>=t))return d;if(!o.continuationToken)break;r=o.continuationToken}return d},qe=async(s,n)=>{let t=0,i;for(let d=0;d<oe;d+=1){if(n.aborted)return t;const{data:r}=await U({path:{mailboxId:s},query:{order:"desc",continuationToken:i},throwOnError:!0});for(const c of r.items)c.isDeleted||(t+=1);if(!r.continuationToken)break;i=r.continuationToken}return t};function Ke({accountId:s,mailboxId:n,onDeleted:t}){const i=W(),[d,r]=u.useState("idle"),[c,o]=u.useState(null),[a,l]=u.useState(),p=u.useRef(null),m=u.useCallback(()=>{i.invalidateQueries({queryKey:X({path:{accountId:s}})}),i.invalidateQueries({queryKey:J()})},[i,s]),N=u.useCallback(async()=>{r("deleting");const b=await T(ue({path:{accountId:s,mailboxId:n},throwOnError:!0}));if(!b.ok){l(b.error),r("error");return}m(),r("done"),t()},[s,n,m,t]),C=u.useCallback(()=>he({path:{accountId:s},throwOnError:!0}).then(({data:b})=>b.items.find(g=>g.mailboxId===n)?.messageCount??0),[s,n]),E=u.useCallback(()=>{p.current?.abort()},[]),w=u.useCallback(async b=>{const g=new AbortController;p.current=g;const{signal:f}=g;r("moving"),l(void 0);const I=await T(C());if(f.aborted)return;if(!I.ok){l(I.error),r("error");return}let h=Oe(I.value);o(h);const k=new Set;for(;;){if(f.aborted)return;const v=await T(Qe(n,k,De,f));if(f.aborted)return;if(!v.ok){h=F(h,v.error),o(h),l(v.error),r("error");return}const M=v.value;if(M.length===0)break;const A=await T(fe({body:{messageIds:M,destinationMailboxId:b},throwOnError:!0}));if(f.aborted)return;if(!A.ok){h=F(h,A.error),o(h),l(A.error),r("error");return}for(const S of M)k.add(S);h=Ae(h,M.length),o(h)}const y=await T(qe(n,f));if(!f.aborted){if(!y.ok){h=F(h,y.error),o(h),l(y.error),r("error");return}if(y.value>0){const v=`${y.value} ${y.value===1?"email is":"emails are"} still syncing. Re-open delete to finish removing this folder.`;h=F(h,v),o(h),l(v),r("error"),m();return}await N()}},[n,C,N,m]),D=u.useCallback(()=>{p.current?.abort(),p.current=null,r("idle"),o(null),l(void 0)},[]);return{phase:d,progress:c,errorMessage:a,deleteMailbox:N,moveThenDelete:w,cancel:E,reset:D}}const P=s=>`${s} ${s===1?"email":"emails"}`;function He({open:s,accountId:n,folder:t,mailboxes:i,appointments:d,onClose:r}){const[c,o]=u.useState(()=>q(t.messageCount)),[a,l]=u.useState(),{createFolderIn:p}=ae(n),m=re(),{phase:N,progress:C,errorMessage:E,deleteMailbox:w,moveThenDelete:D,cancel:b,reset:g}=Ke({accountId:n,mailboxId:t.mailboxId,onDeleted:r});u.useEffect(()=>{s&&(o(q(t.messageCount)),g())},[s,t.messageCount,g]),u.useEffect(()=>{s&&l(void 0)},[s]),u.useEffect(()=>b,[b]);const f=u.useCallback(()=>{b(),r()},[b,r]),I=u.useMemo(()=>Ee({mailboxes:i,folderAppointments:d,excludeMailboxId:t.mailboxId,translator:m}),[i,d,t.mailboxId,m]),h=I.find(M=>M.id===a),k=u.useMemo(()=>R(t,ee(d).get(t.mailboxId),m),[t,d,m]);if(!s)return null;const y=`Delete ${k}`,v=N==="moving"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Moving emails…"}),e.jsx("p",{className:"text-xs text-fg-muted",role:"status","aria-live":"polite",children:C?K(C):"Moved 0 of 0"})]}):N==="deleting"||N==="done"?e.jsxs("div",{className:"flex flex-col items-center gap-3 px-5 py-10 text-center",children:[e.jsx(B,{className:"size-8 animate-spin text-accent-2"}),e.jsx("p",{className:"text-sm font-medium text-fg",children:"Deleting folder…"})]}):N==="error"?e.jsxs("div",{className:"space-y-4 px-5 py-4",children:[e.jsx(se,{tone:"danger",variant:"soft",children:E??"Something went wrong. Please try again."}),C&&e.jsxs("p",{className:"text-xs text-fg-muted",children:[K(C),". Already-moved emails stay moved — re-open delete to continue with the rest."]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Close"})})]}):c==="confirm-empty"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k}),"? This folder is empty and will be removed from the server."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder"})]})]}):c==="choose-fate"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:k})," holds"," ",P(t.messageCount),". What should happen to them?"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("button",{type:"button",onClick:()=>o("confirm-delete-all"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(z,{className:"size-4 shrink-0 text-danger"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Delete them with the folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"The emails are removed from the server and can't be recovered."})]})]}),e.jsxs("button",{type:"button",onClick:()=>o("pick-destination"),className:"flex w-full items-center gap-3 rounded-sm border border-line px-3 py-2.5 text-left hover:bg-surface-raised",children:[e.jsx(pe,{className:"size-4 shrink-0 text-accent-2"}),e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block text-sm font-medium text-fg",children:"Move them to another folder"}),e.jsx("span",{className:"block text-xs text-fg-muted",children:"Keep the emails, then delete the emptied folder."})]})]})]})]}),e.jsx("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:e.jsx(j,{variant:"secondary",size:"sm",onClick:f,children:"Cancel"})})]}):c==="confirm-delete-all"?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 px-5 py-4 text-sm text-fg-muted",children:e.jsxs("p",{children:["Delete ",e.jsx("strong",{className:"text-fg",children:k})," and its"," ",P(t.messageCount),"? The messages are removed from the server with the folder and can't be recovered."]})}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-line px-5 py-3",children:[e.jsx(j,{variant:"secondary",size:"sm",onClick:()=>o("choose-fate"),children:"Back"}),e.jsx(j,{variant:"danger",size:"sm",icon:e.jsx(z,{className:"size-3.5"}),onClick:()=>w(),children:"Delete folder and emails"})]})]}):e.jsxs("div",{className:"flex h-[26rem] flex-col",children:[e.jsxs("p",{className:"px-5 pt-4 text-sm text-fg-muted",children:["Move the ",P(t.messageCount)," in"," ",e.jsx("strong",{className:"text-fg",children:k})," to:"]}),e.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:e.jsx(H,{folders:I,selectedId:a,delimiter:i[0]?.hierarchyDelimiter??"/",onSelect:l,onCreateFolder:p,onCancel:()=>{l(void 0),o("choose-fate")},labels:{filterPlaceholder:"Move emails to…"}})}),h&&e.jsx("footer",{className:"shrink-0 border-t border-line p-2",children:e.jsx(j,{variant:"danger",onClick:()=>D(h.id),className:"h-11 w-full font-semibold",children:e.jsx("span",{className:"truncate",children:`Move ${P(t.messageCount)} to ${h.label}`})})})]});return e.jsxs(G,{open:s,onClose:f,title:y,children:[e.jsxs("header",{className:"flex items-center gap-2 border-b border-line px-5 py-3",children:[e.jsx(ge,{className:"size-4 shrink-0 text-danger"}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-fg",children:y}),e.jsx(j,{variant:"ghost",size:"sm",icon:e.jsx(V,{className:"size-3.5"}),onClick:f,"aria-label":"Cancel"})]}),v]})}const Ge=e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"Each canonical role — Inbox, Drafts, Sent, Archive, Spam, Trash — points at one of your account's real folders. Pick the one that actually holds the mail; the message counts tell real folders from empty look-alikes."}),e.jsx("p",{children:`Appointing a folder to a role here doesn't touch any other role, and doesn't move or rename anything on the server — it just tells Remit which folder to treat as e.g. "Drafts" everywhere (sidebar, unread badges, the compose flow).`}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-fg",children:"Your folders"})," is the account's real hierarchy. Open a folder to see what's inside it, make a new one where you're looking, and rename or delete any of them from its row."]})]});function Ve({account:s}){const n=W(),t=s.accountId,i=re(),{data:d,isPending:r,isError:c,error:o,refetch:a}=te(Ne({path:{accountId:t}})),{createFolderIn:l}=ae(t),p=Q({...Ce(),onSuccess:()=>{n.invalidateQueries({queryKey:J()})}}),m=Q({...ke(),onSuccess:()=>{n.invalidateQueries({queryKey:X({path:{accountId:t}})})}}),[N,C]=u.useState(),[E,w]=u.useState(),[D,b]=u.useState(""),g=u.useMemo(()=>d?.items??[],[d]),f=u.useMemo(()=>ee(s.folderAppointments),[s.folderAppointments]),I=u.useMemo(()=>g.map(x=>({id:x.mailboxId,label:R(x,f.get(x.mailboxId),i),path:x.fullPath,deleteBlockedReason:Te(x,g,s.folderAppointments).message})),[g,f,i,s.folderAppointments]),h=(x,O)=>{p.mutate({path:{accountId:t,role:we[x]},body:{mailboxId:O}})},k=(x,O)=>{const _=O.trim();m.mutate({path:{accountId:t,mailboxId:x},body:{displayNameOverride:_===""?null:_}})};if(r)return e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":`Loading folders for ${s.email}`});if(c)return e.jsx(ne,{variant:"inline",title:`Couldn't load folders for ${s.email}`,error:o,onRetry:()=>{a()}});const y=g.map(x=>({mailboxId:x.mailboxId,providerPath:x.fullPath,messageCount:x.messageCount})),v={};for(const x of s.folderAppointments){const O=Me[x.role];O&&(v[O]=x.mailboxId??null)}const M={};for(const x of g)x.displayNameOverride&&(M[x.mailboxId]=x.displayNameOverride);const A=x=>g.find(O=>O.mailboxId===x),S=A(E),$=A(N);return e.jsxs("div",{className:"space-y-4",children:[(p.isError||m.isError)&&e.jsx(se,{tone:"danger",variant:"soft",children:"Couldn't save that change. Please try again."}),e.jsx(_e,{accountEmail:s.email,folders:y,appointments:v,displayNames:M,onAppoint:h,onRename:k}),e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-fg",children:["Your folders — ",s.email]}),e.jsx("div",{className:"flex h-[28rem] flex-col overflow-hidden rounded-sm border border-line bg-surface",children:e.jsx(Pe,{folders:I,delimiter:g[0]?.hierarchyDelimiter??"/",onCreateFolder:l,onRename:x=>{w(x.id),b(A(x.id)?.displayNameOverride?.trim()??"")},onDelete:x=>C(x.id),labels:{treeAriaLabel:`All folders for ${s.email}`}})})]}),S&&e.jsx(ze,{open:!0,folderLabel:R(S,f.get(S.mailboxId),i),defaultLabel:R({fullPath:S.fullPath},f.get(S.mailboxId),i),name:D,onNameChange:b,pending:m.isPending,error:m.isError?"Couldn't save that name. Please try again.":void 0,onSubmit:()=>{const x=D.trim();m.mutate({path:{accountId:t,mailboxId:S.mailboxId},body:{displayNameOverride:x===""?null:x}},{onSuccess:()=>w(void 0)})},onClose:()=>w(void 0)}),$&&e.jsx(He,{open:!0,accountId:t,folder:$,mailboxes:g,appointments:s.folderAppointments,onClose:()=>C(void 0)})]})}function as(){const s=be(),[n,t]=u.useState(!0),{data:i,isPending:d,isError:r,error:c,refetch:o}=te(je()),a=l=>{const p=ye[l];p&&s({to:p})};return e.jsx(Se,{items:ve,activeId:"folders",title:"Folder roles",description:"Appoint which real folder fills each canonical role, per account.",help:Ge,helpOpen:n,onToggleHelp:()=>t(l=>!l),onSelect:a,onBackToMail:()=>{s({to:"/mail"})},children:d?e.jsx("div",{className:"h-24 animate-pulse rounded-sm border border-line bg-surface","aria-busy":"true","aria-label":"Loading accounts"}):r?e.jsx(ne,{title:"Couldn't load accounts",error:c,onRetry:()=>{o()}}):i.accounts.length===0?e.jsx("p",{className:"py-12 text-sm text-fg-muted",children:"No accounts configured."}):e.jsx("div",{className:"space-y-8",children:i.accounts.map(l=>e.jsx(Ve,{account:l},l.accountId))})})}export{as as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CS4WRs19.js";import{M as i}from"./MailboxPane-Cptv9NrX.js";import"./useSearchTokenContext-CI55IeG6.js";import"./kbd-gTxkTuYe.js";import"./use-match-media-cQP6kb5N.js";import"./enums-CCxx0t2v.js";import"./search-scope-CiJO7L67.js";import"./useRefreshControl-Dai7_R2P.js";import"./circle-check-big-C5D6DMtM.js";import"./search-token-index-DT41FctS.js";import"./layout-breakpoints-BWjiUQKh.js";import"./MailListHeader-XYk1qiUs.js";import"./account-form-helpers-ivUrHOn-.js";import"./avatar-5v8CsQPw.js";import"./useSignature-BkFbqoBh.js";import"./useDebouncedValue-C0SXwgbW.js";import"./useFilters-BKTWdrHN.js";import"./ErrorState-WApPEaDG.js";import"./format-De9HZKjg.js";import"./nav-link-CQ7Z4WT-.js";import"./download-DWaNCU-a.js";import"./shield-check-2JF-XI2A.js";import"./move-options-Bqiul3uG.js";import"./confirm-dialog-CKwSJaYW.js";import"./clock-qLthdmxi.js";import"./menu-B0pBSe31.js";import"./MailViewChrome-eJ4mjZK8.js";import"./NavMenuButton-DqHqOJc-.js";import"./useLabels-k8VIZMmD.js";import"./useSemanticSearch-CTggCJhI.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-JE9XidJf.js";import"./circle-help-DcLBg9wT.js";import"./circle-check-DyvDllK0.js";import"./intelligence-pref-C6lFpj6U.js";function I(){return o.jsx(i.Reading,{})}export{I as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CS4WRs19.js";import{M as r}from"./MailboxPane-Cptv9NrX.js";import"./useSearchTokenContext-CI55IeG6.js";import"./kbd-gTxkTuYe.js";import"./use-match-media-cQP6kb5N.js";import"./enums-CCxx0t2v.js";import"./search-scope-CiJO7L67.js";import"./useRefreshControl-Dai7_R2P.js";import"./circle-check-big-C5D6DMtM.js";import"./search-token-index-DT41FctS.js";import"./layout-breakpoints-BWjiUQKh.js";import"./MailListHeader-XYk1qiUs.js";import"./account-form-helpers-ivUrHOn-.js";import"./avatar-5v8CsQPw.js";import"./useSignature-BkFbqoBh.js";import"./useDebouncedValue-C0SXwgbW.js";import"./useFilters-BKTWdrHN.js";import"./ErrorState-WApPEaDG.js";import"./format-De9HZKjg.js";import"./nav-link-CQ7Z4WT-.js";import"./download-DWaNCU-a.js";import"./shield-check-2JF-XI2A.js";import"./move-options-Bqiul3uG.js";import"./confirm-dialog-CKwSJaYW.js";import"./clock-qLthdmxi.js";import"./menu-B0pBSe31.js";import"./MailViewChrome-eJ4mjZK8.js";import"./NavMenuButton-DqHqOJc-.js";import"./useLabels-k8VIZMmD.js";import"./useSemanticSearch-CTggCJhI.js";import"./search-query-Cr_ZXBCp.js";import"./bottom-sheet-JE9XidJf.js";import"./circle-help-DcLBg9wT.js";import"./circle-check-DyvDllK0.js";import"./intelligence-pref-C6lFpj6U.js";function H(){return o.jsx(r.Reading,{})}export{H as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CS4WRs19.js";import{F as r}from"./FlaggedPane-B309puX5.js";import"./useSearchTokenContext-CI55IeG6.js";import"./kbd-gTxkTuYe.js";import"./use-match-media-cQP6kb5N.js";import"./enums-CCxx0t2v.js";import"./search-scope-CiJO7L67.js";import"./MailListHeader-XYk1qiUs.js";import"./search-token-index-DT41FctS.js";import"./layout-breakpoints-BWjiUQKh.js";import"./account-form-helpers-ivUrHOn-.js";import"./avatar-5v8CsQPw.js";import"./useSignature-BkFbqoBh.js";import"./useDebouncedValue-C0SXwgbW.js";import"./useFilters-BKTWdrHN.js";import"./ErrorState-WApPEaDG.js";import"./format-De9HZKjg.js";import"./nav-link-CQ7Z4WT-.js";import"./download-DWaNCU-a.js";import"./shield-check-2JF-XI2A.js";import"./move-options-Bqiul3uG.js";import"./confirm-dialog-CKwSJaYW.js";import"./clock-qLthdmxi.js";import"./menu-B0pBSe31.js";import"./MailViewChrome-eJ4mjZK8.js";function w(){return o.jsx(r.Reading,{})}export{w as component};
|