@alipay/ams-checkout 0.0.1750234752-dev.2 → 0.0.1750234752-dev.3

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.
@@ -20,7 +20,7 @@ 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 { EVENT } from "../../../../constant";
23
+ import { ERRORMESSAGE, EVENT } from "../../../../constant";
24
24
  import AddressProcessor from "../../../../core/component/element/elementProcessor/addressProcessor";
25
25
  import AuthProcessor from "../../../../core/component/element/elementProcessor/authProcessor";
26
26
  import PaymentProcessor from "../../../../core/component/element/elementProcessor/paymentProcessor";
@@ -135,6 +135,7 @@ var ElementController = /*#__PURE__*/function () {
135
135
  _this.initTimeout = null;
136
136
  _this.changeLoading(false);
137
137
  _this.setControllerStatusOrView(IElementStatus.READY);
138
+ _this.onEventCallback(ERRORMESSAGE.SDK_LAUNCH_PAYMENT_APP_ERROR.CALL_APP_URL_ERROR);
138
139
  _this.elementContainerService.getContainerServices().forEach(function (value) {
139
140
  value.getContainerElement().remove();
140
141
  });
@@ -153,6 +154,8 @@ var ElementController = /*#__PURE__*/function () {
153
154
  code: EventCallbackCode.SDK_CREATEPAYMENT_PARAMETER_ERROR,
154
155
  message: (error === null || error === void 0 ? void 0 : error.message) || 'Initialization parameter exception.'
155
156
  });
157
+ clearTimeout(_this.initTimeout);
158
+ _this.initTimeout = null;
156
159
  _this.changeLoading(false);
157
160
  return;
158
161
  });
@@ -300,7 +303,8 @@ var ElementController = /*#__PURE__*/function () {
300
303
  // }
301
304
  });
302
305
  this.serviceMap.EventCenter.listen(EVENT.redirect.name, function (data) {
303
- handleRedirect(data);
306
+ var onEventCallback = _this4.onEventCallback.bind(_this4);
307
+ handleRedirect(data, false, onEventCallback);
304
308
  });
305
309
  this.serviceMap.EventCenter.listen(EVENT.destroy.name, function () {
306
310
  _this4.setControllerStatusOrView(IElementStatus.READY);
@@ -50,7 +50,10 @@ export declare function generateIframeSrc({ paymentSessionObj, paymentSession, i
50
50
  appVersion: string;
51
51
  link?: string;
52
52
  }): string;
53
- export declare function handleRedirect(data: any, fromFastSdk?: boolean): void;
53
+ export declare function handleRedirect(data: any, fromFastSdk: boolean, eventCallback: ({ code, message }: {
54
+ code: any;
55
+ message: any;
56
+ }) => void): void;
54
57
  export declare function redirect(data: {
55
58
  normalUrl?: string;
56
59
  schemeUrl?: string;
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  import { ERRORMESSAGE } from "../../../constant";
14
14
  import { IElementStatus } from "../../../foundation";
15
15
  import { getIframeUrl } from "../../../plugin/component/cashierApp";
16
- import { DisplayTypeEnum, RedirectType, TargetEnum, terminalTypeEnum } from "../../../types";
16
+ import { DisplayTypeEnum, eventCodeEnum, RedirectType, TargetEnum, terminalTypeEnum } from "../../../types";
17
17
  import { device } from "../../../util/index";
18
18
  import CallApp from "../../../util/intl-callapp/es/main";
19
19
  import { getComponentSign, parseSessionData } from "../index";
@@ -149,6 +149,7 @@ export function generateIframeSrc(_ref3) {
149
149
  export function handleRedirect(data) {
150
150
  var _data$isDestroy, _data$isCallApp, _data$callAppDetectSu;
151
151
  var fromFastSdk = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
152
+ var eventCallback = arguments.length > 2 ? arguments[2] : undefined;
152
153
  console.log('local payment sdk new element redirect arg ----', this);
153
154
  var _data = typeof data === 'string' ? {
154
155
  normalUrl: data
@@ -182,10 +183,10 @@ export function handleRedirect(data) {
182
183
  // .send();
183
184
  var successCallback = function successCallback(type, url, durationInSeconds) {
184
185
  // TODO
185
- // event.dispatchToSDK(EVENT.eventCallback.name, {
186
- // code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
187
- // message: `Successfully opened the app,${type}: ${url}`,
188
- // });
186
+ eventCallback({
187
+ code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
188
+ message: "Successfully opened the app,".concat(type, ": ").concat(url)
189
+ });
189
190
  var extra = {
190
191
  redirectInfo: JSON.stringify(_data),
191
192
  openType: type,
@@ -205,10 +206,10 @@ export function handleRedirect(data) {
205
206
  // .send();
206
207
  };
207
208
  var failCallback = function failCallback(type, url, durationInSeconds) {
208
- // event.dispatchToSDK(EVENT.eventCallback.name, {
209
- // code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
210
- // message: `Failed to open app,applinkUrl: ${_data?.applinkUrl} schemeUrl: ${_data?.schemeUrl} normalUrl: ${_data?.normalUrl}`,
211
- // });
209
+ eventCallback({
210
+ code: eventCodeEnum.SDK_LAUNCH_PAYMENT_APP_ERROR,
211
+ message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
212
+ });
212
213
  var extra = {
213
214
  redirectInfo: JSON.stringify(_data),
214
215
  openType: type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1750234752-dev.2",
3
+ "version": "0.0.1750234752-dev.3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",