@alipay/ams-checkout 0.0.1763539719-dev.0 → 0.0.1763711027-dev.1
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/ams-checkout.js +1 -0
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.js +8 -8
- package/esm/constant/auto-debit.js +15 -0
- package/esm/constant/element.js +30 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +30 -28
- package/esm/foundation/core/index.js +27 -0
- package/esm/foundation/service/container/index.js +33 -2
- package/esm/foundation/utils/web_app_url_utils.js +10 -15
- package/esm/index.js +19 -339
- package/esm/loader/Proxy.js +364 -0
- package/esm/loader/constant.js +36 -0
- package/esm/loader/index.js +23 -0
- package/esm/loader/utils/common.js +63 -0
- package/esm/loader/utils/debugger.js +15 -0
- package/esm/loader/utils/loadSDK.js +92 -0
- package/esm/loader/utils/logger.js +59 -0
- package/esm/loader/utils/proxyPerformance.js +66 -0
- package/esm/main.js +329 -0
- package/esm/plugin/component/cashierApp.js +7 -4
- package/esm/util/integrationType.js +48 -0
- package/esm/util/logger.js +1 -1
- package/package.json +7 -1
- package/LEGAL.md +0 -6
- package/LICENSE +0 -6
- package/README.md +0 -49
- package/esm/component/channel.d.ts +0 -21
- package/esm/component/component.inline.style.d.ts +0 -10
- package/esm/component/component.popup.style.d.ts +0 -26
- package/esm/component/popupWindow.style.d.ts +0 -24
- package/esm/config/index.d.ts +0 -16
- package/esm/config/request.d.ts +0 -21
- package/esm/constant/easysafepay.d.ts +0 -16
- package/esm/constant/index.d.ts +0 -341
- package/esm/core/bus/ability/callback.d.ts +0 -9
- package/esm/core/bus/ability/security.d.ts +0 -10
- package/esm/core/bus/ability/tracker.d.ts +0 -9
- package/esm/core/bus/index.d.ts +0 -125
- package/esm/core/bus/interface.d.ts +0 -36
- package/esm/core/component/address.d.ts +0 -8
- package/esm/core/component/appPreloadProcessing.d.ts +0 -1
- package/esm/core/component/ckp/index.d.ts +0 -29
- package/esm/core/component/element/EventCenter/index.d.ts +0 -31
- package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -34
- package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
- package/esm/core/component/element/elementController/index.d.ts +0 -48
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -41
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -22
- package/esm/core/component/element/index.d.ts +0 -13
- package/esm/core/component/element/mock.d.ts +0 -10
- package/esm/core/component/element/type.d.ts +0 -443
- package/esm/core/component/element/util.d.ts +0 -85
- package/esm/core/component/index.d.ts +0 -58
- package/esm/core/drop-in/index.d.ts +0 -22
- package/esm/core/instance/index.d.ts +0 -89
- package/esm/foundation/core/index.d.ts +0 -36
- package/esm/foundation/index.d.ts +0 -97
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +0 -14
- package/esm/foundation/product-processor/autoDebit/index.d.ts +0 -48
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +0 -20
- package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -29
- package/esm/foundation/product-processor/element/index.d.ts +0 -7
- package/esm/foundation/service/api-bus/ability/callback.d.ts +0 -9
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +0 -10
- package/esm/foundation/service/api-bus/ability/request.d.ts +0 -10
- package/esm/foundation/service/api-bus/ability/security.d.ts +0 -12
- package/esm/foundation/service/api-bus/ability/tracker.d.ts +0 -9
- package/esm/foundation/service/api-bus/busManager.d.ts +0 -127
- package/esm/foundation/service/api-bus/index.d.ts +0 -20
- package/esm/foundation/service/api-bus/interface.d.ts +0 -48
- package/esm/foundation/service/container/index.d.ts +0 -41
- package/esm/foundation/service/container/popup.d.ts +0 -31
- package/esm/foundation/service/container/utils.d.ts +0 -7
- package/esm/foundation/service/event-center.d.ts +0 -82
- package/esm/foundation/service/global-data/index.d.ts +0 -11
- package/esm/foundation/service/index.d.ts +0 -19
- package/esm/foundation/service/log/index.d.ts +0 -43
- package/esm/foundation/service/log/keys.d.ts +0 -13
- package/esm/foundation/service/log/processor.d.ts +0 -9
- package/esm/foundation/service/log/types.d.ts +0 -33
- package/esm/foundation/service/requester/deps.d.ts +0 -17
- package/esm/foundation/service/requester/requester.d.ts +0 -22
- package/esm/foundation/service/security/index.d.ts +0 -28
- package/esm/foundation/service/security/security.d.ts +0 -33
- package/esm/foundation/utils/gray_scale_utils.d.ts +0 -7
- package/esm/foundation/utils/payment_context_utils.d.ts +0 -13
- package/esm/foundation/utils/payment_product_utils.d.ts +0 -13
- package/esm/foundation/utils/preload_helper.d.ts +0 -21
- package/esm/foundation/utils/redirect_utils.d.ts +0 -11
- package/esm/foundation/utils/system_events.d.ts +0 -4
- package/esm/foundation/utils/web_app_url_utils.d.ts +0 -116
- package/esm/index.d.ts +0 -54
- package/esm/plugin/applepay/component.d.ts +0 -50
- package/esm/plugin/applepay/index.d.ts +0 -17
- package/esm/plugin/applepay/interface.d.ts +0 -161
- package/esm/plugin/applepay/service.d.ts +0 -54
- package/esm/plugin/component/cashierApp.d.ts +0 -38
- package/esm/plugin/component/channel.d.ts +0 -57
- package/esm/plugin/component/component.inline.style.d.ts +0 -10
- package/esm/plugin/component/component.popup.style.d.ts +0 -25
- package/esm/plugin/component/index.d.ts +0 -133
- package/esm/plugin/component/popupWindow.style.d.ts +0 -11
- package/esm/plugin/const.d.ts +0 -2
- package/esm/plugin/drop-in/index.d.ts +0 -71
- package/esm/plugin/payment-element/utils.d.ts +0 -2
- package/esm/plugin/paypal/index.d.ts +0 -20
- package/esm/plugin/type.d.ts +0 -34
- package/esm/plugin/utils.d.ts +0 -6
- package/esm/request/index.d.ts +0 -9
- package/esm/request/utils.d.ts +0 -28
- package/esm/service/index.d.ts +0 -13
- package/esm/types/index.d.ts +0 -854
- package/esm/util/createIframeNode.d.ts +0 -6
- package/esm/util/debug.d.ts +0 -1
- package/esm/util/get.d.ts +0 -25
- package/esm/util/getBackScheme.d.ts +0 -5
- package/esm/util/index.d.ts +0 -61
- package/esm/util/intl-callapp/es/browser.d.ts +0 -21
- package/esm/util/intl-callapp/es/evoke.d.ts +0 -13
- package/esm/util/intl-callapp/es/generate.d.ts +0 -29
- package/esm/util/intl-callapp/es/index.d.ts +0 -43
- package/esm/util/intl-callapp/es/main.d.ts +0 -41
- package/esm/util/intl-callapp/es/openWallet.d.ts +0 -15
- package/esm/util/intl-callapp/es/types.d.ts +0 -46
- package/esm/util/intl-callapp/es/utils/config.d.ts +0 -24
- package/esm/util/intl-callapp/es/utils/index.d.ts +0 -15
- package/esm/util/logger.d.ts +0 -64
- package/esm/util/mock.d.ts +0 -1
- package/esm/util/redirect.d.ts +0 -6
- package/esm/util/security.d.ts +0 -34
- package/esm/util/spm-map.d.ts +0 -211
- package/esm/util/storage.d.ts +0 -2
- package/esm/util/upgrade.d.ts +0 -39
- package/esm/util/versionCompare.d.ts +0 -15
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IMerchantAppointParam, IPaymentMethod } from '../../../types';
|
|
2
|
-
import AddressProcessor from './elementProcessor/addressProcessor';
|
|
3
|
-
import AuthProcessor from './elementProcessor/authProcessor';
|
|
4
|
-
import PaymentProcessor from './elementProcessor/paymentProcessor';
|
|
5
|
-
/**
|
|
6
|
-
* element 消息事件名
|
|
7
|
-
*/
|
|
8
|
-
export declare enum ElementPaymentEvent {
|
|
9
|
-
RENDER_COMPONENT = "renderComponent",
|
|
10
|
-
CAPTURE_ASSET = "onCaptureAsset",
|
|
11
|
-
SIGN_OUT = "onSignout",
|
|
12
|
-
BLUR = "onBlur",
|
|
13
|
-
SUBMIT_PAY = "submitPay",
|
|
14
|
-
VALIDATE = "onValidate",
|
|
15
|
-
SUBMIT_RISK = "onSubmitRisk",
|
|
16
|
-
AFTER_SUBMIT = "onAfterSubmit",
|
|
17
|
-
SIZE_CHANGE = "onSizeChange",
|
|
18
|
-
LAUNCH = "onLaunch",
|
|
19
|
-
CALLBACK = "callback",
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated 已废弃 请使用eventCallback
|
|
22
|
-
*/
|
|
23
|
-
SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
|
|
24
|
-
LOG = "log",
|
|
25
|
-
HANDLE_PAYMENT = "handlePayment",
|
|
26
|
-
ON_EVENT_CALLBACK = "onEventCallback"
|
|
27
|
-
}
|
|
28
|
-
export declare enum ElementPaymentMethod {
|
|
29
|
-
CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
|
|
30
|
-
AUTH_ELEMENT = "AUTH_ELEMENT",
|
|
31
|
-
ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
|
|
32
|
-
PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
|
|
33
|
-
}
|
|
34
|
-
export declare enum ElementType {
|
|
35
|
-
auth = "auth",
|
|
36
|
-
address = "address",
|
|
37
|
-
payment = "payment"
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* TODO 替换外外网链接
|
|
41
|
-
* 支付状态参考: https://yuque.antfin.com/antom_ka_team/yg9y7x/fe8xxqgbivnx5fd2#rGgE
|
|
42
|
-
*/
|
|
43
|
-
export declare enum PaymentStatus {
|
|
44
|
-
SUCCESS = "SUCCESS",
|
|
45
|
-
PROCESSING = "PROCESSING",
|
|
46
|
-
CANCELLED = "CANCELLED",
|
|
47
|
-
PENDING = "PENDING",
|
|
48
|
-
S = "SUCCESS",
|
|
49
|
-
F = "FAIL",
|
|
50
|
-
U = "PROCESSING",
|
|
51
|
-
FAIL = "FAIL"
|
|
52
|
-
}
|
|
53
|
-
export declare const MountElementType: {
|
|
54
|
-
auth: ElementPaymentMethod;
|
|
55
|
-
address: ElementPaymentMethod;
|
|
56
|
-
payment: ElementPaymentMethod;
|
|
57
|
-
AUTH_ELEMENT: ElementType;
|
|
58
|
-
ADDRESS_ELEMENT: ElementType;
|
|
59
|
-
PAYMENT_ELEMENT: ElementType;
|
|
60
|
-
};
|
|
61
|
-
export declare enum ThemeType {
|
|
62
|
-
NostalgicGray = "nostalgicGray",
|
|
63
|
-
Default = "default",
|
|
64
|
-
Night = "night",
|
|
65
|
-
CherryBlossomPink = "cherryBlossomPink",
|
|
66
|
-
GamingPurple = "gamingPurple",
|
|
67
|
-
AgateGreen = "agateGreen"
|
|
68
|
-
}
|
|
69
|
-
export declare enum PaymentElementLayout {
|
|
70
|
-
Tabs = "tabs",
|
|
71
|
-
Accordion = "Accordion"
|
|
72
|
-
}
|
|
73
|
-
export declare const addressTheme: {
|
|
74
|
-
default: string;
|
|
75
|
-
night: string;
|
|
76
|
-
};
|
|
77
|
-
export declare enum EventCallbackCode {
|
|
78
|
-
SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
|
|
79
|
-
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
|
|
80
|
-
SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
|
|
81
|
-
SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
|
|
82
|
-
SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
|
|
83
|
-
SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
|
|
84
|
-
SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
|
|
85
|
-
}
|
|
86
|
-
export declare enum ELEMENT_ENVIRONMENT {
|
|
87
|
-
DEV = "DEV",
|
|
88
|
-
TEST = "TEST",
|
|
89
|
-
SIT = "SIT",
|
|
90
|
-
PRE = "PRE",
|
|
91
|
-
PROD = "PROD",
|
|
92
|
-
SANDBOX = "SANDBOX"
|
|
93
|
-
}
|
|
94
|
-
type ELEMENT_ENVIRONMENT_VALUE = 'dev' | 'test' | 'sit' | 'pre' | 'prod' | 'sandbox';
|
|
95
|
-
export type ELEMENT_ENVIRONMENT_TYPE = keyof typeof ELEMENT_ENVIRONMENT | (typeof ELEMENT_ENVIRONMENT)[keyof typeof ELEMENT_ENVIRONMENT] | ELEMENT_ENVIRONMENT_VALUE;
|
|
96
|
-
export interface AddressMountComponentsParams {
|
|
97
|
-
configParams?: AddressMountConfig;
|
|
98
|
-
prefillValue: Array<AddressSubmitData>;
|
|
99
|
-
sessionData: string;
|
|
100
|
-
appearance: {
|
|
101
|
-
themeType: string;
|
|
102
|
-
};
|
|
103
|
-
debugProps?: {
|
|
104
|
-
localLink: string;
|
|
105
|
-
};
|
|
106
|
-
elementProps?: {
|
|
107
|
-
elementLink: string;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
interface BaseMountOptions<T = void> {
|
|
111
|
-
configParams?: T;
|
|
112
|
-
debugProps?: {
|
|
113
|
-
localLink: string;
|
|
114
|
-
};
|
|
115
|
-
elementProps?: {
|
|
116
|
-
elementLink: string;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
type HideField = 'shippingCountry' | 'shippingName' | 'shippingPhoneNo' | 'shippingRegion' | 'shippingAddress1' | 'shippingZipCode' | 'shippingAddress2';
|
|
120
|
-
interface AddressMountConfig {
|
|
121
|
-
/**
|
|
122
|
-
* 是否开启地址联想功能
|
|
123
|
-
* 0 开启
|
|
124
|
-
* 1 关闭
|
|
125
|
-
*/
|
|
126
|
-
autoSaveAsDefaultAddress?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* 隐藏部分地址要素
|
|
129
|
-
*/
|
|
130
|
-
hideFields?: Array<HideField>;
|
|
131
|
-
}
|
|
132
|
-
export interface AddressMountOptions extends BaseMountOptions<AddressMountConfig> {
|
|
133
|
-
type: ElementType.address;
|
|
134
|
-
prefillValue: Array<AddressSubmitData>;
|
|
135
|
-
appearance?: {
|
|
136
|
-
theme?: ThemeType.Default | ThemeType.Night;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
export interface LinkAuthMountOptions extends BaseMountOptions {
|
|
140
|
-
type: ElementType.auth;
|
|
141
|
-
appearance?: {
|
|
142
|
-
theme?: ThemeType;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
type ToCamelCase<S extends string> = S extends `${infer First}-${infer Rest}` ? `${First}${Capitalize<ToCamelCase<Rest>>}` : S;
|
|
146
|
-
type CompatibleVariables<T extends Record<string, string>> = {
|
|
147
|
-
[K in keyof T as K | ToCamelCase<K & string>]: string;
|
|
148
|
-
};
|
|
149
|
-
export interface PaymentMountOptions extends BaseMountOptions {
|
|
150
|
-
type: ElementType.payment;
|
|
151
|
-
appearance?: {
|
|
152
|
-
theme?: ThemeType;
|
|
153
|
-
layout?: {
|
|
154
|
-
type: PaymentElementLayout;
|
|
155
|
-
};
|
|
156
|
-
variables?: Partial<CompatibleVariables<{
|
|
157
|
-
'content-primary': string;
|
|
158
|
-
'content-secondary': string;
|
|
159
|
-
'content-tertiary': string;
|
|
160
|
-
'content-quaternary': string;
|
|
161
|
-
'background-primary': string;
|
|
162
|
-
'background-secondary': string;
|
|
163
|
-
'background-disable': string;
|
|
164
|
-
'background-transparency': string;
|
|
165
|
-
'border-primary': string;
|
|
166
|
-
'border-secondary': string;
|
|
167
|
-
'border-disable': string;
|
|
168
|
-
'action-normal': string;
|
|
169
|
-
'action-hover': string;
|
|
170
|
-
'action-disable': string;
|
|
171
|
-
'action-secondary': string;
|
|
172
|
-
'state-failure': string;
|
|
173
|
-
'state-warning': string;
|
|
174
|
-
'state-success': string;
|
|
175
|
-
'state-info': string;
|
|
176
|
-
'state-marketing': string;
|
|
177
|
-
'radius-backup': string;
|
|
178
|
-
'radius-module': string;
|
|
179
|
-
'radius-component': string;
|
|
180
|
-
'radius-button': string;
|
|
181
|
-
'warpper-padding': string;
|
|
182
|
-
}>>;
|
|
183
|
-
};
|
|
184
|
-
notRedirectAfterComplete?: boolean;
|
|
185
|
-
merchantAppointParam?: IMerchantAppointParam;
|
|
186
|
-
}
|
|
187
|
-
export declare enum AddressEventCallbackName {
|
|
188
|
-
SHIPPING_CHANGE = "SHIPPING_CHANGE"
|
|
189
|
-
}
|
|
190
|
-
interface BaseMountResult {
|
|
191
|
-
}
|
|
192
|
-
export interface AddressMountResult extends BaseMountResult {
|
|
193
|
-
on: (event: AddressEventCallbackName, callback: (data: any) => void) => void;
|
|
194
|
-
}
|
|
195
|
-
export interface LinkAuthMountResult extends BaseMountResult {
|
|
196
|
-
}
|
|
197
|
-
export interface PaymentMountResult extends BaseMountResult {
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* connect element之间通信的类型格式
|
|
201
|
-
*/
|
|
202
|
-
export interface ConnectElementMessageDataType<T = {}> {
|
|
203
|
-
source?: ElementPaymentMethod;
|
|
204
|
-
target?: ElementPaymentMethod;
|
|
205
|
-
data?: T;
|
|
206
|
-
event?: ElementPaymentEvent;
|
|
207
|
-
}
|
|
208
|
-
export interface ValidateResult<T = {}> {
|
|
209
|
-
success: boolean;
|
|
210
|
-
data: {
|
|
211
|
-
success: boolean;
|
|
212
|
-
status: PaymentStatus;
|
|
213
|
-
message?: string;
|
|
214
|
-
data: T;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
export interface AuthSubmitData {
|
|
218
|
-
accountInfo: {
|
|
219
|
-
email: string;
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
export interface PaymentSubmitData {
|
|
223
|
-
paymentMethod: {
|
|
224
|
-
paymentMethodType: string;
|
|
225
|
-
paymentMethodDetail?: {
|
|
226
|
-
cardNo?: string;
|
|
227
|
-
};
|
|
228
|
-
cardHolderName?: {
|
|
229
|
-
firstName: string;
|
|
230
|
-
};
|
|
231
|
-
lastName: string;
|
|
232
|
-
};
|
|
233
|
-
paymentFactors: {
|
|
234
|
-
paymentRedirectUrl: string;
|
|
235
|
-
paymentMethodId?: string;
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
export interface AddressSubmitData {
|
|
239
|
-
shippingName: {
|
|
240
|
-
firstName: string;
|
|
241
|
-
lastName: string;
|
|
242
|
-
};
|
|
243
|
-
shippingPhoneNo: string;
|
|
244
|
-
shippingAddress: {
|
|
245
|
-
region: string;
|
|
246
|
-
address1: string;
|
|
247
|
-
address2: string;
|
|
248
|
-
city?: string;
|
|
249
|
-
province?: string;
|
|
250
|
-
zipCode: string;
|
|
251
|
-
districts?: string[];
|
|
252
|
-
districtValues?: {
|
|
253
|
-
[key: string]: string;
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
notes: string;
|
|
257
|
-
prefer: '1' | '0';
|
|
258
|
-
shippingId: string;
|
|
259
|
-
actionFlag?: 'I' | 'U' | 'D';
|
|
260
|
-
}
|
|
261
|
-
export interface SubmitServiceParams extends PaymentSubmitData {
|
|
262
|
-
accountInfo: AuthSubmitData['accountInfo'];
|
|
263
|
-
shipping?: AddressSubmitData;
|
|
264
|
-
}
|
|
265
|
-
interface SubmitResultActionForm extends ActionForm {
|
|
266
|
-
paymentCodeExpireTime: string;
|
|
267
|
-
}
|
|
268
|
-
export interface SubmitServiceResult {
|
|
269
|
-
success: boolean;
|
|
270
|
-
errorCode: ConnectErrorCode;
|
|
271
|
-
errorMessage: string;
|
|
272
|
-
errorStatus: string;
|
|
273
|
-
traceId: string;
|
|
274
|
-
actionForm?: SubmitResultActionForm;
|
|
275
|
-
codeFormViews?: Array<{
|
|
276
|
-
codeExpireTime?: string;
|
|
277
|
-
}>;
|
|
278
|
-
}
|
|
279
|
-
export interface SubmitFuncResult {
|
|
280
|
-
success: boolean;
|
|
281
|
-
msg: string;
|
|
282
|
-
}
|
|
283
|
-
declare enum AccountStatusEnum {
|
|
284
|
-
EFFECTIVE = "EFFECTIVE",
|
|
285
|
-
UNREGISTERED = "UNREGISTERED"
|
|
286
|
-
}
|
|
287
|
-
type IAccountInfo = {
|
|
288
|
-
email?: string;
|
|
289
|
-
verifyId?: string;
|
|
290
|
-
accountStatus?: AccountStatusEnum;
|
|
291
|
-
oneAccountId?: string;
|
|
292
|
-
needOtp?: boolean;
|
|
293
|
-
errorMsg?: string;
|
|
294
|
-
inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
|
|
295
|
-
resendLeftTimes?: number;
|
|
296
|
-
};
|
|
297
|
-
interface ShippingsItem {
|
|
298
|
-
shippingName: {
|
|
299
|
-
firstName: string;
|
|
300
|
-
lastName: string;
|
|
301
|
-
};
|
|
302
|
-
prefer: '1' | '0';
|
|
303
|
-
shippingId: string;
|
|
304
|
-
shippingPhoneNo: string;
|
|
305
|
-
shippingAddress: {
|
|
306
|
-
region: string;
|
|
307
|
-
state: string;
|
|
308
|
-
city: string;
|
|
309
|
-
address1: string;
|
|
310
|
-
address2: string;
|
|
311
|
-
zipCode: string;
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
interface Estimate {
|
|
315
|
-
unit: string;
|
|
316
|
-
value: number;
|
|
317
|
-
}
|
|
318
|
-
interface DeliveryEstimate {
|
|
319
|
-
maximum: Estimate;
|
|
320
|
-
minimum: Estimate;
|
|
321
|
-
}
|
|
322
|
-
interface FixedAmount {
|
|
323
|
-
amount: number;
|
|
324
|
-
currency: string;
|
|
325
|
-
}
|
|
326
|
-
interface ShippingRateData {
|
|
327
|
-
displayName: string;
|
|
328
|
-
deliveryEstimate: DeliveryEstimate;
|
|
329
|
-
fixedAmount: FixedAmount;
|
|
330
|
-
}
|
|
331
|
-
interface ShippingAddress {
|
|
332
|
-
address1: string;
|
|
333
|
-
address2: string;
|
|
334
|
-
city: string;
|
|
335
|
-
region: string;
|
|
336
|
-
state: string;
|
|
337
|
-
zipCode: string;
|
|
338
|
-
}
|
|
339
|
-
interface IUserName {
|
|
340
|
-
firstName: string;
|
|
341
|
-
middleName?: string;
|
|
342
|
-
lastName: string;
|
|
343
|
-
fullName?: string;
|
|
344
|
-
}
|
|
345
|
-
type Shippings = ShippingsItem[];
|
|
346
|
-
type IPaymentMethods = IPaymentMethod[];
|
|
347
|
-
interface CKPShipping {
|
|
348
|
-
shippingRateId?: string;
|
|
349
|
-
shippingRateData?: ShippingRateData;
|
|
350
|
-
shippingAddress: ShippingAddress;
|
|
351
|
-
shippingFee?: IAmount;
|
|
352
|
-
shippingFeeView?: IAmountView;
|
|
353
|
-
shippingDescription?: string;
|
|
354
|
-
deliveryEstimate?: DeliveryEstimate;
|
|
355
|
-
shippingFeeId?: string;
|
|
356
|
-
shippingName?: IUserName;
|
|
357
|
-
shippingPhoneNo?: string;
|
|
358
|
-
shipToEmail?: string;
|
|
359
|
-
notes?: string;
|
|
360
|
-
}
|
|
361
|
-
export interface AccountQueryRequest {
|
|
362
|
-
paymentSessionData: string;
|
|
363
|
-
paymentSessionConfig: any;
|
|
364
|
-
accountInfo: IAccountInfo;
|
|
365
|
-
}
|
|
366
|
-
export interface AccountQueryResult {
|
|
367
|
-
accountInfo: IAccountInfo;
|
|
368
|
-
actionForm?: ActionForm;
|
|
369
|
-
paymentMethods: IPaymentMethods;
|
|
370
|
-
shippings: Shippings;
|
|
371
|
-
success: boolean;
|
|
372
|
-
errorCode?: string;
|
|
373
|
-
errorMessage?: string;
|
|
374
|
-
errorStatus?: string;
|
|
375
|
-
shippingInfo?: CKPShipping;
|
|
376
|
-
}
|
|
377
|
-
export interface IElementOptions {
|
|
378
|
-
sessionData: string;
|
|
379
|
-
environment?: ELEMENT_ENVIRONMENT_TYPE;
|
|
380
|
-
locale?: string;
|
|
381
|
-
version?: string;
|
|
382
|
-
appearance?: {
|
|
383
|
-
theme: ThemeType.Default | ThemeType.Night;
|
|
384
|
-
};
|
|
385
|
-
onEventCallback?: ({ code, message, result }: {
|
|
386
|
-
code: EventCallbackCode;
|
|
387
|
-
message: string;
|
|
388
|
-
result?: any;
|
|
389
|
-
}) => void;
|
|
390
|
-
loading?: {
|
|
391
|
-
onStartLoading: () => void;
|
|
392
|
-
onEndLoading: () => void;
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
export interface IElementProcessors {
|
|
396
|
-
[ElementType.auth]: AuthProcessor;
|
|
397
|
-
[ElementType.address]: AddressProcessor;
|
|
398
|
-
[ElementType.payment]: PaymentProcessor;
|
|
399
|
-
}
|
|
400
|
-
export interface IToastOptions {
|
|
401
|
-
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
402
|
-
backgroundColor?: string;
|
|
403
|
-
color?: string;
|
|
404
|
-
padding?: string;
|
|
405
|
-
borderRadius?: string;
|
|
406
|
-
fontSize?: string;
|
|
407
|
-
zIndex?: number;
|
|
408
|
-
width?: string;
|
|
409
|
-
duration?: number;
|
|
410
|
-
icon?: 'SUCCESS' | 'FAIL';
|
|
411
|
-
spin?: boolean;
|
|
412
|
-
}
|
|
413
|
-
export interface ICommonApiResponse {
|
|
414
|
-
error?: {
|
|
415
|
-
code: string;
|
|
416
|
-
message: string;
|
|
417
|
-
traceId?: string;
|
|
418
|
-
context?: any;
|
|
419
|
-
needChangeSessionForRetry?: boolean;
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
export interface IPaymentApiResponse extends ICommonApiResponse {
|
|
423
|
-
status: keyof typeof PaymentStatus;
|
|
424
|
-
userCanceled3D?: boolean;
|
|
425
|
-
}
|
|
426
|
-
export declare class InvalidElementConfigError extends Error {
|
|
427
|
-
errors: Array<{
|
|
428
|
-
field: keyof IElementOptions;
|
|
429
|
-
message: string;
|
|
430
|
-
}>;
|
|
431
|
-
constructor(errors: Array<{
|
|
432
|
-
field: keyof IElementOptions;
|
|
433
|
-
message: string;
|
|
434
|
-
}>);
|
|
435
|
-
}
|
|
436
|
-
export declare enum EXPOSURE_API_EVENT {
|
|
437
|
-
DESTORY = "destroy",
|
|
438
|
-
MOUNT = "mount",
|
|
439
|
-
SUBMITPAYMENT = "submitPayment",
|
|
440
|
-
VALIDATAFIELDS = "validateFields",
|
|
441
|
-
UPDATEPAYMENT = "updatePayment"
|
|
442
|
-
}
|
|
443
|
-
export {};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { IElementStatus } from '../../../foundation';
|
|
2
|
-
import { CashierSdkActionQueryResult, Ianalytics, IPaymentSessionMetaData } from '../../../types';
|
|
3
|
-
import { ContainerController } from './elementContainerService/containerService';
|
|
4
|
-
import { ELEMENT_ENVIRONMENT_TYPE, EventCallbackCode, IElementOptions, IToastOptions } from './type';
|
|
5
|
-
export declare const formatElementOption: (options: IElementOptions) => {
|
|
6
|
-
environment: ELEMENT_ENVIRONMENT_TYPE;
|
|
7
|
-
sessionData: string;
|
|
8
|
-
locale?: string;
|
|
9
|
-
version?: string;
|
|
10
|
-
appearance?: {
|
|
11
|
-
theme: import("./type").ThemeType.Default | import("./type").ThemeType.Night;
|
|
12
|
-
};
|
|
13
|
-
onEventCallback?: ({ code, message, result }: {
|
|
14
|
-
code: EventCallbackCode;
|
|
15
|
-
message: string;
|
|
16
|
-
result?: any;
|
|
17
|
-
}) => void;
|
|
18
|
-
loading?: {
|
|
19
|
-
onStartLoading: () => void;
|
|
20
|
-
onEndLoading: () => void;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare const validateElementOption: (options: IElementOptions) => {
|
|
24
|
-
isValid: boolean;
|
|
25
|
-
errors: any[];
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* 校验渲染条件
|
|
29
|
-
* 1.校验当前 sdkSelector 结点是否存在
|
|
30
|
-
* 2.校验当前 Element 的状态是否能够渲染
|
|
31
|
-
* 3.校验当前 type 类型 Elment 是否已经执行过 mount
|
|
32
|
-
*/
|
|
33
|
-
export declare function checkCanMount({ sdkSelector, containerService, status, }: {
|
|
34
|
-
sdkSelector: string;
|
|
35
|
-
containerService: ContainerController;
|
|
36
|
-
status: IElementStatus;
|
|
37
|
-
}): {
|
|
38
|
-
success: boolean;
|
|
39
|
-
errorMsg?: string;
|
|
40
|
-
error?: {
|
|
41
|
-
code: string;
|
|
42
|
-
message: string;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare function checkCanUpdate({ status, paymentContainerService, newPaymentSessionData, oldPaymentSessionData, }: {
|
|
46
|
-
status: IElementStatus;
|
|
47
|
-
paymentContainerService: ContainerController;
|
|
48
|
-
newPaymentSessionData: string;
|
|
49
|
-
oldPaymentSessionData: string;
|
|
50
|
-
}): boolean;
|
|
51
|
-
export declare function generateIframeSrc({ paymentSessionObj, paymentSession, instanceId, environment, appVersion, analytics, locale, pageUrl, link, }: {
|
|
52
|
-
paymentSessionObj: IPaymentSessionMetaData;
|
|
53
|
-
paymentSession: string;
|
|
54
|
-
environment: string;
|
|
55
|
-
analytics: Ianalytics;
|
|
56
|
-
locale: string;
|
|
57
|
-
instanceId: string;
|
|
58
|
-
pageUrl: string;
|
|
59
|
-
appVersion: string;
|
|
60
|
-
link?: string;
|
|
61
|
-
}): string;
|
|
62
|
-
export declare function handleRedirect(data: any, fromFastSdk: boolean, eventCallback: ({ code, message }: {
|
|
63
|
-
code: any;
|
|
64
|
-
message: any;
|
|
65
|
-
}) => void): void;
|
|
66
|
-
export declare function redirect(data: {
|
|
67
|
-
normalUrl?: string;
|
|
68
|
-
schemeUrl?: string;
|
|
69
|
-
applinkUrl?: string;
|
|
70
|
-
callAppJudgeTime?: number;
|
|
71
|
-
}): Promise<void>;
|
|
72
|
-
export declare function showToast(options?: IToastOptions, callback?: Function): void;
|
|
73
|
-
export declare const isElementMobile: () => boolean;
|
|
74
|
-
/**
|
|
75
|
-
* @description judge whether the device is a pad, by userAgent and screen aspect ratio, but not accurate
|
|
76
|
-
*/
|
|
77
|
-
export declare const isElementPad: () => boolean;
|
|
78
|
-
export declare const isElementPC: () => boolean;
|
|
79
|
-
/**
|
|
80
|
-
* 判断是否需要加载错误页
|
|
81
|
-
* @param {CashierSdkActionQueryResult} params
|
|
82
|
-
* @returns {boolean} - 是否需要加载错误页
|
|
83
|
-
*/
|
|
84
|
-
export declare const isLoadErrorPage: (params: CashierSdkActionQueryResult) => boolean;
|
|
85
|
-
export declare const safeStringify: (payload: any, defaultValue?: string) => string;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import ComponentApp from '../../plugin/component';
|
|
2
|
-
import { ComponentSignEnum, EventPayloadContext, IappendIframeNodesParams, IcreateComponent, IoptionsParams, IPaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum, ValidationResult } 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 declare const handleParams: (params: IcreateComponent, _this: any) => Promise<{
|
|
7
|
-
iframeNodesParams: IappendIframeNodesParams;
|
|
8
|
-
componentSign: ComponentSignEnum.EASY_PAY_WALLET | ComponentSignEnum.EASY_PAY_APM | ComponentSignEnum.CASHIER_PAYMENT_CARD | ComponentSignEnum.CASHIER_PAYMENT_BANK | ComponentSignEnum.CASHIER_PAYMENT_APM | ComponentSignEnum.AUTO_DEBIT_WALLET | ComponentSignEnum.AUTO_DEBIT_PAY_WALLET | ComponentSignEnum.VAULTING_CARD | ComponentSignEnum.CHECKOUT_PAYMENT | ComponentSignEnum.ELEMENT_PAYMENT | ComponentSignEnum.ELEMENT_ADDRESS | ComponentSignEnum.AUTO_DEBIT_APM;
|
|
9
|
-
}>;
|
|
10
|
-
export type IAMSComponentOptions = IoptionsParams & {
|
|
11
|
-
appVersion: string;
|
|
12
|
-
};
|
|
13
|
-
export declare class AMSComponent extends CoreInstance {
|
|
14
|
-
_componentApp: ComponentApp;
|
|
15
|
-
channelType: ComponentSignEnum[];
|
|
16
|
-
productSceneVersion: string;
|
|
17
|
-
timer: any;
|
|
18
|
-
private _validateResolveMap;
|
|
19
|
-
constructor(options: IAMSComponentOptions);
|
|
20
|
-
private parameterInitAndCheck;
|
|
21
|
-
private pluginAppendIframe;
|
|
22
|
-
private savePreviousChannel;
|
|
23
|
-
/**
|
|
24
|
-
* 初始化 Bus总线的能力
|
|
25
|
-
*/
|
|
26
|
-
private registerBusAbility;
|
|
27
|
-
/**
|
|
28
|
-
* To determine whether the corresponding payment method is available,
|
|
29
|
-
* only the channel described in the document will be called, and it will be returned as available by default
|
|
30
|
-
* @param paymentMethod - described in the document
|
|
31
|
-
* @param subPaymentMethod - described in the document
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
canMakePayments(paymentMethod: PaymentMethodTypeEnum, subPaymentMethod?: SubPaymentMethodTypeEnum): Promise<boolean>;
|
|
35
|
-
/**
|
|
36
|
-
* @description Create component application
|
|
37
|
-
* @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.
|
|
38
|
-
*/
|
|
39
|
-
createComponent(params: IcreateComponent): Promise<void>;
|
|
40
|
-
private createComponentProcess;
|
|
41
|
-
preloadComponent(channelType: any, productSceneVersion: any): void;
|
|
42
|
-
private clearPreloadIframe;
|
|
43
|
-
/**
|
|
44
|
-
* @description Create and render components in the specified element area
|
|
45
|
-
* @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.
|
|
46
|
-
* @param selector - Necessary element selector ID
|
|
47
|
-
*/
|
|
48
|
-
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
|
49
|
-
private mountComponentProcess;
|
|
50
|
-
/**
|
|
51
|
-
* @description Execute payment submission process
|
|
52
|
-
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
|
53
|
-
* @param data - Transfer information in the submission interface according to your requirements (optional)
|
|
54
|
-
*/
|
|
55
|
-
submit(data?: Isubmit): Promise<unknown>;
|
|
56
|
-
protected _validateFields(): Promise<ValidationResult>;
|
|
57
|
-
protected _sendMessageToAPP(eventContext: EventPayloadContext): void;
|
|
58
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IcreatePaymentParams, IoptionsParams } from '../../types';
|
|
2
|
-
export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
|
|
3
|
-
/**
|
|
4
|
-
* @description Create checkout application
|
|
5
|
-
* @description drop-in
|
|
6
|
-
*/
|
|
7
|
-
export declare const createPayment: (params: IcreatePaymentParams) => Promise<void>;
|
|
8
|
-
export interface IcreatePaymentFunc {
|
|
9
|
-
(params: IcreatePaymentParams): Promise<void>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* @description Take action on the interface result of payment submission
|
|
13
|
-
* @description drop-in
|
|
14
|
-
*/
|
|
15
|
-
export declare const confirmPayment: (result: any) => Promise<void>;
|
|
16
|
-
export interface IconfirmPaymentFunc {
|
|
17
|
-
(result: any): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @description Subscribe to the message of the cashier application plug-in
|
|
21
|
-
*/
|
|
22
|
-
export declare const _subscribeFromCheckoutPlugin: () => void;
|
|
@@ -1,89 +0,0 @@
|
|
|
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 { ComponentActionNamesType } from '../../plugin/type';
|
|
9
|
-
import ComponentApp from '../../plugin/component';
|
|
10
|
-
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IoptionsParams } from '../../types/index';
|
|
11
|
-
import { EventCenter } from '../../util/index';
|
|
12
|
-
import { Logger } from '../../util/logger';
|
|
13
|
-
import { Security } from '../../util/security';
|
|
14
|
-
export default class AMSSDK {
|
|
15
|
-
options: AMSCheckoutOptions;
|
|
16
|
-
originOptions: IoptionsParams;
|
|
17
|
-
logger: Logger;
|
|
18
|
-
_eventCenter: EventCenter;
|
|
19
|
-
_instanceId: string;
|
|
20
|
-
_storageId: string;
|
|
21
|
-
_appendParams: IAppendParams;
|
|
22
|
-
_componentApp: ComponentApp;
|
|
23
|
-
protected securitySdkMap: Map<string, Security>;
|
|
24
|
-
protected plugins: Map<string, any>;
|
|
25
|
-
constructor(options: IoptionsParams);
|
|
26
|
-
private preInitSecurity;
|
|
27
|
-
/**
|
|
28
|
-
* @description Destroy and process some contents of the plug-in
|
|
29
|
-
*/
|
|
30
|
-
unmount(): void;
|
|
31
|
-
/**
|
|
32
|
-
* @description init security SDK
|
|
33
|
-
* @param product Product Scenarios
|
|
34
|
-
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
|
35
|
-
*/
|
|
36
|
-
initSecurity({ product, scene, }: InitSecurityConfig & {
|
|
37
|
-
scene?: string;
|
|
38
|
-
}): void;
|
|
39
|
-
/**
|
|
40
|
-
* @description Obtain security SDK through scenario identification
|
|
41
|
-
*/
|
|
42
|
-
_getSecuritySDKByProductScene(securityConfig: InitSecurityConfig): Security;
|
|
43
|
-
/**
|
|
44
|
-
* @description New security SDK through scenario identification
|
|
45
|
-
*/
|
|
46
|
-
_newSecuritySDKByScene(securityConfig: InitSecurityConfig, successCallback?: () => void, failCallback?: (errMsg?: string) => void): Security;
|
|
47
|
-
/**
|
|
48
|
-
* @description Obtain risk control configuration in local storage
|
|
49
|
-
*/
|
|
50
|
-
private getSecurityConfigStorage;
|
|
51
|
-
/**
|
|
52
|
-
* @description Set the sdk basic configuration
|
|
53
|
-
*/
|
|
54
|
-
private _setOptions;
|
|
55
|
-
/**
|
|
56
|
-
* @description Set environment variables
|
|
57
|
-
*/
|
|
58
|
-
private _setEnv;
|
|
59
|
-
/**
|
|
60
|
-
* @description Set UI and Network Mode
|
|
61
|
-
*/
|
|
62
|
-
private _setMode;
|
|
63
|
-
/**
|
|
64
|
-
* @description Initialize event related tasks
|
|
65
|
-
*/
|
|
66
|
-
private _initEvent;
|
|
67
|
-
/**
|
|
68
|
-
* @description Register plug-in
|
|
69
|
-
*/
|
|
70
|
-
protected _registerPlugin(pluginId: string, plugin: any): void;
|
|
71
|
-
/**
|
|
72
|
-
* @description Get Plug-in
|
|
73
|
-
*/
|
|
74
|
-
protected _getPlugin(pluginId: string): any;
|
|
75
|
-
/**
|
|
76
|
-
* @description Execute to open app or jump link
|
|
77
|
-
*/
|
|
78
|
-
_redirect(data: {
|
|
79
|
-
normalUrl?: string;
|
|
80
|
-
schemeUrl?: string;
|
|
81
|
-
applinkUrl?: string;
|
|
82
|
-
callAppJudgeTime?: number;
|
|
83
|
-
}): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* @description Overlay Subscription
|
|
86
|
-
*/
|
|
87
|
-
protected _overrideSubscription(name: string, func: any, funcKey: string): void;
|
|
88
|
-
protected getBusActionNames(): ComponentActionNamesType;
|
|
89
|
-
}
|