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