import{e,k as t,ay as s,aO as a}from"./vendor-element-plus.js?ver=3.1.0";import{_ as i,I as n}from"./fc-bits-ui.js?ver=3.1.0";import{r as l,a as _,o as m,w as c,b as d,P as o,d as p,K as r,O as f,n as h,c as g,L as u}from"./vendor.js?ver=3.1.0";const y=window.fcAdmin.auth.email,b={name:"SendTestEmail",components:{Icons:n},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 O=i(b,[["render",function(i,n,y,b,O,T){const x=e,A=t,P=l("Icons"),V=a,B=s;return m(),_(V,{placement:y.placement,width:"400","popper-class":"fcrm_send_test_email_popover",trigger:"click"},{reference:c(()=>[p(A,{type:y.btn_type,class:h(y.btn_class)},{default:c(()=>[y.showIcon?(m(),g("span",C,[p(P,{"icon-name":"paperPlane"})])):u("",!0),f(" "+o(y.btn_text||i.$t("Send a test email")),1)],void 0,!0),_:1},8,["type","class"])]),default:c(()=>[d("div",v,[d("div",w,[d("h3",S,o(i.$t("Send a test email")),1),d("p",$,o(i.$t("Cam_Type_cetstolbtsc")),1)]),d("div",j,[d("div",k,[p(x,{placeholder:i.$t("Email Address"),modelValue:O.test_email,"onUpdate:modelValue":n[0]||(n[0]=e=>O.test_email=e)},null,8,["placeholder","modelValue"]),r((m(),_(A,{disabled:O.sending_test,onClick:n[1]||(n[1]=e=>T.sendTestEmail()),type:"primary"},{default:c(()=>[f(o(i.$t("Send")),1)],void 0,!0),_:1},8,["disabled"])),[[B,O.sending_test]])]),d("p",E,[d("span",I,[p(P,{"icon-name":"el-icon-info"})]),f(" "+o(i.$t("Some_SmartCode_Not_Work_Alert")),1)])])])],void 0),_:1},8,["placement"])}]]);export{O as S};