UNPKG

@comgate/checkout-dev

Version:

Comgate pre-built checkout library

1,510 lines 147 kB
import zt from "axios"; function p(n, e, t, r) { function i(o) { return o instanceof t ? o : new t(function(s) { s(o); }); } return new (t || (t = Promise))(function(o, s) { function a(d) { try { c(r.next(d)); } catch (h) { s(h); } } function u(d) { try { c(r.throw(d)); } catch (h) { s(h); } } function c(d) { d.done ? o(d.value) : i(d.value).then(a, u); } c((r = r.apply(n, e || [])).next()); }); } function Z(n, e, t, r) { if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter"); if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return t === "m" ? r : t === "a" ? r.call(n) : r ? r.value : e.get(n); } function je(n, e, t, r, i) { if (r === "m") throw new TypeError("Private method is not writable"); if (r === "a" && !i) throw new TypeError("Private accessor was defined without a setter"); if (typeof e == "function" ? n !== e || !i : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return r === "a" ? i.call(n, t) : i ? i.value = t : e.set(n, t), t; } var ye = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Ht(n) { return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; } var Kt = "Expected a function", Ye = 0 / 0, Zt = "[object Symbol]", Jt = /^\s+|\s+$/g, Yt = /^[-+]0x[0-9a-f]+$/i, Xt = /^0b[01]+$/i, Qt = /^0o[0-7]+$/i, en = parseInt, tn = typeof ye == "object" && ye && ye.Object === Object && ye, nn = typeof self == "object" && self && self.Object === Object && self, rn = tn || nn || Function("return this")(), on = Object.prototype, sn = on.toString, an = Math.max, ln = Math.min, Ae = function() { return rn.Date.now(); }; function un(n, e, t) { var r, i, o, s, a, u, c = 0, d = !1, h = !1, g = !0; if (typeof n != "function") throw new TypeError(Kt); e = Xe(e) || 0, Ne(t) && (d = !!t.leading, h = "maxWait" in t, o = h ? an(Xe(t.maxWait) || 0, e) : o, g = "trailing" in t ? !!t.trailing : g); function P(w) { var U = r, oe = i; return r = i = void 0, c = w, s = n.apply(oe, U), s; } function y(w) { return c = w, a = setTimeout(I, e), d ? P(w) : s; } function re(w) { var U = w - u, oe = w - c, Je = e - U; return h ? ln(Je, o - oe) : Je; } function C(w) { var U = w - u, oe = w - c; return u === void 0 || U >= e || U < 0 || h && oe >= o; } function I() { var w = Ae(); if (C(w)) return ie(w); a = setTimeout(I, re(w)); } function ie(w) { return a = void 0, g && r ? P(w) : (r = i = void 0, s); } function Ft() { a !== void 0 && clearTimeout(a), c = 0, r = u = i = a = void 0; } function Wt() { return a === void 0 ? s : ie(Ae()); } function xe() { var w = Ae(), U = C(w); if (r = arguments, i = this, u = w, U) { if (a === void 0) return y(u); if (h) return a = setTimeout(I, e), P(u); } return a === void 0 && (a = setTimeout(I, e)), s; } return xe.cancel = Ft, xe.flush = Wt, xe; } function Ne(n) { var e = typeof n; return !!n && (e == "object" || e == "function"); } function cn(n) { return !!n && typeof n == "object"; } function dn(n) { return typeof n == "symbol" || cn(n) && sn.call(n) == Zt; } function Xe(n) { if (typeof n == "number") return n; if (dn(n)) return Ye; if (Ne(n)) { var e = typeof n.valueOf == "function" ? n.valueOf() : n; n = Ne(e) ? e + "" : e; } if (typeof n != "string") return n === 0 ? n : +n; n = n.replace(Jt, ""); var t = Xt.test(n); return t || Qt.test(n) ? en(n.slice(2), t ? 2 : 8) : Yt.test(n) ? Ye : +n; } var hn = un; const vt = /* @__PURE__ */ Ht(hn); var fn = Object.defineProperty, vn = (n, e, t) => e in n ? fn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ee = (n, e, t) => (vn(n, typeof e != "symbol" ? e + "" : e, t), t), Fe = (n, e, t) => { if (!e.has(n)) throw TypeError("Cannot " + t); }, v = (n, e, t) => (Fe(n, e, "read from private field"), t ? t.call(n) : e.get(n)), b = (n, e, t) => { if (e.has(n)) throw TypeError("Cannot add the same private member more than once"); e instanceof WeakSet ? e.add(n) : e.set(n, t); }, S = (n, e, t, r) => (Fe(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), pn = (n, e, t, r) => ({ set _(i) { S(n, e, i, t); }, get _() { return v(n, e, r); } }), _ = (n, e, t) => (Fe(n, e, "access private method"), t); let f = class extends Error { /** * Create new instance of the error * @param message * @param context * @param cause */ constructor(n, e = null, t = null) { super(n), ee(this, "context"), this.name = "CgError", this.context = e ?? null, this.cause = t ?? null; } /** * Returns string representation of the error */ toString() { let n = `[${this.name}] ${this.message}`; return this.context && (n += ` Context: ${JSON.stringify(this.context)}`), this.cause && (n += ` Cause: [${this.cause.toString()}]`), n; } }; function mn(n) { return new Promise((e) => { const t = setTimeout(() => { e(t); }, n); }); } function pt(n, e, t = !1, r = null) { const i = (o) => t && Math.floor(o) >= e ? Math.floor(o) : o; return typeof n == "number" && n >= e ? i(n) : i(r ? r < e ? e : r : e); } function mt(n, e, t = !1, r = null) { const i = (o) => t && Math.ceil(o) <= e ? Math.ceil(o) : o; return typeof n == "number" && n < e ? i(n) : i(r ? r > e ? e : r : e); } function fe(n, e, t, r = !1, i = !1, o = "lower") { let s = t; return o === "lower" ? s = e : Number.isFinite(o) && (s = o), pt(mt(n, t, r, s), e, i, s); } function gn() { let n = !1; try { n = window.navigator.javaEnabled(); } catch { } return { language: window.navigator.language, colorDepth: window.screen.colorDepth, screenHeight: window.screen.height, screenWidth: window.screen.width, timezone: (/* @__PURE__ */ new Date()).getTimezoneOffset(), javaEnabled: n, javascriptEnabled: !0 }; } function bn(n = !1) { const e = { isSecureContext: window.isSecureContext }, t = ["vendor", "connection", "hardwareConcurrency", "cookieEnabled", "appCodeName", "appName", "appVersion", "platform", "product", "userAgent", "language", "onLine", "userAgentData", "globalPrivacyControl", "maxTouchPoints", "productSub", "userActivation", "webdriver", "doNotTrack"], r = navigator; for (const i of t) i in r && ![null, void 0].includes(r[i]) && (typeof r[i] == "object" ? Object.keys(r[i]).length > 0 && (e[i] = r[i]) : e[i] = r[i]); return n ? " Navigator: " + JSON.stringify(e) : e; } function gt() { return crypto && "randomUUID" in crypto ? crypto.randomUUID() : bt(16); } function bt(n, e = "-") { return (Array.isArray(n) ? n : [n]).map((t) => { let r = ""; do r += Math.floor(Math.random() * Date.now()).toString(32); while (r.length < t); return r.slice(0, t); }).join(e); } function yn(n, e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") { let t = ""; const r = e.length; let i = 0; for (; i < n; ) t += e.charAt(Math.floor(Math.random() * r)), i += 1; return t; } async function wn(n) { return new Promise((e, t) => { try { if (typeof n.foundValidator == "function" && n.foundValidator()) { n.id, e(!0); return; } if (document.getElementById(n.id)) n.foundValidator ? typeof n.foundValidator != "function" ? (console.warn("FoundValidator is not a function"), e(!1)) : n.foundValidator() === !0 ? (n.id, e(!0)) : (n.id, t("Script injected to the DOM but not loaded.")) : (n.id, e(!1)); else { let r = null; if (n.elementType === "script") r = document.createElement("script"), r.src = n.link, r.async = n.async ?? !1, r.defer = n.defer ?? !1; else if (n.elementType === "link") r = document.createElement("link"), r.href = n.link, r.rel = n.rel, r.as = n.as; else throw new CgError("Invalid elementType: " + n.elementType); r.id = n.id, r.addEventListener("load", () => { typeof n.foundValidator == "function" && n.foundValidator() === !0 ? (n.id, e(!0)) : e(!1); }), n.elementType !== "link" && r.addEventListener("error", (i) => { n.id, t(i); }), document.head.append(r); } } catch (r) { n.id, t(r); } }); } const $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, appendScript: wn, bothBarrier: fe, delayedPromise: mn, getBrowserInfo: gn, getNavigatorDump: bn, getPseudoRandom: bt, getPseudoRandomString: gt, getRandom: yn, lowerBarrier: pt, upperBarrier: mt }, Symbol.toStringTag, { value: "Module" })); let Se = "https://payments.comgate.cz"; const _n = zt.create({ baseURL: Se // timeout: 30000, // default timeout is 0 (no timeout) }); function Pn(n, e = 200, t = {}, r = {}) { return new Promise((i, o) => { We( { url: n, method: "GET", params: t }, e, i, o, _t(r), !1, // is repeated on ETimeout !1, // is repeated on ErrorNetwork 0, // networkErrorCount - init val 0 // retryCount - init val ); }); } function yt(n, e = 200, t = {}, r = {}, i = {}) { return new Promise((o, s) => { We( { url: n, params: t, data: r, method: "POST" }, e, o, s, _t(i), !1, // is repeated on ETimeout !1, // is repeated on ErrorNetwork 0, // networkErrorCount - init val 0 // retryCount - init val ); }); } function wt(n) { return typeof n == "string" && /^https:\/\/[a-zA-Z0-9_.-]+/.test(n); } function En(n) { let e = !0, t = n; t && typeof t == "string" && (t = t.toLowerCase().trim(), t.endsWith("/") && (t = t.slice(0, -1)), t.startsWith("http://") && (!window.Cypress || location.hostname !== "localhost") && (t = t.replace("http://", "https://"), console.warn(`Checkout SDK: Changing HTTP of base domain to HTTPS: '${t}'`)), wt(t) && (Se = t, e = !1)), e && console.warn(`Checkout SDK: Invalid base domain: '${t}'. Using default domain: '${Se}'`); } function _t(n) { const { maxRetries: e, repeatDelay: t, responseValidator: r } = n; return { checkSuccessParam: n.checkSuccessParam !== !1, // if TRUE response must have {"success": true} strictMaxRetries: n.strictMaxRetries !== !1, // if TRUE dont allow automatically repeat request on network error repeatDelay: fe(t, 0, 5e3, !0, !0, 500), maxRetries: fe(e, 0, 10, !0, !0, 1), responseValidator: r && typeof r == "function" ? r : null }; } function We(n, e = 200, t, r, i, o = !1, s = !1, a = 0, u = 0) { if (!n.url) throw new f("Missing URL"); n.url = Pt(n.url), n.headers || (n.headers = {}), n.headers["X-Requested-With"] = "XMLHttpRequest", n.headers["X-Cg-Origin"] = window.location.origin, _n(n).then((c) => { var d; if (Array.isArray(e) && (e.length !== 2 || e[0] > e[1]) && console.warn("Invalid successCode array " + JSON.stringify(e) + " the first number must be lower or equal than the second one"), (Array.isArray(e) ? c.status >= e[0] && c.status <= e[1] : c.status === e) && (i.checkSuccessParam && ((d = c.data) == null ? void 0 : d.success) === !0 || !i.checkSuccessParam)) { if (delete c.data.success, i.responseValidator) { if (i.responseValidator(c.data, c.status, c.headers, c.config) === !0) { t(c.data); return; } return Promise.reject({ msg: "Invalid response by custom validator.", valid: !1, response: c }); } t(c.data); return; } return Promise.reject({ msg: "Invalid response by basic validation.", valid: !1, response: c }); }).catch((c) => { var d, h; const g = (c == null ? void 0 : c.code) ?? ((d = c == null ? void 0 : c.response) == null ? void 0 : d.code) ?? ((h = c == null ? void 0 : c.error) == null ? void 0 : h.code) ?? "Not specified", P = g === "ETIMEDOUT", y = g === "ERR_NETWORK"; let re, C; (c == null ? void 0 : c.valid) === !1 ? (re = (c == null ? void 0 : c.msg) || "Invalid response validation", C = c == null ? void 0 : c.response) : (re = (c == null ? void 0 : c.toString()) ?? "Unknown error", typeof c == "object" && "response" in c && typeof c.response == "object" ? C = c.response : C = c); let I = a; if (P && !o || y && !s ? I += 1 : I = 0, !i.strictMaxRetries && I <= 2 || i.maxRetries > u) { let ie = u + 1; (P || y) && I < 1 && !i.strictMaxRetries && (ie = u), setTimeout(() => { We(n, e, t, r, i, P, y, I, ie); }, i.repeatDelay); return; } r({ url: n.url, message: re, status: (C == null ? void 0 : C.status) ?? null, expectedStatus: e, requiredSuccessResponseParam: i.checkSuccessParam, data: (C == null ? void 0 : C.data) ?? null, // request: res?.request ?? null, headers: (C == null ? void 0 : C.headers) ?? null, // config: res?.config, retries: u, maxRetries: i.maxRetries, errorCode: g, networkErrorCountInner: I // response se sem dávat nemusí, protože je rozbalený (status, data, config) }); }); } function Pt(n) { let e = n; return e.startsWith("/") && (e = Se + e), e; } const k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, changeBaseDomain: En, expandUrl: Pt, get: Pn, isDomainValid: wt, post: yt }, Symbol.toStringTag, { value: "Module" })); var Le = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Et = {}, x = Le && Le.__classPrivateFieldGet || function(n, e, t, r) { if (t === "a" && !r) throw new TypeError("Private accessor was defined without a getter"); if (typeof e == "function" ? n !== e || !r : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return t === "m" ? r : t === "a" ? r.call(n) : r ? r.value : e.get(n); }, Oe = Le && Le.__classPrivateFieldSet || function(n, e, t, r, i) { if (r === "m") throw new TypeError("Private method is not writable"); if (r === "a" && !i) throw new TypeError("Private accessor was defined without a setter"); if (typeof e == "function" ? n !== e || !i : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return r === "a" ? i.call(n, t) : i ? i.value = t : e.set(n, t), t; }, R, G; Object.defineProperty(Et, "__esModule", { value: !0 }); class Sn { constructor() { R.set(this, !1), G.set(this, /* @__PURE__ */ new Set()); } /** * Whether the lock is currently acquired or not. Accessing this property does not affect the * status of the lock. */ get acquired() { return x(this, R, "f"); } /** * Acquires the lock, waiting if necessary for it to become free if it is already locked. The * returned promise is fulfilled once the lock is acquired. * * A timeout (in milliseconds) may be optionally provided. If the lock cannot be acquired before * the timeout elapses, the returned promise is rejected with an error. The behavior of invalid * timeout values depends on how `setTimeout` handles those values. * * After acquiring the lock, you **must** call `release` when you are done with it. */ acquireAsync({ timeout: e } = {}) { if (!x(this, R, "f")) return Oe(this, R, !0, "f"), Promise.resolve(); if (e == null) return new Promise((i) => { x(this, G, "f").add(i); }); let t, r; return Promise.race([ new Promise((i) => { t = () => { clearTimeout(r), i(); }, x(this, G, "f").add(t); }), new Promise((i, o) => { r = setTimeout(() => { x(this, G, "f").delete(t), o(new Error("Timed out waiting for lock")); }, e); }) ]); } /** * Acquires the lock if it is free and otherwise returns immediately without waiting. Returns * `true` if the lock was free and is now acquired, and `false` otherwise. * * This method differs from calling `acquireAsync` with a zero-millisecond timeout in that it runs * synchronously without waiting for the JavaScript task queue. */ tryAcquire() { return x(this, R, "f") ? !1 : (Oe(this, R, !0, "f"), !0); } /** * Releases the lock and gives it to the next waiting acquirer, if there is one. Each acquirer * must release the lock exactly once. */ release() { if (!x(this, R, "f")) throw new Error("Cannot release an unacquired lock"); if (x(this, G, "f").size > 0) { const [e] = x(this, G, "f"); x(this, G, "f").delete(e), e(); } else Oe(this, R, !1, "f"); } } var Ln = Et.default = Sn; R = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(); function te(n, e) { try { return St(_e(n, (e == null ? void 0 : e.ignore) ?? [], fe(e == null ? void 0 : e.maxDeep, 1, 15, !0, !0, 5), (e == null ? void 0 : e.stringify) === !0, 0), (e == null ? void 0 : e.stringify) === !0, fe(e == null ? void 0 : e.maxStringLength, 0, 3e4, !0, !0, 2e4), e == null ? void 0 : e.linePrefixSpace); } catch (t) { return "Error: " + ((t == null ? void 0 : t.toString()) ?? t.message); } } function St(n, e = !1, t = 15e3, r = void 0) { return e ? e && typeof n != "string" ? JSON.stringify(n, null, r).slice(0, t) : String(n).slice(0, t) : n; } function _e(n, e, t, r, i) { if (n instanceof Date) return r ? n.toISOString() : n; if (Array.isArray(n)) return n.map((o) => _e(o, e, t, r)); if (typeof n == "object" && n !== null) { if (t <= 0) return "==deeper=="; if ("data" in n && "status" in n && "statusText" in n && "headers" in n && "config" in n) return Lt(n); if (n instanceof Error) { const { name: a, message: u, stack: c, cause: d, context: h } = n, g = { name: a, message: u, stack: c, cause: d }; return "context" in n && (g.context = h), _e(g, e, 3, r); } const o = ["client", "session", "token", "password", "parentElement", "parentNode", "children", "childNodes", "innerHTML", "outerHTML", "innerText", "ownerDocument", "offsetParent", "ownerElement", "googlepayClient", "window", "self", "document", "top", "parent", "state", "frames", "navigator", "doctype", "documentElement", "body", "head", "defaultView", "scripts", "scrollingElement", "firstElementChild", "lastElementChild", "activeElement", "styleSheets", "adoptedStyleSheets", "firstChild", "lastChild", "srcElement"], s = {}; for (const a in n) { if (e.includes(a)) { s[a] = "==ignore=="; continue; } if (o.includes(a)) { s[a] = "==skip=="; continue; } s[a] = _e(n[a], e, t - 1, r); } return s; } return typeof n == "function" ? "func" : n; } function Lt(n) { var e, t, r, i, o, s, a; try { return { request: { base: (e = n.config) == null ? void 0 : e.baseURL, // url to which the request led url: (t = n.config) == null ? void 0 : t.url, // url na kterou vedl request // en: data: (r = n.config) == null ? void 0 : r.data, // POST data requestu params: (i = n.config) == null ? void 0 : i.params, // query parametry requestu method: (o = n.config) == null ? void 0 : o.method, // http metoda (GET, POST, ...) timeout: (s = n.config) == null ? void 0 : s.timeout, // timeout requestu headers: (a = n.config) == null ? void 0 : a.headers //hlavičky requestu }, response: { status: n.status, // návratový status kód našeho API data: n.data, // response body (json/html) headers: n.headers // response headers } }; } catch (u) { return "Axios parse error: " + (u == null ? void 0 : u.message); } } const ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, clearedDeepCopy: te, convertAxios: Lt, cutOutput: St }, Symbol.toStringTag, { value: "Module" })); class Qe { /** * Constructor */ constructor() { ee(this, "_steps", []), ee(this, "_start", /* @__PURE__ */ new Date()), ee(this, "_lastStep", /* @__PURE__ */ new Date()), ee(this, "_done", !1), this._lastStep = this._start, this._steps.push({ message: "start", time: this._start.toISOString(), durationStart: 0 }); } /** * Add a step to the performance log * @param message * @param context */ step(e, t) { const r = /* @__PURE__ */ new Date(), i = { message: e, time: r.toISOString(), durationStart: r.getTime() - this._start.getTime() }, o = this._steps.length; (o >= 2 || o === 1 && e !== "done") && (this._steps[0].durationStep = 0, i.durationStep = r.getTime() - this._lastStep.getTime()), t && (i.context = t), this._steps.push(i), this._lastStep = r; } /** * Mark the performance as done */ done() { this.step("done"), this._done = !0; } /** * Get the performance data */ getData() { return this._steps; } /** * Get the performance data as string */ toString() { return "Performance: " + JSON.stringify(this.getData()) + ` Final: ${this._done ? "Y" : "N"}`; } } var V, we, M, se, Te, q, A, F, Y, Me, et, W, X; let N = (V = class { /** * Logger constructor * @param transports */ constructor(n) { if (b(this, F), b(this, Me), b(this, W), b(this, we, new Ln()), b(this, M, {}), b(this, se, !1), b(this, Te, 0), b(this, q, 0), b(this, A, []), this.addTransports(n).using <= 0) throw new Error("No transports defined."); } /** * Get list of all transports */ getTransports() { return v(this, A); } /** * Add transport to logger * @param transports */ addTransports(n) { const e = Array.isArray(n) ? n : [n]; let t = 0; for (const r of e) v(this, A).some((i) => i.getId() === r.getId()) || (v(this, A).push(r), t++); return S(this, q, v(this, A).length), { added: t, using: v(this, q) }; } /** * Remove transport from logger - at least one transport must remain * @param transport */ removeTransports(n) { const e = v(this, q), t = v(this, A).filter((i) => n.getId() !== i.getId()), r = t.length; return r > 0 ? (S(this, A, t), S(this, q, r), { removed: e - r, using: r }) : { removed: 0, using: e }; } /** * Info log * @param message * @param params */ async info(n, e) { return _(this, W, X).call(this, { message: n, level: V.LEVELS.INFO, ..._(this, F, Y).call(this, e) }); } /** * Warn log * @param message * @param params */ async warn(n, e) { return _(this, W, X).call(this, { message: n, level: V.LEVELS.WARN, ..._(this, F, Y).call(this, e) }); } /** * Error log * @param message * @param params */ async error(n, e) { return _(this, W, X).call(this, { message: n, level: V.LEVELS.ERROR, ..._(this, F, Y).call(this, e) }); } /** * Debug log * @param message * @param params */ async debug(n, e) { return _(this, W, X).call(this, { message: n, level: V.LEVELS.DEBUG, ..._(this, F, Y).call(this, e) }); } /** * * @param message * @param params */ async log(n, e) { return _(this, W, X).call(this, { message: n, level: (e == null ? void 0 : e.level) || V.LEVELS.INFO, // eslint-disable-line @typescript-eslint/no-unnecessary-condition ..._(this, F, Y).call(this, e) }); } /** * Init performance and start it * @returns {LogPerformance} - performance service */ start() { return new Qe(); } /** * Set global detail value * @param value * @param key * @param value */ with(n, e) { return typeof e == "object" ? !1 : e == null ? this.removeWith(n) : (v(this, M)[n] = e, S(this, se, Object.keys(v(this, M)).length > 0), !0); } /** * Remove global detail * @param key */ removeWith(n) { return n in v(this, M) ? (delete v(this, M)[n], S(this, se, Object.keys(v(this, M)).length > 0), !0) : !1; } /** * Set paymentId detail * @param payId */ withPayment(n) { return this.with("payment", n); } /** * Set instanceId detail * @param payId */ withInstance(n) { return this.with("instance", n); } /** * Log with performance * @param message * @param callback * @param params */ async withPerformance(n, e, t) { try { const r = new Qe(); let i = null; const o = async () => { r.done(); const s = t || { level: "INFO" }; s.level = s.level || "INFO", s.context = s.context || {}, s.context.performance = r.getData(); const a = await this.log(n, s); return i && i(a), a; }; if (await e({ step: r.step.bind(r), getData: r.getData.bind(r) }, o), e.length === 2) return new Promise((s) => { i = s; }); if (e.length === 1) return await o(); } catch { } return !1; } }, we = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakSet(), Y = function(n) { const { code: e, context: t, onlyLocal: r, dispatchNow: i, ignoreLimitCheck: o, date: s } = n ?? {}, a = { onlyLocal: r ?? !1, dispatchNow: i ?? !1, ignoreLimitCheck: o ?? !1 }; return e && (a.code = Number(e)), t && (a.context = te(t)), s && (a.date = new Date(s)), v(this, se) && (a.details = te(v(this, M), { maxDeep: 1 })), a; }, Me = /* @__PURE__ */ new WeakSet(), et = async function() { try { await v(this, we).acquireAsync(); try { return ++pn(this, Te)._; } catch { return; } finally { v(this, we).release(); } } catch { return; } }, W = /* @__PURE__ */ new WeakSet(), X = async function(n) { try { if (!n.message || !n.level) return !1; typeof n.level == "string" && (n.level = n.level.toUpperCase()); let e = !1, t = !1; for (let i = 0; i < v(this, q); i++) { const o = v(this, A)[i]; if (o.canHandleLevel(n.level) && (e = !0, !o.isLocal())) { t = !0; break; } } if (!e) return !1; if (t || (n.onlyLocal = !0), n.level === "ERR" && (n.level = "ERROR"), !n.onlyLocal) { const i = await _(this, Me, et).call(this), o = n.date || /* @__PURE__ */ new Date(); n.order = i, n.date = o; const s = n.details; n.details = { ...te(s), order: i }; } let r = 0; for (let i = 0; i < v(this, q); i++) { const o = v(this, A)[i]; o.canHandleLevel(n.level) && (!n.onlyLocal || n.onlyLocal && o.isLocal()) && (o.handle(n, v(this, M).payment), r++); } return r > 0; } catch (e) { return console.error("Logger error", e), !1; } }, ee(V, "LEVELS", { DEBUG: "DEBUG", INFO: "INFO", WARN: "WARN", ERROR: "ERROR" }), V); var Ue, z, ae; const Cn = class Ct { /** * TransportBase constructor */ constructor(e, t) { if (b(this, Ue, gt()), b(this, z, {}), b(this, ae, {}), this.constructor === Ct) throw new Error("Instance of Abstract Class cannot be created"); S(this, ae, e), S(this, z, t); } /** * Get id of transport */ getId() { return v(this, Ue); } /** * Set config * @public * @param key * @param value */ setConfig(e, t) { const r = {}; return r[e] = t, this.applyConfig(r) === 1; } /** * Get config value * @param key */ getConfig(e) { if (e in v(this, z)) return v(this, z)[e]; } /** * Check if Service is available on this device * @public * @param _record * @param _paymentId * @return {boolean} */ handle(e, t) { throw new Error("TransportBase abstract method 'handle' has no implementation"); } /** * Get type of transport * @public * @return {string} type of transport */ getType() { throw new Error("TransportBase abstract method 'handle' has no implementation"); } /** * Check if Transport is only local (no external communication) * @public * @return {boolean} true if is local */ isLocal() { throw new Error("TransportBase abstract method 'isLocal' has no implementation"); } /** * Check if Transport can ignore rate-limiter * @public * @return {boolean} true if can ignore limit */ canIgnoreLimit() { return !1; } /** * Check if Transport can ignore rate-limiter * @public * @return {boolean} true if can dispatch now */ canDispatchNow() { return !1; } /** * Check if Transport can handle specific level * @public * @param level * @return {boolean} true if can handle the level */ canHandleLevel(e) { return v(this, z)[e.toLowerCase()] === !0; } /** * Apply more config records * @public * @param config * @return {number} number of applied records */ applyConfig(e) { if (!e || typeof e != "object") return 0; let t = 0; for (const r in e) { const i = v(this, ae)[r], o = Array.isArray(i); r in v(this, ae) && (!o && typeof e[r] === i || o && i.includes(e[r])) && (v(this, z)[r] = e[r], t++); } return t; } /** * Black hole to handle uncaught promises * @param promise */ hole(e) { (e == null ? void 0 : e.catch) === "function" && e.catch((t) => { console.warn(`Failed to send logs to Comgate server. Detail:`, t); }); } }; Ue = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(); let ze = Cn; class It extends ze { /** * TransportConsole constructor * @param config */ constructor(e) { super({ debug: "boolean", info: "boolean", warn: "boolean", error: "boolean", prefix: "string" }, { debug: !0, info: !0, warn: !0, error: !0, prefix: "" }), super.applyConfig(e); } /** * Check if Service is available on this device * @private * @param record * @param paymentId * @return {void} */ handle(e, t) { var r, i, o; try { let s = e.level; e.onlyLocal && (s = "LOCAL " + s), e.level === N.LEVELS.DEBUG && (s = ` ${s} `); const a = `%c${this.getConfig("prefix")}${s}`; let u = ""; e.order && (u += ` (${e.order})`), e.code && (u += ` <${e.code}>`), (t || (r = e.details) != null && r.payment) && (u += ` [${t || ((i = e.details) == null ? void 0 : i.payment)}]`), (o = e.details) != null && o.instance && (u += ` {${e.details.instance}}`), u += ":"; const c = [u.trim(), e.message]; switch (e.context && (c.push(` Context:`), c.push(e.context)), e.level) { case N.LEVELS.DEBUG: console.log(a, "color:#fff;background:#444;font-weight: bold", ...c); break; case N.LEVELS.INFO: console.log(a, "color:#0099e5;font-weight: bold", ...c); break; case N.LEVELS.WARN: console.log(a, "color:#FFA500;font-weight: bold", ...c); break; case N.LEVELS.ERROR: console.log(a, "color:#ff221e;font-weight: bold", ...c); break; default: return console.log("Invalid level.", e), !1; } return !0; } catch { } return !1; } /** * Check if Transport is only local (no external communication) * @return {boolean} */ isLocal() { return !0; } /** * Check if Transport can ignore rate-limiter * @return {boolean} */ canIgnoreLimit() { return !0; } /** * Get type of transport * @public * @return {string} type of transport */ getType() { return "ConsoleTransport"; } } const In = typeof btoa == "function", He = typeof Buffer == "function"; typeof TextDecoder == "function" && new TextDecoder(); const tt = typeof TextEncoder == "function" ? new TextEncoder() : void 0, kn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", le = Array.prototype.slice.call(kn); ((n) => { let e = {}; return n.forEach((t, r) => e[t] = r), e; })(le); const O = String.fromCharCode.bind(String); typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array); const xn = (n) => n.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), An = (n) => { let e, t, r, i, o = ""; const s = n.length % 3; for (let a = 0; a < n.length; ) { if ((t = n.charCodeAt(a++)) > 255 || (r = n.charCodeAt(a++)) > 255 || (i = n.charCodeAt(a++)) > 255) throw new TypeError("invalid character found"); e = t << 16 | r << 8 | i, o += le[e >> 18 & 63] + le[e >> 12 & 63] + le[e >> 6 & 63] + le[e & 63]; } return s ? o.slice(0, s - 3) + "===".substring(s) : o; }, kt = In ? (n) => btoa(n) : He ? (n) => Buffer.from(n, "binary").toString("base64") : An, On = He ? (n) => Buffer.from(n).toString("base64") : (n) => { let e = []; for (let t = 0, r = n.length; t < r; t += 4096) e.push(O.apply(null, n.subarray(t, t + 4096))); return kt(e.join("")); }, Tn = (n) => { if (n.length < 2) { var e = n.charCodeAt(0); return e < 128 ? n : e < 2048 ? O(192 | e >>> 6) + O(128 | e & 63) : O(224 | e >>> 12 & 15) + O(128 | e >>> 6 & 63) + O(128 | e & 63); } else { var e = 65536 + (n.charCodeAt(0) - 55296) * 1024 + (n.charCodeAt(1) - 56320); return O(240 | e >>> 18 & 7) + O(128 | e >>> 12 & 63) + O(128 | e >>> 6 & 63) + O(128 | e & 63); } }, Mn = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, Dn = (n) => n.replace(Mn, Tn), nt = He ? (n) => Buffer.from(n, "utf8").toString("base64") : tt ? (n) => On(tt.encode(n)) : (n) => kt(Dn(n)), De = (n, e = !1) => e ? xn(nt(n)) : nt(n); var j, J, K, H, he, Pe, Ve, Ce, qe, Ge, rt, Be, xt; class At extends ze { /** * TransportServer constructor * @param config */ constructor(e) { super({ debug: "boolean", info: "boolean", warn: "boolean", error: "boolean", debounce: "number", maxWait: "number", maxStack: "number" }, { debug: !1, info: !0, warn: !0, error: !0, debounce: 2e3, // 2s - time to wait for next record before dispatch maxWait: 1e4, // 10s - maximum time if records are still coming faster than debounce (2s) maxStack: 20 // maximum number of records to keep in stack - if exceeded, dispatch immediately }), b(this, Pe), b(this, Ce), b(this, Ge), b(this, Be), b(this, j, []), b(this, J, void 0), b(this, K, void 0), b(this, H, { aborted: !1, time: (/* @__PURE__ */ new Date()).getTime(), count: 0 }), b(this, he, !1), S(this, j, []), super.applyConfig(e), _(this, Pe, Ve).call(this); } /** * Get number of records in queue */ getQueueSize() { return v(this, j).length; } /** * Add record to queue and trigger dispatch * @param record * @param paymentId * @return {boolean} true if record was added to queue */ handle(e, t) { if ((e.ignoreLimitCheck || [N.LEVELS.WARN, N.LEVELS.ERROR].includes(e.level)) && S(this, he, !0), !_(this, Be, xt).call(this)) return !1; t && S(this, K, t); const r = { message: e.message, level: e.level, code: e.code, order: e.order, date: e.date ?? /* @__PURE__ */ new Date() }; if (e.context && (r.context = te(e.context)), e.details && (r.details = te(e.details)), v(this, j).push(r), e.dispatchNow || v(this, j).length >= this.getConfig("maxStack")) this.hole(this.dispatchNow()); else if (v(this, J)) v(this, J).call(this); else return !1; return !0; } /** * Dispatch all records to server */ dispatchNow() { var e; return (e = v(this, J)) == null || e.cancel(), _(this, Ce, qe).call(this); } /** * Apply more config records * @public * @param config * @return {number} number of applied records */ applyConfig(e) { const t = super.applyConfig(e); if (!e || t <= 0) return 0; const r = Object.keys(e); return r.some((i) => ["debounce", "maxWait"].includes(i)) && _(this, Pe, Ve).call(this), r.includes("maxStack") && v(this, j).length > this.getConfig("maxStack") && this.hole(this.dispatchNow()), t; } /** * Check if Transport is only local (no external communication) * @return {boolean} */ isLocal() { return !1; } /** * Check if Transport can ignore rate-limiter * @return {boolean} */ canIgnoreLimit() { return !0; } /** * Check if Transport can ignore rate-limiter * @return {boolean} */ canDispatchNow() { return !0; } /** * Get type of transport * @public * @return {string} type of transport */ getType() { return "ServerTransport"; } } j = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakSet(), Ve = function() { var n; (n = v(this, J)) == null || n.flush(), S(this, J, vt(() => this.hole(_(this, Ce, qe).call(this)), this.getConfig("debounce"), { maxWait: this.getConfig("maxWait") })); }, Ce = /* @__PURE__ */ new WeakSet(), qe = async function() { const n = v(this, j); if (S(this, j, []), n.length <= 0) return Promise.resolve({ invalid: !1, count: 0, loggerEnabled: this.getConfig("enabled"), stackSize: n.length, server: null, error: null }); const e = v(this, he); S(this, he, !1); const t = _(this, Ge, rt).call(this, n); return yt("/checkout/journal", 204, { ignoreLimitCheck: e ? 1 : 0, ...v(this, K) && { id: v(this, K) } }, t, { strictMaxRetries: !0, maxRetries: 1, repeatDelay: 500, checkSuccessParam: !1 }).then(() => Promise.resolve({ invalid: !1, count: n.length })).catch((r) => Promise.resolve({ invalid: !0, count: n.length, stackSize: this.getConfig("maxStack"), error: r })); }, Ge = /* @__PURE__ */ new WeakSet(), rt = function(n) { const e = { ...v(this, K) && { transId: v(this, K) }, encoded: !0, logs: [] }; return e.logs = n.map((t) => { const { level: r, date: i, code: o, order: s, message: a, context: u, details: c } = t; return { level: r, dt: i.toISOString(), ...o && { code: o }, ...s && { order: s }, message: De(a), ...u && { context: De(JSON.stringify(u)) }, ...c && { details: De(JSON.stringify(c)) } }; }), e; }, Be = /* @__PURE__ */ new WeakSet(), xt = function() { const { aborted: n, time: e, count: t } = v(this, H); if (n) return !1; const r = window.Cypress ? 45 : 5, i = (/* @__PURE__ */ new Date()).getTime(); return t > r && i - e < 1500 ? (v(this, H).aborted = !0, !1) : (i - e < 1500 ? ++v(this, H).count : (v(this, H).count = 0, v(this, H).time = (/* @__PURE__ */ new Date()).getTime()), !0); }; function Ot(n) { return new N(n); } const $e = Ot([new It(), new At()]), ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, BaseTransport: ze, ConsoleTransport: It, Logger: N, LoggerInstance: $e, ServerTransport: At, createLogger: Ot, default: $e }, Symbol.toStringTag, { value: "Module" })); class B { /** * Validate url address * @param url * @private */ static validateUrl(e) { return /^http(|s):\/\/.*/i.test(e); } /** * Redirect to url by GET method * @param url * @param redirectMode */ static redirectGet(e, t = "self") { if (!e || typeof e != "string" || !B.validateUrl(e)) throw new f("Cannot GET redirect to invalid URL address.", { ...arguments }); const r = B.getRedirectWindow(t); try { r.location.href = e; } catch { window.location.href = e; } } /** * Redirect to url by POST method (with form submitting) */ static redirectPost(e, t, r, i = "self") { if (!e || typeof e != "string" || !B.validateUrl(e)) throw new f("Cannot POST redirect to invalid URL address.", { ...arguments }); const o = document.createElement("form"); o.action = e, o.method = "POST", o.enctype = "multipart/form-data", o.target = B.getFormEscapeTarget(i), document.body.append(o); for (const s in t) { const a = document.createElement("input"); a.type = "hidden", a.name = s, a.name = s, a.value = t[s], o.append(a); } r && (o.enctype = r, o.encoding = r), o.submit(); } /** * Redirect to url by submitting form with iframe escape */ static redirectFormPost(e, t = "self") { if (!e || typeof e != "string") throw new f("Cannot redirect to invalid form.", { formDef: e, redirectMode: t }); const r = document.createElement("div"); r.innerHTML = e; const i = r.firstChild; if (i && i instanceof HTMLFormElement) i.target = B.getFormEscapeTarget(t), document.body.append(i), i.submit(); else throw new f("Cannot get form from virtual DIV.", { formDef: e, redirectMode: t }); } /** * Return target for redirection * @param redirectMode * @private */ static getFormEscapeTarget(e = "self") { switch (e) { case "parent": return "_parent"; case "top": return "_top"; case "self": default: return "_self"; } } /** * Get Window object for redirection * @private */ static getRedirectWindow(e = "self") { return e === "top" && window.top ? window.top : e === "parent" && window.parent ? window.parent : e === "self" && window.self ? window.self : ($e.warn("Unknown redirect mode. Redirecting to self window.", { context: { redirectMode: e } }), window); } } const Rn = "1.1.7"; function jn(n, e = null) { return k.get("/checkout/data/load", 200, Object.assign( { transId: e, checkoutId: n }, { dev: null } // null values will not be sent )); } function Nn(n, e) { return k.get("/checkout/data/payment", 200, { transId: e, checkoutId: n }); } function Un(n) { return k.get("/checkout/methods", 200, n, { checkSuccessParam: !1, responseValidator: (e, t) => t === 200 && "methods" in e }); } const Ee = ["cs", "de", "en", "es", "fr", "hr", "hu", "it", "no", "pl", "ro", "si", "sl", "sk", "sv"], Vn = ["CZK", "EUR", "PLN", "HUF", "USD", "GBP", "RON", "NOK", "SEK"], qn = ["AT", "BE", "CY", "CZ", "DE", "EE", "EL", "ES", "FI", "FR", "GB", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "NO", "PL", "PT", "RO", "SL", "SK", "SE", "US"], Tt = ["ALL", ...qn], Mt = ["CSOB", "COMGATE"], Gn = ["self", "parent", "top"], it = ["applepay", "googlepay", "card"], Bn = ["PAID", "AUTHORIZED", "PENDING", "CANCELLED"], $n = ["PAID", "AUTHORIZED", "CANCELLED"], ot = ["PAID", "AUTHORIZED"], L = [!0, !1], st = { style: ["black", "white", "white-outline"], type: ["plain", "add-money", "book", "buy", "check-out", "continue", "contribute", "donate", "order", "pay", "reload", "rent", "set-up", "subscribe", "support", "tip", "top-up"], disabled: L, locale: ["en-US", "ar-AB", "ca-ES", "zh-CN", "zh-HK", "zh-TW", "hr-HR", "cs-CZ", "da-DK", "de-DE", "nl-NL", "en-AU", "en-GB", "fi-FI", "fr-CA", "fr-FR", "de-DE", "el-GR", "he-IL", "hi-IN", "hu-HU", "id-ID", "it-IT", "ja-JP", "ko-KR", "ms-MY", "nb-NO", "pl-PL", "pt-BR", "pt-PT", "ro-RO", "ru-RU", "sk-SK", "es-MX", "es-ES", "sv-SE", "th-TH", "tr-TR", "uk-UA", "vi-VN"], provider: Mt, testEnvironment: L }, at = { style: ["black", "white"], type: ["book", "buy", "checkout", "donate", "order", "pay", "plain", "subscribe"], disabled: L, locale: ["ar", "bg", "ca", "zh", "hr", "cs", "da", "nl", "en", "et", "fi", "fr", "de", "el", "id", "it", "ja", "ko", "ms", "no", "pl", "pt", "ru", "sr", "sk", "sl", "es", "sv", "th", "tr", "uk"], provider: Mt, testEnvironment: L }, lt = { locale: Ee, layout: ["list", "groups"], icons: L, expanded: L, expandable: L, disabled: L, currency: Vn, country: Tt, preauth: L, embedded: L, initRecurring: L, verification: L, dynamicExpiration: L }, Ie = { // a = Apple | g = Google cs: { a: "cs-CZ", g: "cs" }, de: { a: "de-DE", g: "de" }, en: { a: "en-GB", g: "en" }, es: { a: "es-ES", g: "es" }, fr: { a: "fr-FR", g: "fr" }, hr: { a: "hr-HR", g: "hr" }, hu: { a: "hu-HU", g: "en" }, // Google Pay does not support Hungarian it: { a: "it-IT", g: "it" }, no: { a: "nb-NO", g: "no" }, pl: { a: "pl-PL", g: "pl" }, ro: { a: "ro-RO", g: "en" }, // Google Pay does not support Romanian si: { a: "en-GB", g: "sl" }, // fallback from our lang name error / Apple Pay does not support Slovenian sl: { a: "en-GB", g: "sl" }, // Apple Pay does not support Slovenian sk: { a: "sk-SK", g: "sk" }, sv: { a: "sv-SE", g: "sv" }, // new languages bg: { a: "en-GB", g: "bg" }, // Apple Pay does not support Bulgarian da: { a: "da-DK", g: "da" }, el: { a: "el-GR", g: "el" }, et: { a: "en-GB", g: "et" }, // Apple Pay does not support Estonian lt: { a: "en-GB", g: "en" }, // Apple Pay does not support Lithuanian // Google Pay does not support Lithuanian lv: { a: "en-GB", g: "en" }, // Apple Pay does not support Latvian // Google Pay does not support Latvian nl: { a: "nl-NL", g: "nl" }, pt: { a: "pt-PT", g: "pt" } }, Fn = /^[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/i, Dt = /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, Wn = /^[1-9][0-9]*(m|h|d)$/i, zn = /^(APPLEPAY|GOOGLEPAY|CARD|LATER|BANK|PART|LOAN|[A-Z0-9]+_([A-Z]{2})_[A-Z0-9]+)/i, Hn = typeof btoa == "function", Ke = typeof Buffer == "function"; typeof TextDecoder == "function" && new TextDecoder(); const ut = typeof TextEncoder == "function" ? new TextEncoder() : void 0, Kn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", ue = Array.prototype.slice.call(Kn); ((n) => { let e = {}; return n.forEach((t, r) => e[t] = r), e; })(ue); const T = String.fromCharCode.bind(String); typeof Uint8Array.from == "function" && Uint8Array.from.bind(Uint8Array); const Zn = (n) => n.replace(/=/g, "").replace(/[+\/]/g, (e) => e == "+" ? "-" : "_"), Jn = (n) => { let e, t, r, i, o = ""; const s = n.length % 3; for (let a = 0; a < n.length; ) { if ((t = n.charCodeAt(a++)) > 255 || (r = n.charCodeAt(a++)) > 255 || (i = n.charCodeAt(a++)) > 255) throw new TypeError("invalid character found"); e = t << 16 | r << 8 | i, o += ue[e >> 18 & 63] + ue[e >> 12 & 63] + ue[e >> 6 & 63] + ue[e & 63]; } return s ? o.slice(0, s - 3) + "===".substring(s) : o; }, Rt = Hn ? (n) => btoa(n) : Ke ? (n) => Buffer.from(n, "binary").toString("base64") : Jn, Yn = Ke ? (n) => Buffer.from(n).toString("base64") : (n) => { let t = []; for (let r = 0, i = n.length; r < i; r += 4096) t.push(T.apply(null, n.subarray(r, r + 4096))); return Rt(t.join("")); }, Xn = (n) => { if (n.length < 2) { var e = n.charCodeAt(0); return e < 128 ? n : e < 2048 ? T(192 | e >>> 6) + T(128 | e & 63) : T(224 | e >>> 12 & 15) + T(128 | e >>> 6 & 63) + T(128 | e & 63); } else { var e = 65536 + (n.charCodeAt(0) - 55296) * 1024 + (n.charCodeAt(1) - 56320); return T(240 | e >>> 18 & 7) + T(128 | e >>> 12 & 63) + T(128 | e >>> 6 & 63) + T(128 | e & 63); } }, Qn = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g, er = (n) => n.replace(Qn, Xn), ct = Ke ? (n) => Buffer.from(n, "utf8").toString("base64") : ut ? (n) => Yn(ut.encode(n)) : (n) => Rt(er(n)), ke = (n, e = !1) => e ? Zn(ct(n)) : ct(n); var Q; class tr extends ne.BaseTransport { /** * TransportServer constructor * @param loggingFunction */ constructor(e) { if (super({ debug: "boolean", info: "boolean", warn: "boolean", error: "boolean" }, { debug: !0, info: !0, warn: !0, error: !0 }), Q.set(this, void 0), typeof e != "function") throw new TypeError("ExternalLogger: loggingFunction must be a function"); je(this, Q, e, "f"); } /** * Check if Service is available on this device * @public * @param _record * @param _paymentId * @return {boolean} */ handle(e, t) { var r; try { if (Z(this, Q, "f") && typeof Z(this, Q, "f") == "function") return Z(this, Q, "f").call(this, e.message, e.level.toLowerCase(), (r = e.code) !== null && r !== void 0 ? r : null, { source: "checkout", context: e.context, details: e.details }, e.onlyLocal, e.ignoreLimitCheck, e.dispatchNow), !0; } catch (i) { console.error("Logger: log error", i); } return !1; } /** * Get type of transport * @public * @return {string} type of transport */ getType() { return "ExternalTransport"; } /** * Check if Transport is only local (no external communication) * @public * @return {boolean} true if is local */ isLocal() { return !1; } /** * Check if Transport can ignore rate-limiter * @public * @return {boolean} true if can ignore limit */ canIgnoreLimit() { return !0; } /** * Check if Transport can ignore rate-limiter * @public * @return {boolean} true if can dispatch now */ canDispatchNow() { return !