@alipay/ams-checkout 0.0.1766066234-dev.1 → 0.0.1766066234-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.
@@ -369,7 +369,7 @@ var ElementController = /*#__PURE__*/function () {
369
369
  _context4.next = 11;
370
370
  return new Promise( /*#__PURE__*/function () {
371
371
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
372
- var that, recordResultCallback, params, processStep, _yield$_this3$onValid2, data, errorResult;
372
+ var that, recordResultCallback, params, processStep, _yield$_this3$onValid2, data, errorString, errorResult;
373
373
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
374
374
  while (1) switch (_context3.prev = _context3.next) {
375
375
  case 0:
@@ -458,14 +458,16 @@ var ElementController = /*#__PURE__*/function () {
458
458
  recordResult = data;
459
459
  recordResultCallback(recordResult);
460
460
  case 21:
461
- _context3.next = 29;
461
+ _context3.next = 30;
462
462
  break;
463
463
  case 23:
464
464
  _context3.prev = 23;
465
465
  _context3.t0 = _context3["catch"](2);
466
+ // 修复error为{}空对象的问题,上报stack&message
467
+ errorString = JSON.stringify(_context3.t0, Object.getOwnPropertyNames(_context3.t0));
466
468
  errorResult = {
467
469
  error: _objectSpread(_objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED), {}, {
468
- context: JSON.stringify(_context3.t0)
470
+ context: errorString
469
471
  }),
470
472
  status: PaymentStatus.FAIL
471
473
  };
@@ -476,7 +478,7 @@ var ElementController = /*#__PURE__*/function () {
476
478
  });
477
479
  recordResult = errorResult;
478
480
  recordResultCallback(errorResult);
479
- case 29:
481
+ case 30:
480
482
  case "end":
481
483
  return _context3.stop();
482
484
  }
@@ -63,14 +63,20 @@ export function checkCanMount(_ref) {
63
63
  return {
64
64
  success: false,
65
65
  errorMsg: "Element with selector ".concat(sdkSelector, " not found."),
66
- error: ERRORMESSAGE.PARAM_INVALID
66
+ error: {
67
+ code: ERRORMESSAGE.PARAM_INVALID.code,
68
+ message: "Element with selector ".concat(sdkSelector, " not found.")
69
+ }
67
70
  };
68
71
  }
69
72
  if (status === IElementStatus.DESTROYED) {
70
73
  return {
71
74
  success: false,
72
75
  errorMsg: "Creating components in the destroyed state is forbidden.",
73
- error: ERRORMESSAGE.UI_STATE_ERROR
76
+ error: {
77
+ code: ERRORMESSAGE.UI_STATE_ERROR.code,
78
+ message: "Creating components in the destroyed state is forbidden."
79
+ }
74
80
  };
75
81
  }
76
82
  if (status === IElementStatus.READY) {
@@ -82,7 +88,10 @@ export function checkCanMount(_ref) {
82
88
  return {
83
89
  success: false,
84
90
  errorMsg: "SDK status error.",
85
- error: ERRORMESSAGE.UI_STATE_ERROR
91
+ error: {
92
+ code: ERRORMESSAGE.UI_STATE_ERROR.code,
93
+ message: "SDK status error."
94
+ }
86
95
  };
87
96
  }
88
97
  return {
package/esm/main.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AddressComponent } from './core/component/address';
2
2
  import { ElementComponent } from './core/component/element';
3
3
  import { AMSComponent } from './core/component/index';
4
- import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions } from './types';
4
+ import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions, ValidationResult } from './types';
5
5
  export { AMSCheckoutPage } from './core/component/ckp';
6
6
  export * from './types';
7
7
  export declare class AMSCheckout extends AMSComponent {
@@ -14,6 +14,15 @@ export declare class AMSAutoDebitPay extends AMSCheckout {
14
14
  export declare class AMSCashierPayment extends AMSCheckout {
15
15
  constructor(options: IoptionsParams);
16
16
  static preload(options?: IPreloadOptions): void;
17
+ /**
18
+ * Form validation function
19
+ * If the form is currently displayed:
20
+ * - Successful validation: isValid is true
21
+ * - Failed validation: isValid is false, and error messages are displayed on the form page
22
+ * If not on the form display page, isValid returns false
23
+ * @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
24
+ */
25
+ validateFields(): Promise<ValidationResult>;
17
26
  }
18
27
  export declare class AMSVaulting extends AMSCheckout {
19
28
  constructor(options: IoptionsParams);
package/esm/main.js CHANGED
@@ -112,7 +112,21 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
112
112
  }
113
113
  return _super3.call(this, _options, currentChannelType);
114
114
  }
115
- _createClass(AMSCashierPayment, null, [{
115
+ _createClass(AMSCashierPayment, [{
116
+ key: "validateFields",
117
+ value:
118
+ /**
119
+ * Form validation function
120
+ * If the form is currently displayed:
121
+ * - Successful validation: isValid is true
122
+ * - Failed validation: isValid is false, and error messages are displayed on the form page
123
+ * If not on the form display page, isValid returns false
124
+ * @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
125
+ */
126
+ function validateFields() {
127
+ return this._validateFields();
128
+ }
129
+ }], [{
116
130
  key: "preload",
117
131
  value: function preload() {
118
132
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
@@ -238,7 +252,8 @@ export var AMSEasyPay = /*#__PURE__*/function () {
238
252
  displayInfo: {
239
253
  type: DisplayTypeEnum.popup
240
254
  },
241
- isAppWebview: params.isAppWebview
255
+ isAppWebview: params.isAppWebview,
256
+ isNativeAppWebview: params.isNativeAppWebview
242
257
  });
243
258
  }
244
259
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1766066234-dev.1",
3
+ "version": "0.0.1766066234-dev.3",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",