cos-wx-sdk-v5 1.4.1 → 1.4.2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
9
9
 
10
+ ## [v1.4.0](https://github.com/tencentyun/cos-wx-sdk-v5/compare/v1.3.0...v1.4.0) - 2022-08-17
11
+
12
+ feat
13
+ - 新增beacon上报
14
+
15
+ ### Merged
16
+
17
+ - feat/1.4.0 [`#72`](https://github.com/tencentyun/cos-wx-sdk-v5/pull/72)
18
+
19
+ ### Commits
20
+
21
+ - Updated CHANGELOG.md [`7d52326`](https://github.com/tencentyun/cos-wx-sdk-v5/commit/7d523262e886826755a1adf0aae207b04bee7391)
22
+
10
23
  ## [v1.3.0](https://github.com/tencentyun/cos-wx-sdk-v5/compare/v1.2.1...v1.3.0) - 2022-08-09
11
24
 
12
25
  feat
@@ -6450,7 +6450,7 @@ module.exports = function(module) {
6450
6450
  /*! exports provided: name, version, description, main, scripts, repository, author, license, dependencies, devDependencies, default */
6451
6451
  /***/ (function(module) {
6452
6452
 
6453
- module.exports = JSON.parse("{\"name\":\"cos-wx-sdk-v5\",\"version\":\"1.4.1\",\"description\":\"小程序 SDK for [腾讯云对象存储服务](https://cloud.tencent.com/product/cos)\",\"main\":\"demo/lib/cos-wx-sdk-v5.min.js\",\"scripts\":{\"dev\":\"cross-env NODE_ENV=development node build.js --mode=development\",\"build\":\"cross-env NODE_ENV=production node build.js --mode=production\",\"sts.js\":\"node server/sts.js\"},\"repository\":{\"type\":\"git\",\"url\":\"http://github.com/tencentyun/cos-wx-sdk-v5.git\"},\"author\":\"carsonxu\",\"license\":\"ISC\",\"dependencies\":{\"mime\":\"^2.4.6\",\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"babel-core\":\"6.26.3\",\"babel-loader\":\"8.2.5\",\"@babel/preset-env\":\"7.16.11\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^7.0.3\",\"express\":\"^4.17.1\",\"qcloud-cos-sts\":\"^3.0.2\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}");
6453
+ module.exports = JSON.parse("{\"name\":\"cos-wx-sdk-v5\",\"version\":\"1.4.2\",\"description\":\"小程序 SDK for [腾讯云对象存储服务](https://cloud.tencent.com/product/cos)\",\"main\":\"demo/lib/cos-wx-sdk-v5.min.js\",\"scripts\":{\"dev\":\"cross-env NODE_ENV=development node build.js --mode=development\",\"build\":\"cross-env NODE_ENV=production node build.js --mode=production\",\"sts.js\":\"node server/sts.js\"},\"repository\":{\"type\":\"git\",\"url\":\"http://github.com/tencentyun/cos-wx-sdk-v5.git\"},\"author\":\"carsonxu\",\"license\":\"ISC\",\"dependencies\":{\"mime\":\"^2.4.6\",\"@xmldom/xmldom\":\"^0.8.2\"},\"devDependencies\":{\"babel-core\":\"6.26.3\",\"babel-loader\":\"8.2.5\",\"@babel/preset-env\":\"7.16.11\",\"body-parser\":\"^1.18.3\",\"cross-env\":\"^7.0.3\",\"express\":\"^4.17.1\",\"qcloud-cos-sts\":\"^3.0.2\",\"terser-webpack-plugin\":\"4.2.3\",\"webpack\":\"4.46.0\",\"webpack-cli\":\"4.10.0\"}}");
6454
6454
 
6455
6455
  /***/ }),
6456
6456
 
@@ -7395,7 +7395,7 @@ function uploadFile(params, callback) {
7395
7395
  }; // 上传链路
7396
7396
 
7397
7397
  if (self.options.EnableTracker) {
7398
- var accelerate = self.options.UseAccelerate || self.options.Domain.includes('accelerate.');
7398
+ var accelerate = self.options.UseAccelerate || typeof self.options.Domain === 'string' && self.options.Domain.includes('accelerate.');
7399
7399
  params.tracker = new Tracker({
7400
7400
  bucket: params.Bucket,
7401
7401
  region: params.Region,
@@ -7487,7 +7487,7 @@ function uploadFiles(params, callback) {
7487
7487
  TotalSize += FileSize; // 单个文件上传链路
7488
7488
 
7489
7489
  if (self.options.EnableTracker) {
7490
- var accelerate = self.options.UseAccelerate || self.options.Domain.includes('accelerate.');
7490
+ var accelerate = self.options.UseAccelerate || typeof self.options.Domain === 'string' && self.options.Domain.includes('accelerate.');
7491
7491
  fileParams.tracker = new Tracker({
7492
7492
  bucket: fileParams.Bucket,
7493
7493
  region: fileParams.Region,
@@ -12731,7 +12731,8 @@ var Tracker = /*#__PURE__*/function () {
12731
12731
  deepTracker = opt.deepTracker;
12732
12732
  var appid = bucket && bucket.substr(bucket.lastIndexOf('-') + 1) || '';
12733
12733
  this.parent = parent;
12734
- this.deepTracker = deepTracker; // 上报用到的字段
12734
+ this.deepTracker = deepTracker;
12735
+ this.delay = delay; // 上报用到的字段
12735
12736
 
12736
12737
  this.params = {
12737
12738
  // 通用字段
@@ -12888,19 +12889,19 @@ var Tracker = /*#__PURE__*/function () {
12888
12889
  }
12889
12890
 
12890
12891
  var eventCode = getEventCode(this.params.name);
12891
- var formattedParams = formatParams(this.params);
12892
- console.log(eventCode, formattedParams);
12892
+ var formattedParams = formatParams(this.params); // 兜底处理
12893
+
12894
+ if (!this.beacon) {
12895
+ this.beacon = getBeacon(this.delay || 5000);
12896
+ }
12893
12897
 
12894
12898
  if (this.params.delay === 0) {
12895
12899
  // 实时上报
12896
- this.beacon.onDirectUserAction(eventCode, formattedParams);
12900
+ this.beacon && this.beacon.onDirectUserAction(eventCode, formattedParams);
12897
12901
  } else {
12898
12902
  // 周期性上报
12899
- this.beacon.onUserAction(eventCode, formattedParams);
12900
- } // 上报结束即销毁
12901
-
12902
-
12903
- this.destroy();
12903
+ this.beacon && this.beacon.onUserAction(eventCode, formattedParams);
12904
+ }
12904
12905
  } // 生成子实例,与父所属一个链路,可用于分块上传内部流程上报单个分块操作
12905
12906
 
12906
12907
  }, {
@@ -12917,13 +12918,6 @@ var Tracker = /*#__PURE__*/function () {
12917
12918
  delay: this.params.delay
12918
12919
  });
12919
12920
  return new Tracker(subParams);
12920
- } // 链路结束后销毁实例
12921
-
12922
- }, {
12923
- key: "destroy",
12924
- value: function destroy() {
12925
- this.beacon = null;
12926
- this.params = {};
12927
12921
  }
12928
12922
  }]);
12929
12923