1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[3527],{3527:function(e,t,s){s.r(t),s.d(t,{default:function(){return ee}});s(44114);var i=s(20641),a=s(90033);const l={key:1,class:"builder-lock-pane"},n={class:"ns-content-toolbar builder-lock-chrome"},o={class:"ns-content-toolbar-left"},r={class:"icon is-small"},d={class:"button is-light is-small is-rounded"},m={class:"icon is-small mr-1"},u={class:"ns-content-toolbar-right"},c=["disabled"],h={class:"icon is-small mr-1"},p=["disabled"],g={key:2,class:"columns"},v={class:"column ml-5"},w={class:"ml-4 mr-4"};function b(e,t,s,b,f,y){const k=(0,i.g2)("b-loading"),L=(0,i.g2)("NewsletterScheduleModal"),$=(0,i.g2)("font-awesome-icon"),S=(0,i.g2)("b-input"),T=(0,i.g2)("b-dropdown-item"),E=(0,i.g2)("b-dropdown"),N=(0,i.g2)("NewsletterBuilderProxy"),C=(0,i.g2)("NewsletterSubmenu"),_=(0,i.g2)("b-field");return(0,i.uX)(),(0,i.CE)("section",{class:(0,a.C4)({"is-builder-locked":f.createEditTemplate})},[(0,i.bF)(k,{modelValue:f.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>f.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),f.itemNewsletter?((0,i.uX)(),(0,i.Wv)(L,{key:0,modelValue:f.showScheduleModal,"onUpdate:modelValue":t[1]||(t[1]=e=>f.showScheduleModal=e),newsletter:f.itemNewsletter,"is-loading":f.isLoadingSave,onConfirm:y.confirmSchedule,onCancel:y.cancelSchedule},null,8,["modelValue","newsletter","is-loading","onConfirm","onCancel"])):(0,i.Q3)("",!0),f.createEditTemplate?((0,i.uX)(),(0,i.CE)("div",l,[(0,i.Lk)("div",n,[(0,i.Lk)("div",o,[(0,i.Lk)("button",{class:"button is-white is-small is-rounded",onClick:t[2]||(t[2]=t=>e.$router.push({name:"NewsletterTemplateSelection"}))},[(0,i.Lk)("span",r,[(0,i.bF)($,{icon:"fa-light fa-chevron-left"})])]),(0,i.bF)(S,{modelValue:f.template.name,"onUpdate:modelValue":t[3]||(t[3]=e=>f.template.name=e),placeholder:e.$t("Template name"),size:"is-small",required:"",class:"nb-template-name-input"},null,8,["modelValue","placeholder"]),(0,i.bF)(E,{"aria-role":"list",position:"is-bottom-right"},{trigger:(0,i.k6)(()=>[(0,i.Lk)("button",d,[(0,i.Lk)("span",m,[(0,i.bF)($,{icon:"fa-light fa-brackets-curly"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Placeholders")),1)])]),default:(0,i.k6)(()=>[((0,i.uX)(!0),(0,i.CE)(i.FK,null,(0,i.pI)(f.placeholders,e=>((0,i.uX)(),(0,i.Wv)(T,{key:e.key,"aria-role":"listitem",onClick:t=>y.copyPlaceholder(e.key)},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.key),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),(0,i.Lk)("div",u,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-light is-small is-rounded",{"is-loading":f.isLoadingPreview}]),disabled:f.isLoadingPreview,onClick:t[4]||(t[4]=(...e)=>y.sendPreviewEmailTemplate&&y.sendPreviewEmailTemplate(...e))},[(0,i.Lk)("span",h,[(0,i.bF)($,{icon:"fa-light fa-envelope"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Send test")),1)],10,c),(0,i.Lk)("button",{class:(0,a.C4)(["button is-primary is-small is-rounded",{"is-loading":f.isLoadingSave}]),disabled:f.isLoadingSave,onClick:t[5]||(t[5]=(...e)=>y.save&&y.save(...e))},[(0,i.Lk)("span",null,(0,a.v_)(e.$t("Save")),1)],10,p)])]),(0,i.bF)(N,{ref:"emailEditor",mode:"template","item-id":f.itemId,"create-edit-template":f.createEditTemplate,height:"1200px",onEditorLoaded:y.editorLoaded},null,8,["item-id","create-edit-template","onEditorLoaded"])])):((0,i.uX)(),(0,i.CE)("div",g,[(0,i.bF)(C,{item:f.itemNewsletter,"item-template":f.itemTemplate,"create-edit-template":f.createEditTemplate,"is-loading-save":f.isLoadingSave,"is-loading-preview":f.isLoadingPreview,onSave:y.save,onSaveSend:y.saveSend,onSchedule:e.openScheduleModal,onSendPreviewEmail:y.sendPreviewEmail,onSendPreviewEmailTemplate:y.sendPreviewEmailTemplate},null,8,["item","item-template","create-edit-template","is-loading-save","is-loading-preview","onSave","onSaveSend","onSchedule","onSendPreviewEmail","onSendPreviewEmailTemplate"]),(0,i.Lk)("div",v,[(0,i.Lk)("div",w,[f.itemNewsletter?((0,i.uX)(),(0,i.Wv)(_,{key:0,"aria-disabled":f.isLoading,label:e.$t("Email subject"),class:"mb-5"},{default:(0,i.k6)(()=>[(0,i.bF)(S,{modelValue:f.itemNewsletter.subject,"onUpdate:modelValue":t[6]||(t[6]=e=>f.itemNewsletter.subject=e),required:""},null,8,["modelValue"])]),_:1},8,["aria-disabled","label"])):(0,i.Q3)("",!0),(0,i.bF)(N,{ref:"emailEditor",mode:"newsletter","item-id":f.itemId,"create-edit-template":f.createEditTemplate,height:"1200px",onEditorLoaded:y.editorLoaded},null,8,["item-id","create-edit-template","onEditorLoaded"])])])]))],2)}s(18111),s(61701);var f=s(34622),y=s(40834),k=s(95256),L=s(82235);const $={class:"schedule-modal"},S={class:"schedule-modal__header"},T={class:"schedule-modal__icon"},E={class:"schedule-modal__title"},N={class:"schedule-modal__subtitle"},C={key:0,class:"schedule-modal__preview"},_={class:"schedule-modal__preview-label"},P={class:"schedule-modal__preview-datetime"},D={class:"schedule-modal__preview-timezone"},x={class:"schedule-modal__form"},U={class:"columns is-mobile mb-4"},F={class:"column is-7"},I={class:"schedule-modal__label"},A={class:"column is-5"},z={class:"schedule-modal__label"},M={class:"mb-2"},V={class:"schedule-modal__label"},B={key:0,class:"schedule-modal__warning"},W={class:"schedule-modal__footer"};function X(e,t,s,l,n,o){const r=(0,i.g2)("font-awesome-icon"),d=(0,i.g2)("b-datepicker"),m=(0,i.g2)("b-timepicker"),u=(0,i.g2)("TimezoneSelect"),c=(0,i.g2)("b-button"),h=(0,i.g2)("b-modal");return(0,i.uX)(),(0,i.Wv)(h,{"model-value":s.modelValue,width:640,scroll:"keep","onUpdate:modelValue":t[4]||(t[4]=t=>e.$emit("update:modelValue",t))},{default:(0,i.k6)(()=>[(0,i.Lk)("div",$,[(0,i.Lk)("div",S,[(0,i.Lk)("div",T,[(0,i.bF)(r,{icon:"fa-light fa-calendar-clock"})]),(0,i.Lk)("div",null,[(0,i.Lk)("h2",E,(0,a.v_)(e.$t("Schedule newsletter")),1),(0,i.Lk)("p",N,(0,a.v_)(e.$t("Choose when your newsletter will be sent")),1)])]),o.canSchedule?((0,i.uX)(),(0,i.CE)("div",C,[(0,i.Lk)("div",_,[(0,i.bF)(r,{icon:"fa-light fa-paper-plane",class:"mr-2"}
1),(0,i.eW)(" "+(0,a.v_)(o.isScheduled?e.$t("Currently scheduled"):e.$t("Will be sent")),1)]),(0,i.Lk)("div",P,(0,a.v_)(o.formattedSchedulePreview),1),(0,i.Lk)("div",D,(0,a.v_)(n.localTimezone),1)])):(0,i.Q3)("",!0),(0,i.Lk)("div",x,[(0,i.Lk)("div",U,[(0,i.Lk)("div",F,[(0,i.Lk)("label",I,(0,a.v_)(e.$t("Date")),1),(0,i.bF)(d,{modelValue:n.localDate,"onUpdate:modelValue":t[0]||(t[0]=e=>n.localDate=e),"min-date":o.minScheduleDate,icon:"calendar","mobile-native":!1,"append-to-body":"","trap-focus":""},null,8,["modelValue","min-date"])]),(0,i.Lk)("div",A,[(0,i.Lk)("label",z,(0,a.v_)(e.$t("Time")),1),(0,i.bF)(m,{modelValue:n.localTime,"onUpdate:modelValue":t[1]||(t[1]=e=>n.localTime=e),icon:"clock","hour-format":"24","increment-minutes":15,"mobile-native":!1,"append-to-body":"","trap-focus":""},null,8,["modelValue"])])]),(0,i.Lk)("div",M,[(0,i.Lk)("label",V,(0,a.v_)(e.$t("Timezone")),1),(0,i.bF)(u,{modelValue:n.localTimezone,"onUpdate:modelValue":t[2]||(t[2]=e=>n.localTimezone=e),"init-value":n.localTimezone},null,8,["modelValue","init-value"])]),o.isTooSoon?((0,i.uX)(),(0,i.CE)("div",B,[(0,i.bF)(r,{icon:"fa-light fa-circle-exclamation",class:"mr-2"}),(0,i.eW)(" "+(0,a.v_)(e.$t("Scheduled time must be at least 2 minutes in the future")),1)])):(0,i.Q3)("",!0)]),(0,i.Lk)("div",W,[o.isScheduled?((0,i.uX)(),(0,i.Wv)(c,{key:0,class:"is-rounded",type:"is-danger is-light",onClick:o.onCancelSchedule},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(e.$t("remove")),1)]),_:1},8,["onClick"])):(0,i.Q3)("",!0),t[5]||(t[5]=(0,i.Lk)("div",{class:"schedule-modal__footer-spacer"},null,-1)),(0,i.bF)(c,{class:"is-rounded",onClick:t[3]||(t[3]=t=>e.$emit("update:modelValue",!1))},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(o.isScheduled?e.$t("close"):e.$t("Cancel")),1)]),_:1}),(0,i.bF)(c,{class:"is-rounded is-primary",loading:s.isLoading,disabled:!o.canSchedule,onClick:o.onConfirmSchedule},{default:(0,i.k6)(()=>[(0,i.eW)((0,a.v_)(o.isScheduled?e.$t("update"):e.$t("Schedule send")),1)]),_:1},8,["loading","disabled","onClick"])])])]),_:1},8,["model-value"])}var R=s(90957),H=s(84743),q=s.n(H),Q={name:"NewsletterScheduleModal",components:{TimezoneSelect:R.A},props:{modelValue:{type:Boolean,default:!1},newsletter:{type:Object,required:!0},isLoading:{type:Boolean,default:!1}},emits:["update:modelValue","confirm","cancel"],data(){return{localDate:null,localTime:null,localTimezone:null}},computed:{...(0,y.L8)(["tenant","user"]),defaultTimezone(){return this.user&&this.user.timezone?this.user.timezone:this.tenant?.timezone},minScheduleDate(){const e=new Date;return e.setHours(0,0,0,0),e},canSchedule(){return this.localDate&&this.localTime&&this.localTimezone&&!this.isTooSoon},isTooSoon(){if(!this.localDate||!this.localTime)return!1;const e=new Date(this.localDate);e.setHours(this.localTime.getHours(),this.localTime.getMinutes(),0,0);const t=new Date(Date.now()+12e4);return e<=t},isScheduled(){return this.newsletter&&"Scheduled"===this.newsletter.status},formattedSchedulePreview(){if(!this.localDate||!this.localTime)return"";const e=new Date(this.localDate);e.setHours(this.localTime.getHours(),this.localTime.getMinutes(),0,0);const t={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1};return e.toLocaleDateString(this.$i18n?.locale||"en",t)}},watch:{modelValue:{immediate:!0,handler(e){e&&this.initializeValues()}}},methods:{initializeValues(){if(this.newsletter&&this.newsletter.scheduledAt){const e=this.newsletter.timezone||this.defaultTimezone,t=q().utc(this.newsletter.scheduledAt).tz(e),s=new Date(t.year(),t.month(),t.date(),t.hours(),t.minutes(),0,0);this.localDate=s,this.localTime=s,this.localTimezone=e}else{const e=new Date;e.setDate(e.getDate()+1),e.setHours(9,0,0,0),this.localDate=e,this.localTime=e,this.localTimezone=this.defaultTimezone}},onConfirmSchedule(){if(!this.canSchedule)return;const e=new Date(this.localDate);e.setHours(this.localTime.getHours(),this.localTime.getMinutes(),0,0);const t=q()(e).tz(this.localTimezone,!0).utc().format();this.$emit("confirm",{scheduledAt:t,timezone:this.localTimezone})},onCancelSchedule(){this.$buefy.dialog.confirm({title:this.$t("Cancel schedule"),message:this.$t("Are you sure you want to cancel the scheduled send? The newsletter will be reverted to draft status."),confirmText:this.$t("Cancel schedule"),cancelText:this.$t("Keep scheduled"),type:"is-danger",onConfirm:()=>{this.$emit("cancel")}})}}},j=s(66262);const J=(0,j.A)(Q,[["render",X],["__scopeId","data-v-68365e34"]]);var K=J,O=s(21389),G=s(51726),Y={mixins:[O.A],data(){return{unlayerProjectId:265057,itemId:this.$route.params.item?this.$route.params.item:null,createEditTemplate:!!this.$route.query.createEditTemplate&&this.$route.query.createEditTemplate,itemNewsletter:null,itemTemplate:null,isLoading:!1,isLoadingPreview:!1,isLoadingSave:!1,isAutoSaving:!1,autoSaveTimer:null,signedUrl:"",template:{name:"",html:""},showScheduleModal:!1,placeholders:G.$.map(e=>({key:e.value}))}},mounted(){},created(){},beforeUnmount(){this.stopAutoSave()},methods:{copyToClipboard:k.lW,copyPlaceholder(e){this.copyToClipboard(e),this.$buefy.toast.o
1pen({message:this.$t("Copied")+": "+e,type:"is-info",duration:1e3})},editorLoaded(){this.retrieve(),this.startAutoSave()},initEditorDesign(e){this.$refs.emailEditor.loadDesign(e)},retrieve(){this.isLoading=!0,this.createEditTemplate?this.itemId?this.retrieveTemplate():this.isLoading=!1:this.retrieveNewsletter()},retrieveNewsletter(){this.$http.plain.get("/newsletters/"+this.itemId).then(e=>{this.itemNewsletter=e.data,this.initEditorDesign(e.data.design)}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},retrieveTemplate(){this.$http.plain.get("/newsletter_templates/"+this.itemId).then(e=>{this.template.name=e.data.name,this.itemTemplate=e.data,this.initEditorDesign(e.data.design),this.$route.query.duplicate&&(this.template.name="Copy "+this.template.name)}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},saveBuilderContent(){!this.isAutoSaving&&this.$refs.emailEditor&&(!this.createEditTemplate||this.itemId&&this.itemTemplate)&&(this.createEditTemplate||this.itemNewsletter)&&(this.isAutoSaving=!0,this.$refs.emailEditor.exportHtml().then(e=>this.createEditTemplate?this.$http.plain.patch("/newsletter_templates/"+this.itemId,{design:e.design,htmlInline:e.html,name:this.template.name}):this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid,{design:e.design,htmlInline:e.html,htmlRaw:e.html,subject:this.itemNewsletter.subject})).then(e=>{this.createEditTemplate?this.itemTemplate=e.data:this.itemNewsletter=e.data}).catch(e=>{console.log(e)}).finally(()=>{this.isAutoSaving=!1}))},startAutoSave(){this.stopAutoSave(),this.autoSaveTimer=setInterval(()=>{this.saveBuilderContent()},3e4)},stopAutoSave(){this.autoSaveTimer&&(clearInterval(this.autoSaveTimer),this.autoSaveTimer=null)},save(){this.createEditTemplate?this.saveTemplate():this.saveNewsletter()},async saveNewsletter(){if(!this.isLoadingSave)try{this.isLoadingSave=!0;const e=await this.$refs.emailEditor.exportHtml(),t=await this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid,{design:e.design,htmlInline:e.html,htmlRaw:e.html,subject:this.itemNewsletter.subject});this.itemNewsletter=t.data,this.$buefy.toast.open({message:this.$t("saved"),type:"is-success",duration:3e3})}catch(e){console.error("Save newsletter error:",e),this.$buefy.toast.open({message:this.$t("Failed to save newsletter")+": "+(e.message||"Unknown error"),type:"is-danger",duration:5e3})}finally{this.isLoadingSave=!1}},async saveSend(){const e=this.itemNewsletter.recipients?this.itemNewsletter.recipients:0,t="Scheduled"===this.itemNewsletter.status;let s=this.$t("Are you sure you want to send this newsletter to all subscribers? This action cannot be undone.");t&&(s=this.$t("This newsletter is currently scheduled. Sending now will cancel the schedule and send immediately.")+"<br><br>"+s),s+="<br><br><strong>"+this.$t("Total recipients")+": "+e+"</strong>",this.$buefy.dialog.confirm({title:t?this.$t("Send now"):this.$t("Send newsletter"),message:s,confirmText:t?this.$t("Send now"):this.$t("Send"),cancelText:this.$t("Cancel"),type:t?"is-danger":"is-warning",onConfirm:async()=>{if(!this.isLoadingSave)try{this.isLoadingSave=!0;const e=await this.$refs.emailEditor.exportHtml();return await this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid,{design:e.design,htmlInline:e.html,subject:this.itemNewsletter.subject}),await this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid+"/send",{}),this.$buefy.toast.open({duration:5e3,message:this.$t("Newsletter sending started")+"...",type:"is-success"}),this.$router.push({name:"NewsletterShow",params:{item:this.itemNewsletter.uuid}})}catch(e){console.error("Send newsletter error:",e),this.$buefy.toast.open({message:this.$t("Failed to send newsletter")+": "+(e.message||"Unknown error"),type:"is-danger",duration:5e3})}finally{this.isLoadingSave=!1}}})},async saveTemplate(){if(!this.template.name)return this.$buefy.toast.open({message:this.$t("Please provide a template name"),type:"is-danger",duration:3e3});this.isLoadingSave=!0;try{this.itemId&&0!==this.itemId&&this.itemTemplate&&!this.$route.query.duplicate?await this.saveExistingTemplate():await this.saveNewTemplate()}catch(e){console.error("Template save error:",e),this.$buefy.toast.o
1pen({message:this.$t("Failed to save template")+": "+(e.message||"Unknown error"),type:"is-danger",duration:5e3})}finally{this.isLoadingSave=!1}},async saveExistingTemplate(){try{const e=await this.$refs.emailEditor.exportHtml(),t=await this.$http.plain.patch("/newsletter_templates/"+this.itemId,{design:e.design,htmlInline:e.html,name:this.template.name});this.itemTemplate=t.data,this.$buefy.toast.open({message:this.$t("saved"),type:"is-success",duration:3e3})}catch(e){console.error("Save template error:",e),this.$buefy.toast.open({message:this.$t("Failed to save template")+": "+(e.message||"Unknown error"),type:"is-danger",duration:5e3})}},async saveNewTemplate(){try{const e=await this.$refs.emailEditor.exportHtml(),t=await this.$http.plain.post("/newsletter_templates",{design:e.design,htmlInline:e.html,name:this.template.name});return this.$buefy.toast.open({message:this.$t("saved"),type:"is-success",duration:3e3}),this.$router.push({name:"NewsletterBuilder",params:{item:t.data.id},query:{createEditTemplate:!0}})}catch(e){console.error("Save new template error:",e),this.$buefy.toast.open({message:this.$t("Failed to save template")+": "+(e.message||"Unknown error"),type:"is-danger",duration:5e3})}},sendPreviewEmail(){this.isLoadingPreview=!0,this.$refs.emailEditor.exportHtml().then(e=>{if(e&&e.html)return this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid,{design:e.design,htmlInline:e.html,htmlRaw:e.html,subject:this.itemNewsletter.subject}).then(t=>(this.itemNewsletter=t.data,this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid+"/send",{is_preview:!0,htmlInlinePreview:e.html}))).then(()=>{this.$buefy.toast.open({duration:5e3,message:this.$t("Newsletter sent! Please check your inbox"),type:"is-success"})});this.$buefy.toast.open({duration:5e3,message:this.$t("Failed to export newsletter content. Please try again."),type:"is-danger"})}).catch(e=>{console.log(e),this.$buefy.toast.open({duration:5e3,message:this.$t("Failed to send preview"),type:"is-danger"})}).finally(()=>{this.isLoadingPreview=!1})},sendPreviewEmailTemplate(){this.itemTemplate&&(this.isLoadingPreview=!0,this.$refs.emailEditor.exportHtml().then(e=>{if(e&&e.html)return this.$http.plain.patch("/newsletter_templates/"+this.itemTemplate.id,{design:e.design,htmlInline:e.html,name:this.template.name}).then(t=>(this.itemTemplate=t.data,this.$http.plain.patch("/newsletter_template/"+this.itemTemplate.id+"/send",{is_preview:!0,htmlInlinePreview:e.html}))).then(()=>{this.$buefy.toast.open({duration:5e3,message:this.$t("Newsletter sent! Please check your inbox"),type:"is-success"})});this.$buefy.toast.open({duration:5e3,message:this.$t("Failed to export newsletter content. Please try again."),type:"is-danger"})}).catch(e=>{console.log(e),this.$buefy.toast.open({duration:5e3,message:this.$t("Failed to send preview"),type:"is-danger"})}).finally(()=>{this.isLoadingPreview=!1}))},getNewsletter(){return this.itemNewsletter},setNewsletter(e){this.itemNewsletter=e},getLoadingState(){return"isLoadingSave"},confirmSchedule(e){const t=()=>this.$refs.emailEditor.exportHtml().then(e=>this.$http.plain.patch("/newsletters/"+this.itemNewsletter.uuid,{design:e.design,htmlInline:e.html,subject:this.itemNewsletter.subject})),s=e=>{this.$router.push({name:"NewsletterShow",params:{item:e.uuid}})};this.scheduleNewsletter(e,t,s)},cancelSchedule(){this.cancelNewsletterSchedule()}},computed:{...(0,y.L8)(["tenant","user","isGranted"])},components:{NewsletterBuilderProxy:f.A,NewsletterSubmenu:L.A,NewsletterScheduleModal:K}};const Z=(0,j.A)(Y,[["render",b],["__scopeId","data-v-0fb7afdd"]]);var ee=Z},21389:function(e,t){t.A={methods:{openScheduleModal(){this.showScheduleModal=!0},scheduleNewsletter(e,t=null,s=null){const i=this.getNewsletter(),a=this.getLoadingState();this[a]=!0;const l=()=>{const t="Scheduled"===i.status?"/newsletters/"+i.uuid+"/schedule":"/newsletters/"+i.uuid+"/send";return this.$http.plain.patch(t,{scheduledAt:e.scheduledAt,timezone:e.timezone})},n=t?t().then(l):l();n.then(e=>{this.setNewsletter(e.data),this.showScheduleModal=!1,this.$buefy.toast.o
1pen({duration:5e3,message:this.$t("Newsletter scheduled successfully"),type:"is-success"}),s&&s(e.data)}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to schedule newsletter")+": "+(e.response?.data?.detail||e.message||"Unknown error"),type:"is-danger",duration:5e3})}).finally(()=>{this[a]=!1})},cancelNewsletterSchedule(){const e=this.getNewsletter(),t=this.getLoadingState();this[t]=!0,this.$http.plain.patch("/newsletters/"+e.uuid+"/schedule",{scheduledAt:null}).then(e=>{this.setNewsletter(e.data),this.showScheduleModal=!1,this.$buefy.toast.open({duration:5e3,message:this.$t("Schedule cancelled"),type:"is-success"})}).catch(e=>{console.log(e),this.$buefy.toast.open({message:this.$t("Failed to cancel schedule"),type:"is-danger",duration:5e3})}).finally(()=>{this[t]=!1})}}}},34622:function(e,t,s){s.d(t,{A:function(){return m}});var i=s(20641),a=s(90033);const l=["src"];function n(e,t,s,n,o,r){const d=(0,i.g2)("b-loading");return(0,i.uX)(),(0,i.CE)("div",{class:"newsletter-builder-proxy",style:(0,a.Tr)({height:o.iframeHeight})},[(0,i.bF)(d,{modelValue:o.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>o.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,i.Lk)("iframe",{ref:"builderIframe",src:r.iframeSrc,style:{height:"100%",width:"100%",border:"none",display:"block"},allow:"clipboard-write",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox",onLoad:t[1]||(t[1]=(...e)=>r.onIframeLoad&&r.onIframeLoad(...e))},null,40,l)],4)}s(14603),s(47566),s(98721);var o={name:"NewsletterBuilderProxy",props:{mode:{type:String,required:!0,validator:e=>["newsletter","template"].includes(e)},itemId:{type:String,default:null},createEditTemplate:{type:Boolean,default:!1},height:{type:String,default:"1200px"}},data(){return{isLoading:!0,iframeHeight:this.height,messageId:0,embedToken:null,canonicalDomain:"localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname?window.location.origin:"https://app.orgo.space",editorReady:!1}},computed:{iframeSrc(){if(!this.embedToken)return"about:blank";if(!this.$store.state.tenant?.slug)return console.error("No tenant slug available"),"about:blank";const e=this.canonicalDomain,t=new URLSearchParams;return t.set("mode",this.mode),t.set("itemId",this.itemId||""),t.set("createEditTemplate",this.createEditTemplate.toString()),t.set("authToken",this.embedToken),t.set("tenantSlug",this.$store.state.tenant?.slug),t.set("appHost",this.$store.state.tenant?.appHost||"app.orgo.space"),t.set("locale",this.$i18n?.locale||"en"),t.set("workspace",this.$store.state.tenant.slug),t.set("iframe","true"),`${e}/newsletter-builder-embed?${t.toString()}`}},mounted(){this.setupMessageListener(),this.generateEmbedToken()},beforeUnmount(){window.removeEventListener("message",this.handleMessage)},methods:{generateEmbedToken(){this.$http.plain.get("/newsletter-builder/generate-embed-token").then(e=>{this.embedToken=e.data.token}).catch(e=>{console.error("Failed to generate embed token:",e),this.$emit("error",{message:"Failed to generate authentication token for newsletter builder"})})},getAuthToken(){return this.embedToken||""},setupMessageListener(){window.addEventListener("message",this.handleMessage)},handleMessage(e){const t=new URL(this.canonicalDomain).origin;if(e.origin!==t)return void console.warn("Message received from unexpected origin:",e.origin,"expected:",t);const{type:s,data:i}=e.data;switch(s){case"builder-loaded":this.isLoading=!1,this.editorReady=!0,this.$emit("editorLoaded");break;case"design-exported":this.$emit("designExported",i);break;case"save-requested":this.$emit("saveRequested",i);break;case"preview-requested":this.$emit("previewRequested",i);break;case"height-changed":this.iframeHeight=`${i.height}px`;break;case"error":console.error("Newsletter builder error:",i),this.$emit("error",i);break}},onIframeLoad(){this.sendMessage("configure",{tenantSlug:this.$store.state.tenant?.slug,locale:this.$i18n.locale})},sendMessage(e,t={}){const s={id:++this.messageId,type:e,data:t},i=new URL(this.canonicalDomain).origin;this.$refs.builderIframe?.contentWindow?.postMessage(s,i)},exportHtml(){return new Promise((e,t)=>
1{if(!this.$refs.builderIframe?.contentWindow)return console.error("Newsletter builder iframe not ready"),void t(new Error("Newsletter builder iframe not ready"));const s=(i=0)=>{const a=10,l=300;if(!this.editorReady&&i<a)return console.warn(`Editor not ready, waiting ${l}ms (attempt ${i+1}/${a})`),void setTimeout(()=>s(i+1),l);if(!this.editorReady)return console.error("Editor not ready after waiting"),void t(new Error("Editor not ready"));const n=++this.messageId;let o;const r=s=>{const i=new URL(this.canonicalDomain).origin;if(s.origin===i)if("design-exported"===s.data.type&&s.data.data?.id===n){window.removeEventListener("message",r),clearTimeout(o);const t=s.data.data.html||"",i=s.data.data.design||{};e({design:i,html:t})}else"error"===s.data.type&&s.data.data?.id===n&&(console.error("Export error received:",s.data.data.message),window.removeEventListener("message",r),clearTimeout(o),t(new Error(s.data.data.message||"Export failed")))};o=setTimeout(()=>{console.error("Export timeout - newsletter builder did not respond"),window.removeEventListener("message",r),t(new Error("Export timeout - newsletter builder did not respond"))},3e4),window.addEventListener("message",r),this.sendMessage("export-html",{messageId:n})};s()})},loadDesign(e){this.sendMessage("load-design",{design:e})}}},r=s(66262);const d=(0,r.A)(o,[["render",n],["__scopeId","data-v-526f2204"]]
1);var m=d},51726:function(e,t,s){s.d(t,{$:function(){return i}});const i=[{name:"First Name",value:"{firstName}",sample:"John"},{name:"Full Name",value:"{fullName}",sample:"John Doe"},{name:"User Phone Number",value:"{userPhoneNumber}",sample:"+40 712 345 678"},{name:"User Address",value:"{userAddress}",sample:"Strada Exemplu 1"},{name:"User Postal Code",value:"{userPostalCode}",sample:"012345"},{name:"User Town",value:"{userTown}",sample:"Bucharest"},{name:"User Country",value:"{userCountry}",sample:"Romania"},{name:"User Profile URL",value:"{userProfileURL}",sample:"https://app.orgo.space/user/123"},{name:"User Company Name",value:"{userCompanyName}",sample:"Acme Inc."},{name:"Company Name",value:"{companyName}",sample:"Acme Inc."},{name:"Contact Email",value:"{contactEmail}",sample:"[email protected]"},{name:"Membership Level Name",value:"{membershipLevelName}",sample:"Gold"},{name:"Membership Level Price",value:"{membershipLevelPrice}",sample:"100"},{name:"Current Period End",value:"{currentPeriodEnd}",sample:"2026-12-31 23:59"},{name:"Event Title",value:"{eventTitle}",sample:"Annual Conference 2026"},{name:"Event Description",value:"{eventDescription}",sample:"Join us for our annual conference..."},{name:"Event Start Date",value:"{eventDateBegin}",sample:"15 March 2026, 14:00"},{name:"Event End Date",value:"{eventDateEnd}",sample:"15 March 2026, 18:00"},{name:"Event Timezone",value:"{eventTimezone}",sample:"Europe/Bucharest"},{name:"Event Location",value:"{eventLocation}",sample:"Convention Center"},{name:"Event Register URL",value:"{eventRegisterUrl}",sample:"https://app.orgo.space/event/register"},{name:"Event Agenda URL",value:"{eventAgendaUrl}",sample:"https://app.orgo.space/public/event/abc"},{name:"Preferences URL",value:"{preferencesUrl}",sample:"https://app.orgo.space/preferences"},{name:"Unsubscribe URL",value:"{unsubscribeUrl}",sample:"https://app.orgo.space/unsubscribe"}]},82235:function(e,t,s){s.d(t,{A:function(){return X}});var i=s(20641),a=s(90033);const l={class:"column is-narrow"},n={key:0,class:"mb-3"},o={class:"icon-text"},r={class:"icon is-small ml-2"},d={key:1,class:"mb-3"},m={class:"icon-text"},u={class:"icon is-small ml-2"},c={key:2,class:"mb-5-half"},h={class:"icon-text"},p={class:"icon is-small ml-2"},g={key:3,class:"mb-3"},v=["disabled"],w={class:"icon-text"},b={class:"icon is-small ml-2"},f={key:4,class:"mb-3"},y=["disabled"],k={class:"icon-text"},L={class:"icon is-small ml-2"},$={key:5,class:"mb-3"},S=["disabled"],T={class:"icon-text"},E={class:"icon is-small ml-2"},N={key:6,class:"mb-3"},C=["disabled"],_={class:"icon-text"},P={class:"icon is-small ml-2"},D={key:7,class:"mb-3"},x=["disabled"],U={class:"icon-text"},F={class:"icon is-small ml-2"},I={key:8,class:"mt-6 p-4"},A={class:"is-size-7 mb-5 has-text-dark"};function z(e,t,s,z,M,V){const B=(0,i.g2)("font-awesome-icon"),W=(0,i.g2)("router-link");return(0,i.uX)(),(0,i.CE)("div",l,[s.item?((0,i.uX)(),(0,i.CE)("p",n,[(0,i.bF)(W,{to:{name:"NewsletterShow",params:{item:s.item.uuid},query:V.eventQuery},class:(0,a.C4)(["button is-small is-rounded is-light level is-fullwidth",{"is-primary":V.isActive("NewsletterShow")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",o,[(0,i.Lk)("span",r,[(0,i.bF)(B,{icon:"fa-light fa-info-circle"})]),(0,i.Lk)("span",null,(0,a.v_)(V.isEventMessage?e.$t("Message"):e.$t("Campaign")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),s.item&&"Draft"===s.item.status?((0,i.uX)(),(0,i.CE)("p",d,[(0,i.bF)(W,{to:{name:"NewsletterBuilder",params:{item:s.item.uuid},query:V.eventQuery},class:(0,a.C4)(["button is-rounded is-light is-small level is-fullwidth",{"is-primary":V.isActive("NewsletterBuilder")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",m,[(0,i.Lk)("span",u,["Draft"===s.item.status?((0,i.uX)(),(0,i.Wv)(B,{key:0,icon:"fa-light fa-pencil-alt"})):((0,i.uX)(),(0,i.Wv)(B,{key:1,icon:"fa-light fa-eye"}))]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Content")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),s.item&&"Draft"===s.item.status?((0,i.uX)(),(0,i.CE)("p",c,[(0,i.bF)(W,{to:{name:"NewsletterUpdate",params:{item:s.item.uuid},query:V.eventQuery},class:(0,a.C4)(["button is-rounded is-light is-small is-fullwidth level",{"is-primary":V.isActive("NewsletterUpdate")}])},{default:(0,i.k6)(()=>[(0,i.Lk)("span",h,[(0,i.Lk)("span",p,[(0,i.bF)(B,{icon:"fa-light fa-cog"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Settings")),1)])]),_:1},8,["to","class"])])):(0,i.Q3)("",!0),V.showSaveButton?((0,i.uX)(),(0,i.CE)("p",g,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-primary is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[0]||(t[0]=t=>e.$emit("save"))},[(0,i.Lk)("span",w,[(0,i.Lk)("span",b,[(0,i.bF)(B,{icon:"fa-light fa-save"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("save")),1)])],10,v)])):(0,i.Q3)("",!0),V.showSendButton?((0,i.uX)(),(0,i.CE)("p",f,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-light is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[1]||(t[1]=t=>e.$emit("save-send"))},[(0,i.Lk)("span",k,[(0,i.Lk)("span",L,[(0,i.bF)(B,{icon:"fa-light fa-paper-plane-top"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("send")),1)])],10,y)])):(0,i.Q3)("",!0),V.showScheduleButton?((0,i.uX)(),(0,i.CE)("p",$,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-light is-small is-rounded is-fullwidth level",{"is-loading":s.isLoadingSave}]),disabled:s.isLoadingSave,onClick:t[2]||(t[2]=t=>e.$emit("schedule"))},[(0,i.Lk)("span",T,[(0,i.Lk)("span",E,[(0,i.bF)(B,{icon:"fa-light fa-clock"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Schedule")),1)])],10,S)])):(0,i.Q3)("",!0),V.showPreviewButton?((0,i.uX)(),(0,i.CE)("p",N,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-light is-rounded is-small is-fullwidth level",{"is-loading":s.isLoadingPreview}]),disabled:s.isLoadingPreview,onClick:t[3]||(t[3]=t=>e.$emit("send-preview-email"))},[(0,i.Lk)("span",_,[(0,i.Lk)("span",P,[(0,i.bF)(B,{icon:"fa-light fa-envelope"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Preview on my email")),1)])],10,C)])):(0,i.Q3)("",!0),V.showPreviewTemplateButton?((0,i.uX)(),(0,i.CE)("p",D,[(0,i.Lk)("button",{class:(0,a.C4)(["button is-light is-rounded is-small is-fullwidth level",{"is-loading":s.isLoadingPreview}]),disabled:s.isLoadingPreview,onClick:t[4]||(t[4]=t=>e.$emit("send-preview-email-template"))},[(0,i.Lk)("span",U,[(0,i.Lk)("span",F,[(0,i.bF)(B,{icon:"fa-light fa-envelope"})]),(0,i.Lk)("span",null,(0,a.v_)(e.$t("Preview on my email")),1)])],10,x)])):(0,i.Q3)("",!0),"NewsletterBuilder"===e.$route.name?((0,i.uX)(),(0,i.CE)("div",I,[(0,i.Lk)("div",A,[(0,i.Lk)("b",null,(0,a.v_)(e.$t("Placeholders:")),1),t[22]||(t[22]=(0,i.Fv)('<hr class="mb-2 mt-2"> {firstName} <br> {fullName} <br> {preferencesUrl} <br> {unsubscribeUrl} <br> {membershipLevelName} <br> {membershipLevelPrice} <br> {userProfileURL} <br> {userPhoneNumber} <br> {userAddress} <br> {userPostalCode} <br> {userTown} <br> {userCountry} <br> {userCompanyName} <br> {companyName} <br> {contactEmail} <br> {currentPeriodEnd} ',32)),V.isEventMessage?((0,i.uX)(),(0,i.CE)(i.FK,{key:0},[t[5]||(t[5]=(0,i.Lk)("hr",{class:"mb-2 mt-2"},null,-1)),(0,i.Lk)("b",null,(0,a.v_)(e.$t("Event:")),1),t[6]||(t[6]=(0,i.Lk)("br",null,null,-1)),t[7]||
1(t[7]=(0,i.eW)(" {eventTitle} ",-1)),t[8]||(t[8]=(0,i.Lk)("br",null,null,-1)),t[9]||(t[9]=(0,i.eW)(" {eventDescription} ",-1)),t[10]||(t[10]=(0,i.Lk)("br",null,null,-1)),t[11]||(t[11]=(0,i.eW)(" {eventDateBegin} ",-1)),t[12]||(t[12]=(0,i.Lk)("br",null,null,-1)),t[13]||(t[13]=(0,i.eW)(" {eventDateEnd} ",-1)),t[14]||(t[14]=(0,i.Lk)("br",null,null,-1)),t[15]||(t[15]=(0,i.eW)(" {eventTimezone} ",-1)),t[16]||(t[16]=(0,i.Lk)("br",null,null,-1)),t[17]||(t[17]=(0,i.eW)(" {eventLocation} ",-1)),t[18]||(t[18]=(0,i.Lk)("br",null,null,-1)),t[19]||(t[19]=(0,i.eW)(" {eventRegisterUrl} ",-1)),t[20]||(t[20]=(0,i.Lk)("br",null,null,-1)),t[21]||(t[21]=(0,i.eW)(" {eventAgendaUrl} ",-1))],64)):(0,i.Q3)("",!0)])])):(0,i.Q3)("",!0)])}var M=s(61273),V={name:"NewsletterSubmenu",components:{FontAwesomeIcon:M.gc},props:{item:{type:Object,default:null},itemTemplate:{type:Object,default:null},createEditTemplate:{type:Boolean,default:!1},isLoadingSave:{type:Boolean,default:!1},isLoadingPreview:{type:Boolean,default:!1}},emits:["save","save-send","schedule","send-preview-email","send-preview-email-template"],computed:{isEventMessage(){return!!this.$route.query.eventUuid||!!this.item?.event},eventQuery(){return this.$route.query.eventUuid?{eventUuid:this.$route.query.eventUuid}:{}},showSaveButton(){return this.item&&"Draft"===this.item.status&&"NewsletterBuilder"===this.$route.name||this.createEditTemplate},showSendButton(){return this.item&&("Draft"===this.item.status||"Scheduled"===this.item.status)},showScheduleButton(){return this.item&&("Draft"===this.item.status||"Scheduled"===this.item.status)},showPreviewButton(){return!this.createEditTemplate&&this.item&&"Draft"===this.item.status&&("NewsletterBuilder"===this.$route.name||"NewsletterShow"===this.$route.name)},showPreviewTemplateButton(){return this.itemTemplate}},methods:{isActive(e){return this.$route.name===e}}},B=s(66262);const W=(0,B.A)(V,[["render",z]]);var X=W}}]);
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.