@bikdotai/bik-component-library 0.0.455-beta.ppif-4 → 0.0.456-0

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.
Files changed (65) hide show
  1. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  2. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +0 -19
  3. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  4. package/dist/cjs/components/product-picker-v2/helpers/AllProductHelper.d.ts +4 -0
  5. package/dist/cjs/components/product-picker-v2/helpers/AllProductHelper.js +1 -0
  6. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -5
  7. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  8. package/dist/cjs/components/product-picker-v2/modal.d.ts +3 -16
  9. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  10. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +37 -6
  11. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  12. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  13. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
  14. package/dist/cjs/components/product-picker-v2/reducers.d.ts +1 -25
  15. package/dist/cjs/components/product-picker-v2/reducers.js +1 -1
  16. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +3 -10
  17. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  18. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +2 -5
  19. package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
  20. package/dist/cjs/components/product-picker-v2/style.d.ts +0 -1
  21. package/dist/cjs/components/product-picker-v2/style.js +12 -32
  22. package/dist/cjs/components/product-picker-v2/utility.d.ts +0 -37
  23. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  24. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  25. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  26. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +0 -19
  27. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  28. package/dist/esm/components/product-picker-v2/helpers/AllProductHelper.d.ts +4 -0
  29. package/dist/esm/components/product-picker-v2/helpers/AllProductHelper.js +1 -0
  30. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -5
  31. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  32. package/dist/esm/components/product-picker-v2/modal.d.ts +3 -16
  33. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  34. package/dist/esm/components/product-picker-v2/productScreen.d.ts +37 -6
  35. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  36. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  37. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
  38. package/dist/esm/components/product-picker-v2/reducers.d.ts +1 -25
  39. package/dist/esm/components/product-picker-v2/reducers.js +1 -1
  40. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +3 -10
  41. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  42. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +2 -5
  43. package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
  44. package/dist/esm/components/product-picker-v2/style.d.ts +0 -1
  45. package/dist/esm/components/product-picker-v2/style.js +12 -32
  46. package/dist/esm/components/product-picker-v2/utility.d.ts +0 -37
  47. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  48. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/cjs/components/product-picker-v2/ProductPickerShimmer.d.ts +0 -3
  51. package/dist/cjs/components/product-picker-v2/ProductPickerShimmer.js +0 -1
  52. package/dist/cjs/components/product-picker-v2/ProductPickerTag.d.ts +0 -19
  53. package/dist/cjs/components/product-picker-v2/ProductPickerTag.js +0 -1
  54. package/dist/cjs/components/product-picker-v2/product.d.ts +0 -43
  55. package/dist/cjs/components/product-picker-v2/product.js +0 -1
  56. package/dist/cjs/components/product-picker-v2/productInfoOverlay.d.ts +0 -17
  57. package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +0 -39
  58. package/dist/esm/components/product-picker-v2/ProductPickerShimmer.d.ts +0 -3
  59. package/dist/esm/components/product-picker-v2/ProductPickerShimmer.js +0 -1
  60. package/dist/esm/components/product-picker-v2/ProductPickerTag.d.ts +0 -19
  61. package/dist/esm/components/product-picker-v2/ProductPickerTag.js +0 -1
  62. package/dist/esm/components/product-picker-v2/product.d.ts +0 -43
  63. package/dist/esm/components/product-picker-v2/product.js +0 -1
  64. package/dist/esm/components/product-picker-v2/productInfoOverlay.d.ts +0 -17
  65. package/dist/esm/components/product-picker-v2/productInfoOverlay.js +0 -39
@@ -1,15 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
3
- import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
2
+ import { Collection, SelectedItems } from '.';
3
+ import { SelectedCollectionsActions } from './reducers';
4
4
  interface SearchScreenInterface {
5
5
  customCollectionRestriction?: boolean;
6
6
  selectedCollections: SelectedItems;
7
- searchedCollections: SearchedItems;
8
- searchedCollectionsDispatch: React.Dispatch<SearchReducerActions>;
7
+ searchedCollections: SelectedItems;
9
8
  selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
10
9
  setScreen: React.Dispatch<React.SetStateAction<string>>;
11
- setCollectionId: React.Dispatch<React.SetStateAction<string>>;
12
- setSelectedCollectionId: React.Dispatch<React.SetStateAction<string>>;
13
10
  collections: {
14
11
  [key: string]: Collection;
15
12
  };
@@ -18,10 +15,6 @@ interface SearchScreenInterface {
18
15
  pickerType?: 'COLLECTION' | 'PRODUCT';
19
16
  hideProductVariants?: boolean;
20
17
  hideProductCheckbox?: boolean;
21
- storeId: string;
22
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
23
- hideCollectionCheckbox?: boolean;
24
- renderWithoutModal?: boolean;
25
18
  }
26
19
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
27
20
  export {};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o,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"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{const{customCollectionRestriction:C,selectedCollections:k,searchedCollections:y,searchedCollectionsDispatch:b,selectedCollectionsDispatch:f,setScreen:j,collections:I,onBackPress:P,hideVariantCheckbox:S,pickerType:x,hideProductVariants:O,hideProductCheckbox:g,storeId:D,fbStatusFetcher:T,setCollectionId:V,setSelectedCollectionId:w,hideCollectionCheckbox:R,renderWithoutModal:W}=m;i((()=>{var e;a(null!==(e=y.products)&&void 0!==e?e:{},D,b,T,"setProducts")}),[null==y?void 0:y.products]);const B=!!C&&(null==k?void 0:k.isCustom);return e("div",{children:[e(u,{children:[o(c,{Icon:l,onClick:()=>{j("collections"),P()}}),o(d,{children:"Searched Products"})]}),o("div",{children:Object.keys(null==y?void 0:y.products).length||Object.keys(null==y?void 0:y.collections).length?e(t,{children:[o(t,{children:Object.keys(null==y?void 0:y.collections).map((e=>o(s,{customCollectionRestriction:C,data:null==I?void 0:I[e],isDisabled:B&&!(null==k?void 0:k[e]),isChecked:!!(null==k?void 0:k[e]),isPartiallyChecked:p(e,null==I?void 0:I[e],k),selectedCollectionsDispatch:f,setCollectionId:V,setSelectedCollectionId:w,setScreen:j,id:e,hideCollectionCheckbox:R||"-1"===e,selectedCollections:k,renderWithoutModal:W,pickerType:x,usedInSearch:!0},e)))}),o(t,{children:Object.keys(null==y?void 0:y.products).map((e=>{var t,l;return Object.keys((null===(l=null===(t=null==y?void 0:y.products)||void 0===t?void 0:t[e])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let d=!1;return(null===(l=null==y?void 0:y.products)||void 0===l?void 0:l.isCustom)&&(d=!0),o(n,{collectionId:e,upliftAdditions:(o,t)=>((e,o,t)=>{var l;const i=v(t,null===(l=null==y?void 0:y.products)||void 0===l?void 0:l[e]);f({type:o,data:Object.assign(Object.assign({},i),{isRestricted:C})})})(e,o,t),productId:t,data:(null===(i=null==y?void 0:y.products)||void 0===i?void 0:i[e].products)[t],isProductPartiallyChecked:h(e,t,k,null===(c=y.products)||void 0===c?void 0:c[e]),selectedData:k,selectedCollectionsDispatch:f,viewOnly:d,hideProductCheckbox:g,hideVariantCheckbox:S,hideProductVariants:O,pickerType:x},t)}))}))})]}):o(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
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 l}from"../TypographyStyle.js";import{EmptyState as c}from"./emptyState.js";import{ProductGroup as d}from"./productScreen.js";import{SelectedScreenHeader as s}from"./style.js";import{liftTheStateUp as n}from"./utility.js";const u=u=>{const{customCollectionRestriction:a,selectedCollections:v,searchedCollections:p,selectedCollectionsDispatch:h,setScreen:m,collections:y,onBackPress:f,hideVariantCheckbox:j,pickerType:k,hideProductVariants:b,hideProductCheckbox:C}=u,O=(o,t)=>{var e,i,r,l,c,d,s,n,u;let a=0,p=0;return!!((null===(i=null===(e=null==v?void 0:v[o])||void 0===e?void 0:e.products)||void 0===i?void 0:i[t])&&(null===(d=Object.keys((null===(c=null===(l=null===(r=null==y?void 0:y[o])||void 0===r?void 0:r.products)||void 0===l?void 0:l[t])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>p++)),Object.keys((null===(u=null===(n=null===(s=null==v?void 0:v[o])||void 0===s?void 0:s.products)||void 0===n?void 0:n[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&p!==a))};return o("div",{children:[o(s,{children:[t(r,{Icon:i,onClick:()=>{m("collections"),f()}}),t(l,{children:"Searched Products"})]}),t("div",{children:Object.keys(p).length?t(e,{children:Object.keys(p).map((o=>{var e;return Object.keys((null===(e=null==p?void 0:p[o])||void 0===e?void 0:e.products)||[]).map((e=>{let i=!1;return(null==p?void 0:p.isCustom)&&(i=!0),t(d,{collectionId:o,upliftAdditions:(t,e)=>((o,t,e)=>{const i=n(e,p[o]);h({type:t,data:Object.assign(Object.assign({},i),{isRestricted:a})})})(o,t,e),productId:e,data:p[o].products[e],isProductPartiallyChecked:O(o,e),selectedData:v,selectedCollectionsDispatch:h,viewOnly:i,hideProductCheckbox:C,hideVariantCheckbox:j,hideProductVariants:b,pickerType:k},e)}))}))}):t(c,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{u as SearchScreen};
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { Collection, FbStatusFetcherReturn, SelectedItems } from '.';
2
+ import { Collection, SelectedItems } from '.';
3
3
  import { SelectedCollectionsActions } from './reducers';
4
- import { OUT_OF_STOCK_ACTION } from './type';
5
4
  interface SelectedScreenInterface {
6
5
  selectedCollections: SelectedItems;
7
6
  selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
@@ -9,9 +8,7 @@ interface SelectedScreenInterface {
9
8
  collections: {
10
9
  [key: string]: Collection;
11
10
  };
12
- outOfStockAction?: OUT_OF_STOCK_ACTION;
13
- storeId: string;
14
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
11
+ hideProductVariants?: boolean;
15
12
  }
16
13
  export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
17
14
  export {};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e,Fragment as r}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as n,useEffect as i}from"react";import{IconButton as s}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./product.js";import{paginationReducer as p}from"./reducers.js";import{SelectedScreenHeader as a}from"./style.js";import{paginateSelectedItems as m,fetchFbStatusCollection as f,isProductPartiallyChecked as h}from"./utility.js";const v=v=>{const{selectedCollections:y,selectedCollectionsDispatch:j,setScreen:b,collections:S,outOfStockAction:k,storeId:I,fbStatusFetcher:O}=v,g=c(0),C=c(null),[w,P]=n(p,{});return i((()=>{g.current=0;const t=m(y,10,0);P({type:"paginate",data:t}),f(t,I,P,O,"set"),g.current+=1}),[]),i((()=>{P({type:"filter",data:y})}),[y]),i((()=>{const t=new IntersectionObserver((t=>{if(t[0].isIntersecting&&g.current>0){const t=m(y,10,g.current);P({type:"paginate",data:t}),f(t,I,P,O,"update"),g.current+=1}}),{threshold:1});return C.current&&t.observe(C.current),()=>{C.current&&t.unobserve(C.current)}}),[C,y]),t("div",{children:[t(a,{children:[e(s,{Icon:o,onClick:()=>{b("collections")}}),e(l,{children:"Selected Products"})]}),t("div",{children:[Object.keys(w).length>0?e(r,{children:Object.keys(w).map((t=>{var r;return Object.keys((null===(r=null==w?void 0:w[t])||void 0===r?void 0:r.products)||[]).map((r=>{let o=!1;return(null==y?void 0:y.isCustom)&&(o=!0),e(u,{upliftAdditions:null,collectionId:t,productId:r,data:w[t].products[r],isProductPartiallyChecked:h(t,r,y,null==S?void 0:S[t]),selectedData:y,selectedCollectionsDispatch:j,viewOnly:o,outOfStockAction:k},r)}))}))}):e(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),e("div",{ref:C})]})]})};export{v as SelectedScreen};
1
+ import{jsxs as o,jsx as t,Fragment as e}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{IconButton as i}from"../icon-button/IconButton.js";import{BodyCaption as r}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{AllProductHelper as c}from"./helpers/AllProductHelper.js";import{ProductGroup as s}from"./productScreen.js";import{SelectedScreenHeader as n}from"./style.js";const u=u=>{const{selectedCollections:v,selectedCollectionsDispatch:a,setScreen:p,collections:m,hideProductVariants:h=!1}=u,j=(o,t)=>{var e,l,i,r,d,c,s,n,u;let a=0,p=0;return!!((null===(l=null===(e=null==v?void 0:v[o])||void 0===e?void 0:e.products)||void 0===l?void 0:l[t])&&(null===(c=Object.keys((null===(d=null===(r=null===(i=null==m?void 0:m[o])||void 0===i?void 0:i.products)||void 0===r?void 0:r[t])||void 0===d?void 0:d.variants)||[]))||void 0===c||c.forEach((()=>p++)),Object.keys((null===(u=null===(n=null===(s=null==v?void 0:v[o])||void 0===s?void 0:s.products)||void 0===n?void 0:n[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&p!==a))},f=h?c.removeDuplicatesForAllProducts(Object.assign({},v)):v;return o("div",{children:[o(n,{children:[t(i,{Icon:l,onClick:()=>{p("collections")}}),t(r,{children:"Selected Products"})]}),t("div",{children:Object.keys(f).length>0?t(e,{children:Object.keys(f).map((o=>{var e;return Object.keys((null===(e=null==f?void 0:f[o])||void 0===e?void 0:e.products)||[]).map((e=>{let l=!1;return(null==f?void 0:f.isCustom)&&(l=!0),t(s,{upliftAdditions:null,collectionId:o,productId:e,data:f[o].products[e],isProductPartiallyChecked:j(o,e),selectedData:f,selectedCollectionsDispatch:a,viewOnly:l,hideProductVariants:h},e)}))}))}):t(d,{title:"No Products Selected",subtitle:"Select products will appear here"})})]})};export{u as SelectedScreen};
@@ -3,7 +3,6 @@ export declare const ScrollContainerStyle: import("styled-components").StyledCom
3
3
  export declare const CollectionCardStyle: import("styled-components").StyledComponent<"div", any, {
4
4
  isDisabled: boolean;
5
5
  isActive: boolean;
6
- usedInSearch: boolean;
7
6
  }, never>;
8
7
  export declare const CollectionCardInfoStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
9
8
  export declare const CollectionCardDetailStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -1,26 +1,17 @@
1
1
  import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";const t=e.div`
2
2
  display: flex;
3
3
  background-color: white;
4
- height: 600px;
4
+ max-height: 600px;
5
+ min-height: 600px;
5
6
  flex-direction: column;
6
7
  `,o=e.div`
7
8
  overflow-y: scroll;
8
9
  overflow-x: hidden;
9
-
10
- ::-webkit-scrollbar {
11
- display: block;
12
- width: 8px;
13
- }
14
-
15
- ::-webkit-scrollbar-thumb {
16
- background-color: #888;
17
- border-radius: 8px;
18
- }
19
10
  `,n=e.div`
20
11
  height: 64px;
21
12
  background-color: ${e=>e.isDisabled?"#F0F0F0":e.isActive?i.background.positive.light:"white"};
22
13
  border-bottom: 1px solid #e0e0e0;
23
- padding: ${e=>e.usedInSearch?"12px 16px":"12px 24px"};
14
+ padding: 12px 24px;
24
15
  display: flex;
25
16
  flex-direction: row;
26
17
  column-gap: 16px;
@@ -40,7 +31,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
40
31
  display: flex;
41
32
  flex-direction: column;
42
33
  justify-content: center;
43
- `,p=e.div`
34
+ `,l=e.div`
44
35
  display: flex;
45
36
  flex-direction: row;
46
37
  max-height: 32px;
@@ -50,18 +41,15 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
50
41
  align-items: center;
51
42
  padding: 8px 16px;
52
43
  margin-top: 16px;
53
- position: sticky;
54
- top: 0;
55
- z-index: 10;
56
- `,l=e.div`
44
+ `,p=e.div`
57
45
  display: flex;
58
46
  flex-direction: row;
59
47
  column-gap: 16px;
60
48
  padding: 12px 16px;
61
49
  border-bottom: 1px solid #e0e0e0;
62
50
  align-items: center;
63
- `,c=e.div`
64
- min-height: 64px;
51
+ `,x=e.div`
52
+ height: 64px;
65
53
  background-color: ${e=>e.isActive?i.background.positive.light:"white"};
66
54
  border-bottom: 1px solid #e0e0e0;
67
55
  padding: 12px 16px;
@@ -75,7 +63,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
75
63
  cursor: pointer;
76
64
  background-color: ${i.surface.hovered};
77
65
  }
78
- `,x=e.div`
66
+ `,c=e.div`
79
67
  display: flex;
80
68
  flex-direction: row;
81
69
  max-height: 32px;
@@ -84,26 +72,18 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
84
72
  justify-content: flex-start;
85
73
  align-items: center;
86
74
  padding: 8px 16px;
87
- position: sticky;
88
- top: 0;
89
- z-index: 10;
90
75
  `,a=e.div`
91
76
  display: flex;
92
77
  flex-direction: column;
93
78
  `,s=e.div`
94
- min-height: 72px;
79
+ height: 72px;
95
80
  background: white;
96
81
  padding: 12px 16px;
97
82
  display: flex;
98
83
  flex-direction: row;
84
+ gap: 16px;
99
85
  align-items: center;
100
- justify-content: space-between;
101
-
102
- .text-container {
103
- display: flex;
104
- justify-content: space-between;
105
- gap: 16px;
106
- }
86
+ justify-content: center;
107
87
 
108
88
  .tooltip-title-tag {
109
89
  display: flex;
@@ -127,4 +107,4 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
127
107
  align-items: center;
128
108
  border: 1px solid ${i.stroke.primary};
129
109
  border-radius: 4px;
130
- `;export{d as CollectionCardDetailStyle,r as CollectionCardInfoStyle,n as CollectionCardStyle,a as CollectionNameHolder,t as ContainerStyle,c as ProductCardStyle,l as ProductScreenCollectionCardStyle,p as ProductScreenHeader,o as ScrollContainerStyle,x as SelectedScreenHeader,g as VariantCardGridStyle,s as VariantCardListStyle};
110
+ `;export{d as CollectionCardDetailStyle,r as CollectionCardInfoStyle,n as CollectionCardStyle,a as CollectionNameHolder,t as ContainerStyle,x as ProductCardStyle,p as ProductScreenCollectionCardStyle,l as ProductScreenHeader,o as ScrollContainerStyle,c as SelectedScreenHeader,g as VariantCardGridStyle,s as VariantCardListStyle};
@@ -1,38 +1 @@
1
- import { Collection, FbStatusFetcherReturn, Product, SelectedItems } from './modal';
2
- import { CollectionsActions } from './reducers';
3
1
  export declare const liftTheStateUp: (payload: any, data: any) => any;
4
- export declare function paginateSelectedItems(selectedItems: SelectedItems, limit: number, offset: number): {
5
- [key: string]: Collection;
6
- };
7
- /**
8
- * 3 scenarios.
9
- * 1. If no api is provided -> marks everything as approved.
10
- * 2. If api is success -> sets the status
11
- * 3. If api is failure -> marks everything as approved.
12
- *
13
- * We first get the variant ids to fetch and only if we have variant ids, we call api.
14
- */
15
- export declare const fetchFbStatusCollection: (data: SelectedItems, storeId: string, dispatcher: any, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, dispatchType?: string) => void;
16
- /**
17
- * Instead of collection level, we do it product level.
18
- *
19
- * For more info refer @function getVariantIdsToFetch
20
- */
21
- export declare const getVariantIdsToFetchAtProductLevel: (products: {
22
- [key: string]: Product;
23
- }, globalData?: Collection) => string[];
24
- /**
25
- * Instead of collection level, we do it product level.
26
- *
27
- * For more info refer @function markVariantsAsApproved
28
- */
29
- export declare const markVariantsAsApprovedProductsLevel: (products: {
30
- [key: string]: Product;
31
- }, dispatcher: React.Dispatch<CollectionsActions>, collectionId: string, curScreenData?: Collection, setCurScreenData?: React.Dispatch<React.SetStateAction<Collection>>) => void;
32
- /**
33
- * If product has only one variant and variant name has product name, returns false.
34
- * Other cases returns true.
35
- */
36
- export declare const shouldShowVariant: (data: Product) => boolean;
37
- export declare const isProductPartiallyChecked: (collectionId: string, productId: string, selectedData: SelectedItems, currentCollection: Collection) => boolean;
38
- export declare const isCollectionPartiallyChecked: (collectionId: string, collection: Collection, selectedCollections: SelectedItems) => boolean;
@@ -1 +1 @@
1
- import{cloneDeep as o}from"lodash";const l=(l,i)=>{const n=o(i);if(delete n.products,(l=Object.assign(Object.assign({},l),{catalogOnlyData:n})).productId&&i.products){const t=o(i.products[l.productId]);(null==t?void 0:t.variants)&&delete t.variants,l=Object.assign(Object.assign({},l),{catalogOnlyData:n,productOnlyData:t})}return l};function i(o,l,i){var t;const d={};let v=0;for(const s in o)if(Object.prototype.hasOwnProperty.call(o,s)){const u=o[s],c=n(u.products,l,i-v);c&&Object.keys(c).length>0&&(d[s]=Object.assign(Object.assign({},u),{products:c})),v+=Object.keys(null!==(t=u.products)&&void 0!==t?t:{}).length}return d}function n(o,l,i){if(!o)return{};const n=Object.keys(o).slice(i,i+l),t={};return n.forEach((l=>{t[l]=o[l]})),t}const t=(o,l,i)=>{Object.keys(o).forEach((l=>{var i,n;const t=null!==(n=null===(i=o[l])||void 0===i?void 0:i.products)&&void 0!==n?n:{};Object.keys(t).forEach((i=>{var n,t,d,v;const s=null!==(v=null===(d=null===(t=null===(n=o[l])||void 0===n?void 0:n.products)||void 0===t?void 0:t[i])||void 0===d?void 0:d.variants)&&void 0!==v?v:{};Object.keys(s).forEach((n=>{var t,d,v,s;const u=null===(s=null===(v=null===(d=null===(t=o[l])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[n];u&&!u.fbStatus&&(u.fbStatus="APPROVED")}))}))})),l({type:i,data:o})},d=function(o,l,i,n){let d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"paged";n||t(o,i,d);const v=(o=>{const l=[];return Object.keys(o).forEach((i=>{var n,t;const d=null!==(t=null===(n=o[i])||void 0===n?void 0:n.products)&&void 0!==t?t:{};Object.keys(d).forEach((n=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=o[i])||void 0===t?void 0:t.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=o[i])||void 0===d?void 0:d.products)||void 0===v?void 0:v[n])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];(null==c?void 0:c.fbStatus)||l.push(t)}))}))})),l})(o);v.length>0&&n&&n(l,v).then((l=>{const n=Object.assign({},o);Object.keys(n).forEach((o=>{var i,t;const d=null!==(t=null===(i=n[o])||void 0===i?void 0:i.products)&&void 0!==t?t:{};Object.keys(d).forEach((i=>{var t,d,v,s;const u=null!==(s=null===(v=null===(d=null===(t=n[o])||void 0===t?void 0:t.products)||void 0===d?void 0:d[i])||void 0===v?void 0:v.variants)&&void 0!==s?s:{};Object.keys(u).forEach((t=>{var d,v,s,u;const c=null===(u=null===(s=null===(v=null===(d=n[o])||void 0===d?void 0:d.products)||void 0===v?void 0:v[i])||void 0===s?void 0:s.variants)||void 0===u?void 0:u[t];c&&"REJECTED"===l[t]?c.fbStatus="REJECTED":c&&"APPROVED"===l[t]&&(c.fbStatus="APPROVED")}))}))})),i({type:d,data:n})})).catch((l=>{console.error("Error in fbStatusFetcher",l),t(o,i,d)}))},v=(o,l)=>{const i=[];return Object.keys(null!=o?o:{}).forEach((n=>{var t,d;const v=null!==(d=null===(t=null==o?void 0:o[n])||void 0===t?void 0:t.variants)&&void 0!==d?d:{};Object.keys(v).forEach((t=>{var d,v,s,u,c;let r;r=l?null===(s=null===(v=null===(d=null==l?void 0:l.products)||void 0===d?void 0:d[n])||void 0===v?void 0:v.variants)||void 0===s?void 0:s[t]:null===(c=null===(u=null==o?void 0:o[n])||void 0===u?void 0:u.variants)||void 0===c?void 0:c[t],(null==r?void 0:r.fbStatus)||i.push(t)}))})),i},s=(o,l,i,n,t)=>{const d=Object.assign({},o);if(Object.keys(o).forEach((l=>{var i,n;Object.keys(null!==(n=null===(i=null==o?void 0:o[l])||void 0===i?void 0:i.variants)&&void 0!==n?n:{}).forEach((i=>{var n,t;const v=null===(n=null==o?void 0:o[l].variants)||void 0===n?void 0:n[i];v&&(v.fbStatus="APPROVED");const s=null===(t=null==d?void 0:d[l])||void 0===t?void 0:t.variants;s&&s[i]&&(s[i]=v)}))})),n&&t){const o=Object.assign({},n);o.products=d,t(o),l({type:"productsPaged",data:{collectionId:i,products:d}})}else l({type:"productsPaged",data:{collectionId:i,products:d}})},u=o=>{const l=Object.keys(o.variants||[]);let i=!1;return!(l.length<=1)||(l.forEach((l=>{var n,t;i=null!==(t=null===(n=o.variants)||void 0===n?void 0:n[l].name.includes(o.name))&&void 0!==t&&t})),!i)},c=(o,l,i,n)=>{var t,d,v,s,u,c,r,a,e,f,p,b,O,h,j,y,E,k,g;let P=0,D=0;if(null===(d=null===(t=null==i?void 0:i[o])||void 0===t?void 0:t.products)||void 0===d?void 0:d[l]){const t=(null===(u=null===(s=null===(v=null==i?void 0:i[o])||void 0===v?void 0:v.products)||void 0===s?void 0:s[l])||void 0===u?void 0:u.variants)||[];if(1===Object.keys(t).length)for(const n in t){const t=null===(r=null===(c=null==i?void 0:i[o])||void 0===c?void 0:c.products)||void 0===r?void 0:r[l],d=null===(p=null===(f=null===(e=null===(a=null==i?void 0:i[o])||void 0===a?void 0:a.products)||void 0===e?void 0:e[l])||void 0===f?void 0:f.variants)||void 0===p?void 0:p[n];if(null===(b=null==d?void 0:d.name)||void 0===b?void 0:b.includes(null!==(O=null==t?void 0:t.name)&&void 0!==O?O:""))return!1}if(null===(y=Object.keys((null===(j=null===(h=null==n?void 0:n.products)||void 0===h?void 0:h[l])||void 0===j?void 0:j.variants)||[]))||void 0===y||y.forEach((()=>D++)),Object.keys((null===(g=null===(k=null===(E=null==i?void 0:i[o])||void 0===E?void 0:E.products)||void 0===k?void 0:k[l])||void 0===g?void 0:g.variants)||[]).forEach((()=>P++)),P>0&&D!==P)return!0}return!1},r=(o,l,i)=>{var n;let t=0,d=0;if(i[o]){const v=null==l?void 0:l.products;v&&Object.keys(v).forEach((o=>{var l;const i=null===(l=v[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>t+=1))}));const s=null===(n=i[o])||void 0===n?void 0:n.products;return s&&Object.keys(s).forEach((o=>{var l;const i=null===(l=s[o])||void 0===l?void 0:l.variants;i&&Object.keys(i).forEach((o=>d+=1))})),!(t<=0&&d>0)&&(d>0&&t!==d)}return!1};export{d as fetchFbStatusCollection,v as getVariantIdsToFetchAtProductLevel,r as isCollectionPartiallyChecked,c as isProductPartiallyChecked,l as liftTheStateUp,s as markVariantsAsApprovedProductsLevel,i as paginateSelectedItems,u as shouldShowVariant};
1
+ import{cloneDeep as t}from"lodash";const a=(a,s)=>{const o=t(s);if(delete o.products,(a=Object.assign(Object.assign({},a),{catalogOnlyData:o})).productId&&s.products){const c=t(s.products[a.productId]);(null==c?void 0:c.variants)&&delete c.variants,a=Object.assign(Object.assign({},a),{catalogOnlyData:o,productOnlyData:c})}return a};export{a as liftTheStateUp};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/delete.svg.js";import i from"../../assets/icons/drag_handle.svg.js";import{COLORS as r}from"../../constants/Theme.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as c}from"../TypographyStyle.js";import{truncate as s}from"./collectionScreen.js";import{ProductPickerTag as l}from"./ProductPickerTag.js";import{VariantCardListStyle as m,VariantCardGridStyle as d}from"./style.js";import{Tooltip as h}from"../tooltips/Tooltip.js";const p=d=>{const{data:p,selectedCollectionsDispatch:g,outOfStockAction:u}=d,j=t=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,t?s(e,34,!0):e};return t(m,{children:[t("div",Object.assign({className:"text-container"},{children:[e(i,{width:24,height:24,color:r.content.placeholder}),e("div",{children:e(n,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(h,Object.assign({body:j(!1),placement:"bottom",delay:400,variant:"light"},{children:e(c,{children:j(!0)})})),e(l,{isVariant:!0,data:p,outOfStockAction:u})]}))]})),e(a,{Icon:()=>e(o,{width:24,height:24,color:r.content.placeholder}),onClick:()=>{g&&g({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),d.onDelete&&d.onDelete()}})]})},g=t=>{const{data:o}=t;return e(d,{children:e(h,Object.assign({body:o.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(n,{width:72,height:72,imageUrl:o.image,alt:"Item",borderRadius:4})}))})};export{g as VariantCardGridView,p as VariantCardListView};
1
+ import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/delete.svg.js";import r from"../../assets/icons/drag_handle.svg.js";import{COLORS as a}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{TitleRegular as s}from"../TypographyStyle.js";import{truncate as c}from"./collectionScreen.js";import{ProductHelper as m}from"./helpers/ProductHelper.js";import{VariantCardListStyle as d,VariantCardGridStyle as h}from"./style.js";import{Tooltip as p}from"../tooltips/Tooltip.js";import{Tag as g}from"../tag/Tag.js";const j=h=>{const{data:j,selectedCollectionsDispatch:u,outOfStockAction:f}=h,b=m.getProductLabels(j,f),y=t=>{let e;return e=j.name.includes(j.productName)?j.name:`${j.productName} ${j.name}`,t?c(e,34,!0):e};return t(d,{children:[e(r,{width:24,height:24,color:a.content.placeholder}),e("div",{children:e(l,{width:40,height:40,imageUrl:j.image,alt:"Item",borderRadius:4},j.variantId)}),t("div",Object.assign({className:"tooltip-title-tag"},{children:[e(p,Object.assign({body:y(!1),placement:"bottom",delay:400},{children:e(s,{children:y(!0)})})),b?e("div",Object.assign({style:{width:90,display:"flex"}},{children:e(g,{tagText:b,type:"warning",theme:"light"})})):e(o,{})]})),e(n,{Icon:()=>e(i,{width:24,height:24,color:a.content.placeholder}),onClick:()=>{u&&u({type:"variantUnselected",data:{productId:j.productId,variantId:j.variantId,collectionId:j.collectionId}}),h.onDelete&&h.onDelete()}})]})},u=t=>{const{data:o}=t;return e(h,{children:e(p,Object.assign({body:o.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e(l,{width:72,height:72,imageUrl:o.image,alt:"Item",borderRadius:4})}))})};export{u as VariantCardGridView,j as VariantCardListView};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.455-beta.ppif-4",
3
+ "version": "0.0.456-0",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,3 +0,0 @@
1
- export declare const ProductPickerShimmer: (props: {
2
- limit?: number;
3
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../shimmer/ShimmerComponent/BikShimmer.js");exports.ProductPickerShimmer=i=>{const{limit:t}=i;return e.jsx(e.Fragment,{children:Array.from({length:null!=t?t:5}).map(((i,t)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(r.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),t)))})};
@@ -1,19 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- export type ProductPickerTagType = {
4
- isVariant: boolean;
5
- data: Product | ProductVariant;
6
- outOfStockAction?: OUT_OF_STOCK_ACTION;
7
- };
8
- /**
9
- * Used in Product Screen, Search Screen, Selected Screen and Rearrange Screen.
10
- * Wherever product card is shown, we use this component.
11
- *
12
- * New logic: When product has only one variant and variant name is same as product name,
13
- * we consider that a variant and do operations as variant.
14
- *
15
- * Note: If there is no Fb rejected tag in the variant, we show a shimmer,
16
- * meanwhile hit the API to get FB status.
17
- *
18
- */
19
- export declare const ProductPickerTag: (props: ProductPickerTagType) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../shimmer/ShimmerComponent/BikShimmer.js"),r=require("../tag/Tag.js"),i=require("./helpers/ProductHelper.js");exports.ProductPickerTag=s=>{var l,a;const{isVariant:n,data:o,outOfStockAction:u}=s;let d=o,c=n;1===Object.keys(null!==(l=null==o?void 0:o.variants)&&void 0!==l?l:{}).length&&(d=Object.values(null!==(a=null==o?void 0:o.variants)&&void 0!==a?a:{})[0],c=!0);const p=i.ProductHelper.getProductLabels(d,u),g=i.ProductHelper.getTagType(null!=p?p:"");return e.jsx("div",Object.assign({style:{display:"flex"}},{children:!(null==d?void 0:d.fbStatus)&&c?e.jsx(t.BikShimmer,{boxes:[{height:"24px",width:"100px",marginTop:"0px"}]}):p?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(r.Tag,{tagText:p,type:g,theme:"light"})})):e.jsx(e.Fragment,{})}))};
@@ -1,43 +0,0 @@
1
- /// <reference types="react" />
2
- import { Product, ProductVariant, SelectedItems } from './modal';
3
- import { SelectedCollectionsActions } from './reducers';
4
- import { OUT_OF_STOCK_ACTION } from './type';
5
- interface ProductGroupInterface {
6
- collectionId: string;
7
- productId: string;
8
- data: Product;
9
- selectedData: SelectedItems;
10
- selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
11
- viewOnly: boolean;
12
- isProductPartiallyChecked?: boolean;
13
- upliftAdditions: any;
14
- hideProductCheckbox?: boolean;
15
- outOfStockAction?: OUT_OF_STOCK_ACTION;
16
- hideVariantCheckbox?: boolean;
17
- hideProductVariants?: boolean;
18
- showProductDetailInfoIcon?: boolean;
19
- pickerType?: 'COLLECTION' | 'PRODUCT';
20
- onProductDetailClick?: (productData: Product | ProductVariant) => void;
21
- }
22
- export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
23
- interface ProductCardInterface {
24
- isVariant: boolean;
25
- data: Product | ProductVariant;
26
- productId: string;
27
- collectionId: string;
28
- variantId?: string;
29
- isSelected: boolean;
30
- selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
31
- viewOnly: boolean;
32
- isPartiallyChecked?: boolean;
33
- upliftAdditions: any;
34
- hideProductCheckbox?: boolean;
35
- outOfStockAction?: OUT_OF_STOCK_ACTION;
36
- hideVariantCheckbox?: boolean;
37
- hideProductVariants?: boolean;
38
- showProductDetailInfoIcon?: boolean;
39
- pickerType?: 'COLLECTION' | 'PRODUCT';
40
- onProductDetailClick?: (productData: Product | ProductVariant) => void;
41
- }
42
- export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
43
- export {};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),a=require("../TypographyStyle.js"),n=require("./ProductPickerTag.js"),l=require("./style.js"),s=require("./utility.js");const u=s=>{const{isVariant:u,data:h,productId:p,collectionId:v,variantId:I,isSelected:j,selectedCollectionsDispatch:k,viewOnly:x,upliftAdditions:y,isPartiallyChecked:C,hideProductCheckbox:P,outOfStockAction:f,hideVariantCheckbox:m,hideProductVariants:b,pickerType:g,onProductDetailClick:O,showProductDetailInfoIcon:S}=s;return e.jsxs(l.ProductCardStyle,Object.assign({isVariant:u,onClick:e=>{"PRODUCT"===g&&b&&(e.stopPropagation(),k({type:"reset",data:{}}),y("variantSelected",{productId:p,variantId:I||Object.keys(h.variants)[0],collectionId:v,variant:h}))},isActive:j},{children:[u&&!x&&!m||!u&&!x&&!P?e.jsx(o.CheckBox,{isChecked:j,isPartiallyChecked:C||!1,onValueChange:function(e){u?e?y("variantSelected",{productId:p,variantId:I,collectionId:v,variant:h}):k({type:"variantUnselected",data:{productId:p,variantId:I,collectionId:v}}):e?y("productSelected",{productId:p,collectionId:v,product:h}):k({type:"productUnselected",data:{productId:p,collectionId:v}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:h.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(r.Tooltip,Object.assign({variant:"light",body:h.name,placement:"bottom",delay:400},{children:e.jsx(a.BodyPrimary,Object.assign({numberOfLines:1},{children:h.name}))})),S&&e.jsx(c.IconButton,{onClick:()=>{null==O||O(h)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})),e.jsx(n.ProductPickerTag,{isVariant:u,data:h,outOfStockAction:f})]}))]}))};exports.ProductCard=u,exports.ProductGroup=t=>{const{collectionId:i,productId:o,data:c,selectedData:d,selectedCollectionsDispatch:r,viewOnly:a,upliftAdditions:n,isProductPartiallyChecked:l,hideProductCheckbox:h,outOfStockAction:p,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,onProductDetailClick:k,showProductDetailInfoIcon:x}=t,y=e=>{var t,c,r,a,n,l;if(!(null===(c=null===(t=null==d?void 0:d[i])||void 0===t?void 0:t.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(l=null===(n=null===(a=null===(r=null==d?void 0:d[i])||void 0===r?void 0:r.products)||void 0===a?void 0:a[o])||void 0===n?void 0:n.variants)||void 0===l?void 0:l[e])};return e.jsxs("div",{children:[e.jsx(u,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(P=null===(C=null==d?void 0:d[i])||void 0===C?void 0:C.products)||void 0===P?void 0:P[o]),isPartiallyChecked:l,selectedCollectionsDispatch:r,upliftAdditions:n,viewOnly:a,hideProductCheckbox:h,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,outOfStockAction:p,onProductDetailClick:k,showProductDetailInfoIcon:x},o),I?null:s.shouldShowVariant(c)&&Object.keys(c.variants||[]).map((t=>e.jsx(u,{isVariant:!0,hideVariantCheckbox:v,data:c.variants[t],variantId:t,productId:o,viewOnly:a,upliftAdditions:n,collectionId:i,isSelected:y(t),selectedCollectionsDispatch:r,outOfStockAction:p,onProductDetailClick:k,showProductDetailInfoIcon:x},t)))]});var C,P};
@@ -1,17 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- /**
4
- * When user presses i icon on a product, we show the overlay.
5
- * In case of a product, contains products image, product name & description
6
- * In case of a variant, contains variant image, variant name,
7
- * description as product name, variant tag
8
- */
9
- export declare const ProductInfoOverlay: (props: {
10
- productData: Product | ProductVariant;
11
- onClose: () => void;
12
- outOfStockAction?: OUT_OF_STOCK_ACTION;
13
- }) => import("react/jsx-runtime").JSX.Element;
14
- export declare const ProductInfoCard: (props: {
15
- productData: Product | ProductVariant;
16
- outOfStockAction?: OUT_OF_STOCK_ACTION;
17
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,39 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const c=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=l.default.div`
2
- display: flex;
3
- flex: 1;
4
- background: rgba(0, 0, 0, 0.5);
5
- flex-direction: column;
6
- width: 100%;
7
- height: 100%;
8
- position: absolute;
9
- bottom: 0;
10
- z-index: 10;
11
- `,p=l.default.div`
12
- display: flex;
13
- flex: 1;
14
- background: rgba(0, 0, 0, 0.5);
15
- `,x=l.default.div`
16
- position: relative;
17
-
18
- .close-button {
19
- position: absolute;
20
- top: -50px;
21
- right: 0px;
22
- margin: 10px;
23
- background: ${o.COLORS.surface.standard};
24
- border-radius: 50%;
25
- }
26
- `,f=l.default.div`
27
- display: flex;
28
- background: white;
29
- padding: 24px;
30
- gap: 24px;
31
- border-radius: 8px 8px 0px 0px;
32
- `,g=l.default.div`
33
- display: flex;
34
- `,h=l.default.div`
35
- display: flex;
36
- flex: 1;
37
- flex-direction: column;
38
- gap: 10px;
39
- `;exports.ProductInfoCard=c,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(c,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
@@ -1,3 +0,0 @@
1
- export declare const ProductPickerShimmer: (props: {
2
- limit?: number;
3
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- import{jsx as r,Fragment as i}from"react/jsx-runtime";import{BikShimmer as m}from"../shimmer/ShimmerComponent/BikShimmer.js";const t=t=>{const{limit:e}=t;return r(i,{children:Array.from({length:null!=e?e:5}).map(((i,t)=>r("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:r(m,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),t)))})};export{t as ProductPickerShimmer};
@@ -1,19 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- export type ProductPickerTagType = {
4
- isVariant: boolean;
5
- data: Product | ProductVariant;
6
- outOfStockAction?: OUT_OF_STOCK_ACTION;
7
- };
8
- /**
9
- * Used in Product Screen, Search Screen, Selected Screen and Rearrange Screen.
10
- * Wherever product card is shown, we use this component.
11
- *
12
- * New logic: When product has only one variant and variant name is same as product name,
13
- * we consider that a variant and do operations as variant.
14
- *
15
- * Note: If there is no Fb rejected tag in the variant, we show a shimmer,
16
- * meanwhile hit the API to get FB status.
17
- *
18
- */
19
- export declare const ProductPickerTag: (props: ProductPickerTagType) => import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- import{jsx as t,Fragment as e}from"react/jsx-runtime";import{BikShimmer as i}from"../shimmer/ShimmerComponent/BikShimmer.js";import{Tag as l}from"../tag/Tag.js";import{ProductHelper as r}from"./helpers/ProductHelper.js";const o=o=>{var s,n;const{isVariant:a,data:m,outOfStockAction:p}=o;let d=m,c=a;1===Object.keys(null!==(s=null==m?void 0:m.variants)&&void 0!==s?s:{}).length&&(d=Object.values(null!==(n=null==m?void 0:m.variants)&&void 0!==n?n:{})[0],c=!0);const u=r.getProductLabels(d,p),g=r.getTagType(null!=u?u:"");return t("div",Object.assign({style:{display:"flex"}},{children:!(null==d?void 0:d.fbStatus)&&c?t(i,{boxes:[{height:"24px",width:"100px",marginTop:"0px"}]}):u?t("div",Object.assign({style:{display:"flex"}},{children:t(l,{tagText:u,type:g,theme:"light"})})):t(e,{})}))};export{o as ProductPickerTag};
@@ -1,43 +0,0 @@
1
- /// <reference types="react" />
2
- import { Product, ProductVariant, SelectedItems } from './modal';
3
- import { SelectedCollectionsActions } from './reducers';
4
- import { OUT_OF_STOCK_ACTION } from './type';
5
- interface ProductGroupInterface {
6
- collectionId: string;
7
- productId: string;
8
- data: Product;
9
- selectedData: SelectedItems;
10
- selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
11
- viewOnly: boolean;
12
- isProductPartiallyChecked?: boolean;
13
- upliftAdditions: any;
14
- hideProductCheckbox?: boolean;
15
- outOfStockAction?: OUT_OF_STOCK_ACTION;
16
- hideVariantCheckbox?: boolean;
17
- hideProductVariants?: boolean;
18
- showProductDetailInfoIcon?: boolean;
19
- pickerType?: 'COLLECTION' | 'PRODUCT';
20
- onProductDetailClick?: (productData: Product | ProductVariant) => void;
21
- }
22
- export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
23
- interface ProductCardInterface {
24
- isVariant: boolean;
25
- data: Product | ProductVariant;
26
- productId: string;
27
- collectionId: string;
28
- variantId?: string;
29
- isSelected: boolean;
30
- selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
31
- viewOnly: boolean;
32
- isPartiallyChecked?: boolean;
33
- upliftAdditions: any;
34
- hideProductCheckbox?: boolean;
35
- outOfStockAction?: OUT_OF_STOCK_ACTION;
36
- hideVariantCheckbox?: boolean;
37
- hideProductVariants?: boolean;
38
- showProductDetailInfoIcon?: boolean;
39
- pickerType?: 'COLLECTION' | 'PRODUCT';
40
- onProductDetailClick?: (productData: Product | ProductVariant) => void;
41
- }
42
- export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
43
- export {};
@@ -1 +0,0 @@
1
- import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{BodyPrimary as r}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{ProductCardStyle as u}from"./style.js";import{shouldShowVariant as p}from"./utility.js";const h=o=>{const{collectionId:e,productId:c,data:d,selectedData:n,selectedCollectionsDispatch:l,viewOnly:a,upliftAdditions:r,isProductPartiallyChecked:s,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:m,hideProductVariants:I,pickerType:f,onProductDetailClick:k,showProductDetailInfoIcon:y}=o,C=t=>{var i,o,d,l,a,r;if(!(null===(o=null===(i=null==n?void 0:n[e])||void 0===i?void 0:i.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(r=null===(a=null===(l=null===(d=null==n?void 0:n[e])||void 0===d?void 0:d.products)||void 0===l?void 0:l[c])||void 0===a?void 0:a.variants)||void 0===r?void 0:r[t])};return t("div",{children:[i(v,{isVariant:!1,data:d,productId:c,collectionId:e,isSelected:!!(null===(b=null===(P=null==n?void 0:n[e])||void 0===P?void 0:P.products)||void 0===b?void 0:b[c]),isPartiallyChecked:s,selectedCollectionsDispatch:l,upliftAdditions:r,viewOnly:a,hideProductCheckbox:u,hideVariantCheckbox:m,hideProductVariants:I,pickerType:f,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},c),I?null:p(d)&&Object.keys(d.variants||[]).map((t=>i(v,{isVariant:!0,hideVariantCheckbox:m,data:d.variants[t],variantId:t,productId:c,viewOnly:a,upliftAdditions:r,collectionId:e,isSelected:C(t),selectedCollectionsDispatch:l,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},t)))]});var P,b},v=p=>{const{isVariant:h,data:v,productId:m,collectionId:I,variantId:f,isSelected:k,selectedCollectionsDispatch:y,viewOnly:C,upliftAdditions:P,isPartiallyChecked:b,hideProductCheckbox:j,outOfStockAction:g,hideVariantCheckbox:O,hideProductVariants:x,pickerType:D,onProductDetailClick:S,showProductDetailInfoIcon:V}=p;return t(u,Object.assign({isVariant:h,onClick:t=>{"PRODUCT"===D&&x&&(t.stopPropagation(),y({type:"reset",data:{}}),P("variantSelected",{productId:m,variantId:f||Object.keys(v.variants)[0],collectionId:I,variant:v}))},isActive:k},{children:[h&&!C&&!O||!h&&!C&&!j?i(d,{isChecked:k,isPartiallyChecked:b||!1,onValueChange:function(t){h?t?P("variantSelected",{productId:m,variantId:f,collectionId:I,variant:v}):y({type:"variantUnselected",data:{productId:m,variantId:f,collectionId:I}}):t?P("productSelected",{productId:m,collectionId:I,product:v}):y({type:"productUnselected",data:{productId:m,collectionId:I}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(a,Object.assign({variant:"light",body:v.name,placement:"bottom",delay:400},{children:i(r,Object.assign({numberOfLines:1},{children:v.name}))})),V&&i(n,{onClick:()=>{null==S||S(v)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(s,{isVariant:h,data:v,outOfStockAction:g})]}))]}))};export{v as ProductCard,h as ProductGroup};
@@ -1,17 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- /**
4
- * When user presses i icon on a product, we show the overlay.
5
- * In case of a product, contains products image, product name & description
6
- * In case of a variant, contains variant image, variant name,
7
- * description as product name, variant tag
8
- */
9
- export declare const ProductInfoOverlay: (props: {
10
- productData: Product | ProductVariant;
11
- onClose: () => void;
12
- outOfStockAction?: OUT_OF_STOCK_ACTION;
13
- }) => import("react/jsx-runtime").JSX.Element;
14
- export declare const ProductInfoCard: (props: {
15
- productData: Product | ProductVariant;
16
- outOfStockAction?: OUT_OF_STOCK_ACTION;
17
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,39 +0,0 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as d,BodyCaption as s}from"../TypographyStyle.js";import{ProductPickerTag as c}from"./ProductPickerTag.js";const l=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(p,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),p=i=>{var r;const e=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(n,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(s,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(r=i.productData.description)&&void 0!==r?r:""}}),t(c,{isVariant:e,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=i.div`
2
- display: flex;
3
- flex: 1;
4
- background: rgba(0, 0, 0, 0.5);
5
- flex-direction: column;
6
- width: 100%;
7
- height: 100%;
8
- position: absolute;
9
- bottom: 0;
10
- z-index: 10;
11
- `,u=i.div`
12
- display: flex;
13
- flex: 1;
14
- background: rgba(0, 0, 0, 0.5);
15
- `,x=i.div`
16
- position: relative;
17
-
18
- .close-button {
19
- position: absolute;
20
- top: -50px;
21
- right: 0px;
22
- margin: 10px;
23
- background: ${r.surface.standard};
24
- border-radius: 50%;
25
- }
26
- `,f=i.div`
27
- display: flex;
28
- background: white;
29
- padding: 24px;
30
- gap: 24px;
31
- border-radius: 8px 8px 0px 0px;
32
- `,g=i.div`
33
- display: flex;
34
- `,h=i.div`
35
- display: flex;
36
- flex: 1;
37
- flex-direction: column;
38
- gap: 10px;
39
- `;export{p as ProductInfoCard,l as ProductInfoOverlay};