@usereactify/search 5.51.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 +21 -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/hooks/useSearch.d.ts +3 -1
- package/dist/src/hooks/useSearch.js +31 -0
- package/dist/src/hooks/useSearch.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,14 +1,23 @@
|
|
|
1
|
-
import { ProductQuery,
|
|
1
|
+
import { ProductQuery, BulkQueryProductsWithDraftProductsQuery, ListAppSubscriptionsQuery, ListAppPurchaseOneTimeQuery, BulkQueryProductMarketsWithDraftProductsQuery } from "./graphql";
|
|
2
|
+
export declare type ShopifyProductImage = {
|
|
3
|
+
__typename: "Image";
|
|
4
|
+
id?: string | null;
|
|
5
|
+
altText?: string | null;
|
|
6
|
+
originalSrc: string;
|
|
7
|
+
};
|
|
2
8
|
export declare type ShopifyProduct = NonNullable<ProductQuery["product"]>;
|
|
3
9
|
export declare type ShopifyVariant = ShopifyProduct["variants"]["edges"][0]["node"];
|
|
4
|
-
export declare type BulkShopifyProduct =
|
|
10
|
+
export declare type BulkShopifyProduct = BulkQueryProductsWithDraftProductsQuery["products"]["edges"][0]["node"];
|
|
11
|
+
export declare type BulkShopifyProductMarket = BulkQueryProductMarketsWithDraftProductsQuery["products"]["edges"][0]["node"];
|
|
5
12
|
export declare type BulkShopifyVariant = BulkShopifyProduct["variants"]["edges"][0]["node"];
|
|
6
13
|
export declare type ShopifyExportProduct = Omit<BulkShopifyProduct, "variants" | "images" | "media" | "metafields">;
|
|
7
14
|
export declare type ShopifyExportProductVariant = Omit<BulkShopifyVariant, "presentmentPrices">;
|
|
8
|
-
export declare type ShopifyExportPresentmentPrice = BulkShopifyVariant["presentmentPrices"]["edges"][0]["node"]
|
|
9
|
-
|
|
15
|
+
export declare type ShopifyExportPresentmentPrice = BulkShopifyVariant["presentmentPrices"]["edges"][0]["node"] & {
|
|
16
|
+
__parentId?: string;
|
|
17
|
+
};
|
|
10
18
|
export declare type ShopifyExportMedia = BulkShopifyProduct["media"]["edges"][0]["node"];
|
|
11
19
|
export declare type ShopifyExportMetafield = BulkShopifyProduct["metafields"]["edges"][0]["node"];
|
|
20
|
+
export declare type ShopifyExportPublication = BulkShopifyProductMarket["unpublishedPublications"]["edges"][0]["node"];
|
|
12
21
|
export interface ShopifyExportLine {
|
|
13
22
|
__parentId?: string;
|
|
14
23
|
__typename: string;
|
|
@@ -16,6 +25,13 @@ export interface ShopifyExportLine {
|
|
|
16
25
|
export declare function isProduct(exportLine: ShopifyExportLine): exportLine is ShopifyExportProduct;
|
|
17
26
|
export declare function isProductVariant(exportLine: ShopifyExportLine): exportLine is ShopifyExportProductVariant;
|
|
18
27
|
export declare function isPresentmentPrice(exportLine: ShopifyExportLine): exportLine is ShopifyExportPresentmentPrice;
|
|
19
|
-
export declare function isImage(exportLine: ShopifyExportLine): exportLine is ShopifyExportImage;
|
|
20
28
|
export declare function isMedia(exportLine: ShopifyExportLine): exportLine is ShopifyExportMedia;
|
|
29
|
+
export declare function isPublication(exportLine: ShopifyExportLine): exportLine is ShopifyExportPublication;
|
|
21
30
|
export declare function isMetafield(exportLine: ShopifyExportLine): exportLine is ShopifyExportMetafield;
|
|
31
|
+
export { ProductStatus } from "./graphql";
|
|
32
|
+
export declare type ShopifyAppSubscription = NonNullable<ListAppSubscriptionsQuery["currentAppInstallation"]["activeSubscriptions"][number]>;
|
|
33
|
+
export declare type ShopifyAppPurchaseOneTime = NonNullable<ListAppPurchaseOneTimeQuery["currentAppInstallation"]["oneTimePurchases"]["edges"][number]["node"]>;
|
|
34
|
+
export interface ShopifyExportLine {
|
|
35
|
+
__parentId?: string;
|
|
36
|
+
__typename: string;
|
|
37
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMetafield = exports.
|
|
3
|
+
exports.ProductStatus = exports.isMetafield = exports.isPublication = exports.isMedia = exports.isPresentmentPrice = exports.isProductVariant = exports.isProduct = void 0;
|
|
4
4
|
function isProduct(exportLine) {
|
|
5
5
|
return "Product" === exportLine.__typename;
|
|
6
6
|
}
|
|
@@ -13,16 +13,18 @@ function isPresentmentPrice(exportLine) {
|
|
|
13
13
|
return "ProductVariantPricePair" === exportLine.__typename;
|
|
14
14
|
}
|
|
15
15
|
exports.isPresentmentPrice = isPresentmentPrice;
|
|
16
|
-
function isImage(exportLine) {
|
|
17
|
-
return "Image" === exportLine.__typename;
|
|
18
|
-
}
|
|
19
|
-
exports.isImage = isImage;
|
|
20
16
|
function isMedia(exportLine) {
|
|
21
17
|
return ["Video", "Model3d", "MediaImage", "ExternalVideo"].includes(exportLine.__typename);
|
|
22
18
|
}
|
|
23
19
|
exports.isMedia = isMedia;
|
|
20
|
+
function isPublication(exportLine) {
|
|
21
|
+
return "Publication" === exportLine.__typename;
|
|
22
|
+
}
|
|
23
|
+
exports.isPublication = isPublication;
|
|
24
24
|
function isMetafield(exportLine) {
|
|
25
25
|
return "Metafield" === exportLine.__typename;
|
|
26
26
|
}
|
|
27
27
|
exports.isMetafield = isMetafield;
|
|
28
|
+
var graphql_1 = require("./graphql");
|
|
29
|
+
Object.defineProperty(exports, "ProductStatus", { enumerable: true, get: function () { return graphql_1.ProductStatus; } });
|
|
28
30
|
//# sourceMappingURL=shopify.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify.js","sourceRoot":"","sources":["../../../src/types/shopify.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shopify.js","sourceRoot":"","sources":["../../../src/types/shopify.ts"],"names":[],"mappings":";;;AAsCA,SAAgB,SAAS,CAAC,UAA6B;IACrD,OAAO,SAAS,KAAK,UAAU,CAAC,UAAU,CAAC;AAC7C,CAAC;AAFD,8BAEC;AAED,SAAgB,gBAAgB,CAAC,UAA6B;IAC5D,OAAO,gBAAgB,KAAK,UAAU,CAAC,UAAU,CAAC;AACpD,CAAC;AAFD,4CAEC;AAED,SAAgB,kBAAkB,CAAC,UAA6B;IAC9D,OAAO,yBAAyB,KAAK,UAAU,CAAC,UAAU,CAAC;AAC7D,CAAC;AAFD,gDAEC;AAED,SAAgB,OAAO,CAAC,UAA6B;IACnD,OAAO,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC7F,CAAC;AAFD,0BAEC;AAED,SAAgB,aAAa,CAAC,UAA6B;IACzD,OAAO,aAAa,KAAK,UAAU,CAAC,UAAU,CAAC;AACjD,CAAC;AAFD,sCAEC;AAED,SAAgB,WAAW,CAAC,UAA6B;IACvD,OAAO,WAAW,KAAK,UAAU,CAAC,UAAU,CAAC;AAC/C,CAAC;AAFD,kCAEC;AAED,qCAA0C;AAAjC,wGAAA,aAAa,OAAA","sourcesContent":["import {\n ProductQuery,\n BulkQueryProductsWithDraftProductsQuery,\n ListAppSubscriptionsQuery,\n ListAppPurchaseOneTimeQuery,\n BulkQueryProductMarketsWithDraftProductsQuery,\n} from \"./graphql\";\n\nexport type ShopifyProductImage = {\n __typename: \"Image\";\n id?: string | null;\n altText?: string | null;\n originalSrc: string;\n}\n\n// these are the types from the single \"product\" query, and is what we store in firestore\nexport type ShopifyProduct = NonNullable<ProductQuery[\"product\"]>\nexport type ShopifyVariant = ShopifyProduct[\"variants\"][\"edges\"][0][\"node\"]\n\n// these are the types from the bulk \"product\" query, which should match the above, but we\n// always type on the single query in firestore\nexport type BulkShopifyProduct = BulkQueryProductsWithDraftProductsQuery[\"products\"][\"edges\"][0][\"node\"]\nexport type BulkShopifyProductMarket = BulkQueryProductMarketsWithDraftProductsQuery[\"products\"][\"edges\"][0][\"node\"]\nexport type BulkShopifyVariant = BulkShopifyProduct[\"variants\"][\"edges\"][0][\"node\"]\n\n// these are types for the individual \"export lines\" which shopify exports in the bulk export file\nexport type ShopifyExportProduct = Omit<BulkShopifyProduct, \"variants\" | \"images\" | \"media\" | \"metafields\">\nexport type ShopifyExportProductVariant = Omit<BulkShopifyVariant, \"presentmentPrices\">\nexport type ShopifyExportPresentmentPrice = BulkShopifyVariant[\"presentmentPrices\"][\"edges\"][0][\"node\"] & { __parentId?: string }\nexport type ShopifyExportMedia = BulkShopifyProduct[\"media\"][\"edges\"][0][\"node\"]\nexport type ShopifyExportMetafield = BulkShopifyProduct[\"metafields\"][\"edges\"][0][\"node\"]\nexport type ShopifyExportPublication = BulkShopifyProductMarket[\"unpublishedPublications\"][\"edges\"][0][\"node\"]\n\nexport interface ShopifyExportLine {\n __parentId?: string\n __typename: string\n}\n\nexport function isProduct(exportLine: ShopifyExportLine): exportLine is ShopifyExportProduct {\n return \"Product\" === exportLine.__typename;\n}\n\nexport function isProductVariant(exportLine: ShopifyExportLine): exportLine is ShopifyExportProductVariant {\n return \"ProductVariant\" === exportLine.__typename;\n}\n\nexport function isPresentmentPrice(exportLine: ShopifyExportLine): exportLine is ShopifyExportPresentmentPrice {\n return \"ProductVariantPricePair\" === exportLine.__typename;\n}\n\nexport function isMedia(exportLine: ShopifyExportLine): exportLine is ShopifyExportMedia {\n return [\"Video\", \"Model3d\", \"MediaImage\", \"ExternalVideo\"].includes(exportLine.__typename);\n}\n\nexport function isPublication(exportLine: ShopifyExportLine): exportLine is ShopifyExportPublication {\n return \"Publication\" === exportLine.__typename;\n}\n\nexport function isMetafield(exportLine: ShopifyExportLine): exportLine is ShopifyExportMetafield {\n return \"Metafield\" === exportLine.__typename;\n}\n\nexport { ProductStatus } from \"./graphql\";\n\nexport type ShopifyAppSubscription = NonNullable<\n ListAppSubscriptionsQuery[\"currentAppInstallation\"][\"activeSubscriptions\"][number]\n>\nexport type ShopifyAppPurchaseOneTime = NonNullable<\n ListAppPurchaseOneTimeQuery[\"currentAppInstallation\"][\"oneTimePurchases\"][\"edges\"][number][\"node\"]\n>\n\nexport interface ShopifyExportLine {\n __parentId?: string\n __typename: string\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactiveList } from "@usereactify/search-internals";
|
|
3
3
|
import { ReactifySearchProviderProps } from "../components";
|
|
4
|
-
import { Config, ConfigFilter,
|
|
4
|
+
import { Config, ConfigFilter, ConfigFilterFacet } from "../types";
|
|
5
5
|
export declare type GeneratePropsFilterGroupOptions = {
|
|
6
6
|
provider: ReactifySearchProviderProps;
|
|
7
7
|
config: Config;
|
|
@@ -114,7 +114,7 @@ export declare const getPropsFilterGroup: (options: GeneratePropsFilterGroupOpti
|
|
|
114
114
|
and: string[];
|
|
115
115
|
};
|
|
116
116
|
} | null)[];
|
|
117
|
-
export declare const getPropsFilterGroupOption: (options: GeneratePropsFilterGroupOptions, filterGroupOption:
|
|
117
|
+
export declare const getPropsFilterGroupOption: (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterFacet) => {
|
|
118
118
|
URLParams: boolean;
|
|
119
119
|
componentId: string;
|
|
120
120
|
dataField: string;
|
|
@@ -348,10 +348,10 @@ export declare const getPropsResults: (options: GeneratePropsFilterGroupOptions
|
|
|
348
348
|
renderNoResults: () => null;
|
|
349
349
|
source: typeof ReactiveList;
|
|
350
350
|
};
|
|
351
|
-
export declare const getPropsReact: (options: GeneratePropsFilterGroupOptions, filterGroupOption?:
|
|
351
|
+
export declare const getPropsReact: (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterFacet | undefined) => {
|
|
352
352
|
and: string[];
|
|
353
353
|
};
|
|
354
|
-
export declare const getPropsShared: (options: GeneratePropsFilterGroupOptions, filterGroupOption:
|
|
354
|
+
export declare const getPropsShared: (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterFacet) => {
|
|
355
355
|
URLParams: boolean;
|
|
356
356
|
componentId: string;
|
|
357
357
|
dataField: string;
|
|
@@ -425,7 +425,7 @@ export declare const getPropsShared: (options: GeneratePropsFilterGroupOptions,
|
|
|
425
425
|
and: string[];
|
|
426
426
|
};
|
|
427
427
|
};
|
|
428
|
-
export declare const getPropsFilterList: (filterGroupOption:
|
|
428
|
+
export declare const getPropsFilterList: (filterGroupOption: ConfigFilterFacet) => {
|
|
429
429
|
size: number | undefined;
|
|
430
430
|
queryFormat: "and" | "or";
|
|
431
431
|
showFilter: boolean;
|
|
@@ -434,7 +434,7 @@ export declare const getPropsFilterList: (filterGroupOption: ConfigFilterOption)
|
|
|
434
434
|
showRadio: boolean;
|
|
435
435
|
showCheckbox: boolean;
|
|
436
436
|
};
|
|
437
|
-
export declare const getPropsFilterRange: (filterGroupOption:
|
|
437
|
+
export declare const getPropsFilterRange: (filterGroupOption: ConfigFilterFacet) => {
|
|
438
438
|
queryFormat: "and" | "or";
|
|
439
439
|
showFilter: boolean;
|
|
440
440
|
showRadio: boolean;
|
|
@@ -445,4 +445,4 @@ export declare const getPropsFilterRange: (filterGroupOption: ConfigFilterOption
|
|
|
445
445
|
end: number;
|
|
446
446
|
}[];
|
|
447
447
|
};
|
|
448
|
-
export declare const getPropsFilterSlider: (filterGroupOption:
|
|
448
|
+
export declare const getPropsFilterSlider: (filterGroupOption: ConfigFilterFacet) => {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAAgI;AAChI,8CAAwE;AAExE,yCAAyC;AACzC,6CAAkF;AAClF,uCAA2C;AAC3C,oCAAqD;AAErD,sEAAqC;AAqB9B,MAAM,mBAAmB,GAAG,CAAC,OAAwC,EAAE,EAAE;;IAC9E,OAAO;QACL,GAAG,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,IAAA,iCAAyB,EAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC,mCAAI,EAAE;QACvH,GAAG,IAAA,uBAAe,EAAC,OAAO,CAAC;QAC3B,IAAA,uBAAe,EAAC,OAAO,CAAC;KACzB,CAAC;AACJ,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X,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,mBAAmB,uBAiB9B;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 \"@usereactify/search-internals\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterOption } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\nimport { replaceDocCountWithParent } from \"../hooks\";\n\nimport pkg from \"../../package.json\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsBase = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport const getPropsFilterGroup = (options: GeneratePropsFilterGroupOptions) => {\n return [\n ...options.filterGroup?.options.map((filterGroupOption) => getPropsFilterGroupOption(options, filterGroupOption)) ?? [],\n ...getPropsSensors(options),\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 getPropsSensors = (options: GeneratePropsSensorOptions) => {\n return [\n ...getPropsSensorCustom(options),\n getPropsSensorCollection(options),\n getPropsSensorPublished(options),\n getPropsSensorInventoryAvailable(options),\n getPropsSensorSort(options),\n ].filter(Boolean);\n}\n\nexport const getPropsSensorCustom = (options: GeneratePropsSensorOptions) => {\n const sensors = options.provider.mode === \"collection\" ? options.config.sensors.collection : options.config.sensors.search;\n\n return sensors.map((sensor, index) => ({\n componentId: `SensorCustom_${index}`,\n customQuery: () => sensor,\n source: ReactiveComponent,\n }));\n}\n\nexport const getPropsSensorCollection = (options: GeneratePropsSensorOptions) => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n \n return {\n componentId: \"SensorCollection\",\n customQuery: () => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n\n const conditions: Array<unknown> = [];\n\n if (options.provider.market) {\n conditions.push({\n nested: {\n path: \"curations\",\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n must: [{\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.markets.keyword\": options.provider.market,\n },\n },\n },\n }]\n },\n },\n },\n });\n }\n \n return {\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n },\n },\n } \n },\n source: ReactiveComponent,\n };\n}\n\nexport const getPropsSensorPublished = (options: GeneratePropsSensorOptions) => {\n return {\n componentId: \"SensorPublished\",\n customQuery: () => {\n if (options.provider.market) {\n return {\n query: {\n bool: {\n must:[{\n match: {\n markets: options.provider.market,\n },\n },{\n match: {\n published: true,\n },\n }]\n },\n },\n };\n }\n\n return {\n query: {\n match: {\n published: true,\n },\n },\n }\n },\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorInventoryAvailable = (options: GeneratePropsSensorOptions) => {\n const filterStack = getFilterStack(options);\n\n if (!filterStack || \"show_all\" === filterStack.inventoryVisibility) {\n return null;\n }\n\n return {\n componentId: \"SensorInventoryAvailable\",\n customQuery: () => ({\n query: {\n bool: {\n should: [\n {\n bool: {\n must: [\n {\n term: {\n type: {\n value: \"product\",\n },\n },\n },\n {\n nested: {\n path: \"variants\",\n query: {\n match: { \"variants.available\": true },\n },\n },\n },\n ],\n },\n },\n ...(options.provider.mode === \"instant-search\"\n ? []\n : [\n {\n term: {\n type: {\n value: \"callout\",\n },\n },\n },\n ]),\n ],\n minimum_should_match: \"1\",\n },\n },\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorSort = (options: GeneratePropsSensorOptions & { searchTerm?: string; sortOption?: string; }) => {\n const curation = getCuration(options);\n const sortOption = getSortOption(options);\n\n const sort = generateSortSort({\n provider: options.provider,\n config: options.config,\n curation: curation,\n sortOption: sortOption,\n });\n const query = generateSortQuery({\n sortOption: sortOption,\n curation: curation,\n });\n\n return {\n componentId: \"SensorSort\",\n customQuery: () => ({\n sort,\n query,\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsBase = (options: GeneratePropsBase) => {\n const props = {\n app: options.config.index,\n url: options.config.endpoint,\n credentials: options.provider.credentials,\n theme: options.provider.theme,\n initialState: options.provider.preload?.state,\n transformSort: () => {\n const sortSensor = getPropsSensorSort(options);\n const customQuery = sortSensor.customQuery();\n\n return customQuery.sort;\n },\n transformRequest: (request: any) => {\n if ((request.url as string).endsWith(\"?\")) {\n request.url = request.url.substring(0, request.url.length - 1);\n }\n return request;\n },\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n replaceDocCountWithParent(\n response?.aggregations?.reactivesearch_nested\n ?.reactify_nested_outer\n );\n }\n\n return response;\n },\n headers: {\n \"x-reactify-shop\": options.provider.shopifyPermanentDomain,\n \"x-reactify-mode\": options.provider.mode,\n \"x-reactify-client-id\": options.provider.clientId,\n \"x-reactify-client-version\": pkg.version,\n },\n };\n\n return props;\n}\n\nexport const getPropsResults = (options: GeneratePropsFilterGroupOptions & { scrollTarget?: string | Element | HTMLDocument; pageSize?: number; }) => {\n const includeFieldsProp = (() => {\n return [\n ...(options.provider.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.provider.excludeFields ?? [])];\n })();\n\n return {\n size: options.pageSize ?? options.filterGroup?.pageSize ?? 20,\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 // defaultQuery: () => ({\n // sort: [\"_score\"],\n // query: {\n // match_all: {}\n // }\n // })\n }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterOption) => {\n const sensorIds = SENSOR_IDS(options.provider.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.provider.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 = 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 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};"]}
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../src/utility/props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oEAAgI;AAChI,8CAAwE;AAExE,yCAAyC;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C,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB;SACnD,CAAC;IACJ,CAAC,CAAC,mCAAI,EAAE,CAAC;IAET,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;AAjBW,QAAA,mBAAmB,uBAiB9B;AAEK,MAAM,oBAAoB,GAAG,CAAC,iBAAoC,EAAE,EAAE;IAC3E,OAAO,EAAE,CAAA;AACX,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","sourcesContent":["import { MultiList, MultiRange, ReactiveComponent, ReactiveList, SingleList, SingleRange } from \"@usereactify/search-internals\";\nimport { ReactifySearchProviderProps, SENSOR_IDS } from \"../components\";\nimport { Config, ConfigFilter, ConfigFilterFacet } from \"../types\";\nimport { getCuration } from \"./curation\";\nimport { generateSortQuery, generateSortSort, getSortOption } from \"./sortOption\";\nimport { getFilterStack } from \"./filters\";\nimport { replaceDocCountWithParent } from \"../hooks\";\n\nimport pkg from \"../../package.json\";\n\nexport type GeneratePropsFilterGroupOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n filterGroup?: ConfigFilter;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsSensorOptions = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport type GeneratePropsBase = {\n provider: ReactifySearchProviderProps;\n config: Config;\n query?: Record<string, string>;\n};\n\nexport const getPropsFilterGroup = (options: GeneratePropsFilterGroupOptions) => {\n return [\n ...options.filterGroup?.options.map((filterGroupOption) => getPropsFilterGroupOption(options, filterGroupOption)) ?? [],\n ...getPropsSensors(options),\n getPropsResults(options),\n ];\n};\n\nexport const getPropsFilterGroupOption = (options: GeneratePropsFilterGroupOptions, filterGroupOption: ConfigFilterFacet) => {\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 getPropsSensors = (options: GeneratePropsSensorOptions) => {\n return [\n ...getPropsSensorCustom(options),\n getPropsSensorCollection(options),\n getPropsSensorPublished(options),\n getPropsSensorInventoryAvailable(options),\n getPropsSensorSort(options),\n ].filter(Boolean);\n}\n\nexport const getPropsSensorCustom = (options: GeneratePropsSensorOptions) => {\n const sensors = options.provider.mode === \"collection\" ? options.config.sensors.collection : options.config.sensors.search;\n\n return sensors.map((sensor, index) => ({\n componentId: `SensorCustom_${index}`,\n customQuery: () => sensor,\n source: ReactiveComponent,\n }));\n}\n\nexport const getPropsSensorCollection = (options: GeneratePropsSensorOptions) => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n \n return {\n componentId: \"SensorCollection\",\n customQuery: () => {\n if (options.provider.mode !== \"collection\") {\n return null;\n }\n\n const conditions: Array<unknown> = [];\n\n if (options.provider.market) {\n conditions.push({\n nested: {\n path: \"curations\",\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n must: [{\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.markets.keyword\": options.provider.market,\n },\n },\n },\n }]\n },\n },\n },\n });\n }\n \n return {\n query: {\n bool: {\n should: [\n {\n nested: {\n path: \"collections\",\n query: {\n term: {\n \"collections.handle.keyword\": options.provider.collectionHandle,\n },\n },\n },\n },\n {\n nested: {\n path: \"curations\",\n query: {\n term: {\n \"curations.collectionHandle.keyword\":\n options.provider.collectionHandle,\n },\n },\n },\n },\n ],\n },\n },\n } \n },\n source: ReactiveComponent,\n };\n}\n\nexport const getPropsSensorPublished = (options: GeneratePropsSensorOptions) => {\n return {\n componentId: \"SensorPublished\",\n customQuery: () => {\n if (options.provider.market) {\n return {\n query: {\n bool: {\n must:[{\n match: {\n markets: options.provider.market,\n },\n },{\n match: {\n published: true,\n },\n }]\n },\n },\n };\n }\n\n return {\n query: {\n match: {\n published: true,\n },\n },\n }\n },\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorInventoryAvailable = (options: GeneratePropsSensorOptions) => {\n const filterStack = getFilterStack(options);\n\n if (!filterStack || \"show_all\" === filterStack.inventoryVisibility) {\n return null;\n }\n\n return {\n componentId: \"SensorInventoryAvailable\",\n customQuery: () => ({\n query: {\n bool: {\n should: [\n {\n bool: {\n must: [\n {\n term: {\n type: {\n value: \"product\",\n },\n },\n },\n {\n nested: {\n path: \"variants\",\n query: {\n match: { \"variants.available\": true },\n },\n },\n },\n ],\n },\n },\n ...(options.provider.mode === \"instant-search\"\n ? []\n : [\n {\n term: {\n type: {\n value: \"callout\",\n },\n },\n },\n ]),\n ],\n minimum_should_match: \"1\",\n },\n },\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsSensorSort = (options: GeneratePropsSensorOptions & { searchTerm?: string; sortOption?: string; }) => {\n const curation = getCuration(options);\n const sortOption = getSortOption(options);\n\n const sort = generateSortSort({\n provider: options.provider,\n config: options.config,\n curation: curation,\n sortOption: sortOption,\n });\n const query = generateSortQuery({\n sortOption: sortOption,\n curation: curation,\n });\n\n return {\n componentId: \"SensorSort\",\n customQuery: () => ({\n sort,\n query,\n }),\n source: ReactiveComponent,\n }\n}\n\nexport const getPropsBase = (options: GeneratePropsBase) => {\n const props = {\n app: options.config.index,\n url: options.config.endpoint,\n credentials: options.provider.credentials,\n theme: options.provider.theme,\n initialState: options.provider.preload?.state,\n transformSort: () => {\n const sortSensor = getPropsSensorSort(options);\n const customQuery = sortSensor.customQuery();\n\n return customQuery.sort;\n },\n transformRequest: (request: any) => {\n if ((request.url as string).endsWith(\"?\")) {\n request.url = request.url.substring(0, request.url.length - 1);\n }\n return request;\n },\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n replaceDocCountWithParent(\n response?.aggregations?.reactivesearch_nested\n ?.reactify_nested_outer\n );\n }\n\n return response;\n },\n headers: {\n \"x-reactify-shop\": options.provider.shopifyPermanentDomain,\n \"x-reactify-mode\": options.provider.mode,\n \"x-reactify-client-id\": options.provider.clientId,\n \"x-reactify-client-version\": pkg.version,\n },\n };\n\n return props;\n}\n\nexport const getPropsResults = (options: GeneratePropsFilterGroupOptions & { scrollTarget?: string | Element | HTMLDocument; pageSize?: number; }) => {\n const includeFieldsProp = (() => {\n return [\n ...(options.provider.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.provider.excludeFields ?? [])];\n })();\n\n return {\n size: options.pageSize ?? options.filterGroup?.pageSize ?? 20,\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 // defaultQuery: () => ({\n // sort: [\"_score\"],\n // query: {\n // match_all: {}\n // }\n // })\n }\n}\n\nexport const getPropsReact = (options: GeneratePropsFilterGroupOptions, filterGroupOption?: ConfigFilterFacet) => {\n const sensorIds = SENSOR_IDS(options.provider.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.provider.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: ConfigFilterFacet) => {\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: ConfigFilterFacet) => {\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: ConfigFilterFacet) => {\n const data = 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 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: ConfigFilterFacet) => {\n return {}\n};"]}
|