@remit/web-client-dist 0.0.358 → 0.0.359
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-CtQ__4rW.js +1 -0
- package/assets/{ErrorState-BnG-HaD4.js → ErrorState-eMOlBfIV.js} +1 -1
- package/assets/FlaggedPane-CtT4pW1A.js +1 -0
- package/assets/FullCompose-BZ0Enn9I.js +1 -0
- package/assets/MailListHeader-BXdL6PZE.js +7 -0
- package/assets/{MailViewChrome-BJ4q1GXR.js → MailViewChrome-C4KeVspC.js} +1 -1
- package/assets/MailboxPane-Xp15g3fz.js +1 -0
- package/assets/{NavMenuButton-O8AaZTpY.js → NavMenuButton-BXjID2LC.js} +1 -1
- package/assets/{OnboardingWizard-CEm3zOtV.js → OnboardingWizard-C7KAfYmq.js} +1 -1
- package/assets/OutboxPane-C9G6yi-O.js +1 -0
- package/assets/_mailboxId-BIBSxF-E.js +1 -0
- package/assets/_messageId-CY4bgXOY.js +1 -0
- package/assets/_messageId-CtueS4H5.js +1 -0
- package/assets/_messageId-DnJEGG2N.js +1 -0
- package/assets/_outboxMessageId-BfdM6H4-.js +1 -0
- package/assets/_threadId-B3tWBLSG.js +1 -0
- package/assets/_threadId-DZQHrmp9.js +1 -0
- package/assets/_threadId-DaxMqmjN.js +1 -0
- package/assets/{accounts-Bp1UvtHI.js → accounts-BMowAy8J.js} +1 -1
- package/assets/{advanced-JyuqGV4K.js → advanced-BriHDMMN.js} +1 -1
- package/assets/{appearance-CJPxo4Dl.js → appearance-BQWqzSY1.js} +1 -1
- package/assets/{attachment-file-CMfx3CcW.js → attachment-file-B6idyO8B.js} +1 -1
- package/assets/{avatar-DqkGERXB.js → avatar-BA2RXTDI.js} +1 -1
- package/assets/{bottom-sheet-CNBsemxY.js → bottom-sheet-DDpdzJg1.js} +1 -1
- package/assets/{brief-DMSyXbnZ.js → brief-Bt9VukKS.js} +1 -1
- package/assets/brief-C1tXNG83.js +1 -0
- package/assets/{browser-ponyfill-D4nvYSFj.js → browser-ponyfill-A4iyNg9e.js} +1 -1
- package/assets/{bug-BZM7jlIN.js → bug-Rs-29jam.js} +1 -1
- package/assets/{circle-check-BsPPl8Vd.js → circle-check-BvII-ksS.js} +1 -1
- package/assets/{circle-check-big-Cn33pldS.js → circle-check-big-DPA5LcMX.js} +1 -1
- package/assets/{circle-help-DWpn0l-r.js → circle-help-pT1YKg_z.js} +1 -1
- package/assets/{clock-60QzMefl.js → clock-Cq-y4Ofh.js} +1 -1
- package/assets/compose._-_outboxMessageId_-B5n3en0_.js +1 -0
- package/assets/compose._-_outboxMessageId_-BdyPvleS.js +1 -0
- package/assets/compose._-_outboxMessageId_-CCXfgPlt.js +1 -0
- package/assets/compose._-_outboxMessageId_-CHVV-SvJ.js +1 -0
- package/assets/{confirm-dialog-53Vs8qdX.js → confirm-dialog-B6lZSCEM.js} +1 -1
- package/assets/{download-D1wer2rZ.js → download-CSf0lEDY.js} +1 -1
- package/assets/{filters-CMw41CNL.js → filters-C69m9PhI.js} +1 -1
- package/assets/flagged-BQ7cNAQz.js +1 -0
- package/assets/{flagged-Cru9TjXl.js → flagged-Dei1zYcV.js} +1 -1
- package/assets/{folders-YVFNTyHN.js → folders-DVVTDsJd.js} +1 -1
- package/assets/{index-35SwEY68.js → index-BEyl0d8i.js} +57 -57
- package/assets/index-BP53GtG2.js +1 -0
- package/assets/{index-BdqDBo3X.js → index-CAiNnkB0.js} +13 -13
- package/assets/index-CY4bgXOY.js +1 -0
- package/assets/index-C_iKScVo.js +1 -0
- package/assets/index-D4bBzZTg.js +1 -0
- package/assets/index-DGKguLDU.js +1 -0
- package/assets/index-DbBAJiCH.js +1 -0
- package/assets/index-DnJEGG2N.js +1 -0
- package/assets/index-DzQ32fcu.js +1 -0
- package/assets/{kbd-DRG84K0I.js → kbd-uGbHAKde.js} +1 -1
- package/assets/{labels-9XIJbNPF.js → labels-DmLCvGYD.js} +1 -1
- package/assets/mail-C-TDrqf-.js +1 -0
- package/assets/{mail-Dt38b6by.js → mail-VetUziho.js} +1 -1
- package/assets/{menu-DhWodGKO.js → menu-BmGtg6yi.js} +1 -1
- package/assets/{move-options-DQMo_1sS.js → move-options-CPfUgc6V.js} +1 -1
- package/assets/{onboarding-DELVHzq-.js → onboarding-IKY1kzpt.js} +1 -1
- package/assets/outbox-n_yFwu3F.js +1 -0
- package/assets/{pencil-D_5c_wk2.js → pencil-DsJcl1vg.js} +1 -1
- package/assets/{rich-text-DP-h8BHT.js → rich-text-BUPj5pN8.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-GExspSVN.js → rich-text-spellcheck-worker-provider-CuE6qJCh.js} +1 -1
- package/assets/{rotate-ccw-DZMpRbI3.js → rotate-ccw-CuIPaHN2.js} +1 -1
- package/assets/{row-actions-D0SH67tM.js → row-actions-CX4I9NkX.js} +1 -1
- package/assets/{search-scope-D8eDCx--.js → search-scope-DwTzWX9q.js} +1 -1
- package/assets/{search-token-index-BUcol5TC.js → search-token-index-CQQGbw7m.js} +1 -1
- package/assets/search-view-BaOWm1XY.js +1 -0
- package/assets/{senders-TcrlfWI1.js → senders-Hq7mP6fW.js} +1 -1
- package/assets/settings-CWrTUDSR.js +1 -0
- package/assets/{settings-screen-DhSJUsiq.js → settings-screen-DNu8idS1.js} +1 -1
- package/assets/{shield-check-CCXTGJKT.js → shield-check-sn-UZZVv.js} +1 -1
- package/assets/{suggested-vips-t25EFcuR.js → suggested-vips-D8wBl0qr.js} +1 -1
- package/assets/{useDebouncedValue-BWx5HMb8.js → useDebouncedValue-D0CZV2a8.js} +1 -1
- package/assets/{useFilters-CWfk6Iq3.js → useFilters-3cmqs9Eg.js} +1 -1
- package/assets/{useLabels-BngSwTS5.js → useLabels-DouRODjU.js} +1 -1
- package/assets/{useMediaQuery-DXxjKaoU.js → useMediaQuery-Cjj26W9X.js} +1 -1
- package/assets/useMessageBodyContent-DN1BB_sF.js +1 -0
- package/assets/{useRefreshControl-Rijlvzuj.js → useRefreshControl-81MoE9n0.js} +1 -1
- package/assets/useSearchMirror-C59IlnkH.js +1 -0
- package/assets/{useSearchTokenContext-Cbnmmy2v.js → useSearchTokenContext-ClnpCWt9.js} +1 -1
- package/assets/{useSemanticSearch-_Eo5DA7X.js → useSemanticSearch-DYkRo4Qk.js} +1 -1
- package/assets/{useSignature-Bm--1yAp.js → useSignature-DAKxkpyQ.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/BriefPane-YxP0nBcU.js +0 -1
- package/assets/FlaggedPane-C9Tl8Sgb.js +0 -1
- package/assets/FullCompose-CPdM2XxU.js +0 -1
- package/assets/MailListHeader-Trtc8lfx.js +0 -7
- package/assets/MailboxPane-DUPDvxrK.js +0 -1
- package/assets/OutboxPane-ZalnkqRY.js +0 -1
- package/assets/_mailboxId-DXY2DcuZ.js +0 -1
- package/assets/_messageId-ByR6_bo3.js +0 -1
- package/assets/_messageId-DJaF3SkN.js +0 -1
- package/assets/_messageId-YRdjdIfb.js +0 -1
- package/assets/_outboxMessageId-CkQCgzpt.js +0 -1
- package/assets/_threadId-Bd2uE3xH.js +0 -1
- package/assets/_threadId-BpRvUgZ7.js +0 -1
- package/assets/_threadId-CPMLmOLx.js +0 -1
- package/assets/brief-citXjdnu.js +0 -1
- package/assets/compose-CqHqZWHD.js +0 -1
- package/assets/compose._-_outboxMessageId_-ByFahrZS.js +0 -1
- package/assets/compose._-_outboxMessageId_-C2HJn-2W.js +0 -1
- package/assets/compose._-_outboxMessageId_-CxA7rvH-.js +0 -1
- package/assets/compose._-_outboxMessageId_-oxU0Mfa7.js +0 -1
- package/assets/flagged-CY2Fx9HR.js +0 -1
- package/assets/index-B-qT49RY.js +0 -1
- package/assets/index-B3RVTIK6.js +0 -1
- package/assets/index-ByR6_bo3.js +0 -1
- package/assets/index-C7e45zc3.js +0 -1
- package/assets/index-DIOW99Bl.js +0 -1
- package/assets/index-DJaF3SkN.js +0 -1
- package/assets/index-Hzw2sya0.js +0 -1
- package/assets/index-VU4NiHyS.js +0 -1
- package/assets/mail-C6L5FwL2.js +0 -1
- package/assets/outbox-DH9yQHIF.js +0 -1
- package/assets/search-view-gS47hGhs.js +0 -1
- package/assets/settings-Esp4eIvp.js +0 -1
- package/assets/useMessageBodyContent-BZp02vgj.js +0 -1
- package/assets/useSearchMirror-DcLrKu1Z.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bO as M,bP as O,bQ as T,w as f,r as i,bR as P,m as h,j as W,bS as Y,bT as H,W as z,k as J,n as Z,s as ee,bU as te,bV as se}from"./index-BEyl0d8i.js";import{u as re}from"./useMediaQuery-Cjj26W9X.js";function ne(e){const t=M({warn:e?.router===void 0}),s=e?.router||t;return O(s.stores.__store,T(e,s))}function oe(e){const t=M();return O(t.stores.location,T(e,t))}const S="/mail/brief",A="/mail/$mailboxId",v="/mail/outbox",L="/mail/flagged";function _(e){for(const t of e){if(t.routeId===S)return{list:"brief"};if(t.routeId===L)return{list:"flagged"};if(t.routeId===v)return{list:"outbox"};if(t.routeId===A)return{list:"mailbox",mailboxId:t.params?.mailboxId}}}function Oe(e){const t=_(e);if(!t)return"";switch(t.list){case"mailbox":return t.mailboxId?ae(t.mailboxId):"";case"flagged":return L;case"outbox":return v;case"brief":return S}}function ae(e){return`${A}:${e}`}function Te(e,t){return e===t?!0:e.startsWith(`${t}/`)}function Pe(e){const t=e.split(/[?#]/)[0].split("/").filter(Boolean);return t[0]==="mail"&&t.length>2}function b(){const e=ne({select:s=>_(s.matches)?.list}),t=f({from:"/mail/$mailboxId",shouldThrow:!1});return{list:e,mailboxId:t?.mailboxId}}const k=["intelligence","nav","shortcuts"],ie=["nav","shortcuts"],ue=e=>ie.includes(e),ce=P(k);function x(e){const t=new Set(e.split(",").map(s=>ce.safeParse(s)).filter(s=>s.success).map(s=>s.data));return k.filter(s=>t.has(s))}function w(e){return k.filter(t=>e.includes(t)).join(",")}function Se(){const e=oe({select:t=>w(x(t.hash))});return i.useMemo(()=>x(e),[e])}const le=(e,t)=>!ue(e)&&t;function de(e){return(t="")=>w(x(t).filter(s=>le(s,e)))}function g(){const e=re();return i.useMemo(()=>de(e),[e])}function Ae(){const e=h();return i.useCallback(t=>{e({search:!0,hash:w(t),replace:!0,hashScrollIntoView:!1})},[e])}const D="/mail/brief/compose/{-$outboxMessageId}",U="/mail/flagged/compose/{-$outboxMessageId}",B="/mail/outbox/compose/{-$outboxMessageId}",F="/mail/$mailboxId/compose/{-$outboxMessageId}";function N(){const e=f({from:D,shouldThrow:!1}),t=f({from:U,shouldThrow:!1}),s=f({from:B,shouldThrow:!1}),r=f({from:F,shouldThrow:!1});return e??t??s??r}function ve(){return N()!==void 0}function Le(){return N()?.outboxMessageId}function fe(e,t,s){return e==="flagged"?{to:U,params:{outboxMessageId:s}}:e==="outbox"?{to:B,params:{outboxMessageId:s}}:e==="mailbox"&&t?{to:F,params:{mailboxId:t,outboxMessageId:s}}:{to:D,params:{outboxMessageId:s}}}function C(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback((n,o)=>{e({...fe(s,r,n),search:a=>a,hash:o?.keepPanels?!0:t,replace:o?.replace??!1})},[e,t,s,r])}function _e(){const e=C();return i.useCallback(()=>e(void 0),[e])}function De(){const e=C();return i.useCallback(t=>e(t),[e])}function Ue(){const e=C();return i.useCallback(t=>e(t,{replace:!0,keepPanels:!0}),[e])}function Be(){const e=h(),t=g(),{list:s,mailboxId:r}=b();return i.useCallback(()=>{const n=a=>a,o=t;if(s==="flagged"){e({to:"/mail/flagged",search:n,hash:o});return}if(s==="outbox"){e({to:"/mail/outbox",search:n,hash:o});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId",params:{mailboxId:r},search:n,hash:o});return}e({to:"/mail/brief",search:n,hash:o})},[e,t,s,r])}const me=Y(H);function Fe({fragment:e,...t}){const s=g();return W.jsx(me,{...t,hash:e??s})}const he=["reply","reply-all","forward"],pe=P(he),K="/mail/brief/$threadId/$messageId/$mode/{-$outboxMessageId}",Q="/mail/flagged/$threadId/$messageId/$mode/{-$outboxMessageId}",X="/mail/$mailboxId/$threadId/$messageId/$mode/{-$outboxMessageId}";function q(){const e=f({from:K,shouldThrow:!1}),t=f({from:Q,shouldThrow:!1}),s=f({from:X,shouldThrow:!1});return e??t??s}function $(){const e=q();return i.useMemo(()=>{if(!e)return;const t=pe.safeParse(e.mode);return t.success?{kind:"reply",mode:t.data,threadId:e.threadId,sourceMessageId:e.messageId,outboxMessageId:e.outboxMessageId}:{kind:"unknown",segment:e.mode}},[e])}function Ne(){return $()?.kind==="reply"}function G(e,t,s,r){return e==="flagged"?{to:Q,params:{...s,outboxMessageId:r}}:e==="mailbox"&&t?{to:X,params:{...s,mailboxId:t,outboxMessageId:r}}:{to:K,params:{...s,outboxMessageId:r}}}function be(e,t){if(e?.kind==="reply"&&e.threadId===t.threadId&&e.sourceMessageId===t.messageId)return e.outboxMessageId}function Ke(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=$();return i.useCallback(o=>{e({...G(s,r,o,be(n,o)),search:a=>a,hash:t})},[e,t,s,r,n])}function Qe(){const e=h(),{list:t,mailboxId:s}=b(),r=$();return i.useCallback(n=>{r?.kind==="reply"&&e({...G(t,s,{threadId:r.threadId,messageId:r.sourceMessageId,mode:r.mode},n),search:o=>o,hash:!0,replace:!0})},[e,t,s,r])}function Xe(){const e=h(),t=g(),{list:s,mailboxId:r}=b(),n=q();return i.useCallback(()=>{if(!n)return;const o=c=>c,a=t,u={threadId:n.threadId,messageId:n.messageId};if(s==="flagged"){e({to:"/mail/flagged/$threadId/$messageId",params:u,search:o,hash:a});return}if(s==="mailbox"&&r){e({to:"/mail/$mailboxId/$threadId/$messageId",params:{...u,mailboxId:r},search:o,hash:a});return}e({to:"/mail/brief/$threadId/$messageId",params:u,search:o,hash:a})},[e,t,s,r,n])}const ge=e=>{const t=e.filter(n=>!n.isMultipart&&n.disposition!=="attachment"&&n.mediaType==="TEXT"&&n.contentUrl.length>0),s=t.find(n=>n.mediaSubtype.toUpperCase()==="HTML");if(s)return{kind:"html",contentUrl:s.contentUrl};const r=t.find(n=>n.mediaSubtype.toUpperCase()==="PLAIN");return r?{kind:"text",contentUrl:r.contentUrl}:null},R={all:["messages"],detail:e=>[...R.all,"detail",e],body:e=>[...R.detail(e),"body"]};class m extends Error{reason;status;retryAfterSeconds;constructor(t,s,r,n){super(s),this.name="BodyFetchError",this.reason=t,this.status=r,this.retryAfterSeconds=n}}const ye=e=>{const t=Number.parseInt(e??"",10);return!Number.isFinite(t)||t<=0?1:Math.min(t,30)},Ie=8,xe="x-remit-403-reason",Re=(e,t)=>{const s=t?.trim()??"";return e===401?"auth":e===403?s.length>0?"auth":"body-missing":e===404?"body-missing":"generic"},ke=(e,t)=>(t??"").toLowerCase().startsWith("text/html")?/<div\s+id=["']root["']/i.test(e):!1,we=(e,t)=>{const s=(t??"").toLowerCase();return!!(e==="text"&&s.startsWith("text/html"))},Ce=async(e,t,s=async()=>null)=>{const r={},n=await s();n&&(r.Authorization=`Bearer ${n}`);const o=await se(e,{headers:r});if(o.status===202)throw new m("not-ready","Message body is still syncing",202,ye(o.headers.get("Retry-After")));if(!o.ok){const c=o.headers.get(xe),y=Re(o.status,c);throw new m(y,`Failed to load message body (${o.status} ${o.statusText})`,o.status)}const a=o.headers.get("content-type");if(we(t,a))throw new m("content-type-mismatch",`Refusing to render message body — expected ${t}, got Content-Type ${a}`);const u=await o.text();if(ke(u,a))throw new m("spa-shell-leak","Refusing to render message body — response looks like the SPA shell (CloudFront 403/404 fallback leaked through to /content/*)");return u},$e=async(e,t)=>(t.isRetryAfterNotReady&&await e.refetchDescribeMessage(),e.fetchContent(t.contentUrl,t.kind)),qe=({messageId:e,bodyParts:t,enabled:s=!0})=>{const r=t?ge(t):null,n=z(),{getToken:o}=J(),a=i.useRef(null),u=Z(),c=i.useRef(!1),y=i.useRef(null),E=e&&r?`${e}:${r.contentUrl}`:null;y.current!==E&&(y.current=E,c.current=!1);const l=ee({queryKey:e?[...R.body(e),r?.contentUrl??null]:["messages","body","noop"],queryFn:()=>{if(!r)throw new Error("No renderable body part");if(!e)throw new Error("No messageId");const p=c.current;return c.current=!1,$e({fetchContent:(d,V)=>Ce(d,V,o),refetchDescribeMessage:()=>u.refetchQueries({queryKey:te({path:{messageId:e}})})},{contentUrl:r.contentUrl,kind:r.kind,isRetryAfterNotReady:p})},enabled:s&&!!e&&!!r,staleTime:300*1e3,gcTime:1800*1e3,retry:(p,d)=>d instanceof m&&d.reason==="not-ready"?p<Ie:p<1,retryDelay:(p,d)=>d instanceof m&&d.reason==="not-ready"?(c.current=!0,(d.retryAfterSeconds??1)*1e3):1e3,meta:{softError:!0}}),I=l.isLoading&&!!r;i.useEffect(()=>{I&&(a.current=performance.now())},[I]),i.useEffect(()=>{l.isSuccess&&a.current!==null&&(n.recordTiming("message.body.load",Math.round(performance.now()-a.current)),a.current=null)},[l.isSuccess,n]);const j=l.data&&r?{kind:r.kind,body:l.data}:void 0;return{picked:r,data:j,isLoading:I,isError:l.isError,error:l.error,refetch:l.refetch}};export{m as B,Fe as N,oe as a,Se as b,Ae as c,ne as d,ve as e,_ as f,Te as g,Le as h,ue as i,De as j,g as k,Pe as l,Oe as m,Ke as n,Ne as o,qe as p,Ue as q,Be as r,Qe as s,Xe as t,_e as u,Re as v,$ as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,J as Q,H,K as $,L as z}from"./index-
|
|
1
|
+
import{j as E,e as q,b as j,B as D,r as i,ax as R,n as C,l as K,W as A,J as Q,H,K as $,L as z}from"./index-BEyl0d8i.js";import{C as B}from"./circle-check-big-DPA5LcMX.js";import{R as G,c as P}from"./search-token-index-CQQGbw7m.js";function oe({state:e,onRefresh:t,label:s,errorMessage:a,hasUpdate:n,size:u="sm",className:c}){const o=e==="refreshing",f=e==="error",h=e==="success",g=f?E.jsx(q,{className:"size-4 text-danger"}):h?E.jsx(B,{className:"size-4 text-positive"}):E.jsx(G,{className:j("size-4",o&&"animate-spin")}),y=f?`${s} — failed: ${a??"try again"}`:o?`${s} — refreshing`:h?`${s} — up to date`:n?`${s} — new mail`:s;return E.jsxs("div",{className:"relative inline-flex",children:[E.jsx(D,{variant:"ghost",size:u,icon:g,onClick:t,disabled:o,"aria-label":y,"aria-busy":o||void 0,title:f?a:s,className:c}),e==="idle"&&n&&E.jsx("span",{"aria-hidden":"true",className:"absolute right-1 top-1 size-1.5 rounded-full bg-accent-2"})]})}const W=new Set(["discovering_mailboxes","syncing_inbox","syncing_others"]);function L(e){return!!e&&W.has(e)}const N=3e3,U=N*2,M={syncing:!1,resolved:!1,synced:0,total:0};function ie(e,t){const s=e.join(","),[a,n]=i.useState(!1),[u,c]=i.useState(!1);i.useEffect(()=>{n(!1),c(!1)},[s,t]),i.useEffect(()=>{if(!t)return;const r=setTimeout(()=>c(!0),U);return()=>clearTimeout(r)},[s,t]);const o=P({queries:e.map(r=>({...R({path:{accountId:r}}),enabled:t&&!a,refetchInterval:N,meta:{softError:!0}}))}),f=o.every(r=>r.isSuccess||r.isError),h=o.length===0||f||u;let g=!1,y=0,w=0;for(const r of o)if(L(r.data?.syncPhase)){g=!0;for(const l of r.data?.mailboxes??[])y+=l.messagesSynced,w+=l.messagesTotal}const S=t&&h&&!g;return i.useEffect(()=>{S&&n(!0)},[S]),!t||!h?M:{syncing:g,resolved:!0,synced:y,total:w}}const k=6e4,I=new Set(["sent","drafts","trash","archive"]),v=(e,t)=>{const s=new Map;for(const a of e){const n=t.get(a.mailboxId)?.role;n&&I.has(n)||s.set(a.mailboxId,a.messagesTotal)}return s},J=(e,t)=>{for(const[s,a]of t)if(a>(e.get(s)??0))return!0;return!1},_=i.createContext(null),X=()=>{const e=i.useContext(_);if(!e)throw new Error("useMailFreshness must be used inside <MailFreshnessProvider>");return e};function ce({accountIds:e,children:t}){const s=C(),{resultFolderIndex:a}=K(),n=i.useRef(new Map),u=i.useRef(new Set),[c,o]=i.useState(new Set),f=P({queries:e.map(r=>({...R({path:{accountId:r}}),refetchInterval:k,staleTime:k,meta:{softError:!0}}))}),h=f.map(r=>r.dataUpdatedAt).join(","),g=e.join(",");i.useEffect(()=>{let r=!1;const l=new Set(c);e.forEach((d,x)=>{const p=f[x]?.data;if(!p)return;const m=v(p.mailboxes??[],a);if(!u.current.has(d)){u.current.add(d),n.current.set(d,m);return}if(l.has(d))return;const T=n.current.get(d)??new Map;J(T,m)&&(l.add(d),r=!0)}),r&&o(l)},[g,h]);const y=i.useCallback(r=>r.some(l=>c.has(l)),[c]),w=i.useCallback(r=>{o(l=>{if(r.every(x=>!l.has(x)))return l;const d=new Set(l);for(const x of r)d.delete(x);return d});for(const l of r){const d=s.getQueryData(R({path:{accountId:l}}).queryKey);n.current.set(l,v(d?.mailboxes??[],a)),u.current.add(l)}},[s,a]),S=i.useMemo(()=>({hasNewMail:y,acknowledge:w}),[y,w]);return E.jsx(_.Provider,{value:S,children:t})}const V=2e3,Y=45e3,Z=e=>new Promise(t=>setTimeout(t,e)),b=e=>e instanceof Error&&e.message?e.message:"Something went wrong",ee=e=>{$(e,{softError:!0})&&z(e)},F=e=>e.reduce((t,s)=>Math.max(t,s.lastSyncedAt??0),0),O=(e,t)=>e.fetchQuery({...R({path:{accountId:t}}),staleTime:0}),se=async(e,t,s,a)=>{let n=!1;for(;;){const u=await O(e,t).then(f=>({ok:!0,data:f})).catch(f=>({ok:!1,error:f}));if(!u.ok)return{accountId:t,message:b(u.error)};const{syncPhase:c,mailboxes:o}=u.data;if(L(c))n=!0;else if(n||F(o??[])>s)return c==="error"?{accountId:t,message:"Sync failed for this account"}:void 0;if(Date.now()>=a)return{accountId:t,message:"Refresh is taking longer than usual"};await Z(V)}},te=async(e,t,s,a)=>{const n=await O(e,s).then(o=>({ok:!0,maxLastSynced:F(o.mailboxes??[])})).catch(o=>({ok:!1,error:o}));if(!n.ok)return{accountId:s,enqueued:!1,ok:!1,message:b(n.error)};const u=await H({path:{accountId:s},throwOnError:!0}).then(()=>({ok:!0})).catch(o=>({ok:!1,error:o}));if(!u.ok)return ee(u.error),{accountId:s,enqueued:!1,ok:!1,message:b(u.error)};t.recordEvent("sync.triggered");const c=await se(e,s,n.maxLastSynced,a);return c?{accountId:s,enqueued:!0,ok:!1,message:c.message}:{accountId:s,enqueued:!0,ok:!0}},ue=(e,t={})=>{const s=C(),a=A(),{acknowledge:n}=X(),[u,c]=i.useState("idle"),[o,f]=i.useState(),h=i.useRef(0),g=i.useRef(e);g.current=e;const y=i.useRef(t);y.current=t,i.useEffect(()=>{if(u!=="success")return;const S=setTimeout(()=>c("idle"),2e3);return()=>clearTimeout(S)},[u]);const w=i.useCallback(()=>{const S=g.current;if(S.length===0){c("error"),f("Nothing to refresh yet");return}const r=++h.current;c("refreshing"),f(void 0),(async()=>{const l=Date.now()+Y,d=await Promise.all(S.map(m=>te(s,a,m,l)));if(h.current!==r)return;const x=d.filter(m=>m.enqueued).map(m=>m.accountId);for(const m of x)s.invalidateQueries({queryKey:Q({path:{accountId:m}})});x.length>0&&(y.current.onSettled?.(),n(x));const p=d.filter(m=>!m.ok);p.length===0?c("success"):(c("error"),f(p[0]?.message))})()},[n,s,a]);return{state:u,errorMessage:o,refresh:w}};export{ce as M,oe as R,ue as a,ie as b,L as i,X as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as d,l as v,P as x,r as h}from"./index-BEyl0d8i.js";import{d as Q,e as I}from"./useMessageBodyContent-DN1BB_sF.js";import{b}from"./search-view-BaOWm1XY.js";function R(o){const s=d(),{searchInput:c,searchQuery:e}=v(),{q:n=""}=x({from:"/mail"}),i=Q({select:p=>p.location.pathname}),m=I(),a=h.useRef(n);a.current=n;const{to:r}=o,t="params"in o?o.params.mailboxId:void 0,l=t?`/mail/${t}`:r;h.useEffect(()=>{if(!b({searchInput:c,committedQuery:e,urlQuery:a.current,pathname:i,listPath:l}))return;const f=!!e&&a.current!==e&&!m,u=y=>({...y,q:e||void 0});if(!f){s({to:".",search:u,hash:!0,replace:!0});return}if(r==="/mail/$mailboxId"){if(!t)return;s({to:r,params:{mailboxId:t},search:u,hash:!0,replace:!0});return}s({to:r,search:u,hash:!0,replace:!0})},[c,e,s,r,t,l,i,m])}export{R as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bZ as V,r as g,j as a,b,I as Q,n as Y,a5 as q,a7 as X,a8 as Z,bU as J,b5 as ee,k as te,e as se,X as re,l as ne}from"./index-
|
|
1
|
+
import{bZ as V,r as g,j as a,b,I as Q,n as Y,a5 as q,a7 as X,a8 as Z,bU as J,b5 as ee,k as te,e as se,X as re,l as ne}from"./index-BEyl0d8i.js";import{K as k}from"./kbd-uGbHAKde.js";import{B as ae,p as oe,d as ie}from"./useMessageBodyContent-DN1BB_sF.js";import{M as L}from"./enums-CCxx0t2v.js";import{i as ce}from"./search-scope-DwTzWX9q.js";const le=(e,t)=>{const r=e==="newsletter"||e==="marketing"||t;return{framed:r,isPlain:!r}},de=()=>`
|
|
2
2
|
/* Zero the UA default body margin and clamp the document to the iframe width so
|
|
3
3
|
wide author markup can't push the body (and the page) past the viewport. */
|
|
4
4
|
html, body {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as L,a5 as C,a7 as I,bn as k,bo as E,r as x,j as d,bp as h,bq as A,br as j,l as R,s as Q,bs as D}from"./index-
|
|
1
|
+
import{n as L,a5 as C,a7 as I,bn as k,bo as E,r as x,j as d,bp as h,bq as A,br as j,l as R,s as Q,bs as D}from"./index-BEyl0d8i.js";import{P as O}from"./attachment-file-B6idyO8B.js";import{ag as P,ah as _,ai as q,aj as z}from"./MailListHeader-BXdL6PZE.js";import{a as N}from"./useLabels-DouRODjU.js";import{M as U}from"./enums-CCxx0t2v.js";import{d as w}from"./useMessageBodyContent-DN1BB_sF.js";import{n as B}from"./search-query-Cr_ZXBCp.js";import{s as F}from"./search-scope-DwTzWX9q.js";import{u as G,p as K}from"./useSearchTokenContext-ClnpCWt9.js";const V=t=>{const{mailboxId:a,messages:i}=t,l=L(),{pushError:c}=C(),{mutateAsync:n,isPending:s}=I({...E(),onError:(o,u)=>{c({title:u.body.action==="Remove"?"Couldn't remove label":"Couldn't apply label",detail:k(o),error:o})},onSettled:(o,u,m)=>{P(l,_(q(m.body.messageIds??[],i??[],a)))}});return{applyLabel:x.useCallback((o,u,m)=>{o.length!==0&&z(o,p=>n({body:{messageIds:p,labelId:u,action:m}}))},[n]),isPending:s}};function ne({accountId:t,mailboxId:a,messageIds:i}){const{labels:l}=N(t),{applyLabel:c}=V({mailboxId:a}),n=x.useMemo(()=>l.map(s=>({key:s.labelId,label:s.name,icon:d.jsx("span",{className:`size-2.5 rounded-full ${A(s.color)?h[s.color]:h.Default}`}),onSelect:()=>c(i,s.labelId,"Apply")})),[l,i,c]);return n.length===0?null:d.jsx(O,{triggerLabel:"Apply label to selected messages",triggerIcon:d.jsx(j,{className:"size-4 text-fg-subtle"}),triggerText:"Apply label",items:n,align:"start",nested:!0,touch:!1,triggerClassName:"min-h-11 w-full justify-start gap-3 px-4 py-2.5 text-sm font-normal text-fg"})}const $=20,H=new Set(Object.values(U)),J=t=>t!==void 0&&H.has(t)?t:void 0,W=t=>{if(t.some(a=>a.type==="isUnread"))return!1;if(t.some(a=>a.type==="isRead"))return!0};function ie({mailboxId:t,filterCategory:a}={}){const{searchQuery:i}=R(),l=G(),c=w({select:e=>e.matches}),n=B(i),{freeText:s,tokens:r}=K(n,l),o=s.length>0,u=r.find(e=>e.type==="category"),m=J(a)??u?.category,p=r.some(e=>e.type==="hasAttachment")?!0:void 0,b=r.some(e=>e.type==="isStarred")?!0:void 0,y=W(r),f=r.find(e=>e.type==="after"),g=r.find(e=>e.type==="before"),S=r.find(e=>e.type==="in"),M=F({matches:c,callerMailboxId:t,inTokenMailboxId:S?.mailboxId}),{data:T,isLoading:v}=Q({...D({query:{query:s,mailboxId:M,limit:$,...m!==void 0?{category:m}:{},...p!==void 0?{hasAttachment:p}:{},...b!==void 0?{hasStars:b}:{},...y!==void 0?{isRead:y}:{},...f?{sentDateFrom:f.epochSeconds}:{},...g?{sentDateTo:g.epochSeconds}:{}}}),enabled:o,staleTime:6e4});return{hits:T?.items??[],isLoading:o&&v}}export{ne as L,ie as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-
|
|
1
|
+
import{n as g,a5 as p,s as f,Q as m,r,a7 as y,a8 as T,V as E,a9 as x}from"./index-BEyl0d8i.js";const i={html:"",plainText:""},d=e=>{const u=g(),{pushError:o}=p(),{data:n}=f({...m(),staleTime:1/0}),l=r.useMemo(()=>{if(!e||!n)return i;const t=n.accounts.find(a=>a.accountId===e);return t?{html:t.signatureHtml??"",plainText:t.signaturePlainText??""}:i},[e,n]),s=y({...x(),onSuccess:()=>{u.invalidateQueries({queryKey:E()})},onError:t=>{o(T("Couldn't save signature","The signature wasn't saved.",t))}}),c=r.useCallback((t,a)=>{e&&s.mutate({path:{accountId:e},body:{signatureHtml:t,signaturePlainText:a}})},[e,s]);return{signature:l,setSignature:c,isSaving:s.isPending}};export{d as u};
|
package/index.html
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
} catch (_) {}
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="/assets/index-
|
|
41
|
+
<script type="module" crossorigin src="/assets/index-BEyl0d8i.js"></script>
|
|
42
42
|
<link rel="stylesheet" crossorigin href="/assets/index-Bn4mOVkF.css">
|
|
43
43
|
</head>
|
|
44
44
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a,af as Ze,S as Xe,bh as es,l as O,bb as ss,m as ae,r as n,s as se,bi as te,q as ts,bj as as,bk as os,bl as ns,e as Re,bm as rs,i as is}from"./index-35SwEY68.js";import{s as Te,a as ls,b as we,u as cs,p as ds,R as us}from"./useSearchTokenContext-Cbnmmy2v.js";import{a2 as ve,D as ye,a3 as ms,a4 as fs,E as hs,a5 as Se,a6 as gs,a7 as xs,a8 as ps,a1 as Is,a9 as bs,aa as vs,ab as ys,M as Ss,ac as Cs,ad as js,ae as Rs,e as Ts,v as ws,af as Ms,r as ks,S as As,H as Ns,L as Ce,K as Fs,I as Bs,d as Os,W as Ls,X as Me,Y as Es,Z as ke,_ as qs}from"./MailListHeader-Trtc8lfx.js";import{u as Ds,a as Ps,R as zs,i as _s,b as Hs}from"./useRefreshControl-Rijlvzuj.js";import{e as Qs,c as $s,R as Ws}from"./search-token-index-BUcol5TC.js";import{a as Us}from"./useLabels-BngSwTS5.js";import{u as Vs}from"./useMediaQuery-DXxjKaoU.js";import{u as Ys,L as Gs}from"./useSemanticSearch-_Eo5DA7X.js";import{f as Js}from"./useMessageBodyContent-BZp02vgj.js";function Ks({sync:e}){return e?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",role:"status","aria-live":"polite",children:[a.jsx(Ze,{className:"size-8 animate-spin text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"Still syncing your mail"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:Zs(e)})]}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center px-4",children:[a.jsx(Xe,{className:"size-8 text-fg-subtle","aria-hidden":"true"}),a.jsx("p",{className:"text-sm font-medium text-fg",children:"You're caught up"}),a.jsx("p",{className:"text-xs text-fg-subtle",children:"Nothing needs attention."})]})}function Zs({synced:e,total:s}){return s>0?`${e.toLocaleString()} of ${s.toLocaleString()} messages downloaded. This list fills in as they arrive.`:"Downloading your messages. This list fills in as they arrive."}const Ae=[{id:"unread",name:"is",value:"unread"},{id:"attachment",name:"has",value:"attachment"}],Ne="category",Xs={unclassified:"uncategorized"},z=e=>ls(e).map(s=>s.raw),P=e=>e.join(" "),oe=e=>{const s=we(e);if(s)return Ae.find(o=>o.name===s.name&&o.value===s.value.toLowerCase())?.id},ne=e=>{const s=we(e);if(!s||s.name!==Ne)return;const o=s.value.toLowerCase(),r=Xs[o];if(r)return r;if(!(!es(o)||o==="all"))return o},Fe=e=>Ae.find(s=>s.id===e),Be=e=>Fe(e)!==void 0,et=e=>{const s=new Set;for(const o of z(e)){const r=oe(o);r&&s.add(r)}return s},st=e=>{let s="all";for(const o of z(e)){const r=ne(o);r&&(s=r)}return s},tt=(e,s)=>{const o=Fe(s);if(!o)return;const r=z(e),d=r.filter(i=>oe(i)!==s);return d.length<r.length?P(d):P([...r,Te(o.name,o.value)])},at=(e,s)=>{const o=z(e).filter(r=>!ne(r));return P(s==="all"?o:[...o,Te(Ne,s)])},ot=e=>P(z(e).filter(s=>!oe(s)&&!ne(s))),Oe=e=>e.trim().length>0,nt=e=>{if(!Oe(e.query))return e.ownFilters;const s=new Set(et(e.query));for(const o of e.ownFilters)Be(o)||s.add(o);return s},rt=e=>Oe(e.query)?st(e.query):e.ownCategory,it=(e,s)=>e.createdAt!==s.createdAt?e.createdAt-s.createdAt:e.accountId.localeCompare(s.accountId),lt=e=>[...e].sort(it),ct=200,je=()=>a.jsx("div",{className:"animate-pulse",children:Array.from({length:3}).map((e,s)=>a.jsxs("div",{className:"flex items-start gap-3 py-2 pl-5 pr-4 border-b border-line",children:[a.jsx("div",{className:"size-7 rounded-full bg-surface-sunken shrink-0 mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-28"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-12"})]}),a.jsx("div",{className:"h-3.5 bg-surface-sunken rounded w-48"}),a.jsx("div",{className:"h-3 bg-surface-sunken rounded w-full"})]})]},s))}),dt=({accountEmail:e})=>{const s=ae();return a.jsxs("div",{className:"flex items-center gap-2 px-row-inset py-2 border-b border-line bg-danger-soft/40 text-xs text-danger",children:[a.jsx(Re,{className:"size-3.5 shrink-0"}),a.jsxs("span",{className:"flex-1 truncate",children:[e," can't connect"]}),a.jsx("button",{type:"button",onClick:()=>s({to:"/settings/accounts"}),className:"shrink-0 underline text-danger hover:opacity-80",children:"Reconnect"})]})},ut=(e,s)=>{if(s.size===0)return{};const o=new Set,r=new Set;for(const i of e)s.has(i.id)&&(i.accountId&&o.add(i.accountId),i.mailboxId&&r.add(i.mailboxId));if(o.size>1)return{restriction:"spansAccounts",moveDisabledHint:"Move only works within one account — clear selection or pick messages from a single account"};const d=o.size===1?[...o][0]:void 0;return r.size>1?{accountId:d,restriction:"spansFolders",moveDisabledHint:`Move only works within one folder — this selection spans ${r.size} folders`}:{accountId:d,mailboxId:r.size===1?[...r][0]:void 0}};function mt({header:e,rows:s,wizard:o,children:r}){const{selectedIds:d,selectedCount:i,exitSelection:x,orderedIds:f,allSelected:u,toggleAllLoaded:y}=Rs(),p=n.useMemo(()=>ut(s,d),[s,d]),{junkMailboxId:I}=Ts(p.accountId),{labels:S}=Us(p.accountId),N=n.useMemo(()=>Array.from(d),[d]),L=n.useMemo(()=>s.filter(h=>d.has(h.id)).map(h=>({id:h.id,sender:h.fromName,email:h.fromEmail,subject:h.subject,date:h.timeLabel})),[s,d]),m=ws(I,p.mailboxId),b=n.useMemo(()=>f.length>0?{checked:u,indeterminate:i>0&&!u,onChange:y}:void 0,[f.length,u,i,y]),j=p.moveDisabledHint?{tone:"warning",text:p.moveDisabledHint}:void 0,C=h=>a.jsx(As,{title:h.title,navSlot:h.navSlot,titleMeta:h.titleMeta,searchSlot:h.searchSlot,searchField:h.searchField,idleSlot:h.makeFilterSlot,count:i,onCancel:x,onDelete:()=>o.start("delete"),onMove:()=>o.start("move"),onOrganize:()=>o.start("organize"),onJunk:m?()=>o.start("junk"):void 0,onMarkRead:()=>o.start("markRead"),overflowSlot:p.accountId&&p.mailboxId&&i>0&&S.length>0?a.jsx(Gs,{accountId:p.accountId,mailboxId:p.mailboxId,messageIds:N}):void 0,selectAll:b,notice:j});return a.jsx(Ms,{...e,selectionBar:C,paneOverlay:a.jsx(ks,{verb:o.verb,accountId:p.accountId,mailboxId:p.mailboxId,selection:L,selectionRestriction:p.restriction,onFinished:x}),children:r})}function ft({accounts:e,selectedMessageId:s,onOpenThread:o,commandsRef:r,onTriageContextChange:d,onDeleteMessages:i}){const{searchQuery:x,searchInput:f,resultFolderIndex:u,onSearchChange:y}=O(),p=cs(),I=Vs(),S=Qs(),N=ss(),L=ae(),m=n.useMemo(()=>lt(e.filter(t=>!t.muted?.value)),[e]),[b,j]=n.useState("all"),[C,h]=n.useState("all"),[_,E]=n.useState(new Set),[Y,B]=n.useState(!1),q=n.useCallback(t=>{E(l=>{const c=new Set(l);return c.has(t)?c.delete(t):c.add(t),c})},[]),H=n.useCallback(()=>E(new Set),[]),R=f.trim().length>0,T=n.useMemo(()=>nt({query:f,ownFilters:_}),[f,_]),w=n.useMemo(()=>rt({query:f,ownCategory:C}),[f,C]),g=n.useCallback(t=>{if(!R||!Be(t)){q(t);return}const l=tt(f,t);l!==void 0&&y(l)},[R,f,y,q]),M=n.useCallback(t=>{if(!R){h(t);return}y(at(f,t))},[R,f,y]),F=n.useCallback(()=>{h("all"),j("all"),H(),R&&y(ot(f))},[R,f,y,H]),{data:Q,isLoading:G,isError:re,refetch:ie}=se({...te(),staleTime:6e4}),$=$s({queries:m.map(t=>({...ts({path:{accountId:t.accountId}}),staleTime:1/0,meta:{softError:!0}}))}),W=n.useMemo(()=>{const t=new Map;for(let l=0;l<m.length;l++){const c=m[l].accountId,Ge=($[l]?.data?.items??[]).reduce((Je,Ke)=>Je+(Ke.unseenCount??0),0);t.set(c,Ge)}return t},[m,$]),qe=n.useMemo(()=>m.filter((t,l)=>{const c=$[l];return c?.isError?!as(c.error):!1}),[m,$]),{freeText:k,tokens:J}=ds(x.trim().toLowerCase(),p),{data:le,isFetching:De}=se({...te({query:{query:k,limit:ct}}),enabled:k.length>0,staleTime:3e4}),v=n.useMemo(()=>{const t=ve(Q?.items??[]).map(ye);return(k?ms(t.filter(c=>fs(c,k)),ve(le?.items??[]).map(ye)):t).filter(c=>(b==="all"||c.accountId===b)&&hs(c,J))},[Q,le,b,k,J]),{bodyRows:ce,briefSpamOffer:K}=n.useMemo(()=>{if(!k)return{bodyRows:v,briefSpamOffer:void 0};const t=v.map(A=>Se(A,u)),{spam:l}=gs(t);if(l.length===0)return{bodyRows:v,briefSpamOffer:void 0};const c=new Set(l.map(A=>A.id));return{bodyRows:v.filter(A=>!c.has(A.id)),briefSpamOffer:xs(t)}},[v,k,u]),de=n.useMemo(()=>ps(ce),[ce]),ue=n.useCallback((t,l)=>{const c=v.find(A=>A.id===t)?.threadId;c&&o?.({threadId:c,messageId:t},l)},[v,o]),Pe=n.useCallback(t=>{const l=t.threadId??v.find(c=>c.id===t.id)?.threadId;l&&o?.({threadId:l,messageId:t.id})},[v,o]),Z=n.useMemo(()=>m.length<=1?[]:[{id:"all",label:"All",active:b==="all"},...m.map(t=>({id:t.accountId,label:t.email.split("@")[0]??t.email,count:W.get(t.accountId),active:b===t.accountId}))],[m,W,b]),D=n.useMemo(()=>e.filter(t=>t.muted?.value).length,[e]),ze=n.useMemo(()=>Array.from(W.values()).reduce((t,l)=>t+l,0),[W]),X=n.useMemo(()=>m.map(t=>t.accountId),[m]),{hasNewMail:me}=Ds(),{state:fe,errorMessage:he,refresh:ge}=Ps(X,{onSettled:()=>ie()}),_e=n.useMemo(()=>a.jsx(zs,{state:fe,onRefresh:ge,label:"Refresh daily brief",errorMessage:he,hasUpdate:me(X)}),[fe,ge,he,me,X]),ee=n.useMemo(()=>v.filter(t=>(w==="all"||t.category===w)&&os(t,T)).map(t=>Se(t,u)),[v,w,T,u]),{hits:xe,isLoading:He}=Ys(),Qe=n.useMemo(()=>{const t=new Map;for(const c of Q?.items??[])t.set(c.messageId,c.threadId);const l=ee.map(c=>t.get(c.id)).filter(c=>c!=null);return Is(xe,l,u)},[xe,ee,Q,u]),$e=n.useMemo(()=>{const t=bs(Z.map(l=>({id:l.id,label:l.label,count:l.count,active:l.active})));return{categories:t.categories,filters:t.filters,sources:t.sources,sourcesNote:D>0?`+${D} muted`:void 0,selectedCategory:w,activeFilters:T,expanded:Y,onExpandedChange:B,onSelectCategory:l=>M(l),onSelectSource:j,onToggleFilter:l=>g(l),onClear:F}},[Z,D,w,T,Y,g,M,F]),pe=de.length===0&&b==="all"&&k.length===0&&J.length===0,We=n.useMemo(()=>m.map(t=>t.accountId),[m]),Ue=n.useMemo(()=>m.some(t=>_s(t.syncPhase)),[m]),U=Hs(We,pe||Ue),Ie=a.jsxs("div",{className:"h-full overflow-y-auto",children:[a.jsx(je,{}),a.jsx(je,{})]}),be=!G&&!re&&!pe,Ve=vs({tier:S,hasLiveInput:R,hasCommittedQuery:x.trim().length>0,bodyRendersCommittedResults:!0}),Ye=be?a.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[K&&a.jsx(ys,{count:K.count,onScopeToSpam:()=>L({to:"/mail/$mailboxId",params:{mailboxId:K.mailboxId},search:{q:x||void 0}})}),a.jsx("div",{className:"min-h-0 flex-1",children:a.jsx(ns,{sections:de,briefCategory:w,Row:Ss,selectedThreadId:s,onSelectThread:ue,onSelectBriefCategory:M,sources:Z,sourcesNote:D>0?`+${D} muted`:void 0,onSelectSource:j,activeFilters:T,onToggleFilter:g,onClearFilters:F})})]}):G?Ie:re?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 py-12 text-sm text-fg-muted",children:[a.jsx(Re,{className:"size-8 text-danger"}),a.jsx("p",{children:"Couldn't load your messages"}),a.jsxs("button",{type:"button",onClick:()=>ie(),className:"flex items-center gap-1 text-accent underline text-xs",children:[a.jsx(Ws,{className:"size-3.5"}),"Try again"]})]}):U.resolved?a.jsx(Ks,{sync:U.syncing?{synced:U.synced,total:U.total}:void 0}):Ie;return a.jsx(rs,{hasSheet:be&&!Ve,children:a.jsx(Cs,{selectedMessageId:s,onOpen:ue,onDeleteMessages:i,onSelectionVerb:N.start,wizardOpen:N.isOpen,commandsRef:r,onTriageContextChange:d,children:a.jsx(mt,{wizard:N,header:{title:"Daily brief",unreadCount:ze,footer:I?a.jsx(js,{}):void 0,searchFilter:$e,searchResults:ee,searchLoading:G||De,relatedResults:Qe,relatedLoading:He,onSelectSearchResult:Pe,searchResultsInBody:!0,refreshControl:_e},rows:v,children:a.jsxs("div",{className:"flex h-full flex-col",children:[qe.map(t=>a.jsx(dt,{accountEmail:t.email,accountId:t.accountId},t.accountId)),a.jsx("div",{className:"min-h-0 flex-1",children:Ye})]})})})})}const Le=n.createContext(null);function V(){const e=n.useContext(Le);if(!e)throw new Error("BriefPane.* must be used inside <BriefPane>");return e}function ht({thread:e,children:s}){const o=ae(),r=Js(),{searchInput:d}=O(),i=e?.threadId,x=e?.messageId,{data:f}=se({...te(),staleTime:6e4}),u=n.useMemo(()=>f?.items??[],[f]),y=n.useMemo(()=>{if(i)return u.find(g=>g.messageId===x)??u.find(g=>g.threadId===i)},[u,i,x]),p=Ns(i,x),I=y??p,S=x??I?.messageId,N=n.useMemo(()=>{if(i)return{threadId:i,mailboxId:I?.mailboxId??"",subject:I?.subject,messageId:S,authenticity:I?.authenticity}},[i,I,S]),L=n.useCallback((g,M)=>{o({to:"/mail/brief/$threadId/$messageId",params:g,replace:M?.replace,search:F=>({...F,q:d||void 0}),hash:r})},[o,r,d]),m=n.useCallback(()=>{o({to:"/mail/brief",search:g=>g,hash:r})},[o,r]),b=n.useCallback(g=>{S&&g.includes(S)&&m()},[S,m]),j=Ce({thread:I,onAfterOptimisticRemove:b}),C=Fs(),{deleteMessages:h}=Bs({mailboxId:I?.mailboxId??"",messages:u,onAfterOptimisticRemove:b}),{toggleReadFor:_}=Os({mailboxId:I?.mailboxId??"",messages:u}),E=C.focusedMessageId,B=n.useMemo(()=>u.find(g=>g.messageId===E),[u,E])??I,q=Ce({thread:B}),{nextMessageId:H,previousMessageId:R}=Ls({context:C,orderedIds:C.orderedIds,selectedMessageId:S,onClose:m,handlers:{reply:()=>j.requestCompose("reply"),replyAll:()=>j.requestCompose("reply_all"),forward:()=>j.requestCompose("forward"),delete:()=>{C.listCommandsRef.current?.requestVerb("delete")||q.deleteThread()},toggleStar:q.toggleStar,toggleRead:()=>{C.listCommandsRef.current?.requestVerb("markRead")||B&&_([B.messageId],!B.isRead)},goFlagged:()=>o({to:"/mail/flagged"}),goSettings:()=>o({to:"/settings"})}}),T=n.useCallback(g=>{if(!g)return;const M=u.find(F=>F.messageId===g);return M?{threadId:M.threadId,messageId:g}:void 0},[u]),w={selectedMessageId:S,selectedThread:I,conversation:N,onOpenThread:L,onCloseThread:m,nextThread:T(H),previousThread:T(R),actions:j,triage:C,onDeleteMessages:h,handleDeselectIfRemoved:b};return a.jsx(Le.Provider,{value:w,children:s})}function Ee(){const{selectedMessageId:e,onOpenThread:s,triage:o,onDeleteMessages:r}=V(),{accounts:d}=O();return a.jsx(ft,{accounts:d,selectedMessageId:e,onOpenThread:s,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:r})}function gt(){const{conversation:e,actions:s}=V(),{intelligenceOpen:o,onToggleIntelligence:r}=O(),d=is()?.showIntelligencePane??!1,i=!!e,x=d&&i;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(qs,{hasThread:i,intelligenceOpen:x&&o,canToggleIntelligence:x,onToggleIntelligence:r,onReply:i?()=>s.requestCompose("reply"):void 0,onReplyAll:i?()=>s.requestCompose("reply_all"):void 0,onForward:i?()=>s.requestCompose("forward"):void 0,onDelete:i?s.deleteThread:void 0,onToggleStar:i?s.toggleStar:void 0,isStarred:s.isStarred,moveContext:i&&s.accountId&&s.mailboxId?{accountId:s.accountId,currentMailboxId:s.mailboxId,onMove:s.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(Me,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:s.composeRequest,onComposeClose:s.clearComposeRequest}):a.jsx(us,{})})]})}function xt(){const{selectedThread:e,handleDeselectIfRemoved:s}=V(),{onToggleIntelligence:o}=O();return a.jsx(ke,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:s})}function pt(){const{selectedThread:e,conversation:s,onOpenThread:o,onCloseThread:r,nextThread:d,previousThread:i,handleDeselectIfRemoved:x}=V(),{intelligenceOpen:f,onToggleIntelligence:u}=O();return s?a.jsxs(a.Fragment,{children:[a.jsx(Me,{threadId:s.threadId,mailboxId:s.mailboxId,subject:s.subject,selectedMessageId:s.messageId,authenticity:s.authenticity,onBack:r,onOpenIntelligence:u,onSwipeNext:d?()=>o(d):void 0,onSwipePrevious:i?()=>o(i):void 0,mobileIntelligenceOpen:f}),a.jsx(Es,{isOpen:f,onClose:u,ariaLabel:"Message details",side:"right",children:a.jsx(ke,{onClose:u,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:x})})]}):a.jsx("div",{className:"h-full",children:a.jsx(Ee,{})})}const wt=Object.assign(ht,{List:Ee,Reading:gt,Intelligence:xt,Phone:pt});export{wt as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d4 as X,r as n,cp as Y,l as P,bb as Z,aF as J,aG as ee,j as a,m as te,i as se}from"./index-35SwEY68.js";import{u as ae,p as oe,R as re}from"./useSearchTokenContext-Cbnmmy2v.js";import{D as ne,a4 as ie,E as de,aq as le,a5 as ce,b as ue,M as ge,ac as he,ar as me,ae as fe,r as pe,H as Ie,L as H,K as xe,I as Te,d as be,W as ve,X as z,Y as Ce,Z as Q,_ as ye}from"./MailListHeader-Trtc8lfx.js";import{u as Re,b as Se,a as je}from"./MailViewChrome-BJ4q1GXR.js";import{f as we}from"./ErrorState-BnG-HaD4.js";import{u as Fe}from"./useMediaQuery-DXxjKaoU.js";import{f as Me}from"./useMessageBodyContent-BZp02vgj.js";const Pe=()=>Y({query:{starred:!0,order:"desc"}});function V(){const{data:e,isLoading:t,isError:o,error:i,refetch:m,fetchNextPage:s,hasNextPage:h,isFetchingNextPage:c}=Re({queryKey:Pe(),queryFn:async({pageParam:f})=>{const{data:d}=await X({query:{starred:!0,order:"desc",continuationToken:f},throwOnError:!0});return d},initialPageParam:void 0,getNextPageParam:f=>f.continuationToken,staleTime:6e4});return{threads:n.useMemo(()=>(e?.pages??[]).flatMap(f=>f.items??[]),[e]),isLoading:t,isError:o,error:i,refetch:m,fetchNextPage:s,hasNextPage:h,isFetchingNextPage:c}}const ke=e=>{const t=new Set;return e.filter(o=>t.has(o.threadId)?!1:(t.add(o.threadId),!0))},Le={unread:e=>!e.isRead,attachment:e=>e.hasAttachment===!0};function qe({rows:e,verb:t}){const{selectedIds:o,exitSelection:i}=fe(),m=n.useMemo(()=>e.filter(s=>o.has(s.id)).map(s=>({id:s.id,sender:s.fromName,email:s.fromEmail,subject:s.subject,date:s.timeLabel})),[e,o]);return a.jsx(pe,{verb:t,selection:m,selectionRestriction:"spansAccounts",onFinished:i})}function Oe({selectedMessageId:e,onOpenThread:t,commandsRef:o,onTriageContextChange:i,onDeleteMessages:m}){const{searchQuery:s,resultFolderIndex:h}=P(),c=ae(),T=Fe(),f=Z(),[d,I]=n.useState("all"),[S,k]=n.useState(new Set),v=n.useCallback(r=>{k(g=>{const p=new Set(g);return p.has(r)?p.delete(r):p.add(r),p})},[]),j=n.useCallback(()=>{I("all"),k(new Set)},[]),{threads:b,isLoading:x,isError:L,error:N,refetch:q,fetchNextPage:E,hasNextPage:C,isFetchingNextPage:w}=V(),{freeText:y,tokens:O}=oe(s.trim().toLowerCase(),c),u=n.useMemo(()=>{const r=Array.from(S).map(g=>Le[g]).filter(g=>g!=null);return ke(b).map(ne).filter(g=>(d==="all"||g.category===d)&&r.every(p=>p(g))&&(!y||ie(g,y))&&de(g,O))},[b,d,S,y,O]),F=n.useCallback((r,g)=>{const p=u.find(U=>U.id===r)?.threadId;p&&t?.({threadId:p,messageId:r},g)},[u,t]),l=n.useCallback(r=>{const g=r.threadId??u.find(p=>p.id===r.id)?.threadId;g&&t?.({threadId:g,messageId:r.id})},[u,t]),R=n.useMemo(()=>le(),[]),M=n.useMemo(()=>u.map(r=>ce(r,h)),[u,h]),W=n.useMemo(()=>u.filter(r=>!r.isRead).length,[u]),D=x?"loading":L?"error":u.length===0?"empty":"ready",G=n.useCallback(()=>{const r=J(ee());window.open(r,"_blank","noopener,noreferrer")},[]),B=ue(),$=a.jsx("div",{className:"flex h-full min-h-0 flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsx("div",{className:"divide-y divide-line",children:u.map(r=>a.jsx(ge,{thread:r,active:r.id===e,onClick:()=>F(r.id)},r.id))}),C?a.jsx("button",{type:"button",className:"w-full py-3 text-sm text-muted hover:text-fg disabled:opacity-50",onClick:()=>E(),disabled:w,children:w?"Loading…":"Load more"}):null]})});return a.jsx(Se,{title:"Starred",unreadCount:W,preset:R,selectedCategory:d,activeFilters:S,onSelectCategory:I,onToggleFilter:v,onClearFilters:j,searchResults:M,searchLoading:x,onSelectSearchResult:l,searchResultsInBody:!0,children:a.jsxs(he,{selectedMessageId:e,onOpen:F,onDeleteMessages:m,onSelectionVerb:f.start,wizardOpen:f.isOpen,commandsRef:o,onTriageContextChange:i,children:[a.jsx(je,{listTitle:"Starred",sections:[{id:"flagged",threads:u}],flatList:!0,hideHeader:!0,listState:B.searchResults?"ready":D,searchQuery:y?s:void 0,errorMessage:L?we(N):void 0,onRetry:()=>q(),onReportError:G,selectedThreadId:e,onSelectThread:F,isDesktop:T,selectionBar:a.jsx(me,{title:"Starred"}),listBody:B.searchResults??(D==="ready"?$:void 0)}),a.jsx(qe,{rows:u,verb:f.verb})]})})}const _=n.createContext(null);function A(){const e=n.useContext(_);if(!e)throw new Error("FlaggedPane.* must be used inside <FlaggedPane>");return e}function Ae({thread:e,children:t}){const o=te(),i=Me(),{searchInput:m}=P(),s=e?.threadId,h=e?.messageId,{threads:c}=V(),T=n.useMemo(()=>{if(s)return c.find(l=>l.messageId===h)??c.find(l=>l.threadId===s)},[c,s,h]),f=Ie(s,h),d=T??f,I=h??d?.messageId,S=n.useMemo(()=>{if(s)return{threadId:s,mailboxId:d?.mailboxId??"",subject:d?.subject,messageId:I,authenticity:d?.authenticity}},[s,d,I]),k=n.useCallback((l,R)=>{o({to:"/mail/flagged/$threadId/$messageId",params:l,replace:R?.replace,search:M=>({...M,q:m||void 0}),hash:i})},[o,i,m]),v=n.useCallback(()=>{o({to:"/mail/flagged",search:l=>l,hash:i})},[o,i]),j=n.useCallback(l=>{I&&l.includes(I)&&v()},[I,v]),b=H({thread:d,onAfterOptimisticRemove:j}),x=xe(),{deleteMessages:L}=Te({mailboxId:d?.mailboxId??"",messages:c,onAfterOptimisticRemove:j}),{toggleReadFor:N}=be({mailboxId:d?.mailboxId??"",messages:c}),q=x.focusedMessageId,C=n.useMemo(()=>c.find(l=>l.messageId===q),[c,q])??d,w=H({thread:C}),{nextMessageId:y,previousMessageId:O}=ve({context:x,orderedIds:x.orderedIds,selectedMessageId:I,onClose:v,handlers:{reply:()=>b.requestCompose("reply"),replyAll:()=>b.requestCompose("reply_all"),forward:()=>b.requestCompose("forward"),delete:()=>{x.listCommandsRef.current?.requestVerb("delete")||w.deleteThread()},toggleStar:w.toggleStar,toggleRead:()=>{x.listCommandsRef.current?.requestVerb("markRead")||C&&N([C.messageId],!C.isRead)},goBrief:()=>o({to:"/mail/brief"}),goSettings:()=>o({to:"/settings"})}}),u=n.useCallback(l=>{if(!l)return;const R=c.find(M=>M.messageId===l);return R?{threadId:R.threadId,messageId:l}:void 0},[c]),F={selectedMessageId:I,selectedThread:d,conversation:S,onOpenThread:k,onCloseThread:v,nextThread:u(y),previousThread:u(O),actions:b,triage:x,onDeleteMessages:L,handleDeselectIfRemoved:j};return a.jsx(_.Provider,{value:F,children:t})}function K(){const{selectedMessageId:e,onOpenThread:t,triage:o,onDeleteMessages:i}=A();return a.jsx(Oe,{selectedMessageId:e,onOpenThread:t,commandsRef:o.listCommandsRef,onTriageContextChange:o.onTriageContextChange,onDeleteMessages:i})}function Ne(){const{conversation:e,actions:t}=A(),{intelligenceOpen:o,onToggleIntelligence:i}=P(),m=se()?.showIntelligencePane??!1,s=!!e,h=m&&s;return a.jsxs("section",{className:"flex h-full w-full min-w-0 flex-col bg-canvas",children:[a.jsx(ye,{hasThread:s,intelligenceOpen:h&&o,canToggleIntelligence:h,onToggleIntelligence:i,onReply:s?()=>t.requestCompose("reply"):void 0,onReplyAll:s?()=>t.requestCompose("reply_all"):void 0,onForward:s?()=>t.requestCompose("forward"):void 0,onDelete:s?t.deleteThread:void 0,onToggleStar:s?t.toggleStar:void 0,isStarred:t.isStarred,moveContext:s&&t.accountId&&t.mailboxId?{accountId:t.accountId,currentMailboxId:t.mailboxId,onMove:t.moveThread}:void 0}),a.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e?a.jsx(z,{threadId:e.threadId,mailboxId:e.mailboxId,subject:e.subject,selectedMessageId:e.messageId,authenticity:e.authenticity,composeRequest:t.composeRequest,onComposeClose:t.clearComposeRequest}):a.jsx(re,{})})]})}function Ee(){const{selectedThread:e,handleDeselectIfRemoved:t}=A(),{onToggleIntelligence:o}=P();return a.jsx(Q,{onClose:o,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,onAfterOptimisticRemove:t})}function De(){const{selectedThread:e,conversation:t,onCloseThread:o,onOpenThread:i,nextThread:m,previousThread:s,handleDeselectIfRemoved:h}=A(),{intelligenceOpen:c,onToggleIntelligence:T}=P();return t?a.jsxs(a.Fragment,{children:[a.jsx(z,{threadId:t.threadId,mailboxId:t.mailboxId,subject:t.subject,selectedMessageId:t.messageId,authenticity:t.authenticity,onBack:o,onOpenIntelligence:T,onSwipeNext:m?()=>i(m):void 0,onSwipePrevious:s?()=>i(s):void 0,mobileIntelligenceOpen:c}),a.jsx(Ce,{isOpen:c,onClose:T,ariaLabel:"Message details",side:"right",children:a.jsx(Q,{onClose:T,thread:e,mailboxId:e?.mailboxId,accountId:e?.accountId,hideCloseButton:!0,onAfterOptimisticRemove:h})})]}):a.jsx("div",{className:"h-full",children:a.jsx(K,{})})}const We=Object.assign(Ae,{List:K,Reading:Ne,Intelligence:Ee,Phone:De});export{We as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,s as f,Q as m,j as e,X as N}from"./index-35SwEY68.js";import{E as u}from"./ErrorState-BnG-HaD4.js";import{D as r,C as x,u as w}from"./index-BdqDBo3X.js";import{u as E}from"./useMediaQuery-DXxjKaoU.js";import{b as p,d as h,e as b}from"./compose-CqHqZWHD.js";import"./useMessageBodyContent-BZp02vgj.js";import{C as k}from"./confirm-dialog-53Vs8qdX.js";const C=t=>t?"Draft":"New Message",I=()=>{const t=n.useRef(!1);return n.useCallback(()=>{const s=document.querySelector("[data-subject-field]")?.value??"",o=(document.querySelector('[data-testid="compose-body"]')?.textContent??"").replace(/--\s*/g,"").trim();return t.current=s.trim().length>0||o.length>0,t.current},[])},S=()=>{const t=p(),i=h(),s=b(),a=I(),[l,o]=n.useState(!1),{isError:d,error:c,refetch:g}=f({...m(),staleTime:1/0}),j=n.useCallback(D=>{D||(a()?o(!0):s())},[s,a]),y=n.useCallback(()=>{o(!1),s()},[s]),v=n.useCallback(()=>{o(!1)},[]);return e.jsxs(r.Root,{open:!0,onOpenChange:j,children:[e.jsxs(r.Portal,{children:[e.jsx(r.Overlay,{className:"fixed inset-0 z-40 bg-black/40"}),e.jsxs(r.Content,{className:"fixed inset-x-0 bottom-0 z-50 flex flex-col rounded-t-lg bg-canvas pb-[env(safe-area-inset-bottom,0px)]",style:{height:"95dvh"},children:[e.jsx(r.Handle,{className:"mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30"}),e.jsx(r.Title,{className:"px-4 py-2 text-base font-semibold border-b border-line",children:C(t)}),d?e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:c,onRetry:()=>{g()}})}):e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})]}),e.jsx(k,{isOpen:l,title:"Discard draft?",description:"Your message has unsaved content. Are you sure you want to discard it?",confirmLabel:"Discard",cancelLabel:"Keep editing",destructive:!0,onConfirm:y,onCancel:v})]})},A=()=>{const t=p(),i=h(),s=b(),a=E(),{isError:l,error:o,refetch:d}=f({...m(),staleTime:1/0});if(w({bindings:[{key:"Escape",handler:s,preventDefault:!0}]}),!a)return e.jsx(S,{});const c=e.jsxs("header",{className:"flex items-center justify-between gap-2 px-4 py-3 border-b border-line shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("h2",{className:"text-lg font-semibold truncate",children:C(t)})}),e.jsx("button",{type:"button",onClick:s,className:"p-2 rounded-md hover:bg-surface-raised transition-colors min-h-11 min-w-11 inline-flex items-center justify-center","aria-label":"Close",children:e.jsx(N,{className:"size-5"})})]});return l?e.jsxs("div",{className:"h-full flex flex-col bg-canvas",children:[c,e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(u,{title:"Couldn't load compose",error:o,onRetry:()=>{d()}})})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-canvas",children:[c,e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(x,{mode:"new",outboxMessageId:t,onDraftCreated:i,onClose:s})})]})};export{A as F};
|