Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
!function(t){if(t&&t.blocks&&t.blockEditor&&t.components&&t.element&&t.i18n){var n,e=t.blocks.registerBlockType,i=t.blockEditor,o=t.components,l=t.element,s=t.i18n,r=i.InspectorControls,a=i.InnerBlocks,c=i.useBlockProps,u=o.PanelBody,_=o.SelectControl,f=o.FormTokenField,d=o.Notice,g=l.createElement,h=l.Fragment,m=l.useMemo,w=l.useEffect,p=s.__,x=window.fcrmConditionalContentConfig||{},v=!!x.hasPro,y=g("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},g("rect",{x:1,y:1,width:22,height:22,rx:5,fill:"#6E41E2"}),g("path",{d:"M6 9.8L18.4 6.4L17.6 9.3L7.8 12L6 9.8Z",fill:"#FFFFFF"}),g("path",{d:"M7.5 14.2L16.5 11.8L15.8 14.6L9.3 16.4L7.5 14.2Z",fill:"#FFFFFF"})),b=(n=x.tags||[],Array.isArray(n)?n.map(function(t){return{id:String(t.id||""),title:String(t.title||"").trim()}}).filter(function(t){return!!t.id&&!!t.title}):[]);e("fluent-crm/conditional-content",{apiVersion:3,title:p("Conditional Content","fluent-crm"),description:p("Show or hide content based on contact tags or visitor login state.","fluent-crm"),category:"widgets",icon:y,keywords:[p("conditional","fluent-crm"),p("visibility","fluent-crm"),p("fluentcrm","fluent-crm")],supports:{align:["wide","full"],anchor:!0,html:!1},attributes:{condition_type:{type:"string",default:"show_if_tag_exist"},tag_ids:{type:"array",default:[]}},edit:function(t){var n,e,i=t.attributes,o=t.setAttributes,l=(n=i.condition_type||"show_if_tag_exist",(e=String(n).trim())?{show_if_logged_in:"show_if_user_logged_in",show_if_public_users:"show_if_user_not_logged_in",show_if_tag_exists:"show_if_tag_exist",show_if_tag_not_exists:"show_if_tag_not_exist"}[e]||e:"show_if_tag_exist"),s=Array.isArray(i.tag_ids)?i.tag_ids.map(String):[],x="show_if_tag_exist"===l||"show_if_tag_not_exist"===l;w(function(){(i.condition_type||"")!==l&&o({condition_type:l})},[i.condition_type,l]);var y=m(function(){var t={};return b.forEach(function(n){t[n.id]=n.title}),t},[]),S=m(function(){var t={};return b.forEach(function(n){t[n.title]=n.id}),t},[]),F=m(function(){return s.map(function(t){return y[t]||t})},[s,y]),C=m(function(){return b.map(function(t){return t.title})},[]),k=c({className:"fc-cond-section",style:{backgroundColor:"#fff8d9",border:"1px solid #f1d676",borderRadius:"6px",padding:"12px"}});return g(h,null,g(r,null,g(u,{title:p("Conditional Settings","fluent-crm")},g(_,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:p("Condition Type","fluent-crm"),value:l,onChange:function(t){var n=t||"show_if_tag_exist";o({condition_type:n,tag_ids:"show_if_tag_exist"===n||"show_if_tag_not_exist"===n?s:[]})},options:[{value:"show_if_tag_exist",label:p("Show if in selected tags","fluent-crm")},{value:"show_if_tag_not_exist",label:p("Show if not in selected tags","fluent-crm")},{value:"show_if_user_logged_in",label:p("Show if user is logged in","fluent-crm")},{value:"show_if_user_not_logged_in",label:p("Show if user is not logged in","fluent-crm")}]}),v?x?g(f,{label:p("Tags","fluent-crm"),value:F,suggestions:C,onChange:function(t){if(v){var n=t.map(function(t){return S[t]}).filter(Boolean);o({tag_ids:n})}},__experimentalExpandOnFocus:!0,__experimentalAutoSelectFirstMatch:!0,__experimentalShowHowTo:!1,__next40pxDefaultSize:!0}):null:g(d,{status:"warning",isDismissible:!1},p("Conditional Content requires FluentCRM Pro.","fluent-crm")),g("div",{className:"components-base-control__help",style:{marginTop:"12px"}},g("strong",null,p("How conditions work","fluent-crm")),g("ul",{style:{margin:"8px 0 0 16px"}},g("li",null,p("Show if in selected tags: visible when contact has any selected tag.","fluent-crm")),g("li",null,p("Show if not in selected tags: hidden when contact has any selected tag.","fluent-crm")),g("li",null,p("Show if user is logged in: visible for logged-in visitors only.","fluent-crm")),g("li",null,p("Show if user is not logged in: visible for logged-out visitors only.","fluent-crm"))),g("p",{style:{margin:"8px 0 0"}},p("Yellow background is editor-only to identify conditional content.","fluent-crm"))))),g("div",k,g("div",{className:"fc-cond-blocks"},g(a,null))))},save:function(){var t=c.save({className:"fc-cond-section"});return g("div",t,g("div",{className:"fc-cond-blocks"},g(a.Content,null)))}})}}(window.wp);
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// Silence is golden.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(e){var r=e(".fluentcrm_public_pref_form");r.length&&(r.find("input[name=reason]").on("change",function(){"other"===r.find("input[name=reason]:checked").val()?r.find("#fluentcrm_other_reason_wrapper").show():r.find("#fluentcrm_other_reason_wrapper").hide()}),r.on("submit",function(r){r.preventDefault();var s=e(this).serialize();e(".fluentcrm_form_responses").html(""),e.post(window.fluentcrm_public_pref.ajaxurl,s).then(r=>{e(".fluentcrm_un_form_wrapper").html('<div class="fluentcrm_success">'+r.data.message+"</div>"),r.data.redirect_url&&(window.location.href=r.data.redirect_url)}).fail(r=>{let s="Sorry! Something is wrong. Please try again";r.responseJSON&&r.responseJSON.data&&r.responseJSON.data.message&&(s=r.responseJSON.data.message),e(".fluentcrm_form_responses").html('<div class="fluentcrm_error">'+s+"</div>")}).always(()=>{})}),"yes"==window.fluentcrm_public_pref.auto_unsubscribe&&setTimeout(function(){e("#fluentcrm_unsubscribe_submit").click()},500));var s=e("#pref_unsubscribe");if(s.length){var a=!1;s.on("click",function(r){if(r.preventDefault(),!a){a=!0,s.css("pointer-events","none").attr("aria-disabled","true");var n={action:"fluentcrm_unsubscribe_ajax",secure_hash:e("#fluentcrm_preferences_form").find('input[name="_secure_hash"]').val()};e(".fluentcrm_form_responses").html(""),e.post(window.fluentcrm_public_pref.ajaxurl,n).then(r=>{e(".fc_manage_sub_form").html('<div class="fluentcrm_success">'+r.data.message+"</div>"),r.data.redirect_url&&(window.location.href=r.data.redirect_url)}).fail(r=>{let s="Sorry! Something went wrong. Please try again";r.responseJSON&&r.responseJSON.data&&r.responseJSON.data.message&&(s=r.responseJSON.data.message),e(".fluentcrm_form_responses").html('<div class="fluentcrm_error">'+s+"</div>")}).always(()=>{a=!1,s.css("pointer-events","").removeAttr("aria-disabled")})}})}var n=e("#fc_pref_form");n.length&&n.on("submit",function(r){r.preventDefault();var s=e(this).serialize(),a=e("#fluentcrm_preferences_submit");e(".fluentcrm_form_responses").html(""),a.attr("disabled",!0).addClass("fc_btn_loading"),e.post(window.fluentcrm_sub_pref.ajaxurl,s).then(r=>{e(".fluentcrm_form_responses").html('<div class="fluentcrm_success">'+r.data.message+"</div>")}).fail(r=>{let s="Sorry! Something is wrong. Please try again";r.responseJSON&&r.responseJSON.data&&r.responseJSON.data.message&&(s=r.responseJSON.data.message),e(".fluentcrm_form_responses").html('<div class="fluentcrm_error">'+s+"</div>")}).always(()=>{a.attr("disabled",!1).removeClass("fc_btn_loading")})})});
|
||||
Reference in New Issue
Block a user