@bikdotai/bik-component-library 0.0.453-beta.ppi-9 → 0.0.453

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 (57) hide show
  1. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +0 -1
  2. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  3. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -2
  4. package/dist/cjs/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  5. package/dist/cjs/components/product-picker-v2/modal.d.ts +3 -12
  6. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  7. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +3 -10
  8. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  9. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  10. package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
  11. package/dist/cjs/components/product-picker-v2/reducers.d.ts +0 -1
  12. package/dist/cjs/components/product-picker-v2/reducers.js +1 -1
  13. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -6
  14. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  15. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -5
  16. package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
  17. package/dist/cjs/components/product-picker-v2/style.js +7 -12
  18. package/dist/cjs/components/product-picker-v2/utility.d.ts +0 -10
  19. package/dist/cjs/components/product-picker-v2/utility.js +1 -1
  20. package/dist/cjs/components/product-picker-v2/variant.js +1 -1
  21. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +0 -1
  22. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  23. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.d.ts +0 -2
  24. package/dist/esm/components/product-picker-v2/helpers/ProductHelper.js +1 -1
  25. package/dist/esm/components/product-picker-v2/modal.d.ts +3 -12
  26. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  27. package/dist/esm/components/product-picker-v2/productScreen.d.ts +3 -10
  28. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  29. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -3
  30. package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
  31. package/dist/esm/components/product-picker-v2/reducers.d.ts +0 -1
  32. package/dist/esm/components/product-picker-v2/reducers.js +1 -1
  33. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -6
  34. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  35. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -5
  36. package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
  37. package/dist/esm/components/product-picker-v2/style.js +9 -14
  38. package/dist/esm/components/product-picker-v2/utility.d.ts +0 -10
  39. package/dist/esm/components/product-picker-v2/utility.js +1 -1
  40. package/dist/esm/components/product-picker-v2/variant.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/cjs/components/product-picker-v2/ProductPickerTag.d.ts +0 -8
  43. package/dist/cjs/components/product-picker-v2/ProductPickerTag.js +0 -1
  44. package/dist/cjs/components/product-picker-v2/productInfoOverlay.d.ts +0 -11
  45. package/dist/cjs/components/product-picker-v2/productInfoOverlay.js +0 -39
  46. package/dist/cjs/components/product-picker-v2/useFetchFbStatus copy.d.ts +0 -2
  47. package/dist/cjs/components/product-picker-v2/useFetchFbStatus copy.js +0 -1
  48. package/dist/cjs/components/product-picker-v2/useFetchFbStatus.d.ts +0 -5
  49. package/dist/cjs/components/product-picker-v2/useFetchFbStatus.js +0 -1
  50. package/dist/esm/components/product-picker-v2/ProductPickerTag.d.ts +0 -8
  51. package/dist/esm/components/product-picker-v2/ProductPickerTag.js +0 -1
  52. package/dist/esm/components/product-picker-v2/productInfoOverlay.d.ts +0 -11
  53. package/dist/esm/components/product-picker-v2/productInfoOverlay.js +0 -39
  54. package/dist/esm/components/product-picker-v2/useFetchFbStatus copy.d.ts +0 -2
  55. package/dist/esm/components/product-picker-v2/useFetchFbStatus copy.js +0 -1
  56. package/dist/esm/components/product-picker-v2/useFetchFbStatus.d.ts +0 -5
  57. package/dist/esm/components/product-picker-v2/useFetchFbStatus.js +0 -1
@@ -7,13 +7,10 @@ export interface ProductVariant {
7
7
  quantity: number;
8
8
  skipSync?: boolean;
9
9
  displayOrder?: number | null;
10
- fbStatus?: FbProductStatus;
11
- description?: string;
12
10
  }
13
11
  export interface Product {
14
12
  name: string;
15
13
  image: string;
16
- description?: string;
17
14
  variants?: {
18
15
  [key: string]: ProductVariant;
19
16
  };
@@ -41,10 +38,6 @@ export type CollectionFetcherReturn = Promise<{
41
38
  export type ProductFetcherReturn = Promise<{
42
39
  [key: string]: Product;
43
40
  }>;
44
- export type FbStatusFetcherReturn = Promise<{
45
- [key: string]: FbProductStatus;
46
- }>;
47
- export type FbProductStatus = 'APPROVED' | 'REJECTED';
48
41
  export declare enum ScreenName {
49
42
  Collections = "collections",
50
43
  RearrangeProducts = "rearrange",
@@ -56,11 +49,10 @@ export type ProductPickerInterface = {
56
49
  hideGlobalSearch?: boolean;
57
50
  hideInCollectionSearch?: boolean;
58
51
  customCollectionRestriction?: boolean;
59
- searchInCollectionFetcher: (storeId: string, collectionId: string, query: string) => ProductFetcherReturn;
60
- searchFetcher: (storeId: string, query: string, limit?: number, offset?: number) => Promise<SelectedItems>;
52
+ searchInCollectionFetcher: (storeId: string, collectionId: string, query: string) => Promise<string[]>;
53
+ searchFetcher: (storeId: string, query: string) => Promise<SelectedItems>;
61
54
  collectionFetcher: (offset: number, storeId: string) => CollectionFetcherReturn;
62
- productFetcher: (collectionId: string, storeId: string, limit?: number, offset?: number) => ProductFetcherReturn;
63
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
55
+ productFetcher: (collectionId: string, storeId: string) => ProductFetcherReturn;
64
56
  storeId: string;
65
57
  selectedItems: SelectedItems;
66
58
  onAdd: (items: SelectedItems, total: number) => void;
@@ -84,7 +76,6 @@ export type ProductPickerInterface = {
84
76
  hideProductVariants?: boolean;
85
77
  rearrangeEnabled?: boolean;
86
78
  selectSingleItem?: boolean;
87
- showProductDetailInfoIcon?: boolean;
88
79
  } & ({
89
80
  startupScreen: ScreenName.RearrangeProducts;
90
81
  rearrangeEnabled: true;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as n,useEffect as i}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as h}from"../modals/styledModal.js";import{Spinner as u}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,selectedColectionsReducer as S,CollectionIdContext as y}from"./reducers.js";import{SearchScreen as P}from"./searchScreen.js";import{SelectedScreen as j}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as x}from"./style.js";import{OUT_OF_STOCK_ACTION as k}from"./type.js";import{useFetchFbStatusForCollections as I}from"./useFetchFbStatus.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const T=T=>{const{storeId:O,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:$,hideCollectionCheckbox:V,hideProductCheckbox:B,outOfStockAction:L=k.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:G,title:H,width:W,renderWithoutModal:Y,onClickSave:K,pickerType:U,hideProductVariants:q=!1,startupScreen:J=F.Collections,rearrangeEnabled:N,selectSingleItem:Q=!1,showProductDetailInfoIcon:X}=T,[Z,_]=r(b,{}),[ee,te]=s([F.Collections,F.RearrangeProducts].includes(J)?J:F.Collections),[oe,ce]=s("grid"),[re,se]=s(""),[ne,ie]=s(""),[le,de]=s(0),[ae,he]=s(!1),[ue,pe]=s(0),[me,Ce]=s(""),[ge,fe]=s(!1),[be,Se]=s(!1),[ye,Pe]=s({}),[je,ve]=r(S,Object.keys(D).length>0?D:{}),xe=n(null),[ke,Ie]=s(!1),[Fe,Te]=s();I(je,O,ve,T.fbStatusFetcher,!1),i((()=>{he(!0),Se(!0),T.collectionFetcher(le,O).then((e=>{_({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),de((e=>e+1)),Se(!1)})).catch()}),[]),i((()=>{let e=0;Object.keys(je||[]).forEach((t=>{var o;Object.keys((null===(o=je[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=je[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),pe(e)})),i((()=>{}),[re]),i((()=>{ne&&(he(!0),T.productFetcher(ne,O).then((e=>{Object.keys(e).length&&_({type:"productsFetched",data:{collectionId:ne,products:e}}),he(!1)})).catch())}),[ne]),i((()=>{const e=setTimeout((()=>{"rearrange"!==ee&&(me.length?(fe(!0),T.searchFetcher(O,me,10,0).then((e=>{Pe(Object.assign({},e)),te("searchProducts"),he(!1),fe(!1)}))):te("collections"))}),800);return()=>clearTimeout(e)}),[me]),i((()=>{K&&(T.onAdd(je,ue),Oe())}),[K]),i((()=>{Q&&Object.keys(je||{}).length&&ue&&(T.onAdd(je,ue),Oe())}),[Q,je,ue]);const Oe=()=>{ve({type:"reset",data:{}})},De=e(v,{children:[T.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:T.postHeader})),!T.hideGlobalSearch&&t(o,{children:("collections"===ee||"searchProducts"===ee)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?t(u,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:me,onChangeText:e=>{e.length&&e.trim().length?Ce(e):Ce("")}})}))}),e(x,Object.assign({ref:xe},{children:["collections"===ee&&t(m,{customCollectionRestriction:T.customCollectionRestriction,dataLoading:be,collections:Z,selectedCollectionsDispatch:ve,setCollectionId:se,setSelectedCollectionId:ie,setScreen:te,selectedCollections:je,collectionFetcher:T.collectionFetcher,storeId:O,collectionsDispatch:_,setSaveDisabled:he,pagingControls:{curPage:le,setCurPage:de},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:U}),"products"===ee&&re&&t(y.Provider,Object.assign({value:re},{children:t(g,{hideInCollectionSearch:T.hideInCollectionSearch,customCollectionRestriction:T.customCollectionRestriction,productFetcher:T.productFetcher,setScreen:te,storeId:O,data:Z[re],collectionsDispatch:_,selectedCollectionsDispatch:ve,selectedData:je,setSaveDisabled:he,searchInCollectionFetcher:T.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:U,hideProductVariants:q,fbStatusFetcher:T.fbStatusFetcher,onInfoIconClick:e=>{Ie(!0),Te(e)},showProductDetailInfoIcon:X})})),"view"===ee&&t(j,{selectedCollections:je||{},selectedCollectionsDispatch:ve,setScreen:te,collections:Z,outOfStockAction:L,storeId:O,fbStatusFetcher:T.fbStatusFetcher}),"rearrange"===ee&&t(f,{selectedCollections:je||{},selectedCollectionsDispatch:ve,setScreen:te,outOfStockAction:L,rearrangeViewType:"grid"===oe?"list":"grid",scrollContainerRef:xe,storeId:O,fbStatusFetcher:T.fbStatusFetcher}),"searchProducts"===ee&&t(P,{customCollectionRestriction:T.customCollectionRestriction,selectedCollections:je||{},searchedCollections:ye||{},setSearchedCollections:Pe,selectedCollectionsDispatch:ve,setScreen:te,collections:Z,onBackPress:()=>{Ce(""),Pe({})},pickerType:U,hideProductCheckbox:B,hideProductVariants:q,hideVariantCheckbox:M,storeId:O,fbStatusFetcher:T.fbStatusFetcher,searchFetcher:T.searchFetcher,searchText:me})]}))]});return t(o,{children:Y?De:e(h,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),Oe()},headingTitle:H||("collections"===ee||"products"===ee?"Select Products":"view"===ee?"Selected Products":"searchProducts"===ee?"Searched Products":"rearrange"===ee?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:W||"600px"},headerRightCustomElement:"rearrange"===ee?(console.log("ignore:",ce),t(o,{})):t(o,{}),primaryButton:{buttonText:ae?"Loading...":ee===F.RearrangeProducts?"Done":"Add",disabled:ae||ue<1||A&&ue<A||!A&&$&&ue>$||!1,onClick:()=>{T.onAdd(je,ue),Oe()}},footerLeftCustomElement:G?t(o,{}):A&&ue>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):$&&ue>$?t(p,{tagText:`You can only select ${$} products`,type:"negative"}):t(d,ue>0?{onClick:()=>{te(N?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${ue}/${A} products selected`:`${ue} products selected`,buttonType:["rearrange","view"].includes(ee)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ee)}:{disabled:!0,buttonText:A?`${ue}/${A} products selected`:`${ue} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:ke},{children:[De,ke&&Fe?t(C,{productData:Fe,outOfStockAction:L,onClose:()=>{Ie(!1)}}):t(o,{})]}))})};export{T as ProductPickerModal,F as ScreenName};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as n}from"react";import{COLORS as l}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as C}from"./rearrangeScreen.js";import{collectionsReducer as b,selectedColectionsReducer as y,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as f}from"./selectedScreen.js";import{ContainerStyle as P,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as x}from"./type.js";var k;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(k||(k={}));const T=T=>{const{storeId:I,selectedItems:O,onClose:R,visible:D,zIndex:F,exactLimit:w,limit:E,hideCollectionCheckbox:$,hideProductCheckbox:A,outOfStockAction:V=x.BLUR,hideVariantCheckbox:B,selectProductsFromCustomCollection:L,hideSelectionCount:M,title:z,width:G,renderWithoutModal:H,onClickSave:W,pickerType:Y,hideProductVariants:K=!1,startupScreen:U=k.Collections,rearrangeEnabled:q,selectSingleItem:J=!1}=T,[N,Q]=r(b,{}),[X,Z]=s([k.Collections,k.RearrangeProducts].includes(U)?U:k.Collections),[_,ee]=s("grid"),[te,oe]=s(""),[ce,re]=s(0),[se,ie]=s(!1),[ne,le]=s(0),[de,ae]=s(""),[ue,he]=s(!1),[pe,me]=s(!1),[ge,Ce]=s(),[be,ye]=r(y,Object.keys(O).length>0?O:{}),ve=i(null);n((()=>{ie(!0),me(!0),T.collectionFetcher(ce,I).then((e=>{Q({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ie(!1),re((e=>e+1)),me(!1)})).catch()}),[]),n((()=>{let e=0;Object.keys(be||[]).forEach((t=>{var o;Object.keys((null===(o=be[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=be[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),le(e)})),n((()=>{var e;te&&!(null===(e=null==N?void 0:N[te])||void 0===e?void 0:e.products)&&(ie(!0),T.productFetcher(te,I).then((e=>{Object.keys(e).length&&Q({type:"productsFetched",data:{collectionId:te,products:e}}),ie(!1)})).catch())}),[te]),n((()=>{const e=setTimeout((()=>{"rearrange"!==X&&(de.length?(he(!0),T.searchFetcher(I,de).then((e=>{Ce(Object.assign({},e)),Z("searchProducts"),ie(!1),he(!1)}))):Z("collections"))}),800);return()=>clearTimeout(e)}),[de]),n((()=>{W&&(T.onAdd(be,ne),Se())}),[W]),n((()=>{J&&Object.keys(be||{}).length&&ne&&(T.onAdd(be,ne),Se())}),[J,be,ne]);const Se=()=>{ye({type:"reset",data:{}})},fe=e(P,{children:[T.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:T.postHeader})),!T.hideGlobalSearch&&t(o,{children:("collections"===X||"searchProducts"===X)&&t("div",Object.assign({style:{padding:H?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ue?t(h,{size:"small",color:l.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:de,onChangeText:e=>{e.length&&e.trim().length?ae(e):ae("")}})}))}),e(j,Object.assign({ref:ve},{children:["collections"===X&&t(m,{customCollectionRestriction:T.customCollectionRestriction,dataLoading:pe,collections:N,selectedCollectionsDispatch:ye,setCollectionId:oe,setScreen:Z,selectedCollections:be,collectionFetcher:T.collectionFetcher,storeId:I,collectionsDispatch:Q,setSaveDisabled:ie,pagingControls:{curPage:ce,setCurPage:re},hideCollectionCheckbox:$,renderWithoutModal:H,pickerType:Y}),"products"===X&&te&&t(v.Provider,Object.assign({value:te},{children:t(g,{hideInCollectionSearch:T.hideInCollectionSearch,customCollectionRestriction:T.customCollectionRestriction,productFetcher:T.productFetcher,setScreen:Z,storeId:I,data:N[te],collectionsDispatch:Q,selectedCollectionsDispatch:ye,selectedData:be,setSaveDisabled:ie,searchInCollectionFetcher:T.searchInCollectionFetcher,hideProductCheckbox:A,outOfStockAction:V,hideVariantCheckbox:B,selectProductsFromCustomCollection:L,renderWithoutModal:H,pickerType:Y,hideProductVariants:K})})),"view"===X&&t(f,{selectedCollections:be||{},selectedCollectionsDispatch:ye,setScreen:Z,collections:N}),"rearrange"===X&&t(C,{selectedCollections:be||{},selectedCollectionsDispatch:ye,setScreen:Z,outOfStockAction:V,rearrangeViewType:"grid"===_?"list":"grid",scrollContainerRef:ve}),"searchProducts"===X&&t(S,{customCollectionRestriction:T.customCollectionRestriction,selectedCollections:be||{},searchedCollections:ge||{},selectedCollectionsDispatch:ye,setScreen:Z,collections:N,onBackPress:()=>{ae(""),Ce({})},pickerType:Y,hideProductCheckbox:A,hideProductVariants:K,hideVariantCheckbox:B})]}))]});return t(o,{children:H?fe:t(u,Object.assign({zIndex:F,open:D,onClose:()=>{null==R||R(),Se()},headingTitle:z||("collections"===X||"products"===X?"Select Products":"view"===X?"Selected Products":"searchProducts"===X?"Searched Products":"rearrange"===X?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:G||"480px"},headerRightCustomElement:"rearrange"===X?(console.log("ignore:",ee),t(o,{})):t(o,{}),primaryButton:{buttonText:se?"Loading...":X===k.RearrangeProducts?"Done":"Add",disabled:se||ne<1||w&&ne<w||!w&&E&&ne>E||!1,onClick:()=>{T.onAdd(be,ne),Se()}},footerLeftCustomElement:M?t(o,{}):w&&ne>w?t(p,{tagText:`You can only select ${w} products`,type:"negative"}):E&&ne>E?t(p,{tagText:`You can only select ${E} products`,type:"negative"}):t(d,ne>0?{onClick:()=>{Z(q?k.RearrangeProducts:k.SelectedProducts)},buttonText:w?`${ne}/${w} products selected`:`${ne} products selected`,buttonType:["rearrange","view"].includes(X)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(X)}:{disabled:!0,buttonText:w?`${ne}/${w} products selected`:`${ne} products selected`,buttonType:"tertiaryGray"})},{children:fe}))})};export{T as ProductPickerModal,k as ScreenName};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Collection, FbStatusFetcherReturn, Product, ProductFetcherReturn, ProductVariant, SelectedItems } from '.';
2
+ import { Collection, Product, ProductFetcherReturn, ProductVariant, SelectedItems } from '.';
3
3
  import { CollectionsActions, SelectedCollectionsActions } from './reducers';
4
4
  import { OUT_OF_STOCK_ACTION } from './type';
5
5
  interface ProductsScreenInterface {
@@ -9,8 +9,8 @@ interface ProductsScreenInterface {
9
9
  collectionsDispatch: React.Dispatch<CollectionsActions>;
10
10
  selectedData: SelectedItems;
11
11
  selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
12
- searchInCollectionFetcher: (storeId: string, collectionId: string, query: string) => ProductFetcherReturn;
13
- productFetcher: (collectionId: string, storeId: string, limit?: number, offset?: number) => ProductFetcherReturn;
12
+ searchInCollectionFetcher: (storeId: string, collectionId: string, query: string) => Promise<string[]>;
13
+ productFetcher: (collectionId: string, storeId: string) => ProductFetcherReturn;
14
14
  storeId: string;
15
15
  setScreen: React.Dispatch<React.SetStateAction<string>>;
16
16
  setSaveDisabled: React.Dispatch<React.SetStateAction<boolean>>;
@@ -21,9 +21,6 @@ interface ProductsScreenInterface {
21
21
  renderWithoutModal?: boolean;
22
22
  pickerType?: 'COLLECTION' | 'PRODUCT';
23
23
  hideProductVariants?: boolean;
24
- showProductDetailInfoIcon?: boolean;
25
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
26
- onInfoIconClick: (productData: Product | ProductVariant) => void;
27
24
  }
28
25
  export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
29
26
  interface ProductGroupInterface {
@@ -39,9 +36,7 @@ interface ProductGroupInterface {
39
36
  outOfStockAction?: OUT_OF_STOCK_ACTION;
40
37
  hideVariantCheckbox?: boolean;
41
38
  hideProductVariants?: boolean;
42
- showProductDetailInfoIcon?: boolean;
43
39
  pickerType?: 'COLLECTION' | 'PRODUCT';
44
- onInfoIconClick?: (productData: Product | ProductVariant) => void;
45
40
  }
46
41
  export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
47
42
  interface ProductCardInterface {
@@ -59,9 +54,7 @@ interface ProductCardInterface {
59
54
  outOfStockAction?: OUT_OF_STOCK_ACTION;
60
55
  hideVariantCheckbox?: boolean;
61
56
  hideProductVariants?: boolean;
62
- showProductDetailInfoIcon?: boolean;
63
57
  pickerType?: 'COLLECTION' | 'PRODUCT';
64
- onInfoIconClick?: (productData: Product | ProductVariant) => void;
65
58
  }
66
59
  export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
67
60
  export {};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as o,Fragment as e}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import n from"../../assets/icons/box.svg.js";import c from"../../assets/icons/search.svg.js";import{cloneDeep as l}from"lodash";import{useContext as s,useRef as d,useState as r,useEffect as a}from"react";import{COLORS as u}from"../../constants/Theme.js";import v from"../../assets/icons/info.svg.js";import{CheckBox as h}from"../checkBox/CheckBox.js";import{IconButton as p}from"../icon-button/IconButton.js";import{Input as g}from"../input/Input.js";import{BikShimmer as f}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as b}from"../shimmer-image/ShimmerImage.js";import{Spinner as j}from"../spinner/Spinner.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as y,TitleRegular as k,BodyPrimary as I}from"../TypographyStyle.js";import{EmptyState as O}from"./emptyState.js";import{ProductPickerTag as C}from"./ProductPickerTag.js";import{CollectionIdContext as P}from"./reducers.js";import{ProductScreenHeader as S,ProductScreenCollectionCardStyle as x,ProductCardStyle as E}from"./style.js";import{OUT_OF_STOCK_ACTION as D}from"./type.js";import{liftTheStateUp as V}from"./utility.js";const w=e=>{const{data:v,collectionsDispatch:b,selectedData:m,selectedCollectionsDispatch:I,productFetcher:C,storeId:E,setScreen:w,setSaveDisabled:T,hideInCollectionSearch:F,customCollectionRestriction:R,hideProductCheckbox:B,outOfStockAction:U=D.BLUR,hideVariantCheckbox:L=!1,selectProductsFromCustomCollection:H=!1,pickerType:J,hideProductVariants:W,fbStatusFetcher:z,onInfoIconClick:K,showProductDetailInfoIcon:M}=e,N=s(P),_=d(null),q=d(0),[G,Q]=r(!1),[X,Y]=r(""),[Z,$]=r(!1),[tt,ot]=r(v),et=d(!1);a((()=>{const t=setTimeout((()=>{X.length?($(!0),e.searchInCollectionFetcher(E,N,X).then((t=>{const o=l(v);o.products=t,ot(o);const e=ct(null!=t?t:{},!0);lt(e,null!=t?t:{},!0),T(!1),$(!1)}))):ot(v)}),800);return()=>clearTimeout(t)}),[X]),a((()=>{var t,o,e,i,n,c,l,s;console.log("vj: collectionId change before",v,v.products,null===(o=Object.keys(null!==(t=v.products)&&void 0!==t?t:{}))||void 0===o?void 0:o.length,et),et.current=!1,q.current=Math.floor((null===(i=Object.keys(null!==(e=v.products)&&void 0!==e?e:{}))||void 0===i?void 0:i.length)/10);const d=ct(null!==(n=v.products)&&void 0!==n?n:{});lt(d,null!==(c=v.products)&&void 0!==c?c:{}),console.log("vj: collectionId change after",v,v.products,null===(s=Object.keys(null!==(l=v.products)&&void 0!==l?l:{}))||void 0===s?void 0:s.length,et)}),[N]);const it=!!R&&v.isSmartCollection,nt=t=>{var o,e,i,n,c,l,s,d;let r=0,a=0;return!!((null===(e=null===(o=null==m?void 0:m[N])||void 0===o?void 0:o.products)||void 0===e?void 0:e[t])&&(null===(c=Object.keys((null===(n=null===(i=null==v?void 0:v.products)||void 0===i?void 0:i[t])||void 0===n?void 0:n.variants)||[]))||void 0===c||c.forEach((()=>a++)),Object.keys((null===(d=null===(s=null===(l=null==m?void 0:m[N])||void 0===l?void 0:l.products)||void 0===s?void 0:s[t])||void 0===d?void 0:d.variants)||[]).forEach((()=>r++)),r>0&&a!==r))};a((()=>{(null==v?void 0:v.products)||st(10)}),[]);const ct=(t,o)=>{const e=[];return console.log("vj: getVariantIdsForFbStatusFetch",t),Object.keys(null!=t?t:{}).forEach((i=>{var n,c;const l=null!==(c=null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.variants)&&void 0!==c?c:{};Object.keys(l).forEach((n=>{var c,l,s,d,r;let a;a=o?null===(l=null===(c=null==t?void 0:t[i])||void 0===c?void 0:c.variants)||void 0===l?void 0:l[n]:null===(r=null===(d=null===(s=null==v?void 0:v.products)||void 0===s?void 0:s[i])||void 0===d?void 0:d.variants)||void 0===r?void 0:r[n],console.log("vj: variant fb status",{data:v,variant:a}),(null==a?void 0:a.fbStatus)||e.push(n)}))})),console.log("vj: getVariantIdsForFbStatusFetch returning",e),e},lt=(t,o,e)=>{if(console.log("fetchFbStatusAndDispatchProducts",{variantIdsToFetchFbStatus:t,fbStatusFetcher:z}),!z){const t=Object.assign({},o);if(Object.keys(o).forEach((e=>{var i,n,c;console.log("vj: response variants",null===(i=null==o?void 0:o[e])||void 0===i?void 0:i.variants),Object.keys(null!==(c=null===(n=null==o?void 0:o[e])||void 0===n?void 0:n.variants)&&void 0!==c?c:{}).forEach((i=>{var n,c;const l=null===(n=null==o?void 0:o[e].variants)||void 0===n?void 0:n[i];l&&(l.fbStatus="APPROVED");const s=null===(c=null==t?void 0:t[e])||void 0===c?void 0:c.variants;s&&s[i]&&(s[i]=l)}))})),console.log("vj: fetchFbStatusAndDispatchProducts updated Products",t),e){const o=Object.assign({},tt);o.products=t,ot(o)}else b({type:"productsPaged",data:{collectionId:N,products:t}})}t.length>0&&z&&z(E,t).then((t=>{console.log("vj: response",{response:t,products:o});const i=Object.assign({},o);if(Object.keys(o).forEach((e=>{var n,c,l;console.log("vj: response variants",null===(n=null==o?void 0:o[e])||void 0===n?void 0:n.variants),Object.keys(null!==(l=null===(c=null==o?void 0:o[e])||void 0===c?void 0:c.variants)&&void 0!==l?l:{}).forEach((n=>{var c,l;const s=null===(c=null==o?void 0:o[e].variants)||void 0===c?void 0:c[n];console.log("vj: v",{v:s,vId:n,status:t[n],response:t}),s&&"REJECTED"===t[n]?s.fbStatus="REJECTED":s&&"APPROVED"===t[n]&&(s.fbStatus="APPROVED");const d=null===(l=null==i?void 0:i[e])||void 0===l?void 0:l.variants;d&&d[n]&&(d[n]=s)}))})),console.log("vj: updated Products",i),e){const t=Object.assign({},tt);t.products=i,ot(t)}else b({type:"productsPaged",data:{collectionId:N,products:i}})})).catch((t=>{const i=Object.assign({},o);if(Object.keys(o).forEach((t=>{var e,n,c;console.log("vj: response variants",null===(e=null==o?void 0:o[t])||void 0===e?void 0:e.variants),Object.keys(null!==(c=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.variants)&&void 0!==c?c:{}).forEach((e=>{var n,c;const l=null===(n=null==o?void 0:o[t].variants)||void 0===n?void 0:n[e];l&&(l.fbStatus="APPROVED");const s=null===(c=null==i?void 0:i[t])||void 0===c?void 0:c.variants;s&&s[e]&&(s[e]=l)}))})),console.log("vj: fetchFbStatusAndDispatchProducts updated Products",i),e){const t=Object.assign({},tt);t.products=i,ot(t)}else b({type:"productsPaged",data:{collectionId:N,products:i}})}))};a((()=>{console.log("vj: observertarget",_.current);const t=new IntersectionObserver((t=>{console.log("vj: observertargetinside",t),t[0].isIntersecting&&(console.log("vj: nextPageRef",q.current,et),q.current>=0&&!et.current&&(T(!0),Q(!0),C(N,E,10,q.current).then((t=>{if(console.log("vj: fetched products",t,et,Object.keys(t).length),Object.keys(t).length||(console.log("vj: setHasAllCollectionLoaded ",!0),et.current=!0),Object.keys(t).length){const o=tt;o.products=Object.assign(Object.assign({},tt.products),t),ot(o);const e=ct(t);lt(e,t),q.current+=1}Q(!1),T(!1)})).catch()))}),{threshold:1});return _.current&&t.observe(_.current),()=>{_.current&&t.unobserve(_.current)}}),[_]);const st=t=>{console.log("vj: getProductsForCollection"),T(!0),$(!0),C(N,E,t,0).then((o=>{if(Object.keys(o).length||(console.log("vj: setHasAllCollectionLoaded ",!0),et.current=!0),Object.keys(o).length){ot(Object.assign(Object.assign({},tt),{products:o})),console.log("vj: next page when products loaded",q.current);const t=ct(o);lt(t,o),q.current=1}console.log("vj: product data",{productData:o,limit:t,data:v}),t||I({type:"selected",data:{id:N,val:Object.assign(Object.assign({},v),{products:o})}}),T(!1),$(!1)})).catch()},dt=(t,o)=>{const e=V(o,v);I({type:t,data:Object.assign(Object.assign({},e),{isRestricted:R})})};return t("div",{children:[t(S,{children:[o(p,{Icon:i,height:16,onClick:()=>{w("collections")}}),o(y,Object.assign({style:{color:u.content.secondary}},{children:v.name}))]}),!F&&o("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:o(g,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Z&&X.length?o(j,{size:"small",color:u.content.primary}):o(c,{})},id:"listInput",height:"24px",type:"text",value:X,onChangeText:t=>{t.length&&t.trim().length?Y(t):Y("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==tt?void 0:tt.products)||[]).length>0&&!it&&!X.length&&!B&&"-1"!==N&&t(x,{children:[o(h,{isChecked:!!(null==m?void 0:m[N]),isPartiallyChecked:(t=>{var o;let e=0,i=0;if(m[t]){const n=null==v?void 0:v.products;n&&Object.keys(n).forEach((t=>{var o;const i=null===(o=n[t])||void 0===o?void 0:o.variants;i&&Object.keys(i).forEach((t=>e+=1))}));const c=null===(o=m[t])||void 0===o?void 0:o.products;return c&&Object.keys(c).forEach((t=>{var o;const e=null===(o=c[t])||void 0===o?void 0:o.variants;e&&Object.keys(e).forEach((()=>i+=1))})),i>0&&e!==i}return!1})(N),onValueChange:function(t){t?st():I({type:"unselected",data:{id:N}})}}),o("div",Object.assign({style:{width:40,height:40}},{children:o(n,{})})),o(k,{children:"All Products"})]}),Object.keys((null==tt?void 0:tt.products)||[]).length?Object.keys(tt.products||[]).map((t=>o(A,{outOfStockAction:U,collectionId:N,isProductPartiallyChecked:nt(t),productId:t,data:tt.products[t],selectedData:m,selectedCollectionsDispatch:I,viewOnly:!H&&!!it,upliftAdditions:dt,hideProductCheckbox:B,hideVariantCheckbox:L,hideProductVariants:W,pickerType:J,onInfoIconClick:K,showProductDetailInfoIcon:M},t))):Z?[1,2,3,4,5,6,7,8,9,10].map(((t,e)=>o("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:o(f,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),e))):o(O,{title:"No products to show",subtitle:X.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."}),o("div",{ref:_})]}),G&&[1,2,3,4,5].map(((t,e)=>o("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:o(f,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),e)))]})},A=e=>{const{collectionId:i,productId:n,data:c,selectedData:l,selectedCollectionsDispatch:s,viewOnly:d,upliftAdditions:r,isProductPartiallyChecked:a,hideProductCheckbox:u,outOfStockAction:v,hideVariantCheckbox:h,hideProductVariants:p,pickerType:g,onInfoIconClick:f,showProductDetailInfoIcon:b}=e,j=t=>{var o,e,c,s,d,r;if(!(null===(e=null===(o=null==l?void 0:l[i])||void 0===o?void 0:o.products)||void 0===e?void 0:e[n]))return!1;return!!(null===(r=null===(d=null===(s=null===(c=null==l?void 0:l[i])||void 0===c?void 0:c.products)||void 0===s?void 0:s[n])||void 0===d?void 0:d.variants)||void 0===r?void 0:r[t])};return t("div",{children:[o(T,{isVariant:!1,data:c,productId:n,collectionId:i,isSelected:!!(null===(y=null===(m=null==l?void 0:l[i])||void 0===m?void 0:m.products)||void 0===y?void 0:y[n]),isPartiallyChecked:a,selectedCollectionsDispatch:s,upliftAdditions:r,viewOnly:d,hideProductCheckbox:u,hideVariantCheckbox:h,hideProductVariants:p,pickerType:g,outOfStockAction:v,onInfoIconClick:f,showProductDetailInfoIcon:b},n),p?null:Object.keys(c.variants||[]).length>1&&Object.keys(c.variants||[]).map((t=>o(T,{isVariant:!0,hideVariantCheckbox:h,data:c.variants[t],variantId:t,productId:n,viewOnly:d,upliftAdditions:r,collectionId:i,isSelected:j(t),selectedCollectionsDispatch:s,outOfStockAction:v,onInfoIconClick:f,showProductDetailInfoIcon:b},t)))]});var m,y},T=i=>{const{isVariant:n,data:c,productId:l,collectionId:s,variantId:d,isSelected:r,selectedCollectionsDispatch:a,viewOnly:g,upliftAdditions:f,isPartiallyChecked:j,hideProductCheckbox:y,outOfStockAction:k,hideVariantCheckbox:O,hideProductVariants:P,pickerType:S,onInfoIconClick:x,showProductDetailInfoIcon:D}=i;return t(E,Object.assign({isVariant:n,onClick:t=>{"PRODUCT"===S&&P&&(t.stopPropagation(),a({type:"reset",data:{}}),f("variantSelected",{productId:l,variantId:d||Object.keys(c.variants)[0],collectionId:s,variant:c}))},isActive:r},{children:[n&&!g&&!O||!n&&!g&&!y?o(h,{isChecked:r,isPartiallyChecked:j||!1,onValueChange:function(t){n?t?f("variantSelected",{productId:l,variantId:d,collectionId:s,variant:c}):a({type:"variantUnselected",data:{productId:l,variantId:d,collectionId:s}}):t?f("productSelected",{productId:l,collectionId:s,product:c}):a({type:"productUnselected",data:{productId:l,collectionId:s}})}}):o(e,{}),o("div",{children:o(b,{width:40,height:40,imageUrl:c.image,alt:"Item",borderRadius:4})}),o(m,Object.assign({variant:"light",body:c.name,placement:"bottom",delay:400},{children: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:[o(I,Object.assign({numberOfLines:1},{children:c.name})),D&&o(p,{onClick:()=>{null==x||x(c)},Icon:()=>o(v,{width:20,height:20,color:u.content.placeholder})})]})),o(C,{isVariant:n,data:c,outOfStockAction:k})]}))}))]}))};export{T as ProductCard,A as ProductGroup,w as ProductsScreen};
1
+ import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import i from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import d from"../../assets/icons/search.svg.js";import{cloneDeep as r}from"lodash";import{useContext as n,useState as l,useEffect as s}from"react";import{Tag as a}from"../tag/Tag.js";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as p}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as v}from"../input/Input.js";import{BikShimmer as m}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as y}from"../shimmer-image/ShimmerImage.js";import{Spinner as f}from"../spinner/Spinner.js";import{Tooltip as g}from"../tooltips/Tooltip.js";import{BodyCaption as k,TitleRegular as b}from"../TypographyStyle.js";import{truncate as j}from"./collectionScreen.js";import{EmptyState as C}from"./emptyState.js";import{ProductHelper as I}from"./helpers/ProductHelper.js";import{CollectionIdContext as O}from"./reducers.js";import{ProductScreenHeader as x,ProductScreenCollectionCardStyle as P,ProductCardStyle as S}from"./style.js";import{OUT_OF_STOCK_ACTION as V}from"./type.js";import{liftTheStateUp as T}from"./utility.js";const w=o=>{const a=n(O),{data:y,collectionsDispatch:g,selectedData:j,selectedCollectionsDispatch:I,productFetcher:S,storeId:w,setScreen:E,setSaveDisabled:A,hideInCollectionSearch:B,customCollectionRestriction:R,hideProductCheckbox:U,outOfStockAction:F=V.BLUR,hideVariantCheckbox:H=!1,selectProductsFromCustomCollection:L=!1,pickerType:W,hideProductVariants:z}=o,[K,N]=l(""),[_,q]=l(!1),[G,J]=l(y);s((()=>{const t=setTimeout((()=>{K.length?(q(!0),o.searchInCollectionFetcher(w,a,K).then((t=>{var e;const o=r(y);o.products={};for(const i of t)(null===(e=null==y?void 0:y.products)||void 0===e?void 0:e[i])&&(o.products[i]=y.products[i]);J(o),A(!1),q(!1)}))):J(y)}),800);return()=>clearTimeout(t)}),[K]);const M=!!R&&y.isSmartCollection,Q=t=>{var e,o,i,c,d,r,n,l;let s=0,u=0;return!!((null===(o=null===(e=null==j?void 0:j[a])||void 0===e?void 0:e.products)||void 0===o?void 0:o[t])&&(null===(d=Object.keys((null===(c=null===(i=null==y?void 0:y.products)||void 0===i?void 0:i[t])||void 0===c?void 0:c.variants)||[]))||void 0===d||d.forEach((()=>u++)),Object.keys((null===(l=null===(n=null===(r=null==j?void 0:j[a])||void 0===r?void 0:r.products)||void 0===n?void 0:n[t])||void 0===l?void 0:l.variants)||[]).forEach((()=>s++)),s>0&&u!==s))};s((()=>{(null==y?void 0:y.products)||X()}),[]);const X=()=>{A(!0),q(!0),S(a,w).then((t=>{Object.keys(t).length&&(g({type:"productsFetched",data:{collectionId:a,products:t}}),J(Object.assign(Object.assign({},G),{products:t}))),A(!1),q(!1)})).catch()},Y=(t,e)=>{const o=T(e,y);I({type:t,data:Object.assign(Object.assign({},o),{isRestricted:R})})};return t("div",{children:[t(x,{children:[e(h,{Icon:i,height:16,onClick:()=>{E("collections")}}),e(k,Object.assign({style:{color:u.content.secondary}},{children:y.name}))]}),!B&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(v,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>_&&K.length?e(f,{size:"small",color:u.content.primary}):e(d,{})},id:"listInput",height:"24px",type:"text",value:K,onChangeText:t=>{t.length&&t.trim().length?N(t):N("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==G?void 0:G.products)||[]).length>0&&!M&&!K.length&&!U&&t(P,{children:[e(p,{isChecked:!!(null==j?void 0:j[a]),isPartiallyChecked:(t=>{var e;let o=0,i=0;if(j[t]){const c=null==y?void 0:y.products;c&&Object.keys(c).forEach((t=>{var e;const i=null===(e=c[t])||void 0===e?void 0:e.variants;i&&Object.keys(i).forEach((t=>o+=1))}));const d=null===(e=j[t])||void 0===e?void 0:e.products;return d&&Object.keys(d).forEach((t=>{var e;const o=null===(e=d[t])||void 0===e?void 0:e.variants;o&&Object.keys(o).forEach((()=>i+=1))})),i>0&&o!==i}return!1})(a),onValueChange:function(t){I(t?{type:"selected",data:{id:a,val:y}}:{type:"unselected",data:{id:a}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(b,{children:"All Products"})]}),Object.keys((null==G?void 0:G.products)||[]).length?Object.keys(G.products||[]).map((t=>e(D,{outOfStockAction:F,collectionId:a,isProductPartiallyChecked:Q(t),productId:t,data:G.products[t],selectedData:j,selectedCollectionsDispatch:I,viewOnly:!L&&!!M,upliftAdditions:Y,hideProductCheckbox:U,hideVariantCheckbox:H,hideProductVariants:z,pickerType:W},t))):_?[1,2,3,4,5,6,7,8,9,10].map(((t,o)=>e("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e(m,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),o))):e(C,{title:"No products to show",subtitle:K.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})},D=o=>{const{collectionId:i,productId:c,data:d,selectedData:r,selectedCollectionsDispatch:n,viewOnly:l,upliftAdditions:s,isProductPartiallyChecked:a,hideProductCheckbox:u,outOfStockAction:p,hideVariantCheckbox:h,hideProductVariants:v,pickerType:m}=o,y=t=>{var e,o,d,n,l,s;if(!(null===(o=null===(e=null==r?void 0:r[i])||void 0===e?void 0:e.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(s=null===(l=null===(n=null===(d=null==r?void 0:r[i])||void 0===d?void 0:d.products)||void 0===n?void 0:n[c])||void 0===l?void 0:l.variants)||void 0===s?void 0:s[t])};return t("div",{children:[e(E,{isVariant:!1,data:d,productId:c,collectionId:i,isSelected:!!(null===(g=null===(f=null==r?void 0:r[i])||void 0===f?void 0:f.products)||void 0===g?void 0:g[c]),isPartiallyChecked:a,selectedCollectionsDispatch:n,upliftAdditions:s,viewOnly:l,hideProductCheckbox:u,hideVariantCheckbox:h,hideProductVariants:v,pickerType:m},c),v?null:Object.keys(d.variants||[]).map((t=>e(E,{isVariant:!0,hideVariantCheckbox:h,data:d.variants[t],variantId:t,productId:c,viewOnly:l,upliftAdditions:s,collectionId:i,isSelected:y(t),selectedCollectionsDispatch:n,outOfStockAction:p},t)))]});var f,g},E=i=>{const{isVariant:c,data:d,productId:r,collectionId:n,variantId:l,isSelected:s,selectedCollectionsDispatch:u,viewOnly:h,upliftAdditions:v,isPartiallyChecked:m,hideProductCheckbox:f,outOfStockAction:k,hideVariantCheckbox:C,hideProductVariants:O,pickerType:x}=i,P=I.getProductLabels(d,k);return t(S,Object.assign({isVariant:c,onClick:t=>{"PRODUCT"===x&&O&&(t.stopPropagation(),u({type:"reset",data:{}}),v("variantSelected",{productId:r,variantId:l||Object.keys(d.variants)[0],collectionId:n,variant:d}))},isActive:s},{children:[c&&!h&&!C||!c&&!h&&!f?e(p,{isChecked:s,isPartiallyChecked:m||!1,onValueChange:function(t){c?t?v("variantSelected",{productId:r,variantId:l,collectionId:n,variant:d}):u({type:"variantUnselected",data:{productId:r,variantId:l,collectionId:n}}):t?v("productSelected",{productId:r,collectionId:n,product:d}):u({type:"productUnselected",data:{productId:r,collectionId:n}})}}):e(o,{}),e("div",{children:e(y,{width:40,height:40,imageUrl:d.image,alt:"Item",borderRadius:4})}),e(g,Object.assign({body:d.name,placement:"bottom",delay:400},{children:t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e(b,{children:j(d.name,40,!0)}),P?e("div",Object.assign({style:{width:90,display:"flex"}},{children:e(a,{tagText:P,type:"warning",theme:"light"})})):e(o,{})]}))}))]}))};export{E as ProductCard,D as ProductGroup,w as ProductsScreen};
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { FbStatusFetcherReturn, SelectedItems } from '.';
2
+ import { SelectedItems } from '.';
3
3
  import { SelectedCollectionsActions } from './reducers';
4
4
  import { OUT_OF_STOCK_ACTION } from './type';
5
5
  interface RearrangeScreenInterface {
@@ -9,8 +9,6 @@ interface RearrangeScreenInterface {
9
9
  rearrangeViewType: 'grid' | 'list';
10
10
  outOfStockAction?: OUT_OF_STOCK_ACTION;
11
11
  scrollContainerRef: React.RefObject<HTMLDivElement>;
12
- storeId: string;
13
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
14
12
  }
15
13
  /**
16
14
  * Screen will be opened on two conditions -
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as c}from"react-beautiful-dnd";import{COLORS as i}from"../../constants/Theme.js";import{IconButton as n}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as a}from"./emptyState.js";import{parseSelectedVariantsToArray as d}from"./helpers/ProductHelper.js";import{SelectedScreenHeader as p}from"./style.js";import{useFetchFbStatusForCollections as m}from"./useFetchFbStatus.js";import{VariantsList as u,VariantsGrid as f}from"./variantComponents.js";const h=h=>{const{selectedCollections:j,selectedCollectionsDispatch:S,setScreen:y,rearrangeViewType:b,outOfStockAction:g,scrollContainerRef:C,storeId:O,fbStatusFetcher:v}=h,[V,k]=r(d(j)),{fetchFbStatus:w}=m(j,O,S,v,!1);s((()=>{var t;null===(t=null==C?void 0:C.current)||void 0===t||t.scrollTo({top:0}),w(),k(d(j))}),[j]);return t(c,Object.assign({onDragEnd:t=>{if(!t.destination)return;const e=V,[o]=e.splice(t.source.index,1);e.splice(t.destination.index,0,o),e.forEach(((t,e)=>{t.displayOrder=e})),k(e)}},{children:[t(p,{children:[e(n,{Icon:o,width:16,height:16,color:i.content.secondary,onClick:()=>{y("collections")}}),e(l,Object.assign({color:i.content.secondary},{children:"All Products"}))]}),Object.keys(j).length>0?"list"===b?e(u,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:S,outOfStockAction:g}):e(f,{selectedVariants:V,setSelectedVariants:k,selectedCollectionsDispatch:S}):e(a,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};export{h as RearrangeScreen};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import{useState as r,useEffect as s}from"react";import{DragDropContext as c}from"react-beautiful-dnd";import{COLORS as n}from"../../constants/Theme.js";import{IconButton as i}from"../icon-button/IconButton.js";import{BodyCaption as l}from"../TypographyStyle.js";import{EmptyState as a}from"./emptyState.js";import{parseSelectedVariantsToArray as d}from"./helpers/ProductHelper.js";import{SelectedScreenHeader as p}from"./style.js";import{VariantsList as m,VariantsGrid as f}from"./variantComponents.js";const u=u=>{const{selectedCollections:h,selectedCollectionsDispatch:j,setScreen:y,rearrangeViewType:S,outOfStockAction:g,scrollContainerRef:C}=u,[b,O]=r(d(h));s((()=>{var e;null===(e=null==C?void 0:C.current)||void 0===e||e.scrollTo({top:0}),O(d(h))}),[h]);return e(c,Object.assign({onDragEnd:e=>{if(!e.destination)return;const t=b,[o]=t.splice(e.source.index,1);t.splice(e.destination.index,0,o),t.forEach(((e,t)=>{e.displayOrder=t})),O(t)}},{children:[e(p,{children:[t(i,{Icon:o,width:16,height:16,color:n.content.secondary,onClick:()=>{y("collections")}}),t(l,Object.assign({color:n.content.secondary},{children:"All Products"}))]}),Object.keys(h).length>0?"list"===S?t(m,{selectedVariants:b,setSelectedVariants:O,selectedCollectionsDispatch:j,outOfStockAction:g}):t(f,{selectedVariants:b,setSelectedVariants:O,selectedCollectionsDispatch:j}):t(a,{title:"No Products Selected",subtitle:"Selected products will appear here"})]}))};export{u as RearrangeScreen};
@@ -14,5 +14,4 @@ export interface CollectionsActions {
14
14
  };
15
15
  }
16
16
  export declare function collectionsReducer(collections: Collection, action: CollectionsActions): any;
17
- export declare function paginationReducer(collections: SelectedItems, action: SelectedCollectionsActions): SelectedItems;
18
17
  export declare const CollectionIdContext: import("react").Context<string>;
@@ -1 +1 @@
1
- import{cloneDeep as t}from"lodash";import{createContext as e}from"react";function a(e,a){var o,c,s,d,n,l;let r={},i="",u="",p="";switch(console.log("vj: selected Items",e),a.type){case"selected":return console.log("vj: selectedColectionsReducer selected",a),r=t(e),a.data.val.isSmartCollection&&(a.data.isRestricted&&(r={}),r.isCustom=!0),r[a.data.id]=a.data.val,r;case"unselected":return r=t(e),(null==r?void 0:r.isCustom)&&(r.isCustom=!1),delete r[a.data.id],r;case"productUnselected":return r=t(e),i=a.data.productId,u=a.data.collectionId,delete r[u].products[i],Object.keys(r[u].products).length||((null==r?void 0:r.isCustom)&&(r.isCustom=!1),delete r[u]),r;case"productSelected":return r=t(e),i=a.data.productId,u=a.data.collectionId,(null===(o=a.data.catalogOnlyData)||void 0===o?void 0:o.isSmartCollection)&&(a.data.isRestricted&&(r={}),r.isCustom=!0),(null==r?void 0:r[u])||(r[u]=a.data.catalogOnlyData,r[u].products={}),r[u].products[i]=a.data.product,r;case"variantSelected":return r=t(e),i=a.data.productId,u=a.data.collectionId,p=a.data.variantId,(null===(c=a.data.catalogOnlyData)||void 0===c?void 0:c.isSmartCollection)&&(a.data.isRestricted&&(r={}),r.isCustom=!0),(null==r?void 0:r[u])||(r[u]=a.data.catalogOnlyData,r[u].products={},r[u].products[i]=a.data.productOnlyData,r[u].products[i].variants={}),(null===(d=null===(s=null==r?void 0:r[u])||void 0===s?void 0:s.products)||void 0===d?void 0:d[i])||((null===(n=null==r?void 0:r[u])||void 0===n?void 0:n.products)||(r[u].products={}),r[u].products[i]=a.data.productOnlyData,r[u].products[i].variants={}),r[u].products[i].variants[p]=a.data.variant,r;case"variantUnselected":return r=t(e),i=a.data.productId,u=a.data.collectionId,p=a.data.variantId,delete r[u].products[i].variants[p],Object.keys(r[u].products[i].variants).length||(delete r[u].products[i],Object.keys(r[u].products).length||((null===(l=r[u])||void 0===l?void 0:l.isSmartCollection)&&(r.isCustom=!1),delete r[u])),r;case"reset":return{};default:return e}}function o(t,e){let a={};switch(e.type){case"fetched":return a=Object.assign({},e.data),a;case"productsFetched":return console.log("vj: productsFetched",{collections:t,action:e}),a=Object.assign({},t),a[e.data.collectionId].products=e.data.products,console.log("vj: collectionsCopy",{collectionsCopy:a}),a;case"paged":return console.log("vj: paged",{collections:t,action:e}),a=Object.assign(Object.assign({},t),e.data),a;case"productsPaged":return console.log("vj: pagedProducts",{collections:t,action:e}),a=Object.assign({},t),e.data.collectionId,a[e.data.collectionId].products=Object.assign(Object.assign({},a[e.data.collectionId].products),e.data.products),a;default:return{}}}function c(t,e){let a={};switch(console.log("vj: selected Items",t),e.type){case"paginate":console.log("vj: paginate",e),a=Object.assign({},t);for(const t in e.data)if(Object.prototype.hasOwnProperty.call(e.data,t)){const o=e.data[t];if(Object.prototype.hasOwnProperty.call(a,t)){const e=a[t];a[t]=Object.assign(Object.assign({},e),{products:Object.assign(Object.assign({},e.products),o.products)})}else a[t]=o}return console.log("vj: collections copy",a),a;case"update":return console.log("vj: update",e),a=Object.assign({},t),console.log("vj: update collection",e),a;case"set":return a=Object.assign(Object.assign({},t),e.data),console.log("vj: update collection",e),a;case"init":return e.data;case"filter":a={};for(const o in t)if(o in e.data){const c=Object.assign({},t[o]),s=e.data[o],d={};for(const t in c.products)if(t in s.products){const e=Object.assign({},c.products[t]),a=s.products[t],o={};for(const t in e.variants)t in a.variants&&(o[t]=Object.assign({},e.variants[t]));Object.keys(o).length>0&&(e.variants=o,d[t]=e)}Object.keys(d).length>0&&(c.products=d,a[o]=c)}return a;default:return t}}const s=e("");export{s as CollectionIdContext,o as collectionsReducer,c as paginationReducer,a as selectedColectionsReducer};
1
+ import{cloneDeep as t}from"lodash";import{createContext as a}from"react";function d(a,d){var e,o,c,s,r,l;let i={},u="",n="",p="";switch(d.type){case"selected":return i=t(a),d.data.val.isSmartCollection&&(d.data.isRestricted&&(i={}),i.isCustom=!0),i[d.data.id]=d.data.val,i;case"unselected":return i=t(a),(null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[d.data.id],i;case"productUnselected":return i=t(a),u=d.data.productId,n=d.data.collectionId,delete i[n].products[u],Object.keys(i[n].products).length||((null==i?void 0:i.isCustom)&&(i.isCustom=!1),delete i[n]),i;case"productSelected":return i=t(a),u=d.data.productId,n=d.data.collectionId,(null===(e=d.data.catalogOnlyData)||void 0===e?void 0:e.isSmartCollection)&&(d.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[n])||(i[n]=d.data.catalogOnlyData,i[n].products={}),i[n].products[u]=d.data.product,i;case"variantSelected":return i=t(a),u=d.data.productId,n=d.data.collectionId,p=d.data.variantId,(null===(o=d.data.catalogOnlyData)||void 0===o?void 0:o.isSmartCollection)&&(d.data.isRestricted&&(i={}),i.isCustom=!0),(null==i?void 0:i[n])||(i[n]=d.data.catalogOnlyData,i[n].products={},i[n].products[u]=d.data.productOnlyData,i[n].products[u].variants={}),(null===(s=null===(c=null==i?void 0:i[n])||void 0===c?void 0:c.products)||void 0===s?void 0:s[u])||((null===(r=null==i?void 0:i[n])||void 0===r?void 0:r.products)||(i[n].products={}),i[n].products[u]=d.data.productOnlyData,i[n].products[u].variants={}),i[n].products[u].variants[p]=d.data.variant,i;case"variantUnselected":return i=t(a),u=d.data.productId,n=d.data.collectionId,p=d.data.variantId,delete i[n].products[u].variants[p],Object.keys(i[n].products[u].variants).length||(delete i[n].products[u],Object.keys(i[n].products).length||((null===(l=i[n])||void 0===l?void 0:l.isSmartCollection)&&(i.isCustom=!1),delete i[n])),i;case"reset":return{};default:return a}}function e(t,a){let d={};switch(a.type){case"fetched":return d=Object.assign({},a.data),d;case"productsFetched":return d=Object.assign({},t),d[a.data.collectionId].products=a.data.products,d;case"paged":return d=Object.assign(Object.assign({},t),a.data),d;default:return{}}}const o=a("");export{o as CollectionIdContext,e as collectionsReducer,d as selectedColectionsReducer};
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Collection, FbStatusFetcherReturn, SelectedItems } from '.';
2
+ import { Collection, SelectedItems } from '.';
3
3
  import { SelectedCollectionsActions } from './reducers';
4
4
  interface SearchScreenInterface {
5
5
  customCollectionRestriction?: boolean;
6
6
  selectedCollections: SelectedItems;
7
7
  searchedCollections: SelectedItems;
8
- setSearchedCollections: React.Dispatch<React.SetStateAction<SelectedItems>>;
9
8
  selectedCollectionsDispatch: React.Dispatch<SelectedCollectionsActions>;
10
9
  setScreen: React.Dispatch<React.SetStateAction<string>>;
11
10
  collections: {
@@ -16,10 +15,6 @@ interface SearchScreenInterface {
16
15
  pickerType?: 'COLLECTION' | 'PRODUCT';
17
16
  hideProductVariants?: boolean;
18
17
  hideProductCheckbox?: boolean;
19
- storeId: string;
20
- fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
21
- searchFetcher: (storeId: string, query: string, limit?: number, offset?: number) => Promise<SelectedItems>;
22
- searchText: string;
23
18
  }
24
19
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
25
20
  export {};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as i,useEffect as n}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"./productScreen.js";import{paginationReducer as a}from"./reducers.js";import{SelectedScreenHeader as v}from"./style.js";import{fetchFbStatus as p}from"./useFetchFbStatus copy.js";import{liftTheStateUp as h}from"./utility.js";const m=m=>{const{customCollectionRestriction:f,selectedCollections:b,searchedCollections:j,selectedCollectionsDispatch:y,setScreen:g,collections:k,onBackPress:C,hideVariantCheckbox:O,pickerType:P,hideProductVariants:x,hideProductCheckbox:S,storeId:I,fbStatusFetcher:w,searchText:D}=m,F=c(1),T=c(null),[V,R]=i(a,{});n((()=>{R({type:"init",data:j}),p(j,I,R,w,!0),F.current+=1}),[j]),n((()=>{console.log("vj: observertarget",T.current);const e=new IntersectionObserver((e=>{console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",F.current),F.current>0&&m.searchFetcher(I,D,10,F.current).then((e=>{console.log("after getting data",{curScreenData:V,data:e,props:m}),R({type:"paginate",data:e}),p(e,I,R,w),F.current+=1})))}),{threshold:1});return T.current&&e.observe(T.current),()=>{T.current&&e.unobserve(T.current)}}),[T,j]);const B=(e,t)=>{var o,r,c,i,n,s,l,d,u;let a=0,v=0;return!!((null===(r=null===(o=null==b?void 0:b[e])||void 0===o?void 0:o.products)||void 0===r?void 0:r[t])&&(null===(s=Object.keys((null===(n=null===(i=null===(c=null==k?void 0:k[e])||void 0===c?void 0:c.products)||void 0===i?void 0:i[t])||void 0===n?void 0:n.variants)||[]))||void 0===s||s.forEach((()=>v++)),Object.keys((null===(u=null===(d=null===(l=null==b?void 0:b[e])||void 0===l?void 0:l.products)||void 0===d?void 0:d[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return e("div",{children:[e(v,{children:[t(s,{Icon:r,onClick:()=>{g("collections"),C()}}),t(l,{children:"Searched Products"})]}),e("div",{children:[Object.keys(V).length?t(o,{children:Object.keys(V).map((e=>{var o;return Object.keys((null===(o=null==V?void 0:V[e])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==V?void 0:V.isCustom)&&(r=!0),t(u,{collectionId:e,upliftAdditions:(t,o)=>((e,t,o)=>{const r=h(o,V[e]);y({type:t,data:Object.assign(Object.assign({},r),{isRestricted:f})})})(e,t,o),productId:o,data:V[e].products[o],isProductPartiallyChecked:B(e,o),selectedData:b,selectedCollectionsDispatch:y,viewOnly:r,hideProductCheckbox:S,hideVariantCheckbox:O,hideProductVariants:x,pickerType:P},o)}))}))}):t(d,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."}),t("div",{ref:T})]})]})};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,6 @@ 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;
15
11
  }
16
12
  export declare const SelectedScreen: (props: SelectedScreenInterface) => import("react/jsx-runtime").JSX.Element;
17
13
  export {};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../assets/icons/arrow_left.svg.js";import{useRef as c,useReducer as l,useEffect as n}from"react";import{IconButton as i}from"../icon-button/IconButton.js";import{BodyCaption as s}from"../TypographyStyle.js";import{EmptyState as d}from"./emptyState.js";import{ProductGroup as u}from"./productScreen.js";import{paginationReducer as a}from"./reducers.js";import{SelectedScreenHeader as v}from"./style.js";import{fetchFbStatus as p}from"./useFetchFbStatus copy.js";import{paginateSelectedItems as m}from"./utility.js";const f=f=>{const{selectedCollections:j,selectedCollectionsDispatch:g,setScreen:h,collections:y,outOfStockAction:b,storeId:S,fbStatusFetcher:k}=f,O=c(1),C=c(null),[I,P]=l(a,{});n((()=>{const e=m(j,10,0);P({type:"paginate",data:e}),p(e,S,P,k,!0),O.current+=1}),[]),n((()=>{console.log("vj: curScreen Data change")}),[I]),n((()=>{P({type:"filter",data:j})}),[j]),n((()=>{console.log("vj: observertarget",C.current);const e=new IntersectionObserver((e=>{if(console.log("vj: observertargetinside",e),e[0].isIntersecting&&(console.log("vj: nextPageRef",O.current),O.current>0)){const e=m(j,10,O.current);console.log("paginated inside observer target",{paginatedProducts:e,selectedCollections:j,curScreenData:I}),P({type:"paginate",data:e}),p(e,S,P,k),O.current+=1}}),{threshold:1});return C.current&&e.observe(C.current),()=>{C.current&&e.unobserve(C.current)}}),[C,j]);const D=(e,t)=>{var o,r,c,l,n,i,s,d,u;let a=0,v=0;return!!((null===(r=null===(o=null==j?void 0:j[e])||void 0===o?void 0:o.products)||void 0===r?void 0:r[t])&&(null===(i=Object.keys((null===(n=null===(l=null===(c=null==y?void 0:y[e])||void 0===c?void 0:c.products)||void 0===l?void 0:l[t])||void 0===n?void 0:n.variants)||[]))||void 0===i||i.forEach((()=>v++)),Object.keys((null===(u=null===(d=null===(s=null==j?void 0:j[e])||void 0===s?void 0:s.products)||void 0===d?void 0:d[t])||void 0===u?void 0:u.variants)||[]).forEach((()=>a++)),a>0&&v!==a))};return e("div",{children:[e(v,{children:[t(i,{Icon:r,onClick:()=>{h("collections")}}),t(s,{children:"Selected Products"})]}),e("div",{children:[Object.keys(I).length>0?t(o,{children:Object.keys(I).map((e=>{var o;return Object.keys((null===(o=null==I?void 0:I[e])||void 0===o?void 0:o.products)||[]).map((o=>{let r=!1;return(null==I?void 0:I.isCustom)&&(r=!0),t(u,{upliftAdditions:null,collectionId:e,productId:o,data:I[e].products[o],isProductPartiallyChecked:D(e,o),selectedData:j,selectedCollectionsDispatch:g,viewOnly:r,outOfStockAction:b},o)}))}))}):t(d,{title:"No Products Selected",subtitle:"Select products will appear here"}),t("div",{ref:C})]})]})};export{f as SelectedScreen};
1
+ import{jsxs as o,jsx as t,Fragment as l}from"react/jsx-runtime";import e 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{ProductGroup as c}from"./productScreen.js";import{SelectedScreenHeader as n}from"./style.js";const s=s=>{const{selectedCollections:u,selectedCollectionsDispatch:v,setScreen:p,collections:a}=s,m=(o,t)=>{var l,e,i,r,d,c,n,s,v;let p=0,m=0;return!!((null===(e=null===(l=null==u?void 0:u[o])||void 0===l?void 0:l.products)||void 0===e?void 0:e[t])&&(null===(c=Object.keys((null===(d=null===(r=null===(i=null==a?void 0:a[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((()=>m++)),Object.keys((null===(v=null===(s=null===(n=null==u?void 0:u[o])||void 0===n?void 0:n.products)||void 0===s?void 0:s[t])||void 0===v?void 0:v.variants)||[]).forEach((()=>p++)),p>0&&m!==p))};return o("div",{children:[o(n,{children:[t(i,{Icon:e,onClick:()=>{p("collections")}}),t(r,{children:"Selected Products"})]}),t("div",{children:Object.keys(u).length>0?t(l,{children:Object.keys(u).map((o=>{var l;return Object.keys((null===(l=null==u?void 0:u[o])||void 0===l?void 0:l.products)||[]).map((l=>{let e=!1;return(null==u?void 0:u.isCustom)&&(e=!0),t(c,{upliftAdditions:null,collectionId:o,productId:l,data:u[o].products[l],isProductPartiallyChecked:m(o,l),selectedData:u,selectedCollectionsDispatch:v,viewOnly:e},l)}))}))}):t(d,{title:"No Products Selected",subtitle:"Select products will appear here"})})]})};export{s as SelectedScreen};
@@ -1,7 +1,8 @@
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;
@@ -30,7 +31,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
30
31
  display: flex;
31
32
  flex-direction: column;
32
33
  justify-content: center;
33
- `,p=e.div`
34
+ `,l=e.div`
34
35
  display: flex;
35
36
  flex-direction: row;
36
37
  max-height: 32px;
@@ -40,18 +41,15 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
40
41
  align-items: center;
41
42
  padding: 8px 16px;
42
43
  margin-top: 16px;
43
- position: sticky;
44
- top: 0;
45
- z-index: 10;
46
- `,l=e.div`
44
+ `,p=e.div`
47
45
  display: flex;
48
46
  flex-direction: row;
49
47
  column-gap: 16px;
50
48
  padding: 12px 16px;
51
49
  border-bottom: 1px solid #e0e0e0;
52
50
  align-items: center;
53
- `,c=e.div`
54
- min-height: 64px;
51
+ `,x=e.div`
52
+ height: 64px;
55
53
  background-color: ${e=>e.isActive?i.background.positive.light:"white"};
56
54
  border-bottom: 1px solid #e0e0e0;
57
55
  padding: 12px 16px;
@@ -65,7 +63,7 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
65
63
  cursor: pointer;
66
64
  background-color: ${i.surface.hovered};
67
65
  }
68
- `,x=e.div`
66
+ `,c=e.div`
69
67
  display: flex;
70
68
  flex-direction: row;
71
69
  max-height: 32px;
@@ -74,14 +72,11 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
74
72
  justify-content: flex-start;
75
73
  align-items: center;
76
74
  padding: 8px 16px;
77
- position: sticky;
78
- top: 0;
79
- z-index: 10;
80
75
  `,a=e.div`
81
76
  display: flex;
82
77
  flex-direction: column;
83
78
  `,s=e.div`
84
- min-height: 72px;
79
+ height: 72px;
85
80
  background: white;
86
81
  padding: 12px 16px;
87
82
  display: flex;
@@ -112,4 +107,4 @@ import e from"styled-components";import{COLORS as i}from"../../constants/Theme.j
112
107
  align-items: center;
113
108
  border: 1px solid ${i.stroke.primary};
114
109
  border-radius: 4px;
115
- `;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,11 +1 @@
1
- import { Collection, SelectedItems } from './modal';
2
1
  export declare const liftTheStateUp: (payload: any, data: any) => any;
3
- export declare function paginateArray(array: Array<any>, limit: number, pageNo: number): {
4
- data: any[];
5
- leftCursor: boolean;
6
- rightCursor: boolean;
7
- };
8
- export declare function paginateSelectedItems(selectedItems: SelectedItems, limit: number, offset: number): {
9
- [key: string]: Collection;
10
- };
11
- export declare function mergeProducts(curData: any, paginatedData: any): any;
@@ -1 +1 @@
1
- import{cloneDeep as t}from"lodash";const o=(o,s)=>{const c=t(s);if(delete c.products,(o=Object.assign(Object.assign({},o),{catalogOnlyData:c})).productId&&s.products){const n=t(s.products[o.productId]);(null==n?void 0:n.variants)&&delete n.variants,o=Object.assign(Object.assign({},o),{catalogOnlyData:c,productOnlyData:n})}return o};function s(t,o,s){var n;const e={};let r=0;console.log("paginated offset",s);for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)){const l=t[a],i=c(l.products,o,s-r);i&&Object.keys(i).length>0&&(e[a]=Object.assign(Object.assign({},l),{products:i})),r+=Object.keys(null!==(n=l.products)&&void 0!==n?n:{}).length}return e}function c(t,o,s){if(!t)return{};const c=Object.keys(t).slice(s,s+o),n={};return c.forEach((o=>{n[o]=t[o]})),n}export{o as liftTheStateUp,s as paginateSelectedItems};
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 m}from"./collectionScreen.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{VariantCardListStyle as l,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?m(e,34,!0):e};return t(l,{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},{children:e(c,{children:j(!0)})})),e(s,{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.453-beta.ppi-9",
3
+ "version": "0.0.453",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,8 +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
- 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,11 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- export declare const ProductInfoOverlay: (props: {
4
- productData: Product | ProductVariant;
5
- onClose: () => void;
6
- outOfStockAction?: OUT_OF_STOCK_ACTION;
7
- }) => import("react/jsx-runtime").JSX.Element;
8
- export declare const ProductInfoCard: (props: {
9
- productData: Product | ProductVariant;
10
- outOfStockAction?: OUT_OF_STOCK_ACTION;
11
- }) => 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;console.log("vj: product data",t);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,2 +0,0 @@
1
- import { FbStatusFetcherReturn, SelectedItems } from './modal';
2
- export declare const fetchFbStatus: (data: SelectedItems, storeId: string, dispatchCurScreenData: any, fbStatusFetcher?: ((storeId: string, variantIds: string[]) => FbStatusFetcherReturn) | undefined, set?: boolean) => void;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.fetchFbStatus=(o,d,v,l,i)=>{if(!l){const d=o;Object.keys(d).forEach((o=>{var v,l;const i=null!==(l=null===(v=d[o])||void 0===v?void 0:v.products)&&void 0!==l?l:{};Object.keys(i).forEach((v=>{var l,i,t,n;const s=null!==(n=null===(t=null===(i=null===(l=d[o])||void 0===l?void 0:l.products)||void 0===i?void 0:i[v])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((l=>{var i,t,n,s;const a=null===(s=null===(n=null===(t=null===(i=d[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[l];a&&(a.fbStatus="APPROVED")}))}))})),v({type:"update",data:d})}const t=(o=>{const d=[];return Object.keys(o).forEach((v=>{var l,i;const t=null!==(i=null===(l=o[v])||void 0===l?void 0:l.products)&&void 0!==i?i:{};Object.keys(t).forEach((l=>{var i,t,n,s;const a=null!==(s=null===(n=null===(t=null===(i=o[v])||void 0===i?void 0:i.products)||void 0===t?void 0:t[l])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((i=>{var t,n,s,a;const u=null===(a=null===(s=null===(n=null===(t=o[v])||void 0===t?void 0:t.products)||void 0===n?void 0:n[l])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[i];(null==u?void 0:u.fbStatus)||d.push(i)}))}))})),d})(o);console.log("vj: variantids",t),t.length>0&&l&&l(d,t).then((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var v,i;const t=null!==(i=null===(v=l[o])||void 0===v?void 0:v.products)&&void 0!==i?i:{};Object.keys(t).forEach((v=>{var i,t,n,s;const a=null!==(s=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[v])||void 0===n?void 0:n.variants)&&void 0!==s?s:{};Object.keys(a).forEach((i=>{var t,n,s,a;const u=null===(a=null===(s=null===(n=null===(t=l[o])||void 0===t?void 0:t.products)||void 0===n?void 0:n[v])||void 0===s?void 0:s.variants)||void 0===a?void 0:a[i];u&&"REJECTED"===d[i]?u.fbStatus="REJECTED":u&&"APPROVED"===d[i]&&(u.fbStatus="APPROVED")}))}))})),console.log("updated data",l),v(i?{type:"set",data:l}:{type:"update",data:l})})).catch((d=>{const l=Object.assign({},o);Object.keys(l).forEach((o=>{var d,v;const i=null!==(v=null===(d=l[o])||void 0===d?void 0:d.products)&&void 0!==v?v:{};Object.keys(i).forEach((d=>{var v,i,t,n;const s=null!==(n=null===(t=null===(i=null===(v=l[o])||void 0===v?void 0:v.products)||void 0===i?void 0:i[d])||void 0===t?void 0:t.variants)&&void 0!==n?n:{};Object.keys(s).forEach((v=>{var i,t,n,s;const a=null===(s=null===(n=null===(t=null===(i=l[o])||void 0===i?void 0:i.products)||void 0===t?void 0:t[d])||void 0===n?void 0:n.variants)||void 0===s?void 0:s[v];a&&(a.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",l),v({type:"update",data:l})}))};
@@ -1,5 +0,0 @@
1
- import { FbStatusFetcherReturn, SelectedItems } from './modal';
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 | undefined>>) => {
4
- fetchFbStatus: () => void;
5
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.useFetchFbStatusForCollections=function(o,v,d,i){let l=arguments.length>5?arguments[5]:void 0;const t=()=>{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 c=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];c&&(c.fbStatus="APPROVED")}))}))})),l?l(v):d({type:"paged",data:v})}const t=(()=>{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 c=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(c).forEach((l=>{var t,n,s,c;const u=null===(c=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===c?void 0:c[l];(null==u?void 0:u.fbStatus)||v.push(l)}))}))})),v})();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 c=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(c).forEach((l=>{var t,n,s,c;const u=null===(c=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===c?void 0:c[l];u&&"REJECTED"===v[l]?u.fbStatus="REJECTED":u&&"APPROVED"===v[l]&&(u.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 c=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];c&&(c.fbStatus="APPROVED")}))}))})),console.log("vj: variantids",i),l?l(i):d({type:"paged",data:i})}))};return(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&t(),{fetchFbStatus:t}};
@@ -1,8 +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
- 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,11 +0,0 @@
1
- import { Product, ProductVariant } from './modal';
2
- import { OUT_OF_STOCK_ACTION } from './type';
3
- export declare const ProductInfoOverlay: (props: {
4
- productData: Product | ProductVariant;
5
- onClose: () => void;
6
- outOfStockAction?: OUT_OF_STOCK_ACTION;
7
- }) => import("react/jsx-runtime").JSX.Element;
8
- export declare const ProductInfoCard: (props: {
9
- productData: Product | ProductVariant;
10
- outOfStockAction?: OUT_OF_STOCK_ACTION;
11
- }) => import("react/jsx-runtime").JSX.Element;