PageSourceSearch

https://voice-pilot.ai/assets/NewCampaign-ttHZwkyM.js

js voice-pilot.ai collected 2026-10-05 13:14:02 UTC 43,698 bytes, 12 lines download raw bytes

1import{j as e,a as Ne,h as ve,r as f}from"./vendor-react-DK_MHVKo.js";import{a as we,u as T,k as Ce,b as ye,U as _e,V as Se,z as q}from"./index-Djo5SZyv.js";import{u as ke}from"./useTagsQueries-gPPFAut-.js";import{u as $e}from"./useProfessionalQueries-DhKLpbvi.js";import{P as Te,k as Pe,D as V,F as te,ay as Ae,m as ae,as as Ee,B as Le,a8 as I,U as Me,j as Re,Z as qe,az as Oe,aA as Ve,aB as Be,aC as Fe,aD as He,aE as ze,H as Ge,v as Je,aF as Ue,al as D,A as Ye}from"./vendor-icons-Dr_X1Hjo.js";import{V as We}from"./VoicePicker-sG7CxSBL.js";import{S as Ze}from"./SmsBodyEditor-rVOID6bW.js";import"./vendor-query-Ceg45NlR.js";const Ke=[{id:"voice",icon:Te,gradient:"from-indigo-500 to-purple-500",bg:"bg-indigo-500/20"},{id:"sms",icon:Pe,gradient:"from-emerald-500 to-teal-500",bg:"bg-emerald-500/20"}];function Qe({selected:n,onSelect:o}){const{theme:t}=we(),m=t==="dark",{t:i}=T();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-bold",children:i("sms.chooseType")}),e.jsx("p",{className:`mt-2 ${m?"text-slate-400":"text-slate-600"}`,children:i("sms.chooseTypeDesc")})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6 max-w-2xl mx-auto",children:Ke.map(c=>{const j=c.icon,v=n===c.id;return e.jsxs("button",{onClick:()=>o(c.id),className:`relative p-4 sm:p-6 rounded-2xl border-2 transition-all text-left ${v?"border-indigo-500 ring-2 ring-indigo-500/30":m?"border-slate-700 hover:border-slate-600":"border-slate-200 hover:border-slate-300"} ${m?"bg-slate-800":"bg-white"}`,children:[e.jsx("div",{className:`w-14 h-14 rounded-xl ${c.bg} flex items-center justify-center mb-4`,children:e.jsx(j,{className:`w-7 h-7 bg-gradient-to-r ${c.gradient} bg-clip-text`,style:{color:c.id==="voice"?"#6366f1":"#10b981"}})}),e.jsx("h3",{className:"text-lg font-semibold",children:i(`sms.type_${c.id}`)}),e.jsx("p",{className:`mt-1 text-sm ${m?"text-slate-400":"text-slate-600"}`,children:i(`sms.type_${c.id}_desc`)}),v&&e.jsx("div",{className:"absolute top-3 right-3 w-6 h-6 bg-indigo-500 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-4 h-4 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})})]},c.id)})})]})}function Xe({categories:n,selected:o,onSelect:t,getCategoryName:m}){const{t:i}=T();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:i("newCampaign.chooseCategory")}),e.jsx("p",{className:"text-slate-400",children:i("newCampaign.chooseCategoryDesc")})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:n.map(c=>e.jsxs("button",{onClick:()=>t(c.id),className:`p-6 rounded-xl border-2 transition-all text-center group ${o===c.id?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50 hover:bg-slate-800"}`,children:[e.jsx("div",{className:`w-14 h-14 bg-gradient-to-br ${c.color} rounded-xl flex items-center justify-center mx-auto mb-3 group-hover:scale-110 transition-transform ${o===c.id?"shadow-lg":""}`,children:e.jsx(c.icon,{className:"w-7 h-7 text-white"})}),e.jsx("p",{className:`font-medium ${o===c.id?"text-white":"text-slate-300"}`,children:m(c.id)})]},c.id))})]})}function Ie({templates:n,selected:o,onSelect:t,getTemplateName:m,getTemplateDescription:i}){const{t:c}=T();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:c("newCampaign.chooseTemplate")}),e.jsx("p",{className:"text-slate-400",children:c("newCampaign.chooseTemplateDesc")})]}),e.jsxs("div",{className:"space-y-3",children:[n==null?void 0:n.map(j=>e.jsx("button",{onClick:()=>t(j.id),className:`w-full p-5 rounded-xl border-2 text-left transition-all ${o===j.id?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:`font-medium ${o===j.id?"text-white":"text-slate-300"}`,children:m(j.id)}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:i(j.id)})]}),o===j.id&&e.jsx("div",{className:"w-8 h-8 bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg flex items-center justify-center shadow-lg shadow-indigo-500/25",children:e.jsx(V,{className:"w-5 h-5 text-white"})})]})},j.id)),!n&&e.jsx("p",{className:"text-slate-400 text-center py-8",children:c("newCampaign.customNoTemplateNeeded")})]})]})}function De({professionals:n,loading:o,selectedId:t,onSelect:m}){const{t:i}=T();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:i("newCampaign.assignProfessional")}),e.jsx("p",{className:"text-slate-400",children:i("newCampaign.assignProfessionalDesc")})]}),o?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx("div",{className:"h-8 w-8 rounded-lg bg-slate-800 animate-pulse"})}):n.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-slate-400 mb-2",children:i("newCampaign.noProfessionalFound")}),e.jsx("p",{className:"text-sm text-slate-500",children:i("newCampaign.campaignWithoutAssignment")})]}):e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("button",{onClick:()=>m(null),className:`p-4 rounded-xl border-2 text-left transition-all ${t===null?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:[e.jsx("p",{className:`font-medium ${t===null?"text-white":"text-slate-300"}`,children:i("newCampaign.noProfessional")}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:i("newCampaign.genericCampaign")})]}),n.map(c=>{var j;return e.jsx("button",{onClick:()=>m(c.id),className:`p-4 rounded-xl border-2 text-left transition-all ${t===c.id?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl flex items-center justify-center text-white font-semibold text-sm flex-shrink-0",style:{backgroundColor:c.color||"#6366f1"},children:(j=(c.name||"?")[0])==null?void 0:j.toUpperCase()}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:`font-medium truncate ${t===c.id?"text-white":"text-slate-300"}`,children:[c.title?`${c.title} `:"",c.name]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[c.specialty&&e.jsx("span",{className:"text-xs text-slate-500",children:c.specialty}),c.location&&e.jsx("span",{className:"text-xs text-slate-500",children:c.location})]})]}),t===c.id&&e.jsx("div",{className:"ml-auto w-6 h-6 bg-gradient-to-r from-indigo-500 to-purple-500 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(V,{className:"w-4 h-4 text-white"})})]})},c.id)})]})]})}const Y=new Set(["contact_name","contact_company"]);function O({label:n,value:o,min:t,max:m,step:i,hints:c,onChange:j}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("label",{className:"text-xs text-slate-400",children:n}),e.jsx("span",{className:"text-xs text-emerald-400 font-mono w-8 text-right",children:Number(o).toFixed(1)})]}),e.jsx("input",{type:"range",min:t,max:m,step:i,value:o,onChange:v=>
1j(parseFloat(v.target.value)),className:`w-full h-1.5 rounded-full appearance-none cursor-pointer bg-slate-700 accent-emerald-500
2          [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-3.5 [&::-webkit-slider-thumb]:h-3.5
3          [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-emerald-500 [&::-webkit-slider-thumb]:shadow-lg`}),e.jsx("div",{className:"flex justify-between text-[10px] text-slate-600 mt-0.5",children:c.map((v,h)=>e.jsx("span",{children:v},h))})]})}function es({formData:n,onFormChange:o,templateInfo:t,tags:m,selectedTagIds:i,onToggleTag:c,savedScripts:j,selectedScriptId:v,onSelectScript:h,contactCount:P,countLoading:k,onClearTags:w,getVariableLabel:p}){const{t:l}=T(),_=((t==null?void 0:t.required_vars)||[]).filter(r=>!Y.has(r)),N=((t==null?void 0:t.optional_vars)||[]).filter(r=>!Y.has(r));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:l("newCampaign.configurationTitle")}),e.jsx("p",{className:"text-slate-400",children:l("newCampaign.configurationDesc")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"label",children:l("newCampaign.campaignNameLabel")}),e.jsx("input",{type:"text",value:n.name,onChange:r=>o({...n,name:r.target.value}),className:"input",placeholder:l("newCampaign.campaignNamePlaceholder")})]}),n.template==="custom"||n.category==="custom"?e.jsxs("div",{className:"space-y-4",children:[j.length>0&&e.jsxs("div",{children:[e.jsxs("label",{className:"label flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4"}),l("newCampaign.selectSavedScript")]}),e.jsx("div",{className:"grid gap-2 max-h-48 overflow-y-auto",children:j.map(r=>e.jsx("button",{type:"button",onClick:()=>h(r),className:`w-full text-left p-3 rounded-xl border transition-all ${v===r.id?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:`text-sm font-medium ${v===r.id?"text-white":"text-slate-300"}`,children:r.name}),r.description&&e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:r.description})]}),e.jsx("span",{className:"text-xs text-slate-500 px-2 py-1 rounded bg-slate-700/50",children:r.category||"custom"})]})},r.id))}),e.jsx("div",{className:"border-t border-slate-700 my-4"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"label",children:l("newCampaign.customScriptLabel")}),e.jsx("textarea",{value:n.customPrompt,onChange:r=>o({...n,customPrompt:r.target.value}),className:"input min-h-[200px] resize-none",placeholder:l("newCampaign.customScriptPlaceholder")}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:l("newCampaign.customScriptHelp")})]})]}):t&&(()=>{const r=((t==null?void 0:t.contact_vars)||[]).filter(u=>!Y.has(u));return e.jsxs("div",{className:"space-y-4",children:[(_.length>0||N.length>0)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm font-medium text-slate-300",children:l("newCampaign.templateVariables")}),_.length>0&&e.jsx("span",{className:"text-xs text-slate-500",children:l("newCampaign.requiredFields")})]}),e.jsx("div",{className:"grid gap-4",children:_.map(u=>e.jsxs("div",{children:[e.jsxs("label",{className:"label flex items-center gap-2",children:[p(u),e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx("input",{type:"text",value:n.variables[u]||"",onChange:A=>o({...n,variables:{...n.variables,[u]:A.target.value}}),className:"input",placeholder:l("newCampaign.variablePlaceholder").replace("{variable}",u)})]},u))}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-slate-700 pt-4 mt-6",children:e.jsx("p",{className:"text-sm font-medium text-slate-500 mb-4",children:l("newCampaign.optionalFields")})}),e.jsx("div",{className:"grid gap-4",children:N.map(u=>e.jsxs("div",{children:[e.jsx("label",{className:"label",children:p(u)}),e.jsx("input",{type:"text",value:n.variables[u]||"",onChange:A=>o({...n,variables:{...n.variables,[u]:A.target.value}}),className:"input",placeholder:l("newCampaign.variablePlaceholder").replace("{variable}",u)})]},u))})]})]}),r.length>0&&e.jsx("div",{className:"border-t border-slate-700 pt-4 mt-2",children:e.jsx("div",{className:"p-4 rounded-xl bg-amber-500/10 border border-amber-500/30",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ae,{className:"w-5 h-5 text-amber-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-300 mb-1",children:l("newCampaign.contactVarsTitle")}),e.jsx("p",{className:"text-xs text-slate-400 mb-3",children:l("newCampaign.contactVarsDesc")}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:r.map(u=>e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded bg-slate-700/60 text-xs text-slate-300 font-mono",children:p(u)},u))}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:l("newCampaign.contactVarsCsvHint")})]})]})})})]})})(),n.professional_id&&e.jsx("div",{className:"border-t border-slate-700 pt-6 mt-6",children:e.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-800/50 rounded-xl border border-slate-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-emerald-500/20",children:e.jsx(ae,{className:"w-5 h-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-white",children:l("newCampaign.autoBooking")}),e.jsx("p",{className:"text-sm text-slate-400",children:l("newCampaign.autoBookingDesc")})]})]}),e.jsx("button",{type:"button",onClick:()=>o({...n,enable_scheduling:!n.enable_scheduling}),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 ${n.enable_scheduling?"bg-emerald-500":"bg-slate-600"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${n.enable_scheduling?"translate-x-6":"translate-x-1"}`})})]})}),e.jsxs("div",{className:"border-t border-slate-700 pt-6 mt-6",children:[e.jsx("label",{className:"block text-sm font-semibold text-white mb-1",children:l("newCampaign.openingLineLabel")}),e.jsx("input",{type:"text",value:n.ai_greeting||"",onChange:r=>o({...n,ai_greeting:r.target.value}),placeholder:l("newCampaign.openingLinePlaceholder"),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-base sm:text-sm focus:border-emerald-500 outline-none"}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:l("newCampaign.openingLineHint")})]}),e.jsxs("div",{className:"border-t border-slate-700 pt-6 mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Ee,{className:"w-4 h-4 text-emerald-400"}),e.jsx("h3",{className:"text-base font-semibold text-white",children:l("newCampaign.voiceTitle")})]}),e.jsx("div",{className:"mb-4",children:e.jsx(We,{value:n.voice_id||"custom_voice_dd4e5af
309ac1689bcdd16b3783",onChange:r=>o({...n,voice_id:r})})}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 p-4 bg-slate-800/40 border border-slate-700 rounded-lg",children:[e.jsx(O,{label:l("newCampaign.voiceSpeed"),value:n.voice_speed??1,min:.5,max:2,step:.1,hints:[l("newCampaign.speedSlow"),l("newCampaign.speedNormal"),l("newCampaign.speedFast")],onChange:r=>o({...n,voice_speed:r})}),e.jsx(O,{label:l("newCampaign.voiceTemperature"),value:n.voice_temperature??1,min:0,max:2,step:.1,hints:[l("newCampaign.tempStable"),l("newCampaign.tempNatural"),l("newCampaign.tempCreative")],onChange:r=>o({...n,voice_temperature:r})}),e.jsx(O,{label:l("newCampaign.voiceInterruption"),value:n.interruption_sensitivity??1,min:0,max:1,step:.1,hints:[l("newCampaign.interruptPatient"),l("newCampaign.interruptNormal"),l("newCampaign.interruptReactive")],onChange:r=>o({...n,interruption_sensitivity:r})}),e.jsx(O,{label:l("newCampaign.voiceBackchannel"),value:n.backchannel_frequency??.6,min:0,max:1,step:.1,hints:[l("newCampaign.backchannelNone"),l("newCampaign.backchannelModerate"),l("newCampaign.backchannelFrequent")],onChange:r=>o({...n,backchannel_frequency:r})})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block text-xs text-slate-400 mb-1",children:l("newCampaign.ambientLabel")}),e.jsxs("select",{value:n.ambient_sound||"",onChange:r=>o({...n,ambient_sound:r.target.value}),className:"w-full bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-white text-base sm:text-sm focus:border-emerald-500 outline-none",children:[e.jsx("option",{value:"",children:l("newCampaign.ambientNone")}),e.jsx("option",{value:"call-center",children:l("newCampaign.ambientCallCenter")}),e.jsx("option",{value:"coffee-shop",children:l("newCampaign.ambientCafe")}),e.jsx("option",{value:"convention-hall",children:l("newCampaign.ambientConference")}),e.jsx("option",{value:"summer-outdoor",children:l("newCampaign.ambientOutdoor")}),e.jsx("option",{value:"static-noise",children:l("newCampaign.ambientStatic")})]}),e.jsx("p",{className:"text-xs text-slate-500 mt-1",children:l("newCampaign.ambientDesc")})]})]}),n.enable_scheduling&&e.jsxs("div",{className:"border-t border-slate-700 pt-6 mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Le,{className:"w-4 h-4 text-indigo-400"}),e.jsx("h3",{className:"text-base font-semibold text-white",children:l("newCampaign.confirmationTitle")})]}),e.jsx("p",{className:"text-sm text-slate-400 mb-3",children:l("newCampaign.confirmationDesc")}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{id:"sms",label:l("newCampaign.confirmationSms"),icon:"📱"},{id:"email",label:l("newCampaign.confirmationEmail"),icon:"✉️"},{id:"both",label:l("newCampaign.confirmationBoth"),icon:"🔔"}].map(r=>{const u=(n.confirmation_channel||"sms")===r.id;return e.jsxs("button",{type:"button",onClick:()=>o({...n,confirmation_channel:r.id}),className:`px-3 py-2 rounded-lg border text-sm transition-all ${u?"border-emerald-500 bg-emerald-500/10 text-emerald-300":"border-slate-700 bg-slate-800 text-slate-400 hover:border-slate-600"}`,children:[e.jsx("span",{className:"mr-1",children:r.icon}),r.label]},r.id)})})]}),e.jsxs("div",{className:"border-t border-slate-700 pt-6 mt-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(I,{className:"w-4 h-4 text-indigo-400"}),e.jsx("h3",{className:"text-base font-semibold text-white",children:l("newCampaign.targetByGroup")})]}),e.jsx("p",{className:"text-sm text-slate-400 mb-4",children:l("newCampaign.targetByGroupDesc")}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[e.jsxs("button",{type:"button",onClick:w,className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-all border ${i.length===0?"bg-indigo-500 border-transparent text-white shadow-lg":"border-slate-600 text-slate-300 hover:border-slate-500"}`,children:[e.jsx(Me,{className:"w-3 h-3"}),l("newCampaign.allContacts")||"Tous les contacts"]}),m.length===0?e.jsx("span",{className:"text-sm text-slate-500 self-center",children:l("newCampaign.noGroupsAvailable")}):m.map(r=>e.jsxs("button",{type:"button",onClick:()=>c(r.id),className:`inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium transition-all border ${i.includes(r.id)?"border-transparent text-white shadow-lg":"border-slate-600 text-slate-300 hover:border-slate-500"}`,style:i.includes(r.id)?{backgroundColor:r.color||"#6366f1"}:{},children:[e.jsx(I,{className:"w-3 h-3"}),r.name,r.contact_count>0&&e.jsxs("span",{className:`text-xs ${i.includes(r.id)?"opacity-80":"text-slate-500"}`,children:["(",r.contact_count,")"]})]},r.id))]})]})]})}function ss({formData:n,selectedCategoryData:o,professionals:t,tags:m,selectedTagIds:i,getCategoryName:c,getTemplateName:j,templates:v}){var P,k;const{t:h}=T();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:h("newCampaign.reviewTitle")}),e.jsx("p",{className:"text-slate-400",children:h("newCampaign.reviewDesc")})]}),e.jsxs("div",{className:"bg-slate-800/50 rounded-xl p-6 space-y-4 border border-slate-700",children:[e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-700",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.reviewName")}),e.jsx("span",{className:"font-medium text-white",children:n.name})]}),e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-700",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.reviewCategory")}),e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx("div",{className:`w-6 h-6 rounded-lg bg-gradient-to-br ${o.color} flex items-center justify-center`,children:e.jsx(o.icon,{className:"w-3 h-3 text-white"})}),e.jsx("span",{className:"font-medium text-white",children:o?c(o.id):""})]})]}),e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-700",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.reviewTemplate")}),e.jsx("span",{className:"font-medium text-white",children:(P=v[n.category])!=null&&P.find(w=>w.id===n.template)?j(n.template):""})]}),e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-700",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.stepProfessional")}),e.jsx("span",{className:"font-medium text-white",children:n.professional_id?((k=t.find(w=>
3w.id===n.professional_id))==null?void 0:k.name)||`#${n.professional_id}`:h("newCampaign.notAssigned")})]}),n.professional_id&&e.jsxs("div",{className:"flex justify-between items-center pb-4 border-b border-slate-700",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.autoBooking")}),e.jsx("span",{className:`font-medium ${n.enable_scheduling?"text-emerald-400":"text-slate-400"}`,children:n.enable_scheduling?h("newCampaign.enabled"):h("newCampaign.disabled")})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-slate-400",children:h("newCampaign.targetedGroups")}),e.jsx("div",{className:"flex flex-wrap gap-1 justify-end",children:i.length>0?m.filter(w=>i.includes(w.id)).map(w=>e.jsx("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs text-white font-medium",style:{backgroundColor:w.color||"#6366f1"},children:w.name},w.id)):e.jsx("span",{className:"font-medium text-white",children:h("newCampaign.allContacts")})})]})]}),e.jsxs("div",{className:"bg-gradient-to-r from-indigo-500/10 to-purple-500/10 rounded-xl p-5 flex items-start border border-indigo-500/20",children:[e.jsx("div",{className:"p-2 rounded-lg bg-indigo-500/20 mr-4",children:e.jsx(Re,{className:"w-5 h-5 text-indigo-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-indigo-300 mb-1",children:h("newCampaign.agentAutoCreated")}),e.jsx("p",{className:"text-sm text-slate-400",children:h("newCampaign.agentAutoCreatedDesc")})]})]}),e.jsxs("div",{className:"bg-gradient-to-r from-emerald-500/10 to-teal-500/10 rounded-xl p-5 flex items-start border border-emerald-500/20",children:[e.jsx("div",{className:"p-2 rounded-lg bg-emerald-500/20 mr-4",children:e.jsx(qe,{className:"w-5 h-5 text-emerald-400"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-emerald-300 mb-1",children:h("newCampaign.readyToLaunch")}),e.jsx("p",{className:"text-sm text-slate-400",children:h("newCampaign.readyToLaunchDesc")})]})]})]})}const ts={artisan:"sales",automobile:"auto",medical:"medical",commerce:"sales",immobilier:"real_estate",assurance:"insurance",fiscal:"fiscal",general:"general",custom:"general"},ee=[{id:"artisan",icon:Oe,color:"from-orange-500 to-amber-500",bg:"bg-orange-500/20"},{id:"hospitality",icon:Ve,color:"from-rose-500 to-red-500",bg:"bg-rose-500/20"},{id:"tech",icon:Be,color:"from-sky-500 to-blue-500",bg:"bg-sky-500/20"},{id:"automobile",icon:Fe,color:"from-blue-500 to-cyan-500",bg:"bg-blue-500/20"},{id:"medical",icon:He,color:"from-red-500 to-pink-500",bg:"bg-red-500/20"},{id:"commerce",icon:ze,color:"from-emerald-500 to-teal-500",bg:"bg-emerald-500/20"},{id:"immobilier",icon:Ge,color:"from-amber-500 to-orange-500",bg:"bg-amber-500/20"},{id:"assurance",icon:Je,color:"from-purple-500 to-violet-500",bg:"bg-purple-500/20"},{id:"fiscal",icon:Ue,color:"from-teal-500 to-emerald-500",bg:"bg-teal-500/20"},{id:"general",icon:ae,color:"from-slate-500 to-slate-600",bg:"bg-slate-500/20"},{id:"custom",icon:te,color:"from-indigo-500 to-purple-500",bg:"bg-indigo-500/20"}],se={artisan:[{id:"relance_devis_btp"},{id:"relance_devis"},{id:"prise_rdv"},{id:"relance_facture"},{id:"enquete_satisfaction"}],hospitality:[{id:"winback_hotellerie"},{id:"prise_rdv"},{id:"enquete_satisfaction"}],tech:[{id:"relance_essai_gratuit"},{id:"prise_rdv"},{id:"enquete_satisfaction"}],automobile:[{id:"controle_technique"},{id:"entretien_vehicule"},{id:"rappel_revision"}],medical:[{id:"rappel_rdv_medical"},{id:"rappel_vaccination"},{id:"suivi_patient"}],commerce:[{id:"relance_devis"},{id:"relance_facture"},{id:"enquete_satisfaction"},{id:"confirmation_commande"}],immobilier:[{id:"relance_prospect_immo"},{id:"rappel_visite"}],assurance:[{id:"renouvellement_contrat"},{id:"relance_sinistre"}],fiscal:[{id:"bilan_fiscal"},{id:"suivi_rdv_fiscal"},{id:"prospection_fiscale"}],general:[{id:"prise_rdv"},{id:"confirmation_rdv"},{id:"rappel_echeance"}],custom:[{id:"custom"}]},as="voice_ai_scripts";function xs(){const n=Ne(),[o]=ve(),{t}=T(),m=o.get("type"),[i,c]=f.useState(m==="sms"?3:m==="voice"?2:1),[j,v]=f.useState(!1),[h,P]=f.useState([]),[k,w]=f.useState(null),[p,l]=f.useState(m==="sms"?"sms":m==="voice"?"voice":null),[_]=f.useState("commercial"),[N,r]=f.useState(""),[u,A]=f.useState({}),[B,ne]=f.useState(""),[F,ie]=f.useState(""),[H,le]=f.useState("2026"),[M,re]=f.useState("14:00"),R=B&&F&&H?`${H}-${F.padStart(2,"0")}-${B.padStart(2,"0")}`:"",[C,W]=f.useState([]),[a,S]=f.useState({name:"",category:"",template:"",variables:{},customPrompt:"",ai_greeting:"",professional_id:null,enable_scheduling:!1,voice_id:"custom_voice_dd4e5af
309ac1689bcdd16b3783",voice_speed:1,voice_temperature:1,interruption_sensitivity:1,backchannel_frequency:.6,ambient_sound:"",confirmation_channel:"sms"}),[z,G]=f.useState(null);f.useEffect(()=>{try{const s=localStorage.getItem(as);s&&P(JSON.parse(s))}catch{}},[]);const{data:E=[]}=ke(),ce=f.useMemo(()=>{const s={};return C.length>0&&(s.tag_ids=C.join(",")),s},[C]),{data:J,isLoading:de}=Ce(ce,{enabled:i===4}),oe=(J==null?void 0:J.count)??null,Z=s=>{W(d=>d.includes(s)?d.filter(b=>b!==s):[...d,s])},{data:L,isLoading:me}=$e(),$=f.useMemo(()=>{if(!L)return[];if(p==="sms")return L;if(!a.category)return[];const s=ts[a.category]||"general",d=L.filter(b=>b.professional_type===s||s==="general");return d.length>0?d:L},[L,a.category,p]);f.useEffect(()=>{$.length===1&&p!=="sms"&&S(s=>({...s,professional_id:$[0].id}))},[$,p]),f.useEffect(()=>{a.template&&a.template!=="custom"?xe(a.template):G(null)},[a.template]);const xe=async s=>{try{const{data:d}=await ye.get(`/templates/${s}`),b=d.data||d;G(b)}catch{G({required_vars:[],optional_vars:[],prompt:""})}},K=s=>{var b,g,y;w(s.id);let d=s.content||"";s.ai_personality&&(d+=`
4
5PERSONNALITÉ: ${s.ai_personality}`),(b=s.ai_objection_handlers)!=null&&b.length&&(d+=`
6
7GESTION DES OBJECTIONS:`,s.ai_objection_handlers.forEach(x=>{d+=`
8- Si "${x.trigger}" → ${x.response}`})),(g=s.ai_forbidden_topics)!=null&&g.length&&(d+=`
9
10SUJETS INTERDITS: ${s.ai_forbidden_topics.join(", ")}`),(y=s.ai_required_info)!=null&&y.length&&(d+=`
11
12INFORMATIONS À COLLECTER: ${s.ai_required_info.join(", ")}`),S(x=>({...x,customPrompt:d,name:x.name||s.name}))},pe=_e(),he=Se(),ge=async()=>{var s,d;v(!0);try{if(p==="sms"){const x={name:a.name,body:N,description:a.name};u&&Object.keys(u).length>0&&(x.variables=u),C.length>0&&(x.tag_ids=C),a.professional_id&&(x.professional_id=a.professional_id),R&&M&&(x.appointment_datetime=`${R}T${M}:00`);const U=await he.mutateAsync(x);q.success(t("sms.campaignCreated")),n(`/campaigns/${U.id}`);return}let b=a.customPrompt;a.template!=="custom"&&z&&(b=z.prompt);const g={name:a.name,prompt_template:b||"Default prompt",use_case_type:a.template!=="custom"?a.template:void 0};a.variables&&Object.keys(a.variables).length>0&&(g.variables=a.variables),a.professional_id&&(g.professional_id=a.professional_id),a.enable_scheduling&&(g.enable_scheduling=!0),a.ai_greeting&&a.ai_greeting.trim()&&(g.ai_greeting=a.ai_greeting.trim()),C.length>0&&(g.tag_ids=C),a.voice_id&&(g.voice_id=a.voice_id),a.voice_speed!=null&&(g.voice_speed=a.voice_speed),a.voice_temperature!=null&&(g.voice_temperature=a.voice_temperature),a.interruption_sensitivity!=null&&(g.interruption_sensitivity=a.interruption_sensitivity),a.backchannel_frequency!=null&&(g.backchannel_frequency=a.backchannel_frequency),a.ambient_sound&&(g.ambient_sound=a.ambient_sound),a.confirmation_channel&&(g.confirmation_channel=a.confirmation_channel);const y=await pe.mutateAsync(g);q.success(t("newCampaign.campaignCreated")),n(`/campaigns/${y.id}`)}catch(b){const g=(d=(s=b==null?void 0:b.response)==null?void 0:s.data)==null?void 0:d.message;g?q.error(g):q.error(t("newCampaign.createError"))}finally{v(!1)}},ue=ee.find(s=>s.id===a.category),be=s=>t(`newCampaign.variableLabels.${s}`)||s,Q=s=>t(`newCampaign.templates.${s}.name`)||s,je=s=>t(`newCampaign.templates.${s}.description`)||"",X=s=>t(`newCampaign.categories.${s}`)||s;return e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("button",{onClick:()=>n("/campaigns"),className:"flex items-center text-slate-400 hover:text-white mb-4 transition-colors",children:[e.jsx(D,{className:"w-4 h-4 mr-2"}),t("newCampaign.backToCampaigns")]}),e.jsx("h1",{className:"text-2xl font-bold text-white",children:t("newCampaign.title")}),e.jsx("p",{className:"text-slate-400",children:t("newCampaign.subtitle")})]}),(()=>{const s=p==="sms"?[...m?[]:[{num:1,displayNum:1,label:t("sms.stepType")}],{num:3,displayNum:m?1:2,label:t("sms.stepMessage")}]:[...m?[]:[{num:1,displayNum:1,label:t("sms.stepType")}],{num:2,displayNum:m?1:2,label:t("newCampaign.stepCategory")},{num:3,displayNum:m?2:3,label:t("newCampaign.stepTemplate")},{num:4,displayNum:m?3:4,label:t("newCampaign.stepProfessional")}
12,{num:5,displayNum:m?4:5,label:t("newCampaign.stepConfiguration")},{num:6,displayNum:m?5:6,label:t("newCampaign.stepConfirmation")}],d=s.filter(x=>i>x.num).length,b=s.find(x=>x.num===i),g=b?b.label:t("newCampaign.stepConfirmation"),y=Math.min(s.length,d+(b?1:0));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"md:hidden mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-white",children:g}),e.jsxs("span",{className:"text-xs text-slate-400",children:[y,"/",s.length]})]}),e.jsx("div",{className:"h-1.5 bg-slate-800 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-indigo-500 to-purple-500 transition-all",style:{width:`${Math.round(y/s.length*100)}%`}})})]}),e.jsx("div",{className:"hidden md:flex items-center justify-center mb-8",children:s.map((x,U,fe)=>e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:`w-10 h-10 sm:w-12 sm:h-12 rounded-xl flex items-center justify-center font-semibold transition-all text-sm ${i>x.num?"bg-gradient-to-r from-indigo-500 to-purple-500 text-white shadow-lg shadow-indigo-500/25":i===x.num?"bg-slate-800 text-indigo-400 border-2 border-indigo-500":"bg-slate-800 text-slate-500"}`,children:i>x.num?e.jsx(V,{className:"w-5 h-5"}):x.displayNum}),e.jsx("span",{className:`text-xs mt-2 ${i>=x.num?"text-slate-300":"text-slate-600"}`,children:x.label})]}),U<fe.length-1&&e.jsx("div",{className:`w-10 sm:w-16 h-1 mx-1 sm:mx-2 rounded ${i>x.num?"bg-gradient-to-r from-indigo-500 to-purple-500":"bg-slate-800"}`})]},x.num))})]})})(),e.jsxs("div",{className:"card p-4 sm:p-8",children:[i===1&&e.jsx(Qe,{selected:p,onSelect:l}),p==="sms"&&i===3&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-4",children:[e.jsx("h2",{className:"text-2xl font-bold",children:t(_==="appointment_confirmation"?"sms.appointmentMessageTitle":"sms.composeMessage")}),_==="appointment_confirmation"&&e.jsx("p",{className:"text-sm text-slate-400 mt-1",children:t("sms.appointmentMessageDesc")})]}),_==="appointment_confirmation"&&e.jsxs("div",{className:"relative z-20 p-4 rounded-xl bg-slate-800/50 border border-slate-700",children:[e.jsx("label",{className:"block text-sm font-medium mb-1 text-slate-300",children:t("sms.professional")}),e.jsx("p",{className:"text-xs text-slate-500 mb-2",children:t("sms.professionalHint")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{onClick:()=>S(s=>({...s,professional_id:null})),className:`p-3 rounded-xl border cursor-pointer transition-all ${a.professional_id==null?"border-indigo-500 bg-indigo-500/10 text-white":"border-slate-600 bg-slate-800 text-slate-400 hover:border-slate-500"}`,children:t("sms.noProfessional")}),$.map(s=>e.jsxs("div",{onClick:()=>S(d=>({...d,professional_id:s.id})),className:`p-3 rounded-xl border cursor-pointer transition-all ${a.professional_id===s.id?"border-indigo-500 bg-indigo-500/10 text-white":"border-slate-600 bg-slate-800 text-slate-300 hover:border-slate-500"}`,children:[e.jsx("span",{className:"font-medium",children:s.name}),s.specialty&&e.jsxs("span",{className:"text-slate-500 ml-2",children:["— ",s.specialty]})]},s.id))]})]}),_==="appointment_confirmation"&&a.professional_id&&e.jsxs("div",{className:"relative z-20 p-4 rounded-xl bg-slate-800/50 border border-slate-700",children:[e.jsx("label",{className:"block text-sm font-medium mb-1 text-slate-300",children:t("sms.appointmentDatetime")}),e.jsx("p",{className:"text-xs text-slate-500 mb-2",children:t("sms.appointmentDatetimeHint")}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Jour"}),e.jsxs("select",{value:B,onChange:s=>ne(s.target.value),className:"w-full rounded-xl border bg-slate-800 border-slate-600 text-white px-3 py-3 cursor-pointer",children:[e.jsx("option",{value:"",children:"--"}),Array.from({length:31},(s,d)=>d+1).map(s=>e.jsx("option",{value:String(s),children:s},s))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Mois"}),e.jsxs("select",{value:F,onChange:s=>ie(s.target.value),className:"w-full rounded-xl border bg-slate-800 border-slate-600 text-white px-3 py-3 cursor-pointer",children:[e.jsx("option",{value:"",children:"--"}),["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"].map((s,d)=>e.jsx("option",{value:String(d+1),children:s},d+1))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Année"}),e.jsxs("select",{value:H,onChange:s=>le(s.target.value),className:"w-full rounded-xl border bg-slate-800 border-slate-600 text-white px-3 py-3 cursor-pointer",children:[e.jsx("option",{value:"2026",children:"2026"}),e.jsx("option",{value:"2027",children:"2027"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-slate-500 mb-1",children:"Heure"}),e.jsx("select",{value:M,onChange:s=>re(s.target.value),className:"w-full rounded-xl border bg-slate-800 border-slate-600 text-white px-3 py-3 cursor-pointer",children:Array.from({length:24},(s,d)=>[`${String(d).padStart(2,"0")}:00`,`${String(d).padStart(2,"0")}:30`]).flat().map(s=>e.jsx("option",{value:s,children:s.replace(":","h")},s))})]})]})]}),e.jsx(Ze,{body:N,onChange:r,variables:u,onVariablesChange:A}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-slate-300",children:t("campaigns.campaignName")}),e.jsx("input",{type:"text",value:a.name,onChange:s=>S({...a,name:s.target.value}),placeholder:t("sms.namePlaceholder"),className:"w-full rounded-xl border bg-slate-800 border-slate-600 text-white px-4 py-3"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-2 text-slate-300",children:t("sms.targeting")}),E.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:E.map(s=>e.jsx("button",{onClick:()=>Z(s.id),className:`px-3 py-1.5 rounded-lg text-sm transition-colors ${C.includes(s.id
12)?"bg-indigo-500 text-white":"bg-slate-700 text-slate-300 hover:bg-slate-600"}`,children:s.name},s.id))}),e.jsx("p",{className:"text-xs text-slate-500 mt-2",children:C.length>0?`${C.length} ${t("sms.tagsSelected")}`:t("sms.targetAllHint")})]})]}),p==="sms"&&i===5&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-2xl font-bold text-center",children:t("sms.reviewTitle")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-slate-800 border border-slate-700",children:[e.jsx("p",{className:"text-sm text-slate-400",children:t("campaigns.campaignName")}),e.jsx("p",{className:"font-medium text-white",children:a.name})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-slate-800 border border-slate-700",children:[e.jsx("p",{className:"text-sm text-slate-400",children:t("sms.messageBody")}),e.jsx("p",{className:"font-medium text-emerald-300 whitespace-pre-wrap",children:N}),e.jsxs("p",{className:"text-xs text-slate-500 mt-2",children:[(N==null?void 0:N.length)||0," ",t("sms.chars")]})]}),C.length>0&&e.jsxs("div",{className:"p-4 rounded-xl bg-slate-800 border border-slate-700",children:[e.jsx("p",{className:"text-sm text-slate-400",children:t("sms.targetTags")}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:C.map(s=>{const d=E.find(b=>b.id===s);return d?e.jsx("span",{className:"px-2 py-1 bg-indigo-500/20 text-indigo-300 rounded text-sm",children:d.name},s):null})})]}),_==="appointment_confirmation"&&R&&e.jsxs("div",{className:"p-4 rounded-xl bg-slate-800 border border-slate-700",children:[e.jsx("p",{className:"text-sm text-slate-400",children:t("sms.appointmentDatetime")}),e.jsx("p",{className:"font-medium text-white",children:new Date(`${R}T${M}
12`).toLocaleString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit"})})]}),_==="appointment_confirmation"&&e.jsxs("div",{className:"p-4 rounded-xl bg-indigo-500/5 border border-indigo-500/20",children:[e.jsx("p",{className:"text-sm font-medium text-indigo-300 mb-3",children:t("sms.appointmentReviewAutoReplies")}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs px-2 py-0.5 bg-emerald-500/10 text-emerald-400 rounded",children:t("sms.appointmentReviewReplyOn")}),e.jsx("span",{className:"text-slate-500",children:"→"}),e.jsx("span",{className:"text-slate-300",children:t("sms.replyFlowConfirm")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs px-2 py-0.5 bg-red-500/10 text-red-400 rounded",children:t("sms.appointmentReviewReplyOff")}),e.jsx("span",{className:"text-slate-500",children:"→"}),e.jsx("span",{className:"text-slate-300",children:t("sms.replyFlowCancel")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs px-2 py-0.5 bg-amber-500/10 text-amber-400 rounded",children:t("sms.appointmentReviewReplyReschedule")}),e.jsx("span",{className:"text-slate-500",children:"→"}),e.jsx("span",{className:"text-slate-300",children:t("sms.replyFlowReschedule")})]})]})]})]})]}),p==="voice"&&i===2&&e.jsx(Xe,{categories:ee,selected:a.category,onSelect:s=>S({...a,category:s}),getCategoryName:X}),p==="voice"&&i===3&&a.category!=="custom"&&e.jsx(Ie,{templates:se[a.category],selected:a.template,onSelect:s=>S({...a,template:s}),getTemplateName:Q,getTemplateDescription:je}),p==="voice"&&i===3&&a.category==="custom"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-white mb-2",children:t("newCampaign.selectScript")}),e.jsx("p",{className:"text-slate-400",children:t("newCampaign.selectScriptDesc")})]}),h.length>0&&e.jsx("div",{className:"grid gap-3",children:h.map(s=>e.jsx("button",{type:"button",onClick:()=>{K(s),S(d=>({...d,template:"custom"}))},className:`w-full text-left p-4 rounded-xl border-2 transition-all ${k===s.id?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:`font-medium ${k===s.id?"text-white":"text-slate-300"}`,children:s.name}),s.description&&e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:s.description})]}),e.jsx("span",{className:"text-xs text-slate-500 px-2 py-1 rounded bg-slate-700/50",children:s.category||"custom"})]})},s.id))}),e.jsx("div",{className:"border-t border-slate-700 pt-4",children:e.jsxs("button",{type:"button",onClick:()=>{w(null),S(s=>({...s,template:"custom",customPrompt:""}))},className:`w-full text-left p-4 rounded-xl border-2 transition-all ${a.template==="custom"&&!k?"border-indigo-500 bg-indigo-500/10":"border-slate-700 hover:border-slate-600 bg-slate-800/50"}`,children:[e.jsx("p",{className:`font-medium ${a.template==="custom"&&!k?"text-white":"text-slate-300"}`,children:t("newCampaign.writeFromScratch")}),e.jsx("p",{className:"text-sm text-slate-500 mt-1",children:t("newCampaign.writeFromScratchDesc")})]})})]}),p==="voice"&&i===4&&e.jsx(De,{professionals:$,loading:me,selectedId:a.professional_id,onSelect:s=>S({...a,professional_id:s})}),p==="voice"&&i===5&&e.jsx(es,{formData:a,onFormChange:S,templateInfo:z,tags:E,selectedTagIds:C,onToggleTag:Z,savedScripts:h,selectedScriptId:k,onSelectScript:K,contactCount:oe,countLoading:de,onClearTags:()=>W([]),professionals:$,getVariableLabel:be}),p==="voice"&&i===6&&e.jsx(ss,{formData:a,selectedCategoryData:ue,professionals:$,tags:E,selectedTagIds:C,getCategoryName:X,getTemplateName:Q,templates:se}),(()=>{var g;const d=i===(p==="sms"?3:6),b=(()=>{var y,x;if(i===1)return!!p;if(p==="sms"){if(i===2)return!!_;if(i===3)return!!(N!=null&&N.trim());if(i===4)return!!((y=a.name)!=null&&y.trim())}else{if(i===2)return!!a.category;if(i===3)return!!a.template;if(i===5)return!(!a.name||a.template==="custom"&&!((x=a.customPrompt)!=null&&x.trim()))}return!0})();return e.jsxs("div",{className:"flex justify-between mt-8 pt-6 border-t border-slate-700",children:[e.jsxs("button",{onClick:()=>{const y=m==="sms"?3:m?2:1,x=p==="sms"&&i===3?1:i-1;c(Math.max(y,x))},disabled:i<=(m==="sms"?3:m?2:1),className:"btn btn-secondary disabled:opacity-50",children:[e.jsx(D,{className:"w-4 h-4 mr-2"}),t("newCampaign.previous")]}),d?e.jsx("button",{onClick:ge,disabled:j||p==="sms"&&(!(N!=null&&N.trim())||!((g=a.name)!=null&&g.trim())),className:"btn btn-success disabled:opacity-50",children:j?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t("newCampaign.creating")]}):e.jsxs(e.Fragment,{children:[t("newCampaign.createCampaign"),e.jsx(V,{className:"w-4 h-4 ml-2"})]})}):e.jsxs("button",{onClick:()=>{c(p==="sms"&&i===1?3:i+1)},disabled:!b,className:"btn btn-primary disabled:opacity-50",children:[t("newCampaign.next"),e.jsx(Ye,{className:"w-4 h-4 ml-2"})]})]})})()]})]})}export{xs 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.