@alipay/ams-checkout 0.0.1730107332-dev.4 → 0.0.1730706734-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/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +6 -1
- package/esm/constant/index.js +80 -3
- package/esm/core/bus/ability/callback.d.ts +9 -0
- package/esm/{foundation/service/api-bus → core/bus}/ability/callback.js +1 -1
- package/esm/core/bus/ability/globalData.d.ts +10 -0
- package/esm/{foundation/service/api-bus → core/bus}/ability/globalData.js +2 -2
- package/esm/{foundation/service/api-bus → core/bus}/ability/request.d.ts +1 -1
- package/esm/{foundation/service/api-bus → core/bus}/ability/request.js +2 -2
- package/esm/core/bus/ability/security.d.ts +10 -0
- package/esm/core/bus/ability/security.js +104 -0
- package/esm/core/bus/ability/tracker.d.ts +9 -0
- package/esm/core/bus/ability/tracker.js +77 -0
- package/esm/core/bus/index.d.ts +125 -0
- package/esm/core/bus/index.js +366 -0
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.d.ts +1 -0
- package/esm/core/component/appPreloadProcessing.js +91 -0
- package/esm/core/component/ckp/index.d.ts +27 -0
- package/esm/core/component/ckp/index.js +166 -0
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +59 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/element-mock.d.ts +2 -0
- package/esm/core/component/element/element-mock.js +263 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +776 -0
- package/esm/core/component/element/mock.d.ts +3 -0
- package/esm/core/component/element/mock.js +1156 -0
- package/esm/core/component/element/type.d.ts +176 -0
- package/esm/core/component/element/type.js +34 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +51 -0
- package/esm/core/component/index.js +535 -0
- package/esm/core/drop-in/index.d.ts +22 -0
- package/esm/core/drop-in/index.js +104 -0
- package/esm/core/instance/index.d.ts +89 -0
- package/esm/core/instance/index.js +500 -0
- package/esm/foundation/core/index.d.ts +3 -3
- package/esm/foundation/core/index.js +51 -114
- package/esm/foundation/index.d.ts +3 -5
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +4 -7
- package/esm/foundation/product-processor/easysafepay/deps.js +2 -5
- package/esm/foundation/product-processor/easysafepay/index.d.ts +4 -5
- package/esm/foundation/product-processor/easysafepay/index.js +114 -174
- package/esm/foundation/service/container/index.js +5 -5
- package/esm/foundation/service/container/popup.js +1 -1
- package/esm/foundation/service/event-bus/ability/callback.js +55 -0
- package/esm/foundation/service/{api-bus → event-bus}/ability/globalData.d.ts +1 -1
- package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/request.js +151 -0
- package/esm/foundation/service/{api-bus → event-bus}/ability/security.js +19 -29
- package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.js +1 -1
- package/esm/foundation/service/{api-bus → event-bus}/busManager.js +1 -1
- package/esm/foundation/service/event-center.d.ts +5 -4
- package/esm/foundation/service/event-center.js +39 -8
- package/esm/foundation/service/global-data/index.js +5 -4
- package/esm/foundation/service/index.js +1 -1
- package/esm/foundation/service/requester/requester.js +11 -14
- package/esm/foundation/service/security/index.d.ts +7 -9
- package/esm/foundation/service/security/index.js +44 -113
- package/esm/foundation/utils/redirect_utils.js +8 -24
- package/esm/foundation/utils/web_app_url_utils.d.ts +2 -11
- package/esm/foundation/utils/web_app_url_utils.js +2 -17
- package/esm/index.d.ts +30 -1
- package/esm/index.js +147 -7
- package/esm/plugin/applepay/component.d.ts +50 -0
- package/esm/plugin/applepay/component.js +339 -0
- package/esm/plugin/applepay/index.d.ts +17 -0
- package/esm/plugin/applepay/index.js +117 -0
- package/esm/plugin/applepay/interface.d.ts +161 -0
- package/esm/plugin/applepay/interface.js +69 -0
- package/esm/plugin/applepay/service.d.ts +54 -0
- package/esm/plugin/applepay/service.js +289 -0
- package/esm/plugin/component/cashierApp.d.ts +36 -0
- package/esm/plugin/component/cashierApp.js +245 -0
- package/esm/{component → plugin/component}/channel.d.ts +2 -1
- package/esm/{component → plugin/component}/channel.js +37 -1
- package/esm/{component → plugin/component}/component.inline.style.d.ts +2 -2
- package/esm/{component → plugin/component}/component.inline.style.js +7 -6
- package/esm/{component → plugin/component}/component.popup.style.d.ts +1 -1
- package/esm/{component → plugin/component}/component.popup.style.js +4 -4
- package/esm/plugin/component/index.d.ts +126 -0
- package/esm/plugin/component/index.js +1862 -0
- package/esm/{component → plugin/component}/popupWindow.style.js +2 -2
- package/esm/plugin/const.d.ts +2 -0
- package/esm/plugin/const.js +33 -0
- package/esm/plugin/drop-in/index.d.ts +71 -0
- package/esm/plugin/drop-in/index.js +324 -0
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +7 -0
- package/esm/plugin/paypal/index.d.ts +20 -0
- package/esm/plugin/paypal/index.js +390 -0
- package/esm/plugin/type.d.ts +34 -0
- package/esm/plugin/type.js +1 -0
- package/esm/plugin/utils.d.ts +6 -0
- package/esm/plugin/utils.js +21 -0
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +2 -0
- package/esm/types/index.d.ts +218 -22
- package/esm/types/index.js +47 -4
- package/esm/util/createIframeNode.d.ts +6 -0
- package/esm/util/createIframeNode.js +48 -0
- package/esm/util/getBackScheme.d.ts +2 -2
- package/esm/util/getBackScheme.js +2 -94
- package/esm/util/index.d.ts +11 -1
- package/esm/util/index.js +84 -4
- package/esm/util/intl-callapp/es/index.js +0 -1
- package/esm/util/ua/index.d.ts +2 -0
- package/esm/util/ua/index.js +2 -0
- package/esm/util/ua/isAndroid.d.ts +4 -0
- package/esm/util/ua/isAndroid.js +7 -0
- package/esm/util/ua/isIOS.d.ts +4 -0
- package/esm/util/ua/isIOS.js +7 -0
- package/package.json +2 -1
- package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
- package/esm/foundation/utils/payment_product_utils.js +0 -38
- /package/esm/{foundation/service/api-bus → core/bus}/interface.d.ts +0 -0
- /package/esm/{foundation/service/api-bus → core/bus}/interface.js +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/callback.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/security.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/ability/tracker.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/busManager.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/index.d.ts +0 -0
- /package/esm/foundation/service/{api-bus → event-bus}/index.js +0 -0
- /package/esm/{component → plugin/component}/popupWindow.style.d.ts +0 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
import { ConnectErrorCode, ElementPaymentMethod } from '../../../types';
|
2
|
+
export declare enum ThemeType {
|
3
|
+
NostalgicGray = "nostalgicGray",
|
4
|
+
Default = "default",
|
5
|
+
Night = "night",
|
6
|
+
CherryBlossomPink = "cherryBlossomPink",
|
7
|
+
GamingPurple = "gamingPurple",
|
8
|
+
AgateGreen = "agateGreen"
|
9
|
+
}
|
10
|
+
export declare const addressTheme: {
|
11
|
+
default: string;
|
12
|
+
night: string;
|
13
|
+
};
|
14
|
+
export declare enum EventCallbackCode {
|
15
|
+
Failed = "Failed",
|
16
|
+
Completed = "Completed"
|
17
|
+
}
|
18
|
+
export declare enum ELEMENT_ENVIRONMENT {
|
19
|
+
DEV = "DEV",
|
20
|
+
TEST = "TEST",
|
21
|
+
PRE = "PRE",
|
22
|
+
PROD = "PROD"
|
23
|
+
}
|
24
|
+
export type ELEMENT_ENVIRONMENT_TYPE = keyof typeof ELEMENT_ENVIRONMENT | (typeof ELEMENT_ENVIRONMENT)[keyof typeof ELEMENT_ENVIRONMENT];
|
25
|
+
export interface IElementOptions {
|
26
|
+
sessionData: string;
|
27
|
+
environment?: ELEMENT_ENVIRONMENT_TYPE;
|
28
|
+
locale?: string;
|
29
|
+
mode?: string;
|
30
|
+
version?: string;
|
31
|
+
appearance?: {
|
32
|
+
theme: ThemeType.Default | ThemeType.Night;
|
33
|
+
};
|
34
|
+
onEventCallback?: ({ code, message }: {
|
35
|
+
code: EventCallbackCode;
|
36
|
+
message: string;
|
37
|
+
}) => void;
|
38
|
+
loading?: {
|
39
|
+
onStartLoading: () => void;
|
40
|
+
onEndLoading: () => void;
|
41
|
+
};
|
42
|
+
}
|
43
|
+
export interface AddressMountComponentsParams {
|
44
|
+
configParams?: AddressMountConfig;
|
45
|
+
prefillValue: Array<AddressSubmitData>;
|
46
|
+
appearance: {
|
47
|
+
themeType: string;
|
48
|
+
};
|
49
|
+
debugProps?: {
|
50
|
+
localLink: string;
|
51
|
+
};
|
52
|
+
}
|
53
|
+
interface BaseMountOptions<T = void> {
|
54
|
+
configParams?: T;
|
55
|
+
debugProps?: {
|
56
|
+
localLink: string;
|
57
|
+
};
|
58
|
+
}
|
59
|
+
type HideField = 'shippingCountry' | 'shippingName' | 'shippingPhoneNo' | 'shippingRegion' | 'shippingAddress1' | 'shippingZipCode' | 'shippingAddress2';
|
60
|
+
interface AddressMountConfig {
|
61
|
+
/**
|
62
|
+
* 是否开启地址联想功能
|
63
|
+
* 0 开启
|
64
|
+
* 1 关闭
|
65
|
+
*/
|
66
|
+
autoSaveAsDefaultAddress?: boolean;
|
67
|
+
/**
|
68
|
+
* 隐藏部分地址要素
|
69
|
+
*/
|
70
|
+
hideFields?: Array<HideField>;
|
71
|
+
}
|
72
|
+
export interface AddressMountOptions extends BaseMountOptions<AddressMountConfig> {
|
73
|
+
type: 'address';
|
74
|
+
prefillValue: Array<AddressSubmitData>;
|
75
|
+
appearance?: {
|
76
|
+
theme: ThemeType.Default | ThemeType.Night;
|
77
|
+
};
|
78
|
+
}
|
79
|
+
export interface LinkAuthMountOptions extends BaseMountOptions {
|
80
|
+
type: 'auth';
|
81
|
+
appearance?: {
|
82
|
+
theme: ThemeType;
|
83
|
+
};
|
84
|
+
}
|
85
|
+
export interface PaymentMountOptions extends BaseMountOptions {
|
86
|
+
type: 'payment';
|
87
|
+
appearance?: {
|
88
|
+
theme: ThemeType;
|
89
|
+
};
|
90
|
+
}
|
91
|
+
export declare enum AddressEventCallbackName {
|
92
|
+
SHIPPING_CHANGE = "SHIPPING_CHANGE"
|
93
|
+
}
|
94
|
+
interface BaseMountResult {
|
95
|
+
}
|
96
|
+
export interface AddressMountResult extends BaseMountResult {
|
97
|
+
on: (event: AddressEventCallbackName, callback: (data: any) => void) => void;
|
98
|
+
}
|
99
|
+
export interface LinkAuthMountResult extends BaseMountResult {
|
100
|
+
}
|
101
|
+
export interface PaymentMountResult extends BaseMountResult {
|
102
|
+
}
|
103
|
+
export interface EventCallbackData<T = {}> {
|
104
|
+
source?: ElementPaymentMethod;
|
105
|
+
target?: ElementPaymentMethod;
|
106
|
+
success?: boolean;
|
107
|
+
data?: T;
|
108
|
+
event?: AddressEventCallbackName;
|
109
|
+
}
|
110
|
+
export interface ValidateResult<T = {}> {
|
111
|
+
success: boolean;
|
112
|
+
data: {
|
113
|
+
success: boolean;
|
114
|
+
data: T;
|
115
|
+
};
|
116
|
+
}
|
117
|
+
export interface AuthSubmitData {
|
118
|
+
accountInfo: {
|
119
|
+
email: string;
|
120
|
+
};
|
121
|
+
}
|
122
|
+
export interface PaymentSubmitData {
|
123
|
+
paymentMethod: {
|
124
|
+
paymentMethodType: string;
|
125
|
+
paymentMethodDetail?: {
|
126
|
+
cardNo?: string;
|
127
|
+
};
|
128
|
+
cardHolderName?: {
|
129
|
+
firstName: string;
|
130
|
+
};
|
131
|
+
lastName: string;
|
132
|
+
};
|
133
|
+
paymentFactors: {
|
134
|
+
paymentRedirectUrl: string;
|
135
|
+
paymentMethodId?: string;
|
136
|
+
};
|
137
|
+
}
|
138
|
+
export interface AddressSubmitData {
|
139
|
+
shippingName: {
|
140
|
+
firstName: string;
|
141
|
+
lastName: string;
|
142
|
+
};
|
143
|
+
shippingPhoneNo: string;
|
144
|
+
shippingAddress: {
|
145
|
+
region: string;
|
146
|
+
address1: string;
|
147
|
+
address2: string;
|
148
|
+
city?: string;
|
149
|
+
province?: string;
|
150
|
+
zipCode: string;
|
151
|
+
districts?: string[];
|
152
|
+
districtValues?: {
|
153
|
+
[key: string]: string;
|
154
|
+
};
|
155
|
+
};
|
156
|
+
notes: string;
|
157
|
+
prefer: '1' | '0';
|
158
|
+
shippingId: string;
|
159
|
+
actionFlag?: 'I' | 'U' | 'D';
|
160
|
+
}
|
161
|
+
export interface SubmitServiceParams extends PaymentSubmitData {
|
162
|
+
accountInfo: AuthSubmitData['accountInfo'];
|
163
|
+
shipping?: AddressSubmitData;
|
164
|
+
}
|
165
|
+
export interface SubmitServiceResult {
|
166
|
+
success: boolean;
|
167
|
+
errorCode: ConnectErrorCode;
|
168
|
+
errorMessage: string;
|
169
|
+
errorStatus: string;
|
170
|
+
traceId: string;
|
171
|
+
}
|
172
|
+
export interface SubmitFuncResult {
|
173
|
+
success: boolean;
|
174
|
+
msg: string;
|
175
|
+
}
|
176
|
+
export {};
|
@@ -0,0 +1,34 @@
|
|
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 _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; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
|
+
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); }
|
5
|
+
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
6
|
+
ThemeType["NostalgicGray"] = "nostalgicGray";
|
7
|
+
ThemeType["Default"] = "default";
|
8
|
+
ThemeType["Night"] = "night";
|
9
|
+
ThemeType["CherryBlossomPink"] = "cherryBlossomPink";
|
10
|
+
ThemeType["GamingPurple"] = "gamingPurple";
|
11
|
+
ThemeType["AgateGreen"] = "agateGreen";
|
12
|
+
return ThemeType;
|
13
|
+
}({});
|
14
|
+
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
|
15
|
+
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
|
16
|
+
EventCallbackCode["Failed"] = "Failed";
|
17
|
+
EventCallbackCode["Completed"] = "Completed";
|
18
|
+
return EventCallbackCode;
|
19
|
+
}({});
|
20
|
+
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
21
|
+
ELEMENT_ENVIRONMENT["DEV"] = "DEV";
|
22
|
+
ELEMENT_ENVIRONMENT["TEST"] = "TEST";
|
23
|
+
ELEMENT_ENVIRONMENT["PRE"] = "PRE";
|
24
|
+
ELEMENT_ENVIRONMENT["PROD"] = "PROD";
|
25
|
+
return ELEMENT_ENVIRONMENT;
|
26
|
+
}({});
|
27
|
+
// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
|
28
|
+
|
29
|
+
export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
|
30
|
+
AddressEventCallbackName["SHIPPING_CHANGE"] = "SHIPPING_CHANGE";
|
31
|
+
return AddressEventCallbackName;
|
32
|
+
}({});
|
33
|
+
|
34
|
+
// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export interface ISessionDataExtendInfo {
|
2
|
+
displayLayout: 'LEFT_ORDER_AND_RIGHT_PAYMENT' | 'LEFT_PAYMENT_AND_RIGHT_ORDER';
|
3
|
+
displayAntomLogo: string;
|
4
|
+
themeType: 'LIGHT' | 'NIGHT' | 'CUSTOMIZE';
|
5
|
+
OPEN_MULTI_PAYMENT_ABILITY: boolean;
|
6
|
+
[key: string]: any;
|
7
|
+
}
|
8
|
+
export interface LinkData {
|
9
|
+
linkId: string;
|
10
|
+
region: string;
|
11
|
+
displaySetting?: ISessionDataExtendInfo;
|
12
|
+
}
|
13
|
+
export declare const displayIframe: (selector: string) => void;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import ComponentApp from '../../plugin/component';
|
2
|
+
import { ComponentSignEnum, IcreateComponent, IOptionsParams, IPaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../types';
|
3
|
+
import CoreInstance from '../instance/index';
|
4
|
+
export declare const getComponentSign: (params: IPaymentSessionMetaData) => ComponentSignEnum;
|
5
|
+
export declare const parseSessionData: (sessionData: string) => [IPaymentSessionMetaData, string];
|
6
|
+
export type IAMSComponentOptions = IOptionsParams & {
|
7
|
+
appVersion: string;
|
8
|
+
};
|
9
|
+
export declare class AMSComponent extends CoreInstance {
|
10
|
+
_componentApp: ComponentApp;
|
11
|
+
channelType: ComponentSignEnum[];
|
12
|
+
productSceneVersion: string;
|
13
|
+
timer: any;
|
14
|
+
constructor(options: IAMSComponentOptions);
|
15
|
+
private parameterInitAndCheck;
|
16
|
+
private pluginAppendIframe;
|
17
|
+
private savePreviousChannel;
|
18
|
+
/**
|
19
|
+
* 初始化 Bus总线的能力
|
20
|
+
*/
|
21
|
+
private registerBusAbility;
|
22
|
+
/**
|
23
|
+
* To determine whether the corresponding payment method is available,
|
24
|
+
* only the channel described in the document will be called, and it will be returned as available by default
|
25
|
+
* @param paymentMethod - described in the document
|
26
|
+
* @param subPaymentMethod - described in the document
|
27
|
+
* @returns
|
28
|
+
*/
|
29
|
+
canMakePayments(paymentMethod: PaymentMethodTypeEnum, subPaymentMethod?: SubPaymentMethodTypeEnum): Promise<boolean>;
|
30
|
+
/**
|
31
|
+
* @description Create component application
|
32
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
33
|
+
*/
|
34
|
+
createComponent(params: IcreateComponent): Promise<void>;
|
35
|
+
private createComponentProcess;
|
36
|
+
preloadComponent(channelType: any, productSceneVersion: any): void;
|
37
|
+
private clearPreloadIframe;
|
38
|
+
/**
|
39
|
+
* @description Create and render components in the specified element area
|
40
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
41
|
+
* @param selector - Necessary element selector ID
|
42
|
+
*/
|
43
|
+
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
44
|
+
private mountComponentProcess;
|
45
|
+
/**
|
46
|
+
* @description Execute payment submission process
|
47
|
+
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
48
|
+
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
49
|
+
*/
|
50
|
+
submit(data?: Isubmit): Promise<unknown>;
|
51
|
+
}
|