@bikdotai/bik-component-library 0.0.439-beta.ppi-18 → 0.0.439-beta.ppi-21
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.
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/useFetchFbStatus copy.d.ts +3 -0
- package/dist/cjs/components/product-picker-v2/useFetchFbStatus copy.js +1 -0
- package/dist/cjs/components/product-picker-v2/useFetchFbStatus.d.ts +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/useFetchFbStatus copy.d.ts +3 -0
- package/dist/esm/components/product-picker-v2/useFetchFbStatus copy.js +1 -0
- package/dist/esm/components/product-picker-v2/useFetchFbStatus.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),r=require("./emptyState.js"),s=require("./productScreen.js"),c=require("./style.js"),l=require("./useFetchFbStatus.js"),d=require("./utility.js");exports.SearchScreen=n=>{const{customCollectionRestriction:u,selectedCollections:a,searchedCollections:v,selectedCollectionsDispatch:h,
|
|
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("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),r=require("./emptyState.js"),s=require("./productScreen.js"),c=require("./style.js"),l=require("./useFetchFbStatus.js"),d=require("./utility.js");exports.SearchScreen=n=>{const{customCollectionRestriction:u,selectedCollections:a,searchedCollections:v,selectedCollectionsDispatch:h,setScreen:p,collections:j,onBackPress:y,hideVariantCheckbox:b,pickerType:k,hideProductVariants:x,hideProductCheckbox:C,storeId:S,fbStatusFetcher:f}=n;l.useFetchFbStatusForCollections(v,S,h,f,!0);const P=(e,t)=>{var o,i,r,s,c,l,d,n,u;let v=0,h=0;return!!((null===(i=null===(o=null==a?void 0:a[e])||void 0===o?void 0:o.products)||void 0===i?void 0:i[t])&&(null===(l=Object.keys((null===(c=null===(s=null===(r=null==j?void 0:j[e])||void 0===r?void 0:r.products)||void 0===s?void 0:s[t])||void 0===c?void 0:c.variants)||[]))||void 0===l||l.forEach((()=>h++)),Object.keys((null===(u=null===(n=null===(d=null==a?void 0:a[e])||void 0===d?void 0:d.products)||void 0===n?void 0:n[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>v++)),v>0&&h!==v))};return e.jsxs("div",{children:[e.jsxs(c.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{p("collections"),y()}}),e.jsx(i.BodyCaption,{children:"Searched Products"})]}),e.jsx("div",{children:Object.keys(v).length?e.jsx(e.Fragment,{children:Object.keys(v).map((t=>{var o;return Object.keys((null===(o=null==v?void 0:v[t])||void 0===o?void 0:o.products)||[]).map((o=>{let i=!1;return(null==v?void 0:v.isCustom)&&(i=!0),e.jsx(s.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{const i=d.liftTheStateUp(o,v[e]);h({type:t,data:Object.assign(Object.assign({},i),{isRestricted:u})})})(t,e,o),productId:o,data:v[t].products[o],isProductPartiallyChecked:P(t,o),selectedData:a,selectedCollectionsDispatch:h,viewOnly:i,hideProductCheckbox:C,hideVariantCheckbox:b,hideProductVariants:x,pickerType:k},o)}))}))}):e.jsx(r.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -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"),
|
|
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})]})]})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FbStatusFetcherReturn, SelectedItems } from './modal';
|
|
2
|
+
import { SelectedCollectionsActions } from './reducers';
|
|
3
|
+
export declare const fetchFbStatus: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems>>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.fetchFbStatus=function(o,v,d,i){let l=arguments.length>5?arguments[5]:void 0;if(!i){const v=Object.assign({},o);Object.keys(v).forEach((o=>{var d,i;const l=null!==(i=null===(d=v[o])||void 0===d?void 0:d.products)&&void 0!==i?i:{};Object.keys(l).forEach((d=>{var i,l,t,n;const s=null!==(n=null===(t=null===(l=null===(i=v[o])||void 0===i?void 0:i.products)||void 0===l?void 0:l[d])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((i=>{var l,t,n,s;const a=null===(s=null===(n=null===(t=null===(l=v[o])||void 0===l?void 0:l.products)||void 0===t?void 0:t[d])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[i];a&&(a.fbStatus="APPROVED")}))}))})),l?l(v):d({type:"paged",data:v})}const t=(o=>{const v=[];return Object.keys(o).forEach((d=>{var i,l;const t=null!==(l=null===(i=o[d])||void 0===i?void 0:i.products)&&void 0!==l?l:{};Object.keys(t).forEach((i=>{var l,t,n,s;const a=null!==(s=null===(n=null===(t=null===(l=o[d])||void 0===l?void 0:l.products)||void 0===t?void 0:t[i])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((l=>{var t,n,s,a;const c=null===(a=null===(s=null===(n=null===(t=o[d])||void 0===t?void 0:t.products)||void 0===n?void 0:n[i])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[l];(null==c?void 0:c.fbStatus)||v.push(l)}))}))})),v})(o);console.log("vj: variantids",t),t.length>0&&i&&i(v,t).then((v=>{const i=Object.assign({},o);Object.keys(i).forEach((o=>{var d,l;const t=null!==(l=null===(d=i[o])||void 0===d?void 0:d.products)&&void 0!==l?l:{};Object.keys(t).forEach((d=>{var l,t,n,s;const a=null!==(s=null===(n=null===(t=null===(l=i[o])||void 0===l?void 0:l.products)||void 0===t?void 0:t[d])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((l=>{var t,n,s,a;const c=null===(a=null===(s=null===(n=null===(t=i[o])||void 0===t?void 0:t.products)||void 0===n?void 0:n[d])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[l];c&&"REJECTED"===v[l]?c.fbStatus="REJECTED":c&&"APPROVED"===v[l]&&(c.fbStatus="APPROVED")}))}))})),console.log("variantids",i),l?l(i):d({type:"paged",data:i})})).catch((v=>{const i=Object.assign({},o);Object.keys(i).forEach((o=>{var v,d;const l=null!==(d=null===(v=i[o])||void 0===v?void 0:v.products)&&void 0!==d?d:{};Object.keys(l).forEach((v=>{var d,l,t,n;const s=null!==(n=null===(t=null===(l=null===(d=i[o])||void 0===d?void 0:d.products)||void 0===l?void 0:l[v])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((d=>{var l,t,n,s;const a=null===(s=null===(n=null===(t=null===(l=i[o])||void 0===l?void 0:l.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[d];a&&(a.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",i),l?l(i):d({type:"paged",data:i})}))};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FbStatusFetcherReturn, SelectedItems } from './modal';
|
|
2
2
|
import { SelectedCollectionsActions } from './reducers';
|
|
3
|
-
export declare const useFetchFbStatusForCollections: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems>>) => {
|
|
3
|
+
export declare const useFetchFbStatusForCollections: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems | undefined>>) => {
|
|
4
4
|
fetchFbStatus: () => void;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as t,Fragment as e}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import{IconButton as r}from"../icon-button/IconButton.js";import{BodyCaption as c}from"../TypographyStyle.js";import{EmptyState as l}from"./emptyState.js";import{ProductGroup as s}from"./productScreen.js";import{SelectedScreenHeader as d}from"./style.js";import{useFetchFbStatusForCollections as n}from"./useFetchFbStatus.js";import{liftTheStateUp as u}from"./utility.js";const a=a=>{const{customCollectionRestriction:v,selectedCollections:p,searchedCollections:h,selectedCollectionsDispatch:m,
|
|
1
|
+
import{jsxs as o,jsx as t,Fragment as e}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import{IconButton as r}from"../icon-button/IconButton.js";import{BodyCaption as c}from"../TypographyStyle.js";import{EmptyState as l}from"./emptyState.js";import{ProductGroup as s}from"./productScreen.js";import{SelectedScreenHeader as d}from"./style.js";import{useFetchFbStatusForCollections as n}from"./useFetchFbStatus.js";import{liftTheStateUp as u}from"./utility.js";const a=a=>{const{customCollectionRestriction:v,selectedCollections:p,searchedCollections:h,selectedCollectionsDispatch:m,setScreen:f,collections:y,onBackPress:j,hideVariantCheckbox:b,pickerType:k,hideProductVariants:C,hideProductCheckbox:O,storeId:P,fbStatusFetcher:S}=a;n(h,P,m,S,!0);const g=(o,t)=>{var e,i,r,c,l,s,d,n,u;let a=0,v=0;return!!((null===(i=null===(e=null==p?void 0:p[o])||void 0===e?void 0:e.products)||void 0===i?void 0:i[t])&&(null===(s=Object.keys((null===(l=null===(c=null===(r=null==y?void 0:y[o])||void 0===r?void 0:r.products)||void 0===c?void 0:c[t])||void 0===l?void 0:l.variants)||[]))||void 0===s||s.forEach((()=>v++)),Object.keys((null===(u=null===(n=null===(d=null==p?void 0:p[o])||void 0===d?void 0:d.products)||void 0===n?void 0:n[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return o("div",{children:[o(d,{children:[t(r,{Icon:i,onClick:()=>{f("collections"),j()}}),t(c,{children:"Searched Products"})]}),t("div",{children:Object.keys(h).length?t(e,{children:Object.keys(h).map((o=>{var e;return Object.keys((null===(e=null==h?void 0:h[o])||void 0===e?void 0:e.products)||[]).map((e=>{let i=!1;return(null==h?void 0:h.isCustom)&&(i=!0),t(s,{collectionId:o,upliftAdditions:(t,e)=>((o,t,e)=>{const i=u(e,h[o]);m({type:t,data:Object.assign(Object.assign({},i),{isRestricted:v})})})(o,t,e),productId:e,data:h[o].products[e],isProductPartiallyChecked:g(o,e),selectedData:p,selectedCollectionsDispatch:m,viewOnly:i,hideProductCheckbox:O,hideVariantCheckbox:b,hideProductVariants:C,pickerType:k},e)}))}))}):t(l,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{a as SearchScreen};
|
|
@@ -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{
|
|
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};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FbStatusFetcherReturn, SelectedItems } from './modal';
|
|
2
|
+
import { SelectedCollectionsActions } from './reducers';
|
|
3
|
+
export declare const fetchFbStatus: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems>>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=function(o,v,d,i){let l=arguments.length>5?arguments[5]:void 0;if(!i){const v=Object.assign({},o);Object.keys(v).forEach((o=>{var d,i;const l=null!==(i=null===(d=v[o])||void 0===d?void 0:d.products)&&void 0!==i?i:{};Object.keys(l).forEach((d=>{var i,l,n,t;const s=null!==(t=null===(n=null===(l=null===(i=v[o])||void 0===i?void 0:i.products)||void 0===l?void 0:l[d])||void 0===n?void 0:n.variants)&&void 0!==t?t:{};Object.keys(s).forEach((i=>{var l,n,t,s;const a=null===(s=null===(t=null===(n=null===(l=v[o])||void 0===l?void 0:l.products)||void 0===n?void 0:n[d])||void 0===t?void 0:t.variants)||void 0===s?void 0:s[i];a&&(a.fbStatus="APPROVED")}))}))})),l?l(v):d({type:"paged",data:v})}const n=(o=>{const v=[];return Object.keys(o).forEach((d=>{var i,l;const n=null!==(l=null===(i=o[d])||void 0===i?void 0:i.products)&&void 0!==l?l:{};Object.keys(n).forEach((i=>{var l,n,t,s;const a=null!==(s=null===(t=null===(n=null===(l=o[d])||void 0===l?void 0:l.products)||void 0===n?void 0:n[i])||void 0===t?void 0:t.variants)&&void 0!==s?s:{};Object.keys(a).forEach((l=>{var n,t,s,a;const c=null===(a=null===(s=null===(t=null===(n=o[d])||void 0===n?void 0:n.products)||void 0===t?void 0:t[i])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[l];(null==c?void 0:c.fbStatus)||v.push(l)}))}))})),v})(o);console.log("vj: variantids",n),n.length>0&&i&&i(v,n).then((v=>{const i=Object.assign({},o);Object.keys(i).forEach((o=>{var d,l;const n=null!==(l=null===(d=i[o])||void 0===d?void 0:d.products)&&void 0!==l?l:{};Object.keys(n).forEach((d=>{var l,n,t,s;const a=null!==(s=null===(t=null===(n=null===(l=i[o])||void 0===l?void 0:l.products)||void 0===n?void 0:n[d])||void 0===t?void 0:t.variants)&&void 0!==s?s:{};Object.keys(a).forEach((l=>{var n,t,s,a;const c=null===(a=null===(s=null===(t=null===(n=i[o])||void 0===n?void 0:n.products)||void 0===t?void 0:t[d])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[l];c&&"REJECTED"===v[l]?c.fbStatus="REJECTED":c&&"APPROVED"===v[l]&&(c.fbStatus="APPROVED")}))}))})),console.log("variantids",i),l?l(i):d({type:"paged",data:i})})).catch((v=>{const i=Object.assign({},o);Object.keys(i).forEach((o=>{var v,d;const l=null!==(d=null===(v=i[o])||void 0===v?void 0:v.products)&&void 0!==d?d:{};Object.keys(l).forEach((v=>{var d,l,n,t;const s=null!==(t=null===(n=null===(l=null===(d=i[o])||void 0===d?void 0:d.products)||void 0===l?void 0:l[v])||void 0===n?void 0:n.variants)&&void 0!==t?t:{};Object.keys(s).forEach((d=>{var l,n,t,s;const a=null===(s=null===(t=null===(n=null===(l=i[o])||void 0===l?void 0:l.products)||void 0===n?void 0:n[v])||void 0===t?void 0:t.variants)||void 0===s?void 0:s[d];a&&(a.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",i),l?l(i):d({type:"paged",data:i})}))};export{o as fetchFbStatus};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FbStatusFetcherReturn, SelectedItems } from './modal';
|
|
2
2
|
import { SelectedCollectionsActions } from './reducers';
|
|
3
|
-
export declare const useFetchFbStatusForCollections: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems>>) => {
|
|
3
|
+
export declare const useFetchFbStatusForCollections: (data: SelectedItems, storeId: string, selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, autoFetch?: boolean, setSearchedCollections?: React.Dispatch<React.SetStateAction<SelectedItems | undefined>>) => {
|
|
4
4
|
fetchFbStatus: () => void;
|
|
5
5
|
};
|