@arkadiuminc/sdk 2.59.0 → 2.60.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.
@@ -1,5 +1,6 @@
1
1
  import { DebugProvider } from '../../core/debug-provider';
2
2
  import { RpcProvider } from '../../core/rpc';
3
+ import { ObserverFn } from '../../utils/observable';
3
4
 
4
5
  export declare enum ArenaType {
5
6
  ARKCOM = "ARKCOM",
@@ -34,6 +35,11 @@ declare class WebEnvironmentDetails {
34
35
  constructor(siteName?: string, siteDomain?: string, referrer?: string, activeLocale?: string, devEnvironment?: string, darkMode?: boolean);
35
36
  clone(p: Partial<WebEnvironmentDetails>): WebEnvironmentDetails;
36
37
  }
38
+ export declare type UrlState = {
39
+ url: 'string';
40
+ params?: URLSearchParams;
41
+ };
42
+ export declare type UrlStateUnsubscribeFn = () => void;
37
43
  /** @hidden */
38
44
  export declare class HostArena implements IHost {
39
45
  private rpcProvider;
@@ -41,6 +47,7 @@ export declare class HostArena implements IHost {
41
47
  private gameIdOverride;
42
48
  private data;
43
49
  private openRequest;
50
+ private readonly urlState;
44
51
  /**
45
52
  * @internal
46
53
  */
@@ -63,10 +70,14 @@ export declare class HostArena implements IHost {
63
70
  width: number;
64
71
  height: number;
65
72
  }>;
73
+ sendUrlState(urlState: UrlState): Promise<void>;
74
+ private updateUrlState;
75
+ subscribeToUrlStateChange(observer: ObserverFn<UrlState | undefined>): UrlStateUnsubscribeFn;
66
76
  }
67
77
  export declare class HostGame implements IHost {
68
78
  private rpcProvider;
69
79
  private purchaseFormState;
80
+ private readonly urlState;
70
81
  /**
71
82
  * @internal
72
83
  */
@@ -90,5 +101,8 @@ export declare class HostGame implements IHost {
90
101
  height: number;
91
102
  }>;
92
103
  getGameAssetsUrl(): string;
104
+ sendUrlState(urlState: UrlState): Promise<void>;
105
+ private updateUrlState;
106
+ subscribeToUrlStateChange(observer: ObserverFn<UrlState | undefined>): UrlStateUnsubscribeFn;
93
107
  }
94
108
  export {};
@@ -0,0 +1,42 @@
1
+ export declare type ValidationResult = {
2
+ valid: true;
3
+ } | {
4
+ valid: false;
5
+ expected: string;
6
+ received: string;
7
+ };
8
+ export declare type ArgumentValidator = (value: unknown) => ValidationResult;
9
+ /**
10
+ * Schema primitives for defining object shapes. Use these as the single source of truth:
11
+ * define the schema once, derive the type with InferSchema, and pass to schema() for validation.
12
+ */
13
+ export declare type SchemaPrimitive = 'string' | 'number' | 'boolean' | 'object' | 'array';
14
+ /**
15
+ * Infers a TypeScript type from a schema object. Use with: type T = InferSchema<typeof mySchema>
16
+ */
17
+ export declare type InferSchema<T> = T extends Record<string, SchemaPrimitive> ? {
18
+ [K in keyof T]: SchemaPrimitiveToType<T[K]>;
19
+ } : never;
20
+ declare type SchemaPrimitiveToType<P> = P extends 'string' ? string : P extends 'number' ? number : P extends 'boolean' ? boolean : P extends 'object' ? Record<string, unknown> : P extends 'array' ? unknown[] : never;
21
+ /**
22
+ * Creates a validator from a schema object. The schema is the single source of truth:
23
+ * use InferSchema<typeof schema> for the type and schema(schema) for the decorator.
24
+ *
25
+ * @example
26
+ * const UrlStateSchema = { url: 'string' } as const;
27
+ * type UrlState = InferSchema<typeof UrlStateSchema>;
28
+ * @ValidateInput(schema(UrlStateSchema))
29
+ * private updateUrlState(urlState: UrlState): void { ... }
30
+ */
31
+ export declare function schema<T extends Record<string, SchemaPrimitive>>(shape: T): ArgumentValidator;
32
+ /**
33
+ * Decorator that validates method arguments before invocation.
34
+ * Pass one validator per argument in order.
35
+ * Throws an Error with details about which argument(s) failed validation.
36
+ *
37
+ * @example
38
+ * @ValidateInput(schema(UrlStateSchema))
39
+ * private updateUrlState(urlState: UrlState): void { ... }
40
+ */
41
+ export declare function ValidateInput(...validators: ArgumentValidator[]): (_target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
42
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkadiuminc/sdk",
3
- "version": "2.59.0",
3
+ "version": "2.60.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/pkg/arkadium-sdk.umd.js",