@fast-simon/dashboard-utilities 1.0.1 → 1.0.2

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.
@@ -1,12 +1,5 @@
1
- import { BuriedIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/BuriedIcon";
2
- import { HiddenIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/HiddenIcon";
3
- import { PinIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/PinIcon";
4
1
  import { PromoteIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/PromoteIcon";
5
- import { CutIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/CutIcon";
6
- import { RestoreIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/RestoreIcon";
7
2
  import { RemoveIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/RemoveIcon";
8
- import { PositionIcon } from "../../../../../../../../frontends/dashboard-utilities/src/icons/PositionIcon";
9
- import Positioning from "../Positioning";
10
3
  export const ActionsBarItems = [
11
4
  {
12
5
  getIcon: (customClasses) => PromoteIcon.call(undefined, { height: 40, width: 40, customClasses: customClasses }),
@@ -14,43 +7,6 @@ export const ActionsBarItems = [
14
7
  hooverTooltip: 'Promote',
15
8
  isVisible: (product) => true
16
9
  },
17
- {
18
- getIcon: (customClasses) => BuriedIcon.call(undefined, { height: 35, width: 35, customClasses: customClasses }),
19
- name: 'bury',
20
- hooverTooltip: 'Bury',
21
- isVisible: (product) => (product === null || product === void 0 ? void 0 : product.productLabel) !== 'Buried'
22
- },
23
- {
24
- getIcon: (customClasses) => CutIcon.call(undefined, { height: 40, width: 40, customClasses: customClasses }),
25
- name: 'cut',
26
- hooverTooltip: 'Cut',
27
- isVisible: () => false
28
- },
29
- {
30
- getIcon: (customClasses) => PositionIcon.call(undefined, { customClasses: customClasses }),
31
- getComponent: (onChangeCommitted, currentPosition) => Positioning.call(undefined, { onChangeCommitted: onChangeCommitted, currentPosition: currentPosition }),
32
- name: 'position',
33
- hooverTooltip: 'Position',
34
- isVisible: () => true
35
- },
36
- {
37
- getIcon: (customClasses) => RestoreIcon.call(undefined, { height: 40, width: 40, customClasses: customClasses }),
38
- name: 'restore',
39
- hooverTooltip: 'Restore',
40
- isVisible: (product) => (['Buried', 'Promoted', 'Pinned'].includes((product === null || product === void 0 ? void 0 : product.productLabel) || ''))
41
- },
42
- {
43
- getIcon: (customClasses) => HiddenIcon.call(undefined, { height: 26, width: 32, customClasses: customClasses }),
44
- name: 'hide',
45
- hooverTooltip: 'Hide',
46
- isVisible: (product) => (product === null || product === void 0 ? void 0 : product.productLabel) !== 'Hidden'
47
- },
48
- {
49
- getIcon: (customClasses) => PinIcon.call(undefined, { height: 40, width: 40, customClasses: customClasses }),
50
- name: 'pin',
51
- hooverTooltip: 'Pin',
52
- isVisible: (product) => (!['Promoted', 'Pinned', 'Buried'].includes((product === null || product === void 0 ? void 0 : product.productLabel) || ''))
53
- },
54
10
  {
55
11
  getIcon: (customClasses) => RemoveIcon.call(undefined, { height: 40, width: 40, customClasses: customClasses }),
56
12
  name: 'remove',
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../../../../dashboard/dashboard-client/src/pages/LandingPages/editor/components/ActionsBar/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4EAA4E,CAAC;AACtG,OAAO,EAAC,UAAU,EAAC,MAAM,4EAA4E,CAAC;AACtG,OAAO,EAAC,OAAO,EAAC,MAAM,yEAAyE,CAAC;AAChG,OAAO,EAAC,WAAW,EAAC,MAAM,6EAA6E,CAAC;AACxG,OAAO,EAAC,OAAO,EAAC,MAAM,yEAAyE,CAAC;AAChG,OAAO,EAAC,WAAW,EAAC,MAAM,6EAA6E,CAAC;AACxG,OAAO,EAAC,UAAU,EAAC,MAAM,4EAA4E,CAAC;AAEtG,OAAO,EAAC,YAAY,EAAC,MAAM,8EAA8E,CAAC;AAC1G,O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AO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,EAAE,CAAC,CAAC;KACpG;IACA;QACG,OAAO,EAAE,CAAC,aAA6B,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,EAAC,CAAC;QAC7H,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK;KAChC;CACJ,CAAA","sourcesContent":["import {BuriedIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/BuriedIcon\";\r\nimport {HiddenIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/HiddenIcon\";\r\nimport {PinIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/PinIcon\";\r\nimport {PromoteIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/PromoteIcon\";\r\nimport {CutIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/CutIcon\";\r\nimport {RestoreIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/RestoreIcon\";\r\nimport {RemoveIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/RemoveIcon\";\r\nimport {EditorProduct} from \"../../../../../../../../frontends/dashboard-utilities/src/@types/editorProduct\";\r\nimport {PositionIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/PositionIcon\";\r\nimport Positioning from \"../Positioning\";\r\n\r\nexport interface CustomClasses {\r\n wrapper?: string,\r\n svg?: string,\r\n path?: string\r\n}\r\n\r\nexport type ActionItemName = | 'bury' | 'hide' | 'unpublish' | 'pin' | 'promote' | 'cut' | 'restore' | 'position' | 'remove';\r\n\r\nexport interface ActionItem {\r\n getIcon?: (customClasses?: CustomClasses) => JSX.Element;\r\n getComponent?: (onChangeCommitted: (newPosition: number) => void, currentPosition: number) => JSX.Element;\r\n name: ActionItemName;\r\n hooverTooltip?: string;\r\n beforeExpand?: boolean;\r\n\r\n isVisible?: (product: EditorProduct) => boolean;\r\n}\r\n\r\nexport const ActionsBarItems: ActionItem[] = [\r\n {\r\n getIcon: (customClasses?: CustomClasses) => PromoteIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'promote',\r\n hooverTooltip: 'Promote',\r\n isVisible: (product) => true\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => BuriedIcon.call(undefined, {height: 35, width: 35, customClasses: customClasses}),\r\n name: 'bury',\r\n hooverTooltip: 'Bury',\r\n isVisible: (product) => product?.productLabel !== 'Buried'\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => CutIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'cut',\r\n hooverTooltip: 'Cut',\r\n isVisible: () => false\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => PositionIcon.call(undefined, {customClasses: customClasses}),\r\n getComponent: (onChangeCommitted, currentPosition) => Positioning.call(undefined, {onChangeCommitted: onChangeCommitted, currentPosition: currentPosition}),\r\n name: 'position',\r\n hooverTooltip: 'Position',\r\n isVisible: () => true\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => RestoreIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'restore',\r\n hooverTooltip: 'Restore',\r\n isVisible: (product) => (['Buried', 'Promoted', 'Pinned'].includes(product?.productLabel || ''))\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => HiddenIcon.call(undefined, {height: 26, width: 32, customClasses: customClasses}),\r\n name: 'hide',\r\n hooverTooltip: 'Hide',\r\n isVisible: (product) => product?.productLabel !== 'Hidden'\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => PinIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'pin',\r\n hooverTooltip: 'Pin',\r\n isVisible: (product) => (!['Promoted', 'Pinned', 'Buried'].includes(product?.productLabel || ''))\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => RemoveIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'remove',\r\n hooverTooltip: 'Remove',\r\n isVisible: (product) => false\r\n }\r\n]"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../../../../../../dashboard/dashboard-client/src/pages/LandingPages/editor/components/ActionsBar/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,6EAA6E,CAAC;AAExG,OAAO,EAAC,UAAU,EAAC,MAAM,4EAA4E,CAAC;AAqBtG,MAAM,CAAC,MAAM,eAAe,GAAiB;IACzC;QACI,OAAO,EAAE,CAAC,aAA6B,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,EAAC,CAAC;QAC9H,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,SAAS;QACxB,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI;KAC/B;IACD;QACI,OAAO,EAAE,CAAC,aAA6B,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,aAAa,EAAC,CAAC;QAC7H,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,QAAQ;QACvB,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK;KAChC;CACJ,CAAA","sourcesContent":["import {PromoteIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/PromoteIcon\";\r\nimport {RestoreIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/RestoreIcon\";\r\nimport {RemoveIcon} from \"../../../../../../../../frontends/dashboard-utilities/src/icons/RemoveIcon\";\r\nimport {EditorProduct} from \"../../../../../../../../frontends/dashboard-utilities/src/@types/editorProduct\";\r\n\r\nexport interface CustomClasses {\r\n wrapper?: string,\r\n svg?: string,\r\n path?: string\r\n}\r\n\r\nexport type ActionItemName = | 'bury' | 'hide' | 'unpublish' | 'pin' | 'promote' | 'cut' | 'restore' | 'position' | 'remove';\r\n\r\nexport interface ActionItem {\r\n getIcon?: (customClasses?: CustomClasses) => JSX.Element;\r\n getComponent?: (onChangeCommitted: (newPosition: number) => void, currentPosition: number) => JSX.Element;\r\n name: ActionItemName;\r\n hooverTooltip?: string;\r\n beforeExpand?: boolean;\r\n\r\n isVisible?: (product: EditorProduct) => boolean;\r\n}\r\n\r\nexport const ActionsBarItems: ActionItem[] = [\r\n {\r\n getIcon: (customClasses?: CustomClasses) => PromoteIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'promote',\r\n hooverTooltip: 'Promote',\r\n isVisible: (product) => true\r\n },\r\n {\r\n getIcon: (customClasses?: CustomClasses) => RemoveIcon.call(undefined, {height: 40, width: 40, customClasses: customClasses}),\r\n name: 'remove',\r\n hooverTooltip: 'Remove',\r\n isVisible: (product) => false\r\n }\r\n]"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCard.js","sourceRoot":"","sources":["../../../../../../../../../../../dashboard/dashboard-client/src/pages/LandingPages/editor/components/ProductCard/ProductCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAsB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,YAAY,MAAM,wCAAwC,CAAC;AAClE,OAAO,UAAU,MAAM,0BAA0B,CAAC;AA0BlD,MAAM,WAAW,GAAoB,CAAC,EACpC,OAAO,EACP,QAAQ,EACR,OAAO,EACP,U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AW,EAAE,GACvB,CACH,KAOG,EACN,6BAAK,SAAS,EAAE,OAAO,CAAC,oBAAoB,iBAC1C,4BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,CAChB,gBAEA,OAAO,CAAC,CAAC,IACN,EAEL,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,GAAG,KAAI,CACtB,4BAAK,SAAS,EAAE,OAAO,CAAC,UAAU,gBAAG,OAAO,CAAC,GAAG,IAAO,CACxD,EAED,4BAAK,SAAS,EAAE,OAAO,CAAC,yBAAyB,gBAC/C,4BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,kBAAkB;gCACxB,CAAC,CAAC,OAAO,CAAC,2BAA2B;gCACrC,CAAC,CAAC,EAAE,CACP,gBAEA,OAAO,CAAC,CAAC,KAAK,MAAM,IAAI,CACvB,6BAAK,SAAS,EAAE,OAAO,CAAC,qBAAqB,iBAC1C,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACrB,6BAAK,SAAS,EAAE,OAAO,CAAC,cAAc,sBAAI,OAAO,CAAC,GAAG,KAAO,CAC7D,CAAC,CAAC,CAAC,IAAI,EAER,6BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,YAAY,EACpB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAC3D,sBAEC,OAAO,CAAC,CAAC,KACP,KACF,CACP,IACG,IACF,KACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport clsx from \"clsx\";\nimport { EditorProduct } from \"../../../../../../../../frontends/dashboard-utilities/src/@types/editorProduct\";\nimport { ProductsUtils } from \"../../../../../../../../frontends/dashboard-utilities/src/utils/products\";\nimport classes from \"./styles.module.css\";\nimport { useVisualEditorContext } from \"../../context/visualEditorContext\";\nimport { NO_IMAGE } from \"./utils\";\nimport ProductLabel from \"./components/ProductLabel/ProductLabel\";\nimport ActionsBar from \"../ActionsBar/ActionsBar\";\nimport { ActionItem as ActionItemType, ActionItem } from \"../ActionsBar/utils\";\n\ninterface CustomClasses {\n productCard?: string;\n actionsContainer?: string;\n}\n\nexport interface Props {\n product: EditorProduct;\n position?: number;\n onClick: (event: React.MouseEvent<HTMLDivElement>) => void;\n isSelected: boolean;\n renderingRules?: {\n actionsBar: boolean;\n label: boolean;\n sku: boolean;\n };\n customClasses?: CustomClasses;\n\n onActionClicked?: (action: ActionItem) => void;\n\n actionBarItems?: ActionItemType[];\n onDropClicked?: (position: number) => void;\n}\n\nconst ProductCard: React.FC<Props> = ({\n product,\n position,\n onClick,\n isSelected,\n renderingRules,\n customClasses,\n onActionClicked,\n actionBarItems,\n onDropClicked,\n}) => {\n const { state, dispatcher } = useVisualEditorContext();\n\n const [isActionbarVisible, setIsActionbarVisible] = useState(false);\n\n const promote = (productsCopy: EditorProduct[], productIndex: number) => {\n productsCopy[productIndex][\"productLabel\"] = \"Promoted\";\n if (\n state.searchWithinResultsQuery != \"\" ||\n Object.keys(state.narrow).length\n ) {\n dispatcher.setProducts(productsCopy);\n } else {\n productsCopy = [productsCopy.splice(productIndex, 1)[0], ...productsCopy];\n dispatcher.setProducts(productsCopy);\n }\n dispatcher.setPromoted([\n product.id,\n ...state.promoted.filter((id) => id !== product.id),\n ]);\n };\n const remove = (\n productsCopy: EditorProduct[],\n productIndex: number,\n pos?: number\n ) => {\n dispatcher.setPromoted(state.promoted.filter((id) => id !== product.id));\n productsCopy.splice(productIndex, 1);\n dispatcher.setProducts(productsCopy);\n };\n\n const onActionClick = useCallback(\n (action: ActionItem, newPosition?: number) => {\n if (onActionClicked) {\n onActionClicked(action);\n return;\n }\n if (!position) {\n return;\n }\n const productsCopy = [...state.products];\n const productIndex = position - 1;\n if (action.name === \"promote\") {\n promote(productsCopy, productIndex);\n } else if (action.name === \"remove\") {\n remove(productsCopy, productIndex);\n }\n },\n [{ ...dispatcher }]\n );\n\n const onDrop = (event: any) => {\n if (position !== undefined) {\n event.stopPropagation();\n event.preventDefault();\n onDropClicked?.(position ?? -1);\n }\n };\n\n const getSmallImage = (url?: string) => {\n if (!url || !url.includes(\"cdn.shopify\")) {\n // temp solution, pass the platform as a prop\n return url;\n }\n url = url.replace(\"_large.\", \".\").replace(\"_small.\", \".\");\n const splattedURL = url.split(\".\");\n splattedURL[splattedURL.length - 2] = `${\n splattedURL[splattedURL.length - 2]\n }_300x`;\n return splattedURL.join(\".\");\n };\n\n const getPosition = useCallback(() => {\n const pinProduct = state.pinned?.find((pin) => pin[1] === product.id);\n if (\n (state.searchWithinResultsQuery || Object.keys(state.narrow).length) &&\n pinProduct\n ) {\n return pinProduct[0] + 1;\n } else if (\n state.searchWithinResultsQuery ||\n Object.keys(state.narrow).length\n ) {\n return undefined;\n }\n return position;\n }, [position, product.id, state.searchWithinResultsQuery, state.narrow]);\n\n return (\n <div\n className={clsx(\n classes.productCard,\n isSelected ? classes.selectedProductCard : \"\",\n customClasses?.productCard,\n \"product-card\"\n )}\n onClick={(event) => onClick(event)}\n onMouseLeave={() => setIsActionbarVisible(false)}\n onMouseEnter={() => setIsActionbarVisible(true)}\n onMouseOver={() => setIsActionbarVisible(true)}\n >\n <div className={classes.imageAndActionsContainer}>\n <ProductLabel\n key={product.id + \"_\" + product?.productLabel}\n // position={(!state.searchWithinResultsQuery && !Object.keys(state.narrow).length) ? (!state.loading.products ? position : position || undefined) : positionInSearchWithin}\n position={position}\n label={product?.productLabel}\n isUnpublished={product?.is_unpublished}\n onlyUnpublished={false}\n sellable={!product?.iso}\n />\n\n <div className={classes.imageWrapper}>\n <img\n src={\n getSmallImage(product?.t) ||\n getSmallImage(product?.t2) ||\n NO_IMAGE\n }\n alt={\"product image\"}\n className={classes.image}\n onError={(event) => ((event.target as any).src = NO_IMAGE)}\n />\n </div>\n {renderingRules?.actionsBar && isActionbarVisible && (\n <ActionsBar\n onClick={onActionClick}\n className={clsx(\n classes.actionsContainer,\n customClasses?.actionsContainer\n )}\n product={product}\n actionBarItems={actionBarItems}\n position={getPosition()}\n />\n )}\n {/*{renderingRules.sevenDaysSells && product?.inv_sale && (*/}\n {/* <InventoryInfo*/}\n {/* product={product}*/}\n {/* isOverlayOpen={isInventoryOverlayOpen || isInventoryOverlayPinned}*/}\n {/* />*/}\n {/*)}*/}\n </div>\n <div className={classes.productInfoContainer}>\n <div\n className={clsx(\n classes.productTitle,\n classes.ellipsisTitle,\n classes.twoRows\n )}\n >\n {product.l}\n </div>\n\n {renderingRules?.sku && (\n <div className={classes.productSku}>{product.sku}</div>\n )}\n\n <div className={classes.productInfoContentWrapper}>\n <div\n className={clsx(\n classes.productInfoContent\n ? classes.productInfoContentWithSells\n : \"\"\n )}\n >\n {product.p !== \"0.00\" && (\n <div className={classes.productPriceContainer}>\n {Number(product.p_c) ? (\n <div className={classes.productCompare}>${product.p_c}</div>\n ) : null}\n\n <div\n className={clsx(\n classes.productPrice,\n Number(product.p_c) ? classes.productPriceWithCompare : \"\"\n )}\n >\n ${product.p}\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\nexport default ProductCard;\n"]}
1
+ {"version":3,"file":"ProductCard.js","sourceRoot":"","sources":["../../../../../../../../../../../dashboard/dashboard-client/src/pages/LandingPages/editor/components/ProductCard/ProductCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAsB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,YAAY,MAAM,wCAAwC,CAAC;AAClE,OAAO,UAAU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aAAa,CAAE,gBAAgB,CAChC,EACD,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,WAAW,EAAE,GACvB,CACH,KAOG,EACN,6BAAK,SAAS,EAAE,OAAO,CAAC,oBAAoB,iBAC1C,4BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,OAAO,CAChB,gBAEA,OAAO,CAAC,CAAC,IACN,EAEL,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,GAAG,KAAI,CACtB,4BAAK,SAAS,EAAE,OAAO,CAAC,UAAU,gBAAG,OAAO,CAAC,GAAG,IAAO,CACxD,EAED,4BAAK,SAAS,EAAE,OAAO,CAAC,yBAAyB,gBAC/C,4BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,kBAAkB;gCACxB,CAAC,CAAC,OAAO,CAAC,2BAA2B;gCACrC,CAAC,CAAC,EAAE,CACP,gBAEA,OAAO,CAAC,CAAC,KAAK,MAAM,IAAI,CACvB,6BAAK,SAAS,EAAE,OAAO,CAAC,qBAAqB,iBAC1C,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACrB,6BAAK,SAAS,EAAE,OAAO,CAAC,cAAc,sBAAI,OAAO,CAAC,GAAG,KAAO,CAC7D,CAAC,CAAC,CAAC,IAAI,EAER,6BACE,SAAS,EAAE,IAAI,CACb,OAAO,CAAC,YAAY,EACpB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAC3D,sBAEC,OAAO,CAAC,CAAC,KACP,KACF,CACP,IACG,IACF,KACF,KACF,CACP,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport clsx from \"clsx\";\nimport { EditorProduct } from \"../../../../../../../../frontends/dashboard-utilities/src/@types/editorProduct\";\nimport classes from \"./styles.module.css\";\nimport { useVisualEditorContext } from \"../../context/visualEditorContext\";\nimport { NO_IMAGE } from \"./utils\";\nimport ProductLabel from \"./components/ProductLabel/ProductLabel\";\nimport ActionsBar from \"../ActionsBar/ActionsBar\";\nimport { ActionItem as ActionItemType, ActionItem } from \"../ActionsBar/utils\";\n\ninterface CustomClasses {\n productCard?: string;\n actionsContainer?: string;\n}\n\nexport interface Props {\n product: EditorProduct;\n position?: number;\n onClick: (event: React.MouseEvent<HTMLDivElement>) => void;\n isSelected: boolean;\n renderingRules?: {\n actionsBar: boolean;\n label: boolean;\n sku: boolean;\n };\n customClasses?: CustomClasses;\n\n onActionClicked?: (action: ActionItem) => void;\n\n actionBarItems?: ActionItemType[];\n onDropClicked?: (position: number) => void;\n}\n\nconst ProductCard: React.FC<Props> = ({\n product,\n position,\n onClick,\n isSelected,\n renderingRules,\n customClasses,\n onActionClicked,\n actionBarItems,\n onDropClicked,\n}) => {\n const { state, dispatcher } = useVisualEditorContext();\n\n const [isActionbarVisible, setIsActionbarVisible] = useState(false);\n\n const promote = (productsCopy: EditorProduct[], productIndex: number) => {\n productsCopy[productIndex][\"productLabel\"] = \"Promoted\";\n if (\n state.searchWithinResultsQuery != \"\" ||\n Object.keys(state.narrow).length\n ) {\n dispatcher.setProducts(productsCopy);\n } else {\n productsCopy = [productsCopy.splice(productIndex, 1)[0], ...productsCopy];\n dispatcher.setProducts(productsCopy);\n }\n dispatcher.setPromoted([\n product.id,\n ...state.promoted.filter((id) => id !== product.id),\n ]);\n };\n const remove = (\n productsCopy: EditorProduct[],\n productIndex: number,\n pos?: number\n ) => {\n dispatcher.setPromoted(state.promoted.filter((id) => id !== product.id));\n productsCopy.splice(productIndex, 1);\n dispatcher.setProducts(productsCopy);\n };\n\n const onActionClick = useCallback(\n (action: ActionItem, newPosition?: number) => {\n if (onActionClicked) {\n onActionClicked(action);\n return;\n }\n if (!position) {\n return;\n }\n const productsCopy = [...state.products];\n const productIndex = position - 1;\n if (action.name === \"promote\") {\n promote(productsCopy, productIndex);\n } else if (action.name === \"remove\") {\n remove(productsCopy, productIndex);\n }\n },\n [{ ...dispatcher }]\n );\n\n const onDrop = (event: any) => {\n if (position !== undefined) {\n event.stopPropagation();\n event.preventDefault();\n onDropClicked?.(position ?? -1);\n }\n };\n\n const getSmallImage = (url?: string) => {\n if (!url || !url.includes(\"cdn.shopify\")) {\n // temp solution, pass the platform as a prop\n return url;\n }\n url = url.replace(\"_large.\", \".\").replace(\"_small.\", \".\");\n const splattedURL = url.split(\".\");\n splattedURL[splattedURL.length - 2] = `${\n splattedURL[splattedURL.length - 2]\n }_300x`;\n return splattedURL.join(\".\");\n };\n\n const getPosition = useCallback(() => {\n const pinProduct = state.pinned?.find((pin) => pin[1] === product.id);\n if (\n (state.searchWithinResultsQuery || Object.keys(state.narrow).length) &&\n pinProduct\n ) {\n return pinProduct[0] + 1;\n } else if (\n state.searchWithinResultsQuery ||\n Object.keys(state.narrow).length\n ) {\n return undefined;\n }\n return position;\n }, [position, product.id, state.searchWithinResultsQuery, state.narrow]);\n\n return (\n <div\n className={clsx(\n classes.productCard,\n isSelected ? classes.selectedProductCard : \"\",\n customClasses?.productCard,\n \"product-card\"\n )}\n onClick={(event) => onClick(event)}\n onMouseLeave={() => setIsActionbarVisible(false)}\n onMouseEnter={() => setIsActionbarVisible(true)}\n onMouseOver={() => setIsActionbarVisible(true)}\n >\n <div className={classes.imageAndActionsContainer}>\n <ProductLabel\n key={product.id + \"_\" + product?.productLabel}\n // position={(!state.searchWithinResultsQuery && !Object.keys(state.narrow).length) ? (!state.loading.products ? position : position || undefined) : positionInSearchWithin}\n position={position}\n label={product?.productLabel}\n isUnpublished={product?.is_unpublished}\n onlyUnpublished={false}\n sellable={!product?.iso}\n />\n\n <div className={classes.imageWrapper}>\n <img\n src={\n getSmallImage(product?.t) ||\n getSmallImage(product?.t2) ||\n NO_IMAGE\n }\n alt={\"product image\"}\n className={classes.image}\n onError={(event) => ((event.target as any).src = NO_IMAGE)}\n />\n </div>\n {renderingRules?.actionsBar && isActionbarVisible && (\n <ActionsBar\n onClick={onActionClick}\n className={clsx(\n classes.actionsContainer,\n customClasses?.actionsContainer\n )}\n product={product}\n actionBarItems={actionBarItems}\n position={getPosition()}\n />\n )}\n {/*{renderingRules.sevenDaysSells && product?.inv_sale && (*/}\n {/* <InventoryInfo*/}\n {/* product={product}*/}\n {/* isOverlayOpen={isInventoryOverlayOpen || isInventoryOverlayPinned}*/}\n {/* />*/}\n {/*)}*/}\n </div>\n <div className={classes.productInfoContainer}>\n <div\n className={clsx(\n classes.productTitle,\n classes.ellipsisTitle,\n classes.twoRows\n )}\n >\n {product.l}\n </div>\n\n {renderingRules?.sku && (\n <div className={classes.productSku}>{product.sku}</div>\n )}\n\n <div className={classes.productInfoContentWrapper}>\n <div\n className={clsx(\n classes.productInfoContent\n ? classes.productInfoContentWithSells\n : \"\"\n )}\n >\n {product.p !== \"0.00\" && (\n <div className={classes.productPriceContainer}>\n {Number(product.p_c) ? (\n <div className={classes.productCompare}>${product.p_c}</div>\n ) : null}\n\n <div\n className={clsx(\n classes.productPrice,\n Number(product.p_c) ? classes.productPriceWithCompare : \"\"\n )}\n >\n ${product.p}\n </div>\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n};\nexport default ProductCard;\n"]}
@@ -0,0 +1,7 @@
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';
@@ -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'"]}
@@ -1 +1,9 @@
1
- export {};
1
+ import { EditorProduct } from './@types/editorProduct';
2
+ import { SideMenuType, MenuItemName } from './@types/sideMenu';
3
+ import { videoFormats } from './@types/banner';
4
+ import { ProductLabelType } from './@types/productLabel';
5
+ import DndContextWrapper from './components/DragAndDrop/DndContextWrapper';
6
+ import BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu/BackOfficeFiltersMenu';
7
+ import InStoreFiltersMenu from './components/InStoreFiltersMenu/InStoreFiltersMenu';
8
+ import * as Icons from './icons';
9
+ export type { EditorProduct, SideMenuType, MenuItemName, DndContextWrapper, Icons, videoFormats, ProductLabelType, BackOfficeFiltersMenu, InStoreFiltersMenu };
@@ -1,6 +1,2 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import ReactDOM from "react-dom";
4
- import App from "./App";
5
- ReactDOM.render(_jsx(React.StrictMode, { children: _jsx(App, {}) }), document.getElementById('root'));
1
+ export {};
6
2
  //# sourceMappingURL=main.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/main.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,QAAQ,CAAC,MAAM,CACb,KAAC,KAAK,CAAC,UAAU,cACb,KAAC,GAAG,KAAG,GACQ,EACnB,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAChC,CAAA","sourcesContent":["import React from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\nimport App from \"./App\";\r\n\r\nReactDOM.render(\r\n <React.StrictMode>\r\n <App />\r\n </React.StrictMode>,\r\n document.getElementById('root')\r\n)\r\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/main.ts"],"names":[],"mappings":"","sourcesContent":["\nimport { EditorProduct } from './@types/editorProduct';\nimport { SideMenuType, MenuItemName } from './@types/sideMenu';\nimport { videoFormats } from './@types/banner';\nimport { ProductLabelType } from './@types/productLabel';\nimport DndContextWrapper from './components/DragAndDrop/DndContextWrapper';\nimport BackOfficeFiltersMenu from './components/BackOfficeFiltersMenu/BackOfficeFiltersMenu';\nimport InStoreFiltersMenu from './components/InStoreFiltersMenu/InStoreFiltersMenu';\nimport * as Icons from './icons';\n\nexport type { EditorProduct, SideMenuType, MenuItemName, DndContextWrapper, Icons, videoFormats, ProductLabelType,\n BackOfficeFiltersMenu, InStoreFiltersMenu };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fast-simon/dashboard-utilities",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "preview": "vite preview",