@alipay/ams-checkout 0.0.1733198624-dev.2 → 0.0.1733711101-dev.1

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.
@@ -19,7 +19,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
19
19
  /* eslint-disable @typescript-eslint/no-explicit-any */
20
20
  import { v4 as uuid } from 'uuid';
21
21
  import { sdkVersion } from "../../config";
22
- import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
22
+ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
23
23
  import { queryPaymentInfo, submitPayInfo } from "../../service";
24
24
  import { ComponentSignEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, DisplayTypeEnum, TargetEnum } from "../../types";
25
25
  import { getType, isJsonString, isPC } from "../../util";
@@ -359,9 +359,11 @@ var ComponentApp = /*#__PURE__*/function () {
359
359
  if (channelBehavior !== null && channelBehavior !== void 0 && channelBehavior.allowClickOutsideClose) {
360
360
  onClickOutside = this.closeBtnFunc.bind(this);
361
361
  }
362
+ var closeBtnFunc = this.closeBtnFunc.bind(this);
362
363
  createMockup({
363
364
  platform: this.platform,
364
- onClickOutside: onClickOutside
365
+ onClickOutside: onClickOutside,
366
+ closeBtnFunc: closeBtnFunc
365
367
  });
366
368
  this.renderPopupLoading(renderParams);
367
369
  }
@@ -1260,6 +1262,10 @@ var ComponentApp = /*#__PURE__*/function () {
1260
1262
  this.handleCloseBtnShow(true);
1261
1263
  return;
1262
1264
  }
1265
+ if (data.context.event === EVENT.setMaskCloseButton.name) {
1266
+ this.handleMaskCloseBtnShow(data.context.data);
1267
+ return;
1268
+ }
1263
1269
  if (data.context.event === EVENT.setAllowRetention.name) {
1264
1270
  if (data.context.data === true) this._isRetention = true;
1265
1271
  if (data.context.data === false) this._isRetention = false;
@@ -1365,6 +1371,21 @@ var ComponentApp = /*#__PURE__*/function () {
1365
1371
  }
1366
1372
  (_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
1367
1373
  }
1374
+ }, {
1375
+ key: "updateMaskCloseBtn",
1376
+ value: function updateMaskCloseBtn(data) {
1377
+ var maskCloseBtn = document.getElementById("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID));
1378
+ if (maskCloseBtn) {
1379
+ if (this.platform === 'desktop') {
1380
+ var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
1381
+ var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
1382
+ maskCloseBtn.style.top = "".concat((windowHeight - data.height) / 2 - 42, "px");
1383
+ maskCloseBtn.style.right = "".concat((windowWidth - data.width) / 2 + 18, "px");
1384
+ } else {
1385
+ maskCloseBtn.style.bottom = "".concat(data.height + 2, "px");
1386
+ }
1387
+ }
1388
+ }
1368
1389
  }, {
1369
1390
  key: "handleSizeChanged",
1370
1391
  value: function handleSizeChanged(data) {
@@ -1409,6 +1430,8 @@ var ComponentApp = /*#__PURE__*/function () {
1409
1430
  }
1410
1431
  // 关闭loading,保留蒙层
1411
1432
  this.dismissLoadingFunc();
1433
+ // 更新弹窗关闭按钮位置
1434
+ this.updateMaskCloseBtn(data.context.data);
1412
1435
  }
1413
1436
  if (this._renderDisplayType === DisplayTypeEnum.inline) {
1414
1437
  var _document$getElementB3;
@@ -1638,6 +1661,16 @@ var ComponentApp = /*#__PURE__*/function () {
1638
1661
  closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
1639
1662
  }
1640
1663
  }
1664
+ }, {
1665
+ key: "handleMaskCloseBtnShow",
1666
+ value: function handleMaskCloseBtnShow(data) {
1667
+ var closeBlock = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID);
1668
+ if ((data === null || data === void 0 ? void 0 : data.status) === 'show') {
1669
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1670
+ } else {
1671
+ closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-hidden"));
1672
+ }
1673
+ }
1641
1674
 
1642
1675
  /**
1643
1676
  * @description Send message to SDK
@@ -1794,9 +1827,11 @@ var ComponentApp = /*#__PURE__*/function () {
1794
1827
  key: "cleanContainer",
1795
1828
  value: function cleanContainer() {
1796
1829
  var _document$getElementB4,
1830
+ _document$getElementB5,
1797
1831
  _this10 = this;
1798
1832
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1799
- (_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1833
+ (_document$getElementB4 = document.getElementById(COMPONENT_CLOSE_MASK_BLOCK_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
1834
+ (_document$getElementB5 = document.getElementById(LOADING_ID)) === null || _document$getElementB5 === void 0 || _document$getElementB5.remove();
1800
1835
  this.hideComponentAnimation();
1801
1836
  var mockup = document.getElementById(MOCKUP_ID);
1802
1837
  mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1733198624-dev.2",
3
+ "version": "0.0.1733711101-dev.1",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",