PageSourceSearch

https://anam.ma/assets/EmailInpeSettings-D9xaCs_4.js

js anam.ma collected 2026-10-02 06:28:13 UTC 12,219 bytes, 11 lines download raw bytes

1import{i as k,b8 as P,r as C,u as S,b9 as p,j as e,bt as L,C as r,a as n,g as l,b as i,b4 as A,B as h,c as j,h as N,bN as _,ba as d,bb as g}from"./index-2upL18V-.js";import{L as c}from"./loader-circle-8lBfJYzw.js";import{S as b}from"./square-DW9xzLgd.js";import{C as y}from"./clock-BrCgYvQE.js";import{C as v}from"./circle-x-Dg7bm871.js";import{I as E}from"./info-Bg89KSiM.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const q=k("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const M=k("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function K(){const{toast:t}=P(),[m,I]=C.useState(null),{data:a,isLoading:w}=S({queryKey:["/api/email-inpe/status"],refetchInterval:12e4}),x=p({mutationFn:async()=>(await g("POST","/api/email-inpe/check")).json(),onSuccess:s=>{I(s),d.invalidateQueries({queryKey:["/api/email-inpe/status"]}),s.imported>0?(t({title:"Emails importés",description:`${s.imported} demande(s) INPE importée(s) avec succès`}),d.invalidateQueries({queryKey:["/api/inpe"]})):s.errors>0?t({title:"Erreurs d'importation",description:`${s.errors} email(s) n'ont pas pu être importés`,variant:"destructive"}):t({title:"Aucun nouvel email",description:"Aucun email non lu trouvé dans la boîte INPE"})},onError:s=>{t({title:"Erreur",description:s.message||"Impossible de vérifier les emails",variant:"destructive"})}}),o=p({mutationFn:async()=>(await g("POST","/api/email-inpe/start",{intervalMinutes:(a==null?void 0:a.checkIntervalMinutes)||5})).json(),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/email-inpe/status"]}),t({title:"Service démarré",description:"La vérification périodique des emails est active"})},onError:s=>{t({title:"Erreur",description:s.message,variant:"destructive"})}}),u=p({mutationFn:async()=>(await g("POST","/api/email-inpe/stop")).json(),onSuccess:()=>{d.invalidateQueries({queryKey:["/api/email-inpe/status"]}),t({title:"Service arrêté",description:"La vérification périodique des emails est désactivée"})},onError:s=>{t({title:"Erreur",description:s.message,variant:"destructive"})}});return w?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(c,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsxs("div",{className:"p-6 space-y-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(L,{className:"h-6 w-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-semibold","data-testid":"text-page-title",children:"Intégration Email INPE"})]}),e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(l,{className:"text-lg flex items-center gap-2",children:[e.jsx(M,{className:"h-5 w-5"}),"Configuration du serveur email"]})}),e.jsx(i,{className:"space-y-4",children:a!=null&&a.configured?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Serveur IMAP"}),e.jsx("p",{className:"font-medium","data-testid":"text-email-host",children:a.emailHost})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Compte email"}),e.jsx("p",{className:"font-medium","data-testid":"text-email-user",children:a.emailUser})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Intervalle de vérification"}),e.jsxs("p",{className:"font-medium",children:["Toutes les ",a.checkIntervalMinutes," minutes"]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Statut du service"}),e.jsx("div",{children:a.running?e.jsxs(h,{variant:"default",className:"bg-green-600","data-testid":"badge-status-running",children:[e.jsx(j,{className:"h-3 w-3 mr-1"}),"Actif"]}):e.jsxs(h,{variant:"secondary","data-testid":"badge-status-stopped",children:[e.jsx(b,{className:"h-3 w-3 mr-1"}),"Arrêté"]})})]})]}):e.jsxs("div",{className:"flex items-start gap-3 p-4 bg-amber-50 dark:bg-amber-950/20 rounded-md border border-amber-200 dark:border-amber-800",children:[e.jsx(A,{className:"h-5 w-5 text-amber-600 dar
11k:text-amber-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-300",children:"Configuration requise"}),e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:"Pour activer l'importation automatique des emails INPE, configurez les variables d'environnement suivantes sur votre serveur :"}),e.jsxs("div",{className:"bg-background rounded-md p-3 text-sm font-mono space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_HOST"}),"=",e.jsx("span",{className:"text-primary",children:"mail.anam.ma"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_PORT"}),"=",e.jsx("span",{className:"text-primary",children:"993"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_USER"}),"=",e.jsx("span",{className:"text-primary",children:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_PASS"}),"=",e.jsx("span",{className:"text-primary",children:"votre_mot_de_passe"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_SECURE"}),"=",e.jsx("span",{className:"text-primary",children:"true"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_INTERVAL"}),"=",e.jsx("span",{className:"text-primary",children:"5"})," ",e.jsx("span",{className:"text-muted-foreground",children:"(minutes)"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_AUTO_START"}),"=",e.jsx("span",{className:"text-primary",children:"true"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"INPE_EMAIL_TLS_REJECT"}),"=",e.jsx("span",{className:"text-primary",children:"false"})," ",e.jsx("span",{className:"text-muted-foreground",children:"(si certificat auto-signé)"})]})]})]})]})})]}),(a==null?void 0:a.configured)&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(l,{className:"text-lg flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5"}),"Contrôle du service"]})}),e.jsx(i,{children:e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(N,{onClick:()=>x.mutate(),disabled:x.isPending,"data-testid":"button-check-emails",children:[x.isPending?e.jsx(c,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(_,{className:"h-4 w-4 mr-2"}),"Vérifier maintenant"]}),a.running?e.jsxs(N,{variant:"outline",onClick:()=>u.mutate(),disabled:u.isPending,"data-testid":"button-stop-service",children:[u.isPending?e.jsx(c,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(b,{className:"h-4 w-4 mr-2"}),"Arrêter la vérification auto"]}):e.jsxs(N,{variant:"outline",onClick:()=>o.mutate(),disabled:o.isPending,"data-testid":"button-start-service",children:[o.isPending?e.jsx(c,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(q,{className:"h-4 w-4 mr-2"}),"Démarrer la vérification auto"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(r,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-green-100 dark:bg-green-900/30",children:e.jsx(j,{className:"h-5 w-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold","data-testid":"text-total-imported",children:a.totalImported}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Importées avec succès"})]})]})})}),e.jsx(r,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-red-100 dark:bg-red-900/30",children:e.jsx(v,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold","data-testid":"text-total-errors",children:a.totalErrors}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Erreurs"})]})]})})}),e.jsx(r,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-md bg-blue-100 dar
11k:bg-blue-900/30",children:e.jsx(y,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium","data-testid":"text-last-check",children:a.lastCheckTime?new Date(a.lastCheckTime).toLocaleString("fr-FR"):"Jamais"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Dernière vérification"})]})]})})})]}),a.lastError&&e.jsx(r,{className:"border-red-200 dark:border-red-800",children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(v,{className:"h-5 w-5 text-red-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-red-700 dark:text-red-400",children:"Dernière erreur"}),e.jsx("p",{className:"text-sm text-red-600 dark:text-red-300 mt-1",children:a.lastError})]})]})})}),m&&e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(l,{className:"text-lg flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5"}),"Résultats de la dernière vérification"]})}),e.jsx(i,{children:m.details.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Aucun nouvel email trouvé"}):e.jsx("div",{className:"space-y-3",children:m.details.map((s,f)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-md border","data-testid":`email-result-${f}`,children:[s.success?e.jsx(j,{className:"h-4 w-4 text-green-500 flex-shrink-0 mt-1"}):e.jsx(v,{className:"h-4 w-4 text-red-500 flex-shrink-0 mt-1"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-sm truncate",children:s.emailSubject}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["De: ",s.emailFrom]}),s.requestNumber&&e.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:["Demande créée: ",s.requestNumber]}),s.error&&e.jsxs("p",{className:"text-xs text-red-600 dark:text-red-400 mt-1",children:["Erreur: ",s.error]})]})]},f))})})]}),e.jsxs(r,{children:[e.jsx(n,{children:e.jsxs(l,{className:"text-lg flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5"}),"Comment ça fonctionne"]})}),e.jsx(i,{children:e.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Le service vérifie périodiquement la boîte email INPE et importe automatiquement les nouvelles demandes :"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-2 ml-2",children:[e.jsx("li",{children:"Connexion au serveur Exchange via IMAP"}),e.jsx("li",{children:"Lecture des emails non lus dans la boîte de réception"}),e.jsx("li",{children:"Extraction des informations (nom, prénom, CNIE, etc.) depuis le corps de l'email"}),e.jsx("li",{children:"Téléchargement des pièces jointes PDF"}),e.jsx("li",{children:"Création automatique de la demande INPE dans le système"}),e.jsx("li",{children:"Marquage de l'email comme lu"})]}),e.jsxs("p",{className:"mt-4",children:["Les demandes importées par email apparaissent avec le statut ",e.jsx(h,{variant:"secondary",children:"Nouveau"})," dans la page INPE - Bureau d'ordre, prêtes à être vérifiées et transmises."]}),e.jsx("p",{children:`Les champs non reconnus dans l'email seront pré-remplis avec "À compléter" et pourront être modifiés manuellement.`})]})})]})]})]})}export{K as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.