2 lines
49 KiB
JavaScript
2 lines
49 KiB
JavaScript
import{S as e,R as t,_ as s}from"../../../fc-bits.js?ver=3.1.8";import{$ as a,ae as l,an as i,aU as n,ax as o,aV as r,aW as c,E as d,k as _,e as u,aB as p,g as h,a6 as m,aj as g,aL as f,aK as b,ay as y,B as v,i as C,aG as w,az as k,aX as F,a4 as $,J as L,ac as V,a7 as S,u as T,c as A,L as P,D,j as x,h as q,aI as M,aQ as I,aP as B,aH as R}from"../../../vendor-element-plus.js?ver=3.1.8";import{aQ as j,W as H,Y as E,a5 as U,X as O,ab as Z,ax as z,Z as N,aa as W,J as K,az as Q,a0 as Y,a9 as G,a8 as J,a7 as X,a6 as ee,$ as te,_ as se,bU as ae,b2 as le,bS as ie,bV as ne,bT as oe,bW as re}from"../../../vendor.js?ver=3.1.8";import{P as ce}from"../../../ProBadge.js?ver=3.1.8";import{P as de}from"../../../PromoCard.js?ver=3.1.8";import{_ as _e,I as ue,a as pe,T as he}from"../../../fc-bits-ui.js?ver=3.1.8";import{C as me}from"../../../Confirm.js?ver=3.1.8";import{P as ge}from"../../../PaginationBar.js?ver=3.1.8";import{I as fe}from"../../../InlineDoc.js?ver=3.1.8";import{F as be}from"../../../Filterer.js?ver=3.1.8";import{a as ye}from"../../../data_config.js?ver=3.1.8";import{P as ve}from"../../../PageHeader.js?ver=3.1.8";import{F as Ce}from"../../../FloatingBulkActionShell.js?ver=3.1.8";import{B as we}from"../../../Badge.js?ver=3.1.8";const ke={key:0,class:"el-dialog__title"},Fe={key:1,class:"el-dialog__title"},$e={key:0,class:"fcrm_trigger_selection_wrapper"},Le={class:"fcrm_trigger_selection_inner"},Ve={class:"fcrm_trigger_selection_sidebar"},Se={class:"fc_trigger_icon"},Te=["innerHTML"],Ae={class:"fcrm_trigger_label"},Pe={key:0,class:"fcrm_trigger_selection_sidebar--footer"},De={class:"fcrm_trigger_selection_main"},xe={class:"fcrm_trigger_selection_internal_label_wrapper"},qe={class:"icon"},Me={class:"fcrm_trigger_selection_header"},Ie={class:"fcrm_trigger_selection_header_title"},Be={key:0,class:"fcrm_trigger_selection_list"},Re=["onClick"],je={class:"fcrm_trigger_selection_item_icon"},He=["innerHTML"],Ee={key:1},Ue={class:"fcrm_trigger_selection_item_content"},Oe={class:"fcrm_trigger_selection_item_title"},Ze={class:"fcrm_trigger_selection_item_description"},ze=["href"],Ne={key:1,class:"fcrm_trigger_prebuild_template_wrapper"},We={key:0,class:"fcrm_trigger_prebuild_template_list--section"},Ke={class:"fcrm_trigger_prebuild_template_list"},Qe={class:"fcrm_trigger_prebuild_template_item_icon"},Ye={class:"fcrm_trigger_prebuild_template_item_title"},Ge={class:"fcrm_trigger_prebuild_template_item_description"},Je={class:"fcrm_trigger_prebuild_template_item_overlay"},Xe={class:"icon"},et={class:"icon"},tt=["href"],st={key:1,class:"fcrm_promo_block"},at={key:0,class:"dialog-footer"};const lt=_e({name:"CreateFunnelModal",components:{Icons:ue,PromoCard:de,ProBadge:ce,Back:i,CirclePlus:l,Finished:a},props:["visible","triggers"],emits:["close"],data(){var e,t;return{saving:!1,funnel:{title:"",trigger_name:""},templates:[],templatesLoading:!1,showCreateNewAutomations:!0,dialogVisible:this.visible,selected_category:(null==(t=null==(e=window.fcAdmin)?void 0:e.addons)?void 0:t.fluentcampaign)?this.$t("CRM"):"__all__",allCategoryKey:"__all__",allowed_categories:[],searchTrigger:"",showProDialog:!1}},watch:{visible(e){this.dialogVisible=e},dialogVisible(){this.$emit("close")}},computed:{has_campaign_pro(){var e,t;return!!(null==(t=null==(e=window.fcAdmin)?void 0:e.addons)?void 0:t.fluentcampaign)},effectiveSelectedCategory(){return(this.searchTrigger||"").trim()?this.allCategoryKey:this.selected_category},funnel_categories(){const e=[];return this.each(this.triggers,t=>{-1===e.indexOf(t.category)&&e.push(t.category)}),e.sort()},funnelTriggers(){const e=(this.searchTrigger||"").trim().toLowerCase(),t=!!e,s=[this.$t("CRM")],a={};this.each(this.triggers,(l,i)=>{const n=this.effectiveSelectedCategory===this.allCategoryKey||l.category===this.effectiveSelectedCategory;if(t||n){if(e){const t=(l.description||"").replace(/<[^>]*>/g," ");if(!`${l.label||""} ${t} ${l.category||""} ${i||""}`.toLowerCase().includes(e))return}s.includes(l.category)||s.push(l.category),a[i]=l}});const l={};if(s.forEach(e=>{this.each(a,(t,s)=>{t.category===e&&(l[s]=t)})}),!this.has_campaign_pro){const e={},t={};return this.each(l,(s,a)=>{s.disabled?t[a]=s:e[a]=s}),{...e,...t}}return l}},methods:{funnelActiveHandle(e){this.funnel.trigger_name&&this.funnel.trigger_name==e?this.funnel.trigger_name="":this.funnel.trigger_name=e},saveFunnel(){this.saving=!0,this.$post("funnels",{funnel:this.funnel}).then(e=>{this.$notify.success(e.message),this.$router.push({name:"edit_funnel",params:{funnel_id:e.funnel.id},query:{is_new:"yes"}})}).catch(e=>{this.handleError(e)}).finally(()=>{this.saving=!1})},getCatIcon(e){e=e.replaceAll(" ","").toLowerCase();const t=this.appVars.funnel_cat_icons[e];return t?"string"==typeof t?t.startsWith("<")?t:'<i class="'+t+'"></i>':t.svg?t.svg:t.icon?'<i class="'+t.icon+'"></i>':"":""},getElIcon:e=>n[e]||a,createFromTemplate(e){this.checkImportable(e)&&this.$post("funnels/create-from-template",{template:e}).then(e=>{this.$notify.success(e.message),this.$router.push({name:"edit_funnel",params:{funnel_id:e.funnel.id},query:{is_template:"yes"}})}).catch(e=>{this.handleError(e)})},checkImportable(e){if(this.visibleProRibon(e))return this.$notify.error(this.$t("This template requires FluentCRM Pro version. Please upgrade to Pro.")),!1;if(e.dependencies&&e.dependencies.length>0){const t=e.dependencies.filter(e=>"fluentcrm_pro"!==e&&!this.allowed_categories.includes(e));if(t.length>0){const e=t.map(e=>this.getDependencyLabel(e));return this.$notify.error({title:this.$t("Missing Dependencies"),message:this.$t("This template requires the following dependencies to be activated: ")+e.join(", "),duration:6e3}),!1}}return!0},getTemplates(){this.templatesLoading=!0,this.$get("funnels/templates").then(e=>{this.templates=e.all,this.allowed_categories=e.cats}).catch(e=>{this.handleError(e)}).finally(()=>{this.templatesLoading=!1})},getTriggerIcon:e=>({woocommerce_order_status_completed:"fc-icon-woo_order_complete",woocommerce_order_status_processing:"fc-icon-woo_new_order",woocommerce_order_status_refunded:"fc-icon-woo_refund",woocommerce_order_status_changed:"fc-icon-woo",woocommerce_subscription_status_active:"fc-icon-woo_order_complete",woocommerce_subscription_renewal_payment_complete:"fc-icon-woo_order_complete",woocommerce_subscription_renewal_payment_failed:"fc-icon-woo_refund",wishlistmember_add_user_levels:"fc-icon-wishlist",tutor_after_enrolled:"fc-icon-tutor_lms_enrollment_course",tutor_course_complete_after:"fc-icon-tutor_lms_complete_course",tutor_lesson_completed_after:"fc-icon-tutor_lms_complete_course",rcp_membership_post_activate:"fc-icon-rcp_membership_level",rcp_transition_membership_status_expired:"fc-icon-rcp_membership_cancle",rcp_membership_post_cancel:"fc-icon-rcp_membership_cancle",pmpro_after_change_membership_level:"fc-icon-paid_membership_pro_user_level",pmpro_membership_post_membership_expiry:"fc-icon-membership_level_ex_pmp","mepr-account-is-active":"fc-icon-memberpress_membership","mepr-event-transaction-expired":"fc-icon-circle-close",llms_user_enrolled_in_course:"fc-icon-lifter_lms_course_enrollment",lifterlms_course_completed:"fc-icon-lifter_lms_complete_course",llms_user_added_to_membership_level:"fc-icon-lifter_lms_membership",lifterlms_lesson_completed:"fc-icon-lifter_lms_complete_lession-t2",learndash_update_course_access:"fc-icon-learndash_enroll_course",learndash_lesson_completed:"fc-icon-learndash_complete_lesson",learndash_topic_completed:"fc-icon-learndash_complete_topic",learndash_course_completed:"fc-icon-learndash_complete_course",ld_added_group_access:"fc-icon-learndash_course_group",simulated_learndash_update_course_removed:"fc-icon-learndash_enroll_course",fc_ab_cart_simulation_woo:"fc-icon-woo",fluentcrm_contact_birthday:"fc-icon-present",user_register:"fc-icon-wp_new_user_signup",fluentform_submission_inserted:"fc-icon-fluentforms",fluentcrm_contact_added_to_lists:"fc-icon-list_applied_2",edd_update_payment_status:"fc-icon-edd_new_order_success",edd_recurring_add_subscription_payment:"fc-icon-edd_new_order_success",edd_subscription_status_change:"fc-icon-circle-close",affwp_set_affiliate_status:"fc-icon-trigger",fluent_surecart_purchase_created_wrap:"fc-icon-shopping-cart-full",fluent_surecart_purchase_refund_wrap:"fc-icon-sold-out"}[e]||"fc-icon-trigger"),visibleProRibon(e){const t=window.fcAdmin.addons.fluentcampaign,s=e.dependencies&&e.dependencies.includes("fluentcrm_pro");return!t&&s},getDependencyLabel:e=>({fluentforms:"Fluent Forms",memberpress:"MemberPress","fluent-boards":"Fluent Boards","fluent-support":"Fluent Support","fluent-booking":"Fluent Booking",woocommerce:"WooCommerce",wcs:"WooCommerce Subscriptions",edd:"Easy Digital Downloads",lifterlms:"LifterLMS",tutor:"Tutor LMS",learndash:"LearnDash",surecart:"SureCart",woo_abandon_carts:"WooCommerce Abandoned Cart",fluentcrm_pro:"FluentCRM Pro"}[e]||e.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()))},mounted(){this.getTemplates()}},[["render",function(e,t,s,a,l,i){const n=j("Icons"),m=c,g=j("Finished"),f=d,b=r,y=_,v=u,C=j("ProBadge"),w=o,k=p,F=j("PromoCard"),$=h;return H(),E($,{modelValue:l.dialogVisible,"onUpdate:modelValue":t[8]||(t[8]=e=>l.dialogVisible=e),"close-on-click-modal":!1,"append-to-body":!0,"modal-class":"fcrm_trigger_modal_wrapper",width:"75%"},{header:U(()=>[l.showCreateNewAutomations?(H(),O("span",ke,W(e.$t("_Cr_Create_aAF")),1)):(H(),O("span",Fe,[N("span",{class:"icon cursor_pointer",onClick:t[0]||(t[0]=e=>l.showCreateNewAutomations=!0)},[Z(n,{"icon-name":"arrow-left"})]),G(" "+W(e.$t("Popular pre-built funnel templates")),1)]))]),footer:U(()=>{var a;return[l.showCreateNewAutomations&&l.funnel.trigger_name&&!(null==(a=s.triggers[l.funnel.trigger_name])?void 0:a.disabled)?(H(),O("span",at,[Z(y,{type:"primary",onClick:t[7]||(t[7]=e=>i.saveFunnel())},{default:U(()=>[G(W(e.$t("Continue")),1)],void 0,!0),_:1})])):J("",!0)]}),default:U(()=>[l.showCreateNewAutomations?(H(),O("div",$e,[Z(w,{onSubmit:z(i.saveFunnel,["prevent"]),data:l.funnel,"label-position":"top"},{default:U(()=>[N("div",Le,[N("div",Ve,[Z(b,{"background-color":"#f2f2f2","text-color":"#1e1f21","active-text-color":"#ffd04b",onSelect:t[1]||(t[1]=e=>{l.selected_category=e,l.funnel.trigger_name="",l.searchTrigger=""}),class:"fc_trigger_selectors","default-active":i.effectiveSelectedCategory},{default:U(()=>[Z(m,{index:l.allCategoryKey},{default:U(()=>[t[9]||(t[9]=N("span",{class:"fc_trigger_icon"},[N("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[N("path",{d:"M6.0625 2.875C6.48109 2.875 6.89558 2.95745 7.28231 3.11763C7.66903 3.27782 8.02042 3.51261 8.31641 3.8086C8.61239 4.10458 8.84718 4.45597 9.00737 4.8427C9.16755 5.22942 9.25 5.64391 9.25 6.0625V9.25H6.0625C5.21712 9.25 4.40637 8.91418 3.8086 8.3164C3.21083 7.71863 2.875 6.90788 2.875 6.0625C2.875 5.21712 3.21083 4.40637 3.8086 3.8086C4.40637 3.21082 5.21712 2.875 6.0625 2.875V2.875ZM7.75 7.75V6.0625C7.75 5.72874 7.65103 5.40248 7.46561 5.12498C7.28018 4.84747 7.01663 4.63118 6.70828 4.50345C6.39993 4.37573 6.06063 4.34231 5.73329 4.40742C5.40594 4.47254 5.10526 4.63326 4.86926 4.86926C4.63326 5.10526 4.47254 5.40594 4.40743 5.73328C4.34231 6.06063 4.37573 6.39993 4.50345 6.70828C4.63118 7.01663 4.84747 7.28018 5.12498 7.46561C5.40248 7.65103 5.72875 7.75 6.0625 7.75H7.75ZM6.0625 10.75H9.25V13.9375C9.25 14.5679 9.06306 15.1842 8.71281 15.7084C8.36256 16.2326 7.86474 16.6411 7.28231 16.8824C6.69987 17.1236 6.05897 17.1867 5.44065 17.0638C4.82234 16.9408 4.25438 16.6372 3.8086 16.1914C3.36282 15.7456 3.05924 15.1777 2.93625 14.5594C2.81326 13.941 2.87638 13.3001 3.11764 12.7177C3.35889 12.1353 3.76744 11.6374 4.29162 11.2872C4.8158 10.9369 5.43207 10.75 6.0625 10.75V10.75ZM6.0625 12.25C5.72875 12.25 5.40248 12.349 5.12498 12.5344C4.84747 12.7198 4.63118 12.9834 4.50345 13.2917C4.37573 13.6001 4.34231 13.9394 4.40743 14.2667C4.47254 14.5941 4.63326 14.8947 4.86926 15.1307C5.10526 15.3667 5.40594 15.5275 5.73329 15.5926C6.06063 15.6577 6.39993 15.6243 6.70828 15.4965C7.01663 15.3688 7.28018 15.1525 7.46561 14.875C7.65103 14.5975 7.75 14.2713 7.75 13.9375V12.25H6.0625ZM13.9375 2.875C14.7829 2.875 15.5936 3.21082 16.1914 3.8086C16.7892 4.40637 17.125 5.21712 17.125 6.0625C17.125 6.90788 16.7892 7.71863 16.1914 8.3164C15.5936 8.91418 14.7829 9.25 13.9375 9.25H10.75V6.0625C10.75 5.21712 11.0858 4.40637 11.6836 3.8086C12.2814 3.21082 13.0921 2.875 13.9375 2.875V2.875ZM13.9375 7.75C14.2713 7.75 14.5975 7.65103 14.875 7.46561C15.1525 7.28018 15.3688 7.01663 15.4965 6.70828C15.6243 6.39993 15.6577 6.06063 15.5926 5.73328C15.5275 5.40594 15.3667 5.10526 15.1307 4.86926C14.8947 4.63326 14.5941 4.47254 14.2667 4.40742C13.9394 4.34231 13.6001 4.37573 13.2917 4.50345C12.9834 4.63118 12.7198 4.84747 12.5344 5.12498C12.349 5.40248 12.25 5.72874 12.25 6.0625V7.75H13.9375ZM10.75 10.75H13.9375C14.5679 10.75 15.1842 10.9369 15.7084 11.2872C16.2326 11.6374 16.6411 12.1353 16.8824 12.7177C17.1236 13.3001 17.1867 13.941 17.0638 14.5594C16.9408 15.1777 16.6372 15.7456 16.1914 16.1914C15.7456 16.6372 15.1777 16.9408 14.5594 17.0638C13.941 17.1867 13.3001 17.1236 12.7177 16.8824C12.1353 16.6411 11.6374 16.2326 11.2872 15.7084C10.9369 15.1842 10.75 14.5679 10.75 13.9375V10.75ZM12.25 12.25V13.9375C12.25 14.2713 12.349 14.5975 12.5344 14.875C12.7198 15.1525 12.9834 15.3688 13.2917 15.4965C13.6001 15.6243 13.9394 15.6577 14.2667 15.5926C14.5941 15.5275 14.8947 15.3667 15.1307 15.1307C15.3667 14.8947 15.5275 14.5941 15.5926 14.2667C15.6577 13.9394 15.6243 13.6001 15.4965 13.2917C15.3688 12.9834 15.1525 12.7198 14.875 12.5344C14.5975 12.349 14.2713 12.25 13.9375 12.25H12.25Z",fill:"currentColor"})])],-1)),N("span",null,W(e.$t("All")),1)],void 0,!0),_:1},8,["index"]),(H(!0),O(K,null,Q(i.funnel_categories,e=>(H(),E(m,{key:e,index:e},{default:U(()=>[N("span",Se,[i.getCatIcon(e)?(H(),O("span",{key:0,innerHTML:i.getCatIcon(e)},null,8,Te)):(H(),E(f,{key:1},{default:U(()=>[Z(g)],void 0,!0),_:1}))]),N("span",Ae,W(e),1)],void 0,!0),_:2},1032,["index"]))),128))],void 0,!0),_:1},8,["default-active"]),l.showCreateNewAutomations?(H(),O("div",Pe,[Z(y,{class:Y(["pre-built-triggers-btn",{cursor_pointer:l.showCreateNewAutomations}]),onClick:t[2]||(t[2]=e=>l.showCreateNewAutomations=!1)},{default:U(()=>[G(W(e.$t("Pre-built Templates")),1)],void 0,!0),_:1},8,["class"])])):J("",!0)]),N("div",De,[N("div",xe,[Z(v,{placeholder:e.$t("Search Triggers e.g: List Applied"),modelValue:l.searchTrigger,"onUpdate:modelValue":t[3]||(t[3]=e=>l.searchTrigger=e)},{prefix:U(()=>[N("span",qe,[Z(n,{"icon-name":"search"})])]),_:1},8,["placeholder","modelValue"])]),N("div",Me,[N("h2",Ie,W(e.$t("Select the trigger for this automation")),1)]),l.selected_category?(H(),O("div",Be,[(H(!0),O(K,null,Q(i.funnelTriggers,(t,s)=>(H(),O("div",{class:Y(["fcrm_trigger_selection_item",{fc_trigger_selected:l.funnel.trigger_name==s,fcrm_trigger_selection_item_pro:t.disabled}]),key:s,onClick:e=>i.funnelActiveHandle(s)},[t.disabled?(H(),E(C,{key:0,text:t.ribbon},null,8,["text"])):t.ribbon?(H(),E(C,{key:1,text:t.ribbon,hideIcon:!0},null,8,["text"])):J("",!0),N("div",je,[t.svg?(H(),O("span",{key:0,class:"icon",innerHTML:t.svg},null,8,He)):t["element-icon"]?(H(),O("span",Ee,[Z(f,null,{default:U(()=>[(H(),E(X(i.getElIcon(t["element-icon"]))))],void 0,!0),_:2},1024)])):(H(),O("i",{key:2,class:Y(t.icon?t.icon:"fc-icon-trigger")},null,2))]),N("div",Ue,[N("h3",Oe,W(t.label),1),N("p",Ze,W(t.description),1)]),t.disabled?(H(),O("a",{key:2,href:e.appVars.crm_pro_url,target:"_blank",class:"fcrm_trigger_selection__pro el-button el-button--primary el-button--small"},W(e.$t("Upgrade To Pro")),9,ze)):J("",!0)],10,Re))),128))])):J("",!0)])])],void 0,!0),_:1},8,["onSubmit","data"])])):(H(),O("div",Ne,[l.selected_category?(H(),O("div",We,[N("div",Ke,[l.templatesLoading?(H(),O(K,{key:0},Q(6,e=>N("div",{key:e,class:"fcrm_trigger_prebuild_template_item"},[Z(k,{animated:"",rows:2})])),64)):(H(!0),O(K,{key:1},Q(l.templates,(s,a)=>{var o;return H(),O("div",{class:Y(["fcrm_trigger_prebuild_template_item",{fcrm_trigger_prebuild_template_item_pro:i.visibleProRibon(s)}]),key:a},[N("div",Qe,[N("i",{class:Y(i.getTriggerIcon(null==(o=null==s?void 0:s.funnel_data)?void 0:o.trigger_name))},null,2)]),N("div",Ye,W(s.title),1),N("div",Ge,W(s.short_description),1),N("div",Je,[i.visibleProRibon(s)?(H(),E(y,{key:1,size:"small",onClick:t[4]||(t[4]=e=>l.showProDialog=!0)},{default:U(()=>[N("span",et,[Z(n,{"icon-name":"import"})]),G(" "+W(e.$t("Import")),1)],void 0,!0),_:1})):(H(),E(y,{key:0,class:"import-btn",size:"small",onClick:e=>i.createFromTemplate(s)},{default:U(()=>[N("span",Xe,[Z(n,{"icon-name":"import"})]),G(" "+W(e.$t("Import")),1)],void 0,!0),_:1},8,["onClick"])),N("a",{class:"el-button preview-btn",href:s.link,target:"_blank",rel:"noopener noreferrer"},[N("span",null,[t[10]||(t[10]=N("span",{class:"icon"},[N("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[N("path",{d:"M9.99999 3.25C14.044 3.25 17.4085 6.16 18.1142 10C17.4092 13.84 14.044 16.75 9.99999 16.75C5.95599 16.75 2.59149 13.84 1.88574 10C2.59074 6.16 5.95599 3.25 9.99999 3.25ZM9.99999 15.25C11.5296 15.2497 13.0138 14.7301 14.2096 13.7764C15.4055 12.8226 16.2422 11.4912 16.5827 10C16.2409 8.50998 15.4037 7.18 14.208 6.22752C13.0122 5.27504 11.5287 4.7564 9.99999 4.7564C8.47126 4.7564 6.98776 5.27504 5.79202 6.22752C4.59629 7.18 3.75907 8.50998 3.41724 10C3.75781 11.4912 4.5945 12.8226 5.79035 13.7764C6.9862 14.7301 8.47039 15.2497 9.99999 15.25V15.25ZM9.99999 13.375C9.10489 13.375 8.24644 13.0194 7.61351 12.3865C6.98057 11.7536 6.62499 10.8951 6.62499 10C6.62499 9.10489 6.98057 8.24645 7.61351 7.61352C8.24644 6.98058 9.10489 6.625 9.99999 6.625C10.8951 6.625 11.7535 6.98058 12.3865 7.61352C13.0194 8.24645 13.375 9.10489 13.375 10C13.375 10.8951 13.0194 11.7536 12.3865 12.3865C11.7535 13.0194 10.8951 13.375 9.99999 13.375ZM9.99999 11.875C10.4973 11.875 10.9742 11.6775 11.3258 11.3258C11.6774 10.9742 11.875 10.4973 11.875 10C11.875 9.50272 11.6774 9.02581 11.3258 8.67418C10.9742 8.32254 10.4973 8.125 9.99999 8.125C9.50271 8.125 9.0258 8.32254 8.67417 8.67418C8.32254 9.02581 8.12499 9.50272 8.12499 10C8.12499 10.4973 8.32254 10.9742 8.67417 11.3258C9.0258 11.6775 9.50271 11.875 9.99999 11.875Z",fill:"var(--fc-secondary-text)"})])],-1)),G(" "+W(e.$t("Preview")),1)])],8,tt)]),i.visibleProRibon(s)?(H(),E(C,{key:0})):J("",!0)],2)}),128))])])):J("",!0),l.funnel.trigger_name&&s.triggers[l.funnel.trigger_name].disabled?(H(),O("div",st,[Z(F,{heading:e.$t("Upgrade to FluentCRM Pro"),description:e.$t("install_fluentcrm_pro")},null,8,["heading","description"])])):J("",!0)])),Z($,{modelValue:l.showProDialog,"onUpdate:modelValue":t[5]||(t[5]=e=>l.showProDialog=e),"append-to-body":!0,width:"400px","close-on-click-modal":!1,"show-close":!0,onClosed:t[6]||(t[6]=e=>l.showProDialog=!1),title:e.$t("Upgrade to FluentCRM Pro")},{default:U(()=>[Z(F,{heading:e.$t("Upgrade to FluentCRM Pro"),"show-header-upgrade-icon":!1},null,8,["heading"])],void 0,!0),_:1},8,["modelValue","title"])],void 0),_:1},8,["modelValue"])}]]),it={class:"fcrm_bulk_action_inline"},nt={class:"fcrm_bulk_wrap"},ot={class:"fcrm_bulk_item"},rt={class:"icon"},ct={class:"icon"};const dt=_e({name:"BulkFunnelActions",props:["selectedFunnels","options","theme_mode"],emits:["refetch"],components:{Confirm:me,Check:g,Delete:m},data(){return{delete_confirm_message:"<b>"+this.$t("Are you sure to delete?")+"</b><br />"+this.$t("delete_all_funnels_notice"),actions:{},select_job:{action_name:"",selected_options:[]},doing_action:!1,select_status:"",selectedLabels:[]}},watch:{"select_job.action_name":{handler(){this.select_job.selected_options=[],this.select_status="",this.selectedLabels=[]},deep:!0}},computed:{bulkSelectPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"},bulkSelectWordbreakPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"}},methods:{doBulkAction(){const e=[];this.each(this.selectedFunnels,t=>{e.push(t.id)}),this.doing_action=!0,this.$post("funnels/do-bulk-action",{action_name:this.select_job.action_name,status:this.select_status,labels:this.selectedLabels,funnel_ids:e}).then(e=>{this.$notify.success(e.message),this.$emit("refetch"),this.selectedLabels=[]}).catch(e=>{this.handleError(e)}).finally(()=>{this.doing_action=!1})}},mounted(){this.actions={change_funnel_status:{label:this.$t("Change Funnel Status"),options:this.options.statuses},apply_labels:{label:this.$t("Apply Labels"),options:this.options.labels},delete_funnels:{label:this.$t("Delete Funnels")}}}},[["render",function(e,t,s,a,l,i){const n=f,o=b,r=j("Check"),c=d,u=_,p=j("Delete"),h=j("confirm"),m=y;return H(),O("div",it,[N("div",nt,[N("div",ot,[N("label",null,W(e.$t("Select Action")),1),Z(o,{clearable:"",filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:e.$t("Select Action"),"popper-class":i.bulkSelectPopperClass,effect:"dark",modelValue:l.select_job.action_name,"onUpdate:modelValue":t[0]||(t[0]=e=>l.select_job.action_name=e)},{default:U(()=>[(H(!0),O(K,null,Q(l.actions,(e,t)=>(H(),E(n,{key:t,value:t,label:e.label},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"])]),"change_funnel_status"==l.select_job.action_name?(H(),O(K,{key:0},[Z(o,{filterable:"",clearable:"",size:"small",class:"fcrm_bulk_select",placeholder:e.$t("Select"),"popper-class":i.bulkSelectPopperClass,effect:"dark",modelValue:l.select_status,"onUpdate:modelValue":t[1]||(t[1]=e=>l.select_status=e)},{default:U(()=>[(H(!0),O(K,null,Q(s.options.statuses,e=>(H(),E(n,{key:e.id,value:e.id,label:e.title},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"]),ee((H(),E(u,{disabled:l.doing_action||!l.select_status,onClick:t[2]||(t[2]=e=>i.doBulkAction()),type:"primary",size:"small"},{default:U(()=>[N("span",rt,[Z(c,null,{default:U(()=>[Z(r)],void 0,!0),_:1})]),G(" "+W(e.$t("Change Status")),1)],void 0),_:1},8,["disabled"])),[[m,l.doing_action]])],64)):J("",!0),"apply_labels"===l.select_job.action_name?(H(),O(K,{key:1},[Z(o,{filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:e.$t("Select Labels"),modelValue:l.selectedLabels,"onUpdate:modelValue":t[3]||(t[3]=e=>l.selectedLabels=e),multiple:"","collapse-tags":"","max-collapse-tags":2,"popper-class":i.bulkSelectWordbreakPopperClass,effect:"dark"},{default:U(()=>[(H(!0),O(K,null,Q(s.options.labels,e=>(H(),E(n,{key:e.id,value:e.id},{default:U(()=>[N("span",{style:te("background:"+(e.settings&&e.settings.color?e.settings.color:e.color||"#e5e7eb")+";padding: 2px 5px 4px 5px;border-radius: 4px;color: #0E121B;")},W(e.title),5)],void 0,!0),_:2},1032,["value"]))),128))],void 0),_:1},8,["placeholder","modelValue","popper-class"]),ee((H(),E(u,{disabled:l.doing_action||!l.selectedLabels.length,onClick:t[4]||(t[4]=e=>i.doBulkAction()),type:"primary",size:"small"},{default:U(()=>[N("span",ct,[Z(c,null,{default:U(()=>[Z(r)],void 0,!0),_:1})]),G(" "+W(e.$t("Apply Label")),1)],void 0),_:1},8,["disabled"])),[[m,l.doing_action]])],64)):"delete_funnels"==l.select_job.action_name?(H(),E(h,{key:2,placement:"top-start",message:l.delete_confirm_message,onYes:t[5]||(t[5]=e=>i.doBulkAction())},{reference:U(()=>[ee((H(),E(u,{disabled:l.doing_action,type:"danger",plain:"",size:"small"},{default:U(()=>[Z(c,null,{default:U(()=>[Z(p)],void 0,!0),_:1}),G(" "+W(e.$t("Delete Funnels")),1)],void 0,!0),_:1},8,["disabled"])),[[m,l.doing_action]])]),_:1},8,["message"])):J("",!0)])])}]]),_t={class:"fcrm_checkbox_group_label d-none"};const ut=_e({name:"ColumnToggler",components:{Filterer:be,Setting:v},emits:["input","update:modelValue","dataChanged"],data:()=>({selection:[],automationFunnelColumns:ye}),computed:{columnGroups(){return[{slug:"automation",label:this.$t("Primary Fields"),fields:ye}]}},methods:{init(){const e=this.storage.get("automationFunnelColumns");e?(this.selection=e,this.fire()):(this.selection=["trigger","action","stats","pause/run","labels"],this.save())},save(){var e;this.storage.set("automationFunnelColumns",this.selection),null==(e=this.$refs.filterer)||e.hide(),this.fire()},fire(){this.$emit("input",this.selection),this.$emit("update:modelValue",this.selection),setTimeout(()=>{this.$emit("dataChanged",this.selection)},400)}},mounted(){this.init()}},[["render",function(e,t,s,a,l,i){const n=_,o=k,r=w,c=C,d=j("filterer");return H(),E(d,{ref:"filterer",name:"column-toggler"},{header:U(()=>[Z(n,{class:"only-icon-btn small",size:"small"},{default:U(()=>[...t[1]||(t[1]=[N("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[N("path",{d:"M9.25 4.75H4.75V15.25H9.25V4.75ZM10.75 4.75V15.25H15.25V4.75H10.75ZM4 3.25H16C16.1989 3.25 16.3897 3.32902 16.5303 3.46967C16.671 3.61032 16.75 3.80109 16.75 4V16C16.75 16.1989 16.671 16.3897 16.5303 16.5303C16.3897 16.671 16.1989 16.75 16 16.75H4C3.80109 16.75 3.61032 16.671 3.46967 16.5303C3.32902 16.3897 3.25 16.1989 3.25 16V4C3.25 3.80109 3.32902 3.61032 3.46967 3.46967C3.61032 3.32902 3.80109 3.25 4 3.25Z",fill:"var(--fc-secondary-text)"})],-1)])],void 0,!0),_:1})]),items:U(()=>[Z(r,{modelValue:l.selection,"onUpdate:modelValue":t[0]||(t[0]=e=>l.selection=e),class:"fcrm_filter-options fcrm_checkbox_group fcrm_column_toggler_checks"},{default:U(()=>[(H(!0),O(K,null,Q(i.columnGroups,(e,t)=>(H(),O("div",{key:t},[N("div",_t,W(e.label),1),(H(!0),O(K,null,Q(e.fields,(e,s)=>(H(),O("div",{class:"el-dropdown-menu__item",key:t+"-"+e.value},[Z(o,{value:e.value,class:"fcrm_checkbox"},{default:U(()=>[G(W(e.label),1)],void 0,!0),_:2},1032,["value"])]))),128))]))),128))],void 0,!0),_:1},8,["modelValue"])]),footer:U(()=>[Z(c,{class:"no-hover"},{default:U(()=>[Z(n,{type:"primary",size:"small",style:{width:"100%","margin-top":"10px"},onClick:i.save},{default:U(()=>[se(e.$slots,"btn-label",{},()=>[G(W(e.$t("Save")),1)])],void 0,!0),_:3},8,["onClick"])],void 0,!0),_:3})]),_:3},512)}]]),pt="funnels_filters";function ht(e){var t,s,a,l,i,n,o,r,c;try{return JSON.stringify({search:(null==(t=e.query_data)?void 0:t.search)||"",labels:(null==(s=e.query_data)?void 0:s.labels)||[],tags:(null==(a=e.query_data)?void 0:a.tags)||[],lists:(null==(l=e.query_data)?void 0:l.lists)||[],statuses:(null==(i=e.query_data)?void 0:i.statuses)||[],sort_by:(null==(n=e.query_data)?void 0:n.sort_by)||"id",sort_type:(null==(o=e.query_data)?void 0:o.sort_type)||"DESC",page:(null==(r=e.pagination)?void 0:r.current_page)||1,per_page:(null==(c=e.pagination)?void 0:c.per_page)||10})}catch(d){return""}}const mt=ae("funnels",{state:()=>({funnels:[],triggers:{},pagination:{current_page:1,per_page:10,total:0},query_data:{search:"",labels:[],tags:[],lists:[],statuses:[],sort_by:"id",sort_type:"DESC"},loading:!1,first_loading:!0,cache_metadata:{last_fetch_time:null,cache_key_hash:null,is_stale:!1},options:{labels:[],tags:[],lists:[],statuses:[]}}),getters:{isCacheValid(e){if(!e.cache_metadata.last_fetch_time||e.cache_metadata.is_stale)return!1;return Date.now()-e.cache_metadata.last_fetch_time<3e5},filterHash:e=>ht({query_data:e.query_data,pagination:e.pagination}),hasCachedDataForCurrentFilters(e){if(!e.cache_metadata.cache_key_hash)return!1;const t=ht({query_data:e.query_data,pagination:e.pagination});return e.cache_metadata.cache_key_hash===t},shouldShowCache(){return this.isCacheValid&&this.hasCachedDataForCurrentFilters&&this.funnels.length>0}},actions:{async fetchFunnels(e=!1,s=!1){if(e||!this.shouldShowCache){s||(this.loading=!0);try{const e={per_page:this.pagination.per_page,page:this.pagination.current_page,labels:this.query_data.labels,tags:this.query_data.tags,lists:this.query_data.lists,statuses:this.query_data.statuses,with:["triggers"],search:this.query_data.search,sort_by:this.query_data.sort_by,sort_type:this.query_data.sort_type},s=await t.get("funnels",e);this.funnels=s.funnels.data,this.pagination.total=s.funnels.total,this.triggers=s.triggers,this.cache_metadata.last_fetch_time=Date.now(),this.cache_metadata.cache_key_hash=this.filterHash,this.cache_metadata.is_stale=!1,this.persistFilters()}catch(a){throw console.error("[FunnelsStore] Failed to fetch funnels",a),a}finally{s||(this.loading=!1),this.first_loading=!1}}},restoreFilters(){try{const t=e.get(pt,null);return!!t&&(this.query_data=t.query_data||this.query_data,t.pagination&&(this.pagination.current_page=t.pagination.current_page||1,this.pagination.per_page=t.pagination.per_page||10),!0)}catch(t){return console.error("[FunnelsStore] Failed to restore filters",t),!1}},persistFilters(){try{e.set(pt,{query_data:this.query_data,pagination:{current_page:this.pagination.current_page,per_page:this.pagination.per_page}})}catch(t){console.error("[FunnelsStore] Failed to persist filters",t)}},invalidateCache(){this.cache_metadata.is_stale=!0,this.cache_metadata.last_fetch_time=null,this.cache_metadata.cache_key_hash=null},updatePagination(e,t,s=!1){void 0!==e&&(this.pagination.current_page=e),void 0!==t&&(this.pagination.per_page=t),s||this.persistFilters()},updateQueryData(e){this.query_data={...this.query_data,...e},this.persistFilters()},setOptions(e){this.options={...this.options,...e}}}}),gt=re(()=>s(()=>import("../../../v3app/src/Modules/Labels/Labels.js?ver=3.1.8"),[],import.meta.url)),ft=re(()=>s(()=>import("../../../v3app/src/Modules/Contacts/Filter/FilterPopover.js?ver=3.1.8"),[],import.meta.url)),bt={name:"AutomationFunnels",components:{Badge:we,PageHeader:ve,ActiveFiltersBar:re(()=>s(()=>import("../../../v3app/src/Modules/Contacts/Filter/ActiveFiltersBar.js?ver=3.1.8"),[],import.meta.url)),FilterPopover:ft,FloatingBulkActionShell:Ce,Icons:ue,Labels:gt,CreateFunnelModal:lt,Confirm:me,PaginationBar:ge,BulkFunnelActions:dt,InlineDoc:fe,Toggler:ut,Search:D,Plus:P,Close:A,User:T,DataLine:S,Back:i,CopyDocument:V,PriceTag:L,Download:$,Delete:m,Timer:F},data:()=>({search:"",create_modal:!1,duplicating:!1,sortBy:"id",sortType:"DESC",selection:!1,selectedFunnels:[],working:!1,visibleLabelsForm:!1,selectedLabels:[],tagFilter:[],listFilter:[],labelFilter:[],statusFilter:[],showingLabelsConfig:!1,rowActionVisible:{},applyLabelDialogVisible:!1,funnelForLabels:null,applyLabelsLoading:!1,columns:[],initialFired:!1,inline_errors:null,current_mode:"system"===he.getCurrentTheme()?he.getSystemTheme():he.getCurrentTheme()}),computed:{...oe(mt,["funnels","triggers","pagination","loading","options","query_data"]),...ne(mt,["shouldShowCache"])},methods:{...ie(mt,["fetchFunnels","invalidateCache","restoreFilters","persistFilters","updatePagination","updateQueryData","setOptions"]),closeCreateModal(){if(this.create_modal=!1,this.$route.query.add){const e={...this.$route.query};delete e.add,this.$router.replace({path:this.$route.path,query:e})}},maybeReFetch(){this.initialFired&&this.getFunnels(!1,!0)},async getFunnels(e=!0,t=!1){this.updateQueryData({search:this.search,labels:this.labelFilter,tags:this.tagFilter,lists:this.listFilter,statuses:this.statusFilter,sort_by:this.sortBy,sort_type:this.sortType}),this.storage.set("funnel_per_page",this.pagination.per_page);try{await this.fetchFunnels(e,t),this.selection=!1}catch(s){this.storage.set("funnel_per_page",10),this.pagination.per_page=10,this.handleError(s)}finally{this.initialFired=!0}},onSelection(e){this.selection=!!e.length,this.selectedFunnels=e},clearFunnelSelection(){this.$refs.funnelTable&&this.$refs.funnelTable.clearSelection(),this.selection=!1,this.selectedFunnels=[]},handleSortable(e){"descending"===e.order?(this.sortBy=e.prop,this.sortType="DESC"):(this.sortBy=e.prop,this.sortType="ASC"),this.getFunnels()},stripHtml(e){if(!e||"string"!=typeof e)return e||"";return e.replace(/<[^>]*>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},getTriggerTitle(e){return this.triggers[e]?this.stripHtml(this.triggers[e].label):'<strong style="color: red;">'+this.stripHtml(e)+" ("+this.$t("INACTIVE")+")</strong>"},getTriggerSegmentType:e=>({fluentcrm_contact_added_to_tags:"tags",fluentcrm_contact_removed_from_tags:"tags",fluentcrm_contact_added_to_lists:"lists",fluentcrm_contact_removed_from_lists:"lists"}[e]||""),getTriggerSegmentNames(e){const t=this.getTriggerSegmentType(e.trigger_name);if(!t||!e.settings||!Array.isArray(e.settings[t]))return[];const s=e.settings[t].map(e=>e&&"object"==typeof e?e.id?e.id.toString():"":e?e.toString():"").filter(Boolean);return(this.options[t]||[]).filter(e=>-1!==s.indexOf(e.id.toString())).map(e=>e.title)},getTriggerIcon(e){return this.triggers[e.trigger_name]&&this.triggers[e.trigger_name].svg?'<span class="el-icon">'+this.triggers[e.trigger_name].svg+"</span>":""},edit(e){this.$router.push({name:"edit_funnel",params:{funnel_id:e.id}})},subscribers(e){this.$router.push(this.getReportsRoute(e))},getReportsRoute:e=>({name:"funnel_subscribers",params:{funnel_id:e.id}}),isActiveAutomation:e=>e&&"published"===e.status,getInProgressSubscribersCount:e=>parseInt((null==e?void 0:e.in_progress_subscribers_count)||0),remove(e){this.$del(`funnels/${e.id}`).then(e=>{this.$notify.success(e.message),this.invalidateCache(),this.getFunnels()}).catch(e=>{this.handleError(e)})},duplicate(e){this.duplicating=!0,this.$post(`funnels/${e.id}/clone`).then(e=>{this.$notify.success(e.message),this.invalidateCache(),this.$router.push({name:"edit_funnel",params:{funnel_id:e.funnel.id},query:{is_new:"yes"}})}).catch(e=>{this.handleError(e)}).finally(()=>{this.duplicating=!1})},exportFunnel(e){location.href=window.ajaxurl+"?"+jQuery.param({action:"fluentcrm_export_funnel",_nonce:window.fcAdmin.ajax_nonce,funnel_id:e.id})},updateStatus(e){this.working=!0;const t=e.status;this.$put("funnels/"+e.id,{status:t}).then(s=>{this.$notify.success(s.message),this.invalidateCache(),e.status=t}).catch(e=>{this.handleError(e)}).finally(()=>{this.working=!1})},showLabelDialog(){this.showingLabelsConfig=!0},fetchLabels(){this.$get("labels").then(e=>{this.options.labels=e.labels}).catch(e=>{this.handleError(e)}).finally(()=>{})},onRowActionShow(e){Object.keys(this.rowActionVisible).forEach(t=>{parseInt(t)!==e.id&&(this.rowActionVisible[t]=!1)}),this.selectedLabels=[]},openApplyLabelDialog(e){this.rowActionVisible[e.id]=!1,this.funnelForLabels=e,this.selectedLabels=(e.labels||[]).map(e=>e.id),this.applyLabelDialogVisible=!0},closeApplyLabelDialog(){this.applyLabelDialogVisible=!1,this.funnelForLabels=null,this.selectedLabels=[]},applyLabelsFromDialog(){this.funnelForLabels&&this.applyLabels(this.funnelForLabels,[],"sync")},applyLabels(e,t,s="attach"){const a=this.funnelForLabels&&this.funnelForLabels.id===e.id;a&&(this.applyLabelsLoading=!0),this.$put("funnels/"+e.id+"/update-labels",{action:s,label_ids:["attach","sync"].includes(s)?this.selectedLabels:t}).then(e=>{this.$notify.success(e.message),this.invalidateCache(),this.getFunnels()}).catch(e=>{this.handleError(e)}).finally(()=>{a&&(this.applyLabelsLoading=!1,this.closeApplyLabelDialog())})},closeDrawer(){this.showingLabelsConfig=!1},syncSegmentFilters(e){this.query_data.tags=e.tags||[],this.query_data.lists=e.lists||[],this.query_data.labels=e.labels||[],this.query_data.statuses=e.statuses||[],this.tagFilter=e.tags||[],this.listFilter=e.lists||[],this.labelFilter=e.labels||[],this.statusFilter=e.statuses||[]},handleFilterApply(e){this.syncSegmentFilters(e),this.pagination.current_page=1,this.getFunnels()},handleFilterBarChange(e){this.syncSegmentFilters(e),void 0!==e.search&&(this.query_data.search=e.search,this.search=e.search),this.pagination.current_page=1,this.getFunnels()},handleOpenFilter(e){this.$nextTick(()=>{this.$refs.filterPopoverRef&&this.$refs.filterPopoverRef.openFilterCategory&&this.$refs.filterPopoverRef.openFilterCategory(e)})}},mounted(){this.setOptions({tags:this.appVars.available_tags||[],lists:this.appVars.available_lists||[],statuses:[{id:"published",title:this.$t("Publish")},{id:"draft",title:this.$t("Draft")}]}),this.restoreFilters();const e=parseInt(this.storage.get("funnel_per_page",10));this.updatePagination(void 0,e,!0),this.search=this.query_data.search||"",this.tagFilter=this.query_data.tags||[],this.listFilter=this.query_data.lists||[],this.labelFilter=this.query_data.labels||[],this.statusFilter=this.query_data.statuses||[],this.sortBy=this.query_data.sort_by||"id",this.sortType=this.query_data.sort_type||"DESC",this.changeTitle(this.$t("Automation Funnels")),this.fetchLabels(),this.shouldShowCache?(this.loading=!1,setTimeout(()=>this.getFunnels(!0,!0),100)):this.getFunnels(),this.$route.query.add&&this.hasPermission("fcrm_write_funnels")&&(this.create_modal=!0),this.onThemeChanged=e=>{var t;this.current_mode=(null==(t=e.detail)?void 0:t.effective)||he.getCurrentTheme()},window.addEventListener(pe,this.onThemeChanged)},beforeUnmount(){this.onThemeChanged&&window.removeEventListener(pe,this.onThemeChanged)}},yt={class:"fcrm_funnels_page"},vt={class:"fcrm_page_header_top_nav_wrapper"},Ct={class:"fcrm_page_header_top_nav"},wt={class:"fcrm_page_header_top_nav_links"},kt={class:"fcrm-layout-width"},Ft={class:"icon"},$t={class:"el-popover__reference"},Lt={class:"icon"},Vt={class:"el-popover__reference"},St={class:"icon"},Tt={class:"icon"},At={class:"fcrm_table_wrapper"},Pt={class:"fcrm_table_header"},Dt={class:"fcrm_table_header_inner"},xt={class:"fcrm_table_header_inner_left"},qt={class:"icon"},Mt={class:"fcrm_table_header_inner_actions"},It={class:"fcrm_automation_table_header_bulk_actions"},Bt={class:"fcrm_table_body"},Rt={class:"fcrm_funnel_title_line"},jt=["title"],Ht={class:"funnel_title_text"},Et={key:0,class:"item_description funnel_description"},Ut={class:"fcrm_funnel_trigger_cell"},Ot=["innerHTML"],Zt={class:"fcrm_funnel_trigger_content"},zt=["innerHTML"],Nt={key:0,class:"fcrm_funnel_trigger_segments"},Wt=["title"],Kt={key:0,class:"fc_funnel_labels"},Qt=["title"],Yt={key:1,class:"stats_badge_inline"},Gt=["title"],Jt={class:"el-dropdown-link"},Xt={class:"el-popover__reference"},es={class:"icon"},ts={class:"el-popover__reference"},ss={class:"icon"},as={class:"el-popover__reference"},ls={class:"icon"},is={class:"el-popover__reference"},ns={class:"icon"},os={class:"el-popover__reference"},rs={class:"icon"},cs={class:"fcrm_empty_state"},ds={class:"fcrm_empty_state_text"},_s={key:0,class:"fcrm_apply_labels_body"},us={class:"dialog-footer"};const ps=_e(bt,[["render",function(e,t,s,a,l,i){const n=j("router-link"),o=j("Icons"),r=_,c=C,m=q,g=x,v=j("inline-doc"),w=j("page-header"),k=u,F=j("filter-popover"),$=j("toggler"),L=j("active-filters-bar"),V=p,S=M,T=j("Close"),A=d,P=j("Confirm"),D=I,z=j("Badge"),Y=j("User"),X=j("Timer"),se=B,ae=j("DataLine"),ie=j("confirm"),ne=R,oe=j("pagination-bar"),re=j("bulk-funnel-actions"),ce=j("floating-bulk-action-shell"),de=j("create-funnel-modal"),_e=f,ue=b,pe=h,he=j("labels"),me=y;return H(),O("div",yt,[N("div",vt,[N("div",Ct,[N("ul",wt,[N("li",null,[Z(n,{to:"/funnels",class:"fcrm_top_nav_link"},{default:U(()=>[G(W(e.$t("Automation Funnels")),1)],void 0),_:1})]),N("li",null,[Z(n,{to:"/funnels/funnel/all-activities",class:"fcrm_top_nav_link"},{default:U(()=>[G(W(e.$t("All Activities")),1)],void 0),_:1})])])]),t[9]||(t[9]=N("div",{class:"fcrm_page_header_top_actions"},null,-1))]),N("div",kt,[Z(w,null,{title:U(()=>[G(W(e.$t("Automation Funnels")),1)]),actions:U(()=>[Z(g,{trigger:"click"},{dropdown:U(()=>[Z(m,null,{default:U(()=>[e.hasPermission("fcrm_write_funnels")?(H(),E(c,{key:0,class:"fc_dropdown_action",onClick:t[0]||(t[0]=t=>e.$router.push({name:"import_funnel"}))},{default:U(()=>[N("span",$t,[N("span",Lt,[Z(o,{"icon-name":"import"})]),G(" "+W(e.$t("Import")),1)])],void 0,!0),_:1})):J("",!0),Z(c,{class:"fc_dropdown_action",onClick:i.showLabelDialog},{default:U(()=>[N("span",Vt,[N("span",St,[Z(o,{"icon-name":"manageLabels"})]),G(" "+W(e.$t("Manage Labels")),1)])],void 0,!0),_:1},8,["onClick"])],void 0,!0),_:1})]),default:U(()=>[Z(r,{class:"el-dropdown-link"},{default:U(()=>[G(W(e.$t("More Actions"))+" ",1),N("span",Ft,[Z(o,{"icon-name":"downIcon"})])],void 0,!0),_:1})],void 0,!0),_:1}),Z(v,{doc_id:2362}),e.hasPermission("fcrm_write_funnels")?(H(),E(r,{key:0,type:"primary",onClick:t[1]||(t[1]=e=>l.create_modal=!0)},{default:U(()=>[N("span",Tt,[Z(o,{"icon-name":"plus"})]),G(" "+W(e.$t("New Automation")),1)],void 0,!0),_:1})):J("",!0)]),_:1}),N("div",At,[N("div",Pt,[N("div",Dt,[N("div",xt,[Z(k,{onKeyup:le(i.getFunnels,["enter"]),size:"small",onClear:t[2]||(t[2]=e=>i.getFunnels()),clearable:"",placeholder:e.$t("Search by title or trigger key"),modelValue:l.search,"onUpdate:modelValue":t[3]||(t[3]=e=>l.search=e)},{prefix:U(()=>[N("span",qt,[Z(o,{"icon-name":"search"})])]),_:1},8,["onKeyup","placeholder","modelValue"])]),N("div",Mt,[Z(F,{ref:"filterPopoverRef",options:{lists:e.options.lists?e.options.lists:[],tags:e.options.tags?e.options.tags:[],labels:e.options.labels?e.options.labels:[],statuses:e.options.statuses?e.options.statuses:[]},"selected-filters":e.query_data,onApply:i.handleFilterApply},null,8,["options","selected-filters","onApply"]),Z($,{onDataChanged:t[4]||(t[4]=e=>i.maybeReFetch()),modelValue:l.columns,"onUpdate:modelValue":t[5]||(t[5]=e=>l.columns=e)},null,8,["modelValue"])])]),N("div",It,[Z(L,{"selected-filters":e.query_data,options:{lists:e.options.lists?e.options.lists:[],tags:e.options.tags?e.options.tags:[],labels:e.options.labels?e.options.labels:[],statuses:e.options.statuses?e.options.statuses:[]},onFilterChange:i.handleFilterBarChange,onOpenFilter:i.handleOpenFilter,plus_filter_icon:!0},null,8,["selected-filters","options","onFilterChange","onOpenFilter"])])]),N("div",Bt,[e.loading&&!e.funnels.length?(H(),E(V,{key:0,style:{padding:"20px"},rows:8})):J("",!0),e.funnels.length||!e.loading?ee((H(),E(ne,{key:1,ref:"funnelTable",border:"","default-sort":{prop:l.sortBy,order:"DESC"==l.sortType?"descending":"ascending"},onSortChange:i.handleSortable,onSelectionChange:i.onSelection,stripe:"",data:e.funnels,style:{width:"100%"}},{empty:U(()=>[N("div",cs,[Z(o,{"icon-name":"common-empty-state"}),N("div",ds,[N("span",null,W(e.$t("Create your first automation funnel to streamline your marketing workflows.")),1)])])]),default:U(()=>[Z(S,{type:"selection",width:"45",fixed:""}),Z(S,{sortable:"custom",prop:"id",width:"80",label:e.$t("ID")},{default:U(e=>[G(W(e.row.id),1)]),_:1},8,["label"]),Z(S,{"min-width":"250",sortable:"custom",prop:"title",label:e.$t("Title")},{default:U(t=>[N("div",Rt,[i.getInProgressSubscribersCount(t.row)?(H(),O("span",{key:0,title:e.$t("Contacts currently in this automation"),class:"fcrm_live_indicator"},null,8,jt)):J("",!0),Z(n,{to:{name:"edit_funnel",params:{funnel_id:t.row.id}}},{default:U(()=>[N("p",Ht,W(t.row.title),1)],void 0,!0),_:2},1032,["to"])]),t.row.description?(H(),O("span",Et,W(t.row.description),1)):J("",!0)]),_:1},8,["label"]),-1!=l.columns.indexOf("trigger")?(H(),E(S,{key:0,"min-width":"250",sortable:"custom",prop:"trigger_name",label:e.$t("Trigger")},{default:U(e=>[N("div",Ut,[N("span",{class:"fcrm_funnel_trigger_icon",innerHTML:i.getTriggerIcon(e.row)},null,8,Ot),N("div",Zt,[N("span",{innerHTML:i.getTriggerTitle(e.row.trigger_name)},null,8,zt),i.getTriggerSegmentNames(e.row).length?(H(),O("div",Nt,[(H(!0),O(K,null,Q(i.getTriggerSegmentNames(e.row),e=>(H(),O("span",{key:e,class:"fcrm_badge"},[N("span",{title:e},W(e),9,Wt)]))),128))])):J("",!0)])])]),_:1},8,["label"])):J("",!0),-1!=l.columns.indexOf("labels")?(H(),E(S,{key:1,width:"250",label:e.$t("Labels")},{default:U(t=>[t.row.labels?(H(),O("div",Kt,[(H(!0),O(K,null,Q(t.row.labels,(s,a)=>(H(),E(D,{key:a,size:"small",style:te("background:"+s.color)},{default:U(()=>[G(W(s.title)+" ",1),Z(P,{onYes:e=>i.applyLabels(t.row,s.id,"detach"),message:e.$t("Remove_Label_From_funnel_Message")},{reference:U(()=>[Z(A,{class:"el-tag__close"},{default:U(()=>[Z(T)],void 0,!0),_:1})]),_:1},8,["onYes","message"])],void 0,!0),_:2},1032,["style"]))),128))])):J("",!0)]),_:1},8,["label"])):J("",!0),Z(S,{sortable:"custom",prop:"status",width:"100",label:e.$t("Status")},{default:U(e=>[ee(Z(z,{type:e.row.status},null,8,["type"]),[[me,l.working]])]),_:1},8,["label"]),-1!=l.columns.indexOf("stats")?(H(),E(S,{key:2,width:"125",label:e.$t("Stats")},{default:U(t=>[i.isActiveAutomation(t.row)?(H(),E(n,{key:0,to:i.getReportsRoute(t.row),class:"stats_badge_inline fcrm_stats_badge_link",title:e.$t("Reports")},{default:U(()=>[Z(A,null,{default:U(()=>[Z(Y)],void 0,!0),_:1}),G(" "+W(t.row.subscribers_count)+" ",1),i.getInProgressSubscribersCount(t.row)?(H(),O("span",{key:0,title:e.$t("Contacts currently in this automation"),class:"fcrm_stats_badge_segment"},[Z(A,{class:"fcrm_stats_badge_segment_icon"},{default:U(()=>[Z(X)],void 0,!0),_:1}),G(" "+W(i.getInProgressSubscribersCount(t.row)),1)],8,Qt)):J("",!0)],void 0,!0),_:2},1032,["to","title"])):(H(),O("span",Yt,[Z(A,null,{default:U(()=>[Z(Y)],void 0,!0),_:1}),G(" "+W(t.row.subscribers_count)+" ",1),i.getInProgressSubscribersCount(t.row)?(H(),O("span",{key:0,title:e.$t("Contacts currently in this automation"),class:"fcrm_stats_badge_segment"},[Z(A,{class:"fcrm_stats_badge_segment_icon"},{default:U(()=>[Z(X)],void 0,!0),_:1}),G(" "+W(i.getInProgressSubscribersCount(t.row)),1)],8,Gt)):J("",!0)]))]),_:1},8,["label"])):J("",!0),-1!=l.columns.indexOf("pause/run")?(H(),E(S,{key:3,width:"100",label:e.$t("Pause/Run")},{default:U(e=>[Z(se,{modelValue:e.row.status,"onUpdate:modelValue":t=>e.row.status=t,"inactive-value":"draft","active-value":"published",onChange:t=>i.updateStatus(e.row)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1},8,["label"])):J("",!0),-1!=l.columns.indexOf("created_at")?(H(),E(S,{key:4,sortable:"custom",prop:"created_at",width:"160",label:e.$t("Created At")},{default:U(t=>[G(W(e.$nsHumanDiffTime(t.row.created_at)),1)]),_:1},8,["label"])):J("",!0),-1!=l.columns.indexOf("updated_at")?(H(),E(S,{key:5,sortable:"custom",prop:"updated_at",width:"160",label:e.$t("Updated At")},{default:U(t=>[G(W(e.$nsHumanDiffTime(t.row.updated_at)),1)]),_:1},8,["label"])):J("",!0),-1!=l.columns.indexOf("action")?(H(),E(S,{key:6,fixed:"right","min-width":"50",align:"center","class-name":"fcrm_table_actions_cell"},{default:U(t=>[Z(g,{trigger:"click",placement:"bottom-end","popper-class":"fc-funnel-actions-popover",onVisibleChange:e=>e&&i.onRowActionShow(t.row)},{dropdown:U(()=>[Z(m,{class:"fc_funnel_acton_field"},{default:U(()=>["published"===t.row.status?(H(),E(c,{key:0,onClick:e=>i.subscribers(t.row)},{default:U(()=>[N("span",Xt,[N("span",es,[Z(A,null,{default:U(()=>[Z(ae)],void 0,!0),_:1})]),G(" "+W(e.$t("Reports")),1)])],void 0,!0),_:1},8,["onClick"])):J("",!0),e.hasPermission("fcrm_write_funnels")?(H(),E(c,{key:1,onClick:e=>i.duplicate(t.row)},{default:U(()=>[N("span",ts,[N("span",ss,[Z(o,{"icon-name":"duplicate"})]),G(" "+W(e.$t("Duplicate")),1)])],void 0,!0),_:1},8,["onClick"])):J("",!0),e.hasPermission("fcrm_write_funnels")?(H(),E(c,{key:2,onClick:e=>i.openApplyLabelDialog(t.row)},{default:U(()=>[N("span",as,[N("span",ls,[Z(o,{"icon-name":"manageLabels"})]),G(" "+W(e.$t("Apply Labels")),1)])],void 0,!0),_:1},8,["onClick"])):J("",!0),e.hasPermission("fcrm_write_funnels")?(H(),E(c,{key:3,onClick:e=>i.exportFunnel(t.row)},{default:U(()=>[N("span",is,[N("span",ns,[Z(o,{"icon-name":"export"})]),G(" "+W(e.$t("Export")),1)])],void 0,!0),_:1},8,["onClick"])):J("",!0),e.hasPermission("fcrm_write_funnels")?(H(),E(c,{key:4,class:"fcrm_danger_action"},{default:U(()=>[Z(ie,{placement:"top-start",message:e.$t("Automation_Delete_Alert"),onYes:e=>i.remove(t.row)},{reference:U(()=>[N("span",os,[N("span",rs,[Z(o,{"icon-name":"delete"})]),G(" "+W(e.$t("Delete")),1)])]),_:1},8,["message","onYes"])],void 0,!0),_:2},1024)):J("",!0)],void 0,!0),_:2},1024)]),default:U(()=>[N("span",Jt,[Z(o,{"icon-name":"more_actions"})])],void 0,!0),_:2},1032,["onVisibleChange"])]),_:1})):J("",!0)],void 0),_:1},8,["default-sort","onSortChange","onSelectionChange","data"])),[[me,e.loading||l.duplicating]]):J("",!0),Z(oe,{pagination:e.pagination,onFetch:i.getFunnels},null,8,["pagination","onFetch"])])])]),Z(ce,{visible:l.selection,"theme-mode":l.current_mode,"selected-count":l.selectedFunnels.length,"selected-label":e.$t("selected"),"deselect-label":e.$t("Deselect"),onDeselect:i.clearFunnelSelection},{actions:U(()=>[Z(re,{onRefetch:t[6]||(t[6]=t=>{e.invalidateCache(),i.getFunnels()}),selectedFunnels:l.selectedFunnels,options:e.options,theme_mode:l.current_mode},null,8,["selectedFunnels","options","theme_mode"])]),_:1},8,["visible","theme-mode","selected-count","selected-label","deselect-label","onDeselect"]),l.create_modal?(H(),E(de,{key:0,triggers:e.triggers,onClose:i.closeCreateModal,visible:l.create_modal},null,8,["triggers","onClose","visible"])):J("",!0),Z(pe,{modelValue:l.applyLabelDialogVisible,"onUpdate:modelValue":t[8]||(t[8]=e=>l.applyLabelDialogVisible=e),title:e.$t("Apply Labels"),width:"400px",class:"fcrm_apply_labels_dialog","close-on-click-modal":!1,onClose:i.closeApplyLabelDialog},{footer:U(()=>[N("div",us,[Z(r,{onClick:i.closeApplyLabelDialog},{default:U(()=>[G(W(e.$t("Cancel")),1)],void 0,!0),_:1},8,["onClick"]),Z(r,{type:"primary",loading:l.applyLabelsLoading,onClick:i.applyLabelsFromDialog},{default:U(()=>[G(W(e.$t("Apply")),1)],void 0,!0),_:1},8,["loading","onClick"])])]),default:U(()=>[l.funnelForLabels?(H(),O("div",_s,[Z(ue,{modelValue:l.selectedLabels,"onUpdate:modelValue":t[7]||(t[7]=e=>l.selectedLabels=e),multiple:"",placeholder:e.$t("Select Labels"),"popper-class":"fcrm_apply_labels_select_popper"},{default:U(()=>[(H(!0),O(K,null,Q(e.options.labels,e=>(H(),E(_e,{key:e.id,label:e.title,value:e.id},null,8,["label","value"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"])])):J("",!0)],void 0),_:1},8,["modelValue","title","onClose"]),l.showingLabelsConfig?(H(),E(he,{key:1,open:l.showingLabelsConfig,onClose:i.closeDrawer,onCallFetchLabels:i.fetchLabels},null,8,["open","onClose","onCallFetchLabels"])):J("",!0)])}]]);export{ps as default};
|