@orbit-software/sdk 1.94.0 → 1.94.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbit-software/sdk",
3
- "version": "1.94.0",
3
+ "version": "1.94.2",
4
4
  "main": "dist/esm/sdk.mjs",
5
5
  "types": "dist/esm/sdk.d.ts",
6
6
  "exports": {
@@ -34,7 +34,6 @@
34
34
  "@testing-library/jest-dom": "^6.6.2",
35
35
  "@testing-library/react": "^16.0.1",
36
36
  "@types/jest": "^29.5.14",
37
- "@types/mixpanel-browser": "^2.60.0",
38
37
  "@types/node": "^22.10.5",
39
38
  "@types/react": "^18.3.12",
40
39
  "@types/react-dom": "^18.3.1",
@@ -72,7 +71,6 @@
72
71
  "framer-motion": "^12.23.22",
73
72
  "i18next": "^25.5.3",
74
73
  "lottie-react": "^2.4.0",
75
- "mixpanel-browser": "^2.65.0",
76
74
  "preact": "^10.25.4",
77
75
  "react-confetti": "^6.1.0",
78
76
  "react-device-detect": "^2.2.3",
@@ -1,25 +0,0 @@
1
- import { a as t } from "./sdk-CMdgqzfW.mjs";
2
- const c = {
3
- async show(a, e, n) {
4
- const r = performance.now();
5
- try {
6
- return { ok: await t(
7
- void 0,
8
- n,
9
- a,
10
- // transactionIdOverride
11
- a
12
- // showTagOverride
13
- ), durationMs: performance.now() - r };
14
- } catch (o) {
15
- return {
16
- ok: !1,
17
- reason: o instanceof Error ? o.message : String(o),
18
- durationMs: performance.now() - r
19
- };
20
- }
21
- }
22
- };
23
- export {
24
- c as default
25
- };
@@ -1,11 +0,0 @@
1
- import { Adapter } from '../types';
2
- /**
3
- * Gigapub adapter for the exchange dispatcher.
4
- *
5
- * The exchange's echo field for Gigapub is `showTag` — the SDK threads the
6
- * `impression_id` into showTag so the publisher's postback can be matched
7
- * back to the issued impression. Likewise, transactionId is set to
8
- * impression_id so it lines up across all Gigapub telemetry surfaces.
9
- */
10
- declare const gigapubAdapter: Adapter;
11
- export default gigapubAdapter;
@@ -1,15 +0,0 @@
1
- import { Adapter } from '../types';
2
- /**
3
- * Monetag adapter for the exchange dispatcher.
4
- *
5
- * The exchange's echo field for Monetag is `ymid` — the SDK threads the
6
- * `impression_id` issued by the exchange into Monetag's ymid slot
7
- * (overriding the legacy game_id default used by the hardcoded path).
8
- *
9
- * The payload from `/exchange/serve` carries `fn_name` (or `zone_id`) — the
10
- * name of the function Monetag exposes on `window` after the publisher
11
- * script loads. We assume the SDK has already initialised Monetag at boot
12
- * (via `initMonetagAds`), so `ensureReady` is currently a no-op.
13
- */
14
- declare const monetagAdapter: Adapter;
15
- export default monetagAdapter;
@@ -1,18 +0,0 @@
1
- import { Adapter } from '../types';
2
- /**
3
- * own_video adapter — delegates to the existing Orbit rendering pipeline.
4
- *
5
- * The exchange's serve payload carries the ad-server `Impression` object
6
- * (the same shape returned by ad-server's `/_internal/v1/own-bid/commit`).
7
- *
8
- * NOTE: today's `showOrbitAd` always re-fetches via `window.showOrbitAds`
9
- * rather than accepting an injected impression. For Wave 9 we keep that
10
- * behaviour — the legacy Orbit script handles selection and rendering, and
11
- * the exchange round-trip mostly acts as the decision authority and
12
- * telemetry funnel. A future wave can extend `orbit.ts` (or replace the
13
- * window-script handoff) to render the pre-decided impression verbatim,
14
- * eliminating the duplicate selection. TODO(T34+): wire payload into the
15
- * Orbit rendering path so the exchange's decision is honoured byte-for-byte.
16
- */
17
- declare const ownVideoAdapter: Adapter;
18
- export default ownVideoAdapter;
@@ -1,21 +0,0 @@
1
- import { ClientEvent, Decision, ServeRequest } from './types';
2
- /**
3
- * Auth configuration for the exchange endpoints.
4
- *
5
- * The SDK uses header-based auth (X-Auth = Telegram initData, X-Bot-ID =
6
- * optional external bot id). The exchange module is loaded lazily by the
7
- * dispatcher, so it can't import from sdk.ts (which would create a cycle).
8
- * T34 wires the real getters via `configureExchangeClient()` at init time.
9
- *
10
- * Defaults read Telegram WebApp initData directly from window so the module
11
- * is still usable in tests / standalone scenarios.
12
- */
13
- export interface ExchangeClientConfig {
14
- baseUrl?: string;
15
- getAuthData?: () => string | null;
16
- getBotId?: () => string | null;
17
- getInitData?: () => string;
18
- }
19
- export declare function configureExchangeClient(next: ExchangeClientConfig): void;
20
- export declare function exchangeServe(req: ServeRequest): Promise<Decision>;
21
- export declare function postClientEvents(events: ClientEvent[]): Promise<void>;
@@ -1,22 +0,0 @@
1
- import { ServeRequest } from './types';
2
- /**
3
- * Sentinel thrown when the exchange explicitly directs the SDK back to its
4
- * legacy hardcoded provider path (e.g. circuit breaker tripped — Wave 13).
5
- * `sdk.ts` catches this in T34 and falls back to `showProviderRewardAd()`.
6
- */
7
- export declare class FallbackToHardcoded extends Error {
8
- constructor();
9
- }
10
- /**
11
- * Run one ad request through the exchange.
12
- *
13
- * Returns `true` when the ad was rendered (primary or fallback adapter
14
- * succeeded), `false` when no fill / load failure / render failure.
15
- * Throws `FallbackToHardcoded` when the exchange explicitly opts out via
16
- * `payload.use_hardcoded`.
17
- *
18
- * Side effect: enqueues a stream of client events via the telemetry
19
- * batcher — these are flushed to `/api/v1/exchange/client-event` on a 5s
20
- * timer or on page hide.
21
- */
22
- export declare function exchangeDispatch(req: ServeRequest, placementId?: string): Promise<boolean>;
@@ -1,4 +0,0 @@
1
- export { configureExchangeClient, exchangeServe } from './client';
2
- export { exchangeDispatch, FallbackToHardcoded } from './dispatcher';
3
- export { telemetry as exchangeTelemetry } from './telemetry';
4
- export type { Adapter, AdapterResult, ClientEvent, ClientEventKind, Decision, DecisionFill, DecisionNoFill, Provider, ServeRequest, } from './types';
@@ -1,4 +0,0 @@
1
- import { Adapter, Provider } from './types';
2
- export declare function loadAdapter(p: Provider): Promise<Adapter>;
3
- /** Test-only: drop cached adapters so mocks can be re-injected. */
4
- export declare function _resetLoaderCacheForTesting(): void;
@@ -1,27 +0,0 @@
1
- import { ClientEvent } from './types';
2
- /**
3
- * Batches client telemetry events and flushes them periodically (every 5s),
4
- * eagerly when the queue reaches BATCH_SIZE, and on `visibilitychange:hidden`
5
- * / `pagehide`. Mirrors games-launcher's analytics Batcher pattern but
6
- * scoped to exchange-specific events.
7
- *
8
- * Memory bounded at MAX_QUEUE (oldest dropped FIFO) so a backend outage
9
- * cannot cause unbounded growth.
10
- */
11
- declare class ExchangeTelemetryBatcher {
12
- private queue;
13
- private timer;
14
- private inFlight;
15
- private started;
16
- start(): void;
17
- stop(): void;
18
- track(event: ClientEvent): void;
19
- flush(): Promise<void>;
20
- /** Fire-and-forget flush for page-hide using fetch keepalive. */
21
- private flushOnHide;
22
- private onVisibilityChange;
23
- /** Test-only: reset the singleton's internal state. */
24
- _resetForTesting(): void;
25
- }
26
- export declare const telemetry: ExchangeTelemetryBatcher;
27
- export {};
@@ -1,54 +0,0 @@
1
- export type Provider = 'monetag' | 'gigapub' | 'own_video';
2
- export interface ServeRequest {
3
- placement_id: string;
4
- ad_format: 'rewarded' | 'interstitial';
5
- supported_providers: Provider[];
6
- request_id: string;
7
- /**
8
- * Shadow mode (Wave 12, T41): when true the exchange treats this request as
9
- * observation-only — the bandit logs it for learning but does NOT serve a
10
- * provider; the SDK ignores any response. Used to fire fire-and-forget
11
- * shadow requests from the legacy `requestRewardAd` path when
12
- * `shadowEnabled` is on but `useExchange` is off.
13
- */
14
- shadow?: boolean;
15
- }
16
- export interface DecisionFill {
17
- fill: true;
18
- impression_id: string;
19
- provider: Provider;
20
- payload: Record<string, unknown>;
21
- echo_field: 'ymid' | 'showTag' | 'url_param:tag';
22
- mint_token: string;
23
- ttl_seconds: number;
24
- fallback?: {
25
- provider: Provider;
26
- payload: Record<string, unknown>;
27
- mint_token: string;
28
- };
29
- }
30
- export interface DecisionNoFill {
31
- fill: false;
32
- reason: string;
33
- retry_after_seconds?: number;
34
- }
35
- export type Decision = DecisionFill | DecisionNoFill;
36
- export interface AdapterResult {
37
- ok: boolean;
38
- reason?: string;
39
- durationMs: number;
40
- }
41
- export interface Adapter {
42
- ensureReady?: (payload: DecisionFill['payload']) => Promise<void>;
43
- show: (impressionId: string, payload: DecisionFill['payload'], placementId?: string) => Promise<AdapterResult>;
44
- }
45
- export type ClientEventKind = 'decision_received' | 'provider_load_start' | 'provider_load_ok' | 'provider_load_fail' | 'client_completion' | 'client_failure' | 'fallback_attempted';
46
- export interface ClientEvent {
47
- kind: ClientEventKind;
48
- impression_id?: string;
49
- mint_token?: string;
50
- provider?: Provider;
51
- duration_ms?: number;
52
- reason?: string;
53
- ts?: string;
54
- }
@@ -1,25 +0,0 @@
1
- import { s as t } from "./sdk-CMdgqzfW.mjs";
2
- const m = {
3
- async ensureReady(a) {
4
- },
5
- async show(a, r, s) {
6
- const o = performance.now();
7
- try {
8
- const n = r, e = n.fn_name ?? n.zone_id;
9
- return e ? { ok: await t(e, a, s), durationMs: performance.now() - o } : {
10
- ok: !1,
11
- reason: "monetag payload missing fn_name/zone_id",
12
- durationMs: performance.now() - o
13
- };
14
- } catch (n) {
15
- return {
16
- ok: !1,
17
- reason: n instanceof Error ? n.message : String(n),
18
- durationMs: performance.now() - o
19
- };
20
- }
21
- }
22
- };
23
- export {
24
- m as default
25
- };
@@ -1,19 +0,0 @@
1
- import { b as s } from "./sdk-CMdgqzfW.mjs";
2
- const c = {
3
- async show(a, e, r) {
4
- const n = performance.now();
5
- try {
6
- const o = e, t = typeof o.zone_id == "number" ? o.zone_id : typeof o.zoneId == "number" ? o.zoneId : void 0;
7
- return { ok: await s(void 0, { zoneId: t, placementId: r }), durationMs: performance.now() - n };
8
- } catch (o) {
9
- return {
10
- ok: !1,
11
- reason: o instanceof Error ? o.message : String(o),
12
- durationMs: performance.now() - n
13
- };
14
- }
15
- }
16
- };
17
- export {
18
- c as default
19
- };