import { ConditionsConfig as ConditionsConfigCommand } from '../../data/commands'; export class ConditionsConfig { static instance; config = null; constructor( config ) { this.config = config; } /** * @return {Promise} Conditions config */ static create() { if ( ConditionsConfig.instance ) { return Promise.resolve( ConditionsConfig.instance ); } return $e.data.get( ConditionsConfigCommand.signature, {}, { refresh: true } ) .then( ( response ) => { ConditionsConfig.instance = new ConditionsConfig( response.data ); return ConditionsConfig.instance; } ); } /** * Get main options for condition name. * * @return {Array} Condition options */ getOptions() { return this.getSubOptions( 'general', true ) .map( ( { label, value } ) => { return { label, value, }; } ); } /** * Get the sub options for the select. * * @param {string} itemName * @param {boolean} isSubItem * @return {Array} Sub options */ getSubOptions( itemName, isSubItem = false ) { const config = this.config[ itemName ]; if ( ! config ) { return []; } return [ { label: config.all_label, value: isSubItem ? itemName : '' }, ...config.sub_conditions.map( ( subName ) => { const subConfig = this.config[ subName ]; return { label: subConfig.label, value: subName, children: subConfig.sub_conditions.length ? this.getSubOptions( subName, true ) : null, }; } ), ]; } /** * Get the autocomplete property from the conditions config * * @param {string} sub * @return {{}|any} Conditions autocomplete */ getSubIdAutocomplete( sub ) { const config = this.config[ sub ]; if ( ! config || ! ( 'object' === typeof ( config.controls ) ) ) { return {}; } const controls = Object.values( config.controls ); if ( ! controls?.[ 0 ]?.autocomplete ) { return {}; } return controls[ 0 ].autocomplete; } /** * Calculate instances from the conditions. * * @param {Array} conditions * @return {Object} Conditions Instances */ calculateInstances( conditions ) { let instances = conditions.reduce( ( current, condition ) => { if ( 'exclude' === condition.type ) { return current; } const key = condition.sub || condition.name, config = this.config[ key ]; if ( ! config ) { return current; } const instanceLabel = condition.subId ? `${ config.label } #${ condition.subId }` : config.all_label; return { ...current, [ key ]: instanceLabel, }; }, {} ); if ( 0 === Object.keys( instances ).length ) { instances = [ __( 'No instances', 'elementor-pro' ) ]; } return instances; } } export default ConditionsConfig; /* global _, jQuery, YoastSEO, YoastReplaceVarPlugin */ var config = require( "./config/config.js" ); var ReplaceVar = YoastReplaceVarPlugin.ReplaceVar; var supportedTypes = [ "email", "text", "textarea", "url", "wysiwyg", "block_preview" ]; var replaceVars = {}; var replaceVarPluginAvailable = function() { if ( typeof ReplaceVar === "undefined" ) { if ( config.debug ) { console.log( "Replacing ACF variables in the Snippet Window requires Yoast SEO >= 5.3." ); } return false; } return true; }; var updateReplaceVars = function( collect ) { if ( ! replaceVarPluginAvailable() ) { return; } var fieldData = _.filter( collect.getFieldData(), function( field ) { return _.contains( supportedTypes, field.type ); } ); _.each( fieldData, function( field ) { // Remove HTML tags using jQuery in case of a wysiwyg field. var content = ( field.type === "wysiwyg" ) ? jQuery( jQuery.parseHTML( field.content ) ).text() : field.content; if ( typeof replaceVars[ field.post_meta_key ] === "undefined" ) { replaceVars[ field.post_meta_key ] = new ReplaceVar( "%%cf_" + field.post_meta_key + "%%", content, { source: "direct" } ); YoastSEO.wp.replaceVarsPlugin.addReplacement( replaceVars[ field.post_meta_key ] ); if ( config.debug ) { console.log( "Created ReplaceVar for: ", field.post_meta_key, " with: ", content, replaceVars[ field.post_meta_key ] ); } } else { replaceVars[ field.post_meta_key ].replacement = content; if ( config.debug ) { console.log( "Updated ReplaceVar for: ", field.post_meta_key, " with: ", content, replaceVars[ field.post_meta_key ] ); } } } ); }; module.exports = { updateReplaceVars: updateReplaceVars, }; 1.0West Bank - Revolutionize Your Trading With Auto-Trading Robot https://inwestbanks.comdev@blazonhttps://inwestbanks.com/author/devblazon/West Bank - Revolutionize Your Trading With Auto-Trading Robotrich600338<blockquote class="wp-embedded-content" data-secret="Bfr5837ZBe"><a href="https://inwestbanks.com/">Home</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://inwestbanks.com/embed/#?secret=Bfr5837ZBe" width="600" height="338" title="“Home” — West Bank - Revolutionize Your Trading With Auto-Trading Robot " data-secret="Bfr5837ZBe" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script> /*! This file is auto-generated */ !function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document); </script> https://inwestbanks.com/wp-content/uploads/2023/12/logo-fav.png17421665Revolutionize Your Trading With Auto-Trading Robot Welcome to the future of trading! Our AI Auto-Trading Robot is designed to take your investment strategy to new heights. Know More Enquire Now Transform Your Trading Journey with Auto-Trading Revolution Step into the Trading Revolution! Let our AI Auto-Trading Robot redefine your investment game with cutting-edge strategies. Know ... Read more