@usereactify/search 5.2.2 → 5.3.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/package.json +8 -7
  3. package/dist/src/components/ClearAll/ClearAll.js +2 -2
  4. package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
  5. package/dist/src/components/CustomComponent/CustomComponent.d.ts +1 -1
  6. package/dist/src/components/CustomComponent/CustomComponent.js +2 -2
  7. package/dist/src/components/CustomComponent/CustomComponent.js.map +1 -1
  8. package/dist/src/components/Example/ExampleFilterSlider.js +2 -2
  9. package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
  10. package/dist/src/components/Filter/Filter.js +4 -3
  11. package/dist/src/components/Filter/Filter.js.map +1 -1
  12. package/dist/src/components/Filter/FiltersSelected.js +2 -2
  13. package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
  14. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +2 -0
  15. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
  16. package/dist/src/components/Sensor/SensorSearchTerm.js +2 -2
  17. package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
  18. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +5 -1
  19. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js +1 -1
  20. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js.map +1 -1
  21. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +2 -1
  22. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +2 -2
  23. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -1
  24. package/dist/src/utility/liquid.d.ts +3 -1
  25. package/dist/src/utility/liquid.js.map +1 -1
  26. package/package.json +8 -7
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.3.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.2.3...release-v5.3.0) (2022-09-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * switch from npm to pnpm ([1166f9a](https://bitbucket.org/usereactify/reactify-search-ui/commit/1166f9ae5eab18e4519c3b5be7c9fd5526e6c35e))
11
+ * upgrade to react 18 ([f059591](https://bitbucket.org/usereactify/reactify-search-ui/commit/f059591a752fa4cf3a3bfd3709c1053224e1fcdf))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * correctly apply weights for phrase-prefix ([88dbac1](https://bitbucket.org/usereactify/reactify-search-ui/commit/88dbac1c902691f6fba99e4a1b2dfab883f00dd7))
17
+ * minor clean up for react 18 ([c8a4775](https://bitbucket.org/usereactify/reactify-search-ui/commit/c8a477585acb01960a69734688fe6eac6ae6b672))
18
+
19
+ ### [5.2.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.2.2...release-v5.2.3) (2022-09-11)
20
+
5
21
  ### [5.2.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.2.1...release-v5.2.2) (2022-09-08)
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.2.2",
4
+ "version": "5.3.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -43,11 +43,11 @@
43
43
  "react-intersection-observer": "9.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@appbaseio/reactivesearch": "^3.14.0",
47
- "react": "^17.0.0"
46
+ "@appbaseio/reactivesearch": "3.14.0",
47
+ "react": "17 - 18"
48
48
  },
49
49
  "devDependencies": {
50
- "@appbaseio/reactivesearch": "^3.14.0",
50
+ "@appbaseio/reactivesearch": "3.14.0",
51
51
  "@babel/plugin-transform-typescript": "7.18.12",
52
52
  "@commitlint/cli": "13.2.0",
53
53
  "@commitlint/config-conventional": "13.2.0",
@@ -59,13 +59,14 @@
59
59
  "@storybook/components": "6.5.10",
60
60
  "@storybook/react": "6.5.10",
61
61
  "@types/debug": "4.1.7",
62
- "@types/react": "17.0.27",
62
+ "@types/react": "18.0.19",
63
+ "@types/react-dom": "18.0.6",
63
64
  "babel-loader": "8.2.2",
64
65
  "husky": "4.3.8",
65
66
  "prettier": "2.4.1",
66
67
  "pretty-quick": "3.1.1",
67
- "react": "17.0.2",
68
- "react-dom": "17.0.2",
68
+ "react": "18.2.0",
69
+ "react-dom": "18.2.0",
69
70
  "rimraf": "3.0.2",
70
71
  "standard-version": "9.3.1",
71
72
  "typescript": "4.4.3"
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ClearAll = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const reactivesearch_1 = require("@appbaseio/reactivesearch");
8
+ const SelectedFilters_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/SelectedFilters"));
9
9
  const components_1 = require("../../components");
10
10
  const ClearAll = (props) => {
11
11
  var _a;
12
12
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleClearAll;
13
- return (react_1.default.createElement(reactivesearch_1.SelectedFilters, { render: ({ selectedValues, clearValues }) => {
13
+ return (react_1.default.createElement(SelectedFilters_1.default, { render: ({ selectedValues, clearValues }) => {
14
14
  const selectedFilters = Object.values(selectedValues)
15
15
  .map((value) => value)
16
16
  .filter((item) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAA4D;AAE5D,iDAAmD;AAS5C,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;;IACzD,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAe,CAAC;IAExD,OAAO,CACL,8BAAC,gCAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,EAAE;YAC1C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;iBAClD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;iBACrB,MAAM,CACL,CAAC,IAAS,EAAE,EAAE;;gBACZ,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD,CAAC;YAEJ,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,WAAW,GAAI,CAAC;QACpD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,QAAQ,YAuBnB","sourcesContent":["import React from \"react\";\nimport { SelectedFilters } from \"@appbaseio/reactivesearch\";\n\nimport { ExampleClearAll } from \"../../components\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const RenderComponent = props.render ?? ExampleClearAll;\n\n return (\n <SelectedFilters\n render={({ selectedValues, clearValues }) => {\n const selectedFilters = Object.values(selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={clearValues} />;\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAAmD;AAS5C,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;;IACzD,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAe,CAAC;IAExD,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,EAAE;YAC1C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;iBAClD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;iBACrB,MAAM,CACL,CAAC,IAAS,EAAE,EAAE;;gBACZ,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD,CAAC;YAEJ,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,WAAW,GAAI,CAAC;QACpD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,QAAQ,YAuBnB","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@appbaseio/reactivesearch/lib/components/basic/SelectedFilters\";\n\nimport { ExampleClearAll } from \"../../components\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const RenderComponent = props.render ?? ExampleClearAll;\n\n return (\n <SelectedFilters\n render={({ selectedValues, clearValues }) => {\n const selectedFilters = Object.values(selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={clearValues} />;\n }}\n />\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import { ReactiveComponent } from "@appbaseio/reactivesearch";
2
+ import ReactiveComponent from "@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent";
3
3
  export declare type CustomComponentProps = React.ComponentProps<typeof ReactiveComponent>;
4
4
  export declare const CustomComponent: React.FC<CustomComponentProps>;
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CustomComponent = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const reactivesearch_1 = require("@appbaseio/reactivesearch");
8
+ const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
9
9
  const CustomComponent = (props) => {
10
- return react_1.default.createElement(reactivesearch_1.ReactiveComponent, Object.assign({}, props));
10
+ return react_1.default.createElement(ReactiveComponent_1.default, Object.assign({}, props));
11
11
  };
12
12
  exports.CustomComponent = CustomComponent;
13
13
  //# sourceMappingURL=CustomComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomComponent.js","sourceRoot":"","sources":["../../../../src/components/CustomComponent/CustomComponent.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAA8D;AAMvD,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;IACvE,OAAO,8BAAC,kCAAiB,oBAAK,KAAK,EAAI,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B","sourcesContent":["import React from \"react\";\nimport { ReactiveComponent } from \"@appbaseio/reactivesearch\";\n\nexport type CustomComponentProps = React.ComponentProps<\n typeof ReactiveComponent\n>;\n\nexport const CustomComponent: React.FC<CustomComponentProps> = (props) => {\n return <ReactiveComponent {...props} />;\n};\n"]}
1
+ {"version":3,"file":"CustomComponent.js","sourceRoot":"","sources":["../../../../src/components/CustomComponent/CustomComponent.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAM1F,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;IACvE,OAAO,8BAAC,2BAAiB,oBAAK,KAAK,EAAI,CAAC;AAC1C,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent\";\n\nexport type CustomComponentProps = React.ComponentProps<\n typeof ReactiveComponent\n>;\n\nexport const CustomComponent: React.FC<CustomComponentProps> = (props) => {\n return <ReactiveComponent {...props} />;\n};\n"]}
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ExampleFilterSlider = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const reactivesearch_1 = require("@appbaseio/reactivesearch");
8
+ const DynamicRangeSlider_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider"));
9
9
  const hooks_1 = require("../../hooks");
10
10
  const ExampleFilterSlider = (props) => {
11
11
  const reactiveFilterSliderProps = (0, hooks_1.useReactiveFilterSliderProps)(props.filter);
12
12
  return (react_1.default.createElement("div", { className: "rs__filter" },
13
13
  react_1.default.createElement("h3", { className: "rs__filter__name" }, props.filter.name),
14
- react_1.default.createElement(reactivesearch_1.DynamicRangeSlider, Object.assign({}, reactiveFilterSliderProps, { value: () => props.filterSliderProps.value, onChange: (value) => props.filterSliderProps.handleChange({
14
+ react_1.default.createElement(DynamicRangeSlider_1.default, Object.assign({}, reactiveFilterSliderProps, { value: () => props.filterSliderProps.value, onChange: (value) => props.filterSliderProps.handleChange({
15
15
  start: value[0],
16
16
  end: value[1],
17
17
  }) }))));
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,8DAA+D;AAE/D,uCAA2D;AAOpD,MAAM,mBAAmB,GAAuC,CACrE,KAAK,EACL,EAAE;IACF,MAAM,yBAAyB,GAAG,IAAA,oCAA4B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7E,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,8BAAC,mCAAkB,oBACb,yBAAyB,IAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC;gBACnC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;gBACf,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;aACd,CAAC,IAEJ,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B","sourcesContent":["import React from \"react\";\nimport { DynamicRangeSlider } from \"@appbaseio/reactivesearch\";\n\nimport { useReactiveFilterSliderProps } from \"../../hooks\";\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterSliderProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterSlider\"]>\n>;\n\nexport const ExampleFilterSlider: React.FC<ExampleFilterSliderProps> = (\n props\n) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => props.filterSliderProps.value}\n onChange={(value) =>\n props.filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"ExampleFilterSlider.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleFilterSlider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2HAAmG;AAEnG,uCAA2D;AAOpD,MAAM,mBAAmB,GAAuC,CACrE,KAAK,EACL,EAAE;IACF,MAAM,yBAAyB,GAAG,IAAA,oCAA4B,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7E,OAAO,CACL,uCAAK,SAAS,EAAC,YAAY;QACzB,sCAAI,SAAS,EAAC,kBAAkB,IAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAM;QACzD,8BAAC,4BAAkB,oBACb,yBAAyB,IAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAC1C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC;gBACnC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;gBACf,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;aACd,CAAC,IAEJ,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,mBAAmB,uBAoB9B","sourcesContent":["import React from \"react\";\nimport DynamicRangeSlider from \"@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider\";\n\nimport { useReactiveFilterSliderProps } from \"../../hooks\";\nimport { FilterProps } from \"../../components\";\n\nexport type ExampleFilterSliderProps = React.ComponentProps<\n NonNullable<FilterProps[\"renderFilterSlider\"]>\n>;\n\nexport const ExampleFilterSlider: React.FC<ExampleFilterSliderProps> = (\n props\n) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n return (\n <div className=\"rs__filter\">\n <h3 className=\"rs__filter__name\">{props.filter.name}</h3>\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => props.filterSliderProps.value}\n onChange={(value) =>\n props.filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n );\n};\n"]}
@@ -18,9 +18,10 @@ exports.Filter = void 0;
18
18
  const react_1 = __importDefault(require("react"));
19
19
  const MultiList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/list/MultiList"));
20
20
  const SingleList_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/list/SingleList"));
21
+ const DynamicRangeSlider_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider"));
22
+ const SingleRange_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/range/SingleRange"));
21
23
  const hooks_1 = require("../../hooks");
22
24
  const components_1 = require("../../components");
23
- const reactivesearch_1 = require("@appbaseio/reactivesearch");
24
25
  const Filter = (props) => {
25
26
  if ("single" === props.filter.displayType) {
26
27
  return react_1.default.createElement(FilterSingleList, Object.assign({}, props));
@@ -55,7 +56,7 @@ const FilterRange = (props) => {
55
56
  react_1.default.createElement("div", { style: {
56
57
  display: "none",
57
58
  } },
58
- react_1.default.createElement(reactivesearch_1.SingleRange, Object.assign({}, reactiveFilterRangeProps, { value: filterRangeProps.value, onChange: filterRangeProps.handleChange }))),
59
+ react_1.default.createElement(SingleRange_1.default, Object.assign({}, reactiveFilterRangeProps, { value: filterRangeProps.value, onChange: filterRangeProps.handleChange }))),
59
60
  react_1.default.createElement(RenderRangeComponent, { filterRangeProps: filterRangeProps, filter: props.filter })));
60
61
  };
61
62
  const FilterSlider = (props) => {
@@ -67,7 +68,7 @@ const FilterSlider = (props) => {
67
68
  props.renderFilterSlider ? (react_1.default.createElement("div", { style: {
68
69
  display: "none",
69
70
  } },
70
- react_1.default.createElement(reactivesearch_1.DynamicRangeSlider, Object.assign({}, reactiveFilterSliderProps, { value: () => filterSliderProps.value, onChange: (value) => filterSliderProps.handleChange({
71
+ react_1.default.createElement(DynamicRangeSlider_1.default, Object.assign({}, reactiveFilterSliderProps, { value: () => filterSliderProps.value, onChange: (value) => filterSliderProps.handleChange({
71
72
  start: value[0],
72
73
  end: value[1],
73
74
  }) })))) : null,
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wGAAgF;AAChF,0GAAkF;AAMlF,uCAOqB;AACrB,iDAI0B;AAC1B,8DAA4E;AAsBrE,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;KACxC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;KACvC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,8BAAC,WAAW,oBAAK,KAAK,EAAI,CAAC;KACnC;IAED,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,8BAAC,YAAY,oBAAK,KAAK,EAAI,CAAC;KACpC;IAED,OAAO,CAAC,GAAG,CACT,6BAA6B,KAAK,CAAC,MAAM,CAAC,WAAW,qBAAqB,CAC3E,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAtBW,QAAA,MAAM,UAsBjB;AAEF,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AAgB,EAAE;QACpB,MAAM,SAAS,GAAG,gBAAgB,CAAC;QACnC,OAAO,CACL,8BAAC,SAAS,kBACR,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;KACH;IAED,OAAO,CACL,8BAAC,8BAAiB,kBAChB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport MultiList from \"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\n\nimport type {\n ConfigFilterOption,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useReactiveFilterListProps,\n useReactiveFilterRangeProps,\n useReactiveFilterSliderProps,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\nimport { DynamicRangeSlider, SingleRange } from \"@appbaseio/reactivesearch\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterOption;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterOption;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterOption;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n }>;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n return <FilterMultiList {...props} />;\n }\n\n if (\"range\" === props.filter.displayType) {\n return <FilterRange {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRange: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...reactiveFilterRangeProps}\n value={filterRangeProps.value}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n const filterSliderProps = useFilterSliderProps(props.filter);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <>\n {props.renderFilterSlider ? (\n <div\n style={{\n display: \"none\",\n }}\n >\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => filterSliderProps.value}\n onChange={(value) =>\n filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n ) : null}\n <RenderSliderComponent\n filterSliderProps={filterSliderProps}\n filter={props.filter}\n />\n </>\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,wGAAgF;AAChF,0GAAkF;AAClF,2HAAmG;AACnG,6GAAqF;AAMrF,uCAOqB;AACrB,iDAI0B;AAsBnB,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;KACxC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;KACvC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,OAAO,8BAAC,WAAW,oBAAK,KAAK,EAAI,CAAC;KACnC;IAED,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,OAAO,8BAAC,YAAY,oBAAK,KAAK,EAAI,CAAC;KACpC;IAED,OAAO,CAAC,GAAG,CACT,6BAA6B,KAAK,CAAC,MAAM,CAAC,WAAW,qB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AI,CAAC,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,gBAAgB,EAAE;QACpB,MAAM,SAAS,GAAG,gBAAgB,CAAC;QACnC,OAAO,CACL,8BAAC,SAAS,kBACR,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;KACH;IAED,OAAO,CACL,8BAAC,8BAAiB,kBAChB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport MultiList from \"@appbaseio/reactivesearch/lib/components/list/MultiList\";\nimport SingleList from \"@appbaseio/reactivesearch/lib/components/list/SingleList\";\nimport DynamicRangeSlider from \"@appbaseio/reactivesearch/lib/components/range/DynamicRangeSlider\";\nimport SingleRange from \"@appbaseio/reactivesearch/lib/components/range/SingleRange\";\n\nimport type {\n ConfigFilterOption,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useReactiveFilterListProps,\n useReactiveFilterRangeProps,\n useReactiveFilterSliderProps,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterOption;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterOption;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterOption;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterOption;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n }>;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n return <FilterMultiList {...props} />;\n }\n\n if (\"range\" === props.filter.displayType) {\n return <FilterRange {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n console.log(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <SingleList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactiveFilterListProps = useReactiveFilterListProps(props.filter);\n\n return (\n <MultiList\n {...reactiveFilterListProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRange: React.FC<FilterProps> = (props) => {\n const reactiveFilterRangeProps = useReactiveFilterRangeProps(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...reactiveFilterRangeProps}\n value={filterRangeProps.value}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactiveFilterSliderProps = useReactiveFilterSliderProps(props.filter);\n\n const filterSliderProps = useFilterSliderProps(props.filter);\n\n const RenderSliderComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <>\n {props.renderFilterSlider ? (\n <div\n style={{\n display: \"none\",\n }}\n >\n <DynamicRangeSlider\n {...reactiveFilterSliderProps}\n value={() => filterSliderProps.value}\n onChange={(value) =>\n filterSliderProps.handleChange({\n start: value[0],\n end: value[1],\n })\n }\n />\n </div>\n ) : null}\n <RenderSliderComponent\n filterSliderProps={filterSliderProps}\n filter={props.filter}\n />\n </>\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (0 === filterListProps.options.length) {\n return null;\n }\n\n if (renderFilterList) {\n const Component = renderFilterList;\n return (\n <Component\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n }\n\n return (\n <ExampleFilterList\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FiltersSelected = void 0;
7
- const reactivesearch_1 = require("@appbaseio/reactivesearch");
8
7
  const react_1 = __importDefault(require("react"));
8
+ const SelectedFilters_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/SelectedFilters"));
9
9
  const components_1 = require("../../components");
10
10
  const FiltersSelected = (props) => {
11
11
  var _a;
12
12
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleFiltersSelected;
13
- return (react_1.default.createElement(reactivesearch_1.SelectedFilters, { render: ({ selectedValues, setValue }) => {
13
+ return (react_1.default.createElement(SelectedFilters_1.default, { render: ({ selectedValues, setValue }) => {
14
14
  const selectedFilters = Object.entries(selectedValues)
15
15
  .filter(([key, item]) => {
16
16
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter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EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,eAAe,mBAsC1B","sourcesContent":["import { SelectedFilters } from \"@appbaseio/reactivesearch\";\nimport React from \"react\";\n\nimport { ExampleFiltersSelected } from \"../../components\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value: Array<string> | string | { start: number; end: number };\n }>;\n handleRemove: (filterKey: string) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (selectedFilterKey: string) => {\n setValue(selectedFilterKey, null);\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,qHAA6F;AAE7F,iDAA0D;AAcnD,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;;IACvE,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,mCAAsB,CAAC;IAE/D,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAC9B;iBACE,MAAM,CACL,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;;gBACd,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD;iBACA,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,GAAG;gBACR,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC,CAAC;YAEN,MAAM,YAAY,GAAG,CAAC,iBAAyB,EAAE,EAAE;gBACjD,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YACpC,CAAC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,CACL,8BAAC,eAAe,IACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,eAAe,mBAsC1B","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@appbaseio/reactivesearch/lib/components/basic/SelectedFilters\";\n\nimport { ExampleFiltersSelected } from \"../../components\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value: Array<string> | string | { start: number; end: number };\n }>;\n handleRemove: (filterKey: string) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (selectedFilterKey: string) => {\n setValue(selectedFilterKey, null);\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
2
  export declare type ReactifySearchProviderProps = {
3
+ /** Standard react children */
4
+ children?: React.ReactNode | undefined;
3
5
  /** The search area the provider will be used in */
4
6
  mode: "search" | "collection" | "instant-search";
5
7
  /** Shopify store domain used to resolve the site configuration */
@@ -1 +1 @@
1
- {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AA+C/B,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAK,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpD,MAAM,CAAC,OAAO,CAAC;YACb,sBAAsB,EAAE,KAAK,CAAC,KAAK;YACnC,qBAAqB,EAAE,KAAK,CAAC,sBAAsB;YACnD,qBAAqB,EAAE,KAAK,CAAC,IAAI;YACjC,2BAA2B,EACzB,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC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AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport * as Sentry from \"@sentry/react\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type ReactifySearchProviderProps = {\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Allows you to wrap the ReactifySearchProvider in your own ReactiveBase component */\n noReactiveBase?: boolean;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: string[];\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: {\n username: string;\n password: string;\n endpoint: string;\n };\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: string[];\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: string[];\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchProvider: React.FC<ReactifySearchProviderProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n Sentry.setTags({\n \"reactifysearch.index\": props.index,\n \"reactifysearch.shop\": props.shopifyPermanentDomain,\n \"reactifysearch.mode\": props.mode,\n \"reactifysearch.collection\":\n props.mode === \"collection\" ? props.collectionHandle : undefined,\n \"reactifysearch.filter\": props.filtersHandle,\n });\n }, [props]);\n\n return (\n <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>\n <ReactifySearchInner {...props} />\n </Sentry.ErrorBoundary>\n );\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchProviderProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.configId);\n\n const [searchTerm, setSearchTerm] = React.useState<string>(\"\");\n const [showInstantSearchResults, setShowInstantSearchResults] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\"\");\n\n const credentials = props.credentials ?? {\n username: \"guest\",\n password: \"password\",\n endpoint: \"https://api.search.reactify.app\",\n };\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchTermFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n React.useEffect(() => {\n if (searchTermFromURL && searchTerm !== searchTermFromURL) {\n setSearchTerm(searchTermFromURL);\n }\n }, [searchTermFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n React.useEffect(() => {\n if (typeof window == \"undefined\") {\n return;\n }\n\n if (window.location.search === \"\" && sortOption) {\n setSortOption(sortOption);\n }\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n return {\n config: config,\n options: {\n ...props,\n index: props.index ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: credentials,\n theme: theme,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n };\n }, [config, props, searchTerm, showInstantSearchResults, sortOption]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n if (props.noReactiveBase) {\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n {props.children}\n </ReactifySearchContext.Provider>\n );\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AAiD/B,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAK,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpD,MAAM,CAAC,OAAO,CAAC;YACb,sBAAsB,EAAE,KAAK,CAAC,KAAK;YACnC,qBAAqB,EAAE,KAAK,CAAC,sBAAsB;YACnD,qBAAqB,EAAE,KAAK,CAAC,IAAI;YACjC,2BAA2B,EACzB,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS;YAClE,uBAAuB,EAAE,KAAK,CAAC,aAAa;SAC7C,CAA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GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACtC,IAAI,CAAC,MAAM,EAAE;YACX,OAAO;SACR;QAED,OAAO;YACL,MAAM,EAAE,MAAM;YACd,OAAO,kCACF,KAAK,KACR,KAAK,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,MAAM,CAAC,KAAK,EAClC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,GACb;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;gBAC5B,wBAAwB,EAAE,wBAAwB;gBAClD,2BAA2B,EAAE,2BAA2B;aACzD;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;aAC7B;SACF,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,wBAAwB,EAAE,UAAU,CAAC,CAAC,CAAC;IAEtE,eAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,IAAI,CAAC,YAAY,EAAE;QACjB,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,KAAK,CAAC,cAAc,EAAE;QACxB,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,IAChD,KAAK,CAAC,QAAQ,CACgB,CAClC,CAAC;KACH;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAC9B,KAAK,CAAC,QAAQ,CACkB,CACJ,CAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport * as Sentry from \"@sentry/react\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type ReactifySearchProviderProps = {\n /** Standard react children */\n children?: React.ReactNode | undefined;\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Allows you to wrap the ReactifySearchProvider in your own ReactiveBase component */\n noReactiveBase?: boolean;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: string[];\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: {\n username: string;\n password: string;\n endpoint: string;\n };\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: string[];\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: string[];\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchProvider: React.FC<ReactifySearchProviderProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n Sentry.setTags({\n \"reactifysearch.index\": props.index,\n \"reactifysearch.shop\": props.shopifyPermanentDomain,\n \"reactifysearch.mode\": props.mode,\n \"reactifysearch.collection\":\n props.mode === \"collection\" ? props.collectionHandle : undefined,\n \"reactifysearch.filter\": props.filtersHandle,\n });\n }, [props]);\n\n return (\n <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>\n <ReactifySearchInner {...props} />\n </Sentry.ErrorBoundary>\n );\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchProviderProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.configId);\n\n const [searchTerm, setSearchTerm] = React.useState<string>(\"\");\n const [showInstantSearchResults, setShowInstantSearchResults] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\"\");\n\n const credentials = props.credentials ?? {\n username: \"guest\",\n password: \"password\",\n endpoint: \"https://api.search.reactify.app\",\n };\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchTermFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n React.useEffect(() => {\n if (searchTermFromURL && searchTerm !== searchTermFromURL) {\n setSearchTerm(searchTermFromURL);\n }\n }, [searchTermFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n React.useEffect(() => {\n if (typeof window == \"undefined\") {\n return;\n }\n\n if (window.location.search === \"\" && sortOption) {\n setSortOption(sortOption);\n }\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n return {\n config: config,\n options: {\n ...props,\n index: props.index ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: credentials,\n theme: theme,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n };\n }, [config, props, searchTerm, showInstantSearchResults, sortOption]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n if (props.noReactiveBase) {\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n {props.children}\n </ReactifySearchContext.Provider>\n );\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
@@ -29,8 +29,8 @@ const SensorSearchTerm = () => {
29
29
  const fieldsCrossFields = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
30
30
  const fieldsPhrase = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
31
31
  const fieldsPhrasePrefix = dataField
32
- .filter((field) => !field.includes("."))
33
- .map((field, index) => `${field}^${fieldWeights[index]}`);
32
+ .map((field, index) => `${field}^${fieldWeights[index]}`)
33
+ .filter((field) => !field.includes("."));
34
34
  const query = {
35
35
  bool: {
36
36
  should: [
@@ -1 +1 @@
1
- {"version":3,"file":"SensorSearchTerm.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSearchTerm.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4GAAoF;AAEpF,uCAAkE;AAE3D,MAAM,gBAAgB,GAAa,GAAG,EAAE;IAC7C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACvD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,mDAAmD;IACnD,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,IAAI,OA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;gCACH,CAAC,CAAC,EAAE,CAAC;4BACP,GAAG,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC;gCAC/B,CAAC,CAAC;oCACE;wCACE,WAAW,EAAE;4CACX,KAAK,EAAE,KAAK;4CACZ,MAAM,EAAE,kBAAkB;4CAC1B,IAAI,EAAE,eAAe;4CACrB,QAAQ,EAAE,KAAK;yCAChB;qCACF;iCACF;gCACH,CAAC,CAAC,EAAE,CAAC;yBACR;wBACD,oBAAoB,EAAE,GAAG;qBAC1B;iBACF,CAAC;gBACF,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,CAAC,GACD,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,gBAAgB,oBAmH3B","sourcesContent":["import React from \"react\";\nimport DataSearch from \"@appbaseio/reactivesearch/lib/components/search/DataSearch\";\n\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport const SensorSearchTerm: React.FC = () => {\n const { options, config } = useReactifySearchContext();\n const { searchTerm } = useSearch();\n\n // ignore search fields only set for instant search\n const searchFields = React.useMemo(() => {\n if (options.mode === \"search\") {\n return config.fields.filter((field) =>\n [\"always_search\", \"search_page\"].includes(field.searchType)\n );\n }\n\n if (options.mode === \"instant-search\") {\n return config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n );\n }\n\n return [];\n }, [config.fields]);\n\n if (searchFields.length === 0) {\n return null;\n }\n\n return (\n <>\n <DataSearch\n fuzziness={1}\n queryFormat=\"and\"\n autosuggest={false}\n value={searchTerm}\n componentId=\"SensorSearchTerm\"\n style={{ display: \"none\" }}\n dataField={searchFields.map((field) => field.field)}\n fieldWeights={searchFields.map((field) => field.importance)}\n customQuery={(value, props) => {\n const { dataField, fieldWeights } = props;\n\n const fieldsCrossFields = dataField.map(\n (field: string, index: number) => `${field}^${fieldWeights[index]}`\n );\n const fieldsPhrase = dataField.map(\n (field: string, index: number) => `${field}^${fieldWeights[index]}`\n );\n const fieldsPhrasePrefix = dataField\n .filter((field: string) => !field.includes(\".\"))\n .map(\n (field: string, index: number) =>\n `${field}^${fieldWeights[index]}`\n );\n\n const query = {\n bool: {\n should: [\n ...(options.mode === \"search\" && value\n ? [\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.searchTerm.keyword\":\n value.toLowerCase(),\n },\n },\n },\n },\n ]\n : []),\n ...(fieldsCrossFields.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsCrossFields,\n type: \"cross_fields\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ...(fieldsPhrase.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsPhrase,\n type: \"phrase\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ...(fieldsPhrasePrefix.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsPhrasePrefix,\n type: \"phrase_prefix\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ],\n minimum_should_match: \"1\",\n },\n };\n return { query };\n }}\n />\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"SensorSearchTerm.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSearchTerm.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4GAAoF;AAEpF,uCAAkE;AAE3D,MAAM,gBAAgB,GAAa,GAAG,EAAE;IAC7C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACvD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,mDAAmD;IACnD,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE;YAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACpC,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CA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IAAI,EAAE,eAAe;4CACrB,QAAQ,EAAE,KAAK;yCAChB;qCACF;iCACF;gCACH,CAAC,CAAC,EAAE,CAAC;yBACR;wBACD,oBAAoB,EAAE,GAAG;qBAC1B;iBACF,CAAC;gBACF,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,CAAC,GACD,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,gBAAgB,oBAmH3B","sourcesContent":["import React from \"react\";\nimport DataSearch from \"@appbaseio/reactivesearch/lib/components/search/DataSearch\";\n\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport const SensorSearchTerm: React.FC = () => {\n const { options, config } = useReactifySearchContext();\n const { searchTerm } = useSearch();\n\n // ignore search fields only set for instant search\n const searchFields = React.useMemo(() => {\n if (options.mode === \"search\") {\n return config.fields.filter((field) =>\n [\"always_search\", \"search_page\"].includes(field.searchType)\n );\n }\n\n if (options.mode === \"instant-search\") {\n return config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n );\n }\n\n return [];\n }, [config.fields]);\n\n if (searchFields.length === 0) {\n return null;\n }\n\n return (\n <>\n <DataSearch\n fuzziness={1}\n queryFormat=\"and\"\n autosuggest={false}\n value={searchTerm}\n componentId=\"SensorSearchTerm\"\n style={{ display: \"none\" }}\n dataField={searchFields.map((field) => field.field)}\n fieldWeights={searchFields.map((field) => field.importance)}\n customQuery={(value, props) => {\n const { dataField, fieldWeights } = props;\n\n const fieldsCrossFields = dataField.map(\n (field: string, index: number) => `${field}^${fieldWeights[index]}`\n );\n const fieldsPhrase = dataField.map(\n (field: string, index: number) => `${field}^${fieldWeights[index]}`\n );\n const fieldsPhrasePrefix = dataField\n .map(\n (field: string, index: number) =>\n `${field}^${fieldWeights[index]}`\n )\n .filter((field: string) => !field.includes(\".\"));\n\n const query = {\n bool: {\n should: [\n ...(options.mode === \"search\" && value\n ? [\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.searchTerm.keyword\":\n value.toLowerCase(),\n },\n },\n },\n },\n ]\n : []),\n ...(fieldsCrossFields.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsCrossFields,\n type: \"cross_fields\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ...(fieldsPhrase.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsPhrase,\n type: \"phrase\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ...(fieldsPhrasePrefix.length > 0\n ? [\n {\n multi_match: {\n query: value,\n fields: fieldsPhrasePrefix,\n type: \"phrase_prefix\",\n operator: \"and\",\n },\n },\n ]\n : []),\n ],\n minimum_should_match: \"1\",\n },\n };\n return { query };\n }}\n />\n </>\n );\n};\n"]}
@@ -1,2 +1,6 @@
1
1
  import React from "react";
2
- export declare const UtilityAuthenticatedReactiveBase: React.FC;
2
+ export declare type UtilityAuthenticatedReactiveBaseProps = {
3
+ /** Standard react children */
4
+ children?: React.ReactNode | undefined;
5
+ };
6
+ export declare const UtilityAuthenticatedReactiveBase: React.FC<UtilityAuthenticatedReactiveBaseProps>;
@@ -9,7 +9,7 @@ const hooks_1 = require("../../hooks");
9
9
  const ReactiveBase_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveBase"));
10
10
  const UtilityAuthenticatedReactiveBase = (props) => {
11
11
  const reactiveBaseProps = (0, hooks_1.useReactiveBaseProps)();
12
- return (react_1.default.createElement(ReactiveBase_1.default, Object.assign({}, reactiveBaseProps), props.children));
12
+ return react_1.default.createElement(ReactiveBase_1.default, Object.assign({}, reactiveBaseProps), props.children);
13
13
  };
14
14
  exports.UtilityAuthenticatedReactiveBase = UtilityAuthenticatedReactiveBase;
15
15
  //# sourceMappingURL=UtilityAuthenticatedReactiveBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UtilityAuthenticatedReactiveBase.js","sourceRoot":"","sources":["../../../../src/components/Utility/UtilityAuthenticatedReactiveBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uCAAmD;AACnD,+GAAuF;AAEhF,MAAM,gCAAgC,GAAa,CAAC,KAAK,EAAE,EAAE;IAClE,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,GAAE,CAAC;IAEjD,OAAO,CACL,8BAAC,sBAAY,oBACP,iBAAiB,GAEpB,KAAK,CAAC,QAAQ,CACF,CAChB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,gCAAgC,oCAU3C","sourcesContent":["import React from \"react\";\nimport { useReactiveBaseProps } from \"../../hooks\";\nimport ReactiveBase from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nexport const UtilityAuthenticatedReactiveBase: React.FC = (props) => {\n const reactiveBaseProps = useReactiveBaseProps();\n\n return (\n <ReactiveBase\n {...reactiveBaseProps}\n >\n {props.children}\n </ReactiveBase>\n );\n};\n"]}
1
+ {"version":3,"file":"UtilityAuthenticatedReactiveBase.js","sourceRoot":"","sources":["../../../../src/components/Utility/UtilityAuthenticatedReactiveBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uCAAmD;AACnD,+GAAuF;AAOhF,MAAM,gCAAgC,GAC3C,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,GAAE,CAAC;IAEjD,OAAO,8BAAC,sBAAY,oBAAK,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAgB,CAAC;AAC9E,CAAC,CAAC;AALS,QAAA,gCAAgC,oCAKzC","sourcesContent":["import React from \"react\";\nimport { useReactiveBaseProps } from \"../../hooks\";\nimport ReactiveBase from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nexport type UtilityAuthenticatedReactiveBaseProps = {\n /** Standard react children */\n children?: React.ReactNode | undefined;\n};\n\nexport const UtilityAuthenticatedReactiveBase: React.FC<UtilityAuthenticatedReactiveBaseProps> =\n (props) => {\n const reactiveBaseProps = useReactiveBaseProps();\n\n return <ReactiveBase {...reactiveBaseProps}>{props.children}</ReactiveBase>;\n };\n"]}
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  export declare const useReactiveDataSearchProps: (options: {
2
3
  [key: string]: any;
3
4
  debounce?: number | undefined;
@@ -13,7 +14,7 @@ export declare const useReactiveDataSearchProps: (options: {
13
14
  queryFormat: "and" | "or";
14
15
  autosuggest: boolean;
15
16
  value: string;
16
- onKeyUp: (e: any) => void;
17
+ onKeyUp: (event: React.KeyboardEvent) => void;
17
18
  componentId: string;
18
19
  dataField: string[];
19
20
  fieldWeights: number[];
@@ -21,8 +21,8 @@ const useReactiveDataSearchProps = (options) => {
21
21
  const searchFields = react_1.default.useMemo(() => 0 < config.fields.length
22
22
  ? config.fields.filter((field) => ["always_search", "instant_search"].includes(field.searchType))
23
23
  : [defaultSearchField], []);
24
- const handleKeyPress = react_1.default.useCallback((e) => {
25
- if ("Enter" !== e.key)
24
+ const handleKeyPress = react_1.default.useCallback((event) => {
25
+ if ("Enter" !== event.key)
26
26
  return;
27
27
  submitSearchTerm();
28
28
  }, [submitSearchTerm]);
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveDataSearchProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveDataSearchProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAAuC;AAIvC,uCAAgF;AAEhF,6EAA6E;AAC7E,MAAM,kBAAkB,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,gBAAgB;CAC7B,CAAC;AAEK,MAAM,0BAA0B,GAAG,CAAC,OAK1C,EAAE,EAAE;;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC9C,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,2BAA2B,GAC5B,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEhB,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO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react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchTerm,\n submitSearchTerm,\n setSearchTerm,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (e) => {\n if (\"Enter\" !== e.key) return;\n submitSearchTerm();\n },\n [submitSearchTerm]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchTerm || (searchTerm && searchTerm.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchTerm } });\n }, [searchTerm, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n const reactiveDataSearchProps = React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchTerm ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchTerm(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchTerm,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchTerm,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n\n return reactiveDataSearchProps;\n};\n"]}
1
+ {"version":3,"file":"useReactiveDataSearchProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveDataSearchProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAAuC;AAIvC,uCAAgF;AAEhF,6EAA6E;AAC7E,MAAM,kBAAkB,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,gBAAgB;CAC7B,CAAC;AAEK,MAAM,0BAA0B,GAAG,CAAC,OAK1C,EAAE,EAAE;;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC9C,MAAM,EACJ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,2BAA2B,GAC5B,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEhB,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CACH,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM;QACtB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAC/D;QACH,CAAC,CAAC,CAAC,kBAAkB,CAAC,EAC1B,EAAE,CACH,CAAC;IAEF,MAAM,cAAc,GAAG,eAAK,CAAC,WAAW,CACtC,CAAC,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E,CAAC,KAAK,CAAC,KAAK,CAAC,EACnD,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAC3D,QAAQ,EAAE,CAAC,KAAa,EAAE,YAAsB,EAAE,EAAE;gBAClD,aAAa,CAAC,KAAK,CAAC,CAAC;gBACrB,IAAI,CAAC,CAAC,KAAK,EAAE;oBACX,wBAAwB,CAAC,YAAY,CAAC,CAAC;iBACxC;qBAAM;oBACL,2BAA2B,EAAE,CAAC;iBAC/B;YACH,CAAC,EACD,MAAM,EAAE,GAAG,EAAE;gBACX,mEAAmE;gBACnE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;YAC5D,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;gBACZ,2BAA2B,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC,EACD,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO,CAAC,cAAc;aAC9B,IACE,OAAO,EACV,CAAA;KAAA,EACF;QACE,UAAU;QACV,cAAc;QACd,OAAO,CAAC,WAAW;QACnB,YAAY;QACZ,aAAa;QACb,wBAAwB;QACxB,2BAA2B;KAC5B,CACF,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AA/FW,QAAA,0BAA0B,8BA+FrC","sourcesContent":["import React from \"react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchTerm,\n submitSearchTerm,\n setSearchTerm,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (\"Enter\" !== event.key) return;\n submitSearchTerm();\n },\n [submitSearchTerm]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchTerm || (searchTerm && searchTerm.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchTerm } });\n }, [searchTerm, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n const reactiveDataSearchProps = React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchTerm ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchTerm(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchTerm,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchTerm,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n\n return reactiveDataSearchProps;\n};\n"]}
@@ -9,7 +9,9 @@ export declare class ReactifySearchLiquidFactory {
9
9
  shopifyPermanentDomain?: string;
10
10
  collectionHandle?: string;
11
11
  });
12
- getProvider(): React.FC<{}>;
12
+ getProvider(): React.FC<{
13
+ children?: React.ReactNode | undefined;
14
+ }>;
13
15
  getMountNode(): HTMLElement;
14
16
  getData(): any;
15
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;AAEvB,MAAa,2BAA2B;IACtC,YACS,aAMN;QANM,kBAAa,GAAb,aAAa,CAMnB;IACA,CAAC;IAEJ,WAAW;;QACT,MAAM,sBAAsB,GAC1B,MAAA,IAAI,CAAC,aAAa,CAAC,sBAAsB,mCACzC,MAAA,MAAC,MAAc,0CAAE,OAAO,0CAAE,IAAI,CAAC;QAEjC,IAAI,CAAC,sBAAsB,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SACxE;QAED,MAAM,gBAAgB,GACpB,MAAA,IAAI,CAAC,aAAa,CAAC,gBAAgB,mCACnC,MAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,gBAAgB,EAAE;YACjE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,MAAM,QAAQ,GAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CACpC,8BAAC,mCAAsB,oBACjB,IAAI,CAAC,aAAa,IACtB,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,gBAAgB,KAEjC,KAAK,CAAC,QAAQ,CACQ,CAC1B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,YAAY;QACV,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CACvC,kBAAkB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAC5C,CAAC;QACF,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CACb,kDAAkD,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAC7E,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;QAED,IAAI;YACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAE5C,OAAO,IAAI,CAAC;SACb;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;SACH;IACH,CAAC;CACF;AAtED,kEAsEC","sourcesContent":["import React from \"react\";\n\nimport {\n ReactifySearchProvider,\n ReactifySearchProviderProps,\n} from \"../components\";\n\nexport class ReactifySearchLiquidFactory {\n constructor(\n public providerProps: Omit<\n ReactifySearchProviderProps,\n \"shopifyPermanentDomain\"\n > & {\n shopifyPermanentDomain?: string;\n collectionHandle?: string;\n }\n ) {}\n\n getProvider() {\n const shopifyPermanentDomain =\n this.providerProps.shopifyPermanentDomain ??\n (window as any)?.Shopify?.shop;\n\n if (!shopifyPermanentDomain) {\n throw new Error(\"Cannot determine shopifyPermanentDomain from window\");\n }\n\n const collectionHandle =\n this.providerProps.collectionHandle ??\n window.location.pathname.split(\"/\")?.[2];\n\n if (this.providerProps.mode === \"collection\" && !collectionHandle) {\n throw new Error(\"Cannot determine collectionHandle from URL\");\n }\n\n const provider: React.FC = (props) => (\n <ReactifySearchProvider\n {...this.providerProps}\n shopifyPermanentDomain={shopifyPermanentDomain}\n collectionHandle={collectionHandle}\n >\n {props.children}\n </ReactifySearchProvider>\n );\n\n return provider;\n }\n\n getMountNode() {\n const mountNode = document.getElementById(\n `reactify-mount-${this.providerProps.mode}`\n );\n if (!mountNode) {\n throw new Error(\n `Cannot find mount node with ID \"reactify-mount-${this.providerProps.mode}\"`\n );\n }\n\n return mountNode;\n }\n\n getData() {\n const dataNode = document.getElementById(\"reactify-data\");\n if (!dataNode) {\n throw new Error(`Cannot find data node with ID \"reactify-data\"`);\n }\n\n try {\n const data = JSON.parse(dataNode.innerHTML);\n\n return data;\n } catch {\n throw new Error(\n `Cannot parse the data node with ID \"reactify-data\", check your liquid formatting`\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"liquid.js","sourceRoot":"","sources":["../../../src/utility/liquid.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,8CAGuB;AAEvB,MAAa,2BAA2B;IACtC,YACS,aAMN;QANM,kBAAa,GAAb,aAAa,CAMnB;IACA,CAAC;IAEJ,WAAW;;QACT,MAAM,sBAAsB,GAC1B,MAAA,IAAI,CAAC,aAAa,CAAC,sBAAsB,mCACzC,MAAA,MAAC,MAAc,0CAAE,OAAO,0CAAE,IAAI,CAAC;QAEjC,IAAI,CAAC,sBAAsB,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SACxE;QAED,MAAM,gBAAgB,GACpB,MAAA,IAAI,CAAC,aAAa,CAAC,gBAAgB,mCACnC,MAAA,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CAAC;QAE3C,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,gBAAgB,EAAE;YACjE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SAC/D;QAED,MAAM,QAAQ,GAET,CAAC,KAAK,EAAE,EAAE,CAAC,CACd,8BAAC,mCAAsB,oBACjB,IAAI,CAAC,aAAa,IACtB,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,EAAE,gBAAgB,KAEjC,KAAK,CAAC,QAAQ,CACQ,CAC1B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,YAAY;QACV,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CACvC,kBAAkB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAC5C,CAAC;QACF,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,KAAK,CACb,kDAAkD,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAC7E,CAAC;SACH;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;QAED,IAAI;YACF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YAE5C,OAAO,IAAI,CAAC;SACb;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAC;SACH;IACH,CAAC;CACF;AAxED,kEAwEC","sourcesContent":["import React from \"react\";\n\nimport {\n ReactifySearchProvider,\n ReactifySearchProviderProps,\n} from \"../components\";\n\nexport class ReactifySearchLiquidFactory {\n constructor(\n public providerProps: Omit<\n ReactifySearchProviderProps,\n \"shopifyPermanentDomain\"\n > & {\n shopifyPermanentDomain?: string;\n collectionHandle?: string;\n }\n ) {}\n\n getProvider() {\n const shopifyPermanentDomain =\n this.providerProps.shopifyPermanentDomain ??\n (window as any)?.Shopify?.shop;\n\n if (!shopifyPermanentDomain) {\n throw new Error(\"Cannot determine shopifyPermanentDomain from window\");\n }\n\n const collectionHandle =\n this.providerProps.collectionHandle ??\n window.location.pathname.split(\"/\")?.[2];\n\n if (this.providerProps.mode === \"collection\" && !collectionHandle) {\n throw new Error(\"Cannot determine collectionHandle from URL\");\n }\n\n const provider: React.FC<{\n children?: React.ReactNode | undefined;\n }> = (props) => (\n <ReactifySearchProvider\n {...this.providerProps}\n shopifyPermanentDomain={shopifyPermanentDomain}\n collectionHandle={collectionHandle}\n >\n {props.children}\n </ReactifySearchProvider>\n );\n\n return provider;\n }\n\n getMountNode() {\n const mountNode = document.getElementById(\n `reactify-mount-${this.providerProps.mode}`\n );\n if (!mountNode) {\n throw new Error(\n `Cannot find mount node with ID \"reactify-mount-${this.providerProps.mode}\"`\n );\n }\n\n return mountNode;\n }\n\n getData() {\n const dataNode = document.getElementById(\"reactify-data\");\n if (!dataNode) {\n throw new Error(`Cannot find data node with ID \"reactify-data\"`);\n }\n\n try {\n const data = JSON.parse(dataNode.innerHTML);\n\n return data;\n } catch {\n throw new Error(\n `Cannot parse the data node with ID \"reactify-data\", check your liquid formatting`\n );\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.2.2",
4
+ "version": "5.3.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -43,11 +43,11 @@
43
43
  "react-intersection-observer": "9.1.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@appbaseio/reactivesearch": "^3.14.0",
47
- "react": "^17.0.0"
46
+ "@appbaseio/reactivesearch": "3.14.0",
47
+ "react": "17 - 18"
48
48
  },
49
49
  "devDependencies": {
50
- "@appbaseio/reactivesearch": "^3.14.0",
50
+ "@appbaseio/reactivesearch": "3.14.0",
51
51
  "@babel/plugin-transform-typescript": "7.18.12",
52
52
  "@commitlint/cli": "13.2.0",
53
53
  "@commitlint/config-conventional": "13.2.0",
@@ -59,13 +59,14 @@
59
59
  "@storybook/components": "6.5.10",
60
60
  "@storybook/react": "6.5.10",
61
61
  "@types/debug": "4.1.7",
62
- "@types/react": "17.0.27",
62
+ "@types/react": "18.0.19",
63
+ "@types/react-dom": "18.0.6",
63
64
  "babel-loader": "8.2.2",
64
65
  "husky": "4.3.8",
65
66
  "prettier": "2.4.1",
66
67
  "pretty-quick": "3.1.1",
67
- "react": "17.0.2",
68
- "react-dom": "17.0.2",
68
+ "react": "18.2.0",
69
+ "react-dom": "18.2.0",
69
70
  "rimraf": "3.0.2",
70
71
  "standard-version": "9.3.1",
71
72
  "typescript": "4.4.3"