Skip to content

Commit

Permalink
Release 1.17.3
Browse files Browse the repository at this point in the history
  • Loading branch information
shengyonggen committed Mar 7, 2022
1 parent b2d3d66 commit c541426
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 55 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.17.3(2022-1-13)
1. 新增
- 支持自定义属性配置插件


## 1.17.2(2022-1-13)
1. 修复
- 页面浏览时长出现负值的问题
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.17.2",
"version": "1.17.3",
"description": "sensorsdata miniprogram sdk",
"main": "sensorsdata.min.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions plugins/register-properties/register-properties.cmd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/register-properties/register-properties.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 19 additions & 8 deletions product/sensorsdata.custom.es6.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ var isArray =
};

function isFunction(f) {
try {
return /^\s*\bfunction\b/.test(f);
} catch (x) {
if (!f) {
return false;
}
var type = Object.prototype.toString.call(f);
return type == '[object Function]' || type == '[object AsyncFunction]';
}

function isArguments(obj) {
Expand Down Expand Up @@ -280,8 +280,7 @@ var _ = {

var kit = {};

kit.buildData = function(p) {
var _ = sa._;
kit.buildData = function(p, custom_monitor_prop) {
var data = {
distinct_id: sa.store.getDistinctId(),
identities: sa.store._state.identities,
Expand All @@ -298,6 +297,10 @@ kit.buildData = function(p) {
delete p.unbind_value;
}

if (!_.isObject(custom_monitor_prop)) {
custom_monitor_prop = {};
}

_.extend(data, sa.store.getUnionId(), p);

if (_.isObject(p.properties) && !_.isEmptyObject(p.properties)) {
Expand All @@ -306,7 +309,7 @@ kit.buildData = function(p) {

if (!p.type || p.type.slice(0, 7) !== 'profile') {
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);
data.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, custom_monitor_prop, data.properties);
if (p.type === 'track') {
data.properties.$is_first_day = _.getIsFirstDay();
}
Expand Down Expand Up @@ -371,6 +374,11 @@ function setPublicPProperties(data) {
}
}

kit.onEventSend = function() {
var custom_monitor_prop = {};
return custom_monitor_prop;
};


var mergeStorageData = {};

Expand Down Expand Up @@ -551,7 +559,10 @@ saEvent.send = function(p, callback) {
return false;
}

var data = sa.kit.buildData(p);
var event_target = sa._.deepCopy(p);
var custom_monitor_prop = sa.kit.onEventSend(event_target);

var data = sa.kit.buildData(p, custom_monitor_prop);
if (data) {
saEvent.debug(data);
sa.events.emit('send', data);
Expand Down Expand Up @@ -818,7 +829,7 @@ sa.getServerUrl = function() {
return sa.para.server_url;
};

var LIB_VERSION = '1.17.2',
var LIB_VERSION = '1.17.3',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down
27 changes: 19 additions & 8 deletions product/sensorsdata.custom.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ var isArray =
};

function isFunction(f) {
try {
return /^\s*\bfunction\b/.test(f);
} catch (x) {
if (!f) {
return false;
}
var type = Object.prototype.toString.call(f);
return type == '[object Function]' || type == '[object AsyncFunction]';
}

function isArguments(obj) {
Expand Down Expand Up @@ -283,8 +283,7 @@ var _ = {

var kit = {};

kit.buildData = function(p) {
var _ = sa._;
kit.buildData = function(p, custom_monitor_prop) {
var data = {
distinct_id: sa.store.getDistinctId(),
identities: sa.store._state.identities,
Expand All @@ -301,6 +300,10 @@ kit.buildData = function(p) {
delete p.unbind_value;
}

if (!_.isObject(custom_monitor_prop)) {
custom_monitor_prop = {};
}

_.extend(data, sa.store.getUnionId(), p);

if (_.isObject(p.properties) && !_.isEmptyObject(p.properties)) {
Expand All @@ -309,7 +312,7 @@ kit.buildData = function(p) {

if (!p.type || p.type.slice(0, 7) !== 'profile') {
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);
data.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, custom_monitor_prop, data.properties);
if (p.type === 'track') {
data.properties.$is_first_day = _.getIsFirstDay();
}
Expand Down Expand Up @@ -374,6 +377,11 @@ function setPublicPProperties(data) {
}
}

kit.onEventSend = function() {
var custom_monitor_prop = {};
return custom_monitor_prop;
};


var mergeStorageData = {};

Expand Down Expand Up @@ -554,7 +562,10 @@ saEvent.send = function(p, callback) {
return false;
}

var data = sa.kit.buildData(p);
var event_target = sa._.deepCopy(p);
var custom_monitor_prop = sa.kit.onEventSend(event_target);

var data = sa.kit.buildData(p, custom_monitor_prop);
if (data) {
saEvent.debug(data);
sa.events.emit('send', data);
Expand Down Expand Up @@ -821,7 +832,7 @@ sa.getServerUrl = function() {
return sa.para.server_url;
};

var LIB_VERSION = '1.17.2',
var LIB_VERSION = '1.17.3',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down
27 changes: 19 additions & 8 deletions product/sensorsdata.es6.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ var isArray =
};

function isFunction(f) {
try {
return /^\s*\bfunction\b/.test(f);
} catch (x) {
if (!f) {
return false;
}
var type = Object.prototype.toString.call(f);
return type == '[object Function]' || type == '[object AsyncFunction]';
}

function isArguments(obj) {
Expand Down Expand Up @@ -280,8 +280,7 @@ var _ = {

var kit = {};

kit.buildData = function(p) {
var _ = sa._;
kit.buildData = function(p, custom_monitor_prop) {
var data = {
distinct_id: sa.store.getDistinctId(),
identities: sa.store._state.identities,
Expand All @@ -298,6 +297,10 @@ kit.buildData = function(p) {
delete p.unbind_value;
}

if (!_.isObject(custom_monitor_prop)) {
custom_monitor_prop = {};
}

_.extend(data, sa.store.getUnionId(), p);

if (_.isObject(p.properties) && !_.isEmptyObject(p.properties)) {
Expand All @@ -306,7 +309,7 @@ kit.buildData = function(p) {

if (!p.type || p.type.slice(0, 7) !== 'profile') {
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);
data.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, custom_monitor_prop, data.properties);
if (p.type === 'track') {
data.properties.$is_first_day = _.getIsFirstDay();
}
Expand Down Expand Up @@ -371,6 +374,11 @@ function setPublicPProperties(data) {
}
}

kit.onEventSend = function() {
var custom_monitor_prop = {};
return custom_monitor_prop;
};


var mergeStorageData = {};

Expand Down Expand Up @@ -551,7 +559,10 @@ saEvent.send = function(p, callback) {
return false;
}

var data = sa.kit.buildData(p);
var event_target = sa._.deepCopy(p);
var custom_monitor_prop = sa.kit.onEventSend(event_target);

var data = sa.kit.buildData(p, custom_monitor_prop);
if (data) {
saEvent.debug(data);
sa.events.emit('send', data);
Expand Down Expand Up @@ -1030,7 +1041,7 @@ sa.getServerUrl = function() {
return sa.para.server_url;
};

var LIB_VERSION = '1.17.2',
var LIB_VERSION = '1.17.3',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down
27 changes: 19 additions & 8 deletions product/sensorsdata.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ var isArray =
};

function isFunction(f) {
try {
return /^\s*\bfunction\b/.test(f);
} catch (x) {
if (!f) {
return false;
}
var type = Object.prototype.toString.call(f);
return type == '[object Function]' || type == '[object AsyncFunction]';
}

function isArguments(obj) {
Expand Down Expand Up @@ -283,8 +283,7 @@ var _ = {

var kit = {};

kit.buildData = function(p) {
var _ = sa._;
kit.buildData = function(p, custom_monitor_prop) {
var data = {
distinct_id: sa.store.getDistinctId(),
identities: sa.store._state.identities,
Expand All @@ -301,6 +300,10 @@ kit.buildData = function(p) {
delete p.unbind_value;
}

if (!_.isObject(custom_monitor_prop)) {
custom_monitor_prop = {};
}

_.extend(data, sa.store.getUnionId(), p);

if (_.isObject(p.properties) && !_.isEmptyObject(p.properties)) {
Expand All @@ -309,7 +312,7 @@ kit.buildData = function(p) {

if (!p.type || p.type.slice(0, 7) !== 'profile') {
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);
data.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, custom_monitor_prop, data.properties);
if (p.type === 'track') {
data.properties.$is_first_day = _.getIsFirstDay();
}
Expand Down Expand Up @@ -374,6 +377,11 @@ function setPublicPProperties(data) {
}
}

kit.onEventSend = function() {
var custom_monitor_prop = {};
return custom_monitor_prop;
};


var mergeStorageData = {};

Expand Down Expand Up @@ -554,7 +562,10 @@ saEvent.send = function(p, callback) {
return false;
}

var data = sa.kit.buildData(p);
var event_target = sa._.deepCopy(p);
var custom_monitor_prop = sa.kit.onEventSend(event_target);

var data = sa.kit.buildData(p, custom_monitor_prop);
if (data) {
saEvent.debug(data);
sa.events.emit('send', data);
Expand Down Expand Up @@ -1033,7 +1044,7 @@ sa.getServerUrl = function() {
return sa.para.server_url;
};

var LIB_VERSION = '1.17.2',
var LIB_VERSION = '1.17.3',
LIB_NAME = 'MiniProgram';

var source_channel_standard = 'utm_source utm_medium utm_campaign utm_content utm_term';
Expand Down
Loading

0 comments on commit c541426

Please sign in to comment.