@alipay/ams-checkout 0.0.1693912790-dev.3 → 0.0.1694400497-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/constant/index.d.ts +53 -32
- package/esm/constant/index.js +53 -32
- package/esm/core/component/index.d.ts +23 -16
- package/esm/core/component/index.js +155 -44
- package/esm/core/drop-in/index.d.ts +4 -11
- package/esm/core/drop-in/index.js +19 -19
- package/esm/core/instance/index.d.ts +6 -15
- package/esm/core/instance/index.js +32 -53
- package/esm/image/skeleton.svg +18 -0
- package/esm/index.d.ts +4 -10
- package/esm/index.js +8 -30
- package/esm/plugin/component/cashierApp.d.ts +2 -2
- package/esm/plugin/component/cashierApp.js +16 -15
- package/esm/plugin/component/{component.style.d.ts → component.inline.style.d.ts} +4 -1
- package/esm/plugin/component/component.inline.style.js +38 -0
- package/esm/plugin/component/component.popup.style.d.ts +12 -0
- package/esm/plugin/component/component.popup.style.js +165 -0
- package/esm/plugin/component/index.d.ts +26 -33
- package/esm/plugin/component/index.js +243 -396
- package/esm/plugin/drop-in/index.d.ts +7 -9
- package/esm/plugin/drop-in/index.js +4 -3
- package/esm/request/index.d.ts +2 -9
- package/esm/request/index.js +15 -28
- package/esm/request/utils.d.ts +4 -4
- package/esm/request/utils.js +6 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +78 -51
- package/esm/types/index.js +85 -48
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +15 -8
- package/esm/util/get.js +7 -0
- package/esm/util/index.d.ts +8 -6
- package/esm/util/index.js +25 -11
- package/esm/util/mock.js +1 -2
- package/package.json +1 -1
- package/esm/plugin/component/component.style.js +0 -15
- package/esm/util/security.d.ts +0 -12
- package/esm/util/security.js +0 -107
@@ -1,5 +1,5 @@
|
|
1
1
|
import type AMSCheckout from '../../core/instance';
|
2
|
-
import type {
|
2
|
+
import type { IcreatePaymentParams, eventPayload } from '../../types';
|
3
3
|
export default class CheckoutApp {
|
4
4
|
app: any;
|
5
5
|
paymentMethodsResult: any;
|
@@ -16,13 +16,11 @@ export default class CheckoutApp {
|
|
16
16
|
/**
|
17
17
|
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
18
18
|
*/
|
19
|
-
setRender(createIframeNode:
|
20
|
-
selector: string | HTMLElement;
|
21
|
-
}) => Promise<void>): void;
|
19
|
+
setRender(createIframeNode: any): void;
|
22
20
|
/**
|
23
21
|
* @description High order function of rendering capability
|
24
22
|
*/
|
25
|
-
render(renderParams:
|
23
|
+
render(renderParams: IcreatePaymentParams): Promise<void>;
|
26
24
|
/**
|
27
25
|
* @description Cancel listening and destroy the dom
|
28
26
|
*/
|
@@ -49,15 +47,15 @@ export default class CheckoutApp {
|
|
49
47
|
/**
|
50
48
|
* @description Processing messages from iframe
|
51
49
|
*/
|
52
|
-
_handleAppMessage(data:
|
50
|
+
_handleAppMessage(data: eventPayload): void;
|
53
51
|
/**
|
54
52
|
* @description Send message to SDK
|
55
53
|
*/
|
56
|
-
_dispatchToSDK(data:
|
54
|
+
_dispatchToSDK(data: eventPayload): void;
|
57
55
|
/**
|
58
56
|
* @description Send message to iframe
|
59
57
|
*/
|
60
|
-
_dispatchToApp(data:
|
58
|
+
_dispatchToApp(data: eventPayload): void;
|
61
59
|
/**
|
62
60
|
* @description Subscribe to messages from SDK
|
63
61
|
*/
|
@@ -69,5 +67,5 @@ export default class CheckoutApp {
|
|
69
67
|
/**
|
70
68
|
* @description Send the post submission processing event, and the cashier applies the consumption result
|
71
69
|
*/
|
72
|
-
_handleRequestPayment(data:
|
70
|
+
_handleRequestPayment(data: eventPayload): void;
|
73
71
|
}
|
@@ -11,6 +11,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
11
11
|
* 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
|
12
12
|
* 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.
|
13
13
|
*/
|
14
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
14
15
|
import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
15
16
|
import { messageName } from "../../types";
|
16
17
|
import { getOrigin, getType, getViewPort, isDom, isJsonString, serialize } from "../../util";
|
@@ -185,7 +186,7 @@ var CheckoutApp = /*#__PURE__*/function () {
|
|
185
186
|
id = 'checkout-dropin';
|
186
187
|
break;
|
187
188
|
case 'COMPONENT':
|
188
|
-
id = 'checkout-component';
|
189
|
+
id = 'ams-checkout-component';
|
189
190
|
break;
|
190
191
|
}
|
191
192
|
return id;
|
@@ -264,7 +265,7 @@ var CheckoutApp = /*#__PURE__*/function () {
|
|
264
265
|
appId: BASEPLUGINID,
|
265
266
|
instanceId: this.AMSSDK._instanceId
|
266
267
|
}, data);
|
267
|
-
this.AMSSDK.
|
268
|
+
this.AMSSDK._eventCenter.emit("".concat(BASEPLUGINID, "-").concat(data.context.event), _data);
|
268
269
|
}
|
269
270
|
/**
|
270
271
|
* @description Send message to iframe
|
@@ -288,7 +289,7 @@ var CheckoutApp = /*#__PURE__*/function () {
|
|
288
289
|
for (var key in eventKeyMap) {
|
289
290
|
// eslint-disable-next-line no-prototype-builtins
|
290
291
|
if (eventKeyMap.hasOwnProperty(key)) {
|
291
|
-
this.AMSSDK.
|
292
|
+
this.AMSSDK._eventCenter.on("".concat(BASEPLUGINID, "-").concat(key), eventKeyMap[key].bind(this));
|
292
293
|
}
|
293
294
|
}
|
294
295
|
}
|
package/esm/request/index.d.ts
CHANGED
@@ -1,15 +1,8 @@
|
|
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 { RequestConfig } from '../types';
|
1
|
+
import { IrequestConfig } from '../types';
|
9
2
|
/**
|
10
3
|
*
|
11
4
|
* @param requestData 请求参数
|
12
5
|
* @param options 请求配置
|
13
6
|
* @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
|
14
7
|
*/
|
15
|
-
export declare function request<T>(requestData: Record<string, any> | undefined, options:
|
8
|
+
export declare function request<T>(requestData: Record<string, any> | undefined, options: IrequestConfig): Promise<T>;
|
package/esm/request/index.js
CHANGED
@@ -14,12 +14,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
14
14
|
* 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
|
15
15
|
* 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.
|
16
16
|
*/
|
17
|
-
|
17
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
18
|
import { sdkVersion } from "../config/index";
|
19
19
|
import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
|
20
|
-
import {
|
20
|
+
import { errorEnum } from "../types";
|
21
21
|
import { get } from "../util/get";
|
22
|
-
import { getApdidToken, getAppname } from "../util/security";
|
23
22
|
import axios from 'axios';
|
24
23
|
import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
|
25
24
|
var _queryParse = queryParse(),
|
@@ -64,7 +63,7 @@ export function request(_x, _x2) {
|
|
64
63
|
}
|
65
64
|
function _request() {
|
66
65
|
_request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestData, options) {
|
67
|
-
var myRequest, startTime, envInfo,
|
66
|
+
var myRequest, startTime, envInfo, _navigator, _data, _yield$myRequest, data, headers, resData, traceId, handleGetWayError, _error$message, _error, timeoutCode, errorCode;
|
68
67
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
69
68
|
while (1) switch (_context.prev = _context.next) {
|
70
69
|
case 0:
|
@@ -84,16 +83,6 @@ function _request() {
|
|
84
83
|
screenHeight: screen.height,
|
85
84
|
timeZoneOffset: new Date().getTimezoneOffset()
|
86
85
|
};
|
87
|
-
if (!(options !== null && options !== void 0 && options.needDeviceId)) {
|
88
|
-
_context.next = 8;
|
89
|
-
break;
|
90
|
-
}
|
91
|
-
_context.next = 6;
|
92
|
-
return getApdidToken(getAppname('Card'), options === null || options === void 0 ? void 0 : options.waitTime);
|
93
|
-
case 6:
|
94
|
-
deviceId = _context.sent;
|
95
|
-
envInfo.deviceId = deviceId;
|
96
|
-
case 8:
|
97
86
|
try {
|
98
87
|
envInfo.browserInfo.browserJavaEnabled = ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.javaEnabled()) || false;
|
99
88
|
// eslint-disable-next-line no-empty
|
@@ -105,12 +94,12 @@ function _request() {
|
|
105
94
|
refUrl: window.location.href
|
106
95
|
}
|
107
96
|
})] : [requestData];
|
108
|
-
_context.prev =
|
109
|
-
_context.next =
|
97
|
+
_context.prev = 6;
|
98
|
+
_context.next = 9;
|
110
99
|
return myRequest({
|
111
100
|
data: _data
|
112
101
|
});
|
113
|
-
case
|
102
|
+
case 9:
|
114
103
|
_yield$myRequest = _context.sent;
|
115
104
|
data = _yield$myRequest.data;
|
116
105
|
headers = _yield$myRequest.headers;
|
@@ -119,7 +108,7 @@ function _request() {
|
|
119
108
|
resData.traceId = traceId || '';
|
120
109
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
121
110
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
122
|
-
_context.next =
|
111
|
+
_context.next = 18;
|
123
112
|
break;
|
124
113
|
}
|
125
114
|
throw new Error(JSON.stringify({
|
@@ -127,30 +116,28 @@ function _request() {
|
|
127
116
|
errorCode: handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorCode,
|
128
117
|
success: false
|
129
118
|
}));
|
130
|
-
case
|
119
|
+
case 18:
|
131
120
|
return _context.abrupt("return", resData);
|
132
|
-
case
|
133
|
-
_context.prev =
|
134
|
-
_context.t0 = _context["catch"](
|
135
|
-
// eslint-disable-next-line no-console
|
136
|
-
console.log('request error', _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
|
121
|
+
case 21:
|
122
|
+
_context.prev = 21;
|
123
|
+
_context.t0 = _context["catch"](6);
|
137
124
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
138
125
|
success: false,
|
139
|
-
errorCode:
|
126
|
+
errorCode: errorEnum.SYSTEM,
|
140
127
|
errorMessage: ''
|
141
128
|
});
|
142
|
-
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ?
|
129
|
+
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
143
130
|
errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
|
144
131
|
return _context.abrupt("return", Promise.reject({
|
145
132
|
success: false,
|
146
133
|
errorCode: errorCode,
|
147
134
|
errorMessage: ''
|
148
135
|
}));
|
149
|
-
case
|
136
|
+
case 27:
|
150
137
|
case "end":
|
151
138
|
return _context.stop();
|
152
139
|
}
|
153
|
-
}, _callee, null, [[
|
140
|
+
}, _callee, null, [[6, 21]]);
|
154
141
|
}));
|
155
142
|
return _request.apply(this, arguments);
|
156
143
|
}
|
package/esm/request/utils.d.ts
CHANGED
@@ -5,19 +5,19 @@
|
|
5
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
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
7
|
*/
|
8
|
-
import {
|
8
|
+
import { errorEnum } from '../types';
|
9
9
|
export declare const safeJson: (data: any, obj: any) => any;
|
10
10
|
export declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
|
11
11
|
success: boolean;
|
12
12
|
traceId: string;
|
13
|
-
errorCode:
|
13
|
+
errorCode: errorEnum;
|
14
14
|
resultStatus: any;
|
15
15
|
errorMessage?: undefined;
|
16
16
|
result?: undefined;
|
17
17
|
} | {
|
18
18
|
success: boolean;
|
19
19
|
traceId: string;
|
20
|
-
errorCode:
|
20
|
+
errorCode: errorEnum;
|
21
21
|
errorMessage: string;
|
22
22
|
result: {
|
23
23
|
resultStatus: any;
|
@@ -25,4 +25,4 @@ export declare const fomatGetwayError: (headers: Record<string, any>, traceId: s
|
|
25
25
|
memo: string;
|
26
26
|
};
|
27
27
|
resultStatus: any;
|
28
|
-
};
|
28
|
+
} | null;
|
package/esm/request/utils.js
CHANGED
@@ -6,8 +6,10 @@
|
|
6
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
7
|
*/
|
8
8
|
|
9
|
-
import {
|
9
|
+
import { errorEnum } from "../types";
|
10
10
|
import { get } from "../util/get";
|
11
|
+
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
11
13
|
export var safeJson = function safeJson(data, obj) {
|
12
14
|
try {
|
13
15
|
return JSON.parse(data) || obj;
|
@@ -26,7 +28,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
26
28
|
return {
|
27
29
|
success: false,
|
28
30
|
traceId: traceId,
|
29
|
-
errorCode:
|
31
|
+
errorCode: errorEnum.LOGIN,
|
30
32
|
resultStatus: resultStatus
|
31
33
|
};
|
32
34
|
}
|
@@ -35,7 +37,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
35
37
|
return {
|
36
38
|
success: false,
|
37
39
|
traceId: traceId,
|
38
|
-
errorCode:
|
40
|
+
errorCode: errorEnum.TIMEOUT,
|
39
41
|
resultStatus: resultStatus
|
40
42
|
};
|
41
43
|
}
|
@@ -45,7 +47,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
45
47
|
return {
|
46
48
|
success: false,
|
47
49
|
traceId: traceId,
|
48
|
-
errorCode:
|
50
|
+
errorCode: errorEnum.GATEWAY,
|
49
51
|
errorMessage: decodeURIComponent(tips || ''),
|
50
52
|
result: {
|
51
53
|
resultStatus: resultStatus || '',
|
package/esm/service/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult,
|
2
|
-
export declare function queryPaymentInfo(params?: CashierSdkActionQueryRequest, options?:
|
1
|
+
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, IrequestConfig } from '../types';
|
2
|
+
export declare function queryPaymentInfo(params?: CashierSdkActionQueryRequest, options?: IrequestConfig): Promise<CashierSdkActionQueryResult>;
|
package/esm/types/index.d.ts
CHANGED
@@ -8,27 +8,32 @@
|
|
8
8
|
/**
|
9
9
|
* SDK options
|
10
10
|
*/
|
11
|
-
export interface
|
11
|
+
export interface IoptionsParams {
|
12
12
|
environment?: string;
|
13
13
|
locale?: string;
|
14
14
|
onError?: callOnError;
|
15
15
|
onSizeChanged?: callOnSizeChanged;
|
16
16
|
onPaymentMethodSelected?: callonPaymentMethodSelected;
|
17
17
|
onLog?: callOnLog;
|
18
|
-
onEventCallback?:
|
19
|
-
onClose?:
|
18
|
+
onEventCallback?: callOnEventCallback;
|
19
|
+
onClose?: callOnClose;
|
20
20
|
networkMode?: string;
|
21
21
|
mode?: string;
|
22
22
|
analytics?: {
|
23
23
|
enabled: boolean;
|
24
24
|
};
|
25
25
|
}
|
26
|
-
export
|
26
|
+
export type Iselector = string;
|
27
|
+
export declare enum renderDisplayTypeEnum {
|
28
|
+
'popup' = "popup",
|
29
|
+
'inline' = "inline"
|
30
|
+
}
|
31
|
+
export interface IcreatePaymentParams {
|
27
32
|
paymentMethodsResult?: any;
|
28
33
|
paymentSessionData?: string;
|
29
|
-
selector:
|
34
|
+
selector: Iselector;
|
30
35
|
appearance?: {
|
31
|
-
displayType?:
|
36
|
+
displayType?: checkoutDisplayEnum;
|
32
37
|
backgroundColor?: string;
|
33
38
|
};
|
34
39
|
}
|
@@ -51,29 +56,20 @@ export declare enum paymentMethodCategoryTypeEnum {
|
|
51
56
|
}
|
52
57
|
export interface IcreateComponent {
|
53
58
|
paymentSessionData: string;
|
54
|
-
selector?: string | HTMLElement;
|
55
59
|
appearance?: Record<string, any>;
|
56
60
|
}
|
57
61
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
58
|
-
paymentSessionMetaData
|
62
|
+
paymentSessionMetaData: IpaymentSessionMetaData;
|
63
|
+
renderDisplayType: renderDisplayTypeEnum;
|
64
|
+
selector?: Iselector;
|
59
65
|
}
|
60
66
|
interface IpaymentSessionConfig {
|
61
67
|
productScene: productSceneEnum;
|
62
68
|
paymentMethodCategoryType: paymentMethodCategoryTypeEnum;
|
63
69
|
productSceneVersion: string;
|
64
70
|
}
|
65
|
-
interface IpaymentSecurityConfig {
|
66
|
-
appId: string;
|
67
|
-
appName: string;
|
68
|
-
bizToken: string;
|
69
|
-
gateway: string;
|
70
|
-
h5gateway: string;
|
71
|
-
tokenCollectTime: string;
|
72
|
-
workSpaceId: string;
|
73
|
-
}
|
74
71
|
export interface IpaymentSessionMetaData {
|
75
72
|
paymentSessionConfig?: IpaymentSessionConfig;
|
76
|
-
securityConfig?: IpaymentSecurityConfig;
|
77
73
|
moneyView?: any;
|
78
74
|
extendInfo?: string;
|
79
75
|
paymentMethodInfoView?: any;
|
@@ -84,75 +80,98 @@ export interface IpaymentSessionMetaData {
|
|
84
80
|
export declare enum localeEnum {
|
85
81
|
'en-US' = "en-US"
|
86
82
|
}
|
87
|
-
export declare enum
|
83
|
+
export declare enum checkoutDisplayEnum {
|
88
84
|
horizon = "horizon",
|
89
85
|
vertical = "vertical"
|
90
86
|
}
|
91
|
-
export declare enum
|
87
|
+
export declare enum modeEnum {
|
92
88
|
dropin = "dropin",
|
93
89
|
component = "component"
|
94
90
|
}
|
95
|
-
export declare enum
|
91
|
+
export declare enum networkModeEnum {
|
96
92
|
proxy = "proxy",
|
97
93
|
session = "session"
|
98
94
|
}
|
99
|
-
export interface
|
100
|
-
paymentMethodType
|
95
|
+
export interface IcheckoutState {
|
96
|
+
paymentMethodType?: string;
|
101
97
|
}
|
102
|
-
export declare enum
|
98
|
+
export declare enum environmentEnum {
|
103
99
|
sandbox = "sandbox",
|
104
100
|
prod = "prod",
|
105
101
|
light_sandbox = "light_sandbox"
|
106
102
|
}
|
107
|
-
export declare enum
|
103
|
+
export declare enum osTypeEnum {
|
108
104
|
IOS = "IOS",
|
109
105
|
ANDROID = "ANDROID",
|
110
106
|
ELSE = "ELSE"
|
111
107
|
}
|
112
|
-
export declare enum
|
108
|
+
export declare enum terminalTypeEnum {
|
113
109
|
WEB = "WEB",
|
114
110
|
WAP = "WAP",
|
115
111
|
APP = "APP",
|
116
112
|
MINI_APP = "MINI_APP"
|
117
113
|
}
|
118
|
-
export interface
|
119
|
-
osType?:
|
120
|
-
terminalType:
|
114
|
+
export interface Ienv {
|
115
|
+
osType?: osTypeEnum;
|
116
|
+
terminalType: terminalTypeEnum;
|
121
117
|
environment: string;
|
122
118
|
}
|
119
|
+
export declare enum platformEnum {
|
120
|
+
desktop = "desktop",
|
121
|
+
mobile = "mobile"
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* @description Create an event handler, called when an error occurs in AMSCheckout.
|
125
|
+
*/
|
123
126
|
export type callOnError = (state: {
|
124
|
-
|
125
|
-
|
127
|
+
code: string;
|
128
|
+
message: string;
|
126
129
|
stack?: any;
|
127
130
|
}) => void;
|
131
|
+
/**
|
132
|
+
* @description Create an event handler, called when the general log triggers during the SDK runtime.
|
133
|
+
*/
|
134
|
+
export type callOnLog = (state: {
|
135
|
+
code: string;
|
136
|
+
message: string;
|
137
|
+
}) => void;
|
138
|
+
/**
|
139
|
+
* @description Create an event handler, during the running of the sdk, some events are called after execution, and the specific event code is returned.
|
140
|
+
*/
|
141
|
+
export type callOnEventCallback = (state: {
|
142
|
+
code: string;
|
143
|
+
message: string;
|
144
|
+
}) => void;
|
128
145
|
export type callonPaymentMethodSelected = (state: {
|
129
146
|
paymentMethodType: string;
|
130
147
|
}) => void;
|
131
148
|
export type callOnSizeChanged = (state: {
|
132
|
-
width:
|
133
|
-
height:
|
134
|
-
}) => void;
|
135
|
-
export type callOnLog = (state: {
|
136
|
-
code: string;
|
137
|
-
message: string;
|
149
|
+
width: number;
|
150
|
+
height: number;
|
138
151
|
}) => void;
|
152
|
+
/**
|
153
|
+
* @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
|
154
|
+
*/
|
155
|
+
export type callOnClose = () => void;
|
139
156
|
export declare enum messageName {
|
140
157
|
SDK_TO_APP = "SDK_TO_APP",
|
141
158
|
APP_TO_SDK = "APP_TO_SDK",
|
142
159
|
APP_TO_APP = "APP_TO_APP"
|
143
160
|
}
|
144
|
-
export interface
|
161
|
+
export interface eventPayload {
|
145
162
|
name: messageName;
|
146
163
|
mode?: string;
|
147
164
|
appId?: string;
|
148
165
|
instanceId: string;
|
149
|
-
context:
|
150
|
-
|
151
|
-
|
152
|
-
|
166
|
+
context: eventPayloadContext;
|
167
|
+
}
|
168
|
+
export interface eventPayloadContext {
|
169
|
+
event: string;
|
170
|
+
data: any;
|
171
|
+
eventCallbackId?: string;
|
153
172
|
}
|
154
173
|
export interface AMSCheckoutOptions {
|
155
|
-
env:
|
174
|
+
env: Ienv;
|
156
175
|
locale: string;
|
157
176
|
networkMode: string;
|
158
177
|
mode: string;
|
@@ -161,7 +180,11 @@ export interface AMSCheckoutOptions {
|
|
161
180
|
export interface Ianalytics {
|
162
181
|
enabled: boolean;
|
163
182
|
}
|
164
|
-
export declare enum
|
183
|
+
export declare enum targetEnum {
|
184
|
+
BLANK = "_blank",
|
185
|
+
SELF = "_self"
|
186
|
+
}
|
187
|
+
export declare enum errorEnum {
|
165
188
|
PARAMS = "PARAMS",
|
166
189
|
TIMEOUT = "TIMEOUT",
|
167
190
|
NETWORK = "NETWORK",
|
@@ -176,7 +199,7 @@ export declare enum ERROR {
|
|
176
199
|
SIGNIN = "SIGNIN",
|
177
200
|
GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
|
178
201
|
}
|
179
|
-
export interface
|
202
|
+
export interface IrequestConfig {
|
180
203
|
env?: string;
|
181
204
|
baseURL?: string;
|
182
205
|
timeout?: number;
|
@@ -188,8 +211,6 @@ export interface RequestConfig {
|
|
188
211
|
beforerRequest?: () => void;
|
189
212
|
afterRequest?: () => void;
|
190
213
|
needEnvInfo?: boolean;
|
191
|
-
needDeviceId?: boolean;
|
192
|
-
waitTime?: string;
|
193
214
|
locale?: string;
|
194
215
|
hostSign?: string;
|
195
216
|
}
|
@@ -216,13 +237,19 @@ export interface CashierSdkActionQueryResult {
|
|
216
237
|
schemeUrl?: string;
|
217
238
|
authUrl?: string;
|
218
239
|
}
|
240
|
+
export declare enum eventCodeEnum {
|
241
|
+
SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
|
242
|
+
SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
|
243
|
+
SDK_INTERNAL_ERROR = "SDK_INTERNAL_ERROR",
|
244
|
+
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
|
245
|
+
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
|
246
|
+
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
247
|
+
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
248
|
+
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
|
249
|
+
}
|
219
250
|
declare global {
|
220
251
|
interface Window {
|
221
252
|
[key: string]: any;
|
222
253
|
}
|
223
254
|
}
|
224
|
-
export declare enum Target {
|
225
|
-
BLANK = "_blank",
|
226
|
-
SELF = "_self"
|
227
|
-
}
|
228
255
|
export {};
|