@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,36 @@
|
|
|
1
|
+
export declare enum PaymentActionEnum {
|
|
2
|
+
optional_init = "plugin_optional_init"
|
|
3
|
+
}
|
|
4
|
+
export declare enum ApplePayActionEnum {
|
|
5
|
+
canMakePayments = "plugin_CARD_APPLE_PAY_available",
|
|
6
|
+
createComponent = "plugin_CARD_APPLE_PAY_createComponent",
|
|
7
|
+
destroyComponent = "plugin_CARD_APPLE_PAY_destroyComponent"
|
|
8
|
+
}
|
|
9
|
+
export declare enum PaypalActionEnum {
|
|
10
|
+
mountComponent = "plugin_Paypal_mountComponent",
|
|
11
|
+
destroyComponent = "plugin_Paypal_destroyComponent"
|
|
12
|
+
}
|
|
13
|
+
export declare enum SDKCallbackActionEnum {
|
|
14
|
+
onEventCallback = "onEventCallback"
|
|
15
|
+
}
|
|
16
|
+
export declare enum SecuritySDKActionEnum {
|
|
17
|
+
getSecurityDeviceId = "getSecurityDeviceId"
|
|
18
|
+
}
|
|
19
|
+
export declare enum TrackerActionEnum {
|
|
20
|
+
/**
|
|
21
|
+
* level: string info/error
|
|
22
|
+
* basic: json object
|
|
23
|
+
* extra: json object
|
|
24
|
+
*/
|
|
25
|
+
reportAnalytics = "reportAnalytics"
|
|
26
|
+
}
|
|
27
|
+
export declare enum ComponentActiontEnum {
|
|
28
|
+
onDestory = "onDestory"
|
|
29
|
+
}
|
|
30
|
+
export declare enum RequestActiontEnum {
|
|
31
|
+
onDestory = "httpRequest"
|
|
32
|
+
}
|
|
33
|
+
export declare enum LoadingActiontEnum {
|
|
34
|
+
showLoading = "showLoading",
|
|
35
|
+
dismissLoading = "dismissLoading"
|
|
36
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function loadChannelPneumaticControl(paymentSessionFactor: any, logger: any): Promise<unknown>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IcreateComponent, IoptionsParams } from '../../../types';
|
|
2
|
+
import { Logger } from '../../../util/logger';
|
|
3
|
+
type LOCAL_URL = string;
|
|
4
|
+
export type CKPEmbeddedAppEnv = 'dev' | 'sit' | 'pre' | 'prod';
|
|
5
|
+
export type CKPEmbeddedEventType = 'SDK_PAYMENT_SUCCESSFUL' | 'SDK_PAYMENT_FAIL' | 'SDK_PAYMENT_CANCEL' | 'SDK_PAYMENT_CLICK_BACK_TO_MERCHANT';
|
|
6
|
+
export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL) => string;
|
|
7
|
+
export declare class AMSCheckoutPage {
|
|
8
|
+
logger: Logger;
|
|
9
|
+
private _instanceId;
|
|
10
|
+
private iframe;
|
|
11
|
+
private originOptions;
|
|
12
|
+
private readonly APP_IFRAME_ID;
|
|
13
|
+
private eventListener?;
|
|
14
|
+
constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>);
|
|
15
|
+
private generateIframeSrc;
|
|
16
|
+
private eventListenerWrapper;
|
|
17
|
+
private addListener;
|
|
18
|
+
private removeListener;
|
|
19
|
+
private dispatchToApp;
|
|
20
|
+
/**
|
|
21
|
+
* 挂载组件
|
|
22
|
+
*/
|
|
23
|
+
mountComponent(params: Pick<IcreateComponent, 'sessionData'>, selector: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 卸载组件
|
|
26
|
+
*/
|
|
27
|
+
unmount(): void;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LogService } from '../../../../foundation/service/log';
|
|
2
|
+
export declare class EventCenter {
|
|
3
|
+
private activeEvents;
|
|
4
|
+
private heartbeatIntervalId;
|
|
5
|
+
private readonly HEARTBEAT_INTERVAL;
|
|
6
|
+
private uniqueId;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor({ logger }: {
|
|
9
|
+
logger: LogService;
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* 注册事件
|
|
13
|
+
* @param {string} functionName 函数名称
|
|
14
|
+
* @returns {string} 返回事件起始ID
|
|
15
|
+
*/
|
|
16
|
+
registerEvent(functionName: string, sessionData?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* 结束事件
|
|
19
|
+
* @param startId 事件起始ID
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
endEvent(startId: string, extra?: any): void;
|
|
23
|
+
private startHeartbeat;
|
|
24
|
+
private stopHeartbeat;
|
|
25
|
+
private sendHeartbeat;
|
|
26
|
+
private sendLog;
|
|
27
|
+
private buildId;
|
|
28
|
+
private getEventName;
|
|
29
|
+
private buildIdFromStart;
|
|
30
|
+
private getEventNameFromStart;
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import BaseElementProcessor from '../elementProcessor/baseElementProcessor';
|
|
2
|
+
import { ContainerService } from './../../../../foundation/service/container';
|
|
3
|
+
import { EventCenter } from './../../../../foundation/service/event-center';
|
|
4
|
+
export declare enum IContainerStatus {
|
|
5
|
+
UNINIT = "UNINIT",
|
|
6
|
+
INITING = "INITING",
|
|
7
|
+
READY = "READY",
|
|
8
|
+
IN_BIZ_FLOW = "IN_BIZ_FLOW",
|
|
9
|
+
DESTROYED = "DESTROYED"
|
|
10
|
+
}
|
|
11
|
+
export declare class ContainerController {
|
|
12
|
+
private containerStatus;
|
|
13
|
+
private instanceId;
|
|
14
|
+
private containerService;
|
|
15
|
+
private eventService;
|
|
16
|
+
private containerElement;
|
|
17
|
+
private _globalData?;
|
|
18
|
+
constructor({ type, instanceId, selector, processor, options, }: {
|
|
19
|
+
type: string;
|
|
20
|
+
instanceId: string;
|
|
21
|
+
selector: string;
|
|
22
|
+
processor: BaseElementProcessor;
|
|
23
|
+
options: any;
|
|
24
|
+
});
|
|
25
|
+
private addEventListener;
|
|
26
|
+
getContainerElement(): HTMLDivElement;
|
|
27
|
+
createWebLaunchPromise(): Promise<unknown>;
|
|
28
|
+
switchContainerStatus(status: IContainerStatus): void;
|
|
29
|
+
getContainerStatus(): IContainerStatus;
|
|
30
|
+
getEventService(): EventCenter;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
getContainerService(): ContainerService;
|
|
33
|
+
getInstanceId(): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ElementType } from '../type';
|
|
2
|
+
import { ContainerController } from './containerService';
|
|
3
|
+
export declare class ElementContainerService {
|
|
4
|
+
private containerServices;
|
|
5
|
+
private instanceId;
|
|
6
|
+
constructor({ instanceId }: {
|
|
7
|
+
instanceId: any;
|
|
8
|
+
});
|
|
9
|
+
addContainerService(name: ElementType, service: ContainerController): void;
|
|
10
|
+
getContainerService(name: ElementType): ContainerController | undefined;
|
|
11
|
+
getContainerServices(): Map<ElementType, ContainerController>;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
mount({ type, selector, processor, options }: {
|
|
14
|
+
type: any;
|
|
15
|
+
selector: any;
|
|
16
|
+
processor: any;
|
|
17
|
+
options: any;
|
|
18
|
+
}): void;
|
|
19
|
+
getEventService(name: ElementType): import("../../../../foundation/service/event-center").EventCenter;
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AddressMountOptions, ICommonApiResponse, IElementOptions, IPaymentApiResponse, LinkAuthMountOptions, PaymentMountOptions } from '../type';
|
|
2
|
+
declare class ElementController {
|
|
3
|
+
private options;
|
|
4
|
+
private elementContainer;
|
|
5
|
+
private serviceMap;
|
|
6
|
+
private loading;
|
|
7
|
+
private elementProcessors;
|
|
8
|
+
private initTimeout;
|
|
9
|
+
private elementContainerService;
|
|
10
|
+
private onStatusChangeCallback;
|
|
11
|
+
private submitPayPromise;
|
|
12
|
+
private elementEventCenter;
|
|
13
|
+
constructor(options: IElementOptions);
|
|
14
|
+
private initService;
|
|
15
|
+
private initElementProcessors;
|
|
16
|
+
private onEventCallback;
|
|
17
|
+
/**
|
|
18
|
+
* 处理初始化错误的方法
|
|
19
|
+
*/
|
|
20
|
+
private handleInitializationError;
|
|
21
|
+
private handleMountError;
|
|
22
|
+
private clearAndSetInitTimeout;
|
|
23
|
+
private setInitTimeout;
|
|
24
|
+
private initializeAndMountProcessor;
|
|
25
|
+
private handleStartBizFlowError;
|
|
26
|
+
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string): Promise<ICommonApiResponse>;
|
|
27
|
+
private onValidateFunc;
|
|
28
|
+
private onValidateAndSubmitPay;
|
|
29
|
+
/**
|
|
30
|
+
* 25/09/08 新增商户主动校验api
|
|
31
|
+
* @returns {Promise<{isValid: boolean}>}
|
|
32
|
+
*/
|
|
33
|
+
validateFields(): Promise<{
|
|
34
|
+
isValid: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
submitPayment(): Promise<IPaymentApiResponse>;
|
|
37
|
+
private changeLoading;
|
|
38
|
+
private addEventListener;
|
|
39
|
+
private sendRequestAndWaitWebLaunch;
|
|
40
|
+
private getErrorFromResponse;
|
|
41
|
+
private areAllContainersReady;
|
|
42
|
+
private sendReady;
|
|
43
|
+
updatePayment(paymentSessionData: any): Promise<unknown>;
|
|
44
|
+
private destroyHandle;
|
|
45
|
+
destroy(): void;
|
|
46
|
+
private setControllerStatusOrView;
|
|
47
|
+
}
|
|
48
|
+
export default ElementController;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BaseElementProcessor from './baseElementProcessor';
|
|
2
|
+
declare class AddressProcessor extends BaseElementProcessor {
|
|
3
|
+
onReady(extraParam: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}): void;
|
|
6
|
+
parameterInitAndCheck(): void;
|
|
7
|
+
beforeMount(): void;
|
|
8
|
+
preload(): void;
|
|
9
|
+
generateIframeSrc({ link, instanceId }: {
|
|
10
|
+
link: any;
|
|
11
|
+
instanceId: any;
|
|
12
|
+
}): string;
|
|
13
|
+
obtainData(): any;
|
|
14
|
+
getValue(hasValidate?: boolean): any;
|
|
15
|
+
update({ data, paymentSessionData }: {
|
|
16
|
+
data: any;
|
|
17
|
+
paymentSessionData: any;
|
|
18
|
+
}): void;
|
|
19
|
+
}
|
|
20
|
+
export default AddressProcessor;
|
|
@@ -20,8 +20,8 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
20
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
21
|
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; } }
|
|
22
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
-
import { ELEMENT_PAGE_URL } from "../../../../constant/element";
|
|
24
23
|
import { parseSessionData } from "../..";
|
|
24
|
+
import { ADDRESSElementAppVersion } from "../../../../config";
|
|
25
25
|
import { ProductSceneEnum } from "../../../../types";
|
|
26
26
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
|
27
27
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
@@ -95,6 +95,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
95
95
|
environment = _this$options.env.environment,
|
|
96
96
|
analytics = _this$options.analytics,
|
|
97
97
|
locale = _this$options.locale;
|
|
98
|
+
var pageUrl = "/element-address/".concat(ADDRESSElementAppVersion, "/pages/address/index.html");
|
|
98
99
|
return _generateIframeSrc({
|
|
99
100
|
paymentSession: paymentSession,
|
|
100
101
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -103,7 +104,7 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
103
104
|
locale: locale,
|
|
104
105
|
link: link,
|
|
105
106
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
106
|
-
pageUrl:
|
|
107
|
+
pageUrl: pageUrl,
|
|
107
108
|
instanceId: instanceId
|
|
108
109
|
});
|
|
109
110
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BaseElementProcessor from './baseElementProcessor';
|
|
2
|
+
declare class AuthProcessor extends BaseElementProcessor {
|
|
3
|
+
onReady(extraParam: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}): void;
|
|
6
|
+
parameterInitAndCheck(): void;
|
|
7
|
+
beforeMount(): void;
|
|
8
|
+
preload(): void;
|
|
9
|
+
generateIframeSrc({ link, instanceId }: {
|
|
10
|
+
link: any;
|
|
11
|
+
instanceId: any;
|
|
12
|
+
}): string;
|
|
13
|
+
obtainData(): any;
|
|
14
|
+
getValue(): any;
|
|
15
|
+
update({ data, paymentSessionData }: {
|
|
16
|
+
data: any;
|
|
17
|
+
paymentSessionData: any;
|
|
18
|
+
}): void;
|
|
19
|
+
}
|
|
20
|
+
export default AuthProcessor;
|
|
@@ -17,7 +17,7 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
17
17
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
18
|
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; } }
|
|
19
19
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
-
import {
|
|
20
|
+
import { AUTHElementAppVersion } from "../../../../config";
|
|
21
21
|
import { parseSessionData } from "../../index";
|
|
22
22
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
|
23
23
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
@@ -69,6 +69,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
69
69
|
environment = _this$options.env.environment,
|
|
70
70
|
analytics = _this$options.analytics,
|
|
71
71
|
locale = _this$options.locale;
|
|
72
|
+
var pageUrl = "/auth-element/".concat(AUTHElementAppVersion, "/pages/element_auth/index.html");
|
|
72
73
|
return _generateIframeSrc({
|
|
73
74
|
paymentSession: paymentSession,
|
|
74
75
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -77,7 +78,7 @@ var AuthProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
77
78
|
locale: locale,
|
|
78
79
|
link: link,
|
|
79
80
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
80
|
-
pageUrl:
|
|
81
|
+
pageUrl: pageUrl,
|
|
81
82
|
instanceId: instanceId
|
|
82
83
|
});
|
|
83
84
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AntomSDKCore } from "../../../../foundation/core";
|
|
2
|
+
import { Ianalytics, Ienv } from '../../../../types';
|
|
3
|
+
import { EventCenter } from './../../../../foundation/service/event-center';
|
|
4
|
+
interface ElementProcessorOptions {
|
|
5
|
+
env: Ienv;
|
|
6
|
+
locale: string;
|
|
7
|
+
networkMode: string;
|
|
8
|
+
mode: string;
|
|
9
|
+
analytics?: Ianalytics;
|
|
10
|
+
product: string;
|
|
11
|
+
}
|
|
12
|
+
declare abstract class BaseElementProcessor {
|
|
13
|
+
elementContainer: AntomSDKCore;
|
|
14
|
+
instanceId: string;
|
|
15
|
+
options: ElementProcessorOptions;
|
|
16
|
+
obtainDataRes: any;
|
|
17
|
+
elementUrl: string;
|
|
18
|
+
eventCenter: EventCenter;
|
|
19
|
+
eventListener: {};
|
|
20
|
+
abstract beforeMount(): void;
|
|
21
|
+
abstract preload(): void;
|
|
22
|
+
abstract generateIframeSrc({ instanceId, link }: {
|
|
23
|
+
instanceId: any;
|
|
24
|
+
link: any;
|
|
25
|
+
}): string;
|
|
26
|
+
abstract obtainData(): any;
|
|
27
|
+
abstract getValue(): any;
|
|
28
|
+
abstract onReady(extraParam: {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}): void;
|
|
31
|
+
constructor(options: any);
|
|
32
|
+
private _setOptions;
|
|
33
|
+
abstract update(data: any): void;
|
|
34
|
+
registerElementContainer(elementContainer: AntomSDKCore): void;
|
|
35
|
+
registerEventCenter(eventCenter: EventCenter): void;
|
|
36
|
+
registerEventListener(event: any, callback: any): void;
|
|
37
|
+
setElementUrl(url: any): void;
|
|
38
|
+
getElementUrl(): string;
|
|
39
|
+
getObtainDataRes(): any;
|
|
40
|
+
}
|
|
41
|
+
export default BaseElementProcessor;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LogService } from "../../../../foundation/service/log";
|
|
2
|
+
import BaseElementProcessor from './baseElementProcessor';
|
|
3
|
+
declare class PaymentProcessor extends BaseElementProcessor {
|
|
4
|
+
private ApplePayService;
|
|
5
|
+
onReady(extraParam: any): void;
|
|
6
|
+
getLogger(): LogService;
|
|
7
|
+
private addEventListener;
|
|
8
|
+
private initApplePaySdk;
|
|
9
|
+
beforeMount(): void;
|
|
10
|
+
preload(): void;
|
|
11
|
+
generateIframeSrc({ link, instanceId }: {
|
|
12
|
+
link: any;
|
|
13
|
+
instanceId: any;
|
|
14
|
+
}): string;
|
|
15
|
+
obtainData(): Promise<any>;
|
|
16
|
+
getValue(): any;
|
|
17
|
+
update({ data, paymentSessionData }: {
|
|
18
|
+
data: any;
|
|
19
|
+
paymentSessionData: any;
|
|
20
|
+
}): void;
|
|
21
|
+
}
|
|
22
|
+
export default PaymentProcessor;
|
|
@@ -23,7 +23,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
23
23
|
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; }
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
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); }
|
|
26
|
-
import { ELEMENT_PAGE_URL } from "../../../../constant/element";
|
|
27
26
|
import { EVENT } from "../../../../constant";
|
|
28
27
|
import { ServiceProvider } from "../../../../foundation/service";
|
|
29
28
|
import { ApplePaySdk, handleGooglePay, isSkipRenderPaymentMethod } from "../../../../plugin/component/channel";
|
|
@@ -33,16 +32,8 @@ import { parseSessionData } from "../../index";
|
|
|
33
32
|
import { oneAccount, sdkAction } from "../mock";
|
|
34
33
|
import { generateIframeSrc as _generateIframeSrc, isElementPad, isElementPC, safeStringify } from "../util";
|
|
35
34
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
35
|
+
import { AMSPaymentElementAppVersion } from "../../../../config";
|
|
36
36
|
var logger = new Logger(LogConfig, true);
|
|
37
|
-
var isExpressCheckout = function isExpressCheckout(extendInfo) {
|
|
38
|
-
try {
|
|
39
|
-
var _JSON$parse;
|
|
40
|
-
var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
|
|
41
|
-
return !!expressCheckout;
|
|
42
|
-
} catch (_) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
37
|
var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
47
38
|
_inherits(PaymentProcessor, _BaseElementProcessor);
|
|
48
39
|
var _super = _createSuper(PaymentProcessor);
|
|
@@ -128,7 +119,6 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
128
119
|
});
|
|
129
120
|
});
|
|
130
121
|
});
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
122
|
this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
|
|
133
123
|
var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
|
|
134
124
|
paymentSessionId = _this2$elementContain.paymentSessionId,
|
|
@@ -161,12 +151,12 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
161
151
|
key: "initApplePaySdk",
|
|
162
152
|
value: function () {
|
|
163
153
|
var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
164
|
-
var _this$
|
|
165
|
-
var
|
|
154
|
+
var _this$elementContaine7;
|
|
155
|
+
var _this$elementContaine6, paymentSessionObj, paymentSessionId;
|
|
166
156
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
167
157
|
while (1) switch (_context.prev = _context.next) {
|
|
168
158
|
case 0:
|
|
169
|
-
|
|
159
|
+
_this$elementContaine6 = (_this$elementContaine7 = this.elementContainer) === null || _this$elementContaine7 === void 0 ? void 0 : _this$elementContaine7.getPaymentContext(), paymentSessionObj = _this$elementContaine6.paymentSessionObj, paymentSessionId = _this$elementContaine6.paymentSessionId;
|
|
170
160
|
if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
|
|
171
161
|
_context.next = 13;
|
|
172
162
|
break;
|
|
@@ -219,20 +209,28 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
219
209
|
}
|
|
220
210
|
}, {
|
|
221
211
|
key: "generateIframeSrc",
|
|
222
|
-
value: function generateIframeSrc(
|
|
223
|
-
var link =
|
|
224
|
-
instanceId =
|
|
212
|
+
value: function generateIframeSrc(_ref) {
|
|
213
|
+
var link = _ref.link,
|
|
214
|
+
instanceId = _ref.instanceId;
|
|
225
215
|
this.instanceId = instanceId;
|
|
226
|
-
var
|
|
227
|
-
paymentSession =
|
|
228
|
-
paymentSessionObj =
|
|
229
|
-
sdkMetaData =
|
|
216
|
+
var _ref2 = this.elementContainer.getPaymentContext() || {},
|
|
217
|
+
paymentSession = _ref2.paymentSession,
|
|
218
|
+
paymentSessionObj = _ref2.paymentSessionObj,
|
|
219
|
+
sdkMetaData = _ref2.sdkMetaData;
|
|
230
220
|
var _this$options = this.options,
|
|
231
221
|
environment = _this$options.env.environment,
|
|
232
222
|
analytics = _this$options.analytics,
|
|
233
223
|
locale = _this$options.locale;
|
|
234
|
-
var
|
|
235
|
-
extendInfo =
|
|
224
|
+
var _ref3 = paymentSessionObj || {},
|
|
225
|
+
extendInfo = _ref3.extendInfo;
|
|
226
|
+
var pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/element_payment/index.html");
|
|
227
|
+
try {
|
|
228
|
+
var _JSON$parse;
|
|
229
|
+
var expressCheckout = JSON.parse((_JSON$parse = JSON.parse(extendInfo)) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse.expressCheckout);
|
|
230
|
+
if (expressCheckout) {
|
|
231
|
+
pageUrl = "/elements/".concat(AMSPaymentElementAppVersion, "/pages/express_checkout/index.html");
|
|
232
|
+
}
|
|
233
|
+
} catch (error) {}
|
|
236
234
|
var url = _generateIframeSrc({
|
|
237
235
|
paymentSession: paymentSession,
|
|
238
236
|
paymentSessionObj: paymentSessionObj,
|
|
@@ -241,7 +239,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
241
239
|
locale: locale,
|
|
242
240
|
link: link,
|
|
243
241
|
appVersion: sdkMetaData === null || sdkMetaData === void 0 ? void 0 : sdkMetaData.webAppVersion,
|
|
244
|
-
pageUrl:
|
|
242
|
+
pageUrl: pageUrl,
|
|
245
243
|
instanceId: instanceId
|
|
246
244
|
});
|
|
247
245
|
this.setElementUrl(url);
|
|
@@ -253,16 +251,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
253
251
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
254
252
|
var _paymentSessionObj$co,
|
|
255
253
|
_this3 = this;
|
|
256
|
-
var requestService, _this$
|
|
254
|
+
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
|
257
255
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
258
256
|
while (1) switch (_context2.prev = _context2.next) {
|
|
259
257
|
case 0:
|
|
260
258
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
|
261
|
-
_this$
|
|
259
|
+
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
|
262
260
|
_displayInfo = displayInfo;
|
|
263
261
|
debugProps = _displayInfo.debugProps;
|
|
264
262
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
|
265
|
-
|
|
263
|
+
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
|
266
264
|
hostSign = paymentSession.split('&&')[1] || '';
|
|
267
265
|
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
|
268
266
|
LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
|
|
@@ -394,9 +392,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
394
392
|
}
|
|
395
393
|
}, {
|
|
396
394
|
key: "update",
|
|
397
|
-
value: function update(
|
|
398
|
-
var data =
|
|
399
|
-
paymentSessionData =
|
|
395
|
+
value: function update(_ref5) {
|
|
396
|
+
var data = _ref5.data,
|
|
397
|
+
paymentSessionData = _ref5.paymentSessionData;
|
|
400
398
|
var _parseSessionData = parseSessionData(paymentSessionData),
|
|
401
399
|
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
|
402
400
|
parseData = _parseSessionData2[0],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IElementOptions, PaymentMountOptions } from './type';
|
|
2
|
+
export declare class ElementComponent {
|
|
3
|
+
private options;
|
|
4
|
+
private controller;
|
|
5
|
+
constructor(options: IElementOptions);
|
|
6
|
+
updatePayment(paymentSessionData: any): Promise<unknown>;
|
|
7
|
+
mount(renderOptions: PaymentMountOptions, sdkSelector: string): Promise<import("./type").ICommonApiResponse>;
|
|
8
|
+
validateFields(): Promise<{
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
submitPayment(): Promise<import("./type").IPaymentApiResponse>;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const sdkAction1: any;
|
|
2
|
+
export declare const sdkAction2: any;
|
|
3
|
+
export declare const sdkAction: any;
|
|
4
|
+
export declare const oneAccount1: any;
|
|
5
|
+
export declare const oneAccount2: any;
|
|
6
|
+
export declare const oneAccount: any;
|
|
7
|
+
export declare const paymentResult: any;
|
|
8
|
+
export declare const submitResult: any;
|
|
9
|
+
export declare const sdkActionUpdate: any;
|
|
10
|
+
export declare const oneAccountUpdate: any;
|