@alipay/ams-checkout 0.0.1779094014-dev.2 → 0.0.1779094014-dev.21

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.
Files changed (47) hide show
  1. package/ams-checkout.js +3 -3
  2. package/dist/ams-checkout.min.js +1 -1
  3. package/dist/ams-checkout.min.js.map +1 -1
  4. package/esm/component/popupWindow.style.js +2 -1
  5. package/esm/config/index.d.ts +7 -0
  6. package/esm/config/index.js +2 -2
  7. package/esm/constant/index.d.ts +1 -0
  8. package/esm/constant/index.js +1 -0
  9. package/esm/core/component/element/elementContainerService/containerService.js +3 -2
  10. package/esm/core/component/element/elementProcessor/paymentProcessor.js +42 -4
  11. package/esm/core/component/element/index.d.ts +3 -0
  12. package/esm/core/component/element/index.js +13 -8
  13. package/esm/core/component/element/modernElementController/adapter.d.ts +5 -5
  14. package/esm/core/component/element/modernElementController/adapter.js +23 -19
  15. package/esm/core/component/element/modernElementController/index.d.ts +43 -13
  16. package/esm/core/component/element/modernElementController/index.js +585 -263
  17. package/esm/core/component/element/type.d.ts +6 -18
  18. package/esm/foundation/service/container/utils.js +3 -1
  19. package/esm/modern/global.d.ts +3 -0
  20. package/esm/modern/index.d.ts +5 -1
  21. package/esm/modern/index.js +1 -51
  22. package/esm/modern/tools.js +1 -0
  23. package/esm/plugin/component/channel.d.ts +4 -1
  24. package/esm/plugin/component/channel.js +6 -2
  25. package/esm/plugin/component/index.js +7 -6
  26. package/esm/tsdoc-metadata.json +1 -1
  27. package/esm/types/index.d.ts +1 -0
  28. package/esm/util/logger.js +1 -2
  29. package/package.json +23 -10
  30. package/types.d.ts +896 -71
  31. package/types.untrimmed.d.ts +1203 -113
  32. package/esm/modern/oneapi/iexpfront/PaymentSessionService.d.ts +0 -23
  33. package/esm/modern/oneapi/iexpfront/PaymentSessionService.js +0 -55
  34. package/esm/modern/oneapi/iexpfront/definitions.d.ts +0 -3656
  35. package/esm/modern/oneapi/iexpfront/definitions.js +0 -1
  36. package/esm/modern/tools/AntomSDKError.d.ts +0 -47
  37. package/esm/modern/tools/AntomSDKError.js +0 -47
  38. package/esm/modern/tools/buildPageUrl.d.ts +0 -4
  39. package/esm/modern/tools/buildPageUrl.js +0 -19
  40. package/esm/modern/tools/getDevReqConfig.d.ts +0 -2
  41. package/esm/modern/tools/getDevReqConfig.js +0 -16
  42. package/esm/modern/tools/getLocaleFromRenderData.d.ts +0 -6
  43. package/esm/modern/tools/getLocaleFromRenderData.js +0 -20
  44. package/esm/modern/tools/getMetaData.d.ts +0 -102
  45. package/esm/modern/tools/getMetaData.js +0 -7
  46. package/esm/modern/tools/openModal.d.ts +0 -20
  47. package/esm/modern/tools/openModal.js +0 -221
@@ -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;
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
+ * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
+ */
1
8
  export declare const marmotMap: Record<string, string>;
2
9
  export declare const marmotConfigMap: Record<string, string>;
3
10
  export declare const v2AppMarmotMap: Record<string, string>;
@@ -5,7 +5,7 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
- import json from "../../package.json";
8
+
9
9
  export var marmotMap = {
10
10
  dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
11
11
  sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
@@ -30,7 +30,7 @@ export var v2AppMarmotMap = {
30
30
  light_sandbox: 'https://checkout.antom.com',
31
31
  prod: 'https://checkout.antom.com'
32
32
  };
33
- export var sdkVersion = json.version;
33
+ export var sdkVersion = "0.0.1779094014-dev.21";
34
34
 
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
@@ -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
  });
@@ -3,6 +3,9 @@ export declare class ElementComponent {
3
3
  private options;
4
4
  private controller;
5
5
  constructor(options: IElementOptions);
6
+ /**
7
+ * @deprecated 不要使用,internal experiment方法
8
+ */
6
9
  updatePayment(paymentSessionData: any): Promise<boolean>;
7
10
  mount(renderOptions: PaymentMountOptions, sdkSelector: string): Promise<import("./type").ICommonApiResponse>;
8
11
  validateFields(): Promise<{
@@ -1,16 +1,16 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
8
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
10
  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; }
11
11
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
12
  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); }
13
- import { getMetaData } from "../../../modern/tools/getMetaData";
13
+ import { adjustSessionData, isElements2 } from "../../../modern/tools";
14
14
  import ElementController from "./elementController";
15
15
  import { ModernElementController } from "./modernElementController";
16
16
  import { InvalidElementConfigError } from "./type";
@@ -27,17 +27,21 @@ export var ElementComponent = /*#__PURE__*/function () {
27
27
  this.options = formatElementOption(options);
28
28
 
29
29
  // 核心分流逻辑
30
- var parseData = getMetaData(options.sessionData);
31
- if (parseData !== null && parseData !== void 0 && parseData.modernWeb) {
32
- console.log('新payment');
33
- this.controller = new ModernElementController(this.options);
30
+ if (isElements2(options.sessionData)) {
31
+ this.controller = new ModernElementController(_objectSpread(_objectSpread({}, this.options), {}, {
32
+ sessionData: adjustSessionData(this.options.sessionData)
33
+ }));
34
34
  } else {
35
35
  this.controller = new ElementController(this.options);
36
36
  }
37
37
  }
38
+
39
+ /**
40
+ * @deprecated 不要使用,internal experiment方法
41
+ */
38
42
  _createClass(ElementComponent, [{
39
43
  key: "updatePayment",
40
- value: function () {
44
+ value: (function () {
41
45
  var _updatePayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentSessionData) {
42
46
  return _regeneratorRuntime().wrap(function _callee$(_context) {
43
47
  while (1) switch (_context.prev = _context.next) {
@@ -57,6 +61,7 @@ export var ElementComponent = /*#__PURE__*/function () {
57
61
  // mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
58
62
  // mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
59
63
  // mount(renderOptions: PaymentMountOptions, sdkSelector: string);
64
+ )
60
65
  }, {
61
66
  key: "mount",
62
67
  value: function mount(renderOptions, sdkSelector) {
@@ -1,8 +1,8 @@
1
- import type { ErrorPayload } from '@antintl/opensdk-core';
2
- import type { IPaymentApiResponse } from '../type';
1
+ import type { IMerchantAppointParam } from "../../../../types";
2
+ import type { IPaymentApiResponse, PaymentMountOptions } from '../type';
3
3
  import { EventCallbackCode } from '../type';
4
- import type { SubmitResult } from "../../../../modern/sdk/types";
5
- export declare function adaptSubmitResult(result: SubmitResult): IPaymentApiResponse;
4
+ import type { PaymentSubmitResult, ErrorPayload } from "../../../../modern/tools";
5
+ export declare function adaptSubmitResult(result: PaymentSubmitResult): IPaymentApiResponse;
6
6
  export declare function adaptErrorToEventCallback(error: ErrorPayload): {
7
7
  code: EventCallbackCode;
8
8
  message: string;
@@ -16,4 +16,4 @@ export declare function adaptErrorToEventCallback(error: ErrorPayload): {
16
16
  * 3. card.showBrandIcon → displaySetting.showCardBrandIcon
17
17
  * 4. layout: 直接透传
18
18
  */
19
- export declare function adaptAppearance(appearance?: any): any;
19
+ export declare function adaptAppearance(appearance?: PaymentMountOptions['appearance'], merchantAppointParam?: IMerchantAppointParam): any;
@@ -8,11 +8,18 @@ import { EventCallbackCode } from "../type";
8
8
  export function adaptSubmitResult(result) {
9
9
  return {
10
10
  status: result.status || 'FAIL',
11
- error: result.status === 'FAIL' || result.code ? {
12
- code: result.code || 'UNKNOWN_ERROR',
13
- message: result.message || ''
11
+ error: result.error ? {
12
+ code: result.error.code,
13
+ message: result.error.message
14
14
  } : undefined,
15
- userCanceled3D: result.userCanceled3D
15
+ userCanceled3D: result.userCanceled3D,
16
+ session: result.paymentSession ? {
17
+ nextAction: {
18
+ applinkUrl: result.paymentSession.returnAppUrl,
19
+ normalUrl: result.paymentSession.returnUrl,
20
+ schemeUrl: result.paymentSession.returnAppScheme
21
+ }
22
+ } : undefined
16
23
  };
17
24
  }
18
25
  export function adaptErrorToEventCallback(error) {
@@ -22,16 +29,6 @@ export function adaptErrorToEventCallback(error) {
22
29
  };
23
30
  }
24
31
 
25
- /**
26
- * 老架构 theme (kebab-case) → 新架构 theme (camelCase) 映射表
27
- */
28
- var THEME_MAP = {
29
- 'nostalgic-gray': 'nostalgicGray',
30
- 'cherry-blossom-pink': 'cherryBlossomPink',
31
- 'gaming-purple': 'gamingPurple',
32
- 'agate-green': 'agateGreen'
33
- };
34
-
35
32
  /**
36
33
  * 将老架构的 appearance 格式转换为新架构格式
37
34
  *
@@ -41,14 +38,14 @@ var THEME_MAP = {
41
38
  * 3. card.showBrandIcon → displaySetting.showCardBrandIcon
42
39
  * 4. layout: 直接透传
43
40
  */
44
- export function adaptAppearance(appearance) {
45
- var _appearance$card;
41
+ export function adaptAppearance(appearance, merchantAppointParam) {
42
+ var _appearance$card, _merchantAppointParam, _appearance$accordion, _appearance$card2;
46
43
  if (!appearance) return undefined;
47
44
  var result = {};
48
45
 
49
46
  // Theme mapping: kebab-case → camelCase
50
47
  if (appearance.theme) {
51
- result.theme = THEME_MAP[appearance.theme] || appearance.theme;
48
+ result.theme = appearance.theme;
52
49
  }
53
50
 
54
51
  // Variables: 直接透传
@@ -58,9 +55,15 @@ export function adaptAppearance(appearance) {
58
55
  result.variables = filtered;
59
56
  }
60
57
  }
58
+ result.displaySetting = {
59
+ showCardBrandIcon: !!((_appearance$card = appearance.card) !== null && _appearance$card !== void 0 && _appearance$card.showBrandIcon),
60
+ showCardCVV: !!(merchantAppointParam !== null && merchantAppointParam !== void 0 && (_merchantAppointParam = merchantAppointParam.storedCard) !== null && _merchantAppointParam !== void 0 && _merchantAppointParam.needCVV),
61
+ showPaymentMethodListWhenSingleOption: (merchantAppointParam === null || merchantAppointParam === void 0 ? void 0 : merchantAppointParam.singleOption) === 'list',
62
+ showRadioWhenAccordionLayout: !!((_appearance$accordion = appearance.accordion) !== null && _appearance$accordion !== void 0 && _appearance$accordion.showRadio)
63
+ };
61
64
 
62
65
  // card.showBrandIcon → displaySetting.showCardBrandIcon
63
- if (((_appearance$card = appearance.card) === null || _appearance$card === void 0 ? void 0 : _appearance$card.showBrandIcon) !== undefined) {
66
+ if (((_appearance$card2 = appearance.card) === null || _appearance$card2 === void 0 ? void 0 : _appearance$card2.showBrandIcon) !== undefined) {
64
67
  result.displaySetting = {
65
68
  showCardBrandIcon: appearance.card.showBrandIcon
66
69
  };
@@ -68,7 +71,8 @@ export function adaptAppearance(appearance) {
68
71
 
69
72
  // Layout: 直接透传
70
73
  if (appearance.layout) {
71
- result.layout = _objectSpread({}, appearance.layout);
74
+ var _appearance$layout$ty;
75
+ result.layout = ((_appearance$layout$ty = appearance.layout.type) === null || _appearance$layout$ty === void 0 ? void 0 : _appearance$layout$ty.toLowerCase()) || 'accordion';
72
76
  }
73
77
  return Object.keys(result).length > 0 ? result : undefined;
74
78
  }
@@ -1,26 +1,27 @@
1
- import { IElementController, IElementOptions, ICommonApiResponse, IPaymentApiResponse, PaymentMountOptions, SubmitFuncParams, EVENTNAME, EventDataMap } from '../type';
1
+ import type { IElementController, IElementOptions, ICommonApiResponse, IPaymentApiResponse, PaymentMountOptions, SubmitFuncParams, EventDataMap } from '../type';
2
+ import { EVENTNAME } from '../type';
2
3
  /**
3
4
  * ModernElementController 使用 opensdk-core 的 HostBridge 实现新架构通信。
4
5
  *
5
6
  * Mount 流程(正确):
6
7
  * 1. setup() — 解析 sessionData 获取 metaData,准备 HANDSHAKE 配置
7
- * 2. 创建 iframe,设置 src
8
- * 3. iframe 添加到容器
9
- * 4. 监听 READY_HANDSHAKE → setTarget(iframe.contentWindow) send(HANDSHAKE, mergedConfig)
10
- * 5. 等待 HANDSHAKE_ACK 设置 status = 'ready'
11
- * 6. ready 后发送缓存的消息
8
+ * 2. 创建 iframe(先不设置 src,避免提前触发加载)
9
+ * 3. 先注册所有事件监听,再设置 iframe.src 和 appendChild 触发加载
10
+ * 4. setup() waitForReadyHandshake() 并行执行
11
+ * 5. 两者都完成后,sendHandshake() 发送 HANDSHAKE 配置
12
+ * 6. 等待 HANDSHAKE_ACK → 设置 status = 'ready'
13
+ * 7. ready 后发送缓存的消息
12
14
  */
13
15
  export declare class ModernElementController implements IElementController {
14
16
  private options;
15
17
  private bridge;
16
18
  private iframe;
17
19
  private status;
18
- private eventListeners;
19
20
  private cachedSend;
20
- private modalIframe;
21
21
  private modalBridge;
22
22
  private modalDestroy;
23
23
  private _closeConfirmResolve;
24
+ private notRedirectAfterComplete;
24
25
  constructor(options: IElementOptions);
25
26
  mount(renderOptions: PaymentMountOptions, sdkSelector: string): Promise<ICommonApiResponse>;
26
27
  /**
@@ -35,15 +36,44 @@ export declare class ModernElementController implements IElementController {
35
36
  */
36
37
  private setup;
37
38
  /**
38
- * 执行握手流程:
39
- * - 监听 READY_HANDSHAKE setTarget → send(HANDSHAKE, mergedConfig)
40
- * - 等待 HANDSHAKE_ACK resolve
39
+ * 校验 renderData 数据格式,参照老逻辑 isLoadErrorPage 的三个校验维度:
40
+ * 1. success 字段 接口是否返回业务成功
41
+ * 2. 支付方式 paymentMethods 或 savedPaymentMethods 必须存在且为非空数组
42
+ * 3. 金额视图 — orderAmountView 和 paymentAmountView 必须同时存在
43
+ *
44
+ * 当数据结构异常时,构造 ERR_DATA_STRUCT_UNRECOGNIZED 错误
41
45
  */
42
- private performHandshake;
46
+ private validateRenderData;
43
47
  /**
44
- * 绑定持续监听的 bridge 事件
48
+ * 注册所有 bridge 事件监听(必须在 iframe 加载前调用,避免丢失早期消息)
45
49
  */
46
50
  private bindBridgeEvents;
51
+ /**
52
+ * 处理 webapp 委托的 Apple Pay token 请求。
53
+ * Chrome 等非 Safari 浏览器内 iframe 无法拉起 Apple 二维码 modal(jsapi 注入需父域),
54
+ * 改由 SDK 域 new ApplePaySdk().startPay() 拉起 Apple modal,结果通过 bridge 回传。
55
+ */
56
+ private handleGetApplePayToken;
57
+ /**
58
+ * 处理 webapp 委托的 skipRenderPaymentMethod 拉起请求(fire-and-forget)。
59
+ * 走 plugin/applepay 标准链路:ApplePayBusSubscriber.onCreateComponent 自动注入
60
+ * onEventCallback,通过 BusManager.publish(SDKCallbackActionEnum.onEventCallback)
61
+ * 通知商户。SDK 端不需要 reply 给 webapp。
62
+ */
63
+ private handleHandlePayment;
64
+ /**
65
+ * 等待 webapp 发送 READY_HANDSHAKE(表示 iframe 已加载并准备好握手),
66
+ * 收到后设置 bridge target 和安全源
67
+ */
68
+ private waitForReadyHandshake;
69
+ /**
70
+ * 发送 HANDSHAKE 配置给 webapp(setup 和 READY_HANDSHAKE 都完成后调用)
71
+ */
72
+ private sendHandshake;
73
+ /**
74
+ * 等待 webapp 返回 HANDSHAKE_ACK(确认握手完成)
75
+ */
76
+ private waitForHandshakeAck;
47
77
  submitPayment(params: SubmitFuncParams): Promise<IPaymentApiResponse>;
48
78
  validateFields(): Promise<{
49
79
  isValid: boolean;