UGC Widgets
    Preparing search index...

    Interface ConfigSDK

    The Config SDK provides helper methods for accessing and updating widget configuration options such as style, tile options, and claim settings. Use this SDK to retrieve and mutate configuration for expanded tiles, inline tiles, claim settings, and widget style. It also provides helpers to check pagination and scroll settings.

    interface ConfigSDK {
        getExpandedTileConfig: () => ExpandedTileOptions;
        getInlineTileConfig: () => InlineTileOptions;
        getStyleConfig: () => Style;
        isPaginationEnabled: () => boolean;
        isScrollWidget: () => boolean;
        updateExpandedTileOptions: (
            mutatedExpandedTileOptions: Partial<InlineTileOptions>,
        ) => void;
        updateInlineTileOptions: (
            mutatedInlineTileOptions: Partial<InlineTileOptions>,
        ) => void;
        updateWidgetStyle: (mutatedStyle: Partial<Style>) => void;
    }
    Index

    Properties

    getExpandedTileConfig: () => ExpandedTileOptions

    Get the tile configuration for the expanded tile

    // Get expanded tile config and check if shopspots are shown
    const config = sdk.getExpandedTileConfig();
    if (config.show_shopspots) {
    // do something
    }
    getInlineTileConfig: () => InlineTileOptions

    Get the tile configuration for the inline tile

    // Access inline tile options and update a property
    const inlineConfig = sdk.getInlineTileConfig();
    inlineConfig.show_shopspots = false;
    getStyleConfig: () => Style

    Type declaration

      • (): Style
      • Returns Style

    Get properties relating to styling for the widget

    // Get the widget style and log the background color
    const style = sdk.getStyleConfig();
    console.log(style.background_color);
    isPaginationEnabled: () => boolean

    Type declaration

      • (): boolean
      • Returns boolean

    See if pagination is enabled based on style configuration This checks if the load_more_type is set to scroll or button

    // Returns true if pagination is enabled (scroll or button)
    sdk.isPaginationEnabled();
    isScrollWidget: () => boolean

    Type declaration

      • (): boolean
      • Returns boolean

    Check if the widget is a scroll widget

    // Returns true if the widget uses scroll for pagination
    sdk.isScrollWidget();
    updateExpandedTileOptions: (
        mutatedExpandedTileOptions: Partial<InlineTileOptions>,
    ) => void

    Update the expanded tile options

    // Enable shopspots in expanded tiles
    sdk.updateExpandedTileOptions({ show_shopspots: true });
    updateInlineTileOptions: (
        mutatedInlineTileOptions: Partial<InlineTileOptions>,
    ) => void

    Update the inline tile options

    // Hide shopspots in inline tiles
    sdk.updateInlineTileOptions({ show_shopspots: false });
    updateWidgetStyle: (mutatedStyle: Partial<Style>) => void

    Update the widget style

    // Change the widget background color
    sdk.updateWidgetStyle({ background_color: '#fff' });