@alipay/ams-checkout 0.0.1763724075-dev.4 → 0.0.1763966842-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/LEGAL.md +6 -0
- package/LICENSE +6 -0
- package/README.md +58 -0
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/channel.d.ts +21 -0
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/component/component.popup.style.d.ts +26 -0
- package/esm/component/popupWindow.style.d.ts +24 -0
- package/esm/config/index.d.ts +16 -0
- package/esm/config/request.d.ts +21 -0
- package/esm/constant/easysafepay.d.ts +16 -0
- package/esm/constant/index.d.ts +341 -0
- package/esm/constant/index.js +0 -3
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/interface.d.ts +36 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/ckp/index.d.ts +29 -0
- package/esm/core/component/element/EventCenter/index.d.ts +31 -0
- package/esm/core/component/element/elementContainerService/containerService.d.ts +34 -0
- package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
- package/esm/core/component/element/elementController/index.d.ts +48 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +3 -2
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
- package/esm/core/component/element/elementProcessor/authProcessor.js +3 -2
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +22 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +28 -30
- package/esm/core/component/element/index.d.ts +13 -0
- package/esm/core/component/element/mock.d.ts +10 -0
- package/esm/core/component/element/type.d.ts +443 -0
- package/esm/core/component/element/util.d.ts +85 -0
- package/esm/core/component/index.d.ts +58 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/foundation/core/index.d.ts +36 -0
- package/esm/foundation/core/index.js +0 -27
- package/esm/foundation/index.d.ts +97 -0
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
- package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +20 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +29 -0
- package/esm/foundation/product-processor/element/index.d.ts +7 -0
- package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/api-bus/index.d.ts +20 -0
- package/esm/foundation/service/api-bus/interface.d.ts +48 -0
- package/esm/foundation/service/container/index.d.ts +41 -0
- package/esm/foundation/service/container/index.js +2 -33
- package/esm/foundation/service/container/popup.d.ts +31 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/event-center.d.ts +82 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/keys.d.ts +13 -0
- package/esm/foundation/service/log/processor.d.ts +9 -0
- package/esm/foundation/service/log/types.d.ts +33 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/security/index.d.ts +28 -0
- package/esm/foundation/service/security/security.d.ts +33 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/preload_helper.d.ts +21 -0
- package/esm/foundation/utils/redirect_utils.d.ts +11 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +116 -0
- package/esm/foundation/utils/web_app_url_utils.js +15 -10
- package/esm/index.d.ts +54 -0
- package/esm/index.js +341 -5
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/component/cashierApp.d.ts +38 -0
- package/esm/plugin/component/cashierApp.js +4 -7
- package/esm/plugin/component/channel.d.ts +57 -0
- package/esm/plugin/component/component.inline.style.d.ts +10 -0
- package/esm/plugin/component/component.popup.style.d.ts +25 -0
- package/esm/plugin/component/index.d.ts +133 -0
- package/esm/plugin/component/popupWindow.style.d.ts +11 -0
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/request/index.d.ts +9 -0
- package/esm/request/utils.d.ts +28 -0
- package/esm/service/index.d.ts +13 -0
- package/esm/types/index.d.ts +854 -0
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/debug.d.ts +1 -0
- package/esm/util/get.d.ts +25 -0
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/index.d.ts +61 -0
- package/esm/util/intl-callapp/es/browser.d.ts +21 -0
- package/esm/util/intl-callapp/es/evoke.d.ts +13 -0
- package/esm/util/intl-callapp/es/generate.d.ts +29 -0
- package/esm/util/intl-callapp/es/index.d.ts +43 -0
- package/esm/util/intl-callapp/es/main.d.ts +41 -0
- package/esm/util/intl-callapp/es/openWallet.d.ts +15 -0
- package/esm/util/intl-callapp/es/types.d.ts +46 -0
- package/esm/util/intl-callapp/es/utils/config.d.ts +24 -0
- package/esm/util/intl-callapp/es/utils/index.d.ts +15 -0
- package/esm/util/logger.d.ts +64 -0
- package/esm/util/logger.js +1 -1
- package/esm/util/mock.d.ts +1 -0
- package/esm/util/redirect.d.ts +6 -0
- package/esm/util/security.d.ts +34 -0
- package/esm/util/spm-map.d.ts +211 -0
- package/esm/util/storage.d.ts +2 -0
- package/esm/util/upgrade.d.ts +39 -0
- package/esm/util/versionCompare.d.ts +15 -0
- package/package.json +6 -16
- package/ams-checkout.js +0 -1
- package/esm/constant/auto-debit.js +0 -15
- package/esm/constant/element.js +0 -30
- package/esm/loader/Proxy.js +0 -364
- package/esm/loader/constant.js +0 -36
- package/esm/loader/index.js +0 -23
- package/esm/loader/utils/common.js +0 -63
- package/esm/loader/utils/debugger.js +0 -15
- package/esm/loader/utils/loadSDK.js +0 -92
- package/esm/loader/utils/logger.js +0 -59
- package/esm/loader/utils/proxyPerformance.js +0 -66
- package/esm/main.js +0 -329
- package/esm/util/integrationType.js +0 -48
|
@@ -0,0 +1,54 @@
|
|
|
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 { IGetMerchantSession, ICompletePaymentAuthorized, ICompleteApplePay, ILogError } from './interface';
|
|
9
|
+
import { ApplePaySubTypeEnum, IPaymentSessionMetaData } from '../../types';
|
|
10
|
+
import type { Logger } from '../../util/logger';
|
|
11
|
+
/**
|
|
12
|
+
* Apple Pay Service
|
|
13
|
+
*/
|
|
14
|
+
declare class ApplePayService {
|
|
15
|
+
private merchantIdentifier;
|
|
16
|
+
private merchantName;
|
|
17
|
+
private session;
|
|
18
|
+
private paymentState;
|
|
19
|
+
private getMerchantSession;
|
|
20
|
+
private completePaymentAuthorized;
|
|
21
|
+
private completeApplePay;
|
|
22
|
+
private logError;
|
|
23
|
+
private isRecurring;
|
|
24
|
+
private logger;
|
|
25
|
+
constructor(logger: Logger);
|
|
26
|
+
/**
|
|
27
|
+
* set Apple Pay Params
|
|
28
|
+
* @param getMerchantSession
|
|
29
|
+
* @param completePaymentAuthorized
|
|
30
|
+
* @param completeApplePay
|
|
31
|
+
* @param logError
|
|
32
|
+
* @param applePayTrace
|
|
33
|
+
*/
|
|
34
|
+
setApplePayParams(getMerchantSession: IGetMerchantSession, completePaymentAuthorized: ICompletePaymentAuthorized, completeApplePay: ICompleteApplePay, logError: ILogError): void;
|
|
35
|
+
/**
|
|
36
|
+
* Is Apple Pay Enabled
|
|
37
|
+
* @param subTypeEnum
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
static canMakePayments(subTypeEnum?: ApplePaySubTypeEnum): any;
|
|
41
|
+
/**
|
|
42
|
+
* has Active Card in Apple Pay
|
|
43
|
+
* @param merchantIdentifier
|
|
44
|
+
*/
|
|
45
|
+
hasActiveCard(merchantIdentifier: string): Promise<boolean>;
|
|
46
|
+
private onvalidatemerchant;
|
|
47
|
+
private sessionAbort;
|
|
48
|
+
private onpaymentauthorized;
|
|
49
|
+
/**
|
|
50
|
+
* Start Pay
|
|
51
|
+
*/
|
|
52
|
+
startPay: (param: IPaymentSessionMetaData) => void;
|
|
53
|
+
}
|
|
54
|
+
export default ApplePayService;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentSignEnum, DisplayTypeEnum, Ianalytics } from '../../types';
|
|
2
|
+
export declare const getAppVersion: (_extendInfo: string, productScene: string, mid: string, sendLog?: boolean) => string;
|
|
3
|
+
export declare const getFinalProductSceneVersion: (componentSign: ComponentSignEnum, productSceneVersion: string) => string;
|
|
4
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, elementLink?: string) => any;
|
|
5
|
+
export declare const getAppDomain: (domainParams: {
|
|
6
|
+
environment: string;
|
|
7
|
+
appVersion: string;
|
|
8
|
+
componentSign: ComponentSignEnum;
|
|
9
|
+
productScene: string;
|
|
10
|
+
productSceneVersion: string;
|
|
11
|
+
extendInfo: string;
|
|
12
|
+
mid: string;
|
|
13
|
+
elementLink: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare const getIframeUrl: (iframeParams: {
|
|
16
|
+
componentSign: ComponentSignEnum;
|
|
17
|
+
analytics?: Ianalytics;
|
|
18
|
+
productScene: string;
|
|
19
|
+
productSceneVersion: string;
|
|
20
|
+
environment: string;
|
|
21
|
+
appVersion: string;
|
|
22
|
+
extendInfo?: string;
|
|
23
|
+
locale?: string;
|
|
24
|
+
instanceId: string;
|
|
25
|
+
renderDisplayType: DisplayTypeEnum;
|
|
26
|
+
isPreload?: string;
|
|
27
|
+
hostSign?: string;
|
|
28
|
+
elementLink?: string;
|
|
29
|
+
mid?: string;
|
|
30
|
+
}) => {
|
|
31
|
+
path: string;
|
|
32
|
+
locationSearch: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @description Create iframe
|
|
36
|
+
*/
|
|
37
|
+
export declare const createIframe: (mode: string, platform: 'mobile' | 'desktop') => HTMLIFrameElement;
|
|
38
|
+
export declare const createPreloadIframe: (channelType: any, version: any) => HTMLIFrameElement;
|
|
@@ -15,7 +15,6 @@ 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 { getProxyCostTime } from "../../loader/utils/proxyPerformance";
|
|
19
18
|
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
|
|
20
19
|
import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
|
|
21
20
|
import { isDebugLog } from "../../util/debug";
|
|
@@ -96,7 +95,6 @@ export var getAppPath = function getAppPath() {
|
|
|
96
95
|
}
|
|
97
96
|
var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
|
|
98
97
|
// only for test while testurl?host=https://xxxxx.test.html
|
|
99
|
-
// 目前所有的elementProcessor中都会传入elementLink, 理论上Element场景该函数都会在这里直接返回
|
|
100
98
|
if (elementLink) {
|
|
101
99
|
return elementLink;
|
|
102
100
|
}
|
|
@@ -105,7 +103,7 @@ export var getAppPath = function getAppPath() {
|
|
|
105
103
|
}
|
|
106
104
|
// 地址应用特殊处理
|
|
107
105
|
if (componentSign === ComponentSignEnum.ELEMENT_ADDRESS) {
|
|
108
|
-
return "".concat(v2AppMarmotMap[environment], "/element-address/pages/address/index.html");
|
|
106
|
+
return "".concat(v2AppMarmotMap[environment], "/element-address/").concat(finalAppVersion, "/pages/address/index.html");
|
|
109
107
|
}
|
|
110
108
|
// element应用特殊处理
|
|
111
109
|
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
|
|
@@ -119,12 +117,12 @@ export var getAppPath = function getAppPath() {
|
|
|
119
117
|
}
|
|
120
118
|
if (isExpressCheckout) {
|
|
121
119
|
// express_checkout模式走单独映射
|
|
122
|
-
return "".concat(v2AppMarmotMap[environment], "/elements/pages/express_checkout/index.html");
|
|
120
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/express_checkout/index.html");
|
|
123
121
|
} else {
|
|
124
|
-
return "".concat(v2AppMarmotMap[environment], "/elements/pages/").concat(productScene.toLowerCase(), "/index.html");
|
|
122
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
|
-
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.html");
|
|
125
|
+
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
|
128
126
|
};
|
|
129
127
|
export var getAppDomain = function getAppDomain(domainParams) {
|
|
130
128
|
var environment = domainParams.environment,
|
|
@@ -185,7 +183,6 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
|
185
183
|
sdkVersion: sdkVersion,
|
|
186
184
|
refUrl: window.location.href,
|
|
187
185
|
_componentStartTime: "".concat(Date.now()),
|
|
188
|
-
_proxyCostTime: "".concat(getProxyCostTime(productScene)),
|
|
189
186
|
isPreload: isPreload || '',
|
|
190
187
|
hostSign: hostSign || ''
|
|
191
188
|
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type EventPayload, type IPaymentSessionMetaData } from '../../types';
|
|
2
|
+
import { Logger } from '../../util/logger';
|
|
3
|
+
export type IChannelBehavior = {
|
|
4
|
+
usePaymentSessionAsQueryResult: boolean;
|
|
5
|
+
submitPayInSdk: boolean;
|
|
6
|
+
createIframeNode: boolean;
|
|
7
|
+
loadApp: boolean;
|
|
8
|
+
buildSubmitPayExtParams?: (params: GetDoubleFaParams) => any;
|
|
9
|
+
allowClickOutsideClose?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type GetDoubleFaParams = {
|
|
12
|
+
instanceId: string;
|
|
13
|
+
paymentSessionData: string;
|
|
14
|
+
paymentSessionObj: IPaymentSessionMetaData;
|
|
15
|
+
locale: string;
|
|
16
|
+
paymentMethodType: string;
|
|
17
|
+
env: string;
|
|
18
|
+
sdkVersion: string;
|
|
19
|
+
notRedirectAfterComplete: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData, notRedirectAfterComplete?: boolean): IChannelBehavior | undefined;
|
|
22
|
+
export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
|
|
23
|
+
export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
|
|
24
|
+
export declare class ApplePaySdk {
|
|
25
|
+
private APPLESDKURL;
|
|
26
|
+
private session;
|
|
27
|
+
private paymentSessionData;
|
|
28
|
+
private parseData;
|
|
29
|
+
/**
|
|
30
|
+
* @description 支付状态,pending:支付中,normal:正常
|
|
31
|
+
*/
|
|
32
|
+
private paymentStatus;
|
|
33
|
+
private logger;
|
|
34
|
+
constructor({ paymentSessionData, parseData, logger, }: {
|
|
35
|
+
paymentSessionData: string;
|
|
36
|
+
parseData: IPaymentSessionMetaData;
|
|
37
|
+
logger: Logger;
|
|
38
|
+
});
|
|
39
|
+
startPay(): Promise<unknown>;
|
|
40
|
+
begin(): Promise<unknown>;
|
|
41
|
+
private submitPay;
|
|
42
|
+
private setPayStatus;
|
|
43
|
+
initApplePaySession(): Promise<never>;
|
|
44
|
+
private abortSession;
|
|
45
|
+
private get initSessionParams();
|
|
46
|
+
private get isRequiredParameters();
|
|
47
|
+
private isCanMakePayments;
|
|
48
|
+
private loadApplePaySdk;
|
|
49
|
+
private get checkScriptIsLoaded();
|
|
50
|
+
/**
|
|
51
|
+
* @description 非标方案,sdk目前无法直接监听国内不支持弹窗的关闭操作
|
|
52
|
+
*/
|
|
53
|
+
private addEventListener;
|
|
54
|
+
private getDeviceId;
|
|
55
|
+
}
|
|
56
|
+
export declare const isSkipRenderPaymentMethod: (parseData: IPaymentSessionMetaData) => boolean;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentSignEnum, PlatformEnum } from '../../types';
|
|
2
|
+
interface Options {
|
|
3
|
+
componentSign?: ComponentSignEnum;
|
|
4
|
+
type: 'tabs' | 'Accordion';
|
|
5
|
+
isExpressCheckout?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const inlineComponentAddCss: () => void;
|
|
8
|
+
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: PlatformEnum, options: Options) => void;
|
|
9
|
+
export declare const createInlineBaseElement: (selector: string, containerId?: string, selectorId?: string) => HTMLDivElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PlatformEnum } from '../../types';
|
|
2
|
+
export declare const componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 0px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n height: 100%;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 12px;\n overflow: hidden;\n transform-origin: 50% 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translate(-50%, -50%) scale(1);\n -webkit-transform: translate(-50%, -50%) scale(1);\n opacity: 1\n }\n\n 100% {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.4);\n -webkit-transform: translate(-50%, -50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translate(-50%, -50%) scale(0.4);\n opacity: 0\n }\n\n 100% {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n border-radius: 8px;\n overflow: hidden;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n\n.asm-component-close-block-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n\n.asm-component-close-block-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n\n.ams-component-mask-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n top: 10px;\n cursor: pointer;\n z-index: 1013;\n}\n \n.ams-component-mask-close-block-mobile {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 18px;\n cursor: pointer;\n z-index: 1012;\n}\n\n.ams-component-mask-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n\n.ams-component-mask-close-block-btn {\n width: 24px;\n height: 24px;\n object-fit: fill;\n position: absolute;\n right: 8px;\n top: 8px;\n}\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n border-radius: 12px 12px 0 0;\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n -webkit-animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards;\n -webkit-animation-fill-mode: forwards;\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n padding: 0 6px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 159px;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n box-sizing: border-box;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n padding: 0 6px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n padding: 0 16px;\n max-width: 225px;\n min-width: 144px;\n}\n.ams-component-mockup-hidden{\nanimation: ams-component-mockup-opacity 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes ams-component-mockup-opacity {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n}\n\n";
|
|
3
|
+
export declare const componentAddCSS: () => void;
|
|
4
|
+
export declare const createBaseElement: (platform: PlatformEnum, closeBtnFunc: () => void) => HTMLDivElement;
|
|
5
|
+
export declare const createCloseBtn: (platform: PlatformEnum, closeBtnFunc: () => void) => void;
|
|
6
|
+
export declare const createMaskCloseButton: (platform: PlatformEnum, closeBtnFunc: () => void) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 弹出离开挽留弹窗
|
|
9
|
+
* @param platform
|
|
10
|
+
* @param remainBtnFunc
|
|
11
|
+
* @param leaveBtnFunc
|
|
12
|
+
*/
|
|
13
|
+
export declare const createRetentionPopup: (platform: PlatformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
|
14
|
+
export declare const hideRetentionPopup: () => void;
|
|
15
|
+
export declare const removeRetentionPopup: (platform: PlatformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
|
16
|
+
export declare const createMockup: (options: {
|
|
17
|
+
platform: PlatformEnum;
|
|
18
|
+
onClickOutside: () => void;
|
|
19
|
+
closeBtnFunc: () => void;
|
|
20
|
+
}) => void;
|
|
21
|
+
export declare const addPopupLoading: () => void;
|
|
22
|
+
export declare const handleDeclareInfo: ({ closeDialogData }: {
|
|
23
|
+
closeDialogData: any;
|
|
24
|
+
}) => void;
|
|
25
|
+
export declare const slideInAndOutKeyframes: (id: any, height: any) => string;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type AMSCheckout from '../../core/instance';
|
|
2
|
+
import type { EventPayload, EventPayloadContext, IappendIframeNodesParams, IMerchantAppointParam, Iselector } from '../../types';
|
|
3
|
+
import { ComponentSignEnum, DeviceIdParameter, DisplayTypeEnum, PlatformEnum } from '../../types';
|
|
4
|
+
type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: DisplayTypeEnum) => Promise<void>;
|
|
5
|
+
export default class ComponentApp {
|
|
6
|
+
app: null | HTMLIFrameElement;
|
|
7
|
+
AMSSDK: AMSCheckout;
|
|
8
|
+
platform: PlatformEnum;
|
|
9
|
+
_performanceData: any[];
|
|
10
|
+
_loadAppPromiseResolve: ((value: boolean) => void) | null;
|
|
11
|
+
_isInitComponent: boolean;
|
|
12
|
+
private _globalData?;
|
|
13
|
+
private popupApp?;
|
|
14
|
+
private appDomain;
|
|
15
|
+
private createIframeNode;
|
|
16
|
+
private createPreloadIframeNode;
|
|
17
|
+
private _selector;
|
|
18
|
+
private _appVersion;
|
|
19
|
+
private _isRetention;
|
|
20
|
+
private _allowSubmitPayCallAhead;
|
|
21
|
+
private _actionQueryPromise;
|
|
22
|
+
private _actionSubmitPromise;
|
|
23
|
+
private _renderParams;
|
|
24
|
+
private _componentSign;
|
|
25
|
+
private _appLocationSearch;
|
|
26
|
+
private _renderDisplayType;
|
|
27
|
+
private _multipleCallbackEvents;
|
|
28
|
+
private _isAppWebview;
|
|
29
|
+
private _isNativeAppWebview;
|
|
30
|
+
_merchantAppointParam: IMerchantAppointParam;
|
|
31
|
+
private _webAppHeartBeatTimeoutFn;
|
|
32
|
+
private _hasRenderComponent;
|
|
33
|
+
constructor(componentOption?: {
|
|
34
|
+
appVersion?: string;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* @description Cancel listening and destroy the dom
|
|
38
|
+
*/
|
|
39
|
+
logoutPlugin(): void;
|
|
40
|
+
/**
|
|
41
|
+
* @description When SDK registers plug-ins, it is a required function to receive SDK instances
|
|
42
|
+
*/
|
|
43
|
+
applyPlugin(AMSSDK: AMSCheckout): void;
|
|
44
|
+
private initLoggerMeta;
|
|
45
|
+
/**
|
|
46
|
+
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
|
47
|
+
*/
|
|
48
|
+
setRender(renderFunc: IrenderFuncParams): void;
|
|
49
|
+
setPreloadRender(renderFunc: any): void;
|
|
50
|
+
private initSecurity;
|
|
51
|
+
private logDeviceId;
|
|
52
|
+
getDeviceIdAndLog(deviceIdParameter?: DeviceIdParameter, isPolling?: boolean): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* @description render iframe content
|
|
55
|
+
*/
|
|
56
|
+
appendIframeNodes(componentSign: ComponentSignEnum, renderParams: IappendIframeNodesParams): Promise<void>;
|
|
57
|
+
appendPreloadIframeNodes(componentSign: any, productSceneVersion: any): void;
|
|
58
|
+
private setParameterDefaultValues;
|
|
59
|
+
private renderInlineLoading;
|
|
60
|
+
private renderPopupLoading;
|
|
61
|
+
_createLoadAppPromise(loadTimeLimit?: number): Promise<unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* @description Interface request
|
|
64
|
+
*/
|
|
65
|
+
private createActionQueryPromise;
|
|
66
|
+
private createSubmitPromise;
|
|
67
|
+
private cleanElement;
|
|
68
|
+
private createPreloadApp;
|
|
69
|
+
/**
|
|
70
|
+
* @description Create app
|
|
71
|
+
*/
|
|
72
|
+
private createApp;
|
|
73
|
+
private listener;
|
|
74
|
+
private resizeListener;
|
|
75
|
+
private createDialog;
|
|
76
|
+
private getDeviceIdAndCallback;
|
|
77
|
+
private getUserAgentAndCallback;
|
|
78
|
+
private returnDataAndCallback;
|
|
79
|
+
/**
|
|
80
|
+
* @description Initialize subscription iframe message
|
|
81
|
+
*/
|
|
82
|
+
private addEventListener;
|
|
83
|
+
private removeEventListener;
|
|
84
|
+
private elementEventCallback;
|
|
85
|
+
/**
|
|
86
|
+
* @description Processing messages from iframe
|
|
87
|
+
*/
|
|
88
|
+
_handleAppMessage(data: EventPayload): void;
|
|
89
|
+
private logEventCallback;
|
|
90
|
+
private dismissLoadingFunc;
|
|
91
|
+
private updateMaskCloseBtn;
|
|
92
|
+
private handleSizeChanged;
|
|
93
|
+
private handleAuthUrlInfo;
|
|
94
|
+
private handleRedirect;
|
|
95
|
+
private handleDeclareInfo;
|
|
96
|
+
private handleDeclarePopWindowCallback;
|
|
97
|
+
private handleAppHeartBeat;
|
|
98
|
+
private isAppAttached;
|
|
99
|
+
private isWindowVisible;
|
|
100
|
+
private handleCloseBtnShow;
|
|
101
|
+
private handleMaskCloseBtnShow;
|
|
102
|
+
/**
|
|
103
|
+
* @description Send message to SDK
|
|
104
|
+
*/
|
|
105
|
+
dispatchToSDK(event: string, data: any, eventCallbackId?: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* @description Send message to iframe
|
|
108
|
+
*/
|
|
109
|
+
dispatchToApp(payload: {
|
|
110
|
+
context: EventPayloadContext;
|
|
111
|
+
}, targetElement?: any): any;
|
|
112
|
+
/**
|
|
113
|
+
* @description Subscribe to messages from SDK
|
|
114
|
+
*/
|
|
115
|
+
private subscribeFromSDK;
|
|
116
|
+
/**
|
|
117
|
+
* @description Send rendering events to iframe
|
|
118
|
+
*/
|
|
119
|
+
private sendRenderEvent;
|
|
120
|
+
/**
|
|
121
|
+
* @description close cashier
|
|
122
|
+
*/
|
|
123
|
+
private cleanContainer;
|
|
124
|
+
private hideComponentAnimation;
|
|
125
|
+
private closeBtnFunc;
|
|
126
|
+
private retentionPopupLeaveFunc;
|
|
127
|
+
private removeRetentionPopup;
|
|
128
|
+
private showRetentionPopup;
|
|
129
|
+
private hideRetentionPopupFunc;
|
|
130
|
+
private submitForm;
|
|
131
|
+
shouldValidateFields(): boolean;
|
|
132
|
+
}
|
|
133
|
+
export {};
|
|
@@ -0,0 +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;
|
|
4
|
+
export declare const insertStyleSheet: () => void;
|
|
5
|
+
export declare const createModal: ({ device, url, widthPadding, loadingConfig }: {
|
|
6
|
+
device: any;
|
|
7
|
+
url: any;
|
|
8
|
+
widthPadding: any;
|
|
9
|
+
loadingConfig: any;
|
|
10
|
+
}) => Promise<HTMLIFrameElement>;
|
|
11
|
+
export declare const destroyModal: () => void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type AMSCheckout from '../../core/instance';
|
|
2
|
+
import type { IcreatePaymentParams, EventPayload } from '../../types';
|
|
3
|
+
export default class CheckoutApp {
|
|
4
|
+
app: any;
|
|
5
|
+
paymentMethodsResult: any;
|
|
6
|
+
appDomain: string;
|
|
7
|
+
AMSSDK: AMSCheckout;
|
|
8
|
+
private _render;
|
|
9
|
+
private _selector;
|
|
10
|
+
private _version;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* @description When SDK registers plug-ins, it is a required function to receive SDK instances
|
|
14
|
+
*/
|
|
15
|
+
applyPlugin(AMSSDK: AMSCheckout): void;
|
|
16
|
+
/**
|
|
17
|
+
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
|
18
|
+
*/
|
|
19
|
+
setRender(createIframeNode: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* @description High order function of rendering capability
|
|
22
|
+
*/
|
|
23
|
+
render(renderParams: IcreatePaymentParams): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* @description Cancel listening and destroy the dom
|
|
26
|
+
*/
|
|
27
|
+
logoutPlugin(): void;
|
|
28
|
+
/**
|
|
29
|
+
* @description Create app
|
|
30
|
+
*/
|
|
31
|
+
private _createApp;
|
|
32
|
+
private _getIframeUrl;
|
|
33
|
+
/**
|
|
34
|
+
* @description Create iframe
|
|
35
|
+
*/
|
|
36
|
+
private _createIframe;
|
|
37
|
+
/**
|
|
38
|
+
* @description Get iftame id
|
|
39
|
+
*/
|
|
40
|
+
private _getIframeId;
|
|
41
|
+
_listener(e: any): void;
|
|
42
|
+
/**
|
|
43
|
+
* @description Initialize subscription iframe message
|
|
44
|
+
*/
|
|
45
|
+
_addEventListener(): void;
|
|
46
|
+
_removeEventListener(): void;
|
|
47
|
+
/**
|
|
48
|
+
* @description Processing messages from iframe
|
|
49
|
+
*/
|
|
50
|
+
_handleAppMessage(data: EventPayload): void;
|
|
51
|
+
/**
|
|
52
|
+
* @description Send message to SDK
|
|
53
|
+
*/
|
|
54
|
+
_dispatchToSDK(data: EventPayload): void;
|
|
55
|
+
/**
|
|
56
|
+
* @description Send message to iframe
|
|
57
|
+
*/
|
|
58
|
+
_dispatchToApp(data: EventPayload): void;
|
|
59
|
+
/**
|
|
60
|
+
* @description Subscribe to messages from SDK
|
|
61
|
+
*/
|
|
62
|
+
_subscribeFromSDK(): void;
|
|
63
|
+
/**
|
|
64
|
+
* @description Send rendering events to iframe
|
|
65
|
+
*/
|
|
66
|
+
_renderPaymentMethods(paymentResult: any): void;
|
|
67
|
+
/**
|
|
68
|
+
* @description Send the post submission processing event, and the cashier applies the consumption result
|
|
69
|
+
*/
|
|
70
|
+
_handleRequestPayment(data: EventPayload): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BusContext, BusMessage, BusSubscriber } from '../../core/bus';
|
|
2
|
+
import { Logger } from '../../util/logger';
|
|
3
|
+
export declare class PaypalBusSubscriber extends BusSubscriber {
|
|
4
|
+
logger: Logger;
|
|
5
|
+
constructor(logger: Logger);
|
|
6
|
+
actionNames(): string[];
|
|
7
|
+
private onEventCallback;
|
|
8
|
+
protected renderPaypalButton(context: BusContext, message: BusMessage): Promise<never>;
|
|
9
|
+
private appendPaypalLoading;
|
|
10
|
+
private removePaypalLoading;
|
|
11
|
+
private preCheck;
|
|
12
|
+
private loadPaypalResource;
|
|
13
|
+
private createPaypalScript;
|
|
14
|
+
private onShippingChange;
|
|
15
|
+
private createOrder;
|
|
16
|
+
private onApprove;
|
|
17
|
+
private onCancel;
|
|
18
|
+
private destroyComponent;
|
|
19
|
+
onMessage(context: BusContext, message: BusMessage): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BusSubscriber } from '../core/bus';
|
|
2
|
+
import { PaymentMethodCategoryTypeEnum, ProductSceneEnum, ProductSceneVersion } from '../types';
|
|
3
|
+
export type IExtendPlugin = IExtendPluginItem[];
|
|
4
|
+
export interface ComponentActionNamesType {
|
|
5
|
+
canMakePayments?: string;
|
|
6
|
+
optional_init?: string;
|
|
7
|
+
createComponent?: string;
|
|
8
|
+
mountComponent?: string;
|
|
9
|
+
submit?: string;
|
|
10
|
+
destroyComponent?: string;
|
|
11
|
+
getValue?: string;
|
|
12
|
+
}
|
|
13
|
+
export type IExtendPluginItem = {
|
|
14
|
+
/**
|
|
15
|
+
* 以下为sessionData匹配的场景
|
|
16
|
+
*/
|
|
17
|
+
sessionMatcher?: {
|
|
18
|
+
productScene: ProductSceneEnum;
|
|
19
|
+
productSceneVersion: ProductSceneVersion;
|
|
20
|
+
paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
|
|
21
|
+
paymentMethodTypes: string[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 用于无sessionData场景,比如:canMakePayments
|
|
25
|
+
*/
|
|
26
|
+
paymentChannelMatcher?: {
|
|
27
|
+
paymentMethod: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 以下plugin 实现的定义
|
|
31
|
+
*/
|
|
32
|
+
busActionNames: ComponentActionNamesType;
|
|
33
|
+
busSubscriber?: BusSubscriber;
|
|
34
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RequestConfig } from '../types';
|
|
2
|
+
import type { Logger } from '../util/logger';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param requestData 请求参数
|
|
6
|
+
* @param options 请求配置
|
|
7
|
+
* @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
|
|
8
|
+
*/
|
|
9
|
+
export declare function request<T>(requestData: Record<string, any> | undefined, options: RequestConfig, logger: Logger): Promise<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { errorEnum } from '../types';
|
|
9
|
+
export declare const safeJson: (data: any, obj: any) => any;
|
|
10
|
+
export declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
|
|
11
|
+
success: boolean;
|
|
12
|
+
traceId: string;
|
|
13
|
+
errorCode: errorEnum;
|
|
14
|
+
resultStatus: any;
|
|
15
|
+
errorMessage?: undefined;
|
|
16
|
+
result?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
success: boolean;
|
|
19
|
+
traceId: string;
|
|
20
|
+
errorCode: errorEnum;
|
|
21
|
+
errorMessage: string;
|
|
22
|
+
result: {
|
|
23
|
+
resultStatus: any;
|
|
24
|
+
tips: string;
|
|
25
|
+
memo: string;
|
|
26
|
+
};
|
|
27
|
+
resultStatus: any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApplePayPaymentSessionRequest, ApplePayPaymentSessionResult, CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
|
2
|
+
import type { Logger } from '../util/logger';
|
|
3
|
+
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
|
4
|
+
export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
|
|
5
|
+
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|
|
6
|
+
/**
|
|
7
|
+
* Get merchant session by Apple Pay
|
|
8
|
+
* @param paymentSessionData
|
|
9
|
+
* @param params
|
|
10
|
+
* @param options
|
|
11
|
+
* @param logger
|
|
12
|
+
*/
|
|
13
|
+
export declare function getApplePayPaymentSession(paymentSessionData: string, params: ApplePayPaymentSessionRequest, options: RequestConfig, logger: Logger): Promise<ApplePayPaymentSessionResult>;
|