@alipay/ams-checkout 2.0.27 → 2.0.29

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,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.0"
8
+ "packageVersion": "7.59.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -296,6 +296,6 @@ export var LogConfig = {
296
296
  version: 'iteration/20231021',
297
297
  mdata: {
298
298
  firstLogTime: Date.now(),
299
- sdkVersion: "2.0.27"
299
+ sdkVersion: "2.0.29"
300
300
  }
301
301
  };
@@ -0,0 +1 @@
1
+ export declare const getIdengineTimezone: () => string;
@@ -0,0 +1,8 @@
1
+ export var getIdengineTimezone = function getIdengineTimezone() {
2
+ var offsetMinutes = -new Date().getTimezoneOffset();
3
+ var sign = offsetMinutes >= 0 ? '+' : '-';
4
+ var absoluteMinutes = Math.abs(offsetMinutes);
5
+ var hours = Math.floor(absoluteMinutes / 60);
6
+ var minutes = absoluteMinutes % 60;
7
+ return "UTC".concat(sign).concat(hours).concat(minutes ? ":".concat(String(minutes).padStart(2, '0')) : '');
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "2.0.27",
3
+ "version": "2.0.29",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -209,8 +209,10 @@ export declare type AntomLayouts = 'tabs' | 'accordion';
209
209
  export declare class AntomSDK extends BaseElementsFactory {
210
210
  static version: string;
211
211
  private stopModalMessageMonitor;
212
+ private readonly apiTracker;
212
213
  constructor(config?: AntomSDKConfig);
213
214
  protected canUseElements(): Array<ElementListItemType>;
215
+ init(): Promise<this>;
214
216
  /**
215
217
  * @description 更新配置
216
218
  */
@@ -221,19 +223,36 @@ export declare class AntomSDK extends BaseElementsFactory {
221
223
  elements(): Elements;
222
224
  createElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
223
225
  createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
224
- createElement(elementType: 'CVV', options?: CVVAppConfig): CVVElement;
226
+ createElement(elementType: 'CVV', options: CVVAppConfig): CVVElement;
225
227
  createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
228
+ createElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
226
229
  getElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
227
230
  getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
228
231
  getElement(elementType: 'CVV', options?: CVVAppConfig): CVVElement;
229
232
  getElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
233
+ getElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
230
234
  /**
231
235
  * 从 elements 容器或直接传入的 MainElement 中提取指定类型的主元素
232
236
  * @throws {AntomSDKError} 当无法找到有效的主元素时抛出错误
233
237
  */
234
238
  private extractMainElement;
235
239
  confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult>;
240
+ private runConfirmCardSetup;
236
241
  confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult>;
242
+ private runConfirmPayment;
243
+ /**
244
+ * 触发 Express Vaulting element 的 PayPal 绑卡提交流程。
245
+ *
246
+ * iframe 收到 OPENSDK@CONFIRM_VAULTING 后执行 submitPay + 单次 inquiry 兜底,
247
+ * 完成后通过 OPENSDK@CONFIRM_VAULTING_RESULT 回包,Promise resolve。
248
+ *
249
+ * @param options.elements 已挂载的 ExpressVaultingElement 或包含它的 Elements 实例
250
+ * @param options.redirect 跳转策略,默认 'always',透传给 iframe
251
+ */
252
+ confirmVaulting(options: {
253
+ elements: BaseMainElement | BaseElements;
254
+ redirect?: 'always' | 'if_required';
255
+ }): Promise<ExpressVaultingResult>;
237
256
  }
238
257
 
239
258
  /**
@@ -293,9 +312,29 @@ export declare const AntomSDKErrorCodes: {
293
312
  */
294
313
  readonly AMOUNT_VALUE_EMPTY: "AMOUNT_VALUE_EMPTY";
295
314
  /**
296
- * @description 金额格式非法(仅允许整数和小数)
315
+ * @description 金额格式非法(仅允许 ASCII 数字字符串)
297
316
  */
298
317
  readonly AMOUNT_VALUE_INVALID: "AMOUNT_VALUE_INVALID";
318
+ /**
319
+ * @description Amount currency does not match the payment session currency
320
+ */
321
+ readonly AMOUNT_CURRENCY_MISMATCH: "AMOUNT_CURRENCY_MISMATCH";
322
+ /**
323
+ * @description Amount currency is not supported
324
+ */
325
+ readonly AMOUNT_CURRENCY_UNSUPPORTED: "AMOUNT_CURRENCY_UNSUPPORTED";
326
+ /**
327
+ * @description Amount currency precision is not supported
328
+ */
329
+ readonly AMOUNT_PRECISION_UNSUPPORTED: "AMOUNT_PRECISION_UNSUPPORTED";
330
+ /**
331
+ * @description Amount conversion timed out
332
+ */
333
+ readonly AMOUNT_RESOLVE_TIMEOUT: "AMOUNT_RESOLVE_TIMEOUT";
334
+ /**
335
+ * @description Amount conversion failed
336
+ */
337
+ readonly AMOUNT_RESOLVE_FAILED: "AMOUNT_RESOLVE_FAILED";
299
338
  readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
300
339
  readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
301
340
  readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
@@ -308,8 +347,8 @@ export declare const AntomSDKErrorCodes: {
308
347
  readonly ELEMENT_DEFINE_ERROR: "ELEMENT_DEFINE_ERROR";
309
348
  readonly ELEMENT_ALREADY_REGISTERED: "ELEMENT_ALREADY_REGISTERED";
310
349
  readonly CANNOT_CREATE_SAME_ELEMENT_TWICE: "CANNOT_CREATE_SAME_ELEMENT_TWICE";
311
- readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT";
312
- readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT";
350
+ readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT"; /** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
351
+ readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT"; /** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
313
352
  readonly NOT_SUPPORT_ELEMENT: "NOT_SUPPORT_ELEMENT";
314
353
  readonly NOT_SUPPORT_SUBMIT: "NOT_SUPPORT_SUBMIT";
315
354
  readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
@@ -2129,18 +2168,22 @@ export declare interface ConfirmCardSetupOptions {
2129
2168
  redirect?: 'always' | 'if_required';
2130
2169
  }
2131
2170
 
2132
- export declare interface ConfirmPaymentOptions extends Omit<ConfirmCardSetupOptions, 'elements'>, PaymentSubmitParams {
2133
- sessionData: string;
2134
- /**
2135
- * @description 传入已挂载的 CVVElement / PaymentElement / Elements 实例,不传则使用无 UI 自动提交模式
2136
- */
2137
- elements?: BaseMainElement | BaseElements;
2171
+ export declare type ConfirmPaymentOptions = PaymentSubmitParams & {
2138
2172
  appearance?: CVVAppearance;
2139
2173
  /**
2140
2174
  * @description 集成用户自定义信息(如 cardHolderName)
2141
2175
  */
2142
2176
  params?: Record<string, unknown>;
2143
- }
2177
+ } & ({
2178
+ /** 已挂载的 Element;确认时使用其创建时绑定的会话。 */
2179
+ elements: BaseMainElement | BaseElements;
2180
+ /** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
2181
+ sessionData?: string;
2182
+ } | {
2183
+ elements?: undefined;
2184
+ /** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
2185
+ sessionData: string;
2186
+ });
2144
2187
 
2145
2188
  /**
2146
2189
  * @description Connect流程参数
@@ -2281,9 +2324,9 @@ export declare interface CVVAppConfig extends BaseElementAppConfig {
2281
2324
  /** CVV appearance configuration including optional alias-only Rules. */
2282
2325
  appearance?: CVVAppearance;
2283
2326
  /**
2284
- * @description sessionData
2327
+ * @description 创建时必填的支付会话;不可通过 updateConfig 或 submit 替换
2285
2328
  */
2286
- sessionData?: string;
2329
+ sessionData: string;
2287
2330
  /* Excluded from this release type: paymentSessionConfig */
2288
2331
  /* Excluded from this release type: renderData */
2289
2332
  /* Excluded from this release type: sdkVersion */
@@ -2309,15 +2352,18 @@ export declare type CVVAppearanceProps = {
2309
2352
  */
2310
2353
  export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVElementEvents> {
2311
2354
  static elementType: string;
2355
+ private readonly sessionData;
2356
+ private readonly elementTracker;
2357
+ private _mountInProgress;
2358
+ private _destroyInProgress;
2312
2359
  constructor(name: string, config: CVVElementConfig);
2313
2360
  /* Excluded from this release type: setup */
2314
- /**
2315
- * Updates CVV configuration while preserving the public Rules clear semantics.
2316
- * @param newConfig Partial CVV configuration patch.
2317
- * @returns The WebApp update acknowledgement.
2318
- */
2319
- updateConfig(newConfig: Partial<CVVAppConfig>): Promise<CVVElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
2361
+ /* Excluded from this release type: updateConfig */
2320
2362
  /* Excluded from this release type: submit */
2363
+ mount(container: HTMLElement): Promise<void>;
2364
+ on<T extends keyof CVVElementEvents>(event: T, handler: (payload: CVVElementEvents[T]) => void): void;
2365
+ unmount(): void;
2366
+ destroy(): void;
2321
2367
  protected focus(): void;
2322
2368
  protected blur(): void;
2323
2369
  protected clear(): void;
@@ -2328,20 +2374,10 @@ export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVEle
2328
2374
  * @description CVV element config type
2329
2375
  */
2330
2376
  export declare interface CVVElementConfig extends BaseElementConfig<CVVAppConfig> {
2377
+ appConfig: CVVAppConfig;
2331
2378
  }
2332
2379
 
2333
- export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams> {
2334
- /**
2335
- * @description Emitted event about form
2336
- */
2337
- form: {
2338
- errors?: Array<{
2339
- field: string | number;
2340
- message: string;
2341
- currentValue: any;
2342
- }>;
2343
- message: string;
2344
- };
2380
+ export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams & Pick<CVVAppConfig, 'sessionData'>> {
2345
2381
  /**
2346
2382
  * @description Emitted when the element is destroy
2347
2383
  */
@@ -2385,10 +2421,6 @@ export declare type CVVSubmitErrorCodes = 'NOT_FIND_MAINELEMENT' | 'SESSION_DATA
2385
2421
  * @description CVV 支付提交参数
2386
2422
  */
2387
2423
  export declare interface CVVSubmitParams {
2388
- /**
2389
- * 支付会话数据
2390
- */
2391
- sessionData?: string;
2392
2424
  /**
2393
2425
  * 重定向策略
2394
2426
  */
@@ -3072,8 +3104,12 @@ declare interface ElementPluginChangeStates {
3072
3104
  declare type ElementPluginNameEnum = 'SET_STATE' | 'PASSIVE_SET_STATE';
3073
3105
 
3074
3106
  declare class Elements extends BaseElements {
3107
+ private readonly apiTracker;
3075
3108
  protected canUseElements(): Array<ElementListItemType>;
3076
3109
  constructor(config: BaseElementsConfig);
3110
+ init(): Promise<this>;
3111
+ updateConfig(config: Partial<BaseElementsConfig>): void;
3112
+ destroy(): void;
3077
3113
  createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
3078
3114
  createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
3079
3115
  getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
@@ -3209,12 +3245,13 @@ export declare interface ExpressAppConfig extends BaseElementAppConfig {
3209
3245
  /**
3210
3246
  * Amount & Currency
3211
3247
  *
3212
- * Only effective via `updateConfig({ amount })` at runtime.
3213
- * Passing amount at creation time is ignored; the initial amount
3214
- * comes from the server-side sdkQuery result (renderData.paymentAmount).
3248
+ * For Apple Pay and Google Pay, `value` is a positive ASCII digit string in
3249
+ * the payment session currency's minor unit; `currency` may be omitted.
3250
+ * For example, USD 10.99 is passed as `{ value: '1099' }`.
3251
+ * PayPal keeps its existing major-unit amount semantics and requires `currency`.
3215
3252
  */
3216
3253
  amount?: {
3217
- currency: string;
3254
+ currency?: string;
3218
3255
  value: string;
3219
3256
  };
3220
3257
  /** PayPal 配置 */
@@ -3281,6 +3318,17 @@ export declare interface ExpressClickEvent {
3281
3318
  expressPaymentType: string;
3282
3319
  }
3283
3320
 
3321
+ declare type ExpressCompletePaymentResult = {
3322
+ success: boolean;
3323
+ result?: any;
3324
+ error?: {
3325
+ code: string;
3326
+ message: string;
3327
+ };
3328
+ userCanceled3D?: boolean;
3329
+ status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
3330
+ };
3331
+
3284
3332
  /** confirm 事件负载(统一终态,替代 approve) */
3285
3333
  export declare interface ExpressConfirmData {
3286
3334
  expressPaymentType: string;
@@ -3327,6 +3375,10 @@ export declare interface ExpressConfirmData {
3327
3375
  */
3328
3376
  export declare class ExpressElement extends BaseMainElement<ExpressElementConfig, ExpressElementEvents> {
3329
3377
  static elementType: string;
3378
+ private readonly elementTracker;
3379
+ private _mountInProgress;
3380
+ private _destroyInProgress;
3381
+ private _registeringInternalListeners;
3330
3382
  /**
3331
3383
  * Store all function-type callbacks locally, not involved in postMessage serialization
3332
3384
  */
@@ -3345,7 +3397,23 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3345
3397
  private _localHandlers;
3346
3398
  /** 支付流程进行中标志(click → confirm/error/cancel 之间) */
3347
3399
  private _paymentInProgress;
3400
+ /**
3401
+ * confirm 窗口超时标志:iframe 在 20s onTimeout 发 error(MERCHANT_CONFIRM_TIMEOUT) 时置位,
3402
+ * completePayment 入口据此立即返失败(不发 COMPLETE_PAYMENT,不进 5min 兜底)。
3403
+ * 每新一轮 confirm 事件到达时复位(见 on() 重写)。
3404
+ */
3405
+ private _confirmWindowTimedOut;
3406
+ /**
3407
+ * 是否已收到 iframe 业务层 ready 事件(app.tsx sendReady)。
3408
+ * 注意:与 host `status='ready'`(由 HANDSHAKE_ACK 触发,bridge.js:450 同步回发,与 amount 解析无关)不同。
3409
+ * 首屏 amount setupError 时 iframe 不发业务 ready → _readyReceived 保持 false,
3410
+ * 据此判别"首屏失败"以阻断后续 updateConfig。
3411
+ */
3412
+ private _readyReceived;
3413
+ /** 首屏 setupError 致命标志:置位后 updateConfig 被 CHECKOUT_NOT_READY 阻断,只能 destroy 重开。 */
3414
+ private _setupFailed;
3348
3415
  private _paypalOverlay;
3416
+ private _updateQueue;
3349
3417
  constructor(name: string, config: ExpressElementConfig);
3350
3418
  /**
3351
3419
  * 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
@@ -3357,24 +3425,29 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3357
3425
  */
3358
3426
  private _emit;
3359
3427
  updateConfig(newConfig: ExpressAppConfig): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
3428
+ private runUpdateConfig;
3429
+ private updateConfigTransaction;
3430
+ private updateAmountConfigWithSanitizedDebug;
3431
+ private getAmountValidationReason;
3432
+ /** iframe 业务 ready 事件到达:置 _readyReceived,后续运行时 error 不再视为首屏失败。
3433
+ * ready 是"本次首屏成功"的确实信号(首屏 setupError 时 iframe 不发 ready),
3434
+ * 故同时清掉 _setupFailed——unmount+remount 同实例二次首屏成功后可恢复 updateConfig。
3435
+ */
3436
+ private _handleReady;
3437
+ /** iframe error 事件:若 business ready 未到达,视为首屏 setupError → 置 _setupFailed 阻断后续 updateConfig。 */
3438
+ private _handleError;
3360
3439
  /**
3361
3440
  * 商户在 confirm 回调内调用,触发实际支付提交。
3362
3441
  * iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
3363
3442
  * 完成后通过 OPENSDK@COMPLETE_PAYMENT_RESULT 回包,Promise resolve。
3364
3443
  */
3365
- completePayment(redirect?: 'always' | 'if_required'): Promise<{
3366
- success: boolean;
3367
- result?: any;
3368
- error?: {
3369
- code: string;
3370
- message: string;
3371
- };
3372
- /** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
3373
- userCanceled3D?: boolean;
3374
- status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
3375
- }>;
3444
+ completePayment(redirect?: 'always' | 'if_required'): Promise<ExpressCompletePaymentResult>;
3445
+ private runCompletePayment;
3376
3446
  setup(): Promise<Partial<ExpressAppConfig> | undefined>;
3377
3447
  private registerInternalListeners;
3448
+ mount(container: HTMLElement): Promise<void>;
3449
+ unmount(): void;
3450
+ destroy(): void;
3378
3451
  protected focus(): void;
3379
3452
  protected blur(): void;
3380
3453
  protected clear(): void;
@@ -3446,6 +3519,11 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
3446
3519
  'OPENSDK@GET_APPLE_PAY_TOKEN': {
3447
3520
  requestId: string;
3448
3521
  expressPaymentType: string;
3522
+ /** iframe 已转好的 major unit 金额(来自 resolvedAmount);host 委托 Apple Pay 消费,不再做 minor→major 转换。 */
3523
+ walletAmount?: {
3524
+ value: string;
3525
+ currency: string;
3526
+ };
3449
3527
  };
3450
3528
  /** host 完成 Apple Pay token 获取后回包给 iframe,submit/3DS/polling 均由 webapp 完成 */
3451
3529
  'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': {
@@ -3478,6 +3556,184 @@ declare type ExpressSetupError = ErrorPayload & {
3478
3556
  mulityLanguageMapping?: boolean;
3479
3557
  };
3480
3558
 
3559
+ /**
3560
+ * @public
3561
+ * @description Express Vaulting element app config type
3562
+ */
3563
+ export declare interface ExpressVaultingAppConfig extends BaseElementAppConfig {
3564
+ /**
3565
+ * @description payment sessionData,无法通过 updateConfig 更新
3566
+ */
3567
+ sessionData?: string;
3568
+ /**
3569
+ * @description 开通的支付方式列表,本期固定为 ['PAYPAL_DIRECTDEBIT']
3570
+ */
3571
+ paymentMethods?: string[];
3572
+ /** PayPal 按钮配置 */
3573
+ paypal?: ExpressVaultingPayPalConfig;
3574
+ /** PayPal 按钮文案类型 */
3575
+ buttonType?: {
3576
+ paypal?: 'paypal' | 'checkout' | 'buynow' | 'pay';
3577
+ };
3578
+ /** 按钮统一高度(px) */
3579
+ buttonHeight?: number;
3580
+ /** PayPal 按钮主题色 */
3581
+ buttonTheme?: {
3582
+ paypal?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
3583
+ };
3584
+ }
3585
+
3586
+ /**
3587
+ * @public
3588
+ * @description cancel 事件负载
3589
+ */
3590
+ export declare interface ExpressVaultingCancelEvent {
3591
+ paymentMethodType: ExpressVaultingMethod;
3592
+ data?: unknown;
3593
+ }
3594
+
3595
+ /**
3596
+ * @public
3597
+ * @description click 事件负载
3598
+ */
3599
+ export declare interface ExpressVaultingClickEvent {
3600
+ paymentMethodType: ExpressVaultingMethod;
3601
+ }
3602
+
3603
+ /**
3604
+ * @public
3605
+ * @description confirm 事件负载(PayPal onApprove 成功后触发,商户可在回调中调 confirmVaulting)
3606
+ */
3607
+ export declare interface ExpressVaultingConfirmEvent {
3608
+ paymentMethodType: ExpressVaultingMethod;
3609
+ payerInfo?: ExpressVaultingPayerInfo;
3610
+ }
3611
+
3612
+ /**
3613
+ * @public
3614
+ * @description Express Vaulting element - PayPal 绑卡 Element
3615
+ *
3616
+ * Host 侧只保留 Element 生命周期与 bridge 连接;PayPal 按钮渲染、Braintree SDK
3617
+ * 加载、submit/inquiry 都由 express_vaulting webapp 承接。
3618
+ *
3619
+ * setup 阶段调 sdkActionQuery 拿 paypalClientToken,握手时下发给 iframe(系分
3620
+ * 4.1 节 BR-007:client token 必须来自握手,iframe 不自调 sdkActionQuery)。
3621
+ */
3622
+ export declare class ExpressVaultingElement extends BaseMainElement<ExpressVaultingElementConfig, ExpressVaultingElementEvents> {
3623
+ static elementType: string;
3624
+ /**
3625
+ * Host-side fullscreen overlay shown while the PayPal popup is open.
3626
+ *
3627
+ * PayPal Braintree vault flow renders its own popup + backdrop inside the
3628
+ * iframe body, so without a host overlay the backdrop only masks the tiny
3629
+ * button area. Mirrors ExpressElement: show on `click`, hide on
3630
+ * `confirm` / `cancel` / `error`.
3631
+ */
3632
+ private _paypalOverlay;
3633
+ constructor(name: string, config: ExpressVaultingElementConfig);
3634
+ /* Excluded from this release type: setup */
3635
+ /* Excluded from this release type: registerInternalListeners */
3636
+ protected focus(): void;
3637
+ protected blur(): void;
3638
+ protected clear(): void;
3639
+ /* Excluded from this release type: _confirmVaulting */
3640
+ }
3641
+
3642
+ /**
3643
+ * @public
3644
+ * @description Express Vaulting element config type
3645
+ */
3646
+ export declare interface ExpressVaultingElementConfig extends BaseElementConfig<ExpressVaultingAppConfig> {
3647
+ }
3648
+
3649
+ /**
3650
+ * @public
3651
+ * @description Express Vaulting element 事件类型
3652
+ */
3653
+ export declare interface ExpressVaultingElementEvents extends AntomBridgeWithNativeEventMap<ExpressVaultingAppConfig> {
3654
+ ready: ExpressVaultingReadyEvent;
3655
+ click: ExpressVaultingClickEvent;
3656
+ confirm: ExpressVaultingConfirmEvent;
3657
+ cancel: ExpressVaultingCancelEvent;
3658
+ error: ExpressVaultingErrorEvent;
3659
+ 'OPENSDK@CONFIRM_VAULTING': {
3660
+ requestId: string;
3661
+ redirect?: 'always' | 'if_required';
3662
+ };
3663
+ 'OPENSDK@CONFIRM_VAULTING_RESULT': {
3664
+ requestId: string;
3665
+ result: ExpressVaultingResult;
3666
+ };
3667
+ }
3668
+
3669
+ /**
3670
+ * @public
3671
+ * @description error 事件负载
3672
+ */
3673
+ export declare interface ExpressVaultingErrorEvent extends ErrorPayload<string> {
3674
+ paymentMethodType: ExpressVaultingMethod;
3675
+ }
3676
+
3677
+ /**
3678
+ * Supported express vaulting payment methods. All bridge event payloads carry
3679
+ * `paymentMethodType` — use this enum instead of硬编码 strings so adding a
3680
+ * new wallet only needs one entry here. Must match the iframe-side enum in
3681
+ * elements2/express_vaulting/interface.ts.
3682
+ */
3683
+ declare enum ExpressVaultingMethod {
3684
+ PAYPAL_DIRECTDEBIT = "PAYPAL_DIRECTDEBIT"
3685
+ }
3686
+
3687
+ /**
3688
+ * @public
3689
+ * @description Braintree tokenizePayment 返回的 payer 信息,随 confirm 事件透传给商户
3690
+ */
3691
+ export declare interface ExpressVaultingPayerInfo {
3692
+ payerId?: string;
3693
+ email?: string;
3694
+ firstName?: string;
3695
+ lastName?: string;
3696
+ countryCode?: string;
3697
+ phone?: string;
3698
+ }
3699
+
3700
+ /**
3701
+ * MERCHANT_CONFIRM_TIMEOUT is owned by the iframe side (mirrors express_element:
3702
+ * iframe starts a 20s timer on the `confirm` event and sends
3703
+ * `error(MERCHANT_CONFIRM_TIMEOUT)` if the merchant never calls confirmVaulting).
3704
+ * See elements2/express_vaulting/app.tsx + tools/error.ts.
3705
+ */
3706
+ /**
3707
+ * @public
3708
+ * @description PayPal 按钮配置
3709
+ */
3710
+ export declare interface ExpressVaultingPayPalConfig {
3711
+ /** 按钮形状 */
3712
+ buttonShape?: 'pill' | 'rect' | 'sharp';
3713
+ }
3714
+
3715
+ /**
3716
+ * @public
3717
+ * @description ready 事件负载
3718
+ */
3719
+ export declare interface ExpressVaultingReadyEvent {
3720
+ availablePaymentMethods: Partial<Record<ExpressVaultingMethod, boolean>>;
3721
+ }
3722
+
3723
+ /**
3724
+ * @public
3725
+ * @description confirmVaulting 返回结果
3726
+ */
3727
+ export declare interface ExpressVaultingResult {
3728
+ status: 'SUCCESS' | 'PROCESSING' | 'FAIL' | 'CANCELLED';
3729
+ paymentMethodId?: string;
3730
+ payerId?: string;
3731
+ error?: {
3732
+ code: string;
3733
+ message: string;
3734
+ };
3735
+ }
3736
+
3481
3737
  declare interface ExpSupportBank {
3482
3738
  /**
3483
3739
  * @description 银行名称
@@ -3556,6 +3812,57 @@ declare interface FrontSupportIppBank {
3556
3812
  logo?: Logo;
3557
3813
  }
3558
3814
 
3815
+ /** host 回传 webapp 的 OPENSDK@GET_APPLE_PAY_TOKEN_REPLY 形态(result 对齐老链路 {token,billingContact,shippingContact})。 */
3816
+ declare interface GetApplePayTokenReply {
3817
+ success: boolean;
3818
+ result?: {
3819
+ token?: unknown;
3820
+ billingContact?: unknown;
3821
+ shippingContact?: unknown;
3822
+ } | {
3823
+ errorCode: string;
3824
+ };
3825
+ }
3826
+
3827
+ /** webapp 传来的 OPENSDK@GET_APPLE_PAY_TOKEN payload 形态。 */
3828
+ declare interface GetApplePayTokenRequest {
3829
+ paymentMethod?: {
3830
+ paymentMethodDetail?: {
3831
+ applePayProps?: {
3832
+ paymentRequest?: unknown;
3833
+ };
3834
+ };
3835
+ };
3836
+ shipping?: unknown;
3837
+ }
3838
+
3839
+ /** host 回传 webapp 的 OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY 形态。 */
3840
+ declare interface GetGooglePayTokenReply {
3841
+ success: boolean;
3842
+ result?: unknown;
3843
+ err?: {
3844
+ statusCode?: string;
3845
+ [key: string]: unknown;
3846
+ };
3847
+ }
3848
+
3849
+ /** webapp 传来的 OPENSDK@GET_GOOGLE_PAY_TOKEN payload 形态。 */
3850
+ declare interface GetGooglePayTokenRequest {
3851
+ actionName?: string;
3852
+ data?: {
3853
+ environment?: string;
3854
+ paymentRequest?: unknown;
3855
+ paymentMethod?: unknown;
3856
+ paymentMethodDetail?: {
3857
+ googlePayProps?: {
3858
+ environment?: string;
3859
+ paymentRequest?: unknown;
3860
+ };
3861
+ };
3862
+ [key: string]: unknown;
3863
+ };
3864
+ }
3865
+
3559
3866
  declare type GetI18nQueryParam = string | {
3560
3867
  /**
3561
3868
  * 多语言文案的 key
@@ -7095,13 +7402,23 @@ export declare type PaymentAppearanceProps = {
7095
7402
  export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
7096
7403
  static elementType: string;
7097
7404
  private _paymentInProgress;
7405
+ private readonly paymentTracker;
7406
+ private _mountStartedAt;
7407
+ private _mountInProgress;
7408
+ private _mountPhase;
7409
+ private _destroyInProgress;
7410
+ private readonly walletLogger;
7098
7411
  constructor(name: string, config: PaymentElementConfig);
7099
7412
  /* Excluded from this release type: setup */
7413
+ mount(container: HTMLElement): Promise<void>;
7100
7414
  /**
7101
7415
  * @description Update payment element configuration with amount validation and appearance Rules support
7102
7416
  */
7103
7417
  updateConfig(newConfig: Partial<PaymentAppConfig>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
7104
7418
  /* Excluded from this release type: submit */
7419
+ on<T extends keyof PaymentElementEvents>(event: T, handler: (payload: PaymentElementEvents[T]) => void): void;
7420
+ unmount(): void;
7421
+ destroy(): void;
7105
7422
  protected focus(): void;
7106
7423
  protected blur(): void;
7107
7424
  protected clear(): void;
@@ -7117,6 +7434,25 @@ declare interface PaymentElementConfig extends BaseElementConfig<PaymentAppConfi
7117
7434
  * @description Payment element events
7118
7435
  */
7119
7436
  export declare interface PaymentElementEvents extends AntomBridgeWithNativeEventMap<PaymentAppConfig, PaymentSubmitParams, PaymentSubmitResult> {
7437
+ /**
7438
+ * webapp 委托 host(父 frame)拉起 Apple Pay 拿 token。
7439
+ * payload 结构对齐 ModernElementController.GetApplePayTokenRequest(放 paymentMethod/shipping)。
7440
+ */
7441
+ 'OPENSDK@GET_APPLE_PAY_TOKEN': GetApplePayTokenRequest;
7442
+ /** host 完成 Apple Pay token 获取后回包给 webapp */
7443
+ 'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': GetApplePayTokenReply;
7444
+ /**
7445
+ * webapp 委托 host(父 frame)拉起 Google Pay 拿 token。
7446
+ * payload 结构对齐 ModernElementController.GetGooglePayTokenRequest(放 data.environment/paymentRequest)。
7447
+ */
7448
+ 'OPENSDK@GET_GOOGLE_PAY_TOKEN': GetGooglePayTokenRequest;
7449
+ /** host 完成 Google Pay token 获取后回包给 webapp */
7450
+ 'OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY': GetGooglePayTokenReply;
7451
+ /** WebApp notifies the host when the selected payment method changes. */
7452
+ paymentMethodChanged: {
7453
+ type: string;
7454
+ name?: string;
7455
+ };
7120
7456
  }
7121
7457
 
7122
7458
  declare interface PaymentElementView {
@@ -24563,6 +24899,9 @@ export declare type VaultingAppearanceProps = {
24563
24899
  */
24564
24900
  export declare class VaultingElement extends BaseMainElement<VaultingElementConfig, VaultingElementEvents> {
24565
24901
  static elementType: string;
24902
+ private readonly elementTracker;
24903
+ private _mountInProgress;
24904
+ private _destroyInProgress;
24566
24905
  constructor(name: string, config: VaultingElementConfig);
24567
24906
  /* Excluded from this release type: setup */
24568
24907
  /**
@@ -24572,6 +24911,10 @@ export declare class VaultingElement extends BaseMainElement<VaultingElementConf
24572
24911
  */
24573
24912
  updateConfig(newConfig: Partial<VaultingAppConfig>): Promise<VaultingElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
24574
24913
  /* Excluded from this release type: submit */
24914
+ mount(container: HTMLElement): Promise<void>;
24915
+ on<T extends keyof VaultingElementEvents>(event: T, handler: (payload: VaultingElementEvents[T]) => void): void;
24916
+ unmount(): void;
24917
+ destroy(): void;
24575
24918
  protected focus(): void;
24576
24919
  protected blur(): void;
24577
24920
  protected clear(): void;