@alipay/ams-checkout 0.0.1744283958-dev.4 → 0.0.1744283958-dev.5

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.
@@ -28,5 +28,6 @@ export declare class ContainerController {
28
28
  switchContainerStatus(status: IContainerStatus): void;
29
29
  getContainerStatus(): IContainerStatus;
30
30
  getEventService(): EventCenter;
31
+ destroy(): void;
31
32
  getContainerService(): ContainerService;
32
33
  }
@@ -103,6 +103,12 @@ export var ContainerController = /*#__PURE__*/function () {
103
103
  value: function getEventService() {
104
104
  return this.eventService;
105
105
  }
106
+ }, {
107
+ key: "destroy",
108
+ value: function destroy() {
109
+ this.eventService.destroy();
110
+ this.containerElement.remove();
111
+ }
106
112
  }, {
107
113
  key: "getContainerService",
108
114
  value: function getContainerService() {
@@ -33,6 +33,9 @@ export var ElementContainerService = /*#__PURE__*/function () {
33
33
  }, {
34
34
  key: "destroy",
35
35
  value: function destroy() {
36
+ this.containerServices.forEach(function (value) {
37
+ value.destroy();
38
+ });
36
39
  this.containerServices = new Map();
37
40
  }
38
41
  }, {
@@ -19,6 +19,7 @@ declare class ElementController {
19
19
  private sendRequestAndWaitWebLaunch;
20
20
  private sendReady;
21
21
  updatePayment(paymentSessionData: any): Promise<unknown>;
22
+ private destroyHandle;
22
23
  destroy(): void;
23
24
  }
24
25
  export default ElementController;
@@ -164,9 +164,9 @@ var ElementController = /*#__PURE__*/function () {
164
164
  function readyCallback(payload) {
165
165
  var _this2 = this;
166
166
  var resultData = _objectSpread({
167
- getValue: this.elementProcessors[renderOptions.type].getValue.bind(this.elementProcessors[renderOptions.type]),
167
+ getValue: this === null || this === void 0 ? void 0 : this.elementProcessors[renderOptions.type].getValue.bind(this === null || this === void 0 ? void 0 : this.elementProcessors[renderOptions.type]),
168
168
  on: function on(event, callback) {
169
- _this2.elementProcessors[renderOptions.type].registerEventListener(event, callback);
169
+ _this2 === null || _this2 === void 0 || _this2.elementProcessors[renderOptions.type].registerEventListener(event, callback);
170
170
  }
171
171
  }, payload);
172
172
  resolve(resultData);
@@ -297,6 +297,10 @@ var ElementController = /*#__PURE__*/function () {
297
297
  this.serviceMap.EventCenter.listen(EVENT.redirect.name, function (data) {
298
298
  handleRedirect(data);
299
299
  });
300
+ this.serviceMap.EventCenter.listen(EVENT.destroy.name, function () {
301
+ _this4.elementContainer.setStatus(IContainerStatus.READY);
302
+ _this4.destroyHandle();
303
+ });
300
304
  this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
301
305
  if (_this4.elementContainerService.getContainerService(data.source)) {
302
306
  renderCallback({
@@ -418,17 +422,21 @@ var ElementController = /*#__PURE__*/function () {
418
422
  return updatePayment;
419
423
  }()
420
424
  }, {
421
- key: "destroy",
422
- value: function destroy() {
425
+ key: "destroyHandle",
426
+ value: function destroyHandle() {
423
427
  this.elementContainer.destroy();
424
- this.elementContainer.setStatus(IContainerStatus.DESTROYED);
428
+ this.elementContainerService.destroy();
429
+ this.serviceMap.EventCenter.cleanIFrames();
425
430
  // popup未注册会报错,但element不需要感知popup是否被注册
426
431
  try {
427
432
  destroyModal(); // 关闭popup弹窗
428
433
  } catch (error) {}
429
- this.elementContainerService.getContainerServices().forEach(function (value) {
430
- value.getContainerElement().remove();
431
- });
434
+ }
435
+ }, {
436
+ key: "destroy",
437
+ value: function destroy() {
438
+ this.destroyHandle();
439
+ this.elementContainer.setStatus(IContainerStatus.DESTROYED);
432
440
  }
433
441
  }]);
434
442
  return ElementController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1744283958-dev.4",
3
+ "version": "0.0.1744283958-dev.5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",