@alipay/ams-checkout 0.0.1715248982-dev.0 → 0.0.1716362599-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.
@@ -25,6 +25,7 @@ import { getType, isJsonString, isPC } from "../../util";
25
25
  import { isLocalMock } from "../../util/mock";
26
26
  import { matchVersion } from "../../util/versionCompare";
27
27
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
28
+ import { getChannelBehavior } from "./channel";
28
29
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
29
30
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
30
31
  import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
@@ -46,6 +47,7 @@ var ComponentApp = /*#__PURE__*/function () {
46
47
  _defineProperty(this, "_selector", void 0);
47
48
  _defineProperty(this, "_appVersion", void 0);
48
49
  _defineProperty(this, "_isRetention", void 0);
50
+ _defineProperty(this, "_allowSubmitPayCallAhead", void 0);
49
51
  _defineProperty(this, "_actionQueryPromise", null);
50
52
  _defineProperty(this, "_actionSubmitPromise", null);
51
53
  _defineProperty(this, "_renderParams", null);
@@ -55,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
55
57
  _defineProperty(this, "_multipleCallbackEvents", void 0);
56
58
  _defineProperty(this, "_merchantAppointParam", void 0);
57
59
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
58
- this._appVersion = '1.14.0.0';
60
+ this._appVersion = '1.18.0';
59
61
  this._isInitComponent = false;
60
62
  this._selector = "#".concat(COMPONENT_SECTION_ID);
61
63
  this.createIframeNode = function () {
@@ -112,7 +114,7 @@ var ComponentApp = /*#__PURE__*/function () {
112
114
  productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
113
115
  paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
114
116
  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,
117
+ requestSeq: (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.sessionData,
116
118
  trackId: (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData
117
119
  });
118
120
  }
@@ -246,6 +248,10 @@ var ComponentApp = /*#__PURE__*/function () {
246
248
  key: "appendIframeNodes",
247
249
  value: function appendIframeNodes(componentSign, renderParams) {
248
250
  var _renderParams,
251
+ _this$_renderParams5,
252
+ _this$_renderParams6,
253
+ _this$_renderParams7,
254
+ _this$_renderParams8,
249
255
  _this3 = this;
250
256
  if (this._isInitComponent) {
251
257
  this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
@@ -265,6 +271,61 @@ var ComponentApp = /*#__PURE__*/function () {
265
271
  key: 'sdk_create_component',
266
272
  value: Date.now()
267
273
  });
274
+ var params = {
275
+ paymentSessionData: this._renderParams && ((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData) || '',
276
+ 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
277
+ };
278
+ var _ref2 = params.paymentSessionConfig || {},
279
+ _ref2$productSceneVer = _ref2.productSceneVersion,
280
+ productSceneVersion = _ref2$productSceneVer === void 0 ? '' : _ref2$productSceneVer,
281
+ _ref2$productScene = _ref2.productScene,
282
+ productScene = _ref2$productScene === void 0 ? '' : _ref2$productScene;
283
+ var _ref3 = ((_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.paymentSessionMetaData) || {},
284
+ _ref3$action = _ref3.action,
285
+ _ref3$action2 = _ref3$action === void 0 ? {} : _ref3$action,
286
+ _ref3$action2$autoDeb = _ref3$action2.autoDebitWithToken,
287
+ autoDebitWithToken = _ref3$action2$autoDeb === void 0 ? false : _ref3$action2$autoDeb,
288
+ _ref3$action2$require = _ref3$action2.requireFastSdk,
289
+ requireFastSdk = _ref3$action2$require === void 0 ? false : _ref3$action2$require;
290
+ var _ref4 = ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.paymentSessionMetaData) || {},
291
+ _ref4$authUrlInfo = _ref4.authUrlInfo,
292
+ authUrlInfo = _ref4$authUrlInfo === void 0 ? {} : _ref4$authUrlInfo;
293
+ this.AMSSDK.logger.logInfo({
294
+ title: 'sdk_event_createComponent'
295
+ }, {
296
+ version: productSceneVersion,
297
+ product: this.AMSSDK.options.product
298
+ }).send();
299
+ if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
300
+ if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
301
+ // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
302
+ this.handleAuthUrlInfo(authUrlInfo);
303
+ return;
304
+ }
305
+ }
306
+ if (componentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
307
+ var _this$_renderParams9, _action$web, _action$wap;
308
+ var action = ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 || (_this$_renderParams9 = _this$_renderParams9.paymentSessionMetaData) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.action) || {};
309
+ var 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;
310
+ var _requireFastSdk = (action === null || action === void 0 ? void 0 : action.requireFastSdk) || false;
311
+ if (signType === 'REDIRECT' && _requireFastSdk === true) {
312
+ // REDIRECT,requireFastSdk为true,不需要接口请求
313
+ this.handleAuthUrlInfo(authUrlInfo);
314
+ return;
315
+ }
316
+ }
317
+ if (componentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
318
+ if (requireFastSdk === true && productSceneVersion === '1.0') {
319
+ // REDIRECT,requireFastSdk为true,不需要接口请求
320
+ this.handleAuthUrlInfo(authUrlInfo);
321
+ return;
322
+ } else {
323
+ return Promise.reject({
324
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
325
+ message: "Abnormal response data, interface failure, or unsupported payment method."
326
+ });
327
+ }
328
+ }
268
329
  this.dispatchToSDK(EVENT.eventCallback.name, {
269
330
  code: eventCodeEnum.SDK_START_OF_LOADING
270
331
  });
@@ -274,9 +335,18 @@ var ComponentApp = /*#__PURE__*/function () {
274
335
  insertStyleSheet();
275
336
  }
276
337
  if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
338
+ var _this$_renderParams10;
277
339
  createBaseElement(this.platform, this.closeBtnFunc.bind(this));
278
340
  createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
279
- createMockup();
341
+ var channelBehavior = getChannelBehavior((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.paymentSessionMetaData);
342
+ var onClickOutside = function onClickOutside() {};
343
+ if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
344
+ onClickOutside = this.closeBtnFunc.bind(this);
345
+ }
346
+ createMockup({
347
+ platform: this.platform,
348
+ onClickOutside: onClickOutside
349
+ });
280
350
  this.renderPopupLoading(renderParams);
281
351
  }
282
352
  this.createApp(renderParams);
@@ -356,17 +426,18 @@ var ComponentApp = /*#__PURE__*/function () {
356
426
  }, {
357
427
  key: "createActionQueryPromise",
358
428
  value: function createActionQueryPromise() {
359
- var _this5 = this;
429
+ var _this$_renderParams11,
430
+ _this5 = this;
431
+ var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
360
432
  this._performanceData.push({
361
433
  key: 'sdk_action_query_start',
362
434
  value: Date.now()
363
435
  });
364
-
365
436
  // eslint-disable-next-line no-async-promise-executor
366
437
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
367
- 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;
438
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
439
+ var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
440
+ var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
370
441
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
371
442
  while (1) switch (_context2.prev = _context2.next) {
372
443
  case 0:
@@ -382,10 +453,10 @@ var ComponentApp = /*#__PURE__*/function () {
382
453
  /**
383
454
  * @description Simulated or unnecessary scenarios
384
455
  */
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;
456
+ _ref6 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref6$extendInfo = _ref6.extendInfo, extendInfo = _ref6$extendInfo === void 0 ? '' : _ref6$extendInfo, actionData = _ref6.action;
386
457
  enableVaultingApiOptimize = false;
387
458
  enableEasypayApiOptimize = false;
388
- _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;
459
+ _ref7 = ((_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 = _ref7.skipSdkQuery, skipSdkQueryForm = _ref7.skipSdkQueryForm;
389
460
  try {
390
461
  extendInfoData = JSON.parse(extendInfo);
391
462
  enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
@@ -439,78 +510,89 @@ var ComponentApp = /*#__PURE__*/function () {
439
510
  });
440
511
  return _context2.abrupt("return");
441
512
  case 21:
513
+ channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
514
+ if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
515
+ _context2.next = 24;
516
+ break;
517
+ }
518
+ return _context2.abrupt("return", resolve({
519
+ autoDebitWithToken: actionData === null || actionData === void 0 ? void 0 : actionData.autoDebitWithToken,
520
+ amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
521
+ success: true
522
+ }));
523
+ case 24:
442
524
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
443
- _context2.next = 27;
525
+ _context2.next = 30;
444
526
  break;
445
527
  }
446
528
  params.paymentMethodType = 'CARD';
447
- _context2.next = 25;
529
+ _context2.next = 28;
448
530
  return _this5.getDeviceIdAndLog();
449
- case 25:
531
+ case 28:
450
532
  envInfo.deviceId = _context2.sent;
451
533
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
452
534
  envInfo.extendInfo = {
453
535
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
454
536
  };
455
537
  }
456
- case 27:
538
+ case 30:
457
539
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
458
- _context2.next = 37;
540
+ _context2.next = 40;
459
541
  break;
460
542
  }
461
- _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;
543
+ _ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
544
+ _ref9 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$autoDeb = _ref9$action2.autoDebitWithToken, autoDebitWithToken = _ref9$action2$autoDeb === void 0 ? false : _ref9$action2$autoDeb;
545
+ 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)) {
546
+ _context2.next = 35;
465
547
  break;
466
548
  }
467
549
  return _context2.abrupt("return", resolve({
468
550
  message: 'sdk no need to make query request',
469
551
  success: true
470
552
  }));
471
- case 32:
472
- if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
473
- _context2.next = 34;
553
+ case 35:
554
+ if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
555
+ _context2.next = 37;
474
556
  break;
475
557
  }
476
558
  return _context2.abrupt("return", resolve({
477
559
  message: 'sdk no need to make query request',
478
560
  success: true
479
561
  }));
480
- case 34:
481
- _context2.next = 36;
562
+ case 37:
563
+ _context2.next = 39;
482
564
  return _this5.getDeviceIdAndLog();
483
- case 36:
565
+ case 39:
484
566
  envInfo.deviceId = _context2.sent;
485
- case 37:
567
+ case 40:
486
568
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
487
- _context2.next = 47;
569
+ _context2.next = 50;
488
570
  break;
489
571
  }
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) || {};
491
- 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;
572
+ 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) || {};
573
+ signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
492
574
  if (!(signType === 'SMS')) {
493
- _context2.next = 42;
575
+ _context2.next = 45;
494
576
  break;
495
577
  }
496
578
  return _context2.abrupt("return", resolve({
497
579
  message: 'sdk no need to make query request',
498
580
  success: true
499
581
  }));
500
- case 42:
582
+ case 45:
501
583
  if (!(!signType || signType !== 'REDIRECT')) {
502
- _context2.next = 44;
584
+ _context2.next = 47;
503
585
  break;
504
586
  }
505
587
  return _context2.abrupt("return", resolve({
506
588
  success: false
507
589
  }));
508
- case 44:
509
- _context2.next = 46;
590
+ case 47:
591
+ _context2.next = 49;
510
592
  return _this5.getDeviceIdAndLog();
511
- case 46:
593
+ case 49:
512
594
  envInfo.deviceId = _context2.sent;
513
- case 47:
595
+ case 50:
514
596
  _this5.AMSSDK.logger.logInfo({
515
597
  title: 'sdk_event_sdkQuery'
516
598
  }, {
@@ -549,14 +631,14 @@ var ComponentApp = /*#__PURE__*/function () {
549
631
  }).send();
550
632
  reject(err);
551
633
  });
552
- case 49:
634
+ case 52:
553
635
  case "end":
554
636
  return _context2.stop();
555
637
  }
556
638
  }, _callee2);
557
639
  }));
558
640
  return function (_x, _x2) {
559
- return _ref2.apply(this, arguments);
641
+ return _ref5.apply(this, arguments);
560
642
  };
561
643
  }());
562
644
  return this._actionQueryPromise;
@@ -566,46 +648,74 @@ var ComponentApp = /*#__PURE__*/function () {
566
648
  }, {
567
649
  key: "createSubmitPromise",
568
650
  value: function createSubmitPromise() {
569
- var _this$_renderParams5,
570
- _this$_renderParams6,
651
+ var _this$_renderParams12,
652
+ _this$_renderParams13,
653
+ _this$_renderParams14,
571
654
  _this6 = this;
572
655
  this._performanceData.push({
573
656
  key: 'sdk_submit_start',
574
657
  value: Date.now()
575
658
  });
576
659
  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
660
+ paymentSessionData: this._renderParams && ((_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData) || '',
661
+ paymentSessionConfig: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig
579
662
  };
580
-
663
+ var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
581
664
  // eslint-disable-next-line no-async-promise-executor
582
665
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
583
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
584
- var _this6$_renderParams;
666
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
667
+ var _channelBehavior$buil, _this6$_renderParams$;
668
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
585
669
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
586
670
  while (1) switch (_context3.prev = _context3.next) {
587
671
  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;
672
+ shouldSkipSubmitPayInSDK = false;
673
+ if (channelBehavior) {
674
+ // 新逻辑走 channelBehavior判断
675
+ shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
676
+ } else {
677
+ 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;
678
+ }
679
+ if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
680
+ _ref11 = params.paymentSessionConfig || {}, _ref11$productSceneVe = _ref11.productSceneVersion, productSceneVersion = _ref11$productSceneVe === void 0 ? '' : _ref11$productSceneVe, _ref11$productScene = _ref11.productScene, productScene = _ref11$productScene === void 0 ? '' : _ref11$productScene;
681
+ _ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
682
+ if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
683
+ ///EasyPay 2.0 首次传signAgreement字段
684
+ params['signAgreement'] = enableSignAgreement;
685
+ }
686
+ }
687
+ // 带上标记告知WebCheckOut SDK已发送submitpay请求
688
+ _this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
689
+ if (!shouldSkipSubmitPayInSDK) {
690
+ _context3.next = 6;
590
691
  break;
591
692
  }
592
693
  return _context3.abrupt("return", resolve({
593
694
  message: 'sdk no need to make submitPay request',
594
695
  success: true
595
696
  }));
596
- case 2:
697
+ case 6:
597
698
  _this6.AMSSDK.logger.logInfo({
598
699
  title: 'sdk_event_submitPay'
599
700
  }, {
600
701
  paymentSessionConfig: JSON.stringify(params.paymentSessionConfig),
601
702
  requestBody: params
602
703
  }).send();
704
+ extParams = (channelBehavior === null || channelBehavior === void 0 || (_channelBehavior$buil = channelBehavior.buildSubmitPayExtParams) === null || _channelBehavior$buil === void 0 ? void 0 : _channelBehavior$buil.call(channelBehavior, {
705
+ instanceId: _this6.AMSSDK._instanceId,
706
+ locale: _this6.AMSSDK.options.locale,
707
+ 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,
708
+ paymentSessionData: _this6._renderParams.sessionData,
709
+ env: _this6.AMSSDK.options.env.environment,
710
+ sdkVersion: _this6._appVersion
711
+ })) || {};
712
+ params.extParams = extParams;
603
713
  _context3.t0 = submitPayInfo;
604
714
  _context3.t1 = params;
605
715
  _context3.t2 = _this6.AMSSDK.options.env.environment;
606
- _context3.next = 8;
716
+ _context3.next = 14;
607
717
  return _this6.getDeviceIdAndLog();
608
- case 8:
718
+ case 14:
609
719
  _context3.t3 = _context3.sent;
610
720
  _context3.t4 = {
611
721
  deviceId: _context3.t3
@@ -639,14 +749,14 @@ var ComponentApp = /*#__PURE__*/function () {
639
749
  success: false
640
750
  });
641
751
  });
642
- case 13:
752
+ case 19:
643
753
  case "end":
644
754
  return _context3.stop();
645
755
  }
646
756
  }, _callee3);
647
757
  }));
648
758
  return function (_x3) {
649
- return _ref7.apply(this, arguments);
759
+ return _ref10.apply(this, arguments);
650
760
  };
651
761
  }());
652
762
  }
@@ -766,8 +876,13 @@ var ComponentApp = /*#__PURE__*/function () {
766
876
  path = _getIframeUrl2.path,
767
877
  locationSearch = _getIframeUrl2.locationSearch;
768
878
  this._appLocationSearch = locationSearch;
769
- this.app.src = "".concat(path, "?").concat(locationSearch);
770
-
879
+ // locationSearch 是一个序列化好的字符串
880
+ // 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
881
+ if (path.indexOf('?') !== -1) {
882
+ this.app.src = "".concat(path, "&").concat(locationSearch);
883
+ } else {
884
+ this.app.src = "".concat(path, "?").concat(locationSearch);
885
+ }
771
886
  // Subscribe to messages from iframe
772
887
  this.addEventListener();
773
888
  } catch (error) {
@@ -782,7 +897,12 @@ var ComponentApp = /*#__PURE__*/function () {
782
897
  }, {
783
898
  key: "listener",
784
899
  value: function listener(e) {
900
+ var _e$data;
785
901
  if (e.origin !== this.appDomain) return;
902
+ if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.source) === 'react-devtools-content-script') {
903
+ // 防止 react 开发工具发的消息,非常频繁影响查看日志
904
+ return;
905
+ }
786
906
  var isJson = isJsonString(e.data);
787
907
  if (isJson) {
788
908
  var data = JSON.parse(e.data);
@@ -1162,11 +1282,31 @@ var ComponentApp = /*#__PURE__*/function () {
1162
1282
  this.app.style.height = "".concat(data.context.data.height, "px");
1163
1283
  }
1164
1284
  }
1285
+ }, {
1286
+ key: "handleAuthUrlInfo",
1287
+ value: function handleAuthUrlInfo(authUrlInfo) {
1288
+ var data = {};
1289
+ if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
1290
+ data = {
1291
+ normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
1292
+ schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
1293
+ applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
1294
+ };
1295
+ } else {
1296
+ data = {
1297
+ normalUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
1298
+ schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
1299
+ applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
1300
+ };
1301
+ }
1302
+ this.handleRedirect(data, true);
1303
+ }
1165
1304
  }, {
1166
1305
  key: "handleRedirect",
1167
1306
  value: function handleRedirect(data) {
1168
1307
  var _data$isDestroy,
1169
1308
  _this7 = this;
1309
+ var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1170
1310
  var _data = typeof data === 'string' ? {
1171
1311
  normalUrl: data
1172
1312
  } : _objectSpread(_objectSpread({}, data), {}, {
@@ -1189,7 +1329,8 @@ var ComponentApp = /*#__PURE__*/function () {
1189
1329
  }, {
1190
1330
  redirectInfo: JSON.stringify(_data),
1191
1331
  openType: type,
1192
- url: url
1332
+ url: url,
1333
+ fromFastSdk: fromFastSdk
1193
1334
  }).send();
1194
1335
  };
1195
1336
  var failCallback = function failCallback(type, url) {
@@ -1202,7 +1343,8 @@ var ComponentApp = /*#__PURE__*/function () {
1202
1343
  }, {
1203
1344
  redirectInfo: JSON.stringify(_data),
1204
1345
  openType: type,
1205
- url: url
1346
+ url: url,
1347
+ fromFastSdk: fromFastSdk
1206
1348
  }).send();
1207
1349
  };
1208
1350
 
@@ -1245,9 +1387,9 @@ var ComponentApp = /*#__PURE__*/function () {
1245
1387
  }
1246
1388
  }, {
1247
1389
  key: "handleDeclareInfo",
1248
- value: function handleDeclareInfo(_ref8) {
1249
- var _ref8$closeDialogData = _ref8.closeDialogData,
1250
- closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
1390
+ value: function handleDeclareInfo(_ref13) {
1391
+ var _ref13$closeDialogDat = _ref13.closeDialogData,
1392
+ closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
1251
1393
  _handleDeclareInfo({
1252
1394
  closeDialogData: closeDialogData
1253
1395
  });
@@ -1348,20 +1490,12 @@ var ComponentApp = /*#__PURE__*/function () {
1348
1490
  key: "dispatchToApp",
1349
1491
  value: function dispatchToApp(payload) {
1350
1492
  var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1351
- var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1352
1493
  var data = Object.assign({}, payload, {
1353
1494
  name: messageName.SDK_TO_APP,
1354
1495
  mode: this.AMSSDK.options.mode,
1355
1496
  appId: COMPONENTPLUGINID,
1356
1497
  instanceId: this.AMSSDK._instanceId
1357
1498
  });
1358
- if (sendLog) {
1359
- this.AMSSDK.logger.logInfo({
1360
- title: 'sdk_event_send_message_to_web'
1361
- }, {
1362
- event: data === null || data === void 0 ? void 0 : data.context.event
1363
- }).send();
1364
- }
1365
1499
  if (targetElement && targetElement.contentWindow) {
1366
1500
  return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
1367
1501
  }
@@ -1396,7 +1530,7 @@ var ComponentApp = /*#__PURE__*/function () {
1396
1530
  key: "sendRenderEvent",
1397
1531
  value: (function () {
1398
1532
  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;
1533
+ var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
1400
1534
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1401
1535
  while (1) switch (_context8.prev = _context8.next) {
1402
1536
  case 0:
@@ -1425,32 +1559,33 @@ var ComponentApp = /*#__PURE__*/function () {
1425
1559
  data: {
1426
1560
  queryResult: res,
1427
1561
  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,
1562
+ sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
1563
+ paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
1430
1564
  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,
1565
+ renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
1566
+ appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
1567
+ notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1434
1568
  merchantAppointParam: this._merchantAppointParam,
1569
+ allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1435
1570
  envInfo: {
1436
1571
  screenHeight: screen.height,
1437
1572
  screenWidth: screen.width
1438
1573
  },
1439
1574
  logMetaData: _objectSpread(_objectSpread({
1440
- trackId: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData,
1575
+ trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
1441
1576
  platform: this.platform,
1442
1577
  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,
1578
+ }, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
1579
+ renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
1445
1580
  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,
1581
+ merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
1447
1582
  instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1448
1583
  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
1584
+ paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
1450
1585
  })
1451
1586
  }
1452
1587
  }
1453
- }, null, true);
1588
+ }, null);
1454
1589
  this.AMSSDK.logger.logInfo({
1455
1590
  title: 'sdk_event_renderComponent'
1456
1591
  });
@@ -1489,9 +1624,6 @@ var ComponentApp = /*#__PURE__*/function () {
1489
1624
  var _document$getElementB4,
1490
1625
  _this9 = this;
1491
1626
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1492
- this.AMSSDK.logger.logInfo({
1493
- title: 'sdk_event_clean_component'
1494
- }).send();
1495
1627
  (_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1496
1628
  this.hideComponentAnimation();
1497
1629
  var mockup = document.getElementById(MOCKUP_ID);
@@ -124,7 +124,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
124
124
  locale: locale,
125
125
  'client-id': channelMerchantAccountId
126
126
  });
127
- var disableFundingArr = [];
127
+ var disableFundingArr = ['bancontact', 'blik', 'eps', 'giropay', 'ideal', 'mercadopago', 'mybank', 'p24', 'sepa', 'sofort'];
128
128
  if (blockPayPalCreditButton && !displayPayPalPayLaterButtonOnly) {
129
129
  disableFundingArr.push('card');
130
130
  }
@@ -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;