@alipay/ams-checkout 0.0.1788166152-dev.0 → 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/tsdoc-metadata.json +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 +14 -14
- package/types.d.ts +580 -71
- package/types.untrimmed.d.ts +603 -71
package/types.d.ts
CHANGED
|
@@ -215,30 +215,51 @@ export declare type AntomPreloadElement = 'payment' | 'express' | 'vaulting' | '
|
|
|
215
215
|
*/
|
|
216
216
|
export declare class AntomSDK extends BaseElementsFactory {
|
|
217
217
|
static version: string;
|
|
218
|
+
private stopModalMessageMonitor;
|
|
219
|
+
private readonly apiTracker;
|
|
218
220
|
constructor(config?: AntomSDKConfig);
|
|
219
221
|
protected canUseElements(): Array<ElementListItemType>;
|
|
222
|
+
init(): Promise<this>;
|
|
220
223
|
/**
|
|
221
224
|
* @description 更新配置
|
|
222
225
|
*/
|
|
223
226
|
updateConfig(config: Partial<BaseFactoryConfig>): void;
|
|
227
|
+
destroy(): void;
|
|
224
228
|
/* Excluded from this release type: redirect */
|
|
225
229
|
/* Excluded from this release type: openModal */
|
|
226
230
|
elements(): Elements;
|
|
227
231
|
createElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
228
232
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
229
|
-
createElement(elementType: 'CVV', options
|
|
233
|
+
createElement(elementType: 'CVV', options: CVVAppConfig): CVVElement;
|
|
230
234
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
235
|
+
createElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
|
|
231
236
|
getElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
232
237
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
233
238
|
getElement(elementType: 'CVV', options?: CVVAppConfig): CVVElement;
|
|
234
239
|
getElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
240
|
+
getElement(elementType: 'expressVaulting', options?: ExpressVaultingAppConfig): ExpressVaultingElement;
|
|
235
241
|
/**
|
|
236
242
|
* 从 elements 容器或直接传入的 MainElement 中提取指定类型的主元素
|
|
237
243
|
* @throws {AntomSDKError} 当无法找到有效的主元素时抛出错误
|
|
238
244
|
*/
|
|
239
245
|
private extractMainElement;
|
|
240
246
|
confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult>;
|
|
247
|
+
private runConfirmCardSetup;
|
|
241
248
|
confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult>;
|
|
249
|
+
private runConfirmPayment;
|
|
250
|
+
/**
|
|
251
|
+
* 触发 Express Vaulting element 的 PayPal 绑卡提交流程。
|
|
252
|
+
*
|
|
253
|
+
* iframe 收到 OPENSDK@CONFIRM_VAULTING 后执行 submitPay + 单次 inquiry 兜底,
|
|
254
|
+
* 完成后通过 OPENSDK@CONFIRM_VAULTING_RESULT 回包,Promise resolve。
|
|
255
|
+
*
|
|
256
|
+
* @param options.elements 已挂载的 ExpressVaultingElement 或包含它的 Elements 实例
|
|
257
|
+
* @param options.redirect 跳转策略,默认 'always',透传给 iframe
|
|
258
|
+
*/
|
|
259
|
+
confirmVaulting(options: {
|
|
260
|
+
elements: BaseMainElement | BaseElements;
|
|
261
|
+
redirect?: 'always' | 'if_required';
|
|
262
|
+
}): Promise<ExpressVaultingResult>;
|
|
242
263
|
}
|
|
243
264
|
|
|
244
265
|
/**
|
|
@@ -298,9 +319,29 @@ export declare const AntomSDKErrorCodes: {
|
|
|
298
319
|
*/
|
|
299
320
|
readonly AMOUNT_VALUE_EMPTY: "AMOUNT_VALUE_EMPTY";
|
|
300
321
|
/**
|
|
301
|
-
* @description
|
|
322
|
+
* @description 金额格式非法(仅允许 ASCII 数字字符串)
|
|
302
323
|
*/
|
|
303
324
|
readonly AMOUNT_VALUE_INVALID: "AMOUNT_VALUE_INVALID";
|
|
325
|
+
/**
|
|
326
|
+
* @description Amount currency does not match the payment session currency
|
|
327
|
+
*/
|
|
328
|
+
readonly AMOUNT_CURRENCY_MISMATCH: "AMOUNT_CURRENCY_MISMATCH";
|
|
329
|
+
/**
|
|
330
|
+
* @description Amount currency is not supported
|
|
331
|
+
*/
|
|
332
|
+
readonly AMOUNT_CURRENCY_UNSUPPORTED: "AMOUNT_CURRENCY_UNSUPPORTED";
|
|
333
|
+
/**
|
|
334
|
+
* @description Amount currency precision is not supported
|
|
335
|
+
*/
|
|
336
|
+
readonly AMOUNT_PRECISION_UNSUPPORTED: "AMOUNT_PRECISION_UNSUPPORTED";
|
|
337
|
+
/**
|
|
338
|
+
* @description Amount conversion timed out
|
|
339
|
+
*/
|
|
340
|
+
readonly AMOUNT_RESOLVE_TIMEOUT: "AMOUNT_RESOLVE_TIMEOUT";
|
|
341
|
+
/**
|
|
342
|
+
* @description Amount conversion failed
|
|
343
|
+
*/
|
|
344
|
+
readonly AMOUNT_RESOLVE_FAILED: "AMOUNT_RESOLVE_FAILED";
|
|
304
345
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
305
346
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
306
347
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -314,7 +355,9 @@ export declare const AntomSDKErrorCodes: {
|
|
|
314
355
|
readonly ELEMENT_ALREADY_REGISTERED: "ELEMENT_ALREADY_REGISTERED";
|
|
315
356
|
readonly CANNOT_CREATE_SAME_ELEMENT_TWICE: "CANNOT_CREATE_SAME_ELEMENT_TWICE";
|
|
316
357
|
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT";
|
|
317
|
-
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT";
|
|
358
|
+
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT"; /**
|
|
359
|
+
* @description 环境配置,默认为prod
|
|
360
|
+
*/
|
|
318
361
|
readonly NOT_SUPPORT_ELEMENT: "NOT_SUPPORT_ELEMENT";
|
|
319
362
|
readonly NOT_SUPPORT_SUBMIT: "NOT_SUPPORT_SUBMIT";
|
|
320
363
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
@@ -336,28 +379,100 @@ export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeo
|
|
|
336
379
|
|
|
337
380
|
export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
|
|
338
381
|
|
|
339
|
-
|
|
382
|
+
/**
|
|
383
|
+
* @deprecated Use {@link AppearanceVariables} (Token 2.0) instead.
|
|
384
|
+
* 保留仅为向后兼容,将在下一个 major 版本中删除。
|
|
385
|
+
*/
|
|
386
|
+
export declare type AntomVariables = LegacyAppearanceVariables;
|
|
340
387
|
|
|
341
388
|
/**
|
|
342
389
|
* @description SDK UI组件的外观配置。
|
|
343
390
|
* 控制主题、CSS变量、布局规则及显示设置。
|
|
344
391
|
* @template Props - 自定义外观属性类型,默认为 DefaultAppearanceProps。
|
|
345
392
|
*/
|
|
346
|
-
declare interface Appearance<Props extends Partial<DefaultAppearanceProps> = DefaultAppearanceProps> {
|
|
393
|
+
declare interface Appearance<Props extends Partial<DefaultAppearanceProps> = DefaultAppearanceProps, Rules extends CSS_2.Properties<string, number> = CSS_2.Properties<string, number>> {
|
|
347
394
|
theme?: Props['theme'];
|
|
348
395
|
variables?: PartialSpeKey<Props['variables'], string>;
|
|
349
|
-
rules?: PartialSpeKey<Props['rules'],
|
|
396
|
+
rules?: PartialSpeKey<Props['rules'], Rules>;
|
|
350
397
|
displaySetting?: PartialSpeKey<Props['displaySetting'], boolean>;
|
|
351
398
|
layout?: Props['layout'];
|
|
352
399
|
fonts?: FontSource[];
|
|
353
400
|
}
|
|
354
401
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
402
|
+
/** Target-level layout declarations admitted before runtime capability intersection. */
|
|
403
|
+
export declare type AppearanceLayoutDeclarations = {
|
|
404
|
+
[Property in Exclude<AppearanceLayoutProperty, 'height'>]?: AppearanceSpacingValue;
|
|
405
|
+
} & {
|
|
406
|
+
/** Exact integer-pixel enum allocated by the target contract. */
|
|
407
|
+
readonly height?: `${number}px`;
|
|
359
408
|
};
|
|
360
409
|
|
|
410
|
+
/** Controlled layout longhands intersected with the concrete Part at runtime. */
|
|
411
|
+
export declare type AppearanceLayoutProperty = 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'height';
|
|
412
|
+
|
|
413
|
+
/** Paint declarations accepted before WebApp and Components runtime validation. */
|
|
414
|
+
declare type AppearancePaintDeclarations = Partial<Record<Exclude<AppearancePaintProperty, 'fillOpacity' | 'strokeOpacity' | 'strokeWidth' | 'textDecorationStyle' | 'outlineStyle'>, string> & Record<'fillOpacity' | 'strokeOpacity' | 'strokeWidth', string | number> & {
|
|
415
|
+
textDecorationStyle: '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | 'dashed' | 'dotted' | 'double' | 'solid' | 'wavy';
|
|
416
|
+
outlineStyle: '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | 'auto' | 'dashed' | 'dotted' | 'double' | 'groove' | 'inset' | 'none' | 'outset' | 'ridge' | 'solid';
|
|
417
|
+
}>;
|
|
418
|
+
|
|
419
|
+
/** Paint-only property names exposed by the SDK contract. */
|
|
420
|
+
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';
|
|
421
|
+
|
|
422
|
+
/** Paint declarations plus controlled typography and target-level layout fields. */
|
|
423
|
+
declare type AppearanceRuleDeclarations = AppearancePaintDeclarations & AppearanceLayoutDeclarations & {
|
|
424
|
+
/** Single font family identifier admitted only for authorized targets at runtime. */
|
|
425
|
+
readonly fontFamily?: string;
|
|
426
|
+
/** Integer pixel size admitted only for authorized text targets at runtime. */
|
|
427
|
+
readonly fontSize?: `${number}px`;
|
|
428
|
+
/** Controlled font weight admitted only for authorized text targets at runtime. */
|
|
429
|
+
readonly fontWeight?: 400 | 500 | 600 | 700;
|
|
430
|
+
/** Controlled font style admitted only for authorized text targets at runtime. */
|
|
431
|
+
readonly fontStyle?: 'normal' | 'italic';
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
/** Controlled pseudo-class accepted by the merchant selector grammar. */
|
|
435
|
+
declare type AppearanceRulePseudoClass = 'autofill';
|
|
436
|
+
|
|
437
|
+
/** Controlled pseudo-element accepted by the merchant selector grammar. */
|
|
438
|
+
declare type AppearanceRulePseudoElement = 'placeholder' | 'selection';
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Optional state or controlled pseudo suffix on one alias.
|
|
442
|
+
*/
|
|
443
|
+
export declare type AppearanceRuleScopeSuffix = '' | `:${AppearanceRuleState | AppearanceRulePseudoClass}` | `::${AppearanceRulePseudoElement}`;
|
|
444
|
+
|
|
445
|
+
/** One merchant alias with an optional semantic suffix. */
|
|
446
|
+
export declare type AppearanceRuleSelector<RuleAlias extends string> = `${RuleAlias}${AppearanceRuleScopeSuffix}`;
|
|
447
|
+
|
|
448
|
+
/** Semantic states accepted by the merchant selector grammar. */
|
|
449
|
+
declare type AppearanceRuleState = 'hover' | 'focus' | 'focus-visible' | 'active' | 'disabled' | 'loading' | 'selected' | 'checked' | 'expanded' | 'invalid' | 'success' | 'error';
|
|
450
|
+
|
|
451
|
+
/** Backward-compatible name for the Express appearance configuration. */
|
|
452
|
+
export declare type AppearanceSetting = ExpressAppearance;
|
|
453
|
+
|
|
454
|
+
/** Exact official spacing Token accepted by controlled margin and padding. */
|
|
455
|
+
export declare type AppearanceSpacingToken = `var(--spacing-${'base' | 'none' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'})`;
|
|
456
|
+
|
|
457
|
+
/** Runtime-constrained non-negative integer pixel value for spacing longhands. */
|
|
458
|
+
export declare type AppearanceSpacingValue = '0' | `${number}px` | AppearanceSpacingToken;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* 对客公开 appearance variables 类型(Token 2.x,figma-v4「3 层 + 状态」命名)。
|
|
462
|
+
* 字段名为新 CSS 变量名去掉 '--' 前缀(如 color-text-primary)。
|
|
463
|
+
*
|
|
464
|
+
* 权威源:`antom-web-checkout-v2/packages/elements2/src/utils/themeConfig.ts` 的 `PUBLIC_TOKENS`
|
|
465
|
+
* (54 color + 4 radius + 10 spacing = 68 项)。本 union 是该清单的手工镜像,
|
|
466
|
+
* 增删 token 时必须两侧同步,否则商户会遇到「类型报错但运行时可用」的错位。
|
|
467
|
+
*
|
|
468
|
+
* 命名规则:`--color-<scene>-<level>[-<state>]`;brand 场景并入 scene 段的 camelCase
|
|
469
|
+
* (如 `color-backgroundBrand-primary-hover`),CSS 变量大小写敏感,不可改写为 kebab。
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* variables: { 'color-text-primary': '#2a3a52', 'radius-sm': '4px' }
|
|
473
|
+
*/
|
|
474
|
+
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';
|
|
475
|
+
|
|
361
476
|
declare interface AppleMerchantInfo {
|
|
362
477
|
/**
|
|
363
478
|
* @description Apple商户ID
|
|
@@ -746,10 +861,6 @@ declare interface BankInfo {
|
|
|
746
861
|
hasSchemaUrl?: boolean;
|
|
747
862
|
}
|
|
748
863
|
|
|
749
|
-
declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
750
|
-
appearance?: A;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
864
|
/**
|
|
754
865
|
* @description 内置基础的桥接事件映射类型
|
|
755
866
|
*/
|
|
@@ -2066,18 +2177,22 @@ export declare interface ConfirmCardSetupOptions {
|
|
|
2066
2177
|
redirect?: 'always' | 'if_required';
|
|
2067
2178
|
}
|
|
2068
2179
|
|
|
2069
|
-
export declare
|
|
2070
|
-
sessionData: string;
|
|
2071
|
-
/**
|
|
2072
|
-
* @description 传入已挂载的 CVVElement / PaymentElement / Elements 实例,不传则使用无 UI 自动提交模式
|
|
2073
|
-
*/
|
|
2074
|
-
elements?: BaseMainElement | BaseElements;
|
|
2180
|
+
export declare type ConfirmPaymentOptions = PaymentSubmitParams & {
|
|
2075
2181
|
appearance?: CVVAppearance;
|
|
2076
2182
|
/**
|
|
2077
2183
|
* @description 集成用户自定义信息(如 cardHolderName)
|
|
2078
2184
|
*/
|
|
2079
2185
|
params?: Record<string, unknown>;
|
|
2080
|
-
}
|
|
2186
|
+
} & ({
|
|
2187
|
+
/** 已挂载的 Element;确认时使用其创建时绑定的会话。 */
|
|
2188
|
+
elements: BaseMainElement | BaseElements;
|
|
2189
|
+
/** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
2190
|
+
sessionData?: string;
|
|
2191
|
+
} | {
|
|
2192
|
+
elements?: undefined;
|
|
2193
|
+
/** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
2194
|
+
sessionData: string;
|
|
2195
|
+
});
|
|
2081
2196
|
|
|
2082
2197
|
/**
|
|
2083
2198
|
* @description Connect流程参数
|
|
@@ -2214,11 +2329,13 @@ declare interface CustomFontSource {
|
|
|
2214
2329
|
* @public
|
|
2215
2330
|
* @description CVV element app config type
|
|
2216
2331
|
*/
|
|
2217
|
-
export declare interface CVVAppConfig extends
|
|
2332
|
+
export declare interface CVVAppConfig extends BaseElementAppConfig {
|
|
2333
|
+
/** CVV appearance configuration including optional alias-only Rules. */
|
|
2334
|
+
appearance?: CVVAppearance;
|
|
2218
2335
|
/**
|
|
2219
|
-
* @description
|
|
2336
|
+
* @description 创建时必填的支付会话;不可通过 updateConfig 或 submit 替换
|
|
2220
2337
|
*/
|
|
2221
|
-
sessionData
|
|
2338
|
+
sessionData: string;
|
|
2222
2339
|
/* Excluded from this release type: paymentSessionConfig */
|
|
2223
2340
|
/* Excluded from this release type: renderData */
|
|
2224
2341
|
/* Excluded from this release type: sdkVersion */
|
|
@@ -2231,12 +2348,13 @@ export declare interface CVVAppConfig extends BaseAppearance<CVVAppearance>, Bas
|
|
|
2231
2348
|
/* Excluded from this release type: paymentFlow */
|
|
2232
2349
|
}
|
|
2233
2350
|
|
|
2234
|
-
export declare type CVVAppearance =
|
|
2351
|
+
export declare type CVVAppearance = PickAntomAppearance<CVVAppearanceProps>;
|
|
2235
2352
|
|
|
2236
2353
|
export declare type CVVAppearanceProps = {
|
|
2237
2354
|
theme: AntomTheme;
|
|
2238
|
-
variables: AntomVariables;
|
|
2355
|
+
variables: AppearanceVariables | AntomVariables;
|
|
2239
2356
|
fonts?: FontSource[];
|
|
2357
|
+
rules: AppearanceRuleSelector<string>;
|
|
2240
2358
|
};
|
|
2241
2359
|
|
|
2242
2360
|
/**
|
|
@@ -2244,9 +2362,18 @@ export declare type CVVAppearanceProps = {
|
|
|
2244
2362
|
*/
|
|
2245
2363
|
export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVElementEvents> {
|
|
2246
2364
|
static elementType: string;
|
|
2365
|
+
private readonly sessionData;
|
|
2366
|
+
private readonly elementTracker;
|
|
2367
|
+
private _mountInProgress;
|
|
2368
|
+
private _destroyInProgress;
|
|
2247
2369
|
constructor(name: string, config: CVVElementConfig);
|
|
2248
2370
|
/* Excluded from this release type: setup */
|
|
2371
|
+
/* Excluded from this release type: updateConfig */
|
|
2249
2372
|
/* Excluded from this release type: submit */
|
|
2373
|
+
mount(container: HTMLElement): Promise<void>;
|
|
2374
|
+
on<T extends keyof CVVElementEvents>(event: T, handler: (payload: CVVElementEvents[T]) => void): void;
|
|
2375
|
+
unmount(): void;
|
|
2376
|
+
destroy(): void;
|
|
2250
2377
|
protected focus(): void;
|
|
2251
2378
|
protected blur(): void;
|
|
2252
2379
|
protected clear(): void;
|
|
@@ -2257,20 +2384,10 @@ export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVEle
|
|
|
2257
2384
|
* @description CVV element config type
|
|
2258
2385
|
*/
|
|
2259
2386
|
export declare interface CVVElementConfig extends BaseElementConfig<CVVAppConfig> {
|
|
2387
|
+
appConfig: CVVAppConfig;
|
|
2260
2388
|
}
|
|
2261
2389
|
|
|
2262
|
-
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams
|
|
2263
|
-
/**
|
|
2264
|
-
* @description Emitted event about form
|
|
2265
|
-
*/
|
|
2266
|
-
form: {
|
|
2267
|
-
errors?: Array<{
|
|
2268
|
-
field: string | number;
|
|
2269
|
-
message: string;
|
|
2270
|
-
currentValue: any;
|
|
2271
|
-
}>;
|
|
2272
|
-
message: string;
|
|
2273
|
-
};
|
|
2390
|
+
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams & Pick<CVVAppConfig, 'sessionData'>> {
|
|
2274
2391
|
/**
|
|
2275
2392
|
* @description Emitted when the element is destroy
|
|
2276
2393
|
*/
|
|
@@ -2314,10 +2431,6 @@ export declare type CVVSubmitErrorCodes = 'NOT_FIND_MAINELEMENT' | 'SESSION_DATA
|
|
|
2314
2431
|
* @description CVV 支付提交参数
|
|
2315
2432
|
*/
|
|
2316
2433
|
export declare interface CVVSubmitParams {
|
|
2317
|
-
/**
|
|
2318
|
-
* 支付会话数据
|
|
2319
|
-
*/
|
|
2320
|
-
sessionData?: string;
|
|
2321
2434
|
/**
|
|
2322
2435
|
* 重定向策略
|
|
2323
2436
|
*/
|
|
@@ -3001,8 +3114,12 @@ declare interface ElementPluginChangeStates {
|
|
|
3001
3114
|
declare type ElementPluginNameEnum = 'SET_STATE' | 'PASSIVE_SET_STATE';
|
|
3002
3115
|
|
|
3003
3116
|
declare class Elements extends BaseElements {
|
|
3117
|
+
private readonly apiTracker;
|
|
3004
3118
|
protected canUseElements(): Array<ElementListItemType>;
|
|
3005
3119
|
constructor(config: BaseElementsConfig);
|
|
3120
|
+
init(): Promise<this>;
|
|
3121
|
+
updateConfig(config: Partial<BaseElementsConfig>): void;
|
|
3122
|
+
destroy(): void;
|
|
3006
3123
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
3007
3124
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
3008
3125
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
@@ -3130,20 +3247,21 @@ declare interface ExpPaymentOptionDetail {
|
|
|
3130
3247
|
* @public
|
|
3131
3248
|
* @description Express element app config type
|
|
3132
3249
|
*/
|
|
3133
|
-
export declare interface ExpressAppConfig extends
|
|
3250
|
+
export declare interface ExpressAppConfig extends BaseElementAppConfig {
|
|
3251
|
+
/** Express appearance configuration. */
|
|
3252
|
+
appearance?: ExpressAppearance;
|
|
3134
3253
|
/** payment SessionData */
|
|
3135
3254
|
sessionData?: string;
|
|
3136
|
-
/** Business division (country/region) */
|
|
3137
|
-
businessDivision?: string;
|
|
3138
3255
|
/**
|
|
3139
3256
|
* Amount & Currency
|
|
3140
3257
|
*
|
|
3141
|
-
*
|
|
3142
|
-
*
|
|
3143
|
-
*
|
|
3258
|
+
* For Apple Pay and Google Pay, `value` is a positive ASCII digit string in
|
|
3259
|
+
* the payment session currency's minor unit; `currency` may be omitted.
|
|
3260
|
+
* For example, USD 10.99 is passed as `{ value: '1099' }`.
|
|
3261
|
+
* PayPal keeps its existing major-unit amount semantics and requires `currency`.
|
|
3144
3262
|
*/
|
|
3145
3263
|
amount?: {
|
|
3146
|
-
currency
|
|
3264
|
+
currency?: string;
|
|
3147
3265
|
value: string;
|
|
3148
3266
|
};
|
|
3149
3267
|
/** PayPal 配置 */
|
|
@@ -3189,6 +3307,17 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3189
3307
|
/* Excluded from this release type: doMain */
|
|
3190
3308
|
}
|
|
3191
3309
|
|
|
3310
|
+
/** Express element appearance configuration. */
|
|
3311
|
+
declare type ExpressAppearance = PickAntomAppearance<ExpressAppearanceProps>;
|
|
3312
|
+
|
|
3313
|
+
/** Express element appearance properties. */
|
|
3314
|
+
export declare type ExpressAppearanceProps = {
|
|
3315
|
+
displaySetting: 'showCardBrandIcon';
|
|
3316
|
+
theme: 'light' | 'dark';
|
|
3317
|
+
layout: 'accordion' | 'tabs';
|
|
3318
|
+
rules: AppearanceRuleSelector<string>;
|
|
3319
|
+
};
|
|
3320
|
+
|
|
3192
3321
|
/** cancel 事件负载 */
|
|
3193
3322
|
export declare interface ExpressCancelEvent {
|
|
3194
3323
|
expressPaymentType: string;
|
|
@@ -3200,6 +3329,17 @@ export declare interface ExpressClickEvent {
|
|
|
3200
3329
|
expressPaymentType: string;
|
|
3201
3330
|
}
|
|
3202
3331
|
|
|
3332
|
+
declare type ExpressCompletePaymentResult = {
|
|
3333
|
+
success: boolean;
|
|
3334
|
+
result?: any;
|
|
3335
|
+
error?: {
|
|
3336
|
+
code: string;
|
|
3337
|
+
message: string;
|
|
3338
|
+
};
|
|
3339
|
+
userCanceled3D?: boolean;
|
|
3340
|
+
status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
|
|
3341
|
+
};
|
|
3342
|
+
|
|
3203
3343
|
/** confirm 事件负载(统一终态,替代 approve) */
|
|
3204
3344
|
export declare interface ExpressConfirmData {
|
|
3205
3345
|
expressPaymentType: string;
|
|
@@ -3246,6 +3386,10 @@ export declare interface ExpressConfirmData {
|
|
|
3246
3386
|
*/
|
|
3247
3387
|
export declare class ExpressElement extends BaseMainElement<ExpressElementConfig, ExpressElementEvents> {
|
|
3248
3388
|
static elementType: string;
|
|
3389
|
+
private readonly elementTracker;
|
|
3390
|
+
private _mountInProgress;
|
|
3391
|
+
private _destroyInProgress;
|
|
3392
|
+
private _registeringInternalListeners;
|
|
3249
3393
|
/**
|
|
3250
3394
|
* Store all function-type callbacks locally, not involved in postMessage serialization
|
|
3251
3395
|
*/
|
|
@@ -3264,7 +3408,23 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3264
3408
|
private _localHandlers;
|
|
3265
3409
|
/** 支付流程进行中标志(click → confirm/error/cancel 之间) */
|
|
3266
3410
|
private _paymentInProgress;
|
|
3411
|
+
/**
|
|
3412
|
+
* confirm 窗口超时标志:iframe 在 20s onTimeout 发 error(MERCHANT_CONFIRM_TIMEOUT) 时置位,
|
|
3413
|
+
* completePayment 入口据此立即返失败(不发 COMPLETE_PAYMENT,不进 5min 兜底)。
|
|
3414
|
+
* 每新一轮 confirm 事件到达时复位(见 on() 重写)。
|
|
3415
|
+
*/
|
|
3416
|
+
private _confirmWindowTimedOut;
|
|
3417
|
+
/**
|
|
3418
|
+
* 是否已收到 iframe 业务层 ready 事件(app.tsx sendReady)。
|
|
3419
|
+
* 注意:与 host `status='ready'`(由 HANDSHAKE_ACK 触发,bridge.js:450 同步回发,与 amount 解析无关)不同。
|
|
3420
|
+
* 首屏 amount setupError 时 iframe 不发业务 ready → _readyReceived 保持 false,
|
|
3421
|
+
* 据此判别"首屏失败"以阻断后续 updateConfig。
|
|
3422
|
+
*/
|
|
3423
|
+
private _readyReceived;
|
|
3424
|
+
/** 首屏 setupError 致命标志:置位后 updateConfig 被 CHECKOUT_NOT_READY 阻断,只能 destroy 重开。 */
|
|
3425
|
+
private _setupFailed;
|
|
3267
3426
|
private _paypalOverlay;
|
|
3427
|
+
private _updateQueue;
|
|
3268
3428
|
constructor(name: string, config: ExpressElementConfig);
|
|
3269
3429
|
/**
|
|
3270
3430
|
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
@@ -3275,24 +3435,30 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3275
3435
|
* 用于 Native WebView 场景下 SDK 需要向商户透传跳转信息等。
|
|
3276
3436
|
*/
|
|
3277
3437
|
private _emit;
|
|
3278
|
-
updateConfig(newConfig:
|
|
3438
|
+
updateConfig(newConfig: ExpressAppConfig): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3439
|
+
private runUpdateConfig;
|
|
3440
|
+
private updateConfigTransaction;
|
|
3441
|
+
private updateAmountConfigWithSanitizedDebug;
|
|
3442
|
+
private getAmountValidationReason;
|
|
3443
|
+
/** iframe 业务 ready 事件到达:置 _readyReceived,后续运行时 error 不再视为首屏失败。
|
|
3444
|
+
* ready 是"本次首屏成功"的确实信号(首屏 setupError 时 iframe 不发 ready),
|
|
3445
|
+
* 故同时清掉 _setupFailed——unmount+remount 同实例二次首屏成功后可恢复 updateConfig。
|
|
3446
|
+
*/
|
|
3447
|
+
private _handleReady;
|
|
3448
|
+
/** iframe error 事件:若 business ready 未到达,视为首屏 setupError → 置 _setupFailed 阻断后续 updateConfig。 */
|
|
3449
|
+
private _handleError;
|
|
3279
3450
|
/**
|
|
3280
3451
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3281
3452
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
3282
3453
|
* 完成后通过 OPENSDK@COMPLETE_PAYMENT_RESULT 回包,Promise resolve。
|
|
3283
3454
|
*/
|
|
3284
|
-
completePayment(redirect?: 'always' | 'if_required'): Promise<
|
|
3285
|
-
|
|
3286
|
-
result?: any;
|
|
3287
|
-
error?: {
|
|
3288
|
-
code: string;
|
|
3289
|
-
message: string;
|
|
3290
|
-
};
|
|
3291
|
-
/** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
|
|
3292
|
-
userCanceled3D?: boolean;
|
|
3293
|
-
}>;
|
|
3455
|
+
completePayment(redirect?: 'always' | 'if_required'): Promise<ExpressCompletePaymentResult>;
|
|
3456
|
+
private runCompletePayment;
|
|
3294
3457
|
setup(): Promise<Partial<ExpressAppConfig> | undefined>;
|
|
3295
3458
|
private registerInternalListeners;
|
|
3459
|
+
mount(container: HTMLElement): Promise<void>;
|
|
3460
|
+
unmount(): void;
|
|
3461
|
+
destroy(): void;
|
|
3296
3462
|
protected focus(): void;
|
|
3297
3463
|
protected blur(): void;
|
|
3298
3464
|
protected clear(): void;
|
|
@@ -3364,6 +3530,11 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3364
3530
|
'OPENSDK@GET_APPLE_PAY_TOKEN': {
|
|
3365
3531
|
requestId: string;
|
|
3366
3532
|
expressPaymentType: string;
|
|
3533
|
+
/** iframe 已转好的 major unit 金额(来自 resolvedAmount);host 委托 Apple Pay 消费,不再做 minor→major 转换。 */
|
|
3534
|
+
walletAmount?: {
|
|
3535
|
+
value: string;
|
|
3536
|
+
currency: string;
|
|
3537
|
+
};
|
|
3367
3538
|
};
|
|
3368
3539
|
/** host 完成 Apple Pay token 获取后回包给 iframe,submit/3DS/polling 均由 webapp 完成 */
|
|
3369
3540
|
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': {
|
|
@@ -3396,6 +3567,184 @@ declare type ExpressSetupError = ErrorPayload & {
|
|
|
3396
3567
|
mulityLanguageMapping?: boolean;
|
|
3397
3568
|
};
|
|
3398
3569
|
|
|
3570
|
+
/**
|
|
3571
|
+
* @public
|
|
3572
|
+
* @description Express Vaulting element app config type
|
|
3573
|
+
*/
|
|
3574
|
+
export declare interface ExpressVaultingAppConfig extends BaseElementAppConfig {
|
|
3575
|
+
/**
|
|
3576
|
+
* @description payment sessionData,无法通过 updateConfig 更新
|
|
3577
|
+
*/
|
|
3578
|
+
sessionData?: string;
|
|
3579
|
+
/**
|
|
3580
|
+
* @description 开通的支付方式列表,本期固定为 ['PAYPAL_DIRECTDEBIT']
|
|
3581
|
+
*/
|
|
3582
|
+
paymentMethods?: string[];
|
|
3583
|
+
/** PayPal 按钮配置 */
|
|
3584
|
+
paypal?: ExpressVaultingPayPalConfig;
|
|
3585
|
+
/** PayPal 按钮文案类型 */
|
|
3586
|
+
buttonType?: {
|
|
3587
|
+
paypal?: 'paypal' | 'checkout' | 'buynow' | 'pay';
|
|
3588
|
+
};
|
|
3589
|
+
/** 按钮统一高度(px) */
|
|
3590
|
+
buttonHeight?: number;
|
|
3591
|
+
/** PayPal 按钮主题色 */
|
|
3592
|
+
buttonTheme?: {
|
|
3593
|
+
paypal?: 'gold' | 'blue' | 'silver' | 'white' | 'black';
|
|
3594
|
+
};
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
/**
|
|
3598
|
+
* @public
|
|
3599
|
+
* @description cancel 事件负载
|
|
3600
|
+
*/
|
|
3601
|
+
export declare interface ExpressVaultingCancelEvent {
|
|
3602
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
3603
|
+
data?: unknown;
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
/**
|
|
3607
|
+
* @public
|
|
3608
|
+
* @description click 事件负载
|
|
3609
|
+
*/
|
|
3610
|
+
export declare interface ExpressVaultingClickEvent {
|
|
3611
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
/**
|
|
3615
|
+
* @public
|
|
3616
|
+
* @description confirm 事件负载(PayPal onApprove 成功后触发,商户可在回调中调 confirmVaulting)
|
|
3617
|
+
*/
|
|
3618
|
+
export declare interface ExpressVaultingConfirmEvent {
|
|
3619
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
3620
|
+
payerInfo?: ExpressVaultingPayerInfo;
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3623
|
+
/**
|
|
3624
|
+
* @public
|
|
3625
|
+
* @description Express Vaulting element - PayPal 绑卡 Element
|
|
3626
|
+
*
|
|
3627
|
+
* Host 侧只保留 Element 生命周期与 bridge 连接;PayPal 按钮渲染、Braintree SDK
|
|
3628
|
+
* 加载、submit/inquiry 都由 express_vaulting webapp 承接。
|
|
3629
|
+
*
|
|
3630
|
+
* setup 阶段调 sdkActionQuery 拿 paypalClientToken,握手时下发给 iframe(系分
|
|
3631
|
+
* 4.1 节 BR-007:client token 必须来自握手,iframe 不自调 sdkActionQuery)。
|
|
3632
|
+
*/
|
|
3633
|
+
export declare class ExpressVaultingElement extends BaseMainElement<ExpressVaultingElementConfig, ExpressVaultingElementEvents> {
|
|
3634
|
+
static elementType: string;
|
|
3635
|
+
/**
|
|
3636
|
+
* Host-side fullscreen overlay shown while the PayPal popup is open.
|
|
3637
|
+
*
|
|
3638
|
+
* PayPal Braintree vault flow renders its own popup + backdrop inside the
|
|
3639
|
+
* iframe body, so without a host overlay the backdrop only masks the tiny
|
|
3640
|
+
* button area. Mirrors ExpressElement: show on `click`, hide on
|
|
3641
|
+
* `confirm` / `cancel` / `error`.
|
|
3642
|
+
*/
|
|
3643
|
+
private _paypalOverlay;
|
|
3644
|
+
constructor(name: string, config: ExpressVaultingElementConfig);
|
|
3645
|
+
/* Excluded from this release type: setup */
|
|
3646
|
+
/* Excluded from this release type: registerInternalListeners */
|
|
3647
|
+
protected focus(): void;
|
|
3648
|
+
protected blur(): void;
|
|
3649
|
+
protected clear(): void;
|
|
3650
|
+
/* Excluded from this release type: _confirmVaulting */
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
/**
|
|
3654
|
+
* @public
|
|
3655
|
+
* @description Express Vaulting element config type
|
|
3656
|
+
*/
|
|
3657
|
+
export declare interface ExpressVaultingElementConfig extends BaseElementConfig<ExpressVaultingAppConfig> {
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3660
|
+
/**
|
|
3661
|
+
* @public
|
|
3662
|
+
* @description Express Vaulting element 事件类型
|
|
3663
|
+
*/
|
|
3664
|
+
export declare interface ExpressVaultingElementEvents extends AntomBridgeWithNativeEventMap<ExpressVaultingAppConfig> {
|
|
3665
|
+
ready: ExpressVaultingReadyEvent;
|
|
3666
|
+
click: ExpressVaultingClickEvent;
|
|
3667
|
+
confirm: ExpressVaultingConfirmEvent;
|
|
3668
|
+
cancel: ExpressVaultingCancelEvent;
|
|
3669
|
+
error: ExpressVaultingErrorEvent;
|
|
3670
|
+
'OPENSDK@CONFIRM_VAULTING': {
|
|
3671
|
+
requestId: string;
|
|
3672
|
+
redirect?: 'always' | 'if_required';
|
|
3673
|
+
};
|
|
3674
|
+
'OPENSDK@CONFIRM_VAULTING_RESULT': {
|
|
3675
|
+
requestId: string;
|
|
3676
|
+
result: ExpressVaultingResult;
|
|
3677
|
+
};
|
|
3678
|
+
}
|
|
3679
|
+
|
|
3680
|
+
/**
|
|
3681
|
+
* @public
|
|
3682
|
+
* @description error 事件负载
|
|
3683
|
+
*/
|
|
3684
|
+
export declare interface ExpressVaultingErrorEvent extends ErrorPayload<string> {
|
|
3685
|
+
paymentMethodType: ExpressVaultingMethod;
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
/**
|
|
3689
|
+
* Supported express vaulting payment methods. All bridge event payloads carry
|
|
3690
|
+
* `paymentMethodType` — use this enum instead of硬编码 strings so adding a
|
|
3691
|
+
* new wallet only needs one entry here. Must match the iframe-side enum in
|
|
3692
|
+
* elements2/express_vaulting/interface.ts.
|
|
3693
|
+
*/
|
|
3694
|
+
declare enum ExpressVaultingMethod {
|
|
3695
|
+
PAYPAL_DIRECTDEBIT = "PAYPAL_DIRECTDEBIT"
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
/**
|
|
3699
|
+
* @public
|
|
3700
|
+
* @description Braintree tokenizePayment 返回的 payer 信息,随 confirm 事件透传给商户
|
|
3701
|
+
*/
|
|
3702
|
+
export declare interface ExpressVaultingPayerInfo {
|
|
3703
|
+
payerId?: string;
|
|
3704
|
+
email?: string;
|
|
3705
|
+
firstName?: string;
|
|
3706
|
+
lastName?: string;
|
|
3707
|
+
countryCode?: string;
|
|
3708
|
+
phone?: string;
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3711
|
+
/**
|
|
3712
|
+
* MERCHANT_CONFIRM_TIMEOUT is owned by the iframe side (mirrors express_element:
|
|
3713
|
+
* iframe starts a 20s timer on the `confirm` event and sends
|
|
3714
|
+
* `error(MERCHANT_CONFIRM_TIMEOUT)` if the merchant never calls confirmVaulting).
|
|
3715
|
+
* See elements2/express_vaulting/app.tsx + tools/error.ts.
|
|
3716
|
+
*/
|
|
3717
|
+
/**
|
|
3718
|
+
* @public
|
|
3719
|
+
* @description PayPal 按钮配置
|
|
3720
|
+
*/
|
|
3721
|
+
export declare interface ExpressVaultingPayPalConfig {
|
|
3722
|
+
/** 按钮形状 */
|
|
3723
|
+
buttonShape?: 'pill' | 'rect' | 'sharp';
|
|
3724
|
+
}
|
|
3725
|
+
|
|
3726
|
+
/**
|
|
3727
|
+
* @public
|
|
3728
|
+
* @description ready 事件负载
|
|
3729
|
+
*/
|
|
3730
|
+
export declare interface ExpressVaultingReadyEvent {
|
|
3731
|
+
availablePaymentMethods: Partial<Record<ExpressVaultingMethod, boolean>>;
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
/**
|
|
3735
|
+
* @public
|
|
3736
|
+
* @description confirmVaulting 返回结果
|
|
3737
|
+
*/
|
|
3738
|
+
export declare interface ExpressVaultingResult {
|
|
3739
|
+
status: 'SUCCESS' | 'PROCESSING' | 'FAIL' | 'CANCELLED';
|
|
3740
|
+
paymentMethodId?: string;
|
|
3741
|
+
payerId?: string;
|
|
3742
|
+
error?: {
|
|
3743
|
+
code: string;
|
|
3744
|
+
message: string;
|
|
3745
|
+
};
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3399
3748
|
declare interface ExpSupportBank {
|
|
3400
3749
|
/**
|
|
3401
3750
|
* @description 银行名称
|
|
@@ -3474,6 +3823,57 @@ declare interface FrontSupportIppBank {
|
|
|
3474
3823
|
logo?: Logo;
|
|
3475
3824
|
}
|
|
3476
3825
|
|
|
3826
|
+
/** host 回传 webapp 的 OPENSDK@GET_APPLE_PAY_TOKEN_REPLY 形态(result 对齐老链路 {token,billingContact,shippingContact})。 */
|
|
3827
|
+
declare interface GetApplePayTokenReply {
|
|
3828
|
+
success: boolean;
|
|
3829
|
+
result?: {
|
|
3830
|
+
token?: unknown;
|
|
3831
|
+
billingContact?: unknown;
|
|
3832
|
+
shippingContact?: unknown;
|
|
3833
|
+
} | {
|
|
3834
|
+
errorCode: string;
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3837
|
+
|
|
3838
|
+
/** webapp 传来的 OPENSDK@GET_APPLE_PAY_TOKEN payload 形态。 */
|
|
3839
|
+
declare interface GetApplePayTokenRequest {
|
|
3840
|
+
paymentMethod?: {
|
|
3841
|
+
paymentMethodDetail?: {
|
|
3842
|
+
applePayProps?: {
|
|
3843
|
+
paymentRequest?: unknown;
|
|
3844
|
+
};
|
|
3845
|
+
};
|
|
3846
|
+
};
|
|
3847
|
+
shipping?: unknown;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
/** host 回传 webapp 的 OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY 形态。 */
|
|
3851
|
+
declare interface GetGooglePayTokenReply {
|
|
3852
|
+
success: boolean;
|
|
3853
|
+
result?: unknown;
|
|
3854
|
+
err?: {
|
|
3855
|
+
statusCode?: string;
|
|
3856
|
+
[key: string]: unknown;
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
/** webapp 传来的 OPENSDK@GET_GOOGLE_PAY_TOKEN payload 形态。 */
|
|
3861
|
+
declare interface GetGooglePayTokenRequest {
|
|
3862
|
+
actionName?: string;
|
|
3863
|
+
data?: {
|
|
3864
|
+
environment?: string;
|
|
3865
|
+
paymentRequest?: unknown;
|
|
3866
|
+
paymentMethod?: unknown;
|
|
3867
|
+
paymentMethodDetail?: {
|
|
3868
|
+
googlePayProps?: {
|
|
3869
|
+
environment?: string;
|
|
3870
|
+
paymentRequest?: unknown;
|
|
3871
|
+
};
|
|
3872
|
+
};
|
|
3873
|
+
[key: string]: unknown;
|
|
3874
|
+
};
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3477
3877
|
declare type GetI18nQueryParam = string | {
|
|
3478
3878
|
/**
|
|
3479
3879
|
* 多语言文案的 key
|
|
@@ -4324,6 +4724,58 @@ declare interface Language {
|
|
|
4324
4724
|
country?: string;
|
|
4325
4725
|
}
|
|
4326
4726
|
|
|
4727
|
+
/**
|
|
4728
|
+
* @deprecated Token 1.0 老字段类型 — 请迁移到 {@link AppearanceVariables}。
|
|
4729
|
+
* 所有字段均已废弃,运行时由 WebApp 侧 LEGACY_TO_NEW_TOKEN_MAP 翻译为新 token。
|
|
4730
|
+
*
|
|
4731
|
+
* @deprecated 'content-primary' → color-text-primary
|
|
4732
|
+
* @deprecated 'content-secondary' → color-text-secondary
|
|
4733
|
+
* @deprecated 'content-tertiary' → color-text-tertiary
|
|
4734
|
+
* @deprecated 'content-quaternary' → color-text-inverse
|
|
4735
|
+
* @deprecated 'background-primary' → color-background-primary
|
|
4736
|
+
* @deprecated 'background-secondary' → color-background-secondary
|
|
4737
|
+
* @deprecated 'background-disable' → color-background-disabled
|
|
4738
|
+
* @deprecated 'background-transparency' → color-background-transparency
|
|
4739
|
+
* @deprecated 'border-primary' → color-border-primary
|
|
4740
|
+
* @deprecated 'border-secondary' → color-border-secondary
|
|
4741
|
+
* @deprecated 'border-disable' → color-border-disabled
|
|
4742
|
+
* @deprecated 'border-active' → color-border-active
|
|
4743
|
+
* @deprecated 'action-normal' → 一对多 fan-out(无单值映射;运行时展开为 3 个新 token,老 key 不再注入):
|
|
4744
|
+
* - background/background-color → color-backgroundBrand-primary
|
|
4745
|
+
* - border/border-color/box-shadow → color-border-active
|
|
4746
|
+
* - color/文本/图标/勾选态 → color-text-active
|
|
4747
|
+
* @deprecated 'action-hover' → 一对多 fan-out(运行时展开为 2 个新 token,老 key 不再注入):
|
|
4748
|
+
* - background → color-backgroundBrand-primary-hover
|
|
4749
|
+
* - border → color-borderBrand-primary-hover
|
|
4750
|
+
* 文字色 color-textBrand-secondary-hover 不参与派生
|
|
4751
|
+
* (设计稿中与 bg/border 不同色阶),需要时请显式传入该新 token 键
|
|
4752
|
+
* @deprecated 'action-secondary' → color-backgroundBrand-secondary
|
|
4753
|
+
* @deprecated 'action-disable' → 一对多 fan-out(运行时展开为 2 个新 token,老 key 不再注入):
|
|
4754
|
+
* - background/background-color → color-backgroundBrand-disabled
|
|
4755
|
+
* - border/border-color → color-borderBrand-disabled
|
|
4756
|
+
* 文字色 color-textBrand-disabled 不参与派生
|
|
4757
|
+
* (设计稿中全部主题均与 bg/border 不同色阶),需要时请显式传入该新 token 键
|
|
4758
|
+
* @deprecated 'state-success' → color-text-success
|
|
4759
|
+
* @deprecated 'state-failure' → color-text-danger
|
|
4760
|
+
* @deprecated 'state-warning' → color-text-warning
|
|
4761
|
+
* @deprecated 'state-info' → color-text-info
|
|
4762
|
+
* @deprecated 'state-conventional' → color-text-neutral
|
|
4763
|
+
* @deprecated 'state-marketing' → color-text-promotional(color 上下文;background 上下文由 CSS 层直接迁移)
|
|
4764
|
+
* @deprecated 'radius-backup' → radius-sm
|
|
4765
|
+
* @deprecated 'radius-component' → radius-md
|
|
4766
|
+
* @deprecated 'radius-module' → radius-lg
|
|
4767
|
+
* @deprecated 'radius-button' → radius-lg(与 radius-module 同档合并)
|
|
4768
|
+
* @deprecated 'wrapper-padding' → spacing-lg
|
|
4769
|
+
* @deprecated 'stroke-default' → 由 Rules 机制接管
|
|
4770
|
+
* @deprecated 'stroke-active' → 由 Rules 机制接管
|
|
4771
|
+
*
|
|
4772
|
+
* 注:fan-out 展开基数以 figma-v4 设计稿的色阶一致性为准,故 action-hover / action-disable
|
|
4773
|
+
* 为 1→2 而非 1→3;三者合计派生 7 项。
|
|
4774
|
+
*/
|
|
4775
|
+
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'
|
|
4776
|
+
/** 非 Token 体系字段,由 WebApp 侧展开为 design-font-family-* 系列 */
|
|
4777
|
+
| 'fontFamily';
|
|
4778
|
+
|
|
4327
4779
|
declare interface Link {
|
|
4328
4780
|
/**
|
|
4329
4781
|
* @description 发起关联的父元素,如国家
|
|
@@ -6889,7 +7341,7 @@ declare interface OtpChallengeActionForm {
|
|
|
6889
7341
|
resendLeftTimes?: number;
|
|
6890
7342
|
}
|
|
6891
7343
|
|
|
6892
|
-
declare type PartialSpeKey<T, V> = Partial<T extends
|
|
7344
|
+
declare type PartialSpeKey<T extends string | undefined, V> = Partial<Record<T extends string ? T : string, V>>;
|
|
6893
7345
|
|
|
6894
7346
|
declare interface PayByLinkInfo {
|
|
6895
7347
|
/**
|
|
@@ -6913,7 +7365,9 @@ declare interface PayByLinkInfo {
|
|
|
6913
7365
|
/**
|
|
6914
7366
|
* @description Payment element app config type
|
|
6915
7367
|
*/
|
|
6916
|
-
export declare interface PaymentAppConfig extends
|
|
7368
|
+
export declare interface PaymentAppConfig extends BaseElementAppConfig {
|
|
7369
|
+
/** Payment appearance configuration including optional alias-only Rules. */
|
|
7370
|
+
appearance?: PaymentAppearance;
|
|
6917
7371
|
/**
|
|
6918
7372
|
* @description sessionData,无法通过updateConfig更新
|
|
6919
7373
|
*/
|
|
@@ -6943,12 +7397,18 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
6943
7397
|
/**
|
|
6944
7398
|
* @description Payment element appearance type
|
|
6945
7399
|
*/
|
|
6946
|
-
export declare type PaymentAppearance =
|
|
7400
|
+
export declare type PaymentAppearance = PickAntomAppearance<PaymentAppearanceProps>;
|
|
7401
|
+
|
|
7402
|
+
/**
|
|
7403
|
+
* @description Payment element appearance properties
|
|
7404
|
+
*/
|
|
7405
|
+
export declare type PaymentAppearanceProps = {
|
|
6947
7406
|
displaySetting: 'showPaymentMethodListWhenSingleOption' | 'showCardBrandIcon' | 'showRadioWhenAccordionLayout' | 'showCardCVV';
|
|
6948
7407
|
theme: AntomTheme;
|
|
6949
|
-
variables: AntomVariables;
|
|
7408
|
+
variables: AppearanceVariables | AntomVariables;
|
|
6950
7409
|
layout: AntomLayouts;
|
|
6951
|
-
|
|
7410
|
+
rules: AppearanceRuleSelector<string>;
|
|
7411
|
+
};
|
|
6952
7412
|
|
|
6953
7413
|
/**
|
|
6954
7414
|
* @description Payment element
|
|
@@ -6956,13 +7416,23 @@ export declare type PaymentAppearance = PickAppearance<{
|
|
|
6956
7416
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
6957
7417
|
static elementType: string;
|
|
6958
7418
|
private _paymentInProgress;
|
|
7419
|
+
private readonly paymentTracker;
|
|
7420
|
+
private _mountStartedAt;
|
|
7421
|
+
private _mountInProgress;
|
|
7422
|
+
private _mountPhase;
|
|
7423
|
+
private _destroyInProgress;
|
|
7424
|
+
private readonly walletLogger;
|
|
6959
7425
|
constructor(name: string, config: PaymentElementConfig);
|
|
6960
7426
|
/* Excluded from this release type: setup */
|
|
7427
|
+
mount(container: HTMLElement): Promise<void>;
|
|
6961
7428
|
/**
|
|
6962
|
-
* @description Update payment element configuration with amount validation
|
|
7429
|
+
* @description Update payment element configuration with amount validation and appearance Rules support
|
|
6963
7430
|
*/
|
|
6964
|
-
updateConfig(newConfig:
|
|
7431
|
+
updateConfig(newConfig: Partial<PaymentAppConfig>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
6965
7432
|
/* Excluded from this release type: submit */
|
|
7433
|
+
on<T extends keyof PaymentElementEvents>(event: T, handler: (payload: PaymentElementEvents[T]) => void): void;
|
|
7434
|
+
unmount(): void;
|
|
7435
|
+
destroy(): void;
|
|
6966
7436
|
protected focus(): void;
|
|
6967
7437
|
protected blur(): void;
|
|
6968
7438
|
protected clear(): void;
|
|
@@ -6978,6 +7448,25 @@ declare interface PaymentElementConfig extends BaseElementConfig<PaymentAppConfi
|
|
|
6978
7448
|
* @description Payment element events
|
|
6979
7449
|
*/
|
|
6980
7450
|
export declare interface PaymentElementEvents extends AntomBridgeWithNativeEventMap<PaymentAppConfig, PaymentSubmitParams, PaymentSubmitResult> {
|
|
7451
|
+
/**
|
|
7452
|
+
* webapp 委托 host(父 frame)拉起 Apple Pay 拿 token。
|
|
7453
|
+
* payload 结构对齐 ModernElementController.GetApplePayTokenRequest(放 paymentMethod/shipping)。
|
|
7454
|
+
*/
|
|
7455
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN': GetApplePayTokenRequest;
|
|
7456
|
+
/** host 完成 Apple Pay token 获取后回包给 webapp */
|
|
7457
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': GetApplePayTokenReply;
|
|
7458
|
+
/**
|
|
7459
|
+
* webapp 委托 host(父 frame)拉起 Google Pay 拿 token。
|
|
7460
|
+
* payload 结构对齐 ModernElementController.GetGooglePayTokenRequest(放 data.environment/paymentRequest)。
|
|
7461
|
+
*/
|
|
7462
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN': GetGooglePayTokenRequest;
|
|
7463
|
+
/** host 完成 Google Pay token 获取后回包给 webapp */
|
|
7464
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY': GetGooglePayTokenReply;
|
|
7465
|
+
/** WebApp notifies the host when the selected payment method changes. */
|
|
7466
|
+
paymentMethodChanged: {
|
|
7467
|
+
type: string;
|
|
7468
|
+
name?: string;
|
|
7469
|
+
};
|
|
6981
7470
|
}
|
|
6982
7471
|
|
|
6983
7472
|
declare interface PaymentElementView {
|
|
@@ -7669,6 +8158,7 @@ export declare interface PayPalConfig {
|
|
|
7669
8158
|
channelMerchantAccountId?: string;
|
|
7670
8159
|
/** Button style (fine-grained override) */
|
|
7671
8160
|
style?: PayPalButtonStyle;
|
|
8161
|
+
businessDivision?: string;
|
|
7672
8162
|
/** Callback to create PayPal order, no params, returns sessionData */
|
|
7673
8163
|
createOrder?: () => Promise<string>;
|
|
7674
8164
|
/** Callback when user changes shipping address, data is raw data returned by PayPal */
|
|
@@ -7688,12 +8178,15 @@ declare interface PeriodRule {
|
|
|
7688
8178
|
periodCount?: number;
|
|
7689
8179
|
}
|
|
7690
8180
|
|
|
8181
|
+
/** Builds an Antom appearance type with the restricted Rules declaration contract. */
|
|
8182
|
+
declare type PickAntomAppearance<T extends Record<string, any>> = PickAppearance<T, AppearanceRuleDeclarations>;
|
|
8183
|
+
|
|
7691
8184
|
/**
|
|
7692
8185
|
* @description 工具类型,仅从 Appearance 中拾取与 Props 类型匹配的属性。
|
|
7693
8186
|
* 返回受 Props 中存在的键约束的部分外观对象。
|
|
7694
8187
|
* @template Props - 要从 Appearance 中拾取的自定义外观属性类型。
|
|
7695
8188
|
*/
|
|
7696
|
-
declare type PickAppearance<Props extends Partial<DefaultAppearanceProps>> = Partial<Pick<Appearance<Props>, keyof Props extends infer k extends keyof Partial<Appearance> ? k : keyof Partial<Appearance>>>;
|
|
8189
|
+
declare type PickAppearance<Props extends Partial<DefaultAppearanceProps>, Rules extends CSS_2.Properties<string, number> = CSS_2.Properties<string, number>> = Partial<Pick<Appearance<Props, Rules>, keyof Props extends infer k extends keyof Partial<Appearance> ? k : keyof Partial<Appearance>>>;
|
|
7697
8190
|
|
|
7698
8191
|
/**
|
|
7699
8192
|
* @description 政策信息,例如隐私链接,免责声明等
|
|
@@ -24393,7 +24886,9 @@ declare interface UserName {
|
|
|
24393
24886
|
* @public
|
|
24394
24887
|
* @description Vaulting element app config type
|
|
24395
24888
|
*/
|
|
24396
|
-
export declare interface VaultingAppConfig extends
|
|
24889
|
+
export declare interface VaultingAppConfig extends BaseElementAppConfig {
|
|
24890
|
+
/** Vaulting appearance configuration including optional alias-only Rules. */
|
|
24891
|
+
appearance?: VaultingAppearance;
|
|
24397
24892
|
/**
|
|
24398
24893
|
* @description sessionData,无法通过updateConfig更新
|
|
24399
24894
|
*/
|
|
@@ -24406,13 +24901,14 @@ export declare interface VaultingAppConfig extends BaseAppearance<VaultingAppear
|
|
|
24406
24901
|
/* Excluded from this release type: preloadTelemetryContext */
|
|
24407
24902
|
}
|
|
24408
24903
|
|
|
24409
|
-
export declare type VaultingAppearance =
|
|
24904
|
+
export declare type VaultingAppearance = PickAntomAppearance<VaultingAppearanceProps>;
|
|
24410
24905
|
|
|
24411
24906
|
export declare type VaultingAppearanceProps = {
|
|
24412
24907
|
displaySetting: 'showCardBrandIcon';
|
|
24413
24908
|
theme: AntomTheme;
|
|
24414
|
-
variables: AntomVariables;
|
|
24909
|
+
variables: AppearanceVariables | AntomVariables;
|
|
24415
24910
|
fonts?: FontSource[];
|
|
24911
|
+
rules: AppearanceRuleSelector<string>;
|
|
24416
24912
|
};
|
|
24417
24913
|
|
|
24418
24914
|
/**
|
|
@@ -24420,9 +24916,22 @@ export declare type VaultingAppearanceProps = {
|
|
|
24420
24916
|
*/
|
|
24421
24917
|
export declare class VaultingElement extends BaseMainElement<VaultingElementConfig, VaultingElementEvents> {
|
|
24422
24918
|
static elementType: string;
|
|
24919
|
+
private readonly elementTracker;
|
|
24920
|
+
private _mountInProgress;
|
|
24921
|
+
private _destroyInProgress;
|
|
24423
24922
|
constructor(name: string, config: VaultingElementConfig);
|
|
24424
24923
|
/* Excluded from this release type: setup */
|
|
24924
|
+
/**
|
|
24925
|
+
* Updates Vaulting configuration while preserving the public Rules clear semantics.
|
|
24926
|
+
* @param newConfig Partial Vaulting configuration patch.
|
|
24927
|
+
* @returns The WebApp update acknowledgement.
|
|
24928
|
+
*/
|
|
24929
|
+
updateConfig(newConfig: Partial<VaultingAppConfig>): Promise<VaultingElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
24425
24930
|
/* Excluded from this release type: submit */
|
|
24931
|
+
mount(container: HTMLElement): Promise<void>;
|
|
24932
|
+
on<T extends keyof VaultingElementEvents>(event: T, handler: (payload: VaultingElementEvents[T]) => void): void;
|
|
24933
|
+
unmount(): void;
|
|
24934
|
+
destroy(): void;
|
|
24426
24935
|
protected focus(): void;
|
|
24427
24936
|
protected blur(): void;
|
|
24428
24937
|
protected clear(): void;
|