initial
This commit is contained in:
commit
9883323161
17470 files changed
+4470592
No files matched your search
+1
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_automattic_woocommerce_analytics=self.webpackChunk_automattic_woocommerce_analytics||[]).push([[252],{252:(c,o,t)=>{function n(c){jQuery(".woocommerce-MyAccount-navigation-link--customer-logout").on("click",function(){c("my_account_tab_click",{tab:"logout"})})}t.r(o),t.d(o,{initListeners:()=>n})}}]);
|
||||
+1
@@ -0,0 +1 @@
|
||||
"use strict";(self.webpackChunk_automattic_woocommerce_analytics=self.webpackChunk_automattic_woocommerce_analytics||[]).push([[591],{591:(e,i,t)=>{var n=t(37),s=t.n(n);const o="woocommerceanalytics_session",a=/^[a-z_][a-z0-9_]*$/,r=s()("wc-analytics:api-client");class c{eventQueue=[];debounceTimer=null;isInitialized=!1;init=()=>{this.isInitialized||(r("API client initialized"),window.addEventListener("beforeunload",this.flush),window.addEventListener("pagehide",this.flush),this.isInitialized=!0)};addEvent=(e,i={})=>{if(!this.isInitialized)return void r("API client not initialized, skipping event: %s",e);r('Recording event via API: "%s" with props %o',e,i);const t={event_name:e,properties:i};this.eventQueue.push(t),r("Event added to queue: %s (queue size: %d)",e,this.eventQueue.length),this.debouncedSend(),this.eventQueue.length>=10&&this.flush()};debouncedSend=()=>{this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.flush()},1e3)};sendEventsViaBeacon=e=>{if("undefined"==typeof navigator||!navigator.sendBeacon)return r("Beacon API not available"),!1;try{const i=JSON.stringify(e),t=new Blob([i],{type:"application/json"});return navigator.sendBeacon(window.wcAnalytics.trackEndpoint,t)}catch(e){return r("Beacon API failed: %o",e),!1}};flush=()=>{if(this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),0===this.eventQueue.length)return;const e=[...this.eventQueue];this.eventQueue=[],window.wcAnalytics?.trackEndpoint?this.sendEventsViaBeacon(e)?r("Sent %d events via Beacon API",e.length):(r("Failed to send events via Beacon API, falling back to fetch with keepalive"),this.sendEvents(e)):r("Track endpoint not available")};sendEvents=async e=>{if(0!==e.length)try{r("Sending %d events to API",e.length);const i=await fetch(window.wcAnalytics.trackEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0,credentials:"same-origin"});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const t=await i.json();r("API response received: %o",t)}catch(i){r("Failed to send events to API: %o",i),this.eventQueue.unshift(...e)}}}var d=t(771);function h(e){const i=`; ${document.cookie}`.split(`; ${e}=`);return 2===i.length&&i.pop()?.split(";").shift()||null}const l=s()("wc-analytics:analytics");class u{constructor(e,{eventQueue:i=[],commonProps:t={},features:n={},pages:s={}}){this.isInitialized=!1,this.sessionManager=e,this.apiClient=new c,this.eventQueue=i,this.commonProps=t,this.features=n,this.pages=s}init=()=>{if(!this.isInitialized){if(this.features.proxy&&this.apiClient.init(),this.features.sessionTracking){d.K.addConsentChangeListener(this.handleConsentChange),this.sessionManager.init();const{sessionId:e,landingPage:i,isNewSession:t}=this.sessionManager;this.features.proxy||(this.commonProps={...this.commonProps,session_id:e,landing_page:i}),t?this.maybeRecordSessionStartedEvent():this.maybeRecordEngagementEvent(),this.recordEvent("page_view")}this.maybeSetAnonId(),this.processEventQueue(),this.initListeners(),this.isInitialized=!0}};initListeners=()=>{this.pages.isAccountPage&&t.e(252).then(t.bind(t,252)).then(({initListeners:e})=>{e(this.recordEvent)})};processEventQueue=()=>{for(const e of this.eventQueue)this.recordEvent(e.eventName,e.props)};recordEvent=(e,i={})=>{if(!d.K.hasAnalyticsConsent())return void l("Skipping event recording due to lack of statistics consent: %s",e);if("string"!=typeof e||!a.test(e))return void l("Skipping event recording because event name is not valid");const t={...this.commonProps,...i};this.features.ch?t.ch=1:delete t.ch,this.features.proxy?(this.addClientProperties(t),this.apiClient.addEvent(e,t)):this.fireDirectPixel(e,t),this.isInitialized&&this.maybeRecordEngagementEvent()};fireDirectPixel=(e,i)=>{window._wca?(l('Recording event via _wca: "%s" with props %o',e,i),i._en=`woocommerceanalytics_${e}`,window._wca.push(i)):l("Skipping event recording because _wca is not defined")};addClientProperties=e=>{const i=new Date;e._ts=i.getTime(),e._tz=i.getTimezoneOffset()/60;const t=window.navigator,n=window.screen;e._lg=t.language,e._pf=navigator?.platform,e._ht=n.height,e._wd=n.width;const s=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body).scrollLeft,o=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body).scrollTop;e._sx=void 0!==s?s:0,e._sy=void 0!==o?o:0,void 0!==document.location&&(e._dl=document.location.toString()),void 0!==document.referrer&&(e._dr=document.referrer)};maybeRecordSessionStartedEvent=()=>{this.features.sessionTracking&&this.sessionManager.isNewSession&&this.sessionManager.sessionId&&this.recordEvent("session_started")};maybeRecordEngagementEvent=()=>{this.features.sessionTracking&&!this.sessionManager.isEngaged&&this.sessionManager.sessionId&&(this.sessionManager.setEngaged(),this.recordEvent("session_engagement"))};handleConsentChange=e=>{e?this.sessionManager.sessionId||thiLine truncated
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '8d8bb846cc19ac858460');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{var e,t,n={771:(e,t,n)=>{"use strict";n.d(t,{K:()=>a});var r=n(37);const s=n.n(r)()("wc-analytics:consent"),o="statistics",a=new class{consentListeners=[];isListenerInitialized=!1;isWpConsentApiAvailable(){return"function"==typeof window.wp_has_consent}hasAnalyticsConsent(){if(!this.isWpConsentApiAvailable())return s("WP Consent API not available, defaulting to true for backward compatibility"),!0;const e=window.wp_has_consent(o);return s("Analytics consent status:",e),e}addConsentChangeListener(e){this.consentListeners.push(e),this.initializeConsentListener()}initializeConsentListener(){!this.isListenerInitialized&&this.isWpConsentApiAvailable()&&(s("Initializing consent change listener"),document.addEventListener("wp_listen_for_consent_change",e=>{const t=e.detail;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&e===o&&this.notifyListeners("allow"===t[e])}),this.isListenerInitialized=!0)}notifyListeners(e){this.consentListeners.forEach(t=>{try{t(e)}catch(e){s("Error in consent change listener:",e)}})}}},466:(e,t,n)=>{"object"==typeof window&&window.wcAnalytics?.assets_url&&(n.p=window.wcAnalytics.assets_url)},37:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,s=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(s=r))}),t.splice(s,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(588)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},588:(e,t,n)=>{e.exports=function(e){function t(e){let n,s,o,a=null;function i(...e){if(!i.enabled)return;const r=i,s=Number(new Date),o=s-(n||s);r.diff=o,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,s)=>{if("%%"===n)return"%";a++;const o=t.formatters[s];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n}),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return i.namespace=e,i.useColors=t.useColors(),i.color=t.selectColor(e),i.extend=r,i.destroy=t.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(s!==t.namespaces&&(s=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(i),i}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function s(e,t){let n=0,r=0,s=-1,o=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(s=r,o=n,r++):(n++,r++);else{if(-1===s)return!1;r=s+1,o++,n=o}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,..Line truncated
|
||||
Reference in new issue
Block a user