@alipay/ams-checkout 0.0.1751254427-dev.0 → 0.0.1751254427-dev.2

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 (40) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/component.inline.style.js +1 -1
  3. package/esm/component/component.popup.style.d.ts +1 -0
  4. package/esm/component/component.popup.style.js +1 -1
  5. package/esm/component/popupWindow.style.d.ts +4 -1
  6. package/esm/component/popupWindow.style.js +33 -1
  7. package/esm/config/index.d.ts +8 -7
  8. package/esm/config/index.js +8 -7
  9. package/esm/constant/index.d.ts +21 -0
  10. package/esm/constant/index.js +23 -0
  11. package/esm/core/component/element/elementController/index.js +22 -14
  12. package/esm/core/component/element/type.d.ts +29 -15
  13. package/esm/core/component/element/type.js +20 -12
  14. package/esm/core/component/index.d.ts +5 -2
  15. package/esm/core/component/index.js +105 -2
  16. package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
  17. package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
  18. package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
  19. package/esm/foundation/product-processor/autoDebit/index.js +466 -0
  20. package/esm/foundation/service/container/index.d.ts +2 -0
  21. package/esm/foundation/service/container/index.js +48 -24
  22. package/esm/foundation/service/container/popup.d.ts +9 -6
  23. package/esm/foundation/service/container/popup.js +3 -1
  24. package/esm/foundation/service/requester/requester.js +2 -2
  25. package/esm/foundation/utils/web_app_url_utils.d.ts +3 -3
  26. package/esm/foundation/utils/web_app_url_utils.js +15 -11
  27. package/esm/index.d.ts +18 -6
  28. package/esm/index.js +116 -53
  29. package/esm/plugin/component/cashierApp.js +2 -2
  30. package/esm/plugin/component/index.d.ts +2 -0
  31. package/esm/plugin/component/index.js +44 -8
  32. package/esm/plugin/paypal/index.js +5 -2
  33. package/esm/request/index.js +2 -2
  34. package/esm/types/index.d.ts +17 -6
  35. package/esm/types/index.js +2 -1
  36. package/esm/util/index.d.ts +12 -1
  37. package/esm/util/index.js +39 -3
  38. package/esm/util/spm-map.d.ts +18 -4
  39. package/esm/util/spm-map.js +20 -6
  40. package/package.json +2 -2
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  import axios from 'axios';
14
14
  import { ServiceProvider } from '..';
15
15
  import { errorEnum } from "./deps";
16
- import { appId, device, fomatGetwayError, get, hostSignMap, isPC, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
16
+ import { appId, device, fomatGetwayError, get, hostSignMap, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
17
17
 
18
18
  /**
19
19
  * @author congle.zzq <congle.zzq@alipay.com>
@@ -149,7 +149,7 @@ export var RequesterService = /*#__PURE__*/function () {
149
149
  value: function getEnvInfo(options) {
150
150
  var _options$envInfo;
151
151
  var envInfo = _objectSpread(_objectSpread({
152
- terminalType: isPC() ? 'WEB' : 'WAP',
152
+ terminalType: device.isMobile ? 'WAP' : 'WEB',
153
153
  browserInfo: {
154
154
  browserJavaScriptEnabled: true,
155
155
  browserLanguage: navigator.language,
@@ -1,6 +1,6 @@
1
- import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, IPaymentSessionMetaData } from '../../types';
1
+ import { ESP_PAGE_NAME } from '../../constant/easysafepay';
2
+ import { DisplayTypeEnum, IPaymentSessionMetaData, PaymentMethodCategoryTypeEnum, ProductSceneEnum } from '../../types';
2
3
  import { SDKMetaData } from '../index';
3
- import { ESP_PAGE_NAME } from "../../constant/easysafepay";
4
4
  /**
5
5
  * Tell the SDK which version of the Web App to load.
6
6
  * Sent by server inside paymentSession.
@@ -110,7 +110,7 @@ export declare const defaultCheckoutUrl: (productScene: ProductSceneEnum, enviro
110
110
  * V2应用EasySafePay 热更新兜底URL构建规则
111
111
  * 1. 兜底URL版本与sdk版本保持一致
112
112
  * 2. DEV环境下html新增版本前缀
113
- **/
113
+ **/
114
114
  export declare const getDefaultEasySafePayPageUrl: (pageName: ESP_PAGE_NAME, env: string) => string;
115
115
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
116
116
  export declare const getDoubleFaUrlFromSession: (paymentSessionObj: IPaymentSessionMetaData, env?: string) => string;
@@ -4,12 +4,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  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; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
+ import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config";
8
+ import { ESP_PAGE_NAME } from "../../constant/easysafepay";
7
9
  import { ComponentSignEnum, ProductSceneEnum } from "../../types";
8
- import { marmotMap, v2AppMarmotMap, sdkVersion } from "../../config";
9
10
  import { queryParse, serialize } from "../../util";
10
- import { compareVersion } from "../../util/versionCompare";
11
11
  import { isDebugLog } from "../../util/debug";
12
- import { ESP_PAGE_NAME } from "../../constant/easysafepay";
12
+ import { compareVersion } from "../../util/versionCompare";
13
+
13
14
  /**
14
15
  * Tell the SDK which version of the Web App to load.
15
16
  * Sent by server inside paymentSession.
@@ -117,6 +118,9 @@ var getAppPath = function getAppPath() {
117
118
  var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
118
119
  var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
119
120
  var webAppVersion = sdkMetaData.webAppVersion;
121
+ if (productSceneWithPaymentMethodCategoryType === ComponentSignEnum.AUTO_DEBIT_APM) {
122
+ return "".concat(v2AppMarmotMap[environment], "/auto-debit/").concat(webAppVersion, "/pages/trustly/index.html");
123
+ }
120
124
  switch (productScene) {
121
125
  case ProductSceneEnum.EASY_PAY:
122
126
  return v2Url !== null && v2Url !== void 0 ? v2Url : defaultCheckoutUrl(productScene, environment);
@@ -151,7 +155,7 @@ export var parseWebAppUrlMatchConfig = function parseWebAppUrlMatchConfig(extend
151
155
  };
152
156
  var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
153
157
  var _supportMapping;
154
- var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']));
158
+ var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']), ComponentSignEnum.AUTO_DEBIT_APM, ['1.0']));
155
159
  var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
156
160
  if (!targetVersions) {
157
161
  return '';
@@ -251,8 +255,8 @@ export var matchEasySafePayV2Url = function matchEasySafePayV2Url(params) {
251
255
  if (!config) return defaultEspUrl;
252
256
 
253
257
  // 根据pageName匹配URL
254
- if (pageName == ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
255
- if (pageName == ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
258
+ if (pageName === ESP_PAGE_NAME.SDK_PORTAL) return (config === null || config === void 0 ? void 0 : config.url) || defaultEspUrl;
259
+ if (pageName === ESP_PAGE_NAME.DOUBLE_FA) return (config === null || config === void 0 ? void 0 : config.doubleFa) || defaultEspUrl;
256
260
  return defaultEspUrl;
257
261
  };
258
262
 
@@ -275,7 +279,7 @@ export var getLocalCheckoutUrl = function getLocalCheckoutUrl(productScene, envi
275
279
  * @param productScene - The product scene for which the default checkout URL should be provided.
276
280
  */
277
281
  export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
278
- var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
282
+ var environment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
279
283
  switch (productScene) {
280
284
  case ProductSceneEnum.EASY_PAY:
281
285
  return getDefaultEasySafePayPageUrl(ESP_PAGE_NAME.SDK_PORTAL, environment);
@@ -288,7 +292,7 @@ export var defaultCheckoutUrl = function defaultCheckoutUrl(productScene) {
288
292
  * V2应用EasySafePay 热更新兜底URL构建规则
289
293
  * 1. 兜底URL版本与sdk版本保持一致
290
294
  * 2. DEV环境下html新增版本前缀
291
- **/
295
+ **/
292
296
  export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(pageName, env) {
293
297
  // 生成的URL EXAMPLE:
294
298
  // const DEFAULT_DOUBLE_FA_URL_MAPPING = {
@@ -298,14 +302,14 @@ export var getDefaultEasySafePayPageUrl = function getDefaultEasySafePayPageUrl(
298
302
  // pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2/easysafepay/1.36.0/pages/double-fa/index.html',
299
303
  // prod: 'https://checkout.antom.com/easysafepay/1.36.0/pages/double-fa/index.html',
300
304
  // };
301
- var environment = env || "prod";
302
- if (environment === "dev") return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
305
+ var environment = env || 'prod';
306
+ if (environment === 'dev') return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index-").concat(sdkVersion, ".html");else return "".concat(v2AppMarmotMap[environment], "/easysafepay/").concat(sdkVersion, "/pages/").concat(pageName, "/index.html");
303
307
  };
304
308
 
305
309
  /**通过sessionData获取doubleFa,于createComponent时传递给WEB应用*/
306
310
  //TODO 后续需要构造一个类,专门用于构造&存储web应用url
307
311
  export var getDoubleFaUrlFromSession = function getDoubleFaUrlFromSession(paymentSessionObj) {
308
- var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "prod";
312
+ var env = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'prod';
309
313
  var mid = paymentSessionObj.clientId;
310
314
  var extendInfo = paymentSessionObj.extendInfo;
311
315
  var configs = parseWebAppUrlMatchConfig(extendInfo);
package/esm/index.d.ts CHANGED
@@ -1,16 +1,12 @@
1
1
  import { AddressComponent } from './core/component/address';
2
2
  import { ElementComponent } from './core/component/element';
3
3
  import { AMSComponent } from './core/component/index';
4
- import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions } from './types';
4
+ import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams, IPreloadOptions, ValidationResult } from './types';
5
5
  export { AMSCheckoutPage } from './core/component/ckp';
6
6
  export * from './types';
7
7
  export declare class AMSCheckout extends AMSComponent {
8
8
  constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
9
9
  }
10
- export declare class AMSAutoDebit extends AMSCheckout {
11
- constructor(options: IoptionsParams);
12
- static preload(options?: IPreloadOptions): void;
13
- }
14
10
  export declare class AMSAutoDebitPay extends AMSCheckout {
15
11
  constructor(options: IoptionsParams);
16
12
  static preload(options?: IPreloadOptions): void;
@@ -18,6 +14,15 @@ export declare class AMSAutoDebitPay extends AMSCheckout {
18
14
  export declare class AMSCashierPayment extends AMSCheckout {
19
15
  constructor(options: IoptionsParams);
20
16
  static preload(options?: IPreloadOptions): void;
17
+ /**
18
+ * Form validation function
19
+ * If the form is currently displayed:
20
+ * - Successful validation: isValid is true
21
+ * - Failed validation: isValid is false, and error messages are displayed on the form page
22
+ * If not on the form display page, isValid returns false
23
+ * @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
24
+ */
25
+ validateFields(): Promise<ValidationResult>;
21
26
  }
22
27
  export declare class AMSVaulting extends AMSCheckout {
23
28
  constructor(options: IoptionsParams);
@@ -29,7 +34,7 @@ export declare class AntomElement extends AMSCheckout {
29
34
  export declare class AddressElement extends AddressComponent {
30
35
  constructor(options: IoptionsAddressParams);
31
36
  }
32
- export declare class Element extends ElementComponent {
37
+ export declare class AMSElement extends ElementComponent {
33
38
  constructor(options: IElementOptions);
34
39
  }
35
40
  export declare class AMSEasyPay {
@@ -39,4 +44,11 @@ export declare class AMSEasyPay {
39
44
  createComponent(params: IcreateComponent): void;
40
45
  unmount(): void;
41
46
  }
47
+ export declare class AMSAutoDebit {
48
+ private core;
49
+ constructor(options: IoptionsParams);
50
+ createComponent(params: IcreateComponent): Promise<void>;
51
+ unmount(): void;
52
+ static preload(options?: IPreloadOptions): void;
53
+ }
42
54
  export default AMSCheckout;
package/esm/index.js CHANGED
@@ -1,4 +1,7 @@
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 _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; }
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); } }
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); }); }; }
2
5
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
7
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -24,19 +27,21 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
24
27
  * 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
25
28
  * 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.
26
29
  */
27
- import { ADDRESSElementAppVersion, AMSAutoDebitAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
30
+ import { ADDRESSElementAppVersion, AMSCashierPaymentAppVersion, AMSCheckoutAppVersion, AMSPaymentElementAppVersion, AMSVaultingAppVersion } from "./config/index";
28
31
  import { AddressComponent } from "./core/component/address";
29
32
  import { ElementComponent } from "./core/component/element";
30
33
  // import { ElementComponent } from './core/component/oldElement';
31
34
  import { AMSComponent } from "./core/component/index";
32
- import { ComponentSignEnum, DisplayTypeEnum, PaymentMethodCategoryTypeEnum } from "./types";
35
+ import PreloadHelper from "./foundation/utils/preload_helper";
36
+ import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, PaymentMethodCategoryTypeEnum } from "./types";
33
37
  import { ProductSceneEnum } from "./types/index";
34
38
  import { LogConfig, Logger } from "./util/logger";
35
- import PreloadHelper from "./foundation/utils/preload_helper";
36
39
  var logger = new Logger(LogConfig, true);
37
40
  export { AMSCheckoutPage } from "./core/component/ckp";
38
41
  export * from "./types";
42
+ import { EVENT } from "./constant";
39
43
  import { AntomSDKCore } from "./foundation/core";
44
+ import { AutoDebitProcessor } from "./foundation/product-processor/autoDebit";
40
45
  import { EasySafePayProcessor } from "./foundation/product-processor/easysafepay";
41
46
  export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
42
47
  _inherits(AMSCheckout, _AMSComponent);
@@ -53,39 +58,15 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
53
58
  }
54
59
  return _createClass(AMSCheckout);
55
60
  }(AMSComponent);
56
- export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
57
- _inherits(AMSAutoDebit, _AMSCheckout);
58
- var _super2 = _createSuper(AMSAutoDebit);
59
- function AMSAutoDebit(options) {
60
- _classCallCheck(this, AMSAutoDebit);
61
- var _options = Object.assign({}, options, {
62
- product: ProductSceneEnum.AUTO_DEBIT,
63
- appVersion: AMSAutoDebitAppVersion
64
- });
65
- return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_WALLET]);
66
- }
67
- _createClass(AMSAutoDebit, null, [{
68
- key: "preload",
69
- value: function preload() {
70
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
71
- securityRegion: 'SG',
72
- environment: 'prod'
73
- };
74
- PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
75
- PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
76
- }
77
- }]);
78
- return AMSAutoDebit;
79
- }(AMSCheckout);
80
- export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
81
- _inherits(AMSAutoDebitPay, _AMSCheckout2);
82
- var _super3 = _createSuper(AMSAutoDebitPay);
61
+ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout) {
62
+ _inherits(AMSAutoDebitPay, _AMSCheckout);
63
+ var _super2 = _createSuper(AMSAutoDebitPay);
83
64
  function AMSAutoDebitPay(options) {
84
65
  _classCallCheck(this, AMSAutoDebitPay);
85
66
  var _options = Object.assign({}, options, {
86
67
  product: ProductSceneEnum.AUTO_DEBIT_PAY
87
68
  });
88
- return _super3.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
69
+ return _super2.call(this, _options, [ComponentSignEnum.AUTO_DEBIT_PAY_WALLET]);
89
70
  }
90
71
  _createClass(AMSAutoDebitPay, null, [{
91
72
  key: "preload",
@@ -100,9 +81,9 @@ export var AMSAutoDebitPay = /*#__PURE__*/function (_AMSCheckout2) {
100
81
  }]);
101
82
  return AMSAutoDebitPay;
102
83
  }(AMSCheckout);
103
- export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
104
- _inherits(AMSCashierPayment, _AMSCheckout3);
105
- var _super4 = _createSuper(AMSCashierPayment);
84
+ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout2) {
85
+ _inherits(AMSCashierPayment, _AMSCheckout2);
86
+ var _super3 = _createSuper(AMSCashierPayment);
106
87
  function AMSCashierPayment(options) {
107
88
  _classCallCheck(this, AMSCashierPayment);
108
89
  var _options = Object.assign({}, options, {
@@ -128,9 +109,23 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
128
109
  errorMessage: error
129
110
  });
130
111
  }
131
- return _super4.call(this, _options, currentChannelType);
112
+ return _super3.call(this, _options, currentChannelType);
132
113
  }
133
- _createClass(AMSCashierPayment, null, [{
114
+ _createClass(AMSCashierPayment, [{
115
+ key: "validateFields",
116
+ value:
117
+ /**
118
+ * Form validation function
119
+ * If the form is currently displayed:
120
+ * - Successful validation: isValid is true
121
+ * - Failed validation: isValid is false, and error messages are displayed on the form page
122
+ * If not on the form display page, isValid returns false
123
+ * @returns {Promise<ValidationResult>} Returns a Promise containing the validation result
124
+ */
125
+ function validateFields() {
126
+ return this._validateFields();
127
+ }
128
+ }], [{
134
129
  key: "preload",
135
130
  value: function preload() {
136
131
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
@@ -173,16 +168,16 @@ export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
173
168
  }]);
174
169
  return AMSCashierPayment;
175
170
  }(AMSCheckout);
176
- export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
177
- _inherits(AMSVaulting, _AMSCheckout4);
178
- var _super5 = _createSuper(AMSVaulting);
171
+ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout3) {
172
+ _inherits(AMSVaulting, _AMSCheckout3);
173
+ var _super4 = _createSuper(AMSVaulting);
179
174
  function AMSVaulting(options) {
180
175
  _classCallCheck(this, AMSVaulting);
181
176
  var _options = Object.assign({}, options, {
182
177
  product: ProductSceneEnum.VAULTING,
183
178
  appVersion: AMSVaultingAppVersion
184
179
  });
185
- return _super5.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
180
+ return _super4.call(this, _options, [ComponentSignEnum.CASHIER_PAYMENT_CARD]);
186
181
  }
187
182
  _createClass(AMSVaulting, null, [{
188
183
  key: "preload",
@@ -197,44 +192,44 @@ export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
197
192
  }]);
198
193
  return AMSVaulting;
199
194
  }(AMSCheckout);
200
- export var AntomElement = /*#__PURE__*/function (_AMSCheckout5) {
201
- _inherits(AntomElement, _AMSCheckout5);
202
- var _super6 = _createSuper(AntomElement);
195
+ export var AntomElement = /*#__PURE__*/function (_AMSCheckout4) {
196
+ _inherits(AntomElement, _AMSCheckout4);
197
+ var _super5 = _createSuper(AntomElement);
203
198
  function AntomElement(options) {
204
199
  _classCallCheck(this, AntomElement);
205
200
  var _options = Object.assign({}, options, {
206
201
  product: ProductSceneEnum.ELEMENT_PAYMENT,
207
202
  appVersion: AMSPaymentElementAppVersion
208
203
  });
209
- return _super6.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
204
+ return _super5.call(this, _options, [ComponentSignEnum.ELEMENT_PAYMENT]);
210
205
  }
211
206
  return _createClass(AntomElement);
212
207
  }(AMSCheckout);
213
208
  export var AddressElement = /*#__PURE__*/function (_AddressComponent) {
214
209
  _inherits(AddressElement, _AddressComponent);
215
- var _super7 = _createSuper(AddressElement);
210
+ var _super6 = _createSuper(AddressElement);
216
211
  function AddressElement(options) {
217
212
  _classCallCheck(this, AddressElement);
218
213
  var _options = Object.assign({}, options, {
219
214
  product: ProductSceneEnum.ELEMENT_ADDRESS,
220
215
  appVersion: ADDRESSElementAppVersion
221
216
  });
222
- return _super7.call(this, _options);
217
+ return _super6.call(this, _options);
223
218
  }
224
219
  return _createClass(AddressElement);
225
220
  }(AddressComponent);
226
- export var Element = /*#__PURE__*/function (_ElementComponent) {
227
- _inherits(Element, _ElementComponent);
228
- var _super8 = _createSuper(Element);
229
- function Element(options) {
230
- _classCallCheck(this, Element);
221
+ export var AMSElement = /*#__PURE__*/function (_ElementComponent) {
222
+ _inherits(AMSElement, _ElementComponent);
223
+ var _super7 = _createSuper(AMSElement);
224
+ function AMSElement(options) {
225
+ _classCallCheck(this, AMSElement);
231
226
  var _options = Object.assign({}, options, {
232
227
  product: ProductSceneEnum.ELEMENT_PAYMENT,
233
228
  environment: options.environment
234
229
  });
235
- return _super8.call(this, _options);
230
+ return _super7.call(this, _options);
236
231
  }
237
- return _createClass(Element);
232
+ return _createClass(AMSElement);
238
233
  }(ElementComponent);
239
234
  export var AMSEasyPay = /*#__PURE__*/function () {
240
235
  function AMSEasyPay(options) {
@@ -276,4 +271,72 @@ export var AMSEasyPay = /*#__PURE__*/function () {
276
271
  }]);
277
272
  return AMSEasyPay;
278
273
  }();
274
+ export var AMSAutoDebit = /*#__PURE__*/function () {
275
+ function AMSAutoDebit(options) {
276
+ _classCallCheck(this, AMSAutoDebit);
277
+ _defineProperty(this, "core", void 0);
278
+ this.core = new AntomSDKCore();
279
+ this.core.registerProcessor(ProductSceneEnum.AUTO_DEBIT, '', new AutoDebitProcessor());
280
+ this.core.init(options, ProductSceneEnum.AUTO_DEBIT);
281
+ }
282
+ _createClass(AMSAutoDebit, [{
283
+ key: "createComponent",
284
+ value: function () {
285
+ var _createComponent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
286
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
287
+ while (1) switch (_context.prev = _context.next) {
288
+ case 0:
289
+ _context.prev = 0;
290
+ _context.next = 3;
291
+ return this.core.startBizFlow({
292
+ submitPayRequestExtra: {
293
+ notRedirectAfterComplete: params.notRedirectAfterComplete,
294
+ merchantAppointParam: params.merchantAppointParam
295
+ },
296
+ paymentSession: params.sessionData || params.paymentSessionData,
297
+ displayInfo: {
298
+ type: DisplayTypeEnum.popup
299
+ },
300
+ isAppWebview: params.isAppWebview
301
+ });
302
+ case 3:
303
+ _context.next = 9;
304
+ break;
305
+ case 5:
306
+ _context.prev = 5;
307
+ _context.t0 = _context["catch"](0);
308
+ this.core.getServiceProvider().getService('EventCenter').emit(EVENT.eventCallback.name, {
309
+ code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR,
310
+ message: (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || 'Initialization parameter exception.'
311
+ });
312
+ this.core.destroy();
313
+ case 9:
314
+ case "end":
315
+ return _context.stop();
316
+ }
317
+ }, _callee, this, [[0, 5]]);
318
+ }));
319
+ function createComponent(_x) {
320
+ return _createComponent.apply(this, arguments);
321
+ }
322
+ return createComponent;
323
+ }()
324
+ }, {
325
+ key: "unmount",
326
+ value: function unmount() {
327
+ this.core.destroy();
328
+ }
329
+ }], [{
330
+ key: "preload",
331
+ value: function preload() {
332
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
333
+ securityRegion: 'SG',
334
+ environment: 'prod'
335
+ };
336
+ PreloadHelper.preloadWebApp(ProductSceneEnum.AUTO_DEBIT, PaymentMethodCategoryTypeEnum.WALLET, options.environment);
337
+ PreloadHelper.preloadSecuritySDK(ProductSceneEnum.AUTO_DEBIT, options.securityRegion);
338
+ }
339
+ }]);
340
+ return AMSAutoDebit;
341
+ }();
279
342
  export default AMSCheckout;
@@ -15,7 +15,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
15
15
  * 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
16
16
  * 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.
17
17
  */
18
- import { v2AppMarmotMap, marmotMap, sdkVersion } from "../../config/index";
18
+ import { marmotMap, sdkVersion, v2AppMarmotMap } from "../../config/index";
19
19
  import { ComponentSignEnum, ComponentSignEnumV2 } from "../../types";
20
20
  import { isDebugLog } from "../../util/debug";
21
21
  import { queryParse, serialize } from "../../util/index";
@@ -59,7 +59,7 @@ var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
59
59
  };
60
60
  var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
61
61
  var _signSupportMap;
62
- var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0.0']));
62
+ var signSupportMap = (_signSupportMap = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_defineProperty(_signSupportMap, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0.0']), ComponentSignEnum.AUTO_DEBIT_APM, ['1.0']));
63
63
  var supportProductSceneVersion = signSupportMap[componentSign] || [];
64
64
  // 从左到右,从旧到新
65
65
  var isSupport = supportProductSceneVersion.find(function (it) {
@@ -28,6 +28,7 @@ export default class ComponentApp {
28
28
  private _isAppWebview;
29
29
  _merchantAppointParam: IMerchantAppointParam;
30
30
  private _webAppHeartBeatTimeoutFn;
31
+ private _hasRenderComponent;
31
32
  constructor(componentOption?: {
32
33
  appVersion?: string;
33
34
  });
@@ -126,5 +127,6 @@ export default class ComponentApp {
126
127
  private showRetentionPopup;
127
128
  private hideRetentionPopupFunc;
128
129
  private submitForm;
130
+ shouldValidateFields(): boolean;
129
131
  }
130
132
  export {};
@@ -23,7 +23,7 @@ import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK
23
23
  import { ElementPaymentMethod } from "../../core/component/oldElement/type";
24
24
  import { queryPaymentInfo, submitPayInfo } from "../../service";
25
25
  import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
26
- import { getType, isJsonString, isPC } from "../../util";
26
+ import { getType, isJsonString, isPC, device } from "../../util";
27
27
  import { getBackScheme } from "../../util/getBackScheme";
28
28
  import { isLocalMock } from "../../util/mock";
29
29
  import { matchVersion } from "../../util/versionCompare";
@@ -62,6 +62,7 @@ var ComponentApp = /*#__PURE__*/function () {
62
62
  _defineProperty(this, "_isAppWebview", void 0);
63
63
  _defineProperty(this, "_merchantAppointParam", void 0);
64
64
  _defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
65
+ _defineProperty(this, "_hasRenderComponent", false);
65
66
  this._appVersion = componentOption.appVersion;
66
67
  this._isInitComponent = false;
67
68
  this._selector = "#".concat(COMPONENT_SECTION_ID);
@@ -71,7 +72,7 @@ var ComponentApp = /*#__PURE__*/function () {
71
72
  this.createPreloadIframeNode = function () {
72
73
  return Promise.resolve();
73
74
  };
74
- this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
75
+ this.platform = device.isMobile ? PlatformEnum.mobile : PlatformEnum.desktop;
75
76
  this._isRetention = true;
76
77
  this._appLocationSearch = '';
77
78
  this._performanceData.push({
@@ -447,6 +448,7 @@ var ComponentApp = /*#__PURE__*/function () {
447
448
  }, loadTimeLimit !== null && loadTimeLimit !== void 0 ? loadTimeLimit : LOADTIME_LIMIT);
448
449
  }).catch(function (error) {
449
450
  _this4.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
451
+ _this4.dispatchToSDK(EVENT.eventCallback.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
450
452
  _this4.AMSSDK.logger.logError({
451
453
  title: 'sdk_error_web_app_timeout'
452
454
  }).send();
@@ -658,13 +660,34 @@ var ComponentApp = /*#__PURE__*/function () {
658
660
  key: 'sdk_action_query_end',
659
661
  value: Date.now()
660
662
  });
661
- resolve(res);
662
663
  _this5.AMSSDK.logger.logInfo({
663
664
  title: 'sdk_event_sdkQueryEnd'
664
665
  }, {
665
666
  paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
666
667
  }).send();
668
+ // fix: 泡泡玛特CVV场景,actionQuery报错会进入错误兜底页,导致CVV页面占用大幅空间
669
+ if (ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && !(res !== null && res !== void 0 && res.success)) {
670
+ var _res$errorActions;
671
+ // 通用操作:抛CREATECOMPONENT_ERROR错误码给商户,商户升级到新版本需要处理CREATECOMPONENT_ERROR逻辑
672
+ var createComponentError = {
673
+ code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code,
674
+ message: res === null || res === void 0 ? void 0 : res.errorMessage
675
+ };
676
+ _this5.dispatchToSDK(EVENT.error.name, createComponentError);
677
+ _this5.dispatchToSDK(EVENT.eventCallback.name, createComponentError);
678
+ if ((res === null || res === void 0 || (_res$errorActions = res.errorActions) === null || _res$errorActions === void 0 ? void 0 : _res$errorActions.showType) === 'NONE') {
679
+ // 抛错销毁SDK,不展示错误页面
680
+ reject(createComponentError);
681
+ return;
682
+ }
683
+ }
684
+ resolve(res);
667
685
  }).catch(function (err) {
686
+ if (ComponentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign) {
687
+ // 通用操作:抛CREATECOMPONENT_ERROR错误码给商户,商户升级到新版本需要处理CREATECOMPONENT_ERROR逻辑
688
+ _this5.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.NETWORK_REQUEST_ERROR);
689
+ _this5.dispatchToSDK(EVENT.eventCallback.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.NETWORK_REQUEST_ERROR);
690
+ }
668
691
  if ([ComponentSignEnum.CASHIER_PAYMENT_CARD, ComponentSignEnum.VAULTING_CARD, ComponentSignEnum.CASHIER_PAYMENT_APM].includes(_this5._componentSign)) {
669
692
  return resolve({
670
693
  success: false
@@ -1387,6 +1410,12 @@ var ComponentApp = /*#__PURE__*/function () {
1387
1410
  });
1388
1411
  return;
1389
1412
  }
1413
+ if (data.context.event === EVENT.validateFieldsResult.name) {
1414
+ // 将validateFieldsResult事件转发到subsribe处理,解决subsribe拿不到eventCallbackId的问题
1415
+ this.AMSSDK._eventCenter.emit(EVENT.validateFieldsResult.forwardName, data.context);
1416
+ return;
1417
+ }
1418
+
1390
1419
  // log event before sending the callback
1391
1420
  this.logEventCallback(data, 'sdk_event_event_callback');
1392
1421
  try {
@@ -1822,6 +1851,7 @@ var ComponentApp = /*#__PURE__*/function () {
1822
1851
  return this._actionSubmitPromise;
1823
1852
  case 9:
1824
1853
  submitRes = _context8.sent;
1854
+ this._hasRenderComponent = true;
1825
1855
  this._performanceData.push({
1826
1856
  key: 'sdk_render_component',
1827
1857
  value: Date.now()
@@ -1877,16 +1907,16 @@ var ComponentApp = /*#__PURE__*/function () {
1877
1907
  }
1878
1908
  });
1879
1909
  // eslint-disable-next-line no-empty
1880
- _context8.next = 18;
1910
+ _context8.next = 19;
1881
1911
  break;
1882
- case 16:
1883
- _context8.prev = 16;
1912
+ case 17:
1913
+ _context8.prev = 17;
1884
1914
  _context8.t0 = _context8["catch"](0);
1885
- case 18:
1915
+ case 19:
1886
1916
  case "end":
1887
1917
  return _context8.stop();
1888
1918
  }
1889
- }, _callee8, this, [[0, 16]]);
1919
+ }, _callee8, this, [[0, 17]]);
1890
1920
  }));
1891
1921
  function sendRenderEvent() {
1892
1922
  return _sendRenderEvent.apply(this, arguments);
@@ -1913,6 +1943,7 @@ var ComponentApp = /*#__PURE__*/function () {
1913
1943
  this._performanceData = [];
1914
1944
  this._isInitComponent = false;
1915
1945
  this.app = null;
1946
+ this._hasRenderComponent = false;
1916
1947
  if (immediately) this.cleanElement();else {
1917
1948
  setTimeout(function () {
1918
1949
  _this10.cleanElement();
@@ -1999,6 +2030,11 @@ var ComponentApp = /*#__PURE__*/function () {
1999
2030
  form.submit();
2000
2031
  }, 0);
2001
2032
  }
2033
+ }, {
2034
+ key: "shouldValidateFields",
2035
+ value: function shouldValidateFields() {
2036
+ return this._hasRenderComponent;
2037
+ }
2002
2038
  }]);
2003
2039
  return ComponentApp;
2004
2040
  }();