@alipay/ams-checkout 2.0.26 → 2.0.28

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.
@@ -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 = "2.0.26";
33
+ export var sdkVersion = "2.0.28";
34
34
 
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
@@ -7,6 +7,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
7
7
  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; }
8
8
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
9
  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); }
10
+ import { isModernWeb } from "../../../modern/tools";
10
11
  import { redirect } from "../../../util/redirect";
11
12
  import { v4 as uuid } from 'uuid';
12
13
  import { EnvironmentEnum, MessageName } from "../../../types";
@@ -23,6 +24,8 @@ var CKP_PAYMENT_PAGE_HOST = {
23
24
 
24
25
  var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
25
26
  var CKP_PAGE_NEW_ADDRESS = '/checkout-page/pages/payment/index.html';
27
+ var CKP2_PAGE_ADDRESS = '/checkout-page2/pages/payment/index.html';
28
+ var CKP2_FLOW_SWITCH_TAG = 'ckp2';
26
29
  export var getCKPPageAddress = function getCKPPageAddress(env) {
27
30
  switch (env) {
28
31
  case 'dev':
@@ -40,6 +43,23 @@ export var getCKPPageAddress = function getCKPPageAddress(env) {
40
43
  return env;
41
44
  }
42
45
  };
46
+ var getCKP2PageAddress = function getCKP2PageAddress(env) {
47
+ switch (env) {
48
+ case 'dev':
49
+ return "".concat(CKP_PAYMENT_PAGE_HOST.DEV).concat(CKP2_PAGE_ADDRESS);
50
+ case 'sit':
51
+ return "".concat(CKP_PAYMENT_PAGE_HOST.TEST).concat(CKP2_PAGE_ADDRESS);
52
+ case 'pre':
53
+ return "".concat(CKP_PAYMENT_PAGE_HOST.PRE).concat(CKP2_PAGE_ADDRESS);
54
+ case 'prod':
55
+ case 'sandbox':
56
+ case 'light_sandbox':
57
+ return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP2_PAGE_ADDRESS);
58
+ default:
59
+ // A caller-provided URL is already the explicit page selection authority.
60
+ return env;
61
+ }
62
+ };
43
63
  export var AMSCheckoutPage = /*#__PURE__*/function () {
44
64
  function AMSCheckoutPage(options) {
45
65
  var _this = this;
@@ -54,7 +74,7 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
54
74
  var env = _this.originOptions.environment || 'prod';
55
75
  var session = sessionData || '';
56
76
  var lang = _this.originOptions.locale || 'en_US';
57
- var ckpPageAddress = getCKPPageAddress(env);
77
+ var ckpPageAddress = isModernWeb(sessionData, CKP2_FLOW_SWITCH_TAG).modernWeb ? getCKP2PageAddress(env) : getCKPPageAddress(env);
58
78
  console.log('[antom-web-sdk] <antom-checkout-page> generateIframeSrc', _this.originOptions, env, session, lang, ckpPageAddress);
59
79
 
60
80
  // 先获取去除的 query 参数的 url
@@ -42,7 +42,7 @@ import { ElementContainerService } from "../elementContainerService"; // 引入
42
42
  import { IContainerStatus } from "../elementContainerService/containerService";
43
43
  import { EventCenter as ElementEventCenter } from "../EventCenter/index";
44
44
  import { oneAccountUpdate, sdkActionUpdate } from "../mock";
45
- import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EVENTNAME, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
45
+ import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EVENTNAME, EXPOSURE_API_EVENT, MountElementType, PaymentStatus, ThemeType } from "../type";
46
46
  import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, safeParse, safeStringify, showToast } from "../util";
47
47
  var TIMEOUT_DURATION = 16000;
48
48
  var ElementController = /*#__PURE__*/function () {
@@ -233,7 +233,7 @@ var ElementController = /*#__PURE__*/function () {
233
233
  }, {
234
234
  key: "initializeAndMountProcessor",
235
235
  value: function initializeAndMountProcessor(type, selector, options) {
236
- var _this$serviceMap$Log, _options$appearance;
236
+ var _this$serviceMap$Log, _options$appearance, _options$appearance2;
237
237
  this.initElementProcessors(type);
238
238
  // 创建 iframe,拉起应用页面,同时监听全局的数据更新和获取事件
239
239
  this.elementContainerService.mount({
@@ -253,7 +253,8 @@ var ElementController = /*#__PURE__*/function () {
253
253
  title: 'sdk_event_appearance'
254
254
  }, {
255
255
  variables: options !== null && options !== void 0 && (_options$appearance = options.appearance) !== null && _options$appearance !== void 0 && _options$appearance.variables ? true : false,
256
- theme: options === null || options === void 0 ? void 0 : options.theme
256
+ // theme 挂在 appearance 下,商户未传时生效主题为 default,按生效值上报避免维度为空
257
+ theme: (options === null || options === void 0 || (_options$appearance2 = options.appearance) === null || _options$appearance2 === void 0 ? void 0 : _options$appearance2.theme) || ThemeType.Default
257
258
  });
258
259
  this.elementProcessors[type].beforeMount();
259
260
  }
@@ -41,7 +41,7 @@ export function adaptErrorToEventCallback(error) {
41
41
  * 4. layout: 直接透传
42
42
  */
43
43
  export function adaptAppearance(appearance, merchantAppointParam) {
44
- var _merchantAppointParam, _appearance$card, _appearance$accordion;
44
+ var _merchantAppointParam, _appearance$card$show, _appearance$card, _appearance$accordion, _appearance$accordion2;
45
45
  var merchantDisplaySetting = {
46
46
  showCardCVV: !!(merchantAppointParam !== null && merchantAppointParam !== void 0 && (_merchantAppointParam = merchantAppointParam.storedCard) !== null && _merchantAppointParam !== void 0 && _merchantAppointParam.needCVV),
47
47
  showPaymentMethodListWhenSingleOption: (merchantAppointParam === null || merchantAppointParam === void 0 ? void 0 : merchantAppointParam.singleOption) === 'list'
@@ -66,9 +66,9 @@ export function adaptAppearance(appearance, merchantAppointParam) {
66
66
  }
67
67
  }
68
68
  result.displaySetting = _objectSpread(_objectSpread({
69
- showCardBrandIcon: !!((_appearance$card = appearance.card) !== null && _appearance$card !== void 0 && _appearance$card.showBrandIcon)
69
+ showCardBrandIcon: (_appearance$card$show = (_appearance$card = appearance.card) === null || _appearance$card === void 0 ? void 0 : _appearance$card.showBrandIcon) !== null && _appearance$card$show !== void 0 ? _appearance$card$show : true
70
70
  }, merchantDisplaySetting), {}, {
71
- showRadioWhenAccordionLayout: !!((_appearance$accordion = appearance.accordion) !== null && _appearance$accordion !== void 0 && _appearance$accordion.showRadio)
71
+ showRadioWhenAccordionLayout: (_appearance$accordion = (_appearance$accordion2 = appearance.accordion) === null || _appearance$accordion2 === void 0 ? void 0 : _appearance$accordion2.showRadio) !== null && _appearance$accordion !== void 0 ? _appearance$accordion : true
72
72
  });
73
73
 
74
74
  // Layout: 直接透传
@@ -1,4 +1,4 @@
1
- import type { IElementController, IElementOptions, ICommonApiResponse, IPaymentApiResponse, PaymentMountOptions, SubmitFuncParams, EventDataMap } from '../type';
1
+ import type { EventDataMap, ICommonApiResponse, IElementController, IElementOptions, IPaymentApiResponse, PaymentMountOptions, SubmitFuncParams } from '../type';
2
2
  import { EVENTNAME } from '../type';
3
3
  type ModernElementStatus = 'initialized' | 'mounting' | 'mounted' | 'ready' | 'destroyed';
4
4
  interface ModernElementControllerOptions extends IElementOptions {
@@ -38,6 +38,8 @@ export declare class ModernElementController implements IElementController {
38
38
  private _merchantCurrency;
39
39
  /** 当前选中的支付方式类型(如 'APPLEPAY', 'CARD'),通过 paymentMethodChanged 事件更新 */
40
40
  private currentPaymentMethodType;
41
+ /** Removes the passive host-window modal monitor for this controller. */
42
+ private readonly stopModalMessageMonitor;
41
43
  /** 提交进行中标志:submitPayment 执行期间为 true,用于拒绝并发重入,避免旧闭包串扰/重复拉起钱包 */
42
44
  private isSubmitting;
43
45
  /**