@alipay/ams-checkout 2.0.22 → 2.0.24

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.
@@ -296,6 +296,6 @@ export var LogConfig = {
296
296
  version: 'iteration/20231021',
297
297
  mdata: {
298
298
  firstLogTime: Date.now(),
299
- sdkVersion: "2.0.22"
299
+ sdkVersion: "2.0.24"
300
300
  }
301
301
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "2.0.22",
3
+ "version": "2.0.24",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -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(
@@ -767,6 +772,7 @@ declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Rec
767
772
  /* Excluded from this release type: "OPENSDK@CLOSE_MODAL" */
768
773
  /* Excluded from this release type: "OPENSDK@REDIRECT" */
769
774
  /* Excluded from this release type: "OPENSDK@TRANSFER_MODAL_PORT" */
775
+ /* Excluded from this release type: "OPENSDK@MODAL_TRANSFER_READY" */
770
776
  /* Excluded from this release type: "OPENSDK@TRANSFER_MODAL_APPEARANCE" */
771
777
  /* Excluded from this release type: "OPENSDK@TRANSFER_MODAL_INITIALDATA" */
772
778
  /* Excluded from this release type: "OPENSDK@TRANSFER_APP_PORT" */
@@ -920,6 +926,7 @@ declare abstract class BaseFactory {
920
926
  /* Excluded from this release type: globalBridgeForModal */
921
927
  /* Excluded from this release type: openModalHandle */
922
928
  /* Excluded from this release type: elementClasses */
929
+ /* Excluded from this release type: modalIsReady */
923
930
  /**
924
931
  * @param config 配置
925
932
  */
@@ -3165,10 +3172,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3165
3172
  */
3166
3173
  paymentMethods?: string[];
3167
3174
  /* Excluded from this release type: setupError */
3168
- /**
3169
- * Locale for internationalization, passed from entry params (loadAntom), default to en_US
3170
- */
3171
- locale?: string;
3175
+ /* Excluded from this release type: locale */
3176
+ /* Excluded from this release type: _paypalSdkEnvironment */
3172
3177
  /**
3173
3178
  * 是否运行在 Native App 的 WebView 中。
3174
3179
  * 为 true 时,跳转通过 onRedirect 事件委托给 Native 端处理。
@@ -3256,9 +3261,7 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3256
3261
  private _paypalOverlay;
3257
3262
  constructor(name: string, config: ExpressElementConfig);
3258
3263
  /**
3259
- * 重写 on
3260
- * 1. 对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
3261
- * 2. 对 onRedirect 事件同步注册到 _localHandlers(SDK host 主动推送时商户能收到)
3264
+ * 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
3262
3265
  */
3263
3266
  on(event: string, handler: (...args: any[]) => void): void;
3264
3267
  /**
@@ -3279,6 +3282,8 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3279
3282
  code: string;
3280
3283
  message: string;
3281
3284
  };
3285
+ /** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
3286
+ userCanceled3D?: boolean;
3282
3287
  }>;
3283
3288
  setup(): Promise<Partial<ExpressAppConfig> | undefined>;
3284
3289
  private registerInternalListeners;
@@ -3377,6 +3382,14 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
3377
3382
  };
3378
3383
  }
3379
3384
 
3385
+ declare type ExpressPaymentMethod = (typeof SUPPORTED_EXPRESS_METHODS)[number];
3386
+
3387
+ declare type ExpressSetupError = ErrorPayload & {
3388
+ expressPaymentType?: ExpressPaymentMethod;
3389
+ /** 服务端返回的 errorMessage 已完成国际化,可直接对客展示 */
3390
+ mulityLanguageMapping?: boolean;
3391
+ };
3392
+
3380
3393
  declare interface ExpSupportBank {
3381
3394
  /**
3382
3395
  * @description 银行名称
@@ -6676,11 +6689,14 @@ declare interface OneAccountQueryResult {
6676
6689
  */
6677
6690
  declare type OpenModalHandle = {
6678
6691
  destroy: () => void;
6679
- onLoadedSuccess: (onLoadSuccess: () => void) => void;
6692
+ /**
6693
+ * @deprecated 移除,内部监听ready事件
6694
+ */
6695
+ onLoadedSuccess?: (onLoadSuccess: () => void) => void;
6680
6696
  getContentWindow: () => Window | null;
6681
6697
  };
6682
6698
 
6683
- declare interface OpenModalParams extends BaseOpenModalConfig {
6699
+ declare interface OpenModalParams extends Omit<BaseOpenModalConfig, 'hideCloseWhenLoaded'> {
6684
6700
  mode: 'desktop' | 'mobile';
6685
6701
  loadingConfig?: {
6686
6702
  theme?: 'light' | 'dark';
@@ -6904,6 +6920,15 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
6904
6920
  /* Excluded from this release type: _requestConfig */
6905
6921
  /* Excluded from this release type: logMetaData */
6906
6922
  /* Excluded from this release type: heightOfVisible */
6923
+ /**
6924
+ * Amount & Currency
6925
+ *
6926
+ * Only effective via `updateConfig({ amount })` at runtime.
6927
+ */
6928
+ amount?: {
6929
+ currency: string;
6930
+ value: string;
6931
+ };
6907
6932
  }
6908
6933
 
6909
6934
  /**
@@ -6921,8 +6946,13 @@ export declare type PaymentAppearance = PickAppearance<{
6921
6946
  */
6922
6947
  export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
6923
6948
  static elementType: string;
6949
+ private _paymentInProgress;
6924
6950
  constructor(name: string, config: PaymentElementConfig);
6925
6951
  /* Excluded from this release type: setup */
6952
+ /**
6953
+ * @description Update payment element configuration with amount validation
6954
+ */
6955
+ updateConfig(newConfig: Pick<PaymentAppConfig, 'amount'>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
6926
6956
  /* Excluded from this release type: submit */
6927
6957
  protected focus(): void;
6928
6958
  protected blur(): void;
@@ -23785,6 +23815,10 @@ export declare type SubmitResult = {
23785
23815
  * 查询到的结果消息
23786
23816
  */
23787
23817
  message?: string;
23818
+ /**
23819
+ * @description 接口错误时的链路追踪 id,用于定位排查根因(非错误状态无该字段)
23820
+ */
23821
+ traceId?: string;
23788
23822
  /**
23789
23823
  * @description 是否需要更换 session 重试
23790
23824
  */
@@ -23906,6 +23940,8 @@ declare interface SubscriptionPricePlan {
23906
23940
  pricePlanAmountView?: PaymentView;
23907
23941
  }
23908
23942
 
23943
+ declare const SUPPORTED_EXPRESS_METHODS: readonly ["paypal", "applePay", "googlePay", "alipay"];
23944
+
23909
23945
  declare type SvgAttributes =
23910
23946
  | "[-khtml-opacity]"
23911
23947
  | "[-moz-opacity]"
@@ -306,7 +306,6 @@ export declare class AntomSDK extends BaseElementsFactory {
306
306
  */
307
307
  protected openModal(payload: AntomOpenModalConfig): Promise<{
308
308
  destroy: () => void;
309
- onLoadedSuccess: (onLoadSuccess: () => void) => void;
310
309
  getContentWindow: () => Window;
311
310
  }>;
312
311
  elements(): Elements;
@@ -722,6 +721,8 @@ declare type AxiosHeaderMatcher =
722
721
  | RegExp
723
722
  | ((this: AxiosHeaders, value: string, name: string) => boolean);
724
723
 
724
+ declare type AxiosHeaderParameters = Record<string, string>;
725
+
725
726
  declare type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
726
727
 
727
728
  declare class AxiosHeaders {
@@ -737,6 +738,7 @@ declare class AxiosHeaders {
737
738
  set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
738
739
  set(headers?: Iterable<[string, AxiosHeaderValue]>, rewrite?: boolean): AxiosHeaders;
739
740
 
741
+ get(headerName: string, parser: typeof AxiosHeaders.parseParameters): AxiosHeaderParameters;
740
742
  get(headerName: string, parser: RegExp): RegExpExecArray | null;
741
743
  get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
742
744
 
@@ -758,6 +760,8 @@ declare class AxiosHeaders {
758
760
 
759
761
  static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
760
762
 
763
+ static parseParameters(value: AxiosHeaderValue): AxiosHeaderParameters;
764
+
761
765
  static accessor(header: string | string[]): AxiosHeaders;
762
766
 
763
767
  static concat(
@@ -898,6 +902,10 @@ declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Rec
898
902
  * @internal 内部事件 不暴露给商户
899
903
  */
900
904
  "OPENSDK@TRANSFER_MODAL_PORT": string;
905
+ /**
906
+ * @internal 内部事件 不暴露给商户
907
+ */
908
+ "OPENSDK@MODAL_TRANSFER_READY": void;
901
909
  /**
902
910
  * @internal 内部事件 不暴露给商户
903
911
  */
@@ -1228,6 +1236,11 @@ declare abstract class BaseFactory {
1228
1236
  * @internal
1229
1237
  */
1230
1238
  protected elementClasses: Record<string, iBaseElementClass | undefined>;
1239
+ /**
1240
+ * @description modal是否已准备好
1241
+ * @internal
1242
+ */
1243
+ private modalIsReady;
1231
1244
  /**
1232
1245
  * @param config 配置
1233
1246
  */
@@ -3580,11 +3593,13 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3580
3593
  /**
3581
3594
  * @internal setup 阶段的错误信息,传给 iframe 侧处理
3582
3595
  */
3583
- setupError?: ErrorPayload;
3596
+ setupError?: ExpressSetupError;
3584
3597
  /**
3585
- * Locale for internationalization, passed from entry params (loadAntom), default to en_US
3598
+ * @internal Locale is injected from loadAntom and defaults to en_US.
3586
3599
  */
3587
3600
  locale?: string;
3601
+ /** @internal PayPal v6 core script environment injected from the element env. */
3602
+ _paypalSdkEnvironment?: 'sandbox' | 'prod';
3588
3603
  /**
3589
3604
  * 是否运行在 Native App 的 WebView 中。
3590
3605
  * 为 true 时,跳转通过 onRedirect 事件委托给 Native 端处理。
@@ -3674,9 +3689,7 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3674
3689
  private _paypalOverlay;
3675
3690
  constructor(name: string, config: ExpressElementConfig);
3676
3691
  /**
3677
- * 重写 on
3678
- * 1. 对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
3679
- * 2. 对 onRedirect 事件同步注册到 _localHandlers(SDK host 主动推送时商户能收到)
3692
+ * 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
3680
3693
  */
3681
3694
  on(event: string, handler: (...args: any[]) => void): void;
3682
3695
  /**
@@ -3697,6 +3710,8 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
3697
3710
  code: string;
3698
3711
  message: string;
3699
3712
  };
3713
+ /** 用户是否手动关闭 3D 弹窗(透传 webapp COMPLETE_PAYMENT_RESULT.userCanceled3D) */
3714
+ userCanceled3D?: boolean;
3700
3715
  }>;
3701
3716
  setup(): Promise<Partial<ExpressAppConfig> | undefined>;
3702
3717
  private registerInternalListeners;
@@ -3795,6 +3810,14 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
3795
3810
  };
3796
3811
  }
3797
3812
 
3813
+ declare type ExpressPaymentMethod = (typeof SUPPORTED_EXPRESS_METHODS)[number];
3814
+
3815
+ declare type ExpressSetupError = ErrorPayload & {
3816
+ expressPaymentType?: ExpressPaymentMethod;
3817
+ /** 服务端返回的 errorMessage 已完成国际化,可直接对客展示 */
3818
+ mulityLanguageMapping?: boolean;
3819
+ };
3820
+
3798
3821
  declare interface ExpSupportBank {
3799
3822
  /**
3800
3823
  * @description 银行名称
@@ -7094,11 +7117,14 @@ declare interface OneAccountQueryResult {
7094
7117
  */
7095
7118
  declare type OpenModalHandle = {
7096
7119
  destroy: () => void;
7097
- onLoadedSuccess: (onLoadSuccess: () => void) => void;
7120
+ /**
7121
+ * @deprecated 移除,内部监听ready事件
7122
+ */
7123
+ onLoadedSuccess?: (onLoadSuccess: () => void) => void;
7098
7124
  getContentWindow: () => Window | null;
7099
7125
  };
7100
7126
 
7101
- declare interface OpenModalParams extends BaseOpenModalConfig {
7127
+ declare interface OpenModalParams extends Omit<BaseOpenModalConfig, 'hideCloseWhenLoaded'> {
7102
7128
  mode: 'desktop' | 'mobile';
7103
7129
  loadingConfig?: {
7104
7130
  theme?: 'light' | 'dark';
@@ -7358,6 +7384,15 @@ export declare interface PaymentAppConfig extends BaseAppearance<PaymentAppearan
7358
7384
  * @internal 内部使用,无需用户传递,高度信息
7359
7385
  */
7360
7386
  heightOfVisible?: number;
7387
+ /**
7388
+ * Amount & Currency
7389
+ *
7390
+ * Only effective via `updateConfig({ amount })` at runtime.
7391
+ */
7392
+ amount?: {
7393
+ currency: string;
7394
+ value: string;
7395
+ };
7361
7396
  }
7362
7397
 
7363
7398
  /**
@@ -7375,11 +7410,16 @@ export declare type PaymentAppearance = PickAppearance<{
7375
7410
  */
7376
7411
  export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
7377
7412
  static elementType: string;
7413
+ private _paymentInProgress;
7378
7414
  constructor(name: string, config: PaymentElementConfig);
7379
7415
  /**
7380
7416
  * @internal
7381
7417
  */
7382
7418
  setup(): Promise<Partial<PaymentAppConfig> | undefined>;
7419
+ /**
7420
+ * @description Update payment element configuration with amount validation
7421
+ */
7422
+ updateConfig(newConfig: Pick<PaymentAppConfig, 'amount'>): Promise<PaymentElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
7383
7423
  /**
7384
7424
  * @internal
7385
7425
  */
@@ -24255,6 +24295,10 @@ export declare type SubmitResult = {
24255
24295
  * 查询到的结果消息
24256
24296
  */
24257
24297
  message?: string;
24298
+ /**
24299
+ * @description 接口错误时的链路追踪 id,用于定位排查根因(非错误状态无该字段)
24300
+ */
24301
+ traceId?: string;
24258
24302
  /**
24259
24303
  * @description 是否需要更换 session 重试
24260
24304
  */
@@ -24376,6 +24420,8 @@ declare interface SubscriptionPricePlan {
24376
24420
  pricePlanAmountView?: PaymentView;
24377
24421
  }
24378
24422
 
24423
+ declare const SUPPORTED_EXPRESS_METHODS: readonly ["paypal", "applePay", "googlePay", "alipay"];
24424
+
24379
24425
  declare type SvgAttributes =
24380
24426
  | "[-khtml-opacity]"
24381
24427
  | "[-moz-opacity]"