@usereactify/search 5.58.0 → 5.59.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/package.json +1 -1
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +14 -3
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +5 -6
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
- package/dist/src/components/Result/Results.d.ts +3 -1
- package/dist/src/components/Result/Results.js +33 -34
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/components/Sensor/SensorCollection.js +2 -1
- package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
- package/dist/src/components/Sensor/SensorCuratedPageCollection.d.ts +1 -0
- package/dist/src/components/Sensor/SensorCuratedPageCollection.js +22 -0
- package/dist/src/components/Sensor/SensorCuratedPageCollection.js.map +1 -0
- package/dist/src/components/Sensor/SensorCuratedPageSearch.d.ts +1 -0
- package/dist/src/components/Sensor/SensorCuratedPageSearch.js +21 -0
- package/dist/src/components/Sensor/SensorCuratedPageSearch.js.map +1 -0
- package/dist/src/components/Sensor/Sensors.js +18 -0
- package/dist/src/components/Sensor/Sensors.js.map +1 -1
- package/dist/src/components/Sensor/index.d.ts +4 -1
- package/dist/src/components/Sensor/index.js +5 -1
- package/dist/src/components/Sensor/index.js.map +1 -1
- package/dist/src/hooks/useReactifySearchContext.d.ts +17 -1
- package/dist/src/hooks/useReactifySearchContext.js +30 -4
- package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
- package/dist/src/types/config.d.ts +7 -5
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/firestore.d.ts +84 -392
- package/dist/src/types/firestore.js +53 -84
- package/dist/src/types/firestore.js.map +1 -1
- package/dist/src/types/reactivesearch.d.ts +2 -0
- package/dist/src/types/reactivesearch.js.map +1 -1
- package/dist/src/utility/liquid.d.ts +8 -1
- package/dist/src/utility/liquid.js +32 -11
- package/dist/src/utility/liquid.js.map +1 -1
- package/dist/src/utility/props.d.ts +210 -8
- package/dist/src/utility/props.js +90 -80
- package/dist/src/utility/props.js.map +1 -1
- package/dist/src/utility/queries.d.ts +391 -0
- package/dist/src/utility/queries.js +225 -0
- package/dist/src/utility/queries.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Config, ConfigCuration, ConfigRedirect, ReactivesearchResultProps } from "../types";
|
|
3
|
-
export type ReactifySearchMode = "search" | "collection" | "instant-search";
|
|
3
|
+
export type ReactifySearchMode = "search" | "collection" | "instant-search" | "curated-page";
|
|
4
4
|
export declare const ReactifySearchContext: React.Context<{
|
|
5
5
|
config: Config;
|
|
6
6
|
options: {
|
|
@@ -28,6 +28,14 @@ export declare const ReactifySearchContext: React.Context<{
|
|
|
28
28
|
collectionHandle: string;
|
|
29
29
|
} | {
|
|
30
30
|
mode: "instant-search";
|
|
31
|
+
} | {
|
|
32
|
+
mode: "curated-page";
|
|
33
|
+
variation: "collection";
|
|
34
|
+
handle: string;
|
|
35
|
+
} | {
|
|
36
|
+
mode: "curated-page";
|
|
37
|
+
variation: "search";
|
|
38
|
+
searchTerm: string;
|
|
31
39
|
});
|
|
32
40
|
search: {
|
|
33
41
|
searchTerm: string;
|
|
@@ -75,6 +83,14 @@ export declare const useReactifySearchContext: () => {
|
|
|
75
83
|
collectionHandle: string;
|
|
76
84
|
} | {
|
|
77
85
|
mode: "instant-search";
|
|
86
|
+
} | {
|
|
87
|
+
mode: "curated-page";
|
|
88
|
+
variation: "collection";
|
|
89
|
+
handle: string;
|
|
90
|
+
} | {
|
|
91
|
+
mode: "curated-page";
|
|
92
|
+
variation: "search";
|
|
93
|
+
searchTerm: string;
|
|
78
94
|
});
|
|
79
95
|
search: {
|
|
80
96
|
searchTerm: string;
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.useReactifySearchContext = exports.ReactifySearchContext = void 0;
|
|
7
|
-
const react_1 =
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
8
28
|
exports.ReactifySearchContext = react_1.default.createContext(undefined);
|
|
9
|
-
const useReactifySearchContext = () =>
|
|
29
|
+
const useReactifySearchContext = () => {
|
|
30
|
+
const context = (0, react_1.useContext)(exports.ReactifySearchContext);
|
|
31
|
+
if (!context) {
|
|
32
|
+
throw new Error("useReactifySearchContext must be used within a ReactifySearchProvider");
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
};
|
|
10
36
|
exports.useReactifySearchContext = useReactifySearchContext;
|
|
11
37
|
//# sourceMappingURL=useReactifySearchContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactifySearchContext.js","sourceRoot":"","sources":["../../../src/hooks/useReactifySearchContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useReactifySearchContext.js","sourceRoot":"","sources":["../../../src/hooks/useReactifySearchContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAM7B,QAAA,qBAAqB,GAAG,eAAK,CAAC,aAAa,CAiEtD,SAAS,CAAC,CAAC;AAEN,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,6BAAqB,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,wBAAwB,4BAMnC","sourcesContent":["import React, { useContext } from \"react\";\n\nimport { Config, ConfigCuration, ConfigRedirect, ReactivesearchResultProps } from \"../types\";\n\nexport type ReactifySearchMode = \"search\" | \"collection\" | \"instant-search\" | \"curated-page\";\n\nexport const ReactifySearchContext = React.createContext<\n | {\n config: Config;\n options: {\n clientId: string;\n mode: ReactifySearchMode;\n index: string;\n shopifyPermanentDomain: string;\n market?: string;\n filtersHandle?: string;\n credentials?: string;\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n theme: Record<string, unknown>;\n additionalComponentIds?: Array<string>;\n includeFields?: Array<string>;\n excludeFields?: Array<string>;\n query?: Record<string, string>;\n preload?: {\n config: Config;\n state: unknown;\n };\n } & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n | {\n mode: \"curated-page\";\n variation: \"collection\";\n handle: string;\n }\n | {\n mode: \"curated-page\";\n variation: \"search\";\n searchTerm: string;\n }\n );\n search: {\n searchTerm: string;\n setSearchTerm: React.Dispatch<React.SetStateAction<string>>;\n showInstantSearchResults: boolean;\n setShowInstantSearchResults: React.Dispatch<React.SetStateAction<boolean>>;\n searchRedirect: ConfigRedirect | undefined;\n };\n sortby: {\n sortOption: string;\n setSortOption: React.Dispatch<React.SetStateAction<string>>;\n };\n results: {\n results: ReactivesearchResultProps[\"data\"];\n setResults: React.Dispatch<React.SetStateAction<ReactivesearchResultProps[\"data\"]>>;\n resultStats?: ReactivesearchResultProps[\"resultStats\"];\n setResultStats: React.Dispatch<\n React.SetStateAction<ReactivesearchResultProps[\"resultStats\"] | undefined>\n >;\n };\n curation: ConfigCuration | undefined;\n }\n | undefined\n>(undefined);\n\nexport const useReactifySearchContext = () => {\n const context = useContext(ReactifySearchContext);\n if (!context) {\n throw new Error(\"useReactifySearchContext must be used within a ReactifySearchProvider\");\n }\n return context;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Antonym, Callout, Curation, FilterFacet, FilterGroup, Market, MerchandisingCalloutAutofillBehaviour, Redirect, Relevance, SearchableField, Sort, Synonym } from "./firestore";
|
|
2
2
|
export type Config = {
|
|
3
3
|
index: string;
|
|
4
4
|
endpoint: string;
|
|
@@ -14,6 +14,7 @@ export type Config = {
|
|
|
14
14
|
};
|
|
15
15
|
sort: Array<ConfigSort>;
|
|
16
16
|
fields: Array<ConfigField>;
|
|
17
|
+
searchableFields: Array<ConfigSeachableField>;
|
|
17
18
|
filters: Array<ConfigFilter>;
|
|
18
19
|
redirects: Array<ConfigRedirect>;
|
|
19
20
|
curations: Array<ConfigCuration>;
|
|
@@ -34,6 +35,7 @@ export type ConfigSynonym = Omit<Synonym, "enabled">;
|
|
|
34
35
|
export type ConfigCallout = Omit<Callout, "enabled">;
|
|
35
36
|
export type ConfigSort = Omit<Sort, "enabled">;
|
|
36
37
|
export type ConfigField = Omit<Relevance, "enabled">;
|
|
38
|
+
export type ConfigSeachableField = Omit<SearchableField, "enabled">;
|
|
37
39
|
export type ConfigRedirect = Omit<Redirect, "enabled" | "keywords">;
|
|
38
40
|
export type ConfigFilter = Omit<FilterGroup, "enabled" | "keywords"> & {
|
|
39
41
|
options: Omit<FilterFacet, "enabled">[];
|
|
@@ -41,11 +43,11 @@ export type ConfigFilter = Omit<FilterGroup, "enabled" | "keywords"> & {
|
|
|
41
43
|
export type ConfigFilterFacet = Omit<FilterFacet, "enabled">;
|
|
42
44
|
export type ConfigCuration = Omit<Curation, "keywords" | "boosting" | "longRunningTask" | "callouts"> & {
|
|
43
45
|
boosting: {
|
|
44
|
-
groupings: Array<
|
|
46
|
+
groupings: Array<NonNullable<NonNullable<Curation["boosting"]>["groupings"]>[0] & {
|
|
45
47
|
query: string;
|
|
46
|
-
}
|
|
47
|
-
sortings: Array<
|
|
48
|
+
}>;
|
|
49
|
+
sortings: Array<NonNullable<NonNullable<Curation["boosting"]>["sortings"]>[0] & {
|
|
48
50
|
query: string;
|
|
49
|
-
}
|
|
51
|
+
}>;
|
|
50
52
|
};
|
|
51
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"","sourcesContent":["import {\n Antonym,\n Callout,\n Curation,\n FilterFacet,\n FilterGroup,\n Market,\n MerchandisingCalloutAutofillBehaviour,\n Redirect,\n Relevance,\n SearchableField,\n Sort,\n Synonym,\n} from \"./firestore\";\n\n// when exposed as config, most resources have the `enabled` and `keywords` attributes removed\n// curation boosting groupings and sortings both have a json encoded elastic query added to them\n\nexport type Config = {\n index: string;\n endpoint: string;\n cluster: string;\n version: string;\n key: string;\n cache: {\n enabled: boolean;\n seconds: number;\n };\n merchandising: {\n calloutAutofillBehaviour: MerchandisingCalloutAutofillBehaviour;\n };\n sort: Array<ConfigSort>;\n fields: Array<ConfigField>;\n searchableFields: Array<ConfigSeachableField>;\n filters: Array<ConfigFilter>;\n redirects: Array<ConfigRedirect>;\n curations: Array<ConfigCuration>;\n antonyms: Array<ConfigAntonym>;\n synonyms: Array<ConfigSynonym>;\n callouts: Array<ConfigCallout>;\n markets: Array<Market>;\n suggestions: {\n exclude: Array<string>;\n };\n sensors: {\n search: Array<unknown>;\n collection: Array<unknown>;\n };\n};\n\nexport type ConfigAntonym = Omit<Antonym, \"enabled\">;\nexport type ConfigSynonym = Omit<Synonym, \"enabled\">;\nexport type ConfigCallout = Omit<Callout, \"enabled\">;\nexport type ConfigSort = Omit<Sort, \"enabled\">;\nexport type ConfigField = Omit<Relevance, \"enabled\">;\nexport type ConfigSeachableField = Omit<SearchableField, \"enabled\">;\nexport type ConfigRedirect = Omit<Redirect, \"enabled\" | \"keywords\">;\nexport type ConfigFilter = Omit<FilterGroup, \"enabled\" | \"keywords\"> & {\n options: Omit<FilterFacet, \"enabled\">[];\n};\nexport type ConfigFilterFacet = Omit<FilterFacet, \"enabled\">;\nexport type ConfigCuration = Omit<\n Curation,\n \"keywords\" | \"boosting\" | \"longRunningTask\" | \"callouts\"\n> & {\n boosting: {\n groupings: Array<\n NonNullable<NonNullable<Curation[\"boosting\"]>[\"groupings\"]>[0] & { query: string }\n >;\n sortings: Array<\n NonNullable<NonNullable<Curation[\"boosting\"]>[\"sortings\"]>[0] & { query: string }\n >;\n };\n};\n\n"]}
|