1.0.27 • Published 5 months ago

@searchstax-inc/searchstudio-ux-vue v1.0.27

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

sitesearch-ux-vue

Library to build Site Search page

changelog

changelog is documented at CHANGELOG.md

Installation

npm install following package npm install --save @searchstax-inc/searchstudio-ux-vue

Add following code to <head>

<script type="text/javascript">
      var _msq = _msq || []; //declare object
      var analyticsBaseUrl = 'https://analytics-us-east.searchstax.co';
      (function () {
        var ms = document.createElement('script');
        ms.type = 'text/javascript';
        ms.src = 'https://static.searchstax.co/studio-js/v3/js/studio-analytics.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ms, s);
      })();
    </script>

Usage

After importing SearchstaxWrapper component needs to wrap all other components:

<SearchstaxWrapper
    :language="sampleConfig.language"
    :searchURL="sampleConfig.searchURL"
    :suggesterURL="sampleConfig.suggesterURL"
    :trackApiKey="sampleConfig.trackApiKey"
    :searchAuth="sampleConfig.searchAuth"
    :authType="sampleConfig.authType"
    :router="sampleConfig.router"
    :beforeSearch="sampleConfig.hooks.beforeSearch" // callback function to intercept search object before search is fired
    :afterSearch="sampleConfig.hooks.afterSearch" //  callback function to handle results after search is fired

  >
  // other components will go there

  </SearchstaxWrapper>

Initialization

Initialization object needs to be of type: ISearchstaxConfig

Initialization example

sampleConfig = {
    language: "en",
    searchURL: "",
    suggesterURL: "",
    trackApiKey: "",
    searchAuth: "",
    authType: "basic",
    router: {
      enabled: true,
      routeName: "searchstax",
      title: (result: ISearchObject) => {
        return "Search results for: " + result.query;
      },
      ignoredKeys: [],
    },
    hooks: {
      beforeSearch: function (props: ISearchObject) {
        const propsCopy = { ...props };
        return propsCopy;
      },
      afterSearch: function (results: ISearchstaxParsedResult[]) {
        const copy = [...results];
        return copy;
      },
    }
  };

Initial layout

Our base theme is designed with this layout in mind but it is optional as all widgets have id parameters and can be attached to any element.

<SearchstaxWrapper
    :language="sampleConfig.language"
    :searchURL="sampleConfig.searchURL"
    :suggesterURL="sampleConfig.suggesterURL"
    :trackApiKey="sampleConfig.trackApiKey"
    :searchAuth="sampleConfig.searchAuth"
    :authType="sampleConfig.authType"
    :router="sampleConfig.router"
    :beforeSearch="sampleConfig.hooks.beforeSearch" // callback function to intercept search object before search is fired
    :afterSearch="sampleConfig.hooks.afterSearch" //  callback function to handle results after search is fired
  >
    <template #default>
      <div class="searchstax-page-layout-container">
        <SearchstaxInputWidget
          :afterAutosuggest="afterAutosuggest"
          :beforeAutosuggest="beforeAutosuggest"
          :suggestAfterMinChars="3"
        >
        </SearchstaxInputWidget>
        <div class="search-details-container">
          <SearchstaxSearchFeedbackWidget></SearchstaxSearchFeedbackWidget>
          <SearchstaxSortingWidget></SearchstaxSortingWidget>
        </div>
        <div class="searchstax-page-layout-facet-result-container">
          <div class="searchstax-page-layout-facet-container">
            <SearchstaxFacetsWidget
              :facetingType="'or'"
              :itemsPerPageDesktop="3"
              :itemsPerPageMobile="99"
            >
            </SearchstaxFacetsWidget>
          </div>
          <div class="searchstax-page-layout-result-container">
            <div id="searchstax-external-promotions-layout-container"></div>
            <SearchstaxResultWidget :afterLinkClick="afterLinkClick">
            </SearchstaxResultWidget>
            <div id="searchstax-related-searches-container"></div>
            <SearchstaxPaginationWidget>
            </SearchstaxPaginationWidget>
          </div>
        </div>
      </div>
    </template>
  </SearchstaxWrapper>

widgets

Following widgets are available:

Answer Widget

Input Widget

Result Widget

Facets Widget

Pagination Widget

SearchFeedback Widget

RelatedSearches Widget

ExternalPromotions Widget

sorting Widget

Answer Widget

example of answer widget initialization with minimum options

  <SearchstaxAnswerWidget :showShowMoreAfterWordCount="10"></SearchstaxAnswerWidget>

example of answer widget initialization with lightweight feedback widget

feedbackConfig = {
    renderFeedbackWidget: true,
    emailOverride: () => '',
    thumbsUpValue: 10,
    thumbsDownValue: 0,
    lightweightTemplateOverride: `
 <div class="searchstax-lightweight-widget-container">
 <div class="searchstax-lightweight-widget-thumbs-up {{#thumbsUpActive}}active{{/thumbsUpActive}}">
 <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path d="M4.85079 7.59996L7.83141 1C8.4243 1 8.9929 1.23178 9.41213 1.64436C9.83136 2.05694 10.0669 2.61651 10.0669 3.19999V6.1333H14.2845C14.5005 6.13089 14.7145 6.17474 14.9116 6.26179C15.1087 6.34885 15.2842 6.47704 15.426 6.63747C15.5677 6.79791 15.6723 6.98676 15.7326 7.19094C15.7928 7.39513 15.8072 7.60975 15.7748 7.81996L14.7465 14.4199C14.6926 14.7696 14.5121 15.0884 14.2382 15.3175C13.9643 15.5466 13.6156 15.6706 13.2562 15.6666H4.85079M4.85079 7.59996V15.6666M4.85079 7.59996H2.61531C2.22006 7.59996 1.84099 7.75448 1.5615 8.02953C1.28201 8.30458 1.125 8.67763 1.125 9.06661V14.1999C1.125 14.5889 1.28201 14.9619 1.5615 15.237C1.84099 15.512 2.22006 15.6666 2.61531 15.6666H4.85079"  stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>
</div>
 <div class="searchstax-lightweight-widget-separator"></div>
 <div class="searchstax-lightweight-widget-thumbs-down {{#thumbsDownActive}}active{{/thumbsDownActive}}">
  <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path d="M12.1492 9.06801L9.16859 15.668C8.5757 15.668 8.0071 15.4362 7.58787 15.0236C7.16864 14.611 6.93311 14.0515 6.93311 13.468V10.5347H2.71552C2.4995 10.5371 2.28552 10.4932 2.08842 10.4062C1.89132 10.3191 1.71581 10.1909 1.57405 10.0305C1.43229 9.87006 1.32766 9.6812 1.26743 9.47702C1.2072 9.27284 1.19279 9.05822 1.22521 8.84801L2.25353 2.24806C2.30742 1.89833 2.48793 1.57955 2.76179 1.35046C3.03566 1.12136 3.38443 0.997398 3.74384 1.0014H12.1492M12.1492 9.06801V1.0014M12.1492 9.06801H14.3847C14.7799 9.06801 15.159 8.91349 15.4385 8.63844C15.718 8.36339 15.875 7.99034 15.875 7.60135V2.46805C15.875 2.07907 15.718 1.70602 15.4385 1.43097C15.159 1.15592 14.7799 1.0014 14.3847 1.0014H12.1492"  stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
  </svg>

 </div>
 </div>
  `
  }
  <SearchstaxAnswerWidget :showShowMoreAfterWordCount="100" :feedbackwidget="feedbackConfig">
      <template #answer="{ answerData, showMore }">
        <div v-if="answerData && answerData?.searchExecuted && answerData.shouldShowAnswer">
          <div class="searchstax-answer-wrap">
            <div class="searchstax-answer-icon"></div>
            <div>
              <div
                :class="
                  'searchstax-answer-container ' + answerData.showMoreButtonVisible
                    ? 'searchstax-answer-show-more'
                    : ''
                "
              >
                <div class="searchstax-answer-title">Smart Answers</div>
                <div class="searchstax-answer-error" v-if="answerData.shouldShowAnswerError" v-html="answerData.answerErrorMessage"></div>
                <div
                  class="searchstax-answer-description"
                  v-html="answerData.fullAnswerFormatted"
                ></div>
                <div v-if="answerData.answerLoading" class="searchstax-answer-loading"></div>
              </div>
              <div
                v-if="answerData.showMoreButtonVisible"
                class="searchstax-answer-load-more-button-container"
              >
                <button class="searchstax-answer-load-more-button" @click="showMore">
                  Read More
                </button>
              </div>
            </div>
            <div class="searchstax-answer-footer">
              <div id="feedbackWidgetContainer"></div>
              <div class="searchstax-lightweight-widget-separator-inline"></div>
              <p class="searchstax-disclaimer">Generative AI is Experimental</p>
            </div>
          </div>
        </div>
      </template>
    </SearchstaxAnswerWidget>

example of answer widget initialization without feedback widget

  <SearchstaxAnswerWidget :showShowMoreAfterWordCount="10">
      <template #answer="{ answerData, showMore }">
        <div v-if="answerData && answerData?.searchExecuted && answerData.shouldShowAnswer">
          <div class="searchstax-answer-wrap">
            <div class="searchstax-answer-icon"></div>
            <div>
              <div
                :class="
                  'searchstax-answer-container ' + answerData.showMoreButtonVisible
                    ? 'searchstax-answer-show-more'
                    : ''
                "
              >
                <div class="searchstax-answer-title">Smart Answers</div>
                <div class="searchstax-answer-error" v-if="answerData.shouldShowAnswerError" v-html="answerData.answerErrorMessage"></div>
                <div
                  class="searchstax-answer-description"
                  v-html="answerData.fullAnswerFormatted"
                ></div>
                <div v-if="answerData.answerLoading" class="searchstax-answer-loading"></div>
              </div>
              <div
                v-if="answerData.showMoreButtonVisible"
                class="searchstax-answer-load-more-button-container"
              >
                <button class="searchstax-answer-load-more-button" @click="showMore">
                  Read More
                </button>
              </div>
            </div>
            <div class="searchstax-answer-footer">
              <div id="feedbackWidgetContainer"></div>
              <div class="searchstax-lightweight-widget-separator-inline"></div>
              <p class="searchstax-disclaimer">Generative AI is Experimental</p>
            </div>
          </div>
        </div>
      </template>
    </SearchstaxAnswerWidget>

Input Widget

example of input widget initialization with minimum options

<SearchstaxInputWidget
          :afterAutosuggest="afterAutosuggest"
          :beforeAutosuggest="beforeAutosuggest"
          :suggestAfterMinChars="3"
        ></SearchstaxInputWidget>

example of input widget initialization with template override

<SearchstaxInputWidget
          :afterAutosuggest="afterAutosuggest"
          :beforeAutosuggest="beforeAutosuggest"
          :suggestAfterMinChars="3"
        >
          <template #input="{ suggestions, onMouseLeave, onMouseOver, onMouseClick }">
            <div class="searchstax-search-input-wrapper">
              <input
                type="text"
                id="searchstax-search-input"
                class="searchstax-search-input"
                placeholder="SEARCH FOR..."
              />
              <div
                class="searchstax-autosuggest-container"
                :class="{ 'hidden': suggestions.length === 0 }"
                @mouseleave="onMouseLeave"
              >
                <div
                  class="searchstax-autosuggest-item"
                  v-for="suggestion in suggestions"
                  :key="suggestion.term"
                >
                  <div
                    class="searchstax-autosuggest-item-term-container"
                    v-html="suggestion.term"
                    @mouseover="onMouseOver(suggestion)"
                    @click.stop="onMouseClick()"
                  ></div>
                </div>
              </div>
              <button
                class="searchstax-spinner-icon"
                id="searchstax-search-input-action-button"
              >
              </button>
            </div>
          </template>
        </SearchstaxInputWidget>

Result Widget

example of results widget initialization with minimum options

<SearchstaxResultWidget :afterLinkClick="afterLinkClick"></SearchstaxResultWidget>

example of results widget initialization with infinite scroll behavior

<SearchstaxResultWidget :afterLinkClick="afterLinkClick" :renderMethod="'infiniteScroll'"></SearchstaxResultWidget>

example of result widget initialization with template override

 <SearchstaxResultWidget :afterLinkClick="afterLinkClick">
              <template #results="{ searchResults, resultClicked }">
                <div
                  class="searchstax-search-results"
                  v-if="searchResults && searchResults.length"
                >
                  <div
                    class="searchstax-search-result"
                    :class="{ 'has-thumbnail': searchResult.thumbnail }"
                    :key="searchResult.uniqueId"
                    v-for="searchResult in searchResults"
                  >
                    <div
                      v-if="searchResult.promoted"
                      class="searchstax-search-result-promoted"
                    ></div>
                    <a
                      v-if="searchResult.url"
                      :href="searchResult.url"
                      :data-searchstax-unique-result-id="searchResult.uniqueId"
                      @click="resultClicked(searchResult, $event)"
                      class="searchstax-result-item-link"
                    ></a>
                    <div
                      v-if="searchResult.ribbon"
                      class="searchstax-search-result-ribbon"
                    > {{ searchResult.ribbon }} </div>
                    <img
                      v-if="searchResult.thumbnail"
                      :src="searchResult.thumbnail"
                      class="searchstax-thumbnail"
                    />
                    <div class="searchstax-search-result-title-container">
                      <span class="searchstax-search-result-title">{{ searchResult.title }}</span>
                    </div>
                    <p
                      v-if="searchResult.paths"
                      class="searchstax-search-result-common"
                    > {{ searchResult.paths }} </p>
                    <p
                      v-if="searchResult.description"
                      class="searchstax-search-result-description searchstax-search-result-common"
                    > {{ searchResult.description }} </p>
                    <div
                      :key="unmappedField.key"
                      v-for="unmappedField in searchResult.unmappedFields"
                    >
                      <div
                        v-if="unmappedField.isImage && typeof unmappedField.value === 'string'"
                        class="searchstax-search-result-image-container"
                      >
                        <img
                          :src="unmappedField.value"
                          class="searchstax-result-image"
                        />
                      </div>
                      <div v-else>
                        <p class="searchstax-search-result-common"> {{ unmappedField.value }} </p>
                      </div>
                    </div>
                  </div>
                </div>
              </template>
            </SearchstaxResultWidget>

Pagination Widget

example of pagination widget initialization with minimum options

<SearchstaxPaginationWidget></SearchstaxPaginationWidget>

example of pagination widget initialization with various options

 <template #pagination="{ paginationData, previousPage, nextPage }">
                <div
                  class="searchstax-pagination-container"
                  v-if="paginationData"
                >
                  <div class="searchstax-pagination-content">
                    <a
                      class="searchstax-pagination-previous"
                      :disabled="paginationData?.isFirstPage"
                      @click="previousPage"
                      id="searchstax-pagination-previous"
                    > &lt; Previous </a>
                    <div class="searchstax-pagination-details"> {{ paginationData?.startResultIndex }} - {{
                      paginationData?.endResultIndex }} of {{ paginationData?.totalResults }} </div>
                    <a
                      class="searchstax-pagination-next"
                      :disabled="paginationData?.isLastPage"
                      @click="nextPage"
                      id="searchstax-pagination-next"
                    >Next ></a>
                  </div>
                </div>
              </template>

example of pagination widget initialization with infinite scroll template override

<template #infiniteScroll="{ nextPage }">
<div className="searchstax-pagination-container"
                <a
                  class="searchstax-pagination-load-more"
                  @click="nextPage"
                >Load More override</a>
</div>
</template>

Facets Widget

example of facets widget initialization with minimum options

<SearchstaxFacetsWidget
              :facetingType="'or'"
              :itemsPerPageDesktop="3"
              :itemsPerPageMobile="99"
            ></SearchstaxFacetsWidget>

example of facets widget initialization with template overrides

             <SearchstaxFacetsWidget
              :facetingType="'or'"
              :itemsPerPageDesktop="3"
              :itemsPerPageMobile="99"
            >
              <template
                #desktopFacets="{ facetsTemplateDataDesktop, isNotDeactivated, toggleFacetGroup, isChecked, selectFacet, showMoreLessDesktop, facetContainers }"
              >
                <div
                  v-if="facetsTemplateDataDesktop?.hasResultsOrExternalPromotions"
                  class="searchstax-facets-container-desktop"
                >
                  <div
                    v-for="facet in facetsTemplateDataDesktop.facets"
                    :key="facet"
                    class="searchstax-facet-container"
                    :class="{ 'active': isNotDeactivated(facet.name) }"
                  >
                    <div>
                      <div
                        class="searchstax-facet-title-container"
                        @click="toggleFacetGroup(facet.name)"
                      >
                        <div class="searchstax-facet-title"> {{ facet.label }} </div>
                        <div class="searchstax-facet-title-arrow active"></div>
                      </div>
                      <div class="searchstax-facet-values-container">
                        <div
                          v-for="(facetValue, key) in facet.values"
                          :key="facetValue.value + facetValue.parentName"
                          class="searchstax-facet-value-container"
                          :class="{ 'searchstax-facet-value-disabled': facetValue.disabled }"
                          :ref="el => { facetContainers[key + facet.name] = el }"
                        >
                          <div class="searchstax-facet-input">
                            <input
                              type="checkbox"
                              class="searchstax-facet-input-checkbox"
                              :checked="isChecked(facetValue)"
                              :disabled="facetValue.disabled"
                              @click="selectFacet(key + facet.name, $event, facetValue, true)"
                            />
                          </div>
                          <div
                            class="searchstax-facet-value-label"
                            @click="selectFacet(key + facet.name, $event, facetValue, false)"
                          >{{ facetValue.value }}</div>
                          <div
                            class="searchstax-facet-value-count"
                            @click="selectFacet(key + facet.name, $event, facetValue, false)"
                          >({{ facetValue.count }})</div>
                        </div>
                        <div
                          class="searchstax-facet-show-more-container"
                          v-if="facet.hasMoreFacets"
                        >
                          <div
                            class="searchstax-facet-show-more-container"
                            @click="showMoreLessDesktop($event, facet)"
                          >
                            <div
                              v-if="facet.showingAllFacets"
                              class="searchstax-facet-show-less-button searchstax-facet-show-button"
                            >less</div>
                            <div
                              v-else
                              class="searchstax-facet-show-more-button  searchstax-facet-show-button"
                            >more</div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </template>
              <template
                #mobileFacets="{ facetsTemplateDataMobile, selectedFacetsCheckboxes, isNotDeactivated, toggleFacetGroup, isChecked, selectFacet, showMoreLessDesktop, facetContainers, openOverlay, unselectFacet, unselectAll, closeOverlay }"
              >
                <div
                  class="searchstax-facets-container-mobile"
                  v-if="facetsTemplateDataMobile?.hasResultsOrExternalPromotions"
                >
                  <div class="searchstax-facets-pills-container">
                    <div
                      class="searchstax-facets-pill searchstax-facets-pill-filter-by"
                      @click="openOverlay"
                    >
                      <div class="searchstax-facets-pill-label">Filter By</div>
                    </div>
                    <div class="searchstax-facets-pills-selected">
                      <div
                        class="searchstax-facets-pill searchstax-facets-pill-facets"
                        v-for="facet in selectedFacetsCheckboxes"
                        :key="facet.value"
                        @click="unselectFacet(facet)"
                      >
                        <div class="searchstax-facets-pill-label">{{ facet.value }} ({{ facet.count }})</div>
                        <div class="searchstax-facets-pill-icon-close"></div>
                      </div>
                    </div>
                    <div
                      class="searchstax-facets-pill searchstax-clear-filters searchstax-facets-pill-clear-all"
                      v-if="selectedFacetsCheckboxes.length"
                      @click="unselectAll"
                    >
                      <div class="searchstax-facets-pill-label">Clear Filters</div>
                    </div>
                  </div>
                  <div
                    class="searchstax-facets-mobile-overlay"
                    :class="{ 'searchstax-show': facetsTemplateDataMobile?.overlayOpened }"
                  >
                    <div class="searchstax-facets-mobile-overlay-header">
                      <div class="searchstax-facets-mobile-overlay-header-title">Filter By</div>
                      <div
                        class="searchstax-search-close"
                        @click="closeOverlay"
                      ></div>
                    </div>
                    <div class="searchstax-facets-container-mobile">
                      <div
                        v-for="facet in facetsTemplateDataMobile?.facets"
                        :key="facet"
                        class="searchstax-facet-container"
                        :class="{ 'active': isNotDeactivated(facet.name) }"
                      >
                        <div>
                          <div
                            class="searchstax-facet-title-container"
                            @click="toggleFacetGroup(facet.name)"
                          >
                            <div class="searchstax-facet-title"> {{ facet.label }} </div>
                            <div class="searchstax-facet-title-arrow active"></div>
                          </div>
                          <div class="searchstax-facet-values-container">
                            <div
                              v-for="(facetValue, key) in facet.values"
                              :key="facetValue.value + facetValue.parentName"
                              class="searchstax-facet-value-container"
                              :class="{ 'searchstax-facet-value-disabled': facetValue.disabled }"
                              :ref="el => { facetContainers[key + facet.name] = el }"
                            >
                              <div class="searchstax-facet-input">
                                <input
                                  type="checkbox"
                                  class="searchstax-facet-input-checkbox"
                                  :checked="isChecked(facetValue)"
                                  :disabled="facetValue.disabled"
                                  @click="selectFacet(key + facet.name, $event, facetValue, true)"
                                />
                              </div>
                              <div
                                class="searchstax-facet-value-label"
                                @click="selectFacet(key + facet.name, $event, facetValue, false)"
                              >{{ facetValue.value }}</div>
                              <div
                                class="searchstax-facet-value-count"
                                @click="selectFacet(key + facet.name, $event, facetValue, false)"
                              >({{ facetValue.count }})</div>
                            </div>
                            <div
                              class="searchstax-facet-show-more-container"
                              v-if="facet.hasMoreFacets"
                            >
                              <div
                                class="searchstax-facet-show-more-container"
                                @click="showMoreLessDesktop($event, facet)"
                              >
                                <div
                                  v-if="facet.showingAllFacets"
                                  class="searchstax-facet-show-less-button searchstax-facet-show-button"
                                >less</div>
                                <div
                                  v-else
                                  class="searchstax-facet-show-more-button  searchstax-facet-show-button"
                                >more</div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <button
                      class="searchstax-facets-mobile-overlay-done"
                      @click="closeOverlay"
                    >Done</button>
                  </div>
                </div>
              </template>
            </SearchstaxFacetsWidget>

SearchFeedback Widget

example of search feedback widget initialization with minimum options

<SearchstaxSearchFeedbackWidget></SearchstaxSearchFeedbackWidget>

example of search feedback widget initialization with template overrides

<SearchstaxSearchFeedbackWidget>
            <template #searchFeedback="{ searchFeedbackData, onOriginalQueryClick }">
              <div
                class="searchstax-feedback-container"
                v-if="searchFeedbackData && searchFeedbackData?.searchExecuted && searchFeedbackData?.totalResults"
              > Showing <b>{{ searchFeedbackData.startResultIndex }} - {{ searchFeedbackData.endResultIndex }}</b> of
                <b>{{ searchFeedbackData.totalResults }}</b> results <span v-if="searchFeedbackData.searchTerm">for "<b>{{
                  searchFeedbackData.searchTerm }}</b>" </span>
                <div class="searchstax-feedback-container-suggested">
                  <div v-if="searchFeedbackData.autoCorrectedQuery"> Search instead for <a
                      href="#"
                      @click.prevent="onOriginalQueryClick($event)"
                      class="searchstax-feedback-original-query"
                    >{{ searchFeedbackData.originalQuery }}</a>
                  </div>
                </div>
              </div>
            </template>
          </SearchstaxSearchFeedbackWidget>

RelatedSearches widget

example of search feedback widget initialization with minimum options

<SearchstaxRelatedSearchesWidget
              :relatedSearchesURL="config.relatedSearchesURL"
              :relatedSearchesAPIKey="config.relatedSearchesAPIKey"
            ></SearchstaxRelatedSearchesWidget>

example of search feedback widget initialization with template overrides

<SearchstaxRelatedSearchesWidget
              :relatedSearchesURL="config.relatedSearchesURL"
              :relatedSearchesAPIKey="config.relatedSearchesAPIKey"
            >
              <template #related="{ relatedData, executeSearch }">
                <div
                  class="searchstax-related-searches-container"
                  id="searchstax-related-searches-container"
                  v-if="relatedData && relatedData?.searchExecuted && relatedData?.hasRelatedSearches"
                > Related searches: <span id="searchstax-related-searches"></span>
                  <span
                    class="searchstax-related-search"
                    v-if="relatedData.relatedSearches"
                  >
                    <span
                      v-for="related in relatedData.relatedSearches"
                      :key="related.related_search"
                      @click="executeSearch(related)"
                      class="searchstax-related-search searchstax-related-search-item"
                    > {{ related.related_search }}<span v-if="!related.last">,</span>
                    </span>
                  </span>
                </div>
              </template>
            </SearchstaxRelatedSearchesWidget>

ExternalPromotions widget

example of search feedback widget initialization with minimum options

<SearchstaxExternalPromotionsWidget></SearchstaxExternalPromotionsWidget>

example of search feedback widget initialization with template overrides

<SearchstaxExternalPromotionsWidget>
              <template #externalPromotions="{ externalPromotionsData, trackClick }">
                <div
                  class="searchstax-external-promotions-container"
                  id="searchstax-external-promotions-container"
                  v-if="externalPromotionsData && externalPromotionsData?.searchExecuted && externalPromotionsData?.hasExternalPromotions"
                >
                  <div
                    class="searchstax-external-promotion searchstax-search-result"
                    v-for="externalPromotion in externalPromotionsData.externalPromotions"
                    :key="externalPromotion.id"
                  >
                    <div class="icon-elevated"></div>
                    <a
                      v-if="externalPromotion.url"
                      href="{{externalPromotion.url}}"
                      @click="trackClick(externalPromotion, $event)"
                      class="searchstax-result-item-link"
                    ></a>
                    <div class="searchstax-search-result-title-container">
                      <span class="searchstax-search-result-title">{{ externalPromotion.name }}</span>
                    </div>
                    <p
                      v-if="externalPromotion.description"
                      class="searchstax-search-result-description searchstax-search-result-common"
                    > {{ externalPromotion.description }} </p>
                    <p
                      v-if="externalPromotion.url"
                      class="searchstax-search-result-description searchstax-search-result-common"
                    > {{ externalPromotion.url }} </p>
                  </div>
                </div>
              </template>
            </SearchstaxExternalPromotionsWidget>

Sorting Widget

example of sorting widget initialization with minimum options

<SearchstaxSortingWidget></SearchstaxSortingWidget>

example of sorting widget initialization with template override

<SearchstaxSortingWidget>
            <template #sorting="{ sortingData, orderChange, selectedSorting }">
              <div
                class="searchstax-sorting-container"
                v-if="sortingData && sortingData?.searchExecuted && sortingData?.hasResultsOrExternalPromotions"
              >
                <label
                  class="searchstax-sorting-label"
                  for="sort-by"
                >Sort By</label>
                <select
                  id="searchstax-search-order-select"
                  class="searchstax-search-order-select"
                  :value="selectedSorting"
                  @change="orderChange($event)"
                >
                  <option value=""> Relevance </option>
                  <option value="date desc"> Newest Content </option>
                  <option value="date asc"> Oldest Content </option>
                </select>
              </div>
            </template>
          </SearchstaxSortingWidget>

Template overrides

Templates use vue slots.

STYLING

scss styles can be imported from searchstudio-ux-js

 @import './../node_modules/@searchstax-inc/searchstudio-ux-js/dist/styles/scss/mainTheme.scss';

css can be taken from

./../node_modules/@searchstax-inc/searchstudio-ux-js/dist/styles/mainTheme.css
1.0.9

9 months ago

1.0.8

9 months ago

1.0.6

9 months ago

1.0.4

10 months ago

1.0.3

11 months ago

1.0.22

6 months ago

1.0.27

5 months ago

1.0.15

6 months ago

1.0.14

7 months ago

1.0.13

8 months ago

1.0.2

1 year ago

1.0.1

1 year ago

0.2.27

1 year ago

0.2.26

1 year ago

0.2.25

1 year ago

0.2.24

1 year ago

0.2.18

1 year ago

0.2.16

1 year ago

0.2.14

1 year ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago