Maestro Web SDK - User Settings
Overview
The User Settings feature allows client applications to customize the Maestro SDK behavior based on user preferences. This enables personalized experiences including panel hiding and feature disabling.
Basic Configuration
import SDK, { IUserSettings } from "@maestro_io/maestro-web-sdk";
const userSettings: IUserSettings = {
panels: {
bets: {
hidePanel: false,
hideWagers: true,
},
stats: {
hidePanel: false,
},
keyPlays: {
hidePanel: false,
},
},
};
// Configure SDK with user settings
SDK.configure({
siteID: "your-site-id",
userSettings: userSettings,
});
Event-Specific Settings
// Start watching an event with specific settings
const maestroEvent = await SDK.userDidStartWatchingEvent(
"event-id",
delegate,
userSettings
);
API Reference
Interfaces
IUserSettings
interface IUserSettings {
panels?: {
bets?: {
hidePanel?: boolean;
hideWagers?: boolean;
};
stats?: {
hidePanel?: boolean;
};
keyPlays?: {
hidePanel?: boolean;
};
};
}
SDKConfigParams
interface SDKConfigParams {
siteID: string;
environment?: "development" | "production";
userSettings?: IUserSettings;
// ... other configuration options
}
Methods
configure(params: SDKConfigParams)
Configure the SDK with user settings:
SDK.configure({
siteID: "your-site-id",
userSettings: {
panels: {
bets: { hidePanel: true },
},
},
});
userDidStartWatchingEvent(eventId, delegate, userSettings?)
Start watching an event with optional user settings:
const maestroEvent = await SDK.userDidStartWatchingEvent("event-id", delegate, {
panels: {
bets: { hideWagers: true },
},
});
updateUserSettings(settings: IUserSettings)
Update user settings in real-time:
await maestroEvent.updateUserSettings({
panels: {
bets: { hideWagers: false },
},
});
Dynamic Settings Updates
class UserPreferencesManager {
private maestroEvent: any;
async updateBettingPreferences(hidePanels: boolean, hideWagers: boolean) {
await this.maestroEvent.updateUserSettings({
panels: {
bets: {
hidePanel: hidePanels,
hideWagers: hideWagers,
},
},
});
}
async updateStatsPreferences(hidePanel: boolean) {
await this.maestroEvent.updateUserSettings({
panels: {
stats: {
hidePanel: hidePanel,
},
},
});
}
}
Examples
Complete Implementation Example
import SDK, { IUserSettings } from "@maestro_io/maestro-web-sdk";
class MaestroIntegration {
private maestroEvent: any;
async initialize() {
const userSettings: IUserSettings = {
panels: {
bets: {
hidePanel: false,
hideWagers: true,
},
stats: {
hidePanel: false,
},
},
};
SDK.configure({
siteID: "your-site-id",
environment: "production",
userSettings,
});
this.maestroEvent = await SDK.userDidStartWatchingEvent(
"event-id",
this.delegate
);
}
async updateUserPreferences(preferences: any) {
try {
await this.maestroEvent.updateUserSettings({
panels: {
bets: {
hidePanel: preferences.hideBettingPanel,
hideWagers: preferences.hideWagers,
},
stats: {
hidePanel: preferences.hideStatsPanel,
},
},
});
} catch (error) {
console.error("Failed to update user settings:", error);
}
}
private delegate = {
// Your delegate implementation
};
}