@alipay/ams-checkout 0.0.1726734012-dev.1 → 0.0.1726734012-dev.11
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/component/channel.d.ts +19 -0
- package/esm/component/channel.js +87 -0
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/component/component.inline.style.js +121 -0
- package/esm/component/component.popup.style.d.ts +25 -0
- package/esm/component/component.popup.style.js +203 -0
- package/esm/component/popupWindow.style.d.ts +11 -0
- package/esm/component/popupWindow.style.js +121 -0
- package/esm/config/index.d.ts +11 -0
- package/esm/config/index.js +20 -1
- package/esm/constant/index.d.ts +25 -0
- package/esm/constant/index.js +28 -0
- package/esm/core/bus/index.d.ts +3 -3
- package/esm/core/bus/index.js +14 -14
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.js +2 -2
- package/esm/core/component/ckp/index.js +12 -8
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +817 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +191 -0
- package/esm/core/component/element/type.js +36 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +14 -7
- package/esm/core/component/index.js +136 -78
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +2 -1
- package/esm/core/instance/index.js +27 -12
- package/esm/foundation/core/index.d.ts +28 -0
- package/esm/foundation/core/index.js +396 -0
- package/esm/foundation/index.d.ts +75 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +18 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +12 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +464 -0
- package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/callback.js +55 -0
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/request.js +151 -0
- package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/api-bus/ability/security.js +161 -0
- package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/api-bus/busManager.js +398 -0
- package/esm/foundation/service/api-bus/index.d.ts +20 -0
- package/esm/foundation/service/api-bus/index.js +88 -0
- package/esm/foundation/service/api-bus/interface.d.ts +48 -0
- package/esm/foundation/service/api-bus/interface.js +54 -0
- package/esm/foundation/service/container/index.d.ts +32 -0
- package/esm/foundation/service/container/index.js +332 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/foundation/service/container/popup.js +103 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-center.d.ts +82 -0
- package/esm/foundation/service/event-center.js +274 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +68 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +250 -0
- package/esm/foundation/service/log/keys.d.ts +13 -0
- package/esm/foundation/service/log/keys.js +103 -0
- package/esm/foundation/service/log/processor.d.ts +9 -0
- package/esm/foundation/service/log/processor.js +148 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/log/types.js +1 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +217 -0
- package/esm/foundation/service/security/index.d.ts +28 -0
- package/esm/foundation/service/security/index.js +284 -0
- package/esm/foundation/service/security/security.d.ts +33 -0
- package/esm/foundation/service/security/security.js +182 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.js +38 -0
- package/esm/foundation/utils/redirect_utils.d.ts +11 -0
- package/esm/foundation/utils/redirect_utils.js +262 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +66 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
- package/esm/foundation/utils/web_app_url_utils.js +112 -0
- package/esm/index.d.ts +21 -12
- package/esm/index.js +116 -56
- package/esm/plugin/applepay/component.js +13 -11
- package/esm/plugin/applepay/index.js +10 -6
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +26 -18
- package/esm/plugin/component/cashierApp.d.ts +10 -8
- package/esm/plugin/component/cashierApp.js +48 -11
- package/esm/plugin/component/channel.d.ts +4 -3
- package/esm/plugin/component/channel.js +39 -2
- package/esm/plugin/component/component.inline.style.d.ts +9 -10
- package/esm/plugin/component/component.inline.style.js +93 -10
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +30 -7
- package/esm/plugin/component/index.d.ts +14 -8
- package/esm/plugin/component/index.js +384 -187
- package/esm/plugin/component/popupWindow.style.d.ts +5 -2
- package/esm/plugin/component/popupWindow.style.js +70 -14
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.js +2 -1
- package/esm/plugin/type.d.ts +4 -3
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +6 -2
- package/esm/types/index.d.ts +339 -40
- package/esm/types/index.js +119 -55
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +133 -0
- package/esm/util/index.js +4 -8
- package/esm/util/logger.d.ts +3 -3
- package/esm/util/logger.js +49 -13
- package/esm/util/security.d.ts +3 -2
- package/esm/util/security.js +2 -2
- package/esm/util/spm-map.d.ts +172 -0
- package/esm/util/spm-map.js +172 -0
- package/package.json +3 -1
@@ -0,0 +1,121 @@
|
|
1
|
+
import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../constant";
|
2
|
+
import { getDesignFontSize } from "../util";
|
3
|
+
|
4
|
+
// 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 .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\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 .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n \n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\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
|
+
};
|
44
|
+
// 创建和插入样式表
|
45
|
+
export var insertStyleSheet = function insertStyleSheet() {
|
46
|
+
var style = document.createElement('style');
|
47
|
+
style.innerHTML = modalStyles;
|
48
|
+
document.head.appendChild(style);
|
49
|
+
};
|
50
|
+
var modalDevice = 'desktop';
|
51
|
+
// 插入弹窗
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
53
|
+
export var createModal = function createModal(_ref) {
|
54
|
+
var device = _ref.device,
|
55
|
+
url = _ref.url,
|
56
|
+
widthPadding = _ref.widthPadding,
|
57
|
+
loadingConfig = _ref.loadingConfig;
|
58
|
+
return new Promise(function (resolve, reject) {
|
59
|
+
try {
|
60
|
+
modalDevice = device;
|
61
|
+
var overlay = document.createElement('div');
|
62
|
+
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "overlay"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
63
|
+
var modal = document.createElement('div');
|
64
|
+
if (device === 'desktop') {
|
65
|
+
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal"), "".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
66
|
+
modal.style.width = '656px';
|
67
|
+
modal.style.height = '620px';
|
68
|
+
modal.style.borderRadius = '12px';
|
69
|
+
} else {
|
70
|
+
modal.classList.add("".concat(AMSPOPUP_PREFIX, "modal-mobile"), "".concat(AMSPOPUP_PREFIX, "-drawer-enter"));
|
71
|
+
modal.style.width = '100%';
|
72
|
+
modal.style.height = '80vh';
|
73
|
+
modal.style.borderRadius = '12px 12px 0 0';
|
74
|
+
}
|
75
|
+
var iframe = document.createElement('iframe');
|
76
|
+
iframe.src = url; // 替换为实际的 URL 地址
|
77
|
+
iframe.style.border = 'none';
|
78
|
+
iframe.style.width = '100%';
|
79
|
+
iframe.style.height = '100%';
|
80
|
+
if (loadingConfig && Object.keys(loadingConfig).length) {
|
81
|
+
var _loadingConfig$theme = loadingConfig.theme,
|
82
|
+
theme = _loadingConfig$theme === void 0 ? 'default' : _loadingConfig$theme,
|
83
|
+
_loadingConfig$backgr = loadingConfig.backgroundPrimary,
|
84
|
+
backgroundPrimary = _loadingConfig$backgr === void 0 ? '#ffffff' : _loadingConfig$backgr;
|
85
|
+
var mode = getCurrentTheme(theme);
|
86
|
+
renderPopupLoading(modal, mode);
|
87
|
+
modal.style.backgroundColor = backgroundPrimary;
|
88
|
+
iframe.style.backgroundColor = backgroundPrimary;
|
89
|
+
}
|
90
|
+
modal.appendChild(iframe);
|
91
|
+
var body = document.getElementsByTagName('body')[0];
|
92
|
+
body.appendChild(overlay);
|
93
|
+
body.appendChild(modal);
|
94
|
+
resolve(iframe);
|
95
|
+
} catch (error) {
|
96
|
+
reject({
|
97
|
+
title: 'sdk_error_create_pop_up',
|
98
|
+
message: error === null || error === void 0 ? void 0 : error.toString()
|
99
|
+
});
|
100
|
+
}
|
101
|
+
});
|
102
|
+
};
|
103
|
+
|
104
|
+
// 销毁弹窗
|
105
|
+
export var destroyModal = function destroyModal() {
|
106
|
+
var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
|
107
|
+
var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile"));
|
108
|
+
overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
109
|
+
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
|
110
|
+
if (modalDevice === 'desktop') {
|
111
|
+
modal.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
112
|
+
modal.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
|
113
|
+
} else {
|
114
|
+
modal.classList.remove("".concat(AMSPOPUP_PREFIX, "-drawer-enter"));
|
115
|
+
modal.classList.add("".concat(AMSPOPUP_PREFIX, "-drawer-exit"));
|
116
|
+
}
|
117
|
+
setTimeout(function () {
|
118
|
+
overlay.parentNode.removeChild(overlay);
|
119
|
+
modal.parentNode.removeChild(modal);
|
120
|
+
}, ANIMATION_TIME);
|
121
|
+
};
|
package/esm/config/index.d.ts
CHANGED
@@ -1,3 +1,14 @@
|
|
1
1
|
export declare const marmotMap: Record<string, string>;
|
2
2
|
export declare const marmotConfigMap: Record<string, string>;
|
3
|
+
export declare const elementAppMarmotMap: Record<string, string>;
|
3
4
|
export declare const sdkVersion: string;
|
5
|
+
/**
|
6
|
+
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
|
+
*/
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.27.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.27.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.27.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.27.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.27.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.27.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.27.0";
|
package/esm/config/index.js
CHANGED
@@ -22,4 +22,23 @@ export var marmotConfigMap = {
|
|
22
22
|
light_sandbox: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
|
23
23
|
prod: 'https://config.marmot-cloud.com/config/data/antom-sdk-config/en_US.json'
|
24
24
|
};
|
25
|
-
export var
|
25
|
+
export var elementAppMarmotMap = {
|
26
|
+
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
|
+
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
|
+
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
29
|
+
sandbox: 'https://checkout.antom.com',
|
30
|
+
light_sandbox: 'https://checkout.antom.com',
|
31
|
+
prod: 'https://checkout.antom.com'
|
32
|
+
};
|
33
|
+
export var sdkVersion = json.version;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
|
+
*/
|
38
|
+
export var AMSCheckoutAppVersion = '1.27.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.27.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.27.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.27.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.27.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.27.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.27.0'; // address element
|
package/esm/constant/index.d.ts
CHANGED
@@ -112,6 +112,10 @@ export declare const EVENT: {
|
|
112
112
|
name: string;
|
113
113
|
uniqueKey: string;
|
114
114
|
};
|
115
|
+
closeCallback: {
|
116
|
+
name: string;
|
117
|
+
uniqueKey: string;
|
118
|
+
};
|
115
119
|
eventCallback: {
|
116
120
|
name: string;
|
117
121
|
uniqueKey: string;
|
@@ -125,6 +129,9 @@ export declare const EVENT: {
|
|
125
129
|
showCloseButton: {
|
126
130
|
name: string;
|
127
131
|
};
|
132
|
+
setMaskCloseButton: {
|
133
|
+
name: string;
|
134
|
+
};
|
128
135
|
setAllowRetention: {
|
129
136
|
name: string;
|
130
137
|
};
|
@@ -161,6 +168,12 @@ export declare const EVENT: {
|
|
161
168
|
receiveMuitiAppFromSdk: {
|
162
169
|
name: string;
|
163
170
|
};
|
171
|
+
sendBroadcast: {
|
172
|
+
name: string;
|
173
|
+
};
|
174
|
+
receiveBroadcast: {
|
175
|
+
name: string;
|
176
|
+
};
|
164
177
|
getUserAgentFromSdk: {
|
165
178
|
name: string;
|
166
179
|
};
|
@@ -175,14 +188,26 @@ export declare const EVENT: {
|
|
175
188
|
name: string;
|
176
189
|
uniqueKey: string;
|
177
190
|
};
|
191
|
+
onChange: {
|
192
|
+
name: string;
|
193
|
+
uniqueKey: string;
|
194
|
+
};
|
195
|
+
getGooglePayToken: {
|
196
|
+
name: string;
|
197
|
+
};
|
198
|
+
initSecuritySDK: {
|
199
|
+
name: string;
|
200
|
+
};
|
178
201
|
};
|
179
202
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
180
203
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
181
204
|
export declare const COMPONENT_IFRAME_TAG_ID = "ams-checkout-component";
|
182
205
|
export declare const COMPONENT_CLOSE_BLOCK_ID = "asm-component-close-block";
|
206
|
+
export declare const COMPONENT_CLOSE_MASK_BLOCK_ID = "ams-component-mask-close-block";
|
183
207
|
export declare const COMPONENT_RETENTION_ID = "ams-component-retention";
|
184
208
|
export declare const MOCKUP_ID = "ams-component-mockup";
|
185
209
|
export declare const LOADING_ID = "ams-component-loading";
|
210
|
+
export declare const POPUPLOADING_ID = "ams-component-popup-loading";
|
186
211
|
export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
|
187
212
|
export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
|
188
213
|
export declare const INLINE_IMG_CLASSNAME = "inline-loading";
|
package/esm/constant/index.js
CHANGED
@@ -112,6 +112,11 @@ export var EVENT = {
|
|
112
112
|
name: 'onClose',
|
113
113
|
uniqueKey: 'userOnClose'
|
114
114
|
},
|
115
|
+
// 标记 SDK 回调事件
|
116
|
+
closeCallback: {
|
117
|
+
name: 'onCloseCallback',
|
118
|
+
uniqueKey: 'closeCallback'
|
119
|
+
},
|
115
120
|
eventCallback: {
|
116
121
|
name: 'onEventCallback',
|
117
122
|
uniqueKey: 'userEventCallback'
|
@@ -125,6 +130,9 @@ export var EVENT = {
|
|
125
130
|
showCloseButton: {
|
126
131
|
name: 'showCloseButton'
|
127
132
|
},
|
133
|
+
setMaskCloseButton: {
|
134
|
+
name: 'setMaskCloseButton'
|
135
|
+
},
|
128
136
|
setAllowRetention: {
|
129
137
|
name: 'setAllowRetention'
|
130
138
|
},
|
@@ -155,12 +163,20 @@ export var EVENT = {
|
|
155
163
|
getGlobalData: {
|
156
164
|
name: 'getGlobalData'
|
157
165
|
},
|
166
|
+
// deprecated
|
158
167
|
sendMuitiAppEventToSdk: {
|
159
168
|
name: 'sendMuitiAppEventToSdk'
|
160
169
|
},
|
170
|
+
// deprecated
|
161
171
|
receiveMuitiAppFromSdk: {
|
162
172
|
name: 'receiveMuitiAppFromSdk'
|
163
173
|
},
|
174
|
+
sendBroadcast: {
|
175
|
+
name: 'sendBroadcast'
|
176
|
+
},
|
177
|
+
receiveBroadcast: {
|
178
|
+
name: 'receiveBroadcast'
|
179
|
+
},
|
164
180
|
getUserAgentFromSdk: {
|
165
181
|
name: 'getUserAgentFromSdk'
|
166
182
|
},
|
@@ -174,15 +190,27 @@ export var EVENT = {
|
|
174
190
|
beforeSubmitDone: {
|
175
191
|
name: 'beforeSubmitDone',
|
176
192
|
uniqueKey: 'userBeforeSubmitDone'
|
193
|
+
},
|
194
|
+
onChange: {
|
195
|
+
name: 'onChange',
|
196
|
+
uniqueKey: 'userChange'
|
197
|
+
},
|
198
|
+
getGooglePayToken: {
|
199
|
+
name: 'getGooglePayToken'
|
200
|
+
},
|
201
|
+
initSecuritySDK: {
|
202
|
+
name: 'initSecuritySDK'
|
177
203
|
}
|
178
204
|
};
|
179
205
|
export var COMPONENT_CONTAINER_ID = 'ams-component-container';
|
180
206
|
export var COMPONENT_SECTION_ID = 'ams-component-section';
|
181
207
|
export var COMPONENT_IFRAME_TAG_ID = 'ams-checkout-component';
|
182
208
|
export var COMPONENT_CLOSE_BLOCK_ID = 'asm-component-close-block';
|
209
|
+
export var COMPONENT_CLOSE_MASK_BLOCK_ID = 'ams-component-mask-close-block';
|
183
210
|
export var COMPONENT_RETENTION_ID = 'ams-component-retention';
|
184
211
|
export var MOCKUP_ID = 'ams-component-mockup';
|
185
212
|
export var LOADING_ID = 'ams-component-loading';
|
213
|
+
export var POPUPLOADING_ID = 'ams-component-popup-loading'; // popup弹窗loading
|
186
214
|
export var LISTENER_PREFIX = '_ams_sdk_component_listener';
|
187
215
|
export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
|
188
216
|
export var INLINE_IMG_CLASSNAME = 'inline-loading';
|
package/esm/core/bus/index.d.ts
CHANGED
@@ -16,17 +16,17 @@ export declare enum BusLogEventEnum {
|
|
16
16
|
/**
|
17
17
|
* 查询是否订阅
|
18
18
|
* action:string
|
19
|
-
* sub: bool
|
19
|
+
* sub (processResult): bool
|
20
20
|
*/
|
21
21
|
sdk_event_busIsSubscribe = "sdk_event_busIsSubscribe",
|
22
22
|
/**
|
23
23
|
* 订阅协议
|
24
|
-
* actions: string[] , 用逗号拼接
|
24
|
+
* actions (actionNames): string[] , 用逗号拼接
|
25
25
|
*/
|
26
26
|
sdk_event_busSubscribe = "sdk_event_busSubscribe",
|
27
27
|
/**
|
28
28
|
* 退订协议
|
29
|
-
* actions: string[] , 用逗号拼接
|
29
|
+
* actions (actionNames): string[] , 用逗号拼接
|
30
30
|
*/
|
31
31
|
sdk_event_busUnsubscribe = "sdk_event_busUnsubscribe",
|
32
32
|
/**
|
package/esm/core/bus/index.js
CHANGED
@@ -140,7 +140,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
140
140
|
this.logger.logInfo({
|
141
141
|
title: title
|
142
142
|
}, _objectSpread({
|
143
|
-
|
143
|
+
eventSource: 'sdk'
|
144
144
|
}, optionalParams)).send();
|
145
145
|
}
|
146
146
|
}
|
@@ -154,7 +154,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
154
154
|
this.logger.logError({
|
155
155
|
title: title
|
156
156
|
}, _objectSpread({
|
157
|
-
|
157
|
+
eventSource: 'sdk'
|
158
158
|
}, optionalParams)).send();
|
159
159
|
}
|
160
160
|
}
|
@@ -187,7 +187,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
187
187
|
setTimeout(function () {
|
188
188
|
if (failed) {
|
189
189
|
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishNoResult, {
|
190
|
-
|
190
|
+
actionName: message.getAction()
|
191
191
|
});
|
192
192
|
if ((config === null || config === void 0 ? void 0 : config.fallback) !== null) {
|
193
193
|
resolve(message.result(config === null || config === void 0 ? void 0 : config.fallback));
|
@@ -203,7 +203,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
203
203
|
value: function publish(message, callback) {
|
204
204
|
var _callBack = function _callBack(result) {
|
205
205
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishCallback, {
|
206
|
-
|
206
|
+
actionName: message.getAction()
|
207
207
|
});
|
208
208
|
if (callback) {
|
209
209
|
callback(result);
|
@@ -213,7 +213,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
213
213
|
var actionName = message.getAction();
|
214
214
|
var subscribers = BusManager.subscribersMap.get(actionName);
|
215
215
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busPublishMessage, {
|
216
|
-
|
216
|
+
actionName: message.getAction()
|
217
217
|
});
|
218
218
|
if (subscribers) {
|
219
219
|
var _iterator = _createForOfIteratorHelper(subscribers),
|
@@ -225,8 +225,8 @@ export var BusManager = /*#__PURE__*/function () {
|
|
225
225
|
subscriber.onMessage(context, message);
|
226
226
|
} catch (e) {
|
227
227
|
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishError, {
|
228
|
-
|
229
|
-
|
228
|
+
actionName: message.getAction(),
|
229
|
+
errorMessage: e
|
230
230
|
});
|
231
231
|
var _iterator2 = _createForOfIteratorHelper(BusManager.interceptors),
|
232
232
|
_step2;
|
@@ -266,7 +266,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
266
266
|
BusManager.publish(message, callback); // Re-publish the message
|
267
267
|
} else {
|
268
268
|
BusManager.traceError(BusLogEventEnum.sdk_error_busPublishUnsubscribeError, {
|
269
|
-
|
269
|
+
actionName: message.getAction()
|
270
270
|
});
|
271
271
|
}
|
272
272
|
}
|
@@ -275,7 +275,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
275
275
|
key: "subscribe",
|
276
276
|
value: function subscribe(subscriber) {
|
277
277
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busSubscribe, {
|
278
|
-
|
278
|
+
actionNames: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
|
279
279
|
});
|
280
280
|
var _iterator4 = _createForOfIteratorHelper(subscriber.actionNames()),
|
281
281
|
_step4;
|
@@ -300,7 +300,7 @@ export var BusManager = /*#__PURE__*/function () {
|
|
300
300
|
key: "unsubscribe",
|
301
301
|
value: function unsubscribe(subscriber) {
|
302
302
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busUnsubscribe, {
|
303
|
-
|
303
|
+
actionNames: subscriber === null || subscriber === void 0 ? void 0 : subscriber.actionNames()
|
304
304
|
});
|
305
305
|
var _iterator5 = _createForOfIteratorHelper(subscriber.actionNames()),
|
306
306
|
_step5;
|
@@ -327,8 +327,8 @@ export var BusManager = /*#__PURE__*/function () {
|
|
327
327
|
var subscribers = BusManager.subscribersMap.get(actionName);
|
328
328
|
if (subscribers && subscribers.length > 0) {
|
329
329
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
330
|
-
|
331
|
-
|
330
|
+
actionName: actionName,
|
331
|
+
processResult: true
|
332
332
|
});
|
333
333
|
return true;
|
334
334
|
}
|
@@ -350,8 +350,8 @@ export var BusManager = /*#__PURE__*/function () {
|
|
350
350
|
return BusManager.subscribersMap.has(actionName);
|
351
351
|
}
|
352
352
|
BusManager.traceLog(BusLogEventEnum.sdk_event_busIsSubscribe, {
|
353
|
-
|
354
|
-
|
353
|
+
actionName: actionName,
|
354
|
+
processResult: false
|
355
355
|
});
|
356
356
|
return false;
|
357
357
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { IoptionsParams } from '../../types';
|
2
|
+
import { AMSComponent } from './index';
|
3
|
+
export declare class AddressComponent extends AMSComponent {
|
4
|
+
constructor(options: IoptionsParams & {
|
5
|
+
appVersion: string;
|
6
|
+
});
|
7
|
+
getValue(hasValidate?: boolean): Promise<unknown>;
|
8
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
8
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
9
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
10
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
11
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
13
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
14
|
+
/**
|
15
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
16
|
+
*
|
17
|
+
* 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:
|
18
|
+
* 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
|
19
|
+
* 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.
|
20
|
+
*/
|
21
|
+
import { v4 as uuid } from 'uuid';
|
22
|
+
import { BusManager, BusMessage } from "../bus";
|
23
|
+
import { AMSComponent } from "./index";
|
24
|
+
export var AddressComponent = /*#__PURE__*/function (_AMSComponent) {
|
25
|
+
_inherits(AddressComponent, _AMSComponent);
|
26
|
+
var _super = _createSuper(AddressComponent);
|
27
|
+
function AddressComponent(options) {
|
28
|
+
_classCallCheck(this, AddressComponent);
|
29
|
+
return _super.call(this, options);
|
30
|
+
}
|
31
|
+
_createClass(AddressComponent, [{
|
32
|
+
key: "getValue",
|
33
|
+
value: function getValue(hasValidate) {
|
34
|
+
var _this = this;
|
35
|
+
return new Promise(function (resolve, reject) {
|
36
|
+
try {
|
37
|
+
var _this$getBusActionNam;
|
38
|
+
var eventCallbackId = uuid();
|
39
|
+
_this.logger.logInfo({
|
40
|
+
title: 'sdk_event_apiGetValue'
|
41
|
+
});
|
42
|
+
var actionName = (_this$getBusActionNam = _this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.getValue;
|
43
|
+
if (actionName && BusManager.isSubscribed(actionName)) {
|
44
|
+
// 执行出错了,在通用拦截器返回
|
45
|
+
BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
|
46
|
+
appendParams: _this._appendParams,
|
47
|
+
options: _this.originOptions,
|
48
|
+
data: hasValidate
|
49
|
+
}))).then(function (busMessage) {
|
50
|
+
resolve(busMessage === null || busMessage === void 0 ? void 0 : busMessage.getJSONObject());
|
51
|
+
});
|
52
|
+
} else {
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
54
|
+
_this._eventCenter.once(eventCallbackId, function (_data) {
|
55
|
+
resolve(_data);
|
56
|
+
});
|
57
|
+
_this._componentApp.dispatchToApp({
|
58
|
+
context: {
|
59
|
+
event: 'getValue',
|
60
|
+
eventCallbackId: eventCallbackId,
|
61
|
+
data: hasValidate
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
} catch (error) {
|
66
|
+
reject(error);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}]);
|
71
|
+
return AddressComponent;
|
72
|
+
}(AMSComponent);
|
@@ -39,8 +39,8 @@ function _loadChannelPneumaticControl() {
|
|
39
39
|
logger.logInfo({
|
40
40
|
title: 'load_channel_sdk_start'
|
41
41
|
}, {
|
42
|
-
|
43
|
-
|
42
|
+
eventMessage: JSON.stringify(frontModulesToBeLoaded),
|
43
|
+
requestId: paymentRequestId
|
44
44
|
});
|
45
45
|
frontModulesToBeLoaded.forEach(function (loadItem) {
|
46
46
|
var acquirerName = loadItem.acquirerName,
|
@@ -6,19 +6,20 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
8
|
import { v4 as uuid } from 'uuid';
|
9
|
-
import {
|
9
|
+
import { EnvironmentEnum } from "../../../types";
|
10
10
|
import { queryParse } from "../../../util";
|
11
11
|
import { LogConfig, Logger } from "../../../util/logger";
|
12
12
|
var CKP_PAYMENT_PAGE_HOST = {
|
13
13
|
DEV: 'https://dev.page.alipay.net',
|
14
14
|
TEST: 'https://test.page.alipay.net',
|
15
15
|
PRE: 'https://pre.ac.alipay.com',
|
16
|
-
PROD: 'https://
|
16
|
+
PROD: 'https://checkout.antom.com'
|
17
17
|
};
|
18
18
|
|
19
19
|
// for local development
|
20
20
|
|
21
21
|
var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
|
22
|
+
var CKP_PAGE_NEW_ADDRESS = '/checkout-page/pages/payment/index.html';
|
22
23
|
export var getCKPPageAddress = function getCKPPageAddress(env) {
|
23
24
|
switch (env) {
|
24
25
|
case 'dev':
|
@@ -30,7 +31,7 @@ export var getCKPPageAddress = function getCKPPageAddress(env) {
|
|
30
31
|
case 'prod':
|
31
32
|
case 'sandbox':
|
32
33
|
case 'light_sandbox':
|
33
|
-
return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(
|
34
|
+
return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_NEW_ADDRESS);
|
34
35
|
default:
|
35
36
|
// for local development, e.g. http://localhost:5173/checkout-page/src/pages/payment/index.html
|
36
37
|
return env;
|
@@ -87,11 +88,11 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
87
88
|
_defineProperty(this, "removeListener", function () {
|
88
89
|
window.removeEventListener('message', _this.eventListenerWrapper);
|
89
90
|
});
|
90
|
-
options.environment = options.environment ||
|
91
|
+
options.environment = options.environment || EnvironmentEnum.prod;
|
91
92
|
this._instanceId = uuid();
|
92
93
|
this.originOptions = options;
|
93
94
|
this.eventListener = options.onEventCallback;
|
94
|
-
this.logger = new Logger(LogConfig, ![
|
95
|
+
this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
95
96
|
Logger.setInstance(this.logger);
|
96
97
|
this.logger.setMedta({
|
97
98
|
instanceId: this._instanceId
|
@@ -113,14 +114,16 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
113
114
|
function mountComponent(params, selector) {
|
114
115
|
if (params.sessionData === undefined || params.sessionData === '' || typeof params.sessionData !== 'string') {
|
115
116
|
this.logger.logError({
|
116
|
-
title: '
|
117
|
+
title: 'event_important_error',
|
118
|
+
msg: 'PARAMS_ERROR_INVALID_SESSION_DATA'
|
117
119
|
});
|
118
120
|
console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: sessionData is required and must be a string');
|
119
121
|
throw new Error('PARAMS_ERROR_INVALID_SESSION_DATA');
|
120
122
|
}
|
121
123
|
if (document.querySelector(this.APP_IFRAME_ID)) {
|
122
124
|
this.logger.logError({
|
123
|
-
title: '
|
125
|
+
title: 'event_important_error',
|
126
|
+
msg: 'PARAMS_ERROR_ALREADY_MOUNTED'
|
124
127
|
});
|
125
128
|
console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: already mounted, please unmount first');
|
126
129
|
throw new Error('PARAMS_ERROR_ALREADY_MOUNTED');
|
@@ -139,7 +142,8 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
139
142
|
wrapper.appendChild(iframe);
|
140
143
|
} else {
|
141
144
|
this.logger.logError({
|
142
|
-
title: '
|
145
|
+
title: 'event_important_error',
|
146
|
+
msg: 'PARAMS_ERROR_INVALID_SELECTOR'
|
143
147
|
});
|
144
148
|
console.error('[antom-web-sdk] <antom-checkout-page> mountComponent: invalid selector');
|
145
149
|
this.removeListener();
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { AddressMountComponentsParams } from '../type';
|
2
|
+
interface ElementAddressMountOptions extends Omit<AddressMountComponentsParams, 'type'> {
|
3
|
+
selector: string;
|
4
|
+
}
|
5
|
+
export declare class ElementAddressComponent {
|
6
|
+
private sdk;
|
7
|
+
private elementContainer;
|
8
|
+
private isConnect;
|
9
|
+
constructor();
|
10
|
+
create(options: {
|
11
|
+
environment: string;
|
12
|
+
locale: string;
|
13
|
+
appVersion: string;
|
14
|
+
}, isConnect: boolean): void;
|
15
|
+
mount(sessionData: string, options: ElementAddressMountOptions): Promise<HTMLIFrameElement | undefined>;
|
16
|
+
update(): void;
|
17
|
+
unmount(): void;
|
18
|
+
}
|
19
|
+
export {};
|