From 8c7e22802a0713aee5b321292327a13830ae6f18 Mon Sep 17 00:00:00 2001 From: Torben Lundsgaard Date: Mon, 23 Oct 2023 16:58:36 +0200 Subject: [PATCH] Update assets for admin settings --- assets/admin/settings.asset.php | 2 +- assets/admin/settings.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/admin/settings.asset.php b/assets/admin/settings.asset.php index d41a8dc..15a8b59 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' => 'c3721e4626a84a4332cc'); + array('lodash', 'react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'ace6967dc457faddd697'); diff --git a/assets/admin/settings.js b/assets/admin/settings.js index f5ad518..a889604 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.React,n=t.n(e),a=window.wp.element,i=window.wp.components,o=window.lodash,r=window.wp.apiFetch,l=t.n(r);l().use(l().createNonceMiddleware(window.gtmkitSettings.nonce)),l().use(l().createRootURLMiddleware(window.gtmkitSettings.root));const s=async()=>{let t={};try{t=await l()({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},m=async()=>{let t={};try{t=await l()({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 c=window.wp.i18n,u=(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,c.__)("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,c.__)("Saved Successfully.","gtm-kit"),i=!1;void 0!==e.payload.fetchedSettings.gtm_kit_settings_update_settings_errors&&(t=!0,a=(0,c.__)("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 g=(0,a.createContext)();var d,p=t=>{const[n,i]=(0,a.useReducer)(u,{fetchedSettings:{},stateSettings:{},isPending:!0,notice:"",hasError:"",canSave:!1}),r=async()=>{const[t,e]=await Promise.all([s(),m()]),n="wizard"===window.gtmkitSettings.currentPage?await(async()=>{let t={};try{t=await l()({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}})},c=async t=>{i({type:"UPDATE_STATE",payload:t})};(0,a.useEffect)((()=>{r()}),[]);const d={useDispatch:t=>{i(t)},useUpdateSettings:async()=>{i({type:"UPDATE_SETTINGS_BEFORE",payload:{isPending:!0}});const t=await(async t=>{let e={};try{e=await l()({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:r,useUpdateState:c,useUpdateStateSettings:async(t,e,a)=>{const i=JSON.parse(JSON.stringify(n.stateSettings));let r;i[t][e]=a,r=!(0,o.isEqual)(i,n.fetchedSettings),c({stateSettings:i,canSave:r})},useImportSettings:async(t,e)=>{const a=JSON.parse(JSON.stringify(n.stateSettings));let i;const r={};r.general={...a.general,...e.general},"integrations"in e&&(r.integrations={...a.integrations,...e.integrations}),i=!(0,o.isEqual)(r,n.fetchedSettings),c({stateSettings:r,canSave:i})},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)(g.Provider,{value:d},t.children)};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 F(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:K(a),hash:J(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,"/"),H=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),K=t=>t&&"?"!==t?t.startsWith("?")?t:"?"+t:"",J=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{a.current=!0})),e.useCallback((function(e,i){void 0===i&&(i={}),a.current&&("number"==typeof e?t.navigate(e):t.navigate(e,q({fromRouteId:n},i)))}),[t,n])}():function(){et()||k(!1);let t=e.useContext(V),{basename:n,navigator:a}=e.useContext(X),{matches:i}=e.useContext(Z),{pathname:o}=nt(),r=JSON.stringify(j(i).map((t=>t.pathnameBase))),l=e.useRef(!1);return at((()=>{l.current=!0})),e.useCallback((function(e,i){if(void 0===i&&(i={}),!l.current)return;if("number"==typeof e)return void a.go(e);let s=F(e,JSON.parse(r),o,"path"===i.relative);null==t&&"/"!==n&&(s.pathname="/"===s.pathname?n:B([n,s.pathname])),(i.replace?a.replace:a.push)(s,i.state,i)}),[n,a,r,o,t])}()}function ot(t,n){let{relative:a}=void 0===n?{}:n,{matches:i}=e.useContext(Z),{pathname:o}=nt(),r=JSON.stringify(j(i).map((t=>t.pathnameBase)));return e.useMemo((()=>F(t,JSON.parse(r),o,"path"===a)),[t,r,o,a])}function rt(t,n,a){et()||k(!1);let{navigator:i}=e.useContext(X),{matches:o}=e.useContext(Z),r=o[o.length-1],l=r?r.params:{},s=(r&&r.pathname,r?r.pathnameBase:"/");r&&r.route;let m,c=nt();if(n){var u;let t="string"==typeof n?y(n):n;"/"===s||(null==(u=t.pathname)?void 0:u.startsWith(s))||k(!1),m=t}else m=c;let g=m.pathname||"/",p=w(t,{pathname:"/"===s?g:g.slice(s.length)||"/"}),h=function(t,n,a){var i;if(void 0===n&&(n=[]),void 0===a&&(a=null),null==t){var o;if(null==(o=a)||!o.errors)return null;t=a.matches}let r=t,l=null==(i=a)?void 0:i.errors;if(null!=l){let t=r.findIndex((t=>t.route.id&&(null==l?void 0:l[t.route.id])));t>=0||k(!1),r=r.slice(0,Math.min(r.length,t+1))}return r.reduceRight(((t,i,o)=>{let s=i.route.id?null==l?void 0:l[i.route.id]:null,m=null;a&&(m=i.route.errorElement||st);let c=n.concat(r.slice(0,o+1)),u=()=>{let n;return n=s?m:i.route.Component?e.createElement(i.route.Component,null):i.route.element?i.route.element:t,e.createElement(ct,{match:i,routeContext:{outlet:t,matches:c,isDataRoute:null!=a},children:n})};return a&&(i.route.ErrorBoundary||i.route.errorElement||0===o)?e.createElement(mt,{location:a.location,revalidation:a.revalidation,component:m,error:s,children:u(),routeContext:{outlet:null,matches:c,isDataRoute:!0}}):u()}),null)}(p&&p.map((t=>Object.assign({},t,{params:Object.assign({},l,t.params),pathname:B([s,i.encodeLocation?i.encodeLocation(t.pathname).pathname:t.pathname]),pathnameBase:"/"===t.pathnameBase?s:B([s,i.encodeLocation?i.encodeLocation(t.pathnameBase).pathname:t.pathnameBase])}))),o,a);return n&&h?e.createElement(Q.Provider,{value:{location:q({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:d.Pop}},h):h}function lt(){let t=function(){var t;let n=e.useContext(tt),a=function(t){let n=e.useContext(Y);return n||k(!1),n}(gt.UseRouteError),i=dt(gt.UseRouteError);return n||(null==(t=a.errors)?void 0:t[i])}(),n=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),a=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return e.createElement(e.Fragment,null,e.createElement("h2",null,"Unexpected Application Error!"),e.createElement("h3",{style:{fontStyle:"italic"}},n),a?e.createElement("pre",{style:i},a):null,null)}const st=e.createElement(lt,null);class mt extends e.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?e.createElement(Z.Provider,{value:this.props.routeContext},e.createElement(tt.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ct(t){let{routeContext:n,match:a,children:i}=t,o=e.useContext(V);return o&&o.static&&o.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=a.route.id),e.createElement(Z.Provider,{value:n},i)}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 n=function(t){let n=e.useContext(Z);return n||k(!1),n}(),a=n.matches[n.matches.length-1];return a.route.id||k(!1),a.route.id}function pt(t){let{to:n,replace:a,state:i,relative:o}=t;et()||k(!1);let{matches:r}=e.useContext(Z),{pathname:l}=nt(),s=it(),m=F(n,j(r).map((t=>t.pathnameBase)),l,"path"===o),c=JSON.stringify(m);return e.useEffect((()=>s(JSON.parse(c),{replace:a,state:i,relative:o})),[s,c,o,a,i]),null}function ht(t){k(!1)}function _t(t){let{basename:n="/",children:a=null,location:i,navigationType:o=d.Pop,navigator:r,static:l=!1}=t;et()&&k(!1);let s=n.replace(/^\/*/,"/"),m=e.useMemo((()=>({basename:s,navigator:r,static:l})),[s,r,l]);"string"==typeof i&&(i=y(i));let{pathname:c="/",search:u="",hash:g="",state:p=null,key:h="default"}=i,_=e.useMemo((()=>{let t=L(c,s);return null==t?null:{location:{pathname:t,search:u,hash:g,state:p,key:h},navigationType:o}}),[s,c,u,g,p,h,o]);return null==_?null:e.createElement(X.Provider,{value:m},e.createElement(Q.Provider,{children:a,value:_}))}function kt(t){let{children:e,location:n}=t;return rt(ft(e),n)}function ft(t,n){void 0===n&&(n=[]);let a=[];return e.Children.forEach(t,((t,i)=>{if(!e.isValidElement(t))return;let o=[...n,i];if(t.type===e.Fragment)return void a.push.apply(a,ft(t.props.children,o));t.type!==ht&&k(!1),t.props.index&&t.props.children&&k(!1);let r={id:t.props.id||o.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&&(r.children=ft(t.props.children,o)),a.push(r)})),a}function Et(){return Et=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0||(i[n]=t[n]);return i}e.startTransition,new Promise((()=>{})),e.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=e.startTransition;function wt(t){let{basename:n,children:a,future:i,window:o}=t,r=e.useRef();var l;null==r.current&&(r.current=(void 0===(l={window:o,v5Compat:!0})&&(l={}),function(t,e,n,a){void 0===a&&(a={});let{window:i=document.defaultView,v5Compat:o=!1}=a,r=i.history,l=d.Pop,s=null,m=c();function c(){return(r.state||{idx:null}).idx}function u(){l=d.Pop;let t=c(),e=null==t?null:t-m;m=t,s&&s({action:l,location:p.location,delta:e})}function g(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(_,u),s=t,()=>{i.removeEventListener(_,u),s=null}},createHref(t){return e(i,t)},createURL:g,encodeLocation(t){let e=g(t);return{pathname:e.pathname,search:e.search,hash:e.hash}},push:function(t,e){l=d.Push;let a=v(p.location,t,e);n&&n(a,t),m=c()+1;let u=E(a,m),g=p.createHref(a);try{r.pushState(u,"",g)}catch(t){if(t instanceof DOMException&&"DataCloneError"===t.name)throw t;i.location.assign(g)}o&&s&&s({action:l,location:p.location,delta:1})},replace:function(t,e){l=d.Replace;let a=v(p.location,t,e);n&&n(a,t),m=c();let i=E(a,m),u=p.createHref(a);r.replaceState(i,"",u),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)+")")}),l)));let s=r.current,[m,c]=e.useState({action:s.action,location:s.location}),{v7_startTransition:u}=i||{},g=e.useCallback((t=>{u&&xt?xt((()=>c(t))):c(t)}),[c,u]);return e.useLayoutEffect((()=>s.listen(g)),[s,g]),e.createElement(_t,{basename:n,children:a,location:m.location,navigationType:m.action,navigator:s})}const St="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Nt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ct=e.forwardRef((function(t,n){let a,{onClick:i,relative:o,reloadDocument:r,replace:l,state:s,target:m,to:c,preventScrollReset:u}=t,g=vt(t,bt),{basename:d}=e.useContext(X),p=!1;if("string"==typeof c&&Nt.test(c)&&(a=c,St))try{let t=new URL(window.location.href),e=c.startsWith("//")?new URL(t.protocol+c):new URL(c),n=L(e.pathname,d);e.origin===t.origin&&null!=n?c=n+e.search+e.hash:p=!0}catch(t){}let h=function(t,n){let{relative:a}=void 0===n?{}:n;et()||k(!1);let{basename:i,navigator:o}=e.useContext(X),{hash:r,pathname:l,search:s}=ot(t,{relative:a}),m=l;return"/"!==i&&(m="/"===l?i:B([i,l])),o.createHref({pathname:m,search:s,hash:r})}(c,{relative:o}),_=function(t,n){let{target:a,replace:i,state:o,preventScrollReset:r,relative:l}=void 0===n?{}:n,s=it(),m=nt(),c=ot(t,{relative:l});return e.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,a)){e.preventDefault();let n=void 0!==i?i:b(m)===b(c);s(t,{replace:n,state:o,preventScrollReset:r,relative:l})}}),[m,s,c,i,o,a,t,r,l])}(c,{replace:l,state:s,target:m,preventScrollReset:u,relative:o});return e.createElement("a",Et({},g,{href:a||h,onClick:p||r?i:function(t){i&&i(t),t.defaultPrevented||_(t)},ref:n,target:m}))})),Tt=e.forwardRef((function(t,n){let{"aria-current":a="page",caseSensitive:i=!1,className:o="",end:r=!1,style:l,to:s,children:m}=t,c=vt(t,yt),u=ot(s,{relative:c.relative}),g=nt(),d=e.useContext(Y),{navigator:p}=e.useContext(X),h=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=g.pathname,k=d&&d.navigation&&d.navigation.location?d.navigation.location.pathname:null;i||(_=_.toLowerCase(),k=k?k.toLowerCase():null,h=h.toLowerCase());let f,E=_===h||!r&&_.startsWith(h)&&"/"===_.charAt(h.length),v=null!=k&&(k===h||!r&&k.startsWith(h)&&"/"===k.charAt(h.length)),b=E?a:void 0;f="function"==typeof o?o({isActive:E,isPending:v}):[o,E?"active":null,v?"pending":null].filter(Boolean).join(" ");let y="function"==typeof l?l({isActive:E,isPending:v}):l;return e.createElement(Ct,Et({},c,{"aria-current":b,className:f,ref:n,style:y,to:s}),"function"==typeof m?m({isActive:E,isPending:v}):m)}));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,c.__)("Dashboard","gtm-kit")},{to:"container",title:(0,c.__)("Container","gtm-kit")},{to:"post-data",title:(0,c.__)("Post data","gtm-kit")},{to:"user-data",title:(0,c.__)("User data","gtm-kit")},{to:"google-consent-mode",title:(0,c.__)("Google Consent Mode","gtm-kit")},{to:"misc",title:(0,c.__)("Misc","gtm-kit")},{to:"whats-new",title:(0,c.__)("What's New","gtm-kit")}],n=[{to:"integrations",title:(0,c.__)("Integrations","gtm-kit")},{to:"woocommerce",title:"WooCommerce"},{to:"cf7",title:"Contact Form 7"},{to:"edd",title:"Easy Digital Downloads"}],a=[{to:"help",title:(0,c.__)("Help","gtm-kit")},{to:"support",title:(0,c.__)("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,c.__)("Settings","gtm-kit");switch(t){case"general":n=(0,c.__)("Settings","gtm-kit");break;case"integrations":n=(0,c.__)("Integrations","gtm-kit");break;case"help":n=(0,c.__)("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),Ft=n().createContext(null),Bt=function(t){return t.scrollTop},Ht="unmounted",Kt="exited",Jt="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=Kt,a.appearStatus=Jt):i=zt:i=e.unmountOnExit||e.mountOnEnter?Ht:Kt,a.state={status:i},a.nextCallback=null,a}At(e,t),e.getDerivedStateFromProps=function(t,e){return t.in&&e.status===Ht?{status:Kt}:null};var a=e.prototype;return a.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},a.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==Jt&&n!==zt&&(e=Jt):n!==Jt&&n!==zt||(e=$t)}this.updateStatus(!1,e)},a.componentWillUnmount=function(){this.cancelNextCallback()},a.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}},a.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e)if(this.cancelNextCallback(),e===Jt){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===Kt&&this.setState({status:Ht})},a.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:Jt},(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)}))},a.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:Kt},(function(){t.props.onExited(a)}))}))}))):this.safeSetState({status:Kt},(function(){t.props.onExited(a)}))},a.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},a.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},a.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},a.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)},a.render=function(){var t=this.state.status;if(t===Ht)return null;var e=this.props,a=e.children,i=(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 n().createElement(Ft.Provider,{value:null},"function"==typeof a?a(t,i):n().cloneElement(n().Children.only(a),i))},e}(n().Component);function Vt(){}qt.contextType=Ft,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=Ht,qt.EXITED=Kt,qt.ENTERING=Jt,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:o,useIsPending:r,useCanSave:l}=(0,a.useContext)(g);return(0,e.createElement)(i.Button,{className:n,onClick:()=>o(),variant:"primary",disabled:r||!l},l?(0,c.__)(t,"gtm-kit"):(0,c.__)("Saved","gtm-kit"),r?(0,e.createElement)(i.Spinner,null):"")},ee=()=>{const{useCanSave:t}=(0,a.useContext)(g);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,c.__)("Active","gtm-kit"):(0,c.__)("Inactive","gtm-kit"))};const ae=(0,a.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:n,newTab:a=!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)(i.Button,{variant:"primary",className:"gtmkit-rounded !gtmkit-py-4 !gtmkit-px-8 gtmkit-w-full",onClick:()=>{n&&t&&!1===a?window.gtmkitSettings.current_poage===r?s(n,{replace:!0}):window.location.href=t+"#"+n:t?a?window.open(t):window.location.href=t:s(n,{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:i=""})=>{const{useSettings:o}=(0,a.useContext)(g);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] "+i},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:o[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,c.__)("Read article","gtm-kit"),newTab:t.link.external,group:t.group}))))))};const re=[{title:"Woocommerce",pill:!0,group:"integrations",option:"woocommerce_integration",text:[(0,c.__)("The #1 open source eCommerce platform built for WordPress","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/woocommerce",text:(0,c.__)("Setup integration","gtm-kit")}},{title:"Contact Form 7",pill:!0,group:"integrations",option:"cf7_integration",text:[(0,c.__)("Just another contact form plugin for WordPress. Simple but flexible","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/cf7",text:(0,c.__)("Setup integration","gtm-kit")}},{title:"Easy Digital Downloads",pill:!0,group:"integrations",option:"edd_integration",text:[(0,c.__)("Easy way to sell Digital Products With WordPress","gtm-kit")],link:{internal:!0,url:window.gtmkitSettings.integrationsUrl,destination:"/edd",text:(0,c.__)("Setup integration","gtm-kit")}}],le=[{title:"Getting started with GTM Kit",text:[(0,c.__)("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,c.__)("WooCommerce integration","gtm-kit"),text:[(0,c.__)("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,c.__)("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,c.__)("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,c.__)("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,c.__)("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,a.useContext)(g),n=le;return n.push({title:(0,c.__)("See all tutorials…","gtm-kit"),text:[(0,c.__)("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,c.__)("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,c.__)("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,c.__)("Container ID:","gtm-kit")," ",t&&t.general.gtm_id):(0,e.createElement)("p",null,(0,c.__)("The container is not active but the datalayer is generated.","gtm-kit"))),(0,e.createElement)(ie.Button,{destination:"/container",text:(0,c.__)("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,c.__)("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,c.__)("Share anonymous data with the development team to help improve GTM Kit.","gtm-kit"))),(0,e.createElement)(ie.Button,{destination:"/misc",text:(0,c.__)("Share anonymous data","gtm-kit")}))),(0,e.createElement)(oe,{title:(0,c.__)("Tutorials","gtm-kit"),data:n}),(0,e.createElement)(oe,{title:(0,c.__)("Integrations","gtm-kit"),data:re}))},me=({title:t,placeholder:n,help:o,className:r="gtmkit-settings-field-wrap gtmkit-py-4 gtmkit-max-w-md",optionGroup:l="general",optionName:s,pluginInactive:m})=>{const{useSettings:c,useUpdateStateSettings:u}=(0,a.useContext)(g);return(0,e.createElement)(i.TextControl,{label:t,placeholder:n,help:o,className:r,value:c&&c[l][s],onChange:t=>u(l,s,t),disabled:m})},ce=({title:t,label:n,optionGroup:o="general",optionName:r,disabled:l=!1})=>{const{useSettings:s,useUpdateStateSettings:m}=(0,a.useContext)(g);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)("div",{className:"gtmkit-settings-field-wrap gtmkit-py-4"},(0,e.createElement)(i.BaseControl,{label:t},(0,e.createElement)(i.ToggleControl,{label:n,checked:!l&&s[o][r],onChange:()=>{m(o,r,!(s&&s[o][r]))},disabled:l}))))},ue=({title:t,options:n,help:o,className:r="gtmkit-settings-field-wrap gtmkit-py-4",optionGroup:l="general",optionName:s,disabled:m})=>{const{useSettings:c,useUpdateStateSettings:u}=(0,a.useContext)(g);return(0,e.createElement)(i.RadioControl,{label:t,options:n,help:o,className:r,selected:parseInt(c[l][s]),onChange:t=>u(l,s,t),disabled:m})};const ge=(0,a.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,c.__)("Google Tag Manager container","gtm-kit")),(0,e.createElement)(de,null,(0,e.createElement)(de.Header,{title:(0,c.__)("Google Tag Manager container code","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)("p",{className:"gtmkit-mb-4"},(0,c.__)("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,c.__)("Container ID:","gtm-kit"),optionName:"gtm_id",placeholder:(0,c.__)("Enter Container ID","gtm-kit")}),(0,e.createElement)(ce,{title:(0,c.__)("Inject Container Code","gtm-kit"),label:(0,c.__)("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,c.__)("Just the container","gtm-kit"),label:(0,c.__)("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,c.__)("dataLayer variable name:","gtm-kit"),optionName:"datalayer_name",placeholder:"dataLayer",help:(0,c.__)("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,c.__)("GTM Server Side","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)(me,{title:(0,c.__)("GTM Server Side Domain:","gtm-kit"),optionName:"sgtm_domain",placeholder:(0,c.__)("Enter domain …","gtm-kit"),help:(0,c.__)("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,c.__)("sGTM container identifier:","gtm-kit"),optionName:"sgtm_container_identifier",placeholder:(0,c.__)("Enter loader name …","gtm-kit"),help:(0,c.__)("Only use if you are using a custom loader.","gtm-kit")}))),(0,e.createElement)(de,null,(0,e.createElement)(de.Header,{title:(0,c.__)("Container Code Implementation","gtm-kit")}),(0,e.createElement)(de.Content,null,(0,e.createElement)(ue,{title:(0,c.__)("Container code implementation:","gtm-kit"),options:[{label:(0,c.__)("Standard implementation as recommended by Google (no delay)","gtm-kit"),value:0},{label:(0,c.__)("Load container when browser is idle (requestIdleCallback)","gtm-kit"),value:1}],help:(0,c.__)("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,c.__)("Container code noscript implementation:","gtm-kit"),options:[{label:(0,c.__)("Just after the opening tag","gtm-kit"),value:0},{label:(0,c.__)("Footer of the page (not recommended by Google)","gtm-kit"),value:1},{label:(0,c.__)("Custom (insert function in your template)","gtm-kit"),value:2},{label:(0,c.__)("Disable