@alipay/ams-checkout 0.0.1762310209-dev.0 → 0.0.1762410565-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/config/index.d.ts +8 -8
- package/esm/config/index.js +8 -8
- package/esm/core/component/ckp/index.d.ts +11 -2
- package/esm/core/component/ckp/index.js +22 -8
- package/esm/core/component/element/elementController/index.js +2 -1
- package/esm/core/component/element/elementProcessor/addressProcessor.js +4 -2
- package/esm/core/component/element/elementProcessor/authProcessor.js +4 -2
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +4 -2
- package/esm/core/component/element/type.d.ts +4 -0
- package/esm/core/component/element/util.d.ts +9 -1
- package/esm/core/component/element/util.js +14 -5
- package/esm/foundation/core/index.js +2 -1
- package/esm/foundation/index.d.ts +8 -1
- package/esm/foundation/product-processor/autoDebit/index.d.ts +5 -1
- package/esm/foundation/product-processor/autoDebit/index.js +5 -2
- package/esm/foundation/product-processor/easysafepay/index.d.ts +4 -1
- package/esm/foundation/product-processor/easysafepay/index.js +25 -17
- package/esm/foundation/product-processor/element/index.d.ts +1 -1
- package/esm/foundation/product-processor/element/index.js +1 -1
- package/esm/foundation/utils/web_app_url_utils.d.ts +3 -0
- package/esm/foundation/utils/web_app_url_utils.js +15 -8
- package/esm/index.js +1 -0
- package/esm/plugin/component/cashierApp.d.ts +9 -1
- package/esm/plugin/component/cashierApp.js +19 -7
- package/esm/plugin/component/index.js +9 -2
- package/esm/types/index.d.ts +8 -0
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +21 -1
- package/package.json +3 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ComponentSignEnum, DisplayTypeEnum, Ianalytics } from '../../types';
|
|
2
2
|
export declare const getAppVersion: (_extendInfo: string, productScene: string, mid: string, sendLog?: boolean) => string;
|
|
3
3
|
export declare const getFinalProductSceneVersion: (componentSign: ComponentSignEnum, productSceneVersion: string) => string;
|
|
4
|
-
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, elementLink?: string
|
|
4
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: ComponentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string, sendLog?: boolean, elementLink?: string, mockOptions?: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}) => any;
|
|
5
7
|
export declare const getAppDomain: (domainParams: {
|
|
6
8
|
environment: string;
|
|
7
9
|
appVersion: string;
|
|
@@ -11,6 +13,9 @@ export declare const getAppDomain: (domainParams: {
|
|
|
11
13
|
extendInfo: string;
|
|
12
14
|
mid: string;
|
|
13
15
|
elementLink: string;
|
|
16
|
+
mockOptions: {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
};
|
|
14
19
|
}) => string;
|
|
15
20
|
export declare const getIframeUrl: (iframeParams: {
|
|
16
21
|
componentSign: ComponentSignEnum;
|
|
@@ -27,6 +32,9 @@ export declare const getIframeUrl: (iframeParams: {
|
|
|
27
32
|
hostSign?: string;
|
|
28
33
|
elementLink?: string;
|
|
29
34
|
mid?: string;
|
|
35
|
+
mockOptions?: {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
};
|
|
30
38
|
}) => {
|
|
31
39
|
path: string;
|
|
32
40
|
locationSearch: string;
|
|
@@ -18,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
18
18
|
import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
|
|
19
19
|
import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
|
|
20
20
|
import { isDebugLog } from "../../util/debug";
|
|
21
|
-
import { queryParse, serialize } from "../../util/index";
|
|
21
|
+
import { genProxyUrl, queryParse, serialize } from "../../util/index";
|
|
22
22
|
import { Logger } from "../../util/logger";
|
|
23
23
|
import { getLastAppVersion, getMatchAppVersion, setLastAppVersion } from "../../util/upgrade";
|
|
24
24
|
export var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
|
|
@@ -78,6 +78,7 @@ export var getAppPath = function getAppPath() {
|
|
|
78
78
|
var mid = arguments.length > 6 ? arguments[6] : undefined;
|
|
79
79
|
var sendLog = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
80
80
|
var elementLink = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : '';
|
|
81
|
+
var mockOptions = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : {};
|
|
81
82
|
var _ref = queryParse() || {},
|
|
82
83
|
urlTestHost = _ref.host;
|
|
83
84
|
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid, sendLog);
|
|
@@ -122,7 +123,12 @@ export var getAppPath = function getAppPath() {
|
|
|
122
123
|
return "".concat(v2AppMarmotMap[environment], "/elements/").concat(finalAppVersion, "/pages/").concat(productScene.toLowerCase(), "/index.html");
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
var finalURL = "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
|
127
|
+
// 简化的Mock逻辑:直接使用genProxyUrl,内部会处理环境安全检查
|
|
128
|
+
if (mockOptions && mockOptions.useMock === true) {
|
|
129
|
+
return genProxyUrl(finalURL, environment);
|
|
130
|
+
}
|
|
131
|
+
return finalURL;
|
|
126
132
|
};
|
|
127
133
|
export var getAppDomain = function getAppDomain(domainParams) {
|
|
128
134
|
var environment = domainParams.environment,
|
|
@@ -132,9 +138,10 @@ export var getAppDomain = function getAppDomain(domainParams) {
|
|
|
132
138
|
productSceneVersion = domainParams.productSceneVersion,
|
|
133
139
|
extendInfo = domainParams.extendInfo,
|
|
134
140
|
mid = domainParams.mid,
|
|
135
|
-
elementLink = domainParams.elementLink
|
|
141
|
+
elementLink = domainParams.elementLink,
|
|
142
|
+
mockOptions = domainParams.mockOptions;
|
|
136
143
|
var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
|
|
137
|
-
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid, false, elementLink));
|
|
144
|
+
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid, false, elementLink, mockOptions));
|
|
138
145
|
return macth && macth[0] || '';
|
|
139
146
|
};
|
|
140
147
|
export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
@@ -158,8 +165,11 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
|
158
165
|
_iframeParams$mid = iframeParams.mid,
|
|
159
166
|
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid,
|
|
160
167
|
_iframeParams$element = iframeParams.elementLink,
|
|
161
|
-
elementLink = _iframeParams$element === void 0 ? '' : _iframeParams$element
|
|
162
|
-
|
|
168
|
+
elementLink = _iframeParams$element === void 0 ? '' : _iframeParams$element,
|
|
169
|
+
_iframeParams$mockOpt = iframeParams.mockOptions,
|
|
170
|
+
mockOptions = _iframeParams$mockOpt === void 0 ? {} : _iframeParams$mockOpt;
|
|
171
|
+
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid, true, elementLink, mockOptions);
|
|
172
|
+
console.log('INgetIframeUrl>>>>>,', path);
|
|
163
173
|
var appMatched = getMatchAppVersion(extendInfo, {
|
|
164
174
|
sdkVersion: sdkVersion,
|
|
165
175
|
productScene: productScene,
|
|
@@ -173,7 +183,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
|
173
183
|
_queryParse$groupId = _queryParse.groupId,
|
|
174
184
|
groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
|
|
175
185
|
LOCAL_MOCK = _queryParse.LOCAL_MOCK,
|
|
176
|
-
_displayType = _queryParse._displayType
|
|
186
|
+
_displayType = _queryParse._displayType,
|
|
187
|
+
__DEBUG_TOKEN__ = _queryParse.__DEBUG_TOKEN__;
|
|
177
188
|
var urlParams = Object.assign({}, {
|
|
178
189
|
displayType: renderDisplayType,
|
|
179
190
|
locale: locale,
|
|
@@ -192,6 +203,7 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
|
192
203
|
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
|
193
204
|
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
|
194
205
|
if (_displayType) urlParams.displayType = _displayType;
|
|
206
|
+
if (__DEBUG_TOKEN__) urlParams.__DEBUG_TOKEN__ = __DEBUG_TOKEN__;
|
|
195
207
|
var locationSearch = serialize(urlParams);
|
|
196
208
|
if (isDebugLog()) {
|
|
197
209
|
console.log('appUpgrade#getIframeUrl#appMatched', appMatched);
|
|
@@ -922,6 +922,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
922
922
|
}, {
|
|
923
923
|
key: "createApp",
|
|
924
924
|
value: function createApp(renderParams) {
|
|
925
|
+
console.log('createApp,renderParams', renderParams);
|
|
925
926
|
if (!!window.postMessage !== true) {
|
|
926
927
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.SDK_COMPATIBILITY_ISSUES.BROWSER_NOT_SUPPORT_POSTMESSAGE);
|
|
927
928
|
return;
|
|
@@ -945,7 +946,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
945
946
|
productSceneVersion: productSceneVersion,
|
|
946
947
|
extendInfo: extendInfo,
|
|
947
948
|
mid: mid,
|
|
948
|
-
elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element = renderParams.elementProps) === null || _renderParams$element === void 0 ? void 0 : _renderParams$element.elementLink
|
|
949
|
+
elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element = renderParams.elementProps) === null || _renderParams$element === void 0 ? void 0 : _renderParams$element.elementLink,
|
|
950
|
+
// TODO Connect本地调试link
|
|
951
|
+
mockOptions: renderParams === null || renderParams === void 0 ? void 0 : renderParams.mockOptions
|
|
949
952
|
});
|
|
950
953
|
this.app = createIframe(this.AMSSDK.options.mode, this.platform);
|
|
951
954
|
var hostSign = ((renderParams === null || renderParams === void 0 ? void 0 : renderParams.sessionData) || '').split('&&')[1] || '';
|
|
@@ -962,11 +965,15 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
962
965
|
instanceId: this.AMSSDK._instanceId,
|
|
963
966
|
hostSign: hostSign,
|
|
964
967
|
mid: mid,
|
|
965
|
-
elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element2 = renderParams.elementProps) === null || _renderParams$element2 === void 0 ? void 0 : _renderParams$element2.elementLink
|
|
968
|
+
elementLink: renderParams === null || renderParams === void 0 || (_renderParams$element2 = renderParams.elementProps) === null || _renderParams$element2 === void 0 ? void 0 : _renderParams$element2.elementLink,
|
|
969
|
+
// TODO Connect本地调试link
|
|
970
|
+
mockOptions: renderParams === null || renderParams === void 0 ? void 0 : renderParams.mockOptions
|
|
966
971
|
}),
|
|
967
972
|
path = _getIframeUrl2.path,
|
|
968
973
|
locationSearch = _getIframeUrl2.locationSearch;
|
|
969
974
|
this._appLocationSearch = locationSearch;
|
|
975
|
+
console.log('creatApp>>>>>,', this.app, path);
|
|
976
|
+
|
|
970
977
|
// locationSearch 是一个序列化好的字符串
|
|
971
978
|
// 先判断path 是否有QueryParams,如果有需要扩展,否则直接拼?xx=xx
|
|
972
979
|
if (path.indexOf('?') !== -1) {
|
package/esm/types/index.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ export interface IoptionsParams {
|
|
|
39
39
|
networkMode?: string;
|
|
40
40
|
mode?: string;
|
|
41
41
|
securityRegion?: 'US' | 'SG' | 'DE';
|
|
42
|
+
mockOptions?: {
|
|
43
|
+
useMock?: boolean;
|
|
44
|
+
mockUserId?: any;
|
|
45
|
+
};
|
|
42
46
|
}
|
|
43
47
|
export interface ValidationResult {
|
|
44
48
|
isValid: boolean;
|
|
@@ -123,6 +127,10 @@ export interface IcreateComponent {
|
|
|
123
127
|
};
|
|
124
128
|
isAppWebview?: boolean;
|
|
125
129
|
merchantAppointParam?: IMerchantAppointParam;
|
|
130
|
+
mockOptions?: {
|
|
131
|
+
useMock: boolean;
|
|
132
|
+
mockUserId?: string;
|
|
133
|
+
};
|
|
126
134
|
isNativeAppWebview?: boolean;
|
|
127
135
|
}
|
|
128
136
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
package/esm/util/index.d.ts
CHANGED
|
@@ -58,4 +58,5 @@ export declare const omit: <T extends {
|
|
|
58
58
|
[x: string]: any;
|
|
59
59
|
hasOwnProperty: (arg0: any) => any;
|
|
60
60
|
}>(obj: T, keys: Array<keyof T>) => T;
|
|
61
|
-
|
|
61
|
+
declare const genProxyUrl: (url: string, env?: string) => string;
|
|
62
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue, genProxyUrl, };
|
package/esm/util/index.js
CHANGED
|
@@ -382,4 +382,24 @@ export var omit = function omit(obj, keys) {
|
|
|
382
382
|
return acc;
|
|
383
383
|
}, {});
|
|
384
384
|
};
|
|
385
|
-
|
|
385
|
+
|
|
386
|
+
// 生成代理链接
|
|
387
|
+
var genProxyUrl = function genProxyUrl(url, env) {
|
|
388
|
+
console.log('[ANTOM SDK] genProxyUrl 请求 - URL:', url, 'Environment:', env);
|
|
389
|
+
|
|
390
|
+
// 严格的生产环境检查
|
|
391
|
+
var PRODUCTION_ENVS = ['prod', 'sandbox'];
|
|
392
|
+
if (PRODUCTION_ENVS.includes(env || '')) {
|
|
393
|
+
console.warn('[ANTOM SDK SECURITY] Mock代理在生产环境被禁用,直接返回原URL. Environment:', env);
|
|
394
|
+
return url; // 生产环境直接返回原URL,不使用代理
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 根据环境选择合适的代理服务器
|
|
398
|
+
var host = env === 'pre' ? "https://antom-launch-hub-prod.marmot-cloud.com" // 预发布使用生产代理
|
|
399
|
+
: "https://antom-launch-hub-dev-alb.marmot-cloud.com"; // 开发环境使用开发代理
|
|
400
|
+
|
|
401
|
+
var finalUrl = "".concat(host, "/htmlProxy?ORI_URL=").concat(encodeURIComponent(url));
|
|
402
|
+
console.log('[ANTOM SDK] Mock代理URL已生成:', finalUrl);
|
|
403
|
+
return finalUrl;
|
|
404
|
+
};
|
|
405
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, isFunction, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, loadSDKScript, isEmpty, isTrue, genProxyUrl };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1762410565-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"main": "esm/index.js",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "father build",
|
|
18
18
|
"build:w": "father dev",
|
|
19
|
+
"build:cdn": "node scripts/cdn-dev.js",
|
|
19
20
|
"ci": "tnpm run cov",
|
|
20
21
|
"cov": "jest --coverage --silent",
|
|
21
22
|
"dev": "father dev",
|
|
@@ -61,6 +62,7 @@
|
|
|
61
62
|
"babel-jest": "^29.3.1",
|
|
62
63
|
"babel-loader": "^9.1.0",
|
|
63
64
|
"babel-plugin-import": "^1.13.0",
|
|
65
|
+
"chokidar": "^3.5.3",
|
|
64
66
|
"eslint": "^8.56.0",
|
|
65
67
|
"eslint-plugin-prettier": "^5.1.3",
|
|
66
68
|
"father": "^4.2.3",
|