@arkadiuminc/sdk 2.70.8 → 2.72.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.
@@ -2,6 +2,7 @@ import { default as defaultConfigJson } from '../../config.json';
2
2
  import { ABTestAssignment } from './ab-test-service';
3
3
  import { ArenaType } from '../features/host/arena-type';
4
4
  import { IHost } from '../features/host';
5
+ import { ApiEnv } from '../features/backend/backend.api';
5
6
 
6
7
  export declare type AdsConfig = {
7
8
  isEnabled: boolean;
@@ -12,8 +13,19 @@ export declare type AdsConfig = {
12
13
  export declare enum GameConfigProperty {
13
14
  hasGems = "hasGems",
14
15
  hasEagle = "hasEagle",
15
- slug = "slug"
16
+ slug = "slug",
17
+ gameServerSettings = "gameServerSettings"
16
18
  }
19
+ export declare type GameServerConnectionSettings = {
20
+ host: string;
21
+ port: string;
22
+ key: string;
23
+ secure: boolean;
24
+ };
25
+ export declare type GameServerSettings = Partial<Record<ApiEnv, GameServerConnectionSettings>>;
26
+ export declare type DefaultGameConfig = {
27
+ gameServerSettings?: GameServerSettings;
28
+ };
17
29
  declare type GamePlatformFilterEntry = {
18
30
  games?: string[];
19
31
  platformTypes?: ArenaType[];
@@ -36,6 +48,7 @@ export interface ConfigSchema {
36
48
  refreshInterval: number;
37
49
  };
38
50
  lifecycle: Record<string, LifecycleEventConfig>;
51
+ defaultGameConfig?: DefaultGameConfig;
39
52
  ads: {
40
53
  isEnabled: boolean;
41
54
  configs: Array<{
@@ -219,6 +232,37 @@ export declare const schema: {
219
232
  required: string[];
220
233
  additionalProperties: boolean;
221
234
  };
235
+ defaultGameConfig: {
236
+ type: string;
237
+ properties: {
238
+ gameServerSettings: {
239
+ type: string;
240
+ properties: {
241
+ [k: string]: {
242
+ type: string;
243
+ properties: {
244
+ host: {
245
+ type: string;
246
+ };
247
+ port: {
248
+ type: string;
249
+ };
250
+ key: {
251
+ type: string;
252
+ };
253
+ secure: {
254
+ type: string;
255
+ };
256
+ };
257
+ required: string[];
258
+ additionalProperties: boolean;
259
+ };
260
+ };
261
+ additionalProperties: boolean;
262
+ };
263
+ };
264
+ additionalProperties: boolean;
265
+ };
222
266
  };
223
267
  required: string[];
224
268
  additionalProperties: boolean;
@@ -237,12 +281,13 @@ export declare class ConfigService {
237
281
  private _host;
238
282
  private _gameConfig;
239
283
  private _abTestService;
284
+ private _env;
240
285
  private constructor();
241
286
  static get Instance(): ConfigService;
242
287
  subscribe(callback: ConfigChangeCallback): () => void;
243
288
  private notifyConfigChange;
244
289
  private loadBundledConfig;
245
- init(host?: IHost): Promise<void>;
290
+ init(host?: IHost, env?: ApiEnv): Promise<void>;
246
291
  loadConfig(): Promise<void>;
247
292
  get config(): ConfigSchema;
248
293
  getSupportsSubscriptionsHosts(): string[];
@@ -261,6 +306,8 @@ export declare class ConfigService {
261
306
  private isPlatformType;
262
307
  private isGame;
263
308
  resetGameConfig(): void;
264
- setGameConfig(gameConfig: any): void;
265
- getGameConfigProperty(property: GameConfigProperty, defaultValue?: any): any;
309
+ private getSdkDefaultGameConfig;
310
+ setGameConfig(gameConfig: Record<string, unknown> | null | undefined): void;
311
+ private resolveGameConfigPropertyValue;
312
+ getGameConfigProperty(propertyName: string | GameConfigProperty, defaultValue?: any): any;
266
313
  }
@@ -0,0 +1,7 @@
1
+ export declare class ConfigArena {
2
+ constructor();
3
+ getProperty(propertyName: string): Promise<any>;
4
+ }
5
+ export declare class ConfigGame {
6
+ getProperty(propertyName: string): Promise<any>;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,54 @@
1
+ import { ObserverFn } from '../../utils/observable';
2
+
3
+ export declare enum LogLevel {
4
+ DEBUG = 0,
5
+ INFO = 1,
6
+ WARN = 2,
7
+ ERROR = 3,
8
+ NONE = 4
9
+ }
10
+ export interface ILogger {
11
+ readonly Level: typeof LogLevel;
12
+ setLogPrefix(prefix: string): void;
13
+ debug(...args: any[]): void;
14
+ info(...args: any[]): void;
15
+ warn(...args: any[]): void;
16
+ error(...args: any[]): void;
17
+ setLogLevel(level: LogLevel): void;
18
+ getLogLevel(): LogLevel;
19
+ onLogEvent(observer: ObserverFn<{
20
+ level: LogLevel;
21
+ args: any[];
22
+ }>): void;
23
+ }
24
+ /** @hidden */
25
+ export declare class Logger implements ILogger {
26
+ readonly Level: typeof LogLevel;
27
+ private static _instance;
28
+ private readonly observers;
29
+ private currentLogLevel;
30
+ private isUserSetLogLevel;
31
+ private logPrefix;
32
+ private constructor();
33
+ 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
+ private shouldLog;
41
+ private formatMessage;
42
+ setLogPrefix(prefix: string): void;
43
+ private log;
44
+ debug(...args: any[]): void;
45
+ info(...args: any[]): void;
46
+ warn(...args: any[]): void;
47
+ error(...args: any[]): void;
48
+ setLogLevel(level: LogLevel): void;
49
+ getLogLevel(): LogLevel;
50
+ onLogEvent(observer: ObserverFn<{
51
+ level: LogLevel;
52
+ args: any[];
53
+ }>): void;
54
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ declare type LogLevelName = 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
2
+ /** Matches Logger's first console argument: `[ISO][LEVEL]` */
3
+ export declare function expectLogTimestamp(level: LogLevelName, anchored?: boolean): any;
4
+ /** Full argument list passed to console.* by Logger */
5
+ export declare function expectLoggedArgs(level: LogLevelName, ...messageArgs: unknown[]): any[];
6
+ export {};
@@ -18,6 +18,7 @@ import { ConfigService } from './api/core/config-service';
18
18
  import { RatingsArena } from './api/features/ratings';
19
19
  import { TournamentsArena } from './api/features/tournaments';
20
20
  import { RecorderArena } from './api/features/recorder';
21
+ import { ILogger } from './api/features/logger';
21
22
 
22
23
  import * as MockUserUtils from './api/utils/mockUser';
23
24
  /** @hidden */
@@ -40,6 +41,7 @@ export declare class ArkadiumArenaSdk {
40
41
  ratings: RatingsArena;
41
42
  tournaments: TournamentsArena;
42
43
  recorder: RecorderArena;
44
+ logger: ILogger;
43
45
  private currentEnv;
44
46
  private currentTarget;
45
47
  private gamePingSender;
@@ -47,7 +49,7 @@ export declare class ArkadiumArenaSdk {
47
49
  $pingNotification: Observable<number>;
48
50
  version: string;
49
51
  config: ConfigService;
50
- 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);
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);
51
53
  setEnv(e: ApiEnv): void;
52
54
  initialize(env: ApiEnv, isGameSide: boolean, sessionStorage?: SessionStorageType | null): Promise<void>;
53
55
  private envDiscoverListener;
@@ -0,0 +1 @@
1
+ export {};
@@ -11,6 +11,8 @@ import { HostGame } from './api/features/host';
11
11
  import { LeaderboardGame } from './api/features/leaderboard';
12
12
  import { TournamentsGame } from './api/features/tournaments';
13
13
  import { RecorderGame } from './api/features/recorder';
14
+ import { ILogger } from './api/features/logger';
15
+ import { ConfigGame } from './api/features/config';
14
16
 
15
17
  export declare class ArkadiumGameSdk {
16
18
  version: string;
@@ -29,7 +31,9 @@ export declare class ArkadiumGameSdk {
29
31
  wallet: Wallet;
30
32
  leaderboard: LeaderboardGame;
31
33
  tournaments: TournamentsGame;
32
- constructor({ rpcProvider, backendApi, host, lifecycle, ads, auth, analytics, timeoutTester, persistence, wallet, leaderboard, tournaments, recorder }: {
34
+ logger: ILogger;
35
+ config: ConfigGame;
36
+ constructor({ rpcProvider, backendApi, host, lifecycle, ads, auth, analytics, timeoutTester, persistence, wallet, leaderboard, tournaments, recorder, logger, config }: {
33
37
  rpcProvider: RpcProvider;
34
38
  backendApi: Backend;
35
39
  host: HostGame;
@@ -43,6 +47,8 @@ export declare class ArkadiumGameSdk {
43
47
  leaderboard: LeaderboardGame;
44
48
  tournaments: TournamentsGame;
45
49
  recorder: RecorderGame;
50
+ logger: ILogger;
51
+ config: ConfigGame;
46
52
  });
47
53
  initialize(env: ApiEnv, isGameSide: boolean): Promise<void>;
48
54
  getEnv(): ApiEnv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkadiuminc/sdk",
3
- "version": "2.70.8",
3
+ "version": "2.72.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/pkg/arkadium-sdk.umd.js",