@alipay/ams-checkout 1.31.1 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) 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/popupWindow.style.js +4 -1
  4. package/esm/config/index.d.ts +7 -7
  5. package/esm/config/index.js +7 -7
  6. package/esm/constant/index.d.ts +12 -0
  7. package/esm/constant/index.js +12 -0
  8. package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
  9. package/esm/core/component/element/elementContainerService/containerService.js +123 -0
  10. package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
  11. package/esm/core/component/element/elementContainerService/index.js +63 -0
  12. package/esm/core/component/element/elementController/index.d.ts +27 -0
  13. package/esm/core/component/element/elementController/index.js +478 -0
  14. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
  15. package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
  16. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
  17. package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
  18. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +38 -0
  19. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +85 -0
  20. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
  21. package/esm/core/component/element/elementProcessor/paymentProcessor.js +373 -0
  22. package/esm/core/component/element/index.d.ts +8 -46
  23. package/esm/core/component/element/index.js +28 -922
  24. package/esm/core/component/element/mock.d.ts +4 -0
  25. package/esm/core/component/element/mock.js +365 -1
  26. package/esm/core/component/element/type.d.ts +42 -1
  27. package/esm/core/component/element/util.d.ts +60 -0
  28. package/esm/core/component/element/util.js +451 -0
  29. package/esm/core/component/index.d.ts +5 -1
  30. package/esm/core/component/index.js +1 -2
  31. package/esm/core/component/oldElement/index.d.ts +59 -0
  32. package/esm/core/component/oldElement/index.js +956 -0
  33. package/esm/core/component/oldElement/mock.d.ts +6 -0
  34. package/esm/core/component/oldElement/mock.js +567 -0
  35. package/esm/core/component/oldElement/type.d.ts +351 -0
  36. package/esm/core/component/oldElement/type.js +81 -0
  37. package/esm/foundation/core/index.d.ts +6 -1
  38. package/esm/foundation/core/index.js +73 -35
  39. package/esm/foundation/index.d.ts +14 -0
  40. package/esm/foundation/index.js +13 -2
  41. package/esm/foundation/product-processor/easysafepay/deps.d.ts +2 -0
  42. package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
  43. package/esm/foundation/product-processor/easysafepay/index.d.ts +3 -0
  44. package/esm/foundation/product-processor/easysafepay/index.js +42 -26
  45. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  46. package/esm/foundation/product-processor/element/index.js +24 -0
  47. package/esm/foundation/service/container/index.d.ts +6 -3
  48. package/esm/foundation/service/container/index.js +45 -15
  49. package/esm/foundation/service/container/popup.d.ts +1 -1
  50. package/esm/foundation/service/event-center.js +1 -0
  51. package/esm/foundation/service/log/keys.js +3 -1
  52. package/esm/foundation/service/log/types.d.ts +1 -0
  53. package/esm/foundation/service/requester/requester.js +5 -4
  54. package/esm/index.js +1 -0
  55. package/esm/plugin/component/cashierApp.d.ts +1 -1
  56. package/esm/plugin/component/index.js +1 -1
  57. package/esm/types/index.d.ts +1 -1
  58. package/esm/types/index.js +1 -1
  59. package/package.json +1 -1
  60. /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
  61. /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
  62. /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
  63. /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
  64. /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
  65. /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
  66. /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
  67. /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -1,27 +1,28 @@
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 { DisplayTypeEnum, eventCodeEnum } from "../../types";
14
- import { DisplayInfo } from "../index";
15
13
  import { v4 as uuid } from 'uuid';
14
+ import { cleanMockup, createMockup, createRetentionPopup, handleDeclareInfo, hideMockup, hideRetentionPopup, removeRetentionPopup, showRetentionPopup } from "../../component/component.popup.style";
15
+ import { insertStyleSheet } from "../../component/popupWindow.style";
16
+ import { sdkVersion } from "../../config";
17
+ import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
18
+ import { DisplayTypeEnum, eventCodeEnum } from "../../types";
19
+ import { DisplayInfo, IElementStatus } from "../index";
16
20
  import { ServiceProvider } from "../service";
17
- import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
18
21
  import { getGrayscaleId } from "../utils/gray_scale_utils";
19
- import { sdkVersion } from "../../config";
20
- import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
22
+ import { convertPaymentSession, getWebAppVersion, saveWebAppVersion } from "../utils/payment_context_utils";
21
23
  import { redirect } from "../utils/redirect_utils";
22
- import { insertStyleSheet } from "../../component/popupWindow.style";
23
- import { hideMockup, createMockup, createRetentionPopup, hideRetentionPopup, showRetentionPopup, cleanMockup, removeRetentionPopup, handleDeclareInfo } from "../../component/component.popup.style";
24
- import { COMPONENT_CLOSE_MASK_BLOCK_ID, EVENT, LOADING_ID } from "../../constant";
24
+ import { parseWebAppMatchConfig } from "../utils/web_app_url_utils";
25
+
25
26
  /**
26
27
  * @author 谦彧 <zhangmian.zm@alipay.com>
27
28
  * @date 2024/9/17
@@ -36,8 +37,34 @@ export var AntomSDKCore = /*#__PURE__*/function () {
36
37
  _defineProperty(this, "sdkMetaData", void 0);
37
38
  _defineProperty(this, "productProcessors", {});
38
39
  _defineProperty(this, "enablePopWindowEventCallback", false);
40
+ _defineProperty(this, "status", IElementStatus.UNINIT);
41
+ this.status = IElementStatus.INITING;
39
42
  }
40
43
  _createClass(AntomSDKCore, [{
44
+ key: "getStatus",
45
+ value: function getStatus() {
46
+ return this.status;
47
+ }
48
+ }, {
49
+ key: "setStatus",
50
+ value: function setStatus(status) {
51
+ if (status === this.getStatus()) return;
52
+ console.log("[test] status has changed from ".concat(this.getStatus(), " to ").concat(status));
53
+ this.status = status;
54
+ }
55
+ }, {
56
+ key: "updatePaymentSessionData",
57
+ value: function updatePaymentSessionData(paymentSession) {
58
+ var _convertPaymentSessio = convertPaymentSession(paymentSession),
59
+ paymentSessionId = _convertPaymentSessio.id,
60
+ paymentSessionMetaData = _convertPaymentSessio.data;
61
+ this.paymentContext = _objectSpread(_objectSpread({}, this.paymentContext), {}, {
62
+ paymentSession: paymentSession,
63
+ paymentSessionId: paymentSessionId,
64
+ paymentSessionObj: paymentSessionMetaData
65
+ });
66
+ }
67
+ }, {
41
68
  key: "registerProcessor",
42
69
  value: function registerProcessor(productScene) {
43
70
  var paymentMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
@@ -151,6 +178,10 @@ export var AntomSDKCore = /*#__PURE__*/function () {
151
178
  return _ref2.apply(this, arguments);
152
179
  };
153
180
  }());
181
+ eventCenter.listen(EVENT.destroy.name, function (data) {
182
+ _this.setStatus(IElementStatus.READY);
183
+ _this.destroy();
184
+ });
154
185
  eventCenter.listen(EVENT.closeCallback.name, function () {
155
186
  var _options$onClose;
156
187
  (_options$onClose = options.onClose) === null || _options$onClose === void 0 || _options$onClose.call(options);
@@ -179,7 +210,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
179
210
  value: function () {
180
211
  var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
181
212
  var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
182
- var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
213
+ var paymentSession, displayInfo, _convertPaymentSessio2, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
183
214
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
184
215
  while (1) switch (_context3.prev = _context3.next) {
185
216
  case 0:
@@ -189,8 +220,9 @@ export var AntomSDKCore = /*#__PURE__*/function () {
189
220
  }
190
221
  throw new Error('paymentSession is empty');
191
222
  case 2:
223
+ this.setStatus(IElementStatus.IN_BIZ_FLOW);
192
224
  paymentSession = options.paymentSession, displayInfo = options.displayInfo;
193
- _convertPaymentSessio = convertPaymentSession(paymentSession), paymentSessionId = _convertPaymentSessio.id, paymentSessionMetaData = _convertPaymentSessio.data;
225
+ _convertPaymentSessio2 = convertPaymentSession(paymentSession), paymentSessionId = _convertPaymentSessio2.id, paymentSessionMetaData = _convertPaymentSessio2.data;
194
226
  this.paymentContext = {
195
227
  initOptions: this.initOptions,
196
228
  startBizFlowOptions: options,
@@ -213,59 +245,59 @@ export var AntomSDKCore = /*#__PURE__*/function () {
213
245
  // Invoke processor
214
246
  productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
215
247
  paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
216
- _context3.prev = 13;
248
+ _context3.prev = 14;
217
249
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
218
- _context3.next = 20;
250
+ _context3.next = 21;
219
251
  break;
220
252
  }
221
- _context3.next = 17;
253
+ _context3.next = 18;
222
254
  return this.productProcessors["".concat(productScene, "|").concat(paymentMethod)].startBizFlow(this.paymentContext);
223
- case 17:
255
+ case 18:
224
256
  this.bizFlowStartBehavior = _context3.sent;
225
- _context3.next = 24;
257
+ _context3.next = 25;
226
258
  break;
227
- case 20:
259
+ case 21:
228
260
  if (!this.productProcessors["".concat(productScene)]) {
229
- _context3.next = 24;
261
+ _context3.next = 25;
230
262
  break;
231
263
  }
232
- _context3.next = 23;
264
+ _context3.next = 24;
233
265
  return this.productProcessors["".concat(productScene)].startBizFlow(this.paymentContext);
234
- case 23:
235
- this.bizFlowStartBehavior = _context3.sent;
236
266
  case 24:
237
- _context3.next = 29;
267
+ this.bizFlowStartBehavior = _context3.sent;
268
+ case 25:
269
+ _context3.next = 30;
238
270
  break;
239
- case 26:
240
- _context3.prev = 26;
241
- _context3.t0 = _context3["catch"](13);
271
+ case 27:
272
+ _context3.prev = 27;
273
+ _context3.t0 = _context3["catch"](14);
242
274
  console.error('Invoke processor failed', _context3.t0);
243
- case 29:
275
+ case 30:
244
276
  if (!(!this.bizFlowStartBehavior || this.bizFlowStartBehavior.behaviorType === 'NONE' || !this.bizFlowStartBehavior.payload)) {
245
- _context3.next = 31;
277
+ _context3.next = 32;
246
278
  break;
247
279
  }
248
280
  return _context3.abrupt("return");
249
- case 31:
281
+ case 32:
250
282
  if (!(this.bizFlowStartBehavior.behaviorType === 'RENDER')) {
251
- _context3.next = 34;
283
+ _context3.next = 35;
252
284
  break;
253
285
  }
254
286
  this.handleBehaviorRender();
255
287
  return _context3.abrupt("return");
256
- case 34:
288
+ case 35:
257
289
  if (!(this.bizFlowStartBehavior.behaviorType === 'REDIRECT')) {
258
- _context3.next = 38;
290
+ _context3.next = 39;
259
291
  break;
260
292
  }
261
293
  payload = (_this$bizFlowStartBeh = this.bizFlowStartBehavior) === null || _this$bizFlowStartBeh === void 0 ? void 0 : _this$bizFlowStartBeh.payload;
262
294
  redirect(payload, this.instanceId);
263
295
  return _context3.abrupt("return");
264
- case 38:
296
+ case 39:
265
297
  case "end":
266
298
  return _context3.stop();
267
299
  }
268
- }, _callee3, this, [[13, 26]]);
300
+ }, _callee3, this, [[14, 27]]);
269
301
  }));
270
302
  function startBizFlow(_x5) {
271
303
  return _startBizFlow.apply(this, arguments);
@@ -374,7 +406,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
374
406
  var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
375
407
  var containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
376
408
  var cleanElement = function cleanElement() {
377
- containerService.cleanContainer(_this3.paymentContext.displayInfo);
409
+ var _this3$paymentContext;
410
+ containerService.cleanContainer((_this3$paymentContext = _this3.paymentContext) === null || _this3$paymentContext === void 0 ? void 0 : _this3$paymentContext.displayInfo);
378
411
  cleanMockup();
379
412
  removeRetentionPopup();
380
413
  // TODO @/component this.removeEventListener();
@@ -391,6 +424,11 @@ export var AntomSDKCore = /*#__PURE__*/function () {
391
424
  cleanElement();
392
425
  }, 300);
393
426
  }
427
+ }, {
428
+ key: "getInstanceId",
429
+ value: function getInstanceId() {
430
+ return this.instanceId;
431
+ }
394
432
  }]);
395
433
  return AntomSDKCore;
396
434
  }();
@@ -28,6 +28,13 @@ export declare class DisplayInfo {
28
28
  selector: string;
29
29
  appearance?: Record<string, any>;
30
30
  appendAliasContainerId?: boolean;
31
+ merchantAppointParam?: {
32
+ storedCard: {
33
+ needCVV: boolean;
34
+ };
35
+ };
36
+ iframeStyle?: Partial<CSSStyleDeclaration>;
37
+ notRedirectAfterComplete?: boolean;
31
38
  constructor();
32
39
  }
33
40
  /**
@@ -73,3 +80,10 @@ export interface InitContext {
73
80
  initOptions: IoptionsParams;
74
81
  sdkMetaData: SDKMetaData;
75
82
  }
83
+ export declare enum IElementStatus {
84
+ UNINIT = "UNINIT",
85
+ INITING = "INITING",
86
+ READY = "READY",
87
+ IN_BIZ_FLOW = "IN_BIZ_FLOW",
88
+ DESTROYED = "DESTROYED"
89
+ }
@@ -7,7 +7,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
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
8
  import { DisplayTypeEnum, PlatformEnum } from "../types";
9
9
  import { isPC } from "../util";
10
-
11
10
  /**
12
11
  * @author 谦彧 <zhangmian.zm@alipay.com>
13
12
  * @date 2024/9/17
@@ -27,6 +26,9 @@ export var DisplayInfo = /*#__PURE__*/_createClass(function DisplayInfo() {
27
26
  _defineProperty(this, "appearance", void 0);
28
27
  // append selector name to containerId
29
28
  _defineProperty(this, "appendAliasContainerId", void 0);
29
+ _defineProperty(this, "merchantAppointParam", void 0);
30
+ _defineProperty(this, "iframeStyle", void 0);
31
+ _defineProperty(this, "notRedirectAfterComplete", void 0);
30
32
  this.platform = isPC() ? PlatformEnum.desktop : PlatformEnum.mobile;
31
33
  this.isRetention = true;
32
34
  this.type = DisplayTypeEnum.popup;
@@ -39,4 +41,13 @@ export var DisplayInfo = /*#__PURE__*/_createClass(function DisplayInfo() {
39
41
 
40
42
  /**
41
43
  * Provide some capability, such as MonitorService, EventBusService, SecurityService
42
- */
44
+ */
45
+
46
+ export var IElementStatus = /*#__PURE__*/function (IElementStatus) {
47
+ IElementStatus["UNINIT"] = "UNINIT";
48
+ IElementStatus["INITING"] = "INITING";
49
+ IElementStatus["READY"] = "READY";
50
+ IElementStatus["IN_BIZ_FLOW"] = "IN_BIZ_FLOW";
51
+ IElementStatus["DESTROYED"] = "DESTROYED";
52
+ return IElementStatus;
53
+ }({});
@@ -16,3 +16,5 @@ export type { RequesterService } from '../../service/requester/requester';
16
16
  export type { SecurityService } from '../../service/security';
17
17
  export { ProductInfoCacheUtil } from '../../utils/payment_product_utils';
18
18
  export * as WebAppUrlUtil from '../../utils/web_app_url_utils';
19
+ export { eventCodeEnum } from '../../../types';
20
+ export { EVENT } from '../../../constant';
@@ -9,4 +9,6 @@ export { ServiceProvider } from "../../service";
9
9
  export { LogService } from "../../service/log";
10
10
  export { ProductInfoCacheUtil } from "../../utils/payment_product_utils";
11
11
  import * as _WebAppUrlUtil from "../../utils/web_app_url_utils";
12
- export { _WebAppUrlUtil as WebAppUrlUtil };
12
+ export { _WebAppUrlUtil as WebAppUrlUtil };
13
+ export { eventCodeEnum } from "../../../types";
14
+ export { EVENT } from "../../../constant";
@@ -4,11 +4,14 @@ export declare class EasySafePayProcessor implements ProductProcessor {
4
4
  private initConfig;
5
5
  private logger;
6
6
  private securityService;
7
+ private eventCenter;
7
8
  private instanceId;
8
9
  private hostSign;
9
10
  private allowSubmitPayCallAhead;
10
11
  private channelBehavior?;
11
12
  private SECURITY_SDK_INIT_TIMEOUT;
13
+ private SDK_REQUEST_TIMEOUT;
14
+ private LOAD_APP_RESOURCES_TIMEOUT;
12
15
  init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
13
16
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
14
17
  private buildWebAppUrl;
@@ -17,7 +17,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
17
17
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
18
  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); }
19
19
  import PreloadHelper from "../../../foundation/utils/preload_helper";
20
- import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil } from "./deps";
20
+ import { ChannelCustomize, DisplayTypeEnum, getBackScheme, isPC, PaymentMethodCategoryTypeEnum, ProductInfoCacheUtil, ProductSceneEnum, RiskSdkInfoEnum, ServiceProvider, uuid, WebAppUrlUtil, EVENT, eventCodeEnum } from "./deps";
21
21
  export var EasySafePayProcessor = /*#__PURE__*/function () {
22
22
  function EasySafePayProcessor() {
23
23
  _classCallCheck(this, EasySafePayProcessor);
@@ -25,6 +25,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
25
25
  _defineProperty(this, "initConfig", void 0);
26
26
  _defineProperty(this, "logger", void 0);
27
27
  _defineProperty(this, "securityService", void 0);
28
+ _defineProperty(this, "eventCenter", void 0);
28
29
  _defineProperty(this, "instanceId", void 0);
29
30
  // 服务端接口区域信息,请求时决定API域名
30
31
  _defineProperty(this, "hostSign", void 0);
@@ -32,6 +33,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
32
33
  _defineProperty(this, "allowSubmitPayCallAhead", void 0);
33
34
  _defineProperty(this, "channelBehavior", void 0);
34
35
  _defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 18000);
36
+ _defineProperty(this, "SDK_REQUEST_TIMEOUT", 15000);
37
+ _defineProperty(this, "LOAD_APP_RESOURCES_TIMEOUT", 15000);
35
38
  }
36
39
  _createClass(EasySafePayProcessor, [{
37
40
  key: "init",
@@ -40,6 +43,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
40
43
  this.instanceId = instanceId;
41
44
  this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
42
45
  this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
46
+ this.eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
43
47
 
44
48
  // preload web app
45
49
  PreloadHelper.preloadWebApp(ProductSceneEnum.EASY_PAY, PaymentMethodCategoryTypeEnum.WALLET, this.initConfig.environment);
@@ -162,9 +166,12 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
162
166
  key: "sendRequestAndWaitWebLaunch",
163
167
  value: function sendRequestAndWaitWebLaunch() {
164
168
  var _this = this;
165
- var eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
166
- var webLaunchPromise = new Promise(function (resolve) {
167
- eventCenter.listen('onLaunch', function (res) {
169
+ var webLaunchPromise = new Promise(function (resolve, reject) {
170
+ var t = setTimeout(function () {
171
+ reject(new Error('Load resource timeout'));
172
+ }, _this.LOAD_APP_RESOURCES_TIMEOUT);
173
+ _this.eventCenter.listen('onLaunch', function (res) {
174
+ clearTimeout(t);
168
175
  resolve(res);
169
176
  });
170
177
  });
@@ -177,7 +184,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
177
184
  submitRes = _ref2[1],
178
185
  _webLaunchRes = _ref2[2];
179
186
  var logMetaData = _this.logger.getLogConfig().mdata;
180
- eventCenter.dispatchToApp({
187
+ _this.eventCenter.dispatchToApp({
181
188
  event: 'renderComponent',
182
189
  data: {
183
190
  sessionResult: (_this$paymentContext = _this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj,
@@ -207,6 +214,14 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
207
214
  })
208
215
  }
209
216
  });
217
+ }).catch(function (error) {
218
+ _this.eventCenter.emit(EVENT.destroy.name, {});
219
+ _this.eventCenter.emit(EVENT.eventCallback.name, {
220
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
221
+ result: {
222
+ message: error === null || error === void 0 ? void 0 : error.message
223
+ }
224
+ });
210
225
  });
211
226
  }
212
227
  }, {
@@ -270,25 +285,26 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
270
285
  _context2.t0 = requester;
271
286
  _context2.t1 = submitParams;
272
287
  _context2.t2 = this.initConfig.environment;
273
- _context2.next = 19;
288
+ _context2.t3 = this.SDK_REQUEST_TIMEOUT;
289
+ _context2.next = 20;
274
290
  return this.acquireApdidToken();
275
- case 19:
276
- _context2.t3 = _context2.sent;
277
- _context2.t4 = {
278
- deviceId: _context2.t3
291
+ case 20:
292
+ _context2.t4 = _context2.sent;
293
+ _context2.t5 = {
294
+ deviceId: _context2.t4
279
295
  };
280
- _context2.t5 = this.hostSign;
281
- _context2.t6 = {
296
+ _context2.t6 = this.hostSign;
297
+ _context2.t7 = {
282
298
  env: _context2.t2,
283
- timeout: 15000,
284
- envInfo: _context2.t4,
285
- hostSign: _context2.t5,
299
+ timeout: _context2.t3,
300
+ envInfo: _context2.t5,
301
+ hostSign: _context2.t6,
286
302
  needEnvInfo: true,
287
303
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
288
304
  };
289
- _context2.next = 25;
290
- return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t6);
291
- case 25:
305
+ _context2.next = 26;
306
+ return _context2.t0.request.call(_context2.t0, _context2.t1, _context2.t7);
307
+ case 26:
292
308
  res = _context2.sent;
293
309
  this.logger.logInfo({
294
310
  title: 'sdk_event_submitPayEnd'
@@ -298,23 +314,23 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
298
314
  rpcTraceId: res.traceId
299
315
  });
300
316
  return _context2.abrupt("return", res);
301
- case 30:
302
- _context2.prev = 30;
303
- _context2.t7 = _context2["catch"](13);
317
+ case 31:
318
+ _context2.prev = 31;
319
+ _context2.t8 = _context2["catch"](13);
304
320
  this.logger.logError({
305
321
  title: 'sdk_event_submitPay_failed'
306
322
  }, {
307
323
  config: JSON.stringify(submitParams.paymentSessionConfig),
308
- errorMessage: _context2.t7,
324
+ errorMessage: JSON.stringify(_context2.t8),
309
325
  requestId: requestBizId,
310
- rpcTraceId: _context2.t7 === null || _context2.t7 === void 0 ? void 0 : _context2.t7.traceId
326
+ rpcTraceId: _context2.t8 === null || _context2.t8 === void 0 ? void 0 : _context2.t8.traceId
311
327
  });
312
- throw _context2.t7;
313
- case 34:
328
+ return _context2.abrupt("return", null);
329
+ case 35:
314
330
  case "end":
315
331
  return _context2.stop();
316
332
  }
317
- }, _callee2, this, [[13, 30]]);
333
+ }, _callee2, this, [[13, 31]]);
318
334
  }));
319
335
  function processSubmitPay() {
320
336
  return _processSubmitPay.apply(this, arguments);
@@ -0,0 +1,7 @@
1
+ import { BizFlowStartBehavior, ProductProcessor } from "../..";
2
+ declare class ElementProcessor implements ProductProcessor {
3
+ constructor();
4
+ init(config: any, instanceId: string): any;
5
+ startBizFlow(): Promise<BizFlowStartBehavior>;
6
+ }
7
+ export { ElementProcessor };
@@ -0,0 +1,24 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ var ElementProcessor = /*#__PURE__*/function () {
8
+ function ElementProcessor() {
9
+ _classCallCheck(this, ElementProcessor);
10
+ }
11
+ _createClass(ElementProcessor, [{
12
+ key: "init",
13
+ value: function init(config, instanceId) {
14
+ return null;
15
+ }
16
+ }, {
17
+ key: "startBizFlow",
18
+ value: function startBizFlow() {
19
+ return null;
20
+ }
21
+ }]);
22
+ return ElementProcessor;
23
+ }();
24
+ export { ElementProcessor };
@@ -1,10 +1,12 @@
1
- import { DisplayInfo, SDKMetaData, Service } from '../../index';
2
1
  import { IoptionsParams } from '../../../types';
2
+ import { DisplayInfo, SDKMetaData, Service } from '../../index';
3
+ import { PopupManager } from './popup';
3
4
  export declare class ContainerService implements Service {
4
5
  private instanceId;
5
6
  private sdkMetaData;
7
+ private initMessageEvent;
6
8
  private clearTimerIdMapping;
7
- private popupManager;
9
+ popupManager: PopupManager;
8
10
  private eventCenter;
9
11
  private logService;
10
12
  private displayInfo;
@@ -14,7 +16,7 @@ export declare class ContainerService implements Service {
14
16
  destroy(): void;
15
17
  init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
16
18
  update(): void;
17
- load(displayInfo: DisplayInfo, url: string, closeBtnFunc: () => void): HTMLDivElement;
19
+ load(displayInfo: DisplayInfo, url: string, closeBtnFunc?: () => void): HTMLDivElement;
18
20
  cleanContainer(displayInfo: DisplayInfo): void;
19
21
  showLoading(container: HTMLDivElement, displayInfo: DisplayInfo): void;
20
22
  dismissLoading(isKeepMockup?: boolean): void;
@@ -27,4 +29,5 @@ export declare class ContainerService implements Service {
27
29
  private handleAppHeartBeat;
28
30
  private changeCloseBtnVisibility;
29
31
  private handleMaskCloseBtnShow;
32
+ getWebApp(): HTMLIFrameElement;
30
33
  }