@orbit-software/sdk 1.92.6 → 1.93.2
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/constants.d.ts +1 -0
- package/dist/esm/sdk.d.ts +0 -1
- package/dist/esm/sdk.mjs +581 -253
- 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.2";
|
|
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$7 = { NODE_ENV: "production", version: "1.93.2", 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$7.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$6 = { NODE_ENV: "production", version: "1.93.2", 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$6.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$5 = { NODE_ENV: "production", version: "1.93.2", 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$5.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$5.LANG && define_process_env_default$5.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$5.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$5.LANG && define_process_env_default$5.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,188 @@ 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$4 = { NODE_ENV: "production", version: "1.93.2", 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 BASE_URL = define_process_env_default$4.BASE_URL;
|
|
47784
|
+
var define_process_env_default$3 = { NODE_ENV: "production", version: "1.93.2", 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" };
|
|
47785
|
+
const MIXPANEL_TOKEN = "b0d7c97039e244366388b9a210c0b15a", ANALYTICS_ENDPOINT = `${BASE_URL}/analytics/events`;
|
|
47786
|
+
function getBaseAnalyticsParams() {
|
|
47787
|
+
return {
|
|
47788
|
+
game_id: window.game_id,
|
|
47789
|
+
game_title: window.game_title,
|
|
47790
|
+
game_url: window.location.origin + window.location.pathname
|
|
47791
|
+
};
|
|
47792
|
+
}
|
|
47793
|
+
mixpanel.init(MIXPANEL_TOKEN, {
|
|
47794
|
+
debug: !0,
|
|
47795
|
+
track_pageview: !0,
|
|
47796
|
+
persistence: "localStorage"
|
|
47797
|
+
});
|
|
47798
|
+
const biAnalytics = getAnalytics({
|
|
47799
|
+
endpoint: ANALYTICS_ENDPOINT,
|
|
47800
|
+
getHeaders: () => {
|
|
47801
|
+
var t, i;
|
|
47802
|
+
const e = (i = (t = window.Telegram) == null ? void 0 : t.WebApp) == null ? void 0 : i.initData;
|
|
47803
|
+
return e ? { "X-Auth": e } : null;
|
|
47804
|
+
},
|
|
47805
|
+
debug: define_process_env_default$3.NODE_ENV !== "production"
|
|
47806
|
+
});
|
|
47807
|
+
function getBiSessionId() {
|
|
47808
|
+
return biAnalytics.getSessionId();
|
|
47809
|
+
}
|
|
47810
|
+
class AnalyticsServiceImpl {
|
|
47811
|
+
identify(t) {
|
|
47812
|
+
mixpanel.identify(String(t)), biAnalytics.identify(Number(t));
|
|
47813
|
+
}
|
|
47814
|
+
track(t, i = {}) {
|
|
47815
|
+
mixpanel.track(t, i), biAnalytics.track(t, i);
|
|
47816
|
+
}
|
|
47817
|
+
}
|
|
47818
|
+
const analytics = new AnalyticsServiceImpl(), SESSION_HEADER = "X-Session-Id";
|
|
47819
|
+
class APIRequestError extends Error {
|
|
47820
|
+
constructor({
|
|
47821
|
+
message: t,
|
|
47822
|
+
status: i,
|
|
47823
|
+
responseText: s
|
|
47824
|
+
}) {
|
|
47825
|
+
super(t), this.status = i, this.responseText = s;
|
|
47826
|
+
}
|
|
47827
|
+
}
|
|
47828
|
+
function createMakeRequest(e) {
|
|
47829
|
+
return async function(i, s, o) {
|
|
47830
|
+
e.waitUntilReady && await e.waitUntilReady();
|
|
47831
|
+
const a = `${e.baseUrl}/${i}`;
|
|
47832
|
+
try {
|
|
47833
|
+
const l = e.getAuthData(), c = e.getBotId(), u = {
|
|
47834
|
+
"X-Auth": l || e.getInitData(),
|
|
47835
|
+
"Content-Type": "application/json",
|
|
47836
|
+
[SESSION_HEADER]: getBiSessionId()
|
|
47837
|
+
};
|
|
47838
|
+
if (c && (u["X-Bot-ID"] = c), l) {
|
|
47839
|
+
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());
|
|
47840
|
+
const d = l || e.getInitData();
|
|
47841
|
+
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"]);
|
|
47842
|
+
}
|
|
47843
|
+
const f = await fetch(a, {
|
|
47844
|
+
method: s,
|
|
47845
|
+
headers: u,
|
|
47846
|
+
body: o ? JSON.stringify(o) : null
|
|
47847
|
+
});
|
|
47848
|
+
if (!f.ok)
|
|
47849
|
+
throw new APIRequestError({
|
|
47850
|
+
message: `Request to ${i} failed with status ${f.status}`,
|
|
47851
|
+
status: f.status,
|
|
47852
|
+
responseText: await (async () => {
|
|
47853
|
+
try {
|
|
47854
|
+
return await f.text();
|
|
47855
|
+
} catch {
|
|
47856
|
+
return;
|
|
47857
|
+
}
|
|
47858
|
+
})()
|
|
47859
|
+
});
|
|
47860
|
+
return f.json();
|
|
47861
|
+
} catch (l) {
|
|
47862
|
+
throw l instanceof APIRequestError || console.error(`Error during request to ${i}:`, l), l;
|
|
47863
|
+
}
|
|
47864
|
+
};
|
|
47865
|
+
}
|
|
47866
|
+
const queryClient = new QueryClient({
|
|
47867
|
+
mutationCache: new MutationCache({
|
|
47868
|
+
onError: (e) => {
|
|
47869
|
+
captureException(e);
|
|
47870
|
+
}
|
|
47871
|
+
}),
|
|
47872
|
+
queryCache: new QueryCache({
|
|
47873
|
+
onError: (e) => {
|
|
47874
|
+
captureException(e);
|
|
47875
|
+
}
|
|
47876
|
+
}),
|
|
47877
|
+
defaultOptions: {
|
|
47878
|
+
queries: {
|
|
47879
|
+
staleTime: 5 * 60 * 1e3,
|
|
47880
|
+
// 5 minutes
|
|
47881
|
+
gcTime: 10 * 60 * 1e3,
|
|
47882
|
+
// 10 minutes (formerly cacheTime)
|
|
47883
|
+
refetchOnWindowFocus: !1,
|
|
47884
|
+
refetchOnReconnect: !0,
|
|
47885
|
+
refetchOnMount: !0,
|
|
47886
|
+
retry: (e, t) => {
|
|
47887
|
+
if (t instanceof APIRequestError && t.status === 401)
|
|
47888
|
+
return e < 3;
|
|
47889
|
+
if (t instanceof Error && "status" in t) {
|
|
47890
|
+
const i = t.status;
|
|
47891
|
+
if (i && i >= 400 && i < 500)
|
|
47892
|
+
return !1;
|
|
47893
|
+
}
|
|
47894
|
+
return e < 3;
|
|
47895
|
+
},
|
|
47896
|
+
retryDelay: (e, t) => t instanceof APIRequestError && t.status === 401 ? Math.min(1e3 * 2 ** e, 4e3) : Math.min(1e3 * 2 ** e, 3e4)
|
|
47897
|
+
},
|
|
47898
|
+
mutations: {
|
|
47899
|
+
retry: 1,
|
|
47900
|
+
retryDelay: 1e3
|
|
47901
|
+
}
|
|
47902
|
+
}
|
|
47903
|
+
});
|
|
47904
|
+
function createOverlay(e) {
|
|
47905
|
+
let t = document.getElementById("overlay-root");
|
|
47906
|
+
t = document.createElement("div"), t.id = "overlay-root", document.body.appendChild(t), clientExports.createRoot(t).render(/* @__PURE__ */ jsxRuntimeExports.jsx(OverlayManager, { options: e }));
|
|
47907
|
+
}
|
|
47908
|
+
const OverlayManager = ({ options: e }) => {
|
|
47909
|
+
const t = useCallback(() => {
|
|
47910
|
+
var i;
|
|
47911
|
+
(i = window.Telegram.WebApp) == null || i.openTelegramLink("https://t.me/orbit_portal_bot/app?startapp=profile");
|
|
47912
|
+
}, []);
|
|
47913
|
+
return useEffect(() => {
|
|
47914
|
+
const i = (s) => {
|
|
47915
|
+
s.shiftKey && s.key === "Tab" && (s.preventDefault(), t());
|
|
47916
|
+
};
|
|
47917
|
+
return document.addEventListener("keydown", i), () => {
|
|
47918
|
+
document.removeEventListener("keydown", i);
|
|
47919
|
+
};
|
|
47920
|
+
}, [t]), /* @__PURE__ */ jsxRuntimeExports.jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AppRoot, { children: [
|
|
47921
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OrientationCheck, {}),
|
|
47922
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-top", className: "cssdk-banner-container cssdk-banner-top" }),
|
|
47923
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(I18nBackendLanguageProvider, { children: [
|
|
47924
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SnackbarProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ConfettiProvider, { children: [
|
|
47925
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
47926
|
+
OverlayProfile,
|
|
47927
|
+
{
|
|
47928
|
+
variant: (e == null ? void 0 : e.variant) || "translucent",
|
|
47929
|
+
onOpenProfile: () => t(),
|
|
47930
|
+
initialPosition: e == null ? void 0 : e.initialPosition,
|
|
47931
|
+
initialCoordinates: e == null ? void 0 : e.initialCoordinates
|
|
47932
|
+
}
|
|
47933
|
+
),
|
|
47934
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TopUpModal, {}),
|
|
47935
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(BoxOpeningModal, {}),
|
|
47936
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ProfileInventoryModal, {})
|
|
47937
|
+
] }) }) }),
|
|
47938
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EventsStack, {})
|
|
47939
|
+
] }) }),
|
|
47940
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "overlay-banner-bottom", className: "cssdk-banner-container cssdk-banner-bottom" })
|
|
47941
|
+
] }) });
|
|
47942
|
+
};
|
|
47943
|
+
class AbortError extends Error {
|
|
47944
|
+
constructor(t = "The operation was aborted") {
|
|
47945
|
+
super(t), this.name = "AbortError";
|
|
47946
|
+
}
|
|
47947
|
+
}
|
|
47948
|
+
function delay(e, { signal: t } = {}) {
|
|
47949
|
+
return new Promise((i, s) => {
|
|
47950
|
+
const o = () => {
|
|
47951
|
+
s(new AbortError());
|
|
47952
|
+
}, a = () => {
|
|
47953
|
+
clearTimeout(l), o();
|
|
47954
|
+
};
|
|
47955
|
+
if (t != null && t.aborted)
|
|
47956
|
+
return o();
|
|
47957
|
+
const l = setTimeout(() => {
|
|
47958
|
+
t == null || t.removeEventListener("abort", a), i();
|
|
47959
|
+
}, e);
|
|
47960
|
+
t == null || t.addEventListener("abort", a, { once: !0 });
|
|
47961
|
+
});
|
|
47962
|
+
}
|
|
47963
|
+
var lib = {}, uaParser_min$1 = { exports: {} }, uaParser_min = uaParser_min$1.exports, hasRequiredUaParser_min;
|
|
47709
47964
|
function requireUaParser_min() {
|
|
47710
47965
|
return hasRequiredUaParser_min || (hasRequiredUaParser_min = 1, function(e, t) {
|
|
47711
47966
|
(function(i, s) {
|
|
@@ -50359,7 +50614,7 @@ const balance$4 = "Balance", topUp$4 = "Top Up", ads$4 = "Ads", adsOn$4 = "On",
|
|
|
50359
50614
|
topUpModal,
|
|
50360
50615
|
inventoryModal
|
|
50361
50616
|
};
|
|
50362
|
-
var define_process_env_default$2 = { NODE_ENV: "production", version: "1.
|
|
50617
|
+
var define_process_env_default$2 = { NODE_ENV: "production", version: "1.93.2", 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
50618
|
const resources = {
|
|
50364
50619
|
en: {
|
|
50365
50620
|
translation: en
|
|
@@ -50860,54 +51115,68 @@ let activityDetectorInstance = null;
|
|
|
50860
51115
|
function getActivityDetector(e) {
|
|
50861
51116
|
return activityDetectorInstance || (activityDetectorInstance = new ActivityDetector(e)), activityDetectorInstance;
|
|
50862
51117
|
}
|
|
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
51118
|
const log$4 = createAdLogger("Adsgram");
|
|
50871
51119
|
async function showAdsgramAdWithTimeout(e) {
|
|
50872
51120
|
if (!e)
|
|
50873
|
-
return log$4.error("Ad controller not available"),
|
|
51121
|
+
return log$4.error("Ad controller not available"), analytics.track("ad_show_error", {
|
|
50874
51122
|
message: "Adsgram Ad Controller not available",
|
|
50875
51123
|
error_type: "controller_unavailable",
|
|
51124
|
+
error_code: "controller_unavailable",
|
|
50876
51125
|
...getBaseAnalyticsParams(),
|
|
50877
|
-
ad_type: "adsgram"
|
|
51126
|
+
ad_type: "adsgram",
|
|
51127
|
+
provider: "adsgram"
|
|
50878
51128
|
}), !1;
|
|
50879
51129
|
const t = e;
|
|
50880
51130
|
return log$4.group("Showing Ad"), log$4.time("show"), new Promise((i) => {
|
|
50881
51131
|
const s = setTimeout(() => {
|
|
50882
|
-
log$4.timeEnd("show"), log$4.error("Ad request timed out after 5s"), log$4.groupEnd(),
|
|
51132
|
+
log$4.timeEnd("show"), log$4.error("Ad request timed out after 5s"), log$4.groupEnd(), analytics.track("ad_show_error", {
|
|
50883
51133
|
message: "Adsgram ad request timed out after 5 seconds",
|
|
50884
51134
|
error_type: "timeout",
|
|
51135
|
+
error_code: "timeout",
|
|
50885
51136
|
timeout_duration: 5e3,
|
|
50886
51137
|
...getBaseAnalyticsParams(),
|
|
50887
|
-
ad_type: "adsgram"
|
|
51138
|
+
ad_type: "adsgram",
|
|
51139
|
+
provider: "adsgram"
|
|
50888
51140
|
}), i(!1);
|
|
50889
|
-
}, 5e3);
|
|
50890
|
-
|
|
51141
|
+
}, 5e3), o = performance.now();
|
|
51142
|
+
analytics.track("ad_show_started", {
|
|
50891
51143
|
...getBaseAnalyticsParams(),
|
|
50892
|
-
ad_type: "adsgram"
|
|
50893
|
-
|
|
50894
|
-
|
|
51144
|
+
ad_type: "adsgram",
|
|
51145
|
+
provider: "adsgram"
|
|
51146
|
+
}), log$4.info("Starting ad display..."), t.show().then((a) => {
|
|
51147
|
+
clearTimeout(s), log$4.timeEnd("show"), a.done ? (log$4.info("Ad finished successfully", {
|
|
51148
|
+
state: a.state,
|
|
51149
|
+
description: a.description
|
|
51150
|
+
}), analytics.track("ad_show_success", {
|
|
50895
51151
|
...getBaseAnalyticsParams(),
|
|
50896
|
-
ad_type: "adsgram"
|
|
50897
|
-
|
|
51152
|
+
ad_type: "adsgram",
|
|
51153
|
+
provider: "adsgram",
|
|
51154
|
+
duration_ms: Math.round(performance.now() - o)
|
|
51155
|
+
}), log$4.groupEnd(), i(!0)) : (log$4.warn("Ad was not completed", {
|
|
51156
|
+
state: a.state,
|
|
51157
|
+
description: a.description
|
|
51158
|
+
}), analytics.track("ad_show_error", {
|
|
50898
51159
|
message: "Adsgram ad was not completed.",
|
|
50899
51160
|
error_type: "not_completed",
|
|
50900
|
-
|
|
51161
|
+
error_code: "not_completed",
|
|
51162
|
+
result: a,
|
|
50901
51163
|
...getBaseAnalyticsParams(),
|
|
50902
|
-
ad_type: "adsgram"
|
|
51164
|
+
ad_type: "adsgram",
|
|
51165
|
+
provider: "adsgram"
|
|
50903
51166
|
}), log$4.groupEnd(), i(!1));
|
|
50904
|
-
}).catch((
|
|
50905
|
-
clearTimeout(s), log$4.timeEnd("show"), log$4.error("Ad error", {
|
|
51167
|
+
}).catch((a) => {
|
|
51168
|
+
clearTimeout(s), log$4.timeEnd("show"), log$4.error("Ad error", {
|
|
51169
|
+
error: a == null ? void 0 : a.error,
|
|
51170
|
+
state: a == null ? void 0 : a.state,
|
|
51171
|
+
description: a == null ? void 0 : a.description
|
|
51172
|
+
}), log$4.groupEnd(), analytics.track("ad_show_error", {
|
|
50906
51173
|
message: "Adsgram ad threw an error",
|
|
50907
51174
|
error_type: "exception",
|
|
50908
|
-
|
|
51175
|
+
error_code: "exception",
|
|
51176
|
+
error: (a == null ? void 0 : a.error) || String(a),
|
|
50909
51177
|
...getBaseAnalyticsParams(),
|
|
50910
|
-
ad_type: "adsgram"
|
|
51178
|
+
ad_type: "adsgram",
|
|
51179
|
+
provider: "adsgram"
|
|
50911
51180
|
}), i(!1);
|
|
50912
51181
|
});
|
|
50913
51182
|
});
|
|
@@ -50947,40 +51216,49 @@ async function initGigapubAds(e) {
|
|
|
50947
51216
|
}
|
|
50948
51217
|
async function showGigapubAd(e, t) {
|
|
50949
51218
|
const i = crypto.randomUUID();
|
|
50950
|
-
return !window.showGiga || typeof window.showGiga != "function" ? e ? (log$3.warn("showGiga not available, using fallback", { transactionId: i }),
|
|
51219
|
+
return !window.showGiga || typeof window.showGiga != "function" ? e ? (log$3.warn("showGiga not available, using fallback", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
50951
51220
|
message: "Gigapub showGiga function not available, using fallback.",
|
|
50952
51221
|
...getBaseAnalyticsParams(),
|
|
50953
51222
|
ad_type: "gigapub",
|
|
51223
|
+
provider: "gigapub",
|
|
50954
51224
|
transaction_id: i,
|
|
50955
51225
|
placement_id: t
|
|
50956
|
-
}), await e()) : (
|
|
51226
|
+
}), await e()) : (analytics.track("ad_show_error", {
|
|
50957
51227
|
message: "Gigapub showGiga function not available",
|
|
50958
51228
|
error_type: "function_unavailable",
|
|
51229
|
+
error_code: "function_unavailable",
|
|
50959
51230
|
...getBaseAnalyticsParams(),
|
|
50960
51231
|
ad_type: "gigapub",
|
|
51232
|
+
provider: "gigapub",
|
|
50961
51233
|
transaction_id: i,
|
|
50962
51234
|
placement_id: t
|
|
50963
51235
|
}), !1) : (log$3.group("Showing Ad"), log$3.time("show"), log$3.info("Starting ad display", { transactionId: i, placementId: t }), new Promise((s) => {
|
|
50964
|
-
|
|
51236
|
+
const o = performance.now();
|
|
51237
|
+
analytics.track("ad_show_started", {
|
|
50965
51238
|
...getBaseAnalyticsParams(),
|
|
50966
51239
|
ad_type: "gigapub",
|
|
51240
|
+
provider: "gigapub",
|
|
50967
51241
|
transaction_id: i,
|
|
50968
51242
|
placement_id: t
|
|
50969
51243
|
}), 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(),
|
|
51244
|
+
log$3.timeEnd("show"), log$3.info("Ad finished successfully", { transactionId: i, placementId: t }), log$3.groupEnd(), analytics.track("ad_show_success", {
|
|
50971
51245
|
...getBaseAnalyticsParams(),
|
|
50972
51246
|
ad_type: "gigapub",
|
|
51247
|
+
provider: "gigapub",
|
|
50973
51248
|
transaction_id: i,
|
|
50974
|
-
placement_id: t
|
|
51249
|
+
placement_id: t,
|
|
51250
|
+
duration_ms: Math.round(performance.now() - o)
|
|
50975
51251
|
}), s(!0);
|
|
50976
|
-
}).catch((
|
|
50977
|
-
log$3.timeEnd("show"), log$3.error("Ad error", { error:
|
|
51252
|
+
}).catch((a) => {
|
|
51253
|
+
log$3.timeEnd("show"), log$3.error("Ad error", { error: a, transactionId: i, placementId: t }), log$3.groupEnd(), analytics.track("ad_show_error", {
|
|
50978
51254
|
message: "Gigapub ad failed or was skipped",
|
|
50979
51255
|
error_type: "exception",
|
|
50980
|
-
|
|
50981
|
-
|
|
51256
|
+
error_code: "exception",
|
|
51257
|
+
error: a == null ? void 0 : a.toString(),
|
|
51258
|
+
error_message: (a == null ? void 0 : a.message) || "Unknown error",
|
|
50982
51259
|
...getBaseAnalyticsParams(),
|
|
50983
51260
|
ad_type: "gigapub",
|
|
51261
|
+
provider: "gigapub",
|
|
50984
51262
|
transaction_id: i,
|
|
50985
51263
|
placement_id: t
|
|
50986
51264
|
}), s(!1);
|
|
@@ -51037,48 +51315,58 @@ function createMonetagFallbackFunction(e, t) {
|
|
|
51037
51315
|
}
|
|
51038
51316
|
async function showMonetagAd(e, t, i) {
|
|
51039
51317
|
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(),
|
|
51318
|
+
return log$2.error("Ad function name not found"), log$2.timeEnd("show"), log$2.groupEnd(), analytics.track("ad_show_error", {
|
|
51041
51319
|
message: "Monetag ad function name not found",
|
|
51042
51320
|
error_type: "function_name_missing",
|
|
51321
|
+
error_code: "function_name_missing",
|
|
51043
51322
|
...getBaseAnalyticsParams(),
|
|
51044
51323
|
ad_type: "monetag",
|
|
51324
|
+
provider: "monetag",
|
|
51045
51325
|
placement_id: i
|
|
51046
51326
|
}), !1;
|
|
51047
51327
|
const s = window[e];
|
|
51048
51328
|
if (typeof s != "function")
|
|
51049
|
-
return log$2.error("Ad function not found on window", { fnName: e }), log$2.timeEnd("show"), log$2.groupEnd(),
|
|
51329
|
+
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
51330
|
message: "Monetag ad function not found on window object",
|
|
51051
51331
|
error_type: "function_unavailable",
|
|
51332
|
+
error_code: "function_unavailable",
|
|
51052
51333
|
function_name: e,
|
|
51053
51334
|
...getBaseAnalyticsParams(),
|
|
51054
51335
|
ad_type: "monetag",
|
|
51336
|
+
provider: "monetag",
|
|
51055
51337
|
placement_id: i
|
|
51056
51338
|
}), !1;
|
|
51057
51339
|
const o = i ? `orbit-${i}` : "orbit";
|
|
51058
51340
|
return new Promise((a) => {
|
|
51059
|
-
|
|
51341
|
+
const l = performance.now();
|
|
51342
|
+
analytics.track("ad_show_started", {
|
|
51060
51343
|
...getBaseAnalyticsParams(),
|
|
51061
51344
|
ad_type: "monetag",
|
|
51345
|
+
provider: "monetag",
|
|
51062
51346
|
placement_id: i
|
|
51063
51347
|
}), s({ ymid: t, requestVar: o, timeout: 5 }).then(() => {
|
|
51064
|
-
log$2.timeEnd("show"), log$2.info("Ad watched successfully", { placementId: i }), log$2.groupEnd(),
|
|
51348
|
+
log$2.timeEnd("show"), log$2.info("Ad watched successfully", { placementId: i }), log$2.groupEnd(), analytics.track("ad_show_success", {
|
|
51065
51349
|
...getBaseAnalyticsParams(),
|
|
51066
51350
|
ad_type: "monetag",
|
|
51067
|
-
|
|
51351
|
+
provider: "monetag",
|
|
51352
|
+
placement_id: i,
|
|
51353
|
+
duration_ms: Math.round(performance.now() - l)
|
|
51068
51354
|
}), a(!0);
|
|
51069
|
-
}).catch((
|
|
51070
|
-
log$2.timeEnd("show"), log$2.error("Ad failed or was skipped", { error:
|
|
51355
|
+
}).catch((c) => {
|
|
51356
|
+
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
51357
|
message: "Monetag ad failed or was skipped",
|
|
51072
51358
|
error_type: "ad_failed",
|
|
51073
|
-
|
|
51359
|
+
error_code: "ad_failed",
|
|
51360
|
+
error: String(c),
|
|
51074
51361
|
...getBaseAnalyticsParams(),
|
|
51075
51362
|
ad_type: "monetag",
|
|
51363
|
+
provider: "monetag",
|
|
51076
51364
|
placement_id: i
|
|
51077
51365
|
}), a(!1);
|
|
51078
51366
|
});
|
|
51079
51367
|
});
|
|
51080
51368
|
}
|
|
51081
|
-
var define_process_env_default$1 = { NODE_ENV: "production", version: "1.
|
|
51369
|
+
var define_process_env_default$1 = { NODE_ENV: "production", version: "1.93.2", 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
51370
|
const log$1 = createAdLogger("Orbit");
|
|
51083
51371
|
async function initOrbitAds() {
|
|
51084
51372
|
log$1.group("Initialization"), log$1.time("init"), log$1.info("Loading script...");
|
|
@@ -51105,59 +51393,70 @@ async function initOrbitAds() {
|
|
|
51105
51393
|
async function showOrbitAd(e, t) {
|
|
51106
51394
|
const i = crypto.randomUUID();
|
|
51107
51395
|
if (!window.showOrbitAds || typeof window.showOrbitAds != "function")
|
|
51108
|
-
return e ? (log$1.warn("showOrbitAds not available, using fallback", { transactionId: i }),
|
|
51396
|
+
return e ? (log$1.warn("showOrbitAds not available, using fallback", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51109
51397
|
message: "Orbit showOrbitAds function not available, using fallback.",
|
|
51110
51398
|
...getBaseAnalyticsParams(),
|
|
51111
51399
|
ad_type: "orbit",
|
|
51400
|
+
provider: "orbit",
|
|
51112
51401
|
transaction_id: i
|
|
51113
|
-
}), await e()) : (
|
|
51402
|
+
}), await e()) : (analytics.track("ad_show_error", {
|
|
51114
51403
|
message: "Orbit showOrbitAds function not available",
|
|
51115
51404
|
error_type: "function_unavailable",
|
|
51405
|
+
error_code: "function_unavailable",
|
|
51116
51406
|
...getBaseAnalyticsParams(),
|
|
51117
51407
|
ad_type: "orbit",
|
|
51408
|
+
provider: "orbit",
|
|
51118
51409
|
transaction_id: i
|
|
51119
51410
|
}), !1);
|
|
51120
|
-
|
|
51411
|
+
const s = performance.now();
|
|
51412
|
+
analytics.track("ad_show_started", {
|
|
51121
51413
|
...getBaseAnalyticsParams(),
|
|
51122
51414
|
ad_type: "orbit",
|
|
51415
|
+
provider: "orbit",
|
|
51123
51416
|
transaction_id: i
|
|
51124
51417
|
}), log$1.group("Showing Ad"), log$1.time("show"), log$1.info("Starting ad display", { transactionId: i, ...t });
|
|
51125
51418
|
try {
|
|
51126
|
-
const
|
|
51127
|
-
if (log$1.timeEnd("show"), log$1.info("showOrbitAds resolved", { response:
|
|
51128
|
-
return
|
|
51419
|
+
const o = await window.showOrbitAds(t);
|
|
51420
|
+
if (log$1.timeEnd("show"), log$1.info("showOrbitAds resolved", { response: o, transactionId: i }), o.is_direct_sales)
|
|
51421
|
+
return analytics.track("ad_show_success", {
|
|
51129
51422
|
...getBaseAnalyticsParams(),
|
|
51130
51423
|
ad_type: "orbit",
|
|
51131
|
-
|
|
51424
|
+
provider: "orbit",
|
|
51425
|
+
transaction_id: i,
|
|
51426
|
+
duration_ms: Math.round(performance.now() - s)
|
|
51132
51427
|
}), 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 }),
|
|
51428
|
+
if (log$1.warn("is_direct_sales=false, falling back to provider", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51134
51429
|
message: "Orbit has no ad available, falling back to provider network.",
|
|
51135
51430
|
...getBaseAnalyticsParams(),
|
|
51136
51431
|
ad_type: "orbit",
|
|
51432
|
+
provider: "orbit",
|
|
51137
51433
|
transaction_id: i
|
|
51138
51434
|
}), e) {
|
|
51139
|
-
const
|
|
51140
|
-
return log$1.info("Fallback result", { result:
|
|
51435
|
+
const a = await e();
|
|
51436
|
+
return log$1.info("Fallback result", { result: a, transactionId: i }), log$1.groupEnd(), a;
|
|
51141
51437
|
}
|
|
51142
51438
|
return log$1.groupEnd(), !1;
|
|
51143
|
-
} catch (
|
|
51144
|
-
if (log$1.timeEnd("show"), log$1.error("Ad error", { error:
|
|
51439
|
+
} catch (o) {
|
|
51440
|
+
if (log$1.timeEnd("show"), log$1.error("Ad error", { error: o, transactionId: i }), analytics.track("ad_show_error", {
|
|
51145
51441
|
message: "Orbit ad failed or was skipped",
|
|
51146
51442
|
error_type: "exception",
|
|
51147
|
-
|
|
51148
|
-
|
|
51443
|
+
error_code: "exception",
|
|
51444
|
+
error: o instanceof Error ? o.toString() : String(o),
|
|
51445
|
+
error_message: o instanceof Error ? o.message : "Unknown error",
|
|
51149
51446
|
...getBaseAnalyticsParams(),
|
|
51150
51447
|
ad_type: "orbit",
|
|
51448
|
+
provider: "orbit",
|
|
51151
51449
|
transaction_id: i
|
|
51152
51450
|
}), e) {
|
|
51153
|
-
log$1.warn("Error occurred, using fallback provider", { transactionId: i }),
|
|
51451
|
+
log$1.warn("Error occurred, using fallback provider", { transactionId: i }), analytics.track("ad_show_fallback", {
|
|
51154
51452
|
message: "Orbit ad errored, falling back to provider network.",
|
|
51155
51453
|
...getBaseAnalyticsParams(),
|
|
51156
51454
|
ad_type: "orbit",
|
|
51455
|
+
provider: "orbit",
|
|
51157
51456
|
transaction_id: i
|
|
51158
51457
|
});
|
|
51159
|
-
const
|
|
51160
|
-
return log$1.info("Fallback result after error", { result:
|
|
51458
|
+
const a = await e();
|
|
51459
|
+
return log$1.info("Fallback result after error", { result: a, transactionId: i }), log$1.groupEnd(), a;
|
|
51161
51460
|
}
|
|
51162
51461
|
return log$1.groupEnd(), !1;
|
|
51163
51462
|
}
|
|
@@ -51168,65 +51467,78 @@ async function checkAdStatus(e) {
|
|
|
51168
51467
|
log.info("Checking ad status", { adId: e });
|
|
51169
51468
|
const t = await fetch(`https://sp.tmanetwork.tech/bid_info?id=${e}`);
|
|
51170
51469
|
if (t.status === 204)
|
|
51171
|
-
return log.info("Ad status: NOT_SHOWED (204)", { adId: e }),
|
|
51470
|
+
return log.info("Ad status: NOT_SHOWED (204)", { adId: e }), analytics.track("ad_status_not_showed", {
|
|
51172
51471
|
...getBaseAnalyticsParams(),
|
|
51173
51472
|
ad_id: e,
|
|
51174
|
-
ad_type: "tma"
|
|
51473
|
+
ad_type: "tma",
|
|
51474
|
+
provider: "tma"
|
|
51175
51475
|
}), "NOT_SHOWED";
|
|
51176
51476
|
if (!t.ok)
|
|
51177
51477
|
throw new Error(`Failed to check ad status: ${t.status}`);
|
|
51178
51478
|
const i = await t.json();
|
|
51179
|
-
return i.click_created ? (log.info("Ad status: CLICKED", { adId: e }),
|
|
51479
|
+
return i.click_created ? (log.info("Ad status: CLICKED", { adId: e }), analytics.track("ad_status_clicked", {
|
|
51180
51480
|
...getBaseAnalyticsParams(),
|
|
51181
51481
|
ad_id: e,
|
|
51182
|
-
ad_type: "tma"
|
|
51183
|
-
|
|
51482
|
+
ad_type: "tma",
|
|
51483
|
+
provider: "tma"
|
|
51484
|
+
}), "CLICKED") : i.imp_created ? (log.info("Ad status: SHOWED", { adId: e }), analytics.track("ad_status_showed", {
|
|
51184
51485
|
...getBaseAnalyticsParams(),
|
|
51185
51486
|
ad_id: e,
|
|
51186
|
-
ad_type: "tma"
|
|
51187
|
-
|
|
51487
|
+
ad_type: "tma",
|
|
51488
|
+
provider: "tma"
|
|
51489
|
+
}), "SHOWED") : (log.info("Ad status: NOT_SHOWED (no imp/click)", { adId: e }), analytics.track("ad_status_not_showed", {
|
|
51188
51490
|
...getBaseAnalyticsParams(),
|
|
51189
51491
|
ad_id: e,
|
|
51190
|
-
ad_type: "tma"
|
|
51492
|
+
ad_type: "tma",
|
|
51493
|
+
provider: "tma"
|
|
51191
51494
|
}), "NOT_SHOWED");
|
|
51192
51495
|
} catch (t) {
|
|
51193
|
-
throw log.error("Error checking ad status", { adId: e, error: t }),
|
|
51496
|
+
throw log.error("Error checking ad status", { adId: e, error: t }), analytics.track("ad_status_error", {
|
|
51194
51497
|
...getBaseAnalyticsParams(),
|
|
51195
51498
|
ad_id: e,
|
|
51196
|
-
ad_type: "tma"
|
|
51499
|
+
ad_type: "tma",
|
|
51500
|
+
provider: "tma"
|
|
51197
51501
|
}), t;
|
|
51198
51502
|
}
|
|
51199
51503
|
}
|
|
51200
51504
|
async function showAd(e = {}) {
|
|
51201
51505
|
if (!window.TMANetwork) {
|
|
51202
51506
|
const t = new Error("TMANetwork is not available");
|
|
51203
|
-
throw log.error("TMANetwork not available on window"),
|
|
51507
|
+
throw log.error("TMANetwork not available on window"), analytics.track("ad_show_error", {
|
|
51204
51508
|
message: "TMANetwork is not available",
|
|
51205
51509
|
error_type: "sdk_unavailable",
|
|
51510
|
+
error_code: "sdk_unavailable",
|
|
51206
51511
|
...getBaseAnalyticsParams(),
|
|
51207
|
-
ad_type: "tma"
|
|
51512
|
+
ad_type: "tma",
|
|
51513
|
+
provider: "tma"
|
|
51208
51514
|
}), t;
|
|
51209
51515
|
}
|
|
51210
51516
|
if (window.TMANetwork.hasInterstitialAd()) {
|
|
51211
51517
|
log.info("Ad already loaded, showing immediately"), e.onStart && e.onStart();
|
|
51212
51518
|
try {
|
|
51213
|
-
|
|
51519
|
+
const t = performance.now();
|
|
51520
|
+
analytics.track("ad_show_started", {
|
|
51214
51521
|
...getBaseAnalyticsParams(),
|
|
51215
|
-
ad_type: "tma"
|
|
51522
|
+
ad_type: "tma",
|
|
51523
|
+
provider: "tma"
|
|
51216
51524
|
});
|
|
51217
|
-
const
|
|
51218
|
-
return log.info("Ad shown successfully", { adId:
|
|
51525
|
+
const i = await window.TMANetwork.showInterstitialAd();
|
|
51526
|
+
return log.info("Ad shown successfully", { adId: i.id }), analytics.track("ad_show_success", {
|
|
51219
51527
|
...getBaseAnalyticsParams(),
|
|
51220
51528
|
ad_type: "tma",
|
|
51221
|
-
|
|
51222
|
-
|
|
51529
|
+
provider: "tma",
|
|
51530
|
+
ad_id: i.id,
|
|
51531
|
+
duration_ms: Math.round(performance.now() - t)
|
|
51532
|
+
}), window.TMANetwork.reloadAd(), i;
|
|
51223
51533
|
} catch (t) {
|
|
51224
|
-
throw log.error("Error showing preloaded ad", t),
|
|
51534
|
+
throw log.error("Error showing preloaded ad", t), analytics.track("ad_show_error", {
|
|
51225
51535
|
message: t instanceof Error ? t.message : "Unknown error showing TMA ad",
|
|
51226
51536
|
error_type: "exception",
|
|
51537
|
+
error_code: "exception",
|
|
51227
51538
|
error: t instanceof Error ? t.toString() : String(t),
|
|
51228
51539
|
...getBaseAnalyticsParams(),
|
|
51229
|
-
ad_type: "tma"
|
|
51540
|
+
ad_type: "tma",
|
|
51541
|
+
provider: "tma"
|
|
51230
51542
|
}), t;
|
|
51231
51543
|
}
|
|
51232
51544
|
}
|
|
@@ -51236,26 +51548,31 @@ async function showAd(e = {}) {
|
|
|
51236
51548
|
if (!s) {
|
|
51237
51549
|
s = !0;
|
|
51238
51550
|
try {
|
|
51239
|
-
log.info("onAdLoaded event received"),
|
|
51551
|
+
log.info("onAdLoaded event received"), analytics.track("ad_load_event_received", {
|
|
51240
51552
|
...getBaseAnalyticsParams(),
|
|
51241
|
-
ad_type: "tma"
|
|
51242
|
-
|
|
51553
|
+
ad_type: "tma",
|
|
51554
|
+
provider: "tma"
|
|
51555
|
+
}), e.onStart && e.onStart(), analytics.track("ad_show_started", {
|
|
51243
51556
|
...getBaseAnalyticsParams(),
|
|
51244
|
-
ad_type: "tma"
|
|
51557
|
+
ad_type: "tma",
|
|
51558
|
+
provider: "tma"
|
|
51245
51559
|
});
|
|
51246
51560
|
const a = await window.TMANetwork.showInterstitialAd();
|
|
51247
|
-
log.info("Ad shown successfully after load", { adId: a.id }),
|
|
51561
|
+
log.info("Ad shown successfully after load", { adId: a.id }), analytics.track("ad_load_success", {
|
|
51248
51562
|
...getBaseAnalyticsParams(),
|
|
51249
51563
|
ad_type: "tma",
|
|
51564
|
+
provider: "tma",
|
|
51250
51565
|
ad_id: a.id
|
|
51251
51566
|
}), window.TMANetwork.reloadAd(), t(a);
|
|
51252
51567
|
} catch (a) {
|
|
51253
|
-
log.error("Error showing ad after load event", a),
|
|
51568
|
+
log.error("Error showing ad after load event", a), analytics.track("ad_load_error", {
|
|
51254
51569
|
message: a instanceof Error ? a.message : "Unknown error loading TMA ad",
|
|
51255
51570
|
error_type: "load_exception",
|
|
51571
|
+
error_code: "load_exception",
|
|
51256
51572
|
error: a instanceof Error ? a.toString() : String(a),
|
|
51257
51573
|
...getBaseAnalyticsParams(),
|
|
51258
|
-
ad_type: "tma"
|
|
51574
|
+
ad_type: "tma",
|
|
51575
|
+
provider: "tma"
|
|
51259
51576
|
}), i(a);
|
|
51260
51577
|
}
|
|
51261
51578
|
}
|
|
@@ -51264,12 +51581,14 @@ async function showAd(e = {}) {
|
|
|
51264
51581
|
if (!s) {
|
|
51265
51582
|
s = !0;
|
|
51266
51583
|
const a = new Error("Ad load timeout");
|
|
51267
|
-
log.error("Ad load timeout after 10s"),
|
|
51584
|
+
log.error("Ad load timeout after 10s"), analytics.track("ad_load_timeout", {
|
|
51268
51585
|
message: "Ad load timeout after 10 seconds",
|
|
51269
51586
|
error_type: "timeout",
|
|
51587
|
+
error_code: "timeout",
|
|
51270
51588
|
timeout_duration: 1e4,
|
|
51271
51589
|
...getBaseAnalyticsParams(),
|
|
51272
|
-
ad_type: "tma"
|
|
51590
|
+
ad_type: "tma",
|
|
51591
|
+
provider: "tma"
|
|
51273
51592
|
}), i(a);
|
|
51274
51593
|
}
|
|
51275
51594
|
}, 1e4), window.TMANetwork.addEventListener("onAdLoaded", o);
|
|
@@ -51277,17 +51596,18 @@ async function showAd(e = {}) {
|
|
|
51277
51596
|
}
|
|
51278
51597
|
function loadTMANetworkScript() {
|
|
51279
51598
|
return new Promise((e, t) => {
|
|
51280
|
-
if (log.group("Script Load"), log.time("scriptLoad"),
|
|
51599
|
+
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
51600
|
log.info("Script already loaded (skipping)"), log.timeEnd("scriptLoad"), log.groupEnd(), e();
|
|
51282
51601
|
return;
|
|
51283
51602
|
}
|
|
51284
51603
|
const i = document.createElement("script");
|
|
51285
51604
|
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(),
|
|
51605
|
+
log.timeEnd("scriptLoad"), log.info("Script loaded successfully"), log.groupEnd(), analytics.track("tma_script_load_success", getBaseAnalyticsParams()), e();
|
|
51287
51606
|
}, i.onerror = (s) => {
|
|
51288
|
-
log.timeEnd("scriptLoad"), log.error("Failed to load script", s), log.groupEnd(),
|
|
51607
|
+
log.timeEnd("scriptLoad"), log.error("Failed to load script", s), log.groupEnd(), analytics.track("tma_script_load_error", {
|
|
51289
51608
|
message: "Failed to load TMANetwork script",
|
|
51290
51609
|
error_type: "script_load_failed",
|
|
51610
|
+
error_code: "script_load_failed",
|
|
51291
51611
|
error: String(s),
|
|
51292
51612
|
...getBaseAnalyticsParams()
|
|
51293
51613
|
}), captureException(s), t(new Error("Failed to load TMANetwork script"));
|
|
@@ -51430,10 +51750,12 @@ function createIframeSdk() {
|
|
|
51430
51750
|
}
|
|
51431
51751
|
});
|
|
51432
51752
|
}
|
|
51433
|
-
var define_process_env_default = { NODE_ENV: "production", version: "1.
|
|
51753
|
+
var define_process_env_default = { NODE_ENV: "production", version: "1.93.2", 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
51754
|
const _isThirdPartyIframe = window.parent !== window && !((Kr = (qr = window.Telegram) == null ? void 0 : qr.WebApp) != null && Kr.initData);
|
|
51435
51755
|
_isThirdPartyIframe || (ensureViewportMetaTag(), initSentry());
|
|
51436
|
-
const adLog = createAdLogger("SDK")
|
|
51756
|
+
const adLog = createAdLogger("SDK");
|
|
51757
|
+
let gameInitializedAt = null;
|
|
51758
|
+
const CloudStorageGetItem = (e) => new Promise((t, i) => {
|
|
51437
51759
|
getTelegramWebApp().CloudStorage.getItem(e, (s, o) => {
|
|
51438
51760
|
s ? i(new Error(s)) : t(o ?? null);
|
|
51439
51761
|
});
|
|
@@ -51445,7 +51767,7 @@ const adLog = createAdLogger("SDK"), CloudStorageGetItem = (e) => new Promise((t
|
|
|
51445
51767
|
getTelegramWebApp().CloudStorage.removeItem(e, (s, o) => {
|
|
51446
51768
|
s ? i(new Error(s)) : t(o ?? null);
|
|
51447
51769
|
});
|
|
51448
|
-
}),
|
|
51770
|
+
}), G_MEASUREMENT_ID = "G-4RMXVE2K75", BANNER_HEIGHT = 60, bannerManager = new BannerManager({
|
|
51449
51771
|
height: BANNER_HEIGHT
|
|
51450
51772
|
});
|
|
51451
51773
|
let timer = null;
|
|
@@ -51618,11 +51940,7 @@ function startGameTimeTrack() {
|
|
|
51618
51940
|
var Yr, Xr, Jr, Qr;
|
|
51619
51941
|
try {
|
|
51620
51942
|
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());
|
|
51943
|
+
e && analytics.identify(e), analytics.track("sdk_initialized", getBaseAnalyticsParams());
|
|
51626
51944
|
} catch (e) {
|
|
51627
51945
|
console.error(e);
|
|
51628
51946
|
}
|
|
@@ -51699,7 +52017,7 @@ const CryptoSteamSDK = {
|
|
|
51699
52017
|
adLog.error("Monetag fallback: failed to initialize", f);
|
|
51700
52018
|
}
|
|
51701
52019
|
}
|
|
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] &&
|
|
52020
|
+
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
52021
|
"Experiment name": "start_page_ab",
|
|
51704
52022
|
"Variant name": (o = a == null ? void 0 : a.audiences) == null ? void 0 : o[0]
|
|
51705
52023
|
});
|
|
@@ -51716,14 +52034,14 @@ const CryptoSteamSDK = {
|
|
|
51716
52034
|
console.error("Config not found");
|
|
51717
52035
|
return;
|
|
51718
52036
|
}
|
|
51719
|
-
|
|
52037
|
+
analytics.identify(String(a.id)), window.game_id = a.game_id, window.game_title = l.title, ReactGA.initialize(G_MEASUREMENT_ID, {
|
|
51720
52038
|
gaOptions: {
|
|
51721
52039
|
userId: a.id,
|
|
51722
52040
|
gameId: a.game_id
|
|
51723
52041
|
}
|
|
51724
52042
|
}), ReactGA.event("init", {
|
|
51725
52043
|
gameId: a.game_id
|
|
51726
|
-
}),
|
|
52044
|
+
}), gameInitializedAt = performance.now(), analytics.track("game_initialized", {
|
|
51727
52045
|
game_id: a.game_id,
|
|
51728
52046
|
game_title: l.title
|
|
51729
52047
|
}), !isPortal && !(t != null && t.disable_startup_ads) && CryptoSteamSDK.requestAd().catch((c) => {
|
|
@@ -51762,9 +52080,10 @@ const CryptoSteamSDK = {
|
|
|
51762
52080
|
}), (i = CryptoSteamSDK.onAdEnd) == null || i.call(CryptoSteamSDK, !1), adLog.timeEnd("requestAd"), adLog.groupEnd(), !1;
|
|
51763
52081
|
if (l.ads_free && !isPortal)
|
|
51764
52082
|
return adLog.warn("Skipped: profile has ads_free flag"), (s = CryptoSteamSDK.onAdEnd) == null || s.call(CryptoSteamSDK, !1), adLog.timeEnd("requestAd"), adLog.groupEnd(), !1;
|
|
51765
|
-
|
|
52083
|
+
analytics.track("ad_show_requested", {
|
|
51766
52084
|
...getBaseAnalyticsParams(),
|
|
51767
52085
|
ad_type: orbitInitialized ? "orbit" : adType,
|
|
52086
|
+
provider: orbitInitialized ? "orbit" : adType,
|
|
51768
52087
|
placement_id: e.placementId
|
|
51769
52088
|
});
|
|
51770
52089
|
const f = async () => {
|
|
@@ -51787,11 +52106,13 @@ const CryptoSteamSDK = {
|
|
|
51787
52106
|
);
|
|
51788
52107
|
return await showGigapubAd(h, e.placementId);
|
|
51789
52108
|
}
|
|
51790
|
-
return adLog.error("Ad network not initialized or not supported", { adType }),
|
|
52109
|
+
return adLog.error("Ad network not initialized or not supported", { adType }), analytics.track("ad_show_error", {
|
|
51791
52110
|
...getBaseAnalyticsParams(),
|
|
51792
52111
|
message: "Ad network not initialized or not supported",
|
|
51793
52112
|
ad_type: adType,
|
|
52113
|
+
provider: adType,
|
|
51794
52114
|
error_type: "unsupported_network",
|
|
52115
|
+
error_code: "unsupported_network",
|
|
51795
52116
|
placement_id: e.placementId
|
|
51796
52117
|
}), !1;
|
|
51797
52118
|
};
|
|
@@ -51811,11 +52132,13 @@ const CryptoSteamSDK = {
|
|
|
51811
52132
|
d = await f();
|
|
51812
52133
|
return adLog.timeEnd("requestAd"), adLog.info("Ad request completed", { result: d }), adLog.groupEnd(), (o = CryptoSteamSDK.onAdEnd) == null || o.call(CryptoSteamSDK, d), d;
|
|
51813
52134
|
} catch (l) {
|
|
51814
|
-
return adLog.timeEnd("requestAd"), adLog.error("Error in requestAd", l), adLog.groupEnd(),
|
|
52135
|
+
return adLog.timeEnd("requestAd"), adLog.error("Error in requestAd", l), adLog.groupEnd(), analytics.track("ad_show_error", {
|
|
51815
52136
|
...getBaseAnalyticsParams(),
|
|
51816
52137
|
message: l instanceof Error ? l.message : "Unknown error in requestAd",
|
|
51817
52138
|
error_type: "sdk_exception",
|
|
52139
|
+
error_code: "sdk_exception",
|
|
51818
52140
|
ad_type: adType,
|
|
52141
|
+
provider: adType,
|
|
51819
52142
|
error: l instanceof Error ? l.toString() : String(l),
|
|
51820
52143
|
placement_id: e.placementId
|
|
51821
52144
|
}), (a = CryptoSteamSDK.onAdEnd) == null || a.call(CryptoSteamSDK, !1), !1;
|
|
@@ -51825,9 +52148,10 @@ const CryptoSteamSDK = {
|
|
|
51825
52148
|
var t, i, s;
|
|
51826
52149
|
adLog.group("requestRewardAd"), adLog.time("requestRewardAd"), (t = CryptoSteamSDK.onAdStart) == null || t.call(CryptoSteamSDK);
|
|
51827
52150
|
try {
|
|
51828
|
-
|
|
52151
|
+
analytics.track("ad_show_requested", {
|
|
51829
52152
|
...getBaseAnalyticsParams(),
|
|
51830
52153
|
ad_type: orbitInitialized ? "orbit" : adType,
|
|
52154
|
+
provider: orbitInitialized ? "orbit" : adType,
|
|
51831
52155
|
placement_id: e.placementId
|
|
51832
52156
|
});
|
|
51833
52157
|
const o = async () => {
|
|
@@ -51853,11 +52177,13 @@ const CryptoSteamSDK = {
|
|
|
51853
52177
|
), c = await showGigapubAd(l, e.placementId);
|
|
51854
52178
|
return await delay(2e3), c;
|
|
51855
52179
|
}
|
|
51856
|
-
return adLog.error("Ad network not initialized or not supported", { adType }),
|
|
52180
|
+
return adLog.error("Ad network not initialized or not supported", { adType }), analytics.track("ad_show_error", {
|
|
51857
52181
|
...getBaseAnalyticsParams(),
|
|
51858
52182
|
message: "Ad network not initialized or not supported",
|
|
51859
52183
|
ad_type: adType,
|
|
52184
|
+
provider: adType,
|
|
51860
52185
|
error_type: "unsupported_network",
|
|
52186
|
+
error_code: "unsupported_network",
|
|
51861
52187
|
placement_id: e.placementId
|
|
51862
52188
|
}), !1;
|
|
51863
52189
|
};
|
|
@@ -51876,11 +52202,13 @@ const CryptoSteamSDK = {
|
|
|
51876
52202
|
a = await o();
|
|
51877
52203
|
return adLog.timeEnd("requestRewardAd"), adLog.info("Reward ad request completed", { result: a }), adLog.groupEnd(), (i = CryptoSteamSDK.onAdEnd) == null || i.call(CryptoSteamSDK, a), a;
|
|
51878
52204
|
} catch (o) {
|
|
51879
|
-
return adLog.timeEnd("requestRewardAd"), adLog.error("Error in requestRewardAd", o), adLog.groupEnd(),
|
|
52205
|
+
return adLog.timeEnd("requestRewardAd"), adLog.error("Error in requestRewardAd", o), adLog.groupEnd(), analytics.track("ad_show_error", {
|
|
51880
52206
|
...getBaseAnalyticsParams(),
|
|
51881
52207
|
message: o instanceof Error ? o.message : "Unknown error in requestRewardAd",
|
|
51882
52208
|
error_type: "sdk_exception",
|
|
52209
|
+
error_code: "sdk_exception",
|
|
51883
52210
|
ad_type: adType,
|
|
52211
|
+
provider: adType,
|
|
51884
52212
|
error: o instanceof Error ? o.toString() : String(o),
|
|
51885
52213
|
placement_id: e.placementId
|
|
51886
52214
|
}), (s = CryptoSteamSDK.onAdEnd) == null || s.call(CryptoSteamSDK, !1), !1;
|
|
@@ -52014,9 +52342,10 @@ const CryptoSteamSDK = {
|
|
|
52014
52342
|
console.error("Config not found");
|
|
52015
52343
|
return;
|
|
52016
52344
|
}
|
|
52017
|
-
|
|
52345
|
+
analytics.track("game_ready", {
|
|
52018
52346
|
game_id: e.game_id,
|
|
52019
|
-
game_title: t.title
|
|
52347
|
+
game_title: t.title,
|
|
52348
|
+
time_to_load_ms: gameInitializedAt !== null ? Math.round(performance.now() - gameInitializedAt) : void 0
|
|
52020
52349
|
}), ReactGA.event("game_loaded", {
|
|
52021
52350
|
gameId: e.game_id
|
|
52022
52351
|
});
|
|
@@ -52075,7 +52404,6 @@ const PortalEmuSDK = {
|
|
|
52075
52404
|
};
|
|
52076
52405
|
globalObj.PortalEmuSDK = PortalEmuSDK;
|
|
52077
52406
|
export {
|
|
52078
|
-
BASE_URL,
|
|
52079
52407
|
resolvedSDK as PortalSDK,
|
|
52080
52408
|
resolvedSDK as default,
|
|
52081
52409
|
makeRequest,
|