Skip to content

Commit

Permalink
Release 1.14.24
Browse files Browse the repository at this point in the history
  • Loading branch information
shengyonggen committed Oct 11, 2021
1 parent 8ba6b57 commit 78bb7e1
Show file tree
Hide file tree
Showing 15 changed files with 385 additions and 188 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.14.24(2021-10-11)
1. 修复
- 修复 `sendPageLeave` 方法可能导致的报错问题
- 修复 `Fortify` 扫描的安全漏洞问题

## 1.14.23(2021-09-28)
1. 修复
- 修复 `setWebviewUrl` 方法可能会导致客户 `url` 中参数丢失的问题
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

## License

Copyright 2015-2020 Sensors Data Inc.
Copyright 2015-2021 Sensors Data Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
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.23",
"version": "1.14.24",
"description": "sensorsdata miniprogram sdk",
"main": "sensorsdata.min.js",
"scripts": {
Expand Down
92 changes: 62 additions & 30 deletions product/sensorsdata.custom.es6.full.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
function isObject(obj) {
if (obj === undefined || obj === null) {
return false;
} else {
return toString.call(obj) == '[object Object]';
}
}

var getRandomBasic = (function() {
var today = new Date();
var seed = today.getTime();

function rnd() {
seed = (seed * 9301 + 49297) % 233280;
return seed / 233280.0;
}
return function rand(number) {
return Math.ceil(rnd() * number);
};
})();

function getRandom() {
if (typeof Uint32Array === 'function') {
var cry = '';
if (typeof crypto !== 'undefined') {
cry = crypto;
} else if (typeof msCrypto !== 'undefined') {
cry = msCrypto;
}
if (isObject(cry) && cry.getRandomValues) {
var typedArray = new Uint32Array(1);
var randomNumber = cry.getRandomValues(typedArray)[0];
var integerLimit = Math.pow(2, 32);
return randomNumber / integerLimit;
}
}
return getRandomBasic(10000000000000000000) / 10000000000000000000;
}

var _ = {};

var sa = {};
Expand Down Expand Up @@ -156,9 +195,9 @@ sa.status = {};
var ArrayProto = Array.prototype,
ObjProto = Object.prototype,
slice = ArrayProto.slice,
toString = ObjProto.toString,
toString$1 = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = '1.14.23',
LIB_VERSION = '1.14.24',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down Expand Up @@ -249,7 +288,7 @@ var page_route_map = [];
_.isArray =
nativeIsArray ||
function(obj) {
return toString.call(obj) === '[object Array]';
return toString$1.call(obj) === '[object Array]';
};

_.isFunction = function(f) {
Expand Down Expand Up @@ -316,7 +355,7 @@ _.isObject = function(obj) {
if (obj === undefined || obj === null) {
return false;
} else {
return toString.call(obj) == '[object Object]';
return toString$1.call(obj) == '[object Object]';
}
};

Expand All @@ -337,19 +376,19 @@ _.isUndefined = function(obj) {
};

_.isString = function(obj) {
return toString.call(obj) == '[object String]';
return toString$1.call(obj) == '[object String]';
};

_.isDate = function(obj) {
return toString.call(obj) == '[object Date]';
return toString$1.call(obj) == '[object Date]';
};

_.isBoolean = function(obj) {
return toString.call(obj) == '[object Boolean]';
return toString$1.call(obj) == '[object Boolean]';
};

_.isNumber = function(obj) {
return toString.call(obj) == '[object Number]' && /[\d\.]+/.test(String(obj));
return toString$1.call(obj) == '[object Number]' && /[\d\.]+/.test(String(obj));
};

_.isJSONString = function(str) {
Expand Down Expand Up @@ -1085,11 +1124,12 @@ _.setSfSource = function(para, prop) {

_.setPageSfSource = function(prop) {
try {
var allpages = getCurrentPages();
var myvar = JSON.parse(JSON.stringify(allpages[allpages.length - 1].options));
var allpages = _.getCurrentPage();
var options = allpages ? allpages.options : '';
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 @@ -1104,8 +1144,7 @@ try {
Object.defineProperty(wx, 'setNavigationBarTitle', {
get: function() {
return function(titleObj) {
var pages = getCurrentPages();
var currentPagePath = pages[pages.length - 1].route || '';
var currentPagePath = _.getCurrentPath();
titleObj = _.isObject(titleObj) ? titleObj : {};
globalTitle[currentPagePath] = titleObj.title;
oldSetNavigationBarTitle.call(this, titleObj);
Expand Down Expand Up @@ -1442,7 +1481,7 @@ sa.prepareData = function(p, callback) {
}

if (!p.type || p.type.slice(0, 7) !== 'profile') {
data._track_id = Number(String(Math.random()).slice(2, 5) + String(Math.random()).slice(2, 4) + String(Date.now()).slice(-4));
data._track_id = Number(String(getRandom()).slice(2, 5) + String(getRandom()).slice(2, 4) + String(Date.now()).slice(-4));
data.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, data.properties);
if (p.type === 'track') {
data.properties.$is_first_day = _.getIsFirstDay();
Expand Down Expand Up @@ -1482,11 +1521,11 @@ sa.store = {
'' +
Date.now() +
'-' +
Math.floor(1e7 * Math.random()) +
Math.floor(1e7 * getRandom()) +
'-' +
Math.random().toString(16).replace('.', '') +
getRandom().toString(16).replace('.', '') +
'-' +
String(Math.random() * 31242)
String(getRandom() * 31242)
.replace('.', '')
.slice(0, 8)
);
Expand Down Expand Up @@ -2261,9 +2300,8 @@ _.setQuery = function(params, isEncode) {
_.getUtmFromPage = function() {
var newObj = {};
try {
var allpages = getCurrentPages();
var myvar = JSON.parse(JSON.stringify(allpages[allpages.length - 1].options));

var allpages = _.getCurrentPage();
var myvar = JSON.parse(JSON.stringify(allpages.options));
for (var i in myvar) {
myvar[i] = _.decodeURIComponent(myvar[i]);
}
Expand All @@ -2277,13 +2315,13 @@ _.getUtmFromPage = function() {

_.sendPageLeave = function() {
var currentPage = {};
var router = '';
try {
var pages = getCurrentPages();
currentPage = pages[pages.length - 1];
currentPage = _.getCurrentPage();
router = currentPage ? currentPage.route : '';
} catch (error) {
logger.info(error);
}
var router = currentPage.route;
if (page_show_time >= 0 && router !== '') {
var prop = {};
var title = _.getPageTitle(router);
Expand Down Expand Up @@ -2683,13 +2721,7 @@ sa.pageShow = function(prop) {
var obj = {};
var router = _.getCurrentPath();
var title = _.getPageTitle(router);
var currentPage = {};
try {
var pages = getCurrentPages();
currentPage = pages[pages.length - 1];
} catch (error) {
logger.info(error);
}
var currentPage = _.getCurrentPage();
if (sa.para.preset_properties.url_path === true) {
sa.registerApp({
$url_path: router
Expand Down
Loading

0 comments on commit 78bb7e1

Please sign in to comment.