import { WxtStorageItem } from "wxt/storage"; export const defaultPreferences = { favoritedPlaces: { enabled: true }, bestFriends: { enabled: true }, forumMentions: { enabled: true }, improvedFriendLists: { enabled: true }, irlBrickPrice: { enabled: true }, hideNotificationBadges: { enabled: false }, storeOwnedTags: { enabled: true }, membershipThemes: { enabled: false, themeId: "plus" }, tryItems: { enabled: true }, outfitCost: { enabled: true }, placeRevenue: { enabled: true }, accurateOwners: { enabled: true } } export type preferencesSchema = typeof defaultPreferences & { [key: string]: any; }; // Sync interface PreferencesStorageItem extends WxtStorageItem { /** * Wrapper for the standard `.getValue()` method that merges the user's saved preferences with the default preferences to make sure there are no unexpected errors. */ getPreferences: () => Promise; } export const preferences: PreferencesStorageItem = storage.defineItem('sync:preferences', { fallback: defaultPreferences, version: 1 }) as PreferencesStorageItem; export const _favoritedPlaces = storage.defineItem('sync:favoritedPlaces', { fallback: ["9656"], version: 1 }); export const _bestFriends = storage.defineItem('sync:bestFriends', { fallback: ["2782"], version: 1 }); preferences.getPreferences = async function() { const userPreferences = await this.getValue(); return { ...defaultPreferences, ...userPreferences }; }; // Cache export const cache = storage.defineItem('local:cache', { fallback: { favoritedPlaces: [], bestFriends: [], inventory: [], userIDs: {}, avatars: {}, items: {}, placeRevenue: {}, ownerCount: {} }, version: 1 });