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