/* global ajaxurl */ /** * WPForms Challenge function. * * @since 1.5.0 * @since 1.6.2 Challenge v2. */ 'use strict'; var WPFormsChallenge = window.WPFormsChallenge || {}; WPFormsChallenge.embed = window.WPFormsChallenge.embed || ( function( document, window, $ ) { /** * Public functions and properties. * * @since 1.5.0 * * @type {object} */ var app = { /** * Start the engine. * * @since 1.5.0 */ init: function() { $( app.ready ); $( window ).on( 'load', function() { // in case of jQuery 3.+ we need to wait for an `ready` event first. if ( typeof $.ready.then === 'function' ) { $.ready.then( app.load ); } else { app.load(); } } ); }, /** * Document ready. * * @since 1.5.0 */ ready: function() { app.setup(); app.events(); app.observeFullscreenMode(); }, /** * Window load. * * @since 1.5.0 */ load: function() { // If the page is Add new page. if ( window.location.href.indexOf( 'post-new.php' ) > -1 ) { app.lastStep(); $( '.wpforms-challenge-dot-completed' ).hide(); return; } if ( WPFormsChallenge.core.isGutenberg() ) { WPFormsChallenge.core.initTooltips( 5, '.block-editor .edit-post-header', { side: 'bottom' } ); app.updateTooltipVisibility(); } else { WPFormsChallenge.core.initTooltips( 5, '.wpforms-insert-form-button', { side: 'right' } ); } WPFormsChallenge.core.updateTooltipUI(); }, /** * Initial setup. * * @since 1.5.0 */ setup: function() { if ( 5 === WPFormsChallenge.core.loadStep() ) { $( '.wpforms-challenge' ).addClass( 'wpforms-challenge-completed' ); app.showPopup(); } $( '.wpforms-challenge' ).show(); }, /** * Register JS events. * * @since 1.5.0 */ events: function() { $( '.wpforms-challenge-step5-done' ) .on( 'click', app.lastStep ); $( '.wpforms-challenge-popup-close, .wpforms-challenge-end' ) .on( 'click', app.completeChallenge ); $( '#wpforms-challenge-contact-form .wpforms-challenge-popup-contact-btn' ) .on( 'click', app.submitContactForm ); }, /** * Last step done routine. * * @since 1.6.2 */ lastStep: function() { WPFormsChallenge.core.timer.pause(); WPFormsChallenge.core.stepCompleted( 5 ); $( '.wpforms-challenge' ).addClass( 'wpforms-challenge-completed' ); app.showPopup(); }, /** * Show either 'Congratulations' or 'Contact Us' popup. * * @since 1.5.0 */ showPopup: function() { var secondsLeft = WPFormsChallenge.core.timer.getSecondsLeft(); $( '.wpforms-challenge-popup-container' ).show(); if ( 0 < secondsLeft ) { var secondsSpent = WPFormsChallenge.core.timer.getSecondsSpent( secondsLeft ); $( '#wpforms-challenge-congrats-minutes' ) .text( WPFormsChallenge.core.timer.getMinutesFormatted( secondsSpent ) ); $( '#wpforms-challenge-congrats-seconds' ) .text( WPFormsChallenge.core.timer.getSecondsFormatted( secondsSpent ) ); $( '#wpforms-challenge-congrats-popup' ).show(); } else { $( '#wpforms-challenge-contact-popup' ).show(); } }, /** * Hide the popup. * * @since 1.5.0 */ hidePopup: function() { $( '.wpforms-challenge-popup-container' ).hide(); $( '.wpforms-challenge-popup' ).hide(); }, /** * Complete Challenge. * * @since 1.5.0 */ completeChallenge: function() { var optionData = { status : 'completed', seconds_spent: WPFormsChallenge.core.timer.getSecondsSpent(), seconds_left : WPFormsChallenge.core.timer.getSecondsLeft(), }; app.hidePopup(); WPFormsChallenge.core.removeChallengeUI(); WPFormsChallenge.core.clearLocalStorage(); WPFormsChallenge.admin.saveChallengeOption( optionData ) .done( WPFormsChallenge.core.triggerPageSave ); // Save and reload the page to remove WPForms Challenge JS. }, /** * Submit contact form button click event handler. * * @since 1.5.0 * * @param {object} e Event object. */ submitContactForm: function( e ) { e.preventDefault(); var $btn = $( this ), $form = $btn.closest( '#wpforms-challenge-contact-form' ); /* eslint-disable camelcase */ var data = { action : 'wpforms_challenge_send_contact_form', _wpnonce : WPFormsChallenge.admin.l10n.nonce, contact_data: { message : $form.find( '.wpforms-challenge-contact-message' ).val(), contact_me: $form.find( '.wpforms-challenge-contact-permission' ).prop( 'checked' ), }, }; /* eslint-enable */ $btn.prop( 'disabled', true ); $.post( ajaxurl, data, function( response ) { if ( ! response.success ) { console.error( 'Error sending WPForms Challenge Contact Form.' ); } } ).done( app.completeChallenge ); }, /** * Observe Gutenberg's Fullscreen Mode state to adjust tooltip positioning. * * @since 1.6.2 */ observeFullscreenMode: function() { var $body = $( 'body' ), isFullScreenPrev = $body.hasClass( 'is-fullscreen-mode' ); // MutationObserver configuration and callback. var obs = { targetNode : $body[0], config : { attributes: true, }, }; obs.callback = function( mutationsList, observer ) { var mutation, isFullScreen, $step5 = $( '.wpforms-challenge-tooltip-step5' ), $step5Arrow = $step5.find( '.tooltipster-arrow' ); for ( var i in mutationsList ) { mutation = mutationsList[ i ]; if ( mutation.type !== 'attributes' || mutation.attributeName !== 'class' ) { continue; } isFullScreen = $body.hasClass( 'is-fullscreen-mode' ); if ( isFullScreen === isFullScreenPrev ) { continue; } isFullScreenPrev = isFullScreen; if ( isFullScreen ) { $step5.css( { 'top': '93px', 'left': '0', } ); $step5Arrow.css( 'left', '91px' ); } else { $step5.css( { 'top': '125px', 'left': '66px', } ); $step5Arrow.css( 'left', '130px' ); } } }; obs.observer = new MutationObserver( obs.callback ); obs.observer.observe( obs.targetNode, obs.config ); }, /** * Update tooltip z-index when Gutenberg sidebar is open. * * @since 1.7.4 * * @returns {Function} Default function. */ updateTooltipVisibility: function() { var targetNode = document.querySelector( '.interface-interface-skeleton__body' ); if ( targetNode === null ) { return app.updateTooltipVisibilityDefault(); } var observer = new MutationObserver( function( mutationsList ) { var $step5 = $( '.wpforms-challenge-tooltip-step5' ); for ( var mutation of mutationsList ) { if ( mutation.type === 'childList' ) { $step5.toggleClass( 'wpforms-challenge-tooltip-step5-hide' ); } } } ); observer.observe( targetNode, { attributes: true, childList: true } ); }, /** * Update tooltip visibility for WP 5.6 version. * * @since 1.7.4 */ updateTooltipVisibilityDefault: function() { $( '.editor-inserter__toggle' ).on( 'click', function() { $( '.wpforms-challenge-tooltip-step5' ).toggleClass( 'wpforms-challenge-tooltip-step5-hide' ); } ); }, }; // Provide access to public functions/properties. return app; }( document, window, jQuery ) ); // Initialize. WPFormsChallenge.embed.init(); (()=>{"use strict";const e=e=>{const t=(e?.jquery?e[0]:e).querySelector(".bdt-custom-gallery");if(!t)return;const n=JSON.parse(t.dataset.settings||"{}");if(!0===n.tiltShow){const e=document.querySelectorAll(n.id+" [data-tilt]");VanillaTilt.init(e)}};window.addEventListener("elementor/frontend/init",()=>{window.elementorFrontend?.hooks&&(elementorFrontend.hooks.addAction("frontend/element_ready/bdt-custom-gallery.default",e),elementorFrontend.hooks.addAction("frontend/element_ready/bdt-custom-gallery.bdt-abetis",e),elementorFrontend.hooks.addAction("frontend/element_ready/bdt-custom-gallery.bdt-fedara",e))})})();@use 'common'; @use 'import-export'; @use 'position-option'; @use 'location-option'; @use 'native-options'; @use 'display-conditions/main'; !function(){"use strict";var e=window.wp.element,l=window.wp.i18n,c=window.wp.blocks,t=window.wp.blockEditor,n=window.wp.components;var o=function({attributes:c,setAttributes:o,clientId:s,...a}){const i=!window.location.pathname.includes("widgets.php")&&!window.location.pathname.includes("customize.php"),r=wp.data.select("core/block-editor").getBlock(s),p="blocksy/woocommerce-filters"===c.block&&r.innerBlocks&&r.innerBlocks.length>1&&"core/heading"===r.innerBlocks[0].name,d=[["core/heading",{level:3,content:c.heading||"",fontSize:"medium",className:i?"":"widget-title"}]];let u=["core/heading"];r.innerBlocks.find(function({name:e}){return"core/heading"===e})&&(u=[]),c.hasDescription&&(c.description&&d.push(["core/paragraph",{content:c.description,placeholder:"Description"}]),u.push("core/paragraph")),d.push([c.block,{lock:{remove:!0},...c.blockAttrs}]);const w=(0,t.useBlockProps)({className:{"wp-block-blocksy-widgets-wrapper--collapsible":c.isCollapsible,"wp-block-blocksy-widgets-wrapper--expanded":c.defaultExpanded}});return(0,e.createElement)(React.Fragment,null,p?(0,e.createElement)(t.InspectorControls,null,(0,e.createElement)(n.PanelBody,null,(0,e.createElement)(n.ToggleControl,{label:(0,l.__)("Expandable Container","blocksy-companion"),checked:c.isCollapsible,onChange:function(){return o({isCollapsible:!c.isCollapsible})}}),c.isCollapsible?(0,e.createElement)(n.ToggleControl,{label:(0,l.__)("Expanded by Default","blocksy-companion"),checked:c.defaultExpanded,onChange:function(){return o({defaultExpanded:!c.defaultExpanded})}}):null)):null,(0,e.createElement)("div",w,(0,e.createElement)(t.InnerBlocks,{allowedBlocks:u,template:d})))},s=window.wp.hooks,a=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"blocksy/widgets-wrapper","supports":{"className":false,"spacing":{"margin":true,"__experimentalDefaultControls":{"margin":true}}}}');(0,s.addFilter)("blockEditor.__unstableCanInsertBlockType","blocksy/widgets-wrapper",function(e,l,c,{getBlock:t}){if(0!==l.name.indexOf("blocksy/"))return e;if(!l.parent||!l.parent.includes("blocksy/widgets-wrapper"))return e;const n=t(c);return(!n||"blocksy/widgets-wrapper"!==n.name)&&e},500),(0,c.registerBlockType)("blocksy/widgets-wrapper",{...a,title:(0,l.__)("Widgets Wrapper","blocksy-companion"),icon:{src:(0,e.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"wc-block-editor-components-block-icon"},(0,e.createElement)("path",{d:"M20 14.6c-.2-.3-.5-.6-.9-.8.1-1.2-.1-2.4-.6-3.5s-1.3-2.1-2.3-2.9c-.4-.3-.8-.5-1.3-.8 0-.6-.2-1.2-.5-1.6-.3-.5-.8-.9-1.4-1.1-1-.4-2.4-.1-3.2.8-.5.5-.8 1.2-.8 2-1 .4-1.8 1-2.5 1.8-.8 1-1.4 2.1-1.6 3.3-.1.6-.1 1.3-.1 2-.7.4-1.2 1-1.4 1.7-.3 1.2.1 2.4 1 3.2s2.3.8 3.3.2c.9.6 1.9 1.1 3 1.2.4.1.8.1 1.2.1.9 0 1.9-.2 2.7-.5.5-.2.9-.5 1.4-.8.2.1.4.2.7.3 1.1.3 2.4-.1 3.1-1 .1-.1.2-.3.3-.4v-.1c.7-.9.6-2.2-.1-3.1zm-9.6-8.1c0-.1 0-.2.1-.3 0 0 0-.1.1-.2 0-.1.1-.2.2-.3l.1-.1s.1-.1.1-.2h.1s.1 0 .1-.1c0 0 .1 0 .1-.1h.1c.1 0 .2-.1.3-.1h.7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1-.1c.2-.1.5-.3.7-.4 0 0 .1 0 .1-.1 0 0 0 .1.1.1.3.5.7.9 1.3 1.2.6.3 1.2.4 1.9.3.9-.1 1.7-.8 2.2-1.6.2.1.4.3.7.5l.2.1c.1.1.2.2.3.2.2.2.4.4.5.6l.1.1s0 .1.1.1c.1.1.2.2.2.3.1.2.3.4.4.7 0 .1.1.1.1.2v.1c0 .1.1.2.1.4.1.3.1.5.2.8v1.3c-.4 0-.8 0-1.1.1-1.2.4-2.1 1.6-2 2.9 0 .6.2 1.1.5 1.6zm1.7-3.3zm2.4 1.8v.2c0 .1 0 .2-.1.3v.1c0 .1 0 .1-.1.1 0 0-.1.1-.1.2l-.2.2-.1.1c-.1.1-.2.1-.3.2h-.1c-.1 0-.2.1-.3.1h-.7c-.1 0-.2-.1-.3-.2h-.1l-.1-.1-.1-.1c-.1-.1-.1-.2-.2-.3v-.2c0-.1-.1-.2-.1-.4v-.4c0-.1 0-.2.1-.3l.1-.2v-.1c0-.1.1-.2.2-.3l.1-.1.1-.1c.1-.1.2-.1.3-.2h.2c.1 0 .2-.1.3-.1H18.7c.1 0 .2.1.3.2l.1.1.2.2c.1.1.1.2.2.3v.2c0 .1.1.2.1.3v.1c-.4 0-.4.1-.4.2z"}))},category:"blocksy-blocks",isHidden:!0,edit:o,save:function(){return(0,e.createElement)(t.InnerBlocks.Content,null)},attributes:{heading:{type:"string",default:(0,l.__)("Socials","blocksy-companion")},block:{type:"string",default:"blocksy/socials"},hasDescription:{type:"boolean",default:!1},description:{type:"string",default:""},blockAttrs:{type:"object",default:{}},isCollapsible:{type:"boolean",default:!1},defaultExpanded:{type:"boolean",default:!0}},variations:[]})}();