@alipay/ams-checkout 0.0.1784626568-dev.2 → 0.0.1784626568-dev.21
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/element/elementProcessor/paymentProcessor.js +7 -5
- package/esm/core/component/element/modernElementController/adapter.js +1 -0
- package/esm/core/component/element/modernElementController/index.d.ts +3 -1
- package/esm/core/component/element/modernElementController/index.js +468 -255
- package/esm/core/utils/connectConfig.d.ts +11 -0
- package/esm/core/utils/connectConfig.js +28 -0
- package/esm/foundation/service/event-center.js +12 -9
- package/esm/modern/index.js +1 -1
- package/esm/modern/tools.js +1 -1
- package/esm/plugin/component/channel.js +2 -0
- package/esm/util/logger.js +1 -1
- package/package.json +4 -1
- package/types.d.ts +99 -27
- package/types.untrimmed.d.ts +101 -25
|
@@ -92,6 +92,8 @@ export var handleGooglePay = function handleGooglePay(data) {
|
|
|
92
92
|
var script = document.createElement('script');
|
|
93
93
|
script.src = 'https://pay.google.com/gp/p/js/pay.js';
|
|
94
94
|
script.async = true;
|
|
95
|
+
|
|
96
|
+
// 当判断条件成立时,代表 document.body.appendChild 方法已经被劫持
|
|
95
97
|
if (document.body.appendChild !== Node.prototype.appendChild) {
|
|
96
98
|
// 使用原生 appendChild 避免微前端沙箱(如 qiankun)将动态 <script> 劫持为 fetch 加载,
|
|
97
99
|
// 导致不支持 CORS 的第三方脚本(如 pay.google.com)加载失败
|
package/esm/util/logger.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "0.0.1784626568-dev.
|
|
3
|
+
"version": "0.0.1784626568-dev.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"exports": {
|
|
@@ -86,6 +86,9 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
+
"@antintl/antom-toolset": "^2.0.0",
|
|
90
|
+
"@antintl/opensdk-cli": "^0.0.20260706074040-dev.6",
|
|
91
|
+
"@antintl/opensdk-core": "^0.0.20260706074040-dev.6",
|
|
89
92
|
"axios": "^1.3.4",
|
|
90
93
|
"proxy-polyfill": "^0.3.2",
|
|
91
94
|
"uuid": "^9.0.0"
|
package/types.d.ts
CHANGED
|
@@ -313,7 +313,7 @@ export declare const AntomSDKErrorCodes: {
|
|
|
313
313
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
314
314
|
readonly UPDATE_CONFIG_NOT_READY: "UPDATE_CONFIG_NOT_READY";
|
|
315
315
|
/**
|
|
316
|
-
*
|
|
316
|
+
* 查询到的结果消息
|
|
317
317
|
*/
|
|
318
318
|
readonly INVALID_MODAL_URL: "INVALID_MODAL_URL";
|
|
319
319
|
readonly LOAD_DEBUGGER_FAILED: "LOAD_DEBUGGER_FAILED";
|
|
@@ -629,6 +629,8 @@ declare type AxiosHeaderMatcher =
|
|
|
629
629
|
| RegExp
|
|
630
630
|
| ((this: AxiosHeaders, value: string, name: string) => boolean);
|
|
631
631
|
|
|
632
|
+
declare type AxiosHeaderParameters = Record<string, string>;
|
|
633
|
+
|
|
632
634
|
declare type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
|
|
633
635
|
|
|
634
636
|
declare class AxiosHeaders {
|
|
@@ -644,6 +646,7 @@ declare class AxiosHeaders {
|
|
|
644
646
|
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|
645
647
|
set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders;
|
|
646
648
|
|
|
649
|
+
get(headerName: string, parser: typeof AxiosHeaders.parseParameters): AxiosHeaderParameters;
|
|
647
650
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
648
651
|
get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
|
649
652
|
|
|
@@ -665,6 +668,8 @@ declare class AxiosHeaders {
|
|
|
665
668
|
|
|
666
669
|
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
|
667
670
|
|
|
671
|
+
static parseParameters(value: AxiosHeaderValue): AxiosHeaderParameters;
|
|
672
|
+
|
|
668
673
|
static accessor(header: string | string[]): AxiosHeaders;
|
|
669
674
|
|
|
670
675
|
static concat(
|
|
@@ -905,6 +910,10 @@ declare abstract class BaseElementsFactory extends BaseFactory {
|
|
|
905
910
|
declare abstract class BaseFactory {
|
|
906
911
|
/* Excluded from this release type: config */
|
|
907
912
|
/* Excluded from this release type: isInit */
|
|
913
|
+
/**
|
|
914
|
+
* Indicates whether this factory instance has been destroyed.
|
|
915
|
+
*/
|
|
916
|
+
isDestroyed: boolean;
|
|
908
917
|
/**
|
|
909
918
|
* @description 当前版本号
|
|
910
919
|
* 用于日志上报
|
|
@@ -3117,19 +3126,6 @@ declare interface ExpPaymentOptionDetail {
|
|
|
3117
3126
|
export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetting>, BaseElementAppConfig {
|
|
3118
3127
|
/** payment SessionData */
|
|
3119
3128
|
sessionData?: string;
|
|
3120
|
-
/** Business division (country/region) */
|
|
3121
|
-
businessDivision?: string;
|
|
3122
|
-
/**
|
|
3123
|
-
* Amount & Currency
|
|
3124
|
-
*
|
|
3125
|
-
* Only effective via `updateConfig({ amount })` at runtime.
|
|
3126
|
-
* Passing amount at creation time is ignored; the initial amount
|
|
3127
|
-
* comes from the server-side sdkQuery result (renderData.paymentAmount).
|
|
3128
|
-
*/
|
|
3129
|
-
amount?: {
|
|
3130
|
-
currency: string;
|
|
3131
|
-
value: string;
|
|
3132
|
-
};
|
|
3133
3129
|
/** PayPal 配置 */
|
|
3134
3130
|
paypal?: PayPalConfig;
|
|
3135
3131
|
/**
|
|
@@ -3161,10 +3157,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3161
3157
|
*/
|
|
3162
3158
|
paymentMethods?: string[];
|
|
3163
3159
|
/* Excluded from this release type: setupError */
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
*/
|
|
3167
|
-
locale?: string;
|
|
3160
|
+
/* Excluded from this release type: locale */
|
|
3161
|
+
/* Excluded from this release type: _paypalSdkEnvironment */
|
|
3168
3162
|
/**
|
|
3169
3163
|
* 是否运行在 Native App 的 WebView 中。
|
|
3170
3164
|
* 为 true 时,跳转通过 onRedirect 事件委托给 Native 端处理。
|
|
@@ -3237,11 +3231,6 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3237
3231
|
private _callbacks;
|
|
3238
3232
|
/** setup 阶段的 renderData,仅供非 Safari PC Apple Pay host-token 路径读取 paymentRequest。 */
|
|
3239
3233
|
private _renderData;
|
|
3240
|
-
/**
|
|
3241
|
-
* 构造时传入的初始金额。cleanAppConfig 已剔除 amount,setup 阶段透传给 iframe(PayPal 按钮首屏需要)
|
|
3242
|
-
* 与 PayPal channelClientId 查询仍需读它;运行时改额只能走 updateConfig。
|
|
3243
|
-
*/
|
|
3244
|
-
private _initialAmount;
|
|
3245
3234
|
/**
|
|
3246
3235
|
* 本地事件处理器(绕过 bridge 的 host→webapp 方向限制)。
|
|
3247
3236
|
* bridge.on 只能监听 iframe 发来的消息;SDK host 主动推送事件给商户时走 _emit → _localHandlers。
|
|
@@ -3252,9 +3241,7 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3252
3241
|
private _paypalOverlay;
|
|
3253
3242
|
constructor(name: string, config: ExpressElementConfig);
|
|
3254
3243
|
/**
|
|
3255
|
-
* 重写 on
|
|
3256
|
-
* 1. 对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
3257
|
-
* 2. 对 onRedirect 事件同步注册到 _localHandlers(SDK host 主动推送时商户能收到)
|
|
3244
|
+
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
3258
3245
|
*/
|
|
3259
3246
|
on(event: string, handler: (...args: any[]) => void): void;
|
|
3260
3247
|
/**
|
|
@@ -3262,7 +3249,12 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3262
3249
|
* 用于 Native WebView 场景下 SDK 需要向商户透传跳转信息等。
|
|
3263
3250
|
*/
|
|
3264
3251
|
private _emit;
|
|
3265
|
-
updateConfig(newConfig:
|
|
3252
|
+
updateConfig(newConfig: {
|
|
3253
|
+
amount: {
|
|
3254
|
+
currency: string;
|
|
3255
|
+
value: string;
|
|
3256
|
+
};
|
|
3257
|
+
}): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3266
3258
|
/**
|
|
3267
3259
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3268
3260
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
@@ -3275,6 +3267,15 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3275
3267
|
code: string;
|
|
3276
3268
|
message: string;
|
|
3277
3269
|
};
|
|
3270
|
+
/** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
|
|
3271
|
+
userCanceled3D?: boolean;
|
|
3272
|
+
/**
|
|
3273
|
+
* 支付终态,与 SubmitResult.status 契约一致:
|
|
3274
|
+
* - SUCCESS / CANCELLED / FAIL 由 webapp 透传(基于接口 paymentStatus / 客户端取消事件判定)
|
|
3275
|
+
* - PROCESSING 由 SDK 端超时兜底产生(completePayment 5 分钟轮询超时,支付状态未知)
|
|
3276
|
+
* 未传时由调用方兜底推导
|
|
3277
|
+
*/
|
|
3278
|
+
status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
|
|
3278
3279
|
}>;
|
|
3279
3280
|
setup(): Promise<Partial<ExpressAppConfig> | undefined>;
|
|
3280
3281
|
private registerInternalListeners;
|
|
@@ -3373,6 +3374,14 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3373
3374
|
};
|
|
3374
3375
|
}
|
|
3375
3376
|
|
|
3377
|
+
declare type ExpressPaymentMethod = (typeof SUPPORTED_EXPRESS_METHODS)[number];
|
|
3378
|
+
|
|
3379
|
+
declare type ExpressSetupError = ErrorPayload & {
|
|
3380
|
+
expressPaymentType?: ExpressPaymentMethod;
|
|
3381
|
+
/** 服务端返回的 errorMessage 已完成国际化,可直接对客展示 */
|
|
3382
|
+
mulityLanguageMapping?: boolean;
|
|
3383
|
+
};
|
|
3384
|
+
|
|
3376
3385
|
declare interface ExpSupportBank {
|
|
3377
3386
|
/**
|
|
3378
3387
|
* @description 银行名称
|
|
@@ -6891,6 +6900,7 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
6891
6900
|
*/
|
|
6892
6901
|
sessionData?: string;
|
|
6893
6902
|
/* Excluded from this release type: merchantDomain */
|
|
6903
|
+
doMain?: string;
|
|
6894
6904
|
/* Excluded from this release type: renderData */
|
|
6895
6905
|
/* Excluded from this release type: connectAccount */
|
|
6896
6906
|
/* Excluded from this release type: sessionMetaData */
|
|
@@ -6899,6 +6909,15 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
6899
6909
|
/* Excluded from this release type: _requestConfig */
|
|
6900
6910
|
/* Excluded from this release type: logMetaData */
|
|
6901
6911
|
/* Excluded from this release type: heightOfVisible */
|
|
6912
|
+
/**
|
|
6913
|
+
* Amount & Currency
|
|
6914
|
+
*
|
|
6915
|
+
* Only effective via `updateConfig({ amount })` at runtime.
|
|
6916
|
+
*/
|
|
6917
|
+
amount?: {
|
|
6918
|
+
currency: string;
|
|
6919
|
+
value: string;
|
|
6920
|
+
};
|
|
6902
6921
|
}
|
|
6903
6922
|
|
|
6904
6923
|
/**
|
|
@@ -6916,8 +6935,13 @@ export declare type PaymentAppearance = PickAppearance<{
|
|
|
6916
6935
|
*/
|
|
6917
6936
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
6918
6937
|
static elementType: string;
|
|
6938
|
+
private _paymentInProgress;
|
|
6919
6939
|
constructor(name: string, config: PaymentElementConfig);
|
|
6920
6940
|
/* Excluded from this release type: setup */
|
|
6941
|
+
/**
|
|
6942
|
+
* @description Update payment element configuration with amount validation
|
|
6943
|
+
*/
|
|
6944
|
+
updateConfig(newConfig: Pick<PaymentAppConfig, 'amount'>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
6921
6945
|
/* Excluded from this release type: submit */
|
|
6922
6946
|
protected focus(): void;
|
|
6923
6947
|
protected blur(): void;
|
|
@@ -7625,6 +7649,20 @@ export declare interface PayPalConfig {
|
|
|
7625
7649
|
channelMerchantAccountId?: string;
|
|
7626
7650
|
/** Button style (fine-grained override) */
|
|
7627
7651
|
style?: PayPalButtonStyle;
|
|
7652
|
+
/**
|
|
7653
|
+
* PayPal 专属首屏币种(仅 currency)。
|
|
7654
|
+
* 用于 PayPal channelClientIdQuery 与首屏按钮 SDK 加载 / findEligibleMethods;
|
|
7655
|
+
* PayPal 不消费 amount.value(实际扣款金额由 createOrder 回调返回的 sessionData 决定)。
|
|
7656
|
+
*/
|
|
7657
|
+
amount?: {
|
|
7658
|
+
currency: string;
|
|
7659
|
+
};
|
|
7660
|
+
/**
|
|
7661
|
+
* Business division (country/region),PayPal 专属:用于 channelClientIdQuery 的 businessDivision
|
|
7662
|
+
* 参数与 per-call hostSign(见 setup.ts resolvePayPalSetup)。AP/GP/Alipay 的 sdkQuery hostSign
|
|
7663
|
+
* 由 sessionData 解析,不读此字段,故归位 paypal 配置避免污染其它渠道。
|
|
7664
|
+
*/
|
|
7665
|
+
businessDivision?: string;
|
|
7628
7666
|
/** Callback to create PayPal order, no params, returns sessionData */
|
|
7629
7667
|
createOrder?: () => Promise<string>;
|
|
7630
7668
|
/** Callback when user changes shipping address, data is raw data returned by PayPal */
|
|
@@ -23780,6 +23818,10 @@ export declare type SubmitResult = {
|
|
|
23780
23818
|
* 查询到的结果消息
|
|
23781
23819
|
*/
|
|
23782
23820
|
message?: string;
|
|
23821
|
+
/**
|
|
23822
|
+
* @description 接口错误时的链路追踪 id,用于定位排查根因(非错误状态无该字段)
|
|
23823
|
+
*/
|
|
23824
|
+
traceId?: string;
|
|
23783
23825
|
/**
|
|
23784
23826
|
* @description 是否需要更换 session 重试
|
|
23785
23827
|
*/
|
|
@@ -23901,6 +23943,8 @@ declare interface SubscriptionPricePlan {
|
|
|
23901
23943
|
pricePlanAmountView?: PaymentView;
|
|
23902
23944
|
}
|
|
23903
23945
|
|
|
23946
|
+
declare const SUPPORTED_EXPRESS_METHODS: readonly ["paypal", "applePay", "googlePay", "alipay"];
|
|
23947
|
+
|
|
23904
23948
|
declare type SvgAttributes =
|
|
23905
23949
|
| "[-khtml-opacity]"
|
|
23906
23950
|
| "[-moz-opacity]"
|
|
@@ -24252,6 +24296,34 @@ export declare const themeColorMap: Record<AntomTheme, {
|
|
|
24252
24296
|
backgroundColor: string;
|
|
24253
24297
|
}>;
|
|
24254
24298
|
|
|
24299
|
+
/** Configuration options for rendering a toast notification. */
|
|
24300
|
+
export declare interface ToastParams {
|
|
24301
|
+
/** Text displayed in the toast. */
|
|
24302
|
+
message: string;
|
|
24303
|
+
/** Placement of the toast container within the viewport. */
|
|
24304
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
24305
|
+
/** Toast background color in any valid CSS color format. */
|
|
24306
|
+
backgroundColor?: string;
|
|
24307
|
+
/** Toast text color in any valid CSS color format. */
|
|
24308
|
+
color?: string;
|
|
24309
|
+
/** Toast padding in any valid CSS length format. */
|
|
24310
|
+
padding?: string;
|
|
24311
|
+
/** Toast border radius in any valid CSS length format. */
|
|
24312
|
+
borderRadius?: string;
|
|
24313
|
+
/** Toast font size in any valid CSS length format. */
|
|
24314
|
+
fontSize?: string;
|
|
24315
|
+
/** Stacking order of the toast container. */
|
|
24316
|
+
zIndex?: number;
|
|
24317
|
+
/** Toast width in any valid CSS length format. */
|
|
24318
|
+
width?: string;
|
|
24319
|
+
/** Time in milliseconds before the toast starts to disappear. */
|
|
24320
|
+
duration?: number;
|
|
24321
|
+
/** Preset status icon displayed above the message. */
|
|
24322
|
+
icon?: 'SUCCESS' | 'FAIL';
|
|
24323
|
+
/** Whether the status icon uses a spinning animation. */
|
|
24324
|
+
spin?: boolean;
|
|
24325
|
+
}
|
|
24326
|
+
|
|
24255
24327
|
/**
|
|
24256
24328
|
* @description 交易信息
|
|
24257
24329
|
*/
|
package/types.untrimmed.d.ts
CHANGED
|
@@ -406,7 +406,7 @@ export declare const AntomSDKErrorCodes: {
|
|
|
406
406
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
407
407
|
readonly UPDATE_CONFIG_NOT_READY: "UPDATE_CONFIG_NOT_READY";
|
|
408
408
|
/**
|
|
409
|
-
*
|
|
409
|
+
* 查询到的结果消息
|
|
410
410
|
*/
|
|
411
411
|
readonly INVALID_MODAL_URL: "INVALID_MODAL_URL";
|
|
412
412
|
readonly LOAD_DEBUGGER_FAILED: "LOAD_DEBUGGER_FAILED";
|
|
@@ -722,6 +722,8 @@ declare type AxiosHeaderMatcher =
|
|
|
722
722
|
| RegExp
|
|
723
723
|
| ((this: AxiosHeaders, value: string, name: string) => boolean);
|
|
724
724
|
|
|
725
|
+
declare type AxiosHeaderParameters = Record<string, string>;
|
|
726
|
+
|
|
725
727
|
declare type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
|
|
726
728
|
|
|
727
729
|
declare class AxiosHeaders {
|
|
@@ -737,6 +739,7 @@ declare class AxiosHeaders {
|
|
|
737
739
|
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|
738
740
|
set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders;
|
|
739
741
|
|
|
742
|
+
get(headerName: string, parser: typeof AxiosHeaders.parseParameters): AxiosHeaderParameters;
|
|
740
743
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
741
744
|
get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
|
742
745
|
|
|
@@ -758,6 +761,8 @@ declare class AxiosHeaders {
|
|
|
758
761
|
|
|
759
762
|
static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
|
|
760
763
|
|
|
764
|
+
static parseParameters(value: AxiosHeaderValue): AxiosHeaderParameters;
|
|
765
|
+
|
|
761
766
|
static accessor(header: string | string[]): AxiosHeaders;
|
|
762
767
|
|
|
763
768
|
static concat(
|
|
@@ -1190,6 +1195,10 @@ declare abstract class BaseFactory {
|
|
|
1190
1195
|
* @internal
|
|
1191
1196
|
*/
|
|
1192
1197
|
private isInit;
|
|
1198
|
+
/**
|
|
1199
|
+
* Indicates whether this factory instance has been destroyed.
|
|
1200
|
+
*/
|
|
1201
|
+
isDestroyed: boolean;
|
|
1193
1202
|
/**
|
|
1194
1203
|
* @description 当前版本号
|
|
1195
1204
|
* 用于日志上报
|
|
@@ -3530,19 +3539,6 @@ declare interface ExpPaymentOptionDetail {
|
|
|
3530
3539
|
export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetting>, BaseElementAppConfig {
|
|
3531
3540
|
/** payment SessionData */
|
|
3532
3541
|
sessionData?: string;
|
|
3533
|
-
/** Business division (country/region) */
|
|
3534
|
-
businessDivision?: string;
|
|
3535
|
-
/**
|
|
3536
|
-
* Amount & Currency
|
|
3537
|
-
*
|
|
3538
|
-
* Only effective via `updateConfig({ amount })` at runtime.
|
|
3539
|
-
* Passing amount at creation time is ignored; the initial amount
|
|
3540
|
-
* comes from the server-side sdkQuery result (renderData.paymentAmount).
|
|
3541
|
-
*/
|
|
3542
|
-
amount?: {
|
|
3543
|
-
currency: string;
|
|
3544
|
-
value: string;
|
|
3545
|
-
};
|
|
3546
3542
|
/** PayPal 配置 */
|
|
3547
3543
|
paypal?: PayPalConfig;
|
|
3548
3544
|
/**
|
|
@@ -3576,11 +3572,13 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3576
3572
|
/**
|
|
3577
3573
|
* @internal setup 阶段的错误信息,传给 iframe 侧处理
|
|
3578
3574
|
*/
|
|
3579
|
-
setupError?:
|
|
3575
|
+
setupError?: ExpressSetupError;
|
|
3580
3576
|
/**
|
|
3581
|
-
* Locale
|
|
3577
|
+
* @internal Locale is injected from loadAntom and defaults to en_US.
|
|
3582
3578
|
*/
|
|
3583
3579
|
locale?: string;
|
|
3580
|
+
/** @internal PayPal v6 core script environment injected from the element env. */
|
|
3581
|
+
_paypalSdkEnvironment?: 'sandbox' | 'prod';
|
|
3584
3582
|
/**
|
|
3585
3583
|
* 是否运行在 Native App 的 WebView 中。
|
|
3586
3584
|
* 为 true 时,跳转通过 onRedirect 事件委托给 Native 端处理。
|
|
@@ -3655,11 +3653,6 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3655
3653
|
private _callbacks;
|
|
3656
3654
|
/** setup 阶段的 renderData,仅供非 Safari PC Apple Pay host-token 路径读取 paymentRequest。 */
|
|
3657
3655
|
private _renderData;
|
|
3658
|
-
/**
|
|
3659
|
-
* 构造时传入的初始金额。cleanAppConfig 已剔除 amount,setup 阶段透传给 iframe(PayPal 按钮首屏需要)
|
|
3660
|
-
* 与 PayPal channelClientId 查询仍需读它;运行时改额只能走 updateConfig。
|
|
3661
|
-
*/
|
|
3662
|
-
private _initialAmount;
|
|
3663
3656
|
/**
|
|
3664
3657
|
* 本地事件处理器(绕过 bridge 的 host→webapp 方向限制)。
|
|
3665
3658
|
* bridge.on 只能监听 iframe 发来的消息;SDK host 主动推送事件给商户时走 _emit → _localHandlers。
|
|
@@ -3670,9 +3663,7 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3670
3663
|
private _paypalOverlay;
|
|
3671
3664
|
constructor(name: string, config: ExpressElementConfig);
|
|
3672
3665
|
/**
|
|
3673
|
-
* 重写 on
|
|
3674
|
-
* 1. 对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
3675
|
-
* 2. 对 onRedirect 事件同步注册到 _localHandlers(SDK host 主动推送时商户能收到)
|
|
3666
|
+
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
3676
3667
|
*/
|
|
3677
3668
|
on(event: string, handler: (...args: any[]) => void): void;
|
|
3678
3669
|
/**
|
|
@@ -3680,7 +3671,12 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3680
3671
|
* 用于 Native WebView 场景下 SDK 需要向商户透传跳转信息等。
|
|
3681
3672
|
*/
|
|
3682
3673
|
private _emit;
|
|
3683
|
-
updateConfig(newConfig:
|
|
3674
|
+
updateConfig(newConfig: {
|
|
3675
|
+
amount: {
|
|
3676
|
+
currency: string;
|
|
3677
|
+
value: string;
|
|
3678
|
+
};
|
|
3679
|
+
}): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3684
3680
|
/**
|
|
3685
3681
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3686
3682
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
@@ -3693,6 +3689,15 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3693
3689
|
code: string;
|
|
3694
3690
|
message: string;
|
|
3695
3691
|
};
|
|
3692
|
+
/** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
|
|
3693
|
+
userCanceled3D?: boolean;
|
|
3694
|
+
/**
|
|
3695
|
+
* 支付终态,与 SubmitResult.status 契约一致:
|
|
3696
|
+
* - SUCCESS / CANCELLED / FAIL 由 webapp 透传(基于接口 paymentStatus / 客户端取消事件判定)
|
|
3697
|
+
* - PROCESSING 由 SDK 端超时兜底产生(completePayment 5 分钟轮询超时,支付状态未知)
|
|
3698
|
+
* 未传时由调用方兜底推导
|
|
3699
|
+
*/
|
|
3700
|
+
status?: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
|
|
3696
3701
|
}>;
|
|
3697
3702
|
setup(): Promise<Partial<ExpressAppConfig> | undefined>;
|
|
3698
3703
|
private registerInternalListeners;
|
|
@@ -3791,6 +3796,14 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3791
3796
|
};
|
|
3792
3797
|
}
|
|
3793
3798
|
|
|
3799
|
+
declare type ExpressPaymentMethod = (typeof SUPPORTED_EXPRESS_METHODS)[number];
|
|
3800
|
+
|
|
3801
|
+
declare type ExpressSetupError = ErrorPayload & {
|
|
3802
|
+
expressPaymentType?: ExpressPaymentMethod;
|
|
3803
|
+
/** 服务端返回的 errorMessage 已完成国际化,可直接对客展示 */
|
|
3804
|
+
mulityLanguageMapping?: boolean;
|
|
3805
|
+
};
|
|
3806
|
+
|
|
3794
3807
|
declare interface ExpSupportBank {
|
|
3795
3808
|
/**
|
|
3796
3809
|
* @description 银行名称
|
|
@@ -7315,6 +7328,7 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
7315
7328
|
* @internal sdk所在hostname
|
|
7316
7329
|
*/
|
|
7317
7330
|
merchantDomain?: string;
|
|
7331
|
+
doMain?: string;
|
|
7318
7332
|
/**
|
|
7319
7333
|
* @internal 渲染数据
|
|
7320
7334
|
*/
|
|
@@ -7353,6 +7367,15 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
|
|
|
7353
7367
|
* @internal 内部使用,无需用户传递,高度信息
|
|
7354
7368
|
*/
|
|
7355
7369
|
heightOfVisible?: number;
|
|
7370
|
+
/**
|
|
7371
|
+
* Amount & Currency
|
|
7372
|
+
*
|
|
7373
|
+
* Only effective via `updateConfig({ amount })` at runtime.
|
|
7374
|
+
*/
|
|
7375
|
+
amount?: {
|
|
7376
|
+
currency: string;
|
|
7377
|
+
value: string;
|
|
7378
|
+
};
|
|
7356
7379
|
}
|
|
7357
7380
|
|
|
7358
7381
|
/**
|
|
@@ -7370,11 +7393,16 @@ export declare type PaymentAppearance = PickAppearance<{
|
|
|
7370
7393
|
*/
|
|
7371
7394
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
7372
7395
|
static elementType: string;
|
|
7396
|
+
private _paymentInProgress;
|
|
7373
7397
|
constructor(name: string, config: PaymentElementConfig);
|
|
7374
7398
|
/**
|
|
7375
7399
|
* @internal
|
|
7376
7400
|
*/
|
|
7377
7401
|
setup(): Promise<Partial<PaymentAppConfig> | undefined>;
|
|
7402
|
+
/**
|
|
7403
|
+
* @description Update payment element configuration with amount validation
|
|
7404
|
+
*/
|
|
7405
|
+
updateConfig(newConfig: Pick<PaymentAppConfig, 'amount'>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
7378
7406
|
/**
|
|
7379
7407
|
* @internal
|
|
7380
7408
|
*/
|
|
@@ -8085,6 +8113,20 @@ export declare interface PayPalConfig {
|
|
|
8085
8113
|
channelMerchantAccountId?: string;
|
|
8086
8114
|
/** Button style (fine-grained override) */
|
|
8087
8115
|
style?: PayPalButtonStyle;
|
|
8116
|
+
/**
|
|
8117
|
+
* PayPal 专属首屏币种(仅 currency)。
|
|
8118
|
+
* 用于 PayPal channelClientIdQuery 与首屏按钮 SDK 加载 / findEligibleMethods;
|
|
8119
|
+
* PayPal 不消费 amount.value(实际扣款金额由 createOrder 回调返回的 sessionData 决定)。
|
|
8120
|
+
*/
|
|
8121
|
+
amount?: {
|
|
8122
|
+
currency: string;
|
|
8123
|
+
};
|
|
8124
|
+
/**
|
|
8125
|
+
* Business division (country/region),PayPal 专属:用于 channelClientIdQuery 的 businessDivision
|
|
8126
|
+
* 参数与 per-call hostSign(见 setup.ts resolvePayPalSetup)。AP/GP/Alipay 的 sdkQuery hostSign
|
|
8127
|
+
* 由 sessionData 解析,不读此字段,故归位 paypal 配置避免污染其它渠道。
|
|
8128
|
+
*/
|
|
8129
|
+
businessDivision?: string;
|
|
8088
8130
|
/** Callback to create PayPal order, no params, returns sessionData */
|
|
8089
8131
|
createOrder?: () => Promise<string>;
|
|
8090
8132
|
/** Callback when user changes shipping address, data is raw data returned by PayPal */
|
|
@@ -24250,6 +24292,10 @@ export declare type SubmitResult = {
|
|
|
24250
24292
|
* 查询到的结果消息
|
|
24251
24293
|
*/
|
|
24252
24294
|
message?: string;
|
|
24295
|
+
/**
|
|
24296
|
+
* @description 接口错误时的链路追踪 id,用于定位排查根因(非错误状态无该字段)
|
|
24297
|
+
*/
|
|
24298
|
+
traceId?: string;
|
|
24253
24299
|
/**
|
|
24254
24300
|
* @description 是否需要更换 session 重试
|
|
24255
24301
|
*/
|
|
@@ -24371,6 +24417,8 @@ declare interface SubscriptionPricePlan {
|
|
|
24371
24417
|
pricePlanAmountView?: PaymentView;
|
|
24372
24418
|
}
|
|
24373
24419
|
|
|
24420
|
+
declare const SUPPORTED_EXPRESS_METHODS: readonly ["paypal", "applePay", "googlePay", "alipay"];
|
|
24421
|
+
|
|
24374
24422
|
declare type SvgAttributes =
|
|
24375
24423
|
| "[-khtml-opacity]"
|
|
24376
24424
|
| "[-moz-opacity]"
|
|
@@ -24722,6 +24770,34 @@ export declare const themeColorMap: Record<AntomTheme, {
|
|
|
24722
24770
|
backgroundColor: string;
|
|
24723
24771
|
}>;
|
|
24724
24772
|
|
|
24773
|
+
/** Configuration options for rendering a toast notification. */
|
|
24774
|
+
export declare interface ToastParams {
|
|
24775
|
+
/** Text displayed in the toast. */
|
|
24776
|
+
message: string;
|
|
24777
|
+
/** Placement of the toast container within the viewport. */
|
|
24778
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
24779
|
+
/** Toast background color in any valid CSS color format. */
|
|
24780
|
+
backgroundColor?: string;
|
|
24781
|
+
/** Toast text color in any valid CSS color format. */
|
|
24782
|
+
color?: string;
|
|
24783
|
+
/** Toast padding in any valid CSS length format. */
|
|
24784
|
+
padding?: string;
|
|
24785
|
+
/** Toast border radius in any valid CSS length format. */
|
|
24786
|
+
borderRadius?: string;
|
|
24787
|
+
/** Toast font size in any valid CSS length format. */
|
|
24788
|
+
fontSize?: string;
|
|
24789
|
+
/** Stacking order of the toast container. */
|
|
24790
|
+
zIndex?: number;
|
|
24791
|
+
/** Toast width in any valid CSS length format. */
|
|
24792
|
+
width?: string;
|
|
24793
|
+
/** Time in milliseconds before the toast starts to disappear. */
|
|
24794
|
+
duration?: number;
|
|
24795
|
+
/** Preset status icon displayed above the message. */
|
|
24796
|
+
icon?: 'SUCCESS' | 'FAIL';
|
|
24797
|
+
/** Whether the status icon uses a spinning animation. */
|
|
24798
|
+
spin?: boolean;
|
|
24799
|
+
}
|
|
24800
|
+
|
|
24725
24801
|
/**
|
|
24726
24802
|
* @description 交易信息
|
|
24727
24803
|
*/
|