@usereactify/search 5.49.0 → 5.49.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/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
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.49.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.49.1...release-v5.49.2) (2024-03-03)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * correctly parse URL query params within SSR ([a7bea5c](https://bitbucket.org/usereactify/reactify-search-ui/commit/a7bea5ce9befc3f358af48912dab078f2ac2e4f0))
11
+ * minor react key issues in ExampleFitlersSelected ([ad94ea6](https://bitbucket.org/usereactify/reactify-search-ui/commit/ad94ea6645026490b11aac1de4627e42b702a467))
12
+ * select correct filter group and rework filter doc count ([7eee273](https://bitbucket.org/usereactify/reactify-search-ui/commit/7eee27399fb6441dd0ba6a3507d895c10034e4ca))
13
+
14
+ ### [5.49.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.49.0...release-v5.49.1) (2024-02-22)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * use correct name for sort sensor ([65a638c](https://bitbucket.org/usereactify/reactify-search-ui/commit/65a638cb1fb2f38a9999d39c82cb4167180f3867))
20
+
5
21
  ## [5.49.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.48.0...release-v5.49.0) (2024-02-21)
6
22
 
7
23
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.49.0",
4
+ "version": "5.49.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -9,14 +9,14 @@ const hooks_1 = require("../../hooks");
9
9
  const ExampleFiltersSelected = (props) => {
10
10
  return (react_1.default.createElement("div", { className: "rs__filters-selected" },
11
11
  react_1.default.createElement("h3", { className: "rs__filters-selected__name" }, "Filters Selected"),
12
- react_1.default.createElement("ul", { className: "rs__filters-selected__list" }, props.selectedFilters.map((selectedFilter) => (react_1.default.createElement(ExampleFiltersSelectedItem, { selectedFilter: selectedFilter, handleRemove: props.handleRemove }))))));
12
+ react_1.default.createElement("ul", { className: "rs__filters-selected__list" }, props.selectedFilters.map((selectedFilter) => (react_1.default.createElement(ExampleFiltersSelectedItem, { key: selectedFilter.key + selectedFilter.value, selectedFilter: selectedFilter, handleRemove: props.handleRemove }))))));
13
13
  };
14
14
  exports.ExampleFiltersSelected = ExampleFiltersSelected;
15
15
  const ExampleFiltersSelectedItem = (props) => {
16
16
  var _a;
17
17
  const filtersHook = (0, hooks_1.useFilters)();
18
18
  const filter = (_a = filtersHook.filters) === null || _a === void 0 ? void 0 : _a.find((filter) => filter.handle === props.selectedFilter.key);
19
- return (react_1.default.createElement("li", { key: props.selectedFilter.key, className: "rs__filters-selected__list-item" },
19
+ return (react_1.default.createElement("li", { className: "rs__filters-selected__list-item" },
20
20
  react_1.default.createElement("label", { className: "rs__filters-selected__list-item-label" },
21
21
  react_1.default.createElement("span", { className: "rs__filters-selected__list-item-label", onClick: () => props.handleRemove(props.selectedFilter.key) },
22
22
  props.selectedFilter.label,
@@ -29,8 +29,8 @@ const ExampleFiltersSelectedItem = (props) => {
29
29
  react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [
30
30
  props.selectedFilter.value,
31
31
  ]) }, props.selectedFilter.value))),
32
- (filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView === "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [value.label]) }, value.label))))),
33
- (filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView !== "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [value]) }, value))))),
32
+ (filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView === "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { key: value.label, onClick: () => props.handleRemove(props.selectedFilter.key, [value.label]) }, value.label))))),
33
+ (filter === null || filter === void 0 ? void 0 : filter.displayType) === "multi" && filter.displayView !== "range" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" }, props.selectedFilter.value.map((value) => (react_1.default.createElement("span", { key: value, onClick: () => props.handleRemove(props.selectedFilter.key, [value]) }, value))))),
34
34
  (filter === null || filter === void 0 ? void 0 : filter.displayType) === "slider" && (react_1.default.createElement("span", { className: "rs__filters-selected__list-item-value" },
35
35
  react_1.default.createElement("span", { onClick: () => props.handleRemove(props.selectedFilter.key, [""]) }, `${filter.displaySliderPrefix}${props.selectedFilter.value[0]} to ${filter.displaySliderPrefix}${props.selectedFilter.value[1]}`))))));
36
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAyC;AAMlC,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,sBAAsB;QACnC,sCAAI,SAAS,EAAC,4BAA4B,IAAE,kBAAkB,CAAM;QACpE,sCAAI,SAAS,EAAC,4BAA4B,IACvC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAC7C,8BAAC,0BAA0B,IACzB,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,KAAK,CAAC,YAAY,GAChC,CACH,CAAC,CACC,CACD,CACP,CAAC;AAC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Aa,CAAC,CAAC,CACvC,OAAO,MAAM,CAAC,mBAAmB,GAC9B,KAAK,CAAC,cAAc,CAAC,KAAa,CAAC,CAAC,CACvC,EAAE,CACG,CACF,CACR,CACK,CACL,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\n\nimport { FiltersSelectedProps } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ExampleFiltersSelectedProps = React.ComponentProps<\n NonNullable<FiltersSelectedProps[\"render\"]>\n>;\n\nexport const ExampleFiltersSelected: React.FC<ExampleFiltersSelectedProps> = (\n props\n) => {\n return (\n <div className=\"rs__filters-selected\">\n <h3 className=\"rs__filters-selected__name\">{\"Filters Selected\"}</h3>\n <ul className=\"rs__filters-selected__list\">\n {props.selectedFilters.map((selectedFilter) => (\n <ExampleFiltersSelectedItem\n selectedFilter={selectedFilter}\n handleRemove={props.handleRemove}\n />\n ))}\n </ul>\n </div>\n );\n};\n\ntype ExampleFiltersSelectedItemProps = {\n selectedFilter: ExampleFiltersSelectedProps[\"selectedFilters\"][number];\n handleRemove: ExampleFiltersSelectedProps[\"handleRemove\"];\n};\n\nconst ExampleFiltersSelectedItem: React.FC<ExampleFiltersSelectedItemProps> = (\n props\n) => {\n const filtersHook = useFilters();\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === props.selectedFilter.key\n );\n\n return (\n <li\n key={props.selectedFilter.key}\n className=\"rs__filters-selected__list-item\"\n >\n <label className=\"rs__filters-selected__list-item-label\">\n <span\n className=\"rs__filters-selected__list-item-label\"\n onClick={() => props.handleRemove(props.selectedFilter.key)}\n >\n {props.selectedFilter.label}\n {\": \"}\n </span>\n\n {filter?.displayType === \"single\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n (props.selectedFilter.value as { label: string }).label,\n ])\n }\n >\n {(props.selectedFilter.value as { label: string }).label}\n </span>\n </span>\n )}\n {filter?.displayType === \"single\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n props.selectedFilter.value as string,\n ])\n }\n >\n {props.selectedFilter.value as string}\n </span>\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<{ label: string }>).map(\n (value) => (\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value.label])\n }\n >\n {value.label}\n </span>\n )\n )}\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<string>).map((value) => (\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value])\n }\n >\n {value}\n </span>\n ))}\n </span>\n )}\n {filter?.displayType === \"slider\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() => props.handleRemove(props.selectedFilter.key, [\"\"])}\n >\n {`${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[0]\n } to ${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[1]\n }`}\n </span>\n </span>\n )}\n </label>\n </li>\n );\n};\n"]}
1
+ {"version":3,"file":"ExampleFiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAyC;AAMlC,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,OAAO,CACL,uCAAK,SAAS,EAAC,sBAAsB;QACnC,sCAAI,SAAS,EAAC,4BAA4B,IAAE,kBAAkB,CAAM;QACpE,sCAAI,SAAS,EAAC,4BAA4B,IACvC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,CAC7C,8BAAC,0BAA0B,IACzB,GAAG,EAAE,cAAc,CAAC,GAAG,GAA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AAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,IAEhE,GAAG,MAAM,CAAC,mBAAmB,GAC3B,KAAK,CAAC,cAAc,CAAC,KAAa,CAAC,CAAC,CACvC,OAAO,MAAM,CAAC,mBAAmB,GAC9B,KAAK,CAAC,cAAc,CAAC,KAAa,CAAC,CAAC,CACvC,EAAE,CACG,CACF,CACR,CACK,CACL,CACN,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\n\nimport { FiltersSelectedProps } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ExampleFiltersSelectedProps = React.ComponentProps<\n NonNullable<FiltersSelectedProps[\"render\"]>\n>;\n\nexport const ExampleFiltersSelected: React.FC<ExampleFiltersSelectedProps> = (\n props\n) => {\n return (\n <div className=\"rs__filters-selected\">\n <h3 className=\"rs__filters-selected__name\">{\"Filters Selected\"}</h3>\n <ul className=\"rs__filters-selected__list\">\n {props.selectedFilters.map((selectedFilter) => (\n <ExampleFiltersSelectedItem\n key={selectedFilter.key + selectedFilter.value}\n selectedFilter={selectedFilter}\n handleRemove={props.handleRemove}\n />\n ))}\n </ul>\n </div>\n );\n};\n\ntype ExampleFiltersSelectedItemProps = {\n selectedFilter: ExampleFiltersSelectedProps[\"selectedFilters\"][number];\n handleRemove: ExampleFiltersSelectedProps[\"handleRemove\"];\n};\n\nconst ExampleFiltersSelectedItem: React.FC<ExampleFiltersSelectedItemProps> = (\n props\n) => {\n const filtersHook = useFilters();\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === props.selectedFilter.key\n );\n\n return (\n <li\n className=\"rs__filters-selected__list-item\"\n >\n <label className=\"rs__filters-selected__list-item-label\">\n <span\n className=\"rs__filters-selected__list-item-label\"\n onClick={() => props.handleRemove(props.selectedFilter.key)}\n >\n {props.selectedFilter.label}\n {\": \"}\n </span>\n\n {filter?.displayType === \"single\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n (props.selectedFilter.value as { label: string }).label,\n ])\n }\n >\n {(props.selectedFilter.value as { label: string }).label}\n </span>\n </span>\n )}\n {filter?.displayType === \"single\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [\n props.selectedFilter.value as string,\n ])\n }\n >\n {props.selectedFilter.value as string}\n </span>\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView === \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<{ label: string }>).map(\n (value) => (\n <span\n key={value.label}\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value.label])\n }\n >\n {value.label}\n </span>\n )\n )}\n </span>\n )}\n {filter?.displayType === \"multi\" && filter.displayView !== \"range\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n {(props.selectedFilter.value as Array<string>).map((value) => (\n <span\n key={value}\n onClick={() =>\n props.handleRemove(props.selectedFilter.key, [value])\n }\n >\n {value}\n </span>\n ))}\n </span>\n )}\n {filter?.displayType === \"slider\" && (\n <span className=\"rs__filters-selected__list-item-value\">\n <span\n onClick={() => props.handleRemove(props.selectedFilter.key, [\"\"])}\n >\n {`${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[0]\n } to ${filter.displaySliderPrefix}${\n (props.selectedFilter.value as any)[1]\n }`}\n </span>\n </span>\n )}\n </label>\n </li>\n );\n};\n"]}
@@ -1,2 +1,3 @@
1
1
  import { ReactiveBaseProps } from "@appbaseio/reactivesearch/lib/components/basic/ReactiveBase";
2
+ export declare const replaceDocCountWithParent: (response: any) => any;
2
3
  export declare const useReactiveBaseProps: () => ReactiveBaseProps;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useReactiveBaseProps = void 0;
15
+ exports.useReactiveBaseProps = exports.replaceDocCountWithParent = void 0;
16
16
  const react_1 = __importDefault(require("react"));
17
17
  const hooks_1 = require("../../hooks");
18
18
  const package_json_1 = __importDefault(require("../../../package.json"));
@@ -30,6 +30,7 @@ const replaceDocCountWithParent = (response) => {
30
30
  });
31
31
  return response;
32
32
  };
33
+ exports.replaceDocCountWithParent = replaceDocCountWithParent;
33
34
  const useReactiveBaseProps = () => {
34
35
  var _a;
35
36
  const { options, config } = (0, hooks_1.useReactifySearchContext)();
@@ -59,7 +60,7 @@ const useReactiveBaseProps = () => {
59
60
  // https://github.com/appbaseio/reactivesearch/issues/1530
60
61
  if ((_c = (_b = response === null || response === void 0 ? void 0 : response.aggregations) === null || _b === void 0 ? void 0 : _b.reactivesearch_nested) === null || _c === void 0 ? void 0 : _c.reactify_nested_outer) {
61
62
  response.aggregations.reactivesearch_nested =
62
- replaceDocCountWithParent((_e = (_d = response === null || response === void 0 ? void 0 : response.aggregations) === null || _d === void 0 ? void 0 : _d.reactivesearch_nested) === null || _e === void 0 ? void 0 : _e.reactify_nested_outer);
63
+ (0, exports.replaceDocCountWithParent)((_e = (_d = response === null || response === void 0 ? void 0 : response.aggregations) === null || _d === void 0 ? void 0 : _d.reactivesearch_nested) === null || _e === void 0 ? void 0 : _e.reactify_nested_outer);
63
64
  }
64
65
  return response;
65
66
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAG1B,uCAAkE;AAElE,yEAAwC;AAExC,MAAM,yBAAyB,GAAG,CAAC,QAAa,EAAE,EAAE;IAClD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC;SACtC,OAAO,CAAC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A,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;oBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;wBACzC,yBAAyB,CACvB,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CACzC,qBAAqB,CAC1B,CAAC;iBACL;gBAED,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAA;YACD,OAAO,EAAE;gBACP,iBAAiB,EAAE,OAAO,CAAC,sBAAsB;gBACjD,iBAAiB,EAAE,OAAO,CAAC,IAAI;gBAC/B,sBAAsB,EAAE,OAAO,CAAC,QAAQ;gBACxC,2BAA2B,EAAE,sBAAG,CAAC,OAAO;gBACxC,eAAe,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;aACrC;SACF,CAAC,CAAA;KAAA,EACF,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,CAAC,CAC7F,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAjDW,QAAA,oBAAoB,wBAiD/B","sourcesContent":["import React from \"react\";\nimport { ReactiveBaseProps } from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nimport { getCookie, useReactifySearchContext } from \"../../hooks\";\n\nimport pkg from \"../../../package.json\";\n\nconst replaceDocCountWithParent = (response: any) => {\n Object.entries(response)\n .filter(([key]) => key !== \"doc_count\")\n .forEach(([key, value]: [string, any]) => {\n value.buckets?.forEach((bucket: any) => {\n if (bucket.parent_docs) {\n bucket.doc_count = bucket.parent_docs.doc_count;\n delete bucket.parent_docs;\n }\n });\n });\n\n return response;\n};\n\nexport const useReactiveBaseProps = (): ReactiveBaseProps => {\n const { options, config } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo<ReactiveBaseProps>(\n () => ({\n app: options.index,\n url: config.endpoint,\n credentials: options.credentials,\n theme: options.theme,\n initialState: options.preload?.state,\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.shopifyPermanentDomain,\n \"x-reactify-mode\": options.mode,\n \"x-reactify-client-id\": options.clientId,\n \"x-reactify-client-version\": pkg.version,\n \"x-reactify-ga\": getCookie(\"_rs_ga\"),\n },\n }),\n [options.index, config.endpoint, options.credentials, options.theme, options.preload?.state]\n );\n\n return reactiveBaseProps;\n};\n"]}
1
+ {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAG1B,uCAAkE;AAElE,yEAAwC;AAEjC,MAAM,yBAAyB,GAAG,CAAC,QAAa,EAAE,EAAE;IACzD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC;SACtC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAgB,EAAE,EAAE;;QACvC,MAAA,KAAK,CAAC,OAAO,0CAAE,OAAO,CA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,0CAAE,qBAAqB,EACpE;oBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;wBACzC,IAAA,iCAAyB,EACvB,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CACzC,qBAAqB,CAC1B,CAAC;iBACL;gBAED,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAA;YACD,OAAO,EAAE;gBACP,iBAAiB,EAAE,OAAO,CAAC,sBAAsB;gBACjD,iBAAiB,EAAE,OAAO,CAAC,IAAI;gBAC/B,sBAAsB,EAAE,OAAO,CAAC,QAAQ;gBACxC,2BAA2B,EAAE,sBAAG,CAAC,OAAO;gBACxC,eAAe,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC;aACrC;SACF,CAAC,CAAA;KAAA,EACF,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,CAAC,CAC7F,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAjDW,QAAA,oBAAoB,wBAiD/B","sourcesContent":["import React from \"react\";\nimport { ReactiveBaseProps } from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nimport { getCookie, useReactifySearchContext } from \"../../hooks\";\n\nimport pkg from \"../../../package.json\";\n\nexport const replaceDocCountWithParent = (response: any) => {\n Object.entries(response)\n .filter(([key]) => key !== \"doc_count\")\n .forEach(([key, value]: [string, any]) => {\n value.buckets?.forEach((bucket: any) => {\n if (bucket.parent_docs) {\n bucket.doc_count = bucket.parent_docs.doc_count;\n delete bucket.parent_docs;\n }\n });\n });\n\n return response;\n};\n\nexport const useReactiveBaseProps = (): ReactiveBaseProps => {\n const { options, config } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo<ReactiveBaseProps>(\n () => ({\n app: options.index,\n url: config.endpoint,\n credentials: options.credentials,\n theme: options.theme,\n initialState: options.preload?.state,\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.shopifyPermanentDomain,\n \"x-reactify-mode\": options.mode,\n \"x-reactify-client-id\": options.clientId,\n \"x-reactify-client-version\": pkg.version,\n \"x-reactify-ga\": getCookie(\"_rs_ga\"),\n },\n }),\n [options.index, config.endpoint, options.credentials, options.theme, options.preload?.state]\n );\n\n return reactiveBaseProps;\n};\n"]}
@@ -55,8 +55,15 @@ const useFilterListProps = (filter, reactivesearchFilterProps) => {
55
55
  }, [filter]);
56
56
  const customSortOrder = (_a = filter.customSortOrder) === null || _a === void 0 ? void 0 : _a.split(",").map((item) => item.trim().toUpperCase());
57
57
  const filterListProps = react_1.default.useMemo(() => {
58
+ var _a, _b, _c;
59
+ let data = reactivesearchFilterProps.data;
60
+ if ((_c = (_b = (_a = reactivesearchFilterProps === null || reactivesearchFilterProps === void 0 ? void 0 : reactivesearchFilterProps.rawData) === null || _a === void 0 ? void 0 : _a.aggregations) === null || _b === void 0 ? void 0 : _b.reactivesearch_nested) === null || _c === void 0 ? void 0 : _c.reactify_nested_outer) {
61
+ const nestedOptions = (0, hooks_1.replaceDocCountWithParent)(reactivesearchFilterProps.rawData.aggregations.reactivesearch_nested.reactify_nested_outer);
62
+ const nestedOptionsKey = Object.keys(nestedOptions).filter(key => key !== "doc_count");
63
+ data = nestedOptions[nestedOptionsKey[0]].buckets;
64
+ }
58
65
  // remove excluded options, sort alphabeticaly, map checked boolean
59
- const options = reactivesearchFilterProps.data
66
+ const options = data
60
67
  .filter(({ key }) => {
61
68
  var _a, _b;
62
69
  if ((_a = filter.valuesExclude) === null || _a === void 0 ? void 0 : _a.includes(key))
@@ -1 +1 @@
1
- {"version":3,"file":"useFilterListProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,oCAAwC;AACxC,wCAAmC;AAEnC,MAAM,oBAAoB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AACxD,MAAM,yBAAyB,GAAG;IAChC,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;IACN,YAAY;IACZ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,MAAM;IACN,GAAG;IACH,IAAI;IACJ,KAAK;IACL,GAAG;IACH,IAAI;IACJ,KAAK;IACL,GAAG;IACH,KAAK;IACL,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,SAAS;CACV,CAAC;AAEF,qFAAqF;AAC9E,MAAM,kBAAkB,GAAG,CAChC,MAA0B,EAC1B,yBAAwD,EAWxD,EAAE;;IACF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,eAAK,CAAC,WAAW,CACpC,CAAC,GAAW,EAAE,EAAE;QACd,eAAK,CAAC,GAAG,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,CAAC,CAAC;QAE1D,yBAAyB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC5C,KAAK,CAAC;YACJ,SAAS,EAAE,cAA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AAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAExE,uCACK,yBAAyB,KAC5B,YAAY;YACZ,MAAM;YACN,OAAO;YACP,WAAW;YACX,aAAa,IACb;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAEtD,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAlGW,QAAA,kBAAkB,sBAkG7B","sourcesContent":["import React from \"react\";\n\nimport { ConfigFilterOption } from \"../types/config\";\nimport { ReactivesearchFilterListProps } from \"../types/reactivesearch\";\nimport { useAnalytics } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nconst DEFAULT_NUMERIC_SORT = [\"0000\", \"000\", \"00\", \"0\"];\nconst DEFAULT_ALPHABETICAL_SORT = [\n \"SINGLE\",\n \"DOUBLE\",\n \"QUEEN\",\n \"KING\",\n \"SUPER KING\",\n \"XXXS\",\n \"XXS\",\n \"XS\",\n \"XS/S\",\n \"S\",\n \"SM\",\n \"S/M\",\n \"M\",\n \"ML\",\n \"M/L\",\n \"L\",\n \"LXL\",\n \"L/XL\",\n \"XL\",\n \"2L\",\n \"XXL\",\n \"3L\",\n \"XXXL\",\n \"4L\",\n \"5L\",\n \"6L\",\n \"OS\",\n \"ONESIZE\",\n];\n\n// converts reactivesearch props returned in filters to a cleaned up/filtered version\nexport const useFilterListProps = (\n filter: ConfigFilterOption,\n reactivesearchFilterProps: ReactivesearchFilterListProps\n): ReactivesearchFilterListProps & {\n filter: ConfigFilterOption;\n options: Array<{\n doc_count: number;\n key: string;\n label: string;\n checked: boolean;\n }>;\n hasSelected: boolean;\n totalSelected: number;\n} => {\n const { track } = useAnalytics();\n\n const handleChange = React.useCallback(\n (key: string) => {\n debug.log(\"useFilterListProps\", \"handleChange[key]\", key);\n\n reactivesearchFilterProps.handleChange(key);\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: key,\n },\n });\n },\n [filter]\n );\n\n const customSortOrder = filter.customSortOrder\n ?.split(\",\")\n .map((item) => item.trim().toUpperCase());\n\n const filterListProps = React.useMemo(() => {\n // remove excluded options, sort alphabeticaly, map checked boolean\n const options = reactivesearchFilterProps.data\n .filter(({ key }) => {\n if (filter.valuesExclude?.includes(key)) return false;\n if (!!filter.valuesManual?.length && !filter.valuesManual.includes(key))\n return false;\n return true;\n })\n .sort(\n (a, b) =>\n DEFAULT_NUMERIC_SORT.indexOf(a.key) -\n DEFAULT_NUMERIC_SORT.indexOf(b.key)\n )\n .sort((a, b) =>\n new Intl.Collator(\"en\", { numeric: true, sensitivity: \"base\" }).compare(\n a.key,\n b.key\n )\n )\n .sort((a, b) => {\n if (!customSortOrder || customSortOrder.length === 0) {\n return (\n DEFAULT_ALPHABETICAL_SORT.indexOf(a.key.toUpperCase()) -\n DEFAULT_ALPHABETICAL_SORT.indexOf(b.key.toUpperCase())\n );\n }\n\n return (\n customSortOrder?.indexOf(a.key.toUpperCase()) -\n customSortOrder?.indexOf(b.key.toUpperCase())\n );\n })\n .map((option) => ({\n ...option,\n label: filter.settingsUppercase ? option.key.toUpperCase() : option.key,\n checked:\n (typeof reactivesearchFilterProps.value === \"object\" &&\n reactivesearchFilterProps.value[option.key]) ||\n reactivesearchFilterProps.value === option.key,\n }));\n\n // work out if at least one option selected\n const hasSelected =\n (typeof reactivesearchFilterProps.value === \"object\" &&\n 0 < Object.keys(reactivesearchFilterProps.value).length) ||\n (typeof reactivesearchFilterProps.value !== \"object\" &&\n !!reactivesearchFilterProps.value);\n\n const totalSelected = options.filter((option) => option.checked).length;\n\n return {\n ...reactivesearchFilterProps,\n handleChange,\n filter,\n options,\n hasSelected,\n totalSelected,\n };\n }, [filter, handleChange, reactivesearchFilterProps]);\n\n return filterListProps;\n};\n"]}
1
+ {"version":3,"file":"useFilterListProps.js","sourceRoot":"","sources":["../../../src/hooks/useFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,oCAAmE;AACnE,w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;gBAClD,CAAC,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAEvC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;QAExE,uCACK,yBAAyB,KAC5B,YAAY;YACZ,MAAM;YACN,OAAO;YACP,WAAW;YACX,aAAa,IACb;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAEtD,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AA3GW,QAAA,kBAAkB,sBA2G7B","sourcesContent":["import React from \"react\";\n\nimport { ConfigFilterOption } from \"../types/config\";\nimport { ReactivesearchFilterListProps } from \"../types/reactivesearch\";\nimport { replaceDocCountWithParent, useAnalytics } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nconst DEFAULT_NUMERIC_SORT = [\"0000\", \"000\", \"00\", \"0\"];\nconst DEFAULT_ALPHABETICAL_SORT = [\n \"SINGLE\",\n \"DOUBLE\",\n \"QUEEN\",\n \"KING\",\n \"SUPER KING\",\n \"XXXS\",\n \"XXS\",\n \"XS\",\n \"XS/S\",\n \"S\",\n \"SM\",\n \"S/M\",\n \"M\",\n \"ML\",\n \"M/L\",\n \"L\",\n \"LXL\",\n \"L/XL\",\n \"XL\",\n \"2L\",\n \"XXL\",\n \"3L\",\n \"XXXL\",\n \"4L\",\n \"5L\",\n \"6L\",\n \"OS\",\n \"ONESIZE\",\n];\n\n// converts reactivesearch props returned in filters to a cleaned up/filtered version\nexport const useFilterListProps = (\n filter: ConfigFilterOption,\n reactivesearchFilterProps: ReactivesearchFilterListProps\n): ReactivesearchFilterListProps & {\n filter: ConfigFilterOption;\n options: Array<{\n doc_count: number;\n key: string;\n label: string;\n checked: boolean;\n }>;\n hasSelected: boolean;\n totalSelected: number;\n} => {\n const { track } = useAnalytics();\n\n const handleChange = React.useCallback(\n (key: string) => {\n debug.log(\"useFilterListProps\", \"handleChange[key]\", key);\n\n reactivesearchFilterProps.handleChange(key);\n track({\n eventName: \"filterChange\",\n payload: {\n name: filter.name,\n value: key,\n },\n });\n },\n [filter]\n );\n\n const customSortOrder = filter.customSortOrder\n ?.split(\",\")\n .map((item) => item.trim().toUpperCase());\n\n const filterListProps = React.useMemo(() => {\n let data = reactivesearchFilterProps.data;\n if (\n reactivesearchFilterProps?.rawData?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n const nestedOptions = replaceDocCountWithParent(reactivesearchFilterProps.rawData.aggregations.reactivesearch_nested.reactify_nested_outer);\n const nestedOptionsKey = Object.keys(nestedOptions).filter(key => key !== \"doc_count\");\n data = nestedOptions[nestedOptionsKey[0]].buckets;\n }\n\n // remove excluded options, sort alphabeticaly, map checked boolean\n const options = data\n .filter(({ key }) => {\n if (filter.valuesExclude?.includes(key)) return false;\n if (!!filter.valuesManual?.length && !filter.valuesManual.includes(key))\n return false;\n return true;\n })\n .sort(\n (a, b) =>\n DEFAULT_NUMERIC_SORT.indexOf(a.key) -\n DEFAULT_NUMERIC_SORT.indexOf(b.key)\n )\n .sort((a, b) =>\n new Intl.Collator(\"en\", { numeric: true, sensitivity: \"base\" }).compare(\n a.key,\n b.key\n )\n )\n .sort((a, b) => {\n if (!customSortOrder || customSortOrder.length === 0) {\n return (\n DEFAULT_ALPHABETICAL_SORT.indexOf(a.key.toUpperCase()) -\n DEFAULT_ALPHABETICAL_SORT.indexOf(b.key.toUpperCase())\n );\n }\n\n return (\n customSortOrder?.indexOf(a.key.toUpperCase()) -\n customSortOrder?.indexOf(b.key.toUpperCase())\n );\n })\n .map((option) => ({\n ...option,\n label: filter.settingsUppercase ? option.key.toUpperCase() : option.key,\n checked:\n (typeof reactivesearchFilterProps.value === \"object\" &&\n reactivesearchFilterProps.value[option.key]) ||\n reactivesearchFilterProps.value === option.key,\n }));\n\n // work out if at least one option selected\n const hasSelected =\n (typeof reactivesearchFilterProps.value === \"object\" &&\n 0 < Object.keys(reactivesearchFilterProps.value).length) ||\n (typeof reactivesearchFilterProps.value !== \"object\" &&\n !!reactivesearchFilterProps.value);\n\n const totalSelected = options.filter((option) => option.checked).length;\n\n return {\n ...reactivesearchFilterProps,\n handleChange,\n filter,\n options,\n hasSelected,\n totalSelected,\n };\n }, [filter, handleChange, reactivesearchFilterProps]);\n\n return filterListProps;\n};\n"]}
@@ -10,6 +10,9 @@ export interface ReactivesearchFilterListProps {
10
10
  value: string | {
11
11
  [key: string]: boolean;
12
12
  };
13
+ rawData: {
14
+ aggregations?: any;
15
+ };
13
16
  }
14
17
  export interface ReactivesearchPaginationProps {
15
18
  pages: number;
@@ -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}\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\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"]}
@@ -237,7 +237,7 @@ const getPropsSensorSort = (options) => {
237
237
  curation: curation,
238
238
  });
239
239
  return {
240
- componentId: "SensorInventoryAvailable",
240
+ componentId: "SensorSort",
241
241
  customQuery: () => ({
242
242
  sort,
243
243
  query,
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;AAAA,8DAA4H;AAC5H,8CAAwE;AAExE,yCAAyC;AACzC,6CAAkF;AAClF,uCAA2C;AAapC,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,iBAAqC,EAAE,EAAE;IAC3H,IAAI,WAAW,GAA4B,EAAE,CAAC;IAE9C,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC9C,WAAW,GAAG,IAAA,4BAAoB,EAAC,iBAAiB,CAAC,CAAC;KACvD;IAED,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,IAAI,iBAAiB,CAAC,WAAW,KAAK,OAAO,EAAE;QAC3F,IAAI,iBAAiB,CAAC,WAAW,KAAK,OAAO,EAAE;YAC7C,WAAW,GAAG,IAAA,2BAAmB,EAAC,iBAAiB,CAAC,C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AAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB;SACnD,CAAC;IACJ,CAAC,CAAC,mCAAI,EAAE,CAAC;IAET,OAAO;QACL,WAAW,EAAE,MAAA,iBAAiB,CAAC,mBAAmB,mCAAI,IAAI;QAC1D,UAAU,EAAE,MAAA,iBAAiB,CAAC,kBAAkB,mCAAI,IAAI;QACxD,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,mBAAmB,uBAiB9B;AAEK,MAAM,oBAAoB,GAAG,CAAC,iBAAqC,EAAE,EAAE;IAC5E,OAAO,EAAE,CAAA;AACX,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { MultiList, MultiRange, ReactiveComponent, ReactiveList, SingleList, SingleRange } from \"@appbaseio/reactivesearch\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterOption } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\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: ConfigFilterOption) => {\n let filterProps: Record<string, unknown> = {};\n\n if (filterGroupOption.displayType === \"slider\") {\n filterProps = getPropsFilterSlider(filterGroupOption);\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: { \"variants.available\": true },\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 sortOption: sortOption,\n curation: curation,\n });\n\n return {\n componentId: \"SensorInventoryAvailable\",\n customQuery: () => ({\n sort,\n query,\n }),\n source: ReactiveComponent,\n }\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: 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 }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterOption) => {\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: ConfigFilterOption) => {\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 return {\n URLParams: true,\n componentId: filterGroupOption.handle,\n dataField: filterGroupOption.field,\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: ConfigFilterOption) => {\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: ConfigFilterOption) => {\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: ConfigFilterOption) => {\n return {}\n};"]}
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;AAAA,8DAA4H;AAC5H,8CAAwE;AAExE,yCAAyC;AACzC,6CAAkF;AAClF,uCAA2C;AAapC,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,iBAAqC,EAAE,EAAE;IAC3H,IAAI,WAAW,GAA4B,EAAE,CAAC;IAE9C,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC9C,WAAW,GAAG,IAAA,4BAAoB,EAAC,iBAAiB,CAAC,CAAC;KACvD;IAED,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,IAAI,iBAAiB,CAAC,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YACZ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB;SACnD,CAAC;IACJ,CAAC,CAAC,mCAAI,EAAE,CAAC;IAET,OAAO;QACL,WAAW,EAAE,MAAA,iBAAiB,CAAC,mBAAmB,mCAAI,IAAI;QAC1D,UAAU,EAAE,MAAA,iBAAiB,CAAC,kBAAkB,mCAAI,IAAI;QACxD,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,mBAAmB,uBAiB9B;AAEK,MAAM,oBAAoB,GAAG,CAAC,iBAAqC,EAAE,EAAE;IAC5E,OAAO,EAAE,CAAA;AACX,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { MultiList, MultiRange, ReactiveComponent, ReactiveList, SingleList, SingleRange } from \"@appbaseio/reactivesearch\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterOption } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\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: ConfigFilterOption) => {\n let filterProps: Record<string, unknown> = {};\n\n if (filterGroupOption.displayType === \"slider\") {\n filterProps = getPropsFilterSlider(filterGroupOption);\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: { \"variants.available\": true },\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 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 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: 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 }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterOption) => {\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: ConfigFilterOption) => {\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 return {\n URLParams: true,\n componentId: filterGroupOption.handle,\n dataField: filterGroupOption.field,\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: ConfigFilterOption) => {\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: ConfigFilterOption) => {\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: ConfigFilterOption) => {\n return {}\n};"]}
@@ -1,2 +1,4 @@
1
1
  import { ReactifySearchProviderProps } from "../components";
2
- export declare const generateProviderProps: (options: ReactifySearchProviderProps) => Promise<ReactifySearchProviderProps>;
2
+ export declare const generateProviderProps: (options: ReactifySearchProviderProps & {
3
+ query: Record<string, string>;
4
+ }) => Promise<ReactifySearchProviderProps>;
@@ -17,16 +17,21 @@ exports.generateProviderProps = void 0;
17
17
  const server_1 = __importDefault(require("@appbaseio/reactivesearch/lib/server"));
18
18
  const config_1 = require("./config");
19
19
  const props_1 = require("./props");
20
+ const filters_1 = require("./filters");
20
21
  const generateProviderProps = (options) => __awaiter(void 0, void 0, void 0, function* () {
21
22
  const config = yield (0, config_1.getConfig)(options.shopifyPermanentDomain);
23
+ const filterStack = (0, filters_1.getFilterStack)({
24
+ provider: options,
25
+ config: config
26
+ });
22
27
  const props = (0, props_1.getPropsFilterGroup)({
23
28
  provider: options,
24
29
  config: config,
25
- filterGroup: config.filters[0],
30
+ filterGroup: filterStack,
26
31
  });
27
32
  return Object.assign(Object.assign({}, options), { preload: {
28
33
  config: config,
29
- state: yield (0, server_1.default)(props, null, {
34
+ state: yield (0, server_1.default)(props, options.query, {
30
35
  app: config.index,
31
36
  url: config.endpoint,
32
37
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/utility/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,kFAAsE;AAEtE,qCAAqC;AACrC,mCAA8C;AAIvC,MAAM,qBAAqB,GAAG,CAAO,OAAoC,EAAwC,EAAE;IACxH,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAA,2BAAmB,EAAC;QAChC,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/B,CAAC,CAAC;IAEH,uCACK,OAAO,KACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM,IAAA,gBAAkB,EAAC,KAAK,EAAE,IAAI,EAAE;gBAC3C,GAAG,EAAE,MAAM,CAAC,KAAK;gBACjB,GAAG,EAAE,MAAM,CAAC,QAAQ;aACrB,CAAC;SACH,IACF;AACH,CAAC,CAAA,CAAA;AAlBY,QAAA,qBAAqB,yBAkBjC","sourcesContent":["// @ts-expect-error missing types\nimport initReactivesearch from \"@appbaseio/reactivesearch/lib/server\";\n\nimport { getConfig } from \"./config\";\nimport { getPropsFilterGroup } from \"./props\";\nimport { ReactifySearchProviderProps } from \"../components\";\n\n\nexport const generateProviderProps = async (options: ReactifySearchProviderProps): Promise<ReactifySearchProviderProps> => {\n const config = await getConfig(options.shopifyPermanentDomain);\n const props = getPropsFilterGroup({\n provider: options,\n config: config,\n filterGroup: config.filters[0],\n });\n\n return {\n ...options,\n preload: {\n config: config,\n state: await initReactivesearch(props, null, {\n app: config.index,\n url: config.endpoint,\n }),\n }\n }\n}"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/utility/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,kFAAsE;AAEtE,qCAAqC;AACrC,mCAA8C;AAE9C,uCAA2C;AAEpC,MAAM,qBAAqB,GAAG,CAAO,OAAwE,EAAwC,EAAE;IAC5J,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAE/D,MAAM,WAAW,GAAG,IAAA,wBAAc,EAAC;QACjC,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,IAAA,2BAAmB,EAAC;QAChC,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,WAAW;KACzB,CAAC,CAAC;IAEH,uCACK,OAAO,KACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM,IAAA,gBAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;gBACpD,GAAG,EAAE,MAAM,CAAC,KAAK;gBACjB,GAAG,EAAE,MAAM,CAAC,QAAQ;aACrB,CAAC;SACH,IACF;AACH,CAAC,CAAA,CAAA;AAxBY,QAAA,qBAAqB,yBAwBjC","sourcesContent":["// @ts-expect-error missing types\nimport initReactivesearch from \"@appbaseio/reactivesearch/lib/server\";\n\nimport { getConfig } from \"./config\";\nimport { getPropsFilterGroup } from \"./props\";\nimport { ReactifySearchProviderProps } from \"../components\";\nimport { getFilterStack } from \"./filters\";\n\nexport const generateProviderProps = async (options: ReactifySearchProviderProps & { query: Record<string, string> }): Promise<ReactifySearchProviderProps> => {\n const config = await getConfig(options.shopifyPermanentDomain);\n\n const filterStack = getFilterStack({\n provider: options,\n config: config\n });\n\n const props = getPropsFilterGroup({\n provider: options,\n config: config,\n filterGroup: filterStack,\n });\n\n return {\n ...options,\n preload: {\n config: config,\n state: await initReactivesearch(props, options.query, {\n app: config.index,\n url: config.endpoint,\n }),\n }\n }\n}"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.49.0",
4
+ "version": "5.49.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",