@alipay/ams-checkout 1.25.2 → 1.27.0

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.
Files changed (55) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.js +1 -1
  3. package/esm/component/component.popup.style.d.ts +2 -0
  4. package/esm/component/component.popup.style.js +15 -2
  5. package/esm/config/index.d.ts +7 -7
  6. package/esm/config/index.js +7 -7
  7. package/esm/constant/index.d.ts +4 -0
  8. package/esm/constant/index.js +4 -0
  9. package/esm/core/bus/index.d.ts +3 -3
  10. package/esm/core/bus/index.js +14 -14
  11. package/esm/core/component/appPreloadProcessing.js +2 -2
  12. package/esm/core/component/ckp/index.js +6 -3
  13. package/esm/core/component/element/index.js +5 -4
  14. package/esm/core/component/element/type.d.ts +3 -2
  15. package/esm/core/component/element/type.js +1 -0
  16. package/esm/core/component/index.js +6 -10
  17. package/esm/core/instance/index.js +3 -3
  18. package/esm/foundation/core/index.d.ts +1 -0
  19. package/esm/foundation/core/index.js +25 -12
  20. package/esm/foundation/product-processor/easysafepay/index.js +17 -16
  21. package/esm/foundation/service/api-bus/busManager.d.ts +3 -3
  22. package/esm/foundation/service/api-bus/busManager.js +14 -14
  23. package/esm/foundation/service/container/index.d.ts +2 -0
  24. package/esm/foundation/service/container/index.js +31 -1
  25. package/esm/foundation/service/event-center.d.ts +2 -2
  26. package/esm/foundation/service/event-center.js +9 -9
  27. package/esm/foundation/service/log/index.d.ts +2 -2
  28. package/esm/foundation/service/log/index.js +23 -8
  29. package/esm/foundation/service/log/keys.d.ts +13 -0
  30. package/esm/foundation/service/log/keys.js +103 -0
  31. package/esm/foundation/service/log/processor.d.ts +9 -0
  32. package/esm/foundation/service/log/processor.js +148 -0
  33. package/esm/foundation/service/log/types.d.ts +1 -1
  34. package/esm/foundation/service/requester/requester.js +3 -0
  35. package/esm/foundation/service/security/index.js +6 -8
  36. package/esm/foundation/utils/redirect_utils.js +1 -2
  37. package/esm/index.js +1 -1
  38. package/esm/plugin/applepay/component.js +10 -8
  39. package/esm/plugin/applepay/index.js +10 -6
  40. package/esm/plugin/applepay/service.js +24 -16
  41. package/esm/plugin/component/cashierApp.js +3 -3
  42. package/esm/plugin/component/channel.js +1 -1
  43. package/esm/plugin/component/component.popup.style.d.ts +8 -0
  44. package/esm/plugin/component/component.popup.style.js +22 -2
  45. package/esm/plugin/component/index.d.ts +2 -0
  46. package/esm/plugin/component/index.js +66 -27
  47. package/esm/plugin/paypal/index.js +1 -1
  48. package/esm/service/index.js +4 -2
  49. package/esm/util/getBackScheme.js +1 -2
  50. package/esm/util/index.js +4 -8
  51. package/esm/util/logger.d.ts +3 -3
  52. package/esm/util/logger.js +49 -13
  53. package/esm/util/spm-map.d.ts +172 -0
  54. package/esm/util/spm-map.js +172 -0
  55. package/package.json +1 -1
@@ -19,7 +19,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
20
  import { v4 as uuid } from 'uuid';
21
21
  import { sdkVersion } from "../../config";
22
- import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
22
+ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
23
23
  import { queryPaymentInfo, submitPayInfo } from "../../service";
24
24
  import { ComponentSignEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, DisplayTypeEnum, TargetEnum } from "../../types";
25
25
  import { getType, isJsonString, isPC } from "../../util";
@@ -110,7 +110,7 @@ var ComponentApp = /*#__PURE__*/function () {
110
110
  sdkVersion: sdkVersion,
111
111
  webAppVersion: this._appVersion,
112
112
  instanceId: this.AMSSDK._instanceId,
113
- storageId: this.AMSSDK._storageId,
113
+ deviceId: this.AMSSDK._storageId,
114
114
  // the better way to use md5 paymentSesionID
115
115
  renderDisplayType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.renderDisplayType,
116
116
  merchantId: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.clientId,
@@ -147,7 +147,7 @@ var ComponentApp = /*#__PURE__*/function () {
147
147
  this.AMSSDK.logger.logInfo({
148
148
  title: 'sdk_event_security_unneeded_scenarios'
149
149
  }, {
150
- product: product
150
+ productScene: product
151
151
  });
152
152
  }
153
153
  var securitySDK = this.AMSSDK._getSecuritySDKByProductScene({
@@ -180,15 +180,13 @@ var ComponentApp = /*#__PURE__*/function () {
180
180
  this.AMSSDK.logger.logInfo({
181
181
  title: 'sdk_event_securitySdkGetTokenSuccess'
182
182
  }, {
183
- deviceId: deviceId,
184
- time: time
183
+ eventMessage: time
185
184
  }).send();
186
185
  } else {
187
186
  this.AMSSDK.logger.logInfo({
188
187
  title: 'sdk_error_securitySdkGetTokenFailed'
189
188
  }, {
190
- deviceId: deviceId,
191
- time: time
189
+ eventMessage: time
192
190
  }).send();
193
191
  }
194
192
  }
@@ -309,8 +307,7 @@ var ComponentApp = /*#__PURE__*/function () {
309
307
  this.AMSSDK.logger.logInfo({
310
308
  title: 'sdk_event_createComponent'
311
309
  }, {
312
- version: productSceneVersion,
313
- product: this.AMSSDK.options.product
310
+ productScene: this.AMSSDK.options.product
314
311
  }).send();
315
312
  if (ComponentSignEnum.EASY_PAY_WALLET === this._componentSign) {
316
313
  if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
@@ -359,9 +356,11 @@ var ComponentApp = /*#__PURE__*/function () {
359
356
  if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
360
357
  onClickOutside = this.closeBtnFunc.bind(this);
361
358
  }
359
+ var closeBtnFunc = this.closeBtnFunc.bind(this);
362
360
  createMockup({
363
361
  platform: this.platform,
364
- onClickOutside: onClickOutside
362
+ onClickOutside: onClickOutside,
363
+ closeBtnFunc: closeBtnFunc
365
364
  });
366
365
  this.renderPopupLoading(renderParams);
367
366
  }
@@ -385,7 +384,6 @@ var ComponentApp = /*#__PURE__*/function () {
385
384
  this.AMSSDK.logger.logInfo({
386
385
  title: 'performance_optimization_preload'
387
386
  }, {
388
- componentSign: componentSign,
389
387
  productSceneVersion: productSceneVersion
390
388
  });
391
389
  }
@@ -642,8 +640,7 @@ var ComponentApp = /*#__PURE__*/function () {
642
640
  _this5.AMSSDK.logger.logInfo({
643
641
  title: 'sdk_event_sdkQuery'
644
642
  }, {
645
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
646
- requestBody: params
643
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
647
644
  }).send();
648
645
  queryPaymentInfo(params, {
649
646
  env: _this5.AMSSDK.options.env.environment,
@@ -657,8 +654,7 @@ var ComponentApp = /*#__PURE__*/function () {
657
654
  _this5.AMSSDK.logger.logInfo({
658
655
  title: 'sdk_event_sdkQueryEnd'
659
656
  }, {
660
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
661
- responseBody: res
657
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
662
658
  }).send();
663
659
  }).catch(function (err) {
664
660
  if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
@@ -673,7 +669,7 @@ var ComponentApp = /*#__PURE__*/function () {
673
669
  title: 'sdk_event_sdkQuery_failed'
674
670
  }, {
675
671
  paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
676
- errorReason: err
672
+ errorMessage: err
677
673
  }).send();
678
674
  reject(err);
679
675
  });
@@ -760,8 +756,7 @@ var ComponentApp = /*#__PURE__*/function () {
760
756
  _this6.AMSSDK.logger.logInfo({
761
757
  title: 'sdk_event_submitPay'
762
758
  }, {
763
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
764
- requestBody: params
759
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
765
760
  }).send();
766
761
  extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
767
762
  instanceId: _this6.AMSSDK._instanceId,
@@ -796,16 +791,14 @@ var ComponentApp = /*#__PURE__*/function () {
796
791
  _this6.AMSSDK.logger.logInfo({
797
792
  title: 'sdk_event_submitPayEnd'
798
793
  }, {
799
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
800
- responseBody: res
794
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
801
795
  }).send();
802
796
  resolve(res);
803
797
  }).catch(function (err) {
804
798
  _this6.AMSSDK.logger.logError({
805
799
  title: 'sdk_event_submitPay_failed'
806
800
  }, {
807
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
808
- responseBody: err
801
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
809
802
  }).send();
810
803
  resolve({
811
804
  success: false
@@ -881,8 +874,7 @@ var ComponentApp = /*#__PURE__*/function () {
881
874
  this.AMSSDK.logger.logError({
882
875
  title: 'performance_optimization_preload_path_error'
883
876
  }, {
884
- path: path,
885
- locationSearch: locationSearch
877
+ eventMessage: path
886
878
  });
887
879
  }
888
880
  return preloadIframe;
@@ -1037,7 +1029,7 @@ var ComponentApp = /*#__PURE__*/function () {
1037
1029
  this.AMSSDK.logger.logError({
1038
1030
  title: (_context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.title) || 'sdk_error_create_pop_up'
1039
1031
  }, {
1040
- message: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
1032
+ errorMessage: _context4.t0 === null || _context4.t0 === void 0 ? void 0 : _context4.t0.message,
1041
1033
  url: pageUrl
1042
1034
  });
1043
1035
  this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
@@ -1260,6 +1252,10 @@ var ComponentApp = /*#__PURE__*/function () {
1260
1252
  this.handleCloseBtnShow(true);
1261
1253
  return;
1262
1254
  }
1255
+ if (data.context.event === EVENT.setMaskCloseButton.name) {
1256
+ this.handleMaskCloseBtnShow(data.context.data);
1257
+ return;
1258
+ }
1263
1259
  if (data.context.event === EVENT.setAllowRetention.name) {
1264
1260
  if (data.context.data === true) this._isRetention = true;
1265
1261
  if (data.context.data === false) this._isRetention = false;
@@ -1365,6 +1361,21 @@ var ComponentApp = /*#__PURE__*/function () {
1365
1361
  }
1366
1362
  (_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
1367
1363
  }
1364
+ }, {
1365
+ key: "updateMaskCloseBtn",
1366
+ value: function updateMaskCloseBtn(data) {
1367
+ var maskCloseBtn = document.getElementById("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID));
1368
+ if (maskCloseBtn) {
1369
+ if (this.platform === 'desktop') {
1370
+ var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1371
+ var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1372
+ maskCloseBtn.style.top = "".concat((windowHeight - data.height) / 2 - 42, "px");
1373
+ maskCloseBtn.style.right = "".concat((windowWidth - data.width) / 2 + 18, "px");
1374
+ } else {
1375
+ maskCloseBtn.style.bottom = "".concat(data.height + 2, "px");
1376
+ }
1377
+ }
1378
+ }
1368
1379
  }, {
1369
1380
  key: "handleSizeChanged",
1370
1381
  value: function handleSizeChanged(data) {
@@ -1409,6 +1420,8 @@ var ComponentApp = /*#__PURE__*/function () {
1409
1420
  }
1410
1421
  // 关闭loading,保留蒙层
1411
1422
  this.dismissLoadingFunc();
1423
+ // 更新弹窗关闭按钮位置
1424
+ this.updateMaskCloseBtn(data.context.data);
1412
1425
  }
1413
1426
  if (this._renderDisplayType === DisplayTypeEnum.inline) {
1414
1427
  var _document$getElementB3;
@@ -1441,6 +1454,9 @@ var ComponentApp = /*#__PURE__*/function () {
1441
1454
  var _data$isDestroy,
1442
1455
  _data$isCallApp,
1443
1456
  _data$callAppDetectSu,
1457
+ _data$isDestroy2,
1458
+ _data$isCallApp2,
1459
+ _data$callAppDetectSu2,
1444
1460
  _this8 = this;
1445
1461
  var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1446
1462
  var _data = typeof data === 'string' ? {
@@ -1454,9 +1470,20 @@ var ComponentApp = /*#__PURE__*/function () {
1454
1470
  isCallApp: (_data$isCallApp = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp !== void 0 ? _data$isCallApp : false,
1455
1471
  callAppDetectSuccessDelay: (_data$callAppDetectSu = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu !== void 0 ? _data$callAppDetectSu : 2000
1456
1472
  });
1473
+ var logParams = {
1474
+ applinkUrl: (data === null || data === void 0 ? void 0 : data.applinkUrl) || '',
1475
+ schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
1476
+ normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
1477
+ target: data === null || data === void 0 ? void 0 : data.target,
1478
+ isDestroy: (_data$isDestroy2 = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy2 !== void 0 ? _data$isDestroy2 : true,
1479
+ isCallApp: (_data$isCallApp2 = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp2 !== void 0 ? _data$isCallApp2 : false,
1480
+ callAppDetectSuccessDelay: (_data$callAppDetectSu2 = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu2 !== void 0 ? _data$callAppDetectSu2 : 2000
1481
+ };
1457
1482
  this.AMSSDK.logger.logInfo({
1458
1483
  title: 'sdk_event_call_url_start'
1459
- }, _objectSpread({}, data)).send();
1484
+ }, {
1485
+ redirectInfo: JSON.stringify(logParams)
1486
+ }).send();
1460
1487
  var successCallback = function successCallback(type, url, durationInSeconds) {
1461
1488
  _this8.dispatchToSDK(EVENT.eventCallback.name, {
1462
1489
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
@@ -1638,6 +1665,16 @@ var ComponentApp = /*#__PURE__*/function () {
1638
1665
  closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
1639
1666
  }
1640
1667
  }
1668
+ }, {
1669
+ key: "handleMaskCloseBtnShow",
1670
+ value: function handleMaskCloseBtnShow(data) {
1671
+ var closeBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
1672
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'show') {
1673
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1674
+ } else {
1675
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1676
+ }
1677
+ }
1641
1678
 
1642
1679
  /**
1643
1680
  * @description Send message to SDK
@@ -1794,9 +1831,11 @@ var ComponentApp = /*#__PURE__*/function () {
1794
1831
  key: "cleanContainer",
1795
1832
  value: function cleanContainer() {
1796
1833
  var _document$getElementB4,
1834
+ _document$getElementB5,
1797
1835
  _this10 = this;
1798
1836
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1799
- (_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1837
+ (_document$getElementB4 = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1838
+ (_document$getElementB5 = document.getElementById(LOADING_ID)) === null || _document$getElementB5 === void 0 || _document$getElementB5.remove();
1800
1839
  this.hideComponentAnimation();
1801
1840
  var mockup = document.getElementById(MOCKUP_ID);
1802
1841
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
@@ -346,7 +346,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
346
346
  _this2.logger.logError({
347
347
  title: 'button_render_failed'
348
348
  }, {
349
- message: error
349
+ errorMessage: error
350
350
  });
351
351
  _this2.onEventCallback({
352
352
  code: eventCodeEnum.SDK_PAYMENT_FAIL,
@@ -59,14 +59,16 @@ function _antomConfig() {
59
59
  case 6:
60
60
  json = _context2.sent;
61
61
  logger.logInfo({
62
- title: 'Successfully obtained marmot emergency configuration'
62
+ title: 'sdk_event_importantEvent',
63
+ msg: 'Successfully obtained marmot emergency configuration'
63
64
  });
64
65
  return _context2.abrupt("return", json);
65
66
  case 11:
66
67
  _context2.prev = 11;
67
68
  _context2.t0 = _context2["catch"](0);
68
69
  logger.logError({
69
- title: 'Abnormal acquisition of marmot emergency configuration'
70
+ title: 'event_important_error',
71
+ msg: 'Abnormal acquisition of marmot emergency configuration'
70
72
  });
71
73
  return _context2.abrupt("return", '{}');
72
74
  case 15:
@@ -111,8 +111,7 @@ function logBackScheme(logger, userAgent, scheme) {
111
111
  logger.logInfo({
112
112
  title: 'a3753.b101271.c377460'
113
113
  }, {
114
- userAgent: userAgent,
115
- backScheme: scheme
114
+ eventMessage: scheme
116
115
  });
117
116
  }
118
117
  }
package/esm/util/index.js CHANGED
@@ -280,8 +280,7 @@ function loadSDKScript(_ref, logger) {
280
280
  logger.logInfo({
281
281
  title: 'load_item_sdk_start'
282
282
  }, {
283
- src: src,
284
- attrOptions: JSON.stringify(attrOptions)
283
+ eventMessage: src
285
284
  });
286
285
  console.time();
287
286
  var script = document.createElement('script');
@@ -294,8 +293,7 @@ function loadSDKScript(_ref, logger) {
294
293
  logger.logInfo({
295
294
  title: 'load_item_sdk_end'
296
295
  }, {
297
- src: src,
298
- attrOptions: JSON.stringify(attrOptions)
296
+ eventMessage: src
299
297
  });
300
298
  console.timeEnd();
301
299
  clearTimeout(timer);
@@ -308,8 +306,7 @@ function loadSDKScript(_ref, logger) {
308
306
  logger.logError({
309
307
  title: 'load_item_sdk_error'
310
308
  }, {
311
- src: src,
312
- attrOptions: JSON.stringify(attrOptions)
309
+ eventMessage: src
313
310
  });
314
311
  clearTimeout(timer);
315
312
  console.error('The script ' + src + ' is not accessible.');
@@ -319,8 +316,7 @@ function loadSDKScript(_ref, logger) {
319
316
  _this2.logger.logError({
320
317
  title: 'load_item_sdk_timeout'
321
318
  }, {
322
- src: src,
323
- attrOptions: JSON.stringify(attrOptions)
319
+ eventMessage: src
324
320
  });
325
321
  reject(false);
326
322
  }, timeOut * 1000);
@@ -13,10 +13,10 @@ export interface LogMetaData {
13
13
  platform?: string;
14
14
  sdkVersion?: string;
15
15
  webAppVersion?: string;
16
- fistLogTime?: number;
16
+ firstLogTime?: number;
17
17
  fsDuration?: number;
18
18
  instanceId?: string;
19
- storageId?: string;
19
+ deviceId?: string;
20
20
  renderDisplayType?: string;
21
21
  merchantId?: string;
22
22
  productScene?: string;
@@ -49,7 +49,7 @@ export declare class Logger {
49
49
  static setInstance(instance: Logger): Logger;
50
50
  static getInstance(): Logger;
51
51
  setMedta(mdata: LogMetaData): void;
52
- logError(error: LogPayload, extra?: Extra): Logger;
52
+ logError(error: LogPayload, extra?: Extra, enableExtractCompliance?: boolean): Logger;
53
53
  logInfo(info: LogPayload, extra?: Extra): Logger;
54
54
  reportRPC(rpcData: LogPayload, extra?: Extra): Logger;
55
55
  reportLogs(): void;
@@ -7,6 +7,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ import { LogComplianceProcessor } from "../foundation/service/log/processor";
11
+ import { SPM_MAP } from "./spm-map";
10
12
  export var Logger = /*#__PURE__*/function () {
11
13
  function Logger(config, debug) {
12
14
  _classCallCheck(this, Logger);
@@ -43,18 +45,30 @@ export var Logger = /*#__PURE__*/function () {
43
45
  }, {
44
46
  key: "logError",
45
47
  value: function logError(error, extra) {
48
+ var _this2 = this;
49
+ var enableExtractCompliance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
50
+ var newExtra = enableExtractCompliance ? LogComplianceProcessor.extractComplianceParams(error.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
51
+ _this2.logError(error, ext, false);
52
+ }) : extra !== null && extra !== void 0 ? extra : {};
46
53
  var now = Date.now();
47
54
  var fsDuration = now - this.componentStartTime;
55
+ var newError = _objectSpread({}, error);
56
+ var oldTitle = error === null || error === void 0 ? void 0 : error.title;
57
+ if (SPM_MAP[oldTitle]) {
58
+ newError.title = SPM_MAP[oldTitle];
59
+ }
60
+ newExtra.eventSource = 'sdk';
61
+ newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
48
62
  this.logs.push({
49
63
  type: 'error',
50
- logPayload: error,
51
- extra: _objectSpread(_objectSpread({}, extra), {}, {
64
+ logPayload: newError,
65
+ extra: _objectSpread(_objectSpread({}, newExtra), {}, {
52
66
  fsDuration: fsDuration,
53
67
  timeStamp: now
54
68
  })
55
69
  });
56
70
  if (this.debug) {
57
- console.error(error);
71
+ console.log('[web-sdk] Log error', newError, newExtra);
58
72
  }
59
73
  this.send();
60
74
  return this;
@@ -62,18 +76,29 @@ export var Logger = /*#__PURE__*/function () {
62
76
  }, {
63
77
  key: "logInfo",
64
78
  value: function logInfo(info, extra) {
79
+ var _this3 = this;
80
+ var newExtra = LogComplianceProcessor.extractComplianceParams(info.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
81
+ _this3.logError(error, ext, false);
82
+ });
65
83
  var now = Date.now();
66
84
  var fsDuration = now - this.componentStartTime;
85
+ var newInfo = _objectSpread({}, info);
86
+ var oldTitle = info === null || info === void 0 ? void 0 : info.title;
87
+ if (SPM_MAP[oldTitle]) {
88
+ newInfo.title = SPM_MAP[oldTitle];
89
+ }
90
+ newExtra.eventSource = 'sdk';
91
+ newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
67
92
  this.logs.push({
68
93
  type: 'info',
69
- logPayload: info,
70
- extra: _objectSpread(_objectSpread({}, extra), {}, {
94
+ logPayload: newInfo,
95
+ extra: _objectSpread(_objectSpread({}, newExtra), {}, {
71
96
  fsDuration: fsDuration,
72
97
  timeStamp: now
73
98
  })
74
99
  });
75
100
  if (this.debug) {
76
- console.log(info);
101
+ console.log('[web-sdk] Log error', newInfo, newExtra);
77
102
  }
78
103
  this.send();
79
104
  return this;
@@ -81,18 +106,29 @@ export var Logger = /*#__PURE__*/function () {
81
106
  }, {
82
107
  key: "reportRPC",
83
108
  value: function reportRPC(rpcData, extra) {
109
+ var _this4 = this;
110
+ var newExtra = LogComplianceProcessor.extractComplianceParams(rpcData.title, extra !== null && extra !== void 0 ? extra : {}, function (error, ext) {
111
+ _this4.logError(error, ext, false);
112
+ });
84
113
  var now = Date.now();
85
114
  var fsDuration = now - this.componentStartTime;
115
+ var newRpcData = _objectSpread({}, rpcData);
116
+ var oldTitle = rpcData === null || rpcData === void 0 ? void 0 : rpcData.title;
117
+ if (SPM_MAP[oldTitle]) {
118
+ newRpcData.title = SPM_MAP[oldTitle];
119
+ }
120
+ newExtra.eventSource = 'sdk';
121
+ newExtra.eventAlias = extra !== null && extra !== void 0 && extra.eventAlias ? extra === null || extra === void 0 ? void 0 : extra.eventAlias : oldTitle;
86
122
  this.logs.push({
87
123
  type: 'rpc',
88
- logPayload: rpcData,
89
- extra: _objectSpread(_objectSpread({}, extra), {}, {
124
+ logPayload: newRpcData,
125
+ extra: _objectSpread(_objectSpread({}, newExtra), {}, {
90
126
  fsDuration: fsDuration,
91
127
  timeStamp: now
92
128
  })
93
129
  });
94
130
  if (this.debug) {
95
- console.log(rpcData);
131
+ console.log('[web-sdk] Log rpc', newRpcData, newExtra);
96
132
  }
97
133
  this.send();
98
134
  return this;
@@ -151,16 +187,16 @@ export var Logger = /*#__PURE__*/function () {
151
187
  }, {
152
188
  key: "initTracker",
153
189
  value: function initTracker() {
154
- var _this2 = this;
190
+ var _this5 = this;
155
191
  if (this.isLoaded) return;
156
192
  this.isLoaded = true;
157
193
  try {
158
194
  if (typeof localStorage !== 'undefined') {
159
195
  this.loadScript(this.config.scriptUrl, function () {
160
196
  var _window4;
161
- (_window4 = window) === null || _window4 === void 0 || _window4.iTracker.initiTracker(_this2.config);
197
+ (_window4 = window) === null || _window4 === void 0 || _window4.iTracker.initiTracker(_this5.config);
162
198
  setTimeout(function () {
163
- _this2.reportLogs();
199
+ _this5.reportLogs();
164
200
  }, 80);
165
201
  });
166
202
  }
@@ -217,6 +253,6 @@ export var LogConfig = {
217
253
  productId: 'ANTOM_SDK',
218
254
  version: 'iteration/20231021',
219
255
  mdata: {
220
- fistLogTime: Date.now()
256
+ firstLogTime: Date.now()
221
257
  }
222
258
  };
@@ -0,0 +1,172 @@
1
+ export declare const SPM_MAP: {
2
+ sdk_error_runtime_error: string;
3
+ sdk_event_sdkQuery_failed: string;
4
+ container_error_error_insert_js: string;
5
+ event_important_error: string;
6
+ sdk_error_parameter: string;
7
+ sdk_event_submitPay_failed: string;
8
+ sdk_event_destroyComponent: string;
9
+ container_error_page_load_failed: string;
10
+ sdk_event_eventCallback: string;
11
+ iap_net_error: string;
12
+ sdk_event_event_callback: string;
13
+ sdk_event_renderComponent: string;
14
+ sdk_event_call_url_success: string;
15
+ sdk_event_web_app_timeout: string;
16
+ container_error_jsapi_call: string;
17
+ sdk_event_appUpgradeInfo: string;
18
+ sdk_event_webAppOnLaunch: string;
19
+ sdk_event_createComponent: string;
20
+ container_error_insert_js: string;
21
+ container_error_error_jsapi_call: string;
22
+ sdk_error_receive_message_from_web: string;
23
+ sdk_error_securitySdkGetCodeFailed: string;
24
+ sdk_error_securitySdkGetTokenFailed: string;
25
+ sdk_error_securitySdkInitFailed: string;
26
+ sdk_error_caught_exception_in_callback: string;
27
+ sdk_error_call_url_failed: string;
28
+ sdk_event_webAppTimeout: string;
29
+ sdk_error_getGaidFailed: string;
30
+ sdk_error_securitySdkInitTokenFailed: string;
31
+ sdk_event_mount_element: string;
32
+ container_error_error_invalid_param: string;
33
+ container_error_error_set_ua_failed: string;
34
+ sdk_event_onAddressResult: string;
35
+ sdk_event_onAbnormalEventName: string;
36
+ event_important_log: string;
37
+ sdk_event_sdkQueryEnd: string;
38
+ container_event_manifest_load_start: string;
39
+ sdk_event_api_preheat: string;
40
+ container_event_manifest_load_complete: string;
41
+ sdk_event_apiSubmit: string;
42
+ sdk_event_securitySdkGetCodeSuccess: string;
43
+ sdk_event_securitySdkInitSuccess: string;
44
+ container_event_start_load: string;
45
+ sdk_event_getRemoteConfigStart: string;
46
+ container_event_webViewOnPageFinished: string;
47
+ container_event_page_load_success: string;
48
+ sdk_event_pre_init: string;
49
+ sdk_event_submitPay: string;
50
+ sdk_event_submitPayEnd: string;
51
+ container_stop_event_loop: string;
52
+ iap_net_start: string;
53
+ sdk_event_securitySdkPreInitSuccess: string;
54
+ sdk_event_securitySdkPreInit: string;
55
+ sdk_event_important_event: string;
56
+ sdk_event_accelerateInfo: string;
57
+ container_event_manifest_res_complete: string;
58
+ container_event_manifest_res_start: string;
59
+ sdk_event_dismissWindowCloseCancel: string;
60
+ sdk_event_jsBridgeCall_httpRequestStart: string;
61
+ sdk_event_getGaidSuccess: string;
62
+ sdk_event_securitySdkInit: string;
63
+ sdk_event_getRemoteLanguageResult: string;
64
+ sdk_event_getRemoteLanguageStart: string;
65
+ sdk_event_handleSDKPaymentResult: string;
66
+ sdk_event_handleSDKPaymentFail: string;
67
+ sdk_event_sdkQuery: string;
68
+ sdk_event_handleSDKPaymentStart: string;
69
+ sdk_event_securitySdkGetTokenSuccess: string;
70
+ sdk_event_api_onDestroy: string;
71
+ container_load_failed: string;
72
+ sdk_event_kycAppPreLoadStart: string;
73
+ sdk_event_apiOnDestroy: string;
74
+ sdk_event_getRemoteConfigResult: string;
75
+ iap_net_result: string;
76
+ sdk_event_popupWindowCloseButtonClick: string;
77
+ container_error_resourceLoadFailed: string;
78
+ container_event_startPreRenderUrl: string;
79
+ sdk_event_webAppPreLoadStart: string;
80
+ sdk_event_importantEvent: string;
81
+ container_error_registerJSAPIPlugin: string;
82
+ sdk_event_afterEventCallback: string;
83
+ sdk_event_createPayment: string;
84
+ sdk_event_sendMessageToWeb: string;
85
+ sdk_error_appHeartBeatTimeout: string;
86
+ container_event_jSEngineEvaluateJavascript: string;
87
+ container_event_jSEngineLoadJavascript: string;
88
+ sdk_event_receive_message_from_web: string;
89
+ sdk_event_receiveMessageFromWeb: string;
90
+ sdk_event_monitorFlushReport: string;
91
+ container_event_page_pv: string;
92
+ container_event_override_url_loading: string;
93
+ sdk_event_dismissWindowCloseConfirm: string;
94
+ container_load_success: string;
95
+ container_event_page_start: string;
96
+ sdk_event_webAppStartLoad: string;
97
+ container_event_startPreLoadUrl: string;
98
+ container_event_jsSEngineStart: string;
99
+ container_event_jSEngineDestroy: string;
100
+ sdk_event_send_message_to_web: string;
101
+ container_event_importantEvent: string;
102
+ sdk_event_monitorCrashTrackInit: string;
103
+ container_event_stop_event_loop: string;
104
+ sdk_event_requestAccelerateInfo: string;
105
+ native_rpc_performance: string;
106
+ container_event_jSEngineEvaluateJavascriptCallback: string;
107
+ container_event_jSEngineRegisterJsapi: string;
108
+ jSEngineEvaluateJavascriptConvertError: string;
109
+ sdk_event_security_unneeded_scenarios: string;
110
+ container_event_launch: string;
111
+ event_jsapi_call_start: string;
112
+ event_jsapi_call_end: string;
113
+ sdk_event_call_url_start: string;
114
+ sdk_event_onAbnormalKeys: string;
115
+ sdk_event_espBeforePay: string;
116
+ sdk_event_busPublishMessage: string;
117
+ sdk_event_busIsSubscribe: string;
118
+ sdk_event_busSubscribe: string;
119
+ NEW_AMSSDK_BY_MECHANT: string;
120
+ sdk_event_busClear: string;
121
+ sdk_event_busAddInterceptor: string;
122
+ sdk_error_securitySdkInitTimeout: string;
123
+ sdk_error_busPublishNoResult: string;
124
+ sdk_event_busPublishCallback: string;
125
+ sdk_error_busPublishError: string;
126
+ sdk_error_busPublishUnsubscribeError: string;
127
+ sdk_event_busUnsubscribe: string;
128
+ onBusPublishException: string;
129
+ sdk_event_apiGetValue: string;
130
+ load_channel_sdk_start: string;
131
+ preload_match: string;
132
+ preload_no_match: string;
133
+ canMakePayments_error: string;
134
+ performance_optimization_clearPreloadIframe: string;
135
+ performance_optimization_clearPreloadIframe_timeout: string;
136
+ sdk_event_call_url_failed: string;
137
+ sdk_event_applePaymentResult: string;
138
+ submitPayStatus: string;
139
+ sdk_event_appleAvailable: string;
140
+ sdk_event_appleCreateComponent: string;
141
+ sdk_event_appleShowPaymentSheet: string;
142
+ sdk_event_appleSubmitToken: string;
143
+ sdk_event_appleDestroyComponent: string;
144
+ paypal_payment_failed: string;
145
+ paypal_payment_approved: string;
146
+ paypal_payment_cancelled: string;
147
+ sdk_event_clean_component: string;
148
+ load_item_sdk_start: string;
149
+ load_item_sdk_end: string;
150
+ performance_optimization_get_previousChannel_error: string;
151
+ performance_optimization_channelType_error: string;
152
+ sdk_error_before_submit: string;
153
+ sessionDataNull: string;
154
+ 'appple runtime excepiton': string;
155
+ sdk_error_created_app_process_failed: string;
156
+ sdk_error_web_app_timeout: string;
157
+ performance_optimization_preload: string;
158
+ performance_optimization_preload_path_error: string;
159
+ sdk_error_created_app_failed: string;
160
+ sdk_error_create_pop_up: string;
161
+ button_render_failed: string;
162
+ paypal_payment_loadSDK_failed: string;
163
+ load_item_sdk_error: string;
164
+ load_item_sdk_timeout: string;
165
+ MerchantValidationError: string;
166
+ PaymentAuthorizedError: string;
167
+ 'ApplePaySession is only support in Safari': string;
168
+ 'Abnormal params paymentSessionFactor': string;
169
+ 'Abnormal params recurringInfo': string;
170
+ 'Payment processing but user dismissed the sheet': string;
171
+ 'User dismissed the sheet': string;
172
+ };