@bikdotai/bik-component-library 0.0.454-beta.ppi-2 → 0.0.454-beta.ppi-3

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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -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("./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:S,storeId:g,fbStatusFetcher:y}=a,h=r.useRef(0),b=r.useRef(null),[x,q]=r.useReducer(l.paginationReducer,{});r.useEffect((()=>{h.current=0;const e=d.paginateSelectedItems(v,10,0);q({type:"paginate",data:e}),u.fetchFbStatus(e,g,q,y,!0),h.current+=1}),[]),r.useEffect((()=>{q({type:"filter",data: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",h.current),h.current>0)){const e=d.paginateSelectedItems(v,10,h.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:v,curScreenData:x}),q({type:"paginate",data:e}),u.fetchFbStatus(e,g,q,y),h.current+=1}}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b,v]);const I=(e,t)=>{var r,o,s,c,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===(c=null===(s=null==f?void 0:f[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((()=>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(s.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:S},r)}))}))}):e.jsx(c.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"),s=require("../TypographyStyle.js"),c=require("./emptyState.js"),n=require("./productScreen.js"),l=require("./reducers.js"),i=require("./style.js"),u=require("./useFetchFbStatus.js"),d=require("./utility.js");exports.SelectedScreen=a=>{const{selectedCollections:v,selectedCollectionsDispatch:p,setScreen:j,collections:f,outOfStockAction:S,storeId:g,fbStatusFetcher:h}=a,y=r.useRef(0),b=r.useRef(null),[x,q]=r.useReducer(l.paginationReducer,{}),{fetchFbStatus:I}=u.useFetchFbStatusForCollections(x,g,q,h);r.useEffect((()=>{y.current=0;const e=d.paginateSelectedItems(v,10,0);q({type:"paginate",data:e}),I(),y.current+=1}),[]),r.useEffect((()=>{q({type:"filter",data: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}),I(),y.current+=1}}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b,v]);const O=(e,t)=>{var r,o,s,c,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===(c=null===(s=null==f?void 0:f[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((()=>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(s.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:O(t,r),selectedData:v,selectedCollectionsDispatch:p,viewOnly:o,outOfStockAction:S},r)}))}))}):e.jsx(c.EmptyState,{title:"No Products Selected",subtitle:"Select products will appear here"}),e.jsx("div",{ref:b})]})]})};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -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{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:h,setScreen:y,collections:g,outOfStockAction:b,storeId:S,fbStatusFetcher:k}=f,O=c(0),C=c(null),[I,P]=l(a,{});n((()=>{O.current=0;const t=m(j,10,0);P({type:"paginate",data:t}),p(t,S,P,k,!0),O.current+=1}),[]),n((()=>{P({type:"filter",data:j})}),[j]),n((()=>{console.log("vj: observertarget",C.current);const t=new IntersectionObserver((t=>{if(console.log("vj: observertargetinside",t),t[0].isIntersecting&&(console.log("vj: nextPageRef",O.current),O.current>0)){const t=m(j,10,O.current);console.log("paginated inside observer target",{paginatedProducts:t,selectedCollections:j,curScreenData:I}),P({type:"paginate",data:t}),p(t,S,P,k),O.current+=1}}),{threshold:1});return C.current&&t.observe(C.current),()=>{C.current&&t.unobserve(C.current)}}),[C,j]);const w=(t,e)=>{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[t])||void 0===o?void 0:o.products)||void 0===r?void 0:r[e])&&(null===(i=Object.keys((null===(n=null===(l=null===(c=null==g?void 0:g[t])||void 0===c?void 0:c.products)||void 0===l?void 0:l[e])||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[t])||void 0===s?void 0:s.products)||void 0===d?void 0:d[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return t("div",{children:[t(v,{children:[e(i,{Icon:r,onClick:()=>{y("collections")}}),e(s,{children:"Selected Products"})]}),t("div",{children:[Object.keys(I).length>0?e(o,{children:Object.keys(I).map((t=>{var o;return Object.keys((null===(o=null==I?void 0:I[t])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==I?void 0:I.isCustom)&&(r=!0),e(u,{upliftAdditions:null,collectionId:t,productId:o,data:I[t].products[o],isProductPartiallyChecked:w(t,o),selectedData:j,selectedCollectionsDispatch:h,viewOnly:r,outOfStockAction:b},o)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("div",{ref:C})]})]})};export{f as SelectedScreen};
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{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{useFetchFbStatusForCollections as p}from"./useFetchFbStatus.js";import{paginateSelectedItems as m}from"./utility.js";const f=f=>{const{selectedCollections:h,selectedCollectionsDispatch:j,setScreen:b,collections:g,outOfStockAction:y,storeId:S,fbStatusFetcher:k}=f,O=c(0),C=c(null),[I,P]=l(a,{}),{fetchFbStatus:w}=p(I,S,P,k);n((()=>{O.current=0;const t=m(h,10,0);P({type:"paginate",data:t}),w(),O.current+=1}),[]),n((()=>{P({type:"filter",data:h})}),[h]),n((()=>{console.log("vj: observertarget",C.current);const t=new IntersectionObserver((t=>{if(console.log("vj: observertargetinside",t),t[0].isIntersecting&&(console.log("vj: nextPageRef",O.current),O.current>0)){const t=m(h,10,O.current);console.log("paginated inside observer target",{paginatedProducts:t,selectedCollections:h,curScreenData:I}),P({type:"paginate",data:t}),w(),O.current+=1}}),{threshold:1});return C.current&&t.observe(C.current),()=>{C.current&&t.unobserve(C.current)}}),[C,h]);const D=(t,e)=>{var o,r,c,l,n,i,s,d,u;let a=0,v=0;return!!((null===(r=null===(o=null==h?void 0:h[t])||void 0===o?void 0:o.products)||void 0===r?void 0:r[e])&&(null===(i=Object.keys((null===(n=null===(l=null===(c=null==g?void 0:g[t])||void 0===c?void 0:c.products)||void 0===l?void 0:l[e])||void 0===n?void 0:n.variants)||[]))||void 0===i||i.forEach((()=>v++)),Object.keys((null===(u=null===(d=null===(s=null==h?void 0:h[t])||void 0===s?void 0:s.products)||void 0===d?void 0:d[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return t("div",{children:[t(v,{children:[e(i,{Icon:r,onClick:()=>{b("collections")}}),e(s,{children:"Selected Products"})]}),t("div",{children:[Object.keys(I).length>0?e(o,{children:Object.keys(I).map((t=>{var o;return Object.keys((null===(o=null==I?void 0:I[t])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==I?void 0:I.isCustom)&&(r=!0),e(u,{upliftAdditions:null,collectionId:t,productId:o,data:I[t].products[o],isProductPartiallyChecked:D(t,o),selectedData:h,selectedCollectionsDispatch:j,viewOnly:r,outOfStockAction:y},o)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("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.454-beta.ppi-2",
3
+ "version": "0.0.454-beta.ppi-3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.fetchFbStatus=(o,d,v,l,i)=>{if(!l){const d=o;Object.keys(d).forEach((o=>{var v,l;const i=null!==(l=null===(v=d[o])||void 0===v?void 0:v.products)&&void 0!==l?l:{};Object.keys(i).forEach((v=>{var l,i,t,n;const s=null!==(n=null===(t=null===(i=null===(l=d[o])||void 0===l?void 0:l.products)||void 0===i?void 0:i[v])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((l=>{var i,t,n,s;const a=null===(s=null===(n=null===(t=null===(i=d[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[l];a&&(a.fbStatus="APPROVED")}))}))})),v({type:"update",data:d})}const t=(o=>{const d=[];return Object.keys(o).forEach((v=>{var l,i;const t=null!==(i=null===(l=o[v])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(t).forEach((l=>{var i,t,n,s;const a=null!==(s=null===(n=null===(t=null===(i=o[v])||void 0===i?void 0:i.products)||void 0===t?void 0:t[l])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((i=>{var t,n,s,a;const u=null===(a=null===(s=null===(n=null===(t=o[v])||void 0===t?void 0:t.products)||void 0===n?void 0:n[l])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[i];(null==u?void 0:u.fbStatus)||d.push(i)}))}))})),d})(o);console.log("vj: variantids",t),t.length>0&&l&&l(d,t).then((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var v,i;const t=null!==(i=null===(v=l[o])||void 0===v?void 0:v.products)&&void 0!==i?i:{};Object.keys(t).forEach((v=>{var i,t,n,s;const a=null!==(s=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((i=>{var t,n,s,a;const u=null===(a=null===(s=null===(n=null===(t=l[o])||void 0===t?void 0:t.products)||void 0===n?void 0:n[v])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[i];u&&"REJECTED"===d[i]?u.fbStatus="REJECTED":u&&"APPROVED"===d[i]&&(u.fbStatus="APPROVED")}))}))})),console.log("updated data",l),v(i?{type:"set",data:l}:{type:"update",data:l})})).catch((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var d,v;const i=null!==(v=null===(d=l[o])||void 0===d?void 0:d.products)&&void 0!==v?v:{};Object.keys(i).forEach((d=>{var v,i,t,n;const s=null!==(n=null===(t=null===(i=null===(v=l[o])||void 0===v?void 0:v.products)||void 0===i?void 0:i[d])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((v=>{var i,t,n,s;const a=null===(s=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[d])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[v];a&&(a.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",l),v({type:"update",data:l})}))};
@@ -1 +0,0 @@
1
- const o=(o,d,v,l,i)=>{if(!l){const d=o;Object.keys(d).forEach((o=>{var v,l;const i=null!==(l=null===(v=d[o])||void 0===v?void 0:v.products)&&void 0!==l?l:{};Object.keys(i).forEach((v=>{var l,i,t,n;const a=null!==(n=null===(t=null===(i=null===(l=d[o])||void 0===l?void 0:l.products)||void 0===i?void 0:i[v])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(a).forEach((l=>{var i,t,n,a;const s=null===(a=null===(n=null===(t=null===(i=d[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)||void 0===a?void 0:a[l];s&&(s.fbStatus="APPROVED")}))}))})),v({type:"update",data:d})}const t=(o=>{const d=[];return Object.keys(o).forEach((v=>{var l,i;const t=null!==(i=null===(l=o[v])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(t).forEach((l=>{var i,t,n,a;const s=null!==(a=null===(n=null===(t=null===(i=o[v])||void 0===i?void 0:i.products)||void 0===t?void 0:t[l])||void 0===n?void 0:n.variants)&&void 0!==a?a:{};Object.keys(s).forEach((i=>{var t,n,a,s;const u=null===(s=null===(a=null===(n=null===(t=o[v])||void 0===t?void 0:t.products)||void 0===n?void 0:n[l])||void 0===a?void 0:a.variants)||void 0===s?void 0:s[i];(null==u?void 0:u.fbStatus)||d.push(i)}))}))})),d})(o);console.log("vj: variantids",t),t.length>0&&l&&l(d,t).then((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var v,i;const t=null!==(i=null===(v=l[o])||void 0===v?void 0:v.products)&&void 0!==i?i:{};Object.keys(t).forEach((v=>{var i,t,n,a;const s=null!==(a=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)&&void 0!==a?a:{};Object.keys(s).forEach((i=>{var t,n,a,s;const u=null===(s=null===(a=null===(n=null===(t=l[o])||void 0===t?void 0:t.products)||void 0===n?void 0:n[v])||void 0===a?void 0:a.variants)||void 0===s?void 0:s[i];u&&"REJECTED"===d[i]?u.fbStatus="REJECTED":u&&"APPROVED"===d[i]&&(u.fbStatus="APPROVED")}))}))})),console.log("updated data",l),v(i?{type:"set",data:l}:{type:"update",data:l})})).catch((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var d,v;const i=null!==(v=null===(d=l[o])||void 0===d?void 0:d.products)&&void 0!==v?v:{};Object.keys(i).forEach((d=>{var v,i,t,n;const a=null!==(n=null===(t=null===(i=null===(v=l[o])||void 0===v?void 0:v.products)||void 0===i?void 0:i[d])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(a).forEach((v=>{var i,t,n,a;const s=null===(a=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[d])||void 0===n?void 0:n.variants)||void 0===a?void 0:a[v];s&&(s.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",l),v({type:"update",data:l})}))};export{o as fetchFbStatus};