@searchstax-inc/searchstudio-ux-react 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -3
- package/dist/@searchstax-inc/components/SearchstaxExternalPromotionsWidget.d.ts +5 -0
- package/dist/@searchstax-inc/components/SearchstaxRelatedSearchesWidget.d.ts +7 -0
- package/dist/@searchstax-inc/main.d.ts +3 -1
- package/dist/@searchstax-inc/searchstudio-ux-react.cjs +12 -12
- package/dist/@searchstax-inc/searchstudio-ux-react.d.cts +3 -1
- package/dist/@searchstax-inc/searchstudio-ux-react.iife.js +18 -18
- package/dist/@searchstax-inc/searchstudio-ux-react.mjs +530 -431
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -796,12 +796,52 @@ function searchOverviewTemplate(
|
|
|
796
796
|
|
|
797
797
|
example of search feedback widget initialization with minimum options
|
|
798
798
|
```
|
|
799
|
-
|
|
799
|
+
<SearchstaxRelatedSearchesWidget
|
|
800
|
+
relatedSearchesURL={config.relatedSearchesURL}
|
|
801
|
+
relatedSearchesAPIKey={config.relatedSearchesAPIKey}
|
|
802
|
+
></SearchstaxRelatedSearchesWidget>
|
|
800
803
|
```
|
|
801
804
|
|
|
802
805
|
|
|
803
806
|
example of search feedback widget initialization with template overrides
|
|
804
807
|
```
|
|
808
|
+
function searchRelatedSearchesTemplate(
|
|
809
|
+
relatedData: null | ISearchstaxRelatedSearchesData,
|
|
810
|
+
executeSearch: (result: ISearchstaxRelatedSearchResult) => void
|
|
811
|
+
) {
|
|
812
|
+
return (
|
|
813
|
+
<>
|
|
814
|
+
{relatedData && relatedData?.searchExecuted && relatedData?.hasRelatedSearches && (
|
|
815
|
+
<div className="searchstax-related-searches-container" id="searchstax-related-searches-container">
|
|
816
|
+
{" "}
|
|
817
|
+
Related searches: <span id="searchstax-related-searches"></span>
|
|
818
|
+
{relatedData.relatedSearches && (
|
|
819
|
+
<span className="searchstax-related-search">
|
|
820
|
+
{relatedData.relatedSearches.map((related) => (
|
|
821
|
+
<span
|
|
822
|
+
key={related.related_search}
|
|
823
|
+
onClick={() => {
|
|
824
|
+
executeSearch(related);
|
|
825
|
+
}}
|
|
826
|
+
className="searchstax-related-search searchstax-related-search-item"
|
|
827
|
+
>
|
|
828
|
+
{" "}
|
|
829
|
+
{related.related_search}
|
|
830
|
+
{!related.last && <span>,</span>}
|
|
831
|
+
</span>
|
|
832
|
+
))}
|
|
833
|
+
</span>
|
|
834
|
+
)}
|
|
835
|
+
</div>
|
|
836
|
+
)}
|
|
837
|
+
</>
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
<SearchstaxRelatedSearchesWidget
|
|
841
|
+
relatedSearchesURL={config.relatedSearchesURL}
|
|
842
|
+
relatedSearchesAPIKey={config.relatedSearchesAPIKey}
|
|
843
|
+
searchRelatedSearchesTemplate={searchRelatedSearchesTemplate}
|
|
844
|
+
></SearchstaxRelatedSearchesWidget>
|
|
805
845
|
|
|
806
846
|
```
|
|
807
847
|
|
|
@@ -809,13 +849,56 @@ example of search feedback widget initialization with template overrides
|
|
|
809
849
|
|
|
810
850
|
example of search feedback widget initialization with minimum options
|
|
811
851
|
```
|
|
812
|
-
|
|
852
|
+
<SearchstaxExternalPromotionsWidget></SearchstaxExternalPromotionsWidget>
|
|
813
853
|
```
|
|
814
854
|
|
|
815
855
|
|
|
816
856
|
example of search feedback widget initialization with template overrides
|
|
817
857
|
```
|
|
818
|
-
|
|
858
|
+
function searchExternalPromotionsTemplate(
|
|
859
|
+
externalPromotionsData: null | ISearchstaxExternalPromotionsData,
|
|
860
|
+
trackClick: (externalPromotion: IExternalPromotion, event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void
|
|
861
|
+
) {
|
|
862
|
+
return (
|
|
863
|
+
<>
|
|
864
|
+
{externalPromotionsData &&
|
|
865
|
+
externalPromotionsData?.searchExecuted &&
|
|
866
|
+
externalPromotionsData?.hasExternalPromotions &&
|
|
867
|
+
externalPromotionsData.externalPromotions.map((externalPromotion) => (
|
|
868
|
+
<div className="searchstax-external-promotion searchstax-search-result" key={externalPromotion.id}>
|
|
869
|
+
<div className="icon-elevated"></div>
|
|
870
|
+
{externalPromotion.url && (
|
|
871
|
+
<a
|
|
872
|
+
href={externalPromotion.url}
|
|
873
|
+
onClick={(event) => {
|
|
874
|
+
trackClick(externalPromotion, event);
|
|
875
|
+
}}
|
|
876
|
+
className="searchstax-result-item-link"
|
|
877
|
+
></a>
|
|
878
|
+
)}
|
|
879
|
+
<div className="searchstax-search-result-title-container">
|
|
880
|
+
<span className="searchstax-search-result-title">{externalPromotion.name}</span>
|
|
881
|
+
</div>
|
|
882
|
+
{externalPromotion.description && (
|
|
883
|
+
<p className="searchstax-search-result-description searchstax-search-result-common">
|
|
884
|
+
{" "}
|
|
885
|
+
{externalPromotion.description}{" "}
|
|
886
|
+
</p>
|
|
887
|
+
)}
|
|
888
|
+
{externalPromotion.url && (
|
|
889
|
+
<p className="searchstax-search-result-description searchstax-search-result-common">
|
|
890
|
+
{" "}
|
|
891
|
+
{externalPromotion.url}{" "}
|
|
892
|
+
</p>
|
|
893
|
+
)}
|
|
894
|
+
</div>
|
|
895
|
+
))}
|
|
896
|
+
</>
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
<SearchstaxExternalPromotionsWidget
|
|
900
|
+
searchExternalPromotionsTemplate={searchExternalPromotionsTemplate}
|
|
901
|
+
></SearchstaxExternalPromotionsWidget>
|
|
819
902
|
```
|
|
820
903
|
|
|
821
904
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ISearchstaxExternalPromotionsData, IExternalPromotion } from "@searchstax-inc/searchstudio-ux-js";
|
|
2
|
+
declare function SearchstaxExternalPromotionsWidget(props: {
|
|
3
|
+
searchExternalPromotionsTemplate?: (externalPromotionsData: null | ISearchstaxExternalPromotionsData, trackClick: (externalPromotion: IExternalPromotion, event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void) => React.ReactElement;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default SearchstaxExternalPromotionsWidget;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ISearchstaxRelatedSearchesData, ISearchstaxRelatedSearchResult } from "@searchstax-inc/searchstudio-ux-js";
|
|
2
|
+
declare function SearchstaxRelatedSearchesWidget(props: {
|
|
3
|
+
relatedSearchesURL: string;
|
|
4
|
+
relatedSearchesAPIKey: string;
|
|
5
|
+
searchRelatedSearchesTemplate?: (relatedData: null | ISearchstaxRelatedSearchesData, executeSearch: (result: ISearchstaxRelatedSearchResult) => void) => React.ReactElement;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default SearchstaxRelatedSearchesWidget;
|
|
@@ -5,4 +5,6 @@ import SearchstaxPaginationWidget from "./components/SearchstaxPaginationWidget"
|
|
|
5
5
|
import SearchstaxSortingWidget from "./components/SearchstaxSortingWidget";
|
|
6
6
|
import SearchstaxOverviewWidget from "./components/SearchstaxOverviewWidget";
|
|
7
7
|
import SearchstaxFacetsWidget from "./components/SearchstaxFacetsWidget";
|
|
8
|
-
|
|
8
|
+
import SearchstaxRelatedSearchesWidget from './components/SearchstaxRelatedSearchesWidget';
|
|
9
|
+
import SearchstaxExternalPromotionsWidget from './components/SearchstaxExternalPromotionsWidget';
|
|
10
|
+
export { SearchstaxWrapper, SearchstaxResultWidget, SearchstaxInputWidget, SearchstaxPaginationWidget, SearchstaxSortingWidget, SearchstaxOverviewWidget, SearchstaxFacetsWidget, SearchstaxRelatedSearchesWidget, SearchstaxExternalPromotionsWidget };
|