import{e,k as t,ay as s,aO as a}from"./vendor-element-plus.js?ver=3.1.8";import{aQ as i,W as n,Y as l,a5 as _,Z as m,aa as c,ab as d,a6 as o,a9 as p,a0 as r,X as f,a8 as h}from"./vendor.js?ver=3.1.8";import{_ as g,I as u}from"./fc-bits-ui.js?ver=3.1.8";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,subjects:this.campaign.subjects||[],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"},k={class:"fcrm_send_test_email_input_wrap"},E={class:"fcrm_input_hint"},I={class:"icon"},C={key:0,class:"icon"};const T=g(b,[["render",function(g,u,y,b,T,x){const A=e,O=t,V=i("Icons"),P=a,W=s;return n(),l(P,{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",C,[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",k,[d(A,{placeholder:g.$t("Email Address"),modelValue:T.test_email,"onUpdate:modelValue":u[0]||(u[0]=e=>T.test_email=e)},null,8,["placeholder","modelValue"]),o((n(),l(O,{disabled:T.sending_test,onClick:u[1]||(u[1]=e=>x.sendTestEmail()),type:"primary"},{default:_(()=>[p(c(g.$t("Send")),1)],void 0,!0),_:1},8,["disabled"])),[[W,T.sending_test]])]),m("p",E,[m("span",I,[d(V,{"icon-name":"el-icon-info"})]),p(" "+c(g.$t("Some_SmartCode_Not_Work_Alert")),1)])])])],void 0),_:1},8,["placement"])}]]);export{T as S};
