@alipay/ams-checkout 0.0.1723203704-dev.3 → 0.0.1724309103-dev.2
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 +0 -1
- package/esm/config/index.js +0 -8
- package/esm/constant/index.d.ts +1 -10
- package/esm/constant/index.js +0 -9
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +163 -0
- package/esm/core/component/index.js +6 -14
- package/esm/index.d.ts +2 -12
- package/esm/index.js +2 -39
- package/esm/plugin/applepay/component.js +1 -1
- package/esm/plugin/component/cashierApp.d.ts +3 -3
- package/esm/plugin/component/cashierApp.js +3 -29
- package/esm/plugin/component/component.inline.style.d.ts +9 -8
- package/esm/plugin/component/component.inline.style.js +6 -87
- package/esm/plugin/component/component.popup.style.d.ts +0 -1
- package/esm/plugin/component/component.popup.style.js +0 -3
- package/esm/plugin/component/index.js +47 -59
- package/esm/plugin/component/popupWindow.style.d.ts +2 -5
- package/esm/plugin/component/popupWindow.style.js +7 -55
- package/esm/plugin/paypal/index.js +0 -1
- package/esm/plugin/type.d.ts +0 -1
- package/esm/types/index.d.ts +4 -11
- package/esm/types/index.js +2 -10
- package/esm/util/security.d.ts +0 -1
- package/esm/util/security.js +1 -1
- package/package.json +1 -1
- package/esm/core/component/address.d.ts +0 -34
- package/esm/core/component/address.js +0 -298
- package/esm/core/instance/address.d.ts +0 -76
- package/esm/core/instance/address.js +0 -283
- package/esm/plugin/address/cashierApp.d.ts +0 -34
- package/esm/plugin/address/cashierApp.js +0 -218
- package/esm/plugin/address/channel.d.ts +0 -20
- package/esm/plugin/address/channel.js +0 -52
- package/esm/plugin/address/component.inline.style.d.ts +0 -11
- package/esm/plugin/address/component.inline.style.js +0 -38
- package/esm/plugin/address/component.popup.style.d.ts +0 -16
- package/esm/plugin/address/component.popup.style.js +0 -174
- package/esm/plugin/address/index.d.ts +0 -108
- package/esm/plugin/address/index.js +0 -862
- package/esm/plugin/address/popupWindow.style.d.ts +0 -8
- package/esm/plugin/address/popupWindow.style.js +0 -65
- package/esm/plugin/payment-element/utils.d.ts +0 -2
- package/esm/plugin/payment-element/utils.js +0 -6
- package/esm/types/address.d.ts +0 -92
- package/esm/types/address.js +0 -7
@@ -5,11 +5,10 @@
|
|
5
5
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
6
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
7
|
*/
|
8
|
-
import {
|
9
|
-
import {
|
8
|
+
import { platformEnum } from "../../types";
|
9
|
+
import { INLINE_BASE_STYLE_ID, LOADING_ID, INLINE_IMG_CLASSNAME, COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID } from "../../constant";
|
10
10
|
import { amsSetSize } from "../../util";
|
11
|
-
|
12
|
-
var inlineComponentCss = "#".concat(COMPONENT_IFRAME_TAG_ID, "-desktop{\n position: absolute;\n top: 0;\n left: 0;\n}\n#").concat(COMPONENT_IFRAME_TAG_ID, "-mobile{\n position: absolute;\n top: 0;\n left: 0;\n}\n.").concat(COMPONENT_CONTAINER_ID, "-inline{\n width: 100%;\n height: auto;\n position: relative;\n line-height: 0;\n display: flex;\n}\n#").concat(LOADING_ID, "{\n width: 100%;\n flex: 1;\n}\n.").concat(INLINE_IMG_CLASSNAME, "{\n width: 100%;\n height: auto;\n object-fit: contain;\n box-sizing: border-box;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-mobile{\n padding: 0 0.16em;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-desktop{}\n");
|
11
|
+
var inlineComponentCss = "#".concat(COMPONENT_IFRAME_TAG_ID, "-desktop{\n border-radius: 8px;\n position: absolute;\n top: 0;\n left: 0;\n}\n#").concat(COMPONENT_IFRAME_TAG_ID, "-mobile{\n position: absolute;\n top: 0;\n left: 0;\n}\n.").concat(COMPONENT_CONTAINER_ID, "-inline{\n width: 100%;\n height: auto;\n position: relative;\n line-height: 0;\n display: flex;\n}\n#").concat(LOADING_ID, "{\n width: 100%;\n flex: 1;\n}\n.").concat(INLINE_IMG_CLASSNAME, "{\n width: 100%;\n height: auto;\n object-fit: contain;\n box-sizing: border-box;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-mobile{\n padding: 0 0.16em;\n}\n.").concat(INLINE_IMG_CLASSNAME, "-desktop{}\n");
|
13
12
|
export var inlineComponentAddCss = function inlineComponentAddCss() {
|
14
13
|
var style = document.createElement('style');
|
15
14
|
style.id = 'ams-inline-component-style';
|
@@ -17,91 +16,11 @@ export var inlineComponentAddCss = function inlineComponentAddCss() {
|
|
17
16
|
style.innerHTML = inlineComponentCss;
|
18
17
|
document.head.appendChild(style);
|
19
18
|
};
|
20
|
-
|
21
|
-
* @description componentSignEnum.ELEMENT_PAYMENT特殊处理
|
22
|
-
* @param {Options['type']} type
|
23
|
-
*/
|
24
|
-
var renderElementPayment = function renderElementPayment(type) {
|
25
|
-
var spliceStr = function spliceStr() {
|
26
|
-
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
27
|
-
return arr.reduce(function (pre, cur) {
|
28
|
-
return pre += cur;
|
29
|
-
}, '');
|
30
|
-
};
|
31
|
-
var commonDom = function commonDom(children) {
|
32
|
-
var viewBox = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '0 0 560 256';
|
33
|
-
var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 256;
|
34
|
-
return "<svg id=\"".concat(INLINE_IMG_CLASSNAME, "-").concat(type, "\" width=\"100%\" height=\"").concat(height, "\" viewBox=\"").concat(viewBox, "\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"none\">\n ").concat(spliceStr(children), "\n <animate xlink:href=\"#").concat(INLINE_IMG_CLASSNAME, "-").concat(type, "\" attributeName=\"opacity\" values=\"0.5; 1; 0.5\" begin=\"0s\" dur=\"1s\" repeatCount=\"indefinite\"></animate>\n </svg>");
|
35
|
-
};
|
36
|
-
var creatRect = function creatRect(_ref) {
|
37
|
-
var _ref$x = _ref.x,
|
38
|
-
x = _ref$x === void 0 ? 0 : _ref$x,
|
39
|
-
_ref$y = _ref.y,
|
40
|
-
y = _ref$y === void 0 ? 0 : _ref$y,
|
41
|
-
_ref$fill = _ref.fill,
|
42
|
-
fill = _ref$fill === void 0 ? 'black' : _ref$fill,
|
43
|
-
_ref$width = _ref.width,
|
44
|
-
width = _ref$width === void 0 ? 560 : _ref$width,
|
45
|
-
_ref$height = _ref.height,
|
46
|
-
height = _ref$height === void 0 ? 32 : _ref$height,
|
47
|
-
_ref$rx = _ref.rx,
|
48
|
-
rx = _ref$rx === void 0 ? 4 : _ref$rx;
|
49
|
-
return "<rect fill-opacity=\"0.04\" x=\"".concat(x, "\" y=\"").concat(y, "\" width=\"").concat(width, "\" height=\"").concat(height, "\" rx=\"").concat(rx, "\" fill=\"").concat(fill, "\"/>");
|
50
|
-
};
|
51
|
-
var result = [creatRect({
|
52
|
-
fill: 'white'
|
53
|
-
}), creatRect({
|
54
|
-
y: 4
|
55
|
-
}), creatRect({
|
56
|
-
y: 48,
|
57
|
-
height: 64
|
58
|
-
}), creatRect({
|
59
|
-
y: 128
|
60
|
-
}), creatRect({
|
61
|
-
y: 176
|
62
|
-
}), creatRect({
|
63
|
-
y: 224
|
64
|
-
})];
|
65
|
-
if (type === 'tabs') {
|
66
|
-
result = [creatRect({
|
67
|
-
fill: 'white',
|
68
|
-
width: 358,
|
69
|
-
height: 305
|
70
|
-
}), creatRect({
|
71
|
-
y: 4,
|
72
|
-
width: '50%',
|
73
|
-
height: 73
|
74
|
-
}), creatRect({
|
75
|
-
x: '51%',
|
76
|
-
y: 4,
|
77
|
-
height: 73
|
78
|
-
}), creatRect({
|
79
|
-
y: 96,
|
80
|
-
height: 64
|
81
|
-
}), creatRect({
|
82
|
-
y: 178
|
83
|
-
}), creatRect({
|
84
|
-
y: 228
|
85
|
-
}), creatRect({
|
86
|
-
y: 276
|
87
|
-
})];
|
88
|
-
}
|
89
|
-
var viewBox = {
|
90
|
-
view: type === 'tabs' ? '0 0 358 305' : '0 0 560 256',
|
91
|
-
height: type === 'tabs' ? 305 : 256
|
92
|
-
};
|
93
|
-
return commonDom(result, viewBox.view, viewBox.height);
|
94
|
-
};
|
95
|
-
export var addInlineLoading = function addInlineLoading(_selector, platform, options) {
|
19
|
+
export var addInlineLoading = function addInlineLoading(_selector, platform) {
|
96
20
|
var loading = document.createElement('div');
|
97
21
|
loading.id = LOADING_ID;
|
98
|
-
if (
|
99
|
-
|
100
|
-
loading.innerHTML = '';
|
101
|
-
} else {
|
102
|
-
loading.innerHTML = renderElementPayment(options === null || options === void 0 ? void 0 : options.type);
|
103
|
-
}
|
104
|
-
} else if (platform === platformEnum.desktop) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"740\" height=\"360\" viewBox=\"0 0 740 360\" fill=\"none\" xmlns=\"\">\n <rect width=\"740\" height=\"360\" rx=\"12\" fill=\"#F6F6F6\"/>\n <rect opacity=\"0.7\" x=\"44\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"94\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"144\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z\" fill=\"#E1E6ED\"/>\n </g>\n </svg>");else if (platform === platformEnum.mobile) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"358\" height=\"186\" viewBox=\"0 0 358 186\" fill=\"none\" xmlns=\"\">\n <g clip-path=\"url(#clip0_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <g clip-path=\"url(#clip1_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <rect width=\"358\" height=\"40\" fill=\"white\"/>\n <rect opacity=\"0.7\" x=\"4\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"54\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"104\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g clip-path=\"url(#clip2_2543_91192)\">\n <rect width=\"358\" height=\"120\" transform=\"translate(0 66)\" fill=\"white\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M95 66H9C4.02944 66 0 70.0294 0 75C0 79.9706 4.02943 84 9 84H95C99.9706 84 104 79.9706 104 75C104 70.0294 99.9706 66 95 66Z\" fill=\"#E1E6ED\"/>\n </g>\n <g clip-path=\"url(#clip3_2543_91192)\">\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 94H18C8.05888 94 0 102.059 0 112C0 121.941 8.05887 130 18 130H340C349.941 130 358 121.941 358 112C358 102.059 349.941 94 340 94Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 150H18C8.05888 150 0 158.059 0 168C0 177.941 8.05887 186 18 186H340C349.941 186 358 177.941 358 168C358 158.059 349.941 150 340 150Z\" fill=\"#E1E6ED\"/>\n </g>\n </g>\n </g>\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip1_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip2_2543_91192\">\n <rect width=\"358\" height=\"120\" fill=\"white\" transform=\"translate(0 66)\"/>\n </clipPath>\n <clipPath id=\"clip3_2543_91192\">\n <rect width=\"358\" height=\"92\" fill=\"white\" transform=\"translate(0 94)\"/>\n </clipPath>\n </defs>\n </svg>\n ");
|
22
|
+
if (platform === platformEnum.desktop) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"740\" height=\"360\" viewBox=\"0 0 740 360\" fill=\"none\" xmlns=\"\">\n <rect width=\"740\" height=\"360\" rx=\"12\" fill=\"#F6F6F6\"/>\n <rect opacity=\"0.7\" x=\"44\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"94\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"144\" y=\"44\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z\" fill=\"#E1E6ED\"/>\n </g>\n </svg>");
|
23
|
+
if (platform === platformEnum.mobile) loading.innerHTML = "<svg class=\"".concat(INLINE_IMG_CLASSNAME, " ").concat(INLINE_IMG_CLASSNAME, "-").concat(platform, "\" width=\"358\" height=\"186\" viewBox=\"0 0 358 186\" fill=\"none\" xmlns=\"\">\n <g clip-path=\"url(#clip0_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <g clip-path=\"url(#clip1_2543_91192)\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n <rect width=\"358\" height=\"40\" fill=\"white\"/>\n <rect opacity=\"0.7\" x=\"4\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"54\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <rect opacity=\"0.7\" x=\"104\" y=\"4\" width=\"32\" height=\"32\" rx=\"4\" fill=\"#E1E6ED\"/>\n <g clip-path=\"url(#clip2_2543_91192)\">\n <rect width=\"358\" height=\"120\" transform=\"translate(0 66)\" fill=\"white\"/>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M95 66H9C4.02944 66 0 70.0294 0 75C0 79.9706 4.02943 84 9 84H95C99.9706 84 104 79.9706 104 75C104 70.0294 99.9706 66 95 66Z\" fill=\"#E1E6ED\"/>\n </g>\n <g clip-path=\"url(#clip3_2543_91192)\">\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 94H18C8.05888 94 0 102.059 0 112C0 121.941 8.05887 130 18 130H340C349.941 130 358 121.941 358 112C358 102.059 349.941 94 340 94Z\" fill=\"#E1E6ED\"/>\n </g>\n <g style=\"mix-blend-mode:multiply\" opacity=\"0.336007\">\n <path d=\"M340 150H18C8.05888 150 0 158.059 0 168C0 177.941 8.05887 186 18 186H340C349.941 186 358 177.941 358 168C358 158.059 349.941 150 340 150Z\" fill=\"#E1E6ED\"/>\n </g>\n </g>\n </g>\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip1_2543_91192\">\n <rect width=\"358\" height=\"186\" fill=\"white\"/>\n </clipPath>\n <clipPath id=\"clip2_2543_91192\">\n <rect width=\"358\" height=\"120\" fill=\"white\" transform=\"translate(0 66)\"/>\n </clipPath>\n <clipPath id=\"clip3_2543_91192\">\n <rect width=\"358\" height=\"92\" fill=\"white\" transform=\"translate(0 94)\"/>\n </clipPath>\n </defs>\n </svg>\n ");
|
105
24
|
if (_selector) _selector.appendChild(loading);
|
106
25
|
var loadingDom = document.getElementById(LOADING_ID);
|
107
26
|
amsSetSize(null, loadingDom);
|
@@ -168,7 +168,4 @@ export var handleDeclareInfo = function handleDeclareInfo(_ref) {
|
|
168
168
|
} catch (error) {
|
169
169
|
console.error(error);
|
170
170
|
}
|
171
|
-
};
|
172
|
-
export var slideInAndOutKeyframes = function slideInAndOutKeyframes(id, height) {
|
173
|
-
return "@keyframes ".concat(id, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(height, "px;\n }\n }\n @keyframes ").concat(id, "-slide-out {\n 0% {\n height: ").concat(height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
174
171
|
};
|
@@ -24,12 +24,11 @@ import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSce
|
|
24
24
|
import { getType, isJsonString, isPC } from "../../util";
|
25
25
|
import { isLocalMock } from "../../util/mock";
|
26
26
|
import { matchVersion } from "../../util/versionCompare";
|
27
|
-
import { handlePaymentSessionConfig } from "../payment-element/utils";
|
28
27
|
import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
29
28
|
import { getChannelBehavior } from "./channel";
|
30
29
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
31
|
-
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup
|
32
|
-
import { createModal, destroyModal, insertStyleSheet
|
30
|
+
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
31
|
+
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
33
32
|
window.changingPageHeight = window.innerHeight;
|
34
33
|
var ComponentApp = /*#__PURE__*/function () {
|
35
34
|
function ComponentApp() {
|
@@ -58,7 +57,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
58
57
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
59
58
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
60
59
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
61
|
-
this._appVersion = '1.
|
60
|
+
this._appVersion = '1.19.0';
|
62
61
|
this._isInitComponent = false;
|
63
62
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
64
63
|
this.createIframeNode = function () {
|
@@ -387,22 +386,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
387
386
|
}, {
|
388
387
|
key: "renderInlineLoading",
|
389
388
|
value: function renderInlineLoading(renderParams, selector) {
|
390
|
-
var _renderParams$appeara
|
389
|
+
var _renderParams$appeara;
|
391
390
|
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
392
391
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
393
|
-
|
394
|
-
var isExpressCheckout = false;
|
395
|
-
try {
|
396
|
-
// expressCheckout可能出现string(false) JSON.parse再转一次
|
397
|
-
isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
|
398
|
-
} catch (error) {
|
399
|
-
// 遇到JSON解析错误,默认false
|
400
|
-
}
|
401
|
-
if (showLoading) addInlineLoading(selector, this.platform, {
|
402
|
-
componentSign: this._componentSign,
|
403
|
-
type: (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.appearance) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.layout) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.type,
|
404
|
-
isExpressCheckout: isExpressCheckout
|
405
|
-
});
|
392
|
+
if (showLoading) addInlineLoading(selector, this.platform);
|
406
393
|
}
|
407
394
|
}, {
|
408
395
|
key: "renderPopupLoading",
|
@@ -439,7 +426,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
439
426
|
}, {
|
440
427
|
key: "createActionQueryPromise",
|
441
428
|
value: function createActionQueryPromise() {
|
442
|
-
var
|
429
|
+
var _this$_renderParams11,
|
430
|
+
_this5 = this;
|
431
|
+
var paymentMethodType = (_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentSessionMetaData) === null || _this$_renderParams11 === void 0 || (_this$_renderParams11 = _this$_renderParams11.paymentMethodInfoView) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.paymentMethodType;
|
443
432
|
this._performanceData.push({
|
444
433
|
key: 'sdk_action_query_start',
|
445
434
|
value: Date.now()
|
@@ -448,7 +437,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
448
437
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
449
438
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
450
439
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5, _this5$_renderParams6;
|
451
|
-
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _this5$
|
440
|
+
var envInfo, params, _ref6, _ref6$extendInfo, extendInfo, actionData, enableVaultingApiOptimize, enableEasypayApiOptimize, _ref7, skipSdkQuery, skipSdkQueryForm, extendInfoData, ifSkip, channelBehavior, _this5$_renderParams7, _this5$_renderParams8, _ref8, _ref8$productSceneVer, productSceneVersion, _ref8$productScene, productScene, _ref9, _ref9$action, _ref9$action2, _ref9$action2$autoDeb, autoDebitWithToken, _this5$_renderParams9, _action$web2, _action$wap2, action, signType;
|
452
441
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
453
442
|
while (1) switch (_context2.prev = _context2.next) {
|
454
443
|
case 0:
|
@@ -484,28 +473,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
484
473
|
success: true
|
485
474
|
}));
|
486
475
|
case 9:
|
487
|
-
if (componentSignEnum.ELEMENT_PAYMENT === _this5._componentSign) {
|
488
|
-
params.paymentSessionConfig = handlePaymentSessionConfig(params.paymentSessionConfig);
|
489
|
-
}
|
490
|
-
|
491
|
-
// 绑卡跳过actionQuery接口
|
492
|
-
// 目前只有绑卡加上 skipSdkQueryForm 判断
|
493
476
|
if (!(componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
494
|
-
_context2.next =
|
477
|
+
_context2.next = 21;
|
495
478
|
break;
|
496
479
|
}
|
497
480
|
if (!enableVaultingApiOptimize) {
|
498
|
-
_context2.next =
|
481
|
+
_context2.next = 21;
|
499
482
|
break;
|
500
483
|
}
|
501
484
|
if (!skipSdkQueryForm) {
|
502
|
-
_context2.next =
|
485
|
+
_context2.next = 18;
|
503
486
|
break;
|
504
487
|
}
|
505
488
|
// 优先判断 skipSdkQueryForm
|
506
489
|
ifSkip = matchVersion(skipSdkQueryForm, _this5._appVersion);
|
507
490
|
if (!ifSkip) {
|
508
|
-
_context2.next =
|
491
|
+
_context2.next = 16;
|
509
492
|
break;
|
510
493
|
}
|
511
494
|
resolve({
|
@@ -513,12 +496,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
513
496
|
success: true
|
514
497
|
});
|
515
498
|
return _context2.abrupt("return");
|
516
|
-
case
|
517
|
-
_context2.next =
|
499
|
+
case 16:
|
500
|
+
_context2.next = 21;
|
518
501
|
break;
|
519
|
-
case
|
502
|
+
case 18:
|
520
503
|
if (!skipSdkQuery) {
|
521
|
-
_context2.next =
|
504
|
+
_context2.next = 21;
|
522
505
|
break;
|
523
506
|
}
|
524
507
|
resolve({
|
@@ -526,10 +509,10 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
526
509
|
success: true
|
527
510
|
});
|
528
511
|
return _context2.abrupt("return");
|
529
|
-
case
|
512
|
+
case 21:
|
530
513
|
channelBehavior = getChannelBehavior((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData); // Easypay TOSS 渠道无需actionQuery
|
531
514
|
if (!(channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.usePaymentSessionAsQueryResult)) {
|
532
|
-
_context2.next =
|
515
|
+
_context2.next = 24;
|
533
516
|
break;
|
534
517
|
}
|
535
518
|
return _context2.abrupt("return", resolve({
|
@@ -537,28 +520,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
537
520
|
amountConfirmRequired: actionData === null || actionData === void 0 ? void 0 : actionData.amountConfirmRequired,
|
538
521
|
success: true
|
539
522
|
}));
|
540
|
-
case
|
523
|
+
case 24:
|
541
524
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
542
|
-
_context2.next =
|
525
|
+
_context2.next = 30;
|
543
526
|
break;
|
544
527
|
}
|
545
528
|
params.paymentMethodType = 'CARD';
|
546
|
-
_context2.next =
|
529
|
+
_context2.next = 28;
|
547
530
|
return _this5.getDeviceIdAndLog();
|
548
|
-
case
|
531
|
+
case 28:
|
549
532
|
envInfo.deviceId = _context2.sent;
|
550
533
|
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
551
534
|
envInfo.extendInfo = {
|
552
535
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
553
536
|
};
|
554
537
|
}
|
555
|
-
case
|
538
|
+
case 30:
|
556
539
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
557
540
|
_context2.next = 40;
|
558
541
|
break;
|
559
542
|
}
|
560
543
|
_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;
|
561
|
-
|
544
|
+
_ref9 = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.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;
|
545
|
+
if (!((_this5$_renderParams8 = _this5._renderParams) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.paymentSessionMetaData) !== null && _this5$_renderParams8 !== void 0 && (_this5$_renderParams8 = _this5$_renderParams8.action) !== null && _this5$_renderParams8 !== void 0 && _this5$_renderParams8.skipSdkQuery && enableEasypayApiOptimize)) {
|
562
546
|
_context2.next = 35;
|
563
547
|
break;
|
564
548
|
}
|
@@ -585,7 +569,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
585
569
|
_context2.next = 50;
|
586
570
|
break;
|
587
571
|
}
|
588
|
-
action = ((_this5$
|
572
|
+
action = ((_this5$_renderParams9 = _this5._renderParams) === null || _this5$_renderParams9 === void 0 || (_this5$_renderParams9 = _this5$_renderParams9.paymentSessionMetaData) === null || _this5$_renderParams9 === void 0 ? void 0 : _this5$_renderParams9.action) || {};
|
589
573
|
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;
|
590
574
|
if (!(signType === 'SMS')) {
|
591
575
|
_context2.next = 45;
|
@@ -679,9 +663,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
679
663
|
var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
|
680
664
|
// eslint-disable-next-line no-async-promise-executor
|
681
665
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
682
|
-
var
|
666
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
683
667
|
var _channelBehavior$buil, _this6$_renderParams$;
|
684
|
-
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2,
|
668
|
+
var shouldSkipSubmitPayInSDK, _this6$_renderParams, _this6$_renderParams2, _ref11, _ref11$productSceneVe, productSceneVersion, _ref11$productScene, productScene, _ref12, _ref12$action, _ref12$action2, _ref12$action2$enable, enableSignAgreement, _ref12$action2$autoDe, autoDebitWithToken, extParams;
|
685
669
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
686
670
|
while (1) switch (_context3.prev = _context3.next) {
|
687
671
|
case 0:
|
@@ -693,8 +677,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
693
677
|
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;
|
694
678
|
}
|
695
679
|
if (componentSignEnum.EASY_PAY_WALLET === _this6._componentSign) {
|
696
|
-
|
697
|
-
|
680
|
+
_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;
|
681
|
+
_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;
|
698
682
|
if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken) {
|
699
683
|
///EasyPay 2.0 首次传signAgreement字段
|
700
684
|
params['signAgreement'] = enableSignAgreement;
|
@@ -772,7 +756,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
772
756
|
}, _callee3);
|
773
757
|
}));
|
774
758
|
return function (_x3) {
|
775
|
-
return
|
759
|
+
return _ref10.apply(this, arguments);
|
776
760
|
};
|
777
761
|
}());
|
778
762
|
}
|
@@ -822,9 +806,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
822
806
|
productScene: componentSign,
|
823
807
|
productSceneVersion: productSceneVersion,
|
824
808
|
environment: this.AMSSDK.options.env.environment,
|
809
|
+
// TODO 确定一下这个参数是干啥的
|
825
810
|
appVersion: this._appVersion,
|
811
|
+
extendInfo: '',
|
812
|
+
locale: '',
|
826
813
|
instanceId: '',
|
827
|
-
isPreload: 'true'
|
814
|
+
isPreload: 'true',
|
815
|
+
mid: ''
|
828
816
|
}),
|
829
817
|
path = _getIframeUrl.path,
|
830
818
|
locationSearch = _getIframeUrl.locationSearch;
|
@@ -945,7 +933,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
945
933
|
key: "createDialog",
|
946
934
|
value: function () {
|
947
935
|
var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
|
948
|
-
var pageUrl,
|
936
|
+
var pageUrl, isLoad, timeout, logTimeout;
|
949
937
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
950
938
|
while (1) switch (_context4.prev = _context4.next) {
|
951
939
|
case 0:
|
@@ -955,8 +943,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
955
943
|
_context4.next = 5;
|
956
944
|
return createModal({
|
957
945
|
widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
|
958
|
-
|
959
|
-
|
946
|
+
heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
|
947
|
+
device: this.platform,
|
960
948
|
url: pageUrl
|
961
949
|
});
|
962
950
|
case 5:
|
@@ -975,7 +963,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
975
963
|
}, POPUP_LOADTIME_LOG_LIMIT);
|
976
964
|
this.popupApp.onload = function () {
|
977
965
|
isLoad = true;
|
978
|
-
removePopupLoading();
|
979
966
|
clearTimeout(timeout);
|
980
967
|
clearTimeout(logTimeout);
|
981
968
|
};
|
@@ -1268,8 +1255,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1268
1255
|
|
1269
1256
|
// 此style用于弹窗出现和高度变化时动画,动画不同,属性不同
|
1270
1257
|
this.app.style.height = parseInt(this.app.style.height) > 0 ? '100%' : "".concat(data.context.data.height, "px");
|
1258
|
+
|
1271
1259
|
// 弹出和弹入动画
|
1272
|
-
var runkeyframes =
|
1260
|
+
var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
1273
1261
|
// 创建style标签
|
1274
1262
|
var style = document.createElement('style');
|
1275
1263
|
style.id = animationStyleId;
|
@@ -1279,6 +1267,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1279
1267
|
style.innerHTML = runkeyframes;
|
1280
1268
|
// 将style样式存放到head标签
|
1281
1269
|
document.getElementsByTagName('head')[0].appendChild(style);
|
1270
|
+
|
1282
1271
|
// size变动时动画
|
1283
1272
|
setTimeout(function () {
|
1284
1273
|
cashier.style.transition = 'height 0.28s ease-in-out';
|
@@ -1398,9 +1387,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1398
1387
|
}
|
1399
1388
|
}, {
|
1400
1389
|
key: "handleDeclareInfo",
|
1401
|
-
value: function handleDeclareInfo(
|
1402
|
-
var
|
1403
|
-
closeDialogData =
|
1390
|
+
value: function handleDeclareInfo(_ref13) {
|
1391
|
+
var _ref13$closeDialogDat = _ref13.closeDialogData,
|
1392
|
+
closeDialogData = _ref13$closeDialogDat === void 0 ? {} : _ref13$closeDialogDat;
|
1404
1393
|
_handleDeclareInfo({
|
1405
1394
|
closeDialogData: closeDialogData
|
1406
1395
|
});
|
@@ -1652,9 +1641,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1652
1641
|
}, {
|
1653
1642
|
key: "hideComponentAnimation",
|
1654
1643
|
value: function hideComponentAnimation() {
|
1655
|
-
var _container$style;
|
1656
1644
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
1657
|
-
if (this.app) this.app.style.height = container
|
1645
|
+
if (this.app) this.app.style.height = container.style.height;
|
1658
1646
|
if (container) {
|
1659
1647
|
// size变化动画取消
|
1660
1648
|
container.style.transition = '';
|
@@ -1,11 +1,8 @@
|
|
1
|
-
export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void;
|
2
|
-
export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void;
|
3
|
-
export declare const removePopupLoading: (isShowMockup?: boolean) => void;
|
4
1
|
export declare const insertStyleSheet: () => void;
|
5
|
-
export declare const createModal: ({ device, url, widthPadding,
|
2
|
+
export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
|
6
3
|
device: any;
|
7
4
|
url: any;
|
8
5
|
widthPadding: any;
|
9
|
-
|
6
|
+
heightPadding: any;
|
10
7
|
}) => Promise<HTMLIFrameElement>;
|
11
8
|
export declare const destroyModal: () => void;
|
@@ -1,46 +1,8 @@
|
|
1
|
-
import { AMSPOPUP_PREFIX, ANIMATION_TIME
|
2
|
-
import { getDesignFontSize } from "../../util";
|
1
|
+
import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
|
3
2
|
|
4
3
|
// CSS样式字符串
|
5
|
-
var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n
|
6
|
-
|
7
|
-
var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
8
|
-
var theme = {
|
9
|
-
night: 'dark',
|
10
|
-
gamingPurple: 'dark',
|
11
|
-
agateGreen: 'dark',
|
12
|
-
default: 'light',
|
13
|
-
nostalgicGray: 'light',
|
14
|
-
cherryBlossomPink: 'light'
|
15
|
-
};
|
16
|
-
return theme[curTheme];
|
17
|
-
};
|
18
|
-
export var createCustomSheet = function createCustomSheet() {
|
19
|
-
var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
|
20
|
-
var sheet = "\n .ams-component-popup-loading .line div:before,\n .ams-component-popup-loading .line div:after {\n background: ".concat(curTheme === 'light' ? '#000000' : '#ffffff', " !important;\n }");
|
21
|
-
var style = document.createElement('style');
|
22
|
-
style.innerHTML = sheet;
|
23
|
-
document.head.appendChild(style);
|
24
|
-
};
|
25
|
-
export var renderPopupLoading = function renderPopupLoading(container, curTheme) {
|
26
|
-
createCustomSheet(curTheme);
|
27
|
-
var loading = document.createElement('div');
|
28
|
-
loading === null || loading === void 0 || loading.classList.add(POPUPLOADING_ID);
|
29
|
-
loading.id = POPUPLOADING_ID;
|
30
|
-
loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>';
|
31
|
-
loading.style.fontSize = "".concat(getDesignFontSize(), "px");
|
32
|
-
container.appendChild(loading);
|
33
|
-
};
|
34
|
-
export var removePopupLoading = function removePopupLoading() {
|
35
|
-
var _document$getElementB;
|
36
|
-
var isShowMockup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
37
|
-
var mockup = document.getElementById(MOCKUP_ID);
|
38
|
-
if (mockup) {
|
39
|
-
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
40
|
-
mockup.style.display = isShowMockup ? 'block' : 'none';
|
41
|
-
}
|
42
|
-
(_document$getElementB = document.getElementById(POPUPLOADING_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
43
|
-
};
|
4
|
+
var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n");
|
5
|
+
|
44
6
|
// 创建和插入样式表
|
45
7
|
export var insertStyleSheet = function insertStyleSheet() {
|
46
8
|
var style = document.createElement('style');
|
@@ -53,7 +15,7 @@ export var createModal = function createModal(_ref) {
|
|
53
15
|
var device = _ref.device,
|
54
16
|
url = _ref.url,
|
55
17
|
widthPadding = _ref.widthPadding,
|
56
|
-
|
18
|
+
heightPadding = _ref.heightPadding;
|
57
19
|
return new Promise(function (resolve, reject) {
|
58
20
|
try {
|
59
21
|
var overlay = document.createElement('div');
|
@@ -61,12 +23,12 @@ export var createModal = function createModal(_ref) {
|
|
61
23
|
var modal = document.createElement('div');
|
62
24
|
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
63
25
|
if (device === 'desktop') {
|
64
|
-
modal.style.width = '
|
65
|
-
modal.style.height = '
|
26
|
+
modal.style.width = '600px';
|
27
|
+
modal.style.height = '464px';
|
66
28
|
modal.style.borderRadius = '12px';
|
67
29
|
} else {
|
68
30
|
modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
|
69
|
-
modal.style.height = "
|
31
|
+
modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
|
70
32
|
modal.style.borderRadius = '8px';
|
71
33
|
}
|
72
34
|
var iframe = document.createElement('iframe');
|
@@ -74,16 +36,6 @@ export var createModal = function createModal(_ref) {
|
|
74
36
|
iframe.style.border = 'none';
|
75
37
|
iframe.style.width = '100%';
|
76
38
|
iframe.style.height = '100%';
|
77
|
-
if (loadingConfig && Object.keys(loadingConfig).length) {
|
78
|
-
var _loadingConfig$theme = loadingConfig.theme,
|
79
|
-
theme = _loadingConfig$theme === void 0 ? 'default' : _loadingConfig$theme,
|
80
|
-
_loadingConfig$backgr = loadingConfig.backgroundPrimary,
|
81
|
-
backgroundPrimary = _loadingConfig$backgr === void 0 ? '#ffffff' : _loadingConfig$backgr;
|
82
|
-
var mode = getCurrentTheme(theme);
|
83
|
-
renderPopupLoading(modal, mode);
|
84
|
-
modal.style.backgroundColor = backgroundPrimary;
|
85
|
-
iframe.style.backgroundColor = backgroundPrimary;
|
86
|
-
}
|
87
39
|
modal.appendChild(iframe);
|
88
40
|
var body = document.getElementsByTagName('body')[0];
|
89
41
|
body.appendChild(overlay);
|
@@ -380,7 +380,6 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
|
|
380
380
|
break;
|
381
381
|
case PaypalActionEnum.destroyComponent:
|
382
382
|
this.destroyComponent(context, message);
|
383
|
-
break;
|
384
383
|
default:
|
385
384
|
console.log('Unknown action: ' + message.getAction());
|
386
385
|
}
|
package/esm/plugin/type.d.ts
CHANGED
package/esm/types/index.d.ts
CHANGED
@@ -40,10 +40,6 @@ export interface IcreatePaymentParams {
|
|
40
40
|
backgroundColor?: string;
|
41
41
|
};
|
42
42
|
}
|
43
|
-
export declare enum ComponentSignEnumV2 {
|
44
|
-
'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
|
45
|
-
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
|
46
|
-
}
|
47
43
|
export declare enum componentSignEnum {
|
48
44
|
'EASY_PAY_WALLET' = "EASY_PAY_WALLET",
|
49
45
|
'EASY_PAY_APM' = "EASY_PAY_APM",
|
@@ -54,8 +50,7 @@ export declare enum componentSignEnum {
|
|
54
50
|
'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
|
55
51
|
'NONE' = "NONE",
|
56
52
|
'VAULTING_CARD' = "VAULTING_CARD",
|
57
|
-
'
|
58
|
-
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
|
53
|
+
'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT"
|
59
54
|
}
|
60
55
|
export declare enum productSceneEnum {
|
61
56
|
'EASY_PAY' = "EASY_PAY",
|
@@ -65,15 +60,13 @@ export declare enum productSceneEnum {
|
|
65
60
|
'VAULTING' = "VAULTING",
|
66
61
|
'FLASH_BUY' = "FLASH_BUY",
|
67
62
|
'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
|
68
|
-
'
|
69
|
-
'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS"
|
63
|
+
'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT"
|
70
64
|
}
|
71
65
|
export declare enum paymentMethodCategoryTypeEnum {
|
72
66
|
'CARD' = "CARD",
|
73
67
|
'WALLET' = "WALLET",
|
74
68
|
'BANK' = "BANK",
|
75
|
-
'APM' = "APM"
|
76
|
-
'ALL' = "ALL"
|
69
|
+
'APM' = "APM"
|
77
70
|
}
|
78
71
|
export interface DeviceIdParameter {
|
79
72
|
scene?: string;
|
@@ -126,7 +119,7 @@ export interface Isubmit {
|
|
126
119
|
}
|
127
120
|
export interface IpaymentSessionConfig {
|
128
121
|
productScene: productSceneEnum;
|
129
|
-
paymentMethodCategoryType
|
122
|
+
paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
|
130
123
|
productSceneVersion: string;
|
131
124
|
}
|
132
125
|
export interface IpaymentSecurityConfig {
|