@alipay/ams-checkout 0.0.1742280578-dev.1 → 0.0.1742285920-dev.1

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 (93) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +3 -1
  3. package/esm/component/channel.js +26 -62
  4. package/esm/component/component.inline.style.js +2 -2
  5. package/esm/component/popupWindow.style.js +4 -1
  6. package/esm/config/index.d.ts +8 -8
  7. package/esm/config/index.js +8 -8
  8. package/esm/constant/easysafepay.d.ts +16 -0
  9. package/esm/constant/easysafepay.js +19 -0
  10. package/esm/constant/index.d.ts +34 -2
  11. package/esm/constant/index.js +36 -5
  12. package/esm/core/component/ckp/index.d.ts +2 -0
  13. package/esm/core/component/ckp/index.js +39 -5
  14. package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
  15. package/esm/core/component/element/elementContainerService/containerService.js +123 -0
  16. package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
  17. package/esm/core/component/element/elementContainerService/index.js +63 -0
  18. package/esm/core/component/element/elementController/index.d.ts +27 -0
  19. package/esm/core/component/element/elementController/index.js +485 -0
  20. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
  21. package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
  22. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
  23. package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
  24. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
  25. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
  26. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
  27. package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
  28. package/esm/core/component/element/index.d.ts +7 -46
  29. package/esm/core/component/element/index.js +31 -923
  30. package/esm/core/component/element/mock.d.ts +4 -0
  31. package/esm/core/component/element/mock.js +365 -1
  32. package/esm/core/component/element/type.d.ts +45 -19
  33. package/esm/core/component/element/util.d.ts +69 -0
  34. package/esm/core/component/element/util.js +477 -0
  35. package/esm/core/component/index.d.ts +5 -1
  36. package/esm/core/component/index.js +1 -2
  37. package/esm/core/component/oldElement/index.d.ts +59 -0
  38. package/esm/core/component/oldElement/index.js +956 -0
  39. package/esm/core/component/oldElement/mock.d.ts +6 -0
  40. package/esm/core/component/oldElement/mock.js +567 -0
  41. package/esm/core/component/oldElement/type.d.ts +354 -0
  42. package/esm/core/component/oldElement/type.js +81 -0
  43. package/esm/core/instance/index.d.ts +1 -1
  44. package/esm/core/instance/index.js +1 -1
  45. package/esm/foundation/core/index.d.ts +9 -1
  46. package/esm/foundation/core/index.js +153 -49
  47. package/esm/foundation/index.d.ts +20 -0
  48. package/esm/foundation/index.js +13 -2
  49. package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
  50. package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
  51. package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
  52. package/esm/foundation/product-processor/autoDebit/index.js +466 -0
  53. package/esm/foundation/product-processor/easysafepay/deps.d.ts +3 -1
  54. package/esm/foundation/product-processor/easysafepay/deps.js +3 -1
  55. package/esm/foundation/product-processor/easysafepay/index.d.ts +5 -0
  56. package/esm/foundation/product-processor/easysafepay/index.js +267 -128
  57. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  58. package/esm/foundation/product-processor/element/index.js +24 -0
  59. package/esm/foundation/service/container/index.d.ts +12 -3
  60. package/esm/foundation/service/container/index.js +145 -16
  61. package/esm/foundation/service/container/popup.d.ts +1 -1
  62. package/esm/foundation/service/event-center.js +1 -0
  63. package/esm/foundation/service/log/keys.js +3 -1
  64. package/esm/foundation/service/log/types.d.ts +1 -0
  65. package/esm/foundation/service/requester/requester.js +5 -4
  66. package/esm/foundation/utils/preload_helper.d.ts +2 -2
  67. package/esm/foundation/utils/preload_helper.js +8 -4
  68. package/esm/foundation/utils/redirect_utils.js +34 -18
  69. package/esm/foundation/utils/web_app_url_utils.d.ts +71 -1
  70. package/esm/foundation/utils/web_app_url_utils.js +219 -8
  71. package/esm/index.d.ts +7 -4
  72. package/esm/index.js +98 -48
  73. package/esm/plugin/component/cashierApp.d.ts +1 -1
  74. package/esm/plugin/component/cashierApp.js +5 -5
  75. package/esm/plugin/component/channel.d.ts +3 -1
  76. package/esm/plugin/component/channel.js +10 -12
  77. package/esm/plugin/component/index.js +47 -44
  78. package/esm/plugin/type.d.ts +1 -1
  79. package/esm/types/index.d.ts +37 -3
  80. package/esm/types/index.js +10 -2
  81. package/esm/util/index.d.ts +7 -1
  82. package/esm/util/index.js +10 -1
  83. package/esm/util/redirect.d.ts +6 -0
  84. package/esm/util/redirect.js +54 -0
  85. package/package.json +27 -4
  86. /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
  87. /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
  88. /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
  89. /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
  90. /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
  91. /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
  92. /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
  93. /package/esm/core/component/{element → oldElement}/utils.js +0 -0
@@ -0,0 +1,466 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
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); }
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; }
8
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ 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; }
11
+ 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); } }
12
+ 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); }); }; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ 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); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ 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; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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
+ import { ComponentSignEnum, COMPONENT_CONTAINER_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, eventCodeEnum, getComponentSign, getWebAppV2Url, isLocalMock, isPC, LOADTIME_LIMIT, PlatformEnum, ServiceProvider } from "./deps";
20
+ var defaultActionQueryResponse = {
21
+ message: 'sdk no need to make query request',
22
+ success: true
23
+ };
24
+ export var AutoDebitProcessor = /*#__PURE__*/function () {
25
+ function AutoDebitProcessor() {
26
+ _classCallCheck(this, AutoDebitProcessor);
27
+ _defineProperty(this, "paymentContext", void 0);
28
+ _defineProperty(this, "initConfig", void 0);
29
+ _defineProperty(this, "logger", void 0);
30
+ _defineProperty(this, "eventCenter", void 0);
31
+ _defineProperty(this, "securityService", void 0);
32
+ _defineProperty(this, "instanceId", void 0);
33
+ _defineProperty(this, "componentSign", void 0);
34
+ // 服务端接口区域信息,请求时决定API域名
35
+ _defineProperty(this, "hostSign", void 0);
36
+ _defineProperty(this, "_performanceData", []);
37
+ // 安全SDK初始化超时时间
38
+ _defineProperty(this, "SECURITY_SDK_INIT_TIMEOUT", 1500);
39
+ }
40
+ _createClass(AutoDebitProcessor, [{
41
+ key: "init",
42
+ value: function init(config, instanceId, sdkMetaData) {
43
+ this.initConfig = config;
44
+ this.instanceId = instanceId;
45
+ this.logger = ServiceProvider.getInstance(this.instanceId).getService('Log');
46
+ this.eventCenter = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
47
+ this.securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
48
+ this._performanceData.push({
49
+ key: 'sdk_init',
50
+ value: Date.now()
51
+ });
52
+ }
53
+ }, {
54
+ key: "startBizFlow",
55
+ value: function () {
56
+ var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(paymentContext) {
57
+ var _this$paymentContext;
58
+ var _this$paymentContext$, action, _this$paymentContext$2, authUrlInfo, _action$web, _action$wap, signType, requireFastSdk, webAppUrl, renderBehavior;
59
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
60
+ while (1) switch (_context.prev = _context.next) {
61
+ case 0:
62
+ this.paymentContext = paymentContext;
63
+ this.componentSign = getComponentSign((_this$paymentContext = this.paymentContext) === null || _this$paymentContext === void 0 ? void 0 : _this$paymentContext.paymentSessionObj);
64
+ this.hostSign = ((paymentContext === null || paymentContext === void 0 ? void 0 : paymentContext.paymentSession) || '').split('&&')[1] || '';
65
+ _this$paymentContext$ = this.paymentContext.paymentSessionObj, action = _this$paymentContext$.action, _this$paymentContext$2 = _this$paymentContext$.authUrlInfo, authUrlInfo = _this$paymentContext$2 === void 0 ? {} : _this$paymentContext$2;
66
+ if (!(this.componentSign === ComponentSignEnum.AUTO_DEBIT_WALLET)) {
67
+ _context.next = 9;
68
+ break;
69
+ }
70
+ signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
71
+ requireFastSdk = (action === null || action === void 0 ? void 0 : action.requireFastSdk) || false;
72
+ if (!(signType === 'REDIRECT' && requireFastSdk === true)) {
73
+ _context.next = 9;
74
+ break;
75
+ }
76
+ return _context.abrupt("return", this.buildRedirectResult(authUrlInfo));
77
+ case 9:
78
+ webAppUrl = this.buildWebAppUrl();
79
+ renderBehavior = {
80
+ url: webAppUrl,
81
+ allowClickPopupOutsideClose: this.componentSign === ComponentSignEnum.AUTO_DEBIT_WALLET
82
+ };
83
+ this.sendRequestAndWaitWebLaunch();
84
+ return _context.abrupt("return", {
85
+ behaviorType: 'RENDER',
86
+ payload: renderBehavior
87
+ });
88
+ case 13:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }, _callee, this);
93
+ }));
94
+ function startBizFlow(_x) {
95
+ return _startBizFlow.apply(this, arguments);
96
+ }
97
+ return startBizFlow;
98
+ }()
99
+ }, {
100
+ key: "acquireApdidToken",
101
+ value: function () {
102
+ var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
103
+ var _this$paymentContext$3;
104
+ var productScene, deviceId;
105
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
106
+ while (1) switch (_context2.prev = _context2.next) {
107
+ case 0:
108
+ productScene = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentSessionConfig) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.productScene;
109
+ deviceId = this.securityService.getDeviceId({
110
+ productScene: productScene
111
+ });
112
+ return _context2.abrupt("return", deviceId);
113
+ case 3:
114
+ case "end":
115
+ return _context2.stop();
116
+ }
117
+ }, _callee2, this);
118
+ }));
119
+ function acquireApdidToken() {
120
+ return _acquireApdidToken.apply(this, arguments);
121
+ }
122
+ return acquireApdidToken;
123
+ }()
124
+ /**
125
+ * 获取SDK操作查询请求
126
+ * @returns {Promise<CashierSdkActionQueryRequest | { message?: string; success: boolean }>} 返回SDK操作查询请求或错误信息
127
+ */
128
+ }, {
129
+ key: "getSdkActionQuery",
130
+ value: (function () {
131
+ var _getSdkActionQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
132
+ var requestService, _this$paymentContext2, paymentSession, paymentSessionObj, _this$initConfig, environment, locale, _ref, paymentSessionConfig, action, web, wap, signType, params, res;
133
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
134
+ while (1) switch (_context3.prev = _context3.next) {
135
+ case 0:
136
+ // 获取请求服务实例
137
+ requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
138
+ _this$paymentContext2 = this.paymentContext, paymentSession = _this$paymentContext2.paymentSession, paymentSessionObj = _this$paymentContext2.paymentSessionObj; // 获取初始化配置中的环境和区域设置
139
+ _this$initConfig = this.initConfig, environment = _this$initConfig.environment, locale = _this$initConfig.locale;
140
+ _ref = paymentSessionObj || {}, paymentSessionConfig = _ref.paymentSessionConfig, action = _ref.action;
141
+ if (!(this.componentSign === ComponentSignEnum.AUTO_DEBIT_WALLET)) {
142
+ _context3.next = 11;
143
+ break;
144
+ }
145
+ web = action.web, wap = action.wap;
146
+ signType = isPC() ? web === null || web === void 0 ? void 0 : web.signType : wap === null || wap === void 0 ? void 0 : wap.signType; // 如果签名类型为SMS,则返回默认操作查询响应
147
+ if (!(signType === 'SMS')) {
148
+ _context3.next = 9;
149
+ break;
150
+ }
151
+ return _context3.abrupt("return", Promise.resolve(defaultActionQueryResponse));
152
+ case 9:
153
+ if (!(!signType || signType !== 'REDIRECT')) {
154
+ _context3.next = 11;
155
+ break;
156
+ }
157
+ return _context3.abrupt("return", Promise.resolve({
158
+ success: false
159
+ }));
160
+ case 11:
161
+ if (!isLocalMock()) {
162
+ _context3.next = 13;
163
+ break;
164
+ }
165
+ return _context3.abrupt("return", Promise.resolve(defaultActionQueryResponse));
166
+ case 13:
167
+ this._performanceData.push({
168
+ key: 'sdk_action_query_start',
169
+ value: Date.now()
170
+ });
171
+ // 构造请求参数
172
+ params = {
173
+ paymentSessionConfig: paymentSessionConfig,
174
+ paymentSessionData: paymentSession
175
+ };
176
+ _context3.prev = 15;
177
+ _context3.t0 = requestService;
178
+ _context3.t1 = params;
179
+ _context3.t2 = environment;
180
+ _context3.t3 = locale;
181
+ _context3.next = 22;
182
+ return this.acquireApdidToken();
183
+ case 22:
184
+ _context3.t4 = _context3.sent;
185
+ _context3.t5 = {
186
+ locale: _context3.t3,
187
+ deviceId: _context3.t4
188
+ };
189
+ _context3.t6 = this.hostSign;
190
+ _context3.t7 = {
191
+ env: _context3.t2,
192
+ envInfo: _context3.t5,
193
+ hostSign: _context3.t6,
194
+ needEnvInfo: true,
195
+ 'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
196
+ };
197
+ _context3.next = 28;
198
+ return _context3.t0.request.call(_context3.t0, _context3.t1, _context3.t7);
199
+ case 28:
200
+ res = _context3.sent;
201
+ this._performanceData.push({
202
+ key: 'sdk_action_query_end',
203
+ value: Date.now()
204
+ });
205
+ // 记录日志
206
+ this.logger.logInfo({
207
+ title: 'sdk_event_sdkQueryEnd'
208
+ }, {
209
+ config: JSON.stringify(paymentSessionConfig),
210
+ rpcTraceId: res.traceId
211
+ });
212
+ return _context3.abrupt("return", res);
213
+ case 34:
214
+ _context3.prev = 34;
215
+ _context3.t8 = _context3["catch"](15);
216
+ // 记录错误日志
217
+ this.logger.logError({
218
+ title: 'sdk_event_sdkQuery_failed'
219
+ }, {
220
+ config: JSON.stringify(paymentSessionConfig),
221
+ errorMessage: JSON.stringify(_context3.t8),
222
+ rpcTraceId: _context3.t8 === null || _context3.t8 === void 0 ? void 0 : _context3.t8.traceId
223
+ });
224
+ return _context3.abrupt("return", Promise.reject());
225
+ case 38:
226
+ case "end":
227
+ return _context3.stop();
228
+ }
229
+ }, _callee3, this, [[15, 34]]);
230
+ }));
231
+ function getSdkActionQuery() {
232
+ return _getSdkActionQuery.apply(this, arguments);
233
+ }
234
+ return getSdkActionQuery;
235
+ }()
236
+ /**
237
+ * webLaunchPromise方法用于返回一个Promise对象,用于异步加载Web App
238
+ * @returns {Promise} 返回一个Promise对象
239
+ */
240
+ )
241
+ }, {
242
+ key: "webLaunchPromise",
243
+ value: function webLaunchPromise() {
244
+ var _this = this;
245
+ this._performanceData.push({
246
+ key: 'sdk_onLaunch',
247
+ value: Date.now()
248
+ });
249
+ return new Promise(function (resolve, reject) {
250
+ var t = setTimeout(function () {
251
+ // 超时处理
252
+ reject(new Error('Load resource timeout'));
253
+ _this.eventCenter.dispatchToApp({
254
+ event: EVENT.error.name,
255
+ data: ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT
256
+ });
257
+ _this.logger.logError({
258
+ title: 'sdk_error_web_app_timeout'
259
+ });
260
+ }, LOADTIME_LIMIT);
261
+ // 监听onLaunch事件,清除超时计时器
262
+ _this.eventCenter.listen('onLaunch', function (res) {
263
+ clearTimeout(t);
264
+ resolve(res);
265
+ });
266
+ });
267
+ }
268
+ }, {
269
+ key: "sendRequestAndWaitWebLaunch",
270
+ value: function sendRequestAndWaitWebLaunch() {
271
+ var _this2 = this;
272
+ var _ref2 = this.paymentContext || {},
273
+ _ref2$paymentSessionO = _ref2.paymentSessionObj,
274
+ paymentSessionObj = _ref2$paymentSessionO === void 0 ? {} : _ref2$paymentSessionO,
275
+ paymentSessionId = _ref2.paymentSessionId,
276
+ displayInfo = _ref2.displayInfo,
277
+ startBizFlowOptions = _ref2.startBizFlowOptions;
278
+ // 等请求和 Web启动都Ready之后,发送renderComponent
279
+ Promise.all([this.webLaunchPromise(), this.getSdkActionQuery(), this.initSecuritySDK()]).then(function (_ref3) {
280
+ var _startBizFlowOptions$, _startBizFlowOptions$2;
281
+ var _ref4 = _slicedToArray(_ref3, 2),
282
+ _webLaunchPromise = _ref4[0],
283
+ actionQuery = _ref4[1];
284
+ _this2._performanceData.push({
285
+ key: 'sdk_render_component',
286
+ value: Date.now()
287
+ });
288
+ var logMetaData = _this2.logger.getLogConfig().mdata;
289
+ _this2.eventCenter.dispatchToApp({
290
+ event: 'renderComponent',
291
+ data: {
292
+ queryResult: actionQuery,
293
+ sessionResult: paymentSessionObj,
294
+ paymentSessionData: paymentSessionId,
295
+ heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
296
+ renderDisplayType: displayInfo.type,
297
+ appearance: displayInfo === null || displayInfo === void 0 ? void 0 : displayInfo.appearance,
298
+ notRedirectAfterComplete: ((_startBizFlowOptions$ = startBizFlowOptions.submitPayRequestExtra) === null || _startBizFlowOptions$ === void 0 ? void 0 : _startBizFlowOptions$.notRedirectAfterComplete) === true,
299
+ isAppWebview: startBizFlowOptions.isAppWebview,
300
+ merchantAppointParam: (_startBizFlowOptions$2 = startBizFlowOptions.submitPayRequestExtra) === null || _startBizFlowOptions$2 === void 0 ? void 0 : _startBizFlowOptions$2.merchantAppointParam,
301
+ envInfo: {
302
+ screenHeight: screen.height,
303
+ screenWidth: screen.width
304
+ },
305
+ logMetaData: _objectSpread(_objectSpread({
306
+ trackId: logMetaData.requestSeq,
307
+ platform: logMetaData.platform,
308
+ firstLogTime: logMetaData.firstLogTime
309
+ }, (paymentSessionObj === null || paymentSessionObj === void 0 ? void 0 : paymentSessionObj.paymentSessionConfig) || {}), {}, {
310
+ renderDisplayType: logMetaData.renderDisplayType,
311
+ sdkVersion: logMetaData.sdkVersion,
312
+ merchantId: logMetaData.merchantId,
313
+ instanceId: logMetaData.instanceId,
314
+ paymentMethodType: logMetaData.paymentMethodType
315
+ })
316
+ }
317
+ });
318
+ _this2.logger.logInfo({
319
+ title: 'sdk_event_renderComponent'
320
+ });
321
+ _this2.eventCenter.dispatchToApp({
322
+ event: 'web-sdk-performance',
323
+ data: {
324
+ performanceData: _this2._performanceData
325
+ }
326
+ });
327
+ _this2.setAchAutoDebitContainerWidth();
328
+ }).catch(function (error) {
329
+ _this2.eventCenter.emit(EVENT.destroy.name, {});
330
+ _this2.eventCenter.emit(EVENT.eventCallback.name, {
331
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
332
+ message: error === null || error === void 0 ? void 0 : error.message
333
+ });
334
+ });
335
+ }
336
+ }, {
337
+ key: "buildRedirectResult",
338
+ value: function buildRedirectResult(authUrlInfo) {
339
+ var data;
340
+ if (!(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.normalUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.schemeUrl) && !(authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.applinkUrl) && authUrlInfo !== null && authUrlInfo !== void 0 && authUrlInfo.authUrl) {
341
+ data = {
342
+ url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
343
+ schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl,
344
+ applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.authUrl
345
+ };
346
+ } else {
347
+ data = {
348
+ url: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.normalUrl,
349
+ schemeUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.schemeUrl,
350
+ applinkUrl: authUrlInfo === null || authUrlInfo === void 0 ? void 0 : authUrlInfo.applinkUrl
351
+ };
352
+ }
353
+ var result = {
354
+ behaviorType: 'REDIRECT',
355
+ payload: data
356
+ };
357
+ return result;
358
+ }
359
+
360
+ /**
361
+ * 构建 Web App 的 URL
362
+ * @returns {string} Web App 的 URL
363
+ */
364
+ }, {
365
+ key: "buildWebAppUrl",
366
+ value: function buildWebAppUrl() {
367
+ var _paymentSessionObj$pa, _paymentSessionObj$pa2, _paymentSessionObj$pa3, _this$initConfig$anal;
368
+ var _this$paymentContext3 = this.paymentContext,
369
+ displayInfo = _this$paymentContext3.displayInfo,
370
+ sdkMetaData = _this$paymentContext3.sdkMetaData,
371
+ paymentSessionObj = _this$paymentContext3.paymentSessionObj;
372
+ var paymentMethodCategoryType = (_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.paymentMethodCategoryType;
373
+ var productScene = (_paymentSessionObj$pa2 = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa2 === void 0 ? void 0 : _paymentSessionObj$pa2.productScene;
374
+ var productSceneVersion = (_paymentSessionObj$pa3 = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa3 === void 0 ? void 0 : _paymentSessionObj$pa3.productSceneVersion;
375
+ var hostSign = this.hostSign;
376
+ var mid = paymentSessionObj.clientId;
377
+ var extendInfo = paymentSessionObj.extendInfo;
378
+ // 构建 Web App 的 URL
379
+ var webAppUrl = getWebAppV2Url({
380
+ environment: this.initConfig.environment,
381
+ paymentMethodCategoryType: paymentMethodCategoryType,
382
+ sdkMetaData: sdkMetaData,
383
+ productScene: productScene,
384
+ productSceneVersion: productSceneVersion,
385
+ isPreload: false,
386
+ query: {
387
+ analyticsEnabled: (_this$initConfig$anal = this.initConfig.analytics) === null || _this$initConfig$anal === void 0 ? void 0 : _this$initConfig$anal.enabled,
388
+ displayType: displayInfo.type,
389
+ instanceId: this.instanceId,
390
+ locale: this.initConfig.locale,
391
+ hostSign: hostSign
392
+ },
393
+ mid: mid,
394
+ extendInfo: extendInfo
395
+ });
396
+ return webAppUrl;
397
+ // // 调试地址
398
+ // const urlObj = new URL(webAppUrl);
399
+ // return `${`http://svc-2qdwgpbkf7s1rw3k.cloudide.svc.et15-sqa.alipay.net:5175/auto-debit/src/pages/trustly/index.html`}?${urlObj.searchParams.toString()}`;
400
+ }
401
+
402
+ /**
403
+ * 初始化安全SDK
404
+ * @returns {Promise}
405
+ */
406
+ }, {
407
+ key: "initSecuritySDK",
408
+ value: (function () {
409
+ var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
410
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
411
+ while (1) switch (_context4.prev = _context4.next) {
412
+ case 0:
413
+ _context4.prev = 0;
414
+ _context4.next = 3;
415
+ return this.securityService.initSecurity(this.SECURITY_SDK_INIT_TIMEOUT);
416
+ case 3:
417
+ return _context4.abrupt("return", _context4.sent);
418
+ case 6:
419
+ _context4.prev = 6;
420
+ _context4.t0 = _context4["catch"](0);
421
+ return _context4.abrupt("return", Promise.resolve());
422
+ case 9:
423
+ case "end":
424
+ return _context4.stop();
425
+ }
426
+ }, _callee4, this, [[0, 6]]);
427
+ }));
428
+ function initSecuritySDK() {
429
+ return _initSecuritySDK.apply(this, arguments);
430
+ }
431
+ return initSecuritySDK;
432
+ }()
433
+ /**
434
+ * 设置容器宽度
435
+ * 如果是 Trustly 支付方式,并且显示平台为桌面端,则设置组件区块和容器的最大宽度为 656px
436
+ */
437
+ )
438
+ }, {
439
+ key: "setAchAutoDebitContainerWidth",
440
+ value: function setAchAutoDebitContainerWidth() {
441
+ // 判断是否为 Trustly 支付方式
442
+ if (this.isTrustly) {
443
+ var _this$paymentContext4;
444
+ // 判断显示平台是否为桌面端
445
+ if (((_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.displayInfo) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.platform) === PlatformEnum.desktop) {
446
+ var _document$getElementB, _document$getElementB2;
447
+ // 设置组件区块的最大宽度为 656px
448
+ (_document$getElementB = document.getElementById(COMPONENT_SECTION_ID)) === null || _document$getElementB === void 0 || _document$getElementB.setAttribute('style', 'max-width: 656px');
449
+ // 设置容器的最大宽度为 656px
450
+ (_document$getElementB2 = document.getElementById(COMPONENT_CONTAINER_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.setAttribute('style', 'max-width: 656px');
451
+ }
452
+ }
453
+ }
454
+
455
+ /**
456
+ * 判断是否为Trustly支付方式
457
+ * @returns {boolean} true 表示是Trustly支付方式
458
+ */
459
+ }, {
460
+ key: "isTrustly",
461
+ get: function get() {
462
+ return this.componentSign === ComponentSignEnum.AUTO_DEBIT_APM;
463
+ }
464
+ }]);
465
+ return AutoDebitProcessor;
466
+ }();
@@ -4,7 +4,7 @@ export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBe
4
4
  export * as ChannelCustomize from '../../../component/channel';
5
5
  export type { IChannelBehavior } from '../../../component/channel';
6
6
  export { DisplayTypeEnum, PaymentMethodCategoryTypeEnum, ProductSceneEnum, RiskSdkInfoEnum } from '../../../types';
7
- export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
7
+ export type { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSdkActionQuerySessionResult, CashierSubmitPayRequest, CashierSubmitPayResult, IoptionsParams, } from '../../../types';
8
8
  export { isPC } from '../../../util';
9
9
  export { getBackScheme } from '../../utils/redirect_utils';
10
10
  export { isLocalMock } from '../../../util/mock';
@@ -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,15 @@ 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;
10
+ private allowQueryCall;
9
11
  private allowSubmitPayCallAhead;
10
12
  private channelBehavior?;
11
13
  private SECURITY_SDK_INIT_TIMEOUT;
14
+ private SDK_REQUEST_TIMEOUT;
15
+ private LOAD_APP_RESOURCES_TIMEOUT;
12
16
  init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
13
17
  startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
14
18
  private buildWebAppUrl;
@@ -18,6 +22,7 @@ export declare class EasySafePayProcessor implements ProductProcessor {
18
22
  * start waiting web launch, then send renderComponent event
19
23
  * */
20
24
  private sendRequestAndWaitWebLaunch;
25
+ private processQuery;
21
26
  private processSubmitPay;
22
27
  private acquireApdidToken;
23
28
  private initSecuritySDK;