@alipay/ams-checkout 0.0.1718085825-dev.3 → 0.0.1719569471-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.
@@ -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) {
@@ -17,6 +17,7 @@ export default class ComponentApp {
17
17
  private _selector;
18
18
  private _appVersion;
19
19
  private _isRetention;
20
+ private _allowSubmitPayCallAhead;
20
21
  private _actionQueryPromise;
21
22
  private _actionSubmitPromise;
22
23
  private _renderParams;
@@ -47,6 +47,7 @@ var ComponentApp = /*#__PURE__*/function () {
47
47
  _defineProperty(this, "_selector", void 0);
48
48
  _defineProperty(this, "_appVersion", void 0);
49
49
  _defineProperty(this, "_isRetention", void 0);
50
+ _defineProperty(this, "_allowSubmitPayCallAhead", void 0);
50
51
  _defineProperty(this, "_actionQueryPromise", null);
51
52
  _defineProperty(this, "_actionSubmitPromise", null);
52
53
  _defineProperty(this, "_renderParams", null);
@@ -56,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
56
57
  _defineProperty(this, "_multipleCallbackEvents", void 0);
57
58
  _defineProperty(this, "_merchantAppointParam", void 0);
58
59
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
59
- this._appVersion = '1.16.0.0';
60
+ this._appVersion = '1.17.1';
60
61
  this._isInitComponent = false;
61
62
  this._selector = "#".concat(COMPONENT_SECTION_ID);
62
63
  this.createIframeNode = function () {
@@ -297,7 +298,7 @@ var ComponentApp = /*#__PURE__*/function () {
297
298
  }).send();
298
299
  if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
299
300
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
300
- // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
301
+ // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
301
302
  this.handleAuthUrlInfo(authUrlInfo);
302
303
  return;
303
304
  }
@@ -539,7 +540,7 @@ var ComponentApp = /*#__PURE__*/function () {
539
540
  success: true
540
541
  }));
541
542
  case 35:
542
- if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
543
+ if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
543
544
  _context2.next = 37;
544
545
  break;
545
546
  }
@@ -653,7 +654,7 @@ var ComponentApp = /*#__PURE__*/function () {
653
654
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
654
655
  var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
655
656
  var _channelBehavior$buil, _this6$_renderParams$;
656
- var shouldSkipSubmitPayInSDK, _this6$_renderParams, extParams;
657
+ 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;
657
658
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
658
659
  while (1) switch (_context3.prev = _context3.next) {
659
660
  case 0:
@@ -664,15 +665,25 @@ var ComponentApp = /*#__PURE__*/function () {
664
665
  } else {
665
666
  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;
666
667
  }
668
+ if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
669
+ _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;
670
+ _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;
671
+ if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
672
+ ///EasyPay 2.0 首次传signAgreement字段
673
+ params['signAgreement'] = enableSignAgreement;
674
+ }
675
+ }
676
+ // 带上标记告知WebCheckOut SDK已发送submitpay请求
677
+ _this6._allowSubmitPayCallAhead = !shouldSkipSubmitPayInSDK;
667
678
  if (!shouldSkipSubmitPayInSDK) {
668
- _context3.next = 4;
679
+ _context3.next = 6;
669
680
  break;
670
681
  }
671
682
  return _context3.abrupt("return", resolve({
672
683
  message: 'sdk no need to make submitPay request',
673
684
  success: true
674
685
  }));
675
- case 4:
686
+ case 6:
676
687
  _this6.AMSSDK.logger.logInfo({
677
688
  title: 'sdk_event_submitPay'
678
689
  }, {
@@ -691,9 +702,9 @@ var ComponentApp = /*#__PURE__*/function () {
691
702
  _context3.t0 = submitPayInfo;
692
703
  _context3.t1 = params;
693
704
  _context3.t2 = _this6.AMSSDK.options.env.environment;
694
- _context3.next = 12;
705
+ _context3.next = 14;
695
706
  return _this6.getDeviceIdAndLog();
696
- case 12:
707
+ case 14:
697
708
  _context3.t3 = _context3.sent;
698
709
  _context3.t4 = {
699
710
  deviceId: _context3.t3
@@ -727,7 +738,7 @@ var ComponentApp = /*#__PURE__*/function () {
727
738
  success: false
728
739
  });
729
740
  });
730
- case 17:
741
+ case 19:
731
742
  case "end":
732
743
  return _context3.stop();
733
744
  }
@@ -854,8 +865,13 @@ var ComponentApp = /*#__PURE__*/function () {
854
865
  path = _getIframeUrl2.path,
855
866
  locationSearch = _getIframeUrl2.locationSearch;
856
867
  this._appLocationSearch = locationSearch;
857
- this.app.src = "".concat(path, "?").concat(locationSearch);
858
-
868
+ // locationSearch 是一个序列化好的字符串
869
+ // 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
870
+ if (path.indexOf('?') !== -1) {
871
+ this.app.src = "".concat(path, "&").concat(locationSearch);
872
+ } else {
873
+ this.app.src = "".concat(path, "?").concat(locationSearch);
874
+ }
859
875
  // Subscribe to messages from iframe
860
876
  this.addEventListener();
861
877
  } catch (error) {
@@ -870,7 +886,12 @@ var ComponentApp = /*#__PURE__*/function () {
870
886
  }, {
871
887
  key: "listener",
872
888
  value: function listener(e) {
889
+ var _e$data;
873
890
  if (e.origin !== this.appDomain) return;
891
+ if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.source) === 'react-devtools-content-script') {
892
+ // 防止 react 开发工具发的消息,非常频繁影响查看日志
893
+ return;
894
+ }
874
895
  var isJson = isJsonString(e.data);
875
896
  if (isJson) {
876
897
  var data = JSON.parse(e.data);
@@ -1355,9 +1376,9 @@ var ComponentApp = /*#__PURE__*/function () {
1355
1376
  }
1356
1377
  }, {
1357
1378
  key: "handleDeclareInfo",
1358
- value: function handleDeclareInfo(_ref11) {
1359
- var _ref11$closeDialogDat = _ref11.closeDialogData,
1360
- closeDialogData = _ref11$closeDialogDat === void 0 ? {} : _ref11$closeDialogDat;
1379
+ value: function handleDeclareInfo(_ref13) {
1380
+ var _ref13$closeDialogDat = _ref13.closeDialogData,
1381
+ closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
1361
1382
  _handleDeclareInfo({
1362
1383
  closeDialogData: closeDialogData
1363
1384
  });
@@ -1534,6 +1555,7 @@ var ComponentApp = /*#__PURE__*/function () {
1534
1555
  appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
1535
1556
  notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1536
1557
  merchantAppointParam: this._merchantAppointParam,
1558
+ allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1537
1559
  envInfo: {
1538
1560
  screenHeight: screen.height,
1539
1561
  screenWidth: screen.width
@@ -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
  requireFastSdk: boolean;
152
153
  skipSdkQueryForm?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1718085825-dev.3",
3
+ "version": "0.0.1719569471-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",