@arkadiuminc/sdk 2.77.0 → 2.78.0

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.
@@ -14,8 +14,13 @@ export declare enum GameConfigProperty {
14
14
  hasGems = "hasGems",
15
15
  hasEagle = "hasEagle",
16
16
  slug = "slug",
17
- gameServerSettings = "gameServerSettings"
17
+ gameServerSettings = "gameServerSettings",
18
+ debugMenu = "debugMenu"
18
19
  }
20
+ export declare type DebugMenuConfig = {
21
+ isEnabled: boolean;
22
+ users: string[];
23
+ };
19
24
  export declare type GameServerConnectionSettings = {
20
25
  host: string;
21
26
  port: string;
@@ -25,6 +30,7 @@ export declare type GameServerConnectionSettings = {
25
30
  export declare type GameServerSettings = Partial<Record<ApiEnv, GameServerConnectionSettings>>;
26
31
  export declare type DefaultGameConfig = {
27
32
  gameServerSettings?: GameServerSettings;
33
+ debugMenu?: DebugMenuConfig;
28
34
  };
29
35
  declare type GamePlatformFilterEntry = {
30
36
  games?: string[];
@@ -264,7 +270,24 @@ export declare const schema: {
264
270
  };
265
271
  additionalProperties: boolean;
266
272
  };
273
+ debugMenu: {
274
+ type: string;
275
+ properties: {
276
+ isEnabled: {
277
+ type: string;
278
+ };
279
+ users: {
280
+ type: string;
281
+ items: {
282
+ type: string;
283
+ };
284
+ };
285
+ };
286
+ required: string[];
287
+ additionalProperties: boolean;
288
+ };
267
289
  };
290
+ required: string[];
268
291
  additionalProperties: boolean;
269
292
  };
270
293
  };
@@ -0,0 +1,4 @@
1
+ /** localStorage / sessionStorage key used to persist SDK debug mode (value {@link DEBUG_SDK_STORAGE_ENABLED_VALUE}). */
2
+ export declare const DEBUG_SDK_STORAGE_KEY = "DEBUG_SDK";
3
+ /** Stored value that enables SDK debug mode. */
4
+ export declare const DEBUG_SDK_STORAGE_ENABLED_VALUE = "*";
@@ -1,27 +1,28 @@
1
1
  import { ObserverFn } from '../utils/observable';
2
+ import { IDebugMenuRuntimeDependencies } from '../debug';
2
3
 
3
- export interface DebugProvider {
4
- isDebugMode?(): boolean;
5
- setDebugMode?(isEnabled: boolean): void;
6
- sendDebugEvent(type: string, ...args: any[]): void;
7
- onDebugEvent?(observer: any): void;
8
- }
9
- export declare function isDebugMode(): boolean;
10
- export declare class DebugProviderArena implements DebugProvider {
4
+ export declare class DebugProvider {
11
5
  private static _instance;
12
6
  private observers;
13
7
  private isDebug;
8
+ private debugMenuDependencies;
14
9
  private constructor();
15
- static get Instance(): DebugProviderArena;
10
+ registerRpcHandlers(): void;
11
+ static get Instance(): DebugProvider;
12
+ private isArenaEnvironment;
13
+ private getStorage;
16
14
  private initDebugMode;
15
+ private syncWithLogger;
17
16
  isDebugMode(): boolean;
18
17
  setDebugMode(isEnabled: boolean): void;
18
+ private updateDebugMode;
19
+ private propagateDebugMode;
19
20
  sendDebugEvent(type: string, ...args: any[]): void;
20
21
  onDebugEvent(observer: ObserverFn<string>): void;
21
- }
22
- export declare class DebugProviderGame implements DebugProvider {
23
- private static _instance;
24
- private constructor();
25
- static get Instance(): DebugProviderGame;
26
- sendDebugEvent(type: string, ...args: any[]): void;
22
+ setDebugMenuDependencies(deps: IDebugMenuRuntimeDependencies): void;
23
+ private toggleDebugMenu;
24
+ showDebugMenu(): Promise<void>;
25
+ hideDebugMenu(): void;
26
+ isUser(): boolean;
27
+ private isUserAllowedDebugMenu;
27
28
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { IDebugMenuDependencies } from './types';
2
+
3
+ export declare const DEBUG_MENU_ROOT_ID = "arkadium-sdk-debug-menu";
4
+ export declare class DebugMenu {
5
+ private readonly deps;
6
+ private anchor;
7
+ constructor(deps: IDebugMenuDependencies);
8
+ mount(): void;
9
+ destroy(): void;
10
+ }
11
+ export declare function mountDebugMenu(deps: IDebugMenuDependencies): void;
12
+ export declare function hideDebugMenu(): void;
13
+ /** @internal */
14
+ export declare function resetDebugMenuForTests(): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { mountDebugMenu, hideDebugMenu, DebugMenu, DEBUG_MENU_ROOT_ID, resetDebugMenuForTests, } from './debug-menu';
2
+ export type { IDebugMenuDependencies, IDebugMenuRuntimeDependencies, DebugMenuPersistence, } from './types';
@@ -0,0 +1,3 @@
1
+ import { DebugMenuPersistence } from '../types';
2
+
3
+ export declare function createLocalStoragePanel(persistence: DebugMenuPersistence): HTMLElement;
@@ -0,0 +1,18 @@
1
+ import { IPersistence } from '../features/persistence';
2
+
3
+ export declare type DebugMenuPersistence = Pick<IPersistence, 'getLocalStorageItem' | 'setLocalStorageItem' | 'removeLocalStorageItem'> & {
4
+ listLocalStorageKeys(): Promise<string[]>;
5
+ };
6
+ export interface IDebugMenuDependencies {
7
+ gameSlug: string;
8
+ persistence: DebugMenuPersistence;
9
+ }
10
+ export interface IDebugMenuRuntimeDependencies {
11
+ config: {
12
+ getProperty(propertyName: string): Promise<unknown>;
13
+ };
14
+ persistence: DebugMenuPersistence;
15
+ host: {
16
+ getGameId(): Promise<string>;
17
+ };
18
+ }
@@ -3,9 +3,9 @@ import { createStore } from '../../utils/observable';
3
3
  import { RpcProvider } from '../../core/rpc';
4
4
  import { IHost } from '../host';
5
5
  import { PersistenceArena } from '../persistence';
6
- import { UserProfile, AuthFormObserver, AuthStatusObserver } from './types';
6
+ import { UserProfile, AuthFormObserver, AuthStatusObserver, UserIdentity } from './types';
7
7
 
8
- export type { UserProfile, UserProfileImage, AuthFormObserver, AuthStatusObserver } from './types';
8
+ export type { UserProfile, UserProfileImage, AuthFormObserver, AuthStatusObserver, UserIdentity } from './types';
9
9
  interface UserProfileReaderContract {
10
10
  authStatus: ReturnType<typeof createStore<boolean>>;
11
11
  isUserAuthorized(): Promise<boolean>;
@@ -19,11 +19,6 @@ interface AuthUIManagerContract {
19
19
  onOpenAuthForm(observer: AuthFormObserver): void;
20
20
  }
21
21
  export declare function getAvatarLink(avatarName: string, extension: string): string;
22
- interface UserIdentity {
23
- eagleId: string | undefined;
24
- arkUserId: string;
25
- arkSessionId: string;
26
- }
27
22
  export declare abstract class Auth {
28
23
  private backendApi;
29
24
  protected userProfileReader: UserProfileReaderContract;
@@ -24,3 +24,8 @@ export interface UserProfile {
24
24
  }
25
25
  export declare type AuthFormObserver = ObserverFn<boolean>;
26
26
  export declare type AuthStatusObserver = ObserverFn<boolean>;
27
+ export interface UserIdentity {
28
+ eagleId: string | undefined;
29
+ arkUserId: string;
30
+ arkSessionId: string;
31
+ }
@@ -9,6 +9,7 @@ export declare enum LogLevel {
9
9
  }
10
10
  export interface ILogger {
11
11
  readonly Level: typeof LogLevel;
12
+ syncWithDebugMode(isDebug: boolean): void;
12
13
  setLogPrefix(prefix: string): void;
13
14
  debug(...args: any[]): void;
14
15
  info(...args: any[]): void;
@@ -31,14 +32,10 @@ export declare class Logger implements ILogger {
31
32
  private logPrefix;
32
33
  private constructor();
33
34
  static get Instance(): ILogger;
34
- /**
35
- * Syncs the log level with DebugProvider's debug mode state.
36
- * When DebugProvider is enabled → sets log level to DEBUG
37
- * When DebugProvider is disabled → resets to WARN (unless user manually set a level)
38
- */
39
- private syncWithDebugMode;
40
35
  private shouldLog;
36
+ private logLevelName;
41
37
  private formatMessage;
38
+ syncWithDebugMode(isDebug: boolean): void;
42
39
  setLogPrefix(prefix: string): void;
43
40
  private log;
44
41
  debug(...args: any[]): void;
@@ -47,6 +44,7 @@ export declare class Logger implements ILogger {
47
44
  error(...args: any[]): void;
48
45
  setLogLevel(level: LogLevel): void;
49
46
  getLogLevel(): LogLevel;
47
+ getLogLevelName(): string;
50
48
  onLogEvent(observer: ObserverFn<{
51
49
  level: LogLevel;
52
50
  args: any[];
@@ -1,7 +1,7 @@
1
1
  import { RpcProvider } from '../../core/rpc';
2
2
  import { Backend } from '../backend/backend.api';
3
3
  import { IHost } from '../host';
4
- import { DebugProvider, DebugProviderArena } from '../../core/debug-provider';
4
+ import { DebugProvider } from '../../core/debug-provider';
5
5
  import { IndexedDBStorage } from '../../utils/indexed-db-storage';
6
6
 
7
7
  declare type RemoteStorageValueType = string | object;
@@ -22,12 +22,13 @@ export declare class PersistenceArena implements IPersistence {
22
22
  /**
23
23
  * @internal
24
24
  */
25
- constructor(rpcProvider?: RpcProvider, debugProvider?: DebugProviderArena, storage?: IndexedDBStorage);
25
+ constructor(rpcProvider?: RpcProvider, debugProvider?: DebugProvider, storage?: IndexedDBStorage);
26
26
  static get Instance(): PersistenceArena;
27
27
  getCookie(cookieName: string): Promise<string>;
28
28
  getLocalStorageItem(key: string): Promise<string | null>;
29
29
  setLocalStorageItem(key: string, value: string): Promise<void>;
30
30
  removeLocalStorageItem(key: string): Promise<void>;
31
+ listLocalStorageKeys(prefix: string): Promise<string[]>;
31
32
  }
32
33
  export declare class PersistenceGame implements IPersistence {
33
34
  private rpcProvider;
@@ -45,6 +46,7 @@ export declare class PersistenceGame implements IPersistence {
45
46
  getLocalStorageItem(key: string): Promise<string | null>;
46
47
  setLocalStorageItem(key: string, value: string): Promise<void>;
47
48
  removeLocalStorageItem(key: string): Promise<void>;
49
+ listLocalStorageKeys(): Promise<string[]>;
48
50
  private getCollection;
49
51
  private getRemoteToLocalStorageKey;
50
52
  private isRemoteStorageBlacklisted;
@@ -0,0 +1,12 @@
1
+ export declare type DomStyle = Partial<CSSStyleDeclaration> | Record<string, string>;
2
+ export declare type CreateElementOptions = {
3
+ id?: string;
4
+ className?: string;
5
+ text?: string;
6
+ html?: string;
7
+ attrs?: Record<string, string>;
8
+ styles?: DomStyle;
9
+ children?: (Node | string)[];
10
+ };
11
+ export declare function createElement<K extends keyof HTMLElementTagNameMap>(tag: K, options?: CreateElementOptions): HTMLElementTagNameMap[K];
12
+ export declare function createButton(label: string, onClick: () => void, variant?: 'primary' | 'secondary' | 'danger'): HTMLButtonElement;
@@ -0,0 +1,33 @@
1
+ export declare type SnapEdge = 'top' | 'right' | 'bottom' | 'left';
2
+ export declare function getClosestSnapEdge(rect: {
3
+ left: number;
4
+ top: number;
5
+ width: number;
6
+ height: number;
7
+ }, viewportWidth: number, viewportHeight: number): SnapEdge;
8
+ export declare function applySnapPosition(element: HTMLElement, edge: SnapEdge, rect: DOMRect, viewportWidth: number, viewportHeight: number, margin?: number): void;
9
+ export declare type DraggableEdgeAnchorOptions = {
10
+ margin?: number;
11
+ initialEdge?: SnapEdge;
12
+ };
13
+ /**
14
+ * Wraps content in a fixed-position panel that can be dragged and snaps to the nearest viewport edge on release.
15
+ */
16
+ export declare class DraggableEdgeAnchor {
17
+ private readonly content;
18
+ private readonly root;
19
+ private readonly dragHandle;
20
+ private readonly margin;
21
+ private dragOffsetX;
22
+ private dragOffsetY;
23
+ private isDragging;
24
+ private pointerId;
25
+ private resizeObserver;
26
+ constructor(content: HTMLElement, options?: DraggableEdgeAnchorOptions);
27
+ get element(): HTMLDivElement;
28
+ setDragHandle(handle: HTMLElement): void;
29
+ mount(parent?: HTMLElement): void;
30
+ destroy(): void;
31
+ snapToClosestEdge(): void;
32
+ private bindDragEvents;
33
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export { createElement, createButton } from './dom';
2
+ export type { CreateElementOptions, DomStyle } from './dom';
3
+ export { DraggableEdgeAnchor, getClosestSnapEdge, applySnapPosition } from './draggable-edge-anchor';
4
+ export type { SnapEdge, DraggableEdgeAnchorOptions } from './draggable-edge-anchor';
5
+ export { debugPanelTheme, UI_FONT_FAMILY } from './theme';
@@ -0,0 +1,15 @@
1
+ export declare const UI_FONT_FAMILY = "Arial, Helvetica, sans-serif";
2
+ export declare const debugPanelTheme: {
3
+ readonly background: "#1a1d24";
4
+ readonly surface: "#252a33";
5
+ readonly border: "#3d4554";
6
+ readonly text: "#e8eaed";
7
+ readonly textMuted: "#9aa0a9";
8
+ readonly accent: "#4c8bf5";
9
+ readonly accentHover: "#3a7ae8";
10
+ readonly danger: "#e57373";
11
+ readonly radius: "8px";
12
+ readonly shadow: "0 8px 24px rgba(0, 0, 0, 0.45)";
13
+ readonly zIndex: 99999;
14
+ readonly margin: 12;
15
+ };
@@ -15,4 +15,5 @@ export declare class IndexedDBStorage {
15
15
  getItem(key: string): Promise<string | null>;
16
16
  setItem(key: string, value: string): Promise<void>;
17
17
  removeItem(key: string): Promise<void>;
18
+ listKeysWithPrefix(prefix: string): Promise<string[]>;
18
19
  }
@@ -8,7 +8,7 @@ import { TimeoutTesterContract } from './api/core/timeout-tester';
8
8
  import { PersistenceArena } from './api/features/persistence';
9
9
  import { HostArena } from './api/features/host';
10
10
  import { WalletArena } from './api/features/wallet';
11
- import { DebugProviderArena } from './api/core/debug-provider';
11
+ import { DebugProvider } from './api/core/debug-provider';
12
12
  import { SupportV1 } from './api/features/support-v1/support-v1';
13
13
  import { LeaderboardArena } from './api/features/leaderboard';
14
14
  import { FriendsArena } from './api/features/friends';
@@ -32,7 +32,7 @@ export declare class ArkadiumArenaSdk {
32
32
  private timeoutTester;
33
33
  persistence: PersistenceArena;
34
34
  private wallet;
35
- debug: DebugProviderArena;
35
+ debug: DebugProvider;
36
36
  private supportV1;
37
37
  private leaderboard;
38
38
  friends: FriendsArena;
@@ -49,7 +49,7 @@ export declare class ArkadiumArenaSdk {
49
49
  $pingNotification: Observable<number>;
50
50
  version: string;
51
51
  config: ConfigService;
52
- constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProviderArena, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena, ratings: RatingsArena, tournaments: TournamentsArena, recorder: RecorderArena, logger: ILogger);
52
+ constructor(backendApi: Backend, host: HostArena, lifecycle: GameLifecycleArena, ads: AdsArena, auth: AuthArena, analytics: AnalyticsApiContract, timeoutTester: TimeoutTesterContract, persistence: PersistenceArena, wallet: WalletArena, debug: DebugProvider, supportV1: SupportV1, leaderboard: LeaderboardArena, friends: FriendsArena, notifications: NotificationsArena, chats: ChatArena, ratings: RatingsArena, tournaments: TournamentsArena, recorder: RecorderArena, logger: ILogger);
53
53
  setEnv(e: ApiEnv): void;
54
54
  initialize(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
55
55
  private envDiscoverListener;
@@ -8,6 +8,7 @@ import { TimeoutTesterContract } from './api/core/timeout-tester';
8
8
  import { PersistenceGame } from './api/features/persistence';
9
9
  import { WalletGame } from './api/features/wallet';
10
10
  import { HostGame } from './api/features/host';
11
+ import { DebugProvider } from './api/core/debug-provider';
11
12
  import { LeaderboardGame } from './api/features/leaderboard';
12
13
  import { TournamentsGame } from './api/features/tournaments';
13
14
  import { RecorderGame } from './api/features/recorder';
@@ -33,6 +34,7 @@ export declare class ArkadiumGameSdk {
33
34
  tournaments: TournamentsGame;
34
35
  logger: ILogger;
35
36
  config: ConfigGame;
37
+ debug: DebugProvider;
36
38
  constructor({ rpcProvider, backendApi, host, lifecycle, ads, auth, analytics, timeoutTester, persistence, wallet, leaderboard, tournaments, recorder, logger, config }: {
37
39
  rpcProvider: RpcProvider;
38
40
  backendApi: Backend;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkadiuminc/sdk",
3
- "version": "2.77.0",
3
+ "version": "2.78.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/pkg/arkadium-sdk.umd.js",