@remit/web-client-dist 0.0.494 → 0.0.495
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-BnE8GpDb.js → BriefPane-BEMpREbM.js} +1 -1
- package/assets/{CalendarComposePane-C64qPrWN.js → CalendarComposePane-B8RIG3G1.js} +1 -1
- package/assets/{CalendarComposeSeed-CjuhXJ9h.js → CalendarComposeSeed-DKiVztER.js} +1 -1
- package/assets/{CalendarShell-kvKJYTxW.js → CalendarShell-CPdIENU0.js} +1 -1
- package/assets/{EmptyState-BSOaweyr.js → EmptyState-ByZPPoBW.js} +1 -1
- package/assets/{ErrorState-APGcZLbf.js → ErrorState-BdpB-2BQ.js} +1 -1
- package/assets/{FlaggedPane-BCnhyoJH.js → FlaggedPane-DgGAJWxG.js} +1 -1
- package/assets/{FullCompose-B_s7dvRy.js → FullCompose-w8QBwa1F.js} +1 -1
- package/assets/{MailListHeader-BGb3qWZS.js → MailListHeader-DpqTxu9Y.js} +1 -1
- package/assets/{MailNav-C-cg6R6p.js → MailNav-B_HG7DOH.js} +1 -1
- package/assets/{MailShell-BfeWFs9w.js → MailShell-DoajaymZ.js} +1 -1
- package/assets/{MailViewChrome-DTjPG0HJ.js → MailViewChrome-BoZny5Ug.js} +1 -1
- package/assets/{MailboxPane-B3xNGsI1.js → MailboxPane-55oYauzw.js} +1 -1
- package/assets/{NavMenuButton-CZ0ZAUZp.js → NavMenuButton-eChrqIjJ.js} +1 -1
- package/assets/{OnboardingWizard-jklNO9bD.js → OnboardingWizard-Cnq-2-am.js} +1 -1
- package/assets/{OpenCalendarEvent-DzqMoEpW.js → OpenCalendarEvent-D8vDrPlh.js} +1 -1
- package/assets/{OutboxPane-CNcNhGs7.js → OutboxPane-YAn3UaxA.js} +1 -1
- package/assets/_calendarObjectId-BuG_Ye1C.js +1 -0
- package/assets/_mailboxId-YH1qdozC.js +1 -0
- package/assets/_messageId-DT8AInZs.js +1 -0
- package/assets/_messageId-Drx2zgqi.js +1 -0
- package/assets/_messageId-wkdIQ55g.js +1 -0
- package/assets/_outboxMessageId-BH_mWFfT.js +1 -0
- package/assets/_recurrenceId-BpO2J3MQ.js +1 -0
- package/assets/_threadId-BBYabMdf.js +1 -0
- package/assets/_threadId-DgIn0EPf.js +1 -0
- package/assets/_threadId-pMNs7I9p.js +1 -0
- package/assets/{_view._date-C2dteSv0.js → _view._date-6Wdiax9r.js} +1 -1
- package/assets/{accounts-GvT-gH1i.js → accounts-B7WcpGKX.js} +1 -1
- package/assets/{advanced-DcygA-ix.js → advanced-Bh1WCftW.js} +1 -1
- package/assets/{appearance-ugg6-_6y.js → appearance-Ux2-yIoq.js} +1 -1
- package/assets/{attachment-file-BuvYw1HE.js → attachment-file-D0HDeXxM.js} +1 -1
- package/assets/{avatar-DtKHLoQk.js → avatar-CRolAGMx.js} +1 -1
- package/assets/{bottom-sheet-DH8ZD7EF.js → bottom-sheet-DscANK9c.js} +1 -1
- package/assets/brief-BSuLtYRH.js +1 -0
- package/assets/{brief-CQRKSU8D.js → brief-CnKOJ14k.js} +1 -1
- package/assets/{browser-ponyfill-BEuLQB6a.js → browser-ponyfill-Q866M4Nr.js} +1 -1
- package/assets/{bug-C12AZqJK.js → bug-pEghc6tg.js} +1 -1
- package/assets/{calendar-DwTSM1Ao.js → calendar-Rv-lEWWe.js} +1 -1
- package/assets/{calendar-days-CB6ESLQO.js → calendar-days-BJ_20Jyk.js} +1 -1
- package/assets/{card-QZQtqlvh.js → card-CcIkIugx.js} +1 -1
- package/assets/chevron-left-Ga46zxOJ.js +1 -0
- package/assets/{circle-check-big--h5VjHUW.js → circle-check-big-C-VUNWnE.js} +1 -1
- package/assets/{circle-check-CBQyzrU1.js → circle-check-j3ftvpbW.js} +1 -1
- package/assets/{circle-help-CPj30Y-3.js → circle-help-CwU6dZTm.js} +1 -1
- package/assets/{clock-ydwjMqnM.js → clock-WuXeJWU-.js} +1 -1
- package/assets/compose._-_outboxMessageId_-BmHcjRV_.js +1 -0
- package/assets/compose._-_outboxMessageId_-CBakJ-28.js +1 -0
- package/assets/compose._-_outboxMessageId_-CQmLLJ1w.js +1 -0
- package/assets/compose._-_outboxMessageId_-Cy_n6EHj.js +1 -0
- package/assets/{config-import-VakDsNQ7.js → config-import-BE0ryw-i.js} +1 -1
- package/assets/{confirm-dialog-CtcMScz-.js → confirm-dialog-BHPwL2Mu.js} +1 -1
- package/assets/{credential-steps-BeFxuU3Z.js → credential-steps-DNS1SWlp.js} +1 -1
- package/assets/{download-DPLkqI1r.js → download-N8RxH0I6.js} +1 -1
- package/assets/{filters-GtQzlAlC.js → filters-Ct4TImnH.js} +1 -1
- package/assets/flagged-Br3BjTTD.js +1 -0
- package/assets/{flagged-rSwCFlpM.js → flagged-DhiVOrbH.js} +1 -1
- package/assets/{folders-6TpS_O4t.js → folders-CQJZVAEw.js} +1 -1
- package/assets/{format-B-OOHWGv.js → format-B_FD2e8R.js} +1 -1
- package/assets/{help-copy-DLxG6x31.js → help-copy-CG_2LyCi.js} +1 -1
- package/assets/{import-CuqBaArE.js → import-kmOabCNM.js} +1 -1
- package/assets/{index-BCOt-LiG.js → index-BQWnqT7l.js} +1 -1
- package/assets/{index-DZMQdc91.js → index-BoxiBjE8.js} +4 -4
- package/assets/index-BwMp4ajK.js +1 -0
- package/assets/index-Cv2GSA9r.js +1 -0
- package/assets/index-DPkvu_tH.js +1 -0
- package/assets/index-DdfFHYoN.js +1 -0
- package/assets/index-Dlf2Mkch.js +1 -0
- package/assets/index-Drx2zgqi.js +1 -0
- package/assets/index-bKs-2H7O.js +1 -0
- package/assets/{index-w4JCmJ6j.js → index-tORYm1g3.js} +4 -4
- package/assets/index-th64R5dx.js +1 -0
- package/assets/index-wkdIQ55g.js +1 -0
- package/assets/{kbd-BvXpqvPz.js → kbd-CQfGa1PF.js} +1 -1
- package/assets/{labels-CCuLHAOk.js → labels-DmoFn23z.js} +1 -1
- package/assets/{mail-CGWAUXBT.js → mail-DzgLd5ht.js} +1 -1
- package/assets/{mail-UcBfRUkI.js → mail-zh2SRy5b.js} +1 -1
- package/assets/{menu-B-gq6ySP.js → menu-DN5zpA0a.js} +1 -1
- package/assets/minus-cjwKQEGX.js +1 -0
- package/assets/{new-BbQwLhhQ.js → new-SbqXSShl.js} +1 -1
- package/assets/onboarding-C1GknuLf.js +1 -0
- package/assets/{onboarding-completion-B7rZPljF.js → onboarding-completion-bJbWoJKX.js} +1 -1
- package/assets/outbox-WWgW5q0K.js +1 -0
- package/assets/{pencil-Dh6tli4M.js → pencil-BxMsOZ8c.js} +1 -1
- package/assets/{rich-text-B_neVkty.js → rich-text-BHpf3a14.js} +1 -1
- package/assets/{rich-text-spellcheck-worker-provider-s1EQpvzP.js → rich-text-spellcheck-worker-provider-BO9xn8gr.js} +1 -1
- package/assets/{rotate-ccw-DUAGNyUl.js → rotate-ccw-Cs1JQfpJ.js} +1 -1
- package/assets/{row-actions-BrdgiHbq.js → row-actions-DPIYaysg.js} +1 -1
- package/assets/{search-mirror-Cw7GFLQS.js → search-mirror-2weR7Ba_.js} +1 -1
- package/assets/{search-token-index-CIPCfJWo.js → search-token-index-D-gWPAEk.js} +1 -1
- package/assets/{sections-DNei7Spy.js → sections-COsJpcXX.js} +1 -1
- package/assets/{senders-DiIJOYUP.js → senders-3doDrsut.js} +1 -1
- package/assets/settings-C4nobC4_.js +1 -0
- package/assets/{settings-screen-BOv10j_E.js → settings-screen-4RhR5454.js} +1 -1
- package/assets/{shield-check-BvFGrgM2.js → shield-check-CDbh7UQQ.js} +1 -1
- package/assets/{suggested-vips-CxDn5cW3.js → suggested-vips-BlaOLYOc.js} +1 -1
- package/assets/{useCalendarData-C6YGSfDT.js → useCalendarData-B5kQq5mg.js} +1 -1
- package/assets/{useCalendars-CaVN_WZs.js → useCalendars-CuuHCvAe.js} +1 -1
- package/assets/{useDebouncedValue-Da0awk1W.js → useDebouncedValue-ATwGPcJy.js} +1 -1
- package/assets/{useFilters-CwRuLYAS.js → useFilters-BcjDJmnI.js} +1 -1
- package/assets/{useLabels-C_WPK1_9.js → useLabels-DXK6wqpQ.js} +1 -1
- package/assets/{useLayoutTier-DlqgV_B1.js → useLayoutTier-B31omesr.js} +1 -1
- package/assets/{useMessageBodyContent-Dt2slY5y.js → useMessageBodyContent-Dgv5wWIW.js} +1 -1
- package/assets/{useQueries-DmyAOQK_.js → useQueries-CYk5lp9G.js} +1 -1
- package/assets/{useRefreshControl-knRH5VIv.js → useRefreshControl-Ek98Uvm0.js} +1 -1
- package/assets/{useSearchTokenContext-DhZqEO7r.js → useSearchTokenContext-BKuymkTr.js} +1 -1
- package/assets/{useSemanticSearch-MpjQSFne.js → useSemanticSearch-BK5kVsoj.js} +1 -1
- package/assets/{useSignature-Bm56kjTW.js → useSignature-D5Vdi95d.js} +1 -1
- package/index.html +1 -1
- package/package.json +1 -1
- package/assets/_calendarObjectId-Dutr11EF.js +0 -1
- package/assets/_mailboxId-CeFrg_eQ.js +0 -1
- package/assets/_messageId-BrtiBEBq.js +0 -1
- package/assets/_messageId-CIwKZmVZ.js +0 -1
- package/assets/_messageId-SL8s8OXM.js +0 -1
- package/assets/_outboxMessageId-CpIcaN7Z.js +0 -1
- package/assets/_recurrenceId-CFhzb1_5.js +0 -1
- package/assets/_threadId-BADWjAuk.js +0 -1
- package/assets/_threadId-BYgUUoU7.js +0 -1
- package/assets/_threadId-DuCXJHKC.js +0 -1
- package/assets/brief-CdhCDwIC.js +0 -1
- package/assets/chevron-left-CrYl2DX8.js +0 -1
- package/assets/compose._-_outboxMessageId_-BAx5uMDG.js +0 -1
- package/assets/compose._-_outboxMessageId_-BvVOOUcR.js +0 -1
- package/assets/compose._-_outboxMessageId_-DpqtfcoG.js +0 -1
- package/assets/compose._-_outboxMessageId_-MtzVIOS3.js +0 -1
- package/assets/flagged-DsqnhNGG.js +0 -1
- package/assets/index-BYj6_ESU.js +0 -1
- package/assets/index-CIwKZmVZ.js +0 -1
- package/assets/index-COhcTkGF.js +0 -1
- package/assets/index-CwTrJca8.js +0 -1
- package/assets/index-Cx2qBi06.js +0 -1
- package/assets/index-DKX4t36K.js +0 -1
- package/assets/index-DrhUDOsx.js +0 -1
- package/assets/index-SL8s8OXM.js +0 -1
- package/assets/index-_Vbcj2Cq.js +0 -1
- package/assets/minus-BHVFPRvM.js +0 -1
- package/assets/onboarding-DEgija64.js +0 -1
- package/assets/outbox-Bhn1clu9.js +0 -1
- package/assets/settings-DE1P-dUq.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as H,j as e,B as x,f,L as _,X as Ee,r,I as Oe,g as O,h as pe,c as ze,d as Be,i as q,s as de,k as $e,l as Pe,m as Le,n as De,o as J,q as qe}from"./index-DZMQdc91.js";import{W as k,C as fe,a as le,u as We,b as He,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-BeFxuU3Z.js";import{c as ge,f as Ve,v as xe,r as Ge,a as Je,b as ue,w as me,p as Xe,W as Ye,s as Ze,g as et}from"./config-import-VakDsNQ7.js";import{F as tt}from"./card-QZQtqlvh.js";import{c as st}from"./onboarding-completion-B7rZPljF.js";const nt=H("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);const it=H("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const at=H("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);const rt=H("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),y=["File","Review","Credentials","Folders"];function Y({children:t}){return e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:t})}function ot({state:t="idle",file:n,ready:i=!1,failure:s,onChoose:d,onDragStateChange:l,onNext:m}){const u=r.useId(),w=r.useRef(null),h=t==="dragging",j=t==="reading",S=t==="checking",R=j||S,N=p=>{p.preventDefault(),l?.(!1);const b=p.dataTransfer.files.item(0);b&&d?.(b)};return e.jsx(k,{steps:y,activeStep:0,title:"Import a config file",subtitle:"Accounts, folder roles, rules, senders and appearance — everything except passwords.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Nothing is written until you have seen what will change."}),e.jsx(f,{variant:"primary",disabled:R||!i,icon:R?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:m,children:j?"Reading…":S?"Checking…":"Check the file"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{tone:"danger",children:s.title}),e.jsx("p",{className:"text-sm text-fg",children:s.explanation}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.fix}),e.jsx(Y,{children:s.raw})]}),e.jsxs("div",{onDragOver:p=>{p.preventDefault(),l?.(!0)},onDragLeave:()=>l?.(!1),onDrop:N,className:h?"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-accent bg-accent-soft px-4 py-9 text-center":"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-line px-4 py-9 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-md bg-surface-sunken",children:e.jsx(rt,{className:"size-5 text-fg-muted"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:h?"Drop it here":"Drop a config file here, or choose one"}),e.jsx("p",{className:"mt-1 text-xs text-fg-subtle",children:"A .json file written by Reader — up to 2 MB."})]}),e.jsx("input",{ref:w,id:u,type:"file",accept:"application/json,.json",className:"sr-only",onChange:p=>{const b=p.target.files?.item(0);b&&d?.(b)}}),e.jsx(f,{variant:"secondary",size:"sm",onClick:()=>w.current?.click(),children:"Choose file"})]}),n&&e.jsxs("div",{className:"flex items-start gap-3 rounded-sm border border-line px-3 py-2.5",children:[e.jsx(tt,{className:"mt-0.5 size-4 shrink-0 text-fg-muted"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-fg",children:n.name}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[Ve(n.size)," ·"," ",j?"reading it from disk":S?"checking it against this instance":i?"ready to check — nothing has been sent yet":"not a configuration this instance can read"]})]})]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Export one from Settings → Advanced on the instance you are moving from, or run"," ",e.jsx("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:"remit config save"})," ","on its host."]})]})})}function ct({sections:t}){const n=ge(t.flatMap(i=>i.entries.map(s=>({section:i.id,key:s.label,verdict:s.verdict}))));return e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["created","updated","unchanged","skipped","rejected"].filter(i=>n[i]>0).map(i=>e.jsxs(O,{tone:xe[i],dot:!0,children:[n[i]," ",i]},i))})}function dt({section:t}){return e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.title}),e.jsx("ul",{className:"mt-1.5 divide-y divide-line",children:t.entries.map(n=>e.jsxs("li",{className:"flex items-start gap-3 py-2",children:[e.jsx(O,{tone:xe[n.verdict],className:"mt-0.5 shrink-0",children:n.verdict}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm text-fg",children:n.label}),n.reason&&e.jsx("p",{className:n.verdict==="rejected"?"mt-1 text-xs text-danger":"mt-1 text-xs text-warning",children:n.reason})]})]},n.id))})]})}function lt({sections:t,fileName:n,warnings:i=[],applying:s=!1,onBack:d,onNext:l}){const m=ge(t.flatMap(h=>h.entries.map(j=>({section:h.id,key:j.label,verdict:j.verdict})))),u=m.created+m.updated,w=m.skipped+m.rejected;return e.jsx(k,{steps:y,activeStep:1,title:"What this file will change",subtitle:`${n} · nothing has been written yet.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:d,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:s,icon:s?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:l,children:s?"Importing…":`Import ${u} changes`})]}),children:e.jsxs("div",{className:"space-y-5",children:[e.jsx(ct,{sections:t}),w>0&&e.jsxs(x,{tone:"warning",children:[w," entries will not be imported. Each says why below — read them before you continue, because nothing here retries on its own."]}),i.length>0&&e.jsx("ul",{className:"space-y-1 text-xs text-warning",children:i.map(h=>e.jsx("li",{children:h},h))}),t.map(h=>e.jsx(dt,{section:h},h.id))]})})}function ut({choice:t,held:n,onChoose:i,onBack:s,onNext:d}){return e.jsx(k,{steps:y,activeStep:1,title:"This instance already has configuration",subtitle:n,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:s,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:!t,onClick:d,children:t==="merge"?"Continue with merge":"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"warning",children:"An import into a configured instance can only add and update — it never deletes what is here. Pick how the two should meet."}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(le,{name:"Stop, keep this instance",description:"Nothing is written. Use this if you meant to import into a fresh instance.",icon:e.jsx(Ee,{className:"size-5"}),selected:t==="abort",onSelect:()=>i?.("abort")}),e.jsx(le,{name:"Merge the file in",description:"Adds what is missing and updates what differs. Existing accounts keep their server settings.",icon:e.jsx(at,{className:"size-5"}),selected:t==="merge",onSelect:()=>i?.("merge")})]}),t==="merge"&&e.jsx("p",{className:"text-xs text-fg-muted",children:"The next screen lists every add and update before anything is written."})]})})}function mt(t){return t==="entered"?e.jsx(O,{tone:"positive",children:"ready"}):t==="failed"?e.jsx(O,{tone:"danger",children:"sign-in failed"}):e.jsx(O,{tone:"danger",children:"credentials needed"})}function ht({accounts:t,busyAccountId:n,onOpen:i}){return e.jsx("ul",{className:"divide-y divide-line",children:t.map(s=>e.jsxs("li",{className:s.state==="entered"?"flex flex-wrap items-start justify-between gap-3 py-3":"flex flex-wrap items-start justify-between gap-3 border-l-2 border-danger bg-danger-soft py-3 pl-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:s.address}),mt(s.state)]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[s.displayName," ·"," ",s.connector==="microsoft"?"Microsoft 365":"IMAP / SMTP"," ","· ",s.server]}),s.state!=="entered"&&e.jsx("p",{className:"mt-1 text-xs text-danger",children:s.failure??(s.connector==="microsoft"?"Config files never carry OAuth tokens. Reconnect with Microsoft to start syncing this account.":"Config files never carry passwords. Enter this mailbox's password to start syncing.")})]}),s.state!=="entered"&&e.jsx(f,{variant:"primary",size:"sm",disabled:n===s.accountId,icon:n===s.accountId?e.jsx(_,{className:"size-3.5 animate-spin"}):s.connector==="microsoft"?e.jsx(Oe,{className:"size-3.5"}):e.jsx(it,{className:"size-3.5"}),onClick:()=>i?.(s),children:n===s.accountId?"Redirecting…":s.connector==="microsoft"?"Reconnect":s.state==="failed"?"Try again":"Enter password"})]},s.accountId))})}function pt({accounts:t,busyAccountId:n,error:i,onOpen:s,onNext:d}){const l=t.filter(m=>m.state!=="entered").length;return e.jsx(k,{steps:y,activeStep:2,title:"These accounts need credentials",subtitle:"The config file carries servers and settings. Passwords and Microsoft sign-ins it deliberately leaves out.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:l>0?"Settings › Accounts keeps asking until every account is signed in.":"Every account can sync."}),e.jsx(f,{variant:"primary",onClick:d,children:l>0?"Finish later":"All accounts connected"})]}),children:e.jsxs("div",{className:"space-y-4",children:[i&&e.jsx(x,{tone:"danger",children:i}),l>0&&e.jsxs(x,{tone:"danger",children:[l," of ",t.length," accounts cannot sync yet. They stay listed in Settings, marked like this, until you sign in — no mail arrives for them in the meantime."]}),e.jsx(ht,{accounts:t,busyAccountId:n,onOpen:s})]})})}function ft({account:t,position:n,total:i,error:s,busy:d=!1,onBack:l,onNext:m}){return e.jsx(k,{steps:y,activeStep:2,title:`Reconnect ${t.address}`,subtitle:`Account ${n} of ${i} · Microsoft 365`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:l,children:"Back"}),e.jsx(f,{variant:"primary",disabled:d,icon:d?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:m,children:d?"Redirecting…":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsx(x,{tone:"danger",children:s}),e.jsx(x,{tone:"info",children:"A config file never carries an OAuth token — one only works for the instance it was granted to. Signing in here mints a fresh one for this instance."}),e.jsxs("div",{className:"rounded-sm border border-line px-3 py-2.5",children:[e.jsx("p",{className:"text-sm text-fg",children:t.displayName}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[t.address," · ",t.server]})]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"You will be sent to Microsoft and returned here. If your organisation requires admin approval, the sign-in stops there and this account keeps waiting."})]})})}function gt({folders:t,onNext:n}){return e.jsx(k,{steps:y,activeStep:3,title:t.length>0?"Waiting on folders":"Import finished",subtitle:t.length>0?"The config names folders this server has not shown us yet.":"Everything in the file landed, and every folder it named resolved.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Folder discovery runs with every sync."}),e.jsx(f,{variant:"primary",onClick:n,children:"Go to inbox"})]}),children:e.jsx("div",{className:"space-y-4",children:t.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(x,{tone:"warning",children:[t.length," settings are imported but switched off. Each turns itself on the moment its folder appears — nothing was dropped. If a folder never appears, create it in your mail client, or edit the setting in Settings → Senders & Rules."]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(nt,{className:"size-4"}),"Folder discovery runs with every sync of the account."]}),e.jsx("div",{className:"divide-y divide-line",children:t.map(i=>e.jsx(fe,{label:i.path,detail:i.waitingFor,state:"pending"},`${i.accountId??""}-${i.path}-${i.waitingFor}`))})]}):e.jsx(x,{tone:"success",children:"Every account, rule, label and sender in the file is live on this instance."})})})}function xt({failure:t,onBack:n}){return e.jsx(k,{steps:y,activeStep:0,title:t.title,subtitle:"Nothing was imported.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"This instance is unchanged."}),e.jsx(f,{variant:"primary",onClick:n,children:"Choose another file"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{tone:"danger",children:t.explanation}),e.jsx("p",{className:"text-sm text-fg",children:t.fix}),e.jsx(Y,{children:t.raw})]})})}function jt(t){return t==="landed"?"ok":t==="failed"||t==="unknown"?"failed":"pending"}function vt({results:t,message:n,raw:i,onBack:s,onNext:d}){const l=t.filter(u=>u.state==="landed").length,m=t.some(u=>u.state==="unknown");return e.jsx(k,{steps:y,activeStep:1,title:"The import stopped part-way",subtitle:m?"It did not say how far it got, so check Settings before importing again.":`${l} of ${t.length} sections landed.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:s,children:"Choose another file"}),e.jsx(f,{variant:"primary",onClick:d,children:"Retry the rest"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"danger",children:n}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Retrying is safe: an import folds into what is already here rather than replacing it, so what landed is recognised and left alone."}),e.jsx("div",{className:"divide-y divide-line",children:t.map(u=>e.jsx(fe,{label:u.title,detail:u.detail,state:jt(u.state)},u.section))}),e.jsx(Y,{children:i})]})})}const je=(t,n)=>t?"tls":n?"starttls":"none",yt=t=>({host:t.imapHost,port:t.imapPort,security:je(t.imapTls,t.imapStartTls)}),wt=t=>({host:t.smtpEnabled?t.smtpHost:"",port:t.smtpPort,security:je(t.smtpTls,t.smtpStartTls)}),he=(t,n,i)=>{const s=t.authType==="oauthMicrosoft"?"microsoft":"imap",d=!i&&(s==="microsoft"?t.connectionState==="reauth_required":t.connectionState==="credentials_missing");return{accountId:t.accountId,address:t.email,displayName:t.displayName?.trim()||t.email,connector:s,server:`${t.imapHost}:${t.imapPort}`,state:n?"failed":d?"needed":"entered",failure:n}},bt=t=>{if(!t)return"This instance already holds configuration of its own.";const n=[["accounts","account"],["labels","label"],["filters","rule"],["addressFlags","flagged sender"]].map(([i,s])=>({count:Number(t[i]??0),noun:s})).filter(i=>i.count>0).map(i=>`${i.count} ${i.noun}${i.count===1?"":"s"}`);return n.length===0?"This instance already holds configuration of its own.":`${n.join(", ")} are set up here already.`},W=(t,n)=>{if(t instanceof Error)return t.message;if(typeof t=="object"&&t!==null){const i=t.message;if(typeof i=="string")return i}return n};function kt({onDone:t}){const n=pe(),[i,s]=r.useState("file"),[d,l]=r.useState(!1),[m,u]=r.useState(!1),[w,h]=r.useState(void 0),[j,S]=r.useState(void 0),[R,N]=r.useState(void 0),[p,b]=r.useState(void 0),[Z,ee]=r.useState("abort"),[te,se]=r.useState(void 0),[ye,K]=r.useState(void 0),[C,we]=r.useState([]),[Q,be]=r.useState([]),[g,I]=r.useState(null),[T,U]=r.useState({username:"",password:""}),[F,V]=r.useState({}),[ke,ne]=r.useState(void 0),[G,z]=r.useState(null),[B,Se]=r.useState([]),{data:$}=ze({...Be(),enabled:C.length>0||i==="folders"}),A=r.useMemo(()=>{const a=new Map;for(const o of $?.accounts??[])a.set(o.accountId,o);return a},[$]),Ne=r.useMemo(()=>C.map(a=>A.get(a)).filter(a=>!!a).map(a=>he(a,F[a.accountId],Q.includes(a.accountId))),[C,A,F,Q]),c=g?A.get(g):void 0,ie=g?C.indexOf(g)+1:0,P=q({...$e(),meta:de(409)}),ae=q({...Pe(),meta:de(403,404)}),re=q(Le()),oe=q(De());We(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=He(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),u(!0),h({name:a.name,size:a.size}),N(void 0),S(void 0),a.text().then(o=>Ge(a.name,a.size,o)).then(o=>{if(u(!1),!o.ok){N(o.failure);return}S(o.document)}).catch(o=>{u(!1),N({title:"That file could not be read",explanation:`The browser could not read ${a.name} from disk, so nothing was sent.`,fix:"Check the file is still there and try again.",raw:W(o,"the file read was refused")})})},[]),L=r.useCallback((a,o)=>{j&&(K(void 0),P.mutate({body:{mode:a,onExisting:o,document:j}},{onSuccess:v=>{if(b(v),ue(v)){s("rejected");return}if(me(v)){s("partial");return}if(a==="validate"){s("review");return}if(Se(Xe(v)),n.invalidateQueries({queryKey:J()}),v.accountsNeedingCredentials.length>0){we([...v.accountsNeedingCredentials]),s("credentials");return}s("folders")},onError:v=>{const D=Je(v);if(D){K(D),se(void 0),s("conflict");return}N({title:"The import could not be sent",explanation:"The request to this instance failed before it produced a report, so nothing was written.",fix:"Check your connection and try again.",raw:W(v,"POST /config/import failed")}),s("file")}}))},[j,P,n]),Ie=r.useCallback(a=>{if(I(a.accountId),ne(void 0),a.connector==="microsoft"){s("account-oauth");return}const o=A.get(a.accountId);U({username:o?.username||a.address,password:""}),s("account-password")},[A]),Te=r.useCallback(()=>{g&&ae.mutate({path:{accountId:g},body:{password:T.password,isActive:!0}},{onSuccess:()=>{re.mutate({path:{accountId:g}}),be(a=>a.includes(g)?a:[...a,g]),V(a=>{const o={...a};return delete o[g],o}),n.invalidateQueries({queryKey:J()}),U({username:"",password:""}),I(null),s("credentials")},onError:a=>{V(o=>({...o,[g]:W(a,"The password was verified but could not be stored. Try again.")})),I(null),s("credentials")}})},[g,T.password,n,re,ae]),Re=r.useCallback(()=>{c&&(z(c.accountId),oe.mutate({body:{email:c.email}},{onSuccess:a=>{ce(),window.location.assign(a.authorizationUrl)},onError:a=>{z(null),V(o=>({...o,[c.accountId]:W(a,"Microsoft sign-in could not be started.")})),I(null),s("credentials")}}))},[c,ce,oe]),Fe=r.useCallback((a,o)=>U({username:a,password:o}),[]),Ae=r.useMemo(()=>{const a=$?.pendingImport?.folderPaths;if(!a)return B;const o=new Set(a),v=B.filter(E=>o.has(E.path)),D=a.filter(E=>!B.some(Me=>Me.path===E)).map(E=>({path:E,waitingFor:"An imported setting"}));return[...v,...D]},[$,B]),M=r.useCallback(()=>{b(void 0),K(void 0),N(void 0),h(void 0),S(void 0),ee("abort"),s("file")},[]);switch(i){case"file":return e.jsx(ot,{state:m?"reading":P.isPending?"checking":d?"dragging":"idle",file:w,ready:j!==void 0,failure:R,onChoose:Ce,onDragStateChange:l,onNext:()=>L("validate",Z)});case"rejected":return e.jsx(xt,{failure:(p&&ue(p))??R??{title:"The file could not be imported",explanation:"The import was refused and nothing was written.",fix:"Re-export the configuration and try again.",raw:"no error was reported"},onBack:M});case"conflict":return e.jsx(ut,{choice:te,held:bt(ye?.details),onChoose:se,onBack:M,onNext:()=>{if(te==="abort"){t("abandoned");return}ee("merge"),L("validate","merge")}});case"review":return e.jsx(lt,{sections:et(p?.items??[]),fileName:w?.name??"the config file",warnings:(p?.warnings??[]).map(a=>a.message),applying:P.isPending,onBack:M,onNext:()=>L("apply",Z)});case"partial":{if(!p)return e.jsx(St,{onBack:M});const a=me(p);return e.jsx(vt,{results:Ze(p),message:a?.message??"The import stopped before it finished.",raw:`${a?.code??Ye}: ${a?.message??"no message"}`,onBack:M,onNext:()=>L("apply","merge")})}case"credentials":return e.jsx(pt,{accounts:Ne,busyAccountId:G??void 0,error:ke,onOpen:Ie,onNext:()=>s("folders")});case"account-password":return c?e.jsx(Ke,{steps:y,activeStep:2,title:`Sign in to ${c.email}`,subtitle:`Account ${ie} of ${C.length} · ${c.imapHost}:${c.imapPort}`,email:c.email,username:T.username,password:T.password,error:F[c.accountId],continueLabel:"Test and continue",notice:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(Qe,{className:"size-3.5"}),"Server settings came from the config file — edit them in Settings if they are wrong."]}),onContinue:()=>s("account-test"),onBack:()=>{I(null),s("credentials")},onChange:Fe}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-test":return c?e.jsx(_e,{steps:y,activeStep:2,email:c.email,imapConfig:yt(c),smtpConfig:wt(c),username:T.username,password:T.password,credentialsBackLabel:"Back to the password",serversBackLabel:"Back to the password",successLabel:"Save and continue",onSuccess:Te,onBackToCredentials:()=>s("account-password"),onBackToServers:()=>s("account-password")}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-oauth":return c?e.jsx(ft,{account:he(c,F[c.accountId],Q.includes(c.accountId)),position:ie,total:C.length,error:F[c.accountId],busy:G===c.accountId,onBack:()=>{I(null),s("credentials")},onNext:Re}):e.jsx(X,{onBack:()=>t("abandoned")});case"folders":return e.jsx(gt,{folders:Ae,onNext:()=>t("imported")})}}function ve({children:t,label:n,onBack:i}){return e.jsxs("div",{className:"mx-auto max-w-lg p-6",children:[e.jsx(x,{tone:"danger",children:t}),e.jsx("button",{type:"button",className:"mt-3 text-sm text-accent underline",onClick:i,children:n})]})}function X({onBack:t}){return e.jsx(ve,{label:"Go to inbox",onBack:t,children:"That account is no longer in this instance's configuration, so there is nothing left to sign in to. Open Settings › Accounts to see what is here."})}function St({onBack:t}){return e.jsx(ve,{label:"Choose another file",onBack:t,children:"The import stopped but produced no report, so nothing here can say what it wrote. Open Settings to see what this instance holds before importing again."})}function Ft(){const t=qe(),n=pe(),i=r.useCallback(s=>{st({queryClient:n,recordCompleted:()=>{s==="imported"&&t.recordEvent("config.imported")},navigateToInbox:()=>{window.location.assign("/mail")}})},[t,n]);return e.jsx(kt,{onDone:i})}export{Ft as component};
|
|
1
|
+
import{e as H,j as e,B as x,f,L as _,X as Ee,r,I as Oe,g as O,h as pe,c as ze,d as Be,i as q,s as de,k as $e,l as Pe,m as Le,n as De,o as J,q as qe}from"./index-BoxiBjE8.js";import{W as k,C as fe,a as le,u as We,b as He,c as _e,d as Ke,S as Qe,R as Ue}from"./credential-steps-DNS1SWlp.js";import{c as ge,f as Ve,v as xe,r as Ge,a as Je,b as ue,w as me,p as Xe,W as Ye,s as Ze,g as et}from"./config-import-BE0ryw-i.js";import{F as tt}from"./card-CcIkIugx.js";import{c as st}from"./onboarding-completion-bJbWoJKX.js";const nt=H("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);const it=H("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);const at=H("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);const rt=H("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),y=["File","Review","Credentials","Folders"];function Y({children:t}){return e.jsx("code",{className:"block rounded bg-surface-sunken px-2.5 py-2 text-2xs text-fg-muted",children:t})}function ot({state:t="idle",file:n,ready:i=!1,failure:s,onChoose:d,onDragStateChange:l,onNext:m}){const u=r.useId(),w=r.useRef(null),h=t==="dragging",j=t==="reading",S=t==="checking",R=j||S,N=p=>{p.preventDefault(),l?.(!1);const b=p.dataTransfer.files.item(0);b&&d?.(b)};return e.jsx(k,{steps:y,activeStep:0,title:"Import a config file",subtitle:"Accounts, folder roles, rules, senders and appearance — everything except passwords.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Nothing is written until you have seen what will change."}),e.jsx(f,{variant:"primary",disabled:R||!i,icon:R?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:m,children:j?"Reading…":S?"Checking…":"Check the file"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(x,{tone:"danger",children:s.title}),e.jsx("p",{className:"text-sm text-fg",children:s.explanation}),e.jsx("p",{className:"text-sm text-fg-muted",children:s.fix}),e.jsx(Y,{children:s.raw})]}),e.jsxs("div",{onDragOver:p=>{p.preventDefault(),l?.(!0)},onDragLeave:()=>l?.(!1),onDrop:N,className:h?"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-accent bg-accent-soft px-4 py-9 text-center":"flex flex-col items-center gap-3 rounded-sm border-2 border-dashed border-line px-4 py-9 text-center",children:[e.jsx("span",{className:"flex size-11 items-center justify-center rounded-md bg-surface-sunken",children:e.jsx(rt,{className:"size-5 text-fg-muted"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-fg",children:h?"Drop it here":"Drop a config file here, or choose one"}),e.jsx("p",{className:"mt-1 text-xs text-fg-subtle",children:"A .json file written by Reader — up to 2 MB."})]}),e.jsx("input",{ref:w,id:u,type:"file",accept:"application/json,.json",className:"sr-only",onChange:p=>{const b=p.target.files?.item(0);b&&d?.(b)}}),e.jsx(f,{variant:"secondary",size:"sm",onClick:()=>w.current?.click(),children:"Choose file"})]}),n&&e.jsxs("div",{className:"flex items-start gap-3 rounded-sm border border-line px-3 py-2.5",children:[e.jsx(tt,{className:"mt-0.5 size-4 shrink-0 text-fg-muted"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm text-fg",children:n.name}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[Ve(n.size)," ·"," ",j?"reading it from disk":S?"checking it against this instance":i?"ready to check — nothing has been sent yet":"not a configuration this instance can read"]})]})]}),e.jsxs("p",{className:"text-2xs text-fg-subtle",children:["Export one from Settings → Advanced on the instance you are moving from, or run"," ",e.jsx("code",{className:"rounded bg-surface-sunken px-1 py-0.5",children:"remit config save"})," ","on its host."]})]})})}function ct({sections:t}){const n=ge(t.flatMap(i=>i.entries.map(s=>({section:i.id,key:s.label,verdict:s.verdict}))));return e.jsx("div",{className:"flex flex-wrap gap-1.5",children:["created","updated","unchanged","skipped","rejected"].filter(i=>n[i]>0).map(i=>e.jsxs(O,{tone:xe[i],dot:!0,children:[n[i]," ",i]},i))})}function dt({section:t}){return e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-fg",children:t.title}),e.jsx("ul",{className:"mt-1.5 divide-y divide-line",children:t.entries.map(n=>e.jsxs("li",{className:"flex items-start gap-3 py-2",children:[e.jsx(O,{tone:xe[n.verdict],className:"mt-0.5 shrink-0",children:n.verdict}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm text-fg",children:n.label}),n.reason&&e.jsx("p",{className:n.verdict==="rejected"?"mt-1 text-xs text-danger":"mt-1 text-xs text-warning",children:n.reason})]})]},n.id))})]})}function lt({sections:t,fileName:n,warnings:i=[],applying:s=!1,onBack:d,onNext:l}){const m=ge(t.flatMap(h=>h.entries.map(j=>({section:h.id,key:j.label,verdict:j.verdict})))),u=m.created+m.updated,w=m.skipped+m.rejected;return e.jsx(k,{steps:y,activeStep:1,title:"What this file will change",subtitle:`${n} · nothing has been written yet.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:d,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:s,icon:s?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:l,children:s?"Importing…":`Import ${u} changes`})]}),children:e.jsxs("div",{className:"space-y-5",children:[e.jsx(ct,{sections:t}),w>0&&e.jsxs(x,{tone:"warning",children:[w," entries will not be imported. Each says why below — read them before you continue, because nothing here retries on its own."]}),i.length>0&&e.jsx("ul",{className:"space-y-1 text-xs text-warning",children:i.map(h=>e.jsx("li",{children:h},h))}),t.map(h=>e.jsx(dt,{section:h},h.id))]})})}function ut({choice:t,held:n,onChoose:i,onBack:s,onNext:d}){return e.jsx(k,{steps:y,activeStep:1,title:"This instance already has configuration",subtitle:n,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:s,children:"Choose another file"}),e.jsx(f,{variant:"primary",disabled:!t,onClick:d,children:t==="merge"?"Continue with merge":"Continue"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"warning",children:"An import into a configured instance can only add and update — it never deletes what is here. Pick how the two should meet."}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsx(le,{name:"Stop, keep this instance",description:"Nothing is written. Use this if you meant to import into a fresh instance.",icon:e.jsx(Ee,{className:"size-5"}),selected:t==="abort",onSelect:()=>i?.("abort")}),e.jsx(le,{name:"Merge the file in",description:"Adds what is missing and updates what differs. Existing accounts keep their server settings.",icon:e.jsx(at,{className:"size-5"}),selected:t==="merge",onSelect:()=>i?.("merge")})]}),t==="merge"&&e.jsx("p",{className:"text-xs text-fg-muted",children:"The next screen lists every add and update before anything is written."})]})})}function mt(t){return t==="entered"?e.jsx(O,{tone:"positive",children:"ready"}):t==="failed"?e.jsx(O,{tone:"danger",children:"sign-in failed"}):e.jsx(O,{tone:"danger",children:"credentials needed"})}function ht({accounts:t,busyAccountId:n,onOpen:i}){return e.jsx("ul",{className:"divide-y divide-line",children:t.map(s=>e.jsxs("li",{className:s.state==="entered"?"flex flex-wrap items-start justify-between gap-3 py-3":"flex flex-wrap items-start justify-between gap-3 border-l-2 border-danger bg-danger-soft py-3 pl-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-fg",children:s.address}),mt(s.state)]}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[s.displayName," ·"," ",s.connector==="microsoft"?"Microsoft 365":"IMAP / SMTP"," ","· ",s.server]}),s.state!=="entered"&&e.jsx("p",{className:"mt-1 text-xs text-danger",children:s.failure??(s.connector==="microsoft"?"Config files never carry OAuth tokens. Reconnect with Microsoft to start syncing this account.":"Config files never carry passwords. Enter this mailbox's password to start syncing.")})]}),s.state!=="entered"&&e.jsx(f,{variant:"primary",size:"sm",disabled:n===s.accountId,icon:n===s.accountId?e.jsx(_,{className:"size-3.5 animate-spin"}):s.connector==="microsoft"?e.jsx(Oe,{className:"size-3.5"}):e.jsx(it,{className:"size-3.5"}),onClick:()=>i?.(s),children:n===s.accountId?"Redirecting…":s.connector==="microsoft"?"Reconnect":s.state==="failed"?"Try again":"Enter password"})]},s.accountId))})}function pt({accounts:t,busyAccountId:n,error:i,onOpen:s,onNext:d}){const l=t.filter(m=>m.state!=="entered").length;return e.jsx(k,{steps:y,activeStep:2,title:"These accounts need credentials",subtitle:"The config file carries servers and settings. Passwords and Microsoft sign-ins it deliberately leaves out.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:l>0?"Settings › Accounts keeps asking until every account is signed in.":"Every account can sync."}),e.jsx(f,{variant:"primary",onClick:d,children:l>0?"Finish later":"All accounts connected"})]}),children:e.jsxs("div",{className:"space-y-4",children:[i&&e.jsx(x,{tone:"danger",children:i}),l>0&&e.jsxs(x,{tone:"danger",children:[l," of ",t.length," accounts cannot sync yet. They stay listed in Settings, marked like this, until you sign in — no mail arrives for them in the meantime."]}),e.jsx(ht,{accounts:t,busyAccountId:n,onOpen:s})]})})}function ft({account:t,position:n,total:i,error:s,busy:d=!1,onBack:l,onNext:m}){return e.jsx(k,{steps:y,activeStep:2,title:`Reconnect ${t.address}`,subtitle:`Account ${n} of ${i} · Microsoft 365`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:l,children:"Back"}),e.jsx(f,{variant:"primary",disabled:d,icon:d?e.jsx(_,{className:"size-3.5 animate-spin"}):void 0,onClick:m,children:d?"Redirecting…":"Sign in with Microsoft"})]}),children:e.jsxs("div",{className:"space-y-4",children:[s&&e.jsx(x,{tone:"danger",children:s}),e.jsx(x,{tone:"info",children:"A config file never carries an OAuth token — one only works for the instance it was granted to. Signing in here mints a fresh one for this instance."}),e.jsxs("div",{className:"rounded-sm border border-line px-3 py-2.5",children:[e.jsx("p",{className:"text-sm text-fg",children:t.displayName}),e.jsxs("p",{className:"mt-0.5 text-xs text-fg-subtle",children:[t.address," · ",t.server]})]}),e.jsx("p",{className:"text-2xs text-fg-subtle",children:"You will be sent to Microsoft and returned here. If your organisation requires admin approval, the sign-in stops there and this account keeps waiting."})]})})}function gt({folders:t,onNext:n}){return e.jsx(k,{steps:y,activeStep:3,title:t.length>0?"Waiting on folders":"Import finished",subtitle:t.length>0?"The config names folders this server has not shown us yet.":"Everything in the file landed, and every folder it named resolved.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"Folder discovery runs with every sync."}),e.jsx(f,{variant:"primary",onClick:n,children:"Go to inbox"})]}),children:e.jsx("div",{className:"space-y-4",children:t.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(x,{tone:"warning",children:[t.length," settings are imported but switched off. Each turns itself on the moment its folder appears — nothing was dropped. If a folder never appears, create it in your mail client, or edit the setting in Settings → Senders & Rules."]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(nt,{className:"size-4"}),"Folder discovery runs with every sync of the account."]}),e.jsx("div",{className:"divide-y divide-line",children:t.map(i=>e.jsx(fe,{label:i.path,detail:i.waitingFor,state:"pending"},`${i.accountId??""}-${i.path}-${i.waitingFor}`))})]}):e.jsx(x,{tone:"success",children:"Every account, rule, label and sender in the file is live on this instance."})})})}function xt({failure:t,onBack:n}){return e.jsx(k,{steps:y,activeStep:0,title:t.title,subtitle:"Nothing was imported.",footer:e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-2xs text-fg-subtle",children:"This instance is unchanged."}),e.jsx(f,{variant:"primary",onClick:n,children:"Choose another file"})]}),children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(x,{tone:"danger",children:t.explanation}),e.jsx("p",{className:"text-sm text-fg",children:t.fix}),e.jsx(Y,{children:t.raw})]})})}function jt(t){return t==="landed"?"ok":t==="failed"||t==="unknown"?"failed":"pending"}function vt({results:t,message:n,raw:i,onBack:s,onNext:d}){const l=t.filter(u=>u.state==="landed").length,m=t.some(u=>u.state==="unknown");return e.jsx(k,{steps:y,activeStep:1,title:"The import stopped part-way",subtitle:m?"It did not say how far it got, so check Settings before importing again.":`${l} of ${t.length} sections landed.`,footer:e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",onClick:s,children:"Choose another file"}),e.jsx(f,{variant:"primary",onClick:d,children:"Retry the rest"})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(x,{tone:"danger",children:n}),e.jsx("p",{className:"text-sm text-fg-muted",children:"Retrying is safe: an import folds into what is already here rather than replacing it, so what landed is recognised and left alone."}),e.jsx("div",{className:"divide-y divide-line",children:t.map(u=>e.jsx(fe,{label:u.title,detail:u.detail,state:jt(u.state)},u.section))}),e.jsx(Y,{children:i})]})})}const je=(t,n)=>t?"tls":n?"starttls":"none",yt=t=>({host:t.imapHost,port:t.imapPort,security:je(t.imapTls,t.imapStartTls)}),wt=t=>({host:t.smtpEnabled?t.smtpHost:"",port:t.smtpPort,security:je(t.smtpTls,t.smtpStartTls)}),he=(t,n,i)=>{const s=t.authType==="oauthMicrosoft"?"microsoft":"imap",d=!i&&(s==="microsoft"?t.connectionState==="reauth_required":t.connectionState==="credentials_missing");return{accountId:t.accountId,address:t.email,displayName:t.displayName?.trim()||t.email,connector:s,server:`${t.imapHost}:${t.imapPort}`,state:n?"failed":d?"needed":"entered",failure:n}},bt=t=>{if(!t)return"This instance already holds configuration of its own.";const n=[["accounts","account"],["labels","label"],["filters","rule"],["addressFlags","flagged sender"]].map(([i,s])=>({count:Number(t[i]??0),noun:s})).filter(i=>i.count>0).map(i=>`${i.count} ${i.noun}${i.count===1?"":"s"}`);return n.length===0?"This instance already holds configuration of its own.":`${n.join(", ")} are set up here already.`},W=(t,n)=>{if(t instanceof Error)return t.message;if(typeof t=="object"&&t!==null){const i=t.message;if(typeof i=="string")return i}return n};function kt({onDone:t}){const n=pe(),[i,s]=r.useState("file"),[d,l]=r.useState(!1),[m,u]=r.useState(!1),[w,h]=r.useState(void 0),[j,S]=r.useState(void 0),[R,N]=r.useState(void 0),[p,b]=r.useState(void 0),[Z,ee]=r.useState("abort"),[te,se]=r.useState(void 0),[ye,K]=r.useState(void 0),[C,we]=r.useState([]),[Q,be]=r.useState([]),[g,I]=r.useState(null),[T,U]=r.useState({username:"",password:""}),[F,V]=r.useState({}),[ke,ne]=r.useState(void 0),[G,z]=r.useState(null),[B,Se]=r.useState([]),{data:$}=ze({...Be(),enabled:C.length>0||i==="folders"}),A=r.useMemo(()=>{const a=new Map;for(const o of $?.accounts??[])a.set(o.accountId,o);return a},[$]),Ne=r.useMemo(()=>C.map(a=>A.get(a)).filter(a=>!!a).map(a=>he(a,F[a.accountId],Q.includes(a.accountId))),[C,A,F,Q]),c=g?A.get(g):void 0,ie=g?C.indexOf(g)+1:0,P=q({...$e(),meta:de(409)}),ae=q({...Pe(),meta:de(403,404)}),re=q(Le()),oe=q(De());We(G!==null,()=>{n.invalidateQueries({queryKey:J()}),z(null)});const ce=He(a=>{z(null),a==="stalled"&&ne(Ue)}),Ce=r.useCallback(a=>{l(!1),u(!0),h({name:a.name,size:a.size}),N(void 0),S(void 0),a.text().then(o=>Ge(a.name,a.size,o)).then(o=>{if(u(!1),!o.ok){N(o.failure);return}S(o.document)}).catch(o=>{u(!1),N({title:"That file could not be read",explanation:`The browser could not read ${a.name} from disk, so nothing was sent.`,fix:"Check the file is still there and try again.",raw:W(o,"the file read was refused")})})},[]),L=r.useCallback((a,o)=>{j&&(K(void 0),P.mutate({body:{mode:a,onExisting:o,document:j}},{onSuccess:v=>{if(b(v),ue(v)){s("rejected");return}if(me(v)){s("partial");return}if(a==="validate"){s("review");return}if(Se(Xe(v)),n.invalidateQueries({queryKey:J()}),v.accountsNeedingCredentials.length>0){we([...v.accountsNeedingCredentials]),s("credentials");return}s("folders")},onError:v=>{const D=Je(v);if(D){K(D),se(void 0),s("conflict");return}N({title:"The import could not be sent",explanation:"The request to this instance failed before it produced a report, so nothing was written.",fix:"Check your connection and try again.",raw:W(v,"POST /config/import failed")}),s("file")}}))},[j,P,n]),Ie=r.useCallback(a=>{if(I(a.accountId),ne(void 0),a.connector==="microsoft"){s("account-oauth");return}const o=A.get(a.accountId);U({username:o?.username||a.address,password:""}),s("account-password")},[A]),Te=r.useCallback(()=>{g&&ae.mutate({path:{accountId:g},body:{password:T.password,isActive:!0}},{onSuccess:()=>{re.mutate({path:{accountId:g}}),be(a=>a.includes(g)?a:[...a,g]),V(a=>{const o={...a};return delete o[g],o}),n.invalidateQueries({queryKey:J()}),U({username:"",password:""}),I(null),s("credentials")},onError:a=>{V(o=>({...o,[g]:W(a,"The password was verified but could not be stored. Try again.")})),I(null),s("credentials")}})},[g,T.password,n,re,ae]),Re=r.useCallback(()=>{c&&(z(c.accountId),oe.mutate({body:{email:c.email}},{onSuccess:a=>{ce(),window.location.assign(a.authorizationUrl)},onError:a=>{z(null),V(o=>({...o,[c.accountId]:W(a,"Microsoft sign-in could not be started.")})),I(null),s("credentials")}}))},[c,ce,oe]),Fe=r.useCallback((a,o)=>U({username:a,password:o}),[]),Ae=r.useMemo(()=>{const a=$?.pendingImport?.folderPaths;if(!a)return B;const o=new Set(a),v=B.filter(E=>o.has(E.path)),D=a.filter(E=>!B.some(Me=>Me.path===E)).map(E=>({path:E,waitingFor:"An imported setting"}));return[...v,...D]},[$,B]),M=r.useCallback(()=>{b(void 0),K(void 0),N(void 0),h(void 0),S(void 0),ee("abort"),s("file")},[]);switch(i){case"file":return e.jsx(ot,{state:m?"reading":P.isPending?"checking":d?"dragging":"idle",file:w,ready:j!==void 0,failure:R,onChoose:Ce,onDragStateChange:l,onNext:()=>L("validate",Z)});case"rejected":return e.jsx(xt,{failure:(p&&ue(p))??R??{title:"The file could not be imported",explanation:"The import was refused and nothing was written.",fix:"Re-export the configuration and try again.",raw:"no error was reported"},onBack:M});case"conflict":return e.jsx(ut,{choice:te,held:bt(ye?.details),onChoose:se,onBack:M,onNext:()=>{if(te==="abort"){t("abandoned");return}ee("merge"),L("validate","merge")}});case"review":return e.jsx(lt,{sections:et(p?.items??[]),fileName:w?.name??"the config file",warnings:(p?.warnings??[]).map(a=>a.message),applying:P.isPending,onBack:M,onNext:()=>L("apply",Z)});case"partial":{if(!p)return e.jsx(St,{onBack:M});const a=me(p);return e.jsx(vt,{results:Ze(p),message:a?.message??"The import stopped before it finished.",raw:`${a?.code??Ye}: ${a?.message??"no message"}`,onBack:M,onNext:()=>L("apply","merge")})}case"credentials":return e.jsx(pt,{accounts:Ne,busyAccountId:G??void 0,error:ke,onOpen:Ie,onNext:()=>s("folders")});case"account-password":return c?e.jsx(Ke,{steps:y,activeStep:2,title:`Sign in to ${c.email}`,subtitle:`Account ${ie} of ${C.length} · ${c.imapHost}:${c.imapPort}`,email:c.email,username:T.username,password:T.password,error:F[c.accountId],continueLabel:"Test and continue",notice:e.jsxs("div",{className:"flex items-center gap-2 text-xs text-fg-muted",children:[e.jsx(Qe,{className:"size-3.5"}),"Server settings came from the config file — edit them in Settings if they are wrong."]}),onContinue:()=>s("account-test"),onBack:()=>{I(null),s("credentials")},onChange:Fe}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-test":return c?e.jsx(_e,{steps:y,activeStep:2,email:c.email,imapConfig:yt(c),smtpConfig:wt(c),username:T.username,password:T.password,credentialsBackLabel:"Back to the password",serversBackLabel:"Back to the password",successLabel:"Save and continue",onSuccess:Te,onBackToCredentials:()=>s("account-password"),onBackToServers:()=>s("account-password")}):e.jsx(X,{onBack:()=>t("abandoned")});case"account-oauth":return c?e.jsx(ft,{account:he(c,F[c.accountId],Q.includes(c.accountId)),position:ie,total:C.length,error:F[c.accountId],busy:G===c.accountId,onBack:()=>{I(null),s("credentials")},onNext:Re}):e.jsx(X,{onBack:()=>t("abandoned")});case"folders":return e.jsx(gt,{folders:Ae,onNext:()=>t("imported")})}}function ve({children:t,label:n,onBack:i}){return e.jsxs("div",{className:"mx-auto max-w-lg p-6",children:[e.jsx(x,{tone:"danger",children:t}),e.jsx("button",{type:"button",className:"mt-3 text-sm text-accent underline",onClick:i,children:n})]})}function X({onBack:t}){return e.jsx(ve,{label:"Go to inbox",onBack:t,children:"That account is no longer in this instance's configuration, so there is nothing left to sign in to. Open Settings › Accounts to see what is here."})}function St({onBack:t}){return e.jsx(ve,{label:"Choose another file",onBack:t,children:"The import stopped but produced no report, so nothing here can say what it wrote. Open Settings to see what this instance holds before importing again."})}function Ft(){const t=qe(),n=pe(),i=r.useCallback(s=>{st({queryClient:n,recordCompleted:()=>{s==="imported"&&t.recordEvent("config.imported")},navigateToInbox:()=>{window.location.assign("/mail")}})},[t,n]);return e.jsx(kt,{onDone:i})}export{Ft as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./index-
|
|
1
|
+
import{j as e}from"./index-BoxiBjE8.js";import{E as a}from"./EmptyState-ByZPPoBW.js";import{C as s}from"./calendar-days-BJ_20Jyk.js";function i(){return e.jsx("div",{className:"flex h-full items-center justify-center bg-surface",children:e.jsx(a,{message:"Pick an event to read it here.",icon:e.jsx(s,{className:"size-8"})})})}export{i as component};
|