@alipay/ams-checkout 0.0.1716363774-dev.1 → 0.0.1717141544-dev.3

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.
@@ -1,5 +1,6 @@
1
1
  export function getChannelBehavior(paymentSessionMetaData) {
2
- var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4;
2
+ var _paymentSessionMetaDa, _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5, _paymentSessionMetaDa6, _paymentSessionMetaDa7, _paymentSessionMetaDa8;
3
+ // TOSS EASYPAY 2.0
3
4
  if ('BANKTRANSFER_QUICKPAY' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa2 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa2 === void 0 ? void 0 : _paymentSessionMetaDa2.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa3 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa3 === void 0 ? void 0 : _paymentSessionMetaDa3.paymentMethodCategoryType) === 'APM' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0') {
4
5
  return {
5
6
  usePaymentSessionAsQueryResult: true,
@@ -15,6 +16,19 @@ export function getChannelBehavior(paymentSessionMetaData) {
15
16
  }
16
17
  };
17
18
  }
19
+ // TNG EASYPAY 2.0
20
+ if ('TNG' === (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa5 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa5 === void 0 ? void 0 : _paymentSessionMetaDa5.paymentMethodType) && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa6 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa6 === void 0 ? void 0 : _paymentSessionMetaDa6.productScene) === 'EASY_PAY' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa7 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa7 === void 0 ? void 0 : _paymentSessionMetaDa7.paymentMethodCategoryType) === 'WALLET' && (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa8 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa8 === void 0 ? void 0 : _paymentSessionMetaDa8.productSceneVersion) === '2.0') {
21
+ return {
22
+ usePaymentSessionAsQueryResult: false,
23
+ submitPayInSdk: false,
24
+ createIframeNode: true,
25
+ loadApp: true,
26
+ allowClickOutsideClose: false,
27
+ buildSubmitPayExtParams: function buildSubmitPayExtParams(params) {
28
+ return {};
29
+ }
30
+ };
31
+ }
18
32
  return undefined;
19
33
  }
20
34
  export function getDoubleFaUrl(params) {
@@ -56,7 +56,7 @@ var ComponentApp = /*#__PURE__*/function () {
56
56
  _defineProperty(this, "_multipleCallbackEvents", void 0);
57
57
  _defineProperty(this, "_merchantAppointParam", void 0);
58
58
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
59
- this._appVersion = '1.15.0';
59
+ this._appVersion = '1.16.0';
60
60
  this._isInitComponent = false;
61
61
  this._selector = "#".concat(COMPONENT_SECTION_ID);
62
62
  this.createIframeNode = function () {
@@ -492,7 +492,7 @@ var ComponentApp = /*#__PURE__*/function () {
492
492
  success: true
493
493
  }));
494
494
  case 35:
495
- if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
495
+ if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
496
496
  _context2.next = 37;
497
497
  break;
498
498
  }
@@ -606,7 +606,7 @@ var ComponentApp = /*#__PURE__*/function () {
606
606
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
607
607
  var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
608
608
  var _channelBehavior$buil, _this6$_renderParams$;
609
- var shouldSkipSubmitPayInSDK, _this6$_renderParams, extParams;
609
+ var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$enableS, enableSignAgreement, extParams;
610
610
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
611
611
  while (1) switch (_context3.prev = _context3.next) {
612
612
  case 0:
@@ -617,15 +617,22 @@ var ComponentApp = /*#__PURE__*/function () {
617
617
  } else {
618
618
  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;
619
619
  }
620
+ if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
621
+ _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;
622
+ _ref9 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$enableS = _ref9$action2.enableSignAgreement, enableSignAgreement = _ref9$action2$enableS === void 0 ? false : _ref9$action2$enableS;
623
+ if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0') {
624
+ params['signAgreement'] = enableSignAgreement;
625
+ }
626
+ }
620
627
  if (!shouldSkipSubmitPayInSDK) {
621
- _context3.next = 4;
628
+ _context3.next = 5;
622
629
  break;
623
630
  }
624
631
  return _context3.abrupt("return", resolve({
625
632
  message: 'sdk no need to make submitPay request',
626
633
  success: true
627
634
  }));
628
- case 4:
635
+ case 5:
629
636
  _this6.AMSSDK.logger.logInfo({
630
637
  title: 'sdk_event_submitPay'
631
638
  }, {
@@ -644,9 +651,9 @@ var ComponentApp = /*#__PURE__*/function () {
644
651
  _context3.t0 = submitPayInfo;
645
652
  _context3.t1 = params;
646
653
  _context3.t2 = _this6.AMSSDK.options.env.environment;
647
- _context3.next = 12;
654
+ _context3.next = 13;
648
655
  return _this6.getDeviceIdAndLog();
649
- case 12:
656
+ case 13:
650
657
  _context3.t3 = _context3.sent;
651
658
  _context3.t4 = {
652
659
  deviceId: _context3.t3
@@ -680,7 +687,7 @@ var ComponentApp = /*#__PURE__*/function () {
680
687
  success: false
681
688
  });
682
689
  });
683
- case 17:
690
+ case 18:
684
691
  case "end":
685
692
  return _context3.stop();
686
693
  }
@@ -807,8 +814,13 @@ var ComponentApp = /*#__PURE__*/function () {
807
814
  path = _getIframeUrl2.path,
808
815
  locationSearch = _getIframeUrl2.locationSearch;
809
816
  this._appLocationSearch = locationSearch;
810
- this.app.src = "".concat(path, "?").concat(locationSearch);
811
-
817
+ // locationSearch 是一个序列化好的字符串
818
+ // 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
819
+ if (path.indexOf('?') !== -1) {
820
+ this.app.src = "".concat(path, "&").concat(locationSearch);
821
+ } else {
822
+ this.app.src = "".concat(path, "?").concat(locationSearch);
823
+ }
812
824
  // Subscribe to messages from iframe
813
825
  this.addEventListener();
814
826
  } catch (error) {
@@ -823,7 +835,12 @@ var ComponentApp = /*#__PURE__*/function () {
823
835
  }, {
824
836
  key: "listener",
825
837
  value: function listener(e) {
838
+ var _e$data;
826
839
  if (e.origin !== this.appDomain) return;
840
+ if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.source) === 'react-devtools-content-script') {
841
+ // 防止 react 开发工具发的消息,非常频繁影响查看日志
842
+ return;
843
+ }
827
844
  var isJson = isJsonString(e.data);
828
845
  if (isJson) {
829
846
  var data = JSON.parse(e.data);
@@ -1286,9 +1303,9 @@ var ComponentApp = /*#__PURE__*/function () {
1286
1303
  }
1287
1304
  }, {
1288
1305
  key: "handleDeclareInfo",
1289
- value: function handleDeclareInfo(_ref8) {
1290
- var _ref8$closeDialogData = _ref8.closeDialogData,
1291
- closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
1306
+ value: function handleDeclareInfo(_ref10) {
1307
+ var _ref10$closeDialogDat = _ref10.closeDialogData,
1308
+ closeDialogData = _ref10$closeDialogDat === void 0 ? {} : _ref10$closeDialogDat;
1292
1309
  _handleDeclareInfo({
1293
1310
  closeDialogData: closeDialogData
1294
1311
  });
@@ -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
  }
@@ -147,6 +147,7 @@ export interface IpaymentSessionMetaData {
147
147
  action?: {
148
148
  amountConfirmRequired?: boolean;
149
149
  autoDebitWithToken: boolean;
150
+ enableSignAgreement?: boolean;
150
151
  skipSdkQuery: boolean;
151
152
  skipSdkQueryForm?: {
152
153
  value: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1716363774-dev.1",
3
+ "version": "0.0.1717141544-dev.3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",