@alipay/ams-checkout 1.5.7 → 1.5.9
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/config/index.d.ts +1 -1
- package/esm/config/index.js +4 -4
- package/esm/constant/index.d.ts +13 -0
- package/esm/constant/index.js +13 -0
- package/esm/core/component/index.js +7 -4
- package/esm/core/instance/index.d.ts +13 -1
- package/esm/core/instance/index.js +77 -4
- package/esm/index.js +1 -1
- package/esm/plugin/component/cashierApp.js +3 -3
- package/esm/plugin/component/component.popup.style.js +24 -24
- package/esm/plugin/component/index.d.ts +9 -2
- package/esm/plugin/component/index.js +402 -193
- package/esm/plugin/component/popupWindow.style.d.ts +6 -0
- package/esm/plugin/component/popupWindow.style.js +54 -0
- package/esm/plugin/drop-in/index.js +1 -1
- package/esm/request/index.d.ts +2 -1
- package/esm/request/index.js +61 -38
- package/esm/service/index.d.ts +9 -1
- package/esm/service/index.js +8 -7
- package/esm/types/index.d.ts +47 -9
- package/esm/types/index.js +13 -0
- package/esm/util/get.js +1 -1
- package/esm/util/index.js +1 -1
- package/esm/util/logger.d.ts +55 -0
- package/esm/util/logger.js +177 -0
- package/esm/util/security.d.ts +6 -3
- package/esm/util/security.js +98 -75
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
function _typeof(
|
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
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
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
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
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
@@ -16,21 +16,17 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
16
16
|
*/
|
17
17
|
/* eslint-disable no-console */
|
18
18
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
19
|
+
import { marmotMap } from "../../config/index";
|
19
20
|
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID } from "../../constant";
|
20
21
|
import { queryPaymentInfo } from "../../service";
|
21
|
-
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, targetEnum } from "../../types";
|
22
|
-
import { getType, isJsonString, isPC
|
22
|
+
import { componentSignEnum, eventCodeEnum, messageName, platformEnum, productSceneEnum, renderDisplayTypeEnum, SecuritySceneEnum, targetEnum, RedirectType } from "../../types";
|
23
|
+
import { getType, isJsonString, isPC } from "../../util";
|
23
24
|
import { isLocalMock } from "../../util/mock";
|
25
|
+
import { getApdidToken, getAppname, getSecurityHost, initSecuritySDK } from "../../util/security";
|
24
26
|
import { createIframe, getAppDomain, getIframeUrl } from "./cashierApp";
|
25
27
|
import { addInlineLoading, createInlineBaseElement } from "./component.inline.style";
|
26
28
|
import { addPopupLoading, createBaseElement, createMockup, createRetentionPopup, handleDeclareInfo as _handleDeclareInfo, hideRetentionPopup, removeRetentionPopup as _removeRetentionPopup } from "./component.popup.style";
|
27
|
-
import
|
28
|
-
import { getSecurityHost, getAppname } from "../../util/security";
|
29
|
-
var _ref = queryParse() || {},
|
30
|
-
preinit = _ref.preinit,
|
31
|
-
rebuild = _ref.rebuild,
|
32
|
-
scene = _ref.scene,
|
33
|
-
region = _ref.region;
|
29
|
+
import { createModal, destroyModal, insertStyleSheet } from "./popupWindow.style";
|
34
30
|
window.changingPageHeight = window.innerHeight;
|
35
31
|
var ComponentApp = /*#__PURE__*/function () {
|
36
32
|
function ComponentApp() {
|
@@ -41,6 +37,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
41
37
|
_defineProperty(this, "_performanceData", []);
|
42
38
|
_defineProperty(this, "_loadAppPromiseResolve", null);
|
43
39
|
_defineProperty(this, "_isInitComponent", void 0);
|
40
|
+
_defineProperty(this, "_threedData", void 0);
|
41
|
+
_defineProperty(this, "popupWindow", void 0);
|
44
42
|
_defineProperty(this, "appDomain", void 0);
|
45
43
|
_defineProperty(this, "createIframeNode", void 0);
|
46
44
|
_defineProperty(this, "_selector", void 0);
|
@@ -51,7 +49,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
51
49
|
_defineProperty(this, "_componentSign", componentSignEnum.NONE);
|
52
50
|
_defineProperty(this, "_clickEventName", void 0);
|
53
51
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
54
|
-
this._appVersion = '1.5.
|
52
|
+
this._appVersion = '1.5.9';
|
55
53
|
this._isInitComponent = false;
|
56
54
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
57
55
|
this.createIframeNode = function () {
|
@@ -84,6 +82,29 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
84
82
|
this.AMSSDK = AMSSDK;
|
85
83
|
this.subscribeFromSDK();
|
86
84
|
}
|
85
|
+
}, {
|
86
|
+
key: "initLoggerMeta",
|
87
|
+
value: function initLoggerMeta() {
|
88
|
+
var _this$_renderParams, _paymentSessionMetaDa;
|
89
|
+
console.log('this._renderParams', JSON.stringify(this._renderParams), null, 3);
|
90
|
+
var paymentSessionMetaData = (_this$_renderParams = this._renderParams) === null || _this$_renderParams === void 0 ? void 0 : _this$_renderParams.paymentSessionMetaData;
|
91
|
+
var paymentSessionConfig = paymentSessionMetaData.paymentSessionConfig;
|
92
|
+
this.AMSSDK.logger.setMedta({
|
93
|
+
platform: this.platform === platformEnum.desktop ? 'PC' : 'WAP',
|
94
|
+
// PC/WAP,
|
95
|
+
sdkVersion: this._appVersion,
|
96
|
+
instanceId: this.AMSSDK._instanceId,
|
97
|
+
storageId: this.AMSSDK._storageId,
|
98
|
+
// the better way to use md5 paymentSesionID
|
99
|
+
renderDisplayType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.renderDisplayType,
|
100
|
+
merchantId: paymentSessionMetaData === null || paymentSessionMetaData === void 0 ? void 0 : paymentSessionMetaData.clientId,
|
101
|
+
productScene: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productScene,
|
102
|
+
productSceneVersion: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.productSceneVersion,
|
103
|
+
paymentMethodType: paymentSessionMetaData === null || paymentSessionMetaData === void 0 || (_paymentSessionMetaDa = paymentSessionMetaData.paymentMethodInfoView) === null || _paymentSessionMetaDa === void 0 ? void 0 : _paymentSessionMetaDa.paymentMethodType,
|
104
|
+
paymentMethodCategoryType: paymentSessionConfig === null || paymentSessionConfig === void 0 ? void 0 : paymentSessionConfig.paymentMethodCategoryType
|
105
|
+
});
|
106
|
+
this.AMSSDK.logger.setComponentStartTime(Date.now());
|
107
|
+
}
|
87
108
|
|
88
109
|
/**
|
89
110
|
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
@@ -96,24 +117,84 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
96
117
|
}, {
|
97
118
|
key: "initAPSecurity",
|
98
119
|
value: function initAPSecurity() {
|
99
|
-
var _this$
|
120
|
+
var _this$_renderParams2,
|
121
|
+
_this = this;
|
100
122
|
if (componentSignEnum.CASHIER_PAYMENT_CARD !== this._componentSign) {
|
101
123
|
return;
|
102
124
|
}
|
103
|
-
var securityConfig = (_this$
|
125
|
+
var securityConfig = (_this$_renderParams2 = this._renderParams) === null || _this$_renderParams2 === void 0 || (_this$_renderParams2 = _this$_renderParams2.paymentSessionMetaData) === null || _this$_renderParams2 === void 0 ? void 0 : _this$_renderParams2.securityConfig;
|
104
126
|
if (!securityConfig) {
|
105
127
|
return;
|
106
128
|
}
|
107
129
|
var appName = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.appName;
|
108
130
|
var h5gateway = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.h5gateway;
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
}
|
116
|
-
|
131
|
+
|
132
|
+
// if merchant have init securitySDK and same as service paymentSessionMetaData, no need init again
|
133
|
+
if (this.AMSSDK.securityConfig) {
|
134
|
+
if (appName === getAppname(this.AMSSDK.securityConfig.scene) && h5gateway === getSecurityHost(this.AMSSDK.securityConfig.region)) {
|
135
|
+
return;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
this.AMSSDK.logger.logInfo({
|
139
|
+
title: 'sdk_event_securitySdkInit'
|
140
|
+
});
|
141
|
+
initSecuritySDK(appName, h5gateway, function () {
|
142
|
+
_this.AMSSDK.logger.logInfo({
|
143
|
+
title: 'sdk_event_securitySdkInitSuccess'
|
144
|
+
});
|
145
|
+
}, function () {
|
146
|
+
// TODO Distinguishing Call Scenarios of Security SDK Failures
|
147
|
+
_this.AMSSDK.logger.logError({
|
148
|
+
title: 'sdk_error_securitySdkInitFailed'
|
149
|
+
});
|
150
|
+
});
|
151
|
+
}
|
152
|
+
}, {
|
153
|
+
key: "logDeviceId",
|
154
|
+
value: function logDeviceId(deviceId, getDeviceIdStartTime) {
|
155
|
+
var time = "".concat(Date.now() - getDeviceIdStartTime);
|
156
|
+
if (deviceId) {
|
157
|
+
this.AMSSDK.logger.logInfo({
|
158
|
+
title: 'sdk_event_securitySdkGetTokenSuccess'
|
159
|
+
}, {
|
160
|
+
deviceId: deviceId,
|
161
|
+
time: time
|
162
|
+
}).send();
|
163
|
+
} else {
|
164
|
+
this.AMSSDK.logger.logInfo({
|
165
|
+
title: 'sdk_error_securitySdkGetTokenFailed'
|
166
|
+
}, {
|
167
|
+
deviceId: deviceId,
|
168
|
+
time: time
|
169
|
+
}).send();
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}, {
|
173
|
+
key: "getDeviceIdAndLog",
|
174
|
+
value: function getDeviceIdAndLog() {
|
175
|
+
var _this2 = this;
|
176
|
+
return new Promise(function (resolve) {
|
177
|
+
// To avoid rendering being blocked, move the logic to the next event loop for processing
|
178
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
179
|
+
var _this2$_renderParams;
|
180
|
+
var securityConfig, getDeviceIdStartTime, deviceId;
|
181
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
182
|
+
while (1) switch (_context.prev = _context.next) {
|
183
|
+
case 0:
|
184
|
+
securityConfig = (_this2$_renderParams = _this2._renderParams) === null || _this2$_renderParams === void 0 || (_this2$_renderParams = _this2$_renderParams.paymentSessionMetaData) === null || _this2$_renderParams === void 0 ? void 0 : _this2$_renderParams.securityConfig;
|
185
|
+
getDeviceIdStartTime = Date.now();
|
186
|
+
_context.next = 4;
|
187
|
+
return getApdidToken(getAppname(SecuritySceneEnum.CARD), securityConfig);
|
188
|
+
case 4:
|
189
|
+
deviceId = _context.sent;
|
190
|
+
_this2.logDeviceId(deviceId, getDeviceIdStartTime);
|
191
|
+
resolve(deviceId);
|
192
|
+
case 7:
|
193
|
+
case "end":
|
194
|
+
return _context.stop();
|
195
|
+
}
|
196
|
+
}, _callee);
|
197
|
+
})), 0);
|
117
198
|
});
|
118
199
|
}
|
119
200
|
|
@@ -123,7 +204,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
123
204
|
}, {
|
124
205
|
key: "appendIframeNodes",
|
125
206
|
value: function appendIframeNodes(componentSign, renderParams) {
|
126
|
-
var
|
207
|
+
var _this3 = this;
|
127
208
|
if (this._isInitComponent) {
|
128
209
|
this.dispatchToSDK(EVENT.error.name, ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
129
210
|
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.SINGLETON_COMPONENT_ERROR);
|
@@ -135,6 +216,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
135
216
|
this._renderDisplayType = renderParams.renderDisplayType;
|
136
217
|
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
137
218
|
this.initAPSecurity();
|
219
|
+
this.initLoggerMeta();
|
138
220
|
this._performanceData.push({
|
139
221
|
key: 'sdk_create_component',
|
140
222
|
value: Date.now()
|
@@ -145,6 +227,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
145
227
|
if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
|
146
228
|
var container = createInlineBaseElement(this._selector);
|
147
229
|
if (container) this.renderInlineLoading(renderParams, container);
|
230
|
+
insertStyleSheet();
|
148
231
|
}
|
149
232
|
if (this._renderDisplayType === renderDisplayTypeEnum.popup) {
|
150
233
|
createBaseElement(this.platform, this.closeBtnFunc.bind(this));
|
@@ -154,10 +237,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
154
237
|
}
|
155
238
|
this.createApp(renderParams);
|
156
239
|
return Promise.all([this.createActionQueryPromise(), this.createIframeNode(this, insertedNode, this._renderDisplayType), this._createLoadAppPromise()]).then(function () {
|
240
|
+
_this3.AMSSDK.logger.logInfo({
|
241
|
+
title: 'sdk_event_successfully_created_app_process'
|
242
|
+
}).send();
|
157
243
|
return Promise.resolve();
|
158
244
|
}).catch(function (error) {
|
159
|
-
|
160
|
-
|
245
|
+
_this3._isInitComponent = false;
|
246
|
+
_this3.cleanContainer();
|
161
247
|
return Promise.reject(error);
|
162
248
|
});
|
163
249
|
}
|
@@ -165,7 +251,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
165
251
|
key: "renderInlineLoading",
|
166
252
|
value: function renderInlineLoading(renderParams, selector) {
|
167
253
|
var _renderParams$appeara;
|
168
|
-
var showLoading = renderParams === null || renderParams === void 0
|
254
|
+
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara = renderParams.appearance) === null || _renderParams$appeara === void 0 ? void 0 : _renderParams$appeara.showLoading;
|
169
255
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
170
256
|
if (showLoading) addInlineLoading(selector, this.platform);
|
171
257
|
}
|
@@ -173,7 +259,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
173
259
|
key: "renderPopupLoading",
|
174
260
|
value: function renderPopupLoading(renderParams) {
|
175
261
|
var _renderParams$appeara2;
|
176
|
-
var showLoading = renderParams === null || renderParams === void 0
|
262
|
+
var showLoading = renderParams === null || renderParams === void 0 || (_renderParams$appeara2 = renderParams.appearance) === null || _renderParams$appeara2 === void 0 ? void 0 : _renderParams$appeara2.showLoading;
|
177
263
|
showLoading = typeof showLoading === 'boolean' ? showLoading : true;
|
178
264
|
if (!showLoading) return;
|
179
265
|
var mockup = document.getElementById(MOCKUP_ID);
|
@@ -183,17 +269,20 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
183
269
|
}, {
|
184
270
|
key: "_createLoadAppPromise",
|
185
271
|
value: function _createLoadAppPromise() {
|
186
|
-
var
|
272
|
+
var _this4 = this;
|
187
273
|
return new Promise(function (resolve, reject) {
|
188
|
-
|
274
|
+
_this4._loadAppPromiseResolve = resolve;
|
189
275
|
setTimeout(function () {
|
190
276
|
reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
|
191
277
|
}, LOADTIME_LIMIT);
|
192
278
|
}).catch(function (error) {
|
193
|
-
|
279
|
+
_this4.dispatchToSDK(EVENT.error.name, {
|
194
280
|
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code,
|
195
281
|
message: ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT.message
|
196
282
|
});
|
283
|
+
_this4.AMSSDK.logger.logError({
|
284
|
+
title: 'sdk_error_web_app_timeout'
|
285
|
+
}).send();
|
197
286
|
return Promise.reject(error);
|
198
287
|
});
|
199
288
|
}
|
@@ -204,109 +293,131 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
204
293
|
}, {
|
205
294
|
key: "createActionQueryPromise",
|
206
295
|
value: function createActionQueryPromise() {
|
207
|
-
var
|
296
|
+
var _this5 = this;
|
208
297
|
this._performanceData.push({
|
209
298
|
key: 'sdk_action_query_start',
|
210
299
|
value: Date.now()
|
211
300
|
});
|
212
|
-
this._actionQueryPromise = new Promise(function (resolve, reject) {
|
213
|
-
var _this3$_renderParams, _this3$_renderParams2, _this3$_renderParams3, _this3$_renderParams4, _this3$_renderParams5;
|
214
|
-
var params = {
|
215
|
-
paymentSessionData: _this3._renderParams && ((_this3$_renderParams = _this3._renderParams) === null || _this3$_renderParams === void 0 ? void 0 : _this3$_renderParams.sessionData) || '',
|
216
|
-
paymentSessionConfig: (_this3$_renderParams2 = _this3._renderParams) === null || _this3$_renderParams2 === void 0 ? void 0 : (_this3$_renderParams3 = _this3$_renderParams2.paymentSessionMetaData) === null || _this3$_renderParams3 === void 0 ? void 0 : _this3$_renderParams3.paymentSessionConfig
|
217
|
-
};
|
218
|
-
/**
|
219
|
-
* @description card
|
220
|
-
*/
|
221
|
-
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign || componentSignEnum.VAULTING_CARD === _this3._componentSign) {
|
222
|
-
params.paymentMethodType = 'CARD';
|
223
|
-
}
|
224
|
-
var needDeviceId = false;
|
225
|
-
var waitTime = '3000';
|
226
|
-
var securityConfig = (_this3$_renderParams4 = _this3._renderParams) === null || _this3$_renderParams4 === void 0 ? void 0 : (_this3$_renderParams5 = _this3$_renderParams4.paymentSessionMetaData) === null || _this3$_renderParams5 === void 0 ? void 0 : _this3$_renderParams5.securityConfig;
|
227
|
-
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this3._componentSign && securityConfig) {
|
228
|
-
var _this3$_renderParams6, _this3$_renderParams7;
|
229
|
-
var extendInfo = ((_this3$_renderParams6 = _this3._renderParams) === null || _this3$_renderParams6 === void 0 ? void 0 : (_this3$_renderParams7 = _this3$_renderParams6.paymentSessionMetaData) === null || _this3$_renderParams7 === void 0 ? void 0 : _this3$_renderParams7.extendInfo) || '';
|
230
|
-
var info = JSON.parse(extendInfo);
|
231
|
-
if ((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false') {
|
232
|
-
needDeviceId = true;
|
233
|
-
waitTime = securityConfig === null || securityConfig === void 0 ? void 0 : securityConfig.tokenCollectTime;
|
234
|
-
}
|
235
|
-
}
|
236
301
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
var
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
302
|
+
// eslint-disable-next-line no-async-promise-executor
|
303
|
+
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
304
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
305
|
+
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
|
306
|
+
var envInfo, params, securityConfig, _this5$_renderParams5, extendInfo, info, _this5$_renderParams6, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams7, _action$web, _action$wap, action, signType;
|
307
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
308
|
+
while (1) switch (_context2.prev = _context2.next) {
|
309
|
+
case 0:
|
310
|
+
envInfo = {
|
311
|
+
locale: _this5.AMSSDK.options.locale
|
312
|
+
};
|
313
|
+
params = {
|
314
|
+
paymentSessionData: _this5._renderParams && ((_this5$_renderParams = _this5._renderParams) === null || _this5$_renderParams === void 0 ? void 0 : _this5$_renderParams.sessionData) || '',
|
315
|
+
paymentSessionConfig: (_this5$_renderParams2 = _this5._renderParams) === null || _this5$_renderParams2 === void 0 || (_this5$_renderParams2 = _this5$_renderParams2.paymentSessionMetaData) === null || _this5$_renderParams2 === void 0 ? void 0 : _this5$_renderParams2.paymentSessionConfig,
|
316
|
+
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
317
|
+
};
|
318
|
+
/**
|
319
|
+
* @description card
|
320
|
+
*/
|
321
|
+
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign) {
|
322
|
+
params.paymentMethodType = 'CARD';
|
323
|
+
}
|
324
|
+
securityConfig = (_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 || (_this5$_renderParams4 = _this5$_renderParams4.paymentSessionMetaData) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.securityConfig;
|
325
|
+
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign && securityConfig)) {
|
326
|
+
_context2.next = 11;
|
327
|
+
break;
|
328
|
+
}
|
329
|
+
extendInfo = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 || (_this5$_renderParams5 = _this5$_renderParams5.paymentSessionMetaData) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.extendInfo) || '{}';
|
330
|
+
info = JSON.parse(extendInfo);
|
331
|
+
if (!((info === null || info === void 0 ? void 0 : info.cardTokenPay) !== 'false')) {
|
332
|
+
_context2.next = 11;
|
333
|
+
break;
|
334
|
+
}
|
335
|
+
_context2.next = 10;
|
336
|
+
return _this5.getDeviceIdAndLog();
|
337
|
+
case 10:
|
338
|
+
envInfo.deviceId = _context2.sent;
|
339
|
+
case 11:
|
340
|
+
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
341
|
+
_context2.next = 16;
|
342
|
+
break;
|
343
|
+
}
|
344
|
+
_ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
|
345
|
+
_ref4 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
346
|
+
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
347
|
+
_context2.next = 16;
|
348
|
+
break;
|
349
|
+
}
|
350
|
+
return _context2.abrupt("return", resolve({
|
351
|
+
message: 'sdk no need to make query request',
|
352
|
+
success: true
|
353
|
+
}));
|
354
|
+
case 16:
|
355
|
+
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
356
|
+
_context2.next = 23;
|
357
|
+
break;
|
358
|
+
}
|
359
|
+
action = ((_this5$_renderParams7 = _this5._renderParams) === null || _this5$_renderParams7 === void 0 || (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) === null || _this5$_renderParams7 === void 0 ? void 0 : _this5$_renderParams7.action) || {};
|
360
|
+
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
361
|
+
if (!(signType === 'SMS')) {
|
362
|
+
_context2.next = 21;
|
363
|
+
break;
|
364
|
+
}
|
365
|
+
return _context2.abrupt("return", resolve({
|
366
|
+
message: 'sdk no need to make query request',
|
367
|
+
success: true
|
368
|
+
}));
|
369
|
+
case 21:
|
370
|
+
if (!(!signType || signType !== 'REDIRECT')) {
|
371
|
+
_context2.next = 23;
|
372
|
+
break;
|
373
|
+
}
|
374
|
+
return _context2.abrupt("return", resolve({
|
375
|
+
success: false
|
376
|
+
}));
|
377
|
+
case 23:
|
378
|
+
if (!isLocalMock()) {
|
379
|
+
_context2.next = 25;
|
380
|
+
break;
|
381
|
+
}
|
382
|
+
return _context2.abrupt("return", resolve({
|
383
|
+
message: 'sdk no need to make query request',
|
384
|
+
success: true
|
385
|
+
}));
|
386
|
+
case 25:
|
387
|
+
queryPaymentInfo(params, {
|
388
|
+
env: _this5.AMSSDK.options.env.environment,
|
389
|
+
envInfo: envInfo
|
390
|
+
}, _this5.AMSSDK.logger).then(function (res) {
|
391
|
+
_this5._performanceData.push({
|
392
|
+
key: 'sdk_action_query_end',
|
393
|
+
value: Date.now()
|
394
|
+
});
|
395
|
+
if (res !== null && res !== void 0 && res.success) {
|
396
|
+
resolve(res);
|
397
|
+
} else {
|
398
|
+
resolve(res);
|
399
|
+
}
|
400
|
+
}).catch(function (err) {
|
401
|
+
if (componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign) {
|
402
|
+
return resolve({
|
403
|
+
success: false
|
404
|
+
});
|
405
|
+
}
|
406
|
+
_this5.dispatchToSDK(EVENT.error.name, {
|
407
|
+
code: ERRORMESSAGE.CREATECOMPONENT_ERROR.code
|
408
|
+
});
|
409
|
+
reject(err);
|
410
|
+
});
|
411
|
+
case 26:
|
412
|
+
case "end":
|
413
|
+
return _context2.stop();
|
414
|
+
}
|
415
|
+
}, _callee2);
|
416
|
+
}));
|
417
|
+
return function (_x, _x2) {
|
418
|
+
return _ref2.apply(this, arguments);
|
419
|
+
};
|
420
|
+
}());
|
310
421
|
return this._actionQueryPromise;
|
311
422
|
}
|
312
423
|
}, {
|
@@ -320,16 +431,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
320
431
|
if (selectorDom) selectorDom.innerHTML = '';
|
321
432
|
}
|
322
433
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
323
|
-
if (container) container === null || container === void 0
|
434
|
+
if (container) container === null || container === void 0 || container.remove();
|
324
435
|
|
325
436
|
// animation
|
326
|
-
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation-style"))) === null || _document$getElementB === void 0
|
437
|
+
(_document$getElementB = document.getElementById("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation-style"))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
|
327
438
|
|
328
439
|
// mockup
|
329
440
|
var body = document.getElementsByTagName('body')[0];
|
330
441
|
body.style.overflow = 'auto';
|
331
442
|
var mockup = document.getElementById(MOCKUP_ID);
|
332
|
-
mockup === null || mockup === void 0
|
443
|
+
mockup === null || mockup === void 0 || mockup.remove();
|
333
444
|
|
334
445
|
// retentionPopup
|
335
446
|
this.removeRetentionPopup(this.platform);
|
@@ -356,9 +467,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
356
467
|
value: Date.now()
|
357
468
|
});
|
358
469
|
try {
|
359
|
-
var _renderParams$payment, _renderParams$payment2
|
360
|
-
var productSceneVersion = (renderParams === null || renderParams === void 0
|
361
|
-
var extendInfo = (renderParams === null || renderParams === void 0
|
470
|
+
var _renderParams$payment, _renderParams$payment2;
|
471
|
+
var productSceneVersion = (renderParams === null || renderParams === void 0 || (_renderParams$payment = renderParams.paymentSessionMetaData) === null || _renderParams$payment === void 0 || (_renderParams$payment = _renderParams$payment.paymentSessionConfig) === null || _renderParams$payment === void 0 ? void 0 : _renderParams$payment.productSceneVersion) || '';
|
472
|
+
var extendInfo = (renderParams === null || renderParams === void 0 || (_renderParams$payment2 = renderParams.paymentSessionMetaData) === null || _renderParams$payment2 === void 0 ? void 0 : _renderParams$payment2.extendInfo) || '';
|
362
473
|
var environment = this.AMSSDK.options.env.environment;
|
363
474
|
this.appDomain = getAppDomain({
|
364
475
|
environment: environment,
|
@@ -391,17 +502,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
391
502
|
}, {
|
392
503
|
key: "listener",
|
393
504
|
value: function listener(e) {
|
394
|
-
if (e.origin !== this.appDomain)
|
395
|
-
return;
|
396
|
-
}
|
505
|
+
if (e.origin !== this.appDomain) return;
|
397
506
|
var isJson = isJsonString(e.data);
|
398
507
|
if (isJson) {
|
399
508
|
var data = JSON.parse(e.data);
|
400
|
-
if (data.name !== messageName.APP_TO_SDK && data.name !== messageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId)
|
401
|
-
return;
|
402
|
-
}
|
403
|
-
// TODO
|
404
|
-
// 如果带有callback标识,则从map结构中取出callbackfunc,执行,执行后在map结构中删除
|
509
|
+
if (data.name !== messageName.APP_TO_SDK && data.name !== messageName.APP_TO_APP || data.instanceId !== this.AMSSDK._instanceId) return;
|
405
510
|
this._handleAppMessage(data);
|
406
511
|
} else {
|
407
512
|
console.warn(ERRORMESSAGE.NOT_JSON_FORMAT);
|
@@ -418,13 +523,60 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
418
523
|
context: {
|
419
524
|
event: 'renderResize',
|
420
525
|
data: {
|
421
|
-
heightOfVisible: (e === null || e === void 0
|
422
|
-
widthOfVisible: (e === null || e === void 0
|
526
|
+
heightOfVisible: (e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.innerHeight) || window.innerHeight,
|
527
|
+
widthOfVisible: (e === null || e === void 0 || (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.innerWidth) || window.innerWidth
|
423
528
|
}
|
424
529
|
}
|
425
530
|
});
|
426
531
|
}
|
427
|
-
|
532
|
+
}, {
|
533
|
+
key: "createPopupWindow",
|
534
|
+
value: function createPopupWindow(data) {
|
535
|
+
var _this$_renderParams3;
|
536
|
+
this._threedData = data;
|
537
|
+
var sessionData = encodeURIComponent((_this$_renderParams3 = this._renderParams) === null || _this$_renderParams3 === void 0 ? void 0 : _this$_renderParams3.sessionData);
|
538
|
+
var threedPageUrl = "".concat(marmotMap[this.AMSSDK.options.env.environment], "/threedPage/index.html?scene=threedWrapperPage&sessionData=").concat(sessionData, "&instanceId=").concat(this.AMSSDK._instanceId);
|
539
|
+
this.popupWindow = createModal({
|
540
|
+
device: this.platform,
|
541
|
+
url: threedPageUrl
|
542
|
+
});
|
543
|
+
}
|
544
|
+
}, {
|
545
|
+
key: "getDeviceIdAndCallback",
|
546
|
+
value: function () {
|
547
|
+
var _getDeviceIdAndCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventContext) {
|
548
|
+
var deviceId;
|
549
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
550
|
+
while (1) switch (_context3.prev = _context3.next) {
|
551
|
+
case 0:
|
552
|
+
if (!(eventContext !== null && eventContext !== void 0 && eventContext.eventCallbackId)) {
|
553
|
+
_context3.next = 5;
|
554
|
+
break;
|
555
|
+
}
|
556
|
+
_context3.next = 3;
|
557
|
+
return this.getDeviceIdAndLog();
|
558
|
+
case 3:
|
559
|
+
deviceId = _context3.sent;
|
560
|
+
this.dispatchToApp({
|
561
|
+
context: {
|
562
|
+
event: 'appEventCallback',
|
563
|
+
eventCallbackId: eventContext === null || eventContext === void 0 ? void 0 : eventContext.eventCallbackId,
|
564
|
+
data: {
|
565
|
+
deviceId: deviceId
|
566
|
+
}
|
567
|
+
}
|
568
|
+
});
|
569
|
+
case 5:
|
570
|
+
case "end":
|
571
|
+
return _context3.stop();
|
572
|
+
}
|
573
|
+
}, _callee3, this);
|
574
|
+
}));
|
575
|
+
function getDeviceIdAndCallback(_x3) {
|
576
|
+
return _getDeviceIdAndCallback.apply(this, arguments);
|
577
|
+
}
|
578
|
+
return getDeviceIdAndCallback;
|
579
|
+
}()
|
428
580
|
/**
|
429
581
|
* @description Initialize subscription iframe message
|
430
582
|
*/
|
@@ -450,10 +602,32 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
450
602
|
}, {
|
451
603
|
key: "_handleAppMessage",
|
452
604
|
value: function _handleAppMessage(data) {
|
453
|
-
var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name];
|
605
|
+
var eventKeyMap = [EVENT.launch.name, EVENT.redirect.name, EVENT.sizeChanged.name, EVENT.log.name, EVENT.close.name, EVENT.error.name, EVENT.eventCallback.name, EVENT.submitForm.name, EVENT.showCloseButton.name, EVENT.hideCloseButton.name, EVENT.setAllowRetention.name, EVENT.declareCheckoutInfo.name, EVENT.showPopup.name, EVENT.dismissLoading.name, EVENT.popupWindow.name, EVENT.threedReady.name, EVENT.closePopup.name, EVENT.getDeviceId.name];
|
454
606
|
if (!eventKeyMap.includes(data.context.event)) {
|
455
607
|
return;
|
456
608
|
}
|
609
|
+
if (data.context.event === EVENT.getDeviceId.name) {
|
610
|
+
this.getDeviceIdAndCallback(data.context);
|
611
|
+
return;
|
612
|
+
}
|
613
|
+
if (data.context.event === EVENT.closePopup.name) {
|
614
|
+
destroyModal();
|
615
|
+
return;
|
616
|
+
}
|
617
|
+
if (data.context.event === EVENT.threedReady.name) {
|
618
|
+
this.dispatchToApp({
|
619
|
+
context: {
|
620
|
+
event: 'renderThreedPage',
|
621
|
+
data: this._threedData
|
622
|
+
}
|
623
|
+
}, this.popupWindow);
|
624
|
+
return;
|
625
|
+
}
|
626
|
+
if (data.context.event === EVENT.popupWindow.name) {
|
627
|
+
var _data$context;
|
628
|
+
this.createPopupWindow((_data$context = data.context) === null || _data$context === void 0 ? void 0 : _data$context.data);
|
629
|
+
return;
|
630
|
+
}
|
457
631
|
if (data.context.event === EVENT.dismissLoading.name) {
|
458
632
|
var _data$context$data;
|
459
633
|
this.dispatchToSDK(EVENT.eventCallback.name, {
|
@@ -501,6 +675,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
501
675
|
this.handleDeclareInfo(data.context.data);
|
502
676
|
return;
|
503
677
|
}
|
678
|
+
if (data.context.event === EVENT.eventCallback.name) {
|
679
|
+
this.AMSSDK.logger.logInfo({
|
680
|
+
title: 'sdk_event_event_callback'
|
681
|
+
}).send();
|
682
|
+
}
|
504
683
|
|
505
684
|
// The plug-in communicates with the sdk after processing
|
506
685
|
this.dispatchToSDK(data.context.event, data.context.data, data.context.eventCallbackId);
|
@@ -519,7 +698,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
519
698
|
mockup.style.background = 'rgb(0, 0, 0, 0.6)';
|
520
699
|
mockup.style.display = 'block';
|
521
700
|
}
|
522
|
-
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0
|
701
|
+
(_document$getElementB2 = document.getElementById(LOADING_ID)) === null || _document$getElementB2 === void 0 || _document$getElementB2.remove();
|
523
702
|
if (this.platform === 'desktop') {
|
524
703
|
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
525
704
|
if (data.context.data.width) cashier.style.width = "".concat(data.context.data.width, "px");
|
@@ -528,7 +707,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
528
707
|
cashier.classList.add("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
529
708
|
var animationStyleId = "".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation-style");
|
530
709
|
var animationStyle = document.getElementById(animationStyleId);
|
531
|
-
if (animationStyle) animationStyle === null || animationStyle === void 0
|
710
|
+
if (animationStyle) animationStyle === null || animationStyle === void 0 || animationStyle.remove();
|
532
711
|
|
533
712
|
// 弹出和弹入动画
|
534
713
|
var runkeyframes = "@keyframes ".concat(COMPONENT_CONTAINER_ID, "-slide-in {\n 0% {\n height: 1px;\n }\n 100% {\n height: ").concat(data.context.data.height, "px;\n }\n }\n @keyframes ").concat(COMPONENT_CONTAINER_ID, "-slide-out {\n 0% {\n height: ").concat(data.context.data.height, "px;\n opacity: 1;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n height: 1px;\n opacity: 0;\n }\n }");
|
@@ -550,7 +729,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
550
729
|
}
|
551
730
|
if (this._renderDisplayType === renderDisplayTypeEnum.inline) {
|
552
731
|
var _document$getElementB3;
|
553
|
-
(_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0
|
732
|
+
(_document$getElementB3 = document.getElementById(LOADING_ID)) === null || _document$getElementB3 === void 0 || _document$getElementB3.remove();
|
554
733
|
}
|
555
734
|
this.app.style.height = "".concat(data.context.data.height, "px");
|
556
735
|
this.app.style.opacity = '1';
|
@@ -558,7 +737,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
558
737
|
}, {
|
559
738
|
key: "handleRedirect",
|
560
739
|
value: function handleRedirect(data) {
|
561
|
-
var
|
740
|
+
var _this6 = this;
|
562
741
|
var _data = typeof data === 'string' ? {
|
563
742
|
normalUrl: data
|
564
743
|
} : {
|
@@ -567,23 +746,42 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
567
746
|
normalUrl: (data === null || data === void 0 ? void 0 : data.normalUrl) || '',
|
568
747
|
target: data === null || data === void 0 ? void 0 : data.target
|
569
748
|
};
|
749
|
+
this.AMSSDK.logger.logInfo({
|
750
|
+
title: 'sdk_event_call_url_start'
|
751
|
+
}, {
|
752
|
+
redirectInfo: JSON.stringify(_data)
|
753
|
+
}).send();
|
570
754
|
var successCallback = function successCallback(type, url) {
|
571
|
-
|
755
|
+
_this6.dispatchToSDK(EVENT.eventCallback.name, {
|
572
756
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
573
757
|
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
574
758
|
});
|
759
|
+
_this6.AMSSDK.logger.logInfo({
|
760
|
+
title: 'sdk_event_call_url_success'
|
761
|
+
}, {
|
762
|
+
redirectInfo: JSON.stringify(_data),
|
763
|
+
openType: type,
|
764
|
+
url: url
|
765
|
+
}).send();
|
575
766
|
};
|
576
|
-
var failCallback = function failCallback() {
|
577
|
-
|
767
|
+
var failCallback = function failCallback(type, url) {
|
768
|
+
_this6.dispatchToSDK(EVENT.eventCallback.name, {
|
578
769
|
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
579
770
|
message: "Failed to open app,applinkUrl: ".concat(_data === null || _data === void 0 ? void 0 : _data.applinkUrl, " schemeUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.schemeUrl, " normalUrl: ").concat(_data === null || _data === void 0 ? void 0 : _data.normalUrl)
|
580
771
|
});
|
772
|
+
_this6.AMSSDK.logger.logInfo({
|
773
|
+
title: 'sdk_error_call_url_failed'
|
774
|
+
}, {
|
775
|
+
redirectInfo: JSON.stringify(_data),
|
776
|
+
openType: type,
|
777
|
+
url: url
|
778
|
+
}).send();
|
581
779
|
};
|
582
780
|
|
583
781
|
// 支持 target: _blank,新开tab页打开
|
584
782
|
if (_data.target === targetEnum.BLANK) {
|
585
|
-
if (!_data.normalUrl) return failCallback();
|
586
|
-
successCallback(
|
783
|
+
if (!_data.normalUrl) return failCallback(RedirectType.NormalUrl, '');
|
784
|
+
successCallback(RedirectType.NormalUrl, _data.normalUrl);
|
587
785
|
window.open(_data.normalUrl);
|
588
786
|
return;
|
589
787
|
}
|
@@ -591,28 +789,30 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
591
789
|
this.AMSSDK._redirect({
|
592
790
|
applinkUrl: _data === null || _data === void 0 ? void 0 : _data.applinkUrl
|
593
791
|
}).then(function () {
|
594
|
-
successCallback(
|
792
|
+
successCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
595
793
|
}).catch(function () {
|
596
|
-
|
794
|
+
failCallback(RedirectType.ApplinkUrl, _data === null || _data === void 0 ? void 0 : _data.applinkUrl);
|
795
|
+
return _this6.AMSSDK._redirect({
|
597
796
|
schemeUrl: _data === null || _data === void 0 ? void 0 : _data.schemeUrl
|
598
797
|
});
|
599
798
|
}).then(function () {
|
600
|
-
successCallback(
|
799
|
+
successCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
601
800
|
}).catch(function () {
|
602
|
-
|
801
|
+
failCallback(RedirectType.SchemeUrl, _data === null || _data === void 0 ? void 0 : _data.schemeUrl);
|
802
|
+
return _this6.AMSSDK._redirect({
|
603
803
|
normalUrl: _data === null || _data === void 0 ? void 0 : _data.normalUrl
|
604
804
|
});
|
605
805
|
}).then(function () {
|
606
|
-
successCallback(
|
806
|
+
successCallback(RedirectType.NormalUrl, _data === null || _data === void 0 ? void 0 : _data.normalUrl);
|
607
807
|
}).catch(function () {
|
608
|
-
failCallback();
|
808
|
+
failCallback(RedirectType.NormalUrl, _data === null || _data === void 0 ? void 0 : _data.normalUrl);
|
609
809
|
});
|
610
810
|
}
|
611
811
|
}, {
|
612
812
|
key: "handleDeclareInfo",
|
613
|
-
value: function handleDeclareInfo(
|
614
|
-
var
|
615
|
-
closeDialogData =
|
813
|
+
value: function handleDeclareInfo(_ref5) {
|
814
|
+
var _ref5$closeDialogData = _ref5.closeDialogData,
|
815
|
+
closeDialogData = _ref5$closeDialogData === void 0 ? {} : _ref5$closeDialogData;
|
616
816
|
_handleDeclareInfo({
|
617
817
|
closeDialogData: closeDialogData
|
618
818
|
});
|
@@ -622,9 +822,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
622
822
|
value: function handleCloseBtnShow(showClose) {
|
623
823
|
var closeBlock = document.getElementById(COMPONENT_CLOSE_BLOCK_ID);
|
624
824
|
if (showClose) {
|
625
|
-
closeBlock === null || closeBlock === void 0
|
825
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.remove("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
|
626
826
|
} else if (showClose === false) {
|
627
|
-
closeBlock === null || closeBlock === void 0
|
827
|
+
closeBlock === null || closeBlock === void 0 || closeBlock.classList.add("".concat(COMPONENT_CLOSE_BLOCK_ID, "-hidden"));
|
628
828
|
}
|
629
829
|
}
|
630
830
|
|
@@ -644,13 +844,21 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
644
844
|
}, {
|
645
845
|
key: "dispatchToApp",
|
646
846
|
value: function dispatchToApp(payload) {
|
847
|
+
var targetElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
647
848
|
var data = Object.assign({}, payload, {
|
648
849
|
name: messageName.SDK_TO_APP,
|
649
850
|
mode: this.AMSSDK.options.mode,
|
650
851
|
appId: COMPONENTPLUGINID,
|
651
852
|
instanceId: this.AMSSDK._instanceId
|
652
853
|
});
|
653
|
-
|
854
|
+
this.AMSSDK.logger.logInfo({
|
855
|
+
title: 'sdk_event_send_message_to_web'
|
856
|
+
}, {
|
857
|
+
event: data === null || data === void 0 ? void 0 : data.context.event
|
858
|
+
}).send();
|
859
|
+
if (targetElement && targetElement.contentWindow) {
|
860
|
+
return targetElement.contentWindow.postMessage(JSON.stringify(data), '*');
|
861
|
+
}
|
654
862
|
if (this.app && this.app.contentWindow) {
|
655
863
|
return this.app.contentWindow.postMessage(JSON.stringify(data), this.appDomain);
|
656
864
|
}
|
@@ -678,22 +886,22 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
678
886
|
}, {
|
679
887
|
key: "sendRenderEvent",
|
680
888
|
value: function () {
|
681
|
-
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
682
|
-
var _this$
|
683
|
-
return _regeneratorRuntime().wrap(function
|
684
|
-
while (1) switch (
|
889
|
+
var _sendRenderEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
890
|
+
var _this$_renderParams4, _this$_renderParams5, _this$_renderParams6, _this$_renderParams7, _this$_renderParams8, res;
|
891
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
892
|
+
while (1) switch (_context4.prev = _context4.next) {
|
685
893
|
case 0:
|
686
|
-
|
894
|
+
_context4.prev = 0;
|
687
895
|
if (this._actionQueryPromise) {
|
688
|
-
|
896
|
+
_context4.next = 3;
|
689
897
|
break;
|
690
898
|
}
|
691
|
-
return
|
899
|
+
return _context4.abrupt("return");
|
692
900
|
case 3:
|
693
|
-
|
901
|
+
_context4.next = 5;
|
694
902
|
return this._actionQueryPromise;
|
695
903
|
case 5:
|
696
|
-
res =
|
904
|
+
res = _context4.sent;
|
697
905
|
this._performanceData.push({
|
698
906
|
key: 'sdk_render_component',
|
699
907
|
value: Date.now()
|
@@ -703,11 +911,12 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
703
911
|
event: 'renderComponent',
|
704
912
|
data: {
|
705
913
|
queryResult: res,
|
706
|
-
sessionResult: (_this$
|
707
|
-
paymentSessionData: (_this$
|
914
|
+
sessionResult: (_this$_renderParams4 = this._renderParams) === null || _this$_renderParams4 === void 0 ? void 0 : _this$_renderParams4.paymentSessionMetaData,
|
915
|
+
paymentSessionData: (_this$_renderParams5 = this._renderParams) === null || _this$_renderParams5 === void 0 ? void 0 : _this$_renderParams5.sessionData,
|
708
916
|
heightOfVisible: Math.max(window.changingPageHeight, window.innerHeight),
|
709
|
-
renderDisplayType: (_this$
|
710
|
-
appearance: (_this$
|
917
|
+
renderDisplayType: (_this$_renderParams6 = this._renderParams) === null || _this$_renderParams6 === void 0 ? void 0 : _this$_renderParams6.renderDisplayType,
|
918
|
+
appearance: (_this$_renderParams7 = this._renderParams) === null || _this$_renderParams7 === void 0 ? void 0 : _this$_renderParams7.appearance,
|
919
|
+
notRedirectAfterComplete: ((_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.notRedirectAfterComplete) === true,
|
711
920
|
envInfo: {
|
712
921
|
screenHeight: screen.height,
|
713
922
|
screenWidth: screen.width
|
@@ -724,16 +933,16 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
724
933
|
}
|
725
934
|
});
|
726
935
|
// eslint-disable-next-line no-empty
|
727
|
-
|
936
|
+
_context4.next = 13;
|
728
937
|
break;
|
729
938
|
case 11:
|
730
|
-
|
731
|
-
|
939
|
+
_context4.prev = 11;
|
940
|
+
_context4.t0 = _context4["catch"](0);
|
732
941
|
case 13:
|
733
942
|
case "end":
|
734
|
-
return
|
943
|
+
return _context4.stop();
|
735
944
|
}
|
736
|
-
},
|
945
|
+
}, _callee4, this, [[0, 11]]);
|
737
946
|
}));
|
738
947
|
function sendRenderEvent() {
|
739
948
|
return _sendRenderEvent.apply(this, arguments);
|
@@ -747,19 +956,19 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
747
956
|
key: "cleanContainer",
|
748
957
|
value: function cleanContainer() {
|
749
958
|
var _document$getElementB4,
|
750
|
-
|
959
|
+
_this7 = this;
|
751
960
|
var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
752
961
|
this._loadAppPromiseResolve && this._loadAppPromiseResolve(true);
|
753
962
|
this._performanceData = [];
|
754
963
|
this._isInitComponent = false;
|
755
964
|
this.app = null;
|
756
|
-
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0
|
965
|
+
(_document$getElementB4 = document.getElementById(LOADING_ID)) === null || _document$getElementB4 === void 0 || _document$getElementB4.remove();
|
757
966
|
this.hideComponentAnimation();
|
758
967
|
var mockup = document.getElementById(MOCKUP_ID);
|
759
|
-
mockup === null || mockup === void 0
|
968
|
+
mockup === null || mockup === void 0 || mockup.classList.add("".concat(MOCKUP_ID, "-hidden"));
|
760
969
|
if (immediately) this.cleanElement();else {
|
761
970
|
setTimeout(function () {
|
762
|
-
|
971
|
+
_this7.cleanElement();
|
763
972
|
}, 300);
|
764
973
|
}
|
765
974
|
}
|
@@ -770,9 +979,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
770
979
|
if (container) {
|
771
980
|
// size变化动画取消
|
772
981
|
container.style.transition = '';
|
773
|
-
container === null || container === void 0
|
774
|
-
container === null || container === void 0
|
775
|
-
container === null || container === void 0
|
982
|
+
container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform));
|
983
|
+
container === null || container === void 0 || container.classList.remove("".concat(COMPONENT_CONTAINER_ID, "-").concat(this.platform, "-animation"));
|
984
|
+
container === null || container === void 0 || container.classList.add("".concat(COMPONENT_CONTAINER_ID, "-hidden-").concat(this.platform));
|
776
985
|
}
|
777
986
|
}
|
778
987
|
}, {
|
@@ -802,7 +1011,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
802
1011
|
var retentionPopup = document.getElementById(COMPONENT_RETENTION_ID);
|
803
1012
|
var container = document.getElementById(COMPONENT_CONTAINER_ID);
|
804
1013
|
if (retentionPopup) {
|
805
|
-
container === null || container === void 0
|
1014
|
+
container === null || container === void 0 || container.classList.add("".concat(COMPONENT_CONTAINER_ID, "-opacity"));
|
806
1015
|
retentionPopup.classList.remove("".concat(COMPONENT_RETENTION_ID, "-hidden"));
|
807
1016
|
retentionPopup.classList.add("".concat(COMPONENT_RETENTION_ID, "-show"));
|
808
1017
|
}
|