mirror of
https://gh.wpcy.net/https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2026-04-30 04:42:19 +08:00
1 line
No EOL
762 B
JavaScript
1 line
No EOL
762 B
JavaScript
document.addEventListener("DOMContentLoaded",()=>{const t=ppcpSwitchSettingsUi;void 0!==t&&document.addEventListener("click",e=>{(e.target.closest(".button.button-settings-switch-ui")||e.target.closest(".ppcp-notice-wrapper:not(.inline) a.settings-switch-ui")||e.target.closest('a[name="settings-switch-ui"]')||e.target.closest(".woocommerce-inbox-note__action-button")?.textContent.includes("Switch to New Settings"))&&(e=>{e.preventDefault(),confirm(t.confirmMessage)&&fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nonce:t.nonce})}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(e=>{window.location.href=t.settingsUrl}).catch(t=>{console.error("Error:",t)})})(e)})}); |