@alipay/ams-checkout 0.0.1710212811-dev.15 → 0.0.1710212811-dev.18
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,7 +17,6 @@ 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 { SecurityBusSubscriber } from "../../core/bus/ability/security";
|
21
20
|
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";
|
22
21
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
23
22
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
@@ -27,11 +26,9 @@ import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from ".
|
|
27
26
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
28
27
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
29
28
|
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
30
|
-
import { BusManager } from "../../core/bus";
|
31
29
|
window.changingPageHeight = window.innerHeight;
|
32
30
|
var ComponentApp = /*#__PURE__*/function () {
|
33
31
|
function ComponentApp() {
|
34
|
-
var _this = this;
|
35
32
|
_classCallCheck(this, ComponentApp);
|
36
33
|
_defineProperty(this, "app", void 0);
|
37
34
|
_defineProperty(this, "AMSSDK", void 0);
|
@@ -74,9 +71,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
74
71
|
value: Date.now()
|
75
72
|
});
|
76
73
|
this._globalData = new Map();
|
77
|
-
BusManager.subscribe(new SecurityBusSubscriber(function (deviceIdParameter, isPolling) {
|
78
|
-
return _this.getDeviceIdAndLog(deviceIdParameter, isPolling);
|
79
|
-
}));
|
80
74
|
}
|
81
75
|
|
82
76
|
/**
|
@@ -138,7 +132,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
138
132
|
key: "initSecurity",
|
139
133
|
value: function initSecurity() {
|
140
134
|
var _this$_renderParams3,
|
141
|
-
|
135
|
+
_this = this;
|
142
136
|
var product = (_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionMetaData) === null || _this$_renderParams3 === void 0 || (_this$_renderParams3 = _this$_renderParams3.paymentSessionConfig) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.productScene;
|
143
137
|
if (componentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
|
144
138
|
if (componentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
|
@@ -158,11 +152,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
158
152
|
this.AMSSDK._newSecuritySDKByScene({
|
159
153
|
product: product
|
160
154
|
}, function () {
|
161
|
-
|
155
|
+
_this.AMSSDK.logger.logInfo({
|
162
156
|
title: 'sdk_event_securitySdkInitSuccess'
|
163
157
|
});
|
164
158
|
}, function () {
|
165
|
-
|
159
|
+
_this.AMSSDK.logger.logError({
|
166
160
|
title: 'sdk_error_securitySdkInitFailed'
|
167
161
|
}, {
|
168
162
|
sign: 'SDK internal initialization'
|
@@ -193,20 +187,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
193
187
|
}, {
|
194
188
|
key: "getDeviceIdAndLog",
|
195
189
|
value: function getDeviceIdAndLog() {
|
196
|
-
var
|
190
|
+
var _this2 = this;
|
197
191
|
var deviceIdParameter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
198
192
|
var isPolling = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
199
193
|
return new Promise(function (resolve) {
|
200
194
|
// To avoid rendering being blocked, move the logic to the next event loop for processing
|
201
195
|
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
202
|
-
var
|
196
|
+
var _this2$_renderParams;
|
203
197
|
var productScene, getDeviceIdStartTime, securitySDK, deviceId;
|
204
198
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
205
199
|
while (1) switch (_context.prev = _context.next) {
|
206
200
|
case 0:
|
207
|
-
productScene = (
|
201
|
+
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;
|
208
202
|
getDeviceIdStartTime = Date.now();
|
209
|
-
securitySDK =
|
203
|
+
securitySDK = _this2.AMSSDK._getSecuritySDKByProductScene({
|
210
204
|
product: (deviceIdParameter === null || deviceIdParameter === void 0 ? void 0 : deviceIdParameter.productScene) || productScene
|
211
205
|
});
|
212
206
|
deviceId = '';
|
@@ -231,7 +225,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
231
225
|
_context.t0 = _context.sent;
|
232
226
|
case 14:
|
233
227
|
deviceId = _context.t0;
|
234
|
-
|
228
|
+
_this2.logDeviceId(deviceId, getDeviceIdStartTime);
|
235
229
|
case 16:
|
236
230
|
resolve(deviceId);
|
237
231
|
case 17:
|
@@ -250,7 +244,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
250
244
|
key: "appendIframeNodes",
|
251
245
|
value: function appendIframeNodes(componentSign, renderParams) {
|
252
246
|
var _renderParams,
|
253
|
-
|
247
|
+
_this3 = this;
|
254
248
|
if (this._isInitComponent) {
|
255
249
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
256
250
|
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
@@ -287,11 +281,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
287
281
|
return Promise.all([this.createActionQueryPromise(), this.createSubmitPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
288
282
|
return Promise.resolve();
|
289
283
|
}).catch(function (error) {
|
290
|
-
|
284
|
+
_this3.AMSSDK.logger.logError({
|
291
285
|
title: 'sdk_error_created_app_process_failed'
|
292
286
|
}).send();
|
293
|
-
|
294
|
-
|
287
|
+
_this3._isInitComponent = false;
|
288
|
+
_this3.cleanContainer();
|
295
289
|
return Promise.reject(error);
|
296
290
|
});
|
297
291
|
}
|
@@ -339,15 +333,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
339
333
|
}, {
|
340
334
|
key: "_createLoadAppPromise",
|
341
335
|
value: function _createLoadAppPromise(loadTimeLimit) {
|
342
|
-
var
|
336
|
+
var _this4 = this;
|
343
337
|
return new Promise(function (resolve, reject) {
|
344
|
-
|
338
|
+
_this4._loadAppPromiseResolve = resolve;
|
345
339
|
setTimeout(function () {
|
346
340
|
reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
347
341
|
}, loadTimeLimit !== null && loadTimeLimit !== void 0 ? loadTimeLimit : LOADTIME_LIMIT);
|
348
342
|
}).catch(function (error) {
|
349
|
-
|
350
|
-
|
343
|
+
_this4.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
344
|
+
_this4.AMSSDK.logger.logError({
|
351
345
|
title: 'sdk_error_web_app_timeout'
|
352
346
|
}).send();
|
353
347
|
return Promise.reject(error);
|
@@ -360,7 +354,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
360
354
|
}, {
|
361
355
|
key: "createActionQueryPromise",
|
362
356
|
value: function createActionQueryPromise() {
|
363
|
-
var
|
357
|
+
var _this5 = this;
|
364
358
|
this._performanceData.push({
|
365
359
|
key: 'sdk_action_query_start',
|
366
360
|
value: Date.now()
|
@@ -369,24 +363,24 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
369
363
|
// eslint-disable-next-line no-async-promise-executor
|
370
364
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
371
365
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
372
|
-
var
|
373
|
-
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData,
|
366
|
+
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;
|
374
368
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
375
369
|
while (1) switch (_context2.prev = _context2.next) {
|
376
370
|
case 0:
|
377
371
|
envInfo = {
|
378
|
-
locale:
|
372
|
+
locale: _this5.AMSSDK.options.locale
|
379
373
|
};
|
380
374
|
params = {
|
381
|
-
paymentSessionData:
|
382
|
-
paymentSessionConfig: (
|
383
|
-
notRedirectAfterComplete: ((
|
384
|
-
merchantAppointParam:
|
375
|
+
paymentSessionData: _this5._renderParams && ((_this5$_renderParams = _this5._renderParams) === null || _this5$_renderParams === void 0 ? void 0 : _this5$_renderParams.sessionData) || '',
|
376
|
+
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,
|
377
|
+
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true,
|
378
|
+
merchantAppointParam: _this5._merchantAppointParam
|
385
379
|
};
|
386
380
|
/**
|
387
381
|
* @description Simulated or unnecessary scenarios
|
388
382
|
*/
|
389
|
-
_ref3 = ((
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
|
390
384
|
enableVaultingApiOptimize = false;
|
391
385
|
enableEasypayApiOptimize = false;
|
392
386
|
try {
|
@@ -405,7 +399,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
405
399
|
success: true
|
406
400
|
}));
|
407
401
|
case 8:
|
408
|
-
if (!(componentSignEnum.VAULTING_CARD ===
|
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)) {
|
409
403
|
_context2.next = 10;
|
410
404
|
break;
|
411
405
|
}
|
@@ -414,13 +408,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
414
408
|
success: true
|
415
409
|
}));
|
416
410
|
case 10:
|
417
|
-
if (!(componentSignEnum.CASHIER_PAYMENT_CARD ===
|
411
|
+
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
418
412
|
_context2.next = 16;
|
419
413
|
break;
|
420
414
|
}
|
421
415
|
params.paymentMethodType = 'CARD';
|
422
416
|
_context2.next = 14;
|
423
|
-
return
|
417
|
+
return _this5.getDeviceIdAndLog();
|
424
418
|
case 14:
|
425
419
|
envInfo.deviceId = _context2.sent;
|
426
420
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
@@ -429,13 +423,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
429
423
|
};
|
430
424
|
}
|
431
425
|
case 16:
|
432
|
-
if (!(componentSignEnum.EASY_PAY_WALLET ===
|
426
|
+
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
433
427
|
_context2.next = 26;
|
434
428
|
break;
|
435
429
|
}
|
436
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;
|
437
|
-
_ref5 = ((
|
438
|
-
if (!((
|
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;
|
432
|
+
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)) {
|
439
433
|
_context2.next = 21;
|
440
434
|
break;
|
441
435
|
}
|
@@ -454,15 +448,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
454
448
|
}));
|
455
449
|
case 23:
|
456
450
|
_context2.next = 25;
|
457
|
-
return
|
451
|
+
return _this5.getDeviceIdAndLog();
|
458
452
|
case 25:
|
459
453
|
envInfo.deviceId = _context2.sent;
|
460
454
|
case 26:
|
461
|
-
if (!(componentSignEnum.AUTO_DEBIT_WALLET ===
|
455
|
+
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
462
456
|
_context2.next = 36;
|
463
457
|
break;
|
464
458
|
}
|
465
|
-
action = ((
|
459
|
+
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) || {};
|
466
460
|
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;
|
467
461
|
if (!(signType === 'SMS')) {
|
468
462
|
_context2.next = 31;
|
@@ -482,36 +476,36 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
482
476
|
}));
|
483
477
|
case 33:
|
484
478
|
_context2.next = 35;
|
485
|
-
return
|
479
|
+
return _this5.getDeviceIdAndLog();
|
486
480
|
case 35:
|
487
481
|
envInfo.deviceId = _context2.sent;
|
488
482
|
case 36:
|
489
|
-
|
483
|
+
_this5.AMSSDK.logger.logInfo({
|
490
484
|
title: 'sdk_event_sdkQuery'
|
491
485
|
}, {
|
492
486
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
493
487
|
}).send();
|
494
488
|
queryPaymentInfo(params, {
|
495
|
-
env:
|
489
|
+
env: _this5.AMSSDK.options.env.environment,
|
496
490
|
envInfo: envInfo
|
497
|
-
},
|
498
|
-
|
491
|
+
}, _this5.AMSSDK.logger).then(function (res) {
|
492
|
+
_this5._performanceData.push({
|
499
493
|
key: 'sdk_action_query_end',
|
500
494
|
value: Date.now()
|
501
495
|
});
|
502
496
|
resolve(res);
|
503
497
|
}).catch(function (err) {
|
504
|
-
if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(
|
498
|
+
if ([componentSignEnum.CASHIER_PAYMENT_CARD, componentSignEnum.VAULTING_CARD, componentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
505
499
|
return resolve({
|
506
500
|
success: false
|
507
501
|
});
|
508
502
|
}
|
509
|
-
|
503
|
+
_this5.dispatchToSDK(EVENT.error.name, {
|
510
504
|
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
|
511
505
|
});
|
512
506
|
reject(err);
|
513
507
|
}).finally(function () {
|
514
|
-
|
508
|
+
_this5.AMSSDK.logger.logInfo({
|
515
509
|
title: 'sdk_event_sdkQueryEnd'
|
516
510
|
}, {
|
517
511
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
@@ -536,7 +530,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
536
530
|
value: function createSubmitPromise() {
|
537
531
|
var _this$_renderParams4,
|
538
532
|
_this$_renderParams5,
|
539
|
-
|
533
|
+
_this6 = this;
|
540
534
|
this._performanceData.push({
|
541
535
|
key: 'sdk_submit_start',
|
542
536
|
value: Date.now()
|
@@ -549,11 +543,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
549
543
|
// eslint-disable-next-line no-async-promise-executor
|
550
544
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
551
545
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
552
|
-
var
|
546
|
+
var _this6$_renderParams;
|
553
547
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
554
548
|
while (1) switch (_context3.prev = _context3.next) {
|
555
549
|
case 0:
|
556
|
-
if (!(!((
|
550
|
+
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)) {
|
557
551
|
_context3.next = 2;
|
558
552
|
break;
|
559
553
|
}
|
@@ -562,16 +556,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
562
556
|
success: true
|
563
557
|
}));
|
564
558
|
case 2:
|
565
|
-
|
559
|
+
_this6.AMSSDK.logger.logInfo({
|
566
560
|
title: 'sdk_event_submitPay'
|
567
561
|
}, {
|
568
562
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
569
563
|
}).send();
|
570
564
|
_context3.t0 = submitPayInfo;
|
571
565
|
_context3.t1 = params;
|
572
|
-
_context3.t2 =
|
566
|
+
_context3.t2 = _this6.AMSSDK.options.env.environment;
|
573
567
|
_context3.next = 8;
|
574
|
-
return
|
568
|
+
return _this6.getDeviceIdAndLog();
|
575
569
|
case 8:
|
576
570
|
_context3.t3 = _context3.sent;
|
577
571
|
_context3.t4 = {
|
@@ -582,9 +576,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
582
576
|
timeout: 15000,
|
583
577
|
envInfo: _context3.t4
|
584
578
|
};
|
585
|
-
_context3.t6 =
|
579
|
+
_context3.t6 = _this6.AMSSDK.logger;
|
586
580
|
(0, _context3.t0)(_context3.t1, _context3.t5, _context3.t6).then(function (res) {
|
587
|
-
|
581
|
+
_this6._performanceData.push({
|
588
582
|
key: 'sdk_submit_end',
|
589
583
|
value: Date.now()
|
590
584
|
});
|
@@ -598,7 +592,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
598
592
|
success: false
|
599
593
|
});
|
600
594
|
}).finally(function () {
|
601
|
-
|
595
|
+
_this6.AMSSDK.logger.logInfo({
|
602
596
|
title: 'sdk_event_submitPayEnd'
|
603
597
|
}, {
|
604
598
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
@@ -1123,7 +1117,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1123
1117
|
key: "handleRedirect",
|
1124
1118
|
value: function handleRedirect(data) {
|
1125
1119
|
var _data$isDestroy,
|
1126
|
-
|
1120
|
+
_this7 = this;
|
1127
1121
|
var _data = typeof data === 'string' ? {
|
1128
1122
|
normalUrl: data
|
1129
1123
|
} : _objectSpread(_objectSpread({}, data), {}, {
|
@@ -1137,11 +1131,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1137
1131
|
title: 'sdk_event_call_url_start'
|
1138
1132
|
}, _objectSpread({}, data)).send();
|
1139
1133
|
var successCallback = function successCallback(type, url) {
|
1140
|
-
|
1134
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1141
1135
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
1142
1136
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
1143
1137
|
});
|
1144
|
-
|
1138
|
+
_this7.AMSSDK.logger.logInfo({
|
1145
1139
|
title: 'sdk_event_call_url_success'
|
1146
1140
|
}, {
|
1147
1141
|
redirectInfo: JSON.stringify(_data),
|
@@ -1150,11 +1144,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1150
1144
|
}).send();
|
1151
1145
|
};
|
1152
1146
|
var failCallback = function failCallback(type, url) {
|
1153
|
-
|
1147
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1154
1148
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
1155
1149
|
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)
|
1156
1150
|
});
|
1157
|
-
|
1151
|
+
_this7.AMSSDK.logger.logInfo({
|
1158
1152
|
title: 'sdk_error_call_url_failed'
|
1159
1153
|
}, {
|
1160
1154
|
redirectInfo: JSON.stringify(_data),
|
@@ -1184,14 +1178,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1184
1178
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1185
1179
|
}).catch(function () {
|
1186
1180
|
if (_data !== null && _data !== void 0 && _data.applinkUrl) failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1187
|
-
return
|
1181
|
+
return _this7.AMSSDK._redirect({
|
1188
1182
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
1189
1183
|
});
|
1190
1184
|
}).then(function () {
|
1191
1185
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1192
1186
|
}).catch(function () {
|
1193
1187
|
if (_data !== null && _data !== void 0 && _data.schemeUrl) failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1194
|
-
return
|
1188
|
+
return _this7.AMSSDK._redirect({
|
1195
1189
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
1196
1190
|
});
|
1197
1191
|
}).then(function () {
|
@@ -1230,12 +1224,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1230
1224
|
}, {
|
1231
1225
|
key: "handleAppHeartBeat",
|
1232
1226
|
value: function handleAppHeartBeat() {
|
1233
|
-
var
|
1227
|
+
var _this8 = this;
|
1234
1228
|
try {
|
1235
1229
|
if (!this._webAppHeartBeatTimeoutFn) {
|
1236
1230
|
this._webAppHeartBeatTimeoutFn = function () {
|
1237
|
-
if (
|
1238
|
-
|
1231
|
+
if (_this8.isAppAttached()) {
|
1232
|
+
_this8.AMSSDK.logger.logError({
|
1239
1233
|
title: 'sdk_error_appHeartBeatTimeout'
|
1240
1234
|
});
|
1241
1235
|
}
|
@@ -1249,8 +1243,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1249
1243
|
this._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1250
1244
|
}
|
1251
1245
|
setTimeout(function () {
|
1252
|
-
if (
|
1253
|
-
|
1246
|
+
if (_this8.isAppAttached()) {
|
1247
|
+
_this8.dispatchToApp({
|
1254
1248
|
context: {
|
1255
1249
|
event: 'sdkHeartBeat',
|
1256
1250
|
data: {}
|
@@ -1429,7 +1423,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1429
1423
|
key: "cleanContainer",
|
1430
1424
|
value: function cleanContainer() {
|
1431
1425
|
var _document$getElementB4,
|
1432
|
-
|
1426
|
+
_this9 = this;
|
1433
1427
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1434
1428
|
this.AMSSDK.logger.logInfo({
|
1435
1429
|
title: 'sdk_event_clean_component'
|
@@ -1444,7 +1438,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1444
1438
|
this.app = null;
|
1445
1439
|
if (immediately) this.cleanElement();else {
|
1446
1440
|
setTimeout(function () {
|
1447
|
-
|
1441
|
+
_this9.cleanElement();
|
1448
1442
|
}, 300);
|
1449
1443
|
}
|
1450
1444
|
}
|