@alipay/ams-checkout 2.0.8 → 2.0.10
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/README.md +1 -1
- package/ams-checkout.js +3 -3
- package/antom.d.ts +6 -0
- package/dist/ams-checkout.min.js +1 -0
- package/esm/component/popupWindow.style.d.ts +5 -2
- package/esm/component/popupWindow.style.js +9 -0
- package/esm/core/component/element/elementController/index.js +1 -1
- package/esm/foundation/core/index.js +1 -1
- package/esm/foundation/index.d.ts +2 -6
- package/esm/foundation/service/api-bus/ability/request.js +28 -30
- package/esm/foundation/service/api-bus/ability/security.js +33 -35
- package/esm/foundation/service/container/popup.js +4 -1
- package/esm/foundation/service/log/index.js +1 -1
- package/esm/foundation/service/requester/deps.d.ts +1 -1
- package/esm/foundation/service/requester/deps.js +1 -1
- package/esm/foundation/service/requester/requester.js +2 -2
- package/esm/index.d.ts +11 -2
- package/esm/index.js +22 -2
- package/esm/modern/index.d.ts +5 -0
- package/esm/modern/index.js +51 -0
- package/esm/modern/stageName.d.ts +3 -0
- package/esm/modern/stageName.js +1 -0
- package/esm/request/index.js +2 -2
- package/esm/request/utils.d.ts +2 -2
- package/esm/request/utils.js +3 -2
- package/esm/tsdoc-metadata.json +11 -0
- package/esm/types/index.d.ts +4 -3
- package/esm/types/index.js +1 -0
- package/esm/util/index.d.ts +1 -1
- package/esm/util/logger.js +1 -1
- package/package.json +51 -9
- package/react-js.cjs +50 -0
- package/react-js.d.ts +21 -0
- package/react-js.js +40 -0
- package/types.d.ts +28037 -0
- package/types.untrimmed.d.ts +28352 -0
- package/dist/umd/ams-checkout.min.js +0 -1
package/esm/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
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 type { AxiosHeaderValue } from 'axios';
|
|
8
9
|
import { IApplePayContactField } from '../plugin/applepay/interface';
|
|
9
10
|
export type onChange = () => onCnageResult;
|
|
10
11
|
export { type IElementOptions, ElementType, PaymentElementLayout, ThemeType } from '../core/component/element/type';
|
|
@@ -83,6 +84,7 @@ export declare enum ComponentSignEnum {
|
|
|
83
84
|
'AUTO_DEBIT_APM' = "AUTO_DEBIT_APM"
|
|
84
85
|
}
|
|
85
86
|
export declare enum ProductSceneEnum {
|
|
87
|
+
'VAULTING_ELEMENT' = "VAULTING_ELEMENT",
|
|
86
88
|
'EASY_PAY' = "EASY_PAY",
|
|
87
89
|
'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
|
|
88
90
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
|
@@ -197,6 +199,7 @@ export declare enum payPalConfigurationIntentEnum {
|
|
|
197
199
|
}
|
|
198
200
|
export interface IMerchantAppointParam {
|
|
199
201
|
storedCard?: IStoredCard;
|
|
202
|
+
singleOption?: 'skip' | 'list';
|
|
200
203
|
}
|
|
201
204
|
export interface IStoredCard {
|
|
202
205
|
needCVV?: boolean;
|
|
@@ -527,13 +530,11 @@ export interface RequestConfig {
|
|
|
527
530
|
env?: string;
|
|
528
531
|
baseURL?: string;
|
|
529
532
|
timeout?: number;
|
|
530
|
-
headers?:
|
|
533
|
+
headers?: Record<string, AxiosHeaderValue>;
|
|
531
534
|
withCredentials?: boolean;
|
|
532
535
|
method?: string;
|
|
533
536
|
workspaceId?: string;
|
|
534
537
|
'Operation-Type'?: string;
|
|
535
|
-
beforerRequest?: () => void;
|
|
536
|
-
afterRequest?: () => void;
|
|
537
538
|
needEnvInfo?: boolean;
|
|
538
539
|
hostSign?: string;
|
|
539
540
|
appId?: string;
|
package/esm/types/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
|
|
|
41
41
|
return ComponentSignEnum;
|
|
42
42
|
}({});
|
|
43
43
|
export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
|
|
44
|
+
ProductSceneEnum["VAULTING_ELEMENT"] = "VAULTING_ELEMENT";
|
|
44
45
|
ProductSceneEnum["EASY_PAY"] = "EASY_PAY";
|
|
45
46
|
ProductSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
|
|
46
47
|
ProductSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
|
package/esm/util/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ declare const device: {
|
|
|
30
30
|
};
|
|
31
31
|
declare const safeJson: (data: any, obj: any) => any;
|
|
32
32
|
declare const isPC: () => boolean;
|
|
33
|
-
declare const queryParse: (url?: string) =>
|
|
33
|
+
declare const queryParse: <T extends Record<string, any> = Record<string, any>>(url?: string) => Partial<T>;
|
|
34
34
|
declare const getDesignFontSize: () => number;
|
|
35
35
|
declare const amsSetSize: (event?: any, dom?: any) => void;
|
|
36
36
|
declare const addSetFontSizeEvent: () => void;
|
package/esm/util/logger.js
CHANGED
|
@@ -287,7 +287,7 @@ export var Logger = /*#__PURE__*/function () {
|
|
|
287
287
|
}();
|
|
288
288
|
_defineProperty(Logger, "instance", void 0);
|
|
289
289
|
export var LogConfig = {
|
|
290
|
-
scriptUrl: 'https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_intl-tracker/1.6.0/dist/common.min.js',
|
|
290
|
+
scriptUrl: 'https://gw-intl.alipayobjects.com/render/p/yuyan_npm/@alipay_intl-tracker/1.6.0/dist/common.min.js',
|
|
291
291
|
spmConfig: {},
|
|
292
292
|
batchCount: 1,
|
|
293
293
|
appId: 'antom_sdk',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "esm/index.js",
|
|
@@ -9,20 +9,55 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"esm",
|
|
12
|
+
"antom.d.ts",
|
|
13
|
+
"types.d.ts",
|
|
14
|
+
"types.untrimmed.d.ts",
|
|
12
15
|
"ams-checkout.js",
|
|
16
|
+
"react-js.cjs",
|
|
17
|
+
"react-js.js",
|
|
18
|
+
"react-js.d.ts",
|
|
13
19
|
"LEGAL.md",
|
|
14
20
|
"LICENSE",
|
|
15
21
|
"README.md"
|
|
16
22
|
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./esm/index.js",
|
|
26
|
+
"types": "./esm/index.d.ts",
|
|
27
|
+
"require": "./ams-checkout.js"
|
|
28
|
+
},
|
|
29
|
+
"./types": "./types.d.ts",
|
|
30
|
+
"./antom": "./antom.d.ts",
|
|
31
|
+
"./react-js": {
|
|
32
|
+
"import": "./react-js.js",
|
|
33
|
+
"types": "./react-js.d.ts",
|
|
34
|
+
"require": "./react-js.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./interface": "./types.untrimmed.d.ts"
|
|
37
|
+
},
|
|
17
38
|
"scripts": {
|
|
18
|
-
"build": "father build",
|
|
39
|
+
"build": "opensdk update && npm run build:father:pre && npm run extract && npm run build:father && npm run build:father:umd && npm run build:react",
|
|
40
|
+
"build:local": "opensdk update && npm run build:father:pre && npm run extract && npm run build:father:local && npm run build:father:umd:local && npm run build:react",
|
|
19
41
|
"build:analyze": "ANALYZE=1 father build",
|
|
42
|
+
"build:father": "FATHER_TSCONFIG_NAME=tsconfig.build.json father build",
|
|
43
|
+
"build:father:local": "STAGE_NAME=LOCAL FATHER_TSCONFIG_NAME=tsconfig.build.json father build",
|
|
44
|
+
"build:father:pre": "FATHER_BUILD_TYPE=prebuild father build",
|
|
45
|
+
"build:father:umd": "FATHER_BUILD_TYPE=only-umd father build",
|
|
46
|
+
"build:father:umd:local": "STAGE_NAME=LOCAL FATHER_BUILD_TYPE=only-umd father build",
|
|
47
|
+
"build:react": "tsc --project tsconfig.cjs.json && mv react-js.js react-js.cjs && tsc --project tsconfig.esm.json",
|
|
20
48
|
"build:type": "dts-bundle-generator -o ./types/antom-web-sdk.d.ts ./src/index.ts --no-banner --silent --no-check",
|
|
21
|
-
"build:w": "father dev",
|
|
49
|
+
"build:w": "FATHER_BUILD_TYPE=only-umd STAGE_NAME=LOCAL father dev",
|
|
22
50
|
"ci": "tnpm run cov",
|
|
23
51
|
"cov": "jest --coverage --silent",
|
|
24
52
|
"dev": "father dev",
|
|
53
|
+
"extract": "opensdk extract -p esm/modern/sdk",
|
|
54
|
+
"e2e": "nyc playwright test",
|
|
55
|
+
"e2e:ui": "playwright test --ui",
|
|
56
|
+
"e2e:create": "e2e create -b new_mock_wrap",
|
|
57
|
+
"e2e:create_new_mock_wrap": "BAKERY_PROJECT=new_mock_wrap e2e create -b new_mock_wrap",
|
|
58
|
+
"e2e:create_e2e_mock_wrap": "BAKERY_PROJECT=e2e_mock_wrap e2e create -b e2e_mock_wrap",
|
|
25
59
|
"format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
|
|
60
|
+
"generateApi": "intl-oneapi generate && prettier --write src/modern/sdk/oneapi",
|
|
26
61
|
"lint": "eslint ./src",
|
|
27
62
|
"test": "jest --coverage --silent",
|
|
28
63
|
"tsc": "tsc --noEmit"
|
|
@@ -46,41 +81,47 @@
|
|
|
46
81
|
]
|
|
47
82
|
},
|
|
48
83
|
"dependencies": {
|
|
84
|
+
"@antglobal/create-sdk-loader": "^1.0.5",
|
|
49
85
|
"axios": "^1.3.4",
|
|
50
86
|
"proxy-polyfill": "^0.3.2",
|
|
51
87
|
"uuid": "^9.0.0"
|
|
52
88
|
},
|
|
53
89
|
"devDependencies": {
|
|
54
|
-
"@ali/ci": "^4.72.0",
|
|
55
90
|
"@babel/core": "^7.20.7",
|
|
56
91
|
"@babel/preset-env": "^7.20.2",
|
|
57
92
|
"@commitlint/cli": "^17.3.0",
|
|
58
93
|
"@commitlint/config-conventional": "^17.3.0",
|
|
94
|
+
"@microsoft/api-extractor": "^7.55.2",
|
|
95
|
+
"@playwright/test": "^1.55.1",
|
|
59
96
|
"@testing-library/jest-dom": "^5.1.1",
|
|
60
97
|
"@testing-library/react": "^9.5.0",
|
|
61
98
|
"@types/jest": "^29.2.4",
|
|
99
|
+
"@types/lodash.get": "^4.4.9",
|
|
100
|
+
"@types/react": "^19.2.14",
|
|
62
101
|
"@types/uuid": "^9.0.0",
|
|
63
102
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
64
103
|
"@typescript-eslint/parser": "^6.21.0",
|
|
65
104
|
"babel-jest": "^29.3.1",
|
|
66
105
|
"babel-loader": "^9.1.0",
|
|
67
106
|
"babel-plugin-import": "^1.13.0",
|
|
107
|
+
"dotenv": "^16.3.1",
|
|
68
108
|
"dts-bundle-generator": "^6.13.0",
|
|
69
109
|
"eslint": "^8.56.0",
|
|
70
|
-
"eslint-plugin-prettier": "^
|
|
110
|
+
"eslint-plugin-prettier": "^4.x",
|
|
71
111
|
"father": "^4.2.3",
|
|
72
112
|
"jest": "^29.5.0",
|
|
73
113
|
"jest-environment-jsdom": "^29.3.1",
|
|
74
|
-
"
|
|
114
|
+
"nyc": "^17.1.0",
|
|
115
|
+
"prettier": "^2.8.8",
|
|
75
116
|
"prettier-plugin-organize-imports": "^3.2.3",
|
|
76
117
|
"prettier-plugin-packagejson": "^2.4.5",
|
|
77
118
|
"serve": "^14.2.5",
|
|
78
119
|
"ts-jest": "^29.0.3",
|
|
79
120
|
"ts-node": "^10.9.1",
|
|
80
|
-
"typescript": "^
|
|
121
|
+
"typescript": "^5.x"
|
|
81
122
|
},
|
|
82
123
|
"engines": {
|
|
83
|
-
"install-node": "
|
|
124
|
+
"install-node": "20"
|
|
84
125
|
},
|
|
85
126
|
"publishConfig": {
|
|
86
127
|
"access": "public"
|
|
@@ -88,5 +129,6 @@
|
|
|
88
129
|
"ci": {
|
|
89
130
|
"resourceClass": "L",
|
|
90
131
|
"type": "aci"
|
|
91
|
-
}
|
|
132
|
+
},
|
|
133
|
+
"marmotId": "180020050100010657"
|
|
92
134
|
}
|
package/react-js.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AntomProvider = void 0;
|
|
7
|
+
exports.useAntom = useAntom;
|
|
8
|
+
exports.useLoadAntomError = useLoadAntomError;
|
|
9
|
+
var react_1 = __importDefault(require("react"));
|
|
10
|
+
var Context = react_1.default.createContext({ antom: undefined, error: undefined });
|
|
11
|
+
var AntomProvider = function (props) {
|
|
12
|
+
var _a = props.customError, customError = _a === void 0 ? true : _a;
|
|
13
|
+
var _b = react_1.default.useState(), antomInstance = _b[0], setAntomInstance = _b[1];
|
|
14
|
+
var _c = react_1.default.useState(), loadError = _c[0], setLoadError = _c[1];
|
|
15
|
+
var _d = react_1.default.useState(true), loading = _d[0], setLoading = _d[1];
|
|
16
|
+
react_1.default.useEffect(function () {
|
|
17
|
+
props.loadPromise
|
|
18
|
+
.then(function (instance) {
|
|
19
|
+
setAntomInstance(instance);
|
|
20
|
+
})
|
|
21
|
+
.catch(function (e) {
|
|
22
|
+
var _a;
|
|
23
|
+
setLoadError(e);
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
(_a = window.sdkDebugger) === null || _a === void 0 ? void 0 : _a.log('ERROR', 'SYSTEM', 'Antom script load failed', {
|
|
27
|
+
message: 'Antom script load failed',
|
|
28
|
+
stack: e.stack,
|
|
29
|
+
source: 'SYSTEM',
|
|
30
|
+
});
|
|
31
|
+
})
|
|
32
|
+
.finally(function () {
|
|
33
|
+
setLoading(false);
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
return (react_1.default.createElement(Context.Provider, { value: { antom: antomInstance, error: loadError } }, !loading && (customError ? true : !loadError) ? props.children : null));
|
|
37
|
+
};
|
|
38
|
+
exports.AntomProvider = AntomProvider;
|
|
39
|
+
/**
|
|
40
|
+
* @description 获取antom实例用于调用antom的方法,请在AntomProvider包裹的组件中使用
|
|
41
|
+
*/
|
|
42
|
+
function useAntom() {
|
|
43
|
+
return react_1.default.useContext(Context).antom;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns 加载antom的问题,如果存在的话,只需要在顶层处理一次
|
|
47
|
+
*/
|
|
48
|
+
function useLoadAntomError() {
|
|
49
|
+
return react_1.default.useContext(Context).error;
|
|
50
|
+
}
|
package/react-js.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { AntomSDK } from './types';
|
|
4
|
+
type ProviderProps = {
|
|
5
|
+
loadPromise: Promise<AntomSDK>;
|
|
6
|
+
/**
|
|
7
|
+
* @description 是否需要自定义错误处理,如果为true,请使用useLoadAntomError,进行错误处理,否则加载失败时,antomsdk将直接中断并且不提供任何界面
|
|
8
|
+
*/
|
|
9
|
+
customError?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const AntomProvider: FC<ProviderProps>;
|
|
13
|
+
/**
|
|
14
|
+
* @description 获取antom实例用于调用antom的方法,请在AntomProvider包裹的组件中使用
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAntom(): AntomSDK;
|
|
17
|
+
/**
|
|
18
|
+
* @returns 加载antom的问题,如果存在的话,只需要在顶层处理一次
|
|
19
|
+
*/
|
|
20
|
+
export declare function useLoadAntomError(): Error | undefined;
|
|
21
|
+
export {};
|
package/react-js.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
const Context = React.createContext({ antom: undefined, error: undefined });
|
|
3
|
+
export const AntomProvider = (props) => {
|
|
4
|
+
const { customError = true } = props;
|
|
5
|
+
const [antomInstance, setAntomInstance] = React.useState();
|
|
6
|
+
const [loadError, setLoadError] = React.useState();
|
|
7
|
+
const [loading, setLoading] = React.useState(true);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
props.loadPromise
|
|
10
|
+
.then((instance) => {
|
|
11
|
+
setAntomInstance(instance);
|
|
12
|
+
})
|
|
13
|
+
.catch((e) => {
|
|
14
|
+
setLoadError(e);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
window.sdkDebugger?.log('ERROR', 'SYSTEM', 'Antom script load failed', {
|
|
18
|
+
message: 'Antom script load failed',
|
|
19
|
+
stack: e.stack,
|
|
20
|
+
source: 'SYSTEM',
|
|
21
|
+
});
|
|
22
|
+
})
|
|
23
|
+
.finally(() => {
|
|
24
|
+
setLoading(false);
|
|
25
|
+
});
|
|
26
|
+
}, []);
|
|
27
|
+
return (React.createElement(Context.Provider, { value: { antom: antomInstance, error: loadError } }, !loading && (customError ? true : !loadError) ? props.children : null));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @description 获取antom实例用于调用antom的方法,请在AntomProvider包裹的组件中使用
|
|
31
|
+
*/
|
|
32
|
+
export function useAntom() {
|
|
33
|
+
return React.useContext(Context).antom;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @returns 加载antom的问题,如果存在的话,只需要在顶层处理一次
|
|
37
|
+
*/
|
|
38
|
+
export function useLoadAntomError() {
|
|
39
|
+
return React.useContext(Context).error;
|
|
40
|
+
}
|