@alipay/ams-checkout 2.0.7 → 2.0.9

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/ams-checkout.js +3 -3
  3. package/antom.d.ts +6 -0
  4. package/dist/ams-checkout.min.js +1 -0
  5. package/esm/component/popupWindow.style.js +4 -0
  6. package/esm/core/component/element/config.js +1 -1
  7. package/esm/core/component/element/elementProcessor/paymentProcessor.js +4 -2
  8. package/esm/core/component/element/type.d.ts +17 -14
  9. package/esm/core/component/element/type.js +1 -1
  10. package/esm/foundation/core/index.js +1 -1
  11. package/esm/foundation/index.d.ts +2 -6
  12. package/esm/foundation/service/log/index.js +1 -1
  13. package/esm/foundation/service/requester/deps.d.ts +1 -1
  14. package/esm/foundation/service/requester/deps.js +1 -1
  15. package/esm/foundation/service/requester/requester.js +2 -2
  16. package/esm/index.d.ts +11 -2
  17. package/esm/index.js +22 -2
  18. package/esm/modern/index.d.ts +5 -0
  19. package/esm/modern/index.js +53 -0
  20. package/esm/modern/stageName.d.ts +3 -0
  21. package/esm/modern/stageName.js +1 -0
  22. package/esm/plugin/component/channel.d.ts +3 -1
  23. package/esm/plugin/component/channel.js +7 -3
  24. package/esm/plugin/component/index.js +2 -1
  25. package/esm/request/index.js +2 -2
  26. package/esm/request/utils.d.ts +2 -2
  27. package/esm/request/utils.js +3 -2
  28. package/esm/tsdoc-metadata.json +11 -0
  29. package/esm/types/index.d.ts +4 -3
  30. package/esm/types/index.js +1 -0
  31. package/esm/util/index.d.ts +1 -1
  32. package/esm/util/logger.js +1 -1
  33. package/package.json +49 -8
  34. package/react-js.cjs +31 -0
  35. package/react-js.d.ts +17 -0
  36. package/react-js.js +23 -0
  37. package/types.d.ts +28096 -0
  38. package/types.untrimmed.d.ts +28391 -0
  39. package/dist/umd/ams-checkout.min.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
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": "^5.1.3",
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
- "prettier": "^2.8.4",
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": "^4.9.5"
121
+ "typescript": "^5.x"
81
122
  },
82
123
  "engines": {
83
- "install-node": "18"
124
+ "install-node": "20"
84
125
  },
85
126
  "publishConfig": {
86
127
  "access": "public"
package/react-js.cjs ADDED
@@ -0,0 +1,31 @@
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
+ var react_1 = __importDefault(require("react"));
9
+ var Context = react_1.default.createContext({ antom: undefined, error: undefined });
10
+ var AntomProvider = function (props) {
11
+ var _a = react_1.default.useState(), antomInstance = _a[0], setAntomInstance = _a[1];
12
+ var _b = react_1.default.useState(), loadError = _b[0], setLoadError = _b[1];
13
+ var _c = react_1.default.useState(true), loading = _c[0], setLoading = _c[1];
14
+ react_1.default.useEffect(function () {
15
+ props.loadPromise
16
+ .then(function (instance) {
17
+ setAntomInstance(instance);
18
+ })
19
+ .catch(function (e) {
20
+ setLoadError(e);
21
+ })
22
+ .finally(function () {
23
+ setLoading(false);
24
+ });
25
+ }, []);
26
+ return (react_1.default.createElement(Context.Provider, { value: { antom: antomInstance, error: loadError } }, !loading ? props.children : null));
27
+ };
28
+ exports.AntomProvider = AntomProvider;
29
+ function useAntom() {
30
+ return react_1.default.useContext(Context);
31
+ }
package/react-js.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { FC } from 'react';
2
+ import React from 'react';
3
+ import type { AntomSDK } from './types';
4
+ type ResultState = {
5
+ antom: undefined;
6
+ error: Error;
7
+ } | {
8
+ antom: AntomSDK;
9
+ error: undefined;
10
+ };
11
+ type ProviderProps = {
12
+ loadPromise: Promise<AntomSDK>;
13
+ children?: React.ReactNode;
14
+ };
15
+ export declare const AntomProvider: FC<ProviderProps>;
16
+ export declare function useAntom(): ResultState;
17
+ export {};
package/react-js.js ADDED
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ const Context = React.createContext({ antom: undefined, error: undefined });
3
+ export const AntomProvider = (props) => {
4
+ const [antomInstance, setAntomInstance] = React.useState();
5
+ const [loadError, setLoadError] = React.useState();
6
+ const [loading, setLoading] = React.useState(true);
7
+ React.useEffect(() => {
8
+ props.loadPromise
9
+ .then((instance) => {
10
+ setAntomInstance(instance);
11
+ })
12
+ .catch((e) => {
13
+ setLoadError(e);
14
+ })
15
+ .finally(() => {
16
+ setLoading(false);
17
+ });
18
+ }, []);
19
+ return (React.createElement(Context.Provider, { value: { antom: antomInstance, error: loadError } }, !loading ? props.children : null));
20
+ };
21
+ export function useAntom() {
22
+ return React.useContext(Context);
23
+ }