| @@ -1,2 +1,2 @@ | ||
| 1 | -import{s as Y,u as X,t as Z,E as R,a as x,d as M,G as q,g as z,v as $,h as j,x as G,F as J,H as K,O as ee,r as le,N as Q}from"./element-plus.js?ver=2.10.0";import"./dayjs.js?ver=2.10.0";import{B as oe}from"./BgImageUpload.js?ver=2.10.0";import{I as te,L as ne,M as se,b as ie}from"./app.js?ver=2.10.0";import{ae as g,D as a,E as p,I as s,S as o,F as _,R as L,ab as O,K as d,Q as m,O as w,a7 as H,P as W,L as ae,M as de,J as ce,U as re,B as _e,W as A}from"./vue.js?ver=2.10.0";import{_ as N}from"./emoji-picker.js?ver=2.10.0";import{F as ue}from"./FullEditorFrame.js?ver=2.10.0";import"./fcom-utils.js?ver=2.10.0";import"./vendor.js?ver=2.10.0";import"./vue-router.js?ver=2.10.0";import"./pinia.js?ver=2.10.0";import"./milkdown.js?ver=2.10.0";const me={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:te},props:{field:{type:Object,required:!0},space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,editTab:"paywall",availablePaywalls:[]}},methods:{initAddPaywall(){this.field.paywalls=this.field.paywalls||[],this.field.paywalls.push("")},removePaywall(e){const l=this.field.paywalls||[];l.splice(l.indexOf(e),1),this.field.paywalls=l},isPaywallAdded(e){var l;return(l=this.field.paywalls)==null?void 0:l.includes(e.toString())},getAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getAvailablePaywalls()}},pe={key:0,class:"fcom_paywalls"},ge={class:"fcom_paywall"},fe={class:"fcom_select_photo",style:{float:"left"}},be=["src"],ke={key:0,class:"fcom_description"},he={class:"fcom_paywall_actions"},ye={class:"fcom_color_input_wrap"},Ve={class:"fcom_color_input_wrap"},we={class:"fcom_color_input_wrap"},ve={class:"fcom_color_input_wrap"};function Fe(e,l,n,b,t,u){const k=g("image-placeholder"),S=Y,U=X,B=Z,T=g("Delete"),D=R,I=x,h=M,f=q,C=z,F=$,P=j,c=G,y=J,V=K;return a(),p(V,{modelValue:t.editTab,"onUpdate:modelValue":l[12]||(l[12]=r=>t.editTab=r)},{default:s(()=>[o(f,{label:e.$t("Paywalls"),name:"paywall"},{default:s(()=>[t.loading?(a(),p(h,{key:1,rows:2,animated:""})):(a(),_("div",pe,[(a(!0),_(L,null,O(n.field.paywalls,(r,i)=>(a(),_("div",ge,[o(B,{"fit-input-width":"",modelValue:n.field.paywalls[i],"onUpdate:modelValue":E=>n.field.paywalls[i]=E,placeholder:e.$t("Select Paywall")},{default:s(()=>[(a(!0),_(L,null,O(t.availablePaywalls,E=>(a(),p(U,{key:E.ID,label:E.post_title},{default:s(()=>[(a(!0),_(L,null,O(E.variants,v=>(a(),p(S,{key:v.id,value:v.id.toString(),label:v.variation_title,disabled:u.isPaywallAdded(v.id),class:"fcom_with_photo_option"},{default:s(()=>[d("span",fe,[v.photo?(a(),_("img",{key:0,src:v.photo},null,8,be)):(a(),p(k,{key:1})),d("span",null,m(v.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),o(D,{onClick:E=>u.removePaywall(r)},{default:s(()=>[o(T)]),_:1},8,["onClick"])]))),256)),!n.field.paywalls||Object.keys(n.field.paywalls).length<1?(a(),_("div",ke,[d("p",null,m(e.$t("Please add paywall pricing options")),1)])):w("",!0),d("div",he,[o(I,{style:{width:"100%"},class:"fcom_plain_button",onClick:u.initAddPaywall},{default:s(()=>[d("span",null,m("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),o(f,{label:e.$t("Content"),name:"content"},{default:s(()=>[o(c,{onSubmit:l[2]||(l[2]=H(r=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(F,{label:e.$t("Button Label")},{default:s(()=>[o(C,{modelValue:n.field.button_text,"onUpdate:modelValue":l[0]||(l[0]=r=>n.field.button_text=r),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(F,null,{default:s(()=>[o(P,{modelValue:n.field.show_description,"onUpdate:modelValue":l[1]||(l[1]=r=>n.field.show_description=r),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:s(()=>[W(m(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),o(f,{label:e.$t("Design"),name:"design"},{default:s(()=>[o(c,{onSubmit:l[11]||(l[11]=H(r=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(F,{label:e.$t("Background Color")},{default:s(()=>[d("div",ye,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.background_color,"onUpdate:modelValue":l[3]||(l[3]=r=>n.field.background_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.background_color,"onUpdate:modelValue":l[4]||(l[4]=r=>n.field.background_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Text Color")},{default:s(()=>[d("div",Ve,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.text_color,"onUpdate:modelValue":l[5]||(l[5]=r=>n.field.text_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.text_color,"onUpdate:modelValue":l[6]||(l[6]=r=>n.field.text_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Button Label")},{default:s(()=>[d("div",we,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.button_text_color,"onUpdate:modelValue":l[7]||(l[7]=r=>n.field.button_text_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.button_text_color,"onUpdate:modelValue":l[8]||(l[8]=r=>n.field.button_text_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Button Background")},{default:s(()=>[d("div",ve,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.button_color,"onUpdate:modelValue":l[9]||(l[9]=r=>n.field.button_color=r),"show-alpha":""},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.button_color,"onUpdate:modelValue":l[10]||(l[10]=r=>n.field.button_color=r)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const Ce=N(me,[["render",Fe]]),Ee={name:"LockscreenMeta",components:{BgImageUpload:oe,LockscreenPaywallMeta:Ce},props:["lockscreen","space_id"],emits:["editField","updatePaywalls"],data(){return{loading:!1,editing:!1,editTab:"content",editingField:null,availablePaywalls:[]}},computed:{lockscreenFields(){return this.lockscreen},getFieldIcon(){return e=>{const l={image:"Picture",block:"Tickets",lesson:"Memo",paywall:"Money",welcome_banner:"VideoPlay"};return e.name=="action"?"Iphone":l[e.type]}}},methods:{toggleHidden(e){e.hidden=!e.hidden,e.type=="paywall"&&!e.hidden&&this.updateField(e)},updateField(e){this.editing=!0,this.editingField=e;const l=e.type=="block"?e:null;this.$emit("editField",l)},backToFields(){this.editing=!1,this.editingField=null,this.$emit("editField",null)},moveUp(e){if(e==0)return;const l=this.lockscreen[e],n=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,l,n)},moveDown(e){if(e==this.lockscreen.length-1)return;const l=this.lockscreen[e],n=this.lockscreen[e+1];this.lockscreen.splice(e,2,n,l)}}},Se={key:0,class:"fcom_lockscreen_meta"},Ue={class:"fcom_meta_section lockscreen_meta"},Be={class:"fcom_description"},Pe={class:"fcom_meta_section lockscreen_meta"},Le={class:"fcom_meta_label"},Te={class:"fcom_meta_content"},De={class:"fcom_meta_block"},Ie={class:"fcom_block_label"},Oe={class:"fcom_meta_sorting"},Ne={class:"fcom_block_action"},Ae={key:1,class:"fcom_lockscreen_meta"},He={class:"fcom_edit_title"},Me={class:"fcom_edit_content"},Re={class:"fcom_color_input_wrap"},qe={class:"fcom_color_input_wrap"},ze={class:"fcom_color_input_wrap"},$e={class:"fcom_color_input_wrap"},je={class:"fcom_color_input_wrap"},Ge={key:1,class:"fcom_description"},Je={key:2,class:"fcom_description"},Ke={key:3,class:"fcom_description"};function Qe(e,l,n,b,t,u){const k=R,S=g("Top"),U=g("Bottom"),B=g("EditPen"),T=g("Hide"),D=g("View"),I=g("Back"),h=z,f=$,C=j,F=G,P=q,c=g("BgImageUpload"),y=J,V=K,r=g("lockscreen-paywall-meta");return t.editing?(a(),_("div",Ae,[d("div",He,[o(k,{onClick:u.backToFields},{default:s(()=>[o(I)]),_:1},8,["onClick"]),d("p",null,m(e.$labelize(t.editingField.label)),1)]),d("div",Me,[t.editingField.type=="image"?(a(),p(V,{key:0,modelValue:t.editTab,"onUpdate:modelValue":l[18]||(l[18]=i=>t.editTab=i)},{default:s(()=>[o(P,{label:e.$t("Content"),name:"content"},{default:s(()=>[o(F,{onSubmit:l[5]||(l[5]=H(i=>e.doNothing(),["prevent"])),model:t.editingField,"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(f,{label:e.$t("Heading")},{default:s(()=>[o(h,{modelValue:t.editingField.heading,"onUpdate:modelValue":l[0]||(l[0]=i=>t.editingField.heading=i),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Description")},{default:s(()=>[o(h,{modelValue:t.editingField.description,"onUpdate:modelValue":l[1]||(l[1]=i=>t.editingField.description=i),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Button Label")},{default:s(()=>[o(h,{modelValue:t.editingField.button_text,"onUpdate:modelValue":l[2]||(l[2]=i=>t.editingField.button_text=i),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Button Link")},{default:s(()=>[o(h,{modelValue:t.editingField.button_link,"onUpdate:modelValue":l[3]||(l[3]=i=>t.editingField.button_link=i)},null,8,["modelValue"])]),_:1},8,["label"]),t.editingField.type=="image"?(a(),p(f,{key:0},{default:s(()=>[o(C,{modelValue:t.editingField.new_tab,"onUpdate:modelValue":l[4]||(l[4]=i=>t.editingField.new_tab=i),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:s(()=>[W(m(e.$t("Open in New Tab")),1)]),_:1},8,["modelValue"])]),_:1})):w("",!0)]),_:1},8,["model"])]),_:1},8,["label"]),o(P,{label:e.$t("Design"),name:"design"},{default:s(()=>[o(F,{onSubmit:l[17]||(l[17]=H(i=>e.doNothing(),["prevent"])),model:t.editingField,"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(f,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:s(()=>[o(c,{modelValue:t.editingField.background_image,"onUpdate:modelValue":l[6]||(l[6]=i=>t.editingField.background_image=i),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),o(f,{label:e.$t("Overlay Color")},{default:s(()=>[d("div",Re,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.overlay_color,"onUpdate:modelValue":l[7]||(l[7]=i=>t.editingField.overlay_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.overlay_color,"onUpdate:modelValue":l[8]||(l[8]=i=>t.editingField.overlay_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Heading Color")},{default:s(()=>[d("div",qe,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.heading_color,"onUpdate:modelValue":l[9]||(l[9]=i=>t.editingField.heading_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.heading_color,"onUpdate:modelValue":l[10]||(l[10]=i=>t.editingField.heading_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Text Color")},{default:s(()=>[d("div",ze,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.text_color,"onUpdate:modelValue":l[11]||(l[11]=i=>t.editingField.text_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.text_color,"onUpdate:modelValue":l[12]||(l[12]=i=>t.editingField.text_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Button Label")},{default:s(()=>[d("div",$e,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.button_text_color,"onUpdate:modelValue":l[13]||(l[13]=i=>t.editingField.button_text_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.button_text_color,"onUpdate:modelValue":l[14]||(l[14]=i=>t.editingField.button_text_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Button Background")},{default:s(()=>[d("div",je,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.button_color,"onUpdate:modelValue":l[15]||(l[15]=i=>t.editingField.button_color=i),"show-alpha":""},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.button_color,"onUpdate:modelValue":l[16]||(l[16]=i=>t.editingField.button_color=i)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):t.editingField.type=="block"?(a(),_("div",Ge,m(e.$t("Edit the field from block editor ")),1)):t.editingField.type=="lesson"?(a(),_("div",Je,m(e.$t("Edit lessons from lesson editor ")),1)):t.editingField.type=="welcome_banner"?(a(),_("div",Ke,m(e.$t("__COURSE_BANNER_SOURCE_DESC")),1)):t.editingField.type=="paywall"?(a(),p(r,{key:4,field:t.editingField,space_id:n.space_id},null,8,["field","space_id"])):w("",!0)])])):(a(),_("div",Se,[d("div",Ue,[d("div",Be,[d("p",null,m(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),d("div",Pe,[d("div",Le,m(e.$t("Page Blocks")),1),d("div",Te,[d("ul",De,[(a(!0),_(L,null,O(u.lockscreenFields,(i,E)=>(a(),_("li",{class:ae(["fcom_block_list",{block_hidden:i.hidden}])},[d("div",Ie,[o(k,{class:"fcom_el_icon"},{default:s(()=>[(a(),p(de(u.getFieldIcon(i))))]),_:2},1024),d("p",null,m(e.$labelize(i.label)),1)]),d("div",Oe,[o(k,{onClick:v=>u.moveUp(E)},{default:s(()=>[o(S)]),_:1},8,["onClick"]),o(k,{onClick:v=>u.moveDown(E)},{default:s(()=>[o(U)]),_:1},8,["onClick"])]),d("div",Ne,[o(k,{onClick:v=>u.updateField(i)},{default:s(()=>[o(B)]),_:1},8,["onClick"]),i.hidden?(a(),p(k,{key:0,onClick:v=>u.toggleHidden(i)},{default:s(()=>[o(T)]),_:1},8,["onClick"])):(a(),p(k,{key:1,onClick:v=>u.toggleHidden(i)},{default:s(()=>[o(D)]),_:1},8,["onClick"]))])],2))),256))])])])]))}const We=N(Ee,[["render",Qe]]),Ye={name:"BlockEditor",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1}},data(){return{loading:!0,has_error:!1,all_loaded:!1,html:this.modelValue}},methods:{attach(){const e=this.$refs.block_editor;this.loading=!1,this.all_loaded=!0,window.wp.attachEditor(e,{iso:{toolbar:{undo:!0,navigation:!0,documentInspector:null},blocks:{allowBlocks:["core/button","core/buttons","core/code","core/column","core/columns","core/embed","core/group","core/heading","core/image","core/list","core/list-item","core/missing","core/paragraph","core/preformatted","core/pullquote","core/quote","core/separator","core/spacer","core/table","core/verse","core/html"]},__experimentalOnChange:function(l){console.log(l)},sidebar:{inserter:!1,inspector:!0}},editor:{__experimentalOnChange:function(l){console.log(l)},__experimentalOnInput(l){console.log(l)},__experimentalOnSelection(l){console.log(l)},onSaveContent:function(l){console.log(l)}}}),e.addEventListener("change",l=>{this.html=l.target.value,this.$emit("update:modelValue",l.target.value)})},loadScript(e){return new Promise((l,n)=>{const b=document.createElement("script");b.src=e,b.onload=l,b.onerror=n,document.head.append(b)})},async loadScripts(){const e=this.appVars.block_editor_assets.scripts;for(const l in e)try{await this.loadScript(e[l]),console.log(`${l} JS loaded`)}catch(n){this.has_error=!0,console.error(`Failed to load js ${l}:`,n)}this.attach()},loadCSSFile(e){return new Promise((l,n)=>{const b=document.createElement("link");b.rel="stylesheet",b.href=e,b.onload=l,b.onerror=n,document.head.append(b)})},async loadCSSFiles(){const l=this.appVars.block_editor_assets.styles.map(this.loadCSSFile);try{await Promise.all(l),console.log("All CSS files loaded")}catch(n){console.error("Failed to load some CSS files:",n)}}},mounted(){window.fl_block_editor_loaded?this.attach():(this.loadCSSFiles(),this.loadScripts(),window.fl_block_editor_loaded=!0)},beforeUnmount(){window.wp.detachEditor(this.$refs.block_editor)}},Xe={class:"fcom_block_editor"};function Ze(e,l,n,b,t,u){const k=M;return a(),_("div",Xe,[ce(d("div",null,[d("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"}," "+m(t.html)+` | |
| 1 | +import{s as Y,u as X,t as Z,E as R,a as x,d as M,G as q,g as z,v as $,h as j,x as G,F as J,H as K,O as ee,r as le,N as Q}from"./element-plus.js?ver=2.11.0";import"./dayjs.js?ver=2.11.0";import{B as oe}from"./BgImageUpload.js?ver=2.11.0";import{I as te,L as ne,M as se,b as ie}from"./app.js?ver=2.11.0";import{ae as g,D as a,E as p,I as s,S as o,F as _,R as L,ab as O,K as d,Q as m,O as w,a7 as H,P as W,L as ae,M as de,J as ce,U as re,B as _e,W as A}from"./vue.js?ver=2.11.0";import{_ as N}from"./emoji-picker.js?ver=2.11.0";import{F as ue}from"./FullEditorFrame.js?ver=2.11.0";import"./fcom-utils.js?ver=2.11.0";import"./vendor.js?ver=2.11.0";import"./vue-router.js?ver=2.11.0";import"./pinia.js?ver=2.11.0";import"./milkdown.js?ver=2.11.0";const me={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:te},props:{field:{type:Object,required:!0},space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,editTab:"paywall",availablePaywalls:[]}},methods:{initAddPaywall(){this.field.paywalls=this.field.paywalls||[],this.field.paywalls.push("")},removePaywall(e){const l=this.field.paywalls||[];l.splice(l.indexOf(e),1),this.field.paywalls=l},isPaywallAdded(e){var l;return(l=this.field.paywalls)==null?void 0:l.includes(e.toString())},getAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getAvailablePaywalls()}},pe={key:0,class:"fcom_paywalls"},ge={class:"fcom_paywall"},fe={class:"fcom_select_photo",style:{float:"left"}},be=["src"],ke={key:0,class:"fcom_description"},he={class:"fcom_paywall_actions"},ye={class:"fcom_color_input_wrap"},Ve={class:"fcom_color_input_wrap"},we={class:"fcom_color_input_wrap"},ve={class:"fcom_color_input_wrap"};function Fe(e,l,n,b,t,u){const k=g("image-placeholder"),S=Y,U=X,B=Z,T=g("Delete"),D=R,I=x,h=M,f=q,C=z,F=$,P=j,c=G,y=J,V=K;return a(),p(V,{modelValue:t.editTab,"onUpdate:modelValue":l[12]||(l[12]=r=>t.editTab=r)},{default:s(()=>[o(f,{label:e.$t("Paywalls"),name:"paywall"},{default:s(()=>[t.loading?(a(),p(h,{key:1,rows:2,animated:""})):(a(),_("div",pe,[(a(!0),_(L,null,O(n.field.paywalls,(r,i)=>(a(),_("div",ge,[o(B,{"fit-input-width":"",modelValue:n.field.paywalls[i],"onUpdate:modelValue":E=>n.field.paywalls[i]=E,placeholder:e.$t("Select Paywall")},{default:s(()=>[(a(!0),_(L,null,O(t.availablePaywalls,E=>(a(),p(U,{key:E.ID,label:E.post_title},{default:s(()=>[(a(!0),_(L,null,O(E.variants,v=>(a(),p(S,{key:v.id,value:v.id.toString(),label:v.variation_title,disabled:u.isPaywallAdded(v.id),class:"fcom_with_photo_option"},{default:s(()=>[d("span",fe,[v.photo?(a(),_("img",{key:0,src:v.photo},null,8,be)):(a(),p(k,{key:1})),d("span",null,m(v.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),o(D,{onClick:E=>u.removePaywall(r)},{default:s(()=>[o(T)]),_:1},8,["onClick"])]))),256)),!n.field.paywalls||Object.keys(n.field.paywalls).length<1?(a(),_("div",ke,[d("p",null,m(e.$t("Please add paywall pricing options")),1)])):w("",!0),d("div",he,[o(I,{style:{width:"100%"},class:"fcom_plain_button",onClick:u.initAddPaywall},{default:s(()=>[d("span",null,m("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),o(f,{label:e.$t("Content"),name:"content"},{default:s(()=>[o(c,{onSubmit:l[2]||(l[2]=H(r=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(F,{label:e.$t("Button Label")},{default:s(()=>[o(C,{modelValue:n.field.button_text,"onUpdate:modelValue":l[0]||(l[0]=r=>n.field.button_text=r),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(F,null,{default:s(()=>[o(P,{modelValue:n.field.show_description,"onUpdate:modelValue":l[1]||(l[1]=r=>n.field.show_description=r),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:s(()=>[W(m(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),o(f,{label:e.$t("Design"),name:"design"},{default:s(()=>[o(c,{onSubmit:l[11]||(l[11]=H(r=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(F,{label:e.$t("Background Color")},{default:s(()=>[d("div",ye,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.background_color,"onUpdate:modelValue":l[3]||(l[3]=r=>n.field.background_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.background_color,"onUpdate:modelValue":l[4]||(l[4]=r=>n.field.background_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Text Color")},{default:s(()=>[d("div",Ve,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.text_color,"onUpdate:modelValue":l[5]||(l[5]=r=>n.field.text_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.text_color,"onUpdate:modelValue":l[6]||(l[6]=r=>n.field.text_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Button Label")},{default:s(()=>[d("div",we,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.button_text_color,"onUpdate:modelValue":l[7]||(l[7]=r=>n.field.button_text_color=r)},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.button_text_color,"onUpdate:modelValue":l[8]||(l[8]=r=>n.field.button_text_color=r)},null,8,["modelValue"])])]),_:1},8,["label"]),o(F,{label:e.$t("Button Background")},{default:s(()=>[d("div",ve,[o(y,{predefine:e.appVars.suggestedColors,modelValue:n.field.button_color,"onUpdate:modelValue":l[9]||(l[9]=r=>n.field.button_color=r),"show-alpha":""},null,8,["predefine","modelValue"]),o(C,{modelValue:n.field.button_color,"onUpdate:modelValue":l[10]||(l[10]=r=>n.field.button_color=r)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const Ce=N(me,[["render",Fe]]),Ee={name:"LockscreenMeta",components:{BgImageUpload:oe,LockscreenPaywallMeta:Ce},props:["lockscreen","space_id"],emits:["editField","updatePaywalls"],data(){return{loading:!1,editing:!1,editTab:"content",editingField:null,availablePaywalls:[]}},computed:{lockscreenFields(){return this.lockscreen},getFieldIcon(){return e=>{const l={image:"Picture",block:"Tickets",lesson:"Memo",paywall:"Money",welcome_banner:"VideoPlay"};return e.name=="action"?"Iphone":l[e.type]}}},methods:{toggleHidden(e){e.hidden=!e.hidden,e.type=="paywall"&&!e.hidden&&this.updateField(e)},updateField(e){this.editing=!0,this.editingField=e;const l=e.type=="block"?e:null;this.$emit("editField",l)},backToFields(){this.editing=!1,this.editingField=null,this.$emit("editField",null)},moveUp(e){if(e==0)return;const l=this.lockscreen[e],n=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,l,n)},moveDown(e){if(e==this.lockscreen.length-1)return;const l=this.lockscreen[e],n=this.lockscreen[e+1];this.lockscreen.splice(e,2,n,l)}}},Se={key:0,class:"fcom_lockscreen_meta"},Ue={class:"fcom_meta_section lockscreen_meta"},Be={class:"fcom_description"},Pe={class:"fcom_meta_section lockscreen_meta"},Le={class:"fcom_meta_label"},Te={class:"fcom_meta_content"},De={class:"fcom_meta_block"},Ie={class:"fcom_block_label"},Oe={class:"fcom_meta_sorting"},Ne={class:"fcom_block_action"},Ae={key:1,class:"fcom_lockscreen_meta"},He={class:"fcom_edit_title"},Me={class:"fcom_edit_content"},Re={class:"fcom_color_input_wrap"},qe={class:"fcom_color_input_wrap"},ze={class:"fcom_color_input_wrap"},$e={class:"fcom_color_input_wrap"},je={class:"fcom_color_input_wrap"},Ge={key:1,class:"fcom_description"},Je={key:2,class:"fcom_description"},Ke={key:3,class:"fcom_description"};function Qe(e,l,n,b,t,u){const k=R,S=g("Top"),U=g("Bottom"),B=g("EditPen"),T=g("Hide"),D=g("View"),I=g("Back"),h=z,f=$,C=j,F=G,P=q,c=g("BgImageUpload"),y=J,V=K,r=g("lockscreen-paywall-meta");return t.editing?(a(),_("div",Ae,[d("div",He,[o(k,{onClick:u.backToFields},{default:s(()=>[o(I)]),_:1},8,["onClick"]),d("p",null,m(e.$labelize(t.editingField.label)),1)]),d("div",Me,[t.editingField.type=="image"?(a(),p(V,{key:0,modelValue:t.editTab,"onUpdate:modelValue":l[18]||(l[18]=i=>t.editTab=i)},{default:s(()=>[o(P,{label:e.$t("Content"),name:"content"},{default:s(()=>[o(F,{onSubmit:l[5]||(l[5]=H(i=>e.doNothing(),["prevent"])),model:t.editingField,"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(f,{label:e.$t("Heading")},{default:s(()=>[o(h,{modelValue:t.editingField.heading,"onUpdate:modelValue":l[0]||(l[0]=i=>t.editingField.heading=i),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Description")},{default:s(()=>[o(h,{modelValue:t.editingField.description,"onUpdate:modelValue":l[1]||(l[1]=i=>t.editingField.description=i),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Button Label")},{default:s(()=>[o(h,{modelValue:t.editingField.button_text,"onUpdate:modelValue":l[2]||(l[2]=i=>t.editingField.button_text=i),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(f,{label:e.$t("Button Link")},{default:s(()=>[o(h,{modelValue:t.editingField.button_link,"onUpdate:modelValue":l[3]||(l[3]=i=>t.editingField.button_link=i)},null,8,["modelValue"])]),_:1},8,["label"]),t.editingField.type=="image"?(a(),p(f,{key:0},{default:s(()=>[o(C,{modelValue:t.editingField.new_tab,"onUpdate:modelValue":l[4]||(l[4]=i=>t.editingField.new_tab=i),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:s(()=>[W(m(e.$t("Open in New Tab")),1)]),_:1},8,["modelValue"])]),_:1})):w("",!0)]),_:1},8,["model"])]),_:1},8,["label"]),o(P,{label:e.$t("Design"),name:"design"},{default:s(()=>[o(F,{onSubmit:l[17]||(l[17]=H(i=>e.doNothing(),["prevent"])),model:t.editingField,"label-position":"top",class:"fcom_form_container"},{default:s(()=>[o(f,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:s(()=>[o(c,{modelValue:t.editingField.background_image,"onUpdate:modelValue":l[6]||(l[6]=i=>t.editingField.background_image=i),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),o(f,{label:e.$t("Overlay Color")},{default:s(()=>[d("div",Re,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.overlay_color,"onUpdate:modelValue":l[7]||(l[7]=i=>t.editingField.overlay_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.overlay_color,"onUpdate:modelValue":l[8]||(l[8]=i=>t.editingField.overlay_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Heading Color")},{default:s(()=>[d("div",qe,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.heading_color,"onUpdate:modelValue":l[9]||(l[9]=i=>t.editingField.heading_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.heading_color,"onUpdate:modelValue":l[10]||(l[10]=i=>t.editingField.heading_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Text Color")},{default:s(()=>[d("div",ze,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.text_color,"onUpdate:modelValue":l[11]||(l[11]=i=>t.editingField.text_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.text_color,"onUpdate:modelValue":l[12]||(l[12]=i=>t.editingField.text_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Button Label")},{default:s(()=>[d("div",$e,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.button_text_color,"onUpdate:modelValue":l[13]||(l[13]=i=>t.editingField.button_text_color=i)},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.button_text_color,"onUpdate:modelValue":l[14]||(l[14]=i=>t.editingField.button_text_color=i)},null,8,["modelValue"])])]),_:1},8,["label"]),o(f,{label:e.$t("Button Background")},{default:s(()=>[d("div",je,[o(y,{predefine:e.appVars.suggestedColors,modelValue:t.editingField.button_color,"onUpdate:modelValue":l[15]||(l[15]=i=>t.editingField.button_color=i),"show-alpha":""},null,8,["predefine","modelValue"]),o(h,{modelValue:t.editingField.button_color,"onUpdate:modelValue":l[16]||(l[16]=i=>t.editingField.button_color=i)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):t.editingField.type=="block"?(a(),_("div",Ge,m(e.$t("Edit the field from block editor ")),1)):t.editingField.type=="lesson"?(a(),_("div",Je,m(e.$t("Edit lessons from lesson editor ")),1)):t.editingField.type=="welcome_banner"?(a(),_("div",Ke,m(e.$t("__COURSE_BANNER_SOURCE_DESC")),1)):t.editingField.type=="paywall"?(a(),p(r,{key:4,field:t.editingField,space_id:n.space_id},null,8,["field","space_id"])):w("",!0)])])):(a(),_("div",Se,[d("div",Ue,[d("div",Be,[d("p",null,m(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),d("div",Pe,[d("div",Le,m(e.$t("Page Blocks")),1),d("div",Te,[d("ul",De,[(a(!0),_(L,null,O(u.lockscreenFields,(i,E)=>(a(),_("li",{class:ae(["fcom_block_list",{block_hidden:i.hidden}])},[d("div",Ie,[o(k,{class:"fcom_el_icon"},{default:s(()=>[(a(),p(de(u.getFieldIcon(i))))]),_:2},1024),d("p",null,m(e.$labelize(i.label)),1)]),d("div",Oe,[o(k,{onClick:v=>u.moveUp(E)},{default:s(()=>[o(S)]),_:1},8,["onClick"]),o(k,{onClick:v=>u.moveDown(E)},{default:s(()=>[o(U)]),_:1},8,["onClick"])]),d("div",Ne,[o(k,{onClick:v=>u.updateField(i)},{default:s(()=>[o(B)]),_:1},8,["onClick"]),i.hidden?(a(),p(k,{key:0,onClick:v=>u.toggleHidden(i)},{default:s(()=>[o(T)]),_:1},8,["onClick"])):(a(),p(k,{key:1,onClick:v=>u.toggleHidden(i)},{default:s(()=>[o(D)]),_:1},8,["onClick"]))])],2))),256))])])])]))}const We=N(Ee,[["render",Qe]]),Ye={name:"BlockEditor",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1}},data(){return{loading:!0,has_error:!1,all_loaded:!1,html:this.modelValue}},methods:{attach(){const e=this.$refs.block_editor;this.loading=!1,this.all_loaded=!0,window.wp.attachEditor(e,{iso:{toolbar:{undo:!0,navigation:!0,documentInspector:null},blocks:{allowBlocks:["core/button","core/buttons","core/code","core/column","core/columns","core/embed","core/group","core/heading","core/image","core/list","core/list-item","core/missing","core/paragraph","core/preformatted","core/pullquote","core/quote","core/separator","core/spacer","core/table","core/verse","core/html"]},__experimentalOnChange:function(l){console.log(l)},sidebar:{inserter:!1,inspector:!0}},editor:{__experimentalOnChange:function(l){console.log(l)},__experimentalOnInput(l){console.log(l)},__experimentalOnSelection(l){console.log(l)},onSaveContent:function(l){console.log(l)}}}),e.addEventListener("change",l=>{this.html=l.target.value,this.$emit("update:modelValue",l.target.value)})},loadScript(e){return new Promise((l,n)=>{const b=document.createElement("script");b.src=e,b.onload=l,b.onerror=n,document.head.append(b)})},async loadScripts(){const e=this.appVars.block_editor_assets.scripts;for(const l in e)try{await this.loadScript(e[l]),console.log(`${l} JS loaded`)}catch(n){this.has_error=!0,console.error(`Failed to load js ${l}:`,n)}this.attach()},loadCSSFile(e){return new Promise((l,n)=>{const b=document.createElement("link");b.rel="stylesheet",b.href=e,b.onload=l,b.onerror=n,document.head.append(b)})},async loadCSSFiles(){const l=this.appVars.block_editor_assets.styles.map(this.loadCSSFile);try{await Promise.all(l),console.log("All CSS files loaded")}catch(n){console.error("Failed to load some CSS files:",n)}}},mounted(){window.fl_block_editor_loaded?this.attach():(this.loadCSSFiles(),this.loadScripts(),window.fl_block_editor_loaded=!0)},beforeUnmount(){window.wp.detachEditor(this.$refs.block_editor)}},Xe={class:"fcom_block_editor"};function Ze(e,l,n,b,t,u){const k=M;return a(),_("div",Xe,[ce(d("div",null,[d("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"}," "+m(t.html)+` | |
| 2 | 2 | `,513)],512),[[re,t.all_loaded]]),t.all_loaded?w("",!0):(a(),p(k,{key:0,class:"white_loaded",rows:7,animated:!0}))])}const xe=N(Ye,[["render",Ze]]),el={name:"LockScreenEditor",props:["title","lockscreen","sections","saving","loading","space_id","settings"],emits:["save","close"],components:{LockscreenLessonEditor:ne,MediaEmbeder:se,BlockEditor:xe,LockscreenMeta:We,LockscreenPaywallView:ie,FullEditorFrame:ue},data(){return{editingField:null,useClassic:!1}},computed:{lockscreenFields(){return this.lockscreen.filter(e=>!e.hidden)},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}},methods:{updateHeading(e,l){l.heading=e.target.innerText},updateDescription(e,l){l.description=e.target.innerText},updateButtonLabel(e,l){l.button_text=e.target.innerText},visibleBlock(e){this.editingField=e},updateEditField(e){this.editingField=e,(e==null?void 0:e.type)==="block"&&setTimeout(()=>{const l=document.getElementById("fcomBlockContent");l&&l.scrollIntoView({behavior:"smooth"})},300)},saveChanges(){this.editingField=null,this.$emit("save")},switchToClassic(){this.useClassic=!0}}},ll={class:"fcom_editor_topbar"},ol={class:"fcom_editor_content"},tl={class:"fcom_item"},nl={class:"fcom_content"},sl=["onBlur"],il=["onBlur"],al=["onBlur"],dl={key:1,class:"fcom_content_wrap"},cl={id:"fcomBlockContent"},rl={key:2,class:"fcom_content_wrap"},_l={key:1,class:"fcom_description"},ul={key:3,class:"fcom_content_wrap"},ml={key:4,class:"fcom_paywall_wrap"};function pl(e,l,n,b,t,u){const k=g("lockscreen-meta"),S=ee,U=g("Lock"),B=R,T=g("block-editor"),D=g("FullEditorFrame"),I=g("welcome-banner"),h=g("lockscreen-lesson-editor"),f=M,C=g("lockscreen-paywall-view"),F=le,P=Q;return a(),_(L,null,[o(S,{class:"fcom_full_editor_side lockscreen_editor",width:"250px"},{default:s(()=>[_e(e.$slots,"before_meta"),o(k,{lockscreen:n.lockscreen,space_id:n.space_id,onEditField:u.updateEditField},null,8,["lockscreen","space_id","onEditField"])]),_:3}),o(P,{class:"fcom_full_editor_main lockscreen_editor"},{default:s(()=>[o(F,null,{default:s(()=>[d("div",ll,[o(B,null,{default:s(()=>[o(U)]),_:1}),d("h3",null,m(n.title),1)]),d("div",ol,[(a(!0),_(L,null,O(u.lockscreenFields,c=>{var y;return a(),_("div",tl,[c.type=="image"?(a(),_("div",{key:0,class:"fcom_image_wrap",style:A(u.imageStyles(c))},[d("div",nl,[d("h2",{style:A(u.headingStyles(c)),contenteditable:"true",onBlur:V=>u.updateHeading(V,c)},m(c.heading),45,sl),c.description?(a(),_("p",{key:0,style:A(u.descriptionStyles(c)),contenteditable:"true",onBlur:V=>u.updateDescription(V,c)},m(c.description),45,il)):w("",!0),c.button_text?(a(),_("button",{key:1,class:"fcom_btn",style:A(u.buttonStyles(c)),contenteditable:"true",onBlur:V=>u.updateButtonLabel(V,c)},m(c.button_text),45,al)):w("",!0)])],4)):w("",!0),c.type=="block"?(a(),_("div",dl,[d("div",cl,[t.useClassic?(a(),p(T,{key:0,modelValue:c.content,"onUpdate:modelValue":V=>c.content=V},null,8,["modelValue","onUpdate:modelValue"])):(a(),p(D,{key:1,ref_for:!0,ref:"fullEditorFrame",onUseAlternateEditor:u.switchToClassic,editorParams:{context:"lockscreen",space_id:n.space_id},frameHeight:"calc(100vh - 160px)",documentTitle:"",modelValue:c.content,"onUpdate:modelValue":V=>c.content=V},null,8,["onUseAlternateEditor","editorParams","modelValue","onUpdate:modelValue"]))])])):w("",!0),c.type=="welcome_banner"?(a(),_("div",rl,[c.banner?(a(),p(I,{key:0,config:c.banner,"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config"])):(a(),_("div",_l,m(e.$t("__COURSE_BANNER_EMPTY_DESC")),1))])):w("",!0),c.type=="lesson"?(a(),_("div",ul,[n.loading?(a(),p(f,{key:1,rows:5,animated:!0})):(a(),p(h,{key:0,sections:n.sections,is_editor:!0,settings:n.settings},null,8,["sections","settings"]))])):w("",!0),c.type=="paywall"&&((y=c.paywalls)==null?void 0:y.length)>0?(a(),_("div",ml,[o(C,{space_id:n.space_id,field:c,editable:!0},null,8,["space_id","field"])])):w("",!0)])}),256))])]),_:1})]),_:1})],64)}const gl=N(el,[["render",pl]]),fl={name:"SpaceLockscreen",props:["spaceProfile","savingCount"],emits:["close"],components:{LockScreenEditor:gl},data(){return{saving:!1,loading:!1,lockscreen:null}},watch:{savingCount(){this.saveChanges()}},methods:{saveChanges(){this.lockscreen&&(this.saving=!0,this.$put("spaces/"+this.spaceProfile.slug+"/lockscreens",{lockscreen:this.lockscreen}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))},getLockscreen(){this.loading=!0,this.$get("spaces/"+this.spaceProfile.slug+"/lockscreens").then(e=>{this.lockscreen=e.lockscreen}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getLockscreen()}},bl={key:0,class:"fcom_lockscreen_meta"},kl={class:"fcom_description"},hl={class:"white_loaded"};function yl(e,l,n,b,t,u){const k=g("lock-screen-editor"),S=M,U=Q;return t.lockscreen?(a(),p(k,{key:0,title:n.spaceProfile.title,space_id:n.spaceProfile.id,settings:n.spaceProfile.settings,lockscreen:t.lockscreen,saving:t.saving,loading:t.loading,onSave:u.saveChanges,onClose:l[0]||(l[0]=B=>e.$emit("close"))},{before_meta:s(()=>[n.spaceProfile.settings.custom_lock_screen!="yes"?(a(),_("div",bl,[d("div",kl,[d("p",null,m(e.$t("__LOCK_SCRREN_DESC")),1)])])):w("",!0)]),_:1},8,["title","space_id","settings","lockscreen","saving","loading","onSave"])):t.loading?(a(),p(U,{key:1,class:"fcom_full_editor_main lockscreen_editor"},{default:s(()=>[d("div",hl,[o(S,{animated:!0,rows:10})])]),_:1})):w("",!0)}const Dl=N(fl,[["render",yl]]);export{Dl as default}; |