@alipay/ams-checkout 0.0.1691995963-dev.1 → 0.0.1692935171-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 +1 -15
- package/esm/config/index.js +9 -62
- package/esm/config/request.d.ts +21 -0
- package/esm/config/request.js +67 -0
- package/esm/constant/index.d.ts +42 -32
- package/esm/constant/index.js +42 -32
- package/esm/core/component/index.d.ts +22 -9
- package/esm/core/component/index.js +161 -98
- package/esm/core/drop-in/index.d.ts +1 -1
- package/esm/core/instance/index.d.ts +6 -23
- package/esm/core/instance/index.js +31 -75
- package/esm/image/skeleton.svg +18 -0
- package/esm/index.d.ts +4 -10
- package/esm/index.js +8 -30
- package/esm/plugin/component/cashierApp.d.ts +5 -6
- package/esm/plugin/component/cashierApp.js +48 -64
- package/esm/plugin/component/component.style.d.ts +4 -1
- package/esm/plugin/component/component.style.js +32 -4
- package/esm/plugin/component/index.d.ts +23 -11
- package/esm/plugin/component/index.js +243 -177
- package/esm/plugin/drop-in/index.js +1 -1
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +8 -7
- package/esm/request/utils.d.ts +3 -3
- package/esm/request/utils.js +4 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +96 -37
- package/esm/types/index.js +92 -52
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +8 -8
- package/esm/util/index.d.ts +6 -4
- package/esm/util/index.js +22 -5
- package/esm/util/mock.js +1 -2
- package/package.json +1 -1
package/esm/util/index.js
CHANGED
@@ -5,7 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
5
5
|
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; }
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
7
7
|
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); }
|
8
|
-
import {
|
8
|
+
import { errorEnum } from "../types";
|
9
9
|
import { get } from "./get";
|
10
10
|
|
11
11
|
/**
|
@@ -174,7 +174,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
174
174
|
return {
|
175
175
|
success: false,
|
176
176
|
traceId: traceId,
|
177
|
-
errorCode:
|
177
|
+
errorCode: errorEnum.LOGIN,
|
178
178
|
resultStatus: resultStatus
|
179
179
|
};
|
180
180
|
}
|
@@ -183,7 +183,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
183
183
|
return {
|
184
184
|
success: false,
|
185
185
|
traceId: traceId,
|
186
|
-
errorCode:
|
186
|
+
errorCode: errorEnum.TIMEOUT,
|
187
187
|
resultStatus: resultStatus
|
188
188
|
};
|
189
189
|
}
|
@@ -193,7 +193,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
|
|
193
193
|
return {
|
194
194
|
success: false,
|
195
195
|
traceId: traceId,
|
196
|
-
errorCode:
|
196
|
+
errorCode: errorEnum.GATEWAY,
|
197
197
|
errorMessage: decodeURIComponent(tips || ''),
|
198
198
|
result: {
|
199
199
|
resultStatus: resultStatus || '',
|
@@ -234,4 +234,21 @@ var getDesignFontSize = function getDesignFontSize() {
|
|
234
234
|
var currentFontSize = isPC() ? maxFontSize : screenWidth * 100 / designSize;
|
235
235
|
return Math.min(currentFontSize, maxFontSize);
|
236
236
|
};
|
237
|
-
|
237
|
+
var amsSetSize = function amsSetSize(event, dom) {
|
238
|
+
try {
|
239
|
+
var componentContainerId = 'ams-component-container';
|
240
|
+
var _dom = dom || document.getElementById(componentContainerId);
|
241
|
+
_dom.style.fontSize = "".concat(getDesignFontSize(), "px");
|
242
|
+
innerHeight = window.innerHeight;
|
243
|
+
// eslint-disable-next-line no-empty
|
244
|
+
} catch (error) {}
|
245
|
+
};
|
246
|
+
var addSetFontSizeEvent = function addSetFontSizeEvent() {
|
247
|
+
window.removeEventListener('resize', amsSetSize);
|
248
|
+
window.removeEventListener('pageShow', amsSetSize);
|
249
|
+
window.removeEventListener('DOMContentLoaded', amsSetSize);
|
250
|
+
window.addEventListener('resize', amsSetSize);
|
251
|
+
window.addEventListener('pageShow', amsSetSize);
|
252
|
+
window.addEventListener('DOMContentLoaded', amsSetSize);
|
253
|
+
};
|
254
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent };
|
package/esm/util/mock.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
1
|
export var isLocalMock = function isLocalMock() {
|
2
|
-
|
3
|
-
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$process = _window.process) === null || _window$process === void 0 ? void 0 : (_window$process$env = _window$process.env) === null || _window$process$env === void 0 ? void 0 : _window$process$env.NODE_ENV) === 'MOCK' && window.location.href.indexOf('LOCAL_MOCK=1') > -1;
|
2
|
+
return window.location.href.indexOf('LOCAL_MOCK=1') > -1;
|
4
3
|
};
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@alipay/ams-checkout","version":"0.0.
|
1
|
+
{"name":"@alipay/ams-checkout","version":"0.0.1692935171-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","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"}}
|