• Decorator that subscribes to configuration data from the ConfigRepository.

    This decorator automatically updates the decorated property whenever configuration data changes in the platform. Returns an object with all configs where the config key is used as the key. It's the recommended approach over manual subscriptions as it handles subscription lifecycle automatically.

    Returns

    A PropertyDecorator that sets up automatic subscription to config data

    Remarks

    Subscribes to: ConfigRepository

    Updates: The decorated property with configuration data (object or specific value)

    Lifecycle: Automatically subscribes in connectedCallback and unsubscribes in disconnectedCallback

    Example

    Get all configuration data

    @State()
    @SelectConfig({})
    private config: Record<string, unknown>;

    render() {
    return (
    <div>
    <h2>Configuration</h2>
    <pre>{JSON.stringify(this.config, null, 2)}</pre>
    </div>
    );
    }

    Example

    Get specific config value by name

    @State()
    @SelectConfig({
    name: 'apiEndpoint',
    map: [(config) => config?.url || 'https://api.example.com']
    })
    private apiUrl: string;

    async fetchData() {
    const response = await fetch(`${this.apiUrl}/data`);
    return response.json();
    }

    Parameters

    Returns PropertyDecorator