(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9553],{28292:(e,t,r)=>{"use strict";r.d(t,{d5:()=>n,tg:()=>s});let s="UltiCal",a="Ultimail";function n(e){let t=e?.replace(/\s+/g," ").trim();if(t){var r;return r=function(e,t=48){let r=e.replace(/\s+/g," ").trim();return r?r.length<=t?r:`${r.slice(0,t-1).trimEnd()}…`:""}(t),`${r} - ${a}`}return"Bo\xeete mail - Ultimail"}},40200:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>p});var s=r(4208),a=r(91356),n=r(35855),i=r.n(n),o=r(19984),l=r(61554),d=r(70259),c=r(99856),m=r(4559),u=r(18747);let x={mail:"Mail",contacts:"Contacts",calendar:r(28292).tg,drive:"Drive"};function p(){return(0,s.jsx)(a.Suspense,{fallback:(0,s.jsx)("main",{className:"mx-auto max-w-lg px-4 py-16",children:(0,s.jsx)("p",{className:"text-muted-foreground",children:"Chargement…"})}),children:(0,s.jsx)(h,{})})}function h(){let e=(0,o.useSearchParams)(),t=(0,o.useRouter)(),r=e.get("token"),n=e.get("oauth"),{authenticated:p}=(0,u.v)(),h=(0,m.iX)(),f=(0,m.Dk)(),g=h.data,j=g?.project,v=g?.onboarding,b=g?.jobs??[];if((0,a.useEffect)(()=>{if(!h.data)return;let e=setInterval(()=>{h.refetch()},5e3);return()=>clearInterval(e)},[h]),(0,a.useEffect)(()=>{p&&r&&g?.invite?.status==="invited"&&t.replace(`/onboard/claim?token=${encodeURIComponent(r)}`)},[p,r,g?.invite?.status,t]),!p){let e=r?`/onboard/migration?token=${encodeURIComponent(r)}`:"/onboard/migration";return(0,s.jsxs)("main",{className:"mx-auto max-w-lg px-4 py-16",children:[(0,s.jsx)("p",{className:"text-muted-foreground",children:"Connectez-vous pour suivre votre migration."}),(0,s.jsx)(l.$,{asChild:!0,className:"mt-4",children:(0,s.jsx)(i(),{href:buildOidcLoginUrl({returnTo:e}),children:"Se connecter"})})]})}let _=g?.invite?.status==="claimed",N=!!v?.has_migration_credentials,y=_&&!v?.waiting_for_admin&&(N||(0,c.Uz)(j)||b.some(e=>"running"===e.status)),w=[{label:"Compte revendiqu\xe9",done:_,current:!_},{label:"Projet activ\xe9 par l'admin",done:_&&!v?.waiting_for_admin,current:_&&!!v?.waiting_for_admin},{label:(0,c.Uz)(j)?(0,c.q6)(j):"Autorisation Google / Microsoft",done:(0,c.Uz)(j)?!v?.waiting_for_admin&&_:N,current:_&&!v?.waiting_for_admin&&!(0,c.Uz)(j)&&!N},{label:"Import en cours",done:b.length>0&&b.every(e=>"completed"===e.status),current:y}],k=(0,c.Es)(j,v,"google"),C=(0,c.Es)(j,v,"microsoft");return(0,s.jsxs)("main",{className:"mx-auto max-w-2xl px-4 py-16",children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold",children:"Migration en cours"}),(0,s.jsxs)("p",{className:"mt-2 text-muted-foreground",children:[j?.name??"Votre migration"," — statut ",j?.status??"…",j?.delta_mode?" (sync delta post-bascule MX)":""]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(c.RU,{steps:w})}),(0,s.jsx)(c.Ri,{project:j,onboarding:v}),"success"===n&&(0,s.jsx)("p",{className:"mt-4 rounded-md bg-green-500/10 px-3 py-2 text-sm text-green-700",children:"Autorisation enregistr\xe9e. L'import d\xe9marre en arri\xe8re-plan."}),"error"===n&&(0,s.jsx)("p",{className:"mt-4 rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"\xc9chec de l'autorisation OAuth. R\xe9essayez ci-dessous."}),(0,s.jsx)("div",{className:"mt-8 space-y-6",children:0===b.length?(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:v?.waiting_for_admin?"Les jobs seront cr\xe9\xe9s apr\xe8s activation du projet par votre administrateur.":"Aucun job de migration actif pour le moment."}):b.map(e=>{let t,r;return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"font-medium",children:x[e.service]??e.service}),(0,s.jsx)("span",{className:"text-muted-foreground",children:e.status})]}),(0,s.jsx)(d.k,{value:(t=e.stats_json?.imported??0,"number"==typeof(r=e.stats_json?.estimated_total??t)&&r<=0||"number"!=typeof t||"number"!=typeof r?"completed"===e.status?100:10:Math.min(100,Math.round(t/r*100)))}),"number"==typeof e.stats_json?.imported&&(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[Math.round(e.stats_json.imported)," \xe9l\xe9ments import\xe9s","number"==typeof e.stats_json.estimated_total?` / ~${Math.round(e.stats_json.estimated_total)}`:""]}),e.error&&(0,s.jsx)("p",{className:"text-xs text-destructive",children:e.error})]},e.service)})}),(0,s.jsxs)("div",{className:"mt-8 flex flex-wrap gap-3",children:[k&&(0,s.jsx)(l.$,{variant:"outline",disabled:f.isPending,onClick:()=>{f.mutateAsync({provider:"google",invite_token:r??void 0}).then(e=>{window.location.href=e.auth_url})},children:"Autoriser Google"}),C&&(0,s.jsx)(l.$,{variant:"outline",disabled:f.isPending,onClick:()=>{f.mutateAsync({provider:"microsoft",invite_token:r??void 0}).then(e=>{window.location.href=e.auth_url})},children:"Autoriser Microsoft"}),(0,s.jsx)(l.$,{asChild:!0,variant:"secondary",children:(0,s.jsx)("a",{href:"/auth/if/flow/ulti-post-migration-security/",target:"_blank",rel:"noreferrer",children:"S\xe9curiser le compte (WebAuthn / TOTP)"})}),(0,s.jsx)(l.$,{asChild:!0,children:(0,s.jsx)(i(),{href:"/mail/inbox",children:"Ouvrir Ultimail"})})]})]})}},70259:(e,t,r)=>{"use strict";r.d(t,{k:()=>i});var s=r(4208);r(91356);var a=r(84687),n=r(58113);function i({className:e,value:t,...r}){return(0,s.jsx)(a.bL,{"data-slot":"progress",className:(0,n.cn)("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",e),...r,children:(0,s.jsx)(a.C1,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})})}},94764:(e,t,r)=>{Promise.resolve().then(r.bind(r,40200))}},e=>{e.O(0,[1909,2082,8306,5855,6958,563,4927,1754,1614,1506,7358],()=>e(e.s=94764)),_N_E=e.O()}]);