@alipay/ams-checkout 0.0.1725951289-dev.4 → 0.0.1726046231-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +6 -8
- package/esm/constant/index.js +9 -81
- package/esm/core/bus/ability/globalData.d.ts +10 -0
- package/esm/core/bus/ability/globalData.js +89 -0
- package/esm/core/bus/ability/request.d.ts +10 -0
- package/esm/core/bus/ability/request.js +151 -0
- package/esm/core/bus/interface.d.ts +12 -0
- package/esm/core/bus/interface.js +16 -2
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +2 -0
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/ckp/index.js +3 -3
- package/esm/core/component/element/components/address.d.ts +17 -0
- package/esm/core/component/element/components/address.js +63 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +54 -0
- package/esm/core/component/element/components/payment.d.ts +17 -0
- package/esm/core/component/element/components/payment.js +67 -0
- package/esm/core/component/element/index.d.ts +44 -0
- package/esm/core/component/element/index.js +615 -0
- package/esm/core/component/element/mock.d.ts +3 -0
- package/esm/core/component/element/mock.js +1156 -0
- package/esm/core/component/element/type.d.ts +120 -0
- package/esm/core/component/element/type.js +14 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +5 -5
- package/esm/core/component/index.js +20 -16
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +5 -6
- package/esm/core/instance/index.js +11 -14
- package/esm/foundation/core/index.d.ts +26 -0
- package/esm/foundation/core/index.js +301 -0
- package/esm/foundation/index.d.ts +71 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +15 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +9 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +536 -0
- package/esm/foundation/service/container/index.d.ts +28 -0
- package/esm/foundation/service/container/index.js +255 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/foundation/service/container/popup.js +103 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/callback.js +55 -0
- package/esm/foundation/service/event-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/request.js +151 -0
- package/esm/foundation/service/event-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/event-bus/ability/security.js +151 -0
- package/esm/foundation/service/event-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/event-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/event-bus/busManager.js +398 -0
- package/esm/foundation/service/event-bus/index.d.ts +20 -0
- package/esm/foundation/service/event-bus/index.js +88 -0
- package/esm/foundation/service/event-center.d.ts +75 -0
- package/esm/foundation/service/event-center.js +244 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +69 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +235 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/log/types.js +1 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +211 -0
- package/esm/foundation/service/security/index.d.ts +26 -0
- package/esm/foundation/service/security/index.js +216 -0
- package/esm/{util → foundation/service/security}/security.d.ts +2 -2
- package/esm/{util → foundation/service/security}/security.js +3 -3
- package/esm/foundation/types/index.d.ts +4 -0
- package/esm/foundation/types/index.js +4 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- package/esm/foundation/utils/redirect_utils.d.ts +6 -0
- package/esm/foundation/utils/redirect_utils.js +99 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +71 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +37 -0
- package/esm/foundation/utils/web_app_url_utils.js +97 -0
- package/esm/index.d.ts +16 -10
- package/esm/index.js +70 -59
- package/esm/plugin/applepay/component.js +3 -3
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +2 -2
- package/esm/plugin/component/cashierApp.d.ts +7 -5
- package/esm/plugin/component/cashierApp.js +16 -8
- package/esm/plugin/component/channel.d.ts +3 -4
- package/esm/plugin/component/channel.js +1 -37
- package/esm/plugin/component/component.inline.style.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.js +10 -7
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +33 -15
- package/esm/plugin/component/index.d.ts +7 -8
- package/esm/plugin/component/index.js +130 -176
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +1 -1
- package/esm/plugin/payment-element/utils.js +2 -1
- package/esm/plugin/type.d.ts +4 -4
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +2 -0
- package/esm/types/index.d.ts +257 -39
- package/esm/types/index.js +107 -59
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +3 -4
- package/package.json +2 -2
- package/esm/util/getBackScheme.d.ts +0 -5
- package/esm/util/getBackScheme.js +0 -42
- package/esm/util/ua/index.d.ts +0 -2
- package/esm/util/ua/index.js +0 -2
- package/esm/util/ua/isAndroid.d.ts +0 -4
- package/esm/util/ua/isAndroid.js +0 -7
- package/esm/util/ua/isIOS.d.ts +0 -4
- package/esm/util/ua/isIOS.js +0 -7
@@ -21,14 +21,13 @@ import { v4 as uuid } from 'uuid';
|
|
21
21
|
import { sdkVersion } from "../../config";
|
22
22
|
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";
|
23
23
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
24
|
-
import {
|
24
|
+
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
25
25
|
import { getType, isJsonString, isPC } from "../../util";
|
26
26
|
import { isLocalMock } from "../../util/mock";
|
27
27
|
import { matchVersion } from "../../util/versionCompare";
|
28
|
-
import { getBackScheme } from "../../util/getBackScheme";
|
29
28
|
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
30
29
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
31
|
-
import { getChannelBehavior
|
30
|
+
import { getChannelBehavior } from "./channel";
|
32
31
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
33
32
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
34
33
|
import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
|
@@ -54,11 +53,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
54
53
|
_defineProperty(this, "_actionQueryPromise", null);
|
55
54
|
_defineProperty(this, "_actionSubmitPromise", null);
|
56
55
|
_defineProperty(this, "_renderParams", null);
|
57
|
-
_defineProperty(this, "_componentSign",
|
56
|
+
_defineProperty(this, "_componentSign", ComponentSignEnum.NONE);
|
58
57
|
_defineProperty(this, "_appLocationSearch", void 0);
|
59
|
-
_defineProperty(this, "_renderDisplayType",
|
58
|
+
_defineProperty(this, "_renderDisplayType", DisplayTypeEnum.popup);
|
60
59
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
61
|
-
_defineProperty(this, "_isAppWebview", void 0);
|
62
60
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
63
61
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
64
62
|
this._appVersion = componentOption.appVersion;
|
@@ -70,7 +68,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
70
68
|
this.createPreloadIframeNode = function () {
|
71
69
|
return Promise.resolve();
|
72
70
|
};
|
73
|
-
this.platform = isPC() ?
|
71
|
+
this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
|
74
72
|
this._isRetention = true;
|
75
73
|
this._appLocationSearch = '';
|
76
74
|
this._performanceData.push({
|
@@ -105,7 +103,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
105
103
|
var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
|
106
104
|
var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
|
107
105
|
this.AMSSDK.logger.setMedta({
|
108
|
-
platform: this.platform ===
|
106
|
+
platform: this.platform === PlatformEnum.desktop ? 'PC' : 'WAP',
|
109
107
|
// PC/WAP,
|
110
108
|
sdkVersion: sdkVersion,
|
111
109
|
webAppVersion: this._appVersion,
|
@@ -142,8 +140,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
142
140
|
var _this$_renderParams4,
|
143
141
|
_this = this;
|
144
142
|
var product = (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionMetaData) === null || _this$_renderParams4 === void 0 || (_this$_renderParams4 = _this$_renderParams4.paymentSessionConfig) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.productScene;
|
145
|
-
if (
|
146
|
-
if (
|
143
|
+
if (ComponentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
|
144
|
+
if (ComponentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
|
147
145
|
this.AMSSDK.logger.logInfo({
|
148
146
|
title: 'sdk_event_security_unneeded_scenarios'
|
149
147
|
}, {
|
@@ -268,8 +266,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
268
266
|
this._componentSign = componentSign;
|
269
267
|
if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
|
270
268
|
this._renderDisplayType = renderParams.renderDisplayType;
|
271
|
-
|
272
|
-
var
|
269
|
+
var appendAliasContainerId = renderParams.appendAliasContainerId ? "-".concat(this._selector) : '';
|
270
|
+
var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
|
271
|
+
var insertedNode = this._renderDisplayType === DisplayTypeEnum.inline ? "#".concat(inlineId) : this._selector;
|
273
272
|
this.initLoggerMeta();
|
274
273
|
this.initSecurity();
|
275
274
|
this._performanceData.push({
|
@@ -301,14 +300,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
301
300
|
version: productSceneVersion,
|
302
301
|
product: this.AMSSDK.options.product
|
303
302
|
}).send();
|
304
|
-
if (
|
305
|
-
if (productScene ===
|
303
|
+
if (ComponentSignEnum.EASY_PAY_WALLET === this._componentSign) {
|
304
|
+
if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
|
306
305
|
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
307
306
|
this.handleAuthUrlInfo(authUrlInfo);
|
308
307
|
return;
|
309
308
|
}
|
310
309
|
}
|
311
|
-
if (
|
310
|
+
if (ComponentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
|
312
311
|
var _this$_renderParams9, _action$web, _action$wap;
|
313
312
|
var action = ((_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 || (_this$_renderParams9 = _this$_renderParams9.paymentSessionMetaData) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.action) || {};
|
314
313
|
var 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;
|
@@ -319,7 +318,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
319
318
|
return;
|
320
319
|
}
|
321
320
|
}
|
322
|
-
if (
|
321
|
+
if (ComponentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
|
323
322
|
if (requireFastSdk === true && productSceneVersion === '1.0') {
|
324
323
|
// REDIRECT,requireFastSdk为true,不需要接口请求
|
325
324
|
this.handleAuthUrlInfo(authUrlInfo);
|
@@ -334,12 +333,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
334
333
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
335
334
|
code: eventCodeEnum.SDK_START_OF_LOADING
|
336
335
|
});
|
337
|
-
if (this._renderDisplayType ===
|
338
|
-
var container = createInlineBaseElement(this._selector);
|
336
|
+
if (this._renderDisplayType === DisplayTypeEnum.inline) {
|
337
|
+
var container = createInlineBaseElement(this._selector, COMPONENT_CONTAINER_ID, inlineId);
|
339
338
|
if (container) this.renderInlineLoading(renderParams, container);
|
340
339
|
insertStyleSheet();
|
341
340
|
}
|
342
|
-
if (this._renderDisplayType ===
|
341
|
+
if (this._renderDisplayType === DisplayTypeEnum.popup) {
|
343
342
|
var _this$_renderParams10;
|
344
343
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
345
344
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
@@ -382,7 +381,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
382
381
|
key: "setParameterDefaultValues",
|
383
382
|
value: function setParameterDefaultValues(componentSign, renderParams) {
|
384
383
|
var newParams = Object.assign({}, renderParams);
|
385
|
-
if (componentSign ===
|
384
|
+
if (componentSign === ComponentSignEnum.VAULTING_CARD) {
|
386
385
|
var _newParams$notRedirec;
|
387
386
|
newParams.notRedirectAfterComplete = (_newParams$notRedirec = newParams === null || newParams === void 0 ? void 0 : newParams.notRedirectAfterComplete) !== null && _newParams$notRedirec !== void 0 ? _newParams$notRedirec : true;
|
388
387
|
}
|
@@ -451,8 +450,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
451
450
|
// eslint-disable-next-line no-async-promise-executor
|
452
451
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
453
452
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
454
|
-
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
455
|
-
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$
|
453
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6, _this5$_renderParams7;
|
454
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams8, _this5$_renderParams9, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams10, _action$web2, _action$wap2, action, signType;
|
456
455
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
457
456
|
while (1) switch (_context2.prev = _context2.next) {
|
458
457
|
case 0:
|
@@ -488,11 +487,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
488
487
|
success: true
|
489
488
|
}));
|
490
489
|
case 9:
|
491
|
-
if (
|
490
|
+
if (ComponentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
492
491
|
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
493
492
|
}
|
494
|
-
|
495
|
-
if (!(componentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
493
|
+
if (!(ComponentSignEnum.ELEMENT_PAYMENT === _this5._componentSign && _this5 !== null && _this5 !== void 0 && (_this5$_renderParams6 = _this5._renderParams) !== null && _this5$_renderParams6 !== void 0 && (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) !== null && _this5$_renderParams6 !== void 0 && (_this5$_renderParams6 = _this5$_renderParams6.connectFactor) !== null && _this5$_renderParams6 !== void 0 && _this5$_renderParams6.enableConnect)) {
|
496
494
|
_context2.next = 12;
|
497
495
|
break;
|
498
496
|
}
|
@@ -501,22 +499,31 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
501
499
|
success: true
|
502
500
|
}));
|
503
501
|
case 12:
|
504
|
-
if (!(
|
505
|
-
_context2.next =
|
502
|
+
if (!(ComponentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
503
|
+
_context2.next = 14;
|
504
|
+
break;
|
505
|
+
}
|
506
|
+
return _context2.abrupt("return", resolve({
|
507
|
+
message: 'sdk no need to make query request',
|
508
|
+
success: true
|
509
|
+
}));
|
510
|
+
case 14:
|
511
|
+
if (!(ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
512
|
+
_context2.next = 26;
|
506
513
|
break;
|
507
514
|
}
|
508
515
|
if (!enableVaultingApiOptimize) {
|
509
|
-
_context2.next =
|
516
|
+
_context2.next = 26;
|
510
517
|
break;
|
511
518
|
}
|
512
519
|
if (!skipSdkQueryForm) {
|
513
|
-
_context2.next =
|
520
|
+
_context2.next = 23;
|
514
521
|
break;
|
515
522
|
}
|
516
523
|
// 优先判断 skipSdkQueryForm
|
517
524
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
518
525
|
if (!ifSkip) {
|
519
|
-
_context2.next =
|
526
|
+
_context2.next = 21;
|
520
527
|
break;
|
521
528
|
}
|
522
529
|
resolve({
|
@@ -524,12 +531,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
524
531
|
success: true
|
525
532
|
});
|
526
533
|
return _context2.abrupt("return");
|
527
|
-
case 19:
|
528
|
-
_context2.next = 24;
|
529
|
-
break;
|
530
534
|
case 21:
|
535
|
+
_context2.next = 26;
|
536
|
+
break;
|
537
|
+
case 23:
|
531
538
|
if (!skipSdkQuery) {
|
532
|
-
_context2.next =
|
539
|
+
_context2.next = 26;
|
533
540
|
break;
|
534
541
|
}
|
535
542
|
resolve({
|
@@ -537,10 +544,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
537
544
|
success: true
|
538
545
|
});
|
539
546
|
return _context2.abrupt("return");
|
540
|
-
case
|
541
|
-
channelBehavior = getChannelBehavior((_this5$
|
547
|
+
case 26:
|
548
|
+
channelBehavior = getChannelBehavior((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
542
549
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
543
|
-
_context2.next =
|
550
|
+
_context2.next = 29;
|
544
551
|
break;
|
545
552
|
}
|
546
553
|
return _context2.abrupt("return", resolve({
|
@@ -548,78 +555,79 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
548
555
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
549
556
|
success: true
|
550
557
|
}));
|
551
|
-
case
|
552
|
-
if (!(
|
553
|
-
_context2.next =
|
558
|
+
case 29:
|
559
|
+
if (!(ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
560
|
+
_context2.next = 35;
|
554
561
|
break;
|
555
562
|
}
|
556
563
|
params.paymentMethodType = 'CARD';
|
557
|
-
_context2.next =
|
564
|
+
_context2.next = 33;
|
558
565
|
return _this5.getDeviceIdAndLog();
|
559
|
-
case
|
566
|
+
case 33:
|
560
567
|
envInfo.deviceId = _context2.sent;
|
561
568
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
562
569
|
envInfo.extendInfo = {
|
563
570
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
564
571
|
};
|
565
572
|
}
|
566
|
-
case
|
567
|
-
if (!(
|
568
|
-
_context2.next =
|
573
|
+
case 35:
|
574
|
+
if (!(ComponentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
575
|
+
_context2.next = 45;
|
569
576
|
break;
|
570
577
|
}
|
571
578
|
_ref8 = params.paymentSessionConfig || {}, _ref8$productSceneVer = _ref8.productSceneVersion, productSceneVersion = _ref8$productSceneVer === void 0 ? '' : _ref8$productSceneVer, _ref8$productScene = _ref8.productScene, productScene = _ref8$productScene === void 0 ? '' : _ref8$productScene;
|
572
|
-
|
573
|
-
|
579
|
+
_ref9 = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.paymentSessionMetaData) || {}, _ref9$action = _ref9.action, _ref9$action2 = _ref9$action === void 0 ? {} : _ref9$action, _ref9$action2$autoDeb = _ref9$action2.autoDebitWithToken, autoDebitWithToken = _ref9$action2$autoDeb === void 0 ? false : _ref9$action2$autoDeb;
|
580
|
+
if (!((_this5$_renderParams9 = _this5._renderParams) !== null && _this5$_renderParams9 !== void 0 && (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) !== null && _this5$_renderParams9 !== void 0 && (_this5$_renderParams9 = _this5$_renderParams9.action) !== null && _this5$_renderParams9 !== void 0 && _this5$_renderParams9.skipSdkQuery && enableEasypayApiOptimize)) {
|
581
|
+
_context2.next = 40;
|
574
582
|
break;
|
575
583
|
}
|
576
584
|
return _context2.abrupt("return", resolve({
|
577
585
|
message: 'sdk no need to make query request',
|
578
586
|
success: true
|
579
587
|
}));
|
580
|
-
case
|
581
|
-
if (!(productScene ===
|
582
|
-
_context2.next =
|
588
|
+
case 40:
|
589
|
+
if (!(productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
590
|
+
_context2.next = 42;
|
583
591
|
break;
|
584
592
|
}
|
585
593
|
return _context2.abrupt("return", resolve({
|
586
594
|
message: 'sdk no need to make query request',
|
587
595
|
success: true
|
588
596
|
}));
|
589
|
-
case
|
590
|
-
_context2.next =
|
597
|
+
case 42:
|
598
|
+
_context2.next = 44;
|
591
599
|
return _this5.getDeviceIdAndLog();
|
592
|
-
case
|
600
|
+
case 44:
|
593
601
|
envInfo.deviceId = _context2.sent;
|
594
|
-
case
|
595
|
-
if (!(
|
596
|
-
_context2.next =
|
602
|
+
case 45:
|
603
|
+
if (!(ComponentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
604
|
+
_context2.next = 55;
|
597
605
|
break;
|
598
606
|
}
|
599
|
-
action = ((_this5$
|
607
|
+
action = ((_this5$_renderParams10 = _this5._renderParams) === null || _this5$_renderParams10 === void 0 || (_this5$_renderParams10 = _this5$_renderParams10.paymentSessionMetaData) === null || _this5$_renderParams10 === void 0 ? void 0 : _this5$_renderParams10.action) || {};
|
600
608
|
signType = isPC() ? action === null || action === void 0 || (_action$web2 = action.web) === null || _action$web2 === void 0 ? void 0 : _action$web2.signType : action === null || action === void 0 || (_action$wap2 = action.wap) === null || _action$wap2 === void 0 ? void 0 : _action$wap2.signType;
|
601
609
|
if (!(signType === 'SMS')) {
|
602
|
-
_context2.next =
|
610
|
+
_context2.next = 50;
|
603
611
|
break;
|
604
612
|
}
|
605
613
|
return _context2.abrupt("return", resolve({
|
606
614
|
message: 'sdk no need to make query request',
|
607
615
|
success: true
|
608
616
|
}));
|
609
|
-
case
|
617
|
+
case 50:
|
610
618
|
if (!(!signType || signType !== 'REDIRECT')) {
|
611
|
-
_context2.next =
|
619
|
+
_context2.next = 52;
|
612
620
|
break;
|
613
621
|
}
|
614
622
|
return _context2.abrupt("return", resolve({
|
615
623
|
success: false
|
616
624
|
}));
|
617
|
-
case
|
618
|
-
_context2.next =
|
625
|
+
case 52:
|
626
|
+
_context2.next = 54;
|
619
627
|
return _this5.getDeviceIdAndLog();
|
620
|
-
case
|
628
|
+
case 54:
|
621
629
|
envInfo.deviceId = _context2.sent;
|
622
|
-
case
|
630
|
+
case 55:
|
623
631
|
_this5.AMSSDK.logger.logInfo({
|
624
632
|
title: 'sdk_event_sdkQuery'
|
625
633
|
}, {
|
@@ -642,7 +650,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
642
650
|
responseBody: res
|
643
651
|
}).send();
|
644
652
|
}).catch(function (err) {
|
645
|
-
if ([
|
653
|
+
if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
646
654
|
return resolve({
|
647
655
|
success: false
|
648
656
|
});
|
@@ -658,7 +666,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
658
666
|
}).send();
|
659
667
|
reject(err);
|
660
668
|
});
|
661
|
-
case
|
669
|
+
case 57:
|
662
670
|
case "end":
|
663
671
|
return _context2.stop();
|
664
672
|
}
|
@@ -690,13 +698,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
690
698
|
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
691
699
|
// eslint-disable-next-line no-async-promise-executor
|
692
700
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
693
|
-
var
|
701
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
694
702
|
var _channelBehavior$buil, _this6$_renderParams$;
|
695
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
703
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
|
696
704
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
697
705
|
while (1) switch (_context3.prev = _context3.next) {
|
698
706
|
case 0:
|
699
|
-
if (!(_this6.AMSSDK.options.product ===
|
707
|
+
if (!(_this6.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS)) {
|
700
708
|
_context3.next = 2;
|
701
709
|
break;
|
702
710
|
}
|
@@ -710,21 +718,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
710
718
|
// 新逻辑走 channelBehavior判断
|
711
719
|
shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
|
712
720
|
} else {
|
713
|
-
shouldSkipSubmitPayInSDK = !((_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) ||
|
721
|
+
shouldSkipSubmitPayInSDK = !((_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;
|
714
722
|
}
|
715
|
-
if (
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
isAppWebview = _this6._isAppWebview || false; ///EasyPay 2.0 首次传signAgreement字段
|
723
|
+
if (ComponentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
724
|
+
_ref11 = params.paymentSessionConfig || {}, _ref11$productSceneVe = _ref11.productSceneVersion, productSceneVersion = _ref11$productSceneVe === void 0 ? '' : _ref11$productSceneVe, _ref11$productScene = _ref11.productScene, productScene = _ref11$productScene === void 0 ? '' : _ref11$productScene;
|
725
|
+
_ref12 = ((_this6$_renderParams2 = _this6._renderParams) === null || _this6$_renderParams2 === void 0 ? void 0 : _this6$_renderParams2.paymentSessionMetaData) || {}, _ref12$action = _ref12.action, _ref12$action2 = _ref12$action === void 0 ? {} : _ref12$action, _ref12$action2$enable = _ref12$action2.enableSignAgreement, enableSignAgreement = _ref12$action2$enable === void 0 ? false : _ref12$action2$enable, _ref12$action2$autoDe = _ref12$action2.autoDebitWithToken, autoDebitWithToken = _ref12$action2$autoDe === void 0 ? false : _ref12$action2$autoDe;
|
726
|
+
if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
727
|
+
///EasyPay 2.0 首次传signAgreement字段
|
721
728
|
params['signAgreement'] = enableSignAgreement;
|
722
|
-
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
723
|
-
backScheme = getBackScheme(undefined, _this6.AMSSDK.logger);
|
724
|
-
if (backScheme && backScheme !== 'https') {
|
725
|
-
params['h5FromApp'] = encodeURIComponent(backScheme);
|
726
|
-
}
|
727
|
-
}
|
728
729
|
}
|
729
730
|
}
|
730
731
|
// 带上标记告知WebCheckOut SDK已发送submitpay请求
|
@@ -799,7 +800,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
799
800
|
}, _callee3);
|
800
801
|
}));
|
801
802
|
return function (_x3) {
|
802
|
-
return
|
803
|
+
return _ref10.apply(this, arguments);
|
803
804
|
};
|
804
805
|
}());
|
805
806
|
}
|
@@ -842,7 +843,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
842
843
|
var preloadIframe = createPreloadIframe(componentSign, productSceneVersion);
|
843
844
|
var productScene = componentSign.split(/_(?=[^_]*$)/)[0];
|
844
845
|
var _getIframeUrl = getIframeUrl({
|
845
|
-
renderDisplayType:
|
846
|
+
renderDisplayType: DisplayTypeEnum.popup,
|
846
847
|
componentSign: componentSign,
|
847
848
|
analytics: {
|
848
849
|
enabled: false
|
@@ -883,7 +884,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
883
884
|
value: Date.now()
|
884
885
|
});
|
885
886
|
try {
|
886
|
-
var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4;
|
887
|
+
var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4, _renderParams$debugPr, _renderParams$debugPr2;
|
887
888
|
var productSceneVersion = (renderParams === null || renderParams === void 0 || (_renderParams$payment = renderParams.paymentSessionMetaData) === null || _renderParams$payment === void 0 || (_renderParams$payment = _renderParams$payment.paymentSessionConfig) === null || _renderParams$payment === void 0 ? void 0 : _renderParams$payment.productSceneVersion) || '';
|
888
889
|
var productScene = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 || (_renderParams$payment2 = _renderParams$payment2.paymentSessionConfig) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.productScene) || '';
|
889
890
|
var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment3 = renderParams.paymentSessionMetaData) === null || _renderParams$payment3 === void 0 ? void 0 : _renderParams$payment3.extendInfo) || '';
|
@@ -896,7 +897,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
896
897
|
productScene: productScene,
|
897
898
|
productSceneVersion: productSceneVersion,
|
898
899
|
extendInfo: extendInfo,
|
899
|
-
mid: mid
|
900
|
+
mid: mid,
|
901
|
+
localLink: renderParams === null || renderParams === void 0 || (_renderParams$debugPr = renderParams.debugProps) === null || _renderParams$debugPr === void 0 ? void 0 : _renderParams$debugPr.localLink // TODO Connect本地调试link
|
900
902
|
});
|
901
903
|
this.app = createIframe(this.AMSSDK.options.mode, this.platform);
|
902
904
|
var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
|
@@ -912,7 +914,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
912
914
|
locale: this.AMSSDK.options.locale,
|
913
915
|
instanceId: this.AMSSDK._instanceId,
|
914
916
|
hostSign: hostSign,
|
915
|
-
mid: mid
|
917
|
+
mid: mid,
|
918
|
+
localLink: renderParams === null || renderParams === void 0 || (_renderParams$debugPr2 = renderParams.debugProps) === null || _renderParams$debugPr2 === void 0 ? void 0 : _renderParams$debugPr2.localLink // TODO Connect本地调试link
|
916
919
|
}),
|
917
920
|
path = _getIframeUrl2.path,
|
918
921
|
locationSearch = _getIframeUrl2.locationSearch;
|
@@ -947,7 +950,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
947
950
|
var isJson = isJsonString(e.data);
|
948
951
|
if (isJson) {
|
949
952
|
var data = JSON.parse(e.data);
|
950
|
-
if (data.name !==
|
953
|
+
if (data.name !== MessageName.APP_TO_SDK && data.name !== MessageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) return;
|
951
954
|
this._handleAppMessage(data);
|
952
955
|
} else {
|
953
956
|
console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
|
@@ -1154,8 +1157,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1154
1157
|
}, {
|
1155
1158
|
key: "_handleAppMessage",
|
1156
1159
|
value: function _handleAppMessage(data) {
|
1157
|
-
var _data$context2,
|
1158
|
-
_this7 = this;
|
1159
1160
|
var eventKeyMap = Object.keys(EVENT).map(function (key) {
|
1160
1161
|
return EVENT[key].name;
|
1161
1162
|
});
|
@@ -1280,26 +1281,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1280
1281
|
title: 'sdk_event_event_callback'
|
1281
1282
|
}).send();
|
1282
1283
|
}
|
1283
|
-
if ((data === null || data === void 0 || (_data$context2 = data.context) === null || _data$context2 === void 0 ? void 0 : _data$context2.event) === EVENT.getGooglePayToken.name) {
|
1284
|
-
handleGooglePay(data).then(function (res) {
|
1285
|
-
_this7.dispatchToApp({
|
1286
|
-
context: {
|
1287
|
-
event: 'getGooglePayToken',
|
1288
|
-
data: _objectSpread({}, res)
|
1289
|
-
}
|
1290
|
-
});
|
1291
|
-
}).catch(function (err) {
|
1292
|
-
_this7.dispatchToApp({
|
1293
|
-
context: {
|
1294
|
-
event: 'getGooglePayToken',
|
1295
|
-
data: {
|
1296
|
-
err: err
|
1297
|
-
}
|
1298
|
-
}
|
1299
|
-
});
|
1300
|
-
});
|
1301
|
-
return;
|
1302
|
-
}
|
1303
1284
|
|
1304
1285
|
// The plug-in communicates with the sdk after processing
|
1305
1286
|
this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
|
@@ -1319,12 +1300,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1319
1300
|
}, {
|
1320
1301
|
key: "handleSizeChanged",
|
1321
1302
|
value: function handleSizeChanged(data) {
|
1322
|
-
var _data$context$data4;
|
1323
|
-
var
|
1324
|
-
|
1303
|
+
var _data$context$data4, _cashier$style;
|
1304
|
+
var _selector = this._renderParams.selector;
|
1305
|
+
var appendAliasContainerId = this._renderParams.appendAliasContainerId;
|
1306
|
+
var selectorId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat(_selector) : COMPONENT_CONTAINER_ID;
|
1307
|
+
var cashier = document.getElementById(selectorId);
|
1308
|
+
if (((_data$context$data4 = data.context.data) === null || _data$context$data4 === void 0 ? void 0 : _data$context$data4.height) <= 1 || data.context.data.height === parseInt(cashier === null || cashier === void 0 || (_cashier$style = cashier.style) === null || _cashier$style === void 0 ? void 0 : _cashier$style.height)) return;
|
1325
1309
|
cashier.style.height = "".concat(data.context.data.height, "px");
|
1326
1310
|
this.app.style.opacity = '1';
|
1327
|
-
if (this._renderDisplayType ===
|
1311
|
+
if (this._renderDisplayType === DisplayTypeEnum.popup) {
|
1328
1312
|
if (this.platform === 'desktop') {
|
1329
1313
|
if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
|
1330
1314
|
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
@@ -1349,6 +1333,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1349
1333
|
style.innerHTML = runkeyframes;
|
1350
1334
|
// 将style样式存放到head标签
|
1351
1335
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1336
|
+
|
1352
1337
|
// size变动时动画
|
1353
1338
|
setTimeout(function () {
|
1354
1339
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1357,7 +1342,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1357
1342
|
// 关闭loading,保留蒙层
|
1358
1343
|
this.dismissLoadingFunc();
|
1359
1344
|
}
|
1360
|
-
if (this._renderDisplayType ===
|
1345
|
+
if (this._renderDisplayType === DisplayTypeEnum.inline) {
|
1361
1346
|
var _document$getElementB3;
|
1362
1347
|
(_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0 || _document$getElementB3.remove();
|
1363
1348
|
this.app.style.height = "".concat(data.context.data.height, "px");
|
@@ -1386,9 +1371,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1386
1371
|
key: "handleRedirect",
|
1387
1372
|
value: function handleRedirect(data) {
|
1388
1373
|
var _data$isDestroy,
|
1389
|
-
|
1390
|
-
_data$callAppDetectSu,
|
1391
|
-
_this8 = this;
|
1374
|
+
_this7 = this;
|
1392
1375
|
var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1393
1376
|
var _data = typeof data === 'string' ? {
|
1394
1377
|
normalUrl: data
|
@@ -1397,58 +1380,48 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1397
1380
|
schemeUrl: (data === null || data === void 0 ? void 0 : data.schemeUrl) || '',
|
1398
1381
|
normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
|
1399
1382
|
target: data === null || data === void 0 ? void 0 : data.target,
|
1400
|
-
isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true
|
1401
|
-
isCallApp: (_data$isCallApp = data === null || data === void 0 ? void 0 : data.isCallApp) !== null && _data$isCallApp !== void 0 ? _data$isCallApp : false,
|
1402
|
-
callAppDetectSuccessDelay: (_data$callAppDetectSu = data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) !== null && _data$callAppDetectSu !== void 0 ? _data$callAppDetectSu : 2000
|
1383
|
+
isDestroy: (_data$isDestroy = data === null || data === void 0 ? void 0 : data.isDestroy) !== null && _data$isDestroy !== void 0 ? _data$isDestroy : true
|
1403
1384
|
});
|
1404
1385
|
this.AMSSDK.logger.logInfo({
|
1405
1386
|
title: 'sdk_event_call_url_start'
|
1406
1387
|
}, _objectSpread({}, data)).send();
|
1407
|
-
var successCallback = function successCallback(type, url
|
1408
|
-
|
1388
|
+
var successCallback = function successCallback(type, url) {
|
1389
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1409
1390
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
1410
1391
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
1411
1392
|
});
|
1412
|
-
|
1393
|
+
_this7.AMSSDK.logger.logInfo({
|
1394
|
+
title: 'sdk_event_call_url_success'
|
1395
|
+
}, {
|
1413
1396
|
redirectInfo: JSON.stringify(_data),
|
1414
1397
|
openType: type,
|
1415
1398
|
url: url,
|
1416
1399
|
fromFastSdk: fromFastSdk
|
1417
|
-
};
|
1418
|
-
if (durationInSeconds) {
|
1419
|
-
extra['durationInSeconds'] = durationInSeconds;
|
1420
|
-
}
|
1421
|
-
_this8.AMSSDK.logger.logInfo({
|
1422
|
-
title: 'sdk_event_call_url_success'
|
1423
|
-
}, extra).send();
|
1400
|
+
}).send();
|
1424
1401
|
};
|
1425
|
-
var failCallback = function failCallback(type, url
|
1426
|
-
|
1402
|
+
var failCallback = function failCallback(type, url) {
|
1403
|
+
_this7.dispatchToSDK(EVENT.eventCallback.name, {
|
1427
1404
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
1428
1405
|
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)
|
1429
1406
|
});
|
1430
|
-
|
1407
|
+
_this7.AMSSDK.logger.logInfo({
|
1408
|
+
title: 'sdk_error_call_url_failed'
|
1409
|
+
}, {
|
1431
1410
|
redirectInfo: JSON.stringify(_data),
|
1432
1411
|
openType: type,
|
1433
1412
|
url: url,
|
1434
1413
|
fromFastSdk: fromFastSdk
|
1435
|
-
};
|
1436
|
-
if (durationInSeconds) {
|
1437
|
-
extra['durationInSeconds'] = durationInSeconds;
|
1438
|
-
}
|
1439
|
-
_this8.AMSSDK.logger.logInfo({
|
1440
|
-
title: 'sdk_error_call_url_failed'
|
1441
|
-
}, extra).send();
|
1414
|
+
}).send();
|
1442
1415
|
};
|
1443
1416
|
|
1444
1417
|
// 支持 target: _blank,新开tab页打开
|
1445
|
-
if (_data.target ===
|
1418
|
+
if (_data.target === TargetEnum.BLANK) {
|
1446
1419
|
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
1447
1420
|
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
1448
1421
|
window.open(_data.normalUrl);
|
1449
1422
|
return;
|
1450
1423
|
}
|
1451
|
-
if (_data.target ===
|
1424
|
+
if (_data.target === TargetEnum.REPLACE && !(_data !== null && _data !== void 0 && _data.applinkUrl) && !(_data !== null && _data !== void 0 && _data.schemeUrl)) {
|
1452
1425
|
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
1453
1426
|
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
1454
1427
|
window.location.replace(_data.normalUrl);
|
@@ -1456,40 +1429,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1456
1429
|
}
|
1457
1430
|
// 销毁iframe和全局loading
|
1458
1431
|
if (_data !== null && _data !== void 0 && _data.isDestroy) this.cleanContainer();
|
1459
|
-
// 唤端
|
1460
|
-
if (_data !== null && _data !== void 0 && _data.isCallApp && _data !== null && _data !== void 0 && _data.schemeUrl) {
|
1461
|
-
var startCallAppTime = new Date();
|
1462
|
-
var detectSuccessDelay = typeof (data === null || data === void 0 ? void 0 : data.callAppDetectSuccessDelay) === 'number' ? data.callAppDetectSuccessDelay : 5000;
|
1463
|
-
this.AMSSDK._redirect({
|
1464
|
-
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl,
|
1465
|
-
callAppJudgeTime: detectSuccessDelay
|
1466
|
-
}).then(function () {
|
1467
|
-
var endCallAppTime = new Date();
|
1468
|
-
var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
|
1469
|
-
var durationInSeconds = durationInMilliseconds / 1000;
|
1470
|
-
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl, durationInSeconds);
|
1471
|
-
}).catch(function () {
|
1472
|
-
var endCallAppTime = new Date();
|
1473
|
-
var durationInMilliseconds = endCallAppTime.getTime() - startCallAppTime.getTime();
|
1474
|
-
var durationInSeconds = durationInMilliseconds / 1000;
|
1475
|
-
failCallback(RedirectType.SchemeUrl, _data.schemeUrl, durationInSeconds);
|
1476
|
-
});
|
1477
|
-
return;
|
1478
|
-
}
|
1479
1432
|
this.AMSSDK._redirect({
|
1480
1433
|
applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
|
1481
1434
|
}).then(function () {
|
1482
1435
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1483
1436
|
}).catch(function () {
|
1484
1437
|
if (_data !== null && _data !== void 0 && _data.applinkUrl) failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1485
|
-
return
|
1438
|
+
return _this7.AMSSDK._redirect({
|
1486
1439
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
1487
1440
|
});
|
1488
1441
|
}).then(function () {
|
1489
1442
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1490
1443
|
}).catch(function () {
|
1491
1444
|
if (_data !== null && _data !== void 0 && _data.schemeUrl) failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1492
|
-
return
|
1445
|
+
return _this7.AMSSDK._redirect({
|
1493
1446
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
1494
1447
|
});
|
1495
1448
|
}).then(function () {
|
@@ -1528,12 +1481,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1528
1481
|
}, {
|
1529
1482
|
key: "handleAppHeartBeat",
|
1530
1483
|
value: function handleAppHeartBeat() {
|
1531
|
-
var
|
1484
|
+
var _this8 = this;
|
1532
1485
|
try {
|
1533
1486
|
if (!this._webAppHeartBeatTimeoutFn) {
|
1534
1487
|
this._webAppHeartBeatTimeoutFn = function () {
|
1535
|
-
if (
|
1536
|
-
|
1488
|
+
if (_this8.isAppAttached()) {
|
1489
|
+
_this8.AMSSDK.logger.logError({
|
1537
1490
|
title: 'sdk_error_appHeartBeatTimeout'
|
1538
1491
|
});
|
1539
1492
|
}
|
@@ -1547,8 +1500,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1547
1500
|
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1548
1501
|
}
|
1549
1502
|
setTimeout(function () {
|
1550
|
-
if (
|
1551
|
-
|
1503
|
+
if (_this8.isAppAttached()) {
|
1504
|
+
_this8.dispatchToApp({
|
1552
1505
|
context: {
|
1553
1506
|
event: 'sdkHeartBeat',
|
1554
1507
|
data: {}
|
@@ -1604,7 +1557,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1604
1557
|
value: function dispatchToApp(payload) {
|
1605
1558
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1606
1559
|
var data = Object.assign({}, payload, {
|
1607
|
-
name:
|
1560
|
+
name: MessageName.SDK_TO_APP,
|
1608
1561
|
mode: this.AMSSDK.options.mode,
|
1609
1562
|
appId: COMPONENTPLUGINID,
|
1610
1563
|
instanceId: this.AMSSDK._instanceId
|
@@ -1648,7 +1601,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1648
1601
|
while (1) switch (_context8.prev = _context8.next) {
|
1649
1602
|
case 0:
|
1650
1603
|
_context8.prev = 0;
|
1651
|
-
isAddressElement = this.AMSSDK.options.product ===
|
1604
|
+
isAddressElement = this.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS;
|
1652
1605
|
if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
|
1653
1606
|
_context8.next = 4;
|
1654
1607
|
break;
|
@@ -1679,7 +1632,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1679
1632
|
renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
|
1680
1633
|
appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
|
1681
1634
|
notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
|
1682
|
-
isAppWebview: this._isAppWebview,
|
1683
1635
|
merchantAppointParam: this._merchantAppointParam,
|
1684
1636
|
allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
|
1685
1637
|
/** 地址组件集成的参数 */
|
@@ -1741,7 +1693,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1741
1693
|
key: "cleanContainer",
|
1742
1694
|
value: function cleanContainer() {
|
1743
1695
|
var _document$getElementB4,
|
1744
|
-
|
1696
|
+
_this9 = this;
|
1745
1697
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1746
1698
|
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
|
1747
1699
|
this.hideComponentAnimation();
|
@@ -1753,7 +1705,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1753
1705
|
this.app = null;
|
1754
1706
|
if (immediately) this.cleanElement();else {
|
1755
1707
|
setTimeout(function () {
|
1756
|
-
|
1708
|
+
_this9.cleanElement();
|
1757
1709
|
}, 300);
|
1758
1710
|
}
|
1759
1711
|
}
|
@@ -1792,7 +1744,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1792
1744
|
}, {
|
1793
1745
|
key: "removeRetentionPopup",
|
1794
1746
|
value: function removeRetentionPopup(platform) {
|
1795
|
-
_removeRetentionPopup(
|
1747
|
+
_removeRetentionPopup();
|
1748
|
+
// TODO check
|
1749
|
+
// removeRetentionPopup(platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
1796
1750
|
}
|
1797
1751
|
}, {
|
1798
1752
|
key: "showRetentionPopup",
|