@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.
@@ -120,8 +120,8 @@ export var createModal = function createModal(_ref2) {
120
120
  theme = _loadingConfig$theme === void 0 ? 'default' : _loadingConfig$theme,
121
121
  _loadingConfig$backgr = loadingConfig.backgroundPrimary,
122
122
  backgroundPrimary = _loadingConfig$backgr === void 0 ? '#ffffff' : _loadingConfig$backgr;
123
- var mode = getCurrentTheme(theme);
124
- renderPopupLoading(modal, mode);
123
+ // const mode = getCurrentTheme(theme);
124
+ // renderPopupLoading(modal, mode);
125
125
  modal.style.backgroundColor = backgroundPrimary;
126
126
  iframe.style.backgroundColor = backgroundPrimary;
127
127
  }
@@ -20,6 +20,16 @@ export declare class EventCenter {
20
20
  * @returns
21
21
  */
22
22
  endEvent(startId: string, extra?: any): void;
23
+ /**
24
+ * Cancels a single active event and reports it as an ended event with canceled=true.
25
+ * This is used when the mount flow is terminated early (for example, on destroy or abnormal exit).
26
+ */
27
+ cancelEvent(startId: string, extra?: any): void;
28
+ /**
29
+ * Cancels all active events whose event id starts with the given prefix.
30
+ * For example, prefix 'mount' will cancel events like mount_1_start.
31
+ */
32
+ cancelByPrefix(prefix: string, extra?: any): void;
23
33
  private startHeartbeat;
24
34
  private stopHeartbeat;
25
35
  private sendHeartbeat;
@@ -89,17 +89,53 @@ export var EventCenter = /*#__PURE__*/function () {
89
89
  // 如果活动事件数量为0,则停止心跳
90
90
  if (this.activeEvents.size === 0) this.stopHeartbeat();
91
91
  }
92
+
93
+ /**
94
+ * Cancels a single active event and reports it as an ended event with canceled=true.
95
+ * This is used when the mount flow is terminated early (for example, on destroy or abnormal exit).
96
+ */
97
+ }, {
98
+ key: "cancelEvent",
99
+ value: function cancelEvent(startId, extra) {
100
+ if (!this.activeEvents.has(startId)) return;
101
+ var startTime = this.activeEvents.get(startId);
102
+ this.activeEvents.delete(startId);
103
+ var type = this.getEventNameFromStart(startId, 'end');
104
+ this.sendLog(type, _objectSpread({
105
+ eventName: this.buildIdFromStart(startId, 'end'),
106
+ startTime: startTime,
107
+ endTime: Date.now(),
108
+ canceled: true
109
+ }, extra || {}));
110
+ if (this.activeEvents.size === 0) this.stopHeartbeat();
111
+ }
112
+
113
+ /**
114
+ * Cancels all active events whose event id starts with the given prefix.
115
+ * For example, prefix 'mount' will cancel events like mount_1_start.
116
+ */
117
+ }, {
118
+ key: "cancelByPrefix",
119
+ value: function cancelByPrefix(prefix, extra) {
120
+ var _this = this;
121
+ var ids = Array.from(this.activeEvents.keys()).filter(function (id) {
122
+ return id.startsWith(prefix);
123
+ });
124
+ ids.forEach(function (id) {
125
+ return _this.cancelEvent(id, extra);
126
+ });
127
+ }
92
128
  }, {
93
129
  key: "startHeartbeat",
94
130
  value: function startHeartbeat() {
95
- var _this = this;
131
+ var _this2 = this;
96
132
  if (this.heartbeatIntervalId) return;
97
133
  this.heartbeatIntervalId = setInterval(function () {
98
- if (_this.activeEvents.size === 0) {
99
- _this.stopHeartbeat();
134
+ if (_this2.activeEvents.size === 0) {
135
+ _this2.stopHeartbeat();
100
136
  return;
101
137
  }
102
- _this.sendHeartbeat();
138
+ _this2.sendHeartbeat();
103
139
  }, this.HEARTBEAT_INTERVAL);
104
140
  }
105
141
  }, {
@@ -20,6 +20,8 @@ declare class ElementController {
20
20
  private handleInitializationError;
21
21
  private handleMountError;
22
22
  private clearAndSetInitTimeout;
23
+ private clearInitTimeout;
24
+ private clearEvents;
23
25
  private setInitTimeout;
24
26
  private initializeAndMountProcessor;
25
27
  private handleStartBizFlowError;
@@ -189,6 +189,25 @@ var ElementController = /*#__PURE__*/function () {
189
189
  this.initTimeout = this.setInitTimeout(resolve);
190
190
  }
191
191
 
192
+ // Clears the pending init timeout to avoid timeout callbacks from stale Element instances.
193
+ }, {
194
+ key: "clearInitTimeout",
195
+ value: function clearInitTimeout() {
196
+ clearTimeout(this.initTimeout);
197
+ this.initTimeout = null;
198
+ }
199
+
200
+ // Clears mount-related heartbeat events to avoid stale heartbeat reporting after abnormal exit.
201
+ }, {
202
+ key: "clearEvents",
203
+ value: function clearEvents(reason) {
204
+ var _this$elementEventCen, _this$elementEventCen2;
205
+ // antlog examples: actionName=mount_end&msg=destroy, actionName=mount_end&msg=webLaunch
206
+ (_this$elementEventCen = (_this$elementEventCen2 = this.elementEventCenter).cancelByPrefix) === null || _this$elementEventCen === void 0 || _this$elementEventCen.call(_this$elementEventCen2, 'mount', {
207
+ msg: reason
208
+ });
209
+ }
210
+
192
211
  // 设置初始化超时定时器
193
212
  }, {
194
213
  key: "setInitTimeout",
@@ -660,18 +679,22 @@ var ElementController = /*#__PURE__*/function () {
660
679
  _this5.sendReady(key, options);
661
680
  });
662
681
  }
663
- _context5.next = 24;
682
+ _context5.next = 26;
664
683
  break;
665
684
  case 20:
666
685
  _context5.prev = 20;
667
686
  _context5.t0 = _context5["catch"](1);
668
687
  this.handleInitializationError();
688
+ // Fix: when request processing enters the catch path (excluding success=false business responses),
689
+ // stale timeout and heartbeat events must be cleared to avoid duplicate error callbacks.
690
+ this.clearInitTimeout();
691
+ this.clearEvents('webLaunch');
669
692
  readyCallback({
670
693
  error: _objectSpread(_objectSpread({}, ERRORMESSAGE.INITIALIZE_TIMEOUT.API), {}, {
671
694
  traceId: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.traceId
672
695
  })
673
696
  });
674
- case 24:
697
+ case 26:
675
698
  case "end":
676
699
  return _context5.stop();
677
700
  }
@@ -828,6 +851,10 @@ var ElementController = /*#__PURE__*/function () {
828
851
  }, {
829
852
  key: "destroyHandle",
830
853
  value: function destroyHandle() {
854
+ // Fix: when a failed mount is destroyed and a new mount succeeds within the 16s timeout window,
855
+ // clear stale timeout and heartbeat events from the destroyed instance.
856
+ this.clearEvents('destroy');
857
+ this.clearInitTimeout();
831
858
  this.elementContainer.destroy();
832
859
  cleanMockup();
833
860
  removeRetentionPopup();
@@ -281,6 +281,11 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
281
281
  }, 100);
282
282
  return;
283
283
  }
284
+ _this3.getLogger().logInfo({
285
+ title: 'sdk_action_query_start'
286
+ }, {
287
+ config: safeStringify(paymentSessionConfig)
288
+ });
284
289
  var sdkRequestData = {
285
290
  paymentSessionConfig: paymentSessionConfig,
286
291
  paymentSessionData: paymentSession,
@@ -76,7 +76,10 @@ export var PopupManager = /*#__PURE__*/function () {
76
76
  styleConfig: {
77
77
  backgroundColor: (_data$loadingConfig = data.loadingConfig) === null || _data$loadingConfig === void 0 ? void 0 : _data$loadingConfig.backgroundPrimary
78
78
  },
79
- loadingConfig: undefined,
79
+ // 修复前
80
+ // loadingConfig: undefined,
81
+ // 修复后
82
+ loadingConfig: data.loadingConfig,
80
83
  showCloseOnLoading: data.showCloseOnLoading,
81
84
  onCloseOnLoading: data.onCloseOnLoading,
82
85
  textDirection: data === null || data === void 0 ? void 0 : data.textDirection
@@ -15,7 +15,7 @@ import { createLoader } from '@antglobal/create-sdk-loader';
15
15
 
16
16
  import { stageName } from "./stageName";
17
17
  var SDKURL = {
18
- DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("2.0.12", "/ams-checkout.js"),
18
+ DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("2.0.14", "/ams-checkout.js"),
19
19
  LOCAL: "http://localhost:3000/ams-checkout.min.js",
20
20
  PROD: 'https://js.antom.com/v2/ams-checkout.js'
21
21
  };
@@ -108,7 +108,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
108
108
  var _paypalPluginProps$pa3, _paypalPluginProps$pa4, _paypalPluginProps$pa5, _paypalPluginProps$pa6;
109
109
  var channelMerchantAccountId = (_paypalPluginProps$pa3 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa3 === void 0 || (_paypalPluginProps$pa3 = _paypalPluginProps$pa3.merchantInfo) === null || _paypalPluginProps$pa3 === void 0 ? void 0 : _paypalPluginProps$pa3.channelMerchantClientId;
110
110
  var accessToken = (_paypalPluginProps$pa4 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.paypal) === null || _paypalPluginProps$pa4 === void 0 ? void 0 : _paypalPluginProps$pa4.accessToken;
111
- var locale = paypalPluginProps.locale;
111
+ var locale = paypalPluginProps.locale || 'en_US';
112
112
  var currency = (_paypalPluginProps$pa5 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.paymentAmount) === null || _paypalPluginProps$pa5 === void 0 ? void 0 : _paypalPluginProps$pa5.currency;
113
113
  var paymentMethodType = (_paypalPluginProps$pa6 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa6 === void 0 || (_paypalPluginProps$pa6 = _paypalPluginProps$pa6.paymentMethodInfo) === null || _paypalPluginProps$pa6 === void 0 ? void 0 : _paypalPluginProps$pa6.paymentMethodType;
114
114
  var _ref2 = (paypalPluginProps === null || paypalPluginProps === void 0 ? void 0 : paypalPluginProps.paypalConfiguration) || {},
@@ -198,7 +198,7 @@ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
198
198
  });
199
199
  _this.onEventCallback({
200
200
  code: eventCodeEnum.SDK_PAYMENT_FAIL,
201
- message: 'Create order failed.'
201
+ message: (queryPaymentInfoRes === null || queryPaymentInfoRes === void 0 ? void 0 : queryPaymentInfoRes.errorMessage) || 'Create order failed.'
202
202
  });
203
203
  return _context2.abrupt("return");
204
204
  case 7:
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.2"
8
+ "packageVersion": "7.58.7"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "2.0.12",
3
+ "version": "2.0.14",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {
7
7
  ".": {
8
- "import": "./esm/index.js",
9
8
  "types": "./esm/index.d.ts",
9
+ "import": "./esm/index.js",
10
10
  "require": "./ams-checkout.js"
11
11
  },
12
12
  "./types": "./types.d.ts",
13
13
  "./antom": "./antom.d.ts",
14
14
  "./react-js": {
15
- "import": "./react-js.js",
16
15
  "types": "./react-js.d.ts",
16
+ "import": "./react-js.js",
17
17
  "require": "./react-js.cjs"
18
18
  },
19
19
  "./interface": "./types.untrimmed.d.ts"
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
  */
@@ -595,11 +582,7 @@ declare type AxiosHeaderMatcher =
595
582
  | RegExp
596
583
  | ((this: AxiosHeaders, value: string, name: string) => boolean);
597
584
 
598
- declare type AxiosHeaderParser = (
599
- this: AxiosHeaders,
600
- value: AxiosHeaderValue,
601
- header: string,
602
- ) => any;
585
+ declare type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any;
603
586
 
604
587
  declare class AxiosHeaders {
605
588
  constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
@@ -609,12 +592,9 @@ declare class AxiosHeaders {
609
592
  set(
610
593
  headerName?: string,
611
594
  value?: AxiosHeaderValue,
612
- rewrite?: boolean | AxiosHeaderMatcher,
613
- ): AxiosHeaders;
614
- set(
615
- headers?: RawAxiosHeaders | AxiosHeaders | string,
616
- rewrite?: boolean,
595
+ rewrite?: boolean | AxiosHeaderMatcher
617
596
  ): AxiosHeaders;
597
+ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;
618
598
 
619
599
  get(headerName: string, parser: RegExp): RegExpExecArray | null;
620
600
  get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue;
@@ -628,9 +608,7 @@ declare class AxiosHeaders {
628
608
  normalize(format: boolean): AxiosHeaders;
629
609
 
630
610
  concat(
631
- ...targets: Array<
632
- AxiosHeaders | RawAxiosHeaders | string | undefined | null
633
- >
611
+ ...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
634
612
  ): AxiosHeaders;
635
613
 
636
614
  toJSON(asStrings?: boolean): RawAxiosHeaders;
@@ -640,55 +618,35 @@ declare class AxiosHeaders {
640
618
  static accessor(header: string | string[]): AxiosHeaders;
641
619
 
642
620
  static concat(
643
- ...targets: Array<
644
- AxiosHeaders | RawAxiosHeaders | string | undefined | null
645
- >
621
+ ...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>
646
622
  ): AxiosHeaders;
647
623
 
648
- setContentType(
649
- value: ContentType,
650
- rewrite?: boolean | AxiosHeaderMatcher,
651
- ): AxiosHeaders;
624
+ setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
652
625
  getContentType(parser?: RegExp): RegExpExecArray | null;
653
626
  getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
654
627
  hasContentType(matcher?: AxiosHeaderMatcher): boolean;
655
628
 
656
- setContentLength(
657
- value: AxiosHeaderValue,
658
- rewrite?: boolean | AxiosHeaderMatcher,
659
- ): AxiosHeaders;
629
+ setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
660
630
  getContentLength(parser?: RegExp): RegExpExecArray | null;
661
631
  getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
662
632
  hasContentLength(matcher?: AxiosHeaderMatcher): boolean;
663
633
 
664
- setAccept(
665
- value: AxiosHeaderValue,
666
- rewrite?: boolean | AxiosHeaderMatcher,
667
- ): AxiosHeaders;
634
+ setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
668
635
  getAccept(parser?: RegExp): RegExpExecArray | null;
669
636
  getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
670
637
  hasAccept(matcher?: AxiosHeaderMatcher): boolean;
671
638
 
672
- setUserAgent(
673
- value: AxiosHeaderValue,
674
- rewrite?: boolean | AxiosHeaderMatcher,
675
- ): AxiosHeaders;
639
+ setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
676
640
  getUserAgent(parser?: RegExp): RegExpExecArray | null;
677
641
  getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
678
642
  hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;
679
643
 
680
- setContentEncoding(
681
- value: AxiosHeaderValue,
682
- rewrite?: boolean | AxiosHeaderMatcher,
683
- ): AxiosHeaders;
644
+ setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
684
645
  getContentEncoding(parser?: RegExp): RegExpExecArray | null;
685
646
  getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
686
647
  hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;
687
648
 
688
- setAuthorization(
689
- value: AxiosHeaderValue,
690
- rewrite?: boolean | AxiosHeaderMatcher,
691
- ): AxiosHeaders;
649
+ setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;
692
650
  getAuthorization(parser?: RegExp): RegExpExecArray | null;
693
651
  getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue;
694
652
  hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;
@@ -698,13 +656,7 @@ declare class AxiosHeaders {
698
656
  [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>;
699
657
  }
700
658
 
701
- declare type AxiosHeaderValue =
702
- | AxiosHeaders
703
- | string
704
- | string[]
705
- | number
706
- | boolean
707
- | null;
659
+ declare type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;
708
660
 
709
661
  declare interface BankInfo {
710
662
  /**
@@ -743,6 +695,7 @@ declare interface BaseAppearance<A extends Partial<Appearance>> {
743
695
  declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Record<string, any>, SubmitReplay extends Record<string, any> = Record<string, any>, SubmitParams extends Record<string, any> = Record<string, any>, AppErrorCodes extends string = string, OpenModalConfig extends BaseOpenModalConfig = BaseOpenModalConfig> {
744
696
  error: ErrorPayload<AppErrorCodes>;
745
697
  /* Excluded from this release type: "OPENSDK@HANDSHAKE" */
698
+ /* Excluded from this release type: "OPENSDK@READY_HANDSHAKE" */
746
699
  /* Excluded from this release type: "OPENSDK@UPDATE_CONFIG" */
747
700
  /* Excluded from this release type: "OPENSDK@HANDSHAKE_ACK" */
748
701
  /* Excluded from this release type: "OPENSDK@SUBMIT" */
@@ -1545,6 +1498,28 @@ declare interface ChargeInfo {
1545
1498
  chargeActualAmountView?: PaymentView;
1546
1499
  }
1547
1500
 
1501
+ /** click 事件 resolve 参数 */
1502
+ export declare interface ClickResolveOptions {
1503
+ amount?: {
1504
+ currency: string;
1505
+ value: string;
1506
+ };
1507
+ shippingAddressRequired?: boolean;
1508
+ allowedShippingCountries?: string[];
1509
+ shippingRates?: Array<{
1510
+ id: string;
1511
+ displayName: string;
1512
+ amount: string;
1513
+ }>;
1514
+ lineItems?: Array<{
1515
+ name: string;
1516
+ amount: string;
1517
+ }>;
1518
+ business?: {
1519
+ name: string;
1520
+ };
1521
+ }
1522
+
1548
1523
  declare interface CodeFormView {
1549
1524
  /**
1550
1525
  * @description title
@@ -2157,12 +2132,12 @@ declare interface ConnectFactor {
2157
2132
 
2158
2133
  declare type ContentType =
2159
2134
  | AxiosHeaderValue
2160
- | "text/html"
2161
- | "text/plain"
2162
- | "multipart/form-data"
2163
- | "application/json"
2164
- | "application/x-www-form-urlencoded"
2165
- | "application/octet-stream";
2135
+ | 'text/html'
2136
+ | 'text/plain'
2137
+ | 'multipart/form-data'
2138
+ | 'application/json'
2139
+ | 'application/x-www-form-urlencoded'
2140
+ | 'application/octet-stream';
2166
2141
 
2167
2142
  declare namespace CSS_2 {
2168
2143
  export {
@@ -3219,8 +3194,8 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3219
3194
  currency: string;
3220
3195
  value: string;
3221
3196
  };
3222
- /** PayPal payment configuration */
3223
- paypalConfig?: PayPalConfig;
3197
+ /** PayPal 配置 */
3198
+ paypal?: PayPalConfig;
3224
3199
  /**
3225
3200
  * Button text type (following Stripe Express Checkout Element design)
3226
3201
  * Each payment method can independently set the button display text
@@ -3249,21 +3224,34 @@ export declare interface ExpressAppConfig extends BaseAppearance<AppearanceSetti
3249
3224
  * @example ['paypal']
3250
3225
  */
3251
3226
  paymentMethods?: string[];
3252
- /** Lifecycle callbacks */
3253
- hooks?: ExpressHooks;
3227
+ /* Excluded from this release type: setupError */
3228
+ /**
3229
+ * Locale for internationalization, passed from entry params (loadAntom), default to en_US
3230
+ */
3231
+ locale?: string;
3254
3232
  }
3255
3233
 
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) */
3234
+ /** cancel 事件负载 */
3235
+ export declare interface ExpressCancelEvent {
3236
+ expressPaymentType: string;
3264
3237
  data?: any;
3265
3238
  }
3266
3239
 
3240
+ /** click 事件负载 */
3241
+ export declare interface ExpressClickEvent {
3242
+ expressPaymentType: string;
3243
+ resolve: (options: ClickResolveOptions) => void;
3244
+ }
3245
+
3246
+ /** confirm 事件负载(统一终态,替代 approve) */
3247
+ export declare interface ExpressConfirmData {
3248
+ expressPaymentType: string;
3249
+ paymentData: any;
3250
+ billingDetails?: any;
3251
+ shippingAddress?: any;
3252
+ sessionData?: string;
3253
+ }
3254
+
3267
3255
  /**
3268
3256
  * @public
3269
3257
  * @description Express element - express checkout element, supports PayPal / Apple Pay / Google Pay
@@ -3302,62 +3290,55 @@ export declare interface ExpressElementConfig extends BaseElementConfig<ExpressA
3302
3290
  */
3303
3291
  export declare interface ExpressElementEvents extends AntomBridgeEventMap<ExpressAppConfig> {
3304
3292
  /**
3305
- * @description Element ready event
3293
+ * @description Element ready event — 上报可用支付方式
3306
3294
  */
3307
- ready: ExpressReadyInfo;
3295
+ ready: {
3296
+ availablePaymentMethods: Record<string, boolean>;
3297
+ };
3308
3298
  /**
3309
- * @description Payment authorization success event
3299
+ * @description 用户点击按钮 商户必须调用 event.resolve() 后 sheet 才弹出
3300
+ * 对 PayPal: resolve 为 no-op(PayPal 自行弹出 popup)
3310
3301
  */
3311
- approve: ApproveData;
3302
+ click: ExpressClickEvent;
3312
3303
  /**
3313
- * @description Payment error event
3304
+ * @description 统一支付完成事件(替代 approve)
3305
+ * 用户授权完成后触发,通过 expressPaymentType 区分钱包类型
3314
3306
  */
3315
- paymentError: ExpressErrorData;
3307
+ confirm: ExpressConfirmData;
3316
3308
  /**
3317
- * @description User cancelled payment event
3309
+ * @description 支付错误事件(扩展基类 ErrorPayload,新增 expressPaymentType)
3318
3310
  */
3319
- cancel: ExpressCancelInfo;
3311
+ error: ErrorPayload & {
3312
+ expressPaymentType: string;
3313
+ };
3320
3314
  /**
3321
- * @description Payment button click event
3315
+ * @description 用户取消支付
3322
3316
  */
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[];
3317
+ cancel: ExpressCancelEvent;
3318
+ /**
3319
+ * @description 用户在 sheet 内变更收货地址(AP/GP only,PayPal 不触发)
3320
+ */
3321
+ shippingaddresschange: {
3322
+ expressPaymentType: string;
3323
+ address: any;
3324
+ resolve: (options: ShippingResolveOptions) => void;
3325
+ reject: (reason: string) => void;
3326
+ };
3327
+ /**
3328
+ * @description 用户在 sheet 内变更配送方式(AP/GP only,PayPal 不触发)
3329
+ */
3330
+ shippingratechange: {
3331
+ expressPaymentType: string;
3332
+ shippingRate: any;
3333
+ resolve: (options: RateResolveOptions) => void;
3334
+ };
3335
+ /* Excluded from this release type: contentHeightChanged */
3336
+ /* Excluded from this release type: "paypal:createOrder" */
3337
+ /* Excluded from this release type: "paypal:createOrder:reply" */
3338
+ /* Excluded from this release type: "paypal:onShippingAddressChange" */
3339
+ /* Excluded from this release type: "paypal:onShippingAddressChange:reply" */
3340
+ /* Excluded from this release type: "paypal:onShippingOptionsChange" */
3341
+ /* Excluded from this release type: "paypal:onShippingOptionsChange:reply" */
3361
3342
  }
3362
3343
 
3363
3344
  declare interface ExpSupportBank {
@@ -9601,6 +9582,14 @@ declare interface RateInfo {
9601
9582
  rate?: Rate;
9602
9583
  }
9603
9584
 
9585
+ /** shippingratechange 事件 resolve 参数 */
9586
+ export declare interface RateResolveOptions {
9587
+ lineItems?: Array<{
9588
+ name: string;
9589
+ amount: string;
9590
+ }>;
9591
+ }
9592
+
9604
9593
  declare interface RawAxiosHeaders {
9605
9594
  [key: string]: AxiosHeaderValue;
9606
9595
  }
@@ -9919,6 +9908,19 @@ declare interface ShippingInfo {
9919
9908
  deliveryEstimate?: DeliveryEstimate;
9920
9909
  }
9921
9910
 
9911
+ /** shippingaddresschange 事件 resolve 参数 */
9912
+ export declare interface ShippingResolveOptions {
9913
+ shippingRates?: Array<{
9914
+ id: string;
9915
+ displayName: string;
9916
+ amount: string;
9917
+ }>;
9918
+ lineItems?: Array<{
9919
+ name: string;
9920
+ amount: string;
9921
+ }>;
9922
+ }
9923
+
9922
9924
  declare type SimpleI18n = {
9923
9925
  get(id: GetI18nQueryParam, variable?: Record<string, any>, localeCode?: string): string;
9924
9926
  };