@alipay/ams-checkout 0.0.1720491429-dev.1 → 0.0.1720509876-dev.1

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.
@@ -27,7 +27,8 @@ import { matchVersion } from "../../util/versionCompare";
27
27
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
28
28
  import { getChannelBehavior } from "./channel";
29
29
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
30
- import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
30
+ import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
31
+ import { handlePaymentSessionConfig } from "../payment-element/utils";
31
32
  import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
32
33
  window.changingPageHeight = window.innerHeight;
33
34
  var ComponentApp = /*#__PURE__*/function () {
@@ -57,7 +58,7 @@ var ComponentApp = /*#__PURE__*/function () {
57
58
  _defineProperty(this, "_multipleCallbackEvents", void 0);
58
59
  _defineProperty(this, "_merchantAppointParam", void 0);
59
60
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
60
- this._appVersion = '1.18.0';
61
+ this._appVersion = '1.20.0';
61
62
  this._isInitComponent = false;
62
63
  this._selector = "#".concat(COMPONENT_SECTION_ID);
63
64
  this.createIframeNode = function () {
@@ -298,7 +299,7 @@ var ComponentApp = /*#__PURE__*/function () {
298
299
  }).send();
299
300
  if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
300
301
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
301
- // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
302
+ // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
302
303
  this.handleAuthUrlInfo(authUrlInfo);
303
304
  return;
304
305
  }
@@ -314,18 +315,6 @@ var ComponentApp = /*#__PURE__*/function () {
314
315
  return;
315
316
  }
316
317
  }
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
- }
329
318
  this.dispatchToSDK(EVENT.eventCallback.name, {
330
319
  code: eventCodeEnum.SDK_START_OF_LOADING
331
320
  });
@@ -426,18 +415,17 @@ var ComponentApp = /*#__PURE__*/function () {
426
415
  }, {
427
416
  key: "createActionQueryPromise",
428
417
  value: function createActionQueryPromise() {
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;
418
+ var _this5 = this;
432
419
  this._performanceData.push({
433
420
  key: 'sdk_action_query_start',
434
421
  value: Date.now()
435
422
  });
423
+
436
424
  // eslint-disable-next-line no-async-promise-executor
437
425
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
438
426
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
439
427
  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;
428
+ var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$_renderParams8, _action$web2, _action$wap2, action, signType;
441
429
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
442
430
  while (1) switch (_context2.prev = _context2.next) {
443
431
  case 0:
@@ -473,22 +461,28 @@ var ComponentApp = /*#__PURE__*/function () {
473
461
  success: true
474
462
  }));
475
463
  case 9:
464
+ if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
465
+ params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
466
+ }
467
+
468
+ // 绑卡跳过actionQuery接口
469
+ // 目前只有绑卡加上 skipSdkQueryForm 判断
476
470
  if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
477
- _context2.next = 21;
471
+ _context2.next = 22;
478
472
  break;
479
473
  }
480
474
  if (!enableVaultingApiOptimize) {
481
- _context2.next = 21;
475
+ _context2.next = 22;
482
476
  break;
483
477
  }
484
478
  if (!skipSdkQueryForm) {
485
- _context2.next = 18;
479
+ _context2.next = 19;
486
480
  break;
487
481
  }
488
482
  // 优先判断 skipSdkQueryForm
489
483
  ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
490
484
  if (!ifSkip) {
491
- _context2.next = 16;
485
+ _context2.next = 17;
492
486
  break;
493
487
  }
494
488
  resolve({
@@ -496,12 +490,12 @@ var ComponentApp = /*#__PURE__*/function () {
496
490
  success: true
497
491
  });
498
492
  return _context2.abrupt("return");
499
- case 16:
500
- _context2.next = 21;
493
+ case 17:
494
+ _context2.next = 22;
501
495
  break;
502
- case 18:
496
+ case 19:
503
497
  if (!skipSdkQuery) {
504
- _context2.next = 21;
498
+ _context2.next = 22;
505
499
  break;
506
500
  }
507
501
  resolve({
@@ -509,10 +503,10 @@ var ComponentApp = /*#__PURE__*/function () {
509
503
  success: true
510
504
  });
511
505
  return _context2.abrupt("return");
512
- case 21:
506
+ case 22:
513
507
  channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
514
508
  if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
515
- _context2.next = 24;
509
+ _context2.next = 25;
516
510
  break;
517
511
  }
518
512
  return _context2.abrupt("return", resolve({
@@ -520,29 +514,28 @@ var ComponentApp = /*#__PURE__*/function () {
520
514
  amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
521
515
  success: true
522
516
  }));
523
- case 24:
517
+ case 25:
524
518
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
525
- _context2.next = 30;
519
+ _context2.next = 31;
526
520
  break;
527
521
  }
528
522
  params.paymentMethodType = 'CARD';
529
- _context2.next = 28;
523
+ _context2.next = 29;
530
524
  return _this5.getDeviceIdAndLog();
531
- case 28:
525
+ case 29:
532
526
  envInfo.deviceId = _context2.sent;
533
527
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
534
528
  envInfo.extendInfo = {
535
529
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
536
530
  };
537
531
  }
538
- case 30:
532
+ case 31:
539
533
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
540
534
  _context2.next = 40;
541
535
  break;
542
536
  }
543
537
  _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)) {
538
+ 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)) {
546
539
  _context2.next = 35;
547
540
  break;
548
541
  }
@@ -569,7 +562,7 @@ var ComponentApp = /*#__PURE__*/function () {
569
562
  _context2.next = 50;
570
563
  break;
571
564
  }
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) || {};
565
+ 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) || {};
573
566
  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;
574
567
  if (!(signType === 'SMS')) {
575
568
  _context2.next = 45;
@@ -648,24 +641,24 @@ var ComponentApp = /*#__PURE__*/function () {
648
641
  }, {
649
642
  key: "createSubmitPromise",
650
643
  value: function createSubmitPromise() {
651
- var _this$_renderParams12,
644
+ var _this$_renderParams11,
645
+ _this$_renderParams12,
652
646
  _this$_renderParams13,
653
- _this$_renderParams14,
654
647
  _this6 = this;
655
648
  this._performanceData.push({
656
649
  key: 'sdk_submit_start',
657
650
  value: Date.now()
658
651
  });
659
652
  var params = {
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
653
+ paymentSessionData: this._renderParams && ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.sessionData) || '',
654
+ paymentSessionConfig: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 || (_this$_renderParams12 = _this$_renderParams12.paymentSessionMetaData) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.paymentSessionConfig
662
655
  };
663
- var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
656
+ var channelBehavior = getChannelBehavior((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionMetaData);
664
657
  // eslint-disable-next-line no-async-promise-executor
665
658
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
666
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
659
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
667
660
  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;
661
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref10, _ref10$productSceneVe, productSceneVersion, _ref10$productScene, productScene, _ref11, _ref11$action, _ref11$action2, _ref11$action2$enable, enableSignAgreement, _ref11$action2$autoDe, autoDebitWithToken, extParams;
669
662
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
670
663
  while (1) switch (_context3.prev = _context3.next) {
671
664
  case 0:
@@ -677,8 +670,8 @@ var ComponentApp = /*#__PURE__*/function () {
677
670
  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
671
  }
679
672
  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;
673
+ _ref10 = params.paymentSessionConfig || {}, _ref10$productSceneVe = _ref10.productSceneVersion, productSceneVersion = _ref10$productSceneVe === void 0 ? '' : _ref10$productSceneVe, _ref10$productScene = _ref10.productScene, productScene = _ref10$productScene === void 0 ? '' : _ref10$productScene;
674
+ _ref11 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref11$action = _ref11.action, _ref11$action2 = _ref11$action === void 0 ? {} : _ref11$action, _ref11$action2$enable = _ref11$action2.enableSignAgreement, enableSignAgreement = _ref11$action2$enable === void 0 ? false : _ref11$action2$enable, _ref11$action2$autoDe = _ref11$action2.autoDebitWithToken, autoDebitWithToken = _ref11$action2$autoDe === void 0 ? false : _ref11$action2$autoDe;
682
675
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
683
676
  ///EasyPay 2.0 首次传signAgreement字段
684
677
  params['signAgreement'] = enableSignAgreement;
@@ -756,7 +749,7 @@ var ComponentApp = /*#__PURE__*/function () {
756
749
  }, _callee3);
757
750
  }));
758
751
  return function (_x3) {
759
- return _ref10.apply(this, arguments);
752
+ return _ref9.apply(this, arguments);
760
753
  };
761
754
  }());
762
755
  }
@@ -806,13 +799,9 @@ var ComponentApp = /*#__PURE__*/function () {
806
799
  productScene: componentSign,
807
800
  productSceneVersion: productSceneVersion,
808
801
  environment: this.AMSSDK.options.env.environment,
809
- // TODO 确定一下这个参数是干啥的
810
802
  appVersion: this._appVersion,
811
- extendInfo: '',
812
- locale: '',
813
803
  instanceId: '',
814
- isPreload: 'true',
815
- mid: ''
804
+ isPreload: 'true'
816
805
  }),
817
806
  path = _getIframeUrl.path,
818
807
  locationSearch = _getIframeUrl.locationSearch;
@@ -1255,9 +1244,8 @@ var ComponentApp = /*#__PURE__*/function () {
1255
1244
 
1256
1245
  // 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
1257
1246
  this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
1258
-
1259
1247
  // 弹出和弹入动画
1260
- var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
1248
+ var runkeyframes = slideInAndOutKeyframes(COMPONENT_CONTAINER_ID, data.context.data.height);
1261
1249
  // 创建style标签
1262
1250
  var style = document.createElement('style');
1263
1251
  style.id = animationStyleId;
@@ -1267,7 +1255,6 @@ var ComponentApp = /*#__PURE__*/function () {
1267
1255
  style.innerHTML = runkeyframes;
1268
1256
  // 将style样式存放到head标签
1269
1257
  document.getElementsByTagName('head')[0].appendChild(style);
1270
-
1271
1258
  // size变动时动画
1272
1259
  setTimeout(function () {
1273
1260
  cashier.style.transition = 'height 0.28s ease-in-out';
@@ -1387,9 +1374,9 @@ var ComponentApp = /*#__PURE__*/function () {
1387
1374
  }
1388
1375
  }, {
1389
1376
  key: "handleDeclareInfo",
1390
- value: function handleDeclareInfo(_ref13) {
1391
- var _ref13$closeDialogDat = _ref13.closeDialogData,
1392
- closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
1377
+ value: function handleDeclareInfo(_ref12) {
1378
+ var _ref12$closeDialogDat = _ref12.closeDialogData,
1379
+ closeDialogData = _ref12$closeDialogDat === void 0 ? {} : _ref12$closeDialogDat;
1393
1380
  _handleDeclareInfo({
1394
1381
  closeDialogData: closeDialogData
1395
1382
  });
@@ -1530,7 +1517,7 @@ var ComponentApp = /*#__PURE__*/function () {
1530
1517
  key: "sendRenderEvent",
1531
1518
  value: (function () {
1532
1519
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
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;
1520
+ var _this$_renderParams14, _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$AMSSDK$logger, _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$AMSSDK, _this$_renderParams23, res, submitRes;
1534
1521
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1535
1522
  while (1) switch (_context8.prev = _context8.next) {
1536
1523
  case 0:
@@ -1559,12 +1546,12 @@ var ComponentApp = /*#__PURE__*/function () {
1559
1546
  data: {
1560
1547
  queryResult: res,
1561
1548
  submitResult: submitRes,
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,
1549
+ sessionResult: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData,
1550
+ paymentSessionData: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.sessionData,
1564
1551
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
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,
1552
+ renderDisplayType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.renderDisplayType,
1553
+ appearance: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.appearance,
1554
+ notRedirectAfterComplete: ((_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.notRedirectAfterComplete) === true,
1568
1555
  merchantAppointParam: this._merchantAppointParam,
1569
1556
  allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1570
1557
  envInfo: {
@@ -1572,16 +1559,16 @@ var ComponentApp = /*#__PURE__*/function () {
1572
1559
  screenWidth: screen.width
1573
1560
  },
1574
1561
  logMetaData: _objectSpread(_objectSpread({
1575
- trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
1562
+ trackId: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.sessionData,
1576
1563
  platform: this.platform,
1577
1564
  firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
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,
1565
+ }, ((_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 || (_this$_renderParams20 = _this$_renderParams20.paymentSessionMetaData) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.paymentSessionConfig) || {}), {}, {
1566
+ renderDisplayType: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.renderDisplayType,
1580
1567
  sdkVersion: this._appVersion,
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,
1568
+ merchantId: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 || (_this$_renderParams22 = _this$_renderParams22.paymentSessionMetaData) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.clientId,
1582
1569
  instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1583
1570
  performanceData: this._performanceData,
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
1571
+ paymentMethodType: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentMethodInfoView) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.paymentMethodType
1585
1572
  })
1586
1573
  }
1587
1574
  }
@@ -1641,8 +1628,9 @@ var ComponentApp = /*#__PURE__*/function () {
1641
1628
  }, {
1642
1629
  key: "hideComponentAnimation",
1643
1630
  value: function hideComponentAnimation() {
1631
+ var _container$style;
1644
1632
  var container = document.getElementById(COMPONENT_CONTAINER_ID);
1645
- if (this.app) this.app.style.height = container.style.height;
1633
+ if (this.app) this.app.style.height = container === null || container === void 0 || (_container$style = container.style) === null || _container$style === void 0 ? void 0 : _container$style.height;
1646
1634
  if (container) {
1647
1635
  // size变化动画取消
1648
1636
  container.style.transition = '';
@@ -0,0 +1,2 @@
1
+ import type { IpaymentSessionConfig } from '../../types';
2
+ export declare const handlePaymentSessionConfig: (config: IpaymentSessionConfig) => Pick<IpaymentSessionConfig, 'productScene' | 'productSceneVersion'>;
@@ -0,0 +1,6 @@
1
+ export var handlePaymentSessionConfig = function handlePaymentSessionConfig(config) {
2
+ return {
3
+ productScene: config === null || config === void 0 ? void 0 : config.productScene,
4
+ productSceneVersion: config === null || config === void 0 ? void 0 : config.productSceneVersion
5
+ };
6
+ };
@@ -380,6 +380,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
380
380
  break;
381
381
  case PaypalActionEnum.destroyComponent:
382
382
  this.destroyComponent(context, message);
383
+ break;
383
384
  default:
384
385
  console.log('Unknown action: ' + message.getAction());
385
386
  }
@@ -40,6 +40,9 @@ export interface IcreatePaymentParams {
40
40
  backgroundColor?: string;
41
41
  };
42
42
  }
43
+ export declare enum ComponentSignEnumV2 {
44
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
45
+ }
43
46
  export declare enum componentSignEnum {
44
47
  'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
45
48
  'EASY_PAY_APM' = "EASY_PAY_APM",
@@ -47,24 +50,25 @@ export declare enum componentSignEnum {
47
50
  'CASHIER_PAYMENT_BANK' = "CASHIER_PAYMENT_BANK",
48
51
  'CASHIER_PAYMENT_APM' = "CASHIER_PAYMENT_APM",
49
52
  'AUTO_DEBIT_WALLET' = "AUTO_DEBIT_WALLET",
50
- 'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
51
53
  'NONE' = "NONE",
52
- 'VAULTING_CARD' = "VAULTING_CARD"
54
+ 'VAULTING_CARD' = "VAULTING_CARD",
55
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL"
53
56
  }
54
57
  export declare enum productSceneEnum {
55
58
  'EASY_PAY' = "EASY_PAY",
56
59
  'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
57
60
  'AUTO_DEBIT' = "AUTO_DEBIT",
58
- 'AUTO_DEBIT_PAY' = "AUTO_DEBIT_PAY",
59
61
  'VAULTING' = "VAULTING",
60
62
  'FLASH_BUY' = "FLASH_BUY",
61
- 'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
63
+ 'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
64
+ 'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT"
62
65
  }
63
66
  export declare enum paymentMethodCategoryTypeEnum {
64
67
  'CARD' = "CARD",
65
68
  'WALLET' = "WALLET",
66
69
  'BANK' = "BANK",
67
- 'APM' = "APM"
70
+ 'APM' = "APM",
71
+ 'ALL' = "ALL"
68
72
  }
69
73
  export interface DeviceIdParameter {
70
74
  scene?: string;
@@ -117,7 +121,7 @@ export interface Isubmit {
117
121
  }
118
122
  export interface IpaymentSessionConfig {
119
123
  productScene: productSceneEnum;
120
- paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
124
+ paymentMethodCategoryType?: paymentMethodCategoryTypeEnum;
121
125
  productSceneVersion: string;
122
126
  }
123
127
  export interface IpaymentSecurityConfig {
@@ -138,10 +142,6 @@ export interface InitSecurityConfig {
138
142
  product: productSceneEnum;
139
143
  region?: string;
140
144
  }
141
- export interface frontModulesToBeLoadedInterface {
142
- acquirerName: string;
143
- scriptUrl: string;
144
- }
145
145
  export interface IpaymentSessionMetaData {
146
146
  clientId?: string;
147
147
  renderDisplayType?: string;
@@ -229,7 +229,6 @@ export interface IpaymentSessionMetaData {
229
229
  */
230
230
  agreementDescription?: string;
231
231
  };
232
- frontModulesToBeLoaded?: frontModulesToBeLoadedInterface[];
233
232
  };
234
233
  }
235
234
  export interface IPaymentSessionFactor {
@@ -15,6 +15,10 @@ export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum)
15
15
  renderDisplayTypeEnum["inline"] = "inline";
16
16
  return renderDisplayTypeEnum;
17
17
  }({});
18
+ export var ComponentSignEnumV2 = /*#__PURE__*/function (ComponentSignEnumV2) {
19
+ ComponentSignEnumV2["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
20
+ return ComponentSignEnumV2;
21
+ }({});
18
22
  export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
19
23
  componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
20
24
  componentSignEnum["EASY_PAY_APM"] = "EASY_PAY_APM";
@@ -22,19 +26,19 @@ export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
22
26
  componentSignEnum["CASHIER_PAYMENT_BANK"] = "CASHIER_PAYMENT_BANK";
23
27
  componentSignEnum["CASHIER_PAYMENT_APM"] = "CASHIER_PAYMENT_APM";
24
28
  componentSignEnum["AUTO_DEBIT_WALLET"] = "AUTO_DEBIT_WALLET";
25
- componentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
26
29
  componentSignEnum["NONE"] = "NONE";
27
30
  componentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
31
+ componentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
28
32
  return componentSignEnum;
29
33
  }({});
30
34
  export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
31
35
  productSceneEnum["EASY_PAY"] = "EASY_PAY";
32
36
  productSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
33
37
  productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
34
- productSceneEnum["AUTO_DEBIT_PAY"] = "AUTO_DEBIT_PAY";
35
38
  productSceneEnum["VAULTING"] = "VAULTING";
36
39
  productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
37
40
  productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
41
+ productSceneEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT";
38
42
  return productSceneEnum;
39
43
  }({});
40
44
  export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
@@ -42,6 +46,7 @@ export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodC
42
46
  paymentMethodCategoryTypeEnum["WALLET"] = "WALLET";
43
47
  paymentMethodCategoryTypeEnum["BANK"] = "BANK";
44
48
  paymentMethodCategoryTypeEnum["APM"] = "APM";
49
+ paymentMethodCategoryTypeEnum["ALL"] = "ALL";
45
50
  return paymentMethodCategoryTypeEnum;
46
51
  }({});
47
52
  export var payPalConfigurationIntentEnum = /*#__PURE__*/function (payPalConfigurationIntentEnum) {
@@ -39,10 +39,4 @@ declare const getOrSetStorageId: (key: string, value?: string) => string;
39
39
  declare const checkTimeElapsed: () => boolean;
40
40
  declare const isFunction: (func: any) => boolean;
41
41
  declare function parseBase64ToString(base64: string): string;
42
- declare function loadSDKScript({ src, attrOptions, timeOut, loadCallback }: {
43
- src: any;
44
- attrOptions?: {};
45
- timeOut?: number;
46
- loadCallback?: any;
47
- }, logger: any): Promise<unknown>;
48
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
42
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, };
package/esm/util/index.js CHANGED
@@ -261,70 +261,4 @@ function parseBase64ToString(base64) {
261
261
  return null;
262
262
  }
263
263
  }
264
- function loadSDKScript(_ref, logger) {
265
- var _this2 = this;
266
- var src = _ref.src,
267
- _ref$attrOptions = _ref.attrOptions,
268
- attrOptions = _ref$attrOptions === void 0 ? {} : _ref$attrOptions,
269
- _ref$timeOut = _ref.timeOut,
270
- timeOut = _ref$timeOut === void 0 ? 3 : _ref$timeOut,
271
- _ref$loadCallback = _ref.loadCallback,
272
- loadCallback = _ref$loadCallback === void 0 ? null : _ref$loadCallback;
273
- return new Promise(function (resolve, reject) {
274
- // 创建 script 标签
275
- logger.logInfo({
276
- title: 'load_item_sdk_start'
277
- }, {
278
- src: src,
279
- attrOptions: JSON.stringify(attrOptions)
280
- });
281
- console.time();
282
- var script = document.createElement('script');
283
- var timer = null;
284
- script.type = 'text/javascript';
285
-
286
- // 监听加载完成事件
287
- script.onload = function () {
288
- // 当脚本加载完毕时,执行回调函数
289
- logger.logInfo({
290
- title: 'load_item_sdk_end'
291
- }, {
292
- src: src,
293
- attrOptions: JSON.stringify(attrOptions)
294
- });
295
- console.timeEnd();
296
- clearTimeout(timer);
297
- if (loadCallback) loadCallback();
298
- resolve(true);
299
- };
300
-
301
- // 监听加载失败事件
302
- script.onerror = function () {
303
- logger.logError({
304
- title: 'load_item_sdk_error'
305
- }, {
306
- src: src,
307
- attrOptions: JSON.stringify(attrOptions)
308
- });
309
- clearTimeout(timer);
310
- console.error('The script ' + src + ' is not accessible.');
311
- reject(false);
312
- };
313
- timer = setTimeout(function () {
314
- _this2.logger.logError({
315
- title: 'load_item_sdk_timeout'
316
- }, {
317
- src: src,
318
- attrOptions: JSON.stringify(attrOptions)
319
- });
320
- reject(false);
321
- }, timeOut * 1000);
322
- script.src = src;
323
- attrOptions && Object.keys(attrOptions).forEach(function (key) {
324
- script.setAttribute(key, attrOptions[key]);
325
- });
326
- // 将 script 标签添加到页面中
327
- document.head.appendChild(script);
328
- });
329
- }
330
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript };
264
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString };
@@ -18,6 +18,7 @@ export declare const sceneMap: {
18
18
  EASYPAY: string;
19
19
  EASY_PAY: string;
20
20
  FLASH_BUY: string;
21
+ ELEMENT_PAYMENT: string;
21
22
  };
22
23
  export declare const getSecurityHost: (region: string) => string;
23
24
  export declare const getSecurityScene: (product: string) => string;
@@ -24,7 +24,7 @@ export var securityHost = {
24
24
  US: 'https://open-na-global.alipay.com/api/open/risk_client',
25
25
  DE: 'https://open-de-global.alipay.com/api/open/risk_client'
26
26
  };
27
- export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount');
27
+ export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount'), productSceneEnum.ELEMENT_PAYMENT, 'Acquirer');
28
28
  export var getSecurityHost = function getSecurityHost(region) {
29
29
  return securityHost[region] || securityHost[SecurityRegionEnum.SG];
30
30
  };
@@ -27,13 +27,13 @@ export declare function isGreyscaleMatch(item: UpgradeItem, randomGreyscale: num
27
27
  export declare const getMatchAppVersion: (_extendInfo: string, sdkInfo: UpgradeSdkInfo) => string;
28
28
  /**
29
29
  * 获取保存的加载版本
30
- * @param versionKey
30
+ * @param productScene
31
31
  * @returns
32
32
  */
33
- export declare const getLastAppVersion: (versionKey: string) => string;
33
+ export declare const getLastAppVersion: (productScene: string) => string;
34
34
  /**
35
35
  * 保存指定场景的加载版本供下次使用
36
- * @param versionKey
36
+ * @param productScene
37
37
  * @returns
38
38
  */
39
- export declare const setLastAppVersion: (versionKey: string, appVersion: string) => boolean;
39
+ export declare const setLastAppVersion: (productScene: string, appVersion: string) => boolean;
@@ -89,12 +89,12 @@ export var getMatchAppVersion = function getMatchAppVersion(_extendInfo, sdkInfo
89
89
 
90
90
  /**
91
91
  * 获取保存的加载版本
92
- * @param versionKey
92
+ * @param productScene
93
93
  * @returns
94
94
  */
95
- export var getLastAppVersion = function getLastAppVersion(versionKey) {
95
+ export var getLastAppVersion = function getLastAppVersion(productScene) {
96
96
  try {
97
- var key = "Antom_".concat(versionKey, "_LastAppVersion");
97
+ var key = "Antom_".concat(productScene, "_LastAppVersion");
98
98
  return getStorageString(key, '');
99
99
  } catch (error) {
100
100
  return '';
@@ -102,12 +102,12 @@ export var getLastAppVersion = function getLastAppVersion(versionKey) {
102
102
  };
103
103
  /**
104
104
  * 保存指定场景的加载版本供下次使用
105
- * @param versionKey
105
+ * @param productScene
106
106
  * @returns
107
107
  */
108
- export var setLastAppVersion = function setLastAppVersion(versionKey, appVersion) {
108
+ export var setLastAppVersion = function setLastAppVersion(productScene, appVersion) {
109
109
  try {
110
- var key = "Antom_".concat(versionKey, "_LastAppVersion");
110
+ var key = "Antom_".concat(productScene, "_LastAppVersion");
111
111
  return setStorageString(key, appVersion);
112
112
  } catch (error) {
113
113
  return false;