Commit realizado el 12:13:52 08-04-2024

This commit is contained in:
Pagina Web Monito
2024-04-08 12:13:55 -04:00
commit 0c33094de9
7815 changed files with 1365694 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
.wpforms-edit-post-education-notice-body{padding-left:52px;min-height:40px;margin:0;position:relative}.wpforms-edit-post-education-notice-body p{margin:0}.wpforms-edit-post-education-notice-body:before{content:'';display:block;width:40px;height:40px;background-image:url("../../images/sullie-edit-post-education.svg");background-size:100%;position:absolute;left:0;top:0}.wpforms-hidden{display:none !important}.wpforms-edit-post-education-notice{position:relative;background:#FFFFFF;border:1px solid #C3C4C7;box-shadow:0 1px 1px rgba(0,0,0,0.05);padding:10px;font-size:14px;line-height:21px;display:flex;align-items:flex-start;margin:23px 0}.wpforms-edit-post-education-notice .notice-dismiss{position:static;margin-left:auto}.wpforms-edit-post-education-notice:not(.wpforms-hidden)+#postdivrich{margin-top:-20px}.is-distraction-free .interface-interface-skeleton__header:focus-within .wpforms-edit-post-education-notice .components-notice__actions,.is-distraction-free .interface-interface-skeleton__header:focus-within .wpforms-edit-post-education-notice .components-notice__content{transform:none !important}.components-notice-list .wpforms-edit-post-education-notice{background-color:#f0f6fc;border-top:0;border-left:4px solid #007cba;border-bottom:0;border-right:0}.components-notice-list .wpforms-edit-post-education-notice-body{padding-right:150px;float:left}@media (max-width: 767px){.components-notice-list .wpforms-edit-post-education-notice-body{float:none;padding-right:0}.components-notice-list .components-notice__action.components-button.wpforms-edit-post-education-notice-guide-button{margin-left:52px}}@media (min-width: 768px){.components-notice-list .components-notice__action.components-button.wpforms-edit-post-education-notice-guide-button{position:absolute;right:60px;top:14px;margin:0}.components-notice-list .wpforms-edit-post-education-notice.components-notice .components-notice__dismiss{margin-top:14px}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" fill="none"><g clip-path="url(#a)"><rect y="0" width="40" height="40" rx="20" fill="#fff"/><path d="M12.055 7.118c2.072 0 3.738 1.778 3.738 3.96s-1.666 3.967-3.738 3.967c-2.073 0-3.739-1.785-3.739-3.967 0-2.182 1.666-3.96 3.739-3.96Z" fill="#7F3E13"/><path d="M12.055 8.209c-1.535 0-2.644 1.37-2.644 2.87 0 1.497 1.109 2.875 2.644 2.875 1.534 0 2.643-1.367 2.643-2.865 0-1.498-1.109-2.88-2.643-2.88Z" fill="#B85A1B"/><path d="M12.055 9.3c-.942 0-1.553.891-1.553 1.778 0 .888.629 1.786 1.553 1.786.923 0 1.552-.888 1.552-1.775 0-.887-.629-1.789-1.552-1.789Z" fill="#63300F"/><path d="M27.945 7.118c2.073 0 3.739 1.778 3.739 3.96s-1.666 3.967-3.739 3.967c-2.072 0-3.738-1.785-3.738-3.967 0-2.182 1.666-3.96 3.738-3.96Z" fill="#7F3E13"/><path d="M27.945 8.209c-1.534 0-2.643 1.37-2.643 2.87 0 1.497 1.09 2.864 2.643 2.864 1.553 0 2.644-1.367 2.644-2.865 0-1.498-1.11-2.869-2.644-2.869Z" fill="#B85A1B"/><path d="M27.945 9.3c-.941 0-1.552.891-1.552 1.778 0 .888.629 1.786 1.552 1.786.924 0 1.553-.888 1.553-1.775 0-.887-.629-1.789-1.553-1.789Z" fill="#4F2800"/><path d="M18.49 8.969a1.185 1.185 0 1 1-1.18 1.182 1.193 1.193 0 0 1 1.18-1.182Zm3.02 0a1.186 1.186 0 1 1-.001 2.371 1.186 1.186 0 0 1 0-2.371Z" fill="#7F3E13"/><path d="M33.818 13.907v7.364l.073.018a2.727 2.727 0 0 1 1.745 2.57v5.292L20 34.318 4.364 29.282V23.86a2.727 2.727 0 0 1 1.756-2.571l.073-.018v-7.382c0-5.09 27.603-5.09 27.603 0l.022.018Z" fill="#7F3E13"/><path d="M7.447 14.184v7.938l-.647.258a1.819 1.819 0 0 0-1.164 1.72v5.59L20 34.317l14.382-4.727V24.1a1.817 1.817 0 0 0-1.164-1.72l-.647-.258v-7.938c0-3.771-25.091-3.771-25.091 0h-.033Z" fill="#B85A1B"/><path d="M7.447 14.184v7.938l-.647.258a1.818 1.818 0 0 0-1.164 1.72v5.59L20 34.317v-3.04c-4.978 0-9.953-3.236-8.64-9.694H20V11.373c-6.273 0-12.564.945-12.564 2.833l.011-.022Z" fill="#E1762F"/><path d="M10.687 19.9h18.684C32 33.925 7.836 33.813 10.687 19.9Z" fill="#E5895B"/><path d="M11.61 20.995c-.257 2.181.205 4.254 1.82 5.88 1.705 1.701 4.276 2.443 6.643 2.425 2.276 0 4.698-.727 6.382-2.349 1.683-1.622 2.181-3.738 1.978-5.956H11.61Z" fill="#E5895B"/><path d="M23.134 27.544c1.259 1.625 4.924.96 3.83-2.48l-3.83 2.48Z" fill="#FAD395"/><path d="M21.989 27.19c1.407 1.819 5.993.728 4.938-3.181l-4.938 3.182Z" fill="#4F2800"/><path d="M23.21 26.245a.553.553 0 0 1 .648.408.56.56 0 0 1-.364.687.567.567 0 0 1-.294-1.09l.01-.005Zm2.997-2.069a.536.536 0 0 1 .648.408.557.557 0 0 1-.364.683.542.542 0 0 1-.636-.403.549.549 0 0 1 .352-.688Z" fill="#fff"/><path d="M25.058 27.875a2.84 2.84 0 0 0 2.018-2.404c-.814-.113-2.221 1.073-2.018 2.404Z" fill="#AD6151"/><path d="M12.61 19.9h14.82c2.086 10.01-17.077 9.916-14.82 0Z" fill="#FAD395"/><path d="M20 25.59a3.465 3.465 0 0 1 .727-1.654c1.775-.28 3.31-1.629 2.83-4.054a10.63 10.63 0 0 0-3.513-.608l-.728 2.291.728 4.051-.044-.025Z" fill="#4F2800"/><path d="M20 25.59a3.506 3.506 0 0 0-.706-1.661c-1.763-.273-3.294-1.611-2.818-4.047 1.132-.4 2.323-.606 3.524-.608v6.317Z" fill="#63300F"/><path d="M17.382 20.235a10.138 10.138 0 0 1 5.254 0c.739 1.832-6.05 1.814-5.254 0Z" fill="#AD6151"/><path d="M17.178 15.147a1.982 1.982 0 1 1 .007 3.964 1.982 1.982 0 0 1-.007-3.964Z" fill="#fff"/><path d="M17.327 15.83a1.48 1.48 0 1 1 0 2.961 1.48 1.48 0 0 1 0-2.96Z" fill="#1B1D23"/><path d="M22.876 15.147a1.982 1.982 0 1 0-.007 3.964 1.982 1.982 0 0 0 .007-3.964Z" fill="#fff"/><path d="M22.727 15.83a1.48 1.48 0 1 0 1.48 1.48 1.487 1.487 0 0 0-1.48-1.48Z" fill="#1B1D23"/><path d="M18.622 14.5a5.538 5.538 0 0 0-4.106.727c-.425-2.429 3.666-3.149 4.106-.727Z" fill="#63300F"/><path d="M21.025 13.278a5.531 5.531 0 0 1 4.11.727c.425-2.429-3.68-3.149-4.11-.727Z" fill="#4F2800"/><path d="M35.636 29.17v15.225a1.855 1.855 0 0 1-1.85 1.85H6.206a1.855 1.855 0 0 1-1.843-1.85V29.3L20 33.038l15.636-3.869Z" fill="#7EAABA"/><path d="M34.382 30.762 20 34.318 5.618 30.871v13.192a.916.916 0 0 0 .927.924h26.91a.917.917 0 0 0 .923-.924l.004-13.301Z" fill="#D3E8EF"/><path d="M20 34.318 5.636 30.871v13.193a.916.916 0 0 0 .91.923H20V34.318Z" fill="#fff"/><path d="M20 38.05h12.09v1.628H20V38.05Zm0 3.348h12.09v1.647H20v-1.647Z" fill="#036AAB"/><path d="M7.93 38.05H20v1.628H7.93V38.05ZM20 43.044v-1.629H7.93v1.63H20Z" fill="#0399ED"/><path d="M12.833 36.995h1.516v7.381h-1.516v-7.381Z" fill="#fff"/><path d="M8.578 30.318c3.811.906 7.637 1.818 11.411 2.738l-4.07 3.83c-2.643-1.557-5.254-3.277-7.34-6.568Z" fill="#7EAABA"/><path d="M11.815 32.35a21.16 21.16 0 0 0 3.938 2.979l1.723-1.625c-1.887-.444-3.774-.91-5.661-1.353Z" fill="#fff"/><path d="M31.422 30.318c-3.811.906-7.637 1.818-11.411 2.738l4.069 3.848c2.644-1.575 5.255-3.295 7.342-6.586Z" fill="#7EAABA"/><path d="M28.185 32.35a21.167 21.167 0 0 1-3.938 2.979l-1.723-1.625c1.887-.444 3.774-.91 5.661-1.353Z" fill="#fff"/></g><rect x=".5" y="0.5" width="39" height="39" rx="19.5" stroke="#C3C4C7"/><defs><clipPath id="a"><rect y="0" width="40" height="40" rx="20" fill="#fff"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -0,0 +1,84 @@
/* global wpforms_builder_lite, wpforms_builder */
'use strict';
var WPFormsBuilderLite = window.WPFormsBuilderLite || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.0.0
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 1.0.0
*/
init: function() {
// Document ready
$( app.ready() );
app.bindUIActions();
},
/**
* Document ready.
*
* @since 1.0.0
*/
ready: function() {},
/**
* Element bindings.
*
* @since 1.0.0
*/
bindUIActions: function() {
// Warn users if they disable email notifications.
$( document ).on( 'change', '#wpforms-panel-field-settings-notification_enable', function() {
app.formBuilderNotificationAlert( $( this ).is( ':checked' ) );
} );
},
/**
* Warn users if they disable email notifications.
*
* @since 1.5.0
*
* @param {bool} value Whether notifications enabled or not. 0 is disabled, 1 is enabled.
*/
formBuilderNotificationAlert: function( value ) {
if ( value !== false ) {
return;
}
$.alert( {
title: wpforms_builder.heads_up,
content: wpforms_builder_lite.disable_notifications,
icon: 'fa fa-exclamation-circle',
type: 'orange',
buttons: {
confirm: {
text: wpforms_builder.ok,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
},
},
} );
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
WPFormsBuilderLite.init();

View File

@@ -0,0 +1 @@
"use strict";var WPFormsBuilderLite=window.WPFormsBuilderLite||function(i,t){var n={init:function(){t(n.ready()),n.bindUIActions()},ready:function(){},bindUIActions:function(){t(i).on("change","#wpforms-panel-field-settings-notification_enable",function(){n.formBuilderNotificationAlert(t(this).is(":checked"))})},formBuilderNotificationAlert:function(i){!1===i&&t.alert({title:wpforms_builder.heads_up,content:wpforms_builder_lite.disable_notifications,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})}};return n}(document,(window,jQuery));WPFormsBuilderLite.init();

View File

@@ -0,0 +1,181 @@
/* global wpforms_admin */
/**
* Connect functionality.
*
* @since 1.5.4
*/
'use strict';
var WPFormsConnect = window.WPFormsConnect || ( function( document, window, $ ) {
/**
* Elements reference.
*
* @since 1.5.5
*
* @type {object}
*/
var el = {
$connectBtn: $( '#wpforms-settings-connect-btn' ),
$connectKey: $( '#wpforms-settings-upgrade-license-key' ),
};
/**
* Public functions and properties.
*
* @since 1.5.5
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 1.5.5
*/
init: function() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.5.5
*/
ready: function() {
app.events();
},
/**
* Register JS events.
*
* @since 1.5.5
*/
events: function() {
app.connectBtnClick();
},
/**
* Register connect button event.
*
* @since 1.5.5
*/
connectBtnClick: function() {
el.$connectBtn.on( 'click', function( event ) {
event.preventDefault();
app.gotoUpgradeUrl();
} );
},
/**
* Get the alert arguments in case of Pro already installed.
*
* @since 1.5.5
*
* @param {object} res Ajax query result object.
*
* @returns {object} Alert arguments.
*/
proAlreadyInstalled: function( res ) {
var buttons = {
confirm: {
text: wpforms_admin.plugin_activate_btn,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
action: function() {
window.location.reload();
},
},
};
return {
title: wpforms_admin.almost_done,
content: res.data.message,
icon: 'fa fa-check-circle',
type: 'green',
buttons: buttons,
};
},
/**
* Go to upgrade url.
*
* @since 1.5.5
*/
gotoUpgradeUrl: function() {
var data = {
action: 'wpforms_connect_url',
key: el.$connectKey.val(),
nonce: wpforms_admin.nonce,
};
$.post( wpforms_admin.ajax_url, data )
.done( function( res ) {
if ( res.success ) {
if ( res.data.reload ) {
$.alert( app.proAlreadyInstalled( res ) );
return;
}
window.location.href = res.data.url;
return;
}
$.alert( {
title: wpforms_admin.oops,
content: res.data.message,
icon: 'fa fa-exclamation-circle',
type: 'orange',
buttons: {
confirm: {
text: wpforms_admin.ok,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
},
},
} );
} )
.fail( function( xhr ) {
app.failAlert( xhr );
} );
},
/**
* Alert in case of server error.
*
* @since 1.5.5
*
* @param {object} xhr XHR object.
*/
failAlert: function( xhr ) {
$.alert( {
title: wpforms_admin.oops,
content: wpforms_admin.server_error + '<br>' + xhr.status + ' ' + xhr.statusText + ' ' + xhr.responseText,
icon: 'fa fa-exclamation-circle',
type: 'orange',
buttons: {
confirm: {
text: wpforms_admin.ok,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
},
},
} );
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPFormsConnect.init();

View File

@@ -0,0 +1 @@
"use strict";var WPFormsConnect=window.WPFormsConnect||function(e,t){var o={$connectBtn:t("#wpforms-settings-connect-btn"),$connectKey:t("#wpforms-settings-upgrade-license-key")},r={init:function(){t(r.ready)},ready:function(){r.events()},events:function(){r.connectBtnClick()},connectBtnClick:function(){o.$connectBtn.on("click",function(n){n.preventDefault(),r.gotoUpgradeUrl()})},proAlreadyInstalled:function(n){var t={confirm:{text:wpforms_admin.plugin_activate_btn,btnClass:"btn-confirm",keys:["enter"],action:function(){e.location.reload()}}};return{title:wpforms_admin.almost_done,content:n.data.message,icon:"fa fa-check-circle",type:"green",buttons:t}},gotoUpgradeUrl:function(){var n={action:"wpforms_connect_url",key:o.$connectKey.val(),nonce:wpforms_admin.nonce};t.post(wpforms_admin.ajax_url,n).done(function(n){if(n.success)return n.data.reload?void t.alert(r.proAlreadyInstalled(n)):void(e.location.href=n.data.url);t.alert({title:wpforms_admin.oops,content:n.data.message,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}).fail(function(n){r.failAlert(n)})},failAlert:function(n){t.alert({title:wpforms_admin.oops,content:wpforms_admin.server_error+"<br>"+n.status+" "+n.statusText+" "+n.responseText,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}};return r}((document,window),jQuery);WPFormsConnect.init();

View File

@@ -0,0 +1,339 @@
/* global wpforms_dashboard_widget, moment, Chart, ajaxurl */
/**
* WPForms Dashboard Widget function.
*
* @since 1.5.0
*/
'use strict';
var WPFormsDashboardWidget = window.WPFormsDashboardWidget || ( function( document, window, $ ) {
/**
* Elements reference.
*
* @since 1.5.0
*
* @type {object}
*/
var el = {
$widget: $( '#wpforms_reports_widget_lite' ),
$settingsBtn: $( '#wpforms-dash-widget-settings-button' ),
$canvas: $( '#wpforms-dash-widget-chart' ),
$dismissBtn: $( '.wpforms-dash-widget-dismiss-chart-upgrade' ),
$recomBlockDismissBtn: $( '#wpforms-dash-widget-dismiss-recommended-plugin-block' ),
};
/**
* Chart.js functions and properties.
*
* @since 1.5.0
*
* @type {object}
*/
var chart = {
/**
* Chart.js instance.
*
* @since 1.5.0
*/
instance: null,
/**
* Chart.js settings.
*
* @since 1.5.0
*/
settings: {
type : 'line',
data : {
labels : [],
datasets: [ {
label : wpforms_dashboard_widget.i18n.entries,
data : [],
backgroundColor : 'rgba(255, 129, 0, 0.135)',
borderColor : 'rgba(211, 126, 71, 1)',
borderWidth : 2,
pointRadius : 4,
pointBorderWidth : 1,
pointBackgroundColor: 'rgba(255, 255, 255, 1)',
} ],
},
options: {
scales : {
xAxes: [ {
type : 'time',
time : {
unit: 'day',
},
distribution: 'series',
ticks : {
beginAtZero: true,
source : 'labels',
padding : 10,
minRotation: 25,
maxRotation: 25,
callback : function( value, index, values ) {
// Distribute the ticks equally starting from a right side of xAxis.
var gap = Math.floor( values.length / 7 );
if ( gap < 1 ) {
return value;
}
if ( ( values.length - index - 1 ) % gap === 0 ) {
return value;
}
},
},
} ],
yAxes: [ {
ticks: {
beginAtZero : true,
maxTicksLimit: 6,
padding : 20,
callback : function( value ) {
// Make sure the tick value has no decimals.
if ( Math.floor( value ) === value ) {
return value;
}
},
},
} ],
},
elements : {
line: {
tension: 0,
},
},
animation : {
duration: 0,
},
hover : {
animationDuration: 0,
},
legend : {
display: false,
},
tooltips : {
displayColors: false,
},
responsiveAnimationDuration: 0,
maintainAspectRatio: false,
},
},
/**
* Init Chart.js.
*
* @since 1.5.0
*/
init: function() {
var ctx;
if ( ! el.$canvas.length ) {
return;
}
ctx = el.$canvas[ 0 ].getContext( '2d' );
chart.instance = new Chart( ctx, chart.settings );
chart.updateUI();
},
/**
* Update Chart.js canvas.
*
* @since 1.5.0
*/
updateUI: function() {
chart.updateWithDummyData();
chart.instance.data.labels = chart.settings.data.labels;
chart.instance.data.datasets[ 0 ].data = chart.settings.data.datasets[ 0 ].data;
chart.instance.update();
},
/**
* Update Chart.js settings with dummy data.
*
* @since 1.5.0
*/
updateWithDummyData: function() {
var end = moment().endOf( 'day' );
var date;
var minY = 5;
var maxY = 20;
var i;
for ( i = 1; i <= 7; i++ ) {
date = end.clone().subtract( i, 'days' );
chart.settings.data.labels.push( date );
chart.settings.data.datasets[ 0 ].data.push( {
t: date,
y: Math.floor( Math.random() * ( maxY - minY + 1 ) ) + minY,
} );
}
},
};
/**
* Public functions and properties.
*
* @since 1.5.0
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 1.5.0
*/
init: function() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.5.0
*/
ready: function() {
chart.init();
app.events();
app.graphSettings();
},
/**
* Graph settings related events.
*
* @since 1.7.4
*/
graphSettings: function() {
el.$settingsBtn.on( 'click', function() {
$( this ).siblings( '.wpforms-dash-widget-settings-menu' ).toggle();
} );
},
/**
* Register JS events.
*
* @since 1.5.0
*/
events: function() {
app.formsListEvents();
app.handleChartClose();
app.handleRecommendedPluginsClose();
},
/**
* Register forms list area JS events.
*
* @since 1.5.0
*/
formsListEvents: function() {
el.$widget.on( 'click', '#wpforms-dash-widget-forms-more', function() {
app.toggleCompleteFormsList();
} );
},
/**
* Handle chart close.
*
* @since 1.7.4
*/
handleChartClose: function() {
el.$dismissBtn.on( 'click', function( event ) {
event.preventDefault();
app.saveWidgetMeta( 'hide_graph', 1 );
$( '.wpforms-dash-widget.wpforms-lite' ).addClass( 'wpforms-dash-widget-no-graph' );
$( this ).closest( '.wpforms-dash-widget-chart-block-container' ).remove();
} );
},
/**
* Handle recommended plugins block close.
*
* @since 1.7.4
*/
handleRecommendedPluginsClose: function() {
el.$recomBlockDismissBtn.on( 'click', function() {
app.dismissRecommendedBlock();
} );
},
/**
* Save dashboard widget meta on a backend.
*
* @since 1.7.4
*
* @param {string} meta Meta name to save.
* @param {number} value Value to save.
*/
saveWidgetMeta: function( meta, value ) {
const data = {
_wpnonce: wpforms_dashboard_widget.nonce,
action : 'wpforms_' + wpforms_dashboard_widget.slug + '_save_widget_meta',
meta : meta,
value : value,
};
$.post( ajaxurl, data );
},
/**
* Toggle forms list hidden entries.
*
* @since 1.5.0.4
*/
toggleCompleteFormsList: function() {
$( '#wpforms-dash-widget-forms-list-table .wpforms-dash-widget-forms-list-hidden-el' ).toggle();
$( '#wpforms-dash-widget-forms-more' ).html( function( i, html ) {
return html === wpforms_dashboard_widget.show_less_html ? wpforms_dashboard_widget.show_more_html : wpforms_dashboard_widget.show_less_html;
} );
},
/**
* Dismiss recommended plugin block.
*
* @since 1.7.4
*/
dismissRecommendedBlock: function() {
$( '.wpforms-dash-widget-recommended-plugin-block' ).remove();
app.saveWidgetMeta( 'hide_recommended_block', 1 );
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPFormsDashboardWidget.init();

View File

@@ -0,0 +1 @@
"use strict";var WPFormsDashboardWidget=window.WPFormsDashboardWidget||function(s){var e={$widget:s("#wpforms_reports_widget_lite"),$settingsBtn:s("#wpforms-dash-widget-settings-button"),$canvas:s("#wpforms-dash-widget-chart"),$dismissBtn:s(".wpforms-dash-widget-dismiss-chart-upgrade"),$recomBlockDismissBtn:s("#wpforms-dash-widget-dismiss-recommended-plugin-block")},i={instance:null,settings:{type:"line",data:{labels:[],datasets:[{label:wpforms_dashboard_widget.i18n.entries,data:[],backgroundColor:"rgba(255, 129, 0, 0.135)",borderColor:"rgba(211, 126, 71, 1)",borderWidth:2,pointRadius:4,pointBorderWidth:1,pointBackgroundColor:"rgba(255, 255, 255, 1)"}]},options:{scales:{xAxes:[{type:"time",time:{unit:"day"},distribution:"series",ticks:{beginAtZero:!0,source:"labels",padding:10,minRotation:25,maxRotation:25,callback:function(t,e,s){var i=Math.floor(s.length/7);return i<1||(s.length-e-1)%i==0?t:void 0}}}],yAxes:[{ticks:{beginAtZero:!0,maxTicksLimit:6,padding:20,callback:function(t){if(Math.floor(t)===t)return t}}}]},elements:{line:{tension:0}},animation:{duration:0},hover:{animationDuration:0},legend:{display:!1},tooltips:{displayColors:!1},responsiveAnimationDuration:0,maintainAspectRatio:!1}},init:function(){var t;e.$canvas.length&&(t=e.$canvas[0].getContext("2d"),i.instance=new Chart(t,i.settings),i.updateUI())},updateUI:function(){i.updateWithDummyData(),i.instance.data.labels=i.settings.data.labels,i.instance.data.datasets[0].data=i.settings.data.datasets[0].data,i.instance.update()},updateWithDummyData:function(){for(var t,e=moment().endOf("day"),s=1;s<=7;s++)t=e.clone().subtract(s,"days"),i.settings.data.labels.push(t),i.settings.data.datasets[0].data.push({t:t,y:Math.floor(16*Math.random())+5})}},a={init:function(){s(a.ready)},ready:function(){i.init(),a.events(),a.graphSettings()},graphSettings:function(){e.$settingsBtn.on("click",function(){s(this).siblings(".wpforms-dash-widget-settings-menu").toggle()})},events:function(){a.formsListEvents(),a.handleChartClose(),a.handleRecommendedPluginsClose()},formsListEvents:function(){e.$widget.on("click","#wpforms-dash-widget-forms-more",function(){a.toggleCompleteFormsList()})},handleChartClose:function(){e.$dismissBtn.on("click",function(t){t.preventDefault(),a.saveWidgetMeta("hide_graph",1),s(".wpforms-dash-widget.wpforms-lite").addClass("wpforms-dash-widget-no-graph"),s(this).closest(".wpforms-dash-widget-chart-block-container").remove()})},handleRecommendedPluginsClose:function(){e.$recomBlockDismissBtn.on("click",function(){a.dismissRecommendedBlock()})},saveWidgetMeta:function(t,e){t={_wpnonce:wpforms_dashboard_widget.nonce,action:"wpforms_"+wpforms_dashboard_widget.slug+"_save_widget_meta",meta:t,value:e};s.post(ajaxurl,t)},toggleCompleteFormsList:function(){s("#wpforms-dash-widget-forms-list-table .wpforms-dash-widget-forms-list-hidden-el").toggle(),s("#wpforms-dash-widget-forms-more").html(function(t,e){return e===wpforms_dashboard_widget.show_less_html?wpforms_dashboard_widget.show_more_html:wpforms_dashboard_widget.show_less_html})},dismissRecommendedBlock:function(){s(".wpforms-dash-widget-recommended-plugin-block").remove(),a.saveWidgetMeta("hide_recommended_block",1)}};return a}((document,window,jQuery));WPFormsDashboardWidget.init();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,413 @@
/* global wpforms_edit_post_education */
/**
* WPForms Edit Post Education function.
*
* @since 1.8.1
*/
'use strict';
const WPFormsEditPostEducation = window.WPFormsEditPostEducation || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.8.1
*
* @type {object}
*/
const app = {
/**
* Determine if the notice was showed before.
*
* @since 1.8.1
*/
isNoticeVisible: false,
/**
* Start the engine.
*
* @since 1.8.1
*/
init: function() {
$( window ).on( 'load', function() {
// In the case of jQuery 3.+, we need to wait for a ready event first.
if ( typeof $.ready.then === 'function' ) {
$.ready.then( app.load );
} else {
app.load();
}
} );
},
/**
* Page load.
*
* @since 1.8.1
*/
load: function() {
if ( ! app.isGutenbergEditor() ) {
app.maybeShowClassicNotice();
app.bindClassicEvents();
return;
}
const blockLoadedInterval = setInterval( function() {
if ( ! document.querySelector( '.editor-post-title__input, iframe[name="editor-canvas"]' ) ) {
return;
}
clearInterval( blockLoadedInterval );
if ( ! app.isFse() ) {
app.maybeShowGutenbergNotice();
app.bindGutenbergEvents();
return;
}
const iframe = document.querySelector( 'iframe[name="editor-canvas"]' );
const observer = new MutationObserver( function() {
const iframeDocument = iframe.contentDocument || iframe.contentWindow.document || {};
if ( iframeDocument.readyState === 'complete' && iframeDocument.querySelector( '.editor-post-title__input' ) ) {
app.maybeShowGutenbergNotice();
app.bindFseEvents();
observer.disconnect();
}
} );
observer.observe( document.body, { subtree: true, childList: true } );
}, 200 );
},
/**
* Bind events for Classic Editor.
*
* @since 1.8.1
*/
bindClassicEvents: function() {
const $document = $( document );
if ( ! app.isNoticeVisible ) {
$document.on( 'input', '#title', app.maybeShowClassicNotice );
}
$document.on( 'click', '.wpforms-edit-post-education-notice-close', app.closeNotice );
},
/**
* Bind events for Gutenberg Editor.
*
* @since 1.8.1
*/
bindGutenbergEvents: function() {
const $document = $( document );
$document
.on( 'DOMSubtreeModified', '.edit-post-layout', app.distractionFreeModeToggle );
if ( app.isNoticeVisible ) {
return;
}
$document
.on( 'input', '.editor-post-title__input', app.maybeShowGutenbergNotice )
.on( 'DOMSubtreeModified', '.editor-post-title__input', app.maybeShowGutenbergNotice );
},
/**
* Bind events for Gutenberg Editor in FSE mode.
*
* @since 1.8.1
*/
bindFseEvents: function() {
const $iframe = $( 'iframe[name="editor-canvas"]' );
$( document )
.on( 'DOMSubtreeModified', '.edit-post-layout', app.distractionFreeModeToggle );
$iframe.contents()
.on( 'DOMSubtreeModified', '.editor-post-title__input', app.maybeShowGutenbergNotice );
},
/**
* Determine if the editor is Gutenberg.
*
* @since 1.8.1
*
* @returns {boolean} True if the editor is Gutenberg.
*/
isGutenbergEditor: function() {
return typeof wp !== 'undefined' && typeof wp.blocks !== 'undefined';
},
/**
* Determine if the editor is Gutenberg in FSE mode.
*
* @since 1.8.1
*
* @returns {boolean} True if the Gutenberg editor in FSE mode.
*/
isFse: function() {
return Boolean( $( 'iframe[name="editor-canvas"]' ).length );
},
/**
* Create a notice for Gutenberg.
*
* @since 1.8.1
*/
showGutenbergNotice: function() {
wp.data.dispatch( 'core/notices' ).createInfoNotice(
wpforms_edit_post_education.gutenberg_notice.template,
app.getGutenbergNoticeSettings()
);
// The notice component doesn't have a way to add HTML id or class to the notice.
// Also, the notice became visible with a delay on old Gutenberg versions.
const hasNotice = setInterval( function() {
const noticeBody = $( '.wpforms-edit-post-education-notice-body' );
if ( ! noticeBody.length ) {
return;
}
const $notice = noticeBody.closest( '.components-notice' );
$notice.addClass( 'wpforms-edit-post-education-notice' );
$notice.find( '.is-secondary, .is-link' ).removeClass( 'is-secondary' ).removeClass( 'is-link' ).addClass( 'is-primary' );
clearInterval( hasNotice );
}, 100 );
},
/**
* Get settings for the Gutenberg notice.
*
* @since 1.8.1
*
* @returns {object} Notice settings.
*/
getGutenbergNoticeSettings: function() {
const pluginName = 'wpforms-edit-post-product-education-guide';
const noticeSettings = {
id: pluginName,
isDismissible: true,
HTML: true,
__unstableHTML: true,
actions: [
{
className: 'wpforms-edit-post-education-notice-guide-button',
variant: 'primary',
label: wpforms_edit_post_education.gutenberg_notice.button,
},
],
};
if ( ! wpforms_edit_post_education.gutenberg_guide ) {
noticeSettings.actions[0].url = wpforms_edit_post_education.gutenberg_notice.url;
return noticeSettings;
}
const Guide = wp.components.Guide;
const useState = wp.element.useState;
const registerPlugin = wp.plugins.registerPlugin;
const unregisterPlugin = wp.plugins.unregisterPlugin;
const GutenbergTutorial = function() {
const [ isOpen, setIsOpen ] = useState( true );
if ( ! isOpen ) {
return null;
}
return (
// eslint-disable-next-line react/react-in-jsx-scope
<Guide
className="edit-post-welcome-guide"
onFinish={ () => {
unregisterPlugin( pluginName );
setIsOpen( false );
} }
pages={ app.getGuidePages() }
/>
);
};
noticeSettings.onDismiss = app.updateUserMeta;
noticeSettings.actions[0].onClick = () => registerPlugin( pluginName, { render: GutenbergTutorial } );
return noticeSettings;
},
/**
* Get Guide pages in proper format.
*
* @since 1.8.1
*
* @returns {Array} Guide Pages.
*/
getGuidePages: function() {
const pages = [];
wpforms_edit_post_education.gutenberg_guide.forEach( function( page ) {
pages.push(
{
/* eslint-disable react/react-in-jsx-scope */
content: (
<>
<h1 className="edit-post-welcome-guide__heading">{ page.title }</h1>
<p className="edit-post-welcome-guide__text">{ page.content }</p>
</>
),
image: <img className="edit-post-welcome-guide__image" src={ page.image } alt={ page.title } />,
/* eslint-enable react/react-in-jsx-scope */
}
);
} );
return pages;
},
/**
* Show notice if the page title matches some keywords for Classic Editor.
*
* @since 1.8.1
*/
maybeShowClassicNotice: function() {
if ( app.isNoticeVisible ) {
return;
}
if ( app.isTitleMatchKeywords( $( '#title' ).val() ) ) {
app.isNoticeVisible = true;
$( '.wpforms-edit-post-education-notice' ).removeClass( 'wpforms-hidden' );
}
},
/**
* Show notice if the page title matches some keywords for Gutenberg Editor.
*
* @since 1.8.1
*/
maybeShowGutenbergNotice: function() {
if ( app.isNoticeVisible ) {
return;
}
const $postTitle = app.isFse() ?
$( 'iframe[name="editor-canvas"]' ).contents().find( '.editor-post-title__input' ) :
$( '.editor-post-title__input' );
const tagName = $postTitle.prop( 'tagName' );
const title = tagName === 'TEXTAREA' ? $postTitle.val() : $postTitle.text();
if ( app.isTitleMatchKeywords( title ) ) {
app.isNoticeVisible = true;
app.showGutenbergNotice();
}
},
/**
* Add notice class when the distraction mode is enabled.
*
* @since 1.8.1.2
*/
distractionFreeModeToggle: function() {
if ( ! app.isNoticeVisible ) {
return;
}
const $document = $( document );
const isDistractionFreeMode = Boolean( $document.find( '.is-distraction-free' ).length );
if ( ! isDistractionFreeMode ) {
return;
}
const isNoticeHasClass = Boolean( $( '.wpforms-edit-post-education-notice' ).length );
if ( isNoticeHasClass ) {
return;
}
const $noticeBody = $document.find( '.wpforms-edit-post-education-notice-body' );
const $notice = $noticeBody.closest( '.components-notice' );
$notice.addClass( 'wpforms-edit-post-education-notice' );
},
/**
* Determine if the title matches keywords.
*
* @since 1.8.1
*
* @param {string} titleValue Page title value.
*
* @returns {boolean} True if the title matches some keywords.
*/
isTitleMatchKeywords: function( titleValue ) {
const expectedTitleRegex = new RegExp( /\b(contact|form)\b/i );
return expectedTitleRegex.test( titleValue );
},
/**
* Close a notice.
*
* @since 1.8.1
*/
closeNotice: function() {
$( this ).closest( '.wpforms-edit-post-education-notice' ).remove();
app.updateUserMeta();
},
/**
* Update user meta and don't show the notice next time.
*
* @since 1.8.1
*/
updateUserMeta() {
$.post(
wpforms_edit_post_education.ajax_url,
{
action: 'wpforms_education_dismiss',
nonce: wpforms_edit_post_education.education_nonce,
section: 'edit-post-notice',
}
);
},
};
return app;
}( document, window, jQuery ) );
WPFormsEditPostEducation.init();

View File

@@ -0,0 +1,201 @@
/* global wpforms_builder, wpforms_education */
/**
* WPForms Education core for Lite.
*
* @since 1.6.6
*/
'use strict';
var WPFormsEducation = window.WPFormsEducation || {};
WPFormsEducation.liteCore = window.WPFormsEducation.liteCore || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.6.6
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 1.6.6
*/
init: function() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.6.6
*/
ready: function() {
app.events();
},
/**
* Register JS events.
*
* @since 1.6.6
*/
events: function() {
app.openModalButtonClick();
},
/**
* Registers click events that should open upgrade modal.
*
* @since 1.6.6
*/
openModalButtonClick: function() {
$( document )
.on( 'click', '.education-modal:not(.wpforms-add-fields-button)', app.openModalButtonHandler )
.on( 'mousedown', '.education-modal.wpforms-add-fields-button', app.openModalButtonHandler );
},
/**
* Open education modal handler.
*
* @since 1.8.0
*
* @param {Event} event Event.
*/
openModalButtonHandler: function( event ) {
const $this = $( this );
if ( $this.data( 'action' ) && [ 'activate', 'install' ].includes( $this.data( 'action' ) ) ) {
return;
}
event.preventDefault();
event.stopImmediatePropagation();
let name = $this.data( 'name' );
if ( $this.hasClass( 'wpforms-add-fields-button' ) ) {
name = $this.text();
name += name.indexOf( wpforms_builder.field ) < 0 ? ' ' + wpforms_builder.field : '';
}
const utmContent = WPFormsEducation.core.getUTMContentValue( $this );
app.upgradeModal( name, utmContent, $this.data( 'license' ), $this.data( 'video' ), $this.data( 'plural' ) );
},
/**
* Upgrade modal.
*
* @since 1.6.6
*
* @param {string} feature Feature name.
* @param {string} utmContent UTM content.
* @param {string} type Feature license type: pro or elite.
* @param {string} video Feature video URL.
* @param {boolean} isPlural Is feature name plural.
*/
upgradeModal( feature, utmContent, type, video, isPlural ) {
// Provide a default value.
if ( typeof type === 'undefined' || type.length === 0 ) {
type = 'pro';
}
// Make sure we received only supported type.
if ( $.inArray( type, [ 'pro', 'elite' ] ) < 0 ) {
return;
}
const message = wpforms_education.upgrade[ type ].message.replace( /%name%/g, feature );
const isVideoModal = ! _.isEmpty( video );
const titleMessage = isPlural ? wpforms_education.upgrade[ type ].title_plural : wpforms_education.upgrade[ type ].title;
let modalWidth = WPFormsEducation.core.getUpgradeModalWidth( isVideoModal );
const modal = $.alert( {
backgroundDismiss: true,
title : feature + ' ' + titleMessage,
icon : 'fa fa-lock',
content : message,
boxWidth : modalWidth,
theme : 'modern,wpforms-education',
closeIcon : true,
onOpenBefore: function() {
if ( isVideoModal ) {
this.$el.addClass( 'has-video' );
}
var videoHtml = isVideoModal ? '<iframe src="' + video + '" class="feature-video" frameborder="0" allowfullscreen="" width="475" height="267"></iframe>' : '';
this.$btnc.after( '<div class="discount-note">' + wpforms_education.upgrade_bonus + '</div>' );
this.$btnc.after( wpforms_education.upgrade[type].doc.replace( /%25name%25/g, feature ) );
this.$btnc.after( videoHtml );
this.$body.find( '.jconfirm-content' ).addClass( 'lite-upgrade' );
},
buttons : {
confirm: {
text : wpforms_education.upgrade[type].button,
btnClass: 'btn-confirm',
keys : [ 'enter' ],
action: function() {
window.open( WPFormsEducation.core.getUpgradeURL( utmContent, type ), '_blank' );
app.upgradeModalThankYou( type );
},
},
},
} );
$( window ).on( 'resize', function() {
modalWidth = WPFormsEducation.core.getUpgradeModalWidth( isVideoModal );
if ( modal.isOpen() ) {
modal.setBoxWidth( modalWidth );
}
} );
},
/**
* Upgrade modal second state.
*
* @since 1.6.6
*
* @param {string} type Feature license type: pro or elite.
*/
upgradeModalThankYou: function( type ) {
$.alert( {
title : wpforms_education.thanks_for_interest,
content : wpforms_education.upgrade[type].modal,
icon : 'fa fa-info-circle',
type : 'blue',
boxWidth: '565px',
buttons : {
confirm: {
text : wpforms_education.ok,
btnClass: 'btn-confirm',
keys : [ 'enter' ],
},
},
} );
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPFormsEducation.liteCore.init();

View File

@@ -0,0 +1 @@
"use strict";var WPFormsEducation=window.WPFormsEducation||{};WPFormsEducation.liteCore=window.WPFormsEducation.liteCore||function(t,c,u){var l={init:function(){u(l.ready)},ready:function(){l.events()},events:function(){l.openModalButtonClick()},openModalButtonClick:function(){u(t).on("click",".education-modal:not(.wpforms-add-fields-button)",l.openModalButtonHandler).on("mousedown",".education-modal.wpforms-add-fields-button",l.openModalButtonHandler)},openModalButtonHandler:function(o){var e=u(this);if(!e.data("action")||!["activate","install"].includes(e.data("action"))){o.preventDefault(),o.stopImmediatePropagation();let t=e.data("name");e.hasClass("wpforms-add-fields-button")&&(t=e.text(),t+=t.indexOf(wpforms_builder.field)<0?" "+wpforms_builder.field:"");o=WPFormsEducation.core.getUTMContentValue(e);l.upgradeModal(t,o,e.data("license"),e.data("video"),e.data("plural"))}},upgradeModal(o,e,n,a,i){if(void 0!==n&&0!==n.length||(n="pro"),!(u.inArray(n,["pro","elite"])<0)){var d=wpforms_education.upgrade[n].message.replace(/%name%/g,o);const r=!_.isEmpty(a);i=i?wpforms_education.upgrade[n].title_plural:wpforms_education.upgrade[n].title;let t=WPFormsEducation.core.getUpgradeModalWidth(r);const s=u.alert({backgroundDismiss:!0,title:o+" "+i,icon:"fa fa-lock",content:d,boxWidth:t,theme:"modern,wpforms-education",closeIcon:!0,onOpenBefore:function(){r&&this.$el.addClass("has-video");var t=r?'<iframe src="'+a+'" class="feature-video" frameborder="0" allowfullscreen="" width="475" height="267"></iframe>':"";this.$btnc.after('<div class="discount-note">'+wpforms_education.upgrade_bonus+"</div>"),this.$btnc.after(wpforms_education.upgrade[n].doc.replace(/%25name%25/g,o)),this.$btnc.after(t),this.$body.find(".jconfirm-content").addClass("lite-upgrade")},buttons:{confirm:{text:wpforms_education.upgrade[n].button,btnClass:"btn-confirm",keys:["enter"],action:function(){c.open(WPFormsEducation.core.getUpgradeURL(e,n),"_blank"),l.upgradeModalThankYou(n)}}}});u(c).on("resize",function(){t=WPFormsEducation.core.getUpgradeModalWidth(r),s.isOpen()&&s.setBoxWidth(t)})}},upgradeModalThankYou:function(t){u.alert({title:wpforms_education.thanks_for_interest,content:wpforms_education.upgrade[t].modal,icon:"fa fa-info-circle",type:"blue",boxWidth:"565px",buttons:{confirm:{text:wpforms_education.ok,btnClass:"btn-confirm",keys:["enter"]}}})}};return l}(document,window,jQuery),WPFormsEducation.liteCore.init();

View File

@@ -0,0 +1,472 @@
/* global wpforms_education_lite_connect, WPFormsChallenge */
/**
* WPForms Education for Lite.
*
* Lite Connect feature.
*
* @since 1.7.4
*/
'use strict';
var WPFormsEducation = window.WPFormsEducation || {};
WPFormsEducation.liteConnect = window.WPFormsEducation.liteConnect || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.7.4
*
* @type {object}
*/
var app = {
/**
* Start the engine.
*
* @since 1.7.4
*/
init: function() {
$( app.ready );
// Page load.
$( window ).on( 'load', function() {
// In the case of jQuery 3.+, we need to wait for a ready event first.
if ( typeof $.ready.then === 'function' ) {
$.ready.then( app.load );
} else {
app.load();
}
} );
},
/**
* Document ready.
*
* @since 1.7.4
*/
ready: function() {
},
/**
* Page load.
*
* @since 1.7.4
*/
load: function() {
app.events();
app.initLiteConnectToggle();
app.maybeRevealBuilderTopBar();
},
/**
* Register JS events.
*
* @since 1.7.4
*/
events: function() {
app.enableLiteConnectToggleClick();
app.enableLiteConnectButtonClick();
app.dismissBuilderTopBarClick();
app.autoSaveToggleChange();
},
/**
* Init Lite Connect toggle.
*
* @since 1.7.5
*/
initLiteConnectToggle: function() {
$( '.wpforms-toggle-control.wpforms-setting-lite-connect-auto-save-toggle input' ).prop( 'disabled', false );
},
/**
* Enable Lite Connect toggle mousedown handler.
*
* @since 1.7.4
*/
enableLiteConnectToggleClick: function() {
$( document ).on(
'mousedown touchstart',
'.wpforms-toggle-control.wpforms-setting-lite-connect-auto-save-toggle',
function( event ) {
var $input = $( this ).find( 'input' ),
isEnabled = $input.is( ':checked' ),
isTouchDevice = 'ontouchstart' in document.documentElement;
if ( ! isTouchDevice ) {
event.preventDefault();
}
if ( $input.prop( 'disabled' ) ) {
return;
}
app.openSettingsLiteConnectModal( isEnabled, function() {
$input
.trigger( 'click' )
.prop( 'disabled', true );
} );
}
);
},
/**
* Enable Lite Connect button click handler.
*
* @since 1.7.4
*/
enableLiteConnectButtonClick: function() {
$( document ).on(
'click',
'.wpforms-dyk-lite-connect .button-primary',
function( event ) {
event.preventDefault();
var $button = $( this );
if ( $button.hasClass( 'wpforms-is-enabled' ) ) {
window.open( $button.attr( 'href' ) );
return;
}
app.openSettingsLiteConnectModal(
false,
app.enableLiteConnectButtonModalConfirm
);
}
);
},
/**
* Enable Lite Connect button modal confirm Callback.
*
* @since 1.7.4
*/
enableLiteConnectButtonModalConfirm: function() {
var $toggle = $( '.wpforms-dyk-lite-connect .button-primary' );
app.saveSettingAjaxPost( true, $toggle, function() {
app.switchSettingView( true, $toggle );
} );
},
/**
* Form Entry Backups information modal.
*
* @since 1.7.4
*
* @param {boolean} isEnabled Current setting state.
* @param {Function} confirmCallback Confirm button action.
*/
openSettingsLiteConnectModal: function( isEnabled, confirmCallback ) {
if ( isEnabled ) {
app.openSettingsLiteConnectDisableModal( confirmCallback );
} else {
app.openSettingsLiteConnectEnableModal( confirmCallback );
}
},
/**
* Form Entry Backups enable information modal.
*
* @since 1.7.4
*
* @param {Function} confirmCallback Confirm button action.
*/
openSettingsLiteConnectEnableModal: function( confirmCallback ) {
$.alert( {
title: false,
content: wp.template( 'wpforms-settings-lite-connect-modal-content' )(),
icon: false,
type: 'orange',
boxWidth: '550px',
theme: 'modern',
useBootstrap: false,
scrollToPreviousElement: false,
buttons: {
confirm: {
text: wpforms_education_lite_connect.enable_modal.confirm,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
action: function() {
if ( typeof confirmCallback === 'function' ) {
confirmCallback();
}
// Maybe close Challenge popup.
if ( window.WPFormsChallenge ) {
var completeChallenge = WPFormsChallenge.embed && WPFormsChallenge.embed.completeChallenge;
}
if ( typeof completeChallenge === 'function' ) {
completeChallenge();
}
},
},
cancel: {
text: wpforms_education_lite_connect.enable_modal.cancel,
action: function() {
$( '.wpforms-challenge-popup-container' ).removeClass( 'wpforms-invisible' );
},
},
},
onOpenBefore: function() {
$( 'body' ).addClass( 'wpforms-setting-lite-connect-modal' );
$( '.wpforms-challenge-popup-container' ).addClass( 'wpforms-invisible' );
},
onDestroy: function() {
$( 'body' ).removeClass( 'wpforms-setting-lite-connect-modal' );
},
} );
},
/**
* Form Entry Backups disable information modal.
*
* @since 1.7.4
*
* @param {Function} confirmCallback Confirm button action.
*/
openSettingsLiteConnectDisableModal: function( confirmCallback ) {
$.alert( {
title: wpforms_education_lite_connect.disable_modal.title,
content: wpforms_education_lite_connect.disable_modal.content,
icon: 'fa fa-exclamation-circle',
type: 'red',
boxWidth: '400px',
theme: 'modern',
useBootstrap: false,
animateFromElement: false,
scrollToPreviousElement: false,
buttons: {
cancel: {
text: wpforms_education_lite_connect.disable_modal.cancel,
keys: [ 'enter' ],
btnClass: 'btn-confirm',
},
confirm: {
text: wpforms_education_lite_connect.disable_modal.confirm,
action: function() {
if ( typeof confirmCallback === 'function' ) {
confirmCallback();
}
},
},
},
} );
},
/**
* Save Lite Connect Enabled setting AJAX post call.
*
* @since 1.7.4
*
* @param {boolean} isEnabled Lite Connect setting flag.
* @param {jQuery|undefined} $toggle Toggle control outer element.
* @param {Function} successCallback Success result callback.
*/
saveSettingAjaxPost: function( isEnabled, $toggle, successCallback ) {
$toggle = $toggle || $();
var $input = $toggle.find( 'input' );
// Perform AJAX request.
$.post(
wpforms_education_lite_connect.ajax_url,
{
action: 'wpforms_update_lite_connect_enabled_setting',
value: isEnabled ? 1 : 0,
nonce: wpforms_education_lite_connect.nonce,
}
).done( function( res ) {
if ( ! res.success ) {
$input.prop( 'checked', ! isEnabled );
app.updateResultModal( 'error' );
return;
}
app.updateResultModal( isEnabled ? 'enabled' : 'disabled' );
if ( typeof successCallback === 'function' ) {
successCallback();
}
} ).fail( function( xhr, textStatus, e ) {
$input.prop( 'checked', ! isEnabled );
app.updateResultModal( 'error' );
} ).always( function( xhr, textStatus, e ) {
$input.prop( 'disabled', false );
} );
},
/**
* Lite Connect toggle `change` event handler with "auto save" feature.
*
* @since 1.7.4
*/
autoSaveToggleChange: function() {
$( document ).on(
'change',
'.wpforms-toggle-control.wpforms-setting-lite-connect-auto-save-toggle input',
function() {
var $input = $( this ),
$toggle = $input.closest( '.wpforms-toggle-control' ),
isEnabled = $input.is( ':checked' );
app.saveSettingAjaxPost( isEnabled, $toggle, function() {
app.switchSettingView( isEnabled, $toggle );
} );
}
);
},
/**
* After updating setting via AJAX we should hide toggle container and show info container.
*
* @since 1.7.4
*
* @param {boolean} isEnabled Toggle state.
* @param {jQuery} $toggle Toggle control.
*/
switchSettingView: function( isEnabled, $toggle ) {
var $wrapper = $toggle.closest( '.wpforms-education-lite-connect-wrapper' ),
$setting = $wrapper.find( '.wpforms-education-lite-connect-setting' ),
$enabledInfo = $wrapper.find( '.wpforms-education-lite-connect-enabled-info' );
$setting.toggleClass( 'wpforms-hidden', isEnabled );
$enabledInfo.toggleClass( 'wpforms-hidden', ! isEnabled );
},
/**
* Update result message modal.
*
* @since 1.7.4
*
* @param {string} msg Message slug.
*/
updateResultModal: function( msg ) {
if ( ! wpforms_education_lite_connect.update_result[ msg ] ) {
return;
}
$.alert( {
title: wpforms_education_lite_connect.update_result[ msg + '_title' ],
content: wpforms_education_lite_connect.update_result[ msg ],
icon: 'fa fa-check-circle',
type: msg === 'error' ? 'red' : 'green',
theme: 'modern',
boxWidth: '400px',
useBootstrap: false,
animation: 'scale',
closeAnimation: 'scale',
animateFromElement: false,
scrollToPreviousElement: false,
buttons: {
confirm: {
text : wpforms_education_lite_connect.update_result.close,
btnClass: 'btn-confirm',
keys : [ 'enter' ],
},
},
} );
},
/**
* Reveal top bar in the Form Builder.
*
* @since 1.7.4
*/
maybeRevealBuilderTopBar: function() {
// Skip it is not Form Builder or Entry Backups is already enabled or top bar is dismissed.
if (
! window.wpforms_builder ||
wpforms_education_lite_connect.is_enabled === '1' ||
$( '#wpforms-builder-lite-connect-top-bar' ).length === 0
) {
return;
}
setTimeout( function() {
app.toggleBuilderTopBar( true );
}, 3000 );
},
/**
* Toggle top bar in the Form Builder.
*
* @since 1.7.4
*
* @param {boolean} open True for open, false for close.
*/
toggleBuilderTopBar: function( open ) {
var cssVar = '--wpforms-admin-bar-height',
root = document.documentElement,
adminBarHeight = parseInt( getComputedStyle( root ).getPropertyValue( cssVar ), 10 ),
topBarHeight = 45;
adminBarHeight += open ? topBarHeight : -topBarHeight;
root.setAttribute(
'style',
cssVar + ': ' + ( adminBarHeight ) + 'px!important;'
);
},
/**
* Dismiss top bar in the Form Builder.
*
* @since 1.7.4
*/
dismissBuilderTopBarClick: function() {
$( document ).on(
'click',
'#wpforms-builder-lite-connect-top-bar .wpforms-dismiss-button',
function() {
app.toggleBuilderTopBar( false );
}
);
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPFormsEducation.liteConnect.init();

File diff suppressed because one or more lines are too long