Skip to content

Preferences

Defined in: sdks/js/browser-sdk/src/Preferences.ts:21

Manages user preferences and consent states

This class is not intended to be initialized directly.

new Preferences(worker): Preferences

Defined in: sdks/js/browser-sdk/src/Preferences.ts:29

Creates a new preferences instance

WorkerBridge<ClientWorkerAction>

The worker bridge that manages preferences

Preferences

fetchInboxState(): Promise<InboxState>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:53

Retrieves the latest inbox state of this client from the network

Promise<InboxState>

Promise that resolves with the inbox state


fetchInboxStates(inboxIds): Promise<InboxState[]>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:79

Retrieves the latest inbox states for specified inbox IDs from the network

string[]

Array of inbox IDs to get state for

Promise<InboxState[]>

Promise that resolves with the inbox states for the inbox IDs


getConsentState(entityType, entity): Promise<ConsentState>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:105

Retrieves consent state for a specific entity

ConsentEntityType

Type of entity to get consent for

string

Entity identifier

Promise<ConsentState>

Promise that resolves with the consent state


getInboxStates(inboxIds): Promise<InboxState[]>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:66

Retrieves the current inbox states for specified inbox IDs from the local database

string[]

Array of inbox IDs to get state for

Promise<InboxState[]>

Promise that resolves with the inbox states for the inbox IDs


inboxState(): Promise<InboxState>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:42

Retrieves the current inbox state of this client from the local database

Promise<InboxState>

Promise that resolves with the inbox state


setConsentStates(records): Promise<void>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:92

Updates consent states for multiple records

Consent[]

Array of consent records to update

Promise<void>

Promise that resolves when consent states are updated


streamConsent(options?): Promise<AsyncStreamProxy<Consent[]>>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:121

Creates a stream of consent state updates

StreamOptions<Consent[]>

Optional stream options

Promise<AsyncStreamProxy<Consent[]>>

Stream instance for consent updates


streamPreferences(options?): Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:151

Creates a stream of user preference updates

StreamOptions<UserPreferenceUpdate[]>

Optional stream options

Promise<AsyncStreamProxy<UserPreferenceUpdate[]>>

Stream instance for preference updates


sync(): Promise<GroupSyncSummary>

Defined in: sdks/js/browser-sdk/src/Preferences.ts:33

Promise<GroupSyncSummary>