@alipay/ams-checkout 0.0.1713146800-dev.0 → 0.0.1713838058-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.
@@ -17,11 +17,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
17
17
  * 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.
18
18
  */
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
+ import { sdkVersion } from "../../config";
20
21
  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, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
21
22
  import { queryPaymentInfo, submitPayInfo } from "../../service";
22
23
  import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
23
24
  import { getType, isJsonString, isPC } from "../../util";
24
25
  import { isLocalMock } from "../../util/mock";
26
+ import { matchVersion } from "../../util/versionCompare";
25
27
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
26
28
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
27
29
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
@@ -52,9 +54,8 @@ var ComponentApp = /*#__PURE__*/function () {
52
54
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
53
55
  _defineProperty(this, "_multipleCallbackEvents", void 0);
54
56
  _defineProperty(this, "_merchantAppointParam", void 0);
55
- _defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
56
57
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
57
- this._appVersion = '1.11.0';
58
+ this._appVersion = '1.13.0.1';
58
59
  this._isInitComponent = false;
59
60
  this._selector = "#".concat(COMPONENT_SECTION_ID);
60
61
  this.createIframeNode = function () {
@@ -100,7 +101,8 @@ var ComponentApp = /*#__PURE__*/function () {
100
101
  this.AMSSDK.logger.setMedta({
101
102
  platform: this.platform === platformEnum.desktop ? 'PC' : 'WAP',
102
103
  // PC/WAP,
103
- sdkVersion: this._appVersion,
104
+ sdkVersion: sdkVersion,
105
+ webAppVersion: this._appVersion,
104
106
  instanceId: this.AMSSDK._instanceId,
105
107
  storageId: this.AMSSDK._storageId,
106
108
  // the better way to use md5 paymentSesionID
@@ -364,7 +366,7 @@ var ComponentApp = /*#__PURE__*/function () {
364
366
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
365
367
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
366
368
  var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
367
- var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
369
+ var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, _this5$_renderParams6, _this5$_renderParams7, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
368
370
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
369
371
  while (1) switch (_context2.prev = _context2.next) {
370
372
  case 0:
@@ -380,9 +382,10 @@ var ComponentApp = /*#__PURE__*/function () {
380
382
  /**
381
383
  * @description Simulated or unnecessary scenarios
382
384
  */
383
- _ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
385
+ _ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref3$extendInfo = _ref3.extendInfo, extendInfo = _ref3$extendInfo === void 0 ? '' : _ref3$extendInfo;
384
386
  enableVaultingApiOptimize = false;
385
387
  enableEasypayApiOptimize = false;
388
+ _ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {}, skipSdkQuery = _ref4.skipSdkQuery, skipSdkQueryForm = _ref4.skipSdkQueryForm;
386
389
  try {
387
390
  extendInfoData = JSON.parse(extendInfo);
388
391
  enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
@@ -391,95 +394,123 @@ var ComponentApp = /*#__PURE__*/function () {
391
394
  console.log(error);
392
395
  }
393
396
  if (!isLocalMock()) {
394
- _context2.next = 8;
397
+ _context2.next = 9;
395
398
  break;
396
399
  }
397
400
  return _context2.abrupt("return", resolve({
398
401
  message: 'sdk no need to make query request',
399
402
  success: true
400
403
  }));
401
- case 8:
402
- if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign && (_this5$_renderParams5 = _this5._renderParams) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.action) !== null && _this5$_renderParams5 !== void 0 && _this5$_renderParams5.skipSdkQuery && enableVaultingApiOptimize)) {
403
- _context2.next = 10;
404
+ case 9:
405
+ if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
406
+ _context2.next = 21;
404
407
  break;
405
408
  }
406
- return _context2.abrupt("return", resolve({
409
+ if (!enableVaultingApiOptimize) {
410
+ _context2.next = 21;
411
+ break;
412
+ }
413
+ if (!skipSdkQueryForm) {
414
+ _context2.next = 18;
415
+ break;
416
+ }
417
+ // 优先判断 skipSdkQueryForm
418
+ ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
419
+ if (!ifSkip) {
420
+ _context2.next = 16;
421
+ break;
422
+ }
423
+ resolve({
407
424
  message: 'sdk no need to make query request',
408
425
  success: true
409
- }));
410
- case 10:
426
+ });
427
+ return _context2.abrupt("return");
428
+ case 16:
429
+ _context2.next = 21;
430
+ break;
431
+ case 18:
432
+ if (!skipSdkQuery) {
433
+ _context2.next = 21;
434
+ break;
435
+ }
436
+ resolve({
437
+ message: 'sdk no need to make query request',
438
+ success: true
439
+ });
440
+ return _context2.abrupt("return");
441
+ case 21:
411
442
  if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
412
- _context2.next = 16;
443
+ _context2.next = 27;
413
444
  break;
414
445
  }
415
446
  params.paymentMethodType = 'CARD';
416
- _context2.next = 14;
447
+ _context2.next = 25;
417
448
  return _this5.getDeviceIdAndLog();
418
- case 14:
449
+ case 25:
419
450
  envInfo.deviceId = _context2.sent;
420
451
  if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
421
452
  envInfo.extendInfo = {
422
453
  WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
423
454
  };
424
455
  }
425
- case 16:
456
+ case 27:
426
457
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
427
- _context2.next = 26;
458
+ _context2.next = 37;
428
459
  break;
429
460
  }
430
- _ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
431
- _ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
461
+ _ref5 = params.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer, _ref5$productScene = _ref5.productScene, productScene = _ref5$productScene === void 0 ? '' : _ref5$productScene;
462
+ _ref6 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
432
463
  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)) {
433
- _context2.next = 21;
464
+ _context2.next = 32;
434
465
  break;
435
466
  }
436
467
  return _context2.abrupt("return", resolve({
437
468
  message: 'sdk no need to make query request',
438
469
  success: true
439
470
  }));
440
- case 21:
471
+ case 32:
441
472
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
442
- _context2.next = 23;
473
+ _context2.next = 34;
443
474
  break;
444
475
  }
445
476
  return _context2.abrupt("return", resolve({
446
477
  message: 'sdk no need to make query request',
447
478
  success: true
448
479
  }));
449
- case 23:
450
- _context2.next = 25;
480
+ case 34:
481
+ _context2.next = 36;
451
482
  return _this5.getDeviceIdAndLog();
452
- case 25:
483
+ case 36:
453
484
  envInfo.deviceId = _context2.sent;
454
- case 26:
485
+ case 37:
455
486
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
456
- _context2.next = 36;
487
+ _context2.next = 47;
457
488
  break;
458
489
  }
459
490
  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) || {};
460
491
  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;
461
492
  if (!(signType === 'SMS')) {
462
- _context2.next = 31;
493
+ _context2.next = 42;
463
494
  break;
464
495
  }
465
496
  return _context2.abrupt("return", resolve({
466
497
  message: 'sdk no need to make query request',
467
498
  success: true
468
499
  }));
469
- case 31:
500
+ case 42:
470
501
  if (!(!signType || signType !== 'REDIRECT')) {
471
- _context2.next = 33;
502
+ _context2.next = 44;
472
503
  break;
473
504
  }
474
505
  return _context2.abrupt("return", resolve({
475
506
  success: false
476
507
  }));
477
- case 33:
478
- _context2.next = 35;
508
+ case 44:
509
+ _context2.next = 46;
479
510
  return _this5.getDeviceIdAndLog();
480
- case 35:
511
+ case 46:
481
512
  envInfo.deviceId = _context2.sent;
482
- case 36:
513
+ case 47:
483
514
  _this5.AMSSDK.logger.logInfo({
484
515
  title: 'sdk_event_sdkQuery'
485
516
  }, {
@@ -511,7 +542,7 @@ var ComponentApp = /*#__PURE__*/function () {
511
542
  paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
512
543
  }).send();
513
544
  });
514
- case 38:
545
+ case 49:
515
546
  case "end":
516
547
  return _context2.stop();
517
548
  }
@@ -542,7 +573,7 @@ var ComponentApp = /*#__PURE__*/function () {
542
573
 
543
574
  // eslint-disable-next-line no-async-promise-executor
544
575
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
545
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
576
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
546
577
  var _this6$_renderParams;
547
578
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
548
579
  while (1) switch (_context3.prev = _context3.next) {
@@ -605,7 +636,7 @@ var ComponentApp = /*#__PURE__*/function () {
605
636
  }, _callee3);
606
637
  }));
607
638
  return function (_x3) {
608
- return _ref6.apply(this, arguments);
639
+ return _ref7.apply(this, arguments);
609
640
  };
610
641
  }());
611
642
  }
@@ -652,6 +683,7 @@ var ComponentApp = /*#__PURE__*/function () {
652
683
  analytics: {
653
684
  enabled: false
654
685
  },
686
+ productScene: componentSign,
655
687
  productSceneVersion: productSceneVersion,
656
688
  environment: this.AMSSDK.options.env.environment,
657
689
  // TODO 确定一下这个参数是干啥的
@@ -659,7 +691,8 @@ var ComponentApp = /*#__PURE__*/function () {
659
691
  extendInfo: '',
660
692
  locale: '',
661
693
  instanceId: '',
662
- isPreload: 'true'
694
+ isPreload: 'true',
695
+ mid: ''
663
696
  }),
664
697
  path = _getIframeUrl.path,
665
698
  locationSearch = _getIframeUrl.locationSearch;
@@ -689,16 +722,20 @@ var ComponentApp = /*#__PURE__*/function () {
689
722
  value: Date.now()
690
723
  });
691
724
  try {
692
- var _renderParams$payment, _renderParams$payment2;
725
+ var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4;
693
726
  var productSceneVersion = (renderParams === null || renderParams === void 0 || (_renderParams$payment = renderParams.paymentSessionMetaData) === null || _renderParams$payment === void 0 || (_renderParams$payment = _renderParams$payment.paymentSessionConfig) === null || _renderParams$payment === void 0 ? void 0 : _renderParams$payment.productSceneVersion) || '';
694
- var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.extendInfo) || '';
727
+ var productScene = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 || (_renderParams$payment2 = _renderParams$payment2.paymentSessionConfig) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.productScene) || '';
728
+ var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment3 = renderParams.paymentSessionMetaData) === null || _renderParams$payment3 === void 0 ? void 0 : _renderParams$payment3.extendInfo) || '';
729
+ var mid = renderParams === null || renderParams === void 0 || (_renderParams$payment4 = renderParams.paymentSessionMetaData) === null || _renderParams$payment4 === void 0 ? void 0 : _renderParams$payment4.clientId;
695
730
  var environment = this.AMSSDK.options.env.environment;
696
731
  this.appDomain = getAppDomain({
697
732
  environment: environment,
698
733
  appVersion: this._appVersion,
699
734
  componentSign: this._componentSign,
735
+ productScene: productScene,
700
736
  productSceneVersion: productSceneVersion,
701
- extendInfo: extendInfo
737
+ extendInfo: extendInfo,
738
+ mid: mid
702
739
  });
703
740
  this.app = createIframe(this.AMSSDK.options.mode, this.platform);
704
741
  var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
@@ -706,13 +743,15 @@ var ComponentApp = /*#__PURE__*/function () {
706
743
  renderDisplayType: renderParams.renderDisplayType,
707
744
  componentSign: this._componentSign,
708
745
  analytics: this.AMSSDK.options.analytics,
746
+ productScene: productScene,
709
747
  productSceneVersion: productSceneVersion,
710
748
  environment: environment,
711
749
  appVersion: this._appVersion,
712
750
  extendInfo: extendInfo,
713
751
  locale: this.AMSSDK.options.locale,
714
752
  instanceId: this.AMSSDK._instanceId,
715
- hostSign: hostSign
753
+ hostSign: hostSign,
754
+ mid: mid
716
755
  }),
717
756
  path = _getIframeUrl2.path,
718
757
  locationSearch = _getIframeUrl2.locationSearch;
@@ -1196,9 +1235,9 @@ var ComponentApp = /*#__PURE__*/function () {
1196
1235
  }
1197
1236
  }, {
1198
1237
  key: "handleDeclareInfo",
1199
- value: function handleDeclareInfo(_ref7) {
1200
- var _ref7$closeDialogData = _ref7.closeDialogData,
1201
- closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
1238
+ value: function handleDeclareInfo(_ref8) {
1239
+ var _ref8$closeDialogData = _ref8.closeDialogData,
1240
+ closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
1202
1241
  _handleDeclareInfo({
1203
1242
  closeDialogData: closeDialogData
1204
1243
  });
@@ -1235,12 +1274,12 @@ var ComponentApp = /*#__PURE__*/function () {
1235
1274
  }
1236
1275
  };
1237
1276
  }
1238
- if (this._webAppHeartBeatTimeoutId) {
1239
- clearTimeout(this._webAppHeartBeatTimeoutId);
1240
- this._webAppHeartBeatTimeoutId = null;
1277
+ if (window._webAppHeartBeatTimeoutId) {
1278
+ clearTimeout(window._webAppHeartBeatTimeoutId);
1279
+ window._webAppHeartBeatTimeoutId = null;
1241
1280
  }
1242
1281
  if (this._webAppHeartBeatTimeoutFn) {
1243
- this._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
1282
+ window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
1244
1283
  }
1245
1284
  setTimeout(function () {
1246
1285
  if (_this8.isAppAttached()) {
@@ -1299,17 +1338,20 @@ var ComponentApp = /*#__PURE__*/function () {
1299
1338
  key: "dispatchToApp",
1300
1339
  value: function dispatchToApp(payload) {
1301
1340
  var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1341
+ var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1302
1342
  var data = Object.assign({}, payload, {
1303
1343
  name: messageName.SDK_TO_APP,
1304
1344
  mode: this.AMSSDK.options.mode,
1305
1345
  appId: COMPONENTPLUGINID,
1306
1346
  instanceId: this.AMSSDK._instanceId
1307
1347
  });
1308
- this.AMSSDK.logger.logInfo({
1309
- title: 'sdk_event_send_message_to_web'
1310
- }, {
1311
- event: data === null || data === void 0 ? void 0 : data.context.event
1312
- }).send();
1348
+ if (sendLog) {
1349
+ this.AMSSDK.logger.logInfo({
1350
+ title: 'sdk_event_send_message_to_web'
1351
+ }, {
1352
+ event: data === null || data === void 0 ? void 0 : data.context.event
1353
+ }).send();
1354
+ }
1313
1355
  if (targetElement && targetElement.contentWindow) {
1314
1356
  return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
1315
1357
  }
@@ -1386,7 +1428,7 @@ var ComponentApp = /*#__PURE__*/function () {
1386
1428
  }
1387
1429
  }
1388
1430
  }
1389
- });
1431
+ }, null, true);
1390
1432
  this.AMSSDK.logger.logInfo({
1391
1433
  title: 'sdk_event_renderComponent'
1392
1434
  });
@@ -50,8 +50,6 @@ function requestInstance(options) {
50
50
  withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
51
51
  method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
52
52
  });
53
- console.log('baseURL', baseURL);
54
- console.log('_headers', _headers);
55
53
  return instance.request;
56
54
  }
57
55
 
@@ -99,25 +97,21 @@ function _request() {
99
97
  })];
100
98
  startTime = Date.now();
101
99
  _context.prev = 5;
102
- console.log('requestInstance options', options);
103
- console.log('requestInstance -data', _data);
104
100
  myRequest = requestInstance(options);
105
- _context.next = 11;
101
+ _context.next = 9;
106
102
  return myRequest({
107
103
  data: _data
108
104
  });
109
- case 11:
105
+ case 9:
110
106
  _yield$myRequest = _context.sent;
111
107
  data = _yield$myRequest.data;
112
108
  headers = _yield$myRequest.headers;
113
- console.log('requestInstance data', data);
114
- console.log('requestInstance headers', headers);
115
109
  resData = data || {};
116
110
  traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
117
111
  resData.traceId = traceId || '';
118
112
  handleGetWayError = fomatGetwayError(headers, traceId);
119
113
  if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
120
- _context.next = 25;
114
+ _context.next = 21;
121
115
  break;
122
116
  }
123
117
  errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
@@ -136,7 +130,7 @@ function _request() {
136
130
  errorCode: errorCode,
137
131
  success: false
138
132
  }));
139
- case 25:
133
+ case 21:
140
134
  logger.reportRPC({
141
135
  name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
142
136
  label: 'request',
@@ -147,8 +141,8 @@ function _request() {
147
141
  traceId: traceId
148
142
  }).send();
149
143
  return _context.abrupt("return", resData);
150
- case 29:
151
- _context.prev = 29;
144
+ case 25:
145
+ _context.prev = 25;
152
146
  _context.t0 = _context["catch"](5);
153
147
  _error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
154
148
  success: false,
@@ -170,11 +164,11 @@ function _request() {
170
164
  errorCode: _errorCode,
171
165
  errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
172
166
  }));
173
- case 36:
167
+ case 32:
174
168
  case "end":
175
169
  return _context.stop();
176
170
  }
177
- }, _callee, null, [[5, 29]]);
171
+ }, _callee, null, [[5, 25]]);
178
172
  }));
179
173
  return _request.apply(this, arguments);
180
174
  }
@@ -133,6 +133,11 @@ export interface IpaymentSessionMetaData {
133
133
  action?: {
134
134
  autoDebitWithToken: boolean;
135
135
  skipSdkQuery: boolean;
136
+ skipSdkQueryForm?: {
137
+ value: boolean;
138
+ version: string;
139
+ platform: string;
140
+ };
136
141
  };
137
142
  paymentSessionFactor?: {
138
143
  extendInfo?: {
@@ -0,0 +1 @@
1
+ export declare const isDebugLog: () => boolean;
@@ -0,0 +1,9 @@
1
+ import { queryParse } from ".";
2
+ export var isDebugLog = function isDebugLog() {
3
+ var _ref = queryParse() || {},
4
+ environment = _ref.environment;
5
+ if (!environment) {
6
+ return false;
7
+ }
8
+ return environment !== 'prod';
9
+ };
@@ -12,6 +12,7 @@ type Extra = Record<string, any>;
12
12
  export interface LogMetaData {
13
13
  platform?: string;
14
14
  sdkVersion?: string;
15
+ webAppVersion?: string;
15
16
  fistLogTime?: number;
16
17
  fsDuration?: number;
17
18
  instanceId?: string;
@@ -41,7 +42,10 @@ export declare class Logger {
41
42
  private debug;
42
43
  private componentStartTime;
43
44
  private isLoaded;
45
+ private static instance;
44
46
  constructor(config: Config, debug: boolean);
47
+ static setInstance(instance: Logger): Logger;
48
+ static getInstance(): Logger;
45
49
  setMedta(mdata: LogMetaData): void;
46
50
  logError(error: LogPayload, extra?: Extra): Logger;
47
51
  logInfo(info: LogPayload, extra?: Extra): Logger;
@@ -166,9 +166,20 @@ export var Logger = /*#__PURE__*/function () {
166
166
  value: function setComponentStartTime(val) {
167
167
  this.componentStartTime = val;
168
168
  }
169
+ }], [{
170
+ key: "setInstance",
171
+ value: function setInstance(instance) {
172
+ return this.instance = instance;
173
+ }
174
+ }, {
175
+ key: "getInstance",
176
+ value: function getInstance() {
177
+ return this.instance;
178
+ }
169
179
  }]);
170
180
  return Logger;
171
181
  }();
182
+ _defineProperty(Logger, "instance", void 0);
172
183
  export var LogConfig = {
173
184
  scriptUrl: 'https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_intl-tracker/1.6.0/dist/common.min.js',
174
185
  spmConfig: {},
@@ -0,0 +1,2 @@
1
+ export declare const getStorageString: (key: string, fallback?: string) => string;
2
+ export declare const setStorageString: (key: string, value: string) => boolean;
@@ -0,0 +1,23 @@
1
+ export var getStorageString = function getStorageString(key) {
2
+ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
3
+ try {
4
+ if (key && window) {
5
+ var storageValue = window.localStorage.getItem(key);
6
+ if (storageValue) {
7
+ return storageValue;
8
+ }
9
+ return fallback;
10
+ }
11
+ } catch (error) {
12
+ return fallback;
13
+ }
14
+ };
15
+ export var setStorageString = function setStorageString(key, value) {
16
+ try {
17
+ if (key && window) {
18
+ window.localStorage.setItem(key, value);
19
+ return true;
20
+ }
21
+ } catch (error) {}
22
+ return false;
23
+ };
@@ -0,0 +1,39 @@
1
+ export declare function isWebPlatform(platform?: string): boolean;
2
+ export interface UpgradeItem {
3
+ productScene?: string;
4
+ v: string;
5
+ appVersion: string;
6
+ platform?: string;
7
+ mid?: string;
8
+ greyscale?: string;
9
+ }
10
+ export interface UpgradeSdkInfo {
11
+ productScene?: string;
12
+ sdkVersion: string;
13
+ appVersion?: string;
14
+ greyscale?: number;
15
+ mid?: string;
16
+ }
17
+ export declare function findUpgradeVersion(upgradeItems: UpgradeItem[], sdkInfo: UpgradeSdkInfo): string;
18
+ export declare const getGrascaleId: (key?: string) => string;
19
+ export declare function getGrayscaleValue(seed?: string): number;
20
+ export declare function isGreyscaleMatch(item: UpgradeItem, randomGreyscale: number): boolean;
21
+ /**
22
+ * 查询匹配到的版本
23
+ * @param _extendInfo
24
+ * @param param1
25
+ * @returns
26
+ */
27
+ export declare const getMatchAppVersion: (_extendInfo: string, sdkInfo: UpgradeSdkInfo) => string;
28
+ /**
29
+ * 获取保存的加载版本
30
+ * @param productScene
31
+ * @returns
32
+ */
33
+ export declare const getLastAppVersion: (productScene: string) => string;
34
+ /**
35
+ * 保存指定场景的加载版本供下次使用
36
+ * @param productScene
37
+ * @returns
38
+ */
39
+ export declare const setLastAppVersion: (productScene: string, appVersion: string) => boolean;