You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
1.4 KiB
JavaScript

"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();