/*! For license information please see beta-features-tracking-modal.js.LICENSE.txt */
(()=>{"use strict";var e={93359:(e,t,o)=>{var r=o(99196),a=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,o){var r,i={},d=null,u=null;for(r in void 0!==o&&(d=""+o),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(u=t.ref),t)n.call(t,r)&&!s.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:a,type:e,key:d,ref:u,props:i,_owner:c.current}}t.jsx=i,t.jsxs=i},81514:(e,t,o)=>{e.exports=o(93359)},99196:e=>{e.exports=window.React}},t={};function o(r){var a=t[r];if(void 0!==a)return a.exports;var n=t[r]={exports:{}};return e[r](n,n.exports,o),n.exports}o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{o.r(r);const e=window.wp.element,t=window.wp.i18n,a=window.wp.components,n=window.wp.data,c=window.wp.compose,s=window.wc.data,i=window.wc.tracks,d=window.wc.explat;var u=o(81514);const w=(0,c.compose)((0,n.withDispatch)((e=>{const{updateOptions:t}=e(s.OPTIONS_STORE_NAME);return{updateOptions:t}})))((({updateOptions:o})=>{const[r,n]=(0,e.useState)(!1),[c,s]=(0,e.useState)(!1),w=(0,e.useRef)(document.querySelector("#woocommerce_navigation_enabled")),l=async e=>("function"==typeof window.wcTracks.enable&&(e?window.wcTracks.enable((()=>{(0,d.initializeExPlat)()})):window.wcTracks.isEnabled=!1),e&&(0,i.recordEvent)("settings_features_tracking_enabled"),o({woocommerce_allow_tracking:e?"yes":"no"}));return(0,e.useEffect)((()=>{if(!w.current)return;const e=e=>{e.target.checked&&(e.target.checked=!1,n(!0))},t=w.current;return t.addEventListener("change",e,!1),()=>t.removeEventListener("change",e)}),[]),w.current&&r?(0,u.jsxs)(a.Modal,{title:(0,t.__)("Build a Better WooCommerce","woocommerce"),onRequestClose:()=>n(!1),className:"woocommerce-beta-features-tracking-modal",children:[(0,u.jsxs)("p",{children:[(0,t.__)("Testing new features requires sharing non-sensitive data via ","woocommerce"),(0,u.jsx)("a",{href:"https://woocommerce.com/usage-tracking?utm_medium=product",children:(0,t.__)("usage tracking","woocommerce")}),(0,t.__)(". Gathering usage data allows us to make WooCommerce better — your store will be considered as we evaluate new features, judge the quality of an update, or determine if an improvement makes sense. No personal data is tracked or stored and you can opt-out at any time.","woocommerce")]}),(0,u.jsx)("div",{className:"woocommerce-beta-features-tracking-modal__checkbox",children:(0,u.jsx)(a.CheckboxControl,{label:"Enable usage tracking",onChange:s,checked:c})}),(0,u.jsx)("div",{className:"woocommerce-beta-features-tracking-modal__actions",children:(0,u.jsx)(a.Button,{isPrimary:!0,onClick:async()=>{c?(await l(!0),w.current.checked=!0):await l(!1),n(!1)},children:(0,t.__)("Save","woocommerce")})})]}):null})),l=document.createElement("div");l.setAttribute("id","beta-features-tracking"),(0,e.createRoot)(document.body.appendChild(l)).render((0,u.jsx)(w,{}))})(),(window.wc=window.wc||{}).betaFeaturesTrackingModal=r})();