lee_web_track_sdk 0.0.12 → 0.0.13
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/dist/index.cjs +258 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +258 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,9 @@ function _array_like_to_array(arr, len) {
|
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
6
9
|
function _array_without_holes(arr) {
|
|
7
10
|
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
11
|
}
|
|
@@ -119,6 +122,33 @@ function _is_native_function(fn) {
|
|
|
119
122
|
function _iterable_to_array(iter) {
|
|
120
123
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
121
124
|
}
|
|
125
|
+
function _iterable_to_array_limit(arr, i) {
|
|
126
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
127
|
+
if (_i == null) return;
|
|
128
|
+
var _arr = [];
|
|
129
|
+
var _n = true;
|
|
130
|
+
var _d = false;
|
|
131
|
+
var _s, _e;
|
|
132
|
+
try {
|
|
133
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
134
|
+
_arr.push(_s.value);
|
|
135
|
+
if (i && _arr.length === i) break;
|
|
136
|
+
}
|
|
137
|
+
} catch (err) {
|
|
138
|
+
_d = true;
|
|
139
|
+
_e = err;
|
|
140
|
+
} finally{
|
|
141
|
+
try {
|
|
142
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
143
|
+
} finally{
|
|
144
|
+
if (_d) throw _e;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return _arr;
|
|
148
|
+
}
|
|
149
|
+
function _non_iterable_rest() {
|
|
150
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
151
|
+
}
|
|
122
152
|
function _non_iterable_spread() {
|
|
123
153
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
124
154
|
}
|
|
@@ -137,6 +167,30 @@ function _object_spread(target) {
|
|
|
137
167
|
}
|
|
138
168
|
return target;
|
|
139
169
|
}
|
|
170
|
+
function ownKeys(object, enumerableOnly) {
|
|
171
|
+
var keys = Object.keys(object);
|
|
172
|
+
if (Object.getOwnPropertySymbols) {
|
|
173
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
174
|
+
if (enumerableOnly) {
|
|
175
|
+
symbols = symbols.filter(function(sym) {
|
|
176
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
keys.push.apply(keys, symbols);
|
|
180
|
+
}
|
|
181
|
+
return keys;
|
|
182
|
+
}
|
|
183
|
+
function _object_spread_props(target, source) {
|
|
184
|
+
source = source != null ? source : {};
|
|
185
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
186
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
187
|
+
} else {
|
|
188
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
189
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return target;
|
|
193
|
+
}
|
|
140
194
|
function _possible_constructor_return(self, call) {
|
|
141
195
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
142
196
|
return call;
|
|
@@ -150,6 +204,9 @@ function _set_prototype_of(o, p) {
|
|
|
150
204
|
};
|
|
151
205
|
return _set_prototype_of(o, p);
|
|
152
206
|
}
|
|
207
|
+
function _sliced_to_array(arr, i) {
|
|
208
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
209
|
+
}
|
|
153
210
|
function _to_consumable_array(arr) {
|
|
154
211
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
155
212
|
}
|
|
@@ -291,14 +348,18 @@ function _ts_generator(thisArg, body) {
|
|
|
291
348
|
}
|
|
292
349
|
}
|
|
293
350
|
// src/config/index.ts
|
|
351
|
+
var MAX_CACHE_SIZE = 15;
|
|
352
|
+
var MAX_CACHE_TIME = 3e5;
|
|
353
|
+
var MAX_TIMEOUT = 1e4;
|
|
294
354
|
var defaultConfig = {
|
|
295
355
|
project_name: "",
|
|
296
356
|
report_url: "",
|
|
297
357
|
app_version: "",
|
|
298
358
|
adapter: "web",
|
|
299
|
-
maxCacheSize:
|
|
300
|
-
maxCacheTime:
|
|
301
|
-
maxTimeout:
|
|
359
|
+
maxCacheSize: MAX_CACHE_SIZE,
|
|
360
|
+
maxCacheTime: MAX_CACHE_TIME,
|
|
361
|
+
maxTimeout: MAX_TIMEOUT,
|
|
362
|
+
isDebug: false,
|
|
302
363
|
plugins: [
|
|
303
364
|
{
|
|
304
365
|
type: "track",
|
|
@@ -378,6 +439,12 @@ var EVENT_KEYS = [
|
|
|
378
439
|
var CACHE_DATA_NAME = "fr-track-cache-data";
|
|
379
440
|
var CACHE_ERR_DATA_NAME = "fr-track-cache-err-data";
|
|
380
441
|
// src/utils/utils.ts
|
|
442
|
+
var logInfo = function(message, title) {
|
|
443
|
+
var isDebug = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
444
|
+
if (!isDebug) return;
|
|
445
|
+
var logTitle = title ? "[Fr-track log ".concat(title, "]") : "[Fr-track log]";
|
|
446
|
+
console.log("".concat(logTitle, ":"), message);
|
|
447
|
+
};
|
|
381
448
|
var logWarn = function(message, title) {
|
|
382
449
|
var logTitle = title ? "[Fr-track warning ".concat(title, "]") : "[Fr-track warning]";
|
|
383
450
|
console.warn("".concat(logTitle, ":"), message);
|
|
@@ -428,6 +495,36 @@ var getUserTimeZone = function() {
|
|
|
428
495
|
}
|
|
429
496
|
}
|
|
430
497
|
};
|
|
498
|
+
var sanitizeCustomData = function(data) {
|
|
499
|
+
var sanitized = {};
|
|
500
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
501
|
+
try {
|
|
502
|
+
for(var _iterator = Object.entries(data)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
503
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
504
|
+
if (typeof value === "string") {
|
|
505
|
+
sanitized[key] = value.replace(/<[^>]*>/g, "");
|
|
506
|
+
} else if (getVariableType(value) === "object") {
|
|
507
|
+
sanitized[key] = sanitizeCustomData(value);
|
|
508
|
+
} else {
|
|
509
|
+
sanitized[key] = value;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
} catch (err) {
|
|
513
|
+
_didIteratorError = true;
|
|
514
|
+
_iteratorError = err;
|
|
515
|
+
} finally{
|
|
516
|
+
try {
|
|
517
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
518
|
+
_iterator.return();
|
|
519
|
+
}
|
|
520
|
+
} finally{
|
|
521
|
+
if (_didIteratorError) {
|
|
522
|
+
throw _iteratorError;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return sanitized;
|
|
527
|
+
};
|
|
431
528
|
// src/utils/validator.ts
|
|
432
529
|
function validateEventType(eventType) {
|
|
433
530
|
return typeof eventType === "string" && EVENT_TYPES.includes(eventType);
|
|
@@ -509,8 +606,9 @@ var cleanTrackData = function(rawData) {
|
|
|
509
606
|
var aggregationData = function(rawData) {
|
|
510
607
|
try {
|
|
511
608
|
var _loop = function(i) {
|
|
512
|
-
var
|
|
513
|
-
if (!
|
|
609
|
+
var rawItem = rawData[i];
|
|
610
|
+
if (!rawItem) return "continue";
|
|
611
|
+
var item = _object_spread({}, rawItem);
|
|
514
612
|
if (CAN_AGGREGATION_TYPES.includes(item.event_type) || item.is_aggregation) {
|
|
515
613
|
delete item.is_aggregation;
|
|
516
614
|
var currentDate = new Date(item.event_time).setHours(0, 0, 0, 0);
|
|
@@ -686,50 +784,57 @@ var WebReport = /*#__PURE__*/ function(Report) {
|
|
|
686
784
|
{
|
|
687
785
|
key: "retry",
|
|
688
786
|
value: function retry(failedData, callback) {
|
|
787
|
+
var retryCount = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
689
788
|
return _async_to_generator(function() {
|
|
690
|
-
var _this,
|
|
789
|
+
var _this, err;
|
|
691
790
|
return _ts_generator(this, function(_state) {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
791
|
+
switch(_state.label){
|
|
792
|
+
case 0:
|
|
793
|
+
_this = this;
|
|
794
|
+
if (!(failedData === null || failedData === void 0 ? void 0 : failedData.length)) return [
|
|
795
|
+
2
|
|
796
|
+
];
|
|
797
|
+
if (retryCount >= 3) {
|
|
798
|
+
if (!callback) return [
|
|
799
|
+
2
|
|
800
|
+
];
|
|
801
|
+
callback();
|
|
802
|
+
return [
|
|
803
|
+
2
|
|
804
|
+
];
|
|
805
|
+
}
|
|
806
|
+
_state.label = 1;
|
|
807
|
+
case 1:
|
|
808
|
+
_state.trys.push([
|
|
809
|
+
1,
|
|
810
|
+
3,
|
|
811
|
+
,
|
|
812
|
+
4
|
|
813
|
+
]);
|
|
814
|
+
return [
|
|
815
|
+
4,
|
|
816
|
+
this.send(failedData)
|
|
817
|
+
];
|
|
818
|
+
case 2:
|
|
819
|
+
_state.sent();
|
|
820
|
+
return [
|
|
821
|
+
3,
|
|
822
|
+
4
|
|
823
|
+
];
|
|
824
|
+
case 3:
|
|
825
|
+
err = _state.sent();
|
|
826
|
+
setTimeout(function() {
|
|
827
|
+
_this.retry(failedData, callback, retryCount + 1);
|
|
828
|
+
}, 3e3);
|
|
829
|
+
return [
|
|
830
|
+
3,
|
|
831
|
+
4
|
|
832
|
+
];
|
|
833
|
+
case 4:
|
|
834
|
+
return [
|
|
835
|
+
2
|
|
836
|
+
];
|
|
705
837
|
}
|
|
706
|
-
retryFun = function() {
|
|
707
|
-
return _async_to_generator(function() {
|
|
708
|
-
return _ts_generator(this, function(_state) {
|
|
709
|
-
switch(_state.label){
|
|
710
|
-
case 0:
|
|
711
|
-
return [
|
|
712
|
-
4,
|
|
713
|
-
this.send(failedData).catch(function() {
|
|
714
|
-
setTimeout(function() {
|
|
715
|
-
retryCount++;
|
|
716
|
-
retryFun();
|
|
717
|
-
}, 3e3);
|
|
718
|
-
})
|
|
719
|
-
];
|
|
720
|
-
case 1:
|
|
721
|
-
_state.sent();
|
|
722
|
-
return [
|
|
723
|
-
2
|
|
724
|
-
];
|
|
725
|
-
}
|
|
726
|
-
});
|
|
727
|
-
}).call(_this);
|
|
728
|
-
};
|
|
729
|
-
retryFun();
|
|
730
|
-
return [
|
|
731
|
-
2
|
|
732
|
-
];
|
|
733
838
|
});
|
|
734
839
|
}).call(this);
|
|
735
840
|
}
|
|
@@ -744,22 +849,34 @@ var WebReport = /*#__PURE__*/ function(Report) {
|
|
|
744
849
|
return [
|
|
745
850
|
2,
|
|
746
851
|
new Promise(function(resolve, reject) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
resolve(xhr.response);
|
|
852
|
+
if ("sendBeacon" in navigator) {
|
|
853
|
+
var jsonData = JSON.stringify(data);
|
|
854
|
+
var formData = new FormData();
|
|
855
|
+
formData.append("data", jsonData);
|
|
856
|
+
var status = navigator.sendBeacon(url, formData);
|
|
857
|
+
if (status) {
|
|
858
|
+
resolve(true);
|
|
755
859
|
} else {
|
|
756
860
|
reject();
|
|
757
861
|
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
862
|
+
} else {
|
|
863
|
+
var xhr = new XMLHttpRequest();
|
|
864
|
+
xhr.open("POST", url, true);
|
|
865
|
+
xhr.timeout = timeout;
|
|
866
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
867
|
+
xhr.onload = function() {
|
|
868
|
+
resolve(xhr.response);
|
|
869
|
+
if (xhr.status === 0) {
|
|
870
|
+
resolve(xhr.response);
|
|
871
|
+
} else {
|
|
872
|
+
reject();
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
xhr.onerror = function() {
|
|
876
|
+
reject();
|
|
877
|
+
};
|
|
878
|
+
xhr.send(JSON.stringify(data));
|
|
879
|
+
}
|
|
763
880
|
})
|
|
764
881
|
];
|
|
765
882
|
});
|
|
@@ -786,13 +903,17 @@ var getAdapter = function(configEnv) {
|
|
|
786
903
|
};
|
|
787
904
|
// src/utils/uuid.ts
|
|
788
905
|
var getUserId = function() {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
906
|
+
try {
|
|
907
|
+
var track_uuid = localStorage.getItem("track_uuid");
|
|
908
|
+
if (track_uuid) {
|
|
909
|
+
return track_uuid;
|
|
910
|
+
}
|
|
911
|
+
var uuid = generateUserId();
|
|
912
|
+
localStorage.setItem("track_uuid", uuid);
|
|
913
|
+
return uuid;
|
|
914
|
+
} catch (e) {
|
|
915
|
+
return generateUserId();
|
|
792
916
|
}
|
|
793
|
-
var uuid = generateUserId();
|
|
794
|
-
localStorage.setItem("track_uuid", uuid);
|
|
795
|
-
return uuid;
|
|
796
917
|
};
|
|
797
918
|
// src/utils/browser.ts
|
|
798
919
|
import Browser from "bowser";
|
|
@@ -835,11 +956,11 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
835
956
|
this.userId = getUserId();
|
|
836
957
|
this.timer = null;
|
|
837
958
|
this.uvTimer = null;
|
|
959
|
+
this.lastUvReportTime = 0;
|
|
838
960
|
this.browserInfo = null;
|
|
839
961
|
this.taskQueue = [];
|
|
840
962
|
this.isProcessing = false;
|
|
841
963
|
this.reportPrevData = function() {
|
|
842
|
-
_this.reportCacheData();
|
|
843
964
|
_this.reportErrCacheData();
|
|
844
965
|
};
|
|
845
966
|
if (!instance2) {
|
|
@@ -878,14 +999,14 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
878
999
|
];
|
|
879
1000
|
case 2:
|
|
880
1001
|
_state.sent();
|
|
881
|
-
|
|
1002
|
+
logInfo("✅ 任务执行成功:".concat(currentTask.desc), "", this.instanceConfig.isDebug);
|
|
882
1003
|
return [
|
|
883
1004
|
3,
|
|
884
1005
|
5
|
|
885
1006
|
];
|
|
886
1007
|
case 3:
|
|
887
1008
|
err = _state.sent();
|
|
888
|
-
|
|
1009
|
+
logInfo(err, "❌ 任务执行失败:".concat(currentTask.desc), this.instanceConfig.isDebug);
|
|
889
1010
|
return [
|
|
890
1011
|
3,
|
|
891
1012
|
5
|
|
@@ -926,10 +1047,11 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
926
1047
|
type: "report_send",
|
|
927
1048
|
fn: function() {
|
|
928
1049
|
return _async_to_generator(function() {
|
|
929
|
-
var cacheData, cleanInfo, result;
|
|
1050
|
+
var _this, cacheData, cleanInfo, result;
|
|
930
1051
|
return _ts_generator(this, function(_state) {
|
|
931
1052
|
switch(_state.label){
|
|
932
1053
|
case 0:
|
|
1054
|
+
_this = this;
|
|
933
1055
|
if (!this.cacheFn || !this.reportFn) return [
|
|
934
1056
|
2
|
|
935
1057
|
];
|
|
@@ -947,9 +1069,10 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
947
1069
|
logWarn(cleanInfo.errReason);
|
|
948
1070
|
} else {
|
|
949
1071
|
result = aggregationData(cleanInfo.data);
|
|
950
|
-
if (result
|
|
1072
|
+
if (result === null || result === void 0 ? void 0 : result.length) {
|
|
951
1073
|
this.reportFn.send(result).catch(function(err) {
|
|
952
1074
|
logError(err, "\u4E0A\u62A5\u5931\u8D25\u6570\u636E\u5F02\u5E38");
|
|
1075
|
+
_this.cacheFn.set(CACHE_ERR_DATA_NAME, result);
|
|
953
1076
|
});
|
|
954
1077
|
}
|
|
955
1078
|
}
|
|
@@ -1130,22 +1253,32 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
1130
1253
|
if (!this.cacheFn) return [
|
|
1131
1254
|
2
|
|
1132
1255
|
];
|
|
1256
|
+
maxCacheSize = this.instanceConfig.maxCacheSize;
|
|
1133
1257
|
return [
|
|
1134
1258
|
4,
|
|
1135
|
-
this.cacheFn.
|
|
1259
|
+
this.cacheFn.get(CACHE_DATA_NAME)
|
|
1136
1260
|
];
|
|
1137
1261
|
case 1:
|
|
1138
|
-
_state.sent();
|
|
1139
|
-
|
|
1262
|
+
res = _state.sent();
|
|
1263
|
+
if (!((res === null || res === void 0 ? void 0 : res.length) >= maxCacheSize)) return [
|
|
1264
|
+
3,
|
|
1265
|
+
2
|
|
1266
|
+
];
|
|
1267
|
+
this.reportCacheData();
|
|
1268
|
+
this.toSetCacheData(params);
|
|
1140
1269
|
return [
|
|
1141
|
-
|
|
1142
|
-
|
|
1270
|
+
3,
|
|
1271
|
+
4
|
|
1143
1272
|
];
|
|
1144
1273
|
case 2:
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
this.
|
|
1148
|
-
|
|
1274
|
+
return [
|
|
1275
|
+
4,
|
|
1276
|
+
this.cacheFn.set(CACHE_DATA_NAME, params)
|
|
1277
|
+
];
|
|
1278
|
+
case 3:
|
|
1279
|
+
_state.sent();
|
|
1280
|
+
_state.label = 4;
|
|
1281
|
+
case 4:
|
|
1149
1282
|
return [
|
|
1150
1283
|
2
|
|
1151
1284
|
];
|
|
@@ -1169,6 +1302,9 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
1169
1302
|
return _ts_generator(this, function(_state) {
|
|
1170
1303
|
_this_instanceConfig = this.instanceConfig, project_name = _this_instanceConfig.project_name, app_version = _this_instanceConfig.app_version;
|
|
1171
1304
|
_this_browserInfo = this.browserInfo, osName = _this_browserInfo.osName, osVersion = _this_browserInfo.osVersion, browserName = _this_browserInfo.browserName, browserVersion = _this_browserInfo.browserVersion, platformName = _this_browserInfo.platformName;
|
|
1305
|
+
if (params.custom_data) {
|
|
1306
|
+
params.custom_data = sanitizeCustomData(params.custom_data);
|
|
1307
|
+
}
|
|
1172
1308
|
trackParams = Object.assign({
|
|
1173
1309
|
project_name: project_name,
|
|
1174
1310
|
app_version: app_version,
|
|
@@ -1203,8 +1339,47 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
1203
1339
|
* @method 自定义用户id
|
|
1204
1340
|
*/ key: "setUser",
|
|
1205
1341
|
value: function setUser(id) {
|
|
1342
|
+
var _this = this;
|
|
1206
1343
|
this.userId = id;
|
|
1207
|
-
this.
|
|
1344
|
+
this.addTask({
|
|
1345
|
+
type: "cache_update",
|
|
1346
|
+
fn: function() {
|
|
1347
|
+
return _async_to_generator(function() {
|
|
1348
|
+
var cacheData, updatedData;
|
|
1349
|
+
return _ts_generator(this, function(_state) {
|
|
1350
|
+
switch(_state.label){
|
|
1351
|
+
case 0:
|
|
1352
|
+
return [
|
|
1353
|
+
4,
|
|
1354
|
+
this.cacheFn.get(CACHE_DATA_NAME)
|
|
1355
|
+
];
|
|
1356
|
+
case 1:
|
|
1357
|
+
cacheData = _state.sent();
|
|
1358
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.length)) return [
|
|
1359
|
+
3,
|
|
1360
|
+
3
|
|
1361
|
+
];
|
|
1362
|
+
updatedData = cacheData.map(function(item) {
|
|
1363
|
+
return _object_spread_props(_object_spread({}, item), {
|
|
1364
|
+
user_id: id
|
|
1365
|
+
});
|
|
1366
|
+
});
|
|
1367
|
+
return [
|
|
1368
|
+
4,
|
|
1369
|
+
this.cacheFn.set(CACHE_DATA_NAME, updatedData)
|
|
1370
|
+
];
|
|
1371
|
+
case 2:
|
|
1372
|
+
_state.sent();
|
|
1373
|
+
_state.label = 3;
|
|
1374
|
+
case 3:
|
|
1375
|
+
return [
|
|
1376
|
+
2
|
|
1377
|
+
];
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
}).call(_this);
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1208
1383
|
}
|
|
1209
1384
|
},
|
|
1210
1385
|
{
|
|
@@ -1335,7 +1510,7 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
1335
1510
|
*/ key: "frUserView",
|
|
1336
1511
|
value: function frUserView() {
|
|
1337
1512
|
var _this = this;
|
|
1338
|
-
|
|
1513
|
+
this.lastUvReportTime = /* @__PURE__ */ new Date().setHours(0, 0, 0, 0);
|
|
1339
1514
|
var interval = 60 * 60 * 1e3;
|
|
1340
1515
|
var params = {
|
|
1341
1516
|
event_name: "user_view"
|
|
@@ -1347,7 +1522,8 @@ var FrTrack = /*#__PURE__*/ function() {
|
|
|
1347
1522
|
}
|
|
1348
1523
|
this.uvTimer = setInterval(function() {
|
|
1349
1524
|
var now = /* @__PURE__ */ new Date().setHours(0, 0, 0, 0);
|
|
1350
|
-
if (now >
|
|
1525
|
+
if (now > _this.lastUvReportTime + 24 * interval) {
|
|
1526
|
+
_this.lastUvReportTime = now;
|
|
1351
1527
|
_this.singleTrack("user_view", params);
|
|
1352
1528
|
}
|
|
1353
1529
|
}, interval);
|