@bikdotai/bik-component-library 0.0.657-1 → 0.0.657-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/product.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +7 -12
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.d.ts +11 -0
- package/dist/cjs/components/product-picker-v2/style.js +43 -16
- package/dist/cjs/components/product-picker-v2/variant.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/cjs/components/product-picker-v2/variantComponents.d.ts +2 -1
- package/dist/cjs/components/product-picker-v2/variantComponents.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/product.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/product-picker-v2/productInfoOverlay.js +8 -13
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/style.d.ts +11 -0
- package/dist/esm/components/product-picker-v2/style.js +41 -14
- package/dist/esm/components/product-picker-v2/variant.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/product-picker-v2/variantComponents.d.ts +2 -1
- package/dist/esm/components/product-picker-v2/variantComponents.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),h=require("./productInfoOverlay.js"),p=require("./productScreen.js"),S=require("./rearrangeScreen.js"),x=require("./reducers.js"),g=require("./searchScreen.js"),C=require("./selectedScreen.js"),j=require("./style.js"),y=require("./type.js"),m=require("./utility.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:b,selectedItems:f,onClose:v,visible:k,zIndex:P,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:R,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:E,width:A,left:w,renderWithoutModal:B,onClickSave:L,pickerType:M,hideProductVariants:V=!1,startupScreen:z=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:W=!1,showProductDetails:_,containerStyle:H,crossButtonInsideHeader:G=!1,footerForNonModal:K={},primaryButton:U,secondaryButton:Y,subtitle:J}=e,[Q,X]=c.useReducer(x.collectionsReducer,{}),[Z,ee]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections),[te,oe]=c.useState("grid"),[ce,re]=c.useState(""),[se,ne]=c.useState(""),[ie,le]=c.useState(0),[ae,de]=c.useState(!1),[ue,he]=c.useState(0),[pe,Se]=c.useState(""),[xe,ge]=c.useState(!1),[Ce,je]=c.useState(!1),[ye,me]=c.useReducer(x.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(x.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=c.useRef(null),[ke,Pe]=c.useState(!1),[Ie,Oe]=c.useState();c.useEffect((()=>{de(!0),je(!0),e.collectionFetcher(ie,b).then((e=>{console.log("collectionsParsed?.collections",null==e?void 0:e.collections),X({type:"fetched",data:(null==e?void 0:e.collections)||{}}),de(!1),le((e=>e+1)),je(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;V?Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&be[-1]&&(null===(c=be[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Q,be,V]),c.useEffect((()=>{se&&(de(!0),e.productFetcher(se,b).then((e=>{Object.keys(e).length&&X({type:"productsFetched",data:{collectionId:se,products:e}}),de(!1)})).catch())}),[se]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==Z&&(pe.length||"collections"!==Z)&&(pe.length?(ge(!0),e.searchFetcher(b,pe).then((e=>{"collections"in e&&"products"in e?(me({type:"set",data:e}),X({type:"searched",data:e.collections})):(me({type:"set",data:{collections:{},products:e}}),X({type:"searched",data:e})),ee("searchProducts"),de(!1),ge(!1)}))):ee("collections"))}),800);return()=>clearTimeout(t)}),[pe]),c.useEffect((()=>{L&&(e.onAdd(be,ue),Fe())}),[L]),c.useEffect((()=>{W&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[W,be,ue]);const Fe=()=>{fe({type:"reset",data:{}})},Re=()=>I&&ue>I?t.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&ue>O?t.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):ue>0?t.jsx(n.Button,{onClick:()=>{ee($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:I?`${ue}/${I} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(Z)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Z)}):t.jsx(n.Button,{disabled:!0,buttonText:I?`${ue}/${I} products selected`:`${ue} products selected`,buttonType:"tertiaryGray"}),Te=e=>ae?"Loading...":Z===exports.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",De=t.jsxs(j.ContainerStyle,Object.assign({style:null!=H?H:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===Z||"searchProducts"===Z)&&t.jsx("div",Object.assign({style:{padding:B?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(i.Input,{placeholder:"Search products using name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>xe?t.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:pe,onChangeText:e=>{e.length&&e.trim().length?Se(e):Se("")}})}))}),t.jsxs(j.ScrollContainerStyle,Object.assign({ref:ve,screenName:Z},{children:["collections"===Z&&t.jsx(u.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:Ce,collections:Q,selectedCollectionsDispatch:fe,setCollectionId:re,setSelectedCollectionId:ne,setScreen:ee,selectedCollections:be,collectionFetcher:e.collectionFetcher,storeId:b,collectionsDispatch:X,setSaveDisabled:de,pagingControls:{curPage:ie,setCurPage:le},hideCollectionCheckbox:F,renderWithoutModal:B,pickerType:M,scrollContainerRef:ve}),"products"===Z&&ce&&t.jsx(x.CollectionIdContext.Provider,Object.assign({value:ce},{children:t.jsx(p.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:ee,storeId:b,data:Q[ce],collectionsDispatch:X,selectedCollectionsDispatch:fe,selectedData:be,setSaveDisabled:de,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:B,pickerType:M,hideProductVariants:V,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{Pe(!0),Oe(e)},showProductDetailInfoIcon:_,scrollContainerRef:ve,pickerWidth:A||"600px"})})),"view"===Z&&t.jsx(C.SelectedScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,hideProductVariants:V,outOfStockAction:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher,pickerWidth:A||"600px"}),"rearrange"===Z&&t.jsx(S.RearrangeScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,outOfStockAction:T,rearrangeViewType:"grid"===te?"list":"grid",scrollContainerRef:ve,storeId:b,fbStatusFetcher:e.fbStatusFetcher,pickerWidth:A||"600px"}),"searchProducts"===Z&&t.jsx(g.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:be||{},searchedCollections:ye||{},searchedCollectionsDispatch:me,selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,onBackPress:()=>{Se(""),me({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:R,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:re,setSelectedCollectionId:ne,renderWithoutModal:B,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return t.jsx(t.Fragment,{children:B?t.jsxs(t.Fragment,{children:[De,K.renderFooter?t.jsxs(j.StyledFooterForNonModal,{children:[Re(),t.jsx(n.Button,{buttonText:Te(K.primaryButtonText),disabled:!K.isLoading&&(ae||ue<1||I&&ue<I||!I&&O&&ue>O)||K.primaryButtonDisabled,isLoading:K.isLoading,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}})]}):t.jsx(t.Fragment,{}),ke&&Ie?t.jsx(h.ProductInfoOverlay,{productData:Ie,outOfStockAction:T,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{Pe(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:P,open:k,onClose:()=>{null==v||v(),Fe()},headingTitle:E||("collections"===Z||"products"===Z?"Select Products":"view"===Z?"Selected Products":"searchProducts"===Z?"Searched Results":"rearrange"===Z?"Rearrange Products":void 0),headingSubtitle:J,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:w||"auto"},headerRightCustomElement:G?t.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:v},{children:t.jsx(s.default,{width:20,height:20,color:r.COLORS.content.secondary})})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:U?(t=>Object.assign(Object.assign({},t),{disabled:!t.isLoading&&(ae||ue<1||I&&ue<I||!I&&O&&ue>O)||t.disabled,onClick:()=>{e.onAdd(be,ue),Fe(),ee([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(z)?z:exports.ScreenName.Collections)}}))(U):{buttonText:Te(),disabled:ae||ue<1||I&&ue<I||!I&&O&&ue>O||!1,onClick:()=>{e.onAdd(be,ue),Fe()}},secondaryButton:Y?(t=>Object.assign(Object.assign({},t),{disabled:ae||ue<1||I&&ue<I||!I&&O&&ue>O||!1,onClick:()=>{const t=m.updateAllVariantsForSelectedProducts(be,Q,ye);e.onAdd(t,ue,!0)}}))(Y):void 0,wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?t.jsx(t.Fragment,{}):Re(),hideCrossButton:ke||G},{children:[De,ke&&Ie?t.jsx(h.ProductInfoOverlay,{productData:Ie,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Pe(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -18,6 +18,7 @@ interface ProductGroupInterface {
|
|
|
18
18
|
showProductDetailInfoIcon?: boolean;
|
|
19
19
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
20
20
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
21
|
+
pickerWidth?: string;
|
|
21
22
|
}
|
|
22
23
|
export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
interface ProductCardInterface {
|
|
@@ -39,6 +40,7 @@ interface ProductCardInterface {
|
|
|
39
40
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
40
41
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
41
42
|
currencyAndPrice?: string;
|
|
43
|
+
pickerWidth?: string;
|
|
42
44
|
}
|
|
43
45
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
44
46
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),d=require("../icon-button/IconButton.js"),c=require("../shimmer-image/ShimmerImage.js"),l=require("../tooltips/Tooltip.js"),r=require("../TypographyStyle.js"),n=require("./constants.js"),a=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),v=require("./utility.js");const p=n=>{var v,p,h,j,y;const{isVariant:I,data:P,productId:g,collectionId:x,variantId:k,isSelected:C,selectedCollectionsDispatch:b,viewOnly:f,upliftAdditions:O,isPartiallyChecked:S,hideProductCheckbox:m,outOfStockAction:T,hideVariantCheckbox:D,hideProductVariants:V,pickerType:w="PRODUCT",onProductDetailClick:q,showProductDetailInfoIcon:A,currencyAndPrice:U,pickerWidth:B}=n,{isVariantForProductPickerTag:$,dataForProductPickerTag:R,tagText:F,tagType:W}=a.ProductHelper.getDataForProductPickerTag(P,I,T);console.log({data:P});const L=I?P.skuId:1===(null===(p=Object.values(null!==(v=null==P?void 0:P.variants)&&void 0!==v?v:{}))||void 0===p?void 0:p.length)?null===(y=null===(j=Object.values(null!==(h=null==P?void 0:P.variants)&&void 0!==h?h:{}))||void 0===j?void 0:j[0])||void 0===y?void 0:y.skuId:void 0;return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:I,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===w&&(m||D)){const e=Object.keys(P.variants);V?C?b({type:"productUnselected",data:{productId:g,collectionId:x}}):O("productSelected",{productId:g,variantId:k,collectionId:x,product:P}):C?b({type:"variantUnselected",data:{productId:g,variantId:k,collectionId:x}}):O("variantSelected",{productId:g,variantId:k||e[0],collectionId:x,variant:P})}},isActive:C},{children:[I&&!f&&!D||!I&&!f&&!m?e.jsx(o.CheckBox,{isChecked:C,isPartiallyChecked:S||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),I?e?O(V?"productSelected":"variantSelected",{productId:g,variantId:k,collectionId:x,variant:P}):b({type:V?"productUnselected":"variantUnselected",data:{productId:g,variantId:k,collectionId:x}}):e?O("productSelected",{productId:g,collectionId:x,product:P}):b({type:"productUnselected",data:{productId:g,collectionId:x}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(c.ShimmerImage,{width:40,height:40,imageUrl:P.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(l.Tooltip,Object.assign({variant:"light",body:P.name,placement:"bottom",delay:400},{children:e.jsxs(u.StyledTitleSmall,Object.assign({style:{width:F?`calc(${B} - 310px)`:`calc(${B} - 160px)`},numberOfLines:1},{children:[P.name,"hsjdh sgfgsdfjhgsdjf sgfhsgfhjsadadaad sadsgf sgfhsjfgjhds"]}))})),e.jsxs(u.ProductInfo,{children:[e.jsx(s.ProductPickerTag,{isVariant:$,data:R,tagText:F,tagType:W}),A&&e.jsx(d.IconButton,{onClick:()=>{null==q||q(P)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})]})),e.jsxs(u.ProductSubTitle,{children:[!(null==R?void 0:R.fbStatus)&&$||F?null:e.jsx(r.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:U})),L&&e.jsx(l.Tooltip,Object.assign({body:L,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${L}`})})}))]})]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,d,c,l,r,a,s,u;const{collectionId:h,productId:j,data:y,selectedData:I,selectedCollectionsDispatch:P,viewOnly:g,upliftAdditions:x,isProductPartiallyChecked:k,hideProductCheckbox:C,outOfStockAction:b,hideVariantCheckbox:f,hideProductVariants:O,pickerType:S,onProductDetailClick:m,showProductDetailInfoIcon:T,pickerWidth:D}=t,V=e=>{var t,i,o,d,c,l;if(!(null===(i=null===(t=null==I?void 0:I[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[j]))return!1;return!!(null===(l=null===(c=null===(d=null===(o=null==I?void 0:I[h])||void 0===o?void 0:o.products)||void 0===d?void 0:d[j])||void 0===c?void 0:c.variants)||void 0===l?void 0:l[e])},w=O||!v.shouldShowVariant(y)?`${y.currency&&null!==(i=n.CurrencySymbols[y.currency])&&void 0!==i?i:""}${null!==(u=null!==(l=null===(c=null===(d=Object.values(null!==(o=y.variants)&&void 0!==o?o:{}))||void 0===d?void 0:d[0])||void 0===c?void 0:c.price)&&void 0!==l?l:null===(s=null===(a=Object.values(null!==(r=y.variants)&&void 0!==r?r:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==u?u:""}`:"";return e.jsxs("div",{children:[e.jsx(p,{isVariant:!1,data:y,productId:j,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==I?void 0:I[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[j])})(),isPartiallyChecked:k,selectedCollectionsDispatch:P,upliftAdditions:x,viewOnly:g,hideProductCheckbox:C,hideVariantCheckbox:f,hideProductVariants:O,pickerType:S,outOfStockAction:b,onProductDetailClick:m,showProductDetailInfoIcon:T,currencyAndPrice:w,pickerWidth:D},j),O?null:v.shouldShowVariant(y)&&Object.keys(y.variants||[]).map((t=>{var i,o,d,c,l,r,a;const s=`${y.currency&&null!==(i=n.CurrencySymbols[y.currency])&&void 0!==i?i:""}${null!==(a=null!==(c=null===(d=null===(o=y.variants)||void 0===o?void 0:o[t])||void 0===d?void 0:d.price)&&void 0!==c?c:null===(r=null===(l=y.variants)||void 0===l?void 0:l[t])||void 0===r?void 0:r.actualPrice)&&void 0!==a?a:""}`;return e.jsx(p,{isVariant:!0,hideVariantCheckbox:f,data:Object.assign(Object.assign({},y.variants[t]),{currency:y.currency}),variantId:t,productId:j,viewOnly:g,upliftAdditions:x,collectionId:h,isSelected:V(t),selectedCollectionsDispatch:P,outOfStockAction:b,onProductDetailClick:m,showProductDetailInfoIcon:T,currencyAndPrice:s,pickerWidth:D},t)}))]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/cross.svg.js"),a=require("../icon-button/IconButton.js"),r=require("../shimmer-image/ShimmerImage.js"),d=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),n=require("./constants.js"),c=require("./helpers/ProductHelper.js"),u=require("./ProductPickerTag.js"),s=require("./style.js"),p=require("./utility.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=v(t);const g=t=>{var i,a,v,x,g,y,j,m,D,I,O,S,P,k,T,q,C,w,B,$;const z=void 0===t.productData.variants;let R;if(z)R=`${t.productData.currency&&null!==(i=n.CurrencySymbols[t.productData.currency])&&void 0!==i?i:""}${null!==(g=null!==(v=null===(a=t.productData)||void 0===a?void 0:a.price)&&void 0!==v?v:null===(x=t.productData)||void 0===x?void 0:x.actualPrice)&&void 0!==g?g:""}`;else{const e=null===(y=t.productData)||void 0===y?void 0:y.currency;R=`${e&&null!==(j=n.CurrencySymbols[e])&&void 0!==j?j:""}${null!==(T=null!==(O=null===(I=null===(D=Object.values(null!==(m=t.productData.variants)&&void 0!==m?m:{}))||void 0===D?void 0:D[0])||void 0===I?void 0:I.price)&&void 0!==O?O:null===(k=null===(P=Object.values(null!==(S=t.productData.variants)&&void 0!==S?S:{}))||void 0===P?void 0:P[0])||void 0===k?void 0:k.actualPrice)&&void 0!==T?T:""}`}const{isVariantForProductPickerTag:L,dataForProductPickerTag:_,tagText:A,tagType:F}=c.ProductHelper.getDataForProductPickerTag(t.productData,z,t.outOfStockAction);console.log({productData:t.productData});const H=z?t.productData.skuId:1===(null===(C=Object.values(null!==(q=t.productData.variants)&&void 0!==q?q:{}))||void 0===C?void 0:C.length)?null===(B=Object.values(null!==(w=t.productData.variants)&&void 0!==w?w:{})[0])||void 0===B?void 0:B.skuId:void 0;return e.jsxs(f,{children:[e.jsx(h,{children:e.jsx(r.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(b,{children:[H&&e.jsx(d.Tooltip,Object.assign({body:H,placement:"top"},{children:e.jsx(s.SKUIDBadge,{children:e.jsx(s.EllipsedBodyTiny,{children:`SKU ID: ${H}`})})})),e.jsx(l.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(l.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(l.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==($=t.productData.description)&&void 0!==$?$:""}}),e.jsx(l.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:z?R:p.shouldShowVariant(t.productData)?null:R})),e.jsx(u.ProductPickerTag,{isVariant:L,data:_,tagText:A,tagType:F})]})]})},y=x.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
word-break: break-word;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,j=x.default.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
background: rgba(0, 0, 0, 0.5);
|
|
24
|
-
`,
|
|
24
|
+
`,m=x.default.div`
|
|
25
25
|
position: relative;
|
|
26
26
|
|
|
27
27
|
.close-button {
|
|
@@ -32,26 +32,21 @@
|
|
|
32
32
|
background: ${o.COLORS.surface.standard};
|
|
33
33
|
border-radius: 50%;
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,f=x.default.div`
|
|
36
36
|
display: flex;
|
|
37
37
|
background: white;
|
|
38
38
|
padding: 24px;
|
|
39
39
|
gap: 24px;
|
|
40
40
|
border-radius: 8px 8px 0px 0px;
|
|
41
|
-
`,
|
|
41
|
+
`,h=x.default.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
max-width: min(50%, 200px);
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
47
|
-
`,
|
|
47
|
+
`,b=x.default.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex: 1;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
gap: 4px;
|
|
52
|
-
|
|
53
|
-
width: fit-content;
|
|
54
|
-
background: ${o.COLORS.background.brandLight};
|
|
55
|
-
padding: 2px 6px;
|
|
56
|
-
border-radius: 14px;
|
|
57
|
-
`;exports.ProductInfoCard=x,exports.ProductInfoOverlay=t=>(console.log("ProductInfoOverlay",t.productData),e.jsxs(g,{children:[e.jsx(v,{}),e.jsx(f,{children:e.jsx(a.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(x,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]}));
|
|
52
|
+
`;exports.ProductInfoCard=g,exports.ProductInfoOverlay=t=>e.jsxs(y,{children:[e.jsx(j,{}),e.jsx(m,{children:e.jsx(a.IconButton,{className:"close-button",onClick:t.onClose,Icon:i.default,width:20,height:20})}),e.jsx(g,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]});
|
|
@@ -25,6 +25,7 @@ interface ProductsScreenInterface {
|
|
|
25
25
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
26
26
|
onProductDetailClick: (productData: Product | ProductVariant) => void;
|
|
27
27
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
28
|
+
pickerWidth?: string;
|
|
28
29
|
}
|
|
29
30
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("../../assets/icons/box.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("../../assets/icons/box.svg.js"),r=require("../../assets/icons/search.svg.js"),c=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),d=require("../InfiniteScroll/InfiniteScroll.js"),u=require("../input/Input.js"),a=require("../spinner/Spinner.js"),h=require("../TypographyStyle.js"),p=require("./emptyState.js"),j=require("./product.js"),v=require("./ProductPickerShimmer.js"),g=require("./reducers.js"),y=require("./style.js"),O=require("./type.js"),b=require("./utility.js");exports.ProductsScreen=f=>{var k,C;const{data:P,collectionsDispatch:x,selectedData:S,selectedCollectionsDispatch:I,productFetcher:m,storeId:q,setScreen:A,setSaveDisabled:D,hideInCollectionSearch:E,customCollectionRestriction:T,hideProductCheckbox:R,outOfStockAction:V=O.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:F=!1,pickerType:w,hideProductVariants:B,fbStatusFetcher:_,onProductDetailClick:W,showProductDetailInfoIcon:M,scrollContainerRef:U,pickerWidth:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[z,G]=s.useState(""),[Q,X]=s.useState(!1),[Y,Z]=s.useState(P),$=s.useRef(!0),ee=s.useRef(!1);s.useEffect((()=>{if($.current)return void($.current=!1);const e=setTimeout((()=>{z.length?(X(!0),f.searchInCollectionFetcher(q,J,z).then((e=>{const t=c.cloneDeep(P);t.products=e,console.log({products:e}),Z(t);const o=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});oe(o,null!=e?e:{},!0),D(!1),X(!1)}))):Z(P)}),800);return()=>clearTimeout(e)}),[z]);s.useEffect((()=>{var e,t,o,r;ee.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=P.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const c=b.getVariantIdsToFetchAtProductLevel(null!==(o=P.products)&&void 0!==o?o:{});oe(c,null!==(r=P.products)&&void 0!==r?r:{})}),[J]);const te=!!T&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||re(10)}),[]);const oe=(e,t,o)=>{_||(o?b.markVariantsAsApprovedProductsLevel(t,x,J,Y,Z):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const r=Object.assign({},t);Object.keys(t).forEach((o=>{var c,s;Object.keys(null!==(s=null===(c=null==t?void 0:t[o])||void 0===c?void 0:c.variants)&&void 0!==s?s:{}).forEach((c=>{var s,n;const i=null===(s=null==t?void 0:t[o].variants)||void 0===s?void 0:s[c];i&&"REJECTED"===e[c]?i.fbStatus="REJECTED":i&&"APPROVED"===e[c]&&(i.fbStatus="APPROVED");const l=null===(n=null==r?void 0:r[o])||void 0===n?void 0:n.variants;l&&l[c]&&(l[c]=i)}))})),o?(Z((e=>{const t=Object.assign({},e);return t.products=r,t})),x({type:"productsPaged",data:{collectionId:J,products:r}})):x({type:"productsPaged",data:{collectionId:J,products:r}})})).catch((e=>{o?b.markVariantsAsApprovedProductsLevel(t,x,J,Y,Z):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},re=e=>{D(!0),X(!0),m(J,q,e,0).then((t=>{if(Object.keys(t).length||(ee.current=!0),Object.keys(t).length){Z(Object.assign(Object.assign({},Y),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);oe(e,t),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},P),{products:t})}}),D(!1),X(!1)})).catch()},ce=(e,t)=>{const o=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},o),{isRestricted:T})})},se=!!(null==S?void 0:S[J])&&!!Object.keys(null!==(C=null===(k=null==S?void 0:S[J])||void 0===k?void 0:k.products)&&void 0!==C?C:{}).length;return e.jsxs("div",{children:[e.jsxs(y.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{A("collections")}}),e.jsx(h.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:P.name}))]}),!E&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Q&&z.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(r.default,{})},id:"listInput",height:"24px",type:"text",value:z,onChangeText:e=>{e.length&&e.trim().length?G(e):G("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==Y?void 0:Y.products)||[]).length>0&&!te&&!z.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:se,isPartiallyChecked:b.isCollectionPartiallyChecked(J,Y,S,B),onValueChange:function(e){e?re():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(o.default,{})})),e.jsx(h.TitleRegular,{children:"All Products"})]}),e.jsx(d.InfiniteScroll,Object.assign({hasData:!(Object.keys((null==Y?void 0:Y.products)||[]).length<10)&&!!Object.keys((null==Y?void 0:Y.products)||[]).length,fetchMore:()=>(N.current=!0,m(J,q,10,K.current).then((e=>{let t=!1;if(Object.keys(e).length||(t=!0),Object.keys(e).length){const t=Y;t.products=Object.assign(Object.assign({},Y.products),e),Z(Object.assign({},t));const o=b.getVariantIdsToFetchAtProductLevel(e);oe(o,e)}return D(!1),N.current=!1,K.current+=1,t}))),containerRef:U},{children:Object.keys((null==Y?void 0:Y.products)||[]).length?Object.keys(Y.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,Y,B),productId:t,data:Y.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!te,upliftAdditions:ce,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:W,showProductDetailInfoIcon:M,pickerWidth:H},t))):Q?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:z.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
|
|
@@ -11,6 +11,7 @@ interface RearrangeScreenInterface {
|
|
|
11
11
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
12
12
|
storeId: string;
|
|
13
13
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
14
|
+
pickerWidth?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Screen will be opened on two conditions -
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),i=require("../icon-button/IconButton.js"),o=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./helpers/ProductHelper.js"),l=require("./style.js"),d=require("./utility.js"),u=require("./variantComponents.js");exports.RearrangeScreen=p=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:h,rearrangeViewType:y,outOfStockAction:f,scrollContainerRef:x,storeId:q,fbStatusFetcher:C,pickerWidth:O}=p,[g,b]=r.useState(a.parseSelectedVariantsToArray(j));r.useEffect((()=>{b(a.parseSelectedVariantsToArray(j))}),[j]),r.useEffect((()=>{var e;null===(e=null==x?void 0:x.current)||void 0===e||e.scrollTo({top:0}),d.fetchFbStatusCollection(j,q,S,C,"update")}),[]);return e.jsxs(s.DragDropContext,Object.assign({onDragEnd:e=>{if(!e.destination)return;const t=g,[r]=t.splice(e.source.index,1);t.splice(e.destination.index,0,r),t.forEach(((e,t)=>{e.displayOrder=t})),b(t)}},{children:[e.jsxs(l.SelectedScreenHeader,{children:[e.jsx(i.IconButton,{Icon:t.default,width:16,height:16,color:c.COLORS.content.secondary,onClick:()=>{h("collections")}}),e.jsx(o.BodyCaption,Object.assign({color:c.COLORS.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===y?e.jsx(u.VariantsList,{selectedVariants:g,setSelectedVariants:b,selectedCollectionsDispatch:S,outOfStockAction:f,pickerWidth:O}):e.jsx(u.VariantsGrid,{selectedVariants:g,setSelectedVariants:b,selectedCollectionsDispatch:S}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};
|
|
@@ -13,6 +13,7 @@ interface SelectedScreenInterface {
|
|
|
13
13
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
14
14
|
storeId: string;
|
|
15
15
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
16
|
+
pickerWidth?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),c=require("../icon-button/IconButton.js"),s=require("../TypographyStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),c=require("../icon-button/IconButton.js"),s=require("../TypographyStyle.js"),i=require("./emptyState.js"),n=require("./product.js"),o=require("./reducers.js"),u=require("./style.js"),l=require("./utility.js");exports.SelectedScreen=d=>{const{selectedCollections:a,selectedCollectionsDispatch:p,setScreen:j,collections:h,hideProductVariants:f=!1,outOfStockAction:y,storeId:S,fbStatusFetcher:v,pickerWidth:b}=d,x=r.useRef(0),g=r.useRef(null),[k,q]=r.useReducer(o.paginationReducer,{});r.useEffect((()=>{x.current=0;const e=l.paginateSelectedItems(a,10,0);q({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,q,v,"set"),x.current+=1}),[]),r.useEffect((()=>{q({type:"filter",data:a})}),[a]),r.useEffect((()=>{const e=new IntersectionObserver((e=>{if(e[0].isIntersecting&&x.current>0){const e=l.paginateSelectedItems(a,10,x.current);q({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,q,v,"update"),x.current+=1}}),{threshold:1});return g.current&&e.observe(g.current),()=>{g.current&&e.unobserve(g.current)}}),[g,a]);const C=a;return e.jsxs("div",{children:[e.jsxs(u.SelectedScreenHeader,{children:[e.jsx(c.IconButton,{Icon:t.default,onClick:()=>{j("collections")}}),e.jsx(s.BodyCaption,{children:"Selected Products"})]}),e.jsxs("div",{children:[Object.keys(k).length>0?e.jsx(e.Fragment,{children:Object.keys(k).map((t=>{var r;return Object.keys((null===(r=null==k?void 0:k[t])||void 0===r?void 0:r.products)||[]).map((r=>{let c=!1;return(null==C?void 0:C.isCustom)&&(c=!0),e.jsx(n.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:k[t].products[r],isProductPartiallyChecked:l.isProductPartiallyChecked(t,r,C,null==h?void 0:h[t],f),selectedData:C,selectedCollectionsDispatch:p,viewOnly:c,hideProductVariants:f,outOfStockAction:y,pickerWidth:b},r)}))}))}):e.jsx(i.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:g})]})]})};
|
|
@@ -23,3 +23,14 @@ export declare const VariantCardListStyle: import("styled-components").StyledCom
|
|
|
23
23
|
export declare const VariantCardGridStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
24
24
|
export declare const StyledHeaderRightIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
25
25
|
export declare const StyledFooterForNonModal: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const SKUIDBadge: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const EllipsedBodyTiny: import("styled-components").StyledComponent<"div", any, {
|
|
28
|
+
numberOfLines?: number | undefined;
|
|
29
|
+
color?: string | undefined;
|
|
30
|
+
}, never>;
|
|
31
|
+
export declare const ProductSubTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
32
|
+
export declare const ProductInfo: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
33
|
+
export declare const StyledTitleSmall: import("styled-components").StyledComponent<"div", any, {
|
|
34
|
+
numberOfLines?: number | undefined;
|
|
35
|
+
color?: string | undefined;
|
|
36
|
+
}, never>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),o=require("./modal.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e);const d=l.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
4
|
height: ${e=>e.renderWithoutModal?"90%":"75vh"};
|
|
5
5
|
flex-direction: column;
|
|
6
|
-
`,l
|
|
6
|
+
`,n=l.default.div`
|
|
7
7
|
overflow-y: scroll;
|
|
8
8
|
overflow-x: hidden;
|
|
9
9
|
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
::-webkit-scrollbar-thumb {
|
|
16
|
-
background-color: ${e=>e.screenName!==
|
|
16
|
+
background-color: ${e=>e.screenName!==o.ScreenName.RearrangeProducts?"#888":"#fff"};
|
|
17
17
|
border-radius: 8px;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,a=l.default.div`
|
|
20
20
|
height: 64px;
|
|
21
21
|
background-color: ${e=>e.isDisabled?"#F0F0F0":e.isActive?t.COLORS.background.positive.light:"white"};
|
|
22
22
|
border-bottom: 1px solid #e0e0e0;
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
cursor: pointer;
|
|
31
31
|
background-color: ${t.COLORS.surface.hovered};
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,p=l.default.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: row;
|
|
36
36
|
justify-content: center;
|
|
37
37
|
align-items: center;
|
|
38
38
|
column-gap: 18px;
|
|
39
|
-
`,
|
|
39
|
+
`,c=l.default.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
justify-content: center;
|
|
43
|
-
`,
|
|
43
|
+
`,s=l.default.div`
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-direction: row;
|
|
46
46
|
max-height: 32px;
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
position: sticky;
|
|
54
54
|
top: 0;
|
|
55
55
|
z-index: 10;
|
|
56
|
-
`,
|
|
56
|
+
`,x=l.default.div`
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: row;
|
|
59
59
|
column-gap: 16px;
|
|
60
60
|
padding: 12px 16px;
|
|
61
61
|
border-bottom: 1px solid #e0e0e0;
|
|
62
62
|
align-items: center;
|
|
63
|
-
`,
|
|
63
|
+
`,f=l.default.div`
|
|
64
64
|
min-height: 64px;
|
|
65
65
|
background-color: ${e=>e.isActive?t.COLORS.background.positive.light:"white"};
|
|
66
66
|
border-bottom: 1px solid #e0e0e0;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
background-color: ${t.COLORS.surface.hovered};
|
|
77
77
|
}
|
|
78
|
-
`,u=
|
|
78
|
+
`,u=l.default.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: row;
|
|
81
81
|
max-height: 32px;
|
|
@@ -87,10 +87,10 @@
|
|
|
87
87
|
position: sticky;
|
|
88
88
|
top: 0;
|
|
89
89
|
z-index: 10;
|
|
90
|
-
`,
|
|
90
|
+
`,g=l.default.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
|
-
`,
|
|
93
|
+
`,y=l.default.div`
|
|
94
94
|
min-height: 72px;
|
|
95
95
|
background: white;
|
|
96
96
|
padding: 12px 16px;
|
|
@@ -111,14 +111,14 @@
|
|
|
111
111
|
flex-direction: column;
|
|
112
112
|
gap: 2px;
|
|
113
113
|
}
|
|
114
|
-
`,
|
|
114
|
+
`,h=l.default.div`
|
|
115
115
|
height: 72px;
|
|
116
116
|
width: 72px;
|
|
117
117
|
display: flex;
|
|
118
118
|
align-items: center;
|
|
119
119
|
justify-content: center;
|
|
120
120
|
margin: 16px;
|
|
121
|
-
`;
|
|
121
|
+
`;l.default.div`
|
|
122
122
|
display: flex;
|
|
123
123
|
width: 32px;
|
|
124
124
|
height: 32px;
|
|
@@ -127,11 +127,38 @@
|
|
|
127
127
|
align-items: center;
|
|
128
128
|
border: 1px solid ${t.COLORS.stroke.primary};
|
|
129
129
|
border-radius: 4px;
|
|
130
|
-
`;const
|
|
130
|
+
`;const b=l.default.div`
|
|
131
131
|
padding: 16px 24px;
|
|
132
132
|
display: flex;
|
|
133
133
|
align-items: center;
|
|
134
134
|
justify-content: space-between;
|
|
135
135
|
margin-top: auto;
|
|
136
136
|
width: 100%;
|
|
137
|
-
|
|
137
|
+
`,m=l.default.div`
|
|
138
|
+
width: fit-content;
|
|
139
|
+
background: ${t.COLORS.background.brandLight};
|
|
140
|
+
padding: 2px 6px;
|
|
141
|
+
border-radius: 14px;
|
|
142
|
+
`,v=l.default(i.BodyTiny)`
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
max-width: 196px;
|
|
147
|
+
display: block;
|
|
148
|
+
color: ${t.COLORS.background.inverseLight};
|
|
149
|
+
`,w=l.default.div`
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 5px;
|
|
154
|
+
`,S=l.default.div`
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-direction: row;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 8px;
|
|
159
|
+
`,k=l.default(i.TitleSmall)`
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
text-overflow: ellipsis;
|
|
163
|
+
display: block;
|
|
164
|
+
`;exports.CollectionCardDetailStyle=c,exports.CollectionCardInfoStyle=p,exports.CollectionCardStyle=a,exports.CollectionNameHolder=g,exports.ContainerStyle=d,exports.EllipsedBodyTiny=v,exports.ProductCardStyle=f,exports.ProductInfo=S,exports.ProductScreenCollectionCardStyle=x,exports.ProductScreenHeader=s,exports.ProductSubTitle=w,exports.SKUIDBadge=m,exports.ScrollContainerStyle=n,exports.SelectedScreenHeader=u,exports.StyledFooterForNonModal=b,exports.StyledTitleSmall=k,exports.VariantCardGridStyle=h,exports.VariantCardListStyle=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=require("../../constants/Theme.js"),a=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),n=require("../TypographyStyle.js"),c=require("./constants.js"),l=require("./helpers/ProductHelper.js"),o=require("./ProductPickerTag.js"),d=require("./style.js"),u=require("../tooltips/Tooltip.js");exports.VariantCardGridView=t=>{const{data:r}=t;return e.jsx(d.VariantCardGridStyle,{children:e.jsx(u.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(s.ShimmerImage,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=h=>{var j,m,g;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y,pickerWidth:b}=h,I=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:S,tagType:T}=l.ProductHelper.getDataForProductPickerTag(p,!0,y),O=`${p.currency&&null!==(j=c.CurrencySymbols[p.currency])&&void 0!==j?j:""}${null!==(g=null!==(m=p.price)&&void 0!==m?m:p.actualPrice)&&void 0!==g?g:""}`,P=p.skuId;return e.jsxs(d.VariantCardListStyle,{children:[e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:i.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(s.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(u.Tooltip,Object.assign({body:I(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(d.StyledTitleSmall,Object.assign({numberOfLines:1,style:{width:S?`calc(${b} - 310px)`:`calc(${b} - 180px)`}},{children:I()}))})),e.jsxs(d.ProductSubTitle,{children:[e.jsx(n.BodyCaption,Object.assign({color:i.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||S?null:O})),P&&e.jsx(u.Tooltip,Object.assign({body:P,placement:"top"},{children:e.jsx(d.SKUIDBadge,{children:e.jsx(d.EllipsedBodyTiny,{children:`SKU ID: ${P}`})})}))]})]}))]})),e.jsxs(d.ProductInfo,{children:[e.jsx(o.ProductPickerTag,{isVariant:!0,data:v,tagText:S,tagType:T}),e.jsx(a.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:i.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),h.onDelete&&h.onDelete()}})]})]})};
|
|
@@ -10,11 +10,12 @@ export type VariantsComponentProps = {
|
|
|
10
10
|
setSelectedVariants: React.Dispatch<React.SetStateAction<ProductVariantForRearrange[]>>;
|
|
11
11
|
selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
|
|
12
12
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
13
|
+
pickerWidth?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Returns a react component of variants list, which are eligible to drag and drop.
|
|
16
17
|
*/
|
|
17
|
-
export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, pickerWidth, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
/**
|
|
19
20
|
* Returns a react component of variants grid, which are eligible to drag and drop.
|
|
20
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("react-beautiful-dnd"),s=require("../../constants/Theme.js"),t=require("./variant.js");exports.VariantsGrid=r=>{let{selectedVariants:s}=r;return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex"})},{children:[e.jsx(a.Droppable,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[s.map(((r,s)=>e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:s},{children:(a,s)=>e.jsxs("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{children:[e.jsx(t.VariantCardGridView,{data:r}),a.placeholder]}))}),`${r.productId}-${r.variantId}`))),r.placeholder]}))})),r.placeholder]}))}))},exports.VariantsList=i=>{let{selectedVariants:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("react-beautiful-dnd"),s=require("../../constants/Theme.js"),t=require("./variant.js");exports.VariantsGrid=r=>{let{selectedVariants:s}=r;return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex"})},{children:[e.jsx(a.Droppable,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[s.map(((r,s)=>e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:s},{children:(a,s)=>e.jsxs("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{children:[e.jsx(t.VariantCardGridView,{data:r}),a.placeholder]}))}),`${r.productId}-${r.variantId}`))),r.placeholder]}))})),r.placeholder]}))}))},exports.VariantsList=i=>{let{selectedVariants:d,setSelectedVariants:n,selectedCollectionsDispatch:l,outOfStockAction:o,pickerWidth:p}=i;const[c,b]=r.useState(-1);function g(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-list"},{children:(r,i)=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign({backgroundColor:s.COLORS.surface.subdued,padding:"0.05px",height:d.length<8?"550px":"100%",overflow:"auto"},r.droppableProps.style)},{children:[d.map(((r,i)=>e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px",boxShadow:i===c?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>b(i),onMouseLeave:()=>b(-1)},{children:e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:i},{children:(a,s)=>e.jsx("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{style:g(Object.assign(Object.assign({},a.draggableProps.style),a.draggableSnapshot))},{children:e.jsx(t.VariantCardListView,{data:r,selectedCollectionsDispatch:l,onDelete:()=>{const e=d.slice();e[i].displayOrder=null,e.splice(i,1),n(e)},outOfStockAction:o,pickerWidth:p},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),r.placeholder&&i.isDraggingOver?e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px"}},{children:r.placeholder})):null]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import d from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as h}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import d from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as u}from"../input/Input.js";import{StyledModal as h}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as m}from"../tag/Tag.js";import{CollectionsScreen as g}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as b}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as S,selectedColectionsReducer as k,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as x}from"./selectedScreen.js";import{ContainerStyle as I,ScrollContainerStyle as P,StyledFooterForNonModal as O}from"./style.js";import{OUT_OF_STOCK_ACTION as D}from"./type.js";import{updateAllVariantsForSelectedProducts as F}from"./utility.js";var T;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(T||(T={}));const R=R=>{const{storeId:w,selectedItems:A,onClose:B,visible:E,zIndex:L,exactLimit:z,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:W,outOfStockAction:M=D.BLUR,hideVariantCheckbox:H,selectProductsFromCustomCollection:G,hideSelectionCount:K,title:N,width:U,left:Y,renderWithoutModal:q,onClickSave:J,pickerType:Q,hideProductVariants:X=!1,startupScreen:Z=T.Collections,rearrangeEnabled:_,selectSingleItem:ee=!1,showProductDetails:te,containerStyle:oe,crossButtonInsideHeader:ce=!1,footerForNonModal:re={},primaryButton:se,secondaryButton:ie,subtitle:ne}=R,[le,de]=r(y,{}),[ae,ue]=s([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections),[he,pe]=s("grid"),[me,ge]=s(""),[Ce,be]=s(""),[fe,ye]=s(0),[Se,ke]=s(!1),[ve,je]=s(0),[xe,Ie]=s(""),[Pe,Oe]=s(!1),[De,Fe]=s(!1),[Te,Re]=r(S,{collections:{},products:{}}),[we,Ae]=r(k,Object.keys(A).length>0?A:{}),Be=i(null),[Ee,Le]=s(!1),[ze,Ve]=s();n((()=>{ke(!0),Fe(!0),R.collectionFetcher(fe,w).then((e=>{console.log("collectionsParsed?.collections",null==e?void 0:e.collections),de({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ke(!1),ye((e=>e+1)),Fe(!1)})).catch()}),[]),n((()=>{let e=0;X?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),je(e)}),[le,we,X]),n((()=>{Ce&&(ke(!0),R.productFetcher(Ce,w).then((e=>{Object.keys(e).length&&de({type:"productsFetched",data:{collectionId:Ce,products:e}}),ke(!1)})).catch())}),[Ce]),n((()=>{const e=setTimeout((()=>{"rearrange"!==ae&&(xe.length||"collections"!==ae)&&(xe.length?(Oe(!0),R.searchFetcher(w,xe).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),de({type:"searched",data:e.collections})):(Re({type:"set",data:{collections:{},products:e}}),de({type:"searched",data:e})),ue("searchProducts"),ke(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[xe]),n((()=>{J&&(R.onAdd(we,ve),$e())}),[J]),n((()=>{ee&&Object.keys(we||{}).length&&ve&&(R.onAdd(we,ve),$e())}),[ee,we,ve]);const $e=()=>{Ae({type:"reset",data:{}})},We=()=>z&&ve>z?t(m,{tagText:`You can only select ${z} products`,type:"negative"}):V&&ve>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):t(a,ve>0?{onClick:()=>{ue(_?T.RearrangeProducts:T.SelectedProducts)},buttonText:z?`${ve}/${z} products selected`:`${ve} products selected`,buttonType:["rearrange","view"].includes(ae)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ae)}:{disabled:!0,buttonText:z?`${ve}/${z} products selected`:`${ve} products selected`,buttonType:"tertiaryGray"}),Me=e=>Se?"Loading...":ae===T.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",He=e(I,Object.assign({style:null!=oe?oe:{}},{children:[R.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&t(o,{children:("collections"===ae||"searchProducts"===ae)&&t("div",Object.assign({style:{padding:q?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(u,{placeholder:"Search products using name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Pe?t(p,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:xe,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e(P,Object.assign({ref:Be,screenName:ae},{children:["collections"===ae&&t(g,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:De,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:ge,setSelectedCollectionId:be,setScreen:ue,selectedCollections:we,collectionFetcher:R.collectionFetcher,storeId:w,collectionsDispatch:de,setSaveDisabled:ke,pagingControls:{curPage:fe,setCurPage:ye},hideCollectionCheckbox:$,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Be}),"products"===ae&&me&&t(v.Provider,Object.assign({value:me},{children:t(b,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:ue,storeId:w,data:le[me],collectionsDispatch:de,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:ke,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:W,outOfStockAction:M,hideVariantCheckbox:H,selectProductsFromCustomCollection:G,renderWithoutModal:q,pickerType:Q,hideProductVariants:X,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:te,scrollContainerRef:Be,pickerWidth:U||"600px"})})),"view"===ae&&t(x,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:X,outOfStockAction:M,storeId:w,fbStatusFetcher:R.fbStatusFetcher,pickerWidth:U||"600px"}),"rearrange"===ae&&t(f,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Be,storeId:w,fbStatusFetcher:R.fbStatusFetcher,pickerWidth:U||"600px"}),"searchProducts"===ae&&t(j,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:we||{},searchedCollections:Te||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:Q,hideProductCheckbox:W,hideProductVariants:X,hideVariantCheckbox:H,storeId:w,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:be,renderWithoutModal:q,hideCollectionCheckbox:$,outOfStockAction:M})]}))]}));return t(o,{children:q?e(o,{children:[He,re.renderFooter?e(O,{children:[We(),t(a,{buttonText:Me(re.primaryButtonText),disabled:!re.isLoading&&(Se||ve<1||z&&ve<z||!z&&V&&ve>V)||re.primaryButtonDisabled,isLoading:re.isLoading,onClick:()=>{R.onAdd(we,ve),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}})]}):t(o,{}),Ee&&ze?t(C,{productData:ze,outOfStockAction:M,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):t(o,{})]}):e(h,Object.assign({zIndex:L,open:E,onClose:()=>{null==B||B(),$e()},headingTitle:N||("collections"===ae||"products"===ae?"Select Products":"view"===ae?"Selected Products":"searchProducts"===ae?"Searched Results":"rearrange"===ae?"Rearrange Products":void 0),headingSubtitle:ne,footerShadow:!0,centralContainerStyles:{width:U||"600px",left:Y||"auto"},headerRightCustomElement:ce?t("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:B},{children:t(d,{width:20,height:20,color:l.content.secondary})})):t(o,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(Se||ve<1||z&&ve<z||!z&&V&&ve>V)||e.disabled,onClick:()=>{R.onAdd(we,ve),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}}))(se):{buttonText:Me(),disabled:Se||ve<1||z&&ve<z||!z&&V&&ve>V||!1,onClick:()=>{R.onAdd(we,ve),$e()}},secondaryButton:ie?(e=>Object.assign(Object.assign({},e),{disabled:Se||ve<1||z&&ve<z||!z&&V&&ve>V||!1,onClick:()=>{const e=F(we,le,Te);R.onAdd(e,ve,!0)}}))(ie):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:K?t(o,{}):We(),hideCrossButton:Ee||ce},{children:[He,Ee&&ze?t(C,{productData:ze,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{Le(!1)}}):t(o,{})]}))})};export{R as ProductPickerModal,T as ScreenName};
|
|
@@ -18,6 +18,7 @@ interface ProductGroupInterface {
|
|
|
18
18
|
showProductDetailInfoIcon?: boolean;
|
|
19
19
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
20
20
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
21
|
+
pickerWidth?: string;
|
|
21
22
|
}
|
|
22
23
|
export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
interface ProductCardInterface {
|
|
@@ -39,6 +40,7 @@ interface ProductCardInterface {
|
|
|
39
40
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
40
41
|
onProductDetailClick?: (productData: Product | ProductVariant) => void;
|
|
41
42
|
currencyAndPrice?: string;
|
|
43
|
+
pickerWidth?: string;
|
|
42
44
|
}
|
|
43
45
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
44
46
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import
|
|
1
|
+
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import d from"../../assets/icons/info.svg.js";import{CheckBox as c}from"../checkBox/CheckBox.js";import{IconButton as l}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{BodyCaption as a}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as u}from"./helpers/ProductHelper.js";import{ProductPickerTag as v}from"./ProductPickerTag.js";import{ProductCardStyle as p,StyledTitleSmall as h,ProductInfo as I,ProductSubTitle as m,SKUIDBadge as f,EllipsedBodyTiny as y}from"./style.js";import{shouldShowVariant as g}from"./utility.js";const k=o=>{var e,d,c,l,n,r,a,u,v;const{collectionId:p,productId:h,data:I,selectedData:m,selectedCollectionsDispatch:f,viewOnly:y,upliftAdditions:k,isProductPartiallyChecked:j,hideProductCheckbox:b,outOfStockAction:C,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:S,showProductDetailInfoIcon:T,pickerWidth:V}=o,w=t=>{var i,o,e,d,c,l;if(!(null===(o=null===(i=null==m?void 0:m[p])||void 0===i?void 0:i.products)||void 0===o?void 0:o[h]))return!1;return!!(null===(l=null===(c=null===(d=null===(e=null==m?void 0:m[p])||void 0===e?void 0:e.products)||void 0===d?void 0:d[h])||void 0===c?void 0:c.variants)||void 0===l?void 0:l[t])},A=x||!g(I)?`${I.currency&&null!==(e=s[I.currency])&&void 0!==e?e:""}${null!==(v=null!==(n=null===(l=null===(c=Object.values(null!==(d=I.variants)&&void 0!==d?d:{}))||void 0===c?void 0:c[0])||void 0===l?void 0:l.price)&&void 0!==n?n:null===(u=null===(a=Object.values(null!==(r=I.variants)&&void 0!==r?r:{}))||void 0===a?void 0:a[0])||void 0===u?void 0:u.actualPrice)&&void 0!==v?v:""}`:"";return t("div",{children:[i(P,{isVariant:!1,data:I,productId:h,collectionId:p,isSelected:(()=>{var t,i;return!!(null===(i=null===(t=null==m?void 0:m[p])||void 0===t?void 0:t.products)||void 0===i?void 0:i[h])})(),isPartiallyChecked:j,selectedCollectionsDispatch:f,upliftAdditions:k,viewOnly:y,hideProductCheckbox:b,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,outOfStockAction:C,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:A,pickerWidth:V},h),x?null:g(I)&&Object.keys(I.variants||[]).map((t=>{var o,e,d,c,l,n,r;const a=`${I.currency&&null!==(o=s[I.currency])&&void 0!==o?o:""}${null!==(r=null!==(c=null===(d=null===(e=I.variants)||void 0===e?void 0:e[t])||void 0===d?void 0:d.price)&&void 0!==c?c:null===(n=null===(l=I.variants)||void 0===l?void 0:l[t])||void 0===n?void 0:n.actualPrice)&&void 0!==r?r:""}`;return i(P,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:h,viewOnly:y,upliftAdditions:k,collectionId:p,isSelected:w(t),selectedCollectionsDispatch:f,outOfStockAction:C,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:a,pickerWidth:V},t)}))]})},P=s=>{var g,k,P,j,b;const{isVariant:C,data:O,productId:x,collectionId:D,variantId:S,isSelected:T,selectedCollectionsDispatch:V,viewOnly:w,upliftAdditions:A,isPartiallyChecked:U,hideProductCheckbox:$,outOfStockAction:W,hideVariantCheckbox:B,hideProductVariants:F,pickerType:R="PRODUCT",onProductDetailClick:H,showProductDetailInfoIcon:K,currencyAndPrice:L,pickerWidth:q}=s,{isVariantForProductPickerTag:z,dataForProductPickerTag:E,tagText:G,tagType:J}=u.getDataForProductPickerTag(O,C,W);console.log({data:O});const M=C?O.skuId:1===(null===(k=Object.values(null!==(g=null==O?void 0:O.variants)&&void 0!==g?g:{}))||void 0===k?void 0:k.length)?null===(b=null===(j=Object.values(null!==(P=null==O?void 0:O.variants)&&void 0!==P?P:{}))||void 0===j?void 0:j[0])||void 0===b?void 0:b.skuId:void 0;return t(p,Object.assign({isVariant:C,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===R&&($||B)){const t=Object.keys(O.variants);F?T?V({type:"productUnselected",data:{productId:x,collectionId:D}}):A("productSelected",{productId:x,variantId:S,collectionId:D,product:O}):T?V({type:"variantUnselected",data:{productId:x,variantId:S,collectionId:D}}):A("variantSelected",{productId:x,variantId:S||t[0],collectionId:D,variant:O})}},isActive:T},{children:[C&&!w&&!B||!C&&!w&&!$?i(c,{isChecked:T,isPartiallyChecked:U||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),C?t?A(F?"productSelected":"variantSelected",{productId:x,variantId:S,collectionId:D,variant:O}):V({type:F?"productUnselected":"variantUnselected",data:{productId:x,variantId:S,collectionId:D}}):t?A("productSelected",{productId:x,collectionId:D,product:O}):V({type:"productUnselected",data:{productId:x,collectionId:D}})}}):i(o,{}),i("div",{children:i(n,{width:40,height:40,imageUrl:O.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(r,Object.assign({variant:"light",body:O.name,placement:"bottom",delay:400},{children:t(h,Object.assign({style:{width:G?`calc(${q} - 310px)`:`calc(${q} - 160px)`},numberOfLines:1},{children:[O.name,"hsjdh sgfgsdfjhgsdjf sgfhsgfhjsadadaad sadsgf sgfhsjfgjhds"]}))})),t(I,{children:[i(v,{isVariant:z,data:E,tagText:G,tagType:J}),K&&i(l,{onClick:()=>{null==H||H(O)},Icon:()=>i(d,{width:20,height:20,color:e.content.placeholder})})]})]})),t(m,{children:[!(null==E?void 0:E.fbStatus)&&z||G?null:i(a,Object.assign({color:e.content.secondary},{children:L})),M&&i(r,Object.assign({body:M,placement:"top"},{children:i(f,{children:i(y,{children:`SKU ID: ${M}`})})}))]})]}))]}))};export{P as ProductCard,k as ProductGroup};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as
|
|
1
|
+
import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as a}from"../../constants/Theme.js";import r from"../../assets/icons/cross.svg.js";import{IconButton as e}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{TitleRegular as c,BodyCaption as l}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as u}from"./helpers/ProductHelper.js";import{ProductPickerTag as p}from"./ProductPickerTag.js";import{SKUIDBadge as m,EllipsedBodyTiny as v}from"./style.js";import{shouldShowVariant as g}from"./utility.js";const f=i=>o(h,{children:[t(y,{}),t(D,{children:t(e,{className:"close-button",onClick:i.onClose,Icon:r,width:20,height:20})}),t(x,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),x=i=>{var r,e,f,x,h,y,D,I,P,T,O,S,w,$,z,A,F,C,H,N;const U=void 0===i.productData.variants;let V;if(U)V=`${i.productData.currency&&null!==(r=s[i.productData.currency])&&void 0!==r?r:""}${null!==(h=null!==(f=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==f?f:null===(x=i.productData)||void 0===x?void 0:x.actualPrice)&&void 0!==h?h:""}`;else{const o=null===(y=i.productData)||void 0===y?void 0:y.currency;V=`${o&&null!==(D=s[o])&&void 0!==D?D:""}${null!==(z=null!==(O=null===(T=null===(P=Object.values(null!==(I=i.productData.variants)&&void 0!==I?I:{}))||void 0===P?void 0:P[0])||void 0===T?void 0:T.price)&&void 0!==O?O:null===($=null===(w=Object.values(null!==(S=i.productData.variants)&&void 0!==S?S:{}))||void 0===w?void 0:w[0])||void 0===$?void 0:$.actualPrice)&&void 0!==z?z:""}`}const{isVariantForProductPickerTag:_,dataForProductPickerTag:B,tagText:K,tagType:L}=u.getDataForProductPickerTag(i.productData,U,i.outOfStockAction);console.log({productData:i.productData});const M=U?i.productData.skuId:1===(null===(F=Object.values(null!==(A=i.productData.variants)&&void 0!==A?A:{}))||void 0===F?void 0:F.length)?null===(H=Object.values(null!==(C=i.productData.variants)&&void 0!==C?C:{})[0])||void 0===H?void 0:H.skuId:void 0;return o(b,{children:[t(j,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(k,{children:[M&&t(d,Object.assign({body:M,placement:"top"},{children:t(m,{children:t(v,{children:`SKU ID: ${M}`})})})),t(c,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(l,Object.assign({color:a.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(l,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(N=i.productData.description)&&void 0!==N?N:""}}),t(l,Object.assign({color:a.content.secondary},{children:U?V:g(i.productData)?null:V})),t(p,{isVariant:_,data:B,tagText:K,tagType:L})]})]})},h=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1;
|
|
4
4
|
background: rgba(0, 0, 0, 0.5);
|
|
@@ -17,11 +17,11 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
17
17
|
word-break: break-word;
|
|
18
18
|
margin-top: 8px;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,y=i.div`
|
|
21
21
|
display: flex;
|
|
22
22
|
flex: 1;
|
|
23
23
|
background: rgba(0, 0, 0, 0.5);
|
|
24
|
-
`,
|
|
24
|
+
`,D=i.div`
|
|
25
25
|
position: relative;
|
|
26
26
|
|
|
27
27
|
.close-button {
|
|
@@ -29,29 +29,24 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
|
|
|
29
29
|
top: -50px;
|
|
30
30
|
right: 0px;
|
|
31
31
|
margin: 10px;
|
|
32
|
-
background: ${
|
|
32
|
+
background: ${a.surface.standard};
|
|
33
33
|
border-radius: 50%;
|
|
34
34
|
}
|
|
35
|
-
`,
|
|
35
|
+
`,b=i.div`
|
|
36
36
|
display: flex;
|
|
37
37
|
background: white;
|
|
38
38
|
padding: 24px;
|
|
39
39
|
gap: 24px;
|
|
40
40
|
border-radius: 8px 8px 0px 0px;
|
|
41
|
-
`,
|
|
41
|
+
`,j=i.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
max-width: min(50%, 200px);
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
align-items: center;
|
|
47
|
-
`,
|
|
47
|
+
`,k=i.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex: 1;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
gap: 4px;
|
|
52
|
-
|
|
53
|
-
width: fit-content;
|
|
54
|
-
background: ${r.background.brandLight};
|
|
55
|
-
padding: 2px 6px;
|
|
56
|
-
border-radius: 14px;
|
|
57
|
-
`;export{v as ProductInfoCard,g as ProductInfoOverlay};
|
|
52
|
+
`;export{x as ProductInfoCard,f as ProductInfoOverlay};
|
|
@@ -25,6 +25,7 @@ interface ProductsScreenInterface {
|
|
|
25
25
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
26
26
|
onProductDetailClick: (productData: Product | ProductVariant) => void;
|
|
27
27
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
28
|
+
pickerWidth?: string;
|
|
28
29
|
}
|
|
29
30
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as a}from"../../constants/Theme.js";import{CheckBox as u}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{InfiniteScroll as p}from"../InfiniteScroll/InfiniteScroll.js";import{Input as m}from"../input/Input.js";import{Spinner as g}from"../spinner/Spinner.js";import{BodyCaption as j,TitleRegular as f}from"../TypographyStyle.js";import{EmptyState as v}from"./emptyState.js";import{ProductGroup as b}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as k}from"./reducers.js";import{ProductScreenHeader as O,ProductScreenCollectionCardStyle as C}from"./style.js";import{OUT_OF_STOCK_ACTION as P}from"./type.js";import{getVariantIdsToFetchAtProductLevel as I,markVariantsAsApprovedProductsLevel as D,isCollectionPartiallyChecked as S,isProductPartiallyChecked as x,liftTheStateUp as E}from"./utility.js";const R=R=>{var T,w;const{data:V,collectionsDispatch:A,selectedData:B,selectedCollectionsDispatch:F,productFetcher:W,storeId:J,setScreen:M,setSaveDisabled:z,hideInCollectionSearch:H,customCollectionRestriction:K,hideProductCheckbox:L,outOfStockAction:N=P.BLUR,hideVariantCheckbox:U=!1,selectProductsFromCustomCollection:_=!1,pickerType:q,hideProductVariants:G,fbStatusFetcher:Q,onProductDetailClick:X,showProductDetailInfoIcon:Y,scrollContainerRef:Z,pickerWidth:$}=R,tt=i(k),et=s(0),ot=s(!1),[ct,rt]=l(""),[nt,it]=l(!1),[st,lt]=l(V),dt=s(!0),at=s(!1);d((()=>{if(dt.current)return void(dt.current=!1);const t=setTimeout((()=>{ct.length?(it(!0),R.searchInCollectionFetcher(J,tt,ct).then((t=>{const e=n(V);e.products=t,console.log({products:t}),lt(e);const o=I(null!=t?t:{});ht(o,null!=t?t:{},!0),z(!1),it(!1)}))):lt(V)}),800);return()=>clearTimeout(t)}),[ct]);d((()=>{var t,e,o,c;at.current=!1,et.current=Math.floor((null===(e=Object.keys(null!==(t=V.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const r=I(null!==(o=V.products)&&void 0!==o?o:{});ht(r,null!==(c=V.products)&&void 0!==c?c:{})}),[tt]);const ut=!!K&&V.isSmartCollection;d((()=>{(null==V?void 0:V.products)||pt(10)}),[]);const ht=(t,e,o)=>{Q||(o?D(e,A,tt,st,lt):D(e,A,tt)),t.length>0&&Q&&Q(J,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var r,n;Object.keys(null!==(n=null===(r=null==e?void 0:e[o])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const s=null===(n=null==e?void 0:e[o].variants)||void 0===n?void 0:n[r];s&&"REJECTED"===t[r]?s.fbStatus="REJECTED":s&&"APPROVED"===t[r]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[r]&&(l[r]=s)}))})),o?(lt((t=>{const e=Object.assign({},t);return e.products=c,e})),A({type:"productsPaged",data:{collectionId:tt,products:c}})):A({type:"productsPaged",data:{collectionId:tt,products:c}})})).catch((t=>{o?D(e,A,tt,st,lt):D(e,A,tt)}))},pt=t=>{z(!0),it(!0),W(tt,J,t,0).then((e=>{if(Object.keys(e).length||(at.current=!0),Object.keys(e).length){lt(Object.assign(Object.assign({},st),{products:e}));const t=I(e);ht(t,e),et.current=1}t||F({type:"selected",data:{id:tt,val:Object.assign(Object.assign({},V),{products:e})}}),z(!1),it(!1)})).catch()},mt=(t,e)=>{const o=E(e,V);F({type:t,data:Object.assign(Object.assign({},o),{isRestricted:K})})},gt=!!(null==B?void 0:B[tt])&&!!Object.keys(null!==(w=null===(T=null==B?void 0:B[tt])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(O,{children:[e(h,{Icon:o,height:16,onClick:()=>{M("collections")}}),e(j,Object.assign({style:{color:a.content.secondary}},{children:V.name}))]}),!H&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(m,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>nt&&ct.length?e(g,{size:"small",color:a.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:ct,onChangeText:t=>{t.length&&t.trim().length?rt(t):rt("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==st?void 0:st.products)||[]).length>0&&!ut&&!ct.length&&!L&&"-1"!==tt&&t(C,{children:[e(u,{isChecked:gt,isPartiallyChecked:S(tt,st,B,G),onValueChange:function(t){t?pt():F({type:"unselected",data:{id:tt}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(f,{children:"All Products"})]}),e(p,Object.assign({hasData:!(Object.keys((null==st?void 0:st.products)||[]).length<10)&&!!Object.keys((null==st?void 0:st.products)||[]).length,fetchMore:()=>(ot.current=!0,W(tt,J,10,et.current).then((t=>{let e=!1;if(Object.keys(t).length||(e=!0),Object.keys(t).length){const e=st;e.products=Object.assign(Object.assign({},st.products),t),lt(Object.assign({},e));const o=I(t);ht(o,t)}return z(!1),ot.current=!1,et.current+=1,e}))),containerRef:Z},{children:Object.keys((null==st?void 0:st.products)||[]).length?Object.keys(st.products||[]).map((t=>e(b,{outOfStockAction:N,collectionId:tt,isProductPartiallyChecked:x(tt,t,B,st,G),productId:t,data:st.products[t],selectedData:B,selectedCollectionsDispatch:F,viewOnly:!_&&!!ut,upliftAdditions:mt,hideProductCheckbox:L,hideVariantCheckbox:U,hideProductVariants:G,pickerType:q,onProductDetailClick:X,showProductDetailInfoIcon:Y,pickerWidth:$},t))):nt?e(y,{limit:10}):e(v,{title:"No products to show",subtitle:ct.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};export{R as ProductsScreen};
|
|
@@ -11,6 +11,7 @@ interface RearrangeScreenInterface {
|
|
|
11
11
|
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
12
12
|
storeId: string;
|
|
13
13
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
14
|
+
pickerWidth?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Screen will be opened on two conditions -
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as i}from"react-beautiful-dnd";import{COLORS as c}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as a}from"./emptyState.js";import{parseSelectedVariantsToArray as d}from"./helpers/ProductHelper.js";import{SelectedScreenHeader as p}from"./style.js";import{fetchFbStatusCollection as m}from"./utility.js";import{VariantsList as u,VariantsGrid as f}from"./variantComponents.js";const h=h=>{const{selectedCollections:j,selectedCollectionsDispatch:y,setScreen:S,rearrangeViewType:g,outOfStockAction:b,scrollContainerRef:C,storeId:k,fbStatusFetcher:O,pickerWidth:v}=h,[V,w]=r(d(j));s((()=>{w(d(j))}),[j]),s((()=>{var t;null===(t=null==C?void 0:C.current)||void 0===t||t.scrollTo({top:0}),m(j,k,y,O,"update")}),[]);return t(i,Object.assign({onDragEnd:t=>{if(!t.destination)return;const e=V,[o]=e.splice(t.source.index,1);e.splice(t.destination.index,0,o),e.forEach(((t,e)=>{t.displayOrder=e})),w(e)}},{children:[t(p,{children:[e(n,{Icon:o,width:16,height:16,color:c.content.secondary,onClick:()=>{S("collections")}}),e(l,Object.assign({color:c.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===g?e(u,{selectedVariants:V,setSelectedVariants:w,selectedCollectionsDispatch:y,outOfStockAction:b,pickerWidth:v}):e(f,{selectedVariants:V,setSelectedVariants:w,selectedCollectionsDispatch:y}):e(a,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};export{h as RearrangeScreen};
|
|
@@ -13,6 +13,7 @@ interface SelectedScreenInterface {
|
|
|
13
13
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
14
14
|
storeId: string;
|
|
15
15
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
16
|
+
pickerWidth?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e,Fragment as r}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as i,useEffect as n}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./product.js";import{paginationReducer as a}from"./reducers.js";import{SelectedScreenHeader as p}from"./style.js";import{paginateSelectedItems as m,fetchFbStatusCollection as f,isProductPartiallyChecked as h}from"./utility.js";const v=v=>{const{selectedCollections:y,selectedCollectionsDispatch:j,setScreen:b,collections:
|
|
1
|
+
import{jsxs as t,jsx as e,Fragment as r}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as i,useEffect as n}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./product.js";import{paginationReducer as a}from"./reducers.js";import{SelectedScreenHeader as p}from"./style.js";import{paginateSelectedItems as m,fetchFbStatusCollection as f,isProductPartiallyChecked as h}from"./utility.js";const v=v=>{const{selectedCollections:y,selectedCollectionsDispatch:j,setScreen:b,collections:k,hideProductVariants:S=!1,outOfStockAction:I,storeId:O,fbStatusFetcher:g,pickerWidth:C}=v,P=c(0),w=c(null),[A,D]=i(a,{});n((()=>{P.current=0;const t=m(y,10,0);D({type:"paginate",data:t}),f(t,O,D,g,"set"),P.current+=1}),[]),n((()=>{D({type:"filter",data:y})}),[y]),n((()=>{const t=new IntersectionObserver((t=>{if(t[0].isIntersecting&&P.current>0){const t=m(y,10,P.current);D({type:"paginate",data:t}),f(t,O,D,g,"update"),P.current+=1}}),{threshold:1});return w.current&&t.observe(w.current),()=>{w.current&&t.unobserve(w.current)}}),[w,y]);const x=y;return t("div",{children:[t(p,{children:[e(s,{Icon:o,onClick:()=>{b("collections")}}),e(l,{children:"Selected Products"})]}),t("div",{children:[Object.keys(A).length>0?e(r,{children:Object.keys(A).map((t=>{var r;return Object.keys((null===(r=null==A?void 0:A[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==x?void 0:x.isCustom)&&(o=!0),e(u,{upliftAdditions:null,collectionId:t,productId:r,data:A[t].products[r],isProductPartiallyChecked:h(t,r,x,null==k?void 0:k[t],S),selectedData:x,selectedCollectionsDispatch:j,viewOnly:o,hideProductVariants:S,outOfStockAction:I,pickerWidth:C},r)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("div",{ref:w})]})]})};export{v as SelectedScreen};
|
|
@@ -23,3 +23,14 @@ export declare const VariantCardListStyle: import("styled-components").StyledCom
|
|
|
23
23
|
export declare const VariantCardGridStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
24
24
|
export declare const StyledHeaderRightIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
25
25
|
export declare const StyledFooterForNonModal: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const SKUIDBadge: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
27
|
+
export declare const EllipsedBodyTiny: import("styled-components").StyledComponent<"div", any, {
|
|
28
|
+
numberOfLines?: number | undefined;
|
|
29
|
+
color?: string | undefined;
|
|
30
|
+
}, never>;
|
|
31
|
+
export declare const ProductSubTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
32
|
+
export declare const ProductInfo: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
33
|
+
export declare const StyledTitleSmall: import("styled-components").StyledComponent<"div", any, {
|
|
34
|
+
numberOfLines?: number | undefined;
|
|
35
|
+
color?: string | undefined;
|
|
36
|
+
}, never>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{
|
|
1
|
+
import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{BodyTiny as t,TitleSmall as o}from"../TypographyStyle.js";import{ScreenName as n}from"./modal.js";const r=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
4
|
height: ${e=>e.renderWithoutModal?"90%":"75vh"};
|
|
5
5
|
flex-direction: column;
|
|
6
|
-
`,
|
|
6
|
+
`,d=e.div`
|
|
7
7
|
overflow-y: scroll;
|
|
8
8
|
overflow-x: hidden;
|
|
9
9
|
|
|
@@ -13,10 +13,10 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
::-webkit-scrollbar-thumb {
|
|
16
|
-
background-color: ${e=>e.screenName!==
|
|
16
|
+
background-color: ${e=>e.screenName!==n.RearrangeProducts?"#888":"#fff"};
|
|
17
17
|
border-radius: 8px;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,p=e.div`
|
|
20
20
|
height: 64px;
|
|
21
21
|
background-color: ${e=>e.isDisabled?"#F0F0F0":e.isActive?i.background.positive.light:"white"};
|
|
22
22
|
border-bottom: 1px solid #e0e0e0;
|
|
@@ -30,17 +30,17 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
30
30
|
cursor: pointer;
|
|
31
31
|
background-color: ${i.surface.hovered};
|
|
32
32
|
}
|
|
33
|
-
`,
|
|
33
|
+
`,l=e.div`
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: row;
|
|
36
36
|
justify-content: center;
|
|
37
37
|
align-items: center;
|
|
38
38
|
column-gap: 18px;
|
|
39
|
-
`,
|
|
39
|
+
`,a=e.div`
|
|
40
40
|
display: flex;
|
|
41
41
|
flex-direction: column;
|
|
42
42
|
justify-content: center;
|
|
43
|
-
`,
|
|
43
|
+
`,c=e.div`
|
|
44
44
|
display: flex;
|
|
45
45
|
flex-direction: row;
|
|
46
46
|
max-height: 32px;
|
|
@@ -53,14 +53,14 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
53
53
|
position: sticky;
|
|
54
54
|
top: 0;
|
|
55
55
|
z-index: 10;
|
|
56
|
-
`,
|
|
56
|
+
`,s=e.div`
|
|
57
57
|
display: flex;
|
|
58
58
|
flex-direction: row;
|
|
59
59
|
column-gap: 16px;
|
|
60
60
|
padding: 12px 16px;
|
|
61
61
|
border-bottom: 1px solid #e0e0e0;
|
|
62
62
|
align-items: center;
|
|
63
|
-
`,
|
|
63
|
+
`,x=e.div`
|
|
64
64
|
min-height: 64px;
|
|
65
65
|
background-color: ${e=>e.isActive?i.background.positive.light:"white"};
|
|
66
66
|
border-bottom: 1px solid #e0e0e0;
|
|
@@ -75,7 +75,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
75
75
|
cursor: pointer;
|
|
76
76
|
background-color: ${i.surface.hovered};
|
|
77
77
|
}
|
|
78
|
-
`,
|
|
78
|
+
`,g=e.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: row;
|
|
81
81
|
max-height: 32px;
|
|
@@ -87,10 +87,10 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
87
87
|
position: sticky;
|
|
88
88
|
top: 0;
|
|
89
89
|
z-index: 10;
|
|
90
|
-
`,
|
|
90
|
+
`,f=e.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
|
-
`,
|
|
93
|
+
`,h=e.div`
|
|
94
94
|
min-height: 72px;
|
|
95
95
|
background: white;
|
|
96
96
|
padding: 12px 16px;
|
|
@@ -111,7 +111,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
111
111
|
flex-direction: column;
|
|
112
112
|
gap: 2px;
|
|
113
113
|
}
|
|
114
|
-
`,
|
|
114
|
+
`,m=e.div`
|
|
115
115
|
height: 72px;
|
|
116
116
|
width: 72px;
|
|
117
117
|
display: flex;
|
|
@@ -134,4 +134,31 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
|
|
|
134
134
|
justify-content: space-between;
|
|
135
135
|
margin-top: auto;
|
|
136
136
|
width: 100%;
|
|
137
|
-
|
|
137
|
+
`,b=e.div`
|
|
138
|
+
width: fit-content;
|
|
139
|
+
background: ${i.background.brandLight};
|
|
140
|
+
padding: 2px 6px;
|
|
141
|
+
border-radius: 14px;
|
|
142
|
+
`,y=e(t)`
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
max-width: 196px;
|
|
147
|
+
display: block;
|
|
148
|
+
color: ${i.background.inverseLight};
|
|
149
|
+
`,w=e.div`
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
align-items: center;
|
|
153
|
+
gap: 5px;
|
|
154
|
+
`,v=e.div`
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-direction: row;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 8px;
|
|
159
|
+
`,k=e(o)`
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
white-space: nowrap;
|
|
162
|
+
text-overflow: ellipsis;
|
|
163
|
+
display: block;
|
|
164
|
+
`;export{a as CollectionCardDetailStyle,l as CollectionCardInfoStyle,p as CollectionCardStyle,f as CollectionNameHolder,r as ContainerStyle,y as EllipsedBodyTiny,x as ProductCardStyle,v as ProductInfo,s as ProductScreenCollectionCardStyle,c as ProductScreenHeader,w as ProductSubTitle,b as SKUIDBadge,d as ScrollContainerStyle,g as SelectedScreenHeader,u as StyledFooterForNonModal,k as StyledTitleSmall,m as VariantCardGridStyle,h as VariantCardListStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import r from"../../assets/icons/delete.svg.js";import i from"../../assets/icons/drag_handle.svg.js";import{COLORS as o}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as c}from"../shimmer-image/ShimmerImage.js";import{BodyCaption as n}from"../TypographyStyle.js";import{CurrencySymbols as l}from"./constants.js";import{ProductHelper as d}from"./helpers/ProductHelper.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{VariantCardListStyle as m,StyledTitleSmall as h,ProductSubTitle as p,SKUIDBadge as g,EllipsedBodyTiny as u,ProductInfo as j,VariantCardGridStyle as b}from"./style.js";import{Tooltip as v}from"../tooltips/Tooltip.js";const y=b=>{var y,f,I;const{data:T,selectedCollectionsDispatch:O,outOfStockAction:k,pickerWidth:P}=b,x=()=>{let t;return t=T.name.includes(T.productName)?T.name:`${T.productName} ${T.name}`,t},{dataForProductPickerTag:$,tagText:w,tagType:D}=d.getDataForProductPickerTag(T,!0,k),S=`${T.currency&&null!==(y=l[T.currency])&&void 0!==y?y:""}${null!==(I=null!==(f=T.price)&&void 0!==f?f:T.actualPrice)&&void 0!==I?I:""}`,N=T.skuId;return t(m,{children:[t("div",Object.assign({className:"text-container"},{children:[e(i,{width:24,height:24,color:o.content.placeholder}),e("div",{children:e(c,{width:40,height:40,imageUrl:T.image,alt:"Item",borderRadius:4},T.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(v,Object.assign({body:x(),placement:"bottom",delay:400,variant:"light"},{children:e(h,Object.assign({numberOfLines:1,style:{width:w?`calc(${P} - 310px)`:`calc(${P} - 180px)`}},{children:x()}))})),t(p,{children:[e(n,Object.assign({color:o.content.secondary},{children:!(null==$?void 0:$.fbStatus)||w?null:S})),N&&e(v,Object.assign({body:N,placement:"top"},{children:e(g,{children:e(u,{children:`SKU ID: ${N}`})})}))]})]}))]})),t(j,{children:[e(s,{isVariant:!0,data:$,tagText:w,tagType:D}),e(a,{Icon:()=>e(r,{width:24,height:24,color:o.content.placeholder}),onClick:()=>{O&&O({type:"variantUnselected",data:{productId:T.productId,variantId:T.variantId,collectionId:T.collectionId}}),b.onDelete&&b.onDelete()}})]})]})},f=t=>{const{data:r}=t;return e(b,{children:e(v,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(c,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})};export{f as VariantCardGridView,y as VariantCardListView};
|
|
@@ -10,11 +10,12 @@ export type VariantsComponentProps = {
|
|
|
10
10
|
setSelectedVariants: React.Dispatch<React.SetStateAction<ProductVariantForRearrange[]>>;
|
|
11
11
|
selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
|
|
12
12
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
13
|
+
pickerWidth?: string;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Returns a react component of variants list, which are eligible to drag and drop.
|
|
16
17
|
*/
|
|
17
|
-
export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, pickerWidth, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
/**
|
|
19
20
|
* Returns a react component of variants grid, which are eligible to drag and drop.
|
|
20
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a}from"react";import{Droppable as t,Draggable as s}from"react-beautiful-dnd";import{COLORS as n}from"../../constants/Theme.js";import{VariantCardListView as d,VariantCardGridView as i}from"./variant.js";const o=i=>{let{selectedVariants:o,setSelectedVariants:l,selectedCollectionsDispatch:c,outOfStockAction:p}=i;const[
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a}from"react";import{Droppable as t,Draggable as s}from"react-beautiful-dnd";import{COLORS as n}from"../../constants/Theme.js";import{VariantCardListView as d,VariantCardGridView as i}from"./variant.js";const o=i=>{let{selectedVariants:o,setSelectedVariants:l,selectedCollectionsDispatch:c,outOfStockAction:p,pickerWidth:g}=i;const[b,f]=a(-1);function h(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e(t,Object.assign({droppableId:"droppable-list"},{children:(a,t)=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign({backgroundColor:n.surface.subdued,padding:"0.05px",height:o.length<8?"550px":"100%",overflow:"auto"},a.droppableProps.style)},{children:[o.map(((r,a)=>e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px",boxShadow:a===b?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>f(a),onMouseLeave:()=>f(-1)},{children:e(s,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:a},{children:(t,s)=>e("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{style:h(Object.assign(Object.assign({},t.draggableProps.style),t.draggableSnapshot))},{children:e(d,{data:r,selectedCollectionsDispatch:c,onDelete:()=>{const e=o.slice();e[a].displayOrder=null,e.splice(a,1),l(e)},outOfStockAction:p,pickerWidth:g},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),a.placeholder&&t.isDraggingOver?e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px"}},{children:a.placeholder})):null]}))}))},l=a=>{let{selectedVariants:n}=a;return e(t,Object.assign({droppableId:"droppable-horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex"})},{children:[e(t,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[n.map(((a,t)=>e(s,Object.assign({draggableId:`${a.productId}-${a.variantId}`,index:t},{children:(t,s)=>r("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{children:[e(i,{data:a}),t.placeholder]}))}),`${a.productId}-${a.variantId}`))),a.placeholder]}))})),a.placeholder]}))}))};export{l as VariantsGrid,o as VariantsList};
|