@alipay/ams-checkout 0.0.1757298389-dev.4 → 0.0.1757298389-dev.6

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.
@@ -217,34 +217,42 @@ var ElementController = /*#__PURE__*/function () {
217
217
  return _regeneratorRuntime().wrap(function _callee$(_context) {
218
218
  while (1) switch (_context.prev = _context.next) {
219
219
  case 0:
220
+ if (!_this3.initTimeout) {
221
+ _context.next = 4;
222
+ break;
223
+ }
224
+ return _context.abrupt("return", resolve({
225
+ isValid: false
226
+ }));
227
+ case 4:
220
228
  if (!((_this3$elementProcess = _this3.elementProcessors) !== null && _this3$elementProcess !== void 0 && _this3$elementProcess[ElementType.payment])) {
221
- _context.next = 13;
229
+ _context.next = 17;
222
230
  break;
223
231
  }
224
- _context.prev = 1;
225
- _context.next = 4;
232
+ _context.prev = 5;
233
+ _context.next = 8;
226
234
  return _this3.onValidateFunc((_this3$elementProcess2 = _this3.elementProcessors[ElementType.payment]) === null || _this3$elementProcess2 === void 0 ? void 0 : _this3$elementProcess2.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
227
- case 4:
235
+ case 8:
228
236
  validateResult = _context.sent;
229
237
  return _context.abrupt("return", resolve(validateResult.data));
230
- case 8:
231
- _context.prev = 8;
232
- _context.t0 = _context["catch"](1);
238
+ case 12:
239
+ _context.prev = 12;
240
+ _context.t0 = _context["catch"](5);
233
241
  return _context.abrupt("return", resolve({
234
242
  isValid: false
235
243
  }));
236
- case 11:
237
- _context.next = 14;
244
+ case 15:
245
+ _context.next = 18;
238
246
  break;
239
- case 13:
247
+ case 17:
240
248
  return _context.abrupt("return", resolve({
241
249
  isValid: false
242
250
  }));
243
- case 14:
251
+ case 18:
244
252
  case "end":
245
253
  return _context.stop();
246
254
  }
247
- }, _callee, null, [[1, 8]]);
255
+ }, _callee, null, [[5, 12]]);
248
256
  }));
249
257
  return function (_x) {
250
258
  return _ref2.apply(this, arguments);
@@ -378,6 +386,7 @@ var ElementController = /*#__PURE__*/function () {
378
386
  });
379
387
  this.serviceMap.EventCenter.listen(EVENT.webAppReady.name, function (data) {
380
388
  clearTimeout(_this5.initTimeout);
389
+ _this5.initTimeout = null;
381
390
  if (_this5.elementContainerService.getContainerService(data.source)) {
382
391
  renderCallback({
383
392
  success: true
@@ -127,6 +127,10 @@ export interface LinkAuthMountOptions extends BaseMountOptions {
127
127
  theme?: ThemeType;
128
128
  };
129
129
  }
130
+ type ToCamelCase<S extends string> = S extends `${infer First}-${infer Rest}` ? `${First}${Capitalize<ToCamelCase<Rest>>}` : S;
131
+ type CompatibleVariables<T extends Record<string, string>> = {
132
+ [K in keyof T as K | ToCamelCase<K & string>]: string;
133
+ };
130
134
  export interface PaymentMountOptions extends BaseMountOptions {
131
135
  type: ElementType.payment;
132
136
  appearance?: {
@@ -134,7 +138,7 @@ export interface PaymentMountOptions extends BaseMountOptions {
134
138
  layout?: {
135
139
  type: PaymentElementLayout;
136
140
  };
137
- variables?: {
141
+ variables?: Partial<CompatibleVariables<{
138
142
  'content-primary': string;
139
143
  'content-secondary': string;
140
144
  'content-tertiary': string;
@@ -159,7 +163,8 @@ export interface PaymentMountOptions extends BaseMountOptions {
159
163
  'radius-module': string;
160
164
  'radius-component': string;
161
165
  'radius-button': string;
162
- };
166
+ 'warpper-padding': string;
167
+ }>>;
163
168
  };
164
169
  notRedirectAfterComplete?: boolean;
165
170
  merchantAppointParam?: IMerchantAppointParam;
@@ -360,7 +365,7 @@ export interface IElementOptions {
360
365
  appearance?: {
361
366
  theme: ThemeType.Default | ThemeType.Night;
362
367
  };
363
- onEventCallback?: ({ code, message, result }: {
368
+ onEventCallback?: ({ code, message, result, }: {
364
369
  code: EventCallbackCode;
365
370
  message: string;
366
371
  result?: any;
@@ -71,6 +71,11 @@ export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
71
71
  ELEMENT_ENVIRONMENT["SANDBOX"] = "SANDBOX";
72
72
  return ELEMENT_ENVIRONMENT;
73
73
  }({});
74
+
75
+ // 将短横线命名转为小驼峰
76
+
77
+ // 同时兼容短横线和小驼峰两种键名
78
+
74
79
  // export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
75
80
 
76
81
  export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
@@ -10,7 +10,7 @@ export declare const formatElementOption: (options: IElementOptions) => {
10
10
  appearance?: {
11
11
  theme: import("./type").ThemeType.Default | import("./type").ThemeType.Night;
12
12
  };
13
- onEventCallback?: ({ code, message, result }: {
13
+ onEventCallback?: ({ code, message, result, }: {
14
14
  code: EventCallbackCode;
15
15
  message: string;
16
16
  result?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1757298389-dev.4",
3
+ "version": "0.0.1757298389-dev.6",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",