@alipay/ams-checkout 0.0.1755258862-dev.7 → 0.0.1756796178-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/channel.d.ts +3 -1
- package/esm/component/channel.js +26 -62
- package/esm/component/component.inline.style.js +2 -2
- package/esm/component/popupWindow.style.d.ts +4 -1
- package/esm/component/popupWindow.style.js +37 -2
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/easysafepay.js +19 -0
- package/esm/constant/index.d.ts +41 -2
- package/esm/constant/index.js +43 -5
- package/esm/core/component/ckp/index.d.ts +2 -0
- package/esm/core/component/ckp/index.js +41 -5
- package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
- package/esm/core/component/element/elementContainerService/containerService.js +123 -0
- package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
- package/esm/core/component/element/elementContainerService/index.js +63 -0
- package/esm/core/component/element/elementController/index.d.ts +27 -0
- package/esm/core/component/element/elementController/index.js +493 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
- package/esm/core/component/element/index.d.ts +7 -46
- package/esm/core/component/element/index.js +31 -923
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +365 -1
- package/esm/core/component/element/type.d.ts +74 -34
- package/esm/core/component/element/type.js +20 -12
- package/esm/core/component/element/util.d.ts +69 -0
- package/esm/core/component/element/util.js +477 -0
- package/esm/core/component/index.d.ts +5 -1
- package/esm/core/component/index.js +1 -2
- package/esm/core/component/oldElement/index.d.ts +59 -0
- package/esm/core/component/oldElement/index.js +956 -0
- package/esm/core/component/oldElement/mock.d.ts +6 -0
- package/esm/core/component/oldElement/mock.js +567 -0
- package/esm/core/component/oldElement/type.d.ts +354 -0
- package/esm/core/component/oldElement/type.js +81 -0
- package/esm/core/instance/index.d.ts +1 -1
- package/esm/core/instance/index.js +1 -1
- package/esm/foundation/core/index.d.ts +9 -1
- package/esm/foundation/core/index.js +153 -53
- package/esm/foundation/index.d.ts +20 -0
- package/esm/foundation/index.js +13 -2
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
- package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
- package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
- package/esm/foundation/product-processor/autoDebit/index.js +466 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +3 -1
- package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
- package/esm/foundation/product-processor/easysafepay/index.d.ts +5 -0
- package/esm/foundation/product-processor/easysafepay/index.js +271 -169
- package/esm/foundation/product-processor/element/index.d.ts +7 -0
- package/esm/foundation/product-processor/element/index.js +24 -0
- package/esm/foundation/service/container/index.d.ts +14 -3
- package/esm/foundation/service/container/index.js +178 -25
- package/esm/foundation/service/container/popup.d.ts +10 -7
- package/esm/foundation/service/container/popup.js +3 -1
- package/esm/foundation/service/event-center.js +1 -0
- package/esm/foundation/service/log/keys.js +3 -1
- package/esm/foundation/service/log/types.d.ts +1 -0
- package/esm/foundation/service/requester/requester.js +20 -109
- package/esm/foundation/utils/preload_helper.d.ts +2 -2
- package/esm/foundation/utils/preload_helper.js +8 -6
- package/esm/foundation/utils/redirect_utils.js +34 -18
- package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
- package/esm/foundation/utils/web_app_url_utils.js +219 -8
- package/esm/index.d.ts +8 -5
- package/esm/index.js +103 -53
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +5 -5
- package/esm/plugin/component/channel.d.ts +3 -1
- package/esm/plugin/component/channel.js +10 -12
- package/esm/plugin/component/index.js +49 -45
- package/esm/plugin/type.d.ts +1 -1
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +37 -3
- package/esm/types/index.js +10 -2
- package/esm/util/index.d.ts +12 -1
- package/esm/util/index.js +39 -3
- package/esm/util/redirect.d.ts +6 -0
- package/esm/util/redirect.js +54 -0
- package/esm/util/spm-map.d.ts +18 -4
- package/esm/util/spm-map.js +20 -6
- package/package.json +27 -4
- /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
- /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -9,11 +9,13 @@ export type IChannelBehavior = {
|
|
9
9
|
type GetDoubleFaParams = {
|
10
10
|
instanceId: string;
|
11
11
|
paymentSessionData: string;
|
12
|
+
paymentSessionObj: IPaymentSessionMetaData;
|
12
13
|
locale: string;
|
13
14
|
paymentMethodType: string;
|
14
15
|
env: string;
|
15
16
|
sdkVersion: string;
|
17
|
+
notRedirectAfterComplete: boolean;
|
16
18
|
};
|
17
|
-
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
19
|
+
export declare function getChannelBehavior(notRedirectAfterComplete: boolean, paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
|
18
20
|
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
19
21
|
export {};
|
package/esm/component/channel.js
CHANGED
@@ -1,62 +1,31 @@
|
|
1
|
-
|
1
|
+
import { getDoubleFaUrlFromSession } from "../foundation/utils/web_app_url_utils";
|
2
|
+
import { MODE } from "../constant/easysafepay";
|
3
|
+
export function getChannelBehavior(notRedirectAfterComplete, paymentSessionMetaData) {
|
2
4
|
var _paymentSessionMetaDa;
|
3
5
|
var allowSubmitPayCallAhead = false;
|
4
6
|
var allowClickOutsideClose = false;
|
5
7
|
var buildSubmitPayExtParams = undefined;
|
6
|
-
|
7
8
|
// EASYPAY
|
8
9
|
if ((paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.productScene) === 'EASY_PAY') {
|
9
|
-
var _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4,
|
10
|
-
var
|
11
|
-
var
|
12
|
-
|
13
|
-
if (
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
var _paymentSessionMetaDa9;
|
27
|
-
if (isFirstTimeToPay) {
|
28
|
-
var _paymentSessionMetaDa7;
|
29
|
-
if (
|
30
|
-
// AlipayCN、TOSS
|
31
|
-
['ALIPAY_CN', 'BANKTRANSFER_QUICKPAY'].includes(paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa7 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa7 === void 0 ? void 0 : _paymentSessionMetaDa7.paymentMethodType)) {
|
32
|
-
allowSubmitPayCallAhead = true;
|
33
|
-
} else {
|
34
|
-
allowSubmitPayCallAhead = false;
|
35
|
-
}
|
36
|
-
} else {
|
37
|
-
if (amountConfirmRequired) {
|
38
|
-
var _paymentSessionMetaDa8;
|
39
|
-
// TOSS
|
40
|
-
if (['BANKTRANSFER_QUICKPAY'].includes(paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa8 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa8 === void 0 ? void 0 : _paymentSessionMetaDa8.paymentMethodType)) {
|
41
|
-
allowSubmitPayCallAhead = true;
|
42
|
-
} else {
|
43
|
-
allowSubmitPayCallAhead = false;
|
44
|
-
}
|
45
|
-
} else {
|
46
|
-
allowSubmitPayCallAhead = true;
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
// TOSS
|
51
|
-
if (['BANKTRANSFER_QUICKPAY'].includes(paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa9 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa9 === void 0 ? void 0 : _paymentSessionMetaDa9.paymentMethodType)) {
|
52
|
-
allowClickOutsideClose = false;
|
53
|
-
buildSubmitPayExtParams = function buildSubmitPayExtParams(params) {
|
54
|
-
var callBackUrl = getDoubleFaUrl(params);
|
55
|
-
return {
|
56
|
-
callBackUrl: callBackUrl
|
57
|
-
};
|
10
|
+
var _paymentSessionMetaDa2, _paymentSessionMetaDa3, _paymentSessionMetaDa4, _paymentSessionMetaDa5;
|
11
|
+
var isFirstTimeToPay = !((_paymentSessionMetaDa2 = paymentSessionMetaData.action) !== null && _paymentSessionMetaDa2 !== void 0 && _paymentSessionMetaDa2.autoDebitWithToken);
|
12
|
+
var needAccountConfirmPage = (_paymentSessionMetaDa3 = paymentSessionMetaData.needAccountConfirmPage) !== null && _paymentSessionMetaDa3 !== void 0 ? _paymentSessionMetaDa3 : true;
|
13
|
+
var isTossPayment = (paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa4 = paymentSessionMetaData.paymentSessionConfig) === null || _paymentSessionMetaDa4 === void 0 ? void 0 : _paymentSessionMetaDa4.productSceneVersion) === '2.0' && ['BANKTRANSFER_QUICKPAY'].includes(paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa5 = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa5 === void 0 ? void 0 : _paymentSessionMetaDa5.paymentMethodType);
|
14
|
+
if (isFirstTimeToPay) {
|
15
|
+
allowSubmitPayCallAhead = !needAccountConfirmPage;
|
16
|
+
} else {
|
17
|
+
// 如果是二次一定调用submitPay接口
|
18
|
+
allowSubmitPayCallAhead = true;
|
19
|
+
}
|
20
|
+
if (isTossPayment) {
|
21
|
+
allowClickOutsideClose = false;
|
22
|
+
buildSubmitPayExtParams = function buildSubmitPayExtParams(params) {
|
23
|
+
var callBackUrl = getDoubleFaUrl(params);
|
24
|
+
return {
|
25
|
+
callBackUrl: callBackUrl,
|
26
|
+
notRedirectAfterComplete: notRedirectAfterComplete
|
58
27
|
};
|
59
|
-
}
|
28
|
+
};
|
60
29
|
}
|
61
30
|
}
|
62
31
|
return {
|
@@ -70,18 +39,13 @@ export function getDoubleFaUrl(params) {
|
|
70
39
|
var instanceId = params.instanceId,
|
71
40
|
paymentMethodType = params.paymentMethodType,
|
72
41
|
paymentSessionData = params.paymentSessionData,
|
42
|
+
paymentSessionObj = params.paymentSessionObj,
|
73
43
|
locale = params.locale,
|
74
44
|
env = params.env,
|
75
|
-
sdkVersion = params.sdkVersion
|
45
|
+
sdkVersion = params.sdkVersion,
|
46
|
+
notRedirectAfterComplete = params.notRedirectAfterComplete;
|
76
47
|
var isLandscapeOrientation = false; // Web 不含横屏
|
77
48
|
|
78
|
-
var
|
79
|
-
|
80
|
-
dev: "http://page.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
81
|
-
sit: "http://page.test.alipay.net/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
82
|
-
pre: "https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html"),
|
83
|
-
prod: "https://ac.alipay.com/page/antom-web-checkout/src/component-app/doubleFA/index.".concat(sdkVersion, ".html")
|
84
|
-
};
|
85
|
-
var doubleFaBaseUrl = DOUBLE_FA_URL_MAPPING[env] || DOUBLE_FA_URL_MAPPING.prod;
|
86
|
-
return "".concat(doubleFaBaseUrl, "?scene=cashierResultPage&instanceId=").concat(instanceId, "&paymentSessionData=").concat(encodeURIComponent(paymentSessionData), "&isLandscape=").concat(isLandscapeOrientation ? 'true' : '', "&pmt=").concat(paymentMethodType, "&locale=").concat(locale, "&sdkVersion=").concat(sdkVersion);
|
49
|
+
var baseDoubleFaUrl = getDoubleFaUrlFromSession(paymentSessionObj, env);
|
50
|
+
return "".concat(baseDoubleFaUrl) + '?' + "scene=cashierResultPage" + '&' + "instanceId=".concat(instanceId) + '&' + "paymentSessionData=".concat(encodeURIComponent(paymentSessionData)) + '&' + "isLandscape=".concat(isLandscapeOrientation ? 'true' : '') + '&' + "pmt=".concat(paymentMethodType) + '&' + "locale=".concat(locale) + '&' + "sdkVersion=".concat(sdkVersion) + '&' + "mode=".concat(MODE.SDK) + '&' + "¬RedirectAfterComplete=".concat(notRedirectAfterComplete);
|
87
51
|
}
|
@@ -95,7 +95,7 @@ var renderElementPayment = function renderElementPayment(type) {
|
|
95
95
|
export var addInlineLoading = function addInlineLoading(_selector, platform, options) {
|
96
96
|
var loading = document.createElement('div');
|
97
97
|
loading.id = LOADING_ID;
|
98
|
-
if (options.componentSign === ComponentSignEnum.ELEMENT_PAYMENT) {
|
98
|
+
if ((options === null || options === void 0 ? void 0 : options.componentSign) === ComponentSignEnum.ELEMENT_PAYMENT) {
|
99
99
|
if (options.isExpressCheckout) {
|
100
100
|
loading.innerHTML = '';
|
101
101
|
} else {
|
@@ -115,7 +115,7 @@ export var createInlineBaseElement = function createInlineBaseElement(selector)
|
|
115
115
|
var amsComponentContainer = document.createElement('div');
|
116
116
|
amsComponentContainer.className = "".concat(containerId, "-inline");
|
117
117
|
amsComponentContainer.id = containerId;
|
118
|
-
var selectorDom = document.querySelector("
|
118
|
+
var selectorDom = document.querySelector("".concat(selector));
|
119
119
|
if (selectorDom) selectorDom.appendChild(amsComponentContainer);
|
120
120
|
return amsComponentContainer;
|
121
121
|
};
|
@@ -2,10 +2,13 @@ export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void;
|
|
2
2
|
export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void;
|
3
3
|
export declare const removePopupLoading: (isShowMockup?: boolean) => void;
|
4
4
|
export declare const insertStyleSheet: () => void;
|
5
|
-
export declare
|
5
|
+
export declare function createCloseIcon(onClose: () => void): HTMLDivElement;
|
6
|
+
export declare const createModal: ({ device, url, widthPadding, loadingConfig, showCloseOnLoading, onCloseOnLoading }: {
|
6
7
|
device: any;
|
7
8
|
url: any;
|
8
9
|
widthPadding: any;
|
9
10
|
loadingConfig: any;
|
11
|
+
showCloseOnLoading: any;
|
12
|
+
onCloseOnLoading: any;
|
10
13
|
}) => Promise<HTMLIFrameElement>;
|
11
14
|
export declare const destroyModal: () => void;
|
@@ -2,7 +2,7 @@ import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../
|
|
2
2
|
import { getDesignFontSize } from "../util";
|
3
3
|
|
4
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
|
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
6
|
var getCurrentTheme = function getCurrentTheme() {
|
7
7
|
var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
|
8
8
|
var theme = {
|
@@ -47,6 +47,27 @@ export var insertStyleSheet = function insertStyleSheet() {
|
|
47
47
|
style.innerHTML = modalStyles;
|
48
48
|
document.head.appendChild(style);
|
49
49
|
};
|
50
|
+
export function createCloseIcon(onClose) {
|
51
|
+
var closeIcon = document.createElement('div');
|
52
|
+
closeIcon.style.position = 'absolute';
|
53
|
+
closeIcon.style.right = '16px';
|
54
|
+
closeIcon.style.top = '23px';
|
55
|
+
closeIcon.style.cursor = 'pointer';
|
56
|
+
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
57
|
+
svg.setAttribute('width', '16');
|
58
|
+
svg.setAttribute('height', '16');
|
59
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
60
|
+
svg.setAttribute('fill', 'none');
|
61
|
+
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
62
|
+
path.setAttribute('fill-rule', 'evenodd');
|
63
|
+
path.setAttribute('clip-rule', 'evenodd');
|
64
|
+
path.setAttribute('d', 'M13.0449 2.99894L12.9494 2.91165L12.8685 2.85222L12.7802 2.7996C12.3611 2.57499 11.8556 2.64328 11.5228 2.9763L7.99909 6.50088L4.48854 2.99028L4.44701 2.95034C4.0098 2.57169 3.38048 2.57202 2.99838 2.9525L2.92363 3.03297L2.85175 3.12897L2.79916 3.21735C2.57471 3.63642 2.64292 4.14198 2.9757 4.47491L6.50186 8.00046L2.95226 11.5518C2.57141 11.9917 2.57173 12.6211 2.95197 13.0033L3.0324 13.078L3.12837 13.15L3.21674 13.2026C3.63573 13.4272 4.14123 13.3589 4.47407 13.0259L7.99909 9.49935L11.5474 13.0494C11.9944 13.4368 12.6238 13.4235 13.0212 13.0259L13.0922 12.9471L13.1559 12.8595C13.4298 12.4403 13.3789 11.8852 13.0211 11.5272L9.497 8.00115L13.0052 4.4915L13.07 4.4225C13.4304 4.00477 13.4199 3.37582 13.0449 2.99894Z');
|
65
|
+
path.setAttribute('fill', '#ABB9CC');
|
66
|
+
svg.appendChild(path);
|
67
|
+
closeIcon.appendChild(svg);
|
68
|
+
closeIcon.onclick = onClose;
|
69
|
+
return closeIcon;
|
70
|
+
}
|
50
71
|
var modalDevice = 'desktop';
|
51
72
|
// 插入弹窗
|
52
73
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -54,7 +75,9 @@ export var createModal = function createModal(_ref) {
|
|
54
75
|
var device = _ref.device,
|
55
76
|
url = _ref.url,
|
56
77
|
widthPadding = _ref.widthPadding,
|
57
|
-
loadingConfig = _ref.loadingConfig
|
78
|
+
loadingConfig = _ref.loadingConfig,
|
79
|
+
showCloseOnLoading = _ref.showCloseOnLoading,
|
80
|
+
onCloseOnLoading = _ref.onCloseOnLoading;
|
58
81
|
return new Promise(function (resolve, reject) {
|
59
82
|
try {
|
60
83
|
modalDevice = device;
|
@@ -87,6 +110,15 @@ export var createModal = function createModal(_ref) {
|
|
87
110
|
modal.style.backgroundColor = backgroundPrimary;
|
88
111
|
iframe.style.backgroundColor = backgroundPrimary;
|
89
112
|
}
|
113
|
+
|
114
|
+
// 弹窗渲染loading时关闭按钮逻辑
|
115
|
+
if (showCloseOnLoading) {
|
116
|
+
var closeIcon = createCloseIcon(onCloseOnLoading);
|
117
|
+
modal.appendChild(closeIcon);
|
118
|
+
iframe.addEventListener('load', function () {
|
119
|
+
modal.removeChild(closeIcon);
|
120
|
+
});
|
121
|
+
}
|
90
122
|
modal.appendChild(iframe);
|
91
123
|
var body = document.getElementsByTagName('body')[0];
|
92
124
|
body.appendChild(overlay);
|
@@ -104,6 +136,9 @@ export var createModal = function createModal(_ref) {
|
|
104
136
|
// 销毁弹窗
|
105
137
|
export var destroyModal = function destroyModal() {
|
106
138
|
var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
|
139
|
+
if (!overlay) {
|
140
|
+
return;
|
141
|
+
}
|
107
142
|
var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile"));
|
108
143
|
overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
|
109
144
|
overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
|
package/esm/config/index.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
export declare const marmotMap: Record<string, string>;
|
2
2
|
export declare const marmotConfigMap: Record<string, string>;
|
3
|
-
export declare const
|
3
|
+
export declare const v2AppMarmotMap: Record<string, string>;
|
4
4
|
export declare const sdkVersion: string;
|
5
5
|
/**
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
*/
|
8
|
-
export declare const AMSCheckoutAppVersion = "1.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.42.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.42.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.42.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.42.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.42.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.42.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.42.0";
|
package/esm/config/index.js
CHANGED
@@ -22,7 +22,7 @@ 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 v2AppMarmotMap = {
|
26
26
|
dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
|
27
27
|
sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
|
28
28
|
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
|
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
|
|
35
35
|
/**
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
*/
|
38
|
-
export var AMSCheckoutAppVersion = '1.
|
39
|
-
export var AMSAutoDebitAppVersion = '1.
|
40
|
-
export var AMSEasyPayAppVersion = '1.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.
|
42
|
-
export var AMSVaultingAppVersion = '1.
|
43
|
-
export var AMSPaymentElementAppVersion = '1.
|
44
|
-
export var ADDRESSElementAppVersion = '1.
|
38
|
+
export var AMSCheckoutAppVersion = '1.42.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.42.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.42.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.42.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.42.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.42.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.42.0'; // address element
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* ESP 构建产物page名称
|
3
|
+
*/
|
4
|
+
export declare enum ESP_PAGE_NAME {
|
5
|
+
API_PORTAL = "api-portal",
|
6
|
+
SDK_PORTAL = "sdk-portal",
|
7
|
+
DOUBLE_FA = "double-fa",
|
8
|
+
PRELOAD = "preload"
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* ESP集成模式
|
12
|
+
*/
|
13
|
+
export declare enum MODE {
|
14
|
+
SDK = "SDK",
|
15
|
+
API = "API"
|
16
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* ESP 构建产物page名称
|
3
|
+
*/
|
4
|
+
export var ESP_PAGE_NAME = /*#__PURE__*/function (ESP_PAGE_NAME) {
|
5
|
+
ESP_PAGE_NAME["API_PORTAL"] = "api-portal";
|
6
|
+
ESP_PAGE_NAME["SDK_PORTAL"] = "sdk-portal";
|
7
|
+
ESP_PAGE_NAME["DOUBLE_FA"] = "double-fa";
|
8
|
+
ESP_PAGE_NAME["PRELOAD"] = "preload";
|
9
|
+
return ESP_PAGE_NAME;
|
10
|
+
}({});
|
11
|
+
|
12
|
+
/**
|
13
|
+
* ESP集成模式
|
14
|
+
*/
|
15
|
+
export var MODE = /*#__PURE__*/function (MODE) {
|
16
|
+
MODE["SDK"] = "SDK";
|
17
|
+
MODE["API"] = "API";
|
18
|
+
return MODE;
|
19
|
+
}({});
|
package/esm/constant/index.d.ts
CHANGED
@@ -67,9 +67,9 @@ export declare const ERRORMESSAGE: {
|
|
67
67
|
message: string;
|
68
68
|
};
|
69
69
|
};
|
70
|
-
|
70
|
+
SDK_LAUNCH_PAYMENT_APP_ERROR: {
|
71
71
|
code: eventCodeEnum;
|
72
|
-
|
72
|
+
CALL_APP_URL_ERROR: {
|
73
73
|
code: eventCodeEnum;
|
74
74
|
message: string;
|
75
75
|
};
|
@@ -78,6 +78,16 @@ export declare const ERRORMESSAGE: {
|
|
78
78
|
code: eventCodeEnum;
|
79
79
|
message: string;
|
80
80
|
};
|
81
|
+
/**
|
82
|
+
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
83
|
+
*/
|
84
|
+
SDK_CALL_URL_ERROR: {
|
85
|
+
code: eventCodeEnum;
|
86
|
+
REDIRECT_ERROR: {
|
87
|
+
code: eventCodeEnum;
|
88
|
+
message: string;
|
89
|
+
};
|
90
|
+
};
|
81
91
|
};
|
82
92
|
export declare const BASEPLUGINID = "CHECKOUT";
|
83
93
|
export declare const COMPONENTPLUGINID = "COMPONENT";
|
@@ -112,6 +122,9 @@ export declare const EVENT: {
|
|
112
122
|
name: string;
|
113
123
|
uniqueKey: string;
|
114
124
|
};
|
125
|
+
destroy: {
|
126
|
+
name: string;
|
127
|
+
};
|
115
128
|
closeCallback: {
|
116
129
|
name: string;
|
117
130
|
uniqueKey: string;
|
@@ -162,6 +175,9 @@ export declare const EVENT: {
|
|
162
175
|
getGlobalData: {
|
163
176
|
name: string;
|
164
177
|
};
|
178
|
+
/**
|
179
|
+
* @deprecated 已废弃 请使用eventCallback
|
180
|
+
*/
|
165
181
|
sendMuitiAppEventToSdk: {
|
166
182
|
name: string;
|
167
183
|
};
|
@@ -207,6 +223,28 @@ export declare const EVENT: {
|
|
207
223
|
getApplePayToken: {
|
208
224
|
name: string;
|
209
225
|
};
|
226
|
+
updated: {
|
227
|
+
name: string;
|
228
|
+
};
|
229
|
+
webAppReady: {
|
230
|
+
name: string;
|
231
|
+
};
|
232
|
+
showToast: {
|
233
|
+
name: string;
|
234
|
+
};
|
235
|
+
getSdkVersion: {
|
236
|
+
name: string;
|
237
|
+
};
|
238
|
+
inputFocus: {
|
239
|
+
name: string;
|
240
|
+
};
|
241
|
+
/**
|
242
|
+
* 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
|
243
|
+
* TODO 推荐使用BusManager
|
244
|
+
*/
|
245
|
+
messageForward: {
|
246
|
+
name: string;
|
247
|
+
};
|
210
248
|
};
|
211
249
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
212
250
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
@@ -227,4 +265,5 @@ export declare const ANIMATION_TIME = 300;
|
|
227
265
|
export declare const TIMEOUT_WEB_APP_HEART_BEAT = 6000;
|
228
266
|
export declare const TIME_DELAY_SEND_HEART_BEAT = 1000;
|
229
267
|
export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
|
268
|
+
export declare const closeImgLight = "https://cdn.marmot-cloud.com/storage/2025/05/24/50891cd3-7a4a-47c0-b550-2e2ce6187c31.svg";
|
230
269
|
export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxeKq9R5fOJG8KAR6+Uy2vlJag8ALDmxSDa2TLWEhos5UPKnEA7sy8yALNYyod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AElFTkSuQmCC";
|
package/esm/constant/index.js
CHANGED
@@ -67,16 +67,26 @@ export var ERRORMESSAGE = {
|
|
67
67
|
message: 'Load resource timeout'
|
68
68
|
}
|
69
69
|
},
|
70
|
+
SDK_LAUNCH_PAYMENT_APP_ERROR: {
|
71
|
+
code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
|
72
|
+
CALL_APP_URL_ERROR: {
|
73
|
+
code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
|
74
|
+
message: 'Failed to launch app'
|
75
|
+
}
|
76
|
+
},
|
77
|
+
SDK_SUBMIT_ERROR: {
|
78
|
+
code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
|
79
|
+
message: 'Component not created or current browser compatibility issue, not supported'
|
80
|
+
},
|
81
|
+
/**
|
82
|
+
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
83
|
+
*/
|
70
84
|
SDK_CALL_URL_ERROR: {
|
71
85
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
72
86
|
REDIRECT_ERROR: {
|
73
87
|
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
74
88
|
message: 'Redirect data exception'
|
75
89
|
}
|
76
|
-
},
|
77
|
-
SDK_SUBMIT_ERROR: {
|
78
|
-
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
79
|
-
message: 'Component not created or current browser compatibility issue, not supported'
|
80
90
|
}
|
81
91
|
};
|
82
92
|
export var BASEPLUGINID = 'CHECKOUT';
|
@@ -112,6 +122,9 @@ export var EVENT = {
|
|
112
122
|
name: 'onClose',
|
113
123
|
uniqueKey: 'userOnClose'
|
114
124
|
},
|
125
|
+
destroy: {
|
126
|
+
name: 'onDestroy'
|
127
|
+
},
|
115
128
|
// 标记 SDK 回调事件
|
116
129
|
closeCallback: {
|
117
130
|
name: 'onCloseCallback',
|
@@ -163,7 +176,9 @@ export var EVENT = {
|
|
163
176
|
getGlobalData: {
|
164
177
|
name: 'getGlobalData'
|
165
178
|
},
|
166
|
-
|
179
|
+
/**
|
180
|
+
* @deprecated 已废弃 请使用eventCallback
|
181
|
+
*/
|
167
182
|
sendMuitiAppEventToSdk: {
|
168
183
|
name: 'sendMuitiAppEventToSdk'
|
169
184
|
},
|
@@ -209,6 +224,28 @@ export var EVENT = {
|
|
209
224
|
},
|
210
225
|
getApplePayToken: {
|
211
226
|
name: 'getApplePayToken'
|
227
|
+
},
|
228
|
+
updated: {
|
229
|
+
name: 'updated'
|
230
|
+
},
|
231
|
+
webAppReady: {
|
232
|
+
name: 'webAppReady'
|
233
|
+
},
|
234
|
+
showToast: {
|
235
|
+
name: 'showToast'
|
236
|
+
},
|
237
|
+
getSdkVersion: {
|
238
|
+
name: 'getSdkVersion'
|
239
|
+
},
|
240
|
+
inputFocus: {
|
241
|
+
name: 'onInputFocus'
|
242
|
+
},
|
243
|
+
/**
|
244
|
+
* 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
|
245
|
+
* TODO 推荐使用BusManager
|
246
|
+
*/
|
247
|
+
messageForward: {
|
248
|
+
name: 'onMessageForward'
|
212
249
|
}
|
213
250
|
};
|
214
251
|
export var COMPONENT_CONTAINER_ID = 'ams-component-container';
|
@@ -230,4 +267,5 @@ export var ANIMATION_TIME = 300;
|
|
230
267
|
export var TIMEOUT_WEB_APP_HEART_BEAT = 6000;
|
231
268
|
export var TIME_DELAY_SEND_HEART_BEAT = 1000;
|
232
269
|
export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
|
270
|
+
export var closeImgLight = 'https://cdn.marmot-cloud.com/storage/2025/05/24/50891cd3-7a4a-47c0-b550-2e2ce6187c31.svg';
|
233
271
|
export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4A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34g69McUKSIDjnSHj4PNiEpWKWyoNWelewXEoCuhj5EPpEzeEVFa3L3X1bgHaKOQcjOOD0YFXqYtSCRkDEPW7ApbjMJExZ5LasyCIW8M9mBZ4FQLkHB7G2MfzJ3Q8eKyGtVIsFlcKvBwayfh/ldW8Ck4Va7USEorFAkEoi1zu3KQrEu+Ca6wwi54GpFmYeC6ruLRAgffCLVgv2EchwkuGgGVZWe15bElAL5FeUwSUBR1f5AQUESCQR2mVh1FkjfAkohJgLj1GEVtZIRFACP0fCm/AgmdREnzYqIRhFHkvq+J77MBFQpEPpCQOYPcntwIWeK6Mu0P9D9pzJq4u5hj+AAAAAElFTkSuQmCC';
|
@@ -7,6 +7,7 @@ export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LO
|
|
7
7
|
export declare class AMSCheckoutPage {
|
8
8
|
logger: Logger;
|
9
9
|
private _instanceId;
|
10
|
+
private iframe;
|
10
11
|
private originOptions;
|
11
12
|
private readonly APP_IFRAME_ID;
|
12
13
|
private eventListener?;
|
@@ -15,6 +16,7 @@ export declare class AMSCheckoutPage {
|
|
15
16
|
private eventListenerWrapper;
|
16
17
|
private addListener;
|
17
18
|
private removeListener;
|
19
|
+
private dispatchToApp;
|
18
20
|
/**
|
19
21
|
* 挂载组件
|
20
22
|
*/
|
@@ -1,12 +1,15 @@
|
|
1
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
2
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
3
5
|
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
6
|
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
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
6
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
9
|
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); }
|
10
|
+
import { redirect } from "../../../util/redirect";
|
8
11
|
import { v4 as uuid } from 'uuid';
|
9
|
-
import { EnvironmentEnum } from "../../../types";
|
12
|
+
import { EnvironmentEnum, MessageName } from "../../../types";
|
10
13
|
import { queryParse } from "../../../util";
|
11
14
|
import { LogConfig, Logger } from "../../../util/logger";
|
12
15
|
var CKP_PAYMENT_PAGE_HOST = {
|
@@ -43,6 +46,7 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
43
46
|
_classCallCheck(this, AMSCheckoutPage);
|
44
47
|
_defineProperty(this, "logger", void 0);
|
45
48
|
_defineProperty(this, "_instanceId", void 0);
|
49
|
+
_defineProperty(this, "iframe", void 0);
|
46
50
|
_defineProperty(this, "originOptions", void 0);
|
47
51
|
_defineProperty(this, "APP_IFRAME_ID", 'antom-checkout-page-sub-page-iframe');
|
48
52
|
_defineProperty(this, "eventListener", void 0);
|
@@ -68,10 +72,16 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
68
72
|
return url;
|
69
73
|
});
|
70
74
|
_defineProperty(this, "eventListenerWrapper", function (event) {
|
71
|
-
var
|
72
|
-
|
73
|
-
message =
|
74
|
-
result =
|
75
|
+
var dataObj = JSON.parse(event.data) || {};
|
76
|
+
var code = dataObj.code,
|
77
|
+
message = dataObj.message,
|
78
|
+
result = dataObj.result;
|
79
|
+
var _ref = (dataObj === null || dataObj === void 0 ? void 0 : dataObj.context) || {
|
80
|
+
event: '',
|
81
|
+
data: {}
|
82
|
+
},
|
83
|
+
eventCode = _ref.event,
|
84
|
+
data = _ref.data;
|
75
85
|
if (code && code.startsWith('SDK_PAYMENT')) {
|
76
86
|
var _this$eventListener;
|
77
87
|
console.log('[antom-web-sdk] <antom-checkout-page> eventListenerWrapper', event, message, result);
|
@@ -81,6 +91,20 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
81
91
|
result: result
|
82
92
|
});
|
83
93
|
}
|
94
|
+
if (eventCode && eventCode !== null && eventCode !== void 0 && eventCode.startsWith('onRedirect')) {
|
95
|
+
var _this$eventListener2;
|
96
|
+
(_this$eventListener2 = _this.eventListener) === null || _this$eventListener2 === void 0 || _this$eventListener2.call(_this, {
|
97
|
+
code: code,
|
98
|
+
message: message,
|
99
|
+
result: result
|
100
|
+
});
|
101
|
+
redirect(data).then(function () {
|
102
|
+
var content = _objectSpread(_objectSpread({}, dataObj === null || dataObj === void 0 ? void 0 : dataObj.context), {}, {
|
103
|
+
event: 'appEventCallback'
|
104
|
+
});
|
105
|
+
_this.dispatchToApp(content);
|
106
|
+
});
|
107
|
+
}
|
84
108
|
});
|
85
109
|
_defineProperty(this, "addListener", function () {
|
86
110
|
window.addEventListener('message', _this.eventListenerWrapper);
|
@@ -88,8 +112,17 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
88
112
|
_defineProperty(this, "removeListener", function () {
|
89
113
|
window.removeEventListener('message', _this.eventListenerWrapper);
|
90
114
|
});
|
115
|
+
_defineProperty(this, "dispatchToApp", function (payloadContext) {
|
116
|
+
var _this$iframe;
|
117
|
+
var data = {
|
118
|
+
name: MessageName.SDK_TO_APP,
|
119
|
+
context: payloadContext
|
120
|
+
};
|
121
|
+
(_this$iframe = _this.iframe) === null || _this$iframe === void 0 || (_this$iframe = _this$iframe.contentWindow) === null || _this$iframe === void 0 || _this$iframe.postMessage(JSON.stringify(data), '*');
|
122
|
+
});
|
91
123
|
options.environment = options.environment || EnvironmentEnum.prod;
|
92
124
|
this._instanceId = uuid();
|
125
|
+
this.iframe = null;
|
93
126
|
this.originOptions = options;
|
94
127
|
this.eventListener = options.onEventCallback;
|
95
128
|
this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
@@ -133,6 +166,8 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
133
166
|
var iframe = document.createElement('iframe');
|
134
167
|
iframe.id = this.APP_IFRAME_ID;
|
135
168
|
iframe.src = ckpPageAddress;
|
169
|
+
// iframe设置支持第三方支付
|
170
|
+
iframe.allow = 'payment';
|
136
171
|
iframe.width = '100%';
|
137
172
|
iframe.height = '100%';
|
138
173
|
iframe.style.border = 'none';
|
@@ -140,6 +175,7 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
|
|
140
175
|
if (wrapper) {
|
141
176
|
wrapper.innerHTML = '';
|
142
177
|
wrapper.appendChild(iframe);
|
178
|
+
this.iframe = iframe;
|
143
179
|
} else {
|
144
180
|
this.logger.logError({
|
145
181
|
title: 'event_important_error',
|