1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[3155],{99162:(e,t,a)=>{a.d(t,{L:()=>E});var l=a(58168),n=a(15001),i=a(18427),s=a(41575),r=a(96540),o=a(80284),m=a(87331),d=a(95093),c=a.n(d),u=a(58065),v=a(85838);var p=a(26336),f=a(72715);const g=(0,o.A)((e=>{let{spacingNumber:t}=e;return(0,v.A)({field:{display:"flex",alignItems:"center"},input:{},container:{},button:{marginLeft:t(2)}})})),E=e=>{let{field:t,form:a,placeholder:o,minDate:d,maxDate:v,clearable:E,classes:y={},views:h,textFieldProps:I,error:x}=e;const[A,N]=(0,r.useState)(!1),b=g({classes:y}),C=(0,r.useCallback)((e=>{a.setFieldValue(t.name,e),a.setFieldTouched(t.name)}),[a,t]),M=(0,r.useCallback)((()=>{a.setFieldValue(t.name,null),a.setFieldTouched(t.name)}),[a,t]),D=t.value&&c()(t.value);return r.createElement("div",{className:b.container},r.createElement("div",{className:b.field},r.createElement(s.$,{dateAdapter:n.A},r.createElement(i.l,{views:h,minDate:d,maxDate:v,className:null==b?void 0:b.input,renderInput:e=>r.createElement(m.TextField,(0,l.A)({},I,e,{placeholder:o,value:(null==D?void 0:D.format("DD MMMM YYYY"))||"",onClick:()=>N(!0)})),open:A,onClose:()=>N(!1),value:null!=D?D:null,onChange:C})),E&&t.value&&r.createElement(m.Button,{color:p.i[f.A].controlPrimary,className:b.button,onClick:M},r.createElement(u.A,{id:"Main.lang.clear",defaultMessage:"Effacer"}))),x&&r.createElement(m.Typography,{component:"p",variant:"helper",color:"danger"},x))}},46214:(e,t,a)=>{a.d(t,{L:()=>u,Y:()=>c});var l=a(58168),n=a(96540),i=a(6442),s=a(10777),r=a(87331),o=a(80284),m=a(85838);const d=(0,o.A)((e=>{let{spacingNumber:t}=e;return(0,m.A)({error:{alignSelf:"start"}})})),c=e=>{let{classes:t={},className:a,field:o,step:m,placeholder:c,error:u,multiline:v,fullWidth:p,cssSelector:f,form:g,variant:E,type:y,disabled:h,tabsAsIndent:I,onChange:x,rows:A,onKeyDown:N,debounceDelay:b=400,...C}=e;const M=(0,n.useRef)(null),D=d({classes:t}),{formatMessage:T}=(0,i.A)(),{name:w,value:L,onBlur:k}=o,[F,S]=(0,n.useState)(L),_=e=>{g.setFieldValue(w,e),g.setFieldTouched(w,!0),"function"==typeof x&&x(e)},[V]=(0,s.A)((0,n.useCallback)(_,[g]),b),z=(0,n.useCallback)((e=>{S(e.target.value),b?V(e.target.value):_(e.target.value)}),[V]),P=(0,n.useCallback)((e=>{if(I&&"Tab"===e.key){e.preventDefault(),e.stopPropagation();const{selectionStart:t,selectionEnd:a}=e.currentTarget,l=!Number.isNaN(Number(t))&&t||0,n=!Number.isNaN(Number(a))&&a||0,i=`${F.substring(0,null!=l?l:0)} ${F.substring(null!=n?n:0)}`;S(i),V(i),M.current&&(M.current.value=i,M.current.selectionStart=M.current.selectionEnd=l+4)}"function"==typeof N&&(e.persist(),N(e))}),[F,V]);return(0,n.useEffect)((()=>{S(L)}),[L]),n.createElement(n.Fragment,null,n.createElement(r.TextField,(0,l.A)({},C,{variant:"flat",inputRef:M,id:`${m||"step"}_form_${f||w}`,onChange:z,onKeyDown:P,value:F||"",placeholder:c&&T(c)},v&&{rows:A||4},{disabled:h,fullWidth:p,error:u,className:a,multiline:v,onBlur:k,name:w,type:y})),u&&n.createElement(r.Typography,{classes:{container:D.error},component:"p",variant:"helper",color:"danger",id:`error_${f}`},u))},u=e=>n.createElement(c,(0,l.A)({multiline:!0,fullWidth:!0},e))},85851:(e,t,a)=>{a.r(t),a.d(t,{default:()=>Ve});
1var l=a(96540),n=a(56347),i=a(87456),s=a(730),r=a(14166),o=a(41088),m=a(85411),d=a(76929),c=a(52893),u=a(63375),v=a.n(u),p=(a(5994),a(30261)),f=a(95093),g=a.n(f),E=a(3451),y=(a(85090),a(58065)),h=a(6442),I=a(54625),x=a(6325),A=a(87331),N=a(64330),b=a(33722);var C=a(76525),M=a(44e3),D=a(67713),T=(a(6170),a(82092)),w=a(97701),L=a(26336),k=a(72715),F=a(765),S=a(70038),_=a(24977),V=a(44802),z=a(7708),P=a(51476);const j=(0,P.defineMessages)({SERVER_ERROR:{id:"TestInvitations.Request.Error.SERVER_ERROR",defaultMessage:"Une erreur est survenue lors de la création de votre requête, merci de nous contacter ou de rééssayer."},DENY_NEED_BIGGER_PLAN:{id:"TestInvitations.Request.Error.DENY_NEED_BIGGER_PLAN",defaultMessage:"Votre abonnement actuel ne vous permet pas d'envoyer plus d'invitations."},DENY_NEED_PLAN:{id:"TestInvitations.Request.Error.DENY_NEED_PLAN",defaultMessage:"Un abonnement aux tests est requis"},DENY_NEED_EMAIL:{id:"TestInvitations.Request.Error.DENY_NEED_EMAIL",defaultMessage:"L'email du candidat est introuvable. Contactez-nous pour plus d'information."},DENY_QUOTA:{id:"TestInvitations.Request.Error.DENY_QUOTA",defaultMessage:"Vous n'avez pas assez de quota pour envoyer cette invitation. Contactez-nous pour plus d'information."},unknown:{id:"TestInvitations.Request.Error.unknown",defaultMessage:"Erreur inconnue"}});var q=a(5546),B=a(39033),R=a(68729),$=a(71070);const O=e=>{var t,a,n,i,s;let{testId:r}=e;const{locale:o}=(0,$.t)(),{data:m}=(0,D.R)(r,"test");return l.createElement(A.Typography,{component:"li"},null!==(t=null==m||null===(a=m.langContent)||void 0===a||null===(n=a[o])||void 0===n?void 0:n.name)&&void 0!==t?t:null==m||null===(i=m.langContent)||void 0===i||null===(s=i.fr)||void 0===s?void 0:s.name)},W=e=>{var t,a;let{testInvitation:n}=e;const{data:i}=(0,D.R)(null==n?void 0:n.devId,"developer");return l.createElement(A.Typography,{component:"li"},null!==(t=null!==(a=n.emailAddress)&&void 0!==a?a:null==i?void 0:i.firstName)&&void 0!==t?t:"")},Y=e=>{let{alreadyExistingSessions:t,onConfirm:a}=e;return l.createElement(R.GenericConfirmDialog,{color:"indigo",open:!0,onConfirm:a,title:l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.AlreadyExisting.title",defaultMessage:"Duplication d'invitations"}),content:l.createElement("div",null,l.createElement(A.Typography,null,l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.AlreadyExisting.title",defaultMessage:"Ces sessions ne sont pas terminées. Vous pouvez demander un renvoi du mail au développeur pour les sessions en cours dans les actions du tableau récapitualtif des QCM."})),l.createElement("ul",{className:"list-disc list-inside p-1"},t.map((e=>{let{testInvitation:t,sessions:a}=e;return l.createElement(l.Fragment,null,l.createElement(W,{testInvitation:t}),l.createElement("ul",{className:"ml-2 list-disc list-inside"},a.map((e=>{let{testId:a,sessionId:n}=e;return l.createElement(O,{key:`${t.devId}_${n}`,testId:a})}))))}))))})},Q=e=>{let{candidate:t,invitation:a}=e;return l.createElement(l.Fragment,null,l.createElement(A.Typography,{variant:"h3",component:"h3"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.candidates",defaultMessage:"Candidats"})),l.createElement(A.Typography,{variant:"body2",className:"mt-1"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.notice",defaultMessage:"Un e-mail sera directement envoyé au dévelopeur avec les liens des sessions à passer. Vous pourrez voir son avancement dans le tableau"})),l.createElement(A.Typography,{variant:"body2",className:"mt-1"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.singleDev",defaultMessage:"Vos tests seront envoyés à ce développeur : "})),l.createElement("div",{className:"w-full flex flex-col items-start my-2"},l.createElement(A.Typography,null,[t.emailAddress,t.name].filter(Boolean).join(" - "))))};var U=a(56655),G=a(58156),J=a.n(G),H=a(67034),K=a(80284),X=a(46214);const Z=(0,P.defineMessages)({namePlaceholder:{id:"Invitations.CreateInvitationDialog.form.name.placeholder",defaultMessage:"Nom (ex : Jean Deau)"},name:{id:"Main.lang.name",defaultMessage:"Nom"},eMail:{id:"Main.lang.emailAddress",defaultMessage:"Adresse email"},deadline:{id:"Invitations.CreateInvitationDialog.form.deadline",defaultMessage:"Date limite"}});var ee=a(85838);const te=(0,K.A)((e=>{let{spacingNumber:t}=e;return(0,ee.A)({candidatesField:{marginTop:t(1),display:"flex",flexDirection:"column"},row:{margin:t(2.5,0),display:"flex"},fieldsContainer:{display:"flex",flexWrap:"wrap"},deleteButton:{alignSelf:"flex-end"},formField:{minWidth:270,margin:t(0,2)}
1,fieldLabel:{padding:t(1)},addCandidateButton:{marginLeft:t(2)},"@media all and (min-width: 1279px)":{fieldsContainer:{flex:"1 1 auto"},formField:{width:`calc(50% - ${t(4)}px)`}},"@media all and (max-width: 1279px)":{row:{alignItems:"center",padding:t(2),borderRadius:5,margin:t(2),border:"2px solid #f3f3f3"},fieldsContainer:{flexDirection:"column",flexWrap:"unset",flex:"1 1 auto"},deleteButton:{alignSelf:"unset"},formField:{minWidth:"unset"}}})})),ae=e=>{let{classes:t={},errors:a,formValues:i}=e;const s=te({classes:t}),r=(0,n.zy)(),[o,m]=(0,l.useState)(!1);(0,l.useEffect)((()=>{localStorage.setItem(`${r.pathname}${r.search}`,JSON.stringify(i.invitees||{}))}),[i]);const d=(0,l.useCallback)(((e,t)=>{var a;t("invitees",(null!==(a=e.target.value)&&void 0!==a?a:"").split("\n").map((e=>e.trim())).map((e=>({emailAddress:e}))))}),[]);return l.createElement(l.Fragment,null,l.createElement(A.Typography,{variant:"h3",component:"h3"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.candidates",defaultMessage:"Candidats"})),l.createElement(A.Typography,{variant:"body2",className:"mt-1"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.notice",defaultMessage:"Un e-mail sera directement envoyé au dévelopeur avec les liens des sessions à passer. Vous pourrez voir son avancement dans le tableau"})),o&&l.createElement(p.FieldArray,{name:"invitees",render:e=>l.createElement("div",{className:"flex flex-col"},l.createElement(A.Typography,{variant:"body2",className:"mt-2"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.candidates.quick.title",defaultMessage:"Ajoutez un email de candidat par ligne"})),l.createElement(A.TextField,{className:"mt-2",multiline:!0,variant:"flat",fullWidth:!0,rows:8,onChange:t=>d(t,e.form.setFieldValue),value:i.invitees.map((e=>{let{emailAddress:t}=e;return t})).join("\n")}),a.invitees&&l.createElement(A.Typography,{variant:"helper",color:"danger"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.candidates.quick.error",defaultMessage:"Erreur dans la liste des invités"})),l.createElement("div",{className:"flex items-center flex-wrap"},l.createElement(A.Button,{onClick:()=>m(!1),size:"small",color:L.i[k.A].controlPrimary},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.candidates.classic.button",defaultMessage:"Mode Classique"}))))}),!o&&l.createElement(p.FieldArray,{name:"invitees",render:e=>l.createElement("div",{className:s.candidatesField},i.invitees.map(((t,n)=>l.createElement("div",{className:s.row},l.createElement("div",{className:s.fieldsContainer},l.createElement("div",{className:s.formField},l.createElement(A.Typography,{variant:"label",component:"div",className:s.fieldLabel},l.createElement(y.A,Z.eMail)),l.createElement(p.FastField,{error:J()(a,`invitees.[${n}].emailAddress`),placeholder:Z.eMail,fullWidth:!0,variant:"flat",name:`invitees.[${n}].emailAddress`,component:X.Y})),l.createElement("div",{className:s.formField},l.createElement(A.Typography,{variant:"label",component:"div",className:s.fieldLabel},l.createElement(y.A,Z.name)),l.createElement(p.FastField,{error:J()(a,`invitees.[${n}].name`),placeholder:Z.namePlaceholder,fullWidth:!0,variant:"flat",name:`invitees.[${n}].name`,component:X.Y}))),l.createElement(U.A,{title:l.createElement(y.A,{id:"Main.lang.delete",defaultMessage:"Supprimer"})},l.createElement(A.Button,{className:"ml-1 self-end",onClick:()=>e.remove(n),color:"danger",size:"small"},l.createElement(H.default,null)))))),l.createElement("div",{className:"flex items-center flex-wrap"},l.createElement(A.Button,{className:s.addCandidateButton,color:L.i[k.A].controlPrimary,size:"small",variant:"contained",onClick:()=>e.push({})},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.addCandidate",defaultMessage:"Ajouter un candidat"})),l.createElement(A.Button,{onClick:()=>m(!0),size:"small",color:L.i[k.A].controlPrimary},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.candidates.quick.button",defaultMessage:"Mode rapide"}))))}))};var le=a(99162);const ne=e=>{let{errors:t,formValues:a}=e;const{formatMessage:n}=(0,h.A)();return l.createElement(l.Fragment,null,l.createElement(A.Typography,{variant:"h3",component:"h3"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.date",defaultMessage:"Date limite"})),l.createElement(A.Typography,{variant:"helper"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.date.subtitle",defaultMessage:"Vous pouvez spécifier une date limite pour répondre aux QCMs. Celle-ci est facultative."})),l.createElement("div",{className:"py-2 px-1 min-w-[230px] flex items-center"},l.createElement(p.FastField,{fullWidth:!0,error:J()(t,"deadline"),clearable:!0,minDate:g()(),textFieldProps:{variant:"flat",placeholder:n(Z.deadline)},name:"deadline",component:le.L})))};var ie=a(38113);const se=e=>{var t;let{recruiterEmail:a,form:i,remove:s,push:r,name:o}=e;const m=(0,n.zy)(),{errors:d,values:c,setFieldValue:u}=(0,p.useFormikContext)();(0,l.useEffect)((()=>{localStorage.setItem(`emails-${m.pathname}${m.search}`,c.emails.join(",")||"")}),[c.emails]);const v=(0,l.useCallback)((e=>{const t=e.trim().split(",").map((e=>e.trim()));t.every((e=>e.match(ie.Iz)))&&(t.forEach((e=>r(e))),i.setFieldValue("emailInputValue",null))}),[i,r]),f=(0,l.useCallback)((e=>{const t=e.target.value;"Enter"!==e.key&&"Tab"!==e.key||""===t.trim()||v(t)}),[]),g=(0,l.useCallback)((()=>{const e=i.values.emailInputValue;v(e)}),[i]),E=(0,l.useMemo)((()=>"string"==typeof d.emails?d.emails:null),[d.emails]);return l.createElement(l.Fragment,null,l.createElement(A.Typography,{variant:"h3",component:"h3"},l.createElement(y.A,{defaultMessage:"E-mails pour les résultats",id:"Invitations.CreateInvitationDialog.form.emailsCopy"})),l.createElement(A.Typography,{variant:"helper"},l.createElement(y.A,{defaultMessage:"Vous pouvez spécifier plusieurs e-mails.",id:"Invitations.CreateInvitationDialog.form.emailsCopy.subtitle"})),l.createElement("div",{className:"flex flex-col items-center w-full px-1 py-2"},l.createElement("div",{className:"flex justify-between w-full gap-2"},l.createElement(p.FastField,{name:"emailInputValue",fullWidth:!0,variant:"flat",placeholder:Z.eMail,onKeyDown:f,debounceDelay:0,component:X.Y,error:i.errors.emailInputValue}),l.createElement(A.Button,{onClick:g,variant:"outlined",color:"codersTestsSecondary",className:"px-4 my-0 min-w-24 md:min-w-0"},l.createElement(y.A,{defaultMessage:"Ajouter",id:"Main.lang.add"}))),E&&l.createElement(A.Typography,{classes:{container:"items-start self-start"},component:"p",variant:"helper",color:"danger",id:"error_emails"},E),"object"==typeof d.emails&&l.createElement(A.Typography,{classes:{container:"items-start self-start"},component:"p",variant:"helper",color:"danger",id:"error_emails_object"},l.createElement(y.A,{defaultMessage:"Erreur dans la liste des e-mails",id:"Invitations.CreateInvitationDialog.form.emailsCopy.error"}))),l.createElement("div",{className:"flex flex-wrap items-center justify-start gap-1 mt-1"},null===(t=c.emails)||void 0===t?void 0:t.map(((e,t)=>{var a;return l.createElement(A.Tag,{className:""+("object"==typeof d.emails&&null!==(a=d.emails)&&void 0!==a&&a[t]?"bg-danger-500":""),color:"codersTestsPrimary",key:`email-${e}-${t}`,onDelete:()=>s(t)},e)})),0===c.emails.length&&a&&l.createElement(A.Typography,{className:"mt-0",variant:"helper"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.emailsCopy.default",defaultMessage:"Votre adresse e-mail {recEmail} sera utilisée par défaut.",values:{recEmail:a}}))))};var re=a(68463),oe=a(44377),me=a.n(oe),de=a(81529),ce=a(51940);const ue=(0,P.defineMessages)({testAutocompletePlaceHolder:{id:"Invitations.CreateInvitationForm.SelectedTEst.autocomplete.placeholder",defaultMessage:"Filtrer (ex: React, Java)"}}),ve=(0,K.A)((e=>{let{spacingNumber:t}=e;return(0,ee.A)({deleteIcon:{},deleteIconButton:{marginLeft:t(1.5),display:"flex"}
1,title:{display:"flex",alignItems:"center",padding:t(2,2,2,0)},chips:{marginLeft:t(2),display:"flex",flexWrap:"wrap",alignItems:"center"},chip:{margin:t(0,1)},confirmDialogContainer:{padding:t(1),display:"flex",alignItems:"center",flexDirection:"column",textAlign:"center",justifyContent:"center"},dialogButton:{padding:t(2)},testsInfos:{width:"100%",display:"flex",flexWrap:"wrap",maxHeight:600,height:600},addButton:{marginLeft:t(2)},testsList:{height:125,flex:"1 1 auto",overflowY:"auto",padding:t(2),backgroundColor:"#F9F9F9",borderRadius:5,border:"1px solid #f0f0f0"},testListItem:{},testListItemLogo:{marginRight:t(1)},companyLogo:{extend:"testListItemLogo",borderRadius:100,width:35,backgroundColor:"transparent"},testListItemName:{flex:"1 1 auto"},listItem:{display:"flex",alignItems:"center",width:"100%"},textField:{marginBottom:t(2)},noTestSelected:{alignItems:"center",justifyContent:"center"},selectedTestCard:{width:`calc(75% - ${t(2)}px)`,overflow:"hidden",marginLeft:t(2),display:"flex",flexDirection:"column",padding:t(2),backgroundColor:"#F9F9F9",borderRadius:5,border:"1px solid #f0f0f0"},testListCard:{width:"25%",display:"flex",flexDirection:"column"},fieldLabel:{},"@media all and (max-width: 1279px)":{testsInfos:{flexDirection:"column"},selectedTestCard:{width:"100%",marginLeft:"unset",flex:"1 1 auto"},testListCard:{width:"100%",marginBottom:t(2),alignItems:"flex-start"},testListItem:{width:"15%"},testsList:{display:"flex",flexWrap:"wrap"}}})})),pe=e=>{let{value:t,onDelete:a}=e;const n=ve({}),{name:i}=(0,ce.a)(t);return l.createElement(A.Tag,{className:n.chip,onDelete:a,color:L.i[k.A].controlPrimary},i)},fe=e=>{let{items:t,onChipDelete:a}=e;const n=ve({});return l.createElement("div",{className:n.chips},t.map(((e,t)=>l.createElement(pe,{key:`chip_sort_${e}_${t}`,value:e,onDelete:()=>a(t),index:t,classes:n}))))},ge=e=>{var t,a,n,i;let{error:s,cssSelector:r,form:o,field:m,companyId:d}=e;const c=ve({}),{formatMessage:u,locale:v}=(0,h.A)(),{testsList:p}=(0,de.O)(d),[f,g]=(0,l.useState)(null),{testDetails:E}=(0,T.Xk)(f),[x,N]=(0,l.useState)(""),b=(null==o||null===(t=o.values)||void 0===t||null===(a=t.testIds)||void 0===a?void 0:a.length)>0,C=(0,l.useMemo)((()=>{const e=Object.entries(p||{}).filter((e=>{let[t,{canBeSent:a,hidden:l}]=e;return"requests"!==t&&a&&!l}));return me()(e)}),[p]),M=(0,l.useMemo)((()=>Object.entries(C||{}).map((e=>{let[t,{testName:a,addedAt:l}]=e;return{testId:t,isCompanyTest:!0,name:a,addedAt:l||0}}))),[C]),D=(0,l.useCallback)((()=>{o.setFieldValue(m.name,[...m.value||[],f]),g(null)}),[JSON.stringify(m.value),f]);(0,l.useEffect)((()=>{E&&D()}),[E,D]);const w=(0,l.useCallback)((e=>{o.setFieldValue(m.name,(m.value||[]).filter(((t,a)=>a!==e)))}),[JSON.stringify(m.value)]),F=(0,l.useMemo)((()=>M.filter((e=>{let{name:t}=e;return t.toLowerCase().includes(x.toLowerCase())})).sort(((e,t)=>t.addedAt-e.addedAt))),[M,x]);return l.createElement("div",null,l.createElement("div",{className:c.title},l.createElement(A.Typography,{variant:"h3",component:"h3",className:c.fieldLabel},!m.value.length&&l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.pickTest",defaultMessage:"Choisir un QCM"}),m.value.length>0&&l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.selectedTests.v2",defaultMessage:"Test sélectionné :"})),l.createElement(fe,{items:null!==(n=m.value)&&void 0!==n?n:[],onChipDelete:w})),!m.value.length&&l.createElement(A.Typography,{variant:"helper"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.pickTest.subtitle",defaultMessage:"Sélectionnez un des QCMs que vous avez créé pour l'envoyer à vos candidats."})),m.value.length>0&&l.createElement(V.a,{testId:null==o||null===(i=o.values)||void 0===i?void 0:i.testIds[0],companyId:d,canEditSesstings:!0}),s&&l.createElement(A.Typography,{component:"p",variant:"helper",color:"danger",id:`error_${r}`},s),l.createElement("div",{className:"w-full"},Object.entries(C||{}).length?l.createElement(l.Fragment,null,!b&&l.createElement(A.List,{className:"max-h-40 h-fit flex-auto overflow-y-auto rounded-md border border-dark-50 bg-[#F9F9F9] mt-2 custom-scrollbar"},l.createElement(re.A,{component:"div",className:"flex items-center py-2 justify-between w-full border-[#f0f0f0] bg-[#F9F9F9] shadow-md shadow-dark-50"},l.createElement(A.TextField,{className:"w-full max-w-[300px] h-4 bg-light-500",variant:"flat",fullWidth:!0,placeholder:u(ue.testAutocompletePlaceHolder),value:x,onChange:e=>N(e.target.value)})),!F.length&&l.createElement(A.ListItem,{className:"justify-center"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.testList.noTests",defaultMessage:"Aucun test ne correspond à votre recherche"})),F.filter((e=>{let{testId:t}=e;return!(m.value||[]).includes(t)})).map(((e,t)=>l.createElement(A.ListItem,{key:`autocomplete_tests_${e.testId}`,classes:{typography:c.listItem},className:(t%2==0?"bg-light-500":"bg-codersTestsPrimary-50/20")+" rounded-none hover:bg-codersTestsPrimary-50 w-full justify-between cursor-pointer",onClick:t=>{t.stopPropagation(),t.preventDefault(),g(e.testId)}},l.createElement("div",{className:"flex w-full"},l.createElement(A.Tooltip,{title:l.createElement(A.Typography,{className:"text-xs text-light-500"},e.name),placement:"top"},l.createElement(A.Typography,{className:"flex truncate"},e.name))),l.createElement(A.Typography,{className:"flex flex-col text-sm sm:hidden"},l.createElement(y.A,{defaultMessage:"Ajouté le {date}",id:"Invitations.CreateInvitationDialog.form.testList.addedAt",values:{date:l.createElement("span",{className:"text-sm font-medium whitespace-nowrap min-w-[130px] text-left"},new Date(e.addedAt).toLocaleDateString(v,{day:"numeric",month:"long",year:"numeric"}))}}))))))):l.createElement(A.Typography,{component:"div",variant:"h4",className:"flex flex-col items-center justify-center"},l.createElement(y.A,{id:"CompanyTests.List.NoTests.title",defaultMessage:"Vous n'avez pas encore créé de tests entreprise !"}))),!b&&l.createElement("div",{className:"flex flex-col items-center w-full my-1"},Object.entries(C||{}).length&&l.createElement("div",{className:"max-w-[300px] w-full flex gap-2 items-center flex-nowrap"},l.createElement("div",{className:"w-full h-[1px] bg-dark-100"}),l.createElement(A.Typography,{className:"text-sm text-dark-300"},l.createElement(y.A,{id:"Main.lang.or",defaultMessage:"ou"})),l.createElement("div",{className:"w-full h-[1px] bg-dark-100"})),l.createElement(I.N_,{to:"/test-builder",className:"max-w-[300px] w-full m-0"},l.createElement(A.Button,{variant:"contained",color:L.i[k.A].controlPrimary,className:"w-full mx-0 my-1/2"},l.createElement(y.A,{id:"Tests.Header.Creator.CreateTest",defaultMessage:"Créer un test"})))))};var Ee=a(83379);const ye=e=>{var t,a;let{devId:n,invitation:i}=e;const{data:s}=(0,D.R)(n,"developer"),r=(0,l.useMemo)((()=>s&&null!=s&&s.id?`/user/${(null==s?void 0:s.seoAlias)||(null==s?void 0:s.id)}`:null),[s]),o=(0,l.useMemo)((()=>(null==s?void 0:s.firstName)||(null==i?void 0:i.name)||(null==i?void 0:i.emailAddress)),[s,i]);return l.createElement(l.Fragment,null,l.createElement(A.Typography,{variant:"h3",component:"h3"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.candidates",defaultMessage:"Candidats"})),l.createElement(A.Typography,{variant:"body2",className:"mt-1"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.notice",defaultMessage:"Un e-mail sera directement envoyé au dévelopeur avec les liens des sessions à passer. Vous pourrez voir son avancement dans le tableau"})),l.createElement(A.Typography,{variant:"body2",className:"mt-1"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.singleDev",defaultMessage:"Vos tests seront envoyés à ce développeur : "})),l.createElement("div",{className:"flex flex-col items-start w-full my-2"},r?l.createElement(I.N_,{to:r},l.createElement("div",{className:"flex items-center group"},l.createElement(Ee.VU,{noLazyLoad:!0,className:"w-5 h-5 mr-2",config:null==s?void 0:s.avatar,handle:null==s||null===(t=s.profilePic)||void 0===t?void 0:t.handle}),l.createElement(A.Typography,{className:"group-hover:text-indigo-500"},o))):l.createElement("div",{className:"flex items-center"},l.createElement(Ee.VU,{noLazyLoad:!0,className:"w-5 h-5 mr-2",config:null==s?void 0:s.avatar,handle:null==s||null===(a=s.profilePic)||void 0===a?void 0:a.handle}),l.createElement(A.Typography,null,o))))};var he=a(77037),Ie=a(37071),xe=a(30799),Ae=a(46831),Ne=a(85496);const be=(0,P.defineMessages)({talkusPlan:{id:"Tests.Invitations.Limits.talkusPlan",defaultMessage:"Bonjour, j'ai un problème avec mon abonnement. Je ne peux plus envoyer de QCMs à mes candidat·es"}}
1),Ce={planLimit:(0,P.defineMessages)({freeTier:{id:"Tests.Invitations.Limits.Dialog.PlanLimit.freeTier",defaultMessage:"Vous utilisez actuellement l'offre gratuite, pour envoyer plus de QCMs, veuillez souscrire à une offre."},payAsYouGo:{id:"Tests.Invitations.Limits.Dialog.PlanLimit.quotas",defaultMessage:"Votre abonnement vous permet d'inviter jusqu'à {planLimit, plural, =0 {# candidat·e} one {# candidat·e} other {# candidat·es}}."},unlimited:{id:"Tests.Invitations.Limits.Dialog.PlanLimit.unlimited",defaultMessage:"{ allTimeCandidatesCount } / â candidat·es testés"},monthlyQuota:{id:"Tests.Invitations.Limits.Dialog.PlanLimit.monthlyQuota",defaultMessage:"Votre abonnement vous permet d'inviter jusqu'à {planLimit, plural, =0 {# candidat·e} one {# candidat·e} other {# candidat·es}} par mois"},unknown:{id:"Tests.Invitations.Limits.Dialog.PlanLimit.unknown",defaultMessage:"Votre abonnement actuel ne vous permet pas d'envoyer de QCMs. "}})},Me=e=>{let{open:t,onClose:a,companyId:n,invitees:s}=e;const{formatMessage:r}=(0,h.A)(),{companyTestPlansLimits:o}=(0,i.G)(n||""),m=null==o?void 0:o.monthlyQuota,d=null==o?void 0:o.monthlyUsage,c=null==o?void 0:o.totalUsage,u=null==o?void 0:o.billingMode,v=(0,l.useMemo)((()=>"freeTier"===u?c:d),[]),p=(0,l.useMemo)((()=>u?m?"unlimited"===m?l.createElement(A.Typography,{className:"text-lg"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.Error",defaultMessage:"Une erreur est survenue, merci de nous contacter."})):l.createElement("div",{className:"w-full flex flex-col"},s?l.createElement(A.Typography,{className:"my-1"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.Invitees",defaultMessage:"Il vous <b>reste {invitationsLeft, plural, =0 {# invitation} one {# invitation} other {# invitations}}</b> disponible mais vous essayez d'inviter <b>{nbInvitees, plural, =0 {# nouveau·elle candidat·e} one {# nouveau·elle candidat·e} other {# nouveau·elles candidat·es}}.</b>",values:{invitationsLeft:Math.max(m-(null!=v?v:0),0),nbInvitees:null==s?void 0:s.length}})):l.createElement(A.Typography,{className:"my-1"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.NoSlot",defaultMessage:"Il vous <b>reste {invitationsLeft, plural, =0 {# invitation} one {# invitation} other {# invitations}}</b> disponible.",values:{invitationsLeft:Math.max(m-(null!=v?v:0),0)}}))):l.createElement(A.Typography,{className:"text-lg"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.Content",defaultMessage:"Vous avez atteint la limite de votre abonnement."})):null),[u,m,v,s]);return l.createElement(he.A,{open:t,onClose:a},l.createElement(Ae.A,null,l.createElement(A.Typography,{className:"text-xl"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.Title",defaultMessage:"Vous ne pouvez plus envoyer de tests"}))),l.createElement(xe.A,{className:"overflow-visible pb-0 flex flex-col"},l.createElement(A.Typography,{className:"text-lg"},r(Ce.planLimit[u||"unknown"],{planLimit:m})),p,l.createElement("div",{className:"w-full flex flex-col items-center my-2"},l.createElement(I.N_,{to:"/plans"},l.createElement(A.Button,{variant:"contained",size:"small",color:"indigo",className:"mx-1/2"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.UpdatePlan",defaultMessage:"Mettre à jour mon abonnement"}))),l.createElement(A.Typography,null,l.createElement(y.A,{id:"Main.lang.or",defaultMessage:"ou"})),l.createElement(Ne.w,{message:r(be.talkusPlan)},l.createElement(A.Button,{variant:"outlined",size:"small",color:"indigo",onClick:a,className:"mx-1/2"},l.createElement(y.A,{id:"Tests.Invitations.Limits.Dialog.ContactUs",defaultMessage:"Contacter le support"}))))),l.createElement(Ie.A,null,l.createElement(A.Button,{color:"indigo",onClick:a},l.createElement(y.A,{id:"Main.lang.close",defaultMessage:"Fermer"}))))};var De=a(68561),Te=a(49170);const we=(e,t)=>De.object().nullable().shape({...t?{}:{invitees:De.array(De.object({emailAddress:De.string().email(e(Te.A.email)).required(e(Te.A.required))}))},deadline:De.object().required(e(Te.A.required)).test("is-in-future",e(Te.A.dateInFuture),(e=>null==e||g()(e).isAfter(g()()))),testIds:De.array().min(1,e(Te.A.minArray,{min:1})).required(e(Te.A.required)),emails:De.array().of(De.string().email(e(Te.A.email)).required(e(Te.A.required))),emailInputValue:De.string().nullable().email(e(Te.A.email))});var Le=a(62095);const ke=e=>{let{onClick:t,formValues:a,errors:n,availableQuota:i}=e;const s=(0,l.useMemo)((()=>a.invitees.length),[JSON.stringify(a)]),r=(0,l.useMemo)((()=>!s||"unlimited"!==i&&i<s),[s,i]);return l.createElement("div",{className:"flex flex-col w-full items-center justify-center"},"unlimited"!==i&&i<s&&l.createElement(A.Banner,{type:"warning",className:"w-full z-10 flex flex-col p-2 justify-center items-center"},l.createElement(A.Typography,{variant:"h3",component:"h3",className:"mb-2"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.quotaExceeded",defaultMessage:"Vous avez dépassé votre quota d'invitations"})),l.createElement(A.Typography,{variant:"body3",className:"mb-2"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.quotaExceededNotice",defaultMessage:"Vous pouvez envoyer {quota} invitations maximum",values:{quota:i}}))),l.createElement(A.Button,{type:"submit",variant:"contained",className:"self-center px-6 m-3",onClick:t,disabled:r,color:L.i[k.A].controlAccent},s>0?l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.form.send.hasInvitations",defaultMessage:"Envoyer {count} invitation{count, plural, =0 {} =1 {} other {s}}",values:{count:s}}):l.createElement(y.A,{id:"Main.lang.send",defaultMessage:"Envoyer"}),Object.keys(n).length>0&&l.createElement(x.default,{className:"ml-1 text-light-500"})))},Fe=(e,t)=>{if(!e)return null;const a=Object.values((null==e?void 0:e.sessions)||{}).filter((e=>"COMPLETED"!==e.status&&t.includes(e.testId)&&!e.archived));return a.length?{sessions:a,testInvitation:e}:null},Se=e=>{var t;let{companyId:a,invitationKey:s,invitation:o,devId:m,anonymousId:u,testId:f,lastSessionId:x}=e;const P=(0,M.P)(),R=(0,r.h)(),$=(0,n.W6)(),{locale:O,formatMessage:W}=(0,h.A)(),{data:U}=(0,D.R)(m||"","developer"),{enqueueSnackbar:G}=(0,E.dh)(),[J,H]=(0,l.useState)(!1),[K,X]=(0,l.useState)([]),{testsInvitations:Z}=(0,C.o)(a),{data:ee}=(0,w.Jd)(null!=P?P:null),[te,le]=(0,l.useState)(f?[f]:null),ie=(0,n.zy)(),[re,oe]=(0,l.useState)(null),{data:me,isSuccess:de}=((e,t)=>{const a=(0,l.useMemo)((()=>({companyId:e,requestKey:t})),[e,t]);return(0,b.R)("company/_companyId_/tests/requests/_requestKey_",a)})(a,re),{companyTestPlansLimits:ce}=(0,i.G)(a),{data:ue}=(0,Le.J)(a),ve=(0,l.useMemo)((()=>{var e;return ce||ue?"unlimited"===(null==ce?void 0:ce.availableQuota)?null==ce?void 0:ce.availableQuota:(null!==(e=null==ce?void 0:ce.availableQuota)&&void 0!==e?e:0)+(null!=ue?ue:0):0}),[null==ce?void 0:ce.availableQuota,ue]),pe=(0,l.useMemo)((()=>{const e=Object.values(Z||{}).find((e=>e.anonymousDevId===u));return e}),[u,Z]),{testDetails:fe}=(0,T.Xk)((null==te?void 0:te[0])||null),Ee=(0,l.useMemo)((()=>{var e;const t=(localStorage.getItem(`emails-${ie.pathname}${ie.search}
1`)||"").split(",").filter(Boolean),a=JSON.parse(localStorage.getItem(`${ie.pathname}${ie.search}`)||"[]"),l=t.length?t:[null!==(e=null==ee?void 0:ee.email)&&void 0!==e?e:""].filter(Boolean);if(u&&pe){var n,i;const e=null==pe||null===(n=pe.sessions)||void 0===n||null===(i=n[null!=x?x:""])||void 0===i?void 0:i.emailsList,t=null!=e&&e.length?e:l;return{invitees:[{name:pe.name||"",emailAddress:pe.emailAddress||""}],testIds:te||[],emails:t,emailInputValue:"",deadline:g()().isoWeekday()<=6?g()().day(7):g()().day(14)}}return{invitees:a.length?a:[{name:(null==o?void 0:o.name)||"",emailAddress:(null==o?void 0:o.emailAddress)||""}],testIds:te||[],emails:l,emailInputValue:"",deadline:g()().isoWeekday()<=6?g()().day(7):g()().day(14)}}),[o,te,Z,u,pe,ee]),[he,Ie,xe]=(0,F.Z)(),Ae=(0,l.useCallback)(((e,t)=>{var l;localStorage.removeItem(`${ie.pathname}${ie.search}`);const n=[],i=v()([...(null==e?void 0:e.emails)||[],e.emailInputValue]).filter(Boolean);if(!i.length&&null!=ee&&ee.email&&i.push(null==ee?void 0:ee.email),le(e.testIds),m){var r,o,d,c,u;const t=Fe(null!==(r=null==Z?void 0:Z[null!=s?s:""])&&void 0!==r?r:null,te||e.testIds);if(t&&null!=t&&null!==(o=t.sessions)&&void 0!==o&&o.length)return void X([t]);n.push({devId:m,email:null!==(d=null===(c=e.emails)||void 0===c?void 0:c[0])&&void 0!==d?d:null,name:null!==(u=null==U?void 0:U.firstName)&&void 0!==u?u:null})}else{const t=e.invitees.map((t=>{const a=Object.values(Z||{}).find((e=>e.emailAddress===t.emailAddress));return Fe(null!=a?a:null,te||e.testIds)})).flat().filter(Boolean);if(t.length)return void X(t);
1e.invitees.forEach((e=>{var t;n.push({email:null==e?void 0:e.emailAddress,name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:null})}))}const p=(0,N.xY)(a,P,{deadline:null===(l=e.deadline)||void 0===l?void 0:l.endOf("day").valueOf(),testsIds:te||e.testIds,emailsList:i},n);H(!0),(0,S.V)(),oe(p.key)}),[m,Z,s,U,te,ie,a]),Ne=!m&&!u,be=(0,l.useCallback)((e=>{f&&(0,q.H)(f,e.title,e.linearMode,e.locales).then((()=>{G(W(_.D.saved),{variant:"success",autoHideDuration:2e3})}))}),[]),Ce=(0,l.useCallback)((e=>{f&&(0,q.r)(f,e.title).then((()=>{G(W(_.D.saved),{variant:"success",autoHideDuration:2e3})}))}),[]);if(J){if(re&&de&&!me){const e=f||(null==te?void 0:te[0]);if(e){const t=(0,c.N_)(R,a,e);return void $.push(t,{from:ie.search})}const t=(0,c.GI)(R,a,"invitations");return $.push(t,{from:ie.search}),null}return null!=me&&me.error?l.createElement(A.Card,{className:"w-full max-w-[1920px] z-10 flex flex-col p-4 max-h-[200px] h-full justify-center items-center"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.erreur",defaultMessage:"Erreur lors de l'envoi de vos invitations : {error}",values:{error:W(j[null==me?void 0:me.error]||j.unknown)}}),l.createElement(A.Button,{size:"xs",color:L.i[k.A].controlPrimary,onClick:()=>{oe(null),H(!1)}},l.createElement(y.A,{id:"Main.lang.back",defaultMessage:"Retour"}))):l.createElement(A.Card,{className:"w-full max-w-[1920px] z-10 flex flex-col p-4 max-h-[200px] h-full justify-center items-center"},l.createElement(d.Ay,null),l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.sending",defaultMessage:"Nous envoyons vos invitations !"}))}return f&&(null!==(t=null==fe?void 0:fe.questionsCount)&&void 0!==t?t:0)<3?l.createElement(A.Card,{className:"w-full max-w-[1920px] z-10 flex flex-col px-9 md:px-4 items-center"},l.createElement(A.Typography,{variant:"h3",component:"h3",className:"mb-2"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.cannotBeSent",defaultMessage:"Ce test ne peut pas (encore ! ) être envoyé! "})),l.createElement(A.Typography,{variant:"body3",className:"mb-2"},l.createElement(y.A,{id:"Invitations.CreateInvitationDialog.cannotBeSentNotice",defaultMessage:"Assurez-vous qu'il contient au moins 3 questions !"})),l.createElement(I.N_,{className:"flex mx-0 md:w-full md:my-0",to:(0,c.Nn)(R,a,f)},l.createElement(A.Button,{color:L.i[k.A].controlPrimary,className:"flex w-full m-0",size:"small",variant:"contained"},W(B.Y.see_questions))),l.createElement("div",{className:"h-[350px] mb-2 mt-5"},l.createElement(z.t,{className:"w-full h-full"}))):l.createElement(A.Card,{className:"w-full max-w-[1920px] z-10 flex flex-col px-9 md:px-2"},K.length>0&&l.createElement(Y,{alreadyExistingSessions:K,onConfirm:()=>X([])}),l.createElement(p.Formik,{initialValues:Ee,enableReinitialize:!0,onSubmit:Ae,validateOnBlur:!1,validateOnChange:!1,validationSchema:we(W,null!=m?m:null)},(e=>{var t;return l.createElement(l.Fragment,null,he&&l.createElement(Me,{open:he,onClose:xe,companyId:a,invitees:e.values.invitees}),f?l.createElement(V.a,{testId:f,companyId:a,onChange:null!=fe&&fe.sentOnce?Ce:be,canEditSesstings:!(null!=fe&&fe.sentOnce),hideEditSettingsWarning:!0}):l.createElement(p.FastField,{error:null==e||null===(t=e.errors)||void 0===t?void 0:t.testIds,variant:"flat",name:"testIds",companyId:a,component:ge}),l.createElement("div",{className:"my-5 mr-5 w-full h-[1px] bg-dark-50"}),l.createElement("div",{className:"flex flex-col"},Ne&&l.createElement(ae,{formValues:e.values,errors:e.errors}),m&&l.createElement(ye,{devId:m,invitation:o}),u&&pe&&l.createElement(Q,{candidate:{id:u,...pe},invitation:o})),l.createElement("div",{className:"my-5 mr-5 w-full h-[1px] bg-dark-50"}),l.createElement("div",null,l.createElement(ne,{errors:e.errors,formValues:e.values})),l.createElement("div",{className:"my-5 mr-5 w-full h-[1px] bg-dark-50"}),l.createElement("div",{className:"mb-1"},l.createElement(p.FieldArray,{name:"emails",component:se})),l.createElement(ke,{formValues:e.values,errors:e.errors,onClick:e.handleSubmit,availableQuota:ve}))})))};var _e=a(20319);const Ve=()=>{const e=(0,n.g)(),t=(0,n.zy)(),a=new URLSearchParams(t.search),u=(0,l.useMemo)((()=>a.get("testId")),[a]),v=(0,l.useMemo)((()=>a.get("devId")),[a]),p=(0,l.useMemo)((()=>a.get("anonymousId")),[a]),f=(0,l.useMemo)((()=>a.get("lastSessionId")),[a]),g=(0,s.Qh)(),E=(0,r.h)(),y=(0,l.useMemo)((()=>E===o.f.ADMIN?e.companyId:g),[g,e.companyId]),h=(0,l.useMemo)((()=>u?(0,c.N_)(E,y,u):(0,c.GI)(E,y)),[E,y,u]),{companyTestPlansLimits:I,loaded:x}=(0,i.G)(y||""),A=null==I?void 0:I.billingMode;return x?E===o.f.ADMIN||A?l.createElement(m.ZO,null,l.createElement("div",{className:"flex flex-col items-center justify-center w-full h-full pb-4 mt-1 px-9 md:px-4"},l.createElement(_e.V,{companyId:y,testId:u,backLink:h,disabled:"onlyInvitations"}),l.createElement(Se,{companyId:y,devId:v,anonymousId:p,testId:u,lastSessionId:f}))):l.createElement(n.rd,{to:"/recruiters-tests"}):l.createElement(d.Ay,null)}}}]); 2//# sourceMappingURL=recruiter-tests-tests_invitations-tests_invitations_form.1ff759848dba3c2fc36e.js.map
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.