@fast-simon/dashboard-utilities 1.0.96 → 1.0.98
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/@types/autocomplete.d.ts +58 -58
- package/dist/@types/autocomplete.js +1 -1
- package/dist/@types/autocomplete.js.map +1 -1
- package/dist/@types/banner.d.ts +7 -7
- package/dist/@types/banner.js +1 -1
- package/dist/@types/banner.js.map +1 -1
- package/dist/@types/categories.d.ts +113 -113
- package/dist/@types/categories.js +1 -1
- package/dist/@types/categories.js.map +1 -1
- package/dist/@types/categoriesNavigation.d.ts +27 -27
- package/dist/@types/categoriesNavigation.js +1 -1
- package/dist/@types/categoriesNavigation.js.map +1 -1
- package/dist/@types/context.d.ts +49 -49
- package/dist/@types/context.js +1 -1
- package/dist/@types/context.js.map +1 -1
- package/dist/@types/currency.d.ts +1 -1
- package/dist/@types/currency.js +1 -1
- package/dist/@types/currency.js.map +1 -1
- package/dist/@types/editorProduct.d.ts +26 -26
- package/dist/@types/editorProduct.js +5 -5
- package/dist/@types/editorProduct.js.map +1 -1
- package/dist/@types/facets.d.ts +59 -59
- package/dist/@types/facets.js +18 -18
- package/dist/@types/facets.js.map +1 -1
- package/dist/@types/iconProps.d.ts +9 -9
- package/dist/@types/iconProps.js +1 -1
- package/dist/@types/iconProps.js.map +1 -1
- package/dist/@types/narrow.d.ts +7 -7
- package/dist/@types/narrow.js +1 -1
- package/dist/@types/narrow.js.map +1 -1
- package/dist/@types/product.d.ts +160 -160
- package/dist/@types/product.js +7 -7
- package/dist/@types/product.js.map +1 -1
- package/dist/@types/productLabel.d.ts +1 -1
- package/dist/@types/productLabel.js +1 -1
- package/dist/@types/promoTile.d.ts +11 -11
- package/dist/@types/promoTile.js +1 -1
- package/dist/@types/promoTile.js.map +1 -1
- package/dist/@types/results.d.ts +142 -142
- package/dist/@types/results.js +1 -1
- package/dist/@types/results.js.map +1 -1
- package/dist/@types/sideMenu.d.ts +19 -19
- package/dist/@types/sideMenu.js +1 -1
- package/dist/@types/sideMenu.js.map +1 -1
- package/dist/@types/sortBy.d.ts +3 -3
- package/dist/@types/sortBy.js +1 -1
- package/dist/@types/sortBy.js.map +1 -1
- package/dist/@types/widget.d.ts +8 -8
- package/dist/@types/widget.js +1 -1
- package/dist/@types/widget.js.map +1 -1
- package/dist/App.d.ts +3 -3
- package/dist/App.js +14 -14
- package/dist/App.js.map +1 -1
- package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.d.ts +9 -9
- package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js +73 -73
- package/dist/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js.map +1 -1
- package/dist/components/BackOfficeFiltersMenu/index.d.ts +1 -1
- package/dist/components/BackOfficeFiltersMenu/index.js +1 -1
- package/dist/components/BackOfficeFiltersMenu/index.js.map +1 -1
- package/dist/components/BackOfficeFiltersMenu/styles.module.css +9 -9
- package/dist/components/BackOfficeFiltersMenu/utils.d.ts +7 -7
- package/dist/components/BackOfficeFiltersMenu/utils.js +238 -238
- package/dist/components/BackOfficeFiltersMenu/utils.js.map +1 -1
- package/dist/components/CheckboxFilter/Checkbox/Checkbox.d.ts +10 -10
- package/dist/components/CheckboxFilter/Checkbox/Checkbox.js +6 -6
- package/dist/components/CheckboxFilter/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/CheckboxFilter/CheckboxFilter.d.ts +6 -6
- package/dist/components/CheckboxFilter/CheckboxFilter.js +8 -8
- package/dist/components/CheckboxFilter/CheckboxFilter.js.map +1 -1
- package/dist/components/CheckboxFilter/styles.module.css +4 -4
- package/dist/components/DragAndDrop/DndContextWrapper.d.ts +19 -19
- package/dist/components/DragAndDrop/DndContextWrapper.js +30 -30
- package/dist/components/DragAndDrop/DndContextWrapper.js.map +1 -1
- package/dist/components/DragAndDrop/Droppable.d.ts +7 -7
- package/dist/components/DragAndDrop/Droppable.js +9 -9
- package/dist/components/DragAndDrop/Droppable.js.map +1 -1
- package/dist/components/DragAndDrop/SortableItem.d.ts +13 -13
- package/dist/components/DragAndDrop/SortableItem.js +38 -38
- package/dist/components/DragAndDrop/SortableItem.js.map +1 -1
- package/dist/components/DragAndDrop/styles.module.css +15 -15
- package/dist/components/FacetItem/FacetItem.d.ts +13 -13
- package/dist/components/FacetItem/FacetItem.js +39 -39
- package/dist/components/FacetItem/FacetItem.js.map +1 -1
- package/dist/components/FacetItem/styles.module.css +54 -54
- package/dist/components/FastSimonApi/FastSimonApi.d.ts +39 -39
- package/dist/components/FastSimonApi/FastSimonApi.js +605 -605
- package/dist/components/FastSimonApi/FastSimonApi.js.map +1 -1
- package/dist/components/FastSimonApi/context.d.ts +62 -62
- package/dist/components/FastSimonApi/context.js +9 -9
- package/dist/components/FastSimonApi/context.js.map +1 -1
- package/dist/components/FastSimonApi/index.d.ts +3 -3
- package/dist/components/FastSimonApi/index.js +2 -2
- package/dist/components/FastSimonApi/index.js.map +1 -1
- package/dist/components/FastSimonApi/reducer.d.ts +458 -458
- package/dist/components/FastSimonApi/reducer.js +76 -76
- package/dist/components/FastSimonApi/reducer.js.map +1 -1
- package/dist/components/FromToFilter/From/From.d.ts +17 -17
- package/dist/components/FromToFilter/From/From.js +21 -21
- package/dist/components/FromToFilter/From/From.js.map +1 -1
- package/dist/components/FromToFilter/FromToFilter.d.ts +14 -14
- package/dist/components/FromToFilter/FromToFilter.js +57 -57
- package/dist/components/FromToFilter/FromToFilter.js.map +1 -1
- package/dist/components/FromToFilter/To/To.d.ts +18 -18
- package/dist/components/FromToFilter/To/To.js +22 -22
- package/dist/components/FromToFilter/To/To.js.map +1 -1
- package/dist/components/FromToFilter/styles.module.css +33 -33
- package/dist/components/FromToFilter/utils.d.ts +25 -25
- package/dist/components/FromToFilter/utils.js +6 -6
- package/dist/components/FromToFilter/utils.js.map +1 -1
- package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.d.ts +10 -10
- package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.js +33 -33
- package/dist/components/InStoreFiltersMenu/InStoreFiltersMenu.js.map +1 -1
- package/dist/components/InStoreFiltersMenu/index.d.ts +1 -1
- package/dist/components/InStoreFiltersMenu/index.js +1 -1
- package/dist/components/InStoreFiltersMenu/index.js.map +1 -1
- package/dist/components/InStoreFiltersMenu/styles.module.css +9 -9
- package/dist/components/Input/Input.d.ts +22 -22
- package/dist/components/Input/Input.js +48 -48
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Input/styles.module.css +2 -2
- package/dist/components/LastReceivedDateFilter/LastReceivedDate.d.ts +9 -9
- package/dist/components/LastReceivedDateFilter/LastReceivedDate.js +87 -87
- package/dist/components/LastReceivedDateFilter/LastReceivedDate.js.map +1 -1
- package/dist/components/LastReceivedDateFilter/styles.module.css +40 -40
- package/dist/components/LastReceivedDateFilter/utils.d.ts +3 -3
- package/dist/components/LastReceivedDateFilter/utils.js +42 -42
- package/dist/components/LastReceivedDateFilter/utils.js.map +1 -1
- package/dist/components/ProductLabel/ProductLabel.d.ts +11 -11
- package/dist/components/ProductLabel/ProductLabel.js +10 -10
- package/dist/components/ProductLabel/ProductLabel.js.map +1 -1
- package/dist/components/ProductLabel/index.d.ts +1 -1
- package/dist/components/ProductLabel/index.js +1 -1
- package/dist/components/ProductLabel/index.js.map +1 -1
- package/dist/components/ProductLabel/styles.module.css +41 -41
- package/dist/components/ProductLabel/utils.d.ts +8 -8
- package/dist/components/ProductLabel/utils.js +8 -8
- package/dist/components/ProductLabel/utils.js.map +1 -1
- package/dist/components/RadioFilter/Radio/Radio.d.ts +10 -10
- package/dist/components/RadioFilter/Radio/Radio.js +6 -6
- package/dist/components/RadioFilter/Radio/Radio.js.map +1 -1
- package/dist/components/RadioFilter/RadioFilter.d.ts +9 -9
- package/dist/components/RadioFilter/RadioFilter.js +44 -44
- package/dist/components/RadioFilter/RadioFilter.js.map +1 -1
- package/dist/components/RadioFilter/styles.module.css +22 -22
- package/dist/components/RadioFilter/utils.d.ts +1 -1
- package/dist/components/RadioFilter/utils.js +7 -7
- package/dist/components/RadioFilter/utils.js.map +1 -1
- package/dist/components/ReactDatePicker/ReactDatePicker.d.ts +11 -11
- package/dist/components/ReactDatePicker/ReactDatePicker.js +15 -15
- package/dist/components/ReactDatePicker/ReactDatePicker.js.map +1 -1
- package/dist/components/ReactDatePicker/index.d.ts +1 -1
- package/dist/components/ReactDatePicker/index.js +1 -1
- package/dist/components/ReactDatePicker/index.js.map +1 -1
- package/dist/components/ReactDatePicker/styles.module.css +2 -2
- package/dist/components/RenderIfVisible/RenderIfVisible.d.ts +12 -12
- package/dist/components/RenderIfVisible/RenderIfVisible.js +58 -58
- package/dist/components/RenderIfVisible/RenderIfVisible.js.map +1 -1
- package/dist/components/RenderIfVisible/index.d.ts +1 -1
- package/dist/components/RenderIfVisible/index.js +1 -1
- package/dist/components/RenderIfVisible/index.js.map +1 -1
- package/dist/components/ScrollToTop/ScrollToTop.d.ts +6 -6
- package/dist/components/ScrollToTop/ScrollToTop.js +27 -27
- package/dist/components/ScrollToTop/ScrollToTop.js.map +1 -1
- package/dist/components/ScrollToTop/styles.module.css +18 -18
- package/dist/components/SelectCard/SelectCard.d.ts +5 -5
- package/dist/components/SelectCard/SelectCard.js +6 -6
- package/dist/components/SelectCard/SelectCard.js.map +1 -1
- package/dist/components/SelectCard/index.d.ts +1 -1
- package/dist/components/SelectCard/index.js +1 -1
- package/dist/components/SelectCard/index.js.map +1 -1
- package/dist/components/SelectCard/styles.module.css +20 -20
- package/dist/components/SingleFilter/SingleFilter.d.ts +11 -11
- package/dist/components/SingleFilter/SingleFilter.js +89 -89
- package/dist/components/SingleFilter/SingleFilter.js.map +1 -1
- package/dist/components/SingleFilter/styles.module.css +23 -23
- package/dist/components/SingleFilter/utils.d.ts +3 -3
- package/dist/components/SingleFilter/utils.js +41 -41
- package/dist/components/SingleFilter/utils.js.map +1 -1
- package/dist/components/SliderFilter/SliderFilter.d.ts +20 -20
- package/dist/components/SliderFilter/SliderFilter.js +45 -45
- package/dist/components/SliderFilter/SliderFilter.js.map +1 -1
- package/dist/components/SliderFilter/index.d.ts +1 -1
- package/dist/components/SliderFilter/index.js +1 -1
- package/dist/components/SliderFilter/index.js.map +1 -1
- package/dist/components/SliderFilter/styles.module.css +15 -15
- package/dist/components/Tooltip/Tooltip.d.ts +8 -8
- package/dist/components/Tooltip/Tooltip.js +8 -8
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/styles.module.css +33 -33
- package/dist/components/common.d.ts +23 -23
- package/dist/components/common.js +30 -30
- package/dist/components/common.js.map +1 -1
- package/dist/components/productGrid/ProductGrid.d.ts +11 -11
- package/dist/components/productGrid/ProductGrid.js +32 -32
- package/dist/components/productGrid/ProductGrid.js.map +1 -1
- package/dist/components/productGrid/index.d.ts +1 -1
- package/dist/components/productGrid/index.js +1 -1
- package/dist/components/productGrid/index.js.map +1 -1
- package/dist/components/productGrid/styles.module.css +25 -25
- package/dist/icons/BackOfficeFiltersIcon.d.ts +2 -2
- package/dist/icons/BackOfficeFiltersIcon.js +6 -6
- package/dist/icons/BackOfficeFiltersIcon.js.map +1 -1
- package/dist/icons/BannersIcon.d.ts +2 -2
- package/dist/icons/BannersIcon.js +6 -6
- package/dist/icons/BannersIcon.js.map +1 -1
- package/dist/icons/GeneralIcon.d.ts +2 -2
- package/dist/icons/GeneralIcon.js +6 -6
- package/dist/icons/GeneralIcon.js.map +1 -1
- package/dist/icons/HelpIcon.d.ts +7 -7
- package/dist/icons/HelpIcon.js +4 -4
- package/dist/icons/HelpIcon.js.map +1 -1
- package/dist/icons/InStoreFiltersIcon.d.ts +2 -2
- package/dist/icons/InStoreFiltersIcon.js +6 -6
- package/dist/icons/InStoreFiltersIcon.js.map +1 -1
- package/dist/icons/PromoteIcon.d.ts +2 -2
- package/dist/icons/PromoteIcon.js +6 -6
- package/dist/icons/PromoteIcon.js.map +1 -1
- package/dist/icons/RemoveIcon.d.ts +2 -2
- package/dist/icons/RemoveIcon.js +6 -6
- package/dist/icons/RemoveIcon.js.map +1 -1
- package/dist/icons/RestoreIcon.d.ts +2 -2
- package/dist/icons/RestoreIcon.js +6 -6
- package/dist/icons/RestoreIcon.js.map +1 -1
- package/dist/icons/styles.module.css +60 -60
- package/dist/index.d.ts +41 -41
- package/dist/index.js +32 -32
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +5 -5
- package/dist/main.js.map +1 -1
- package/dist/services/API.d.ts +21 -21
- package/dist/services/API.js +49 -49
- package/dist/services/API.js.map +1 -1
- package/dist/services/autocomplete.d.ts +4 -4
- package/dist/services/autocomplete.js +25 -25
- package/dist/services/autocomplete.js.map +1 -1
- package/dist/services/getFormatProducts.d.ts +13 -13
- package/dist/services/getFormatProducts.js +43 -43
- package/dist/services/getFormatProducts.js.map +1 -1
- package/dist/services/landingPage.d.ts +28 -28
- package/dist/services/landingPage.js +86 -86
- package/dist/services/landingPage.js.map +1 -1
- package/dist/services/products.d.ts +9 -9
- package/dist/services/products.js +30 -30
- package/dist/services/products.js.map +1 -1
- package/dist/services/search.d.ts +13 -13
- package/dist/services/search.js +113 -113
- package/dist/services/search.js.map +1 -1
- package/dist/services/smartCollections.d.ts +5 -5
- package/dist/services/smartCollections.js +44 -44
- package/dist/services/smartCollections.js.map +1 -1
- package/dist/utils/customTagsFilters.d.ts +4 -4
- package/dist/utils/customTagsFilters.js +9 -9
- package/dist/utils/customTagsFilters.js.map +1 -1
- package/dist/utils/getCacheSettings.d.ts +16 -16
- package/dist/utils/getCacheSettings.js +25 -25
- package/dist/utils/getCacheSettings.js.map +1 -1
- package/dist/utils/getInternalURL.d.ts +1 -1
- package/dist/utils/getInternalURL.js +7 -7
- package/dist/utils/getInternalURL.js.map +1 -1
- package/dist/utils/getLSVectorSearch.d.ts +4 -4
- package/dist/utils/getLSVectorSearch.js +8 -8
- package/dist/utils/getLSVectorSearch.js.map +1 -1
- package/dist/utils/useDragToSelect.d.ts +13 -13
- package/dist/utils/useDragToSelect.js +172 -172
- package/dist/utils/useDragToSelect.js.map +1 -1
- package/dist/utils/useProductsPerRow.d.ts +3 -3
- package/dist/utils/useProductsPerRow.js +18 -18
- package/dist/utils/useProductsPerRow.js.map +1 -1
- package/package.json +64 -64
- package/dist/components/CheckboxFilter/Checkbox/styles.module.css +0 -143
- package/dist/components/FromToFilter/From/styles.module.css +0 -9
- package/dist/components/FromToFilter/To/styles.module.css +0 -9
- package/dist/components/RadioFilter/Radio/styles.module.css +0 -145
|
@@ -1,87 +1,87 @@
|
|
|
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
|
-
var _a;
|
|
11
|
-
import { fastSimonGet } from "./API";
|
|
12
|
-
import { FacetsParser } from "@fast-simon/utilities";
|
|
13
|
-
const BASE_URL = (_a = import.meta.env.VITE_SERVING_BASE_URL) !== null && _a !== void 0 ? _a : "https://internal-v3joil6oqa-uc.a.run.app/search";
|
|
14
|
-
export const LandingPage = {
|
|
15
|
-
landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, }) => __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
|
-
};
|
|
37
|
-
const res = yield fastSimonGet(BASE_URL, "landing_page_editor", params);
|
|
38
|
-
return {
|
|
39
|
-
data: res,
|
|
40
|
-
getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
return (res === null || res === void 0 ? void 0 : res.facets_completed)
|
|
42
|
-
? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
|
|
43
|
-
: yield LandingPage.landingPageFacetsOnly({
|
|
44
|
-
uuid,
|
|
45
|
-
storeID,
|
|
46
|
-
landingPage,
|
|
47
|
-
page,
|
|
48
|
-
narrow,
|
|
49
|
-
type,
|
|
50
|
-
productsPerPage,
|
|
51
|
-
searchWithinResultsQuery,
|
|
52
|
-
withProductAttributes,
|
|
53
|
-
visualMerchandising,
|
|
54
|
-
merchandisingRules,
|
|
55
|
-
});
|
|
56
|
-
}),
|
|
57
|
-
};
|
|
58
|
-
}),
|
|
59
|
-
landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
|
|
61
|
-
UUID: uuid,
|
|
62
|
-
store_id: storeID,
|
|
63
|
-
facets_required: 2,
|
|
64
|
-
products_per_page: productsPerPage,
|
|
65
|
-
narrow: JSON.stringify(narrow),
|
|
66
|
-
type: type,
|
|
67
|
-
lp: landingPage,
|
|
68
|
-
page_num: page !== null && page !== void 0 ? page : 1,
|
|
69
|
-
with_product_attributes: withProductAttributes,
|
|
70
|
-
search_within_search: searchWithinResultsQuery
|
|
71
|
-
? searchWithinResultsQuery
|
|
72
|
-
: undefined,
|
|
73
|
-
visual_merchandising: type == 0
|
|
74
|
-
? JSON.stringify(visualMerchandising)
|
|
75
|
-
.replaceAll('"[', "[")
|
|
76
|
-
.replaceAll(']"', "]")
|
|
77
|
-
: undefined,
|
|
78
|
-
merchandising_rules: merchandisingRules
|
|
79
|
-
? JSON.stringify(merchandisingRules)
|
|
80
|
-
: undefined,
|
|
81
|
-
m: 1,
|
|
82
|
-
});
|
|
83
|
-
return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
|
|
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
|
+
var _a;
|
|
11
|
+
import { fastSimonGet } from "./API";
|
|
12
|
+
import { FacetsParser } from "@fast-simon/utilities";
|
|
13
|
+
const BASE_URL = (_a = import.meta.env.VITE_SERVING_BASE_URL) !== null && _a !== void 0 ? _a : "https://internal-v3joil6oqa-uc.a.run.app/search";
|
|
14
|
+
export const LandingPage = {
|
|
15
|
+
landingPage: ({ uuid, storeID, landingPage, page = 1, sortBy = "relevency", facets = true, narrow, productsPerPage, withProductAttributes = undefined, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, }) => __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
|
+
};
|
|
37
|
+
const res = yield fastSimonGet(BASE_URL, "landing_page_editor", params);
|
|
38
|
+
return {
|
|
39
|
+
data: res,
|
|
40
|
+
getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
return (res === null || res === void 0 ? void 0 : res.facets_completed)
|
|
42
|
+
? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
|
|
43
|
+
: yield LandingPage.landingPageFacetsOnly({
|
|
44
|
+
uuid,
|
|
45
|
+
storeID,
|
|
46
|
+
landingPage,
|
|
47
|
+
page,
|
|
48
|
+
narrow,
|
|
49
|
+
type,
|
|
50
|
+
productsPerPage,
|
|
51
|
+
searchWithinResultsQuery,
|
|
52
|
+
withProductAttributes,
|
|
53
|
+
visualMerchandising,
|
|
54
|
+
merchandisingRules,
|
|
55
|
+
});
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
}),
|
|
59
|
+
landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
|
|
61
|
+
UUID: uuid,
|
|
62
|
+
store_id: storeID,
|
|
63
|
+
facets_required: 2,
|
|
64
|
+
products_per_page: productsPerPage,
|
|
65
|
+
narrow: JSON.stringify(narrow),
|
|
66
|
+
type: type,
|
|
67
|
+
lp: landingPage,
|
|
68
|
+
page_num: page !== null && page !== void 0 ? page : 1,
|
|
69
|
+
with_product_attributes: withProductAttributes,
|
|
70
|
+
search_within_search: searchWithinResultsQuery
|
|
71
|
+
? searchWithinResultsQuery
|
|
72
|
+
: undefined,
|
|
73
|
+
visual_merchandising: type == 0
|
|
74
|
+
? JSON.stringify(visualMerchandising)
|
|
75
|
+
.replaceAll('"[', "[")
|
|
76
|
+
.replaceAll(']"', "]")
|
|
77
|
+
: undefined,
|
|
78
|
+
merchandising_rules: merchandisingRules
|
|
79
|
+
? JSON.stringify(merchandisingRules)
|
|
80
|
+
: undefined,
|
|
81
|
+
m: 1,
|
|
82
|
+
});
|
|
83
|
+
return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
|
|
87
87
|
//# sourceMappingURL=landingPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-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AAoB,EAAE,wBAAwB;gBAC1C,CAAC,CAAC,wBAAwB;gBAC1B,CAAC,CAAC,SAAS;YACf,oBAAoB,EAChB,IAAI,IAAI,CAAC;gBACL,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,mBAAmB,CAAC;qBAC9B,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;qBACrB,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;gBAC5B,CAAC,CAAC,SAAS;YACnB,mBAAmB,EAAE,kBAAkB;gBACnC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;gBACpC,CAAC,CAAC,SAAS;YACf,CAAC,EAAE,CAAC;SACP,CACJ,CAAC;QACF,OAAO,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzE,CAAC,CAAA;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAgB,EAAE,gBAAyB,EAAE,EAAE,CAAC,IAAI,YAAY,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\";\
|
|
1
|
+
{"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAM,YAAY,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAmD/D,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,mCAAI,iDAAiD,CAAC;AAkB5G,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,WAAW,EAAE,CAAO,EAChB,IAAI,EACJ,OAAO,EACP,WAAW,EACX,IAAI,GAAG,CAAC,EACR,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AC,EAAE,CAAC;SACP,CACJ,CAAC;QACF,OAAO,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzE,CAAC,CAAA;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAgB,EAAE,gBAAyB,EAAE,EAAE,CAAC,IAAI,YAAY,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}\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\nconst BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://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}\n\nexport const LandingPage = {\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 }: 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 };\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 LandingPage.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 type == 0\n ? JSON.stringify(visualMerchandising)\n .replaceAll('\"[', \"[\")\n .replaceAll(']\"', \"]\")\n : undefined,\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(\",\") : []);"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface getProductsProps {
|
|
2
|
-
storeID: number;
|
|
3
|
-
uuid: string;
|
|
4
|
-
withAttributes: boolean;
|
|
5
|
-
ids: number[];
|
|
6
|
-
}
|
|
7
|
-
export declare const Products: {
|
|
8
|
-
getProductByIds: ({ uuid, storeID, withAttributes, ids }: getProductsProps) => Promise<unknown>;
|
|
9
|
-
};
|
|
1
|
+
export interface getProductsProps {
|
|
2
|
+
storeID: number;
|
|
3
|
+
uuid: string;
|
|
4
|
+
withAttributes: boolean;
|
|
5
|
+
ids: number[];
|
|
6
|
+
}
|
|
7
|
+
export declare const Products: {
|
|
8
|
+
getProductByIds: ({ uuid, storeID, withAttributes, ids }: getProductsProps) => Promise<unknown>;
|
|
9
|
+
};
|
|
@@ -1,31 +1,31 @@
|
|
|
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 { API } from "./API";
|
|
11
|
-
import { getInternalURL } from "../utils/getInternalURL";
|
|
12
|
-
const BASE_FS_API_URL = "https://internal-v3joil6oqa-uc.a.run.app";
|
|
13
|
-
export const Products = {
|
|
14
|
-
getProductByIds: ({ uuid, storeID, withAttributes, ids }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
const params = {
|
|
16
|
-
products: ids,
|
|
17
|
-
with_product_attributes: withAttributes
|
|
18
|
-
};
|
|
19
|
-
var internal_url = getInternalURL();
|
|
20
|
-
if (internal_url == "") {
|
|
21
|
-
internal_url = BASE_FS_API_URL;
|
|
22
|
-
}
|
|
23
|
-
const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;
|
|
24
|
-
return yield API.post({
|
|
25
|
-
url: url,
|
|
26
|
-
data: params,
|
|
27
|
-
config: { headers: { 'content-type': 'text/plain' } }
|
|
28
|
-
});
|
|
29
|
-
})
|
|
30
|
-
};
|
|
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 { API } from "./API";
|
|
11
|
+
import { getInternalURL } from "../utils/getInternalURL";
|
|
12
|
+
const BASE_FS_API_URL = "https://internal-v3joil6oqa-uc.a.run.app";
|
|
13
|
+
export const Products = {
|
|
14
|
+
getProductByIds: ({ uuid, storeID, withAttributes, ids }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const params = {
|
|
16
|
+
products: ids,
|
|
17
|
+
with_product_attributes: withAttributes
|
|
18
|
+
};
|
|
19
|
+
var internal_url = getInternalURL();
|
|
20
|
+
if (internal_url == "") {
|
|
21
|
+
internal_url = BASE_FS_API_URL;
|
|
22
|
+
}
|
|
23
|
+
const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;
|
|
24
|
+
return yield API.post({
|
|
25
|
+
url: url,
|
|
26
|
+
data: params,
|
|
27
|
+
config: { headers: { 'content-type': 'text/plain' } }
|
|
28
|
+
});
|
|
29
|
+
})
|
|
30
|
+
};
|
|
31
31
|
//# sourceMappingURL=products.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/services/products.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAOnE,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEpB,eAAe,EAAE,CAAO,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAmB,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAwB;YAChC,QAAQ,EAAE,GAAG;YACb,uBAAuB,EAAE,cAAc;SAE1C,CAAC;QACF,IAAI,YAAY,GAAC,cAAc,EAAE,CAAC;QAClC,IAAG,YAAY,IAAE,EAAE,EACnB;YACI,YAAY,GAAC,eAAe,CAAC;SAChC;QACD,MAAM,GAAG,GAAG,GAAG,YAAY,oCAAoC,IAAI,aAAa,OAAO,EAAE,CAAC;QAC1F,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC;YAClB,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE;SACxD,CAAC,CAAC;IACP,CAAC,CAAA;CACJ,CAAA","sourcesContent":["import {API} from \"./API\";\
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/services/products.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAEvD,MAAM,eAAe,GAAG,0CAA0C,CAAC;AAOnE,MAAM,CAAC,MAAM,QAAQ,GAAG;IAEpB,eAAe,EAAE,CAAO,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAmB,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAwB;YAChC,QAAQ,EAAE,GAAG;YACb,uBAAuB,EAAE,cAAc;SAE1C,CAAC;QACF,IAAI,YAAY,GAAC,cAAc,EAAE,CAAC;QAClC,IAAG,YAAY,IAAE,EAAE,EACnB;YACI,YAAY,GAAC,eAAe,CAAC;SAChC;QACD,MAAM,GAAG,GAAG,GAAG,YAAY,oCAAoC,IAAI,aAAa,OAAO,EAAE,CAAC;QAC1F,OAAO,MAAM,GAAG,CAAC,IAAI,CAAC;YAClB,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,EAAE;SACxD,CAAC,CAAC;IACP,CAAC,CAAA;CACJ,CAAA","sourcesContent":["import {API} from \"./API\";\nimport {getInternalURL} from \"../utils/getInternalURL\";\n\nconst BASE_FS_API_URL = \"https://internal-v3joil6oqa-uc.a.run.app\";\nexport interface getProductsProps {\n storeID: number\n uuid: string\n withAttributes:boolean\n ids: number[]\n}\nexport const Products = {\n\n getProductByIds: async ({uuid, storeID, withAttributes, ids}: getProductsProps) => {\n const params: Record<string, any> = {\n products: ids,\n with_product_attributes: withAttributes\n\n };\n var internal_url=getInternalURL();\n if(internal_url==\"\")\n {\n internal_url=BASE_FS_API_URL;\n }\n const url = `${internal_url}/search/get_format_products?UUID=${uuid}&store_id=${storeID}`;\n return await API.post({\n url: url,\n data: params,\n config: { headers: { 'content-type': 'text/plain' } }\n });\n }\n}"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CategoryNavigationResponse } from "../@types/categoriesNavigation";
|
|
2
|
-
import { ServerFacet } from "@fast-simon/utilities";
|
|
3
|
-
import { fullTextSearchProps, FullTextServerResponseAll } from "../@types/results";
|
|
4
|
-
export declare const FullTextSearch: {
|
|
5
|
-
getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }: any) => Promise<{
|
|
6
|
-
data: CategoryNavigationResponse;
|
|
7
|
-
getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
|
|
8
|
-
}>;
|
|
9
|
-
fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }: any) => Promise<import("@fast-simon/utilities").Facet[]>;
|
|
10
|
-
getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
|
|
11
|
-
getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
|
|
12
|
-
};
|
|
13
|
-
export declare const transformFacetsOnlyData: (r: ServerFacet[], avoidTagPrefixes?: string) => import("@fast-simon/utilities").Facet[];
|
|
1
|
+
import { CategoryNavigationResponse } from "../@types/categoriesNavigation";
|
|
2
|
+
import { ServerFacet } from "@fast-simon/utilities";
|
|
3
|
+
import { fullTextSearchProps, FullTextServerResponseAll } from "../@types/results";
|
|
4
|
+
export declare const FullTextSearch: {
|
|
5
|
+
getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }: any) => Promise<{
|
|
6
|
+
data: CategoryNavigationResponse;
|
|
7
|
+
getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
|
|
8
|
+
}>;
|
|
9
|
+
fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }: any) => Promise<import("@fast-simon/utilities").Facet[]>;
|
|
10
|
+
getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
|
|
11
|
+
getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }: fullTextSearchProps) => Promise<FullTextServerResponseAll>;
|
|
12
|
+
};
|
|
13
|
+
export declare const transformFacetsOnlyData: (r: ServerFacet[], avoidTagPrefixes?: string) => import("@fast-simon/utilities").Facet[];
|
package/dist/services/search.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
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 { API, fastSimonGet } from "./API";
|
|
11
|
-
import { FacetsParser } from "@fast-simon/utilities";
|
|
12
|
-
import { getLSVectorSearchDict, getLSVectorSearchOn } from "../utils/getLSVectorSearch";
|
|
13
|
-
import { getInternalURL } from "../utils/getInternalURL";
|
|
14
|
-
import { getUseCacheSetting } from "../utils/getCacheSettings";
|
|
15
|
-
const BASE_URL = "https://internal-v3joil6oqa-uc.a.run.app";
|
|
16
|
-
export const FullTextSearch = {
|
|
17
|
-
getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
const params = {
|
|
19
|
-
UUID: uuid,
|
|
20
|
-
store_id: storeID,
|
|
21
|
-
facets_required: 1,
|
|
22
|
-
q: searchWithinSearch || query,
|
|
23
|
-
page_num: page !== null && page !== void 0 ? page : 1,
|
|
24
|
-
with_product_attributes: withAttributes,
|
|
25
|
-
narrow: JSON.stringify(narrow),
|
|
26
|
-
products_per_page: productsPerPage,
|
|
27
|
-
visual_merchandising: !searchWithinSearch ? JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']') : undefined
|
|
28
|
-
};
|
|
29
|
-
if (lastProduct) {
|
|
30
|
-
params['last_product'] = lastProduct;
|
|
31
|
-
}
|
|
32
|
-
const res = yield API.post({ url: BASE_URL + '/search/full_text_search_editor', data: params, config: { headers: { 'content-type': 'text/plain' } } });
|
|
33
|
-
return {
|
|
34
|
-
data: res,
|
|
35
|
-
getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
return ((res === null || res === void 0 ? void 0 : res.facets_completed) ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) : yield FullTextSearch.fullTextFacetsOnly({ uuid,
|
|
37
|
-
storeID,
|
|
38
|
-
facetRequired,
|
|
39
|
-
narrow,
|
|
40
|
-
page,
|
|
41
|
-
productsPerPage,
|
|
42
|
-
withAttributes,
|
|
43
|
-
searchWithinSearch,
|
|
44
|
-
visualMerchandising,
|
|
45
|
-
lastProduct,
|
|
46
|
-
query }));
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
|
-
}),
|
|
50
|
-
fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
const params = {
|
|
52
|
-
UUID: uuid,
|
|
53
|
-
store_id: storeID,
|
|
54
|
-
facets_required: 2,
|
|
55
|
-
q: query,
|
|
56
|
-
page_num: page !== null && page !== void 0 ? page : 1,
|
|
57
|
-
with_product_attributes: withAttributes,
|
|
58
|
-
narrow: JSON.stringify(narrow),
|
|
59
|
-
products_per_page: productsPerPage,
|
|
60
|
-
search_within_search: searchWithinSearch,
|
|
61
|
-
visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']')
|
|
62
|
-
};
|
|
63
|
-
const res = yield fastSimonGet(BASE_URL, '/search/full_text_search_editor', params);
|
|
64
|
-
return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);
|
|
65
|
-
}),
|
|
66
|
-
getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }) => {
|
|
67
|
-
var _a;
|
|
68
|
-
var internal_url = getInternalURL();
|
|
69
|
-
if (internal_url == "") {
|
|
70
|
-
internal_url = BASE_URL;
|
|
71
|
-
}
|
|
72
|
-
// Cache setting: Controls whether 'm' param is added to request
|
|
73
|
-
// When true (default): omit 'm' - backend uses cache for faster responses
|
|
74
|
-
// When false: add 'm: 1' - backend forces fresh data (useful for debugging)
|
|
75
|
-
const use_cache = getUseCacheSetting();
|
|
76
|
-
const params = Object.assign(Object.assign({ site_key: siteKey,
|
|
77
|
-
// UUID: uuid,
|
|
78
|
-
// store_id: storeID,
|
|
79
|
-
cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, custom_sort_settings: JSON.stringify(custom_sort_settings), with_product_analytics: with_product_analytics ? true : undefined, market_context: market_context || undefined });
|
|
80
|
-
if (getLSVectorSearchOn()) {
|
|
81
|
-
params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
|
|
82
|
-
}
|
|
83
|
-
params["segments"] = JSON.stringify(segments) || undefined;
|
|
84
|
-
return API.get({
|
|
85
|
-
url: `${internal_url}/search/full_text_search_reasoning`,
|
|
86
|
-
params,
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }) => {
|
|
90
|
-
var _a;
|
|
91
|
-
var internal_url = getInternalURL();
|
|
92
|
-
if (internal_url == "") {
|
|
93
|
-
internal_url = BASE_URL;
|
|
94
|
-
}
|
|
95
|
-
// Cache setting: Controls whether 'm' param is added to request
|
|
96
|
-
// When true (default): omit 'm' - backend uses cache for faster responses
|
|
97
|
-
// When false: add 'm: 1' - backend forces fresh data (useful for debugging)
|
|
98
|
-
const use_cache = getUseCacheSetting();
|
|
99
|
-
const params = Object.assign(Object.assign({ site_key: siteKey,
|
|
100
|
-
// UUID: uuid,
|
|
101
|
-
// store_id: storeID,
|
|
102
|
-
cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, ids_only: 1, custom_sort_settings: JSON.stringify(custom_sort_settings), market_context: market_context || undefined });
|
|
103
|
-
if (getLSVectorSearchOn()) {
|
|
104
|
-
params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
|
|
105
|
-
}
|
|
106
|
-
params["segments"] = JSON.stringify(segments) || undefined;
|
|
107
|
-
return API.get({
|
|
108
|
-
url: `${internal_url}/search/full_text_search`,
|
|
109
|
-
params,
|
|
110
|
-
});
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
|
|
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 { API, fastSimonGet } from "./API";
|
|
11
|
+
import { FacetsParser } from "@fast-simon/utilities";
|
|
12
|
+
import { getLSVectorSearchDict, getLSVectorSearchOn } from "../utils/getLSVectorSearch";
|
|
13
|
+
import { getInternalURL } from "../utils/getInternalURL";
|
|
14
|
+
import { getUseCacheSetting } from "../utils/getCacheSettings";
|
|
15
|
+
const BASE_URL = "https://internal-v3joil6oqa-uc.a.run.app";
|
|
16
|
+
export const FullTextSearch = {
|
|
17
|
+
getFullTextSearch: ({ uuid, storeID, facetRequired, narrow, page, productsPerPage, withAttributes, query, searchWithinSearch, visualMerchandising, lastProduct }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
const params = {
|
|
19
|
+
UUID: uuid,
|
|
20
|
+
store_id: storeID,
|
|
21
|
+
facets_required: 1,
|
|
22
|
+
q: searchWithinSearch || query,
|
|
23
|
+
page_num: page !== null && page !== void 0 ? page : 1,
|
|
24
|
+
with_product_attributes: withAttributes,
|
|
25
|
+
narrow: JSON.stringify(narrow),
|
|
26
|
+
products_per_page: productsPerPage,
|
|
27
|
+
visual_merchandising: !searchWithinSearch ? JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']') : undefined
|
|
28
|
+
};
|
|
29
|
+
if (lastProduct) {
|
|
30
|
+
params['last_product'] = lastProduct;
|
|
31
|
+
}
|
|
32
|
+
const res = yield API.post({ url: BASE_URL + '/search/full_text_search_editor', data: params, config: { headers: { 'content-type': 'text/plain' } } });
|
|
33
|
+
return {
|
|
34
|
+
data: res,
|
|
35
|
+
getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
return ((res === null || res === void 0 ? void 0 : res.facets_completed) ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) : yield FullTextSearch.fullTextFacetsOnly({ uuid,
|
|
37
|
+
storeID,
|
|
38
|
+
facetRequired,
|
|
39
|
+
narrow,
|
|
40
|
+
page,
|
|
41
|
+
productsPerPage,
|
|
42
|
+
withAttributes,
|
|
43
|
+
searchWithinSearch,
|
|
44
|
+
visualMerchandising,
|
|
45
|
+
lastProduct,
|
|
46
|
+
query }));
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}),
|
|
50
|
+
fullTextFacetsOnly: ({ uuid, storeID, narrow, page, productsPerPage, withAttributes, collectionID, searchWithinSearch, visualMerchandising, query }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const params = {
|
|
52
|
+
UUID: uuid,
|
|
53
|
+
store_id: storeID,
|
|
54
|
+
facets_required: 2,
|
|
55
|
+
q: query,
|
|
56
|
+
page_num: page !== null && page !== void 0 ? page : 1,
|
|
57
|
+
with_product_attributes: withAttributes,
|
|
58
|
+
narrow: JSON.stringify(narrow),
|
|
59
|
+
products_per_page: productsPerPage,
|
|
60
|
+
search_within_search: searchWithinSearch,
|
|
61
|
+
visual_merchandising: JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']')
|
|
62
|
+
};
|
|
63
|
+
const res = yield fastSimonGet(BASE_URL, '/search/full_text_search_editor', params);
|
|
64
|
+
return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);
|
|
65
|
+
}),
|
|
66
|
+
getReasoningFullTextSearch: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, with_product_analytics, market_context }) => {
|
|
67
|
+
var _a;
|
|
68
|
+
var internal_url = getInternalURL();
|
|
69
|
+
if (internal_url == "") {
|
|
70
|
+
internal_url = BASE_URL;
|
|
71
|
+
}
|
|
72
|
+
// Cache setting: Controls whether 'm' param is added to request
|
|
73
|
+
// When true (default): omit 'm' - backend uses cache for faster responses
|
|
74
|
+
// When false: add 'm: 1' - backend forces fresh data (useful for debugging)
|
|
75
|
+
const use_cache = getUseCacheSetting();
|
|
76
|
+
const params = Object.assign(Object.assign({ site_key: siteKey,
|
|
77
|
+
// UUID: uuid,
|
|
78
|
+
// store_id: storeID,
|
|
79
|
+
cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, custom_sort_settings: JSON.stringify(custom_sort_settings), with_product_analytics: with_product_analytics ? true : undefined, market_context: market_context || undefined });
|
|
80
|
+
if (getLSVectorSearchOn()) {
|
|
81
|
+
params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
|
|
82
|
+
}
|
|
83
|
+
params["segments"] = JSON.stringify(segments) || undefined;
|
|
84
|
+
return API.get({
|
|
85
|
+
url: `${internal_url}/search/full_text_search_reasoning`,
|
|
86
|
+
params,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
getReasoningFullTextSearchProductsIds: ({ uuid, storeID, siteKey, cdn, facetRequired, narrowBy, page, productsPerPage, term, sortBy, withAttributes, recent, searchWithinSearch, segments, disable_semantics, disable_merchandising, disable_strategies, disable_turbolinks, disable_merchandising_rules, disable_antonyms, custom_sort_settings, market_context }) => {
|
|
90
|
+
var _a;
|
|
91
|
+
var internal_url = getInternalURL();
|
|
92
|
+
if (internal_url == "") {
|
|
93
|
+
internal_url = BASE_URL;
|
|
94
|
+
}
|
|
95
|
+
// Cache setting: Controls whether 'm' param is added to request
|
|
96
|
+
// When true (default): omit 'm' - backend uses cache for faster responses
|
|
97
|
+
// When false: add 'm: 1' - backend forces fresh data (useful for debugging)
|
|
98
|
+
const use_cache = getUseCacheSetting();
|
|
99
|
+
const params = Object.assign(Object.assign({ site_key: siteKey,
|
|
100
|
+
// UUID: uuid,
|
|
101
|
+
// store_id: storeID,
|
|
102
|
+
cdn_cache_key: cdn, facets_required: facetRequired, q: term, page_num: page, with_product_attributes: withAttributes, narrow: JSON.stringify(narrowBy), products_per_page: productsPerPage, sort_by: sortBy, sp: recent }, (!use_cache ? { m: 1 } : {})), { search_within_search: searchWithinSearch, disable_semantics: disable_semantics ? 1 : 0, disable_merchandising: disable_merchandising ? 1 : 0, disable_strategies: disable_strategies ? 1 : 0, disable_turbolinks: disable_turbolinks ? 1 : 0, disable_merchandising_rules: disable_merchandising_rules ? 1 : 0, disable_antonyms: disable_antonyms ? 1 : 0, ids_only: 1, custom_sort_settings: JSON.stringify(custom_sort_settings), market_context: market_context || undefined });
|
|
103
|
+
if (getLSVectorSearchOn()) {
|
|
104
|
+
params["hybrid_search_settings"] = (_a = getLSVectorSearchDict()) !== null && _a !== void 0 ? _a : undefined;
|
|
105
|
+
}
|
|
106
|
+
params["segments"] = JSON.stringify(segments) || undefined;
|
|
107
|
+
return API.get({
|
|
108
|
+
url: `${internal_url}/search/full_text_search`,
|
|
109
|
+
params,
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
|
|
114
114
|
//# sourceMappingURL=search.js.map
|