@alipay/ams-checkout 0.0.1788166152-dev.1 → 0.0.1788166152-dev.2
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.
- package/ams-checkout.js +3 -3
- package/dist/ams-checkout.min.js +1 -1
- package/dist/ams-checkout.min.js.map +1 -1
- package/esm/config/index.js +1 -1
- package/esm/core/component/ckp/index.js +21 -1
- package/esm/core/component/element/elementController/index.js +4 -3
- package/esm/core/component/element/modernElementController/adapter.js +3 -3
- package/esm/core/component/element/modernElementController/index.d.ts +6 -1
- package/esm/core/component/element/modernElementController/index.js +260 -189
- package/esm/core/component/element/type.d.ts +2 -2
- package/esm/foundation/service/log/keys.js +4 -0
- package/esm/index.d.ts +6 -7
- package/esm/index.js +9 -14
- package/esm/modern/core/component/element/modernElementController/index.d.ts +6 -1
- package/esm/modern/core/component/element/type.d.ts +2 -2
- package/esm/modern/index.js +1 -1
- package/esm/modern/loadAntomTracker.d.ts +7 -0
- package/esm/modern/loadAntomTracker.js +64 -0
- package/esm/modern/modern/loadAntomTracker.d.ts +7 -0
- package/esm/modern/modern/preload/preloadAntomElements.d.ts +1 -1
- package/esm/modern/modern/preload/startAntomPreload.d.ts +2 -0
- package/esm/modern/modern/sdk/applepay-core/ApplePayHostService.d.ts +1 -0
- package/esm/modern/modern/sdk/elements/CVVElement.d.ts +28 -23
- package/esm/modern/modern/sdk/elements/PaymentElement.d.ts +51 -12
- package/esm/modern/modern/sdk/elements/appearanceRules.d.ts +59 -0
- package/esm/modern/modern/sdk/elements/appearanceRulesDefaults.d.ts +2 -0
- package/esm/modern/modern/sdk/tools/expressElement/applePayHostToken.d.ts +6 -1
- package/esm/modern/modern/sdk/tools/expressElement/types.d.ts +25 -10
- package/esm/modern/modern/sdk/tools/getMetaData.d.ts +8 -1
- package/esm/modern/modern/sdk/tools/modalMessageMonitor.d.ts +41 -0
- package/esm/modern/modern/sdk/tools/paymentElement/applePayHostToken.d.ts +38 -0
- package/esm/modern/modern/sdk/tools/paymentElement/googlePayHostToken.d.ts +38 -0
- package/esm/modern/modern/sdk/tools/paymentElement/tracker.d.ts +16 -0
- package/esm/modern/modern/sdk/tools/paymentElement/walletHostListeners.d.ts +19 -0
- package/esm/modern/modern/sdk/tracking/elementTracker.d.ts +65 -0
- package/esm/modern/modern/sdk/types.d.ts +105 -10
- package/esm/modern/modern/tools.d.ts +3 -2
- package/esm/modern/preload/preloadAntomElements.d.ts +1 -1
- package/esm/modern/preload/sgPreconnection.d.ts +1 -1
- package/esm/modern/preload/startAntomPreload.d.ts +2 -0
- package/esm/modern/preload/startAntomPreload.js +9 -0
- package/esm/modern/sdk/elements/appearanceRules.d.ts +59 -0
- package/esm/modern/tools.js +1 -1
- package/esm/modern/util/timezone.d.ts +1 -0
- package/esm/modern/util/versionCompare.d.ts +1 -1
- package/esm/util/logger.js +1 -1
- package/esm/util/timezone.d.ts +1 -0
- package/esm/util/timezone.js +8 -0
- package/package.json +13 -13
- package/types.d.ts +576 -67
- package/types.untrimmed.d.ts +599 -67
package/types.untrimmed.d.ts
CHANGED
|
@@ -296,12 +296,16 @@ export declare type AntomPreloadElement = 'payment' | 'express' | 'vaulting' | '
|
|
|
296
296
|
*/
|
|
297
297
|
export declare class AntomSDK extends BaseElementsFactory {
|
|
298
298
|
static version: string;
|
|
299
|
+
private stopModalMessageMonitor;
|
|
300
|
+
private readonly apiTracker;
|
|
299
301
|
constructor(config?: AntomSDKConfig);
|
|
300
302
|
protected canUseElements(): Array<ElementListItemType>;
|
|
303
|
+
init(): Promise<this>;
|
|
301
304
|
/**
|
|
302
305
|
* @description 更新配置
|
|
303
306
|
*/
|
|
304
307
|
updateConfig(config: Partial<BaseFactoryConfig>): void;
|
|
308
|
+
destroy(): void;
|
|
305
309
|
/**
|
|
306
310
|
* @internal
|
|
307
311
|
* @param payload
|
|
@@ -318,19 +322,36 @@ export declare class AntomSDK extends BaseElementsFactory {
|
|
|
318
322
|
elements(): Elements;
|
|
319
323
|
createElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
320
324
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
321
|
-
createElement(elementType: 'CVV', options
|
|
325
|
+
createElement(elementType: 'CVV', options: CVVAppConfig): CVVElement;
|
|
322
326
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
327
|
+
createElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
|
|
323
328
|
getElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
324
329
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
325
330
|
getElement(elementType: 'CVV', options?: CVVAppConfig): CVVElement;
|
|
326
331
|
getElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
332
|
+
getElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
|
|
327
333
|
/**
|
|
328
334
|
* 从 elements 容器或直接传入的 MainElement 中提取指定类型的主元素
|
|
329
335
|
* @throws {AntomSDKError} 当无法找到有效的主元素时抛出错误
|
|
330
336
|
*/
|
|
331
337
|
private extractMainElement;
|
|
332
338
|
confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult>;
|
|
339
|
+
private runConfirmCardSetup;
|
|
333
340
|
confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult>;
|
|
341
|
+
private runConfirmPayment;
|
|
342
|
+
/**
|
|
343
|
+
* 触发 Express Vaulting element 的 PayPal 绑卡提交流程。
|
|
344
|
+
*
|
|
345
|
+
* iframe 收到 OPENSDK@CONFIRM_VAULTING 后执行 submitPay + 单次 inquiry 兜底,
|
|
346
|
+
* 完成后通过 OPENSDK@CONFIRM_VAULTING_RESULT 回包,Promise resolve。
|
|
347
|
+
*
|
|
348
|
+
* @param options.elements 已挂载的 ExpressVaultingElement 或包含它的 Elements 实例
|
|
349
|
+
* @param options.redirect 跳转策略,默认 'always',透传给 iframe
|
|
350
|
+
*/
|
|
351
|
+
confirmVaulting(options: {
|
|
352
|
+
elements: BaseMainElement | BaseElements;
|
|
353
|
+
redirect?: 'always' | 'if_required';
|
|
354
|
+
}): Promise<ExpressVaultingResult>;
|
|
334
355
|
}
|
|
335
356
|
|
|
336
357
|
/**
|
|
@@ -390,9 +411,29 @@ export declare const AntomSDKErrorCodes: {
|
|
|
390
411
|
*/
|
|
391
412
|
readonly AMOUNT_VALUE_EMPTY: "AMOUNT_VALUE_EMPTY";
|
|
392
413
|
/**
|
|
393
|
-
* @description
|
|
414
|
+
* @description 金额格式非法(仅允许 ASCII 数字字符串)
|
|
394
415
|
*/
|
|
395
416
|
readonly AMOUNT_VALUE_INVALID: "AMOUNT_VALUE_INVALID";
|
|
417
|
+
/**
|
|
418
|
+
* @description Amount currency does not match the payment session currency
|
|
419
|
+
*/
|
|
420
|
+
readonly AMOUNT_CURRENCY_MISMATCH: "AMOUNT_CURRENCY_MISMATCH";
|
|
421
|
+
/**
|
|
422
|
+
* @description Amount currency is not supported
|
|
423
|
+
*/
|
|
424
|
+
readonly AMOUNT_CURRENCY_UNSUPPORTED: "AMOUNT_CURRENCY_UNSUPPORTED";
|
|
425
|
+
/**
|
|
426
|
+
* @description Amount currency precision is not supported
|
|
427
|
+
*/
|
|
428
|
+
readonly AMOUNT_PRECISION_UNSUPPORTED: "AMOUNT_PRECISION_UNSUPPORTED";
|
|
429
|
+
/**
|
|
430
|
+
* @description Amount conversion timed out
|
|
431
|
+
*/
|
|
432
|
+
readonly AMOUNT_RESOLVE_TIMEOUT: "AMOUNT_RESOLVE_TIMEOUT";
|
|
433
|
+
/**
|
|
434
|
+
* @description Amount conversion failed
|
|
435
|
+
*/
|
|
436
|
+
readonly AMOUNT_RESOLVE_FAILED: "AMOUNT_RESOLVE_FAILED";
|
|
396
437
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
397
438
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
398
439
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -406,7 +447,9 @@ export declare const AntomSDKErrorCodes: {
|
|
|
406
447
|
readonly ELEMENT_ALREADY_REGISTERED: "ELEMENT_ALREADY_REGISTERED";
|
|
407
448
|
readonly CANNOT_CREATE_SAME_ELEMENT_TWICE: "CANNOT_CREATE_SAME_ELEMENT_TWICE";
|
|
408
449
|
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT";
|
|
409
|
-
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT";
|
|
450
|
+
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT"; /**
|
|
451
|
+
* @description 环境配置,默认为prod
|
|
452
|
+
*/
|
|
410
453
|
readonly NOT_SUPPORT_ELEMENT: "NOT_SUPPORT_ELEMENT";
|
|
411
454
|
readonly NOT_SUPPORT_SUBMIT: "NOT_SUPPORT_SUBMIT";
|
|
412
455
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
@@ -428,7 +471,11 @@ export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeo
|
|
|
428
471
|
|
|
429
472
|
export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
|
|
430
473
|
|
|
431
|
-
|
|
474
|
+
/**
|
|
475
|
+
* @deprecated Use {@link AppearanceVariables} (Token 2.0) instead.
|
|
476
|
+
* 保留仅为向后兼容,将在下一个 major 版本中删除。
|
|
477
|
+
*/
|
|
478
|
+
export declare type AntomVariables = LegacyAppearanceVariables;
|
|
432
479
|
|
|
433
480
|
/**
|
|
434
481
|
* @description SDK UI组件的外观配置。
|
|
@@ -444,12 +491,80 @@ declare interface Appearance<Props extends Partial<DefaultAppearanceProps> = Def
|
|
|
444
491
|
fonts?: FontSource[];
|
|
445
492
|
}
|
|
446
493
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
494
|
+
/** Target-level layout declarations admitted before runtime capability intersection. */
|
|
495
|
+
export declare type AppearanceLayoutDeclarations = {
|
|
496
|
+
[Property in Exclude<AppearanceLayoutProperty, 'height'>]?: AppearanceSpacingValue;
|
|
497
|
+
} & {
|
|
498
|
+
/** Exact integer-pixel enum allocated by the target contract. */
|
|
499
|
+
readonly height?: `${number}px`;
|
|
451
500
|
};
|
|
452
501
|
|
|
502
|
+
/** Controlled layout longhands intersected with the concrete Part at runtime. */
|
|
503
|
+
export declare type AppearanceLayoutProperty = 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'height';
|
|
504
|
+
|
|
505
|
+
/** Paint declarations accepted before WebApp and Components runtime validation. */
|
|
506
|
+
declare type AppearancePaintDeclarations = Partial<Record<Exclude<AppearancePaintProperty, 'fillOpacity' | 'strokeOpacity' | 'strokeWidth' | 'textDecorationStyle' | 'outlineStyle'>, string> & Record<'fillOpacity' | 'strokeOpacity' | 'strokeWidth', string | number> & {
|
|
507
|
+
textDecorationStyle: '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | 'dashed' | 'dotted' | 'double' | 'solid' | 'wavy';
|
|
508
|
+
outlineStyle: '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | 'auto' | 'dashed' | 'dotted' | 'double' | 'groove' | 'inset' | 'none' | 'outset' | 'ridge' | 'solid';
|
|
509
|
+
}>;
|
|
510
|
+
|
|
511
|
+
/** Paint-only property names exposed by the SDK contract. */
|
|
512
|
+
export declare type AppearancePaintProperty = 'color' | 'WebkitTextFillColor' | 'textDecorationColor' | 'textDecorationLine' | 'textDecorationStyle' | 'textShadow' | 'backgroundColor' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'borderRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomRightRadius' | 'borderBottomLeftRadius' | 'borderStyle' | 'boxShadow' | 'fill' | 'stroke' | 'fillOpacity' | 'strokeOpacity' | 'strokeWidth' | 'outlineColor' | 'outlineStyle' | 'outlineWidth' | 'outlineOffset' | 'caretColor' | 'accentColor';
|
|
513
|
+
|
|
514
|
+
/** Paint declarations plus controlled typography and target-level layout fields. */
|
|
515
|
+
declare type AppearanceRuleDeclarations = AppearancePaintDeclarations & AppearanceLayoutDeclarations & {
|
|
516
|
+
/** Single font family identifier admitted only for authorized targets at runtime. */
|
|
517
|
+
readonly fontFamily?: string;
|
|
518
|
+
/** Integer pixel size admitted only for authorized text targets at runtime. */
|
|
519
|
+
readonly fontSize?: `${number}px`;
|
|
520
|
+
/** Controlled font weight admitted only for authorized text targets at runtime. */
|
|
521
|
+
readonly fontWeight?: 400 | 500 | 600 | 700;
|
|
522
|
+
/** Controlled font style admitted only for authorized text targets at runtime. */
|
|
523
|
+
readonly fontStyle?: 'normal' | 'italic';
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
/** Controlled pseudo-class accepted by the merchant selector grammar. */
|
|
527
|
+
declare type AppearanceRulePseudoClass = 'autofill';
|
|
528
|
+
|
|
529
|
+
/** Controlled pseudo-element accepted by the merchant selector grammar. */
|
|
530
|
+
declare type AppearanceRulePseudoElement = 'placeholder' | 'selection';
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Optional state or controlled pseudo suffix on one alias.
|
|
534
|
+
*/
|
|
535
|
+
export declare type AppearanceRuleScopeSuffix = '' | `:${AppearanceRuleState | AppearanceRulePseudoClass}` | `::${AppearanceRulePseudoElement}`;
|
|
536
|
+
|
|
537
|
+
/** One merchant alias with an optional semantic suffix. */
|
|
538
|
+
export declare type AppearanceRuleSelector<RuleAlias extends string> = `${RuleAlias}${AppearanceRuleScopeSuffix}`;
|
|
539
|
+
|
|
540
|
+
/** Semantic states accepted by the merchant selector grammar. */
|
|
541
|
+
declare type AppearanceRuleState = 'hover' | 'focus' | 'focus-visible' | 'active' | 'disabled' | 'loading' | 'selected' | 'checked' | 'expanded' | 'invalid' | 'success' | 'error';
|
|
542
|
+
|
|
543
|
+
/** Backward-compatible name for the Express appearance configuration. */
|
|
544
|
+
export declare type AppearanceSetting = ExpressAppearance;
|
|
545
|
+
|
|
546
|
+
/** Exact official spacing Token accepted by controlled margin and padding. */
|
|
547
|
+
export declare type AppearanceSpacingToken = `var(--spacing-${'base' | 'none' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'})`;
|
|
548
|
+
|
|
549
|
+
/** Runtime-constrained non-negative integer pixel value for spacing longhands. */
|
|
550
|
+
export declare type AppearanceSpacingValue = '0' | `${number}px` | AppearanceSpacingToken;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* 对客公开 appearance variables 类型(Token 2.x,figma-v4「3 层 + 状态」命名)。
|
|
554
|
+
* 字段名为新 CSS 变量名去掉 '--' 前缀(如 color-text-primary)。
|
|
555
|
+
*
|
|
556
|
+
* 权威源:`antom-web-checkout-v2/packages/elements2/src/utils/themeConfig.ts` 的 `PUBLIC_TOKENS`
|
|
557
|
+
* (54 color + 4 radius + 10 spacing = 68 项)。本 union 是该清单的手工镜像,
|
|
558
|
+
* 增删 token 时必须两侧同步,否则商户会遇到「类型报错但运行时可用」的错位。
|
|
559
|
+
*
|
|
560
|
+
* 命名规则:`--color-<scene>-<level>[-<state>]`;brand 场景并入 scene 段的 camelCase
|
|
561
|
+
* (如 `color-backgroundBrand-primary-hover`),CSS 变量大小写敏感,不可改写为 kebab。
|
|
562
|
+
*
|
|
563
|
+
* @example
|
|
564
|
+
* variables: { 'color-text-primary': '#2a3a52', 'radius-sm': '4px' }
|
|
565
|
+
*/
|
|
566
|
+
export declare type AppearanceVariables = 'color-background-primary' | 'color-background-primary-hover' | 'color-background-primary-active' | 'color-background-secondary' | 'color-background-secondary-hover' | 'color-background-secondary-active' | 'color-background-layout' | 'color-background-inverse' | 'color-background-disabled' | 'color-background-transparency' | 'color-background-mask' | 'color-background-success' | 'color-background-warning' | 'color-background-danger' | 'color-background-info' | 'color-background-neutral' | 'color-background-promotional' | 'color-backgroundBrand-primary' | 'color-backgroundBrand-primary-hover' | 'color-backgroundBrand-secondary' | 'color-backgroundBrand-secondary-hover' | 'color-backgroundBrand-tertiary' | 'color-backgroundBrand-disabled' | 'color-text-primary' | 'color-text-secondary' | 'color-text-tertiary' | 'color-text-inverse' | 'color-text-active' | 'color-text-disabled' | 'color-text-success' | 'color-text-warning' | 'color-text-danger' | 'color-text-info' | 'color-text-neutral' | 'color-text-promotional' | 'color-textBrand-primary' | 'color-textBrand-secondary' | 'color-textBrand-secondary-hover' | 'color-textBrand-disabled' | 'color-border-primary' | 'color-border-secondary' | 'color-border-inverse' | 'color-border-active' | 'color-border-subtle' | 'color-border-disabled' | 'color-border-success' | 'color-border-warning' | 'color-border-danger' | 'color-border-info' | 'color-border-neutral' | 'color-border-promotional' | 'color-borderBrand-primary' | 'color-borderBrand-primary-hover' | 'color-borderBrand-disabled' | 'radius-sm' | 'radius-md' | 'radius-lg' | 'radius-xl' | 'spacing-base' | 'spacing-none' | 'spacing-2xs' | 'spacing-xs' | 'spacing-sm' | 'spacing-md' | 'spacing-lg' | 'spacing-xl' | 'spacing-2xl' | 'spacing-3xl';
|
|
567
|
+
|
|
453
568
|
declare interface AppleMerchantInfo {
|
|
454
569
|
/**
|
|
455
570
|
* @description Apple商户ID
|
|
@@ -838,10 +953,6 @@ declare interface BankInfo {
|
|
|
838
953
|
hasSchemaUrl?: boolean;
|
|
839
954
|
}
|
|
840
955
|
|
|
841
|
-
declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
842
|
-
appearance?: A;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
956
|
/**
|
|
846
957
|
* @description 内置基础的桥接事件映射类型
|
|
847
958
|
*/
|
|
@@ -2461,18 +2572,22 @@ export declare interface ConfirmCardSetupOptions {
|
|
|
2461
2572
|
redirect?: 'always' | 'if_required';
|
|
2462
2573
|
}
|
|
2463
2574
|
|
|
2464
|
-
export declare
|
|
2465
|
-
sessionData: string;
|
|
2466
|
-
/**
|
|
2467
|
-
* @description 传入已挂载的 CVVElement / PaymentElement / Elements 实例,不传则使用无 UI 自动提交模式
|
|
2468
|
-
*/
|
|
2469
|
-
elements?: BaseMainElement | BaseElements;
|
|
2575
|
+
export declare type ConfirmPaymentOptions = PaymentSubmitParams & {
|
|
2470
2576
|
appearance?: CVVAppearance;
|
|
2471
2577
|
/**
|
|
2472
2578
|
* @description 集成用户自定义信息(如 cardHolderName)
|
|
2473
2579
|
*/
|
|
2474
2580
|
params?: Record<string, unknown>;
|
|
2475
|
-
}
|
|
2581
|
+
} & ({
|
|
2582
|
+
/** 已挂载的 Element;确认时使用其创建时绑定的会话。 */
|
|
2583
|
+
elements: BaseMainElement | BaseElements;
|
|
2584
|
+
/** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
2585
|
+
sessionData?: string;
|
|
2586
|
+
} | {
|
|
2587
|
+
elements?: undefined;
|
|
2588
|
+
/** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
2589
|
+
sessionData: string;
|
|
2590
|
+
});
|
|
2476
2591
|
|
|
2477
2592
|
/**
|
|
2478
2593
|
* @description Connect流程参数
|
|
@@ -2609,11 +2724,13 @@ declare interface CustomFontSource {
|
|
|
2609
2724
|
* @public
|
|
2610
2725
|
* @description CVV element app config type
|
|
2611
2726
|
*/
|
|
2612
|
-
export declare interface CVVAppConfig extends
|
|
2727
|
+
export declare interface CVVAppConfig extends BaseElementAppConfig {
|
|
2728
|
+
/** CVV appearance configuration including optional alias-only Rules. */
|
|
2729
|
+
appearance?: CVVAppearance;
|
|
2613
2730
|
/**
|
|
2614
|
-
* @description
|
|
2731
|
+
* @description 创建时必填的支付会话;不可通过 updateConfig 或 submit 替换
|
|
2615
2732
|
*/
|
|
2616
|
-
sessionData
|
|
2733
|
+
sessionData: string;
|
|
2617
2734
|
/**
|
|
2618
2735
|
* @internal sessionConfig 渲染数据,内部使用,无需用户传递
|
|
2619
2736
|
*/
|
|
@@ -2645,12 +2762,13 @@ export declare interface CVVAppConfig extends BaseAppearance<CVVAppearance>, Bas
|
|
|
2645
2762
|
paymentFlow?: 'automatic' | 'cvv';
|
|
2646
2763
|
}
|
|
2647
2764
|
|
|
2648
|
-
export declare type CVVAppearance =
|
|
2765
|
+
export declare type CVVAppearance = PickAntomAppearance<CVVAppearanceProps>;
|
|
2649
2766
|
|
|
2650
2767
|
export declare type CVVAppearanceProps = {
|
|
2651
2768
|
theme: AntomTheme;
|
|
2652
|
-
variables: AntomVariables;
|
|
2769
|
+
variables: AppearanceVariables | AntomVariables;
|
|
2653
2770
|
fonts?: FontSource[];
|
|
2771
|
+
rules: AppearanceRuleSelector<string>;
|
|
2654
2772
|
};
|
|
2655
2773
|
|
|
2656
2774
|
/**
|
|
@@ -2658,15 +2776,30 @@ export declare type CVVAppearanceProps = {
|
|
|
2658
2776
|
*/
|
|
2659
2777
|
export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVElementEvents> {
|
|
2660
2778
|
static elementType: string;
|
|
2779
|
+
private readonly sessionData;
|
|
2780
|
+
private readonly elementTracker;
|
|
2781
|
+
private _mountInProgress;
|
|
2782
|
+
private _destroyInProgress;
|
|
2661
2783
|
constructor(name: string, config: CVVElementConfig);
|
|
2662
2784
|
/**
|
|
2663
2785
|
* @internal
|
|
2664
2786
|
*/
|
|
2665
2787
|
setup(): Promise<Partial<CVVAppConfig> | undefined>;
|
|
2788
|
+
/**
|
|
2789
|
+
* @internal Not supported by the public CVV integration API.
|
|
2790
|
+
* Updates appearance only, preserving the Rules clear semantics.
|
|
2791
|
+
* @param newConfig Appearance configuration patch.
|
|
2792
|
+
* @returns The WebApp update acknowledgement.
|
|
2793
|
+
*/
|
|
2794
|
+
updateConfig(newConfig: Pick<CVVAppConfig, 'appearance'>): Promise<CVVElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
2666
2795
|
/**
|
|
2667
2796
|
* @internal
|
|
2668
2797
|
*/
|
|
2669
2798
|
submit(data?: CVVSubmitParams): Promise<SubmitResult>;
|
|
2799
|
+
mount(container: HTMLElement): Promise<void>;
|
|
2800
|
+
on<T extends keyof CVVElementEvents>(event: T, handler: (payload: CVVElementEvents[T]) => void): void;
|
|
2801
|
+
unmount(): void;
|
|
2802
|
+
destroy(): void;
|
|
2670
2803
|
protected focus(): void;
|
|
2671
2804
|
protected blur(): void;
|
|
2672
2805
|
protected clear(): void;
|
|
@@ -2677,20 +2810,10 @@ export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVEle
|
|
|
2677
2810
|
* @description CVV element config type
|
|
2678
2811
|
*/
|
|
2679
2812
|
export declare interface CVVElementConfig extends BaseElementConfig<CVVAppConfig> {
|
|
2813
|
+
appConfig: CVVAppConfig;
|
|
2680
2814
|
}
|
|
2681
2815
|
|
|
2682
|
-
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams
|
|
2683
|
-
/**
|
|
2684
|
-
* @description Emitted event about form
|
|
2685
|
-
*/
|
|
2686
|
-
form: {
|
|
2687
|
-
errors?: Array<{
|
|
2688
|
-
field: string | number;
|
|
2689
|
-
message: string;
|
|
2690
|
-
currentValue: any;
|
|
2691
|
-
}>;
|
|
2692
|
-
message: string;
|
|
2693
|
-
};
|
|
2816
|
+
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams & Pick<CVVAppConfig, 'sessionData'>> {
|
|
2694
2817
|
/**
|
|
2695
2818
|
* @description Emitted when the element is destroy
|
|
2696
2819
|
*/
|
|
@@ -2734,10 +2857,6 @@ export declare type CVVSubmitErrorCodes = 'NOT_FIND_MAINELEMENT' | 'SESSION_DATA
|
|
|
2734
2857
|
* @description CVV 支付提交参数
|
|
2735
2858
|
*/
|
|
2736
2859
|
export declare interface CVVSubmitParams {
|
|
2737
|
-
/**
|
|
2738
|
-
* 支付会话数据
|
|
2739
|
-
*/
|
|
2740
|
-
sessionData?: string;
|
|
2741
2860
|
/**
|
|
2742
2861
|
* 重定向策略
|
|
2743
2862
|
*/
|
|
@@ -3421,8 +3540,12 @@ declare interface ElementPluginChangeStates {
|
|
|
3421
3540
|
declare type ElementPluginNameEnum = 'SET_STATE' | 'PASSIVE_SET_STATE';
|
|
3422
3541
|
|
|
3423
3542
|
declare class Elements extends BaseElements {
|
|
3543
|
+
private readonly apiTracker;
|
|
3424
3544
|
protected canUseElements(): Array<ElementListItemType>;
|
|
3425
3545
|
constructor(config: BaseElementsConfig);
|
|
3546
|
+
init(): Promise<this>;
|
|
3547
|
+
updateConfig(config: Partial<BaseElementsConfig>): void;
|
|
3548
|
+
destroy(): void;
|
|
3426
3549
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
3427
3550
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
3428
3551
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
@@ -3550,20 +3673,21 @@ declare interface ExpPaymentOptionDetail {
|
|
|
3550
3673
|
* @public
|
|
3551
3674
|
* @description Express element app config type
|
|
3552
3675
|
*/
|
|
3553
|
-
export declare interface ExpressAppConfig extends
|
|
3676
|
+
export declare interface ExpressAppConfig extends BaseElementAppConfig {
|
|
3677
|
+
/** Express appearance configuration. */
|
|
3678
|
+
appearance?: ExpressAppearance;
|
|
3554
3679
|
/** payment SessionData */
|
|
3555
3680
|
sessionData?: string;
|
|
3556
|
-
/** Business division (country/region) */
|
|
3557
|
-
businessDivision?: string;
|
|
3558
3681
|
/**
|
|
3559
3682
|
* Amount & Currency
|
|
3560
3683
|
*
|
|
3561
|
-
*
|
|
3562
|
-
*
|
|
3563
|
-
*
|
|
3684
|
+
* For Apple Pay and Google Pay, `value` is a positive ASCII digit string in
|
|
3685
|
+
* the payment session currency's minor unit; `currency` may be omitted.
|
|
3686
|
+
* For example, USD 10.99 is passed as `{ value: '1099' }`.
|
|
3687
|
+
* PayPal keeps its existing major-unit amount semantics and requires `currency`.
|
|
3564
3688
|
*/
|
|
3565
3689
|
amount?: {
|
|
3566
|
-
currency
|
|
3690
|
+
currency?: string;
|
|
3567
3691
|
value: string;
|
|
3568
3692
|
};
|
|
3569
3693
|
/** PayPal 配置 */
|
|
@@ -3619,6 +3743,17 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3619
3743
|
doMain?: string;
|
|
3620
3744
|
}
|
|
3621
3745
|
|
|
3746
|
+
/** Express element appearance configuration. */
|
|
3747
|
+
declare type ExpressAppearance = PickAntomAppearance<ExpressAppearanceProps>;
|
|
3748
|
+
|
|
3749
|
+
/** Express element appearance properties. */
|
|
3750
|
+
export declare type ExpressAppearanceProps = {
|
|
3751
|
+
displaySetting: 'showCardBrandIcon';
|
|
3752
|
+
theme: 'light' | 'dark';
|
|
3753
|
+
layout: 'accordion' | 'tabs';
|
|
3754
|
+
rules: AppearanceRuleSelector<string>;
|
|
3755
|
+
};
|
|
3756
|
+
|
|
3622
3757
|
/** cancel 事件负载 */
|
|
3623
3758
|
export declare interface ExpressCancelEvent {
|
|
3624
3759
|
expressPaymentType: string;
|
|
@@ -3630,6 +3765,17 @@ export declare interface ExpressClickEvent {
|
|
|
3630
3765
|
expressPaymentType: string;
|
|
3631
3766
|
}
|
|
3632
3767
|
|
|
3768
|
+
declare type ExpressCompletePaymentResult = {
|
|
3769
|
+
success: boolean;
|
|
3770
|
+
result?: any;
|
|
3771
|
+
error?: {
|
|
3772
|
+
code: string;
|
|
3773
|
+
message: string;
|
|
3774
|
+
};
|
|
3775
|
+
userCanceled3D?: boolean;
|
|
3776
|
+
status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
|
|
3777
|
+
};
|
|
3778
|
+
|
|
3633
3779
|
/** confirm 事件负载(统一终态,替代 approve) */
|
|
3634
3780
|
export declare interface ExpressConfirmData {
|
|
3635
3781
|
expressPaymentType: string;
|
|
@@ -3676,6 +3822,10 @@ export declare interface ExpressConfirmData {
|
|
|
3676
3822
|
*/
|
|
3677
3823
|
export declare class ExpressElement extends BaseMainElement<ExpressElementConfig, ExpressElementEvents> {
|
|
3678
3824
|
static elementType: string;
|
|
3825
|
+
private readonly elementTracker;
|
|
3826
|
+
private _mountInProgress;
|
|
3827
|
+
private _destroyInProgress;
|
|
3828
|
+
private _registeringInternalListeners;
|
|
3679
3829
|
/**
|
|
3680
3830
|
* Store all function-type callbacks locally, not involved in postMessage serialization
|
|
3681
3831
|
*/
|
|
@@ -3694,7 +3844,23 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3694
3844
|
private _localHandlers;
|
|
3695
3845
|
/** 支付流程进行中标志(click → confirm/error/cancel 之间) */
|
|
3696
3846
|
private _paymentInProgress;
|
|
3847
|
+
/**
|
|
3848
|
+
* confirm 窗口超时标志:iframe 在 20s onTimeout 发 error(MERCHANT_CONFIRM_TIMEOUT) 时置位,
|
|
3849
|
+
* completePayment 入口据此立即返失败(不发 COMPLETE_PAYMENT,不进 5min 兜底)。
|
|
3850
|
+
* 每新一轮 confirm 事件到达时复位(见 on() 重写)。
|
|
3851
|
+
*/
|
|
3852
|
+
private _confirmWindowTimedOut;
|
|
3853
|
+
/**
|
|
3854
|
+
* 是否已收到 iframe 业务层 ready 事件(app.tsx sendReady)。
|
|
3855
|
+
* 注意:与 host `status='ready'`(由 HANDSHAKE_ACK 触发,bridge.js:450 同步回发,与 amount 解析无关)不同。
|
|
3856
|
+
* 首屏 amount setupError 时 iframe 不发业务 ready → _readyReceived 保持 false,
|
|
3857
|
+
* 据此判别"首屏失败"以阻断后续 updateConfig。
|
|
3858
|
+
*/
|
|
3859
|
+
private _readyReceived;
|
|
3860
|
+
/** 首屏 setupError 致命标志:置位后 updateConfig 被 CHECKOUT_NOT_READY 阻断,只能 destroy 重开。 */
|
|
3861
|
+
private _setupFailed;
|
|
3697
3862
|
private _paypalOverlay;
|
|
3863
|
+
private _updateQueue;
|
|
3698
3864
|
constructor(name: string, config: ExpressElementConfig);
|
|
3699
3865
|
/**
|
|
3700
3866
|
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
@@ -3705,24 +3871,30 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3705
3871
|
* 用于 Native WebView 场景下 SDK 需要向商户透传跳转信息等。
|
|
3706
3872
|
*/
|
|
3707
3873
|
private _emit;
|
|
3708
|
-
updateConfig(newConfig:
|
|
3874
|
+
updateConfig(newConfig: ExpressAppConfig): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3875
|
+
private runUpdateConfig;
|
|
3876
|
+
private updateConfigTransaction;
|
|
3877
|
+
private updateAmountConfigWithSanitizedDebug;
|
|
3878
|
+
private getAmountValidationReason;
|
|
3879
|
+
/** iframe 业务 ready 事件到达:置 _readyReceived,后续运行时 error 不再视为首屏失败。
|
|
3880
|
+
* ready 是"本次首屏成功"的确实信号(首屏 setupError 时 iframe 不发 ready),
|
|
3881
|
+
* 故同时清掉 _setupFailed——unmount+remount 同实例二次首屏成功后可恢复 updateConfig。
|
|
3882
|
+
*/
|
|
3883
|
+
private _handleReady;
|
|
3884
|
+
/** iframe error 事件:若 business ready 未到达,视为首屏 setupError → 置 _setupFailed 阻断后续 updateConfig。 */
|
|
3885
|
+
private _handleError;
|
|
3709
3886
|
/**
|
|
3710
3887
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3711
3888
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
3712
3889
|
* 完成后通过 OPENSDK@COMPLETE_PAYMENT_RESULT 回包,Promise resolve。
|
|
3713
3890
|
*/
|
|
3714
|
-
completePayment(redirect?: 'always' | 'if_required'): Promise<
|
|
3715
|
-
|
|
3716
|
-
result?: any;
|
|
3717
|
-
error?: {
|
|
3718
|
-
code: string;
|
|
3719
|
-
message: string;
|
|
3720
|
-
};
|
|
3721
|
-
/** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
|
|
3722
|
-
userCanceled3D?: boolean;
|
|
3723
|
-
}>;
|
|
3891
|
+
completePayment(redirect?: 'always' | 'if_required'): Promise<ExpressCompletePaymentResult>;
|
|
3892
|
+
private runCompletePayment;
|
|
3724
3893
|
setup(): Promise<Partial<ExpressAppConfig> | undefined>;
|
|
3725
3894
|
private registerInternalListeners;
|
|
3895
|
+
mount(container: HTMLElement): Promise<void>;
|
|
3896
|
+
unmount(): void;
|
|
3897
|
+
destroy(): void;
|
|
3726
3898
|
protected focus(): void;
|
|
3727
3899
|
protected blur(): void;
|
|
3728
3900
|
protected clear(): void;
|
|
@@ -3794,6 +3966,11 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3794
3966
|
'OPENSDK@GET_APPLE_PAY_TOKEN': {
|
|
3795
3967
|
requestId: string;
|
|
3796
3968
|
expressPaymentType: string;
|
|
3969
|
+
/** iframe 已转好的 major unit 金额(来自 resolvedAmount);host 委托 Apple Pay 消费,不再做 minor→major 转换。 */
|
|
3970
|
+
walletAmount?: {
|
|
3971
|
+
value: string;
|
|
3972
|
+
currency: string;
|
|
3973
|
+
};
|
|
3797
3974
|
};
|
|
3798
3975
|
/** host 完成 Apple Pay token 获取后回包给 iframe,submit/3DS/polling 均由 webapp 完成 */
|
|
3799
3976
|
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': {
|
|
@@ -3826,6 +4003,201 @@ declare type ExpressSetupError = ErrorPayload & {
|
|
|
3826
4003
|
mulityLanguageMapping?: boolean;
|
|
3827
4004
|
};
|
|
3828
4005
|
|
|
4006
|
+
/**
|
|
4007
|
+
* @public
|
|
4008
|
+
* @description Express Vaulting element app config type
|
|
4009
|
+
*/
|
|
4010
|
+
export declare interface ExpressVaultingAppConfig extends BaseElementAppConfig {
|
|
4011
|
+
/**
|
|
4012
|
+
* @description payment sessionData,无法通过 updateConfig 更新
|
|
4013
|
+
*/
|
|
4014
|
+
sessionData?: string;
|
|
4015
|
+
/**
|
|
4016
|
+
* @description 开通的支付方式列表,本期固定为 ['PAYPAL_DIRECTDEBIT']
|
|
4017
|
+
*/
|
|
4018
|
+
paymentMethods?: string[];
|
|
4019
|
+
/** PayPal 按钮配置 */
|
|
4020
|
+
paypal?: ExpressVaultingPayPalConfig;
|
|
4021
|
+
/** PayPal 按钮文案类型 */
|
|
4022
|
+
buttonType?: {
|
|
4023
|
+
paypal?: 'paypal' | 'checkout' | 'buynow' | 'pay';
|
|
4024
|
+
};
|
|
4025
|
+
/** 按钮统一高度(px) */
|
|
4026
|
+
buttonHeight?: number;
|
|
4027
|
+
/** PayPal 按钮主题色 */
|
|
4028
|
+
buttonTheme?: {
|
|
4029
|
+
paypal?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
4030
|
+
};
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
/**
|
|
4034
|
+
* @public
|
|
4035
|
+
* @description cancel 事件负载
|
|
4036
|
+
*/
|
|
4037
|
+
export declare interface ExpressVaultingCancelEvent {
|
|
4038
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
4039
|
+
data?: unknown;
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
/**
|
|
4043
|
+
* @public
|
|
4044
|
+
* @description click 事件负载
|
|
4045
|
+
*/
|
|
4046
|
+
export declare interface ExpressVaultingClickEvent {
|
|
4047
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
/**
|
|
4051
|
+
* @public
|
|
4052
|
+
* @description confirm 事件负载(PayPal onApprove 成功后触发,商户可在回调中调 confirmVaulting)
|
|
4053
|
+
*/
|
|
4054
|
+
export declare interface ExpressVaultingConfirmEvent {
|
|
4055
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
4056
|
+
payerInfo?: ExpressVaultingPayerInfo;
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
/**
|
|
4060
|
+
* @public
|
|
4061
|
+
* @description Express Vaulting element - PayPal 绑卡 Element
|
|
4062
|
+
*
|
|
4063
|
+
* Host 侧只保留 Element 生命周期与 bridge 连接;PayPal 按钮渲染、Braintree SDK
|
|
4064
|
+
* 加载、submit/inquiry 都由 express_vaulting webapp 承接。
|
|
4065
|
+
*
|
|
4066
|
+
* setup 阶段调 sdkActionQuery 拿 paypalClientToken,握手时下发给 iframe(系分
|
|
4067
|
+
* 4.1 节 BR-007:client token 必须来自握手,iframe 不自调 sdkActionQuery)。
|
|
4068
|
+
*/
|
|
4069
|
+
export declare class ExpressVaultingElement extends BaseMainElement<ExpressVaultingElementConfig, ExpressVaultingElementEvents> {
|
|
4070
|
+
static elementType: string;
|
|
4071
|
+
/**
|
|
4072
|
+
* Host-side fullscreen overlay shown while the PayPal popup is open.
|
|
4073
|
+
*
|
|
4074
|
+
* PayPal Braintree vault flow renders its own popup + backdrop inside the
|
|
4075
|
+
* iframe body, so without a host overlay the backdrop only masks the tiny
|
|
4076
|
+
* button area. Mirrors ExpressElement: show on `click`, hide on
|
|
4077
|
+
* `confirm` / `cancel` / `error`.
|
|
4078
|
+
*/
|
|
4079
|
+
private _paypalOverlay;
|
|
4080
|
+
constructor(name: string, config: ExpressVaultingElementConfig);
|
|
4081
|
+
/**
|
|
4082
|
+
* @internal
|
|
4083
|
+
* 握手前调 sdkActionQuery 拿 paypalClientToken,连同按钮样式一起打包下发给 iframe。
|
|
4084
|
+
* 失败时以 setupError 形式返回,iframe 侧读取后透传 error 事件。
|
|
4085
|
+
*/
|
|
4086
|
+
setup(): Promise<Partial<ExpressVaultingAppConfig> | undefined>;
|
|
4087
|
+
/**
|
|
4088
|
+
* @internal
|
|
4089
|
+
* Host-side bridge listeners. Only the PayPal overlay lifecycle here —
|
|
4090
|
+
* show when the PayPal popup opens (click), hide when it closes
|
|
4091
|
+
* (confirm / cancel / error). Mirrors ExpressElement's overlay handling.
|
|
4092
|
+
*/
|
|
4093
|
+
private registerInternalListeners;
|
|
4094
|
+
protected focus(): void;
|
|
4095
|
+
protected blur(): void;
|
|
4096
|
+
protected clear(): void;
|
|
4097
|
+
/**
|
|
4098
|
+
* @internal
|
|
4099
|
+
* 由 SDK 容器(antom.ts.confirmVaulting)调用,向 iframe 发送 CONFIRM_VAULTING
|
|
4100
|
+
* 指令并等待 CONFIRM_VAULTING_RESULT 回包。iframe 侧执行 submitPay + 单次 inquiry
|
|
4101
|
+
* 兜底后回包终态结果。
|
|
4102
|
+
*/
|
|
4103
|
+
_confirmVaulting(redirect?: 'always' | 'if_required'): Promise<ExpressVaultingResult>;
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
/**
|
|
4107
|
+
* @public
|
|
4108
|
+
* @description Express Vaulting element config type
|
|
4109
|
+
*/
|
|
4110
|
+
export declare interface ExpressVaultingElementConfig extends BaseElementConfig<ExpressVaultingAppConfig> {
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
/**
|
|
4114
|
+
* @public
|
|
4115
|
+
* @description Express Vaulting element 事件类型
|
|
4116
|
+
*/
|
|
4117
|
+
export declare interface ExpressVaultingElementEvents extends AntomBridgeWithNativeEventMap<ExpressVaultingAppConfig> {
|
|
4118
|
+
ready: ExpressVaultingReadyEvent;
|
|
4119
|
+
click: ExpressVaultingClickEvent;
|
|
4120
|
+
confirm: ExpressVaultingConfirmEvent;
|
|
4121
|
+
cancel: ExpressVaultingCancelEvent;
|
|
4122
|
+
error: ExpressVaultingErrorEvent;
|
|
4123
|
+
'OPENSDK@CONFIRM_VAULTING': {
|
|
4124
|
+
requestId: string;
|
|
4125
|
+
redirect?: 'always' | 'if_required';
|
|
4126
|
+
};
|
|
4127
|
+
'OPENSDK@CONFIRM_VAULTING_RESULT': {
|
|
4128
|
+
requestId: string;
|
|
4129
|
+
result: ExpressVaultingResult;
|
|
4130
|
+
};
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
/**
|
|
4134
|
+
* @public
|
|
4135
|
+
* @description error 事件负载
|
|
4136
|
+
*/
|
|
4137
|
+
export declare interface ExpressVaultingErrorEvent extends ErrorPayload<string> {
|
|
4138
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
4139
|
+
}
|
|
4140
|
+
|
|
4141
|
+
/**
|
|
4142
|
+
* Supported express vaulting payment methods. All bridge event payloads carry
|
|
4143
|
+
* `paymentMethodType` — use this enum instead of硬编码 strings so adding a
|
|
4144
|
+
* new wallet only needs one entry here. Must match the iframe-side enum in
|
|
4145
|
+
* elements2/express_vaulting/interface.ts.
|
|
4146
|
+
*/
|
|
4147
|
+
declare enum ExpressVaultingMethod {
|
|
4148
|
+
PAYPAL_DIRECTDEBIT = "PAYPAL_DIRECTDEBIT"
|
|
4149
|
+
}
|
|
4150
|
+
|
|
4151
|
+
/**
|
|
4152
|
+
* @public
|
|
4153
|
+
* @description Braintree tokenizePayment 返回的 payer 信息,随 confirm 事件透传给商户
|
|
4154
|
+
*/
|
|
4155
|
+
export declare interface ExpressVaultingPayerInfo {
|
|
4156
|
+
payerId?: string;
|
|
4157
|
+
email?: string;
|
|
4158
|
+
firstName?: string;
|
|
4159
|
+
lastName?: string;
|
|
4160
|
+
countryCode?: string;
|
|
4161
|
+
phone?: string;
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
/**
|
|
4165
|
+
* MERCHANT_CONFIRM_TIMEOUT is owned by the iframe side (mirrors express_element:
|
|
4166
|
+
* iframe starts a 20s timer on the `confirm` event and sends
|
|
4167
|
+
* `error(MERCHANT_CONFIRM_TIMEOUT)` if the merchant never calls confirmVaulting).
|
|
4168
|
+
* See elements2/express_vaulting/app.tsx + tools/error.ts.
|
|
4169
|
+
*/
|
|
4170
|
+
/**
|
|
4171
|
+
* @public
|
|
4172
|
+
* @description PayPal 按钮配置
|
|
4173
|
+
*/
|
|
4174
|
+
export declare interface ExpressVaultingPayPalConfig {
|
|
4175
|
+
/** 按钮形状 */
|
|
4176
|
+
buttonShape?: 'pill' | 'rect' | 'sharp';
|
|
4177
|
+
}
|
|
4178
|
+
|
|
4179
|
+
/**
|
|
4180
|
+
* @public
|
|
4181
|
+
* @description ready 事件负载
|
|
4182
|
+
*/
|
|
4183
|
+
export declare interface ExpressVaultingReadyEvent {
|
|
4184
|
+
availablePaymentMethods: Partial<Record<ExpressVaultingMethod, boolean>>;
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
/**
|
|
4188
|
+
* @public
|
|
4189
|
+
* @description confirmVaulting 返回结果
|
|
4190
|
+
*/
|
|
4191
|
+
export declare interface ExpressVaultingResult {
|
|
4192
|
+
status: 'SUCCESS' | 'PROCESSING' | 'FAIL' | 'CANCELLED';
|
|
4193
|
+
paymentMethodId?: string;
|
|
4194
|
+
payerId?: string;
|
|
4195
|
+
error?: {
|
|
4196
|
+
code: string;
|
|
4197
|
+
message: string;
|
|
4198
|
+
};
|
|
4199
|
+
}
|
|
4200
|
+
|
|
3829
4201
|
declare interface ExpSupportBank {
|
|
3830
4202
|
/**
|
|
3831
4203
|
* @description 银行名称
|
|
@@ -3904,6 +4276,57 @@ declare interface FrontSupportIppBank {
|
|
|
3904
4276
|
logo?: Logo;
|
|
3905
4277
|
}
|
|
3906
4278
|
|
|
4279
|
+
/** host 回传 webapp 的 OPENSDK@GET_APPLE_PAY_TOKEN_REPLY 形态(result 对齐老链路 {token,billingContact,shippingContact})。 */
|
|
4280
|
+
declare interface GetApplePayTokenReply {
|
|
4281
|
+
success: boolean;
|
|
4282
|
+
result?: {
|
|
4283
|
+
token?: unknown;
|
|
4284
|
+
billingContact?: unknown;
|
|
4285
|
+
shippingContact?: unknown;
|
|
4286
|
+
} | {
|
|
4287
|
+
errorCode: string;
|
|
4288
|
+
};
|
|
4289
|
+
}
|
|
4290
|
+
|
|
4291
|
+
/** webapp 传来的 OPENSDK@GET_APPLE_PAY_TOKEN payload 形态。 */
|
|
4292
|
+
declare interface GetApplePayTokenRequest {
|
|
4293
|
+
paymentMethod?: {
|
|
4294
|
+
paymentMethodDetail?: {
|
|
4295
|
+
applePayProps?: {
|
|
4296
|
+
paymentRequest?: unknown;
|
|
4297
|
+
};
|
|
4298
|
+
};
|
|
4299
|
+
};
|
|
4300
|
+
shipping?: unknown;
|
|
4301
|
+
}
|
|
4302
|
+
|
|
4303
|
+
/** host 回传 webapp 的 OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY 形态。 */
|
|
4304
|
+
declare interface GetGooglePayTokenReply {
|
|
4305
|
+
success: boolean;
|
|
4306
|
+
result?: unknown;
|
|
4307
|
+
err?: {
|
|
4308
|
+
statusCode?: string;
|
|
4309
|
+
[key: string]: unknown;
|
|
4310
|
+
};
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4313
|
+
/** webapp 传来的 OPENSDK@GET_GOOGLE_PAY_TOKEN payload 形态。 */
|
|
4314
|
+
declare interface GetGooglePayTokenRequest {
|
|
4315
|
+
actionName?: string;
|
|
4316
|
+
data?: {
|
|
4317
|
+
environment?: string;
|
|
4318
|
+
paymentRequest?: unknown;
|
|
4319
|
+
paymentMethod?: unknown;
|
|
4320
|
+
paymentMethodDetail?: {
|
|
4321
|
+
googlePayProps?: {
|
|
4322
|
+
environment?: string;
|
|
4323
|
+
paymentRequest?: unknown;
|
|
4324
|
+
};
|
|
4325
|
+
};
|
|
4326
|
+
[key: string]: unknown;
|
|
4327
|
+
};
|
|
4328
|
+
}
|
|
4329
|
+
|
|
3907
4330
|
declare type GetI18nQueryParam = string | {
|
|
3908
4331
|
/**
|
|
3909
4332
|
* 多语言文案的 key
|
|
@@ -4754,6 +5177,58 @@ declare interface Language {
|
|
|
4754
5177
|
country?: string;
|
|
4755
5178
|
}
|
|
4756
5179
|
|
|
5180
|
+
/**
|
|
5181
|
+
* @deprecated Token 1.0 老字段类型 — 请迁移到 {@link AppearanceVariables}。
|
|
5182
|
+
* 所有字段均已废弃,运行时由 WebApp 侧 LEGACY_TO_NEW_TOKEN_MAP 翻译为新 token。
|
|
5183
|
+
*
|
|
5184
|
+
* @deprecated 'content-primary' → color-text-primary
|
|
5185
|
+
* @deprecated 'content-secondary' → color-text-secondary
|
|
5186
|
+
* @deprecated 'content-tertiary' → color-text-tertiary
|
|
5187
|
+
* @deprecated 'content-quaternary' → color-text-inverse
|
|
5188
|
+
* @deprecated 'background-primary' → color-background-primary
|
|
5189
|
+
* @deprecated 'background-secondary' → color-background-secondary
|
|
5190
|
+
* @deprecated 'background-disable' → color-background-disabled
|
|
5191
|
+
* @deprecated 'background-transparency' → color-background-transparency
|
|
5192
|
+
* @deprecated 'border-primary' → color-border-primary
|
|
5193
|
+
* @deprecated 'border-secondary' → color-border-secondary
|
|
5194
|
+
* @deprecated 'border-disable' → color-border-disabled
|
|
5195
|
+
* @deprecated 'border-active' → color-border-active
|
|
5196
|
+
* @deprecated 'action-normal' → 一对多 fan-out(无单值映射;运行时展开为 3 个新 token,老 key 不再注入):
|
|
5197
|
+
* - background/background-color → color-backgroundBrand-primary
|
|
5198
|
+
* - border/border-color/box-shadow → color-border-active
|
|
5199
|
+
* - color/文本/图标/勾选态 → color-text-active
|
|
5200
|
+
* @deprecated 'action-hover' → 一对多 fan-out(运行时展开为 2 个新 token,老 key 不再注入):
|
|
5201
|
+
* - background → color-backgroundBrand-primary-hover
|
|
5202
|
+
* - border → color-borderBrand-primary-hover
|
|
5203
|
+
* 文字色 color-textBrand-secondary-hover 不参与派生
|
|
5204
|
+
* (设计稿中与 bg/border 不同色阶),需要时请显式传入该新 token 键
|
|
5205
|
+
* @deprecated 'action-secondary' → color-backgroundBrand-secondary
|
|
5206
|
+
* @deprecated 'action-disable' → 一对多 fan-out(运行时展开为 2 个新 token,老 key 不再注入):
|
|
5207
|
+
* - background/background-color → color-backgroundBrand-disabled
|
|
5208
|
+
* - border/border-color → color-borderBrand-disabled
|
|
5209
|
+
* 文字色 color-textBrand-disabled 不参与派生
|
|
5210
|
+
* (设计稿中全部主题均与 bg/border 不同色阶),需要时请显式传入该新 token 键
|
|
5211
|
+
* @deprecated 'state-success' → color-text-success
|
|
5212
|
+
* @deprecated 'state-failure' → color-text-danger
|
|
5213
|
+
* @deprecated 'state-warning' → color-text-warning
|
|
5214
|
+
* @deprecated 'state-info' → color-text-info
|
|
5215
|
+
* @deprecated 'state-conventional' → color-text-neutral
|
|
5216
|
+
* @deprecated 'state-marketing' → color-text-promotional(color 上下文;background 上下文由 CSS 层直接迁移)
|
|
5217
|
+
* @deprecated 'radius-backup' → radius-sm
|
|
5218
|
+
* @deprecated 'radius-component' → radius-md
|
|
5219
|
+
* @deprecated 'radius-module' → radius-lg
|
|
5220
|
+
* @deprecated 'radius-button' → radius-lg(与 radius-module 同档合并)
|
|
5221
|
+
* @deprecated 'wrapper-padding' → spacing-lg
|
|
5222
|
+
* @deprecated 'stroke-default' → 由 Rules 机制接管
|
|
5223
|
+
* @deprecated 'stroke-active' → 由 Rules 机制接管
|
|
5224
|
+
*
|
|
5225
|
+
* 注:fan-out 展开基数以 figma-v4 设计稿的色阶一致性为准,故 action-hover / action-disable
|
|
5226
|
+
* 为 1→2 而非 1→3;三者合计派生 7 项。
|
|
5227
|
+
*/
|
|
5228
|
+
export declare type LegacyAppearanceVariables = 'content-primary' | 'content-secondary' | 'content-tertiary' | 'content-quaternary' | 'background-primary' | 'background-secondary' | 'background-disable' | 'background-transparency' | 'border-primary' | 'border-secondary' | 'border-disable' | 'action-normal' | 'action-hover' | 'action-disable' | 'action-secondary' | 'state-failure' | 'state-warning' | 'state-success' | 'state-info' | 'state-marketing' | 'state-conventional' | 'radius-backup' | 'radius-module' | 'radius-component' | 'radius-button' | 'wrapper-padding' | 'stroke-default' | 'stroke-active'
|
|
5229
|
+
/** 非 Token 体系字段,由 WebApp 侧展开为 design-font-family-* 系列 */
|
|
5230
|
+
| 'fontFamily';
|
|
5231
|
+
|
|
4757
5232
|
declare interface Link {
|
|
4758
5233
|
/**
|
|
4759
5234
|
* @description 发起关联的父元素,如国家
|
|
@@ -7346,7 +7821,9 @@ declare interface PayByLinkInfo {
|
|
|
7346
7821
|
/**
|
|
7347
7822
|
* @description Payment element app config type
|
|
7348
7823
|
*/
|
|
7349
|
-
export declare interface PaymentAppConfig extends
|
|
7824
|
+
export declare interface PaymentAppConfig extends BaseElementAppConfig {
|
|
7825
|
+
/** Payment appearance configuration including optional alias-only Rules. */
|
|
7826
|
+
appearance?: PaymentAppearance;
|
|
7350
7827
|
/**
|
|
7351
7828
|
* @description sessionData,无法通过updateConfig更新
|
|
7352
7829
|
*/
|
|
@@ -7410,12 +7887,18 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
7410
7887
|
/**
|
|
7411
7888
|
* @description Payment element appearance type
|
|
7412
7889
|
*/
|
|
7413
|
-
export declare type PaymentAppearance =
|
|
7890
|
+
export declare type PaymentAppearance = PickAntomAppearance<PaymentAppearanceProps>;
|
|
7891
|
+
|
|
7892
|
+
/**
|
|
7893
|
+
* @description Payment element appearance properties
|
|
7894
|
+
*/
|
|
7895
|
+
export declare type PaymentAppearanceProps = {
|
|
7414
7896
|
displaySetting: 'showPaymentMethodListWhenSingleOption' | 'showCardBrandIcon' | 'showRadioWhenAccordionLayout' | 'showCardCVV';
|
|
7415
7897
|
theme: AntomTheme;
|
|
7416
|
-
variables: AntomVariables;
|
|
7898
|
+
variables: AppearanceVariables | AntomVariables;
|
|
7417
7899
|
layout: AntomLayouts;
|
|
7418
|
-
|
|
7900
|
+
rules: AppearanceRuleSelector<string>;
|
|
7901
|
+
};
|
|
7419
7902
|
|
|
7420
7903
|
/**
|
|
7421
7904
|
* @description Payment element
|
|
@@ -7423,19 +7906,29 @@ export declare type PaymentAppearance = PickAppearance<{
|
|
|
7423
7906
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
7424
7907
|
static elementType: string;
|
|
7425
7908
|
private _paymentInProgress;
|
|
7909
|
+
private readonly paymentTracker;
|
|
7910
|
+
private _mountStartedAt;
|
|
7911
|
+
private _mountInProgress;
|
|
7912
|
+
private _mountPhase;
|
|
7913
|
+
private _destroyInProgress;
|
|
7914
|
+
private readonly walletLogger;
|
|
7426
7915
|
constructor(name: string, config: PaymentElementConfig);
|
|
7427
7916
|
/**
|
|
7428
7917
|
* @internal
|
|
7429
7918
|
*/
|
|
7430
7919
|
setup(): Promise<Partial<PaymentAppConfig> | undefined>;
|
|
7920
|
+
mount(container: HTMLElement): Promise<void>;
|
|
7431
7921
|
/**
|
|
7432
|
-
* @description Update payment element configuration with amount validation
|
|
7922
|
+
* @description Update payment element configuration with amount validation and appearance Rules support
|
|
7433
7923
|
*/
|
|
7434
|
-
updateConfig(newConfig:
|
|
7924
|
+
updateConfig(newConfig: Partial<PaymentAppConfig>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
7435
7925
|
/**
|
|
7436
7926
|
* @internal
|
|
7437
7927
|
*/
|
|
7438
7928
|
submit(data?: PaymentSubmitParams): Promise<PaymentSubmitResult>;
|
|
7929
|
+
on<T extends keyof PaymentElementEvents>(event: T, handler: (payload: PaymentElementEvents[T]) => void): void;
|
|
7930
|
+
unmount(): void;
|
|
7931
|
+
destroy(): void;
|
|
7439
7932
|
protected focus(): void;
|
|
7440
7933
|
protected blur(): void;
|
|
7441
7934
|
protected clear(): void;
|
|
@@ -7451,6 +7944,25 @@ declare interface PaymentElementConfig extends BaseElementConfig<PaymentAppConfi
|
|
|
7451
7944
|
* @description Payment element events
|
|
7452
7945
|
*/
|
|
7453
7946
|
export declare interface PaymentElementEvents extends AntomBridgeWithNativeEventMap<PaymentAppConfig, PaymentSubmitParams, PaymentSubmitResult> {
|
|
7947
|
+
/**
|
|
7948
|
+
* webapp 委托 host(父 frame)拉起 Apple Pay 拿 token。
|
|
7949
|
+
* payload 结构对齐 ModernElementController.GetApplePayTokenRequest(放 paymentMethod/shipping)。
|
|
7950
|
+
*/
|
|
7951
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN': GetApplePayTokenRequest;
|
|
7952
|
+
/** host 完成 Apple Pay token 获取后回包给 webapp */
|
|
7953
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': GetApplePayTokenReply;
|
|
7954
|
+
/**
|
|
7955
|
+
* webapp 委托 host(父 frame)拉起 Google Pay 拿 token。
|
|
7956
|
+
* payload 结构对齐 ModernElementController.GetGooglePayTokenRequest(放 data.environment/paymentRequest)。
|
|
7957
|
+
*/
|
|
7958
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN': GetGooglePayTokenRequest;
|
|
7959
|
+
/** host 完成 Google Pay token 获取后回包给 webapp */
|
|
7960
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY': GetGooglePayTokenReply;
|
|
7961
|
+
/** WebApp notifies the host when the selected payment method changes. */
|
|
7962
|
+
paymentMethodChanged: {
|
|
7963
|
+
type: string;
|
|
7964
|
+
name?: string;
|
|
7965
|
+
};
|
|
7454
7966
|
}
|
|
7455
7967
|
|
|
7456
7968
|
declare interface PaymentElementView {
|
|
@@ -8142,6 +8654,7 @@ export declare interface PayPalConfig {
|
|
|
8142
8654
|
channelMerchantAccountId?: string;
|
|
8143
8655
|
/** Button style (fine-grained override) */
|
|
8144
8656
|
style?: PayPalButtonStyle;
|
|
8657
|
+
businessDivision?: string;
|
|
8145
8658
|
/** Callback to create PayPal order, no params, returns sessionData */
|
|
8146
8659
|
createOrder?: () => Promise<string>;
|
|
8147
8660
|
/** Callback when user changes shipping address, data is raw data returned by PayPal */
|
|
@@ -8161,6 +8674,9 @@ declare interface PeriodRule {
|
|
|
8161
8674
|
periodCount?: number;
|
|
8162
8675
|
}
|
|
8163
8676
|
|
|
8677
|
+
/** Builds an Antom appearance type with the restricted Rules declaration contract. */
|
|
8678
|
+
declare type PickAntomAppearance<T extends Record<string, any>> = PickAppearance<T, AppearanceRuleDeclarations>;
|
|
8679
|
+
|
|
8164
8680
|
/**
|
|
8165
8681
|
* @description 工具类型,仅从 Appearance 中拾取与 Props 类型匹配的属性。
|
|
8166
8682
|
* 返回受 Props 中存在的键约束的部分外观对象。
|
|
@@ -24889,7 +25405,9 @@ declare interface UserName {
|
|
|
24889
25405
|
* @public
|
|
24890
25406
|
* @description Vaulting element app config type
|
|
24891
25407
|
*/
|
|
24892
|
-
export declare interface VaultingAppConfig extends
|
|
25408
|
+
export declare interface VaultingAppConfig extends BaseElementAppConfig {
|
|
25409
|
+
/** Vaulting appearance configuration including optional alias-only Rules. */
|
|
25410
|
+
appearance?: VaultingAppearance;
|
|
24893
25411
|
/**
|
|
24894
25412
|
* @description sessionData,无法通过updateConfig更新
|
|
24895
25413
|
*/
|
|
@@ -24918,13 +25436,14 @@ export declare interface VaultingAppConfig extends BaseAppearance<VaultingAppear
|
|
|
24918
25436
|
preloadTelemetryContext?: PreloadTelemetryContext;
|
|
24919
25437
|
}
|
|
24920
25438
|
|
|
24921
|
-
export declare type VaultingAppearance =
|
|
25439
|
+
export declare type VaultingAppearance = PickAntomAppearance<VaultingAppearanceProps>;
|
|
24922
25440
|
|
|
24923
25441
|
export declare type VaultingAppearanceProps = {
|
|
24924
25442
|
displaySetting: 'showCardBrandIcon';
|
|
24925
25443
|
theme: AntomTheme;
|
|
24926
|
-
variables: AntomVariables;
|
|
25444
|
+
variables: AppearanceVariables | AntomVariables;
|
|
24927
25445
|
fonts?: FontSource[];
|
|
25446
|
+
rules: AppearanceRuleSelector<string>;
|
|
24928
25447
|
};
|
|
24929
25448
|
|
|
24930
25449
|
/**
|
|
@@ -24932,15 +25451,28 @@ export declare type VaultingAppearanceProps = {
|
|
|
24932
25451
|
*/
|
|
24933
25452
|
export declare class VaultingElement extends BaseMainElement<VaultingElementConfig, VaultingElementEvents> {
|
|
24934
25453
|
static elementType: string;
|
|
25454
|
+
private readonly elementTracker;
|
|
25455
|
+
private _mountInProgress;
|
|
25456
|
+
private _destroyInProgress;
|
|
24935
25457
|
constructor(name: string, config: VaultingElementConfig);
|
|
24936
25458
|
/**
|
|
24937
25459
|
* @internal
|
|
24938
25460
|
*/
|
|
24939
25461
|
setup(): Promise<Partial<VaultingAppConfig> | undefined>;
|
|
25462
|
+
/**
|
|
25463
|
+
* Updates Vaulting configuration while preserving the public Rules clear semantics.
|
|
25464
|
+
* @param newConfig Partial Vaulting configuration patch.
|
|
25465
|
+
* @returns The WebApp update acknowledgement.
|
|
25466
|
+
*/
|
|
25467
|
+
updateConfig(newConfig: Partial<VaultingAppConfig>): Promise<VaultingElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
24940
25468
|
/**
|
|
24941
25469
|
* @internal
|
|
24942
25470
|
*/
|
|
24943
25471
|
submit(data?: VaultingSubmitParams): Promise<SubmitResult>;
|
|
25472
|
+
mount(container: HTMLElement): Promise<void>;
|
|
25473
|
+
on<T extends keyof VaultingElementEvents>(event: T, handler: (payload: VaultingElementEvents[T]) => void): void;
|
|
25474
|
+
unmount(): void;
|
|
25475
|
+
destroy(): void;
|
|
24944
25476
|
protected focus(): void;
|
|
24945
25477
|
protected blur(): void;
|
|
24946
25478
|
protected clear(): void;
|