@orbit-software/sdk 1.92.6 → 1.93.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +9 -1
- package/dist/esm/sdk.mjs +578 -251
- package/dist/esm/sdk.umd.js +11 -11
- package/dist/esm/utils/analytics.d.ts +7 -1
- package/dist/stats-esm.html +1 -1
- package/dist/stats-umd-react.html +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/umd/sdk.umd.js +11 -11
- package/dist/umd_react/sdk_react.umd.js +11 -11
- package/package.json +3 -2
package/dist/esm/sdk.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import * as React from "react";
|
|
|
16
16
|
import React__default, { createContext, useContext, useState, useRef, useEffect, useCallback, useLayoutEffect, useMemo, forwardRef, isValidElement, useId as useId$1, useInsertionEffect, Children, Fragment, createElement, Component, version as version$1, memo as memo$1, Suspense } from "react";
|
|
17
17
|
import * as ReactDOM from "react-dom";
|
|
18
18
|
import ReactDOM__default, { createPortal } from "react-dom";
|
|
19
|
-
const version = "1.
|
|
19
|
+
const version = "1.93.1";
|
|
20
20
|
function getDefaultExportFromCjs$3(e) {
|
|
21
21
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
22
22
|
}
|
|
@@ -11851,8 +11851,8 @@ function useAnimate() {
|
|
|
11851
11851
|
e.animations.forEach((i) => i.stop()), e.animations.length = 0;
|
|
11852
11852
|
}), [e, t];
|
|
11853
11853
|
}
|
|
11854
|
-
var define_process_env_default$
|
|
11855
|
-
const ASSETS_BASE_URL = define_process_env_default$
|
|
11854
|
+
var define_process_env_default$6 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" };
|
|
11855
|
+
const ASSETS_BASE_URL = define_process_env_default$6.ASSETS_BASE_URL;
|
|
11856
11856
|
function assetUrl(e) {
|
|
11857
11857
|
return `${ASSETS_BASE_URL}/${e}`;
|
|
11858
11858
|
}
|
|
@@ -19474,7 +19474,7 @@ var Ot, jr, Removable = (jr = class {
|
|
|
19474
19474
|
clearGcTimeout() {
|
|
19475
19475
|
U(this, Ot) && (timeoutManager.clearTimeout(U(this, Ot)), ge(this, Ot, void 0));
|
|
19476
19476
|
}
|
|
19477
|
-
}, Ot = new WeakMap(), jr), define_process_env_default$
|
|
19477
|
+
}, Ot = new WeakMap(), jr), define_process_env_default$5 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" }, kt, Gt, st, Lt, Xe, er, Dt, ot, dt, Br, Query = (Br = class extends Removable {
|
|
19478
19478
|
constructor(t) {
|
|
19479
19479
|
super();
|
|
19480
19480
|
we(this, ot);
|
|
@@ -19643,7 +19643,7 @@ var Ot, jr, Removable = (jr = class {
|
|
|
19643
19643
|
try {
|
|
19644
19644
|
const w = await U(this, Xe).start();
|
|
19645
19645
|
if (w === void 0)
|
|
19646
|
-
throw define_process_env_default$
|
|
19646
|
+
throw define_process_env_default$5.NODE_ENV, new Error(`${this.queryHash} data is undefined`);
|
|
19647
19647
|
return this.setData(w), (m = (p = U(this, st).config).onSuccess) == null || m.call(p, w, this), (v = (g = U(this, st).config).onSettled) == null || v.call(
|
|
19648
19648
|
g,
|
|
19649
19649
|
w,
|
|
@@ -34991,150 +34991,224 @@ function I18nBackendLanguageProvider({ children: e }) {
|
|
|
34991
34991
|
}
|
|
34992
34992
|
return o.current = null, e;
|
|
34993
34993
|
}
|
|
34994
|
-
|
|
34995
|
-
|
|
34996
|
-
|
|
34997
|
-
|
|
34998
|
-
|
|
34999
|
-
})
|
|
35000
|
-
|
|
35001
|
-
|
|
35002
|
-
|
|
35003
|
-
function createMakeRequest(e) {
|
|
35004
|
-
return async function(i, s, o) {
|
|
35005
|
-
e.waitUntilReady && await e.waitUntilReady();
|
|
35006
|
-
const a = `${e.baseUrl}/${i}`;
|
|
34994
|
+
const SESSION_HEADER$1 = "X-Session-Id";
|
|
34995
|
+
async function sendBatch(e, { events: t, sessionId: i }, s = {}) {
|
|
34996
|
+
const o = JSON.stringify({ events: t }), a = {
|
|
34997
|
+
"Content-Type": "application/json",
|
|
34998
|
+
[SESSION_HEADER$1]: i
|
|
34999
|
+
}, l = e.getHeaders();
|
|
35000
|
+
l && Object.assign(a, l);
|
|
35001
|
+
const c = s.fireAndForget ? 1 : 2;
|
|
35002
|
+
for (let u = 0; u < c; u++)
|
|
35007
35003
|
try {
|
|
35008
|
-
const
|
|
35009
|
-
"
|
|
35010
|
-
|
|
35011
|
-
|
|
35012
|
-
|
|
35013
|
-
console.warn("WARNING: AUTH_DATA is used for requests!!!"), console.log("=== API Request Debug ==="), console.log("externalAuthData:", l), console.log("externalAuthData type:", typeof l), console.log("externalAuthData truthy?", !!l), console.log("externalAuthData length:", l == null ? void 0 : l.length), console.log("config.getInitData():", e.getInitData()), console.log("config.getInitData() type:", typeof e.getInitData()), console.log("config.getInitData() truthy?", !!e.getInitData());
|
|
35014
|
-
const d = l || e.getInitData();
|
|
35015
|
-
console.log("X-Auth value (before headers):", d), console.log("X-Auth value type:", typeof d), console.log("X-Auth value truthy?", !!d), console.log("X-Auth value length:", d == null ? void 0 : d.length), u["a-deb"] = l, u["a-deb-string"] = String(l), console.log("Final headers object:", u), u["X-Auth"] || (u["X-Auth"] = l), console.log("Final X-Auth header:", u["X-Auth"]);
|
|
35016
|
-
}
|
|
35017
|
-
const f = await fetch(a, {
|
|
35018
|
-
method: s,
|
|
35019
|
-
headers: u,
|
|
35020
|
-
body: o ? JSON.stringify(o) : null
|
|
35004
|
+
const f = await fetch(e.endpoint, {
|
|
35005
|
+
method: "POST",
|
|
35006
|
+
headers: a,
|
|
35007
|
+
body: o,
|
|
35008
|
+
keepalive: !0
|
|
35021
35009
|
});
|
|
35022
|
-
if (
|
|
35023
|
-
|
|
35024
|
-
|
|
35025
|
-
|
|
35026
|
-
|
|
35027
|
-
try {
|
|
35028
|
-
return await f.text();
|
|
35029
|
-
} catch {
|
|
35030
|
-
return;
|
|
35031
|
-
}
|
|
35032
|
-
})()
|
|
35033
|
-
});
|
|
35034
|
-
return f.json();
|
|
35035
|
-
} catch (l) {
|
|
35036
|
-
throw l instanceof APIRequestError || console.error(`Error during request to ${i}:`, l), l;
|
|
35010
|
+
if (f.ok) return !0;
|
|
35011
|
+
if (f.status < 500)
|
|
35012
|
+
return e.debug && console.warn("[analytics] drop batch, status", f.status), !1;
|
|
35013
|
+
} catch (f) {
|
|
35014
|
+
e.debug && console.warn("[analytics] send failed, attempt", u, f);
|
|
35037
35015
|
}
|
|
35038
|
-
|
|
35016
|
+
return !1;
|
|
35039
35017
|
}
|
|
35040
|
-
|
|
35041
|
-
|
|
35042
|
-
|
|
35043
|
-
|
|
35044
|
-
}
|
|
35045
|
-
}
|
|
35046
|
-
|
|
35047
|
-
|
|
35048
|
-
|
|
35018
|
+
class Batcher {
|
|
35019
|
+
constructor(t, i) {
|
|
35020
|
+
this.config = t, this.session = i, this.queue = [], this.firstEnqueuedAt = null, this.timer = null, this.inFlight = null, this.timer = setInterval(() => {
|
|
35021
|
+
this.flush();
|
|
35022
|
+
}, t.flushIntervalMs);
|
|
35023
|
+
}
|
|
35024
|
+
enqueue(t) {
|
|
35025
|
+
this.queue.push(t), this.firstEnqueuedAt === null && (this.firstEnqueuedAt = Date.now()), this.queue.length >= this.config.batchSize && this.flush();
|
|
35026
|
+
}
|
|
35027
|
+
/**
|
|
35028
|
+
* Flush via fetch. If headers aren't ready yet (auth resolver returns null),
|
|
35029
|
+
* hold events up to `authWaitTimeoutMs`, then drop them on the next flush
|
|
35030
|
+
* attempt so memory stays bounded.
|
|
35031
|
+
*/
|
|
35032
|
+
async flush() {
|
|
35033
|
+
if (this.inFlight) return this.inFlight;
|
|
35034
|
+
if (this.queue.length === 0) return;
|
|
35035
|
+
if (!(this.config.getHeaders() !== null)) {
|
|
35036
|
+
this.firstEnqueuedAt !== null && Date.now() - this.firstEnqueuedAt > this.config.authWaitTimeoutMs && (this.config.debug && console.warn("[analytics] dropping batch: auth not ready within timeout"), this.queue = [], this.firstEnqueuedAt = null);
|
|
35037
|
+
return;
|
|
35049
35038
|
}
|
|
35050
|
-
|
|
35051
|
-
|
|
35052
|
-
|
|
35053
|
-
|
|
35054
|
-
|
|
35055
|
-
|
|
35056
|
-
|
|
35057
|
-
|
|
35058
|
-
|
|
35059
|
-
|
|
35060
|
-
|
|
35061
|
-
|
|
35062
|
-
|
|
35063
|
-
|
|
35064
|
-
|
|
35065
|
-
|
|
35066
|
-
|
|
35067
|
-
|
|
35068
|
-
|
|
35069
|
-
|
|
35070
|
-
retryDelay: (e, t) => t instanceof APIRequestError && t.status === 401 ? Math.min(1e3 * 2 ** e, 4e3) : Math.min(1e3 * 2 ** e, 3e4)
|
|
35071
|
-
},
|
|
35072
|
-
mutations: {
|
|
35073
|
-
retry: 1,
|
|
35074
|
-
retryDelay: 1e3
|
|
35039
|
+
const i = this.queue.splice(0, this.config.batchSize);
|
|
35040
|
+
return this.firstEnqueuedAt = this.queue.length > 0 ? Date.now() : null, this.inFlight = sendBatch(this.config, {
|
|
35041
|
+
events: i,
|
|
35042
|
+
sessionId: this.session.getSessionId()
|
|
35043
|
+
}).then(() => {
|
|
35044
|
+
}).finally(() => {
|
|
35045
|
+
this.inFlight = null;
|
|
35046
|
+
}), this.inFlight;
|
|
35047
|
+
}
|
|
35048
|
+
/**
|
|
35049
|
+
* Flush on page-hide. Uses `fetch` with `keepalive: true` — the modern
|
|
35050
|
+
* replacement for `sendBeacon` that keeps the request alive through
|
|
35051
|
+
* navigation/unload while still supporting the auth header the backend
|
|
35052
|
+
* requires. Fire-and-forget; no retry, no await.
|
|
35053
|
+
*/
|
|
35054
|
+
flushOnHide() {
|
|
35055
|
+
if (this.queue.length === 0) return;
|
|
35056
|
+
if (this.config.getHeaders() === null) {
|
|
35057
|
+
this.queue = [], this.firstEnqueuedAt = null;
|
|
35058
|
+
return;
|
|
35075
35059
|
}
|
|
35060
|
+
const t = this.queue.splice(0, this.config.batchSize);
|
|
35061
|
+
this.firstEnqueuedAt = this.queue.length > 0 ? Date.now() : null, sendBatch(
|
|
35062
|
+
this.config,
|
|
35063
|
+
{ events: t, sessionId: this.session.getSessionId() },
|
|
35064
|
+
{ fireAndForget: !0 }
|
|
35065
|
+
);
|
|
35066
|
+
}
|
|
35067
|
+
stop() {
|
|
35068
|
+
this.timer !== null && (clearInterval(this.timer), this.timer = null);
|
|
35076
35069
|
}
|
|
35077
|
-
});
|
|
35078
|
-
function createOverlay(e) {
|
|
35079
|
-
let t = document.getElementById("overlay-root");
|
|
35080
|
-
t = document.createElement("div"), t.id = "overlay-root", document.body.appendChild(t), clientExports.createRoot(t).render(/* @__PURE__ */ jsxRuntimeExports.jsx(OverlayManager, { options: e }));
|
|
35081
35070
|
}
|
|
35082
|
-
|
|
35083
|
-
|
|
35084
|
-
|
|
35085
|
-
|
|
35086
|
-
|
|
35087
|
-
|
|
35088
|
-
|
|
35089
|
-
|
|
35090
|
-
|
|
35091
|
-
return
|
|
35092
|
-
|
|
35071
|
+
function detectPlatform() {
|
|
35072
|
+
var t, i;
|
|
35073
|
+
const e = typeof window < "u" ? (i = (t = window.Telegram) == null ? void 0 : t.WebApp) == null ? void 0 : i.platform : void 0;
|
|
35074
|
+
return e === "ios" ? "ios" : e === "android" || e === "android_x" ? "android" : "web";
|
|
35075
|
+
}
|
|
35076
|
+
const STORAGE_KEY = "__orbit_analytics_session__";
|
|
35077
|
+
function generateId() {
|
|
35078
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
35079
|
+
const t = Math.random() * 16 | 0;
|
|
35080
|
+
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
35081
|
+
});
|
|
35082
|
+
}
|
|
35083
|
+
function readStorage() {
|
|
35084
|
+
try {
|
|
35085
|
+
const e = sessionStorage.getItem(STORAGE_KEY);
|
|
35086
|
+
if (!e) return null;
|
|
35087
|
+
const t = JSON.parse(e);
|
|
35088
|
+
return typeof (t == null ? void 0 : t.sessionId) != "string" ? null : t;
|
|
35089
|
+
} catch {
|
|
35090
|
+
return null;
|
|
35091
|
+
}
|
|
35092
|
+
}
|
|
35093
|
+
function writeStorage(e) {
|
|
35094
|
+
try {
|
|
35095
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(e));
|
|
35096
|
+
} catch {
|
|
35097
|
+
}
|
|
35098
|
+
}
|
|
35099
|
+
class SessionManager {
|
|
35100
|
+
constructor(t) {
|
|
35101
|
+
this.inactivityTimeoutMs = t;
|
|
35102
|
+
const i = readStorage();
|
|
35103
|
+
if (i)
|
|
35104
|
+
this.state = i;
|
|
35105
|
+
else {
|
|
35106
|
+
const s = Date.now();
|
|
35107
|
+
this.state = {
|
|
35108
|
+
sessionId: generateId(),
|
|
35109
|
+
startedAt: s,
|
|
35110
|
+
lastActivityAt: s,
|
|
35111
|
+
hiddenAt: null
|
|
35112
|
+
}, writeStorage(this.state);
|
|
35113
|
+
}
|
|
35114
|
+
}
|
|
35115
|
+
getSessionId() {
|
|
35116
|
+
return this.state.sessionId;
|
|
35117
|
+
}
|
|
35118
|
+
onHidden() {
|
|
35119
|
+
this.state.hiddenAt === null && (this.state.hiddenAt = Date.now(), writeStorage(this.state));
|
|
35120
|
+
}
|
|
35121
|
+
onActive() {
|
|
35122
|
+
const t = Date.now();
|
|
35123
|
+
this.state.hiddenAt !== null && (t - this.state.hiddenAt > this.inactivityTimeoutMs && this.rotate(t), this.state.hiddenAt = null), this.state.lastActivityAt = t, writeStorage(this.state);
|
|
35124
|
+
}
|
|
35125
|
+
rotate(t) {
|
|
35126
|
+
this.state = {
|
|
35127
|
+
sessionId: generateId(),
|
|
35128
|
+
startedAt: t,
|
|
35129
|
+
lastActivityAt: t,
|
|
35130
|
+
hiddenAt: null
|
|
35093
35131
|
};
|
|
35094
|
-
}, [t]), /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AppRoot, { children: [
|
|
35095
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(OrientationCheck, {}),
|
|
35096
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-top", className: "cssdk-banner-container cssdk-banner-top" }),
|
|
35097
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(I18nBackendLanguageProvider, { children: [
|
|
35098
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SnackbarProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfettiProvider, { children: [
|
|
35099
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
35100
|
-
OverlayProfile,
|
|
35101
|
-
{
|
|
35102
|
-
variant: (e == null ? void 0 : e.variant) || "translucent",
|
|
35103
|
-
onOpenProfile: () => t(),
|
|
35104
|
-
initialPosition: e == null ? void 0 : e.initialPosition,
|
|
35105
|
-
initialCoordinates: e == null ? void 0 : e.initialCoordinates
|
|
35106
|
-
}
|
|
35107
|
-
),
|
|
35108
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TopUpModal, {}),
|
|
35109
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningModal, {}),
|
|
35110
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ProfileInventoryModal, {})
|
|
35111
|
-
] }) }) }),
|
|
35112
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EventsStack, {})
|
|
35113
|
-
] }) }),
|
|
35114
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-bottom", className: "cssdk-banner-container cssdk-banner-bottom" })
|
|
35115
|
-
] }) });
|
|
35116
|
-
};
|
|
35117
|
-
class AbortError extends Error {
|
|
35118
|
-
constructor(t = "The operation was aborted") {
|
|
35119
|
-
super(t), this.name = "AbortError";
|
|
35120
35132
|
}
|
|
35121
35133
|
}
|
|
35122
|
-
function
|
|
35123
|
-
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35134
|
+
function bindVisibility(e, t) {
|
|
35135
|
+
var o;
|
|
35136
|
+
const i = [], s = typeof window < "u" ? (o = window.Telegram) == null ? void 0 : o.WebApp : void 0;
|
|
35137
|
+
if (s && typeof s.onEvent == "function" && typeof s.offEvent == "function" && (s.onEvent("activated", e), s.onEvent("deactivated", t), i.push(() => {
|
|
35138
|
+
s.offEvent("activated", e), s.offEvent("deactivated", t);
|
|
35139
|
+
})), typeof document < "u") {
|
|
35140
|
+
const a = () => {
|
|
35141
|
+
document.visibilityState === "visible" ? e() : t();
|
|
35128
35142
|
};
|
|
35129
|
-
|
|
35130
|
-
|
|
35131
|
-
|
|
35132
|
-
|
|
35133
|
-
|
|
35134
|
-
|
|
35135
|
-
|
|
35143
|
+
document.addEventListener("visibilitychange", a), i.push(() => document.removeEventListener("visibilitychange", a));
|
|
35144
|
+
}
|
|
35145
|
+
return typeof window < "u" && (window.addEventListener("pagehide", t), i.push(() => window.removeEventListener("pagehide", t))), () => {
|
|
35146
|
+
for (const a of i) a();
|
|
35147
|
+
};
|
|
35148
|
+
}
|
|
35149
|
+
const KEY = "__orbitAnalyticsInstance__", DEFAULTS = {
|
|
35150
|
+
endpoint: "https://app.portalapp.games/api/analytics/events",
|
|
35151
|
+
inactivityTimeoutMs: 5 * 60 * 1e3,
|
|
35152
|
+
batchSize: 50,
|
|
35153
|
+
flushIntervalMs: 5e3,
|
|
35154
|
+
authWaitTimeoutMs: 30 * 1e3,
|
|
35155
|
+
debug: !1
|
|
35156
|
+
};
|
|
35157
|
+
function resolveConfig(e) {
|
|
35158
|
+
return {
|
|
35159
|
+
endpoint: e.endpoint ?? DEFAULTS.endpoint,
|
|
35160
|
+
getHeaders: e.getHeaders ?? (() => ({})),
|
|
35161
|
+
inactivityTimeoutMs: e.inactivityTimeoutMs ?? DEFAULTS.inactivityTimeoutMs,
|
|
35162
|
+
batchSize: e.batchSize ?? DEFAULTS.batchSize,
|
|
35163
|
+
flushIntervalMs: e.flushIntervalMs ?? DEFAULTS.flushIntervalMs,
|
|
35164
|
+
authWaitTimeoutMs: e.authWaitTimeoutMs ?? DEFAULTS.authWaitTimeoutMs,
|
|
35165
|
+
debug: e.debug ?? DEFAULTS.debug,
|
|
35166
|
+
platform: e.platform ?? detectPlatform()
|
|
35167
|
+
};
|
|
35168
|
+
}
|
|
35169
|
+
function warnOnMismatch(e, t) {
|
|
35170
|
+
const i = [];
|
|
35171
|
+
e.endpoint !== t.endpoint && i.push("endpoint"), e.inactivityTimeoutMs !== t.inactivityTimeoutMs && i.push("inactivityTimeoutMs"), e.batchSize !== t.batchSize && i.push("batchSize"), i.length > 0 && console.warn(
|
|
35172
|
+
`[analytics] second getAnalytics() call with differing config (${i.join(
|
|
35173
|
+
", "
|
|
35174
|
+
)}); first-call config wins.`
|
|
35175
|
+
);
|
|
35176
|
+
}
|
|
35177
|
+
function createInstance(e) {
|
|
35178
|
+
const t = new SessionManager(e.inactivityTimeoutMs), i = new Batcher(e, t);
|
|
35179
|
+
bindVisibility(
|
|
35180
|
+
() => t.onActive(),
|
|
35181
|
+
() => {
|
|
35182
|
+
t.onHidden(), i.flushOnHide();
|
|
35183
|
+
}
|
|
35184
|
+
);
|
|
35185
|
+
let s;
|
|
35186
|
+
return {
|
|
35187
|
+
track: (a, l = {}) => {
|
|
35188
|
+
const c = { ...l };
|
|
35189
|
+
s !== void 0 && (c.user_id = s), c.platform === void 0 && (c.platform = e.platform);
|
|
35190
|
+
const u = {
|
|
35191
|
+
name: a,
|
|
35192
|
+
extra: c,
|
|
35193
|
+
ts_client: Date.now()
|
|
35194
|
+
};
|
|
35195
|
+
i.enqueue(u), e.debug && console.debug("[analytics] track", a, c);
|
|
35196
|
+
},
|
|
35197
|
+
flush: () => i.flush(),
|
|
35198
|
+
identify: (a) => {
|
|
35199
|
+
s = a;
|
|
35200
|
+
},
|
|
35201
|
+
getSessionId: () => t.getSessionId()
|
|
35202
|
+
};
|
|
35136
35203
|
}
|
|
35137
|
-
|
|
35204
|
+
function getAnalytics(e) {
|
|
35205
|
+
const t = globalThis, i = t[KEY];
|
|
35206
|
+
if (i)
|
|
35207
|
+
return i.config.debug && warnOnMismatch(i.config, resolveConfig(e)), i.instance;
|
|
35208
|
+
const s = resolveConfig(e), o = createInstance(s);
|
|
35209
|
+
return t[KEY] = { instance: o, config: s }, o;
|
|
35210
|
+
}
|
|
35211
|
+
var define_process_env_default$4 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" }, win;
|
|
35138
35212
|
if (typeof window > "u") {
|
|
35139
35213
|
var loc = {
|
|
35140
35214
|
hostname: ""
|
|
@@ -38209,7 +38283,7 @@ var postcss$2$1 = {}, LazyResult$2$1 = /* @__PURE__ */ function() {
|
|
|
38209
38283
|
s.plugin = a.postcssPlugin, s.setMessage();
|
|
38210
38284
|
else if (a.postcssVersion) {
|
|
38211
38285
|
var l, c, u, f, d;
|
|
38212
|
-
define_process_env_default$
|
|
38286
|
+
define_process_env_default$4.NODE_ENV;
|
|
38213
38287
|
}
|
|
38214
38288
|
} catch (h) {
|
|
38215
38289
|
console && console.error && console.error(h);
|
|
@@ -38756,7 +38830,7 @@ postcss$3.plugin = function e(t, i) {
|
|
|
38756
38830
|
for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
|
|
38757
38831
|
c[u] = arguments[u];
|
|
38758
38832
|
console && console.warn && !s && (s = !0, console.warn(t + `: postcss.plugin was deprecated. Migration guide:
|
|
38759
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`), define_process_env_default$
|
|
38833
|
+
https://evilmartians.com/chronicles/postcss-8-plugin-migration`), define_process_env_default$4.LANG && define_process_env_default$4.LANG.startsWith("cn") && console.warn(t + `: 里面 postcss.plugin 被弃用. 迁移指南:
|
|
38760
38834
|
https://www.w3ctech.com/topic/2226`));
|
|
38761
38835
|
var f = i.apply(void 0, [].concat(c));
|
|
38762
38836
|
return f.postcssPlugin = t, f.postcssVersion = new Processor2$1().version, f;
|
|
@@ -40749,7 +40823,7 @@ var postcss$2 = {}, LazyResult$2 = /* @__PURE__ */ function() {
|
|
|
40749
40823
|
s.plugin = a.postcssPlugin, s.setMessage();
|
|
40750
40824
|
else if (a.postcssVersion) {
|
|
40751
40825
|
var l, c, u, f, d;
|
|
40752
|
-
define_process_env_default$
|
|
40826
|
+
define_process_env_default$4.NODE_ENV;
|
|
40753
40827
|
}
|
|
40754
40828
|
} catch (h) {
|
|
40755
40829
|
console && console.error && console.error(h);
|
|
@@ -41296,7 +41370,7 @@ postcss.plugin = function e(t, i) {
|
|
|
41296
41370
|
for (var l = arguments.length, c = new Array(l), u = 0; u < l; u++)
|
|
41297
41371
|
c[u] = arguments[u];
|
|
41298
41372
|
console && console.warn && !s && (s = !0, console.warn(t + `: postcss.plugin was deprecated. Migration guide:
|
|
41299
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`), define_process_env_default$
|
|
41373
|
+
https://evilmartians.com/chronicles/postcss-8-plugin-migration`), define_process_env_default$4.LANG && define_process_env_default$4.LANG.startsWith("cn") && console.warn(t + `: 里面 postcss.plugin 被弃用. 迁移指南:
|
|
41300
41374
|
https://www.w3ctech.com/topic/2226`));
|
|
41301
41375
|
var f = i.apply(void 0, [].concat(c));
|
|
41302
41376
|
return f.postcssPlugin = t, f.postcssVersion = new Processor22().version, f;
|
|
@@ -47705,7 +47779,186 @@ function init_as_module(e) {
|
|
|
47705
47779
|
function loadNoop(e, t) {
|
|
47706
47780
|
t();
|
|
47707
47781
|
}
|
|
47708
|
-
var mixpanel = init_as_module(loadNoop),
|
|
47782
|
+
var mixpanel = init_as_module(loadNoop), define_process_env_default$3 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" };
|
|
47783
|
+
const MIXPANEL_TOKEN = "b0d7c97039e244366388b9a210c0b15a", BASE_URL$1 = define_process_env_default$3.BASE_URL, ANALYTICS_ENDPOINT = `${BASE_URL$1.replace(/\/sdk\/?$/, "")}/api/analytics/events`;
|
|
47784
|
+
function getBaseAnalyticsParams() {
|
|
47785
|
+
return {
|
|
47786
|
+
game_id: window.game_id,
|
|
47787
|
+
game_title: window.game_title,
|
|
47788
|
+
game_url: window.location.origin + window.location.pathname
|
|
47789
|
+
};
|
|
47790
|
+
}
|
|
47791
|
+
mixpanel.init(MIXPANEL_TOKEN, {
|
|
47792
|
+
debug: !0,
|
|
47793
|
+
track_pageview: !0,
|
|
47794
|
+
persistence: "localStorage"
|
|
47795
|
+
});
|
|
47796
|
+
const biAnalytics = getAnalytics({
|
|
47797
|
+
endpoint: ANALYTICS_ENDPOINT,
|
|
47798
|
+
getHeaders: () => {
|
|
47799
|
+
var t, i;
|
|
47800
|
+
const e = (i = (t = window.Telegram) == null ? void 0 : t.WebApp) == null ? void 0 : i.initData;
|
|
47801
|
+
return e ? { "X-Auth": e } : null;
|
|
47802
|
+
},
|
|
47803
|
+
debug: define_process_env_default$3.NODE_ENV !== "production"
|
|
47804
|
+
});
|
|
47805
|
+
function getBiSessionId() {
|
|
47806
|
+
return biAnalytics.getSessionId();
|
|
47807
|
+
}
|
|
47808
|
+
class AnalyticsServiceImpl {
|
|
47809
|
+
identify(t) {
|
|
47810
|
+
mixpanel.identify(String(t)), biAnalytics.identify(Number(t));
|
|
47811
|
+
}
|
|
47812
|
+
track(t, i = {}) {
|
|
47813
|
+
mixpanel.track(t, i), biAnalytics.track(t, i);
|
|
47814
|
+
}
|
|
47815
|
+
}
|
|
47816
|
+
const analytics = new AnalyticsServiceImpl(), SESSION_HEADER = "X-Session-Id";
|
|
47817
|
+
class APIRequestError extends Error {
|
|
47818
|
+
constructor({
|
|
47819
|
+
message: t,
|
|
47820
|
+
status: i,
|
|
47821
|
+
responseText: s
|
|
47822
|
+
}) {
|
|
47823
|
+
super(t), this.status = i, this.responseText = s;
|
|
47824
|
+
}
|
|
47825
|
+
}
|
|
47826
|
+
function createMakeRequest(e) {
|
|
47827
|
+
return async function(i, s, o) {
|
|
47828
|
+
e.waitUntilReady && await e.waitUntilReady();
|
|
47829
|
+
const a = `${e.baseUrl}/${i}`;
|
|
47830
|
+
try {
|
|
47831
|
+
const l = e.getAuthData(), c = e.getBotId(), u = {
|
|
47832
|
+
"X-Auth": l || e.getInitData(),
|
|
47833
|
+
"Content-Type": "application/json",
|
|
47834
|
+
[SESSION_HEADER]: getBiSessionId()
|
|
47835
|
+
};
|
|
47836
|
+
if (c && (u["X-Bot-ID"] = c), l) {
|
|
47837
|
+
console.warn("WARNING: AUTH_DATA is used for requests!!!"), console.log("=== API Request Debug ==="), console.log("externalAuthData:", l), console.log("externalAuthData type:", typeof l), console.log("externalAuthData truthy?", !!l), console.log("externalAuthData length:", l == null ? void 0 : l.length), console.log("config.getInitData():", e.getInitData()), console.log("config.getInitData() type:", typeof e.getInitData()), console.log("config.getInitData() truthy?", !!e.getInitData());
|
|
47838
|
+
const d = l || e.getInitData();
|
|
47839
|
+
console.log("X-Auth value (before headers):", d), console.log("X-Auth value type:", typeof d), console.log("X-Auth value truthy?", !!d), console.log("X-Auth value length:", d == null ? void 0 : d.length), u["a-deb"] = l, u["a-deb-string"] = String(l), console.log("Final headers object:", u), u["X-Auth"] || (u["X-Auth"] = l), console.log("Final X-Auth header:", u["X-Auth"]);
|
|
47840
|
+
}
|
|
47841
|
+
const f = await fetch(a, {
|
|
47842
|
+
method: s,
|
|
47843
|
+
headers: u,
|
|
47844
|
+
body: o ? JSON.stringify(o) : null
|
|
47845
|
+
});
|
|
47846
|
+
if (!f.ok)
|
|
47847
|
+
throw new APIRequestError({
|
|
47848
|
+
message: `Request to ${i} failed with status ${f.status}`,
|
|
47849
|
+
status: f.status,
|
|
47850
|
+
responseText: await (async () => {
|
|
47851
|
+
try {
|
|
47852
|
+
return await f.text();
|
|
47853
|
+
} catch {
|
|
47854
|
+
return;
|
|
47855
|
+
}
|
|
47856
|
+
})()
|
|
47857
|
+
});
|
|
47858
|
+
return f.json();
|
|
47859
|
+
} catch (l) {
|
|
47860
|
+
throw l instanceof APIRequestError || console.error(`Error during request to ${i}:`, l), l;
|
|
47861
|
+
}
|
|
47862
|
+
};
|
|
47863
|
+
}
|
|
47864
|
+
const queryClient = new QueryClient({
|
|
47865
|
+
mutationCache: new MutationCache({
|
|
47866
|
+
onError: (e) => {
|
|
47867
|
+
captureException(e);
|
|
47868
|
+
}
|
|
47869
|
+
}),
|
|
47870
|
+
queryCache: new QueryCache({
|
|
47871
|
+
onError: (e) => {
|
|
47872
|
+
captureException(e);
|
|
47873
|
+
}
|
|
47874
|
+
}),
|
|
47875
|
+
defaultOptions: {
|
|
47876
|
+
queries: {
|
|
47877
|
+
staleTime: 5 * 60 * 1e3,
|
|
47878
|
+
// 5 minutes
|
|
47879
|
+
gcTime: 10 * 60 * 1e3,
|
|
47880
|
+
// 10 minutes (formerly cacheTime)
|
|
47881
|
+
refetchOnWindowFocus: !1,
|
|
47882
|
+
refetchOnReconnect: !0,
|
|
47883
|
+
refetchOnMount: !0,
|
|
47884
|
+
retry: (e, t) => {
|
|
47885
|
+
if (t instanceof APIRequestError && t.status === 401)
|
|
47886
|
+
return e < 3;
|
|
47887
|
+
if (t instanceof Error && "status" in t) {
|
|
47888
|
+
const i = t.status;
|
|
47889
|
+
if (i && i >= 400 && i < 500)
|
|
47890
|
+
return !1;
|
|
47891
|
+
}
|
|
47892
|
+
return e < 3;
|
|
47893
|
+
},
|
|
47894
|
+
retryDelay: (e, t) => t instanceof APIRequestError && t.status === 401 ? Math.min(1e3 * 2 ** e, 4e3) : Math.min(1e3 * 2 ** e, 3e4)
|
|
47895
|
+
},
|
|
47896
|
+
mutations: {
|
|
47897
|
+
retry: 1,
|
|
47898
|
+
retryDelay: 1e3
|
|
47899
|
+
}
|
|
47900
|
+
}
|
|
47901
|
+
});
|
|
47902
|
+
function createOverlay(e) {
|
|
47903
|
+
let t = document.getElementById("overlay-root");
|
|
47904
|
+
t = document.createElement("div"), t.id = "overlay-root", document.body.appendChild(t), clientExports.createRoot(t).render(/* @__PURE__ */ jsxRuntimeExports.jsx(OverlayManager, { options: e }));
|
|
47905
|
+
}
|
|
47906
|
+
const OverlayManager = ({ options: e }) => {
|
|
47907
|
+
const t = useCallback(() => {
|
|
47908
|
+
var i;
|
|
47909
|
+
(i = window.Telegram.WebApp) == null || i.openTelegramLink("https://t.me/orbit_portal_bot/app?startapp=profile");
|
|
47910
|
+
}, []);
|
|
47911
|
+
return useEffect(() => {
|
|
47912
|
+
const i = (s) => {
|
|
47913
|
+
s.shiftKey && s.key === "Tab" && (s.preventDefault(), t());
|
|
47914
|
+
};
|
|
47915
|
+
return document.addEventListener("keydown", i), () => {
|
|
47916
|
+
document.removeEventListener("keydown", i);
|
|
47917
|
+
};
|
|
47918
|
+
}, [t]), /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AppRoot, { children: [
|
|
47919
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OrientationCheck, {}),
|
|
47920
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-top", className: "cssdk-banner-container cssdk-banner-top" }),
|
|
47921
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(I18nBackendLanguageProvider, { children: [
|
|
47922
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SnackbarProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfettiProvider, { children: [
|
|
47923
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47924
|
+
OverlayProfile,
|
|
47925
|
+
{
|
|
47926
|
+
variant: (e == null ? void 0 : e.variant) || "translucent",
|
|
47927
|
+
onOpenProfile: () => t(),
|
|
47928
|
+
initialPosition: e == null ? void 0 : e.initialPosition,
|
|
47929
|
+
initialCoordinates: e == null ? void 0 : e.initialCoordinates
|
|
47930
|
+
}
|
|
47931
|
+
),
|
|
47932
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TopUpModal, {}),
|
|
47933
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningModal, {}),
|
|
47934
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ProfileInventoryModal, {})
|
|
47935
|
+
] }) }) }),
|
|
47936
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EventsStack, {})
|
|
47937
|
+
] }) }),
|
|
47938
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-bottom", className: "cssdk-banner-container cssdk-banner-bottom" })
|
|
47939
|
+
] }) });
|
|
47940
|
+
};
|
|
47941
|
+
class AbortError extends Error {
|
|
47942
|
+
constructor(t = "The operation was aborted") {
|
|
47943
|
+
super(t), this.name = "AbortError";
|
|
47944
|
+
}
|
|
47945
|
+
}
|
|
47946
|
+
function delay(e, { signal: t } = {}) {
|
|
47947
|
+
return new Promise((i, s) => {
|
|
47948
|
+
const o = () => {
|
|
47949
|
+
s(new AbortError());
|
|
47950
|
+
}, a = () => {
|
|
47951
|
+
clearTimeout(l), o();
|
|
47952
|
+
};
|
|
47953
|
+
if (t != null && t.aborted)
|
|
47954
|
+
return o();
|
|
47955
|
+
const l = setTimeout(() => {
|
|
47956
|
+
t == null || t.removeEventListener("abort", a), i();
|
|
47957
|
+
}, e);
|
|
47958
|
+
t == null || t.addEventListener("abort", a, { once: !0 });
|
|
47959
|
+
});
|
|
47960
|
+
}
|
|
47961
|
+
var lib = {}, uaParser_min$1 = { exports: {} }, uaParser_min = uaParser_min$1.exports, hasRequiredUaParser_min;
|
|
47709
47962
|
function requireUaParser_min() {
|
|
47710
47963
|
return hasRequiredUaParser_min || (hasRequiredUaParser_min = 1, function(e, t) {
|
|
47711
47964
|
(function(i, s) {
|
|
@@ -50359,7 +50612,7 @@ const balance$4 = "Balance", topUp$4 = "Top Up", ads$4 = "Ads", adsOn$4 = "On",
|
|
|
50359
50612
|
topUpModal,
|
|
50360
50613
|
inventoryModal
|
|
50361
50614
|
};
|
|
50362
|
-
var define_process_env_default$2 = { NODE_ENV: "production", version: "1.
|
|
50615
|
+
var define_process_env_default$2 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" };
|
|
50363
50616
|
const resources = {
|
|
50364
50617
|
en: {
|
|
50365
50618
|
translation: en
|
|
@@ -50860,54 +51113,68 @@ let activityDetectorInstance = null;
|
|
|
50860
51113
|
function getActivityDetector(e) {
|
|
50861
51114
|
return activityDetectorInstance || (activityDetectorInstance = new ActivityDetector(e)), activityDetectorInstance;
|
|
50862
51115
|
}
|
|
50863
|
-
function getBaseAnalyticsParams() {
|
|
50864
|
-
return {
|
|
50865
|
-
game_id: window.game_id,
|
|
50866
|
-
game_title: window.game_title,
|
|
50867
|
-
game_url: window.location.origin + window.location.pathname
|
|
50868
|
-
};
|
|
50869
|
-
}
|
|
50870
51116
|
const log$4 = createAdLogger("Adsgram");
|
|
50871
51117
|
async function showAdsgramAdWithTimeout(e) {
|
|
50872
51118
|
if (!e)
|
|
50873
|
-
return log$4.error("Ad controller not available"),
|
|
51119
|
+
return log$4.error("Ad controller not available"), analytics.track("ad_show_error", {
|
|
50874
51120
|
message: "Adsgram Ad Controller not available",
|
|
50875
51121
|
error_type: "controller_unavailable",
|
|
51122
|
+
error_code: "controller_unavailable",
|
|
50876
51123
|
...getBaseAnalyticsParams(),
|
|
50877
|
-
ad_type: "adsgram"
|
|
51124
|
+
ad_type: "adsgram",
|
|
51125
|
+
provider: "adsgram"
|
|
50878
51126
|
}), !1;
|
|
50879
51127
|
const t = e;
|
|
50880
51128
|
return log$4.group("Showing Ad"), log$4.time("show"), new Promise((i) => {
|
|
50881
51129
|
const s = setTimeout(() => {
|
|
50882
|
-
log$4.timeEnd("show"), log$4.error("Ad request timed out after 5s"), log$4.groupEnd(),
|
|
51130
|
+
log$4.timeEnd("show"), log$4.error("Ad request timed out after 5s"), log$4.groupEnd(), analytics.track("ad_show_error", {
|
|
50883
51131
|
message: "Adsgram ad request timed out after 5 seconds",
|
|
50884
51132
|
error_type: "timeout",
|
|
51133
|
+
error_code: "timeout",
|
|
50885
51134
|
timeout_duration: 5e3,
|
|
50886
51135
|
...getBaseAnalyticsParams(),
|
|
50887
|
-
ad_type: "adsgram"
|
|
51136
|
+
ad_type: "adsgram",
|
|
51137
|
+
provider: "adsgram"
|
|
50888
51138
|
}), i(!1);
|
|
50889
|
-
}, 5e3);
|
|
50890
|
-
|
|
51139
|
+
}, 5e3), o = performance.now();
|
|
51140
|
+
analytics.track("ad_show_started", {
|
|
50891
51141
|
...getBaseAnalyticsParams(),
|
|
50892
|
-
ad_type: "adsgram"
|
|
50893
|
-
|
|
50894
|
-
|
|
51142
|
+
ad_type: "adsgram",
|
|
51143
|
+
provider: "adsgram"
|
|
51144
|
+
}), log$4.info("Starting ad display..."), t.show().then((a) => {
|
|
51145
|
+
clearTimeout(s), log$4.timeEnd("show"), a.done ? (log$4.info("Ad finished successfully", {
|
|
51146
|
+
state: a.state,
|
|
51147
|
+
description: a.description
|
|
51148
|
+
}), analytics.track("ad_show_success", {
|
|
50895
51149
|
...getBaseAnalyticsParams(),
|
|
50896
|
-
ad_type: "adsgram"
|
|
50897
|
-
|
|
51150
|
+
ad_type: "adsgram",
|
|
51151
|
+
provider: "adsgram",
|
|
51152
|
+
duration_ms: Math.round(performance.now() - o)
|
|
51153
|
+
}), log$4.groupEnd(), i(!0)) : (log$4.warn("Ad was not completed", {
|
|
51154
|
+
state: a.state,
|
|
51155
|
+
description: a.description
|
|
51156
|
+
}), analytics.track("ad_show_error", {
|
|
50898
51157
|
message: "Adsgram ad was not completed.",
|
|
50899
51158
|
error_type: "not_completed",
|
|
50900
|
-
|
|
51159
|
+
error_code: "not_completed",
|
|
51160
|
+
result: a,
|
|
50901
51161
|
...getBaseAnalyticsParams(),
|
|
50902
|
-
ad_type: "adsgram"
|
|
51162
|
+
ad_type: "adsgram",
|
|
51163
|
+
provider: "adsgram"
|
|
50903
51164
|
}), log$4.groupEnd(), i(!1));
|
|
50904
|
-
}).catch((
|
|
50905
|
-
clearTimeout(s), log$4.timeEnd("show"), log$4.error("Ad error", {
|
|
51165
|
+
}).catch((a) => {
|
|
51166
|
+
clearTimeout(s), log$4.timeEnd("show"), log$4.error("Ad error", {
|
|
51167
|
+
error: a == null ? void 0 : a.error,
|
|
51168
|
+
state: a == null ? void 0 : a.state,
|
|
51169
|
+
description: a == null ? void 0 : a.description
|
|
51170
|
+
}), log$4.groupEnd(), analytics.track("ad_show_error", {
|
|
50906
51171
|
message: "Adsgram ad threw an error",
|
|
50907
51172
|
error_type: "exception",
|
|
50908
|
-
|
|
51173
|
+
error_code: "exception",
|
|
51174
|
+
error: (a == null ? void 0 : a.error) || String(a),
|
|
50909
51175
|
...getBaseAnalyticsParams(),
|
|
50910
|
-
ad_type: "adsgram"
|
|
51176
|
+
ad_type: "adsgram",
|
|
51177
|
+
provider: "adsgram"
|
|
50911
51178
|
}), i(!1);
|
|
50912
51179
|
});
|
|
50913
51180
|
});
|
|
@@ -50947,40 +51214,49 @@ async function initGigapubAds(e) {
|
|
|
50947
51214
|
}
|
|
50948
51215
|
async function showGigapubAd(e, t) {
|
|
50949
51216
|
const i = crypto.randomUUID();
|
|
50950
|
-
return !window.showGiga || typeof window.showGiga != "function" ? e ? (log$3.warn("showGiga not available, using fallback", { transactionId: i }),
|
|
51217
|
+
return !window.showGiga || typeof window.showGiga != "function" ? e ? (log$3.warn("showGiga not available, using fallback", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
50951
51218
|
message: "Gigapub showGiga function not available, using fallback.",
|
|
50952
51219
|
...getBaseAnalyticsParams(),
|
|
50953
51220
|
ad_type: "gigapub",
|
|
51221
|
+
provider: "gigapub",
|
|
50954
51222
|
transaction_id: i,
|
|
50955
51223
|
placement_id: t
|
|
50956
|
-
}), await e()) : (
|
|
51224
|
+
}), await e()) : (analytics.track("ad_show_error", {
|
|
50957
51225
|
message: "Gigapub showGiga function not available",
|
|
50958
51226
|
error_type: "function_unavailable",
|
|
51227
|
+
error_code: "function_unavailable",
|
|
50959
51228
|
...getBaseAnalyticsParams(),
|
|
50960
51229
|
ad_type: "gigapub",
|
|
51230
|
+
provider: "gigapub",
|
|
50961
51231
|
transaction_id: i,
|
|
50962
51232
|
placement_id: t
|
|
50963
51233
|
}), !1) : (log$3.group("Showing Ad"), log$3.time("show"), log$3.info("Starting ad display", { transactionId: i, placementId: t }), new Promise((s) => {
|
|
50964
|
-
|
|
51234
|
+
const o = performance.now();
|
|
51235
|
+
analytics.track("ad_show_started", {
|
|
50965
51236
|
...getBaseAnalyticsParams(),
|
|
50966
51237
|
ad_type: "gigapub",
|
|
51238
|
+
provider: "gigapub",
|
|
50967
51239
|
transaction_id: i,
|
|
50968
51240
|
placement_id: t
|
|
50969
51241
|
}), window.showGiga({ transactionId: i, showTag: t }).then(() => {
|
|
50970
|
-
log$3.timeEnd("show"), log$3.info("Ad finished successfully", { transactionId: i, placementId: t }), log$3.groupEnd(),
|
|
51242
|
+
log$3.timeEnd("show"), log$3.info("Ad finished successfully", { transactionId: i, placementId: t }), log$3.groupEnd(), analytics.track("ad_show_success", {
|
|
50971
51243
|
...getBaseAnalyticsParams(),
|
|
50972
51244
|
ad_type: "gigapub",
|
|
51245
|
+
provider: "gigapub",
|
|
50973
51246
|
transaction_id: i,
|
|
50974
|
-
placement_id: t
|
|
51247
|
+
placement_id: t,
|
|
51248
|
+
duration_ms: Math.round(performance.now() - o)
|
|
50975
51249
|
}), s(!0);
|
|
50976
|
-
}).catch((
|
|
50977
|
-
log$3.timeEnd("show"), log$3.error("Ad error", { error:
|
|
51250
|
+
}).catch((a) => {
|
|
51251
|
+
log$3.timeEnd("show"), log$3.error("Ad error", { error: a, transactionId: i, placementId: t }), log$3.groupEnd(), analytics.track("ad_show_error", {
|
|
50978
51252
|
message: "Gigapub ad failed or was skipped",
|
|
50979
51253
|
error_type: "exception",
|
|
50980
|
-
|
|
50981
|
-
|
|
51254
|
+
error_code: "exception",
|
|
51255
|
+
error: a == null ? void 0 : a.toString(),
|
|
51256
|
+
error_message: (a == null ? void 0 : a.message) || "Unknown error",
|
|
50982
51257
|
...getBaseAnalyticsParams(),
|
|
50983
51258
|
ad_type: "gigapub",
|
|
51259
|
+
provider: "gigapub",
|
|
50984
51260
|
transaction_id: i,
|
|
50985
51261
|
placement_id: t
|
|
50986
51262
|
}), s(!1);
|
|
@@ -51037,48 +51313,58 @@ function createMonetagFallbackFunction(e, t) {
|
|
|
51037
51313
|
}
|
|
51038
51314
|
async function showMonetagAd(e, t, i) {
|
|
51039
51315
|
if (log$2.group("Showing Ad"), log$2.time("show"), log$2.info("Starting ad display", { fnName: e, ymid: t, placementId: i }), !e)
|
|
51040
|
-
return log$2.error("Ad function name not found"), log$2.timeEnd("show"), log$2.groupEnd(),
|
|
51316
|
+
return log$2.error("Ad function name not found"), log$2.timeEnd("show"), log$2.groupEnd(), analytics.track("ad_show_error", {
|
|
51041
51317
|
message: "Monetag ad function name not found",
|
|
51042
51318
|
error_type: "function_name_missing",
|
|
51319
|
+
error_code: "function_name_missing",
|
|
51043
51320
|
...getBaseAnalyticsParams(),
|
|
51044
51321
|
ad_type: "monetag",
|
|
51322
|
+
provider: "monetag",
|
|
51045
51323
|
placement_id: i
|
|
51046
51324
|
}), !1;
|
|
51047
51325
|
const s = window[e];
|
|
51048
51326
|
if (typeof s != "function")
|
|
51049
|
-
return log$2.error("Ad function not found on window", { fnName: e }), log$2.timeEnd("show"), log$2.groupEnd(),
|
|
51327
|
+
return log$2.error("Ad function not found on window", { fnName: e }), log$2.timeEnd("show"), log$2.groupEnd(), analytics.track("ad_show_error", {
|
|
51050
51328
|
message: "Monetag ad function not found on window object",
|
|
51051
51329
|
error_type: "function_unavailable",
|
|
51330
|
+
error_code: "function_unavailable",
|
|
51052
51331
|
function_name: e,
|
|
51053
51332
|
...getBaseAnalyticsParams(),
|
|
51054
51333
|
ad_type: "monetag",
|
|
51334
|
+
provider: "monetag",
|
|
51055
51335
|
placement_id: i
|
|
51056
51336
|
}), !1;
|
|
51057
51337
|
const o = i ? `orbit-${i}` : "orbit";
|
|
51058
51338
|
return new Promise((a) => {
|
|
51059
|
-
|
|
51339
|
+
const l = performance.now();
|
|
51340
|
+
analytics.track("ad_show_started", {
|
|
51060
51341
|
...getBaseAnalyticsParams(),
|
|
51061
51342
|
ad_type: "monetag",
|
|
51343
|
+
provider: "monetag",
|
|
51062
51344
|
placement_id: i
|
|
51063
51345
|
}), s({ ymid: t, requestVar: o, timeout: 5 }).then(() => {
|
|
51064
|
-
log$2.timeEnd("show"), log$2.info("Ad watched successfully", { placementId: i }), log$2.groupEnd(),
|
|
51346
|
+
log$2.timeEnd("show"), log$2.info("Ad watched successfully", { placementId: i }), log$2.groupEnd(), analytics.track("ad_show_success", {
|
|
51065
51347
|
...getBaseAnalyticsParams(),
|
|
51066
51348
|
ad_type: "monetag",
|
|
51067
|
-
|
|
51349
|
+
provider: "monetag",
|
|
51350
|
+
placement_id: i,
|
|
51351
|
+
duration_ms: Math.round(performance.now() - l)
|
|
51068
51352
|
}), a(!0);
|
|
51069
|
-
}).catch((
|
|
51070
|
-
log$2.timeEnd("show"), log$2.error("Ad failed or was skipped", { error:
|
|
51353
|
+
}).catch((c) => {
|
|
51354
|
+
log$2.timeEnd("show"), log$2.error("Ad failed or was skipped", { error: c, placementId: i }), log$2.groupEnd(), analytics.track("ad_show_error", {
|
|
51071
51355
|
message: "Monetag ad failed or was skipped",
|
|
51072
51356
|
error_type: "ad_failed",
|
|
51073
|
-
|
|
51357
|
+
error_code: "ad_failed",
|
|
51358
|
+
error: String(c),
|
|
51074
51359
|
...getBaseAnalyticsParams(),
|
|
51075
51360
|
ad_type: "monetag",
|
|
51361
|
+
provider: "monetag",
|
|
51076
51362
|
placement_id: i
|
|
51077
51363
|
}), a(!1);
|
|
51078
51364
|
});
|
|
51079
51365
|
});
|
|
51080
51366
|
}
|
|
51081
|
-
var define_process_env_default$1 = { NODE_ENV: "production", version: "1.
|
|
51367
|
+
var define_process_env_default$1 = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" };
|
|
51082
51368
|
const log$1 = createAdLogger("Orbit");
|
|
51083
51369
|
async function initOrbitAds() {
|
|
51084
51370
|
log$1.group("Initialization"), log$1.time("init"), log$1.info("Loading script...");
|
|
@@ -51105,59 +51391,70 @@ async function initOrbitAds() {
|
|
|
51105
51391
|
async function showOrbitAd(e, t) {
|
|
51106
51392
|
const i = crypto.randomUUID();
|
|
51107
51393
|
if (!window.showOrbitAds || typeof window.showOrbitAds != "function")
|
|
51108
|
-
return e ? (log$1.warn("showOrbitAds not available, using fallback", { transactionId: i }),
|
|
51394
|
+
return e ? (log$1.warn("showOrbitAds not available, using fallback", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51109
51395
|
message: "Orbit showOrbitAds function not available, using fallback.",
|
|
51110
51396
|
...getBaseAnalyticsParams(),
|
|
51111
51397
|
ad_type: "orbit",
|
|
51398
|
+
provider: "orbit",
|
|
51112
51399
|
transaction_id: i
|
|
51113
|
-
}), await e()) : (
|
|
51400
|
+
}), await e()) : (analytics.track("ad_show_error", {
|
|
51114
51401
|
message: "Orbit showOrbitAds function not available",
|
|
51115
51402
|
error_type: "function_unavailable",
|
|
51403
|
+
error_code: "function_unavailable",
|
|
51116
51404
|
...getBaseAnalyticsParams(),
|
|
51117
51405
|
ad_type: "orbit",
|
|
51406
|
+
provider: "orbit",
|
|
51118
51407
|
transaction_id: i
|
|
51119
51408
|
}), !1);
|
|
51120
|
-
|
|
51409
|
+
const s = performance.now();
|
|
51410
|
+
analytics.track("ad_show_started", {
|
|
51121
51411
|
...getBaseAnalyticsParams(),
|
|
51122
51412
|
ad_type: "orbit",
|
|
51413
|
+
provider: "orbit",
|
|
51123
51414
|
transaction_id: i
|
|
51124
51415
|
}), log$1.group("Showing Ad"), log$1.time("show"), log$1.info("Starting ad display", { transactionId: i, ...t });
|
|
51125
51416
|
try {
|
|
51126
|
-
const
|
|
51127
|
-
if (log$1.timeEnd("show"), log$1.info("showOrbitAds resolved", { response:
|
|
51128
|
-
return
|
|
51417
|
+
const o = await window.showOrbitAds(t);
|
|
51418
|
+
if (log$1.timeEnd("show"), log$1.info("showOrbitAds resolved", { response: o, transactionId: i }), o.is_direct_sales)
|
|
51419
|
+
return analytics.track("ad_show_success", {
|
|
51129
51420
|
...getBaseAnalyticsParams(),
|
|
51130
51421
|
ad_type: "orbit",
|
|
51131
|
-
|
|
51422
|
+
provider: "orbit",
|
|
51423
|
+
transaction_id: i,
|
|
51424
|
+
duration_ms: Math.round(performance.now() - s)
|
|
51132
51425
|
}), log$1.info("Ad shown successfully (internal ad)"), log$1.groupEnd(), !0;
|
|
51133
|
-
if (log$1.warn("is_direct_sales=false, falling back to provider", { transactionId: i }),
|
|
51426
|
+
if (log$1.warn("is_direct_sales=false, falling back to provider", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51134
51427
|
message: "Orbit has no ad available, falling back to provider network.",
|
|
51135
51428
|
...getBaseAnalyticsParams(),
|
|
51136
51429
|
ad_type: "orbit",
|
|
51430
|
+
provider: "orbit",
|
|
51137
51431
|
transaction_id: i
|
|
51138
51432
|
}), e) {
|
|
51139
|
-
const
|
|
51140
|
-
return log$1.info("Fallback result", { result:
|
|
51433
|
+
const a = await e();
|
|
51434
|
+
return log$1.info("Fallback result", { result: a, transactionId: i }), log$1.groupEnd(), a;
|
|
51141
51435
|
}
|
|
51142
51436
|
return log$1.groupEnd(), !1;
|
|
51143
|
-
} catch (
|
|
51144
|
-
if (log$1.timeEnd("show"), log$1.error("Ad error", { error:
|
|
51437
|
+
} catch (o) {
|
|
51438
|
+
if (log$1.timeEnd("show"), log$1.error("Ad error", { error: o, transactionId: i }), analytics.track("ad_show_error", {
|
|
51145
51439
|
message: "Orbit ad failed or was skipped",
|
|
51146
51440
|
error_type: "exception",
|
|
51147
|
-
|
|
51148
|
-
|
|
51441
|
+
error_code: "exception",
|
|
51442
|
+
error: o instanceof Error ? o.toString() : String(o),
|
|
51443
|
+
error_message: o instanceof Error ? o.message : "Unknown error",
|
|
51149
51444
|
...getBaseAnalyticsParams(),
|
|
51150
51445
|
ad_type: "orbit",
|
|
51446
|
+
provider: "orbit",
|
|
51151
51447
|
transaction_id: i
|
|
51152
51448
|
}), e) {
|
|
51153
|
-
log$1.warn("Error occurred, using fallback provider", { transactionId: i }),
|
|
51449
|
+
log$1.warn("Error occurred, using fallback provider", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51154
51450
|
message: "Orbit ad errored, falling back to provider network.",
|
|
51155
51451
|
...getBaseAnalyticsParams(),
|
|
51156
51452
|
ad_type: "orbit",
|
|
51453
|
+
provider: "orbit",
|
|
51157
51454
|
transaction_id: i
|
|
51158
51455
|
});
|
|
51159
|
-
const
|
|
51160
|
-
return log$1.info("Fallback result after error", { result:
|
|
51456
|
+
const a = await e();
|
|
51457
|
+
return log$1.info("Fallback result after error", { result: a, transactionId: i }), log$1.groupEnd(), a;
|
|
51161
51458
|
}
|
|
51162
51459
|
return log$1.groupEnd(), !1;
|
|
51163
51460
|
}
|
|
@@ -51168,65 +51465,78 @@ async function checkAdStatus(e) {
|
|
|
51168
51465
|
log.info("Checking ad status", { adId: e });
|
|
51169
51466
|
const t = await fetch(`https://sp.tmanetwork.tech/bid_info?id=${e}`);
|
|
51170
51467
|
if (t.status === 204)
|
|
51171
|
-
return log.info("Ad status: NOT_SHOWED (204)", { adId: e }),
|
|
51468
|
+
return log.info("Ad status: NOT_SHOWED (204)", { adId: e }), analytics.track("ad_status_not_showed", {
|
|
51172
51469
|
...getBaseAnalyticsParams(),
|
|
51173
51470
|
ad_id: e,
|
|
51174
|
-
ad_type: "tma"
|
|
51471
|
+
ad_type: "tma",
|
|
51472
|
+
provider: "tma"
|
|
51175
51473
|
}), "NOT_SHOWED";
|
|
51176
51474
|
if (!t.ok)
|
|
51177
51475
|
throw new Error(`Failed to check ad status: ${t.status}`);
|
|
51178
51476
|
const i = await t.json();
|
|
51179
|
-
return i.click_created ? (log.info("Ad status: CLICKED", { adId: e }),
|
|
51477
|
+
return i.click_created ? (log.info("Ad status: CLICKED", { adId: e }), analytics.track("ad_status_clicked", {
|
|
51180
51478
|
...getBaseAnalyticsParams(),
|
|
51181
51479
|
ad_id: e,
|
|
51182
|
-
ad_type: "tma"
|
|
51183
|
-
|
|
51480
|
+
ad_type: "tma",
|
|
51481
|
+
provider: "tma"
|
|
51482
|
+
}), "CLICKED") : i.imp_created ? (log.info("Ad status: SHOWED", { adId: e }), analytics.track("ad_status_showed", {
|
|
51184
51483
|
...getBaseAnalyticsParams(),
|
|
51185
51484
|
ad_id: e,
|
|
51186
|
-
ad_type: "tma"
|
|
51187
|
-
|
|
51485
|
+
ad_type: "tma",
|
|
51486
|
+
provider: "tma"
|
|
51487
|
+
}), "SHOWED") : (log.info("Ad status: NOT_SHOWED (no imp/click)", { adId: e }), analytics.track("ad_status_not_showed", {
|
|
51188
51488
|
...getBaseAnalyticsParams(),
|
|
51189
51489
|
ad_id: e,
|
|
51190
|
-
ad_type: "tma"
|
|
51490
|
+
ad_type: "tma",
|
|
51491
|
+
provider: "tma"
|
|
51191
51492
|
}), "NOT_SHOWED");
|
|
51192
51493
|
} catch (t) {
|
|
51193
|
-
throw log.error("Error checking ad status", { adId: e, error: t }),
|
|
51494
|
+
throw log.error("Error checking ad status", { adId: e, error: t }), analytics.track("ad_status_error", {
|
|
51194
51495
|
...getBaseAnalyticsParams(),
|
|
51195
51496
|
ad_id: e,
|
|
51196
|
-
ad_type: "tma"
|
|
51497
|
+
ad_type: "tma",
|
|
51498
|
+
provider: "tma"
|
|
51197
51499
|
}), t;
|
|
51198
51500
|
}
|
|
51199
51501
|
}
|
|
51200
51502
|
async function showAd(e = {}) {
|
|
51201
51503
|
if (!window.TMANetwork) {
|
|
51202
51504
|
const t = new Error("TMANetwork is not available");
|
|
51203
|
-
throw log.error("TMANetwork not available on window"),
|
|
51505
|
+
throw log.error("TMANetwork not available on window"), analytics.track("ad_show_error", {
|
|
51204
51506
|
message: "TMANetwork is not available",
|
|
51205
51507
|
error_type: "sdk_unavailable",
|
|
51508
|
+
error_code: "sdk_unavailable",
|
|
51206
51509
|
...getBaseAnalyticsParams(),
|
|
51207
|
-
ad_type: "tma"
|
|
51510
|
+
ad_type: "tma",
|
|
51511
|
+
provider: "tma"
|
|
51208
51512
|
}), t;
|
|
51209
51513
|
}
|
|
51210
51514
|
if (window.TMANetwork.hasInterstitialAd()) {
|
|
51211
51515
|
log.info("Ad already loaded, showing immediately"), e.onStart && e.onStart();
|
|
51212
51516
|
try {
|
|
51213
|
-
|
|
51517
|
+
const t = performance.now();
|
|
51518
|
+
analytics.track("ad_show_started", {
|
|
51214
51519
|
...getBaseAnalyticsParams(),
|
|
51215
|
-
ad_type: "tma"
|
|
51520
|
+
ad_type: "tma",
|
|
51521
|
+
provider: "tma"
|
|
51216
51522
|
});
|
|
51217
|
-
const
|
|
51218
|
-
return log.info("Ad shown successfully", { adId:
|
|
51523
|
+
const i = await window.TMANetwork.showInterstitialAd();
|
|
51524
|
+
return log.info("Ad shown successfully", { adId: i.id }), analytics.track("ad_show_success", {
|
|
51219
51525
|
...getBaseAnalyticsParams(),
|
|
51220
51526
|
ad_type: "tma",
|
|
51221
|
-
|
|
51222
|
-
|
|
51527
|
+
provider: "tma",
|
|
51528
|
+
ad_id: i.id,
|
|
51529
|
+
duration_ms: Math.round(performance.now() - t)
|
|
51530
|
+
}), window.TMANetwork.reloadAd(), i;
|
|
51223
51531
|
} catch (t) {
|
|
51224
|
-
throw log.error("Error showing preloaded ad", t),
|
|
51532
|
+
throw log.error("Error showing preloaded ad", t), analytics.track("ad_show_error", {
|
|
51225
51533
|
message: t instanceof Error ? t.message : "Unknown error showing TMA ad",
|
|
51226
51534
|
error_type: "exception",
|
|
51535
|
+
error_code: "exception",
|
|
51227
51536
|
error: t instanceof Error ? t.toString() : String(t),
|
|
51228
51537
|
...getBaseAnalyticsParams(),
|
|
51229
|
-
ad_type: "tma"
|
|
51538
|
+
ad_type: "tma",
|
|
51539
|
+
provider: "tma"
|
|
51230
51540
|
}), t;
|
|
51231
51541
|
}
|
|
51232
51542
|
}
|
|
@@ -51236,26 +51546,31 @@ async function showAd(e = {}) {
|
|
|
51236
51546
|
if (!s) {
|
|
51237
51547
|
s = !0;
|
|
51238
51548
|
try {
|
|
51239
|
-
log.info("onAdLoaded event received"),
|
|
51549
|
+
log.info("onAdLoaded event received"), analytics.track("ad_load_event_received", {
|
|
51240
51550
|
...getBaseAnalyticsParams(),
|
|
51241
|
-
ad_type: "tma"
|
|
51242
|
-
|
|
51551
|
+
ad_type: "tma",
|
|
51552
|
+
provider: "tma"
|
|
51553
|
+
}), e.onStart && e.onStart(), analytics.track("ad_show_started", {
|
|
51243
51554
|
...getBaseAnalyticsParams(),
|
|
51244
|
-
ad_type: "tma"
|
|
51555
|
+
ad_type: "tma",
|
|
51556
|
+
provider: "tma"
|
|
51245
51557
|
});
|
|
51246
51558
|
const a = await window.TMANetwork.showInterstitialAd();
|
|
51247
|
-
log.info("Ad shown successfully after load", { adId: a.id }),
|
|
51559
|
+
log.info("Ad shown successfully after load", { adId: a.id }), analytics.track("ad_load_success", {
|
|
51248
51560
|
...getBaseAnalyticsParams(),
|
|
51249
51561
|
ad_type: "tma",
|
|
51562
|
+
provider: "tma",
|
|
51250
51563
|
ad_id: a.id
|
|
51251
51564
|
}), window.TMANetwork.reloadAd(), t(a);
|
|
51252
51565
|
} catch (a) {
|
|
51253
|
-
log.error("Error showing ad after load event", a),
|
|
51566
|
+
log.error("Error showing ad after load event", a), analytics.track("ad_load_error", {
|
|
51254
51567
|
message: a instanceof Error ? a.message : "Unknown error loading TMA ad",
|
|
51255
51568
|
error_type: "load_exception",
|
|
51569
|
+
error_code: "load_exception",
|
|
51256
51570
|
error: a instanceof Error ? a.toString() : String(a),
|
|
51257
51571
|
...getBaseAnalyticsParams(),
|
|
51258
|
-
ad_type: "tma"
|
|
51572
|
+
ad_type: "tma",
|
|
51573
|
+
provider: "tma"
|
|
51259
51574
|
}), i(a);
|
|
51260
51575
|
}
|
|
51261
51576
|
}
|
|
@@ -51264,12 +51579,14 @@ async function showAd(e = {}) {
|
|
|
51264
51579
|
if (!s) {
|
|
51265
51580
|
s = !0;
|
|
51266
51581
|
const a = new Error("Ad load timeout");
|
|
51267
|
-
log.error("Ad load timeout after 10s"),
|
|
51582
|
+
log.error("Ad load timeout after 10s"), analytics.track("ad_load_timeout", {
|
|
51268
51583
|
message: "Ad load timeout after 10 seconds",
|
|
51269
51584
|
error_type: "timeout",
|
|
51585
|
+
error_code: "timeout",
|
|
51270
51586
|
timeout_duration: 1e4,
|
|
51271
51587
|
...getBaseAnalyticsParams(),
|
|
51272
|
-
ad_type: "tma"
|
|
51588
|
+
ad_type: "tma",
|
|
51589
|
+
provider: "tma"
|
|
51273
51590
|
}), i(a);
|
|
51274
51591
|
}
|
|
51275
51592
|
}, 1e4), window.TMANetwork.addEventListener("onAdLoaded", o);
|
|
@@ -51277,17 +51594,18 @@ async function showAd(e = {}) {
|
|
|
51277
51594
|
}
|
|
51278
51595
|
function loadTMANetworkScript() {
|
|
51279
51596
|
return new Promise((e, t) => {
|
|
51280
|
-
if (log.group("Script Load"), log.time("scriptLoad"),
|
|
51597
|
+
if (log.group("Script Load"), log.time("scriptLoad"), analytics.track("tma_script_load_requested", getBaseAnalyticsParams()), document.querySelector('script[src="https://files.tmanetwork.tech/tmanetwork.min.js"]')) {
|
|
51281
51598
|
log.info("Script already loaded (skipping)"), log.timeEnd("scriptLoad"), log.groupEnd(), e();
|
|
51282
51599
|
return;
|
|
51283
51600
|
}
|
|
51284
51601
|
const i = document.createElement("script");
|
|
51285
51602
|
i.src = "https://files.tmanetwork.tech/tmanetwork.min.js", i.async = !0, i.onload = () => {
|
|
51286
|
-
log.timeEnd("scriptLoad"), log.info("Script loaded successfully"), log.groupEnd(),
|
|
51603
|
+
log.timeEnd("scriptLoad"), log.info("Script loaded successfully"), log.groupEnd(), analytics.track("tma_script_load_success", getBaseAnalyticsParams()), e();
|
|
51287
51604
|
}, i.onerror = (s) => {
|
|
51288
|
-
log.timeEnd("scriptLoad"), log.error("Failed to load script", s), log.groupEnd(),
|
|
51605
|
+
log.timeEnd("scriptLoad"), log.error("Failed to load script", s), log.groupEnd(), analytics.track("tma_script_load_error", {
|
|
51289
51606
|
message: "Failed to load TMANetwork script",
|
|
51290
51607
|
error_type: "script_load_failed",
|
|
51608
|
+
error_code: "script_load_failed",
|
|
51291
51609
|
error: String(s),
|
|
51292
51610
|
...getBaseAnalyticsParams()
|
|
51293
51611
|
}), captureException(s), t(new Error("Failed to load TMANetwork script"));
|
|
@@ -51430,10 +51748,12 @@ function createIframeSdk() {
|
|
|
51430
51748
|
}
|
|
51431
51749
|
});
|
|
51432
51750
|
}
|
|
51433
|
-
var define_process_env_default = { NODE_ENV: "production", version: "1.
|
|
51751
|
+
var define_process_env_default = { NODE_ENV: "production", version: "1.93.1", BASE_URL: "https://app.portalapp.games/sdk", ADS_SCRIPT_URL: "https://ads-sdk.portalapp.games/script.js", ASSETS_BASE_URL: "https://sdk.portalapp.games/assets" }, qr, Kr;
|
|
51434
51752
|
const _isThirdPartyIframe = window.parent !== window && !((Kr = (qr = window.Telegram) == null ? void 0 : qr.WebApp) != null && Kr.initData);
|
|
51435
51753
|
_isThirdPartyIframe || (ensureViewportMetaTag(), initSentry());
|
|
51436
|
-
const adLog = createAdLogger("SDK")
|
|
51754
|
+
const adLog = createAdLogger("SDK");
|
|
51755
|
+
let gameInitializedAt = null;
|
|
51756
|
+
const CloudStorageGetItem = (e) => new Promise((t, i) => {
|
|
51437
51757
|
getTelegramWebApp().CloudStorage.getItem(e, (s, o) => {
|
|
51438
51758
|
s ? i(new Error(s)) : t(o ?? null);
|
|
51439
51759
|
});
|
|
@@ -51618,11 +51938,7 @@ function startGameTimeTrack() {
|
|
|
51618
51938
|
var Yr, Xr, Jr, Qr;
|
|
51619
51939
|
try {
|
|
51620
51940
|
const e = (Qr = (Jr = (Xr = (Yr = window.Telegram) == null ? void 0 : Yr.WebApp) == null ? void 0 : Xr.initDataUnsafe) == null ? void 0 : Jr.user) == null ? void 0 : Qr.id;
|
|
51621
|
-
|
|
51622
|
-
debug: !0,
|
|
51623
|
-
track_pageview: !0,
|
|
51624
|
-
persistence: "localStorage"
|
|
51625
|
-
}), e && mixpanel.identify(String(e)), mixpanel.track("sdk_initialized", getBaseAnalyticsParams());
|
|
51941
|
+
e && analytics.identify(e), analytics.track("sdk_initialized", getBaseAnalyticsParams());
|
|
51626
51942
|
} catch (e) {
|
|
51627
51943
|
console.error(e);
|
|
51628
51944
|
}
|
|
@@ -51699,7 +52015,7 @@ const CryptoSteamSDK = {
|
|
|
51699
52015
|
adLog.error("Monetag fallback: failed to initialize", f);
|
|
51700
52016
|
}
|
|
51701
52017
|
}
|
|
51702
|
-
adLog.timeEnd("fullInit"), adLog.info("Ads network fully initialized", { provider: adType, orbitInitialized }), adLog.groupEnd(), (s = a == null ? void 0 : a.audiences) != null && s[0] &&
|
|
52018
|
+
adLog.timeEnd("fullInit"), adLog.info("Ads network fully initialized", { provider: adType, orbitInitialized }), adLog.groupEnd(), (s = a == null ? void 0 : a.audiences) != null && s[0] && analytics.track("$experiment_started", {
|
|
51703
52019
|
"Experiment name": "start_page_ab",
|
|
51704
52020
|
"Variant name": (o = a == null ? void 0 : a.audiences) == null ? void 0 : o[0]
|
|
51705
52021
|
});
|
|
@@ -51716,14 +52032,14 @@ const CryptoSteamSDK = {
|
|
|
51716
52032
|
console.error("Config not found");
|
|
51717
52033
|
return;
|
|
51718
52034
|
}
|
|
51719
|
-
|
|
52035
|
+
analytics.identify(String(a.id)), window.game_id = a.game_id, window.game_title = l.title, ReactGA.initialize(G_MEASUREMENT_ID, {
|
|
51720
52036
|
gaOptions: {
|
|
51721
52037
|
userId: a.id,
|
|
51722
52038
|
gameId: a.game_id
|
|
51723
52039
|
}
|
|
51724
52040
|
}), ReactGA.event("init", {
|
|
51725
52041
|
gameId: a.game_id
|
|
51726
|
-
}),
|
|
52042
|
+
}), gameInitializedAt = performance.now(), analytics.track("game_initialized", {
|
|
51727
52043
|
game_id: a.game_id,
|
|
51728
52044
|
game_title: l.title
|
|
51729
52045
|
}), !isPortal && !(t != null && t.disable_startup_ads) && CryptoSteamSDK.requestAd().catch((c) => {
|
|
@@ -51762,9 +52078,10 @@ const CryptoSteamSDK = {
|
|
|
51762
52078
|
}), (i = CryptoSteamSDK.onAdEnd) == null || i.call(CryptoSteamSDK, !1), adLog.timeEnd("requestAd"), adLog.groupEnd(), !1;
|
|
51763
52079
|
if (l.ads_free && !isPortal)
|
|
51764
52080
|
return adLog.warn("Skipped: profile has ads_free flag"), (s = CryptoSteamSDK.onAdEnd) == null || s.call(CryptoSteamSDK, !1), adLog.timeEnd("requestAd"), adLog.groupEnd(), !1;
|
|
51765
|
-
|
|
52081
|
+
analytics.track("ad_show_requested", {
|
|
51766
52082
|
...getBaseAnalyticsParams(),
|
|
51767
52083
|
ad_type: orbitInitialized ? "orbit" : adType,
|
|
52084
|
+
provider: orbitInitialized ? "orbit" : adType,
|
|
51768
52085
|
placement_id: e.placementId
|
|
51769
52086
|
});
|
|
51770
52087
|
const f = async () => {
|
|
@@ -51787,11 +52104,13 @@ const CryptoSteamSDK = {
|
|
|
51787
52104
|
);
|
|
51788
52105
|
return await showGigapubAd(h, e.placementId);
|
|
51789
52106
|
}
|
|
51790
|
-
return adLog.error("Ad network not initialized or not supported", { adType }),
|
|
52107
|
+
return adLog.error("Ad network not initialized or not supported", { adType }), analytics.track("ad_show_error", {
|
|
51791
52108
|
...getBaseAnalyticsParams(),
|
|
51792
52109
|
message: "Ad network not initialized or not supported",
|
|
51793
52110
|
ad_type: adType,
|
|
52111
|
+
provider: adType,
|
|
51794
52112
|
error_type: "unsupported_network",
|
|
52113
|
+
error_code: "unsupported_network",
|
|
51795
52114
|
placement_id: e.placementId
|
|
51796
52115
|
}), !1;
|
|
51797
52116
|
};
|
|
@@ -51811,11 +52130,13 @@ const CryptoSteamSDK = {
|
|
|
51811
52130
|
d = await f();
|
|
51812
52131
|
return adLog.timeEnd("requestAd"), adLog.info("Ad request completed", { result: d }), adLog.groupEnd(), (o = CryptoSteamSDK.onAdEnd) == null || o.call(CryptoSteamSDK, d), d;
|
|
51813
52132
|
} catch (l) {
|
|
51814
|
-
return adLog.timeEnd("requestAd"), adLog.error("Error in requestAd", l), adLog.groupEnd(),
|
|
52133
|
+
return adLog.timeEnd("requestAd"), adLog.error("Error in requestAd", l), adLog.groupEnd(), analytics.track("ad_show_error", {
|
|
51815
52134
|
...getBaseAnalyticsParams(),
|
|
51816
52135
|
message: l instanceof Error ? l.message : "Unknown error in requestAd",
|
|
51817
52136
|
error_type: "sdk_exception",
|
|
52137
|
+
error_code: "sdk_exception",
|
|
51818
52138
|
ad_type: adType,
|
|
52139
|
+
provider: adType,
|
|
51819
52140
|
error: l instanceof Error ? l.toString() : String(l),
|
|
51820
52141
|
placement_id: e.placementId
|
|
51821
52142
|
}), (a = CryptoSteamSDK.onAdEnd) == null || a.call(CryptoSteamSDK, !1), !1;
|
|
@@ -51825,9 +52146,10 @@ const CryptoSteamSDK = {
|
|
|
51825
52146
|
var t, i, s;
|
|
51826
52147
|
adLog.group("requestRewardAd"), adLog.time("requestRewardAd"), (t = CryptoSteamSDK.onAdStart) == null || t.call(CryptoSteamSDK);
|
|
51827
52148
|
try {
|
|
51828
|
-
|
|
52149
|
+
analytics.track("ad_show_requested", {
|
|
51829
52150
|
...getBaseAnalyticsParams(),
|
|
51830
52151
|
ad_type: orbitInitialized ? "orbit" : adType,
|
|
52152
|
+
provider: orbitInitialized ? "orbit" : adType,
|
|
51831
52153
|
placement_id: e.placementId
|
|
51832
52154
|
});
|
|
51833
52155
|
const o = async () => {
|
|
@@ -51853,11 +52175,13 @@ const CryptoSteamSDK = {
|
|
|
51853
52175
|
), c = await showGigapubAd(l, e.placementId);
|
|
51854
52176
|
return await delay(2e3), c;
|
|
51855
52177
|
}
|
|
51856
|
-
return adLog.error("Ad network not initialized or not supported", { adType }),
|
|
52178
|
+
return adLog.error("Ad network not initialized or not supported", { adType }), analytics.track("ad_show_error", {
|
|
51857
52179
|
...getBaseAnalyticsParams(),
|
|
51858
52180
|
message: "Ad network not initialized or not supported",
|
|
51859
52181
|
ad_type: adType,
|
|
52182
|
+
provider: adType,
|
|
51860
52183
|
error_type: "unsupported_network",
|
|
52184
|
+
error_code: "unsupported_network",
|
|
51861
52185
|
placement_id: e.placementId
|
|
51862
52186
|
}), !1;
|
|
51863
52187
|
};
|
|
@@ -51876,11 +52200,13 @@ const CryptoSteamSDK = {
|
|
|
51876
52200
|
a = await o();
|
|
51877
52201
|
return adLog.timeEnd("requestRewardAd"), adLog.info("Reward ad request completed", { result: a }), adLog.groupEnd(), (i = CryptoSteamSDK.onAdEnd) == null || i.call(CryptoSteamSDK, a), a;
|
|
51878
52202
|
} catch (o) {
|
|
51879
|
-
return adLog.timeEnd("requestRewardAd"), adLog.error("Error in requestRewardAd", o), adLog.groupEnd(),
|
|
52203
|
+
return adLog.timeEnd("requestRewardAd"), adLog.error("Error in requestRewardAd", o), adLog.groupEnd(), analytics.track("ad_show_error", {
|
|
51880
52204
|
...getBaseAnalyticsParams(),
|
|
51881
52205
|
message: o instanceof Error ? o.message : "Unknown error in requestRewardAd",
|
|
51882
52206
|
error_type: "sdk_exception",
|
|
52207
|
+
error_code: "sdk_exception",
|
|
51883
52208
|
ad_type: adType,
|
|
52209
|
+
provider: adType,
|
|
51884
52210
|
error: o instanceof Error ? o.toString() : String(o),
|
|
51885
52211
|
placement_id: e.placementId
|
|
51886
52212
|
}), (s = CryptoSteamSDK.onAdEnd) == null || s.call(CryptoSteamSDK, !1), !1;
|
|
@@ -52014,9 +52340,10 @@ const CryptoSteamSDK = {
|
|
|
52014
52340
|
console.error("Config not found");
|
|
52015
52341
|
return;
|
|
52016
52342
|
}
|
|
52017
|
-
|
|
52343
|
+
analytics.track("game_ready", {
|
|
52018
52344
|
game_id: e.game_id,
|
|
52019
|
-
game_title: t.title
|
|
52345
|
+
game_title: t.title,
|
|
52346
|
+
time_to_load_ms: gameInitializedAt !== null ? Math.round(performance.now() - gameInitializedAt) : void 0
|
|
52020
52347
|
}), ReactGA.event("game_loaded", {
|
|
52021
52348
|
gameId: e.game_id
|
|
52022
52349
|
});
|