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

a-tracker

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-tracker - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

120

m.js

@@ -7,4 +7,5 @@ let initFlag = false; // 初始化完成标记

let mustKeys = ['seedId', 'actionId']; // remoteLog 必传参数
let _extParams = {};
let _extParams = {}
/**

@@ -24,4 +25,4 @@ * track('clickseedname', { bizType: 'Pay', ext: { productId: 'xxx' } })

param3: 'string',
param4: 'string'
};
param4: 'string',
}

@@ -31,4 +32,4 @@ function logParamsCheck(options) {

if (!options[mustKeys[i]]) {
console.warn(`[mas] ${mustKeys[i]}不能为空`);
return true;
console.warn(`[mas] ${mustKeys[i]}不能为空`)
return true
}

@@ -52,12 +53,12 @@ }

ext: {}
};
Object.keys(eventData).forEach((key) => {
}
Object.keys(eventData).forEach(key => {
if (paramsType[key]) {
_evtData[key] = eventData[key];
_evtData[key] = eventData[key]
} else {
_evtData.ext[key] = eventData[key];
_evtData.ext[key] = eventData[key]
}
});
})
sendLog(eventId, _evtData);
sendLog(eventId, _evtData)
}

@@ -67,22 +68,22 @@

* sendLog('payclick', { actionId: 'click', bizType: 'alipay', ext: {a: 1, b: 2} })
* @param {*} eventId
* @param {*} eventData
* @returns
* @param {*} eventId
* @param {*} eventData
* @returns
*/
function sendLog(eventId, eventData = {}) {
if (!eventId) {
console.warn(`[mas] eventId 不能为空`);
return;
console.warn(`[mas] eventId 不能为空`)
return
}
var { ext = {}, actionId, bizType } = options;
if (!actionId) {
console.warn(`[mas] actionId 不能为空`);
console.warn(`[mas] actionId 不能为空`)
// return
}
let options = {};
Object.keys(eventData).forEach((key) => {
let options = {}
Object.keys(eventData).forEach(key => {
if (paramsType[key] && paramsType[key] === typeof eventData[key]) {
options[key] = eventData[key];
options[key] = eventData[key]
}
});
})
_remoteLog({

@@ -93,15 +94,15 @@ ...options,

bizType,
param4: _formatExtParams(Object.assign(_extParams, ext))
});
param4: _formatExtParams(Object.assign(_extParams, ext)),
})
}
function _remoteLog(options) {
let apiObj = options;
let apiObj = options
// Object.assign(apiObj, options);
if (mtrDebug) {
console.log(logTag, 'remoteLog', apiObj);
console.log(logTag, "remoteLog", apiObj)
}
// #ifdef H5
jsBridgeReady(function () {
jsBridgeReady(function() {
AlipayJSBridge.call('remoteLog', apiObj);

@@ -111,3 +112,3 @@ });

// #ifdef MP-ALIPAY
my.call('remoteLog', apiObj);
my.call("remoteLog", apiObj);
// #endif

@@ -118,31 +119,36 @@ }

let n = [];
bizScenario && n.push('mBizScenario='.concat(encodeStr(bizScenario)));
bizScenario &&
n.push(
"mBizScenario=".concat(encodeStr(bizScenario))
);
// #ifdef MP-ALIPAY
n.push('id='.concat(encodeStr(id)));
n.push(
"id=".concat(encodeStr(id))
);
// #endif
Object.keys(t).forEach(function (e) {
n.push(''.concat(e, '=').concat(encodeStr(t[e])));
n.push("".concat(e, "=").concat(encodeStr(t[e])));
});
return n.join(',');
return n.join(',')
}
function encodeStr(e) {
return 'string' == typeof e
? e.replace(/=|,|\^|\$\$/g, function (e) {
switch (e) {
case ',':
return '%2C';
case '^':
return '%5E';
case '$$':
return '%24%24';
case '=':
return '%3D';
case '&&':
return '%26%26';
default:
return ' ';
}
})
: e;
return "string" == typeof e
? e.replace(/=|,|\^|\$\$/g, function (e) {
switch (e) {
case ",":
return "%2C";
case "^":
return "%5E";
case "$$":
return "%24%24";
case "=":
return "%3D";
case "&&":
return "%26%26";
default:
return " ";
}
})
: e;
}

@@ -153,3 +159,3 @@

if (!initFlag) {
console.warn('[mas] 请先执行埋点初始化方法init');
console.warn("[mas] 请先执行埋点初始化方法init");
return;

@@ -159,7 +165,7 @@ }

sendLog(eventId, options);
};
}
},
init(conf = {}) {
// conf: mtrDebug, bizScenario, id
if (typeof conf.mtrDebug === 'boolean') mtrDebug = conf.mtrDebug;
if(typeof conf.mtrDebug === "boolean") mtrDebug = conf.mtrDebug;
// #ifdef MP-ALIPAY

@@ -171,3 +177,3 @@ if (conf.id) {

console.warn('[mas] 小程序id不能为空');
return;
return
}

@@ -178,11 +184,11 @@ }

if (typeof conf.extendParams === 'object') {
_extParams = conf.extendParams;
_extParams = conf.extendParams
} else {
console.warn('[mas] extendParams 格式错误');
console.warn("[mas] extendParams 格式错误"));
}
}
bizScenario = conf.bizScenario;
initFlag = true;
}
};
}
{
"name": "a-tracker",
"version": "1.0.3",
"version": "1.0.4",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "https://github.com/joenix/a-tracker.git",

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