@alipay/ams-checkout 0.0.1763539719-dev.0 → 0.0.1763711027-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/README.md +1 -1
- package/ams-checkout.js +1 -0
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/constant/auto-debit.d.ts +12 -0
- package/esm/constant/auto-debit.js +15 -0
- package/esm/constant/element.d.ts +26 -0
- package/esm/constant/element.js +30 -0
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/element/elementProcessor/addressProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/authProcessor.js +2 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +1 -1
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +30 -28
- package/esm/core/component/element/type.d.ts +3 -0
- package/esm/foundation/core/index.js +27 -0
- package/esm/foundation/service/container/index.d.ts +1 -0
- package/esm/foundation/service/container/index.js +33 -2
- package/esm/foundation/utils/web_app_url_utils.d.ts +0 -2
- package/esm/foundation/utils/web_app_url_utils.js +10 -15
- package/esm/index.d.ts +13 -52
- package/esm/index.js +19 -339
- package/esm/loader/Proxy.d.ts +5 -0
- package/esm/loader/Proxy.js +364 -0
- package/esm/loader/constant.d.ts +36 -0
- package/esm/loader/constant.js +36 -0
- package/esm/loader/index.d.ts +20 -0
- package/esm/loader/index.js +23 -0
- package/esm/loader/utils/common.d.ts +13 -0
- package/esm/loader/utils/common.js +63 -0
- package/esm/loader/utils/debugger.d.ts +7 -0
- package/esm/loader/utils/debugger.js +15 -0
- package/esm/loader/utils/loadSDK.d.ts +8 -0
- package/esm/loader/utils/loadSDK.js +92 -0
- package/esm/loader/utils/logger.d.ts +10 -0
- package/esm/loader/utils/logger.js +59 -0
- package/esm/loader/utils/proxyPerformance.d.ts +20 -0
- package/esm/loader/utils/proxyPerformance.js +66 -0
- package/esm/main.d.ts +45 -0
- package/esm/main.js +329 -0
- package/esm/plugin/component/cashierApp.js +7 -4
- package/esm/util/integrationType.d.ts +21 -0
- package/esm/util/integrationType.js +48 -0
- package/esm/util/logger.d.ts +2 -0
- package/esm/util/logger.js +1 -1
- package/esm/util/versionCompare.d.ts +1 -1
- package/package.json +7 -1
|
@@ -15,6 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
15
15
|
* 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
|
|
16
16
|
* 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.
|
|
17
17
|
*/
|
|
18
|
+
import { getProxyCostTime } from "../../loader/utils/proxyPerformance";
|
|
18
19
|
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
|
|
19
20
|
import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
|
|
20
21
|
import { isDebugLog } from "../../util/debug";
|
|
@@ -95,6 +96,7 @@ export var getAppPath = function getAppPath() {
|
|
|
95
96
|
}
|
|
96
97
|
var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
|
|
97
98
|
// only for test while testurl?host=https://xxxxx.test.html
|
|
99
|
+
// 目前所有的elementProcessor中都会传入elementLink, 理论上Element场景该函数都会在这里直接返回
|
|
98
100
|
if (elementLink) {
|
|
99
101
|
return elementLink;
|
|
100
102
|
}
|
|
@@ -103,7 +105,7 @@ export var getAppPath = function getAppPath() {
|
|
|
103
105
|
}
|
|
104
106
|
// 地址应用特殊处理
|
|
105
107
|
if (componentSign === ComponentSignEnum.ELEMENT_ADDRESS) {
|
|
106
|
-
return "".concat(v2AppMarmotMap[environment], "/element-address/
|
|
108
|
+
return "".concat(v2AppMarmotMap[environment], "/element-address/pages/address/index.html");
|
|
107
109
|
}
|
|
108
110
|
// element应用特殊处理
|
|
109
111
|
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign)) {
|
|
@@ -117,12 +119,12 @@ export var getAppPath = function getAppPath() {
|
|
|
117
119
|
}
|
|
118
120
|
if (isExpressCheckout) {
|
|
119
121
|
// express_checkout模式走单独映射
|
|
120
|
-
return "".concat(v2AppMarmotMap[environment], "/elements/
|
|
122
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/pages/express_checkout/index.html");
|
|
121
123
|
} else {
|
|
122
|
-
return "".concat(v2AppMarmotMap[environment], "/elements/
|
|
124
|
+
return "".concat(v2AppMarmotMap[environment], "/elements/pages/").concat(productScene.toLowerCase(), "/index.html");
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.
|
|
127
|
+
return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.html");
|
|
126
128
|
};
|
|
127
129
|
export var getAppDomain = function getAppDomain(domainParams) {
|
|
128
130
|
var environment = domainParams.environment,
|
|
@@ -183,6 +185,7 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
|
183
185
|
sdkVersion: sdkVersion,
|
|
184
186
|
refUrl: window.location.href,
|
|
185
187
|
_componentStartTime: "".concat(Date.now()),
|
|
188
|
+
_proxyCostTime: "".concat(getProxyCostTime(productScene)),
|
|
186
189
|
isPreload: isPreload || '',
|
|
187
190
|
hostSign: hostSign || ''
|
|
188
191
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 该文件用来做两件事
|
|
3
|
+
*
|
|
4
|
+
* 1. 在window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE,标记商户是NPM集成还是CDN集成
|
|
5
|
+
* 2. 埋点上报integrationType
|
|
6
|
+
*
|
|
7
|
+
* ***/
|
|
8
|
+
/*** 扩展 Window 接口,添加 _ANTOM_SDK_INTEGRATION_TYPE 属性*/
|
|
9
|
+
declare global {
|
|
10
|
+
interface Window {
|
|
11
|
+
_ANTOM_WEB_SDK_INTEGRATION_TYPE?: AntomWebSDKIntegrationType;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/*** SDK 集成类型枚举*/
|
|
15
|
+
export type AntomWebSDKIntegrationType = 'CDN' | 'NPM';
|
|
16
|
+
/*** 往window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE */
|
|
17
|
+
export declare function injectAntomSDKIntegrationType(integrationType: AntomWebSDKIntegrationType): void;
|
|
18
|
+
/**
|
|
19
|
+
* 获取全局变量 _ANTOM_SDK_INTEGRATION_TYPE
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAntomSDKIntegrationType(): AntomWebSDKIntegrationType | undefined;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 该文件用来做两件事
|
|
3
|
+
*
|
|
4
|
+
* 1. 在window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE,标记商户是NPM集成还是CDN集成
|
|
5
|
+
* 2. 埋点上报integrationType
|
|
6
|
+
*
|
|
7
|
+
* ***/
|
|
8
|
+
|
|
9
|
+
import { LogConfig, Logger } from "./logger";
|
|
10
|
+
var logger = new Logger(LogConfig, true);
|
|
11
|
+
|
|
12
|
+
/*** 扩展 Window 接口,添加 _ANTOM_SDK_INTEGRATION_TYPE 属性*/
|
|
13
|
+
|
|
14
|
+
/*** SDK 集成类型枚举*/
|
|
15
|
+
|
|
16
|
+
/*** 往window对象上注入全局变量 _ANTOM_SDK_INTEGRATION_TYPE */
|
|
17
|
+
export function injectAntomSDKIntegrationType(integrationType) {
|
|
18
|
+
// 参数验证
|
|
19
|
+
var validTypes = ['CDN', 'NPM'];
|
|
20
|
+
if (!validTypes.includes(integrationType)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 检查是否在浏览器环境中
|
|
25
|
+
if (typeof window === 'undefined') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 由于使用npm集成已接入热更新的产品 ,会加载cdn资源,导致二次注入type为CDN
|
|
30
|
+
// 如果已经注入过,不进行覆盖
|
|
31
|
+
if (validTypes.includes(window._ANTOM_WEB_SDK_INTEGRATION_TYPE)) return;
|
|
32
|
+
|
|
33
|
+
// 注入全局变量
|
|
34
|
+
window._ANTOM_WEB_SDK_INTEGRATION_TYPE = integrationType;
|
|
35
|
+
|
|
36
|
+
// 埋点上报integrationType
|
|
37
|
+
logger.setMedta({
|
|
38
|
+
integrationType: integrationType
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 获取全局变量 _ANTOM_SDK_INTEGRATION_TYPE
|
|
44
|
+
*/
|
|
45
|
+
export function getAntomSDKIntegrationType() {
|
|
46
|
+
var _window;
|
|
47
|
+
return (_window = window) === null || _window === void 0 ? void 0 : _window._ANTOM_WEB_SDK_INTEGRATION_TYPE;
|
|
48
|
+
}
|
package/esm/util/logger.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AntomWebSDKIntegrationType } from '../loader/constant';
|
|
1
2
|
interface LogPayload {
|
|
2
3
|
title?: string;
|
|
3
4
|
msg?: string;
|
|
@@ -25,6 +26,7 @@ export interface LogMetaData {
|
|
|
25
26
|
paymentMethodCategoryType?: string;
|
|
26
27
|
requestSeq?: string;
|
|
27
28
|
trackId?: string;
|
|
29
|
+
integrationType?: AntomWebSDKIntegrationType;
|
|
28
30
|
}
|
|
29
31
|
interface Config {
|
|
30
32
|
scriptUrl: string;
|
package/esm/util/logger.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1763711027-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "esm/index.js",
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"esm",
|
|
12
|
+
"ams-checkout.js",
|
|
12
13
|
"LEGAL.md",
|
|
13
14
|
"LICENSE",
|
|
14
15
|
"README.md"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "father build",
|
|
19
|
+
"build:analyze": "ANALYZE=1 father build",
|
|
20
|
+
"build:type": "dts-bundle-generator -o ./types/antom-web-sdk.d.ts ./src/index.ts --no-banner --silent --no-check",
|
|
18
21
|
"build:w": "father dev",
|
|
19
22
|
"ci": "tnpm run cov",
|
|
20
23
|
"cov": "jest --coverage --silent",
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|
|
46
49
|
"axios": "^1.3.4",
|
|
50
|
+
"proxy-polyfill": "^0.3.2",
|
|
47
51
|
"uuid": "^9.0.0"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
@@ -61,6 +65,7 @@
|
|
|
61
65
|
"babel-jest": "^29.3.1",
|
|
62
66
|
"babel-loader": "^9.1.0",
|
|
63
67
|
"babel-plugin-import": "^1.13.0",
|
|
68
|
+
"dts-bundle-generator": "^6.13.0",
|
|
64
69
|
"eslint": "^8.56.0",
|
|
65
70
|
"eslint-plugin-prettier": "^5.1.3",
|
|
66
71
|
"father": "^4.2.3",
|
|
@@ -69,6 +74,7 @@
|
|
|
69
74
|
"prettier": "^2.8.4",
|
|
70
75
|
"prettier-plugin-organize-imports": "^3.2.3",
|
|
71
76
|
"prettier-plugin-packagejson": "^2.4.5",
|
|
77
|
+
"serve": "^14.2.5",
|
|
72
78
|
"ts-jest": "^29.0.3",
|
|
73
79
|
"ts-node": "^10.9.1",
|
|
74
80
|
"typescript": "^4.9.5"
|