@alipay/ams-checkout 1.22.0 → 1.24.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 +10 -10
- package/esm/constant/index.d.ts +9 -0
- package/esm/constant/index.js +11 -0
- 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 +6 -5
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +816 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +184 -0
- package/esm/core/component/element/type.js +35 -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 -5
- package/esm/core/instance/index.js +11 -10
- package/esm/foundation/core/index.d.ts +26 -0
- package/esm/foundation/core/index.js +301 -0
- package/esm/foundation/index.d.ts +72 -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 +256 -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 +4 -3
- package/esm/plugin/component/channel.js +37 -1
- 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 +8 -7
- package/esm/plugin/component/index.js +190 -113
- 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 +240 -38
- package/esm/types/index.js +103 -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 -1
@@ -21,14 +21,14 @@ 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
28
|
import { getBackScheme } from "../../util/getBackScheme";
|
29
29
|
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
30
30
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
31
|
-
import { getChannelBehavior } from "./channel";
|
31
|
+
import { getChannelBehavior, handleGooglePay } from "./channel";
|
32
32
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
33
33
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
|
34
34
|
import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
|
@@ -54,9 +54,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
54
54
|
_defineProperty(this, "_actionQueryPromise", null);
|
55
55
|
_defineProperty(this, "_actionSubmitPromise", null);
|
56
56
|
_defineProperty(this, "_renderParams", null);
|
57
|
-
_defineProperty(this, "_componentSign",
|
57
|
+
_defineProperty(this, "_componentSign", ComponentSignEnum.NONE);
|
58
58
|
_defineProperty(this, "_appLocationSearch", void 0);
|
59
|
-
_defineProperty(this, "_renderDisplayType",
|
59
|
+
_defineProperty(this, "_renderDisplayType", DisplayTypeEnum.popup);
|
60
60
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
61
61
|
_defineProperty(this, "_isAppWebview", void 0);
|
62
62
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
@@ -70,7 +70,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
70
70
|
this.createPreloadIframeNode = function () {
|
71
71
|
return Promise.resolve();
|
72
72
|
};
|
73
|
-
this.platform = isPC() ?
|
73
|
+
this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
|
74
74
|
this._isRetention = true;
|
75
75
|
this._appLocationSearch = '';
|
76
76
|
this._performanceData.push({
|
@@ -105,7 +105,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
105
105
|
var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
|
106
106
|
var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
|
107
107
|
this.AMSSDK.logger.setMedta({
|
108
|
-
platform: this.platform ===
|
108
|
+
platform: this.platform === PlatformEnum.desktop ? 'PC' : 'WAP',
|
109
109
|
// PC/WAP,
|
110
110
|
sdkVersion: sdkVersion,
|
111
111
|
webAppVersion: this._appVersion,
|
@@ -142,8 +142,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
142
142
|
var _this$_renderParams4,
|
143
143
|
_this = this;
|
144
144
|
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 (
|
145
|
+
if (ComponentSignEnum.CASHIER_PAYMENT_APM === this._componentSign) return;
|
146
|
+
if (ComponentSignEnum.CASHIER_PAYMENT_BANK === this._componentSign) {
|
147
147
|
this.AMSSDK.logger.logInfo({
|
148
148
|
title: 'sdk_event_security_unneeded_scenarios'
|
149
149
|
}, {
|
@@ -268,8 +268,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
268
268
|
this._componentSign = componentSign;
|
269
269
|
if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
|
270
270
|
this._renderDisplayType = renderParams.renderDisplayType;
|
271
|
+
// connect element模式会存在加载多个sdk,appendAliasContainerId为true来判断,给容器inlineId添加标识,id中不能存在#需在这里提前过滤一下
|
272
|
+
var _selector = this._selector.indexOf('#') === -1 ? this._selector : this._selector.slice(1);
|
273
|
+
// 修改需当前文件搜索,这段注释appendAliasContainerId
|
274
|
+
var appendAliasContainerId = renderParams.appendAliasContainerId ? "-".concat(_selector) : '';
|
275
|
+
var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
|
276
|
+
var insertedNode = this._renderDisplayType === DisplayTypeEnum.inline ? "#".concat(inlineId) : this._selector;
|
271
277
|
this._isAppWebview = renderParams.isAppWebview;
|
272
|
-
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
273
278
|
this.initLoggerMeta();
|
274
279
|
this.initSecurity();
|
275
280
|
this._performanceData.push({
|
@@ -301,14 +306,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
301
306
|
version: productSceneVersion,
|
302
307
|
product: this.AMSSDK.options.product
|
303
308
|
}).send();
|
304
|
-
if (
|
305
|
-
if (productScene ===
|
309
|
+
if (ComponentSignEnum.EASY_PAY_WALLET === this._componentSign) {
|
310
|
+
if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
|
306
311
|
// EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
|
307
312
|
this.handleAuthUrlInfo(authUrlInfo);
|
308
313
|
return;
|
309
314
|
}
|
310
315
|
}
|
311
|
-
if (
|
316
|
+
if (ComponentSignEnum.AUTO_DEBIT_WALLET === this._componentSign) {
|
312
317
|
var _this$_renderParams9, _action$web, _action$wap;
|
313
318
|
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
319
|
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 +324,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
319
324
|
return;
|
320
325
|
}
|
321
326
|
}
|
322
|
-
if (
|
327
|
+
if (ComponentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
|
323
328
|
if (requireFastSdk === true && productSceneVersion === '1.0') {
|
324
329
|
// REDIRECT,requireFastSdk为true,不需要接口请求
|
325
330
|
this.handleAuthUrlInfo(authUrlInfo);
|
@@ -334,12 +339,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
334
339
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
335
340
|
code: eventCodeEnum.SDK_START_OF_LOADING
|
336
341
|
});
|
337
|
-
if (this._renderDisplayType ===
|
338
|
-
var container = createInlineBaseElement(this._selector);
|
342
|
+
if (this._renderDisplayType === DisplayTypeEnum.inline) {
|
343
|
+
var container = createInlineBaseElement(this._selector, COMPONENT_CONTAINER_ID, inlineId);
|
339
344
|
if (container) this.renderInlineLoading(renderParams, container);
|
340
345
|
insertStyleSheet();
|
341
346
|
}
|
342
|
-
if (this._renderDisplayType ===
|
347
|
+
if (this._renderDisplayType === DisplayTypeEnum.popup) {
|
343
348
|
var _this$_renderParams10;
|
344
349
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
345
350
|
createRetentionPopup(this.platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
@@ -382,7 +387,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
382
387
|
key: "setParameterDefaultValues",
|
383
388
|
value: function setParameterDefaultValues(componentSign, renderParams) {
|
384
389
|
var newParams = Object.assign({}, renderParams);
|
385
|
-
if (componentSign ===
|
390
|
+
if (componentSign === ComponentSignEnum.VAULTING_CARD) {
|
386
391
|
var _newParams$notRedirec;
|
387
392
|
newParams.notRedirectAfterComplete = (_newParams$notRedirec = newParams === null || newParams === void 0 ? void 0 : newParams.notRedirectAfterComplete) !== null && _newParams$notRedirec !== void 0 ? _newParams$notRedirec : true;
|
388
393
|
}
|
@@ -451,8 +456,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
451
456
|
// eslint-disable-next-line no-async-promise-executor
|
452
457
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
453
458
|
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$
|
459
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6, _this5$_renderParams7;
|
460
|
+
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
461
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
457
462
|
while (1) switch (_context2.prev = _context2.next) {
|
458
463
|
case 0:
|
@@ -488,11 +493,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
488
493
|
success: true
|
489
494
|
}));
|
490
495
|
case 9:
|
491
|
-
if (
|
496
|
+
if (ComponentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
492
497
|
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
493
498
|
}
|
494
|
-
|
495
|
-
if (!(componentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
499
|
+
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
500
|
_context2.next = 12;
|
497
501
|
break;
|
498
502
|
}
|
@@ -501,22 +505,31 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
501
505
|
success: true
|
502
506
|
}));
|
503
507
|
case 12:
|
504
|
-
if (!(
|
505
|
-
_context2.next =
|
508
|
+
if (!(ComponentSignEnum.ELEMENT_ADDRESS === _this5._componentSign)) {
|
509
|
+
_context2.next = 14;
|
510
|
+
break;
|
511
|
+
}
|
512
|
+
return _context2.abrupt("return", resolve({
|
513
|
+
message: 'sdk no need to make query request',
|
514
|
+
success: true
|
515
|
+
}));
|
516
|
+
case 14:
|
517
|
+
if (!(ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
518
|
+
_context2.next = 26;
|
506
519
|
break;
|
507
520
|
}
|
508
521
|
if (!enableVaultingApiOptimize) {
|
509
|
-
_context2.next =
|
522
|
+
_context2.next = 26;
|
510
523
|
break;
|
511
524
|
}
|
512
525
|
if (!skipSdkQueryForm) {
|
513
|
-
_context2.next =
|
526
|
+
_context2.next = 23;
|
514
527
|
break;
|
515
528
|
}
|
516
529
|
// 优先判断 skipSdkQueryForm
|
517
530
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
518
531
|
if (!ifSkip) {
|
519
|
-
_context2.next =
|
532
|
+
_context2.next = 21;
|
520
533
|
break;
|
521
534
|
}
|
522
535
|
resolve({
|
@@ -524,12 +537,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
524
537
|
success: true
|
525
538
|
});
|
526
539
|
return _context2.abrupt("return");
|
527
|
-
case 19:
|
528
|
-
_context2.next = 24;
|
529
|
-
break;
|
530
540
|
case 21:
|
541
|
+
_context2.next = 26;
|
542
|
+
break;
|
543
|
+
case 23:
|
531
544
|
if (!skipSdkQuery) {
|
532
|
-
_context2.next =
|
545
|
+
_context2.next = 26;
|
533
546
|
break;
|
534
547
|
}
|
535
548
|
resolve({
|
@@ -537,10 +550,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
537
550
|
success: true
|
538
551
|
});
|
539
552
|
return _context2.abrupt("return");
|
540
|
-
case
|
541
|
-
channelBehavior = getChannelBehavior((_this5$
|
553
|
+
case 26:
|
554
|
+
channelBehavior = getChannelBehavior((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
542
555
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
543
|
-
_context2.next =
|
556
|
+
_context2.next = 29;
|
544
557
|
break;
|
545
558
|
}
|
546
559
|
return _context2.abrupt("return", resolve({
|
@@ -548,78 +561,79 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
548
561
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
549
562
|
success: true
|
550
563
|
}));
|
551
|
-
case
|
552
|
-
if (!(
|
553
|
-
_context2.next =
|
564
|
+
case 29:
|
565
|
+
if (!(ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || ComponentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
566
|
+
_context2.next = 35;
|
554
567
|
break;
|
555
568
|
}
|
556
569
|
params.paymentMethodType = 'CARD';
|
557
|
-
_context2.next =
|
570
|
+
_context2.next = 33;
|
558
571
|
return _this5.getDeviceIdAndLog();
|
559
|
-
case
|
572
|
+
case 33:
|
560
573
|
envInfo.deviceId = _context2.sent;
|
561
574
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
562
575
|
envInfo.extendInfo = {
|
563
576
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
564
577
|
};
|
565
578
|
}
|
566
|
-
case
|
567
|
-
if (!(
|
568
|
-
_context2.next =
|
579
|
+
case 35:
|
580
|
+
if (!(ComponentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
581
|
+
_context2.next = 45;
|
569
582
|
break;
|
570
583
|
}
|
571
584
|
_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
|
-
|
585
|
+
_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;
|
586
|
+
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)) {
|
587
|
+
_context2.next = 40;
|
574
588
|
break;
|
575
589
|
}
|
576
590
|
return _context2.abrupt("return", resolve({
|
577
591
|
message: 'sdk no need to make query request',
|
578
592
|
success: true
|
579
593
|
}));
|
580
|
-
case
|
581
|
-
if (!(productScene ===
|
582
|
-
_context2.next =
|
594
|
+
case 40:
|
595
|
+
if (!(productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0')) {
|
596
|
+
_context2.next = 42;
|
583
597
|
break;
|
584
598
|
}
|
585
599
|
return _context2.abrupt("return", resolve({
|
586
600
|
message: 'sdk no need to make query request',
|
587
601
|
success: true
|
588
602
|
}));
|
589
|
-
case
|
590
|
-
_context2.next =
|
603
|
+
case 42:
|
604
|
+
_context2.next = 44;
|
591
605
|
return _this5.getDeviceIdAndLog();
|
592
|
-
case
|
606
|
+
case 44:
|
593
607
|
envInfo.deviceId = _context2.sent;
|
594
|
-
case
|
595
|
-
if (!(
|
596
|
-
_context2.next =
|
608
|
+
case 45:
|
609
|
+
if (!(ComponentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
610
|
+
_context2.next = 55;
|
597
611
|
break;
|
598
612
|
}
|
599
|
-
action = ((_this5$
|
613
|
+
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
614
|
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
615
|
if (!(signType === 'SMS')) {
|
602
|
-
_context2.next =
|
616
|
+
_context2.next = 50;
|
603
617
|
break;
|
604
618
|
}
|
605
619
|
return _context2.abrupt("return", resolve({
|
606
620
|
message: 'sdk no need to make query request',
|
607
621
|
success: true
|
608
622
|
}));
|
609
|
-
case
|
623
|
+
case 50:
|
610
624
|
if (!(!signType || signType !== 'REDIRECT')) {
|
611
|
-
_context2.next =
|
625
|
+
_context2.next = 52;
|
612
626
|
break;
|
613
627
|
}
|
614
628
|
return _context2.abrupt("return", resolve({
|
615
629
|
success: false
|
616
630
|
}));
|
617
|
-
case
|
618
|
-
_context2.next =
|
631
|
+
case 52:
|
632
|
+
_context2.next = 54;
|
619
633
|
return _this5.getDeviceIdAndLog();
|
620
|
-
case
|
634
|
+
case 54:
|
621
635
|
envInfo.deviceId = _context2.sent;
|
622
|
-
case
|
636
|
+
case 55:
|
623
637
|
_this5.AMSSDK.logger.logInfo({
|
624
638
|
title: 'sdk_event_sdkQuery'
|
625
639
|
}, {
|
@@ -642,7 +656,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
642
656
|
responseBody: res
|
643
657
|
}).send();
|
644
658
|
}).catch(function (err) {
|
645
|
-
if ([
|
659
|
+
if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
|
646
660
|
return resolve({
|
647
661
|
success: false
|
648
662
|
});
|
@@ -658,7 +672,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
658
672
|
}).send();
|
659
673
|
reject(err);
|
660
674
|
});
|
661
|
-
case
|
675
|
+
case 57:
|
662
676
|
case "end":
|
663
677
|
return _context2.stop();
|
664
678
|
}
|
@@ -690,13 +704,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
690
704
|
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
691
705
|
// eslint-disable-next-line no-async-promise-executor
|
692
706
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
693
|
-
var
|
707
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
694
708
|
var _channelBehavior$buil, _this6$_renderParams$;
|
695
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3,
|
709
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _this6$_renderParams3, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, _ref13, _ref13$paymentMethodI, _ref13$paymentMethodI2, _ref13$paymentMethodI3, paymentMethodType, isAppWebview, backScheme, extParams;
|
696
710
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
697
711
|
while (1) switch (_context3.prev = _context3.next) {
|
698
712
|
case 0:
|
699
|
-
if (!(_this6.AMSSDK.options.product ===
|
713
|
+
if (!(_this6.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS)) {
|
700
714
|
_context3.next = 2;
|
701
715
|
break;
|
702
716
|
}
|
@@ -710,13 +724,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
710
724
|
// 新逻辑走 channelBehavior判断
|
711
725
|
shouldSkipSubmitPayInSDK = !channelBehavior.submitPayInSdk;
|
712
726
|
} 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) ||
|
727
|
+
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
728
|
}
|
715
|
-
if (
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
if (productScene ===
|
729
|
+
if (ComponentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
730
|
+
_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;
|
731
|
+
_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;
|
732
|
+
_ref13 = ((_this6$_renderParams3 = _this6._renderParams) === null || _this6$_renderParams3 === void 0 ? void 0 : _this6$_renderParams3.paymentSessionMetaData) || {}, _ref13$paymentMethodI = _ref13.paymentMethodInfoView, _ref13$paymentMethodI2 = _ref13$paymentMethodI === void 0 ? {} : _ref13$paymentMethodI, _ref13$paymentMethodI3 = _ref13$paymentMethodI2.paymentMethodType, paymentMethodType = _ref13$paymentMethodI3 === void 0 ? '' : _ref13$paymentMethodI3;
|
733
|
+
if (productScene === ProductSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
720
734
|
isAppWebview = _this6._isAppWebview || false; ///EasyPay 2.0 首次传signAgreement字段
|
721
735
|
params['signAgreement'] = enableSignAgreement;
|
722
736
|
if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
|
@@ -799,7 +813,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
799
813
|
}, _callee3);
|
800
814
|
}));
|
801
815
|
return function (_x3) {
|
802
|
-
return
|
816
|
+
return _ref10.apply(this, arguments);
|
803
817
|
};
|
804
818
|
}());
|
805
819
|
}
|
@@ -842,7 +856,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
842
856
|
var preloadIframe = createPreloadIframe(componentSign, productSceneVersion);
|
843
857
|
var productScene = componentSign.split(/_(?=[^_]*$)/)[0];
|
844
858
|
var _getIframeUrl = getIframeUrl({
|
845
|
-
renderDisplayType:
|
859
|
+
renderDisplayType: DisplayTypeEnum.popup,
|
846
860
|
componentSign: componentSign,
|
847
861
|
analytics: {
|
848
862
|
enabled: false
|
@@ -883,7 +897,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
883
897
|
value: Date.now()
|
884
898
|
});
|
885
899
|
try {
|
886
|
-
var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4;
|
900
|
+
var _renderParams$payment, _renderParams$payment2, _renderParams$payment3, _renderParams$payment4, _renderParams$debugPr, _renderParams$debugPr2;
|
887
901
|
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
902
|
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
903
|
var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment3 = renderParams.paymentSessionMetaData) === null || _renderParams$payment3 === void 0 ? void 0 : _renderParams$payment3.extendInfo) || '';
|
@@ -896,7 +910,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
896
910
|
productScene: productScene,
|
897
911
|
productSceneVersion: productSceneVersion,
|
898
912
|
extendInfo: extendInfo,
|
899
|
-
mid: mid
|
913
|
+
mid: mid,
|
914
|
+
localLink: renderParams === null || renderParams === void 0 || (_renderParams$debugPr = renderParams.debugProps) === null || _renderParams$debugPr === void 0 ? void 0 : _renderParams$debugPr.localLink // TODO Connect本地调试link
|
900
915
|
});
|
901
916
|
this.app = createIframe(this.AMSSDK.options.mode, this.platform);
|
902
917
|
var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
|
@@ -912,7 +927,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
912
927
|
locale: this.AMSSDK.options.locale,
|
913
928
|
instanceId: this.AMSSDK._instanceId,
|
914
929
|
hostSign: hostSign,
|
915
|
-
mid: mid
|
930
|
+
mid: mid,
|
931
|
+
localLink: renderParams === null || renderParams === void 0 || (_renderParams$debugPr2 = renderParams.debugProps) === null || _renderParams$debugPr2 === void 0 ? void 0 : _renderParams$debugPr2.localLink // TODO Connect本地调试link
|
916
932
|
}),
|
917
933
|
path = _getIframeUrl2.path,
|
918
934
|
locationSearch = _getIframeUrl2.locationSearch;
|
@@ -947,7 +963,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
947
963
|
var isJson = isJsonString(e.data);
|
948
964
|
if (isJson) {
|
949
965
|
var data = JSON.parse(e.data);
|
950
|
-
if (data.name !==
|
966
|
+
if (data.name !== MessageName.APP_TO_SDK && data.name !== MessageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) return;
|
951
967
|
this._handleAppMessage(data);
|
952
968
|
} else {
|
953
969
|
console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
|
@@ -1154,6 +1170,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1154
1170
|
}, {
|
1155
1171
|
key: "_handleAppMessage",
|
1156
1172
|
value: function _handleAppMessage(data) {
|
1173
|
+
var _data$context2,
|
1174
|
+
_this7 = this;
|
1157
1175
|
var eventKeyMap = Object.keys(EVENT).map(function (key) {
|
1158
1176
|
return EVENT[key].name;
|
1159
1177
|
});
|
@@ -1278,9 +1296,57 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1278
1296
|
title: 'sdk_event_event_callback'
|
1279
1297
|
}).send();
|
1280
1298
|
}
|
1299
|
+
if ((data === null || data === void 0 || (_data$context2 = data.context) === null || _data$context2 === void 0 ? void 0 : _data$context2.event) === EVENT.getGooglePayToken.name) {
|
1300
|
+
handleGooglePay(data).then(function (res) {
|
1301
|
+
_this7.dispatchToApp({
|
1302
|
+
context: {
|
1303
|
+
event: 'getGooglePayToken',
|
1304
|
+
data: _objectSpread({}, res)
|
1305
|
+
}
|
1306
|
+
});
|
1307
|
+
}).catch(function (err) {
|
1308
|
+
_this7.dispatchToApp({
|
1309
|
+
context: {
|
1310
|
+
event: 'getGooglePayToken',
|
1311
|
+
data: {
|
1312
|
+
err: err
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
});
|
1316
|
+
});
|
1317
|
+
return;
|
1318
|
+
}
|
1281
1319
|
|
1282
|
-
//
|
1283
|
-
this.
|
1320
|
+
// log event before sending the callback
|
1321
|
+
this.logEventCallback(data, "sdk_event_event_callback");
|
1322
|
+
try {
|
1323
|
+
// The plug-in communicates with the sdk after processing
|
1324
|
+
this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
|
1325
|
+
// log event after sending the callback
|
1326
|
+
this.logEventCallback(data, "sdk_event_afterEventCallback");
|
1327
|
+
} catch (e) {
|
1328
|
+
console.error(e);
|
1329
|
+
}
|
1330
|
+
}
|
1331
|
+
}, {
|
1332
|
+
key: "logEventCallback",
|
1333
|
+
value: function logEventCallback(data, title) {
|
1334
|
+
if (data.context.event === EVENT.eventCallback.name) {
|
1335
|
+
var _data$context4;
|
1336
|
+
var callbackData = "";
|
1337
|
+
try {
|
1338
|
+
var _data$context3;
|
1339
|
+
callbackData = JSON.stringify((data === null || data === void 0 || (_data$context3 = data.context) === null || _data$context3 === void 0 ? void 0 : _data$context3.data) || "");
|
1340
|
+
} catch (e) {
|
1341
|
+
console.error(e);
|
1342
|
+
}
|
1343
|
+
this.AMSSDK.logger.logInfo({
|
1344
|
+
title: title
|
1345
|
+
}, {
|
1346
|
+
callbackData: callbackData,
|
1347
|
+
callbackId: (data === null || data === void 0 || (_data$context4 = data.context) === null || _data$context4 === void 0 ? void 0 : _data$context4.eventCallbackId) || ""
|
1348
|
+
}).send();
|
1349
|
+
}
|
1284
1350
|
}
|
1285
1351
|
}, {
|
1286
1352
|
key: "dismissLoadingFunc",
|
@@ -1297,12 +1363,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1297
1363
|
}, {
|
1298
1364
|
key: "handleSizeChanged",
|
1299
1365
|
value: function handleSizeChanged(data) {
|
1300
|
-
var _data$context$data4;
|
1301
|
-
var
|
1302
|
-
|
1366
|
+
var _this$_renderParams$s, _this$_renderParams$s2, _data$context$data4, _cashier$style;
|
1367
|
+
var _selector = ((_this$_renderParams$s = this._renderParams.selector) === null || _this$_renderParams$s === void 0 ? void 0 : _this$_renderParams$s.indexOf('#')) === -1 ? this._renderParams.selector : (_this$_renderParams$s2 = this._renderParams.selector) === null || _this$_renderParams$s2 === void 0 ? void 0 : _this$_renderParams$s2.slice(1);
|
1368
|
+
// 修改需当前文件搜索,这段注释appendAliasContainerId
|
1369
|
+
var appendAliasContainerId = this._renderParams.appendAliasContainerId;
|
1370
|
+
var selectorId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat(_selector) : COMPONENT_CONTAINER_ID;
|
1371
|
+
var cashier = document.getElementById(selectorId);
|
1372
|
+
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;
|
1303
1373
|
cashier.style.height = "".concat(data.context.data.height, "px");
|
1304
1374
|
this.app.style.opacity = '1';
|
1305
|
-
if (this._renderDisplayType ===
|
1375
|
+
if (this._renderDisplayType === DisplayTypeEnum.popup) {
|
1306
1376
|
if (this.platform === 'desktop') {
|
1307
1377
|
if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
|
1308
1378
|
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
@@ -1327,6 +1397,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1327
1397
|
style.innerHTML = runkeyframes;
|
1328
1398
|
// 将style样式存放到head标签
|
1329
1399
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1400
|
+
|
1330
1401
|
// size变动时动画
|
1331
1402
|
setTimeout(function () {
|
1332
1403
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1335,7 +1406,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1335
1406
|
// 关闭loading,保留蒙层
|
1336
1407
|
this.dismissLoadingFunc();
|
1337
1408
|
}
|
1338
|
-
if (this._renderDisplayType ===
|
1409
|
+
if (this._renderDisplayType === DisplayTypeEnum.inline) {
|
1339
1410
|
var _document$getElementB3;
|
1340
1411
|
(_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0 || _document$getElementB3.remove();
|
1341
1412
|
this.app.style.height = "".concat(data.context.data.height, "px");
|
@@ -1366,7 +1437,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1366
1437
|
var _data$isDestroy,
|
1367
1438
|
_data$isCallApp,
|
1368
1439
|
_data$callAppDetectSu,
|
1369
|
-
|
1440
|
+
_this8 = this;
|
1370
1441
|
var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1371
1442
|
var _data = typeof data === 'string' ? {
|
1372
1443
|
normalUrl: data
|
@@ -1383,7 +1454,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1383
1454
|
title: 'sdk_event_call_url_start'
|
1384
1455
|
}, _objectSpread({}, data)).send();
|
1385
1456
|
var successCallback = function successCallback(type, url, durationInSeconds) {
|
1386
|
-
|
1457
|
+
_this8.dispatchToSDK(EVENT.eventCallback.name, {
|
1387
1458
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
1388
1459
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
1389
1460
|
});
|
@@ -1396,12 +1467,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1396
1467
|
if (durationInSeconds) {
|
1397
1468
|
extra['durationInSeconds'] = durationInSeconds;
|
1398
1469
|
}
|
1399
|
-
|
1470
|
+
_this8.AMSSDK.logger.logInfo({
|
1400
1471
|
title: 'sdk_event_call_url_success'
|
1401
1472
|
}, extra).send();
|
1402
1473
|
};
|
1403
1474
|
var failCallback = function failCallback(type, url, durationInSeconds) {
|
1404
|
-
|
1475
|
+
_this8.dispatchToSDK(EVENT.eventCallback.name, {
|
1405
1476
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
1406
1477
|
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)
|
1407
1478
|
});
|
@@ -1414,19 +1485,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1414
1485
|
if (durationInSeconds) {
|
1415
1486
|
extra['durationInSeconds'] = durationInSeconds;
|
1416
1487
|
}
|
1417
|
-
|
1488
|
+
_this8.AMSSDK.logger.logInfo({
|
1418
1489
|
title: 'sdk_error_call_url_failed'
|
1419
1490
|
}, extra).send();
|
1420
1491
|
};
|
1421
1492
|
|
1422
1493
|
// 支持 target: _blank,新开tab页打开
|
1423
|
-
if (_data.target ===
|
1494
|
+
if (_data.target === TargetEnum.BLANK) {
|
1424
1495
|
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
1425
1496
|
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
1426
1497
|
window.open(_data.normalUrl);
|
1427
1498
|
return;
|
1428
1499
|
}
|
1429
|
-
if (_data.target ===
|
1500
|
+
if (_data.target === TargetEnum.REPLACE && !(_data !== null && _data !== void 0 && _data.applinkUrl) && !(_data !== null && _data !== void 0 && _data.schemeUrl)) {
|
1430
1501
|
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
1431
1502
|
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
1432
1503
|
window.location.replace(_data.normalUrl);
|
@@ -1460,14 +1531,14 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1460
1531
|
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1461
1532
|
}).catch(function () {
|
1462
1533
|
if (_data !== null && _data !== void 0 && _data.applinkUrl) failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
1463
|
-
return
|
1534
|
+
return _this8.AMSSDK._redirect({
|
1464
1535
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
1465
1536
|
});
|
1466
1537
|
}).then(function () {
|
1467
1538
|
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1468
1539
|
}).catch(function () {
|
1469
1540
|
if (_data !== null && _data !== void 0 && _data.schemeUrl) failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
1470
|
-
return
|
1541
|
+
return _this8.AMSSDK._redirect({
|
1471
1542
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
1472
1543
|
});
|
1473
1544
|
}).then(function () {
|
@@ -1478,9 +1549,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1478
1549
|
}
|
1479
1550
|
}, {
|
1480
1551
|
key: "handleDeclareInfo",
|
1481
|
-
value: function handleDeclareInfo(
|
1482
|
-
var
|
1483
|
-
closeDialogData =
|
1552
|
+
value: function handleDeclareInfo(_ref14) {
|
1553
|
+
var _ref14$closeDialogDat = _ref14.closeDialogData,
|
1554
|
+
closeDialogData = _ref14$closeDialogDat === void 0 ? {} : _ref14$closeDialogDat;
|
1484
1555
|
_handleDeclareInfo({
|
1485
1556
|
closeDialogData: closeDialogData
|
1486
1557
|
});
|
@@ -1506,12 +1577,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1506
1577
|
}, {
|
1507
1578
|
key: "handleAppHeartBeat",
|
1508
1579
|
value: function handleAppHeartBeat() {
|
1509
|
-
var
|
1580
|
+
var _this9 = this;
|
1510
1581
|
try {
|
1511
1582
|
if (!this._webAppHeartBeatTimeoutFn) {
|
1512
1583
|
this._webAppHeartBeatTimeoutFn = function () {
|
1513
|
-
if (
|
1514
|
-
|
1584
|
+
if (_this9.isAppAttached()) {
|
1585
|
+
_this9.AMSSDK.logger.logError({
|
1515
1586
|
title: 'sdk_error_appHeartBeatTimeout'
|
1516
1587
|
});
|
1517
1588
|
}
|
@@ -1525,8 +1596,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1525
1596
|
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1526
1597
|
}
|
1527
1598
|
setTimeout(function () {
|
1528
|
-
if (
|
1529
|
-
|
1599
|
+
if (_this9.isAppAttached()) {
|
1600
|
+
_this9.dispatchToApp({
|
1530
1601
|
context: {
|
1531
1602
|
event: 'sdkHeartBeat',
|
1532
1603
|
data: {}
|
@@ -1582,7 +1653,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1582
1653
|
value: function dispatchToApp(payload) {
|
1583
1654
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1584
1655
|
var data = Object.assign({}, payload, {
|
1585
|
-
name:
|
1656
|
+
name: MessageName.SDK_TO_APP,
|
1586
1657
|
mode: this.AMSSDK.options.mode,
|
1587
1658
|
appId: COMPONENTPLUGINID,
|
1588
1659
|
instanceId: this.AMSSDK._instanceId
|
@@ -1626,7 +1697,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1626
1697
|
while (1) switch (_context8.prev = _context8.next) {
|
1627
1698
|
case 0:
|
1628
1699
|
_context8.prev = 0;
|
1629
|
-
isAddressElement = this.AMSSDK.options.product ===
|
1700
|
+
isAddressElement = this.AMSSDK.options.product === ProductSceneEnum.ELEMENT_ADDRESS;
|
1630
1701
|
if (!((!this._actionQueryPromise || !this._actionSubmitPromise) && !isAddressElement)) {
|
1631
1702
|
_context8.next = 4;
|
1632
1703
|
break;
|
@@ -1719,7 +1790,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1719
1790
|
key: "cleanContainer",
|
1720
1791
|
value: function cleanContainer() {
|
1721
1792
|
var _document$getElementB4,
|
1722
|
-
|
1793
|
+
_this10 = this;
|
1723
1794
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1724
1795
|
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
|
1725
1796
|
this.hideComponentAnimation();
|
@@ -1731,22 +1802,26 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1731
1802
|
this.app = null;
|
1732
1803
|
if (immediately) this.cleanElement();else {
|
1733
1804
|
setTimeout(function () {
|
1734
|
-
|
1805
|
+
_this10.cleanElement();
|
1735
1806
|
}, 300);
|
1736
1807
|
}
|
1737
1808
|
}
|
1738
1809
|
}, {
|
1739
1810
|
key: "hideComponentAnimation",
|
1740
1811
|
value: function hideComponentAnimation() {
|
1741
|
-
var _container$style;
|
1742
|
-
|
1743
|
-
|
1812
|
+
var _this$_renderParams$s3, _this$_renderParams$s4, _container$style;
|
1813
|
+
// 修改需当前文件搜索,这段注释appendAliasContainerId
|
1814
|
+
var _selector = ((_this$_renderParams$s3 = this._renderParams.selector) === null || _this$_renderParams$s3 === void 0 ? void 0 : _this$_renderParams$s3.indexOf('#')) === -1 ? this._renderParams.selector : (_this$_renderParams$s4 = this._renderParams.selector) === null || _this$_renderParams$s4 === void 0 ? void 0 : _this$_renderParams$s4.slice(1);
|
1815
|
+
var appendAliasContainerId = this._renderParams.appendAliasContainerId ? "-".concat(_selector) : '';
|
1816
|
+
var inlineId = "".concat(COMPONENT_CONTAINER_ID).concat(appendAliasContainerId);
|
1817
|
+
var container = document.getElementById(inlineId);
|
1818
|
+
if (this.app && container) this.app.style.height = container === null || container === void 0 || (_container$style = container.style) === null || _container$style === void 0 ? void 0 : _container$style.height;
|
1744
1819
|
if (container) {
|
1745
1820
|
// size变化动画取消
|
1746
1821
|
container.style.transition = '';
|
1747
|
-
container === null || container === void 0 || container.classList.remove("".concat(
|
1748
|
-
container === null || container === void 0 || container.classList.remove("".concat(
|
1749
|
-
container === null || container === void 0 || container.classList.add("".concat(
|
1822
|
+
container === null || container === void 0 || container.classList.remove("".concat(inlineId, "-").concat(this.platform));
|
1823
|
+
container === null || container === void 0 || container.classList.remove("".concat(inlineId, "-").concat(this.platform, "-animation"));
|
1824
|
+
container === null || container === void 0 || container.classList.add("".concat(inlineId, "-hidden-").concat(this.platform));
|
1750
1825
|
}
|
1751
1826
|
}
|
1752
1827
|
}, {
|
@@ -1770,7 +1845,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1770
1845
|
}, {
|
1771
1846
|
key: "removeRetentionPopup",
|
1772
1847
|
value: function removeRetentionPopup(platform) {
|
1773
|
-
_removeRetentionPopup(
|
1848
|
+
_removeRetentionPopup();
|
1849
|
+
// TODO check
|
1850
|
+
// removeRetentionPopup(platform, this.hideRetentionPopupFunc.bind(this), this.retentionPopupLeaveFunc.bind(this));
|
1774
1851
|
}
|
1775
1852
|
}, {
|
1776
1853
|
key: "showRetentionPopup",
|