Skip to content

Commit 8ba6b57

Browse files
author
shengyonggen
committed
Release 1.14.23
1 parent 5e9f9f9 commit 8ba6b57

14 files changed

+73
-45
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.14.23(2021-09-28)
2+
1. 修复
3+
- 修复 `setWebviewUrl` 方法可能会导致客户 `url` 中参数丢失的问题
4+
- 修复参数 `launched` 暴露修改方法可能会导致 `$MPLaunch` 无法采集的问题
5+
- 修复浏览插件页面退出小程序采集 `$MPHide` 事件时,控制台会捕获到异常的问题
6+
17
## 1.14.22(2021-09-15)
28
1. 优化
39
- 修改初始化配置参数 `show_log` 默认值为 `fasle`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sa-sdk-miniprogram",
3-
"version": "1.14.22",
3+
"version": "1.14.23",
44
"description": "sensorsdata miniprogram sdk",
55
"main": "sensorsdata.min.js",
66
"scripts": {

product/sensorsdata.custom.es6.full.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ sa.para = {
77
server_url: '',
88
send_timeout: 1000,
99
show_log: false,
10-
launched: false,
1110
allow_amend_share_path: true,
1211
max_string_length: 500,
1312
datasend_timeout: 3000,
@@ -159,7 +158,7 @@ var ArrayProto = Array.prototype,
159158
slice = ArrayProto.slice,
160159
toString = ObjProto.toString,
161160
hasOwnProperty = ObjProto.hasOwnProperty,
162-
LIB_VERSION = '1.14.22',
161+
LIB_VERSION = '1.14.23',
163162
LIB_NAME = 'MiniProgram';
164163

165164
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -700,7 +699,7 @@ _.getCurrentPath = function() {
700699
var url = '未取到';
701700
try {
702701
var currentPage = _.getCurrentPage();
703-
url = currentPage.route;
702+
url = currentPage ? currentPage.route : url;
704703
} catch (e) {
705704
logger.info(e);
706705
}
@@ -1857,7 +1856,7 @@ sa.getLocation = function() {
18571856
});
18581857
},
18591858
fail: function(err) {
1860-
console.log('获取位置失败', err);
1859+
logger.info('获取位置失败', err);
18611860
}
18621861
});
18631862
} else {
@@ -2186,6 +2185,7 @@ sa.setWebViewUrl = function(url, after_hash) {
21862185
search = arr[2] || '',
21872186
hash = arr[3] || '',
21882187
nurl = '';
2188+
21892189
var distinct_id = sa.store.getDistinctId() || '',
21902190
first_id = sa.store.getFirstId() || '',
21912191
idIndex;
@@ -2215,7 +2215,8 @@ sa.setWebViewUrl = function(url, after_hash) {
22152215
var hasQuery = /^\?(\w)+/.test(search);
22162216
if (hasQuery) {
22172217
if (idIndex > -1) {
2218-
nurl = host + '?' + search.substring(1, idIndex) + '_sasdk=' + value + hash;
2218+
var newSearch = search.replace(/(_sasdk=)([^&]*)/gi, '_sasdk=' + value);
2219+
nurl = host + newSearch + hash;
22192220
} else {
22202221
nurl = host + '?' + search.substring(1) + '&_sasdk=' + value + hash;
22212222
}

product/sensorsdata.custom.full.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ sa.para = {
99
server_url: '',
1010
send_timeout: 1000,
1111
show_log: false,
12-
launched: false,
1312
allow_amend_share_path: true,
1413
max_string_length: 500,
1514
datasend_timeout: 3000,
@@ -161,7 +160,7 @@ var ArrayProto = Array.prototype,
161160
slice = ArrayProto.slice,
162161
toString = ObjProto.toString,
163162
hasOwnProperty = ObjProto.hasOwnProperty,
164-
LIB_VERSION = '1.14.22',
163+
LIB_VERSION = '1.14.23',
165164
LIB_NAME = 'MiniProgram';
166165

167166
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -702,7 +701,7 @@ _.getCurrentPath = function() {
702701
var url = '未取到';
703702
try {
704703
var currentPage = _.getCurrentPage();
705-
url = currentPage.route;
704+
url = currentPage ? currentPage.route : url;
706705
} catch (e) {
707706
logger.info(e);
708707
}
@@ -1859,7 +1858,7 @@ sa.getLocation = function() {
18591858
});
18601859
},
18611860
fail: function(err) {
1862-
console.log('获取位置失败', err);
1861+
logger.info('获取位置失败', err);
18631862
}
18641863
});
18651864
} else {
@@ -2188,6 +2187,7 @@ sa.setWebViewUrl = function(url, after_hash) {
21882187
search = arr[2] || '',
21892188
hash = arr[3] || '',
21902189
nurl = '';
2190+
21912191
var distinct_id = sa.store.getDistinctId() || '',
21922192
first_id = sa.store.getFirstId() || '',
21932193
idIndex;
@@ -2217,7 +2217,8 @@ sa.setWebViewUrl = function(url, after_hash) {
22172217
var hasQuery = /^\?(\w)+/.test(search);
22182218
if (hasQuery) {
22192219
if (idIndex > -1) {
2220-
nurl = host + '?' + search.substring(1, idIndex) + '_sasdk=' + value + hash;
2220+
var newSearch = search.replace(/(_sasdk=)([^&]*)/gi, '_sasdk=' + value);
2221+
nurl = host + newSearch + hash;
22212222
} else {
22222223
nurl = host + '?' + search.substring(1) + '&_sasdk=' + value + hash;
22232224
}

product/sensorsdata.es6.full.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ sa.para = {
77
server_url: '',
88
send_timeout: 1000,
99
show_log: false,
10-
launched: false,
1110
allow_amend_share_path: true,
1211
max_string_length: 500,
1312
datasend_timeout: 3000,
@@ -43,6 +42,10 @@ sa.para = {
4342
storage_prepare_data_key: 'sensors_mp_prepare_data'
4443
};
4544

45+
var deploy_para = {
46+
launched: false
47+
};
48+
4649
var mpHook = {
4750
data: 1,
4851
onLoad: 1,
@@ -159,7 +162,7 @@ var ArrayProto = Array.prototype,
159162
slice = ArrayProto.slice,
160163
toString = ObjProto.toString,
161164
hasOwnProperty = ObjProto.hasOwnProperty,
162-
LIB_VERSION = '1.14.22',
165+
LIB_VERSION = '1.14.23',
163166
LIB_NAME = 'MiniProgram';
164167

165168
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -700,7 +703,7 @@ _.getCurrentPath = function() {
700703
var url = '未取到';
701704
try {
702705
var currentPage = _.getCurrentPage();
703-
url = currentPage.route;
706+
url = currentPage ? currentPage.route : url;
704707
} catch (e) {
705708
logger.info(e);
706709
}
@@ -1857,7 +1860,7 @@ sa.getLocation = function() {
18571860
});
18581861
},
18591862
fail: function(err) {
1860-
console.log('获取位置失败', err);
1863+
logger.info('获取位置失败', err);
18611864
}
18621865
});
18631866
} else {
@@ -2186,6 +2189,7 @@ sa.setWebViewUrl = function(url, after_hash) {
21862189
search = arr[2] || '',
21872190
hash = arr[3] || '',
21882191
nurl = '';
2192+
21892193
var distinct_id = sa.store.getDistinctId() || '',
21902194
first_id = sa.store.getFirstId() || '',
21912195
idIndex;
@@ -2215,7 +2219,8 @@ sa.setWebViewUrl = function(url, after_hash) {
22152219
var hasQuery = /^\?(\w)+/.test(search);
22162220
if (hasQuery) {
22172221
if (idIndex > -1) {
2218-
nurl = host + '?' + search.substring(1, idIndex) + '_sasdk=' + value + hash;
2222+
var newSearch = search.replace(/(_sasdk=)([^&]*)/gi, '_sasdk=' + value);
2223+
nurl = host + newSearch + hash;
22192224
} else {
22202225
nurl = host + '?' + search.substring(1) + '&_sasdk=' + value + hash;
22212226
}
@@ -2830,10 +2835,10 @@ sa.pageShow = function(prop) {
28302835
};
28312836

28322837
wx.onAppShow(function(para) {
2833-
if (!sa.para.launched) {
2838+
if (!deploy_para.launched) {
28342839
var option = wx.getLaunchOptionsSync() || {};
28352840
sa.autoTrackCustom.appLaunch(option);
2836-
sa.para.launched = true;
2841+
deploy_para.launched = true;
28372842
}
28382843
sa.autoTrackCustom.appShow(para);
28392844
});

product/sensorsdata.full.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ sa.para = {
99
server_url: '',
1010
send_timeout: 1000,
1111
show_log: false,
12-
launched: false,
1312
allow_amend_share_path: true,
1413
max_string_length: 500,
1514
datasend_timeout: 3000,
@@ -45,6 +44,10 @@ sa.para = {
4544
storage_prepare_data_key: 'sensors_mp_prepare_data'
4645
};
4746

47+
var deploy_para = {
48+
launched: false
49+
};
50+
4851
var mpHook = {
4952
data: 1,
5053
onLoad: 1,
@@ -161,7 +164,7 @@ var ArrayProto = Array.prototype,
161164
slice = ArrayProto.slice,
162165
toString = ObjProto.toString,
163166
hasOwnProperty = ObjProto.hasOwnProperty,
164-
LIB_VERSION = '1.14.22',
167+
LIB_VERSION = '1.14.23',
165168
LIB_NAME = 'MiniProgram';
166169

167170
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -702,7 +705,7 @@ _.getCurrentPath = function() {
702705
var url = '未取到';
703706
try {
704707
var currentPage = _.getCurrentPage();
705-
url = currentPage.route;
708+
url = currentPage ? currentPage.route : url;
706709
} catch (e) {
707710
logger.info(e);
708711
}
@@ -1859,7 +1862,7 @@ sa.getLocation = function() {
18591862
});
18601863
},
18611864
fail: function(err) {
1862-
console.log('获取位置失败', err);
1865+
logger.info('获取位置失败', err);
18631866
}
18641867
});
18651868
} else {
@@ -2188,6 +2191,7 @@ sa.setWebViewUrl = function(url, after_hash) {
21882191
search = arr[2] || '',
21892192
hash = arr[3] || '',
21902193
nurl = '';
2194+
21912195
var distinct_id = sa.store.getDistinctId() || '',
21922196
first_id = sa.store.getFirstId() || '',
21932197
idIndex;
@@ -2217,7 +2221,8 @@ sa.setWebViewUrl = function(url, after_hash) {
22172221
var hasQuery = /^\?(\w)+/.test(search);
22182222
if (hasQuery) {
22192223
if (idIndex > -1) {
2220-
nurl = host + '?' + search.substring(1, idIndex) + '_sasdk=' + value + hash;
2224+
var newSearch = search.replace(/(_sasdk=)([^&]*)/gi, '_sasdk=' + value);
2225+
nurl = host + newSearch + hash;
22212226
} else {
22222227
nurl = host + '?' + search.substring(1) + '&_sasdk=' + value + hash;
22232228
}
@@ -2832,10 +2837,10 @@ sa.pageShow = function(prop) {
28322837
};
28332838

28342839
wx.onAppShow(function(para) {
2835-
if (!sa.para.launched) {
2840+
if (!deploy_para.launched) {
28362841
var option = wx.getLaunchOptionsSync() || {};
28372842
sa.autoTrackCustom.appLaunch(option);
2838-
sa.para.launched = true;
2843+
deploy_para.launched = true;
28392844
}
28402845
sa.autoTrackCustom.appShow(para);
28412846
});

product/sensorsdata.plugin.es6.full.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ sa.para = {
77
server_url: '',
88
send_timeout: 1000,
99
show_log: false,
10-
launched: false,
1110
allow_amend_share_path: true,
1211
max_string_length: 500,
1312
datasend_timeout: 3000,
@@ -43,6 +42,10 @@ sa.para = {
4342
storage_prepare_data_key: 'sensors_mp_prepare_data'
4443
};
4544

45+
var deploy_para = {
46+
launched: false
47+
};
48+
4649
var mpHook = {
4750
data: 1,
4851
onLoad: 1,
@@ -159,7 +162,7 @@ var ArrayProto = Array.prototype,
159162
slice = ArrayProto.slice,
160163
toString = ObjProto.toString,
161164
hasOwnProperty = ObjProto.hasOwnProperty,
162-
LIB_VERSION = '1.14.22',
165+
LIB_VERSION = '1.14.23',
163166
LIB_NAME = 'MiniProgram';
164167

165168
var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
@@ -700,7 +703,7 @@ _.getCurrentPath = function() {
700703
var url = '未取到';
701704
try {
702705
var currentPage = _.getCurrentPage();
703-
url = currentPage.route;
706+
url = currentPage ? currentPage.route : url;
704707
} catch (e) {
705708
logger.info(e);
706709
}
@@ -1857,7 +1860,7 @@ sa.getLocation = function() {
18571860
});
18581861
},
18591862
fail: function(err) {
1860-
console.log('获取位置失败', err);
1863+
logger.info('获取位置失败', err);
18611864
}
18621865
});
18631866
} else {
@@ -2186,6 +2189,7 @@ sa.setWebViewUrl = function(url, after_hash) {
21862189
search = arr[2] || '',
21872190
hash = arr[3] || '',
21882191
nurl = '';
2192+
21892193
var distinct_id = sa.store.getDistinctId() || '',
21902194
first_id = sa.store.getFirstId() || '',
21912195
idIndex;
@@ -2215,7 +2219,8 @@ sa.setWebViewUrl = function(url, after_hash) {
22152219
var hasQuery = /^\?(\w)+/.test(search);
22162220
if (hasQuery) {
22172221
if (idIndex > -1) {
2218-
nurl = host + '?' + search.substring(1, idIndex) + '_sasdk=' + value + hash;
2222+
var newSearch = search.replace(/(_sasdk=)([^&]*)/gi, '_sasdk=' + value);
2223+
nurl = host + newSearch + hash;
22192224
} else {
22202225
nurl = host + '?' + search.substring(1) + '&_sasdk=' + value + hash;
22212226
}
@@ -2830,10 +2835,10 @@ sa.pageShow = function(prop) {
28302835
};
28312836

28322837
wx.onAppShow(function(para) {
2833-
if (!sa.para.launched) {
2838+
if (!deploy_para.launched) {
28342839
var option = wx.getLaunchOptionsSync() || {};
28352840
sa.autoTrackCustom.appLaunch(option);
2836-
sa.para.launched = true;
2841+
deploy_para.launched = true;
28372842
}
28382843
sa.autoTrackCustom.appShow(para);
28392844
});

0 commit comments

Comments
 (0)