@alipay/ams-checkout 0.0.1730107332-dev.3 → 0.0.1730107332-dev.30

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 (102) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +2 -3
  3. package/esm/component/channel.js +65 -30
  4. package/esm/component/component.inline.style.js +1 -1
  5. package/esm/component/component.popup.style.d.ts +1 -3
  6. package/esm/component/component.popup.style.js +1 -3
  7. package/esm/config/index.d.ts +7 -7
  8. package/esm/config/index.js +7 -7
  9. package/esm/constant/index.d.ts +3 -0
  10. package/esm/constant/index.js +3 -0
  11. package/esm/core/bus/ability/callback.d.ts +9 -0
  12. package/esm/core/bus/ability/callback.js +55 -0
  13. package/esm/core/bus/ability/security.d.ts +10 -0
  14. package/esm/core/bus/ability/security.js +104 -0
  15. package/esm/core/bus/ability/tracker.d.ts +9 -0
  16. package/esm/core/bus/ability/tracker.js +77 -0
  17. package/esm/core/bus/index.d.ts +125 -0
  18. package/esm/core/bus/index.js +366 -0
  19. package/esm/core/bus/interface.d.ts +36 -0
  20. package/esm/core/bus/interface.js +40 -0
  21. package/esm/core/component/address.d.ts +8 -0
  22. package/esm/core/component/address.js +72 -0
  23. package/esm/core/component/appPreloadProcessing.d.ts +1 -0
  24. package/esm/core/component/appPreloadProcessing.js +89 -0
  25. package/esm/core/component/ckp/index.d.ts +27 -0
  26. package/esm/core/component/ckp/index.js +166 -0
  27. package/esm/core/component/index.d.ts +51 -0
  28. package/esm/core/component/index.js +531 -0
  29. package/esm/core/drop-in/index.d.ts +22 -0
  30. package/esm/core/drop-in/index.js +104 -0
  31. package/esm/core/instance/index.d.ts +89 -0
  32. package/esm/core/instance/index.js +499 -0
  33. package/esm/foundation/core/index.d.ts +2 -2
  34. package/esm/foundation/core/index.js +8 -4
  35. package/esm/foundation/index.d.ts +8 -5
  36. package/esm/foundation/product-processor/easysafepay/deps.d.ts +5 -4
  37. package/esm/foundation/product-processor/easysafepay/deps.js +3 -2
  38. package/esm/foundation/product-processor/easysafepay/index.d.ts +2 -3
  39. package/esm/foundation/product-processor/easysafepay/index.js +115 -231
  40. package/esm/foundation/service/api-bus/index.d.ts +2 -2
  41. package/esm/foundation/service/container/index.d.ts +2 -2
  42. package/esm/foundation/service/container/index.js +0 -1
  43. package/esm/foundation/service/event-center.d.ts +4 -4
  44. package/esm/foundation/service/event-center.js +10 -10
  45. package/esm/foundation/service/global-data/index.d.ts +2 -2
  46. package/esm/foundation/service/index.d.ts +2 -2
  47. package/esm/foundation/service/log/index.d.ts +2 -2
  48. package/esm/foundation/service/requester/deps.d.ts +1 -1
  49. package/esm/foundation/service/requester/requester.d.ts +2 -2
  50. package/esm/foundation/service/security/index.d.ts +2 -2
  51. package/esm/foundation/service/security/index.js +1 -0
  52. package/esm/foundation/utils/redirect_utils.d.ts +5 -0
  53. package/esm/foundation/utils/redirect_utils.js +178 -24
  54. package/esm/foundation/utils/web_app_url_utils.js +1 -1
  55. package/esm/index.d.ts +27 -2
  56. package/esm/index.js +133 -7
  57. package/esm/plugin/applepay/component.d.ts +50 -0
  58. package/esm/plugin/applepay/component.js +339 -0
  59. package/esm/plugin/applepay/index.d.ts +17 -0
  60. package/esm/plugin/applepay/index.js +117 -0
  61. package/esm/plugin/applepay/interface.d.ts +161 -0
  62. package/esm/plugin/applepay/interface.js +69 -0
  63. package/esm/plugin/applepay/service.d.ts +54 -0
  64. package/esm/plugin/applepay/service.js +289 -0
  65. package/esm/plugin/component/cashierApp.d.ts +34 -0
  66. package/esm/plugin/component/cashierApp.js +237 -0
  67. package/esm/plugin/component/channel.d.ts +21 -0
  68. package/esm/plugin/component/channel.js +89 -0
  69. package/esm/plugin/component/component.inline.style.d.ts +10 -0
  70. package/esm/plugin/component/component.inline.style.js +119 -0
  71. package/esm/plugin/component/component.popup.style.d.ts +16 -0
  72. package/esm/plugin/component/component.popup.style.js +174 -0
  73. package/esm/plugin/component/index.d.ts +126 -0
  74. package/esm/plugin/component/index.js +1839 -0
  75. package/esm/plugin/component/popupWindow.style.d.ts +11 -0
  76. package/esm/plugin/component/popupWindow.style.js +121 -0
  77. package/esm/plugin/const.d.ts +2 -0
  78. package/esm/plugin/const.js +33 -0
  79. package/esm/plugin/drop-in/index.d.ts +71 -0
  80. package/esm/plugin/drop-in/index.js +324 -0
  81. package/esm/plugin/payment-element/utils.d.ts +2 -0
  82. package/esm/plugin/payment-element/utils.js +6 -0
  83. package/esm/plugin/paypal/index.d.ts +20 -0
  84. package/esm/plugin/paypal/index.js +390 -0
  85. package/esm/plugin/type.d.ts +34 -0
  86. package/esm/plugin/type.js +1 -0
  87. package/esm/plugin/utils.d.ts +6 -0
  88. package/esm/plugin/utils.js +21 -0
  89. package/esm/types/index.d.ts +10 -11
  90. package/esm/types/index.js +2 -1
  91. package/esm/util/createIframeNode.d.ts +6 -0
  92. package/esm/util/createIframeNode.js +48 -0
  93. package/esm/util/getBackScheme.d.ts +5 -0
  94. package/esm/util/getBackScheme.js +134 -0
  95. package/esm/util/index.d.ts +1 -1
  96. package/esm/util/index.js +4 -3
  97. package/esm/util/intl-callapp/es/index.js +0 -1
  98. package/esm/util/security.d.ts +33 -0
  99. package/esm/util/security.js +182 -0
  100. package/package.json +2 -2
  101. package/esm/foundation/types/index.d.ts +0 -4
  102. package/esm/foundation/types/index.js +0 -4
@@ -0,0 +1,390 @@
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 _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
+ 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
+ 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); }); }; }
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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
+ 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
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
19
+ 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); }
20
+ import { BusManager, BusMessage, BusSubscriber } from "../../core/bus";
21
+ import { PaypalActionEnum, SDKCallbackActionEnum } from "../../core/bus/interface";
22
+ import { queryPaymentInfo } from "../../service";
23
+ import { eventCodeEnum, payPalConfigurationIntentEnum, PaypalMethodEnum } from "../../types";
24
+ import { isFunction } from "../../util";
25
+ import { appendLoadingIcon, isShowLoading } from "../utils";
26
+ export var PaypalBusSubscriber = /*#__PURE__*/function (_BusSubscriber) {
27
+ _inherits(PaypalBusSubscriber, _BusSubscriber);
28
+ var _super = _createSuper(PaypalBusSubscriber);
29
+ function PaypalBusSubscriber(logger) {
30
+ var _this;
31
+ _classCallCheck(this, PaypalBusSubscriber);
32
+ _this = _super.call(this);
33
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
34
+ _defineProperty(_assertThisInitialized(_this), "onEventCallback", function (state) {
35
+ BusManager.publish(new BusMessage(SDKCallbackActionEnum.onEventCallback, JSON.stringify(state)));
36
+ });
37
+ _defineProperty(_assertThisInitialized(_this), "appendPaypalLoading", function (_ref) {
38
+ var selector = _ref.selector;
39
+ if (document.querySelector('.paypal-loading')) {
40
+ return;
41
+ }
42
+ var container = document.querySelector(selector);
43
+ container.innerHTML = '';
44
+ var loadingDiv = document.createElement('div');
45
+ loadingDiv.className = 'paypal-loading';
46
+ loadingDiv.style.backgroundColor = '#EBEBEB';
47
+ loadingDiv.style.width = '100%';
48
+ loadingDiv.style.height = '64px';
49
+ loadingDiv.style.borderRadius = '4px';
50
+ var loadingImage = document.createElement('div');
51
+ loadingImage.style.position = 'absolute';
52
+ loadingImage.style.top = '50%';
53
+ loadingImage.style.left = '50%';
54
+ loadingImage.style.transform = 'translate(-50%, -50%)';
55
+ loadingDiv.style.maxWidth = '750px';
56
+ loadingDiv.style.position = 'relative';
57
+ appendLoadingIcon({
58
+ htmlElement: loadingImage,
59
+ loadingWidth: '25px',
60
+ loadingHeight: '25px'
61
+ });
62
+ loadingDiv.appendChild(loadingImage);
63
+ container.appendChild(loadingDiv);
64
+ });
65
+ _defineProperty(_assertThisInitialized(_this), "removePaypalLoading", function () {
66
+ var loadingDiv = document.querySelector('.paypal-loading');
67
+
68
+ // 如果找到了该类元素,则从DOM中移除
69
+ if (loadingDiv) {
70
+ loadingDiv.remove();
71
+ }
72
+ });
73
+ _defineProperty(_assertThisInitialized(_this), "preCheck", function (paypalPluginProps) {
74
+ var _paypalPluginProps$pa, _paypalPluginProps$pa2;
75
+ var boundPaymentMethod = (_paypalPluginProps$pa = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa === void 0 || (_paypalPluginProps$pa = _paypalPluginProps$pa.paymentMethodInfo) === null || _paypalPluginProps$pa === void 0 || (_paypalPluginProps$pa = _paypalPluginProps$pa.paymentMethodMetaData) === null || _paypalPluginProps$pa === void 0 ? void 0 : _paypalPluginProps$pa.boundPaymentMethod;
76
+ var paymentMethodType = (_paypalPluginProps$pa2 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa2 === void 0 || (_paypalPluginProps$pa2 = _paypalPluginProps$pa2.paymentMethodInfo) === null || _paypalPluginProps$pa2 === void 0 ? void 0 : _paypalPluginProps$pa2.paymentMethodType;
77
+ if (boundPaymentMethod && PaypalMethodEnum.PAYPAL_VAULT === paymentMethodType) {
78
+ _this.onEventCallback({
79
+ code: eventCodeEnum.SDK_PAYMENT_WARN,
80
+ message: 'You can directly request the server interface without antom-sdk.'
81
+ });
82
+ }
83
+ return Promise.resolve(paypalPluginProps);
84
+ });
85
+ // 加载paypal资源
86
+ _defineProperty(_assertThisInitialized(_this), "loadPaypalResource", function (paypalPluginProps) {
87
+ return new Promise(function (resolve, reject) {
88
+ var _paypalPluginProps$ap;
89
+ if (isShowLoading((_paypalPluginProps$ap = paypalPluginProps.appearance) === null || _paypalPluginProps$ap === void 0 ? void 0 : _paypalPluginProps$ap.showLoading)) {
90
+ _this.appendPaypalLoading({
91
+ selector: paypalPluginProps.selector
92
+ });
93
+ }
94
+ var paypalScript = _this.createPaypalScript(paypalPluginProps);
95
+ // 将script标签添加到DOM中
96
+ document.body.appendChild(paypalScript);
97
+ // 在script加载完成后执行回调函数
98
+ paypalScript.onload = function () {
99
+ resolve('loading successfully');
100
+ };
101
+ // 如果有错误则输出错误信息
102
+ paypalScript.onerror = function (error) {
103
+ reject(error);
104
+ };
105
+ });
106
+ });
107
+ _defineProperty(_assertThisInitialized(_this), "createPaypalScript", function (paypalPluginProps) {
108
+ var _paypalPluginProps$pa3, _paypalPluginProps$pa4, _paypalPluginProps$pa5, _paypalPluginProps$pa6;
109
+ var channelMerchantAccountId = (_paypalPluginProps$pa3 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa3 === void 0 || (_paypalPluginProps$pa3 = _paypalPluginProps$pa3.merchantInfo) === null || _paypalPluginProps$pa3 === void 0 ? void 0 : _paypalPluginProps$pa3.channelMerchantClientId;
110
+ var accessToken = (_paypalPluginProps$pa4 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa4 === void 0 || (_paypalPluginProps$pa4 = _paypalPluginProps$pa4.paypal) === null || _paypalPluginProps$pa4 === void 0 ? void 0 : _paypalPluginProps$pa4.accessToken;
111
+ var locale = paypalPluginProps.locale;
112
+ var currency = (_paypalPluginProps$pa5 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa5 === void 0 || (_paypalPluginProps$pa5 = _paypalPluginProps$pa5.paymentAmount) === null || _paypalPluginProps$pa5 === void 0 ? void 0 : _paypalPluginProps$pa5.currency;
113
+ var paymentMethodType = (_paypalPluginProps$pa6 = paypalPluginProps.paymentSessionFactor) === null || _paypalPluginProps$pa6 === void 0 || (_paypalPluginProps$pa6 = _paypalPluginProps$pa6.paymentMethodInfo) === null || _paypalPluginProps$pa6 === void 0 ? void 0 : _paypalPluginProps$pa6.paymentMethodType;
114
+ var _ref2 = (paypalPluginProps === null || paypalPluginProps === void 0 ? void 0 : paypalPluginProps.paypalConfiguration) || {},
115
+ blockPayPalCreditButton = _ref2.blockPayPalCreditButton,
116
+ blockPayPalPayLaterButton = _ref2.blockPayPalPayLaterButton,
117
+ displayPayPalPayLaterButtonOnly = _ref2.displayPayPalPayLaterButtonOnly,
118
+ enableMessages = _ref2.enableMessages,
119
+ intent = _ref2.intent;
120
+ var script = document.createElement('script');
121
+ var src = "https://www.paypal.com/sdk/js?";
122
+ var urlSearchParams = new URLSearchParams({
123
+ currency: currency,
124
+ locale: locale,
125
+ 'client-id': channelMerchantAccountId
126
+ });
127
+ var disableFundingArr = ['bancontact', 'blik', 'eps', 'giropay', 'ideal', 'mercadopago', 'mybank', 'p24', 'sepa', 'sofort'];
128
+ if (blockPayPalCreditButton && !displayPayPalPayLaterButtonOnly) {
129
+ disableFundingArr.push('card');
130
+ }
131
+ if (blockPayPalPayLaterButton && !displayPayPalPayLaterButtonOnly) {
132
+ disableFundingArr.push('credit');
133
+ }
134
+ if (disableFundingArr.length) {
135
+ urlSearchParams.append('disable-funding', disableFundingArr.join(','));
136
+ }
137
+ if (enableMessages) {
138
+ urlSearchParams.append('components', 'messages,buttons');
139
+ } else {
140
+ urlSearchParams.append('components', 'buttons');
141
+ }
142
+ if (payPalConfigurationIntentEnum.intent === intent && PaypalMethodEnum.PAYPAL_CHECKOUT === paymentMethodType) {
143
+ urlSearchParams.append('intent', 'authorize');
144
+ urlSearchParams.append('commit', 'false');
145
+ }
146
+ if (PaypalMethodEnum.PAYPAL_VAULT === paymentMethodType) {
147
+ urlSearchParams.append('vault', 'true');
148
+ }
149
+ src += urlSearchParams.toString();
150
+ script.src = src;
151
+ script.setAttribute('data-user-id-token', accessToken);
152
+ return script;
153
+ });
154
+ _defineProperty(_assertThisInitialized(_this), "onShippingChange", /*#__PURE__*/function () {
155
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
156
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
157
+ while (1) switch (_context.prev = _context.next) {
158
+ case 0:
159
+ _this.onEventCallback({
160
+ code: eventCodeEnum.SDK_PAYMENT_SHIPPINGCHANGE,
161
+ result: {
162
+ data: data
163
+ }
164
+ });
165
+ case 1:
166
+ case "end":
167
+ return _context.stop();
168
+ }
169
+ }, _callee);
170
+ }));
171
+ return function (_x) {
172
+ return _ref3.apply(this, arguments);
173
+ };
174
+ }());
175
+ _defineProperty(_assertThisInitialized(_this), "createOrder", /*#__PURE__*/function () {
176
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_data, _action, paymentSessionData, env, paymentSessionConfig) {
177
+ var _queryPaymentInfoRes$;
178
+ var queryPaymentInfoRes;
179
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
180
+ while (1) switch (_context2.prev = _context2.next) {
181
+ case 0:
182
+ _context2.next = 2;
183
+ return queryPaymentInfo({
184
+ paymentSessionData: paymentSessionData,
185
+ paymentSessionConfig: paymentSessionConfig
186
+ }, {
187
+ env: env,
188
+ timeout: 15000
189
+ }, _this.logger);
190
+ case 2:
191
+ queryPaymentInfoRes = _context2.sent;
192
+ if (!(!(queryPaymentInfoRes !== null && queryPaymentInfoRes !== void 0 && queryPaymentInfoRes.success) || !(queryPaymentInfoRes !== null && queryPaymentInfoRes !== void 0 && (_queryPaymentInfoRes$ = queryPaymentInfoRes.extendInfo) !== null && _queryPaymentInfoRes$ !== void 0 && _queryPaymentInfoRes$.channelOrderId))) {
193
+ _context2.next = 7;
194
+ break;
195
+ }
196
+ _this.logger.logInfo({
197
+ title: 'paypal_payment_failed'
198
+ });
199
+ _this.onEventCallback({
200
+ code: eventCodeEnum.SDK_PAYMENT_FAIL,
201
+ message: 'Create order failed.'
202
+ });
203
+ return _context2.abrupt("return");
204
+ case 7:
205
+ return _context2.abrupt("return", queryPaymentInfoRes.extendInfo.channelOrderId);
206
+ case 8:
207
+ case "end":
208
+ return _context2.stop();
209
+ }
210
+ }, _callee2);
211
+ }));
212
+ return function (_x2, _x3, _x4, _x5, _x6) {
213
+ return _ref4.apply(this, arguments);
214
+ };
215
+ }());
216
+ _defineProperty(_assertThisInitialized(_this), "onApprove", /*#__PURE__*/function () {
217
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(onApproveData) {
218
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
219
+ while (1) switch (_context3.prev = _context3.next) {
220
+ case 0:
221
+ _this.onEventCallback({
222
+ code: eventCodeEnum.SDK_PAYMENT_APPROVE,
223
+ result: {
224
+ onApproveData: onApproveData
225
+ }
226
+ });
227
+ if (_this.logger && isFunction(_this.logger.logInfo)) {
228
+ _this.logger.logInfo({
229
+ title: 'paypal_payment_approved'
230
+ });
231
+ }
232
+ case 2:
233
+ case "end":
234
+ return _context3.stop();
235
+ }
236
+ }, _callee3);
237
+ }));
238
+ return function (_x7) {
239
+ return _ref5.apply(this, arguments);
240
+ };
241
+ }());
242
+ _defineProperty(_assertThisInitialized(_this), "onCancel", /*#__PURE__*/function () {
243
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(orderId) {
244
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
245
+ while (1) switch (_context4.prev = _context4.next) {
246
+ case 0:
247
+ _this.onEventCallback({
248
+ code: eventCodeEnum.SDK_PAYMENT_CANCEL,
249
+ result: {
250
+ orderId: orderId
251
+ }
252
+ });
253
+ if (_this.logger && isFunction(_this.logger.logInfo)) {
254
+ _this.logger.logInfo({
255
+ title: 'paypal_payment_cancelled'
256
+ });
257
+ }
258
+ case 2:
259
+ case "end":
260
+ return _context4.stop();
261
+ }
262
+ }, _callee4);
263
+ }));
264
+ return function (_x8) {
265
+ return _ref6.apply(this, arguments);
266
+ };
267
+ }());
268
+ _defineProperty(_assertThisInitialized(_this), "destroyComponent", /*#__PURE__*/function () {
269
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(context, message) {
270
+ var data;
271
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
272
+ while (1) switch (_context5.prev = _context5.next) {
273
+ case 0:
274
+ data = message.getJSONObject();
275
+ _this.logger.logInfo({
276
+ title: 'sdk_event_clean_component'
277
+ }).send();
278
+ if (document.querySelector(data === null || data === void 0 ? void 0 : data.selector)) {
279
+ document.querySelector(data === null || data === void 0 ? void 0 : data.selector).innerHTML = '';
280
+ console.log('paypal: destroy Component');
281
+ }
282
+ case 3:
283
+ case "end":
284
+ return _context5.stop();
285
+ }
286
+ }, _callee5);
287
+ }));
288
+ return function (_x9, _x10) {
289
+ return _ref7.apply(this, arguments);
290
+ };
291
+ }());
292
+ _this.logger = logger;
293
+ return _this;
294
+ }
295
+ _createClass(PaypalBusSubscriber, [{
296
+ key: "actionNames",
297
+ value: function actionNames() {
298
+ return Object.values(PaypalActionEnum);
299
+ }
300
+ }, {
301
+ key: "renderPaypalButton",
302
+ value: function renderPaypalButton(context, message) {
303
+ var _data$options,
304
+ _data$options2,
305
+ _data$appendParams,
306
+ _data$appendParams2,
307
+ _data$appendParams3,
308
+ _data$appendParams4,
309
+ _data$appendParams5,
310
+ _data$appendParams6,
311
+ _this2 = this;
312
+ var data = message.getJSONObject();
313
+ var paypalPluginProps = {
314
+ locale: (_data$options = data.options) === null || _data$options === void 0 ? void 0 : _data$options.locale,
315
+ environment: (_data$options2 = data.options) === null || _data$options2 === void 0 ? void 0 : _data$options2.environment,
316
+ paymentSessionData: (_data$appendParams = data.appendParams) === null || _data$appendParams === void 0 || (_data$appendParams = _data$appendParams.iframeNodesParams) === null || _data$appendParams === void 0 ? void 0 : _data$appendParams.sessionData,
317
+ paymentSessionFactor: (_data$appendParams2 = data.appendParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.iframeNodesParams) === null || _data$appendParams2 === void 0 || (_data$appendParams2 = _data$appendParams2.paymentSessionMetaData) === null || _data$appendParams2 === void 0 ? void 0 : _data$appendParams2.paymentSessionFactor,
318
+ selector: (_data$appendParams3 = data.appendParams) === null || _data$appendParams3 === void 0 || (_data$appendParams3 = _data$appendParams3.iframeNodesParams) === null || _data$appendParams3 === void 0 ? void 0 : _data$appendParams3.selector,
319
+ paypalConfiguration: (_data$appendParams4 = data.appendParams) === null || _data$appendParams4 === void 0 || (_data$appendParams4 = _data$appendParams4.iframeNodesParams) === null || _data$appendParams4 === void 0 ? void 0 : _data$appendParams4.paypalConfiguration,
320
+ appearance: (_data$appendParams5 = data.appendParams) === null || _data$appendParams5 === void 0 || (_data$appendParams5 = _data$appendParams5.iframeNodesParams) === null || _data$appendParams5 === void 0 ? void 0 : _data$appendParams5.appearance,
321
+ paymentSessionConfig: (_data$appendParams6 = data.appendParams) === null || _data$appendParams6 === void 0 || (_data$appendParams6 = _data$appendParams6.iframeNodesParams) === null || _data$appendParams6 === void 0 || (_data$appendParams6 = _data$appendParams6.paymentSessionMetaData) === null || _data$appendParams6 === void 0 ? void 0 : _data$appendParams6.paymentSessionConfig
322
+ };
323
+ return this.preCheck(paypalPluginProps).then(function (paypalPluginProps) {
324
+ return _this2.loadPaypalResource(paypalPluginProps).then(function () {
325
+ var _paypalPluginProps$pa7, _paypalPluginProps$pa8;
326
+ var createButtonConfig = {
327
+ style: _objectSpread({
328
+ layout: 'vertical',
329
+ color: 'gold',
330
+ shape: 'rect'
331
+ }, ((_paypalPluginProps$pa7 = paypalPluginProps.paypalConfiguration) === null || _paypalPluginProps$pa7 === void 0 ? void 0 : _paypalPluginProps$pa7.style) || {}),
332
+ fundingSource: undefined,
333
+ onShippingChange: _this2.onShippingChange,
334
+ createOrder: function createOrder(data, action) {
335
+ return _this2.createOrder(data, action, paypalPluginProps.paymentSessionData, paypalPluginProps.environment, paypalPluginProps.paymentSessionConfig);
336
+ },
337
+ onApprove: _this2.onApprove,
338
+ onCancel: _this2.onCancel
339
+ };
340
+ if ((_paypalPluginProps$pa8 = paypalPluginProps.paypalConfiguration) !== null && _paypalPluginProps$pa8 !== void 0 && _paypalPluginProps$pa8.displayPayPalPayLaterButtonOnly) {
341
+ createButtonConfig.fundingSource = window.paypal.FUNDING.PAYLATER;
342
+ }
343
+ try {
344
+ window.paypal.Buttons(createButtonConfig).render(paypalPluginProps.selector);
345
+ } catch (error) {
346
+ _this2.logger.logError({
347
+ title: 'button_render_failed'
348
+ }, {
349
+ message: error
350
+ });
351
+ _this2.onEventCallback({
352
+ code: eventCodeEnum.SDK_PAYMENT_FAIL,
353
+ message: 'Button render failed.'
354
+ });
355
+ return Promise.reject(error);
356
+ }
357
+ }).catch(function (error) {
358
+ _this2.logger.logError({
359
+ title: 'paypal_payment_loadSDK_failed'
360
+ });
361
+ _this2.onEventCallback({
362
+ code: eventCodeEnum.SDK_PAYMENT_FAIL,
363
+ message: 'Loading paypal sdk failed.'
364
+ });
365
+ return Promise.reject(error);
366
+ }).finally(function () {
367
+ var _paypalPluginProps$ap2;
368
+ if (isShowLoading((_paypalPluginProps$ap2 = paypalPluginProps.appearance) === null || _paypalPluginProps$ap2 === void 0 ? void 0 : _paypalPluginProps$ap2.showLoading)) {
369
+ _this2.removePaypalLoading();
370
+ }
371
+ });
372
+ });
373
+ }
374
+ }, {
375
+ key: "onMessage",
376
+ value: function onMessage(context, message) {
377
+ switch (message.getAction()) {
378
+ case PaypalActionEnum.mountComponent:
379
+ this.renderPaypalButton(context, message);
380
+ break;
381
+ case PaypalActionEnum.destroyComponent:
382
+ this.destroyComponent(context, message);
383
+ break;
384
+ default:
385
+ console.log('Unknown action: ' + message.getAction());
386
+ }
387
+ }
388
+ }]);
389
+ return PaypalBusSubscriber;
390
+ }(BusSubscriber);
@@ -0,0 +1,34 @@
1
+ import { BusSubscriber } from 'src/core/bus';
2
+ import { PaymentMethodCategoryTypeEnum, ProductSceneEnum, ProductSceneVersion } from '../types';
3
+ export type IExtendPlugin = IExtendPluginItem[];
4
+ export interface ComponentActionNamesType {
5
+ canMakePayments?: string;
6
+ optional_init?: string;
7
+ createComponent?: string;
8
+ mountComponent?: string;
9
+ submit?: string;
10
+ destroyComponent?: string;
11
+ getValue?: string;
12
+ }
13
+ export type IExtendPluginItem = {
14
+ /**
15
+ * 以下为sessionData匹配的场景
16
+ */
17
+ sessionMatcher?: {
18
+ productScene: ProductSceneEnum;
19
+ productSceneVersion: ProductSceneVersion;
20
+ paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
21
+ paymentMethodTypes: string[];
22
+ };
23
+ /**
24
+ * 用于无sessionData场景,比如:canMakePayments
25
+ */
26
+ paymentChannelMatcher?: {
27
+ paymentMethod: string;
28
+ };
29
+ /**
30
+ * 以下plugin 实现的定义
31
+ */
32
+ busActionNames: ComponentActionNamesType;
33
+ busSubscriber?: BusSubscriber;
34
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const appendLoadingIcon: (props: {
2
+ htmlElement: HTMLElement;
3
+ loadingWidth: string;
4
+ loadingHeight: string;
5
+ }) => void;
6
+ export declare const isShowLoading: (showLoading?: boolean) => boolean;
@@ -0,0 +1,21 @@
1
+ export var appendLoadingIcon = function appendLoadingIcon(props) {
2
+ var htmlElement = props.htmlElement,
3
+ loadingHeight = props.loadingHeight,
4
+ loadingWidth = props.loadingWidth;
5
+ var spinStyles = "\n @keyframes loadingSpin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n ";
6
+ var loadingImg = document.createElement('img');
7
+ loadingImg.src = 'https://mdn.alipayobjects.com/huamei_saktgs/afts/img/A*vmqbT6W9g4oAAAAAAAAAAAAADviCAQ/original';
8
+ loadingImg.classList.add('atom-loading');
9
+ loadingImg.style.width = loadingWidth;
10
+ loadingImg.style.height = loadingHeight;
11
+ loadingImg.style.animation = 'loadingSpin 0.8s linear infinite';
12
+ var styleElement = document.createElement('style');
13
+ styleElement.textContent = spinStyles;
14
+ document.head.appendChild(styleElement);
15
+ if (htmlElement) {
16
+ htmlElement.appendChild(loadingImg);
17
+ }
18
+ };
19
+ export var isShowLoading = function isShowLoading(showLoading) {
20
+ return showLoading = typeof showLoading === 'boolean' ? showLoading : true;
21
+ };
@@ -19,7 +19,7 @@ interface AddressValueResult {
19
19
  /**
20
20
  * SDK options
21
21
  */
22
- export interface IOptionsParams {
22
+ export interface IoptionsParams {
23
23
  environment?: string;
24
24
  locale?: string;
25
25
  onError?: callOnError;
@@ -29,15 +29,15 @@ export interface IOptionsParams {
29
29
  onEventCallback?: callOnEventCallback;
30
30
  onClose?: callOnClose;
31
31
  onChange?: onChange;
32
- networkMode?: string;
33
- mode?: string;
34
32
  analytics?: {
35
33
  enabled: boolean;
36
34
  };
37
- product?: string;
38
35
  onBeforeSubmit?: callOnBeforeSubmit;
36
+ product?: string;
37
+ networkMode?: string;
38
+ mode?: string;
39
39
  }
40
- export interface IApplePayOptionsParams extends Pick<IOptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
40
+ export interface IApplePayOptionsParams extends Pick<IoptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
41
41
  }
42
42
  export type Iselector = string;
43
43
  export declare enum DisplayTypeEnum {
@@ -67,6 +67,7 @@ export declare enum ComponentSignEnum {
67
67
  'AUTO_DEBIT_PAY_WALLET' = "AUTO_DEBIT_PAY_WALLET",
68
68
  'NONE' = "NONE",
69
69
  'VAULTING_CARD' = "VAULTING_CARD",
70
+ 'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT",
70
71
  'ELEMENT_PAYMENT' = "ELEMENT_PAYMENT_ALL",
71
72
  'ELEMENT_ADDRESS' = "ELEMENT_ADDRESS_ALL"
72
73
  }
@@ -105,6 +106,7 @@ export interface IcreateComponent {
105
106
  themeType?: string;
106
107
  accentColor?: string;
107
108
  };
109
+ isAppWebview?: boolean;
108
110
  merchantAppointParam?: IMerchantAppointParam;
109
111
  }
110
112
  export interface IappendIframeNodesParams extends IcreateComponent {
@@ -112,9 +114,6 @@ export interface IappendIframeNodesParams extends IcreateComponent {
112
114
  renderDisplayType: DisplayTypeEnum;
113
115
  selector?: Iselector;
114
116
  paypalConfiguration?: IPaypalConfiguration;
115
- connectFactor?: {
116
- enableConnect: boolean;
117
- };
118
117
  /** 将address-element参数定义合入原参数定义 */
119
118
  configParams?: {
120
119
  hideFields?: string[];
@@ -199,7 +198,7 @@ export interface Isubmit {
199
198
  }
200
199
  export interface IpaymentSessionConfig {
201
200
  productScene: ProductSceneEnum;
202
- paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
201
+ paymentMethodCategoryType?: PaymentMethodCategoryTypeEnum;
203
202
  productSceneVersion: string;
204
203
  }
205
204
  export interface IpaymentSecurityConfig {
@@ -231,6 +230,7 @@ export interface PaymentSessionActionData {
231
230
  skipSdkQuery: boolean;
232
231
  requireFastSdk: boolean;
233
232
  nonCompliant?: boolean;
233
+ nonInitSecuritySDK?: boolean;
234
234
  skipSdkQueryForm?: {
235
235
  value: boolean;
236
236
  version: string;
@@ -245,6 +245,7 @@ export interface IPaymentSessionMetaData {
245
245
  moneyView?: any;
246
246
  extendInfo?: string;
247
247
  paymentMethodInfoView?: any;
248
+ paymentView?: any;
248
249
  action?: PaymentSessionActionData;
249
250
  authUrlInfo?: {
250
251
  appIdentifier?: string;
@@ -537,7 +538,6 @@ export interface CashierSubmitPayRequest {
537
538
  verifyFactors?: Record<string, string>;
538
539
  paymentSessionData: string;
539
540
  paymentSessionConfig?: any;
540
- traceId?: string;
541
541
  extParams?: any;
542
542
  }
543
543
  export interface CashierSdkActionQueryResult {
@@ -555,7 +555,6 @@ export interface CashierSdkActionQueryResult {
555
555
  normalUrl?: string;
556
556
  applinkUrl?: string;
557
557
  schemeUrl?: string;
558
- traceId?: string;
559
558
  authUrl?: string;
560
559
  extendInfo?: {
561
560
  channelOrderId?: string;
@@ -31,10 +31,11 @@ export var ComponentSignEnum = /*#__PURE__*/function (ComponentSignEnum) {
31
31
  ComponentSignEnum["AUTO_DEBIT_PAY_WALLET"] = "AUTO_DEBIT_PAY_WALLET";
32
32
  ComponentSignEnum["NONE"] = "NONE";
33
33
  ComponentSignEnum["VAULTING_CARD"] = "VAULTING_CARD";
34
+ ComponentSignEnum["CHECKOUT_PAYMENT"] = "CHECKOUT_PAYMENT";
34
35
  ComponentSignEnum["ELEMENT_PAYMENT"] = "ELEMENT_PAYMENT_ALL";
35
36
  ComponentSignEnum["ELEMENT_ADDRESS"] = "ELEMENT_ADDRESS_ALL";
36
37
  return ComponentSignEnum;
37
- }({}); // 'CHECKOUT_PAYMENT' = 'CHECKOUT_PAYMENT',
38
+ }({});
38
39
  export var ProductSceneEnum = /*#__PURE__*/function (ProductSceneEnum) {
39
40
  ProductSceneEnum["EASY_PAY"] = "EASY_PAY";
40
41
  ProductSceneEnum["CASHIER_PAYMENT"] = "CASHIER_PAYMENT";
@@ -0,0 +1,6 @@
1
+ import { Iselector, DisplayTypeEnum } from '../types';
2
+ /**
3
+ * @description context中需要包含app节点,用于插入selector中
4
+ */
5
+ export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType: DisplayTypeEnum) => Promise<void>;
6
+ export declare const createPreloadIframeNode: (virtualPreloadIframe: any) => void;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+ * 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
5
+ * 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.
6
+ */
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { getType } from '.';
9
+ import { ERRORMESSAGE, EVENT } from "../constant";
10
+ import { MessageName, DisplayTypeEnum } from "../types";
11
+ /**
12
+ * @description context中需要包含app节点,用于插入selector中
13
+ */
14
+ export var createIframeNode = function createIframeNode(context, selector, renderDisplayType) {
15
+ return new Promise(function (resolve, reject) {
16
+ var dorpinDom = null;
17
+ if (getType(selector) === 'string') {
18
+ dorpinDom = document.querySelector(selector);
19
+ }
20
+ if (dorpinDom === null) {
21
+ var error = {
22
+ code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
23
+ message: "Failed to execute 'querySelector' on 'Document': ".concat(selector, " is not a valid selector")
24
+ };
25
+ reject(error);
26
+ context._dispatchToSDK({
27
+ name: MessageName.APP_TO_SDK,
28
+ instanceId: context.AMSSDK._instanceId,
29
+ context: {
30
+ event: EVENT.error.name,
31
+ data: error
32
+ }
33
+ });
34
+ return;
35
+ }
36
+ if (renderDisplayType === DisplayTypeEnum.popup) dorpinDom.innerHTML = '';
37
+ if (context.app) {
38
+ dorpinDom.appendChild(context.app);
39
+ }
40
+ resolve();
41
+ });
42
+ };
43
+ export var createPreloadIframeNode = function createPreloadIframeNode(virtualPreloadIframe) {
44
+ var body = document.body || null;
45
+ if (body) {
46
+ body.appendChild(virtualPreloadIframe);
47
+ }
48
+ };
@@ -0,0 +1,5 @@
1
+ import { Logger } from './logger';
2
+ /**
3
+ * 通过配置规则检测 UA 和获得回跳 scheme
4
+ */
5
+ export declare function getBackScheme(mockUa?: string, logger?: Logger): any;