@bikdotai/bik-component-library 0.0.439-beta.ppi-33 → 0.0.439-beta.ppi-34

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