@alipay/ams-checkout 0.0.1712728793-dev.0 → 0.0.1713146800-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/request.js +3 -3
- package/esm/core/component/index.d.ts +0 -1
- package/esm/core/component/index.js +2 -4
- package/esm/core/instance/index.js +3 -4
- package/esm/plugin/component/component.popup.style.js +1 -1
- package/esm/plugin/component/index.d.ts +2 -1
- package/esm/plugin/component/index.js +49 -81
- package/esm/request/index.js +14 -8
- package/esm/types/index.d.ts +0 -5
- package/esm/util/versionCompare.d.ts +0 -2
- package/esm/util/versionCompare.js +0 -75
- 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-1529.gz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-1529.gz00b.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_20231218150235';
|
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,7 +7,6 @@ export declare class AMSComponent extends CoreInstance {
|
|
7
7
|
_componentApp: ComponentApp;
|
8
8
|
channelType: componentSignEnum[];
|
9
9
|
productSceneVersion: string;
|
10
|
-
timer: any;
|
11
10
|
constructor(options: IoptionsParams);
|
12
11
|
private parameterInitAndCheck;
|
13
12
|
private pluginAppendIframe;
|
@@ -74,7 +74,7 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
74
74
|
parseData = _parseSessionData2[0],
|
75
75
|
sessionData = _parseSessionData2[1];
|
76
76
|
resetEasyPaySceneVersion(parseData);
|
77
|
-
return [parseData
|
77
|
+
return [parseData, sessionData];
|
78
78
|
};
|
79
79
|
var handleParams = function handleParams(params) {
|
80
80
|
var _params = Object.assign({
|
@@ -116,7 +116,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
116
116
|
_defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
|
117
117
|
_defineProperty(_assertThisInitialized(_this), "channelType", void 0);
|
118
118
|
_defineProperty(_assertThisInitialized(_this), "productSceneVersion", void 0);
|
119
|
-
_defineProperty(_assertThisInitialized(_this), "timer", void 0);
|
120
119
|
var ComponentPlugin = new ComponentApp();
|
121
120
|
ComponentPlugin.setRender(createIframeNode);
|
122
121
|
ComponentPlugin.setPreloadRender(createPreloadIframeNode);
|
@@ -362,7 +361,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
362
361
|
channelType: channelType
|
363
362
|
});
|
364
363
|
}
|
365
|
-
|
364
|
+
setTimeout(function () {
|
366
365
|
_this5.clearPreloadIframe(true);
|
367
366
|
}, MAX_CLEAR_TIME);
|
368
367
|
}
|
@@ -370,7 +369,6 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
370
369
|
key: "clearPreloadIframe",
|
371
370
|
value: function clearPreloadIframe() {
|
372
371
|
var isTimeOut = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
373
|
-
!isTimeOut && clearTimeout(this.timer);
|
374
372
|
if (Array.isArray(this.channelType)) {
|
375
373
|
for (var i = 0; i < this.channelType.length; i++) {
|
376
374
|
var iframe = document.getElementById("ams-checkout-component-".concat(this.channelType[i], "-").concat(this.productSceneVersion));
|
@@ -56,7 +56,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
56
56
|
this._storageId = _storageId;
|
57
57
|
|
58
58
|
// TODO Consumption data analysis control parameters
|
59
|
-
this.logger = new Logger(LogConfig,
|
59
|
+
this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment) !== environmentEnum.prod);
|
60
60
|
this.logger.setMedta({
|
61
61
|
instanceId: this._instanceId
|
62
62
|
});
|
@@ -65,15 +65,14 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
65
65
|
title: 'NEW_AMSSDK_BY_MECHANT',
|
66
66
|
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
|
67
67
|
}).send();
|
68
|
-
this.preInitSecurity(
|
68
|
+
this.preInitSecurity();
|
69
69
|
}
|
70
70
|
_createClass(AMSSDK, [{
|
71
71
|
key: "preInitSecurity",
|
72
|
-
value: function preInitSecurity(
|
72
|
+
value: function preInitSecurity() {
|
73
73
|
var _this$options;
|
74
74
|
var antomSDKConfigKey = 'antomSDKConfigKey';
|
75
75
|
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
76
|
-
if (![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
77
76
|
if (checkTimeElapsed()) {
|
78
77
|
antomConfig({
|
79
78
|
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 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");
|
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 80% {\n opacity: 1\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,6 +25,7 @@ export default class ComponentApp {
|
|
25
25
|
private _renderDisplayType;
|
26
26
|
private _multipleCallbackEvents;
|
27
27
|
_merchantAppointParam: IMerchantAppointParam;
|
28
|
+
private _webAppHeartBeatTimeoutId;
|
28
29
|
private _webAppHeartBeatTimeoutFn;
|
29
30
|
constructor();
|
30
31
|
/**
|
@@ -97,7 +98,7 @@ export default class ComponentApp {
|
|
97
98
|
*/
|
98
99
|
dispatchToApp(payload: {
|
99
100
|
context: eventPayloadContext;
|
100
|
-
}, targetElement?: any
|
101
|
+
}, targetElement?: any): any;
|
101
102
|
/**
|
102
103
|
* @description Subscribe to messages from SDK
|
103
104
|
*/
|
@@ -22,7 +22,6 @@ 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";
|
26
25
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
27
26
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
28
27
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
@@ -53,8 +52,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
53
52
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
54
53
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
55
54
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
55
|
+
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
56
56
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
57
|
-
this._appVersion = '1.11.
|
57
|
+
this._appVersion = '1.11.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,
|
367
|
+
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$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,10 +380,9 @@ 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) || {},
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _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;
|
387
386
|
try {
|
388
387
|
extendInfoData = JSON.parse(extendInfo);
|
389
388
|
enableVaultingApiOptimize = extendInfoData.enableVaultingApiOptimize || false;
|
@@ -392,123 +391,95 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
392
391
|
console.log(error);
|
393
392
|
}
|
394
393
|
if (!isLocalMock()) {
|
395
|
-
_context2.next =
|
394
|
+
_context2.next = 8;
|
396
395
|
break;
|
397
396
|
}
|
398
397
|
return _context2.abrupt("return", resolve({
|
399
398
|
message: 'sdk no need to make query request',
|
400
399
|
success: true
|
401
400
|
}));
|
402
|
-
case
|
403
|
-
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
404
|
-
_context2.next =
|
405
|
-
break;
|
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({
|
422
|
-
message: 'sdk no need to make query request',
|
423
|
-
success: true
|
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;
|
401
|
+
case 8:
|
402
|
+
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign && (_this5$_renderParams5 = _this5._renderParams) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) !== null && _this5$_renderParams5 !== void 0 && (_this5$_renderParams5 = _this5$_renderParams5.action) !== null && _this5$_renderParams5 !== void 0 && _this5$_renderParams5.skipSdkQuery && enableVaultingApiOptimize)) {
|
403
|
+
_context2.next = 10;
|
432
404
|
break;
|
433
405
|
}
|
434
|
-
resolve({
|
406
|
+
return _context2.abrupt("return", resolve({
|
435
407
|
message: 'sdk no need to make query request',
|
436
408
|
success: true
|
437
|
-
});
|
438
|
-
|
439
|
-
case 21:
|
409
|
+
}));
|
410
|
+
case 10:
|
440
411
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
441
|
-
_context2.next =
|
412
|
+
_context2.next = 16;
|
442
413
|
break;
|
443
414
|
}
|
444
415
|
params.paymentMethodType = 'CARD';
|
445
|
-
_context2.next =
|
416
|
+
_context2.next = 14;
|
446
417
|
return _this5.getDeviceIdAndLog();
|
447
|
-
case
|
418
|
+
case 14:
|
448
419
|
envInfo.deviceId = _context2.sent;
|
449
420
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
450
421
|
envInfo.extendInfo = {
|
451
422
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
452
423
|
};
|
453
424
|
}
|
454
|
-
case
|
425
|
+
case 16:
|
455
426
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
456
|
-
_context2.next =
|
427
|
+
_context2.next = 26;
|
457
428
|
break;
|
458
429
|
}
|
459
|
-
|
460
|
-
|
430
|
+
_ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
|
431
|
+
_ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
|
461
432
|
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)) {
|
462
|
-
_context2.next =
|
433
|
+
_context2.next = 21;
|
463
434
|
break;
|
464
435
|
}
|
465
436
|
return _context2.abrupt("return", resolve({
|
466
437
|
message: 'sdk no need to make query request',
|
467
438
|
success: true
|
468
439
|
}));
|
469
|
-
case
|
440
|
+
case 21:
|
470
441
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
471
|
-
_context2.next =
|
442
|
+
_context2.next = 23;
|
472
443
|
break;
|
473
444
|
}
|
474
445
|
return _context2.abrupt("return", resolve({
|
475
446
|
message: 'sdk no need to make query request',
|
476
447
|
success: true
|
477
448
|
}));
|
478
|
-
case
|
479
|
-
_context2.next =
|
449
|
+
case 23:
|
450
|
+
_context2.next = 25;
|
480
451
|
return _this5.getDeviceIdAndLog();
|
481
|
-
case
|
452
|
+
case 25:
|
482
453
|
envInfo.deviceId = _context2.sent;
|
483
|
-
case
|
454
|
+
case 26:
|
484
455
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
485
|
-
_context2.next =
|
456
|
+
_context2.next = 36;
|
486
457
|
break;
|
487
458
|
}
|
488
459
|
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) || {};
|
489
460
|
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;
|
490
461
|
if (!(signType === 'SMS')) {
|
491
|
-
_context2.next =
|
462
|
+
_context2.next = 31;
|
492
463
|
break;
|
493
464
|
}
|
494
465
|
return _context2.abrupt("return", resolve({
|
495
466
|
message: 'sdk no need to make query request',
|
496
467
|
success: true
|
497
468
|
}));
|
498
|
-
case
|
469
|
+
case 31:
|
499
470
|
if (!(!signType || signType !== 'REDIRECT')) {
|
500
|
-
_context2.next =
|
471
|
+
_context2.next = 33;
|
501
472
|
break;
|
502
473
|
}
|
503
474
|
return _context2.abrupt("return", resolve({
|
504
475
|
success: false
|
505
476
|
}));
|
506
|
-
case
|
507
|
-
_context2.next =
|
477
|
+
case 33:
|
478
|
+
_context2.next = 35;
|
508
479
|
return _this5.getDeviceIdAndLog();
|
509
|
-
case
|
480
|
+
case 35:
|
510
481
|
envInfo.deviceId = _context2.sent;
|
511
|
-
case
|
482
|
+
case 36:
|
512
483
|
_this5.AMSSDK.logger.logInfo({
|
513
484
|
title: 'sdk_event_sdkQuery'
|
514
485
|
}, {
|
@@ -540,7 +511,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
540
511
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
541
512
|
}).send();
|
542
513
|
});
|
543
|
-
case
|
514
|
+
case 38:
|
544
515
|
case "end":
|
545
516
|
return _context2.stop();
|
546
517
|
}
|
@@ -571,7 +542,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
571
542
|
|
572
543
|
// eslint-disable-next-line no-async-promise-executor
|
573
544
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
574
|
-
var
|
545
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
575
546
|
var _this6$_renderParams;
|
576
547
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
577
548
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -634,7 +605,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
634
605
|
}, _callee3);
|
635
606
|
}));
|
636
607
|
return function (_x3) {
|
637
|
-
return
|
608
|
+
return _ref6.apply(this, arguments);
|
638
609
|
};
|
639
610
|
}());
|
640
611
|
}
|
@@ -1225,9 +1196,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1225
1196
|
}
|
1226
1197
|
}, {
|
1227
1198
|
key: "handleDeclareInfo",
|
1228
|
-
value: function handleDeclareInfo(
|
1229
|
-
var
|
1230
|
-
closeDialogData =
|
1199
|
+
value: function handleDeclareInfo(_ref7) {
|
1200
|
+
var _ref7$closeDialogData = _ref7.closeDialogData,
|
1201
|
+
closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
|
1231
1202
|
_handleDeclareInfo({
|
1232
1203
|
closeDialogData: closeDialogData
|
1233
1204
|
});
|
@@ -1264,12 +1235,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1264
1235
|
}
|
1265
1236
|
};
|
1266
1237
|
}
|
1267
|
-
if (
|
1268
|
-
clearTimeout(
|
1269
|
-
|
1238
|
+
if (this._webAppHeartBeatTimeoutId) {
|
1239
|
+
clearTimeout(this._webAppHeartBeatTimeoutId);
|
1240
|
+
this._webAppHeartBeatTimeoutId = null;
|
1270
1241
|
}
|
1271
1242
|
if (this._webAppHeartBeatTimeoutFn) {
|
1272
|
-
|
1243
|
+
this._webAppHeartBeatTimeoutId = setTimeout(this._webAppHeartBeatTimeoutFn, TIMEOUT_WEB_APP_HEART_BEAT);
|
1273
1244
|
}
|
1274
1245
|
setTimeout(function () {
|
1275
1246
|
if (_this8.isAppAttached()) {
|
@@ -1328,20 +1299,17 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1328
1299
|
key: "dispatchToApp",
|
1329
1300
|
value: function dispatchToApp(payload) {
|
1330
1301
|
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
1331
|
-
var sendLog = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
1332
1302
|
var data = Object.assign({}, payload, {
|
1333
1303
|
name: messageName.SDK_TO_APP,
|
1334
1304
|
mode: this.AMSSDK.options.mode,
|
1335
1305
|
appId: COMPONENTPLUGINID,
|
1336
1306
|
instanceId: this.AMSSDK._instanceId
|
1337
1307
|
});
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
}).send();
|
1344
|
-
}
|
1308
|
+
this.AMSSDK.logger.logInfo({
|
1309
|
+
title: 'sdk_event_send_message_to_web'
|
1310
|
+
}, {
|
1311
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
1312
|
+
}).send();
|
1345
1313
|
if (targetElement && targetElement.contentWindow) {
|
1346
1314
|
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
1347
1315
|
}
|
@@ -1418,7 +1386,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1418
1386
|
}
|
1419
1387
|
}
|
1420
1388
|
}
|
1421
|
-
}
|
1389
|
+
});
|
1422
1390
|
this.AMSSDK.logger.logInfo({
|
1423
1391
|
title: 'sdk_event_renderComponent'
|
1424
1392
|
});
|
package/esm/request/index.js
CHANGED
@@ -50,6 +50,8 @@ function requestInstance(options) {
|
|
50
50
|
withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
|
51
51
|
method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
|
52
52
|
});
|
53
|
+
console.log('baseURL', baseURL);
|
54
|
+
console.log('_headers', _headers);
|
53
55
|
return instance.request;
|
54
56
|
}
|
55
57
|
|
@@ -97,21 +99,25 @@ function _request() {
|
|
97
99
|
})];
|
98
100
|
startTime = Date.now();
|
99
101
|
_context.prev = 5;
|
102
|
+
console.log('requestInstance options', options);
|
103
|
+
console.log('requestInstance -data', _data);
|
100
104
|
myRequest = requestInstance(options);
|
101
|
-
_context.next =
|
105
|
+
_context.next = 11;
|
102
106
|
return myRequest({
|
103
107
|
data: _data
|
104
108
|
});
|
105
|
-
case
|
109
|
+
case 11:
|
106
110
|
_yield$myRequest = _context.sent;
|
107
111
|
data = _yield$myRequest.data;
|
108
112
|
headers = _yield$myRequest.headers;
|
113
|
+
console.log('requestInstance data', data);
|
114
|
+
console.log('requestInstance headers', headers);
|
109
115
|
resData = data || {};
|
110
116
|
traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
|
111
117
|
resData.traceId = traceId || '';
|
112
118
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
113
119
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
114
|
-
_context.next =
|
120
|
+
_context.next = 25;
|
115
121
|
break;
|
116
122
|
}
|
117
123
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
@@ -130,7 +136,7 @@ function _request() {
|
|
130
136
|
errorCode: errorCode,
|
131
137
|
success: false
|
132
138
|
}));
|
133
|
-
case
|
139
|
+
case 25:
|
134
140
|
logger.reportRPC({
|
135
141
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
136
142
|
label: 'request',
|
@@ -141,8 +147,8 @@ function _request() {
|
|
141
147
|
traceId: traceId
|
142
148
|
}).send();
|
143
149
|
return _context.abrupt("return", resData);
|
144
|
-
case
|
145
|
-
_context.prev =
|
150
|
+
case 29:
|
151
|
+
_context.prev = 29;
|
146
152
|
_context.t0 = _context["catch"](5);
|
147
153
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
148
154
|
success: false,
|
@@ -164,11 +170,11 @@ function _request() {
|
|
164
170
|
errorCode: _errorCode,
|
165
171
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
166
172
|
}));
|
167
|
-
case
|
173
|
+
case 36:
|
168
174
|
case "end":
|
169
175
|
return _context.stop();
|
170
176
|
}
|
171
|
-
}, _callee, null, [[5,
|
177
|
+
}, _callee, null, [[5, 29]]);
|
172
178
|
}));
|
173
179
|
return _request.apply(this, arguments);
|
174
180
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -133,11 +133,6 @@ export interface IpaymentSessionMetaData {
|
|
133
133
|
action?: {
|
134
134
|
autoDebitWithToken: boolean;
|
135
135
|
skipSdkQuery: boolean;
|
136
|
-
skipSdkQueryForm?: {
|
137
|
-
value: boolean;
|
138
|
-
version: string;
|
139
|
-
platform: string;
|
140
|
-
};
|
141
136
|
};
|
142
137
|
paymentSessionFactor?: {
|
143
138
|
extendInfo?: {
|
@@ -4,5 +4,3 @@
|
|
4
4
|
* @param v2
|
5
5
|
*/
|
6
6
|
export declare function compareVersion(v1: string, v2: string): 1 | 0 | -1;
|
7
|
-
export declare function isVersionInRange(currentVersion: any, minVersion: any, maxVersion: any): boolean;
|
8
|
-
export declare function matchVersion(config: any, currentVersion: any): boolean;
|
@@ -1,9 +1,3 @@
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
1
|
/**
|
8
2
|
* 返回值0标识一样大,1表示v1大,-1表示v2大
|
9
3
|
* @param v1
|
@@ -48,73 +42,4 @@ export function compareVersion(v1, v2) {
|
|
48
42
|
} else {
|
49
43
|
return 1;
|
50
44
|
}
|
51
|
-
}
|
52
|
-
export function isVersionInRange(currentVersion, minVersion, maxVersion) {
|
53
|
-
function splitVersion(version) {
|
54
|
-
return version.split('.').map(function (num) {
|
55
|
-
return parseInt(num, 10);
|
56
|
-
});
|
57
|
-
}
|
58
|
-
function compareVersions(v1, v2) {
|
59
|
-
for (var i = 0; i < Math.max(v1.length, v2.length); i++) {
|
60
|
-
var num1 = v1[i] === undefined ? 0 : v1[i];
|
61
|
-
var num2 = v2[i] === undefined ? 0 : v2[i];
|
62
|
-
if (num1 > num2) return 1;
|
63
|
-
if (num1 < num2) return -1;
|
64
|
-
}
|
65
|
-
return 0;
|
66
|
-
}
|
67
|
-
var current = splitVersion(currentVersion);
|
68
|
-
var min = minVersion ? splitVersion(minVersion) : null;
|
69
|
-
var max = maxVersion ? splitVersion(maxVersion) : null;
|
70
|
-
if (min && compareVersions(current, min) < 0) {
|
71
|
-
// 当前版本小于最小允许版本
|
72
|
-
return false;
|
73
|
-
}
|
74
|
-
if (max && compareVersions(current, max) > 0) {
|
75
|
-
// 当前版本大于最大允许版本
|
76
|
-
return false;
|
77
|
-
}
|
78
|
-
// 当前版本在允许的版本范围内
|
79
|
-
return true;
|
80
|
-
}
|
81
|
-
export function matchVersion(config, currentVersion) {
|
82
|
-
var value = config.value,
|
83
|
-
version = config.version,
|
84
|
-
platform = config.platform;
|
85
|
-
var CURRENT_PLATFORM = 'WEB';
|
86
|
-
var isMatchVersion = false;
|
87
|
-
var isMatchPlatform = false;
|
88
|
-
|
89
|
-
// 平台判断
|
90
|
-
if (platform) {
|
91
|
-
var platformList = platform.split('|').map(function (platform) {
|
92
|
-
return platform.toLocaleUpperCase();
|
93
|
-
});
|
94
|
-
isMatchPlatform = platformList.includes(CURRENT_PLATFORM);
|
95
|
-
} else {
|
96
|
-
// 没有表示平台全匹配
|
97
|
-
isMatchPlatform = true;
|
98
|
-
}
|
99
|
-
// 版本判断
|
100
|
-
if (!version) {
|
101
|
-
// 为空全匹配
|
102
|
-
isMatchVersion = true;
|
103
|
-
} else if (version.indexOf('|') !== -1) {
|
104
|
-
// | 范围匹配
|
105
|
-
var _version$split = version.split('|'),
|
106
|
-
_version$split2 = _slicedToArray(_version$split, 2),
|
107
|
-
_version$split2$ = _version$split2[0],
|
108
|
-
minVersion = _version$split2$ === void 0 ? '' : _version$split2$,
|
109
|
-
_version$split2$2 = _version$split2[1],
|
110
|
-
maxVersion = _version$split2$2 === void 0 ? '' : _version$split2$2;
|
111
|
-
isMatchVersion = isVersionInRange(currentVersion, minVersion, maxVersion);
|
112
|
-
} else if (version.indexOf(',') !== -1) {
|
113
|
-
// , 枚举匹配
|
114
|
-
var versionList = version.split(',');
|
115
|
-
isMatchVersion = versionList.includes(currentVersion);
|
116
|
-
} else {
|
117
|
-
isMatchVersion = version === currentVersion;
|
118
|
-
}
|
119
|
-
return value && isMatchPlatform && isMatchVersion;
|
120
45
|
}
|