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