@arkadiuminc/sdk 2.77.1 → 2.78.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  };
@@ -1,13 +1,16 @@
1
1
  import { ObserverFn } from '../utils/observable';
2
+ import { IDebugMenuRuntimeDependencies } from '../debug';
2
3
 
3
4
  export declare class DebugProvider {
4
5
  private static _instance;
5
6
  private observers;
6
7
  private isDebug;
8
+ private debugMenuDependencies;
7
9
  private constructor();
8
10
  registerRpcHandlers(): void;
9
11
  static get Instance(): DebugProvider;
10
12
  private isArenaEnvironment;
13
+ private getStorage;
11
14
  private initDebugMode;
12
15
  private syncWithLogger;
13
16
  isDebugMode(): boolean;
@@ -16,4 +19,10 @@ export declare class DebugProvider {
16
19
  private propagateDebugMode;
17
20
  sendDebugEvent(type: string, ...args: any[]): void;
18
21
  onDebugEvent(observer: ObserverFn<string>): void;
22
+ setDebugMenuDependencies(deps: IDebugMenuRuntimeDependencies): void;
23
+ private toggleDebugMenu;
24
+ showDebugMenu(): Promise<void>;
25
+ hideDebugMenu(): void;
26
+ isUser(): boolean;
27
+ private isUserAllowedDebugMenu;
19
28
  }
@@ -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;
@@ -45,14 +40,30 @@ export declare class AuthArena extends Auth {
45
40
  private eagleId?;
46
41
  private arkUserId?;
47
42
  private arkUserIdPromise?;
48
- private arkSessionId?;
49
43
  private userProfilePromise?;
50
44
  constructor(backendApi: Backend, host: IHost, rpcProvider: RpcProvider, persistence: PersistenceArena);
51
45
  getUserProfile(): Promise<UserProfile | null>;
52
- getUserIdentity(): Promise<UserIdentity>;
46
+ getUserIdentity(updateSessionActivity?: boolean): Promise<UserIdentity>;
47
+ private getEagleId;
48
+ /**
49
+ * Returns a stable ark user id for this browser/device. The id is read from local persistence
50
+ * (`unique-arkadium-id`); if none exists, a new UUID is generated, stored, and reused on later
51
+ * calls. Cleared browser storage yields a new id. Cached in memory and deduped while in flight.
52
+ */
53
53
  private getOrCreateArkUserId;
54
54
  private resolveArkUserId;
55
+ /**
56
+ * Returns a persisted ark session id. State is stored in local persistence (`arkadium-ark-session`)
57
+ * (id, createdAt, lastActivityAt). A new id is generated when storage is missing or cleared,
58
+ * when the session is older than 24 hours, or — only when `updateSessionActivity` is true —
59
+ * when no analytics activity was recorded for 30 minutes. Pass `updateSessionActivity` from
60
+ * analytics sends; game-facing `getUserIdentity()` uses the default (read-only, no inactivity bump).
61
+ */
55
62
  private getOrCreateArkSessionId;
63
+ private loadArkSessionState;
64
+ private isArkSessionExpired;
65
+ private createArkSession;
66
+ private persistArkSessionState;
56
67
  }
57
68
  export declare class AuthGame extends Auth {
58
69
  private rpcProvider;
@@ -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
+ }
@@ -28,6 +28,7 @@ export declare class PersistenceArena implements IPersistence {
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkadiuminc/sdk",
3
- "version": "2.77.1",
3
+ "version": "2.78.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/pkg/arkadium-sdk.umd.js",