@alipay/ams-checkout 0.0.1733711101-dev.3 → 0.0.1733711101-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,29 +14,34 @@ export var LogComplianceProcessor = /*#__PURE__*/function () {
14
14
  key: "extractComplianceParams",
15
15
  value: function extractComplianceParams(eventName, params, errorLogCallback) {
16
16
  var _this = this;
17
- // 触发防抖上报
18
- logDebounceTracker.track(function () {
19
- _this.flushAbnormalInfo(errorLogCallback);
20
- });
21
- // 事件名检测
22
- var isSpmId = eventName.includes('.');
23
- if (!isSpmId) {
24
- // 非SPM,说明是未做映射的,需要加到埋点里面
25
- this.reportHasAbnormalEventName(eventName);
26
- }
27
- var newParams = {};
28
- // 逐个字段检查
29
- for (var _i = 0, _Object$keys = Object.keys(params); _i < _Object$keys.length; _i++) {
30
- var key = _Object$keys[_i];
31
- // 如果当前字段不在合规表中,说明是未合规字段,剔除并且上报异常
32
- if (key in LogComplianceExtendKeys.complianceExtParams) {
33
- newParams[key] = "".concat(params[key]);
34
- } else {
17
+ try {
18
+ // 触发防抖上报
19
+ logDebounceTracker.track(function () {
20
+ _this.flushAbnormalInfo(errorLogCallback);
21
+ });
22
+ // 事件名检测
23
+ var isSpmId = eventName ? eventName.includes('.') : false;
24
+ if (!isSpmId) {
25
+ // 非SPM,说明是未做映射的,需要加到埋点里面
26
+ this.reportHasAbnormalEventName(eventName);
27
+ }
28
+ var newParams = {};
29
+ // 逐个字段检查
30
+ for (var _i = 0, _Object$keys = Object.keys(params); _i < _Object$keys.length; _i++) {
31
+ var key = _Object$keys[_i];
35
32
  // 如果当前字段不在合规表中,说明是未合规字段,剔除并且上报异常
36
- this.reportHasIllegalExtendInfoKey(eventName, key);
33
+ if (key in LogComplianceExtendKeys.complianceExtParams) {
34
+ newParams[key] = "".concat(params[key]);
35
+ } else {
36
+ // 如果当前字段不在合规表中,说明是未合规字段,剔除并且上报异常
37
+ this.reportHasIllegalExtendInfoKey(eventName, key);
38
+ }
37
39
  }
40
+ return newParams;
41
+ } catch (error) {
42
+ console.error(error);
43
+ return {};
38
44
  }
39
- return newParams;
40
45
  }
41
46
  }, {
42
47
  key: "reportHasAbnormalEventName",
@@ -54,38 +59,43 @@ export var LogComplianceProcessor = /*#__PURE__*/function () {
54
59
  }, {
55
60
  key: "flushAbnormalInfo",
56
61
  value: function flushAbnormalInfo(errorLogCallback) {
57
- if (this.abnormalEventNameSet.size > 0) {
58
- // 不正常的事件名按|分割
59
- // Abnormal event use event name with divider "|"
60
- var abnormalEventNames = Array.from(this.abnormalEventNameSet).join('|');
62
+ try {
63
+ var _this$abnormalEventNa;
64
+ if (((_this$abnormalEventNa = this.abnormalEventNameSet) === null || _this$abnormalEventNa === void 0 ? void 0 : _this$abnormalEventNa.size) > 0) {
65
+ // 不正常的事件名按|分割
66
+ // Abnormal event use event name with divider "|"
67
+ var abnormalEventNames = Array.from(this.abnormalEventNameSet).join('|');
68
+ errorLogCallback && errorLogCallback({
69
+ title: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_NAME.spmId
70
+ }, {
71
+ eventAlias: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_NAME.alias,
72
+ errorMessage: abnormalEventNames
73
+ });
74
+ this.abnormalEventNameSet.clear();
75
+ }
76
+ // process nonComplianceEventKeys
77
+ // eg: if sdk_event_createComponent has key1,key2,key3
78
+ // sdk_event_createComponent>key1+key2+key3|otherEventName>key1+key2+key3
79
+ var nonComplianceEventKeysList = [];
80
+ if (Object.keys(this.nonComplianceEventKeys).length === 0) {
81
+ return;
82
+ }
83
+ for (var eventName in this.nonComplianceEventKeys) {
84
+ var keys = this.nonComplianceEventKeys[eventName];
85
+ var keyStr = "".concat(eventName, ">").concat(Array.from(keys).join('+'));
86
+ nonComplianceEventKeysList.push(keyStr);
87
+ }
88
+ var nonComplianceEventKeysLogString = nonComplianceEventKeysList.join('|');
61
89
  errorLogCallback && errorLogCallback({
62
- title: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_NAME.spmId
90
+ title: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_EXT_INFO.spmId
63
91
  }, {
64
- eventAlias: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_NAME.alias,
65
- errorMessage: abnormalEventNames
92
+ eventAlias: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_EXT_INFO.alias,
93
+ errorMessage: nonComplianceEventKeysLogString
66
94
  });
67
- this.abnormalEventNameSet.clear();
68
- }
69
- // process nonComplianceEventKeys
70
- // eg: if sdk_event_createComponent has key1,key2,key3
71
- // sdk_event_createComponent>key1+key2+key3|otherEventName>key1+key2+key3
72
- var nonComplianceEventKeysList = [];
73
- if (Object.keys(this.nonComplianceEventKeys).length === 0) {
74
- return;
75
- }
76
- for (var eventName in this.nonComplianceEventKeys) {
77
- var keys = this.nonComplianceEventKeys[eventName];
78
- var keyStr = "".concat(eventName, ">").concat(Array.from(keys).join('+'));
79
- nonComplianceEventKeysList.push(keyStr);
95
+ this.nonComplianceEventKeys = {};
96
+ } catch (error) {
97
+ console.error(error);
80
98
  }
81
- var nonComplianceEventKeysLogString = nonComplianceEventKeysList.join('|');
82
- errorLogCallback && errorLogCallback({
83
- title: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_EXT_INFO.spmId
84
- }, {
85
- eventAlias: KEYS.EVENT_SDK_ON_ABNORMAL_EVENT_EXT_INFO.alias,
86
- errorMessage: nonComplianceEventKeysLogString
87
- });
88
- this.nonComplianceEventKeys = {};
89
99
  }
90
100
  }]);
91
101
  return LogComplianceProcessor;
@@ -80,6 +80,7 @@ export var RequesterService = /*#__PURE__*/function () {
80
80
  errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
81
81
  errorCode = handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode;
82
82
  this.reportRequestTimeCost({
83
+ title: 'a3753.b101271.c388193.d521387',
83
84
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
84
85
  label: 'request',
85
86
  time: Date.now() - startTime,
@@ -95,6 +96,7 @@ export var RequesterService = /*#__PURE__*/function () {
95
96
  }));
96
97
  case 20:
97
98
  this.reportRequestTimeCost({
99
+ title: 'a3753.b101271.c388193.d521387',
98
100
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
99
101
  label: 'request',
100
102
  time: Date.now() - startTime,
@@ -116,6 +118,7 @@ export var RequesterService = /*#__PURE__*/function () {
116
118
  timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
117
119
  _errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
118
120
  this.reportRequestTimeCost({
121
+ title: 'a3753.b101271.c388193.d521387',
119
122
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
120
123
  label: 'request',
121
124
  time: Date.now() - startTime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1733711101-dev.3",
3
+ "version": "0.0.1733711101-dev.5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",