@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,499 +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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
6
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
9
|
-
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); } }
|
10
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
11
|
-
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; }
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
13
|
-
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); }
|
14
|
-
/**
|
15
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
16
|
-
*
|
17
|
-
* 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:
|
18
|
-
* 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
|
19
|
-
* 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.
|
20
|
-
*/
|
21
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
22
|
-
|
23
|
-
import { v4 as uuid } from 'uuid';
|
24
|
-
import { sdkVersion } from "../../config/index";
|
25
|
-
import { ERRORMESSAGE, EVENT } from "../../constant";
|
26
|
-
import { antomConfig } from "../../service";
|
27
|
-
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, productSceneEnum, terminalTypeEnum } from "../../types/index";
|
28
|
-
import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
29
|
-
import CallApp from "../../util/intl-callapp/es/main";
|
30
|
-
import { LogConfig, Logger } from "../../util/logger";
|
31
|
-
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../util/security";
|
32
|
-
import { compareVersion } from "../../util/versionCompare";
|
33
|
-
import { BusManager, BusMessage } from "../bus";
|
34
|
-
var AMSSDK = /*#__PURE__*/function () {
|
35
|
-
function AMSSDK(options) {
|
36
|
-
_classCallCheck(this, AMSSDK);
|
37
|
-
_defineProperty(this, "options", void 0);
|
38
|
-
_defineProperty(this, "originOptions", void 0);
|
39
|
-
_defineProperty(this, "logger", void 0);
|
40
|
-
_defineProperty(this, "_eventCenter", void 0);
|
41
|
-
_defineProperty(this, "_instanceId", void 0);
|
42
|
-
_defineProperty(this, "_storageId", void 0);
|
43
|
-
_defineProperty(this, "_appendParams", void 0);
|
44
|
-
_defineProperty(this, "_componentApp", void 0);
|
45
|
-
_defineProperty(this, "securitySdkMap", void 0);
|
46
|
-
_defineProperty(this, "plugins", void 0);
|
47
|
-
this._instanceId = uuid();
|
48
|
-
this.originOptions = options;
|
49
|
-
this.options = {};
|
50
|
-
this._eventCenter = new EventCenter();
|
51
|
-
this._initEvent(options);
|
52
|
-
this._setOptions(options);
|
53
|
-
this.plugins = new Map();
|
54
|
-
this.securitySdkMap = new Map();
|
55
|
-
var storageIdKey = 'AMSSDK_STORAGE_ID';
|
56
|
-
var _storageId = getOrSetStorageId(storageIdKey);
|
57
|
-
if (!_storageId) {
|
58
|
-
getOrSetStorageId(storageIdKey, this._instanceId);
|
59
|
-
_storageId = this._instanceId;
|
60
|
-
}
|
61
|
-
this._storageId = _storageId;
|
62
|
-
|
63
|
-
// TODO Consumption data analysis control parameters
|
64
|
-
this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
65
|
-
Logger.setInstance(this.logger);
|
66
|
-
this.logger.setMedta({
|
67
|
-
instanceId: this._instanceId
|
68
|
-
});
|
69
|
-
this.logger.initTracker();
|
70
|
-
this.logger.setComponentStartTime(Date.now());
|
71
|
-
this.logger.setTrackId(this._instanceId);
|
72
|
-
this.logger.logInfo({
|
73
|
-
title: 'NEW_AMSSDK_BY_MECHANT',
|
74
|
-
msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
|
75
|
-
}).send();
|
76
|
-
this.preInitSecurity(options);
|
77
|
-
}
|
78
|
-
_createClass(AMSSDK, [{
|
79
|
-
key: "preInitSecurity",
|
80
|
-
value: function preInitSecurity(options) {
|
81
|
-
var _this$options;
|
82
|
-
var antomSDKConfigKey = 'antomSDKConfigKey';
|
83
|
-
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
84
|
-
if (![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
85
|
-
if (checkTimeElapsed()) {
|
86
|
-
antomConfig({
|
87
|
-
env: this.options.env.environment
|
88
|
-
}, this.logger).then(function (res) {
|
89
|
-
getOrSetStorageId(antomSDKConfigKey, JSON.stringify(res));
|
90
|
-
});
|
91
|
-
}
|
92
|
-
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) || productSceneEnum.EASY_PAY;
|
93
|
-
var enable = true;
|
94
|
-
try {
|
95
|
-
var matchingConfig = config['pl_sec'].find(function (item) {
|
96
|
-
var _item$v, _item$v2, _item$platform;
|
97
|
-
var minVersion = item === null || item === void 0 || (_item$v = item.v) === null || _item$v === void 0 ? void 0 : _item$v.split('|')[0];
|
98
|
-
var maxVersion = (item === null || item === void 0 || (_item$v2 = item.v) === null || _item$v2 === void 0 ? void 0 : _item$v2.split('|')[1]) || '999999.9.9';
|
99
|
-
var matchVersion = compareVersion(sdkVersion, minVersion) >= 0 && compareVersion(maxVersion, sdkVersion) >= 0;
|
100
|
-
return ((item === null || item === void 0 || (_item$platform = item.platform) === null || _item$platform === void 0 ? void 0 : _item$platform.includes('Web')) || (item === null || item === void 0 ? void 0 : item.platform) === '') && (item === null || item === void 0 ? void 0 : item.product) === product && (!(item !== null && item !== void 0 && item.v) || matchVersion);
|
101
|
-
});
|
102
|
-
enable = (matchingConfig === null || matchingConfig === void 0 ? void 0 : matchingConfig.enable) === false ? false : true;
|
103
|
-
} catch (error) {
|
104
|
-
/* empty */
|
105
|
-
}
|
106
|
-
if (!enable) return;
|
107
|
-
this.initSecurity({
|
108
|
-
product: product
|
109
|
-
});
|
110
|
-
}
|
111
|
-
/**
|
112
|
-
* @description Destroy and process some contents of the plug-in
|
113
|
-
*/
|
114
|
-
}, {
|
115
|
-
key: "unmount",
|
116
|
-
value: function unmount() {
|
117
|
-
var _this$getBusActionNam;
|
118
|
-
this.logger.logInfo({
|
119
|
-
title: 'sdk_event_apiOnDestroy'
|
120
|
-
}).send();
|
121
|
-
var actionName = (_this$getBusActionNam = this.getBusActionNames()) === null || _this$getBusActionNam === void 0 ? void 0 : _this$getBusActionNam.destroyComponent;
|
122
|
-
if (actionName && BusManager.isSubscribed(actionName)) {
|
123
|
-
var _this$_appendParams;
|
124
|
-
// 执行出错了,在通用拦截器返回
|
125
|
-
BusManager.publish(new BusMessage(actionName, JSON.stringify({
|
126
|
-
options: this.originOptions,
|
127
|
-
selector: (_this$_appendParams = this._appendParams) === null || _this$_appendParams === void 0 || (_this$_appendParams = _this$_appendParams.iframeNodesParams) === null || _this$_appendParams === void 0 ? void 0 : _this$_appendParams.selector
|
128
|
-
})));
|
129
|
-
}
|
130
|
-
var _iterator = _createForOfIteratorHelper(this.plugins.values()),
|
131
|
-
_step;
|
132
|
-
try {
|
133
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
134
|
-
var plugin = _step.value;
|
135
|
-
try {
|
136
|
-
if (plugin.logoutPlugin) {
|
137
|
-
plugin.logoutPlugin();
|
138
|
-
// eslint-disable-next-line no-empty
|
139
|
-
}
|
140
|
-
} catch (error) {
|
141
|
-
console.error(error);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
} catch (err) {
|
145
|
-
_iterator.e(err);
|
146
|
-
} finally {
|
147
|
-
_iterator.f();
|
148
|
-
}
|
149
|
-
}
|
150
|
-
/**
|
151
|
-
* @description init security SDK
|
152
|
-
* @param product Product Scenarios
|
153
|
-
* @param scene Scenario of the product (compatible with old version parameters, about to be deleted)
|
154
|
-
*/
|
155
|
-
}, {
|
156
|
-
key: "initSecurity",
|
157
|
-
value: function initSecurity(_ref) {
|
158
|
-
var _this = this;
|
159
|
-
var _ref$product = _ref.product,
|
160
|
-
product = _ref$product === void 0 ? productSceneEnum.EASY_PAY : _ref$product,
|
161
|
-
_ref$scene = _ref.scene,
|
162
|
-
scene = _ref$scene === void 0 ? productSceneEnum.EASY_PAY : _ref$scene;
|
163
|
-
this.logger.logInfo({
|
164
|
-
title: 'sdk_event_securitySdkPreInit'
|
165
|
-
}, {
|
166
|
-
product: product
|
167
|
-
}).send();
|
168
|
-
var sdk = this._getSecuritySDKByProductScene({
|
169
|
-
product: product || scene
|
170
|
-
});
|
171
|
-
if (sdk) return;
|
172
|
-
this._newSecuritySDKByScene({
|
173
|
-
product: product || scene,
|
174
|
-
region: SecurityRegionEnum.SG
|
175
|
-
}, function () {
|
176
|
-
_this.logger.logInfo({
|
177
|
-
title: 'sdk_event_securitySdkPreInitSuccess'
|
178
|
-
}, {
|
179
|
-
product: product
|
180
|
-
}).send();
|
181
|
-
}, function (msg) {
|
182
|
-
_this.logger.logError({
|
183
|
-
title: 'sdk_error_securitySdkInitFailed',
|
184
|
-
msg: msg
|
185
|
-
}, {
|
186
|
-
product: product,
|
187
|
-
sign: 'Active initialization'
|
188
|
-
}).send();
|
189
|
-
});
|
190
|
-
}
|
191
|
-
/**
|
192
|
-
* @description Obtain security SDK through scenario identification
|
193
|
-
*/
|
194
|
-
}, {
|
195
|
-
key: "_getSecuritySDKByProductScene",
|
196
|
-
value: function _getSecuritySDKByProductScene(securityConfig) {
|
197
|
-
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
198
|
-
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
199
|
-
var securitySdk = this.securitySdkMap.get(scene);
|
200
|
-
return securitySdk;
|
201
|
-
}
|
202
|
-
/**
|
203
|
-
* @description New security SDK through scenario identification
|
204
|
-
*/
|
205
|
-
}, {
|
206
|
-
key: "_newSecuritySDKByScene",
|
207
|
-
value: function _newSecuritySDKByScene(securityConfig, successCallback, failCallback) {
|
208
|
-
var storage = this.getSecurityConfigStorage(securityConfig.product);
|
209
|
-
var scene = storage.scene || getSecurityScene(securityConfig.product);
|
210
|
-
var h5gateway = storage.h5gateway || getSecurityHost(securityConfig.region);
|
211
|
-
try {
|
212
|
-
var securitySdk = new Security({
|
213
|
-
scene: scene,
|
214
|
-
h5gateway: h5gateway
|
215
|
-
});
|
216
|
-
this.securitySdkMap.set(scene, securitySdk);
|
217
|
-
securitySdk.initSecurity(successCallback, failCallback);
|
218
|
-
return securitySdk;
|
219
|
-
} catch (error) {
|
220
|
-
failCallback && failCallback(error === null || error === void 0 ? void 0 : error.toString());
|
221
|
-
}
|
222
|
-
}
|
223
|
-
/**
|
224
|
-
* @description Obtain risk control configuration in local storage
|
225
|
-
*/
|
226
|
-
}, {
|
227
|
-
key: "getSecurityConfigStorage",
|
228
|
-
value: function getSecurityConfigStorage(product) {
|
229
|
-
var scene = '';
|
230
|
-
var h5gateway = '';
|
231
|
-
var securityConfigStorage = getOrSetStorageId(getSecurityConfigStorageKey(product));
|
232
|
-
if (securityConfigStorage) {
|
233
|
-
var config = safeJson(securityConfigStorage, {});
|
234
|
-
scene = config === null || config === void 0 ? void 0 : config.appName;
|
235
|
-
h5gateway = config === null || config === void 0 ? void 0 : config.h5gateway;
|
236
|
-
}
|
237
|
-
return {
|
238
|
-
scene: scene,
|
239
|
-
h5gateway: h5gateway
|
240
|
-
};
|
241
|
-
}
|
242
|
-
/**
|
243
|
-
* @description Set the sdk basic configuration
|
244
|
-
*/
|
245
|
-
}, {
|
246
|
-
key: "_setOptions",
|
247
|
-
value: function _setOptions(options) {
|
248
|
-
this._setMode(options);
|
249
|
-
this._setEnv(options);
|
250
|
-
this.options.locale = (options === null || options === void 0 ? void 0 : options.locale) || '';
|
251
|
-
this.options.product = options === null || options === void 0 ? void 0 : options.product;
|
252
|
-
}
|
253
|
-
/**
|
254
|
-
* @description Set environment variables
|
255
|
-
*/
|
256
|
-
}, {
|
257
|
-
key: "_setEnv",
|
258
|
-
value: function _setEnv(options) {
|
259
|
-
var _queryParse = queryParse(),
|
260
|
-
_moreEnv = _queryParse._moreEnv;
|
261
|
-
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in environmentEnum) && _moreEnv !== 'true') {
|
262
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
263
|
-
options.environment = 'prod';
|
264
|
-
}
|
265
|
-
this.options.env = {
|
266
|
-
terminalType: device.isMobile ? terminalTypeEnum.WAP : terminalTypeEnum.WEB,
|
267
|
-
environment: (options === null || options === void 0 ? void 0 : options.environment) || 'prod'
|
268
|
-
};
|
269
|
-
if (this.options.env.terminalType === terminalTypeEnum.WAP) {
|
270
|
-
// eslint-disable-next-line no-nested-ternary
|
271
|
-
this.options.env.osType = device.iOS ? osTypeEnum.IOS : device.Android ? osTypeEnum.ANDROID : osTypeEnum.ELSE;
|
272
|
-
}
|
273
|
-
}
|
274
|
-
/**
|
275
|
-
* @description Set UI and Network Mode
|
276
|
-
*/
|
277
|
-
}, {
|
278
|
-
key: "_setMode",
|
279
|
-
value: function _setMode(options) {
|
280
|
-
this.options.mode = (options === null || options === void 0 ? void 0 : options.mode) || modeEnum.component;
|
281
|
-
if (options !== null && options !== void 0 && options.mode && !((options === null || options === void 0 ? void 0 : options.mode) in modeEnum)) {
|
282
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.MODE_ERROR.message);
|
283
|
-
this.options.mode = modeEnum.component;
|
284
|
-
}
|
285
|
-
this.options.networkMode = (options === null || options === void 0 ? void 0 : options.networkMode) || networkModeEnum.session;
|
286
|
-
if (options !== null && options !== void 0 && options.networkMode && !((options === null || options === void 0 ? void 0 : options.networkMode) in networkModeEnum)) {
|
287
|
-
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
288
|
-
this.options.networkMode = networkModeEnum.proxy;
|
289
|
-
}
|
290
|
-
}
|
291
|
-
/**
|
292
|
-
* @description Initialize event related tasks
|
293
|
-
*/
|
294
|
-
}, {
|
295
|
-
key: "_initEvent",
|
296
|
-
value: function _initEvent(options) {
|
297
|
-
var _this2 = this;
|
298
|
-
if (options !== null && options !== void 0 && options.onError) {
|
299
|
-
if (getType(options.onError) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
300
|
-
this._overrideSubscription(EVENT.error.name, options.onError, EVENT.error.uniqueKey);
|
301
|
-
}
|
302
|
-
if (options !== null && options !== void 0 && options.onPaymentMethodSelected) {
|
303
|
-
if (getType(options.onPaymentMethodSelected) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
304
|
-
this._overrideSubscription(EVENT.paymentMethodSelected.name, options.onPaymentMethodSelected, EVENT.paymentMethodSelected.uniqueKey);
|
305
|
-
}
|
306
|
-
if (options !== null && options !== void 0 && options.onSizeChanged) {
|
307
|
-
if (getType(options.onSizeChanged) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
308
|
-
this._overrideSubscription(EVENT.sizeChanged.name, options.onSizeChanged, EVENT.sizeChanged.uniqueKey);
|
309
|
-
}
|
310
|
-
if (options !== null && options !== void 0 && options.onLog) {
|
311
|
-
if (getType(options.onLog) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
312
|
-
this._overrideSubscription(EVENT.log.name, options.onLog, EVENT.log.uniqueKey);
|
313
|
-
}
|
314
|
-
if (options !== null && options !== void 0 && options.onEventCallback) {
|
315
|
-
if (getType(options.onEventCallback) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
316
|
-
this._overrideSubscription(EVENT.eventCallback.name, options.onEventCallback, EVENT.eventCallback.uniqueKey);
|
317
|
-
}
|
318
|
-
if (options !== null && options !== void 0 && options.onClose) {
|
319
|
-
if (getType(options.onClose) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
320
|
-
this._overrideSubscription(EVENT.close.name, options.onClose, EVENT.close.uniqueKey);
|
321
|
-
}
|
322
|
-
if (options !== null && options !== void 0 && options.onBeforeSubmit) {
|
323
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.onBeforeSubmit) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
324
|
-
this._overrideSubscription(EVENT.beforeSubmit.name, /*#__PURE__*/function () {
|
325
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
|
326
|
-
var eventCallbackId, res;
|
327
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
328
|
-
while (1) switch (_context.prev = _context.next) {
|
329
|
-
case 0:
|
330
|
-
eventCallbackId = uuid();
|
331
|
-
_context.prev = 1;
|
332
|
-
_context.next = 4;
|
333
|
-
return options.onBeforeSubmit(payload);
|
334
|
-
case 4:
|
335
|
-
res = _context.sent;
|
336
|
-
_this2._componentApp.dispatchToApp({
|
337
|
-
context: {
|
338
|
-
event: EVENT.beforeSubmitDone.name,
|
339
|
-
eventCallbackId: eventCallbackId,
|
340
|
-
data: res
|
341
|
-
}
|
342
|
-
});
|
343
|
-
_context.next = 12;
|
344
|
-
break;
|
345
|
-
case 8:
|
346
|
-
_context.prev = 8;
|
347
|
-
_context.t0 = _context["catch"](1);
|
348
|
-
_this2._componentApp.dispatchToApp({
|
349
|
-
context: {
|
350
|
-
event: EVENT.beforeSubmitDone.name,
|
351
|
-
eventCallbackId: eventCallbackId,
|
352
|
-
data: {
|
353
|
-
result: 'ERROR'
|
354
|
-
}
|
355
|
-
}
|
356
|
-
});
|
357
|
-
_this2.logger.logError({
|
358
|
-
title: 'sdk_error_before_submit',
|
359
|
-
msg: JSON.stringify(_context.t0)
|
360
|
-
}).send();
|
361
|
-
case 12:
|
362
|
-
case "end":
|
363
|
-
return _context.stop();
|
364
|
-
}
|
365
|
-
}, _callee, null, [[1, 8]]);
|
366
|
-
}));
|
367
|
-
return function (_x) {
|
368
|
-
return _ref2.apply(this, arguments);
|
369
|
-
};
|
370
|
-
}(), EVENT.beforeSubmit.uniqueKey);
|
371
|
-
}
|
372
|
-
/** 地址监听 */
|
373
|
-
if (options !== null && options !== void 0 && options.onChange) {
|
374
|
-
if (getType(options.onChange) !== 'function') throw new Error(ERRORMESSAGE.INIT_PARAMETER_ERROR.EVENT_ERROR.message);
|
375
|
-
this._overrideSubscription(EVENT.onChange.name, options.onChange, EVENT.onChange.uniqueKey);
|
376
|
-
}
|
377
|
-
}
|
378
|
-
/**
|
379
|
-
* @description Register plug-in
|
380
|
-
*/
|
381
|
-
}, {
|
382
|
-
key: "_registerPlugin",
|
383
|
-
value: function _registerPlugin(pluginId, plugin) {
|
384
|
-
this.plugins.set(pluginId, plugin);
|
385
|
-
if (plugin !== null && plugin !== void 0 && plugin.applyPlugin) {
|
386
|
-
try {
|
387
|
-
plugin.applyPlugin(this);
|
388
|
-
} catch (error) {
|
389
|
-
this.plugins.delete(pluginId);
|
390
|
-
if (getType(error) === 'error') throw error;
|
391
|
-
throw new Error("Failed to register plug-in\uFF1A".concat(pluginId, " Exception in the apply function of the plug-in"));
|
392
|
-
}
|
393
|
-
}
|
394
|
-
}
|
395
|
-
/**
|
396
|
-
* @description Get Plug-in
|
397
|
-
*/
|
398
|
-
}, {
|
399
|
-
key: "_getPlugin",
|
400
|
-
value: function _getPlugin(pluginId) {
|
401
|
-
if (!this.plugins.has(pluginId)) {
|
402
|
-
console.warn("".concat(pluginId, " Plugin unregistered"));
|
403
|
-
return null;
|
404
|
-
}
|
405
|
-
return this.plugins.get(pluginId);
|
406
|
-
}
|
407
|
-
|
408
|
-
/**
|
409
|
-
* @description Execute to open app or jump link
|
410
|
-
*/
|
411
|
-
}, {
|
412
|
-
key: "_redirect",
|
413
|
-
value: function _redirect(data) {
|
414
|
-
var _this3 = this;
|
415
|
-
return new Promise(function (resolve, reject) {
|
416
|
-
var isWeb = _this3.options.env.terminalType === terminalTypeEnum.WEB;
|
417
|
-
var normalUrl = (data === null || data === void 0 ? void 0 : data.normalUrl) || '';
|
418
|
-
var schemeUrl = (data === null || data === void 0 ? void 0 : data.schemeUrl) || '';
|
419
|
-
var applinkUrl = (data === null || data === void 0 ? void 0 : data.applinkUrl) || '';
|
420
|
-
var callAppJudgeTime = (data === null || data === void 0 ? void 0 : data.callAppJudgeTime) || '';
|
421
|
-
var jumpFunc = function jumpFunc() {
|
422
|
-
if (normalUrl) {
|
423
|
-
resolve();
|
424
|
-
window.location.href = normalUrl;
|
425
|
-
return;
|
426
|
-
}
|
427
|
-
reject(ERRORMESSAGE.SDK_CALL_URL_ERROR.REDIRECT_ERROR);
|
428
|
-
};
|
429
|
-
var callAppFunc = function callAppFunc() {
|
430
|
-
if (!schemeUrl && !applinkUrl) {
|
431
|
-
jumpFunc();
|
432
|
-
return;
|
433
|
-
}
|
434
|
-
var config = {
|
435
|
-
fallback: function fallback() {
|
436
|
-
jumpFunc();
|
437
|
-
},
|
438
|
-
successCb: function successCb() {
|
439
|
-
resolve();
|
440
|
-
},
|
441
|
-
delay: 0
|
442
|
-
};
|
443
|
-
if (callAppJudgeTime) {
|
444
|
-
config['resultJudgmentTime'] = callAppJudgeTime;
|
445
|
-
}
|
446
|
-
try {
|
447
|
-
var callLib = new CallApp(config);
|
448
|
-
callLib.open({
|
449
|
-
scheme: schemeUrl,
|
450
|
-
link: applinkUrl
|
451
|
-
});
|
452
|
-
} catch (error) {
|
453
|
-
jumpFunc();
|
454
|
-
}
|
455
|
-
};
|
456
|
-
if (isWeb) {
|
457
|
-
jumpFunc();
|
458
|
-
} else {
|
459
|
-
callAppFunc();
|
460
|
-
}
|
461
|
-
});
|
462
|
-
}
|
463
|
-
/**
|
464
|
-
* @description Overlay Subscription
|
465
|
-
*/
|
466
|
-
}, {
|
467
|
-
key: "_overrideSubscription",
|
468
|
-
value: function _overrideSubscription(name, func, funcKey) {
|
469
|
-
this._eventCenter.off(name, func, funcKey);
|
470
|
-
this._eventCenter.on(name, func, funcKey);
|
471
|
-
}
|
472
|
-
}, {
|
473
|
-
key: "getBusActionNames",
|
474
|
-
value: function getBusActionNames() {
|
475
|
-
var _appendParams$iframeN;
|
476
|
-
var appendParams = this._appendParams;
|
477
|
-
if (!appendParams) {
|
478
|
-
return null;
|
479
|
-
}
|
480
|
-
var actionNames = null;
|
481
|
-
var paymentSessionConfig = appendParams === null || appendParams === void 0 || (_appendParams$iframeN = appendParams.iframeNodesParams) === null || _appendParams$iframeN === void 0 || (_appendParams$iframeN = _appendParams$iframeN.paymentSessionMetaData) === null || _appendParams$iframeN === void 0 ? void 0 : _appendParams$iframeN.paymentSessionConfig;
|
482
|
-
if (paymentSessionConfig) {
|
483
|
-
var _appendParams$iframeN2;
|
484
|
-
var pluginKey = paymentSessionConfig.productScene + paymentSessionConfig.productSceneVersion + paymentSessionConfig.paymentMethodCategoryType;
|
485
|
-
var paymentMethodType = appendParams === null || appendParams === void 0 || (_appendParams$iframeN2 = appendParams.iframeNodesParams) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentSessionMetaData) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentSessionFactor) === null || _appendParams$iframeN2 === void 0 || (_appendParams$iframeN2 = _appendParams$iframeN2.paymentMethodInfo) === null || _appendParams$iframeN2 === void 0 ? void 0 : _appendParams$iframeN2.paymentMethodType;
|
486
|
-
if (paymentMethodType) {
|
487
|
-
pluginKey = pluginKey + paymentMethodType;
|
488
|
-
}
|
489
|
-
actionNames = this._getPlugin(pluginKey);
|
490
|
-
}
|
491
|
-
if (this.options.product === productSceneEnum.ELEMENT_ADDRESS) {
|
492
|
-
actionNames = this._getPlugin(productSceneEnum.ELEMENT_ADDRESS);
|
493
|
-
}
|
494
|
-
return actionNames;
|
495
|
-
}
|
496
|
-
}]);
|
497
|
-
return AMSSDK;
|
498
|
-
}();
|
499
|
-
export { AMSSDK as default };
|
@@ -1,50 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
-
*
|
4
|
-
* 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:
|
5
|
-
* 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
|
6
|
-
* 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.
|
7
|
-
*/
|
8
|
-
import { ApplePaySubTypeEnum, IAppendParams, IApplePayOptionsParams } from '../../types';
|
9
|
-
import type { Logger } from '../../util/logger';
|
10
|
-
export declare enum ApplePayComponentEvent {
|
11
|
-
sdk_event_appleAvailable = "sdk_event_appleAvailable",
|
12
|
-
sdk_event_appleCreateComponent = "sdk_event_appleCreateComponent",
|
13
|
-
sdk_event_appleShowPaymentSheet = "sdk_event_appleShowPaymentSheet",
|
14
|
-
sdk_event_appleOnvalidatemerchant = "sdk_event_appleOnvalidatemerchant",
|
15
|
-
sdk_event_appleSubmitToken = "sdk_event_appleSubmitToken",
|
16
|
-
sdk_event_applePaymentResult = "sdk_event_applePaymentResult",
|
17
|
-
sdk_event_appleDestroyComponent = "sdk_event_appleDestroyComponent"
|
18
|
-
}
|
19
|
-
/**
|
20
|
-
* Apple pay Component
|
21
|
-
*/
|
22
|
-
declare class ApplePayComponent {
|
23
|
-
private _applePayService;
|
24
|
-
private _parseData;
|
25
|
-
private _sessionData;
|
26
|
-
private _isFinish;
|
27
|
-
private _options;
|
28
|
-
private logger;
|
29
|
-
private isRecurring;
|
30
|
-
constructor(options: IApplePayOptionsParams, logger: Logger);
|
31
|
-
/**
|
32
|
-
* Is Apple Pay Enabled
|
33
|
-
* @param subTypeEnum
|
34
|
-
* @returns
|
35
|
-
*/
|
36
|
-
canMakePayments(subTypeEnum?: ApplePaySubTypeEnum): boolean;
|
37
|
-
/**
|
38
|
-
* Is Apple Pay Enabled
|
39
|
-
* @param subTypeEnum
|
40
|
-
* @returns
|
41
|
-
*/
|
42
|
-
isAppPayEnabled(subTypeEnum?: ApplePaySubTypeEnum): boolean;
|
43
|
-
private onEventCallback;
|
44
|
-
/**
|
45
|
-
* Submit Pay
|
46
|
-
* @param paymentSessionData
|
47
|
-
*/
|
48
|
-
submitPay(appendParams: IAppendParams): void;
|
49
|
-
}
|
50
|
-
export default ApplePayComponent;
|