@seaverse/track-sdk 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/track-sdk.umd.js +606 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install @seaverse/track-sdk
|
|
|
21
21
|
|
|
22
22
|
## 快速开始
|
|
23
23
|
|
|
24
|
-
###
|
|
24
|
+
### 方式 1:npm 包引入(推荐)
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
27
|
import { TrackClient } from '@seaverse/track-sdk';
|
|
@@ -43,6 +43,50 @@ await trackClient.track('button_click', {
|
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
### 方式 2:浏览器 script 标签引入
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<!DOCTYPE html>
|
|
50
|
+
<html>
|
|
51
|
+
<head>
|
|
52
|
+
<!-- 引入 SDK -->
|
|
53
|
+
<script src="https://unpkg.com/@seaverse/track-sdk/dist/track-sdk.umd.js"></script>
|
|
54
|
+
</head>
|
|
55
|
+
<body>
|
|
56
|
+
<div id="root"></div>
|
|
57
|
+
|
|
58
|
+
<script>
|
|
59
|
+
(function() {
|
|
60
|
+
// 通过全局变量 SeaVerseTrack 访问 SDK
|
|
61
|
+
var TrackClient = SeaVerseTrack.TrackClient;
|
|
62
|
+
|
|
63
|
+
// 创建客户端
|
|
64
|
+
var trackClient = new TrackClient({
|
|
65
|
+
token: 'prod_2f8a9c1b4e3d',
|
|
66
|
+
platform: 'web',
|
|
67
|
+
version: '1.0.0',
|
|
68
|
+
debug: true
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// 初始化
|
|
72
|
+
trackClient.initialize().then(function() {
|
|
73
|
+
console.log('Track SDK 已初始化');
|
|
74
|
+
|
|
75
|
+
// 手动埋点
|
|
76
|
+
trackClient.track('page_view', {
|
|
77
|
+
page: 'home',
|
|
78
|
+
title: '首页'
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 导出到全局,方便后续使用
|
|
83
|
+
window.trackClient = trackClient;
|
|
84
|
+
})();
|
|
85
|
+
</script>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
88
|
+
```
|
|
89
|
+
|
|
46
90
|
## API 文档
|
|
47
91
|
|
|
48
92
|
### TrackClient
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("firebase/app"),e=require("firebase/analytics");function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,Object.freeze(e)}var s,i,r=n(require("sa-sdk-javascript"));function o(t,e){return t-=487,a()[t]}function a(){var t=["SENSORS","1146654tyqhKq","10nlCwks","6YRrjUI","12039401HatPBV","72XvwdCb","10434uhteMd","firebase","44156RUyLGb","sensors","1213328lFGCjJ","583857SmdTeC","367678UKKoWY","1925czWzEC","FIREBASE"];return(a=function(){return t})()}function c(){const t=["https://www.googletagmanager.com/ns.html?id=","640618RtkATm","5771596YgzVZB","undefined","error","3mWjXTI","[GTM] GTM ID is empty, skip injection","noscript","DOMContentLoaded","[GTM] Injected successfully: ","head","insertBefore","1368xVdMEr","from","string","[GoogleTagManager] dataLayer not initialized","[GTM] Injection failed:","push","[GoogleTagManager] Invalid event name:","some","createElement","display","firstChild","7112346RRSoLx","gtm.js?id=","body","dataLayer","script","warn","1180fRRVLg","height","addEventListener","https://www.googletagmanager.com/gtm.js?id=","iframe","log","[GTM] Not in browser environment, skip injection","getElementsByTagName","3049958NkRDxS","visibility","appendChild","5AodEsl","getTime","src","includes","79576OEnzmY","[GTM] Already injected, skip","style","[GoogleTagManager] Error pushing to dataLayer:","async","5539044VErsko","querySelectorAll","1133644CGkfOH","none","parentNode"];return(c=function(){return t})()}function l(){return typeof window!==p(200)&&"undefined"!=typeof document}function p(t,e){t-=187;return c()[t]}function d(t){const e=p,n=document.createElement(e(204)),s=document[e(217)](e(230));s[e(239)]=e(197)+t,s[e(227)]="0",s.width="0",s[e(189)][e(218)]=e(195),s[e(189)][e(235)]="hidden",n[e(236)](s),document[e(222)][e(219)]?document[e(222)][e(208)](n,document[e(222)][e(219)]):document[e(222)].appendChild(n)}function f(t,e=!1){const n=p;if(l())if(t)if(function(t){const e=p;if(!l())return!1;const n=!!window[e(223)],s=document[e(193)](e(224)),i=Array[e(210)](s)[e(216)](n=>n[e(239)][e(240)](e(221)+t));return n&&i}(t))e&&console[n(231)](n(188));else try{(function(t){const e=p;window[e(223)]=window[e(223)]||[],window[e(223)][e(214)]({"gtm.start":(new Date)[e(238)](),event:"gtm.js"});const n=document[e(217)](e(224));n[e(191)]=!0,n[e(239)]=e(229)+t;const s=document[e(233)](e(224))[0];s&&s[e(196)]?s[e(196)][e(208)](n,s):document[e(207)][e(236)](n)})(t),document[n(222)]?d(t):document[n(228)](n(205),()=>{d(t)}),e&&console[n(231)](n(206)+t)}catch(t){console[n(201)](n(213),t)}else e&&console[n(225)](n(203));else e&&console[n(225)](n(232))}!function(){for(var t=o,e=a();;)try{if(582763===-parseInt(t(488))/1+-parseInt(t(489))/2*(-parseInt(t(495))/3)+parseInt(t(487))/4+parseInt(t(490))/5*(-parseInt(t(498))/6)+-parseInt(t(500))/7*(parseInt(t(497))/8)+parseInt(t(493))/9+-parseInt(t(494))/10*(-parseInt(t(496))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),exports.TrackProvider=void 0,(s=exports.TrackProvider||(exports.TrackProvider={}))[(i=o)(491)]=i(499),s[i(492)]=i(501),function(){const t=p,e=c();for(;;)try{if(864519===-parseInt(t(194))/1+parseInt(t(234))/2*(-parseInt(t(202))/3)+parseInt(t(199))/4*(-parseInt(t(237))/5)+-parseInt(t(220))/6+parseInt(t(192))/7+parseInt(t(187))/8*(-parseInt(t(209))/9)+parseInt(t(226))/10*(parseInt(t(198))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const h=(t,e)=>{const n=p;if(!t||typeof t!==n(211))return void console[n(201)](n(215),t);(t=>{const e=p;if(typeof window!==e(200)&&window[e(223)])try{window[e(223)].push(t),console[e(231)]("[GoogleTagManager] Pushed to dataLayer:",t)}catch(t){console[e(201)](e(190),t)}else console.error(e(212))})({event:t,...e||{}})},u=m;function I(){const t=["18FZZtQY","debug","700bgNZwQ","error","2286tuPkXP","config","initialize","138120PWZQKy","206773GptbWp","gtmId","firebase initialize failed:","150HXAivI","2573968DFuAOj","track","setUserId","initialized","935CxswzO","1415SANPrR","analytics","14468QYfXpR","23632476ouRicX","2639868LReoTB","setUserProperties"];return(I=function(){return t})()}function m(t,e){t-=378;return I()[t]}!function(){const t=m,e=I();for(;;)try{if(942241===-parseInt(t(388))/1*(-parseInt(t(386))/2)+parseInt(t(382))/3+parseInt(t(380))/4*(parseInt(t(378))/5)+-parseInt(t(395))/6*(-parseInt(t(392))/7)+parseInt(t(396))/8*(parseInt(t(384))/9)+-parseInt(t(391))/10*(parseInt(t(400))/11)+-parseInt(t(381))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class w{constructor(t,e,n=!1){const s=m;this[s(379)]=null,this.initialized=!1,this.config=t,this[s(393)]=e,this[s(385)]=n}async[u(390)](){const n=u;if(!this[n(399)])try{const s=t.initializeApp(this[n(389)]);this[n(379)]=e.getAnalytics(s),this[n(393)]&&f(this[n(393)],this[n(385)]),this[n(399)]=!0}catch(t){throw console[n(387)](n(394),t),t}}async[u(397)](t,e){}async[u(398)](t){}async[u(383)](t){}async clearUserId(){}}function k(){const t=["setProfile","config","11294sjMMdj","1978938nmWEDm","initialized","762160ojZOiE","3584zAhxXy","login","sensors sdk init failed:","ajax","sensors sdk clearUserId failed:","sensors sdk setUserProperties failed:","30FsDgRb","?t=","sensors sdk track failed:","showLog","sensors sdk not initialized, skip setUserProperties","sensors","platform","&v=","sensors sdk not initialized, skip setUserId","token","logout","1190484fKqUHH","clearUserId","serverUrl","144FSCrfE","version","autoTrack","track","2341889dLAaZa","warn","setUserProperties","sensors sdk not initialized, skip track","error","init","heatmap","3sRLQwu","29ucSzEm","sensors sdk not found, please install it by running","495642PTzYnZ"];return(k=function(){return t})()}const y=g;function g(t,e){t-=434;return k()[t]}!function(){const t=g,e=k();for(;;)try{if(152940===parseInt(t(455))/1*(-parseInt(t(460))/2)+parseInt(t(454))/3*(-parseInt(t(440))/4)+-parseInt(t(463))/5+-parseInt(t(457))/6+parseInt(t(464))/7*(-parseInt(t(443))/8)+parseInt(t(461))/9+-parseInt(t(470))/10*(-parseInt(t(447))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class v{constructor(t,e,n,s){const i=g;this[i(434)]=null,this[i(462)]=!1,this[i(438)]=t,this[i(435)]=e,this[i(444)]=n,this[i(459)]=s}async initialize(){const t=g;if(!this[t(462)])try{if(!r)throw new Error(t(456));this[t(434)]=r;const e=encodeURIComponent(this[t(438)]),n=encodeURIComponent(this[t(435)]),s=encodeURIComponent(this.version);this[t(434)][t(452)]({server_url:this[t(459)][t(442)]+(t(471)+e+"&p=")+n+t(436)+s,show_log:this[t(459)][t(473)]??!1,heatmap:this[t(459)][t(453)]??{},is_track_single_page:!0,send_type:t(467)}),this[t(462)]=!0,this[t(434)].quick(t(445))}catch(e){throw console.error(t(466),e),e}}async track(t,e){const n=g;if(this[n(462)]&&this.sensors)try{this.sensors[n(446)](t,e??{})}catch(t){console[n(451)](n(472),t)}else console[n(448)](n(450))}async setUserId(t){const e=g;if(this.initialized&&this[e(434)])try{this[e(434)][e(465)](t)}catch(t){console[e(451)]("sensors sdk setUserId failed:",t)}else console[e(448)](e(437))}async[y(449)](t){const e=y;if(this[e(462)]&&this[e(434)])try{this[e(434)][e(458)](t)}catch(t){console[e(451)](e(469),t)}else console.warn(e(474))}async[y(441)](){const t=y;if(this[t(462)]&&this[t(434)])try{this[t(434)][t(439)]()}catch(e){console[t(451)](t(468),e)}}}function z(){var t=["354678dogvAx","btoa","359526ttsFxQ","from","21987130Tpiajt","664182NOyIiu","49xKmsyL","toString","utf-8","379490LZXEay","1100760TSqOmK","4ijpxah","undefined","537210ZXHEiG","atob","base64","48qWMHBu"];return(z=function(){return t})()}function Z(t,e){return t-=153,z()[t]}function b(t){var e=Z;return typeof window!==e(165)&&window.btoa?window[e(154)](t):Buffer.from(t,e(161))[e(160)](e(168))}function M(t){return JSON.parse((e=t,n=Z,"undefined"!=typeof window&&window[n(167)]?window[n(167)](e):Buffer[n(156)](e,n(168))[n(160)](n(161))));var e,n}!function(){for(var t=Z,e=z();;)try{if(291539===-parseInt(t(153))/1+-parseInt(t(158))/2+parseInt(t(163))/3*(-parseInt(t(164))/4)+-parseInt(t(162))/5+parseInt(t(155))/6*(-parseInt(t(159))/7)+-parseInt(t(169))/8*(parseInt(t(166))/9)+parseInt(t(157))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const T=E;function W(){const t=["invalid token: ","384198pYPvQh","324372WilpbA","1340245cvYdnw","152754uuOaag","SENSORS","3PPXWTF","28NhXTrG","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","473216CZJfaY","GTM-MJDRW2W4","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","2360610plEQbs","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","301116rZpfFW","FIREBASE"];return(W=function(){return t})()}function E(t,e){t-=333;return W()[t]}!function(){const t=E,e=W();for(;;)try{if(227035===parseInt(t(340))/1+-parseInt(t(343))/2+-parseInt(t(348))/3*(-parseInt(t(344))/4)+-parseInt(t(345))/5+parseInt(t(346))/6*(parseInt(t(333))/7)+-parseInt(t(335))/8+parseInt(t(338))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const Y={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[exports.TrackProvider[T(341)],exports.TrackProvider.SENSORS],firebaseConfig:M(T(334)),sensorsConfig:M("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19"),gtmId:T(336)},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[exports.TrackProvider[T(341)],exports.TrackProvider[T(347)]],firebaseConfig:M(T(339)),sensorsConfig:M(T(337))}};const N=R;function R(t,e){t-=143;return J()[t]}function J(){const t=["688465TpRXqg","platform","Must provide a version","firebaseConfig","gtmId","380181RHQacf","log","initializeFirebase","[Track] Clear User ID","FIREBASE"," adapter failed:","token","Track SDK initialized, enabled providers:","version","allSettled","unknown provider: ","20JCPGCX","keys","41433VwwrEk","push","initialize ","debug","platformConfig","initialize","setUserProperties","from","1289510udaYOk","track","Must provide a token","values","Invalid token: ","clearUserId","config","track SDK not initialized, please call initialize() first","warn","initialized","SENSORS","Must provide a platform","4352388KzorHn","1520001jpLeoe","set","50706IgcoHf","trackGTMEvent","validateConfig","providers","setUserId","sensorsConfig","1008JFOLfU","adapters"];return(J=function(){return t})()}!function(){const t=R,e=J();for(;;)try{if(369635===parseInt(t(184))/1+-parseInt(t(143))/2+parseInt(t(171))/3*(parseInt(t(182))/4)+parseInt(t(166))/5+-parseInt(t(155))/6+parseInt(t(156))/7+-parseInt(t(164))/8*(-parseInt(t(158))/9))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class TrackClient{constructor(t){const e=R;this[e(165)]=new Map,this.initialized=!1,this[e(149)]=t,this[e(160)](),this.platformConfig=function(t){const e=T,n=b(t),s=Y[n];if(!s)throw new Error(e(342)+t);return s}(t[e(177)])}[N(160)](){const t=N;if(!this[t(149)][t(177)])throw new Error(t(145));if(!this.config[t(167)])throw new Error(t(154));if(!this[t(149)][t(179)])throw new Error(t(168));if(!(b(this[t(149)].token)in Y))throw new Error(t(147)+this[t(149)][t(177)])}async[N(189)](){const t=N;if(this[t(152)])return;const e=[],n=!1!==this[t(149)][t(173)];for(const s of this[t(188)][t(161)])try{if(s===exports.TrackProvider[t(175)]&&!n){this[t(149)][t(187)]&&console[t(172)]("[Track] Skip Firebase initialization (initializeFirebase = false)");continue}let i;switch(s){case exports.TrackProvider.FIREBASE:i=new w(this[t(188)][t(169)],this[t(188)][t(170)],this[t(149)][t(187)]);break;case exports.TrackProvider[t(153)]:i=new v(this[t(149)][t(177)],this[t(149)][t(167)],this.config[t(179)],this[t(188)][t(163)]);break;default:console[t(151)](t(181)+s);continue}this.adapters[t(157)](s,i),e[t(185)](i[t(189)]())}catch(e){console.error(t(186)+s+t(176),e)}await Promise[t(180)](e),this.initialized=!0,this[t(149)][t(187)]&&console[t(172)](t(178),Array[t(191)](this[t(165)][t(183)]()))}async[N(144)](t,e){const n=N;if(!this[n(152)])return void console.warn(n(150));this[n(149)].debug&&console[n(172)]("[Track] "+t,e);const s=[];for(const i of this[n(165)].values())s[n(185)](i.track(t,e));await Promise.allSettled(s)}async[N(162)](t){const e=N;if(!this[e(152)])return void console[e(151)](e(150));this[e(149)][e(187)]&&console[e(172)]("[Track] Set User ID:",t);const n=[];for(const s of this[e(165)][e(146)]())n.push(s[e(162)](t));await Promise[e(180)](n)}async[N(190)](t){const e=N;if(!this[e(152)])return void console[e(151)](e(150));this[e(149)][e(187)]&&console[e(172)]("[Track] Set User Properties:",t);const n=[];for(const s of this[e(165)][e(146)]())n[e(185)](s[e(190)](t));await Promise[e(180)](n)}async[N(148)](){const t=N;if(!this[t(152)])return void console[t(151)]("track SDK not initialized, please call initialize() first");this[t(149)][t(187)]&&console.log(t(174));const e=[];for(const n of this[t(165)][t(146)]())e[t(185)](n[t(148)]());await Promise[t(180)](e)}getInitializedProviders(){const t=N;return Array[t(191)](this[t(165)][t(183)]())}[N(159)](t,e){h(t,e)}}function j(t,e){return t-=329,S()[t]}function S(){var t=["6196705GwhpAJ","1426217cdUrKE","684760FfrYQM","4448580BvamqL","3871042YoPffK","1989099RgqctH","3322020sfEcMR","6ewsuwv"];return(S=function(){return t})()}!function(){for(var t=j,e=S();;)try{if(986249===parseInt(t(332))/1+-parseInt(t(329))/2+-parseInt(t(336))/3+parseInt(t(334))/4+parseInt(t(331))/5*(parseInt(t(330))/6)+-parseInt(t(335))/7+parseInt(t(333))/8)break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),exports.TrackClient=TrackClient;
|
|
1
|
+
"use strict";var t=require("firebase/app"),e=require("firebase/analytics");function n(t){var e=Object.create(null);return t&&Object.keys(t).forEach(function(n){if("default"!==n){var s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,Object.freeze(e)}var s,i,r=n(require("sa-sdk-javascript"));function o(){var t=["18522cGSQUf","sensors","SENSORS","FIREBASE","firebase","4581890GopZCf","63uQdVIP","10765KvWOyJ","6uaZYHY","9636723KTXVmc","44mAFFyL","1665128QeXzOn","1036682HQGLeO","3907743grlJYR","780XglKIm"];return(o=function(){return t})()}function a(t,e){return t-=371,o()[t]}function c(t,e){t-=181;return d()[t]}function l(){const t=c;return typeof window!==t(198)&&typeof document!==t(198)}function d(){const t=["script","725334nHAhtB","log","style","[GTM] Not in browser environment, skip injection","undefined","85EsLsJl","583416nxPzsi","insertBefore","[GoogleTagManager] Invalid event name:","DOMContentLoaded","https://www.googletagmanager.com/ns.html?id=","firstChild","includes","[GTM] Injected successfully: ","async","width","appendChild","[GoogleTagManager] Pushed to dataLayer:","iframe","string","https://www.googletagmanager.com/gtm.js?id=","368kqPnAq","push","[GoogleTagManager] dataLayer not initialized","[GTM] GTM ID is empty, skip injection","src","display","dataLayer","1777293cPwipi","from","createElement","gtm.js?id=","body","3057480Kckbik","gtm.js","1364762FfAwAk","getTime","3qArzah","parentNode","warn","5972PwSnRc","querySelectorAll","error","hidden","62568HBytrk"];return(d=function(){return t})()}function f(t){const e=c,n=document[e(224)]("noscript"),s=document.createElement(e(212));s[e(219)]=e(204)+t,s.height="0",s[e(209)]="0",s.style[e(220)]="none",s[e(196)].visibility=e(191),n.appendChild(s),document.body[e(205)]?document[e(226)].insertBefore(n,document.body.firstChild):document.body[e(210)](n)}function p(t,e=!1){const n=c;if(l())if(t)if(function(t){const e=c;if(!l())return!1;const n=!!window[e(221)],s=document[e(189)]("script"),i=Array[e(223)](s).some(n=>n.src[e(206)](e(225)+t));return n&&i}(t))e&&console.log("[GTM] Already injected, skip");else try{(function(t){const e=c;window[e(221)]=window.dataLayer||[],window[e(221)].push({"gtm.start":(new Date)[e(184)](),event:e(182)});const n=document[e(224)]("script");n[e(208)]=!0,n.src=e(214)+t;const s=document.getElementsByTagName(e(193))[0];s&&s[e(186)]?s[e(186)][e(201)](n,s):document.head.appendChild(n)})(t),document[n(226)]?f(t):document.addEventListener(n(203),()=>{f(t)}),e&&console[n(195)](n(207)+t)}catch(t){console[n(190)]("[GTM] Injection failed:",t)}else e&&console[n(187)](n(218));else e&&console[n(187)](n(197))}!function(){for(var t=a,e=o();;)try{if(538881===parseInt(t(384))/1+-parseInt(t(372))/2*(-parseInt(t(378))/3)+-parseInt(t(371))/4*(-parseInt(t(379))/5)+-parseInt(t(380))/6*(parseInt(t(385))/7)+parseInt(t(383))/8+parseInt(t(381))/9+parseInt(t(377))/10*(-parseInt(t(382))/11))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),exports.TrackProvider=void 0,(s=exports.TrackProvider||(exports.TrackProvider={}))[(i=a)(375)]=i(376),s[i(374)]=i(373),function(){const t=c,e=d();for(;;)try{if(486449===parseInt(t(194))/1+parseInt(t(183))/2*(-parseInt(t(185))/3)+-parseInt(t(188))/4*(parseInt(t(199))/5)+parseInt(t(200))/6+-parseInt(t(222))/7+-parseInt(t(215))/8*(-parseInt(t(192))/9)+parseInt(t(181))/10)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const h=(t,e)=>{const n=c;if(!t||typeof t!==n(213))return void console[n(190)](n(202),t);(t=>{const e=c;if(typeof window!==e(198)&&window[e(221)])try{window[e(221)][e(216)](t),console[e(195)](e(211),t)}catch(t){console[e(190)]("[GoogleTagManager] Error pushing to dataLayer:",t)}else console[e(190)](e(217))})({event:t,...e||{}})},u=I;function I(t,e){t-=102;return m()[t]}!function(){const t=I,e=m();for(;;)try{if(675182===-parseInt(t(117))/1+parseInt(t(114))/2*(-parseInt(t(120))/3)+parseInt(t(102))/4+-parseInt(t(115))/5+parseInt(t(108))/6*(parseInt(t(118))/7)+-parseInt(t(119))/8+parseInt(t(105))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class k{constructor(t,e,n=!1){const s=I;this[s(113)]=null,this[s(116)]=!1,this[s(106)]=t,this[s(107)]=e,this[s(111)]=n}async initialize(){const n=I;if(!this[n(116)])try{const s=t.initializeApp(this.config);this[n(113)]=e.getAnalytics(s),this[n(107)]&&p(this[n(107)],this.debug),this[n(116)]=!0}catch(t){throw console[n(109)](n(110),t),t}}async[u(103)](t,e){}async[u(104)](t){}async setUserProperties(t){}async[u(112)](){}}function m(){const t=["initialized","1274703qsBMur","2828434lvKqRn","4460656dCtkfi","3sfVjxR","4028284kGGqau","track","setUserId","13773006JWPOyY","config","gtmId","18eZcBRC","error","firebase initialize failed:","debug","clearUserId","analytics","2361450CKFNHi","306995hUOLtV"];return(m=function(){return t})()}const y=w;function w(t,e){t-=438;return g()[t]}function g(){const t=["&p=","setProfile","config","logout","8868965iSHcNq","sensors sdk not initialized, skip setUserProperties","init","3430860ihMoRV","version","sensors sdk setUserId failed:","587754szUKlV","setUserProperties","39XdWqsg","quick","error","autoTrack","initialized","?t=","platform","sensors sdk not initialized, skip track","sensors sdk setUserProperties failed:","sensors sdk not found, please install it by running","login","&v=","171423yYXhri","1853339JDWfAH","591464CDTZIP","10lgKZGf","setUserId","heatmap","sensors sdk not initialized, skip setUserId","sensors","472IhurtC","warn","30109554sXEuzS","sensors sdk init failed:"];return(g=function(){return t})()}!function(){const t=w,e=g();for(;;)try{if(966836===parseInt(t(459))/1+parseInt(t(444))/2+parseInt(t(446))/3*(parseInt(t(460))/4)+-parseInt(t(438))/5+parseInt(t(441))/6+parseInt(t(458))/7*(parseInt(t(466))/8)+-parseInt(t(468))/9*(parseInt(t(461))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class z{constructor(t,e,n,s){const i=w;this[i(465)]=null,this[i(450)]=!1,this.token=t,this[i(452)]=e,this[i(442)]=n,this.config=s}async initialize(){const t=w;if(!this[t(450)])try{if(!r)throw new Error(t(455));this[t(465)]=r;const e=encodeURIComponent(this.token),n=encodeURIComponent(this.platform),s=encodeURIComponent(this[t(442)]);this.sensors[t(440)]({server_url:this[t(472)].serverUrl+(t(451)+e+t(470)+n+t(457)+s),show_log:this[t(472)].showLog??!1,heatmap:this[t(472)][t(463)]??{},is_track_single_page:!0,send_type:"ajax"}),this[t(450)]=!0,this[t(465)][t(447)](t(449))}catch(e){throw console.error(t(469),e),e}}async track(t,e){const n=w;if(this[n(450)]&&this[n(465)])try{this.sensors.track(t,e??{})}catch(t){console[n(448)]("sensors sdk track failed:",t)}else console[n(467)](n(453))}async[y(462)](t){const e=y;if(this[e(450)]&&this[e(465)])try{this.sensors[e(456)](t)}catch(t){console[e(448)](e(443),t)}else console[e(467)](e(464))}async[y(445)](t){const e=y;if(this[e(450)]&&this[e(465)])try{this[e(465)][e(471)](t)}catch(t){console[e(448)](e(454),t)}else console[e(467)](e(439))}async clearUserId(){const t=y;if(this.initialized&&this[t(465)])try{this[t(465)][t(473)]()}catch(e){console[t(448)]("sensors sdk clearUserId failed:",e)}}}function v(){var t=["btoa","undefined","1759257VRiHVJ","parse","10bEbHVZ","atob","3289825midXjw","utf-8","8472KUlUir","toString","1538388mDtBNz","5729275fURXLF","6UuyegU","from","5935128UmGklz","444cVdrUp","base64","737313LxPZDP"];return(v=function(){return t})()}function Z(t){var e=b;return"undefined"!=typeof window&&window[e(335)]?window[e(335)](t):Buffer[e(330)](t,e(324))[e(326)](e(333))}function b(t,e){return t-=321,v()[t]}function M(t){var e,n;return JSON[b(338)]((e=t,n=b,typeof window!==n(336)&&window[n(322)]?window[n(322)](e):Buffer[n(330)](e,n(333)).toString(n(324))))}!function(){for(var t=b,e=v();;)try{if(606829===-parseInt(t(334))/1+parseInt(t(327))/2+-parseInt(t(332))/3*(-parseInt(t(325))/4)+-parseInt(t(328))/5*(parseInt(t(329))/6)+parseInt(t(323))/7+parseInt(t(331))/8+-parseInt(t(337))/9*(-parseInt(t(321))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const W=J;function N(){const t=["42LQkoBc","GTM-MJDRW2W4","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","4517289WnHBGN","1642056FCFiKq","31684563sfZpWH","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","469815LSXeQN","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","205377vXHSKj","invalid token: ","1832784oOLdwL","10Ihjchf","FIREBASE","6689907WXdQiN","SENSORS"];return(N=function(){return t})()}!function(){const t=J,e=N();for(;;)try{if(788575===-parseInt(t(197))/1*(-parseInt(t(200))/2)+-parseInt(t(207))/3+-parseInt(t(192))/4+parseInt(t(195))/5*(-parseInt(t(204))/6)+-parseInt(t(202))/7+-parseInt(t(199))/8+parseInt(t(193))/9)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const T={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[exports.TrackProvider[W(201)],exports.TrackProvider[W(203)]],firebaseConfig:M(W(194)),sensorsConfig:M(W(196)),gtmId:W(205)},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[exports.TrackProvider[W(201)],exports.TrackProvider[W(203)]],firebaseConfig:M(W(206)),sensorsConfig:M("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19")}};function J(t,e){t-=192;return N()[t]}const S=C;function C(t,e){t-=289;return Y()[t]}function Y(){const t=["11KzUpfj","initialize ","values","2861395aMRkHQ","trackGTMEvent","82096bHYCMM","setUserId","1611IrvClk","debug","690ccTjFC","config","unknown provider: ","platformConfig","3671184fWegHe","validateConfig","keys","45598qwoyfx","63637MBuGPw","token","gtmId","639JDnwXF","Track SDK initialized, enabled providers:","initialize","Must provide a token","set","83963AekSXI","from","490IJvYSW","clearUserId","firebaseConfig","FIREBASE","adapters","[Track] Set User Properties:","getInitializedProviders","warn","[Track] Skip Firebase initialization (initializeFirebase = false)","track SDK not initialized, please call initialize() first","providers","initialized","error","[Track] Set User ID:","[Track] ","allSettled","push","708nadYKP","log","platform","setUserProperties"];return(Y=function(){return t})()}!function(){const t=C,e=Y();for(;;)try{if(555031===parseInt(t(326))/1*(parseInt(t(294))/2)+parseInt(t(333))/3*(parseInt(t(322))/4)+parseInt(t(329))/5+parseInt(t(335))/6*(parseInt(t(295))/7)+parseInt(t(331))/8*(-parseInt(t(298))/9)+parseInt(t(305))/10*(-parseInt(t(303))/11)+-parseInt(t(291))/12)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();class TrackClient{constructor(t){const e=C;this[e(309)]=new Map,this[e(316)]=!1,this[e(336)]=t,this[e(292)](),this.platformConfig=function(t){const e=W,n=Z(t),s=T[n];if(!s)throw new Error(e(198)+t);return s}(t.token)}validateConfig(){const t=C;if(!this[t(336)].token)throw new Error(t(301));if(!this[t(336)][t(324)])throw new Error("Must provide a platform");if(!this[t(336)].version)throw new Error("Must provide a version");if(!(Z(this[t(336)][t(296)])in T))throw new Error("Invalid token: "+this[t(336)].token)}async[S(300)](){const t=S;if(this.initialized)return;const e=[],n=!1!==this[t(336)].initializeFirebase;for(const s of this[t(290)][t(315)])try{if(s===exports.TrackProvider[t(308)]&&!n){this.config[t(334)]&&console[t(323)](t(313));continue}let i;switch(s){case exports.TrackProvider.FIREBASE:i=new k(this.platformConfig[t(307)],this[t(290)][t(297)],this[t(336)][t(334)]);break;case exports.TrackProvider.SENSORS:i=new z(this[t(336)][t(296)],this.config.platform,this[t(336)].version,this[t(290)].sensorsConfig);break;default:console.warn(t(289)+s);continue}this[t(309)][t(302)](s,i),e[t(321)](i[t(300)]())}catch(e){console[t(317)](t(327)+s+" adapter failed:",e)}await Promise[t(320)](e),this[t(316)]=!0,this.config[t(334)]&&console[t(323)](t(299),Array[t(304)](this[t(309)][t(293)]()))}async track(t,e){const n=S;if(!this.initialized)return void console[n(312)]("track SDK not initialized, please call initialize() first");this[n(336)][n(334)]&&console[n(323)](n(319)+t,e);const s=[];for(const i of this[n(309)][n(328)]())s.push(i.track(t,e));await Promise.allSettled(s)}async[S(332)](t){const e=S;if(!this[e(316)])return void console[e(312)](e(314));this[e(336)][e(334)]&&console[e(323)](e(318),t);const n=[];for(const s of this[e(309)][e(328)]())n[e(321)](s[e(332)](t));await Promise[e(320)](n)}async[S(325)](t){const e=S;if(!this[e(316)])return void console[e(312)](e(314));this[e(336)][e(334)]&&console[e(323)](e(310),t);const n=[];for(const s of this.adapters[e(328)]())n[e(321)](s[e(325)](t));await Promise.allSettled(n)}async clearUserId(){const t=S;if(!this[t(316)])return void console[t(312)]("track SDK not initialized, please call initialize() first");this.config[t(334)]&&console[t(323)]("[Track] Clear User ID");const e=[];for(const n of this[t(309)][t(328)]())e[t(321)](n[t(306)]());await Promise.allSettled(e)}[S(311)](){const t=S;return Array.from(this[t(309)].keys())}[S(330)](t,e){h(t,e)}}function F(t,e){return t-=371,j()[t]}function j(){var t=["572721wRmYdZ","27wIbbCQ","321100rFtVOY","7fNjMNr","2290698lyFcQD","71644veVguH","3712704LlsPVt","3727690iqwhux","84kNLwqq","5292848fZNSHs"];return(j=function(){return t})()}!function(){for(var t=F,e=j();;)try{if(686349===-parseInt(t(374))/1+parseInt(t(379))/2*(-parseInt(t(372))/3)+parseInt(t(380))/4+-parseInt(t(376))/5+parseInt(t(378))/6*(-parseInt(t(377))/7)+parseInt(t(373))/8+parseInt(t(375))/9*(parseInt(t(371))/10))break;e.push(e.shift())}catch(t){e.push(e.shift())}}(),exports.TrackClient=TrackClient;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initializeApp as t}from"firebase/app";import{getAnalytics as n}from"firebase/analytics";import*as s from"sa-sdk-javascript";var e,i,r;function o(t,n){return t-=487,a()[t]}function a(){var t=["SENSORS","1146654tyqhKq","10nlCwks","6YRrjUI","12039401HatPBV","72XvwdCb","10434uhteMd","firebase","44156RUyLGb","sensors","1213328lFGCjJ","583857SmdTeC","367678UKKoWY","1925czWzEC","FIREBASE"];return(a=function(){return t})()}function c(){const t=["https://www.googletagmanager.com/ns.html?id=","640618RtkATm","5771596YgzVZB","undefined","error","3mWjXTI","[GTM] GTM ID is empty, skip injection","noscript","DOMContentLoaded","[GTM] Injected successfully: ","head","insertBefore","1368xVdMEr","from","string","[GoogleTagManager] dataLayer not initialized","[GTM] Injection failed:","push","[GoogleTagManager] Invalid event name:","some","createElement","display","firstChild","7112346RRSoLx","gtm.js?id=","body","dataLayer","script","warn","1180fRRVLg","height","addEventListener","https://www.googletagmanager.com/gtm.js?id=","iframe","log","[GTM] Not in browser environment, skip injection","getElementsByTagName","3049958NkRDxS","visibility","appendChild","5AodEsl","getTime","src","includes","79576OEnzmY","[GTM] Already injected, skip","style","[GoogleTagManager] Error pushing to dataLayer:","async","5539044VErsko","querySelectorAll","1133644CGkfOH","none","parentNode"];return(c=function(){return t})()}function l(){return typeof window!==h(200)&&"undefined"!=typeof document}function h(t,n){t-=187;return c()[t]}function p(t){const n=h,s=document.createElement(n(204)),e=document[n(217)](n(230));e[n(239)]=n(197)+t,e[n(227)]="0",e.width="0",e[n(189)][n(218)]=n(195),e[n(189)][n(235)]="hidden",s[n(236)](e),document[n(222)][n(219)]?document[n(222)][n(208)](s,document[n(222)][n(219)]):document[n(222)].appendChild(s)}function f(t,n=!1){const s=h;if(l())if(t)if(function(t){const n=h;if(!l())return!1;const s=!!window[n(223)],e=document[n(193)](n(224)),i=Array[n(210)](e)[n(216)](s=>s[n(239)][n(240)](n(221)+t));return s&&i}(t))n&&console[s(231)](s(188));else try{(function(t){const n=h;window[n(223)]=window[n(223)]||[],window[n(223)][n(214)]({"gtm.start":(new Date)[n(238)](),event:"gtm.js"});const s=document[n(217)](n(224));s[n(191)]=!0,s[n(239)]=n(229)+t;const e=document[n(233)](n(224))[0];e&&e[n(196)]?e[n(196)][n(208)](s,e):document[n(207)][n(236)](s)})(t),document[s(222)]?p(t):document[s(228)](s(205),()=>{p(t)}),n&&console[s(231)](s(206)+t)}catch(t){console[s(201)](s(213),t)}else n&&console[s(225)](s(203));else n&&console[s(225)](s(232))}!function(){for(var t=o,n=a();;)try{if(582763===-parseInt(t(488))/1+-parseInt(t(489))/2*(-parseInt(t(495))/3)+parseInt(t(487))/4+parseInt(t(490))/5*(-parseInt(t(498))/6)+-parseInt(t(500))/7*(parseInt(t(497))/8)+parseInt(t(493))/9+-parseInt(t(494))/10*(-parseInt(t(496))/11))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(),(i=e||(e={}))[(r=o)(491)]=r(499),i[r(492)]=r(501),function(){const t=h,n=c();for(;;)try{if(864519===-parseInt(t(194))/1+parseInt(t(234))/2*(-parseInt(t(202))/3)+parseInt(t(199))/4*(-parseInt(t(237))/5)+-parseInt(t(220))/6+parseInt(t(192))/7+parseInt(t(187))/8*(-parseInt(t(209))/9)+parseInt(t(226))/10*(parseInt(t(198))/11))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const d=(t,n)=>{const s=h;if(!t||typeof t!==s(211))return void console[s(201)](s(215),t);(t=>{const n=h;if(typeof window!==n(200)&&window[n(223)])try{window[n(223)].push(t),console[n(231)]("[GoogleTagManager] Pushed to dataLayer:",t)}catch(t){console[n(201)](n(190),t)}else console.error(n(212))})({event:t,...n||{}})},u=m;function I(){const t=["18FZZtQY","debug","700bgNZwQ","error","2286tuPkXP","config","initialize","138120PWZQKy","206773GptbWp","gtmId","firebase initialize failed:","150HXAivI","2573968DFuAOj","track","setUserId","initialized","935CxswzO","1415SANPrR","analytics","14468QYfXpR","23632476ouRicX","2639868LReoTB","setUserProperties"];return(I=function(){return t})()}function m(t,n){t-=378;return I()[t]}!function(){const t=m,n=I();for(;;)try{if(942241===-parseInt(t(388))/1*(-parseInt(t(386))/2)+parseInt(t(382))/3+parseInt(t(380))/4*(parseInt(t(378))/5)+-parseInt(t(395))/6*(-parseInt(t(392))/7)+parseInt(t(396))/8*(parseInt(t(384))/9)+-parseInt(t(391))/10*(parseInt(t(400))/11)+-parseInt(t(381))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class w{constructor(t,n,s=!1){const e=m;this[e(379)]=null,this.initialized=!1,this.config=t,this[e(393)]=n,this[e(385)]=s}async[u(390)](){const s=u;if(!this[s(399)])try{const e=t(this[s(389)]);this[s(379)]=n(e),this[s(393)]&&f(this[s(393)],this[s(385)]),this[s(399)]=!0}catch(t){throw console[s(387)](s(394),t),t}}async[u(397)](t,n){}async[u(398)](t){}async[u(383)](t){}async clearUserId(){}}function y(){const t=["setProfile","config","11294sjMMdj","1978938nmWEDm","initialized","762160ojZOiE","3584zAhxXy","login","sensors sdk init failed:","ajax","sensors sdk clearUserId failed:","sensors sdk setUserProperties failed:","30FsDgRb","?t=","sensors sdk track failed:","showLog","sensors sdk not initialized, skip setUserProperties","sensors","platform","&v=","sensors sdk not initialized, skip setUserId","token","logout","1190484fKqUHH","clearUserId","serverUrl","144FSCrfE","version","autoTrack","track","2341889dLAaZa","warn","setUserProperties","sensors sdk not initialized, skip track","error","init","heatmap","3sRLQwu","29ucSzEm","sensors sdk not found, please install it by running","495642PTzYnZ"];return(y=function(){return t})()}const k=g;function g(t,n){t-=434;return y()[t]}!function(){const t=g,n=y();for(;;)try{if(152940===parseInt(t(455))/1*(-parseInt(t(460))/2)+parseInt(t(454))/3*(-parseInt(t(440))/4)+-parseInt(t(463))/5+-parseInt(t(457))/6+parseInt(t(464))/7*(-parseInt(t(443))/8)+parseInt(t(461))/9+-parseInt(t(470))/10*(-parseInt(t(447))/11))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class z{constructor(t,n,s,e){const i=g;this[i(434)]=null,this[i(462)]=!1,this[i(438)]=t,this[i(435)]=n,this[i(444)]=s,this[i(459)]=e}async initialize(){const t=g;if(!this[t(462)])try{if(!s)throw new Error(t(456));this[t(434)]=s;const n=encodeURIComponent(this[t(438)]),e=encodeURIComponent(this[t(435)]),i=encodeURIComponent(this.version);this[t(434)][t(452)]({server_url:this[t(459)][t(442)]+(t(471)+n+"&p=")+e+t(436)+i,show_log:this[t(459)][t(473)]??!1,heatmap:this[t(459)][t(453)]??{},is_track_single_page:!0,send_type:t(467)}),this[t(462)]=!0,this[t(434)].quick(t(445))}catch(n){throw console.error(t(466),n),n}}async track(t,n){const s=g;if(this[s(462)]&&this.sensors)try{this.sensors[s(446)](t,n??{})}catch(t){console[s(451)](s(472),t)}else console[s(448)](s(450))}async setUserId(t){const n=g;if(this.initialized&&this[n(434)])try{this[n(434)][n(465)](t)}catch(t){console[n(451)]("sensors sdk setUserId failed:",t)}else console[n(448)](n(437))}async[k(449)](t){const n=k;if(this[n(462)]&&this[n(434)])try{this[n(434)][n(458)](t)}catch(t){console[n(451)](n(469),t)}else console.warn(n(474))}async[k(441)](){const t=k;if(this[t(462)]&&this[t(434)])try{this[t(434)][t(439)]()}catch(n){console[t(451)](t(468),n)}}}function Z(){var t=["354678dogvAx","btoa","359526ttsFxQ","from","21987130Tpiajt","664182NOyIiu","49xKmsyL","toString","utf-8","379490LZXEay","1100760TSqOmK","4ijpxah","undefined","537210ZXHEiG","atob","base64","48qWMHBu"];return(Z=function(){return t})()}function v(t,n){return t-=153,Z()[t]}function M(t){var n=v;return typeof window!==n(165)&&window.btoa?window[n(154)](t):Buffer.from(t,n(161))[n(160)](n(168))}function b(t){return JSON.parse((n=t,s=v,"undefined"!=typeof window&&window[s(167)]?window[s(167)](n):Buffer[s(156)](n,s(168))[s(160)](s(161))));var n,s}!function(){for(var t=v,n=Z();;)try{if(291539===-parseInt(t(153))/1+-parseInt(t(158))/2+parseInt(t(163))/3*(-parseInt(t(164))/4)+-parseInt(t(162))/5+parseInt(t(155))/6*(-parseInt(t(159))/7)+-parseInt(t(169))/8*(parseInt(t(166))/9)+parseInt(t(157))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const W=Y;function E(){const t=["invalid token: ","384198pYPvQh","324372WilpbA","1340245cvYdnw","152754uuOaag","SENSORS","3PPXWTF","28NhXTrG","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","473216CZJfaY","GTM-MJDRW2W4","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","2360610plEQbs","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","301116rZpfFW","FIREBASE"];return(E=function(){return t})()}function Y(t,n){t-=333;return E()[t]}!function(){const t=Y,n=E();for(;;)try{if(227035===parseInt(t(340))/1+-parseInt(t(343))/2+-parseInt(t(348))/3*(-parseInt(t(344))/4)+-parseInt(t(345))/5+parseInt(t(346))/6*(parseInt(t(333))/7)+-parseInt(t(335))/8+parseInt(t(338))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const N={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[e[W(341)],e.SENSORS],firebaseConfig:b(W(334)),sensorsConfig:b("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19"),gtmId:W(336)},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[e[W(341)],e[W(347)]],firebaseConfig:b(W(339)),sensorsConfig:b(W(337))}};const R=T;function T(t,n){t-=143;return J()[t]}function J(){const t=["688465TpRXqg","platform","Must provide a version","firebaseConfig","gtmId","380181RHQacf","log","initializeFirebase","[Track] Clear User ID","FIREBASE"," adapter failed:","token","Track SDK initialized, enabled providers:","version","allSettled","unknown provider: ","20JCPGCX","keys","41433VwwrEk","push","initialize ","debug","platformConfig","initialize","setUserProperties","from","1289510udaYOk","track","Must provide a token","values","Invalid token: ","clearUserId","config","track SDK not initialized, please call initialize() first","warn","initialized","SENSORS","Must provide a platform","4352388KzorHn","1520001jpLeoe","set","50706IgcoHf","trackGTMEvent","validateConfig","providers","setUserId","sensorsConfig","1008JFOLfU","adapters"];return(J=function(){return t})()}!function(){const t=T,n=J();for(;;)try{if(369635===parseInt(t(184))/1+-parseInt(t(143))/2+parseInt(t(171))/3*(parseInt(t(182))/4)+parseInt(t(166))/5+-parseInt(t(155))/6+parseInt(t(156))/7+-parseInt(t(164))/8*(-parseInt(t(158))/9))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class TrackClient{constructor(t){const n=T;this[n(165)]=new Map,this.initialized=!1,this[n(149)]=t,this[n(160)](),this.platformConfig=function(t){const n=W,s=M(t),e=N[s];if(!e)throw new Error(n(342)+t);return e}(t[n(177)])}[R(160)](){const t=R;if(!this[t(149)][t(177)])throw new Error(t(145));if(!this.config[t(167)])throw new Error(t(154));if(!this[t(149)][t(179)])throw new Error(t(168));if(!(M(this[t(149)].token)in N))throw new Error(t(147)+this[t(149)][t(177)])}async[R(189)](){const t=R;if(this[t(152)])return;const n=[],s=!1!==this[t(149)][t(173)];for(const i of this[t(188)][t(161)])try{if(i===e[t(175)]&&!s){this[t(149)][t(187)]&&console[t(172)]("[Track] Skip Firebase initialization (initializeFirebase = false)");continue}let r;switch(i){case e.FIREBASE:r=new w(this[t(188)][t(169)],this[t(188)][t(170)],this[t(149)][t(187)]);break;case e[t(153)]:r=new z(this[t(149)][t(177)],this[t(149)][t(167)],this.config[t(179)],this[t(188)][t(163)]);break;default:console[t(151)](t(181)+i);continue}this.adapters[t(157)](i,r),n[t(185)](r[t(189)]())}catch(n){console.error(t(186)+i+t(176),n)}await Promise[t(180)](n),this.initialized=!0,this[t(149)][t(187)]&&console[t(172)](t(178),Array[t(191)](this[t(165)][t(183)]()))}async[R(144)](t,n){const s=R;if(!this[s(152)])return void console.warn(s(150));this[s(149)].debug&&console[s(172)]("[Track] "+t,n);const e=[];for(const i of this[s(165)].values())e[s(185)](i.track(t,n));await Promise.allSettled(e)}async[R(162)](t){const n=R;if(!this[n(152)])return void console[n(151)](n(150));this[n(149)][n(187)]&&console[n(172)]("[Track] Set User ID:",t);const s=[];for(const e of this[n(165)][n(146)]())s.push(e[n(162)](t));await Promise[n(180)](s)}async[R(190)](t){const n=R;if(!this[n(152)])return void console[n(151)](n(150));this[n(149)][n(187)]&&console[n(172)]("[Track] Set User Properties:",t);const s=[];for(const e of this[n(165)][n(146)]())s[n(185)](e[n(190)](t));await Promise[n(180)](s)}async[R(148)](){const t=R;if(!this[t(152)])return void console[t(151)]("track SDK not initialized, please call initialize() first");this[t(149)][t(187)]&&console.log(t(174));const n=[];for(const s of this[t(165)][t(146)]())n[t(185)](s[t(148)]());await Promise[t(180)](n)}getInitializedProviders(){const t=R;return Array[t(191)](this[t(165)][t(183)]())}[R(159)](t,n){d(t,n)}}function S(t,n){return t-=329,F()[t]}function F(){var t=["6196705GwhpAJ","1426217cdUrKE","684760FfrYQM","4448580BvamqL","3871042YoPffK","1989099RgqctH","3322020sfEcMR","6ewsuwv"];return(F=function(){return t})()}!function(){for(var t=S,n=F();;)try{if(986249===parseInt(t(332))/1+-parseInt(t(329))/2+-parseInt(t(336))/3+parseInt(t(334))/4+parseInt(t(331))/5*(parseInt(t(330))/6)+-parseInt(t(335))/7+parseInt(t(333))/8)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();export{TrackClient,e as TrackProvider};
|
|
1
|
+
import{initializeApp as t}from"firebase/app";import{getAnalytics as n}from"firebase/analytics";import*as s from"sa-sdk-javascript";var e,i,r;function o(){var t=["18522cGSQUf","sensors","SENSORS","FIREBASE","firebase","4581890GopZCf","63uQdVIP","10765KvWOyJ","6uaZYHY","9636723KTXVmc","44mAFFyL","1665128QeXzOn","1036682HQGLeO","3907743grlJYR","780XglKIm"];return(o=function(){return t})()}function a(t,n){return t-=371,o()[t]}function c(t,n){t-=181;return f()[t]}function l(){const t=c;return typeof window!==t(198)&&typeof document!==t(198)}function f(){const t=["script","725334nHAhtB","log","style","[GTM] Not in browser environment, skip injection","undefined","85EsLsJl","583416nxPzsi","insertBefore","[GoogleTagManager] Invalid event name:","DOMContentLoaded","https://www.googletagmanager.com/ns.html?id=","firstChild","includes","[GTM] Injected successfully: ","async","width","appendChild","[GoogleTagManager] Pushed to dataLayer:","iframe","string","https://www.googletagmanager.com/gtm.js?id=","368kqPnAq","push","[GoogleTagManager] dataLayer not initialized","[GTM] GTM ID is empty, skip injection","src","display","dataLayer","1777293cPwipi","from","createElement","gtm.js?id=","body","3057480Kckbik","gtm.js","1364762FfAwAk","getTime","3qArzah","parentNode","warn","5972PwSnRc","querySelectorAll","error","hidden","62568HBytrk"];return(f=function(){return t})()}function h(t){const n=c,s=document[n(224)]("noscript"),e=document.createElement(n(212));e[n(219)]=n(204)+t,e.height="0",e[n(209)]="0",e.style[n(220)]="none",e[n(196)].visibility=n(191),s.appendChild(e),document.body[n(205)]?document[n(226)].insertBefore(s,document.body.firstChild):document.body[n(210)](s)}function d(t,n=!1){const s=c;if(l())if(t)if(function(t){const n=c;if(!l())return!1;const s=!!window[n(221)],e=document[n(189)]("script"),i=Array[n(223)](e).some(s=>s.src[n(206)](n(225)+t));return s&&i}(t))n&&console.log("[GTM] Already injected, skip");else try{(function(t){const n=c;window[n(221)]=window.dataLayer||[],window[n(221)].push({"gtm.start":(new Date)[n(184)](),event:n(182)});const s=document[n(224)]("script");s[n(208)]=!0,s.src=n(214)+t;const e=document.getElementsByTagName(n(193))[0];e&&e[n(186)]?e[n(186)][n(201)](s,e):document.head.appendChild(s)})(t),document[s(226)]?h(t):document.addEventListener(s(203),()=>{h(t)}),n&&console[s(195)](s(207)+t)}catch(t){console[s(190)]("[GTM] Injection failed:",t)}else n&&console[s(187)](s(218));else n&&console[s(187)](s(197))}!function(){for(var t=a,n=o();;)try{if(538881===parseInt(t(384))/1+-parseInt(t(372))/2*(-parseInt(t(378))/3)+-parseInt(t(371))/4*(-parseInt(t(379))/5)+-parseInt(t(380))/6*(parseInt(t(385))/7)+parseInt(t(383))/8+parseInt(t(381))/9+parseInt(t(377))/10*(-parseInt(t(382))/11))break;n.push(n.shift())}catch(t){n.push(n.shift())}}(),(i=e||(e={}))[(r=a)(375)]=r(376),i[r(374)]=r(373),function(){const t=c,n=f();for(;;)try{if(486449===parseInt(t(194))/1+parseInt(t(183))/2*(-parseInt(t(185))/3)+-parseInt(t(188))/4*(parseInt(t(199))/5)+parseInt(t(200))/6+-parseInt(t(222))/7+-parseInt(t(215))/8*(-parseInt(t(192))/9)+parseInt(t(181))/10)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const p=(t,n)=>{const s=c;if(!t||typeof t!==s(213))return void console[s(190)](s(202),t);(t=>{const n=c;if(typeof window!==n(198)&&window[n(221)])try{window[n(221)][n(216)](t),console[n(195)](n(211),t)}catch(t){console[n(190)]("[GoogleTagManager] Error pushing to dataLayer:",t)}else console[n(190)](n(217))})({event:t,...n||{}})},u=I;function I(t,n){t-=102;return w()[t]}!function(){const t=I,n=w();for(;;)try{if(675182===-parseInt(t(117))/1+parseInt(t(114))/2*(-parseInt(t(120))/3)+parseInt(t(102))/4+-parseInt(t(115))/5+parseInt(t(108))/6*(parseInt(t(118))/7)+-parseInt(t(119))/8+parseInt(t(105))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class m{constructor(t,n,s=!1){const e=I;this[e(113)]=null,this[e(116)]=!1,this[e(106)]=t,this[e(107)]=n,this[e(111)]=s}async initialize(){const s=I;if(!this[s(116)])try{const e=t(this.config);this[s(113)]=n(e),this[s(107)]&&d(this[s(107)],this.debug),this[s(116)]=!0}catch(t){throw console[s(109)](s(110),t),t}}async[u(103)](t,n){}async[u(104)](t){}async setUserProperties(t){}async[u(112)](){}}function w(){const t=["initialized","1274703qsBMur","2828434lvKqRn","4460656dCtkfi","3sfVjxR","4028284kGGqau","track","setUserId","13773006JWPOyY","config","gtmId","18eZcBRC","error","firebase initialize failed:","debug","clearUserId","analytics","2361450CKFNHi","306995hUOLtV"];return(w=function(){return t})()}const y=k;function k(t,n){t-=438;return g()[t]}function g(){const t=["&p=","setProfile","config","logout","8868965iSHcNq","sensors sdk not initialized, skip setUserProperties","init","3430860ihMoRV","version","sensors sdk setUserId failed:","587754szUKlV","setUserProperties","39XdWqsg","quick","error","autoTrack","initialized","?t=","platform","sensors sdk not initialized, skip track","sensors sdk setUserProperties failed:","sensors sdk not found, please install it by running","login","&v=","171423yYXhri","1853339JDWfAH","591464CDTZIP","10lgKZGf","setUserId","heatmap","sensors sdk not initialized, skip setUserId","sensors","472IhurtC","warn","30109554sXEuzS","sensors sdk init failed:"];return(g=function(){return t})()}!function(){const t=k,n=g();for(;;)try{if(966836===parseInt(t(459))/1+parseInt(t(444))/2+parseInt(t(446))/3*(parseInt(t(460))/4)+-parseInt(t(438))/5+parseInt(t(441))/6+parseInt(t(458))/7*(parseInt(t(466))/8)+-parseInt(t(468))/9*(parseInt(t(461))/10))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class z{constructor(t,n,s,e){const i=k;this[i(465)]=null,this[i(450)]=!1,this.token=t,this[i(452)]=n,this[i(442)]=s,this.config=e}async initialize(){const t=k;if(!this[t(450)])try{if(!s)throw new Error(t(455));this[t(465)]=s;const n=encodeURIComponent(this.token),e=encodeURIComponent(this.platform),i=encodeURIComponent(this[t(442)]);this.sensors[t(440)]({server_url:this[t(472)].serverUrl+(t(451)+n+t(470)+e+t(457)+i),show_log:this[t(472)].showLog??!1,heatmap:this[t(472)][t(463)]??{},is_track_single_page:!0,send_type:"ajax"}),this[t(450)]=!0,this[t(465)][t(447)](t(449))}catch(n){throw console.error(t(469),n),n}}async track(t,n){const s=k;if(this[s(450)]&&this[s(465)])try{this.sensors.track(t,n??{})}catch(t){console[s(448)]("sensors sdk track failed:",t)}else console[s(467)](s(453))}async[y(462)](t){const n=y;if(this[n(450)]&&this[n(465)])try{this.sensors[n(456)](t)}catch(t){console[n(448)](n(443),t)}else console[n(467)](n(464))}async[y(445)](t){const n=y;if(this[n(450)]&&this[n(465)])try{this[n(465)][n(471)](t)}catch(t){console[n(448)](n(454),t)}else console[n(467)](n(439))}async clearUserId(){const t=y;if(this.initialized&&this[t(465)])try{this[t(465)][t(473)]()}catch(n){console[t(448)]("sensors sdk clearUserId failed:",n)}}}function Z(){var t=["btoa","undefined","1759257VRiHVJ","parse","10bEbHVZ","atob","3289825midXjw","utf-8","8472KUlUir","toString","1538388mDtBNz","5729275fURXLF","6UuyegU","from","5935128UmGklz","444cVdrUp","base64","737313LxPZDP"];return(Z=function(){return t})()}function v(t){var n=M;return"undefined"!=typeof window&&window[n(335)]?window[n(335)](t):Buffer[n(330)](t,n(324))[n(326)](n(333))}function M(t,n){return t-=321,Z()[t]}function b(t){var n,s;return JSON[M(338)]((n=t,s=M,typeof window!==s(336)&&window[s(322)]?window[s(322)](n):Buffer[s(330)](n,s(333)).toString(s(324))))}!function(){for(var t=M,n=Z();;)try{if(606829===-parseInt(t(334))/1+parseInt(t(327))/2+-parseInt(t(332))/3*(-parseInt(t(325))/4)+-parseInt(t(328))/5*(parseInt(t(329))/6)+parseInt(t(323))/7+parseInt(t(331))/8+-parseInt(t(337))/9*(-parseInt(t(321))/10))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const W=S;function N(){const t=["42LQkoBc","GTM-MJDRW2W4","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","4517289WnHBGN","1642056FCFiKq","31684563sfZpWH","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","469815LSXeQN","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","205377vXHSKj","invalid token: ","1832784oOLdwL","10Ihjchf","FIREBASE","6689907WXdQiN","SENSORS"];return(N=function(){return t})()}!function(){const t=S,n=N();for(;;)try{if(788575===-parseInt(t(197))/1*(-parseInt(t(200))/2)+-parseInt(t(207))/3+-parseInt(t(192))/4+parseInt(t(195))/5*(-parseInt(t(204))/6)+-parseInt(t(202))/7+-parseInt(t(199))/8+parseInt(t(193))/9)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();const J={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[e[W(201)],e[W(203)]],firebaseConfig:b(W(194)),sensorsConfig:b(W(196)),gtmId:W(205)},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[e[W(201)],e[W(203)]],firebaseConfig:b(W(206)),sensorsConfig:b("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19")}};function S(t,n){t-=192;return N()[t]}const Y=C;function C(t,n){t-=289;return F()[t]}function F(){const t=["11KzUpfj","initialize ","values","2861395aMRkHQ","trackGTMEvent","82096bHYCMM","setUserId","1611IrvClk","debug","690ccTjFC","config","unknown provider: ","platformConfig","3671184fWegHe","validateConfig","keys","45598qwoyfx","63637MBuGPw","token","gtmId","639JDnwXF","Track SDK initialized, enabled providers:","initialize","Must provide a token","set","83963AekSXI","from","490IJvYSW","clearUserId","firebaseConfig","FIREBASE","adapters","[Track] Set User Properties:","getInitializedProviders","warn","[Track] Skip Firebase initialization (initializeFirebase = false)","track SDK not initialized, please call initialize() first","providers","initialized","error","[Track] Set User ID:","[Track] ","allSettled","push","708nadYKP","log","platform","setUserProperties"];return(F=function(){return t})()}!function(){const t=C,n=F();for(;;)try{if(555031===parseInt(t(326))/1*(parseInt(t(294))/2)+parseInt(t(333))/3*(parseInt(t(322))/4)+parseInt(t(329))/5+parseInt(t(335))/6*(parseInt(t(295))/7)+parseInt(t(331))/8*(-parseInt(t(298))/9)+parseInt(t(305))/10*(-parseInt(t(303))/11)+-parseInt(t(291))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}();class TrackClient{constructor(t){const n=C;this[n(309)]=new Map,this[n(316)]=!1,this[n(336)]=t,this[n(292)](),this.platformConfig=function(t){const n=W,s=v(t),e=J[s];if(!e)throw new Error(n(198)+t);return e}(t.token)}validateConfig(){const t=C;if(!this[t(336)].token)throw new Error(t(301));if(!this[t(336)][t(324)])throw new Error("Must provide a platform");if(!this[t(336)].version)throw new Error("Must provide a version");if(!(v(this[t(336)][t(296)])in J))throw new Error("Invalid token: "+this[t(336)].token)}async[Y(300)](){const t=Y;if(this.initialized)return;const n=[],s=!1!==this[t(336)].initializeFirebase;for(const i of this[t(290)][t(315)])try{if(i===e[t(308)]&&!s){this.config[t(334)]&&console[t(323)](t(313));continue}let r;switch(i){case e.FIREBASE:r=new m(this.platformConfig[t(307)],this[t(290)][t(297)],this[t(336)][t(334)]);break;case e.SENSORS:r=new z(this[t(336)][t(296)],this.config.platform,this[t(336)].version,this[t(290)].sensorsConfig);break;default:console.warn(t(289)+i);continue}this[t(309)][t(302)](i,r),n[t(321)](r[t(300)]())}catch(n){console[t(317)](t(327)+i+" adapter failed:",n)}await Promise[t(320)](n),this[t(316)]=!0,this.config[t(334)]&&console[t(323)](t(299),Array[t(304)](this[t(309)][t(293)]()))}async track(t,n){const s=Y;if(!this.initialized)return void console[s(312)]("track SDK not initialized, please call initialize() first");this[s(336)][s(334)]&&console[s(323)](s(319)+t,n);const e=[];for(const i of this[s(309)][s(328)]())e.push(i.track(t,n));await Promise.allSettled(e)}async[Y(332)](t){const n=Y;if(!this[n(316)])return void console[n(312)](n(314));this[n(336)][n(334)]&&console[n(323)](n(318),t);const s=[];for(const e of this[n(309)][n(328)]())s[n(321)](e[n(332)](t));await Promise[n(320)](s)}async[Y(325)](t){const n=Y;if(!this[n(316)])return void console[n(312)](n(314));this[n(336)][n(334)]&&console[n(323)](n(310),t);const s=[];for(const e of this.adapters[n(328)]())s[n(321)](e[n(325)](t));await Promise.allSettled(s)}async clearUserId(){const t=Y;if(!this[t(316)])return void console[t(312)]("track SDK not initialized, please call initialize() first");this.config[t(334)]&&console[t(323)]("[Track] Clear User ID");const n=[];for(const s of this[t(309)][t(328)]())n[t(321)](s[t(306)]());await Promise.allSettled(n)}[Y(311)](){const t=Y;return Array.from(this[t(309)].keys())}[Y(330)](t,n){p(t,n)}}function T(t,n){return t-=371,U()[t]}function U(){var t=["572721wRmYdZ","27wIbbCQ","321100rFtVOY","7fNjMNr","2290698lyFcQD","71644veVguH","3712704LlsPVt","3727690iqwhux","84kNLwqq","5292848fZNSHs"];return(U=function(){return t})()}!function(){for(var t=T,n=U();;)try{if(686349===-parseInt(t(374))/1+parseInt(t(379))/2*(-parseInt(t(372))/3)+parseInt(t(380))/4+-parseInt(t(376))/5+parseInt(t(378))/6*(-parseInt(t(377))/7)+parseInt(t(373))/8+parseInt(t(375))/9*(parseInt(t(371))/10))break;n.push(n.shift())}catch(t){n.push(n.shift())}}();export{TrackClient,e as TrackProvider};
|