@alipay/ams-checkout 0.0.1720509876-dev.1 → 0.0.1723203704-dev.1

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.
Files changed (43) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/request.js +3 -3
  3. package/esm/constant/index.d.ts +10 -1
  4. package/esm/constant/index.js +9 -0
  5. package/esm/core/component/address.d.ts +34 -0
  6. package/esm/core/component/address.js +298 -0
  7. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  8. package/esm/core/component/appPreloadProcessing.js +89 -0
  9. package/esm/core/component/index.d.ts +1 -1
  10. package/esm/core/component/index.js +39 -14
  11. package/esm/core/instance/address.d.ts +76 -0
  12. package/esm/core/instance/address.js +283 -0
  13. package/esm/index.d.ts +12 -1
  14. package/esm/index.js +57 -19
  15. package/esm/plugin/address/cashierApp.d.ts +34 -0
  16. package/esm/plugin/address/cashierApp.js +218 -0
  17. package/esm/plugin/address/channel.d.ts +20 -0
  18. package/esm/plugin/address/channel.js +52 -0
  19. package/esm/plugin/address/component.inline.style.d.ts +11 -0
  20. package/esm/plugin/address/component.inline.style.js +38 -0
  21. package/esm/plugin/address/component.popup.style.d.ts +16 -0
  22. package/esm/plugin/address/component.popup.style.js +174 -0
  23. package/esm/plugin/address/index.d.ts +108 -0
  24. package/esm/plugin/address/index.js +860 -0
  25. package/esm/plugin/address/popupWindow.style.d.ts +8 -0
  26. package/esm/plugin/address/popupWindow.style.js +65 -0
  27. package/esm/plugin/applepay/component.js +1 -1
  28. package/esm/plugin/component/cashierApp.js +21 -5
  29. package/esm/plugin/component/component.inline.style.d.ts +8 -9
  30. package/esm/plugin/component/component.inline.style.js +87 -6
  31. package/esm/plugin/component/index.js +49 -25
  32. package/esm/plugin/component/popupWindow.style.d.ts +5 -2
  33. package/esm/plugin/component/popupWindow.style.js +55 -7
  34. package/esm/plugin/type.d.ts +1 -0
  35. package/esm/types/address.d.ts +92 -0
  36. package/esm/types/address.js +7 -0
  37. package/esm/types/index.d.ts +13 -3
  38. package/esm/types/index.js +5 -0
  39. package/esm/util/index.d.ts +7 -1
  40. package/esm/util/index.js +67 -1
  41. package/esm/util/upgrade.d.ts +4 -4
  42. package/esm/util/upgrade.js +6 -6
  43. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ export declare const insertStyleSheet: () => void;
2
+ export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
3
+ device: any;
4
+ url: any;
5
+ widthPadding: any;
6
+ heightPadding: any;
7
+ }) => Promise<HTMLIFrameElement>;
8
+ export declare const destroyModal: () => void;
@@ -0,0 +1,65 @@
1
+ import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
2
+
3
+ // CSS样式字符串
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
+
6
+ // 创建和插入样式表
7
+ export var insertStyleSheet = function insertStyleSheet() {
8
+ var style = document.createElement('style');
9
+ style.innerHTML = modalStyles;
10
+ document.head.appendChild(style);
11
+ };
12
+
13
+ // 插入弹窗
14
+ export var createModal = function createModal(_ref) {
15
+ var device = _ref.device,
16
+ url = _ref.url,
17
+ widthPadding = _ref.widthPadding,
18
+ heightPadding = _ref.heightPadding;
19
+ return new Promise(function (resolve, reject) {
20
+ try {
21
+ var overlay = document.createElement('div');
22
+ overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
23
+ var modal = document.createElement('div');
24
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
25
+ if (device === 'desktop') {
26
+ modal.style.width = '600px';
27
+ modal.style.height = '464px';
28
+ modal.style.borderRadius = '12px';
29
+ } else {
30
+ modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
31
+ modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
32
+ modal.style.borderRadius = '8px';
33
+ }
34
+ var iframe = document.createElement('iframe');
35
+ iframe.src = url; // 替换为实际的 URL 地址
36
+ iframe.style.border = 'none';
37
+ iframe.style.width = '100%';
38
+ iframe.style.height = '100%';
39
+ modal.appendChild(iframe);
40
+ var body = document.getElementsByTagName('body')[0];
41
+ body.appendChild(overlay);
42
+ body.appendChild(modal);
43
+ resolve(iframe);
44
+ } catch (error) {
45
+ reject({
46
+ title: 'sdk_error_create_pop_up',
47
+ message: error === null || error === void 0 ? void 0 : error.toString()
48
+ });
49
+ }
50
+ });
51
+ };
52
+
53
+ // 销毁弹窗
54
+ export var destroyModal = function destroyModal() {
55
+ var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
56
+ var modal = document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal"));
57
+ overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
58
+ overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
59
+ modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
60
+ modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
61
+ setTimeout(function () {
62
+ overlay.parentNode.removeChild(overlay);
63
+ modal.parentNode.removeChild(modal);
64
+ }, ANIMATION_TIME);
65
+ };
@@ -84,7 +84,7 @@ var ApplePayComponent = /*#__PURE__*/function () {
84
84
  }, {
85
85
  biz: 'sdk',
86
86
  type: 'funnel',
87
- success: eventCodeEnum.SDK_PAYMENT_FAIL === (state === null || state === void 0 ? void 0 : state.code),
87
+ success: eventCodeEnum.SDK_PAYMENT_SUCCESSFUL === (state === null || state === void 0 ? void 0 : state.code),
88
88
  code: state === null || state === void 0 ? void 0 : state.code,
89
89
  errorCode: state === null || state === void 0 || (_state$result = state.result) === null || _state$result === void 0 ? void 0 : _state$result.errorCode,
90
90
  errorMessage: state === null || state === void 0 || (_state$result2 = state.result) === null || _state$result2 === void 0 ? void 0 : _state$result2.errorMessage,
@@ -15,7 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  * 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
16
16
  * 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.
17
17
  */
18
- import { marmotMap, sdkVersion, elementAppMarmotMap } from "../../config/index";
18
+ import { elementAppMarmotMap, marmotMap, sdkVersion } from "../../config/index";
19
19
  import { componentSignEnum, ComponentSignEnumV2 } from "../../types";
20
20
  import { isDebugLog } from "../../util/debug";
21
21
  import { queryParse, serialize } from "../../util/index";
@@ -45,12 +45,12 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
45
45
 
46
46
  // 没有匹配到版本,查询上次的加载版本
47
47
  if (!appVersion) {
48
- appVersion = getLastAppVersion(productScene);
48
+ appVersion = getLastAppVersion(sdkVersion + productScene);
49
49
  return appVersion;
50
50
  }
51
51
  // 不为空时代表是有sessionData,因此要保存当前版本
52
52
  if (_extendInfo) {
53
- setLastAppVersion(productScene, appVersion);
53
+ setLastAppVersion(sdkVersion + productScene, appVersion);
54
54
  }
55
55
  return appVersion;
56
56
  } catch (error) {
@@ -58,7 +58,8 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
58
58
  }
59
59
  };
60
60
  var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
61
- var signSupportMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.EASY_PAY_APM, ['2.0']), componentSignEnum.VAULTING_CARD, ['1.0']), componentSignEnum.ELEMENT_PAYMENT, ['1.0']);
61
+ var _signSupportMap;
62
+ var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), componentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), componentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), componentSignEnum.EASY_PAY_APM, ['2.0']), componentSignEnum.VAULTING_CARD, ['1.0']), componentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.ELEMENT_ADDRESS, ['1.0']));
62
63
  var supportProductSceneVersion = signSupportMap[componentSign];
63
64
  // 从左到右,从旧到新
64
65
  var isSupport = supportProductSceneVersion.find(function (it) {
@@ -98,7 +99,20 @@ export var getAppPath = function getAppPath() {
98
99
  }
99
100
  // element应用特殊处理
100
101
  if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
101
- return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
102
+ // element又分为express_checkout模式和普通模式, express_checkout 模式在扩展参数是返回expressCheckout=true
103
+ var isExpressCheckout = false;
104
+ try {
105
+ // expressCheckout可能出现string(false) JSON.parse再转一次
106
+ isExpressCheckout = JSON.parse(JSON.parse(extendInfo).expressCheckout);
107
+ } catch (error) {
108
+ // 遇到JSON解析错误,默认false
109
+ }
110
+ if (isExpressCheckout) {
111
+ // express_checkout模式走单独映射
112
+ return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html");
113
+ } else {
114
+ return "".concat(elementAppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
115
+ }
102
116
  }
103
117
  return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
104
118
  };
@@ -199,6 +213,8 @@ export var createIframe = function createIframe(mode, platform) {
199
213
  iframe.style.border = none;
200
214
  iframe.style.opacity = none;
201
215
  iframe.style.overflow = 'hidden';
216
+ // iframe设置支持第三方支付
217
+ iframe.allow = 'payment';
202
218
  return iframe;
203
219
  };
204
220
  export var createPreloadIframe = function createPreloadIframe(channelType, version) {
@@ -1,11 +1,10 @@
1
- /**
2
- * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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
- * 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
- */
8
- import { platformEnum } from '../../types';
1
+ import { componentSignEnum, platformEnum } from '../../types';
2
+ interface Options {
3
+ componentSign?: componentSignEnum;
4
+ type: 'tabs' | 'Accordion';
5
+ isExpressCheckout?: boolean;
6
+ }
9
7
  export declare const inlineComponentAddCss: () => void;
10
- export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void;
8
+ export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum, options: Options) => void;
11
9
  export declare const createInlineBaseElement: (selector: string) => HTMLDivElement;
10
+ export {};
@@ -5,10 +5,11 @@
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 { platformEnum } from "../../types";
9
- import { INLINE_BASE_STYLE_ID, LOADING_ID, INLINE_IMG_CLASSNAME, COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID } from "../../constant";
8
+ import { COMPONENT_CONTAINER_ID, COMPONENT_IFRAME_TAG_ID, INLINE_BASE_STYLE_ID, INLINE_IMG_CLASSNAME, LOADING_ID } from "../../constant";
9
+ import { componentSignEnum, platformEnum } from "../../types";
10
10
  import { amsSetSize } from "../../util";
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");
11
+ // border-radius: 8px;
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");
12
13
  export var inlineComponentAddCss = function inlineComponentAddCss() {
13
14
  var style = document.createElement('style');
14
15
  style.id = 'ams-inline-component-style';
@@ -16,11 +17,91 @@ export var inlineComponentAddCss = function inlineComponentAddCss() {
16
17
  style.innerHTML = inlineComponentCss;
17
18
  document.head.appendChild(style);
18
19
  };
19
- export var addInlineLoading = function addInlineLoading(_selector, platform) {
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) {
20
96
  var loading = document.createElement('div');
21
97
  loading.id = LOADING_ID;
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 ");
98
+ if (options.componentSign === componentSignEnum.ELEMENT_PAYMENT) {
99
+ if (options.isExpressCheckout) {
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 ");
24
105
  if (_selector) _selector.appendChild(loading);
25
106
  var loadingDom = document.getElementById(LOADING_ID);
26
107
  amsSetSize(null, loadingDom);
@@ -24,12 +24,12 @@ 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";
27
28
  import { createIframe, createPreloadIframe, getAppDomain, getIframeUrl } from "./cashierApp";
28
29
  import { getChannelBehavior } from "./channel";
29
30
  import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
30
31
  import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup, slideInAndOutKeyframes } from "./component.popup.style";
31
- import { handlePaymentSessionConfig } from "../payment-element/utils";
32
- import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
32
+ import { createModal, destroyModal, insertStyleSheet, removePopupLoading } from "./popupWindow.style";
33
33
  window.changingPageHeight = window.innerHeight;
34
34
  var ComponentApp = /*#__PURE__*/function () {
35
35
  function ComponentApp() {
@@ -299,7 +299,7 @@ var ComponentApp = /*#__PURE__*/function () {
299
299
  }).send();
300
300
  if (componentSignEnum.EASY_PAY_WALLET === this._componentSign) {
301
301
  if (productScene === productSceneEnum.EASY_PAY && productSceneVersion === '1.0' && !autoDebitWithToken && requireFastSdk) {
302
- // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
302
+ // EASY_PAY 1.0首次支付,requireFastSdk为true,不需要接口请求
303
303
  this.handleAuthUrlInfo(authUrlInfo);
304
304
  return;
305
305
  }
@@ -315,6 +315,18 @@ var ComponentApp = /*#__PURE__*/function () {
315
315
  return;
316
316
  }
317
317
  }
318
+ if (componentSignEnum.AUTO_DEBIT_PAY_WALLET === this._componentSign) {
319
+ if (requireFastSdk === true && productSceneVersion === '1.0') {
320
+ // REDIRECT,requireFastSdk为true,不需要接口请求
321
+ this.handleAuthUrlInfo(authUrlInfo);
322
+ return;
323
+ } else {
324
+ return Promise.reject({
325
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
326
+ message: "Abnormal response data, interface failure, or unsupported payment method."
327
+ });
328
+ }
329
+ }
318
330
  this.dispatchToSDK(EVENT.eventCallback.name, {
319
331
  code: eventCodeEnum.SDK_START_OF_LOADING
320
332
  });
@@ -375,10 +387,22 @@ var ComponentApp = /*#__PURE__*/function () {
375
387
  }, {
376
388
  key: "renderInlineLoading",
377
389
  value: function renderInlineLoading(renderParams, selector) {
378
- var _renderParams$appeara;
390
+ var _renderParams$appeara, _this$_renderParams11;
379
391
  var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
380
392
  showLoading = typeof showLoading === 'boolean' ? showLoading : true;
381
- if (showLoading) addInlineLoading(selector, this.platform);
393
+ var extendInfo = renderParams.paymentSessionMetaData.extendInfo;
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
+ });
382
406
  }
383
407
  }, {
384
408
  key: "renderPopupLoading",
@@ -420,7 +444,6 @@ var ComponentApp = /*#__PURE__*/function () {
420
444
  key: 'sdk_action_query_start',
421
445
  value: Date.now()
422
446
  });
423
-
424
447
  // eslint-disable-next-line no-async-promise-executor
425
448
  this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
426
449
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
@@ -641,19 +664,19 @@ var ComponentApp = /*#__PURE__*/function () {
641
664
  }, {
642
665
  key: "createSubmitPromise",
643
666
  value: function createSubmitPromise() {
644
- var _this$_renderParams11,
645
- _this$_renderParams12,
667
+ var _this$_renderParams12,
646
668
  _this$_renderParams13,
669
+ _this$_renderParams14,
647
670
  _this6 = this;
648
671
  this._performanceData.push({
649
672
  key: 'sdk_submit_start',
650
673
  value: Date.now()
651
674
  });
652
675
  var params = {
653
- paymentSessionData: this._renderParams && ((_this$_renderParams11 = this._renderParams) === null || _this$_renderParams11 === void 0 ? void 0 : _this$_renderParams11.sessionData) || '',
654
- paymentSessionConfig: (_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 || (_this$_renderParams12 = _this$_renderParams12.paymentSessionMetaData) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.paymentSessionConfig
676
+ paymentSessionData: this._renderParams && ((_this$_renderParams12 = this._renderParams) === null || _this$_renderParams12 === void 0 ? void 0 : _this$_renderParams12.sessionData) || '',
677
+ paymentSessionConfig: (_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 || (_this$_renderParams13 = _this$_renderParams13.paymentSessionMetaData) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionConfig
655
678
  };
656
- var channelBehavior = getChannelBehavior((_this$_renderParams13 = this._renderParams) === null || _this$_renderParams13 === void 0 ? void 0 : _this$_renderParams13.paymentSessionMetaData);
679
+ var channelBehavior = getChannelBehavior((_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData);
657
680
  // eslint-disable-next-line no-async-promise-executor
658
681
  this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
659
682
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
@@ -922,7 +945,7 @@ var ComponentApp = /*#__PURE__*/function () {
922
945
  key: "createDialog",
923
946
  value: function () {
924
947
  var _createDialog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
925
- var pageUrl, isLoad, timeout, logTimeout;
948
+ var pageUrl, _data$device, isLoad, timeout, logTimeout;
926
949
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
927
950
  while (1) switch (_context4.prev = _context4.next) {
928
951
  case 0:
@@ -932,8 +955,8 @@ var ComponentApp = /*#__PURE__*/function () {
932
955
  _context4.next = 5;
933
956
  return createModal({
934
957
  widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
935
- heightPadding: data === null || data === void 0 ? void 0 : data.heightPadding,
936
- device: this.platform,
958
+ device: (_data$device = data === null || data === void 0 ? void 0 : data.device) !== null && _data$device !== void 0 ? _data$device : this.platform,
959
+ loadingConfig: data === null || data === void 0 ? void 0 : data.loadingConfig,
937
960
  url: pageUrl
938
961
  });
939
962
  case 5:
@@ -952,6 +975,7 @@ var ComponentApp = /*#__PURE__*/function () {
952
975
  }, POPUP_LOADTIME_LOG_LIMIT);
953
976
  this.popupApp.onload = function () {
954
977
  isLoad = true;
978
+ removePopupLoading();
955
979
  clearTimeout(timeout);
956
980
  clearTimeout(logTimeout);
957
981
  };
@@ -1517,7 +1541,7 @@ var ComponentApp = /*#__PURE__*/function () {
1517
1541
  key: "sendRenderEvent",
1518
1542
  value: (function () {
1519
1543
  var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1520
- var _this$_renderParams14, _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$AMSSDK$logger, _this$_renderParams20, _this$_renderParams21, _this$_renderParams22, _this$AMSSDK, _this$_renderParams23, res, submitRes;
1544
+ var _this$_renderParams15, _this$_renderParams16, _this$_renderParams17, _this$_renderParams18, _this$_renderParams19, _this$_renderParams20, _this$AMSSDK$logger, _this$_renderParams21, _this$_renderParams22, _this$_renderParams23, _this$AMSSDK, _this$_renderParams24, res, submitRes;
1521
1545
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1522
1546
  while (1) switch (_context8.prev = _context8.next) {
1523
1547
  case 0:
@@ -1546,12 +1570,12 @@ var ComponentApp = /*#__PURE__*/function () {
1546
1570
  data: {
1547
1571
  queryResult: res,
1548
1572
  submitResult: submitRes,
1549
- sessionResult: (_this$_renderParams14 = this._renderParams) === null || _this$_renderParams14 === void 0 ? void 0 : _this$_renderParams14.paymentSessionMetaData,
1550
- paymentSessionData: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.sessionData,
1573
+ sessionResult: (_this$_renderParams15 = this._renderParams) === null || _this$_renderParams15 === void 0 ? void 0 : _this$_renderParams15.paymentSessionMetaData,
1574
+ paymentSessionData: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.sessionData,
1551
1575
  heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
1552
- renderDisplayType: (_this$_renderParams16 = this._renderParams) === null || _this$_renderParams16 === void 0 ? void 0 : _this$_renderParams16.renderDisplayType,
1553
- appearance: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.appearance,
1554
- notRedirectAfterComplete: ((_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.notRedirectAfterComplete) === true,
1576
+ renderDisplayType: (_this$_renderParams17 = this._renderParams) === null || _this$_renderParams17 === void 0 ? void 0 : _this$_renderParams17.renderDisplayType,
1577
+ appearance: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.appearance,
1578
+ notRedirectAfterComplete: ((_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.notRedirectAfterComplete) === true,
1555
1579
  merchantAppointParam: this._merchantAppointParam,
1556
1580
  allowSubmitPayCallAhead: this._allowSubmitPayCallAhead,
1557
1581
  envInfo: {
@@ -1559,16 +1583,16 @@ var ComponentApp = /*#__PURE__*/function () {
1559
1583
  screenWidth: screen.width
1560
1584
  },
1561
1585
  logMetaData: _objectSpread(_objectSpread({
1562
- trackId: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.sessionData,
1586
+ trackId: (_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.sessionData,
1563
1587
  platform: this.platform,
1564
1588
  firstLogTime: (_this$AMSSDK$logger = this.AMSSDK.logger) === null || _this$AMSSDK$logger === void 0 ? void 0 : _this$AMSSDK$logger.getComponentStartTime()
1565
- }, ((_this$_renderParams20 = this._renderParams) === null || _this$_renderParams20 === void 0 || (_this$_renderParams20 = _this$_renderParams20.paymentSessionMetaData) === null || _this$_renderParams20 === void 0 ? void 0 : _this$_renderParams20.paymentSessionConfig) || {}), {}, {
1566
- renderDisplayType: (_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.renderDisplayType,
1589
+ }, ((_this$_renderParams21 = this._renderParams) === null || _this$_renderParams21 === void 0 || (_this$_renderParams21 = _this$_renderParams21.paymentSessionMetaData) === null || _this$_renderParams21 === void 0 ? void 0 : _this$_renderParams21.paymentSessionConfig) || {}), {}, {
1590
+ renderDisplayType: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.renderDisplayType,
1567
1591
  sdkVersion: this._appVersion,
1568
- merchantId: (_this$_renderParams22 = this._renderParams) === null || _this$_renderParams22 === void 0 || (_this$_renderParams22 = _this$_renderParams22.paymentSessionMetaData) === null || _this$_renderParams22 === void 0 ? void 0 : _this$_renderParams22.clientId,
1592
+ merchantId: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.clientId,
1569
1593
  instanceId: (_this$AMSSDK = this.AMSSDK) === null || _this$AMSSDK === void 0 ? void 0 : _this$AMSSDK._instanceId,
1570
1594
  performanceData: this._performanceData,
1571
- paymentMethodType: (_this$_renderParams23 = this._renderParams) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentSessionMetaData) === null || _this$_renderParams23 === void 0 || (_this$_renderParams23 = _this$_renderParams23.paymentMethodInfoView) === null || _this$_renderParams23 === void 0 ? void 0 : _this$_renderParams23.paymentMethodType
1595
+ paymentMethodType: (_this$_renderParams24 = this._renderParams) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentSessionMetaData) === null || _this$_renderParams24 === void 0 || (_this$_renderParams24 = _this$_renderParams24.paymentMethodInfoView) === null || _this$_renderParams24 === void 0 ? void 0 : _this$_renderParams24.paymentMethodType
1572
1596
  })
1573
1597
  }
1574
1598
  }
@@ -1,8 +1,11 @@
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;
1
4
  export declare const insertStyleSheet: () => void;
2
- export declare const createModal: ({ device, url, widthPadding, heightPadding }: {
5
+ export declare const createModal: ({ device, url, widthPadding, loadingConfig }: {
3
6
  device: any;
4
7
  url: any;
5
8
  widthPadding: any;
6
- heightPadding: any;
9
+ loadingConfig: any;
7
10
  }) => Promise<HTMLIFrameElement>;
8
11
  export declare const destroyModal: () => void;
@@ -1,8 +1,46 @@
1
- import { AMSPOPUP_PREFIX, ANIMATION_TIME } from "../../constant";
1
+ import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../../constant";
2
+ import { getDesignFontSize } from "../../util";
2
3
 
3
4
  // CSS样式字符串
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
-
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\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\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-popup-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-popup-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-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-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-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-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");
6
+ var getCurrentTheme = function getCurrentTheme() {
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
+ };
6
44
  // 创建和插入样式表
7
45
  export var insertStyleSheet = function insertStyleSheet() {
8
46
  var style = document.createElement('style');
@@ -15,7 +53,7 @@ export var createModal = function createModal(_ref) {
15
53
  var device = _ref.device,
16
54
  url = _ref.url,
17
55
  widthPadding = _ref.widthPadding,
18
- heightPadding = _ref.heightPadding;
56
+ loadingConfig = _ref.loadingConfig;
19
57
  return new Promise(function (resolve, reject) {
20
58
  try {
21
59
  var overlay = document.createElement('div');
@@ -23,12 +61,12 @@ export var createModal = function createModal(_ref) {
23
61
  var modal = document.createElement('div');
24
62
  modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
25
63
  if (device === 'desktop') {
26
- modal.style.width = '600px';
27
- modal.style.height = '464px';
64
+ modal.style.width = '656px';
65
+ modal.style.height = '620px';
28
66
  modal.style.borderRadius = '12px';
29
67
  } else {
30
68
  modal.style.width = "calc(100% - ".concat(2 * widthPadding, "px)");
31
- modal.style.height = "calc(100% - ".concat(2 * heightPadding, "px)");
69
+ modal.style.height = "80vh";
32
70
  modal.style.borderRadius = '8px';
33
71
  }
34
72
  var iframe = document.createElement('iframe');
@@ -36,6 +74,16 @@ export var createModal = function createModal(_ref) {
36
74
  iframe.style.border = 'none';
37
75
  iframe.style.width = '100%';
38
76
  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
+ }
39
87
  modal.appendChild(iframe);
40
88
  var body = document.getElementsByTagName('body')[0];
41
89
  body.appendChild(overlay);
@@ -8,6 +8,7 @@ export interface ComponentActionNamesType {
8
8
  mountComponent?: string;
9
9
  submit?: string;
10
10
  destroyComponent?: string;
11
+ getValue?: string;
11
12
  }
12
13
  export type IExtendPluginItem = {
13
14
  /**