@alipay/ams-checkout 0.0.1776167402-dev.0 → 0.0.1776167402-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1776167402-dev.0",
3
+ "version": "0.0.1776167402-dev.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {
package/types.d.ts CHANGED
@@ -368,19 +368,6 @@ declare interface ApplePayProps {
368
368
  paymentRequest?: ApplePaymentModel;
369
369
  }
370
370
 
371
- /**
372
- * @public
373
- * @description onApprove callback parameter
374
- */
375
- export declare interface ApproveData {
376
- /** Payment method identifier */
377
- paymentMethod: string;
378
- /** Raw data returned by payment method */
379
- data?: Record<string, any>;
380
- /** Shipping address (if collectShippingAddress is true) */
381
- shippingAddress?: Record<string, any>;
382
- }
383
-
384
371
  /**
385
372
  * @description googlePay risk check
386
373
  */
@@ -1545,6 +1532,28 @@ declare interface ChargeInfo {
1545
1532
  chargeActualAmountView?: PaymentView;
1546
1533
  }
1547
1534
 
1535
+ /** click 事件 resolve 参数 */
1536
+ export declare interface ClickResolveOptions {
1537
+ amount?: {
1538
+ currency: string;
1539
+ value: string;
1540
+ };
1541
+ shippingAddressRequired?: boolean;
1542
+ allowedShippingCountries?: string[];
1543
+ shippingRates?: Array<{
1544
+ id: string;
1545
+ displayName: string;
1546
+ amount: string;
1547
+ }>;
1548
+ lineItems?: Array<{
1549
+ name: string;
1550
+ amount: string;
1551
+ }>;
1552
+ business?: {
1553
+ name: string;
1554
+ };
1555
+ }
1556
+
1548
1557
  declare interface CodeFormView {
1549
1558
  /**
1550
1559
  * @description title
@@ -3219,8 +3228,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3219
3228
  currency: string;
3220
3229
  value: string;
3221
3230
  };
3222
- /** PayPal payment configuration */
3223
- paypalConfig?: PayPalConfig;
3231
+ /** PayPal 配置 */
3232
+ paypal?: PayPalConfig;
3224
3233
  /**
3225
3234
  * Button text type (following Stripe Express Checkout Element design)
3226
3235
  * Each payment method can independently set the button display text
@@ -3249,21 +3258,29 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3249
3258
  * @example ['paypal']
3250
3259
  */
3251
3260
  paymentMethods?: string[];
3252
- /** Lifecycle callbacks */
3253
- hooks?: ExpressHooks;
3254
3261
  }
3255
3262
 
3256
- /**
3257
- * @public
3258
- * @description onCancel callback parameter
3259
- */
3260
- export declare interface ExpressCancelInfo {
3261
- /** Payment method identifier */
3262
- paymentMethod: string;
3263
- /** Raw data returned by payment method (PayPal SDK return content, fully passed through) */
3263
+ /** cancel 事件负载 */
3264
+ export declare interface ExpressCancelEvent {
3265
+ expressPaymentType: string;
3264
3266
  data?: any;
3265
3267
  }
3266
3268
 
3269
+ /** click 事件负载 */
3270
+ export declare interface ExpressClickEvent {
3271
+ expressPaymentType: string;
3272
+ resolve: (options: ClickResolveOptions) => void;
3273
+ }
3274
+
3275
+ /** confirm 事件负载(统一终态,替代 approve) */
3276
+ export declare interface ExpressConfirmData {
3277
+ expressPaymentType: string;
3278
+ paymentData: any;
3279
+ billingDetails?: any;
3280
+ shippingAddress?: any;
3281
+ sessionData?: string;
3282
+ }
3283
+
3267
3284
  /**
3268
3285
  * @public
3269
3286
  * @description Express element - express checkout element, supports PayPal / Apple Pay / Google Pay
@@ -3302,62 +3319,55 @@ export declare interface ExpressElementConfig extends BaseElementConfig<ExpressA
3302
3319
  */
3303
3320
  export declare interface ExpressElementEvents extends AntomBridgeEventMap<ExpressAppConfig> {
3304
3321
  /**
3305
- * @description Element ready event
3322
+ * @description Element ready event — 上报可用支付方式
3306
3323
  */
3307
- ready: ExpressReadyInfo;
3324
+ ready: {
3325
+ availablePaymentMethods: Record<string, boolean>;
3326
+ };
3308
3327
  /**
3309
- * @description Payment authorization success event
3328
+ * @description 用户点击按钮 商户必须调用 event.resolve() 后 sheet 才弹出
3329
+ * 对 PayPal: resolve 为 no-op(PayPal 自行弹出 popup)
3310
3330
  */
3311
- approve: ApproveData;
3331
+ click: ExpressClickEvent;
3312
3332
  /**
3313
- * @description Payment error event
3333
+ * @description 统一支付完成事件(替代 approve)
3334
+ * 用户授权完成后触发,通过 expressPaymentType 区分钱包类型
3314
3335
  */
3315
- paymentError: ExpressErrorData;
3336
+ confirm: ExpressConfirmData;
3316
3337
  /**
3317
- * @description User cancelled payment event
3338
+ * @description 支付错误事件(扩展基类 ErrorPayload,新增 expressPaymentType)
3318
3339
  */
3319
- cancel: ExpressCancelInfo;
3340
+ error: ErrorPayload & {
3341
+ expressPaymentType: string;
3342
+ };
3320
3343
  /**
3321
- * @description Payment button click event
3344
+ * @description 用户取消支付
3322
3345
  */
3323
- click: void;
3324
- }
3325
-
3326
- /**
3327
- * @public
3328
- * @description onError callback parameter
3329
- */
3330
- export declare interface ExpressErrorData {
3331
- /** Payment method identifier */
3332
- paymentMethod: string;
3333
- /** Error code */
3334
- code: string;
3335
- /** Error message */
3336
- message: string;
3337
- }
3338
-
3339
- /**
3340
- * @public
3341
- * @description Express Element lifecycle hooks
3342
- */
3343
- export declare interface ExpressHooks {
3344
- /** Element initialization ready callback */
3345
- onReady?: (info: ExpressReadyInfo) => void;
3346
- /** Payment authorization success callback */
3347
- onApprove?: (data: ApproveData) => void;
3348
- /** Payment error callback */
3349
- onError?: (error: ExpressErrorData) => void;
3350
- /** User cancelled payment callback */
3351
- onCancel?: (info: ExpressCancelInfo) => void;
3352
- }
3353
-
3354
- /**
3355
- * @public
3356
- * @description onReady callback parameter
3357
- */
3358
- export declare interface ExpressReadyInfo {
3359
- /** List of currently available payment methods */
3360
- availablePaymentMethods: string[];
3346
+ cancel: ExpressCancelEvent;
3347
+ /**
3348
+ * @description 用户在 sheet 内变更收货地址(AP/GP only,PayPal 不触发)
3349
+ */
3350
+ shippingaddresschange: {
3351
+ expressPaymentType: string;
3352
+ address: any;
3353
+ resolve: (options: ShippingResolveOptions) => void;
3354
+ reject: (reason: string) => void;
3355
+ };
3356
+ /**
3357
+ * @description 用户在 sheet 内变更配送方式(AP/GP only,PayPal 不触发)
3358
+ */
3359
+ shippingratechange: {
3360
+ expressPaymentType: string;
3361
+ shippingRate: any;
3362
+ resolve: (options: RateResolveOptions) => void;
3363
+ };
3364
+ /* Excluded from this release type: contentHeightChanged */
3365
+ /* Excluded from this release type: "paypal:createOrder" */
3366
+ /* Excluded from this release type: "paypal:createOrder:reply" */
3367
+ /* Excluded from this release type: "paypal:onShippingAddressChange" */
3368
+ /* Excluded from this release type: "paypal:onShippingAddressChange:reply" */
3369
+ /* Excluded from this release type: "paypal:onShippingOptionsChange" */
3370
+ /* Excluded from this release type: "paypal:onShippingOptionsChange:reply" */
3361
3371
  }
3362
3372
 
3363
3373
  declare interface ExpSupportBank {
@@ -9601,6 +9611,14 @@ declare interface RateInfo {
9601
9611
  rate?: Rate;
9602
9612
  }
9603
9613
 
9614
+ /** shippingratechange 事件 resolve 参数 */
9615
+ export declare interface RateResolveOptions {
9616
+ lineItems?: Array<{
9617
+ name: string;
9618
+ amount: string;
9619
+ }>;
9620
+ }
9621
+
9604
9622
  declare interface RawAxiosHeaders {
9605
9623
  [key: string]: AxiosHeaderValue;
9606
9624
  }
@@ -9919,6 +9937,19 @@ declare interface ShippingInfo {
9919
9937
  deliveryEstimate?: DeliveryEstimate;
9920
9938
  }
9921
9939
 
9940
+ /** shippingaddresschange 事件 resolve 参数 */
9941
+ export declare interface ShippingResolveOptions {
9942
+ shippingRates?: Array<{
9943
+ id: string;
9944
+ displayName: string;
9945
+ amount: string;
9946
+ }>;
9947
+ lineItems?: Array<{
9948
+ name: string;
9949
+ amount: string;
9950
+ }>;
9951
+ }
9952
+
9922
9953
  declare type SimpleI18n = {
9923
9954
  get(id: GetI18nQueryParam, variable?: Record<string, any>, localeCode?: string): string;
9924
9955
  };
@@ -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
  */
@@ -1812,6 +1799,28 @@ declare interface ChargeInfo {
1812
1799
  chargeActualAmountView?: PaymentView;
1813
1800
  }
1814
1801
 
1802
+ /** click 事件 resolve 参数 */
1803
+ export declare interface ClickResolveOptions {
1804
+ amount?: {
1805
+ currency: string;
1806
+ value: string;
1807
+ };
1808
+ shippingAddressRequired?: boolean;
1809
+ allowedShippingCountries?: string[];
1810
+ shippingRates?: Array<{
1811
+ id: string;
1812
+ displayName: string;
1813
+ amount: string;
1814
+ }>;
1815
+ lineItems?: Array<{
1816
+ name: string;
1817
+ amount: string;
1818
+ }>;
1819
+ business?: {
1820
+ name: string;
1821
+ };
1822
+ }
1823
+
1815
1824
  declare interface CodeFormView {
1816
1825
  /**
1817
1826
  * @description title
@@ -3510,8 +3519,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3510
3519
  currency: string;
3511
3520
  value: string;
3512
3521
  };
3513
- /** PayPal payment configuration */
3514
- paypalConfig?: PayPalConfig;
3522
+ /** PayPal 配置 */
3523
+ paypal?: PayPalConfig;
3515
3524
  /**
3516
3525
  * Button text type (following Stripe Express Checkout Element design)
3517
3526
  * Each payment method can independently set the button display text
@@ -3540,21 +3549,29 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3540
3549
  * @example ['paypal']
3541
3550
  */
3542
3551
  paymentMethods?: string[];
3543
- /** Lifecycle callbacks */
3544
- hooks?: ExpressHooks;
3545
3552
  }
3546
3553
 
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) */
3554
+ /** cancel 事件负载 */
3555
+ export declare interface ExpressCancelEvent {
3556
+ expressPaymentType: string;
3555
3557
  data?: any;
3556
3558
  }
3557
3559
 
3560
+ /** click 事件负载 */
3561
+ export declare interface ExpressClickEvent {
3562
+ expressPaymentType: string;
3563
+ resolve: (options: ClickResolveOptions) => void;
3564
+ }
3565
+
3566
+ /** confirm 事件负载(统一终态,替代 approve) */
3567
+ export declare interface ExpressConfirmData {
3568
+ expressPaymentType: string;
3569
+ paymentData: any;
3570
+ billingDetails?: any;
3571
+ shippingAddress?: any;
3572
+ sessionData?: string;
3573
+ }
3574
+
3558
3575
  /**
3559
3576
  * @public
3560
3577
  * @description Express element - express checkout element, supports PayPal / Apple Pay / Google Pay
@@ -3593,62 +3610,82 @@ export declare interface ExpressElementConfig extends BaseElementConfig<ExpressA
3593
3610
  */
3594
3611
  export declare interface ExpressElementEvents extends AntomBridgeEventMap<ExpressAppConfig> {
3595
3612
  /**
3596
- * @description Element ready event
3613
+ * @description Element ready event — 上报可用支付方式
3597
3614
  */
3598
- ready: ExpressReadyInfo;
3615
+ ready: {
3616
+ availablePaymentMethods: Record<string, boolean>;
3617
+ };
3599
3618
  /**
3600
- * @description Payment authorization success event
3619
+ * @description 用户点击按钮 商户必须调用 event.resolve() 后 sheet 才弹出
3620
+ * 对 PayPal: resolve 为 no-op(PayPal 自行弹出 popup)
3601
3621
  */
3602
- approve: ApproveData;
3622
+ click: ExpressClickEvent;
3603
3623
  /**
3604
- * @description Payment error event
3624
+ * @description 统一支付完成事件(替代 approve)
3625
+ * 用户授权完成后触发,通过 expressPaymentType 区分钱包类型
3605
3626
  */
3606
- paymentError: ExpressErrorData;
3627
+ confirm: ExpressConfirmData;
3607
3628
  /**
3608
- * @description User cancelled payment event
3629
+ * @description 支付错误事件(扩展基类 ErrorPayload,新增 expressPaymentType)
3609
3630
  */
3610
- cancel: ExpressCancelInfo;
3631
+ error: ErrorPayload & {
3632
+ expressPaymentType: string;
3633
+ };
3611
3634
  /**
3612
- * @description Payment button click event
3635
+ * @description 用户取消支付
3613
3636
  */
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[];
3637
+ cancel: ExpressCancelEvent;
3638
+ /**
3639
+ * @description 用户在 sheet 内变更收货地址(AP/GP only,PayPal 不触发)
3640
+ */
3641
+ shippingaddresschange: {
3642
+ expressPaymentType: string;
3643
+ address: any;
3644
+ resolve: (options: ShippingResolveOptions) => void;
3645
+ reject: (reason: string) => void;
3646
+ };
3647
+ /**
3648
+ * @description 用户在 sheet 内变更配送方式(AP/GP only,PayPal 不触发)
3649
+ */
3650
+ shippingratechange: {
3651
+ expressPaymentType: string;
3652
+ shippingRate: any;
3653
+ resolve: (options: RateResolveOptions) => void;
3654
+ };
3655
+ /** @internal iframe 内容高度变化 */
3656
+ contentHeightChanged: {
3657
+ height: number;
3658
+ };
3659
+ /** @internal PayPal 请求商户创建订单 */
3660
+ 'paypal:createOrder': {
3661
+ requestId: string;
3662
+ };
3663
+ /** @internal PayPal createOrder 响应 */
3664
+ 'paypal:createOrder:reply': {
3665
+ requestId: string;
3666
+ sessionData?: string;
3667
+ error?: string;
3668
+ };
3669
+ /** @internal PayPal 用户变更收货地址 */
3670
+ 'paypal:onShippingAddressChange': {
3671
+ requestId: string;
3672
+ shippingData: any;
3673
+ };
3674
+ /** @internal PayPal 收货地址变更响应 */
3675
+ 'paypal:onShippingAddressChange:reply': {
3676
+ requestId: string;
3677
+ error?: string;
3678
+ };
3679
+ /** @internal PayPal 用户变更配送方式 */
3680
+ 'paypal:onShippingOptionsChange': {
3681
+ requestId: string;
3682
+ shippingData: any;
3683
+ };
3684
+ /** @internal PayPal 配送方式变更响应 */
3685
+ 'paypal:onShippingOptionsChange:reply': {
3686
+ requestId: string;
3687
+ error?: string;
3688
+ };
3652
3689
  }
3653
3690
 
3654
3691
  declare interface ExpSupportBank {
@@ -9895,6 +9932,14 @@ declare interface RateInfo {
9895
9932
  rate?: Rate;
9896
9933
  }
9897
9934
 
9935
+ /** shippingratechange 事件 resolve 参数 */
9936
+ export declare interface RateResolveOptions {
9937
+ lineItems?: Array<{
9938
+ name: string;
9939
+ amount: string;
9940
+ }>;
9941
+ }
9942
+
9898
9943
  declare interface RawAxiosHeaders {
9899
9944
  [key: string]: AxiosHeaderValue;
9900
9945
  }
@@ -10213,6 +10258,19 @@ declare interface ShippingInfo {
10213
10258
  deliveryEstimate?: DeliveryEstimate;
10214
10259
  }
10215
10260
 
10261
+ /** shippingaddresschange 事件 resolve 参数 */
10262
+ export declare interface ShippingResolveOptions {
10263
+ shippingRates?: Array<{
10264
+ id: string;
10265
+ displayName: string;
10266
+ amount: string;
10267
+ }>;
10268
+ lineItems?: Array<{
10269
+ name: string;
10270
+ amount: string;
10271
+ }>;
10272
+ }
10273
+
10216
10274
  declare type SimpleI18n = {
10217
10275
  get(id: GetI18nQueryParam, variable?: Record<string, any>, localeCode?: string): string;
10218
10276
  };