@bikdotai/bik-component-library 0.0.439-beta.ppis-20 → 0.0.439-beta.ppis-22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("lodash");const e=require("react").createContext("");exports.CollectionIdContext=e,exports.collectionsReducer=function(t,e){let o={};switch(e.type){case"fetched":return o=Object.assign({},e.data),o;case"productsFetched":return console.log("vj: productsFetched",{collections:t,action:e}),o=Object.assign({},t),o[e.data.collectionId].products=e.data.products,console.log("vj: collectionsCopy",{collectionsCopy:o}),o;case"paged":return console.log("vj: paged",{collections:t,action:e}),o=Object.assign(Object.assign({},t),e.data),o;case"productsPaged":return console.log("vj: pagedProducts",{collections:t,action:e}),o=Object.assign({},t),e.data.collectionId,o[e.data.collectionId].products=Object.assign(Object.assign({},o[e.data.collectionId].products),e.data.products),o;default:return{}}},exports.paginationReducer=function(t,e){let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("lodash");const e=require("react").createContext("");exports.CollectionIdContext=e,exports.collectionsReducer=function(t,e){let o={};switch(e.type){case"fetched":return o=Object.assign({},e.data),o;case"productsFetched":return console.log("vj: productsFetched",{collections:t,action:e}),o=Object.assign({},t),o[e.data.collectionId].products=e.data.products,console.log("vj: collectionsCopy",{collectionsCopy:o}),o;case"paged":return console.log("vj: paged",{collections:t,action:e}),o=Object.assign(Object.assign({},t),e.data),o;case"productsPaged":return console.log("vj: pagedProducts",{collections:t,action:e}),o=Object.assign({},t),e.data.collectionId,o[e.data.collectionId].products=Object.assign(Object.assign({},o[e.data.collectionId].products),e.data.products),o;default:return{}}},exports.paginationReducer=function(t,e){var o,c,a,s,l,d;let n={};switch(console.log("vj: selected Items",t),e.type){case"paginate":console.log("vj: paginate",e),n=Object.assign({},t);for(const t in e.data)if(Object.prototype.hasOwnProperty.call(e.data,t)){const o=e.data[t];if(Object.prototype.hasOwnProperty.call(n,t)){const e=n[t];n[t]=Object.assign(Object.assign({},e),{products:Object.assign(Object.assign({},e.products),o.products)})}else n[t]=o}return console.log("vj: collections copy",n),n;case"update":return console.log("vj: update",e),n=Object.assign({},t),console.log("vj: update collection",e),n;case"set":return n=Object.assign(Object.assign({},t),e.data),console.log("vj: update collection",e),n;case"filter":n=Object.assign({},t);for(const t in n)if(t in n){const i=n[t],r=e.data[t],u={};console.log("filter collection",{collection:i,selectedCollection:r});for(const e in i.products)if(e in i.products)if(e in(null!==(o=null==r?void 0:r.products)&&void 0!==o?o:{})){const t=i.products[e],o={};for(const l in t.variants)if(l in t.variants){void 0!==(null===(s=null===(a=null===(c=null==r?void 0:r.products)||void 0===c?void 0:c[e])||void 0===a?void 0:a.variants)||void 0===s?void 0:s[l])&&(o[l]=t.variants[l])}Object.keys(o).length>0&&(u[e]=Object.assign(Object.assign({},t),{variants:o}))}else null===(d=null===(l=null==n?void 0:n[t])||void 0===l?void 0:l.products)||void 0===d||delete d[e];n[t]=Object.assign(Object.assign({},i),{products:u})}return n;default:return t}},exports.selectedColectionsReducer=function(e,o){var c,a,s,l,d,n;let i={},r="",u="",p="";switch(console.log("vj: selected Items",e),o.type){case"selected":return console.log("vj: selectedColectionsReducer selected",o),i=t.cloneDeep(e),o.data.val.isSmartCollection&&(o.data.isRestricted&&(i={}),i.isCustom=!0),i[o.data.id]=o.data.val,i;case"unselected":return i=t.cloneDeep(e),(null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[o.data.id],i;case"productUnselected":return i=t.cloneDeep(e),r=o.data.productId,u=o.data.collectionId,delete i[u].products[r],Object.keys(i[u].products).length||((null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[u]),i;case"productSelected":return i=t.cloneDeep(e),r=o.data.productId,u=o.data.collectionId,(null===(c=o.data.catalogOnlyData)||void 0===c?void 0:c.isSmartCollection)&&(o.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[u])||(i[u]=o.data.catalogOnlyData,i[u].products={}),i[u].products[r]=o.data.product,i;case"variantSelected":return i=t.cloneDeep(e),r=o.data.productId,u=o.data.collectionId,p=o.data.variantId,(null===(a=o.data.catalogOnlyData)||void 0===a?void 0:a.isSmartCollection)&&(o.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[u])||(i[u]=o.data.catalogOnlyData,i[u].products={},i[u].products[r]=o.data.productOnlyData,i[u].products[r].variants={}),(null===(l=null===(s=null==i?void 0:i[u])||void 0===s?void 0:s.products)||void 0===l?void 0:l[r])||((null===(d=null==i?void 0:i[u])||void 0===d?void 0:d.products)||(i[u].products={}),i[u].products[r]=o.data.productOnlyData,i[u].products[r].variants={}),i[u].products[r].variants[p]=o.data.variant,i;case"variantUnselected":return i=t.cloneDeep(e),r=o.data.productId,u=o.data.collectionId,p=o.data.variantId,delete i[u].products[r].variants[p],Object.keys(i[u].products[r].variants).length||(delete i[u].products[r],Object.keys(i[u].products).length||((null===(n=i[u])||void 0===n?void 0:n.isSmartCollection)&&(i.isCustom=!1),delete i[u])),i;case"reset":return{};default:return e}};
|
|
@@ -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"),o=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),s=require("./emptyState.js"),n=require("./productScreen.js"),l=require("./reducers.js"),i=require("./style.js"),u=require("./useFetchFbStatus copy.js"),d=require("./utility.js");exports.SelectedScreen=a=>{const{selectedCollections:v,selectedCollectionsDispatch:p,setScreen:j,collections:f,outOfStockAction:g,storeId:S,fbStatusFetcher:h}=a,y=r.useRef(0),b=r.useRef(null),[x,q]=r.useReducer(l.paginationReducer,{});r.useEffect((()=>{y.current=0;const e=d.paginateSelectedItems(v,10,0);q({type:"paginate",data:e}),u.fetchFbStatus(e,S,q,h,!0),y.current+=1}),[]),r.useEffect((()=>{console.log("vj: curScreen Data change")}),[x]),r.useEffect((()=>{console.log("vj: observertarget",b.current);const e=new IntersectionObserver((e=>{if(console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",y.current),y.current>0)){const e=d.paginateSelectedItems(v,10,y.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:v,curScreenData:x}),q({type:"paginate",data:e}),u.fetchFbStatus(e,S,q,h),y.current+=1}}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b]);const I=(e,t)=>{var r,o,c,s,n,l,i,u,d;let a=0,p=0;return!!((null===(o=null===(r=null==v?void 0:v[e])||void 0===r?void 0:r.products)||void 0===o?void 0:o[t])&&(null===(l=Object.keys((null===(n=null===(s=null===(c=null==f?void 0:f[e])||void 0===c?void 0:c.products)||void 0===s?void 0:s[t])||void 0===n?void 0:n.variants)||[]))||void 0===l||l.forEach((()=>p++)),Object.keys((null===(d=null===(u=null===(i=null==v?void 0:v[e])||void 0===i?void 0:i.products)||void 0===u?void 0:u[t])||void 0===d?void 0:d.variants)||[]).forEach((()=>a++)),a>0&&p!==a))};return e.jsxs("div",{children:[e.jsxs(i.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{j("collections")}}),e.jsx(c.BodyCaption,{children:"Selected Products"})]}),e.jsxs("div",{children:[Object.keys(x).length>0?e.jsx(e.Fragment,{children:Object.keys(x).map((t=>{var r;return Object.keys((null===(r=null==x?void 0:x[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==x?void 0:x.isCustom)&&(o=!0),e.jsx(n.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:x[t].products[r],isProductPartiallyChecked:I(t,r),selectedData:v,selectedCollectionsDispatch:p,viewOnly:o,outOfStockAction:g},r)}))}))}):e.jsx(s.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:b})]})]})};
|
|
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"),o=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),s=require("./emptyState.js"),n=require("./productScreen.js"),l=require("./reducers.js"),i=require("./style.js"),u=require("./useFetchFbStatus copy.js"),d=require("./utility.js");exports.SelectedScreen=a=>{const{selectedCollections:v,selectedCollectionsDispatch:p,setScreen:j,collections:f,outOfStockAction:g,storeId:S,fbStatusFetcher:h}=a,y=r.useRef(0),b=r.useRef(null),[x,q]=r.useReducer(l.paginationReducer,{});r.useEffect((()=>{y.current=0;const e=d.paginateSelectedItems(v,10,0);q({type:"paginate",data:e}),u.fetchFbStatus(e,S,q,h,!0),y.current+=1}),[]),r.useEffect((()=>{console.log("vj: curScreen Data change")}),[x]),r.useEffect((()=>{q({type:"filter",data:{selectedCollections:v}})}),[v]),r.useEffect((()=>{console.log("vj: observertarget",b.current);const e=new IntersectionObserver((e=>{if(console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",y.current),y.current>0)){const e=d.paginateSelectedItems(v,10,y.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:v,curScreenData:x}),q({type:"paginate",data:e}),u.fetchFbStatus(e,S,q,h),y.current+=1}}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b]);const I=(e,t)=>{var r,o,c,s,n,l,i,u,d;let a=0,p=0;return!!((null===(o=null===(r=null==v?void 0:v[e])||void 0===r?void 0:r.products)||void 0===o?void 0:o[t])&&(null===(l=Object.keys((null===(n=null===(s=null===(c=null==f?void 0:f[e])||void 0===c?void 0:c.products)||void 0===s?void 0:s[t])||void 0===n?void 0:n.variants)||[]))||void 0===l||l.forEach((()=>p++)),Object.keys((null===(d=null===(u=null===(i=null==v?void 0:v[e])||void 0===i?void 0:i.products)||void 0===u?void 0:u[t])||void 0===d?void 0:d.variants)||[]).forEach((()=>a++)),a>0&&p!==a))};return e.jsxs("div",{children:[e.jsxs(i.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{j("collections")}}),e.jsx(c.BodyCaption,{children:"Selected Products"})]}),e.jsxs("div",{children:[Object.keys(x).length>0?e.jsx(e.Fragment,{children:Object.keys(x).map((t=>{var r;return Object.keys((null===(r=null==x?void 0:x[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==x?void 0:x.isCustom)&&(o=!0),e.jsx(n.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:x[t].products[r],isProductPartiallyChecked:I(t,r),selectedData:v,selectedCollectionsDispatch:p,viewOnly:o,outOfStockAction:g},r)}))}))}):e.jsx(s.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:b})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cloneDeep as t}from"lodash";import{createContext as
|
|
1
|
+
import{cloneDeep as t}from"lodash";import{createContext as o}from"react";function e(o,e){var a,c,s,d,l,n;let i={},r="",u="",p="";switch(console.log("vj: selected Items",o),e.type){case"selected":return console.log("vj: selectedColectionsReducer selected",e),i=t(o),e.data.val.isSmartCollection&&(e.data.isRestricted&&(i={}),i.isCustom=!0),i[e.data.id]=e.data.val,i;case"unselected":return i=t(o),(null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[e.data.id],i;case"productUnselected":return i=t(o),r=e.data.productId,u=e.data.collectionId,delete i[u].products[r],Object.keys(i[u].products).length||((null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[u]),i;case"productSelected":return i=t(o),r=e.data.productId,u=e.data.collectionId,(null===(a=e.data.catalogOnlyData)||void 0===a?void 0:a.isSmartCollection)&&(e.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[u])||(i[u]=e.data.catalogOnlyData,i[u].products={}),i[u].products[r]=e.data.product,i;case"variantSelected":return i=t(o),r=e.data.productId,u=e.data.collectionId,p=e.data.variantId,(null===(c=e.data.catalogOnlyData)||void 0===c?void 0:c.isSmartCollection)&&(e.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[u])||(i[u]=e.data.catalogOnlyData,i[u].products={},i[u].products[r]=e.data.productOnlyData,i[u].products[r].variants={}),(null===(d=null===(s=null==i?void 0:i[u])||void 0===s?void 0:s.products)||void 0===d?void 0:d[r])||((null===(l=null==i?void 0:i[u])||void 0===l?void 0:l.products)||(i[u].products={}),i[u].products[r]=e.data.productOnlyData,i[u].products[r].variants={}),i[u].products[r].variants[p]=e.data.variant,i;case"variantUnselected":return i=t(o),r=e.data.productId,u=e.data.collectionId,p=e.data.variantId,delete i[u].products[r].variants[p],Object.keys(i[u].products[r].variants).length||(delete i[u].products[r],Object.keys(i[u].products).length||((null===(n=i[u])||void 0===n?void 0:n.isSmartCollection)&&(i.isCustom=!1),delete i[u])),i;case"reset":return{};default:return o}}function a(t,o){let e={};switch(o.type){case"fetched":return e=Object.assign({},o.data),e;case"productsFetched":return console.log("vj: productsFetched",{collections:t,action:o}),e=Object.assign({},t),e[o.data.collectionId].products=o.data.products,console.log("vj: collectionsCopy",{collectionsCopy:e}),e;case"paged":return console.log("vj: paged",{collections:t,action:o}),e=Object.assign(Object.assign({},t),o.data),e;case"productsPaged":return console.log("vj: pagedProducts",{collections:t,action:o}),e=Object.assign({},t),o.data.collectionId,e[o.data.collectionId].products=Object.assign(Object.assign({},e[o.data.collectionId].products),o.data.products),e;default:return{}}}function c(t,o){var e,a,c,s,d,l;let n={};switch(console.log("vj: selected Items",t),o.type){case"paginate":console.log("vj: paginate",o),n=Object.assign({},t);for(const t in o.data)if(Object.prototype.hasOwnProperty.call(o.data,t)){const e=o.data[t];if(Object.prototype.hasOwnProperty.call(n,t)){const o=n[t];n[t]=Object.assign(Object.assign({},o),{products:Object.assign(Object.assign({},o.products),e.products)})}else n[t]=e}return console.log("vj: collections copy",n),n;case"update":return console.log("vj: update",o),n=Object.assign({},t),console.log("vj: update collection",o),n;case"set":return n=Object.assign(Object.assign({},t),o.data),console.log("vj: update collection",o),n;case"filter":n=Object.assign({},t);for(const t in n)if(t in n){const i=n[t],r=o.data[t],u={};console.log("filter collection",{collection:i,selectedCollection:r});for(const o in i.products)if(o in i.products)if(o in(null!==(e=null==r?void 0:r.products)&&void 0!==e?e:{})){const t=i.products[o],e={};for(const d in t.variants)if(d in t.variants){void 0!==(null===(s=null===(c=null===(a=null==r?void 0:r.products)||void 0===a?void 0:a[o])||void 0===c?void 0:c.variants)||void 0===s?void 0:s[d])&&(e[d]=t.variants[d])}Object.keys(e).length>0&&(u[o]=Object.assign(Object.assign({},t),{variants:e}))}else null===(l=null===(d=null==n?void 0:n[t])||void 0===d?void 0:d.products)||void 0===l||delete l[o];n[t]=Object.assign(Object.assign({},i),{products:u})}return n;default:return t}}const s=o("");export{s as CollectionIdContext,a as collectionsReducer,c as paginationReducer,e as selectedColectionsReducer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as l,useEffect as n}from"react";import{IconButton as i}from"../icon-button/IconButton.js";import{BodyCaption as s}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./productScreen.js";import{paginationReducer as a}from"./reducers.js";import{SelectedScreenHeader as v}from"./style.js";import{fetchFbStatus as p}from"./useFetchFbStatus copy.js";import{paginateSelectedItems as m}from"./utility.js";const f=f=>{const{selectedCollections:j,selectedCollectionsDispatch:g,setScreen:h,collections:y,outOfStockAction:b,storeId:S,fbStatusFetcher:k}=f,O=c(0),C=c(null),[I,P]=l(a,{});n((()=>{O.current=0;const e=m(j,10,0);P({type:"paginate",data:e}),p(e,S,P,k,!0),O.current+=1}),[]),n((()=>{console.log("vj: curScreen Data change")}),[I]),n((()=>{P({type:"filter",data:{selectedCollections:j}})}),[j]),n((()=>{console.log("vj: observertarget",C.current);const e=new IntersectionObserver((e=>{if(console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",O.current),O.current>0)){const e=m(j,10,O.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:j,curScreenData:I}),P({type:"paginate",data:e}),p(e,S,P,k),O.current+=1}}),{threshold:1});return C.current&&e.observe(C.current),()=>{C.current&&e.unobserve(C.current)}}),[C]);const D=(e,t)=>{var o,r,c,l,n,i,s,d,u;let a=0,v=0;return!!((null===(r=null===(o=null==j?void 0:j[e])||void 0===o?void 0:o.products)||void 0===r?void 0:r[t])&&(null===(i=Object.keys((null===(n=null===(l=null===(c=null==y?void 0:y[e])||void 0===c?void 0:c.products)||void 0===l?void 0:l[t])||void 0===n?void 0:n.variants)||[]))||void 0===i||i.forEach((()=>v++)),Object.keys((null===(u=null===(d=null===(s=null==j?void 0:j[e])||void 0===s?void 0:s.products)||void 0===d?void 0:d[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return e("div",{children:[e(v,{children:[t(i,{Icon:r,onClick:()=>{h("collections")}}),t(s,{children:"Selected Products"})]}),e("div",{children:[Object.keys(I).length>0?t(o,{children:Object.keys(I).map((e=>{var o;return Object.keys((null===(o=null==I?void 0:I[e])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==I?void 0:I.isCustom)&&(r=!0),t(u,{upliftAdditions:null,collectionId:e,productId:o,data:I[e].products[o],isProductPartiallyChecked:D(e,o),selectedData:j,selectedCollectionsDispatch:g,viewOnly:r,outOfStockAction:b},o)}))}))}):t(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),t("div",{ref:C})]})]})};export{f as SelectedScreen};
|