diff --git a/assets/admin/settings.asset.php b/assets/admin/settings.asset.php index 1d9d962..d41a8dc 100644 --- a/assets/admin/settings.asset.php +++ b/assets/admin/settings.asset.php @@ -1 +1 @@ - array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '783bc0098ae10ff2b858'); + array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'c3721e4626a84a4332cc'); diff --git a/assets/admin/settings.js b/assets/admin/settings.js index aebe031..f5ad518 100644 --- a/assets/admin/settings.js +++ b/assets/admin/settings.js @@ -1 +1 @@ -!function(){"use strict";var t={n:function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,{a:n}),n},d:function(e,n){for(var a in n)t.o(n,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:n[a]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.wp.element,n=window.wp.components,a=window.lodash,i=window.wp.apiFetch,o=t.n(i);o().use(o().createNonceMiddleware(window.gtmkitSettings.nonce)),o().use(o().createRootURLMiddleware(window.gtmkitSettings.root));const r=async()=>{let t={};try{t=await o()({path:"gtmkit/v1/get-options",method:"GET"})}catch(t){return console.log("fetchSettings Errors:",t),{gtm_kit_settings_fetch_settings_errors:!0}}return!0===t.success?t.data:t},l=async()=>{let t={};try{t=await o()({path:"gtmkit/v1/get-site-data",method:"GET"})}catch(t){return console.log("fetchSiteData Errors:",t),{gtm_kit_settings_fetch_site_data_errors:!0}}return!0===t.success?t.data:t};var s=window.wp.i18n,m=(t,e)=>{const n=Object.assign({},t);switch(e.type){case"FETCH_SETTINGS":n.fetchedSettings=e.payload.fetchedSettings,n.stateSettings=e.payload.stateSettings,n.siteData=e.payload.siteData,n.installData=e.payload.installData,n.isPending=!1,n.canSave=!1,void 0===e.payload.fetchedSettings.integrations&&(n.fetchedSettings.integrations={}),void 0!==e.payload.fetchedSettings.gtm_kit_settings_fetch_settings_errors&&(n.notice=(0,s.__)("An error occurred.","gtm-kit"),n.hasError=!0);break;case"UPDATE_SETTINGS_BEFORE":n.isPending=e.payload.isPending;break;case"UPDATE_SETTINGS":n.fetchedSettings=e.payload.fetchedSettings,n.stateSettings=e.payload.stateSettings,n.isPending=!1;let t=!1,a=(0,s.__)("Saved Successfully.","gtm-kit"),i=!1;void 0!==e.payload.fetchedSettings.gtm_kit_settings_update_settings_errors&&(t=!0,a=(0,s.__)("An error occurred.","gtm-kit"),i=!0),n.canSave=t,n.notice=a,n.hasError=i;break;case"UPDATE_STATE":e.payload.fetchedSettings&&(n.fetchedSettings=e.payload.fetchedSettings),e.payload.stateSettings&&(n.stateSettings=e.payload.stateSettings),void 0!==e.payload.isPending&&(n.isPending=e.payload.isPending),void 0!==e.payload.notice&&(n.notice=e.payload.notice),void 0!==e.payload.hasError&&(n.hasError=e.payload.hasError),void 0!==e.payload.canSave&&(n.canSave=e.payload.canSave)}return n};const c=(0,e.createContext)();var u,g=t=>{const[n,i]=(0,e.useReducer)(m,{fetchedSettings:{},stateSettings:{},isPending:!0,notice:"",hasError:"",canSave:!1}),s=async()=>{const[t,e]=await Promise.all([r(),l()]),n="wizard"===window.gtmkitSettings.currentPage?await(async()=>{let t={};try{t=await o()({path:"gtmkit/v1/get-install-data",method:"GET"})}catch(t){return console.log("fetchSiteData Errors:",t),{gtm_kit_settings_fetch_site_data_errors:!0}}return!0===t.success?t.data:t})():{};i({type:"FETCH_SETTINGS",payload:{fetchedSettings:t,stateSettings:t,siteData:e,installData:n}})},u=async t=>{i({type:"UPDATE_STATE",payload:t})};(0,e.useEffect)((()=>{s()}),[]);const g={useDispatch:t=>{i(t)},useUpdateSettings:async()=>{i({type:"UPDATE_SETTINGS_BEFORE",payload:{isPending:!0}});const t=await(async t=>{let e={};try{e=await o()({path:"gtmkit/v1/set-options",method:"POST",data:t})}catch(t){return console.log("updateSettings Errors:",t),{gtm_kit_settings_update_settings_errors:!0}}return!0===e.success?e.data:e})(n.stateSettings);i({type:"UPDATE_SETTINGS",payload:{fetchedSettings:t,stateSettings:t}})},useFetchSettings:s,useUpdateState:u,useUpdateStateSettings:async(t,e,i)=>{const o=JSON.parse(JSON.stringify(n.stateSettings));let r;o[t][e]=i,r=!(0,a.isEqual)(o,n.fetchedSettings),u({stateSettings:o,canSave:r})},useImportSettings:async(t,e)=>{const i=JSON.parse(JSON.stringify(n.stateSettings));let o;const r={};r.general={...i.general,...e.general},"integrations"in e&&(r.integrations={...i.integrations,...e.integrations}),o=!(0,a.isEqual)(r,n.fetchedSettings),u({stateSettings:r,canSave:o})},useSettings:n.stateSettings,useIsPending:n.isPending,useNotice:n.notice,useHasError:n.hasError,useCanSave:n.canSave,useSiteData:n.siteData,useInstallData:n.installData};return(0,e.createElement)(c.Provider,{value:g},t.children)},d=window.React,p=t.n(d);function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0&&(e.hash=t.substr(n),t=t.substr(0,n));let a=t.indexOf("?");a>=0&&(e.search=t.substr(a),t=t.substr(0,a)),t&&(e.pathname=t)}return e}var x;function w(t,e,n){void 0===n&&(n="/");let a=L(("string"==typeof e?y(e):e).pathname||"/",n);if(null==a)return null;let i=S(t);!function(t){t.sort(((t,e)=>t.score!==e.score?e.score-t.score:function(t,e){return t.length===e.length&&t.slice(0,-1).every(((t,n)=>t===e[n]))?t[t.length-1]-e[e.length-1]:0}(t.routesMeta.map((t=>t.childrenIndex)),e.routesMeta.map((t=>t.childrenIndex)))))}(i);let o=null;for(let t=0;null==o&&t{let r={relativePath:void 0===o?t.path||"":o,caseSensitive:!0===t.caseSensitive,childrenIndex:i,route:t};r.relativePath.startsWith("/")&&(k(r.relativePath.startsWith(a),'Absolute route path "'+r.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),r.relativePath=r.relativePath.slice(a.length));let l=B([a,r.relativePath]),s=n.concat(r);t.children&&t.children.length>0&&(k(!0!==t.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),S(t.children,e,s,l)),(null!=t.path||t.index)&&e.push({path:l,score:O(l,t.index),routesMeta:s})};return t.forEach(((t,e)=>{var n;if(""!==t.path&&null!=(n=t.path)&&n.includes("?"))for(let n of N(t.path))i(t,e,n);else i(t,e)})),e}function N(t){let e=t.split("/");if(0===e.length)return[];let[n,...a]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===a.length)return i?[o,""]:[o];let r=N(a.join("/")),l=[];return l.push(...r.map((t=>""===t?o:[o,t].join("/")))),i&&l.push(...r),l.map((e=>t.startsWith("/")&&""===e?"/":e))}!function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"}(x||(x={})),new Set(["lazy","caseSensitive","path","id","index","children"]);const C=/^:\w+$/,T=3,G=2,P=1,I=10,D=-2,R=t=>"*"===t;function O(t,e){let n=t.split("/"),a=n.length;return n.some(R)&&(a+=D),e&&(a+=G),n.filter((t=>!R(t))).reduce(((t,e)=>t+(C.test(e)?T:""===e?P:I)),a)}function M(t,e){let{routesMeta:n}=t,a={},i="/",o=[];for(let t=0;t(a.push(e),"/([^\\/]+)")));return t.endsWith("*")?(a.push("*"),i+="*"===t||"/*"===t?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==t&&"/"!==t&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),a]}(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let o=i[0],r=o.replace(/(.)\/+$/,"$1"),l=i.slice(1);return{params:a.reduce(((t,e,n)=>{if("*"===e){let t=l[n]||"";r=o.slice(0,o.length-t.length).replace(/(.)\/+$/,"$1")}return t[e]=function(t,e){try{return decodeURIComponent(t)}catch(n){return f(!1,'The value for the URL param "'+e+'" will not be decoded because the string "'+t+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),t}}(l[n]||"",e),t}),{}),pathname:o,pathnameBase:r,pattern:t}}function A(t){try{return decodeURI(t)}catch(e){return f(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+e+")."),t}}function L(t,e){if("/"===e)return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,a=t.charAt(n);return a&&"/"!==a?null:t.slice(n)||"/"}function W(t,e,n,a){return"Cannot include a '"+t+"' character in a manually specified `to."+e+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function j(t){return t.filter(((t,e)=>0===e||t.route.path&&t.route.path.length>0))}function H(t,e,n,a){let i;void 0===a&&(a=!1),"string"==typeof t?i=y(t):(i=h({},t),k(!i.pathname||!i.pathname.includes("?"),W("?","pathname","search",i)),k(!i.pathname||!i.pathname.includes("#"),W("#","pathname","hash",i)),k(!i.search||!i.search.includes("#"),W("#","search","hash",i)));let o,r=""===t||""===i.pathname,l=r?"/":i.pathname;if(a||null==l)o=n;else{let t=e.length-1;if(l.startsWith("..")){let e=l.split("/");for(;".."===e[0];)e.shift(),t-=1;i.pathname=e.join("/")}o=t>=0?e[t]:"/"}let s=function(t,e){void 0===e&&(e="/");let{pathname:n,search:a="",hash:i=""}="string"==typeof t?y(t):t,o=n?n.startsWith("/")?n:function(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach((t=>{".."===t?n.length>1&&n.pop():"."!==t&&n.push(t)})),n.length>1?n.join("/"):"/"}(n,e):e;return{pathname:o,search:J(a),hash:K(i)}}(i,o),m=l&&"/"!==l&&l.endsWith("/"),c=(r||"."===l)&&n.endsWith("/");return s.pathname.endsWith("/")||!m&&!c||(s.pathname+="/"),s}const B=t=>t.join("/").replace(/\/\/+/g,"/"),F=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),J=t=>t&&"?"!==t?t.startsWith("?")?t:"?"+t:"",K=t=>t&&"#"!==t?t.startsWith("#")?t:"#"+t:"";Error;const z=["post","put","patch","delete"],$=(new Set(z),["get",...z]);function q(){return q=Object.assign?Object.assign.bind():function(t){for(var e=1;e{n.current=!0})),d.useCallback((function(a,i){void 0===i&&(i={}),n.current&&("number"==typeof a?t.navigate(a):t.navigate(a,q({fromRouteId:e},i)))}),[t,e])}():function(){et()||k(!1);let t=d.useContext(V),{basename:e,navigator:n}=d.useContext(X),{matches:a}=d.useContext(Z),{pathname:i}=nt(),o=JSON.stringify(j(a).map((t=>t.pathnameBase))),r=d.useRef(!1);return at((()=>{r.current=!0})),d.useCallback((function(a,l){if(void 0===l&&(l={}),!r.current)return;if("number"==typeof a)return void n.go(a);let s=H(a,JSON.parse(o),i,"path"===l.relative);null==t&&"/"!==e&&(s.pathname="/"===s.pathname?e:B([e,s.pathname])),(l.replace?n.replace:n.push)(s,l.state,l)}),[e,n,o,i,t])}()}function ot(t,e){let{relative:n}=void 0===e?{}:e,{matches:a}=d.useContext(Z),{pathname:i}=nt(),o=JSON.stringify(j(a).map((t=>t.pathnameBase)));return d.useMemo((()=>H(t,JSON.parse(o),i,"path"===n)),[t,o,i,n])}function rt(t,e,n){et()||k(!1);let{navigator:a}=d.useContext(X),{matches:i}=d.useContext(Z),o=i[i.length-1],r=o?o.params:{},l=(o&&o.pathname,o?o.pathnameBase:"/");o&&o.route;let s,m=nt();if(e){var c;let t="string"==typeof e?y(e):e;"/"===l||(null==(c=t.pathname)?void 0:c.startsWith(l))||k(!1),s=t}else s=m;let g=s.pathname||"/",p=w(t,{pathname:"/"===l?g:g.slice(l.length)||"/"}),h=function(t,e,n){var a;if(void 0===e&&(e=[]),void 0===n&&(n=null),null==t){var i;if(null==(i=n)||!i.errors)return null;t=n.matches}let o=t,r=null==(a=n)?void 0:a.errors;if(null!=r){let t=o.findIndex((t=>t.route.id&&(null==r?void 0:r[t.route.id])));t>=0||k(!1),o=o.slice(0,Math.min(o.length,t+1))}return o.reduceRight(((t,a,i)=>{let l=a.route.id?null==r?void 0:r[a.route.id]:null,s=null;n&&(s=a.route.errorElement||st);let m=e.concat(o.slice(0,i+1)),c=()=>{let e;return e=l?s:a.route.Component?d.createElement(a.route.Component,null):a.route.element?a.route.element:t,d.createElement(ct,{match:a,routeContext:{outlet:t,matches:m,isDataRoute:null!=n},children:e})};return n&&(a.route.ErrorBoundary||a.route.errorElement||0===i)?d.createElement(mt,{location:n.location,revalidation:n.revalidation,component:s,error:l,children:c(),routeContext:{outlet:null,matches:m,isDataRoute:!0}}):c()}),null)}(p&&p.map((t=>Object.assign({},t,{params:Object.assign({},r,t.params),pathname:B([l,a.encodeLocation?a.encodeLocation(t.pathname).pathname:t.pathname]),pathnameBase:"/"===t.pathnameBase?l:B([l,a.encodeLocation?a.encodeLocation(t.pathnameBase).pathname:t.pathnameBase])}))),i,n);return e&&h?d.createElement(Q.Provider,{value:{location:q({pathname:"/",search:"",hash:"",state:null,key:"default"},s),navigationType:u.Pop}},h):h}function lt(){let t=function(){var t;let e=d.useContext(tt),n=function(t){let e=d.useContext(Y);return e||k(!1),e}(gt.UseRouteError),a=dt(gt.UseRouteError);return e||(null==(t=n.errors)?void 0:t[a])}(),e=function(t){return null!=t&&"number"==typeof t.status&&"string"==typeof t.statusText&&"boolean"==typeof t.internal&&"data"in t}(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},e),n?d.createElement("pre",{style:a},n):null,null)}const st=d.createElement(lt,null);class mt extends d.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||"idle"!==e.revalidation&&"idle"===t.revalidation?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error||e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){console.error("React Router caught the following error during render",t,e)}render(){return this.state.error?d.createElement(Z.Provider,{value:this.props.routeContext},d.createElement(tt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ct(t){let{routeContext:e,match:n,children:a}=t,i=d.useContext(V);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),d.createElement(Z.Provider,{value:e},a)}var ut=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ut||{}),gt=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(gt||{});function dt(t){let e=function(t){let e=d.useContext(Z);return e||k(!1),e}(),n=e.matches[e.matches.length-1];return n.route.id||k(!1),n.route.id}function pt(t){let{to:e,replace:n,state:a,relative:i}=t;et()||k(!1);let{matches:o}=d.useContext(Z),{pathname:r}=nt(),l=it(),s=H(e,j(o).map((t=>t.pathnameBase)),r,"path"===i),m=JSON.stringify(s);return d.useEffect((()=>l(JSON.parse(m),{replace:n,state:a,relative:i})),[l,m,i,n,a]),null}function ht(t){k(!1)}function _t(t){let{basename:e="/",children:n=null,location:a,navigationType:i=u.Pop,navigator:o,static:r=!1}=t;et()&&k(!1);let l=e.replace(/^\/*/,"/"),s=d.useMemo((()=>({basename:l,navigator:o,static:r})),[l,o,r]);"string"==typeof a&&(a=y(a));let{pathname:m="/",search:c="",hash:g="",state:p=null,key:h="default"}=a,_=d.useMemo((()=>{let t=L(m,l);return null==t?null:{location:{pathname:t,search:c,hash:g,state:p,key:h},navigationType:i}}),[l,m,c,g,p,h,i]);return null==_?null:d.createElement(X.Provider,{value:s},d.createElement(Q.Provider,{children:n,value:_}))}function kt(t){let{children:e,location:n}=t;return rt(ft(e),n)}function ft(t,e){void 0===e&&(e=[]);let n=[];return d.Children.forEach(t,((t,a)=>{if(!d.isValidElement(t))return;let i=[...e,a];if(t.type===d.Fragment)return void n.push.apply(n,ft(t.props.children,i));t.type!==ht&&k(!1),t.props.index&&t.props.children&&k(!1);let o={id:t.props.id||i.join("-"),caseSensitive:t.props.caseSensitive,element:t.props.element,Component:t.props.Component,index:t.props.index,path:t.props.path,loader:t.props.loader,action:t.props.action,errorElement:t.props.errorElement,ErrorBoundary:t.props.ErrorBoundary,hasErrorBoundary:null!=t.props.ErrorBoundary||null!=t.props.errorElement,shouldRevalidate:t.props.shouldRevalidate,handle:t.props.handle,lazy:t.props.lazy};t.props.children&&(o.children=ft(t.props.children,i)),n.push(o)})),n}function Et(){return Et=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(i[n]=t[n]);return i}d.startTransition,new Promise((()=>{})),d.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);const bt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],yt=["aria-current","caseSensitive","className","end","style","to","children"],xt=d.startTransition;function wt(t){let{basename:e,children:n,future:a,window:i}=t,o=d.useRef();var r;null==o.current&&(o.current=(void 0===(r={window:i,v5Compat:!0})&&(r={}),function(t,e,n,a){void 0===a&&(a={});let{window:i=document.defaultView,v5Compat:o=!1}=a,r=i.history,l=u.Pop,s=null,m=c();function c(){return(r.state||{idx:null}).idx}function g(){l=u.Pop;let t=c(),e=null==t?null:t-m;m=t,s&&s({action:l,location:p.location,delta:e})}function d(t){let e="null"!==i.location.origin?i.location.origin:i.location.href,n="string"==typeof t?t:b(t);return k(e,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,e)}null==m&&(m=0,r.replaceState(h({},r.state,{idx:m}),""));let p={get action(){return l},get location(){return t(i,r)},listen(t){if(s)throw new Error("A history only accepts one active listener");return i.addEventListener(_,g),s=t,()=>{i.removeEventListener(_,g),s=null}},createHref(t){return e(i,t)},createURL:d,encodeLocation(t){let e=d(t);return{pathname:e.pathname,search:e.search,hash:e.hash}},push:function(t,e){l=u.Push;let a=v(p.location,t,e);n&&n(a,t),m=c()+1;let g=E(a,m),d=p.createHref(a);try{r.pushState(g,"",d)}catch(t){if(t instanceof DOMException&&"DataCloneError"===t.name)throw t;i.location.assign(d)}o&&s&&s({action:l,location:p.location,delta:1})},replace:function(t,e){l=u.Replace;let a=v(p.location,t,e);n&&n(a,t),m=c();let i=E(a,m),g=p.createHref(a);r.replaceState(i,"",g),o&&s&&s({action:l,location:p.location,delta:0})},go(t){return r.go(t)}};return p}((function(t,e){let{pathname:n="/",search:a="",hash:i=""}=y(t.location.hash.substr(1));return n.startsWith("/")||n.startsWith(".")||(n="/"+n),v("",{pathname:n,search:a,hash:i},e.state&&e.state.usr||null,e.state&&e.state.key||"default")}),(function(t,e){let n=t.document.querySelector("base"),a="";if(n&&n.getAttribute("href")){let e=t.location.href,n=e.indexOf("#");a=-1===n?e:e.slice(0,n)}return a+"#"+("string"==typeof e?e:b(e))}),(function(t,e){f("/"===t.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(e)+")")}),r)));let l=o.current,[s,m]=d.useState({action:l.action,location:l.location}),{v7_startTransition:c}=a||{},g=d.useCallback((t=>{c&&xt?xt((()=>m(t))):m(t)}),[m,c]);return d.useLayoutEffect((()=>l.listen(g)),[l,g]),d.createElement(_t,{basename:e,children:n,location:s.location,navigationType:s.action,navigator:l})}const St="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Nt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ct=d.forwardRef((function(t,e){let n,{onClick:a,relative:i,reloadDocument:o,replace:r,state:l,target:s,to:m,preventScrollReset:c}=t,u=vt(t,bt),{basename:g}=d.useContext(X),p=!1;if("string"==typeof m&&Nt.test(m)&&(n=m,St))try{let t=new URL(window.location.href),e=m.startsWith("//")?new URL(t.protocol+m):new URL(m),n=L(e.pathname,g);e.origin===t.origin&&null!=n?m=n+e.search+e.hash:p=!0}catch(t){}let h=function(t,e){let{relative:n}=void 0===e?{}:e;et()||k(!1);let{basename:a,navigator:i}=d.useContext(X),{hash:o,pathname:r,search:l}=ot(t,{relative:n}),s=r;return"/"!==a&&(s="/"===r?a:B([a,r])),i.createHref({pathname:s,search:l,hash:o})}(m,{relative:i}),_=function(t,e){let{target:n,replace:a,state:i,preventScrollReset:o,relative:r}=void 0===e?{}:e,l=it(),s=nt(),m=ot(t,{relative:r});return d.useCallback((e=>{if(function(t,e){return!(0!==t.button||e&&"_self"!==e||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t))}(e,n)){e.preventDefault();let n=void 0!==a?a:b(s)===b(m);l(t,{replace:n,state:i,preventScrollReset:o,relative:r})}}),[s,l,m,a,i,n,t,o,r])}(m,{replace:r,state:l,target:s,preventScrollReset:c,relative:i});return d.createElement("a",Et({},u,{href:n||h,onClick:p||o?a:function(t){a&&a(t),t.defaultPrevented||_(t)},ref:e,target:s}))})),Tt=d.forwardRef((function(t,e){let{"aria-current":n="page",caseSensitive:a=!1,className:i="",end:o=!1,style:r,to:l,children:s}=t,m=vt(t,yt),c=ot(l,{relative:m.relative}),u=nt(),g=d.useContext(Y),{navigator:p}=d.useContext(X),h=p.encodeLocation?p.encodeLocation(c).pathname:c.pathname,_=u.pathname,k=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;a||(_=_.toLowerCase(),k=k?k.toLowerCase():null,h=h.toLowerCase());let f,E=_===h||!o&&_.startsWith(h)&&"/"===_.charAt(h.length),v=null!=k&&(k===h||!o&&k.startsWith(h)&&"/"===k.charAt(h.length)),b=E?n:void 0;f="function"==typeof i?i({isActive:E,isPending:v}):[i,E?"active":null,v?"pending":null].filter(Boolean).join(" ");let y="function"==typeof r?r({isActive:E,isPending:v}):r;return d.createElement(Ct,Et({},m,{"aria-current":b,className:f,ref:e,style:y,to:l}),"function"==typeof s?s({isActive:E,isPending:v}):s)}));var Gt,Pt;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher"})(Gt||(Gt={})),function(t){t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"}(Pt||(Pt={}));var It=({to:t,title:n})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Tt,{to:t,className:({isActive:t})=>"gtmkit-border-b-4 gtmkit-border-white gtmkit-text-color-grey gtmkit-font-semibold gtmkit-pt-5 gtmkit-pb-[18px] hover:gtmkit-border-color-grey "+(t?"gtmkit-text-color-heading gtmkit-border-b-color-primary ":"")},n)),Dt=({page:t})=>(0,e.createElement)("nav",{className:"gtmkit-flex gtmkit-items-center gtmkit-px-8 gtmkit-border-y gtmkit-bg-white gtmkit-border-color-border gtmkit-text-sm gtmkit-space-x-8"},function({page:t}){const e=[{to:"general",title:(0,s.__)("Dashboard","gtm-kit")},{to:"container",title:(0,s.__)("Container","gtm-kit")},{to:"post-data",title:(0,s.__)("Post data","gtm-kit")},{to:"user-data",title:(0,s.__)("User data","gtm-kit")},{to:"google-consent-mode",title:(0,s.__)("Google Consent Mode","gtm-kit")},{to:"misc",title:(0,s.__)("Misc","gtm-kit")},{to:"whats-new",title:(0,s.__)("What's New","gtm-kit")}],n=[{to:"integrations",title:(0,s.__)("Integrations","gtm-kit")},{to:"woocommerce",title:"WooCommerce"},{to:"cf7",title:"Contact Form 7"},{to:"edd",title:"Easy Digital Downloads"}],a=[{to:"help",title:(0,s.__)("Help","gtm-kit")},{to:"support",title:(0,s.__)("Support","gtm-kit")}];switch(t){case"general":return e;case"integrations":return n;case"help":return a}}({page:t}).map((function(t){return(0,e.createElement)(It,{key:t.to,to:t.to,title:t.title})}))),Rt=({page:t})=>{let n=(0,s.__)("Settings","gtm-kit");switch(t){case"general":n=(0,s.__)("Settings","gtm-kit");break;case"integrations":n=(0,s.__)("Integrations","gtm-kit");break;case"help":n=(0,s.__)("Help","gtm-kit")}return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("header",{className:"gtmkit-px-8 gtmkit-py-6 gtmkit-sticky"},(0,e.createElement)("div",{className:"gtmkit-flex gtmkit-items-center gtmkit-justify-between"},(0,e.createElement)("h1",{className:"gtmkit-flex gtmkit-items-center gtmkit-font-medium gtmkit-text-3xl"},(0,e.createElement)("svg",{className:"gtmkit-mr-8",height:"44",viewBox:"0 0 160 54",width:"128",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("rect",{fill:"#888",height:"54",rx:"4.265",width:"160"}),(0,e.createElement)("path",{d:"m88.659 7.002h-49.266c-2.915 0-5.378-.184-9.23 2.596l-18.743 12.752c-4.549 3.292-4.571 6.001 0 9.302l18.743 12.751c3.652 2.646 6.299 2.597 9.23 2.597h15.686 33.58c2.931-.057 5.394-1.784 5.34-3.923v-32.21c-.012-2.134-2.409-3.865-5.34-3.865z",fill:"#3969bb",transform:"matrix(-1 0 0 -1 101.999867 53.999547)"}),(0,e.createElement)("g",{fill:"#fff",transform:"matrix(1.465202 0 0 1.465202 -4.582436 -7.553126)"},(0,e.createElement)("path",{d:"m18.316 23.086h4.632v6.052c-.75.245-1.459.415-2.121.514-.663.098-1.341.148-2.033.148-1.764 0-3.106-.517-4.035-1.554-.929-1.034-1.395-2.519-1.395-4.457 0-1.886.538-3.356 1.617-4.41 1.078-1.054 2.573-1.579 4.481-1.579 1.2 0 2.357.239 3.469.718l-.823 1.979c-.85-.425-1.737-.637-2.657-.637-1.071 0-1.932.358-2.572 1.077-.645.718-.968 1.685-.968 2.899 0 1.267.26 2.233.78 2.904.516.667 1.271.999 2.262.999.517 0 1.041-.052 1.572-.158v-2.435h-2.209zm11.912 6.555h-2.474v-9.614h-3.173v-2.06h8.816v2.06h-3.169zm9.908 0-2.811-9.158h-.072c.103 1.863.154 3.105.154 3.728v5.43h-2.213v-11.674h3.368l2.764 8.927h.048l2.934-8.927h3.369v11.674h-2.308v-5.525c0-.261 0-.561.009-.903.009-.341.048-1.246.112-2.716h-.074l-3.011 9.144z"}),(0,e.createElement)("path",{d:"m88.883 31.898h-3.811l-4.147-6.67-1.417 1.018v5.652h-3.357v-15.83h3.357v7.242l1.318-1.861 4.293-5.381h3.724l-5.523 7.006zm1.589-15.233c0-1.075.6-1.614 1.8-1.614 1.199 0 1.798.539 1.798 1.614 0 .512-.148.91-.45 1.196-.297.284-.749.429-1.348.429-1.2 0-1.8-.543-1.8-1.625zm3.449 15.233h-3.302v-12.104h3.302zm8.563-2.413c.578 0 1.271-.128 2.077-.38v2.456c-.82.37-1.831.552-3.031.552-1.324 0-2.28-.333-2.885-1.001-.602-.667-.902-1.668-.902-3.003v-5.835h-1.585v-1.399l1.823-1.103.949-2.557h2.115v2.579h3.388v2.48h-3.388v5.835c0 .467.129.815.393 1.041.264.222.614.335 1.046.335z"}))),n))),(0,e.createElement)(Dt,{page:t}))};function Ot(){return Ot=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(i[n]=t[n]);return i}function Ut(t,e){return Ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ut(t,e)}function At(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Ut(t,e)}function Lt(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}var Wt=window.ReactDOM,jt=t.n(Wt),Ht=p().createContext(null),Bt=function(t){return t.scrollTop},Ft="unmounted",Jt="exited",Kt="entering",zt="entered",$t="exiting",qt=function(t){function e(e,n){var a;a=t.call(this,e,n)||this;var i,o=n&&!n.isMounting?e.enter:e.appear;return a.appearStatus=null,e.in?o?(i=Jt,a.appearStatus=Kt):i=zt:i=e.unmountOnExit||e.mountOnEnter?Ft:Jt,a.state={status:i},a.nextCallback=null,a}At(e,t),e.getDerivedStateFromProps=function(t,e){return t.in&&e.status===Ft?{status:Jt}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==Kt&&n!==zt&&(e=Kt):n!==Kt&&n!==zt||(e=$t)}this.updateStatus(!1,e)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t,e,n,a=this.props.timeout;return t=e=n=a,null!=a&&"number"!=typeof a&&(t=a.exit,e=a.enter,n=void 0!==a.appear?a.appear:e),{exit:t,enter:e,appear:n}},n.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e)if(this.cancelNextCallback(),e===Kt){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:jt().findDOMNode(this);n&&Bt(n)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Jt&&this.setState({status:Ft})},n.performEnter=function(t){var e=this,n=this.props.enter,a=this.context?this.context.isMounting:t,i=this.props.nodeRef?[a]:[jt().findDOMNode(this),a],o=i[0],r=i[1],l=this.getTimeouts(),s=a?l.appear:l.enter;t||n?(this.props.onEnter(o,r),this.safeSetState({status:Kt},(function(){e.props.onEntering(o,r),e.onTransitionEnd(s,(function(){e.safeSetState({status:zt},(function(){e.props.onEntered(o,r)}))}))}))):this.safeSetState({status:zt},(function(){e.props.onEntered(o)}))},n.performExit=function(){var t=this,e=this.props.exit,n=this.getTimeouts(),a=this.props.nodeRef?void 0:jt().findDOMNode(this);e?(this.props.onExit(a),this.safeSetState({status:$t},(function(){t.props.onExiting(a),t.onTransitionEnd(n.exit,(function(){t.safeSetState({status:Jt},(function(){t.props.onExited(a)}))}))}))):this.safeSetState({status:Jt},(function(){t.props.onExited(a)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},n.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(a){n&&(n=!1,e.nextCallback=null,t(a))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(t,e){this.setNextCallback(e);var n=this.props.nodeRef?this.props.nodeRef.current:jt().findDOMNode(this),a=null==t&&!this.props.addEndListener;if(n&&!a){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=i[0],r=i[1];this.props.addEndListener(o,r)}null!=t&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},n.render=function(){var t=this.state.status;if(t===Ft)return null;var e=this.props,n=e.children,a=(e.in,e.mountOnEnter,e.unmountOnExit,e.appear,e.enter,e.exit,e.timeout,e.addEndListener,e.onEnter,e.onEntering,e.onEntered,e.onExit,e.onExiting,e.onExited,e.nodeRef,Mt(e,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return p().createElement(Ht.Provider,{value:null},"function"==typeof n?n(t,a):p().cloneElement(p().Children.only(n),a))},e}(p().Component);function Vt(){}qt.contextType=Ht,qt.propTypes={},qt.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Vt,onEntering:Vt,onEntered:Vt,onExit:Vt,onExiting:Vt,onExited:Vt},qt.UNMOUNTED=Ft,qt.EXITED=Jt,qt.ENTERING=Kt,qt.ENTERED=zt,qt.EXITING=$t;var Yt=qt,Xt=function(t,e){return t&&e&&e.split(" ").forEach((function(e){return a=e,void((n=t).classList?n.classList.remove(a):"string"==typeof n.className?n.className=Lt(n.className,a):n.setAttribute("class",Lt(n.className&&n.className.baseVal||"",a)));var n,a}))},Qt=function(t){function e(){for(var e,n=arguments.length,a=new Array(n),i=0;i{const{useUpdateSettings:i,useIsPending:o,useCanSave:r}=(0,e.useContext)(c);return(0,e.createElement)(n.Button,{className:a,onClick:()=>i(),variant:"primary",disabled:o||!r},r?(0,s.__)(t,"gtm-kit"):(0,s.__)("Saved","gtm-kit"),o?(0,e.createElement)(n.Spinner,null):"")},ee=()=>{const{useCanSave:t}=(0,e.useContext)(c);return(0,e.createElement)(Zt,{in:t,timeout:500,classNames:"slide",unmountOnExit:!0},(0,e.createElement)("footer",{className:"gtmkit-fixed gtmkit-bottom-0 gtmkit-w-full gtmkit-z-10 gtmkit-bg-color-grey gtmkit-text-white gtmkit-p-8"},(0,e.createElement)(te,null)))},ne=({subject:t})=>{const n=!0===t||"on"===t,a=!0===n?"gtmkit-bg-color-success":"gtmkit-bg-color-button-disabled";return(0,e.createElement)("div",{className:"gtmkit-text-xs gtmkit-text-white gtmkit-font-bold gtmkit-rounded-full gtmkit-py gtmkit-px-2 gtmkit-h-5 gtmkit-leading-5 gtmkit-uppercase "+a},n?(0,s.__)("Active","gtm-kit"):(0,s.__)("Inactive","gtm-kit"))};const ae=(0,e.forwardRef)((({children:t,className:n="",...a},i)=>(0,e.createElement)("div",{...a,className:"gtmkit-min-h-[128px] gtmkit-bg-white gtmkit-border gtmkit-border-color-border gtmkit-mb-6 gtmkit-py-4 gtmkit-px-5 gtmkit-rounded gtmkit-group gtmkit-w-full "+n,ref:i},t)));ae.Header=({as:t="h3",title:n="",children:a,className:i="",...o})=>(0,e.createElement)("div",{...o,className:"gtmkit-flex gtmkit-justify-between gtmkit-mb-5 "+i},(0,e.createElement)(t,{className:"gtmkit-text-2xl gtmkit-font-bold gtmkit-text-color-heading"},n),a),ae.Content=({as:t="div",children:n,className:a="group-hover:gtmkit-hidden",...i})=>(0,e.createElement)(t,{...i,className:a},n),ae.Button=({url:t,destination:a,newTab:i=!1,text:o,group:r="",...l})=>{const s=it();return(0,e.createElement)("div",{...l,className:"gtmkit-hidden group-hover:gtmkit-block"},(0,e.createElement)(n.Button,{variant:"primary",className:"gtmkit-rounded !gtmkit-py-4 !gtmkit-px-8 gtmkit-w-full",onClick:()=>{a&&t&&!1===i?window.gtmkitSettings.current_poage===r?s(a,{replace:!0}):window.location.href=t+"#"+a:t?i?window.open(t):window.location.href=t:s(a,{replace:!0})}},(0,e.createElement)("span",{className:"gtmkit-mx-auto gtmkit-text-sm gtmkit-font-bold"},o)))};var ie=ae,oe=({title:t,data:n,className:a=""})=>{const{useSettings:i}=(0,e.useContext)(c);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",{className:"gtmkit-text-2xl gtmkit-font-bold gtmkit-text-color-heading gtmkit-mb-8 gtmkit-mt-6"},t),(0,e.createElement)("div",{className:"lg:gtmkit-grid lg:gtmkit-grid-cols-2 xl:gtmkit-grid-cols-3 gtmkit-justify-between gtmkit-gap-6 gtmkit-border-b gtmkit-border-color-border gtmkit-pb-6 gtmkit-min-h-[175px] "+a},n.map(((t,n)=>!1===t.featured?null:(0,e.createElement)(ie,{key:n},(0,e.createElement)(ie.Header,{title:t.title},t.pill?(0,e.createElement)(ne,{subject:i[t.group][t.option]}):null),(0,e.createElement)(ie.Content,null,t.text.map(((t,n)=>(0,e.createElement)("p",{key:n},t)))),(0,e.createElement)(ie.Button,{url:t.link.url,destination:t.link.destination,text:t.link.text?t.link.text:(0,s.__)("Read article","gtm-kit"),newTab:t.link.external,group:t.group}))))))};const re=[{title:"Woocommerce",pill:!0,group:"integrations",option:"woocommerce_integration",text:[(0,s.__)("The #1 open source eCommerce platform built for WordPress","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/woocommerce",text:(0,s.__)("Setup integration","gtm-kit")}},{title:"Contact Form 7",pill:!0,group:"integrations",option:"cf7_integration",text:[(0,s.__)("Just another contact form plugin for WordPress. Simple but flexible","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/cf7",text:(0,s.__)("Setup integration","gtm-kit")}},{title:"Easy Digital Downloads",pill:!0,group:"integrations",option:"edd_integration",text:[(0,s.__)("Easy way to sell Digital Products With WordPress","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/edd",text:(0,s.__)("Setup integration","gtm-kit")}}],le=[{title:"Getting started with GTM Kit",text:[(0,s.__)("How to get the most out of Google Tag Manager with GTM Kit.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/getting-started-with-gtm-kit/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=getting-started&utm_content=dashboard-tutorials"},featured:!0},{title:(0,s.__)("WooCommerce integration","gtm-kit"),text:[(0,s.__)("Integrate WooCommerce with Google Tag Manager and Google Analytics.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/woocommerce/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=woocommerce&utm_content=dashboard-tutorials"},featured:!0},{title:"Contact Form 7 Integration",text:[(0,s.__)("Integrate Contact Form 7 with Google Tag Manager and Google Analytics.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/contact-form-7-integration/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=getting-started&utm_content=dashboard-tutorials"},featured:!1},{title:"Easy Digital Downloads integration",text:[(0,s.__)("Integrate Easy Digital Downloads with Google Tag Manager and Google Analytics.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/set-up-easy-digital-downloads-for-google-tag-manager/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=getting-started&utm_content=dashboard-tutorials"},featured:!1},{title:"Advanced GTM container implementation",text:[(0,s.__)("Customization of the GTM container implementation and Server Side Tracking.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/advanced-gtm-container-implementation/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=getting-started&utm_content=dashboard-tutorials"},featured:!1},{title:"Settings, actions and filters for developers",text:[(0,s.__)("One of the things that makes GTM Kit a great tool for developers is the ability to override options in wp-config.php.","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/settings-actions-and-filters-for-developers/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=getting-started&utm_content=dashboard-tutorials"},featured:!1}];var se=()=>{const{useSettings:t}=(0,e.useContext)(c),n=le;return n.push({title:(0,s.__)("See all tutorials…","gtm-kit"),text:[(0,s.__)("See all our tutorial and get the most out of GTM Kit","gtm-kit")],link:{external:!0,url:"https://gtmkit.com/documentation/#utm_source=gtmkit-plugin&utm_medium=software&utm_term=documentation&utm_content=dashboard-tutorials",text:(0,s.__)("Read articles","gtm-kit")},featured:!0}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",{className:"gtmkit-text-2xl gtmkit-font-bold gtmkit-text-color-heading gtmkit-mb-8"},(0,s.__)("Status","gtm-kit")),(0,e.createElement)("div",{className:"lg:gtmkit-flex lg:gtmkit-justify-between gtmkit-gap-6 gtmkit-border-b gtmkit-border-color-border gtmkit-pb-6 gtmkit-min-h-[175px]"},(0,e.createElement)(ie,{className:"lg:gtmkit-w-1/2 2xl:gtmkit-w-1/3"},(0,e.createElement)(ie.Header,{title:"Google Tag Manager Container"},(0,e.createElement)(ne,{subject:t.general.gtm_id&&t.general.container_active})),(0,e.createElement)(ie.Content,null,t.general.gtm_id&&t.general.container_active?(0,e.createElement)("p",null,(0,s.__)("Container ID:","gtm-kit")," ",t&&t.general.gtm_id):(0,e.createElement)("p",null,(0,s.__)("The container is not active but the datalayer is generated.","gtm-kit"))),(0,e.createElement)(ie.Button,{destination:"/container",text:(0,s.__)("Edit container","gtm-kit")})),(0,e.createElement)(ie,{className:"lg:gtmkit-w-1/2 2xl:gtmkit-w-1/3"},(0,e.createElement)(ie.Header,{title:(0,s.__)("Help improve GTM Kit","gtm-kit")},(0,e.createElement)(ne,{subject:t.general.analytics_active})),(0,e.createElement)(ie.Content,null,(0,e.createElement)("p",null,(0,s.__)("Share anonymous data with the development team to help improve GTM Kit.","gtm-kit"))),(0,e.createElement)(ie.Button,{destination:"/misc",text:(0,s.__)("Share anonymous data","gtm-kit")}))),(0,e.createElement)(oe,{title:(0,s.__)("Tutorials","gtm-kit"),data:n}),(0,e.createElement)(oe,{title:(0,s.__)("Integrations","gtm-kit"),data:re}))},me=({title:t,placeholder:a,help:i,className:o="gtmkit-settings-field-wrap gtmkit-py-4 gtmkit-max-w-md",optionGroup:r="general",optionName:l,pluginInactive:s})=>{const{useSettings:m,useUpdateStateSettings:u}=(0,e.useContext)(c);return(0,e.createElement)(n.TextControl,{label:t,placeholder:a,help:i,className:o,value:m&&m[r][l],onChange:t=>u(r,l,t),disabled:s})},ce=({title:t,label:a,optionGroup:i="general",optionName:o,disabled:r=!1})=>{const{useSettings:l,useUpdateStateSettings:s}=(0,e.useContext)(c);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"gtmkit-settings-field-wrap gtmkit-py-4"},(0,e.createElement)(n.BaseControl,{label:t},(0,e.createElement)(n.ToggleControl,{label:a,checked:!r&&l[i][o],onChange:()=>{s(i,o,!(l&&l[i][o]))},disabled:r}))))},ue=({title:t,options:a,help:i,className:o="gtmkit-settings-field-wrap gtmkit-py-4",optionGroup:r="general",optionName:l,disabled:s})=>{const{useSettings:m,useUpdateStateSettings:u}=(0,e.useContext)(c);return(0,e.createElement)(n.RadioControl,{label:t,options:a,help:i,className:o,selected:parseInt(m[r][l]),onChange:t=>u(r,l,t),disabled:s})};const ge=(0,e.forwardRef)((({children:t,className:n="",disabled:a=!1,...i},o)=>(0,e.createElement)("div",{...i,className:"gtmkit-mb-12 gtmkit-border gtmkit-bg-white gtmkit-w-3/4 gtmkit-border-color-grey "+n+(a?"gtmkit-opacity-60":""),ref:o},t)));ge.Header=({as:t="h3",title:n="",children:a,className:i="",...o})=>(0,e.createElement)(t,{...o,className:"gtmkit-font-bold gtmkit-text-lg gtmkit-px-8 gtmkit-py-4 gtmkit-border-b gtmkit-border-color-grey "+i},n,a),ge.Content=({as:t="div",children:n,className:a="",...i})=>(0,e.createElement)(t,{...i,className:"gtmkit-px-8 gtmkit-py-6 "+a},n);var de=ge,pe=()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("h2",{className:"gtmkit-text-2xl gtmkit-font-bold gtmkit-text-color-heading gtmkit-mb-8"},(0,s.__)("Google Tag Manager container","gtm-kit")),(0,e.createElement)(de,null,(0,e.createElement)(de.Header,{title:(0,s.__)("Google Tag Manager container code","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)("p",{className:"gtmkit-mb-4"},(0,s.__)("To start collecting data with Google Tag manager you must register the Container ID of your Google Tag Manager container.","gtm-kit")),(0,e.createElement)(me,{title:(0,s.__)("Container ID:","gtm-kit"),optionName:"gtm_id",placeholder:(0,s.__)("Enter Container ID","gtm-kit")}),(0,e.createElement)(ce,{title:(0,s.__)("Inject Container Code","gtm-kit"),label:(0,s.__)("Setting this to Off will remove the Google Tag Manager container code but the data layer will remain.","gtm-kit"),optionName:"container_active"}),(0,e.createElement)(ce,{title:(0,s.__)("Just the container","gtm-kit"),label:(0,s.__)("Setting this to On will reduce the functionality to just the GTM container code. No additional data will be pushed to the datalayer regardless of any other settings.","gtm-kit"),optionName:"just_the_container"}),(0,e.createElement)(me,{title:(0,s.__)("dataLayer variable name:","gtm-kit"),optionName:"datalayer_name",placeholder:"dataLayer",help:(0,s.__)("The default name of the data layer object is dataLayer. If you prefer to use a different name for your data layer, you may do.","gtm-kit")}))),(0,e.createElement)(de,null,(0,e.createElement)(de.Header,{title:(0,s.__)("GTM Server Side","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)(me,{title:(0,s.__)("GTM Server Side Domain:","gtm-kit"),optionName:"sgtm_domain",placeholder:(0,s.__)("Enter domain …","gtm-kit"),help:(0,s.__)("Enter your custom domain name if you are using a custom server side GTM container for tracking.","gtm-kit")}),(0,e.createElement)(me,{title:(0,s.__)("sGTM container identifier:","gtm-kit"),optionName:"sgtm_container_identifier",placeholder:(0,s.__)("Enter loader name …","gtm-kit"),help:(0,s.__)("Only use if you are using a custom loader.","gtm-kit")}))),(0,e.createElement)(de,null,(0,e.createElement)(de.Header,{title:(0,s.__)("Container Code Implementation","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)(ue,{title:(0,s.__)("Container code implementation:","gtm-kit"),options:[{label:(0,s.__)("Standard implementation as recommended by Google (no delay)","gtm-kit"),value:0},{label:(0,s.__)("Load container when browser is idle (requestIdleCallback)","gtm-kit"),value:1}],help:(0,s.__)("Depending on how you use Google Tag Manager you can delay the loading of the container script until the browser is idle.","gtm-kit"),optionName:"script_implementation"}),(0,e.createElement)(ue,{title:(0,s.__)("Container code noscript implementation:","gtm-kit"),options:[{label:(0,s.__)("Just after the opening tag","gtm-kit"),value:0},{label:(0,s.__)("Footer of the page (not recommended by Google)","gtm-kit"),value:1},{label:(0,s.__)("Custom (insert function in your template)","gtm-kit"),value:2},{label:(0,s.__)("Disable