@alipay/ams-checkout 0.0.1757298389-dev.17 → 0.0.1757298389-dev.18
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/constant/index.d.ts +102 -88
- package/esm/constant/index.js +23 -6
- package/esm/core/component/element/elementController/index.d.ts +3 -8
- package/esm/core/component/element/elementController/index.js +17 -13
- package/esm/core/component/element/index.d.ts +3 -10
- package/esm/core/component/element/index.js +4 -1
- package/esm/core/component/element/type.d.ts +22 -4
- package/esm/core/component/element/type.js +16 -0
- package/esm/core/component/element/util.d.ts +4 -2
- package/esm/core/component/element/util.js +4 -1
- package/esm/plugin/component/index.js +2 -2
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.js +1 -1
- package/package.json +1 -1
- package/esm/core/component/oldElement/components/address.d.ts +0 -19
- package/esm/core/component/oldElement/components/address.js +0 -68
- package/esm/core/component/oldElement/components/auth.d.ts +0 -17
- package/esm/core/component/oldElement/components/auth.js +0 -60
- package/esm/core/component/oldElement/components/payment.d.ts +0 -19
- package/esm/core/component/oldElement/components/payment.js +0 -74
- package/esm/core/component/oldElement/index.d.ts +0 -59
- package/esm/core/component/oldElement/index.js +0 -956
- package/esm/core/component/oldElement/mock.d.ts +0 -6
- package/esm/core/component/oldElement/mock.js +0 -567
- package/esm/core/component/oldElement/type.d.ts +0 -354
- package/esm/core/component/oldElement/type.js +0 -81
- package/esm/core/component/oldElement/utils.d.ts +0 -13
- package/esm/core/component/oldElement/utils.js +0 -6
package/esm/constant/index.d.ts
CHANGED
|
@@ -6,117 +6,117 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { eventCodeEnum } from '../types';
|
|
8
8
|
export declare const ERRORMESSAGE: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
DOMAIN_NOT_IN_WHITE_LIST: {
|
|
10
|
+
code: eventCodeEnum;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
NOT_JSON_FORMAT: {
|
|
14
|
+
code: eventCodeEnum;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
SDK_COMPATIBILITY_ISSUES: {
|
|
18
|
+
code: eventCodeEnum;
|
|
19
|
+
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
|
20
|
+
code: eventCodeEnum;
|
|
21
|
+
message: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
FAILED_TO_CREATE_IFRAME: {
|
|
24
|
+
code: eventCodeEnum;
|
|
25
|
+
message: string;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
INIT_PARAMETER_ERROR: {
|
|
29
|
+
code: eventCodeEnum;
|
|
30
|
+
UI_MODE_NOT_SUPPORTED: {
|
|
31
|
+
code: eventCodeEnum;
|
|
32
|
+
message: string;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
ENVIRONMENT_ERROR: {
|
|
35
|
+
code: eventCodeEnum;
|
|
36
|
+
message: string;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
MODE_ERROR: {
|
|
39
|
+
code: eventCodeEnum;
|
|
40
|
+
message: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
LOCALE_ERROR: {
|
|
43
|
+
code: eventCodeEnum;
|
|
44
|
+
message: string;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
NET_MODE_NOT_SUPPORT: {
|
|
47
|
+
code: eventCodeEnum;
|
|
48
|
+
message: string;
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
EVENT_ERROR: {
|
|
51
|
+
code: eventCodeEnum;
|
|
52
|
+
message: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
CREATEPAYMENT_PARAMETER_ERROR: {
|
|
56
|
+
code: eventCodeEnum;
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
CREATECOMPONENT_ERROR: {
|
|
59
|
+
code: eventCodeEnum;
|
|
60
|
+
message: string;
|
|
61
|
+
SINGLETON_COMPONENT_ERROR: {
|
|
62
|
+
code: eventCodeEnum;
|
|
63
|
+
message: string;
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
LOAD_APP_TIMEOUT: {
|
|
66
|
+
code: eventCodeEnum;
|
|
67
|
+
message: string;
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
NETWORK_REQUEST_ERROR: {
|
|
70
|
+
code: eventCodeEnum;
|
|
71
|
+
message: string;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
SDK_LAUNCH_PAYMENT_APP_ERROR: {
|
|
75
|
+
code: eventCodeEnum;
|
|
76
|
+
CALL_APP_URL_ERROR: {
|
|
77
|
+
code: eventCodeEnum;
|
|
78
|
+
message: string;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
SDK_SUBMIT_ERROR: {
|
|
82
|
+
code: eventCodeEnum;
|
|
83
|
+
message: string;
|
|
84
84
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
PARAM_INVALID: {
|
|
86
|
+
code: string;
|
|
87
|
+
message: string;
|
|
88
88
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
UI_STATE_ERROR: {
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
CONTAINER_NOT_LOADED: {
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
96
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
INITALIZE_TIMEOUT: {
|
|
98
|
+
code: string;
|
|
99
|
+
API: {
|
|
100
|
+
code: string;
|
|
101
|
+
message: string;
|
|
102
102
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
WEB: {
|
|
104
|
+
code: string;
|
|
105
|
+
message: string;
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
ERR_DATA_STRUCT_UNRECOGNIZED: {
|
|
109
|
+
code: string;
|
|
110
|
+
message: string;
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
113
|
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
|
114
114
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
SDK_CALL_URL_ERROR: {
|
|
116
|
+
code: eventCodeEnum;
|
|
117
|
+
REDIRECT_ERROR: {
|
|
118
|
+
code: eventCodeEnum;
|
|
119
|
+
message: string;
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
122
|
};
|
|
@@ -315,9 +315,23 @@ export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA
|
|
|
315
315
|
* @description Promise回调code映射
|
|
316
316
|
*/
|
|
317
317
|
export declare const PROMISE_CALLBACK_CODE: {
|
|
318
|
-
SUCCESS:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
SUCCESS: {
|
|
319
|
+
code: string;
|
|
320
|
+
};
|
|
321
|
+
UNKNOWN_EXCEPTION: {
|
|
322
|
+
code: string;
|
|
323
|
+
message: string;
|
|
324
|
+
};
|
|
325
|
+
REPEAT_REQ_REJECT: {
|
|
326
|
+
code: string;
|
|
327
|
+
message: string;
|
|
328
|
+
};
|
|
329
|
+
PROCESS_FAIL: {
|
|
330
|
+
code: string;
|
|
331
|
+
message: string;
|
|
332
|
+
};
|
|
333
|
+
INQUIRY_PAYMENT_SESSION_FAILED: {
|
|
334
|
+
code: string;
|
|
335
|
+
message: string;
|
|
336
|
+
};
|
|
323
337
|
};
|
package/esm/constant/index.js
CHANGED
|
@@ -107,7 +107,7 @@ export var ERRORMESSAGE = {
|
|
|
107
107
|
},
|
|
108
108
|
ERR_DATA_STRUCT_UNRECOGNIZED: {
|
|
109
109
|
code: 'ERR_DATA_STRUCT_UNRECOGNIZED',
|
|
110
|
-
|
|
110
|
+
message: 'The request is abnormal and the transaction cannot be initiated.'
|
|
111
111
|
},
|
|
112
112
|
/**
|
|
113
113
|
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
|
@@ -120,6 +120,9 @@ export var ERRORMESSAGE = {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
// as const satisfies Record<string, ErrorMessage>;
|
|
125
|
+
|
|
123
126
|
export var BASEPLUGINID = 'CHECKOUT';
|
|
124
127
|
export var COMPONENTPLUGINID = 'COMPONENT';
|
|
125
128
|
export var EVENT = {
|
|
@@ -321,9 +324,23 @@ export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEB
|
|
|
321
324
|
* @description Promise回调code映射
|
|
322
325
|
*/
|
|
323
326
|
export var PROMISE_CALLBACK_CODE = {
|
|
324
|
-
SUCCESS:
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
SUCCESS: {
|
|
328
|
+
code: 'SUCCESS'
|
|
329
|
+
},
|
|
330
|
+
UNKNOWN_EXCEPTION: {
|
|
331
|
+
code: 'UNKNOWN_EXCEPTION',
|
|
332
|
+
message: 'Unknown anomaly. Please check the payment status and contact the merchant.'
|
|
333
|
+
},
|
|
334
|
+
REPEAT_REQ_REJECT: {
|
|
335
|
+
code: 'REPEAT_REQ_REJECT',
|
|
336
|
+
message: 'The order status is abnormal. Please check the payment status and contact the merchant.'
|
|
337
|
+
},
|
|
338
|
+
PROCESS_FAIL: {
|
|
339
|
+
code: 'PROCESS_FAIL',
|
|
340
|
+
message: 'The order status is abnormal. Please check the payment status and contact the merchant.'
|
|
341
|
+
},
|
|
342
|
+
INQUIRY_PAYMENT_SESSION_FAILED: {
|
|
343
|
+
code: 'INQUIRY_PAYMENT_SESSION_FAILED',
|
|
344
|
+
message: 'Unknown anomaly. Please check the payment status and contact the merchant.'
|
|
345
|
+
}
|
|
329
346
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressMountOptions, IElementOptions,
|
|
1
|
+
import { AddressMountOptions, ICommonApiResponse, IElementOptions, IPaymentApiResponse, LinkAuthMountOptions, PaymentMountOptions } from '../type';
|
|
2
2
|
declare class ElementController {
|
|
3
3
|
private options;
|
|
4
4
|
private elementContainer;
|
|
@@ -23,7 +23,7 @@ declare class ElementController {
|
|
|
23
23
|
private setInitTimeout;
|
|
24
24
|
private initializeAndMountProcessor;
|
|
25
25
|
private handleStartBizFlowError;
|
|
26
|
-
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string):
|
|
26
|
+
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string): Promise<ICommonApiResponse>;
|
|
27
27
|
private onValidateFunc;
|
|
28
28
|
private onValidateAndSubmitPay;
|
|
29
29
|
/**
|
|
@@ -33,12 +33,7 @@ declare class ElementController {
|
|
|
33
33
|
validateFields(): Promise<{
|
|
34
34
|
isValid: boolean;
|
|
35
35
|
}>;
|
|
36
|
-
submitPayment(): Promise<
|
|
37
|
-
error: {
|
|
38
|
-
readonly code: "UI_STATE_ERROR";
|
|
39
|
-
readonly message: "The request is abnormal and the transaction cannot be initiated.";
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
36
|
+
submitPayment(): Promise<IPaymentApiResponse>;
|
|
42
37
|
private changeLoading;
|
|
43
38
|
private addEventListener;
|
|
44
39
|
private sendRequestAndWaitWebLaunch;
|
|
@@ -38,7 +38,7 @@ import { ElementContainerService } from "../elementContainerService"; // 引入
|
|
|
38
38
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
|
39
39
|
import { EventCenter as ElementEventCenter } from "../EventCenter/index";
|
|
40
40
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
|
41
|
-
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType } from "../type";
|
|
41
|
+
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
|
|
42
42
|
import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, showToast } from "../util";
|
|
43
43
|
var TIMEOUT_DURATION = 10000;
|
|
44
44
|
var ElementController = /*#__PURE__*/function () {
|
|
@@ -327,7 +327,8 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
327
327
|
break;
|
|
328
328
|
}
|
|
329
329
|
res = {
|
|
330
|
-
error: ERRORMESSAGE.UI_STATE_ERROR
|
|
330
|
+
error: ERRORMESSAGE.UI_STATE_ERROR,
|
|
331
|
+
status: PaymentStatus.FAIL
|
|
331
332
|
};
|
|
332
333
|
this.elementEventCenter.endEvent(startEventId, res);
|
|
333
334
|
return _context4.abrupt("return", Promise.resolve(res));
|
|
@@ -367,8 +368,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
367
368
|
_context2.next = 11;
|
|
368
369
|
break;
|
|
369
370
|
}
|
|
371
|
+
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
370
372
|
recordResult = data;
|
|
371
|
-
resolve(
|
|
373
|
+
resolve(recordResult);
|
|
372
374
|
return _context2.abrupt("return", false);
|
|
373
375
|
case 11:
|
|
374
376
|
return _context2.abrupt("return", true);
|
|
@@ -409,8 +411,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
409
411
|
case 15:
|
|
410
412
|
_yield$_this3$onValid2 = _context3.sent;
|
|
411
413
|
data = _yield$_this3$onValid2.data;
|
|
414
|
+
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
415
|
+
// TODO checkout 返回的错误未包含 status 和 message @马杰 @薛浩
|
|
412
416
|
recordResult = data;
|
|
413
|
-
resolve(
|
|
417
|
+
resolve(recordResult);
|
|
414
418
|
case 19:
|
|
415
419
|
_context3.next = 27;
|
|
416
420
|
break;
|
|
@@ -418,11 +422,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
418
422
|
_context3.prev = 21;
|
|
419
423
|
_context3.t0 = _context3["catch"](0);
|
|
420
424
|
errorResult = {
|
|
421
|
-
error: {
|
|
422
|
-
code: ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED.code,
|
|
425
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED), {}, {
|
|
423
426
|
context: JSON.stringify(_context3.t0)
|
|
424
|
-
},
|
|
425
|
-
status:
|
|
427
|
+
}),
|
|
428
|
+
status: PaymentStatus.FAIL
|
|
426
429
|
};
|
|
427
430
|
_this3.serviceMap.Log.logError({
|
|
428
431
|
title: ELEMENT_SPM_MAP.sdk_element_missKeyData
|
|
@@ -608,12 +611,13 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
608
611
|
traceId = _response$originActio.traceId,
|
|
609
612
|
errorCode = _response$originActio.errorCode,
|
|
610
613
|
errorMessage = _response$originActio.errorMessage;
|
|
611
|
-
var error = {
|
|
612
|
-
code: ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED.code
|
|
613
|
-
};
|
|
614
|
+
var error = _objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED);
|
|
614
615
|
if (PROMISE_CALLBACK_CODE[errorCode]) {
|
|
615
|
-
|
|
616
|
-
error
|
|
616
|
+
var _PROMISE_CALLBACK_COD;
|
|
617
|
+
error = {
|
|
618
|
+
code: PROMISE_CALLBACK_CODE[errorCode].code,
|
|
619
|
+
message: ((_PROMISE_CALLBACK_COD = PROMISE_CALLBACK_CODE[errorCode]) === null || _PROMISE_CALLBACK_COD === void 0 ? void 0 : _PROMISE_CALLBACK_COD.message) || errorMessage
|
|
620
|
+
};
|
|
617
621
|
} else {
|
|
618
622
|
this.serviceMap.Log.logError({
|
|
619
623
|
title: ELEMENT_SPM_MAP.sdk_element_missKeyData
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IElementOptions, PaymentMountOptions } from './type';
|
|
2
2
|
export declare class ElementComponent {
|
|
3
3
|
private options;
|
|
4
4
|
private controller;
|
|
5
5
|
constructor(options: IElementOptions);
|
|
6
6
|
updatePayment(paymentSessionData: any): Promise<unknown>;
|
|
7
|
-
mount(renderOptions:
|
|
8
|
-
mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
|
9
|
-
mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
|
|
7
|
+
mount(renderOptions: PaymentMountOptions, sdkSelector: string): Promise<import("./type").ICommonApiResponse>;
|
|
10
8
|
validateFields(): Promise<{
|
|
11
9
|
isValid: boolean;
|
|
12
10
|
}>;
|
|
13
|
-
submitPayment(): Promise<import("./type").
|
|
14
|
-
error: {
|
|
15
|
-
readonly code: "UI_STATE_ERROR";
|
|
16
|
-
readonly message: "The request is abnormal and the transaction cannot be initiated.";
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
11
|
+
submitPayment(): Promise<import("./type").IPaymentApiResponse>;
|
|
19
12
|
destroy(): void;
|
|
20
13
|
}
|
|
@@ -43,7 +43,10 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
|
43
43
|
return _updatePayment.apply(this, arguments);
|
|
44
44
|
}
|
|
45
45
|
return updatePayment;
|
|
46
|
-
}()
|
|
46
|
+
}() // 暂不透出 link 和 address element
|
|
47
|
+
// mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
|
|
48
|
+
// mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
|
49
|
+
// mount(renderOptions: PaymentMountOptions, sdkSelector: string);
|
|
47
50
|
}, {
|
|
48
51
|
key: "mount",
|
|
49
52
|
value: function mount(renderOptions, sdkSelector) {
|
|
@@ -36,6 +36,20 @@ export declare enum ElementType {
|
|
|
36
36
|
address = "address",
|
|
37
37
|
payment = "payment"
|
|
38
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
|
+
}
|
|
39
53
|
export declare const MountElementType: {
|
|
40
54
|
auth: ElementPaymentMethod;
|
|
41
55
|
address: ElementPaymentMethod;
|
|
@@ -194,6 +208,8 @@ export interface ValidateResult<T = {}> {
|
|
|
194
208
|
success: boolean;
|
|
195
209
|
data: {
|
|
196
210
|
success: boolean;
|
|
211
|
+
status: PaymentStatus;
|
|
212
|
+
message?: string;
|
|
197
213
|
data: T;
|
|
198
214
|
};
|
|
199
215
|
}
|
|
@@ -393,15 +409,17 @@ export interface IToastOptions {
|
|
|
393
409
|
icon?: 'SUCCESS' | 'FAIL';
|
|
394
410
|
spin?: boolean;
|
|
395
411
|
}
|
|
396
|
-
export interface
|
|
397
|
-
success?: boolean;
|
|
412
|
+
export interface ICommonApiResponse {
|
|
398
413
|
error?: {
|
|
399
414
|
code: string;
|
|
400
|
-
message
|
|
415
|
+
message: string;
|
|
401
416
|
traceId?: string;
|
|
402
417
|
context?: any;
|
|
403
418
|
};
|
|
404
|
-
|
|
419
|
+
}
|
|
420
|
+
export interface IPaymentApiResponse extends ICommonApiResponse {
|
|
421
|
+
status: keyof typeof PaymentStatus;
|
|
422
|
+
userCanceled3D?: boolean;
|
|
405
423
|
}
|
|
406
424
|
export declare class InvalidElementConfigError extends Error {
|
|
407
425
|
errors: Array<{
|
|
@@ -49,6 +49,22 @@ export var ElementType = /*#__PURE__*/function (ElementType) {
|
|
|
49
49
|
ElementType["payment"] = "payment";
|
|
50
50
|
return ElementType;
|
|
51
51
|
}({});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* TODO 替换外外网链接
|
|
55
|
+
* 支付状态参考: https://yuque.antfin.com/antom_ka_team/yg9y7x/fe8xxqgbivnx5fd2#rGgE
|
|
56
|
+
*/
|
|
57
|
+
export var PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
|
|
58
|
+
PaymentStatus["SUCCESS"] = "SUCCESS";
|
|
59
|
+
PaymentStatus["PROCESSING"] = "PROCESSING";
|
|
60
|
+
PaymentStatus["CANCELLED"] = "CANCELLED";
|
|
61
|
+
PaymentStatus["PENDING"] = "PENDING";
|
|
62
|
+
PaymentStatus["S"] = "SUCCESS";
|
|
63
|
+
PaymentStatus["F"] = "FAIL";
|
|
64
|
+
PaymentStatus["U"] = "PROCESSING";
|
|
65
|
+
PaymentStatus["FAIL"] = "FAIL";
|
|
66
|
+
return PaymentStatus;
|
|
67
|
+
}({});
|
|
52
68
|
export var MountElementType = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT), ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT), ElementType.payment, ElementPaymentMethod.PAYMENT_ELEMENT), ElementPaymentMethod.AUTH_ELEMENT, ElementType.auth), ElementPaymentMethod.ADDRESS_ELEMENT, ElementType.address), ElementPaymentMethod.PAYMENT_ELEMENT, ElementType.payment);
|
|
53
69
|
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
|
54
70
|
ThemeType["NostalgicGray"] = "nostalgicGray";
|
|
@@ -26,7 +26,9 @@ export declare const validateElementOption: (options: IElementOptions) => {
|
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* 校验渲染条件
|
|
29
|
-
*
|
|
29
|
+
* 1.校验当前 sdkSelector 结点是否存在
|
|
30
|
+
* 2.校验当前 Element 的状态是否能够渲染
|
|
31
|
+
* 3.校验当前 type 类型 Elment 是否已经执行过 mount
|
|
30
32
|
*/
|
|
31
33
|
export declare function checkCanMount({ sdkSelector, containerService, status, }: {
|
|
32
34
|
sdkSelector: string;
|
|
@@ -37,7 +39,7 @@ export declare function checkCanMount({ sdkSelector, containerService, status, }
|
|
|
37
39
|
errorMsg?: string;
|
|
38
40
|
error?: {
|
|
39
41
|
code: string;
|
|
40
|
-
message
|
|
42
|
+
message: string;
|
|
41
43
|
};
|
|
42
44
|
};
|
|
43
45
|
export declare function checkCanUpdate({ status, paymentContainerService, newPaymentSessionData, oldPaymentSessionData, }: {
|
|
@@ -27,6 +27,7 @@ export var formatElementOption = function formatElementOption(options) {
|
|
|
27
27
|
export var validateElementOption = function validateElementOption(options) {
|
|
28
28
|
var errors = [];
|
|
29
29
|
if (!options.sessionData) {
|
|
30
|
+
console.error('sessionData is empty, please check new AMSElement params.');
|
|
30
31
|
errors.push({
|
|
31
32
|
field: 'sessionData',
|
|
32
33
|
message: 'sessionData is empty'
|
|
@@ -47,7 +48,9 @@ export var validateElementOption = function validateElementOption(options) {
|
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
50
|
* 校验渲染条件
|
|
50
|
-
*
|
|
51
|
+
* 1.校验当前 sdkSelector 结点是否存在
|
|
52
|
+
* 2.校验当前 Element 的状态是否能够渲染
|
|
53
|
+
* 3.校验当前 type 类型 Elment 是否已经执行过 mount
|
|
51
54
|
*/
|
|
52
55
|
export function checkCanMount(_ref) {
|
|
53
56
|
var sdkSelector = _ref.sdkSelector,
|
|
@@ -17,13 +17,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
17
17
|
* 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.
|
|
18
18
|
*/
|
|
19
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
|
+
import { ElementPaymentMethod } from "../../core/component/element/type";
|
|
20
21
|
import { v4 as uuid } from 'uuid';
|
|
21
22
|
import { sdkVersion } from "../../config";
|
|
22
23
|
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
|
|
23
|
-
import { ElementPaymentMethod } from "../../core/component/oldElement/type";
|
|
24
24
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
|
25
25
|
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
|
26
|
-
import { getType, isJsonString, isPC
|
|
26
|
+
import { device, getType, isJsonString, isPC } from "../../util";
|
|
27
27
|
import { getBackScheme } from "../../util/getBackScheme";
|
|
28
28
|
import { isLocalMock } from "../../util/mock";
|
|
29
29
|
import { matchVersion } from "../../util/versionCompare";
|
package/esm/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { IApplePayContactField } from '../plugin/applepay/interface';
|
|
9
9
|
export type onChange = () => onCnageResult;
|
|
10
|
-
export { ElementType, PaymentElementLayout, ThemeType
|
|
10
|
+
export { type IElementOptions, ElementType, PaymentElementLayout, ThemeType } from '../core/component/element/type';
|
|
11
11
|
interface onCnageResult {
|
|
12
12
|
complete: boolean;
|
|
13
13
|
addressValue: AddressItem[];
|
|
@@ -838,6 +838,6 @@ export declare enum EventLoggingEventId {
|
|
|
838
838
|
}
|
|
839
839
|
export interface ErrorMessage {
|
|
840
840
|
code: string;
|
|
841
|
-
message
|
|
841
|
+
message: string;
|
|
842
842
|
[key: string]: ErrorMessage | string;
|
|
843
843
|
}
|
package/esm/types/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
10
|
|
|
11
|
-
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/
|
|
11
|
+
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/element/type";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* SDK options
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AddressMountComponentsParams } from '../type';
|
|
2
|
-
interface ElementAddressMountOptions extends Omit<AddressMountComponentsParams, 'type'> {
|
|
3
|
-
selector: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class ElementAddressComponent {
|
|
6
|
-
private sdk;
|
|
7
|
-
private elementContainer;
|
|
8
|
-
private isConnect;
|
|
9
|
-
constructor();
|
|
10
|
-
create(options: {
|
|
11
|
-
environment: string;
|
|
12
|
-
locale: string;
|
|
13
|
-
appVersion: string;
|
|
14
|
-
}, isConnect: boolean): void;
|
|
15
|
-
mount(options: ElementAddressMountOptions): Promise<HTMLIFrameElement | undefined>;
|
|
16
|
-
update(): void;
|
|
17
|
-
unmount(): void;
|
|
18
|
-
}
|
|
19
|
-
export {};
|