@usereactify/search 5.45.0 → 5.46.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/package.json +2 -1
  3. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +6 -0
  4. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +3 -3
  5. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
  6. package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
  7. package/dist/src/components/Sensor/SensorCustom.js +1 -1
  8. package/dist/src/components/Sensor/SensorCustom.js.map +1 -1
  9. package/dist/src/components/Suggestions/Suggestions.js +2 -2
  10. package/dist/src/components/Suggestions/Suggestions.js.map +1 -1
  11. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +40 -35
  12. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  13. package/dist/src/hooks/useAnalytics.js +3 -0
  14. package/dist/src/hooks/useAnalytics.js.map +1 -1
  15. package/dist/src/hooks/useConfig.d.ts +1 -1
  16. package/dist/src/hooks/useConfig.js +3 -6
  17. package/dist/src/hooks/useConfig.js.map +1 -1
  18. package/dist/src/hooks/useFlags.js +8 -2
  19. package/dist/src/hooks/useFlags.js.map +1 -1
  20. package/dist/src/hooks/useReactifySearchContext.d.ts +8 -0
  21. package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
  22. package/dist/src/hooks/useSortBy.js +4 -1
  23. package/dist/src/hooks/useSortBy.js.map +1 -1
  24. package/dist/src/index.d.ts +3 -0
  25. package/dist/src/index.js +3 -0
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/types/config.d.ts +0 -3
  28. package/dist/src/types/config.js.map +1 -1
  29. package/dist/src/utility/config.d.ts +4 -0
  30. package/dist/src/utility/config.js +57 -0
  31. package/dist/src/utility/config.js.map +1 -0
  32. package/dist/src/utility/props.d.ts +292 -0
  33. package/dist/src/utility/props.js +255 -0
  34. package/dist/src/utility/props.js.map +1 -0
  35. package/dist/src/utility/server.d.ts +2 -0
  36. package/dist/src/utility/server.js +36 -0
  37. package/dist/src/utility/server.js.map +1 -0
  38. package/package.json +2 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.tsx"],"names":[],"mappings":";;;AAAA,8DAA4H;AAC5H,8CAA2C;AAapC,MAAM,mBAAmB,GAAG,CAAC,OAAwC,EAAE,EAAE;IAC9E,OAAO;QACL,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,IAAA,iCAAyB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAChH,IAAA,uBAAe,EAAC,OAAO,CAAC;KACzB,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B;AAEK,MAAM,yBAAyB,GAAG,CAAC,OAAwC,EAAE,iBAAqC,EAAE,EAAE;IAC3H,IAAI,WAAW,GAA4B,EAAE,CAAC;IAE9C,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC9C,WAAW,GAAG,IAAA,4BAAoB,EAAC,iBAAiB,CAAC,CAAC;KACvD;IAED,IAAI,iBAAiB,CAAC,WAAW,KAAK,QAAQ,IAAI,iBAAiB,CAAC,WAAW,KAAK,OAAO,EAAE;QAC3F,IAAI,iBAAiB,CAAC,WAAW,KAAK,OAAO,EAAE;YAC7C,WAAW,GAAG,IAAA,2BAAmB,EAAC,iBAAiB,CAAC,CAAC;SACtD;aAAM;YACL,WAAW,GAAG,IAAA,0BAAkB,EAAC,iBAAiB,CAAC,CAAC;SACrD;KACF;IAED,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAE/D,uCACK,WAAW,GACX,WAAW,EACd;AACJ,CAAC,CAAC;AArBW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AAC,EAAE,CAAC;IAEL,OAAO;QACL,WAAW,EAAE,MAAA,iBAAiB,CAAC,mBAAmB,mCAAI,IAAI;QAC1D,UAAU,EAAE,MAAA,iBAAiB,CAAC,kBAAkB,mCAAI,IAAI;QACxD,SAAS,EAAE,KAAK;QAChB,YAAY,EAAE,KAAK;QACnB,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,mBAAmB,uBAqB9B;AAEK,MAAM,oBAAoB,GAAG,CAAC,iBAAqC,EAAE,EAAE;IAC5E,OAAO,EAAE,CAAA;AACX,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { MultiList, MultiRange, ReactiveComponent, ReactiveList, SingleList, SingleRange } from \"@appbaseio/reactivesearch\";\nimport { SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterOption } from \"../types\";\n\nexport type GeneratePropsFilterGroupOptions = {\n mode: \"search\" | \"instant-search\" | \"collection\";\n config: Config;\n filterGroup: ConfigFilter;\n\n additionalComponentIds?: Array<string>;\n includeFields?: Array<string>;\n excludeFields?: Array<string>;\n};\n\nexport const getPropsFilterGroup = (options: GeneratePropsFilterGroupOptions) => {\n return [\n ...options.filterGroup.options.map((filterGroupOption) => getPropsFilterGroupOption(options, filterGroupOption)),\n getPropsResults(options),\n ];\n};\n\nexport const getPropsFilterGroupOption = (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterOption) => {\n let filterProps: Record<string, unknown> = {};\n\n if (filterGroupOption.displayType === \"slider\") {\n filterProps = getPropsFilterSlider(filterGroupOption);\n }\n\n if (filterGroupOption.displayType === \"single\" || filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n filterProps = getPropsFilterRange(filterGroupOption);\n } else {\n filterProps = getPropsFilterList(filterGroupOption);\n }\n }\n\n const sharedProps = getPropsShared(options, filterGroupOption);\n\n return {\n ...sharedProps,\n ...filterProps,\n };\n};\n\nexport const getPropsResults = (options: GeneratePropsFilterGroupOptions) => {\n const includeFieldsProp = (() => {\n return [\n ...(options.includeFields ?? []),\n \"id\",\n \"title\",\n \"type\",\n \"handle\",\n \"image\",\n \"variants.id\",\n \"variants.presentment_prices\",\n \"callout\",\n ];\n })();\n const excludeFieldsProp = (() => {\n return [...(options.excludeFields ?? [])];\n })();\n\n return {\n size: options.filterGroup.pageSize,\n URLParams: true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: getPropsReact(options),\n includeFields: includeFieldsProp,\n excludeFields: excludeFieldsProp,\n // scrollTarget: options.scrollTarget,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: options.filterGroup?.paginationType !== \"infinite_scroll\",\n infiniteScroll: options.filterGroup?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n source: ReactiveList,\n }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterOption) => {\n const sensorIds = SENSOR_IDS(options.mode, options.config);\n const reactProp = (() => {\n if (filterGroupOption?.settingsShowEmptyValues) {\n return {\n and: sensorIds,\n };\n }\n\n return {\n and: [\n ...sensorIds,\n ...(options.additionalComponentIds ?? []),\n ...(options.filterGroup?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== filterGroupOption?.handle),\n };\n })();\n\n return reactProp;\n};\n\nexport const getPropsShared = (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterOption) => {\n const reactProp = getPropsReact(options, filterGroupOption);\n const nestedFieldProp = (() => {\n const nestedFields = [\"variants\"];\n const topField = filterGroupOption.field.split(\".\")[0];\n if (nestedFields.includes(topField)) {\n return topField;\n }\n return undefined;\n })();\n const customQueryProp = (() => {\n if (\n !filterGroupOption.settingsHideUnavailable ||\n !filterGroupOption.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filterGroupOption.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n })();\n const defaultQueryProp = (() => {\n if (!filterGroupOption.field.startsWith(\"variants.\")) {\n return undefined;\n }\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n bool: {\n minimum_should_match: 1,\n should: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n match: {\n \"variants.available\": filterGroupOption.settingsHideUnavailable\n ? \"true\"\n : \"false\",\n },\n },\n ],\n },\n },\n aggs: {\n [filterGroupOption.field]: {\n terms: {\n field: filterGroupOption.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n aggs: {\n parent_docs: { reverse_nested: {} },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n })();\n const sourceProp = (() => {\n if (filterGroupOption.displayType === \"slider\") {\n return ReactiveComponent;\n }\n if (filterGroupOption.displayType === \"single\") {\n if (filterGroupOption.displayView === \"range\") {\n return SingleRange;\n }\n return SingleList;\n }\n if (filterGroupOption.displayType === \"multi\") {\n if (filterGroupOption.displayView === \"range\") {\n return MultiRange;\n }\n return MultiList;\n }\n \n return;\n })();\n\n return {\n URLParams: true,\n componentId: filterGroupOption.handle,\n dataField: filterGroupOption.field,\n filterLabel: filterGroupOption.name,\n nestedField: nestedFieldProp,\n customQuery: customQueryProp,\n defaultQuery: defaultQueryProp,\n source: sourceProp,\n react: reactProp,\n }\n};\n\nexport const getPropsFilterList = (filterGroupOption: ConfigFilterOption) => {\n return {\n size: parseInt(filterGroupOption.displaySize) || undefined,\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showLoadMore: filterGroupOption.settingsShowMore ?? false,\n showSearch: filterGroupOption.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n };\n};\n\nexport const getPropsFilterRange = (filterGroupOption: ConfigFilterOption) => {\n const data = (() => {\n return (\n filterGroupOption.displayRangeOptions?.map((option) => {\n const [label, start, end] = option.split(\":\");\n return {\n label: label,\n start: start ? parseInt(start) : 0,\n end: end ? parseInt(end) : Number.MAX_SAFE_INTEGER,\n };\n }) ?? []\n );\n })();\n\n return {\n queryFormat: filterGroupOption.settingsFilterLogic ?? \"or\",\n showFilter: filterGroupOption.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n data: data,\n };\n};\n\nexport const getPropsFilterSlider = (filterGroupOption: ConfigFilterOption) => {\n return {}\n};"]}
@@ -0,0 +1,2 @@
1
+ import { ReactifySearchProviderProps } from "../components";
2
+ export declare const generateProviderProps: (options: ReactifySearchProviderProps) => Promise<ReactifySearchProviderProps>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.generateProviderProps = void 0;
16
+ // @ts-expect-error missing types
17
+ const server_1 = __importDefault(require("@appbaseio/reactivesearch/lib/server"));
18
+ const config_1 = require("./config");
19
+ const props_1 = require("./props");
20
+ const generateProviderProps = (options) => __awaiter(void 0, void 0, void 0, function* () {
21
+ const config = yield (0, config_1.getConfig)(options.shopifyPermanentDomain);
22
+ const props = (0, props_1.getPropsFilterGroup)({
23
+ mode: options.mode,
24
+ config: config,
25
+ filterGroup: config.filters[0],
26
+ });
27
+ return Object.assign(Object.assign({}, options), { preload: {
28
+ config: config,
29
+ state: yield (0, server_1.default)(props, null, {
30
+ app: config.index,
31
+ url: config.endpoint,
32
+ }),
33
+ } });
34
+ });
35
+ exports.generateProviderProps = generateProviderProps;
36
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/utility/server.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,kFAAsE;AAEtE,qCAAqC;AACrC,mCAA8C;AAIvC,MAAM,qBAAqB,GAAG,CAAO,OAAoC,EAAwC,EAAE;IACxH,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,IAAA,2BAAmB,EAAC;QAChC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,MAAM;QACd,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/B,CAAC,CAAC;IAEH,uCACK,OAAO,KACV,OAAO,EAAE;YACP,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,MAAM,IAAA,gBAAkB,EAAC,KAAK,EAAE,IAAI,EAAE;gBAC3C,GAAG,EAAE,MAAM,CAAC,KAAK;gBACjB,GAAG,EAAE,MAAM,CAAC,QAAQ;aACrB,CAAC;SACH,IACF;AACH,CAAC,CAAA,CAAA;AAlBY,QAAA,qBAAqB,yBAkBjC","sourcesContent":["// @ts-expect-error missing types\nimport initReactivesearch from \"@appbaseio/reactivesearch/lib/server\";\n\nimport { getConfig } from \"./config\";\nimport { getPropsFilterGroup } from \"./props\";\nimport { ReactifySearchProviderProps } from \"../components\";\n\n\nexport const generateProviderProps = async (options: ReactifySearchProviderProps): Promise<ReactifySearchProviderProps> => {\n const config = await getConfig(options.shopifyPermanentDomain);\n const props = getPropsFilterGroup({\n mode: options.mode,\n config: config,\n filterGroup: config.filters[0],\n });\n\n return {\n ...options,\n preload: {\n config: config,\n state: await initReactivesearch(props, null, {\n app: config.index,\n url: config.endpoint,\n }),\n }\n }\n}"]}
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.45.0",
4
+ "version": "5.46.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@appbaseio/reactivesearch": "3.14.0",
47
+ "@appbaseio/reactivecore": "9.8.0",
47
48
  "@babel/plugin-transform-typescript": "7.18.12",
48
49
  "@commitlint/cli": "13.2.0",
49
50
  "@commitlint/config-conventional": "13.2.0",