@fast-simon/dashboard-utilities 1.0.98 → 1.0.102

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/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ import { useDragToSelect } from "./utils/useDragToSelect";
24
24
  import { CustomTagsFilters } from "./utils/customTagsFilters";
25
25
  import { useProductsPerRow } from "./utils/useProductsPerRow";
26
26
  import { LandingPage } from "./services/landingPage";
27
+ import { LandingPageTest } from "./services/landingPageTest";
27
28
  import { FullTextSearch } from "./services/search";
28
29
  import { getFormatProducts } from "./services/getFormatProducts";
29
30
  import { useFastState, useFastStateFunctions } from "./components/FastSimonApi";
@@ -38,4 +39,4 @@ import { getLSVectorSearchDict, getLSVectorSearchOn } from "./utils/getLSVectorS
38
39
  import { AutocompleteReasoningResponse } from "./@types/autocomplete";
39
40
  import { getUseCacheSetting, setUseCacheSetting } from "./utils/getCacheSettings";
40
41
  export type { MenuItemName, CustomClasses, SideMenuType, SideMenuItem, ProductLabelType, Banner, EditorProduct, IconProps, ServerProduct, FullTextServerResponseAll, QueryUnderstanding, smartCollectionsResults, AutocompleteReasoningResponse, FeaturedRanking };
41
- export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard, getLSVectorSearchOn, getLSVectorSearchDict, getUseCacheSetting, setUseCacheSetting };
42
+ export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, LandingPageTest, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard, getLSVectorSearchOn, getLSVectorSearchDict, getUseCacheSetting, setUseCacheSetting };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { useDragToSelect } from "./utils/useDragToSelect";
21
21
  import { CustomTagsFilters } from "./utils/customTagsFilters";
22
22
  import { useProductsPerRow } from "./utils/useProductsPerRow";
23
23
  import { LandingPage } from "./services/landingPage";
24
+ import { LandingPageTest } from "./services/landingPageTest";
24
25
  import { FullTextSearch } from "./services/search";
25
26
  import { getFormatProducts } from "./services/getFormatProducts";
26
27
  import { useFastState, useFastStateFunctions } from "./components/FastSimonApi";
@@ -29,5 +30,5 @@ import MainTheme from "./components/FastSimonApi";
29
30
  import { Products } from "./services/products";
30
31
  import { getLSVectorSearchDict, getLSVectorSearchOn } from "./utils/getLSVectorSearch";
31
32
  import { getUseCacheSetting, setUseCacheSetting } from "./utils/getCacheSettings";
32
- export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard, getLSVectorSearchOn, getLSVectorSearchDict, getUseCacheSetting, setUseCacheSetting };
33
+ export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, LandingPageTest, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard, getLSVectorSearchOn, getLSVectorSearchDict, getUseCacheSetting, setUseCacheSetting };
33
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAS,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAgB,eAAe,EAAC,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,qBAAqB,MAAM,oCAAoC,CAAA;AACtE,OAAO,kBAAkB,MAAM,iCAAiC,CAAA;AAChE,OAAO,iBAAiB,MAAM,4CAA4C,CAAA;AAC1E,OAAO,SAAS,MAAM,oCAAoC,CAAA;AAC1D,OAAO,YAAY,MAAM,wCAAwC,CAAA;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAA;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;AAI7E,OAAO,YAAY,MAAM,wCAAwC,CAAA;AACjE,OAAO,SAAS,MAAM,2BAA2B,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAC,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAErF,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAoB/E,OAAO,EACH,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EACnH,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAC3H,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAC,YAAY,EAAE,qBAAqB,EAAC,YAAY,EAAC,SAAS,EAC9H,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAC,qBAAqB,EACtI,kBAAkB,EAAE,kBAAkB,EACzC,CAAC","sourcesContent":["import {CustomClasses, SideMenuType, SideMenuItem, MenuItemName} from \"./@types/sideMenu\"\nimport {ProductLabelType} from \"./@types/productLabel\"\nimport {videoFormats, Banner} from \"./@types/banner\"\nimport {EditorProduct, isEditorProduct} from \"./@types/editorProduct\"\nimport {IconProps} from \"./@types/iconProps\"\n\nimport {BackOfficeFiltersIcon} from \"./icons/BackOfficeFiltersIcon\"\nimport {BannersIcon} from \"./icons/BannersIcon\"\nimport {HelpIcon} from \"./icons/HelpIcon\"\nimport {InStoreFiltersIcon} from \"./icons/InStoreFiltersIcon\"\nimport {PromoteIcon} from \"./icons/PromoteIcon\"\nimport {RemoveIcon} from \"./icons/RemoveIcon\"\nimport {RestoreIcon} from \"./icons/RestoreIcon\"\nimport {GeneralIcon} from \"./icons/GeneralIcon\"\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu'\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu'\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper'\nimport Droppable from './components/DragAndDrop/Droppable'\nimport ProductLabel from './components/ProductLabel/ProductLabel'\nimport {SortableItem} from './components/DragAndDrop/SortableItem'\nimport ProductGrid from \"./components/productGrid/ProductGrid\";\nimport SelectCard from \"./components/SelectCard/SelectCard\";\nimport RenderIfVisible from \"./components/RenderIfVisible\";\nimport {useDragToSelect} from \"./utils/useDragToSelect\";\nimport {CustomTagsFilters} from \"./utils/customTagsFilters\";\nimport {useProductsPerRow} from \"./utils/useProductsPerRow\";\nimport { LandingPage } from \"./services/landingPage\";\nimport { FullTextSearch } from \"./services/search\";\nimport { getFormatProducts } from \"./services/getFormatProducts\";\nimport {useFastState, useFastStateFunctions} from \"./components/FastSimonApi\"\nimport { ServerProduct } from \"./@types/product\"\nimport { FullTextServerResponseAll, QueryUnderstanding } from \"./@types/results\"\nimport { smartCollectionsResults } from \"./@types/categories\"\nimport FastSimonApi from \"./components/FastSimonApi/FastSimonApi\"\nimport MainTheme from \"./components/FastSimonApi\"\nimport { FeaturedRanking } from \"@fast-simon/utilities/lib/@types/product\"\nimport { Products } from \"./services/products\"\nimport {getLSVectorSearchDict, getLSVectorSearchOn } from \"./utils/getLSVectorSearch\"\nimport { AutocompleteReasoningResponse } from \"./@types/autocomplete\"\nimport {getUseCacheSetting, setUseCacheSetting} from \"./utils/getCacheSettings\"\n// export * from './components';\n\nexport type {\n MenuItemName,\n CustomClasses,\n SideMenuType,\n SideMenuItem,\n ProductLabelType,\n Banner,\n EditorProduct,\n IconProps,\n ServerProduct,\n FullTextServerResponseAll,\n QueryUnderstanding,\n smartCollectionsResults,\n AutocompleteReasoningResponse,\n FeaturedRanking\n};\n\nexport {\n BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible,\n useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon,\n RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct,useFastState, useFastStateFunctions,FastSimonApi,MainTheme,\n Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard ,getLSVectorSearchOn,getLSVectorSearchDict,\n getUseCacheSetting, setUseCacheSetting\n};"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAS,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAgB,eAAe,EAAC,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,qBAAqB,MAA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AQ,EAAE,kBAAkB,EAAE,WAAW,EAC3I,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAC,YAAY,EAAE,qBAAqB,EAAC,YAAY,EAAC,SAAS,EAC9H,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAC,qBAAqB,EACtI,kBAAkB,EAAE,kBAAkB,EACzC,CAAC","sourcesContent":["import {CustomClasses, SideMenuType, SideMenuItem, MenuItemName} from \"./@types/sideMenu\"\nimport {ProductLabelType} from \"./@types/productLabel\"\nimport {videoFormats, Banner} from \"./@types/banner\"\nimport {EditorProduct, isEditorProduct} from \"./@types/editorProduct\"\nimport {IconProps} from \"./@types/iconProps\"\n\nimport {BackOfficeFiltersIcon} from \"./icons/BackOfficeFiltersIcon\"\nimport {BannersIcon} from \"./icons/BannersIcon\"\nimport {HelpIcon} from \"./icons/HelpIcon\"\nimport {InStoreFiltersIcon} from \"./icons/InStoreFiltersIcon\"\nimport {PromoteIcon} from \"./icons/PromoteIcon\"\nimport {RemoveIcon} from \"./icons/RemoveIcon\"\nimport {RestoreIcon} from \"./icons/RestoreIcon\"\nimport {GeneralIcon} from \"./icons/GeneralIcon\"\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu'\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu'\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper'\nimport Droppable from './components/DragAndDrop/Droppable'\nimport ProductLabel from './components/ProductLabel/ProductLabel'\nimport {SortableItem} from './components/DragAndDrop/SortableItem'\nimport ProductGrid from \"./components/productGrid/ProductGrid\";\nimport SelectCard from \"./components/SelectCard/SelectCard\";\nimport RenderIfVisible from \"./components/RenderIfVisible\";\nimport {useDragToSelect} from \"./utils/useDragToSelect\";\nimport {CustomTagsFilters} from \"./utils/customTagsFilters\";\nimport {useProductsPerRow} from \"./utils/useProductsPerRow\";\nimport { LandingPage } from \"./services/landingPage\";\nimport { LandingPageTest } from \"./services/landingPageTest\";\nimport { FullTextSearch } from \"./services/search\";\nimport { getFormatProducts } from \"./services/getFormatProducts\";\nimport {useFastState, useFastStateFunctions} from \"./components/FastSimonApi\"\nimport { ServerProduct } from \"./@types/product\"\nimport { FullTextServerResponseAll, QueryUnderstanding } from \"./@types/results\"\nimport { smartCollectionsResults } from \"./@types/categories\"\nimport FastSimonApi from \"./components/FastSimonApi/FastSimonApi\"\nimport MainTheme from \"./components/FastSimonApi\"\nimport { FeaturedRanking } from \"@fast-simon/utilities/lib/@types/product\"\nimport { Products } from \"./services/products\"\nimport {getLSVectorSearchDict, getLSVectorSearchOn } from \"./utils/getLSVectorSearch\"\nimport { AutocompleteReasoningResponse } from \"./@types/autocomplete\"\nimport {getUseCacheSetting, setUseCacheSetting} from \"./utils/getCacheSettings\"\n// export * from './components';\n\nexport type {\n MenuItemName,\n CustomClasses,\n SideMenuType,\n SideMenuItem,\n ProductLabelType,\n Banner,\n EditorProduct,\n IconProps,\n ServerProduct,\n FullTextServerResponseAll,\n QueryUnderstanding,\n smartCollectionsResults,\n AutocompleteReasoningResponse,\n FeaturedRanking\n};\n\nexport {\n BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible,\n useDragToSelect, LandingPage,LandingPageTest, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon,\n RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct,useFastState, useFastStateFunctions,FastSimonApi,MainTheme,\n Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard ,getLSVectorSearchOn,getLSVectorSearchDict,\n getUseCacheSetting, setUseCacheSetting\n};"]}
@@ -0,0 +1,28 @@
1
+ import type { SortBy } from "../@types/sortBy";
2
+ import type { Narrow } from "@fast-simon/utilities";
3
+ import { ServerFacet } from "@fast-simon/utilities";
4
+ import { EditorProduct } from "../@types/editorProduct";
5
+ interface LandingPageResponse {
6
+ items: EditorProduct[];
7
+ facets_completed: boolean;
8
+ narrow?: Narrow[];
9
+ p: number;
10
+ total_p: number;
11
+ isp_quick_view_mode: number;
12
+ related_results: boolean;
13
+ total_results: number;
14
+ lp_slug: string;
15
+ title: string;
16
+ facets: ServerFacet[];
17
+ sort_by: SortBy;
18
+ avoid_tag_prefixes?: string;
19
+ }
20
+ export declare const LandingPageTest: {
21
+ landingPage: ({ uuid, storeID, landingPage, page, sortBy, facets, narrow, productsPerPage, withProductAttributes, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly, }: any) => Promise<{
22
+ data: LandingPageResponse;
23
+ getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
24
+ }>;
25
+ landingPageFacetsOnly: ({ uuid, storeID, landingPage, page, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes, visualMerchandising, merchandisingRules }: any) => Promise<import("@fast-simon/utilities").Facet[]>;
26
+ };
27
+ export declare const transformFacetsOnlyData: (r: ServerFacet[], avoidTagPrefixes?: string) => import("@fast-simon/utilities").Facet[];
28
+ export {};
@@ -0,0 +1,86 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { fastSimonGet } from "./API";
11
+ import { FacetsParser } from "@fast-simon/utilities";
12
+ //Todo: change the url back to- import.meta.env.VITE_SERVING_BASE_URL ?? "https://internal-v3joil6oqa-uc.a.run.app/search";
13
+ const BASE_URL = "https://ys1testlpmerch---internal-v3joil6oqa-uc.a.run.app/search";
14
+ export const LandingPageTest = {
15
+ landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, idsOnly, }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const params = {
17
+ UUID: uuid,
18
+ store_id: storeID,
19
+ facets_required: facets ? 1 : 0,
20
+ products_per_page: productsPerPage,
21
+ narrow: JSON.stringify(narrow),
22
+ lp: landingPage,
23
+ page_num: page,
24
+ type: type,
25
+ with_product_attributes: withProductAttributes,
26
+ search_within_search: searchWithinResultsQuery
27
+ ? searchWithinResultsQuery
28
+ : undefined,
29
+ visual_merchandising: type == 0
30
+ ? JSON.stringify(visualMerchandising)
31
+ .replaceAll('"[', "[")
32
+ .replaceAll(']"', "]")
33
+ : undefined,
34
+ m: 1,
35
+ merchandising_rules: type == 1 ? JSON.stringify(merchandisingRules) : undefined,
36
+ ids_only: idsOnly ? 1 : undefined,
37
+ };
38
+ const res = yield fastSimonGet(BASE_URL, "landing_page_editor", params);
39
+ return {
40
+ data: res,
41
+ getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
42
+ return (res === null || res === void 0 ? void 0 : res.facets_completed)
43
+ ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
44
+ : yield LandingPageTest.landingPageFacetsOnly({
45
+ uuid,
46
+ storeID,
47
+ landingPage,
48
+ page,
49
+ narrow,
50
+ type,
51
+ productsPerPage,
52
+ searchWithinResultsQuery,
53
+ withProductAttributes,
54
+ visualMerchandising,
55
+ merchandisingRules,
56
+ });
57
+ }),
58
+ };
59
+ }),
60
+ landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules }) => __awaiter(void 0, void 0, void 0, function* () {
61
+ const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
62
+ UUID: uuid,
63
+ store_id: storeID,
64
+ facets_required: 2,
65
+ products_per_page: productsPerPage,
66
+ narrow: JSON.stringify(narrow),
67
+ type: type,
68
+ lp: landingPage,
69
+ page_num: page !== null && page !== void 0 ? page : 1,
70
+ with_product_attributes: withProductAttributes,
71
+ search_within_search: searchWithinResultsQuery
72
+ ? searchWithinResultsQuery
73
+ : undefined,
74
+ visual_merchandising: JSON.stringify(visualMerchandising)
75
+ .replaceAll('"[', "[")
76
+ .replaceAll(']"', "]"),
77
+ merchandising_rules: merchandisingRules
78
+ ? JSON.stringify(merchandisingRules)
79
+ : undefined,
80
+ m: 1,
81
+ });
82
+ return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
83
+ }),
84
+ };
85
+ export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
86
+ //# sourceMappingURL=landingPageTest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landingPageTest.js","sourceRoot":"","sources":["../../src/services/landingPageTest.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAmD/D,2HAA2H;AAC3H,MAAM,QAAQ,GAAE,kEAAkE,CAAC;AAiBnF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,WAAW,EAAE,CAAO,EAChB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,IAAI,GAAG,CAAC,EACR,MAAM,GAAG,WAAW,EACpB,MAAM,GAAG,IAAI,EACb,MAAM,EACN,eAAe,EACf,qBAAqB,GAAG,SAAS,EACjC,wBAAwB,EACxB,IAAI,EACJ,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,GACL,EAAE,EAAE;QACN,MAAM,MAAM,GAAwB;YAChC,IAAI,EAAE,IAAI;YACV,QAAQ,EAAE,OAAO;YACjB,eAAe,EAA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,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC","sourcesContent":["import type {SortBy} from \"../@types/sortBy\";\nimport type {Narrow, ServerNarrow} from \"@fast-simon/utilities\";\nimport {API, fastSimonGet} from \"./API\";\nimport {FacetsParser, ServerFacet} from \"@fast-simon/utilities\"\nimport {AncestorCategory} from \"../@types/categories\";\nimport {EditorProduct} from \"../@types/editorProduct\";\ninterface LandingPageRequest {\n uuid: string;\n storeID: string;\n landingPage: string\n type: number\n page?: number\n sortBy?: SortBy\n facets?: boolean\n narrow?: Narrow\n productsPerPage?: number\n withProductAttributes?: boolean\n searchWithinResultsQuery?: string\n idsOnly?: boolean\n}\n\ninterface LandingPageFacetsOnly extends Omit<LandingPageRequest, \"facets\"> {\n avoid_tag_prefixes?: string\n}\n\ninterface LandingPageServerResponseFacetsOnly {\n total_results: number\n term: string\n narrow?: ServerNarrow\n facets_completed: true\n facets: ServerFacet[],\n}\n\ninterface LandingPageServerResponseAll {\n items: EditorProduct[]\n alternatives?: string[]\n facets_completed: boolean\n narrow?: ServerNarrow[]\n p: number\n total_p: number\n total_results: number\n term: string\n lp_slug: string\n title: string\n index_page: number\n banner_html: string\n banner_html_mobile: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n cms_number_found?: number\n within_search_results_for?: string,\n ancestor_categories?: AncestorCategory[]\n}\n//Todo: change the url back to- import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\nconst BASE_URL =\"https://ys1testlpmerch---internal-v3joil6oqa-uc.a.run.app/search\";\n\ninterface LandingPageResponse {\n items: EditorProduct[]\n facets_completed: boolean\n narrow?: Narrow[]\n p: number\n total_p: number\n isp_quick_view_mode: number\n related_results: boolean\n total_results: number\n lp_slug: string\n title: string\n facets: ServerFacet[]\n sort_by: SortBy\n avoid_tag_prefixes?: string\n}\nexport const LandingPageTest = {\n landingPage: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n sortBy = \"relevency\",\n facets = true,\n narrow,\n productsPerPage,\n withProductAttributes = undefined,\n searchWithinResultsQuery,\n type,\n visualMerchandising,\n merchandisingRules,\n idsOnly,\n }: any) => {\n const params: Record<string, any> = {\n UUID: uuid,\n store_id: storeID,\n facets_required: facets ? 1 : 0,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n lp: landingPage,\n page_num: page,\n type: type,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising:\n type == 0\n ? JSON.stringify(visualMerchandising)\n .replaceAll('\"[', \"[\")\n .replaceAll(']\"', \"]\")\n : undefined,\n m: 1,\n merchandising_rules:\n type == 1 ? JSON.stringify(merchandisingRules) : undefined,\n ids_only: idsOnly ? 1 : undefined,\n };\n const res = await fastSimonGet<LandingPageResponse>(\n BASE_URL,\n \"landing_page_editor\",\n params\n );\n return {\n data: res,\n getFacets: async () =>\n res?.facets_completed\n ? transformFacetsOnlyData(\n res.facets,\n res.avoid_tag_prefixes\n )\n : await LandingPageTest.landingPageFacetsOnly({\n uuid,\n storeID,\n landingPage,\n page,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes,\n visualMerchandising,\n merchandisingRules,\n }),\n };\n },\n\n landingPageFacetsOnly: async ({\n uuid,\n storeID,\n landingPage,\n page = 1,\n narrow,\n type,\n productsPerPage,\n searchWithinResultsQuery,\n withProductAttributes = false,\n visualMerchandising,\n merchandisingRules\n }: any) => {\n const data = await fastSimonGet<LandingPageServerResponseAll>(\n BASE_URL,\n \"landing_page_editor\",\n {\n UUID: uuid,\n store_id: storeID,\n facets_required: 2,\n products_per_page: productsPerPage,\n narrow: JSON.stringify(narrow),\n type: type,\n lp: landingPage,\n page_num: page ?? 1,\n with_product_attributes: withProductAttributes,\n search_within_search: searchWithinResultsQuery\n ? searchWithinResultsQuery\n : undefined,\n visual_merchandising:\n JSON.stringify(visualMerchandising)\n .replaceAll('\"[', \"[\")\n .replaceAll(']\"', \"]\"),\n merchandising_rules: merchandisingRules\n ? JSON.stringify(merchandisingRules)\n : undefined,\n m: 1,\n }\n );\n return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);\n },\n};\n\nexport const transformFacetsOnlyData = (r: ServerFacet[], avoidTagPrefixes?: string) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(\",\") : []);"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-simon/dashboard-utilities",
3
- "version": "1.0.98",
3
+ "version": "1.0.102",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "preview": "vite preview",