@alipay/ams-checkout 0.0.1711691167-dev.9 → 0.0.1712728793-dev.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.
@@ -22,6 +22,7 @@ import { queryPaymentInfo, submitPayInfo } from "../../service";
22
22
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
23
23
  import { getType, isJsonString, isPC } from "../../util";
24
24
  import { isLocalMock } from "../../util/mock";
25
+ import { matchVersion } from "../../util/versionCompare";
25
26
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
26
27
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
27
28
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
@@ -52,9 +53,8 @@ var ComponentApp = /*#__PURE__*/function () {
52
53
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
53
54
  _defineProperty(this, "_multipleCallbackEvents", void 0);
54
55
  _defineProperty(this, "_merchantAppointParam", void 0);
55
- _defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
56
56
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
57
- this._appVersion = '1.13.0';
57
+ this._appVersion = '1.11.1';
58
58
  this._isInitComponent = false;
59
59
  this._selector = "#".concat(COMPONENT_SECTION_ID);
60
60
  this.createIframeNode = function () {
@@ -94,7 +94,7 @@ var ComponentApp = /*#__PURE__*/function () {
94
94
  }, {
95
95
  key: "initLoggerMeta",
96
96
  value: function initLoggerMeta() {
97
- var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2, _this$_renderParams3;
97
+ var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2;
98
98
  var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
99
99
  var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
100
100
  this.AMSSDK.logger.setMedta({
@@ -110,9 +110,9 @@ var ComponentApp = /*#__PURE__*/function () {
110
110
  productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
111
111
  paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
112
112
  paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
113
- requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
114
- trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
113
+ requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData
115
114
  });
115
+ this.AMSSDK.logger.setComponentStartTime(Date.now());
116
116
  }
117
117
 
118
118
  /**
@@ -131,9 +131,9 @@ var ComponentApp = /*#__PURE__*/function () {
131
131
  }, {
132
132
  key: "initSecurity",
133
133
  value: function initSecurity() {
134
- var _this$_renderParams4,
134
+ var _this$_renderParams3,
135
135
  _this = this;
136
- var product = (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionConfig) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.productScene;
136
+ var product = (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionMetaData) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionConfig) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.productScene;
137
137
  if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
138
138
  if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
139
139
  this.AMSSDK.logger.logInfo({
@@ -364,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
364
364
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
365
365
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
366
366
  var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
367
- var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
367
+ var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, _this5$_renderParams6, _this5$_renderParams7, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
368
368
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
369
369
  while (1) switch (_context2.prev = _context2.next) {
370
370
  case 0:
@@ -380,9 +380,10 @@ var ComponentApp = /*#__PURE__*/function () {
380
380
  /**
381
381
  * @description Simulated or unnecessary scenarios
382
382
  */
383
- _ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
383
+ _ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref3$extendInfo = _ref3.extendInfo, extendInfo = _ref3$extendInfo === void 0 ? '' : _ref3$extendInfo;
384
384
  enableVaultingApiOptimize = false;
385
385
  enableEasypayApiOptimize = false;
386
+ _ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {}, skipSdkQuery = _ref4.skipSdkQuery, skipSdkQueryForm = _ref4.skipSdkQueryForm;
386
387
  try {
387
388
  extendInfoData = JSON.parse(extendInfo);
388
389
  enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
@@ -391,100 +392,127 @@ var ComponentApp = /*#__PURE__*/function () {
391
392
  console.log(error);
392
393
  }
393
394
  if (!isLocalMock()) {
394
- _context2.next = 8;
395
+ _context2.next = 9;
395
396
  break;
396
397
  }
397
398
  return _context2.abrupt("return", resolve({
398
399
  message: 'sdk no need to make query request',
399
400
  success: true
400
401
  }));
401
- case 8:
402
- if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign && (_this5$_renderParams5 = _this5._renderParams) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.action) !== null && _this5$_renderParams5 !== void 0 && _this5$_renderParams5.skipSdkQuery && enableVaultingApiOptimize)) {
403
- _context2.next = 10;
402
+ case 9:
403
+ if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
404
+ _context2.next = 21;
404
405
  break;
405
406
  }
406
- return _context2.abrupt("return", resolve({
407
+ if (!enableVaultingApiOptimize) {
408
+ _context2.next = 21;
409
+ break;
410
+ }
411
+ if (!skipSdkQueryForm) {
412
+ _context2.next = 18;
413
+ break;
414
+ }
415
+ // 优先判断 skipSdkQueryForm
416
+ ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
417
+ if (!ifSkip) {
418
+ _context2.next = 16;
419
+ break;
420
+ }
421
+ resolve({
407
422
  message: 'sdk no need to make query request',
408
423
  success: true
409
- }));
410
- case 10:
424
+ });
425
+ return _context2.abrupt("return");
426
+ case 16:
427
+ _context2.next = 21;
428
+ break;
429
+ case 18:
430
+ if (!skipSdkQuery) {
431
+ _context2.next = 21;
432
+ break;
433
+ }
434
+ resolve({
435
+ message: 'sdk no need to make query request',
436
+ success: true
437
+ });
438
+ return _context2.abrupt("return");
439
+ case 21:
411
440
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
412
- _context2.next = 16;
441
+ _context2.next = 27;
413
442
  break;
414
443
  }
415
444
  params.paymentMethodType = 'CARD';
416
- _context2.next = 14;
445
+ _context2.next = 25;
417
446
  return _this5.getDeviceIdAndLog();
418
- case 14:
447
+ case 25:
419
448
  envInfo.deviceId = _context2.sent;
420
449
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
421
450
  envInfo.extendInfo = {
422
451
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
423
452
  };
424
453
  }
425
- case 16:
454
+ case 27:
426
455
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
427
- _context2.next = 26;
456
+ _context2.next = 37;
428
457
  break;
429
458
  }
430
- _ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
431
- _ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
459
+ _ref5 = params.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer, _ref5$productScene = _ref5.productScene, productScene = _ref5$productScene === void 0 ? '' : _ref5$productScene;
460
+ _ref6 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
432
461
  if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
433
- _context2.next = 21;
462
+ _context2.next = 32;
434
463
  break;
435
464
  }
436
465
  return _context2.abrupt("return", resolve({
437
466
  message: 'sdk no need to make query request',
438
467
  success: true
439
468
  }));
440
- case 21:
469
+ case 32:
441
470
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
442
- _context2.next = 23;
471
+ _context2.next = 34;
443
472
  break;
444
473
  }
445
474
  return _context2.abrupt("return", resolve({
446
475
  message: 'sdk no need to make query request',
447
476
  success: true
448
477
  }));
449
- case 23:
450
- _context2.next = 25;
478
+ case 34:
479
+ _context2.next = 36;
451
480
  return _this5.getDeviceIdAndLog();
452
- case 25:
481
+ case 36:
453
482
  envInfo.deviceId = _context2.sent;
454
- case 26:
483
+ case 37:
455
484
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
456
- _context2.next = 36;
485
+ _context2.next = 47;
457
486
  break;
458
487
  }
459
488
  action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
460
489
  signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
461
490
  if (!(signType === 'SMS')) {
462
- _context2.next = 31;
491
+ _context2.next = 42;
463
492
  break;
464
493
  }
465
494
  return _context2.abrupt("return", resolve({
466
495
  message: 'sdk no need to make query request',
467
496
  success: true
468
497
  }));
469
- case 31:
498
+ case 42:
470
499
  if (!(!signType || signType !== 'REDIRECT')) {
471
- _context2.next = 33;
500
+ _context2.next = 44;
472
501
  break;
473
502
  }
474
503
  return _context2.abrupt("return", resolve({
475
504
  success: false
476
505
  }));
477
- case 33:
478
- _context2.next = 35;
506
+ case 44:
507
+ _context2.next = 46;
479
508
  return _this5.getDeviceIdAndLog();
480
- case 35:
509
+ case 46:
481
510
  envInfo.deviceId = _context2.sent;
482
- case 36:
511
+ case 47:
483
512
  _this5.AMSSDK.logger.logInfo({
484
513
  title: 'sdk_event_sdkQuery'
485
514
  }, {
486
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
487
- requestBody: params
515
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
488
516
  }).send();
489
517
  queryPaymentInfo(params, {
490
518
  env: _this5.AMSSDK.options.env.environment,
@@ -495,12 +523,6 @@ var ComponentApp = /*#__PURE__*/function () {
495
523
  value: Date.now()
496
524
  });
497
525
  resolve(res);
498
- _this5.AMSSDK.logger.logInfo({
499
- title: 'sdk_event_sdkQueryEnd'
500
- }, {
501
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
502
- responseBody: res
503
- }).send();
504
526
  }).catch(function (err) {
505
527
  if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
506
528
  return resolve({
@@ -510,15 +532,15 @@ var ComponentApp = /*#__PURE__*/function () {
510
532
  _this5.dispatchToSDK(EVENT.error.name, {
511
533
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
512
534
  });
513
- _this5.AMSSDK.logger.logError({
514
- title: 'sdk_event_sdkQuery_failed'
535
+ reject(err);
536
+ }).finally(function () {
537
+ _this5.AMSSDK.logger.logInfo({
538
+ title: 'sdk_event_sdkQueryEnd'
515
539
  }, {
516
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
517
- errorReason: err
540
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
518
541
  }).send();
519
- reject(err);
520
542
  });
521
- case 38:
543
+ case 49:
522
544
  case "end":
523
545
  return _context2.stop();
524
546
  }
@@ -535,21 +557,21 @@ var ComponentApp = /*#__PURE__*/function () {
535
557
  }, {
536
558
  key: "createSubmitPromise",
537
559
  value: function createSubmitPromise() {
538
- var _this$_renderParams5,
539
- _this$_renderParams6,
560
+ var _this$_renderParams4,
561
+ _this$_renderParams5,
540
562
  _this6 = this;
541
563
  this._performanceData.push({
542
564
  key: 'sdk_submit_start',
543
565
  value: Date.now()
544
566
  });
545
567
  var params = {
546
- paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
547
- paymentSessionConfig: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 || (_this$_renderParams6 = _this$_renderParams6.paymentSessionMetaData) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionConfig
568
+ paymentSessionData: this._renderParams && ((_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.sessionData) || '',
569
+ paymentSessionConfig: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 || (_this$_renderParams5 = _this$_renderParams5.paymentSessionMetaData) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentSessionConfig
548
570
  };
549
571
 
550
572
  // eslint-disable-next-line no-async-promise-executor
551
573
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
552
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
574
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
553
575
  var _this6$_renderParams;
554
576
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
555
577
  while (1) switch (_context3.prev = _context3.next) {
@@ -566,8 +588,7 @@ var ComponentApp = /*#__PURE__*/function () {
566
588
  _this6.AMSSDK.logger.logInfo({
567
589
  title: 'sdk_event_submitPay'
568
590
  }, {
569
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
570
- requestBody: params
591
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
571
592
  }).send();
572
593
  _context3.t0 = submitPayInfo;
573
594
  _context3.t1 = params;
@@ -590,23 +611,21 @@ var ComponentApp = /*#__PURE__*/function () {
590
611
  key: 'sdk_submit_end',
591
612
  value: Date.now()
592
613
  });
614
+ if (res !== null && res !== void 0 && res.success) {
615
+ resolve(res);
616
+ } else {
617
+ resolve(res);
618
+ }
619
+ }).catch(function () {
620
+ resolve({
621
+ success: false
622
+ });
623
+ }).finally(function () {
593
624
  _this6.AMSSDK.logger.logInfo({
594
625
  title: 'sdk_event_submitPayEnd'
595
626
  }, {
596
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
597
- responseBody: res
627
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
598
628
  }).send();
599
- resolve(res);
600
- }).catch(function (err) {
601
- _this6.AMSSDK.logger.logError({
602
- title: 'sdk_event_submitPay_failed'
603
- }, {
604
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
605
- responseBody: err
606
- }).send();
607
- resolve({
608
- success: false
609
- });
610
629
  });
611
630
  case 13:
612
631
  case "end":
@@ -615,7 +634,7 @@ var ComponentApp = /*#__PURE__*/function () {
615
634
  }, _callee3);
616
635
  }));
617
636
  return function (_x3) {
618
- return _ref6.apply(this, arguments);
637
+ return _ref7.apply(this, arguments);
619
638
  };
620
639
  }());
621
640
  }
@@ -1206,9 +1225,9 @@ var ComponentApp = /*#__PURE__*/function () {
1206
1225
  }
1207
1226
  }, {
1208
1227
  key: "handleDeclareInfo",
1209
- value: function handleDeclareInfo(_ref7) {
1210
- var _ref7$closeDialogData = _ref7.closeDialogData,
1211
- closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
1228
+ value: function handleDeclareInfo(_ref8) {
1229
+ var _ref8$closeDialogData = _ref8.closeDialogData,
1230
+ closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
1212
1231
  _handleDeclareInfo({
1213
1232
  closeDialogData: closeDialogData
1214
1233
  });
@@ -1245,12 +1264,12 @@ var ComponentApp = /*#__PURE__*/function () {
1245
1264
  }
1246
1265
  };
1247
1266
  }
1248
- if (this._webAppHeartBeatTimeoutId) {
1249
- clearTimeout(this._webAppHeartBeatTimeoutId);
1250
- this._webAppHeartBeatTimeoutId = null;
1267
+ if (window._webAppHeartBeatTimeoutId) {
1268
+ clearTimeout(window._webAppHeartBeatTimeoutId);
1269
+ window._webAppHeartBeatTimeoutId = null;
1251
1270
  }
1252
1271
  if (this._webAppHeartBeatTimeoutFn) {
1253
- this._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
1272
+ window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
1254
1273
  }
1255
1274
  setTimeout(function () {
1256
1275
  if (_this8.isAppAttached()) {
@@ -1309,17 +1328,20 @@ var ComponentApp = /*#__PURE__*/function () {
1309
1328
  key: "dispatchToApp",
1310
1329
  value: function dispatchToApp(payload) {
1311
1330
  var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1331
+ var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1312
1332
  var data = Object.assign({}, payload, {
1313
1333
  name: messageName.SDK_TO_APP,
1314
1334
  mode: this.AMSSDK.options.mode,
1315
1335
  appId: COMPONENTPLUGINID,
1316
1336
  instanceId: this.AMSSDK._instanceId
1317
1337
  });
1318
- this.AMSSDK.logger.logInfo({
1319
- title: 'sdk_event_send_message_to_web'
1320
- }, {
1321
- event: data === null || data === void 0 ? void 0 : data.context.event
1322
- }).send();
1338
+ if (sendLog) {
1339
+ this.AMSSDK.logger.logInfo({
1340
+ title: 'sdk_event_send_message_to_web'
1341
+ }, {
1342
+ event: data === null || data === void 0 ? void 0 : data.context.event
1343
+ }).send();
1344
+ }
1323
1345
  if (targetElement && targetElement.contentWindow) {
1324
1346
  return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
1325
1347
  }
@@ -1354,7 +1376,7 @@ var ComponentApp = /*#__PURE__*/function () {
1354
1376
  key: "sendRenderEvent",
1355
1377
  value: (function () {
1356
1378
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1357
- var _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, _this$_renderParams11, _this$_renderParams12, _this$AMSSDK$logger, _this$_renderParams13, _this$_renderParams14, _this$_renderParams15, _this$AMSSDK, _this$_renderParams16, res, submitRes;
1379
+ var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
1358
1380
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1359
1381
  while (1) switch (_context8.prev = _context8.next) {
1360
1382
  case 0:
@@ -1383,32 +1405,20 @@ var ComponentApp = /*#__PURE__*/function () {
1383
1405
  data: {
1384
1406
  queryResult: res,
1385
1407
  submitResult: submitRes,
1386
- sessionResult: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData,
1387
- paymentSessionData: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.sessionData,
1408
+ sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1409
+ paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
1388
1410
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1389
- renderDisplayType: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.renderDisplayType,
1390
- appearance: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.appearance,
1391
- notRedirectAfterComplete: ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true,
1411
+ renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1412
+ appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1413
+ notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
1392
1414
  merchantAppointParam: this._merchantAppointParam,
1393
1415
  envInfo: {
1394
1416
  screenHeight: screen.height,
1395
1417
  screenWidth: screen.width
1396
- },
1397
- logMetaData: _objectSpread(_objectSpread({
1398
- trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
1399
- platform: this.platform,
1400
- firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1401
- }, ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig) || {}), {}, {
1402
- renderDisplayType: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.renderDisplayType,
1403
- sdkVersion: this._appVersion,
1404
- merchantId: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 || (_this$_renderParams15 = _this$_renderParams15.paymentSessionMetaData) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.clientId,
1405
- instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1406
- performanceData: this._performanceData,
1407
- paymentMethodType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentSessionMetaData) === null || _this$_renderParams16 === void 0 || (_this$_renderParams16 = _this$_renderParams16.paymentMethodInfoView) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.paymentMethodType
1408
- })
1418
+ }
1409
1419
  }
1410
1420
  }
1411
- });
1421
+ }, null, true);
1412
1422
  this.AMSSDK.logger.logInfo({
1413
1423
  title: 'sdk_event_renderComponent'
1414
1424
  });
@@ -1,11 +1,11 @@
1
- import { ApplePayActionEnum, PaymentActionEnum, PaypalActionEnum } from "../core/bus/interface";
2
- import { paymentMethodCategoryTypeEnum, PaypalMethodEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
1
+ import { ApplePayActionEnum, PaymentActionEnum } from "../core/bus/interface";
2
+ import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from "../types/index";
3
3
  export var ExtendPlugin = [{
4
4
  sessionMatcher: {
5
5
  productScene: productSceneEnum.CASHIER_PAYMENT,
6
6
  productSceneVersion: ProductSceneVersion.V1,
7
7
  paymentMethodCategoryType: paymentMethodCategoryTypeEnum.CARD,
8
- paymentMethodTypes: ['CARD_APPLE_PAY']
8
+ paymentMethodTypes: ["CARD_APPLE_PAY"]
9
9
  },
10
10
  paymentChannelMatcher: {
11
11
  paymentMethod: 'ApplePay'
@@ -14,20 +14,6 @@ export var ExtendPlugin = [{
14
14
  canMakePayments: ApplePayActionEnum.canMakePayments,
15
15
  optional_init: PaymentActionEnum.optional_init,
16
16
  createComponent: ApplePayActionEnum.createComponent,
17
- destroyComponent: ApplePayActionEnum.destroyComponent
18
- }
19
- }, {
20
- sessionMatcher: {
21
- productScene: productSceneEnum.CASHIER_PAYMENT,
22
- productSceneVersion: ProductSceneVersion.V1,
23
- paymentMethodCategoryType: paymentMethodCategoryTypeEnum.APM,
24
- paymentMethodTypes: [PaypalMethodEnum.PAYPAL_CHECKOUT, PaypalMethodEnum.PAYPAL_PAYLATER, PaypalMethodEnum.PAYPAL_VAULT]
25
- },
26
- paymentChannelMatcher: {
27
- paymentMethod: 'Paypal'
28
- },
29
- busActionNames: {
30
- mountComponent: PaypalActionEnum.mountComponent,
31
- destroyComponent: PaypalActionEnum.destroyComponent
17
+ destoryComponent: ApplePayActionEnum.destoryComponent
32
18
  }
33
19
  }];
@@ -1,4 +1,4 @@
1
- import { BusSubscriber } from 'src/core/bus';
1
+ import { BusSubscriber } from '../core/bus';
2
2
  import { paymentMethodCategoryTypeEnum, productSceneEnum, ProductSceneVersion } from '../types';
3
3
  export type IExtendPlugin = IExtendPluginItem[];
4
4
  export interface ComponentActionNamesType {
@@ -7,7 +7,7 @@ export interface ComponentActionNamesType {
7
7
  createComponent?: string;
8
8
  mountComponent?: string;
9
9
  submit?: string;
10
- destroyComponent?: string;
10
+ destoryComponent?: string;
11
11
  }
12
12
  export type IExtendPluginItem = {
13
13
  /**
@@ -50,8 +50,6 @@ function requestInstance(options) {
50
50
  withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
51
51
  method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
52
52
  });
53
- console.log('baseURL', baseURL);
54
- console.log('_headers', _headers);
55
53
  return instance.request;
56
54
  }
57
55
 
@@ -99,25 +97,21 @@ function _request() {
99
97
  })];
100
98
  startTime = Date.now();
101
99
  _context.prev = 5;
102
- console.log('requestInstance options', options);
103
- console.log('requestInstance -data', _data);
104
100
  myRequest = requestInstance(options);
105
- _context.next = 11;
101
+ _context.next = 9;
106
102
  return myRequest({
107
103
  data: _data
108
104
  });
109
- case 11:
105
+ case 9:
110
106
  _yield$myRequest = _context.sent;
111
107
  data = _yield$myRequest.data;
112
108
  headers = _yield$myRequest.headers;
113
- console.log('requestInstance data', data);
114
- console.log('requestInstance headers', headers);
115
109
  resData = data || {};
116
110
  traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
117
111
  resData.traceId = traceId || '';
118
112
  handleGetWayError = fomatGetwayError(headers, traceId);
119
113
  if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
120
- _context.next = 25;
114
+ _context.next = 21;
121
115
  break;
122
116
  }
123
117
  errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
@@ -136,7 +130,7 @@ function _request() {
136
130
  errorCode: errorCode,
137
131
  success: false
138
132
  }));
139
- case 25:
133
+ case 21:
140
134
  logger.reportRPC({
141
135
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
142
136
  label: 'request',
@@ -147,8 +141,8 @@ function _request() {
147
141
  traceId: traceId
148
142
  }).send();
149
143
  return _context.abrupt("return", resData);
150
- case 29:
151
- _context.prev = 29;
144
+ case 25:
145
+ _context.prev = 25;
152
146
  _context.t0 = _context["catch"](5);
153
147
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
154
148
  success: false,
@@ -170,11 +164,11 @@ function _request() {
170
164
  errorCode: _errorCode,
171
165
  errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
172
166
  }));
173
- case 36:
167
+ case 32:
174
168
  case "end":
175
169
  return _context.stop();
176
170
  }
177
- }, _callee, null, [[5, 29]]);
171
+ }, _callee, null, [[5, 25]]);
178
172
  }));
179
173
  return _request.apply(this, arguments);
180
174
  }