@bikdotai/bik-component-library 0.0.455-beta.ppi-18 → 0.0.455-beta.ppi-20
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/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),s=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),l=require("../shimmer/ShimmerComponent/BikShimmer.js"),c=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),d=require("./emptyState.js"),a=require("./style.js");const u=(e,t,i)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(i?s.slice(0,s.lastIndexOf(" ")):s)+"..."},h=i=>{const{customCollectionRestriction:l,data:d,selectedCollectionsDispatch:h,setCollectionId:p,setSelectedCollectionId:C,isPartiallyChecked:j,setScreen:x,id:y,isChecked:g,isDisabled:m,hideCollectionCheckbox:v,pickerType:b,selectedCollections:k,usedInSearch:f}=i;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:m,onClick:e=>{if(!m){if("COLLECTION"===b)return e.stopPropagation(),h({type:"reset",data:{}}),h({type:"selected",data:{id:y,val:d,isRestricted:l}}),void p(y);p(y),x("products")}},isActive:!!k[y],usedInSearch:null!=f&&f},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!v&&e.jsx(s.CheckBox,{isDisabled:m,isChecked:g,isPartiallyChecked:j,onValueChange:function(e,t,i){null==i||i.stopPropagation(),h(e?{type:"selected",data:{id:y,val:d,isRestricted:l}}:{type:"unselected",data:{id:y}}),C(e?y:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsx(r.Tooltip,Object.assign({body:d.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(a.CollectionNameHolder,{children:[f?e.jsx(n.BodyPrimary,{children:u(d.name,40,!0)}):e.jsx(n.TitleRegular,{children:u(d.name,40,!0)}),d.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==b&&e.jsx(o.IconButton,{height:12,width:12,disabled:m,Icon:t.default})]}))};exports.CollectionCard=h,exports.CollectionsScreen=t=>{const{customCollectionRestriction:s,dataLoading:o,collections:c,selectedCollectionsDispatch:r,setCollectionId:n,setSelectedCollectionId:a,selectedCollections:u,setScreen:p,collectionFetcher:C,collectionsDispatch:j,pagingControls:x,storeId:y,setSaveDisabled:g,hideCollectionCheckbox:m,renderWithoutModal:v,pickerType:b}=t,k=i.useRef(null),f=i.useRef(x.curPage),S=!!s&&(null==u?void 0:u.isCustom),[O,I]=i.useState(!1),E=i.useRef(!1);i.useEffect((()=>{f.current=x.curPage}),[x.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&f.current>0&&!E.current&&(g(!0),I(!0),C(f.current,y).then((e=>{j({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(f.current+1),I(!1),g(!1),Object.keys(e).length||(E.current=!0)})).catch())}),{threshold:1});return k.current&&e.observe(k.current),()=>{k.current&&e.unobserve(k.current)}}),[k]);const T=e=>{var t,i;let s=0,o=0;if(u[e]){const l=null===(t=c[e])||void 0===t?void 0:t.products;l&&Object.keys(l).forEach((e=>{var t;const i=null===(t=l[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>s+=1))}));const r=null===(i=u[e])||void 0===i?void 0:i.products;return r&&Object.keys(r).forEach((e=>{var t;const i=null===(t=r[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>o+=1))})),!(s<=0&&o>0)&&(o>0&&s!==o)}return!1};return e.jsxs("div",{children:[Object.keys(c).length?Object.keys(c).map((t=>e.jsx(h,{customCollectionRestriction:s,data:c[t],isDisabled:S&&!(null==u?void 0:u[t]),isChecked:!!(null==u?void 0:u[t]),isPartiallyChecked:T(t),selectedCollectionsDispatch:r,setCollectionId:n,setSelectedCollectionId:a,setScreen:p,id:t,hideCollectionCheckbox:m||"-1"===t,selectedCollections:u,renderWithoutModal:v,pickerType:b},t))):o?[1,2,3,4,5].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i))):e.jsx(d.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:k}),O&&[1,2,3,4,5].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i)))]})},exports.truncate=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
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("./productScreen.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{const{customCollectionRestriction:a,selectedCollections:v,searchedCollections:h,searchedCollectionsDispatch:p,selectedCollectionsDispatch:C,setScreen:j,collections:y,onBackPress:k,hideVariantCheckbox:b,pickerType:x,hideProductVariants:f,hideProductCheckbox:S,storeId:P,fbStatusFetcher:O,setCollectionId:m,setSelectedCollectionId:I,hideCollectionCheckbox:g,renderWithoutModal:q}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=h.products)&&void 0!==e?e:{},P,p,O,"setProducts")}),[null==h?void 0:h.products]);const E=!!a&&(null==v?void 0:v.isCustom),D=e=>{var t,o;let l=0,i=0;if(v[e]){const c=null===(t=y[e])||void 0===t?void 0:t.products;c&&Object.keys(c).forEach((e=>{var t;const o=null===(t=c[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>l+=1))}));const s=null===(o=v[e])||void 0===o?void 0:o.products;return s&&Object.keys(s).forEach((e=>{var t;const o=null===(t=s[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))})),!(l<=0&&i>0)&&(i>0&&l!==i)}return!1},V=(e,t)=>{var o,l,i,c,s,d,r,n;let u=0,a=0;return console.log("isProductPartiallyChecked start",{collectionId:e,productId:t,selectedCollections:v,collections:y,searchedCollections:h}),!!((null===(l=null===(o=null==v?void 0:v[e])||void 0===o?void 0:o.products)||void 0===l?void 0:l[t])&&(null===(s=Object.keys((null===(c=null===(i=null==y?void 0:y.products)||void 0===i?void 0:i[t])||void 0===c?void 0:c.variants)||[]))||void 0===s||s.forEach((()=>a++)),Object.keys((null===(n=null===(r=null===(d=null==v?void 0:v[e])||void 0===d?void 0:d.products)||void 0===r?void 0:r[t])||void 0===n?void 0:n.variants)||[]).forEach((()=>u++)),console.log("isProductPartiallyChecked variants",{totalSelectedVariants:u,totalVariants:a}),u>0&&a!==u))};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==h?void 0:h.products).length||Object.keys(null==h?void 0:h.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==h?void 0:h.collections).map((t=>e.jsx(c.CollectionCard,{customCollectionRestriction:a,data:null==y?void 0:y[t],isDisabled:E&&!(null==v?void 0:v[t]),isChecked:!!(null==v?void 0:v[t]),isPartiallyChecked:D(t),selectedCollectionsDispatch:C,setCollectionId:m,setSelectedCollectionId:I,setScreen:j,id:t,hideCollectionCheckbox:g||"-1"===t,selectedCollections:v,renderWithoutModal:q,pickerType:x,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==h?void 0:h.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==h?void 0:h.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,i;let c=!1;return(null===(l=null==h?void 0:h.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const i=n.liftTheStateUp(o,null===(l=null==h?void 0:h.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==h?void 0:h.products)||void 0===i?void 0:i[t].products)[o],isProductPartiallyChecked:V(t,o),selectedData:v,selectedCollectionsDispatch:C,viewOnly:c,hideProductCheckbox:S,hideVariantCheckbox:b,hideProductVariants:f,pickerType:x},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight.svg.js";import{useRef as c,useState as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/chevronRight.svg.js";import{useRef as c,useState as s,useEffect as l}from"react";import{CheckBox as r}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BikShimmer as d}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as a}from"../tag/Tag.js";import{Tooltip as h}from"../tooltips/Tooltip.js";import{TitleRegular as p,BodyPrimary as u}from"../TypographyStyle.js";import{EmptyState as m}from"./emptyState.js";import{CollectionCardStyle as C,CollectionCardInfoStyle as g,CollectionCardDetailStyle as v,CollectionNameHolder as b}from"./style.js";const y=(e,t,o)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(o?i.slice(0,i.lastIndexOf(" ")):i)+"..."},f=o=>{const{customCollectionRestriction:i,dataLoading:r,collections:n,selectedCollectionsDispatch:a,setCollectionId:h,setSelectedCollectionId:p,selectedCollections:u,setScreen:C,collectionFetcher:g,collectionsDispatch:v,pagingControls:b,storeId:y,setSaveDisabled:f,hideCollectionCheckbox:j,renderWithoutModal:x,pickerType:O}=o,I=c(null),S=c(b.curPage),E=!!i&&(null==u?void 0:u.isCustom),[T,D]=s(!1),P=c(!1);l((()=>{S.current=b.curPage}),[b.curPage]),l((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&S.current>0&&!P.current&&(f(!0),D(!0),g(S.current,y).then((e=>{v({type:"paged",data:(null==e?void 0:e.collections)||{}}),b.setCurPage(S.current+1),D(!1),f(!1),Object.keys(e).length||(P.current=!0)})).catch())}),{threshold:1});return I.current&&e.observe(I.current),()=>{I.current&&e.unobserve(I.current)}}),[I]);const w=e=>{var t,o;let i=0,c=0;if(u[e]){const s=null===(t=n[e])||void 0===t?void 0:t.products;s&&Object.keys(s).forEach((e=>{var t;const o=null===(t=s[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))}));const l=null===(o=u[e])||void 0===o?void 0:o.products;return l&&Object.keys(l).forEach((e=>{var t;const o=null===(t=l[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>c+=1))})),!(i<=0&&c>0)&&(c>0&&i!==c)}return!1};return e("div",{children:[Object.keys(n).length?Object.keys(n).map((e=>t(k,{customCollectionRestriction:i,data:n[e],isDisabled:E&&!(null==u?void 0:u[e]),isChecked:!!(null==u?void 0:u[e]),isPartiallyChecked:w(e),selectedCollectionsDispatch:a,setCollectionId:h,setSelectedCollectionId:p,setScreen:C,id:e,hideCollectionCheckbox:j||"-1"===e,selectedCollections:u,renderWithoutModal:x,pickerType:O},e))):r?[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))):t(m,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:I}),T&&[1,2,3,4,5].map(((e,o)=>t("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:t(d,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o)))]})},k=c=>{const{customCollectionRestriction:s,data:l,selectedCollectionsDispatch:d,setCollectionId:m,setSelectedCollectionId:f,isPartiallyChecked:k,setScreen:j,id:x,isChecked:O,isDisabled:I,hideCollectionCheckbox:S,pickerType:E,selectedCollections:T,usedInSearch:D}=c;return e(C,Object.assign({isDisabled:I,onClick:e=>{if(!I){if("COLLECTION"===E)return e.stopPropagation(),d({type:"reset",data:{}}),d({type:"selected",data:{id:x,val:l,isRestricted:s}}),void m(x);m(x),j("products")}},isActive:!!T[x],usedInSearch:null!=D&&D},{children:[e(g,{children:[!S&&t(r,{isDisabled:I,isChecked:O,isPartiallyChecked:k,onValueChange:function(e,t,o){null==o||o.stopPropagation(),d(e?{type:"selected",data:{id:x,val:l,isRestricted:s}}:{type:"unselected",data:{id:x}}),f(e?x:"")}}),t(v,{children:t(h,Object.assign({body:l.name,placement:"bottom",delay:400,variant:"light"},{children:e(b,{children:[t(D?u:p,{children:y(l.name,40,!0)}),l.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(a,{tagText:"Smart Collection",type:"warning"})})):t(o,{})]})}))})]}),"COLLECTION"!==E&&t(n,{height:12,width:12,disabled:I,Icon:i})]}))};export{k as CollectionCard,f as CollectionsScreen,y as truncate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as r}from"./collectionScreen.js";import{EmptyState as s}from"./emptyState.js";import{ProductGroup as n}from"./productScreen.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as
|
|
1
|
+
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as r}from"./collectionScreen.js";import{EmptyState as s}from"./emptyState.js";import{ProductGroup as n}from"./productScreen.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,liftTheStateUp as v}from"./utility.js";const h=h=>{const{customCollectionRestriction:p,selectedCollections:C,searchedCollections:m,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:b,collections:f,onBackPress:j,hideVariantCheckbox:O,pickerType:P,hideProductVariants:I,hideProductCheckbox:S,storeId:g,fbStatusFetcher:x,setCollectionId:D,setSelectedCollectionId:E,hideCollectionCheckbox:V,renderWithoutModal:T}=h;i((()=>{var o;a(null!==(o=m.products)&&void 0!==o?o:{},g,k,x,"setProducts")}),[null==m?void 0:m.products]);const w=!!p&&(null==C?void 0:C.isCustom),R=o=>{var e,t;let l=0,i=0;if(C[o]){const c=null===(e=f[o])||void 0===e?void 0:e.products;c&&Object.keys(c).forEach((o=>{var e;const t=null===(e=c[o])||void 0===e?void 0:e.variants;t&&Object.keys(t).forEach((o=>l+=1))}));const d=null===(t=C[o])||void 0===t?void 0:t.products;return d&&Object.keys(d).forEach((o=>{var e;const t=null===(e=d[o])||void 0===e?void 0:e.variants;t&&Object.keys(t).forEach((o=>i+=1))})),!(l<=0&&i>0)&&(i>0&&l!==i)}return!1},W=(o,e)=>{var t,l,i,c,d,r,s,n;let u=0,a=0;return console.log("isProductPartiallyChecked start",{collectionId:o,productId:e,selectedCollections:C,collections:f,searchedCollections:m}),!!((null===(l=null===(t=null==C?void 0:C[o])||void 0===t?void 0:t.products)||void 0===l?void 0:l[e])&&(null===(d=Object.keys((null===(c=null===(i=null==f?void 0:f.products)||void 0===i?void 0:i[e])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>a++)),Object.keys((null===(n=null===(s=null===(r=null==C?void 0:C[o])||void 0===r?void 0:r.products)||void 0===s?void 0:s[e])||void 0===n?void 0:n.variants)||[]).forEach((()=>u++)),console.log("isProductPartiallyChecked variants",{totalSelectedVariants:u,totalVariants:a}),u>0&&a!==u))};return o("div",{children:[o(u,{children:[e(c,{Icon:l,onClick:()=>{b("collections"),j()}}),e(d,{children:"Searched Products"})]}),e("div",{children:Object.keys(null==m?void 0:m.products).length||Object.keys(null==m?void 0:m.collections).length?o(t,{children:[e(t,{children:Object.keys(null==m?void 0:m.collections).map((o=>e(r,{customCollectionRestriction:p,data:null==f?void 0:f[o],isDisabled:w&&!(null==C?void 0:C[o]),isChecked:!!(null==C?void 0:C[o]),isPartiallyChecked:R(o),selectedCollectionsDispatch:y,setCollectionId:D,setSelectedCollectionId:E,setScreen:b,id:o,hideCollectionCheckbox:V||"-1"===o,selectedCollections:C,renderWithoutModal:T,pickerType:P,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==m?void 0:m.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==m?void 0:m.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i;let c=!1;return(null===(l=null==m?void 0:m.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var l;const i=v(t,null===(l=null==m?void 0:m.products)||void 0===l?void 0:l[o]);y({type:e,data:Object.assign(Object.assign({},i),{isRestricted:p})})})(o,e,t),productId:t,data:(null===(i=null==m?void 0:m.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:W(o,t),selectedData:C,selectedCollectionsDispatch:y,viewOnly:c,hideProductCheckbox:S,hideVariantCheckbox:O,hideProductVariants:I,pickerType:P},t)}))}))})]}):e(s,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{h as SearchScreen};
|