@bikdotai/bik-component-library 0.0.454-beta.ppi-13 → 0.0.454-beta.ppi-15
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"),s=require("react"),i=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,s)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."},h=s=>{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}=s;console.log("collection card props",{id:y,props:s});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(i.CheckBox,{isDisabled:m,isChecked:g,isPartiallyChecked:j,onValueChange:function(e,t,s){null==s||s.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},{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:i,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=s.useRef(null),f=s.useRef(x.curPage),S=!!i&&(null==u?void 0:u.isCustom),[O,I]=s.useState(!1),E=s.useRef(!1);s.useEffect((()=>{f.current=x.curPage}),[x.curPage]),s.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,s;let i=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 s=null===(t=l[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>i+=1))}));const r=null===(s=u[e])||void 0===s?void 0:s.products;return r&&Object.keys(r).forEach((e=>{var t;const s=null===(t=r[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>o+=1))})),!(i<=0&&o>0)&&(o>0&&i!==o)}return!1};return e.jsxs("div",{children:[Object.keys(c).length?Object.keys(c).map((t=>e.jsx(h,{customCollectionRestriction:i,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,6,7,8,9,10].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s))):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,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(l.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s)))]})},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"),o=require("../../assets/icons/arrow_left.svg.js"),t=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),d=require("./emptyState.js"),r=require("./productScreen.js"),s=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{const{customCollectionRestriction:a,selectedCollections:v,searchedCollections:h,searchedCollectionsDispatch:p,selectedCollectionsDispatch:j,setScreen:C,collections:y,onBackPress:k,hideVariantCheckbox:b,pickerType:x,hideProductVariants:f,hideProductCheckbox:S,storeId:O,fbStatusFetcher:m,setCollectionId:P,setSelectedCollectionId:I,hideCollectionCheckbox:g,renderWithoutModal:q}=u;t.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=h.products)&&void 0!==e?e:{},O,p,m,"setProducts")}),[null==h?void 0:h.products]);const E=!!a&&(null==v?void 0:v.isCustom),D=e=>{var o,t;let l=0,i=0;if(v[e]){const c=null===(o=y[e])||void 0===o?void 0:o.products;c&&Object.keys(c).forEach((e=>{var o;const t=null===(o=c[e])||void 0===o?void 0:o.variants;t&&Object.keys(t).forEach((e=>l+=1))}));const d=null===(t=v[e])||void 0===t?void 0:t.products;return d&&Object.keys(d).forEach((e=>{var o;const t=null===(o=d[e])||void 0===o?void 0:o.variants;t&&Object.keys(t).forEach((e=>i+=1))})),!(l<=0&&i>0)&&(i>0&&l!==i)}return!1},F=(e,o)=>{var t,l,i,c,d,r,s,n,u;let a=0,h=0;return!!((null===(l=null===(t=null==v?void 0:v[e])||void 0===t?void 0:t.products)||void 0===l?void 0:l[o])&&(null===(r=Object.keys((null===(d=null===(c=null===(i=null==y?void 0:y[e])||void 0===i?void 0:i.products)||void 0===c?void 0:c[o])||void 0===d?void 0:d.variants)||[]))||void 0===r||r.forEach((()=>h++)),Object.keys((null===(u=null===(n=null===(s=null==v?void 0:v[e])||void 0===s?void 0:s.products)||void 0===n?void 0:n[o])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&h!==a))};return e.jsxs("div",{children:[e.jsxs(s.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:o.default,onClick:()=>{C("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((o=>{var t;return e.jsx(c.CollectionCard,{customCollectionRestriction:a,data:null===(t=null==h?void 0:h.collections)||void 0===t?void 0:t[o],isDisabled:E&&!(null==v?void 0:v[o]),isChecked:!!(null==v?void 0:v[o]),isPartiallyChecked:D(o),selectedCollectionsDispatch:j,setCollectionId:P,setSelectedCollectionId:I,setScreen:C,id:o,hideCollectionCheckbox:g||"-1"===o,selectedCollections:v,renderWithoutModal:q,pickerType:x,usedInSearch:!0},o)}))}),e.jsx(e.Fragment,{children:Object.keys(null==h?void 0:h.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==h?void 0:h.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==h?void 0:h.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e.jsx(r.ProductGroup,{collectionId:o,upliftAdditions:(e,t)=>((e,o,t)=>{var l;const i=n.liftTheStateUp(t,null===(l=null==h?void 0:h.products)||void 0===l?void 0:l[e]);j({type:o,data:Object.assign(Object.assign({},i),{isRestricted:a})})})(o,e,t),productId:t,data:(null===(i=null==h?void 0:h.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:F(o,t),selectedData:v,selectedCollectionsDispatch:j,viewOnly:c,hideProductCheckbox:S,hideVariantCheckbox:b,hideProductVariants:f,pickerType:x},t)}))}))})]}):e.jsx(d.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 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
|
|
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 b,CollectionNameHolder as v}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:b,pagingControls:v,storeId:y,setSaveDisabled:f,hideCollectionCheckbox:j,renderWithoutModal:x,pickerType:O}=o,I=c(null),S=c(v.curPage),E=!!i&&(null==u?void 0:u.isCustom),[T,D]=s(!1),P=c(!1);l((()=>{S.current=v.curPage}),[v.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=>{b({type:"paged",data:(null==e?void 0:e.collections)||{}}),v.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,6,7,8,9,10].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;console.log("collection card props",{id:x,props: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(b,{children:t(h,Object.assign({body:l.name,placement:"bottom",delay:400},{children:e(v,{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
|
|
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 v,liftTheStateUp as a}from"./utility.js";const p=p=>{const{customCollectionRestriction:h,selectedCollections:m,searchedCollections:C,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:b,collections:f,onBackPress:j,hideVariantCheckbox:O,pickerType:S,hideProductVariants:I,hideProductCheckbox:P,storeId:x,fbStatusFetcher:g,setCollectionId:D,setSelectedCollectionId:E,hideCollectionCheckbox:T,renderWithoutModal:V}=p;i((()=>{var o;v(null!==(o=C.products)&&void 0!==o?o:{},x,k,g,"setProducts")}),[null==C?void 0:C.products]);const w=!!h&&(null==m?void 0:m.isCustom),R=o=>{var e,t;let l=0,i=0;if(m[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=m[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,u;let v=0,a=0;return!!((null===(l=null===(t=null==m?void 0:m[o])||void 0===t?void 0:t.products)||void 0===l?void 0:l[e])&&(null===(r=Object.keys((null===(d=null===(c=null===(i=null==f?void 0:f[o])||void 0===i?void 0:i.products)||void 0===c?void 0:c[e])||void 0===d?void 0:d.variants)||[]))||void 0===r||r.forEach((()=>a++)),Object.keys((null===(u=null===(n=null===(s=null==m?void 0:m[o])||void 0===s?void 0:s.products)||void 0===n?void 0:n[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>v++)),v>0&&a!==v))};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==C?void 0:C.products).length&&Object.keys(null==C?void 0:C.collections).length?o(t,{children:[e(t,{children:Object.keys(null==C?void 0:C.collections).map((o=>{var t;return e(r,{customCollectionRestriction:h,data:null===(t=null==C?void 0:C.collections)||void 0===t?void 0:t[o],isDisabled:w&&!(null==m?void 0:m[o]),isChecked:!!(null==m?void 0:m[o]),isPartiallyChecked:R(o),selectedCollectionsDispatch:y,setCollectionId:D,setSelectedCollectionId:E,setScreen:b,id:o,hideCollectionCheckbox:T||"-1"===o,selectedCollections:m,renderWithoutModal:V,pickerType:S,usedInSearch:!0},o)}))}),e(t,{children:Object.keys(null==C?void 0:C.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==C?void 0:C.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==C?void 0:C.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var l;const i=a(t,null===(l=null==C?void 0:C.products)||void 0===l?void 0:l[o]);y({type:e,data:Object.assign(Object.assign({},i),{isRestricted:h})})})(o,e,t),productId:t,data:(null===(i=null==C?void 0:C.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:W(o,t),selectedData:m,selectedCollectionsDispatch:y,viewOnly:c,hideProductCheckbox:P,hideVariantCheckbox:O,hideProductVariants:I,pickerType:S},t)}))}))})]}):e(s,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{p as SearchScreen};
|