@alipay/ams-checkout 0.0.1693189296-dev.0 → 0.0.1693912790-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/constant/index.d.ts +32 -41
- package/esm/constant/index.js +32 -41
- package/esm/core/component/index.d.ts +9 -22
- package/esm/core/component/index.js +43 -145
- package/esm/core/drop-in/index.d.ts +1 -1
- package/esm/core/instance/index.d.ts +15 -6
- package/esm/core/instance/index.js +53 -31
- package/esm/index.d.ts +10 -4
- package/esm/index.js +30 -8
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +15 -16
- package/esm/plugin/component/component.style.d.ts +1 -4
- package/esm/plugin/component/component.style.js +4 -32
- package/esm/plugin/component/index.d.ts +10 -22
- package/esm/plugin/component/index.js +159 -218
- package/esm/plugin/drop-in/index.js +1 -1
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +3 -3
- package/esm/request/utils.d.ts +3 -3
- package/esm/request/utils.js +4 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +34 -71
- package/esm/types/index.js +47 -84
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +8 -8
- package/esm/util/index.d.ts +4 -6
- package/esm/util/index.js +5 -22
- package/esm/util/mock.js +2 -1
- package/package.json +1 -1
- package/esm/image/skeleton.svg +0 -18
package/esm/request/index.d.ts
CHANGED
@@ -5,11 +5,11 @@
|
|
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 { RequestConfig } from '../types';
|
9
9
|
/**
|
10
10
|
*
|
11
11
|
* @param requestData 请求参数
|
12
12
|
* @param options 请求配置
|
13
13
|
* @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
|
14
14
|
*/
|
15
|
-
export declare function request<T>(requestData: Record<string, any> | undefined, options:
|
15
|
+
export declare function request<T>(requestData: Record<string, any> | undefined, options: RequestConfig): Promise<T>;
|
package/esm/request/index.js
CHANGED
@@ -17,7 +17,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
17
17
|
|
18
18
|
import { sdkVersion } from "../config/index";
|
19
19
|
import { appId, hostSignMap, lightSandboxMap, requestHost, sofaId, tntInstId } from "../config/request";
|
20
|
-
import {
|
20
|
+
import { ERROR } from "../types";
|
21
21
|
import { get } from "../util/get";
|
22
22
|
import axios from 'axios';
|
23
23
|
import { device, fomatGetwayError, isPC, queryParse, safeJson } from "../util";
|
@@ -125,10 +125,10 @@ function _request() {
|
|
125
125
|
console.log('request error', _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
|
126
126
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
127
127
|
success: false,
|
128
|
-
errorCode:
|
128
|
+
errorCode: ERROR.SYSTEM,
|
129
129
|
errorMessage: ''
|
130
130
|
});
|
131
|
-
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ?
|
131
|
+
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? ERROR.TIMEOUT : '';
|
132
132
|
errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode) || timeoutCode;
|
133
133
|
return _context.abrupt("return", Promise.reject({
|
134
134
|
success: false,
|
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 { ERROR } 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: ERROR;
|
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: ERROR;
|
21
21
|
errorMessage: string;
|
22
22
|
result: {
|
23
23
|
resultStatus: any;
|
package/esm/request/utils.js
CHANGED
@@ -6,7 +6,7 @@
|
|
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 { ERROR } from "../types";
|
10
10
|
import { get } from "../util/get";
|
11
11
|
export var safeJson = function safeJson(data, obj) {
|
12
12
|
try {
|
@@ -26,7 +26,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
26
26
|
return {
|
27
27
|
success: false,
|
28
28
|
traceId: traceId,
|
29
|
-
errorCode:
|
29
|
+
errorCode: ERROR.LOGIN,
|
30
30
|
resultStatus: resultStatus
|
31
31
|
};
|
32
32
|
}
|
@@ -35,7 +35,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
35
35
|
return {
|
36
36
|
success: false,
|
37
37
|
traceId: traceId,
|
38
|
-
errorCode:
|
38
|
+
errorCode: ERROR.TIMEOUT,
|
39
39
|
resultStatus: resultStatus
|
40
40
|
};
|
41
41
|
}
|
@@ -45,7 +45,7 @@ export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
45
45
|
return {
|
46
46
|
success: false,
|
47
47
|
traceId: traceId,
|
48
|
-
errorCode:
|
48
|
+
errorCode: ERROR.GATEWAY,
|
49
49
|
errorMessage: decodeURIComponent(tips || ''),
|
50
50
|
result: {
|
51
51
|
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, RequestConfig } from '../types';
|
2
|
+
export declare function queryPaymentInfo(params?: CashierSdkActionQueryRequest, options?: RequestConfig): Promise<CashierSdkActionQueryResult>;
|
package/esm/types/index.d.ts
CHANGED
@@ -8,32 +8,27 @@
|
|
8
8
|
/**
|
9
9
|
* SDK options
|
10
10
|
*/
|
11
|
-
export interface
|
11
|
+
export interface optionsParams {
|
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?: (state: any) => void;
|
19
|
+
onClose?: () => void;
|
20
20
|
networkMode?: string;
|
21
21
|
mode?: string;
|
22
22
|
analytics?: {
|
23
23
|
enabled: boolean;
|
24
24
|
};
|
25
25
|
}
|
26
|
-
export
|
27
|
-
export declare enum renderDisplayTypeEnum {
|
28
|
-
'popup' = "popup",
|
29
|
-
'inline' = "inline"
|
30
|
-
}
|
31
|
-
export interface IcreatePaymentParams {
|
26
|
+
export interface createPaymentParams {
|
32
27
|
paymentMethodsResult?: any;
|
33
28
|
paymentSessionData?: string;
|
34
|
-
selector:
|
29
|
+
selector: string | HTMLElement;
|
35
30
|
appearance?: {
|
36
|
-
displayType?:
|
31
|
+
displayType?: checkoutDisplay;
|
37
32
|
backgroundColor?: string;
|
38
33
|
};
|
39
34
|
}
|
@@ -56,12 +51,11 @@ export declare enum paymentMethodCategoryTypeEnum {
|
|
56
51
|
}
|
57
52
|
export interface IcreateComponent {
|
58
53
|
paymentSessionData: string;
|
54
|
+
selector?: string | HTMLElement;
|
59
55
|
appearance?: Record<string, any>;
|
60
56
|
}
|
61
57
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
62
|
-
paymentSessionMetaData
|
63
|
-
renderDisplayType: renderDisplayTypeEnum;
|
64
|
-
selector?: Iselector;
|
58
|
+
paymentSessionMetaData?: IpaymentSessionMetaData;
|
65
59
|
}
|
66
60
|
interface IpaymentSessionConfig {
|
67
61
|
productScene: productSceneEnum;
|
@@ -80,79 +74,58 @@ export interface IpaymentSessionMetaData {
|
|
80
74
|
export declare enum localeEnum {
|
81
75
|
'en-US' = "en-US"
|
82
76
|
}
|
83
|
-
export declare enum
|
77
|
+
export declare enum checkoutDisplay {
|
84
78
|
horizon = "horizon",
|
85
79
|
vertical = "vertical"
|
86
80
|
}
|
87
|
-
export declare enum
|
81
|
+
export declare enum mode {
|
88
82
|
dropin = "dropin",
|
89
83
|
component = "component"
|
90
84
|
}
|
91
|
-
export declare enum
|
85
|
+
export declare enum networkMode {
|
92
86
|
proxy = "proxy",
|
93
87
|
session = "session"
|
94
88
|
}
|
95
|
-
export interface
|
96
|
-
paymentMethodType
|
89
|
+
export interface checkoutState {
|
90
|
+
paymentMethodType: string;
|
97
91
|
}
|
98
|
-
export declare enum
|
92
|
+
export declare enum environment {
|
99
93
|
sandbox = "sandbox",
|
100
94
|
prod = "prod",
|
101
95
|
light_sandbox = "light_sandbox"
|
102
96
|
}
|
103
|
-
export declare enum
|
97
|
+
export declare enum osType {
|
104
98
|
IOS = "IOS",
|
105
99
|
ANDROID = "ANDROID",
|
106
100
|
ELSE = "ELSE"
|
107
101
|
}
|
108
|
-
export declare enum
|
102
|
+
export declare enum terminalType {
|
109
103
|
WEB = "WEB",
|
110
104
|
WAP = "WAP",
|
111
105
|
APP = "APP",
|
112
106
|
MINI_APP = "MINI_APP"
|
113
107
|
}
|
114
|
-
export interface
|
115
|
-
osType?:
|
116
|
-
terminalType:
|
108
|
+
export interface env {
|
109
|
+
osType?: osType;
|
110
|
+
terminalType: terminalType;
|
117
111
|
environment: string;
|
118
112
|
}
|
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
|
-
*/
|
126
113
|
export type callOnError = (state: {
|
127
|
-
|
128
|
-
|
114
|
+
errorMessage: string;
|
115
|
+
errorCode: string;
|
129
116
|
stack?: any;
|
130
117
|
}) => 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;
|
145
118
|
export type callonPaymentMethodSelected = (state: {
|
146
119
|
paymentMethodType: string;
|
147
120
|
}) => void;
|
148
121
|
export type callOnSizeChanged = (state: {
|
149
|
-
width:
|
150
|
-
height:
|
122
|
+
width: string;
|
123
|
+
height: string;
|
124
|
+
}) => void;
|
125
|
+
export type callOnLog = (state: {
|
126
|
+
code: string;
|
127
|
+
message: string;
|
151
128
|
}) => 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;
|
156
129
|
export declare enum messageName {
|
157
130
|
SDK_TO_APP = "SDK_TO_APP",
|
158
131
|
APP_TO_SDK = "APP_TO_SDK",
|
@@ -169,7 +142,7 @@ export interface eventPlayload {
|
|
169
142
|
};
|
170
143
|
}
|
171
144
|
export interface AMSCheckoutOptions {
|
172
|
-
env:
|
145
|
+
env: env;
|
173
146
|
locale: string;
|
174
147
|
networkMode: string;
|
175
148
|
mode: string;
|
@@ -178,11 +151,7 @@ export interface AMSCheckoutOptions {
|
|
178
151
|
export interface Ianalytics {
|
179
152
|
enabled: boolean;
|
180
153
|
}
|
181
|
-
export declare enum
|
182
|
-
BLANK = "_blank",
|
183
|
-
SELF = "_self"
|
184
|
-
}
|
185
|
-
export declare enum errorEnum {
|
154
|
+
export declare enum ERROR {
|
186
155
|
PARAMS = "PARAMS",
|
187
156
|
TIMEOUT = "TIMEOUT",
|
188
157
|
NETWORK = "NETWORK",
|
@@ -197,7 +166,7 @@ export declare enum errorEnum {
|
|
197
166
|
SIGNIN = "SIGNIN",
|
198
167
|
GETSIGNPARAMSERROR = "GETSIGNPARAMSERROR"
|
199
168
|
}
|
200
|
-
export interface
|
169
|
+
export interface RequestConfig {
|
201
170
|
env?: string;
|
202
171
|
baseURL?: string;
|
203
172
|
timeout?: number;
|
@@ -235,19 +204,13 @@ export interface CashierSdkActionQueryResult {
|
|
235
204
|
schemeUrl?: string;
|
236
205
|
authUrl?: string;
|
237
206
|
}
|
238
|
-
export declare enum eventCodeEnum {
|
239
|
-
SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
|
240
|
-
SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
|
241
|
-
SDK_INTERNAL_ERROR = "SDK_INTERNAL_ERROR",
|
242
|
-
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
|
243
|
-
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
|
244
|
-
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
245
|
-
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
246
|
-
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
|
247
|
-
}
|
248
207
|
declare global {
|
249
208
|
interface Window {
|
250
209
|
[key: string]: any;
|
251
210
|
}
|
252
211
|
}
|
212
|
+
export declare enum Target {
|
213
|
+
BLANK = "_blank",
|
214
|
+
SELF = "_self"
|
215
|
+
}
|
253
216
|
export {};
|
package/esm/types/index.js
CHANGED
@@ -10,11 +10,6 @@
|
|
10
10
|
* SDK options
|
11
11
|
*/
|
12
12
|
|
13
|
-
export var renderDisplayTypeEnum = /*#__PURE__*/function (renderDisplayTypeEnum) {
|
14
|
-
renderDisplayTypeEnum["popup"] = "popup";
|
15
|
-
renderDisplayTypeEnum["inline"] = "inline";
|
16
|
-
return renderDisplayTypeEnum;
|
17
|
-
}({});
|
18
13
|
export var componentSignEnum = /*#__PURE__*/function (componentSignEnum) {
|
19
14
|
componentSignEnum["EASY_PAY_WALLET"] = "EASY_PAY_WALLET";
|
20
15
|
componentSignEnum["CASHIER_PAYMENT_CARD"] = "CASHIER_PAYMENT_CARD";
|
@@ -39,96 +34,64 @@ export var localeEnum = /*#__PURE__*/function (localeEnum) {
|
|
39
34
|
localeEnum["en-US"] = "en-US";
|
40
35
|
return localeEnum;
|
41
36
|
}({});
|
42
|
-
export var
|
43
|
-
|
44
|
-
|
45
|
-
return
|
46
|
-
}({});
|
47
|
-
export var modeEnum = /*#__PURE__*/function (modeEnum) {
|
48
|
-
modeEnum["dropin"] = "dropin";
|
49
|
-
modeEnum["component"] = "component";
|
50
|
-
return modeEnum;
|
37
|
+
export var checkoutDisplay = /*#__PURE__*/function (checkoutDisplay) {
|
38
|
+
checkoutDisplay["horizon"] = "horizon";
|
39
|
+
checkoutDisplay["vertical"] = "vertical";
|
40
|
+
return checkoutDisplay;
|
51
41
|
}({});
|
52
|
-
export var
|
53
|
-
|
54
|
-
|
55
|
-
return
|
42
|
+
export var mode = /*#__PURE__*/function (mode) {
|
43
|
+
mode["dropin"] = "dropin";
|
44
|
+
mode["component"] = "component";
|
45
|
+
return mode;
|
56
46
|
}({});
|
57
|
-
export var
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
return environmentEnum;
|
47
|
+
export var networkMode = /*#__PURE__*/function (networkMode) {
|
48
|
+
networkMode["proxy"] = "proxy";
|
49
|
+
networkMode["session"] = "session";
|
50
|
+
return networkMode;
|
62
51
|
}({});
|
63
|
-
export var
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
return
|
52
|
+
export var environment = /*#__PURE__*/function (environment) {
|
53
|
+
environment["sandbox"] = "sandbox";
|
54
|
+
environment["prod"] = "prod";
|
55
|
+
environment["light_sandbox"] = "light_sandbox";
|
56
|
+
return environment;
|
68
57
|
}({});
|
69
|
-
export var
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
return terminalTypeEnum;
|
58
|
+
export var osType = /*#__PURE__*/function (osType) {
|
59
|
+
osType["IOS"] = "IOS";
|
60
|
+
osType["ANDROID"] = "ANDROID";
|
61
|
+
osType["ELSE"] = "ELSE";
|
62
|
+
return osType;
|
75
63
|
}({});
|
76
|
-
export var
|
77
|
-
|
78
|
-
|
79
|
-
|
64
|
+
export var terminalType = /*#__PURE__*/function (terminalType) {
|
65
|
+
terminalType["WEB"] = "WEB";
|
66
|
+
terminalType["WAP"] = "WAP";
|
67
|
+
terminalType["APP"] = "APP";
|
68
|
+
terminalType["MINI_APP"] = "MINI_APP";
|
69
|
+
return terminalType;
|
80
70
|
}({});
|
81
|
-
/**
|
82
|
-
* @description Create an event handler, called when an error occurs in AMSCheckout.
|
83
|
-
*/
|
84
|
-
|
85
|
-
/**
|
86
|
-
* @description Create an event handler, called when the general log triggers during the SDK runtime.
|
87
|
-
*/
|
88
|
-
|
89
|
-
/**
|
90
|
-
* @description Create an event handler, during the running of the sdk, some events are called after execution, and the specific event code is returned.
|
91
|
-
*/
|
92
|
-
|
93
|
-
/**
|
94
|
-
* @description Create an event handler, In pop-up layer mode, the user clicks the semi floating layer close button and is called.
|
95
|
-
*/
|
96
|
-
|
97
71
|
export var messageName = /*#__PURE__*/function (messageName) {
|
98
72
|
messageName["SDK_TO_APP"] = "SDK_TO_APP";
|
99
73
|
messageName["APP_TO_SDK"] = "APP_TO_SDK";
|
100
74
|
messageName["APP_TO_APP"] = "APP_TO_APP";
|
101
75
|
return messageName;
|
102
76
|
}({});
|
103
|
-
export var
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
errorEnum["NOALIPAYID"] = "NOALIPAYID";
|
119
|
-
errorEnum["TRUSTLOGINERROR"] = "TRUSTLOGINERROR";
|
120
|
-
errorEnum["SIGNIN"] = "SIGNIN";
|
121
|
-
errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
|
122
|
-
return errorEnum;
|
77
|
+
export var ERROR = /*#__PURE__*/function (ERROR) {
|
78
|
+
ERROR["PARAMS"] = "PARAMS";
|
79
|
+
ERROR["TIMEOUT"] = "TIMEOUT";
|
80
|
+
ERROR["NETWORK"] = "NETWORK";
|
81
|
+
ERROR["SYSTEM"] = "SYSTEM";
|
82
|
+
ERROR["LOGIN"] = "LOGIN";
|
83
|
+
ERROR["GATEWAY"] = "GATEWAY";
|
84
|
+
ERROR["VALIDATION"] = "VALIDATION";
|
85
|
+
ERROR["TAOBAOBINDALIPAY"] = "TAOBAOBINDALIPAY";
|
86
|
+
ERROR["REGISTERWALLET"] = "REGISTERWALLET";
|
87
|
+
ERROR["NOALIPAYID"] = "NOALIPAYID";
|
88
|
+
ERROR["TRUSTLOGINERROR"] = "TRUSTLOGINERROR";
|
89
|
+
ERROR["SIGNIN"] = "SIGNIN";
|
90
|
+
ERROR["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
|
91
|
+
return ERROR;
|
123
92
|
}({});
|
124
|
-
export var
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
eventCodeEnum["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
|
129
|
-
eventCodeEnum["SDK_INIT_PARAMETER_ERROR"] = "SDK_INIT_PARAMETER_ERROR";
|
130
|
-
eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
|
131
|
-
eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
|
132
|
-
eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
|
133
|
-
return eventCodeEnum;
|
93
|
+
export var Target = /*#__PURE__*/function (Target) {
|
94
|
+
Target["BLANK"] = "_blank";
|
95
|
+
Target["SELF"] = "_self";
|
96
|
+
return Target;
|
134
97
|
}({});
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { createPaymentParams, IcreateComponent } from '../types';
|
2
2
|
/**
|
3
|
-
* @description context中需要包含app节点,用于插入selector中
|
3
|
+
* @description context中需要包含app节点,用于插入params.selector中
|
4
4
|
*/
|
5
|
-
export declare const createIframeNode: (context: any,
|
5
|
+
export declare const createIframeNode: (context: any, params: createPaymentParams | IcreateComponent) => Promise<void>;
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { getType } from '.';
|
2
2
|
import { ERRORMESSAGE, EVENT } from "../constant";
|
3
|
-
import { messageName
|
3
|
+
import { messageName } from "../types";
|
4
4
|
/**
|
5
|
-
* @description context中需要包含app节点,用于插入selector中
|
5
|
+
* @description context中需要包含app节点,用于插入params.selector中
|
6
6
|
*/
|
7
|
-
export var createIframeNode = function createIframeNode(context,
|
7
|
+
export var createIframeNode = function createIframeNode(context, params) {
|
8
8
|
return new Promise(function (resolve, reject) {
|
9
9
|
var dorpinDom = null;
|
10
|
-
if (getType(selector) === 'string') {
|
11
|
-
dorpinDom = document.querySelector(selector);
|
10
|
+
if (getType(params.selector) === 'string') {
|
11
|
+
dorpinDom = document.querySelector(params.selector);
|
12
12
|
}
|
13
13
|
if (dorpinDom === null) {
|
14
14
|
var error = {
|
15
|
-
|
16
|
-
|
15
|
+
errorCode: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.errorCode,
|
16
|
+
errorMessage: "Failed to execute 'querySelector' on 'Document': ".concat(params.selector, " is not a valid selector")
|
17
17
|
};
|
18
18
|
reject(error);
|
19
19
|
context._dispatchToSDK({
|
@@ -26,7 +26,7 @@ export var createIframeNode = function createIframeNode(context, selector, rende
|
|
26
26
|
});
|
27
27
|
return;
|
28
28
|
}
|
29
|
-
|
29
|
+
dorpinDom.innerHTML = '';
|
30
30
|
if (context.app) {
|
31
31
|
dorpinDom.appendChild(context.app);
|
32
32
|
}
|
package/esm/util/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ERROR } from '../types';
|
2
2
|
/**
|
3
3
|
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
4
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:
|
@@ -31,14 +31,14 @@ declare const safeJson: (data: any, obj: any) => any;
|
|
31
31
|
declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
|
32
32
|
success: boolean;
|
33
33
|
traceId: string;
|
34
|
-
errorCode:
|
34
|
+
errorCode: ERROR;
|
35
35
|
resultStatus: any;
|
36
36
|
errorMessage?: undefined;
|
37
37
|
result?: undefined;
|
38
38
|
} | {
|
39
39
|
success: boolean;
|
40
40
|
traceId: string;
|
41
|
-
errorCode:
|
41
|
+
errorCode: ERROR;
|
42
42
|
errorMessage: string;
|
43
43
|
result: {
|
44
44
|
resultStatus: any;
|
@@ -50,6 +50,4 @@ declare const fomatGetwayError: (headers: Record<string, any>, traceId: string)
|
|
50
50
|
declare const isPC: () => boolean;
|
51
51
|
declare const queryParse: (url?: string) => Record<string, any>;
|
52
52
|
declare const getDesignFontSize: () => number;
|
53
|
-
|
54
|
-
declare const addSetFontSizeEvent: () => void;
|
55
|
-
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent };
|
53
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, };
|
package/esm/util/index.js
CHANGED
@@ -5,7 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
5
5
|
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; }
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
7
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
8
|
-
import {
|
8
|
+
import { ERROR } from "../types";
|
9
9
|
import { get } from "./get";
|
10
10
|
|
11
11
|
/**
|
@@ -174,7 +174,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
174
174
|
return {
|
175
175
|
success: false,
|
176
176
|
traceId: traceId,
|
177
|
-
errorCode:
|
177
|
+
errorCode: ERROR.LOGIN,
|
178
178
|
resultStatus: resultStatus
|
179
179
|
};
|
180
180
|
}
|
@@ -183,7 +183,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
183
183
|
return {
|
184
184
|
success: false,
|
185
185
|
traceId: traceId,
|
186
|
-
errorCode:
|
186
|
+
errorCode: ERROR.TIMEOUT,
|
187
187
|
resultStatus: resultStatus
|
188
188
|
};
|
189
189
|
}
|
@@ -193,7 +193,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
193
193
|
return {
|
194
194
|
success: false,
|
195
195
|
traceId: traceId,
|
196
|
-
errorCode:
|
196
|
+
errorCode: ERROR.GATEWAY,
|
197
197
|
errorMessage: decodeURIComponent(tips || ''),
|
198
198
|
result: {
|
199
199
|
resultStatus: resultStatus || '',
|
@@ -234,21 +234,4 @@ var getDesignFontSize = function getDesignFontSize() {
|
|
234
234
|
var currentFontSize = isPC() ? maxFontSize : screenWidth * 100 / designSize;
|
235
235
|
return Math.min(currentFontSize, maxFontSize);
|
236
236
|
};
|
237
|
-
|
238
|
-
try {
|
239
|
-
var componentContainerId = 'ams-component-container';
|
240
|
-
var _dom = dom || document.getElementById(componentContainerId);
|
241
|
-
_dom.style.fontSize = "".concat(getDesignFontSize(), "px");
|
242
|
-
innerHeight = window.innerHeight;
|
243
|
-
// eslint-disable-next-line no-empty
|
244
|
-
} catch (error) {}
|
245
|
-
};
|
246
|
-
var addSetFontSizeEvent = function addSetFontSizeEvent() {
|
247
|
-
window.removeEventListener('resize', amsSetSize);
|
248
|
-
window.removeEventListener('pageShow', amsSetSize);
|
249
|
-
window.removeEventListener('DOMContentLoaded', amsSetSize);
|
250
|
-
window.addEventListener('resize', amsSetSize);
|
251
|
-
window.addEventListener('pageShow', amsSetSize);
|
252
|
-
window.addEventListener('DOMContentLoaded', amsSetSize);
|
253
|
-
};
|
254
|
-
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent };
|
237
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize };
|
package/esm/util/mock.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
1
|
export var isLocalMock = function isLocalMock() {
|
2
|
-
|
2
|
+
var _window, _window$process, _window$process$env;
|
3
|
+
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$process = _window.process) === null || _window$process === void 0 ? void 0 : (_window$process$env = _window$process.env) === null || _window$process$env === void 0 ? void 0 : _window$process$env.NODE_ENV) === 'MOCK' && window.location.href.indexOf('LOCAL_MOCK=1') > -1;
|
3
4
|
};
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@alipay/ams-checkout","version":"0.0.
|
1
|
+
{"name":"@alipay/ams-checkout","version":"0.0.1693912790-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
|
package/esm/image/skeleton.svg
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
<svg width="740" height="360" viewBox="0 0 740 360" fill="none" xmlns="">
|
2
|
-
<rect width="740" height="360" rx="12" fill="#F6F6F6"/>
|
3
|
-
<rect opacity="0.7" x="44" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
4
|
-
<rect opacity="0.7" x="94" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
5
|
-
<rect opacity="0.7" x="144" y="44" width="32" height="32" rx="4" fill="#E1E6ED"/>
|
6
|
-
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
7
|
-
<path d="M136 100H48C43.5817 100 40 103.582 40 108C40 112.418 43.5817 116 48 116H136C140.418 116 144 112.418 144 108C144 103.582 140.418 100 136 100Z" fill="#E1E6ED"/>
|
8
|
-
</g>
|
9
|
-
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
10
|
-
<path d="M682 126H58C48.0589 126 40 134.059 40 144C40 153.941 48.0589 162 58 162H682C691.941 162 700 153.941 700 144C700 134.059 691.941 126 682 126Z" fill="#E1E6ED"/>
|
11
|
-
</g>
|
12
|
-
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
13
|
-
<path d="M682 182H58C48.0589 182 40 190.059 40 200C40 209.941 48.0589 218 58 218H682C691.941 218 700 209.941 700 200C700 190.059 691.941 182 682 182Z" fill="#E1E6ED"/>
|
14
|
-
</g>
|
15
|
-
<g style="mix-blend-mode:multiply" opacity="0.336007">
|
16
|
-
<path d="M504 274H64C52.9543 274 44 282.954 44 294C44 305.046 52.9543 314 64 314H504C515.046 314 524 305.046 524 294C524 282.954 515.046 274 504 274Z" fill="#E1E6ED"/>
|
17
|
-
</g>
|
18
|
-
</svg>
|