@fast-simon/dashboard-utilities 1.0.39 → 1.0.40

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.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { ProductLabelType } from "../../@types/productLabel";
3
+ export interface Props {
4
+ position?: number;
5
+ label?: ProductLabelType;
6
+ isUnpublished?: boolean;
7
+ onlyUnpublished?: boolean;
8
+ sellable?: boolean;
9
+ }
10
+ declare const ProductLabel: React.FC<Props>;
11
+ export default ProductLabel;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classes from './styles.module.css';
3
+ import { labelToColorDict } from "./utils";
4
+ const ProductLabel = ({ position, label, isUnpublished, onlyUnpublished, sellable }) => {
5
+ return (_jsxs("div", Object.assign({ className: classes.productLabelContainer }, { children: [_jsxs("div", Object.assign({ className: classes.badgesContainer }, { children: [!onlyUnpublished && label &&
6
+ _jsx("div", Object.assign({ className: classes.labelText, style: { backgroundColor: labelToColorDict[label], color: "white" } }, { children: label })), isUnpublished &&
7
+ _jsx("div", Object.assign({ className: classes.labelText, style: { backgroundColor: labelToColorDict['Unpublished'], color: "white", marginTop: "2px" } }, { children: "Unpublished" })), !sellable && !isUnpublished &&
8
+ _jsx("div", Object.assign({ className: classes.labelText, style: { backgroundColor: 'black', color: "white", marginTop: "2px" } }, { children: "Out of Stock" }))] })), !onlyUnpublished && position !== undefined && (_jsx("div", Object.assign({ className: classes.productPosition }, { children: position })))] })));
9
+ };
10
+ export default ProductLabel;
11
+ //# sourceMappingURL=ProductLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductLabel.js","sourceRoot":"","sources":["../../../src/components/ProductLabel/ProductLabel.tsx"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAYzC,MAAM,YAAY,GAAoB,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAC,EAAE,EAAE;IAClG,OAAO,CACH,6BAAK,SAAS,EAAE,OAAO,CAAC,qBAAqB,iBACzC,6BAAK,SAAS,EAAE,OAAO,CAAC,eAAe,iBAClC,CAAC,eAAe,IAAI,KAAK;wBACtB,4BAAK,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,EAAC,eAAe,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,gBAC/F,KAAK,IACJ,EAET,aAAa;wBACV,4BAAK,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,EAAC,eAAe,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAC,iCAExH,EAET,CAAC,QAAQ,IAAI,CAAC,aAAa;wBACxB,4BAAK,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,EAAC,eAAe,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAC,kCAEhG,KAER,EACL,CAAC,eAAe,IAAI,QAAQ,KAAK,SAAS,IAAI,CAC3C,4BAAK,SAAS,EAAE,OAAO,CAAC,eAAe,gBAAG,QAAQ,IAAO,CAC5D,KAEC,CACT,CAAC;AACN,CAAC,CAAA;AACD,eAAe,YAAY,CAAC","sourcesContent":["import React from 'react';\r\nimport classes from './styles.module.css';\r\nimport {labelToColorDict} from \"./utils\";\r\nimport {ProductLabelType} from \"../../@types/productLabel\";\r\n\r\nexport interface Props {\r\n position?: number;\r\n label?: ProductLabelType;\r\n isUnpublished?: boolean;\r\n\r\n onlyUnpublished?: boolean;\r\n sellable?: boolean;\r\n}\r\n\r\nconst ProductLabel: React.FC<Props> = ({position, label, isUnpublished, onlyUnpublished, sellable}) => {\r\n return (\r\n <div className={classes.productLabelContainer}>\r\n <div className={classes.badgesContainer}>\r\n {!onlyUnpublished && label &&\r\n <div className={classes.labelText} style={{backgroundColor: labelToColorDict[label], color: \"white\"}}>\r\n {label}\r\n </div>\r\n }\r\n {isUnpublished &&\r\n <div className={classes.labelText} style={{backgroundColor: labelToColorDict['Unpublished'], color: \"white\", marginTop: \"2px\"}}>\r\n Unpublished\r\n </div>\r\n }\r\n {!sellable && !isUnpublished &&\r\n <div className={classes.labelText} style={{backgroundColor: 'black', color: \"white\", marginTop: \"2px\"}}>\r\n Out of Stock\r\n </div>\r\n }\r\n </div>\r\n {!onlyUnpublished && position !== undefined && (\r\n <div className={classes.productPosition}>{position}</div>\r\n )}\r\n\r\n </div>\r\n );\r\n}\r\nexport default ProductLabel;\r\n"]}
@@ -0,0 +1 @@
1
+ export { default } from "./ProductLabel";
@@ -0,0 +1,2 @@
1
+ export { default } from "./ProductLabel";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ProductLabel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from \"./ProductLabel\";\r\n"]}
@@ -0,0 +1,42 @@
1
+ .productLabelContainer {
2
+ width: inherit;
3
+ font-size: 12px;
4
+ display: flex;
5
+ align-items: center;
6
+ flex-direction: row;
7
+ position: absolute;
8
+ justify-content: space-between;
9
+ top: 6px;
10
+ }
11
+
12
+ .productPosition {
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ margin-right: 6px;
17
+ padding: 5px 5px;
18
+ border-radius: 50px;
19
+ border: 1px solid #00000017;
20
+ background-color: #ffffffc9;
21
+ min-width: 16px;
22
+ min-height: 16px;
23
+ width: fit-content;
24
+ height: fit-content;
25
+ }
26
+
27
+ .productLabelContainerWithText {
28
+ color: white;
29
+ }
30
+
31
+ .labelText {
32
+ display: flex;
33
+ justify-content: center;
34
+ padding: 4px 4px;
35
+ border-radius: 0 4px 4px 0;
36
+ }
37
+
38
+ .badgesContainer {
39
+ display: flex;
40
+ flex-direction: column;
41
+ justify-content: space-between;
42
+ }
@@ -0,0 +1,8 @@
1
+ export declare const labelToColorDict: {
2
+ Promoted: string;
3
+ Selected: string;
4
+ Pinned: string;
5
+ Buried: string;
6
+ Hidden: string;
7
+ Unpublished: string;
8
+ };
@@ -0,0 +1,9 @@
1
+ export const labelToColorDict = {
2
+ 'Promoted': '#008847',
3
+ 'Selected': '#008847',
4
+ 'Pinned': '#0093E5',
5
+ 'Buried': '#EA0C19',
6
+ 'Hidden': '#EA0C19',
7
+ 'Unpublished': '#880000d1'
8
+ };
9
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/ProductLabel/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;IACnB,aAAa,EAAE,WAAW;CAC7B,CAAA","sourcesContent":["export const labelToColorDict = {\r\n 'Promoted': '#008847',\r\n 'Selected': '#008847',\r\n 'Pinned': '#0093E5',\r\n 'Buried': '#EA0C19',\r\n 'Hidden': '#EA0C19',\r\n 'Unpublished': '#880000d1'\r\n}"]}
@@ -0,0 +1,5 @@
1
+ interface SelectCardProps {
2
+ numSelected: number;
3
+ }
4
+ declare const SelectCard: ({ numSelected }: SelectCardProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default SelectCard;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classes from "./styles.module.css";
3
+ const SelectCard = ({ numSelected }) => {
4
+ return (_jsx("div", Object.assign({ className: classes.selectCardContainer }, { children: _jsx("div", Object.assign({ className: classes.selectCardText }, { children: numSelected })) })));
5
+ };
6
+ export default SelectCard;
7
+ //# sourceMappingURL=SelectCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectCard.js","sourceRoot":"","sources":["../../../src/components/SelectCard/SelectCard.tsx"],"names":[],"mappings":";AAAA,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAM1C,MAAM,UAAU,GAAG,CAAC,EAAE,WAAW,EAAmB,EAAE,EAAE;IACtD,OAAO,CACL,4BAAK,SAAS,EAAE,OAAO,CAAC,mBAAmB,gBACzC,4BAAK,SAAS,EAAE,OAAO,CAAC,cAAc,gBAAG,WAAW,IAAO,IACvD,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import classes from \"./styles.module.css\";\r\n\r\ninterface SelectCardProps {\r\n numSelected: number;\r\n}\r\n\r\nconst SelectCard = ({ numSelected }: SelectCardProps) => {\r\n return (\r\n <div className={classes.selectCardContainer}>\r\n <div className={classes.selectCardText}>{numSelected}</div>\r\n </div>\r\n );\r\n};\r\n\r\nexport default SelectCard;\r\n"]}
@@ -0,0 +1 @@
1
+ export { default } from "./SelectCard";
@@ -0,0 +1,2 @@
1
+ export { default } from "./SelectCard";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SelectCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { default } from \"./SelectCard\";\r\n"]}
@@ -0,0 +1,21 @@
1
+ .selectCardContainer {
2
+ width: 100%;
3
+ height: 100%;
4
+ position: relative;
5
+ background: rgba(255, 255, 255, 0.8);
6
+ backdrop-filter: blur(10px);
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ flex-direction: column;
11
+ border: 2px solid #ebebeb;
12
+ border-radius: 6px;
13
+ transition: border ease-in-out 150ms;
14
+ cursor: pointer;
15
+ }
16
+
17
+ .selectCardText {
18
+ font-size: 48px;
19
+ font-weight: 900;
20
+ text-align: center;
21
+ }
package/dist/index.d.ts CHANGED
@@ -15,12 +15,17 @@ import BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu';
15
15
  import InStoreFiltersMenu from './components/InStoreFiltersMenu';
16
16
  import DndContextWrapper from './components/DragAndDrop/DndContextWrapper';
17
17
  import Droppable from './components/DragAndDrop/Droppable';
18
+ import ProductLabel from './components/ProductLabel/ProductLabel';
18
19
  import { SortableItem } from './components/DragAndDrop/SortableItem';
19
20
  import ProductGrid from "./components/productGrid/ProductGrid";
21
+ import SelectCard from "./components/SelectCard/SelectCard";
20
22
  import RenderIfVisible from "./components/RenderIfVisible";
21
23
  import { useDragToSelect } from "./utils/useDragToSelect";
24
+ import { CustomTagsFilters } from "./utils/customTagsFilters";
25
+ import { useProductsPerRow } from "./utils/useProductsPerRow";
22
26
  import { LandingPage } from "./services/landingPage";
23
27
  import { FullTextSearch } from "./services/search";
28
+ import { getFormatProducts } from "./services/getFormatProducts";
24
29
  import { useFastState, useFastStateFunctions } from "./components/FastSimonApi";
25
30
  import { ServerProduct } from "./@types/product";
26
31
  import { FullTextServerResponseAll } from "./@types/results";
@@ -30,4 +35,4 @@ import MainTheme from "./components/FastSimonApi";
30
35
  import { FeaturedRanking } from "@fast-simon/utilities/lib/@types/product";
31
36
  import { Products } from "./services/products";
32
37
  export type { MenuItemName, CustomClasses, SideMenuType, SideMenuItem, ProductLabelType, Banner, EditorProduct, IconProps, ServerProduct, FullTextServerResponseAll, smartCollectionsResults, FeaturedRanking };
33
- export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products };
38
+ export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard };
package/dist/index.js CHANGED
@@ -12,15 +12,20 @@ import BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu';
12
12
  import InStoreFiltersMenu from './components/InStoreFiltersMenu';
13
13
  import DndContextWrapper from './components/DragAndDrop/DndContextWrapper';
14
14
  import Droppable from './components/DragAndDrop/Droppable';
15
+ import ProductLabel from './components/ProductLabel/ProductLabel';
15
16
  import { SortableItem } from './components/DragAndDrop/SortableItem';
16
17
  import ProductGrid from "./components/productGrid/ProductGrid";
18
+ import SelectCard from "./components/SelectCard/SelectCard";
17
19
  import RenderIfVisible from "./components/RenderIfVisible";
18
20
  import { useDragToSelect } from "./utils/useDragToSelect";
21
+ import { CustomTagsFilters } from "./utils/customTagsFilters";
22
+ import { useProductsPerRow } from "./utils/useProductsPerRow";
19
23
  import { LandingPage } from "./services/landingPage";
20
24
  import { FullTextSearch } from "./services/search";
25
+ import { getFormatProducts } from "./services/getFormatProducts";
21
26
  import { useFastState, useFastStateFunctions } from "./components/FastSimonApi";
22
27
  import FastSimonApi from "./components/FastSimonApi/FastSimonApi";
23
28
  import MainTheme from "./components/FastSimonApi";
24
29
  import { Products } from "./services/products";
25
- export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products };
30
+ export { BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible, useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon, RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct, useFastState, useFastStateFunctions, FastSimonApi, MainTheme, Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard };
26
31
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAS,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAgB,eAAe,EAAC,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,qBAAqB,MAAM,oCAAoC,CAAA;AACtE,OAAO,kBAAkB,MAAM,iCAAiC,CAAA;AAChE,OAAO,iBAAiB,MAAM,4CAA4C,CAAA;AAC1E,OAAO,SAAS,MAAM,oCAAoC,CAAA;AAC1D,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAA;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;AAI7E,OAAO,YAAY,MAAM,wCAAwC,CAAA;AACjE,OAAO,SAAS,MAAM,2BAA2B,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAkB9C,OAAO,EACH,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EACnH,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAC3H,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAC,YAAY,EAAE,qBAAqB,EAAC,YAAY,EAAC,SAAS,EAC9H,QAAQ,EACX,CAAC","sourcesContent":["import {CustomClasses, SideMenuType, SideMenuItem, MenuItemName} from \"./@types/sideMenu\"\r\nimport {ProductLabelType} from \"./@types/productLabel\"\r\nimport {videoFormats, Banner} from \"./@types/banner\"\r\nimport {EditorProduct, isEditorProduct} from \"./@types/editorProduct\"\r\nimport {IconProps} from \"./@types/iconProps\"\r\n\r\nimport {BackOfficeFiltersIcon} from \"./icons/BackOfficeFiltersIcon\"\r\nimport {BannersIcon} from \"./icons/BannersIcon\"\r\nimport {HelpIcon} from \"./icons/HelpIcon\"\r\nimport {InStoreFiltersIcon} from \"./icons/InStoreFiltersIcon\"\r\nimport {PromoteIcon} from \"./icons/PromoteIcon\"\r\nimport {RemoveIcon} from \"./icons/RemoveIcon\"\r\nimport {RestoreIcon} from \"./icons/RestoreIcon\"\r\nimport {GeneralIcon} from \"./icons/GeneralIcon\"\r\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu'\r\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu'\r\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper'\r\nimport Droppable from './components/DragAndDrop/Droppable'\r\nimport {SortableItem} from './components/DragAndDrop/SortableItem'\r\nimport ProductGrid from \"./components/productGrid/ProductGrid\";\r\nimport RenderIfVisible from \"./components/RenderIfVisible\";\r\nimport {useDragToSelect} from \"./utils/useDragToSelect\";\r\nimport { LandingPage } from \"./services/landingPage\";\r\nimport { FullTextSearch } from \"./services/search\";\r\nimport {useFastState, useFastStateFunctions} from \"./components/FastSimonApi\"\r\nimport { ServerProduct } from \"./@types/product\"\r\nimport { FullTextServerResponseAll } from \"./@types/results\"\r\nimport { smartCollectionsResults } from \"./@types/categories\"\r\nimport FastSimonApi from \"./components/FastSimonApi/FastSimonApi\"\r\nimport MainTheme from \"./components/FastSimonApi\"\r\nimport { FeaturedRanking } from \"@fast-simon/utilities/lib/@types/product\"\r\nimport { Products } from \"./services/products\"\r\n// export * from './components';\r\n\r\nexport type {\r\n MenuItemName,\r\n CustomClasses,\r\n SideMenuType,\r\n SideMenuItem,\r\n ProductLabelType,\r\n Banner,\r\n EditorProduct,\r\n IconProps,\r\n ServerProduct,\r\n FullTextServerResponseAll,\r\n smartCollectionsResults,\r\n FeaturedRanking\r\n};\r\n\r\nexport {\r\n BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible,\r\n useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon,\r\n RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct,useFastState, useFastStateFunctions,FastSimonApi,MainTheme,\r\n Products\r\n};"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAS,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAgB,eAAe,EAAC,MAAM,wBAAwB,CAAA;AAGrE,OAAO,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AAC/C,OAAO,qBAAqB,MAAM,oCAAoC,CAAA;AACtE,OAAO,kBAAkB,MAAM,iCAAiC,CAAA;AAChE,OAAO,iBAAiB,MAAM,4CAA4C,CAAA;AAC1E,OAAO,SAAS,MAAM,oCAAoC,CAAA;AAC1D,OAAO,YAAY,MAAM,wCAAwC,CAAA;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAA;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAC,YAAY,EAAE,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;AAI7E,OAAO,YAAY,MAAM,wCAAwC,CAAA;AACjE,OAAO,SAAS,MAAM,2BAA2B,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAkB9C,OAAO,EACH,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EACnH,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAC3H,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAC,YAAY,EAAE,qBAAqB,EAAC,YAAY,EAAC,SAAS,EAC9H,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAC9F,CAAC","sourcesContent":["import {CustomClasses, SideMenuType, SideMenuItem, MenuItemName} from \"./@types/sideMenu\"\r\nimport {ProductLabelType} from \"./@types/productLabel\"\r\nimport {videoFormats, Banner} from \"./@types/banner\"\r\nimport {EditorProduct, isEditorProduct} from \"./@types/editorProduct\"\r\nimport {IconProps} from \"./@types/iconProps\"\r\n\r\nimport {BackOfficeFiltersIcon} from \"./icons/BackOfficeFiltersIcon\"\r\nimport {BannersIcon} from \"./icons/BannersIcon\"\r\nimport {HelpIcon} from \"./icons/HelpIcon\"\r\nimport {InStoreFiltersIcon} from \"./icons/InStoreFiltersIcon\"\r\nimport {PromoteIcon} from \"./icons/PromoteIcon\"\r\nimport {RemoveIcon} from \"./icons/RemoveIcon\"\r\nimport {RestoreIcon} from \"./icons/RestoreIcon\"\r\nimport {GeneralIcon} from \"./icons/GeneralIcon\"\r\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu'\r\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu'\r\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper'\r\nimport Droppable from './components/DragAndDrop/Droppable'\r\nimport ProductLabel from './components/ProductLabel/ProductLabel'\r\nimport {SortableItem} from './components/DragAndDrop/SortableItem'\r\nimport ProductGrid from \"./components/productGrid/ProductGrid\";\r\nimport SelectCard from \"./components/SelectCard/SelectCard\";\r\nimport RenderIfVisible from \"./components/RenderIfVisible\";\r\nimport {useDragToSelect} from \"./utils/useDragToSelect\";\r\nimport {CustomTagsFilters} from \"./utils/customTagsFilters\";\r\nimport {useProductsPerRow} from \"./utils/useProductsPerRow\";\r\nimport { LandingPage } from \"./services/landingPage\";\r\nimport { FullTextSearch } from \"./services/search\";\r\nimport { getFormatProducts } from \"./services/getFormatProducts\";\r\nimport {useFastState, useFastStateFunctions} from \"./components/FastSimonApi\"\r\nimport { ServerProduct } from \"./@types/product\"\r\nimport { FullTextServerResponseAll } from \"./@types/results\"\r\nimport { smartCollectionsResults } from \"./@types/categories\"\r\nimport FastSimonApi from \"./components/FastSimonApi/FastSimonApi\"\r\nimport MainTheme from \"./components/FastSimonApi\"\r\nimport { FeaturedRanking } from \"@fast-simon/utilities/lib/@types/product\"\r\nimport { Products } from \"./services/products\"\r\n// export * from './components';\r\n\r\nexport type {\r\n MenuItemName,\r\n CustomClasses,\r\n SideMenuType,\r\n SideMenuItem,\r\n ProductLabelType,\r\n Banner,\r\n EditorProduct,\r\n IconProps,\r\n ServerProduct,\r\n FullTextServerResponseAll,\r\n smartCollectionsResults,\r\n FeaturedRanking\r\n};\r\n\r\nexport {\r\n BackOfficeFiltersMenu, InStoreFiltersMenu, Droppable, DndContextWrapper, SortableItem, ProductGrid, RenderIfVisible,\r\n useDragToSelect, LandingPage, FullTextSearch, BackOfficeFiltersIcon, BannersIcon, HelpIcon, InStoreFiltersIcon, PromoteIcon,\r\n RestoreIcon, RemoveIcon, GeneralIcon, videoFormats, isEditorProduct,useFastState, useFastStateFunctions,FastSimonApi,MainTheme,\r\n Products, getFormatProducts, useProductsPerRow, ProductLabel, CustomTagsFilters, SelectCard\r\n};"]}
@@ -0,0 +1,13 @@
1
+ import { CategoryNavigationResponse } from "../@types/categoriesNavigation";
2
+ interface Props {
3
+ uuid: string;
4
+ storeID: number;
5
+ collectionID?: string;
6
+ productIDS: string[];
7
+ }
8
+ export declare const getFormatProducts: ({ uuid, storeID, collectionID, productIDS }: Props) => Promise<{
9
+ data: CategoryNavigationResponse;
10
+ getFacets: () => Promise<import("@fast-simon/utilities").Facet[]>;
11
+ }>;
12
+ export declare const getFormatProductsFacetsOnly: ({ uuid, storeID, collectionID, productIDS }: Props) => Promise<import("@fast-simon/utilities").Facet[]>;
13
+ export {};
@@ -0,0 +1,44 @@
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 { transformFacetsOnlyData } from "./search";
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 getFormatProducts = ({ uuid, storeID, collectionID, productIDS }) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const params = {
16
+ UUID: uuid,
17
+ store_id: storeID,
18
+ category_id: collectionID,
19
+ facets_required: 1,
20
+ products: JSON.stringify(productIDS).replace(/["'\[\]]/g, "")
21
+ };
22
+ const res = yield fastSimonGet(BASE_URL, 'get_format_products_editor', params);
23
+ return {
24
+ data: res,
25
+ getFacets: () => __awaiter(void 0, void 0, void 0, function* () {
26
+ return ((res === null || res === void 0 ? void 0 : res.facets_completed) ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) :
27
+ yield getFormatProductsFacetsOnly({
28
+ uuid, storeID, collectionID, productIDS
29
+ }));
30
+ })
31
+ };
32
+ });
33
+ export const getFormatProductsFacetsOnly = ({ uuid, storeID, collectionID, productIDS }) => __awaiter(void 0, void 0, void 0, function* () {
34
+ const params = {
35
+ UUID: uuid,
36
+ store_id: storeID,
37
+ category_id: collectionID,
38
+ facets_required: 2,
39
+ products: JSON.stringify(productIDS).replace(/["'\[\]]/g, "")
40
+ };
41
+ const res = yield fastSimonGet(BASE_URL, 'get_format_products_editor', params);
42
+ return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);
43
+ });
44
+ //# sourceMappingURL=getFormatProducts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFormatProducts.js","sourceRoot":"","sources":["../../src/services/getFormatProducts.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAC,YAAY,EAAC,MAAM,OAAO,CAAC;AACnC,OAAO,EAAC,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAEjD,MAAM,QAAQ,GAAG,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qBAAqB,mCAAI,iDAAiD,CAAC;AAU5G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAO,EACI,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,UAAU,EACN,EAAE,EAAE;IAEhD,MAAM,MAAM,GAAG;QACX,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,YAAY;QACzB,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KAChE,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,YAAY,CAA6B,QAAQ,EAAE,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAE3G,OAAO;QACH,IAAI,EAAE,GAAG;QACT,SAAS,EAAE,GAAS,EAAE;YAAC,OAAA,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,gBAAgB,EAAC,CAAC,CAAC,uBAAuB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;gBACzG,MAAM,2BAA2B,CAAC;oBAC9B,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU;iBAC1C,CAAC,CAAC,CAAA;UAAA;KACV,CAAC;AACN,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAO,EACN,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,UAAU,EACN,EAAE,EAAE;IAEhD,MAAM,MAAM,GAAG;QACX,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,OAAO;QACjB,WAAW,EAAE,YAAY;QACzB,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;KAChE,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,YAAY,CAA6B,QAAQ,EAAE,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAE3G,OAAO,uBAAuB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACvE,CAAC,CAAA,CAAA","sourcesContent":["import {CategoryNavigationResponse} from \"../@types/categoriesNavigation\";\r\nimport {fastSimonGet} from \"./API\";\r\nimport {transformFacetsOnlyData} from \"./search\";\r\n\r\nconst BASE_URL = import.meta.env.VITE_SERVING_BASE_URL ?? \"https://internal-v3joil6oqa-uc.a.run.app/search\";\r\n\r\ninterface Props {\r\n uuid: string;\r\n storeID: number;\r\n collectionID?: string;\r\n\r\n productIDS: string[];\r\n}\r\n\r\nexport const getFormatProducts = async ({\r\n uuid,\r\n storeID,\r\n collectionID,\r\n productIDS\r\n }: Props) => {\r\n\r\n const params = {\r\n UUID: uuid,\r\n store_id: storeID,\r\n category_id: collectionID,\r\n facets_required: 1,\r\n products: JSON.stringify(productIDS).replace(/[\"'\\[\\]]/g, \"\")\r\n };\r\n const res = await fastSimonGet<CategoryNavigationResponse>(BASE_URL, 'get_format_products_editor', params);\r\n\r\n return {\r\n data: res,\r\n getFacets: async () => (res?.facets_completed ? transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes) :\r\n await getFormatProductsFacetsOnly({\r\n uuid, storeID, collectionID, productIDS\r\n }))\r\n };\r\n}\r\n\r\nexport const getFormatProductsFacetsOnly = async ({\r\n uuid,\r\n storeID,\r\n collectionID,\r\n productIDS\r\n }: Props) => {\r\n\r\n const params = {\r\n UUID: uuid,\r\n store_id: storeID,\r\n category_id: collectionID,\r\n facets_required: 2,\r\n products: JSON.stringify(productIDS).replace(/[\"'\\[\\]]/g, \"\")\r\n };\r\n const res = await fastSimonGet<CategoryNavigationResponse>(BASE_URL, 'get_format_products_editor', params);\r\n\r\n return transformFacetsOnlyData(res.facets, res.avoid_tag_prefixes);\r\n}"]}
@@ -0,0 +1,3 @@
1
+ export declare const useProductsPerRow: () => {
2
+ productsPerRow: number;
3
+ };
@@ -0,0 +1,19 @@
1
+ import { useEffect, useState } from "react";
2
+ const PRODUCTS_PER_ROW_KEY = 'fs-products-per-row';
3
+ export const useProductsPerRow = () => {
4
+ const [productsPerRow, setProductsPerRow] = useState(Number(localStorage.getItem(PRODUCTS_PER_ROW_KEY)) || 4);
5
+ const set = (e) => {
6
+ setProductsPerRow(e.detail.productsPerRow);
7
+ localStorage.setItem(PRODUCTS_PER_ROW_KEY, e.detail.productsPerRow);
8
+ };
9
+ useEffect(() => {
10
+ document.addEventListener('editor-products-per-row', set);
11
+ return () => {
12
+ document.removeEventListener('editor-products-per-row', set);
13
+ };
14
+ }, []);
15
+ return {
16
+ productsPerRow
17
+ };
18
+ };
19
+ //# sourceMappingURL=useProductsPerRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProductsPerRow.js","sourceRoot":"","sources":["../../src/utils/useProductsPerRow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE1C,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAElC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9G,MAAM,GAAG,GAAG,CAAC,CAAM,EAAE,EAAE;QACnB,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC3C,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACxE,CAAC,CAAA;IAED,SAAS,CAAC,GAAG,EAAE;QACX,QAAQ,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC1D,OAAO,GAAG,EAAE;YACR,QAAQ,CAAC,mBAAmB,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QACjE,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACH,cAAc;KACjB,CAAA;AACL,CAAC,CAAA","sourcesContent":["import {useEffect, useState} from \"react\";\r\n\r\nconst PRODUCTS_PER_ROW_KEY = 'fs-products-per-row';\r\nexport const useProductsPerRow = () => {\r\n\r\n const [productsPerRow, setProductsPerRow] = useState(Number(localStorage.getItem(PRODUCTS_PER_ROW_KEY)) || 4);\r\n\r\n const set = (e: any) => {\r\n setProductsPerRow(e.detail.productsPerRow);\r\n localStorage.setItem(PRODUCTS_PER_ROW_KEY, e.detail.productsPerRow);\r\n }\r\n\r\n useEffect(() => {\r\n document.addEventListener('editor-products-per-row', set);\r\n return () => {\r\n document.removeEventListener('editor-products-per-row', set);\r\n };\r\n }, []);\r\n\r\n return {\r\n productsPerRow\r\n }\r\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-simon/dashboard-utilities",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "preview": "vite preview",