@bikdotai/bik-component-library 0.0.657-9 → 0.0.657-beta.1

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.
@@ -28,5 +28,6 @@ export interface BikSidebarProps {
28
28
  popupMinHeight?: number;
29
29
  isNewSidebar?: boolean;
30
30
  onboardingPercentage?: number;
31
+ menuStyle?: React.CSSProperties;
31
32
  }
32
33
  export declare const BikSidebar: React.FC<BikSidebarProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("../../assets/icons/locked.svg.js"),t=require("react"),o=require("../progress-bar/CircularProgressBar.js"),s=require("../../constants/Theme.js"),l=require("../navigation-hyperlink/NavigationHyperlink.js"),a=require("./SidebarPopup.js"),d=require("./SidebarStyles.js"),r=require("./SimpleSidebar.js");const u=i=>{const{icon:n,isActive:t,activeStateIcon:o,hoverStateIcon:l,isHovered:a}=i,d=n,r=o,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(r,{width:20,height:20}):a?e.jsx(u,{width:20,height:20,color:s.COLORS.surface.standard}):e.jsx(d,{width:20,height:20,color:s.COLORS.surface.standard})})},c=i=>{let{option:t,index:o,onClickMainMenuLogic:s,setHandleHoverForFullLayout:l,isDisabled:a,setHoveredComp:r,setPopupMenu:c,mainActiveMenu:v,hoveredComp:p,popupMenu:m}=i;var g,h,k,y,j,b;return e.jsx(d.SibeBarMenuItem,{children:e.jsxs("div",Object.assign({id:(null===(h=null===(g=t.displayName)||void 0===g?void 0:g.split(" "))||void 0===h?void 0:h.join(""))||t.key.toString(),className:"main--sidebar",onClick:()=>s(t),onMouseEnter:()=>{!a&&l(t)},onMouseOver:()=>{!a&&l(t)},onMouseLeave:()=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)||(r(void 0),c(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[t.isNew&&e.jsx("div",Object.assign({className:"new-tag "+(t.isLastSticky?"tag-sticky":"")},{children:"NEW"})),t.isLocked&&e.jsx("div",Object.assign({className:`locked--channel ${t.isLastSticky?"tag-sticky":""} ${t.is2ndLastSticky?"tag-sticky-2":""}`},{children:e.jsx(n.default,{height:16,width:16})})),e.jsxs("div",Object.assign({id:(null===(y=null===(k=t.displayName)||void 0===k?void 0:k.split(" "))||void 0===y?void 0:y.join(""))+"_sub"||t.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==v?void 0:v.key)===t.key?"main-menu-active-class":""} \n\t\t\t\t\t${t.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${t.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${t.key===(null==p?void 0:p.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${t.isNew?"new-menu-item":""}`},{children:[e.jsx(u,{icon:t.icon,isActive:t.key==(null==v?void 0:v.key),activeStateIcon:null!==(j=t.activeIcon)&&void 0!==j?j:{},hoverStateIcon:null!==(b=t.hoverIcon)&&void 0!==b?b:{},isHovered:t.key==(null==p?void 0:p.key)||t.key==(null==m?void 0:m.key)}),e.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsx("p",Object.assign({className:"menu-item-text "+((null==t?void 0:t.key)===(null==v?void 0:v.key)?"active-menu-item-text":"")},{children:t.displayName}))}))]}),o)]}),o)})};exports.BikSidebar=n=>{const{logoSvg:s,allMenuList:u,activeMainMenu:v,activeSubMenu:p,router:m,onClickingMainMenu:g,onClickingSubMenu:h,onClickingAccessUpgradePanel:k,onClickingPopupMenuItem:y,popupMinHeight:j,isNewSidebar:b}=n,[S,M]=t.useState(v),[x,w]=t.useState(),[C,f]=t.useState(p),[L,N]=t.useState(!1),[H,O]=t.useState(),[P,B]=t.useState(),[E,I]=t.useState(),[q,F]=t.useState(null),_=t.useMemo((()=>u.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[u]);t.useEffect((()=>{M(v)}),[v]),t.useEffect((()=>{f(p)}),[p]);const A=t.useCallback((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(O(void 0),w(void 0),N(!0),M(e),e.path||g(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?f(null==e?void 0:e.children[0]):f({}),w(void 0),setTimeout((()=>{N(!1)}),1e3))}),[g]),$=t.useCallback((e=>{var i,n;if(z(),w(void 0),O(void 0),"popup"==(null==e?void 0:e.layout)){const i=T();i&&B(i),O(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=R(t);I(e)}w(e),U()}}),[]),R=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(window.innerHeight<=768)return n;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n};t.useEffect((()=>{const e=()=>{const e=T();e&&B(e),D()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const D=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&I(window.innerHeight-i)},T=()=>{var e,i;if(H){const n=(null===(i=null===(e=H.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||H.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=j?j:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}},U=()=>{z();const e=setTimeout((()=>w(void 0)),1e4);F(e)},z=()=>{clearTimeout(q)};return e.jsxs(d.SideBarContainer,{children:[e.jsx("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:s||e.jsx(i.default,{})})),e.jsxs(d.MainSideBarMenuWrapper,{children:[null==u?void 0:u.map(((i,n)=>{var o,s;return e.jsxs(t.Fragment,{children:[i.path?e.jsx(l.NavigationHyperlink,Object.assign({href:i.path,router:m},{children:e.jsx(c,{option:i,index:n,onClickMainMenuLogic:A,setHandleHoverForFullLayout:$,isDisabled:L,setHoveredComp:w,setPopupMenu:O,mainActiveMenu:S,hoveredComp:x,popupMenu:H})})):e.jsx(c,{option:i,index:n,onClickMainMenuLogic:A,setHandleHoverForFullLayout:$,isDisabled:L,setHoveredComp:w,setPopupMenu:O,mainActiveMenu:S,hoveredComp:x,popupMenu:H}),e.jsxs(e.Fragment,{children:["popup"===i.layout&&(null===(o=null==H?void 0:H.children)||void 0===o?void 0:o.length)&&e.jsx(a.SidebarPopup,{top:null!=P?P:void 0,menuList:null==H?void 0:H.children,onClickingPopupMenu:e=>{y&&y(e),O(void 0)},onMouseLeaveOnMenu:()=>O(void 0)}),(null===(s=null==x?void 0:x.children)||void 0===s?void 0:s.length)&&e.jsx(r.SimpleSidebar,{menuList:null==x?void 0:x.children,activeMenu:C,onMouseEnterOnMenu:()=>z(),onMouseLeaveOnMenu:()=>{z(),w(void 0)},left:b?92:88,postion:"fixed",header:x.displayName,theme:"brand",router:m,showAccessUpgradePanel:x.showAccessUpgradePanel,onMenuClick:(e,i)=>{f(e),M(x),w(void 0),O(void 0),i&&h(e)},onUpgrade:k,top:b&&E||0,isNewSidebar:b})]})]},n)})),"number"==typeof n.onboardingPercentage&&e.jsx(d.SibeBarMenuItem,{children:e.jsx("div",Object.assign({className:"main--sidebar"},{children:e.jsx("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===_?"sticky-menu":1===_?"sticky-menu-int":"sticky-menu-three")},{children:e.jsx(o.default,{percentage:n.onboardingPercentage,width:48})}))}))})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("../../assets/icons/locked.svg.js"),t=require("react"),o=require("../progress-bar/CircularProgressBar.js"),s=require("../../constants/Theme.js"),l=require("../navigation-hyperlink/NavigationHyperlink.js"),a=require("./SidebarPopup.js"),d=require("./SidebarStyles.js"),r=require("./SimpleSidebar.js");const u=i=>{const{icon:n,isActive:t,activeStateIcon:o,hoverStateIcon:l,isHovered:a}=i,d=n,r=o,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(r,{width:20,height:20}):a?e.jsx(u,{width:20,height:20,color:s.COLORS.surface.standard}):e.jsx(d,{width:20,height:20,color:s.COLORS.surface.standard})})},c=i=>{let{option:t,index:o,onClickMainMenuLogic:s,setHandleHoverForFullLayout:l,isDisabled:a,setHoveredComp:r,setPopupMenu:c,mainActiveMenu:v,hoveredComp:p,popupMenu:m}=i;var g,h,y,k,j,b;return e.jsx(d.SibeBarMenuItem,{children:e.jsxs("div",Object.assign({id:(null===(h=null===(g=t.displayName)||void 0===g?void 0:g.split(" "))||void 0===h?void 0:h.join(""))||t.key.toString(),className:"main--sidebar",onClick:()=>s(t),onMouseEnter:()=>{!a&&l(t)},onMouseOver:()=>{!a&&l(t)},onMouseLeave:()=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)||(r(void 0),c(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[t.isNew&&e.jsx("div",Object.assign({className:"new-tag "+(t.isLastSticky?"tag-sticky":"")},{children:"NEW"})),t.isLocked&&e.jsx("div",Object.assign({className:`locked--channel ${t.isLastSticky?"tag-sticky":""} ${t.is2ndLastSticky?"tag-sticky-2":""}`},{children:e.jsx(n.default,{height:16,width:16})})),e.jsxs("div",Object.assign({id:(null===(k=null===(y=t.displayName)||void 0===y?void 0:y.split(" "))||void 0===k?void 0:k.join(""))+"_sub"||t.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==v?void 0:v.key)===t.key?"main-menu-active-class":""} \n\t\t\t\t\t${t.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${t.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${t.key===(null==p?void 0:p.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${t.isNew?"new-menu-item":""}`},{children:[e.jsx(u,{icon:t.icon,isActive:t.key==(null==v?void 0:v.key),activeStateIcon:null!==(j=t.activeIcon)&&void 0!==j?j:{},hoverStateIcon:null!==(b=t.hoverIcon)&&void 0!==b?b:{},isHovered:t.key==(null==p?void 0:p.key)||t.key==(null==m?void 0:m.key)}),e.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsx("p",Object.assign({className:"menu-item-text "+((null==t?void 0:t.key)===(null==v?void 0:v.key)?"active-menu-item-text":"")},{children:t.displayName}))}))]}),o)]}),o)})};exports.BikSidebar=n=>{const{logoSvg:s,allMenuList:u,activeMainMenu:v,activeSubMenu:p,router:m,onClickingMainMenu:g,onClickingSubMenu:h,onClickingAccessUpgradePanel:y,onClickingPopupMenuItem:k,popupMinHeight:j,isNewSidebar:b,menuStyle:S}=n,[M,x]=t.useState(v),[w,C]=t.useState(),[f,L]=t.useState(p),[N,O]=t.useState(!1),[H,P]=t.useState(),[B,E]=t.useState(),[I,q]=t.useState(),[F,_]=t.useState(null),A=t.useMemo((()=>u.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[u]);t.useEffect((()=>{x(v)}),[v]),t.useEffect((()=>{L(p)}),[p]);const $=t.useCallback((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(P(void 0),C(void 0),O(!0),x(e),e.path||g(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?L(null==e?void 0:e.children[0]):L({}),C(void 0),setTimeout((()=>{O(!1)}),1e3))}),[g]),R=t.useCallback((e=>{var i,n;if(W(),C(void 0),P(void 0),"popup"==(null==e?void 0:e.layout)){const i=U();i&&E(i),P(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=D(t);q(e)}C(e),z()}}),[]),D=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(window.innerHeight<=768)return n;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n};t.useEffect((()=>{const e=()=>{const e=U();e&&E(e),T()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const T=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&q(window.innerHeight-i)},U=()=>{var e,i;if(H){const n=(null===(i=null===(e=H.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||H.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=j?j:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}},z=()=>{W();const e=setTimeout((()=>C(void 0)),1e4);_(e)},W=()=>{clearTimeout(F)};return e.jsxs(d.SideBarContainer,{children:[e.jsx("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:s||e.jsx(i.default,{})})),e.jsxs(d.MainSideBarMenuWrapper,Object.assign({style:S},{children:[null==u?void 0:u.map(((i,n)=>{var o,s;return e.jsxs(t.Fragment,{children:[i.path?e.jsx(l.NavigationHyperlink,Object.assign({href:i.path,router:m},{children:e.jsx(c,{option:i,index:n,onClickMainMenuLogic:$,setHandleHoverForFullLayout:R,isDisabled:N,setHoveredComp:C,setPopupMenu:P,mainActiveMenu:M,hoveredComp:w,popupMenu:H})})):e.jsx(c,{option:i,index:n,onClickMainMenuLogic:$,setHandleHoverForFullLayout:R,isDisabled:N,setHoveredComp:C,setPopupMenu:P,mainActiveMenu:M,hoveredComp:w,popupMenu:H}),e.jsxs(e.Fragment,{children:["popup"===i.layout&&(null===(o=null==H?void 0:H.children)||void 0===o?void 0:o.length)&&e.jsx(a.SidebarPopup,{top:null!=B?B:void 0,menuList:null==H?void 0:H.children,onClickingPopupMenu:e=>{k&&k(e),P(void 0)},onMouseLeaveOnMenu:()=>P(void 0)}),(null===(s=null==w?void 0:w.children)||void 0===s?void 0:s.length)&&e.jsx(r.SimpleSidebar,{menuList:null==w?void 0:w.children,activeMenu:f,onMouseEnterOnMenu:()=>W(),onMouseLeaveOnMenu:()=>{W(),C(void 0)},left:b?92:88,postion:"fixed",header:w.displayName,theme:"brand",router:m,showAccessUpgradePanel:w.showAccessUpgradePanel,onMenuClick:(e,i)=>{L(e),x(w),C(void 0),P(void 0),i&&h(e)},onUpgrade:y,top:b&&I||0,isNewSidebar:b})]})]},n)})),"number"==typeof n.onboardingPercentage&&e.jsx(d.SibeBarMenuItem,{children:e.jsx("div",Object.assign({className:"main--sidebar"},{children:e.jsx("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===A?"sticky-menu":1===A?"sticky-menu-int":"sticky-menu-three")},{children:e.jsx(o.default,{percentage:n.onboardingPercentage,width:48})}))}))})]}))]})};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -13,7 +13,6 @@ export interface ProductVariant {
13
13
  id?: string;
14
14
  actualPrice?: string;
15
15
  currency?: string;
16
- skuId?: string;
17
16
  }
18
17
  export interface Product {
19
18
  name: string;
@@ -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"),g=require("./reducers.js"),C=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(g.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(""),[ge,Ce]=c.useState(!1),[xe,je]=c.useState(!1),[ye,me]=c.useReducer(g.searchReducer,{collections:{},products:{}}),[be,fe]=c.useReducer(g.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?(Ce(!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),Ce(!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 products using name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?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(g.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(C.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,{})]}))})};
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"),x=require("./searchScreen.js"),g=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:I,exactLimit:P,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,xe]=c.useState(!1),[ge,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),[ke,Ie]=c.useState(!1),[Pe,Oe]=c.useState();c.useEffect((()=>{de(!0),je(!0),e.collectionFetcher(ie,b).then((e=>{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?(xe(!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),xe(!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=()=>P&&ue>P?t.jsx(d.Tag,{tagText:`You can only select ${P} 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:P?`${ue}/${P} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(Z)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(Z)}):t.jsx(n.Button,{disabled:!0,buttonText:P?`${ue}/${P} 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:ge,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=>{Ie(!0),Oe(e)},showProductDetailInfoIcon:H,scrollContainerRef:ve})})),"view"===Z&&t.jsx(g.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(x.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||P&&ue<P||!P&&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&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,outOfStockAction:T,useDynamicInfoImageSize:e.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}):t.jsxs(l.StyledModal,Object.assign({zIndex:I,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||P&&ue<P||!P&&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||P&&ue<P||!P&&O&&ue>O||!1,onClick:()=>{e.onAdd(be,ue),Fe()}},secondaryButton:Y?(t=>Object.assign(Object.assign({},t),{disabled:ae||ue<1||P&&ue<P||!P&&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&&Pe?t.jsx(h.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:e.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -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=>{var v,p,h;const{isVariant:y,data:j,productId:I,collectionId:P,variantId:x,isSelected:g,selectedCollectionsDispatch:k,viewOnly:C,upliftAdditions:b,isPartiallyChecked:O,hideProductCheckbox:m,outOfStockAction:S,hideVariantCheckbox:f,hideProductVariants:T,pickerType:D="PRODUCT",onProductDetailClick:V,showProductDetailInfoIcon:q,currencyAndPrice:w}=n,{isVariantForProductPickerTag:A,dataForProductPickerTag:U,tagText:B,tagType:F}=a.ProductHelper.getDataForProductPickerTag(j,y,S);console.log({data:j});const R=y?j.skuId:null===(h=null===(p=Object.values(null!==(v=null==j?void 0:j.variants)&&void 0!==v?v:{}))||void 0===p?void 0:p[0])||void 0===h?void 0:h.skuId;return e.jsxs(u.ProductCardStyle,Object.assign({isVariant:y,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===D&&(m||f)){const e=Object.keys(j.variants);T?g?k({type:"productUnselected",data:{productId:I,collectionId:P}}):b("productSelected",{productId:I,variantId:x,collectionId:P,product:j}):g?k({type:"variantUnselected",data:{productId:I,variantId:x,collectionId:P}}):b("variantSelected",{productId:I,variantId:x||e[0],collectionId:P,variant:j})}},isActive:g},{children:[y&&!C&&!f||!y&&!C&&!m?e.jsx(o.CheckBox,{isChecked:g,isPartiallyChecked:O||!1,onValueChange:function(e,t,i){null==i||i.stopPropagation(),y?e?b(T?"productSelected":"variantSelected",{productId:I,variantId:x,collectionId:P,variant:j}):k({type:T?"productUnselected":"variantUnselected",data:{productId:I,variantId:x,collectionId:P}}):e?b("productSelected",{productId:I,collectionId:P,product:j}):k({type:"productUnselected",data:{productId:I,collectionId:P}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:j.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:j.name,placement:"bottom",delay:400},{children:e.jsx(l.TitleSmall,Object.assign({numberOfLines:1},{children:j.name}))})),q&&e.jsx(c.IconButton,{onClick:()=>{null==V||V(j)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})),e.jsxs(u.ProductSubTitle,{children:[e.jsx(s.ProductPickerTag,{isVariant:A,data:U,tagText:B,tagType:F}),!(null==U?void 0:U.fbStatus)&&A||B?null:e.jsxs(e.Fragment,{children:[e.jsx(l.BodyCaption,Object.assign({color:t.COLORS.content.secondary},{children:w})),R&&e.jsx(r.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${R}`})})}))]})]})]}))]}))};exports.ProductCard=p,exports.ProductGroup=t=>{var i,o,c,d,r,l,a,s,u;const{collectionId:h,productId:y,data:j,selectedData:I,selectedCollectionsDispatch:P,viewOnly:x,upliftAdditions:g,isProductPartiallyChecked:k,hideProductCheckbox:C,outOfStockAction:b,hideVariantCheckbox:O,hideProductVariants:m,pickerType:S,onProductDetailClick:f,showProductDetailInfoIcon:T}=t,D=e=>{var t,i,o,c,d,r;if(!(null===(i=null===(t=null==I?void 0:I[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==I?void 0:I[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])},V=m||!v.shouldShowVariant(j)?`${j.currency&&null!==(i=n.CurrencySymbols[j.currency])&&void 0!==i?i:""}${null!==(u=null!==(r=null===(d=null===(c=Object.values(null!==(o=j.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=j.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:j,productId:y,collectionId:h,isSelected:(()=>{var e,t;return!!(null===(t=null===(e=null==I?void 0:I[h])||void 0===e?void 0:e.products)||void 0===t?void 0:t[y])})(),isPartiallyChecked:k,selectedCollectionsDispatch:P,upliftAdditions:g,viewOnly:x,hideProductCheckbox:C,hideVariantCheckbox:O,hideProductVariants:m,pickerType:S,outOfStockAction:b,onProductDetailClick:f,showProductDetailInfoIcon:T,currencyAndPrice:V},y),m?null:v.shouldShowVariant(j)&&Object.keys(j.variants||[]).map((t=>{var i,o,c,d,r,l,a;const s=`${j.currency&&null!==(i=n.CurrencySymbols[j.currency])&&void 0!==i?i:""}${null!==(a=null!==(d=null===(c=null===(o=j.variants)||void 0===o?void 0:o[t])||void 0===c?void 0:c.price)&&void 0!==d?d:null===(l=null===(r=j.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({},j.variants[t]),{currency:j.currency}),variantId:t,productId:y,viewOnly:x,upliftAdditions:g,collectionId:h,isSelected:D(t),selectedCollectionsDispatch:P,outOfStockAction:b,onProductDetailClick:f,showProductDetailInfoIcon:T,currencyAndPrice:s},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"),i=require("../../assets/icons/cross.svg.js"),r=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 v=x(t);const g=t=>{var i,r,x,v,g,y,m,f,D,I,S,O,P,k,T,q,C,w;const B=void 0===t.productData.variants;let $;if(B)$=`${t.productData.currency&&null!==(i=l.CurrencySymbols[t.productData.currency])&&void 0!==i?i:""}${null!==(g=null!==(x=null===(r=t.productData)||void 0===r?void 0:r.price)&&void 0!==x?x:null===(v=t.productData)||void 0===v?void 0:v.actualPrice)&&void 0!==g?g:""}`;else{const e=null===(y=t.productData)||void 0===y?void 0:y.currency;$=`${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===(P=Object.values(null!==(O=t.productData.variants)&&void 0!==O?O:{}))||void 0===P?void 0:P[0])||void 0===k?void 0:k.actualPrice)&&void 0!==T?T:""}`}const{isVariantForProductPickerTag:z,dataForProductPickerTag:R,tagText:L,tagType:_}=c.ProductHelper.getDataForProductPickerTag(t.productData,B,t.outOfStockAction);console.log({productData:t.productData});const A=B?t.productData.skuId:null===(C=Object.values(null!==(q=t.productData.variants)&&void 0!==q?q:{})[0])||void 0===C?void 0:C.skuId;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:[A&&e.jsx(d.Tooltip,Object.assign({body:A,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${A}`})})})),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!==(w=t.productData.description)&&void 0!==w?w:""}}),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:B?$:p.shouldShowVariant(t.productData)?null:$})),e.jsx(s.ProductPickerTag,{isVariant:z,data:R,tagText:L,tagType:_})]})]})},y=v.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"),n=require("../TypographyStyle.js"),d=require("./constants.js"),c=require("./helpers/ProductHelper.js"),l=require("./ProductPickerTag.js"),u=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,v,g,f,h,b,D,P,I,S,O,k;const T=void 0===t.productData.variants;let q;if(T)q=`${t.productData.currency&&null!==(r=d.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===(v=t.productData)||void 0===v?void 0:v.currency;q=`${e&&null!==(g=d.CurrencySymbols[e])&&void 0!==g?g:""}${null!==(O=null!==(D=null===(b=null===(h=Object.values(null!==(f=t.productData.variants)&&void 0!==f?f:{}))||void 0===h?void 0:h[0])||void 0===b?void 0:b.price)&&void 0!==D?D:null===(S=null===(I=Object.values(null!==(P=t.productData.variants)&&void 0!==P?P:{}))||void 0===I?void 0:I[0])||void 0===S?void 0:S.actualPrice)&&void 0!==O?O:""}`}const{isVariantForProductPickerTag:C,dataForProductPickerTag:w,tagText:$,tagType:z}=c.ProductHelper.getDataForProductPickerTag(t.productData,T,t.outOfStockAction);return e.jsxs(m,{children:[e.jsx(y,{children:e.jsx(a.ShimmerImage,{useDynamicInfoImageSize:t.useDynamicInfoImageSize,imageUrl:t.productData.image,width:200,height:200,borderRadius:4})}),e.jsxs(j,{children:[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!==(k=t.productData.description)&&void 0!==k?k:""}}),e.jsx(n.BodyCaption,Object.assign({color:o.COLORS.content.secondary},{children:T?q:u.shouldShowVariant(t.productData)?null:q})),e.jsx(l.ProductPickerTag,{isVariant:C,data:w,tagText:$,tagType:z})]})]})},v=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=v.default.div`
20
+ `,g=p.default.div`
21
21
  display: flex;
22
22
  flex: 1;
23
23
  background: rgba(0, 0, 0, 0.5);
24
- `,f=v.default.div`
24
+ `,f=p.default.div`
25
25
  position: relative;
26
26
 
27
27
  .close-button {
@@ -32,21 +32,21 @@
32
32
  background: ${o.COLORS.surface.standard};
33
33
  border-radius: 50%;
34
34
  }
35
- `,j=v.default.div`
35
+ `,m=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=v.default.div`
41
+ `,y=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=v.default.div`
47
+ `,j=p.default.div`
48
48
  display: flex;
49
49
  flex: 1;
50
50
  flex-direction: column;
51
51
  gap: 4px;
52
- `;exports.ProductInfoCard=g,exports.ProductInfoOverlay=t=>e.jsxs(y,{children:[e.jsx(m,{}),e.jsx(f,{children:e.jsx(r.IconButton,{className:"close-button",onClick:t.onClose,Icon:i.default,width:20,height:20})}),e.jsx(g,{productData:t.productData,outOfStockAction:t.outOfStockAction,useDynamicInfoImageSize:t.useDynamicInfoImageSize})]});
52
+ `;exports.ProductInfoCard=x,exports.ProductInfoOverlay=t=>e.jsxs(v,{children:[e.jsx(g,{}),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})]});
@@ -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: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."})}))]})};
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("../../assets/icons/box.svg.js"),o=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,Y(t);const r=b.getVariantIdsToFetchAtProductLevel(null!=e?e:{});te(r,null!=e?e:{},!0),D(!1),Q(!1)}))):Y(P)}),800);return()=>clearTimeout(e)}),[W]);s.useEffect((()=>{var e,t,r,o;$.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!==(r=P.products)&&void 0!==r?r:{});te(c,null!==(o=P.products)&&void 0!==o?o:{})}),[J]);const ee=!!T&&P.isSmartCollection;s.useEffect((()=>{(null==P?void 0:P.products)||re(10)}),[]);const te=(e,t,r)=>{_||(r?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)),e.length>0&&_&&_(q,e).then((e=>{const o=Object.assign({},t);Object.keys(t).forEach((r=>{var c,s;Object.keys(null!==(s=null===(c=null==t?void 0:t[r])||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[r].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==o?void 0:o[r])||void 0===n?void 0:n.variants;l&&l[c]&&(l[c]=i)}))})),r?(Y((e=>{const t=Object.assign({},e);return t.products=o,t})),x({type:"productsPaged",data:{collectionId:J,products:o}})):x({type:"productsPaged",data:{collectionId:J,products:o}})})).catch((e=>{r?b.markVariantsAsApprovedProductsLevel(t,x,J,X,Y):b.markVariantsAsApprovedProductsLevel(t,x,J)}))},re=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()},oe=(e,t)=>{const r=b.liftTheStateUp(t,P);I({type:e,data:Object.assign(Object.assign({},r),{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(o.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?re():I({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.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 r=b.getVariantIdsToFetchAtProductLevel(e);te(r,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:oe,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."})}))]})};
@@ -23,9 +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>;
@@ -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 d=r(e);const l=d.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=d.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=d.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=d.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=d.default.div`
39
+ `,p=r.default.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,s=d.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=d.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
- `,u=d.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
- `,f=d.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=d.default.div`
90
+ `,f=r.default.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,y=d.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=d.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
- `;d.default.div`
121
+ `;r.default.div`
122
122
  display: flex;
123
123
  width: 32px;
124
124
  height: 32px;
@@ -127,28 +127,11 @@
127
127
  align-items: center;
128
128
  border: 1px solid ${t.COLORS.stroke.primary};
129
129
  border-radius: 4px;
130
- `;const b=d.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=d.default.div`
138
- width: fit-content;
139
- background: ${t.COLORS.background.brandLight};
140
- padding: 2px 6px;
141
- border-radius: 14px;
142
- `,v=d.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=d.default.div`
150
- display: flex;
151
- flex-direction: row;
152
- align-items: center;
153
- gap: 5px;
154
- `;exports.CollectionCardDetailStyle=c,exports.CollectionCardInfoStyle=p,exports.CollectionCardStyle=a,exports.CollectionNameHolder=g,exports.ContainerStyle=l,exports.EllipsedBodyTiny=v,exports.ProductCardStyle=u,exports.ProductScreenCollectionCardStyle=x,exports.ProductScreenHeader=s,exports.ProductSubTitle=w,exports.SKUIDBadge=m,exports.ScrollContainerStyle=n,exports.SelectedScreenHeader=f,exports.StyledFooterForNonModal=b,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;
@@ -28,5 +28,6 @@ export interface BikSidebarProps {
28
28
  popupMinHeight?: number;
29
29
  isNewSidebar?: boolean;
30
30
  onboardingPercentage?: number;
31
+ menuStyle?: React.CSSProperties;
31
32
  }
32
33
  export declare const BikSidebar: React.FC<BikSidebarProps>;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i,Fragment as n}from"react/jsx-runtime";import t from"../../assets/icons/Bik_logo.svg.js";import o from"../../assets/icons/locked.svg.js";import{useState as l,useMemo as s,useEffect as d,useCallback as r,Fragment as a}from"react";import c from"../progress-bar/CircularProgressBar.js";import{COLORS as u}from"../../constants/Theme.js";import{NavigationHyperlink as v}from"../navigation-hyperlink/NavigationHyperlink.js";import{SidebarPopup as m}from"./SidebarPopup.js";import{SideBarContainer as p,MainSideBarMenuWrapper as g,SibeBarMenuItem as h}from"./SidebarStyles.js";import{SimpleSidebar as y}from"./SimpleSidebar.js";const k=o=>{const{logoSvg:u,allMenuList:k,activeMainMenu:b,activeSubMenu:w,router:S,onClickingMainMenu:f,onClickingSubMenu:j,onClickingAccessUpgradePanel:L,onClickingPopupMenuItem:N,popupMinHeight:C,isNewSidebar:H}=o,[O,P]=l(b),[I,A]=l(),[E,x]=l(w),[B,F]=l(!1),[_,$]=l(),[D,T]=l(),[U,R]=l(),[z,q]=l(null),K=s((()=>k.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[k]);d((()=>{P(b)}),[b]),d((()=>{x(w)}),[w]);const W=r((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&($(void 0),A(void 0),F(!0),P(e),e.path||f(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?x(null==e?void 0:e.children[0]):x({}),A(void 0),setTimeout((()=>{F(!1)}),1e3))}),[f]),G=r((e=>{var i,n;if(Y(),A(void 0),$(void 0),"popup"==(null==e?void 0:e.layout)){const i=V();i&&T(i),$(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=J(t);R(e)}A(e),X()}}),[]),J=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(window.innerHeight<=768)return n;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n};d((()=>{const e=()=>{const e=V();e&&T(e),Q()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const Q=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&R(window.innerHeight-i)},V=()=>{var e,i;if(_){const n=(null===(i=null===(e=_.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||_.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=C?C:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}},X=()=>{Y();const e=setTimeout((()=>A(void 0)),1e4);q(e)},Y=()=>{clearTimeout(z)};return e(p,{children:[i("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:u||i(t,{})})),e(g,{children:[null==k?void 0:k.map(((t,o)=>{var l,s;return e(a,{children:[t.path?i(v,Object.assign({href:t.path,router:S},{children:i(M,{option:t,index:o,onClickMainMenuLogic:W,setHandleHoverForFullLayout:G,isDisabled:B,setHoveredComp:A,setPopupMenu:$,mainActiveMenu:O,hoveredComp:I,popupMenu:_})})):i(M,{option:t,index:o,onClickMainMenuLogic:W,setHandleHoverForFullLayout:G,isDisabled:B,setHoveredComp:A,setPopupMenu:$,mainActiveMenu:O,hoveredComp:I,popupMenu:_}),e(n,{children:["popup"===t.layout&&(null===(l=null==_?void 0:_.children)||void 0===l?void 0:l.length)&&i(m,{top:null!=D?D:void 0,menuList:null==_?void 0:_.children,onClickingPopupMenu:e=>{N&&N(e),$(void 0)},onMouseLeaveOnMenu:()=>$(void 0)}),(null===(s=null==I?void 0:I.children)||void 0===s?void 0:s.length)&&i(y,{menuList:null==I?void 0:I.children,activeMenu:E,onMouseEnterOnMenu:()=>Y(),onMouseLeaveOnMenu:()=>{Y(),A(void 0)},left:H?92:88,postion:"fixed",header:I.displayName,theme:"brand",router:S,showAccessUpgradePanel:I.showAccessUpgradePanel,onMenuClick:(e,i)=>{x(e),P(I),A(void 0),$(void 0),i&&j(e)},onUpgrade:L,top:H&&U||0,isNewSidebar:H})]})]},o)})),"number"==typeof o.onboardingPercentage&&i(h,{children:i("div",Object.assign({className:"main--sidebar"},{children:i("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===K?"sticky-menu":1===K?"sticky-menu-int":"sticky-menu-three")},{children:i(c,{percentage:o.onboardingPercentage,width:48})}))}))})]})]})},b=e=>{const{icon:t,isActive:o,activeStateIcon:l,hoverStateIcon:s,isHovered:d}=e,r=t,a=s;return i(n,{children:o?i(l,{width:20,height:20}):i(d?a:r,{width:20,height:20,color:u.surface.standard})})},M=n=>{let{option:t,index:l,onClickMainMenuLogic:s,setHandleHoverForFullLayout:d,isDisabled:r,setHoveredComp:a,setPopupMenu:c,mainActiveMenu:u,hoveredComp:v,popupMenu:m}=n;var p,g,y,k,M,w;return i(h,{children:e("div",Object.assign({id:(null===(g=null===(p=t.displayName)||void 0===p?void 0:p.split(" "))||void 0===g?void 0:g.join(""))||t.key.toString(),className:"main--sidebar",onClick:()=>s(t),onMouseEnter:()=>{!r&&d(t)},onMouseOver:()=>{!r&&d(t)},onMouseLeave:()=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)||(a(void 0),c(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[t.isNew&&i("div",Object.assign({className:"new-tag "+(t.isLastSticky?"tag-sticky":"")},{children:"NEW"})),t.isLocked&&i("div",Object.assign({className:`locked--channel ${t.isLastSticky?"tag-sticky":""} ${t.is2ndLastSticky?"tag-sticky-2":""}`},{children:i(o,{height:16,width:16})})),e("div",Object.assign({id:(null===(k=null===(y=t.displayName)||void 0===y?void 0:y.split(" "))||void 0===k?void 0:k.join(""))+"_sub"||t.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==u?void 0:u.key)===t.key?"main-menu-active-class":""} \n\t\t\t\t\t${t.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${t.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${t.key===(null==v?void 0:v.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${t.isNew?"new-menu-item":""}`},{children:[i(b,{icon:t.icon,isActive:t.key==(null==u?void 0:u.key),activeStateIcon:null!==(M=t.activeIcon)&&void 0!==M?M:{},hoverStateIcon:null!==(w=t.hoverIcon)&&void 0!==w?w:{},isHovered:t.key==(null==v?void 0:v.key)||t.key==(null==m?void 0:m.key)}),i("div",Object.assign({className:"menu-item-container"},{children:i("p",Object.assign({className:"menu-item-text "+((null==t?void 0:t.key)===(null==u?void 0:u.key)?"active-menu-item-text":"")},{children:t.displayName}))}))]}),l)]}),l)})};export{k as BikSidebar};
1
+ import{jsxs as e,jsx as i,Fragment as n}from"react/jsx-runtime";import t from"../../assets/icons/Bik_logo.svg.js";import o from"../../assets/icons/locked.svg.js";import{useState as l,useMemo as s,useEffect as d,useCallback as r,Fragment as a}from"react";import c from"../progress-bar/CircularProgressBar.js";import{COLORS as u}from"../../constants/Theme.js";import{NavigationHyperlink as v}from"../navigation-hyperlink/NavigationHyperlink.js";import{SidebarPopup as m}from"./SidebarPopup.js";import{SideBarContainer as p,MainSideBarMenuWrapper as g,SibeBarMenuItem as h}from"./SidebarStyles.js";import{SimpleSidebar as y}from"./SimpleSidebar.js";const k=o=>{const{logoSvg:u,allMenuList:k,activeMainMenu:b,activeSubMenu:w,router:S,onClickingMainMenu:j,onClickingSubMenu:f,onClickingAccessUpgradePanel:L,onClickingPopupMenuItem:N,popupMinHeight:C,isNewSidebar:H,menuStyle:O}=o,[P,I]=l(b),[A,E]=l(),[x,B]=l(w),[F,_]=l(!1),[$,D]=l(),[T,U]=l(),[R,z]=l(),[q,K]=l(null),W=s((()=>k.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[k]);d((()=>{I(b)}),[b]),d((()=>{B(w)}),[w]);const G=r((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(D(void 0),E(void 0),_(!0),I(e),e.path||j(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?B(null==e?void 0:e.children[0]):B({}),E(void 0),setTimeout((()=>{_(!1)}),1e3))}),[j]),J=r((e=>{var i,n;if(Z(),E(void 0),D(void 0),"popup"==(null==e?void 0:e.layout)){const i=X();i&&U(i),D(e)}else{const t=document.getElementById((null===(n=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===n?void 0:n.join(""))||e.key.toString());if(t){const e=Q(t);z(e)}E(e),Y()}}),[]),Q=e=>{const i=e.getBoundingClientRect();let n=i.top;const t=e.querySelectorAll("div");let o=null;if(window.innerHeight<=768)return n;if(t.forEach((e=>{e.className.includes("sticky")&&(o=e)})),o){const e=window.innerHeight-i.bottom;n=i.top+e-140}return n};d((()=>{const e=()=>{const e=X();e&&U(e),V()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const V=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&z(window.innerHeight-i)},X=()=>{var e,i;if($){const n=(null===(i=null===(e=$.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||$.key.toString()+"_sub",t=document.getElementById(n);if(t){const e=t.getBoundingClientRect();let i=e.top;const n=null!=C?C:320;return e.bottom+n>window.innerHeight&&(i-=e.bottom+n-window.innerHeight),i}return null}},Y=()=>{Z();const e=setTimeout((()=>E(void 0)),1e4);K(e)},Z=()=>{clearTimeout(q)};return e(p,{children:[i("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:u||i(t,{})})),e(g,Object.assign({style:O},{children:[null==k?void 0:k.map(((t,o)=>{var l,s;return e(a,{children:[t.path?i(v,Object.assign({href:t.path,router:S},{children:i(M,{option:t,index:o,onClickMainMenuLogic:G,setHandleHoverForFullLayout:J,isDisabled:F,setHoveredComp:E,setPopupMenu:D,mainActiveMenu:P,hoveredComp:A,popupMenu:$})})):i(M,{option:t,index:o,onClickMainMenuLogic:G,setHandleHoverForFullLayout:J,isDisabled:F,setHoveredComp:E,setPopupMenu:D,mainActiveMenu:P,hoveredComp:A,popupMenu:$}),e(n,{children:["popup"===t.layout&&(null===(l=null==$?void 0:$.children)||void 0===l?void 0:l.length)&&i(m,{top:null!=T?T:void 0,menuList:null==$?void 0:$.children,onClickingPopupMenu:e=>{N&&N(e),D(void 0)},onMouseLeaveOnMenu:()=>D(void 0)}),(null===(s=null==A?void 0:A.children)||void 0===s?void 0:s.length)&&i(y,{menuList:null==A?void 0:A.children,activeMenu:x,onMouseEnterOnMenu:()=>Z(),onMouseLeaveOnMenu:()=>{Z(),E(void 0)},left:H?92:88,postion:"fixed",header:A.displayName,theme:"brand",router:S,showAccessUpgradePanel:A.showAccessUpgradePanel,onMenuClick:(e,i)=>{B(e),I(A),E(void 0),D(void 0),i&&f(e)},onUpgrade:L,top:H&&R||0,isNewSidebar:H})]})]},o)})),"number"==typeof o.onboardingPercentage&&i(h,{children:i("div",Object.assign({className:"main--sidebar"},{children:i("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===W?"sticky-menu":1===W?"sticky-menu-int":"sticky-menu-three")},{children:i(c,{percentage:o.onboardingPercentage,width:48})}))}))})]}))]})},b=e=>{const{icon:t,isActive:o,activeStateIcon:l,hoverStateIcon:s,isHovered:d}=e,r=t,a=s;return i(n,{children:o?i(l,{width:20,height:20}):i(d?a:r,{width:20,height:20,color:u.surface.standard})})},M=n=>{let{option:t,index:l,onClickMainMenuLogic:s,setHandleHoverForFullLayout:d,isDisabled:r,setHoveredComp:a,setPopupMenu:c,mainActiveMenu:u,hoveredComp:v,popupMenu:m}=n;var p,g,y,k,M,w;return i(h,{children:e("div",Object.assign({id:(null===(g=null===(p=t.displayName)||void 0===p?void 0:p.split(" "))||void 0===g?void 0:g.join(""))||t.key.toString(),className:"main--sidebar",onClick:()=>s(t),onMouseEnter:()=>{!r&&d(t)},onMouseOver:()=>{!r&&d(t)},onMouseLeave:()=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)||(a(void 0),c(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[t.isNew&&i("div",Object.assign({className:"new-tag "+(t.isLastSticky?"tag-sticky":"")},{children:"NEW"})),t.isLocked&&i("div",Object.assign({className:`locked--channel ${t.isLastSticky?"tag-sticky":""} ${t.is2ndLastSticky?"tag-sticky-2":""}`},{children:i(o,{height:16,width:16})})),e("div",Object.assign({id:(null===(k=null===(y=t.displayName)||void 0===y?void 0:y.split(" "))||void 0===k?void 0:k.join(""))+"_sub"||t.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==u?void 0:u.key)===t.key?"main-menu-active-class":""} \n\t\t\t\t\t${t.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${t.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${t.key===(null==v?void 0:v.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${t.isNew?"new-menu-item":""}`},{children:[i(b,{icon:t.icon,isActive:t.key==(null==u?void 0:u.key),activeStateIcon:null!==(M=t.activeIcon)&&void 0!==M?M:{},hoverStateIcon:null!==(w=t.hoverIcon)&&void 0!==w?w:{},isHovered:t.key==(null==v?void 0:v.key)||t.key==(null==m?void 0:m.key)}),i("div",Object.assign({className:"menu-item-container"},{children:i("p",Object.assign({className:"menu-item-text "+((null==t?void 0:t.key)===(null==u?void 0:u.key)?"active-menu-item-text":"")},{children:t.displayName}))}))]}),l)]}),l)})};export{k as BikSidebar};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -13,7 +13,6 @@ export interface ProductVariant {
13
13
  id?: string;
14
14
  actualPrice?: string;
15
15
  currency?: string;
16
- skuId?: string;
17
16
  }
18
17
  export interface Product {
19
18
  name: string;
@@ -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 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: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,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(fe,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),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&&(ve(!0),R.productFetcher(Ce,w).then((e=>{Object.keys(e).length&&de({type:"productsFetched",data:{collectionId:Ce,products:e}}),ve(!1)})).catch())}),[Ce]),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 products using name or SKU 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(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:ve,pagingControls:{curPage:fe,setCurPage:ye},hideCollectionCheckbox:$,renderWithoutModal:q,pickerType:Q,scrollContainerRef:Be}),"products"===ae&&me&&t(k.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: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(f,{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:ge,setSelectedCollectionId:be,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(C,{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: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||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:K?t(o,{}):Me(),hideCrossButton:Ee||ce},{children:[We,Ee&&ze?t(C,{productData:ze,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:H,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 x,ScrollContainerStyle as P,StyledFooterForNonModal as O}from"./style.js";import{OUT_OF_STOCK_ACTION as D}from"./type.js";import{updateAllVariantsForSelectedProducts as F}from"./utility.js";var T;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(T||(T={}));const R=R=>{const{storeId:w,selectedItems:A,onClose:B,visible:E,zIndex:L,exactLimit:z,limit:V,hideCollectionCheckbox:$,hideProductCheckbox: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,xe]=s(""),[Pe,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=>{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(x,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:()=>Pe?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?xe(e):xe("")}})}))}),e(P,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:()=>{xe(""),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};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import 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 l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as r}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,ProductSubTitle as I,SKUIDBadge as m,EllipsedBodyTiny as y}from"./style.js";import{shouldShowVariant as P}from"./utility.js";const f=o=>{var e,c,d,n,l,r,a,s,v;const{collectionId:p,productId:h,data:I,selectedData:m,selectedCollectionsDispatch:y,viewOnly:f,upliftAdditions:g,isProductPartiallyChecked:b,hideProductCheckbox:j,outOfStockAction:C,hideVariantCheckbox:O,hideProductVariants:D,pickerType:x,onProductDetailClick:S,showProductDetailInfoIcon:T}=o,V=t=>{var i,o,e,c,d,n;if(!(null===(o=null===(i=null==m?void 0:m[p])||void 0===i?void 0:i.products)||void 0===o?void 0:o[h]))return!1;return!!(null===(n=null===(d=null===(c=null===(e=null==m?void 0:m[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=D||!P(I)?`${I.currency&&null!==(e=u[I.currency])&&void 0!==e?e:""}${null!==(v=null!==(l=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!==l?l:null===(s=null===(a=Object.values(null!==(r=I.variants)&&void 0!==r?r:{}))||void 0===a?void 0:a[0])||void 0===s?void 0:s.actualPrice)&&void 0!==v?v:""}`:"";return t("div",{children:[i(k,{isVariant:!1,data:I,productId:h,collectionId:p,isSelected:(()=>{var t,i;return!!(null===(i=null===(t=null==m?void 0:m[p])||void 0===t?void 0:t.products)||void 0===i?void 0:i[h])})(),isPartiallyChecked:b,selectedCollectionsDispatch:y,upliftAdditions:g,viewOnly:f,hideProductCheckbox:j,hideVariantCheckbox:O,hideProductVariants:D,pickerType:x,outOfStockAction:C,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:A},h),D?null:P(I)&&Object.keys(I.variants||[]).map((t=>{var o,e,c,d,n,l,r;const a=`${I.currency&&null!==(o=u[I.currency])&&void 0!==o?o:""}${null!==(r=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===(l=null===(n=I.variants)||void 0===n?void 0:n[t])||void 0===l?void 0:l.actualPrice)&&void 0!==r?r:""}`;return i(k,{isVariant:!0,hideVariantCheckbox:O,data:Object.assign(Object.assign({},I.variants[t]),{currency:I.currency}),variantId:t,productId:h,viewOnly:f,upliftAdditions:g,collectionId:p,isSelected:V(t),selectedCollectionsDispatch:y,outOfStockAction:C,onProductDetailClick:S,showProductDetailInfoIcon:T,currencyAndPrice:a},t)}))]})},k=u=>{var P,f,k;const{isVariant:g,data:b,productId:j,collectionId:C,variantId:O,isSelected:D,selectedCollectionsDispatch:x,viewOnly:S,upliftAdditions:T,isPartiallyChecked:V,hideProductCheckbox:A,outOfStockAction:w,hideVariantCheckbox:U,hideProductVariants:$,pickerType:B="PRODUCT",onProductDetailClick:F,showProductDetailInfoIcon:R,currencyAndPrice:H}=u,{isVariantForProductPickerTag:K,dataForProductPickerTag:L,tagText:q,tagType:z}=v.getDataForProductPickerTag(b,g,w);console.log({data:b});const E=g?b.skuId:null===(k=null===(f=Object.values(null!==(P=null==b?void 0:b.variants)&&void 0!==P?P:{}))||void 0===f?void 0:f[0])||void 0===k?void 0:k.skuId;return t(h,Object.assign({isVariant:g,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===B&&(A||U)){const t=Object.keys(b.variants);$?D?x({type:"productUnselected",data:{productId:j,collectionId:C}}):T("productSelected",{productId:j,variantId:O,collectionId:C,product:b}):D?x({type:"variantUnselected",data:{productId:j,variantId:O,collectionId:C}}):T("variantSelected",{productId:j,variantId:O||t[0],collectionId:C,variant:b})}},isActive:D},{children:[g&&!S&&!U||!g&&!S&&!A?i(d,{isChecked:D,isPartiallyChecked:V||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),g?t?T($?"productSelected":"variantSelected",{productId:j,variantId:O,collectionId:C,variant:b}):x({type:$?"productUnselected":"variantUnselected",data:{productId:j,variantId:O,collectionId:C}}):t?T("productSelected",{productId:j,collectionId:C,product:b}):x({type:"productUnselected",data:{productId:j,collectionId:C}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:b.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(r,Object.assign({variant:"light",body:b.name,placement:"bottom",delay:400},{children:i(a,Object.assign({numberOfLines:1},{children:b.name}))})),R&&i(n,{onClick:()=>{null==F||F(b)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),t(I,{children:[i(p,{isVariant:K,data:L,tagText:q,tagType:z}),!(null==L?void 0:L.fbStatus)&&K||q?null:t(o,{children:[i(s,Object.assign({color:e.content.secondary},{children:H})),E&&i(r,Object.assign({body:E,placement:"top"},{children:i(m,{children:i(y,{children:`SKU ID: ${E}`})})}))]})]})]}))]}))};export{k as ProductCard,f 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 v}from"./style.js";import{shouldShowVariant as g}from"./utility.js";const f=i=>o(h,{children:[t(y,{}),t(D,{children:t(e,{className:"close-button",onClick:i.onClose,Icon:a,width:20,height:20})}),t(x,{productData:i.productData,outOfStockAction:i.outOfStockAction,useDynamicInfoImageSize:i.useDynamicInfoImageSize})]}),x=i=>{var a,e,f,x,h,y,D,I,P,T,S,O,w,$,z,A,F,C;const H=void 0===i.productData.variants;let N;if(H)N=`${i.productData.currency&&null!==(a=s[i.productData.currency])&&void 0!==a?a:""}${null!==(h=null!==(f=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==f?f:null===(x=i.productData)||void 0===x?void 0:x.actualPrice)&&void 0!==h?h:""}`;else{const o=null===(y=i.productData)||void 0===y?void 0:y.currency;N=`${o&&null!==(D=s[o])&&void 0!==D?D:""}${null!==(z=null!==(S=null===(T=null===(P=Object.values(null!==(I=i.productData.variants)&&void 0!==I?I:{}))||void 0===P?void 0:P[0])||void 0===T?void 0:T.price)&&void 0!==S?S:null===($=null===(w=Object.values(null!==(O=i.productData.variants)&&void 0!==O?O:{}))||void 0===w?void 0:w[0])||void 0===$?void 0:$.actualPrice)&&void 0!==z?z:""}`}const{isVariantForProductPickerTag:U,dataForProductPickerTag:V,tagText:_,tagType:B}=u.getDataForProductPickerTag(i.productData,H,i.outOfStockAction);console.log({productData:i.productData});const K=H?i.productData.skuId:null===(F=Object.values(null!==(A=i.productData.variants)&&void 0!==A?A:{})[0])||void 0===F?void 0:F.skuId;return o(b,{children:[t(j,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(k,{children:[K&&t(c,Object.assign({body:K,placement:"top"},{children:t(m,{children:t(v,{children:`SKU ID: ${K}`})})})),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!==(C=i.productData.description)&&void 0!==C?C:""}}),t(l,Object.assign({color:r.content.secondary},{children:H?N:g(i.productData)?null:N})),t(p,{isVariant:U,data:V,tagText:_,tagType:B})]})]})},h=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 n}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as c,BodyCaption as d}from"../TypographyStyle.js";import{CurrencySymbols as l}from"./constants.js";import{ProductHelper as s}from"./helpers/ProductHelper.js";import{ProductPickerTag as u}from"./ProductPickerTag.js";import{shouldShowVariant as p}from"./utility.js";const m=i=>o(g,{children:[t(f,{}),t(x,{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,m,v,g,f,x,D,j,k,I,P,T,S,w,O;const $=void 0===i.productData.variants;let z;if($)z=`${i.productData.currency&&null!==(a=l[i.productData.currency])&&void 0!==a?a:""}${null!==(g=null!==(m=null===(e=i.productData)||void 0===e?void 0:e.price)&&void 0!==m?m:null===(v=i.productData)||void 0===v?void 0:v.actualPrice)&&void 0!==g?g:""}`;else{const o=null===(f=i.productData)||void 0===f?void 0:f.currency;z=`${o&&null!==(x=l[o])&&void 0!==x?x:""}${null!==(w=null!==(I=null===(k=null===(j=Object.values(null!==(D=i.productData.variants)&&void 0!==D?D:{}))||void 0===j?void 0:j[0])||void 0===k?void 0:k.price)&&void 0!==I?I: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.actualPrice)&&void 0!==w?w:""}`}const{isVariantForProductPickerTag:A,dataForProductPickerTag:F,tagText:C,tagType:H}=s.getDataForProductPickerTag(i.productData,$,i.outOfStockAction);return o(y,{children:[t(h,{children:t(n,{useDynamicInfoImageSize:i.useDynamicInfoImageSize,imageUrl:i.productData.image,width:200,height:200,borderRadius:4})}),o(b,{children:[t(c,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(d,Object.assign({color:r.content.secondary},{children:`Product ID: ${i.productData.id}`})),t(d,{className:"overlay-description",dangerouslySetInnerHTML:{__html:null!==(O=i.productData.description)&&void 0!==O?O:""}}),t(d,Object.assign({color:r.content.secondary},{children:$?z:p(i.productData)?null:z})),t(u,{isVariant:A,data:F,tagText:C,tagType:H})]})]})},g=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
- `,y=i.div`
20
+ `,f=i.div`
21
21
  display: flex;
22
22
  flex: 1;
23
23
  background: rgba(0, 0, 0, 0.5);
24
- `,D=i.div`
24
+ `,x=i.div`
25
25
  position: relative;
26
26
 
27
27
  .close-button {
@@ -32,21 +32,21 @@ 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
- `,b=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
- `,j=i.div`
41
+ `,h=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
- `,k=i.div`
47
+ `,b=i.div`
48
48
  display: flex;
49
49
  flex: 1;
50
50
  flex-direction: column;
51
51
  gap: 4px;
52
- `;export{x as ProductInfoCard,f as ProductInfoOverlay};
52
+ `;export{v as ProductInfoCard,m as ProductInfoOverlay};
@@ -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 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};
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,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};
@@ -23,9 +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>;
@@ -1,9 +1,9 @@
1
- import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{BodyTiny as t}from"../TypographyStyle.js";import{ScreenName as o}from"./modal.js";const n=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
- `,r=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!==o.RearrangeProducts?"#888":"#fff"};
16
+ background-color: ${e=>e.screenName!==t.RearrangeProducts?"#888":"#fff"};
17
17
  border-radius: 8px;
18
18
  }
19
- `,d=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
- `,p=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
- `,l=e.div`
39
+ `,p=e.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,a=e.div`
43
+ `,l=e.div`
44
44
  display: flex;
45
45
  flex-direction: row;
46
46
  max-height: 32px;
@@ -60,7 +60,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
60
60
  padding: 12px 16px;
61
61
  border-bottom: 1px solid #e0e0e0;
62
62
  align-items: center;
63
- `,s=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
- `,x=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
- `,g=e.div`
90
+ `,x=e.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,f=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
- `,h=e.div`
114
+ `,f=e.div`
115
115
  height: 72px;
116
116
  width: 72px;
117
117
  display: flex;
@@ -134,21 +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
- `,m=e.div`
138
- width: fit-content;
139
- background: ${i.background.brandLight};
140
- padding: 2px 6px;
141
- border-radius: 14px;
142
- `,b=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
- `,y=e.div`
150
- display: flex;
151
- flex-direction: row;
152
- align-items: center;
153
- gap: 5px;
154
- `;export{l as CollectionCardDetailStyle,p as CollectionCardInfoStyle,d as CollectionCardStyle,g as CollectionNameHolder,n as ContainerStyle,b as EllipsedBodyTiny,s as ProductCardStyle,c as ProductScreenCollectionCardStyle,a as ProductScreenHeader,y as ProductSubTitle,m as SKUIDBadge,r as ScrollContainerStyle,x as SelectedScreenHeader,u as StyledFooterForNonModal,h as VariantCardGridStyle,f 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.657-9",
3
+ "version": "0.0.657-beta.1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",