@bikdotai/bik-component-library 0.0.439-beta.ppi-21 → 0.0.439-beta.ppi-23

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:f,storeId:b,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,b,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,b,v,g,!1,h)}),[a]),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}),h((t=>{const s=Object.assign({},t);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const o=e[t];if(Object.prototype.hasOwnProperty.call(s,t)){const e=s[t];s[t]=Object.assign(Object.assign({},e),{products:Object.assign(Object.assign({},e.products),o.products)})}else s[t]=o}return s})),S.current+=1,l.fetchFbStatus(O,b,v,g,!1,h)}}),{threshold:1});return y.current&&e.observe(y.current),()=>{y.current&&e.unobserve(y.current)}}),[y,a]);const x=(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:x(t,s),selectedData:a,selectedCollectionsDispatch:v,viewOnly:o,outOfStockAction:f},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"),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("./useFetchFbStatus copy.js"),u=require("./utility.js");exports.SelectedScreen=d=>{const{selectedCollections:a,selectedCollectionsDispatch:v,setScreen:p,collections:j,outOfStockAction:f,storeId:b,fbStatusFetcher:g}=d,[O,h]=o.useState({}),y=o.useRef(0),S=o.useRef(null);o.useEffect((()=>{y.current=0;const e=u.paginateSelectedItems(a,10,y.current);console.log("paginated",{paginatedProducts:e,selectedCollections:a}),h(e),l.fetchFbStatus(e,b,v,g,!1,h),y.current+=1}),[]),o.useEffect((()=>{h((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],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===(s=null===(o=null==u?void 0:u.products)||void 0===o?void 0:o[a])||void 0===s?void 0:s.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}))}),[a]),o.useEffect((()=>{console.log("vj: observertarget",S.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=u.paginateSelectedItems(a,10,y.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:a,curScreenData:O}),h((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 l.fetchFbStatus(o,b,v,g,!1,h),o})),y.current+=1}}),{threshold:1});return S.current&&e.observe(S.current),()=>{S.current&&e.unobserve(S.current)}}),[S,a]);const x=(e,t)=>{var o,s,r,n,c,i,l,u,d;let v=0,p=0;return!!((null===(s=null===(o=null==a?void 0:a[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==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(s.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 o;return Object.keys((null===(o=null==O?void 0:O[t])||void 0===o?void 0:o.products)||[]).map((o=>{let s=!1;return(null==O?void 0:O.isCustom)&&(s=!0),e.jsx(c.ProductGroup,{upliftAdditions:null,collectionId:t,productId:o,data:O[t].products[o],isProductPartiallyChecked:x(t,o),selectedData:a,selectedCollectionsDispatch:v,viewOnly:s,outOfStockAction:f},o)}))}))}):e.jsx(n.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:S})]})]})};
@@ -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 i}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{fetchFbStatus as v}from"./useFetchFbStatus copy.js";import{paginateSelectedItems as p}from"./utility.js";const f=f=>{const{selectedCollections:j,selectedCollectionsDispatch:b,setScreen:g,collections:m,outOfStockAction:O,storeId:h,fbStatusFetcher:y}=f,[S,k]=n({}),P=s(0),C=s(null);i((()=>{P.current=0;const t=p(j,10,P.current);console.log("paginated",{paginatedProducts:t,selectedCollections:j}),k(t),v(t,h,b,y,!1,k),P.current+=1}),[]),i((()=>{k((t=>{var o,e,r,n,s,i;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 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===(i=null===(s=null==c?void 0:c[t])||void 0===s?void 0:s.products)||void 0===i||delete i[a];c[t]=Object.assign(Object.assign({},l),{products:u})}return c})),v(S,h,b,y,!1,k)}),[j]),i((()=>{console.log("vj: observertarget",C.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(j,10,P.current);console.log("paginated inside observer target",{paginatedProducts:t,selectedCollections:j,curScreenData:S}),k((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})),P.current+=1,v(S,h,b,y,!1,k)}}),{threshold:1});return C.current&&t.observe(C.current),()=>{C.current&&t.unobserve(C.current)}}),[C,j]);const I=(t,o)=>{var e,r,n,s,i,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===(i=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===i?void 0:i.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(S).length>0?o(e,{children:Object.keys(S).map((t=>{var e;return Object.keys((null===(e=null==S?void 0:S[t])||void 0===e?void 0:e.products)||[]).map((e=>{let r=!1;return(null==S?void 0:S.isCustom)&&(r=!0),o(u,{upliftAdditions:null,collectionId:t,productId:e,data:S[t].products[e],isProductPartiallyChecked:I(t,e),selectedData:j,selectedCollectionsDispatch:b,viewOnly:r,outOfStockAction:O},e)}))}))}):o(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),o("div",{ref:C})]})]})};export{f 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 i}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{fetchFbStatus as v}from"./useFetchFbStatus copy.js";import{paginateSelectedItems as p}from"./utility.js";const f=f=>{const{selectedCollections:j,selectedCollectionsDispatch:b,setScreen:g,collections:m,outOfStockAction:O,storeId:h,fbStatusFetcher:y}=f,[S,k]=n({}),P=s(0),C=s(null);i((()=>{P.current=0;const t=p(j,10,P.current);console.log("paginated",{paginatedProducts:t,selectedCollections:j}),k(t),v(t,h,b,y,!1,k),P.current+=1}),[]),i((()=>{k((t=>{var o,e,r,n,s,i;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 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===(i=null===(s=null==c?void 0:c[t])||void 0===s?void 0:s.products)||void 0===i||delete i[a];c[t]=Object.assign(Object.assign({},l),{products:u})}return c}))}),[j]),i((()=>{console.log("vj: observertarget",C.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(j,10,P.current);console.log("paginated inside observer target",{paginatedProducts:t,selectedCollections:j,curScreenData:S}),k((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 v(e,h,b,y,!1,k),e})),P.current+=1}}),{threshold:1});return C.current&&t.observe(C.current),()=>{C.current&&t.unobserve(C.current)}}),[C,j]);const I=(t,o)=>{var e,r,n,s,i,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===(i=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===i?void 0:i.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(S).length>0?o(e,{children:Object.keys(S).map((t=>{var e;return Object.keys((null===(e=null==S?void 0:S[t])||void 0===e?void 0:e.products)||[]).map((e=>{let r=!1;return(null==S?void 0:S.isCustom)&&(r=!0),o(u,{upliftAdditions:null,collectionId:t,productId:e,data:S[t].products[e],isProductPartiallyChecked:I(t,e),selectedData:j,selectedCollectionsDispatch:b,viewOnly:r,outOfStockAction:O},e)}))}))}):o(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),o("div",{ref:C})]})]})};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-21",
3
+ "version": "0.0.439-beta.ppi-23",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",