@bikdotai/bik-component-library 0.0.455-beta.ppi-21 → 0.0.455-beta.ppi-23
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"),d=require("./emptyState.js"),s=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 d=null===(o=v[e])||void 0===o?void 0:o.products;return d&&Object.keys(d).forEach((e=>{var t;const o=null===(t=d[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,d,s,r,n,u;let a=0,p=0;return console.log("isProductPartiallyChecked start",{collectionId:e,productId:t,selectedCollections:v,collections:y,searchedCollections:h}),!!((null===(l=null===(o=null==v?void 0:v[e])||void 0===o?void 0:o.products)||void 0===l?void 0:l[t])&&(null===(s=Object.keys((null===(d=null===(c=null===(i=null==
|
|
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"),d=require("./emptyState.js"),s=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 d=null===(o=v[e])||void 0===o?void 0:o.products;return d&&Object.keys(d).forEach((e=>{var t;const o=null===(t=d[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,d,s,r,n,u;let a=0,p=0;return console.log("isProductPartiallyChecked start",{collectionId:e,productId:t,selectedCollections:v,collections:y,searchedCollections:h}),!!((null===(l=null===(o=null==v?void 0:v[e])||void 0===o?void 0:o.products)||void 0===l?void 0:l[t])&&(null===(s=Object.keys((null===(d=null===(c=null===(i=null==h?void 0:h[e])||void 0===i?void 0:i.products)||void 0===c?void 0:c[t])||void 0===d?void 0:d.variants)||[]))||void 0===s||s.forEach((()=>p++)),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[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),console.log("isProductPartiallyChecked variants",{totalSelectedVariants:a,totalVariants:p}),a>0&&p!==a))};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(s.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(d.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,n,u;let a=0,v=0;return console.log("isProductPartiallyChecked start",{collectionId:o,productId:e,selectedCollections:C,collections:f,searchedCollections:m}),!!((null===(l=null===(t=null==C?void 0:C[o])||void 0===t?void 0:t.products)||void 0===l?void 0:l[e])&&(null===(r=Object.keys((null===(d=null===(c=null===(i=null==
|
|
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,n,u;let a=0,v=0;return console.log("isProductPartiallyChecked start",{collectionId:o,productId:e,selectedCollections:C,collections:f,searchedCollections:m}),!!((null===(l=null===(t=null==C?void 0:C[o])||void 0===t?void 0:t.products)||void 0===l?void 0:l[e])&&(null===(r=Object.keys((null===(d=null===(c=null===(i=null==m?void 0:m[o])||void 0===i?void 0:i.products)||void 0===c?void 0:c[e])||void 0===d?void 0:d.variants)||[]))||void 0===r||r.forEach((()=>v++)),Object.keys((null===(u=null===(n=null===(s=null==C?void 0:C[o])||void 0===s?void 0:s.products)||void 0===n?void 0:n[e])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),console.log("isProductPartiallyChecked variants",{totalSelectedVariants:a,totalVariants:v}),a>0&&v!==a))};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};
|