@usereactify/search 3.11.0 → 3.12.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ const FilterStack = (props) => {
14
14
  return null;
15
15
  if (render)
16
16
  return render(filters);
17
- return (react_1.default.createElement(react_1.default.Fragment, null, filters.map((filter) => (react_1.default.createElement(FilterWithState, Object.assign({ key: filter.id, filter: filter }, props))))));
17
+ return (react_1.default.createElement(react_1.default.Fragment, null, filters.map((filter) => (react_1.default.createElement(FilterWithState, Object.assign({ key: filter.handle, filter: filter }, props))))));
18
18
  };
19
19
  exports.FilterStack = FilterStack;
20
20
  const FilterWithState = ({ filter, renderFilter, }) => {
@@ -7,7 +7,7 @@ exports.useReactiveFilterListProps = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const useReactiveReactProp_1 = require("./useReactiveReactProp");
9
9
  const useReactiveFilterListProps = (filter) => {
10
- const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.id);
10
+ const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
11
11
  const nestedField = react_1.default.useMemo(() => {
12
12
  const nestedFields = ["variants"];
13
13
  const topField = filter.field.split(".")[0];
@@ -93,7 +93,7 @@ const useReactiveFilterListProps = (filter) => {
93
93
  customQuery,
94
94
  defaultQuery,
95
95
  URLParams: true,
96
- componentId: filter.id,
96
+ componentId: filter.handle,
97
97
  dataField: filter.field,
98
98
  filterLabel: filter.name,
99
99
  react: reactiveReactProp,
@@ -1,3 +1,3 @@
1
- export declare const useReactiveReactProp: (currentId?: string | undefined) => {
1
+ export declare const useReactiveReactProp: (currentHandle?: string | undefined) => {
2
2
  and: string[];
3
3
  };
@@ -8,18 +8,18 @@ const react_1 = __importDefault(require("react"));
8
8
  const sensor_1 = require("../../sensor");
9
9
  const useFilters_1 = require("../useFilters");
10
10
  const provider_1 = require("../../provider");
11
- const useReactiveReactProp = (currentId) => {
11
+ const useReactiveReactProp = (currentHandle) => {
12
12
  const filters = (0, useFilters_1.useFilters)();
13
- const { additionalComponentIds } = (0, provider_1.useContext)();
13
+ const { additionalComponentHandles } = (0, provider_1.useContext)();
14
14
  return react_1.default.useMemo(() => {
15
15
  return {
16
16
  and: [
17
17
  "SearchInput",
18
18
  ...sensor_1.SENSOR_IDS,
19
- ...(additionalComponentIds !== null && additionalComponentIds !== void 0 ? additionalComponentIds : []),
20
- ...filters.map((filter) => filter.id),
21
- ].filter((id) => id !== currentId),
19
+ ...(additionalComponentHandles !== null && additionalComponentHandles !== void 0 ? additionalComponentHandles : []),
20
+ ...filters.map((filter) => filter.handle),
21
+ ].filter((handle) => handle !== currentHandle),
22
22
  };
23
- }, [filters, currentId]);
23
+ }, [filters, currentHandle]);
24
24
  };
25
25
  exports.useReactiveReactProp = useReactiveReactProp;
@@ -20,7 +20,7 @@ declare type Context = {
20
20
  theme?: Theme;
21
21
  curation?: ConfigCuration;
22
22
  /** Array of additional component IDs managed outside of Reactify Search */
23
- additionalComponentIds?: string[];
23
+ additionalComponentHandles?: string[];
24
24
  };
25
25
  declare const Context: React.Context<Context | undefined>;
26
26
  declare type Props = {
@@ -35,7 +35,7 @@ declare type Props = {
35
35
  credentials?: Credentials;
36
36
  theme?: Theme;
37
37
  /** Array of additional component IDs managed outside of Reactify Search */
38
- additionalComponentIds?: string[];
38
+ additionalComponentHandles?: string[];
39
39
  /**
40
40
  * Optional render function to display a component when the config is loading.
41
41
  */
package/dist/provider.js CHANGED
@@ -38,7 +38,7 @@ const Provider = (_a) => {
38
38
  exports.Provider = Provider;
39
39
  const ConfiguredProvider = (props) => {
40
40
  var _a, _b;
41
- const { index, config, children, collection, instantSearch, filterStackId, noReactiveBase, shopifyPermanentDomain, additionalComponentIds, onRedirect, } = props;
41
+ const { index, config, children, collection, instantSearch, filterStackId, noReactiveBase, shopifyPermanentDomain, additionalComponentHandles, onRedirect, } = props;
42
42
  const credentials = (_a = props.credentials) !== null && _a !== void 0 ? _a : defaultCredentials;
43
43
  const theme = (_b = props.theme) !== null && _b !== void 0 ? _b : {
44
44
  typography: {
@@ -126,7 +126,7 @@ const ConfiguredProvider = (props) => {
126
126
  setShowInstantSearchResults,
127
127
  theme,
128
128
  curation,
129
- additionalComponentIds,
129
+ additionalComponentHandles,
130
130
  instantSearch: !!instantSearch,
131
131
  showInstantSearchResults: !!showInstantSearchResults && !!searchQuery,
132
132
  }), [
@@ -143,7 +143,7 @@ const ConfiguredProvider = (props) => {
143
143
  onRedirect,
144
144
  submitSearch,
145
145
  instantSearch,
146
- additionalComponentIds,
146
+ additionalComponentHandles,
147
147
  showInstantSearchResults,
148
148
  theme,
149
149
  ]);
@@ -191,7 +191,7 @@ const useFilterStack = (config, collection, filterStackId) => react_1.default.us
191
191
  var _a;
192
192
  // manually select filter stack by ID if provided
193
193
  if (filterStackId) {
194
- const filterStack = config.filters.find((filter) => filterStackId === filter.id);
194
+ const filterStack = config.filters.find((filter) => filterStackId === filter.handle);
195
195
  if (filterStack)
196
196
  return filterStack;
197
197
  }
@@ -116,6 +116,7 @@ export interface Sort {
116
116
  export interface Filter {
117
117
  id: string;
118
118
  name: string;
119
+ handle: string;
119
120
  enabled: boolean;
120
121
  pageSize: number;
121
122
  keywords: string[];
@@ -135,6 +136,7 @@ export interface FilterOption {
135
136
  field: string;
136
137
  id: string;
137
138
  name: string;
139
+ handle: string;
138
140
  position: number;
139
141
  settingsCollapsedDesktop: boolean;
140
142
  settingsCollapsedMobile: boolean;
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": "3.11.0",
4
+ "version": "3.12.0-beta.1",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",