@alipay/ams-checkout 1.5.7 → 1.5.9

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.
@@ -1,2 +1,2 @@
1
- export declare const marmptMap: Record<string, string>;
1
+ export declare const marmotMap: Record<string, string>;
2
2
  export declare const sdkVersion: string;
@@ -6,12 +6,12 @@
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
8
  import json from "../../package.json";
9
- export var marmptMap = {
9
+ export var marmotMap = {
10
10
  dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
11
11
  sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
12
12
  pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
13
- sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
14
- light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
15
- prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
13
+ sandbox: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app',
14
+ light_sandbox: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app',
15
+ prod: 'https://cdn.marmot-cloud.com/page/antom-web-checkout/src/component-app'
16
16
  };
17
17
  export var sdkVersion = json.version;
@@ -140,6 +140,18 @@ export declare const EVENT: {
140
140
  dismissLoading: {
141
141
  name: string;
142
142
  };
143
+ popupWindow: {
144
+ name: string;
145
+ };
146
+ closePopup: {
147
+ name: string;
148
+ };
149
+ threedReady: {
150
+ name: string;
151
+ };
152
+ getDeviceId: {
153
+ name: string;
154
+ };
143
155
  };
144
156
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
145
157
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -151,6 +163,7 @@ export declare const LOADING_ID = "ams-component-loading";
151
163
  export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
152
164
  export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
153
165
  export declare const INLINE_IMG_CLASSNAME = "inline-loading";
166
+ export declare const AMSPOPUP_PREFIX = "ams-popup";
154
167
  export declare const LOADTIME_LIMIT = 15000;
155
168
  export declare const ANIMATION_TIME = 300;
156
169
  export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
@@ -139,6 +139,18 @@ export var EVENT = {
139
139
  },
140
140
  dismissLoading: {
141
141
  name: 'dismissLoading'
142
+ },
143
+ popupWindow: {
144
+ name: 'popupWindow'
145
+ },
146
+ closePopup: {
147
+ name: 'closePopup'
148
+ },
149
+ threedReady: {
150
+ name: 'threedReady'
151
+ },
152
+ getDeviceId: {
153
+ name: 'getDeviceId'
142
154
  }
143
155
  };
144
156
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -151,6 +163,7 @@ export var LOADING_ID = 'ams-component-loading';
151
163
  export var LISTENER_PREFIX = '_ams_sdk_component_listener';
152
164
  export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
153
165
  export var INLINE_IMG_CLASSNAME = 'inline-loading';
166
+ export var AMSPOPUP_PREFIX = 'ams-popup';
154
167
  export var LOADTIME_LIMIT = 15000;
155
168
  export var ANIMATION_TIME = 300;
156
169
  export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
@@ -1,4 +1,4 @@
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); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
3
  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); } }
4
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -16,7 +16,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
16
16
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
17
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
18
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
19
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  /**
22
22
  * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
@@ -72,7 +72,7 @@ var handleParams = function handleParams(params) {
72
72
  paymentSessionMetaData: {},
73
73
  renderDisplayType: renderDisplayTypeEnum.popup
74
74
  }, params);
75
- var _handleSessionData = handleSessionData(_params.sessionData),
75
+ var _handleSessionData = handleSessionData(_params.sessionData || (_params === null || _params === void 0 ? void 0 : _params.paymentSessionData)),
76
76
  _handleSessionData2 = _slicedToArray(_handleSessionData, 2),
77
77
  parseData = _handleSessionData2[0],
78
78
  sessionData = _handleSessionData2[1];
@@ -119,7 +119,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
119
119
  selector: selector,
120
120
  renderDisplayType: renderDisplayType
121
121
  }, params);
122
- if (_params && !_params.sessionData) {
122
+ if (_params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
123
123
  return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
124
124
  }
125
125
  if (this.options.networkMode === networkModeEnum.proxy) {
@@ -132,6 +132,9 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
132
132
  key: "pluginAppendIframe",
133
133
  value: function pluginAppendIframe(appendParams) {
134
134
  try {
135
+ this.logger.logInfo({
136
+ title: 'sdk_event_createComponent'
137
+ }).send();
135
138
  return this._componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
136
139
  } catch (error) {
137
140
  return Promise.reject(error);
@@ -1,16 +1,28 @@
1
- import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams } from '../../types/index';
1
+ import { Logger } from '../../util/logger';
2
+ import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams, IsecurityConfig } from '../../types/index';
2
3
  import { EventCenter } from '../../util/index';
3
4
  export default class AMSSDK {
4
5
  options: AMSCheckoutOptions;
5
6
  checkoutState: IcheckoutState;
7
+ securityConfig: IsecurityConfig;
6
8
  _eventCenter: EventCenter;
7
9
  protected plugins: Map<string, any>;
8
10
  _instanceId: string;
11
+ _storageId: string;
12
+ logger: Logger;
9
13
  constructor(options: IoptionsParams);
10
14
  /**
11
15
  * @description Destroy and process some contents of the plug-in
12
16
  */
13
17
  unmount(): void;
18
+ /**
19
+ * @description set STORAGE_ID for a user session
20
+ */
21
+ getStorageId(instanceId: string): any;
22
+ /**
23
+ * @description init initSecurity SDK
24
+ */
25
+ initSecurity(securityConfig: IsecurityConfig): void;
14
26
  /**
15
27
  * @description Set the sdk basic configuration
16
28
  */
@@ -1,4 +1,4 @@
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); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -17,25 +17,47 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
17
17
  */
18
18
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
19
  import { v4 as uuid } from 'uuid';
20
+ import { LogConfig, Logger } from "../../util/logger";
20
21
  import { ERRORMESSAGE, EVENT } from "../../constant";
21
22
  import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../types/index";
22
23
  import { device, EventCenter, getType, queryParse } from "../../util/index";
23
24
  import CallApp from "../../util/intl-callapp/es/main";
25
+ import { initAPSecurity } from "../../util/security";
26
+
27
+ // TODO Faster initialization of buried point tools
24
28
  var AMSSDK = /*#__PURE__*/function () {
25
29
  function AMSSDK(options) {
26
30
  _classCallCheck(this, AMSSDK);
27
31
  _defineProperty(this, "options", void 0);
28
32
  _defineProperty(this, "checkoutState", void 0);
33
+ _defineProperty(this, "securityConfig", void 0);
29
34
  _defineProperty(this, "_eventCenter", void 0);
30
35
  _defineProperty(this, "plugins", void 0);
31
36
  _defineProperty(this, "_instanceId", void 0);
37
+ _defineProperty(this, "_storageId", void 0);
38
+ _defineProperty(this, "logger", void 0);
32
39
  this._instanceId = uuid();
33
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
40
+ this._storageId = this.getStorageId(this._instanceId);
34
41
  this.options = {};
35
42
  this._eventCenter = new EventCenter();
36
43
  this._initEvent(options);
37
44
  this._setOptions(options);
38
45
  this.plugins = new Map();
46
+ this.securityConfig = null;
47
+
48
+ // TODO Consumption data analysis control parameters
49
+ this.logger = new Logger(LogConfig, (options === null || options === void 0 ? void 0 : options.environment) !== environmentEnum.prod);
50
+ this.logger.setMedta({
51
+ instanceId: this._instanceId
52
+ });
53
+ this.logger.initTracker();
54
+ this.logger.logInfo({
55
+ title: 'NEW_AMSSDK_BY_MECHANT',
56
+ msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale, "}")
57
+ }).send();
58
+ if (options !== null && options !== void 0 && options.securityConfig) {
59
+ this.initSecurity(options === null || options === void 0 ? void 0 : options.securityConfig);
60
+ }
39
61
  }
40
62
  /**
41
63
  * @description Destroy and process some contents of the plug-in
@@ -43,6 +65,9 @@ var AMSSDK = /*#__PURE__*/function () {
43
65
  _createClass(AMSSDK, [{
44
66
  key: "unmount",
45
67
  value: function unmount() {
68
+ this.logger.logInfo({
69
+ title: 'sdk_event_apiOnDestroy'
70
+ }).send();
46
71
  var _iterator = _createForOfIteratorHelper(this.plugins.values()),
47
72
  _step;
48
73
  try {
@@ -61,6 +86,54 @@ var AMSSDK = /*#__PURE__*/function () {
61
86
  _iterator.f();
62
87
  }
63
88
  }
89
+
90
+ /**
91
+ * @description set STORAGE_ID for a user session
92
+ */
93
+ }, {
94
+ key: "getStorageId",
95
+ value: function getStorageId(instanceId) {
96
+ var storageKey = 'AMSSDK_STORAGE_ID';
97
+ if (window.localStorage) {
98
+ var storageId = window.localStorage.getItem(storageKey);
99
+ if (storageId) {
100
+ return storageId;
101
+ } else {
102
+ window.localStorage.setItem(storageKey, instanceId);
103
+ }
104
+ }
105
+ return instanceId;
106
+ }
107
+
108
+ /**
109
+ * @description init initSecurity SDK
110
+ */
111
+ }, {
112
+ key: "initSecurity",
113
+ value: function initSecurity(securityConfig) {
114
+ var _this = this;
115
+ try {
116
+ this.securityConfig = securityConfig;
117
+ initAPSecurity(securityConfig, function () {
118
+ _this.logger.logInfo({
119
+ title: 'sdk_event_securitySdkPreInitSuccess'
120
+ }).send();
121
+ }, function (msg) {
122
+ _this.logger.logError({
123
+ title: 'sdk_error_securitySdkInitFailed',
124
+ msg: msg
125
+ }).send();
126
+ });
127
+ this.logger.logInfo({
128
+ title: 'sdk_event_securitySdkPreInit'
129
+ }).send();
130
+ } catch (e) {
131
+ this.logger.logError({
132
+ title: 'sdk_error_securitySdkInitFailed'
133
+ }).send();
134
+ }
135
+ }
136
+
64
137
  /**
65
138
  * @description Set the sdk basic configuration
66
139
  */
@@ -173,9 +246,9 @@ var AMSSDK = /*#__PURE__*/function () {
173
246
  }, {
174
247
  key: "_redirect",
175
248
  value: function _redirect(data) {
176
- var _this = this;
249
+ var _this2 = this;
177
250
  return new Promise(function (resolve, reject) {
178
- var isWeb = _this.options.env.terminalType === terminalTypeEnum.WEB;
251
+ var isWeb = _this2.options.env.terminalType === terminalTypeEnum.WEB;
179
252
  var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
180
253
  var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
181
254
  var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
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); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
@@ -1,4 +1,4 @@
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); }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
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
3
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
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); }
@@ -9,7 +9,7 @@ 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";
12
+ import { marmotMap, sdkVersion } from "../../config/index";
13
13
  import { componentSignEnum } from "../../types";
14
14
  import { getViewPort, queryParse, serialize } from "../../util/index";
15
15
  var getAppVersion = function getAppVersion(_extendInfo) {
@@ -46,7 +46,7 @@ export var getAppPath = function getAppPath() {
46
46
  if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
47
47
  return urlTestHost;
48
48
  }
49
- return "".concat(marmptMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
49
+ return "".concat(marmotMap[environment], "/").concat(componentSign, "/").concat(finalProductSceneVersion, "/index.").concat(finalAppVersion, ".html");
50
50
  };
51
51
  export var getAppDomain = function getAppDomain(domainParams) {
52
52
  var environment = domainParams.environment,
@@ -72,7 +72,7 @@ export var hideRetentionPopup = function hideRetentionPopup() {
72
72
  retentionPopup.classList.add("".concat(COMPONENT_RETENTION_ID, "-hidden"));
73
73
  setTimeout(function () {
74
74
  retentionPopup.classList.remove("".concat(COMPONENT_RETENTION_ID, "-hidden"));
75
- container === null || container === void 0 ? void 0 : container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-opacity"));
75
+ container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-opacity"));
76
76
  }, ANIMATION_TIME);
77
77
  }
78
78
  };
@@ -87,7 +87,7 @@ export var removeRetentionPopup = function removeRetentionPopup(platform, remain
87
87
  if (leaveBtn) {
88
88
  leaveBtn.removeEventListener(clickEventName, leaveBtnFunc);
89
89
  }
90
- (_document$getElementB = document.getElementById(COMPONENT_RETENTION_ID)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
90
+ (_document$getElementB = document.getElementById(COMPONENT_RETENTION_ID)) === null || _document$getElementB === void 0 || _document$getElementB.remove();
91
91
  };
92
92
  export var createMockup = function createMockup() {
93
93
  var body = document.getElementsByTagName('body')[0];
@@ -106,12 +106,12 @@ export var createMockup = function createMockup() {
106
106
  };
107
107
  export var addPopupLoading = function addPopupLoading() {
108
108
  var loading = document.createElement('div');
109
- loading === null || loading === void 0 ? void 0 : loading.classList.add(LOADING_ID);
109
+ loading === null || loading === void 0 || loading.classList.add(LOADING_ID);
110
110
  loading.id = LOADING_ID;
111
111
  loading.innerHTML = '<div class="line"><div></div><div></div><div></div><div></div></div>';
112
112
  loading.style.fontSize = "".concat(getDesignFontSize(), "px");
113
113
  var body = document.getElementsByTagName('body')[0];
114
- body === null || body === void 0 ? void 0 : body.appendChild(loading);
114
+ body === null || body === void 0 || body.appendChild(loading);
115
115
  };
116
116
 
117
117
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -123,40 +123,40 @@ export var handleDeclareInfo = function handleDeclareInfo(_ref) {
123
123
  var retentionTitle = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-title"));
124
124
  if (retentionTitle) {
125
125
  var _closeDialogData$titl, _closeDialogData$titl2, _closeDialogData$titl3;
126
- retentionTitle.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl = closeDialogData.title) === null || _closeDialogData$titl === void 0 ? void 0 : _closeDialogData$titl.fontSize, "px");
127
- retentionTitle.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl2 = closeDialogData.title) === null || _closeDialogData$titl2 === void 0 ? void 0 : _closeDialogData$titl2.fontColor;
128
- retentionTitle.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$titl3 = closeDialogData.title) === null || _closeDialogData$titl3 === void 0 ? void 0 : _closeDialogData$titl3.text;
126
+ retentionTitle.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl = closeDialogData.title) === null || _closeDialogData$titl === void 0 ? void 0 : _closeDialogData$titl.fontSize, "px");
127
+ retentionTitle.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl2 = closeDialogData.title) === null || _closeDialogData$titl2 === void 0 ? void 0 : _closeDialogData$titl2.fontColor;
128
+ retentionTitle.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$titl3 = closeDialogData.title) === null || _closeDialogData$titl3 === void 0 ? void 0 : _closeDialogData$titl3.text;
129
129
  }
130
130
  var retentionMessage = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-sub-title"));
131
131
  if (retentionMessage) {
132
132
  var _closeDialogData$mess, _closeDialogData$mess2, _closeDialogData$mess3;
133
- retentionMessage.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess = closeDialogData.message) === null || _closeDialogData$mess === void 0 ? void 0 : _closeDialogData$mess.fontSize, "px");
134
- retentionMessage.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess2 = closeDialogData.message) === null || _closeDialogData$mess2 === void 0 ? void 0 : _closeDialogData$mess2.fontColor;
135
- retentionMessage.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$mess3 = closeDialogData.message) === null || _closeDialogData$mess3 === void 0 ? void 0 : _closeDialogData$mess3.text;
133
+ retentionMessage.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess = closeDialogData.message) === null || _closeDialogData$mess === void 0 ? void 0 : _closeDialogData$mess.fontSize, "px");
134
+ retentionMessage.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess2 = closeDialogData.message) === null || _closeDialogData$mess2 === void 0 ? void 0 : _closeDialogData$mess2.fontColor;
135
+ retentionMessage.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$mess3 = closeDialogData.message) === null || _closeDialogData$mess3 === void 0 ? void 0 : _closeDialogData$mess3.text;
136
136
  }
137
137
  var remainBtn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-remain"));
138
138
  if (remainBtn) {
139
139
  var _closeDialogData$btnO, _closeDialogData$btnO2, _closeDialogData$btnO3, _closeDialogData$btnO4, _closeDialogData$btnO5, _closeDialogData$btnO7;
140
- remainBtn.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO = closeDialogData.btnOK) === null || _closeDialogData$btnO === void 0 ? void 0 : _closeDialogData$btnO.text;
141
- remainBtn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO2 = closeDialogData.btnOK) === null || _closeDialogData$btnO2 === void 0 ? void 0 : _closeDialogData$btnO2.fontSize, "px");
142
- remainBtn.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO3 = closeDialogData.btnOK) === null || _closeDialogData$btnO3 === void 0 ? void 0 : _closeDialogData$btnO3.fontColor;
143
- remainBtn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO4 = closeDialogData.btnOK) === null || _closeDialogData$btnO4 === void 0 ? void 0 : _closeDialogData$btnO4.corner, "px");
144
- if ((closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO5 = closeDialogData.btnOK) === null || _closeDialogData$btnO5 === void 0 ? void 0 : _closeDialogData$btnO5.type) === 'stroke') {
140
+ remainBtn.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO = closeDialogData.btnOK) === null || _closeDialogData$btnO === void 0 ? void 0 : _closeDialogData$btnO.text;
141
+ remainBtn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO2 = closeDialogData.btnOK) === null || _closeDialogData$btnO2 === void 0 ? void 0 : _closeDialogData$btnO2.fontSize, "px");
142
+ remainBtn.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO3 = closeDialogData.btnOK) === null || _closeDialogData$btnO3 === void 0 ? void 0 : _closeDialogData$btnO3.fontColor;
143
+ remainBtn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO4 = closeDialogData.btnOK) === null || _closeDialogData$btnO4 === void 0 ? void 0 : _closeDialogData$btnO4.corner, "px");
144
+ if ((closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO5 = closeDialogData.btnOK) === null || _closeDialogData$btnO5 === void 0 ? void 0 : _closeDialogData$btnO5.type) === 'stroke') {
145
145
  var _closeDialogData$btnO6;
146
- remainBtn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO6 = closeDialogData.btnOK) === null || _closeDialogData$btnO6 === void 0 ? void 0 : _closeDialogData$btnO6.bg);
147
- } else remainBtn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnO7 = closeDialogData.btnOK) === null || _closeDialogData$btnO7 === void 0 ? void 0 : _closeDialogData$btnO7.bg;
146
+ remainBtn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO6 = closeDialogData.btnOK) === null || _closeDialogData$btnO6 === void 0 ? void 0 : _closeDialogData$btnO6.bg);
147
+ } else remainBtn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnO7 = closeDialogData.btnOK) === null || _closeDialogData$btnO7 === void 0 ? void 0 : _closeDialogData$btnO7.bg;
148
148
  }
149
149
  var leaveBrn = document.getElementById("".concat(COMPONENT_RETENTION_ID, "-leave"));
150
150
  if (leaveBrn) {
151
151
  var _closeDialogData$btnC, _closeDialogData$btnC2, _closeDialogData$btnC3, _closeDialogData$btnC4, _closeDialogData$btnC5, _closeDialogData$btnC7;
152
- leaveBrn.innerHTML = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC = closeDialogData.btnCancel) === null || _closeDialogData$btnC === void 0 ? void 0 : _closeDialogData$btnC.text;
153
- leaveBrn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC2 = closeDialogData.btnCancel) === null || _closeDialogData$btnC2 === void 0 ? void 0 : _closeDialogData$btnC2.fontSize, "px");
154
- leaveBrn.style.color = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC3 = closeDialogData.btnCancel) === null || _closeDialogData$btnC3 === void 0 ? void 0 : _closeDialogData$btnC3.fontColor;
155
- leaveBrn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC4 = closeDialogData.btnCancel) === null || _closeDialogData$btnC4 === void 0 ? void 0 : _closeDialogData$btnC4.corner, "px");
156
- if ((closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC5 = closeDialogData.btnCancel) === null || _closeDialogData$btnC5 === void 0 ? void 0 : _closeDialogData$btnC5.type) === 'stroke') {
152
+ leaveBrn.innerHTML = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC = closeDialogData.btnCancel) === null || _closeDialogData$btnC === void 0 ? void 0 : _closeDialogData$btnC.text;
153
+ leaveBrn.style.fontSize = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC2 = closeDialogData.btnCancel) === null || _closeDialogData$btnC2 === void 0 ? void 0 : _closeDialogData$btnC2.fontSize, "px");
154
+ leaveBrn.style.color = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC3 = closeDialogData.btnCancel) === null || _closeDialogData$btnC3 === void 0 ? void 0 : _closeDialogData$btnC3.fontColor;
155
+ leaveBrn.style.borderRadius = "".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC4 = closeDialogData.btnCancel) === null || _closeDialogData$btnC4 === void 0 ? void 0 : _closeDialogData$btnC4.corner, "px");
156
+ if ((closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC5 = closeDialogData.btnCancel) === null || _closeDialogData$btnC5 === void 0 ? void 0 : _closeDialogData$btnC5.type) === 'stroke') {
157
157
  var _closeDialogData$btnC6;
158
- leaveBrn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC6 = closeDialogData.btnCancel) === null || _closeDialogData$btnC6 === void 0 ? void 0 : _closeDialogData$btnC6.bg);
159
- } else leaveBrn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 ? void 0 : (_closeDialogData$btnC7 = closeDialogData.btnCancel) === null || _closeDialogData$btnC7 === void 0 ? void 0 : _closeDialogData$btnC7.bg;
158
+ leaveBrn.style.border = "1px solid ".concat(closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC6 = closeDialogData.btnCancel) === null || _closeDialogData$btnC6 === void 0 ? void 0 : _closeDialogData$btnC6.bg);
159
+ } else leaveBrn.style.backgroundColor = closeDialogData === null || closeDialogData === void 0 || (_closeDialogData$btnC7 = closeDialogData.btnCancel) === null || _closeDialogData$btnC7 === void 0 ? void 0 : _closeDialogData$btnC7.bg;
160
160
  }
161
161
  }
162
162
  } catch (error) {
@@ -9,6 +9,8 @@ export default class ComponentApp {
9
9
  _performanceData: any[];
10
10
  _loadAppPromiseResolve: ((value: boolean) => void) | null;
11
11
  _isInitComponent: boolean;
12
+ private _threedData?;
13
+ private popupWindow?;
12
14
  private appDomain;
13
15
  private createIframeNode;
14
16
  private _selector;
@@ -28,11 +30,14 @@ export default class ComponentApp {
28
30
  * @description When SDK registers plug-ins, it is a required function to receive SDK instances
29
31
  */
30
32
  applyPlugin(AMSSDK: AMSCheckout): void;
33
+ private initLoggerMeta;
31
34
  /**
32
35
  * @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
33
36
  */
34
37
  setRender(renderFunc: IrenderFuncParams): void;
35
- initAPSecurity(): void;
38
+ private initAPSecurity;
39
+ private logDeviceId;
40
+ private getDeviceIdAndLog;
36
41
  /**
37
42
  * @description render iframe content
38
43
  */
@@ -51,6 +56,8 @@ export default class ComponentApp {
51
56
  private createApp;
52
57
  private listener;
53
58
  private resizeListener;
59
+ private createPopupWindow;
60
+ private getDeviceIdAndCallback;
54
61
  /**
55
62
  * @description Initialize subscription iframe message
56
63
  */
@@ -73,7 +80,7 @@ export default class ComponentApp {
73
80
  */
74
81
  dispatchToApp(payload: {
75
82
  context: eventPayloadContext;
76
- }): any;
83
+ }, targetElement?: any): any;
77
84
  /**
78
85
  * @description Subscribe to messages from SDK
79
86
  */