@alipay/ams-checkout 0.0.1694400497-dev.1 → 1.3.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.
Files changed (73) hide show
  1. package/{esm/config/request.d.ts → dist/esm/config/index.d.ts} +1 -0
  2. package/{esm/config/request.js → dist/esm/config/index.js} +3 -1
  3. package/{esm → dist/esm}/constant/index.d.ts +32 -54
  4. package/{esm → dist/esm}/constant/index.js +32 -54
  5. package/dist/esm/core/component/index.d.ts +17 -0
  6. package/dist/esm/core/component/index.js +146 -0
  7. package/dist/esm/core/drop-in/index.d.ts +29 -0
  8. package/{esm → dist/esm}/core/drop-in/index.js +19 -19
  9. package/{esm → dist/esm}/core/instance/index.d.ts +23 -6
  10. package/{esm → dist/esm}/core/instance/index.js +75 -32
  11. package/{esm/config/index.js → dist/esm/index.d.ts} +15 -10
  12. package/{esm → dist/esm}/index.js +30 -8
  13. package/dist/esm/plugin/component/appPath.d.ts +2 -0
  14. package/dist/esm/plugin/component/appPath.js +75 -0
  15. package/{esm/plugin/component/component.inline.style.d.ts → dist/esm/plugin/component/component.style.d.ts} +1 -4
  16. package/dist/esm/plugin/component/component.style.js +15 -0
  17. package/{esm → dist/esm}/plugin/component/index.d.ts +45 -33
  18. package/{esm → dist/esm}/plugin/component/index.js +450 -316
  19. package/{esm → dist/esm}/plugin/drop-in/index.d.ts +9 -7
  20. package/{esm → dist/esm}/plugin/drop-in/index.js +3 -4
  21. package/{esm → dist/esm/request}/index.d.ts +8 -9
  22. package/{esm → dist/esm}/request/index.js +13 -11
  23. package/{esm → dist/esm}/request/utils.d.ts +3 -3
  24. package/{esm → dist/esm}/request/utils.js +4 -6
  25. package/dist/esm/service/index.d.ts +2 -0
  26. package/{esm → dist/esm}/types/index.d.ts +48 -116
  27. package/dist/esm/types/index.js +94 -0
  28. package/dist/esm/util/createIframeNode.d.ts +5 -0
  29. package/dist/esm/util/createIframeNode.js +35 -0
  30. package/{esm → dist/esm}/util/get.js +0 -7
  31. package/{esm → dist/esm}/util/index.d.ts +4 -6
  32. package/{esm → dist/esm}/util/index.js +13 -29
  33. package/dist/esm/util/mock.js +4 -0
  34. package/dist/umd/ams-checkout.min.js +1 -1
  35. package/package.json +1 -1
  36. package/esm/config/index.d.ts +0 -2
  37. package/esm/core/component/index.d.ts +0 -24
  38. package/esm/core/component/index.js +0 -211
  39. package/esm/core/drop-in/index.d.ts +0 -22
  40. package/esm/image/skeleton.svg +0 -18
  41. package/esm/plugin/component/cashierApp.d.ts +0 -23
  42. package/esm/plugin/component/cashierApp.js +0 -123
  43. package/esm/plugin/component/component.inline.style.js +0 -38
  44. package/esm/plugin/component/component.popup.style.d.ts +0 -12
  45. package/esm/plugin/component/component.popup.style.js +0 -165
  46. package/esm/request/index.d.ts +0 -8
  47. package/esm/service/index.d.ts +0 -2
  48. package/esm/types/index.js +0 -134
  49. package/esm/util/createIframeNode.d.ts +0 -5
  50. package/esm/util/createIframeNode.js +0 -42
  51. package/esm/util/mock.js +0 -3
  52. /package/{esm → dist/esm}/image/cta.svg +0 -0
  53. /package/{esm → dist/esm}/service/index.js +0 -0
  54. /package/{esm → dist/esm}/util/get.d.ts +0 -0
  55. /package/{esm → dist/esm}/util/intl-callapp/es/browser.d.ts +0 -0
  56. /package/{esm → dist/esm}/util/intl-callapp/es/browser.js +0 -0
  57. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.d.ts +0 -0
  58. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.js +0 -0
  59. /package/{esm → dist/esm}/util/intl-callapp/es/generate.d.ts +0 -0
  60. /package/{esm → dist/esm}/util/intl-callapp/es/generate.js +0 -0
  61. /package/{esm → dist/esm}/util/intl-callapp/es/index.d.ts +0 -0
  62. /package/{esm → dist/esm}/util/intl-callapp/es/index.js +0 -0
  63. /package/{esm → dist/esm}/util/intl-callapp/es/main.d.ts +0 -0
  64. /package/{esm → dist/esm}/util/intl-callapp/es/main.js +0 -0
  65. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.d.ts +0 -0
  66. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.js +0 -0
  67. /package/{esm → dist/esm}/util/intl-callapp/es/types.d.ts +0 -0
  68. /package/{esm → dist/esm}/util/intl-callapp/es/types.js +0 -0
  69. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.d.ts +0 -0
  70. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.js +0 -0
  71. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.d.ts +0 -0
  72. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.js +0 -0
  73. /package/{esm → dist/esm}/util/mock.d.ts +0 -0
@@ -1,10 +1,10 @@
1
+ import { ERROR } from '../types';
1
2
  /**
2
3
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
4
  * 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:
4
5
  * 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
5
6
  * 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.
6
7
  */
7
- import { errorEnum } from '../types';
8
8
  declare const getType: (target: any) => string;
9
9
  declare class EventCenter {
10
10
  private events;
@@ -31,14 +31,14 @@ declare const safeJson: (data: any, obj: any) => any;
31
31
  declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
32
32
  success: boolean;
33
33
  traceId: string;
34
- errorCode: errorEnum;
34
+ errorCode: ERROR;
35
35
  resultStatus: any;
36
36
  errorMessage?: undefined;
37
37
  result?: undefined;
38
38
  } | {
39
39
  success: boolean;
40
40
  traceId: string;
41
- errorCode: errorEnum;
41
+ errorCode: ERROR;
42
42
  errorMessage: string;
43
43
  result: {
44
44
  resultStatus: any;
@@ -50,6 +50,4 @@ declare const fomatGetwayError: (headers: Record<string, any>, traceId: string)
50
50
  declare const isPC: () => boolean;
51
51
  declare const queryParse: (url?: string) => Record<string, any>;
52
52
  declare const getDesignFontSize: () => number;
53
- declare const amsSetSize: (event?: any, dom?: any) => void;
54
- declare const addSetFontSizeEvent: () => void;
55
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent };
53
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, };
@@ -5,15 +5,15 @@ 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 { ERROR } from "../types";
9
+ import { get } from "./get";
10
+
8
11
  /**
9
12
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
10
13
  * 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:
11
14
  * 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
12
15
  * 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.
13
16
  */
14
- /* eslint-disable @typescript-eslint/no-explicit-any */
15
- import { errorEnum } from "../types";
16
- import { get } from "./get";
17
17
  var getType = function getType(target) {
18
18
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
19
19
  };
@@ -79,7 +79,10 @@ var EventCenter = /*#__PURE__*/function () {
79
79
  value: function once(name, func, key) {
80
80
  var _this = this;
81
81
  var onceF = function onceF() {
82
- func.apply(void 0, arguments);
82
+ for (var _len2 = arguments.length, rest = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
83
+ rest[_key2] = arguments[_key2];
84
+ }
85
+ func.call.apply(func, [_this].concat(rest));
83
86
  _this.off(name, onceF, key);
84
87
  };
85
88
  this.on(name, onceF, key);
@@ -171,7 +174,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
171
174
  return {
172
175
  success: false,
173
176
  traceId: traceId,
174
- errorCode: errorEnum.LOGIN,
177
+ errorCode: ERROR.LOGIN,
175
178
  resultStatus: resultStatus
176
179
  };
177
180
  }
@@ -180,7 +183,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
180
183
  return {
181
184
  success: false,
182
185
  traceId: traceId,
183
- errorCode: errorEnum.TIMEOUT,
186
+ errorCode: ERROR.TIMEOUT,
184
187
  resultStatus: resultStatus
185
188
  };
186
189
  }
@@ -190,7 +193,7 @@ var fomatGetwayError = function fomatGetwayError(headers, traceId) {
190
193
  return {
191
194
  success: false,
192
195
  traceId: traceId,
193
- errorCode: errorEnum.GATEWAY,
196
+ errorCode: ERROR.GATEWAY,
194
197
  errorMessage: decodeURIComponent(tips || ''),
195
198
  result: {
196
199
  resultStatus: resultStatus || '',
@@ -224,28 +227,9 @@ var queryParse = function queryParse(url) {
224
227
  });
225
228
  return qs;
226
229
  };
227
- var designSize = 390;
228
- var maxFontSize = 130;
229
230
  var getDesignFontSize = function getDesignFontSize() {
230
231
  var screenWidth = document.documentElement.clientWidth;
231
- var currentFontSize = isPC() ? maxFontSize : screenWidth * 100 / designSize;
232
- return Math.min(currentFontSize, maxFontSize);
233
- };
234
- var amsSetSize = function amsSetSize(event, dom) {
235
- try {
236
- var componentContainerId = 'ams-component-container';
237
- var _dom = dom || document.getElementById(componentContainerId);
238
- _dom.style.fontSize = "".concat(getDesignFontSize(), "px");
239
- innerHeight = window.innerHeight;
240
- // eslint-disable-next-line no-empty
241
- } catch (error) {}
242
- };
243
- var addSetFontSizeEvent = function addSetFontSizeEvent() {
244
- window.removeEventListener('resize', amsSetSize);
245
- window.removeEventListener('pageShow', amsSetSize);
246
- window.removeEventListener('DOMContentLoaded', amsSetSize);
247
- window.addEventListener('resize', amsSetSize);
248
- window.addEventListener('pageShow', amsSetSize);
249
- window.addEventListener('DOMContentLoaded', amsSetSize);
232
+ var currentFontSize = isPC() ? 100 : screenWidth * 100 / 390;
233
+ return currentFontSize;
250
234
  };
251
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent };
235
+ export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, fomatGetwayError, safeJson, isPC, queryParse, getDesignFontSize };
@@ -0,0 +1,4 @@
1
+ export var isLocalMock = function isLocalMock() {
2
+ var _window, _window$process, _window$process$env;
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;
4
+ };