@alipay/ams-checkout 0.0.1690894389-dev.1 → 0.0.1691379784-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/esm/config/index.d.ts +2 -22
- package/dist/esm/config/index.js +9 -61
- package/dist/esm/config/request.d.ts +21 -0
- package/dist/esm/config/request.js +67 -0
- package/dist/esm/constant/index.d.ts +1 -0
- package/dist/esm/constant/index.js +1 -0
- package/dist/esm/core/component/index.d.ts +3 -3
- package/dist/esm/core/component/index.js +42 -88
- package/dist/esm/core/instance/index.d.ts +2 -10
- package/dist/esm/core/instance/index.js +0 -22
- package/dist/esm/plugin/component/cashierApp.d.ts +23 -0
- package/dist/esm/plugin/component/cashierApp.js +122 -0
- package/dist/esm/plugin/component/component.style.js +1 -1
- package/dist/esm/plugin/component/index.d.ts +9 -15
- package/dist/esm/plugin/component/index.js +116 -144
- package/dist/esm/request/index.d.ts +1 -1
- package/dist/esm/request/index.js +5 -5
- package/dist/esm/service/index.d.ts +2 -2
- package/dist/esm/types/index.d.ts +42 -13
- package/dist/esm/types/index.js +8 -5
- package/dist/esm/util/index.js +1 -1
- package/dist/umd/ams-checkout.min.js +1 -1
- package/package.json +1 -1
- package/dist/esm/plugin/component/appPath.d.ts +0 -2
- package/dist/esm/plugin/component/appPath.js +0 -75
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@alipay/ams-checkout","version":"0.0.
|
1
|
+
{"name":"@alipay/ams-checkout","version":"0.0.1691379784-dev.0","description":"","author":"","main":"dist/esm/index.js","module":"dist/esm/index.js","typings":"dist/esm/index.d.ts","files":["dist","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"}}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
export declare const getAppPath: (_environment: string | undefined, appVersion: string, componentName: string, productSceneVersion: string, extendInfo: string) => any;
|
2
|
-
export declare const getAppDomain: (_environment: string, version: string, componentName: string, productSceneVersion: string, extendInfo: string) => string;
|
@@ -1,75 +0,0 @@
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
|
-
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; }
|
3
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
4
|
-
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); }
|
5
|
-
/**
|
6
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
7
|
-
*
|
8
|
-
* 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:
|
9
|
-
* 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
|
10
|
-
* 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.
|
11
|
-
*/
|
12
|
-
import json from "../../../package.json";
|
13
|
-
import { componentNameEnum } from "../../types";
|
14
|
-
import { queryParse } from "../../util/index";
|
15
|
-
export var getAppPath = function getAppPath() {
|
16
|
-
var _componentMap;
|
17
|
-
var _environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
|
18
|
-
var appVersion = arguments.length > 1 ? arguments[1] : undefined;
|
19
|
-
var componentName = arguments.length > 2 ? arguments[2] : undefined;
|
20
|
-
var productSceneVersion = arguments.length > 3 ? arguments[3] : undefined;
|
21
|
-
var extendInfo = arguments.length > 4 ? arguments[4] : undefined;
|
22
|
-
var _ref = queryParse() || {},
|
23
|
-
urlTestHost = _ref.host,
|
24
|
-
_ref$_appVersion = _ref._appVersion,
|
25
|
-
_appVersion = _ref$_appVersion === void 0 ? '' : _ref$_appVersion;
|
26
|
-
var host = '';
|
27
|
-
var getAppVersion = function getAppVersion(_extendInfo) {
|
28
|
-
try {
|
29
|
-
// Configure the specified version number
|
30
|
-
if (_appVersion && !['sandbox', 'light_sandbox', 'prod'].includes(_environment)) return _appVersion;
|
31
|
-
var info = JSON.parse(_extendInfo);
|
32
|
-
return info.versionMap.web[json.version].targetWebVerison || appVersion;
|
33
|
-
} catch (error) {
|
34
|
-
return appVersion;
|
35
|
-
}
|
36
|
-
};
|
37
|
-
var marmptMap = {
|
38
|
-
dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
|
39
|
-
sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
|
40
|
-
pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
|
41
|
-
sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
|
42
|
-
light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
|
43
|
-
prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
|
44
|
-
};
|
45
|
-
var finalAppVersion = getAppVersion(extendInfo);
|
46
|
-
var getFinalProductSceneVersion = function getFinalProductSceneVersion(supportProductSceneVersion) {
|
47
|
-
// 从左到右,从旧到新
|
48
|
-
var isSupport = supportProductSceneVersion.find(function (it) {
|
49
|
-
return it === productSceneVersion;
|
50
|
-
});
|
51
|
-
var finalProductSceneVersion = supportProductSceneVersion[supportProductSceneVersion.length - 1];
|
52
|
-
if (isSupport) finalProductSceneVersion = productSceneVersion;
|
53
|
-
return finalProductSceneVersion;
|
54
|
-
};
|
55
|
-
var componentMap = (_componentMap = {}, _defineProperty(_componentMap, componentNameEnum.card, function () {
|
56
|
-
host = "".concat(marmptMap[_environment], "/").concat(componentNameEnum.card, "/index.").concat(finalAppVersion, ".html");
|
57
|
-
}), _defineProperty(_componentMap, componentNameEnum.easyPay, function () {
|
58
|
-
var finalProductSceneVersion = getFinalProductSceneVersion(['1.0', '2.0']);
|
59
|
-
host = "".concat(marmptMap[_environment], "/").concat(componentNameEnum.easyPay, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
60
|
-
}), _defineProperty(_componentMap, componentNameEnum.autoDebit, function () {
|
61
|
-
var finalProductSceneVersion = getFinalProductSceneVersion(['1.0']);
|
62
|
-
host = "".concat(marmptMap[_environment], "/").concat(componentNameEnum.autoDebit, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
|
63
|
-
}), _componentMap);
|
64
|
-
if (componentMap[componentName]) componentMap[componentName]();
|
65
|
-
// only for test while testurl?host=https://xxxxx.test.html
|
66
|
-
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(_environment)) {
|
67
|
-
return urlTestHost;
|
68
|
-
}
|
69
|
-
return host;
|
70
|
-
};
|
71
|
-
export var getAppDomain = function getAppDomain(_environment, version, componentName, productSceneVersion, extendInfo) {
|
72
|
-
var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
|
73
|
-
var macth = reg.exec(getAppPath(_environment, version, componentName, productSceneVersion, extendInfo));
|
74
|
-
return macth && macth[0] || '';
|
75
|
-
};
|