@bikdotai/bik-component-library 0.0.657-23 → 0.0.657-3

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.
Files changed (41) hide show
  1. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  2. package/dist/cjs/components/product-picker-v2/product.d.ts +0 -2
  3. package/dist/cjs/components/product-picker-v2/product.js +1 -1
  4. package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +12 -7
  5. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +0 -1
  6. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  7. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +0 -1
  8. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
  9. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +0 -1
  10. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  11. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +0 -1
  12. package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
  13. package/dist/cjs/components/product-picker-v2/style.d.ts +0 -11
  14. package/dist/cjs/components/product-picker-v2/style.js +16 -43
  15. package/dist/cjs/components/product-picker-v2/utility.d.ts +0 -1
  16. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  17. package/dist/cjs/components/product-picker-v2/variant.d.ts +0 -1
  18. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  19. package/dist/cjs/components/product-picker-v2/variantComponents.d.ts +1 -2
  20. package/dist/cjs/components/product-picker-v2/variantComponents.js +1 -1
  21. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  22. package/dist/esm/components/product-picker-v2/product.d.ts +0 -2
  23. package/dist/esm/components/product-picker-v2/product.js +1 -1
  24. package/dist/esm/components/product-picker-v2/productInfoOverlay.js +12 -7
  25. package/dist/esm/components/product-picker-v2/productScreen.d.ts +0 -1
  26. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  27. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +0 -1
  28. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
  29. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +0 -1
  30. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  31. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +0 -1
  32. package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
  33. package/dist/esm/components/product-picker-v2/style.d.ts +0 -11
  34. package/dist/esm/components/product-picker-v2/style.js +14 -41
  35. package/dist/esm/components/product-picker-v2/utility.d.ts +0 -1
  36. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  37. package/dist/esm/components/product-picker-v2/variant.d.ts +0 -1
  38. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  39. package/dist/esm/components/product-picker-v2/variantComponents.d.ts +1 -2
  40. package/dist/esm/components/product-picker-v2/variantComponents.js +1 -1
  41. 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"),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:W,selectSingleItem:$=!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((()=>{$&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[$,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(W?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,pickerWidth:A||"600px"})]}))]}));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,{})]}))})};
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"),C=require("./reducers.js"),g=require("./searchScreen.js"),x=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:P,zIndex:k,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:_=!1,showProductDetails:H,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:K={},primaryButton:U,secondaryButton:Y,subtitle:J}=e,[Q,X]=c.useReducer(C.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(""),[Ce,ge]=c.useState(!1),[xe,je]=c.useState(!1),[ye,me]=c.useReducer(C.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(C.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=c.useRef(null),[Pe,ke]=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((()=>{_&&Object.keys(be||{}).length&&ue&&(e.onAdd(be,ue),Fe())}),[_,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!=W?W:{}},{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 for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Ce?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:xe,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(C.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=>{ke(!0),Oe(e)},showProductDetailInfoIcon:H,scrollContainerRef:ve})})),"view"===Z&&t.jsx(x.SelectedScreen,{selectedCollections:be||{},selectedCollectionsDispatch:fe,setScreen:ee,collections:Q,hideProductVariants:V,outOfStockAction:T,storeId:b,fbStatusFetcher:e.fbStatusFetcher}),"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}),"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,{}),Pe&&Ie?t.jsx(h.ProductInfoOverlay,{productData:Ie,outOfStockAction:T,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{ke(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:k,open:P,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:Pe||G},{children:[De,Pe&&Ie?t.jsx(h.ProductInfoOverlay,{productData:Ie,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{ke(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -18,7 +18,6 @@ interface ProductGroupInterface {
18
18
  showProductDetailInfoIcon?: boolean;
19
19
  pickerType?: 'COLLECTION' | 'PRODUCT';
20
20
  onProductDetailClick?: (productData: Product | ProductVariant) => void;
21
- pickerWidth?: string;
22
21
  }
23
22
  export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
24
23
  interface ProductCardInterface {
@@ -40,7 +39,6 @@ interface ProductCardInterface {
40
39
  pickerType?: 'COLLECTION' | 'PRODUCT';
41
40
  onProductDetailClick?: (productData: Product | ProductVariant) => void;
42
41
  currencyAndPrice?: string;
43
- pickerWidth?: string;
44
42
  }
45
43
  export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
46
44
  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"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),l=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=>{const{isVariant:p,data:h,productId:y,collectionId:I,variantId:j,isSelected:P,selectedCollectionsDispatch:x,viewOnly:k,upliftAdditions:g,isPartiallyChecked:C,hideProductCheckbox:b,outOfStockAction:O,hideVariantCheckbox:S,hideProductVariants:m,pickerType:f="PRODUCT",onProductDetailClick:T,showProductDetailInfoIcon:D,currencyAndPrice:V,pickerWidth:w}=n,{isVariantForProductPickerTag:q,dataForProductPickerTag:A,tagText:U,tagType:B}=a.ProductHelper.getDataForProductPickerTag(h,p,O);console.log({data:h,isVariant:p,isVariantForProductPickerTag:q});const $=v.getSkuId(h,p);return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:p,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===f&&(b||S)){const e=Object.keys(h.variants);m?P?x({type:"productUnselected",data:{productId:y,collectionId:I}}):g("productSelected",{productId:y,variantId:j,collectionId:I,product:h}):P?x({type:"variantUnselected",data:{productId:y,variantId:j,collectionId:I}}):g("variantSelected",{productId:y,variantId:j||e[0],collectionId:I,variant:h})}},isActive:P},{children:[p&&!k&&!S||!p&&!k&&!b?e.jsx(o.CheckBox,{isChecked:P,isPartiallyChecked:C||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),p?e?g(m?"productSelected":"variantSelected",{productId:y,variantId:j,collectionId:I,variant:h}):x({type:m?"productUnselected":"variantUnselected",data:{productId:y,variantId:j,collectionId:I}}):e?g("productSelected",{productId:y,collectionId:I,product:h}):x({type:"productUnselected",data:{productId:y,collectionId:I}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:h.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(r.Tooltip,Object.assign({variant:"light",body:h.name,placement:"bottom",delay:400},{children:e.jsx(u.StyledTitleSmall,Object.assign({style:{width:U?`calc(${w} - 310px)`:`calc(${w} - ${p?"30px":"0px"} - 160px)`},numberOfLines:1},{children:h.name}))})),e.jsxs(u.ProductInfo,{children:[e.jsx(s.ProductPickerTag,{isVariant:q,data:A,tagText:U,tagType:B}),D&&e.jsx(c.IconButton,{onClick:()=>{null==T||T(h)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})]})),e.jsxs(u.ProductSubTitle,{children:[!(null==A?void 0:A.fbStatus)&&q||U?null:e.jsx(l.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:V})),$&&e.jsx(r.Tooltip,Object.assign({body:$,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${$}`})})}))]})]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,c,d,r,l,a,s,u;const{collectionId:h,productId:y,data:I,selectedData:j,selectedCollectionsDispatch:P,viewOnly:x,upliftAdditions:k,isProductPartiallyChecked:g,hideProductCheckbox:C,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:S,pickerType:m,onProductDetailClick:f,showProductDetailInfoIcon:T,pickerWidth:D}=t,V=e=>{var t,i,o,c,d,r;if(!(null===(i=null===(t=null==j?void 0:j[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[y]))return!1;return!!(null===(r=null===(d=null===(c=null===(o=null==j?void 0:j[h])||void 0===o?void 0:o.products)||void 0===c?void 0:c[y])||void 0===d?void 0:d.variants)||void 0===r?void 0:r[e])},w=S||!v.shouldShowVariant(I)?`${I.currency&&null!==(i=n.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(u=null!==(r=null===(d=null===(c=Object.values(null!==(o=I.variants)&&void 0!==o?o:{}))||void 0===c?void 0:c[0])||void 0===d?void 0:d.price)&&void 0!==r?r:null===(s=null===(a=Object.values(null!==(l=I.variants)&&void 0!==l?l:{}))||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:I,productId:y,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==j?void 0:j[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[y])})(),isPartiallyChecked:g,selectedCollectionsDispatch:P,upliftAdditions:k,viewOnly:x,hideProductCheckbox:C,hideVariantCheckbox:O,hideProductVariants:S,pickerType:m,outOfStockAction:b,onProductDetailClick:f,showProductDetailInfoIcon:T,currencyAndPrice:w,pickerWidth:D},y),S?null:v.shouldShowVariant(I)&&Object.keys(I.variants||[]).map((t=>{var i,o,c,d,r,l,a;const s=`${I.currency&&null!==(i=n.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(a=null!==(d=null===(c=null===(o=I.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(l=null===(r=I.variants)||void 0===r?void 0:r[t])||void 0===l?void 0:l.actualPrice)&&void 0!==a?a:""}`;return e.jsx(p,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:y,viewOnly:x,upliftAdditions:k,collectionId:h,isSelected:V(t),selectedCollectionsDispatch:P,outOfStockAction:b,onProductDetailClick:f,showProductDetailInfoIcon:T,currencyAndPrice:s,pickerWidth:D},t)}))]})};
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"),c=require("../icon-button/IconButton.js"),r=require("../shimmer-image/ShimmerImage.js"),d=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),l=require("./constants.js"),a=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),v=require("./utility.js");const p=l=>{const{isVariant:v,data:p,productId:h,collectionId:y,variantId:I,isSelected:P,selectedCollectionsDispatch:j,viewOnly:x,upliftAdditions:k,isPartiallyChecked:C,hideProductCheckbox:g,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:D}=l,{isVariantForProductPickerTag:V,dataForProductPickerTag:q,tagText:w,tagType:A}=a.ProductHelper.getDataForProductPickerTag(p,v,b);return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:v,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===f&&(g||O)){const e=Object.keys(p.variants);m?P?j({type:"productUnselected",data:{productId:h,collectionId:y}}):k("productSelected",{productId:h,variantId:I,collectionId:y,product:p}):P?j({type:"variantUnselected",data:{productId:h,variantId:I,collectionId:y}}):k("variantSelected",{productId:h,variantId:I||e[0],collectionId:y,variant:p})}},isActive:P},{children:[v&&!x&&!O||!v&&!x&&!g?e.jsx(o.CheckBox,{isChecked:P,isPartiallyChecked:C||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),v?e?k(m?"productSelected":"variantSelected",{productId:h,variantId:I,collectionId:y,variant:p}):j({type:m?"productUnselected":"variantUnselected",data:{productId:h,variantId:I,collectionId:y}}):e?k("productSelected",{productId:h,collectionId:y,product:p}):j({type:"productUnselected",data:{productId:h,collectionId:y}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(r.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(d.Tooltip,Object.assign({variant:"light",body:p.name,placement:"bottom",delay:400},{children:e.jsx(n.TitleSmall,Object.assign({numberOfLines:1},{children:p.name}))})),T&&e.jsx(c.IconButton,{onClick:()=>{null==S||S(p)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})),e.jsx(s.ProductPickerTag,{isVariant:V,data:q,tagText:w,tagType:A}),e.jsx(n.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:!(null==q?void 0:q.fbStatus)&&V||w?null:D}))]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,c,r,d,n,a,s,u;const{collectionId:h,productId:y,data:I,selectedData:P,selectedCollectionsDispatch:j,viewOnly:x,upliftAdditions:k,isProductPartiallyChecked:C,hideProductCheckbox:g,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f,onProductDetailClick:S,showProductDetailInfoIcon:T}=t,D=e=>{var t,i,o,c,r,d;if(!(null===(i=null===(t=null==P?void 0:P[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[y]))return!1;return!!(null===(d=null===(r=null===(c=null===(o=null==P?void 0:P[h])||void 0===o?void 0:o.products)||void 0===c?void 0:c[y])||void 0===r?void 0:r.variants)||void 0===d?void 0:d[e])},V=m||!v.shouldShowVariant(I)?`${I.currency&&null!==(i=l.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(u=null!==(d=null===(r=null===(c=Object.values(null!==(o=I.variants)&&void 0!==o?o:{}))||void 0===c?void 0:c[0])||void 0===r?void 0:r.price)&&void 0!==d?d:null===(s=null===(a=Object.values(null!==(n=I.variants)&&void 0!==n?n:{}))||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:I,productId:y,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==P?void 0:P[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[y])})(),isPartiallyChecked:C,selectedCollectionsDispatch:j,upliftAdditions:k,viewOnly:x,hideProductCheckbox:g,hideVariantCheckbox:O,hideProductVariants:m,pickerType:f,outOfStockAction:b,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:V},y),m?null:v.shouldShowVariant(I)&&Object.keys(I.variants||[]).map((t=>{var i,o,c,r,d,n,a;const s=`${I.currency&&null!==(i=l.CurrencySymbols[I.currency])&&void 0!==i?i:""}${null!==(a=null!==(r=null===(c=null===(o=I.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==r?r:null===(n=null===(d=I.variants)||void 0===d?void 0:d[t])||void 0===n?void 0:n.actualPrice)&&void 0!==a?a:""}`;return e.jsx(p,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:y,viewOnly:x,upliftAdditions:k,collectionId:h,isSelected:D(t),selectedCollectionsDispatch:j,outOfStockAction:b,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:s},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"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),d=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),l=require("./constants.js"),c=require("./helpers/ProductHelper.js"),s=require("./ProductPickerTag.js"),u=require("./style.js"),p=require("./utility.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=x(t);const v=t=>{var r,i,x,g,v,y,m,f,D,I,S,P,O,k,T,q;const C=void 0===t.productData.variants;let w;if(C)w=`${t.productData.currency&&null!==(r=l.CurrencySymbols[t.productData.currency])&&void 0!==r?r:""}${null!==(v=null!==(x=null===(i=t.productData)||void 0===i?void 0:i.price)&&void 0!==x?x:null===(g=t.productData)||void 0===g?void 0:g.actualPrice)&&void 0!==v?v:""}`;else{const e=null===(y=t.productData)||void 0===y?void 0:y.currency;w=`${e&&null!==(m=l.CurrencySymbols[e])&&void 0!==m?m:""}${null!==(T=null!==(S=null===(I=null===(D=Object.values(null!==(f=t.productData.variants)&&void 0!==f?f:{}))||void 0===D?void 0:D[0])||void 0===I?void 0:I.price)&&void 0!==S?S:null===(k=null===(O=Object.values(null!==(P=t.productData.variants)&&void 0!==P?P:{}))||void 0===O?void 0:O[0])||void 0===k?void 0:k.actualPrice)&&void 0!==T?T:""}`}const{isVariantForProductPickerTag:B,dataForProductPickerTag:$,tagText:z,tagType:R}=c.ProductHelper.getDataForProductPickerTag(t.productData,C,t.outOfStockAction);console.log({productData:t.productData});const L=p.getSkuId(t.productData,C);return e.jsxs(j,{children:[e.jsx(h,{children:e.jsx(a.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(b,{children:[L&&e.jsx(d.Tooltip,Object.assign({body:L,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${L}`})})})),e.jsx(n.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(n.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(q=t.productData.description)&&void 0!==q?q:""}}),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:C?w:p.shouldShowVariant(t.productData)?null:w})),e.jsx(s.ProductPickerTag,{isVariant:B,data:$,tagText:z,tagType:R})]})]})},y=g.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),d=require("../TypographyStyle.js"),n=require("./constants.js"),c=require("./helpers/ProductHelper.js"),u=require("./ProductPickerTag.js"),l=require("./utility.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=s(t);const x=t=>{var r,i,s,p,x,g,v,f,b,D,O,k,I,S,P,T;const C=void 0===t.productData.variants;let q;if(C)q=`${t.productData.currency&&null!==(r=n.CurrencySymbols[t.productData.currency])&&void 0!==r?r:""}${null!==(x=null!==(s=null===(i=t.productData)||void 0===i?void 0:i.price)&&void 0!==s?s:null===(p=t.productData)||void 0===p?void 0:p.actualPrice)&&void 0!==x?x:""}`;else{const e=null===(g=t.productData)||void 0===g?void 0:g.currency;q=`${e&&null!==(v=n.CurrencySymbols[e])&&void 0!==v?v:""}${null!==(P=null!==(O=null===(D=null===(b=Object.values(null!==(f=t.productData.variants)&&void 0!==f?f:{}))||void 0===b?void 0:b[0])||void 0===D?void 0:D.price)&&void 0!==O?O:null===(S=null===(I=Object.values(null!==(k=t.productData.variants)&&void 0!==k?k:{}))||void 0===I?void 0:I[0])||void 0===S?void 0:S.actualPrice)&&void 0!==P?P:""}`}const{isVariantForProductPickerTag:w,dataForProductPickerTag:L,tagText:$,tagType:R}=c.ProductHelper.getDataForProductPickerTag(t.productData,C,t.outOfStockAction);return console.log({product:t.productData}),e.jsxs(y,{children:[e.jsx(m,{children:e.jsx(a.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(h,{children:[t.productData.skuId&&e.jsx(j,{children:e.jsx(d.BodyTiny,Object.assign({color:o.COLORS.background.inverseLight},{children:`SKU ID: ${t.productData.skuId}`}))}),e.jsx(d.TitleRegular,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:`Product ID: ${t.productData.id}`})),e.jsx(d.BodyCaption,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(T=t.productData.description)&&void 0!==T?T:""}}),e.jsx(d.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:C?q:l.shouldShowVariant(t.productData)?null:q})),e.jsx(u.ProductPickerTag,{isVariant:w,data:L,tagText:$,tagType:R})]})]})},g=p.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
- `,m=g.default.div`
20
+ `,v=p.default.div`
21
21
  display: flex;
22
22
  flex: 1;
23
23
  background: rgba(0, 0, 0, 0.5);
24
- `,f=g.default.div`
24
+ `,f=p.default.div`
25
25
  position: relative;
26
26
 
27
27
  .close-button {
@@ -32,21 +32,26 @@
32
32
  background: ${o.COLORS.surface.standard};
33
33
  border-radius: 50%;
34
34
  }
35
- `,j=g.default.div`
35
+ `,y=p.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
- `,h=g.default.div`
41
+ `,m=p.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
- `,b=g.default.div`
47
+ `,h=p.default.div`
48
48
  display: flex;
49
49
  flex: 1;
50
50
  flex-direction: column;
51
51
  gap: 4px;
52
- `;exports.ProductInfoCard=v,exports.ProductInfoOverlay=t=>e.jsxs(y,{children:[e.jsx(m,{}),e.jsx(f,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(v,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]});
52
+ `,j=p.default.div`
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=>e.jsxs(g,{children:[e.jsx(v,{}),e.jsx(f,{children:e.jsx(i.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})]});
@@ -25,7 +25,6 @@ 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;
29
28
  }
30
29
  export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
31
30
  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"),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."})}))]})};
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:M,showProductDetailInfoIcon:U,scrollContainerRef:H}=f,J=s.useContext(g.CollectionIdContext),K=s.useRef(0),N=s.useRef(!1),[W,z]=s.useState(""),[G,Q]=s.useState(!1),[X,Y]=s.useState(P),Z=s.useRef(!0),$=s.useRef(!1);s.useEffect((()=>{if(Z.current)return void(Z.current=!1);const e=setTimeout((()=>{W.length?(Q(!0),f.searchInCollectionFetcher(q,J,W).then((e=>{const t=c.cloneDeep(P);t.products=e,console.log({products:e}),Y(t);const o=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(o,null!=e?e:{},!0),D(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,o,r;$.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:{});te(c,null!==(r=P.products)&&void 0!==r?r:{})}),[J]);const ee=!!T&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||oe(10)}),[]);const te=(e,t,o)=>{_||(o?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):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?(Y((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,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},oe=e=>{D(!0),Q(!0),m(J,q,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Y(Object.assign(Object.assign({},X),{products:t}));const e=b.getVariantIdsToFetchAtProductLevel(t);te(e,t),K.current=1}e||I({type:"selected",data:{id:J,val:Object.assign(Object.assign({},P),{products:t})}}),D(!1),Q(!1)})).catch()},re=(e,t)=>{const o=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},o),{isRestricted:T})})},ce=!!(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:()=>G&&W.length?e.jsx(a.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(r.default,{})},id:"listInput",height:"24px",type:"text",value:W,onChangeText:e=>{e.length&&e.trim().length?z(e):z("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==X?void 0:X.products)||[]).length>0&&!ee&&!W.length&&!R&&"-1"!==J&&e.jsxs(y.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:ce,isPartiallyChecked:b.isCollectionPartiallyChecked(J,X,S,B),onValueChange:function(e){e?oe():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==X?void 0:X.products)||[]).length<10)&&!!Object.keys((null==X?void 0:X.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=X;t.products=Object.assign(Object.assign({},X.products),e),Y(Object.assign({},t));const o=b.getVariantIdsToFetchAtProductLevel(e);te(o,e)}return D(!1),N.current=!1,K.current+=1,t}))),containerRef:H},{children:Object.keys((null==X?void 0:X.products)||[]).length?Object.keys(X.products||[]).map((t=>e.jsx(j.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:b.isProductPartiallyChecked(J,t,S,X,B),productId:t,data:X.products[t],selectedData:S,selectedCollectionsDispatch:I,viewOnly:!F&&!!ee,upliftAdditions:re,hideProductCheckbox:R,hideVariantCheckbox:L,hideProductVariants:B,pickerType:w,onProductDetailClick:M,showProductDetailInfoIcon:U},t))):G?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(p.EmptyState,{title:"No products to show",subtitle:W.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})}))]})};
@@ -11,7 +11,6 @@ interface RearrangeScreenInterface {
11
11
  scrollContainerRef: React.RefObject<HTMLDivElement>;
12
12
  storeId: string;
13
13
  fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
14
- pickerWidth?: string;
15
14
  }
16
15
  /**
17
16
  * 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"),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"})]}))};
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"),o=require("../icon-button/IconButton.js"),i=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}=p,[O,g]=r.useState(a.parseSelectedVariantsToArray(j));r.useEffect((()=>{g(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=O,[r]=t.splice(e.source.index,1);t.splice(e.destination.index,0,r),t.forEach(((e,t)=>{e.displayOrder=t})),g(t)}},{children:[e.jsxs(l.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,width:16,height:16,color:c.COLORS.content.secondary,onClick:()=>{h("collections")}}),e.jsx(i.BodyCaption,Object.assign({color:c.COLORS.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===y?e.jsx(u.VariantsList,{selectedVariants:O,setSelectedVariants:g,selectedCollectionsDispatch:S,outOfStockAction:f}):e.jsx(u.VariantsGrid,{selectedVariants:O,setSelectedVariants:g,selectedCollectionsDispatch:S}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};
@@ -24,7 +24,6 @@ interface SearchScreenInterface {
24
24
  hideCollectionCheckbox?: boolean;
25
25
  renderWithoutModal?: boolean;
26
26
  outOfStockAction?: OUT_OF_STOCK_ACTION;
27
- pickerWidth?: string;
28
27
  }
29
28
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
30
29
  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("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:p,searchedCollections:v,searchedCollectionsDispatch:C,selectedCollectionsDispatch:j,setScreen:k,collections:y,onBackPress:b,hideVariantCheckbox:x,pickerType:S,hideProductVariants:P,hideProductCheckbox:f,storeId:m,fbStatusFetcher:O,setCollectionId:g,setSelectedCollectionId:I,hideCollectionCheckbox:q,renderWithoutModal:D,outOfStockAction:F,pickerWidth:T}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=v.products)&&void 0!==e?e:{},m,C,O,"setProducts")}),[null==v?void 0:v.products]);const W=!!h&&(null==p?void 0:p.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{k("collections"),b()}}),e.jsx(i.BodyCaption,{children:(null===(a=Object.keys(null==v?void 0:v.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==v?void 0:v.products).length||Object.keys(null==v?void 0:v.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.collections).map((t=>e.jsx(c.CollectionCard,{customCollectionRestriction:h,data:null==y?void 0:y[t],isDisabled:W&&!(null==p?void 0:p[t]),isChecked:!!(null==p?void 0:p[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==y?void 0:y[t],p,P),selectedCollectionsDispatch:j,setCollectionId:g,setSelectedCollectionId:I,setScreen:k,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:p,renderWithoutModal:D,pickerType:S,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==v?void 0:v.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==v?void 0:v.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,i,c;let s=!1;return(null===(l=null==v?void 0:v.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const i=n.liftTheStateUp(o,null===(l=null==v?void 0:v.products)||void 0===l?void 0:l[e]);j({type:t,data:Object.assign(Object.assign({},i),{isRestricted:h})})})(t,e,o),productId:o,data:(null===(i=null==v?void 0:v.products)||void 0===i?void 0:i[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,p,null===(c=v.products)||void 0===c?void 0:c[t],P),selectedData:p,selectedCollectionsDispatch:j,viewOnly:s,hideProductCheckbox:f,hideVariantCheckbox:x,hideProductVariants:P,pickerType:S,outOfStockAction:F,pickerWidth:T},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
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("react"),l=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),i=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:v,searchedCollections:p,searchedCollectionsDispatch:C,selectedCollectionsDispatch:j,setScreen:k,collections:y,onBackPress:b,hideVariantCheckbox:x,pickerType:S,hideProductVariants:P,hideProductCheckbox:f,storeId:m,fbStatusFetcher:O,setCollectionId:g,setSelectedCollectionId:I,hideCollectionCheckbox:q,renderWithoutModal:D,outOfStockAction:F}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=p.products)&&void 0!==e?e:{},m,C,O,"setProducts")}),[null==p?void 0:p.products]);const T=!!h&&(null==v?void 0:v.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{k("collections"),b()}}),e.jsx(c.BodyCaption,{children:(null===(a=Object.keys(null==p?void 0:p.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==p?void 0:p.products).length||Object.keys(null==p?void 0:p.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.collections).map((t=>e.jsx(i.CollectionCard,{customCollectionRestriction:h,data:null==y?void 0:y[t],isDisabled:T&&!(null==v?void 0:v[t]),isChecked:!!(null==v?void 0:v[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==y?void 0:y[t],v,P),selectedCollectionsDispatch:j,setCollectionId:g,setSelectedCollectionId:I,setScreen:k,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:v,renderWithoutModal:D,pickerType:S,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==p?void 0:p.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,c,i;let s=!1;return(null===(l=null==p?void 0:p.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const c=n.liftTheStateUp(o,null===(l=null==p?void 0:p.products)||void 0===l?void 0:l[e]);j({type:t,data:Object.assign(Object.assign({},c),{isRestricted:h})})})(t,e,o),productId:o,data:(null===(c=null==p?void 0:p.products)||void 0===c?void 0:c[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,v,null===(i=p.products)||void 0===i?void 0:i[t],P),selectedData:v,selectedCollectionsDispatch:j,viewOnly:s,hideProductCheckbox:f,hideVariantCheckbox:x,hideProductVariants:P,pickerType:S,outOfStockAction:F},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
@@ -13,7 +13,6 @@ interface SelectedScreenInterface {
13
13
  outOfStockAction?: OUT_OF_STOCK_ACTION;
14
14
  storeId: string;
15
15
  fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
16
- pickerWidth?: string;
17
16
  }
18
17
  export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
19
18
  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"),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})]})]})};
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"),n=require("./emptyState.js"),i=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:f,hideProductVariants:h=!1,outOfStockAction:y,storeId:S,fbStatusFetcher:v}=d,b=r.useRef(0),x=r.useRef(null),[g,q]=r.useReducer(o.paginationReducer,{});r.useEffect((()=>{b.current=0;const e=l.paginateSelectedItems(a,10,0);q({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,q,v,"set"),b.current+=1}),[]),r.useEffect((()=>{q({type:"filter",data:a})}),[a]),r.useEffect((()=>{const e=new IntersectionObserver((e=>{if(e[0].isIntersecting&&b.current>0){const e=l.paginateSelectedItems(a,10,b.current);q({type:"paginate",data:e}),l.fetchFbStatusCollection(e,S,q,v,"update"),b.current+=1}}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x,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(g).length>0?e.jsx(e.Fragment,{children:Object.keys(g).map((t=>{var r;return Object.keys((null===(r=null==g?void 0:g[t])||void 0===r?void 0:r.products)||[]).map((r=>{let c=!1;return(null==C?void 0:C.isCustom)&&(c=!0),e.jsx(i.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:g[t].products[r],isProductPartiallyChecked:l.isProductPartiallyChecked(t,r,C,null==f?void 0:f[t],h),selectedData:C,selectedCollectionsDispatch:p,viewOnly:c,hideProductVariants:h,outOfStockAction:y},r)}))}))}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:x})]})]})};
@@ -23,14 +23,3 @@ 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("../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`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const n=r.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
- `,n=l.default.div`
6
+ `,l=r.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!==o.ScreenName.RearrangeProducts?"#888":"#fff"};
16
+ background-color: ${e=>e.screenName!==i.ScreenName.RearrangeProducts?"#888":"#fff"};
17
17
  border-radius: 8px;
18
18
  }
19
- `,a=l.default.div`
19
+ `,d=r.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
- `,p=l.default.div`
33
+ `,a=r.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
- `,c=l.default.div`
39
+ `,p=r.default.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,s=l.default.div`
43
+ `,c=r.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
- `,x=l.default.div`
56
+ `,s=r.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
- `,f=l.default.div`
63
+ `,x=r.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=l.default.div`
78
+ `,u=r.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
- `,g=l.default.div`
90
+ `,f=r.default.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,y=l.default.div`
93
+ `,g=r.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
- `,h=l.default.div`
114
+ `,y=r.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
- `;l.default.div`
121
+ `;r.default.div`
122
122
  display: flex;
123
123
  width: 32px;
124
124
  height: 32px;
@@ -127,38 +127,11 @@
127
127
  align-items: center;
128
128
  border: 1px solid ${t.COLORS.stroke.primary};
129
129
  border-radius: 4px;
130
- `;const b=l.default.div`
130
+ `;const h=r.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
- `,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;
137
+ `;exports.CollectionCardDetailStyle=p,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=f,exports.ContainerStyle=n,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=s,exports.ProductScreenHeader=c,exports.ScrollContainerStyle=l,exports.SelectedScreenHeader=u,exports.StyledFooterForNonModal=h,exports.VariantCardGridStyle=y,exports.VariantCardListStyle=g;
@@ -48,4 +48,3 @@ export declare const updateAllVariantsForSelectedProducts: (selectedItems: {
48
48
  } | undefined;
49
49
  };
50
50
  }, collections: Collection, searchedProducts: SearchedItems) => Record<string, any>;
51
- export declare const getSkuId: (product: Product | ProductVariant, isVariant: boolean) => string | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function l(o,l,t){if(!o)return{};const i=Object.keys(o).slice(t,t+l),n={};return i.forEach((l=>{n[l]=o[l]})),n}const t=(o,l,t)=>{Object.keys(o).forEach((l=>{var t,i;const n=null!==(i=null===(t=o[l])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(n).forEach((t=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===n?void 0:n[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),l({type:t,data:o})};exports.fetchFbStatusCollection=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((t=>{var i,n;const d=null!==(n=null===(i=o[t])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];(null==u?void 0:u.fbStatus)||l.push(n)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const t=Object.assign({},o);Object.keys(t).forEach((o=>{var i,n;const d=null!==(n=null===(i=t[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=t[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];u&&"REJECTED"===l[n]?u.fbStatus="REJECTED":u&&"APPROVED"===l[n]&&(u.fbStatus="APPROVED")}))}))})),i({type:d,data:t})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},exports.getSkuId=(o,l)=>{var t;if(l)return o.skuId;const i=Object.values(null!==(t=null==o?void 0:o.variants)&&void 0!==t?t:{});return 1===i.length&&i[0].name.includes(o.name)?i[0].skuId:""},exports.getVariantIdsToFetchAtProductLevel=(o,l)=>{const t=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const v=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(v).forEach((n=>{var d,v,s,e,u;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n]:null===(u=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===u?void 0:u[n],(null==r?void 0:r.fbStatus)||t.push(n)}))})),t},exports.isCollectionPartiallyChecked=function(o,l,t){var i,n,d,v;let s=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==l?void 0:l.products)&&void 0!==i?i:{};s=Object.keys(v).length;const u=null!==(d=null===(n=t[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(u).length}else if(t[o]){const i=null==l?void 0:l.products;i&&Object.keys(i).forEach((o=>{var l;const t=null===(l=i[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>s+=1))}));const n=null===(v=t[o])||void 0===v?void 0:v.products;if(n&&Object.keys(n).forEach((o=>{var l;const t=null===(l=n[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>e+=1))})),s<=0&&e>0)return!1}return e>0&&s!==e},exports.isProductPartiallyChecked=(o,l,t,i,n)=>{var d,v,s,e,u,r,c,a,p,b,O,f,j,h,y,g,k,E,P;let D=0,S=0;if(null===(v=null===(d=null==t?void 0:t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(n)return!1;const d=(null===(u=null===(e=null===(s=null==t?void 0:t[o])||void 0===s?void 0:s.products)||void 0===e?void 0:e[l])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(c=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.products)||void 0===c?void 0:c[l],d=null===(O=null===(b=null===(p=null===(a=null==t?void 0:t[o])||void 0===a?void 0:a.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>S++)),Object.keys((null===(P=null===(E=null===(k=null==t?void 0:t[o])||void 0===k?void 0:k.products)||void 0===E?void 0:E[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&S!==D)return!0}return!1},exports.liftTheStateUp=(l,t)=>{const i=o.cloneDeep(t);if(delete i.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:i})).productId&&t.products){const n=o.cloneDeep(t.products[l.productId]);(null==n?void 0:n.variants)&&delete n.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:i,productOnlyData:n})}return l},exports.markVariantsAsApprovedProductsLevel=(o,l,t,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var t,i;Object.keys(null!==(i=null===(t=null==o?void 0:o[l])||void 0===t?void 0:t.variants)&&void 0!==i?i:{}).forEach((t=>{var i,n;const v=null===(i=null==o?void 0:o[l].variants)||void 0===i?void 0:i[t];v&&(v.fbStatus="APPROVED");const s=null===(n=null==d?void 0:d[l])||void 0===n?void 0:n.variants;s&&s[t]&&(s[t]=v)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),l({type:"productsPaged",data:{collectionId:t,products:d}})}else l({type:"productsPaged",data:{collectionId:t,products:d}})},exports.paginateSelectedItems=function(o,t,i){var n;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const e=o[s],u=l(e.products,t,i-v);u&&Object.keys(u).length>0&&(d[s]=Object.assign(Object.assign({},e),{products:u})),v+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const l=Object.keys(o.variants||[]);let t=!1;return!(l.length<=1)||(l.forEach((l=>{var i,n;t=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[l].name.includes(o.name))&&void 0!==n&&n})),!t)},exports.updateAllVariantsForSelectedProducts=(l,t,i)=>Object.keys(l).reduce(((n,d)=>{var v;return d in t?(n[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((n,v)=>{var s,e,u,r,c,a,p,b,O,f;const j=null===(s=t[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(u=null===(e=null==i?void 0:i.products)||void 0===e?void 0:e[d])||void 0===u?void 0:u.products)||void 0===r?void 0:r[v];return j?n[v]=Object.assign(Object.assign({},(null===(c=l[d].products)||void 0===c?void 0:c[v])||{}),{allVariants:o.cloneDeep(j.variants)}):h?n[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o.cloneDeep(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(n[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o.cloneDeep(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),n}),{})}),n):n}),{});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function l(o,l,t){if(!o)return{};const i=Object.keys(o).slice(t,t+l),n={};return i.forEach((l=>{n[l]=o[l]})),n}const t=(o,l,t)=>{Object.keys(o).forEach((l=>{var t,i;const n=null!==(i=null===(t=o[l])||void 0===t?void 0:t.products)&&void 0!==i?i:{};Object.keys(n).forEach((t=>{var i,n,d,v;const s=null!==(v=null===(d=null===(n=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===n?void 0:n[t])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((i=>{var n,d,v,s;const e=null===(s=null===(v=null===(d=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===d?void 0:d[t])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[i];e&&!e.fbStatus&&(e.fbStatus="APPROVED")}))}))})),l({type:t,data:o})};exports.fetchFbStatusCollection=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((t=>{var i,n;const d=null!==(n=null===(i=o[t])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];(null==u?void 0:u.fbStatus)||l.push(n)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const t=Object.assign({},o);Object.keys(t).forEach((o=>{var i,n;const d=null!==(n=null===(i=t[o])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(d).forEach((i=>{var n,d,v,s;const e=null!==(s=null===(v=null===(d=null===(n=t[o])||void 0===n?void 0:n.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,v,s,e;const u=null===(e=null===(s=null===(v=null===(d=t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];u&&"REJECTED"===l[n]?u.fbStatus="REJECTED":u&&"APPROVED"===l[n]&&(u.fbStatus="APPROVED")}))}))})),i({type:d,data:t})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},exports.getVariantIdsToFetchAtProductLevel=(o,l)=>{const t=[];return Object.keys(null!=o?o:{}).forEach((i=>{var n,d;const v=null!==(d=null===(n=null==o?void 0:o[i])||void 0===n?void 0:n.variants)&&void 0!==d?d:{};Object.keys(v).forEach((n=>{var d,v,s,e,u;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n]:null===(u=null===(e=null==o?void 0:o[i])||void 0===e?void 0:e.variants)||void 0===u?void 0:u[n],(null==r?void 0:r.fbStatus)||t.push(n)}))})),t},exports.isCollectionPartiallyChecked=function(o,l,t){var i,n,d,v;let s=0,e=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(i=null==l?void 0:l.products)&&void 0!==i?i:{};s=Object.keys(v).length;const u=null!==(d=null===(n=t[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};e=Object.keys(u).length}else if(t[o]){const i=null==l?void 0:l.products;i&&Object.keys(i).forEach((o=>{var l;const t=null===(l=i[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>s+=1))}));const n=null===(v=t[o])||void 0===v?void 0:v.products;if(n&&Object.keys(n).forEach((o=>{var l;const t=null===(l=n[o])||void 0===l?void 0:l.variants;t&&Object.keys(t).forEach((o=>e+=1))})),s<=0&&e>0)return!1}return e>0&&s!==e},exports.isProductPartiallyChecked=(o,l,t,i,n)=>{var d,v,s,e,u,r,c,a,p,b,O,f,j,h,y,g,E,k,P;let D=0,S=0;if(null===(v=null===(d=null==t?void 0:t[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(n)return!1;const d=(null===(u=null===(e=null===(s=null==t?void 0:t[o])||void 0===s?void 0:s.products)||void 0===e?void 0:e[l])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(d).length)for(const i in d){const n=null===(c=null===(r=null==t?void 0:t[o])||void 0===r?void 0:r.products)||void 0===c?void 0:c[l],d=null===(O=null===(b=null===(p=null===(a=null==t?void 0:t[o])||void 0===a?void 0:a.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[i];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==n?void 0:n.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==i?void 0:i.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>S++)),Object.keys((null===(P=null===(k=null===(E=null==t?void 0:t[o])||void 0===E?void 0:E.products)||void 0===k?void 0:k[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&S!==D)return!0}return!1},exports.liftTheStateUp=(l,t)=>{const i=o.cloneDeep(t);if(delete i.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:i})).productId&&t.products){const n=o.cloneDeep(t.products[l.productId]);(null==n?void 0:n.variants)&&delete n.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:i,productOnlyData:n})}return l},exports.markVariantsAsApprovedProductsLevel=(o,l,t,i,n)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var t,i;Object.keys(null!==(i=null===(t=null==o?void 0:o[l])||void 0===t?void 0:t.variants)&&void 0!==i?i:{}).forEach((t=>{var i,n;const v=null===(i=null==o?void 0:o[l].variants)||void 0===i?void 0:i[t];v&&(v.fbStatus="APPROVED");const s=null===(n=null==d?void 0:d[l])||void 0===n?void 0:n.variants;s&&s[t]&&(s[t]=v)}))})),i&&n){const o=Object.assign({},i);o.products=d,n(o),l({type:"productsPaged",data:{collectionId:t,products:d}})}else l({type:"productsPaged",data:{collectionId:t,products:d}})},exports.paginateSelectedItems=function(o,t,i){var n;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const e=o[s],u=l(e.products,t,i-v);u&&Object.keys(u).length>0&&(d[s]=Object.assign(Object.assign({},e),{products:u})),v+=Object.keys(null!==(n=e.products)&&void 0!==n?n:{}).length}return d},exports.shouldShowVariant=o=>{const l=Object.keys(o.variants||[]);let t=!1;return!(l.length<=1)||(l.forEach((l=>{var i,n;t=null!==(n=null===(i=o.variants)||void 0===i?void 0:i[l].name.includes(o.name))&&void 0!==n&&n})),!t)},exports.updateAllVariantsForSelectedProducts=(l,t,i)=>Object.keys(l).reduce(((n,d)=>{var v;return d in t?(n[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((n,v)=>{var s,e,u,r,c,a,p,b,O,f;const j=null===(s=t[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(u=null===(e=null==i?void 0:i.products)||void 0===e?void 0:e[d])||void 0===u?void 0:u.products)||void 0===r?void 0:r[v];return j?n[v]=Object.assign(Object.assign({},(null===(c=l[d].products)||void 0===c?void 0:c[v])||{}),{allVariants:o.cloneDeep(j.variants)}):h?n[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o.cloneDeep(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(n[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o.cloneDeep(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),n}),{})}),n):n}),{});
@@ -19,7 +19,6 @@ export interface VariantCardInterface {
19
19
  selectedCollectionsDispatch?: React.Dispatch<SelectedCollectionsActions>;
20
20
  outOfStockAction?: OUT_OF_STOCK_ACTION;
21
21
  onDelete?: () => void;
22
- pickerWidth?: string;
23
22
  }
24
23
  /**
25
24
  * Variant card in list view format.
@@ -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"),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()}})]})]})};
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"),a=require("../../constants/Theme.js"),i=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),n=require("../TypographyStyle.js"),o=require("./constants.js"),c=require("./helpers/ProductHelper.js"),l=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=m=>{var j,g,h;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y}=m,b=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:I,tagType:O}=c.ProductHelper.getDataForProductPickerTag(p,!0,y),T=`${p.currency&&null!==(j=o.CurrencySymbols[p.currency])&&void 0!==j?j:""}${null!==(h=null!==(g=p.price)&&void 0!==g?g:p.actualPrice)&&void 0!==h?h:""}`;return e.jsxs(d.VariantCardListStyle,{children:[e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:a.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:b(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(n.TitleSmall,Object.assign({numberOfLines:1},{children:b()}))})),e.jsx(l.ProductPickerTag,{isVariant:!0,data:v,tagText:I,tagType:O}),e.jsx(n.BodyCaption,Object.assign({color:a.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||I?null:T}))]}))]})),e.jsx(i.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:a.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),m.onDelete&&m.onDelete()}})]})};
@@ -10,12 +10,11 @@ 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;
14
13
  };
15
14
  /**
16
15
  * Returns a react component of variants list, which are eligible to drag and drop.
17
16
  */
18
- export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, pickerWidth, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
19
18
  /**
20
19
  * Returns a react component of variants grid, which are eligible to drag and drop.
21
20
  */
@@ -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: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
+ "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:n,setSelectedVariants:d,selectedCollectionsDispatch:l,outOfStockAction:o}=i;const[p,c]=r.useState(-1);function b(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:n.length<8?"550px":"100%",overflow:"auto"},r.droppableProps.style)},{children:[n.map(((r,i)=>e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px",boxShadow:i===p?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>c(i),onMouseLeave:()=>c(-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:b(Object.assign(Object.assign({},a.draggableProps.style),a.draggableSnapshot))},{children:e.jsx(t.VariantCardListView,{data:r,selectedCollectionsDispatch:l,onDelete:()=>{const e=n.slice();e[i].displayOrder=null,e.splice(i,1),d(e)},outOfStockAction:o},`${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 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:W,hideProductCheckbox:$,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),We())}),[J]),n((()=>{ee&&Object.keys(we||{}).length&&ve&&(R.onAdd(we,ve),We())}),[ee,we,ve]);const We=()=>{Ae({type:"reset",data:{}})},$e=()=>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:W,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:$,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:$,hideProductVariants:X,hideVariantCheckbox:H,storeId:w,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:be,renderWithoutModal:q,hideCollectionCheckbox:W,outOfStockAction:M,pickerWidth:U||"600px"})]}))]}));return t(o,{children:q?e(o,{children:[He,re.renderFooter?e(O,{children:[$e(),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),We(),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(),We()},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),We(),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),We()}},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,{}):$e(),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};
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 C}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as f}from"./productScreen.js";import{RearrangeScreen as y}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as S,selectedColectionsReducer as v,CollectionIdContext as k}from"./reducers.js";import{SearchScreen as j}from"./searchScreen.js";import{SelectedScreen as I}from"./selectedScreen.js";import{ContainerStyle as P,ScrollContainerStyle as x,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:M,outOfStockAction:H=D.BLUR,hideVariantCheckbox:W,selectProductsFromCustomCollection:G,hideSelectionCount:N,title:Y,width:K,left:U,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(b,{}),[ae,ue]=s([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections),[he,pe]=s("grid"),[me,Ce]=s(""),[ge,fe]=s(""),[ye,be]=s(0),[Se,ve]=s(!1),[ke,je]=s(0),[Ie,Pe]=s(""),[xe,Oe]=s(!1),[De,Fe]=s(!1),[Te,Re]=r(S,{collections:{},products:{}}),[we,Ae]=r(v,Object.keys(A).length>0?A:{}),Be=i(null),[Ee,Le]=s(!1),[ze,Ve]=s();n((()=>{ve(!0),Fe(!0),R.collectionFetcher(ye,w).then((e=>{console.log("collectionsParsed?.collections",null==e?void 0:e.collections),de({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ve(!1),be((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((()=>{ge&&(ve(!0),R.productFetcher(ge,w).then((e=>{Object.keys(e).length&&de({type:"productsFetched",data:{collectionId:ge,products:e}}),ve(!1)})).catch())}),[ge]),n((()=>{const e=setTimeout((()=>{"rearrange"!==ae&&(Ie.length||"collections"!==ae)&&(Ie.length?(Oe(!0),R.searchFetcher(w,Ie).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"),ve(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[Ie]),n((()=>{J&&(R.onAdd(we,ke),$e())}),[J]),n((()=>{ee&&Object.keys(we||{}).length&&ke&&(R.onAdd(we,ke),$e())}),[ee,we,ke]);const $e=()=>{Ae({type:"reset",data:{}})},Me=()=>z&&ke>z?t(m,{tagText:`You can only select ${z} products`,type:"negative"}):V&&ke>V?t(m,{tagText:`You can only select ${V} products`,type:"negative"}):t(a,ke>0?{onClick:()=>{ue(_?T.RearrangeProducts:T.SelectedProducts)},buttonText:z?`${ke}/${z} products selected`:`${ke} products selected`,buttonType:["rearrange","view"].includes(ae)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ae)}:{disabled:!0,buttonText:z?`${ke}/${z} products selected`:`${ke} products selected`,buttonType:"tertiaryGray"}),He=e=>Se?"Loading...":ae===T.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",We=e(P,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 for collections and products, or type a product ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>xe?t(p,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ie,onChangeText:e=>{e.length&&e.trim().length?Pe(e):Pe("")}})}))}),e(x,Object.assign({ref:Be,screenName:ae},{children:["collections"===ae&&t(C,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:De,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:Ce,setSelectedCollectionId:fe,setScreen:ue,selectedCollections:we,collectionFetcher:R.collectionFetcher,storeId:w,collectionsDispatch:de,setSaveDisabled:ve,pagingControls:{curPage:ye,setCurPage:be},hideCollectionCheckbox:$,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Be}),"products"===ae&&me&&t(k.Provider,Object.assign({value:me},{children:t(f,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:ue,storeId:w,data:le[me],collectionsDispatch:de,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:ve,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:M,outOfStockAction:H,hideVariantCheckbox:W,selectProductsFromCustomCollection:G,renderWithoutModal:q,pickerType:Q,hideProductVariants:X,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:te,scrollContainerRef:Be})})),"view"===ae&&t(I,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:X,outOfStockAction:H,storeId:w,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===ae&&t(y,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:H,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Be,storeId:w,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===ae&&t(j,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:we||{},searchedCollections:Te||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{Pe(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:Q,hideProductCheckbox:M,hideProductVariants:X,hideVariantCheckbox:W,storeId:w,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:Ce,setSelectedCollectionId:fe,renderWithoutModal:q,hideCollectionCheckbox:$,outOfStockAction:H})]}))]}));return t(o,{children:q?e(o,{children:[We,re.renderFooter?e(O,{children:[Me(),t(a,{buttonText:He(re.primaryButtonText),disabled:!re.isLoading&&(Se||ke<1||z&&ke<z||!z&&V&&ke>V)||re.primaryButtonDisabled,isLoading:re.isLoading,onClick:()=>{R.onAdd(we,ke),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}})]}):t(o,{}),Ee&&ze?t(g,{productData:ze,outOfStockAction:H,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):t(o,{})]}):e(h,Object.assign({zIndex:L,open:E,onClose:()=>{null==B||B(),$e()},headingTitle:Y||("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:K||"600px",left:U||"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||ke<1||z&&ke<z||!z&&V&&ke>V)||e.disabled,onClick:()=>{R.onAdd(we,ke),$e(),ue([T.Collections,T.RearrangeProducts].includes(Z)?Z:T.Collections)}}))(se):{buttonText:He(),disabled:Se||ke<1||z&&ke<z||!z&&V&&ke>V||!1,onClick:()=>{R.onAdd(we,ke),$e()}},secondaryButton:ie?(e=>Object.assign(Object.assign({},e),{disabled:Se||ke<1||z&&ke<z||!z&&V&&ke>V||!1,onClick:()=>{const e=F(we,le,Te);R.onAdd(e,ke,!0)}}))(ie):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?t(o,{}):Me(),hideCrossButton:Ee||ce},{children:[We,Ee&&ze?t(g,{productData:ze,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:H,onClose:()=>{Le(!1)}}):t(o,{})]}))})};export{R as ProductPickerModal,T as ScreenName};
@@ -18,7 +18,6 @@ interface ProductGroupInterface {
18
18
  showProductDetailInfoIcon?: boolean;
19
19
  pickerType?: 'COLLECTION' | 'PRODUCT';
20
20
  onProductDetailClick?: (productData: Product | ProductVariant) => void;
21
- pickerWidth?: string;
22
21
  }
23
22
  export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
24
23
  interface ProductCardInterface {
@@ -40,7 +39,6 @@ interface ProductCardInterface {
40
39
  pickerType?: 'COLLECTION' | 'PRODUCT';
41
40
  onProductDetailClick?: (productData: Product | ProductVariant) => void;
42
41
  currencyAndPrice?: string;
43
- pickerWidth?: string;
44
42
  }
45
43
  export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
46
44
  export {};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as i,Fragment as e}from"react/jsx-runtime";import{COLORS as o}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as r}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{Tooltip as l}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 p}from"./ProductPickerTag.js";import{ProductCardStyle as v,StyledTitleSmall as h,ProductInfo as m,ProductSubTitle as I,SKUIDBadge as y,EllipsedBodyTiny as P}from"./style.js";import{shouldShowVariant as k,getSkuId as f}from"./utility.js";const g=e=>{var o,c,d,r,n,l,a,u,p;const{collectionId:v,productId:h,data:m,selectedData:I,selectedCollectionsDispatch:y,viewOnly:P,upliftAdditions:f,isProductPartiallyChecked:g,hideProductCheckbox:j,outOfStockAction:C,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:T,showProductDetailInfoIcon:S,pickerWidth:V}=e,w=t=>{var i,e,o,c,d,r;if(!(null===(e=null===(i=null==I?void 0:I[v])||void 0===i?void 0:i.products)||void 0===e?void 0:e[h]))return!1;return!!(null===(r=null===(d=null===(c=null===(o=null==I?void 0:I[v])||void 0===o?void 0:o.products)||void 0===c?void 0:c[h])||void 0===d?void 0:d.variants)||void 0===r?void 0:r[t])},A=x||!k(m)?`${m.currency&&null!==(o=s[m.currency])&&void 0!==o?o:""}${null!==(p=null!==(n=null===(r=null===(d=Object.values(null!==(c=m.variants)&&void 0!==c?c:{}))||void 0===d?void 0:d[0])||void 0===r?void 0:r.price)&&void 0!==n?n:null===(u=null===(a=Object.values(null!==(l=m.variants)&&void 0!==l?l:{}))||void 0===a?void 0:a[0])||void 0===u?void 0:u.actualPrice)&&void 0!==p?p:""}`:"";return t("div",{children:[i(b,{isVariant:!1,data:m,productId:h,collectionId:v,isSelected:(()=>{var t,i;return!!(null===(i=null===(t=null==I?void 0:I[v])||void 0===t?void 0:t.products)||void 0===i?void 0:i[h])})(),isPartiallyChecked:g,selectedCollectionsDispatch:y,upliftAdditions:f,viewOnly:P,hideProductCheckbox:j,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,outOfStockAction:C,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:A,pickerWidth:V},h),x?null:k(m)&&Object.keys(m.variants||[]).map((t=>{var e,o,c,d,r,n,l;const a=`${m.currency&&null!==(e=s[m.currency])&&void 0!==e?e:""}${null!==(l=null!==(d=null===(c=null===(o=m.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(n=null===(r=m.variants)||void 0===r?void 0:r[t])||void 0===n?void 0:n.actualPrice)&&void 0!==l?l:""}`;return i(b,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},m.variants[t]),{currency:m.currency}),variantId:t,productId:h,viewOnly:P,upliftAdditions:f,collectionId:v,isSelected:w(t),selectedCollectionsDispatch:y,outOfStockAction:C,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:a,pickerWidth:V},t)}))]})},b=s=>{const{isVariant:k,data:g,productId:b,collectionId:j,variantId:C,isSelected:O,selectedCollectionsDispatch:x,viewOnly:D,upliftAdditions:T,isPartiallyChecked:S,hideProductCheckbox:V,outOfStockAction:w,hideVariantCheckbox:A,hideProductVariants:U,pickerType:$="PRODUCT",onProductDetailClick:F,showProductDetailInfoIcon:W,currencyAndPrice:B,pickerWidth:R}=s,{isVariantForProductPickerTag:H,dataForProductPickerTag:K,tagText:L,tagType:q}=u.getDataForProductPickerTag(g,k,w);console.log({data:g,isVariant:k,isVariantForProductPickerTag:H});const z=f(g,k);return t(v,Object.assign({isVariant:k,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===$&&(V||A)){const t=Object.keys(g.variants);U?O?x({type:"productUnselected",data:{productId:b,collectionId:j}}):T("productSelected",{productId:b,variantId:C,collectionId:j,product:g}):O?x({type:"variantUnselected",data:{productId:b,variantId:C,collectionId:j}}):T("variantSelected",{productId:b,variantId:C||t[0],collectionId:j,variant:g})}},isActive:O},{children:[k&&!D&&!A||!k&&!D&&!V?i(d,{isChecked:O,isPartiallyChecked:S||!1,onValueChange:function(t,i,e){null==e||e.stopPropagation(),k?t?T(U?"productSelected":"variantSelected",{productId:b,variantId:C,collectionId:j,variant:g}):x({type:U?"productUnselected":"variantUnselected",data:{productId:b,variantId:C,collectionId:j}}):t?T("productSelected",{productId:b,collectionId:j,product:g}):x({type:"productUnselected",data:{productId:b,collectionId:j}})}}):i(e,{}),i("div",{children:i(n,{width:40,height:40,imageUrl:g.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(l,Object.assign({variant:"light",body:g.name,placement:"bottom",delay:400},{children:i(h,Object.assign({style:{width:L?`calc(${R} - 310px)`:`calc(${R} - ${k?"30px":"0px"} - 160px)`},numberOfLines:1},{children:g.name}))})),t(m,{children:[i(p,{isVariant:H,data:K,tagText:L,tagType:q}),W&&i(r,{onClick:()=>{null==F||F(g)},Icon:()=>i(c,{width:20,height:20,color:o.content.placeholder})})]})]})),t(I,{children:[!(null==K?void 0:K.fbStatus)&&H||L?null:i(a,Object.assign({color:o.content.secondary},{children:B})),z&&i(l,Object.assign({body:z,placement:"top"},{children:i(y,{children:i(P,{children:`SKU ID: ${z}`})})}))]})]}))]}))};export{b as ProductCard,g as ProductGroup};
1
+ import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as r}from"../shimmer-image/ShimmerImage.js";import{Tooltip as l}from"../tooltips/Tooltip.js";import{TitleSmall as a,BodyCaption as s}from"../TypographyStyle.js";import{CurrencySymbols as u}from"./constants.js";import{ProductHelper as v}from"./helpers/ProductHelper.js";import{ProductPickerTag as p}from"./ProductPickerTag.js";import{ProductCardStyle as h}from"./style.js";import{shouldShowVariant as m}from"./utility.js";const I=o=>{var e,c,d,n,r,l,a,s,v;const{collectionId:p,productId:h,data:I,selectedData:P,selectedCollectionsDispatch:f,viewOnly:k,upliftAdditions:g,isProductPartiallyChecked:C,hideProductCheckbox:b,outOfStockAction:j,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:T,showProductDetailInfoIcon:S}=o,V=t=>{var i,o,e,c,d,n;if(!(null===(o=null===(i=null==P?void 0:P[p])||void 0===i?void 0:i.products)||void 0===o?void 0:o[h]))return!1;return!!(null===(n=null===(d=null===(c=null===(e=null==P?void 0:P[p])||void 0===e?void 0:e.products)||void 0===c?void 0:c[h])||void 0===d?void 0:d.variants)||void 0===n?void 0:n[t])},A=x||!m(I)?`${I.currency&&null!==(e=u[I.currency])&&void 0!==e?e:""}${null!==(v=null!==(r=null===(n=null===(d=Object.values(null!==(c=I.variants)&&void 0!==c?c:{}))||void 0===d?void 0:d[0])||void 0===n?void 0:n.price)&&void 0!==r?r:null===(s=null===(a=Object.values(null!==(l=I.variants)&&void 0!==l?l:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==v?v:""}`:"";return t("div",{children:[i(y,{isVariant:!1,data:I,productId:h,collectionId:p,isSelected:(()=>{var t,i;return!!(null===(i=null===(t=null==P?void 0:P[p])||void 0===t?void 0:t.products)||void 0===i?void 0:i[h])})(),isPartiallyChecked:C,selectedCollectionsDispatch:f,upliftAdditions:g,viewOnly:k,hideProductCheckbox:b,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,outOfStockAction:j,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:A},h),x?null:m(I)&&Object.keys(I.variants||[]).map((t=>{var o,e,c,d,n,r,l;const a=`${I.currency&&null!==(o=u[I.currency])&&void 0!==o?o:""}${null!==(l=null!==(d=null===(c=null===(e=I.variants)||void 0===e?void 0:e[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(r=null===(n=I.variants)||void 0===n?void 0:n[t])||void 0===r?void 0:r.actualPrice)&&void 0!==l?l:""}`;return i(y,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:h,viewOnly:k,upliftAdditions:g,collectionId:p,isSelected:V(t),selectedCollectionsDispatch:f,outOfStockAction:j,onProductDetailClick:T,showProductDetailInfoIcon:S,currencyAndPrice:a},t)}))]})},y=u=>{const{isVariant:m,data:I,productId:y,collectionId:P,variantId:f,isSelected:k,selectedCollectionsDispatch:g,viewOnly:C,upliftAdditions:b,isPartiallyChecked:j,hideProductCheckbox:O,outOfStockAction:x,hideVariantCheckbox:D,hideProductVariants:T,pickerType:S="PRODUCT",onProductDetailClick:V,showProductDetailInfoIcon:A,currencyAndPrice:w}=u,{isVariantForProductPickerTag:U,dataForProductPickerTag:$,tagText:B,tagType:F}=v.getDataForProductPickerTag(I,m,x);return t(h,Object.assign({isVariant:m,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===S&&(O||D)){const t=Object.keys(I.variants);T?k?g({type:"productUnselected",data:{productId:y,collectionId:P}}):b("productSelected",{productId:y,variantId:f,collectionId:P,product:I}):k?g({type:"variantUnselected",data:{productId:y,variantId:f,collectionId:P}}):b("variantSelected",{productId:y,variantId:f||t[0],collectionId:P,variant:I})}},isActive:k},{children:[m&&!C&&!D||!m&&!C&&!O?i(d,{isChecked:k,isPartiallyChecked:j||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),m?t?b(T?"productSelected":"variantSelected",{productId:y,variantId:f,collectionId:P,variant:I}):g({type:T?"productUnselected":"variantUnselected",data:{productId:y,variantId:f,collectionId:P}}):t?b("productSelected",{productId:y,collectionId:P,product:I}):g({type:"productUnselected",data:{productId:y,collectionId:P}})}}):i(o,{}),i("div",{children:i(r,{width:40,height:40,imageUrl:I.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(l,Object.assign({variant:"light",body:I.name,placement:"bottom",delay:400},{children:i(a,Object.assign({numberOfLines:1},{children:I.name}))})),A&&i(n,{onClick:()=>{null==V||V(I)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(p,{isVariant:U,data:$,tagText:B,tagType:F}),i(s,Object.assign({color:e.content.secondary},{children:!(null==$?void 0:$.fbStatus)&&U||B?null:w}))]}))]}))};export{y as ProductCard,I 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 r}from"../../constants/Theme.js";import a 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 c}from"../tooltips/Tooltip.js";import{TitleRegular as d,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 g}from"./style.js";import{getSkuId as v,shouldShowVariant as f}from"./utility.js";const x=i=>o(y,{children:[t(D,{}),t(b,{children:t(e,{className:"close-button",onClick:i.onClose,Icon:a,width:20,height:20})}),t(h,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),h=i=>{var a,e,x,h,y,D,b,P,T,S,O,w,$,z,A,F;const C=void 0===i.productData.variants;let H;if(C)H=`${i.productData.currency&&null!==(a=s[i.productData.currency])&&void 0!==a?a:""}${null!==(y=null!==(x=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==x?x:null===(h=i.productData)||void 0===h?void 0:h.actualPrice)&&void 0!==y?y:""}`;else{const o=null===(D=i.productData)||void 0===D?void 0:D.currency;H=`${o&&null!==(b=s[o])&&void 0!==b?b:""}${null!==(A=null!==(O=null===(S=null===(T=Object.values(null!==(P=i.productData.variants)&&void 0!==P?P:{}))||void 0===T?void 0:T[0])||void 0===S?void 0:S.price)&&void 0!==O?O:null===(z=null===($=Object.values(null!==(w=i.productData.variants)&&void 0!==w?w:{}))||void 0===$?void 0:$[0])||void 0===z?void 0:z.actualPrice)&&void 0!==A?A:""}`}const{isVariantForProductPickerTag:N,dataForProductPickerTag:U,tagText:V,tagType:_}=u.getDataForProductPickerTag(i.productData,C,i.outOfStockAction);console.log({productData:i.productData});const B=v(i.productData,C);return o(j,{children:[t(k,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(I,{children:[B&&t(c,Object.assign({body:B,placement:"top"},{children:t(m,{children:t(g,{children:`SKU ID: ${B}`})})})),t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(l,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(l,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(F=i.productData.description)&&void 0!==F?F:""}}),t(l,Object.assign({color:r.content.secondary},{children:C?H:f(i.productData)?null:H})),t(p,{isVariant:N,data:U,tagText:V,tagType:_})]})]})},y=i.div`
1
+ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import a from"../../assets/icons/cross.svg.js";import{IconButton as e}from"../icon-button/IconButton.js";import{ShimmerImage as d}from"../shimmer-image/ShimmerImage.js";import{BodyTiny as n,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{shouldShowVariant as m}from"./utility.js";const g=i=>o(f,{children:[t(x,{}),t(h,{children:t(e,{className:"close-button",onClick:i.onClose,Icon:a,width:20,height:20})}),t(v,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),v=i=>{var a,e,g,v,f,x,h,j,I,P,S,T,w,O,$,z;const A=void 0===i.productData.variants;let F;if(A)F=`${i.productData.currency&&null!==(a=s[i.productData.currency])&&void 0!==a?a:""}${null!==(f=null!==(g=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==g?g:null===(v=i.productData)||void 0===v?void 0:v.actualPrice)&&void 0!==f?f:""}`;else{const o=null===(x=i.productData)||void 0===x?void 0:x.currency;F=`${o&&null!==(h=s[o])&&void 0!==h?h:""}${null!==($=null!==(S=null===(P=null===(I=Object.values(null!==(j=i.productData.variants)&&void 0!==j?j:{}))||void 0===I?void 0:I[0])||void 0===P?void 0:P.price)&&void 0!==S?S:null===(O=null===(w=Object.values(null!==(T=i.productData.variants)&&void 0!==T?T:{}))||void 0===w?void 0:w[0])||void 0===O?void 0:O.actualPrice)&&void 0!==$?$:""}`}const{isVariantForProductPickerTag:L,dataForProductPickerTag:C,tagText:H,tagType:N}=u.getDataForProductPickerTag(i.productData,A,i.outOfStockAction);return console.log({product:i.productData}),o(y,{children:[t(b,{children:t(d,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(D,{children:[i.productData.skuId&&t(k,{children:t(n,Object.assign({color:r.background.inverseLight},{children:`SKU ID: ${i.productData.skuId}`}))}),t(c,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(l,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(l,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(z=i.productData.description)&&void 0!==z?z:""}}),t(l,Object.assign({color:r.content.secondary},{children:A?F:m(i.productData)?null:F})),t(p,{isVariant:L,data:C,tagText:H,tagType:N})]})]})},f=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
- `,D=i.div`
20
+ `,x=i.div`
21
21
  display: flex;
22
22
  flex: 1;
23
23
  background: rgba(0, 0, 0, 0.5);
24
- `,b=i.div`
24
+ `,h=i.div`
25
25
  position: relative;
26
26
 
27
27
  .close-button {
@@ -32,21 +32,26 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
32
32
  background: ${r.surface.standard};
33
33
  border-radius: 50%;
34
34
  }
35
- `,j=i.div`
35
+ `,y=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
- `,k=i.div`
41
+ `,b=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
- `,I=i.div`
47
+ `,D=i.div`
48
48
  display: flex;
49
49
  flex: 1;
50
50
  flex-direction: column;
51
51
  gap: 4px;
52
- `;export{h as ProductInfoCard,x as ProductInfoOverlay};
52
+ `,k=i.div`
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};
@@ -25,7 +25,6 @@ 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;
29
28
  }
30
29
  export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
31
30
  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 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};
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 O}from"./reducers.js";import{ProductScreenHeader as k,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:J,storeId:M,setScreen:W,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}=R,$=i(O),tt=s(0),et=s(!1),[ot,ct]=l(""),[rt,nt]=l(!1),[it,st]=l(V),lt=s(!0),dt=s(!1);d((()=>{if(lt.current)return void(lt.current=!1);const t=setTimeout((()=>{ot.length?(nt(!0),R.searchInCollectionFetcher(M,$,ot).then((t=>{const e=n(V);e.products=t,console.log({products:t}),st(e);const o=I(null!=t?t:{});ut(o,null!=t?t:{},!0),z(!1),nt(!1)}))):st(V)}),800);return()=>clearTimeout(t)}),[ot]);d((()=>{var t,e,o,c;dt.current=!1,tt.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:{});ut(r,null!==(c=V.products)&&void 0!==c?c:{})}),[$]);const at=!!K&&V.isSmartCollection;d((()=>{(null==V?void 0:V.products)||ht(10)}),[]);const ut=(t,e,o)=>{Q||(o?D(e,A,$,it,st):D(e,A,$)),t.length>0&&Q&&Q(M,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?(st((t=>{const e=Object.assign({},t);return e.products=c,e})),A({type:"productsPaged",data:{collectionId:$,products:c}})):A({type:"productsPaged",data:{collectionId:$,products:c}})})).catch((t=>{o?D(e,A,$,it,st):D(e,A,$)}))},ht=t=>{z(!0),nt(!0),J($,M,t,0).then((e=>{if(Object.keys(e).length||(dt.current=!0),Object.keys(e).length){st(Object.assign(Object.assign({},it),{products:e}));const t=I(e);ut(t,e),tt.current=1}t||F({type:"selected",data:{id:$,val:Object.assign(Object.assign({},V),{products:e})}}),z(!1),nt(!1)})).catch()},pt=(t,e)=>{const o=E(e,V);F({type:t,data:Object.assign(Object.assign({},o),{isRestricted:K})})},mt=!!(null==B?void 0:B[$])&&!!Object.keys(null!==(w=null===(T=null==B?void 0:B[$])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{W("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:()=>rt&&ot.length?e(g,{size:"small",color:a.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:ot,onChangeText:t=>{t.length&&t.trim().length?ct(t):ct("")},placeholder:"Search for a product or type a product ID"})})),Object.keys((null==it?void 0:it.products)||[]).length>0&&!at&&!ot.length&&!L&&"-1"!==$&&t(C,{children:[e(u,{isChecked:mt,isPartiallyChecked:S($,it,B,G),onValueChange:function(t){t?ht():F({type:"unselected",data:{id:$}})}}),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==it?void 0:it.products)||[]).length<10)&&!!Object.keys((null==it?void 0:it.products)||[]).length,fetchMore:()=>(et.current=!0,J($,M,10,tt.current).then((t=>{let e=!1;if(Object.keys(t).length||(e=!0),Object.keys(t).length){const e=it;e.products=Object.assign(Object.assign({},it.products),t),st(Object.assign({},e));const o=I(t);ut(o,t)}return z(!1),et.current=!1,tt.current+=1,e}))),containerRef:Z},{children:Object.keys((null==it?void 0:it.products)||[]).length?Object.keys(it.products||[]).map((t=>e(b,{outOfStockAction:N,collectionId:$,isProductPartiallyChecked:x($,t,B,it,G),productId:t,data:it.products[t],selectedData:B,selectedCollectionsDispatch:F,viewOnly:!_&&!!at,upliftAdditions:pt,hideProductCheckbox:L,hideVariantCheckbox:U,hideProductVariants:G,pickerType:q,onProductDetailClick:X,showProductDetailInfoIcon:Y},t))):rt?e(y,{limit:10}):e(v,{title:"No products to show",subtitle:ot.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,7 +11,6 @@ interface RearrangeScreenInterface {
11
11
  scrollContainerRef: React.RefObject<HTMLDivElement>;
12
12
  storeId: string;
13
13
  fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
14
- pickerWidth?: string;
15
14
  }
16
15
  /**
17
16
  * 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 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};
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 c}from"react-beautiful-dnd";import{COLORS as i}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:O,fbStatusFetcher:v}=h,[V,k]=r(d(j));s((()=>{k(d(j))}),[j]),s((()=>{var t;null===(t=null==C?void 0:C.current)||void 0===t||t.scrollTo({top:0}),m(j,O,y,v,"update")}),[]);return t(c,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})),k(e)}},{children:[t(p,{children:[e(n,{Icon:o,width:16,height:16,color:i.content.secondary,onClick:()=>{S("collections")}}),e(l,Object.assign({color:i.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===g?e(u,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:y,outOfStockAction:b}):e(f,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:y}):e(a,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};export{h as RearrangeScreen};
@@ -24,7 +24,6 @@ interface SearchScreenInterface {
24
24
  hideCollectionCheckbox?: boolean;
25
25
  renderWithoutModal?: boolean;
26
26
  outOfStockAction?: OUT_OF_STOCK_ACTION;
27
- pickerWidth?: string;
28
27
  }
29
28
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
30
29
  export {};
@@ -1 +1 @@
1
- import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import{useEffect as l}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{var C;const{customCollectionRestriction:k,selectedCollections:y,searchedCollections:b,searchedCollectionsDispatch:f,selectedCollectionsDispatch:j,setScreen:S,collections:O,onBackPress:P,hideVariantCheckbox:I,pickerType:g,hideProductVariants:x,hideProductCheckbox:D,storeId:W,fbStatusFetcher:T,setCollectionId:V,setSelectedCollectionId:w,hideCollectionCheckbox:A,renderWithoutModal:R,outOfStockAction:B,pickerWidth:M}=m;l((()=>{var o;a(null!==(o=b.products)&&void 0!==o?o:{},W,f,T,"setProducts")}),[null==b?void 0:b.products]);const F=!!k&&(null==y?void 0:y.isCustom);return o("div",{children:[o(u,{children:[e(c,{Icon:i,onClick:()=>{S("collections"),P()}}),e(d,{children:(null===(C=Object.keys(null==b?void 0:b.collections))||void 0===C?void 0:C.length)?"Searched Collections & Products":"Searched Products"})]}),e("div",{children:Object.keys(null==b?void 0:b.products).length||Object.keys(null==b?void 0:b.collections).length?o(t,{children:[e(t,{children:Object.keys(null==b?void 0:b.collections).map((o=>e(s,{customCollectionRestriction:k,data:null==O?void 0:O[o],isDisabled:F&&!(null==y?void 0:y[o]),isChecked:!!(null==y?void 0:y[o]),isPartiallyChecked:p(o,null==O?void 0:O[o],y,x),selectedCollectionsDispatch:j,setCollectionId:V,setSelectedCollectionId:w,setScreen:S,id:o,hideCollectionCheckbox:A||"-1"===o,selectedCollections:y,renderWithoutModal:R,pickerType:g,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==b?void 0:b.products).map((o=>{var t,i;return Object.keys((null===(i=null===(t=null==b?void 0:b.products)||void 0===t?void 0:t[o])||void 0===i?void 0:i.products)||[]).map((t=>{var i,l,c;let d=!1;return(null===(i=null==b?void 0:b.products)||void 0===i?void 0:i.isCustom)&&(d=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var i;const l=v(t,null===(i=null==b?void 0:b.products)||void 0===i?void 0:i[o]);j({type:e,data:Object.assign(Object.assign({},l),{isRestricted:k})})})(o,e,t),productId:t,data:(null===(l=null==b?void 0:b.products)||void 0===l?void 0:l[o].products)[t],isProductPartiallyChecked:h(o,t,y,null===(c=b.products)||void 0===c?void 0:c[o],x),selectedData:y,selectedCollectionsDispatch:j,viewOnly:d,hideProductCheckbox:D,hideVariantCheckbox:I,hideProductVariants:x,pickerType:g,outOfStockAction:B,pickerWidth:M},t)}))}))})]}):e(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
1
+ import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{var C;const{customCollectionRestriction:k,selectedCollections:y,searchedCollections:b,searchedCollectionsDispatch:f,selectedCollectionsDispatch:j,setScreen:S,collections:O,onBackPress:P,hideVariantCheckbox:I,pickerType:g,hideProductVariants:x,hideProductCheckbox:D,storeId:T,fbStatusFetcher:V,setCollectionId:w,setSelectedCollectionId:A,hideCollectionCheckbox:R,renderWithoutModal:W,outOfStockAction:B}=m;i((()=>{var o;a(null!==(o=b.products)&&void 0!==o?o:{},T,f,V,"setProducts")}),[null==b?void 0:b.products]);const M=!!k&&(null==y?void 0:y.isCustom);return o("div",{children:[o(u,{children:[e(c,{Icon:l,onClick:()=>{S("collections"),P()}}),e(d,{children:(null===(C=Object.keys(null==b?void 0:b.collections))||void 0===C?void 0:C.length)?"Searched Collections & Products":"Searched Products"})]}),e("div",{children:Object.keys(null==b?void 0:b.products).length||Object.keys(null==b?void 0:b.collections).length?o(t,{children:[e(t,{children:Object.keys(null==b?void 0:b.collections).map((o=>e(s,{customCollectionRestriction:k,data:null==O?void 0:O[o],isDisabled:M&&!(null==y?void 0:y[o]),isChecked:!!(null==y?void 0:y[o]),isPartiallyChecked:p(o,null==O?void 0:O[o],y,x),selectedCollectionsDispatch:j,setCollectionId:w,setSelectedCollectionId:A,setScreen:S,id:o,hideCollectionCheckbox:R||"-1"===o,selectedCollections:y,renderWithoutModal:W,pickerType:g,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==b?void 0:b.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==b?void 0:b.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let d=!1;return(null===(l=null==b?void 0:b.products)||void 0===l?void 0:l.isCustom)&&(d=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var l;const i=v(t,null===(l=null==b?void 0:b.products)||void 0===l?void 0:l[o]);j({type:e,data:Object.assign(Object.assign({},i),{isRestricted:k})})})(o,e,t),productId:t,data:(null===(i=null==b?void 0:b.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:h(o,t,y,null===(c=b.products)||void 0===c?void 0:c[o],x),selectedData:y,selectedCollectionsDispatch:j,viewOnly:d,hideProductCheckbox:D,hideVariantCheckbox:I,hideProductVariants:x,pickerType:g,outOfStockAction:B},t)}))}))})]}):e(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
@@ -13,7 +13,6 @@ interface SelectedScreenInterface {
13
13
  outOfStockAction?: OUT_OF_STOCK_ACTION;
14
14
  storeId: string;
15
15
  fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
16
- pickerWidth?: string;
17
16
  }
18
17
  export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
19
18
  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: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};
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:S,hideProductVariants:k=!1,outOfStockAction:I,storeId:O,fbStatusFetcher:g}=v,C=c(0),P=c(null),[w,A]=i(a,{});n((()=>{C.current=0;const t=m(y,10,0);A({type:"paginate",data:t}),f(t,O,A,g,"set"),C.current+=1}),[]),n((()=>{A({type:"filter",data:y})}),[y]),n((()=>{const t=new IntersectionObserver((t=>{if(t[0].isIntersecting&&C.current>0){const t=m(y,10,C.current);A({type:"paginate",data:t}),f(t,O,A,g,"update"),C.current+=1}}),{threshold:1});return P.current&&t.observe(P.current),()=>{P.current&&t.unobserve(P.current)}}),[P,y]);const D=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(w).length>0?e(r,{children:Object.keys(w).map((t=>{var r;return Object.keys((null===(r=null==w?void 0:w[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==D?void 0:D.isCustom)&&(o=!0),e(u,{upliftAdditions:null,collectionId:t,productId:r,data:w[t].products[r],isProductPartiallyChecked:h(t,r,D,null==S?void 0:S[t],k),selectedData:D,selectedCollectionsDispatch:j,viewOnly:o,hideProductVariants:k,outOfStockAction:I},r)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("div",{ref:P})]})]})};export{v as SelectedScreen};
@@ -23,14 +23,3 @@ 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{BodyTiny as t,TitleSmall as o}from"../TypographyStyle.js";import{ScreenName as n}from"./modal.js";const r=e.div`
1
+ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{ScreenName as t}from"./modal.js";const o=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
- `,d=e.div`
6
+ `,n=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!==n.RearrangeProducts?"#888":"#fff"};
16
+ background-color: ${e=>e.screenName!==t.RearrangeProducts?"#888":"#fff"};
17
17
  border-radius: 8px;
18
18
  }
19
- `,p=e.div`
19
+ `,r=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
- `,l=e.div`
33
+ `,d=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
- `,a=e.div`
39
+ `,p=e.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,c=e.div`
43
+ `,l=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
- `,s=e.div`
56
+ `,c=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
- `,x=e.div`
63
+ `,a=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
- `,g=e.div`
78
+ `,s=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
- `,f=e.div`
90
+ `,x=e.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,h=e.div`
93
+ `,g=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
- `,m=e.div`
114
+ `,f=e.div`
115
115
  height: 72px;
116
116
  width: 72px;
117
117
  display: flex;
@@ -134,31 +134,4 @@ 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
- `,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};
137
+ `;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,x as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,s as SelectedScreenHeader,u as StyledFooterForNonModal,f as VariantCardGridStyle,g as VariantCardListStyle};
@@ -48,4 +48,3 @@ export declare const updateAllVariantsForSelectedProducts: (selectedItems: {
48
48
  } | undefined;
49
49
  };
50
50
  }, collections: Collection, searchedProducts: SearchedItems) => Record<string, any>;
51
- export declare const getSkuId: (product: Product | ProductVariant, isVariant: boolean) => string | undefined;
@@ -1 +1 @@
1
- import{cloneDeep as o}from"lodash";const l=(l,i)=>{const n=o(i);if(delete n.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:n})).productId&&i.products){const t=o(i.products[l.productId]);(null==t?void 0:t.variants)&&delete t.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:n,productOnlyData:t})}return l};function i(o,l,i){var t;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const u=o[s],c=n(u.products,l,i-v);c&&Object.keys(c).length>0&&(d[s]=Object.assign(Object.assign({},u),{products:c})),v+=Object.keys(null!==(t=u.products)&&void 0!==t?t:{}).length}return d}function n(o,l,i){if(!o)return{};const n=Object.keys(o).slice(i,i+l),t={};return n.forEach((l=>{t[l]=o[l]})),t}const t=(o,l,i)=>{Object.keys(o).forEach((l=>{var i,n;const t=null!==(n=null===(i=o[l])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(t).forEach((i=>{var n,t,d,v;const s=null!==(v=null===(d=null===(t=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===t?void 0:t[i])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((n=>{var t,d,v,s;const u=null===(s=null===(v=null===(d=null===(t=o[l])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n];u&&!u.fbStatus&&(u.fbStatus="APPROVED")}))}))})),l({type:i,data:o})},d=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((i=>{var n,t;const d=null!==(t=null===(n=o[i])||void 0===n?void 0:n.products)&&void 0!==t?t:{};Object.keys(d).forEach((n=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=o[i])||void 0===t?void 0:t.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=o[i])||void 0===d?void 0:d.products)||void 0===v?void 0:v[n])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];(null==c?void 0:c.fbStatus)||l.push(t)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const n=Object.assign({},o);Object.keys(n).forEach((o=>{var i,t;const d=null!==(t=null===(i=n[o])||void 0===i?void 0:i.products)&&void 0!==t?t:{};Object.keys(d).forEach((i=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=n[o])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=n[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];c&&"REJECTED"===l[t]?c.fbStatus="REJECTED":c&&"APPROVED"===l[t]&&(c.fbStatus="APPROVED")}))}))})),i({type:d,data:n})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},v=(o,l)=>{const i=[];return Object.keys(null!=o?o:{}).forEach((n=>{var t,d;const v=null!==(d=null===(t=null==o?void 0:o[n])||void 0===t?void 0:t.variants)&&void 0!==d?d:{};Object.keys(v).forEach((t=>{var d,v,s,u,c;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[t]:null===(c=null===(u=null==o?void 0:o[n])||void 0===u?void 0:u.variants)||void 0===c?void 0:c[t],(null==r?void 0:r.fbStatus)||i.push(t)}))})),i},s=(o,l,i,n,t)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var i,n;Object.keys(null!==(n=null===(i=null==o?void 0:o[l])||void 0===i?void 0:i.variants)&&void 0!==n?n:{}).forEach((i=>{var n,t;const v=null===(n=null==o?void 0:o[l].variants)||void 0===n?void 0:n[i];v&&(v.fbStatus="APPROVED");const s=null===(t=null==d?void 0:d[l])||void 0===t?void 0:t.variants;s&&s[i]&&(s[i]=v)}))})),n&&t){const o=Object.assign({},n);o.products=d,t(o),l({type:"productsPaged",data:{collectionId:i,products:d}})}else l({type:"productsPaged",data:{collectionId:i,products:d}})},u=o=>{const l=Object.keys(o.variants||[]);let i=!1;return!(l.length<=1)||(l.forEach((l=>{var n,t;i=null!==(t=null===(n=o.variants)||void 0===n?void 0:n[l].name.includes(o.name))&&void 0!==t&&t})),!i)},c=(o,l,i,n,t)=>{var d,v,s,u,c,r,a,e,p,b,O,f,j,h,y,g,E,k,P;let D=0,V=0;if(null===(v=null===(d=null==i?void 0:i[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(t)return!1;const d=(null===(c=null===(u=null===(s=null==i?void 0:i[o])||void 0===s?void 0:s.products)||void 0===u?void 0:u[l])||void 0===c?void 0:c.variants)||[];if(1===Object.keys(d).length)for(const n in d){const t=null===(a=null===(r=null==i?void 0:i[o])||void 0===r?void 0:r.products)||void 0===a?void 0:a[l],d=null===(O=null===(b=null===(p=null===(e=null==i?void 0:i[o])||void 0===e?void 0:e.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[n];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==t?void 0:t.name)&&void 0!==j?j:""))return!1}if(null===(g=Object.keys((null===(y=null===(h=null==n?void 0:n.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===g||g.forEach((()=>V++)),Object.keys((null===(P=null===(k=null===(E=null==i?void 0:i[o])||void 0===E?void 0:E.products)||void 0===k?void 0:k[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&V!==D)return!0}return!1},r=function(o,l,i){var n,t,d,v;let s=0,u=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(n=null==l?void 0:l.products)&&void 0!==n?n:{};s=Object.keys(v).length;const c=null!==(d=null===(t=i[o])||void 0===t?void 0:t.products)&&void 0!==d?d:{};u=Object.keys(c).length}else if(i[o]){const n=null==l?void 0:l.products;n&&Object.keys(n).forEach((o=>{var l;const i=null===(l=n[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>s+=1))}));const t=null===(v=i[o])||void 0===v?void 0:v.products;if(t&&Object.keys(t).forEach((o=>{var l;const i=null===(l=t[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>u+=1))})),s<=0&&u>0)return!1}return u>0&&s!==u},a=(l,i,n)=>Object.keys(l).reduce(((t,d)=>{var v;return d in i?(t[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((t,v)=>{var s,u,c,r,a,e,p,b,O,f;const j=null===(s=i[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(c=null===(u=null==n?void 0:n.products)||void 0===u?void 0:u[d])||void 0===c?void 0:c.products)||void 0===r?void 0:r[v];return j?t[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o(j.variants)}):h?t[v]=Object.assign(Object.assign({},(null===(e=l[d].products)||void 0===e?void 0:e[v])||{}),{allVariants:o(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(t[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),t}),{})}),t):t}),{}),e=(o,l)=>{var i;if(l)return o.skuId;const n=Object.values(null!==(i=null==o?void 0:o.variants)&&void 0!==i?i:{});return 1===n.length&&n[0].name.includes(o.name)?n[0].skuId:""};export{d as fetchFbStatusCollection,e as getSkuId,v as getVariantIdsToFetchAtProductLevel,r as isCollectionPartiallyChecked,c as isProductPartiallyChecked,l as liftTheStateUp,s as markVariantsAsApprovedProductsLevel,i as paginateSelectedItems,u as shouldShowVariant,a as updateAllVariantsForSelectedProducts};
1
+ import{cloneDeep as o}from"lodash";const l=(l,i)=>{const n=o(i);if(delete n.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:n})).productId&&i.products){const t=o(i.products[l.productId]);(null==t?void 0:t.variants)&&delete t.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:n,productOnlyData:t})}return l};function i(o,l,i){var t;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const u=o[s],c=n(u.products,l,i-v);c&&Object.keys(c).length>0&&(d[s]=Object.assign(Object.assign({},u),{products:c})),v+=Object.keys(null!==(t=u.products)&&void 0!==t?t:{}).length}return d}function n(o,l,i){if(!o)return{};const n=Object.keys(o).slice(i,i+l),t={};return n.forEach((l=>{t[l]=o[l]})),t}const t=(o,l,i)=>{Object.keys(o).forEach((l=>{var i,n;const t=null!==(n=null===(i=o[l])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(t).forEach((i=>{var n,t,d,v;const s=null!==(v=null===(d=null===(t=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===t?void 0:t[i])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((n=>{var t,d,v,s;const u=null===(s=null===(v=null===(d=null===(t=o[l])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n];u&&!u.fbStatus&&(u.fbStatus="APPROVED")}))}))})),l({type:i,data:o})},d=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((i=>{var n,t;const d=null!==(t=null===(n=o[i])||void 0===n?void 0:n.products)&&void 0!==t?t:{};Object.keys(d).forEach((n=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=o[i])||void 0===t?void 0:t.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=o[i])||void 0===d?void 0:d.products)||void 0===v?void 0:v[n])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];(null==c?void 0:c.fbStatus)||l.push(t)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const n=Object.assign({},o);Object.keys(n).forEach((o=>{var i,t;const d=null!==(t=null===(i=n[o])||void 0===i?void 0:i.products)&&void 0!==t?t:{};Object.keys(d).forEach((i=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=n[o])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=n[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];c&&"REJECTED"===l[t]?c.fbStatus="REJECTED":c&&"APPROVED"===l[t]&&(c.fbStatus="APPROVED")}))}))})),i({type:d,data:n})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},v=(o,l)=>{const i=[];return Object.keys(null!=o?o:{}).forEach((n=>{var t,d;const v=null!==(d=null===(t=null==o?void 0:o[n])||void 0===t?void 0:t.variants)&&void 0!==d?d:{};Object.keys(v).forEach((t=>{var d,v,s,u,c;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[t]:null===(c=null===(u=null==o?void 0:o[n])||void 0===u?void 0:u.variants)||void 0===c?void 0:c[t],(null==r?void 0:r.fbStatus)||i.push(t)}))})),i},s=(o,l,i,n,t)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var i,n;Object.keys(null!==(n=null===(i=null==o?void 0:o[l])||void 0===i?void 0:i.variants)&&void 0!==n?n:{}).forEach((i=>{var n,t;const v=null===(n=null==o?void 0:o[l].variants)||void 0===n?void 0:n[i];v&&(v.fbStatus="APPROVED");const s=null===(t=null==d?void 0:d[l])||void 0===t?void 0:t.variants;s&&s[i]&&(s[i]=v)}))})),n&&t){const o=Object.assign({},n);o.products=d,t(o),l({type:"productsPaged",data:{collectionId:i,products:d}})}else l({type:"productsPaged",data:{collectionId:i,products:d}})},u=o=>{const l=Object.keys(o.variants||[]);let i=!1;return!(l.length<=1)||(l.forEach((l=>{var n,t;i=null!==(t=null===(n=o.variants)||void 0===n?void 0:n[l].name.includes(o.name))&&void 0!==t&&t})),!i)},c=(o,l,i,n,t)=>{var d,v,s,u,c,r,a,e,p,b,O,f,j,h,y,E,g,k,P;let D=0,V=0;if(null===(v=null===(d=null==i?void 0:i[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[l]){if(t)return!1;const d=(null===(c=null===(u=null===(s=null==i?void 0:i[o])||void 0===s?void 0:s.products)||void 0===u?void 0:u[l])||void 0===c?void 0:c.variants)||[];if(1===Object.keys(d).length)for(const n in d){const t=null===(a=null===(r=null==i?void 0:i[o])||void 0===r?void 0:r.products)||void 0===a?void 0:a[l],d=null===(O=null===(b=null===(p=null===(e=null==i?void 0:i[o])||void 0===e?void 0:e.products)||void 0===p?void 0:p[l])||void 0===b?void 0:b.variants)||void 0===O?void 0:O[n];if(null===(f=null==d?void 0:d.name)||void 0===f?void 0:f.includes(null!==(j=null==t?void 0:t.name)&&void 0!==j?j:""))return!1}if(null===(E=Object.keys((null===(y=null===(h=null==n?void 0:n.products)||void 0===h?void 0:h[l])||void 0===y?void 0:y.variants)||[]))||void 0===E||E.forEach((()=>V++)),Object.keys((null===(P=null===(k=null===(g=null==i?void 0:i[o])||void 0===g?void 0:g.products)||void 0===k?void 0:k[l])||void 0===P?void 0:P.variants)||[]).forEach((()=>D++)),D>0&&V!==D)return!0}return!1},r=function(o,l,i){var n,t,d,v;let s=0,u=0;if(arguments.length>3&&void 0!==arguments[3]&&arguments[3]){const v=null!==(n=null==l?void 0:l.products)&&void 0!==n?n:{};s=Object.keys(v).length;const c=null!==(d=null===(t=i[o])||void 0===t?void 0:t.products)&&void 0!==d?d:{};u=Object.keys(c).length}else if(i[o]){const n=null==l?void 0:l.products;n&&Object.keys(n).forEach((o=>{var l;const i=null===(l=n[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>s+=1))}));const t=null===(v=i[o])||void 0===v?void 0:v.products;if(t&&Object.keys(t).forEach((o=>{var l;const i=null===(l=t[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>u+=1))})),s<=0&&u>0)return!1}return u>0&&s!==u},a=(l,i,n)=>Object.keys(l).reduce(((t,d)=>{var v;return d in i?(t[d]=Object.assign(Object.assign({},l[d]),{products:Object.keys(null!==(v=l[d].products)&&void 0!==v?v:{}).reduce(((t,v)=>{var s,u,c,r,a,e,p,b,O,f;const j=null===(s=i[d].products)||void 0===s?void 0:s[v],h=null===(r=null===(c=null===(u=null==n?void 0:n.products)||void 0===u?void 0:u[d])||void 0===c?void 0:c.products)||void 0===r?void 0:r[v];return j?t[v]=Object.assign(Object.assign({},(null===(a=l[d].products)||void 0===a?void 0:a[v])||{}),{allVariants:o(j.variants)}):h?t[v]=Object.assign(Object.assign({},(null===(e=l[d].products)||void 0===e?void 0:e[v])||{}),{allVariants:o(h.variants)}):(null===(b=null===(p=l[d].products)||void 0===p?void 0:p[v])||void 0===b?void 0:b.allVariants)&&(t[v]=Object.assign(Object.assign({},(null===(O=l[d].products)||void 0===O?void 0:O[v])||{}),{allVariants:o(null===(f=l[d].products)||void 0===f?void 0:f[v].allVariants)})),t}),{})}),t):t}),{});export{d as fetchFbStatusCollection,v as getVariantIdsToFetchAtProductLevel,r as isCollectionPartiallyChecked,c as isProductPartiallyChecked,l as liftTheStateUp,s as markVariantsAsApprovedProductsLevel,i as paginateSelectedItems,u as shouldShowVariant,a as updateAllVariantsForSelectedProducts};
@@ -19,7 +19,6 @@ export interface VariantCardInterface {
19
19
  selectedCollectionsDispatch?: React.Dispatch<SelectedCollectionsActions>;
20
20
  outOfStockAction?: OUT_OF_STOCK_ACTION;
21
21
  onDelete?: () => void;
22
- pickerWidth?: string;
23
22
  }
24
23
  /**
25
24
  * Variant card in list view format.
@@ -1 +1 @@
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};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import r from"../../assets/icons/drag_handle.svg.js";import{COLORS as i}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as c,BodyCaption as l}from"../TypographyStyle.js";import{CurrencySymbols as s}from"./constants.js";import{ProductHelper as d}from"./helpers/ProductHelper.js";import{ProductPickerTag as m}from"./ProductPickerTag.js";import{VariantCardListStyle as p,VariantCardGridStyle as h}from"./style.js";import{Tooltip as g}from"../tooltips/Tooltip.js";const u=h=>{var u,j,b;const{data:v,selectedCollectionsDispatch:f,outOfStockAction:y}=h,I=()=>{let t;return t=v.name.includes(v.productName)?v.name:`${v.productName} ${v.name}`,t},{dataForProductPickerTag:T,tagText:O,tagType:P}=d.getDataForProductPickerTag(v,!0,y),k=`${v.currency&&null!==(u=s[v.currency])&&void 0!==u?u:""}${null!==(b=null!==(j=v.price)&&void 0!==j?j:v.actualPrice)&&void 0!==b?b:""}`;return t(p,{children:[t("div",Object.assign({className:"text-container"},{children:[e(r,{width:24,height:24,color:i.content.placeholder}),e("div",{children:e(n,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4},v.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(g,Object.assign({body:I(),placement:"bottom",delay:400,variant:"light"},{children:e(c,Object.assign({numberOfLines:1},{children:I()}))})),e(m,{isVariant:!0,data:T,tagText:O,tagType:P}),e(l,Object.assign({color:i.content.secondary},{children:!(null==T?void 0:T.fbStatus)||O?null:k}))]}))]})),e(a,{Icon:()=>e(o,{width:24,height:24,color:i.content.placeholder}),onClick:()=>{f&&f({type:"variantUnselected",data:{productId:v.productId,variantId:v.variantId,collectionId:v.collectionId}}),h.onDelete&&h.onDelete()}})]})},j=t=>{const{data:o}=t;return e(h,{children:e(g,Object.assign({body:o.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(n,{width:72,height:72,imageUrl:o.image,alt:"Item",borderRadius:4})}))})};export{j as VariantCardGridView,u as VariantCardListView};
@@ -10,12 +10,11 @@ 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;
14
13
  };
15
14
  /**
16
15
  * Returns a react component of variants list, which are eligible to drag and drop.
17
16
  */
18
- export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, pickerWidth, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const VariantsList: ({ selectedVariants, setSelectedVariants, selectedCollectionsDispatch, outOfStockAction, }: VariantsComponentProps) => import("react/jsx-runtime").JSX.Element;
19
18
  /**
20
19
  * Returns a react component of variants grid, which are eligible to drag and drop.
21
20
  */
@@ -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,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};
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[g,b]=a(-1);function f(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===g?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>b(a),onMouseLeave:()=>b(-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:f(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},`${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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.657-23",
3
+ "version": "0.0.657-3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",