Skip to content

Commit

Permalink
Release 1.14.26
Browse files Browse the repository at this point in the history
  • Loading branch information
shengyonggen committed Nov 11, 2021
1 parent 7790966 commit 2ace157
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 283 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.14.26(2021-11-11)
1. 修复
- 修复返回操作触发页面浏览事件时 `$referrer` 值不准确的问题
- 修复不设置页面标题会出现错误日志的问题
- 修复属性值传空数组会被删除不上报的问题

## 1.14.25(2021-10-28)
1. 修复
- 修复 `setWebviewUrl` 方法可能会导致客户参数无法解析的问题
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sa-sdk-miniprogram",
"version": "1.14.25",
"version": "1.14.26",
"description": "sensorsdata miniprogram sdk",
"main": "sensorsdata.min.js",
"scripts": {
Expand Down
80 changes: 34 additions & 46 deletions product/sensorsdata.custom.es6.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ var mpHook = {
onShow: 1,
onReady: 1,
onPullDownRefresh: 1,
onReachBottom: 1,
onShareAppMessage: 1,
onShareTimeline: 1,
onPullDownRefresh: 1,
onReachBottom: 1,
onPageScroll: 1,
onResize: 1,
Expand Down Expand Up @@ -197,7 +195,7 @@ var ArrayProto = Array.prototype,
slice = ArrayProto.slice,
toString$1 = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = '1.14.25',
LIB_VERSION = '1.14.26',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down Expand Up @@ -512,12 +510,7 @@ _.strip_sa_properties = function(p) {
logger.info('您的数据-', v, '的数组里的值必须是字符串,已经将其删除');
}
});
if (temp.length !== 0) {
p[k] = temp;
} else {
delete p[k];
logger.info('已经删除空的数组');
}
p[k] = temp;
}
if (!(_.isString(v) || _.isNumber(v) || _.isDate(v) || _.isBoolean(v) || _.isArray(v))) {
logger.info('您的数据-', v, '-格式不满足要求,我们已经将其删除');
Expand Down Expand Up @@ -1129,7 +1122,7 @@ _.setPageSfSource = function(prop) {
var myvar = JSON.parse(JSON.stringify(options));
for (var i in myvar) {
myvar[i] = _.decodeURIComponent(myvar[i]);
};
}

if (!_.isEmptyObject(myvar) && myvar._sfs) {
prop.$sf_source = myvar._sfs;
Expand All @@ -1156,25 +1149,33 @@ try {
}

_.setRefPage = function() {

var _refInfo = {
route: "直接打开",
title: "",
};
try {
var pages = getCurrentPages();
if (pages && pages.length === 1) {
var current_path = pages[pages.length - 1].route;
var pages = _.getCurrentPage();
if (pages && pages.route) {
var current_path = pages.route;
var current_title = _.getPageTitle(current_path);
var currentPageInfo = {
title: current_title,
route: current_path
};
_refInfo.route = current_path;
_refInfo.title = current_title;

var len = page_route_map.length,
path = "";

if (page_route_map.length >= 2) {
if (page_route_map[page_route_map.length - 1].route !== currentPageInfo.route) {
page_route_map.push(currentPageInfo);
if (len >= 1) {
path = page_route_map[len - 1].route;
}

if (path !== current_path) {
if (len >= 2) {
page_route_map.shift();
page_route_map.push(_refInfo);
} else {
page_route_map.push(_refInfo);
}
} else {
page_route_map.push(currentPageInfo);
}
};
}
} catch (error) {
logger.info(error);
Expand All @@ -1187,27 +1188,9 @@ _.getRefPage = function() {
title: ''
};

try {
var pages = getCurrentPages();
if (pages && pages.length >= 2) {
_refInfo.route = pages[pages.length - 2].route;
_refInfo.title = _.getPageTitle(_refInfo.route);
} else if (pages && pages.length >= 1) {
if (page_route_map.length >= 2) {
var refPages = page_route_map;
_refInfo.route = refPages[refPages.length - 2].route;
_refInfo.title = _.getPageTitle(_refInfo.route);
}

if (_refInfo.route === pages[pages.length - 1].route) {
_refInfo = {
title: '',
route: '直接打开'
};
}
}
} catch (error) {
logger.info(error);
if (page_route_map.length > 1) {
_refInfo.title = page_route_map[0].title;
_refInfo.route = page_route_map[0].route;
}
return _refInfo;
};
Expand Down Expand Up @@ -1253,7 +1236,7 @@ _.getPageTitle = function(route) {
});
if (title.length === 0) {
var finalTitle = _.extend(globalConfigTitle, pageConfigTitle);
title = finalTitle.titleVal;
title = finalTitle.titleVal || '';
}
}
} catch (err) {
Expand Down Expand Up @@ -1488,6 +1471,7 @@ sa.prepareData = function(p, callback) {
}

var refPage = _.getRefPage();

if (!data.properties.hasOwnProperty('$referrer')) {
data.properties.$referrer = refPage.route;
}
Expand Down Expand Up @@ -2215,16 +2199,19 @@ sa.setWebViewUrl = function(url, after_hash) {
logger.info('error:请传入正确的 URL 格式');
return false;
}

if (!/^http(s)?:\/\//.test(url)) {
logger.info('warning: 请传入正确的 URL 格式');
return false;
}

var reg = /([^?#]+)(\?[^#]*)?(#.*)?/,
arr = reg.exec(url);

if (!arr) {
return false;
}

var host = arr[1] || '',
search = arr[2] || '',
hash = arr[3] || '',
Expand Down Expand Up @@ -2727,6 +2714,7 @@ sa.pageShow = function(prop) {
var router = _.getCurrentPath();
var title = _.getPageTitle(router);
var currentPage = _.getCurrentPage();
_.setRefPage();
if (sa.para.preset_properties.url_path === true) {
sa.registerApp({
$url_path: router
Expand Down
80 changes: 34 additions & 46 deletions product/sensorsdata.custom.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ var mpHook = {
onShow: 1,
onReady: 1,
onPullDownRefresh: 1,
onReachBottom: 1,
onShareAppMessage: 1,
onShareTimeline: 1,
onPullDownRefresh: 1,
onReachBottom: 1,
onPageScroll: 1,
onResize: 1,
Expand Down Expand Up @@ -199,7 +197,7 @@ var ArrayProto = Array.prototype,
slice = ArrayProto.slice,
toString$1 = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = '1.14.25',
LIB_VERSION = '1.14.26',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down Expand Up @@ -514,12 +512,7 @@ _.strip_sa_properties = function(p) {
logger.info('您的数据-', v, '的数组里的值必须是字符串,已经将其删除');
}
});
if (temp.length !== 0) {
p[k] = temp;
} else {
delete p[k];
logger.info('已经删除空的数组');
}
p[k] = temp;
}
if (!(_.isString(v) || _.isNumber(v) || _.isDate(v) || _.isBoolean(v) || _.isArray(v))) {
logger.info('您的数据-', v, '-格式不满足要求,我们已经将其删除');
Expand Down Expand Up @@ -1131,7 +1124,7 @@ _.setPageSfSource = function(prop) {
var myvar = JSON.parse(JSON.stringify(options));
for (var i in myvar) {
myvar[i] = _.decodeURIComponent(myvar[i]);
};
}

if (!_.isEmptyObject(myvar) && myvar._sfs) {
prop.$sf_source = myvar._sfs;
Expand All @@ -1158,25 +1151,33 @@ try {
}

_.setRefPage = function() {

var _refInfo = {
route: "直接打开",
title: "",
};
try {
var pages = getCurrentPages();
if (pages && pages.length === 1) {
var current_path = pages[pages.length - 1].route;
var pages = _.getCurrentPage();
if (pages && pages.route) {
var current_path = pages.route;
var current_title = _.getPageTitle(current_path);
var currentPageInfo = {
title: current_title,
route: current_path
};
_refInfo.route = current_path;
_refInfo.title = current_title;

var len = page_route_map.length,
path = "";

if (page_route_map.length >= 2) {
if (page_route_map[page_route_map.length - 1].route !== currentPageInfo.route) {
page_route_map.push(currentPageInfo);
if (len >= 1) {
path = page_route_map[len - 1].route;
}

if (path !== current_path) {
if (len >= 2) {
page_route_map.shift();
page_route_map.push(_refInfo);
} else {
page_route_map.push(_refInfo);
}
} else {
page_route_map.push(currentPageInfo);
}
};
}
} catch (error) {
logger.info(error);
Expand All @@ -1189,27 +1190,9 @@ _.getRefPage = function() {
title: ''
};

try {
var pages = getCurrentPages();
if (pages && pages.length >= 2) {
_refInfo.route = pages[pages.length - 2].route;
_refInfo.title = _.getPageTitle(_refInfo.route);
} else if (pages && pages.length >= 1) {
if (page_route_map.length >= 2) {
var refPages = page_route_map;
_refInfo.route = refPages[refPages.length - 2].route;
_refInfo.title = _.getPageTitle(_refInfo.route);
}

if (_refInfo.route === pages[pages.length - 1].route) {
_refInfo = {
title: '',
route: '直接打开'
};
}
}
} catch (error) {
logger.info(error);
if (page_route_map.length > 1) {
_refInfo.title = page_route_map[0].title;
_refInfo.route = page_route_map[0].route;
}
return _refInfo;
};
Expand Down Expand Up @@ -1255,7 +1238,7 @@ _.getPageTitle = function(route) {
});
if (title.length === 0) {
var finalTitle = _.extend(globalConfigTitle, pageConfigTitle);
title = finalTitle.titleVal;
title = finalTitle.titleVal || '';
}
}
} catch (err) {
Expand Down Expand Up @@ -1490,6 +1473,7 @@ sa.prepareData = function(p, callback) {
}

var refPage = _.getRefPage();

if (!data.properties.hasOwnProperty('$referrer')) {
data.properties.$referrer = refPage.route;
}
Expand Down Expand Up @@ -2217,16 +2201,19 @@ sa.setWebViewUrl = function(url, after_hash) {
logger.info('error:请传入正确的 URL 格式');
return false;
}

if (!/^http(s)?:\/\//.test(url)) {
logger.info('warning: 请传入正确的 URL 格式');
return false;
}

var reg = /([^?#]+)(\?[^#]*)?(#.*)?/,
arr = reg.exec(url);

if (!arr) {
return false;
}

var host = arr[1] || '',
search = arr[2] || '',
hash = arr[3] || '',
Expand Down Expand Up @@ -2729,6 +2716,7 @@ sa.pageShow = function(prop) {
var router = _.getCurrentPath();
var title = _.getPageTitle(router);
var currentPage = _.getCurrentPage();
_.setRefPage();
if (sa.para.preset_properties.url_path === true) {
sa.registerApp({
$url_path: router
Expand Down
Loading

0 comments on commit 2ace157

Please sign in to comment.