geno/wp-content/plugins/woocommerce/assets/client/admin/wp-admin-scripts/order-tracking.js
2024-02-01 11:54:18 +00:00

1 line
No EOL
1.2 KiB
JavaScript

(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const t=window.wc.customerEffortScore;function o(e){const t=e.querySelectorAll("input, select, textarea"),o={};for(const e of t){const t=e.name||e.id;if("button"!==e.type&&"image"!==e.type&&"submit"!==e.type&&"hidden"!==e.type&&t)switch(e.type){case"checkbox":o[t]=+e.checked;break;case"radio":void 0===o[t]&&(o[t]=""),e.checked&&(o[t]=e.value);break;case"select-multiple":const r=[];for(const t of e.options)t.selected&&r.push(t.value);o[t]=r;break;default:o[t]=e.value}}return o}const r=document.forms;if(null!=r&&r.post){let e=!1;const c=document.querySelector(".save_order"),n=document.querySelector(".submitdelete");c&&c.addEventListener("click",(()=>{e=!0})),n&&n.addEventListener("click",(()=>{e=!0}));const s=o(r.post);(0,t.addCustomerEffortScoreExitPageListener)("shop_order_update",(()=>{if(e)return!1;const t=r.post?o(r.post):{};for(const e of Object.keys(s))if(("object"==typeof s[e]?JSON.stringify(s[e]):s[e])!==("object"==typeof t[e]?JSON.stringify(t[e]):t[e]))return!0;return!1}))}(window.wc=window.wc||{}).orderTracking=e})();