@alipay/ams-checkout 2.0.12 → 2.0.14
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/esm/component/popupWindow.style.js +2 -2
- package/esm/core/component/element/EventCenter/index.d.ts +10 -0
- package/esm/core/component/element/EventCenter/index.js +40 -4
- package/esm/core/component/element/elementController/index.d.ts +2 -0
- package/esm/core/component/element/elementController/index.js +29 -2
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +5 -0
- package/esm/foundation/service/container/popup.js +4 -1
- package/esm/modern/index.js +1 -1
- package/esm/plugin/paypal/index.js +2 -2
- package/esm/tsdoc-metadata.json +1 -1
- package/package.json +3 -3
- package/types.d.ts +127 -125
- package/types.untrimmed.d.ts +160 -125
package/types.untrimmed.d.ts
CHANGED
|
@@ -395,19 +395,6 @@ declare interface ApplePayProps {
|
|
|
395
395
|
paymentRequest?: ApplePaymentModel;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
/**
|
|
399
|
-
* @public
|
|
400
|
-
* @description onApprove callback parameter
|
|
401
|
-
*/
|
|
402
|
-
export declare interface ApproveData {
|
|
403
|
-
/** Payment method identifier */
|
|
404
|
-
paymentMethod: string;
|
|
405
|
-
/** Raw data returned by payment method */
|
|
406
|
-
data?: Record<string, any>;
|
|
407
|
-
/** Shipping address (if collectShippingAddress is true) */
|
|
408
|
-
shippingAddress?: Record<string, any>;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
398
|
/**
|
|
412
399
|
* @description googlePay risk check
|
|
413
400
|
*/
|
|
@@ -622,11 +609,7 @@ declare type AxiosHeaderMatcher =
|
|
|
622
609
|
| RegExp
|
|
623
610
|
| ((this: AxiosHeaders, value: string, name: string) => boolean);
|
|
624
611
|
|
|
625
|
-
declare type AxiosHeaderParser = (
|
|
626
|
-
this: AxiosHeaders,
|
|
627
|
-
value: AxiosHeaderValue,
|
|
628
|
-
header: string,
|
|
629
|
-
) => any;
|
|
612
|
+
declare type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
|
|
630
613
|
|
|
631
614
|
declare class AxiosHeaders {
|
|
632
615
|
constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
|
|
@@ -636,12 +619,9 @@ declare class AxiosHeaders {
|
|
|
636
619
|
set(
|
|
637
620
|
headerName?: string,
|
|
638
621
|
value?: AxiosHeaderValue,
|
|
639
|
-
rewrite?: boolean | AxiosHeaderMatcher
|
|
640
|
-
): AxiosHeaders;
|
|
641
|
-
set(
|
|
642
|
-
headers?: RawAxiosHeaders | AxiosHeaders | string,
|
|
643
|
-
rewrite?: boolean,
|
|
622
|
+
rewrite?: boolean | AxiosHeaderMatcher
|
|
644
623
|
): AxiosHeaders;
|
|
624
|
+
set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
|
|
645
625
|
|
|
646
626
|
get(headerName: string, parser: RegExp): RegExpExecArray | null;
|
|
647
627
|
get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
|
|
@@ -655,9 +635,7 @@ declare class AxiosHeaders {
|
|
|
655
635
|
normalize(format: boolean): AxiosHeaders;
|
|
656
636
|
|
|
657
637
|
concat(
|
|
658
|
-
...targets: Array<
|
|
659
|
-
AxiosHeaders | RawAxiosHeaders | string | undefined | null
|
|
660
|
-
>
|
|
638
|
+
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
|
|
661
639
|
): AxiosHeaders;
|
|
662
640
|
|
|
663
641
|
toJSON(asStrings?: boolean): RawAxiosHeaders;
|
|
@@ -667,55 +645,35 @@ declare class AxiosHeaders {
|
|
|
667
645
|
static accessor(header: string | string[]): AxiosHeaders;
|
|
668
646
|
|
|
669
647
|
static concat(
|
|
670
|
-
...targets: Array<
|
|
671
|
-
AxiosHeaders | RawAxiosHeaders | string | undefined | null
|
|
672
|
-
>
|
|
648
|
+
...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
|
|
673
649
|
): AxiosHeaders;
|
|
674
650
|
|
|
675
|
-
setContentType(
|
|
676
|
-
value: ContentType,
|
|
677
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
678
|
-
): AxiosHeaders;
|
|
651
|
+
setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
679
652
|
getContentType(parser?: RegExp): RegExpExecArray | null;
|
|
680
653
|
getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
681
654
|
hasContentType(matcher?: AxiosHeaderMatcher): boolean;
|
|
682
655
|
|
|
683
|
-
setContentLength(
|
|
684
|
-
value: AxiosHeaderValue,
|
|
685
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
686
|
-
): AxiosHeaders;
|
|
656
|
+
setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
687
657
|
getContentLength(parser?: RegExp): RegExpExecArray | null;
|
|
688
658
|
getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
689
659
|
hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
|
|
690
660
|
|
|
691
|
-
setAccept(
|
|
692
|
-
value: AxiosHeaderValue,
|
|
693
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
694
|
-
): AxiosHeaders;
|
|
661
|
+
setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
695
662
|
getAccept(parser?: RegExp): RegExpExecArray | null;
|
|
696
663
|
getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
697
664
|
hasAccept(matcher?: AxiosHeaderMatcher): boolean;
|
|
698
665
|
|
|
699
|
-
setUserAgent(
|
|
700
|
-
value: AxiosHeaderValue,
|
|
701
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
702
|
-
): AxiosHeaders;
|
|
666
|
+
setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
703
667
|
getUserAgent(parser?: RegExp): RegExpExecArray | null;
|
|
704
668
|
getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
705
669
|
hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
|
|
706
670
|
|
|
707
|
-
setContentEncoding(
|
|
708
|
-
value: AxiosHeaderValue,
|
|
709
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
710
|
-
): AxiosHeaders;
|
|
671
|
+
setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
711
672
|
getContentEncoding(parser?: RegExp): RegExpExecArray | null;
|
|
712
673
|
getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
713
674
|
hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
|
|
714
675
|
|
|
715
|
-
setAuthorization(
|
|
716
|
-
value: AxiosHeaderValue,
|
|
717
|
-
rewrite?: boolean | AxiosHeaderMatcher,
|
|
718
|
-
): AxiosHeaders;
|
|
676
|
+
setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
|
|
719
677
|
getAuthorization(parser?: RegExp): RegExpExecArray | null;
|
|
720
678
|
getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
|
|
721
679
|
hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
|
|
@@ -725,13 +683,7 @@ declare class AxiosHeaders {
|
|
|
725
683
|
[Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
|
|
726
684
|
}
|
|
727
685
|
|
|
728
|
-
declare type AxiosHeaderValue =
|
|
729
|
-
| AxiosHeaders
|
|
730
|
-
| string
|
|
731
|
-
| string[]
|
|
732
|
-
| number
|
|
733
|
-
| boolean
|
|
734
|
-
| null;
|
|
686
|
+
declare type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
|
|
735
687
|
|
|
736
688
|
declare interface BankInfo {
|
|
737
689
|
/**
|
|
@@ -773,6 +725,10 @@ declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Rec
|
|
|
773
725
|
* @internal 内部事件 不暴露给商户
|
|
774
726
|
*/
|
|
775
727
|
"OPENSDK@HANDSHAKE": AppConfig;
|
|
728
|
+
/**
|
|
729
|
+
* @internal 内部事件 不暴露给商户
|
|
730
|
+
*/
|
|
731
|
+
"OPENSDK@READY_HANDSHAKE": void;
|
|
776
732
|
/**
|
|
777
733
|
* @internal 内部事件 不暴露给商户
|
|
778
734
|
*/
|
|
@@ -1812,6 +1768,28 @@ declare interface ChargeInfo {
|
|
|
1812
1768
|
chargeActualAmountView?: PaymentView;
|
|
1813
1769
|
}
|
|
1814
1770
|
|
|
1771
|
+
/** click 事件 resolve 参数 */
|
|
1772
|
+
export declare interface ClickResolveOptions {
|
|
1773
|
+
amount?: {
|
|
1774
|
+
currency: string;
|
|
1775
|
+
value: string;
|
|
1776
|
+
};
|
|
1777
|
+
shippingAddressRequired?: boolean;
|
|
1778
|
+
allowedShippingCountries?: string[];
|
|
1779
|
+
shippingRates?: Array<{
|
|
1780
|
+
id: string;
|
|
1781
|
+
displayName: string;
|
|
1782
|
+
amount: string;
|
|
1783
|
+
}>;
|
|
1784
|
+
lineItems?: Array<{
|
|
1785
|
+
name: string;
|
|
1786
|
+
amount: string;
|
|
1787
|
+
}>;
|
|
1788
|
+
business?: {
|
|
1789
|
+
name: string;
|
|
1790
|
+
};
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1815
1793
|
declare interface CodeFormView {
|
|
1816
1794
|
/**
|
|
1817
1795
|
* @description title
|
|
@@ -2424,12 +2402,12 @@ declare interface ConnectFactor {
|
|
|
2424
2402
|
|
|
2425
2403
|
declare type ContentType =
|
|
2426
2404
|
| AxiosHeaderValue
|
|
2427
|
-
|
|
|
2428
|
-
|
|
|
2429
|
-
|
|
|
2430
|
-
|
|
|
2431
|
-
|
|
|
2432
|
-
|
|
|
2405
|
+
| 'text/html'
|
|
2406
|
+
| 'text/plain'
|
|
2407
|
+
| 'multipart/form-data'
|
|
2408
|
+
| 'application/json'
|
|
2409
|
+
| 'application/x-www-form-urlencoded'
|
|
2410
|
+
| 'application/octet-stream';
|
|
2433
2411
|
|
|
2434
2412
|
declare namespace CSS_2 {
|
|
2435
2413
|
export {
|
|
@@ -3510,8 +3488,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3510
3488
|
currency: string;
|
|
3511
3489
|
value: string;
|
|
3512
3490
|
};
|
|
3513
|
-
/** PayPal
|
|
3514
|
-
|
|
3491
|
+
/** PayPal 配置 */
|
|
3492
|
+
paypal?: PayPalConfig;
|
|
3515
3493
|
/**
|
|
3516
3494
|
* Button text type (following Stripe Express Checkout Element design)
|
|
3517
3495
|
* Each payment method can independently set the button display text
|
|
@@ -3540,21 +3518,37 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
|
|
|
3540
3518
|
* @example ['paypal']
|
|
3541
3519
|
*/
|
|
3542
3520
|
paymentMethods?: string[];
|
|
3543
|
-
/**
|
|
3544
|
-
|
|
3521
|
+
/**
|
|
3522
|
+
* @internal setup 阶段的错误信息,传给 iframe 侧处理
|
|
3523
|
+
*/
|
|
3524
|
+
setupError?: ErrorPayload;
|
|
3525
|
+
/**
|
|
3526
|
+
* Locale for internationalization, passed from entry params (loadAntom), default to en_US
|
|
3527
|
+
*/
|
|
3528
|
+
locale?: string;
|
|
3545
3529
|
}
|
|
3546
3530
|
|
|
3547
|
-
/**
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
*/
|
|
3551
|
-
export declare interface ExpressCancelInfo {
|
|
3552
|
-
/** Payment method identifier */
|
|
3553
|
-
paymentMethod: string;
|
|
3554
|
-
/** Raw data returned by payment method (PayPal SDK return content, fully passed through) */
|
|
3531
|
+
/** cancel 事件负载 */
|
|
3532
|
+
export declare interface ExpressCancelEvent {
|
|
3533
|
+
expressPaymentType: string;
|
|
3555
3534
|
data?: any;
|
|
3556
3535
|
}
|
|
3557
3536
|
|
|
3537
|
+
/** click 事件负载 */
|
|
3538
|
+
export declare interface ExpressClickEvent {
|
|
3539
|
+
expressPaymentType: string;
|
|
3540
|
+
resolve: (options: ClickResolveOptions) => void;
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
/** confirm 事件负载(统一终态,替代 approve) */
|
|
3544
|
+
export declare interface ExpressConfirmData {
|
|
3545
|
+
expressPaymentType: string;
|
|
3546
|
+
paymentData: any;
|
|
3547
|
+
billingDetails?: any;
|
|
3548
|
+
shippingAddress?: any;
|
|
3549
|
+
sessionData?: string;
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3558
3552
|
/**
|
|
3559
3553
|
* @public
|
|
3560
3554
|
* @description Express element - express checkout element, supports PayPal / Apple Pay / Google Pay
|
|
@@ -3593,62 +3587,82 @@ export declare interface ExpressElementConfig extends BaseElementConfig<ExpressA
|
|
|
3593
3587
|
*/
|
|
3594
3588
|
export declare interface ExpressElementEvents extends AntomBridgeEventMap<ExpressAppConfig> {
|
|
3595
3589
|
/**
|
|
3596
|
-
* @description Element ready event
|
|
3590
|
+
* @description Element ready event — 上报可用支付方式
|
|
3597
3591
|
*/
|
|
3598
|
-
ready:
|
|
3592
|
+
ready: {
|
|
3593
|
+
availablePaymentMethods: Record<string, boolean>;
|
|
3594
|
+
};
|
|
3599
3595
|
/**
|
|
3600
|
-
* @description
|
|
3596
|
+
* @description 用户点击按钮 — 商户必须调用 event.resolve() 后 sheet 才弹出
|
|
3597
|
+
* 对 PayPal: resolve 为 no-op(PayPal 自行弹出 popup)
|
|
3601
3598
|
*/
|
|
3602
|
-
|
|
3599
|
+
click: ExpressClickEvent;
|
|
3603
3600
|
/**
|
|
3604
|
-
* @description
|
|
3601
|
+
* @description 统一支付完成事件(替代 approve)
|
|
3602
|
+
* 用户授权完成后触发,通过 expressPaymentType 区分钱包类型
|
|
3605
3603
|
*/
|
|
3606
|
-
|
|
3604
|
+
confirm: ExpressConfirmData;
|
|
3607
3605
|
/**
|
|
3608
|
-
* @description
|
|
3606
|
+
* @description 支付错误事件(扩展基类 ErrorPayload,新增 expressPaymentType)
|
|
3609
3607
|
*/
|
|
3610
|
-
|
|
3608
|
+
error: ErrorPayload & {
|
|
3609
|
+
expressPaymentType: string;
|
|
3610
|
+
};
|
|
3611
3611
|
/**
|
|
3612
|
-
* @description
|
|
3612
|
+
* @description 用户取消支付
|
|
3613
3613
|
*/
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
/**
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3614
|
+
cancel: ExpressCancelEvent;
|
|
3615
|
+
/**
|
|
3616
|
+
* @description 用户在 sheet 内变更收货地址(AP/GP only,PayPal 不触发)
|
|
3617
|
+
*/
|
|
3618
|
+
shippingaddresschange: {
|
|
3619
|
+
expressPaymentType: string;
|
|
3620
|
+
address: any;
|
|
3621
|
+
resolve: (options: ShippingResolveOptions) => void;
|
|
3622
|
+
reject: (reason: string) => void;
|
|
3623
|
+
};
|
|
3624
|
+
/**
|
|
3625
|
+
* @description 用户在 sheet 内变更配送方式(AP/GP only,PayPal 不触发)
|
|
3626
|
+
*/
|
|
3627
|
+
shippingratechange: {
|
|
3628
|
+
expressPaymentType: string;
|
|
3629
|
+
shippingRate: any;
|
|
3630
|
+
resolve: (options: RateResolveOptions) => void;
|
|
3631
|
+
};
|
|
3632
|
+
/** @internal iframe 内容高度变化 */
|
|
3633
|
+
contentHeightChanged: {
|
|
3634
|
+
height: number;
|
|
3635
|
+
};
|
|
3636
|
+
/** @internal PayPal 请求商户创建订单 */
|
|
3637
|
+
'paypal:createOrder': {
|
|
3638
|
+
requestId: string;
|
|
3639
|
+
};
|
|
3640
|
+
/** @internal PayPal createOrder 响应 */
|
|
3641
|
+
'paypal:createOrder:reply': {
|
|
3642
|
+
requestId: string;
|
|
3643
|
+
sessionData?: string;
|
|
3644
|
+
error?: string;
|
|
3645
|
+
};
|
|
3646
|
+
/** @internal PayPal 用户变更收货地址 */
|
|
3647
|
+
'paypal:onShippingAddressChange': {
|
|
3648
|
+
requestId: string;
|
|
3649
|
+
shippingData: any;
|
|
3650
|
+
};
|
|
3651
|
+
/** @internal PayPal 收货地址变更响应 */
|
|
3652
|
+
'paypal:onShippingAddressChange:reply': {
|
|
3653
|
+
requestId: string;
|
|
3654
|
+
error?: string;
|
|
3655
|
+
};
|
|
3656
|
+
/** @internal PayPal 用户变更配送方式 */
|
|
3657
|
+
'paypal:onShippingOptionsChange': {
|
|
3658
|
+
requestId: string;
|
|
3659
|
+
shippingData: any;
|
|
3660
|
+
};
|
|
3661
|
+
/** @internal PayPal 配送方式变更响应 */
|
|
3662
|
+
'paypal:onShippingOptionsChange:reply': {
|
|
3663
|
+
requestId: string;
|
|
3664
|
+
error?: string;
|
|
3665
|
+
};
|
|
3652
3666
|
}
|
|
3653
3667
|
|
|
3654
3668
|
declare interface ExpSupportBank {
|
|
@@ -9895,6 +9909,14 @@ declare interface RateInfo {
|
|
|
9895
9909
|
rate?: Rate;
|
|
9896
9910
|
}
|
|
9897
9911
|
|
|
9912
|
+
/** shippingratechange 事件 resolve 参数 */
|
|
9913
|
+
export declare interface RateResolveOptions {
|
|
9914
|
+
lineItems?: Array<{
|
|
9915
|
+
name: string;
|
|
9916
|
+
amount: string;
|
|
9917
|
+
}>;
|
|
9918
|
+
}
|
|
9919
|
+
|
|
9898
9920
|
declare interface RawAxiosHeaders {
|
|
9899
9921
|
[key: string]: AxiosHeaderValue;
|
|
9900
9922
|
}
|
|
@@ -10213,6 +10235,19 @@ declare interface ShippingInfo {
|
|
|
10213
10235
|
deliveryEstimate?: DeliveryEstimate;
|
|
10214
10236
|
}
|
|
10215
10237
|
|
|
10238
|
+
/** shippingaddresschange 事件 resolve 参数 */
|
|
10239
|
+
export declare interface ShippingResolveOptions {
|
|
10240
|
+
shippingRates?: Array<{
|
|
10241
|
+
id: string;
|
|
10242
|
+
displayName: string;
|
|
10243
|
+
amount: string;
|
|
10244
|
+
}>;
|
|
10245
|
+
lineItems?: Array<{
|
|
10246
|
+
name: string;
|
|
10247
|
+
amount: string;
|
|
10248
|
+
}>;
|
|
10249
|
+
}
|
|
10250
|
+
|
|
10216
10251
|
declare type SimpleI18n = {
|
|
10217
10252
|
get(id: GetI18nQueryParam, variable?: Record<string, any>, localeCode?: string): string;
|
|
10218
10253
|
};
|