@pixels-online/pixels-client-js-sdk 1.14.0 → 1.16.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.
@@ -5,6 +5,7 @@ import { OfferwallConfig } from '../types/index';
5
5
  import { IClientOffer } from '../types/offer';
6
6
  import { ConnectionState } from '../types/connection';
7
7
  import { IClientPlayer } from '../types/player';
8
+ import { StackedLinkResult } from '../types/linking';
8
9
  export declare const mapEnvToOfferClientUrl: (env: "test" | "live" | (string & {})) => "https://offers.pixels.xyz" | "https://offers.sandbox.pixels.xyz" | "https://offers.staging.pixels.xyz" | "https://offers.preview.pixels.xyz" | "https://offers.dev.pixels.xyz";
9
10
  export declare class OfferwallClient {
10
11
  private config;
@@ -17,7 +18,9 @@ export declare class OfferwallClient {
17
18
  private hooks;
18
19
  private logger;
19
20
  private isInitializing;
21
+ private pendingStackedToken;
20
22
  constructor(config: OfferwallConfig);
23
+ private setupStackedLinkDetection;
21
24
  /**
22
25
  * Get the offer store instance
23
26
  */
@@ -67,5 +70,30 @@ export declare class OfferwallClient {
67
70
  getAuthLinkToken(): Promise<string>;
68
71
  getGameId(): string | null;
69
72
  getDashboardRedirectUrl(): Promise<string | null>;
73
+ /**
74
+ * Detect if there's a Stacked link token in the current URL
75
+ * @returns The token string if found, null otherwise
76
+ */
77
+ detectStackedLinkToken(): string | null;
78
+ /**
79
+ * Clear the stackedToken from the URL without page reload
80
+ */
81
+ private clearStackedTokenFromUrl;
82
+ /**
83
+ * Consume a Stacked link token to link the current game player
84
+ * to a Stacked unified user account.
85
+ *
86
+ * IMPORTANT: The player must be authenticated (have a valid JWT from tokenProvider)
87
+ * before calling this method.
88
+ *
89
+ * @param token The Stacked link token from the URL
90
+ * @returns Promise resolving to the link result
91
+ */
92
+ consumeStackedLinkToken(token: string): Promise<StackedLinkResult>;
93
+ /**
94
+ * Detects the token from URL, consumes it if player is authenticated.
95
+ * @returns Promise resolving to the link result, or null if no token found
96
+ */
97
+ processStackedLinkToken(): Promise<StackedLinkResult | null>;
70
98
  private handleError;
71
99
  }
package/dist/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './types/reward';
10
10
  export * from './types/events';
11
11
  export * from './types/hooks';
12
12
  export * from './types/player';
13
+ export * from './types/linking';