import { StateOptions } from '../core'; /** * Config for the {@link SelectUserData} state decorator * @public * @group User data */ export interface SelectUserDataOptions extends StateOptions { /** * Key specifying the user data */ key?: string; } /** * Decorator that subscribes to user data from the {@link UserDataRepository}. * * This decorator automatically updates the decorated property whenever user data * changes in the platform. User data is persistent key-value storage associated * with the current user. You can optionally filter by a specific key. It's the * recommended approach over manual subscriptions as it handles subscription * lifecycle automatically. * * @param options - Configuration including key filtering and state transformation via {@link SelectUserDataOptions} * @returns A PropertyDecorator that sets up automatic subscription to user data * * @remarks * Subscribes to: {@link UserDataRepository} * * Updates: The decorated property with user data (object or specific value) * * Lifecycle: Automatically subscribes in `connectedCallback` and * `componentWillLoad`, and unsubscribes in `disconnectedCallback` * * @example Get all user data * ```ts * import { State } from '@stencil/core'; * import { SelectUserData } from '@limetech/lime-web-components'; * * class MyUserDataComponent { * @State() * @SelectUserData() * private userData: Record; * } * ``` * * @example Get specific user data by key with transformation * ```ts * import { State } from '@stencil/core'; * import { SelectUserData } from '@limetech/lime-web-components'; * * class MyThemedComponent { * // The key narrows the state to that one entry, so the value handed to map * // is the theme itself and not the whole user data object * @State() * @SelectUserData({ * key: 'theme', * map: [(theme) => theme || 'light'], * }) * private selectedTheme: string; * } * ``` * * @public * @group User data */ export declare function SelectUserData(options?: SelectUserDataOptions): PropertyDecorator;