@bikdotai/bik-component-library 0.0.455-beta.ppi-13 → 0.0.455-beta.ppi-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"),o=require("../../assets/icons/arrow_left.svg.js"),t=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/arrow_left.svg.js"),t=require("react"),l=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),c=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./productScreen.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{const{customCollectionRestriction:a,selectedCollections:v,searchedCollections:h,searchedCollectionsDispatch:p,selectedCollectionsDispatch:j,setScreen:C,collections:y,onBackPress:k,hideVariantCheckbox:b,pickerType:f,hideProductVariants:x,hideProductCheckbox:S,storeId:O,fbStatusFetcher:m,setCollectionId:P,setSelectedCollectionId:g,hideCollectionCheckbox:I,renderWithoutModal:q}=u;t.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=h.products)&&void 0!==e?e:{},O,p,m,"setProducts")}),[null==h?void 0:h.products]),t.useEffect((()=>{console.log("selectedCollections",{selectedCollections:v,collections:y})}),[v,y]);const E=!!a&&(null==v?void 0:v.isCustom),D=e=>{var o,t;let l=0,i=0;if(v[e]){const c=null===(o=y[e])||void 0===o?void 0:o.products;c&&Object.keys(c).forEach((e=>{var o;const t=null===(o=c[e])||void 0===o?void 0:o.variants;t&&Object.keys(t).forEach((e=>l+=1))}));const s=null===(t=v[e])||void 0===t?void 0:t.products;return s&&Object.keys(s).forEach((e=>{var o;const t=null===(o=s[e])||void 0===o?void 0:o.variants;t&&Object.keys(t).forEach((e=>i+=1))})),!(l<=0&&i>0)&&(i>0&&l!==i)}return!1},F=(e,o)=>{var t,l,i,c,s,d,r,n,u;let a=0,h=0;return!!((null===(l=null===(t=null==v?void 0:v[e])||void 0===t?void 0:t.products)||void 0===l?void 0:l[o])&&(null===(d=Object.keys((null===(s=null===(c=null===(i=null==y?void 0:y[e])||void 0===i?void 0:i.products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]))||void 0===d||d.forEach((()=>h++)),Object.keys((null===(u=null===(n=null===(r=null==v?void 0:v[e])||void 0===r?void 0:r.products)||void 0===n?void 0:n[o])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&h!==a))};return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:o.default,onClick:()=>{C("collections"),k()}}),e.jsx(i.BodyCaption,{children:"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==h?void 0:h.products).length||Object.keys(null==h?void 0:h.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==h?void 0:h.collections).map((o=>e.jsx(c.CollectionCard,{customCollectionRestriction:a,data:null==y?void 0:y[o],isDisabled:E&&!(null==v?void 0:v[o]),isChecked:!!(null==v?void 0:v[o]),isPartiallyChecked:D(o),selectedCollectionsDispatch:j,setCollectionId:P,setSelectedCollectionId:g,setScreen:C,id:o,hideCollectionCheckbox:I||"-1"===o,selectedCollections:v,renderWithoutModal:q,pickerType:f,usedInSearch:!0},o)))}),e.jsx(e.Fragment,{children:Object.keys(null==h?void 0:h.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==h?void 0:h.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i;let c=!1;return(null===(l=null==h?void 0:h.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e.jsx(d.ProductGroup,{collectionId:o,upliftAdditions:(e,t)=>((e,o,t)=>{var l;const i=n.liftTheStateUp(t,null===(l=null==h?void 0:h.products)||void 0===l?void 0:l[e]);j({type:o,data:Object.assign(Object.assign({},i),{isRestricted:a})})})(o,e,t),productId:t,data:(null===(i=null==h?void 0:h.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:F(o,t),selectedData:v,selectedCollectionsDispatch:j,viewOnly:c,hideProductCheckbox:S,hideVariantCheckbox:b,hideProductVariants:x,pickerType:f},t)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as
|
|
1
|
+
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./productScreen.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as v,liftTheStateUp as a}from"./utility.js";const p=p=>{const{customCollectionRestriction:h,selectedCollections:m,searchedCollections:C,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:b,collections:f,onBackPress:j,hideVariantCheckbox:O,pickerType:S,hideProductVariants:I,hideProductCheckbox:P,storeId:g,fbStatusFetcher:x,setCollectionId:D,setSelectedCollectionId:E,hideCollectionCheckbox:T,renderWithoutModal:V}=p;i((()=>{var o;v(null!==(o=C.products)&&void 0!==o?o:{},g,k,x,"setProducts")}),[null==C?void 0:C.products]),i((()=>{console.log("selectedCollections",{selectedCollections:m,collections:f})}),[m,f]);const w=!!h&&(null==m?void 0:m.isCustom),R=o=>{var e,t;let l=0,i=0;if(m[o]){const c=null===(e=f[o])||void 0===e?void 0:e.products;c&&Object.keys(c).forEach((o=>{var e;const t=null===(e=c[o])||void 0===e?void 0:e.variants;t&&Object.keys(t).forEach((o=>l+=1))}));const d=null===(t=m[o])||void 0===t?void 0:t.products;return d&&Object.keys(d).forEach((o=>{var e;const t=null===(e=d[o])||void 0===e?void 0:e.variants;t&&Object.keys(t).forEach((o=>i+=1))})),!(l<=0&&i>0)&&(i>0&&l!==i)}return!1},W=(o,e)=>{var t,l,i,c,d,s,r,n,u;let v=0,a=0;return!!((null===(l=null===(t=null==m?void 0:m[o])||void 0===t?void 0:t.products)||void 0===l?void 0:l[e])&&(null===(s=Object.keys((null===(d=null===(c=null===(i=null==f?void 0:f[o])||void 0===i?void 0:i.products)||void 0===c?void 0:c[e])||void 0===d?void 0:d.variants)||[]))||void 0===s||s.forEach((()=>a++)),Object.keys((null===(u=null===(n=null===(r=null==m?void 0:m[o])||void 0===r?void 0:r.products)||void 0===n?void 0:n[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>v++)),v>0&&a!==v))};return o("div",{children:[o(u,{children:[e(c,{Icon:l,onClick:()=>{b("collections"),j()}}),e(d,{children:"Searched Products"})]}),e("div",{children:Object.keys(null==C?void 0:C.products).length||Object.keys(null==C?void 0:C.collections).length?o(t,{children:[e(t,{children:Object.keys(null==C?void 0:C.collections).map((o=>e(s,{customCollectionRestriction:h,data:null==f?void 0:f[o],isDisabled:w&&!(null==m?void 0:m[o]),isChecked:!!(null==m?void 0:m[o]),isPartiallyChecked:R(o),selectedCollectionsDispatch:y,setCollectionId:D,setSelectedCollectionId:E,setScreen:b,id:o,hideCollectionCheckbox:T||"-1"===o,selectedCollections:m,renderWithoutModal:V,pickerType:S,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==C?void 0:C.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==C?void 0:C.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i;let c=!1;return(null===(l=null==C?void 0:C.products)||void 0===l?void 0:l.isCustom)&&(c=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var l;const i=a(t,null===(l=null==C?void 0:C.products)||void 0===l?void 0:l[o]);y({type:e,data:Object.assign(Object.assign({},i),{isRestricted:h})})})(o,e,t),productId:t,data:(null===(i=null==C?void 0:C.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:W(o,t),selectedData:m,selectedCollectionsDispatch:y,viewOnly:c,hideProductCheckbox:P,hideVariantCheckbox:O,hideProductVariants:I,pickerType:S},t)}))}))})]}):e(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{p as SearchScreen};
|