@usereactify/search 5.58.0-beta.3 → 5.59.0-beta.1
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/CHANGELOG.md +30 -0
- package/dist/package.json +1 -1
- package/dist/src/components/Result/Results.d.ts +3 -1
- package/dist/src/components/Result/Results.js +33 -34
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/types/reactivesearch.d.ts +2 -0
- package/dist/src/types/reactivesearch.js.map +1 -1
- package/dist/src/utility/props.d.ts +4 -1
- package/dist/src/utility/props.js +20 -17
- package/dist/src/utility/props.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [5.59.0-beta.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.58.0-beta.3...beta-v5.59.0-beta.1) (2025-06-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* expose the onData listener on the Results component ([2e70e4d](https://bitbucket.org/usereactify/reactify-search-ui/commit/2e70e4ddc130813676e0ff2af04cc5111331051e))
|
|
11
|
+
|
|
12
|
+
## [5.59.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.58.0-beta.3...beta-v5.59.0-beta.0) (2025-06-30)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* expose the onData listener on the Results component ([2e70e4d](https://bitbucket.org/usereactify/reactify-search-ui/commit/2e70e4ddc130813676e0ff2af04cc5111331051e))
|
|
18
|
+
|
|
19
|
+
## [5.58.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.57.1...release-v5.58.0) (2025-04-14)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* remove flags ([425865a](https://bitbucket.org/usereactify/reactify-search-ui/commit/425865abe048b6f799c6330ce094f882cce2d0ff))
|
|
25
|
+
* update boosting rules to use market specific pricing ([980a085](https://bitbucket.org/usereactify/reactify-search-ui/commit/980a0852673c493d006b9d29c79b6f071a13a634))
|
|
26
|
+
* update filter options for price_min and price_max to use market specific prices ([bf714ab](https://bitbucket.org/usereactify/reactify-search-ui/commit/bf714abeeb500bfb8d35333044c3b3235f291cfe))
|
|
27
|
+
* update sort options for price_min and price_max to use market specific prices ([1a6c0c3](https://bitbucket.org/usereactify/reactify-search-ui/commit/1a6c0c3b8e63200a71d92d7ba62271bba3ec9d32))
|
|
28
|
+
* update useProductPrice to return market specific prices ([1907949](https://bitbucket.org/usereactify/reactify-search-ui/commit/1907949f2136090afaaba23b344232b5f0d90e9d))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* replace "price_min" with "price" ([f0bceb7](https://bitbucket.org/usereactify/reactify-search-ui/commit/f0bceb79f1b540adafa70a72817d302a288dfaa3))
|
|
34
|
+
|
|
5
35
|
## [5.58.0-beta.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.58.0-beta.2...beta-v5.58.0-beta.3) (2025-04-10)
|
|
6
36
|
|
|
7
37
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactiveList from "@usereactify/search-internals/lib/components/result/ReactiveList";
|
|
3
|
-
import { ElasticCallout, ElasticProduct, ReactivesearchError, ReactivesearchResultProps } from "../../types";
|
|
3
|
+
import { ElasticCallout, ElasticProduct, ReactivesearchError, ReactivesearchResultProps, ResultsDataListener } from "../../types";
|
|
4
4
|
import { useProductPrice, usePagination, usePaginationLoadable } from "../../hooks";
|
|
5
5
|
export type ResultProps = ReactivesearchResultProps & {
|
|
6
6
|
callouts: ElasticCallout[];
|
|
@@ -53,5 +53,7 @@ export type ResultsProps = {
|
|
|
53
53
|
infiniteScrollPosition?: number;
|
|
54
54
|
/** Advanced Usage: Shows subsequent loading states after initial results are loaded */
|
|
55
55
|
showSubsequentLoadingStates?: boolean;
|
|
56
|
+
/** Advanced Usage: Provide a function to listen to when a search request is made and new results are returned. */
|
|
57
|
+
onData?: ResultsDataListener;
|
|
56
58
|
};
|
|
57
59
|
export declare const Results: React.FC<ResultsProps>;
|
|
@@ -24,25 +24,22 @@ const Results = (props) => {
|
|
|
24
24
|
config: reactifySearchContext.config,
|
|
25
25
|
filterGroup: filtersHook.filterStack,
|
|
26
26
|
scrollTarget: props.infiniteScrollContainer,
|
|
27
|
-
pageSize: props.pageSize
|
|
27
|
+
pageSize: props.pageSize,
|
|
28
|
+
onData: props.onData,
|
|
28
29
|
});
|
|
29
30
|
const { track } = (0, hooks_1.useAnalytics)();
|
|
30
31
|
const { searchTerm } = (0, hooks_1.useSearch)();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}, renderPagination: (reactivesearchPaginationProps) => (react_1.default.createElement(ResultsPaginationStack, Object.assign({}, props, reactivesearchPaginationProps))) })));
|
|
32
|
+
const handleData = (renderProps) => {
|
|
33
|
+
var _a;
|
|
34
|
+
if (renderProps.resultStats.numberOfResults === 0) {
|
|
35
|
+
let trimmedSearchTerm = searchTerm.trim();
|
|
36
|
+
if (!trimmedSearchTerm || (trimmedSearchTerm && trimmedSearchTerm.length < 3))
|
|
37
|
+
return;
|
|
38
|
+
track({ eventName: "zeroResults", payload: { searchTerm: trimmedSearchTerm } });
|
|
39
|
+
(_a = props.onData) === null || _a === void 0 ? void 0 : _a.call(props, renderProps);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return (react_1.default.createElement(ReactiveList_1.default, Object.assign({}, reactiveProps, { render: (reactivesearchResultProps) => (react_1.default.createElement(ResultsInner, Object.assign({}, props, { reactivesearchResultProps: reactivesearchResultProps }))), onData: handleData, renderPagination: (reactivesearchPaginationProps) => (react_1.default.createElement(ResultsPaginationStack, Object.assign({}, props, reactivesearchPaginationProps))) })));
|
|
46
43
|
};
|
|
47
44
|
exports.Results = Results;
|
|
48
45
|
const ResultsRenderErrorComponent = (props) => {
|
|
@@ -61,8 +58,7 @@ const ResultsInner = (props) => {
|
|
|
61
58
|
const context = (0, hooks_1.useReactifySearchContext)();
|
|
62
59
|
const filtersHook = (0, hooks_1.useFilters)();
|
|
63
60
|
const resultsHook = (0, hooks_1.useResults)();
|
|
64
|
-
const initialSearchHasRun = react_1.default.useMemo(() => "undefined" !==
|
|
65
|
-
typeof props.reactivesearchResultProps.resultStats.numberOfResults, [props.reactivesearchResultProps]);
|
|
61
|
+
const initialSearchHasRun = react_1.default.useMemo(() => "undefined" !== typeof props.reactivesearchResultProps.resultStats.numberOfResults, [props.reactivesearchResultProps]);
|
|
66
62
|
const listStyle = react_1.default.useMemo(() => {
|
|
67
63
|
var _a;
|
|
68
64
|
return (_a = props.listStyle) !== null && _a !== void 0 ? _a : {
|
|
@@ -92,27 +88,26 @@ const ResultsInner = (props) => {
|
|
|
92
88
|
props.reactivesearchResultProps.data.map((item) => item._id).join(""),
|
|
93
89
|
]);
|
|
94
90
|
const calculateGridOverflow = react_1.default.useCallback((results) => {
|
|
95
|
-
if (!props.gridColumns)
|
|
91
|
+
if (!props.gridColumns)
|
|
96
92
|
return;
|
|
97
|
-
}
|
|
98
93
|
let total = results.length;
|
|
99
94
|
for (const result of results) {
|
|
100
|
-
if (result.type === types_1.ElasticDocumentType.Product)
|
|
95
|
+
if (result.type === types_1.ElasticDocumentType.Product)
|
|
101
96
|
continue;
|
|
102
|
-
|
|
103
|
-
total += ((parseInt(result.callout.displayColumns) * parseInt(result.callout.displayRows)) - 1);
|
|
97
|
+
total += parseInt(result.callout.displayColumns) * parseInt(result.callout.displayRows) - 1;
|
|
104
98
|
}
|
|
105
99
|
const overflow = props.gridColumns - (total % props.gridColumns);
|
|
106
|
-
if (overflow === props.gridColumns)
|
|
100
|
+
if (overflow === props.gridColumns)
|
|
107
101
|
return;
|
|
108
|
-
}
|
|
109
102
|
return overflow === props.gridColumns ? undefined : overflow;
|
|
110
103
|
}, [props.gridColumns]);
|
|
111
104
|
const gridOverflowCallout = react_1.default.useMemo(() => {
|
|
112
105
|
// check if there are more results
|
|
113
|
-
if (props.reactivesearchResultProps.resultStats.displayedResults ===
|
|
106
|
+
if (props.reactivesearchResultProps.resultStats.displayedResults ===
|
|
107
|
+
props.reactivesearchResultProps.resultStats.numberOfResults) {
|
|
114
108
|
// check if we should only autofill when there are more results
|
|
115
|
-
if (context.config.merchandising.calloutAutofillBehaviour ===
|
|
109
|
+
if (context.config.merchandising.calloutAutofillBehaviour ===
|
|
110
|
+
firestore_1.MerchandisingCalloutAutofillBehaviour.MoreResults) {
|
|
116
111
|
return;
|
|
117
112
|
}
|
|
118
113
|
}
|
|
@@ -130,14 +125,18 @@ const ResultsInner = (props) => {
|
|
|
130
125
|
published: true,
|
|
131
126
|
curations: [],
|
|
132
127
|
};
|
|
133
|
-
}, [
|
|
134
|
-
|
|
128
|
+
}, [
|
|
129
|
+
props.reactivesearchResultProps.resultStats,
|
|
130
|
+
props.reactivesearchResultProps.data,
|
|
131
|
+
context.config.callouts,
|
|
132
|
+
]);
|
|
133
|
+
const results = react_1.default.useMemo(() => [
|
|
135
134
|
...props.reactivesearchResultProps.data,
|
|
136
|
-
...gridOverflowCallout ? [gridOverflowCallout] : [],
|
|
137
|
-
]
|
|
135
|
+
...(gridOverflowCallout ? [gridOverflowCallout] : []),
|
|
136
|
+
], [props.reactivesearchResultProps.data, gridOverflowCallout]);
|
|
138
137
|
if (props.reactivesearchResultProps.error) {
|
|
139
138
|
const RenderErrorComponent = (_c = props.renderError) !== null && _c !== void 0 ? _c : ResultsRenderErrorComponent;
|
|
140
|
-
return
|
|
139
|
+
return react_1.default.createElement(RenderErrorComponent, { error: props.reactivesearchResultProps.error });
|
|
141
140
|
}
|
|
142
141
|
if (!initialSearchHasRun) {
|
|
143
142
|
const RenderLoadingComponent = (_d = props.renderLoading) !== null && _d !== void 0 ? _d : ResultsRenderLoadingComponent;
|
|
@@ -188,10 +187,10 @@ const ResultsPaginationStack = (props) => {
|
|
|
188
187
|
return null;
|
|
189
188
|
}
|
|
190
189
|
if ("pagination" === (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType)) {
|
|
191
|
-
return
|
|
190
|
+
return react_1.default.createElement(ResultPaginationNumbered_1.ResultPaginationNumbered, Object.assign({}, props, { render: props.renderPaginationNumbered }));
|
|
192
191
|
}
|
|
193
192
|
if ("next_prev" === (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType)) {
|
|
194
|
-
return
|
|
193
|
+
return react_1.default.createElement(ResultPaginationNextPrev_1.ResultPaginationNextPrev, Object.assign({}, props, { render: props.renderPaginationNextPrev }));
|
|
195
194
|
}
|
|
196
195
|
return null;
|
|
197
196
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Results.js","sourceRoot":"","sources":["../../../../src/components/Result/Results.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,oHAA4F;AAE5F,2DAAwD;AACxD,2DAAwD;AACxD,yEAAsE;AACtE,yEAAsE;AACtE,yEAAsE;AACtE,qFAAkF;AAElF,uCASqB;AACrB,uCASqB;AACrB,+CAAsD;AACtD,qDAA8E;AA4DvE,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,EAAE;IACvD,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACzD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IACjC,MAAM,aAAa,GAAG,IAAA,uBAAe,EAAC;QACpC,QAAQ,EAAE,qBAAqB,CAAC,OAAO;QACvC,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AE,CAAC;IAErC,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE,CAAC;QAChD,OAAO,CACL,8BAAC,mDAAwB,oBACnB,KAAK,CAAC,yBAAyB,IACnC,MAAM,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,iBAAiB,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE,CAAC;QACtD,OAAO,CACL,8BAAC,+DAA8B,oBACzB,KAAK,CAAC,yBAAyB,IACnC,MAAM,EAAE,KAAK,CAAC,8BAA8B,IAC5C,CACH,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@usereactify/search-internals/lib/components/result/ReactiveList\";\n\nimport { ResultCardCallout } from \"./ResultCardCallout\";\nimport { ResultCardProduct } from \"./ResultCardProduct\";\nimport { ResultPaginationNumbered } from \"./ResultPaginationNumbered\";\nimport { ResultPaginationLoadMore } from \"./ResultPaginationLoadMore\";\nimport { ResultPaginationNextPrev } from \"./ResultPaginationNextPrev\";\nimport { ResultPaginationInfiniteScroll } from \"./ResultPaginationInfiniteScroll\";\n\nimport {\n ElasticCallout,\n ElasticProduct,\n ElasticDocumentType,\n ReactivesearchError,\n ReactivesearchResultProps,\n ReactivesearchPaginationProps,\n ElasticHit,\n ElasticDocument,\n} from \"../../types\";\nimport {\n useReactifySearchContext,\n useAnalytics,\n useSearch,\n useFilters,\n useProductPrice,\n usePagination,\n usePaginationLoadable,\n useResults,\n} from \"../../hooks\";\nimport { getPropsResults } from \"../../utility/props\";\nimport { MerchandisingCalloutAutofillBehaviour } from \"../../types/firestore\";\n\nexport type ResultProps = ReactivesearchResultProps & {\n callouts: ElasticCallout[];\n products: ElasticProduct[];\n};\n\nexport type ResultsProps = {\n /** Style prop for the list wrapper */\n listStyle?: React.HTMLAttributes<HTMLElement>[\"style\"];\n /** Classname prop for the list wrapper */\n listClassName?: string;\n /** Render method called when an error occurs */\n renderError?: React.FC<{ error: ReactivesearchError }>;\n /** Render method called while loading for the first time */\n renderLoading?: React.FC;\n /** Render method called when no results are found */\n renderNoResults?: React.FC;\n /** Render method called once for each product result */\n renderResultCardProduct?: React.FC<\n ReturnType<typeof useProductPrice> & {\n pagePosition: number;\n product: ElasticProduct;\n document: ElasticProduct;\n itemRef: (node?: Element | null) => void;\n handleClick: () => void;\n }\n >;\n /** Render method called once for each callout result */\n renderResultCardCallout?: React.FC<{\n pagePosition: number;\n document: ElasticCallout;\n callout: ElasticCallout[\"callout\"];\n itemRef: (node?: Element | null) => void;\n handleClick: () => void;\n }>;\n /** Render method called for pagination type \"pagination\" */\n renderPaginationNumbered?: React.FC<ReturnType<typeof usePagination>>;\n /** Render method called for pagination type \"next_prev\" */\n renderPaginationNextPrev?: React.FC<ReturnType<typeof usePagination>>;\n /** Render method called for pagination type \"load_more\" */\n renderPaginationLoadMore?: React.FC<ReturnType<typeof usePaginationLoadable>>;\n /** Render method called for pagination type \"infinite_scroll\" */\n renderPaginationInfiniteScroll?: React.FC<\n ReturnType<typeof usePaginationLoadable>\n >;\n /** Used to determine which filler callouts to use when there is an uneven grid */\n gridColumns?: number;\n /** Advanced Usage: Override the default amount of results per page */\n pageSize?: number;\n /** Advanced Usage: Override the default scrollTarget used to determine when infinite load should be triggered (infinite scroll) */\n infiniteScrollContainer?: React.ComponentProps<\n typeof ReactiveList\n >[\"scrollTarget\"];\n /** Advanced Usage: Provide a specific result position to trigger loading more results (infinite scroll) */\n infiniteScrollPosition?: number;\n /** Advanced Usage: Shows subsequent loading states after initial results are loaded */\n showSubsequentLoadingStates?: boolean;\n};\n\nexport const Results: React.FC<ResultsProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const reactiveProps = getPropsResults({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n scrollTarget: props.infiniteScrollContainer,\n pageSize: props.pageSize\n });\n\n const { track } = useAnalytics();\n const { searchTerm } = useSearch();\n\n return (\n <ReactiveList\n {...reactiveProps}\n render={(reactivesearchResultProps: ReactivesearchResultProps) => (\n <ResultsInner\n {...props}\n reactivesearchResultProps={reactivesearchResultProps}\n />\n )}\n onData={(renderProps) => {\n if (renderProps.resultStats.numberOfResults === 0) {\n let trimmedSearchTerm = searchTerm.trim();\n\n if (\n !trimmedSearchTerm ||\n (trimmedSearchTerm && trimmedSearchTerm.length < 3)\n ) {\n return;\n }\n\n track({\n eventName: \"zeroResults\",\n payload: {\n searchTerm: trimmedSearchTerm,\n },\n });\n }\n }}\n renderPagination={(\n reactivesearchPaginationProps: ReactivesearchPaginationProps\n ) => (\n <ResultsPaginationStack {...props} {...reactivesearchPaginationProps} />\n )}\n />\n );\n};\n\nconst ResultsRenderErrorComponent: ResultsProps[\"renderError\"] = (props) => {\n return (\n <div>\n {\"Error: \"}\n {props.error.statusText}\n </div>\n );\n};\n\nconst ResultsRenderLoadingComponent: ResultsProps[\"renderLoading\"] = () => {\n return <div>{\"Loading\"}</div>;\n};\n\nconst ResultsRenderNoResultsComponent: ResultsProps[\"renderNoResults\"] = () => {\n return <div>{\"No results\"}</div>;\n};\n\nconst ResultsInner: React.FC<\n ResultsProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const context = useReactifySearchContext();\n const filtersHook = useFilters();\n const resultsHook = useResults();\n const initialSearchHasRun = React.useMemo(\n () =>\n \"undefined\" !==\n typeof props.reactivesearchResultProps.resultStats.numberOfResults,\n [props.reactivesearchResultProps]\n );\n\n const listStyle = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () =>\n props.listStyle ?? {\n display: \"grid\",\n gap: \"8px\",\n gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\",\n },\n [props.listStyle]\n );\n\n const infiniteScrollPosition = React.useMemo<number>(() => {\n if (!props.infiniteScrollPosition) {\n return NaN;\n }\n\n const scrollPositionOffset =\n props.reactivesearchResultProps.resultStats.displayedResults -\n (props.pageSize ?? filtersHook.filterStack?.pageSize ?? 0);\n\n return scrollPositionOffset + (props.infiniteScrollPosition ?? 0);\n }, [\n props.pageSize ?? filtersHook.filterStack?.pageSize,\n props.reactivesearchResultProps.resultStats.displayedResults,\n props.infiniteScrollPosition,\n ]);\n\n React.useEffect(() => {\n resultsHook.setResults(props.reactivesearchResultProps.data);\n resultsHook.setResultStats(props.reactivesearchResultProps.resultStats);\n }, [\n props.reactivesearchResultProps.resultStats.numberOfResults,\n props.reactivesearchResultProps.data.map((item) => item._id).join(\"\"),\n ]);\n\n const calculateGridOverflow = React.useCallback((results: ReactivesearchResultProps[\"data\"]) => {\n if (!props.gridColumns) {\n return;\n\n }\n let total = results.length;\n for (const result of results) {\n if (result.type === ElasticDocumentType.Product) {\n continue;\n }\n total += ((parseInt(result.callout.displayColumns) * parseInt(result.callout.displayRows)) - 1);\n }\n\n const overflow = props.gridColumns - (total % props.gridColumns);\n\n if (overflow === props.gridColumns) {\n return;\n }\n\n return overflow === props.gridColumns ? undefined : overflow;\n }, [props.gridColumns]);\n\n const gridOverflowCallout = React.useMemo((): Omit<ElasticHit, \"_source\"> & ElasticCallout | undefined => {\n // check if there are more results\n if (props.reactivesearchResultProps.resultStats.displayedResults === props.reactivesearchResultProps.resultStats.numberOfResults) {\n // check if we should only autofill when there are more results\n if (context.config.merchandising.calloutAutofillBehaviour === MerchandisingCalloutAutofillBehaviour.MoreResults) {\n return;\n }\n }\n\n const overflow = calculateGridOverflow(props.reactivesearchResultProps.data);\n\n const callout = context.config.callouts.find((item) => item.displayColumns === `${overflow}`);\n if (!callout) {\n return;\n }\n\n return {\n _id: callout.id,\n _score: 0,\n type: ElasticDocumentType.Callout,\n key: Math.random().toString(16),\n callout: {\n ...callout,\n enabled: true,\n },\n published: true,\n curations: [],\n }\n }, [props.reactivesearchResultProps.resultStats, props.reactivesearchResultProps.data, context.config.callouts]);\n\n const results = React.useMemo(() => ([\n ...props.reactivesearchResultProps.data,\n ...gridOverflowCallout ? [gridOverflowCallout] : [],\n ]), [props.reactivesearchResultProps.data, gridOverflowCallout]);\n\n if (props.reactivesearchResultProps.error) {\n const RenderErrorComponent =\n props.renderError ?? ResultsRenderErrorComponent;\n\n return (\n <RenderErrorComponent error={props.reactivesearchResultProps.error} />\n );\n }\n\n if (!initialSearchHasRun) {\n const RenderLoadingComponent =\n props.renderLoading ?? ResultsRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n \n if (props.showSubsequentLoadingStates === true) {\n if (props.reactivesearchResultProps.loading) {\n const RenderLoadingComponent = props.renderLoading ?? ResultsRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n }\n\n if (\n !props.reactivesearchResultProps.loading &&\n !props.reactivesearchResultProps.resultStats.numberOfResults\n ) {\n const RenderNoResultsComponent =\n props.renderNoResults ?? ResultsRenderNoResultsComponent;\n\n return <RenderNoResultsComponent />;\n }\n\n if ([\"search\", \"instant-search\"].includes(context.options.mode)) {\n if (!context.search.searchTerm) {\n const RenderNoResultsComponent =\n props.renderNoResults ?? ResultsRenderNoResultsComponent;\n\n return <RenderNoResultsComponent />;\n }\n }\n\n return (\n <>\n <section style={listStyle} className={props.listClassName}>\n {results.map((item, key) => {\n if (ElasticDocumentType.Product === item.type) {\n return (\n <ResultCardProduct\n key={item._id}\n product={item}\n document={item}\n pagePosition={key + 1}\n render={props.renderResultCardProduct}\n {...(infiniteScrollPosition === key + 1\n ? {\n onView: () => props.reactivesearchResultProps.loadMore(),\n }\n : {})}\n />\n );\n }\n\n if (ElasticDocumentType.Callout === item.type) {\n return (\n <ResultCardCallout\n key={item._id}\n document={item}\n pagePosition={key + 1}\n callout={item.callout}\n render={props.renderResultCardCallout}\n {...(infiniteScrollPosition === key + 1\n ? {\n onView: () => props.reactivesearchResultProps.loadMore(),\n }\n : {})}\n />\n );\n }\n\n return null;\n })}\n </section>\n <ResultsPaginationStackLoadable\n {...props}\n {...props.reactivesearchResultProps}\n />\n </>\n );\n};\n\n/** Handles rendering pagination for types that use \"pagination props\" */\nconst ResultsPaginationStack: React.FC<\n ResultsProps & ReactivesearchPaginationProps\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"pagination\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNumbered\n {...props}\n render={props.renderPaginationNumbered}\n />\n );\n }\n\n if (\"next_prev\" === filterStack?.paginationType) {\n return (\n <ResultPaginationNextPrev\n {...props}\n render={props.renderPaginationNextPrev}\n />\n );\n }\n\n return null;\n};\n\n/** Handles rendering pagination for types that use \"result props\" */\nconst ResultsPaginationStackLoadable: React.FC<\n ResultsProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"load_more\" === filterStack?.paginationType) {\n return (\n <ResultPaginationLoadMore\n {...props.reactivesearchResultProps}\n render={props.renderPaginationLoadMore}\n />\n );\n }\n\n if (\"infinite_scroll\" === filterStack?.paginationType) {\n return (\n <ResultPaginationInfiniteScroll\n {...props.reactivesearchResultProps}\n render={props.renderPaginationInfiniteScroll}\n />\n );\n }\n\n return null;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Results.js","sourceRoot":"","sources":["../../../../src/components/Result/Results.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,oHAA4F;AAE5F,2DAAwD;AACxD,2DAAwD;AACxD,yEAAsE;AACtE,yEAAsE;AACtE,yEAAsE;AACtE,qFAAkF;AAElF,uCAUqB;AACrB,uCASqB;AACrB,+CAAsD;AACtD,qDAA8E;AA0DvE,MAAM,OAAO,GAA2B,CAAC,KAAK,EAAE,E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,CAAC;AAEF,qEAAqE;AACrE,MAAM,8BAA8B,GAEhC,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC/C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE,CAAC;QAChD,OAAO,CACL,8BAAC,mDAAwB,oBACnB,KAAK,CAAC,yBAAyB,IACnC,MAAM,EAAE,KAAK,CAAC,wBAAwB,IACtC,CACH,CAAC;IACJ,CAAC;IAED,IAAI,iBAAiB,MAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAA,EAAE,CAAC;QACtD,OAAO,CACL,8BAAC,+DAA8B,oBACzB,KAAK,CAAC,yBAAyB,IACnC,MAAM,EAAE,KAAK,CAAC,8BAA8B,IAC5C,CACH,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@usereactify/search-internals/lib/components/result/ReactiveList\";\n\nimport { ResultCardCallout } from \"./ResultCardCallout\";\nimport { ResultCardProduct } from \"./ResultCardProduct\";\nimport { ResultPaginationNumbered } from \"./ResultPaginationNumbered\";\nimport { ResultPaginationLoadMore } from \"./ResultPaginationLoadMore\";\nimport { ResultPaginationNextPrev } from \"./ResultPaginationNextPrev\";\nimport { ResultPaginationInfiniteScroll } from \"./ResultPaginationInfiniteScroll\";\n\nimport {\n ElasticCallout,\n ElasticProduct,\n ElasticDocumentType,\n ReactivesearchError,\n ReactivesearchResultProps,\n ReactivesearchPaginationProps,\n ElasticHit,\n ElasticDocument,\n ResultsDataListener,\n} from \"../../types\";\nimport {\n useReactifySearchContext,\n useAnalytics,\n useSearch,\n useFilters,\n useProductPrice,\n usePagination,\n usePaginationLoadable,\n useResults,\n} from \"../../hooks\";\nimport { getPropsResults } from \"../../utility/props\";\nimport { MerchandisingCalloutAutofillBehaviour } from \"../../types/firestore\";\n\nexport type ResultProps = ReactivesearchResultProps & {\n callouts: ElasticCallout[];\n products: ElasticProduct[];\n};\n\nexport type ResultsProps = {\n /** Style prop for the list wrapper */\n listStyle?: React.HTMLAttributes<HTMLElement>[\"style\"];\n /** Classname prop for the list wrapper */\n listClassName?: string;\n /** Render method called when an error occurs */\n renderError?: React.FC<{ error: ReactivesearchError }>;\n /** Render method called while loading for the first time */\n renderLoading?: React.FC;\n /** Render method called when no results are found */\n renderNoResults?: React.FC;\n /** Render method called once for each product result */\n renderResultCardProduct?: React.FC<\n ReturnType<typeof useProductPrice> & {\n pagePosition: number;\n product: ElasticProduct;\n document: ElasticProduct;\n itemRef: (node?: Element | null) => void;\n handleClick: () => void;\n }\n >;\n /** Render method called once for each callout result */\n renderResultCardCallout?: React.FC<{\n pagePosition: number;\n document: ElasticCallout;\n callout: ElasticCallout[\"callout\"];\n itemRef: (node?: Element | null) => void;\n handleClick: () => void;\n }>;\n /** Render method called for pagination type \"pagination\" */\n renderPaginationNumbered?: React.FC<ReturnType<typeof usePagination>>;\n /** Render method called for pagination type \"next_prev\" */\n renderPaginationNextPrev?: React.FC<ReturnType<typeof usePagination>>;\n /** Render method called for pagination type \"load_more\" */\n renderPaginationLoadMore?: React.FC<ReturnType<typeof usePaginationLoadable>>;\n /** Render method called for pagination type \"infinite_scroll\" */\n renderPaginationInfiniteScroll?: React.FC<ReturnType<typeof usePaginationLoadable>>;\n /** Used to determine which filler callouts to use when there is an uneven grid */\n gridColumns?: number;\n /** Advanced Usage: Override the default amount of results per page */\n pageSize?: number;\n /** Advanced Usage: Override the default scrollTarget used to determine when infinite load should be triggered (infinite scroll) */\n infiniteScrollContainer?: React.ComponentProps<typeof ReactiveList>[\"scrollTarget\"];\n /** Advanced Usage: Provide a specific result position to trigger loading more results (infinite scroll) */\n infiniteScrollPosition?: number;\n /** Advanced Usage: Shows subsequent loading states after initial results are loaded */\n showSubsequentLoadingStates?: boolean;\n /** Advanced Usage: Provide a function to listen to when a search request is made and new results are returned. */\n onData?: ResultsDataListener;\n};\n\nexport const Results: React.FC<ResultsProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const reactiveProps = getPropsResults({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n scrollTarget: props.infiniteScrollContainer,\n pageSize: props.pageSize,\n onData: props.onData,\n });\n\n const { track } = useAnalytics();\n const { searchTerm } = useSearch();\n\n const handleData: ResultsDataListener = (renderProps) => {\n if (renderProps.resultStats.numberOfResults === 0) {\n let trimmedSearchTerm = searchTerm.trim();\n if (!trimmedSearchTerm || (trimmedSearchTerm && trimmedSearchTerm.length < 3)) return;\n track({ eventName: \"zeroResults\", payload: { searchTerm: trimmedSearchTerm } });\n props.onData?.(renderProps);\n }\n };\n\n return (\n <ReactiveList\n {...reactiveProps}\n render={(reactivesearchResultProps: ReactivesearchResultProps) => (\n <ResultsInner {...props} reactivesearchResultProps={reactivesearchResultProps} />\n )}\n onData={handleData}\n renderPagination={(reactivesearchPaginationProps: ReactivesearchPaginationProps) => (\n <ResultsPaginationStack {...props} {...reactivesearchPaginationProps} />\n )}\n />\n );\n};\n\nconst ResultsRenderErrorComponent: ResultsProps[\"renderError\"] = (props) => {\n return (\n <div>\n {\"Error: \"}\n {props.error.statusText}\n </div>\n );\n};\n\nconst ResultsRenderLoadingComponent: ResultsProps[\"renderLoading\"] = () => {\n return <div>{\"Loading\"}</div>;\n};\n\nconst ResultsRenderNoResultsComponent: ResultsProps[\"renderNoResults\"] = () => {\n return <div>{\"No results\"}</div>;\n};\n\nconst ResultsInner: React.FC<\n ResultsProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const context = useReactifySearchContext();\n const filtersHook = useFilters();\n const resultsHook = useResults();\n const initialSearchHasRun = React.useMemo(\n () => \"undefined\" !== typeof props.reactivesearchResultProps.resultStats.numberOfResults,\n [props.reactivesearchResultProps]\n );\n\n const listStyle = React.useMemo<React.HTMLAttributes<HTMLElement>[\"style\"]>(\n () =>\n props.listStyle ?? {\n display: \"grid\",\n gap: \"8px\",\n gridTemplateColumns: \"repeat(4, minmax(0, 1fr))\",\n },\n [props.listStyle]\n );\n\n const infiniteScrollPosition = React.useMemo<number>(() => {\n if (!props.infiniteScrollPosition) {\n return NaN;\n }\n\n const scrollPositionOffset =\n props.reactivesearchResultProps.resultStats.displayedResults -\n (props.pageSize ?? filtersHook.filterStack?.pageSize ?? 0);\n\n return scrollPositionOffset + (props.infiniteScrollPosition ?? 0);\n }, [\n props.pageSize ?? filtersHook.filterStack?.pageSize,\n props.reactivesearchResultProps.resultStats.displayedResults,\n props.infiniteScrollPosition,\n ]);\n\n React.useEffect(() => {\n resultsHook.setResults(props.reactivesearchResultProps.data);\n resultsHook.setResultStats(props.reactivesearchResultProps.resultStats);\n }, [\n props.reactivesearchResultProps.resultStats.numberOfResults,\n props.reactivesearchResultProps.data.map((item) => item._id).join(\"\"),\n ]);\n\n const calculateGridOverflow = React.useCallback(\n (results: ReactivesearchResultProps[\"data\"]) => {\n if (!props.gridColumns) return;\n let total = results.length;\n for (const result of results) {\n if (result.type === ElasticDocumentType.Product) continue;\n total += parseInt(result.callout.displayColumns) * parseInt(result.callout.displayRows) - 1;\n }\n const overflow = props.gridColumns - (total % props.gridColumns);\n if (overflow === props.gridColumns) return;\n return overflow === props.gridColumns ? undefined : overflow;\n },\n [props.gridColumns]\n );\n\n const gridOverflowCallout = React.useMemo(():\n | (Omit<ElasticHit, \"_source\"> & ElasticCallout)\n | undefined => {\n // check if there are more results\n if (\n props.reactivesearchResultProps.resultStats.displayedResults ===\n props.reactivesearchResultProps.resultStats.numberOfResults\n ) {\n // check if we should only autofill when there are more results\n if (\n context.config.merchandising.calloutAutofillBehaviour ===\n MerchandisingCalloutAutofillBehaviour.MoreResults\n ) {\n return;\n }\n }\n\n const overflow = calculateGridOverflow(props.reactivesearchResultProps.data);\n\n const callout = context.config.callouts.find((item) => item.displayColumns === `${overflow}`);\n if (!callout) {\n return;\n }\n\n return {\n _id: callout.id,\n _score: 0,\n type: ElasticDocumentType.Callout,\n key: Math.random().toString(16),\n callout: {\n ...callout,\n enabled: true,\n },\n published: true,\n curations: [],\n };\n }, [\n props.reactivesearchResultProps.resultStats,\n props.reactivesearchResultProps.data,\n context.config.callouts,\n ]);\n\n const results = React.useMemo(\n () => [\n ...props.reactivesearchResultProps.data,\n ...(gridOverflowCallout ? [gridOverflowCallout] : []),\n ],\n [props.reactivesearchResultProps.data, gridOverflowCallout]\n );\n\n if (props.reactivesearchResultProps.error) {\n const RenderErrorComponent = props.renderError ?? ResultsRenderErrorComponent;\n\n return <RenderErrorComponent error={props.reactivesearchResultProps.error} />;\n }\n\n if (!initialSearchHasRun) {\n const RenderLoadingComponent = props.renderLoading ?? ResultsRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n\n if (props.showSubsequentLoadingStates === true) {\n if (props.reactivesearchResultProps.loading) {\n const RenderLoadingComponent = props.renderLoading ?? ResultsRenderLoadingComponent;\n return <RenderLoadingComponent />;\n }\n }\n\n if (\n !props.reactivesearchResultProps.loading &&\n !props.reactivesearchResultProps.resultStats.numberOfResults\n ) {\n const RenderNoResultsComponent = props.renderNoResults ?? ResultsRenderNoResultsComponent;\n\n return <RenderNoResultsComponent />;\n }\n\n if ([\"search\", \"instant-search\"].includes(context.options.mode)) {\n if (!context.search.searchTerm) {\n const RenderNoResultsComponent = props.renderNoResults ?? ResultsRenderNoResultsComponent;\n\n return <RenderNoResultsComponent />;\n }\n }\n\n return (\n <>\n <section style={listStyle} className={props.listClassName}>\n {results.map((item, key) => {\n if (ElasticDocumentType.Product === item.type) {\n return (\n <ResultCardProduct\n key={item._id}\n product={item}\n document={item}\n pagePosition={key + 1}\n render={props.renderResultCardProduct}\n {...(infiniteScrollPosition === key + 1\n ? {\n onView: () => props.reactivesearchResultProps.loadMore(),\n }\n : {})}\n />\n );\n }\n\n if (ElasticDocumentType.Callout === item.type) {\n return (\n <ResultCardCallout\n key={item._id}\n document={item}\n pagePosition={key + 1}\n callout={item.callout}\n render={props.renderResultCardCallout}\n {...(infiniteScrollPosition === key + 1\n ? {\n onView: () => props.reactivesearchResultProps.loadMore(),\n }\n : {})}\n />\n );\n }\n\n return null;\n })}\n </section>\n <ResultsPaginationStackLoadable {...props} {...props.reactivesearchResultProps} />\n </>\n );\n};\n\n/** Handles rendering pagination for types that use \"pagination props\" */\nconst ResultsPaginationStack: React.FC<ResultsProps & ReactivesearchPaginationProps> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"pagination\" === filterStack?.paginationType) {\n return <ResultPaginationNumbered {...props} render={props.renderPaginationNumbered} />;\n }\n\n if (\"next_prev\" === filterStack?.paginationType) {\n return <ResultPaginationNextPrev {...props} render={props.renderPaginationNextPrev} />;\n }\n\n return null;\n};\n\n/** Handles rendering pagination for types that use \"result props\" */\nconst ResultsPaginationStackLoadable: React.FC<\n ResultsProps & { reactivesearchResultProps: ReactivesearchResultProps }\n> = (props) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n if (options.mode === \"instant-search\") {\n return null;\n }\n\n if (\"load_more\" === filterStack?.paginationType) {\n return (\n <ResultPaginationLoadMore\n {...props.reactivesearchResultProps}\n render={props.renderPaginationLoadMore}\n />\n );\n }\n\n if (\"infinite_scroll\" === filterStack?.paginationType) {\n return (\n <ResultPaginationInfiniteScroll\n {...props.reactivesearchResultProps}\n render={props.renderPaginationInfiniteScroll}\n />\n );\n }\n\n return null;\n};\n"]}
|
|
@@ -54,6 +54,8 @@ export interface ReactivesearchResultProps {
|
|
|
54
54
|
triggerAnalytics: unknown;
|
|
55
55
|
triggerClickAnalytics: unknown;
|
|
56
56
|
}
|
|
57
|
+
export type ResultsDataListenerParams = Pick<ReactivesearchResultProps, "data" | "resultStats" | "rawData">;
|
|
58
|
+
export type ResultsDataListener = (params: ResultsDataListenerParams) => void;
|
|
57
59
|
export interface ReactivesearchSearchStatePage {
|
|
58
60
|
isLoading: boolean;
|
|
59
61
|
hits: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactivesearch.js","sourceRoot":"","sources":["../../../src/types/reactivesearch.ts"],"names":[],"mappings":"","sourcesContent":["import { ElasticDocument, ElasticHit } from \"./elastic\";\n\n// props passed to SingleList/MultiList.render\nexport interface ReactivesearchFilterListProps {\n loading: boolean;\n error: Error | null;\n handleChange: (key: string) => void;\n data: { doc_count: number; key: string }[];\n value: string | { [key: string]: boolean };\n rawData: {\n aggregations?: any;\n };\n}\n\n// props passed to ReactiveList.renderPagination\nexport interface ReactivesearchPaginationProps {\n pages: number;\n showEndPage: false;\n totalPages: number;\n currentPage: number;\n setPage: (page: number) => void;\n}\n\n// props passed to ReactiveList.render\n// @todo complete missing types\nexport interface ReactivesearchResultProps {\n error?: ReactivesearchError;\n loading: boolean;\n data: Array<Omit<ElasticHit, \"_source\"> & ElasticDocument>;\n loadMore: () => void;\n customData: unknown;\n promotedData: unknown;\n aggregationData: unknown;\n rawData?: {\n _shards: {\n failed: number;\n skipped: number;\n successful: number;\n total: number;\n };\n took: number;\n status: number;\n timed_out: boolean;\n hits: ElasticHit[];\n };\n resultStats: {\n time: number;\n hidden: number;\n promoted: number;\n currentPage: number;\n numberOfPages: number;\n numberOfResults?: number;\n displayedResults: number;\n };\n streamData: unknown;\n triggerAnalytics: unknown;\n triggerClickAnalytics: unknown;\n}\n\n// state for the \"page\" component returned by StateProvider when given the keys: [\"isLoading\", \"hits\", \"resultStats\", \"error\"]\nexport interface ReactivesearchSearchStatePage {\n isLoading: boolean;\n hits: {\n hidden: number;\n time: number;\n total: number;\n hits: ElasticHit[];\n };\n resultStats: {\n hidden: number;\n numberOfResults?: number;\n promoted: number;\n time: number;\n };\n error?: ReactivesearchError;\n}\n\nexport interface ReactivesearchError {\n status: number;\n statusText: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reactivesearch.js","sourceRoot":"","sources":["../../../src/types/reactivesearch.ts"],"names":[],"mappings":"","sourcesContent":["import { ElasticDocument, ElasticHit } from \"./elastic\";\n\n// props passed to SingleList/MultiList.render\nexport interface ReactivesearchFilterListProps {\n loading: boolean;\n error: Error | null;\n handleChange: (key: string) => void;\n data: { doc_count: number; key: string }[];\n value: string | { [key: string]: boolean };\n rawData: {\n aggregations?: any;\n };\n}\n\n// props passed to ReactiveList.renderPagination\nexport interface ReactivesearchPaginationProps {\n pages: number;\n showEndPage: false;\n totalPages: number;\n currentPage: number;\n setPage: (page: number) => void;\n}\n\n// props passed to ReactiveList.render\n// @todo complete missing types\nexport interface ReactivesearchResultProps {\n error?: ReactivesearchError;\n loading: boolean;\n data: Array<Omit<ElasticHit, \"_source\"> & ElasticDocument>;\n loadMore: () => void;\n customData: unknown;\n promotedData: unknown;\n aggregationData: unknown;\n rawData?: {\n _shards: {\n failed: number;\n skipped: number;\n successful: number;\n total: number;\n };\n took: number;\n status: number;\n timed_out: boolean;\n hits: ElasticHit[];\n };\n resultStats: {\n time: number;\n hidden: number;\n promoted: number;\n currentPage: number;\n numberOfPages: number;\n numberOfResults?: number;\n displayedResults: number;\n };\n streamData: unknown;\n triggerAnalytics: unknown;\n triggerClickAnalytics: unknown;\n}\n\nexport type ResultsDataListenerParams = Pick<\n ReactivesearchResultProps,\n \"data\" | \"resultStats\" | \"rawData\"\n>;\nexport type ResultsDataListener = (params: ResultsDataListenerParams) => void;\n\n// state for the \"page\" component returned by StateProvider when given the keys: [\"isLoading\", \"hits\", \"resultStats\", \"error\"]\nexport interface ReactivesearchSearchStatePage {\n isLoading: boolean;\n hits: {\n hidden: number;\n time: number;\n total: number;\n hits: ElasticHit[];\n };\n resultStats: {\n hidden: number;\n numberOfResults?: number;\n promoted: number;\n time: number;\n };\n error?: ReactivesearchError;\n}\n\nexport interface ReactivesearchError {\n status: number;\n statusText: string;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactiveList } from "@usereactify/search-internals";
|
|
2
2
|
import { ReactifySearchProviderProps } from "../components";
|
|
3
|
-
import { Config, ConfigFilter, ConfigFilterFacet } from "../types";
|
|
3
|
+
import { Config, ConfigFilter, ConfigFilterFacet, ResultsDataListener } from "../types";
|
|
4
4
|
export type GeneratePropsFilterGroupOptions = {
|
|
5
5
|
provider: ReactifySearchProviderProps;
|
|
6
6
|
config: Config;
|
|
@@ -35,6 +35,7 @@ export declare const getPropsFilterGroup: (options: GeneratePropsFilterGroupOpti
|
|
|
35
35
|
infiniteScroll: boolean;
|
|
36
36
|
renderNoResults: () => null;
|
|
37
37
|
source: typeof ReactiveList;
|
|
38
|
+
onData: ResultsDataListener | undefined;
|
|
38
39
|
} | {
|
|
39
40
|
componentId: string;
|
|
40
41
|
customQuery: () => unknown;
|
|
@@ -328,6 +329,7 @@ export declare const getPropsBase: (options: GeneratePropsBase) => {
|
|
|
328
329
|
export declare const getPropsResults: (options: GeneratePropsFilterGroupOptions & {
|
|
329
330
|
scrollTarget?: string | Element | HTMLDocument;
|
|
330
331
|
pageSize?: number;
|
|
332
|
+
onData?: ResultsDataListener;
|
|
331
333
|
}) => {
|
|
332
334
|
size: number;
|
|
333
335
|
URLParams: boolean;
|
|
@@ -346,6 +348,7 @@ export declare const getPropsResults: (options: GeneratePropsFilterGroupOptions
|
|
|
346
348
|
infiniteScroll: boolean;
|
|
347
349
|
renderNoResults: () => null;
|
|
348
350
|
source: typeof ReactiveList;
|
|
351
|
+
onData: ResultsDataListener | undefined;
|
|
349
352
|
};
|
|
350
353
|
export declare const getPropsReact: (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterFacet) => {
|
|
351
354
|
and: string[];
|
|
@@ -23,7 +23,7 @@ const package_json_1 = __importDefault(require("../../package.json"));
|
|
|
23
23
|
const getPropsFilterGroup = (options) => {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
return [
|
|
26
|
-
...(_b = (_a = options.filterGroup) === null || _a === void 0 ? void 0 : _a.options.map((filterGroupOption) => (0, exports.getPropsFilterGroupOption)(options, filterGroupOption))) !== null && _b !== void 0 ? _b : [],
|
|
26
|
+
...((_b = (_a = options.filterGroup) === null || _a === void 0 ? void 0 : _a.options.map((filterGroupOption) => (0, exports.getPropsFilterGroupOption)(options, filterGroupOption))) !== null && _b !== void 0 ? _b : []),
|
|
27
27
|
...(0, exports.getPropsSensors)(options),
|
|
28
28
|
(0, exports.getPropsResults)(options),
|
|
29
29
|
];
|
|
@@ -62,7 +62,9 @@ const getPropsSensors = (options) => {
|
|
|
62
62
|
};
|
|
63
63
|
exports.getPropsSensors = getPropsSensors;
|
|
64
64
|
const getPropsSensorCustom = (options) => {
|
|
65
|
-
const sensors = options.provider.mode === "collection"
|
|
65
|
+
const sensors = options.provider.mode === "collection"
|
|
66
|
+
? options.config.sensors.collection
|
|
67
|
+
: options.config.sensors.search;
|
|
66
68
|
return sensors.map((sensor, index) => ({
|
|
67
69
|
componentId: `SensorCustom_${index}`,
|
|
68
70
|
customQuery: () => sensor,
|
|
@@ -109,7 +111,8 @@ const getPropsSensorCollection = (options) => {
|
|
|
109
111
|
},
|
|
110
112
|
},
|
|
111
113
|
],
|
|
112
|
-
must: [
|
|
114
|
+
must: [
|
|
115
|
+
{
|
|
113
116
|
nested: {
|
|
114
117
|
path: "curations",
|
|
115
118
|
query: {
|
|
@@ -118,7 +121,8 @@ const getPropsSensorCollection = (options) => {
|
|
|
118
121
|
},
|
|
119
122
|
},
|
|
120
123
|
},
|
|
121
|
-
}
|
|
124
|
+
},
|
|
125
|
+
],
|
|
122
126
|
},
|
|
123
127
|
},
|
|
124
128
|
},
|
|
@@ -165,15 +169,18 @@ const getPropsSensorPublished = (options) => {
|
|
|
165
169
|
return {
|
|
166
170
|
query: {
|
|
167
171
|
bool: {
|
|
168
|
-
must: [
|
|
172
|
+
must: [
|
|
173
|
+
{
|
|
169
174
|
match: {
|
|
170
175
|
markets: options.provider.market,
|
|
171
176
|
},
|
|
172
|
-
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
173
179
|
match: {
|
|
174
180
|
published: true,
|
|
175
181
|
},
|
|
176
|
-
}
|
|
182
|
+
},
|
|
183
|
+
],
|
|
177
184
|
},
|
|
178
185
|
},
|
|
179
186
|
};
|
|
@@ -216,7 +223,9 @@ const getPropsSensorInventoryAvailable = (options) => {
|
|
|
216
223
|
path: "variants",
|
|
217
224
|
query: {
|
|
218
225
|
match: {
|
|
219
|
-
[options.provider.market
|
|
226
|
+
[options.provider.market
|
|
227
|
+
? `variants.available_market_${options.provider.market}`
|
|
228
|
+
: "variants.available"]: true,
|
|
220
229
|
},
|
|
221
230
|
},
|
|
222
231
|
},
|
|
@@ -298,8 +307,7 @@ const getPropsBase = (options) => {
|
|
|
298
307
|
//
|
|
299
308
|
// https://github.com/appbaseio/reactivesearch/issues/1530
|
|
300
309
|
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.aggregations) === null || _a === void 0 ? void 0 : _a.reactivesearch_nested) === null || _b === void 0 ? void 0 : _b.reactify_nested_outer) {
|
|
301
|
-
response.aggregations.reactivesearch_nested =
|
|
302
|
-
(0, hooks_1.replaceDocCountWithParent)((_d = (_c = response === null || response === void 0 ? void 0 : response.aggregations) === null || _c === void 0 ? void 0 : _c.reactivesearch_nested) === null || _d === void 0 ? void 0 : _d.reactify_nested_outer);
|
|
310
|
+
response.aggregations.reactivesearch_nested = (0, hooks_1.replaceDocCountWithParent)((_d = (_c = response === null || response === void 0 ? void 0 : response.aggregations) === null || _c === void 0 ? void 0 : _c.reactivesearch_nested) === null || _d === void 0 ? void 0 : _d.reactify_nested_outer);
|
|
303
311
|
}
|
|
304
312
|
return response;
|
|
305
313
|
}),
|
|
@@ -349,12 +357,7 @@ const getPropsResults = (options) => {
|
|
|
349
357
|
infiniteScroll: ((_e = options.filterGroup) === null || _e === void 0 ? void 0 : _e.paginationType) === "infinite_scroll",
|
|
350
358
|
renderNoResults: () => null, // always use only render, otherwise both are shown
|
|
351
359
|
source: search_internals_1.ReactiveList,
|
|
352
|
-
|
|
353
|
-
// sort: ["_score"],
|
|
354
|
-
// query: {
|
|
355
|
-
// match_all: {}
|
|
356
|
-
// }
|
|
357
|
-
// })
|
|
360
|
+
onData: options.onData,
|
|
358
361
|
};
|
|
359
362
|
};
|
|
360
363
|
exports.getPropsResults = getPropsResults;
|
|
@@ -590,7 +593,7 @@ const getPropsFilterSlider = (filterGroupOption, query, value) => {
|
|
|
590
593
|
},
|
|
591
594
|
],
|
|
592
595
|
},
|
|
593
|
-
}
|
|
596
|
+
},
|
|
594
597
|
};
|
|
595
598
|
})();
|
|
596
599
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAAgI;AAChI,8CAAwE;AAExE,yCAAyC;AACzC,6CAAkF;AAClF,uCAA2C;AAC3C,oCAAqD;AAErD,sEAAqC;AAqB9B,MAAM,mBAAmB,GAAG,CAAC,OAAwC,EAAE,EAAE;;IAC9E,OAAO;QACL,GAAG,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,IAAA,iCAAyB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,mCAAI,EAAE;QACvH,GAAG,IAAA,uBAAe,EAAC,OAAO,CAAC;QAC3B,IAAA,uBAAe,EAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEK,MAAM,yBAAyB,GAAG,CAAC,OAAwC,EAAE,iBAAoC,EAAE,EAAE;;IAC1H,IAAI,WAAW,GAA4B,EAAE,CAAC;IA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C,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,mCAAI,OAAO,CAAC,CAAC;IAEtK,MAAM,YAAY,GAAG;QACnB,IAAI,EAAE;YACJ,GAAG,EAAE;gBACH,GAAG,EAAE;oBACH,KAAK,EAAE,iBAAiB,CAAC,KAAK;iBAC/B;aACF;YACD,GAAG,EAAE;gBACH,GAAG,EAAE;oBACH,KAAK,EAAE,iBAAiB,CAAC,KAAK;iBAC/B;aACF;SACF;KACF,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;QACxB,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,OAAO;QACT,CAAC;QAED,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE;gCACJ,IAAI,EAAE;oCACJ;wCACE,KAAK,EAAE;4CACL,SAAS,EAAE,IAAI;yCAChB;qCACF;oCACD;wCACE,KAAK,EAAE;4CACL,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;gDACzB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;gDACnB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;gDACnB,KAAK,EAAE,CAAC;6CACT;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;QACL,YAAY;QACZ,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,oBAAoB,wBAyD/B","sourcesContent":["import { MultiList, MultiRange, ReactiveComponent, ReactiveList, SingleList, SingleRange } from \"@usereactify/search-internals\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterFacet } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\nimport { replaceDocCountWithParent } from \"../hooks\";\n\nimport pkg from \"../../package.json\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsBase = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport const getPropsFilterGroup = (options: GeneratePropsFilterGroupOptions) => {\n return [\n ...options.filterGroup?.options.map((filterGroupOption) => getPropsFilterGroupOption(options, filterGroupOption)) ?? [],\n ...getPropsSensors(options),\n getPropsResults(options),\n ];\n};\n\nexport const getPropsFilterGroupOption = (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterFacet) => {\n let filterProps: Record<string, unknown> = {};\n\n if (filterGroupOption.displayType === \"slider\") {\n const sliderFilterProps = getPropsFilterSlider(filterGroupOption, options.provider.query ?? {});\n filterProps = {\n defaultQuery: () => sliderFilterProps.defaultQuery,\n customQuery: () => sliderFilterProps.customQuery,\n };\n }\n\n if (filterGroupOption.displayType === \"single\" || filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n filterProps = getPropsFilterRange(filterGroupOption);\n } else {\n filterProps = getPropsFilterList(filterGroupOption);\n }\n }\n\n const sharedProps = getPropsShared(options, filterGroupOption);\n\n return {\n ...sharedProps,\n ...filterProps,\n };\n};\n\nexport const getPropsSensors = (options: GeneratePropsSensorOptions) => {\n return [\n ...getPropsSensorCustom(options),\n getPropsSensorCollection(options),\n getPropsSensorPublished(options),\n getPropsSensorInventoryAvailable(options),\n getPropsSensorSort(options),\n ].filter(Boolean);\n}\n\nexport const getPropsSensorCustom = (options: GeneratePropsSensorOptions) => {\n const sensors = options.provider.mode === \"collection\" ? options.config.sensors.collection : options.config.sensors.search;\n\n return sensors.map((sensor, index) => ({\n componentId: `SensorCustom_${index}`,\n customQuery: () => sensor,\n source: ReactiveComponent,\n }));\n}\n\nexport const getPropsSensorCollection = (options: GeneratePropsSensorOptions) => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n \n return {\n componentId: \"SensorCollection\",\n customQuery: () => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n\n const conditions: Array<unknown> = [];\n\n if (options.provider.market) {\n conditions.push({\n nested: {\n path: \"curations\",\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n must: [{\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.markets.keyword\": options.provider.market,\n },\n },\n },\n }]\n },\n },\n },\n });\n }\n \n return {\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n },\n },\n } \n },\n source: ReactiveComponent,\n };\n}\n\nexport const getPropsSensorPublished = (options: GeneratePropsSensorOptions) => {\n return {\n componentId: \"SensorPublished\",\n customQuery: () => {\n if (options.provider.market) {\n return {\n query: {\n bool: {\n must:[{\n match: {\n markets: options.provider.market,\n },\n },{\n match: {\n published: true,\n },\n }]\n },\n },\n };\n }\n\n return {\n query: {\n match: {\n published: true,\n },\n },\n }\n },\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorInventoryAvailable = (options: GeneratePropsSensorOptions) => {\n const filterStack = getFilterStack(options);\n\n if (!filterStack || \"show_all\" === filterStack.inventoryVisibility) {\n return null;\n }\n\n return {\n componentId: \"SensorInventoryAvailable\",\n customQuery: () => ({\n query: {\n bool: {\n should: [\n {\n bool: {\n must: [\n {\n term: {\n type: {\n value: \"product\",\n },\n },\n },\n {\n nested: {\n path: \"variants\",\n query: {\n match: {\n [options.provider.market ? `variants.available_market_${options.provider.market}` : \"variants.available\"]: true\n },\n },\n },\n },\n ],\n },\n },\n ...(options.provider.mode === \"instant-search\"\n ? []\n : [\n {\n term: {\n type: {\n value: \"callout\",\n },\n },\n },\n ]),\n ],\n minimum_should_match: \"1\",\n },\n },\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorSort = (options: GeneratePropsSensorOptions & { searchTerm?: string; sortOption?: string; }) => {\n const curation = getCuration(options);\n const sortOption = getSortOption(options);\n\n const sort = generateSortSort({\n provider: options.provider,\n config: options.config,\n curation: curation,\n sortOption: sortOption,\n });\n const query = generateSortQuery({\n provider: options.provider,\n sortOption: sortOption,\n curation: curation,\n });\n\n return {\n componentId: \"SensorSort\",\n customQuery: () => ({\n sort,\n query,\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsBase = (options: GeneratePropsBase) => {\n const props = {\n app: options.config.index,\n url: options.config.endpoint,\n credentials: options.provider.credentials,\n theme: options.provider.theme,\n initialState: options.provider.preload?.state,\n transformSort: () => {\n const sortSensor = getPropsSensorSort(options);\n const customQuery = sortSensor.customQuery();\n\n return customQuery.sort;\n },\n transformRequest: (request: any) => {\n if ((request.url as string).endsWith(\"?\")) {\n request.url = request.url.substring(0, request.url.length - 1);\n }\n return request;\n },\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n replaceDocCountWithParent(\n response?.aggregations?.reactivesearch_nested\n ?.reactify_nested_outer\n );\n }\n\n return response;\n },\n headers: {\n \"x-reactify-shop\": options.provider.shopifyPermanentDomain,\n \"x-reactify-mode\": options.provider.mode,\n \"x-reactify-client-id\": options.provider.clientId,\n \"x-reactify-client-version\": pkg.version,\n },\n };\n\n return props;\n}\n\nexport const getPropsResults = (options: GeneratePropsFilterGroupOptions & { scrollTarget?: string | Element | HTMLDocument; pageSize?: number; }) => {\n const includeFieldsProp = (() => {\n return [\n ...(options.provider.includeFields ?? []),\n \"id\",\n \"title\",\n \"type\",\n \"handle\",\n \"image\",\n \"variants.id\",\n \"variants.presentment_prices\",\n \"callout\",\n ];\n })();\n const excludeFieldsProp = (() => {\n return [...(options.provider.excludeFields ?? [])];\n })();\n\n return {\n size: options.pageSize ?? options.filterGroup?.pageSize ?? 20,\n URLParams: options.provider.mode === \"instant-search\" ? false : true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: getPropsReact(options),\n includeFields: includeFieldsProp,\n excludeFields: excludeFieldsProp,\n scrollTarget: options.scrollTarget,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: options.filterGroup?.paginationType !== \"infinite_scroll\",\n infiniteScroll: options.filterGroup?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n source: ReactiveList,\n // defaultQuery: () => ({\n // sort: [\"_score\"],\n // query: {\n // match_all: {}\n // }\n // })\n }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterFacet) => {\n const sensorIds = SENSOR_IDS(options.provider.mode, options.config);\n const reactProp = (() => {\n if (filterGroupOption?.settingsShowEmptyValues) {\n return {\n and: sensorIds,\n };\n }\n\n return {\n and: [\n ...sensorIds,\n ...(options.provider.additionalComponentIds ?? []),\n ...(options.filterGroup?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== filterGroupOption?.handle),\n };\n })();\n\n return reactProp;\n};\n\nexport const getPropsShared = (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterFacet) => {\n const reactProp = getPropsReact(options, filterGroupOption);\n const nestedFieldProp = (() => {\n const nestedFields = [\"variants\"];\n const topField = filterGroupOption.field.split(\".\")[0];\n if (nestedFields.includes(topField)) {\n return topField;\n }\n return undefined;\n })();\n const customQueryProp = (() => {\n if (\n !filterGroupOption.settingsHideUnavailable ||\n !filterGroupOption.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filterGroupOption.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n })();\n const defaultQueryProp = (() => {\n if (!filterGroupOption.field.startsWith(\"variants.\")) {\n return undefined;\n }\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n bool: {\n minimum_should_match: 1,\n should: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n match: {\n \"variants.available\": filterGroupOption.settingsHideUnavailable\n ? \"true\"\n : \"false\",\n },\n },\n ],\n },\n },\n aggs: {\n [filterGroupOption.field]: {\n terms: {\n field: filterGroupOption.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n aggs: {\n parent_docs: { reverse_nested: {} },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n })();\n const sourceProp = (() => {\n if (filterGroupOption.displayType === \"slider\") {\n return ReactiveComponent;\n }\n if (filterGroupOption.displayType === \"single\") {\n if (filterGroupOption.displayView === \"range\") {\n return SingleRange;\n }\n return SingleList;\n }\n if (filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n return MultiRange;\n }\n return MultiList;\n }\n \n return;\n })();\n\n const fieldProp = (() => {\n if ([\"price_min\", \"price_max\"].includes(filterGroupOption.field) && options.provider.market) {\n return `${filterGroupOption.field}_market_${options.provider.market}`;\n }\n\n return filterGroupOption.field;\n })();\n\n return {\n URLParams: true,\n componentId: filterGroupOption.handle,\n dataField: fieldProp,\n filterLabel: filterGroupOption.name,\n nestedField: nestedFieldProp,\n customQuery: customQueryProp,\n defaultQuery: defaultQueryProp,\n source: sourceProp,\n react: reactProp,\n }\n};\n\nexport const getPropsFilterList = (filterGroupOption: ConfigFilterFacet) => {\n return {\n size: parseInt(filterGroupOption.displaySize) || undefined,\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showLoadMore: filterGroupOption.settingsShowMore ?? false,\n showSearch: filterGroupOption.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n };\n};\n\nexport const getPropsFilterRange = (filterGroupOption: ConfigFilterFacet) => {\n const data = filterGroupOption.displayRangeOptions?.map((option) => {\n const [label, start, end] = option.split(\":\");\n return {\n label: label,\n start: start ? parseInt(start) : 0,\n end: end ? parseInt(end) : Number.MAX_SAFE_INTEGER,\n };\n }) ?? [];\n\n return {\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n data: data,\n };\n};\n\nexport const getPropsFilterSlider = (filterGroupOption: ConfigFilterFacet, query: Record<string, string> | string, value?: [number, number] | []) => {\n const filterValue = value ?? JSON.parse(new URLSearchParams(typeof window === \"undefined\" ? query : window.location.search).get(filterGroupOption.handle) ?? \"[0,0]\");\n\n const defaultQuery = {\n aggs: {\n min: {\n min: {\n field: filterGroupOption.field,\n },\n },\n max: {\n max: {\n field: filterGroupOption.field,\n },\n },\n },\n };\n\n const customQuery = (() => {\n if (filterValue[0] === 0 && filterValue[1] === 0) {\n return;\n }\n\n return {\n query: {\n bool: {\n must: [\n {\n bool: {\n must: [\n {\n match: {\n published: true,\n },\n },\n {\n range: {\n [filterGroupOption.field]: {\n gte: filterValue[0],\n lte: filterValue[1],\n boost: 2,\n },\n },\n },\n ],\n },\n },\n ],\n },\n }\n };\n })();\n \n return {\n defaultQuery,\n customQuery,\n };\n};"]}
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAOuC;AACvC,8CAAwE;AAExE,yCAAyC;AACzC,6CAAkF;AAClF,uCAA2C;AAC3C,oCAAqD;AAErD,sEAAqC;AAqB9B,MAAM,mBAAmB,GAAG,CAAC,OAAwC,EAAE,EAAE;;IAC9E,OAAO;QACL,GAAG,CAAC,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CACzD,IAAA,iCAAyB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CACtD,mCAAI,EAAE,CAAC;QACR,GAAG,IAAA,uBAAe,EAAC,OAAO,CAAC;QAC3B,IAAA,uBAAe,EAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEK,MAAM,yBAAyB,GAAG,CACvC,OAAwC,EACxC,iBAAoC,EACpC,EAAE;;IACF,IAAI,WAAW,GAA4B,EAAE,CAAC;IAE9C,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QAC/C,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,EAAC,iBAAiB,EAAE,MAAA,OAAO,CAAC,QAAQ,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC;QAChG,WAAW,GAAG;YACZ,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC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K,EAAE,iBAAiB,CAAC,KAAK;iBAC/B;aACF;SACF;KACF,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;QACxB,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,OAAO;QACT,CAAC;QAED,OAAO;YACL,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ;4BACE,IAAI,EAAE;gCACJ,IAAI,EAAE;oCACJ;wCACE,KAAK,EAAE;4CACL,SAAS,EAAE,IAAI;yCAChB;qCACF;oCACD;wCACE,KAAK,EAAE;4CACL,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;gDACzB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;gDACnB,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;gDACnB,KAAK,EAAE,CAAC;6CACT;yCACF;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO;QACL,YAAY;QACZ,WAAW;KACZ,CAAC;AACJ,CAAC,CAAC;AAnEW,QAAA,oBAAoB,wBAmE/B","sourcesContent":["import {\n MultiList,\n MultiRange,\n ReactiveComponent,\n ReactiveList,\n SingleList,\n SingleRange,\n} from \"@usereactify/search-internals\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterFacet, ResultsDataListener } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\nimport { replaceDocCountWithParent } from \"../hooks\";\n\nimport pkg from \"../../package.json\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsBase = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport const getPropsFilterGroup = (options: GeneratePropsFilterGroupOptions) => {\n return [\n ...(options.filterGroup?.options.map((filterGroupOption) =>\n getPropsFilterGroupOption(options, filterGroupOption)\n ) ?? []),\n ...getPropsSensors(options),\n getPropsResults(options),\n ];\n};\n\nexport const getPropsFilterGroupOption = (\n options: GeneratePropsFilterGroupOptions,\n filterGroupOption: ConfigFilterFacet\n) => {\n let filterProps: Record<string, unknown> = {};\n\n if (filterGroupOption.displayType === \"slider\") {\n const sliderFilterProps = getPropsFilterSlider(filterGroupOption, options.provider.query ?? {});\n filterProps = {\n defaultQuery: () => sliderFilterProps.defaultQuery,\n customQuery: () => sliderFilterProps.customQuery,\n };\n }\n\n if (filterGroupOption.displayType === \"single\" || filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n filterProps = getPropsFilterRange(filterGroupOption);\n } else {\n filterProps = getPropsFilterList(filterGroupOption);\n }\n }\n\n const sharedProps = getPropsShared(options, filterGroupOption);\n\n return {\n ...sharedProps,\n ...filterProps,\n };\n};\n\nexport const getPropsSensors = (options: GeneratePropsSensorOptions) => {\n return [\n ...getPropsSensorCustom(options),\n getPropsSensorCollection(options),\n getPropsSensorPublished(options),\n getPropsSensorInventoryAvailable(options),\n getPropsSensorSort(options),\n ].filter(Boolean);\n};\n\nexport const getPropsSensorCustom = (options: GeneratePropsSensorOptions) => {\n const sensors =\n options.provider.mode === \"collection\"\n ? options.config.sensors.collection\n : options.config.sensors.search;\n\n return sensors.map((sensor, index) => ({\n componentId: `SensorCustom_${index}`,\n customQuery: () => sensor,\n source: ReactiveComponent,\n }));\n};\n\nexport const getPropsSensorCollection = (options: GeneratePropsSensorOptions) => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n\n return {\n componentId: \"SensorCollection\",\n customQuery: () => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n\n const conditions: Array<unknown> = [];\n\n if (options.provider.market) {\n conditions.push({\n nested: {\n path: \"curations\",\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n must: [\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.markets.keyword\": options.provider.market,\n },\n },\n },\n },\n ],\n },\n },\n },\n });\n }\n\n return {\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n },\n },\n };\n },\n source: ReactiveComponent,\n };\n};\n\nexport const getPropsSensorPublished = (options: GeneratePropsSensorOptions) => {\n return {\n componentId: \"SensorPublished\",\n customQuery: () => {\n if (options.provider.market) {\n return {\n query: {\n bool: {\n must: [\n {\n match: {\n markets: options.provider.market,\n },\n },\n {\n match: {\n published: true,\n },\n },\n ],\n },\n },\n };\n }\n\n return {\n query: {\n match: {\n published: true,\n },\n },\n };\n },\n source: ReactiveComponent,\n };\n};\n\nexport const getPropsSensorInventoryAvailable = (options: GeneratePropsSensorOptions) => {\n const filterStack = getFilterStack(options);\n\n if (!filterStack || \"show_all\" === filterStack.inventoryVisibility) {\n return null;\n }\n\n return {\n componentId: \"SensorInventoryAvailable\",\n customQuery: () => ({\n query: {\n bool: {\n should: [\n {\n bool: {\n must: [\n {\n term: {\n type: {\n value: \"product\",\n },\n },\n },\n {\n nested: {\n path: \"variants\",\n query: {\n match: {\n [options.provider.market\n ? `variants.available_market_${options.provider.market}`\n : \"variants.available\"]: true,\n },\n },\n },\n },\n ],\n },\n },\n ...(options.provider.mode === \"instant-search\"\n ? []\n : [\n {\n term: {\n type: {\n value: \"callout\",\n },\n },\n },\n ]),\n ],\n minimum_should_match: \"1\",\n },\n },\n }),\n source: ReactiveComponent,\n };\n};\n\nexport const getPropsSensorSort = (\n options: GeneratePropsSensorOptions & {\n searchTerm?: string;\n sortOption?: string;\n }\n) => {\n const curation = getCuration(options);\n const sortOption = getSortOption(options);\n\n const sort = generateSortSort({\n provider: options.provider,\n config: options.config,\n curation: curation,\n sortOption: sortOption,\n });\n const query = generateSortQuery({\n provider: options.provider,\n sortOption: sortOption,\n curation: curation,\n });\n\n return {\n componentId: \"SensorSort\",\n customQuery: () => ({\n sort,\n query,\n }),\n source: ReactiveComponent,\n };\n};\n\nexport const getPropsBase = (options: GeneratePropsBase) => {\n const props = {\n app: options.config.index,\n url: options.config.endpoint,\n credentials: options.provider.credentials,\n theme: options.provider.theme,\n initialState: options.provider.preload?.state,\n transformSort: () => {\n const sortSensor = getPropsSensorSort(options);\n const customQuery = sortSensor.customQuery();\n\n return customQuery.sort;\n },\n transformRequest: (request: any) => {\n if ((request.url as string).endsWith(\"?\")) {\n request.url = request.url.substring(0, request.url.length - 1);\n }\n return request;\n },\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (response?.aggregations?.reactivesearch_nested?.reactify_nested_outer) {\n response.aggregations.reactivesearch_nested = replaceDocCountWithParent(\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n );\n }\n\n return response;\n },\n headers: {\n \"x-reactify-shop\": options.provider.shopifyPermanentDomain,\n \"x-reactify-mode\": options.provider.mode,\n \"x-reactify-client-id\": options.provider.clientId,\n \"x-reactify-client-version\": pkg.version,\n },\n };\n\n return props;\n};\n\nexport const getPropsResults = (\n options: GeneratePropsFilterGroupOptions & {\n scrollTarget?: string | Element | HTMLDocument;\n pageSize?: number;\n onData?: ResultsDataListener;\n }\n) => {\n const includeFieldsProp = (() => {\n return [\n ...(options.provider.includeFields ?? []),\n \"id\",\n \"title\",\n \"type\",\n \"handle\",\n \"image\",\n \"variants.id\",\n \"variants.presentment_prices\",\n \"callout\",\n ];\n })();\n const excludeFieldsProp = (() => {\n return [...(options.provider.excludeFields ?? [])];\n })();\n\n return {\n size: options.pageSize ?? options.filterGroup?.pageSize ?? 20,\n URLParams: options.provider.mode === \"instant-search\" ? false : true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: getPropsReact(options),\n includeFields: includeFieldsProp,\n excludeFields: excludeFieldsProp,\n scrollTarget: options.scrollTarget,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: options.filterGroup?.paginationType !== \"infinite_scroll\",\n infiniteScroll: options.filterGroup?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n source: ReactiveList,\n onData: options.onData,\n };\n};\n\nexport const getPropsReact = (\n options: GeneratePropsFilterGroupOptions,\n filterGroupOption?: ConfigFilterFacet\n) => {\n const sensorIds = SENSOR_IDS(options.provider.mode, options.config);\n const reactProp = (() => {\n if (filterGroupOption?.settingsShowEmptyValues) {\n return {\n and: sensorIds,\n };\n }\n\n return {\n and: [\n ...sensorIds,\n ...(options.provider.additionalComponentIds ?? []),\n ...(options.filterGroup?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== filterGroupOption?.handle),\n };\n })();\n\n return reactProp;\n};\n\nexport const getPropsShared = (\n options: GeneratePropsFilterGroupOptions,\n filterGroupOption: ConfigFilterFacet\n) => {\n const reactProp = getPropsReact(options, filterGroupOption);\n const nestedFieldProp = (() => {\n const nestedFields = [\"variants\"];\n const topField = filterGroupOption.field.split(\".\")[0];\n if (nestedFields.includes(topField)) {\n return topField;\n }\n return undefined;\n })();\n const customQueryProp = (() => {\n if (\n !filterGroupOption.settingsHideUnavailable ||\n !filterGroupOption.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filterGroupOption.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n })();\n const defaultQueryProp = (() => {\n if (!filterGroupOption.field.startsWith(\"variants.\")) {\n return undefined;\n }\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n bool: {\n minimum_should_match: 1,\n should: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n match: {\n \"variants.available\": filterGroupOption.settingsHideUnavailable\n ? \"true\"\n : \"false\",\n },\n },\n ],\n },\n },\n aggs: {\n [filterGroupOption.field]: {\n terms: {\n field: filterGroupOption.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n aggs: {\n parent_docs: { reverse_nested: {} },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n })();\n const sourceProp = (() => {\n if (filterGroupOption.displayType === \"slider\") {\n return ReactiveComponent;\n }\n if (filterGroupOption.displayType === \"single\") {\n if (filterGroupOption.displayView === \"range\") {\n return SingleRange;\n }\n return SingleList;\n }\n if (filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n return MultiRange;\n }\n return MultiList;\n }\n\n return;\n })();\n\n const fieldProp = (() => {\n if ([\"price_min\", \"price_max\"].includes(filterGroupOption.field) && options.provider.market) {\n return `${filterGroupOption.field}_market_${options.provider.market}`;\n }\n\n return filterGroupOption.field;\n })();\n\n return {\n URLParams: true,\n componentId: filterGroupOption.handle,\n dataField: fieldProp,\n filterLabel: filterGroupOption.name,\n nestedField: nestedFieldProp,\n customQuery: customQueryProp,\n defaultQuery: defaultQueryProp,\n source: sourceProp,\n react: reactProp,\n };\n};\n\nexport const getPropsFilterList = (filterGroupOption: ConfigFilterFacet) => {\n return {\n size: parseInt(filterGroupOption.displaySize) || undefined,\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showLoadMore: filterGroupOption.settingsShowMore ?? false,\n showSearch: filterGroupOption.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n };\n};\n\nexport const getPropsFilterRange = (filterGroupOption: ConfigFilterFacet) => {\n const data =\n filterGroupOption.displayRangeOptions?.map((option) => {\n const [label, start, end] = option.split(\":\");\n return {\n label: label,\n start: start ? parseInt(start) : 0,\n end: end ? parseInt(end) : Number.MAX_SAFE_INTEGER,\n };\n }) ?? [];\n\n return {\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n data: data,\n };\n};\n\nexport const getPropsFilterSlider = (\n filterGroupOption: ConfigFilterFacet,\n query: Record<string, string> | string,\n value?: [number, number] | []\n) => {\n const filterValue =\n value ??\n JSON.parse(\n new URLSearchParams(typeof window === \"undefined\" ? query : window.location.search).get(\n filterGroupOption.handle\n ) ?? \"[0,0]\"\n );\n\n const defaultQuery = {\n aggs: {\n min: {\n min: {\n field: filterGroupOption.field,\n },\n },\n max: {\n max: {\n field: filterGroupOption.field,\n },\n },\n },\n };\n\n const customQuery = (() => {\n if (filterValue[0] === 0 && filterValue[1] === 0) {\n return;\n }\n\n return {\n query: {\n bool: {\n must: [\n {\n bool: {\n must: [\n {\n match: {\n published: true,\n },\n },\n {\n range: {\n [filterGroupOption.field]: {\n gte: filterValue[0],\n lte: filterValue[1],\n boost: 2,\n },\n },\n },\n ],\n },\n },\n ],\n },\n },\n };\n })();\n\n return {\n defaultQuery,\n customQuery,\n };\n};\n\n"]}
|