@alipay/ams-checkout 0.0.1698890614-dev.1 → 0.0.1699585541-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.
@@ -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, SecuritySceneEnum, targetEnum } from "../../types";
22
22
  import { getType, isJsonString, isPC } from "../../util";
23
23
  import { isLocalMock } from "../../util/mock";
@@ -44,6 +44,7 @@ var ComponentApp = /*#__PURE__*/function () {
44
44
  _defineProperty(this, "_appVersion", void 0);
45
45
  _defineProperty(this, "_isRetention", void 0);
46
46
  _defineProperty(this, "_actionQueryPromise", null);
47
+ _defineProperty(this, "_actionSubmitPromise", null);
47
48
  _defineProperty(this, "_renderParams", null);
48
49
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
49
50
  _defineProperty(this, "_appLocationSearch", void 0);
@@ -118,7 +119,7 @@ var ComponentApp = /*#__PURE__*/function () {
118
119
  value: function initAPSecurity() {
119
120
  var _this$_renderParams2,
120
121
  _this = this;
121
- if (componentSignEnum.CASHIER_PAYMENT_CARD !== this._componentSign) {
122
+ if (![componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.EASY_PAY_WALLET].includes(this._componentSign)) {
122
123
  return;
123
124
  }
124
125
  var securityConfig = (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 || (_this$_renderParams2 = _this$_renderParams2.paymentSessionMetaData) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.securityConfig;
@@ -170,7 +171,7 @@ var ComponentApp = /*#__PURE__*/function () {
170
171
  }
171
172
  }, {
172
173
  key: "getDeviceIdAndLog",
173
- value: function getDeviceIdAndLog() {
174
+ value: function getDeviceIdAndLog(scene) {
174
175
  var _this2 = this;
175
176
  return new Promise(function (resolve) {
176
177
  // To avoid rendering being blocked, move the logic to the next event loop for processing
@@ -183,7 +184,7 @@ var ComponentApp = /*#__PURE__*/function () {
183
184
  securityConfig = (_this2$_renderParams = _this2._renderParams) === null || _this2$_renderParams === void 0 || (_this2$_renderParams = _this2$_renderParams.paymentSessionMetaData) === null || _this2$_renderParams === void 0 ? void 0 : _this2$_renderParams.securityConfig;
184
185
  getDeviceIdStartTime = Date.now();
185
186
  _context.next = 4;
186
- return getApdidToken(getAppname(SecuritySceneEnum.CARD), securityConfig);
187
+ return getApdidToken(getAppname(scene || SecuritySceneEnum.CARD), securityConfig);
187
188
  case 4:
188
189
  deviceId = _context.sent;
189
190
  _this2.logDeviceId(deviceId, getDeviceIdStartTime);
@@ -235,7 +236,7 @@ var ComponentApp = /*#__PURE__*/function () {
235
236
  this.renderPopupLoading(renderParams);
236
237
  }
237
238
  this.createApp(renderParams);
238
- return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
239
+ return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
239
240
  _this3.AMSSDK.logger.logInfo({
240
241
  title: 'sdk_event_successfully_created_app_process'
241
242
  }).send();
@@ -301,8 +302,8 @@ var ComponentApp = /*#__PURE__*/function () {
301
302
  // eslint-disable-next-line no-async-promise-executor
302
303
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
303
304
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
304
- var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
305
- var envInfo, params, securityConfig, _this5$_renderParams5, extendInfo, info, _this5$_renderParams6, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams7, _action$web, _action$wap, action, signType;
305
+ var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
306
+ var envInfo, params, securityConfig, _this5$_renderParams6, extendInfo, info, _this5$_renderParams7, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
306
307
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
307
308
  while (1) switch (_context2.prev = _context2.next) {
308
309
  case 0:
@@ -314,73 +315,76 @@ var ComponentApp = /*#__PURE__*/function () {
314
315
  paymentSessionConfig: (_this5$_renderParams2 = _this5._renderParams) === null || _this5$_renderParams2 === void 0 || (_this5$_renderParams2 = _this5$_renderParams2.paymentSessionMetaData) === null || _this5$_renderParams2 === void 0 ? void 0 : _this5$_renderParams2.paymentSessionConfig,
315
316
  notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
316
317
  };
318
+ /**
319
+ * @description Simulated or unnecessary scenarios
320
+ */
321
+ 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)) {
322
+ _context2.next = 4;
323
+ break;
324
+ }
325
+ return _context2.abrupt("return", resolve({
326
+ message: 'sdk no need to make query request',
327
+ success: true
328
+ }));
329
+ case 4:
317
330
  /**
318
331
  * @description card
319
332
  */
320
333
  if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign) {
321
334
  params.paymentMethodType = 'CARD';
322
335
  }
323
- securityConfig = (_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 || (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.securityConfig;
336
+ securityConfig = (_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.securityConfig;
324
337
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
325
- _context2.next = 11;
338
+ _context2.next = 13;
326
339
  break;
327
340
  }
328
- extendInfo = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.extendInfo) || '{}';
341
+ extendInfo = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.extendInfo) || '{}';
329
342
  info = JSON.parse(extendInfo);
330
343
  if (!((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false')) {
331
- _context2.next = 11;
344
+ _context2.next = 13;
332
345
  break;
333
346
  }
334
- _context2.next = 10;
347
+ _context2.next = 12;
335
348
  return _this5.getDeviceIdAndLog();
336
- case 10:
349
+ case 12:
337
350
  envInfo.deviceId = _context2.sent;
338
- case 11:
351
+ case 13:
339
352
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
340
- _context2.next = 16;
353
+ _context2.next = 18;
341
354
  break;
342
355
  }
343
356
  _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;
344
- _ref4 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.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;
357
+ _ref4 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.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;
345
358
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
346
- _context2.next = 16;
359
+ _context2.next = 18;
347
360
  break;
348
361
  }
349
362
  return _context2.abrupt("return", resolve({
350
363
  message: 'sdk no need to make query request',
351
364
  success: true
352
365
  }));
353
- case 16:
366
+ case 18:
354
367
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
355
- _context2.next = 23;
368
+ _context2.next = 25;
356
369
  break;
357
370
  }
358
- action = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 || (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.action) || {};
371
+ 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) || {};
359
372
  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;
360
373
  if (!(signType === 'SMS')) {
361
- _context2.next = 21;
374
+ _context2.next = 23;
362
375
  break;
363
376
  }
364
377
  return _context2.abrupt("return", resolve({
365
378
  message: 'sdk no need to make query request',
366
379
  success: true
367
380
  }));
368
- case 21:
369
- if (!(!signType || signType !== 'REDIRECT')) {
370
- _context2.next = 23;
371
- break;
372
- }
373
- return _context2.abrupt("return", resolve({
374
- success: false
375
- }));
376
381
  case 23:
377
- if (!isLocalMock()) {
382
+ if (!(!signType || signType !== 'REDIRECT')) {
378
383
  _context2.next = 25;
379
384
  break;
380
385
  }
381
386
  return _context2.abrupt("return", resolve({
382
- message: 'sdk no need to make query request',
383
- success: true
387
+ success: false
384
388
  }));
385
389
  case 25:
386
390
  queryPaymentInfo(params, {
@@ -419,6 +423,65 @@ var ComponentApp = /*#__PURE__*/function () {
419
423
  }());
420
424
  return this._actionQueryPromise;
421
425
  }
426
+ }, {
427
+ key: "createSubmitPromise",
428
+ value: function createSubmitPromise() {
429
+ var _this$_renderParams3,
430
+ _this$_renderParams4,
431
+ _this6 = this;
432
+ this._performanceData.push({
433
+ key: 'sdk_submit_start',
434
+ value: Date.now()
435
+ });
436
+ var params = {
437
+ paymentSessionData: this._renderParams && ((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData) || '',
438
+ 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
439
+ };
440
+
441
+ // eslint-disable-next-line no-async-promise-executor
442
+ this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
443
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
444
+ var _this6$_renderParams;
445
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
446
+ while (1) switch (_context3.prev = _context3.next) {
447
+ case 0:
448
+ 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)) {
449
+ _context3.next = 2;
450
+ break;
451
+ }
452
+ return _context3.abrupt("return", resolve({
453
+ message: 'sdk no need to make submitPay request',
454
+ success: true
455
+ }));
456
+ case 2:
457
+ submitPayInfo(params, {
458
+ timeout: 15000
459
+ }, _this6.AMSSDK.logger).then(function (res) {
460
+ _this6._performanceData.push({
461
+ key: 'sdk_submit_end',
462
+ value: Date.now()
463
+ });
464
+ if (res !== null && res !== void 0 && res.success) {
465
+ resolve(res);
466
+ } else {
467
+ resolve(res);
468
+ }
469
+ }).catch(function () {
470
+ return resolve({
471
+ success: false
472
+ });
473
+ });
474
+ case 3:
475
+ case "end":
476
+ return _context3.stop();
477
+ }
478
+ }, _callee3);
479
+ }));
480
+ return function (_x3) {
481
+ return _ref5.apply(this, arguments);
482
+ };
483
+ }());
484
+ }
422
485
  }, {
423
486
  key: "cleanElement",
424
487
  value: function cleanElement() {
@@ -535,9 +598,9 @@ var ComponentApp = /*#__PURE__*/function () {
535
598
  }, {
536
599
  key: "createPopupWindow",
537
600
  value: function createPopupWindow(data) {
538
- var _this$_renderParams3;
601
+ var _this$_renderParams5;
539
602
  this._threedData = data;
540
- var sessionData = encodeURIComponent((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData);
603
+ var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
541
604
  var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
542
605
  this.popupWindow = createModal({
543
606
  device: this.platform,
@@ -547,19 +610,19 @@ var ComponentApp = /*#__PURE__*/function () {
547
610
  }, {
548
611
  key: "getDeviceIdAndCallback",
549
612
  value: function () {
550
- var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventContext) {
613
+ var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
551
614
  var deviceId;
552
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
553
- while (1) switch (_context3.prev = _context3.next) {
615
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
616
+ while (1) switch (_context4.prev = _context4.next) {
554
617
  case 0:
555
618
  if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
556
- _context3.next = 5;
619
+ _context4.next = 5;
557
620
  break;
558
621
  }
559
- _context3.next = 3;
622
+ _context4.next = 3;
560
623
  return this.getDeviceIdAndLog();
561
624
  case 3:
562
- deviceId = _context3.sent;
625
+ deviceId = _context4.sent;
563
626
  this.dispatchToApp({
564
627
  context: {
565
628
  event: 'appEventCallback',
@@ -571,11 +634,11 @@ var ComponentApp = /*#__PURE__*/function () {
571
634
  });
572
635
  case 5:
573
636
  case "end":
574
- return _context3.stop();
637
+ return _context4.stop();
575
638
  }
576
- }, _callee3, this);
639
+ }, _callee4, this);
577
640
  }));
578
- function getDeviceIdAndCallback(_x3) {
641
+ function getDeviceIdAndCallback(_x4) {
579
642
  return _getDeviceIdAndCallback.apply(this, arguments);
580
643
  }
581
644
  return getDeviceIdAndCallback;
@@ -740,7 +803,7 @@ var ComponentApp = /*#__PURE__*/function () {
740
803
  }, {
741
804
  key: "handleRedirect",
742
805
  value: function handleRedirect(data) {
743
- var _this6 = this;
806
+ var _this7 = this;
744
807
  var _data = typeof data === 'string' ? {
745
808
  normalUrl: data
746
809
  } : {
@@ -755,11 +818,11 @@ var ComponentApp = /*#__PURE__*/function () {
755
818
  redirectInfo: JSON.stringify(_data)
756
819
  }).send();
757
820
  var successCallback = function successCallback(type, url) {
758
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
821
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
759
822
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
760
823
  message: "Successfully opened the app,".concat(type, ": ").concat(url)
761
824
  });
762
- _this6.AMSSDK.logger.logInfo({
825
+ _this7.AMSSDK.logger.logInfo({
763
826
  title: 'sdk_event_call_url_success'
764
827
  }, {
765
828
  redirectInfo: JSON.stringify(_data),
@@ -768,11 +831,11 @@ var ComponentApp = /*#__PURE__*/function () {
768
831
  }).send();
769
832
  };
770
833
  var failCallback = function failCallback(type, url) {
771
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
834
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
772
835
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
773
836
  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)
774
837
  });
775
- _this6.AMSSDK.logger.logInfo({
838
+ _this7.AMSSDK.logger.logInfo({
776
839
  title: 'sdk_error_call_url_failed'
777
840
  }, {
778
841
  redirectInfo: JSON.stringify(_data),
@@ -795,14 +858,14 @@ var ComponentApp = /*#__PURE__*/function () {
795
858
  successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
796
859
  }).catch(function () {
797
860
  failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
798
- return _this6.AMSSDK._redirect({
861
+ return _this7.AMSSDK._redirect({
799
862
  schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
800
863
  });
801
864
  }).then(function () {
802
865
  successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
803
866
  }).catch(function () {
804
867
  failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
805
- return _this6.AMSSDK._redirect({
868
+ return _this7.AMSSDK._redirect({
806
869
  normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
807
870
  });
808
871
  }).then(function () {
@@ -813,9 +876,9 @@ var ComponentApp = /*#__PURE__*/function () {
813
876
  }
814
877
  }, {
815
878
  key: "handleDeclareInfo",
816
- value: function handleDeclareInfo(_ref5) {
817
- var _ref5$closeDialogData = _ref5.closeDialogData,
818
- closeDialogData = _ref5$closeDialogData === void 0 ? {} : _ref5$closeDialogData;
879
+ value: function handleDeclareInfo(_ref6) {
880
+ var _ref6$closeDialogData = _ref6.closeDialogData,
881
+ closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
819
882
  _handleDeclareInfo({
820
883
  closeDialogData: closeDialogData
821
884
  });
@@ -889,22 +952,26 @@ var ComponentApp = /*#__PURE__*/function () {
889
952
  }, {
890
953
  key: "sendRenderEvent",
891
954
  value: function () {
892
- var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
893
- var _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, res;
894
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
895
- while (1) switch (_context4.prev = _context4.next) {
955
+ var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
956
+ var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
957
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
958
+ while (1) switch (_context5.prev = _context5.next) {
896
959
  case 0:
897
- _context4.prev = 0;
898
- if (this._actionQueryPromise) {
899
- _context4.next = 3;
960
+ _context5.prev = 0;
961
+ if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
962
+ _context5.next = 3;
900
963
  break;
901
964
  }
902
- return _context4.abrupt("return");
965
+ return _context5.abrupt("return");
903
966
  case 3:
904
- _context4.next = 5;
967
+ _context5.next = 5;
905
968
  return this._actionQueryPromise;
906
969
  case 5:
907
- res = _context4.sent;
970
+ res = _context5.sent;
971
+ _context5.next = 8;
972
+ return this._actionSubmitPromise;
973
+ case 8:
974
+ submitRes = _context5.sent;
908
975
  this._performanceData.push({
909
976
  key: 'sdk_render_component',
910
977
  value: Date.now()
@@ -914,12 +981,13 @@ var ComponentApp = /*#__PURE__*/function () {
914
981
  event: 'renderComponent',
915
982
  data: {
916
983
  queryResult: res,
917
- sessionResult: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionMetaData,
918
- paymentSessionData: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData,
984
+ submitResult: submitRes,
985
+ sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
986
+ paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
919
987
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
920
- renderDisplayType: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.renderDisplayType,
921
- appearance: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.appearance,
922
- notRedirectAfterComplete: ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.notRedirectAfterComplete) === true,
988
+ renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
989
+ appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
990
+ notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
923
991
  envInfo: {
924
992
  screenHeight: screen.height,
925
993
  screenWidth: screen.width
@@ -936,16 +1004,16 @@ var ComponentApp = /*#__PURE__*/function () {
936
1004
  }
937
1005
  });
938
1006
  // eslint-disable-next-line no-empty
939
- _context4.next = 13;
1007
+ _context5.next = 16;
940
1008
  break;
941
- case 11:
942
- _context4.prev = 11;
943
- _context4.t0 = _context4["catch"](0);
944
- case 13:
1009
+ case 14:
1010
+ _context5.prev = 14;
1011
+ _context5.t0 = _context5["catch"](0);
1012
+ case 16:
945
1013
  case "end":
946
- return _context4.stop();
1014
+ return _context5.stop();
947
1015
  }
948
- }, _callee4, this, [[0, 11]]);
1016
+ }, _callee5, this, [[0, 14]]);
949
1017
  }));
950
1018
  function sendRenderEvent() {
951
1019
  return _sendRenderEvent.apply(this, arguments);
@@ -959,7 +1027,7 @@ var ComponentApp = /*#__PURE__*/function () {
959
1027
  key: "cleanContainer",
960
1028
  value: function cleanContainer() {
961
1029
  var _document$getElementB4,
962
- _this7 = this;
1030
+ _this8 = this;
963
1031
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
964
1032
  this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
965
1033
  this._performanceData = [];
@@ -971,7 +1039,7 @@ var ComponentApp = /*#__PURE__*/function () {
971
1039
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
972
1040
  if (immediately) this.cleanElement();else {
973
1041
  setTimeout(function () {
974
- _this7.cleanElement();
1042
+ _this8.cleanElement();
975
1043
  }, 300);
976
1044
  }
977
1045
  }
@@ -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>;
@@ -15,11 +15,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
15
15
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
16
16
  */
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
+ import axios from 'axios';
18
19
  import { sdkVersion } from "../config/index";
19
20
  import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
20
21
  import { errorEnum } from "../types";
21
22
  import { get } from "../util/get";
22
- import axios from 'axios';
23
23
  import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
24
24
  var _queryParse = queryParse(),
25
25
  _sandbox = _queryParse._sandbox;
@@ -1,10 +1,4 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
- * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
- * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
- */
1
+ import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
8
2
  import { Logger } from '../util/logger';
9
- import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, IrequestConfig } from '../types';
10
- export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: IrequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
3
+ export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
4
+ export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
@@ -14,7 +14,6 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
14
14
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
15
15
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
16
16
  */
17
-
18
17
  import { request } from "../request";
19
18
  export function queryPaymentInfo(_x, _x2, _x3) {
20
19
  return _queryPaymentInfo.apply(this, arguments);
@@ -38,4 +37,27 @@ function _queryPaymentInfo() {
38
37
  }, _callee);
39
38
  }));
40
39
  return _queryPaymentInfo.apply(this, arguments);
40
+ }
41
+ export function submitPayInfo(_x4, _x5, _x6) {
42
+ return _submitPayInfo.apply(this, arguments);
43
+ }
44
+ function _submitPayInfo() {
45
+ _submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, options, logger) {
46
+ var hostSign;
47
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
48
+ while (1) switch (_context2.prev = _context2.next) {
49
+ case 0:
50
+ hostSign = ((params === null || params === void 0 ? void 0 : params.paymentSessionData) || '').split('&&')[1] || '';
51
+ return _context2.abrupt("return", request(params, _objectSpread(_objectSpread({}, options), {}, {
52
+ hostSign: hostSign,
53
+ needEnvInfo: true,
54
+ 'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
55
+ }), logger));
56
+ case 2:
57
+ case "end":
58
+ return _context2.stop();
59
+ }
60
+ }, _callee2);
61
+ }));
62
+ return _submitPayInfo.apply(this, arguments);
41
63
  }
@@ -104,6 +104,7 @@ export interface IpaymentSessionMetaData {
104
104
  paymentMethodInfoView?: any;
105
105
  action?: {
106
106
  autoDebitWithToken: boolean;
107
+ skipSdkQuery: boolean;
107
108
  };
108
109
  }
109
110
  export declare enum localeEnum {
@@ -239,7 +240,7 @@ export declare enum errorEnum {
239
240
  SIGNIN = "SIGNIN",
240
241
  GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
241
242
  }
242
- export interface IrequestConfig {
243
+ export interface RequestConfig {
243
244
  env?: string;
244
245
  baseURL?: string;
245
246
  timeout?: number;
@@ -251,8 +252,11 @@ export interface IrequestConfig {
251
252
  beforerRequest?: () => void;
252
253
  afterRequest?: () => void;
253
254
  needEnvInfo?: boolean;
254
- locale?: string;
255
255
  hostSign?: string;
256
+ appId?: string;
257
+ sandbox?: boolean;
258
+ deviceId?: string;
259
+ locale?: string;
256
260
  envInfo?: Record<string, any>;
257
261
  }
258
262
  export interface CashierSdkActionQueryRequest {
@@ -262,6 +266,29 @@ export interface CashierSdkActionQueryRequest {
262
266
  notRedirectAfterComplete?: boolean;
263
267
  extParams?: any;
264
268
  }
269
+ export interface CashierSubmitPayRequest {
270
+ /**
271
+ * @description payment method type
272
+ */
273
+ paymentMethodType?: string;
274
+ /**
275
+ * @description payment factors
276
+ */
277
+ paymentFactors?: Record<string, string>;
278
+ /**
279
+ * @description 需要验证的场景
280
+ */
281
+ verifyFactors?: Record<string, string>;
282
+ paymentSessionData: string;
283
+ paymentSessionConfig?: any;
284
+ }
285
+ export interface CashierSubmitPayRequest {
286
+ paymentMethodType?: string;
287
+ paymentFactors?: Record<string, string>;
288
+ verifyFactors?: Record<string, string>;
289
+ paymentSessionData: string;
290
+ paymentSessionConfig?: any;
291
+ }
265
292
  export interface CashierSdkActionQueryResult {
266
293
  supportedLanguages?: any[];
267
294
  amountConfirmRequired?: boolean;
@@ -279,6 +306,30 @@ export interface CashierSdkActionQueryResult {
279
306
  schemeUrl?: string;
280
307
  authUrl?: string;
281
308
  }
309
+ export declare enum redirectTypeEnum {
310
+ UNSAFE_BROWSER = "UNSAFE_BROWSER",
311
+ SAFETY_BROWSER = "SAFETY_BROWSER",
312
+ INVOKE_SDK = "INVOKE_SDK"
313
+ }
314
+ export interface ActionForm {
315
+ parameters: any;
316
+ redirectUrl: any;
317
+ elementValue?: string;
318
+ redirectType?: redirectTypeEnum;
319
+ }
320
+ export interface CashierSubmitPayResult {
321
+ success: boolean;
322
+ resultCode?: string;
323
+ resultMessage?: string;
324
+ errorActions?: Record<string, string>;
325
+ errorCode?: string;
326
+ errorMessage?: string;
327
+ extendInfo?: Record<string, string>;
328
+ actionForm?: ActionForm;
329
+ normalUrl?: string;
330
+ errorStatus?: string;
331
+ message?: string;
332
+ }
282
333
  export declare enum eventCodeEnum {
283
334
  SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
284
335
  SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
@@ -124,6 +124,12 @@ export var errorEnum = /*#__PURE__*/function (errorEnum) {
124
124
  errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
125
125
  return errorEnum;
126
126
  }({});
127
+ export var redirectTypeEnum = /*#__PURE__*/function (redirectTypeEnum) {
128
+ redirectTypeEnum["UNSAFE_BROWSER"] = "UNSAFE_BROWSER";
129
+ redirectTypeEnum["SAFETY_BROWSER"] = "SAFETY_BROWSER";
130
+ redirectTypeEnum["INVOKE_SDK"] = "INVOKE_SDK";
131
+ return redirectTypeEnum;
132
+ }({}); // 拉SDK
127
133
  export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
128
134
  eventCodeEnum["SDK_START_OF_LOADING"] = "SDK_START_OF_LOADING";
129
135
  eventCodeEnum["SDK_END_OF_LOADING"] = "SDK_END_OF_LOADING";