@alipay/ams-checkout 0.0.1732886551-dev.4 → 0.0.1733198624-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.
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
5
5
  /**
6
6
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
7
  */
8
- export declare const AMSCheckoutAppVersion = "1.25.0";
9
- export declare const AMSAutoDebitAppVersion = "1.25.0";
10
- export declare const AMSEasyPayAppVersion = "1.25.0";
11
- export declare const AMSCashierPaymentAppVersion = "1.25.0";
12
- export declare const AMSVaultingAppVersion = "1.25.0";
13
- export declare const AMSPaymentElementAppVersion = "1.25.0";
14
- export declare const ADDRESSElementAppVersion = "1.25.0";
8
+ export declare const AMSCheckoutAppVersion = "1.25.2";
9
+ export declare const AMSAutoDebitAppVersion = "1.25.2";
10
+ export declare const AMSEasyPayAppVersion = "1.25.2";
11
+ export declare const AMSCashierPaymentAppVersion = "1.25.2";
12
+ export declare const AMSVaultingAppVersion = "1.25.2";
13
+ export declare const AMSPaymentElementAppVersion = "1.25.2";
14
+ export declare const ADDRESSElementAppVersion = "1.25.2";
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
37
  */
38
- export var AMSCheckoutAppVersion = '1.25.0'; // 兜底版本号
39
- export var AMSAutoDebitAppVersion = '1.25.0'; // 代扣
40
- export var AMSEasyPayAppVersion = '1.25.0'; // easypay
41
- export var AMSCashierPaymentAppVersion = '1.25.0'; // 收银台(卡、apm)
42
- export var AMSVaultingAppVersion = '1.25.0'; // 绑卡
43
- export var AMSPaymentElementAppVersion = '1.25.0'; // payment element
44
- export var ADDRESSElementAppVersion = '1.25.0'; // address element
38
+ export var AMSCheckoutAppVersion = '1.25.2'; // 兜底版本号
39
+ export var AMSAutoDebitAppVersion = '1.25.2'; // 代扣
40
+ export var AMSEasyPayAppVersion = '1.25.2'; // easypay
41
+ export var AMSCashierPaymentAppVersion = '1.25.2'; // 收银台(卡、apm)
42
+ export var AMSVaultingAppVersion = '1.25.2'; // 绑卡
43
+ export var AMSPaymentElementAppVersion = '1.25.2'; // payment element
44
+ export var ADDRESSElementAppVersion = '1.25.2'; // address element
@@ -112,10 +112,6 @@ export declare const EVENT: {
112
112
  name: string;
113
113
  uniqueKey: string;
114
114
  };
115
- closeCallback: {
116
- name: string;
117
- uniqueKey: string;
118
- };
119
115
  eventCallback: {
120
116
  name: string;
121
117
  uniqueKey: string;
@@ -112,11 +112,6 @@ export var EVENT = {
112
112
  name: 'onClose',
113
113
  uniqueKey: 'userOnClose'
114
114
  },
115
- // 标记 SDK 回调事件
116
- closeCallback: {
117
- name: 'onCloseCallback',
118
- uniqueKey: 'closeCallback'
119
- },
120
115
  eventCallback: {
121
116
  name: 'onEventCallback',
122
117
  uniqueKey: 'userEventCallback'
@@ -22,6 +22,5 @@ export declare class AntomSDKCore {
22
22
  getPaymentContext(): PaymentContext;
23
23
  destroy(): void;
24
24
  private handleBehaviorRender;
25
- private handleClose;
26
25
  private cleanRender;
27
26
  }
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
10
10
  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; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  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); }
13
- import { DisplayTypeEnum, eventCodeEnum } from "../../types";
13
+ import { DisplayTypeEnum } from "../../types";
14
14
  import { DisplayInfo } from "../index";
15
15
  import { v4 as uuid } from 'uuid';
16
16
  import { ServiceProvider } from "../service";
@@ -150,18 +150,6 @@ export var AntomSDKCore = /*#__PURE__*/function () {
150
150
  return _ref2.apply(this, arguments);
151
151
  };
152
152
  }());
153
- eventCenter.listen(EVENT.closeCallback.name, function () {
154
- var _options$onClose;
155
- (_options$onClose = options.onClose) === null || _options$onClose === void 0 || _options$onClose.call(options);
156
- });
157
- eventCenter.listen(EVENT.eventCallback.name, function (data) {
158
- var _options$onEventCallb;
159
- (_options$onEventCallb = options.onEventCallback) === null || _options$onEventCallb === void 0 || _options$onEventCallb.call(options, data);
160
- });
161
- eventCenter.listen(EVENT.error.name, function (data) {
162
- var _options$onError;
163
- (_options$onError = options.onError) === null || _options$onError === void 0 || _options$onError.call(options, data);
164
- });
165
153
 
166
154
  // execute additional logic from specified product
167
155
  if (this.productProcessors[sdkMetaData.productScene]) {
@@ -303,7 +291,11 @@ export var AntomSDKCore = /*#__PURE__*/function () {
303
291
  showRetentionPopup();
304
292
  return;
305
293
  } else {
306
- _this2.handleClose();
294
+ _this2.cleanRender();
295
+ eventCenter.dispatchToApp({
296
+ event: EVENT.close.name,
297
+ data: {}
298
+ });
307
299
  }
308
300
  };
309
301
 
@@ -330,8 +322,12 @@ export var AntomSDKCore = /*#__PURE__*/function () {
330
322
  createRetentionPopup(platform, function () {
331
323
  hideRetentionPopup();
332
324
  }, function () {
325
+ eventCenter.dispatchToApp({
326
+ event: EVENT.close.name,
327
+ data: {}
328
+ });
333
329
  hideRetentionPopup();
334
- _this2.handleClose();
330
+ _this2.cleanRender();
335
331
  });
336
332
  createMockup({
337
333
  platform: platform,
@@ -341,19 +337,6 @@ export var AntomSDKCore = /*#__PURE__*/function () {
341
337
  return;
342
338
  }
343
339
  }
344
- }, {
345
- key: "handleClose",
346
- value: function handleClose() {
347
- var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
348
- eventCenter.emit(EVENT.closeCallback.name, {});
349
- eventCenter.emit(EVENT.eventCallback.name, {
350
- code: eventCodeEnum.SDK_PAYMENT_CANCEL,
351
- result: {
352
- result: {}
353
- }
354
- });
355
- this.cleanRender();
356
- }
357
340
  }, {
358
341
  key: "cleanRender",
359
342
  value: function cleanRender() {
@@ -82,8 +82,6 @@ export var ContainerService = /*#__PURE__*/function () {
82
82
  }
83
83
  var container = document.getElementById(COMPONENT_CONTAINER_ID);
84
84
  if (container) container === null || container === void 0 || container.remove();
85
- this.webApp = null;
86
- this.eventCenter.cleanIFrames();
87
85
 
88
86
  // animation
89
87
  (_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(displayInfo.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
@@ -27,10 +27,6 @@ export declare class EventCenter implements Service {
27
27
  * @param domain - The domain of the app.
28
28
  */
29
29
  addIFrame(iframe: HTMLIFrameElement): void;
30
- /**
31
- * Cleans iframes when web app close
32
- */
33
- cleanIFrames(): void;
34
30
  removeIFrame(iframe: HTMLIFrameElement): void;
35
31
  /**
36
32
  * Handles messages received from the app.
@@ -46,9 +42,8 @@ export declare class EventCenter implements Service {
46
42
  * Listens to an event by adding a callback function.
47
43
  * @param name - The name of the event to listen for.
48
44
  * @param func - The callback function to execute when the event is emitted.
49
- * @param isAppend - Append to event handlers as chain, default value is false
50
45
  */
51
- listen(name: string, func: IListener, isAppend?: boolean): void;
46
+ listen(name: string, func: IListener): void;
52
47
  /**
53
48
  * Unsubscribes from an event. If a function is provided, only that function is removed.
54
49
  * @param name - The name of the event to unlisten to.
@@ -72,15 +72,6 @@ export var EventCenter = /*#__PURE__*/function () {
72
72
  origin: getIframeOrigin(iframe)
73
73
  });
74
74
  }
75
-
76
- /**
77
- * Cleans iframes when web app close
78
- */
79
- }, {
80
- key: "cleanIFrames",
81
- value: function cleanIFrames() {
82
- this.iframes = [];
83
- }
84
75
  }, {
85
76
  key: "removeIFrame",
86
77
  value: function removeIFrame(iframe) {
@@ -108,11 +99,11 @@ export var EventCenter = /*#__PURE__*/function () {
108
99
  }
109
100
  var isJson = isJsonString(e.data);
110
101
  if (isJson) {
111
- var eventPayload = JSON.parse(e.data);
112
- if (eventPayload.name !== MessageName.APP_TO_SDK || eventPayload.instanceId !== this.instanceId) {
102
+ var _EventPayload = JSON.parse(e.data);
103
+ if (_EventPayload.name !== MessageName.APP_TO_SDK) {
113
104
  return;
114
105
  }
115
- this._handleAppMessage(eventPayload);
106
+ this._handleAppMessage(_EventPayload);
116
107
  } else {
117
108
  console.error(ERRORMESSAGE.NOT_JSON_FORMAT);
118
109
  }
@@ -135,13 +126,11 @@ export var EventCenter = /*#__PURE__*/function () {
135
126
  * Listens to an event by adding a callback function.
136
127
  * @param name - The name of the event to listen for.
137
128
  * @param func - The callback function to execute when the event is emitted.
138
- * @param isAppend - Append to event handlers as chain, default value is false
139
129
  */
140
130
  }, {
141
131
  key: "listen",
142
132
  value: function listen(name, func) {
143
- var isAppend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
144
- var eventList = isAppend ? this.events.get(name) || [] : [];
133
+ var eventList = this.events.get(name) || [];
145
134
  eventList.push({
146
135
  func: func
147
136
  });
package/esm/index.d.ts CHANGED
@@ -33,5 +33,4 @@ export declare class AMSEasyPay {
33
33
  private core;
34
34
  constructor(options: IoptionsParams);
35
35
  createComponent(params: IcreateComponent): void;
36
- unmount(): void;
37
36
  }
package/esm/index.js CHANGED
@@ -181,11 +181,6 @@ export var AMSEasyPay = /*#__PURE__*/function () {
181
181
  isAppWebview: params.isAppWebview
182
182
  });
183
183
  }
184
- }, {
185
- key: "unmount",
186
- value: function unmount() {
187
- this.core.destroy();
188
- }
189
184
  }]);
190
185
  return AMSEasyPay;
191
186
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1732886551-dev.4",
3
+ "version": "0.0.1733198624-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",