@alipay/ams-checkout 0.0.1713838058-dev.3 → 0.0.1713844123-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.
Files changed (40) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/core/bus/index.d.ts +1 -1
  3. package/esm/core/bus/interface.d.ts +1 -5
  4. package/esm/core/bus/interface.js +1 -6
  5. package/esm/core/component/index.js +9 -11
  6. package/esm/core/instance/index.d.ts +1 -8
  7. package/esm/core/instance/index.js +11 -18
  8. package/esm/plugin/applepay/component.d.ts +1 -1
  9. package/esm/plugin/applepay/component.js +5 -5
  10. package/esm/plugin/applepay/index.d.ts +1 -1
  11. package/esm/plugin/applepay/index.js +6 -6
  12. package/esm/plugin/component/cashierApp.d.ts +2 -6
  13. package/esm/plugin/component/cashierApp.js +13 -69
  14. package/esm/plugin/component/channel.d.ts +20 -0
  15. package/esm/plugin/component/channel.js +38 -0
  16. package/esm/plugin/component/component.popup.style.d.ts +4 -1
  17. package/esm/plugin/component/component.popup.style.js +7 -1
  18. package/esm/plugin/component/index.js +119 -110
  19. package/esm/plugin/const.js +4 -18
  20. package/esm/plugin/type.d.ts +2 -2
  21. package/esm/request/index.js +2 -2
  22. package/esm/types/index.d.ts +6 -53
  23. package/esm/types/index.js +1 -18
  24. package/esm/util/index.d.ts +1 -2
  25. package/esm/util/index.js +2 -4
  26. package/esm/util/logger.d.ts +0 -8
  27. package/esm/util/logger.js +3 -34
  28. package/esm/util/versionCompare.d.ts +1 -8
  29. package/esm/util/versionCompare.js +0 -22
  30. package/package.json +1 -1
  31. package/esm/plugin/paypal/index.d.ts +0 -20
  32. package/esm/plugin/paypal/index.js +0 -389
  33. package/esm/plugin/utils.d.ts +0 -6
  34. package/esm/plugin/utils.js +0 -21
  35. package/esm/util/debug.d.ts +0 -1
  36. package/esm/util/debug.js +0 -9
  37. package/esm/util/storage.d.ts +0 -2
  38. package/esm/util/storage.js +0 -23
  39. package/esm/util/upgrade.d.ts +0 -39
  40. package/esm/util/upgrade.js +0 -115
@@ -17,7 +17,6 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
17
17
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
18
18
  */
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
- import { sdkVersion } from "../../config";
21
20
  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
21
  import { queryPaymentInfo, submitPayInfo } from "../../service";
23
22
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
@@ -25,6 +24,7 @@ import { getType, isJsonString, isPC } from "../../util";
25
24
  import { isLocalMock } from "../../util/mock";
26
25
  import { matchVersion } from "../../util/versionCompare";
27
26
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
27
+ import { getChannelBehavior } from "./channel";
28
28
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
29
29
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
30
30
  import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
@@ -55,7 +55,7 @@ var ComponentApp = /*#__PURE__*/function () {
55
55
  _defineProperty(this, "_multipleCallbackEvents", void 0);
56
56
  _defineProperty(this, "_merchantAppointParam", void 0);
57
57
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
58
- this._appVersion = '1.13.0';
58
+ this._appVersion = '1.12.0.15';
59
59
  this._isInitComponent = false;
60
60
  this._selector = "#".concat(COMPONENT_SECTION_ID);
61
61
  this.createIframeNode = function () {
@@ -95,14 +95,13 @@ var ComponentApp = /*#__PURE__*/function () {
95
95
  }, {
96
96
  key: "initLoggerMeta",
97
97
  value: function initLoggerMeta() {
98
- var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2, _this$_renderParams3;
98
+ var _this$_renderParams, _paymentSessionMetaDa, _this$_renderParams2;
99
99
  var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
100
100
  var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
101
101
  this.AMSSDK.logger.setMedta({
102
102
  platform: this.platform === platformEnum.desktop ? 'PC' : 'WAP',
103
103
  // PC/WAP,
104
- sdkVersion: sdkVersion,
105
- webAppVersion: this._appVersion,
104
+ sdkVersion: this._appVersion,
106
105
  instanceId: this.AMSSDK._instanceId,
107
106
  storageId: this.AMSSDK._storageId,
108
107
  // the better way to use md5 paymentSesionID
@@ -112,9 +111,9 @@ var ComponentApp = /*#__PURE__*/function () {
112
111
  productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
113
112
  paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
114
113
  paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType,
115
- requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData,
116
- trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
114
+ requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.paymentSessionData
117
115
  });
116
+ this.AMSSDK.logger.setComponentStartTime(Date.now());
118
117
  }
119
118
 
120
119
  /**
@@ -133,9 +132,9 @@ var ComponentApp = /*#__PURE__*/function () {
133
132
  }, {
134
133
  key: "initSecurity",
135
134
  value: function initSecurity() {
136
- var _this$_renderParams4,
135
+ var _this$_renderParams3,
137
136
  _this = this;
138
- 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;
137
+ 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;
139
138
  if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
140
139
  if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
141
140
  this.AMSSDK.logger.logInfo({
@@ -274,9 +273,18 @@ var ComponentApp = /*#__PURE__*/function () {
274
273
  insertStyleSheet();
275
274
  }
276
275
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
276
+ var _this$_renderParams4;
277
277
  createBaseElement(this.platform, this.closeBtnFunc.bind(this));
278
278
  createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
279
- createMockup();
279
+ var channelBehavior = getChannelBehavior((_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionMetaData);
280
+ var onClickOutside = function onClickOutside() {};
281
+ if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
282
+ onClickOutside = this.closeBtnFunc.bind(this);
283
+ }
284
+ createMockup({
285
+ platform: this.platform,
286
+ onClickOutside: onClickOutside
287
+ });
280
288
  this.renderPopupLoading(renderParams);
281
289
  }
282
290
  this.createApp(renderParams);
@@ -356,7 +364,9 @@ var ComponentApp = /*#__PURE__*/function () {
356
364
  }, {
357
365
  key: "createActionQueryPromise",
358
366
  value: function createActionQueryPromise() {
359
- var _this5 = this;
367
+ var _this$_renderParams5,
368
+ _this5 = this;
369
+ var paymentMethodType = (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 || (_this$_renderParams5 = _this$_renderParams5.paymentSessionMetaData) === null || _this$_renderParams5 === void 0 || (_this$_renderParams5 = _this$_renderParams5.paymentMethodInfoView) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.paymentMethodType;
360
370
  this._performanceData.push({
361
371
  key: 'sdk_action_query_start',
362
372
  value: Date.now()
@@ -365,8 +375,8 @@ var ComponentApp = /*#__PURE__*/function () {
365
375
  // eslint-disable-next-line no-async-promise-executor
366
376
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
367
377
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
368
- var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
369
- 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;
378
+ var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
379
+ var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web, _action$wap, action, signType;
370
380
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
371
381
  while (1) switch (_context2.prev = _context2.next) {
372
382
  case 0:
@@ -382,7 +392,7 @@ var ComponentApp = /*#__PURE__*/function () {
382
392
  /**
383
393
  * @description Simulated or unnecessary scenarios
384
394
  */
385
- _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;
395
+ _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, actionData = _ref3.action;
386
396
  enableVaultingApiOptimize = false;
387
397
  enableEasypayApiOptimize = false;
388
398
  _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;
@@ -439,83 +449,93 @@ var ComponentApp = /*#__PURE__*/function () {
439
449
  });
440
450
  return _context2.abrupt("return");
441
451
  case 21:
452
+ channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
453
+ if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
454
+ _context2.next = 24;
455
+ break;
456
+ }
457
+ return _context2.abrupt("return", resolve({
458
+ autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
459
+ amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
460
+ success: true
461
+ }));
462
+ case 24:
442
463
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
443
- _context2.next = 27;
464
+ _context2.next = 30;
444
465
  break;
445
466
  }
446
467
  params.paymentMethodType = 'CARD';
447
- _context2.next = 25;
468
+ _context2.next = 28;
448
469
  return _this5.getDeviceIdAndLog();
449
- case 25:
470
+ case 28:
450
471
  envInfo.deviceId = _context2.sent;
451
472
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
452
473
  envInfo.extendInfo = {
453
474
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
454
475
  };
455
476
  }
456
- case 27:
477
+ case 30:
457
478
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
458
- _context2.next = 37;
479
+ _context2.next = 40;
459
480
  break;
460
481
  }
461
482
  _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;
462
- _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;
463
- 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)) {
464
- _context2.next = 32;
483
+ _ref6 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.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;
484
+ if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
485
+ _context2.next = 35;
465
486
  break;
466
487
  }
467
488
  return _context2.abrupt("return", resolve({
468
489
  message: 'sdk no need to make query request',
469
490
  success: true
470
491
  }));
471
- case 32:
492
+ case 35:
472
493
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
473
- _context2.next = 34;
494
+ _context2.next = 37;
474
495
  break;
475
496
  }
476
497
  return _context2.abrupt("return", resolve({
477
498
  message: 'sdk no need to make query request',
478
499
  success: true
479
500
  }));
480
- case 34:
481
- _context2.next = 36;
501
+ case 37:
502
+ _context2.next = 39;
482
503
  return _this5.getDeviceIdAndLog();
483
- case 36:
504
+ case 39:
484
505
  envInfo.deviceId = _context2.sent;
485
- case 37:
506
+ case 40:
486
507
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
487
- _context2.next = 47;
508
+ _context2.next = 50;
488
509
  break;
489
510
  }
490
- 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) || {};
511
+ action = ((_this5$_renderParams9 = _this5._renderParams) === null || _this5$_renderParams9 === void 0 || (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) === null || _this5$_renderParams9 === void 0 ? void 0 : _this5$_renderParams9.action) || {};
491
512
  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;
492
513
  if (!(signType === 'SMS')) {
493
- _context2.next = 42;
514
+ _context2.next = 45;
494
515
  break;
495
516
  }
496
517
  return _context2.abrupt("return", resolve({
497
518
  message: 'sdk no need to make query request',
498
519
  success: true
499
520
  }));
500
- case 42:
521
+ case 45:
501
522
  if (!(!signType || signType !== 'REDIRECT')) {
502
- _context2.next = 44;
523
+ _context2.next = 47;
503
524
  break;
504
525
  }
505
526
  return _context2.abrupt("return", resolve({
506
527
  success: false
507
528
  }));
508
- case 44:
509
- _context2.next = 46;
529
+ case 47:
530
+ _context2.next = 49;
510
531
  return _this5.getDeviceIdAndLog();
511
- case 46:
532
+ case 49:
512
533
  envInfo.deviceId = _context2.sent;
513
- case 47:
534
+ case 50:
514
535
  _this5.AMSSDK.logger.logInfo({
515
536
  title: 'sdk_event_sdkQuery'
516
537
  }, {
517
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
518
- requestBody: params
538
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
519
539
  }).send();
520
540
  queryPaymentInfo(params, {
521
541
  env: _this5.AMSSDK.options.env.environment,
@@ -526,12 +546,6 @@ var ComponentApp = /*#__PURE__*/function () {
526
546
  value: Date.now()
527
547
  });
528
548
  resolve(res);
529
- _this5.AMSSDK.logger.logInfo({
530
- title: 'sdk_event_sdkQueryEnd'
531
- }, {
532
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
533
- responseBody: res
534
- }).send();
535
549
  }).catch(function (err) {
536
550
  if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
537
551
  return resolve({
@@ -541,15 +555,15 @@ var ComponentApp = /*#__PURE__*/function () {
541
555
  _this5.dispatchToSDK(EVENT.error.name, {
542
556
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
543
557
  });
544
- _this5.AMSSDK.logger.logError({
545
- title: 'sdk_event_sdkQuery_failed'
558
+ reject(err);
559
+ }).finally(function () {
560
+ _this5.AMSSDK.logger.logInfo({
561
+ title: 'sdk_event_sdkQueryEnd'
546
562
  }, {
547
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
548
- errorReason: err
563
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
549
564
  }).send();
550
- reject(err);
551
565
  });
552
- case 49:
566
+ case 52:
553
567
  case "end":
554
568
  return _context2.stop();
555
569
  }
@@ -566,46 +580,63 @@ var ComponentApp = /*#__PURE__*/function () {
566
580
  }, {
567
581
  key: "createSubmitPromise",
568
582
  value: function createSubmitPromise() {
569
- var _this$_renderParams5,
570
- _this$_renderParams6,
583
+ var _this$_renderParams6,
584
+ _this$_renderParams7,
585
+ _this$_renderParams8,
571
586
  _this6 = this;
572
587
  this._performanceData.push({
573
588
  key: 'sdk_submit_start',
574
589
  value: Date.now()
575
590
  });
576
591
  var params = {
577
- paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
578
- 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
592
+ paymentSessionData: this._renderParams && ((_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.sessionData) || '',
593
+ paymentSessionConfig: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 || (_this$_renderParams7 = _this$_renderParams7.paymentSessionMetaData) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionConfig
579
594
  };
580
-
595
+ var channelBehavior = getChannelBehavior((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.paymentSessionMetaData);
581
596
  // eslint-disable-next-line no-async-promise-executor
582
597
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
583
598
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
584
- var _this6$_renderParams;
599
+ var _channelBehavior$buil, _this6$_renderParams$;
600
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, extParams;
585
601
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
586
602
  while (1) switch (_context3.prev = _context3.next) {
587
603
  case 0:
588
- if (!(!((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign)) {
589
- _context3.next = 2;
604
+ shouldSkipSubmitPayInSDK = false;
605
+ if (channelBehavior) {
606
+ // 新逻辑走 channelBehavior判断
607
+ shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
608
+ } else {
609
+ shouldSkipSubmitPayInSDK = !((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign;
610
+ }
611
+ if (!shouldSkipSubmitPayInSDK) {
612
+ _context3.next = 4;
590
613
  break;
591
614
  }
592
615
  return _context3.abrupt("return", resolve({
593
616
  message: 'sdk no need to make submitPay request',
594
617
  success: true
595
618
  }));
596
- case 2:
619
+ case 4:
597
620
  _this6.AMSSDK.logger.logInfo({
598
621
  title: 'sdk_event_submitPay'
599
622
  }, {
600
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
601
- requestBody: params
623
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
602
624
  }).send();
625
+ extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
626
+ instanceId: _this6.AMSSDK._instanceId,
627
+ locale: _this6.AMSSDK.options.locale,
628
+ paymentMethodType: (_this6$_renderParams$ = _this6._renderParams.paymentSessionMetaData) === null || _this6$_renderParams$ === void 0 || (_this6$_renderParams$ = _this6$_renderParams$.paymentMethodInfoView) === null || _this6$_renderParams$ === void 0 ? void 0 : _this6$_renderParams$.paymentMethodType,
629
+ paymentSessionData: _this6._renderParams.sessionData,
630
+ env: _this6.AMSSDK.options.env.environment,
631
+ sdkVersion: _this6._appVersion
632
+ })) || {};
633
+ params.extParams = extParams;
603
634
  _context3.t0 = submitPayInfo;
604
635
  _context3.t1 = params;
605
636
  _context3.t2 = _this6.AMSSDK.options.env.environment;
606
- _context3.next = 8;
637
+ _context3.next = 12;
607
638
  return _this6.getDeviceIdAndLog();
608
- case 8:
639
+ case 12:
609
640
  _context3.t3 = _context3.sent;
610
641
  _context3.t4 = {
611
642
  deviceId: _context3.t3
@@ -621,25 +652,23 @@ var ComponentApp = /*#__PURE__*/function () {
621
652
  key: 'sdk_submit_end',
622
653
  value: Date.now()
623
654
  });
655
+ if (res !== null && res !== void 0 && res.success) {
656
+ resolve(res);
657
+ } else {
658
+ resolve(res);
659
+ }
660
+ }).catch(function () {
661
+ resolve({
662
+ success: false
663
+ });
664
+ }).finally(function () {
624
665
  _this6.AMSSDK.logger.logInfo({
625
666
  title: 'sdk_event_submitPayEnd'
626
667
  }, {
627
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
628
- responseBody: res
629
- }).send();
630
- resolve(res);
631
- }).catch(function (err) {
632
- _this6.AMSSDK.logger.logError({
633
- title: 'sdk_event_submitPay_failed'
634
- }, {
635
- paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
636
- responseBody: err
668
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
637
669
  }).send();
638
- resolve({
639
- success: false
640
- });
641
670
  });
642
- case 13:
671
+ case 17:
643
672
  case "end":
644
673
  return _context3.stop();
645
674
  }
@@ -693,7 +722,6 @@ var ComponentApp = /*#__PURE__*/function () {
693
722
  analytics: {
694
723
  enabled: false
695
724
  },
696
- productScene: componentSign,
697
725
  productSceneVersion: productSceneVersion,
698
726
  environment: this.AMSSDK.options.env.environment,
699
727
  // TODO 确定一下这个参数是干啥的
@@ -701,8 +729,7 @@ var ComponentApp = /*#__PURE__*/function () {
701
729
  extendInfo: '',
702
730
  locale: '',
703
731
  instanceId: '',
704
- isPreload: 'true',
705
- mid: ''
732
+ isPreload: 'true'
706
733
  }),
707
734
  path = _getIframeUrl.path,
708
735
  locationSearch = _getIframeUrl.locationSearch;
@@ -732,20 +759,16 @@ var ComponentApp = /*#__PURE__*/function () {
732
759
  value: Date.now()
733
760
  });
734
761
  try {
735
- var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4;
762
+ var _renderParams$payment, _renderParams$payment2;
736
763
  var productSceneVersion = (renderParams === null || renderParams === void 0 || (_renderParams$payment = renderParams.paymentSessionMetaData) === null || _renderParams$payment === void 0 || (_renderParams$payment = _renderParams$payment.paymentSessionConfig) === null || _renderParams$payment === void 0 ? void 0 : _renderParams$payment.productSceneVersion) || '';
737
- var productScene = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 || (_renderParams$payment2 = _renderParams$payment2.paymentSessionConfig) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.productScene) || '';
738
- var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment3 = renderParams.paymentSessionMetaData) === null || _renderParams$payment3 === void 0 ? void 0 : _renderParams$payment3.extendInfo) || '';
739
- var mid = renderParams === null || renderParams === void 0 || (_renderParams$payment4 = renderParams.paymentSessionMetaData) === null || _renderParams$payment4 === void 0 ? void 0 : _renderParams$payment4.clientId;
764
+ var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.extendInfo) || '';
740
765
  var environment = this.AMSSDK.options.env.environment;
741
766
  this.appDomain = getAppDomain({
742
767
  environment: environment,
743
768
  appVersion: this._appVersion,
744
769
  componentSign: this._componentSign,
745
- productScene: productScene,
746
770
  productSceneVersion: productSceneVersion,
747
- extendInfo: extendInfo,
748
- mid: mid
771
+ extendInfo: extendInfo
749
772
  });
750
773
  this.app = createIframe(this.AMSSDK.options.mode, this.platform);
751
774
  var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
@@ -753,15 +776,13 @@ var ComponentApp = /*#__PURE__*/function () {
753
776
  renderDisplayType: renderParams.renderDisplayType,
754
777
  componentSign: this._componentSign,
755
778
  analytics: this.AMSSDK.options.analytics,
756
- productScene: productScene,
757
779
  productSceneVersion: productSceneVersion,
758
780
  environment: environment,
759
781
  appVersion: this._appVersion,
760
782
  extendInfo: extendInfo,
761
783
  locale: this.AMSSDK.options.locale,
762
784
  instanceId: this.AMSSDK._instanceId,
763
- hostSign: hostSign,
764
- mid: mid
785
+ hostSign: hostSign
765
786
  }),
766
787
  path = _getIframeUrl2.path,
767
788
  locationSearch = _getIframeUrl2.locationSearch;
@@ -1396,7 +1417,7 @@ var ComponentApp = /*#__PURE__*/function () {
1396
1417
  key: "sendRenderEvent",
1397
1418
  value: (function () {
1398
1419
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1399
- 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;
1420
+ var _this$_renderParams9, _this$_renderParams10, _this$_renderParams11, _this$_renderParams12, _this$_renderParams13, res, submitRes;
1400
1421
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1401
1422
  while (1) switch (_context8.prev = _context8.next) {
1402
1423
  case 0:
@@ -1425,29 +1446,17 @@ var ComponentApp = /*#__PURE__*/function () {
1425
1446
  data: {
1426
1447
  queryResult: res,
1427
1448
  submitResult: submitRes,
1428
- sessionResult: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData,
1429
- paymentSessionData: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.sessionData,
1449
+ sessionResult: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.paymentSessionMetaData,
1450
+ paymentSessionData: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.sessionData,
1430
1451
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1431
- renderDisplayType: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.renderDisplayType,
1432
- appearance: (_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.appearance,
1433
- notRedirectAfterComplete: ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.notRedirectAfterComplete) === true,
1452
+ renderDisplayType: (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.renderDisplayType,
1453
+ appearance: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.appearance,
1454
+ notRedirectAfterComplete: ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.notRedirectAfterComplete) === true,
1434
1455
  merchantAppointParam: this._merchantAppointParam,
1435
1456
  envInfo: {
1436
1457
  screenHeight: screen.height,
1437
1458
  screenWidth: screen.width
1438
- },
1439
- logMetaData: _objectSpread(_objectSpread({
1440
- trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
1441
- platform: this.platform,
1442
- firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1443
- }, ((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig) || {}), {}, {
1444
- renderDisplayType: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.renderDisplayType,
1445
- sdkVersion: this._appVersion,
1446
- 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,
1447
- instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1448
- performanceData: this._performanceData,
1449
- 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
1450
- })
1459
+ }
1451
1460
  }
1452
1461
  }
1453
1462
  }, null, true);
@@ -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
  /**
@@ -91,9 +91,9 @@ function _request() {
91
91
  if (envInfo.terminalType === 'WAP') envInfo.osType = device.iOS ? 'IOS' : 'ANDROID';
92
92
  _data = [_objectSpread(_objectSpread({}, requestData), {}, {
93
93
  envInfo: envInfo,
94
- extParams: {
94
+ extParams: _objectSpread(_objectSpread({}, requestData === null || requestData === void 0 ? void 0 : requestData.extParams), {}, {
95
95
  refUrl: window.location.href
96
- }
96
+ })
97
97
  })];
98
98
  startTime = Date.now();
99
99
  _context.prev = 5;