@alipay/ams-checkout 0.0.1694675458-dev.0 → 1.3.1-dev

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 (69) 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 +127 -0
  7. package/{esm → dist/esm}/core/drop-in/index.d.ts +4 -4
  8. package/{esm → dist/esm}/core/drop-in/index.js +3 -3
  9. package/{esm → dist/esm}/core/instance/index.d.ts +23 -6
  10. package/{esm → dist/esm}/core/instance/index.js +75 -31
  11. package/{esm → dist/esm}/index.d.ts +10 -4
  12. package/{esm → dist/esm}/index.js +30 -8
  13. package/{esm → dist/esm}/plugin/component/cashierApp.d.ts +6 -5
  14. package/{esm → dist/esm}/plugin/component/cashierApp.js +74 -57
  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 +33 -31
  18. package/{esm → dist/esm}/plugin/component/index.js +356 -273
  19. package/{esm → dist/esm}/plugin/drop-in/index.d.ts +5 -3
  20. package/{esm → dist/esm}/plugin/drop-in/index.js +3 -3
  21. package/{esm → dist/esm}/request/index.d.ts +2 -2
  22. package/{esm → dist/esm}/request/index.js +9 -9
  23. package/{esm → dist/esm}/request/utils.d.ts +3 -3
  24. package/{esm → dist/esm}/request/utils.js +4 -4
  25. package/dist/esm/service/index.d.ts +2 -0
  26. package/{esm → dist/esm}/types/index.d.ts +40 -99
  27. package/dist/esm/types/index.js +94 -0
  28. package/dist/esm/util/createIframeNode.d.ts +5 -0
  29. package/{esm → dist/esm}/util/createIframeNode.js +8 -8
  30. package/{esm → dist/esm}/util/index.d.ts +4 -6
  31. package/{esm → dist/esm}/util/index.js +7 -26
  32. package/dist/esm/util/mock.js +4 -0
  33. package/dist/umd/ams-checkout.min.js +1 -1
  34. package/package.json +54 -1
  35. package/esm/config/index.d.ts +0 -2
  36. package/esm/config/index.js +0 -17
  37. package/esm/core/component/index.d.ts +0 -31
  38. package/esm/core/component/index.js +0 -202
  39. package/esm/image/skeleton.svg +0 -18
  40. package/esm/plugin/component/component.inline.style.js +0 -38
  41. package/esm/plugin/component/component.popup.style.d.ts +0 -12
  42. package/esm/plugin/component/component.popup.style.js +0 -163
  43. package/esm/service/index.d.ts +0 -2
  44. package/esm/types/index.js +0 -134
  45. package/esm/util/createIframeNode.d.ts +0 -5
  46. package/esm/util/mock.js +0 -3
  47. /package/{esm → dist/esm}/image/cta.svg +0 -0
  48. /package/{esm → dist/esm}/service/index.js +0 -0
  49. /package/{esm → dist/esm}/util/get.d.ts +0 -0
  50. /package/{esm → dist/esm}/util/get.js +0 -0
  51. /package/{esm → dist/esm}/util/intl-callapp/es/browser.d.ts +0 -0
  52. /package/{esm → dist/esm}/util/intl-callapp/es/browser.js +0 -0
  53. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.d.ts +0 -0
  54. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.js +0 -0
  55. /package/{esm → dist/esm}/util/intl-callapp/es/generate.d.ts +0 -0
  56. /package/{esm → dist/esm}/util/intl-callapp/es/generate.js +0 -0
  57. /package/{esm → dist/esm}/util/intl-callapp/es/index.d.ts +0 -0
  58. /package/{esm → dist/esm}/util/intl-callapp/es/index.js +0 -0
  59. /package/{esm → dist/esm}/util/intl-callapp/es/main.d.ts +0 -0
  60. /package/{esm → dist/esm}/util/intl-callapp/es/main.js +0 -0
  61. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.d.ts +0 -0
  62. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.js +0 -0
  63. /package/{esm → dist/esm}/util/intl-callapp/es/types.d.ts +0 -0
  64. /package/{esm → dist/esm}/util/intl-callapp/es/types.js +0 -0
  65. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.d.ts +0 -0
  66. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.js +0 -0
  67. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.d.ts +0 -0
  68. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.js +0 -0
  69. /package/{esm → dist/esm}/util/mock.d.ts +0 -0
@@ -17,7 +17,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
17
17
  */
18
18
  import { v4 as uuid } from 'uuid';
19
19
  import { ERRORMESSAGE, EVENT } from "../../constant";
20
- import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../types/index";
20
+ import { environment, mode, networkMode, osType, terminalType } from "../../types/index";
21
21
  import { device, EventCenter, getType, queryParse } from "../../util/index";
22
22
  import CallApp from "../../util/intl-callapp/es/main";
23
23
  var AMSSDK = /*#__PURE__*/function () {
@@ -25,13 +25,16 @@ var AMSSDK = /*#__PURE__*/function () {
25
25
  _classCallCheck(this, AMSSDK);
26
26
  _defineProperty(this, "options", void 0);
27
27
  _defineProperty(this, "checkoutState", void 0);
28
- _defineProperty(this, "_eventCenter", void 0);
28
+ _defineProperty(this, "eventCenter", void 0);
29
29
  _defineProperty(this, "plugins", void 0);
30
30
  _defineProperty(this, "_instanceId", void 0);
31
31
  this._instanceId = uuid();
32
32
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
33
33
  this.options = {};
34
- this._eventCenter = new EventCenter();
34
+ this.eventCenter = new EventCenter();
35
+ this.checkoutState = {
36
+ paymentMethodType: ''
37
+ };
35
38
  this._initEvent(options);
36
39
  this._setOptions(options);
37
40
  this.plugins = new Map();
@@ -40,8 +43,8 @@ var AMSSDK = /*#__PURE__*/function () {
40
43
  * @description Destroy and process some contents of the plug-in
41
44
  */
42
45
  _createClass(AMSSDK, [{
43
- key: "unmount",
44
- value: function unmount() {
46
+ key: "destroy",
47
+ value: function destroy() {
45
48
  var _iterator = _createForOfIteratorHelper(this.plugins.values()),
46
49
  _step;
47
50
  try {
@@ -50,9 +53,7 @@ var AMSSDK = /*#__PURE__*/function () {
50
53
  try {
51
54
  plugin.logoutPlugin();
52
55
  // eslint-disable-next-line no-empty
53
- } catch (error) {
54
- console.error(error);
55
- }
56
+ } catch (error) {}
56
57
  }
57
58
  } catch (err) {
58
59
  _iterator.e(err);
@@ -78,17 +79,17 @@ var AMSSDK = /*#__PURE__*/function () {
78
79
  value: function _setEnv(options) {
79
80
  var _queryParse = queryParse(),
80
81
  _moreEnv = _queryParse._moreEnv;
81
- if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environmentEnum) && _moreEnv !== 'true') {
82
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
82
+ if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environment) && _moreEnv !== 'true') {
83
+ console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.errorMessage);
83
84
  options.environment = 'prod';
84
85
  }
85
86
  this.options.env = {
86
- terminalType: device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB,
87
+ terminalType: device.isMobile ? terminalType.WAP : terminalType.WEB,
87
88
  environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
88
89
  };
89
- if (this.options.env.terminalType === terminalTypeEnum.WAP) {
90
+ if (this.options.env.terminalType === terminalType.WAP) {
90
91
  // eslint-disable-next-line no-nested-ternary
91
- this.options.env.osType = device.iOS ? osTypeEnum.IOS : device.Android ? osTypeEnum.ANDROID : osTypeEnum.ELSE;
92
+ this.options.env.osType = device.iOS ? osType.IOS : device.Android ? osType.ANDROID : osType.ELSE;
92
93
  }
93
94
  }
94
95
  /**
@@ -97,15 +98,15 @@ var AMSSDK = /*#__PURE__*/function () {
97
98
  }, {
98
99
  key: "_setMode",
99
100
  value: function _setMode(options) {
100
- this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || modeEnum.component;
101
- if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in modeEnum)) {
102
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.message);
103
- this.options.mode = modeEnum.component;
101
+ this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || mode.dropin;
102
+ if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in mode)) {
103
+ console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.errorMessage);
104
+ this.options.mode = mode.component;
104
105
  }
105
- this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkModeEnum.session;
106
- if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkModeEnum)) {
107
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
108
- this.options.networkMode = networkModeEnum.proxy;
106
+ this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkMode.session;
107
+ if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkMode)) {
108
+ console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
109
+ this.options.networkMode = networkMode.proxy;
109
110
  }
110
111
  }
111
112
  /**
@@ -115,28 +116,32 @@ var AMSSDK = /*#__PURE__*/function () {
115
116
  key: "_initEvent",
116
117
  value: function _initEvent(options) {
117
118
  if (options !== null && options !== void 0 && options.onError) {
118
- if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
119
+ if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
119
120
  this._overrideSubscription(EVENT.error.name, options.onError, EVENT.error.uniqueKey);
120
121
  }
121
122
  if (options !== null && options !== void 0 && options.onPaymentMethodSelected) {
122
- if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
123
+ if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
123
124
  this._overrideSubscription(EVENT.paymentMethodSelected.name, options.onPaymentMethodSelected, EVENT.paymentMethodSelected.uniqueKey);
124
125
  }
126
+ if (options !== null && options !== void 0 && options.onReady) {
127
+ if (getType(options.onReady) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
128
+ this._overrideSubscription(EVENT.ready.name, options.onReady, EVENT.ready.uniqueKey);
129
+ }
125
130
  if (options !== null && options !== void 0 && options.onSizeChanged) {
126
- if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
131
+ if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
127
132
  this._overrideSubscription(EVENT.sizeChanged.name, options.onSizeChanged, EVENT.sizeChanged.uniqueKey);
128
133
  }
129
134
  if (options !== null && options !== void 0 && options.onLog) {
130
- if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
135
+ if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
131
136
  this._overrideSubscription(EVENT.log.name, options.onLog, EVENT.log.uniqueKey);
132
137
  }
133
138
  if (options !== null && options !== void 0 && options.onEventCallback) {
134
- if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
139
+ if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
135
140
  this._overrideSubscription(EVENT.eventCallback.name, options.onEventCallback, EVENT.eventCallback.uniqueKey);
136
141
  }
137
142
  if (options !== null && options !== void 0 && options.onClose) {
138
- if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
139
- this._overrideSubscription(EVENT.close.name, options.onClose, EVENT.close.uniqueKey);
143
+ if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.errorMessage);
144
+ this._overrideSubscription(EVENT.onClose.name, options.onClose, EVENT.onClose.uniqueKey);
140
145
  }
141
146
  }
142
147
  /**
@@ -174,7 +179,7 @@ var AMSSDK = /*#__PURE__*/function () {
174
179
  value: function _redirect(data) {
175
180
  var _this = this;
176
181
  return new Promise(function (resolve, reject) {
177
- var isWeb = _this.options.env.terminalType === terminalTypeEnum.WEB;
182
+ var isWeb = _this.options.env.terminalType === terminalType.WEB;
178
183
  var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
179
184
  var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
180
185
  var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
@@ -223,8 +228,47 @@ var AMSSDK = /*#__PURE__*/function () {
223
228
  }, {
224
229
  key: "_overrideSubscription",
225
230
  value: function _overrideSubscription(name, func, funcKey) {
226
- this._eventCenter.off(name, func, funcKey);
227
- this._eventCenter.on(name, func, funcKey);
231
+ this.eventCenter.off(name, func, funcKey);
232
+ this.eventCenter.on(name, func, funcKey);
233
+ }
234
+ /**
235
+ * @description Create an event handler, called when an error occurs in AMSCheckout.
236
+ */
237
+ }, {
238
+ key: "onError",
239
+ value: function onError(event) {
240
+ this._overrideSubscription(EVENT.error.name, event, EVENT.error.uniqueKey);
241
+ }
242
+ /**
243
+ * @description Create an event handler, called when the checkout view is available for interaction.
244
+ * mode: dropin
245
+ */
246
+ // onReady(event: () => void) {
247
+ // this._overrideSubscription(EVENT.ready.name, event, EVENT.ready.uniqueKey);
248
+ // }
249
+ /**
250
+ * @description Create an event handler, called after the user selects the payment method
251
+ * mode: dropin
252
+ */
253
+ // onPaymentMethodSelected(event: callonPaymentMethodSelected) {
254
+ // this._overrideSubscription(
255
+ // EVENT.paymentMethodSelected.name,
256
+ // event,
257
+ // EVENT.paymentMethodSelected.uniqueKey,
258
+ // );
259
+ // }
260
+ /**
261
+ * @description Create an event handler
262
+ */
263
+ }, {
264
+ key: "onSizeChanged",
265
+ value: function onSizeChanged(event) {
266
+ this._overrideSubscription(EVENT.sizeChanged.name, event, EVENT.sizeChanged.uniqueKey);
267
+ }
268
+ }, {
269
+ key: "onLog",
270
+ value: function onLog(event) {
271
+ this._overrideSubscription(EVENT.log.name, event, EVENT.log.uniqueKey);
228
272
  }
229
273
  }]);
230
274
  return AMSSDK;
@@ -5,12 +5,18 @@
5
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
6
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.
7
7
  */
8
- import { AMSComponent } from './core/component/index';
9
- import { IoptionsParams } from './types';
8
+ import { IcreateComponentFunc } from './core/component/index';
9
+ import { IconfirmPaymentFunc, IcreatePaymentFunc } from './core/drop-in/index';
10
+ import AMSSDK from './core/instance';
11
+ import { optionsParams } from './types';
10
12
  export * from './types';
11
- export declare class AMSCheckout extends AMSComponent {
13
+ export declare class AMSCheckout extends AMSSDK {
14
+ createComponent: IcreateComponentFunc;
15
+ createPayment: IcreatePaymentFunc;
16
+ confirmPayment: IconfirmPaymentFunc;
17
+ constructor(options: optionsParams);
12
18
  }
13
19
  export declare class AMSAutoDebit extends AMSCheckout {
14
- constructor(options: IoptionsParams);
20
+ constructor(options: optionsParams);
15
21
  }
16
22
  export default AMSCheckout;
@@ -1,8 +1,6 @@
1
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
2
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
3
3
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
- 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); }
6
4
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
5
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
6
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
@@ -11,6 +9,9 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
11
9
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
11
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
+ 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; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ 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); }
14
15
  /**
15
16
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
16
17
  *
@@ -18,17 +19,38 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
18
19
  * 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
19
20
  * 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.
20
21
  */
21
- import { AMSComponent } from "./core/component/index";
22
+ import { createComponent, mixinComponentConstructor } from "./core/component/index";
23
+ import { confirmPayment, createPayment, mixinDropInConstructor, _subscribeFromCheckoutPlugin } from "./core/drop-in/index";
24
+ import AMSSDK from "./core/instance";
22
25
  export * from "./types";
23
- export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
24
- _inherits(AMSCheckout, _AMSComponent);
26
+ export var AMSCheckout = /*#__PURE__*/function (_AMSSDK) {
27
+ _inherits(AMSCheckout, _AMSSDK);
25
28
  var _super = _createSuper(AMSCheckout);
26
- function AMSCheckout() {
29
+ function AMSCheckout(options) {
30
+ var _this;
27
31
  _classCallCheck(this, AMSCheckout);
28
- return _super.apply(this, arguments);
32
+ _this = _super.call(this, options);
33
+ _defineProperty(_assertThisInitialized(_this), "createComponent", void 0);
34
+ _defineProperty(_assertThisInitialized(_this), "createPayment", void 0);
35
+ _defineProperty(_assertThisInitialized(_this), "confirmPayment", void 0);
36
+ Object.defineProperty(_assertThisInitialized(_this), 'createComponent', {
37
+ value: createComponent
38
+ });
39
+ Object.defineProperty(_assertThisInitialized(_this), 'createPayment', {
40
+ value: createPayment
41
+ });
42
+ Object.defineProperty(_assertThisInitialized(_this), 'confirmPayment', {
43
+ value: confirmPayment
44
+ });
45
+ Object.defineProperty(_assertThisInitialized(_this), '_subscribeFromCheckoutPlugin', {
46
+ value: _subscribeFromCheckoutPlugin
47
+ });
48
+ mixinComponentConstructor(options, _assertThisInitialized(_this));
49
+ mixinDropInConstructor(options, _assertThisInitialized(_this));
50
+ return _this;
29
51
  }
30
52
  return _createClass(AMSCheckout);
31
- }(AMSComponent);
53
+ }(AMSSDK);
32
54
  export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
33
55
  _inherits(AMSAutoDebit, _AMSCheckout);
34
56
  var _super2 = _createSuper(AMSAutoDebit);
@@ -1,14 +1,15 @@
1
- import { componentSignEnum, Ianalytics } from '../../types';
2
- export declare const getAppPath: (environment: string | undefined, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
1
+ import { Ianalytics } from '../../types';
2
+ export declare const getAppPath: (environment: string | undefined, appVersion: string, componentName: string, productSceneVersion: string, extendInfo: string) => any;
3
3
  export declare const getAppDomain: (domainParams: {
4
4
  environment: string;
5
5
  appVersion: string;
6
- componentSign: componentSignEnum;
6
+ componentName: string;
7
7
  productSceneVersion: string;
8
8
  extendInfo: string;
9
9
  }) => string;
10
10
  export declare const getIframeUrl: (iframeParams: {
11
- componentSign: componentSignEnum;
11
+ componentName: string;
12
+ appearance: Record<string, string>;
12
13
  analytics?: Ianalytics;
13
14
  productSceneVersion: string;
14
15
  environment: string;
@@ -20,4 +21,4 @@ export declare const getIframeUrl: (iframeParams: {
20
21
  /**
21
22
  * @description Create iframe
22
23
  */
23
- export declare const createIframe: (mode: string, platform: 'mobile' | 'desktop') => HTMLIFrameElement;
24
+ export declare const createIframe: (UIMode: string) => HTMLIFrameElement;
@@ -9,57 +9,78 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
9
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
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
11
  */
12
- import { marmptMap, sdkVersion } from "../../config/index";
13
- import { componentSignEnum } from "../../types";
12
+ import json from "../../../package.json";
13
+ import { componentNameEnum } from "../../types";
14
14
  import { getViewPort, queryParse, serialize } from "../../util/index";
15
- var getAppVersion = function getAppVersion(_extendInfo) {
16
- try {
17
- var info = JSON.parse(_extendInfo);
18
- return info.versionMap.web[sdkVersion].targetWebVerison;
19
- } catch (error) {
20
- return '';
21
- }
22
- };
23
- var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
24
- var _signSupportMap;
25
- var signSupportMap = (_signSupportMap = {}, _defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), _defineProperty(_signSupportMap, componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), _signSupportMap);
26
- var supportProductSceneVersion = signSupportMap[componentSign];
27
- // 从左到右,从旧到新
28
- var isSupport = supportProductSceneVersion.find(function (it) {
29
- return it === productSceneVersion;
30
- });
31
- var finalProductSceneVersion = supportProductSceneVersion[supportProductSceneVersion.length - 1];
32
- return isSupport ? productSceneVersion : finalProductSceneVersion;
33
- };
34
15
  export var getAppPath = function getAppPath() {
16
+ var _componentMap;
35
17
  var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
36
18
  var appVersion = arguments.length > 1 ? arguments[1] : undefined;
37
- var componentSign = arguments.length > 2 ? arguments[2] : undefined;
19
+ var componentName = arguments.length > 2 ? arguments[2] : undefined;
38
20
  var productSceneVersion = arguments.length > 3 ? arguments[3] : undefined;
39
21
  var extendInfo = arguments.length > 4 ? arguments[4] : undefined;
40
22
  var _ref = queryParse() || {},
41
- urlTestHost = _ref.host;
42
- var finalAppVersion = getAppVersion(extendInfo) || appVersion;
43
- var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
44
-
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]();
45
65
  // only for test while testurl?host=https://xxxxx.test.html
46
66
  if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
47
67
  return urlTestHost;
48
68
  }
49
- return "".concat(marmptMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
69
+ return host;
50
70
  };
51
71
  export var getAppDomain = function getAppDomain(domainParams) {
52
72
  var environment = domainParams.environment,
53
73
  appVersion = domainParams.appVersion,
54
- componentSign = domainParams.componentSign,
74
+ componentName = domainParams.componentName,
55
75
  productSceneVersion = domainParams.productSceneVersion,
56
76
  extendInfo = domainParams.extendInfo;
57
77
  var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
58
- var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo));
78
+ var macth = reg.exec(getAppPath(environment, appVersion, componentName, productSceneVersion, extendInfo));
59
79
  return macth && macth[0] || '';
60
80
  };
61
81
  export var getIframeUrl = function getIframeUrl(iframeParams) {
62
- var componentSign = iframeParams.componentSign,
82
+ var componentName = iframeParams.componentName,
83
+ appearance = iframeParams.appearance,
63
84
  _iframeParams$analyti = iframeParams.analytics,
64
85
  analytics = _iframeParams$analyti === void 0 ? {
65
86
  enabled: true
@@ -70,9 +91,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
70
91
  extendInfo = iframeParams.extendInfo,
71
92
  locale = iframeParams.locale,
72
93
  instanceId = iframeParams.instanceId;
73
- var path = getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo || '');
74
- var initialScale = 1;
75
- var scale = getViewPort('initial-scale') || initialScale;
94
+ var path = getAppPath(environment, appVersion, componentName, productSceneVersion, extendInfo || '');
95
+ var scale = getViewPort('initial-scale') || 1;
76
96
  var _queryParse = queryParse(),
77
97
  _sandbox = _queryParse._sandbox,
78
98
  _light_sandbox = _queryParse._light_sandbox,
@@ -81,43 +101,40 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
81
101
  _queryParse$groupId = _queryParse.groupId,
82
102
  groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
83
103
  LOCAL_MOCK = _queryParse.LOCAL_MOCK;
84
- var urlParams = Object.assign({}, {
104
+ var urlParams = Object.assign({
85
105
  locale: locale,
86
106
  scale: scale,
87
107
  instanceId: instanceId,
108
+ sandbox: environment === 'light_sandbox' || _light_sandbox === 'true' ? 'true' : 'false',
88
109
  analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',
89
- sdkVersion: sdkVersion,
90
- refUrl: window.location.href
91
- });
92
- if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
93
- if (requestHost) urlParams.requestHost = requestHost;
94
- if (groupId) urlParams.groupId = groupId;
95
- if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
96
- if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
110
+ sdkVersion: json.version,
111
+ refUrl: window.location.href,
112
+ shadow: environment === 'sandbox' || _sandbox === 'true' ? 'true' : 'false',
113
+ requestHost: requestHost,
114
+ groupId: groupId,
115
+ LOCAL_MOCK: LOCAL_MOCK
116
+ }, appearance);
97
117
  var locationSearch = serialize(urlParams);
98
118
  return "".concat(path, "?").concat(locationSearch);
99
119
  };
120
+ var getIframeId = function getIframeId(UIMode) {
121
+ var IdMap = {
122
+ dropin: 'checkout-dropin',
123
+ component: 'checkout-component'
124
+ };
125
+ return IdMap[UIMode] || 'checkout-component';
126
+ };
100
127
 
101
128
  /**
102
129
  * @description Create iframe
103
130
  */
104
- export var createIframe = function createIframe(mode, platform) {
105
- var getIframeId = function getIframeId() {
106
- var IdMap = {
107
- dropin: "ams-checkout-dropin-".concat(platform),
108
- component: "ams-checkout-component-".concat(platform)
109
- };
110
- return IdMap[mode] || 'ams-checkout-component';
111
- };
131
+ export var createIframe = function createIframe(UIMode) {
112
132
  var iframe = document.createElement('iframe');
113
- var iframeId = getIframeId();
114
- var none = '0';
115
- var width = '100%';
133
+ var iframeId = getIframeId(UIMode);
116
134
  iframe.id = iframeId;
117
- iframe.style.height = none;
118
- iframe.style.width = width;
119
- iframe.style.border = none;
120
- iframe.style.opacity = none;
135
+ iframe.style.height = '0px';
136
+ iframe.style.width = '100%';
137
+ iframe.style.border = '0';
121
138
  iframe.style.overflow = 'hidden';
122
139
  return iframe;
123
140
  };
@@ -5,7 +5,4 @@
5
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
6
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.
7
7
  */
8
- import { platformEnum } from '../../types';
9
- export declare const inlineComponentAddCss: () => void;
10
- export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void;
11
- export declare const createInlineBaseElement: (selector: string) => HTMLDivElement | undefined;
8
+ export declare function componentAddCSS(): void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 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:
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
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.
7
+ */
8
+
9
+ var componentCss = ".ams-component-container-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: #ffffff;\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n}\n.ams-component-container-mobile-animation{\n animation: ams-component-container-slide-in 0.3s ease-in-out;\n}\n\n.ams-component-section-desktop {\n font-size: 0;\n}\n\n.ams-component-container-hidden-mobile {\n width: 100%;\n height: 1px;\n position: fixed;\n bottom: -1px;\n left: 0;\n z-index: 1001;\n background-color: transparent;\n border-radius: 12px 12px 0 0;\n animation: ams-component-container-slide-out 0.26s ease-in forwards;\n overflow: hidden;\n}\n\n.ams-component-section-mobile {\n border-radius: 12px 12px 0 0;\n overflow: hidden;\n font-size: 0;\n}\n\n.ams-component-container-desktop {\n display: block;\n width: 672px;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n background-color: #ffffff;\n border-radius: 8px;\n overflow: hidden;\n transform-origin: 50% 50%;\n}\n.ams-component-container-desktop-animation{\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n@keyframes ams-component-container-zoom-out {\n 0% {\n transform: translateX(-50%) translateY(-50%) scale(1);\n opacity: 1\n }\n\n 80% {\n opacity: 0\n }\n \n 100% {\n opacity: 0;\n transform: translateX(-50%) translateY(-50%) scale(0.4);\n }\n}\n\n@keyframes ams-component-container-zoom-in {\n 0% {\n transform: translateX(-50%) translateY(-50%) scale(0.4);\n opacity: 0\n }\n\n 80% {\n opacity: 1\n }\n\n 100% {\n opacity: 1;\n transform: translateX(-50%) translateY(-50%) scale(1);\n }\n}\n\n.ams-component-container-hidden-desktop {\n display: block;\n position: fixed;\n top: 50%;\n left: 50%;\n z-index: 1001;\n background-color: #ffffff;\n border-radius: 8px;\n overflow: hidden;\n animation-fill-mode: forwards;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n transform-origin: 50% 50%;\n}\n\n.ams-component-loading {\n width: 0.8em;\n height:0.8em;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-loading .line div:before,\n.ams-component-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: #fcfcfc;\n border-radius: 5.3px;\n}\n.ams-component-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n\n}\n\n.ams-component-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n\n.asm-component-close-block-desktop {\n position: absolute;\n width: 40px;\n height: 40px;\n right: 0;\n top: 0;\n cursor: pointer;\n}\n.asm-component-close-btn-desktop {\n width: 11px;\n height: 11px;\n object-fit: fill;\n position: absolute;\n right: 18.7px;\n top: 26.7px;\n}\n.asm-component-close-block-hidden {\n width: 0px !important;\n height: 0px !important;\n visibility: hidden;\n}\n.asm-component-close-block-mobile {\n position: absolute;\n width: 0.4em;\n height: 0.4em;\n right: 0;\n top: 0;\n cursor: pointer;\n z-index: 1009;\n}\n\n.asm-component-close-btn-mobile {\n width: 0.11em;\n height: 0.11em;\n object-fit: fill;\n position: absolute;\n right: 0.147em;\n top: 0.167em;\n}\n\n\n.ams-component-container-opacity{\n opacity: 1;\n}\n\n.ams-component-container-opacity:after{\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n display: block;\n content: \"\";\n z-index: 1010;\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n#ams-component-retention {\n position: fixed;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: 50%;\n height: auto;\n display: none;\n z-index: 1009;\n}\n\n.ams-component-retention-show {\n display: flex !important;\n animation: ams-component-container-zoom-in 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-hidden {\n display: flex !important;\n animation: ams-component-container-zoom-out 0.3s ease-in-out;\n animation-fill-mode: forwards\n}\n\n.ams-component-retention-mobile {\n width: 294px;\n border-radius: 12px;\n padding: 24px 0;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-desktop {\n width: 544px;\n border-radius: 12px;\n padding: 32px;\n background-color: #fff;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n box-sizing: border-box;\n}\n\n@media screen and (max-width: 300px) {\n .ams-component-retention-mobile {\n transform: translate(-50%, -50%) scale(0.8);\n }\n}\n\n.ams-component-retention-title-mobile {\n width: 100%;\n font-style: normal;\n font-weight: 600;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-title-desktop {\n text-align: left;\n width: 100%;\n font-style: normal;\n font-weight: 600;\n font-size: 16px;\n line-height: 24px;\n color: #2A3A52;\n}\n\n.ams-component-retention-sub-title-mobile {\n width: 100%;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 8px;\n text-align: center;\n padding: 0 16px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-sub-title-desktop {\n text-align: left;\n font-style: normal;\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: #7C8CA3;\n margin-top: 10px;\n}\n\n.ams-component-retention-btn-block-mobile {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n margin-top: 24px;\n padding: 0 24px;\n box-sizing: border-box;\n}\n\n.ams-component-retention-btn-block-desktop {\n width: 100%;\n margin-top: 24px;\n}\n\n#ams-component-retention-remain {\n background: #0079FF;\n border-radius: 100px;\n font-style: normal;\n font-weight: 600;\n text-align: center;\n box-sizing: border-box;\n color: #FFFFFF;\n}\n\n.ams-component-retention-remain-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n}\n\n.ams-component-retention-remain-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n display: inline-block;\n padding: 0 24px;\n float: right;\n cursor: pointer;\n}\n\n#ams-component-retention-leave {\n border-radius: 100px;\n border: 1px solid #0079FF;\n font-style: normal;\n font-weight: 600;\n text-align: center;\n box-sizing: border-box;\n}\n\n.ams-component-retention-leave-mobile {\n width: 100%;\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n margin-top: 12px;\n}\n\n.ams-component-retention-leave-desktop {\n height: 44px;\n font-size: 16px;\n line-height: 44px;\n color: #1677FF;\n display: inline-block;\n padding: 0 24px;\n float: right;\n margin-right: 16px;\n cursor: pointer;\n}\n\n";
10
+ export function componentAddCSS() {
11
+ var style = document.createElement('style');
12
+ style.type = 'text/css';
13
+ style.innerHTML = componentCss;
14
+ document.head.appendChild(style);
15
+ }