@bikdotai/bik-component-library 0.0.439-beta.ppi-7 → 0.0.439-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.
|
@@ -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"),s=require("../TypographyStyle.js"),c=require("./emptyState.js"),n=require("./productScreen.js"),l=require("./style.js"),i=require("./utility.js");exports.SelectedScreen=u=>{const{selectedCollections:d,selectedCollectionsDispatch:a,setScreen:v,collections:p,outOfStockAction:j}=u,[g,f]=r.useState({}),b=r.useRef(0),y=r.useRef(null);r.useEffect((()=>{b.current=0;const e=i.paginateSelectedItems(d,10,b.current);console.log("paginated",{paginatedProducts:e,selectedCollections:d});const t=i.mergeProducts(g,e);f(t),b.current+=1}),[]),r.useEffect((()=>{f((e=>{const t={};for(const r in e)Object.prototype.hasOwnProperty.call(d,r)&&(t[r]=
|
|
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"),s=require("../TypographyStyle.js"),c=require("./emptyState.js"),n=require("./productScreen.js"),l=require("./style.js"),i=require("./utility.js");exports.SelectedScreen=u=>{const{selectedCollections:d,selectedCollectionsDispatch:a,setScreen:v,collections:p,outOfStockAction:j}=u,[g,f]=r.useState({}),b=r.useRef(0),y=r.useRef(null);r.useEffect((()=>{b.current=0;const e=i.paginateSelectedItems(d,10,b.current);console.log("paginated",{paginatedProducts:e,selectedCollections:d});const t=i.mergeProducts(g,e);f(t),b.current+=1}),[]),r.useEffect((()=>{f((e=>{const t={};for(const r in e)Object.prototype.hasOwnProperty.call(d,r)&&(t[r]=d[r]);return t}))}),[d]),r.useEffect((()=>{console.log("vj: observertarget",y.current);const e=new IntersectionObserver((e=>{if(console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",b.current),b.current>0)){const e=i.paginateSelectedItems(d,10,b.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:d,curScreenData:g}),f((t=>{const r=Object.assign({},t);console.log("prev Data",t);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];if(Object.prototype.hasOwnProperty.call(r,t)){const e=r[t];r[t]=Object.assign(Object.assign({},e),{products:Object.assign(Object.assign({},e.products),o.products)})}else r[t]=o}return r})),b.current+=1}}),{threshold:1});return y.current&&e.observe(y.current),()=>{y.current&&e.unobserve(y.current)}}),[y]);const O=(e,t)=>{var r,o,s,c,n,l,i,u,a;let v=0,j=0;return!!((null===(o=null===(r=null==d?void 0:d[e])||void 0===r?void 0:r.products)||void 0===o?void 0:o[t])&&(null===(l=Object.keys((null===(n=null===(c=null===(s=null==p?void 0:p[e])||void 0===s?void 0:s.products)||void 0===c?void 0:c[t])||void 0===n?void 0:n.variants)||[]))||void 0===l||l.forEach((()=>j++)),Object.keys((null===(a=null===(u=null===(i=null==d?void 0:d[e])||void 0===i?void 0:i.products)||void 0===u?void 0:u[t])||void 0===a?void 0:a.variants)||[]).forEach((()=>v++)),v>0&&j!==v))};return e.jsxs("div",{children:[e.jsxs(l.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{v("collections")}}),e.jsx(s.BodyCaption,{children:"Selected Products"})]}),e.jsxs("div",{children:[Object.keys(g).length>0?e.jsx(e.Fragment,{children:Object.keys(g).map((t=>{var r;return Object.keys((null===(r=null==g?void 0:g[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==g?void 0:g.isCustom)&&(o=!0),e.jsx(n.ProductGroup,{upliftAdditions:null,collectionId:t,productId:r,data:g[t].products[r],isProductPartiallyChecked:O(t,r),selectedData:d,selectedCollectionsDispatch:a,viewOnly:o,outOfStockAction:j},r)}))}))}):e.jsx(c.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:y})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useState as c,useRef as n,useEffect as l}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{BodyCaption as i}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./productScreen.js";import{SelectedScreenHeader as a}from"./style.js";import{paginateSelectedItems as p,mergeProducts as v}from"./utility.js";const j=j=>{const{selectedCollections:g,selectedCollectionsDispatch:m,setScreen:f,collections:b,outOfStockAction:O}=j,[y,h]=c({}),P=n(0),S=n(null);l((()=>{P.current=0;const t=p(g,10,P.current);console.log("paginated",{paginatedProducts:t,selectedCollections:g});const e=v(y,t);h(e),P.current+=1}),[]),l((()=>{h((t=>{const e={};for(const o in t)Object.prototype.hasOwnProperty.call(g,o)&&(e[o]=
|
|
1
|
+
import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useState as c,useRef as n,useEffect as l}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{BodyCaption as i}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./productScreen.js";import{SelectedScreenHeader as a}from"./style.js";import{paginateSelectedItems as p,mergeProducts as v}from"./utility.js";const j=j=>{const{selectedCollections:g,selectedCollectionsDispatch:m,setScreen:f,collections:b,outOfStockAction:O}=j,[y,h]=c({}),P=n(0),S=n(null);l((()=>{P.current=0;const t=p(g,10,P.current);console.log("paginated",{paginatedProducts:t,selectedCollections:g});const e=v(y,t);h(e),P.current+=1}),[]),l((()=>{h((t=>{const e={};for(const o in t)Object.prototype.hasOwnProperty.call(g,o)&&(e[o]=g[o]);return e}))}),[g]),l((()=>{console.log("vj: observertarget",S.current);const t=new IntersectionObserver((t=>{if(console.log("vj: observertargetinside",t),t[0].isIntersecting&&(console.log("vj: nextPageRef",P.current),P.current>0)){const t=p(g,10,P.current);console.log("paginated inside observer target",{paginatedProducts:t,selectedCollections:g,curScreenData:y}),h((e=>{const o=Object.assign({},e);console.log("prev Data",e);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];if(Object.prototype.hasOwnProperty.call(o,e)){const t=o[e];o[e]=Object.assign(Object.assign({},t),{products:Object.assign(Object.assign({},t.products),r.products)})}else o[e]=r}return o})),P.current+=1}}),{threshold:1});return S.current&&t.observe(S.current),()=>{S.current&&t.unobserve(S.current)}}),[S]);const k=(t,e)=>{var o,r,c,n,l,s,i,d,u;let a=0,p=0;return!!((null===(r=null===(o=null==g?void 0:g[t])||void 0===o?void 0:o.products)||void 0===r?void 0:r[e])&&(null===(s=Object.keys((null===(l=null===(n=null===(c=null==b?void 0:b[t])||void 0===c?void 0:c.products)||void 0===n?void 0:n[e])||void 0===l?void 0:l.variants)||[]))||void 0===s||s.forEach((()=>p++)),Object.keys((null===(u=null===(d=null===(i=null==g?void 0:g[t])||void 0===i?void 0:i.products)||void 0===d?void 0:d[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&p!==a))};return t("div",{children:[t(a,{children:[e(s,{Icon:r,onClick:()=>{f("collections")}}),e(i,{children:"Selected Products"})]}),t("div",{children:[Object.keys(y).length>0?e(o,{children:Object.keys(y).map((t=>{var o;return Object.keys((null===(o=null==y?void 0:y[t])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==y?void 0:y.isCustom)&&(r=!0),e(u,{upliftAdditions:null,collectionId:t,productId:o,data:y[t].products[o],isProductPartiallyChecked:k(t,o),selectedData:g,selectedCollectionsDispatch:m,viewOnly:r,outOfStockAction:O},o)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("div",{ref:S})]})]})};export{j as SelectedScreen};
|