| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Create-c0321a7f.js |
import{r as h,T as j,c as n,f as c,g as x,F as w,o as a,a as e,t as l,u as o,l as B,k as g,h as _,n as p,b as f,e as R}from"./app-f1493ab2.js";import{_ as T}from"./App-45dbd9fa.js";import{t as u}from"./index-764662c4.js";import{_ as A}from"./FormInput-b3450213.js";import{_ as y}from"./FormSelect-3a6ffebd.js";import{_ as N}from"./FormTextArea-95511fff.js";import{_ as U}from"./Modal-a0814fa2.js";import"./Sidebar-f2ddcf5a.js";import"./Menu-73c1148a.js";import"./ProfileModal-09ae28bb.js";import"./tabs-80627b62.js";import"./hidden-f79cef22.js";import"./micro-task-89dcd6af.js";import"./transition-f32a8133.js";import"./use-outside-click-92c6377f.js";import"./LangToggle-d2b58a25.js";import"./index-114bea05.js";import"./MobileSidebar-e6661e49.js";/* empty css */import"./pusher-a82d1614.js";import"./use-text-value-ecd8c541.js";const F={class:"bg-white md:bg-inherit pt-10 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] h-full md:overflow-y-auto"},O={class:"flex justify-between"},P={class:"text-xl mb-1"},I={class:"mb-6 flex items-center text-sm leading-6 text-gray-600"},D={class:"ml-1 mt-1"},E={class:"flex border-b py-5"},G={class:"w-[40%] mb-1"},H={class:"text-sm text-gray-500 tracking-[0px]"},W={class:"w-[60%] flex space-x-6"},z={class:"w-[80%]"},J={class:"flex border-b py-5"},q={class:"w-[40%] mb-1"},K={class:"text-sm text-gray-500 tracking-[0px]"},Q={class:"flex text-xs mt-2"},X={class:"w-[60%] flex space-x-6"},Y={class:"w-[80%]"},ee={class:"flex border-b py-5"},te={class:"w-[40%] mb-1"},se={class:"text-sm text-gray-500 tracking-[0px]"},oe={class:"flex text-xs mt-2"},ie={class:"w-[60%] flex space-x-6"},le={class:"w-[80%]"},re={class:"flex border-b py-5"},ne={class:"w-[40%] mb-1"},ae={class:"text-sm text-gray-500 tracking-[0px]"},de={class:"w-[60%] flex space-x-6"},ce={class:"w-[80%]"},pe={key:0,class:"flex py-5"},ue={class:"w-[40%] mb-1"},me={class:"text-sm text-gray-500 tracking-[0px]"},he={class:"w-[60%] flex space-x-6"},ge={class:"w-[80%]"},fe={class:p("sm:col-span-6 mb-2")},xe={class:"mt-2"},ve={key:0,class:"form-error text-[#b91c1c] text-xs"},be={type:"submit",class:"float-right flex items-center space-x-4 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},we={key:1,class:"flex py-5"},_e={class:"w-[40%] mb-1"},ye={key:0,class:"text-sm text-gray-500 tracking-[0px]"},ke={key:1,class:"text-sm text-gray-500 tracking-[0px]"},$e={class:"w-[60%] flex space-x-6"},Ce={class:"w-[80%]"},Ve=["accept"],Le={class:"text-center"},Me={key:0,class:"flex justify-center items-center"},Se={class:"flex justify-center items-center space-x-3 py-1 border bg-slate-100 rounded-lg mb-2 w-fit px-2"},Ze={class:"flex items-center space-x-2"},je={class:"text-sm"},Be={class:"flex justify-center text-sm text-gray-600"},Re={key:0,for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"},Te={class:"text-xs text-center text-gray-500"},Ae={key:1,for:"file-upload",class:"relative cursor-pointer bg-white rounded-md font-medium hover:text-indigo-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"},Ne={class:"text-xs text-center text-gray-500"},Ue={key:0,class:"form-error text-[#b91c1c] text-xs"},Fe={type:"submit",class:"mt-10 float-right flex items-center space-x-4 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm hover:bg-slate-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},Oe={class:"mt-2 grid grid-cols-1 gap-x-6"},Pe={class:"pt-3 grid grid-cols-2 gap-x-2 text-sm gap-y-1"},Ie=["onClick"],De={class:"mt-4 border-t pt-4"},ct={__name:"Create",props:["placeholders"],setup(k){const $=k,m=h(!1),v=h(null),C=i=>{const t=v.value;if(t){const d=t.selectionStart,r=t.selectionEnd;t.value=`${t.value.substring(0,d)}${i}${t.value.substring(r)}`}m.value=!1},V=i=>{s.response=i.target.value},s=j({name:null,trigger:null,match_criteria:null,response_type:"text",response:null}),L=h([{value:"exact match",label:u("When text is an exact match to trigger text")},{value:"contains",label:u("When text contains trigger text")}]),M=h([{value:"text",label:u("Respond with text")},{value:"image",label:u("Respond with image")},{value:"audio",label:u("Respond with audio")}]),S=i=>{const t=i.target.files[0],d=new FileReader;d.onload=r=>{s.response=t},d.readAsDataURL(t)},b=()=>{s.response=null},Z=()=>{s.post("/automation/basic",{preserveScroll:!0,onSuccess:()=>s.reset()})};return(i,t)=>(a(),n(w,null,[c(T,null,{default:x(()=>{var d;return[e("div",F,[e("div",O,[e("div",null,[e("h2",P,l(i.$t("Create automation")),1),e("p",I,[t[9]||(t[9]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),e("span",D,l(i.$t("Create reply automation using your own criteria")),1)])]),e("div",null,[c(o(B),{href:"/automation/basic",class:"flex items-center space-x-4 rounded-md bg-indigo-600 px-3 py-2 text-sm text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},{default:x(()=>[t[10]||(t[10]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M5.841 5.28a.75.75 0 0 0-1.06-1.06L1.53 7.47L1 8l.53.53l3.25 3.25a.75.75 0 0 0 1.061-1.06l-1.97-1.97H24.25a.75.75 0 0 0 0-1.5H3.871l1.97-1.97Z","clip-rule":"evenodd"})],-1)),g(" "+l(i.$t("Back")),1)]),_:1})])]),e("form",{onSubmit:t[7]||(t[7]=_(r=>Z(),["prevent"])),class:"bg-white border py-5 px-5 rounded-[0.5rem]"},[e("div",E,[e("div",G,[e("h2",H,l(i.$t("Name")),1)]),e("div",W,[e("div",z,[c(A,{modelValue:o(s).name,"onUpdate:modelValue":t[0]||(t[0]=r=>o(s).name=r),type:"text",error:o(s).errors.name,class:p("w-full"),labelClass:"mb-0"},null,8,["modelValue","error"])])])]),e("div",J,[e("div",q,[e("h2",K,l(i.$t("Trigger")),1),e("span",Q,[t[11]||(t[11]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),g(" "+l(i.$t("Add the string of text responsible for triggering the response")),1)])]),e("div",X,[e("div",Y,[c(N,{modelValue:o(s).trigger,"onUpdate:modelValue":t[1]||(t[1]=r=>o(s).trigger=r),type:"text",error:o(s).errors.trigger,textAreaRows:3,class:p("sm:col-span-6 mb-10")},null,8,["modelValue","error"])])])]),e("div",ee,[e("div",te,[e("h2",se,l(i.$t("Match criteria")),1),e("span",oe,[t[12]||(t[12]=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"15",height:"15",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 11v5m0 5a9 9 0 1 1 0-18a9 9 0 0 1 0 18Zm.05-13v.1h-.1V8h.1Z"})],-1)),g(" "+l(i.$t("Select the criteria for matching the trigger text above")),1)])]),e("div",ie,[e("div",le,[c(y,{modelValue:o(s).match_criteria,"onUpdate:modelValue":t[2]||(t[2]=r=>o(s).match_criteria=r),options:L.value,error:o(s).errors.match_criteria,class:p("sm:col-span-6"),placeholder:i.$t("Select criteria")},null,8,["modelValue","options","error","placeholder"])])])]),e("div",re,[e("div",ne,[e("h2",ae,l(i.$t("Response type")),1)]),e("div",de,[e("div",ce,[c(y,{modelValue:o(s).response_type,"onUpdate:modelValue":[t[3]||(t[3]=r=>o(s).response_type=r),b],options:M.value,error:o(s).errors.response_type,class:p("sm:col-span-6"),placeholder:"Select Type"},null,8,["modelValue","options","error"])])])]),o(s).response_type==="text"?(a(),n("div",pe,[e("div",ue,[e("h2",me,l(i.$t("Text response")),1)]),e("div",he,[e("div",ge,[e("div",null,[e("div",fe,[e("div",xe,[e("textarea",{class:p(["block w-full rounded-md border-0 py-1.5 px-4 text-gray-900 shadow-sm outline-none ring-1 ring-inset placeholder:text-gray-400 sm:text-sm sm:leading-6",o(s).errors.response?"ring-[#b91c1c]":"ring-gray-300"]),onInput:V,rows:"3",ref_key:"textareaRef",ref:v},l(o(s).response),35)]),o(s).errors.response?(a(),n("div",ve,l(o(s).errors.response),1)):f("",!0)]),e("button",{type:"button",onClick:t[4]||(t[4]=r=>m.value=!0),class:"bg-slate-100 px-2 py-1 rounded-md text-sm flex items-center gap-x-1 shadow-sm"},t[13]||(t[13]=[g(" Add Variable "),e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[e("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M8.25 15L12 18.75L15.75 15m-7.5-6L12 5.25L15.75 9"})],-1)]))]),e("button",be,l(i.$t("Save")),1)])])])):o(s).response_type==="image"||o(s).response_type==="audio"?(a(),n("div",we,[e("div",_e,[o(s).response_type==="image"?(a(),n("h2",ye,l(i.$t("Image response")),1)):(a(),n("h2",ke,l(i.$t("Audio response")),1))]),e("div",$e,[e("div",Ce,[e("div",{class:p([o(s).errors.response?"border-[#b91c1c]":"border-gray-300","flex justify-center px-6 pt-5 pb-6 border-2 border-dashed rounded-md"])},[e("input",{type:"file",class:"sr-only",accept:o(s).response_type==="image"?".jpg, .png":".mp3",ref:"fileInput",id:"file-upload",onChange:t[5]||(t[5]=r=>S(r))},null,40,Ve),e("div",Le,[e("div",null,[o(s).response?(a(),n("div",Me,[e("div",Se,[t[15]||(t[15]=e("div",null,[e("svg",{class:"mx-auto h-6 w-6 text-gray-400 cursor-pointer",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor",d:"M14 9a1.5 1.5 0 1 1 3 0a1.5 1.5 0 0 1-3 0Z"}),e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M7.268 4.658a54.647 54.647 0 0 1 9.465 0l1.51.132a3.138 3.138 0 0 1 2.831 2.66a30.604 30.604 0 0 1 0 9.1a3.138 3.138 0 0 1-2.831 2.66l-1.51.131c-3.15.274-6.316.274-9.465 0l-1.51-.131a3.138 3.138 0 0 1-2.832-2.66a30.601 30.601 0 0 1 0-9.1a3.138 3.138 0 0 1 2.831-2.66l1.51-.132Zm9.335 1.495a53.147 53.147 0 0 0-9.206 0l-1.51.131A1.638 1.638 0 0 0 4.41 7.672a29.101 29.101 0 0 0-.311 5.17L7.97 8.97a.75.75 0 0 1 1.09.032l3.672 4.13l2.53-.844a.75.75 0 0 1 .796.21l3.519 3.91a29.101 29.101 0 0 0 .014-8.736a1.638 1.638 0 0 0-1.478-1.388l-1.51-.131Zm2.017 11.435l-3.349-3.721l-2.534.844a.75.75 0 0 1-.798-.213l-3.471-3.905l-4.244 4.243c.049.498.11.996.185 1.491a1.638 1.638 0 0 0 1.478 1.389l1.51.131c3.063.266 6.143.266 9.206 0l1.51-.131c.178-.016.35-.06.507-.128Z","clip-rule":"evenodd"})])],-1)),e("div",Ze,[e("span",je,l(((d=o(s).response)==null?void 0:d.name)??o(s).response),1),e("button",{type:"button",onClick:t[6]||(t[6]=r=>b())},t[14]||(t[14]=[e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M17.707 7.707a1 1 0 0 0-1.414-1.414L12 10.586L7.707 6.293a1 1 0 0 0-1.414 1.414L10.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414L12 13.414l4.293 4.293a1 1 0 1 0 1.414-1.414L13.414 12l4.293-4.293Z","clip-rule":"evenodd"})],-1)]))])])])):f("",!0),e("div",Be,[o(s).response_type==="image"?(a(),n("label",Re,[e("p",null,l(i.$t("Click to upload image")),1),e("p",Te,l(i.$t("PNG or JPG files only")),1)])):(a(),n("label",Ae,[e("p",null,l(i.$t("Click to upload audio")),1),e("p",Ne,l(i.$t("MP3 files only")),1)]))])])])],2),o(s).errors.response?(a(),n("div",Ue,l(o(s).errors.response),1)):f("",!0),e("button",Fe,l(i.$t("Save")),1)])])])):f("",!0)],32)])]}),_:1}),c(U,{label:i.$t("Select variable"),isOpen:m.value},{default:x(()=>[t[16]||(t[16]=e("div",{class:"flex bg-slate-50 p-2 rounded-md mt-3"},[e("span",{class:"font-light text-sm"},"Select a placeholder to add to your response. The placeholder will replace itself with the actual data.")],-1)),e("div",Oe,[e("div",Pe,[(a(!0),n(w,null,R($.placeholders,d=>(a(),n("button",{onClick:r=>C(d.value),class:"col-span-1 bg-gray-100 p-2 rounded-md text-left hover:bg-gray-50"},l(i.$t(d.label)),9,Ie))),256))]),e("div",De,[e("button",{type:"button",onClick:t[8]||(t[8]=_(d=>m.value=!1,["self"])),class:"inline-flex justify-center rounded-md border border-transparent bg-slate-50 px-4 py-2 text-sm text-slate-500 hover:bg-slate-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 mr-4"},l(i.$t("Cancel")),1)])])]),_:1},8,["label","isOpen"])],64))}};export{ct as default};