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