@alipay/ams-checkout 0.0.1699863258-dev.1 → 0.0.1699863258-dev.2

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.
@@ -17,6 +17,7 @@ export default class ComponentApp {
17
17
  private _appVersion;
18
18
  private _isRetention;
19
19
  private _actionQueryPromise;
20
+ private _actionSubmitPromise;
20
21
  private _renderParams;
21
22
  private _componentSign;
22
23
  private _appLocationSearch;
@@ -49,6 +50,7 @@ export default class ComponentApp {
49
50
  * @description Interface request
50
51
  */
51
52
  private createActionQueryPromise;
53
+ private createSubmitPromise;
52
54
  private cleanElement;
53
55
  /**
54
56
  * @description Create app
@@ -17,7 +17,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
  import { marmotMap } from "../../config/index";
19
19
  import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID } from "../../constant";
20
- import { queryPaymentInfo } from "../../service";
20
+ import { queryPaymentInfo, submitPayInfo } from "../../service";
21
21
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
22
22
  import { getType, isJsonString, isPC } from "../../util";
23
23
  import { isLocalMock } from "../../util/mock";
@@ -43,11 +43,12 @@ var ComponentApp = /*#__PURE__*/function () {
43
43
  _defineProperty(this, "_appVersion", void 0);
44
44
  _defineProperty(this, "_isRetention", void 0);
45
45
  _defineProperty(this, "_actionQueryPromise", null);
46
+ _defineProperty(this, "_actionSubmitPromise", null);
46
47
  _defineProperty(this, "_renderParams", null);
47
48
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
48
49
  _defineProperty(this, "_appLocationSearch", void 0);
49
50
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
50
- this._appVersion = '1.6.2';
51
+ this._appVersion = '1.6.1';
51
52
  this._isInitComponent = false;
52
53
  this._selector = "#".concat(COMPONENT_SECTION_ID);
53
54
  this.createIframeNode = function () {
@@ -257,7 +258,7 @@ var ComponentApp = /*#__PURE__*/function () {
257
258
  this.renderPopupLoading(renderParams);
258
259
  }
259
260
  this.createApp(renderParams);
260
- return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
261
+ return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
261
262
  _this3.AMSSDK.logger.logInfo({
262
263
  title: 'sdk_event_successfully_created_app_process'
263
264
  }).send();
@@ -323,8 +324,8 @@ var ComponentApp = /*#__PURE__*/function () {
323
324
  // eslint-disable-next-line no-async-promise-executor
324
325
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
325
326
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
326
- var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3;
327
- var envInfo, params, _this5$_renderParams4, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams5, _action$web, _action$wap, action, signType;
327
+ var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
328
+ var envInfo, params, _this5$_renderParams5, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams6, _action$web, _action$wap, action, signType;
328
329
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
329
330
  while (1) switch (_context2.prev = _context2.next) {
330
331
  case 0:
@@ -337,70 +338,75 @@ var ComponentApp = /*#__PURE__*/function () {
337
338
  notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
338
339
  };
339
340
  /**
340
- * @description card
341
+ * @description Simulated or unnecessary scenarios
341
342
  */
343
+ if (!(isLocalMock() || (_this5$_renderParams4 = _this5._renderParams) !== null && _this5$_renderParams4 !== void 0 && (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) !== null && _this5$_renderParams4 !== void 0 && _this5$_renderParams4.action.skipSdkQuery)) {
344
+ _context2.next = 4;
345
+ break;
346
+ }
347
+ return _context2.abrupt("return", resolve({
348
+ message: 'sdk no need to make query request',
349
+ success: true
350
+ }));
351
+ case 4:
342
352
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
343
- _context2.next = 7;
353
+ _context2.next = 9;
344
354
  break;
345
355
  }
346
356
  params.paymentMethodType = 'CARD';
347
- _context2.next = 6;
357
+ _context2.next = 8;
348
358
  return _this5.getDeviceIdAndLog();
349
- case 6:
359
+ case 8:
350
360
  envInfo.deviceId = _context2.sent;
351
- case 7:
361
+ case 9:
352
362
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
353
- _context2.next = 15;
363
+ _context2.next = 17;
354
364
  break;
355
365
  }
356
366
  _ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
357
- _ref4 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
367
+ _ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
358
368
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
359
- _context2.next = 12;
369
+ _context2.next = 14;
360
370
  break;
361
371
  }
362
372
  return _context2.abrupt("return", resolve({
363
373
  message: 'sdk no need to make query request',
364
374
  success: true
365
375
  }));
366
- case 12:
367
- _context2.next = 14;
368
- return _this5.getDeviceIdAndLog();
369
376
  case 14:
377
+ _context2.next = 16;
378
+ return _this5.getDeviceIdAndLog();
379
+ case 16:
370
380
  envInfo.deviceId = _context2.sent;
371
- case 15:
381
+ case 17:
372
382
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
373
- _context2.next = 22;
383
+ _context2.next = 27;
374
384
  break;
375
385
  }
376
- action = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {};
386
+ action = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.action) || {};
377
387
  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;
378
388
  if (!(signType === 'SMS')) {
379
- _context2.next = 20;
389
+ _context2.next = 22;
380
390
  break;
381
391
  }
382
392
  return _context2.abrupt("return", resolve({
383
393
  message: 'sdk no need to make query request',
384
394
  success: true
385
395
  }));
386
- case 20:
387
- if (!(!signType || signType !== 'REDIRECT')) {
388
- _context2.next = 22;
389
- break;
390
- }
391
- return _context2.abrupt("return", resolve({
392
- success: false
393
- }));
394
396
  case 22:
395
- if (!isLocalMock()) {
397
+ if (!(!signType || signType !== 'REDIRECT')) {
396
398
  _context2.next = 24;
397
399
  break;
398
400
  }
399
401
  return _context2.abrupt("return", resolve({
400
- message: 'sdk no need to make query request',
401
- success: true
402
+ success: false
402
403
  }));
403
404
  case 24:
405
+ _context2.next = 26;
406
+ return _this5.getDeviceIdAndLog();
407
+ case 26:
408
+ envInfo.deviceId = _context2.sent;
409
+ case 27:
404
410
  queryPaymentInfo(params, {
405
411
  env: _this5.AMSSDK.options.env.environment,
406
412
  envInfo: envInfo
@@ -425,7 +431,7 @@ var ComponentApp = /*#__PURE__*/function () {
425
431
  });
426
432
  reject(err);
427
433
  });
428
- case 25:
434
+ case 28:
429
435
  case "end":
430
436
  return _context2.stop();
431
437
  }
@@ -437,6 +443,66 @@ var ComponentApp = /*#__PURE__*/function () {
437
443
  }());
438
444
  return this._actionQueryPromise;
439
445
  }
446
+ }, {
447
+ key: "createSubmitPromise",
448
+ value: function createSubmitPromise() {
449
+ var _this$_renderParams3,
450
+ _this$_renderParams4,
451
+ _this6 = this;
452
+ this._performanceData.push({
453
+ key: 'sdk_submit_start',
454
+ value: Date.now()
455
+ });
456
+ var params = {
457
+ paymentSessionData: this._renderParams && ((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData) || '',
458
+ paymentSessionConfig: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionConfig
459
+ };
460
+
461
+ // eslint-disable-next-line no-async-promise-executor
462
+ this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
463
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
464
+ var _this6$_renderParams;
465
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
466
+ while (1) switch (_context3.prev = _context3.next) {
467
+ case 0:
468
+ if (!(!((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.action.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign)) {
469
+ _context3.next = 2;
470
+ break;
471
+ }
472
+ return _context3.abrupt("return", resolve({
473
+ message: 'sdk no need to make submitPay request',
474
+ success: true
475
+ }));
476
+ case 2:
477
+ submitPayInfo(params, {
478
+ env: _this6.AMSSDK.options.env.environment,
479
+ timeout: 15000
480
+ }, _this6.AMSSDK.logger).then(function (res) {
481
+ _this6._performanceData.push({
482
+ key: 'sdk_submit_end',
483
+ value: Date.now()
484
+ });
485
+ if (res !== null && res !== void 0 && res.success) {
486
+ resolve(res);
487
+ } else {
488
+ resolve(res);
489
+ }
490
+ }).catch(function () {
491
+ return resolve({
492
+ success: false
493
+ });
494
+ });
495
+ case 3:
496
+ case "end":
497
+ return _context3.stop();
498
+ }
499
+ }, _callee3);
500
+ }));
501
+ return function (_x3) {
502
+ return _ref5.apply(this, arguments);
503
+ };
504
+ }());
505
+ }
440
506
  }, {
441
507
  key: "cleanElement",
442
508
  value: function cleanElement() {
@@ -553,9 +619,9 @@ var ComponentApp = /*#__PURE__*/function () {
553
619
  }, {
554
620
  key: "createPopupWindow",
555
621
  value: function createPopupWindow(data) {
556
- var _this$_renderParams3;
622
+ var _this$_renderParams5;
557
623
  this._threedData = data;
558
- var sessionData = encodeURIComponent((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData);
624
+ var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
559
625
  var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
560
626
  this.popupWindow = createModal({
561
627
  device: this.platform,
@@ -565,19 +631,19 @@ var ComponentApp = /*#__PURE__*/function () {
565
631
  }, {
566
632
  key: "getDeviceIdAndCallback",
567
633
  value: function () {
568
- var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventContext) {
634
+ var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
569
635
  var deviceId;
570
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
571
- while (1) switch (_context3.prev = _context3.next) {
636
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
637
+ while (1) switch (_context4.prev = _context4.next) {
572
638
  case 0:
573
639
  if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
574
- _context3.next = 5;
640
+ _context4.next = 5;
575
641
  break;
576
642
  }
577
- _context3.next = 3;
643
+ _context4.next = 3;
578
644
  return this.getDeviceIdAndLog(eventContext === null || eventContext === void 0 ? void 0 : eventContext.data, true);
579
645
  case 3:
580
- deviceId = _context3.sent;
646
+ deviceId = _context4.sent;
581
647
  this.dispatchToApp({
582
648
  context: {
583
649
  event: 'appEventCallback',
@@ -589,11 +655,11 @@ var ComponentApp = /*#__PURE__*/function () {
589
655
  });
590
656
  case 5:
591
657
  case "end":
592
- return _context3.stop();
658
+ return _context4.stop();
593
659
  }
594
- }, _callee3, this);
660
+ }, _callee4, this);
595
661
  }));
596
- function getDeviceIdAndCallback(_x3) {
662
+ function getDeviceIdAndCallback(_x4) {
597
663
  return _getDeviceIdAndCallback.apply(this, arguments);
598
664
  }
599
665
  return getDeviceIdAndCallback;
@@ -758,7 +824,7 @@ var ComponentApp = /*#__PURE__*/function () {
758
824
  }, {
759
825
  key: "handleRedirect",
760
826
  value: function handleRedirect(data) {
761
- var _this6 = this;
827
+ var _this7 = this;
762
828
  var _data = typeof data === 'string' ? {
763
829
  normalUrl: data
764
830
  } : {
@@ -773,11 +839,11 @@ var ComponentApp = /*#__PURE__*/function () {
773
839
  redirectInfo: JSON.stringify(_data)
774
840
  }).send();
775
841
  var successCallback = function successCallback(type, url) {
776
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
842
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
777
843
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
778
844
  message: "Successfully opened the app,".concat(type, ": ").concat(url)
779
845
  });
780
- _this6.AMSSDK.logger.logInfo({
846
+ _this7.AMSSDK.logger.logInfo({
781
847
  title: 'sdk_event_call_url_success'
782
848
  }, {
783
849
  redirectInfo: JSON.stringify(_data),
@@ -786,11 +852,11 @@ var ComponentApp = /*#__PURE__*/function () {
786
852
  }).send();
787
853
  };
788
854
  var failCallback = function failCallback(type, url) {
789
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
855
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
790
856
  code: eventCodeEnum.SDK_CALL_URL_ERROR,
791
857
  message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
792
858
  });
793
- _this6.AMSSDK.logger.logInfo({
859
+ _this7.AMSSDK.logger.logInfo({
794
860
  title: 'sdk_error_call_url_failed'
795
861
  }, {
796
862
  redirectInfo: JSON.stringify(_data),
@@ -813,14 +879,14 @@ var ComponentApp = /*#__PURE__*/function () {
813
879
  successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
814
880
  }).catch(function () {
815
881
  failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
816
- return _this6.AMSSDK._redirect({
882
+ return _this7.AMSSDK._redirect({
817
883
  schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
818
884
  });
819
885
  }).then(function () {
820
886
  successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
821
887
  }).catch(function () {
822
888
  failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
823
- return _this6.AMSSDK._redirect({
889
+ return _this7.AMSSDK._redirect({
824
890
  normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
825
891
  });
826
892
  }).then(function () {
@@ -831,9 +897,9 @@ var ComponentApp = /*#__PURE__*/function () {
831
897
  }
832
898
  }, {
833
899
  key: "handleDeclareInfo",
834
- value: function handleDeclareInfo(_ref5) {
835
- var _ref5$closeDialogData = _ref5.closeDialogData,
836
- closeDialogData = _ref5$closeDialogData === void 0 ? {} : _ref5$closeDialogData;
900
+ value: function handleDeclareInfo(_ref6) {
901
+ var _ref6$closeDialogData = _ref6.closeDialogData,
902
+ closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
837
903
  _handleDeclareInfo({
838
904
  closeDialogData: closeDialogData
839
905
  });
@@ -907,22 +973,26 @@ var ComponentApp = /*#__PURE__*/function () {
907
973
  }, {
908
974
  key: "sendRenderEvent",
909
975
  value: function () {
910
- var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
911
- var _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, res;
912
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
913
- while (1) switch (_context4.prev = _context4.next) {
976
+ var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
977
+ var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
978
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
979
+ while (1) switch (_context5.prev = _context5.next) {
914
980
  case 0:
915
- _context4.prev = 0;
916
- if (this._actionQueryPromise) {
917
- _context4.next = 3;
981
+ _context5.prev = 0;
982
+ if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
983
+ _context5.next = 3;
918
984
  break;
919
985
  }
920
- return _context4.abrupt("return");
986
+ return _context5.abrupt("return");
921
987
  case 3:
922
- _context4.next = 5;
988
+ _context5.next = 5;
923
989
  return this._actionQueryPromise;
924
990
  case 5:
925
- res = _context4.sent;
991
+ res = _context5.sent;
992
+ _context5.next = 8;
993
+ return this._actionSubmitPromise;
994
+ case 8:
995
+ submitRes = _context5.sent;
926
996
  this._performanceData.push({
927
997
  key: 'sdk_render_component',
928
998
  value: Date.now()
@@ -932,12 +1002,13 @@ var ComponentApp = /*#__PURE__*/function () {
932
1002
  event: 'renderComponent',
933
1003
  data: {
934
1004
  queryResult: res,
935
- sessionResult: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionMetaData,
936
- paymentSessionData: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData,
1005
+ submitResult: submitRes,
1006
+ sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1007
+ paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
937
1008
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
938
- renderDisplayType: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.renderDisplayType,
939
- appearance: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.appearance,
940
- notRedirectAfterComplete: ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.notRedirectAfterComplete) === true,
1009
+ renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1010
+ appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1011
+ notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
941
1012
  envInfo: {
942
1013
  screenHeight: screen.height,
943
1014
  screenWidth: screen.width
@@ -954,16 +1025,16 @@ var ComponentApp = /*#__PURE__*/function () {
954
1025
  }
955
1026
  });
956
1027
  // eslint-disable-next-line no-empty
957
- _context4.next = 13;
1028
+ _context5.next = 16;
958
1029
  break;
959
- case 11:
960
- _context4.prev = 11;
961
- _context4.t0 = _context4["catch"](0);
962
- case 13:
1030
+ case 14:
1031
+ _context5.prev = 14;
1032
+ _context5.t0 = _context5["catch"](0);
1033
+ case 16:
963
1034
  case "end":
964
- return _context4.stop();
1035
+ return _context5.stop();
965
1036
  }
966
- }, _callee4, this, [[0, 11]]);
1037
+ }, _callee5, this, [[0, 14]]);
967
1038
  }));
968
1039
  function sendRenderEvent() {
969
1040
  return _sendRenderEvent.apply(this, arguments);
@@ -977,7 +1048,7 @@ var ComponentApp = /*#__PURE__*/function () {
977
1048
  key: "cleanContainer",
978
1049
  value: function cleanContainer() {
979
1050
  var _document$getElementB4,
980
- _this7 = this;
1051
+ _this8 = this;
981
1052
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
982
1053
  this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
983
1054
  this._performanceData = [];
@@ -989,7 +1060,7 @@ var ComponentApp = /*#__PURE__*/function () {
989
1060
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
990
1061
  if (immediately) this.cleanElement();else {
991
1062
  setTimeout(function () {
992
- _this7.cleanElement();
1063
+ _this8.cleanElement();
993
1064
  }, 300);
994
1065
  }
995
1066
  }
@@ -1,4 +1,4 @@
1
- import { IrequestConfig } from '../types';
1
+ import { RequestConfig } from '../types';
2
2
  import { Logger } from '../util/logger';
3
3
  /**
4
4
  *
@@ -6,4 +6,4 @@ import { Logger } from '../util/logger';
6
6
  * @param options 请求配置
7
7
  * @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
8
8
  */
9
- export declare function request<T>(requestData: Record<string, any> | undefined, options: IrequestConfig, logger: Logger): Promise<T>;
9
+ export declare function request<T>(requestData: Record<string, any> | undefined, options: RequestConfig, logger: Logger): Promise<T>;
@@ -19,8 +19,8 @@ import axios from 'axios';
19
19
  import { sdkVersion } from "../config/index";
20
20
  import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
21
21
  import { errorEnum } from "../types";
22
- import { device, isPC, queryParse, safeJson } from "../util";
23
22
  import { get } from "../util/get";
23
+ import { device, isPC, queryParse, safeJson } from "../util";
24
24
  import { fomatGetwayError } from "./utils";
25
25
  var _queryParse = queryParse(),
26
26
  _sandbox = _queryParse._sandbox;
@@ -1,4 +1,5 @@
1
- import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, IrequestConfig } from '../types';
1
+ import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
2
2
  import { Logger } from '../util/logger';
3
- export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: IrequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
4
- export declare function antomConfig(options: IrequestConfig, logger: Logger): Promise<any>;
3
+ export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
4
+ export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
5
+ export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
@@ -74,4 +74,27 @@ function _antomConfig() {
74
74
  }, _callee2, null, [[0, 11]]);
75
75
  }));
76
76
  return _antomConfig.apply(this, arguments);
77
+ }
78
+ export function submitPayInfo(_x6, _x7, _x8) {
79
+ return _submitPayInfo.apply(this, arguments);
80
+ }
81
+ function _submitPayInfo() {
82
+ _submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, options, logger) {
83
+ var hostSign;
84
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
85
+ while (1) switch (_context3.prev = _context3.next) {
86
+ case 0:
87
+ hostSign = ((params === null || params === void 0 ? void 0 : params.paymentSessionData) || '').split('&&')[1] || '';
88
+ return _context3.abrupt("return", request(params, _objectSpread(_objectSpread({}, options), {}, {
89
+ hostSign: hostSign,
90
+ needEnvInfo: true,
91
+ 'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
92
+ }), logger));
93
+ case 2:
94
+ case "end":
95
+ return _context3.stop();
96
+ }
97
+ }, _callee3);
98
+ }));
99
+ return _submitPayInfo.apply(this, arguments);
77
100
  }
@@ -120,6 +120,7 @@ export interface IpaymentSessionMetaData {
120
120
  paymentMethodInfoView?: any;
121
121
  action?: {
122
122
  autoDebitWithToken: boolean;
123
+ skipSdkQuery: boolean;
123
124
  };
124
125
  }
125
126
  export declare enum localeEnum {
@@ -256,7 +257,7 @@ export declare enum errorEnum {
256
257
  SIGNIN = "SIGNIN",
257
258
  GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
258
259
  }
259
- export interface IrequestConfig {
260
+ export interface RequestConfig {
260
261
  env?: string;
261
262
  baseURL?: string;
262
263
  timeout?: number;
@@ -268,8 +269,11 @@ export interface IrequestConfig {
268
269
  beforerRequest?: () => void;
269
270
  afterRequest?: () => void;
270
271
  needEnvInfo?: boolean;
271
- locale?: string;
272
272
  hostSign?: string;
273
+ appId?: string;
274
+ sandbox?: boolean;
275
+ deviceId?: string;
276
+ locale?: string;
273
277
  envInfo?: Record<string, any>;
274
278
  }
275
279
  export interface CashierSdkActionQueryRequest {
@@ -279,6 +283,29 @@ export interface CashierSdkActionQueryRequest {
279
283
  notRedirectAfterComplete?: boolean;
280
284
  extParams?: any;
281
285
  }
286
+ export interface CashierSubmitPayRequest {
287
+ /**
288
+ * @description payment method type
289
+ */
290
+ paymentMethodType?: string;
291
+ /**
292
+ * @description payment factors
293
+ */
294
+ paymentFactors?: Record<string, string>;
295
+ /**
296
+ * @description 需要验证的场景
297
+ */
298
+ verifyFactors?: Record<string, string>;
299
+ paymentSessionData: string;
300
+ paymentSessionConfig?: any;
301
+ }
302
+ export interface CashierSubmitPayRequest {
303
+ paymentMethodType?: string;
304
+ paymentFactors?: Record<string, string>;
305
+ verifyFactors?: Record<string, string>;
306
+ paymentSessionData: string;
307
+ paymentSessionConfig?: any;
308
+ }
282
309
  export interface CashierSdkActionQueryResult {
283
310
  supportedLanguages?: any[];
284
311
  amountConfirmRequired?: boolean;
@@ -296,6 +323,30 @@ export interface CashierSdkActionQueryResult {
296
323
  schemeUrl?: string;
297
324
  authUrl?: string;
298
325
  }
326
+ export declare enum redirectTypeEnum {
327
+ UNSAFE_BROWSER = "UNSAFE_BROWSER",
328
+ SAFETY_BROWSER = "SAFETY_BROWSER",
329
+ INVOKE_SDK = "INVOKE_SDK"
330
+ }
331
+ export interface ActionForm {
332
+ parameters: any;
333
+ redirectUrl: any;
334
+ elementValue?: string;
335
+ redirectType?: redirectTypeEnum;
336
+ }
337
+ export interface CashierSubmitPayResult {
338
+ success: boolean;
339
+ resultCode?: string;
340
+ resultMessage?: string;
341
+ errorActions?: Record<string, string>;
342
+ errorCode?: string;
343
+ errorMessage?: string;
344
+ extendInfo?: Record<string, string>;
345
+ actionForm?: ActionForm;
346
+ normalUrl?: string;
347
+ errorStatus?: string;
348
+ message?: string;
349
+ }
299
350
  export declare enum eventCodeEnum {
300
351
  SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
301
352
  SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
@@ -125,6 +125,12 @@ export var errorEnum = /*#__PURE__*/function (errorEnum) {
125
125
  errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
126
126
  return errorEnum;
127
127
  }({});
128
+ export var redirectTypeEnum = /*#__PURE__*/function (redirectTypeEnum) {
129
+ redirectTypeEnum["UNSAFE_BROWSER"] = "UNSAFE_BROWSER";
130
+ redirectTypeEnum["SAFETY_BROWSER"] = "SAFETY_BROWSER";
131
+ redirectTypeEnum["INVOKE_SDK"] = "INVOKE_SDK";
132
+ return redirectTypeEnum;
133
+ }({}); // 拉SDK
128
134
  export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
129
135
  eventCodeEnum["SDK_START_OF_LOADING"] = "SDK_START_OF_LOADING";
130
136
  eventCodeEnum["SDK_END_OF_LOADING"] = "SDK_END_OF_LOADING";
package/esm/util/index.js CHANGED
@@ -225,20 +225,25 @@ var getOrSetStorageId = function getOrSetStorageId(key, value) {
225
225
  }
226
226
  };
227
227
  var checkTimeElapsed = function checkTimeElapsed() {
228
+ var key = 'antomSDKConfiglastCallTime';
229
+ var currentTime = new Date().getTime();
228
230
  try {
229
- var key = 'antomSDKConfiglastCallTime';
230
- var currentTime = new Date().getTime();
231
231
  var lastCallTime = localStorage.getItem(key);
232
232
  if (lastCallTime) {
233
233
  var elapsedTime = currentTime - parseInt(lastCallTime);
234
234
  if (elapsedTime >= 10 * 60 * 1000) {
235
+ // 记录当前调用时间
236
+ localStorage.setItem(key, currentTime.toString());
235
237
  // 超过10分钟
236
238
  return true;
237
- } else return false;
239
+ }
240
+ return false;
238
241
  }
239
- // 记录当前调用时间
240
- localStorage.setItem(key, currentTime.toString());
241
- } catch (error) {/* empty */}
242
+ } catch (error) {
243
+ /* empty */
244
+ }
245
+ // 记录当前调用时间
246
+ localStorage.setItem(key, currentTime.toString());
242
247
  return true;
243
248
  };
244
249
  export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed };