@bikdotai/bik-component-library 0.0.696 → 0.0.697-1

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 (63) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +1 -1
  7. package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  8. package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +1 -1
  9. package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
  10. package/dist/cjs/components/discount-modal/DiscountModal.d.ts +1 -1
  11. package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
  12. package/dist/cjs/components/dropdown/Common.styled.d.ts +1 -0
  13. package/dist/cjs/components/dropdown/Common.styled.js +17 -10
  14. package/dist/cjs/components/dropdown/DropdownPopover/index.d.ts +1 -0
  15. package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
  16. package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
  17. package/dist/cjs/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  18. package/dist/cjs/components/dropdown-button/DropdownButton.style.js +15 -2
  19. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +1 -1
  20. package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -1
  21. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  22. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +1 -1
  23. package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
  24. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +1 -1
  25. package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +1 -1
  26. package/dist/cjs/components/product-picker-v2/utility.d.ts +1 -1
  27. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  28. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  29. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  30. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
  31. package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  32. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  33. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  34. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  35. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  36. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  37. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +1 -1
  38. package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
  39. package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +1 -1
  40. package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
  41. package/dist/esm/components/discount-modal/DiscountModal.d.ts +1 -1
  42. package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
  43. package/dist/esm/components/dropdown/Common.styled.d.ts +1 -0
  44. package/dist/esm/components/dropdown/Common.styled.js +15 -8
  45. package/dist/esm/components/dropdown/DropdownPopover/index.d.ts +1 -0
  46. package/dist/esm/components/dropdown/DropdownPopover/index.js +1 -1
  47. package/dist/esm/components/dropdown-button/DropdownButton.js +1 -1
  48. package/dist/esm/components/dropdown-button/DropdownButton.style.d.ts +1 -0
  49. package/dist/esm/components/dropdown-button/DropdownButton.style.js +17 -4
  50. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +1 -1
  51. package/dist/esm/components/product-picker-v2/modal.d.ts +1 -1
  52. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  53. package/dist/esm/components/product-picker-v2/productScreen.d.ts +1 -1
  54. package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +1 -1
  55. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +1 -1
  56. package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +1 -1
  57. package/dist/esm/components/product-picker-v2/utility.d.ts +1 -1
  58. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +1 -1
  59. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +1 -1
  60. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  61. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.d.ts +1 -1
  62. package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as h}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as P,ScreenName as O}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:A,visible:B,zIndex:E,exactLimit:L,limit:z,hideCollectionCheckbox:V,hideProductCheckbox:$,outOfStockAction:M=P.BLUR,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,hideSelectionCount:G,title:K,width:N,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=O.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections),[pe,he]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Pe]=s(!1),[Oe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Ae]=c(b,Object.keys(w).length>0?w:{}),Be=r(null),[Ee,Le]=s(!1),[ze,Ve]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Pe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Pe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),$e())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),$e())}),[Z,we,Se]);const $e=()=>{Ae({type:"reset",data:{}})},Me=()=>L&&Se>L?e.jsx(h,{tagText:`You can only select ${L} products`,type:"negative"}):z&&Se>z?e.jsx(h,{tagText:`You can only select ${z} products`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?O.RearrangeProducts:O.SelectedProducts)},buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:"tertiaryGray"}),He=e=>be?"Loading...":de===O.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",We=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(p,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Be,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Oe,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Be}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:$,outOfStockAction:M,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Be})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===pe?"list":"grid",scrollContainerRef:Be,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:$,hideProductVariants:J,hideVariantCheckbox:H,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:V,outOfStockAction:M})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[We,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:He(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&ze?e.jsx(g,{productData:ze,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:B,onClose:()=>{null==A||A(),$e()},headingTitle:K||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:N||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:A},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||e.disabled,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}}))(se):{buttonText:He(),disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{D.onAdd(we,Se),$e()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:G?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[We,Ee&&ze?e.jsx(g,{productData:ze,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as h}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as P,ScreenName as O}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:A,visible:B,zIndex:E,exactLimit:L,limit:z,hideCollectionCheckbox:V,hideProductCheckbox:$,outOfStockAction:M=P.BLUR,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,hideSelectionCount:G,title:K,width:N,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=O.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections),[pe,he]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Pe]=s(!1),[Oe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Ae]=c(b,Object.keys(w).length>0?w:{}),Be=r(null),[Ee,Le]=s(!1),[ze,Ve]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Pe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Pe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),$e())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),$e())}),[Z,we,Se]);const $e=()=>{Ae({type:"reset",data:{}})},Me=()=>L&&Se>L?e.jsx(h,{tagText:`You can only select ${L} products`,type:"negative"}):z&&Se>z?e.jsx(h,{tagText:`You can only select ${z} products`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?O.RearrangeProducts:O.SelectedProducts)},buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:"tertiaryGray"}),He=e=>be?"Loading...":de===O.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",We=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(p,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Be,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Oe,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Be}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:$,outOfStockAction:M,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Be})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===pe?"list":"grid",scrollContainerRef:Be,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:$,hideProductVariants:J,hideVariantCheckbox:H,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:V,outOfStockAction:M})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[We,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:He(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&ze?e.jsx(g,{productData:ze,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:B,onClose:()=>{null==A||A(),$e()},headingTitle:K||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:N||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:A},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||e.disabled,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}}))(se):{buttonText:He(),disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{D.onAdd(we,Se),$e()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:G?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[We,Ee&&ze?e.jsx(g,{productData:ze,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { Collection, FbStatusFetcherReturn, Product, ProductFetcherReturn, ProductVariant, SelectedItems } from '.';
4
4
  import { CollectionsActions, SelectedCollectionsActions } from './reducers';
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  import { FbStatusFetcherReturn, SelectedItems } from '.';
4
4
  import { SelectedCollectionsActions } from './reducers';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
4
4
  import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
5
5
  import { OUT_OF_STOCK_ACTION } from './type';
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ApplicationType } from '@bikdotai/bik-models/growth';
2
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
3
3
  import { Collection, FbStatusFetcherReturn, SelectedItems } from '.';
4
4
  import { SelectedCollectionsActions } from './reducers';
5
5
  import { OUT_OF_STOCK_ACTION } from './type';
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { Collection, FbStatusFetcherReturn, Product, ProductVariant, SearchedItems, SelectedItems } from './modal';
3
3
  import { CollectionsActions } from './reducers';
4
4
  export declare const liftTheStateUp: (payload: any, data: any) => any;
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableListInterfaceV2 } from "../add-variableV2/AddVariableV2";
3
3
  import { CarouselProduct } from "./modalElements/EditWhatsAppCarouselTemplateV2";
4
4
  import { WhatsAppCarouselTemplateVariables } from "../template-preview/models/WhatsappCarouselTemplate";
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import { VariableV3 } from "../../../helpers";
3
3
  import React, { LegacyRef } from 'react';
4
4
  import Slider from 'react-slick';
@@ -1 +1 @@
1
- import{j as e}from"../../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth";import l from"../../../assets/icons/arrow_back.svg.js";import o from"../../../assets/icons/chevronLeft.svg.js";import n from"../../../assets/icons/chevronRight.svg.js";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as s,useEffect as a}from"react";import{Button as d}from"../../button/Button.js";import{IconButton as c}from"../../icon-button/IconButton.js";import{ProductPickerModal as u}from"../../product-picker-v2/modal.js";import{ScreenName as p}from"../../product-picker-v2/type.js";import{Badge as m}from"../Badge/index.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import h from"./EditWhatsAppTemplateV2.js";import{ProductBox as g}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as j}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as f}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as y}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as x,TitleRegular as b,BodySecondary as C,BodyCaption as I}from"../../TypographyStyle.js";const w=w=>{let{template:k,whatsappSpecificPickerMeta:O,showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}=w;var B,E,A,F,M,V,D,R;const{selectedCarouselIndex:W,setTemplate:$,pickerConf:q,isProductCarouselType:N,pod:_,cardCount:z,carouselProducts:G,setCarouselProducts:H,isError:K,cardImages:J,disableEditVariable:Q,onDeleteSelectedProducts:U,setSelectedCarouselIndex:X,setVariableCallback:Y,setShowVariablePicker:Z,sliderRef:ee}=v(),[te,le]=s(y(null==k?void 0:k.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(E=null===(B=null==k?void 0:k.mapping)||void 0===B?void 0:B.body)||void 0===E?void 0:E.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(F=null===(A=null==k?void 0:k.mapping)||void 0===A?void 0:A.body)||void 0===F?void 0:F.length)?"(Step 2/2)":"")),[oe,ne]=s(!1),[ie,re]=s(!1),se=W===(null!=z?z:-1)-1,ae=(null!=W?W:-1)<1;a((()=>{var e,t,l,o;le(y(null==k?void 0:k.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(t=null===(e=null==k?void 0:k.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==k?void 0:k.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[W]);const de=e=>{null==H||H([{name:"variable",productName:e.actualValue}])};return a((()=>{-1===W&&y(null==k?void 0:k.channel)&&(null==X||X(0))}),[W,null==k?void 0:k.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!y(null==k?void 0:k.channel)&&null!=W&&W>=0&&!!(null===(V=null===(M=null==k?void 0:k.mapping)||void 0===M?void 0:M.body)||void 0===V?void 0:V.length)&&e.jsx(c,{Icon:l,onClick:()=>{null==X||X(-1)}}),e.jsx(x,Object.assign({style:{marginLeft:10}},{children:te}))]})),N&&(null!==(D=null==G?void 0:G.length)&&void 0!==D?D:0)>0&&null!=W&&W>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g,{editItem:()=>{1===(null==G?void 0:G.length)&&"variable"===G[0].name?(Y((()=>de)),Z(!0)):ne(!oe)},cardBody:1===(null==G?void 0:G.length)&&"variable"===G[0].name?`${G[0].productName}`:`${null==G?void 0:G.length} Products Selected`,hideIcon:1===(null==G?void 0:G.length)&&"variable"===G[0].name,deleteItem:()=>{var e;if(1===(null==G?void 0:G.length)&&"variable"===G[0].name)return void(null==H||H([]));const t=r(Object.assign({},k));t&&(J&&J.length>0?null==J||J.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=J[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==$||$(t)),null==H||H([]),null==U||U()}}),G&&(null==G?void 0:G.length)>0&&"variable"!=G[0].name&&e.jsx(d,{disabled:(null!==(R=null==G?void 0:G.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{re(!0),ne(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!Q&&N&&0===(null==G?void 0:G.length)&&null!=W&&W>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(b,{children:"Product(s)"}),e.jsx(C,{children:`Select ${null!=z?z:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:K?16:12,marginRight:K?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{ne(!0)}}),_===f.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(I,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{Y((()=>de)),Z(!0)}})]})]})),K&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(m,{padding:"8px",errorText:"Please add products"})}))]}),!N&&(null!=W?W:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:j.surface.hovered,alignItems:"center"}},{children:[e.jsx(c,{Icon:o,disabled:ae,width:8,height:14,svgStyle:ae?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickPrev(),(null!=W?W:-1)<1||null==X||X((e=>e-1))}}),e.jsx(b,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:j.content.secondary},{children:`Card ${(null!=W?W:0)+1}/${z}`})),e.jsx(c,{Icon:n,width:8,height:14,disabled:se,svgStyle:se?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickNext(),(null!=W?W:-1)>=(null!=z?z:-1)-1||null==X||X((e=>e+1))}})]})),e.jsx(h,{whatsappSpecificPickerMeta:O,template:k,onTemplateChange:e=>{null==$||$(e)},showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}),oe&&q&&e.jsx(u,{zIndex:200,startupScreen:ie?p.RearrangeProducts:p.Collections,rearrangeEnabled:!0,storeId:q.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,n=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[n]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=G?G:[]),collectionFetcher:q.fetchCollections,productFetcher:q.fetchProducts,onAdd:(e,t)=>{var l,o,n,i,s,a;re(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const c=r[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=r[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(i=null===(n=r[e])||void 0===n?void 0:n.name)&&void 0!==i?i:"",productImage:null!==(a=null===(s=r[e])||void 0===s?void 0:s.image)&&void 0!==a?a:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=r(Object.assign({},k));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==J?void 0:J[t])&&void 0!==l?l:""]})),null==$||$(p)),null==H||H(c),ne(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:oe,onClose:()=>{ne(!1)},exactLimit:null!=z?z:1,appType:q.appType||t.BIK})]}))};export{w as default};
1
+ import{j as e}from"../../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import l from"../../../assets/icons/arrow_back.svg.js";import o from"../../../assets/icons/chevronLeft.svg.js";import i from"../../../assets/icons/chevronRight.svg.js";import n from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as s,useEffect as a}from"react";import{Button as d}from"../../button/Button.js";import{IconButton as c}from"../../icon-button/IconButton.js";import{ProductPickerModal as u}from"../../product-picker-v2/modal.js";import{ScreenName as p}from"../../product-picker-v2/type.js";import{Badge as m}from"../Badge/index.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import h from"./EditWhatsAppTemplateV2.js";import{ProductBox as g}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as j}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as f}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as y}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as x,TitleRegular as b,BodySecondary as C,BodyCaption as I}from"../../TypographyStyle.js";const k=k=>{let{template:w,whatsappSpecificPickerMeta:O,showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}=k;var B,E,A,F,M,V,D,R;const{selectedCarouselIndex:W,setTemplate:$,pickerConf:q,isProductCarouselType:N,pod:_,cardCount:z,carouselProducts:G,setCarouselProducts:H,isError:K,cardImages:J,disableEditVariable:Q,onDeleteSelectedProducts:U,setSelectedCarouselIndex:X,setVariableCallback:Y,setShowVariablePicker:Z,sliderRef:ee}=v(),[te,le]=s(y(null==w?void 0:w.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(E=null===(B=null==w?void 0:w.mapping)||void 0===B?void 0:B.body)||void 0===E?void 0:E.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(F=null===(A=null==w?void 0:w.mapping)||void 0===A?void 0:A.body)||void 0===F?void 0:F.length)?"(Step 2/2)":"")),[oe,ie]=s(!1),[ne,re]=s(!1),se=W===(null!=z?z:-1)-1,ae=(null!=W?W:-1)<1;a((()=>{var e,t,l,o;le(y(null==w?void 0:w.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(t=null===(e=null==w?void 0:w.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==w?void 0:w.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[W]);const de=e=>{null==H||H([{name:"variable",productName:e.actualValue}])};return a((()=>{-1===W&&y(null==w?void 0:w.channel)&&(null==X||X(0))}),[W,null==w?void 0:w.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!y(null==w?void 0:w.channel)&&null!=W&&W>=0&&!!(null===(V=null===(M=null==w?void 0:w.mapping)||void 0===M?void 0:M.body)||void 0===V?void 0:V.length)&&e.jsx(c,{Icon:l,onClick:()=>{null==X||X(-1)}}),e.jsx(x,Object.assign({style:{marginLeft:10}},{children:te}))]})),N&&(null!==(D=null==G?void 0:G.length)&&void 0!==D?D:0)>0&&null!=W&&W>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g,{editItem:()=>{1===(null==G?void 0:G.length)&&"variable"===G[0].name?(Y((()=>de)),Z(!0)):ie(!oe)},cardBody:1===(null==G?void 0:G.length)&&"variable"===G[0].name?`${G[0].productName}`:`${null==G?void 0:G.length} Products Selected`,hideIcon:1===(null==G?void 0:G.length)&&"variable"===G[0].name,deleteItem:()=>{var e;if(1===(null==G?void 0:G.length)&&"variable"===G[0].name)return void(null==H||H([]));const t=r(Object.assign({},w));t&&(J&&J.length>0?null==J||J.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=J[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==$||$(t)),null==H||H([]),null==U||U()}}),G&&(null==G?void 0:G.length)>0&&"variable"!=G[0].name&&e.jsx(d,{disabled:(null!==(R=null==G?void 0:G.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{re(!0),ie(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!Q&&N&&0===(null==G?void 0:G.length)&&null!=W&&W>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(b,{children:"Product(s)"}),e.jsx(C,{children:`Select ${null!=z?z:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:K?16:12,marginRight:K?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(n,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{ie(!0)}}),_===f.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(I,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(n,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{Y((()=>de)),Z(!0)}})]})]})),K&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(m,{padding:"8px",errorText:"Please add products"})}))]}),!N&&(null!=W?W:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:j.surface.hovered,alignItems:"center"}},{children:[e.jsx(c,{Icon:o,disabled:ae,width:8,height:14,svgStyle:ae?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickPrev(),(null!=W?W:-1)<1||null==X||X((e=>e-1))}}),e.jsx(b,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:j.content.secondary},{children:`Card ${(null!=W?W:0)+1}/${z}`})),e.jsx(c,{Icon:i,width:8,height:14,disabled:se,svgStyle:se?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickNext(),(null!=W?W:-1)>=(null!=z?z:-1)-1||null==X||X((e=>e+1))}})]})),e.jsx(h,{whatsappSpecificPickerMeta:O,template:w,onTemplateChange:e=>{null==$||$(e)},showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}),oe&&q&&e.jsx(u,{zIndex:200,startupScreen:ne?p.RearrangeProducts:p.Collections,rearrangeEnabled:!0,storeId:q.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=G?G:[]),collectionFetcher:q.fetchCollections,productFetcher:q.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,s,a;re(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const c=r[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=r[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(n=null===(i=r[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(a=null===(s=r[e])||void 0===s?void 0:s.image)&&void 0!==a?a:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=r(Object.assign({},w));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==J?void 0:J[t])&&void 0!==l?l:""]})),null==$||$(p)),null==H||H(c),ie(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:oe,onClose:()=>{ie(!1)},exactLimit:null!=z?z:1,appType:q.appType||t.BIK})]}))};export{k as default};
@@ -1,4 +1,4 @@
1
- import { ApplicationType } from '@bikdotai/bik-models/growth';
1
+ import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
2
2
  import React from 'react';
3
3
  export interface UnsatisfactoryResponseListProps {
4
4
  storeId?: string;
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as s}from"@bikdotai/bik-models/growth";import t from"../../assets/icons/cross.svg.js";import n from"../../assets/icons/info.svg.js";import{format as o}from"date-fns";import{useState as i,useEffect as r}from"react";import{COLORS as a}from"../../constants/Theme.js";import{Avatar as l}from"../avatar/Avatar.js";import{SIZE as c,AVATAR_TYPES as d,AVATAR_BACKGROUND as p}from"../avatar/AvatarHelper.js";import{Button as m}from"../button/Button.js";import{StateComponent as h,StateInterface as y}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import{TitleRegular as j,BodySecondary as f,Caption as g}from"../TypographyStyle.js";import{UnsatisfactoryCountIntentWiseModal as u}from"./UnsatisfactoryCountIntentWiseModal.js";import{IncorrectRepliesStyle as x}from"./UnsatisfactoryResponseList.style.js";const v=v=>{const{storeId:b,appType:I,incorrectMessages:w,onIncorrectMessageBubbleClick:C,setShowIncorrectReplies:T,ChecklistType:U,IntentWiseUnsatisfactoryResponse:M,IntentHeaderTitle:O,redirectToUnsatisfactoryResponse:R,fetchUnsatisfactoryResponseCountIntentWise:k,fetchUnsatisfactoryResponseCount:N}=v,[S,A]=i(""),[W,L]=i((null==w?void 0:w.length)>0),[D,E]=i(!1);return r((()=>{!W&&N&&N().then((e=>{e>0&&L(!0),0===e&&T(!1)}))}),[]),e.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxs(x,{children:[I==s.MANIFEST&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(j,{children:"Unsatisfactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>T(!1)},{children:e.jsx(t,{height:16,width:16,color:a.content.primary})}))]})),e.jsx(f,Object.assign({style:{color:a.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==w?void 0:w.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsx(h,{states:y.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:c.SMALL,icon:e.jsx(l,{type:d.ICON,size:c.MEDIUM,background:p.LIGHT,icon:()=>e.jsx(n,{width:16,height:16,color:a.content.warning})})})})),!!(null==w?void 0:w.length)&&e.jsxs(e.Fragment,{children:[I==s.MANIFEST&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==w?void 0:w.length)?"flex-start":"center"}},{children:e.jsx(m,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{E(!0)},disabled:!W})})),e.jsx(u,{storeId:b,setShowUnsatisfactoryResponseModal:E,showUnsatisfactoryResponseModal:D,ChecklistType:U,UnsatisfactoryResponseIntentList:M,IntentHeaderTitle:O,fetchUnsatisfactoryResponseCountIntentWise:k,viewIntentWiseUnsatisfactoryResponse:R}),w&&(null==w?void 0:w.length)>0&&e.jsx("div",Object.assign({className:"wrapper"},{children:w.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{C(s.messageId),A(s.messageId)},style:S===s.messageId?{backgroundColor:a.surface.hovered}:{}},{children:[e.jsx(f,Object.assign({style:{color:a.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(g,Object.assign({style:{color:a.content.secondary}},{children:[o(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",o(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),s.messageId)))}))]})]})}))};export{v as UnsatisfactoryResponseList};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as s}from"@bikdotai/bik-models/growth/models/bik-store";import t from"../../assets/icons/cross.svg.js";import n from"../../assets/icons/info.svg.js";import{format as o}from"date-fns";import{useState as i,useEffect as r}from"react";import{COLORS as a}from"../../constants/Theme.js";import{Avatar as l}from"../avatar/Avatar.js";import{SIZE as c,AVATAR_TYPES as d,AVATAR_BACKGROUND as p}from"../avatar/AvatarHelper.js";import{Button as m}from"../button/Button.js";import{StateComponent as h,StateInterface as y}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import{TitleRegular as j,BodySecondary as f,Caption as g}from"../TypographyStyle.js";import{UnsatisfactoryCountIntentWiseModal as u}from"./UnsatisfactoryCountIntentWiseModal.js";import{IncorrectRepliesStyle as x}from"./UnsatisfactoryResponseList.style.js";const b=b=>{const{storeId:v,appType:I,incorrectMessages:w,onIncorrectMessageBubbleClick:C,setShowIncorrectReplies:T,ChecklistType:U,IntentWiseUnsatisfactoryResponse:M,IntentHeaderTitle:O,redirectToUnsatisfactoryResponse:R,fetchUnsatisfactoryResponseCountIntentWise:k,fetchUnsatisfactoryResponseCount:N}=b,[S,A]=i(""),[W,L]=i((null==w?void 0:w.length)>0),[D,E]=i(!1);return r((()=>{!W&&N&&N().then((e=>{e>0&&L(!0),0===e&&T(!1)}))}),[]),e.jsx("div",Object.assign({style:{overflow:"scroll",height:"100%"}},{children:e.jsxs(x,{children:[I==s.MANIFEST&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsx(j,{children:"Unsatisfactory responses"}),e.jsx("div",Object.assign({style:{cursor:"pointer"},onClick:()=>T(!1)},{children:e.jsx(t,{height:16,width:16,color:a.content.primary})}))]})),e.jsx(f,Object.assign({style:{color:a.content.secondary}},{children:"Spot unsatisfactory replies, dive deeper, and enhance with relevant data for improved responses."}))]})),!(null==w?void 0:w.length)&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:e.jsx(h,{states:y.WARNING,heading:"No unsatisfactory responses",subline:"As of now, all responses are correct",isButtonEnabled:!1,width:0,size:c.SMALL,icon:e.jsx(l,{type:d.ICON,size:c.MEDIUM,background:p.LIGHT,icon:()=>e.jsx(n,{width:16,height:16,color:a.content.warning})})})})),!!(null==w?void 0:w.length)&&e.jsxs(e.Fragment,{children:[I==s.MANIFEST&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%",justifyContent:(null==w?void 0:w.length)?"flex-start":"center"}},{children:e.jsx(m,{buttonText:"Fix all unsatisfactory responses",buttonType:"tertiary",size:"small",onClick:()=>{E(!0)},disabled:!W})})),e.jsx(u,{storeId:v,setShowUnsatisfactoryResponseModal:E,showUnsatisfactoryResponseModal:D,ChecklistType:U,UnsatisfactoryResponseIntentList:M,IntentHeaderTitle:O,fetchUnsatisfactoryResponseCountIntentWise:k,viewIntentWiseUnsatisfactoryResponse:R}),w&&(null==w?void 0:w.length)>0&&e.jsx("div",Object.assign({className:"wrapper"},{children:w.map(((s,t)=>e.jsxs("div",Object.assign({className:"bubble",onClick:()=>{C(s.messageId),A(s.messageId)},style:S===s.messageId?{backgroundColor:a.surface.hovered}:{}},{children:[e.jsx(f,Object.assign({style:{color:a.content.primary}},{children:s.message})),e.jsx("div",{children:e.jsxs(g,Object.assign({style:{color:a.content.secondary}},{children:[o(new Date(null==s?void 0:s.date),"hh:mm a")," |"," ",o(new Date(null==s?void 0:s.date),"dd/MM/yyyy")]}))})]}),s.messageId)))}))]})]})}))};export{b as UnsatisfactoryResponseList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.696",
3
+ "version": "0.0.697-1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",