@alipay/ams-checkout 0.0.1780646303-dev.0 → 0.0.1781004142-dev.0

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.
@@ -283,6 +283,9 @@ export declare const EVENT: {
283
283
  submitPromiseCallback: {
284
284
  name: string;
285
285
  };
286
+ beforeConfirm: {
287
+ name: string;
288
+ };
286
289
  validateFieldsResult: {
287
290
  name: string;
288
291
  forwardName: string;
@@ -289,6 +289,10 @@ export var EVENT = {
289
289
  submitPromiseCallback: {
290
290
  name: 'onSubmitPayCallback'
291
291
  },
292
+ // After Apple Pay authorization, before charge: notify SDK layer to execute merchant's onBeforeConfirm callback
293
+ beforeConfirm: {
294
+ name: 'onBeforeConfirm'
295
+ },
292
296
  validateFieldsResult: {
293
297
  name: 'validateFieldsResult',
294
298
  forwardName: 'validateFieldsResultForward',
@@ -10,6 +10,8 @@ declare class ElementController {
10
10
  private onStatusChangeCallback;
11
11
  private submitPayPromise;
12
12
  private elementEventCenter;
13
+ /** Current selected payment method type (e.g. 'APPLEPAY', 'CARD'), updated via paymentMethodChanged event */
14
+ private currentPaymentMethodType;
13
15
  constructor(options: IElementOptions);
14
16
  private initService;
15
17
  private initElementProcessors;
@@ -41,7 +41,7 @@ import { ElementContainerService } from "../elementContainerService"; // 引入
41
41
  import { IContainerStatus } from "../elementContainerService/containerService";
42
42
  import { EventCenter as ElementEventCenter } from "../EventCenter/index";
43
43
  import { oneAccountUpdate, sdkActionUpdate } from "../mock";
44
- import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
44
+ import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EVENTNAME, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
45
45
  import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, safeParse, safeStringify, showToast } from "../util";
46
46
  var TIMEOUT_DURATION = 16000;
47
47
  var ElementController = /*#__PURE__*/function () {
@@ -59,6 +59,8 @@ var ElementController = /*#__PURE__*/function () {
59
59
  // 新增变量
60
60
  _defineProperty(this, "submitPayPromise", void 0);
61
61
  _defineProperty(this, "elementEventCenter", void 0);
62
+ /** Current selected payment method type (e.g. 'APPLEPAY', 'CARD'), updated via paymentMethodChanged event */
63
+ _defineProperty(this, "currentPaymentMethodType", void 0);
62
64
  _defineProperty(this, "onValidateFunc", function (event, target) {
63
65
  return new Promise(function (resolve) {
64
66
  event.emitAndListen({
@@ -372,7 +374,7 @@ var ElementController = /*#__PURE__*/function () {
372
374
  value: function () {
373
375
  var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(submitParams) {
374
376
  var _this3 = this;
375
- var startEventId, res, logParams, recordResult, _recordResult, _recordResult2, _recordResult3, _recordResult4, _recordResult5, _logParams;
377
+ var startEventId, res, logParams, isApplePay, shouldContinue, recordResult, _recordResult, _recordResult2, _recordResult3, _recordResult4, _recordResult5, _logParams;
376
378
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
377
379
  while (1) switch (_context4.prev = _context4.next) {
378
380
  case 0:
@@ -397,12 +399,60 @@ var ElementController = /*#__PURE__*/function () {
397
399
  return _context4.abrupt("return", Promise.resolve(res));
398
400
  case 6:
399
401
  this.changeLoading(true);
402
+
403
+ // Non-Apple Pay: execute onBeforeConfirm at SDK layer directly, abort on failure
404
+ isApplePay = this.currentPaymentMethodType === 'APPLEPAY';
405
+ if (!(submitParams !== null && submitParams !== void 0 && submitParams.onBeforeConfirm && !isApplePay)) {
406
+ _context4.next = 23;
407
+ break;
408
+ }
409
+ _context4.prev = 9;
410
+ _context4.next = 12;
411
+ return submitParams.onBeforeConfirm();
412
+ case 12:
413
+ shouldContinue = _context4.sent;
414
+ if (!(shouldContinue === false)) {
415
+ _context4.next = 16;
416
+ break;
417
+ }
418
+ this.changeLoading(false);
419
+ return _context4.abrupt("return", {
420
+ status: PaymentStatus.FAIL,
421
+ error: {
422
+ code: 'MERCHANT_ABORT',
423
+ message: 'Payment was cancelled by merchant before confirmation.',
424
+ needChangeSessionForRetry: false
425
+ }
426
+ });
427
+ case 16:
428
+ _context4.next = 23;
429
+ break;
430
+ case 18:
431
+ _context4.prev = 18;
432
+ _context4.t0 = _context4["catch"](9);
433
+ this.changeLoading(false);
434
+ this.serviceMap.Log.logError({
435
+ title: ELEMENT_SPM_MAP.sdk_element_missKeyData
436
+ }, {
437
+ msg: safeStringify({
438
+ error: 'onBeforeConfirm callback error'
439
+ })
440
+ });
441
+ return _context4.abrupt("return", {
442
+ status: PaymentStatus.FAIL,
443
+ error: {
444
+ code: 'BEFORE_CONFIRM_ERROR',
445
+ message: 'An error occurred during the before-confirm callback.',
446
+ needChangeSessionForRetry: false
447
+ }
448
+ });
449
+ case 23:
400
450
  recordResult = null;
401
- _context4.prev = 8;
402
- _context4.next = 11;
451
+ _context4.prev = 24;
452
+ _context4.next = 27;
403
453
  return new Promise( /*#__PURE__*/function () {
404
454
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
405
- var that, recordResultCallback, params, processStep, _submitParams$handleA, _yield$_this3$onValid2, _data, errorString, errorResult;
455
+ var that, recordResultCallback, params, processStep, _submitParams$handleA, hasBeforeConfirmForApplePay, _yield$_this3$onValid2, _data, errorString, errorResult;
406
456
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
407
457
  while (1) switch (_context3.prev = _context3.next) {
408
458
  case 0:
@@ -478,26 +528,31 @@ var ElementController = /*#__PURE__*/function () {
478
528
  return _context3.abrupt("return");
479
529
  case 14:
480
530
  if (!_this3.elementProcessors[ElementType.payment]) {
481
- _context3.next = 21;
531
+ _context3.next = 23;
482
532
  break;
483
533
  }
484
- _context3.next = 17;
534
+ // Apple Pay: set onBeforeConfirm on paymentProcessor for event bridge callback after iframe authorization
535
+ hasBeforeConfirmForApplePay = isApplePay && !!(submitParams !== null && submitParams !== void 0 && submitParams.onBeforeConfirm);
536
+ _this3.elementProcessors[ElementType.payment].setOnBeforeConfirm(hasBeforeConfirmForApplePay ? submitParams.onBeforeConfirm : null);
537
+ _context3.next = 19;
485
538
  return _this3.onValidateAndSubmitPay(_this3.elementProcessors[ElementType.payment].eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, _objectSpread(_objectSpread({}, params), {}, {
486
539
  handleActions: (_submitParams$handleA = submitParams === null || submitParams === void 0 ? void 0 : submitParams.handleActions) !== null && _submitParams$handleA !== void 0 ? _submitParams$handleA : true,
487
- shipping: submitParams === null || submitParams === void 0 ? void 0 : submitParams.shippingInfo
540
+ shipping: submitParams === null || submitParams === void 0 ? void 0 : submitParams.shippingInfo,
541
+ applePayAmount: submitParams === null || submitParams === void 0 ? void 0 : submitParams.applePayAmount,
542
+ hasBeforeConfirm: hasBeforeConfirmForApplePay
488
543
  }));
489
- case 17:
544
+ case 19:
490
545
  _yield$_this3$onValid2 = _context3.sent;
491
546
  _data = _yield$_this3$onValid2.data;
492
547
  // TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
493
548
  // TODO checkout 返回的错误未包含 status 和 message @马杰 @薛浩
494
549
  recordResult = _data;
495
550
  recordResultCallback(recordResult);
496
- case 21:
497
- _context3.next = 30;
498
- break;
499
551
  case 23:
500
- _context3.prev = 23;
552
+ _context3.next = 32;
553
+ break;
554
+ case 25:
555
+ _context3.prev = 25;
501
556
  _context3.t0 = _context3["catch"](2);
502
557
  // 修复error为{}空对象的问题,上报stack&message
503
558
  errorString = JSON.stringify(_context3.t0, Object.getOwnPropertyNames(_context3.t0));
@@ -514,20 +569,20 @@ var ElementController = /*#__PURE__*/function () {
514
569
  });
515
570
  recordResult = errorResult;
516
571
  recordResultCallback(errorResult);
517
- case 30:
572
+ case 32:
518
573
  case "end":
519
574
  return _context3.stop();
520
575
  }
521
- }, _callee3, null, [[2, 23]]);
576
+ }, _callee3, null, [[2, 25]]);
522
577
  }));
523
578
  return function (_x2) {
524
579
  return _ref3.apply(this, arguments);
525
580
  };
526
581
  }());
527
- case 11:
582
+ case 27:
528
583
  return _context4.abrupt("return", _context4.sent);
529
- case 12:
530
- _context4.prev = 12;
584
+ case 28:
585
+ _context4.prev = 28;
531
586
  _logParams = {
532
587
  eventCode: (_recordResult = recordResult) === null || _recordResult === void 0 ? void 0 : _recordResult.status,
533
588
  errorName: (_recordResult2 = recordResult) === null || _recordResult2 === void 0 || (_recordResult2 = _recordResult2.error) === null || _recordResult2 === void 0 ? void 0 : _recordResult2.code,
@@ -538,12 +593,12 @@ var ElementController = /*#__PURE__*/function () {
538
593
  };
539
594
  this.elementEventCenter.endEvent(startEventId, _logParams);
540
595
  this.changeLoading(false);
541
- return _context4.finish(12);
542
- case 17:
596
+ return _context4.finish(28);
597
+ case 33:
543
598
  case "end":
544
599
  return _context4.stop();
545
600
  }
546
- }, _callee4, this, [[8,, 12, 17]]);
601
+ }, _callee4, this, [[9, 18], [24,, 28, 33]]);
547
602
  }));
548
603
  function submitPayment(_x) {
549
604
  return _submitPayment.apply(this, arguments);
@@ -628,6 +683,9 @@ var ElementController = /*#__PURE__*/function () {
628
683
  var _this4$submitPayPromi;
629
684
  (_this4$submitPayPromi = _this4.submitPayPromise) === null || _this4$submitPayPromi === void 0 || _this4$submitPayPromi.call(_this4, data);
630
685
  });
686
+ this.serviceMap.EventCenter.listen(EVENTNAME.PAYMENTMETHODCHANGED, function (data) {
687
+ _this4.currentPaymentMethodType = (data === null || data === void 0 ? void 0 : data.type) || '';
688
+ });
631
689
  }
632
690
  }, {
633
691
  key: "sendRequestAndWaitWebLaunch",
@@ -2,6 +2,13 @@ import { LogService } from '../../../../foundation/service/log';
2
2
  import BaseElementProcessor from './baseElementProcessor';
3
3
  declare class PaymentProcessor extends BaseElementProcessor {
4
4
  private ApplePayService;
5
+ /**
6
+ * Merchant's onBeforeConfirm callback reference, used in Apple Pay scenario only.
7
+ * Set by elementController.submitPayment before payment,
8
+ * triggered via beforeConfirm event after Apple Pay authorization in iframe.
9
+ */
10
+ private _onBeforeConfirm;
11
+ setOnBeforeConfirm(callback: (() => Promise<boolean>) | null): void;
5
12
  onReady(extraParam: any): void;
6
13
  getLogger(): LogService;
7
14
  private addEventListener;
@@ -56,9 +56,20 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
56
56
  // parameterInitAndCheck(): void {}
57
57
  // apple pay
58
58
  _defineProperty(_assertThisInitialized(_this), "ApplePayService", void 0);
59
+ /**
60
+ * Merchant's onBeforeConfirm callback reference, used in Apple Pay scenario only.
61
+ * Set by elementController.submitPayment before payment,
62
+ * triggered via beforeConfirm event after Apple Pay authorization in iframe.
63
+ */
64
+ _defineProperty(_assertThisInitialized(_this), "_onBeforeConfirm", null);
59
65
  return _this;
60
66
  }
61
67
  _createClass(PaymentProcessor, [{
68
+ key: "setOnBeforeConfirm",
69
+ value: function setOnBeforeConfirm(callback) {
70
+ this._onBeforeConfirm = callback;
71
+ }
72
+ }, {
62
73
  key: "onReady",
63
74
  value: function onReady(extraParam) {
64
75
  var _this$elementContaine, _this$elementContaine2, _this$elementContaine3, _this$elementContaine4, _this$elementContaine5;
@@ -163,19 +174,75 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
163
174
  });
164
175
  });
165
176
  });
177
+ // Apple Pay event bridge: after user authorization (FaceID/TouchID) in iframe, before actual charge,
178
+ // requests SDK layer to execute merchant's onBeforeConfirm callback via beforeConfirm event,
179
+ // and returns the result (continue/abort) to iframe via dispatchToApp.
180
+ this.eventCenter.listen(EVENT.beforeConfirm.name, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
181
+ var shouldContinue;
182
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
183
+ while (1) switch (_context.prev = _context.next) {
184
+ case 0:
185
+ if (_this2._onBeforeConfirm) {
186
+ _context.next = 3;
187
+ break;
188
+ }
189
+ _this2.eventCenter.dispatchToApp({
190
+ event: EVENT.beforeConfirm.name,
191
+ data: {
192
+ success: true,
193
+ result: true
194
+ }
195
+ });
196
+ return _context.abrupt("return");
197
+ case 3:
198
+ _context.prev = 3;
199
+ _context.next = 6;
200
+ return _this2._onBeforeConfirm();
201
+ case 6:
202
+ shouldContinue = _context.sent;
203
+ _this2.eventCenter.dispatchToApp({
204
+ event: EVENT.beforeConfirm.name,
205
+ data: {
206
+ success: true,
207
+ result: shouldContinue !== false
208
+ }
209
+ });
210
+ _context.next = 14;
211
+ break;
212
+ case 10:
213
+ _context.prev = 10;
214
+ _context.t0 = _context["catch"](3);
215
+ logger.logError({
216
+ title: 'sdk_element_onBeforeConfirm_error'
217
+ }, {
218
+ error: safeStringify(_context.t0)
219
+ });
220
+ _this2.eventCenter.dispatchToApp({
221
+ event: EVENT.beforeConfirm.name,
222
+ data: {
223
+ success: false,
224
+ result: false
225
+ }
226
+ });
227
+ case 14:
228
+ case "end":
229
+ return _context.stop();
230
+ }
231
+ }, _callee, null, [[3, 10]]);
232
+ })));
166
233
  }
167
234
  }, {
168
235
  key: "initApplePaySdk",
169
236
  value: function () {
170
- var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
237
+ var _initApplePaySdk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
171
238
  var _this$elementContaine6;
172
- var _ref, paymentSessionObj, paymentSession;
173
- return _regeneratorRuntime().wrap(function _callee$(_context) {
174
- while (1) switch (_context.prev = _context.next) {
239
+ var _ref2, paymentSessionObj, paymentSession;
240
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
241
+ while (1) switch (_context2.prev = _context2.next) {
175
242
  case 0:
176
- _ref = ((_this$elementContaine6 = this.elementContainer) === null || _this$elementContaine6 === void 0 ? void 0 : _this$elementContaine6.getPaymentContext()) || {}, paymentSessionObj = _ref.paymentSessionObj, paymentSession = _ref.paymentSession;
243
+ _ref2 = ((_this$elementContaine6 = this.elementContainer) === null || _this$elementContaine6 === void 0 ? void 0 : _this$elementContaine6.getPaymentContext()) || {}, paymentSessionObj = _ref2.paymentSessionObj, paymentSession = _ref2.paymentSession;
177
244
  if (!isSkipRenderPaymentMethod(paymentSessionObj)) {
178
- _context.next = 13;
245
+ _context2.next = 13;
179
246
  break;
180
247
  }
181
248
  this.ApplePayService = new ApplePaySdk({
@@ -184,29 +251,29 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
184
251
  logger: logger,
185
252
  env: this.options.env.environment
186
253
  });
187
- _context.prev = 3;
254
+ _context2.prev = 3;
188
255
  logger.logInfo({
189
256
  title: 'a3753.b107385.c398110'
190
257
  });
191
- _context.next = 7;
258
+ _context2.next = 7;
192
259
  return this.ApplePayService.initApplePaySession();
193
260
  case 7:
194
261
  logger.logInfo({
195
262
  title: 'a3753.b107385.c398112'
196
263
  });
197
- _context.next = 13;
264
+ _context2.next = 13;
198
265
  break;
199
266
  case 10:
200
- _context.prev = 10;
201
- _context.t0 = _context["catch"](3);
267
+ _context2.prev = 10;
268
+ _context2.t0 = _context2["catch"](3);
202
269
  logger.logError({
203
270
  title: 'a3753.b107385.c398111'
204
271
  });
205
272
  case 13:
206
273
  case "end":
207
- return _context.stop();
274
+ return _context2.stop();
208
275
  }
209
- }, _callee, this, [[3, 10]]);
276
+ }, _callee2, this, [[3, 10]]);
210
277
  }));
211
278
  function initApplePaySdk() {
212
279
  return _initApplePaySdk.apply(this, arguments);
@@ -227,20 +294,20 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
227
294
  }
228
295
  }, {
229
296
  key: "generateIframeSrc",
230
- value: function generateIframeSrc(_ref2) {
231
- var link = _ref2.link,
232
- instanceId = _ref2.instanceId;
297
+ value: function generateIframeSrc(_ref3) {
298
+ var link = _ref3.link,
299
+ instanceId = _ref3.instanceId;
233
300
  this.instanceId = instanceId;
234
- var _ref3 = this.elementContainer.getPaymentContext() || {},
235
- paymentSession = _ref3.paymentSession,
236
- paymentSessionObj = _ref3.paymentSessionObj,
237
- sdkMetaData = _ref3.sdkMetaData;
301
+ var _ref4 = this.elementContainer.getPaymentContext() || {},
302
+ paymentSession = _ref4.paymentSession,
303
+ paymentSessionObj = _ref4.paymentSessionObj,
304
+ sdkMetaData = _ref4.sdkMetaData;
238
305
  var _this$options = this.options,
239
306
  environment = _this$options.env.environment,
240
307
  analytics = _this$options.analytics,
241
308
  locale = _this$options.locale;
242
- var _ref4 = paymentSessionObj || {},
243
- extendInfo = _ref4.extendInfo;
309
+ var _ref5 = paymentSessionObj || {},
310
+ extendInfo = _ref5.extendInfo;
244
311
  var url = _generateIframeSrc({
245
312
  paymentSession: paymentSession,
246
313
  paymentSessionObj: paymentSessionObj,
@@ -258,19 +325,19 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
258
325
  }, {
259
326
  key: "obtainData",
260
327
  value: function () {
261
- var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
328
+ var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
262
329
  var _paymentSessionObj$co,
263
330
  _this3 = this;
264
- var requestService, _this$elementContaine7, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref5, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
265
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
266
- while (1) switch (_context2.prev = _context2.next) {
331
+ var requestService, _this$elementContaine7, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref6, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
332
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
333
+ while (1) switch (_context3.prev = _context3.next) {
267
334
  case 0:
268
335
  requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
269
336
  _this$elementContaine7 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine7.paymentSession, paymentSessionObj = _this$elementContaine7.paymentSessionObj, displayInfo = _this$elementContaine7.displayInfo;
270
337
  _displayInfo = displayInfo;
271
338
  debugProps = _displayInfo.debugProps;
272
339
  _this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
273
- _ref5 = paymentSessionObj || {}, paymentSessionConfig = _ref5.paymentSessionConfig;
340
+ _ref6 = paymentSessionObj || {}, paymentSessionConfig = _ref6.paymentSessionConfig;
274
341
  hostSign = paymentSession.split('&&')[1] || '';
275
342
  isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
276
343
  LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
@@ -407,10 +474,10 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
407
474
  });
408
475
  });
409
476
  };
410
- _context2.next = 15;
477
+ _context3.next = 15;
411
478
  return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
412
479
  case 15:
413
- _yield$Promise$all = _context2.sent;
480
+ _yield$Promise$all = _context3.sent;
414
481
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
415
482
  originActionQueryResult = _yield$Promise$all2[0];
416
483
  originOneAccountQueryResult = _yield$Promise$all2[1];
@@ -418,15 +485,15 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
418
485
  originActionQueryResult: originActionQueryResult,
419
486
  originOneAccountQueryResult: originOneAccountQueryResult
420
487
  };
421
- return _context2.abrupt("return", {
488
+ return _context3.abrupt("return", {
422
489
  originActionQueryResult: originActionQueryResult,
423
490
  originOneAccountQueryResult: originOneAccountQueryResult
424
491
  });
425
492
  case 21:
426
493
  case "end":
427
- return _context2.stop();
494
+ return _context3.stop();
428
495
  }
429
- }, _callee2, this);
496
+ }, _callee3, this);
430
497
  }));
431
498
  function obtainData() {
432
499
  return _obtainData.apply(this, arguments);
@@ -441,9 +508,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
441
508
  }
442
509
  }, {
443
510
  key: "update",
444
- value: function update(_ref6) {
445
- var data = _ref6.data,
446
- paymentSessionData = _ref6.paymentSessionData;
511
+ value: function update(_ref7) {
512
+ var data = _ref7.data,
513
+ paymentSessionData = _ref7.paymentSessionData;
447
514
  var _parseSessionData = parseSessionData(paymentSessionData),
448
515
  _parseSessionData2 = _slicedToArray(_parseSessionData, 2),
449
516
  parseData = _parseSessionData2[0],
@@ -284,9 +284,34 @@ export interface AddressSubmitData {
284
284
  shippingId: string;
285
285
  actionFlag?: 'I' | 'U' | 'D';
286
286
  }
287
+ /**
288
+ * Amount info displayed on Apple Pay sheet (display only; actual charge amount is controlled by server)
289
+ */
290
+ export interface SubmitAmount {
291
+ /** Amount value, e.g. '10.99' */
292
+ value: string;
293
+ /** Currency code, e.g. 'USD' */
294
+ currency: string;
295
+ }
287
296
  export interface SubmitFuncParams {
288
297
  handleActions?: boolean;
289
298
  shippingInfo?: ShippingInfo;
299
+ /**
300
+ * Amount displayed on Apple Pay sheet. Only effective in Apple Pay scenario,
301
+ * used to show amount when launching the sheet first. Actual charge amount
302
+ * is determined by server. Ignored in non-Apple Pay scenarios.
303
+ */
304
+ applePayAmount?: SubmitAmount;
305
+ /**
306
+ * Pre-confirmation callback. Executed after user authorization but before actual charge,
307
+ * allowing merchant to create order at this point.
308
+ * - Apple Pay: invoked via event bridge after user FaceID/TouchID authorization on the sheet
309
+ * - Non-Apple Pay: invoked synchronously at SDK layer
310
+ * - Return true: proceed with charge
311
+ * - Return false: abort payment, returns MERCHANT_ABORT error code
312
+ * - Throw error: abort payment, returns BEFORE_CONFIRM_ERROR error code
313
+ */
314
+ onBeforeConfirm?: () => Promise<boolean>;
290
315
  }
291
316
  export interface SubmitServiceParams extends PaymentSubmitData {
292
317
  accountInfo: AuthSubmitData['accountInfo'];
@@ -119,6 +119,10 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
119
119
  */
120
120
 
121
121
  // export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
122
+
123
+ /**
124
+ * Amount info displayed on Apple Pay sheet (display only; actual charge amount is controlled by server)
125
+ */
122
126
  var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
123
127
  AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
124
128
  AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
@@ -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("dev-1780646303", "/ams-checkout.js"),
18
+ DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("dev-1781004142", "/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
  };
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.58.7"
8
+ "packageVersion": "7.58.8"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1780646303-dev.0",
3
+ "version": "0.0.1781004142-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {