@usereactify/search 5.52.0 → 5.53.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/package.json +1 -1
- package/dist/src/components/Example/ExampleResultCardCallout.js +1 -1
- package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
- package/dist/src/components/Filter/Filter.d.ts +5 -5
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/components/Filter/Filters.d.ts +4 -4
- package/dist/src/components/Filter/Filters.js.map +1 -1
- package/dist/src/components/Result/Results.d.ts +2 -2
- package/dist/src/components/Result/Results.js +42 -1
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/hooks/react-slider/useReactSliderProps.d.ts +2 -2
- package/dist/src/hooks/react-slider/useReactSliderProps.js.map +1 -1
- package/dist/src/hooks/useFilterCollapsedState.d.ts +2 -2
- package/dist/src/hooks/useFilterCollapsedState.js.map +1 -1
- package/dist/src/hooks/useFilterListProps.d.ts +3 -3
- package/dist/src/hooks/useFilterListProps.js.map +1 -1
- package/dist/src/hooks/useFilterRangeProps.d.ts +3 -3
- package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/useFilterSliderProps.d.ts +3 -3
- package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/useFilters.d.ts +2 -2
- package/dist/src/hooks/useFilters.js.map +1 -1
- package/dist/src/types/config.d.ts +20 -18
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/elastic.d.ts +1 -1
- package/dist/src/types/elastic.js.map +1 -1
- package/dist/src/types/firestore.d.ts +441 -103
- package/dist/src/types/firestore.js +114 -1
- package/dist/src/types/firestore.js.map +1 -1
- package/dist/src/types/graphql.d.ts +36337 -11312
- package/dist/src/types/graphql.js +5475 -562
- package/dist/src/types/graphql.js.map +1 -1
- package/dist/src/types/shopify.d.ts +21 -5
- package/dist/src/types/shopify.js +7 -5
- package/dist/src/types/shopify.js.map +1 -1
- package/dist/src/utility/props.d.ts +7 -7
- package/dist/src/utility/props.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilters.js","sourceRoot":"","sources":["../../../src/hooks/useFilters.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iCAAiC;AACjC,mEAA4E;AAC5E,iCAAiC;AACjC,iEAA+D;AAG/D,oCAAoD;AACpD,wCAAmC;AAE5B,MAAM,UAAU,GAAG,GAmBxB,EAAE;;IACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACvD,MAAM,qBAAqB,GAAG,eAAK,CAAC,UAAU,CAAM,yBAAiB,CAAC,CAAC;IAEvE,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,yBAAyB;QACzB,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CACzC,CAAC;QAEF,4CAA4C;QAC5C,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAC3C,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,WAAW,CAAC,MAAM,CAC9D,CAAC;YACF,IAAI,eAAe,EAAE;gBACnB,OAAO,eAAe,CAAC;aACxB;SACF;QAED,gDAAgD;QAChD,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC7D,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,WAC5D,OAAA,MAAA,WAAW,CAAC,WAAW,0CAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA,EAAA,CA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,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;aAClE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACd,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,qBAAqB,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK;SACnE,CAAC,CAAC,CAAC;IACR,CAAC,EAAE,CAAC,OAAO,EAAE,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,UAAU,0CAAE,cAAc,CAAC,CAAC,CAAC;IAEjE,MAAM,cAAc,GAAG,eAAK,CAAC,WAAW,CACtC,CACE,MAAc,EACd,KAAgD,EAC1C,EAAE;QACR,eAAK,CAAC,GAAG,CAAC,YAAY,EAAE,8BAA8B,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACvE,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAA,kBAAQ,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC,EACD,CAAC,qBAAqB,CAAC,CACxB,CAAC;IAEF,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IACrD,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7C,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE/C,OAAO;QACL,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;QAClB,cAAc,EAAE,cAAc;KAC/B,CAAC;AACJ,CAAC,CAAC;AAhHW,QAAA,UAAU,cAgHrB","sourcesContent":["import React from \"react\";\n// @ts-expect-error missing types\nimport { ReactReduxContext } from \"@usereactify/search-internals/lib/utils\";\n// @ts-expect-error missing types\nimport { setValue } from \"@appbaseio/reactivecore/lib/actions\";\n\nimport { ConfigFilter,
|
|
1
|
+
{"version":3,"file":"useFilters.js","sourceRoot":"","sources":["../../../src/hooks/useFilters.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iCAAiC;AACjC,mEAA4E;AAC5E,iCAAiC;AACjC,iEAA+D;AAG/D,oCAAoD;AACpD,wCAAmC;AAE5B,MAAM,UAAU,GAAG,GAmBxB,EAAE;;IACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACvD,MAAM,qBAAqB,GAAG,eAAK,CAAC,UAAU,CAAM,yBAAiB,CAAC,CAAC;IAEvE,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,yBAAyB;QACzB,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAC5C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CACzC,CAAC;QAEF,4CAA4C;QAC5C,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAC3C,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,KAAK,WAAW,CAAC,MAAM,CAC9D,CAAC;YACF,IAAI,eAAe,EAAE;gBACnB,OAAO,eAAe,CAAC;aACxB;SACF;QAED,gDAAgD;QAChD,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,IAAI,OAAO,CAAC,gBAAgB,EAAE;YAC7D,MAAM,eAAe,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,WAC5D,OAAA,MAAA,WAAW,CAAC,WAAW,0CAAE,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA,EAAA,CAC5D,CAAC;YACF,IAAI,eAAe,EAAE;gBACnB,OAAO,eAAe,CAAC;aACxB;SAC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CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;aAClE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACd,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,qBAAqB,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK;SACnE,CAAC,CAAC,CAAC;IACR,CAAC,EAAE,CAAC,OAAO,EAAE,MAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,UAAU,0CAAE,cAAc,CAAC,CAAC,CAAC;IAEjE,MAAM,cAAc,GAAG,eAAK,CAAC,WAAW,CACtC,CACE,MAAc,EACd,KAAgD,EAC1C,EAAE;QACR,eAAK,CAAC,GAAG,CAAC,YAAY,EAAE,8BAA8B,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QACvE,qBAAqB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAA,kBAAQ,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC,EACD,CAAC,qBAAqB,CAAC,CACxB,CAAC;IAEF,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IACrD,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7C,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE/C,OAAO;QACL,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;QAClB,cAAc,EAAE,cAAc;KAC/B,CAAC;AACJ,CAAC,CAAC;AAhHW,QAAA,UAAU,cAgHrB","sourcesContent":["import React from \"react\";\n// @ts-expect-error missing types\nimport { ReactReduxContext } from \"@usereactify/search-internals/lib/utils\";\n// @ts-expect-error missing types\nimport { setValue } from \"@appbaseio/reactivecore/lib/actions\";\n\nimport { ConfigFilter, ConfigFilterFacet } from \"../types\";\nimport { useReactifySearchContext } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useFilters = (): {\n /** The currently selected filter stack, based on mode, curation and more */\n filterStack?: ConfigFilter;\n /** All of the available filters within the filter stack */\n filters?: Array<ConfigFilterFacet>;\n /** All of the selected filters with their value */\n selected: Array<{\n handle: string;\n value: string | Array<string> | Array<{\n label: string;\n start: number;\n end: number;\n }>;\n }>;\n /** Clear filter by handle */\n setFilterValue: (\n handle: string,\n value: string | Array<string> | [number, number]\n ) => void;\n} => {\n const { options, config } = useReactifySearchContext();\n const reactivesearchContext = React.useContext<any>(ReactReduxContext);\n\n const filterStack = React.useMemo(() => {\n // select filters by type\n const matchingFilterss = config.filters.filter(\n (filter) => filter.type === options.mode\n );\n\n // select filter stack by handle if provided\n if (options.filtersHandle) {\n const matchingFilters = matchingFilterss.find(\n (filterStack) => options.filtersHandle === filterStack.handle\n );\n if (matchingFilters) {\n return matchingFilters;\n }\n }\n\n // select filter stack by collection if provided\n if (options.mode === \"collection\" && options.collectionHandle) {\n const matchingFilters = matchingFilterss.find((filterStack) =>\n filterStack.collections?.includes(options.collectionHandle)\n );\n if (matchingFilters) {\n return matchingFilters;\n }\n }\n\n // select filter with \"default\" handle\n let matchingFilters = matchingFilterss.find(\n (filterStack) => filterStack.handle === \"default\"\n );\n if (matchingFilters) {\n return matchingFilters;\n }\n\n // select any filter with \"default\" handle\n matchingFilters = config.filters.find(\n (filterStack) => filterStack.handle === \"default\"\n );\n if (matchingFilters) {\n return matchingFilters;\n }\n\n // select any available filter as a last resort\n matchingFilters = config.filters[0];\n\n return matchingFilters;\n }, [\n config,\n options.mode === \"collection\" ? options.collectionHandle : undefined,\n ]);\n\n const filters = React.useMemo(() => {\n const sortedFilters = filterStack?.options.sort((a, b) =>\n a.position > b.position ? 1 : -1\n );\n\n return sortedFilters;\n }, [filterStack]);\n\n const selected = React.useMemo(() => {\n return Object.keys(reactivesearchContext.storeState.selectedValues)\n .filter((item) => filters.find((filter) => filter.handle === item))\n .map((item) => ({\n handle: item,\n value: reactivesearchContext.storeState.selectedValues[item].value,\n }));\n }, [filters, reactivesearchContext?.storeState?.selectedValues]);\n\n const setFilterValue = React.useCallback(\n (\n handle: string,\n value: string | Array<string> | [number, number]\n ): void => {\n debug.log(\"useFilters\", \"setFilterValue[handle,value]\", handle, value);\n reactivesearchContext.store.dispatch(setValue(handle, value));\n },\n [reactivesearchContext]\n );\n\n debug.hook(\"useFilters\", \"filterStack\", filterStack);\n debug.hook(\"useFilters\", \"filters\", filters);\n debug.hook(\"useFilters\", \"selected\", selected);\n\n return {\n filterStack: filterStack,\n filters: filters,\n selected: selected,\n setFilterValue: setFilterValue,\n };\n};\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { Sort,
|
|
2
|
-
export
|
|
1
|
+
import { Sort, FilterGroup, FilterFacet, Redirect, Relevance, Curation, Market, Antonym, Synonym, Callout } from "./firestore";
|
|
2
|
+
export declare type Config = {
|
|
3
3
|
index: string;
|
|
4
4
|
endpoint: string;
|
|
5
|
+
cluster: string;
|
|
5
6
|
version: string;
|
|
7
|
+
key: string;
|
|
6
8
|
cache: {
|
|
7
9
|
enabled: boolean;
|
|
8
10
|
seconds: number;
|
|
@@ -12,7 +14,10 @@ export interface Config {
|
|
|
12
14
|
filters: Array<ConfigFilter>;
|
|
13
15
|
redirects: Array<ConfigRedirect>;
|
|
14
16
|
curations: Array<ConfigCuration>;
|
|
15
|
-
|
|
17
|
+
antonyms: Array<ConfigAntonym>;
|
|
18
|
+
synonyms: Array<ConfigSynonym>;
|
|
19
|
+
callouts: Array<ConfigCallout>;
|
|
20
|
+
markets: Array<Market>;
|
|
16
21
|
suggestions: {
|
|
17
22
|
exclude: Array<string>;
|
|
18
23
|
};
|
|
@@ -20,27 +25,24 @@ export interface Config {
|
|
|
20
25
|
search: Array<unknown>;
|
|
21
26
|
collection: Array<unknown>;
|
|
22
27
|
};
|
|
23
|
-
}
|
|
28
|
+
};
|
|
29
|
+
export declare type ConfigAntonym = Omit<Antonym, "enabled">;
|
|
30
|
+
export declare type ConfigSynonym = Omit<Synonym, "enabled">;
|
|
31
|
+
export declare type ConfigCallout = Omit<Callout, "enabled">;
|
|
24
32
|
export declare type ConfigSort = Omit<Sort, "enabled">;
|
|
25
|
-
export declare type ConfigField = Omit<
|
|
33
|
+
export declare type ConfigField = Omit<Relevance, "enabled">;
|
|
26
34
|
export declare type ConfigRedirect = Omit<Redirect, "enabled" | "keywords">;
|
|
27
|
-
export declare type ConfigFilter = Omit<
|
|
28
|
-
options: Omit<
|
|
35
|
+
export declare type ConfigFilter = Omit<FilterGroup, "enabled" | "keywords"> & {
|
|
36
|
+
options: Omit<FilterFacet, "enabled">[];
|
|
29
37
|
};
|
|
30
|
-
export declare type
|
|
38
|
+
export declare type ConfigFilterFacet = Omit<FilterFacet, "enabled">;
|
|
31
39
|
export declare type ConfigCuration = Omit<Curation, "keywords" | "boosting" | "longRunningTask" | "callouts"> & {
|
|
32
40
|
boosting: {
|
|
33
|
-
groupings: (NonNullable<NonNullable<Curation["boosting"]>["groupings"]>[0] & {
|
|
41
|
+
groupings: Array<(NonNullable<NonNullable<Curation["boosting"]>["groupings"]>[0] & {
|
|
34
42
|
query: string;
|
|
35
|
-
})
|
|
36
|
-
sortings: (NonNullable<NonNullable<Curation["boosting"]>["sortings"]>[0] & {
|
|
43
|
+
})>;
|
|
44
|
+
sortings: Array<(NonNullable<NonNullable<Curation["boosting"]>["sortings"]>[0] & {
|
|
37
45
|
query: string;
|
|
38
|
-
})
|
|
46
|
+
})>;
|
|
39
47
|
};
|
|
40
48
|
};
|
|
41
|
-
export declare type ConfigMarket = {
|
|
42
|
-
id: string;
|
|
43
|
-
label: string;
|
|
44
|
-
handle: string;
|
|
45
|
-
enabled: boolean;
|
|
46
|
-
};
|
|
@@ -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 { Sort, FilterGroup, FilterFacet, Redirect, Relevance, Curation, Market, Antonym, Synonym, Callout } 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 sort: Array<ConfigSort>;\n fields: Array<ConfigField>;\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 ConfigRedirect = Omit<Redirect, \"enabled\" | \"keywords\">;\nexport type ConfigFilter = Omit<FilterGroup, \"enabled\" | \"keywords\"> & { options: Omit<FilterFacet, \"enabled\">[] };\nexport type ConfigFilterFacet = Omit<FilterFacet, \"enabled\">;\nexport type ConfigCuration = Omit<Curation, \"keywords\" | \"boosting\" | \"longRunningTask\" | \"callouts\"> & {\n boosting: {\n groupings: Array<(NonNullable<NonNullable<Curation[\"boosting\"]>[\"groupings\"]>[0] & { query: string })>;\n sortings: Array<(NonNullable<NonNullable<Curation[\"boosting\"]>[\"sortings\"]>[0] & { query: string })>;\n };\n};"]}
|
|
@@ -12,7 +12,7 @@ export interface ElasticCallout {
|
|
|
12
12
|
/** elastic callouts are always published */
|
|
13
13
|
published: true;
|
|
14
14
|
/** elastic callouts are always attached to one curation */
|
|
15
|
-
curations: [ElasticCuration];
|
|
15
|
+
curations: [ElasticCuration] | [];
|
|
16
16
|
}
|
|
17
17
|
export interface ElasticProduct {
|
|
18
18
|
type: ElasticDocumentType.Product;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAkOD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EARW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ1B","sourcesContent":["import { Callout } from \"./firestore\";\nimport {\n Maybe,\n ProductVariantInventoryPolicy,\n MetafieldValueType,\n} from \"./graphql\";\n\nexport enum ElasticDocumentType {\n Callout = \"callout\",\n Product = \"product\",\n}\n\nexport type ElasticDocument = ElasticCallout | ElasticProduct;\n\nexport interface ElasticCallout {\n type: ElasticDocumentType.Callout;\n key: string;\n callout: Omit<Callout, \"keywords\">;\n /** elastic callouts are always published */\n published: true;\n /** elastic callouts are always attached to one curation */\n curations: [ElasticCuration];\n}\n\nexport interface ElasticProduct {\n type: ElasticDocumentType.Product;\n /** the log id from which this product was last uploaded */\n lastLogId: string;\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n description: string;\n vendor: string;\n product_type: string;\n handle: string;\n url: string;\n tags: Array<string>;\n collection_titles: Array<string>;\n /** tag prefixes defined in tagKeys are split to their own attributes */\n [key: `tags_${string}`]: Array<string> | undefined;\n /** decimal number e.g. 99.95 */\n price_min: number;\n /** decimal number e.g. 99.95 */\n price_max: number;\n /** array of option names e.g. [\"Colour\", \"Size\"] */\n options: Array<string>;\n /** @todo it would be better to use ProductStatus directly, which has uppercase */\n status: \"active\" | \"archived\" | \"draft\";\n published: boolean;\n /** ISO 8601 datetime */\n published_at: Maybe<string>;\n /** ISO 8601 datetime */\n updated_at: string;\n /** ISO 8601 datetime */\n created_at: string;\n tracks_inventory: boolean;\n /** originalSrc URL for featured image */\n image: Maybe<string>;\n /** array of images (undefined if images are disabled in sync settings) */\n images?: Array<ElasticImage>;\n /** array of variants attached to product (undefined if variants are disabled in sync settings) */\n variants?: Array<ElasticVariant>;\n /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */\n presentment_price_ranges?: {\n min_variant_price: Array<ElasticPresentmentPrice>;\n max_variant_price: Array<ElasticPresentmentPrice>;\n };\n /** array of variant skus (undefined if variants are disabled in sync settings) */\n variant_skus?: Array<string>;\n /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */\n variant_options?: Array<string>;\n /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */\n collections?: Array<ElasticCollection>;\n /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */\n metafields?: Array<ElasticMetafield>;\n /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */\n discount_amount?: number;\n /** combined inventory for all variants (undefined if variants are disabled in sync settings) */\n inventory_total?: number;\n /** number of days since published, null if unpublished */\n published_days: Maybe<number>;\n /** collection of curations that this product is attached to */\n curations?: Array<ElasticCuration>;\n /** related products **/\n related?: Array<ElasticProductRelated>;\n}\n\nexport interface ElasticProductRelated {\n createdAt: string;\n description: string;\n featuredImage: {\n originalSrc: \"https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345\";\n };\n handle: string;\n id: string;\n images: Array<ElasticImage>;\n legacyResourceId: string;\n metafields?: Array<ElasticMetafield>;\n options: Array<{\n name: string;\n }>;\n priceRangeV2: {\n maxVariantPrice: {\n amount: string;\n };\n minVariantPrice: {\n amount: string;\n };\n };\n productType: string;\n publishedAt: string;\n status: \"ACTIVE\" | \"ARCHIVED\" | \"DRAFT\";\n storefrontId: string;\n tags: Array<string>;\n title: string;\n tracksInventory: boolean;\n updatedAt: string;\n variants: Array<ElasticVariant>;\n vendor: string;\n __typename: \"Product\";\n}\n\nexport interface ElasticVariant {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n sku: Maybe<string>;\n barcode: Maybe<string>;\n /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */\n presentment_prices?: Array<{\n price: ElasticPresentmentPrice;\n compare_at_price: Maybe<ElasticPresentmentPrice>;\n }>;\n /** decimal number e.g. 99.95 */\n price: number;\n /** decimal number e.g. 99.95 */\n compare_at_price: Maybe<number>;\n /** value string for option 1 e.g. Blue */\n option1: Maybe<string>;\n /** value string for option 2 e.g. Medium */\n option2: Maybe<string>;\n /** value string for option 3 */\n option3: Maybe<string>;\n /** sort position within the product */\n position: number;\n inventory_policy: ProductVariantInventoryPolicy;\n inventory_quantity: number;\n available: boolean;\n /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */\n images?: Array<ElasticImage>;\n}\n\nexport interface ElasticCollection {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n handle: string;\n title: string;\n position: number;\n}\n\nexport interface ElasticMetafield {\n key: string;\n type: string;\n value: string;\n namespace: string;\n /**\n * Legacy valueType attribute which is no longer provided by Shopify. We still\n * populate this field to prevent any frontends breaking which rely on it.\n *\n * @see https://shopify.dev/apps/metafields/definitions/types\n */\n value_type: MetafieldValueType;\n}\n\nexport interface ElasticPresentmentPrice {\n /** decimal number e.g. 99.95 */\n amount: number;\n currency_code: string;\n}\n\nexport interface ElasticImage {\n /** originalSrc URL */\n src: string;\n /** alt text */\n alt: Maybe<string>;\n}\n\nexport interface ElasticCuration {\n id: string;\n hidden: boolean;\n position?: number;\n searchTerm?: string;\n collectionHandle?: string;\n}\n\n// non-exhaustive type for bulk request\n// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html\nexport type ElasticBulkOperationUpdate = [\n { update: { _index: string; _id: string } },\n {\n script?: {\n lang: \"painless\";\n source: string;\n params?: Record<string, any>;\n };\n upsert?: Partial<ElasticProduct>;\n scripted_upsert?: true;\n doc?: Partial<ElasticProduct>;\n doc_as_upsert?: true;\n }\n];\n\nexport type ElasticBulkOperationIndex = [\n { index: { _index: string; _id: string } },\n ElasticDocument\n];\n\nexport type ElasticBulkOperation =\n | ElasticBulkOperationUpdate\n | ElasticBulkOperationIndex;\n\nexport type ElasticSearchResult<T = ElasticDocument> = {\n hits: {\n hits: Array<ElasticHit<T>>;\n };\n};\n\nexport type ElasticHit<T = ElasticDocument> = {\n _id: string;\n _source: T;\n _score: number | null;\n};\n\nexport enum ElasticDataType {\n Text = \"text\",\n Long = \"long\",\n Date = \"date\",\n Float = \"float\",\n Nested = \"nested\",\n Keyword = \"keyword\",\n Boolean = \"boolean\",\n}\n\nexport interface ElasticProperty {\n analyzer?: string;\n type: ElasticDataType;\n ignore_above?: number;\n fields?: { [key: string]: ElasticField };\n properties?: { [key: string]: ElasticProperty };\n}\n\nexport interface ElasticField {\n type: ElasticDataType;\n ignore_above?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAkOD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EARW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ1B","sourcesContent":["import { Callout } from \"./firestore\";\nimport {\n Maybe,\n ProductVariantInventoryPolicy,\n MetafieldValueType,\n} from \"./graphql\";\n\nexport enum ElasticDocumentType {\n Callout = \"callout\",\n Product = \"product\",\n}\n\nexport type ElasticDocument = ElasticCallout | ElasticProduct;\n\nexport interface ElasticCallout {\n type: ElasticDocumentType.Callout;\n key: string;\n callout: Omit<Callout, \"keywords\">;\n /** elastic callouts are always published */\n published: true;\n /** elastic callouts are always attached to one curation */\n curations: [ElasticCuration] | [];\n}\n\nexport interface ElasticProduct {\n type: ElasticDocumentType.Product;\n /** the log id from which this product was last uploaded */\n lastLogId: string;\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n description: string;\n vendor: string;\n product_type: string;\n handle: string;\n url: string;\n tags: Array<string>;\n collection_titles: Array<string>;\n /** tag prefixes defined in tagKeys are split to their own attributes */\n [key: `tags_${string}`]: Array<string> | undefined;\n /** decimal number e.g. 99.95 */\n price_min: number;\n /** decimal number e.g. 99.95 */\n price_max: number;\n /** array of option names e.g. [\"Colour\", \"Size\"] */\n options: Array<string>;\n /** @todo it would be better to use ProductStatus directly, which has uppercase */\n status: \"active\" | \"archived\" | \"draft\";\n published: boolean;\n /** ISO 8601 datetime */\n published_at: Maybe<string>;\n /** ISO 8601 datetime */\n updated_at: string;\n /** ISO 8601 datetime */\n created_at: string;\n tracks_inventory: boolean;\n /** originalSrc URL for featured image */\n image: Maybe<string>;\n /** array of images (undefined if images are disabled in sync settings) */\n images?: Array<ElasticImage>;\n /** array of variants attached to product (undefined if variants are disabled in sync settings) */\n variants?: Array<ElasticVariant>;\n /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */\n presentment_price_ranges?: {\n min_variant_price: Array<ElasticPresentmentPrice>;\n max_variant_price: Array<ElasticPresentmentPrice>;\n };\n /** array of variant skus (undefined if variants are disabled in sync settings) */\n variant_skus?: Array<string>;\n /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */\n variant_options?: Array<string>;\n /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */\n collections?: Array<ElasticCollection>;\n /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */\n metafields?: Array<ElasticMetafield>;\n /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */\n discount_amount?: number;\n /** combined inventory for all variants (undefined if variants are disabled in sync settings) */\n inventory_total?: number;\n /** number of days since published, null if unpublished */\n published_days: Maybe<number>;\n /** collection of curations that this product is attached to */\n curations?: Array<ElasticCuration>;\n /** related products **/\n related?: Array<ElasticProductRelated>;\n}\n\nexport interface ElasticProductRelated {\n createdAt: string;\n description: string;\n featuredImage: {\n originalSrc: \"https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345\";\n };\n handle: string;\n id: string;\n images: Array<ElasticImage>;\n legacyResourceId: string;\n metafields?: Array<ElasticMetafield>;\n options: Array<{\n name: string;\n }>;\n priceRangeV2: {\n maxVariantPrice: {\n amount: string;\n };\n minVariantPrice: {\n amount: string;\n };\n };\n productType: string;\n publishedAt: string;\n status: \"ACTIVE\" | \"ARCHIVED\" | \"DRAFT\";\n storefrontId: string;\n tags: Array<string>;\n title: string;\n tracksInventory: boolean;\n updatedAt: string;\n variants: Array<ElasticVariant>;\n vendor: string;\n __typename: \"Product\";\n}\n\nexport interface ElasticVariant {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n sku: Maybe<string>;\n barcode: Maybe<string>;\n /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */\n presentment_prices?: Array<{\n price: ElasticPresentmentPrice;\n compare_at_price: Maybe<ElasticPresentmentPrice>;\n }>;\n /** decimal number e.g. 99.95 */\n price: number;\n /** decimal number e.g. 99.95 */\n compare_at_price: Maybe<number>;\n /** value string for option 1 e.g. Blue */\n option1: Maybe<string>;\n /** value string for option 2 e.g. Medium */\n option2: Maybe<string>;\n /** value string for option 3 */\n option3: Maybe<string>;\n /** sort position within the product */\n position: number;\n inventory_policy: ProductVariantInventoryPolicy;\n inventory_quantity: number;\n available: boolean;\n /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */\n images?: Array<ElasticImage>;\n}\n\nexport interface ElasticCollection {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n handle: string;\n title: string;\n position: number;\n}\n\nexport interface ElasticMetafield {\n key: string;\n type: string;\n value: string;\n namespace: string;\n /**\n * Legacy valueType attribute which is no longer provided by Shopify. We still\n * populate this field to prevent any frontends breaking which rely on it.\n *\n * @see https://shopify.dev/apps/metafields/definitions/types\n */\n value_type: MetafieldValueType;\n}\n\nexport interface ElasticPresentmentPrice {\n /** decimal number e.g. 99.95 */\n amount: number;\n currency_code: string;\n}\n\nexport interface ElasticImage {\n /** originalSrc URL */\n src: string;\n /** alt text */\n alt: Maybe<string>;\n}\n\nexport interface ElasticCuration {\n id: string;\n hidden: boolean;\n position?: number;\n searchTerm?: string;\n collectionHandle?: string;\n}\n\n// non-exhaustive type for bulk request\n// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html\nexport type ElasticBulkOperationUpdate = [\n { update: { _index: string; _id: string } },\n {\n script?: {\n lang: \"painless\";\n source: string;\n params?: Record<string, any>;\n };\n upsert?: Partial<ElasticProduct>;\n scripted_upsert?: true;\n doc?: Partial<ElasticProduct>;\n doc_as_upsert?: true;\n }\n];\n\nexport type ElasticBulkOperationIndex = [\n { index: { _index: string; _id: string } },\n ElasticDocument\n];\n\nexport type ElasticBulkOperation =\n | ElasticBulkOperationUpdate\n | ElasticBulkOperationIndex;\n\nexport type ElasticSearchResult<T = ElasticDocument> = {\n hits: {\n hits: Array<ElasticHit<T>>;\n };\n};\n\nexport type ElasticHit<T = ElasticDocument> = {\n _id: string;\n _source: T;\n _score: number | null;\n};\n\nexport enum ElasticDataType {\n Text = \"text\",\n Long = \"long\",\n Date = \"date\",\n Float = \"float\",\n Nested = \"nested\",\n Keyword = \"keyword\",\n Boolean = \"boolean\",\n}\n\nexport interface ElasticProperty {\n analyzer?: string;\n type: ElasticDataType;\n ignore_above?: number;\n fields?: { [key: string]: ElasticField };\n properties?: { [key: string]: ElasticProperty };\n}\n\nexport interface ElasticField {\n type: ElasticDataType;\n ignore_above?: number;\n}\n"]}
|