@alipay/ams-checkout 0.0.1729593469-dev.0 → 0.0.1730107332-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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/{plugin/component → component}/channel.d.ts +3 -4
- package/esm/{plugin/component → component}/channel.js +1 -37
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/{plugin/component → component}/component.inline.style.js +11 -9
- package/esm/{plugin/component → component}/component.popup.style.d.ts +15 -6
- package/esm/{plugin/component → component}/component.popup.style.js +36 -18
- package/esm/{plugin/component → component}/popupWindow.style.js +2 -2
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +7 -6
- package/esm/constant/index.js +11 -80
- package/esm/foundation/core/index.d.ts +26 -0
- package/esm/foundation/core/index.js +335 -0
- package/esm/foundation/index.d.ts +71 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +17 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +11 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +27 -0
- package/esm/foundation/product-processor/easysafepay/index.js +581 -0
- package/esm/{core/bus → foundation/service/api-bus}/ability/callback.d.ts +2 -2
- package/esm/{core/bus → foundation/service/api-bus}/ability/callback.js +1 -1
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
- package/esm/{core/component/address.js → foundation/service/api-bus/ability/globalData.js} +75 -58
- package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/request.js +151 -0
- package/esm/{core/bus → foundation/service/api-bus}/ability/security.d.ts +6 -4
- package/esm/{core/bus → foundation/service/api-bus}/ability/security.js +92 -35
- package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.d.ts +4 -4
- package/esm/{core/bus → foundation/service/api-bus}/ability/tracker.js +6 -3
- package/esm/{core/bus/index.d.ts → foundation/service/api-bus/busManager.d.ts} +17 -15
- package/esm/{core/bus/index.js → foundation/service/api-bus/busManager.js} +67 -35
- package/esm/foundation/service/api-bus/index.d.ts +20 -0
- package/esm/foundation/service/api-bus/index.js +88 -0
- package/esm/{core/bus → foundation/service/api-bus}/interface.d.ts +12 -0
- package/esm/{core/bus → foundation/service/api-bus}/interface.js +16 -2
- package/esm/foundation/service/container/index.d.ts +28 -0
- package/esm/foundation/service/container/index.js +257 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/{core/component/appPreloadProcessing.js → foundation/service/container/popup.js} +97 -83
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-center.d.ts +74 -0
- package/esm/foundation/service/event-center.js +213 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +68 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +235 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +214 -0
- package/esm/foundation/service/security/index.d.ts +28 -0
- package/esm/foundation/service/security/index.js +285 -0
- package/esm/{util → foundation/service/security}/security.d.ts +2 -2
- package/esm/{util → foundation/service/security}/security.js +3 -3
- package/esm/foundation/types/index.d.ts +4 -0
- package/esm/foundation/types/index.js +4 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.js +38 -0
- package/esm/foundation/utils/redirect_utils.d.ts +6 -0
- package/esm/foundation/utils/redirect_utils.js +99 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +71 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
- package/esm/foundation/utils/web_app_url_utils.js +112 -0
- package/esm/index.d.ts +5 -28
- package/esm/index.js +28 -158
- package/esm/types/index.d.ts +66 -38
- package/esm/types/index.js +63 -59
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +3 -4
- package/package.json +2 -2
- package/esm/core/component/address.d.ts +0 -8
- package/esm/core/component/appPreloadProcessing.d.ts +0 -1
- package/esm/core/component/ckp/index.d.ts +0 -27
- package/esm/core/component/ckp/index.js +0 -166
- package/esm/core/component/index.d.ts +0 -51
- package/esm/core/component/index.js +0 -531
- package/esm/core/drop-in/index.d.ts +0 -22
- package/esm/core/drop-in/index.js +0 -104
- package/esm/core/instance/index.d.ts +0 -89
- package/esm/core/instance/index.js +0 -499
- package/esm/plugin/applepay/component.d.ts +0 -50
- package/esm/plugin/applepay/component.js +0 -339
- package/esm/plugin/applepay/index.d.ts +0 -17
- package/esm/plugin/applepay/index.js +0 -117
- package/esm/plugin/applepay/interface.d.ts +0 -161
- package/esm/plugin/applepay/interface.js +0 -69
- package/esm/plugin/applepay/service.d.ts +0 -54
- package/esm/plugin/applepay/service.js +0 -289
- package/esm/plugin/component/cashierApp.d.ts +0 -34
- package/esm/plugin/component/cashierApp.js +0 -237
- package/esm/plugin/component/component.inline.style.d.ts +0 -10
- package/esm/plugin/component/index.d.ts +0 -126
- package/esm/plugin/component/index.js +0 -1839
- package/esm/plugin/const.d.ts +0 -2
- package/esm/plugin/const.js +0 -33
- package/esm/plugin/drop-in/index.d.ts +0 -71
- package/esm/plugin/drop-in/index.js +0 -324
- package/esm/plugin/payment-element/utils.d.ts +0 -2
- package/esm/plugin/payment-element/utils.js +0 -6
- package/esm/plugin/paypal/index.d.ts +0 -20
- package/esm/plugin/paypal/index.js +0 -390
- package/esm/plugin/type.d.ts +0 -34
- package/esm/plugin/utils.d.ts +0 -6
- package/esm/plugin/utils.js +0 -21
- package/esm/util/createIframeNode.d.ts +0 -6
- package/esm/util/createIframeNode.js +0 -48
- package/esm/util/getBackScheme.d.ts +0 -5
- package/esm/util/getBackScheme.js +0 -42
- package/esm/util/ua/index.d.ts +0 -2
- package/esm/util/ua/index.js +0 -2
- package/esm/util/ua/isAndroid.d.ts +0 -4
- package/esm/util/ua/isAndroid.js +0 -7
- package/esm/util/ua/isIOS.d.ts +0 -4
- package/esm/util/ua/isIOS.js +0 -7
- /package/esm/{plugin/component → component}/popupWindow.style.d.ts +0 -0
- /package/esm/{plugin/type.js → foundation/service/log/types.js} +0 -0
@@ -1,390 +0,0 @@
|
|
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);
|
package/esm/plugin/type.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
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
|
-
};
|
package/esm/plugin/utils.d.ts
DELETED
package/esm/plugin/utils.js
DELETED
@@ -1,21 +0,0 @@
|
|
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
|
-
};
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { Iselector, renderDisplayTypeEnum } from '../types';
|
2
|
-
/**
|
3
|
-
* @description context中需要包含app节点,用于插入selector中
|
4
|
-
*/
|
5
|
-
export declare const createIframeNode: (context: any, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
|
6
|
-
export declare const createPreloadIframeNode: (virtualPreloadIframe: any) => void;
|
@@ -1,48 +0,0 @@
|
|
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, renderDisplayTypeEnum } 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 === renderDisplayTypeEnum.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
|
-
};
|
@@ -1,42 +0,0 @@
|
|
1
|
-
import { isAndroid, isIOS } from "./ua";
|
2
|
-
import { RULES } from "../constant/index";
|
3
|
-
/**
|
4
|
-
* 通过配置规则检测 UA 和获得回跳 scheme
|
5
|
-
*/
|
6
|
-
export function getBackScheme(mockUa, logger) {
|
7
|
-
var ua = mockUa || window.navigator.userAgent || '';
|
8
|
-
// 获取规则
|
9
|
-
var uaMatchedRule = RULES;
|
10
|
-
var matchedRule;
|
11
|
-
var matched = null;
|
12
|
-
for (var i = 0; i < uaMatchedRule.length; i++) {
|
13
|
-
var rule = uaMatchedRule[i];
|
14
|
-
matched = ua.match(rule.matchRule);
|
15
|
-
if (matched) {
|
16
|
-
matchedRule = rule;
|
17
|
-
break;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
if (!matchedRule) {
|
21
|
-
logBackScheme(logger, ua, '');
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
if (isAndroid(ua)) {
|
25
|
-
logBackScheme(logger, ua, matchedRule.andScheme);
|
26
|
-
return matchedRule.andScheme;
|
27
|
-
}
|
28
|
-
if (isIOS(ua)) {
|
29
|
-
logBackScheme(logger, ua, matchedRule.iosScheme);
|
30
|
-
return matchedRule.iosScheme;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
function logBackScheme(logger, userAgent, scheme) {
|
34
|
-
if (logger) {
|
35
|
-
logger.logInfo({
|
36
|
-
title: 'a3753.b101271.c377460'
|
37
|
-
}, {
|
38
|
-
userAgent: userAgent,
|
39
|
-
backScheme: scheme
|
40
|
-
});
|
41
|
-
}
|
42
|
-
}
|
package/esm/util/ua/index.d.ts
DELETED
package/esm/util/ua/index.js
DELETED
package/esm/util/ua/isAndroid.js
DELETED
package/esm/util/ua/isIOS.d.ts
DELETED
package/esm/util/ua/isIOS.js
DELETED
File without changes
|
File without changes
|