@alipay/ams-checkout 2.0.14 → 2.0.17

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.
@@ -1,4 +1,4 @@
1
- import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../constant";
1
+ import { AMSPOPUP_PREFIX, ANIMATION_TIME, DEFAULT_IFRAME_COLOR_SCHEME, MOCKUP_ID, POPUPLOADING_ID } from "../constant";
2
2
  import { getDesignFontSize } from "../util";
3
3
  // CSS样式字符串
4
4
  var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-popup-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-popup-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n");
@@ -111,6 +111,7 @@ export var createModal = function createModal(_ref2) {
111
111
  iframe.style.border = 'none';
112
112
  iframe.style.width = '100%';
113
113
  iframe.style.height = '100%';
114
+ iframe.style.colorScheme = DEFAULT_IFRAME_COLOR_SCHEME;
114
115
  if (styleConfig) {
115
116
  modal.style.backgroundColor = styleConfig.backgroundColor;
116
117
  iframe.style.backgroundColor = styleConfig.backgroundColor;
@@ -310,6 +310,7 @@ export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
310
310
  export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
311
311
  export declare const INLINE_IMG_CLASSNAME = "inline-loading";
312
312
  export declare const AMSPOPUP_PREFIX = "ams-popup";
313
+ export declare const DEFAULT_IFRAME_COLOR_SCHEME = "light dark";
313
314
  export declare const LOADTIME_LIMIT = 15000;
314
315
  export declare const POPUP_LOADTIME_LOG_LIMIT = 3000;
315
316
  export declare const ANIMATION_TIME = 300;
@@ -318,6 +318,7 @@ export var LISTENER_PREFIX = '_ams_sdk_component_listener';
318
318
  export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
319
319
  export var INLINE_IMG_CLASSNAME = 'inline-loading';
320
320
  export var AMSPOPUP_PREFIX = 'ams-popup';
321
+ export var DEFAULT_IFRAME_COLOR_SCHEME = 'light dark';
321
322
  export var LOADTIME_LIMIT = 15000;
322
323
  export var POPUP_LOADTIME_LOG_LIMIT = 3000;
323
324
  export var ANIMATION_TIME = 300;
@@ -5,7 +5,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- import { EVENT } from "../../../../constant";
8
+ import { EVENT, DEFAULT_IFRAME_COLOR_SCHEME } from "../../../../constant";
9
9
  import { ServiceProvider } from "./../../../../foundation/service";
10
10
  import { isElementPC, isElementPad } from "../util";
11
11
  import { DisplayTypeEnum, PlatformEnum, ProductSceneEnum } from "./../../../../types";
@@ -49,7 +49,8 @@ export var ContainerController = /*#__PURE__*/function () {
49
49
  selector: selector,
50
50
  appendAliasContainerId: true,
51
51
  iframeStyle: {
52
- display: 'block'
52
+ display: 'block',
53
+ colorScheme: DEFAULT_IFRAME_COLOR_SCHEME
53
54
  }
54
55
  }, processor.generateIframeSrc({
55
56
  link: iframesSrcLink,
@@ -132,14 +132,18 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
132
132
  });
133
133
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
134
134
  this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
135
+ var _this2$obtainDataRes;
135
136
  var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
136
137
  paymentSessionObj = _this2$elementContain.paymentSessionObj,
137
138
  paymentSession = _this2$elementContain.paymentSession;
139
+ // SDK shipping takes priority; fall back to sdkAction.query shippingInfo (from createSession)
140
+ var shipping = (data === null || data === void 0 ? void 0 : data.shipping) || ((_this2$obtainDataRes = _this2.obtainDataRes) === null || _this2$obtainDataRes === void 0 || (_this2$obtainDataRes = _this2$obtainDataRes.originActionQueryResult) === null || _this2$obtainDataRes === void 0 ? void 0 : _this2$obtainDataRes.shippingInfo);
138
141
  var applePayService = new ApplePaySdk({
139
142
  paymentSessionData: paymentSession,
140
143
  parseData: paymentSessionObj,
141
144
  logger: logger,
142
- env: _this2.options.env.environment
145
+ env: _this2.options.env.environment,
146
+ shipping: shipping
143
147
  });
144
148
  applePayService.startPay().then(function (res) {
145
149
  _this2.eventCenter.dispatchToApp({
@@ -272,9 +276,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
272
276
  LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
273
277
  _queryParse = queryParse(this.getElementUrl()), appType = _queryParse.appType;
274
278
  terminalType = isElementPad() ? 'WEB' : appType ? 'APP' : isElementPC() ? 'WEB' : 'WAP';
279
+ /**
280
+ * 生成查询支付动作的Promise
281
+ * 该方法负责向后端发起sdkAction查询请求,获取支付相关的动作配置信息。
282
+ * 支持本地mock模式用于开发调试,生产环境会发起真实的HTTP请求。
283
+ * @returns {Promise<CashierSdkActionQueryResult>} 返回支付动作查询结果的Promise
284
+ */
275
285
  generateActionQueryPromise = function generateActionQueryPromise() {
276
286
  return new Promise(function (resolve, reject) {
277
287
  var _displayInfo$merchant;
288
+ // 本地mock模式:直接返回预设的sdkAction,用于开发调试
278
289
  if (LOCAL_MOCK) {
279
290
  setTimeout(function () {
280
291
  resolve(sdkAction);
@@ -294,12 +305,18 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
294
305
  isUserPreferredLocale: true
295
306
  }
296
307
  };
308
+
309
+ // 可选参数:商户指定的储值卡信息
297
310
  if (displayInfo !== null && displayInfo !== void 0 && (_displayInfo$merchant = displayInfo.merchantAppointParam) !== null && _displayInfo$merchant !== void 0 && _displayInfo$merchant.storedCard) {
298
311
  sdkRequestData.merchantAppointParam = displayInfo.merchantAppointParam;
299
312
  }
313
+
314
+ // 可选参数:控制支付完成后是否重定向
300
315
  if (Object.prototype.hasOwnProperty.call(displayInfo, 'notRedirectAfterComplete')) {
301
316
  sdkRequestData.notRedirectAfterComplete = displayInfo.notRedirectAfterComplete;
302
317
  }
318
+
319
+ // 发起支付动作查询请求
303
320
  requestService.request(sdkRequestData, {
304
321
  env: environment,
305
322
  envInfo: {
@@ -309,8 +326,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
309
326
  hostSign: hostSign,
310
327
  timeout: 300000,
311
328
  // TODO dev环境接口超时
312
- 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
329
+ 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query',
330
+ // 避免被第三方库或axios拦截器覆写,降低请求被错误处理的风险
331
+ headers: {
332
+ 'Content-Type': 'application/json' // 手动指定Content-Type为application/json,确保符合MGW预期
333
+ }
313
334
  }).then(function (result) {
335
+ // 记录请求结果日志
314
336
  if (!result.success) {
315
337
  _this3.getLogger().logError({
316
338
  title: 'sdk_event_sdkQuery_failed'
@@ -329,6 +351,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
329
351
  }
330
352
  resolve(result);
331
353
  }, function (e) {
354
+ // 请求异常处理:记录错误日志并reject
332
355
  reject(e);
333
356
  _this3.getLogger().logError({
334
357
  title: 'sdk_event_sdkQuery_failed'
@@ -339,19 +362,28 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
339
362
  });
340
363
  });
341
364
  };
365
+ /**
366
+ * 生成查询用户账户信息的Promise
367
+ * 该方法负责向后端发起oneAccount查询请求,获取用户的账户相关信息(如会员等级、权益等)。
368
+ * 支持本地mock模式用于开发调试,生产环境会发起真实的HTTP请求。
369
+ * @returns {Promise<AccountQueryResult>} 返回账户信息查询结果的Promise
370
+ */
342
371
  generateOneAccountQueryPromise = function generateOneAccountQueryPromise() {
343
372
  return new Promise(function (resolve, reject) {
373
+ // 本地mock模式:直接返回预设的oneAccount数据,用于开发调试
344
374
  if (LOCAL_MOCK) {
345
375
  setTimeout(function () {
346
376
  resolve(oneAccount);
347
377
  }, 100);
348
378
  return;
349
379
  }
380
+
381
+ // 发起账户信息查询请求
350
382
  requestService.request({
351
383
  paymentSessionConfig: paymentSessionConfig,
352
384
  paymentSessionData: paymentSession,
353
385
  accountInfo: {
354
- email: ''
386
+ email: '' // 邮箱字段预留,当前传空字符串
355
387
  }
356
388
  }, {
357
389
  env: environment,
@@ -361,10 +393,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
361
393
  },
362
394
  timeout: 300000,
363
395
  // TODO dev环境接口超时
364
- 'Operation-Type': 'com.ipay.iexpfront.one.account.query'
396
+ 'Operation-Type': 'com.ipay.iexpfront.one.account.query',
397
+ // 避免被第三方库或axios拦截器覆写,降低请求被错误处理的风险
398
+ headers: {
399
+ 'Content-Type': 'application/json' // 手动指定Content-Type为application/json,确保符合MGW预期
400
+ }
365
401
  }).then(function (result) {
402
+ // 直接透传查询结果,不做额外处理
366
403
  resolve(result);
367
404
  }, function (e) {
405
+ // 请求异常处理:直接reject错误,由调用方处理
368
406
  reject(e);
369
407
  });
370
408
  });
@@ -174,6 +174,7 @@ export interface PaymentMountOptions extends BaseMountOptions {
174
174
  'state-success': string;
175
175
  'state-info': string;
176
176
  'state-marketing': string;
177
+ 'state-conventional': string;
177
178
  'radius-backup': string;
178
179
  'radius-module': string;
179
180
  'radius-component': string;
@@ -373,7 +374,7 @@ interface IUserName {
373
374
  }
374
375
  type Shippings = ShippingsItem[];
375
376
  type IPaymentMethods = IPaymentMethod[];
376
- interface CKPShipping {
377
+ export interface CKPShipping {
377
378
  shippingRateId?: string;
378
379
  shippingRateData?: ShippingRateData;
379
380
  shippingAddress: ShippingAddress;
@@ -1,4 +1,4 @@
1
- import { COMPONENT_CONTAINER_ID } from "../../../constant";
1
+ import { COMPONENT_CONTAINER_ID, DEFAULT_IFRAME_COLOR_SCHEME } from "../../../constant";
2
2
 
3
3
  /**
4
4
  * @author 谦彧 <zhangmian.zm@alipay.com>
@@ -14,6 +14,7 @@ export var createPreloadIframe = function createPreloadIframe(containerId) {
14
14
  iframe.style.border = none;
15
15
  iframe.style.opacity = '0';
16
16
  iframe.style.overflow = 'hidden';
17
+ iframe.style.colorScheme = DEFAULT_IFRAME_COLOR_SCHEME;
17
18
  return iframe;
18
19
  };
19
20
  export var createIframe = function createIframe(containerId) {
@@ -27,6 +28,7 @@ export var createIframe = function createIframe(containerId) {
27
28
  iframe.style.border = none;
28
29
  iframe.style.opacity = none;
29
30
  iframe.style.overflow = 'hidden';
31
+ iframe.style.colorScheme = DEFAULT_IFRAME_COLOR_SCHEME;
30
32
  return iframe;
31
33
  };
32
34
  export var startSizeChangeAnim = function startSizeChangeAnim(target, height, animationStyleId) {
@@ -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.14", "/ams-checkout.js"),
18
+ DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("2.0.17", "/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
  };
@@ -1,4 +1,5 @@
1
1
  import { type EventPayload, type IPaymentSessionMetaData } from '../../types';
2
+ import type { CKPShipping } from '../../core/component/element/type';
2
3
  import { Logger } from '../../util/logger';
3
4
  export type IChannelBehavior = {
4
5
  usePaymentSessionAsQueryResult: boolean;
@@ -32,11 +33,13 @@ export declare class ApplePaySdk {
32
33
  private paymentStatus;
33
34
  private logger;
34
35
  private env;
35
- constructor({ paymentSessionData, parseData, logger, env, }: {
36
+ private shipping?;
37
+ constructor({ paymentSessionData, parseData, logger, env, shipping, }: {
36
38
  paymentSessionData: string;
37
39
  parseData: IPaymentSessionMetaData;
38
40
  logger: Logger;
39
41
  env?: string;
42
+ shipping?: CKPShipping;
40
43
  });
41
44
  startPay(): Promise<unknown>;
42
45
  begin(): Promise<unknown>;
@@ -136,7 +136,8 @@ export var ApplePaySdk = /*#__PURE__*/function () {
136
136
  parseData = _ref.parseData,
137
137
  logger = _ref.logger,
138
138
  _ref$env = _ref.env,
139
- env = _ref$env === void 0 ? EnvironmentEnum.prod : _ref$env;
139
+ env = _ref$env === void 0 ? EnvironmentEnum.prod : _ref$env,
140
+ shipping = _ref.shipping;
140
141
  _classCallCheck(this, ApplePaySdk);
141
142
  _defineProperty(this, "APPLESDKURL", 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js');
142
143
  _defineProperty(this, "session", null);
@@ -148,10 +149,12 @@ export var ApplePaySdk = /*#__PURE__*/function () {
148
149
  _defineProperty(this, "paymentStatus", void 0);
149
150
  _defineProperty(this, "logger", void 0);
150
151
  _defineProperty(this, "env", void 0);
152
+ _defineProperty(this, "shipping", void 0);
151
153
  this.paymentSessionData = paymentSessionData;
152
154
  this.parseData = parseData;
153
155
  this.env = env;
154
156
  this.logger = logger;
157
+ this.shipping = shipping;
155
158
  }
156
159
  _createClass(ApplePaySdk, [{
157
160
  key: "startPay",
@@ -346,7 +349,8 @@ export var ApplePaySdk = /*#__PURE__*/function () {
346
349
  paymentFactors: params,
347
350
  paymentMethod: {
348
351
  paymentMethodType: 'APPLEPAY'
349
- }
352
+ },
353
+ shipping: this.shipping
350
354
  };
351
355
  _context4.t2 = this.env;
352
356
  _context4.next = 6;
@@ -1384,12 +1384,13 @@ var ComponentApp = /*#__PURE__*/function () {
1384
1384
  });
1385
1385
  }
1386
1386
  if ((data === null || data === void 0 || (_data$context6 = data.context) === null || _data$context6 === void 0 ? void 0 : _data$context6.event) === EVENT.getApplePayToken.name) {
1387
- var _this$_renderParams18, _this$_renderParams19;
1387
+ var _this$_renderParams18, _this$_renderParams19, _data$context7;
1388
1388
  var applePayService = new ApplePaySdk({
1389
1389
  paymentSessionData: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.sessionData,
1390
1390
  parseData: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.paymentSessionMetaData,
1391
1391
  logger: this.AMSSDK.logger,
1392
- env: this.AMSSDK.options.env.environment
1392
+ env: this.AMSSDK.options.env.environment,
1393
+ shipping: data === null || data === void 0 || (_data$context7 = data.context) === null || _data$context7 === void 0 || (_data$context7 = _data$context7.data) === null || _data$context7 === void 0 ? void 0 : _data$context7.shipping
1393
1394
  });
1394
1395
  applePayService.startPay().then(function (res) {
1395
1396
  _this7.dispatchToApp({
@@ -1435,11 +1436,11 @@ var ComponentApp = /*#__PURE__*/function () {
1435
1436
  key: "logEventCallback",
1436
1437
  value: function logEventCallback(data, title) {
1437
1438
  if (data.context.event === EVENT.eventCallback.name) {
1438
- var _data$context8;
1439
+ var _data$context9;
1439
1440
  var callbackData = '';
1440
1441
  try {
1441
- var _data$context7;
1442
- callbackData = JSON.stringify((data === null || data === void 0 || (_data$context7 = data.context) === null || _data$context7 === void 0 ? void 0 : _data$context7.data) || '');
1442
+ var _data$context8;
1443
+ callbackData = JSON.stringify((data === null || data === void 0 || (_data$context8 = data.context) === null || _data$context8 === void 0 ? void 0 : _data$context8.data) || '');
1443
1444
  } catch (e) {
1444
1445
  console.error(e);
1445
1446
  }
@@ -1447,7 +1448,7 @@ var ComponentApp = /*#__PURE__*/function () {
1447
1448
  title: title
1448
1449
  }, {
1449
1450
  callbackData: callbackData,
1450
- callbackId: (data === null || data === void 0 || (_data$context8 = data.context) === null || _data$context8 === void 0 ? void 0 : _data$context8.eventCallbackId) || ''
1451
+ callbackId: (data === null || data === void 0 || (_data$context9 = data.context) === null || _data$context9 === void 0 ? void 0 : _data$context9.eventCallbackId) || ''
1451
1452
  }).send();
1452
1453
  }
1453
1454
  }
@@ -572,6 +572,7 @@ export interface CashierSubmitPayRequest {
572
572
  paymentMethodDetail?: Record<string, any>;
573
573
  category?: string;
574
574
  };
575
+ shipping?: import('../core/component/element/type').CKPShipping;
575
576
  }
576
577
  export interface CashierSubmitPayRequest {
577
578
  paymentMethodType?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "2.0.14",
3
+ "version": "2.0.17",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "exports": {
@@ -58,7 +58,13 @@
58
58
  "generateApi": "intl-oneapi generate && prettier --write src/modern/sdk/oneapi",
59
59
  "lint": "eslint ./src",
60
60
  "test": "jest --coverage --silent",
61
- "tsc": "tsc --noEmit"
61
+ "tsc": "tsc --noEmit",
62
+ "code-review-biz": "node .agents/skills/code-review-biz/scripts/code-review-cli.js",
63
+ "code-review-biz:mr": "node .agents/skills/code-review-biz/scripts/code-review-cli.js --url=",
64
+ "code-review-biz:push": "node .agents/skills/code-review-biz/scripts/code-review-cli.js --mode=pre-push",
65
+ "code-review-biz:init": "node .agents/skills/code-review-biz/scripts/lib/init.js init",
66
+ "code-review-biz:update": "node .agents/skills/code-review-biz/scripts/lib/init.js update",
67
+ "prepare": "husky install || true"
62
68
  },
63
69
  "commitlint": {
64
70
  "extends": [
package/types.d.ts CHANGED
@@ -208,18 +208,8 @@ export declare class AntomSDK extends BaseElementsFactory {
208
208
  * @throws {AntomSDKError} 当无法找到有效的主元素时抛出错误
209
209
  */
210
210
  private extractMainElement;
211
- confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult | {
212
- code: string;
213
- message: string;
214
- status: string;
215
- userCancel3D: boolean;
216
- }>;
217
- confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult | {
218
- code: string;
219
- message: string;
220
- userCancel3D: boolean;
221
- status: string;
222
- }>;
211
+ confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult>;
212
+ confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult>;
223
213
  }
224
214
 
225
215
  /**
@@ -233,7 +223,7 @@ export declare class AntomSDKError extends AntomError<AntomSDKErrorCodes> {
233
223
  name: string;
234
224
  }
235
225
 
236
- declare const AntomSDKErrorCodes: {
226
+ export declare const AntomSDKErrorCodes: {
237
227
  /**
238
228
  * @description 找不到主元素
239
229
  */
@@ -246,6 +236,26 @@ declare const AntomSDKErrorCodes: {
246
236
  * @description WebApp 初始化超时
247
237
  */
248
238
  readonly SDK_LAUNCH_PAYMENT_APP_ERROR: "SDK_LAUNCH_PAYMENT_APP_ERROR";
239
+ /**
240
+ * @description 参数非法,缺少必填参数或参数值不合法
241
+ */
242
+ readonly PARAM_INVALID: "PARAM_INVALID";
243
+ /**
244
+ * @description channelClientId 查询接口超时
245
+ */
246
+ readonly CHANNEL_CLIENT_ID_QUERY_TIMEOUT: "CHANNEL_CLIENT_ID_QUERY_TIMEOUT";
247
+ /**
248
+ * @description channelClientId 查询返回 success=true 但缺少 channelClientId
249
+ */
250
+ readonly CHANNEL_CLIENT_ID_MISSING: "CHANNEL_CLIENT_ID_MISSING";
251
+ /**
252
+ * @description channelClientId 查询失败(success=false 或其他异常)
253
+ */
254
+ readonly CHANNEL_CLIENT_ID_QUERY_FAILED: "CHANNEL_CLIENT_ID_QUERY_FAILED";
255
+ /**
256
+ * @description channelClientId 查询失败(请求异常,如网络错误、服务器错误等)
257
+ */
258
+ readonly CHANNEL_CLIENT_ID_QUERY_ERROR: "CHANNEL_CLIENT_ID_QUERY_ERROR";
249
259
  readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
250
260
  readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
251
261
  readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
@@ -275,9 +285,9 @@ declare const AntomSDKErrorCodes: {
275
285
  readonly INVALID_REDIRECT_URL: "INVALID_REDIRECT_URL";
276
286
  };
277
287
 
278
- declare type AntomSDKErrorCodes = typeof AntomSDKErrorCodes[keyof typeof AntomSDKErrorCodes];
288
+ export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeof AntomSDKErrorCodes];
279
289
 
280
- export declare type AntomTheme = "default" | "agateGreen" | "night" | "nostalgicGray" | "gamingPurple" | "cherryBlossomPink" | "light";
290
+ export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
281
291
 
282
292
  declare interface APICallbackOptions {
283
293
  requestType: 'fetch' | 'xhr';
@@ -23771,14 +23781,21 @@ export declare type SubmitResult = {
23771
23781
  * 查询到的状态
23772
23782
  */
23773
23783
  status: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
23784
+ /* Excluded from this release type: code */
23785
+ /* Excluded from this release type: message */
23774
23786
  /**
23775
- * 查询到的结果码或者错误码, SUCCESS和CANCELLED无该字段
23776
- */
23777
- code?: string;
23778
- /**
23779
- * 查询到的结果消息, 在SUCCESS和CANCELLED无该字段
23787
+ * @description 对结果的详细结果码和结果信息,在status为SUCCESS时无该字段
23780
23788
  */
23781
- message?: string;
23789
+ error?: {
23790
+ /**
23791
+ * 查询到的结果码或者错误码
23792
+ */
23793
+ code?: string;
23794
+ /**
23795
+ * 查询到的结果消息
23796
+ */
23797
+ message?: string;
23798
+ };
23782
23799
  /**
23783
23800
  * 是否是用户手动取消3D
23784
23801
  */
@@ -235,18 +235,8 @@ export declare class AntomSDK extends BaseElementsFactory {
235
235
  * @throws {AntomSDKError} 当无法找到有效的主元素时抛出错误
236
236
  */
237
237
  private extractMainElement;
238
- confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult | {
239
- code: string;
240
- message: string;
241
- status: string;
242
- userCancel3D: boolean;
243
- }>;
244
- confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult | {
245
- code: string;
246
- message: string;
247
- userCancel3D: boolean;
248
- status: string;
249
- }>;
238
+ confirmCardSetup(options: ConfirmCardSetupOptions): Promise<SubmitResult>;
239
+ confirmPayment(options: ConfirmPaymentOptions): Promise<SubmitResult>;
250
240
  }
251
241
 
252
242
  /**
@@ -260,7 +250,7 @@ export declare class AntomSDKError extends AntomError<AntomSDKErrorCodes> {
260
250
  name: string;
261
251
  }
262
252
 
263
- declare const AntomSDKErrorCodes: {
253
+ export declare const AntomSDKErrorCodes: {
264
254
  /**
265
255
  * @description 找不到主元素
266
256
  */
@@ -273,6 +263,26 @@ declare const AntomSDKErrorCodes: {
273
263
  * @description WebApp 初始化超时
274
264
  */
275
265
  readonly SDK_LAUNCH_PAYMENT_APP_ERROR: "SDK_LAUNCH_PAYMENT_APP_ERROR";
266
+ /**
267
+ * @description 参数非法,缺少必填参数或参数值不合法
268
+ */
269
+ readonly PARAM_INVALID: "PARAM_INVALID";
270
+ /**
271
+ * @description channelClientId 查询接口超时
272
+ */
273
+ readonly CHANNEL_CLIENT_ID_QUERY_TIMEOUT: "CHANNEL_CLIENT_ID_QUERY_TIMEOUT";
274
+ /**
275
+ * @description channelClientId 查询返回 success=true 但缺少 channelClientId
276
+ */
277
+ readonly CHANNEL_CLIENT_ID_MISSING: "CHANNEL_CLIENT_ID_MISSING";
278
+ /**
279
+ * @description channelClientId 查询失败(success=false 或其他异常)
280
+ */
281
+ readonly CHANNEL_CLIENT_ID_QUERY_FAILED: "CHANNEL_CLIENT_ID_QUERY_FAILED";
282
+ /**
283
+ * @description channelClientId 查询失败(请求异常,如网络错误、服务器错误等)
284
+ */
285
+ readonly CHANNEL_CLIENT_ID_QUERY_ERROR: "CHANNEL_CLIENT_ID_QUERY_ERROR";
276
286
  readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
277
287
  readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
278
288
  readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
@@ -302,9 +312,9 @@ declare const AntomSDKErrorCodes: {
302
312
  readonly INVALID_REDIRECT_URL: "INVALID_REDIRECT_URL";
303
313
  };
304
314
 
305
- declare type AntomSDKErrorCodes = typeof AntomSDKErrorCodes[keyof typeof AntomSDKErrorCodes];
315
+ export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeof AntomSDKErrorCodes];
306
316
 
307
- export declare type AntomTheme = "default" | "agateGreen" | "night" | "nostalgicGray" | "gamingPurple" | "cherryBlossomPink" | "light";
317
+ export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
308
318
 
309
319
  declare interface APICallbackOptions {
310
320
  requestType: 'fetch' | 'xhr';
@@ -24099,13 +24109,30 @@ export declare type SubmitResult = {
24099
24109
  */
24100
24110
  status: 'SUCCESS' | 'CANCELLED' | 'FAIL' | 'PROCESSING';
24101
24111
  /**
24102
- * 查询到的结果码或者错误码, 在SUCCESS和CANCELLED无该字段
24112
+ * 查询到的结果码或者错误码, 在SUCCESS无该字段
24113
+ * @deprecated 已废弃请读取error中的code
24114
+ * @internal
24103
24115
  */
24104
24116
  code?: string;
24105
24117
  /**
24106
- * 查询到的结果消息, 在SUCCESS和CANCELLED无该字段
24118
+ * 查询到的结果消息, 在SUCCESS无该字段
24119
+ * @deprecated 已废弃请读取error中的message
24120
+ * @internal
24107
24121
  */
24108
24122
  message?: string;
24123
+ /**
24124
+ * @description 对结果的详细结果码和结果信息,在status为SUCCESS时无该字段
24125
+ */
24126
+ error?: {
24127
+ /**
24128
+ * 查询到的结果码或者错误码
24129
+ */
24130
+ code?: string;
24131
+ /**
24132
+ * 查询到的结果消息
24133
+ */
24134
+ message?: string;
24135
+ };
24109
24136
  /**
24110
24137
  * 是否是用户手动取消3D
24111
24138
  */