first commit

This commit is contained in:
Roman Pyrih
2024-12-19 15:27:13 +01:00
commit d6241cfa7a
21694 changed files with 6902106 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

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

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: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 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,353 @@
/* global wpforms_dashboard_widget, moment, Chart, ajaxurl */
/**
* WPForms Dashboard Widget function.
*
* @since 1.5.0
*/
const WPFormsDashboardWidget = window.WPFormsDashboardWidget || ( function( document, window, $ ) {
/**
* Elements reference.
*
* @since 1.5.0
*
* @type {Object}
*/
const el = {
$widget: $( '#wpforms_reports_widget_lite' ),
$settingsBtn: $( '#wpforms-dash-widget-settings-button' ),
$canvas: $( '#wpforms-dash-widget-chart' ),
$chartDismissButton: $( '.wpforms-dash-widget-dismiss-chart-upgrade' ),
$dismissButton: $( '.wpforms-dash-widget-dismiss-icon' ),
$recommendedBlockDismissButton: $( '#wpforms-dash-widget-dismiss-recommended-plugin-block' ),
};
/**
* Check if the site is RTL.
*
* @since 1.9.1
*/
const isRTL = $( 'body' ).hasClass( 'rtl' );
/**
* Chart.js functions and properties.
*
* @since 1.5.0
*
* @type {Object}
*/
// eslint-disable-next-line no-var
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: {
maintainAspectRatio: false,
scales : {
x: {
type : 'timeseries',
reverse: isRTL,
ticks : {
source : 'labels',
padding : 10,
minRotation: 25,
maxRotation: 25,
callback( value, index, values ) {
// Distribute the ticks equally starting from a right side of xAxis.
const gap = Math.floor( values.length / 7 );
if ( gap < 1 ) {
return moment( value ).format( 'MMM D' );
}
if ( ( values.length - index - 1 ) % gap === 0 ) {
return moment( value ).format( 'MMM D' );
}
},
},
},
y: {
beginAtZero : true,
ticks: {
maxTicksLimit: 6,
padding : 20,
callback( value ) {
// Make sure the tick value has no decimals.
if ( Math.floor( value ) === value ) {
return value;
}
},
},
},
},
elements: {
line: {
tension: 0,
fill: true,
},
},
animation: false,
plugins: {
legend: {
display: false,
},
tooltip: {
displayColors: false,
rtl: isRTL,
},
},
},
},
/**
* Init Chart.js.
*
* @since 1.5.0
*/
init() {
if ( ! el.$canvas.length ) {
return;
}
const ctx = el.$canvas[ 0 ].getContext( '2d' );
chart.instance = new Chart( ctx, chart.settings );
chart.updateUI();
},
/**
* Update Chart.js canvas.
*
* @since 1.5.0
*/
updateUI() {
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() {
const end = moment().endOf( 'day' );
let date;
const minY = 5;
const maxY = 20;
let 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( {
x: date,
y: Math.floor( Math.random() * ( maxY - minY + 1 ) ) + minY,
} );
}
},
};
/**
* Public functions and properties.
*
* @since 1.5.0
*
* @type {Object}
*/
// eslint-disable-next-line no-var
var app = {
/**
* Start the engine.
*
* @since 1.5.0
*/
init() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.5.0
*/
ready() {
chart.init();
app.events();
app.graphSettings();
},
/**
* Graph settings related events.
*
* @since 1.7.4
*/
graphSettings() {
el.$settingsBtn.on( 'click', function() {
$( this ).siblings( '.wpforms-dash-widget-settings-menu' ).toggle();
} );
},
/**
* Register JS events.
*
* @since 1.5.0
*/
events() {
app.formsListEvents();
app.handleChartClose();
app.handleRecommendedPluginsClose();
app.handleWidgetBlockClose();
},
/**
* Register forms list area JS events.
*
* @since 1.5.0
*/
formsListEvents() {
el.$widget.on( 'click', '#wpforms-dash-widget-forms-more', function() {
app.toggleCompleteFormsList();
} );
},
/**
* Handle chart close.
*
* @since 1.7.4
*/
handleChartClose() {
el.$chartDismissButton.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
* @since 1.8.7 Deprecated.
*
* @deprecated Use WPFormsDashboardWidget.handleWidgetBlockClose() instead.
*/
handleRecommendedPluginsClose() {
// eslint-disable-next-line no-console
console.warn( 'WARNING! WPFormsDashboardWidget.handleRecommendedPluginsClose() has been deprecated, please use WPFormsDashboardWidget.handleWidgetBlockClose() instead.' );
el.$recommendedBlockDismissButton.on( 'click', function() {
app.dismissRecommendedBlock();
} );
},
/**
* Handle widget block close.
*
* @since 1.8.7
*/
handleWidgetBlockClose() {
el.$dismissButton.on( 'click', function() {
app.dismissWidgetBlock( $( this ) );
} );
},
/**
* 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( meta, value ) {
const data = {
_wpnonce: wpforms_dashboard_widget.nonce,
action : 'wpforms_' + wpforms_dashboard_widget.slug + '_save_widget_meta',
meta,
value,
};
$.post( ajaxurl, data );
},
/**
* Toggle forms list hidden entries.
*
* @since 1.5.0.4
*/
toggleCompleteFormsList() {
$( '#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 widget block.
*
* @since 1.8.7
*
* @param {Object} $clickedButton jQuery object of the clicked button.
*/
dismissWidgetBlock( $clickedButton ) {
$clickedButton.closest( '.wpforms-dash-widget-block' ).remove();
app.saveWidgetMeta( $clickedButton.data( 'field' ), 1 );
},
/**
* Dismiss recommended plugin block.
*
* @since 1.7.4
* @since 1.8.7 Deprecated.
*
* @deprecated Use WPFormsDashboardWidget.dismissWidgetBlock() instead.
*/
dismissRecommendedBlock() {
// eslint-disable-next-line no-console
console.warn( 'WARNING! WPFormsDashboardWidget.dismissRecommendedBlock() has been deprecated, please use WPFormsDashboardWidget.dismissWidgetBlock() instead.' );
$( '.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 @@
const WPFormsDashboardWidget=window.WPFormsDashboardWidget||function(t){const s={$widget:t("#wpforms_reports_widget_lite"),$settingsBtn:t("#wpforms-dash-widget-settings-button"),$canvas:t("#wpforms-dash-widget-chart"),$chartDismissButton:t(".wpforms-dash-widget-dismiss-chart-upgrade"),$dismissButton:t(".wpforms-dash-widget-dismiss-icon"),$recommendedBlockDismissButton:t("#wpforms-dash-widget-dismiss-recommended-plugin-block")};var e=t("body").hasClass("rtl"),a={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:{maintainAspectRatio:!1,scales:{x:{type:"timeseries",reverse:e,ticks:{source:"labels",padding:10,minRotation:25,maxRotation:25,callback(e,s,t){var a=Math.floor(t.length/7);return a<1||(t.length-s-1)%a==0?moment(e).format("MMM D"):void 0}}},y:{beginAtZero:!0,ticks:{maxTicksLimit:6,padding:20,callback(e){if(Math.floor(e)===e)return e}}}},elements:{line:{tension:0,fill:!0}},animation:!1,plugins:{legend:{display:!1},tooltip:{displayColors:!1,rtl:e}}}},init(){var e;s.$canvas.length&&(e=s.$canvas[0].getContext("2d"),a.instance=new Chart(e,a.settings),a.updateUI())},updateUI(){a.updateWithDummyData(),a.instance.data.labels=a.settings.data.labels,a.instance.data.datasets[0].data=a.settings.data.datasets[0].data,a.instance.update()},updateWithDummyData(){var e,s=moment().endOf("day");let t;for(t=1;t<=7;t++)e=s.clone().subtract(t,"days"),a.settings.data.labels.push(e),a.settings.data.datasets[0].data.push({x:e,y:Math.floor(16*Math.random())+5})}},o={init(){t(o.ready)},ready(){a.init(),o.events(),o.graphSettings()},graphSettings(){s.$settingsBtn.on("click",function(){t(this).siblings(".wpforms-dash-widget-settings-menu").toggle()})},events(){o.formsListEvents(),o.handleChartClose(),o.handleRecommendedPluginsClose(),o.handleWidgetBlockClose()},formsListEvents(){s.$widget.on("click","#wpforms-dash-widget-forms-more",function(){o.toggleCompleteFormsList()})},handleChartClose(){s.$chartDismissButton.on("click",function(e){e.preventDefault(),o.saveWidgetMeta("hide_graph",1),t(".wpforms-dash-widget.wpforms-lite").addClass("wpforms-dash-widget-no-graph"),t(this).closest(".wpforms-dash-widget-chart-block-container").remove()})},handleRecommendedPluginsClose(){console.warn("WARNING! WPFormsDashboardWidget.handleRecommendedPluginsClose() has been deprecated, please use WPFormsDashboardWidget.handleWidgetBlockClose() instead."),s.$recommendedBlockDismissButton.on("click",function(){o.dismissRecommendedBlock()})},handleWidgetBlockClose(){s.$dismissButton.on("click",function(){o.dismissWidgetBlock(t(this))})},saveWidgetMeta(e,s){e={_wpnonce:wpforms_dashboard_widget.nonce,action:"wpforms_"+wpforms_dashboard_widget.slug+"_save_widget_meta",meta:e,value:s};t.post(ajaxurl,e)},toggleCompleteFormsList(){t("#wpforms-dash-widget-forms-list-table .wpforms-dash-widget-forms-list-hidden-el").toggle(),t("#wpforms-dash-widget-forms-more").html(function(e,s){return s===wpforms_dashboard_widget.show_less_html?wpforms_dashboard_widget.show_more_html:wpforms_dashboard_widget.show_less_html})},dismissWidgetBlock(e){e.closest(".wpforms-dash-widget-block").remove(),o.saveWidgetMeta(e.data("field"),1)},dismissRecommendedBlock(){console.warn("WARNING! WPFormsDashboardWidget.dismissRecommendedBlock() has been deprecated, please use WPFormsDashboardWidget.dismissWidgetBlock() instead."),t(".wpforms-dash-widget-recommended-plugin-block").remove(),o.saveWidgetMeta("hide_recommended_block",1)}};return o}((document,window,jQuery));WPFormsDashboardWidget.init();

View File

@@ -0,0 +1,176 @@
/* global wpforms_builder, wpforms_education */
/**
* WPForms Education core for Lite.
*
* @since 1.6.6
*/
// noinspection ES6ConvertVarToLetConst
/**
* @param wpforms_education.upgrade
* @param wpforms_education.upgrade.button
* @param wpforms_education.upgrade.doc
* @param wpforms_education.upgrade.message
* @param wpforms_education.upgrade.title
* @param wpforms_education.upgrade.title_plural
* @param wpforms_education.upgrade_bonus
*/
var WPFormsEducation = window.WPFormsEducation || {}; // eslint-disable-line no-var
WPFormsEducation.liteCore = window.WPFormsEducation.liteCore || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.6.6
*
* @type {Object}
*/
const app = {
/**
* Start the engine.
*
* @since 1.6.6
*/
init() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.6.6
*/
ready() {
app.events();
},
/**
* Register JS events.
*
* @since 1.6.6
*/
events() {
app.openModalButtonClick();
},
/**
* Registers click events that should open upgrade modal.
*
* @since 1.6.6
*/
openModalButtonClick() {
$( 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( 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 a 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() {
if ( isVideoModal ) {
this.$el.addClass( 'has-video' );
}
const videoHtml = isVideoModal ? '<iframe src="' + video + '" class="feature-video" 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: () => {
window.open( WPFormsEducation.core.getUpgradeURL( utmContent, type ), '_blank' );
WPFormsEducation.core.upgradeModalThankYou( type );
},
},
},
} );
$( window ).on( 'resize', function() {
modalWidth = WPFormsEducation.core.getUpgradeModalWidth( isVideoModal );
if ( modal.isOpen() ) {
modal.setBoxWidth( modalWidth );
}
} );
},
};
// Provide access to public functions/properties.
return app;
}( document, window, jQuery ) );
// Initialize.
WPFormsEducation.liteCore.init();

View File

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

View File

@@ -0,0 +1,552 @@
/* global wpforms_education_lite_connect, WPFormsChallenge */
/**
* WPForms Education for Lite.
*
* Lite Connect feature.
*
* @since 1.7.4
*/
// eslint-disable-next-line no-var
var WPFormsEducation = window.WPFormsEducation || {};
WPFormsEducation.liteConnect = window.WPFormsEducation.liteConnect || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.7.4
*
* @type {Object}
*/
const app = {
/**
* Start the engine.
*
* @since 1.7.4
*/
init() {
$( 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() {
},
/**
* Page load.
*
* @since 1.7.4
*/
load() {
app.events();
app.initLiteConnectToggle();
app.maybeRevealBuilderTopBar();
},
/**
* Register JS events.
*
* @since 1.7.4
*/
events() {
app.enableLiteConnectToggleClick();
app.enableLiteConnectButtonClick();
app.dismissBuilderTopBarClick();
app.autoSaveToggleChange();
app.enableLiteConnectAIButtonClick();
},
/**
* Init Lite Connect toggle.
*
* @since 1.7.5
*/
initLiteConnectToggle() {
$( '.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() {
$( document ).on(
'mousedown touchstart',
'#wpforms-setting-row-lite-connect-enabled label, .wpforms-setting-lite-connect-auto-save-toggle label',
function( event ) {
const isTouchDevice = 'ontouchstart' in document.documentElement;
if ( ! isTouchDevice ) {
event.preventDefault();
}
const wrapper = $( this ).closest( '#wpforms-setting-row-lite-connect-enabled, .wpforms-setting-lite-connect-auto-save-toggle' );
const $input = wrapper.find( '#wpforms-setting-lite-connect-enabled' );
if ( $input.prop( 'disabled' ) ) {
return;
}
const isEnabled = $input.is( ':checked' );
app.openSettingsLiteConnectModal( isEnabled, function() {
$input
.trigger( 'click' )
.prop( 'disabled', true );
} );
}
);
},
/**
* Enable Lite Connect button click handler.
*
* @since 1.7.4
*/
enableLiteConnectButtonClick() {
$( document ).on(
'click',
'.wpforms-dyk-lite-connect .button-primary',
function( event ) {
event.preventDefault();
const $button = $( this );
if ( $button.hasClass( 'wpforms-is-enabled' ) ) {
window.open( $button.attr( 'href' ) );
return;
}
app.openSettingsLiteConnectModal(
false,
app.enableLiteConnectButtonModalConfirm
);
}
);
},
/**
* Enable Lite Connect button click handler.
*
* @since 1.9.1
*/
enableLiteConnectAIButtonClick() {
$( document ).on(
'click',
'.enable-lite-connect-modal',
app.handleLiteConnectModalClick,
);
},
/**
* Finalize the Lite Connect keys setup.
*
* @since 1.9.1
*
* @return {jQuery} AJAX request deferred object.
*/
finalizeLiteConnectSetup() {
return $.get( wpforms_education_lite_connect.ajax_url, {
action: 'wpforms_lite_connect_finalize',
nonce: wpforms_education_lite_connect.nonce,
} );
},
/**
* Handle Lite Connect modal click.
*
* @since 1.9.1
*
* @param {Event} event Event object.
*/
handleLiteConnectModalClick( event ) {
event.preventDefault();
app.openAILiteConnectEnableModal(
function() {
app.saveSettingAjaxPost( true, $(), function() {
app.switchSettingView( true, $( '#wpforms-builder-lite-connect-top-bar .wpforms-toggle-control' ) );
// Finalize the Lite Connect keys setup.
app.finalizeLiteConnectSetup()
.done( () => {
app.removeLiteConnectModalOnAIButtons();
} );
} );
}
);
},
/**
* Remove Lite Connect modal on AI buttons.
*
* @since 1.9.1
*/
removeLiteConnectModalOnAIButtons() {
$( '.enable-lite-connect-modal.wpforms-ai-modal-disabled' ).each( function() {
$( this ).removeClass( 'enable-lite-connect-modal wpforms-ai-modal-disabled' );
} );
},
/**
* Enable Lite Connect button modal confirm Callback.
*
* @since 1.7.4
*/
enableLiteConnectButtonModalConfirm() {
const $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( 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( confirmCallback ) {
const $args = {
content: wp.template( 'wpforms-settings-lite-connect-modal-content' )(),
confirm: {
text: wpforms_education_lite_connect.enable_modal.confirm,
callback: confirmCallback,
},
};
app.enableModal( $args );
},
/**
* AI features enable information modal.
*
* @since 1.9.1
*
* @param {Function} confirmCallback Confirm button action.
*/
openAILiteConnectEnableModal( confirmCallback ) {
const $args = {
content: wp.template( 'wpforms-builder-ai-lite-connect-modal-content' )(),
confirm: {
text: wpforms_education_lite_connect.enable_ai.confirm,
callback: confirmCallback,
},
theme: 'modern, ai-modal',
};
// eslint-disable-next-line camelcase
wpforms_education_lite_connect.update_result.enabled_title = wpforms_education_lite_connect.enable_ai.enabled_title;
app.enableModal( $args );
},
/**
* Render Enable modal.
*
* @param {Object} $args Modal arguments.
*/
enableModal( $args ) {
$.alert( {
title: false,
content: $args.content,
icon: false,
type: 'orange',
boxWidth: 550,
theme: $args.theme || 'modern',
useBootstrap: false,
scrollToPreviousElement: false,
buttons: {
confirm: {
text: $args.confirm.text,
btnClass: 'btn-confirm',
keys: [ 'enter' ],
action() {
if ( typeof $args.confirm.callback === 'function' ) {
$args.confirm.callback();
}
// Maybe close Challenge popup.
if ( window.WPFormsChallenge ) {
// eslint-disable-next-line no-var
var completeChallenge = WPFormsChallenge.embed && WPFormsChallenge.embed.completeChallenge;
}
if ( typeof completeChallenge === 'function' ) {
completeChallenge();
}
},
},
cancel: {
text: wpforms_education_lite_connect.enable_modal.cancel,
action() {
$( '.wpforms-challenge-popup-container' ).removeClass( 'wpforms-invisible' );
},
},
},
onOpenBefore() {
$( 'body' ).addClass( 'wpforms-setting-lite-connect-modal' );
$( '.wpforms-challenge-popup-container' ).addClass( 'wpforms-invisible' );
},
onDestroy() {
$( 'body' ).removeClass( 'wpforms-setting-lite-connect-modal' );
},
} );
},
/**
* Form Entry Backups disable information modal.
*
* @since 1.7.4
*
* @param {Function} confirmCallback Confirm button action.
*/
openSettingsLiteConnectDisableModal( 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() {
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( isEnabled, $toggle, successCallback ) {
$toggle = $toggle || $();
const $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() {
$input.prop( 'checked', ! isEnabled );
app.updateResultModal( 'error' );
} ).always( function() {
$input.prop( 'disabled', false );
} );
},
/**
* Lite Connect toggle `change` event handler with "auto save" feature.
*
* @since 1.7.4
*/
autoSaveToggleChange() {
$( document ).on(
'change',
'.wpforms-toggle-control.wpforms-setting-lite-connect-auto-save-toggle input',
function() {
const $input = $( this ),
$toggle = $input.closest( '.wpforms-toggle-control' ),
isEnabled = $input.is( ':checked' );
app.saveSettingAjaxPost( isEnabled, $toggle, function() {
app.switchSettingView( isEnabled, $toggle );
app.removeLiteConnectModalOnAIButtons();
// Finalize the Lite Connect keys setup.
app.finalizeLiteConnectSetup();
} );
}
);
},
/**
* 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( isEnabled, $toggle ) {
const $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( 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() {
// 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( open ) {
const cssVar = '--wpforms-admin-bar-height';
const root = document.documentElement;
const topBarHeight = 45;
let adminBarHeight = parseInt( getComputedStyle( root ).getPropertyValue( cssVar ), 10 );
adminBarHeight += open ? topBarHeight : -topBarHeight;
root.setAttribute(
'style',
cssVar + ': ' + ( adminBarHeight ) + 'px!important;'
);
},
/**
* Dismiss top bar in the Form Builder.
*
* @since 1.7.4
*/
dismissBuilderTopBarClick() {
$( 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

View File

@@ -0,0 +1,120 @@
/* global wpCookies */
/**
* Entries list page.
*/
const WPFormsEntryList = window.WPFormsEntryList || ( function( document, window, $ ) {
/**
* Public functions and properties.
*
* @since 1.8.9
*
* @type {Object}
*/
const app = {
/**
* Initialize the engine.
*
* @since 1.8.9
*/
init() {
$( app.ready );
},
/**
* Ready.
*
* @since 1.8.9
*/
ready() {
app.events();
},
/**
* Events.
*
* @since 1.8.9
*/
events() {
// Show sample data for entries when the Explore Entries is clicked.
$( '#wpforms-entries-explore' ).on( 'click', app.showEntries );
// Hide sample data for entries when the Hide Sample Data is clicked.
$( '#wpforms-hide-sample-data' ).on( 'click', app.hideEntries );
// Toggle the action dropdown.
$( '#wpforms-list-table-ext-edit-columns-cog' ).on( 'click', app.toggleActionDropdown );
$( '#wpcontent' ).on( 'click', app.hideActionDropdown );
},
/**
* Show entries.
*
* @since 1.8.9
*
* @param {Object} e Event object.
*/
showEntries( e ) {
e.preventDefault();
$( '.entries-modal' ).fadeOut( 500, function() {
$( '#wpforms-sample-entry-main-notice' ).slideDown( 250 );
$( '#wpforms-entries-list' ).addClass( 'wpforms-entires-sample-view' );
} );
wpCookies.set( 'wpforms_sample_entries', 'true', 2592000 ); // 1 month
},
/**
* Hide entries.
*
* @since 1.8.9
*
* @param {Object} e Event object.
*/
hideEntries( e ) {
e.preventDefault();
// Bypass animation as this is causing fade in/out issues.
$( '#wpforms-sample-entry-main-notice' ).fadeOut( 250, function() {
$( '#wpforms-entries-list' ).removeClass( 'wpforms-entires-sample-view' );
$( '.wpforms-sample-entry-notice' ).removeClass( 'wpf-no-animate' );
$( '.entries-modal' ).fadeIn( 500 );
} );
wpCookies.remove( 'wpforms_sample_entries' );
},
/**
* Toggle the action dropdown.
*
* @since 1.8.9
*
* @param {Object} e Event object.
*/
toggleActionDropdown( e ) {
e.preventDefault();
e.stopPropagation();
$( this ).parent().toggleClass( 'is_active' );
},
/**
* Hide the action dropdown.
*
* @since 1.8.9
*/
hideActionDropdown() {
const actionColumn = $( '#wpforms-list-table-ext-edit-columns-cog' ).parent();
if ( actionColumn.hasClass( 'is_active' ) ) {
actionColumn.removeClass( 'is_active' );
}
},
};
return app;
}( document, window, jQuery ) );
// Initialize the engine.
WPFormsEntryList.init();

View File

@@ -0,0 +1 @@
const WPFormsEntryList=window.WPFormsEntryList||function(t){const e={init(){t(e.ready)},ready(){e.events()},events(){t("#wpforms-entries-explore").on("click",e.showEntries),t("#wpforms-hide-sample-data").on("click",e.hideEntries),t("#wpforms-list-table-ext-edit-columns-cog").on("click",e.toggleActionDropdown),t("#wpcontent").on("click",e.hideActionDropdown)},showEntries(e){e.preventDefault(),t(".entries-modal").fadeOut(500,function(){t("#wpforms-sample-entry-main-notice").slideDown(250),t("#wpforms-entries-list").addClass("wpforms-entires-sample-view")}),wpCookies.set("wpforms_sample_entries","true",2592e3)},hideEntries(e){e.preventDefault(),t("#wpforms-sample-entry-main-notice").fadeOut(250,function(){t("#wpforms-entries-list").removeClass("wpforms-entires-sample-view"),t(".wpforms-sample-entry-notice").removeClass("wpf-no-animate"),t(".entries-modal").fadeIn(500)}),wpCookies.remove("wpforms_sample_entries")},toggleActionDropdown(e){e.preventDefault(),e.stopPropagation(),t(this).parent().toggleClass("is_active")},hideActionDropdown(){var e=t("#wpforms-list-table-ext-edit-columns-cog").parent();e.hasClass("is_active")&&e.removeClass("is_active")}};return e}((document,window,jQuery));WPFormsEntryList.init();

View File

@@ -0,0 +1,105 @@
/**
* View single entry page.
*
* @since 1.8.9
*/
const WPFormsViewEntry = window.WPFormsViewEntry || ( function( document, window, $ ) {
/**
* Elements holder.
*
* @since 1.8.9
*
* @type {Object}
*/
let el = {};
/**
* Public functions and properties.
*
* @since 1.8.9
*
* @type {Object}
*/
const app = {
/**
* Initialize the engine.
*
* @since 1.8.9
*/
init() {
$( app.ready );
},
/**
* Document ready.
*
* @since 1.8.9
*/
ready() {
app.setup();
app.events();
},
/**
* Setup. Prepare some variables.
*
* @since 1.8.9
*/
setup() {
// Cache DOM elements.
el = {
menuClass: '.wpforms-entries-settings-menu',
};
},
/**
* Events.
*
* @since 1.8.9
*/
events() {
$( '#wpforms-entries-settings-button' ).on( 'click', app.menuToggle );
$( '#wpcontent' ).on( 'click', app.menuHide );
},
/**
* Handler for the menu toggle behavior.
*
* @since 1.8.9
*
* @param {Object} event Event object.
*/
menuToggle( event ) {
event.preventDefault();
event.stopPropagation();
// Toggle the visibility of the matched element.
$( el.menuClass ).toggle( 0, function() {
const $menu = $( this );
// When the menu is open, aria-expended="true".
$menu.attr( 'aria-expanded', $menu.is( ':visible' ) );
} );
},
/**
* Handler for hiding the menu when a click is outside of it.
*
* @since 1.8.9
*
* @param {Object} event Event object.
*/
menuHide( event ) {
// Check if the clicked element is not the menu container or a child of it.
if ( ! $( event.target ).closest( `${ el.menuClass }:visible` ).length ) {
$( el.menuClass ).attr( 'aria-expanded', 'false' ).hide();
}
},
};
return app;
}( document, window, jQuery ) );
// Initialize the engine.
WPFormsViewEntry.init();

View File

@@ -0,0 +1 @@
const WPFormsViewEntry=window.WPFormsViewEntry||function(n){let t={};const e={init(){n(e.ready)},ready(){e.setup(),e.events()},setup(){t={menuClass:".wpforms-entries-settings-menu"}},events(){n("#wpforms-entries-settings-button").on("click",e.menuToggle),n("#wpcontent").on("click",e.menuHide)},menuToggle(e){e.preventDefault(),e.stopPropagation(),n(t.menuClass).toggle(0,function(){var e=n(this);e.attr("aria-expanded",e.is(":visible"))})},menuHide(e){n(e.target).closest(t.menuClass+":visible").length||n(t.menuClass).attr("aria-expanded","false").hide()}};return e}((document,window,jQuery));WPFormsViewEntry.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,121 @@
/* jshint es3: false, esversion: 6 */
import education from '../../../../js/integrations/gutenberg/modules/education.js';
import common from '../../../../js/integrations/gutenberg/modules/common.js';
import themesPanel from '../../../../js/integrations/gutenberg/modules/themes-panel.js';
import containerStyles from '../../../../js/integrations/gutenberg/modules/container-styles.js';
import backgroundStyles from '../../../../js/integrations/gutenberg/modules/background-styles.js';
import buttonStyles from '../../../../js/integrations/gutenberg/modules/button-styles.js';
import advancedSettings from '../../../../js/integrations/gutenberg/modules/advanced-settings.js';
import fieldStyles from '../../../../js/integrations/gutenberg/modules/field-styles.js';
/**
* Gutenberg editor block for Lite.
*
* @since 1.8.8
*/
const WPForms = window.WPForms || {};
WPForms.FormSelector = WPForms.FormSelector || ( function() {
/**
* Public functions and properties.
*
* @since 1.8.8
*
* @type {Object}
*/
const app = {
/**
* Common module object.
*
* @since 1.8.8
*
* @type {Object}
*/
common: {},
/**
* Panel modules objects.
*
* @since 1.8.8
*
* @type {Object}
*/
panels: {},
/**
* Start the engine.
*
* @since 1.8.8
*/
init() {
app.education = education;
app.common = common;
app.panels.themes = themesPanel;
app.panels.container = containerStyles;
app.panels.background = backgroundStyles;
app.panels.button = buttonStyles;
app.panels.advanced = advancedSettings;
app.panels.field = fieldStyles;
const blockOptions = {
panels: app.panels,
getThemesPanel: app.panels.themes.getThemesPanel,
getFieldStyles: app.panels.field.getFieldStyles,
getContainerStyles: app.panels.container.getContainerStyles,
getBackgroundStyles: app.panels.background.getBackgroundStyles,
getButtonStyles: app.panels.button.getButtonStyles,
getCommonAttributes: app.getCommonAttributes,
setStylesHandlers: app.getStyleHandlers(),
education: app.education,
};
// Initialize Advanced Settings module.
app.panels.advanced.init( app.common );
// Initialize block.
app.common.init( blockOptions );
},
/**
* Get style handlers.
*
* @since 1.8.8
*
* @return {Object} Style handlers.
*/
getCommonAttributes() {
return {
...app.panels.field.getBlockAttributes(),
...app.panels.container.getBlockAttributes(),
...app.panels.background.getBlockAttributes(),
...app.panels.button.getBlockAttributes(),
};
},
/**
* Get style handlers.
*
* @since 1.8.8
*
* @return {Object} Style handlers.
*/
getStyleHandlers() {
return {
'background-image': app.panels.background.setContainerBackgroundImage,
'background-position': app.panels.background.setContainerBackgroundPosition,
'background-repeat': app.panels.background.setContainerBackgroundRepeat,
'background-width': app.panels.background.setContainerBackgroundWidth,
'background-height': app.panels.background.setContainerBackgroundHeight,
'background-color': app.panels.background.setBackgroundColor,
'background-url': app.panels.background.setBackgroundUrl,
};
},
};
// Provide access to public functions/properties.
return app;
}() );
// Initialize.
WPForms.FormSelector.init();

View File

@@ -0,0 +1,452 @@
{
"classic": {
"name": "Classic",
"settings": {
"fieldSize": "medium",
"fieldBorderRadius": "0px",
"fieldBorderStyle": "solid",
"fieldBorderSize": "1px",
"fieldBackgroundColor": "#ffffff",
"fieldBorderColor": "#cccccc",
"fieldTextColor": "#444444",
"fieldMenuColor": "#ffffff",
"labelSize": "small",
"labelColor": "#262626",
"labelSublabelColor": "#7f7f7f",
"labelErrorColor": "#ff0000",
"buttonSize": "medium",
"buttonBorderStyle": "solid",
"buttonBorderSize": "1px",
"buttonBorderRadius": "0px",
"buttonBorderColor": "#cccccc",
"buttonBackgroundColor": "#dddddd",
"buttonTextColor": "#666666",
"pageBreakColor": "#dddddd"
}
},
"default": {
"name": "Default",
"settings": {
"fieldSize": "medium",
"fieldBorderRadius": "3px",
"fieldBorderStyle": "solid",
"fieldBorderSize": "1px",
"fieldBackgroundColor": "#ffffff",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )",
"fieldTextColor": "rgba( 0, 0, 0, 0.7 )",
"fieldMenuColor": "#ffffff",
"labelSize": "medium",
"labelColor": "rgba( 0, 0, 0, 0.85 )",
"labelSublabelColor": "rgba( 0, 0, 0, 0.55 )",
"labelErrorColor": "#d63637",
"buttonSize": "medium",
"buttonBorderStyle": "none",
"buttonBorderSize": "1px",
"buttonBorderRadius": "3px",
"buttonBorderColor": "#066aab",
"buttonBackgroundColor": "#066aab",
"buttonTextColor": "#ffffff",
"pageBreakColor": "#066aab"
}
},
"curelean": {
"name": "Curelean",
"settings": {
"buttonBackgroundColor": "#0090bf",
"buttonTextColor": "#e5f4f9",
"labelColor": "#262c2e",
"labelSublabelColor": "#4c585d",
"fieldBorderColor": "#afb6b9"
}
},
"ocean": {
"name": "Ocean",
"settings": {
"buttonBackgroundColor": "#348180",
"buttonTextColor": "#ebf2f2",
"labelColor": "#181c1c",
"labelSublabelColor": "#636c6c",
"fieldBorderColor": "#9ea3a3"
}
},
"fern": {
"name": "Fern",
"settings": {
"buttonBackgroundColor": "#58bb5d",
"buttonTextColor": "#eef8ef",
"labelColor": "#383c39",
"labelSublabelColor": "#707971",
"fieldBorderColor": "#c6cbc6"
}
},
"lilac": {
"name": "Lilac",
"settings": {
"buttonBackgroundColor": "#9864c0",
"buttonTextColor": "#f5eff9",
"labelColor": "#333135",
"labelSublabelColor": "#807b84",
"fieldBorderColor": "#bfbdc1"
}
},
"taffy": {
"name": "Taffy",
"settings": {
"buttonBackgroundColor": "#f785c0",
"buttonTextColor": "#fef3f9",
"labelColor": "#484446",
"labelSublabelColor": "#b5aab0",
"fieldBorderColor": "#dad4d7"
}
},
"tangerine": {
"name": "Tangerine",
"settings": {
"buttonBackgroundColor": "#e27730",
"buttonTextColor": "#fcf1ea",
"labelColor": "#3d3835",
"labelSublabelColor": "#79716b",
"fieldBorderColor": "#cbc6c2"
}
},
"slate": {
"name": "Slate",
"settings": {
"buttonBackgroundColor": "#67687d",
"buttonTextColor": "#f0f0f2",
"labelColor": "#3a3a41",
"labelSublabelColor": "#686974",
"fieldBorderColor": "#c3c3c7"
}
},
"iron": {
"name": "Iron",
"settings": {
"buttonBackgroundColor": "#2e2c2f",
"buttonTextColor": "#eaeaea",
"labelColor": "#2e2c2e",
"labelSublabelColor": "#969596",
"fieldBorderColor": "#cbcacb"
}
},
"aero": {
"name": "Aero",
"settings": {
"buttonBackgroundColor": "#3961FF",
"buttonTextColor": "#FFFFFF",
"labelColor": "#000000",
"labelSublabelColor": "#6A6A6A",
"fieldBorderColor": "#D2D2D2"
}
},
"blossom": {
"name": "Blossom",
"settings": {
"buttonBackgroundColor": "#d75e42",
"buttonTextColor": "#ffffff",
"labelColor": "#32261b",
"labelSublabelColor": "#634d36",
"fieldBorderColor": "rgba( 51, 26, 0, 0.15 )"
}
},
"bokeh": {
"name": "Bokeh",
"settings": {
"buttonBackgroundColor": "#272633",
"buttonTextColor": "#FFFFFF",
"labelColor": "#272633",
"labelSublabelColor": "#625E53",
"fieldBorderColor": "#FCF5F3"
}
},
"concrete": {
"name": "Concrete",
"settings": {
"buttonBackgroundColor": "#f04970",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "rgba(255, 255, 255, 0.50)",
"fieldBorderColor": "rgba(255, 255, 255, 0.25)"
}
},
"cottoncandy": {
"name": "Cotton Candy",
"settings": {
"buttonBackgroundColor": "#952653",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "rgba(255, 255, 255, 0.75)",
"fieldBorderColor": "rgba(255, 255, 255, 0.5)"
}
},
"craft": {
"name": "Craft",
"settings": {
"buttonBackgroundColor": "rgba(0 ,0 ,0 ,0)",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "#e0c5c5",
"fieldBorderColor": "rgba(255, 255, 255, 0.50)"
}
},
"elegance": {
"name": "Elegance",
"settings": {
"buttonBackgroundColor": "#7d7d7d",
"buttonTextColor": "#ffffff",
"labelColor": "#7d7d7d",
"labelSublabelColor": "#7d7d7d",
"fieldBorderColor": "#e6e6e4"
}
},
"feathered": {
"name": "Feathered",
"settings": {
"buttonBackgroundColor": "#46443a",
"buttonTextColor": "#ffffff",
"labelColor": "#46443a",
"labelSublabelColor": "#625e53",
"fieldBorderColor": "rgba(0, 0, 0, 0.15)"
}
},
"flynn": {
"name": "Flynn",
"settings": {
"buttonBackgroundColor": "f0f0ff",
"buttonTextColor": "#4b49e0",
"labelColor": "#4b49e0",
"labelSublabelColor": "#4b49e0",
"fieldBorderColor": "#4b49e0"
}
},
"fresh": {
"name": "Fresh",
"settings": {
"buttonBackgroundColor": "#2da314",
"buttonTextColor": "#ffffff",
"labelColor": "#000000",
"labelSublabelColor": "#404040",
"fieldBorderColor": "rgba(0, 0, 0, 0.30)"
}
},
"frost": {
"name": "Frost",
"settings": {
"buttonBackgroundColor": "#e03f79",
"buttonTextColor": "#ffffff",
"labelColor": "#09598d",
"labelSublabelColor": "#578bad",
"fieldBorderColor": "#6e9fbe"
}
},
"gloom": {
"name": "Gloom",
"settings": {
"buttonBackgroundColor": "#258c60",
"buttonTextColor": "#ffffff",
"labelColor": "#a9abad",
"labelSublabelColor": "rgba(255, 255, 255, .7)",
"fieldBorderColor": "#4a4b4f"
}
},
"greenery": {
"name": "Greenery",
"settings": {
"buttonBackgroundColor": "#1e1f19",
"buttonTextColor": "#ffffff",
"labelColor": "#262c1e",
"labelSublabelColor": "rgba(38, 44, 30, 0.5)",
"fieldBorderColor": "rgba(0, 0, 0, 0.10)"
}
},
"hallway": {
"name": "Hallway",
"settings": {
"buttonBackgroundColor": "#000000",
"buttonTextColor": "#ffffff",
"labelColor": "#000000",
"labelSublabelColor": "#000000",
"fieldBorderColor": "#cbcbcb"
}
},
"harvest": {
"name": "Harvest",
"settings": {
"buttonBackgroundColor": "#984628",
"buttonTextColor": "#ffffff",
"labelColor": "#481f10",
"labelSublabelColor": "#984628",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"jungle": {
"name": "Jungle",
"settings": {
"buttonBackgroundColor": "rgba(14, 143, 28, 0.5)",
"buttonTextColor": "#ffffff",
"labelColor": "rgba(255, 255, 255, 0.7)",
"labelSublabelColor": "rgba(255, 255, 255, 0.6)",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"lush": {
"name": "Lush",
"settings": {
"buttonBackgroundColor": "#962d3c",
"buttonTextColor": "#ffffff",
"labelColor": "#312425",
"labelSublabelColor": "rgba(49, 36, 37, 0.5)",
"fieldBorderColor": "rgba(0, 0, 0, 0.10)"
}
},
"manhattan": {
"name": "Manhattan",
"settings": {
"buttonBackgroundColor": "rgba(0, 0, 0, 0.32)",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "rgba(255, 255, 255, 0.75)",
"fieldBorderColor": "rgba(255, 255, 255, 0.15)"
}
},
"matrix": {
"name": "Matrix",
"settings": {
"buttonBackgroundColor": "#8ee8d6",
"buttonTextColor": "#111a12",
"labelColor": "#d8fff7",
"labelSublabelColor": "#d8fff7",
"fieldBorderColor": "#8ee8d6"
}
},
"monstera": {
"name": "Monstera",
"settings": {
"buttonBackgroundColor": "#2f590f",
"buttonTextColor": "#ffffff",
"labelColor": "#000000",
"labelSublabelColor": "#6a6a6a",
"fieldBorderColor": "#a3a9c2"
}
},
"negative": {
"name": "Negative",
"settings": {
"buttonBackgroundColor": "#ff4d24",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "#999999",
"fieldBorderColor": "#616265"
}
},
"palm": {
"name": "Palm",
"settings": {
"buttonBackgroundColor": "#000000",
"buttonTextColor": "#ffffff",
"labelColor": "#000000",
"labelSublabelColor": "#6a6a6a",
"fieldBorderColor": "#636363"
}
},
"plaster": {
"name": "Plaster",
"settings": {
"buttonBackgroundColor": "#494848",
"buttonTextColor": "#ffffff",
"labelColor": "#494848",
"labelSublabelColor": "#afafaf",
"fieldBorderColor": "#afafaf"
}
},
"range": {
"name": "Range",
"settings": {
"buttonBackgroundColor": "#ae0120",
"buttonTextColor": "#ffffff",
"labelColor": "#000000",
"labelSublabelColor": "#6a6a6a",
"fieldBorderColor": "rgba(61, 0, 0, 0.15)"
}
},
"rustic": {
"name": "Rustic",
"settings": {
"buttonBackgroundColor": "rgba(0, 0, 0, 0.5)",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "rgba(255, 255, 255, 0.75)",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"scrap": {
"name": "Scrap",
"settings": {
"buttonBackgroundColor": "#2f3133",
"buttonTextColor": "#ffffff",
"labelColor": "#2f3133",
"labelSublabelColor": "#2f3133",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"solitude": {
"name": "Solitude",
"settings": {
"buttonBackgroundColor": "#0e0f32",
"buttonTextColor": "#ffffff",
"labelColor": "#0e0f32",
"labelSublabelColor": "#64647f",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"sonic": {
"name": "Sonic",
"settings": {
"buttonBackgroundColor": "#073eff",
"buttonTextColor": "#ffffff",
"labelColor": "#666666",
"labelSublabelColor": "#666666",
"fieldBorderColor": "#073eff"
}
},
"tidal": {
"name": "Tidal",
"settings": {
"buttonBackgroundColor": "#474e54",
"buttonTextColor": "#ffffff",
"labelColor": "#ffffff",
"labelSublabelColor": "#a7b3be",
"fieldBorderColor": "#474e54"
}
},
"tranquil": {
"name": "Tranquil",
"settings": {
"buttonBackgroundColor": "#366ce3",
"buttonTextColor": "#ffffff",
"labelColor": "#373d4a",
"labelSublabelColor": "#606775",
"fieldBorderColor": "rgba( 0, 0, 0, 0.25 )"
}
},
"vintage": {
"name": "Vintage",
"settings": {
"buttonBackgroundColor": "#f2cd52",
"buttonTextColor": "#1a1a1a",
"labelColor": "#1a1a1a",
"labelSublabelColor": "#4d4d4d",
"fieldBorderColor": "#bababa"
}
},
"western": {
"name": "Western",
"settings": {
"buttonBackgroundColor": "rgba(255, 255, 255, 0.05)",
"buttonTextColor": "#e0b495",
"labelColor": "#ffffff",
"labelSublabelColor": "#e0b495",
"fieldBorderColor": "#e0b495"
}
}
}