New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tuhu/mp-sensor

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tuhu/mp-sensor - npm Package Compare versions

Comparing version 0.0.7 to 0.1.0

8

./@types/index.d.ts

@@ -27,2 +27,3 @@ interface KVObject {

pageShare?: boolean;
mpClick?: boolean;
};

@@ -108,2 +109,7 @@ /**

*/
export default function(config: any, JPage: any, JApp: any, jgb?: any): ISensor;
export default function (
config: any,
JPage: any,
JApp: any,
jgb?: any
): ISensor;

@@ -1,1 +0,1038 @@

(function () {var C;function f(r){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var a=wx,A=function(r){"object"===f(r)&&(a=r)};var b={},c={para:{name:"sensors",server_url:"https://analytics.tuhu.com/sa?project=production",send_timeout:1e3,use_client_time:!1,show_log:!0,allow_amend_share_path:!0,max_string_length:300,datasend_timeout:3e3,autoTrack:{appLaunch:!0,appShow:!0,appHide:!0,pageShow:!0,pageShare:!0}},setPara:function(r){c.para=b.extend2Lev(c.para,r),b.isObject(c.para.register)&&b.extend(b.info.properties,c.para.register),c.para.openid_url||(c.para.openid_url=c.para.server_url.replace(/([^\/])\/(sa)(\.gif){0,1}/,"$1/mp_login")),"number"!=typeof c.para.send_timeout&&(c.para.send_timeout=1e3);var $={send_timeout:6e3,max_length:6};!0===c.para.batch_send?(c.para.batch_send=b.extend({},$),c.para.use_client_time=!0):"object"==f(c.para.batch_send)&&(c.para.use_client_time=!0,c.para.batch_send=b.extend({},$,c.para.batch_send))},status:{}},o=Array.prototype,z=Function.prototype,r=Object.prototype,g=o.slice,h=r.toString,p=r.hasOwnProperty,m="1.13.2",t="MiniProgram",k="utm_source utm_medium utm_campaign utm_content utm_term",x={1001:"\u53D1\u73B0\u680F\u5C0F\u7A0B\u5E8F\u4E3B\u5165\u53E3\uFF0C\u201C\u6700\u8FD1\u4F7F\u7528\u201D\u5217\u8868",1005:"\u9876\u90E8\u641C\u7D22\u6846\u7684\u641C\u7D22\u7ED3\u679C\u9875",1006:"\u53D1\u73B0\u680F\u5C0F\u7A0B\u5E8F\u4E3B\u5165\u53E3\u641C\u7D22\u6846\u7684\u641C\u7D22\u7ED3\u679C\u9875",1007:"\u5355\u4EBA\u804A\u5929\u4F1A\u8BDD\u4E2D\u7684\u5C0F\u7A0B\u5E8F\u6D88\u606F\u5361\u7247",1008:"\u7FA4\u804A\u4F1A\u8BDD\u4E2D\u7684\u5C0F\u7A0B\u5E8F\u6D88\u606F\u5361\u7247",1011:"\u626B\u63CF\u4E8C\u7EF4\u7801",1012:"\u957F\u6309\u56FE\u7247\u8BC6\u522B\u4E8C\u7EF4\u7801",1013:"\u624B\u673A\u76F8\u518C\u9009\u53D6\u4E8C\u7EF4\u7801",1014:"\u5C0F\u7A0B\u5E8F\u6A21\u7248\u6D88\u606F",1017:"\u524D\u5F80\u4F53\u9A8C\u7248\u7684\u5165\u53E3\u9875",1019:"\u5FAE\u4FE1\u94B1\u5305",1020:"\u516C\u4F17\u53F7 profile \u9875\u76F8\u5173\u5C0F\u7A0B\u5E8F\u5217\u8868",1022:"\u804A\u5929\u9876\u90E8\u7F6E\u9876\u5C0F\u7A0B\u5E8F\u5165\u53E3",1023:"\u5B89\u5353\u7CFB\u7EDF\u684C\u9762\u56FE\u6807",1024:"\u5C0F\u7A0B\u5E8F profile \u9875",1025:"\u626B\u63CF\u4E00\u7EF4\u7801",1026:"\u9644\u8FD1\u5C0F\u7A0B\u5E8F\u5217\u8868",1027:"\u9876\u90E8\u641C\u7D22\u6846\u641C\u7D22\u7ED3\u679C\u9875\u201C\u4F7F\u7528\u8FC7\u7684\u5C0F\u7A0B\u5E8F\u201D\u5217\u8868",1028:"\u6211\u7684\u5361\u5305",1029:"\u5361\u5238\u8BE6\u60C5\u9875",1030:"\u81EA\u52A8\u5316\u6D4B\u8BD5\u4E0B\u6253\u5F00\u5C0F\u7A0B\u5E8F",1031:"\u957F\u6309\u56FE\u7247\u8BC6\u522B\u4E00\u7EF4\u7801",1032:"\u624B\u673A\u76F8\u518C\u9009\u53D6\u4E00\u7EF4\u7801",1034:"\u5FAE\u4FE1\u652F\u4ED8\u5B8C\u6210\u9875",1035:"\u516C\u4F17\u53F7\u81EA\u5B9A\u4E49\u83DC\u5355",1036:"App \u5206\u4EAB\u6D88\u606F\u5361\u7247",1037:"\u5C0F\u7A0B\u5E8F\u6253\u5F00\u5C0F\u7A0B\u5E8F",1038:"\u4ECE\u53E6\u4E00\u4E2A\u5C0F\u7A0B\u5E8F\u8FD4\u56DE",1039:"\u6447\u7535\u89C6",1042:"\u6DFB\u52A0\u597D\u53CB\u641C\u7D22\u6846\u7684\u641C\u7D22\u7ED3\u679C\u9875",1043:"\u516C\u4F17\u53F7\u6A21\u677F\u6D88\u606F",1044:"\u5E26 shareTicket \u7684\u5C0F\u7A0B\u5E8F\u6D88\u606F\u5361\u7247\uFF08\u8BE6\u60C5)",1045:"\u670B\u53CB\u5708\u5E7F\u544A",1046:"\u670B\u53CB\u5708\u5E7F\u544A\u8BE6\u60C5\u9875",1047:"\u626B\u63CF\u5C0F\u7A0B\u5E8F\u7801",1048:"\u957F\u6309\u56FE\u7247\u8BC6\u522B\u5C0F\u7A0B\u5E8F\u7801",1049:"\u624B\u673A\u76F8\u518C\u9009\u53D6\u5C0F\u7A0B\u5E8F\u7801",1052:"\u5361\u5238\u7684\u9002\u7528\u95E8\u5E97\u5217\u8868",1053:"\u641C\u4E00\u641C\u7684\u7ED3\u679C\u9875",1054:"\u9876\u90E8\u641C\u7D22\u6846\u5C0F\u7A0B\u5E8F\u5FEB\u6377\u5165\u53E3",1056:"\u97F3\u4E50\u64AD\u653E\u5668\u83DC\u5355",1057:"\u94B1\u5305\u4E2D\u7684\u94F6\u884C\u5361\u8BE6\u60C5\u9875",1058:"\u516C\u4F17\u53F7\u6587\u7AE0",1059:"\u4F53\u9A8C\u7248\u5C0F\u7A0B\u5E8F\u7ED1\u5B9A\u9080\u8BF7\u9875",1064:"\u5FAE\u4FE1\u8FDEWi-Fi\u72B6\u6001\u680F",1067:"\u516C\u4F17\u53F7\u6587\u7AE0\u5E7F\u544A",1068:"\u9644\u8FD1\u5C0F\u7A0B\u5E8F\u5217\u8868\u5E7F\u544A",1069:"\u79FB\u52A8\u5E94\u7528",1071:"\u94B1\u5305\u4E2D\u7684\u94F6\u884C\u5361\u5217\u8868\u9875",1072:"\u4E8C\u7EF4\u7801\u6536\u6B3E\u9875\u9762",1073:"\u5BA2\u670D\u6D88\u606F\u5217\u8868\u4E0B\u53D1\u7684\u5C0F\u7A0B\u5E8F\u6D88\u606F\u5361\u7247",1074:"\u516C\u4F17\u53F7\u4F1A\u8BDD\u4E0B\u53D1\u7684\u5C0F\u7A0B\u5E8F\u6D88\u606F\u5361\u7247",1077:"\u6447\u5468\u8FB9",1078:"\u8FDEWi-Fi\u6210\u529F\u9875",1079:"\u5FAE\u4FE1\u6E38\u620F\u4E2D\u5FC3",1081:"\u5BA2\u670D\u6D88\u606F\u4E0B\u53D1\u7684\u6587\u5B57\u94FE",1082:"\u516C\u4F17\u53F7\u4F1A\u8BDD\u4E0B\u53D1\u7684\u6587\u5B57\u94FE",1084:"\u670B\u53CB\u5708\u5E7F\u544A\u539F\u751F\u9875",1089:"\u5FAE\u4FE1\u804A\u5929\u4E3B\u754C\u9762\u4E0B\u62C9",1090:"\u957F\u6309\u5C0F\u7A0B\u5E8F\u53F3\u4E0A\u89D2\u83DC\u5355\u5524\u51FA\u6700\u8FD1\u4F7F\u7528\u5386\u53F2",1091:"\u516C\u4F17\u53F7\u6587\u7AE0\u5546\u54C1\u5361\u7247",1092:"\u57CE\u5E02\u670D\u52A1\u5165\u53E3",1095:"\u5C0F\u7A0B\u5E8F\u5E7F\u544A\u7EC4\u4EF6",1096:"\u804A\u5929\u8BB0\u5F55",1097:"\u5FAE\u4FE1\u652F\u4ED8\u7B7E\u7EA6\u9875",1099:"\u9875\u9762\u5185\u5D4C\u63D2\u4EF6",1102:"\u516C\u4F17\u53F7 profile \u9875\u670D\u52A1\u9884\u89C8",1103:"\u53D1\u73B0\u680F\u5C0F\u7A0B\u5E8F\u4E3B\u5165\u53E3\uFF0C\u201C\u6211\u7684\u5C0F\u7A0B\u5E8F\u201D\u5217\u8868",1104:"\u5FAE\u4FE1\u804A\u5929\u4E3B\u754C\u9762\u4E0B\u62C9\uFF0C\u201C\u6211\u7684\u5C0F\u7A0B\u5E8F\u201D\u680F"},q="\u76F4\u63A5\u6253\u5F00";c.status.referrer="\u76F4\u63A5\u6253\u5F00";var l=null,j=0,n="",w=!1;c.lib_version=m;var d="object"==f(d)?d:{};function e(r,$,a){var e=c.autoTrackCustom[a];if(r[$]){var t=r[$];r[$]=function(){"onLaunch"===$&&(this[c.para.name]=c),!c.para.autoTrackIsFirst||b.isObject(c.para.autoTrackIsFirst)&&!c.para.autoTrackIsFirst[a]?(t.apply(this,arguments),e.apply(this,arguments)):(!0===c.para.autoTrackIsFirst||b.isObject(c.para.autoTrackIsFirst)&&c.para.autoTrackIsFirst[a])&&(e.apply(this,arguments),t.apply(this,arguments))}}else r[$]=function(){"onLaunch"===$&&(this[c.para.name]=c),e.apply(this,arguments)}}d.info=function(){if(c.para.show_log&&"object"==("undefined"==typeof console?"undefined":f(console))&&console.log)try{return console.log.apply(console,arguments)}catch(r){console.log(arguments[0])}},function(){z.bind;var r=o.forEach,$=o.indexOf,a=Array.isArray,e={},t=b.each=function($,a,t){if(null==$)return!1;if(r&&$.forEach===r)$.forEach(a,t);else if($.length===+$.length){for(var s=0,n=$.length;s<n;s++)if(s in $&&a.call(t,$[s],s,$)===e)return!1}else for(var i in $)if(p.call($,i)&&a.call(t,$[i],i,$)===e)return!1};b.logger=d,b.extend=function(r){return t(g.call(arguments,1),function($){for(var a in $)void 0!==$[a]&&(r[a]=$[a])}),r},b.extend2Lev=function(r){return t(g.call(arguments,1),function($){for(var a in $)void 0!==$[a]&&(b.isObject($[a])&&b.isObject(r[a])?b.extend(r[a],$[a]):r[a]=$[a])}),r},b.coverExtend=function(r){return t(g.call(arguments,1),function($){for(var a in $)void 0!==$[a]&&void 0===r[a]&&(r[a]=$[a])}),r},b.isArray=a||function(r){return"[object Array]"===h.call(r)},b.isFunction=function(r){try{return /^\s*\bfunction\b/.test(r)}catch(r){return!1}},b.isArguments=function(r){return!(!r||!p.call(r,"callee"))},b.toArray=function(r){return r?r.toArray?r.toArray():b.isArray(r)?g.call(r):b.isArguments(r)?g.call(r):b.values(r):[]},b.values=function(r){var $=[];return null==r?$:(t(r,function(r){$[$.length]=r}),$)},b.include=function(r,a){var s=!1;return null==r?s:$&&r.indexOf===$?-1!=r.indexOf(a):(t(r,function(r){if(s||(s=r===a))return e}),s)}}(),b.trim=function(r){return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},b.isObject=function(r){return null!=r&&"[object Object]"==h.call(r)},b.isEmptyObject=function(r){if(b.isObject(r)){for(var $ in r)if(p.call(r,$))return!1;return!0}return!1},b.isUndefined=function(r){return void 0===r},b.isString=function(r){return"[object String]"==h.call(r)},b.isDate=function(r){return"[object Date]"==h.call(r)},b.isBoolean=function(r){return"[object Boolean]"==h.call(r)},b.isNumber=function(r){return"[object Number]"==h.call(r)&&/[\d\.]+/.test(String(r))},b.isJSONString=function(r){try{JSON.parse(r)}catch(r){return!1}return!0},b.decodeURIComponent=function(r){var $="";try{$=decodeURIComponent(r)}catch(a){$=r}return $},b.encodeDates=function(r){return b.each(r,function($,a){b.isDate($)?r[a]=b.formatDate($):b.isObject($)&&(r[a]=b.encodeDates($))}),r},b.formatDate=function(r){function $(r){return r<10?"0"+r:r}return r.getFullYear()+"-"+$(r.getMonth()+1)+"-"+$(r.getDate())+" "+$(r.getHours())+":"+$(r.getMinutes())+":"+$(r.getSeconds())+"."+$(r.getMilliseconds())},b.searchObjDate=function(r){b.isObject(r)&&b.each(r,function($,a){b.isObject($)?b.searchObjDate(r[a]):b.isDate($)&&(r[a]=b.formatDate($))})},b.formatString=function(r){return r.length>c.para.max_string_length?(d.info("\u5B57\u7B26\u4E32\u957F\u5EA6\u8D85\u8FC7\u9650\u5236\uFF0C\u5DF2\u7ECF\u505A\u622A\u53D6--"+r),r.slice(0,c.para.max_string_length)):r},b.searchObjString=function(r){b.isObject(r)&&b.each(r,function($,a){b.isObject($)?b.searchObjString(r[a]):b.isString($)&&(r[a]=b.formatString($))})},b.unique=function(r){for(var $,a=[],e={},t=0;t<r.length;t++)($=r[t])in e||(e[$]=!0,a.push($));return a},b.strip_sa_properties=function(r){return b.isObject(r)?(b.each(r,function($,a){if(b.isArray($)){var e=[];b.each($,function(r){b.isString(r)?e.push(r):d.info("\u60A8\u7684\u6570\u636E-",$,"\u7684\u6570\u7EC4\u91CC\u7684\u503C\u5FC5\u987B\u662F\u5B57\u7B26\u4E32,\u5DF2\u7ECF\u5C06\u5176\u5220\u9664")}),0!==e.length?r[a]=e:(delete r[a],d.info("\u5DF2\u7ECF\u5220\u9664\u7A7A\u7684\u6570\u7EC4"))}b.isString($)||b.isNumber($)||b.isDate($)||b.isBoolean($)||b.isArray($)||(d.info("\u60A8\u7684\u6570\u636E-",$,"-\u683C\u5F0F\u4E0D\u6EE1\u8DB3\u8981\u6C42\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u5C06\u5176\u5220\u9664"),delete r[a])}),r):r},b.strip_empty_properties=function(r){var $={};return b.each(r,function(r,a){null!=r&&($[a]=r)}),$},b.utf8Encode=function(r){var $,a,e,t,s="";for($=a=0,e=(r=(r+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,t=0;t<e;t++){var n=r.charCodeAt(t),i=null;n<128?a++:i=n>127&&n<2048?String.fromCharCode(n>>6|192,63&n|128):String.fromCharCode(n>>12|224,n>>6&63|128,63&n|128),null!==i&&(a>$&&(s+=r.substring($,a)),s+=i,$=a=t+1)}return a>$&&(s+=r.substring($,r.length)),s},b.base64Encode=function(r){var $,a,e,t,s,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=0,o=0,v="",c=[];if(!r)return r;r=b.utf8Encode(r);do{$=(s=r.charCodeAt(i++)<<16|r.charCodeAt(i++)<<8|r.charCodeAt(i++))>>18&63,a=s>>12&63,e=s>>6&63,t=63&s,c[o++]=n.charAt($)+n.charAt(a)+n.charAt(e)+n.charAt(t)}while(i<r.length);switch(v=c.join(""),r.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"=";}return v},b.getCurrentPath=function(){var r="\u672A\u53D6\u5230";try{var $=getCurrentPages();r=$[$.length-1].route}catch(r){d.info(r)}return r},b.getCurrentUrl=function(r){var $=b.getCurrentPath(),a="";return b.isObject(r)&&r.sensors_mp_url_query&&(a=r.sensors_mp_url_query),$?a?$+"?"+a:$:"\u672A\u53D6\u5230"},b.getPath=function(r){return"string"==typeof r?r.replace(/^\//,""):"\u53D6\u503C\u5F02\u5E38"},b.getQueryParam=function(r,$){var a=new RegExp("[\\?&]"+$+"=([^&#]*)").exec(r);return null===a||a&&"string"!=typeof a[1]&&a[1].length?"":b.decodeURIComponent(a[1])},c.initialState={queue:[],isComplete:!1,systemIsComplete:!1,storeIsComplete:!1,checkIsComplete:function(){this.systemIsComplete&&this.storeIsComplete&&(this.isComplete=!0,this.queue.length>0&&(b.each(this.queue,function(r){c[r[0]].apply(c,g.call(r[1]))}),c.queue=[]))}},b.getPrefixUtm=function(r,$,a){if($=$||"",a=a||"_",!b.isObject(r))return{};var e={},t={};for(var s in r)-1!==(" "+k+" ").indexOf(" "+s+" ")?e[$+s]=r[s]:t[a+s]=r[s];return{$utms:e,otherUtms:t}},b.convertObjToParam=function(r){var $=[];for(var a in r)$.push(a+"="+r[a]);return $.join("&")},b.getSource=function(r){if(b.isObject(r)){if(b.isEmptyObject(r))return{};for(var $ in r)-1===(" "+k+" ").indexOf(" "+$+" ")?delete r[$]:r[$]=r[$].replace("?","*");r="?"+(r=b.convertObjToParam(r))}else r=b.decodeURIComponent(r);var a=k.split(" "),e=k.split(" "),t="",s={};return 2!==(r=r.split("?")).length?{}:(r="?"+(r=r[1]),b.isArray(c.para.source_channel)&&c.para.source_channel.length>0&&(e=e.concat(c.para.source_channel),e=b.unique(e)),b.each(e,function($){t=b.getQueryParam(r,$),(t=b.decodeURIComponent(t)).length&&b.include(a,$)&&(s[$]=t)}),s)},b.getObjFromQuery=function(r){var $=r.split("?"),a={};return $&&$[1]?(b.each($[1].split("&"),function(r){var $=r.split("=");$[0]&&$[1]&&(a[$[0]]=$[1])}),a):{}},b.getUtm=function(r,$,a){var e=b.getSource(r);return void 0===a&&$?{pre1:b.getPrefixUtm(e,$).$utms||{},pre2:{}}:void 0!==a&&$?{pre1:b.getPrefixUtm(e,$).$utms||{},pre2:b.getPrefixUtm(e,a).$utms||{}}:{pre1:{},pre2:{}}},b.getMPScene=function(r){return"number"==typeof r||"string"==typeof r&&""!==r?(r=String(r),x[r]||r):"\u672A\u53D6\u5230\u503C"},b.getShareDepth=function(){if("number"==typeof j&&0!==j){var r=c.store.getDistinctId(),$=c.store.getFirstId();return!n||n!==r&&n!==$?j+1:j}return 1},b.setShareInfo=function(r,$){var a={};if(!(r&&b.isObject(r.query)&&r.query.sampshare))return{};if(a=b.decodeURIComponent(r.query.sampshare),!b.isJSONString(a))return{};var e=(a=JSON.parse(a)).d,t=a.p,s=a.i;"string"==typeof s?($.$share_distinct_id=s,n=s):$.$share_distinct_id="\u53D6\u503C\u5F02\u5E38","number"==typeof e?($.$share_depth=e,j=e):$.$share_depth="-1",$.$share_url_path="string"==typeof t?t:"\u53D6\u503C\u5F02\u5E38"},b.getShareInfo=function(){return JSON.stringify({i:c.store.getDistinctId()||"\u53D6\u503C\u5F02\u5E38",p:b.getCurrentPath(),d:b.getShareDepth()})},b.setUtm=function(r,$){var a={};if(r&&b.isObject(r.query)){var e=(a=b.extend({},r.query)).scene;e&&(e=-1!==(e=b.decodeURIComponent(e)).indexOf("?")?"?"+e.replace(/\?/g,""):"?"+e,b.extend(a,b.getObjFromQuery(e))),r.query.q&&b.extend(a,b.getObjFromQuery(b.decodeURIComponent(r.query.q)))}if(r&&b.isObject(r.referrerInfo)&&r.referrerInfo.extraData){var t={};b.isObject(r.referrerInfo.extraData)&&!b.isEmptyObject(r.referrerInfo.extraData)?t=r.referrerInfo.extraData:b.isJSONString(r.referrerInfo.extraData)&&(t=JSON.parse(r.referrerInfo.extraData)),b.extend(a,t)}var s=b.getUtm(a,"$","$latest_");return b.extend($,s.pre1),s},b.wxrequest=function(r){var $=a.request(r);setTimeout(function(){b.isObject($)&&b.isFunction($.abort)&&$.abort()},c.para.datasend_timeout)},b.info={currentProps:{},properties:{$lib:t,$lib_version:String(m)},getSystem:function(){var r=this.properties;a.getNetworkType({success:function($){r.$network_type=$.networkType},complete:function(){a.getSystemInfo({success:function($){r.$manufacturer=$.brand,r.$model=$.model,r.$screen_width=Number($.screenWidth),r.$screen_height=Number($.screenHeight),r.$os=$.system.split(" ")[0],r.$os_version=$.system.split(" ")[1]},complete:function(){c.initialState.systemIsComplete=!0,c.initialState.checkIsComplete()}})}})}},c._=b,c.prepareData=function(r,$){var a={distinct_id:this.store.getDistinctId(),lib:{$lib:t,$lib_method:"code",$lib_version:String(m)},properties:{}};b.extend(a,r),b.isObject(r.properties)&&!b.isEmptyObject(r.properties)&&b.extend(a.properties,r.properties),r.type&&"profile"===r.type.slice(0,7)||(c.para.batch_send&&(a._track_id=Number(String(Math.random()).slice(2,5)+String(Math.random()).slice(2,4)+String(Date.now()).slice(-4))),a.properties=b.extend({},b.info.properties,c.store.getProps(),b.info.currentProps,a.properties),"object"==f(c.store._state)&&"number"==typeof c.store._state.first_visit_day_time&&c.store._state.first_visit_day_time>new Date().getTime()?a.properties.$is_first_day=!0:a.properties.$is_first_day=!1),a.properties.$time&&b.isDate(a.properties.$time)?(a.time=1*a.properties.$time,delete a.properties.$time):c.para.use_client_time&&(a.time=1*new Date),b.searchObjDate(a),b.searchObjString(a),d.info(a),c.sendStrategy.send(a)},c.store={verifyDistinctId:function(r){return"number"==typeof r&&(r=String(r),/^\d+$/.test(r)||(r="unexpected_id")),"string"==typeof r&&""!==r||(r="unexpected_id"),r},storageInfo:null,getUUID:function(){return Date.now()+"-"+Math.floor(1e7*Math.random())+"-"+Math.random().toString(16).replace(".","")+"-"+String(31242*Math.random()).replace(".","").slice(0,8)},getStorage:function(){return this.storageInfo?this.storageInfo:(this.storageInfo=a.getStorageSync("sensorsdata2015_wechat")||"",this.storageInfo)},_state:{},mem:{mdata:[],getLength:function(){return this.mdata.length},add:function(r){this.mdata.push(r)},clear:function(r){this.mdata.splice(0,r)}},toState:function(r){var $=null;b.isJSONString(r)?($=JSON.parse(r)).distinct_id?this._state=$:this.set("distinct_id",this.getUUID()):b.isObject(r)&&($=r).distinct_id?this._state=$:this.set("distinct_id",this.getUUID())},getFirstId:function(){return this._state.first_id},getDistinctId:function(){return this._state.distinct_id},getProps:function(){return this._state.props||{}},setProps:function(r,$){var a=this._state.props||{};$?this.set("props",r):(b.extend(a,r),this.set("props",a))},set:function(r,$){var a={};for(var e in"string"==typeof r?a[r]=$:"object"==f(r)&&(a=r),this._state=this._state||{},a)this._state[e]=a[e];this.save()},change:function(r,$){this._state[r]=$},save:function(){a.setStorageSync("sensorsdata2015_wechat",this._state)},init:function(){var r=this.getStorage();if(r)this.toState(r);else{w=!0;var $=new Date,a=$.getTime();$.setHours(23),$.setMinutes(59),$.setSeconds(60),c.setOnceProfile({$first_visit_time:new Date}),this.set({distinct_id:this.getUUID(),first_visit_time:a,first_visit_day_time:$.getTime()})}}},c.setProfile=function(r,$){c.prepareData({type:"profile_set",properties:r},$)},c.setOnceProfile=function(r,$){c.prepareData({type:"profile_set_once",properties:r},$)},c.appendProfile=function(r,$){if(!b.isObject(r))return!1;b.each(r,function($,a){b.isString($)?r[a]=[$]:b.isArray($)||(delete r[a],d.info("appendProfile\u5C5E\u6027\u7684\u503C\u5FC5\u987B\u662F\u5B57\u7B26\u4E32\u6216\u8005\u6570\u7EC4"))}),c.prepareData({type:"profile_append",properties:r},$)},c.incrementProfile=function(r,$){if(!b.isObject(r))return!1;var a=r;b.isString(r)&&((r={})[a]=1),c.prepareData({type:"profile_increment",properties:r},$)},c.track=function(r,$,a){this.prepareData({type:"track",event:r,properties:$},a)},c.identify=function(r,$){if("string"!=typeof r&&"number"!=typeof r)return!1;r=c.store.verifyDistinctId(r);var a=c.store.getFirstId();!0===$?a?c.store.set("first_id",r):c.store.set("distinct_id",r):a?c.store.change("first_id",r):c.store.change("distinct_id",r)},c.trackSignup=function(r,$,a,e){c.prepareData({original_id:c.store.getFirstId()||c.store.getDistinctId(),distinct_id:r,type:"track_signup",event:$,properties:a},e),c.store.set("distinct_id",r)},c.registerApp=function(r){b.isObject(r)&&!b.isEmptyObject(r)&&(b.info.currentProps=b.extend(b.info.currentProps,r))},c.register=function(r){b.isObject(r)&&!b.isEmptyObject(r)&&c.store.setProps(r)},c.clearAllRegister=function(){c.store.setProps({},!0)},c.login=function(r){if("string"!=typeof r&&"number"!=typeof r)return!1;r=c.store.verifyDistinctId(r);var $=c.store.getFirstId(),a=c.store.getDistinctId();r!==a&&($?c.trackSignup(r,"$SignUp"):(c.store.set("first_id",a),c.trackSignup(r,"$SignUp")))},c.openid={getRequest:function(r){a.login({success:function($){$.code&&c.para.appid&&c.para.openid_url?b.wxrequest({url:c.para.openid_url+"&code="+$.code+"&appid="+c.para.appid,method:"GET",complete:function($){b.isObject($)&&b.isObject($.data)&&$.data.openid?r($.data.openid):r()}}):r()}})},getWXStorage:function(){var r=c.store.getStorage();if(r&&b.isObject(r))return r.openid},getOpenid:function(r){if(!c.para.appid)return r(),!1;var $=this.getWXStorage();$?r($):this.getRequest(r)}},c.initial=function(){this._.info.getSystem(),this.store.init()},c.init=function(r){if(!0===this.hasInit)return!1;this.hasInit=!0,c.setPara(r),c.para.batch_send&&c.sendStrategy.batchInterval(),c.initialState.storeIsComplete=!0,c.initialState.checkIsComplete()},c.getPresetProperties=function(){if(b.info&&b.info.properties&&b.info.properties.$lib){var r=b.extend({$url_path:b.getCurrentPath()},b.info.properties,c.store.getProps());return delete r.$lib,r}return{}},b.autoExeQueue=function(){return{items:[],enqueue:function(r){this.items.push(r),this.start()},dequeue:function(){return this.items.shift()},getCurrentItem:function(){return this.items[0]},isRun:!1,start:function(){this.items.length>0&&!this.isRun&&(this.isRun=!0,this.getCurrentItem().start())},close:function(){this.dequeue(),this.isRun=!1,this.start()}}},c.requestQueue=function(r){this.url=r.url},c.requestQueue.prototype.isEnd=function(){this.received||(this.received=!0,this.close())},c.requestQueue.prototype.start=function(){var r=this;setTimeout(function(){r.isEnd()},c.para.send_timeout),b.wxrequest({url:this.url,method:"GET",complete:function(){r.isEnd()}})},c.dataQueue=b.autoExeQueue(),c.sendStrategy={dataHasSend:!0,dataHasChange:!1,onAppHide:function(){c.para.batch_send&&this.batchSend()},send:function(r){if(c.para.batch_send){if(this.dataHasChange=!0,c.store.mem.getLength()>=300)return d.info("\u6570\u636E\u91CF\u5B58\u50A8\u8FC7\u5927\uFF0C\u6709\u5F02\u5E38"),!1;c.store.mem.add(r),c.store.mem.getLength()>=c.para.batch_send.max_length&&this.batchSend()}else this.queueSend(r)},queueSend:function(r){r=JSON.stringify(r),r=-1!==c.para.server_url.indexOf("?")?c.para.server_url+"&data="+encodeURIComponent(b.base64Encode(r)):c.para.server_url+"?data="+encodeURIComponent(b.base64Encode(r));var $=new c.requestQueue({url:r});$.close=function(){c.dataQueue.close()},c.dataQueue.enqueue($)},wxrequest:function(r){if(b.isArray(r.data)&&r.data.length>0){var $=Date.now();r.data.forEach(function(r){r._flush_time=$}),r.data=JSON.stringify(r.data),b.wxrequest({url:c.para.server_url,method:"POST",dataType:"text",data:"data_list="+encodeURIComponent(b.base64Encode(r.data)),success:function(){r.success(r.len)}})}else r.success(r.len)},batchSend:function(){if(this.dataHasSend){var r=c.store.mem.mdata,$=r.length;$>0&&(this.dataHasSend=!1,this.wxrequest({data:r,len:$,success:this.batchRemove.bind(this)}))}},batchRemove:function(r){c.store.mem.clear(r),this.dataHasSend=!0,this.dataHasChange=!0,this.batchWrite()},is_first_batch_write:!0,batchWrite:function(){var r=this;this.dataHasChange&&(this.is_first_batch_write&&(this.is_first_batch_write=!1,setTimeout(function(){r.batchSend()},1e3)),this.dataHasChange=!1,a.setStorageSync("sensors_mp_prepare_data",c.store.mem.mdata))},batchInterval:function(){var r=this;!function $(){setTimeout(function(){r.batchWrite(),$()},1e3)}(),function $(){setTimeout(function(){r.batchSend(),$()},c.para.batch_send.send_timeout)}()}},c.setOpenid=function(r,$){c.store.set("openid",r),$?c.store.set("distinct_id",r):c.identify(r,!0)},c.initWithOpenid=function(r,$){(r=r||{}).appid&&(c.para.appid=r.appid),c.openid.getOpenid(function(a){a&&c.setOpenid(a,r.isCoverLogin),$&&b.isFunction($)&&$(a),c.init(r)})},b.each(["setProfile","setOnceProfile","track","register","clearAllRegister","quick"],function(r){var $=c[r];c[r]=function(){c.initialState.isComplete?$.apply(c,arguments):c.initialState.queue.push([r,arguments])}}),b.setQuery=function(r){if(r&&b.isObject(r)&&!b.isEmptyObject(r)){var $=[];return b.each(r,function(r,a){"q"===a&&b.isString(r)&&0===r.indexOf("http")||"scene"===a||$.push(a+"="+r)}),$.join("&")}return""},c.autoTrackCustom={trackCustom:function(r,$,a){var e=c.para.autoTrack[r],t="";c.para.autoTrack&&e&&("function"==typeof e?(t=e(),b.isObject(t)&&b.extend($,t)):b.isObject(e)&&(b.extend($,e),c.para.autoTrack[r]=!0),c.track(a,$))},appLaunch:function(r,$){"object"!=f(this)||this.trackCustom||(this[c.para.name]=c);var a={};r&&r.path&&(a.$url_path=b.getPath(r.path)),b.setShareInfo(r,a);var e=b.setUtm(r,a);w?(a.$is_first_time=!0,b.isEmptyObject(e.pre1)||c.setOnceProfile(e.pre1)):a.$is_first_time=!1,b.isEmptyObject(e.pre2)||c.registerApp(e.pre2),r.scene=r.scene||"\u672A\u53D6\u5230\u503C",a.$scene=b.getMPScene(r.scene),c.registerApp({$latest_scene:a.$scene}),a.$url_query=b.setQuery(r.query),$?(a=b.extend(a,$),c.track("$MPLaunch",a)):c.para.autoTrack&&c.para.autoTrack.appLaunch&&c.autoTrackCustom.trackCustom("appLaunch",a,"$MPLaunch")},appShow:function(r,$){var a={};l=new Date().getTime(),r&&r.path&&(a.$url_path=b.getPath(r.path)),b.setShareInfo(r,a);var e=b.setUtm(r,a);b.isEmptyObject(e.pre2)||c.registerApp(e.pre2),r.scene=r.scene||"\u672A\u53D6\u5230\u503C",a.$scene=b.getMPScene(r.scene),c.registerApp({$latest_scene:a.$scene}),a.$url_query=b.setQuery(r.query),$?(a=b.extend(a,$),c.track("$MPShow",a)):c.para.autoTrack&&c.para.autoTrack.appShow&&c.autoTrackCustom.trackCustom("appShow",a,"$MPShow")},appHide:function(r){var $=new Date().getTime(),a={};a.$url_path=b.getCurrentPath(),l&&$-l>0&&($-l)/36e5<24&&(a.event_duration=($-l)/1e3),r?(a=b.extend(a,r),c.track("$MPHide",a)):c.para.autoTrack&&c.para.autoTrack.appHide&&c.autoTrackCustom.trackCustom("appHide",a,"$MPHide"),c.sendStrategy.onAppHide()},pageLoad:function(r){r&&b.isObject(r)&&(this.sensors_mp_url_query=b.setQuery(r))},pageShow:function(r){var $={},a=b.getCurrentPath();$.$referrer=q,$.$url_path=a,c.status.last_referrer=q,this.sensors_mp_url_query&&($.$url_query=this.sensors_mp_url_query),r?($=b.extend($,r),c.track("$MPViewScreen",$)):c.para.onshow?c.para.onshow(c,a,this):c.para.autoTrack&&c.para.autoTrack.pageShow&&c.autoTrackCustom.trackCustom("pageShow",$,"$MPViewScreen"),q=a,c.status.referrer=a},pageShare:function(r,$){var a=r.onShareAppMessage;r.onShareAppMessage=function(){var r=a.apply(this,arguments);return c.para.autoTrack&&c.para.autoTrack.pageShare&&c.autoTrackCustom.trackCustom("pageShare",{$url_path:b.getCurrentPath(),$share_depth:b.getShareDepth()},"$MPShare"),c.para.allow_amend_share_path&&("object"!=f(r)&&((r={}).path=b.getCurrentUrl(this)),"object"!=f(r)||void 0!==r.path&&""!==r.path||(r.path=b.getCurrentUrl(this)),"object"==f(r)&&"string"==typeof r.path&&(-1===r.path.indexOf("?")?r.path=r.path+"?":"&"!==r.path.slice(-1)&&(r.path=r.path+"&")),r.path=r.path+"sampshare="+encodeURIComponent(b.getShareInfo())),r}}},c.quick=function(){var r=arguments[0],$=arguments[1],a=arguments[2],e=b.isObject(a)?a:{};"appLaunch"===r||"appShow"===r?$?c.autoTrackCustom[r]($,e):d.info("App\u7684launch\u548Cshow\uFF0C\u5728sensors.quick\u7B2C\u4E8C\u4E2A\u53C2\u6570\u5FC5\u987B\u4F20\u5165App\u7684options\u53C2\u6570"):"appHide"===r&&(e=b.isObject($)?$:{},c.autoTrackCustom[r](e))},c.App=function(r){e(r=r||{},"onLaunch","appLaunch"),e(r,"onShow","appShow"),e(r,"onHide","appHide")},c.Page=function(r){e(r,"onLoad","pageLoad"),e(r,"onShow","pageShow"),"function"==typeof r.onShareAppMessage&&c.autoTrackCustom.pageShare(r)},c.initial(),C=c;var v={},y=A,i=C;function u(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var r=arguments.length>1?arguments[1]:void 0,$=arguments.length>2?arguments[2]:void 0,e=arguments.length>3?arguments[3]:void 0;return y(e),i.setPara({}),s(r)&&r.intercept(function(r){return i.Page(r),r}),s($)&&$.intercept(function(r){return i.App(r),r}),B(i),i}function B(r){var $=r.track,e=[];r.track=function(o,a){var c=e.reduce(function(r,$){return Object.assign(r,$()||{})},{});$.call(r,o,Object.assign(a,c))},r.registerDynamicSuperProperties=function(r){e.push(r)}}function s(r){return"function"==typeof r}(v=u).default=u;if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=v}else if(typeof define==="function"&&define.amd){define(function(){return v})}})();
const globalVars = {
App: App,
Page: Page,
Component: Component,
wx: wx
};
function Sensors(config = {}, JPage, JApp, jgb, JComponent) {
const wx = jgb || globalVars.wx;
const Page = JPage || globalVars.Page;
const Component = JComponent || globalVars.Component;
const App = JApp || globalVars.App;
var _ = {},
sa = {
para: {
name: "sensors",
server_url: "",
send_timeout: 1e3,
use_client_time: !1,
show_log: !0,
allow_amend_share_path: !0,
max_string_length: 300,
datasend_timeout: 3e3,
source_channel: [],
autoTrack: {
appLaunch: !0,
appShow: !0,
appHide: !0,
pageShow: !0,
pageShare: !0,
mpClick: !1
},
is_persistent_save: {
share: !1,
utm: !1
}
}
},
mpHook = {
data: 1,
onLoad: 1,
onShow: 1,
onReady: 1,
onPullDownRefresh: 1,
onReachBottom: 1,
onShareAppMessage: 1,
onPageScroll: 1,
onResize: 1,
onTabItemTap: 1,
onHide: 1,
onUnload: 1
},
logger = "object" == typeof logger ? logger : {};
logger.info = function () {
if (sa.para.show_log && "object" == typeof console && console.log) try {
return console.log.apply(console, arguments);
} catch (t) {
console.log(arguments[0]);
}
}, sa.setPara = function (t) {
sa.para = _.extend2Lev(sa.para, t);
var e = [];
if (_.isArray(sa.para.source_channel)) for (var a = sa.para.source_channel.length, s = 0; s < a; s++) -1 === " utm_source utm_medium utm_campaign utm_content utm_term sa_utm ".indexOf(" " + sa.para.source_channel[s] + " ") && e.push(sa.para.source_channel[s]);
sa.para.source_channel = e, _.isObject(sa.para.register) && _.extend(_.info.properties, sa.para.register), sa.para.openid_url || (sa.para.openid_url = sa.para.server_url.replace(/([^\/])\/(sa)(\.gif){0,1}/, "$1/mp_login")), "number" != typeof sa.para.send_timeout && (sa.para.send_timeout = 1e3);
var r = {
send_timeout: 6e3,
max_length: 6
};
t && t.datasend_timeout || sa.para.batch_send && (sa.para.datasend_timeout = 1e4), !0 === sa.para.batch_send ? (sa.para.batch_send = _.extend({}, r), sa.para.use_client_time = !0) : _.isObject(sa.para.batch_send) && (sa.para.use_client_time = !0, sa.para.batch_send = _.extend({}, r, sa.para.batch_send));
var n = {
share: !1,
utm: !1
};
!0 === sa.para.is_persistent_save ? (sa.para.is_persistent_save = _.extend({}, n), sa.para.is_persistent_save.utm = !0) : _.isObject(sa.para.is_persistent_save) && (sa.para.is_persistent_save = _.extend({}, n, sa.para.is_persistent_save)), sa.para.server_url || logger.info("\u8bf7\u4f7f\u7528 setPara() \u65b9\u6cd5\u8bbe\u7f6e server_url \u6570\u636e\u63a5\u6536\u5730\u5740,\u8be6\u60c5\u53ef\u67e5\u770bhttps://www.sensorsdata.cn/manual/mp_sdk_new.html#112-%E5%BC%95%E5%85%A5%E5%B9%B6%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0");
}, sa.status = {};
var ArrayProto = Array.prototype,
FuncProto = Function.prototype,
ObjProto = Object.prototype,
slice = ArrayProto.slice,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty,
LIB_VERSION = "1.13.22",
LIB_NAME = "MiniProgram",
source_channel_standard = "utm_source utm_medium utm_campaign utm_content utm_term",
latest_source_channel = ["$latest_utm_source", "$latest_utm_medium", "$latest_utm_campaign", "$latest_utm_content", "$latest_utm_term", "latest_sa_utm"],
latest_share_info = ["$latest_share_distinct_id", "$latest_share_url_path", "$latest_share_depth"],
mp_scene = {
1000: "\u5176\u4ed6",
1001: "\u53d1\u73b0\u680f\u5c0f\u7a0b\u5e8f\u4e3b\u5165\u53e3\uff0c「\u6700\u8fd1\u4f7f\u7528」\u5217\u8868\uff08\u57fa\u7840\u5e932.2.4\u7248\u672c\u8d77\u5305\u542b「\u6211\u7684\u5c0f\u7a0b\u5e8f」\u5217\u8868\uff09",
1005: "\u9876\u90e8\u641c\u7d22\u6846\u7684\u641c\u7d22\u7ed3\u679c\u9875",
1006: "\u53d1\u73b0\u680f\u5c0f\u7a0b\u5e8f\u4e3b\u5165\u53e3\u641c\u7d22\u6846\u7684\u641c\u7d22\u7ed3\u679c\u9875",
1007: "\u5355\u4eba\u804a\u5929\u4f1a\u8bdd\u4e2d\u7684\u5c0f\u7a0b\u5e8f\u6d88\u606f\u5361\u7247",
1008: "\u7fa4\u804a\u4f1a\u8bdd\u4e2d\u7684\u5c0f\u7a0b\u5e8f\u6d88\u606f\u5361\u7247",
1011: "\u626b\u63cf\u4e8c\u7ef4\u7801",
1012: "\u957f\u6309\u56fe\u7247\u8bc6\u522b\u4e8c\u7ef4\u7801",
1013: "\u624b\u673a\u76f8\u518c\u9009\u53d6\u4e8c\u7ef4\u7801",
1014: "\u5c0f\u7a0b\u5e8f\u6a21\u7248\u6d88\u606f",
1017: "\u524d\u5f80\u4f53\u9a8c\u7248\u7684\u5165\u53e3\u9875",
1019: "\u5fae\u4fe1\u94b1\u5305",
1020: "\u516c\u4f17\u53f7 profile \u9875\u76f8\u5173\u5c0f\u7a0b\u5e8f\u5217\u8868",
1022: "\u804a\u5929\u9876\u90e8\u7f6e\u9876\u5c0f\u7a0b\u5e8f\u5165\u53e3",
1023: "\u5b89\u5353\u7cfb\u7edf\u684c\u9762\u56fe\u6807",
1024: "\u5c0f\u7a0b\u5e8f profile \u9875",
1025: "\u626b\u63cf\u4e00\u7ef4\u7801",
1026: "\u9644\u8fd1\u5c0f\u7a0b\u5e8f\u5217\u8868",
1027: "\u9876\u90e8\u641c\u7d22\u6846\u641c\u7d22\u7ed3\u679c\u9875“\u4f7f\u7528\u8fc7\u7684\u5c0f\u7a0b\u5e8f”\u5217\u8868",
1028: "\u6211\u7684\u5361\u5305",
1029: "\u5361\u5238\u8be6\u60c5\u9875",
1030: "\u81ea\u52a8\u5316\u6d4b\u8bd5\u4e0b\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1031: "\u957f\u6309\u56fe\u7247\u8bc6\u522b\u4e00\u7ef4\u7801",
1032: "\u624b\u673a\u76f8\u518c\u9009\u53d6\u4e00\u7ef4\u7801",
1034: "\u5fae\u4fe1\u652f\u4ed8\u5b8c\u6210\u9875",
1035: "\u516c\u4f17\u53f7\u81ea\u5b9a\u4e49\u83dc\u5355",
1036: "App \u5206\u4eab\u6d88\u606f\u5361\u7247",
1037: "\u5c0f\u7a0b\u5e8f\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1038: "\u4ece\u53e6\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u8fd4\u56de",
1039: "\u6447\u7535\u89c6",
1042: "\u6dfb\u52a0\u597d\u53cb\u641c\u7d22\u6846\u7684\u641c\u7d22\u7ed3\u679c\u9875",
1043: "\u516c\u4f17\u53f7\u6a21\u677f\u6d88\u606f",
1044: "\u5e26 shareTicket \u7684\u5c0f\u7a0b\u5e8f\u6d88\u606f\u5361\u7247\uff08\u8be6\u60c5)",
1045: "\u670b\u53cb\u5708\u5e7f\u544a",
1046: "\u670b\u53cb\u5708\u5e7f\u544a\u8be6\u60c5\u9875",
1047: "\u626b\u63cf\u5c0f\u7a0b\u5e8f\u7801",
1048: "\u957f\u6309\u56fe\u7247\u8bc6\u522b\u5c0f\u7a0b\u5e8f\u7801",
1049: "\u624b\u673a\u76f8\u518c\u9009\u53d6\u5c0f\u7a0b\u5e8f\u7801",
1052: "\u5361\u5238\u7684\u9002\u7528\u95e8\u5e97\u5217\u8868",
1053: "\u641c\u4e00\u641c\u7684\u7ed3\u679c\u9875",
1054: "\u9876\u90e8\u641c\u7d22\u6846\u5c0f\u7a0b\u5e8f\u5feb\u6377\u5165\u53e3",
1056: "\u97f3\u4e50\u64ad\u653e\u5668\u83dc\u5355",
1057: "\u94b1\u5305\u4e2d\u7684\u94f6\u884c\u5361\u8be6\u60c5\u9875",
1058: "\u516c\u4f17\u53f7\u6587\u7ae0",
1059: "\u4f53\u9a8c\u7248\u5c0f\u7a0b\u5e8f\u7ed1\u5b9a\u9080\u8bf7\u9875",
1064: "\u5fae\u4fe1\u8fdeWi-Fi\u72b6\u6001\u680f",
1067: "\u516c\u4f17\u53f7\u6587\u7ae0\u5e7f\u544a",
1068: "\u9644\u8fd1\u5c0f\u7a0b\u5e8f\u5217\u8868\u5e7f\u544a",
1069: "\u79fb\u52a8\u5e94\u7528",
1071: "\u94b1\u5305\u4e2d\u7684\u94f6\u884c\u5361\u5217\u8868\u9875",
1072: "\u4e8c\u7ef4\u7801\u6536\u6b3e\u9875\u9762",
1073: "\u5ba2\u670d\u6d88\u606f\u5217\u8868\u4e0b\u53d1\u7684\u5c0f\u7a0b\u5e8f\u6d88\u606f\u5361\u7247",
1074: "\u516c\u4f17\u53f7\u4f1a\u8bdd\u4e0b\u53d1\u7684\u5c0f\u7a0b\u5e8f\u6d88\u606f\u5361\u7247",
1077: "\u6447\u5468\u8fb9",
1078: "\u8fdeWi-Fi\u6210\u529f\u9875",
1079: "\u5fae\u4fe1\u6e38\u620f\u4e2d\u5fc3",
1081: "\u5ba2\u670d\u6d88\u606f\u4e0b\u53d1\u7684\u6587\u5b57\u94fe",
1082: "\u516c\u4f17\u53f7\u4f1a\u8bdd\u4e0b\u53d1\u7684\u6587\u5b57\u94fe",
1084: "\u670b\u53cb\u5708\u5e7f\u544a\u539f\u751f\u9875",
1088: "\u4f1a\u8bdd\u4e2d\u67e5\u770b\u7cfb\u7edf\u6d88\u606f\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1089: "\u5fae\u4fe1\u804a\u5929\u4e3b\u754c\u9762\u4e0b\u62c9",
1090: "\u957f\u6309\u5c0f\u7a0b\u5e8f\u53f3\u4e0a\u89d2\u83dc\u5355\u5524\u51fa\u6700\u8fd1\u4f7f\u7528\u5386\u53f2",
1091: "\u516c\u4f17\u53f7\u6587\u7ae0\u5546\u54c1\u5361\u7247",
1092: "\u57ce\u5e02\u670d\u52a1\u5165\u53e3",
1095: "\u5c0f\u7a0b\u5e8f\u5e7f\u544a\u7ec4\u4ef6",
1096: "\u804a\u5929\u8bb0\u5f55",
1097: "\u5fae\u4fe1\u652f\u4ed8\u7b7e\u7ea6\u9875",
1099: "\u9875\u9762\u5185\u5d4c\u63d2\u4ef6",
1102: "\u516c\u4f17\u53f7 profile \u9875\u670d\u52a1\u9884\u89c8",
1103: "\u53d1\u73b0\u680f\u5c0f\u7a0b\u5e8f\u4e3b\u5165\u53e3\uff0c“\u6211\u7684\u5c0f\u7a0b\u5e8f”\u5217\u8868",
1104: "\u5fae\u4fe1\u804a\u5929\u4e3b\u754c\u9762\u4e0b\u62c9\uff0c“\u6211\u7684\u5c0f\u7a0b\u5e8f”\u680f",
1106: "\u804a\u5929\u4e3b\u754c\u9762\u4e0b\u62c9\uff0c\u4ece\u9876\u90e8\u641c\u7d22\u7ed3\u679c\u9875\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1107: "\u8ba2\u9605\u6d88\u606f\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1113: "\u5b89\u5353\u624b\u673a\u8d1f\u4e00\u5c4f\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f(\u4e09\u661f)",
1114: "\u5b89\u5353\u624b\u673a\u4fa7\u8fb9\u680f\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f(\u4e09\u661f)",
1124: "\u626b“\u4e00\u7269\u4e00\u7801”\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1125: "\u957f\u6309\u56fe\u7247\u8bc6\u522b“\u4e00\u7269\u4e00\u7801”",
1126: "\u626b\u63cf\u624b\u673a\u76f8\u518c\u4e2d\u9009\u53d6\u7684“\u4e00\u7269\u4e00\u7801”",
1129: "\u5fae\u4fe1\u722c\u866b\u8bbf\u95ee",
1131: "\u6d6e\u7a97\u6253\u5f00\u5c0f\u7a0b\u5e8f",
1146: "\u5730\u7406\u4f4d\u7f6e\u4fe1\u606f\u6253\u5f00\u51fa\u884c\u7c7b\u5c0f\u7a0b\u5e8f",
1148: "\u5361\u5305-\u4ea4\u901a\u5361\uff0c\u6253\u5f00\u5c0f\u7a0b\u5e8f"
},
sa_referrer = "\u76f4\u63a5\u6253\u5f00";
sa.status.referrer = "\u76f4\u63a5\u6253\u5f00";
var mpshow_time = null,
query_share_depth = 0,
share_distinct_id = "",
is_first_launch = !1;
function mp_proxy(t, e, a) {
var s = sa.autoTrackCustom[a];
if (t[e]) {
var r = t[e];
t[e] = function () {
"onLaunch" === e && (this[sa.para.name] = sa), !sa.para.autoTrackIsFirst || _.isObject(sa.para.autoTrackIsFirst) && !sa.para.autoTrackIsFirst[a] ? (r.apply(this, arguments), s.apply(this, arguments)) : (!0 === sa.para.autoTrackIsFirst || _.isObject(sa.para.autoTrackIsFirst) && sa.para.autoTrackIsFirst[a]) && (s.apply(this, arguments), r.apply(this, arguments));
};
} else t[e] = function () {
"onLaunch" === e && (this[sa.para.name] = sa), s.apply(this, arguments);
};
}
function click_proxy(t, e) {
var a = t[e];
t[e] = function () {
var t = {},
e = "";
if (_.isObject(arguments[0])) {
var s = arguments[0].currentTarget || {},
r = s.dataset || {};
e = arguments[0].type, t.$element_id = s.id, t.$element_type = r.type, t.$element_content = r.content, t.$element_name = r.name;
}
return e && _.isClick(e) && (t.$url_path = _.getCurrentPath(), sa.track("$MPClick", t)), a && a.apply(this, arguments);
};
}
sa.lib_version = LIB_VERSION, function () {
FuncProto.bind;
var t = ArrayProto.forEach,
e = ArrayProto.indexOf,
a = Array.isArray,
s = {},
r = _.each = function (e, a, r) {
if (null == e) return !1;
if (t && e.forEach === t) e.forEach(a, r);else if (e.length === +e.length) {
for (var n = 0, i = e.length; n < i; n++) if (n in e && a.call(r, e[n], n, e) === s) return !1;
} else for (var o in e) if (hasOwnProperty.call(e, o) && a.call(r, e[o], o, e) === s) return !1;
};
_.logger = logger, _.extend = function (t) {
return r(slice.call(arguments, 1), function (e) {
for (var a in e) void 0 !== e[a] && (t[a] = e[a]);
}), t;
}, _.extend2Lev = function (t) {
return r(slice.call(arguments, 1), function (e) {
for (var a in e) void 0 !== e[a] && null !== e[a] && (_.isObject(e[a]) && _.isObject(t[a]) ? _.extend(t[a], e[a]) : t[a] = e[a]);
}), t;
}, _.coverExtend = function (t) {
return r(slice.call(arguments, 1), function (e) {
for (var a in e) void 0 !== e[a] && void 0 === t[a] && (t[a] = e[a]);
}), t;
}, _.isArray = a || function (t) {
return "[object Array]" === toString.call(t);
}, _.isFunction = function (t) {
try {
return /^\s*\bfunction\b/.test(t);
} catch (t) {
return !1;
}
}, _.isArguments = function (t) {
return !(!t || !hasOwnProperty.call(t, "callee"));
}, _.toArray = function (t) {
return t ? t.toArray ? t.toArray() : _.isArray(t) ? slice.call(t) : _.isArguments(t) ? slice.call(t) : _.values(t) : [];
}, _.values = function (t) {
var e = [];
return null == t ? e : (r(t, function (t) {
e[e.length] = t;
}), e);
}, _.include = function (t, a) {
var n = !1;
return null == t ? n : e && t.indexOf === e ? -1 != t.indexOf(a) : (r(t, function (t) {
if (n || (n = t === a)) return s;
}), n);
};
}(), _.trim = function (t) {
return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
}, _.isObject = function (t) {
return null != t && "[object Object]" == toString.call(t);
}, _.isEmptyObject = function (t) {
if (_.isObject(t)) {
for (var e in t) if (hasOwnProperty.call(t, e)) return !1;
return !0;
}
return !1;
}, _.isUndefined = function (t) {
return void 0 === t;
}, _.isString = function (t) {
return "[object String]" == toString.call(t);
}, _.isDate = function (t) {
return "[object Date]" == toString.call(t);
}, _.isBoolean = function (t) {
return "[object Boolean]" == toString.call(t);
}, _.isNumber = function (t) {
return "[object Number]" == toString.call(t) && /[\d\.]+/.test(String(t));
}, _.isJSONString = function (t) {
try {
JSON.parse(t);
} catch (t) {
return !1;
}
return !0;
}, _.decodeURIComponent = function (t) {
var e = "";
try {
e = decodeURIComponent(t);
} catch (a) {
e = t;
}
return e;
}, _.encodeDates = function (t) {
return _.each(t, function (e, a) {
_.isDate(e) ? t[a] = _.formatDate(e) : _.isObject(e) && (t[a] = _.encodeDates(e));
}), t;
}, _.formatDate = function (t) {
function e(t) {
return t < 10 ? "0" + t : t;
}
return t.getFullYear() + "-" + e(t.getMonth() + 1) + "-" + e(t.getDate()) + " " + e(t.getHours()) + ":" + e(t.getMinutes()) + ":" + e(t.getSeconds()) + "." + e(t.getMilliseconds());
}, _.searchObjDate = function (t) {
_.isObject(t) && _.each(t, function (e, a) {
_.isObject(e) ? _.searchObjDate(t[a]) : _.isDate(e) && (t[a] = _.formatDate(e));
});
}, _.formatString = function (t) {
return t.length > sa.para.max_string_length ? (logger.info("\u5b57\u7b26\u4e32\u957f\u5ea6\u8d85\u8fc7\u9650\u5236\uff0c\u5df2\u7ecf\u505a\u622a\u53d6--" + t), t.slice(0, sa.para.max_string_length)) : t;
}, _.searchObjString = function (t) {
_.isObject(t) && _.each(t, function (e, a) {
_.isObject(e) ? _.searchObjString(t[a]) : _.isString(e) && (t[a] = _.formatString(e));
});
}, _.unique = function (t) {
for (var e, a = [], s = {}, r = 0; r < t.length; r++) (e = t[r]) in s || (s[e] = !0, a.push(e));
return a;
}, _.strip_sa_properties = function (t) {
return _.isObject(t) ? (_.each(t, function (e, a) {
if (_.isArray(e)) {
var s = [];
_.each(e, function (t) {
_.isString(t) ? s.push(t) : logger.info("\u60a8\u7684\u6570\u636e-", e, "\u7684\u6570\u7ec4\u91cc\u7684\u503c\u5fc5\u987b\u662f\u5b57\u7b26\u4e32,\u5df2\u7ecf\u5c06\u5176\u5220\u9664");
}), 0 !== s.length ? t[a] = s : (delete t[a], logger.info("\u5df2\u7ecf\u5220\u9664\u7a7a\u7684\u6570\u7ec4"));
}
_.isString(e) || _.isNumber(e) || _.isDate(e) || _.isBoolean(e) || _.isArray(e) || (logger.info("\u60a8\u7684\u6570\u636e-", e, "-\u683c\u5f0f\u4e0d\u6ee1\u8db3\u8981\u6c42\uff0c\u6211\u4eec\u5df2\u7ecf\u5c06\u5176\u5220\u9664"), delete t[a]);
}), t) : t;
}, _.strip_empty_properties = function (t) {
var e = {};
return _.each(t, function (t, a) {
null != t && (e[a] = t);
}), e;
}, _.utf8Encode = function (t) {
var e,
a,
s,
r,
n = "";
for (e = a = 0, s = (t = (t + "").replace(/\r\n/g, "\n").replace(/\r/g, "\n")).length, r = 0; r < s; r++) {
var i = t.charCodeAt(r),
o = null;
i < 128 ? a++ : o = i > 127 && i < 2048 ? String.fromCharCode(i >> 6 | 192, 63 & i | 128) : String.fromCharCode(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128), null !== o && (a > e && (n += t.substring(e, a)), n += o, e = a = r + 1);
}
return a > e && (n += t.substring(e, t.length)), n;
}, _.base64Encode = function (t) {
var e,
a,
s,
r,
n,
i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
o = 0,
c = 0,
u = "",
p = [];
if (!t) return t;
t = _.utf8Encode(t);
do {
e = (n = t.charCodeAt(o++) << 16 | t.charCodeAt(o++) << 8 | t.charCodeAt(o++)) >> 18 & 63, a = n >> 12 & 63, s = n >> 6 & 63, r = 63 & n, p[c++] = i.charAt(e) + i.charAt(a) + i.charAt(s) + i.charAt(r);
} while (o < t.length);
switch (u = p.join(""), t.length % 3) {
case 1:
u = u.slice(0, -2) + "==";
break;
case 2:
u = u.slice(0, -1) + "=";
}
return u;
}, _.getCurrentPath = function () {
var t = "\u672a\u53d6\u5230";
try {
var e = getCurrentPages();
t = e[e.length - 1].route;
} catch (t) {
logger.info(t);
}
return t;
}, _.getCurrentUrl = function (t) {
var e = _.getCurrentPath(),
a = "";
return _.isObject(t) && t.sensors_mp_encode_url_query && (a = t.sensors_mp_encode_url_query), e ? a ? e + "?" + a : e : "\u672a\u53d6\u5230";
}, _.getPath = function (t) {
return t = "string" == typeof t ? t.replace(/^\//, "") : "\u53d6\u503c\u5f02\u5e38";
}, _.getMethods = function (t) {
var e = [];
for (var a in t) "function" != typeof t[a] || mpHook[a] || e.push(a);
return e;
}, _.isClick = function (t) {
return !!{
tap: 1,
longpress: 1,
longtap: 1
}[t];
}, sa.initialState = {
queue: [],
isComplete: !1,
systemIsComplete: !1,
storeIsComplete: !1,
checkIsComplete: function () {
this.systemIsComplete && this.storeIsComplete && (this.isComplete = !0, this.queue.length > 0 && (_.each(this.queue, function (t) {
sa[t[0]].apply(sa, slice.call(t[1]));
}), this.queue = []));
}
}, _.getCustomUtmFromQuery = function (t, e, a, s) {
if (!_.isObject(t)) return {};
var r = {};
if (t.sa_utm) for (var n in t) "sa_utm" !== n ? _.include(sa.para.source_channel, n) && (r[a + n] = t[n]) : r[s + n] = t[n];else for (var n in t) -1 === (" " + source_channel_standard + " ").indexOf(" " + n + " ") ? _.include(sa.para.source_channel, n) && (r[a + n] = t[n]) : r[e + n] = t[n];
return r;
}, _.getObjFromQuery = function (t) {
var e = t.split("?"),
a = [],
s = {};
return e && e[1] ? (_.each(e[1].split("&"), function (t) {
(a = t.split("="))[0] && a[1] && (s[a[0]] = a[1]);
}), s) : {};
}, _.setStorageSync = function (t, e) {
var a = function () {
wx.setStorageSync(t, e);
};
try {
a();
} catch (t) {
logger.info("set Storage fail --", t);
try {
a();
} catch (t) {
logger.info("set Storage fail again --", t);
}
}
}, _.getStorageSync = function (t) {
var e = "";
try {
e = wx.getStorageSync(t);
} catch (a) {
try {
e = wx.getStorageSync(t);
} catch (t) {
logger.info("getStorage fail");
}
}
return e;
}, _.getMPScene = function (t) {
return "number" == typeof t || "string" == typeof t && "" !== t ? (t = String(t), mp_scene[t] || t) : "\u672a\u53d6\u5230\u503c";
}, _.setShareInfo = function (t, e) {
var a = {},
s = {},
r = sa.store.getDistinctId(),
n = sa.store.getFirstId();
if (!(t && _.isObject(t.query) && t.query.sampshare)) return {};
if (a = _.decodeURIComponent(t.query.sampshare), !_.isJSONString(a)) return {};
var i = (a = JSON.parse(a)).d,
o = a.p,
c = a.i;
"string" == typeof c ? (e.$share_distinct_id = c, share_distinct_id = c, s.$latest_share_distinct_id = c) : e.$share_distinct_id = "\u53d6\u503c\u5f02\u5e38", "number" == typeof i ? !share_distinct_id || share_distinct_id !== r && share_distinct_id !== n ? !share_distinct_id || share_distinct_id === r && share_distinct_id === n ? e.$share_depth = "-1" : (e.$share_depth = i + 1, query_share_depth = i + 1, s.$latest_share_depth = i + 1) : (e.$share_depth = i, query_share_depth = i, s.$latest_share_depth = i) : e.$share_depth = "-1", "string" == typeof o ? (e.$share_url_path = o, s.$latest_share_url_path = o) : e.$share_url_path = "\u53d6\u503c\u5f02\u5e38", _.setLatestShare(s);
}, _.getShareInfo = function () {
return JSON.stringify({
i: sa.store.getDistinctId() || "\u53d6\u503c\u5f02\u5e38",
p: _.getCurrentPath(),
d: query_share_depth
});
}, _.detectOptionQuery = function (t) {
if (!t || !_.isObject(t.query)) return {};
var e,
a,
s,
r,
n = {};
return n.query = _.extend({}, t.query), "string" == typeof n.query.scene && (e = n.query, a = ["utm_source", "utm_content", "utm_medium", "utm_campaign", "utm_term", "sa_utm"].concat(sa.para.source_channel), s = new RegExp("(" + a.join("|") + ")%3D", "i"), 1 === (r = Object.keys(e)).length && "scene" === r[0] && s.test(e.scene)) && (n.scene = n.query.scene, delete n.query.scene), t.query.q && t.query.scancode_time && "101" === String(t.scene).slice(0, 3) && (n.q = String(n.query.q), delete n.query.q, delete n.query.scancode_time), n;
}, _.getMixedQuery = function (t) {
var e = _.detectOptionQuery(t),
a = e.scene,
s = e.q,
r = e.query;
for (var n in r) r[n] = _.decodeURIComponent(r[n]);
return a && (a = -1 !== (a = _.decodeURIComponent(a)).indexOf("?") ? "?" + a.replace(/\?/g, "") : "?" + a, _.extend(r, _.getObjFromQuery(a))), s && _.extend(r, _.getObjFromQuery(_.decodeURIComponent(s))), r;
}, _.setUtm = function (t, e) {
var a = {},
s = _.getMixedQuery(t),
r = _.getCustomUtmFromQuery(s, "$", "_", "$"),
n = _.getCustomUtmFromQuery(s, "$latest_", "_latest_", "$latest_");
return a.pre1 = r, a.pre2 = n, _.extend(e, r), a;
}, _.wxrequest = function (t) {
var e = wx.request(t);
setTimeout(function () {
_.isObject(e) && _.isFunction(e.abort) && e.abort();
}, sa.para.datasend_timeout);
}, _.info = {
currentProps: {},
properties: {
$lib: LIB_NAME,
$lib_version: String(LIB_VERSION)
},
getSystem: function () {
var t = this.properties;
function e() {
wx.getSystemInfo({
success: function (e) {
var a, s;
t.$manufacturer = e.brand, t.$model = e.model, t.$screen_width = Number(e.screenWidth), t.$screen_height = Number(e.screenHeight), t.$os = (a = e.platform, "ios" === (s = a.toLowerCase()) ? "iOS" : "android" === s ? "Android" : a), t.$os_version = e.system.indexOf(" ") > -1 ? e.system.split(" ")[1] : e.system;
},
complete: function () {
sa.initialState.systemIsComplete = !0, sa.initialState.checkIsComplete();
}
});
}
wx.getNetworkType({
success: function (e) {
t.$network_type = e.networkType;
},
complete: e
});
}
}, sa._ = _, sa.prepareData = function (t, e) {
var a = {
distinct_id: this.store.getDistinctId(),
lib: {
$lib: LIB_NAME,
$lib_method: "code",
$lib_version: String(LIB_VERSION)
},
properties: {}
};
_.extend(a, this.store.getUnionId(), t), _.isObject(t.properties) && !_.isEmptyObject(t.properties) && _.extend(a.properties, t.properties), t.type && "profile" === t.type.slice(0, 7) || (sa.para.batch_send && (a._track_id = Number(String(Math.random()).slice(2, 5) + String(Math.random()).slice(2, 4) + String(Date.now()).slice(-4))), a.properties = _.extend({}, _.info.properties, sa.store.getProps(), _.info.currentProps, a.properties), "object" == typeof sa.store._state && "number" == typeof sa.store._state.first_visit_day_time && sa.store._state.first_visit_day_time > new Date().getTime() ? a.properties.$is_first_day = !0 : a.properties.$is_first_day = !1), a.properties.$time && _.isDate(a.properties.$time) ? (a.time = 1 * a.properties.$time, delete a.properties.$time) : sa.para.use_client_time && (a.time = 1 * new Date()), _.searchObjDate(a), _.searchObjString(a), logger.info(a), sa.sendStrategy.send(a);
}, sa.store = {
verifyDistinctId: function (t) {
return "number" == typeof t && (t = String(t), /^\d+$/.test(t) || (t = "unexpected_id")), "string" == typeof t && "" !== t || (t = "unexpected_id"), t;
},
storageInfo: null,
getUUID: function () {
return Date.now() + "-" + Math.floor(1e7 * Math.random()) + "-" + Math.random().toString(16).replace(".", "") + "-" + String(31242 * Math.random()).replace(".", "").slice(0, 8);
},
getStorage: function () {
return this.storageInfo ? this.storageInfo : (this.storageInfo = sa._.getStorageSync("sensorsdata2015_wechat") || "", this.storageInfo);
},
_state: {},
mem: {
mdata: [],
getLength: function () {
return this.mdata.length;
},
add: function (t) {
this.mdata.push(t);
},
clear: function (t) {
this.mdata.splice(0, t);
}
},
toState: function (t) {
var e = null;
_.isJSONString(t) ? (e = JSON.parse(t)).distinct_id ? this._state = e : this.set("distinct_id", this.getUUID()) : _.isObject(t) && (e = t).distinct_id ? this._state = e : this.set("distinct_id", this.getUUID());
},
getFirstId: function () {
return this._state._first_id || this._state.first_id;
},
getDistinctId: function () {
return this._state._distinct_id || this._state.distinct_id;
},
getUnionId: function () {
var t = {},
e = this._state._first_id || this._state.first_id,
a = this._state._distinct_id || this._state.distinct_id;
return e && a ? (t.login_id = a, t.anonymous_id = e) : t.anonymous_id = a, t;
},
getProps: function () {
return this._state.props || {};
},
setProps: function (t, e) {
var a = this._state.props || {};
e ? this.set("props", t) : (_.extend(a, t), this.set("props", a));
},
set: function (t, e) {
var a = {};
for (var s in "string" == typeof t ? a[t] = e : "object" == typeof t && (a = t), this._state = this._state || {}, a) this._state[s] = a[s], "first_id" === s ? delete this._state._first_id : "distinct_id" === s && delete this._state._distinct_id;
this.save();
},
change: function (t, e) {
this._state["_" + t] = e;
},
save: function () {
var t = JSON.parse(JSON.stringify(this._state));
delete t._first_id, delete t._distinct_id, sa._.setStorageSync("sensorsdata2015_wechat", t);
},
init: function () {
var t = this.getStorage();
if (t) this.toState(t);else {
is_first_launch = !0;
var e = new Date(),
a = e.getTime();
e.setHours(23), e.setMinutes(59), e.setSeconds(60), sa.setOnceProfile({
$first_visit_time: new Date()
}), this.set({
distinct_id: this.getUUID(),
first_visit_time: a,
first_visit_day_time: e.getTime()
});
}
}
}, sa.setProfile = function (t, e) {
sa.prepareData({
type: "profile_set",
properties: t
}, e);
}, sa.setOnceProfile = function (t, e) {
sa.prepareData({
type: "profile_set_once",
properties: t
}, e);
}, sa.appendProfile = function (t, e) {
if (!_.isObject(t)) return !1;
_.each(t, function (e, a) {
_.isString(e) ? t[a] = [e] : _.isArray(e) || (delete t[a], logger.info("appendProfile\u5c5e\u6027\u7684\u503c\u5fc5\u987b\u662f\u5b57\u7b26\u4e32\u6216\u8005\u6570\u7ec4"));
}), sa.prepareData({
type: "profile_append",
properties: t
}, e);
}, sa.incrementProfile = function (t, e) {
if (!_.isObject(t)) return !1;
var a = t;
_.isString(t) && ((t = {})[a] = 1), sa.prepareData({
type: "profile_increment",
properties: t
}, e);
}, sa.track = function (t, e, a) {
this.prepareData({
type: "track",
event: t,
properties: e
}, a);
}, sa.identify = function (t, e) {
if ("string" != typeof t && "number" != typeof t) return !1;
t = sa.store.verifyDistinctId(t);
var a = sa.store.getFirstId();
!0 === e ? a ? sa.store.set("first_id", t) : sa.store.set("distinct_id", t) : a ? sa.store.change("first_id", t) : sa.store.change("distinct_id", t);
}, sa.trackSignup = function (t, e, a, s) {
var r = sa.store.getFirstId() || sa.store.getDistinctId();
sa.store.set("distinct_id", t), sa.prepareData({
original_id: r,
distinct_id: t,
type: "track_signup",
event: e,
properties: a
}, s);
}, sa.registerApp = function (t) {
_.isObject(t) && !_.isEmptyObject(t) && (_.info.currentProps = _.extend(_.info.currentProps, t));
}, sa.register = function (t) {
_.isObject(t) && !_.isEmptyObject(t) && sa.store.setProps(t);
}, sa.clearAllRegister = function () {
sa.store.setProps({}, !0);
}, sa.clearAllProps = function (t) {
var e = sa.store.getProps(),
a = {};
_.isArray(t) && (_.each(e, function (e, s) {
_.include(t, s) || (a[s] = e);
}), sa.store.setProps(a, !0));
}, sa.clearAppRegister = function (t) {
_.isArray(t) && _.each(_.info.currentProps, function (e, a) {
_.include(t, a) && delete _.info.currentProps[a];
});
}, _.setLatestChannel = function (t) {
_.isEmptyObject(t) || (function (t, e) {
var a = !1;
for (var s in e) t[e[s]] && (a = !0);
return a;
}(t, latest_source_channel) && (sa.clearAppRegister(latest_source_channel), sa.clearAllProps(latest_source_channel)), sa.para.is_persistent_save.utm ? sa.register(t) : sa.registerApp(t));
}, _.setLatestShare = function (t) {
(t.$latest_share_depth || t.$latest_share_distinct_id || t.$latest_share_url_path) && (sa.clearAppRegister(latest_share_info), sa.clearAllProps(latest_share_info), sa.para.is_persistent_save.share ? sa.register(t) : sa.registerApp(t));
}, sa.login = function (t) {
if ("string" != typeof t && "number" != typeof t) return !1;
t = sa.store.verifyDistinctId(t);
var e = sa.store.getFirstId(),
a = sa.store.getDistinctId();
t !== a && (e ? sa.trackSignup(t, "$SignUp") : (sa.store.set("first_id", a), sa.trackSignup(t, "$SignUp")));
}, sa.logout = function (t) {
var e = sa.store.getFirstId();
e ? (sa.store.set("first_id", ""), !0 === t ? sa.store.set("distinct_id", sa.store.getUUID()) : sa.store.set("distinct_id", e)) : logger.info("\u6ca1\u6709first_id\uff0clogout\u5931\u8d25");
}, sa.openid = {
getRequest: function (t) {
wx.login({
success: function (e) {
e.code && sa.para.appid && sa.para.openid_url ? _.wxrequest({
url: sa.para.openid_url + "&code=" + e.code + "&appid=" + sa.para.appid,
method: "GET",
complete: function (e) {
_.isObject(e) && _.isObject(e.data) && e.data.openid ? t(e.data.openid) : t();
}
}) : t();
}
});
},
getWXStorage: function () {
var t = sa.store.getStorage();
if (t && _.isObject(t)) return t.openid;
},
getOpenid: function (t) {
if (!sa.para.appid) return t(), !1;
var e = this.getWXStorage();
e ? t(e) : this.getRequest(t);
}
}, sa.initial = function () {
this._.info.getSystem(), this.store.init();
}, sa.init = function (t) {
if (!0 === this.hasInit) return !1;
this.hasInit = !0, sa.setPara(t), sa.para.batch_send && (wx.getStorage({
key: "sensors_mp_prepare_data",
complete(t) {
var e = t.data && _.isArray(t.data) ? t.data : [];
sa.store.mem.mdata = e.concat(sa.store.mem.mdata), sa.sendStrategy.syncStorage = !0;
}
}), sa.sendStrategy.batchInterval()), sa.initialState.storeIsComplete = !0, sa.initialState.checkIsComplete();
}, sa.getPresetProperties = function () {
if (_.info && _.info.properties && _.info.properties.$lib) {
var t = {};
_.each(_.info.currentProps, function (e, a) {
0 === a.indexOf("$") && (t[a] = e);
});
var e = _.extend(t, {
$url_path: _.getCurrentPath()
}, _.info.properties, sa.store.getProps());
return delete e.$lib, e;
}
return {};
}, _.autoExeQueue = function () {
return {
items: [],
enqueue: function (t) {
this.items.push(t), this.start();
},
dequeue: function () {
return this.items.shift();
},
getCurrentItem: function () {
return this.items[0];
},
isRun: !1,
start: function () {
this.items.length > 0 && !this.isRun && (this.isRun = !0, this.getCurrentItem().start());
},
close: function () {
this.dequeue(), this.isRun = !1, this.start();
}
};
}, sa.requestQueue = function (t) {
this.url = t.url;
}, sa.requestQueue.prototype.isEnd = function () {
this.received || (this.received = !0, this.close());
}, sa.requestQueue.prototype.start = function () {
var t = this;
setTimeout(function () {
t.isEnd();
}, sa.para.send_timeout), _.wxrequest({
url: this.url,
method: "GET",
complete: function () {
t.isEnd();
}
});
}, sa.dataQueue = _.autoExeQueue(), sa.sendStrategy = {
dataHasSend: !0,
dataHasChange: !1,
syncStorage: !1,
failTime: 0,
onAppHide: function () {
sa.para.batch_send && this.batchSend();
},
send: function (t) {
if (!sa.para.server_url) return !1;
if (sa.para.batch_send) {
if (this.dataHasChange = !0, sa.store.mem.getLength() >= 300) return logger.info("\u6570\u636e\u91cf\u5b58\u50a8\u8fc7\u5927\uff0c\u6709\u5f02\u5e38"), !1;
sa.store.mem.add(t), sa.store.mem.getLength() >= sa.para.batch_send.max_length && this.batchSend();
} else this.queueSend(t);
},
queueSend: function (t) {
t = JSON.stringify(t), t = -1 !== sa.para.server_url.indexOf("?") ? sa.para.server_url + "&data=" + encodeURIComponent(_.base64Encode(t)) : sa.para.server_url + "?data=" + encodeURIComponent(_.base64Encode(t));
var e = new sa.requestQueue({
url: t
});
e.close = function () {
sa.dataQueue.close();
}, sa.dataQueue.enqueue(e);
},
wxrequest: function (t) {
if (_.isArray(t.data) && t.data.length > 0) {
var e = Date.now();
t.data.forEach(function (t) {
t._flush_time = e;
}), t.data = JSON.stringify(t.data), _.wxrequest({
url: sa.para.server_url,
method: "POST",
dataType: "text",
data: "data_list=" + encodeURIComponent(_.base64Encode(t.data)),
success: function () {
t.success(t.len);
},
fail: function () {
t.fail();
}
});
} else t.success(t.len);
},
batchSend: function () {
if (this.dataHasSend) {
var t = sa.store.mem.mdata,
e = t.length;
e > 0 && (this.dataHasSend = !1, this.wxrequest({
data: t,
len: e,
success: this.batchRemove.bind(this),
fail: this.sendFail.bind(this)
}));
}
},
sendFail: function () {
this.dataHasSend = !0, this.failTime++;
},
batchRemove: function (t) {
sa.store.mem.clear(t), this.dataHasSend = !0, this.dataHasChange = !0, this.batchWrite(), this.failTime = 0;
},
is_first_batch_write: !0,
batchWrite: function () {
var t = this;
this.dataHasChange && (this.is_first_batch_write && (this.is_first_batch_write = !1, setTimeout(function () {
t.batchSend();
}, 1e3)), this.dataHasChange = !1, this.syncStorage && sa._.setStorageSync("sensors_mp_prepare_data", sa.store.mem.mdata));
},
batchInterval: function () {
var t = this;
!function e() {
setTimeout(function () {
t.batchWrite(), e();
}, 500);
}(), function e() {
setTimeout(function () {
t.batchSend(), e();
}, sa.para.batch_send.send_timeout * Math.pow(2, t.failTime));
}();
}
}, sa.setOpenid = function (t, e) {
sa.store.set("openid", t), e ? sa.store.set("distinct_id", t) : sa.identify(t, !0);
}, sa.initWithOpenid = function (t, e) {
(t = t || {}).appid && (sa.para.appid = t.appid), sa.openid.getOpenid(function (a) {
a && sa.setOpenid(a, t.isCoverLogin), e && _.isFunction(e) && e(a), sa.init(t);
});
}, _.each(["setProfile", "setOnceProfile", "track", "quick", "incrementProfile", "appendProfile", "login", "logout"], function (t) {
var e = sa[t];
sa[t] = function () {
sa.initialState.isComplete ? e.apply(sa, arguments) : sa.initialState.queue.push([t, arguments]);
};
}), _.setQuery = function (t, e) {
if (t && _.isObject(t) && !_.isEmptyObject(t)) {
var a = [];
return _.each(t, function (t, s) {
"q" === s && _.isString(t) && 0 === t.indexOf("http") || "scene" === s || (e ? a.push(s + "=" + t) : a.push(s + "=" + _.decodeURIComponent(t)));
}), a.join("&");
}
return "";
}, _.getUtmFromPage = function () {
var t = {};
try {
var e = getCurrentPages(),
a = e[e.length - 1].options;
t = _.getCustomUtmFromQuery(a, "$", "_", "$");
} catch (t) {
logger.info(t);
}
return t;
}, sa.autoTrackCustom = {
trackCustom: function (t, e, a) {
var s = sa.para.autoTrack[t],
r = "";
sa.para.autoTrack && s && ("function" == typeof s ? (r = s(), _.isObject(r) && _.extend(e, r)) : _.isObject(s) && (_.extend(e, s), sa.para.autoTrack[t] = !0), sa.track(a, e));
},
appLaunch: function (t, e) {
"object" != typeof this || this.trackCustom || (this[sa.para.name] = sa);
var a = {};
t && t.path && (a.$url_path = _.getPath(t.path)), _.setShareInfo(t, a);
var s = _.setUtm(t, a);
is_first_launch ? (a.$is_first_time = !0, _.isEmptyObject(s.pre1) || sa.setOnceProfile(s.pre1)) : a.$is_first_time = !1, _.setLatestChannel(s.pre2), a.$scene = _.getMPScene(t.scene), sa.registerApp({
$latest_scene: a.$scene
}), a.$url_query = _.setQuery(t.query), e ? (a = _.extend(a, e), sa.track("$MPLaunch", a)) : sa.para.autoTrack && sa.para.autoTrack.appLaunch && sa.autoTrackCustom.trackCustom("appLaunch", a, "$MPLaunch");
},
appShow: function (t, e) {
var a = {};
mpshow_time = new Date().getTime(), t && t.path && (a.$url_path = _.getPath(t.path)), _.setShareInfo(t, a);
var s = _.setUtm(t, a);
_.setLatestChannel(s.pre2), a.$scene = _.getMPScene(t.scene), sa.registerApp({
$latest_scene: a.$scene
}), a.$url_query = _.setQuery(t.query), e ? (a = _.extend(a, e), sa.track("$MPShow", a)) : sa.para.autoTrack && sa.para.autoTrack.appShow && sa.autoTrackCustom.trackCustom("appShow", a, "$MPShow");
},
appHide: function (t) {
var e = new Date().getTime(),
a = {};
a.$url_path = _.getCurrentPath(), mpshow_time && e - mpshow_time > 0 && (e - mpshow_time) / 36e5 < 24 && (a.event_duration = (e - mpshow_time) / 1e3), t ? (a = _.extend(a, t), sa.track("$MPHide", a)) : sa.para.autoTrack && sa.para.autoTrack.appHide && sa.autoTrackCustom.trackCustom("appHide", a, "$MPHide"), sa.sendStrategy.onAppHide();
},
pageLoad: function (t) {
t && _.isObject(t) && (this.sensors_mp_url_query = _.setQuery(t), this.sensors_mp_encode_url_query = _.setQuery(t, !0));
},
pageShow: function () {
var t = {},
e = _.getCurrentPath();
t.$referrer = sa_referrer, t.$url_path = e, sa.status.last_referrer = sa_referrer, t.$url_query = this.sensors_mp_url_query ? this.sensors_mp_url_query : "", t = _.extend(t, _.getUtmFromPage()), sa.para.onshow ? sa.para.onshow(sa, e, this) : sa.para.autoTrack && sa.para.autoTrack.pageShow && sa.autoTrackCustom.trackCustom("pageShow", t, "$MPViewScreen"), sa_referrer = e, sa.status.referrer = e;
},
pageShare: function (t, e) {
var a = t.onShareAppMessage;
t.onShareAppMessage = function () {
var t = a.apply(this, arguments);
return sa.para.autoTrack && sa.para.autoTrack.pageShare && sa.autoTrackCustom.trackCustom("pageShare", {
$url_path: _.getCurrentPath(),
$share_depth: query_share_depth
}, "$MPShare"), sa.para.allow_amend_share_path && ("object" != typeof t && ((t = {}).path = _.getCurrentUrl(this)), "object" != typeof t || void 0 !== t.path && "" !== t.path || (t.path = _.getCurrentUrl(this)), "object" == typeof t && "string" == typeof t.path && (-1 === t.path.indexOf("?") ? t.path = t.path + "?" : "&" !== t.path.slice(-1) && (t.path = t.path + "&")), t.path = t.path + "sampshare=" + encodeURIComponent(_.getShareInfo())), t;
};
}
}, sa.quick = function () {
var t = arguments[0],
e = arguments[1],
a = arguments[2],
s = _.isObject(a) ? a : {};
if ("getAnonymousID" === t) {
if (!_.isEmptyObject(sa.store._state)) return sa.store._state._first_id || sa.store._state.first_id || sa.store._state._distinct_id || sa.store._state.distinct_id;
logger.info("\u8bf7\u5148\u521d\u59cb\u5316SDK");
} else "appLaunch" === t || "appShow" === t ? e ? sa.autoTrackCustom[t](e, s) : logger.info("App\u7684launch\u548cshow\uff0c\u5728sensors.quick\u7b2c\u4e8c\u4e2a\u53c2\u6570\u5fc5\u987b\u4f20\u5165App\u7684options\u53c2\u6570") : "appHide" === t && (s = _.isObject(e) ? e : {}, sa.autoTrackCustom[t](s));
}, sa.App = function (t) {
mp_proxy(t = t || {}, "onLaunch", "appLaunch"), mp_proxy(t, "onShow", "appShow"), mp_proxy(t, "onHide", "appHide");
}, sa.Page = function (t) {
var e = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(t);
if (e) for (var a = 0, s = e.length; a < s; a++) click_proxy(t, e[a]);
mp_proxy(t, "onLoad", "pageLoad"), mp_proxy(t, "onShow", "pageShow"), "function" == typeof t.onShareAppMessage && sa.autoTrackCustom.pageShare(t);
}, sa.Component = function (t) {
try {
var e = sa.para.autoTrack && sa.para.autoTrack.mpClick && _.getMethods(t.methods);
if (e) for (var a = 0, s = e.length; a < s; a++) click_proxy(t.methods, e[a]);
mp_proxy(t.methods, "onLoad", "pageLoad"), mp_proxy(t.methods, "onShow", "pageShow"), "function" == typeof t.methods.onShareAppMessage && sa.autoTrackCustom.pageShare(t.methods);
} catch (t) {}
}, sa.initial();
sa.setPara({
server_url: "https://analytics.tuhu.com/sa?project=production"
});
if (isFunction(Page.intercept)) {
Page.intercept(function (e) {
sa.Page(e);
return e;
});
}
if (isFunction(App.intercept)) {
App.intercept(function (e) {
sa.App(e);
return e;
});
}
if (isFunction(Component.intercept)) {
Component.intercept(function (e) {
sa.Component(e);
return e;
});
}
extendSensors(sa);
return sa;
}
/**
* 扩展神策
*/
function extendSensors(sa) {
const track = sa.track;
const DynamicProperties = [];
sa.track = function (evtname, metadata) {
const extendMetadata = DynamicProperties.reduce((obj, func) => {
return Object.assign(obj, func() || {});
}, {});
track.call(sa, evtname, Object.assign(metadata, extendMetadata));
}; // 设置动态公共属性
sa.registerDynamicSuperProperties = function (func) {
DynamicProperties.push(func);
};
}
function isFunction(func) {
return typeof func === 'function';
}
module.exports = Sensors;
module.exports.default = Sensors;

13

package.json
{
"name": "@tuhu/mp-sensor",
"version": "0.0.7",
"version": "0.1.0",
"main": "lib/index.js",

@@ -8,8 +8,13 @@ "license": "MIT",

"scripts": {
"build": "parcel build src/index.js -d lib --no-source-maps --experimental-scope-hoisting",
"dev": "parcel watch src/index.js -d lib",
"build": "gulp",
"dev": "gulp watch",
"prepublishOnly": "rm -rf lib && npm run build"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@types/jest": "^25.2.1",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-cli": "^2.2.0",
"gulp-include": "^2.4.1",
"jest": "^25.3.0",

@@ -24,3 +29,3 @@ "miniprogram-simulate": "^1.1.6",

],
"gitHead": "4af50737f4a270177f97274b48c392d074926770"
"gitHead": "cb418aade9407598dc496d97c98e8af22bb02a1e"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc