cap-hydra-web-sdk 1.7.0 → 1.10.5

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.
package/dist/index.d.ts CHANGED
@@ -104,6 +104,10 @@ interface WebSDKConfig {
104
104
  debugLevel?: DebugLevel;
105
105
  }
106
106
  type DebugLevel = 'NONE' | 'ERROR' | 'WARN' | 'INFO' | 'DEBUG' | 'VERBOSE';
107
+ /** Gamification theme. NONE (default) applies no theme-specific behavior — gamification
108
+ * renders exactly as it did before setTheme() existed. AUTO resolves to the browser's
109
+ * current prefers-color-scheme at render time. See WebSDK.setTheme(). */
110
+ type Theme = 'NONE' | 'AUTO' | 'DARK' | 'LIGHT';
107
111
  /**
108
112
  * User attributes for pushUserSignin, pushUserSignup, pushUserUpdate
109
113
  * - firstName, lastName are always required
@@ -136,7 +140,11 @@ interface Identifier {
136
140
  cuid: string;
137
141
  }
138
142
  /**
139
- * User traits for the identify method
143
+ * User traits for the identify method.
144
+ * `email`/`mobile`/`externalId` are secondary identifiers — supply them alongside a
145
+ * different primary `identifier` (e.g. `identifier: {type: 'mobile', cuid}, traits: {email}`)
146
+ * so both end up on the merged visitor's comm channels. They are ignored if they match
147
+ * the primary identifier's type, since that one is already sourced from `identifier.cuid`.
140
148
  */
141
149
  interface IdentifyTraits {
142
150
  firstName?: string;
@@ -146,6 +154,9 @@ interface IdentifyTraits {
146
154
  city?: string;
147
155
  country?: string;
148
156
  timezone?: string;
157
+ email?: string;
158
+ mobile?: string;
159
+ externalId?: string;
149
160
  custom?: Record<string, unknown>;
150
161
  }
151
162
  /**
@@ -161,10 +172,10 @@ interface IdentifyParams {
161
172
  * Options for manual page view tracking
162
173
  */
163
174
  interface PageViewOptions {
164
- url?: string;
165
- title?: string;
175
+ page_url?: string;
176
+ page_title?: string;
166
177
  referrer?: string;
167
- category?: string;
178
+ page_category?: string;
168
179
  properties?: Record<string, unknown>;
169
180
  }
170
181
  /**
@@ -190,6 +201,266 @@ interface UserInfo {
190
201
  */
191
202
  type UserIdentifierName = 'id' | 'mobile' | 'email' | 'externalId';
192
203
 
204
+ /** Extensible by design: adding TIME_EVENT/SESSION_EVENT later is a union-type + lookup-map
205
+ * change, not a rewrite of the entry-point evaluation flow. */
206
+ type TriggerType = 'ACTION_EVENT';
207
+ interface ActionEventConfig {
208
+ eventName: string;
209
+ }
210
+ interface ActionStateData {
211
+ programsState?: unknown;
212
+ rewardsState?: unknown;
213
+ }
214
+ interface OpenContainerContentAction {
215
+ type: 'OPEN_CONTAINER_CONTENT';
216
+ container: EntryPointContainer;
217
+ content: EntryPointContent;
218
+ data?: ActionStateData;
219
+ }
220
+ interface ToggleContainerContentAction {
221
+ type: 'TOGGLE_CONTAINER_CONTENT';
222
+ id: string;
223
+ container: EntryPointContainer;
224
+ content: EntryPointContent;
225
+ data?: ActionStateData;
226
+ }
227
+ interface CloseContainerContentAction {
228
+ type: 'CLOSE_CONTAINER_CONTENT';
229
+ data?: ActionStateData;
230
+ }
231
+ /** Fired by content when any button inside the campaign is clicked, not just a dedicated
232
+ * close button — a distinct postMessage type from CLOSE_CONTAINER_CONTENT, but handled
233
+ * identically by the manager. */
234
+ interface CloseAction {
235
+ type: 'CLOSE';
236
+ data?: ActionStateData;
237
+ }
238
+ interface UpdateContentStateAction {
239
+ type: 'UPDATE_CONTENT_STATE';
240
+ data: ActionStateData;
241
+ }
242
+ interface RequestStateAction {
243
+ type: 'REQUEST_STATE';
244
+ }
245
+ interface RedirectAction {
246
+ type: 'REDIRECT';
247
+ data: {
248
+ url: string;
249
+ openInNewTab?: boolean;
250
+ };
251
+ }
252
+ interface LoginAction {
253
+ type: 'LOGIN';
254
+ data: {
255
+ url: string;
256
+ };
257
+ }
258
+ interface AnalyticsAction {
259
+ type: 'ANALYTICS';
260
+ data: unknown;
261
+ }
262
+ interface RefreshAction {
263
+ type: 'REFRESH';
264
+ }
265
+ interface OpenDeepLinkPayload {
266
+ deepLink?: string;
267
+ isHandledByCG?: string | boolean;
268
+ closeOnDeepLink?: string | boolean;
269
+ }
270
+ /** Fired by content when a CTA should navigate to a deep link — CG's native-app bridge
271
+ * protocol calls this OPEN_DEEPLINK; ported here so web behaves the same way. The real payload
272
+ * is observed nested one level deeper on the wire (`action.data.data`), which the native SDKs
273
+ * unwrap — `data`'s own top-level fields are kept optional as a fallback for a flatter payload,
274
+ * but are not the primary shape. See handleOpenDeepLink(). */
275
+ interface OpenDeepLinkAction {
276
+ type: 'OPEN_DEEPLINK';
277
+ data: OpenDeepLinkPayload & {
278
+ data?: OpenDeepLinkPayload;
279
+ };
280
+ }
281
+ interface DimensionsUpdatePayload {
282
+ height: number;
283
+ }
284
+ /** Content reports its real rendered height (px) so the container can size itself to match —
285
+ * needed by any container whose height isn't already fixed by container CSS (EMBEDDED, and
286
+ * POP_UP/BOTTOM_SHEET/CHAT_BOX when configured to size to content). Confirmed on the wire as a
287
+ * flat `{eventName: 'DIMENSIONS_UPDATE', data: {height}}` message, same as CLOSE/ANALYTICS — but
288
+ * like OPEN_DEEPLINK/OPEN_CG_WEBVIEW, the real payload is also observed nested one level deeper
289
+ * (`action.data.data`) for some content; `data`'s own top-level `height` is kept as a fallback
290
+ * for a flatter payload. See handleSdkEvent()'s DIMENSIONS_UPDATE case. */
291
+ interface DimensionsUpdateAction {
292
+ type: 'DIMENSIONS_UPDATE';
293
+ data: DimensionsUpdatePayload & {
294
+ data?: DimensionsUpdatePayload;
295
+ };
296
+ }
297
+ /** Content signals it has finished loading and its own loading state can be hidden. Confirmed
298
+ * on the wire as a flat `{eventName: 'HIDE_LOADER', data: null}` message. */
299
+ interface HideLoaderAction {
300
+ type: 'HIDE_LOADER';
301
+ }
302
+ /** Content requests cached program/reward data; answered with an empty REQUEST_API_RESULT (the
303
+ * SDK doesn't cache this separately), matching the Android bridge's stub response. */
304
+ interface RequestApiDataAction {
305
+ type: 'REQUEST_API_DATA';
306
+ data?: {
307
+ requestId?: string;
308
+ };
309
+ }
310
+ /** Content requests a fresh data refresh; answered with an empty REFRESH_API_DATA_RESULT,
311
+ * matching the Android bridge's stub response. */
312
+ interface RefreshApiDataAction {
313
+ type: 'REFRESH_API_DATA';
314
+ data?: {
315
+ requestId?: string;
316
+ };
317
+ }
318
+ /** Opens the wallet as a standalone popup — a dedicated shortcut distinct from
319
+ * OPEN_CG_WEBVIEW's own `content.type: "WALLET"` variant. */
320
+ interface OpenWalletAction {
321
+ type: 'OPEN_WALLET';
322
+ }
323
+ /** Opens an external link, always in a new tab/context — unlike REDIRECT, never appends
324
+ * userId and never navigates the current tab. */
325
+ interface OpenWebLinkAction {
326
+ type: 'OPEN_WEBLINK';
327
+ data: {
328
+ url: string;
329
+ };
330
+ }
331
+ /** Native-share request — WhatsApp/generic text share, or an image (handed to the host,
332
+ * since neither platform's share API can attach a remote image URL directly). */
333
+ interface ShareAction {
334
+ type: 'SHARE';
335
+ data?: {
336
+ text?: string;
337
+ image?: string;
338
+ channelName?: string;
339
+ };
340
+ }
341
+ /** Standalone game-completion signal — distinct from (and, per the Android/iOS SDKs, sent
342
+ * independently of) an ANALYTICS event whose nested event_name is also GAME_PLAYED. */
343
+ interface GamePlayedAction {
344
+ type: 'GAME_PLAYED';
345
+ data?: Record<string, unknown>;
346
+ }
347
+ /** Opens nested wallet/campaign/URL content from within an already-open campaign. */
348
+ interface OpenCgWebViewPayload {
349
+ content?: {
350
+ type?: string;
351
+ url?: string;
352
+ campaignId?: string;
353
+ };
354
+ container?: {
355
+ type?: string;
356
+ absoluteHeight?: string;
357
+ relativeHeight?: string;
358
+ };
359
+ hidePrevious?: string | boolean;
360
+ closeOnDeepLink?: string | boolean;
361
+ }
362
+ /** Mirrors OPEN_DEEPLINK: the native SDKs (Android GamificationJsBridge, iOS
363
+ * GamificationJSBridge) document this event as wrapped one level deeper on the wire
364
+ * (`data.data`) and unwrap it before reading `content`/`container`/`hidePrevious` — `data`'s
365
+ * own top-level fields are kept optional as a fallback for a flatter payload. See
366
+ * handleOpenCgWebView(). */
367
+ interface OpenCgWebViewAction {
368
+ type: 'OPEN_CG_WEBVIEW';
369
+ data?: OpenCgWebViewPayload & {
370
+ data?: OpenCgWebViewPayload;
371
+ };
372
+ }
373
+ type EntryPointAction = OpenContainerContentAction | ToggleContainerContentAction | CloseContainerContentAction | CloseAction | UpdateContentStateAction | RequestStateAction | RedirectAction | LoginAction | AnalyticsAction | RefreshAction | OpenDeepLinkAction | DimensionsUpdateAction | HideLoaderAction | RequestApiDataAction | RefreshApiDataAction | OpenWalletAction | OpenWebLinkAction | ShareAction | GamePlayedAction | OpenCgWebViewAction;
374
+ interface GamificationError {
375
+ code: string;
376
+ message: string;
377
+ cause?: unknown;
378
+ }
379
+ /** Host-facing lifecycle/event hooks for gamification — registered via
380
+ * WebSDK.setGamificationCallback(). Mirrors the Android SDK's GamificationCallback interface. */
381
+ interface GamificationCallback {
382
+ onInitSuccess?: () => void;
383
+ onInitFailure?: (error: GamificationError) => void;
384
+ onEntryPointsLoaded?: (entryPoints: EntryPoint[]) => void;
385
+ onCampaignOpened?: (campaignId: string) => void;
386
+ onCampaignClosed?: (campaignId: string) => void;
387
+ onAnalyticsEvent?: (data: unknown) => void;
388
+ onDeepLinkEvent?: (data: Record<string, unknown>) => void;
389
+ onGameEventTrigger?: (eventName: string, data: Record<string, unknown>) => void;
390
+ }
391
+ interface EntryPointConditions {
392
+ singleOpenName?: string;
393
+ priority?: number;
394
+ showCount?: {
395
+ count: number;
396
+ dailyRefresh?: boolean;
397
+ };
398
+ backendValidations: 'NOT_REQUIRED' | 'VALID' | 'INVALID';
399
+ timeWindow?: {
400
+ start: string;
401
+ end: string;
402
+ };
403
+ delay?: number;
404
+ paths: {
405
+ includePaths: string[];
406
+ excludePaths: string[];
407
+ };
408
+ isLoggedIn?: boolean;
409
+ backgroundOpacity?: number;
410
+ }
411
+ type ContainerTypeId = 'ICON_BUTTON' | 'NATIVE_BANNER' | 'CHAT_BOX' | 'POP_UP' | 'BOTTOM_SHEET' | 'EMBEDDED';
412
+ type ContentTypeId = 'CAMPAIGN' | 'STATIC' | 'WALLET' | 'DYNAMIC' | 'DYNAMIC_MULTISTEP_1' | 'DYNAMIC_MULTISTEP_2' | 'DYNAMIC_MULTISTEP_3' | 'NUDGE' | 'PROGRAM' | 'REWARD' | 'ACCEPT_GUARD';
413
+ interface IWidgetStateItem {
414
+ step: number;
415
+ state: string;
416
+ headerImage?: string;
417
+ title: string;
418
+ body: string;
419
+ badgeTag?: string;
420
+ ctaText?: string;
421
+ ctaAction?: unknown;
422
+ progressMeter?: {
423
+ completedText?: string;
424
+ };
425
+ progressBar?: {
426
+ progressRewardText?: string;
427
+ progressLabel?: string;
428
+ };
429
+ }
430
+ interface EntryPointContainer {
431
+ typeId: ContainerTypeId;
432
+ css: string;
433
+ height: string;
434
+ elementHookId: string;
435
+ }
436
+ interface EntryPointContent {
437
+ typeId: ContentTypeId;
438
+ campaignId?: string;
439
+ src?: string;
440
+ state?: unknown;
441
+ url?: string;
442
+ rewardUserId?: string;
443
+ action?: EntryPointAction;
444
+ conditions?: Record<string, unknown>;
445
+ IWidgetState?: IWidgetStateItem[];
446
+ widgetCss?: string;
447
+ progressBarIcon?: string;
448
+ progressMeterIcon?: string;
449
+ /** Only meaningful for an EMBEDDED container — appended to the Constellation URL when
450
+ * present. See Content.urlModifier(). */
451
+ rootId?: string;
452
+ }
453
+ interface EntryPoint {
454
+ id: string;
455
+ name?: string;
456
+ container: EntryPointContainer;
457
+ content: EntryPointContent;
458
+ conditions?: EntryPointConditions;
459
+ triggerType?: TriggerType;
460
+ actionEventConfig?: ActionEventConfig;
461
+ createdAt?: string;
462
+ }
463
+
193
464
  /**
194
465
  * WebSDK Core Initialization
195
466
  * Handles SDK bootstrap, lifecycle management, and main API
@@ -222,6 +493,31 @@ declare class WebSDK {
222
493
  private apiClient;
223
494
  private gamificationManager;
224
495
  private gamificationBaseUrl;
496
+ /**
497
+ * Buffers the last setGamificationCallback() call. init() is fire-and-forget — the Remote
498
+ * Config fetch, and therefore gamificationManager's construction, can still be in flight when
499
+ * a host calls setGamificationCallback() right after WebSDK.initialize() — the most natural
500
+ * place to put it. Without this, that call's `this.gamificationManager?.setGamificationCallback`
501
+ * would silently no-op with nothing to ever reapply it. Held here regardless of whether the
502
+ * manager exists yet, applied to it as soon as it's constructed (initializeAsync()) and again
503
+ * on every future call, mirroring the Android SDK's own gamificationCallback field.
504
+ */
505
+ private pendingGamificationCallback;
506
+ /**
507
+ * Buffers the latest call to setCapToken()/enablePagePathTracking()/onScreenChanged()/
508
+ * setGamificationSuppressed()/setTheme() made before gamificationManager exists — same race as
509
+ * pendingGamificationCallback above (init() is fire-and-forget; these are just as natural to
510
+ * call right after WebSDK.initialize()), but these five settings had no equivalent buffering
511
+ * at all, so `this.gamificationManager?.xxx(...)` silently no-op'd with nothing to ever
512
+ * reapply them. Replayed, in this declared order, as soon as the manager is constructed
513
+ * (applyPendingGamificationSettings()) by calling each real public setter — which still sets
514
+ * the manager's own "explicitlySet" guard (pagePathTrackingExplicitlySet/
515
+ * suppressedExplicitlySet/themeExplicitlySet), so a later restorePersistedXXX() call (run from
516
+ * initializeAsync() right after this) correctly defers to it instead of clobbering it with
517
+ * stale persisted history. Matches iOS, which keeps every one of these until the manager is
518
+ * ready.
519
+ */
520
+ private pendingGamificationSettings;
225
521
  constructor(config: WebSDKConfig);
226
522
  /**
227
523
  * Initialize the WebSDK singleton instance.
@@ -290,6 +586,16 @@ declare class WebSDK {
290
586
  static enablePagePathTracking(enabled: boolean): void;
291
587
  /** @see WebSDK.prototype.onScreenChanged */
292
588
  static onScreenChanged(screenName: string): void;
589
+ /** @see WebSDK.prototype.setGamificationSuppressed */
590
+ static setGamificationSuppressed(value: boolean): void;
591
+ /** @see WebSDK.prototype.setTheme */
592
+ static setTheme(theme: Theme): void;
593
+ /** @see WebSDK.prototype.forceSyncGamification */
594
+ static forceSyncGamification(): void;
595
+ /** @see WebSDK.prototype.setGamificationCallback */
596
+ static setGamificationCallback(callback: GamificationCallback | null): void;
597
+ /** @see WebSDK.prototype.isGamificationSuppressed */
598
+ static isGamificationSuppressed(): boolean;
293
599
  /** @see WebSDK.prototype.disableSDK */
294
600
  static disableSDK(): void;
295
601
  /** @see WebSDK.prototype.enableSDK */
@@ -316,6 +622,9 @@ declare class WebSDK {
316
622
  * If so, ends the session to prevent mixing events
317
623
  */
318
624
  private validateAndClearDifferentUserContext;
625
+ /** Storage key lastAuthenticatedUser is persisted under — shared by every read/write/clear
626
+ * site so they can never drift apart. */
627
+ private lastAuthenticatedUserKey;
319
628
  /**
320
629
  * Persist lastAuthenticatedUser to storage
321
630
  */
@@ -390,9 +699,24 @@ declare class WebSDK {
390
699
  */
391
700
  setUserContext(cuid: string, userIdentifierType?: UserIdentifierName): Promise<void>;
392
701
  /**
393
- * Clear user context (sign out equivalent)
394
- */
395
- clearUserContext(): Promise<void>;
702
+ * Clear user context (sign out equivalent). `resetIdentified` defaults to true for a real
703
+ * sign-out/teardown; pass `false` from validateAndClearDifferentUserContext()'s mid-switch
704
+ * call, which clears the *previous* user's context right before a *new* identified user takes
705
+ * over — resetting `userIdentified` there would otherwise be immediately (and silently)
706
+ * clobbered back to false, since nothing re-sets it afterward in the signin/signup flow.
707
+ *
708
+ * `resetIdentified` also gates clearing `lastAuthenticatedUser` (in-memory and persisted): a
709
+ * real sign-out forgets who was last authenticated, so e.g. a second `reset()` call with
710
+ * nobody signed in correctly no-ops instead of re-issuing a signout for the stale cuid. This
711
+ * is safe now that every signout unconditionally ends the session and clears context on its
712
+ * own (see resetToAnonymousMode()) — validateAndClearDifferentUserContext()'s own
713
+ * user-switch detection no longer needs `lastAuthenticatedUser` to survive past a signout to
714
+ * work correctly; it still works for a *direct* switch with no signout in between, since
715
+ * `lastAuthenticatedUser` is simply never cleared on that path at all.
716
+ */
717
+ clearUserContext(options?: {
718
+ resetIdentified?: boolean;
719
+ }): Promise<void>;
396
720
  /**
397
721
  * Track a behavioral event (fire-and-forget).
398
722
  * This is the recommended public API for tracking events.
@@ -404,7 +728,7 @@ declare class WebSDK {
404
728
  /**
405
729
  * Manually track a page view event.
406
730
  *
407
- * @param options - Optional page view options (url, title, category, properties)
731
+ * @param options - Optional page view options (page_url, page_title, page_category, properties)
408
732
  */
409
733
  pageView(options?: PageViewOptions): void;
410
734
  /**
@@ -491,6 +815,42 @@ declare class WebSDK {
491
815
  enablePagePathTracking(enabled: boolean): void;
492
816
  /** Report the current screen when path tracking is disabled — call on every navigation. */
493
817
  onScreenChanged(screenName: string): void;
818
+ /**
819
+ * Suppress (true) or resume (false) automatic gamification campaign rendering. While
820
+ * suppressed, campaigns that would otherwise open on their own (screen/path match) are
821
+ * skipped; explicit opens (openEntryPoint(), or a click inside an already-open campaign)
822
+ * are unaffected. Default false — a host that never calls this sees no behavior change.
823
+ * Resuming immediately re-evaluates display rules, so an eligible campaign shows right away.
824
+ */
825
+ setGamificationSuppressed(value: boolean): void;
826
+ /** Current suppression state set via setGamificationSuppressed(). Defaults to false. */
827
+ isGamificationSuppressed(): boolean;
828
+ /**
829
+ * Set the gamification theme: NONE (default, no theme-specific behavior), AUTO (resolves
830
+ * the browser's prefers-color-scheme at render time), DARK, or LIGHT. Affects the darkMode
831
+ * query param appended to subsequently loaded campaign/loyalty URLs, and the SDK's own
832
+ * container chrome and hand-built widget colors. An unrecognized value is logged and
833
+ * ignored. See DEVELOPER_GUIDE.md's Gamification section for details.
834
+ */
835
+ setTheme(theme: Theme): void;
836
+ /**
837
+ * Internal/testing use only — not part of the documented public API surface.
838
+ * Forces an immediate re-fetch of gamification campaigns/entry points, bypassing the normal
839
+ * staleness threshold, then re-evaluates display rules against the fresh data (closing an
840
+ * entry point that just completed or no longer matches, opening one that now does). Fire-and-
841
+ * forget, like other public tracking methods — see GamificationManager.forceSync() for details.
842
+ */
843
+ forceSyncGamification(): void;
844
+ /**
845
+ * Register a callback for gamification lifecycle/event hooks: init success/failure, entry
846
+ * points loaded, campaign opened/closed, analytics events, deep links, and game-event
847
+ * triggers with no matching campaign. Pass null to unregister. Safe to call at any time,
848
+ * including immediately after WebSDK.initialize() — gamificationManager may not exist yet
849
+ * (its construction waits on the Remote Config fetch), so the callback is buffered and
850
+ * applied as soon as it is, in addition to being applied immediately if it already exists.
851
+ * A no-op only if gamification is never enabled (gamificationWriteKey never configured).
852
+ */
853
+ setGamificationCallback(callback: GamificationCallback | null): void;
494
854
  /**
495
855
  * Push user signout event and return to anonymous mode (fire-and-forget)
496
856
  * Note: SDK continues to run for anonymous tracking after signout
@@ -506,6 +866,15 @@ declare class WebSDK {
506
866
  * Push behavioral event (fire-and-forget)
507
867
  */
508
868
  pushEvent(eventName: string, attributes?: Record<string, unknown>): void;
869
+ /**
870
+ * Push a gamification event (fire-and-forget). Shares the same durable events pipeline as
871
+ * pushEvent(), but is exempt from the visitor tracking gate: gamification events must keep
872
+ * flowing regardless of tracking consent. Internal use only — wired into GamificationManager.
873
+ * Auto-injects `cuid` when a user is identified (omitted for anonymous visitors) — an
874
+ * explicit `cuid` already present on `attributes` wins, though none of GamificationManager's
875
+ * own attribute builders set one today.
876
+ */
877
+ private pushGamificationEvent;
509
878
  /**
510
879
  * Internal async behavioral event logic
511
880
  */
@@ -554,6 +923,12 @@ declare class WebSDK {
554
923
  private bootstrapConfig;
555
924
  private getExtendedFieldsForMerge;
556
925
  private initializeManagersFromConfig;
926
+ /** Split out of initializeManagersFromConfig() to keep its cognitive complexity down. */
927
+ private initializeGamificationManager;
928
+ /** Replays setCapToken()/enablePagePathTracking()/onScreenChanged()/
929
+ * setGamificationSuppressed()/setTheme() calls made before gamificationManager existed — see
930
+ * pendingGamificationSettings' own comment for why that's otherwise silently lost. */
931
+ private applyPendingGamificationSettings;
557
932
  /**
558
933
  * Fetch configuration from Firebase Remote Config and apply to SDK
559
934
  * This is ALWAYS called during SDK initialization
@@ -570,7 +945,15 @@ declare class WebSDK {
570
945
  */
571
946
  private ensureInitialized;
572
947
  /**
573
- * Set user context if needed (for HydraSDK methods)
948
+ * Set user context if needed (for HydraSDK methods). "Needed" means either no context is set
949
+ * yet, or the incoming cuid differs from the currently-authenticated one — a same-user re-call
950
+ * (e.g. a redundant pushUserSignin() for the user already signed in) stays a no-op, same as
951
+ * before, but a direct switch to a *different* user (pushUserSignin(B) called while A is still
952
+ * signed in, with no intervening reset()/sign-out) now still runs setUserContext(), which
953
+ * detects the switch via validateAndClearDifferentUserContext() and transitions the
954
+ * EventTracker/session to the new user — previously, since userContextSet was already true
955
+ * from A, this guard skipped that entirely, leaving every event tagged with A's cuid while
956
+ * gamification loaded B's data.
574
957
  */
575
958
  private setUserContextIfNeeded;
576
959
  /**
@@ -581,4 +964,4 @@ declare class WebSDK {
581
964
  }
582
965
 
583
966
  export { WebSDK as HydraSDK, WebSDK as default };
584
- export type { DebugLevel, FirebaseConfig, Identifier, IdentifierType, IdentifyActionType, IdentifyParams, IdentifyTraits, NotificationConfig, NotificationPayload, NotificationState, PageViewOptions, UserAttributes, UserInfo, WebSDKConfig };
967
+ export type { DebugLevel, EntryPoint, FirebaseConfig, GamificationCallback, GamificationError, Identifier, IdentifierType, IdentifyActionType, IdentifyParams, IdentifyTraits, NotificationConfig, NotificationPayload, NotificationState, PageViewOptions, Theme, UserAttributes, UserInfo, WebSDKConfig };