import{x as e,d as t,bh as s,J as a}from"./vendor-element-plus.js?ver=3.0.6";import{bi as i,b1 as n,y as l,c5 as _,x as m,br as c,J as d,c6 as o,I as p,aO as r,A as f,z as h}from"./vendor.js?ver=3.0.6";import{_ as g,I as u}from"./fc-bits-ui.js?ver=3.0.6";const y=window.fcAdmin.auth.email,b={name:"SendTestEmail",components:{Icons:u},props:{campaign:{type:Object,default:()=>({})},btn_text:{type:String,default:()=>""},btn_type:{type:String,default:()=>"default"},placement:{type:String,default:()=>"top"},btn_class:{type:String,default:()=>""},showIcon:{type:Boolean,default:()=>!0}},data:()=>({sending_test:!1,test_email:y}),methods:{sendTestEmail(){if(!this.campaign.email_body)return this.$notify.error({title:this.$t("Oops!"),message:this.$t("Cam_Please_peb"),offset:19});window.last_fc_test_email=this.test_email,this.sending_test=!0,this.$post("campaigns/send-test-email",{campaign:{id:this.campaign.id,settings:this.campaign.settings,email_subject:this.campaign.email_subject,email_pre_header:this.campaign.email_pre_header,email_body:this.campaign.email_body,design_template:this.campaign.design_template},test_campaign:"yes",email:this.test_email}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.handleError(e)}).finally(()=>{this.sending_test=!1})}},mounted(){window.last_fc_test_email&&(this.test_email=window.last_fc_test_email)}},v={class:"fcrm_send_test_email_content"},w={class:"fcrm_send_test_email_content_header"},S={class:"fcrm_send_test_email_title"},$={class:"fcrm_send_test_email_description"},j={class:"fcrm_send_test_email_content_footer"},I={class:"fcrm_send_test_email_input_wrap"},x={class:"fcrm_input_hint"},E={class:"icon"},k={key:0,class:"icon"};const A=g(b,[["render",function(g,u,y,b,A,C){const T=e,O=t,V=i("Icons"),J=a,P=s;return n(),l(J,{placement:y.placement,width:"400","popper-class":"fcrm_send_test_email_popover",trigger:"click"},{reference:_(()=>[d(O,{type:y.btn_type,class:r(y.btn_class)},{default:_(()=>[y.showIcon?(n(),f("span",k,[d(V,{"icon-name":"paperPlane"})])):h("",!0),p(" "+c(y.btn_text||g.$t("Send a test email")),1)],void 0,!0),_:1},8,["type","class"])]),default:_(()=>[m("div",v,[m("div",w,[m("h3",S,c(g.$t("Send a test email")),1),m("p",$,c(g.$t("Cam_Type_cetstolbtsc")),1)]),m("div",j,[m("div",I,[d(T,{placeholder:g.$t("Email Address"),modelValue:A.test_email,"onUpdate:modelValue":u[0]||(u[0]=e=>A.test_email=e)},null,8,["placeholder","modelValue"]),o((n(),l(O,{disabled:A.sending_test,onClick:u[1]||(u[1]=e=>C.sendTestEmail()),type:"primary"},{default:_(()=>[p(c(g.$t("Send")),1)],void 0,!0),_:1},8,["disabled"])),[[P,A.sending_test]])]),m("p",x,[m("span",E,[d(V,{"icon-name":"el-icon-info"})]),p(" "+c(g.$t("Some_SmartCode_Not_Work_Alert")),1)])])])],void 0),_:1},8,["placement"])}]]);export{A as S};