uibuilder

package
v0.0.0-...-0fffe9f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSearchBoxToCache

func AddSearchBoxToCache(searchbox SearchBoxESModel)

func DeleteSearchBoxToCache

func DeleteSearchBoxToCache(id string)

func GetCachedSearchBoxes

func GetCachedSearchBoxes(filterHidden bool, filterEnabled bool) map[string]SearchBoxESModel

To retrieve the cached searchboxes

func GetFeaturedSuggestions

func GetFeaturedSuggestions(query *querytranslate.Query, value string) ([]querytranslate.SuggestionHIT, error)

Returns the featured suggestions

func MapToString

func MapToString(m interface{}) *string

func SetCachedSearchBoxes

func SetCachedSearchBoxes(searchBoxes []SearchBoxESModel)

Types

type DocumentPreferences

type DocumentPreferences struct {
	SectionLabel     *string `json:"sectionLabel,omitempty"`
	RenderSuggestion *string `json:"renderSuggestion,omitempty"`
}

type ESFeaturedSuggestionDoc

type ESFeaturedSuggestionDoc struct {
	Label        string                     `json:"label,omitempty"`
	Value        string                     `json:"value,omitempty"`
	Description  *string                    `json:"description,omitempty"`
	Action       *querytranslate.ActionType `json:"action,omitempty"`
	SearchboxId  *string                    `json:"searchboxId,omitempty"`
	Id           *string                    `json:"id,omitempty"`
	SubAction    *string                    `json:"subAction,omitempty"`
	SectionId    *string                    `json:"sectionId,omitempty"`
	SectionLabel *string                    `json:"sectionLabel,omitempty"`
	Icon         *string                    `json:"icon,omitempty"`
	IconURL      *string                    `json:"iconURL,omitempty"`
	Score        *float64                   `json:"_score,omitempty"`
	Order        *int                       `json:"order,omitempty"`
}

Featured suggestion document stored in ES

type Endpoint

type Endpoint struct {
	URL                 *string            `json:"url,omitempty"`
	Method              *string            `json:"method,omitempty"`
	HeadersMap          *map[string]string `json:"headers,omitempty"`
	BodyMap             *interface{}       `json:"body,omitempty"`
	Headers             *string            `json:"headers_string,omitempty"`
	Body                *string            `json:"body_string,omitempty"`
	IsUsingStringFormat bool               `json:"is_using_string_format,omitempty"`
}

Endpoint struct

type EndpointPreferences

type EndpointPreferences struct {
	SectionLabel                *string   `json:"sectionLabel,omitempty"`
	Endpoint                    *Endpoint `json:"endpoint,omitempty"`
	TransformResponse           *string   `json:"transformResponse,omitempty"`
	ShowDistinctSuggestions     *bool     `json:"showDistinctSuggestions,omitempty"`
	EnablePredictiveSuggestions *bool     `json:"enablePredictiveSuggestions,omitempty"`
	MaxPredictedWords           *int      `json:"maxPredictedWords,omitempty"`
	ApplyStopwords              *bool     `json:"applyStopwords,omitempty"`
	CustomStopwords             *[]string `json:"customStopwords,omitempty"`
	EnableSynonyms              *bool     `json:"enableSynonyms,omitempty"`
	IncludeFields               *[]string `json:"includeFields,omitempty"`
	ExcludeFields               *[]string `json:"excludeFields,omitempty"`
	URLField                    *string   `json:"urlField,omitempty"`
}

type Error

type Error struct {
	// contains filtered or unexported fields
}

type ExportAs

type ExportAs int
const (
	Embed ExportAs = iota
	Hackable
)

func (ExportAs) MarshalJSON

func (o ExportAs) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the Marshaler interface for marshaling ExportAs type.

func (ExportAs) String

func (o ExportAs) String() string

String is the implementation of Stringer interface that returns the string representation of ExportAs type.

func (*ExportAs) UnmarshalJSON

func (o *ExportAs) UnmarshalJSON(bytes []byte) error

UnmarshalJSON is the implementation of the Unmarshaler interface for unmarshaling ExportAs type.

type ExportSettings

type ExportSettings struct {
	ExportType  *ExportType            `json:"type"`
	OpenAsPage  bool                   `json:"openAsPage"`
	Credentials string                 `json:"credentials"`
	ExportAs    *ExportAs              `json:"exportAs"`
	Meta        map[string]interface{} `json:"meta,omitempty"`
}

type ExportType

type ExportType int
const (
	Other ExportType = iota
	Shopify
)

func (ExportType) MarshalJSON

func (o ExportType) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the Marshaler interface for marshaling SortBy type.

func (ExportType) String

func (o ExportType) String() string

String is the implementation of Stringer interface that returns the string representation of ExportType type.

func (*ExportType) UnmarshalJSON

func (o *ExportType) UnmarshalJSON(bytes []byte) error

UnmarshalJSON is the implementation of the Unmarshaler interface for unmarshaling ExportType type.

type FacetSettings

type FacetSettings struct {
	StaticFacets []struct {
		Name           *StaticFilterType `json:"name"`
		Enabled        bool              `json:"enabled"`
		IsCollapsible  bool              `json:"isCollapsible"`
		CustomMessages struct {
			Loading   string `json:"loading"`
			NoResults string `json:"noResults"`
		} `json:"customMessages"`
		RSConfig map[string]interface{} `json:"rsConfig"`
	} `json:"staticFacets"`
	DynamicFacets []struct {
		Enabled        bool `json:"enabled"`
		CustomMessages struct {
			Loading   string `json:"loading"`
			NoResults string `json:"noResults"`
		} `json:"customMessages"`
		RSConfig map[string]interface{} `json:"rsConfig"`
	} `json:"dynamicFacets"`
	Meta map[string]interface{} `json:"meta,omitempty"`
}

type FeaturedPreferences

type FeaturedPreferences struct {
	SectionLabel *string                 `json:"sectionLabel,omitempty"`
	Design       *map[string]interface{} `json:"design,omitempty"`
	Layout       *Layout                 `json:"layout,omitempty"`
}

type FeaturedSuggestionsCacheSyncScript

type FeaturedSuggestionsCacheSyncScript struct {
	// contains filtered or unexported fields
}

func (FeaturedSuggestionsCacheSyncScript) Index

func (FeaturedSuggestionsCacheSyncScript) PluginName

func (FeaturedSuggestionsCacheSyncScript) SetCache

type FeaturedSuggestionsConfig

type FeaturedSuggestionsConfig struct {
	// contains filtered or unexported fields
}

func (*FeaturedSuggestionsConfig) DeleteFeaturedSuggestions

func (featuredSuggestionsConfig *FeaturedSuggestionsConfig) DeleteFeaturedSuggestions(searchboxId string, idsToDelete *[]string) error

func (*FeaturedSuggestionsConfig) GetFeaturedSuggestions

func (featuredSuggestionsConfig *FeaturedSuggestionsConfig) GetFeaturedSuggestions(groupId string) ([]ESFeaturedSuggestionDoc, error)

Get saved featured suggestions

func (*FeaturedSuggestionsConfig) SearchFeaturedSuggestions

func (featuredSuggestionsConfig *FeaturedSuggestionsConfig) SearchFeaturedSuggestions(groupId string, value string) ([]ESFeaturedSuggestionDoc, error)

Returns the matched featured suggestions by value

func (*FeaturedSuggestionsConfig) UpdateFeaturedSuggestions

func (featuredSuggestionsConfig *FeaturedSuggestionsConfig) UpdateFeaturedSuggestions(searchboxId string, featuredSuggestions []ESFeaturedSuggestionDoc) error

Update the featured suggestions in ES index

type FusionSettings

type FusionSettings struct {
	App           string                 `json:"app"`
	Profile       string                 `json:"profile"`
	SearchProfile string                 `json:"searchProfile"`
	Meta          map[string]interface{} `json:"meta,omitempty"`
}

type GlobalSettings

type GlobalSettings struct {
	Currency            string                 `json:"currency"`
	ShowSelectedFilters bool                   `json:"showSelectedFilters"`
	Meta                map[string]interface{} `json:"meta,omitempty"`
}

type Layout

type Layout struct {
	Sections                 []SectionInfo `json:"sections,omitempty"`
	MaxSuggestionsPerSection *int          `json:"maxSuggestionsPerSection,omitempty"`
	SectionsOrder            *[]string     `json:"sectionsOrder,omitempty"`
}

type PreferenceType

type PreferenceType int
const (
	Search PreferenceType = iota
	Recommendation
)

func (PreferenceType) MarshalJSON

func (o PreferenceType) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the Marshaler interface for marshaling PreferenceType type.

func (PreferenceType) String

func (o PreferenceType) String() string

String is the implementation of Stringer interface that returns the string representation of PreferenceType type.

func (*PreferenceType) UnmarshalJSON

func (o *PreferenceType) UnmarshalJSON(bytes []byte) error

UnmarshalJSON is the implementation of the Unmarshaler interface for unmarshaling PreferenceType type.

type PutObjectToBucketRequest

type PutObjectToBucketRequest struct {
	MetaData map[string]string `json:"metadata"`
	Content  map[string]string `json:"content"`
}

type RSThemeConfig

type RSThemeConfig struct {
	Colors     ThemeColors     `json:"colors"`
	Typography ThemeTypography `json:"typography"`
}

type RecommendationPreference

type RecommendationPreference struct {
	ID                     string                  `json:"id"`
	Name                   string                  `json:"name"`
	Description            string                  `json:"description"`
	Pipeline               string                  `json:"pipeline"`
	Type                   PreferenceType          `json:"type"`
	DeploySettings         map[string]interface{}  `json:"deploySettings"`
	ThemeSettings          *ThemeSettings          `json:"themeSettings,omitempty"`
	GlobalSettings         *GlobalSettings         `json:"globalSettings,omitempty"`
	ResultSettings         *ResultSettings         `json:"resultSettings,omitempty"`
	ExportSettings         *ExportSettings         `json:"exportSettings,omitempty"`
	RecommendationSettings *RecommendationSettings `json:"recommendationSettings,omitempty"`
	UpdatedAt              *int64                  `json:"updated_at,omitempty"`
	CreatedAt              *int64                  `json:"created_at,omitempty"`
}

type RecommendationPreferenceRequest

type RecommendationPreferenceRequest struct {
	ID                     string                  `json:"id"`
	Name                   string                  `json:"name"`
	Description            string                  `json:"description"`
	Pipeline               string                  `json:"pipeline"`
	Type                   PreferenceType          `json:"type"`
	DeploySettings         map[string]interface{}  `json:"deploySettings"`
	ThemeSettings          *ThemeSettings          `json:"themeSettings,omitempty"`
	GlobalSettings         *GlobalSettings         `json:"globalSettings,omitempty"`
	ResultSettings         *ResultSettings         `json:"resultSettings,omitempty"`
	ExportSettings         *ExportSettings         `json:"exportSettings,omitempty"`
	RecommendationSettings *RecommendationSettings `json:"recommendationSettings,omitempty"`
}

type RecommendationSettings

type RecommendationSettings struct {
	CtaTitle        string `json:"ctaTitle"`
	CtaAction       string `json:"ctaAction"`
	Recommendations []struct {
		ID              string    `json:"id"`
		Title           string    `json:"title"`
		Type            string    `json:"type"`
		MaxProducts     int64     `json:"maxProducts"`
		ProductsPageUrl *string   `json:"productsPageUrl,omitempty"`
		DataField       *string   `json:"dataField,omitempty"`
		DocIds          *[]string `json:"docIds,omitempty"`
	} `json:"recommendations"`
	Meta map[string]interface{} `json:"meta,omitempty"`
}

type RecommendationsPreferences

type RecommendationsPreferences struct {
	ThemeSettings          *ThemeSettings          `json:"themeSettings,omitempty"`
	GlobalSettings         *GlobalSettings         `json:"globalSettings,omitempty"`
	ResultSettings         *ResultSettings         `json:"resultSettings,omitempty"`
	ExportSettings         *ExportSettings         `json:"exportSettings,omitempty"`
	RecommendationSettings *RecommendationSettings `json:"recommendationSettings,omitempty"`
}

type ResultSettings

type ResultSettings struct {
	Fields struct {
		Title       string `json:"title"`
		Description string `json:"description"`
		Price       string `json:"price"`
		Image       string `json:"image"`
		Handle      string `json:"handle"`
	} `json:"fields"`
	CustomMessages struct {
		ResultStats string `json:"resultStats"`
		NoResults   string `json:"noResults"`
	} `json:"customMessages"`
	RSConfig           map[string]interface{} `json:"rsConfig"`
	ViewSwitcher       bool                   `json:"viewSwitcher"`
	Layout             string                 `json:"layout"`
	Meta               map[string]interface{} `json:"meta,omitempty"`
	ResultHighlight    bool                   `json:"resultHighlight,omitempty"`
	MapLayout          string                 `json:"mapLayout,omitempty"`
	MapComponent       string                 `json:"mapComponent,omitempty"`
	DefaultZoom        int32                  `json:"defaultZoom,omitempty"`
	ShowSearchAsMove   bool                   `json:"showSearchAsMove"`
	ShowMarkerClusters bool                   `json:"showMarkerClusters"`
	MapsAPIKey         string                 `json:"mapsAPIkey,omitempty"`
	LocationDataField  string                 `json:"locationDataField,omitempty"`
}

type SearchBoxESFeaturedSuggestionDoc

type SearchBoxESFeaturedSuggestionDoc struct {
	Label       string                     `json:"label,omitempty"`
	Value       string                     `json:"value,omitempty"`
	Description *string                    `json:"description,omitempty"`
	Action      *querytranslate.ActionType `json:"action,omitempty"`
	Id          *string                    `json:"id,omitempty"`
	SubAction   *string                    `json:"subAction,omitempty"`
	Icon        *string                    `json:"icon,omitempty"`
	IconURL     *string                    `json:"iconURL,omitempty"`
}

Featured suggestion document stored in ES

type SearchBoxESModel

type SearchBoxESModel struct {
	Id          *string              `json:"id,omitempty"`
	Description *string              `json:"description,omitempty"`
	Enabled     *bool                `json:"enabled,omitempty"`
	Hidden      *bool                `json:"hidden,omitempty"`
	SearchBox   *SearchBoxPreference `json:"searchbox,omitempty"`
	CreatedAt   *int64               `json:"created_at,omitempty"`
	UpdatedAt   *int64               `json:"updated_at,omitempty"`
}

func GetCachedSearchBox

func GetCachedSearchBox(id string) *SearchBoxESModel

To retrieve the cached searchbox

type SearchBoxPreference

type SearchBoxPreference struct {
	Popular  *querytranslate.PopularSuggestionsOptions `json:"popular,omitempty"`
	Recent   *querytranslate.RecentSuggestionsOptions  `json:"recent,omitempty"`
	Endpoint *EndpointPreferences                      `json:"endpoint,omitempty"`
	Featured *FeaturedPreferences                      `json:"featured,omitempty"`
	Document *DocumentPreferences                      `json:"document,omitempty"`
	FAQ      *map[string]string                        `json:"faq,omitempty"`
}

type SearchPreference

type SearchPreference struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Pipeline    string         `json:"pipeline"`
	UpdatedAt   *int64         `json:"updated_at,omitempty"`
	CreatedAt   *int64         `json:"created_at,omitempty"`
	Type        PreferenceType `json:"type"`
	// New fields to store settings as string
	FusionSettings         *string `json:"fusionSettings_string,omitempty"`
	DeploySettings         *string `json:"deploySettings_string,omitempty"`
	AuthenticationSettings *string `json:"authenticationSettings_string,omitempty"`
	PageSettings           *string `json:"pageSettings_string,omitempty"`
	ComponentSettings      *string `json:"componentSettings_string,omitempty"`
	ThemeSettings          *string `json:"themeSettings_string,omitempty"`
	GlobalSettings         *string `json:"globalSettings_string,omitempty"`
	ResultSettings         *string `json:"resultSettings_string,omitempty"`
	ExportSettings         *string `json:"exportSettings_string,omitempty"`
	SearchSettings         *string `json:"searchSettings_string,omitempty"`
	FacetSettings          *string `json:"facetSettings_string,omitempty"`
	SyncSettings           *string `json:"syncSettings_string,omitempty"`
	// Older fields
	FusionSettingsStruct         *FusionSettings         `json:"fusionSettings"`
	DeploySettingsStruct         *map[string]interface{} `json:"deploySettings,omitempty"`
	AuthenticationSettingsStruct *map[string]interface{} `json:"authenticationSettings,omitempty"`
	PageSettingsStruct           *map[string]interface{} `json:"pageSettings,omitempty"`
	ComponentSettingsStruct      *map[string]interface{} `json:"componentSettings,omitempty"`
	ThemeSettingsStruct          *ThemeSettings          `json:"themeSettings,omitempty"`
	GlobalSettingsStruct         *GlobalSettings         `json:"globalSettings,omitempty"`
	ResultSettingsStruct         *ResultSettings         `json:"resultSettings,omitempty"`
	ExportSettingsStruct         *ExportSettings         `json:"exportSettings,omitempty"`
	SearchSettingsStruct         *SearchSettings         `json:"searchSettings,omitempty"`
	FacetSettingsStruct          *FacetSettings          `json:"facetSettings,omitempty"`
	SyncSettingsStruct           *map[string]interface{} `json:"syncSettings"`
	// To track if using new fields
	IsUsingStringFields bool `json:"isUsingStringFields"`
}

type SearchPreferenceRequest

type SearchPreferenceRequest struct {
	ID                     string                 `json:"id"`
	Name                   string                 `json:"name"`
	Description            string                 `json:"description"`
	Pipeline               string                 `json:"pipeline"`
	Type                   PreferenceType         `json:"type"`
	DeploySettings         map[string]interface{} `json:"deploySettings"`
	AuthenticationSettings map[string]interface{} `json:"authenticationSettings,omitempty"`
	ThemeSettings          *ThemeSettings         `json:"themeSettings,omitempty"`
	FusionSettings         *FusionSettings        `json:"fusionSettings,omitempty"`
	PageSettings           map[string]interface{} `json:"pageSettings,omitempty"`
	ComponentSettings      map[string]interface{} `json:"componentSettings,omitempty"`
	GlobalSettings         *GlobalSettings        `json:"globalSettings,omitempty"`
	ResultSettings         *ResultSettings        `json:"resultSettings,omitempty"`
	ExportSettings         *ExportSettings        `json:"exportSettings,omitempty"`
	SearchSettings         *SearchSettings        `json:"searchSettings,omitempty"`
	FacetSettings          *FacetSettings         `json:"facetSettings,omitempty"`
	SyncSettings           map[string]interface{} `json:"syncSettings"`
}

type SearchPreferences

type SearchPreferences struct {
	ThemeSettings     *ThemeSettings         `json:"themeSettings,omitempty"`
	FusionSettings    *FusionSettings        `json:"fusionSettings,omitempty"`
	PageSettings      map[string]interface{} `json:"pageSettings,omitempty"`
	ComponentSettings map[string]interface{} `json:"componentSettings,omitempty"`
	GlobalSettings    *GlobalSettings        `json:"globalSettings,omitempty"`
	ResultSettings    *ResultSettings        `json:"resultSettings,omitempty"`
	ExportSettings    *ExportSettings        `json:"exportSettings,omitempty"`
	SearchSettings    *SearchSettings        `json:"searchSettings,omitempty"`
	FacetSettings     *FacetSettings         `json:"facetSettings,omitempty"`
	SyncSettings      map[string]interface{} `json:"syncSettings"`
}

type SearchSettings

type SearchSettings struct {
	// To override the fields to display suggestions
	// We don't support this in UI right now
	Fields struct {
		Title       string `json:"title"`
		Description string `json:"description"`
		Price       string `json:"price"`
		Image       string `json:"image"`
		Handle      string `json:"handle"`
	} `json:"fields"`
	CustomMessages struct {
		NoResults string `json:"noResults"`
	} `json:"customMessages"`
	RSConfig     map[string]interface{} `json:"rsConfig"`
	SearchButton struct {
		Icon string `json:"icon"`
		Text string `json:"text"`
	} `json:"searchButton"`
	RedirectURLIcon string                 `json:"redirectUrlIcon,omitempty"`
	RedirectURLText string                 `json:"redirectUrlText,omitempty"`
	Meta            map[string]interface{} `json:"meta,omitempty"`
}

type SectionInfo

type SectionInfo struct {
	Id          *string                            `json:"id,omitempty"`
	Label       *string                            `json:"label,omitempty"`
	Suggestions []SearchBoxESFeaturedSuggestionDoc `json:"suggestions,omitempty"`
}

type StaticFilterType

type StaticFilterType int
const (
	ProductType StaticFilterType = iota
	Collection
	Color
	Size
	Price
)

func (StaticFilterType) MarshalJSON

func (o StaticFilterType) MarshalJSON() ([]byte, error)

MarshalJSON is the implementation of the Marshaler interface for marshaling SortBy type.

func (StaticFilterType) String

func (o StaticFilterType) String() string

String is the implementation of Stringer interface that returns the string representation of StaticFilterType type.

func (*StaticFilterType) UnmarshalJSON

func (o *StaticFilterType) UnmarshalJSON(bytes []byte) error

UnmarshalJSON is the implementation of the Unmarshaler interface for unmarshaling StaticFilterType type.

type ThemeColors

type ThemeColors struct {
	PrimaryColor     string `json:"primaryColor"`
	PrimaryTextColor string `json:"primaryTextColor"`
	TextColor        string `json:"textColor"`
	TitleColor       string `json:"titleColor"`
}

type ThemeSettings

type ThemeSettings struct {
	Type      string                 `json:"type"`
	RSConfig  RSThemeConfig          `json:"rsConfig"`
	CustomCSS string                 `json:"customCss"`
	Meta      map[string]interface{} `json:"meta,omitempty"`
}

type ThemeTypography

type ThemeTypography struct {
	FontFamily string `json:"fontFamily"`
}

type UIBuilder

type UIBuilder struct {
	// contains filtered or unexported fields
}

func Instance

func Instance() *UIBuilder

Instance returns the singleton instance of Logs plugin. Note: Only this function must be used (both within and outside the package) to obtain the instance Logs in order to avoid stateless instances of the plugin.

func (*UIBuilder) AlternateRoutes

func (p *UIBuilder) AlternateRoutes() []plugins.Route

Expose plugin specific routes

func (*UIBuilder) ESMiddleware

func (p *UIBuilder) ESMiddleware() []middleware.Middleware

ESMiddleware is a default empty middleware function

func (*UIBuilder) InitFunc

func (e *UIBuilder) InitFunc() error

InitFunc is a part of Plugin interface that gets executed only once, and initializes the dao, i.e. elasticsearch before the plugin is operational.

func (*UIBuilder) Name

func (e *UIBuilder) Name() string

Name returns the name of the plugin: "logs"

func (*UIBuilder) RSMiddleware

func (p *UIBuilder) RSMiddleware() []middleware.Middleware

RSMiddleware is a default empty middleware function

func (*UIBuilder) Routes

func (e *UIBuilder) Routes() []plugins.Route

Routes returns an empty slice of routes, since Logs is solely a middleware.

type UIBuilderPreferencesMigration

type UIBuilderPreferencesMigration struct {
	// contains filtered or unexported fields
}

func (UIBuilderPreferencesMigration) ConditionCheck

func (m UIBuilderPreferencesMigration) ConditionCheck() (bool, *util.Error)

func (UIBuilderPreferencesMigration) IsAsync

func (m UIBuilderPreferencesMigration) IsAsync() bool

func (UIBuilderPreferencesMigration) Script

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL