@usereactify/search 5.27.1 → 5.28.0-beta.0

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,58 @@
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.28.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.12.0-beta.0...beta-v5.28.0-beta.0) (2023-08-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * add clientId prop to ReactifySearchProvider, add telemetry ([4090696](https://bitbucket.org/usereactify/reactify-search-ui/commit/4090696a5e5d547b961fe9c4feea9c79be3580bc))
11
+ * add filter value sorting for bedding sizes ([3bcf4b0](https://bitbucket.org/usereactify/reactify-search-ui/commit/3bcf4b0d8b1da312c586e3ac99482bdbe4ced28b))
12
+ * add flags for synonyms ([cfbc94a](https://bitbucket.org/usereactify/reactify-search-ui/commit/cfbc94ab16cb7a91e570134e7033c1dca8874e71))
13
+ * add flags system to toggle sensors and features ([9f08881](https://bitbucket.org/usereactify/reactify-search-ui/commit/9f0888196b56a12cfdb423e43cd493fb6a9c8d11))
14
+ * add Suggestions component ([21514bb](https://bitbucket.org/usereactify/reactify-search-ui/commit/21514bb7d643647b1ac2a19b57ec649e5a0684b3))
15
+ * add support for controlling flags via provider ([0b5d97e](https://bitbucket.org/usereactify/reactify-search-ui/commit/0b5d97e87e67e04d0be6acca335bc1e16d347d98))
16
+ * add support for separate global search and global collection curations ([7ff7fbd](https://bitbucket.org/usereactify/reactify-search-ui/commit/7ff7fbd18abda4588429ddd9b02b26ddac12985e))
17
+ * add support for settingsFilterLogic ([4c3b00f](https://bitbucket.org/usereactify/reactify-search-ui/commit/4c3b00f18cb216a4c454e0cf89e2520562973a13))
18
+ * add useIndices helper and support index override via url param ([cfd73ae](https://bitbucket.org/usereactify/reactify-search-ui/commit/cfd73ae45c374dadf90c27f5257e59c3a0e5168f))
19
+ * allow custom filter sort order ([e7d9b0b](https://bitbucket.org/usereactify/reactify-search-ui/commit/e7d9b0bed3b8df5cf47a12968c915b9c2e492e2e))
20
+ * allow removing one or more (not just all) filters within SelectedFilters component ([4c486a4](https://bitbucket.org/usereactify/reactify-search-ui/commit/4c486a4d6adf64b39776cda8d074c92d5dc92f44))
21
+ * hide slider when range between min and max is 0 ([2e45a94](https://bitbucket.org/usereactify/reactify-search-ui/commit/2e45a9490642b4c996ea3de76e362f4a35c5405c))
22
+ * implement ga-gtag ([ff0bcb2](https://bitbucket.org/usereactify/reactify-search-ui/commit/ff0bcb2d8490f6a428769c21b8f9472207c8792f))
23
+ * improve elasticsearch types and add related field ([dd88e8a](https://bitbucket.org/usereactify/reactify-search-ui/commit/dd88e8a3ee5e1dce990495aa03b8fe814e35d6c5))
24
+ * improve flags logic and expose setFlag helper ([60b5c33](https://bitbucket.org/usereactify/reactify-search-ui/commit/60b5c336000dcd8c066d9e0af9667642c6dbe8cf))
25
+ * remove javascript cache ttl behaviour for config and rely on rs cache option and browser cache-control ([730a9c5](https://bitbucket.org/usereactify/reactify-search-ui/commit/730a9c541e57a7336015c5d93b7b23371cf64bef))
26
+ * remove option for noreactivebase ([a2df18e](https://bitbucket.org/usereactify/reactify-search-ui/commit/a2df18e067322367b29b9a054c2774e7b44bf7c8))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * add dependencies back into sort memo ([cd5f039](https://bitbucket.org/usereactify/reactify-search-ui/commit/cd5f0395e81c826ce2c821596b88298670f3caab))
32
+ * add inventory sensor to instant search, disable callouts for instant search ([1cbf550](https://bitbucket.org/usereactify/reactify-search-ui/commit/1cbf550b83b59aea8df2f081e3027403b8451a6c))
33
+ * add parent doc count into nested aggs ([c324cf8](https://bitbucket.org/usereactify/reactify-search-ui/commit/c324cf831842dcb16a9a89d1a0b7ef962f45afa0))
34
+ * allow boosted sorting/grouping within all modes ([d276060](https://bitbucket.org/usereactify/reactify-search-ui/commit/d276060096359a1563c64da43e0a2f6d31192aad))
35
+ * bump lockfile ([949edd7](https://bitbucket.org/usereactify/reactify-search-ui/commit/949edd710fa1bfba38f2fbe96091da74589af9bc))
36
+ * check if result count is zero rather than falsey ([7d01cef](https://bitbucket.org/usereactify/reactify-search-ui/commit/7d01cef98f5e42439b764ce46aeca2a3b7efd9b0))
37
+ * check window exists before initializing ga ([19d0f48](https://bitbucket.org/usereactify/reactify-search-ui/commit/19d0f485374f78a9c567cc130e9ec289fe59ae46))
38
+ * clear range filter values when values are cleared within underlying reactivesearch component ([720917f](https://bitbucket.org/usereactify/reactify-search-ui/commit/720917f6e3b2c017cfd05a1d2bacf1692212f37e))
39
+ * correct sort option ordering ([c48ecdd](https://bitbucket.org/usereactify/reactify-search-ui/commit/c48ecdd99166259966c97616a64ec0950e64172f))
40
+ * disable sentry release step ([9e7cce9](https://bitbucket.org/usereactify/reactify-search-ui/commit/9e7cce9732661d4c32ca2d3a9ca70d1e7588ccd1))
41
+ * exclude selectable sort option from instant search logic ([988427d](https://bitbucket.org/usereactify/reactify-search-ui/commit/988427d72ee6525cf20c4a3f8a900d3bf9db398a))
42
+ * hide results in search modes when search term is empty ([1d600fb](https://bitbucket.org/usereactify/reactify-search-ui/commit/1d600fb44c1880255f11bbd3d04cb86c7db164ca))
43
+ * improve support for removing slider filter values ([4b5f05c](https://bitbucket.org/usereactify/reactify-search-ui/commit/4b5f05c90b8220a31e8096d80fc4e35016ab7153))
44
+ * improve types for range values ([597a6f3](https://bitbucket.org/usereactify/reactify-search-ui/commit/597a6f35dd069b5b7f18f6b248049c319981774a))
45
+ * misc fixes to types and values for FiltersSelected component ([35619de](https://bitbucket.org/usereactify/reactify-search-ui/commit/35619de4d25eafe105753fe7a54caaef8452be88))
46
+ * move gtag initializer into provider and include relevant user properties ([72ca81e](https://bitbucket.org/usereactify/reactify-search-ui/commit/72ca81e5556f07f1c7fd4a0c630698ed4e70f6fa))
47
+ * only apply global boosting rules in collection mode ([731009c](https://bitbucket.org/usereactify/reactify-search-ui/commit/731009c9d6df2dee80d30bbef678b7c7a68bdd55))
48
+ * propagate changes to slider filter values throughout components ([05d612d](https://bitbucket.org/usereactify/reactify-search-ui/commit/05d612d43f69bbd798e95ceaec91bf1a7450894d))
49
+ * properly encode search query when submitting ([3ecc44f](https://bitbucket.org/usereactify/reactify-search-ui/commit/3ecc44fd72ebe4ea3bc919bf1d823b0a49bc0830))
50
+ * remove duplicate sensors from storybook ([c41aab2](https://bitbucket.org/usereactify/reactify-search-ui/commit/c41aab22be3dcb16ea0fe31ede1a232b28f6ced3))
51
+ * sort by collection position after curation pin and boost sorting rather than before ([593ee9d](https://bitbucket.org/usereactify/reactify-search-ui/commit/593ee9d2b9e46726a99e20e1e7a9782bf0bc4590))
52
+ * trim whitespace around search terms for tracking within analytics ([257d99a](https://bitbucket.org/usereactify/reactify-search-ui/commit/257d99aa916210d120c0a17e670d34efcd1979f6))
53
+ * unset slider and multi range filters when using ClearAll component ([185a995](https://bitbucket.org/usereactify/reactify-search-ui/commit/185a9954bbc9e3ea367584bb4a6b5bb42da95775))
54
+ * use filter group when mode is instant-search ([0d5cb86](https://bitbucket.org/usereactify/reactify-search-ui/commit/0d5cb86766257387060b4c7515b660908464906f))
55
+ * use shared ga cookie ([b406fe1](https://bitbucket.org/usereactify/reactify-search-ui/commit/b406fe11a120326bb90d0452dc1a23c0c8643b9a))
56
+
5
57
  ### [5.27.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.27.0...release-v5.27.1) (2023-08-14)
6
58
 
7
59
 
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.27.1",
4
+ "version": "5.28.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -16,6 +16,20 @@ exports.useReactiveBaseProps = 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"));
19
+ const replaceDocCountWithParent = (response) => {
20
+ Object.entries(response)
21
+ .filter(([key]) => key !== "doc_count")
22
+ .forEach(([key, value]) => {
23
+ var _a;
24
+ (_a = value.buckets) === null || _a === void 0 ? void 0 : _a.forEach((bucket) => {
25
+ if (bucket.parent_docs) {
26
+ bucket.doc_count = bucket.parent_docs.doc_count;
27
+ delete bucket.parent_docs;
28
+ }
29
+ });
30
+ });
31
+ return response;
32
+ };
19
33
  const useReactiveBaseProps = () => {
20
34
  const { options } = (0, hooks_1.useReactifySearchContext)();
21
35
  const reactiveBaseProps = react_1.default.useMemo(() => ({
@@ -35,7 +49,7 @@ const useReactiveBaseProps = () => {
35
49
  // https://github.com/appbaseio/reactivesearch/issues/1530
36
50
  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) {
37
51
  response.aggregations.reactivesearch_nested =
38
- (_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;
52
+ 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);
39
53
  }
40
54
  return response;
41
55
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAG1B,uCAAuD;AAEvD,yEAAwC;AAEjC,MAAM,oBAAoB,GAAG,GAAsB,EAAE;IAC1D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,QAAQ;QACrB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;QACD,OAAO,EAAE;YACP,iBAAiB,EAAE,OAAO,CAAC,sBAAsB;YACjD,iBAAiB,EAAE,OAAO,CAAC,IAAI;YAC/B,sBAAsB,EAAE,OAAO,CAAC,QAAQ;YACxC,2BAA2B,EAAE,sBAAG,CAAC,OAAO;SACzC;KACF,CAAC,EACF,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACtE,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAtCW,QAAA,oBAAoB,wBAsC/B","sourcesContent":["import React from \"react\";\nimport { ReactiveBaseProps } from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nimport { useReactifySearchContext } from \"../../hooks\";\n\nimport pkg from \"../../../package.json\";\n\nexport const useReactiveBaseProps = (): ReactiveBaseProps => {\n const { options } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo<ReactiveBaseProps>(\n () => ({\n app: options.index,\n url: options.endpoint,\n credentials: options.credentials,\n theme: options.theme,\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 response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\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 },\n }),\n [options.index, options.endpoint, options.credentials, options.theme]\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,uCAAuD;AAEvD,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,CAAC,CAAC,GAAG,EAAE,KAAK,CAAgB,EAAE,EAAE;;QACvC,MAAA,KAAK,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,WAAW,EAAE;gBACtB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;gBAChD,OAAO,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IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAzCW,QAAA,oBAAoB,wBAyC/B","sourcesContent":["import React from \"react\";\nimport { ReactiveBaseProps } from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nimport { 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 } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo<ReactiveBaseProps>(\n () => ({\n app: options.index,\n url: options.endpoint,\n credentials: options.credentials,\n theme: options.theme,\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 },\n }),\n [options.index, options.endpoint, options.credentials, options.theme]\n );\n\n return reactiveBaseProps;\n};\n"]}
@@ -57,6 +57,11 @@ export declare const useReactiveFilterListProps: (filter: ConfigFilterOption) =>
57
57
  _count: string;
58
58
  };
59
59
  };
60
+ aggs: {
61
+ parent_docs: {
62
+ reverse_nested: {};
63
+ };
64
+ };
60
65
  };
61
66
  };
62
67
  };
@@ -59,6 +59,11 @@ export declare const useReactiveFilterRangeProps: (filter: ConfigFilterOption) =
59
59
  _count: string;
60
60
  };
61
61
  };
62
+ aggs: {
63
+ parent_docs: {
64
+ reverse_nested: {};
65
+ };
66
+ };
62
67
  };
63
68
  };
64
69
  };
@@ -50,6 +50,11 @@ export declare const useReactiveFilterSharedProps: (filter: ConfigFilterOption)
50
50
  _count: string;
51
51
  };
52
52
  };
53
+ aggs: {
54
+ parent_docs: {
55
+ reverse_nested: {};
56
+ };
57
+ };
53
58
  };
54
59
  };
55
60
  };
@@ -82,6 +82,9 @@ const useReactiveFilterSharedProps = (filter) => {
82
82
  size: 100,
83
83
  order: { _count: "desc" },
84
84
  },
85
+ aggs: {
86
+ parent_docs: { reverse_nested: {} },
87
+ },
85
88
  },
86
89
  },
87
90
  },
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtE,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE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AAU,EAAE;wBAC5B,IAAI,EAAE;4BACJ,qBAAqB,EAAE;gCACrB,MAAM,EAAE;oCACN,KAAK,EAAE;wCACL,oBAAoB,EAAE,MAAM;qCAC7B;iCACF;gCACD,IAAI,EAAE;oCACJ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;wCACd,KAAK,EAAE;4CACL,KAAK,EAAE,MAAM,CAAC,KAAK;4CACnB,IAAI,EAAE,GAAG;4CACT,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;yCAC1B;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,WAAW;QACX,YAAY;QACZ,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA3GW,QAAA,4BAA4B,gCA2GvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle, filter);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.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 [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\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 match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n const reactiveFilterSharedProps = React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSharedProps;\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAA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AAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA9GW,QAAA,4BAA4B,gCA8GvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle, filter);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.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 [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\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 match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.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 }, [filter]);\n\n const reactiveFilterSharedProps = React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSharedProps;\n};\n"]}
@@ -56,6 +56,11 @@ export declare const useReactiveFilterSliderProps: (filter: ConfigFilterOption)
56
56
  _count: string;
57
57
  };
58
58
  };
59
+ aggs: {
60
+ parent_docs: {
61
+ reverse_nested: {};
62
+ };
63
+ };
59
64
  };
60
65
  };
61
66
  };
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.27.1",
4
+ "version": "5.28.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",