@bikdotai/bik-component-library 0.0.455-beta.ppi-7 → 0.0.455-beta.ppi-9
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/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.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=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;console.log("collection card props",{id:y,props: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"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./helpers/ProductHelper.js"),l=require("./style.js"),d=require("./utility.js"),u=require("./variantComponents.js");exports.RearrangeScreen=p=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:h,rearrangeViewType:y,outOfStockAction:f,scrollContainerRef:x,storeId:q,fbStatusFetcher:C}=p,[O,g]=r.useState(a.parseSelectedVariantsToArray(j));r.useEffect((()=>{var e;null===(e=null==x?void 0:x.current)||void 0===e||e.scrollTo({top:0})
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("react"),s=require("react-beautiful-dnd"),c=require("../../constants/Theme.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./helpers/ProductHelper.js"),l=require("./style.js"),d=require("./utility.js"),u=require("./variantComponents.js");exports.RearrangeScreen=p=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:h,rearrangeViewType:y,outOfStockAction:f,scrollContainerRef:x,storeId:q,fbStatusFetcher:C}=p,[O,g]=r.useState(a.parseSelectedVariantsToArray(j));r.useEffect((()=>{d.fetchFbStatusCollection(j,q,S,C,"update"),g(a.parseSelectedVariantsToArray(j))}),[j]),r.useEffect((()=>{var e;null===(e=null==x?void 0:x.current)||void 0===e||e.scrollTo({top:0})}),[]);return e.jsxs(s.DragDropContext,Object.assign({onDragEnd:e=>{if(!e.destination)return;const t=O,[r]=t.splice(e.source.index,1);t.splice(e.destination.index,0,r),t.forEach(((e,t)=>{e.displayOrder=t})),g(t)}},{children:[e.jsxs(l.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,width:16,height:16,color:c.COLORS.content.secondary,onClick:()=>{h("collections")}}),e.jsx(i.BodyCaption,Object.assign({color:c.COLORS.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===y?e.jsx(u.VariantsList,{selectedVariants:O,setSelectedVariants:g,selectedCollectionsDispatch:S,outOfStockAction:f}):e.jsx(u.VariantsGrid,{selectedVariants:O,setSelectedVariants:g,selectedCollectionsDispatch:S}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function t(o,t,l){if(!o)return{};const n=Object.keys(o).slice(l,l+t),d={};return n.forEach((t=>{d[t]=o[t]})),d}const l=(o,t,l)=>{Object.keys(o).forEach((t=>{var l,n;const d=null!==(n=null===(l=o[t])||void 0===l?void 0:l.products)&&void 0!==n?n:{};Object.keys(d).forEach((l=>{var n,d,i,s;const e=null!==(s=null===(i=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[l])||void 0===i?void 0:i.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,i,s,e;const v=null===(e=null===(s=null===(i=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===i?void 0:i[l])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];v&&!v.fbStatus&&(v.fbStatus="APPROVED")}))}))})),t({type:l,data:o})};exports.fetchFbStatusCollection=function(o,t,n,d){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";d||l(o,n,i);const s=(o=>{const t=[];return Object.keys(o).forEach((l=>{var n,d;const i=null!==(d=null===(n=o[l])||void 0===n?void 0:n.products)&&void 0!==d?d:{};Object.keys(i).forEach((n=>{var d,i,s,e;const v=null!==(e=null===(s=null===(i=null===(d=o[l])||void 0===d?void 0:d.products)||void 0===i?void 0:i[n])||void 0===s?void 0:s.variants)&&void 0!==e?e:{};Object.keys(v).forEach((d=>{var i,s,e,v;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("lodash");function t(o,t,l){if(!o)return{};const n=Object.keys(o).slice(l,l+t),d={};return n.forEach((t=>{d[t]=o[t]})),d}const l=(o,t,l)=>{Object.keys(o).forEach((t=>{var l,n;const d=null!==(n=null===(l=o[t])||void 0===l?void 0:l.products)&&void 0!==n?n:{};Object.keys(d).forEach((l=>{var n,d,i,s;const e=null!==(s=null===(i=null===(d=null===(n=o[t])||void 0===n?void 0:n.products)||void 0===d?void 0:d[l])||void 0===i?void 0:i.variants)&&void 0!==s?s:{};Object.keys(e).forEach((n=>{var d,i,s,e;const v=null===(e=null===(s=null===(i=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===i?void 0:i[l])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[n];v&&!v.fbStatus&&(v.fbStatus="APPROVED")}))}))})),t({type:l,data:o})};exports.fetchFbStatusCollection=function(o,t,n,d){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";d||l(o,n,i);const s=(o=>{const t=[];return Object.keys(o).forEach((l=>{var n,d;const i=null!==(d=null===(n=o[l])||void 0===n?void 0:n.products)&&void 0!==d?d:{};Object.keys(i).forEach((n=>{var d,i,s,e;const v=null!==(e=null===(s=null===(i=null===(d=o[l])||void 0===d?void 0:d.products)||void 0===i?void 0:i[n])||void 0===s?void 0:s.variants)&&void 0!==e?e:{};Object.keys(v).forEach((d=>{var i,s,e,v;const c=null===(v=null===(e=null===(s=null===(i=o[l])||void 0===i?void 0:i.products)||void 0===s?void 0:s[n])||void 0===e?void 0:e.variants)||void 0===v?void 0:v[d];(null==c?void 0:c.fbStatus)||t.push(d)}))}))})),t})(o);console.log("vj: variantids",s),s.length>0&&d&&d(t,s).then((t=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var n,d;const i=null!==(d=null===(n=l[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};Object.keys(i).forEach((n=>{var d,i,s,e;const v=null!==(e=null===(s=null===(i=null===(d=l[o])||void 0===d?void 0:d.products)||void 0===i?void 0:i[n])||void 0===s?void 0:s.variants)&&void 0!==e?e:{};Object.keys(v).forEach((d=>{var i,s,e,v;const c=null===(v=null===(e=null===(s=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===s?void 0:s[n])||void 0===e?void 0:e.variants)||void 0===v?void 0:v[d];c&&"REJECTED"===t[d]?c.fbStatus="REJECTED":c&&"APPROVED"===t[d]&&(c.fbStatus="APPROVED")}))}))})),console.log("updated data",l,i),n({type:i,data:l})})).catch((t=>{console.error("Error in fbStatusFetcher",t),l(o,n,i)}))},exports.getVariantIdsToFetchAtProductLevel=(o,t)=>{const l=[];return Object.keys(null!=o?o:{}).forEach((n=>{var d,i;const s=null!==(i=null===(d=null==o?void 0:o[n])||void 0===d?void 0:d.variants)&&void 0!==i?i:{};Object.keys(s).forEach((d=>{var i,s,e,v,c;let a;a=t?null===(e=null===(s=null===(i=null==t?void 0:t.products)||void 0===i?void 0:i[n])||void 0===s?void 0:s.variants)||void 0===e?void 0:e[d]:null===(c=null===(v=null==o?void 0:o[n])||void 0===v?void 0:v.variants)||void 0===c?void 0:c[d],(null==a?void 0:a.fbStatus)||l.push(d)}))})),l},exports.liftTheStateUp=(t,l)=>{const n=o.cloneDeep(l);if(delete n.products,(t=Object.assign(Object.assign({},t),{catalogOnlyData:n})).productId&&l.products){const d=o.cloneDeep(l.products[t.productId]);(null==d?void 0:d.variants)&&delete d.variants,t=Object.assign(Object.assign({},t),{catalogOnlyData:n,productOnlyData:d})}return t},exports.markVariantsAsApprovedProductsLevel=(o,t,l,n,d)=>{const i=Object.assign({},o);Object.keys(o).forEach((t=>{var l,n;Object.keys(null!==(n=null===(l=null==o?void 0:o[t])||void 0===l?void 0:l.variants)&&void 0!==n?n:{}).forEach((l=>{var n,d;const s=null===(n=null==o?void 0:o[t].variants)||void 0===n?void 0:n[l];s&&(s.fbStatus="APPROVED");const e=null===(d=null==i?void 0:i[t])||void 0===d?void 0:d.variants;e&&e[l]&&(e[l]=s)}))})),console.log("curscreen",{curScreenData:n,setCurScreenData:d}),n&&d?d((o=>(Object.assign({},n).products=i,o))):t({type:"productsPaged",data:{collectionId:l,products:i}})},exports.paginateSelectedItems=function(o,l,n){var d;const i={};let s=0;console.log("paginated offset",n);for(const e in o)if(Object.prototype.hasOwnProperty.call(o,e)){const v=o[e],c=t(v.products,l,n-s);c&&Object.keys(c).length>0&&(i[e]=Object.assign(Object.assign({},v),{products:c})),s+=Object.keys(null!==(d=v.products)&&void 0!==d?d:{}).length}return i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=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:r}=t;return e.jsx(l.VariantCardGridStyle,{children:e.jsx(d.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(s.ShimmerImage,{width:72,height:72,imageUrl:r.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.jsx(r.default,{width:24,height:24,color:i.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:i.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 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 l,useEffect as s}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]=l(!1),P=c(!1);s((()=>{S.current=b.curPage}),[b.curPage]),s((()=>{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 l=null===(t=n[e])||void 0===t?void 0:t.products;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=>i+=1))}));const s=null===(o=u[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=>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:l,data:s,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:s,isRestricted:l}}),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:s,isRestricted:l}}:{type:"unselected",data:{id:x}}),f(e?x:"")}}),t(v,{children:t(h,Object.assign({body:s.name,placement:"bottom",delay:400,variant:"light"},{children:e(b,{children:[t(D?u:p,{children:y(s.name,40,!0)}),s.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 t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as c}from"react-beautiful-dnd";import{COLORS as i}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as a}from"./emptyState.js";import{parseSelectedVariantsToArray as d}from"./helpers/ProductHelper.js";import{SelectedScreenHeader as p}from"./style.js";import{fetchFbStatusCollection as m}from"./utility.js";import{VariantsList as u,VariantsGrid as f}from"./variantComponents.js";const h=h=>{const{selectedCollections:j,selectedCollectionsDispatch:y,setScreen:S,rearrangeViewType:g,outOfStockAction:b,scrollContainerRef:C,storeId:O,fbStatusFetcher:v}=h,[V,k]=r(d(j));s((()=>{var t;null===(t=null==C?void 0:C.current)||void 0===t||t.scrollTo({top:0})
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as c}from"react-beautiful-dnd";import{COLORS as i}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as a}from"./emptyState.js";import{parseSelectedVariantsToArray as d}from"./helpers/ProductHelper.js";import{SelectedScreenHeader as p}from"./style.js";import{fetchFbStatusCollection as m}from"./utility.js";import{VariantsList as u,VariantsGrid as f}from"./variantComponents.js";const h=h=>{const{selectedCollections:j,selectedCollectionsDispatch:y,setScreen:S,rearrangeViewType:g,outOfStockAction:b,scrollContainerRef:C,storeId:O,fbStatusFetcher:v}=h,[V,k]=r(d(j));s((()=>{m(j,O,y,v,"update"),k(d(j))}),[j]),s((()=>{var t;null===(t=null==C?void 0:C.current)||void 0===t||t.scrollTo({top:0})}),[]);return t(c,Object.assign({onDragEnd:t=>{if(!t.destination)return;const e=V,[o]=e.splice(t.source.index,1);e.splice(t.destination.index,0,o),e.forEach(((t,e)=>{t.displayOrder=e})),k(e)}},{children:[t(p,{children:[e(n,{Icon:o,width:16,height:16,color:i.content.secondary,onClick:()=>{S("collections")}}),e(l,Object.assign({color:i.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===g?e(u,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:y,outOfStockAction:b}):e(f,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:y}):e(a,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};export{h as RearrangeScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cloneDeep as o}from"lodash";const t=(t,
|
|
1
|
+
import{cloneDeep as o}from"lodash";const t=(t,n)=>{const l=o(n);if(delete l.products,(t=Object.assign(Object.assign({},t),{catalogOnlyData:l})).productId&&n.products){const d=o(n.products[t.productId]);(null==d?void 0:d.variants)&&delete d.variants,t=Object.assign(Object.assign({},t),{catalogOnlyData:l,productOnlyData:d})}return t};function n(o,t,n){var d;const i={};let v=0;console.log("paginated offset",n);for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const c=o[s],a=l(c.products,t,n-v);a&&Object.keys(a).length>0&&(i[s]=Object.assign(Object.assign({},c),{products:a})),v+=Object.keys(null!==(d=c.products)&&void 0!==d?d:{}).length}return i}function l(o,t,n){if(!o)return{};const l=Object.keys(o).slice(n,n+t),d={};return l.forEach((t=>{d[t]=o[t]})),d}const d=(o,t,n)=>{Object.keys(o).forEach((t=>{var n,l;const d=null!==(l=null===(n=o[t])||void 0===n?void 0:n.products)&&void 0!==l?l:{};Object.keys(d).forEach((n=>{var l,d,i,v;const s=null!==(v=null===(i=null===(d=null===(l=o[t])||void 0===l?void 0:l.products)||void 0===d?void 0:d[n])||void 0===i?void 0:i.variants)&&void 0!==v?v:{};Object.keys(s).forEach((l=>{var d,i,v,s;const c=null===(s=null===(v=null===(i=null===(d=o[t])||void 0===d?void 0:d.products)||void 0===i?void 0:i[n])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[l];c&&!c.fbStatus&&(c.fbStatus="APPROVED")}))}))})),t({type:n,data:o})},i=function(o,t,n,l){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";l||d(o,n,i);const v=(o=>{const t=[];return Object.keys(o).forEach((n=>{var l,d;const i=null!==(d=null===(l=o[n])||void 0===l?void 0:l.products)&&void 0!==d?d:{};Object.keys(i).forEach((l=>{var d,i,v,s;const c=null!==(s=null===(v=null===(i=null===(d=o[n])||void 0===d?void 0:d.products)||void 0===i?void 0:i[l])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(c).forEach((d=>{var i,v,s,c;const a=null===(c=null===(s=null===(v=null===(i=o[n])||void 0===i?void 0:i.products)||void 0===v?void 0:v[l])||void 0===s?void 0:s.variants)||void 0===c?void 0:c[d];(null==a?void 0:a.fbStatus)||t.push(d)}))}))})),t})(o);console.log("vj: variantids",v),v.length>0&&l&&l(t,v).then((t=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var n,d;const i=null!==(d=null===(n=l[o])||void 0===n?void 0:n.products)&&void 0!==d?d:{};Object.keys(i).forEach((n=>{var d,i,v,s;const c=null!==(s=null===(v=null===(i=null===(d=l[o])||void 0===d?void 0:d.products)||void 0===i?void 0:i[n])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(c).forEach((d=>{var i,v,s,c;const a=null===(c=null===(s=null===(v=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===v?void 0:v[n])||void 0===s?void 0:s.variants)||void 0===c?void 0:c[d];a&&"REJECTED"===t[d]?a.fbStatus="REJECTED":a&&"APPROVED"===t[d]&&(a.fbStatus="APPROVED")}))}))})),console.log("updated data",l,i),n({type:i,data:l})})).catch((t=>{console.error("Error in fbStatusFetcher",t),d(o,n,i)}))},v=(o,t)=>{const n=[];return Object.keys(null!=o?o:{}).forEach((l=>{var d,i;const v=null!==(i=null===(d=null==o?void 0:o[l])||void 0===d?void 0:d.variants)&&void 0!==i?i:{};Object.keys(v).forEach((d=>{var i,v,s,c,a;let r;r=t?null===(s=null===(v=null===(i=null==t?void 0:t.products)||void 0===i?void 0:i[l])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[d]:null===(a=null===(c=null==o?void 0:o[l])||void 0===c?void 0:c.variants)||void 0===a?void 0:a[d],(null==r?void 0:r.fbStatus)||n.push(d)}))})),n},s=(o,t,n,l,d)=>{const i=Object.assign({},o);Object.keys(o).forEach((t=>{var n,l;Object.keys(null!==(l=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.variants)&&void 0!==l?l:{}).forEach((n=>{var l,d;const v=null===(l=null==o?void 0:o[t].variants)||void 0===l?void 0:l[n];v&&(v.fbStatus="APPROVED");const s=null===(d=null==i?void 0:i[t])||void 0===d?void 0:d.variants;s&&s[n]&&(s[n]=v)}))})),console.log("curscreen",{curScreenData:l,setCurScreenData:d}),l&&d?d((o=>(Object.assign({},l).products=i,o))):t({type:"productsPaged",data:{collectionId:n,products:i}})};export{i as fetchFbStatusCollection,v as getVariantIdsToFetchAtProductLevel,t as liftTheStateUp,s as markVariantsAsApprovedProductsLevel,n as paginateSelectedItems};
|
|
@@ -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{truncate as
|
|
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 l}from"./collectionScreen.js";import{ProductPickerTag as m}from"./ProductPickerTag.js";import{VariantCardListStyle as s,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?l(e,34,!0):e};return t(s,{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(m,{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};
|