@alipay/ams-checkout 0.0.1711691167-dev.2 → 0.0.1711691167-dev.21
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/request.js +3 -3
- package/esm/core/component/index.d.ts +1 -0
- package/esm/core/component/index.js +4 -2
- package/esm/core/instance/index.js +4 -3
- package/esm/plugin/component/component.popup.style.js +1 -1
- package/esm/plugin/component/index.d.ts +1 -2
- package/esm/plugin/component/index.js +81 -49
- package/esm/plugin/paypal/index.js +48 -36
- package/esm/request/index.js +8 -14
- package/esm/types/index.d.ts +12 -5
- package/esm/util/versionCompare.d.ts +2 -0
- package/esm/util/versionCompare.js +75 -0
- package/package.json +1 -1
package/esm/config/request.js
CHANGED
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
|
|
12
12
|
groupId = _queryParse.groupId,
|
13
13
|
host = _queryParse.requestHost;
|
14
14
|
export var requestHost = {
|
15
|
-
local: 'http://imgs-
|
16
|
-
dev: host || 'http://imgs-
|
15
|
+
local: 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-8452.sggz00b.dev.alipay.net/mgw.htm',
|
17
17
|
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
18
|
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
19
|
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -22,7 +22,7 @@ export var requestHost = {
|
|
22
22
|
export var clientId = '5J5Y8X4E2Y25GR00690';
|
23
23
|
export var tntInstId = 'ALIPW3SG';
|
24
24
|
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
-
export var sofaId = groupId || '
|
25
|
+
export var sofaId = groupId || 'GROUP_20240304204929';
|
26
26
|
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
27
|
var map = {
|
28
28
|
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -7,6 +7,7 @@ export declare class AMSComponent extends CoreInstance {
|
|
7
7
|
_componentApp: ComponentApp;
|
8
8
|
channelType: componentSignEnum[];
|
9
9
|
productSceneVersion: string;
|
10
|
+
timer: any;
|
10
11
|
constructor(options: IoptionsParams);
|
11
12
|
private parameterInitAndCheck;
|
12
13
|
private pluginAppendIframe;
|
@@ -75,7 +75,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
75
75
|
parseData = _parseSessionData2[0],
|
76
76
|
sessionData = _parseSessionData2[1];
|
77
77
|
resetEasyPaySceneVersion(parseData);
|
78
|
-
return [parseData, sessionData];
|
78
|
+
return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
|
79
79
|
};
|
80
80
|
var handleParams = function handleParams(params) {
|
81
81
|
var _params = Object.assign({
|
@@ -117,6 +117,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
117
117
|
_defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
|
118
118
|
_defineProperty(_assertThisInitialized(_this), "channelType", void 0);
|
119
119
|
_defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "timer", void 0);
|
120
121
|
var ComponentPlugin = new ComponentApp();
|
121
122
|
ComponentPlugin.setRender(createIframeNode);
|
122
123
|
ComponentPlugin.setPreloadRender(createPreloadIframeNode);
|
@@ -365,7 +366,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
365
366
|
channelType: channelType
|
366
367
|
});
|
367
368
|
}
|
368
|
-
setTimeout(function () {
|
369
|
+
this.timer = setTimeout(function () {
|
369
370
|
_this5.clearPreloadIframe(true);
|
370
371
|
}, MAX_CLEAR_TIME);
|
371
372
|
}
|
@@ -373,6 +374,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
373
374
|
key: "clearPreloadIframe",
|
374
375
|
value: function clearPreloadIframe() {
|
375
376
|
var isTimeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
377
|
+
!isTimeOut && clearTimeout(this.timer);
|
376
378
|
if (Array.isArray(this.channelType)) {
|
377
379
|
for (var i = 0; i < this.channelType.length; i++) {
|
378
380
|
var iframe = document.getElementById("ams-checkout-component-".concat(this.channelType[i], "-").concat(this.productSceneVersion));
|
@@ -57,7 +57,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
57
57
|
this._storageId = _storageId;
|
58
58
|
|
59
59
|
// TODO Consumption data analysis control parameters
|
60
|
-
this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment)
|
60
|
+
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
61
61
|
this.logger.setMedta({
|
62
62
|
instanceId: this._instanceId
|
63
63
|
});
|
@@ -68,14 +68,15 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
68
68
|
title: 'NEW_AMSSDK_BY_MECHANT',
|
69
69
|
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
|
70
70
|
}).send();
|
71
|
-
this.preInitSecurity();
|
71
|
+
this.preInitSecurity(options);
|
72
72
|
}
|
73
73
|
_createClass(AMSSDK, [{
|
74
74
|
key: "preInitSecurity",
|
75
|
-
value: function preInitSecurity() {
|
75
|
+
value: function preInitSecurity(options) {
|
76
76
|
var _this$options;
|
77
77
|
var antomSDKConfigKey = 'antomSDKConfigKey';
|
78
78
|
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
79
|
+
if (![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
79
80
|
if (checkTimeElapsed()) {
|
80
81
|
antomConfig({
|
81
82
|
env: this.options.env.environment
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import { ANIMATION_TIME, closeImg, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, LOADING_ID, MOCKUP_ID } from "../../constant";
|
9
9
|
import { platformEnum } from "../../types";
|
10
10
|
import { addSetFontSizeEvent, amsSetSize, getDesignFontSize } from "../../util";
|
11
|
-
var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n \n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n
|
11
|
+
var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n \n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.".concat(MOCKUP_ID, "-hidden{\nanimation: ").concat(MOCKUP_ID, "-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ").concat(MOCKUP_ID, "-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n");
|
12
12
|
export var componentAddCSS = function componentAddCSS() {
|
13
13
|
var style = document.createElement('style');
|
14
14
|
style.type = 'text/css';
|
@@ -25,7 +25,6 @@ export default class ComponentApp {
|
|
25
25
|
private _renderDisplayType;
|
26
26
|
private _multipleCallbackEvents;
|
27
27
|
_merchantAppointParam: IMerchantAppointParam;
|
28
|
-
private _webAppHeartBeatTimeoutId;
|
29
28
|
private _webAppHeartBeatTimeoutFn;
|
30
29
|
constructor();
|
31
30
|
/**
|
@@ -98,7 +97,7 @@ export default class ComponentApp {
|
|
98
97
|
*/
|
99
98
|
dispatchToApp(payload: {
|
100
99
|
context: eventPayloadContext;
|
101
|
-
}, targetElement?: any): any;
|
100
|
+
}, targetElement?: any, sendLog?: boolean): any;
|
102
101
|
/**
|
103
102
|
* @description Subscribe to messages from SDK
|
104
103
|
*/
|
@@ -22,6 +22,7 @@ import { queryPaymentInfo, submitPayInfo } from "../../service";
|
|
22
22
|
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, RedirectType, renderDisplayTypeEnum, targetEnum } from "../../types";
|
23
23
|
import { getType, isJsonString, isPC } from "../../util";
|
24
24
|
import { isLocalMock } from "../../util/mock";
|
25
|
+
import { matchVersion } from "../../util/versionCompare";
|
25
26
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
26
27
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
27
28
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
@@ -52,9 +53,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
52
53
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
53
54
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
54
55
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
55
|
-
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
56
56
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
57
|
-
this._appVersion = '1.
|
57
|
+
this._appVersion = '1.12.0';
|
58
58
|
this._isInitComponent = false;
|
59
59
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
60
60
|
this.createIframeNode = function () {
|
@@ -364,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
364
364
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
365
365
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
366
366
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
367
|
-
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7,
|
367
|
+
var envInfo, params, _ref3, _ref3$extendInfo, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref4, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, _this5$_renderParams6, _this5$_renderParams7, _ref5, _ref5$productSceneVer, productSceneVersion, _ref5$productScene, productScene, _ref6, _ref6$action, _ref6$action2, _ref6$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
|
368
368
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
369
369
|
while (1) switch (_context2.prev = _context2.next) {
|
370
370
|
case 0:
|
@@ -380,9 +380,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
380
380
|
/**
|
381
381
|
* @description Simulated or unnecessary scenarios
|
382
382
|
*/
|
383
|
-
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, _ref3$extendInfo = _ref3.extendInfo, extendInfo = _ref3$extendInfo === void 0 ? '' : _ref3$extendInfo;
|
384
384
|
enableVaultingApiOptimize = false;
|
385
385
|
enableEasypayApiOptimize = false;
|
386
|
+
_ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.action) || {}, skipSdkQuery = _ref4.skipSdkQuery, skipSdkQueryForm = _ref4.skipSdkQueryForm;
|
386
387
|
try {
|
387
388
|
extendInfoData = JSON.parse(extendInfo);
|
388
389
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -391,95 +392,123 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
391
392
|
console.log(error);
|
392
393
|
}
|
393
394
|
if (!isLocalMock()) {
|
394
|
-
_context2.next =
|
395
|
+
_context2.next = 9;
|
395
396
|
break;
|
396
397
|
}
|
397
398
|
return _context2.abrupt("return", resolve({
|
398
399
|
message: 'sdk no need to make query request',
|
399
400
|
success: true
|
400
401
|
}));
|
401
|
-
case
|
402
|
-
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign
|
403
|
-
_context2.next =
|
402
|
+
case 9:
|
403
|
+
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
404
|
+
_context2.next = 21;
|
404
405
|
break;
|
405
406
|
}
|
406
|
-
|
407
|
+
if (!enableVaultingApiOptimize) {
|
408
|
+
_context2.next = 21;
|
409
|
+
break;
|
410
|
+
}
|
411
|
+
if (!skipSdkQueryForm) {
|
412
|
+
_context2.next = 18;
|
413
|
+
break;
|
414
|
+
}
|
415
|
+
// 优先判断 skipSdkQueryForm
|
416
|
+
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
417
|
+
if (!ifSkip) {
|
418
|
+
_context2.next = 16;
|
419
|
+
break;
|
420
|
+
}
|
421
|
+
resolve({
|
407
422
|
message: 'sdk no need to make query request',
|
408
423
|
success: true
|
409
|
-
})
|
410
|
-
|
424
|
+
});
|
425
|
+
return _context2.abrupt("return");
|
426
|
+
case 16:
|
427
|
+
_context2.next = 21;
|
428
|
+
break;
|
429
|
+
case 18:
|
430
|
+
if (!skipSdkQuery) {
|
431
|
+
_context2.next = 21;
|
432
|
+
break;
|
433
|
+
}
|
434
|
+
resolve({
|
435
|
+
message: 'sdk no need to make query request',
|
436
|
+
success: true
|
437
|
+
});
|
438
|
+
return _context2.abrupt("return");
|
439
|
+
case 21:
|
411
440
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
412
|
-
_context2.next =
|
441
|
+
_context2.next = 27;
|
413
442
|
break;
|
414
443
|
}
|
415
444
|
params.paymentMethodType = 'CARD';
|
416
|
-
_context2.next =
|
445
|
+
_context2.next = 25;
|
417
446
|
return _this5.getDeviceIdAndLog();
|
418
|
-
case
|
447
|
+
case 25:
|
419
448
|
envInfo.deviceId = _context2.sent;
|
420
449
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
421
450
|
envInfo.extendInfo = {
|
422
451
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
423
452
|
};
|
424
453
|
}
|
425
|
-
case
|
454
|
+
case 27:
|
426
455
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
427
|
-
_context2.next =
|
456
|
+
_context2.next = 37;
|
428
457
|
break;
|
429
458
|
}
|
430
|
-
|
431
|
-
|
459
|
+
_ref5 = params.paymentSessionConfig || {}, _ref5$productSceneVer = _ref5.productSceneVersion, productSceneVersion = _ref5$productSceneVer === void 0 ? '' : _ref5$productSceneVer, _ref5$productScene = _ref5.productScene, productScene = _ref5$productScene === void 0 ? '' : _ref5$productScene;
|
460
|
+
_ref6 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref6$action = _ref6.action, _ref6$action2 = _ref6$action === void 0 ? {} : _ref6$action, _ref6$action2$autoDeb = _ref6$action2.autoDebitWithToken, autoDebitWithToken = _ref6$action2$autoDeb === void 0 ? false : _ref6$action2$autoDeb;
|
432
461
|
if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
|
433
|
-
_context2.next =
|
462
|
+
_context2.next = 32;
|
434
463
|
break;
|
435
464
|
}
|
436
465
|
return _context2.abrupt("return", resolve({
|
437
466
|
message: 'sdk no need to make query request',
|
438
467
|
success: true
|
439
468
|
}));
|
440
|
-
case
|
469
|
+
case 32:
|
441
470
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
442
|
-
_context2.next =
|
471
|
+
_context2.next = 34;
|
443
472
|
break;
|
444
473
|
}
|
445
474
|
return _context2.abrupt("return", resolve({
|
446
475
|
message: 'sdk no need to make query request',
|
447
476
|
success: true
|
448
477
|
}));
|
449
|
-
case
|
450
|
-
_context2.next =
|
478
|
+
case 34:
|
479
|
+
_context2.next = 36;
|
451
480
|
return _this5.getDeviceIdAndLog();
|
452
|
-
case
|
481
|
+
case 36:
|
453
482
|
envInfo.deviceId = _context2.sent;
|
454
|
-
case
|
483
|
+
case 37:
|
455
484
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
456
|
-
_context2.next =
|
485
|
+
_context2.next = 47;
|
457
486
|
break;
|
458
487
|
}
|
459
488
|
action = ((_this5$_renderParams8 = _this5._renderParams) === null || _this5$_renderParams8 === void 0 || (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) === null || _this5$_renderParams8 === void 0 ? void 0 : _this5$_renderParams8.action) || {};
|
460
489
|
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
461
490
|
if (!(signType === 'SMS')) {
|
462
|
-
_context2.next =
|
491
|
+
_context2.next = 42;
|
463
492
|
break;
|
464
493
|
}
|
465
494
|
return _context2.abrupt("return", resolve({
|
466
495
|
message: 'sdk no need to make query request',
|
467
496
|
success: true
|
468
497
|
}));
|
469
|
-
case
|
498
|
+
case 42:
|
470
499
|
if (!(!signType || signType !== 'REDIRECT')) {
|
471
|
-
_context2.next =
|
500
|
+
_context2.next = 44;
|
472
501
|
break;
|
473
502
|
}
|
474
503
|
return _context2.abrupt("return", resolve({
|
475
504
|
success: false
|
476
505
|
}));
|
477
|
-
case
|
478
|
-
_context2.next =
|
506
|
+
case 44:
|
507
|
+
_context2.next = 46;
|
479
508
|
return _this5.getDeviceIdAndLog();
|
480
|
-
case
|
509
|
+
case 46:
|
481
510
|
envInfo.deviceId = _context2.sent;
|
482
|
-
case
|
511
|
+
case 47:
|
483
512
|
_this5.AMSSDK.logger.logInfo({
|
484
513
|
title: 'sdk_event_sdkQuery'
|
485
514
|
}, {
|
@@ -518,7 +547,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
518
547
|
}).send();
|
519
548
|
reject(err);
|
520
549
|
});
|
521
|
-
case
|
550
|
+
case 49:
|
522
551
|
case "end":
|
523
552
|
return _context2.stop();
|
524
553
|
}
|
@@ -549,7 +578,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
549
578
|
|
550
579
|
// eslint-disable-next-line no-async-promise-executor
|
551
580
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
552
|
-
var
|
581
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
553
582
|
var _this6$_renderParams;
|
554
583
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
555
584
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -615,7 +644,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
615
644
|
}, _callee3);
|
616
645
|
}));
|
617
646
|
return function (_x3) {
|
618
|
-
return
|
647
|
+
return _ref7.apply(this, arguments);
|
619
648
|
};
|
620
649
|
}());
|
621
650
|
}
|
@@ -1206,9 +1235,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1206
1235
|
}
|
1207
1236
|
}, {
|
1208
1237
|
key: "handleDeclareInfo",
|
1209
|
-
value: function handleDeclareInfo(
|
1210
|
-
var
|
1211
|
-
closeDialogData =
|
1238
|
+
value: function handleDeclareInfo(_ref8) {
|
1239
|
+
var _ref8$closeDialogData = _ref8.closeDialogData,
|
1240
|
+
closeDialogData = _ref8$closeDialogData === void 0 ? {} : _ref8$closeDialogData;
|
1212
1241
|
_handleDeclareInfo({
|
1213
1242
|
closeDialogData: closeDialogData
|
1214
1243
|
});
|
@@ -1245,12 +1274,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1245
1274
|
}
|
1246
1275
|
};
|
1247
1276
|
}
|
1248
|
-
if (
|
1249
|
-
clearTimeout(
|
1250
|
-
|
1277
|
+
if (window._webAppHeartBeatTimeoutId) {
|
1278
|
+
clearTimeout(window._webAppHeartBeatTimeoutId);
|
1279
|
+
window._webAppHeartBeatTimeoutId = null;
|
1251
1280
|
}
|
1252
1281
|
if (this._webAppHeartBeatTimeoutFn) {
|
1253
|
-
|
1282
|
+
window._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1254
1283
|
}
|
1255
1284
|
setTimeout(function () {
|
1256
1285
|
if (_this8.isAppAttached()) {
|
@@ -1309,17 +1338,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1309
1338
|
key: "dispatchToApp",
|
1310
1339
|
value: function dispatchToApp(payload) {
|
1311
1340
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1341
|
+
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1312
1342
|
var data = Object.assign({}, payload, {
|
1313
1343
|
name: messageName.SDK_TO_APP,
|
1314
1344
|
mode: this.AMSSDK.options.mode,
|
1315
1345
|
appId: COMPONENTPLUGINID,
|
1316
1346
|
instanceId: this.AMSSDK._instanceId
|
1317
1347
|
});
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1348
|
+
if (sendLog) {
|
1349
|
+
this.AMSSDK.logger.logInfo({
|
1350
|
+
title: 'sdk_event_send_message_to_web'
|
1351
|
+
}, {
|
1352
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
1353
|
+
}).send();
|
1354
|
+
}
|
1323
1355
|
if (targetElement && targetElement.contentWindow) {
|
1324
1356
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1325
1357
|
}
|
@@ -1408,7 +1440,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1408
1440
|
})
|
1409
1441
|
}
|
1410
1442
|
}
|
1411
|
-
});
|
1443
|
+
}, null, true);
|
1412
1444
|
this.AMSSDK.logger.logInfo({
|
1413
1445
|
title: 'sdk_event_renderComponent'
|
1414
1446
|
});
|