@fast-simon/dashboard-utilities 1.0.3 → 1.0.5
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/lib/@types/banner.d.ts +7 -0
- package/lib/@types/banner.js +2 -0
- package/lib/@types/banner.js.map +1 -0
- package/lib/@types/categories.d.ts +16 -0
- package/lib/@types/categories.js +2 -0
- package/lib/@types/categories.js.map +1 -0
- package/lib/@types/currency.d.ts +1 -0
- package/lib/@types/currency.js +2 -0
- package/lib/@types/currency.js.map +1 -0
- package/lib/@types/editorProduct.d.ts +26 -0
- package/lib/@types/editorProduct.js +6 -0
- package/lib/@types/editorProduct.js.map +1 -0
- package/lib/@types/iconProps.d.ts +9 -0
- package/lib/@types/iconProps.js +2 -0
- package/lib/@types/iconProps.js.map +1 -0
- package/lib/@types/product.d.ts +158 -0
- package/lib/@types/product.js +8 -0
- package/lib/@types/product.js.map +1 -0
- package/lib/@types/productLabel.d.ts +1 -0
- package/lib/@types/productLabel.js +2 -0
- package/lib/@types/productLabel.js.map +1 -0
- package/lib/@types/promoTile.d.ts +11 -0
- package/lib/@types/promoTile.js +2 -0
- package/lib/@types/promoTile.js.map +1 -0
- package/lib/@types/results.d.ts +42 -0
- package/lib/@types/results.js +2 -0
- package/lib/@types/results.js.map +1 -0
- package/lib/@types/sideMenu.d.ts +19 -0
- package/lib/@types/sideMenu.js +2 -0
- package/lib/@types/sideMenu.js.map +1 -0
- package/lib/@types/sortBy.d.ts +3 -0
- package/lib/@types/sortBy.js +2 -0
- package/lib/@types/sortBy.js.map +1 -0
- package/lib/App.d.ts +3 -0
- package/lib/App.js +15 -0
- package/lib/App.js.map +1 -0
- package/lib/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.d.ts +9 -0
- package/lib/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js +74 -0
- package/lib/components/BackOfficeFiltersMenu/BackOfficeFiltersMenu.js.map +1 -0
- package/lib/components/BackOfficeFiltersMenu/index.d.ts +1 -0
- package/lib/components/BackOfficeFiltersMenu/index.js +2 -0
- package/lib/components/BackOfficeFiltersMenu/index.js.map +1 -0
- package/lib/components/BackOfficeFiltersMenu/utils.d.ts +7 -0
- package/lib/components/BackOfficeFiltersMenu/utils.js +239 -0
- package/lib/components/BackOfficeFiltersMenu/utils.js.map +1 -0
- package/lib/components/CheckboxFilter/Checkbox/Checkbox.d.ts +10 -0
- package/lib/components/CheckboxFilter/Checkbox/Checkbox.js +7 -0
- package/lib/components/CheckboxFilter/Checkbox/Checkbox.js.map +1 -0
- package/lib/components/CheckboxFilter/CheckboxFilter.d.ts +6 -0
- package/lib/components/CheckboxFilter/CheckboxFilter.js +9 -0
- package/lib/components/CheckboxFilter/CheckboxFilter.js.map +1 -0
- package/lib/components/DragAndDrop/DndContextWrapper.d.ts +20 -0
- package/lib/components/DragAndDrop/DndContextWrapper.js +33 -0
- package/lib/components/DragAndDrop/DndContextWrapper.js.map +1 -0
- package/lib/components/DragAndDrop/Droppable.d.ts +7 -0
- package/lib/components/DragAndDrop/Droppable.js +10 -0
- package/lib/components/DragAndDrop/Droppable.js.map +1 -0
- package/lib/components/DragAndDrop/SortableItem.d.ts +13 -0
- package/lib/components/DragAndDrop/SortableItem.js +39 -0
- package/lib/components/DragAndDrop/SortableItem.js.map +1 -0
- package/lib/components/FacetItem/FacetItem.d.ts +13 -0
- package/lib/components/FacetItem/FacetItem.js +40 -0
- package/lib/components/FacetItem/FacetItem.js.map +1 -0
- package/lib/components/FastSimonApi/FastSimonApi.d.ts +32 -0
- package/lib/components/FastSimonApi/FastSimonApi.js +398 -0
- package/lib/components/FastSimonApi/FastSimonApi.js.map +1 -0
- package/lib/components/FastSimonApi/context.d.ts +50 -0
- package/lib/components/FastSimonApi/context.js +10 -0
- package/lib/components/FastSimonApi/context.js.map +1 -0
- package/lib/components/FastSimonApi/index.d.ts +3 -0
- package/lib/components/FastSimonApi/index.js +3 -0
- package/lib/components/FastSimonApi/index.js.map +1 -0
- package/lib/components/FastSimonApi/reducer.d.ts +172 -0
- package/lib/components/FastSimonApi/reducer.js +67 -0
- package/lib/components/FastSimonApi/reducer.js.map +1 -0
- package/lib/components/FromToFilter/From/From.d.ts +17 -0
- package/lib/components/FromToFilter/From/From.js +22 -0
- package/lib/components/FromToFilter/From/From.js.map +1 -0
- package/lib/components/FromToFilter/FromToFilter.d.ts +14 -0
- package/lib/components/FromToFilter/FromToFilter.js +58 -0
- package/lib/components/FromToFilter/FromToFilter.js.map +1 -0
- package/lib/components/FromToFilter/To/To.d.ts +18 -0
- package/lib/components/FromToFilter/To/To.js +23 -0
- package/lib/components/FromToFilter/To/To.js.map +1 -0
- package/lib/components/FromToFilter/utils.d.ts +25 -0
- package/lib/components/FromToFilter/utils.js +7 -0
- package/lib/components/FromToFilter/utils.js.map +1 -0
- package/lib/components/InStoreFiltersMenu/InStoreFiltersMenu.d.ts +10 -0
- package/lib/components/InStoreFiltersMenu/InStoreFiltersMenu.js +34 -0
- package/lib/components/InStoreFiltersMenu/InStoreFiltersMenu.js.map +1 -0
- package/lib/components/InStoreFiltersMenu/index.d.ts +1 -0
- package/lib/components/InStoreFiltersMenu/index.js +2 -0
- package/lib/components/InStoreFiltersMenu/index.js.map +1 -0
- package/lib/components/Input/Input.d.ts +22 -0
- package/lib/components/Input/Input.js +49 -0
- package/lib/components/Input/Input.js.map +1 -0
- package/lib/components/Input/index.d.ts +1 -0
- package/lib/components/Input/index.js +2 -0
- package/lib/components/Input/index.js.map +1 -0
- package/lib/components/LastReceivedDateFilter/LastReceivedDate.d.ts +9 -0
- package/lib/components/LastReceivedDateFilter/LastReceivedDate.js +88 -0
- package/lib/components/LastReceivedDateFilter/LastReceivedDate.js.map +1 -0
- package/lib/components/LastReceivedDateFilter/utils.d.ts +3 -0
- package/lib/components/LastReceivedDateFilter/utils.js +43 -0
- package/lib/components/LastReceivedDateFilter/utils.js.map +1 -0
- package/lib/components/RadioFilter/Radio/Radio.d.ts +10 -0
- package/lib/components/RadioFilter/Radio/Radio.js +7 -0
- package/lib/components/RadioFilter/Radio/Radio.js.map +1 -0
- package/lib/components/RadioFilter/RadioFilter.d.ts +9 -0
- package/lib/components/RadioFilter/RadioFilter.js +45 -0
- package/lib/components/RadioFilter/RadioFilter.js.map +1 -0
- package/lib/components/RadioFilter/utils.d.ts +1 -0
- package/lib/components/RadioFilter/utils.js +8 -0
- package/lib/components/RadioFilter/utils.js.map +1 -0
- package/lib/components/ReactDatePicker/ReactDatePicker.d.ts +11 -0
- package/lib/components/ReactDatePicker/ReactDatePicker.js +16 -0
- package/lib/components/ReactDatePicker/ReactDatePicker.js.map +1 -0
- package/lib/components/ReactDatePicker/index.d.ts +1 -0
- package/lib/components/ReactDatePicker/index.js +2 -0
- package/lib/components/ReactDatePicker/index.js.map +1 -0
- package/lib/components/RenderIfVisible/RenderIfVisible.d.ts +12 -0
- package/lib/components/RenderIfVisible/RenderIfVisible.js +59 -0
- package/lib/components/RenderIfVisible/RenderIfVisible.js.map +1 -0
- package/lib/components/RenderIfVisible/index.d.ts +1 -0
- package/lib/components/RenderIfVisible/index.js +2 -0
- package/lib/components/RenderIfVisible/index.js.map +1 -0
- package/lib/components/SingleFilter/SingleFilter.d.ts +11 -0
- package/lib/components/SingleFilter/SingleFilter.js +90 -0
- package/lib/components/SingleFilter/SingleFilter.js.map +1 -0
- package/lib/components/SingleFilter/utils.d.ts +3 -0
- package/lib/components/SingleFilter/utils.js +42 -0
- package/lib/components/SingleFilter/utils.js.map +1 -0
- package/lib/components/SliderFilter/SliderFilter.d.ts +20 -0
- package/lib/components/SliderFilter/SliderFilter.js +46 -0
- package/lib/components/SliderFilter/SliderFilter.js.map +1 -0
- package/lib/components/SliderFilter/index.d.ts +1 -0
- package/lib/components/SliderFilter/index.js +2 -0
- package/lib/components/SliderFilter/index.js.map +1 -0
- package/lib/components/Tooltip/Tooltip.d.ts +8 -0
- package/lib/components/Tooltip/Tooltip.js +9 -0
- package/lib/components/Tooltip/Tooltip.js.map +1 -0
- package/lib/components/common.d.ts +34 -0
- package/lib/components/common.js +80 -0
- package/lib/components/common.js.map +1 -0
- package/lib/components/productGrid/ProductGrid.d.ts +7 -0
- package/lib/components/productGrid/ProductGrid.js +11 -0
- package/lib/components/productGrid/ProductGrid.js.map +1 -0
- package/lib/components/productGrid/index.d.ts +1 -0
- package/lib/components/productGrid/index.js +2 -0
- package/lib/components/productGrid/index.js.map +1 -0
- package/lib/icons/BackOfficeFiltersIcon.d.ts +2 -0
- package/lib/icons/BackOfficeFiltersIcon.js +7 -0
- package/lib/icons/BackOfficeFiltersIcon.js.map +1 -0
- package/lib/icons/BannersIcon.d.ts +2 -0
- package/lib/icons/BannersIcon.js +7 -0
- package/lib/icons/BannersIcon.js.map +1 -0
- package/lib/icons/HelpIcon.d.ts +7 -0
- package/lib/icons/HelpIcon.js +5 -0
- package/lib/icons/HelpIcon.js.map +1 -0
- package/lib/icons/InStoreFiltersIcon.d.ts +2 -0
- package/lib/icons/InStoreFiltersIcon.js +7 -0
- package/lib/icons/InStoreFiltersIcon.js.map +1 -0
- package/lib/icons/PromoteIcon.d.ts +2 -0
- package/lib/icons/PromoteIcon.js +7 -0
- package/lib/icons/PromoteIcon.js.map +1 -0
- package/lib/icons/RemoveIcon.d.ts +2 -0
- package/lib/icons/RemoveIcon.js +7 -0
- package/lib/icons/RemoveIcon.js.map +1 -0
- package/lib/icons/RestoreIcon.d.ts +2 -0
- package/lib/icons/RestoreIcon.js +7 -0
- package/lib/icons/RestoreIcon.js.map +1 -0
- package/lib/icons/index.d.ts +7 -0
- package/lib/icons/index.js +8 -0
- package/lib/icons/index.js.map +1 -0
- package/lib/main.d.ts +15 -0
- package/lib/main.js +2 -0
- package/lib/main.js.map +1 -0
- package/lib/services/API.d.ts +21 -0
- package/lib/services/API.js +50 -0
- package/lib/services/API.js.map +1 -0
- package/lib/services/landingPage.d.ts +28 -0
- package/lib/services/landingPage.js +153 -0
- package/lib/services/landingPage.js.map +1 -0
- package/lib/utils/customTagsFilters.d.ts +4 -0
- package/lib/utils/customTagsFilters.js +10 -0
- package/lib/utils/customTagsFilters.js.map +1 -0
- package/lib/utils/products.d.ts +30 -0
- package/lib/utils/products.js +39 -0
- package/lib/utils/products.js.map +1 -0
- package/lib/utils/shopifyMarkets.d.ts +3 -0
- package/lib/utils/shopifyMarkets.js +7 -0
- package/lib/utils/shopifyMarkets.js.map +1 -0
- package/lib/utils/useDragToSelect.d.ts +13 -0
- package/lib/utils/useDragToSelect.js +177 -0
- package/lib/utils/useDragToSelect.js.map +1 -0
- package/package.json +10 -12
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classes from "./styles.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
export const RestoreIcon = ({ width, height, customClasses }) => {
|
|
5
|
+
return (_jsx("div", Object.assign({ className: classes.iconWrapper }, { children: _jsx("span", Object.assign({ className: clsx("material-symbols-outlined", classes.materialIcon, customClasses === null || customClasses === void 0 ? void 0 : customClasses.svg) }, { children: "restart_alt" })) })));
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=RestoreIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestoreIcon.js","sourceRoot":"","sources":["../../src/icons/RestoreIcon.tsx"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,qBAAqB,CAAA;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAY,EAAE,EAAE;IACrE,OAAO,CACH,4BAAK,SAAS,EAAE,OAAO,CAAC,WAAW,gBAC/B,6BAAM,SAAS,EAAE,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC,YAAY,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,GAAG,CAAC,iCAErF,IACL,CACT,CAAA;AACL,CAAC,CAAA","sourcesContent":["import React from \"react\";\r\nimport classes from \"./styles.module.css\"\r\nimport clsx from \"clsx\";\r\nimport {IconProps} from \"../@types/iconProps\";\r\n\r\nexport const RestoreIcon = ({width, height, customClasses}: IconProps) => {\r\n return (\r\n <div className={classes.iconWrapper}>\r\n <span className={clsx(\"material-symbols-outlined\", classes.materialIcon, customClasses?.svg)}>\r\n restart_alt\r\n </span>\r\n </div>\r\n )\r\n}\r\n\r\n\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './BackOfficeFiltersIcon';
|
|
2
|
+
export * from './BannersIcon';
|
|
3
|
+
export * from './HelpIcon';
|
|
4
|
+
export * from './InStoreFiltersIcon';
|
|
5
|
+
export * from './PromoteIcon';
|
|
6
|
+
export * from './RemoveIcon';
|
|
7
|
+
export * from './RestoreIcon';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA","sourcesContent":["export * from './BackOfficeFiltersIcon'\r\nexport * from './BannersIcon'\r\nexport * from './HelpIcon'\r\nexport * from './InStoreFiltersIcon'\r\nexport * from './PromoteIcon'\r\nexport * from './RemoveIcon'\r\nexport * from './RestoreIcon'"]}
|
package/lib/main.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as sideMenuTypes from "./@types/sideMenu";
|
|
2
|
+
import { ProductLabelType } from "./@types/productLabel";
|
|
3
|
+
import { videoFormats, Banner } from "./@types/banner";
|
|
4
|
+
import { EditorProduct } from "./@types/editorProduct";
|
|
5
|
+
import * as Icons from "./icons";
|
|
6
|
+
import BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu';
|
|
7
|
+
import InStoreFiltersMenu from './components/InStoreFiltersMenu';
|
|
8
|
+
import DndContextWrapper from './components/DragAndDrop/DndContextWrapper';
|
|
9
|
+
import Droppable from './components/DragAndDrop/Droppable';
|
|
10
|
+
import { SortableItem } from './components/DragAndDrop/SortableItem';
|
|
11
|
+
import ProductGrid from "./components/productGrid/ProductGrid";
|
|
12
|
+
import RenderIfVisible from "./components/RenderIfVisible";
|
|
13
|
+
import { useDragToSelect } from "./utils/useDragToSelect";
|
|
14
|
+
import { LandingPage } from "./services/landingPage";
|
|
15
|
+
export type { sideMenuTypes, ProductLabelType, videoFormats, Banner, EditorProduct, Icons, BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage };
|
package/lib/main.js
ADDED
package/lib/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"","sourcesContent":["import * as sideMenuTypes from \"./@types/sideMenu\"\nimport {ProductLabelType} from \"./@types/productLabel\"\nimport {videoFormats, Banner} from \"./@types/banner\"\nimport {EditorProduct} from \"./@types/editorProduct\"\nimport * as Icons from \"./icons\"\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu'\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu'\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper'\nimport Droppable from './components/DragAndDrop/Droppable'\nimport {SortableItem} from './components/DragAndDrop/SortableItem'\nimport ProductGrid from \"./components/productGrid/ProductGrid\";\nimport RenderIfVisible from \"./components/RenderIfVisible\";\nimport {useDragToSelect} from \"./utils/useDragToSelect\";\nimport { LandingPage } from \"./services/landingPage\";\n\nexport type { sideMenuTypes, ProductLabelType, videoFormats, Banner, EditorProduct, Icons,\n BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible,\n useDragToSelect, LandingPage};"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
interface Params {
|
|
3
|
+
[key: string]: string | number | object | undefined | boolean;
|
|
4
|
+
}
|
|
5
|
+
interface GetProps {
|
|
6
|
+
url: string;
|
|
7
|
+
params: Params;
|
|
8
|
+
config?: AxiosRequestConfig;
|
|
9
|
+
}
|
|
10
|
+
interface PostProps {
|
|
11
|
+
url: string;
|
|
12
|
+
data?: Params;
|
|
13
|
+
config?: AxiosRequestConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare const API: {
|
|
16
|
+
get: <T>({ url, params, config }: GetProps) => Promise<T>;
|
|
17
|
+
post: <T_1>({ url, config, data }: PostProps) => Promise<T_1>;
|
|
18
|
+
};
|
|
19
|
+
export declare const parseUrl: (url: string) => string;
|
|
20
|
+
export declare function fastSimonGet<T>(endpoint: string, path: string, params?: Params): Promise<T>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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 axios from "axios";
|
|
11
|
+
export const API = {
|
|
12
|
+
get: function ({ url, params, config }) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const response = yield fetch(url + `?${Object.entries(params).filter(param => param[1]).map((param) => `${param[0]}=${param[1]}`).join('&')}`);
|
|
15
|
+
return yield response.json();
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
post: function ({ url, config, data }) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const instance = axios.create({
|
|
21
|
+
baseURL: url,
|
|
22
|
+
data: data
|
|
23
|
+
});
|
|
24
|
+
if ('Session' in instance.defaults.headers) {
|
|
25
|
+
delete (instance.defaults.headers['Session']);
|
|
26
|
+
}
|
|
27
|
+
if ('SiteKey' in instance.defaults.headers) {
|
|
28
|
+
delete (instance.defaults.headers['SiteKey']);
|
|
29
|
+
}
|
|
30
|
+
const response = yield instance.post(url, data, config);
|
|
31
|
+
return response.data;
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const parseUrl = (url) => {
|
|
36
|
+
const fixed = url.replace("https://", "").replace("http://", "");
|
|
37
|
+
if (fixed[fixed.length - 1] === "/") {
|
|
38
|
+
return fixed.slice(0, fixed.length - 1);
|
|
39
|
+
}
|
|
40
|
+
return fixed;
|
|
41
|
+
};
|
|
42
|
+
export function fastSimonGet(endpoint, path, params) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield API.get({
|
|
45
|
+
url: `${endpoint}/${path}`,
|
|
46
|
+
params: Object.assign({ src: "visual-editor" }, params)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=API.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"API.js","sourceRoot":"","sources":["../../src/services/API.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAkBhD,MAAM,CAAC,MAAM,GAAG,GAAG;IACf,GAAG,EAAE,UAAmB,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAW;;YAEnD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,IAAI,MAAM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AAC,KAAK,GAAG,EAAE;QACjC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;KAC1C;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,UAAgB,YAAY,CAAI,QAAgB,EAAE,IAAY,EAAE,MAAe;;QACjF,OAAO,MAAM,GAAG,CAAC,GAAG,CAAI;YACpB,GAAG,EAAE,GAAG,QAAQ,IAAI,IAAI,EAAE;YAC1B,MAAM,kBACF,GAAG,EAAE,eAAe,IACjB,MAAM,CACZ;SACJ,CAAC,CAAA;IACN,CAAC;CAAA","sourcesContent":["import axios, {AxiosRequestConfig} from \"axios\";\r\n\r\ninterface Params {\r\n [key: string]: string | number | object | undefined | boolean\r\n}\r\n\r\ninterface GetProps {\r\n url: string,\r\n params: Params,\r\n config?: AxiosRequestConfig\r\n}\r\n\r\ninterface PostProps {\r\n url: string,\r\n data?: Params,\r\n config?: AxiosRequestConfig\r\n}\r\n\r\nexport const API = {\r\n get: async function <T>({url, params, config}: GetProps): Promise<T> {\r\n\r\n const response = await fetch(url + `?${Object.entries(params).filter(param => param[1]).map((param) => `${param[0]}=${param[1]}`).join('&')}`);\r\n\r\n return await response.json();\r\n },\r\n\r\n post: async function <T>({url, config, data}: PostProps) {\r\n const instance = axios.create({\r\n baseURL: url,\r\n data: data\r\n });\r\n if('Session' in instance.defaults.headers) {\r\n delete ((instance.defaults.headers as Record<string, any>)['Session']);\r\n }\r\n if('SiteKey' in instance.defaults.headers) {\r\n delete ((instance.defaults.headers as Record<string, any>)['SiteKey']);\r\n }\r\n const response = await instance.post(url, data, config);\r\n\r\n return response.data as T;\r\n },\r\n};\r\n\r\nexport const parseUrl = (url: string) => {\r\n const fixed = url.replace(\"https://\", \"\").replace(\"http://\", \"\");\r\n if (fixed[fixed.length - 1] === \"/\") {\r\n return fixed.slice(0, fixed.length - 1)\r\n }\r\n return fixed;\r\n};\r\n\r\nexport async function fastSimonGet<T>(endpoint: string, path: string, params?: Params) {\r\n return await API.get<T>({\r\n url: `${endpoint}/${path}`,\r\n params: {\r\n src: \"visual-editor\",\r\n ...params\r\n }\r\n })\r\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 LandingPage: {
|
|
21
|
+
landingPage: ({ uuid, storeID, landingPage, page, sortBy, facets, narrow, productsPerPage, withProductAttributes, searchWithinResultsQuery, type, visualMerchandising, merchandisingRules, }: 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,153 @@
|
|
|
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
|
+
// const BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? "https://internal-v3joil6oqa-uc.a.run.app/search";
|
|
13
|
+
const BASE_URL = "https://yslp---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, // }: LandingPageRequest): Promise<LandingPageResponse> => {
|
|
16
|
+
// const narrowParm = narrow ? new NarrowParser().toServerNarrow(narrow) : undefined;
|
|
17
|
+
//
|
|
18
|
+
// const data = await fastSimonGet<LandingPageServerResponseAll>(BASE_URL, 'landing_page_editor', {
|
|
19
|
+
// UUID: uuid,
|
|
20
|
+
// store_id: storeID,
|
|
21
|
+
// facets_required: facets ? 1 : 0,
|
|
22
|
+
// products_per_page: productsPerPage,
|
|
23
|
+
// narrow: JSON.stringify(narrow),
|
|
24
|
+
// lp: landingPage,
|
|
25
|
+
// page_num: page,
|
|
26
|
+
// type: type,
|
|
27
|
+
// // sort_by: sortBy,
|
|
28
|
+
// // with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,
|
|
29
|
+
// with_product_attributes: withProductAttributes,
|
|
30
|
+
// search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,
|
|
31
|
+
// visual_merchandising: !searchWithinResultsQuery && !narrow.length ? JSON.stringify(visualMerchandising).replaceAll('"[', '[').replaceAll(']"', ']') : undefined,
|
|
32
|
+
// // merchandising_editor: 1,
|
|
33
|
+
// // disable_merchandising: 1,
|
|
34
|
+
// // related_search: 1
|
|
35
|
+
// m: 1
|
|
36
|
+
// });
|
|
37
|
+
visualMerchandising, merchandisingRules, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
const params = {
|
|
39
|
+
UUID: uuid,
|
|
40
|
+
store_id: storeID,
|
|
41
|
+
facets_required: facets ? 1 : 0,
|
|
42
|
+
products_per_page: productsPerPage,
|
|
43
|
+
narrow: JSON.stringify(narrow),
|
|
44
|
+
lp: landingPage,
|
|
45
|
+
page_num: page,
|
|
46
|
+
type: type,
|
|
47
|
+
// sort_by: sortBy,
|
|
48
|
+
// with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,
|
|
49
|
+
with_product_attributes: withProductAttributes,
|
|
50
|
+
search_within_search: searchWithinResultsQuery
|
|
51
|
+
? searchWithinResultsQuery
|
|
52
|
+
: undefined,
|
|
53
|
+
visual_merchandising: type == 0
|
|
54
|
+
? JSON.stringify(visualMerchandising)
|
|
55
|
+
.replaceAll('"[', "[")
|
|
56
|
+
.replaceAll(']"', "]")
|
|
57
|
+
: undefined,
|
|
58
|
+
// merchandising_editor: 1,
|
|
59
|
+
// disable_merchandising: 1,
|
|
60
|
+
// related_search: 1
|
|
61
|
+
m: 1,
|
|
62
|
+
// merchandising_rules: merchandising_rules ? JSON.stringify(merchandising_rules).replaceAll('"[', '[').replaceAll(']"', ']') : undefined
|
|
63
|
+
merchandising_rules: type == 1 ? JSON.stringify(merchandisingRules) : undefined,
|
|
64
|
+
};
|
|
65
|
+
// if(lastProduct) {
|
|
66
|
+
// params['last_product'] = lastProduct
|
|
67
|
+
// }
|
|
68
|
+
const res = yield yield fastSimonGet(BASE_URL, "landing_page_editor", params);
|
|
69
|
+
// const res = await API.post<LandingPageResponse>({url: BASE_URL+'/landing_page_editor', data: params, config: {headers: {'content-type': 'text/plain'}}});
|
|
70
|
+
return {
|
|
71
|
+
data: res,
|
|
72
|
+
getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
return (res === null || res === void 0 ? void 0 : res.facets_completed)
|
|
74
|
+
? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes)
|
|
75
|
+
: yield LandingPage.landingPageFacetsOnly({
|
|
76
|
+
uuid,
|
|
77
|
+
storeID,
|
|
78
|
+
landingPage,
|
|
79
|
+
page,
|
|
80
|
+
narrow,
|
|
81
|
+
type,
|
|
82
|
+
productsPerPage,
|
|
83
|
+
searchWithinResultsQuery,
|
|
84
|
+
withProductAttributes,
|
|
85
|
+
visualMerchandising,
|
|
86
|
+
merchandisingRules,
|
|
87
|
+
});
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
// return {
|
|
91
|
+
// data: data,
|
|
92
|
+
// getFacets: async () => (data?.facets_completed ? transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes) : await LandingPage.landingPageFacetsOnly({uuid,
|
|
93
|
+
// storeID,
|
|
94
|
+
// landingPage,
|
|
95
|
+
// narrow,
|
|
96
|
+
// type,
|
|
97
|
+
// page,
|
|
98
|
+
// productsPerPage,
|
|
99
|
+
// searchWithinResultsQuery})
|
|
100
|
+
// )
|
|
101
|
+
// }
|
|
102
|
+
}),
|
|
103
|
+
landingPageFacetsOnly: ({ uuid, storeID, landingPage, page = 1, narrow, type, productsPerPage, searchWithinResultsQuery, withProductAttributes = false, visualMerchandising, merchandisingRules, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
+
// }: LandingPageFacetsOnly): Promise<Facet[]> => {
|
|
105
|
+
const data = yield fastSimonGet(BASE_URL, "landing_page_editor", {
|
|
106
|
+
UUID: uuid,
|
|
107
|
+
store_id: storeID,
|
|
108
|
+
facets_required: 2,
|
|
109
|
+
products_per_page: productsPerPage,
|
|
110
|
+
narrow: JSON.stringify(narrow),
|
|
111
|
+
type: type,
|
|
112
|
+
lp: landingPage,
|
|
113
|
+
page_num: page !== null && page !== void 0 ? page : 1,
|
|
114
|
+
// sort_by: sortBy,
|
|
115
|
+
// with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,
|
|
116
|
+
with_product_attributes: withProductAttributes,
|
|
117
|
+
search_within_search: searchWithinResultsQuery
|
|
118
|
+
? searchWithinResultsQuery
|
|
119
|
+
: undefined,
|
|
120
|
+
visual_merchandising: type == 0
|
|
121
|
+
? JSON.stringify(visualMerchandising)
|
|
122
|
+
.replaceAll('"[', "[")
|
|
123
|
+
.replaceAll(']"', "]")
|
|
124
|
+
: undefined,
|
|
125
|
+
merchandising_rules: merchandisingRules
|
|
126
|
+
? JSON.stringify(merchandisingRules)
|
|
127
|
+
: undefined,
|
|
128
|
+
m: 1,
|
|
129
|
+
});
|
|
130
|
+
return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);
|
|
131
|
+
}),
|
|
132
|
+
};
|
|
133
|
+
// const transformData = (r: LandingPageServerResponseAll): LandingPageResults => ({
|
|
134
|
+
// narrow: r.narrow ? new NarrowParser().toNarrow(r.narrow) : {},
|
|
135
|
+
// sortBy: r.sort_by,
|
|
136
|
+
// totalResults: r.total_results,
|
|
137
|
+
// page: r.p,
|
|
138
|
+
// totalPages: r.total_p,
|
|
139
|
+
// lpSlug: r.lp_slug,
|
|
140
|
+
// // products: ProductParser.parseProducts(r.items),
|
|
141
|
+
// products: r.items,
|
|
142
|
+
// productIDS: r.items.map(product => String(product.id)),
|
|
143
|
+
// facets: new FacetsParser().parseFacets(r.facets, r.avoid_tag_prefixes ? r.avoid_tag_prefixes.split(",") : []),
|
|
144
|
+
// avoidTagPrefixes: r.avoid_tag_prefixes ? r.avoid_tag_prefixes.split(",") : [],
|
|
145
|
+
// bannerHTML: r?.banner_html ?? "",
|
|
146
|
+
// bannerHTMLMobile: r?.banner_html_mobile ?? "",
|
|
147
|
+
// indexPage: r.index_page,
|
|
148
|
+
// title: r.title,
|
|
149
|
+
// sort: r.sort_by,
|
|
150
|
+
// ancestors: new FacetsParser().parseAncestors(r?.ancestor_categories)
|
|
151
|
+
// });
|
|
152
|
+
export const transformFacetsOnlyData = (r, avoidTagPrefixes) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(",") : []);
|
|
153
|
+
//# sourceMappingURL=landingPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landingPage.js","sourceRoot":"","sources":["../../src/services/landingPage.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,YAAY,EAAc,MAAM,uBAAuB,CAAA;AAmD/D,+GAA+G;AAC/G,MAAM,QAAQ,GAAG,wDAAwD,CAAA;AAoBzE,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,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,EAAE,4DAA4D;IAClE,qFAAqF;IACrF,EAAE;IACF,mGAAmG;IACnG,kBAAkB;IAClB,yBAAyB;IACzB,uCAAuC;IACvC,0CAA0C;IAC1C,sCAAsC;IACtC,uBAAuB;IACvB,sBAAsB;IACtB,kBAAkB;IAClB,0BAA0B;IAC1B,qGAAqG;IACrG,sDAAsD;IACtD,6FAA6F;IAC7F,uKAAuK;IACvK,kCAAkC;IAClC,mCAAmC;IACnC,2BAA2B;IAC3B,WAAW;IACX,MAAM;IACN,mBAAmB,EACnB,kBAAkB,GAChB,EAAE,EAAE;QACN,MAAM,MAAM,GAAwB;YAChC,IAAI,EAAE,IAAI;YACV,Q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;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;QAEF,OAAO,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzE,CAAC,CAAA;CACJ,CAAC;AAEF,oFAAoF;AAChF,iEAAiE;AACjE,qBAAqB;AACrB,iCAAiC;AACjC,aAAa;AACb,yBAAyB;AACzB,qBAAqB;AACrB,qDAAqD;AACrD,qBAAqB;AACrB,0DAA0D;AAC1D,iHAAiH;AACjH,iFAAiF;AACjF,oCAAoC;AACpC,iDAAiD;AACjD,2BAA2B;AAC3B,kBAAkB;AAClB,mBAAmB;AACnB,uEAAuE;AAC3E,MAAM;AAEN,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\";\r\nimport type {Narrow, ServerNarrow} from \"@fast-simon/utilities\";\r\nimport { fastSimonGet } from \"./API\";\r\nimport {FacetsParser, ServerFacet} from \"@fast-simon/utilities\"\r\nimport {AncestorCategory} from \"../@types/categories\";\r\nimport {EditorProduct} from \"../@types/editorProduct\";\r\ninterface LandingPageRequest {\r\n uuid: string;\r\n storeID: string;\r\n landingPage: string\r\n type: number\r\n page?: number\r\n sortBy?: SortBy\r\n facets?: boolean\r\n narrow?: Narrow\r\n productsPerPage?: number\r\n withProductAttributes?: boolean\r\n searchWithinResultsQuery?: string\r\n}\r\n\r\ninterface LandingPageFacetsOnly extends Omit<LandingPageRequest, \"facets\"> {\r\n avoid_tag_prefixes?: string\r\n}\r\n\r\ninterface LandingPageServerResponseFacetsOnly {\r\n total_results: number\r\n term: string\r\n narrow?: ServerNarrow\r\n facets_completed: true\r\n facets: ServerFacet[],\r\n}\r\n\r\ninterface LandingPageServerResponseAll {\r\n items: EditorProduct[]\r\n alternatives?: string[]\r\n facets_completed: boolean\r\n narrow?: ServerNarrow[]\r\n p: number\r\n total_p: number\r\n total_results: number\r\n term: string\r\n lp_slug: string\r\n title: string\r\n index_page: number\r\n banner_html: string\r\n banner_html_mobile: string\r\n facets: ServerFacet[]\r\n sort_by: SortBy\r\n avoid_tag_prefixes?: string\r\n cms_number_found?: number\r\n within_search_results_for?: string,\r\n ancestor_categories?: AncestorCategory[]\r\n}\r\n\r\n// const BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\r\nconst BASE_URL = \"https://yslp---internal-v3joil6oqa-uc.a.run.app/search\"\r\n\r\ninterface LandingPageResponse {\r\n items: EditorProduct[]\r\n facets_completed: boolean\r\n narrow?: Narrow[]\r\n p: number\r\n total_p: number\r\n isp_quick_view_mode: number\r\n related_results: boolean\r\n total_results: number\r\n lp_slug: string\r\n title: string\r\n facets: ServerFacet[]\r\n sort_by: SortBy\r\n avoid_tag_prefixes?: string\r\n // data: LandingPageResults,\r\n // getFacetsOnly?: () => Promise<Facet[]>\r\n}\r\n\r\nexport const LandingPage = {\r\n landingPage: async ({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page = 1,\r\n sortBy = \"relevency\",\r\n facets = true,\r\n narrow,\r\n productsPerPage,\r\n withProductAttributes = undefined,\r\n searchWithinResultsQuery,\r\n type, // }: LandingPageRequest): Promise<LandingPageResponse> => {\r\n // const narrowParm = narrow ? new NarrowParser().toServerNarrow(narrow) : undefined;\r\n //\r\n // const data = await fastSimonGet<LandingPageServerResponseAll>(BASE_URL, 'landing_page_editor', {\r\n // UUID: uuid,\r\n // store_id: storeID,\r\n // facets_required: facets ? 1 : 0,\r\n // products_per_page: productsPerPage,\r\n // narrow: JSON.stringify(narrow),\r\n // lp: landingPage,\r\n // page_num: page,\r\n // type: type,\r\n // // sort_by: sortBy,\r\n // // with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,\r\n // with_product_attributes: withProductAttributes,\r\n // search_within_search: searchWithinResultsQuery ? searchWithinResultsQuery : undefined,\r\n // visual_merchandising: !searchWithinResultsQuery && !narrow.length ? JSON.stringify(visualMerchandising).replaceAll('\"[', '[').replaceAll(']\"', ']') : undefined,\r\n // // merchandising_editor: 1,\r\n // // disable_merchandising: 1,\r\n // // related_search: 1\r\n // m: 1\r\n // });\r\n visualMerchandising,\r\n merchandisingRules,\r\n }: any) => {\r\n const params: Record<string, any> = {\r\n UUID: uuid,\r\n store_id: storeID,\r\n facets_required: facets ? 1 : 0,\r\n products_per_page: productsPerPage,\r\n narrow: JSON.stringify(narrow),\r\n lp: landingPage,\r\n page_num: page,\r\n type: type,\r\n // sort_by: sortBy,\r\n // with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,\r\n with_product_attributes: withProductAttributes,\r\n search_within_search: searchWithinResultsQuery\r\n ? searchWithinResultsQuery\r\n : undefined,\r\n visual_merchandising:\r\n type == 0\r\n ? JSON.stringify(visualMerchandising)\r\n .replaceAll('\"[', \"[\")\r\n .replaceAll(']\"', \"]\")\r\n : undefined,\r\n // merchandising_editor: 1,\r\n // disable_merchandising: 1,\r\n // related_search: 1\r\n m: 1,\r\n // merchandising_rules: merchandising_rules ? JSON.stringify(merchandising_rules).replaceAll('\"[', '[').replaceAll(']\"', ']') : undefined\r\n merchandising_rules:\r\n type == 1 ? JSON.stringify(merchandisingRules) : undefined,\r\n };\r\n // if(lastProduct) {\r\n // params['last_product'] = lastProduct\r\n // }\r\n const res = await await fastSimonGet<LandingPageResponse>(\r\n BASE_URL,\r\n \"landing_page_editor\",\r\n params\r\n );\r\n // const res = await API.post<LandingPageResponse>({url: BASE_URL+'/landing_page_editor', data: params, config: {headers: {'content-type': 'text/plain'}}});\r\n return {\r\n data: res,\r\n getFacets: async () =>\r\n res?.facets_completed\r\n ? transformFacetsOnlyData(\r\n res.facets,\r\n res.avoid_tag_prefixes\r\n )\r\n : await LandingPage.landingPageFacetsOnly({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page,\r\n narrow,\r\n type,\r\n productsPerPage,\r\n searchWithinResultsQuery,\r\n withProductAttributes,\r\n visualMerchandising,\r\n merchandisingRules,\r\n }),\r\n };\r\n // return {\r\n // data: data,\r\n // getFacets: async () => (data?.facets_completed ? transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes) : await LandingPage.landingPageFacetsOnly({uuid,\r\n // storeID,\r\n // landingPage,\r\n // narrow,\r\n // type,\r\n // page,\r\n // productsPerPage,\r\n // searchWithinResultsQuery})\r\n // )\r\n // }\r\n },\r\n\r\n landingPageFacetsOnly: async ({\r\n uuid,\r\n storeID,\r\n landingPage,\r\n page = 1,\r\n narrow,\r\n type,\r\n productsPerPage,\r\n searchWithinResultsQuery,\r\n withProductAttributes = false,\r\n visualMerchandising,\r\n merchandisingRules,\r\n }: any) => {\r\n // }: LandingPageFacetsOnly): Promise<Facet[]> => {\r\n\r\n const data = await fastSimonGet<LandingPageServerResponseAll>(\r\n BASE_URL,\r\n \"landing_page_editor\",\r\n {\r\n UUID: uuid,\r\n store_id: storeID,\r\n facets_required: 2,\r\n products_per_page: productsPerPage,\r\n narrow: JSON.stringify(narrow),\r\n type: type,\r\n lp: landingPage,\r\n page_num: page ?? 1,\r\n // sort_by: sortBy,\r\n // with_product_attributes: withProductAttributes || get(ispOptions)?.with_product_attributes,\r\n with_product_attributes: withProductAttributes,\r\n search_within_search: searchWithinResultsQuery\r\n ? searchWithinResultsQuery\r\n : undefined,\r\n visual_merchandising:\r\n type == 0\r\n ? JSON.stringify(visualMerchandising)\r\n .replaceAll('\"[', \"[\")\r\n .replaceAll(']\"', \"]\")\r\n : undefined,\r\n merchandising_rules: merchandisingRules\r\n ? JSON.stringify(merchandisingRules)\r\n : undefined,\r\n m: 1,\r\n }\r\n );\r\n\r\n return transformFacetsOnlyData(data.facets, data.avoid_tag_prefixes);\r\n },\r\n};\r\n\r\n// const transformData = (r: LandingPageServerResponseAll): LandingPageResults => ({\r\n // narrow: r.narrow ? new NarrowParser().toNarrow(r.narrow) : {},\r\n // sortBy: r.sort_by,\r\n // totalResults: r.total_results,\r\n // page: r.p,\r\n // totalPages: r.total_p,\r\n // lpSlug: r.lp_slug,\r\n // // products: ProductParser.parseProducts(r.items),\r\n // products: r.items,\r\n // productIDS: r.items.map(product => String(product.id)),\r\n // facets: new FacetsParser().parseFacets(r.facets, r.avoid_tag_prefixes ? r.avoid_tag_prefixes.split(\",\") : []),\r\n // avoidTagPrefixes: r.avoid_tag_prefixes ? r.avoid_tag_prefixes.split(\",\") : [],\r\n // bannerHTML: r?.banner_html ?? \"\",\r\n // bannerHTMLMobile: r?.banner_html_mobile ?? \"\",\r\n // indexPage: r.index_page,\r\n // title: r.title,\r\n // sort: r.sort_by,\r\n // ancestors: new FacetsParser().parseAncestors(r?.ancestor_categories)\r\n// });\r\n\r\nexport const transformFacetsOnlyData = (r: ServerFacet[], avoidTagPrefixes?: string) => new FacetsParser().parseFacets(r, avoidTagPrefixes ? avoidTagPrefixes.split(\",\") : []);"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class CustomTagsFilters {
|
|
2
|
+
static setCustomTagsFilters(customTagsFilters) {
|
|
3
|
+
localStorage.setItem('customTagsFilters', JSON.stringify(customTagsFilters));
|
|
4
|
+
}
|
|
5
|
+
static getCustomTagsFilters() {
|
|
6
|
+
const storedFilters = localStorage.getItem('customTagsFilters');
|
|
7
|
+
return storedFilters ? JSON.parse(storedFilters) : [];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=customTagsFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customTagsFilters.js","sourceRoot":"","sources":["../../src/utils/customTagsFilters.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,iBAAiB;IAC1B,MAAM,CAAC,oBAAoB,CAAC,iBAA2B;QACnD,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,CAAC,oBAAoB;QACvB,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAChE,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,CAAC;CACJ","sourcesContent":["export class CustomTagsFilters {\r\n static setCustomTagsFilters(customTagsFilters: string[]) {\r\n localStorage.setItem('customTagsFilters', JSON.stringify(customTagsFilters));\r\n }\r\n\r\n static getCustomTagsFilters(): string[] {\r\n const storedFilters = localStorage.getItem('customTagsFilters');\r\n return storedFilters ? JSON.parse(storedFilters) : [];\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EditorProduct } from "../@types/editorProduct";
|
|
2
|
+
export declare const ProductsUtils: {
|
|
3
|
+
/**
|
|
4
|
+
* Change the position of multiple products, starting from index a and moving n products to index b, in use for multiple product actions
|
|
5
|
+
* Use the splice method to extract and remove the products from their original positions, then use the splice method again to insert them into the new positions
|
|
6
|
+
* Time complexity O(n), where n is the number of elements in the array that being modified
|
|
7
|
+
* @param products - is the current products state
|
|
8
|
+
* @param startIndex - is the starting index
|
|
9
|
+
* @param numberOfProducts - is the number of products to move
|
|
10
|
+
* @param destIndex - is the destination index you want to insert the product into
|
|
11
|
+
**/
|
|
12
|
+
changeProductsPosition: (products: EditorProduct[], startIndex: number, numberOfProducts: number, destIndex: number) => EditorProduct[];
|
|
13
|
+
/**
|
|
14
|
+
* Change position of a single product
|
|
15
|
+
* Use the splice method to remove the product from its original position and insert it into the new position.
|
|
16
|
+
* time complexity O(n)
|
|
17
|
+
* @param gridItems - is the current products state
|
|
18
|
+
* @param oldIndex - is the index of the product to move
|
|
19
|
+
* @param newIndex - is the destination index
|
|
20
|
+
**/
|
|
21
|
+
changeProductPosition: (gridItems: EditorProduct[], oldIndex: number, newIndex: number) => EditorProduct[];
|
|
22
|
+
/**
|
|
23
|
+
* Add product (hidden/unpublished/promotile) to specific position in the products array
|
|
24
|
+
* Use the splice method to remove the product from its original position and insert it into the new position.
|
|
25
|
+
* @param products - is the current products state
|
|
26
|
+
* @param productToAdd - is the new product to add
|
|
27
|
+
* @param destIndex - is the destination index
|
|
28
|
+
**/
|
|
29
|
+
addProductToIndex: (products: EditorProduct[], productToAdd: EditorProduct, destIndex: number) => EditorProduct[];
|
|
30
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const ProductsUtils = {
|
|
2
|
+
/**
|
|
3
|
+
* Change the position of multiple products, starting from index a and moving n products to index b, in use for multiple product actions
|
|
4
|
+
* Use the splice method to extract and remove the products from their original positions, then use the splice method again to insert them into the new positions
|
|
5
|
+
* Time complexity O(n), where n is the number of elements in the array that being modified
|
|
6
|
+
* @param products - is the current products state
|
|
7
|
+
* @param startIndex - is the starting index
|
|
8
|
+
* @param numberOfProducts - is the number of products to move
|
|
9
|
+
* @param destIndex - is the destination index you want to insert the product into
|
|
10
|
+
**/
|
|
11
|
+
changeProductsPosition: (products, startIndex, numberOfProducts, destIndex) => {
|
|
12
|
+
products.splice(destIndex - numberOfProducts + 1, 0, ...products.splice(startIndex, numberOfProducts));
|
|
13
|
+
return products;
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* Change position of a single product
|
|
17
|
+
* Use the splice method to remove the product from its original position and insert it into the new position.
|
|
18
|
+
* time complexity O(n)
|
|
19
|
+
* @param gridItems - is the current products state
|
|
20
|
+
* @param oldIndex - is the index of the product to move
|
|
21
|
+
* @param newIndex - is the destination index
|
|
22
|
+
**/
|
|
23
|
+
changeProductPosition: (gridItems, oldIndex, newIndex) => {
|
|
24
|
+
gridItems.splice(newIndex, 0, gridItems.splice(oldIndex, 1)[0]);
|
|
25
|
+
return gridItems;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Add product (hidden/unpublished/promotile) to specific position in the products array
|
|
29
|
+
* Use the splice method to remove the product from its original position and insert it into the new position.
|
|
30
|
+
* @param products - is the current products state
|
|
31
|
+
* @param productToAdd - is the new product to add
|
|
32
|
+
* @param destIndex - is the destination index
|
|
33
|
+
**/
|
|
34
|
+
addProductToIndex: (products, productToAdd, destIndex) => {
|
|
35
|
+
products.splice(destIndex, 0, productToAdd);
|
|
36
|
+
return products;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/utils/products.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG;IAEzB;;;;;;;;QAQI;IACJ,sBAAsB,EAAE,CAAC,QAAyB,EAAE,UAAkB,EAAE,gBAAwB,EAAE,SAAiB,EAAE,EAAE;QACnH,QAAQ,CAAC,MAAM,CAAC,SAAS,GAAC,gBAAgB,GAAC,CAAC,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACnG,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;;;;;;QAOI;IACJ,qBAAqB,EAAE,CAAC,SAA0B,EAAE,QAAgB,EAAE,QAAgB,EAAE,EAAE;QACtF,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;;;;;QAMI;IACJ,iBAAiB,EAAE,CAAC,QAAyB,EAAE,YAA2B,EAAE,SAAiB,EAAE,EAAE;QAC7F,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC;IACpB,CAAC;CAGJ,CAAA","sourcesContent":["import {EditorProduct} from \"../@types/editorProduct\";\r\n\r\nexport const ProductsUtils = {\r\n\r\n /**\r\n * Change the position of multiple products, starting from index a and moving n products to index b, in use for multiple product actions\r\n * Use the splice method to extract and remove the products from their original positions, then use the splice method again to insert them into the new positions\r\n * Time complexity O(n), where n is the number of elements in the array that being modified\r\n * @param products - is the current products state\r\n * @param startIndex - is the starting index\r\n * @param numberOfProducts - is the number of products to move\r\n * @param destIndex - is the destination index you want to insert the product into\r\n **/\r\n changeProductsPosition: (products: EditorProduct[], startIndex: number, numberOfProducts: number, destIndex: number) => {\r\n products.splice(destIndex-numberOfProducts+1, 0, ...products.splice(startIndex, numberOfProducts));\r\n return products;\r\n },\r\n\r\n /**\r\n * Change position of a single product\r\n * Use the splice method to remove the product from its original position and insert it into the new position.\r\n * time complexity O(n)\r\n * @param gridItems - is the current products state\r\n * @param oldIndex - is the index of the product to move\r\n * @param newIndex - is the destination index\r\n **/\r\n changeProductPosition: (gridItems: EditorProduct[], oldIndex: number, newIndex: number) => {\r\n gridItems.splice(newIndex, 0, gridItems.splice(oldIndex, 1)[0]);\r\n return gridItems;\r\n },\r\n\r\n /**\r\n * Add product (hidden/unpublished/promotile) to specific position in the products array\r\n * Use the splice method to remove the product from its original position and insert it into the new position.\r\n * @param products - is the current products state\r\n * @param productToAdd - is the new product to add\r\n * @param destIndex - is the destination index\r\n **/\r\n addProductToIndex: (products: EditorProduct[], productToAdd: EditorProduct, destIndex: number) => {\r\n products.splice(destIndex, 0, productToAdd);\r\n return products;\r\n }\r\n\r\n\r\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shopifyMarkets.js","sourceRoot":"","sources":["../../src/utils/shopifyMarkets.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,cAAc;IAChC,MAAM,CAAC,UAAU;;QACZ,OAAO,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,OAAO,0CAAE,OAAO,CAAC;IAC7C,CAAC;CACJ","sourcesContent":["export default class ShopifyMarkets {\r\n static getCountry() {\r\n return (window as any)?.Shopify?.country;\r\n }\r\n}"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
areaRef: React.RefObject<HTMLDivElement>;
|
|
4
|
+
selectables: HTMLElement[];
|
|
5
|
+
areaId: string;
|
|
6
|
+
onSelectCommitted?: (selectedIDS: string[]) => void;
|
|
7
|
+
onSelect: (ids: Record<string, number>) => void;
|
|
8
|
+
isDragAndDropActive: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onDispatch: (key: string, value: any) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const useDragToSelect: ({ areaRef, selectables, areaId, onSelectCommitted, onSelect, isDragAndDropActive, disabled, onDispatch, }: Props) => void;
|
|
13
|
+
export {};
|