@alipay/ams-checkout 2.0.11 → 2.0.13

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.
@@ -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
  /**
@@ -1812,6 +1764,28 @@ declare interface ChargeInfo {
1812
1764
  chargeActualAmountView?: PaymentView;
1813
1765
  }
1814
1766
 
1767
+ /** click 事件 resolve 参数 */
1768
+ export declare interface ClickResolveOptions {
1769
+ amount?: {
1770
+ currency: string;
1771
+ value: string;
1772
+ };
1773
+ shippingAddressRequired?: boolean;
1774
+ allowedShippingCountries?: string[];
1775
+ shippingRates?: Array<{
1776
+ id: string;
1777
+ displayName: string;
1778
+ amount: string;
1779
+ }>;
1780
+ lineItems?: Array<{
1781
+ name: string;
1782
+ amount: string;
1783
+ }>;
1784
+ business?: {
1785
+ name: string;
1786
+ };
1787
+ }
1788
+
1815
1789
  declare interface CodeFormView {
1816
1790
  /**
1817
1791
  * @description title
@@ -2424,12 +2398,12 @@ declare interface ConnectFactor {
2424
2398
 
2425
2399
  declare type ContentType =
2426
2400
  | AxiosHeaderValue
2427
- | "text/html"
2428
- | "text/plain"
2429
- | "multipart/form-data"
2430
- | "application/json"
2431
- | "application/x-www-form-urlencoded"
2432
- | "application/octet-stream";
2401
+ | 'text/html'
2402
+ | 'text/plain'
2403
+ | 'multipart/form-data'
2404
+ | 'application/json'
2405
+ | 'application/x-www-form-urlencoded'
2406
+ | 'application/octet-stream';
2433
2407
 
2434
2408
  declare namespace CSS_2 {
2435
2409
  export {
@@ -3510,8 +3484,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3510
3484
  currency: string;
3511
3485
  value: string;
3512
3486
  };
3513
- /** PayPal payment configuration */
3514
- paypalConfig?: PayPalConfig;
3487
+ /** PayPal 配置 */
3488
+ paypal?: PayPalConfig;
3515
3489
  /**
3516
3490
  * Button text type (following Stripe Express Checkout Element design)
3517
3491
  * Each payment method can independently set the button display text
@@ -3540,21 +3514,37 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3540
3514
  * @example ['paypal']
3541
3515
  */
3542
3516
  paymentMethods?: string[];
3543
- /** Lifecycle callbacks */
3544
- hooks?: ExpressHooks;
3517
+ /**
3518
+ * @internal setup 阶段的错误信息,传给 iframe 侧处理
3519
+ */
3520
+ setupError?: ErrorPayload;
3521
+ /**
3522
+ * Locale for internationalization, passed from entry params (loadAntom), default to en_US
3523
+ */
3524
+ locale?: string;
3545
3525
  }
3546
3526
 
3547
- /**
3548
- * @public
3549
- * @description onCancel callback parameter
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) */
3527
+ /** cancel 事件负载 */
3528
+ export declare interface ExpressCancelEvent {
3529
+ expressPaymentType: string;
3555
3530
  data?: any;
3556
3531
  }
3557
3532
 
3533
+ /** click 事件负载 */
3534
+ export declare interface ExpressClickEvent {
3535
+ expressPaymentType: string;
3536
+ resolve: (options: ClickResolveOptions) => void;
3537
+ }
3538
+
3539
+ /** confirm 事件负载(统一终态,替代 approve) */
3540
+ export declare interface ExpressConfirmData {
3541
+ expressPaymentType: string;
3542
+ paymentData: any;
3543
+ billingDetails?: any;
3544
+ shippingAddress?: any;
3545
+ sessionData?: string;
3546
+ }
3547
+
3558
3548
  /**
3559
3549
  * @public
3560
3550
  * @description Express element - express checkout element, supports PayPal / Apple Pay / Google Pay
@@ -3593,62 +3583,82 @@ export declare interface ExpressElementConfig extends BaseElementConfig<ExpressA
3593
3583
  */
3594
3584
  export declare interface ExpressElementEvents extends AntomBridgeEventMap<ExpressAppConfig> {
3595
3585
  /**
3596
- * @description Element ready event
3586
+ * @description Element ready event — 上报可用支付方式
3587
+ */
3588
+ ready: {
3589
+ availablePaymentMethods: Record<string, boolean>;
3590
+ };
3591
+ /**
3592
+ * @description 用户点击按钮 — 商户必须调用 event.resolve() 后 sheet 才弹出
3593
+ * 对 PayPal: resolve 为 no-op(PayPal 自行弹出 popup)
3597
3594
  */
3598
- ready: ExpressReadyInfo;
3595
+ click: ExpressClickEvent;
3599
3596
  /**
3600
- * @description Payment authorization success event
3597
+ * @description 统一支付完成事件(替代 approve)
3598
+ * 用户授权完成后触发,通过 expressPaymentType 区分钱包类型
3601
3599
  */
3602
- approve: ApproveData;
3600
+ confirm: ExpressConfirmData;
3603
3601
  /**
3604
- * @description Payment error event
3602
+ * @description 支付错误事件(扩展基类 ErrorPayload,新增 expressPaymentType)
3605
3603
  */
3606
- paymentError: ExpressErrorData;
3604
+ error: ErrorPayload & {
3605
+ expressPaymentType: string;
3606
+ };
3607
3607
  /**
3608
- * @description User cancelled payment event
3608
+ * @description 用户取消支付
3609
3609
  */
3610
- cancel: ExpressCancelInfo;
3610
+ cancel: ExpressCancelEvent;
3611
3611
  /**
3612
- * @description Payment button click event
3612
+ * @description 用户在 sheet 内变更收货地址(AP/GP only,PayPal 不触发)
3613
3613
  */
3614
- click: void;
3615
- }
3616
-
3617
- /**
3618
- * @public
3619
- * @description onError callback parameter
3620
- */
3621
- export declare interface ExpressErrorData {
3622
- /** Payment method identifier */
3623
- paymentMethod: string;
3624
- /** Error code */
3625
- code: string;
3626
- /** Error message */
3627
- message: string;
3628
- }
3629
-
3630
- /**
3631
- * @public
3632
- * @description Express Element lifecycle hooks
3633
- */
3634
- export declare interface ExpressHooks {
3635
- /** Element initialization ready callback */
3636
- onReady?: (info: ExpressReadyInfo) => void;
3637
- /** Payment authorization success callback */
3638
- onApprove?: (data: ApproveData) => void;
3639
- /** Payment error callback */
3640
- onError?: (error: ExpressErrorData) => void;
3641
- /** User cancelled payment callback */
3642
- onCancel?: (info: ExpressCancelInfo) => void;
3643
- }
3644
-
3645
- /**
3646
- * @public
3647
- * @description onReady callback parameter
3648
- */
3649
- export declare interface ExpressReadyInfo {
3650
- /** List of currently available payment methods */
3651
- availablePaymentMethods: string[];
3614
+ shippingaddresschange: {
3615
+ expressPaymentType: string;
3616
+ address: any;
3617
+ resolve: (options: ShippingResolveOptions) => void;
3618
+ reject: (reason: string) => void;
3619
+ };
3620
+ /**
3621
+ * @description 用户在 sheet 内变更配送方式(AP/GP only,PayPal 不触发)
3622
+ */
3623
+ shippingratechange: {
3624
+ expressPaymentType: string;
3625
+ shippingRate: any;
3626
+ resolve: (options: RateResolveOptions) => void;
3627
+ };
3628
+ /** @internal iframe 内容高度变化 */
3629
+ contentHeightChanged: {
3630
+ height: number;
3631
+ };
3632
+ /** @internal PayPal 请求商户创建订单 */
3633
+ 'paypal:createOrder': {
3634
+ requestId: string;
3635
+ };
3636
+ /** @internal PayPal createOrder 响应 */
3637
+ 'paypal:createOrder:reply': {
3638
+ requestId: string;
3639
+ sessionData?: string;
3640
+ error?: string;
3641
+ };
3642
+ /** @internal PayPal 用户变更收货地址 */
3643
+ 'paypal:onShippingAddressChange': {
3644
+ requestId: string;
3645
+ shippingData: any;
3646
+ };
3647
+ /** @internal PayPal 收货地址变更响应 */
3648
+ 'paypal:onShippingAddressChange:reply': {
3649
+ requestId: string;
3650
+ error?: string;
3651
+ };
3652
+ /** @internal PayPal 用户变更配送方式 */
3653
+ 'paypal:onShippingOptionsChange': {
3654
+ requestId: string;
3655
+ shippingData: any;
3656
+ };
3657
+ /** @internal PayPal 配送方式变更响应 */
3658
+ 'paypal:onShippingOptionsChange:reply': {
3659
+ requestId: string;
3660
+ error?: string;
3661
+ };
3652
3662
  }
3653
3663
 
3654
3664
  declare interface ExpSupportBank {
@@ -9895,6 +9905,14 @@ declare interface RateInfo {
9895
9905
  rate?: Rate;
9896
9906
  }
9897
9907
 
9908
+ /** shippingratechange 事件 resolve 参数 */
9909
+ export declare interface RateResolveOptions {
9910
+ lineItems?: Array<{
9911
+ name: string;
9912
+ amount: string;
9913
+ }>;
9914
+ }
9915
+
9898
9916
  declare interface RawAxiosHeaders {
9899
9917
  [key: string]: AxiosHeaderValue;
9900
9918
  }
@@ -10213,6 +10231,19 @@ declare interface ShippingInfo {
10213
10231
  deliveryEstimate?: DeliveryEstimate;
10214
10232
  }
10215
10233
 
10234
+ /** shippingaddresschange 事件 resolve 参数 */
10235
+ export declare interface ShippingResolveOptions {
10236
+ shippingRates?: Array<{
10237
+ id: string;
10238
+ displayName: string;
10239
+ amount: string;
10240
+ }>;
10241
+ lineItems?: Array<{
10242
+ name: string;
10243
+ amount: string;
10244
+ }>;
10245
+ }
10246
+
10216
10247
  declare type SimpleI18n = {
10217
10248
  get(id: GetI18nQueryParam, variable?: Record<string, any>, localeCode?: string): string;
10218
10249
  };