@alipay/ams-checkout 0.0.1742382470-dev.4 → 0.0.1743078169-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/dist/umd/ams-checkout.min.js +1 -1
- package/esm/component/component.inline.style.js +1 -1
- package/esm/component/popupWindow.style.js +4 -1
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/element/elementContainerService/containerService.d.ts +29 -0
- package/esm/core/component/element/elementContainerService/containerService.js +101 -0
- package/esm/core/component/element/elementContainerService/index.d.ts +19 -0
- package/esm/core/component/element/elementContainerService/index.js +55 -0
- package/esm/core/component/element/elementController/index.d.ts +22 -0
- package/esm/core/component/element/elementController/index.js +357 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +17 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +122 -0
- package/esm/core/component/element/elementProcessor/authProcessor.d.ts +14 -0
- package/esm/core/component/element/elementProcessor/authProcessor.js +70 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +36 -0
- package/esm/core/component/element/elementProcessor/baseElementProcessor.js +79 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +17 -0
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +178 -0
- package/esm/core/component/element/index.d.ts +8 -46
- package/esm/core/component/element/index.js +28 -922
- package/esm/core/component/element/type.d.ts +29 -1
- package/esm/core/component/element/util.d.ts +58 -0
- package/esm/core/component/element/util.js +321 -0
- package/esm/core/component/index.d.ts +5 -1
- package/esm/core/component/index.js +1 -2
- package/esm/core/component/oldElement/index.d.ts +59 -0
- package/esm/core/component/oldElement/index.js +956 -0
- package/esm/core/component/oldElement/type.d.ts +351 -0
- package/esm/core/component/oldElement/type.js +81 -0
- package/esm/foundation/core/index.d.ts +5 -1
- package/esm/foundation/core/index.js +52 -30
- package/esm/foundation/index.d.ts +7 -0
- package/esm/foundation/index.js +10 -2
- package/esm/foundation/product-processor/element/index.d.ts +7 -0
- package/esm/foundation/product-processor/element/index.js +24 -0
- package/esm/foundation/service/container/index.d.ts +6 -3
- package/esm/foundation/service/container/index.js +19 -7
- package/esm/foundation/service/container/popup.d.ts +1 -1
- package/esm/foundation/service/event-center.js +1 -0
- package/esm/index.js +1 -0
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/index.js +1 -1
- package/esm/types/index.d.ts +1 -1
- package/esm/types/index.js +1 -1
- package/package.json +1 -1
- /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
- /package/esm/core/component/{element → oldElement}/mock.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/mock.js +0 -0
- /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
- /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -0,0 +1,351 @@
|
|
1
|
+
import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IPaymentMethod } from '../../../types';
|
2
|
+
export declare enum ElementPaymentEvent {
|
3
|
+
RENDER_COMPONENT = "renderComponent",
|
4
|
+
CAPTURE_ASSET = "onCaptureAsset",
|
5
|
+
SIGN_OUT = "onSignout",
|
6
|
+
BLUR = "onBlur",
|
7
|
+
VALIDATE = "submitPay",
|
8
|
+
SUBMIT_RISK = "onSubmitRisk",
|
9
|
+
AFTER_SUBMIT = "onAfterSubmit",
|
10
|
+
SIZE_CHANGE = "onSizeChange",
|
11
|
+
LAUNCH = "onLaunch",
|
12
|
+
CALLBACK = "callback",
|
13
|
+
SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
|
14
|
+
LOG = "log",
|
15
|
+
HANDLE_PAYMENT = "handlePayment"
|
16
|
+
}
|
17
|
+
export declare enum ElementPaymentMethod {
|
18
|
+
CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
|
19
|
+
AUTH_ELEMENT = "AUTH_ELEMENT",
|
20
|
+
ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
|
21
|
+
PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
|
22
|
+
}
|
23
|
+
export declare enum ThemeType {
|
24
|
+
NostalgicGray = "nostalgicGray",
|
25
|
+
Default = "default",
|
26
|
+
Night = "night",
|
27
|
+
CherryBlossomPink = "cherryBlossomPink",
|
28
|
+
GamingPurple = "gamingPurple",
|
29
|
+
AgateGreen = "agateGreen"
|
30
|
+
}
|
31
|
+
export declare enum ElementType {
|
32
|
+
auth = "auth",
|
33
|
+
address = "address",
|
34
|
+
payment = "payment"
|
35
|
+
}
|
36
|
+
export declare enum PaymentElementLayout {
|
37
|
+
Tabs = "tabs",
|
38
|
+
Accordion = "Accordion"
|
39
|
+
}
|
40
|
+
export declare enum MountElementType {
|
41
|
+
auth = "AUTH_ELEMENT",
|
42
|
+
address = "ADDRESS_ELEMENT",
|
43
|
+
payment = "PAYMENT_ELEMENT"
|
44
|
+
}
|
45
|
+
export declare const addressTheme: {
|
46
|
+
default: string;
|
47
|
+
night: string;
|
48
|
+
};
|
49
|
+
export declare enum EventCallbackCode {
|
50
|
+
SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
|
51
|
+
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR"
|
52
|
+
}
|
53
|
+
export declare enum ELEMENT_ENVIRONMENT {
|
54
|
+
DEV = "DEV",
|
55
|
+
TEST = "TEST",
|
56
|
+
SIT = "SIT",
|
57
|
+
PRE = "PRE",
|
58
|
+
PROD = "PROD",
|
59
|
+
SANDBOX = "SANDBOX"
|
60
|
+
}
|
61
|
+
export type ELEMENT_ENVIRONMENT_TYPE = keyof typeof ELEMENT_ENVIRONMENT | (typeof ELEMENT_ENVIRONMENT)[keyof typeof ELEMENT_ENVIRONMENT];
|
62
|
+
export interface IElementOptions {
|
63
|
+
sessionData: string;
|
64
|
+
environment?: ELEMENT_ENVIRONMENT_TYPE;
|
65
|
+
locale?: string;
|
66
|
+
version?: string;
|
67
|
+
appearance?: {
|
68
|
+
theme: ThemeType.Default | ThemeType.Night;
|
69
|
+
};
|
70
|
+
onEventCallback?: ({ code, message, result }: {
|
71
|
+
code: EventCallbackCode;
|
72
|
+
message: string;
|
73
|
+
result?: any;
|
74
|
+
}) => void;
|
75
|
+
loading?: {
|
76
|
+
onStartLoading: () => void;
|
77
|
+
onEndLoading: () => void;
|
78
|
+
};
|
79
|
+
}
|
80
|
+
export interface AddressMountComponentsParams {
|
81
|
+
configParams?: AddressMountConfig;
|
82
|
+
prefillValue: Array<AddressSubmitData>;
|
83
|
+
sessionData: string;
|
84
|
+
appearance: {
|
85
|
+
themeType: string;
|
86
|
+
};
|
87
|
+
debugProps?: {
|
88
|
+
localLink: string;
|
89
|
+
};
|
90
|
+
elementProps?: {
|
91
|
+
elementLink: string;
|
92
|
+
};
|
93
|
+
}
|
94
|
+
interface BaseMountOptions<T = void> {
|
95
|
+
configParams?: T;
|
96
|
+
sessionData: string;
|
97
|
+
debugProps?: {
|
98
|
+
localLink: string;
|
99
|
+
};
|
100
|
+
elementProps?: {
|
101
|
+
elementLink: string;
|
102
|
+
};
|
103
|
+
}
|
104
|
+
type HideField = 'shippingCountry' | 'shippingName' | 'shippingPhoneNo' | 'shippingRegion' | 'shippingAddress1' | 'shippingZipCode' | 'shippingAddress2';
|
105
|
+
interface AddressMountConfig {
|
106
|
+
/**
|
107
|
+
* 是否开启地址联想功能
|
108
|
+
* 0 开启
|
109
|
+
* 1 关闭
|
110
|
+
*/
|
111
|
+
autoSaveAsDefaultAddress?: boolean;
|
112
|
+
/**
|
113
|
+
* 隐藏部分地址要素
|
114
|
+
*/
|
115
|
+
hideFields?: Array<HideField>;
|
116
|
+
}
|
117
|
+
export interface AddressMountOptions extends BaseMountOptions<AddressMountConfig> {
|
118
|
+
type: ElementType.address;
|
119
|
+
prefillValue: Array<AddressSubmitData>;
|
120
|
+
appearance?: {
|
121
|
+
theme?: ThemeType.Default | ThemeType.Night;
|
122
|
+
};
|
123
|
+
}
|
124
|
+
export interface LinkAuthMountOptions extends BaseMountOptions {
|
125
|
+
type: ElementType.auth;
|
126
|
+
appearance?: {
|
127
|
+
theme?: ThemeType;
|
128
|
+
};
|
129
|
+
}
|
130
|
+
export interface PaymentMountOptions extends BaseMountOptions {
|
131
|
+
type: ElementType.payment;
|
132
|
+
appearance?: {
|
133
|
+
theme?: ThemeType;
|
134
|
+
layout?: {
|
135
|
+
type: PaymentElementLayout;
|
136
|
+
};
|
137
|
+
variables?: {
|
138
|
+
'content-primary': string;
|
139
|
+
'content-secondary': string;
|
140
|
+
'content-tertiary': string;
|
141
|
+
'content-quaternary': string;
|
142
|
+
'background-primary': string;
|
143
|
+
'background-secondary': string;
|
144
|
+
'background-disable': string;
|
145
|
+
'background-transparency': string;
|
146
|
+
'border-primary': string;
|
147
|
+
'border-secondary': string;
|
148
|
+
'border-disable': string;
|
149
|
+
'action-normal': string;
|
150
|
+
'action-hover': string;
|
151
|
+
'action-disable': string;
|
152
|
+
'action-secondary': string;
|
153
|
+
'state-failure': string;
|
154
|
+
'state-warning': string;
|
155
|
+
'state-success': string;
|
156
|
+
'state-info': string;
|
157
|
+
'state-marketing': string;
|
158
|
+
'radius-backup': string;
|
159
|
+
'radius-module': string;
|
160
|
+
'radius-component': string;
|
161
|
+
'radius-button': string;
|
162
|
+
};
|
163
|
+
};
|
164
|
+
}
|
165
|
+
export declare enum AddressEventCallbackName {
|
166
|
+
SHIPPING_CHANGE = "SHIPPING_CHANGE"
|
167
|
+
}
|
168
|
+
interface BaseMountResult {
|
169
|
+
}
|
170
|
+
export interface AddressMountResult extends BaseMountResult {
|
171
|
+
on: (event: AddressEventCallbackName, callback: (data: any) => void) => void;
|
172
|
+
}
|
173
|
+
export interface LinkAuthMountResult extends BaseMountResult {
|
174
|
+
}
|
175
|
+
export interface PaymentMountResult extends BaseMountResult {
|
176
|
+
}
|
177
|
+
export interface EventCallbackData<T = {}> {
|
178
|
+
source?: ElementPaymentMethod;
|
179
|
+
target?: ElementPaymentMethod;
|
180
|
+
success?: boolean;
|
181
|
+
data?: T;
|
182
|
+
event?: AddressEventCallbackName;
|
183
|
+
}
|
184
|
+
export interface ValidateResult<T = {}> {
|
185
|
+
success: boolean;
|
186
|
+
data: {
|
187
|
+
success: boolean;
|
188
|
+
data: T;
|
189
|
+
};
|
190
|
+
}
|
191
|
+
export interface AuthSubmitData {
|
192
|
+
accountInfo: {
|
193
|
+
email: string;
|
194
|
+
};
|
195
|
+
}
|
196
|
+
export interface PaymentSubmitData {
|
197
|
+
paymentMethod: {
|
198
|
+
paymentMethodType: string;
|
199
|
+
paymentMethodDetail?: {
|
200
|
+
cardNo?: string;
|
201
|
+
};
|
202
|
+
cardHolderName?: {
|
203
|
+
firstName: string;
|
204
|
+
};
|
205
|
+
lastName: string;
|
206
|
+
};
|
207
|
+
paymentFactors: {
|
208
|
+
paymentRedirectUrl: string;
|
209
|
+
paymentMethodId?: string;
|
210
|
+
};
|
211
|
+
}
|
212
|
+
export interface AddressSubmitData {
|
213
|
+
shippingName: {
|
214
|
+
firstName: string;
|
215
|
+
lastName: string;
|
216
|
+
};
|
217
|
+
shippingPhoneNo: string;
|
218
|
+
shippingAddress: {
|
219
|
+
region: string;
|
220
|
+
address1: string;
|
221
|
+
address2: string;
|
222
|
+
city?: string;
|
223
|
+
province?: string;
|
224
|
+
zipCode: string;
|
225
|
+
districts?: string[];
|
226
|
+
districtValues?: {
|
227
|
+
[key: string]: string;
|
228
|
+
};
|
229
|
+
};
|
230
|
+
notes: string;
|
231
|
+
prefer: '1' | '0';
|
232
|
+
shippingId: string;
|
233
|
+
actionFlag?: 'I' | 'U' | 'D';
|
234
|
+
}
|
235
|
+
export interface SubmitServiceParams extends PaymentSubmitData {
|
236
|
+
accountInfo: AuthSubmitData['accountInfo'];
|
237
|
+
shipping?: AddressSubmitData;
|
238
|
+
}
|
239
|
+
interface SubmitResultActionForm extends ActionForm {
|
240
|
+
paymentCodeExpireTime: string;
|
241
|
+
}
|
242
|
+
export interface SubmitServiceResult {
|
243
|
+
success: boolean;
|
244
|
+
errorCode: ConnectErrorCode;
|
245
|
+
errorMessage: string;
|
246
|
+
errorStatus: string;
|
247
|
+
traceId: string;
|
248
|
+
actionForm?: SubmitResultActionForm;
|
249
|
+
codeFormViews?: Array<{
|
250
|
+
codeExpireTime?: string;
|
251
|
+
}>;
|
252
|
+
}
|
253
|
+
export interface SubmitFuncResult {
|
254
|
+
success: boolean;
|
255
|
+
msg: string;
|
256
|
+
}
|
257
|
+
declare enum AccountStatusEnum {
|
258
|
+
EFFECTIVE = "EFFECTIVE",
|
259
|
+
UNREGISTERED = "UNREGISTERED"
|
260
|
+
}
|
261
|
+
type IAccountInfo = {
|
262
|
+
email?: string;
|
263
|
+
verifyId?: string;
|
264
|
+
accountStatus?: AccountStatusEnum;
|
265
|
+
oneAccountId?: string;
|
266
|
+
needOtp?: boolean;
|
267
|
+
errorMsg?: string;
|
268
|
+
inputStatus?: 'success' | 'loading' | 'error' | 'focused' | '';
|
269
|
+
resendLeftTimes?: number;
|
270
|
+
};
|
271
|
+
interface ShippingsItem {
|
272
|
+
shippingName: {
|
273
|
+
firstName: string;
|
274
|
+
lastName: string;
|
275
|
+
};
|
276
|
+
prefer: '1' | '0';
|
277
|
+
shippingId: string;
|
278
|
+
shippingPhoneNo: string;
|
279
|
+
shippingAddress: {
|
280
|
+
region: string;
|
281
|
+
state: string;
|
282
|
+
city: string;
|
283
|
+
address1: string;
|
284
|
+
address2: string;
|
285
|
+
zipCode: string;
|
286
|
+
};
|
287
|
+
}
|
288
|
+
interface Estimate {
|
289
|
+
unit: string;
|
290
|
+
value: number;
|
291
|
+
}
|
292
|
+
interface DeliveryEstimate {
|
293
|
+
maximum: Estimate;
|
294
|
+
minimum: Estimate;
|
295
|
+
}
|
296
|
+
interface FixedAmount {
|
297
|
+
amount: number;
|
298
|
+
currency: string;
|
299
|
+
}
|
300
|
+
interface ShippingRateData {
|
301
|
+
displayName: string;
|
302
|
+
deliveryEstimate: DeliveryEstimate;
|
303
|
+
fixedAmount: FixedAmount;
|
304
|
+
}
|
305
|
+
interface ShippingAddress {
|
306
|
+
address1: string;
|
307
|
+
address2: string;
|
308
|
+
city: string;
|
309
|
+
region: string;
|
310
|
+
state: string;
|
311
|
+
zipCode: string;
|
312
|
+
}
|
313
|
+
interface IUserName {
|
314
|
+
firstName: string;
|
315
|
+
middleName?: string;
|
316
|
+
lastName: string;
|
317
|
+
fullName?: string;
|
318
|
+
}
|
319
|
+
type Shippings = ShippingsItem[];
|
320
|
+
type IPaymentMethods = IPaymentMethod[];
|
321
|
+
interface CKPShipping {
|
322
|
+
shippingRateId?: string;
|
323
|
+
shippingRateData?: ShippingRateData;
|
324
|
+
shippingAddress: ShippingAddress;
|
325
|
+
shippingFee?: IAmount;
|
326
|
+
shippingFeeView?: IAmountView;
|
327
|
+
shippingDescription?: string;
|
328
|
+
deliveryEstimate?: DeliveryEstimate;
|
329
|
+
shippingFeeId?: string;
|
330
|
+
shippingName?: IUserName;
|
331
|
+
shippingPhoneNo?: string;
|
332
|
+
shipToEmail?: string;
|
333
|
+
notes?: string;
|
334
|
+
}
|
335
|
+
export interface AccountQueryRequest {
|
336
|
+
paymentSessionData: string;
|
337
|
+
paymentSessionConfig: any;
|
338
|
+
accountInfo: IAccountInfo;
|
339
|
+
}
|
340
|
+
export interface AccountQueryResult {
|
341
|
+
accountInfo: IAccountInfo;
|
342
|
+
actionForm?: ActionForm;
|
343
|
+
paymentMethods: IPaymentMethods;
|
344
|
+
shippings: Shippings;
|
345
|
+
success: boolean;
|
346
|
+
errorCode?: string;
|
347
|
+
errorMessage?: string;
|
348
|
+
errorStatus?: string;
|
349
|
+
shippingInfo?: CKPShipping;
|
350
|
+
}
|
351
|
+
export {};
|
@@ -0,0 +1,81 @@
|
|
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 ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
6
|
+
ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
|
7
|
+
ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
|
8
|
+
ElementPaymentEvent["SIGN_OUT"] = "onSignout";
|
9
|
+
ElementPaymentEvent["BLUR"] = "onBlur";
|
10
|
+
ElementPaymentEvent["VALIDATE"] = "submitPay";
|
11
|
+
ElementPaymentEvent["SUBMIT_RISK"] = "onSubmitRisk";
|
12
|
+
ElementPaymentEvent["AFTER_SUBMIT"] = "onAfterSubmit";
|
13
|
+
ElementPaymentEvent["SIZE_CHANGE"] = "onSizeChange";
|
14
|
+
ElementPaymentEvent["LAUNCH"] = "onLaunch";
|
15
|
+
ElementPaymentEvent["CALLBACK"] = "callback";
|
16
|
+
ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
|
17
|
+
ElementPaymentEvent["LOG"] = "log";
|
18
|
+
ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
|
19
|
+
return ElementPaymentEvent;
|
20
|
+
}({});
|
21
|
+
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|
22
|
+
ElementPaymentMethod["CONTAINER_ELEMENT"] = "CONTAINER_ELEMENT";
|
23
|
+
ElementPaymentMethod["AUTH_ELEMENT"] = "AUTH_ELEMENT";
|
24
|
+
ElementPaymentMethod["ADDRESS_ELEMENT"] = "ADDRESS_ELEMENT";
|
25
|
+
ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
|
26
|
+
return ElementPaymentMethod;
|
27
|
+
}({});
|
28
|
+
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
29
|
+
ThemeType["NostalgicGray"] = "nostalgicGray";
|
30
|
+
ThemeType["Default"] = "default";
|
31
|
+
ThemeType["Night"] = "night";
|
32
|
+
ThemeType["CherryBlossomPink"] = "cherryBlossomPink";
|
33
|
+
ThemeType["GamingPurple"] = "gamingPurple";
|
34
|
+
ThemeType["AgateGreen"] = "agateGreen";
|
35
|
+
return ThemeType;
|
36
|
+
}({});
|
37
|
+
export var ElementType = /*#__PURE__*/function (ElementType) {
|
38
|
+
ElementType["auth"] = "auth";
|
39
|
+
ElementType["address"] = "address";
|
40
|
+
ElementType["payment"] = "payment";
|
41
|
+
return ElementType;
|
42
|
+
}({});
|
43
|
+
export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
|
44
|
+
PaymentElementLayout["Tabs"] = "tabs";
|
45
|
+
PaymentElementLayout["Accordion"] = "Accordion";
|
46
|
+
return PaymentElementLayout;
|
47
|
+
}({});
|
48
|
+
export var MountElementType = /*#__PURE__*/function (MountElementType) {
|
49
|
+
MountElementType["auth"] = "AUTH_ELEMENT";
|
50
|
+
MountElementType["address"] = "ADDRESS_ELEMENT";
|
51
|
+
MountElementType["payment"] = "PAYMENT_ELEMENT";
|
52
|
+
return MountElementType;
|
53
|
+
}({});
|
54
|
+
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
|
55
|
+
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
|
56
|
+
EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
|
57
|
+
EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
|
58
|
+
return EventCallbackCode;
|
59
|
+
}({});
|
60
|
+
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
61
|
+
ELEMENT_ENVIRONMENT["DEV"] = "DEV";
|
62
|
+
ELEMENT_ENVIRONMENT["TEST"] = "TEST";
|
63
|
+
ELEMENT_ENVIRONMENT["SIT"] = "SIT";
|
64
|
+
ELEMENT_ENVIRONMENT["PRE"] = "PRE";
|
65
|
+
ELEMENT_ENVIRONMENT["PROD"] = "PROD";
|
66
|
+
ELEMENT_ENVIRONMENT["SANDBOX"] = "SANDBOX";
|
67
|
+
return ELEMENT_ENVIRONMENT;
|
68
|
+
}({});
|
69
|
+
// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
|
70
|
+
|
71
|
+
export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
|
72
|
+
AddressEventCallbackName["SHIPPING_CHANGE"] = "SHIPPING_CHANGE";
|
73
|
+
return AddressEventCallbackName;
|
74
|
+
}({});
|
75
|
+
|
76
|
+
// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
|
77
|
+
var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
|
78
|
+
AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
|
79
|
+
AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
|
80
|
+
return AccountStatusEnum;
|
81
|
+
}(AccountStatusEnum || {}); // element 接口start
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { IoptionsParams, ProductSceneEnum } from '../../types';
|
2
|
-
import { BizFlowStartBehavior, PaymentContext, ProductProcessor, StartBizFlowOptions } from '../index';
|
2
|
+
import { BizFlowStartBehavior, IElementStatus, PaymentContext, ProductProcessor, StartBizFlowOptions } from '../index';
|
3
3
|
import { ServiceProvider } from '../service';
|
4
4
|
/**
|
5
5
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
@@ -13,7 +13,10 @@ export declare class AntomSDKCore {
|
|
13
13
|
private sdkMetaData;
|
14
14
|
private productProcessors;
|
15
15
|
private enablePopWindowEventCallback;
|
16
|
+
private status;
|
16
17
|
constructor();
|
18
|
+
getStatus(): IElementStatus;
|
19
|
+
setStatus(status: any): void;
|
17
20
|
registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
|
18
21
|
init(options: IoptionsParams, productScene: ProductSceneEnum): void;
|
19
22
|
private prepare;
|
@@ -25,4 +28,5 @@ export declare class AntomSDKCore {
|
|
25
28
|
private handleBehaviorRender;
|
26
29
|
private handleClose;
|
27
30
|
private cleanRender;
|
31
|
+
getInstanceId(): string;
|
28
32
|
}
|
@@ -10,18 +10,19 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
10
10
|
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; }
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
12
12
|
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); }
|
13
|
-
import { DisplayTypeEnum, eventCodeEnum } from "../../types";
|
14
|
-
import { DisplayInfo } from "../index";
|
15
13
|
import { v4 as uuid } from 'uuid';
|
14
|
+
import { cleanMockup, createMockup, createRetentionPopup, handleDeclareInfo, hideMockup, hideRetentionPopup, removeRetentionPopup, showRetentionPopup } from "../../component/component.popup.style";
|
15
|
+
import { insertStyleSheet } from "../../component/popupWindow.style";
|
16
|
+
import { sdkVersion } from "../../config";
|
17
|
+
import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
|
18
|
+
import { DisplayTypeEnum, eventCodeEnum } from "../../types";
|
19
|
+
import { DisplayInfo, IElementStatus } from "../index";
|
16
20
|
import { ServiceProvider } from "../service";
|
17
|
-
import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
|
18
21
|
import { getGrayscaleId } from "../utils/gray_scale_utils";
|
19
|
-
import {
|
20
|
-
import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
|
22
|
+
import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
|
21
23
|
import { redirect } from "../utils/redirect_utils";
|
22
|
-
import {
|
23
|
-
|
24
|
-
import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
|
24
|
+
import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
|
25
|
+
|
25
26
|
/**
|
26
27
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
27
28
|
* @date 2024/9/17
|
@@ -36,8 +37,22 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
36
37
|
_defineProperty(this, "sdkMetaData", void 0);
|
37
38
|
_defineProperty(this, "productProcessors", {});
|
38
39
|
_defineProperty(this, "enablePopWindowEventCallback", false);
|
40
|
+
_defineProperty(this, "status", IElementStatus.UNINIT);
|
41
|
+
this.status = IElementStatus.INITING;
|
39
42
|
}
|
40
43
|
_createClass(AntomSDKCore, [{
|
44
|
+
key: "getStatus",
|
45
|
+
value: function getStatus() {
|
46
|
+
return this.status;
|
47
|
+
}
|
48
|
+
}, {
|
49
|
+
key: "setStatus",
|
50
|
+
value: function setStatus(status) {
|
51
|
+
if (status === this.getStatus()) return;
|
52
|
+
console.log("[test] status has changed from ".concat(this.getStatus(), " to ").concat(status));
|
53
|
+
this.status = status;
|
54
|
+
}
|
55
|
+
}, {
|
41
56
|
key: "registerProcessor",
|
42
57
|
value: function registerProcessor(productScene) {
|
43
58
|
var paymentMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
@@ -152,6 +167,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
152
167
|
};
|
153
168
|
}());
|
154
169
|
eventCenter.listen(EVENT.destroy.name, function (data) {
|
170
|
+
_this.setStatus(IElementStatus.READY);
|
155
171
|
_this.destroy();
|
156
172
|
});
|
157
173
|
eventCenter.listen(EVENT.closeCallback.name, function () {
|
@@ -192,6 +208,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
192
208
|
}
|
193
209
|
throw new Error('paymentSession is empty');
|
194
210
|
case 2:
|
211
|
+
this.setStatus(IElementStatus.IN_BIZ_FLOW);
|
195
212
|
paymentSession = options.paymentSession, displayInfo = options.displayInfo;
|
196
213
|
_convertPaymentSessio = convertPaymentSession(paymentSession), paymentSessionId = _convertPaymentSessio.id, paymentSessionMetaData = _convertPaymentSessio.data;
|
197
214
|
this.paymentContext = {
|
@@ -216,59 +233,59 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
216
233
|
// Invoke processor
|
217
234
|
productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
|
218
235
|
paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
|
219
|
-
_context3.prev =
|
236
|
+
_context3.prev = 14;
|
220
237
|
if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
|
221
|
-
_context3.next =
|
238
|
+
_context3.next = 21;
|
222
239
|
break;
|
223
240
|
}
|
224
|
-
_context3.next =
|
241
|
+
_context3.next = 18;
|
225
242
|
return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
|
226
|
-
case
|
243
|
+
case 18:
|
227
244
|
this.bizFlowStartBehavior = _context3.sent;
|
228
|
-
_context3.next =
|
245
|
+
_context3.next = 25;
|
229
246
|
break;
|
230
|
-
case
|
247
|
+
case 21:
|
231
248
|
if (!this.productProcessors["".concat(productScene)]) {
|
232
|
-
_context3.next =
|
249
|
+
_context3.next = 25;
|
233
250
|
break;
|
234
251
|
}
|
235
|
-
_context3.next =
|
252
|
+
_context3.next = 24;
|
236
253
|
return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
|
237
|
-
case 23:
|
238
|
-
this.bizFlowStartBehavior = _context3.sent;
|
239
254
|
case 24:
|
240
|
-
|
255
|
+
this.bizFlowStartBehavior = _context3.sent;
|
256
|
+
case 25:
|
257
|
+
_context3.next = 30;
|
241
258
|
break;
|
242
|
-
case
|
243
|
-
_context3.prev =
|
244
|
-
_context3.t0 = _context3["catch"](
|
259
|
+
case 27:
|
260
|
+
_context3.prev = 27;
|
261
|
+
_context3.t0 = _context3["catch"](14);
|
245
262
|
console.error('Invoke processor failed', _context3.t0);
|
246
|
-
case
|
263
|
+
case 30:
|
247
264
|
if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
|
248
|
-
_context3.next =
|
265
|
+
_context3.next = 32;
|
249
266
|
break;
|
250
267
|
}
|
251
268
|
return _context3.abrupt("return");
|
252
|
-
case
|
269
|
+
case 32:
|
253
270
|
if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
|
254
|
-
_context3.next =
|
271
|
+
_context3.next = 35;
|
255
272
|
break;
|
256
273
|
}
|
257
274
|
this.handleBehaviorRender();
|
258
275
|
return _context3.abrupt("return");
|
259
|
-
case
|
276
|
+
case 35:
|
260
277
|
if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
|
261
|
-
_context3.next =
|
278
|
+
_context3.next = 39;
|
262
279
|
break;
|
263
280
|
}
|
264
281
|
payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
|
265
282
|
redirect(payload, this.instanceId);
|
266
283
|
return _context3.abrupt("return");
|
267
|
-
case
|
284
|
+
case 39:
|
268
285
|
case "end":
|
269
286
|
return _context3.stop();
|
270
287
|
}
|
271
|
-
}, _callee3, this, [[
|
288
|
+
}, _callee3, this, [[14, 27]]);
|
272
289
|
}));
|
273
290
|
function startBizFlow(_x5) {
|
274
291
|
return _startBizFlow.apply(this, arguments);
|
@@ -394,6 +411,11 @@ export var AntomSDKCore = /*#__PURE__*/function () {
|
|
394
411
|
cleanElement();
|
395
412
|
}, 300);
|
396
413
|
}
|
414
|
+
}, {
|
415
|
+
key: "getInstanceId",
|
416
|
+
value: function getInstanceId() {
|
417
|
+
return this.instanceId;
|
418
|
+
}
|
397
419
|
}]);
|
398
420
|
return AntomSDKCore;
|
399
421
|
}();
|
@@ -73,3 +73,10 @@ export interface InitContext {
|
|
73
73
|
initOptions: IoptionsParams;
|
74
74
|
sdkMetaData: SDKMetaData;
|
75
75
|
}
|
76
|
+
export declare enum IElementStatus {
|
77
|
+
UNINIT = "UNINIT",
|
78
|
+
INITING = "INITING",
|
79
|
+
READY = "READY",
|
80
|
+
IN_BIZ_FLOW = "IN_BIZ_FLOW",
|
81
|
+
DESTROYED = "DESTROYED"
|
82
|
+
}
|
package/esm/foundation/index.js
CHANGED
@@ -7,7 +7,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
7
7
|
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); }
|
8
8
|
import { DisplayTypeEnum, PlatformEnum } from "../types";
|
9
9
|
import { isPC } from "../util";
|
10
|
-
|
11
10
|
/**
|
12
11
|
* @author 谦彧 <zhangmian.zm@alipay.com>
|
13
12
|
* @date 2024/9/17
|
@@ -39,4 +38,13 @@ export var DisplayInfo = /*#__PURE__*/_createClass(function DisplayInfo() {
|
|
39
38
|
|
40
39
|
/**
|
41
40
|
* Provide some capability, such as MonitorService, EventBusService, SecurityService
|
42
|
-
*/
|
41
|
+
*/
|
42
|
+
|
43
|
+
export var IElementStatus = /*#__PURE__*/function (IElementStatus) {
|
44
|
+
IElementStatus["UNINIT"] = "UNINIT";
|
45
|
+
IElementStatus["INITING"] = "INITING";
|
46
|
+
IElementStatus["READY"] = "READY";
|
47
|
+
IElementStatus["IN_BIZ_FLOW"] = "IN_BIZ_FLOW";
|
48
|
+
IElementStatus["DESTROYED"] = "DESTROYED";
|
49
|
+
return IElementStatus;
|
50
|
+
}({});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { BizFlowStartBehavior, ProductProcessor } from "../..";
|
2
|
+
declare class ElementProcessor implements ProductProcessor {
|
3
|
+
constructor();
|
4
|
+
init(config: any, instanceId: string): any;
|
5
|
+
startBizFlow(): Promise<BizFlowStartBehavior>;
|
6
|
+
}
|
7
|
+
export { ElementProcessor };
|