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