@seaverse/track-sdk 0.1.3 → 0.1.5
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 +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -29,6 +29,8 @@ import { TrackClient } from '@seaverse/track-sdk';
|
|
|
29
29
|
// 创建客户端(使用生产环境 token)
|
|
30
30
|
const trackClient = new TrackClient({
|
|
31
31
|
token: 'prod_2f8a9c1b4e3d',
|
|
32
|
+
platform: 'web', // h5
|
|
33
|
+
version: '1.0.0',
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
// 初始化
|
|
@@ -56,6 +58,8 @@ new TrackClient(config: TrackConfig)
|
|
|
56
58
|
```typescript
|
|
57
59
|
interface TrackConfig {
|
|
58
60
|
token: string; // 应用令牌(必填)
|
|
61
|
+
platform: string; // 平台类型(必填,如:web、h5、ios、android)
|
|
62
|
+
version: string; // 应用版本号(必填)
|
|
59
63
|
debug?: boolean; // 是否开启调试模式,默认 false
|
|
60
64
|
}
|
|
61
65
|
```
|
|
@@ -130,6 +134,8 @@ import { TrackClient } from '@seaverse/track-sdk';
|
|
|
130
134
|
// 创建全局实例
|
|
131
135
|
const trackClient = new TrackClient({
|
|
132
136
|
token: process.env.REACT_APP_TRACK_TOKEN || 'dev_9a3b6c2d1e4f',
|
|
137
|
+
platform: 'web',
|
|
138
|
+
version: '1.0.0', // 建议从 package.json 读取
|
|
133
139
|
debug: process.env.NODE_ENV === 'development',
|
|
134
140
|
});
|
|
135
141
|
|
|
@@ -168,6 +174,8 @@ import { TrackClient } from '@seaverse/track-sdk';
|
|
|
168
174
|
|
|
169
175
|
export const trackClient = new TrackClient({
|
|
170
176
|
token: import.meta.env.VITE_TRACK_TOKEN || 'dev_9a3b6c2d1e4f',
|
|
177
|
+
platform: 'web',
|
|
178
|
+
version: '1.0.0', // 建议从 package.json 读取
|
|
171
179
|
debug: import.meta.env.DEV,
|
|
172
180
|
});
|
|
173
181
|
|
|
@@ -217,6 +225,8 @@ VITE_TRACK_TOKEN=prod_2f8a9c1b4e3d
|
|
|
217
225
|
```typescript
|
|
218
226
|
const trackClient = new TrackClient({
|
|
219
227
|
token: process.env.REACT_APP_TRACK_TOKEN || 'dev_9a3b6c2d1e4f',
|
|
228
|
+
platform: 'web',
|
|
229
|
+
version: '1.0.0',
|
|
220
230
|
debug: process.env.NODE_ENV !== 'production',
|
|
221
231
|
});
|
|
222
232
|
```
|
|
@@ -263,6 +273,8 @@ try {
|
|
|
263
273
|
```typescript
|
|
264
274
|
const trackClient = new TrackClient({
|
|
265
275
|
token: 'your_token',
|
|
276
|
+
platform: 'web',
|
|
277
|
+
version: '1.0.0',
|
|
266
278
|
debug: true, // 会在控制台输出日志
|
|
267
279
|
});
|
|
268
280
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t){var s=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),s.default=t,Object.freeze(s)}var s,r,i=t(require("sa-sdk-javascript"));function e(){var t=["FIREBASE","sensors","3427990UDPcfb","732221cCZylQ","610EesDrh","290166KRmVZn","SENSORS","767868FUFJoM","8yoeguU","280562POuZwM","firebase","134559xNtffz","1640610FJxxZv","2QLUlNw"];return(e=function(){return t})()}function n(t,s){return t-=130,e()[t]}!function(){for(var t=n,s=e();;)try{if(771052===-parseInt(t(132))/1*(-parseInt(t(136))/2)+-parseInt(t(142))/3+parseInt(t(130))/4+-parseInt(t(139))/5+parseInt(t(135))/6+parseInt(t(140))/7*(-parseInt(t(131))/8)+-parseInt(t(134))/9*(-parseInt(t(141))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}(),exports.TrackProvider=void 0,(s=exports.TrackProvider||(exports.TrackProvider={}))[(r=n)(137)]=r(133),s[r(143)]=r(138);const a=o;function o(t,s){t-=324;return c()[t]}function c(){const t=["initialized","firebase/app","1294996CTdGBw","117880piZAsY","13268690mThkxa","track","setUserId","initialize","499492ZIEozO","setUserProperties","7MYWKQW","1726578GAgBtl","323249EfbwRS","1431496auqJlP","analytics","firebase/analytics","3JFpzjR","clearUserId","config","firebase initialize failed:","156BDkgia"];return(c=function(){return t})()}!function(){const t=o,s=c();for(;;)try{if(329546===-parseInt(t(338))/1+parseInt(t(334))/2+-parseInt(t(342))/3*(parseInt(t(328))/4)+parseInt(t(329))/5*(-parseInt(t(325))/6)+parseInt(t(336))/7*(-parseInt(t(339))/8)+parseInt(t(337))/9+parseInt(t(330))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class l{constructor(t){const s=o;this[s(340)]=null,this[s(326)]=!1,this[s(344)]=t}async[a(333)](){const t=a;if(!this.initialized)try{const{initializeApp:s}=await import(t(327)),{getAnalytics:r}=await import(t(341)),i=s(this[t(344)]);this[t(340)]=r(i),this[t(326)]=!0}catch(s){throw console.error(t(324),s),s}}async[a(331)](t,s){}async[a(332)](t){}async[a(335)](t){}async[a(343)](){}}var p=f;function f(t,s){return t-=115,h()[t]}function h(){var t=["logout","3511144ZxjYLm","token","quick","5612CNvzaU","setUserId","sensors sdk track failed:","clearUserId","autoTrack","160655QQZKDa","sensors sdk setUserId failed:","sensors sdk not initialized, skip setUserProperties","2366274IZTaUy","10dUBJOI","?token=","warn","sensors sdk not found, please install it by running","error","1745MSAEoG","heatmap","sensors sdk not initialized, skip track","sensors sdk not initialized, skip setUserId","track","2142339RwGjZW","setProfile","initialized","19190160GIMdmP","setUserProperties","showLog","ajax","sensors","sensors sdk init failed:","initialize","7yLGEJX","config","990956RPlaKT","sensors sdk setUserProperties failed:"];return(h=function(){return t})()}!function(){for(var t=f,s=h();;)try{if(418369===-parseInt(t(144))/1+-parseInt(t(133))/2+-parseInt(t(121))/3+parseInt(t(139))/4*(parseInt(t(116))/5)+parseInt(t(147))/6*(-parseInt(t(131))/7)+-parseInt(t(136))/8+-parseInt(t(124))/9*(-parseInt(t(148))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class I{constructor(t,s){var r=f;this.sensors=null,this[r(123)]=!1,this[r(137)]=t,this.config=s}async[p(130)](){var t=p;if(!this.initialized)try{if(!i)throw new Error(t(151));this[t(128)]=i,this.sensors.init({server_url:this.config.serverUrl+(t(149)+this[t(137)]),show_log:this[t(132)][t(126)]??!1,heatmap:this.config[t(117)]??{},is_track_single_page:!0,send_type:t(127)}),this[t(123)]=!0,this.sensors[t(138)](t(143))}catch(s){throw console.error(t(129),s),s}}async[p(120)](t,s){var r=p;if(this.initialized&&this[r(128)])try{this[r(128)][r(120)](t,s??{})}catch(t){console[r(115)](r(141),t)}else console[r(150)](r(118))}async[p(140)](t){var s=p;if(this[s(123)]&&this[s(128)])try{this.sensors.login(t)}catch(t){console.error(s(145),t)}else console[s(150)](s(119))}async[p(125)](t){var s=p;if(this[s(123)]&&this.sensors)try{this.sensors[s(122)](t)}catch(t){console[s(115)](s(134),t)}else console[s(150)](s(146))}async[p(142)](){var t=p;if(this[t(123)]&&this[t(128)])try{this.sensors[t(135)]()}catch(t){console.error("sensors sdk clearUserId failed:",t)}}}function u(t,s){return t-=203,w()[t]}function d(t){var s=u;return typeof window!==s(210)&&window.btoa?window[s(211)](t):Buffer[s(209)](t,s(213))[s(203)](s(206))}function k(t){var s,r;return JSON[u(222)]((s=t,r=u,"undefined"!=typeof window&&window[r(204)]?window[r(204)](s):Buffer[r(209)](s,r(206))[r(203)](r(213))))}function w(){var t=["5924314IuEinC","1791170YtRuWg","9OHPToU","12dudggP","22872hHVHtE","13758890RkrFXf","parse","toString","atob","397034dVRKGj","base64","3297bcxZBZ","9LnLuZP","from","undefined","btoa","5840112kVBDgt","utf-8","721738dFfGcd","12IuQZan"];return(w=function(){return t})()}!function(){for(var t=u,s=w();;)try{if(706665===parseInt(t(214))/1+parseInt(t(205))/2*(parseInt(t(218))/3)+-parseInt(t(219))/4*(parseInt(t(217))/5)+parseInt(t(212))/6+parseInt(t(207))/7*(-parseInt(t(220))/8)+-parseInt(t(208))/9*(-parseInt(t(221))/10)+-parseInt(t(216))/11*(parseInt(t(215))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const y=v;function z(){const t=["eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","SENSORS","26621368Pugffv","1022312geglzp","FIREBASE","2363529WbTvYo","4010830HlUJSd","2243758JJZYtW","3CLfEqV","2608470MmAjIx","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","464221czTnMv"];return(z=function(){return t})()}function v(t,s){t-=394;return z()[t]}!function(){const t=v,s=z();for(;;)try{if(586729===-parseInt(t(401))/1+-parseInt(t(396))/2+-parseInt(t(397))/3*(parseInt(t(405))/4)+-parseInt(t(395))/5+-parseInt(t(398))/6+parseInt(t(394))/7+parseInt(t(404))/8)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const Z={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[exports.TrackProvider.FIREBASE,exports.TrackProvider[y(403)]],firebaseConfig:k(y(399)),sensorsConfig:k(y(402))},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[exports.TrackProvider[y(406)],exports.TrackProvider[y(403)]],firebaseConfig:k(y(400)),sensorsConfig:k(y(402))}};function m(t,s){t-=256;return g()[t]}const b=m;function g(){const t=["Invalid token: ","values","FIREBASE","SENSORS","error","token","434IlxLix","[Track] Skip Firebase initialization (initializeFirebase = false)","initialize","allSettled","platformConfig","initialize ","[Track] Set User Properties:","initialized","21758530ScPFqr","validateConfig","Must provide a token","adapters","Track SDK initialized, enabled providers:","setUserProperties","4904053othnyg","clearUserId","debug"," adapter failed:","log","471950BcvnhH","track","unknown provider: ","9HvWPKX","initializeFirebase","2265836jRDolN","warn","[Track] Clear User ID","providers","[Track] Set User ID:","config","getInitializedProviders","889992nBqDuO","5gRTFdn","from","track SDK not initialized, please call initialize() first","push","sensorsConfig","4287FIamXn","set","keys","6813888HUrKVz"];return(g=function(){return t})()}!function(){const t=m,s=g();for(;;)try{if(632979===-parseInt(t(259))/1+parseInt(t(287))/2*(parseInt(t(277))/3)+parseInt(t(264))/4*(parseInt(t(272))/5)+-parseInt(t(280))/6+-parseInt(t(301))/7+-parseInt(t(271))/8+-parseInt(t(262))/9*(-parseInt(t(295))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class TrackClient{constructor(t){const s=m;this[s(298)]=new Map,this[s(294)]=!1,this[s(269)]=t,this[s(296)](),this[s(291)]=function(t){const s=d(t),r=Z[s];if(!r)throw new Error("invalid token: "+t);return r}(t[s(286)])}[b(296)](){const t=b;if(!this[t(269)][t(286)])throw new Error(t(297));if(!(d(this[t(269)][t(286)])in Z))throw new Error(t(281)+this[t(269)][t(286)])}async[b(289)](){const t=b;if(this[t(294)])return;const s=[],r=!1!==this[t(269)][t(263)];for(const i of this[t(291)][t(267)])try{if(i===exports.TrackProvider[t(283)]&&!r){this[t(269)][t(256)]&&console[t(258)](t(288));continue}let e;switch(i){case exports.TrackProvider[t(283)]:e=new l(this[t(291)].firebaseConfig);break;case exports.TrackProvider[t(284)]:e=new I(this[t(269)][t(286)],this[t(291)][t(276)]);break;default:console[t(265)](t(261)+i);continue}this.adapters[t(278)](i,e),s[t(275)](e.initialize())}catch(s){console[t(285)](t(292)+i+t(257),s)}await Promise[t(290)](s),this[t(294)]=!0,this.config[t(256)]&&console.log(t(299),Array[t(273)](this.adapters[t(279)]()))}async[b(260)](t,s){const r=b;if(!this[r(294)])return void console.warn(r(274));this[r(269)][r(256)]&&console[r(258)]("[Track] "+t,s);const i=[];for(const e of this[r(298)][r(282)]())i[r(275)](e.track(t,s));await Promise[r(290)](i)}async setUserId(t){const s=b;if(!this[s(294)])return void console[s(265)](s(274));this[s(269)][s(256)]&&console[s(258)](s(268),t);const r=[];for(const i of this[s(298)][s(282)]())r.push(i.setUserId(t));await Promise[s(290)](r)}async setUserProperties(t){const s=b;if(!this.initialized)return void console[s(265)](s(274));this[s(269)][s(256)]&&console[s(258)](s(293),t);const r=[];for(const i of this.adapters[s(282)]())r.push(i[s(300)](t));await Promise[s(290)](r)}async[b(302)](){const t=b;if(!this[t(294)])return void console[t(265)]("track SDK not initialized, please call initialize() first");this[t(269)][t(256)]&&console[t(258)](t(266));const s=[];for(const r of this[t(298)][t(282)]())s[t(275)](r[t(302)]());await Promise[t(290)](s)}[b(270)](){const t=b;return Array[t(273)](this[t(298)][t(279)]())}}function W(t,s){return t-=313,J()[t]}function J(){var t=["4298IHpZxp","358508BbNENt","44889IjODWb","1501494SIAtKt","30maoPex","127900YwwWas","481854wvVbsV","4880646VKSrHS","1kszukf","2376CPwdiv"];return(J=function(){return t})()}!function(){for(var t=W,s=J();;)try{if(285597===parseInt(t(318))/1*(parseInt(t(316))/2)+-parseInt(t(322))/3+-parseInt(t(321))/4*(parseInt(t(314))/5)+parseInt(t(313))/6+-parseInt(t(320))/7*(parseInt(t(319))/8)+parseInt(t(317))/9+-parseInt(t(315))/10)break;s.push(s.shift())}catch(t){s.push(s.shift())}}(),exports.TrackClient=TrackClient;
|
|
1
|
+
"use strict";var t=require("firebase/app"),s=require("firebase/analytics");function r(t){var s=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var e=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,e.get?e:{enumerable:!0,get:function(){return t[r]}})}}),s.default=t,Object.freeze(s)}var e,n,i=r(require("sa-sdk-javascript"));function o(t,s){return t-=371,a()[t]}function a(){var t=["sensors","297tDQJxZ","163487LncWyn","1684045buxUfK","2428320IZTMRJ","2371179ljcPSQ","4vqhmKv","22YGBMeo","455odrInS","149958gkQzQA","6bTtEDm","SENSORS","firebase","6024496gXXvna","305710CCPtqR"];return(a=function(){return t})()}!function(){for(var t=o,s=a();;)try{if(829439===-parseInt(t(374))/1*(parseInt(t(382))/2)+-parseInt(t(377))/3+parseInt(t(378))/4*(parseInt(t(375))/5)+parseInt(t(381))/6*(parseInt(t(380))/7)+parseInt(t(385))/8+parseInt(t(373))/9*(-parseInt(t(371))/10)+-parseInt(t(379))/11*(-parseInt(t(376))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}(),exports.TrackProvider=void 0,e=exports.TrackProvider||(exports.TrackProvider={}),n=o,e.FIREBASE=n(384),e[n(383)]=n(372);const c=l;function l(t,s){t-=112;return p()[t]}function p(){const t=["analytics","track","70EJcNND","108nQVMhI","firebase initialize failed:","error","setUserProperties","8424VnTBHs","setUserId","1687wrwdEo","154vPHpGa","631558cnPISb","initialized","2554428KKZBIe","config","20175AspqHN","306945kDtkwJ","610ZdiTle","7401vVaVdR","192996MJPuKB","clearUserId"];return(p=function(){return t})()}!function(){const t=l,s=p();for(;;)try{if(445436===-parseInt(t(117))/1+parseInt(t(123))/2*(parseInt(t(124))/3)+-parseInt(t(130))/4*(-parseInt(t(121))/5)+parseInt(t(119))/6+parseInt(t(115))/7*(parseInt(t(113))/8)+-parseInt(t(122))/9*(parseInt(t(129))/10)+-parseInt(t(116))/11*(parseInt(t(125))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class f{constructor(t){const s=l;this.analytics=null,this[s(118)]=!1,this[s(120)]=t}async initialize(){const r=l;if(!this[r(118)])try{const e=t.initializeApp(this[r(120)]);this[r(127)]=s.getAnalytics(e),this[r(118)]=!0}catch(t){throw console[r(132)](r(131),t),t}}async[c(128)](t,s){}async[c(114)](t){}async[c(112)](t){}async[c(126)](){}}function h(t,s){t-=255;return d()[t]}const I=h;function d(){const t=["login","warn","4205148LagySc","quick","ajax","?t=","token","setUserProperties","sensors sdk init failed:","10000HGUIKT","36376dxXjRM","sensors sdk not initialized, skip setUserProperties","1395nYjOqU","2158800zPZZZU","serverUrl","setUserId","autoTrack","sensors sdk not initialized, skip setUserId","initialized","sensors sdk not found, please install it by running","sensors sdk track failed:","platform","sensors sdk setUserProperties failed:","1924gzmytc","showLog","10NtlfOT","sensors sdk clearUserId failed:","error","config","2558456mtgsyU","initialize","23677291PEKAMT","heatmap","93GLlCYA","&p=","&v=","version","5FnRYrA","sensors sdk not initialized, skip track","sensors sdk setUserId failed:","track","init","clearUserId","sensors"];return(d=function(){return t})()}!function(){const t=h,s=d();for(;;)try{if(455446===parseInt(t(271))/1+parseInt(t(285))/2*(parseInt(t(295))/3)+-parseInt(t(291))/4*(parseInt(t(255))/5)+-parseInt(t(264))/6+parseInt(t(275))/7+-parseInt(t(272))/8*(parseInt(t(274))/9)+-parseInt(t(287))/10*(-parseInt(t(293))/11))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class u{constructor(t,s,r,e){const n=h;this[n(261)]=null,this.initialized=!1,this[n(268)]=t,this[n(283)]=s,this[n(298)]=r,this[n(290)]=e}async[I(292)](){const t=I;if(!this[t(280)])try{if(!i)throw new Error(t(281));this[t(261)]=i;const s=encodeURIComponent(this[t(268)]),r=encodeURIComponent(this[t(283)]),e=encodeURIComponent(this[t(298)]);this[t(261)][t(259)]({server_url:this.config[t(276)]+(t(267)+s+t(296)+r+t(297)+e),show_log:this[t(290)][t(286)]??!1,heatmap:this[t(290)][t(294)]??{},is_track_single_page:!0,send_type:t(266)}),this[t(280)]=!0,this[t(261)][t(265)](t(278))}catch(s){throw console.error(t(270),s),s}}async[I(258)](t,s){const r=I;if(this[r(280)]&&this[r(261)])try{this[r(261)][r(258)](t,s??{})}catch(t){console[r(289)](r(282),t)}else console[r(263)](r(256))}async[I(277)](t){const s=I;if(this.initialized&&this[s(261)])try{this[s(261)][s(262)](t)}catch(t){console.error(s(257),t)}else console[s(263)](s(279))}async[I(269)](t){const s=I;if(this.initialized&&this[s(261)])try{this[s(261)].setProfile(t)}catch(t){console[s(289)](s(284),t)}else console[s(263)](s(273))}async[I(260)](){const t=I;if(this[t(280)]&&this[t(261)])try{this[t(261)].logout()}catch(s){console.error(t(288),s)}}}function k(){var t=["atob","3260qrbkko","from","14772ApEzQO","undefined","toString","base64","72575yVezWQ","1kfKYQU","utf-8","10EsMsFG","204VZMywi","3182553ClSoya","111377HkznwU","456970poanGf","1899MkhrjZ","1706023vNkSru","8WqMktq","btoa","169eJFqyd"];return(k=function(){return t})()}function y(t,s){return t-=445,k()[t]}function w(t){var s=y;return typeof window!==s(455)&&window[s(449)]?window[s(449)](t):Buffer[s(453)](t,s(460))[s(456)](s(457))}function z(t){return JSON.parse((s=t,r=y,typeof window!==r(455)&&window[r(451)]?window[r(451)](s):Buffer[r(453)](s,r(457))[r(456)](r(460))));var s,r}!function(){for(var t=y,s=k();;)try{if(285664===parseInt(t(459))/1*(-parseInt(t(445))/2)+-parseInt(t(446))/3*(-parseInt(t(452))/4)+parseInt(t(458))/5+parseInt(t(462))/6*(-parseInt(t(464))/7)+parseInt(t(448))/8*(parseInt(t(463))/9)+-parseInt(t(461))/10*(-parseInt(t(447))/11)+parseInt(t(454))/12*(parseInt(t(450))/13))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const Z=m;!function(){const t=m,s=b();for(;;)try{if(354492===parseInt(t(157))/1*(parseInt(t(146))/2)+parseInt(t(149))/3+parseInt(t(145))/4+-parseInt(t(156))/5*(-parseInt(t(151))/6)+-parseInt(t(144))/7+parseInt(t(148))/8+-parseInt(t(154))/9)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const v={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[exports.TrackProvider[Z(152)],exports.TrackProvider.SENSORS],firebaseConfig:z(Z(147)),sensorsConfig:z("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19")},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[exports.TrackProvider[Z(152)],exports.TrackProvider[Z(153)]],firebaseConfig:z(Z(155)),sensorsConfig:z(Z(150))}};function m(t,s){t-=144;return b()[t]}function b(){const t=["85461vrkAAK","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","880494KCWboB","FIREBASE","SENSORS","6572673qrVjNM","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","5TmlrZV","1knsfWw","3777865WWsdvf","1109532ptFHPd","1012358WAdnsG","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","5325488pMKcVU"];return(b=function(){return t})()}const M=W;function W(t,s){t-=459;return g()[t]}function g(){const t=["values","config","Must provide a token","validateConfig"," adapter failed:","platform","[Track] Skip Firebase initialization (initializeFirebase = false)","providers","allSettled","clearUserId","FIREBASE","setUserId","605088WNrEsP","token","384yKwtET","[Track] ","32158fpmMNA","492UzBrao","setUserProperties","push","Must provide a version","61839MtUIkY","track SDK not initialized, please call initialize() first","Invalid token: ","[Track] Clear User ID","platformConfig","673916xMBCMM","83515TDlSkK","debug","initialized","set","warn","keys","420088DNJbVq","initialize","log","getInitializedProviders","initialize ","6081gtfkRB","initializeFirebase","70ZxbMFS","Must provide a platform","[Track] Set User Properties:","version","adapters","error","track"];return(g=function(){return t})()}!function(){const t=W,s=g();for(;;)try{if(219969===parseInt(t(479))/1+-parseInt(t(472))/2+parseInt(t(484))/3*(-parseInt(t(463))/4)+parseInt(t(473))/5+parseInt(t(505))/6+-parseInt(t(462))/7*(-parseInt(t(460))/8)+-parseInt(t(467))/9*(-parseInt(t(486))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class TrackClient{constructor(t){const s=W;this[s(490)]=new Map,this[s(475)]=!1,this[s(494)]=t,this[s(496)](),this.platformConfig=function(t){const s=w(t),r=v[s];if(!r)throw new Error("invalid token: "+t);return r}(t.token)}validateConfig(){const t=W;if(!this[t(494)][t(459)])throw new Error(t(495));if(!this.config[t(498)])throw new Error(t(487));if(!this.config[t(489)])throw new Error(t(466));if(!(w(this[t(494)][t(459)])in v))throw new Error(t(469)+this[t(494)][t(459)])}async[M(480)](){const t=M;if(this[t(475)])return;const s=[],r=!1!==this[t(494)][t(485)];for(const e of this[t(471)][t(500)])try{if(e===exports.TrackProvider[t(503)]&&!r){this[t(494)][t(474)]&&console.log(t(499));continue}let n;switch(e){case exports.TrackProvider[t(503)]:n=new f(this[t(471)].firebaseConfig);break;case exports.TrackProvider.SENSORS:n=new u(this[t(494)][t(459)],this[t(494)].platform,this[t(494)][t(489)],this[t(471)].sensorsConfig);break;default:console.warn("unknown provider: "+e);continue}this[t(490)][t(476)](e,n),s[t(465)](n.initialize())}catch(s){console[t(491)](t(483)+e+t(497),s)}await Promise.allSettled(s),this[t(475)]=!0,this[t(494)].debug&&console[t(481)]("Track SDK initialized, enabled providers:",Array.from(this[t(490)].keys()))}async[M(492)](t,s){const r=M;if(!this[r(475)])return void console[r(477)](r(468));this[r(494)][r(474)]&&console.log(r(461)+t,s);const e=[];for(const n of this.adapters[r(493)]())e[r(465)](n[r(492)](t,s));await Promise.allSettled(e)}async[M(504)](t){const s=M;if(!this[s(475)])return void console.warn(s(468));this.config[s(474)]&&console[s(481)]("[Track] Set User ID:",t);const r=[];for(const e of this[s(490)].values())r[s(465)](e.setUserId(t));await Promise[s(501)](r)}async[M(464)](t){const s=M;if(!this[s(475)])return void console[s(477)](s(468));this[s(494)][s(474)]&&console.log(s(488),t);const r=[];for(const e of this[s(490)][s(493)]())r[s(465)](e[s(464)](t));await Promise[s(501)](r)}async[M(502)](){const t=M;if(!this[t(475)])return void console[t(477)](t(468));this.config[t(474)]&&console.log(t(470));const s=[];for(const r of this[t(490)].values())s.push(r[t(502)]());await Promise[t(501)](s)}[M(482)](){const t=M;return Array.from(this[t(490)][t(478)]())}}function J(){var t=["32SgbGKg","13277sDXSua","6010DhxHtX","783710XdSXHe","97871pbrJYC","242604lBScki","30678fUxqQA","316cJoVjP","1766924BGaTQl","501bLqUoP","532ArrsRj"];return(J=function(){return t})()}function N(t,s){return t-=409,J()[t]}!function(){for(var t=N,s=J();;)try{if(225315===parseInt(t(416))/1+-parseInt(t(419))/2*(parseInt(t(410))/3)+parseInt(t(409))/4+parseInt(t(415))/5+-parseInt(t(418))/6*(-parseInt(t(411))/7)+-parseInt(t(412))/8*(parseInt(t(417))/9)+parseInt(t(414))/10*(-parseInt(t(413))/11))break;s.push(s.shift())}catch(t){s.push(s.shift())}}(),exports.TrackClient=TrackClient;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as s from"sa-sdk-javascript";function t(){var s=["FIREBASE","sensors","3427990UDPcfb","732221cCZylQ","610EesDrh","290166KRmVZn","SENSORS","767868FUFJoM","8yoeguU","280562POuZwM","firebase","134559xNtffz","1640610FJxxZv","2QLUlNw"];return(t=function(){return s})()}var i,n,r;function e(s,i){return s-=130,t()[s]}!function(){for(var s=e,i=t();;)try{if(771052===-parseInt(s(132))/1*(-parseInt(s(136))/2)+-parseInt(s(142))/3+parseInt(s(130))/4+-parseInt(s(139))/5+parseInt(s(135))/6+parseInt(s(140))/7*(-parseInt(s(131))/8)+-parseInt(s(134))/9*(-parseInt(s(141))/10))break;i.push(i.shift())}catch(s){i.push(i.shift())}}(),(n=i||(i={}))[(r=e)(137)]=r(133),n[r(143)]=r(138);const a=o;function o(s,t){s-=324;return c()[s]}function c(){const s=["initialized","firebase/app","1294996CTdGBw","117880piZAsY","13268690mThkxa","track","setUserId","initialize","499492ZIEozO","setUserProperties","7MYWKQW","1726578GAgBtl","323249EfbwRS","1431496auqJlP","analytics","firebase/analytics","3JFpzjR","clearUserId","config","firebase initialize failed:","156BDkgia"];return(c=function(){return s})()}!function(){const s=o,t=c();for(;;)try{if(329546===-parseInt(s(338))/1+parseInt(s(334))/2+-parseInt(s(342))/3*(parseInt(s(328))/4)+parseInt(s(329))/5*(-parseInt(s(325))/6)+parseInt(s(336))/7*(-parseInt(s(339))/8)+parseInt(s(337))/9+parseInt(s(330))/10)break;t.push(t.shift())}catch(s){t.push(t.shift())}}();class l{constructor(s){const t=o;this[t(340)]=null,this[t(326)]=!1,this[t(344)]=s}async[a(333)](){const s=a;if(!this.initialized)try{const{initializeApp:t}=await import(s(327)),{getAnalytics:i}=await import(s(341)),n=t(this[s(344)]);this[s(340)]=i(n),this[s(326)]=!0}catch(t){throw console.error(s(324),t),t}}async[a(331)](s,t){}async[a(332)](s){}async[a(335)](s){}async[a(343)](){}}var h=f;function f(s,t){return s-=115,p()[s]}function p(){var s=["logout","3511144ZxjYLm","token","quick","5612CNvzaU","setUserId","sensors sdk track failed:","clearUserId","autoTrack","160655QQZKDa","sensors sdk setUserId failed:","sensors sdk not initialized, skip setUserProperties","2366274IZTaUy","10dUBJOI","?token=","warn","sensors sdk not found, please install it by running","error","1745MSAEoG","heatmap","sensors sdk not initialized, skip track","sensors sdk not initialized, skip setUserId","track","2142339RwGjZW","setProfile","initialized","19190160GIMdmP","setUserProperties","showLog","ajax","sensors","sensors sdk init failed:","initialize","7yLGEJX","config","990956RPlaKT","sensors sdk setUserProperties failed:"];return(p=function(){return s})()}!function(){for(var s=f,t=p();;)try{if(418369===-parseInt(s(144))/1+-parseInt(s(133))/2+-parseInt(s(121))/3+parseInt(s(139))/4*(parseInt(s(116))/5)+parseInt(s(147))/6*(-parseInt(s(131))/7)+-parseInt(s(136))/8+-parseInt(s(124))/9*(-parseInt(s(148))/10))break;t.push(t.shift())}catch(s){t.push(t.shift())}}();class I{constructor(s,t){var i=f;this.sensors=null,this[i(123)]=!1,this[i(137)]=s,this.config=t}async[h(130)](){var t=h;if(!this.initialized)try{if(!s)throw new Error(t(151));this[t(128)]=s,this.sensors.init({server_url:this.config.serverUrl+(t(149)+this[t(137)]),show_log:this[t(132)][t(126)]??!1,heatmap:this.config[t(117)]??{},is_track_single_page:!0,send_type:t(127)}),this[t(123)]=!0,this.sensors[t(138)](t(143))}catch(s){throw console.error(t(129),s),s}}async[h(120)](s,t){var i=h;if(this.initialized&&this[i(128)])try{this[i(128)][i(120)](s,t??{})}catch(s){console[i(115)](i(141),s)}else console[i(150)](i(118))}async[h(140)](s){var t=h;if(this[t(123)]&&this[t(128)])try{this.sensors.login(s)}catch(s){console.error(t(145),s)}else console[t(150)](t(119))}async[h(125)](s){var t=h;if(this[t(123)]&&this.sensors)try{this.sensors[t(122)](s)}catch(s){console[t(115)](t(134),s)}else console[t(150)](t(146))}async[h(142)](){var s=h;if(this[s(123)]&&this[s(128)])try{this.sensors[s(135)]()}catch(s){console.error("sensors sdk clearUserId failed:",s)}}}function u(s,t){return s-=203,w()[s]}function d(s){var t=u;return typeof window!==t(210)&&window.btoa?window[t(211)](s):Buffer[t(209)](s,t(213))[t(203)](t(206))}function k(s){var t,i;return JSON[u(222)]((t=s,i=u,"undefined"!=typeof window&&window[i(204)]?window[i(204)](t):Buffer[i(209)](t,i(206))[i(203)](i(213))))}function w(){var s=["5924314IuEinC","1791170YtRuWg","9OHPToU","12dudggP","22872hHVHtE","13758890RkrFXf","parse","toString","atob","397034dVRKGj","base64","3297bcxZBZ","9LnLuZP","from","undefined","btoa","5840112kVBDgt","utf-8","721738dFfGcd","12IuQZan"];return(w=function(){return s})()}!function(){for(var s=u,t=w();;)try{if(706665===parseInt(s(214))/1+parseInt(s(205))/2*(parseInt(s(218))/3)+-parseInt(s(219))/4*(parseInt(s(217))/5)+parseInt(s(212))/6+parseInt(s(207))/7*(-parseInt(s(220))/8)+-parseInt(s(208))/9*(-parseInt(s(221))/10)+-parseInt(s(216))/11*(parseInt(s(215))/12))break;t.push(t.shift())}catch(s){t.push(t.shift())}}();const z=Z;function y(){const s=["eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","SENSORS","26621368Pugffv","1022312geglzp","FIREBASE","2363529WbTvYo","4010830HlUJSd","2243758JJZYtW","3CLfEqV","2608470MmAjIx","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","464221czTnMv"];return(y=function(){return s})()}function Z(s,t){s-=394;return y()[s]}!function(){const s=Z,t=y();for(;;)try{if(586729===-parseInt(s(401))/1+-parseInt(s(396))/2+-parseInt(s(397))/3*(parseInt(s(405))/4)+-parseInt(s(395))/5+-parseInt(s(398))/6+parseInt(s(394))/7+parseInt(s(404))/8)break;t.push(t.shift())}catch(s){t.push(t.shift())}}();const m={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[i.FIREBASE,i[z(403)]],firebaseConfig:k(z(399)),sensorsConfig:k(z(402))},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[i[z(406)],i[z(403)]],firebaseConfig:k(z(400)),sensorsConfig:k(z(402))}};function v(s,t){s-=256;return W()[s]}const b=v;function W(){const s=["Invalid token: ","values","FIREBASE","SENSORS","error","token","434IlxLix","[Track] Skip Firebase initialization (initializeFirebase = false)","initialize","allSettled","platformConfig","initialize ","[Track] Set User Properties:","initialized","21758530ScPFqr","validateConfig","Must provide a token","adapters","Track SDK initialized, enabled providers:","setUserProperties","4904053othnyg","clearUserId","debug"," adapter failed:","log","471950BcvnhH","track","unknown provider: ","9HvWPKX","initializeFirebase","2265836jRDolN","warn","[Track] Clear User ID","providers","[Track] Set User ID:","config","getInitializedProviders","889992nBqDuO","5gRTFdn","from","track SDK not initialized, please call initialize() first","push","sensorsConfig","4287FIamXn","set","keys","6813888HUrKVz"];return(W=function(){return s})()}!function(){const s=v,t=W();for(;;)try{if(632979===-parseInt(s(259))/1+parseInt(s(287))/2*(parseInt(s(277))/3)+parseInt(s(264))/4*(parseInt(s(272))/5)+-parseInt(s(280))/6+-parseInt(s(301))/7+-parseInt(s(271))/8+-parseInt(s(262))/9*(-parseInt(s(295))/10))break;t.push(t.shift())}catch(s){t.push(t.shift())}}();class TrackClient{constructor(s){const t=v;this[t(298)]=new Map,this[t(294)]=!1,this[t(269)]=s,this[t(296)](),this[t(291)]=function(s){const t=d(s),i=m[t];if(!i)throw new Error("invalid token: "+s);return i}(s[t(286)])}[b(296)](){const s=b;if(!this[s(269)][s(286)])throw new Error(s(297));if(!(d(this[s(269)][s(286)])in m))throw new Error(s(281)+this[s(269)][s(286)])}async[b(289)](){const s=b;if(this[s(294)])return;const t=[],n=!1!==this[s(269)][s(263)];for(const r of this[s(291)][s(267)])try{if(r===i[s(283)]&&!n){this[s(269)][s(256)]&&console[s(258)](s(288));continue}let e;switch(r){case i[s(283)]:e=new l(this[s(291)].firebaseConfig);break;case i[s(284)]:e=new I(this[s(269)][s(286)],this[s(291)][s(276)]);break;default:console[s(265)](s(261)+r);continue}this.adapters[s(278)](r,e),t[s(275)](e.initialize())}catch(t){console[s(285)](s(292)+r+s(257),t)}await Promise[s(290)](t),this[s(294)]=!0,this.config[s(256)]&&console.log(s(299),Array[s(273)](this.adapters[s(279)]()))}async[b(260)](s,t){const i=b;if(!this[i(294)])return void console.warn(i(274));this[i(269)][i(256)]&&console[i(258)]("[Track] "+s,t);const n=[];for(const r of this[i(298)][i(282)]())n[i(275)](r.track(s,t));await Promise[i(290)](n)}async setUserId(s){const t=b;if(!this[t(294)])return void console[t(265)](t(274));this[t(269)][t(256)]&&console[t(258)](t(268),s);const i=[];for(const n of this[t(298)][t(282)]())i.push(n.setUserId(s));await Promise[t(290)](i)}async setUserProperties(s){const t=b;if(!this.initialized)return void console[t(265)](t(274));this[t(269)][t(256)]&&console[t(258)](t(293),s);const i=[];for(const n of this.adapters[t(282)]())i.push(n[t(300)](s));await Promise[t(290)](i)}async[b(302)](){const s=b;if(!this[s(294)])return void console[s(265)]("track SDK not initialized, please call initialize() first");this[s(269)][s(256)]&&console[s(258)](s(266));const t=[];for(const i of this[s(298)][s(282)]())t[s(275)](i[s(302)]());await Promise[s(290)](t)}[b(270)](){const s=b;return Array[s(273)](this[s(298)][s(279)]())}}function g(s,t){return s-=313,J()[s]}function J(){var s=["4298IHpZxp","358508BbNENt","44889IjODWb","1501494SIAtKt","30maoPex","127900YwwWas","481854wvVbsV","4880646VKSrHS","1kszukf","2376CPwdiv"];return(J=function(){return s})()}!function(){for(var s=g,t=J();;)try{if(285597===parseInt(s(318))/1*(parseInt(s(316))/2)+-parseInt(s(322))/3+-parseInt(s(321))/4*(parseInt(s(314))/5)+parseInt(s(313))/6+-parseInt(s(320))/7*(parseInt(s(319))/8)+parseInt(s(317))/9+-parseInt(s(315))/10)break;t.push(t.shift())}catch(s){t.push(t.shift())}}();export{TrackClient,i as TrackProvider};
|
|
1
|
+
import{initializeApp as t}from"firebase/app";import{getAnalytics as s}from"firebase/analytics";import*as n from"sa-sdk-javascript";var i,r,e;function o(t,s){return t-=371,a()[t]}function a(){var t=["sensors","297tDQJxZ","163487LncWyn","1684045buxUfK","2428320IZTMRJ","2371179ljcPSQ","4vqhmKv","22YGBMeo","455odrInS","149958gkQzQA","6bTtEDm","SENSORS","firebase","6024496gXXvna","305710CCPtqR"];return(a=function(){return t})()}!function(){for(var t=o,s=a();;)try{if(829439===-parseInt(t(374))/1*(parseInt(t(382))/2)+-parseInt(t(377))/3+parseInt(t(378))/4*(parseInt(t(375))/5)+parseInt(t(381))/6*(parseInt(t(380))/7)+parseInt(t(385))/8+parseInt(t(373))/9*(-parseInt(t(371))/10)+-parseInt(t(379))/11*(-parseInt(t(376))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}(),r=i||(i={}),e=o,r.FIREBASE=e(384),r[e(383)]=e(372);const c=l;function l(t,s){t-=112;return p()[t]}function p(){const t=["analytics","track","70EJcNND","108nQVMhI","firebase initialize failed:","error","setUserProperties","8424VnTBHs","setUserId","1687wrwdEo","154vPHpGa","631558cnPISb","initialized","2554428KKZBIe","config","20175AspqHN","306945kDtkwJ","610ZdiTle","7401vVaVdR","192996MJPuKB","clearUserId"];return(p=function(){return t})()}!function(){const t=l,s=p();for(;;)try{if(445436===-parseInt(t(117))/1+parseInt(t(123))/2*(parseInt(t(124))/3)+-parseInt(t(130))/4*(-parseInt(t(121))/5)+parseInt(t(119))/6+parseInt(t(115))/7*(parseInt(t(113))/8)+-parseInt(t(122))/9*(parseInt(t(129))/10)+-parseInt(t(116))/11*(parseInt(t(125))/12))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class h{constructor(t){const s=l;this.analytics=null,this[s(118)]=!1,this[s(120)]=t}async initialize(){const n=l;if(!this[n(118)])try{const i=t(this[n(120)]);this[n(127)]=s(i),this[n(118)]=!0}catch(t){throw console[n(132)](n(131),t),t}}async[c(128)](t,s){}async[c(114)](t){}async[c(112)](t){}async[c(126)](){}}function f(t,s){t-=255;return d()[t]}const I=f;function d(){const t=["login","warn","4205148LagySc","quick","ajax","?t=","token","setUserProperties","sensors sdk init failed:","10000HGUIKT","36376dxXjRM","sensors sdk not initialized, skip setUserProperties","1395nYjOqU","2158800zPZZZU","serverUrl","setUserId","autoTrack","sensors sdk not initialized, skip setUserId","initialized","sensors sdk not found, please install it by running","sensors sdk track failed:","platform","sensors sdk setUserProperties failed:","1924gzmytc","showLog","10NtlfOT","sensors sdk clearUserId failed:","error","config","2558456mtgsyU","initialize","23677291PEKAMT","heatmap","93GLlCYA","&p=","&v=","version","5FnRYrA","sensors sdk not initialized, skip track","sensors sdk setUserId failed:","track","init","clearUserId","sensors"];return(d=function(){return t})()}!function(){const t=f,s=d();for(;;)try{if(455446===parseInt(t(271))/1+parseInt(t(285))/2*(parseInt(t(295))/3)+-parseInt(t(291))/4*(parseInt(t(255))/5)+-parseInt(t(264))/6+parseInt(t(275))/7+-parseInt(t(272))/8*(parseInt(t(274))/9)+-parseInt(t(287))/10*(-parseInt(t(293))/11))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class u{constructor(t,s,n,i){const r=f;this[r(261)]=null,this.initialized=!1,this[r(268)]=t,this[r(283)]=s,this[r(298)]=n,this[r(290)]=i}async[I(292)](){const t=I;if(!this[t(280)])try{if(!n)throw new Error(t(281));this[t(261)]=n;const s=encodeURIComponent(this[t(268)]),i=encodeURIComponent(this[t(283)]),r=encodeURIComponent(this[t(298)]);this[t(261)][t(259)]({server_url:this.config[t(276)]+(t(267)+s+t(296)+i+t(297)+r),show_log:this[t(290)][t(286)]??!1,heatmap:this[t(290)][t(294)]??{},is_track_single_page:!0,send_type:t(266)}),this[t(280)]=!0,this[t(261)][t(265)](t(278))}catch(s){throw console.error(t(270),s),s}}async[I(258)](t,s){const n=I;if(this[n(280)]&&this[n(261)])try{this[n(261)][n(258)](t,s??{})}catch(t){console[n(289)](n(282),t)}else console[n(263)](n(256))}async[I(277)](t){const s=I;if(this.initialized&&this[s(261)])try{this[s(261)][s(262)](t)}catch(t){console.error(s(257),t)}else console[s(263)](s(279))}async[I(269)](t){const s=I;if(this.initialized&&this[s(261)])try{this[s(261)].setProfile(t)}catch(t){console[s(289)](s(284),t)}else console[s(263)](s(273))}async[I(260)](){const t=I;if(this[t(280)]&&this[t(261)])try{this[t(261)].logout()}catch(s){console.error(t(288),s)}}}function k(){var t=["atob","3260qrbkko","from","14772ApEzQO","undefined","toString","base64","72575yVezWQ","1kfKYQU","utf-8","10EsMsFG","204VZMywi","3182553ClSoya","111377HkznwU","456970poanGf","1899MkhrjZ","1706023vNkSru","8WqMktq","btoa","169eJFqyd"];return(k=function(){return t})()}function y(t,s){return t-=445,k()[t]}function w(t){var s=y;return typeof window!==s(455)&&window[s(449)]?window[s(449)](t):Buffer[s(453)](t,s(460))[s(456)](s(457))}function m(t){return JSON.parse((s=t,n=y,typeof window!==n(455)&&window[n(451)]?window[n(451)](s):Buffer[n(453)](s,n(457))[n(456)](n(460))));var s,n}!function(){for(var t=y,s=k();;)try{if(285664===parseInt(t(459))/1*(-parseInt(t(445))/2)+-parseInt(t(446))/3*(-parseInt(t(452))/4)+parseInt(t(458))/5+parseInt(t(462))/6*(-parseInt(t(464))/7)+parseInt(t(448))/8*(parseInt(t(463))/9)+-parseInt(t(461))/10*(-parseInt(t(447))/11)+parseInt(t(454))/12*(parseInt(t(450))/13))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const Z=M;!function(){const t=M,s=v();for(;;)try{if(354492===parseInt(t(157))/1*(parseInt(t(146))/2)+parseInt(t(149))/3+parseInt(t(145))/4+-parseInt(t(156))/5*(-parseInt(t(151))/6)+-parseInt(t(144))/7+parseInt(t(148))/8+-parseInt(t(154))/9)break;s.push(s.shift())}catch(t){s.push(s.shift())}}();const z={"MDE5YjUzNTEyMWJhNzc1ZmIwYTQ1MzY3Njg1NzU1MTU=":{providers:[i[Z(152)],i.SENSORS],firebaseConfig:m(Z(147)),sensorsConfig:m("eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19")},"MDE5YjUzNTE3ZmFiN2YxZDkwNjg5OWVhMGQyMWJlZGI=":{providers:[i[Z(152)],i[Z(153)]],firebaseConfig:m(Z(155)),sensorsConfig:m(Z(150))}};function M(t,s){t-=144;return v()[t]}function v(){const t=["85461vrkAAK","eyJzZXJ2ZXJVcmwiOiJodHRwczovL3N2LWFuYWx5dGljcy5zZy5zZWF2ZXJzZS5haS9zYSIsImhlYXRtYXAiOnsiY2xpY2ttYXAiOiJkZWZhdWx0Iiwic2Nyb2xsX25vdGljZV9tYXAiOiJkZWZhdWx0In19","880494KCWboB","FIREBASE","SENSORS","6572673qrVjNM","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjpkMTQ4OGM3MzI0MWIyZWMzNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctR0gxNk1CQ1NOVyJ9","5TmlrZV","1knsfWw","3777865WWsdvf","1109532ptFHPd","1012358WAdnsG","eyJhcGlLZXkiOiJBSXphU3lBVVVEam5HdDJKQmdiNVFFYmFFMVFybENvMTdpVWxKWGsiLCJhdXRoRG9tYWluIjoic2VhdmVyc2UtcHJvZHVjdGlvbi5maXJlYmFzZWFwcC5jb20iLCJwcm9qZWN0SWQiOiJzZWF2ZXJzZS1wcm9kdWN0aW9uIiwic3RvcmFnZUJ1Y2tldCI6InNlYXZlcnNlLXByb2R1Y3Rpb24uZmlyZWJhc2VzdG9yYWdlLmFwcCIsIm1lc3NhZ2luZ1NlbmRlcklkIjoiMTAzMzk3MzA4MzE5OCIsImFwcElkIjoiMToxMDMzOTczMDgzMTk4OndlYjo2NmI2ZTNmNmEwZjM2MDkwNmY3NTZmIiwibWVhc3VyZW1lbnRJZCI6IkctN0gySjFTQ05QRCJ9","5325488pMKcVU"];return(v=function(){return t})()}const b=W;function W(t,s){t-=459;return J()[t]}function J(){const t=["values","config","Must provide a token","validateConfig"," adapter failed:","platform","[Track] Skip Firebase initialization (initializeFirebase = false)","providers","allSettled","clearUserId","FIREBASE","setUserId","605088WNrEsP","token","384yKwtET","[Track] ","32158fpmMNA","492UzBrao","setUserProperties","push","Must provide a version","61839MtUIkY","track SDK not initialized, please call initialize() first","Invalid token: ","[Track] Clear User ID","platformConfig","673916xMBCMM","83515TDlSkK","debug","initialized","set","warn","keys","420088DNJbVq","initialize","log","getInitializedProviders","initialize ","6081gtfkRB","initializeFirebase","70ZxbMFS","Must provide a platform","[Track] Set User Properties:","version","adapters","error","track"];return(J=function(){return t})()}!function(){const t=W,s=J();for(;;)try{if(219969===parseInt(t(479))/1+-parseInt(t(472))/2+parseInt(t(484))/3*(-parseInt(t(463))/4)+parseInt(t(473))/5+parseInt(t(505))/6+-parseInt(t(462))/7*(-parseInt(t(460))/8)+-parseInt(t(467))/9*(-parseInt(t(486))/10))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();class TrackClient{constructor(t){const s=W;this[s(490)]=new Map,this[s(475)]=!1,this[s(494)]=t,this[s(496)](),this.platformConfig=function(t){const s=w(t),n=z[s];if(!n)throw new Error("invalid token: "+t);return n}(t.token)}validateConfig(){const t=W;if(!this[t(494)][t(459)])throw new Error(t(495));if(!this.config[t(498)])throw new Error(t(487));if(!this.config[t(489)])throw new Error(t(466));if(!(w(this[t(494)][t(459)])in z))throw new Error(t(469)+this[t(494)][t(459)])}async[b(480)](){const t=b;if(this[t(475)])return;const s=[],n=!1!==this[t(494)][t(485)];for(const r of this[t(471)][t(500)])try{if(r===i[t(503)]&&!n){this[t(494)][t(474)]&&console.log(t(499));continue}let e;switch(r){case i[t(503)]:e=new h(this[t(471)].firebaseConfig);break;case i.SENSORS:e=new u(this[t(494)][t(459)],this[t(494)].platform,this[t(494)][t(489)],this[t(471)].sensorsConfig);break;default:console.warn("unknown provider: "+r);continue}this[t(490)][t(476)](r,e),s[t(465)](e.initialize())}catch(s){console[t(491)](t(483)+r+t(497),s)}await Promise.allSettled(s),this[t(475)]=!0,this[t(494)].debug&&console[t(481)]("Track SDK initialized, enabled providers:",Array.from(this[t(490)].keys()))}async[b(492)](t,s){const n=b;if(!this[n(475)])return void console[n(477)](n(468));this[n(494)][n(474)]&&console.log(n(461)+t,s);const i=[];for(const r of this.adapters[n(493)]())i[n(465)](r[n(492)](t,s));await Promise.allSettled(i)}async[b(504)](t){const s=b;if(!this[s(475)])return void console.warn(s(468));this.config[s(474)]&&console[s(481)]("[Track] Set User ID:",t);const n=[];for(const i of this[s(490)].values())n[s(465)](i.setUserId(t));await Promise[s(501)](n)}async[b(464)](t){const s=b;if(!this[s(475)])return void console[s(477)](s(468));this[s(494)][s(474)]&&console.log(s(488),t);const n=[];for(const i of this[s(490)][s(493)]())n[s(465)](i[s(464)](t));await Promise[s(501)](n)}async[b(502)](){const t=b;if(!this[t(475)])return void console[t(477)](t(468));this.config[t(474)]&&console.log(t(470));const s=[];for(const n of this[t(490)].values())s.push(n[t(502)]());await Promise[t(501)](s)}[b(482)](){const t=b;return Array.from(this[t(490)][t(478)]())}}function N(){var t=["32SgbGKg","13277sDXSua","6010DhxHtX","783710XdSXHe","97871pbrJYC","242604lBScki","30678fUxqQA","316cJoVjP","1766924BGaTQl","501bLqUoP","532ArrsRj"];return(N=function(){return t})()}function S(t,s){return t-=409,N()[t]}!function(){for(var t=S,s=N();;)try{if(225315===parseInt(t(416))/1+-parseInt(t(419))/2*(parseInt(t(410))/3)+parseInt(t(409))/4+parseInt(t(415))/5+-parseInt(t(418))/6*(-parseInt(t(411))/7)+-parseInt(t(412))/8*(parseInt(t(417))/9)+parseInt(t(414))/10*(-parseInt(t(413))/11))break;s.push(s.shift())}catch(t){s.push(s.shift())}}();export{TrackClient,i as TrackProvider};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seaverse/track-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Unified analytics SDK for Firebase and Sensors Analytics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"author": "SeaVerse Team <support@seaverse.com>",
|
|
44
44
|
"license": "MIT",
|
|
45
|
-
"
|
|
46
|
-
"firebase": "^11.
|
|
47
|
-
"sa-sdk-javascript": "^1.27.
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"firebase": "^11.2.0",
|
|
47
|
+
"sa-sdk-javascript": "^1.27.11"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@rollup/plugin-commonjs": "^29.0.0",
|