@bikdotai/bik-component-library 0.0.456-beta.ppi-9 → 0.0.456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -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("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.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:y,selectedItems:b,onClose:m,visible:f,zIndex:P,exactLimit:v,limit:k,hideCollectionCheckbox:I,hideProductCheckbox:F,outOfStockAction:O=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:D,width:E,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:L=!1,showProductDetails:V}=e,[_,z]=c.useReducer(S.collectionsReducer,{}),[W,G]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[H,K]=c.useState("grid"),[U,Y]=c.useState(""),[J,Q]=c.useState(""),[X,Z]=c.useState(0),[ee,te]=c.useState(!1),[oe,ce]=c.useState(0),[re,se]=c.useState(""),[ne,le]=c.useState(!1),[ie,ae]=c.useState(!1),[de,ue]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[he,pe]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Se=c.useRef(null),[Ce,xe]=c.useState(!1),[ge,je]=c.useState();c.useEffect((()=>{te(!0),ae(!0),e.collectionFetcher(X,y).then((e=>{z({type:"fetched",data:(null==e?void 0:e.collections)||{}}),te(!1),Z((e=>e+1)),ae(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=he[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ce(e)})),c.useEffect((()=>{J&&(te(!0),e.productFetcher(J,y).then((e=>{Object.keys(e).length&&z({type:"productsFetched",data:{collectionId:J,products:e}}),te(!1)})).catch())}),[J]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==W&&(re.length?(le(!0),e.searchFetcher(y,re).then((e=>{"collections"in e&&"products"in e?(ue({type:"set",data:e}),z({type:"searched",data:e.collections})):(ue({type:"set",data:{collections:{},products:e}}),z({type:"searched",data:e})),G("searchProducts"),te(!1),le(!1)}))):G("collections"))}),800);return()=>clearTimeout(t)}),[re]),c.useEffect((()=>{N&&(e.onAdd(he,oe),ye())}),[N]),c.useEffect((()=>{L&&Object.keys(he||{}).length&&oe&&(e.onAdd(he,oe),ye())}),[L,he,oe]);const ye=()=>{pe({type:"reset",data:{}})},be=t.jsxs(g.ContainerStyle,{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===W||"searchProducts"===W)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ne?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:re,onChangeText:e=>{e.length&&e.trim().length?se(e):se("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Se,screenName:W},{children:["collections"===W&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ie,collections:_,selectedCollectionsDispatch:pe,setCollectionId:Y,setSelectedCollectionId:Q,setScreen:G,selectedCollections:he,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:z,setSaveDisabled:te,pagingControls:{curPage:X,setCurPage:Z},hideCollectionCheckbox:I,renderWithoutModal:w,pickerType:A}),"products"===W&&U&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:U},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:G,storeId:y,data:_[U],collectionsDispatch:z,selectedCollectionsDispatch:pe,selectedData:he,setSaveDisabled:te,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:F,outOfStockAction:O,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{xe(!0),je(e)},showProductDetailInfoIcon:V})})),"view"===W&&t.jsx(x.SelectedScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,collections:_,outOfStockAction:O,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===W&&t.jsx(p.RearrangeScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,outOfStockAction:O,rearrangeViewType:"grid"===H?"list":"grid",scrollContainerRef:Se,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===W&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:he||{},searchedCollections:de||{},searchedCollectionsDispatch:ue,selectedCollectionsDispatch:pe,setScreen:G,collections:_,onBackPress:()=>{se(""),ue({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:F,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Y,setSelectedCollectionId:Q,renderWithoutModal:w,hideCollectionCheckbox:I})]}))]});return t.jsx(t.Fragment,{children:w?be:t.jsxs(l.StyledModal,Object.assign({zIndex:P,open:f,onClose:()=>{null==m||m(),ye()},headingTitle:D||("collections"===W||"products"===W?"Select Products":"view"===W?"Selected Products":"searchProducts"===W?"Searched Products":"rearrange"===W?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:E||"600px"},headerRightCustomElement:"rearrange"===W?(console.log("ignore:",K),t.jsx(t.Fragment,{})):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:{buttonText:ee?"Loading...":W===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:ee||oe<1||v&&oe<v||!v&&k&&oe>k||!1,onClick:()=>{e.onAdd(he,oe),ye()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):v&&oe>v?t.jsx(a.Tag,{tagText:`You can only select ${v} products`,type:"negative"}):k&&oe>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):oe>0?t.jsx(s.Button,{onClick:()=>{G($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:v?`${oe}/${v} products selected`:`${oe} products selected`,buttonType:["rearrange","view"].includes(W)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(W)}):t.jsx(s.Button,{disabled:!0,buttonText:v?`${oe}/${v} products selected`:`${oe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ce},{children:[be,Ce&&ge?t.jsx(u.ProductInfoOverlay,{productData:ge,outOfStockAction:O,onClose:()=>{xe(!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("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.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:y,selectedItems:b,onClose:m,visible:f,zIndex:P,exactLimit:v,limit:k,hideCollectionCheckbox:I,hideProductCheckbox:F,outOfStockAction:O=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:D,width:E,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:L=!1,showProductDetails:V}=e,[_,z]=c.useReducer(S.collectionsReducer,{}),[W,G]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[H,K]=c.useState("grid"),[U,Y]=c.useState(""),[J,Q]=c.useState(""),[X,Z]=c.useState(0),[ee,te]=c.useState(!1),[oe,ce]=c.useState(0),[re,se]=c.useState(""),[ne,le]=c.useState(!1),[ie,ae]=c.useState(!1),[de,ue]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[he,pe]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Se=c.useRef(null),[Ce,xe]=c.useState(!1),[ge,je]=c.useState();c.useEffect((()=>{te(!0),ae(!0),e.collectionFetcher(X,y).then((e=>{z({type:"fetched",data:(null==e?void 0:e.collections)||{}}),te(!1),Z((e=>e+1)),ae(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=he[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ce(e)})),c.useEffect((()=>{J&&(te(!0),e.productFetcher(J,y).then((e=>{Object.keys(e).length&&z({type:"productsFetched",data:{collectionId:J,products:e}}),te(!1)})).catch())}),[J]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==W&&(re.length?(le(!0),e.searchFetcher(y,re).then((e=>{"collections"in e&&"products"in e?(ue({type:"set",data:e}),z({type:"searched",data:e.collections})):(ue({type:"set",data:{collections:{},products:e}}),z({type:"searched",data:e})),G("searchProducts"),te(!1),le(!1)}))):G("collections"))}),800);return()=>clearTimeout(t)}),[re]),c.useEffect((()=>{N&&(e.onAdd(he,oe),ye())}),[N]),c.useEffect((()=>{L&&Object.keys(he||{}).length&&oe&&(e.onAdd(he,oe),ye())}),[L,he,oe]);const ye=()=>{pe({type:"reset",data:{}})},be=t.jsxs(g.ContainerStyle,{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===W||"searchProducts"===W)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ne?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:re,onChangeText:e=>{e.length&&e.trim().length?se(e):se("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Se},{children:["collections"===W&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ie,collections:_,selectedCollectionsDispatch:pe,setCollectionId:Y,setSelectedCollectionId:Q,setScreen:G,selectedCollections:he,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:z,setSaveDisabled:te,pagingControls:{curPage:X,setCurPage:Z},hideCollectionCheckbox:I,renderWithoutModal:w,pickerType:A}),"products"===W&&U&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:U},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:G,storeId:y,data:_[U],collectionsDispatch:z,selectedCollectionsDispatch:pe,selectedData:he,setSaveDisabled:te,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:F,outOfStockAction:O,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{xe(!0),je(e)},showProductDetailInfoIcon:V})})),"view"===W&&t.jsx(x.SelectedScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,collections:_,outOfStockAction:O,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===W&&t.jsx(p.RearrangeScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,outOfStockAction:O,rearrangeViewType:"grid"===H?"list":"grid",scrollContainerRef:Se,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===W&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:he||{},searchedCollections:de||{},searchedCollectionsDispatch:ue,selectedCollectionsDispatch:pe,setScreen:G,collections:_,onBackPress:()=>{se(""),ue({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:F,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Y,setSelectedCollectionId:Q,renderWithoutModal:w,hideCollectionCheckbox:I})]}))]});return t.jsx(t.Fragment,{children:w?be:t.jsxs(l.StyledModal,Object.assign({zIndex:P,open:f,onClose:()=>{null==m||m(),ye()},headingTitle:D||("collections"===W||"products"===W?"Select Products":"view"===W?"Selected Products":"searchProducts"===W?"Searched Products":"rearrange"===W?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:E||"600px"},headerRightCustomElement:"rearrange"===W?(console.log("ignore:",K),t.jsx(t.Fragment,{})):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:{buttonText:ee?"Loading...":W===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:ee||oe<1||v&&oe<v||!v&&k&&oe>k||!1,onClick:()=>{e.onAdd(he,oe),ye()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):v&&oe>v?t.jsx(a.Tag,{tagText:`You can only select ${v} products`,type:"negative"}):k&&oe>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):oe>0?t.jsx(s.Button,{onClick:()=>{G($?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:v?`${oe}/${v} products selected`:`${oe} products selected`,buttonType:["rearrange","view"].includes(W)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(W)}):t.jsx(s.Button,{disabled:!0,buttonText:v?`${oe}/${v} products selected`:`${oe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ce},{children:[be,Ce&&ge?t.jsx(u.ProductInfoOverlay,{productData:ge,outOfStockAction:O,onClose:()=>{xe(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=n(t);const l=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{className:"description",dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=c.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"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const c=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=l.default.div`
2
2
  display: flex;
3
3
  flex: 1;
4
4
  background: rgba(0, 0, 0, 0.5);
@@ -8,19 +8,11 @@
8
8
  position: absolute;
9
9
  bottom: 0;
10
10
  z-index: 10;
11
-
12
- .description {
13
- display: flex;
14
- flex-direction: column;
15
- max-height: 300px;
16
- overflow-y: auto;
17
- word-break: break-word;
18
- }
19
- `,p=c.default.div`
11
+ `,p=l.default.div`
20
12
  display: flex;
21
13
  flex: 1;
22
14
  background: rgba(0, 0, 0, 0.5);
23
- `,x=c.default.div`
15
+ `,x=l.default.div`
24
16
  position: relative;
25
17
 
26
18
  .close-button {
@@ -31,17 +23,17 @@
31
23
  background: ${o.COLORS.surface.standard};
32
24
  border-radius: 50%;
33
25
  }
34
- `,f=c.default.div`
26
+ `,f=l.default.div`
35
27
  display: flex;
36
28
  background: white;
37
29
  padding: 24px;
38
30
  gap: 24px;
39
31
  border-radius: 8px 8px 0px 0px;
40
- `,g=c.default.div`
32
+ `,g=l.default.div`
41
33
  display: flex;
42
- `,h=c.default.div`
34
+ `,h=l.default.div`
43
35
  display: flex;
44
36
  flex: 1;
45
37
  flex-direction: column;
46
38
  gap: 10px;
47
- `;exports.ProductInfoCard=l,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(l,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
39
+ `;exports.ProductInfoCard=c,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(c,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
@@ -1,7 +1,5 @@
1
1
  export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {
3
- screenName: string;
4
- }, never>;
2
+ export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
5
3
  export declare const CollectionCardStyle: import("styled-components").StyledComponent<"div", any, {
6
4
  isDisabled: boolean;
7
5
  isActive: boolean;
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const l=r.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e);const r=o.default.div`
2
2
  display: flex;
3
3
  background-color: white;
4
4
  height: 600px;
5
5
  flex-direction: column;
6
- `,n=r.default.div`
6
+ `,l=o.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!==i.ScreenName.RearrangeProducts?"#888":"#fff"};
16
+ background-color: #888;
17
17
  border-radius: 8px;
18
18
  }
19
- `,d=r.default.div`
19
+ `,n=o.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
- `,a=r.default.div`
33
+ `,d=o.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=r.default.div`
39
+ `,a=o.default.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,p=r.default.div`
43
+ `,p=o.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
- `,s=r.default.div`
56
+ `,c=o.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
- `,x=r.default.div`
63
+ `,x=o.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=r.default.div`
78
+ `,s=o.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
- `,u=r.default.div`
90
+ `,u=o.default.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,g=r.default.div`
93
+ `,f=o.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
- `,y=r.default.div`
114
+ `,g=o.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
- `;r.default.div`
121
+ `;o.default.div`
122
122
  display: flex;
123
123
  width: 32px;
124
124
  height: 32px;
@@ -127,4 +127,4 @@
127
127
  align-items: center;
128
128
  border: 1px solid ${t.COLORS.stroke.primary};
129
129
  border-radius: 4px;
130
- `,exports.CollectionCardDetailStyle=c,exports.CollectionCardInfoStyle=a,exports.CollectionCardStyle=d,exports.CollectionNameHolder=u,exports.ContainerStyle=l,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=s,exports.ProductScreenHeader=p,exports.ScrollContainerStyle=n,exports.SelectedScreenHeader=f,exports.VariantCardGridStyle=y,exports.VariantCardListStyle=g;
130
+ `,exports.CollectionCardDetailStyle=a,exports.CollectionCardInfoStyle=d,exports.CollectionCardStyle=n,exports.CollectionNameHolder=u,exports.ContainerStyle=r,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=c,exports.ProductScreenHeader=p,exports.ScrollContainerStyle=l,exports.SelectedScreenHeader=s,exports.VariantCardGridStyle=g,exports.VariantCardListStyle=f;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("react-beautiful-dnd"),s=require("../../constants/Theme.js"),t=require("./variant.js");exports.VariantsGrid=r=>{let{selectedVariants:s}=r;return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex"})},{children:[e.jsx(a.Droppable,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[s.map(((r,s)=>e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:s},{children:(a,s)=>e.jsxs("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{children:[e.jsx(t.VariantCardGridView,{data:r}),a.placeholder]}))}),`${r.productId}-${r.variantId}`))),r.placeholder]}))})),r.placeholder]}))}))},exports.VariantsList=i=>{let{selectedVariants:n,setSelectedVariants:d,selectedCollectionsDispatch:l,outOfStockAction:o}=i;const[p,c]=r.useState(-1);function b(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-list"},{children:(r,i)=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign({backgroundColor:s.COLORS.surface.subdued,padding:"0.05px",height:n.length<8?"550px":"100%",overflow:"auto"},r.droppableProps.style)},{children:[n.map(((r,i)=>e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px",boxShadow:i===p?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>c(i),onMouseLeave:()=>c(-1)},{children:e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:i},{children:(a,s)=>e.jsx("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{style:b(Object.assign(Object.assign({},a.draggableProps.style),a.draggableSnapshot))},{children:e.jsx(t.VariantCardListView,{data:r,selectedCollectionsDispatch:l,onDelete:()=>{const e=n.slice();e[i].displayOrder=null,e.splice(i,1),d(e)},outOfStockAction:o},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),r.placeholder&&i.isDraggingOver?e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px"}},{children:r.placeholder})):null]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("react-beautiful-dnd"),s=require("../../constants/Theme.js"),t=require("./variant.js");exports.VariantsGrid=r=>{let{selectedVariants:s}=r;return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex"})},{children:[e.jsx(a.Droppable,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:r=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign(Object.assign({},r.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[s.map(((r,s)=>e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:s},{children:(a,s)=>e.jsxs("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{children:[e.jsx(t.VariantCardGridView,{data:r}),a.placeholder]}))}),`${r.productId}-${r.variantId}`))),r.placeholder]}))})),r.placeholder]}))}))},exports.VariantsList=i=>{let{selectedVariants:n,setSelectedVariants:d,selectedCollectionsDispatch:l,outOfStockAction:o}=i;const[p,c]=r.useState(-1);function b(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e.jsx(a.Droppable,Object.assign({droppableId:"droppable-list"},{children:(r,i)=>e.jsxs("div",Object.assign({},r.droppableProps,{ref:r.innerRef,style:Object.assign({backgroundColor:s.COLORS.surface.subdued,padding:"0.05px",height:n.length<8?"550px":"100%"},r.droppableProps.style)},{children:[n.map(((r,i)=>e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px",boxShadow:i===p?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>c(i),onMouseLeave:()=>c(-1)},{children:e.jsx(a.Draggable,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:i},{children:(a,s)=>e.jsx("div",Object.assign({ref:a.innerRef},a.draggableProps,a.dragHandleProps,{style:b(Object.assign(Object.assign({},a.draggableProps.style),a.draggableSnapshot))},{children:e.jsx(t.VariantCardListView,{data:r,selectedCollectionsDispatch:l,onDelete:()=>{const e=n.slice();e[i].displayOrder=null,e.splice(i,1),d(e)},outOfStockAction:o},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),r.placeholder&&i.isDraggingOver?e.jsx("div",Object.assign({style:{background:s.COLORS.surface.hovered,margin:"5px"}},{children:r.placeholder})):null]}))}))};
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -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{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as b}from"./rearrangeScreen.js";import{collectionsReducer as f,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const T=T=>{const{storeId:D,selectedItems:O,onClose:w,visible:R,zIndex:E,exactLimit:A,limit:$,hideCollectionCheckbox:V,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X}=T,[Z,_]=r(f,{}),[ee,te]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[oe,ce]=s("grid"),[re,se]=s(""),[ie,ne]=s(""),[le,de]=s(0),[ae,ue]=s(!1),[he,pe]=s(0),[me,Ce]=s(""),[ge,be]=s(!1),[fe,ye]=s(!1),[Se,ve]=r(y,{collections:{},products:{}}),[ke,Pe]=r(S,Object.keys(O).length>0?O:{}),xe=i(null),[je,Ie]=s(!1),[Fe,Te]=s();n((()=>{ue(!0),ye(!0),T.collectionFetcher(le,D).then((e=>{_({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ue(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),n((()=>{let e=0;Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ke[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),pe(e)})),n((()=>{ie&&(ue(!0),T.productFetcher(ie,D).then((e=>{Object.keys(e).length&&_({type:"productsFetched",data:{collectionId:ie,products:e}}),ue(!1)})).catch())}),[ie]),n((()=>{const e=setTimeout((()=>{"rearrange"!==ee&&(me.length?(be(!0),T.searchFetcher(D,me).then((e=>{"collections"in e&&"products"in e?(ve({type:"set",data:e}),_({type:"searched",data:e.collections})):(ve({type:"set",data:{collections:{},products:e}}),_({type:"searched",data:e})),te("searchProducts"),ue(!1),be(!1)}))):te("collections"))}),800);return()=>clearTimeout(e)}),[me]),n((()=>{K&&(T.onAdd(ke,he),De())}),[K]),n((()=>{Q&&Object.keys(ke||{}).length&&he&&(T.onAdd(ke,he),De())}),[Q,ke,he]);const De=()=>{Pe({type:"reset",data:{}})},Oe=e(x,{children:[T.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:T.postHeader})),!T.hideGlobalSearch&&t(o,{children:("collections"===ee||"searchProducts"===ee)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?t(h,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:me,onChangeText:e=>{e.length&&e.trim().length?Ce(e):Ce("")}})}))}),e(j,Object.assign({ref:xe,screenName:ee},{children:["collections"===ee&&t(m,{customCollectionRestriction:T.customCollectionRestriction,dataLoading:fe,collections:Z,selectedCollectionsDispatch:Pe,setCollectionId:se,setSelectedCollectionId:ne,setScreen:te,selectedCollections:ke,collectionFetcher:T.collectionFetcher,storeId:D,collectionsDispatch:_,setSaveDisabled:ue,pagingControls:{curPage:le,setCurPage:de},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:N}),"products"===ee&&re&&t(v.Provider,Object.assign({value:re},{children:t(g,{hideInCollectionSearch:T.hideInCollectionSearch,customCollectionRestriction:T.customCollectionRestriction,productFetcher:T.productFetcher,setScreen:te,storeId:D,data:Z[re],collectionsDispatch:_,selectedCollectionsDispatch:Pe,selectedData:ke,setSaveDisabled:ue,searchInCollectionFetcher:T.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:T.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Te(e)},showProductDetailInfoIcon:X})})),"view"===ee&&t(P,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,outOfStockAction:L,storeId:D,fbStatusFetcher:T.fbStatusFetcher}),"rearrange"===ee&&t(b,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,outOfStockAction:L,rearrangeViewType:"grid"===oe?"list":"grid",scrollContainerRef:xe,storeId:D,fbStatusFetcher:T.fbStatusFetcher}),"searchProducts"===ee&&t(k,{customCollectionRestriction:T.customCollectionRestriction,selectedCollections:ke||{},searchedCollections:Se||{},searchedCollectionsDispatch:ve,selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,onBackPress:()=>{Ce(""),ve({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:D,fbStatusFetcher:T.fbStatusFetcher,setCollectionId:se,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:V})]}))]});return t(o,{children:Y?Oe:e(u,Object.assign({zIndex:E,open:R,onClose:()=>{null==w||w(),De()},headingTitle:G||("collections"===ee||"products"===ee?"Select Products":"view"===ee?"Selected Products":"searchProducts"===ee?"Searched Products":"rearrange"===ee?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:"rearrange"===ee?(console.log("ignore:",ce),t(o,{})):t(o,{}),footerContainerStyle:T.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:{buttonText:ae?"Loading...":ee===F.RearrangeProducts?"Done":"Add",disabled:ae||he<1||A&&he<A||!A&&$&&he>$||!1,onClick:()=>{T.onAdd(ke,he),De()}},wrapperStyle:T.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&he>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):$&&he>$?t(p,{tagText:`You can only select ${$} products`,type:"negative"}):t(d,he>0?{onClick:()=>{te(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:["rearrange","view"].includes(ee)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ee)}:{disabled:!0,buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:je},{children:[Oe,je&&Fe?t(C,{productData:Fe,outOfStockAction:L,onClose:()=>{Ie(!1)}}):t(o,{})]}))})};export{T as ProductPickerModal,F 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{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as b}from"./rearrangeScreen.js";import{collectionsReducer as f,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const T=T=>{const{storeId:D,selectedItems:O,onClose:w,visible:R,zIndex:E,exactLimit:A,limit:$,hideCollectionCheckbox:V,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:U,hideProductVariants:q=!1,startupScreen:J=F.Collections,rearrangeEnabled:N,selectSingleItem:Q=!1,showProductDetails:X}=T,[Z,_]=r(f,{}),[ee,te]=s([F.Collections,F.RearrangeProducts].includes(J)?J:F.Collections),[oe,ce]=s("grid"),[re,se]=s(""),[ie,ne]=s(""),[le,de]=s(0),[ae,ue]=s(!1),[he,pe]=s(0),[me,Ce]=s(""),[ge,be]=s(!1),[fe,ye]=s(!1),[Se,ve]=r(y,{collections:{},products:{}}),[ke,Pe]=r(S,Object.keys(O).length>0?O:{}),xe=i(null),[je,Ie]=s(!1),[Fe,Te]=s();n((()=>{ue(!0),ye(!0),T.collectionFetcher(le,D).then((e=>{_({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ue(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),n((()=>{let e=0;Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ke[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),pe(e)})),n((()=>{ie&&(ue(!0),T.productFetcher(ie,D).then((e=>{Object.keys(e).length&&_({type:"productsFetched",data:{collectionId:ie,products:e}}),ue(!1)})).catch())}),[ie]),n((()=>{const e=setTimeout((()=>{"rearrange"!==ee&&(me.length?(be(!0),T.searchFetcher(D,me).then((e=>{"collections"in e&&"products"in e?(ve({type:"set",data:e}),_({type:"searched",data:e.collections})):(ve({type:"set",data:{collections:{},products:e}}),_({type:"searched",data:e})),te("searchProducts"),ue(!1),be(!1)}))):te("collections"))}),800);return()=>clearTimeout(e)}),[me]),n((()=>{K&&(T.onAdd(ke,he),De())}),[K]),n((()=>{Q&&Object.keys(ke||{}).length&&he&&(T.onAdd(ke,he),De())}),[Q,ke,he]);const De=()=>{Pe({type:"reset",data:{}})},Oe=e(x,{children:[T.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:T.postHeader})),!T.hideGlobalSearch&&t(o,{children:("collections"===ee||"searchProducts"===ee)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?t(h,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:me,onChangeText:e=>{e.length&&e.trim().length?Ce(e):Ce("")}})}))}),e(j,Object.assign({ref:xe},{children:["collections"===ee&&t(m,{customCollectionRestriction:T.customCollectionRestriction,dataLoading:fe,collections:Z,selectedCollectionsDispatch:Pe,setCollectionId:se,setSelectedCollectionId:ne,setScreen:te,selectedCollections:ke,collectionFetcher:T.collectionFetcher,storeId:D,collectionsDispatch:_,setSaveDisabled:ue,pagingControls:{curPage:le,setCurPage:de},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:U}),"products"===ee&&re&&t(v.Provider,Object.assign({value:re},{children:t(g,{hideInCollectionSearch:T.hideInCollectionSearch,customCollectionRestriction:T.customCollectionRestriction,productFetcher:T.productFetcher,setScreen:te,storeId:D,data:Z[re],collectionsDispatch:_,selectedCollectionsDispatch:Pe,selectedData:ke,setSaveDisabled:ue,searchInCollectionFetcher:T.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:U,hideProductVariants:q,fbStatusFetcher:T.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Te(e)},showProductDetailInfoIcon:X})})),"view"===ee&&t(P,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,outOfStockAction:L,storeId:D,fbStatusFetcher:T.fbStatusFetcher}),"rearrange"===ee&&t(b,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,outOfStockAction:L,rearrangeViewType:"grid"===oe?"list":"grid",scrollContainerRef:xe,storeId:D,fbStatusFetcher:T.fbStatusFetcher}),"searchProducts"===ee&&t(k,{customCollectionRestriction:T.customCollectionRestriction,selectedCollections:ke||{},searchedCollections:Se||{},searchedCollectionsDispatch:ve,selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,onBackPress:()=>{Ce(""),ve({type:"set",data:{collections:{},products:{}}})},pickerType:U,hideProductCheckbox:B,hideProductVariants:q,hideVariantCheckbox:M,storeId:D,fbStatusFetcher:T.fbStatusFetcher,setCollectionId:se,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:V})]}))]});return t(o,{children:Y?Oe:e(u,Object.assign({zIndex:E,open:R,onClose:()=>{null==w||w(),De()},headingTitle:G||("collections"===ee||"products"===ee?"Select Products":"view"===ee?"Selected Products":"searchProducts"===ee?"Searched Products":"rearrange"===ee?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:"rearrange"===ee?(console.log("ignore:",ce),t(o,{})):t(o,{}),footerContainerStyle:T.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:l.surface.standard}:void 0,primaryButton:{buttonText:ae?"Loading...":ee===F.RearrangeProducts?"Done":"Add",disabled:ae||he<1||A&&he<A||!A&&$&&he>$||!1,onClick:()=>{T.onAdd(ke,he),De()}},wrapperStyle:T.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&he>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):$&&he>$?t(p,{tagText:`You can only select ${$} products`,type:"negative"}):t(d,he>0?{onClick:()=>{te(N?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:["rearrange","view"].includes(ee)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ee)}:{disabled:!0,buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:je},{children:[Oe,je&&Fe?t(C,{productData:Fe,outOfStockAction:L,onClose:()=>{Ie(!1)}}):t(o,{})]}))})};export{T as ProductPickerModal,F as ScreenName};
@@ -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 e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as d}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as n,BodyCaption as s}from"../TypographyStyle.js";import{ProductPickerTag as c}from"./ProductPickerTag.js";const p=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(l,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),l=i=>{var r;const e=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(d,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(n,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(s,{className:"description",dangerouslySetInnerHTML:{__html:null!==(r=i.productData.description)&&void 0!==r?r:""}}),t(c,{isVariant:e,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=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 e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as d,BodyCaption as s}from"../TypographyStyle.js";import{ProductPickerTag as c}from"./ProductPickerTag.js";const l=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(p,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),p=i=>{var r;const e=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(n,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(s,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(r=i.productData.description)&&void 0!==r?r:""}}),t(c,{isVariant:e,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=i.div`
2
2
  display: flex;
3
3
  flex: 1;
4
4
  background: rgba(0, 0, 0, 0.5);
@@ -8,14 +8,6 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
8
8
  position: absolute;
9
9
  bottom: 0;
10
10
  z-index: 10;
11
-
12
- .description {
13
- display: flex;
14
- flex-direction: column;
15
- max-height: 300px;
16
- overflow-y: auto;
17
- word-break: break-word;
18
- }
19
11
  `,u=i.div`
20
12
  display: flex;
21
13
  flex: 1;
@@ -44,4 +36,4 @@ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-component
44
36
  flex: 1;
45
37
  flex-direction: column;
46
38
  gap: 10px;
47
- `;export{l as ProductInfoCard,p as ProductInfoOverlay};
39
+ `;export{p as ProductInfoCard,l as ProductInfoOverlay};
@@ -1,7 +1,5 @@
1
1
  export declare const ContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
2
- export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {
3
- screenName: string;
4
- }, never>;
2
+ export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
5
3
  export declare const CollectionCardStyle: import("styled-components").StyledComponent<"div", any, {
6
4
  isDisabled: boolean;
7
5
  isActive: boolean;
@@ -1,9 +1,9 @@
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`
1
+ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";const t=e.div`
2
2
  display: flex;
3
3
  background-color: white;
4
4
  height: 600px;
5
5
  flex-direction: column;
6
- `,n=e.div`
6
+ `,o=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!==t.RearrangeProducts?"#888":"#fff"};
16
+ background-color: #888;
17
17
  border-radius: 8px;
18
18
  }
19
- `,r=e.div`
19
+ `,n=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
- `,d=e.div`
33
+ `,r=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
- `,p=e.div`
39
+ `,d=e.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  justify-content: center;
43
- `,l=e.div`
43
+ `,p=e.div`
44
44
  display: flex;
45
45
  flex-direction: row;
46
46
  max-height: 32px;
@@ -53,14 +53,14 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
53
53
  position: sticky;
54
54
  top: 0;
55
55
  z-index: 10;
56
- `,c=e.div`
56
+ `,l=e.div`
57
57
  display: flex;
58
58
  flex-direction: row;
59
59
  column-gap: 16px;
60
60
  padding: 12px 16px;
61
61
  border-bottom: 1px solid #e0e0e0;
62
62
  align-items: center;
63
- `,a=e.div`
63
+ `,c=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;
@@ -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
- `,s=e.div`
90
+ `,a=e.div`
91
91
  display: flex;
92
92
  flex-direction: column;
93
- `,g=e.div`
93
+ `,s=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
- `,f=e.div`
114
+ `,g=e.div`
115
115
  height: 72px;
116
116
  width: 72px;
117
117
  display: flex;
@@ -127,4 +127,4 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
127
127
  align-items: center;
128
128
  border: 1px solid ${i.stroke.primary};
129
129
  border-radius: 4px;
130
- `;export{p as CollectionCardDetailStyle,d as CollectionCardInfoStyle,r as CollectionCardStyle,s as CollectionNameHolder,o as ContainerStyle,a as ProductCardStyle,c as ProductScreenCollectionCardStyle,l as ProductScreenHeader,n as ScrollContainerStyle,x as SelectedScreenHeader,f as VariantCardGridStyle,g as VariantCardListStyle};
130
+ `;export{d as CollectionCardDetailStyle,r as CollectionCardInfoStyle,n as CollectionCardStyle,a as CollectionNameHolder,t as ContainerStyle,c as ProductCardStyle,l as ProductScreenCollectionCardStyle,p as ProductScreenHeader,o as ScrollContainerStyle,x as SelectedScreenHeader,g as VariantCardGridStyle,s as VariantCardListStyle};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a}from"react";import{Droppable as t,Draggable as s}from"react-beautiful-dnd";import{COLORS as n}from"../../constants/Theme.js";import{VariantCardListView as d,VariantCardGridView as i}from"./variant.js";const o=i=>{let{selectedVariants:o,setSelectedVariants:l,selectedCollectionsDispatch:c,outOfStockAction:p}=i;const[g,b]=a(-1);function f(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e(t,Object.assign({droppableId:"droppable-list"},{children:(a,t)=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign({backgroundColor:n.surface.subdued,padding:"0.05px",height:o.length<8?"550px":"100%",overflow:"auto"},a.droppableProps.style)},{children:[o.map(((r,a)=>e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px",boxShadow:a===g?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>b(a),onMouseLeave:()=>b(-1)},{children:e(s,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:a},{children:(t,s)=>e("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{style:f(Object.assign(Object.assign({},t.draggableProps.style),t.draggableSnapshot))},{children:e(d,{data:r,selectedCollectionsDispatch:c,onDelete:()=>{const e=o.slice();e[a].displayOrder=null,e.splice(a,1),l(e)},outOfStockAction:p},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),a.placeholder&&t.isDraggingOver?e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px"}},{children:a.placeholder})):null]}))}))},l=a=>{let{selectedVariants:n}=a;return e(t,Object.assign({droppableId:"droppable-horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex"})},{children:[e(t,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[n.map(((a,t)=>e(s,Object.assign({draggableId:`${a.productId}-${a.variantId}`,index:t},{children:(t,s)=>r("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{children:[e(i,{data:a}),t.placeholder]}))}),`${a.productId}-${a.variantId}`))),a.placeholder]}))})),a.placeholder]}))}))};export{l as VariantsGrid,o as VariantsList};
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useState as a}from"react";import{Droppable as t,Draggable as s}from"react-beautiful-dnd";import{COLORS as n}from"../../constants/Theme.js";import{VariantCardListView as d,VariantCardGridView as i}from"./variant.js";const l=i=>{let{selectedVariants:l,setSelectedVariants:o,selectedCollectionsDispatch:c,outOfStockAction:p}=i;const[g,b]=a(-1);function f(e){if(null==e?void 0:e.transform){const r=`translate(0px, ${e.transform.split(",").pop()}`;return Object.assign(Object.assign({},e),{transform:r})}return e}return e(t,Object.assign({droppableId:"droppable-list"},{children:(a,t)=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign({backgroundColor:n.surface.subdued,padding:"0.05px",height:l.length<8?"550px":"100%"},a.droppableProps.style)},{children:[l.map(((r,a)=>e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px",boxShadow:a===g?"0px 4px 12px rgba(0, 0, 0, 0.12)":""},onMouseEnter:()=>b(a),onMouseLeave:()=>b(-1)},{children:e(s,Object.assign({draggableId:`${r.productId}-${r.variantId}`,index:a},{children:(t,s)=>e("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{style:f(Object.assign(Object.assign({},t.draggableProps.style),t.draggableSnapshot))},{children:e(d,{data:r,selectedCollectionsDispatch:c,onDelete:()=>{const e=l.slice();e[a].displayOrder=null,e.splice(a,1),o(e)},outOfStockAction:p},`${r.productId}-${r.variantId}`)}))}),`${r.productId}-${r.variantId}`)}),`${r.productId}-${r.variantId}`))),a.placeholder&&t.isDraggingOver?e("div",Object.assign({style:{background:n.surface.hovered,margin:"5px"}},{children:a.placeholder})):null]}))}))},o=a=>{let{selectedVariants:n}=a;return e(t,Object.assign({droppableId:"droppable-horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex"})},{children:[e(t,Object.assign({droppableId:"droppable-vertical",direction:"horizontal"},{children:a=>r("div",Object.assign({},a.droppableProps,{ref:a.innerRef,style:Object.assign(Object.assign({},a.droppableProps.style),{display:"flex",flexWrap:"wrap",flexDirection:"row"})},{children:[n.map(((a,t)=>e(s,Object.assign({draggableId:`${a.productId}-${a.variantId}`,index:t},{children:(t,s)=>r("div",Object.assign({ref:t.innerRef},t.draggableProps,t.dragHandleProps,{children:[e(i,{data:a}),t.placeholder]}))}),`${a.productId}-${a.variantId}`))),a.placeholder]}))})),a.placeholder]}))}))};export{o as VariantsGrid,l as VariantsList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.456-beta.ppi-9",
3
+ "version": "0.0.456",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",