@bikdotai/bik-component-library 0.0.460-beta.ppi-2 → 0.0.460
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/variant.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../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,{
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{const{customCollectionRestriction:a,selectedCollections:h,searchedCollections:p,searchedCollectionsDispatch:v,selectedCollectionsDispatch:C,setScreen:j,collections:y,onBackPress:k,hideVariantCheckbox:x,pickerType:b,hideProductVariants:S,hideProductCheckbox:P,storeId:m,fbStatusFetcher:f,setCollectionId:I,setSelectedCollectionId:g,hideCollectionCheckbox:q,renderWithoutModal:O}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=p.products)&&void 0!==e?e:{},m,v,f,"setProducts")}),[null==p?void 0:p.products]);const D=!!a&&(null==h?void 0:h.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{j("collections"),k()}}),e.jsx(i.BodyCaption,{children:"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==p?void 0:p.products).length||Object.keys(null==p?void 0:p.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.collections).map((t=>e.jsx(c.CollectionCard,{customCollectionRestriction:a,data:null==y?void 0:y[t],isDisabled:D&&!(null==h?void 0:h[t]),isChecked:!!(null==h?void 0:h[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==y?void 0:y[t],h),selectedCollectionsDispatch:C,setCollectionId:I,setSelectedCollectionId:g,setScreen:j,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:h,renderWithoutModal:O,pickerType:b,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==p?void 0:p.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,i,c;let s=!1;return(null===(l=null==p?void 0:p.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const i=n.liftTheStateUp(o,null===(l=null==p?void 0:p.products)||void 0===l?void 0:l[e]);C({type:t,data:Object.assign(Object.assign({},i),{isRestricted:a})})})(t,e,o),productId:o,data:(null===(i=null==p?void 0:p.products)||void 0===i?void 0:i[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,h,null===(c=p.products)||void 0===c?void 0:c[t]),selectedData:h,selectedCollectionsDispatch:C,viewOnly:s,hideProductCheckbox:P,hideVariantCheckbox:x,hideProductVariants:S,pickerType:b},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),i=require("../../assets/icons/drag_handle.svg.js"),r=require("../../constants/Theme.js"),a=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),i=require("../../assets/icons/drag_handle.svg.js"),r=require("../../constants/Theme.js"),a=require("../icon-button/IconButton.js"),s=require("../shimmer-image/ShimmerImage.js"),o=require("../TypographyStyle.js"),n=require("./collectionScreen.js"),c=require("./ProductPickerTag.js"),l=require("./style.js"),d=require("../tooltips/Tooltip.js");exports.VariantCardGridView=t=>{const{data:i}=t;return e.jsx(l.VariantCardGridStyle,{children:e.jsx(d.Tooltip,Object.assign({body:i.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(s.ShimmerImage,{width:72,height:72,imageUrl:i.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=u=>{const{data:m,selectedCollectionsDispatch:h,outOfStockAction:j}=u,g=e=>{let t;return t=m.name.includes(m.productName)?m.name:`${m.productName} ${m.name}`,e?n.truncate(t,34,!0):t};return e.jsxs(l.VariantCardListStyle,{children:[e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(i.default,{width:24,height:24,color:r.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(s.ShimmerImage,{width:40,height:40,imageUrl:m.image,alt:"Item",borderRadius:4},m.variantId)}),e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(d.Tooltip,Object.assign({body:g(!1),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(o.TitleRegular,{children:g(!0)})})),e.jsx(c.ProductPickerTag,{isVariant:!0,data:m,outOfStockAction:j})]}))]})),e.jsx(a.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:r.COLORS.content.placeholder}),onClick:()=>{h&&h({type:"variantUnselected",data:{productId:m.productId,variantId:m.variantId,collectionId:m.collectionId}}),u.onDelete&&u.onDelete()}})]})};
|
|
@@ -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
|
|
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 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{const{customCollectionRestriction:C,selectedCollections:k,searchedCollections:y,searchedCollectionsDispatch:b,selectedCollectionsDispatch:f,setScreen:j,collections:I,onBackPress:P,hideVariantCheckbox:S,pickerType:x,hideProductVariants:O,hideProductCheckbox:g,storeId:D,fbStatusFetcher:T,setCollectionId:V,setSelectedCollectionId:w,hideCollectionCheckbox:R,renderWithoutModal:W}=m;i((()=>{var e;a(null!==(e=y.products)&&void 0!==e?e:{},D,b,T,"setProducts")}),[null==y?void 0:y.products]);const B=!!C&&(null==k?void 0:k.isCustom);return e("div",{children:[e(u,{children:[o(c,{Icon:l,onClick:()=>{j("collections"),P()}}),o(d,{children:"Searched Products"})]}),o("div",{children:Object.keys(null==y?void 0:y.products).length||Object.keys(null==y?void 0:y.collections).length?e(t,{children:[o(t,{children:Object.keys(null==y?void 0:y.collections).map((e=>o(s,{customCollectionRestriction:C,data:null==I?void 0:I[e],isDisabled:B&&!(null==k?void 0:k[e]),isChecked:!!(null==k?void 0:k[e]),isPartiallyChecked:p(e,null==I?void 0:I[e],k),selectedCollectionsDispatch:f,setCollectionId:V,setSelectedCollectionId:w,setScreen:j,id:e,hideCollectionCheckbox:R||"-1"===e,selectedCollections:k,renderWithoutModal:W,pickerType:x,usedInSearch:!0},e)))}),o(t,{children:Object.keys(null==y?void 0:y.products).map((e=>{var t,l;return Object.keys((null===(l=null===(t=null==y?void 0:y.products)||void 0===t?void 0:t[e])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let d=!1;return(null===(l=null==y?void 0:y.products)||void 0===l?void 0:l.isCustom)&&(d=!0),o(n,{collectionId:e,upliftAdditions:(o,t)=>((e,o,t)=>{var l;const i=v(t,null===(l=null==y?void 0:y.products)||void 0===l?void 0:l[e]);f({type:o,data:Object.assign(Object.assign({},i),{isRestricted:C})})})(e,o,t),productId:t,data:(null===(i=null==y?void 0:y.products)||void 0===i?void 0:i[e].products)[t],isProductPartiallyChecked:h(e,t,k,null===(c=y.products)||void 0===c?void 0:c[e]),selectedData:k,selectedCollectionsDispatch:f,viewOnly:d,hideProductCheckbox:g,hideVariantCheckbox:S,hideProductVariants:O,pickerType:x},t)}))}))})]}):o(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import i from"../../assets/icons/drag_handle.svg.js";import{COLORS as r}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as c}from"../TypographyStyle.js";import{
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import i from"../../assets/icons/drag_handle.svg.js";import{COLORS as r}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as c}from"../TypographyStyle.js";import{truncate as s}from"./collectionScreen.js";import{ProductPickerTag as l}from"./ProductPickerTag.js";import{VariantCardListStyle as m,VariantCardGridStyle as d}from"./style.js";import{Tooltip as h}from"../tooltips/Tooltip.js";const p=d=>{const{data:p,selectedCollectionsDispatch:g,outOfStockAction:u}=d,j=t=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,t?s(e,34,!0):e};return t(m,{children:[t("div",Object.assign({className:"text-container"},{children:[e(i,{width:24,height:24,color:r.content.placeholder}),e("div",{children:e(n,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(h,Object.assign({body:j(!1),placement:"bottom",delay:400,variant:"light"},{children:e(c,{children:j(!0)})})),e(l,{isVariant:!0,data:p,outOfStockAction:u})]}))]})),e(a,{Icon:()=>e(o,{width:24,height:24,color:r.content.placeholder}),onClick:()=>{g&&g({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),d.onDelete&&d.onDelete()}})]})},g=t=>{const{data:o}=t;return e(d,{children:e(h,Object.assign({body:o.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(n,{width:72,height:72,imageUrl:o.image,alt:"Item",borderRadius:4})}))})};export{g as VariantCardGridView,p as VariantCardListView};
|