@alipay/ams-checkout 0.0.1700804278-dev.1 → 0.0.1701393225-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,11 +17,10 @@ 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";
21
- import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, SecuritySceneEnum, targetEnum } from "../../types";
20
+ import { queryPaymentInfo, submitPayInfo } from "../../service";
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";
24
- import { getApdidToken, getAppname, getSecurityHost, initSecuritySDK } from "../../util/security";
25
24
  import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
26
25
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
27
26
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
@@ -44,12 +43,13 @@ var ComponentApp = /*#__PURE__*/function () {
44
43
  _defineProperty(this, "_appVersion", void 0);
45
44
  _defineProperty(this, "_isRetention", void 0);
46
45
  _defineProperty(this, "_actionQueryPromise", null);
46
+ _defineProperty(this, "_actionSubmitPromise", null);
47
47
  _defineProperty(this, "_renderParams", null);
48
48
  _defineProperty(this, "_componentSign", componentSignEnum.NONE);
49
49
  _defineProperty(this, "_appLocationSearch", void 0);
50
50
  _defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
51
51
  _defineProperty(this, "_multipleCallbackEvents", void 0);
52
- this._appVersion = '1.6.0';
52
+ this._appVersion = '1.6.1';
53
53
  this._isInitComponent = false;
54
54
  this._selector = "#".concat(COMPONENT_SECTION_ID);
55
55
  this.createIframeNode = function () {
@@ -86,7 +86,6 @@ var ComponentApp = /*#__PURE__*/function () {
86
86
  key: "initLoggerMeta",
87
87
  value: function initLoggerMeta() {
88
88
  var _this$_renderParams, _paymentSessionMetaDa;
89
- console.log('this._renderParams', JSON.stringify(this._renderParams), null, 3);
90
89
  var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
91
90
  var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
92
91
  this.AMSSDK.logger.setMedta({
@@ -115,39 +114,39 @@ var ComponentApp = /*#__PURE__*/function () {
115
114
  this.createIframeNode = renderFunc;
116
115
  }
117
116
  }, {
118
- key: "initAPSecurity",
119
- value: function initAPSecurity() {
117
+ key: "initSecurity",
118
+ value: function initSecurity() {
120
119
  var _this$_renderParams2,
121
120
  _this = this;
122
- if (componentSignEnum.CASHIER_PAYMENT_CARD !== this._componentSign) {
123
- return;
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;
126
- if (!securityConfig) {
127
- return;
128
- }
129
- var appName = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.appName;
130
- var h5gateway = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.h5gateway;
131
-
132
- // if merchant have init securitySDK and same as service paymentSessionMetaData, no need init again
133
- if (this.AMSSDK.securityConfig) {
134
- if (appName === getAppname(this.AMSSDK.securityConfig.scene) && h5gateway === getSecurityHost(this.AMSSDK.securityConfig.region)) {
135
- return;
136
- }
121
+ var product = (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 || (_this$_renderParams2 = _this$_renderParams2.paymentSessionMetaData) === null || _this$_renderParams2 === void 0 || (_this$_renderParams2 = _this$_renderParams2.paymentSessionConfig) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.productScene;
122
+ if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
123
+ this.AMSSDK.logger.logInfo({
124
+ title: 'sdk_event_security_unneeded_scenarios'
125
+ }, {
126
+ product: product
127
+ });
137
128
  }
138
- this.AMSSDK.logger.logInfo({
139
- title: 'sdk_event_securitySdkInit'
129
+ var securitySDK = this.AMSSDK._getSecuritySDKByProductScene({
130
+ product: product
140
131
  });
141
- initSecuritySDK(appName, h5gateway, function () {
142
- _this.AMSSDK.logger.logInfo({
143
- title: 'sdk_event_securitySdkInitSuccess'
132
+ if (!securitySDK) {
133
+ this.AMSSDK.logger.logInfo({
134
+ title: 'sdk_event_securitySdkInit'
144
135
  });
145
- }, function () {
146
- // TODO Distinguishing Call Scenarios of Security SDK Failures
147
- _this.AMSSDK.logger.logError({
148
- title: 'sdk_error_securitySdkInitFailed'
136
+ this.AMSSDK._newSecuritySDKByScene({
137
+ product: product
138
+ }, function () {
139
+ _this.AMSSDK.logger.logInfo({
140
+ title: 'sdk_event_securitySdkInitSuccess'
141
+ });
142
+ }, function () {
143
+ _this.AMSSDK.logger.logError({
144
+ title: 'sdk_error_securitySdkInitFailed'
145
+ }, {
146
+ sign: 'SDK internal initialization'
147
+ });
149
148
  });
150
- });
149
+ }
151
150
  }
152
151
  }, {
153
152
  key: "logDeviceId",
@@ -173,23 +172,47 @@ var ComponentApp = /*#__PURE__*/function () {
173
172
  key: "getDeviceIdAndLog",
174
173
  value: function getDeviceIdAndLog() {
175
174
  var _this2 = this;
175
+ var deviceIdParameter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
176
+ var isPolling = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
176
177
  return new Promise(function (resolve) {
177
178
  // To avoid rendering being blocked, move the logic to the next event loop for processing
178
179
  setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
179
180
  var _this2$_renderParams;
180
- var securityConfig, getDeviceIdStartTime, deviceId;
181
+ var productScene, getDeviceIdStartTime, securitySDK, deviceId;
181
182
  return _regeneratorRuntime().wrap(function _callee$(_context) {
182
183
  while (1) switch (_context.prev = _context.next) {
183
184
  case 0:
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;
185
+ productScene = (_this2$_renderParams = _this2._renderParams) === null || _this2$_renderParams === void 0 || (_this2$_renderParams = _this2$_renderParams.paymentSessionMetaData) === null || _this2$_renderParams === void 0 || (_this2$_renderParams = _this2$_renderParams.paymentSessionConfig) === null || _this2$_renderParams === void 0 ? void 0 : _this2$_renderParams.productScene;
185
186
  getDeviceIdStartTime = Date.now();
186
- _context.next = 4;
187
- return getApdidToken(getAppname(SecuritySceneEnum.CARD), securityConfig);
188
- case 4:
189
- deviceId = _context.sent;
187
+ securitySDK = _this2.AMSSDK._getSecuritySDKByProductScene({
188
+ product: (deviceIdParameter === null || deviceIdParameter === void 0 ? void 0 : deviceIdParameter.productScene) || productScene
189
+ });
190
+ deviceId = '';
191
+ if (!securitySDK) {
192
+ _context.next = 16;
193
+ break;
194
+ }
195
+ if (!(isPolling && parseInt(deviceIdParameter === null || deviceIdParameter === void 0 ? void 0 : deviceIdParameter.tokenCollectTime) > 0)) {
196
+ _context.next = 11;
197
+ break;
198
+ }
199
+ _context.next = 8;
200
+ return securitySDK.pollingGetApdidToken(deviceIdParameter);
201
+ case 8:
202
+ _context.t0 = _context.sent;
203
+ _context.next = 14;
204
+ break;
205
+ case 11:
206
+ _context.next = 13;
207
+ return securitySDK.getApdidToken();
208
+ case 13:
209
+ _context.t0 = _context.sent;
210
+ case 14:
211
+ deviceId = _context.t0;
190
212
  _this2.logDeviceId(deviceId, getDeviceIdStartTime);
213
+ case 16:
191
214
  resolve(deviceId);
192
- case 7:
215
+ case 17:
193
216
  case "end":
194
217
  return _context.stop();
195
218
  }
@@ -215,7 +238,7 @@ var ComponentApp = /*#__PURE__*/function () {
215
238
  if (renderParams !== null && renderParams !== void 0 && renderParams.selector) this._selector = renderParams.selector;
216
239
  this._renderDisplayType = renderParams.renderDisplayType;
217
240
  var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
218
- this.initAPSecurity();
241
+ this.initSecurity();
219
242
  this.initLoggerMeta();
220
243
  this._performanceData.push({
221
244
  key: 'sdk_create_component',
@@ -236,12 +259,12 @@ var ComponentApp = /*#__PURE__*/function () {
236
259
  this.renderPopupLoading(renderParams);
237
260
  }
238
261
  this.createApp(renderParams);
239
- return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
240
- _this3.AMSSDK.logger.logInfo({
241
- title: 'sdk_event_successfully_created_app_process'
242
- }).send();
262
+ return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
243
263
  return Promise.resolve();
244
264
  }).catch(function (error) {
265
+ _this3.AMSSDK.logger.logError({
266
+ title: 'sdk_error_created_app_process_failed'
267
+ }).send();
245
268
  _this3._isInitComponent = false;
246
269
  _this3.cleanContainer();
247
270
  return Promise.reject(error);
@@ -303,7 +326,7 @@ var ComponentApp = /*#__PURE__*/function () {
303
326
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
304
327
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
305
328
  var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
306
- 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;
329
+ 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;
307
330
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
308
331
  while (1) switch (_context2.prev = _context2.next) {
309
332
  case 0:
@@ -316,74 +339,80 @@ var ComponentApp = /*#__PURE__*/function () {
316
339
  notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
317
340
  };
318
341
  /**
319
- * @description card
342
+ * @description Simulated or unnecessary scenarios
320
343
  */
321
- if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign) {
322
- params.paymentMethodType = 'CARD';
323
- }
324
- 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;
325
- if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
326
- _context2.next = 11;
344
+ if (!(isLocalMock() || (_this5$_renderParams4 = _this5._renderParams) !== null && _this5$_renderParams4 !== void 0 && (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) !== null && _this5$_renderParams4 !== void 0 && (_this5$_renderParams4 = _this5$_renderParams4.action) !== null && _this5$_renderParams4 !== void 0 && _this5$_renderParams4.skipSdkQuery)) {
345
+ _context2.next = 4;
327
346
  break;
328
347
  }
329
- 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) || '{}';
330
- info = JSON.parse(extendInfo);
331
- if (!((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false')) {
332
- _context2.next = 11;
348
+ return _context2.abrupt("return", resolve({
349
+ message: 'sdk no need to make query request',
350
+ success: true
351
+ }));
352
+ case 4:
353
+ if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
354
+ _context2.next = 9;
333
355
  break;
334
356
  }
335
- _context2.next = 10;
357
+ params.paymentMethodType = 'CARD';
358
+ _context2.next = 8;
336
359
  return _this5.getDeviceIdAndLog();
337
- case 10:
360
+ case 8:
338
361
  envInfo.deviceId = _context2.sent;
339
- case 11:
362
+ case 9:
340
363
  if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
341
- _context2.next = 16;
364
+ _context2.next = 17;
342
365
  break;
343
366
  }
344
367
  _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;
345
- _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;
368
+ _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;
346
369
  if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
347
- _context2.next = 16;
370
+ _context2.next = 14;
348
371
  break;
349
372
  }
350
373
  return _context2.abrupt("return", resolve({
351
374
  message: 'sdk no need to make query request',
352
375
  success: true
353
376
  }));
377
+ case 14:
378
+ _context2.next = 16;
379
+ return _this5.getDeviceIdAndLog();
354
380
  case 16:
381
+ envInfo.deviceId = _context2.sent;
382
+ case 17:
355
383
  if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
356
- _context2.next = 23;
384
+ _context2.next = 27;
357
385
  break;
358
386
  }
359
- 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) || {};
387
+ 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) || {};
360
388
  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;
361
389
  if (!(signType === 'SMS')) {
362
- _context2.next = 21;
390
+ _context2.next = 22;
363
391
  break;
364
392
  }
365
393
  return _context2.abrupt("return", resolve({
366
394
  message: 'sdk no need to make query request',
367
395
  success: true
368
396
  }));
369
- case 21:
397
+ case 22:
370
398
  if (!(!signType || signType !== 'REDIRECT')) {
371
- _context2.next = 23;
399
+ _context2.next = 24;
372
400
  break;
373
401
  }
374
402
  return _context2.abrupt("return", resolve({
375
403
  success: false
376
404
  }));
377
- case 23:
378
- if (!isLocalMock()) {
379
- _context2.next = 25;
380
- break;
381
- }
382
- return _context2.abrupt("return", resolve({
383
- message: 'sdk no need to make query request',
384
- success: true
385
- }));
386
- case 25:
405
+ case 24:
406
+ _context2.next = 26;
407
+ return _this5.getDeviceIdAndLog();
408
+ case 26:
409
+ envInfo.deviceId = _context2.sent;
410
+ case 27:
411
+ _this5.AMSSDK.logger.logInfo({
412
+ title: 'sdk_event_sdkQuery'
413
+ }, {
414
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
415
+ }).send();
387
416
  queryPaymentInfo(params, {
388
417
  env: _this5.AMSSDK.options.env.environment,
389
418
  envInfo: envInfo
@@ -407,8 +436,14 @@ var ComponentApp = /*#__PURE__*/function () {
407
436
  code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
408
437
  });
409
438
  reject(err);
439
+ }).finally(function () {
440
+ _this5.AMSSDK.logger.logInfo({
441
+ title: 'sdk_event_sdkQueryEnd'
442
+ }, {
443
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
444
+ }).send();
410
445
  });
411
- case 26:
446
+ case 29:
412
447
  case "end":
413
448
  return _context2.stop();
414
449
  }
@@ -420,6 +455,90 @@ var ComponentApp = /*#__PURE__*/function () {
420
455
  }());
421
456
  return this._actionQueryPromise;
422
457
  }
458
+ }, {
459
+ key: "createSubmitPromise",
460
+ value: function createSubmitPromise() {
461
+ var _this$_renderParams3,
462
+ _this$_renderParams4,
463
+ _this6 = this;
464
+ this._performanceData.push({
465
+ key: 'sdk_submit_start',
466
+ value: Date.now()
467
+ });
468
+ var params = {
469
+ paymentSessionData: this._renderParams && ((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData) || '',
470
+ 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
471
+ };
472
+
473
+ // eslint-disable-next-line no-async-promise-executor
474
+ this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
475
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
476
+ var _this6$_renderParams;
477
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
478
+ while (1) switch (_context3.prev = _context3.next) {
479
+ case 0:
480
+ if (!(!((_this6$_renderParams = _this6._renderParams) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.paymentSessionMetaData) !== null && _this6$_renderParams !== void 0 && (_this6$_renderParams = _this6$_renderParams.action) !== null && _this6$_renderParams !== void 0 && _this6$_renderParams.skipSdkQuery) || componentSignEnum.EASY_PAY_WALLET !== _this6._componentSign)) {
481
+ _context3.next = 2;
482
+ break;
483
+ }
484
+ return _context3.abrupt("return", resolve({
485
+ message: 'sdk no need to make submitPay request',
486
+ success: true
487
+ }));
488
+ case 2:
489
+ _this6.AMSSDK.logger.logInfo({
490
+ title: 'sdk_event_submitPay'
491
+ }, {
492
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
493
+ }).send();
494
+ _context3.t0 = submitPayInfo;
495
+ _context3.t1 = params;
496
+ _context3.t2 = _this6.AMSSDK.options.env.environment;
497
+ _context3.next = 8;
498
+ return _this6.getDeviceIdAndLog();
499
+ case 8:
500
+ _context3.t3 = _context3.sent;
501
+ _context3.t4 = {
502
+ deviceId: _context3.t3
503
+ };
504
+ _context3.t5 = {
505
+ env: _context3.t2,
506
+ timeout: 15000,
507
+ envInfo: _context3.t4
508
+ };
509
+ _context3.t6 = _this6.AMSSDK.logger;
510
+ (0, _context3.t0)(_context3.t1, _context3.t5, _context3.t6).then(function (res) {
511
+ _this6._performanceData.push({
512
+ key: 'sdk_submit_end',
513
+ value: Date.now()
514
+ });
515
+ if (res !== null && res !== void 0 && res.success) {
516
+ resolve(res);
517
+ } else {
518
+ resolve(res);
519
+ }
520
+ }).catch(function () {
521
+ resolve({
522
+ success: false
523
+ });
524
+ }).finally(function () {
525
+ _this6.AMSSDK.logger.logInfo({
526
+ title: 'sdk_event_submitPayEnd'
527
+ }, {
528
+ paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
529
+ }).send();
530
+ });
531
+ case 13:
532
+ case "end":
533
+ return _context3.stop();
534
+ }
535
+ }, _callee3);
536
+ }));
537
+ return function (_x3) {
538
+ return _ref5.apply(this, arguments);
539
+ };
540
+ }());
541
+ }
423
542
  }, {
424
543
  key: "cleanElement",
425
544
  value: function cleanElement() {
@@ -536,9 +655,9 @@ var ComponentApp = /*#__PURE__*/function () {
536
655
  }, {
537
656
  key: "createPopupWindow",
538
657
  value: function createPopupWindow(data) {
539
- var _this$_renderParams3;
658
+ var _this$_renderParams5;
540
659
  this._threedData = data;
541
- var sessionData = encodeURIComponent((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData);
660
+ var sessionData = encodeURIComponent((_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData);
542
661
  var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&").concat(this._appLocationSearch);
543
662
  this.popupWindow = createModal({
544
663
  device: this.platform,
@@ -548,19 +667,19 @@ var ComponentApp = /*#__PURE__*/function () {
548
667
  }, {
549
668
  key: "getDeviceIdAndCallback",
550
669
  value: function () {
551
- var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventContext) {
670
+ var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(eventContext) {
552
671
  var deviceId;
553
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
554
- while (1) switch (_context3.prev = _context3.next) {
672
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
673
+ while (1) switch (_context4.prev = _context4.next) {
555
674
  case 0:
556
675
  if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
557
- _context3.next = 5;
676
+ _context4.next = 5;
558
677
  break;
559
678
  }
560
- _context3.next = 3;
561
- return this.getDeviceIdAndLog();
679
+ _context4.next = 3;
680
+ return this.getDeviceIdAndLog(eventContext === null || eventContext === void 0 ? void 0 : eventContext.data, true);
562
681
  case 3:
563
- deviceId = _context3.sent;
682
+ deviceId = _context4.sent;
564
683
  this.dispatchToApp({
565
684
  context: {
566
685
  event: 'appEventCallback',
@@ -572,11 +691,11 @@ var ComponentApp = /*#__PURE__*/function () {
572
691
  });
573
692
  case 5:
574
693
  case "end":
575
- return _context3.stop();
694
+ return _context4.stop();
576
695
  }
577
- }, _callee3, this);
696
+ }, _callee4, this);
578
697
  }));
579
- function getDeviceIdAndCallback(_x3) {
698
+ function getDeviceIdAndCallback(_x4) {
580
699
  return _getDeviceIdAndCallback.apply(this, arguments);
581
700
  }
582
701
  return getDeviceIdAndCallback;
@@ -745,7 +864,7 @@ var ComponentApp = /*#__PURE__*/function () {
745
864
  }, {
746
865
  key: "handleRedirect",
747
866
  value: function handleRedirect(data) {
748
- var _this6 = this;
867
+ var _this7 = this;
749
868
  var _data = typeof data === 'string' ? {
750
869
  normalUrl: data
751
870
  } : {
@@ -760,11 +879,11 @@ var ComponentApp = /*#__PURE__*/function () {
760
879
  redirectInfo: JSON.stringify(_data)
761
880
  }).send();
762
881
  var successCallback = function successCallback(type, url) {
763
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
882
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
764
883
  code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
765
884
  message: "Successfully opened the app,".concat(type, ": ").concat(url)
766
885
  });
767
- _this6.AMSSDK.logger.logInfo({
886
+ _this7.AMSSDK.logger.logInfo({
768
887
  title: 'sdk_event_call_url_success'
769
888
  }, {
770
889
  redirectInfo: JSON.stringify(_data),
@@ -773,11 +892,11 @@ var ComponentApp = /*#__PURE__*/function () {
773
892
  }).send();
774
893
  };
775
894
  var failCallback = function failCallback(type, url) {
776
- _this6.dispatchToSDK(EVENT.eventCallback.name, {
777
- code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
895
+ _this7.dispatchToSDK(EVENT.eventCallback.name, {
896
+ code: eventCodeEnum.SDK_CALL_URL_ERROR,
778
897
  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)
779
898
  });
780
- _this6.AMSSDK.logger.logInfo({
899
+ _this7.AMSSDK.logger.logInfo({
781
900
  title: 'sdk_error_call_url_failed'
782
901
  }, {
783
902
  redirectInfo: JSON.stringify(_data),
@@ -800,14 +919,14 @@ var ComponentApp = /*#__PURE__*/function () {
800
919
  successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
801
920
  }).catch(function () {
802
921
  failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
803
- return _this6.AMSSDK._redirect({
922
+ return _this7.AMSSDK._redirect({
804
923
  schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
805
924
  });
806
925
  }).then(function () {
807
926
  successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
808
927
  }).catch(function () {
809
928
  failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
810
- return _this6.AMSSDK._redirect({
929
+ return _this7.AMSSDK._redirect({
811
930
  normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
812
931
  });
813
932
  }).then(function () {
@@ -818,9 +937,9 @@ var ComponentApp = /*#__PURE__*/function () {
818
937
  }
819
938
  }, {
820
939
  key: "handleDeclareInfo",
821
- value: function handleDeclareInfo(_ref5) {
822
- var _ref5$closeDialogData = _ref5.closeDialogData,
823
- closeDialogData = _ref5$closeDialogData === void 0 ? {} : _ref5$closeDialogData;
940
+ value: function handleDeclareInfo(_ref6) {
941
+ var _ref6$closeDialogData = _ref6.closeDialogData,
942
+ closeDialogData = _ref6$closeDialogData === void 0 ? {} : _ref6$closeDialogData;
824
943
  _handleDeclareInfo({
825
944
  closeDialogData: closeDialogData
826
945
  });
@@ -912,22 +1031,26 @@ var ComponentApp = /*#__PURE__*/function () {
912
1031
  }, {
913
1032
  key: "sendRenderEvent",
914
1033
  value: function () {
915
- var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
916
- var _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, res;
917
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
918
- while (1) switch (_context4.prev = _context4.next) {
1034
+ var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1035
+ var _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, _this$_renderParams9, _this$_renderParams10, res, submitRes;
1036
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1037
+ while (1) switch (_context5.prev = _context5.next) {
919
1038
  case 0:
920
- _context4.prev = 0;
921
- if (this._actionQueryPromise) {
922
- _context4.next = 3;
1039
+ _context5.prev = 0;
1040
+ if (!(!this._actionQueryPromise || !this._actionSubmitPromise)) {
1041
+ _context5.next = 3;
923
1042
  break;
924
1043
  }
925
- return _context4.abrupt("return");
1044
+ return _context5.abrupt("return");
926
1045
  case 3:
927
- _context4.next = 5;
1046
+ _context5.next = 5;
928
1047
  return this._actionQueryPromise;
929
1048
  case 5:
930
- res = _context4.sent;
1049
+ res = _context5.sent;
1050
+ _context5.next = 8;
1051
+ return this._actionSubmitPromise;
1052
+ case 8:
1053
+ submitRes = _context5.sent;
931
1054
  this._performanceData.push({
932
1055
  key: 'sdk_render_component',
933
1056
  value: Date.now()
@@ -937,12 +1060,13 @@ var ComponentApp = /*#__PURE__*/function () {
937
1060
  event: 'renderComponent',
938
1061
  data: {
939
1062
  queryResult: res,
940
- sessionResult: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionMetaData,
941
- paymentSessionData: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData,
1063
+ submitResult: submitRes,
1064
+ sessionResult: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.paymentSessionMetaData,
1065
+ paymentSessionData: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.sessionData,
942
1066
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
943
- renderDisplayType: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.renderDisplayType,
944
- appearance: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.appearance,
945
- notRedirectAfterComplete: ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.notRedirectAfterComplete) === true,
1067
+ renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
1068
+ appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
1069
+ notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
946
1070
  envInfo: {
947
1071
  screenHeight: screen.height,
948
1072
  screenWidth: screen.width
@@ -959,16 +1083,16 @@ var ComponentApp = /*#__PURE__*/function () {
959
1083
  }
960
1084
  });
961
1085
  // eslint-disable-next-line no-empty
962
- _context4.next = 13;
1086
+ _context5.next = 16;
963
1087
  break;
964
- case 11:
965
- _context4.prev = 11;
966
- _context4.t0 = _context4["catch"](0);
967
- case 13:
1088
+ case 14:
1089
+ _context5.prev = 14;
1090
+ _context5.t0 = _context5["catch"](0);
1091
+ case 16:
968
1092
  case "end":
969
- return _context4.stop();
1093
+ return _context5.stop();
970
1094
  }
971
- }, _callee4, this, [[0, 11]]);
1095
+ }, _callee5, this, [[0, 14]]);
972
1096
  }));
973
1097
  function sendRenderEvent() {
974
1098
  return _sendRenderEvent.apply(this, arguments);
@@ -982,7 +1106,7 @@ var ComponentApp = /*#__PURE__*/function () {
982
1106
  key: "cleanContainer",
983
1107
  value: function cleanContainer() {
984
1108
  var _document$getElementB4,
985
- _this7 = this;
1109
+ _this8 = this;
986
1110
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
987
1111
  this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
988
1112
  this._performanceData = [];
@@ -994,7 +1118,7 @@ var ComponentApp = /*#__PURE__*/function () {
994
1118
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
995
1119
  if (immediately) this.cleanElement();else {
996
1120
  setTimeout(function () {
997
- _this7.cleanElement();
1121
+ _this8.cleanElement();
998
1122
  }, 300);
999
1123
  }
1000
1124
  }
@@ -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>;