@alipay/ams-checkout 0.0.1751510477-dev.0 → 0.0.1752029048-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,10 @@ export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void;
2
2
  export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void;
3
3
  export declare const removePopupLoading: (isShowMockup?: boolean) => void;
4
4
  export declare const insertStyleSheet: () => void;
5
- export declare function createCloseIcon(onClose: () => void): HTMLDivElement;
6
- export declare const createModal: ({ device, url, widthPadding, loadingConfig, showCloseOnLoading, onCloseOnLoading }: {
5
+ export declare const createModal: ({ device, url, widthPadding, loadingConfig }: {
7
6
  device: any;
8
7
  url: any;
9
8
  widthPadding: any;
10
9
  loadingConfig: any;
11
- showCloseOnLoading: any;
12
- onCloseOnLoading: any;
13
10
  }) => Promise<HTMLIFrameElement>;
14
11
  export declare const destroyModal: () => void;
@@ -47,27 +47,6 @@ export var insertStyleSheet = function insertStyleSheet() {
47
47
  style.innerHTML = modalStyles;
48
48
  document.head.appendChild(style);
49
49
  };
50
- export function createCloseIcon(onClose) {
51
- var closeIcon = document.createElement('div');
52
- closeIcon.style.position = 'absolute';
53
- closeIcon.style.right = '16px';
54
- closeIcon.style.top = '23px';
55
- closeIcon.style.cursor = 'pointer';
56
- var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
57
- svg.setAttribute('width', '16');
58
- svg.setAttribute('height', '16');
59
- svg.setAttribute('viewBox', '0 0 16 16');
60
- svg.setAttribute('fill', 'none');
61
- var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
62
- path.setAttribute('fill-rule', 'evenodd');
63
- path.setAttribute('clip-rule', 'evenodd');
64
- path.setAttribute('d', 'M13.0449 2.99894L12.9494 2.91165L12.8685 2.85222L12.7802 2.7996C12.3611 2.57499 11.8556 2.64328 11.5228 2.9763L7.99909 6.50088L4.48854 2.99028L4.44701 2.95034C4.0098 2.57169 3.38048 2.57202 2.99838 2.9525L2.92363 3.03297L2.85175 3.12897L2.79916 3.21735C2.57471 3.63642 2.64292 4.14198 2.9757 4.47491L6.50186 8.00046L2.95226 11.5518C2.57141 11.9917 2.57173 12.6211 2.95197 13.0033L3.0324 13.078L3.12837 13.15L3.21674 13.2026C3.63573 13.4272 4.14123 13.3589 4.47407 13.0259L7.99909 9.49935L11.5474 13.0494C11.9944 13.4368 12.6238 13.4235 13.0212 13.0259L13.0922 12.9471L13.1559 12.8595C13.4298 12.4403 13.3789 11.8852 13.0211 11.5272L9.497 8.00115L13.0052 4.4915L13.07 4.4225C13.4304 4.00477 13.4199 3.37582 13.0449 2.99894Z');
65
- path.setAttribute('fill', '#ABB9CC');
66
- svg.appendChild(path);
67
- closeIcon.appendChild(svg);
68
- closeIcon.onclick = onClose;
69
- return closeIcon;
70
- }
71
50
  var modalDevice = 'desktop';
72
51
  // 插入弹窗
73
52
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -75,9 +54,7 @@ export var createModal = function createModal(_ref) {
75
54
  var device = _ref.device,
76
55
  url = _ref.url,
77
56
  widthPadding = _ref.widthPadding,
78
- loadingConfig = _ref.loadingConfig,
79
- showCloseOnLoading = _ref.showCloseOnLoading,
80
- onCloseOnLoading = _ref.onCloseOnLoading;
57
+ loadingConfig = _ref.loadingConfig;
81
58
  return new Promise(function (resolve, reject) {
82
59
  try {
83
60
  modalDevice = device;
@@ -110,15 +87,6 @@ export var createModal = function createModal(_ref) {
110
87
  modal.style.backgroundColor = backgroundPrimary;
111
88
  iframe.style.backgroundColor = backgroundPrimary;
112
89
  }
113
-
114
- // 弹窗渲染loading时关闭按钮逻辑
115
- if (showCloseOnLoading) {
116
- var closeIcon = createCloseIcon(onCloseOnLoading);
117
- modal.appendChild(closeIcon);
118
- iframe.addEventListener('load', function () {
119
- modal.removeChild(closeIcon);
120
- });
121
- }
122
90
  modal.appendChild(iframe);
123
91
  var body = document.getElementsByTagName('body')[0];
124
92
  body.appendChild(overlay);
@@ -238,13 +238,6 @@ export declare const EVENT: {
238
238
  inputFocus: {
239
239
  name: string;
240
240
  };
241
- /**
242
- * 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
243
- * TODO 推荐使用BusManager
244
- */
245
- messageForward: {
246
- name: string;
247
- };
248
241
  };
249
242
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
250
243
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -239,13 +239,6 @@ export var EVENT = {
239
239
  },
240
240
  inputFocus: {
241
241
  name: 'onInputFocus'
242
- },
243
- /**
244
- * 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
245
- * TODO 推荐使用BusManager
246
- */
247
- messageForward: {
248
- name: 'onMessageForward'
249
242
  }
250
243
  };
251
244
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -20,19 +20,19 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
20
20
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
21
21
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
22
  import { cleanMockup, removeRetentionPopup } from "../../../../component/component.popup.style";
23
- import { destroyModal } from "../../../../component/popupWindow.style";
24
23
  import { ERRORMESSAGE, EVENT } from "../../../../constant";
25
24
  import AddressProcessor from "../../../../core/component/element/elementProcessor/addressProcessor";
26
25
  import AuthProcessor from "../../../../core/component/element/elementProcessor/authProcessor";
27
26
  import PaymentProcessor from "../../../../core/component/element/elementProcessor/paymentProcessor";
28
27
  import { IElementStatus } from "../../../../foundation";
29
28
  import { AntomSDKCore } from "../../../../foundation/core";
29
+ import { destroyModal } from "../../../../component/popupWindow.style";
30
30
  import { ElementProcessor } from "../../../../foundation/product-processor/element";
31
31
  import { ProductSceneEnum } from "../../../../types";
32
32
  import { ElementContainerService } from "../elementContainerService"; // 引入 ElementContainerService
33
33
  import { IContainerStatus } from "../elementContainerService/containerService";
34
34
  import { oneAccountUpdate, sdkActionUpdate } from "../mock";
35
- import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, MountElementType } from "../type";
35
+ import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode } from "../type";
36
36
  import { checkCanMount, checkCanUpdate, handleRedirect, showToast } from "../util";
37
37
  var TIMEOUT_DURATION = 10000;
38
38
  var ElementController = /*#__PURE__*/function () {
@@ -100,14 +100,10 @@ var ElementController = /*#__PURE__*/function () {
100
100
  value: function onEventCallback(_ref) {
101
101
  var _this$options, _this$options$onEvent;
102
102
  var code = _ref.code,
103
- _ref$message = _ref.message,
104
- message = _ref$message === void 0 ? '' : _ref$message,
105
- _ref$result = _ref.result,
106
- result = _ref$result === void 0 ? undefined : _ref$result;
103
+ message = _ref.message;
107
104
  this === null || this === void 0 || (_this$options = this.options) === null || _this$options === void 0 || (_this$options$onEvent = _this$options.onEventCallback) === null || _this$options$onEvent === void 0 || _this$options$onEvent.call(_this$options, {
108
105
  code: code,
109
- message: message,
110
- result: result
106
+ message: message
111
107
  });
112
108
  }
113
109
  }, {
@@ -282,9 +278,11 @@ var ElementController = /*#__PURE__*/function () {
282
278
  key: "addEventListener",
283
279
  value: function addEventListener(renderCallback) {
284
280
  var _this4 = this;
285
- this.serviceMap.EventCenter.listen(ElementPaymentEvent.ON_EVENT_CALLBACK, function (data) {
286
- var _this4$onEventCallbac;
287
- (_this4$onEventCallbac = _this4.onEventCallback) === null || _this4$onEventCallbac === void 0 || _this4$onEventCallbac.call(_this4, data);
281
+ this.serviceMap.EventCenter.listen(ElementPaymentEvent.CALLBACK, function (data) {
282
+ if (_this4.elementProcessors[data.source] && _this4.elementProcessors[data.source].eventListener[data.event]) {
283
+ var _this4$elementProcess, _this4$elementProcess2;
284
+ (_this4$elementProcess = (_this4$elementProcess2 = _this4.elementProcessors[data.source].eventListener)[data.event]) === null || _this4$elementProcess === void 0 || _this4$elementProcess.call(_this4$elementProcess2, data.data);
285
+ }
288
286
  });
289
287
  this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
290
288
  clearTimeout(_this4.initTimeout);
@@ -325,15 +323,9 @@ var ElementController = /*#__PURE__*/function () {
325
323
  this.serviceMap.EventCenter.listen(EVENT.showToast.name, function (data) {
326
324
  showToast(data);
327
325
  });
328
- this.serviceMap.EventCenter.listen(EVENT.messageForward.name, function (data) {
329
- var source = MountElementType[data.source];
330
- var target = MountElementType[data.target];
331
- if (_this4.elementProcessors[source] && _this4.elementProcessors[target]) {
332
- _this4.elementProcessors[target].eventCenter.dispatchToApp({
333
- event: data.event,
334
- data: data
335
- });
336
- }
326
+ this.serviceMap.EventCenter.listen(ElementPaymentEvent.SEND_MUITI_APP_EVENT_TO_SDK, function (result) {
327
+ var _this4$options$onEven, _this4$options;
328
+ (_this4$options$onEven = (_this4$options = _this4.options).onEventCallback) === null || _this4$options$onEven === void 0 || _this4$options$onEven.call(_this4$options, result.data);
337
329
  });
338
330
  }
339
331
  }, {
@@ -370,11 +362,11 @@ var ElementController = /*#__PURE__*/function () {
370
362
  var paymentSessionObj = paymentContext.paymentSessionObj;
371
363
  var isConnect = paymentSessionObj.connectFactor.enableConnect && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
372
364
  if (!(paymentResult !== null && paymentResult !== void 0 && (_paymentResult$origin = paymentResult.originActionQueryResult) !== null && _paymentResult$origin !== void 0 && _paymentResult$origin.success) && isConnect) {
373
- var _this$onEventCallback;
365
+ var _this$options$onEvent2, _this$options2;
374
366
  clearTimeout(this.initTimeout);
375
367
  this.changeLoading(false);
376
368
  this.initTimeout = null;
377
- (_this$onEventCallback = this.onEventCallback) === null || _this$onEventCallback === void 0 || _this$onEventCallback.call(this, {
369
+ (_this$options$onEvent2 = (_this$options2 = this.options).onEventCallback) === null || _this$options$onEvent2 === void 0 || _this$options$onEvent2.call(_this$options2, {
378
370
  code: EventCallbackCode.SDK_CREATE_COMPONENT_ERROR,
379
371
  message: 'Component initialization exception.'
380
372
  });
@@ -2,9 +2,6 @@ import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IMerchantAppointPar
2
2
  import AddressProcessor from './elementProcessor/addressProcessor';
3
3
  import AuthProcessor from './elementProcessor/authProcessor';
4
4
  import PaymentProcessor from './elementProcessor/paymentProcessor';
5
- /**
6
- * element 消息事件名
7
- */
8
5
  export declare enum ElementPaymentEvent {
9
6
  RENDER_COMPONENT = "renderComponent",
10
7
  CAPTURE_ASSET = "onCaptureAsset",
@@ -21,8 +18,7 @@ export declare enum ElementPaymentEvent {
21
18
  */
22
19
  SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
23
20
  LOG = "log",
24
- HANDLE_PAYMENT = "handlePayment",
25
- ON_EVENT_CALLBACK = "onEventCallback"
21
+ HANDLE_PAYMENT = "handlePayment"
26
22
  }
27
23
  export declare enum ElementPaymentMethod {
28
24
  CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
@@ -30,19 +26,6 @@ export declare enum ElementPaymentMethod {
30
26
  ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
31
27
  PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
32
28
  }
33
- export declare enum ElementType {
34
- auth = "auth",
35
- address = "address",
36
- payment = "payment"
37
- }
38
- export declare const MountElementType: {
39
- auth: ElementPaymentMethod;
40
- address: ElementPaymentMethod;
41
- payment: ElementPaymentMethod;
42
- AUTH_ELEMENT: ElementType;
43
- ADDRESS_ELEMENT: ElementType;
44
- PAYMENT_ELEMENT: ElementType;
45
- };
46
29
  export declare enum ThemeType {
47
30
  NostalgicGray = "nostalgicGray",
48
31
  Default = "default",
@@ -51,22 +34,27 @@ export declare enum ThemeType {
51
34
  GamingPurple = "gamingPurple",
52
35
  AgateGreen = "agateGreen"
53
36
  }
37
+ export declare enum ElementType {
38
+ auth = "auth",
39
+ address = "address",
40
+ payment = "payment"
41
+ }
54
42
  export declare enum PaymentElementLayout {
55
43
  Tabs = "tabs",
56
44
  Accordion = "Accordion"
57
45
  }
46
+ export declare enum MountElementType {
47
+ auth = "AUTH_ELEMENT",
48
+ address = "ADDRESS_ELEMENT",
49
+ payment = "PAYMENT_ELEMENT"
50
+ }
58
51
  export declare const addressTheme: {
59
52
  default: string;
60
53
  night: string;
61
54
  };
62
55
  export declare enum EventCallbackCode {
63
56
  SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
64
- SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
65
- SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
66
- SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
67
- SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
68
- SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
69
- SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
57
+ SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR"
70
58
  }
71
59
  export declare enum ELEMENT_ENVIRONMENT {
72
60
  DEV = "DEV",
@@ -175,14 +163,12 @@ export interface LinkAuthMountResult extends BaseMountResult {
175
163
  }
176
164
  export interface PaymentMountResult extends BaseMountResult {
177
165
  }
178
- /**
179
- * connect element之间通信的类型格式
180
- */
181
- export interface ConnectElementMessageDataType<T = {}> {
166
+ export interface EventCallbackData<T = {}> {
182
167
  source?: ElementPaymentMethod;
183
168
  target?: ElementPaymentMethod;
169
+ success?: boolean;
184
170
  data?: T;
185
- event?: ElementPaymentEvent;
171
+ event?: AddressEventCallbackName;
186
172
  }
187
173
  export interface ValidateResult<T = {}> {
188
174
  success: boolean;
@@ -2,9 +2,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
4
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
- /**
6
- * element 消息事件名
7
- */
8
5
  export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
9
6
  ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
10
7
  ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
@@ -19,7 +16,6 @@ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
19
16
  ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
20
17
  ElementPaymentEvent["LOG"] = "log";
21
18
  ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
22
- ElementPaymentEvent["ON_EVENT_CALLBACK"] = "onEventCallback";
23
19
  return ElementPaymentEvent;
24
20
  }({});
25
21
  export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
@@ -29,13 +25,6 @@ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
29
25
  ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
30
26
  return ElementPaymentMethod;
31
27
  }({});
32
- export var ElementType = /*#__PURE__*/function (ElementType) {
33
- ElementType["auth"] = "auth";
34
- ElementType["address"] = "address";
35
- ElementType["payment"] = "payment";
36
- return ElementType;
37
- }({});
38
- export var MountElementType = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT), ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT), ElementType.payment, ElementPaymentMethod.PAYMENT_ELEMENT), ElementPaymentMethod.AUTH_ELEMENT, ElementType.auth), ElementPaymentMethod.ADDRESS_ELEMENT, ElementType.address), ElementPaymentMethod.PAYMENT_ELEMENT, ElementType.payment);
39
28
  export var ThemeType = /*#__PURE__*/function (ThemeType) {
40
29
  ThemeType["NostalgicGray"] = "nostalgicGray";
41
30
  ThemeType["Default"] = "default";
@@ -45,20 +34,27 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
45
34
  ThemeType["AgateGreen"] = "agateGreen";
46
35
  return ThemeType;
47
36
  }({});
37
+ export var ElementType = /*#__PURE__*/function (ElementType) {
38
+ ElementType["auth"] = "auth";
39
+ ElementType["address"] = "address";
40
+ ElementType["payment"] = "payment";
41
+ return ElementType;
42
+ }({});
48
43
  export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
49
44
  PaymentElementLayout["Tabs"] = "tabs";
50
45
  PaymentElementLayout["Accordion"] = "Accordion";
51
46
  return PaymentElementLayout;
52
47
  }({});
48
+ export var MountElementType = /*#__PURE__*/function (MountElementType) {
49
+ MountElementType["auth"] = "AUTH_ELEMENT";
50
+ MountElementType["address"] = "ADDRESS_ELEMENT";
51
+ MountElementType["payment"] = "PAYMENT_ELEMENT";
52
+ return MountElementType;
53
+ }({});
53
54
  export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
54
55
  export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
55
56
  EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
56
57
  EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
57
- EventCallbackCode["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
58
- EventCallbackCode["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
59
- EventCallbackCode["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
60
- EventCallbackCode["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
61
- EventCallbackCode["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
62
58
  return EventCallbackCode;
63
59
  }({});
64
60
  export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
@@ -77,10 +73,6 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
77
73
  return AddressEventCallbackName;
78
74
  }({});
79
75
 
80
- /**
81
- * connect element之间通信的类型格式
82
- */
83
-
84
76
  // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
85
77
  var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
86
78
  AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
@@ -35,7 +35,5 @@ export declare class ContainerService implements Service {
35
35
  private changeCloseBtnVisibility;
36
36
  private handleMaskCloseBtnShow;
37
37
  private handleCloseButtonTheme;
38
- private handlePopupWindow;
39
- private handlePopWindow;
40
38
  getWebApp(): HTMLIFrameElement;
41
39
  }
@@ -195,7 +195,19 @@ export var ContainerService = /*#__PURE__*/function () {
195
195
  });
196
196
  });
197
197
  this.eventCenter.listen(EVENT.popupWindow.name, function (data) {
198
- _this.handlePopupWindow(data);
198
+ var _this$displayInfo2;
199
+ if (data.paymentElementOldModel) return;
200
+ insertStyleSheet();
201
+ _this.popupManager.popup(_objectSpread({
202
+ platform: (_this$displayInfo2 = _this.displayInfo) === null || _this$displayInfo2 === void 0 ? void 0 : _this$displayInfo2.platform
203
+ }, data)).then(function () {
204
+ _this.eventCenter.addIFrame(_this.popupManager.popupApp);
205
+ }).catch(function (error) {
206
+ _this.logService.logError({
207
+ title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
208
+ }, error);
209
+ _this.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
210
+ });
199
211
  });
200
212
  this.eventCenter.listen(EVENT.popWindow.name, function () {
201
213
  _this.popupManager.pop();
@@ -254,9 +266,9 @@ export var ContainerService = /*#__PURE__*/function () {
254
266
  }, {
255
267
  key: "handleSizeChanged",
256
268
  value: function handleSizeChanged(data) {
257
- var _this$displayInfo2 = this.displayInfo,
258
- appendAliasContainerId = _this$displayInfo2.appendAliasContainerId,
259
- selector = _this$displayInfo2.selector;
269
+ var _this$displayInfo3 = this.displayInfo,
270
+ appendAliasContainerId = _this$displayInfo3.appendAliasContainerId,
271
+ selector = _this$displayInfo3.selector;
260
272
  var cashierId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat((selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1)) : COMPONENT_CONTAINER_ID;
261
273
  if (!this.webApp || !this.displayInfo) {
262
274
  return;
@@ -317,9 +329,9 @@ export var ContainerService = /*#__PURE__*/function () {
317
329
  key: "focusScrollFixed",
318
330
  value: function focusScrollFixed(focus) {
319
331
  // 获取iframe dom元素
320
- var _this$displayInfo3 = this.displayInfo,
321
- appendAliasContainerId = _this$displayInfo3.appendAliasContainerId,
322
- selector = _this$displayInfo3.selector;
332
+ var _this$displayInfo4 = this.displayInfo,
333
+ appendAliasContainerId = _this$displayInfo4.appendAliasContainerId,
334
+ selector = _this$displayInfo4.selector;
323
335
  var cashierId = appendAliasContainerId ? "".concat(COMPONENT_CONTAINER_ID, "-").concat((selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1)) : COMPONENT_CONTAINER_ID;
324
336
  if (!this.webApp || !this.displayInfo) {
325
337
  return;
@@ -410,41 +422,6 @@ export var ContainerService = /*#__PURE__*/function () {
410
422
  maskCloseBlock === null || maskCloseBlock === void 0 || maskCloseBlock.classList.remove("".concat(COMPONENT_CLOSE_MASK_BLOCK_ID, "-light"));
411
423
  }
412
424
  }
413
-
414
- // SDK主动打开弹框
415
- }, {
416
- key: "handlePopupWindow",
417
- value: function handlePopupWindow(data) {
418
- var _this$displayInfo4,
419
- _this3 = this;
420
- if (data.paymentElementOldModel) return;
421
- insertStyleSheet();
422
- this.popupManager.popup(_objectSpread({
423
- platform: (_this$displayInfo4 = this.displayInfo) === null || _this$displayInfo4 === void 0 ? void 0 : _this$displayInfo4.platform,
424
- showCloseOnLoading: data.showCloseOnLoading,
425
- onCloseOnLoading: function onCloseOnLoading() {
426
- return _this3.handlePopWindow(data);
427
- }
428
- }, data)).then(function () {
429
- _this3.eventCenter.addIFrame(_this3.popupManager.popupApp);
430
- }).catch(function (error) {
431
- _this3.logService.logError({
432
- title: (error === null || error === void 0 ? void 0 : error.title) || 'sdk_error_create_pop_up'
433
- }, error);
434
- _this3.eventCenter.emit(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
435
- });
436
- }
437
-
438
- // SDK主动关闭弹框
439
- }, {
440
- key: "handlePopWindow",
441
- value: function handlePopWindow(data) {
442
- this.popupManager.pop();
443
- this.eventCenter.dispatchToApp({
444
- event: EVENT.popWindow.name,
445
- data: data
446
- });
447
- }
448
425
  }, {
449
426
  key: "getWebApp",
450
427
  value: function getWebApp() {
@@ -1,12 +1,4 @@
1
1
  import { PlatformEnum } from '../../../types';
2
- export type IPopUpParams = {
3
- url: string;
4
- widthPadding: number;
5
- heightPadding: number;
6
- platform: PlatformEnum;
7
- showCloseOnLoading: boolean;
8
- onCloseOnLoading: () => void;
9
- };
10
2
  /**
11
3
  * @author 谦彧 <zhangmian.zm@alipay.com>
12
4
  * @date 2024/9/22
@@ -15,6 +7,11 @@ export declare class PopupManager {
15
7
  private popupUrlQuery;
16
8
  popupApp: HTMLIFrameElement;
17
9
  setPopupUrlQuery(queryParams: string): void;
18
- popup(data: IPopUpParams): Promise<void>;
10
+ popup(data: {
11
+ url: string;
12
+ widthPadding: number;
13
+ heightPadding: number;
14
+ platform: PlatformEnum;
15
+ }): Promise<void>;
19
16
  pop(): void;
20
17
  }
@@ -53,9 +53,7 @@ export var PopupManager = /*#__PURE__*/function () {
53
53
  widthPadding: data === null || data === void 0 ? void 0 : data.widthPadding,
54
54
  device: data === null || data === void 0 ? void 0 : data.platform,
55
55
  url: pageUrl,
56
- loadingConfig: undefined,
57
- showCloseOnLoading: data.showCloseOnLoading,
58
- onCloseOnLoading: data.onCloseOnLoading
56
+ loadingConfig: undefined
59
57
  });
60
58
  case 11:
61
59
  this.popupApp = _context.sent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1751510477-dev.0",
3
+ "version": "0.0.1752029048-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",