File "settings-paypal-commerce.min.js"

Full Path: /home/stylijtl/public_html/wp-content/plugins/wpforms-lite/assets/js/integrations/paypal-commerce/settings-paypal-commerce.min.js
File size: 3.13 KB
MIME-type: text/plain
Charset: utf-8

let WPFormsSettingsPaypalCommerce=window.WPFormsSettingsPaypalCommerce||(n=>{let e={sandboxModeCheckbox:n("#wpforms-setting-paypal-commerce-sandbox-mode"),sandboxConnectionStatusBlock:n("#wpforms-setting-row-paypal-commerce-connection-status-sandbox"),productionConnectionStatusBlock:n("#wpforms-setting-row-paypal-commerce-connection-status-live"),sandboxConnectionMerchantEmailBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-email-sandbox"),productionConnectionMerchantEmailBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-email-live"),sandboxConnectionMerchantIdBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-id-sandbox"),productionConnectionMerchantIdBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-id-live"),sandboxConnectionMerchantGrantedScopesBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-granted-scopes-sandbox"),productionConnectionMerchantGrantedScopesBlock:n("#wpforms-setting-row-paypal-commerce-connection-merchant-granted-scopes-live"),sandboxDisconnectBtn:n("#wpforms-paypal-commerce-disconnect-sandbox"),productionDisconnectBtn:n("#wpforms-paypal-commerce-disconnect-live"),copyButton:n("#wpforms-setting-row-paypal-commerce-webhooks-endpoint-set .wpforms-copy-to-clipboard"),webhookEndpointUrl:n("input#wpforms-paypal-commerce-webhook-endpoint-url"),webhookMethod:n('input[name="paypal-commerce-webhooks-communication"]')},c={init(){n(c.ready)},ready(){e.sandboxModeCheckbox.on("change",c.credentialsFieldsDisplay),e.webhookMethod.on("change",c.onMethodChange),e.copyButton.on("click",function(o){wpf.copyValueToClipboard(o,n(this),e.webhookEndpointUrl)})},onMethodChange(){var o=e.webhookMethod.filter(":checked").val(),o=wpforms_admin.paypal_commerce.webhook_urls[o];e.webhookEndpointUrl.val(o)},credentialsFieldsDisplay(){var o=e.sandboxModeCheckbox.is(":checked");o?(e.sandboxConnectionStatusBlock.show(),e.sandboxDisconnectBtn.length&&(e.sandboxConnectionMerchantEmailBlock.show(),e.sandboxConnectionMerchantIdBlock.show(),e.sandboxConnectionMerchantGrantedScopesBlock.show()),e.productionConnectionStatusBlock.hide(),e.productionConnectionMerchantEmailBlock.hide(),e.productionConnectionMerchantIdBlock.hide(),e.productionConnectionMerchantGrantedScopesBlock.hide()):(e.sandboxConnectionStatusBlock.hide(),e.sandboxConnectionMerchantEmailBlock.hide(),e.sandboxConnectionMerchantIdBlock.hide(),e.sandboxConnectionMerchantGrantedScopesBlock.hide(),e.productionConnectionStatusBlock.show(),e.productionDisconnectBtn.length&&(e.productionConnectionMerchantEmailBlock.show(),e.productionConnectionMerchantIdBlock.show(),e.productionConnectionMerchantGrantedScopesBlock.show())),o&&e.sandboxConnectionStatusBlock.find(".wpforms-paypal-commerce-connected").length||!o&&e.productionConnectionStatusBlock.find(".wpforms-paypal-commerce-connected").length||c.modeChangedWarning()},modeChangedWarning(){n.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.paypal_commerce.mode_update,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}};return c})((document,window,jQuery));WPFormsSettingsPaypalCommerce.init();